texts
sequence | tags
sequence |
---|---|
[
"Create an SSH tunnel to legacy application's open socket connection",
"I have a legacy application that I can't modify that accepts an open socket connection on port 8320 that is running on a linux device. \n\nI would like to make it so that any clients trying to connect to the legacy app would have to make an ssh connection which would then tunnel the traffic to open socket connection created by the legacy application on port 8320. \n\nI only want to make changes to the legacy linux device though. I couldn't find any examples that matched my scenario as most of the port forwarding examples involve forwarding traffic to another remote computer. \n\nWhat configuration steps do I need to take?\n\nThanks in advance."
] | [
"ssh",
"openssh",
"ssh-tunnel"
] |
[
"Hibernate: lockMode for criteria is not working",
"I need to specify lock mode for hibernate.\nWhat I am doing:\n\nsession().createCriteria(clazz, \"c\")\n .add(Restrictions.eq(\"c.a\", false))\n .add(Subqueries.propertyEq(\"c.b\", subquery))\n .setLockMode(\"pos\", LockMode.PESSIMISTIC_READ);\n\n\nBut when I see provided query - hibernate still doesn't provide SELECT FOR UPDATE\n\nHow can I force hibernate to make SELECT FOR UPDATE clause?\nI see only case when it works is this:\n\nsession().get(clazz, id, LockOptions.UPGRADE);\n\n\nBut I need to use more complex query."
] | [
"hibernate",
"optimistic-locking",
"pessimistic-locking"
] |
[
"PostgreSQL database data not showing on DSpace repository after rebuilding",
"Recently migrated from a DSpace 5.5 installation to DSpace 6.2. Successfully restored the database from a PostgreSQL DB dump and have no issues with the database connection, DSpace installation and building, however, no data (i.e. Communities and Records) display on the site. Worked well once before but after executing a number of xmlui changes no data. Where am I going wrong?"
] | [
"postgresql",
"dspace"
] |
[
"Read CSV file with 3 columns into Datastream. JAVA Apache Flink",
"I've been struggling for a while setting up a flink application that creates a Datastream<Tuple3<Integer, java.sql.Time, Double>> from a csv file. The columns in this file (columns ID, dateTime and Result) are all String but they should be converted to Integer, java.sql.Time and Double. The other thing I want is to create tumbling windows with data per day and average the values of the result column in that window. The problem is that I dont know the exact syntax for it. See my code below what I tried. The last part I have sum(2), but I want to calculate the average for the windows. I did not see in a function for this in the documentation. Do I need to write a method myself for this?\n\n\nDataStream<Tuple3<String, java.sql.Time>> dataStream = env\n .readfile(path)\n .map()\n .keyBy(0)\n .timeWindow(Time.days(1));"
] | [
"java",
"apache-flink",
"data-stream",
"streaming-analytics"
] |
[
"Categorical plot of with data of multiple columns and their mean",
"I'd like to create a categorical plot of two pandas DataFrame columns a and b in the same figure with shared x and different y axis:\n\nimport pandas as pd\nimport seaborn as sns\n\nexample = [\n ('exp1','f0', 0.25, 2),\n ('exp1','f1', 0.5, 3),\n ('exp1','f2', 0.75, 4),\n ('exp2','f1', -0.25, 1),\n ('exp2','f2', 1, 2),\n ('exp2','f3', 0, 3)\n]\ndf = pd.DataFrame(example, columns=['exp', 'split', 'a', 'b'])\nmean_df = df.groupby('exp')['a'].mean()\ng = sns.catplot(x='exp', y='a', data=df, jitter=False)\nax2 = plt.twinx()\nsns.catplot(x='exp', y='b', data=df, jitter=False, ax=ax2)\n\n\nIn this implementation I have the problem that the colors are different for categories (x-values), not for the columns. Can I sole this or do I have to change the data structure?\n\nI would also like to connect the means of the categorical values like in the image like this:"
] | [
"pandas",
"matplotlib",
"seaborn"
] |
[
"YouTube API v3 stopped returning status.publishAt",
"When I request the video resource (using the official PHP library) example:\n\n$youtube->videos->listVideos($ytVideoID, \"snippet, contentDetails, status\");\n\n\nthe API stopped returning status.publishAt couple months ago.\n\nI am getting only this now:\n\n[status] => Array\n(\n [uploadStatus] => processed\n [privacyStatus] => private\n [license] => youtube\n [embeddable] => 1\n [publicStatsViewable] => 1\n)\n\n\nI need the response to look something like this:\n\n[status] => Array\n(\n [publishAt] => '2015-07-15T22:45:00'\n [uploadStatus] => processed\n [privacyStatus] => private\n [license] => youtube\n [embeddable] => 1\n [publicStatsViewable] => 1\n)\n\n\nI did not change anything in my code, the API just stopped returning the publishAt parameter one day. I did not managed to find any reference to any change in the API.\n\nAll the videos I am trying to load, have status: scheduled (private), so the publishAt parameter should be there."
] | [
"php",
"youtube",
"youtube-data-api"
] |
[
"Adding grid in gnuplot",
"I've the following script that runs fine in gnuplot (unfortunately I've an old version, and for now I can't do much about it, it's the 4.0).\n\nset xlabel \"y\" \nset ylabel \"rw[j]\"\nset title \"P-D diagram\"\nset zeroaxis\n\nset xzeroaxis\nplot [0.5:1] \\\n-5.71429*x title \"L[-5]\" linetype 1, \\\n-4.28571*x title \"U[-5]\" linetype 3, \\\n-4.71429*x title \"L[-4]\" linetype 1, \\\n-3.28571*x title \"U[-4]\" linetype 3, \\\n-3.71429*x title \"L[-3]\" linetype 1, \\\n-2.28571*x title \"U[-3]\" linetype 3, \\\n-2.71429*x title \"L[-2]\" linetype 1, \\\n-1.28571*x title \"U[-2]\" linetype 3, \\\n-1.71429*x title \"L[-1]\" linetype 1, \\\n-0.285714*x title \"U[-1]\" linetype 3, \\\n-0.714286*x title \"L[0]\" linetype 1, \\\n0.714286*x title \"U[0]\" linetype 3, \\\n0.285714*x title \"L[1]\" linetype 1, \\\n1.71429*x title \"U[1]\" linetype 3, \\\n1.28571*x title \"L[2]\" linetype 1, \\\n2.71429*x title \"U[2]\" linetype 3, \\\n2.28571*x title \"L[3]\" linetype 1, \\\n3.71429*x title \"U[3]\" linetype 3, \\\n3.28571*x title \"L[4]\" linetype 1, \\\n4.71429*x title \"U[4]\" linetype 3, \\\n4.28571*x title \"L[5]\" linetype 1, \\\n5.71429*x title \"U[5]\" linetype 3\npause - 1\n\n\nBelow a picture (I know... it's quite bad but it doesn't matter for now...).\n\n\nWhat I want to do is to add a kind of grid, if I use the grid command with xticks, yticks setting etc I get a grid however when I perform the zoom the grid isn't zoomed as well (I.e. it does depend from the window and not from the global coordinate system).\n\nWhat I want to do is kind of setting lines for each dy = 0.5 for example, similarly to dx = 0.25. This is because the spacing, and therefore the whole script, is derived using a small C++ program. Is there anyway to achieve this?"
] | [
"gnuplot"
] |
[
"Javascript uploading file alignment",
"In the above image the delete button need to align properly. in my code it get align based on file name length. \n\n <script>\n var filelist = new Array();\n\n updateList = function () {\n var input = document.getElementById('fileUploader');\n var output = document.getElementById('divFiles');\n\n var HTML = \"<table>\";\n for (var i = 0; i < input.files.length; ++i) {\n filelist[i]=input.files.item(i).name;\n HTML += \"<tr><td>\" + filelist[i] + \"</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button ></button></td></tr>\";\n }\n HTML += \"</table>\";\n output.innerHTML += HTML;\n }\n </script>"
] | [
"javascript",
"jquery"
] |
[
"How to get pid from pthread",
"in RH Linux, every pthread is mapping to a pid, which can be monitored in tools such as htop. but how can i get the pid of a thread? getpid() just return the pid of the main thread."
] | [
"c++",
"linux",
"pthreads"
] |
[
"Struts 2 stream result download when no data is available",
"I am trying to dynamically generate a file for user to download depending on the records in database. I have successfully done this by using stream result.\n\nThe problem is, when there is no data available to download, I want to show a dialog in the browser to tell the user 'No data available'. \n\nCan anybody tell me how should this be done? When there is no data, the input stream to download is null and there will be exception..\n\nThanks"
] | [
"struts2"
] |
[
"MongoDB: mongod shows that my app is not authorized",
"I have installed mongodb and my mongodb and db folders are C:/mongoDB/bin and C:/data/db respectively. I have also setup admin user as stated on\nhttps://docs.mongodb.com/manual/tutorial/enable-authentication/\n\nNow i want to perform basic CRUD operations requiring both read and write on a database mApp through Express and Mongoose. I am providing code for both app and schema below.\n\nCode is well documented so that it is easy to understand.\n\nApp.js\n\n\r\n\r\nvar express = require('express');\r\nvar app = express();\r\n\r\n//Invoking user\r\nvar User = require('./schema.js');\r\n\r\n//Creating an employee object by giving values to all properties\r\nvar User1 = new User({\r\n name: 'Anurag',\r\n username: 'Anurag2',\r\n password: 'abc',\r\n admin: false,\r\n location: 'somewhere',\r\n meta: {\r\n age: 25,\r\n website: 'abc.com'\r\n },\r\n createdAt: 'Jun 11 2017',\r\n updatedAt: 'Jun 11 2017'\r\n}); //Remember to provide all records,otherwise document wont be saved.\r\n\r\n//CRUD start. Creating a user document\r\nUser1.save(function(err, employ, num) {\r\n if (err) {\r\n console.log('error occurred');\r\n }\r\n console.log('saved ' + num + ' record');\r\n console.log('Details ' + employ);\r\n});\r\n\r\n/* To retrieve documents from database, you can retrieve all at\r\n once, or one at a time by find(), findById(), findOne() */\r\n\r\n//To retrieve all documents\r\nUser.find({}, function(err, data) {\r\n if (err) {\r\n console.log('error occurred while retrieving all docs');\r\n }\r\n console.log(data);\r\n});\r\n\r\nUser.findOne({\r\n username: 'Anurag2'\r\n}, function(err, data) {\r\n if (err) {\r\n console.log('error in finding one document');\r\n }\r\n console.log(data);\r\n});\r\n\r\nUser.update({\r\n location: 'someplace'\r\n}, {\r\n location: 'anything'\r\n}, function(err) {\r\n if (err) {\r\n console.log('error in updating');\r\n }\r\n console.log('updated');\r\n});\r\n\r\n//update one document\r\nUser.findOneAndUpdate({\r\n username: 'Anurag2'\r\n}, {\r\n admin: true\r\n}, function(err, data) {\r\n if (err) {\r\n console.log('error in finding and updating');\r\n }\r\n console.log('updated' + data);\r\n});\r\n\r\n//Delete a user document\r\nUser.remove({\r\n location: 'anywhere'\r\n}, function(err) {\r\n if (err) {\r\n console.log('error occurred');\r\n }\r\n console.log('removed');\r\n});\r\n\r\n\r\n\n\nDB Schema(schema.js)\n\n\r\n\r\nvar mongoose = require('mongoose');\r\nmongoose.connect('mongodb://localhost/mApp'); //myApp is the database being connected here.\r\n\r\n\r\n//now we open a connection\r\nvar db = mongoose.connection;\r\ndb.once('open', function() {\r\n console.log('Connected to Database');\r\n});\r\ndb.on('error', console.error.bind(console, 'connection error'));\r\n\r\n//initialising a schema\r\nvar Schema = mongoose.Schema;\r\n\r\nmongoose.Promise = require('bluebird'); //used as mpromise was showing deprecated on console.\r\n\r\n\r\n//creating a schema\r\nvar userSchema = new Schema({\r\n name: String,\r\n username: {\r\n type: String,\r\n required: true,\r\n unique: true\r\n },\r\n password: {\r\n type: String,\r\n Required: true\r\n },\r\n admin: Boolean,\r\n location: String,\r\n meta: {\r\n age: Number,\r\n website: String\r\n },\r\n createdAt: Date,\r\n updatedAt: Date\r\n});\r\n\r\n//creating a model that uses this schema\r\nvar User = mongoose.model('User', userSchema);\r\n\r\n//now we export this model\r\nmodule.exports = User;\r\n\r\n\r\n\n\nNow, I login in mongo through admin and i changed the db to mApp. I run the app through node.\n\nThe mongod console shows I am not authorized to perform any actions on the app.\n\nNo query gets executed and I get all error messages. Why is this happening? Please help me with this."
] | [
"node.js",
"mongodb",
"express",
"mongoose"
] |
[
"Unable to verify leaf signature npm",
"const express = require('express');\nconst https = require('https'); \nconst app = express();\n\n\napp.get("/" , function(req, res) {\n const url = "https://api.openweathermap.org/data/2.5/weather?q=Bhubaneswar&appid=5b1ee8df0720f3eca886c9ca1cb03385&units=metric";\n\n https.get(url, function(request, response){\n console.log(response);\n });\n\n res.send("Server is up & running");\n});\n\napp.listen(5000, function() {\n console.log("Server is running at port 5000");\n});\n\n[Nodemon app getting crashed][1]\n[1]: https://i.stack.imgur.com/rka1M.jpg\nWhen ever am running the nodemon, error is arising as UNABLE_TO_VERIFY_LEAF_SIGNATURE. Even tried several ways provided bu Stack Overflow & GitHub. Still none of them worked out."
] | [
"javascript",
"express",
"npm"
] |
[
"Can't manually create user using devise because of 'admin' field",
"Using Devise, I created the user model, and later I added an :admin field with default => false to my model using a migration.\nNow I need to manually create an admin user ,so in the rails console I tried : \nsuperadmin = User.create({ :email => '[email protected]', :password => '12345678' , :admin=> true })\nbut getting the error below :\n\n\n ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes: admin\n from /var/lib/gems/1.9.1/gems/activemodel-3.2.13/lib/active_model/mass_assignment_security/sanitizer.rb:48:in process_removed_attributes'\n from /var/lib/gems/1.9.1/gems/activemodel-3.2.13/lib/active_model/mass_assignment_security/sanitizer.rb:20:indebug_protected_attribute_removal'\n from /var/lib/gems/1.9.1/gems/activemodel-3.2.13/lib/active_model/mass_assignment_security/sanitizer.rb:12:in sanitize'\n from /var/lib/gems/1.9.1/gems/activemodel-3.2.13/lib/active_model/mass_assignment_security.rb:230:insanitize_for_mass_assignment'\n from /var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/attribute_assignment.rb:75:in assign_attributes'\n from /var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/base.rb:498:ininitialize'\n from /var/lib/gems/1.9.1/gems/devise-2.2.4/lib/devise/models/confirmable.rb:46:in initialize'\n from /var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/persistence.rb:44:innew'\n from /var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/persistence.rb:44:in create'\n from (irb):4\n from /var/lib/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:instart'\n from /var/lib/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in start'\n from /var/lib/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in'\n from script/rails:6:in require'\n from script/rails:6:in'\n\n\nso is there another way of creating users manually?(using command)"
] | [
"ruby-on-rails-3",
"devise",
"admin"
] |
[
"Android webview has different rendering engine than Chrome -- How do I find the browser",
"I am using android.webkit.WebView on an Android 4.3 (Nexus 7). Some pages look completely different in the web view vs Chrome browser on tablet.\n\nWhat browser engine is it actually using so I can have people test without having to install the application. Is there some sort of default Android browser besides Chrome?"
] | [
"android",
"google-chrome",
"webview"
] |
[
"How do I read the results of a stored proc into it's complex type",
"I've created my stored procedure, I've created the complex type using the entity model. Now assuming I have successfully established a connection to the database - I'm now ready to run the store procedure and store the rows in a List<ComplexType>. How do I do this in the best, most efficient way? I'm aware that I can iterate through the columns and rows of an SQLDataReader but it sort of feels like I'd be missing the point of the entity framework.\n\nThanks a lot."
] | [
"c#",
"sql",
"entity-framework"
] |
[
"How to count the number of occurrences of a string in a file and append it within another file",
"I need to count the number of occurrences of 'Product ID' in the .txt file and have it print the number within that file. I'm new to python and trying to wrap my head around this. I have it working separately in the code, but it prints the number to the command line after running the program (hence the print). I tried using print(count) >> \"hardDriveSummary.txt file\" and print >> count, \"hardDriveSummary.txt file\" but can't get it to work. \n\n# Read .xml file and putlines row_name and Product ID into new .txt file\nsearch = 'row_name', 'Product ID'\n\n#source file\nwith open('20190211-131516_chris_Hard_Drive_Order.xml') as f1:\n #output file\n with open('hardDriveSummary.txt', 'wt') as f2:\n lines = f1.readlines()\n for i, line in enumerate(lines):\n if line.startswith(search):\n f2.write(\"\\n\" + line)\n\n#count how many occurances of 'Product ID' in .txt file\ndef main():\n\n file = open('hardDriveSummary.txt', 'r').read()\n team = \"Product ID\"\n count = file.count(team)\n\n print(count)\n\nmain()\n\n\nSample of hardDriveSummary.txt:\n\nName Country 1\n\nProduct ID : 600GB\n\nName Country 2\n\nProduct ID : 600GB\n\nName Country 1\n\nProduct ID : 450GB\n\n\nContents of .xml file:\n\n************* Server Summary *************\n\nServer serv01\nlabel R720\nasset_no CNT3NW1\nName Country 1\nname.1 City1\nUnnamed: 6 NaN\n\n************* Drive Summary **************\n\nID : 0:1:0\nState : Failed\nProduct ID : 600GB\nSerial No. : 6SL5KF5G\n\n\n************* Server Summary *************\n\nServer serv02\nlabel R720\nasset_no BZYGT03\nName Country 2\nname.1 City2\nUnnamed: 6 NaN\n\n************* Drive Summary **************\n\nID : 0:1:0\nState : Failed\nProduct ID : 600GB\nSerial No. : 6SL5K75G\n\n\n************* Server Summary *************\n\nServer serv03\nlabel R720\nasset_no 5GT4N51\nName Country 1\nname.1 City1 \nUnnamed: 6 NaN\n\n************* Drive Summary **************\n\nID : 0:1:0\nState : Failed\nProduct ID : 450GB\nSerial No. : 6S55K5MG"
] | [
"python",
"file",
"count"
] |
[
"Web Audio filter for visuals and not sound",
"How would I use a filter on the AnalyserNode data without that filter effecting the song that is being played?"
] | [
"javascript",
"web-audio-api"
] |
[
"Bonjour issues on iOS",
"I'm trying to create a Bonjour service in my iOS application, but can't get it to publish. Only the netServiceWillPublish delegate method is ever called and the service isn't showing up using dns-sd.\n\nHere's my code:\n\nvar service: NetService? = nil\n\nfunc start() {\n createSockets()\n\n service = NetService(domain: \"test\", type: \"_test._tcp.\", name: \"Test\", port: Int32(port))\n service?.delegate = self\n service?.startMonitoring()\n service?.publish()\n service?.setTXTRecord(NetService.data(fromTXTRecord: [\n \"model\": \"AppleTV3,2,1\".data(using: .utf8)!,\n \"srcvers\": \"160.10\".data(using: .utf8)!,\n \"features\": \"0x100009FF\".data(using: .utf8)!,\n \"deviceId\": \"b8:53:ac:43:f3:15\".data(using: .utf8)!,\n \"pw\": \"0\".data(using: .utf8)!,\n \"rmodel\": \"MacBookPro10,2\".data(using: .utf8)!\n ]))\n\n}\n\nprivate func createSockets() {\n ipv4Socket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketAutomaticallyReenableAcceptCallBack, socketCallback, nil)\n\n var sin = sockaddr_in()\n\n memset(&sin, 0, MemoryLayout<sockaddr_in>.size)\n sin.sin_len = __uint8_t(MemoryLayout<sockaddr_in>.size)\n sin.sin_family = sa_family_t(AF_INET); /* Address family */\n sin.sin_port = in_port_t(port) /* Or a specific port */\n sin.sin_addr.s_addr = INADDR_ANY\n\n let sincfd = withUnsafePointer(to: &sin) {\n $0.withMemoryRebound(to: UInt8.self, capacity: MemoryLayout<sockaddr_in>.size) {\n return CFDataCreate(kCFAllocatorDefault, $0, MemoryLayout<sockaddr_in>.size)\n }\n }\n\n CFSocketSetAddress(ipv4Socket, sincfd)\n\n let socketsource = CFSocketCreateRunLoopSource(\n kCFAllocatorDefault,\n ipv4Socket,\n 0);\n\n CFRunLoopAddSource(\n CFRunLoopGetCurrent(),\n socketsource,\n CFRunLoopMode.defaultMode);\n}\n\n\nI'm new to this type of networking in iOS, what am I doing wrong here?"
] | [
"ios",
"swift",
"sockets",
"bonjour"
] |
[
"Can programatically created object can access spring context via annotations?",
"Let's say I have following spring.xml (SomeBean is managed by spring)\n\n<bean id=\"some_bean\" class=\"SomeBean\" />\n\n\nand class (this one is not managed)\n\npublic class MyClass {\n @<some magic or something else?>\n private SomeBean sb;\n}\n\n\nand my main\n\npublic class Main {\n public static void main(String[] args) {\n new MyClass().getSB();\n }\n}\n\n\nHow to make that by creation of new class (using new keyword) MyClass instance have access to bean with id=\"some_bean\"?"
] | [
"java",
"spring",
"spring-mvc"
] |
[
"How to create a controller in Web Api to update the lucene.net index?",
"I'm creating a lucene.net for search engine in web api ,and i want to update the index and create a POST controller to return the update method,and here s the update method for index:\n\n private void QueueToIndex(object para)\n {\n while (true)\n {\n if (bookQueue.Count > 0)\n {\n CRUDIndex();\n }\n else\n {\n Thread.Sleep(3000);\n }\n }\n }\nprivate void CRUDIndex()\n{\n Video_List video = new Video_List();\n\n FSDirectory directory = FSDirectory.Open(new DirectoryInfo(Path), new \nNativeFSLockFactory());\n bool isExist = IndexReader.IndexExists(directory);\n if (isExist)\n {\n if (IndexWriter.IsLocked(directory))\n {\n IndexWriter.Unlock(directory);\n }\n }\n IndexWriter writer = new IndexWriter(directory, new PanGuAnalyzer(), \n!isExist, IndexWriter.MaxFieldLength.UNLIMITED);\n while (bookQueue.Count > 0)\n {\n Document document = new Document();\n BookViewMode book = bookQueue.Dequeue();\n if (book.IT == IndexType.Insert)\n {\n document.Add(new Field(\"id\", book.ID.ToString(), \nField.Store.YES, Field.Index.NOT_ANALYZED));\n document.Add(new Field(\"title\", book.Title, Field.Store.YES, \nField.Index.ANALYZED,\n\nField.TermVector.WITH_POSITIONS_OFFSETS));\n document.Add(new Field(\"content\", book.Starring, \nField.Store.YES, Field.Index.ANALYZED,\n\nField.TermVector.WITH_POSITIONS_OFFSETS));\n writer.AddDocument(document);\n }\n else if (book.IT == IndexType.Delete)\n {\n writer.DeleteDocuments(new Term(\"id\", book.ID.ToString()));\n }\n else if (book.IT == IndexType.Modify)\n {\n\n writer.DeleteDocuments(new Term(\"id\", book.ID.ToString()));\n document.Add(new Field(\"id\", book.ID.ToString(), \nField.Store.YES, Field.Index.NOT_ANALYZED));\n document.Add(new Field(\"title\", book.Title, Field.Store.YES, \nField.Index.ANALYZED,\n\nField.TermVector.WITH_POSITIONS_OFFSETS));\n document.Add(new Field(\"content\", book.Starring, \nField.Store.YES, Field.Index.ANALYZED,\n\nField.TermVector.WITH_POSITIONS_OFFSETS));\n writer.AddDocument(document);\n }\n }\n writer.Dispose();\n directory.Dispose();\n}\n\n\nSo How can i return this method to controller like:\n\nprivate bool Update(BookViewMode model)\n {\n return ;\n }"
] | [
"c#",
"asp.net-web-api",
"controller",
"lucene.net"
] |
[
"Can I send messages to a JMS queue from outside the app server?",
"As I understand it, a J2EE container is required to include a JMS provider. Is it possible for a standalone Java application to send messages to a JMS queue provided by the container? If so, how do I access the JNDI lookups from outside the container?\n\n(I am trying this with Geronimo if it makes any difference, but I am hoping there is a standard way of doing this.)"
] | [
"java",
"jakarta-ee",
"jms"
] |
[
"I am Trying to create a webview activity but the whole website is not loaded",
"Recently i developed a Webapp in codeignitor(php). Now i am trying to convert into WebviewActivity for Android.\n\nActivity when open in Android browser\n\nit works fine\n\n\n\nbut when opened in Webview activity App i get this\n\nHalf side of Website blank\n\n\nMethods i tried \n\n\nwebView.setWebViewClient(new WebViewClient() )\nwebView.setWebChromeClient(new MyWebChromeClient(this))\n\n\ni have been stuck on this problem from several hours. searched everywhere but did not find the right answer\n\nXML\n\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\" android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n tools:context=\".MainActivity\">\n\n <WebView\n android:id=\"@+id/activity_main_webview\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\" />\n\n</RelativeLayout>"
] | [
"android",
"android-webview"
] |
[
"How to swap two fields of a struct",
"I've started studying Rust and I'm trying to implement a simple 1D cellular automata. I want to represent the automata state (Board) as struct holding the size and two different vectors (of same size). I tried: \n\nstruct Board {\n n: usize,\n cur: Vec<u32>,\n next: Vec<u32>,\n}\n\nimpl Board {\n fn new(size: usize) -> Board {\n Board {\n n: size,\n cur: vec![0;size],\n next: vec![0;size],\n }\n }\n}\n\n\nSo far so good. I'm also able of mutating both vectors. But then I want to be able to swap both vectors (or rather their references), such as:\n\nfn swap(&mut self) -> &Board {\n let tmp = self.cur;\n self.cur = self.next;\n self.next = tmp;\n self\n}\n\n\nIt fails, with an cannot move out of borrowed content [E0507] which I think I can understand. I also tried mem::swap which I found in a similarly title question without success.\n\nHow can I make this example work ? (Since I'm a total beginner with Rust, don't hesitate to suggest a different data representation)."
] | [
"struct",
"reference",
"rust",
"swap"
] |
[
"reading namespace kml error NullReferenceException c#",
"i want to parse kml in my c# app.\n\nXmlDocument doc = new XmlDocument();\ndoc.Load(fileKml);\nXmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);\nns.AddNamespace(\"x\", \"http://www.opengis.net/kml/2.2\");\nXmlNode nodeKmlns = doc.SelectSingleNode(\"/x:kml\", ns); string sKmlns = nodeKmlns.InnerText;\nXmlNode nodeName = doc.SelectSingleNode(\"GroundOverlay/name\"); string sName = nodeName.InnerText;\nXmlNode nodehref = doc.SelectSingleNode(\"GroundOverlay/Icon/href\"); string shref = nodehref.InnerText;\nXmlNode north = doc.SelectSingleNode(\"GroundOverlay/LatLonBox/north\"); string snorth = north.InnerText; double yn = Convert.ToDouble(snorth);\nXmlNode south = doc.SelectSingleNode(\"GroundOverlay/LatLonBox/south\"); string ssouth = south.InnerText; double ys = Convert.ToDouble(ssouth);\nXmlNode east = doc.SelectSingleNode(\"GroundOverlay/LatLonBox/east\"); string seast = east.InnerText; double xe = Convert.ToDouble(seast);\nXmlNode west = doc.SelectSingleNode(\"GroundOverlay/LatLonBox/west\"); string swest = west.InnerText; double xw = Convert.ToDouble(swest);\n\n\nand here is my .kml\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n<GroundOverlay>\n <name>osm_bandung</name>\n <Icon>\n <href>files/osm_bandung.png</href>\n <viewBoundScale>0.75</viewBoundScale>\n </Icon>\n <LatLonBox>\n <north>-6.928631334672425</north>\n <south>-6.956054957857409</south>\n <east>107.6467976125619</east>\n <west>107.6030622981136</west>\n </LatLonBox>\n</GroundOverlay>\n</kml>\n\n\ni use addNameSpace but still error\nwhen running, the code error in line \n\nXmlNode nodeName = doc.SelectSingleNode(\"GroundOverlay/name\"); string sName = nodeName.InnerText;\n\n\nthe error is NullReferenceException Object reference not set to an instance of an object.\n\nhow to fix that?"
] | [
"c#",
"xml",
"kml"
] |
[
"Retrieving images from MS Access database and display under form",
"I save my images in the database as an OLE Object Data type.How can an image from the database displayed in the tag? Is it also in the 'src' attribute?"
] | [
"c#",
"asp.net"
] |
[
"User input in doubly linked",
"I am trying to build a program that takes in user input and then reverses the input. The output displays both the original and reverses string. The program compiles but gives me the following error \"0ÿÿÿ; Original Linked list Segmentation Fault (core dumped)\"\n\nHere is my code: \n\n struct node\n {\n int info;\n struct node *next;\n struct node *prev;\n }node;\n void reverse(struct node **head_1)\n {\n struct node *temp = NULL;\n struct node *current = *head_1;\n while (current != NULL)\n {\n temp = current->prev;\n current->prev = current->next;\n current->next = temp;\n current = current->prev;\n } \n if(temp != NULL )\n *head_1 = temp->prev;\n } \nvoid push(struct node** head_1, int new_data)\n{\n struct node* new_node =\n (struct node*) malloc(sizeof(struct node));\n\n new_node->info = new_data;\n new_node->prev = NULL;\n new_node->next = (*head_1); \n if((*head_1) != NULL)\n (*head_1)->prev = new_node ; \n (*head_1) = new_node;\n }\nvoid printList(struct node *node)\n{\nwhile(node!=NULL)\n {\n printf(\"%s \", node->info);\n node = node->next;\n }\n }\n\n int main()\n {\nstruct node* head = NULL;\nchar str[300], ch;\nint i;\nprintf(\"enter \");\n while((ch=getchar())!='\\n');\n{\nstr[i++]=ch;\nstr[i]='0';\ni=0;\n}\n while (str[i]!='\\0')\n{ \nputchar(str[i++]);\npush(&head, ch);\n}\n printf(\"\\n Original \");\n printList(head);\n reverse(&head);\n printf(\"\\n Reversed \");\n printList(head); \n\n getchar();\n }"
] | [
"c",
"clang"
] |
[
"Moment.js retrieving a different date when using toDate() and format()",
"I need to get the current date in my TypeScript application. It is now 13:35 for me.\n\nWhen using moment(Date.now()).toDate() I get the current date, but an hour too early than what I would expect: \n\"2020-03-26T12:35:12.938Z\" \nThis gives me 12:35.\n\nWhen using moment(Date.now()).format(\"DDMMYYYY_HHmm\") I get the current date with the hour I am expecting: \"26032020_1335\" \nThis gives me 13:35.\n\nWhat am I missing here to get the correct date and time?\nTo be clear, i need a Date object. Not a string."
] | [
"javascript",
"typescript",
"datetime",
"momentjs"
] |
[
"Sort the value with DBNull using Queryable.OrderBy it throws Exception",
"When I try to sort the value with DBNull using Queryable.OrderBy it throws Exception.\n\n Pet[] pets =\n {\n new Pet {Name = \"Barley\", Age = 8},\n new Pet {Name = DBNull.Value, Age = 1},\n new Pet {Name = \"Boots\", Age = 4}\n };\n\n // Sort the Pet objects in the array by Pet.Name\n IEnumerable<Pet> query = pets.AsQueryable().OrderBy(pet => pet.Name);\n foreach (Pet pet in query)\n Console.WriteLine(\"{0} - {1}\", pet.Name, pet.Age);\n\n\nBelow code throws exception because I'm using DBNull. I know i can overcome this problem by using the code below,\n\n IEnumerable<Pet> query = pets.AsQueryable().OrderBy(delegate(Pet pet)\n {\n if (pet.Name is DBNull)\n return null;\n return pet.Name;\n });\n\n\nBut i can't use this code. Is there any way to handle this problem without adding condition check in OrderBy function."
] | [
"c#",
"wpf",
"linq"
] |
[
"Adding values to charts in R Leaflet.minicharts",
"I want to add values above my chart, using lealfet.minicharts package.\n\nMy current code looks like this\n\naddMinicharts(\n87.2180, -45.3496,\nchartdata = c(20, 40),\ncolorPalette = c(\"darkred\", \"darkblue\"),\nwidth = 45, height = 45, popup = popupArgs(\nlabels = c(\"Test1\", \"Test2\")), showLabels = TRUE, labelText = TRUE) \n\n\nIt gives me a chart with a labels \"true\" and pop-up window with labels and values. But I would like to have values (not labels) on the top of charts or inside on bars (instead of text).\n\nLooking into documentation and cannot figure it out. \nThanks"
] | [
"r",
"leaflet"
] |
[
"how can i insert multiple profileId in profile User Links",
"I want to put the authority into multiple profileId at once.\nIs that possible?\nenter image description here"
] | [
"google-apis-explorer"
] |
[
"PHP Mess Detector giving false positives",
"I'm working with an open source project and thought it would be a good idea to implement automated code revisions with phpmd.\n\nIt showed me many coding mistakes that im fixing already. But one of them made me curious.\n\nConsider the following method:\n\n/**\n * \n * @param string $pluginName\n */\npublic static function loadPlugin($pluginName){\n $path = self::getPath().\"plugins/$pluginName/\";\n $bootPath = $path.'boot.php';\n if(\\is_dir($path)){\n\n //Autoload classes\n self::$classloader->add(\"\", $path);\n\n //If theres a \"boot.php\", run it\n if(is_file($bootPath)){\n require $bootPath;\n }\n\n }else{\n throw new \\Exception(\"Plugin not found: $pluginName\");\n }\n}\n\n\nHere, phpmd says that Else is never necessary\n\n\n ...An if expression with an else branch is never necessary. You can\n rewrite the conditions in a way that the else is not necessary and the\n code becomes simpler to read. ...\n\n\nis_dir will return false whenever the given path is a file or simply does not exist, so, in my opinion, this test is not valid at all.\n\nIs there a way to fix it or maybe simply ignore cases like this one?"
] | [
"php",
"coding-style",
"conventions",
"phpmd"
] |
[
"Does an accurate visualization of floating-point 3-space exist?",
"The closest thing I can find is the figure in this Gamasutra article. I'm wondering specifically if there are other, more extensive/accurate, visualizations of 32 bit floating-point 3-space?"
] | [
"floating-point",
"visualization",
"data-visualization"
] |
[
"Select Active and Recently Completed \"Tasks\" from Table",
"I have a Tasks table something like;\n\n PK TaskId\n TaskName\n Notes\n ...\n ...\n FK StatusId\n DateCompleted\n\n\nWhat I want to do is get a list if tasks that are active plus any tasks completed in the last 7 days.\n\nAt the moment I have;\n\nvar then = DateTime.Today.AddDays(-7);\nreturn _db.Tasks\n .Where(t => (t.StatusId != 1))\n .Union(_db.Tasks\n .Where(t => (t.DateCompleted >= then))\n );\n\n\nIs this the most sensible way to do it? I am creating the DB from scratch so that can change to suit a better method :)\n\nCheers\nSi"
] | [
"linq",
"database-design",
"entity-framework-4"
] |
[
"Connect python script running on App Engine to Oracle database",
"Is it possible to connect a python script running on Google App Engine to a remote oracle database?. \n\nPython needs cx_oracle library for the connection and cx_oracle library needs \"oracle SQL client\" installed in the server that script is running. \n\nThanks"
] | [
"python",
"oracle",
"google-app-engine"
] |
[
"How to do a cross-join in SQLAlchemy?",
"How do I do a cross join in SQLAlchemy? I can't find anything in the docs, nor examples.\nFor example:\nSELECT * from A CROSS JOIN B\n\nIn my particular case I want to cross join with an unnested (PSQL) array:\nSELECT a.id, b_elm FROM a CROSS JOIN (SELECT unnest(b.elms) as b_elm FROM b) AS B_SUB"
] | [
"postgresql",
"sqlalchemy"
] |
[
"What component of an OS implement device files?",
"Are device files of devices (e.g. /dev/sda1) implemented by some component inside an OS (more specifically, Linux or Unix-like OS)? \n\nAre device files of devices implemented by any of the following components of the IO system of an OS:\n\n\n\"device-independent OS software\", \n\"device drivers\", or \nsomething else in an OS?\n\n\nSee Tanenbaum's Modern OS's sketch of layers of the I/O software system, where the OS consists of the middle three layers:\n\n\n\nI learned that devices files belong to the interface provided by device drivers, so I think device files are implemented by device files.\n\nBut device files are intended to allow users treat different devices in an uniform way as files in file systems. That makes me think that device files belong to the interface provided by the outmost component of an OS, which according to the sketch is \"device-independent OS software\". \n\nSo I am not sure."
] | [
"linux",
"file",
"operating-system",
"device",
"device-driver"
] |
[
"How to sum list of tuples?",
"I have a list of tuples:\n\n[ (a,1), (a,2), (b,1), (b,3) ]\n\n\nI want to get the sum of both the a and b values. The results should be in this format:\n\n[ { 'key' : a, 'value' : 3 }, {'key' : b, 'value' : 4 } ]\n\n\nHow can I do this?"
] | [
"python"
] |
[
"ngClass not rendering properly",
"I am loading a todos list, every todo has a flag field which if true the ng-class should apply. When loading data into the page ng-class is applied if I use ng-class=\"{'completed': todo.isCompleted=='true'}\", but then it doesn't work when I play with the checkboxes.\n\nOn the other hand if I use ng-class=\"{'completed': todo.isCompleted==true}\" instead (without the quotes on the true), it loads the data without applying the ng-class at the beginning, means loading all as if they are false, but then it works fine when playing with the checkboxes.\n\nIt has been driving me crazy, couldn't figure out why.\n\n<ul id=\"todo-list\">\n <li ng-repeat=\"todo in todos\" ng-class=\"{'completed': todo.isCompleted==true}\" class=\"editing\">\n <div class=\"view\" >\n <input class=\"toggle\" type=\"checkbox\" ng-click=\"complete(todo)\" ng-model=\"todo.isCompleted\" ng-checked=\"{{todo.isCompleted}}\">\n <label ng-hide=\"isEditing\" ng-dblclick=\"isEditing = !isEditing\">{{todo.title}}</label>\n <button class=\"destroy\" ng-click=\"remove(todo)\"></button>\n </div>\n <input class=\"edit\" ng-show=\"isEditing\" ng-model=\"todo.title\" ng-blur=\"isEditing = !isEditing;edit(todo);\">\n </li>\n</ul>\n\n\nController\n\n$scope.complete = function(todo) {\n $scope.insertTodo(todo, UPDATE);\n};\n\n\nAny help is appreciated."
] | [
"angularjs",
"ng-class"
] |
[
"Tried to register two views with same name",
"I know this kind of question has been asked before but they are related to third party libraries, mine is related to requireNativeComponent\nI have created a React Native Component from a Native iOS component\nHere is my iOS code\nCanvasView File\nclass CanvasView: UIView {\n \n var lines = [[CGPoint]]()\n \n override init(frame: CGRect) {\n super.init(frame:frame)\n backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 0)\n }\n \n required init?(coder: NSCoder) {\n fatalError("init(coder:) has not been implemented")\n }\n \n override func draw(_ rect: CGRect) {\n super.draw(rect)\n \n guard let context = UIGraphicsGetCurrentContext() else {\n return\n }\n \n context.setStrokeColor(#colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1))\n context.setLineWidth(10)\n context.setLineCap(.butt)\n \n lines.forEach { (line) in\n for(i,p) in line.enumerated() {\n if i == 0 {\n context.move(to: p)\n } else {\n context.addLine(to: p)\n }\n }\n }\n \n \n \n context.strokePath()\n }\n \n override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {\n lines.append([CGPoint]())\n }\n \n override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {\n guard let point = touches.first?.location(in: nil) else {\n return\n }\n \n \n \n guard var lastLine = lines.popLast() else {return }\n lastLine.append(point)\n lines.append(lastLine)\n setNeedsDisplay()\n }\n}\n\nCanvas.swift File\nimport Foundation\n\n@objc(Canvas)\nclass Canvas: RCTViewManager {\n override func view() -> UIView! {\n return CanvasView()\n }\n \n override class func requiresMainQueueSetup() -> Bool {\n return true\n }\n \n}\n\nCanvas.m file\n#import <Foundation/Foundation.h>\n#import "React/RCTViewManager.h"\n\n\n@interface RCT_EXTERN_MODULE(Canvas, RCTViewManager)\n@end\n\nHere is my JS code\nconst Canvas = requireNativeComponent('Canvas');\n\nconst App = () => {\n return (\n <View style={styles.container}>\n <Canvas style={styles.bottom} />\n </View>\n );}\n\nthe code works fine, but even when I do some change in my react native code and do command+s to do fast refresh I keep getting error saying Tried to register two views with the same name Canvas, but when I run npx react-native run-ios, the code works fine. So all in all hot reloading or fast refresh is not supported when I include Native component created by me even though I am not changing the native component. I can understand if I change something in iOS swift or objective c code then I need to re-run npx react-native run-ios but even after no changes in iOS side and doing only changes in JS side I keep getting this error. There are not two views with same name of Canvas in my project. I also tried clearing watchman, deleting package.json and reinstalling npm modules and pod\nSame issue happens on android side as well"
] | [
"react-native",
"react-native-android",
"react-native-ios",
"react-native-native-module"
] |
[
"Instagram API OAuth & Endpoints update 04-30-2015",
"After a major Instagram API lots of instagram-based apps started to get access_token errors for all users that try to log in \n(tried to create new instagram client - didn't work) \nI'm using Thiago Locatelli & Lorensius W. L T android-instagram-omniauth https://github.com/thiagolocatelli/android-instagram-oauth\n\naccording to their code I get this error \"Failed to get access token\"\n\nHere is the code:\n\n static int WHAT_FINALIZE = 0;\n static int WHAT_ERROR = 1;\n private static int WHAT_FETCH_INFO = 2;\n\n... \n\n private Handler mHandler = new Handler() {\n @Override\n public void handleMessage(Message msg) {\n if (msg.what == WHAT_ERROR) {\n mProgress.dismiss();\n if (msg.arg1 == 1) {\n mListener.onFail(\"Failed to get access token\");\n } else if (msg.arg1 == 2) {\n mListener.onFail(\"Failed to get user information\");\n }\n } else if (msg.what == WHAT_FETCH_INFO) {\n // fetchUserName();\n mProgress.dismiss();\n mListener.onSuccess();\n }\n }\n};\n\n\nI think it may be the same issue as stated here:\nInstagram oAuth returning "No matching code found" on one server\n\nUPDATE: This issue may be fixed by changing your server ip adress, but there are not enough information on how should Instagram app be configured (does it have \"Enforce signed requests\" or \"Disable implicit OAuth\" enabled, etc.)\n\nDoes the WEBSITE_URL setting in the Instagram client app tell instagram about your server IP?\n\nBTW, right now when you try to save instagram client app's settings you get \"Sorry, an error occurred while processing this request\" that should mean some internal changes are being implemented right now...\n\nThanks a lot, mates!\n\nSOLVED:\n\nThe issue was solved by changing my local IP (I contacted my IS provider and changed IP to a different one). Probably Instagram blocked my previous shared IP for lots of requests so switching to a new one worked for me. Try to connect from mobile network (or any other network different from yours) if there is no error - you need to change your local ip. If the error persists - the reason might be your server IP"
] | [
"android",
"oauth",
"instagram",
"facebook-oauth",
"instagram-api"
] |
[
"How to addclass to parent or target class with Vue.js",
"How to add toggle class to .parent after click on \n\n<template>\n <div class=\"parent\">\n <a href=\"/\" @click=\"??????\">\n </div>\n</template>"
] | [
"vue.js",
"nuxt.js"
] |
[
"How does Spring Boot http2 handle browser requests that do not support http2 at the same time?",
"Spring Boot can support http/2 now, but if browser does not support http/2, can browser request server use http1.x+ssl with the same http port? Nginx can automatically downgrade http/2 to http1.x+ssl when browser does not support http/2.\nIs this a Spring Boot issue, or a servlet container issue(tomcat, jetty, Undertow)?\n\nI tried local with a Spring Boot application with http/2, browsers that support http/2 can access successfully, but access from browsers that does not support http/2 got a 'Aborted' http status. \n\nApplication informations:\nSpring Boot Version: 2.1.0.M4 \nServlet Container: default, Apache Tomcat/9.0.12 \n\napplication.properties:\n\nspring.application.name=spring-test\nserver.port=8443\n\nserver.http2.enabled=true\n\nserver.ssl.key-store=classpath:testkeystore.jks\nserver.ssl.key-store-password=test\nserver.ssl.key-password=test\n\n\nBrowser support http/2: Chrome, version: 66.0.3359.139\nBrowser does not support http/2: Firefox, version: 30.0"
] | [
"spring",
"spring-boot",
"tomcat",
"jetty",
"undertow"
] |
[
"How to display an asp.net mvc view as popup modal from an aspx page which will communicate with the controller",
"I am loading an asp.net mvc view from a link in an aspx page using the following code. The problem is that the view is unable to communicate with the controller. Is there an alternate way to show a view in a modal popup which will communicate with the controller for retrieving and saving data from the displayed page?\n\n $(function () {\n $('body').on('click', '.draw-edit-Link', function (e) {\n e.preventDefault();\n\n $.get(this.href, function (html) {\n $('<div />').kendoWindow({\n visible: true,\n title: 'My Documents',\n modal: true,\n width: '1200px',\n deactivate: function () {\n this.element.closest('.k-widget').remove();\n }\n }).data('kendoWindow')\n .content(html)\n .center()\n .open();\n });\n })\n });\n\n <a id=\"drawEdit\" class=\"draw-edit-Link\" href=\"/MySite/Purchase/MyDocument>My Document</a>"
] | [
"asp.net-mvc-3",
"kendo-ui"
] |
[
"Keras: Derivatives of output wrt each input",
"I am using a very simple MLP with just 1 hidden layer to estimate option prices. \n\nIn addition to the actual output of the neural network I would also like to know the partial derivative of the output value (of each line of the data sample) with regard to one of the 6 input parameters such that the resulting value can be interpreted as the percentage change of the output with regard to a change in the input parameter.\n\nAs I am pretty new to Keras and Neural Networks in general I was not able to come up with a solution for the problem myself. \n\n# Create Model\nmodel = Sequential()\nmodel.add(Dense(6, input_dim=6)) #input layer\nmodel.add(Dense(10, activation=relu)) #hidden layer\nmodel.add(Dense(1, activation=linear)) #output layer\n\n# Compile Model\nmodel.compile(loss='mse', optimizer='adam', metrics=['mae'])\n\n# Train model\nmodel.fit(X_train, Y_train, epochs=50, batch_size=10 verbose=2, validation_split=0.2)\n\n# Predict Values\nY_pred = model.predict(X_test, batch_size=10)"
] | [
"python",
"machine-learning",
"tensorflow",
"keras",
"theano"
] |
[
"SUMIF across many sheets",
"I have a Google sheets document where several sheets have the same column layout. I'd like to sum column J if column G = \"cat\". \n\nEssentially, this:\n\n=SUMIF('A'!G3:G,\"=cat\", 'A'!J3:J) + SUMIF('B'!G3:G,\"=cat\", 'B'!J3:J) + SUMIF('C'!G3:G,\"=cat\", 'C'!J3:J)\n\n\nBut, with lots of sheets, that is cumbersome. How can I reduce that to something like this:\n\n=SUMIF(INDIRECT({A,B,C}&\"!G3:G\"), \"=cat\", INDIRECT({A,B,C}&\"!J3:J\"))"
] | [
"google-sheets"
] |
[
"Enable HTTP 2.0 for Undertow in Spring Boot",
"I wonder how I can enable the HTTP 2.0 for Undertow using Spring Boot, I monitored the protocol and currently HTTPS is using 1.1.\n\nIs there any property for it? Or should I create a EmbeddedServletContainerFactory with this option.\n\nTks,"
] | [
"java",
"spring",
"spring-boot"
] |
[
"strip HTML Tags with perl",
"Whats the easiest way to strip the HTML tags in perl. I am using a regular expression to parse HTML from a URL which works great but how can I strip the HTML tags off?\n\nHere is how I am pulling my HTML\n\n #!/usr/bin/perl -w\nuse strict;\nuse warnings;\nuse LWP::Simple;\nmy $now_string = localtime;\n\nmy $html = get(\"http://www.spc.noaa.gov/climo/reports/last3hours.html\")\n or die \"Could not fetch NWS page.\";\n$html =~ s/<script.*?<\\'/script>/sg;\n$html =~ s/<.+?>//sg;\n$html =~ m{(Hail Reports.*)Wind Reports}s || die;\nmy @hail = $1;"
] | [
"html",
"perl",
"parsing",
"tags"
] |
[
"Call notifyItemChanged(int position) or equivalent from RecyclerView.ViewHolder",
"My RecyclerView items contains views that have 4 TextViews. I \"collapse\" and \"expand\" each view item by setting 2 TextViews' View.visibility to View.GONE and View.VISIBILITY respectively by implementing onClick(View view). I know I must call notifyItemChanged(int position) function of my RecyclerView adapter after a collapse/expand but the problem is that position of view item cannot be (normally) accessed from its ViewHolder.\n\nAs a workaround, I have created a 5th TextView in a view item to hold the position of the item. I access this textview from the view passed to onClick() and thus get the position of the item that I use to call notifyItemChanged(position) and update the screen.\n\nMy solution works but I am looking for a cleaner solution. Using a view to save item position is definitely not good idea\n\nHere's the important parts of my code:\n\npublic class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapter.NotificationHolder> {\n Context context;\n List<Notification> notifications;\n // Notification is my custom class (POJO)\n public NotificationAdapter(Context context, List<Notification> notificationList) {\n this.context = context;\n this.notifications = notificationList;\n }\n public class NotificationHolder extends RecyclerView.ViewHolder implements View.OnClickListener{\n View view;\n //The 4 TextViews\n TextView titleTv, descTv, timeTv,extraTv;\n //TextView added to hold position of the view item\n TextView positionJugad;\n public NotificationHolder(View itemView) {\n super(itemView);\n titleTv = itemView.findViewById(R.id.notification_subject_tv);\n descTv = itemView.findViewById(R.id.notification_body_tv);\n timeTv = itemView.findViewById(R.id.notification_time_tv);\n extraTv = itemView.findViewById(R.id.notification_extra_info_tv);\n positionJugad = itemView.findViewById(R.id.notification_view_position);\n itemView.setOnClickListener(this);\n this.view = itemView;\n }\n public void bindNotification(Notification notification, int position){\n titleTv.setText(notification.getTitle());\n descTv.setText(notification.getDescription());\n timeTv.setText(notification.getTime();\n extraTv.setText(notification.getExtra());\n positionJugad.setText(\"\"+position);\n }\n public void collapseView(){\n descTv.setVisibility(View.GONE);\n extraTv.setVisibility(View.GONE);\n }\n public void expandView(){\n descTv.setVisibility(View.VISIBLE);\n extraTv.setVisibility(View.VISIBLE);\n }\n @Override\n public void onClick(View view){\n //get the textview that stores position\n TextView jugad = view.findViewById(R.id.notification_view_position);\n if(descTv.getVisibility()==View.GONE){\n expandView();\n }\n else collapseView();\n notifyViewToggle(Integer.parseInt(jugad.getText().toString()));\n }\n }\n @Override\n public NotificationHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n View view = LayoutInflater.from(parent.getContext())\n .inflate(R.layout.notification_item,parent,false);\n return new NotificationHolder(view);\n }\n\n @Override\n public void onBindViewHolder(NotificationHolder holder, int position) {\n Notification notification = notifications.get(position);\n holder.bindNotification(notification,position);\n }\n //To change view state from collapsed to expanded and vice versa\n public void notifyViewToggle(int position){\n\n notifyItemChanged(position);\n }\n\n @Override\n public int getItemCount() {\n return notifications.size();\n }\n}"
] | [
"android",
"android-recyclerview",
"android-viewholder"
] |
[
"mongodb:find query on case insensitive index",
"My collection is: \n\n{ \"Name\" : \"Bhanu\"}\n\n\nwhen i execute the below query, will it returns the above doc(\"Name\" : \"Bhanu\")?\n\ndb.coll.find({\"Name\" : \"BHANU\"}).collation({ locale: 'en', strength: 2 }) \n\n\nSurprisingly it was returning the result (\"Name\" : \"Bhanu\") even though that i passed the parameter in upper or lower case like \"BHANU\" or \"bhanu\" .\n\nMy question is, how come that i was getting the result without creating the case insensitive index ? Can someone explain. Thanks in advance."
] | [
"mongodb",
"mongodb-query"
] |
[
"What is equivalent of CURLOPT_HTTPHEADER in java httpurlconnection",
"I need to send some data in header of my request to the server.\nI searched many times but didn't find a way to set header of request in java.\nmany people said things about httpurlconnection.setrequestproperty but that's another feature which is equal to CURLOPT_POSTFIELDS.\nanyway to set the header of request?"
] | [
"java",
"curl"
] |
[
"How check if custom event was prevented",
"In my code i need to interact with custom event after dispatched\n\n// ...\nlet customEvent = new CustomEvent('myevent', {\n bubbles: true,\n cancelable: true\n});\n\nbutton.addEventListener('click', function (e) {\n e.preventDefault();\n otherElement.dispatchEvent( customEvent );\n // at this point i neeed some help\n // if ( customEvent was canceled or prevented ) { do something }\n});\n\n\nHow can check if it has been prevented/canceled or another solution to get some \"feedback\" from event?"
] | [
"javascript",
"javascript-events"
] |
[
"how to change ngBootstrap datepicker border-radius",
"I want to set the border-radius of the ngBoostrap datepicker to 0.\n\nCSS:\n\n[_nghost-c9] {\n border-radius: 0.25rem;\n}\n\n\nHTML:\n\n<ngb-datepicker _ngcontent-c7=\"\" tabindex=\"0\" _nghost-c9=\"\" class=\"ng-untouched ng-pristine ng-valid\">\n</ngb-datepicker>\n\n\nI don't want to change any code of ngBootstrap. Is there a method on how to override this css?"
] | [
"css",
"angular5",
"ng-bootstrap"
] |
[
"Passing session variable in ajax with coldfusion 9",
"I'm trying to create an online chat program for my web users to speak to a salesperson live. I use an ajax jquery command to refresh the chat, which is stored in a database. The problem I'm running into is it is losing the session variable that identifies the user on the ajax call, but it only seems to do this to some users. Is there some setting for coldfusion that I'm missing? \n\nShould I have any specific settings set in my CF Administrator? \n\n<cfapplication name=\"Chat Room\"\n clientmanagement=\"Yes\"\n sessionmanagement=\"Yes\"\n sessiontimeout=\"#CreateTimeSpan(0,1,0,0)#\" >\n\n<cfset session.UserID = #new_session.UserID# >\n\n\n window.onload = function() \n {\n setInterval(\"ReloadChatWindow();\", 2500);\n }; \n\nfunction ReloadChatWindow()\n { \n $.ajax({url: \"messages.cfm\", success: function(result){\n $(\"#ChatLog\").html(result);\n }});\n\n $(\"#ChatLog\").scrollTop($(\"#ChatLog\")[0].scrollHeight);\n }\n\n\nnew_session.UserID# is just from a database insert (the user provides their name and I assign them the userID.\n\nOnly one domain uses the session, there are no cross domain calls."
] | [
"session",
"coldfusion"
] |
[
"Using same Ajax function to return content into multiple divs",
"We have a js ajax call we are using to pull content and placing them in different divs on our page.\n\nWe have been creating a new function for each call, but would like to just use one function for them all. In attempting this - it only updates the last div position requested.\n\nHere are the requests:\n\n<script type=\"text/javascript\">\n sendRequestFS('http://ourdomain.com/somepage.html', 'csad');\n sendRequestFS('http://ourdomain.com/somepage1.html', 'fsad');\n sendRequestFS('http://ourdomain.com/somepage2.html', 'tilead');\n </script>\n\n\nThe divs on the page:\n\n<div id = 'csad'>CS Here</div>\n<div id = 'fsad'>FS Here</div>\n<div id = 'tilead'>Tiles Here</div>\n\n\nAnd the function that we are using ... is there some way to use this same function each time?\n\nfunction createRequestObjectFS() \n{\n var returnObj = false;\n\n if(window.XMLHttpRequest) {\n returnObj = new XMLHttpRequest();\n } else if(window.ActiveXObject) {\n try {\n returnObj = new ActiveXObject(\"Msxml2.XMLHTTP\");\n } catch (e) {\n try {\n returnObj = new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n catch (e) {}\n }\n\n }\n return returnObj;\n}\nvar httpFS = createRequestObjectFS();\nvar targetFS;\n// This is the function to call, give it the script file you want to run and\n// the div you want it to output to.\nfunction sendRequestFS(scriptFileFS, targetElementFS)\n{ \n targetFS = targetElementFS;\n try{\n// alert (\"RQFS File: \" + scriptFileFS + \" Target : \" + targetElementFS);\n httpFS.open('get', scriptFileFS, true);\n }\n catch (e){\n document.getElementById(targetFS).innerHTML = e;\n return;\n }\n httpFS.onreadystatechange = handleResponseFS;\n httpFS.send(); \n}\nfunction handleResponseFS()\n{ \n\n if(httpFS.readyState == 4) { \n try{\n // alert (\"HRQFS\");\n var strResponseFS = httpFS.responseText;\n document.getElementById(targetFS).innerHTML = strResponseFS;\n } catch (e){\n document.getElementById(targetFS).innerHTML = e;\n } \n }\n}"
] | [
"javascript",
"ajax"
] |
[
"Execute some threads after other threads are completed using ThreadPool",
"I'm using ThreadPool to download multiple files from a server. I have a list of files to be downloaded, of which some files are of huge size. I want to download these huge files after downloading other small-sized files. And, I'm using WebClient.DownloadFile().\n\nCurrently I'm using Thread.Join(time) to start the threads for huge files to start after some time. But there is no guarantee that the other downloads would have been completed by that time. The value for time will vary depending on the network speed.\n\nIs there a better solution to handle this? Please help."
] | [
"c#",
"multithreading",
"threadpool"
] |
[
"Is it possible to pass node process variable to webpack builded package?",
"I am currently developing nodejs app which will be hosted on iis, using iisnode.\nI am having such a problem, this is part of my server.js:\n\napp.listen(process.env.PORT);\n\n\nprocess.env.PORT is passed by IIS, so at the moment when I locally building webpack package I have no port.\n\nI deploy the build-ed package on my server, but looking at server.bundle.js, I can see:\n\napp.listen(undefined);\n\n\nnow IIS can not start the application..\n\nIs there any option to set webpack bundle-ed package to expect node process variable to be passed on the run? \n\nOr maybe I am doing something wrong here?"
] | [
"javascript",
"node.js",
"iis",
"webpack",
"iisnode"
] |
[
"Emailing a comment to an email address stored in a table",
"In a comment system, I am using variables called $comment and $submittor. I am using a MySQL table called \"login\" that contains fields called \"username\" and \"email.\"\n\nThe field \"email\" is an email address.\n\nI would like to send an email with $comment in it to the \"email\" where \"username\" = \"$submittor.\"\n\nHere is what I have so far: \n\n$queryem = sprintf('SELECT email FROM login WHERE username = $submittor');\n\n\nHow can I send the email?\n\nThanks in advance,\n\nJohn"
] | [
"php",
"mysql"
] |
[
"how to find list of jobs configured to run on specific date",
"In IBM tivoli work scheduler, how to find list of jobs configured to run on any specific date?\nI'm able to go to individual job and see run cycle configuration. But how can i list out jobs for a specific date?"
] | [
"tivoli-work-scheduler"
] |
[
"What regEx can I use to Split a string into whole words but only if they start with #?",
"I have tried this...\n\nDim myMatches As String() = \nSystem.Text.RegularExpressions.Regex.Split(postRow.Item(\"Post\"), \"\\b\\#\\b\")\n\n\nBut it is splitting all words, I want an array of words that start with#\n\nThanks!"
] | [
"regex",
"vb.net"
] |
[
"no transparency on image",
"So I have this image which im going to call example. So example has a transparency layer like the checker board thing on the image itself. When I do \n\n<head>\n <style type=\"text/css\">\n\n .outerLink \n {\n background-color:black; \n display:block; \n opacity:1;\n filter:alpha(opacity=100);\n width:200px;\n }\n\n img.darkableImage \n {\n opacity:1;\n filter:alpha(opacity=100);\n }\n\n\n\n \n\n<body>\n <a href=\"/example\" class=\"outerLink\">\n <img src=\"example.png\" width=\"200\" \n class=\"darkableImage\" onmouseout=\"this.style.opacity=1;this.filters.alpha.opacity=100\" \n onmouseover=\"this.style.opacity=0.6;this.filters.alpha.opacity=60\" />\n </a>\n</body>\n\n\nit removes the transparency and it looks like:\n\n\n\nhow do i get the transparency back?"
] | [
"html",
"css"
] |
[
"backand platform: what is the objects life cycle (or db trigger action)",
"Because of the lack of precise documentation on Backand documents. I wonder what actually happens at each before,during,after stages in the Create, Update, Delete DB trigger object events . \n\nWhat do I get in backandCallback arguments: userInput, dbRow, parameters, userProfile?\n\nWhat happens if I update every one of them in each stage? \n\nwhat the meaning of return value from the functions .. \n\nAnd what happens if I terminate the execution of the action with exception in each stage?"
] | [
"javascript",
"backand"
] |
[
"Atlassian SDK won't start specified product",
"I'm trying to get a JIRA addon running on my local machine for test purposes. I'm executing this command:\n\ne:\\repositories\\jira-addon>atlas-run-standalone --product jira\nExecuting: \"D:\\atlassian-plugin-sdk\\apache-maven\\bin\\mvn.bat\" com.atlassian.maven.plugins:maven-amps-plugin:4.2.1:run-standalone -gs D:\\atlassian-plugin-sdk\\apache-maven/conf/settings.xml --product jira\nUnable to parse command line options: Unrecognized option: --product\n\n\nI'm quite sure it used to work before. I'm not sure what the problem is, but we recently upgraded from jira 5 to jira 6.\n\nAny suggestions on how to get the Atlassian SDK running my plugin again?"
] | [
"sdk",
"jira",
"jira-plugin"
] |
[
"Excel 2010 VBA Match function is not finding a match",
"In Excel 2010, my MATCH statement below is not working. The function should return the row number of a dataset identified by the datasetId (which should be unique) and 0 if the datasetId is not present. Whether the datasetId is present in the first column or not, the function always goes to the second branch and returns 0 \n\nFunction findDataset(dataWorksheet As Worksheet, datasetId As String) As Integer\n If Not VBA.IsError(Application.Match(datasetId, dataWorksheet.Columns(1), 0)) Then\n findDataset = Application.Match(datasetId, dataWorksheet.Columns(1), 0)\n Else\n findDataset = 0\n End If\nEnd Function"
] | [
"excel",
"vba",
"match"
] |
[
"Subqueries with EXISTS vs IN - MySQL",
"Below two queries are subqueries. Both are the same and both works fine for me. But the problem is Method 1 query takes about 10 secs to execute while Method 2 query takes under 1 sec.\n\nI was able to convert method 1 query to method 2 but I don't understand what's happening in the query. I have been trying to figure it out myself. I would really like to learn what's the difference between below two queries and how does the performance gain happen ? what's the logic behind it ?\n\nI'm new to these advance techniques. I hope someone will help me out here. Given that I read the docs which does not give me a clue.\n\nMethod 1 :\n\nSELECT\n * \nFROM\n tracker \nWHERE\n reservation_id IN (\n SELECT\n reservation_id \n FROM\n tracker \n GROUP BY\n reservation_id \n HAVING\n (\n method = 1 \n AND type = 0 \n AND Count(*) > 1 \n ) \n OR (\n method = 1 \n AND type = 1 \n AND Count(*) > 1 \n ) \n OR (\n method = 2 \n AND type = 2 \n AND Count(*) > 0 \n ) \n OR (\n method = 3 \n AND type = 0 \n AND Count(*) > 0 \n ) \n OR (\n method = 3 \n AND type = 1 \n AND Count(*) > 1 \n ) \n OR (\n method = 3 \n AND type = 3 \n AND Count(*) > 0 \n )\n )\n\n\nMethod 2 :\n\nSELECT\n * \nFROM\n `tracker` t \nWHERE\n EXISTS (\n SELECT\n reservation_id \n FROM\n `tracker` t3 \n WHERE\n t3.reservation_id = t.reservation_id \n GROUP BY\n reservation_id \n HAVING\n (\n METHOD = 1 \n AND TYPE = 0 \n AND COUNT(*) > 1\n ) \n OR \n (\n METHOD = 1 \n AND TYPE = 1 \n AND COUNT(*) > 1\n ) \n OR \n (\n METHOD = 2 \n AND TYPE = 2 \n AND COUNT(*) > 0\n ) \n OR \n (\n METHOD = 3 \n AND TYPE = 0 \n AND COUNT(*) > 0\n ) \n OR \n (\n METHOD = 3 \n AND TYPE = 1 \n AND COUNT(*) > 1\n ) \n OR \n (\n METHOD = 3 \n AND TYPE = 3 \n AND COUNT(*) > 0\n ) \n )"
] | [
"mysql",
"sql",
"phpmyadmin",
"query-optimization",
"subquery"
] |
[
"Dreamweaver CS6/CC hangs or freeze",
"I am having problems with Dreamweaver hanging/freezes. I have searched the entire internet now without finding an answer related to my problems.\n\nThis error is related to every newer version of Dreamweaver (CS5, CS6, CC). \nFirst it hangs when i start dreamweaver for about 20-30 seconds. After that it starts to hang when i finish writing something. I can write one line then wait 2 seconds and it starts to hang. It also hangs when i save files.\n\nIt happens on every kind of file (php, css, html etc).\n\nEverytime it hangs i get (not responding) in the dreamweaver window. It hangs for about 10-20 seconds.\n\nI have been using Dreamweaver for a long time and never had this problem before. \n\nI have tried to delete the cache file without any difference. I have tried various regedit fixes without luck. I have reinstalled and deleted all kind of preferences. I have disabled \"Enable related files\". The only remaining option is to format the computer and reinstall everything.\n\nCan someone please help me or give me a hint ?\n\nI am using Windows 7 ultimate 32 bit."
] | [
"dreamweaver",
"freeze"
] |
[
"How to add value for each specific key in python dictionary? (do not update another key)",
"In my case, I have a dictionary like this\n\ndic_ = {'btcusd': [-1.0, -1.0],\n 'usdjpy': [-1.0, -1.0]}\n\n\nFor example, I would like to update the key 'usdjpy', I using this code\n\ndic_['usdjpy'].append(1)\n\n\nHowever, It updates all other keys in this dictionary and gives the result like \n\n{'btcusd': [-1.0, -1.0, 1],\n 'usdjpy': [-1.0, -1.0, 1]}\n\n\nSo how to solve this problem?\n\nMy desire result is as below\n\n{'btcusd': [-1.0, -1.0],\n 'usdjpy': [-1.0, -1.0, 1]}"
] | [
"python",
"dictionary"
] |
[
"Output different sized dataframes on one .txt file in R",
"I have two dataframes of different size that I want to output into a .txt file.\nI've been using the write.table function but I can only output one on a .txt file.\n\ndataframe1=data.frame(x=c(1:10), y=c(1:10), z=c(1:10))\ndataframe2=data.frame(a=c(1:5), b=c(1:5)) \nwrite.table( C(dataframe1,dataframe2),\n file = \"dataframes.txt\", \n append = F,\n sep = \",\",\n row.names = F,\n col.names = F,\n na=\"\",\n quote = F)\n\n\nI'm trying to get them shown as stacked on top of each other but it is not working. Any suggestions?"
] | [
"r",
"write.table"
] |
[
"Getting realtime updates for document upon its creation?",
"I have an angular app utilizing cloud firestore. I have created a function in a service that gets a users rating from the 'ratings' collection. Every rating is stored in this collection and the documents id is the user id combined with the movies id.\ngetUserRating(movie_id) {\n return this.afAuth.authState.pipe(\n switchMap(user => {\n if (user) {\n return this.db.collection('ratings').doc(user.uid + '_' + movie_id).valueChanges();\n } else {\n return [];\n }\n })\n );\n }\n\nAnd I execute this code in ngOnInit() within my component.\nthis.ratingService.getUserRating(this.release.id).subscribe(doc => {\n this.userRating = doc['rating'];\n this.ratingSliderValue = this.userRating;\n}));\n\nThe issue with this code is that it does respond to changes if the document already exists, but if a user sets the initial rating for the movie it doesn't execute because the document does not previously exist. The page has to be reloaded. Any suggestions on how to get this working properly?"
] | [
"angular",
"typescript",
"firebase",
"asynchronous",
"google-cloud-firestore"
] |
[
"Problem with retrieving row data of my ag-grid by double clicking the row, written by angular 11",
"I used ag grid in my angular project. I want to retrieve double clicked row data and copy it to a variable but in the end it shows [object Object] instead of my row data.\nhere is my codes:\n.html file:\n<p>data:{{rowsSelection}}</p>\n<ag-grid-angular style="width: 100%; height: 500px;"\n class="ag-theme-balham"\n [rowData]="rowdata"\n [columnDefs]="gridOptions.columnDefs"\n [defaultColDef]="gridOptions.defaultColDef"\n [enableRtl]="agGridPropeties.enableRTL"\n [localeText]="localeTextPersian"\n [rowSelection]="agGridPropeties.rowSelection"\n [multiSortKey]="agGridPropeties.multiSortKey"\n [pagination]="agGridPropeties.pagination"\n [paginationPageSize]="agGridPropeties.paginationPageSize"\n enableCharts="true"\n rowDragManaged="true"\n animateRows="true"\n [sideBar]="sideBar"\n (rowClicked)='onRowClicked($event)'\n (cellClicked)='onCellClicked($event)'\n (selectionChanged) = 'onSelectionChanged($event)'\n (rowDoubleClicked) = 'onRowDoubleClicked($event)'\n >\n</ag-grid-angular>\n\n.ts file :\nconstructor(private auth: AuthenticationService) {\n this.newData();\n}\n\npublic newData() {\n this.auth.getallunits().subscribe(result => {\n this.rowdata = result.data;\n });\n}\n\npublic onRowDoubleClicked(event: any) { \n this.rowsSelection = {'data':event};\n console.log({'doubleClicked': event});\n}\n\nIn console i can see the data but inside p tag I see [object Object]!\nhere is the console.log result:\ndoubleClicked:\napi: GridApi {detailGridInfoMap: {…}, destroyCalled: false, immutableService: ImmutableService, csvCreator: CsvCreator, excelCreator: null, …}\ncolumnApi: ColumnApi {columnController: ColumnController}\ncontext: undefined\ndata: {Unit_Code: 20003, Unit_Title_Persian: "بسته 4 عددی", Conversion_factor: 4, Parent_Unit_ID: 10001}\nevent: MouseEvent {isTrusted: true, screenX: 1025, screenY: 866, clientX: 1025, clientY: 763, …}\nnode: RowNode {childrenMapped: {…}, selectable: true, __objectId: 4, alreadyRendered: true, highlighted: null, …}\nrowIndex: 3\nrowPinned: undefined\nsource: RowComp {destroyFunctions: Array(37), destroyed: false, __v_skip: true, getContext: ƒ, isAlive: ƒ, …}\ntype: "rowDoubleClicked"\n__proto__: Object\n__proto__: Object\n\nand inside my p tag :\ndata:[object Object]\n\nDo you have any idea?"
] | [
"html",
"angular",
"typescript",
"ag-grid-angular"
] |
[
"server cuts fields from csv to first 50 chars of string when importing to mysql",
"I'm trying to import data from csv to mysql table via phpmyadmin and I have the problem. Fields which length is more than 50 characters are cut off.\nI can't see any option to repair this\nCan anybody help me?\n\nresult of SHOW CREATE TABLE <table_name>:\n\nTable\nCreate Table\nsklep\nCREATE TABLE sklep (\n product_id varchar(256)..."
] | [
"mysql",
"csv",
"import",
"phpmyadmin"
] |
[
"C# ASP.NET Cannot insert a Gridview into a Word Template document",
"I am battling to successfully insert an existing WebForm GridView into a Word Template document bookmark. I have all the text inserts working well but the GridView insert I have no idea what I am doing. Here is the code: \n\nWord.Application oWord = new Word.Application();\n Word._Document oDoc = new Word.Document();\n oWord.Visible = true;\n Word.Table oTable;\n int r, c;\n string strText;\n object oMissing = System.Reflection.Missing.Value;\n object saveWithDocument = true;\n object oEndOfDoc = \"\\\\endofdoc\"; /* \\endofdoc is a predefined bookmark */\n object oTemplate = @\"C:\\Users\\Client\\Desktop\\iConnect - Proposal v20-2019.11.28.docx\";\n oDoc = oWord.Documents.Add(ref oTemplate, ref oMissing, ref oMissing, ref oMissing);\n oDoc.Bookmarks[\"CompanyName\"].Select();\n oWord.Selection.TypeText(Session[\"QCustomer\"].ToString()); //this is working\n oDoc.Bookmarks[\"Contact\"].Select();\n oWord.Selection.TypeText(Session[\"QContact\"].ToString());//this is working\n oDoc.Bookmarks[\"CellTel\"].Select();\n oWord.Selection.TypeText(Session[\"ANumber\"].ToString());//this is working\n oDoc.Bookmarks[\"DateTime\"].Select();\n oWord.Selection.TypeText(DateTime.Now.ToString(\"yyyy/MM/dd HH:mm:ss\"));//this is working\n oDoc.Bookmarks[\"QuoteName\"].Select();\n oWord.Selection.TypeText(DateTime.Now.ToString(txtQuoteName.Text));//this is working\n oDoc.Bookmarks[\"QuoteNo\"].Select();\n oWord.Selection.TypeText(DateTime.Now.ToString(lblQuoteNo.Text));//this is working\n oDoc.Bookmarks[\"Page2Customer\"].Select();\n oWord.Selection.TypeText(Session[\"QContact\"].ToString());//this is working\n oDoc.Bookmarks[\"Signature\"].Select();\n oWord.Selection.InlineShapes.AddPicture(@\"C:\\Users\\Client\\iConnect SA (PTY) Ltd\\Systems Development - Documents\\Source Code\\iSales\\IS1\\IS1\\Signature\\ICSignature.jpg\", ref oMissing, ref saveWithDocument, ref oMissing);//this is working\n //Add Grid View - Once Off\n oDoc.Bookmarks[\"OnceOffGridview\"].Select();\n GetGridviewData(dgvEdit);//fetches the gridview data and converts to string builder - this is working\n oWord.Selection.Paste(GetGridviewData(dgvEdit));//Here I need to insert the gridview into my Word document\n oDoc.Bookmarks[\"OnceOffExVat\"].Select();//this is working\n oWord.Selection.TypeText(lblSubTotal.Text);//this is working\n //Add \n oDoc.Bookmarks[\"MonthlyGridview\"].Select();\n //oWord.Selection.InlineShapes.AddPicture(GetGridviewData(dgvEdit), ref oMissing, ref saveWithDocument, ref oMissing);\n oDoc.Bookmarks[\"MOnthlyExVat\"].Select();//this is working\n oWord.Selection.TypeText(lblSubTotal.Text);//this is working'''"
] | [
"c#",
"asp.net",
"gridview",
"ms-word"
] |
[
"Quoted shell parameter expansion",
"I have a simple Bash function that gives me a random file from a path expression:\nrand() { ls -d "$@" | shuf -n 1; }\n\nIt let's me write things like rand * or rand ./Documents/*pdf to return things like my_file.txt or ./Documents/my_file.pdf\nThe quotes are needed for handling file names with spaces.\nNow I'd like to add a default value to the function, e.g. something like ${@-./*} (to make rand do rand ./*). How to I do that, so that the user input is still quoted?\nThis will make the default value work, but fails when there are files or user input with spaces:\nrand() { ls -d ${@-*} | shuf -n 1; }\n\nThis will work for user input, but looks for the literal name "*" as the default value, not finding anything:\nrand() { ls -d "${@-*}" | shuf -n 1; }\n\nAnd this is not a valid substitution:\nrand() { ls -d ${"@"-*} | shuf -n 1; }\n\n(I'm on GNU bash, version 5, in case there are syntactical differences between versions)"
] | [
"bash"
] |
[
"I changed the name of the WPF form and now it refuses to launch the application",
"This is probably a very simple fix.\n\n\nI clicked the form in the Solution Explorer.\nPressed F2 to rename it. Renamed it \"MyForm.xaml\". Pressed enter. \nTried launching the application but I get this error:\n\n\n\n Cannot locate resource 'window1.xaml'."
] | [
"wpf",
".net-3.5"
] |
[
"import SDWebImage fails despite CocoaPod installation",
"I have inserted SDWebImage to the Podfile\n\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n\npod 'NSData+Base64', '~> 1.0'\npod 'Facebook-iOS-SDK', '~> 3.23'\npod 'CrashlyticsFramework', '~> 2.2'\npod 'AFNetworking', '~> 2.5'\npod 'NewRelicAgent', '~> 4.186'\npod 'GoogleAnalytics-iOS-SDK', '~> 3.10'\npod 'Reachability', '~> 3.2'\npod 'SDWebImage', '~> 3.7'\n\n\nfollowed by:\n\npod install\npod update\n\n\nIt is all succesfuly installed.\n\nBut when I open the workspace and try to access the library I get this upon importing #import <SDWebImage/UIImageView+WebCache.h>\n\nTNCViewController.m:12:9: 'SDWebImage/UIImageView+WebCache.h' file not found\n\n\nUnder Pods project I can see Pods/SDWebImage\n\nand I have added manually ImageIO.framework to Linked Frameworks and Libraries.\n\nWhat else can I do? Never experienced such problem with a cocoapod library before.\n\nUpdate\nI have found the problem !!\n\nIf I remove the Target Membership for the Unit tests, then it compiles !!\nThis also happened on a fresh project where I copied the files over.\n\nThis means the Pod install doesn't install the files for the test target. Any idea what I could do please?"
] | [
"ios",
"cocoapods",
"sdwebimage"
] |
[
"Python NetworkX: edges color in a weighted graph",
"I am trying to plot a fully connected graph with edge weights given by the Gaussian similarity function using the networkx library in Python. When I plot the graph the color intensity of the edges seems to be very mild, which I guess is due to the small connectivity weights (Half-moons fully connected graph ). However, I was wondering if there is a way to make the color intensity stronger.\nThe code I used:\nimport numpy as np\nimport matplotlib\nfrom matplotlib import pyplot as plt\nfrom sklearn import cluster, datasets\nimport networkx as nx\n\ndef eucledian_dist(x_i, x_j):\n coord = x_i.shape[0]\n d=[]\n if coord == x_j.shape[0]:\n for i in range(coord):\n d.append((x_i[i] - x_j[i])**2)\n return (np.sqrt(sum(d),dtype=np.float64))\n\ndef distance_matrix(data, distance_measure):\n Npts= data.shape[0]\n distance_matrix=np.zeros((Npts,Npts))\n for xi in range(Npts):\n for xj in range(Npts):\n distance_matrix[xi,xj] = distance_measure(data[xi],data[xj])\n return(distance_matrix)\n\ndef adjacency_matrix(data, sigma):\n dist_matrix = distance_matrix(data, eucledian_dist)\n adjacency_matrix= np.exp(-(dist_matrix)**2 /sigma)\n adjacency_matrix[adjacency_matrix==1] = 0\n return(adjacency_matrix)\n \n#Generate data\nNpts = 35\nhalf_moons_data = datasets.make_moons(n_samples=Npts, noise=.040, random_state=1991)\nnodes_coord = dict()\nfor key in [i for i in range(Npts)]:\n nodes_coord[key] = list(half_moons_data[0][key])\n\n#Compute adjancency matrix\nW = adjacency_matrix(half_moons_data[0], sigma=0.05)\n\n#Create graph:\nnodes_idx = [i for i in range(Npts)]\ngraph = nx.Graph()\ngraph.add_nodes_from(nodes_idx)\ngraph.add_weighted_edges_from([(i,j, W[i][j])\n for i in range(Npts) for j in range(Npts)])\n \n#Plot graph:\nnx.draw_networkx_nodes(graph, nodes_coord, node_size=5, node_color="red") \nnx.draw_networkx_edges(graph, nodes_coord,\n edge_cmap= plt.cm.Blues,\n width=1.5, edge_color=[graph[u][v]['weight'] \n for u, v in graph.edges],\n alpha=0.2)\nplt.show()\n\nI would really appreciate any advice/feedback."
] | [
"python",
"graph",
"networkx"
] |
[
"How to keep round corners using Bootstrap",
"From the following image , I want to hide the second button,\n\nusing javascript, and I need for the first button to have round corners.\n\nAfter I hide the second button using javascript, the first button has a rectangular shape on the right side:\n\n\n\nIf I delete the button node, bootstrap sets the rounded corners, but this is not useful.\n\nThis is what i need, by using javascript:\n\n\n\nThe standard bootstrap html button structure:\n\n<div class=\"btn-group\">\n <button class=\"btn btn-mini action_select customSelect\" id=\"btn_bulk_action\" data-toggle=\"button\" disabled=\"disabled\">Reply<span class=\"reply2\"></span></button>\n <button class=\"btn btn-mini action_select\" data-toggle=\"button\" id=\"btn_bulk_action_archive\" disabled=\"disabled\" style=\"\n display: none;\n\">Archive<i class=\"icon-remove\"></i></button>\n </div>"
] | [
"javascript",
"twitter-bootstrap"
] |
[
"How can I write a Rust macro to convert row-major order to column-major order?",
"The macro would allow you to write any M x N matrix in a natural way. For example:\nmatrix![\n 1.0, 3.0, 5.0;\n 2.0, 4.0, 6.0;\n]\n\nwhich corresponds to the following matrix.\n┌ ┐\n│ 1.0 3.0 5.0 │\n│ 2.0 4.0 6.0 │\n└ ┘\n\nThe macro would output an array of arrays like the following:\n[[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]\n\nI know that I can parse row-major order quite simply using the following. But how can I can convert this to a column-major order. I can't figure out how to switch the order of the repeating groups.\nmacro_rules! matrix {\n ($($($e:expr),*);*) => {(\n [$([$($e),*]),*]\n }\n}"
] | [
"matrix",
"rust",
"macros"
] |
[
"SQL Server 2016 integration with R Services",
"While trying to integrate R Studio with SQL Server 2016 I am getting following error:\n\n\n Unable to launch runtime for 'R' script. Please check the configuration of the 'R' runtime. \n\n\nAs suggested on different sites it is advised to install \"%programfiles%\\RRO\\RRO-3.2.2-for-RRE-7.5.0\\R-3.2.2\\library\\RevoScaleR\\rxLibs\\x64\\RegisterRExt.exe\" /install.\n\nBut I have already installed R studio and not able to find the path specified."
] | [
"r",
"sql-server-2016"
] |
[
"RPM build process without installing",
"I'm trying to build my own rpm package and have a couple of doubts.\n\nFirst of all, in several places I've red that one shouldn't build rpms as root. Why is that? During the building process, rpmbuild has to go through the install stage where it installs files to the system.\n\nAs far as I understand I can't do that if I'm not root. rpmbuild process finishes with error. So, the question is if it is really possible to build an rpm without installing stuff into the system? Or eventually I do have to become root to complete the build process?"
] | [
"rpm",
"rpmbuild"
] |
[
"Laravel: Problem with markbaker/complex package & Composer",
"I'm a beginner in Laravel, I have installed Laravel Excel packeage in my project successfully. but, there is a problem appear with the package, when I run composer update it shows this error:\n\nLoading composer repositories with package information\nUpdating dependencies\nNothing to modify in lock file\nInstalling dependencies from lock file (including require-dev)\nPackage operations: 2 installs, 0 updates, 0 removals\n\n\nInstalling markbaker/complex (2.0.0): Extracting archive\nInstalling ezyang/htmlpurifier (v4.13.0): Extracting archive\nGenerating optimized autoload files\n\n\nIlluminate\\Foundation\\ComposerScripts::postAutoloadDump\nPHP Warning: Uncaught ErrorException: require(D:\\projects\\my_project\\vendor\\composer/../markbaker/complex/classes/src/functions/abs.php): failed to open stream: No such file or directory in D:\\projects\\my_project\\vendor\\composer\\autoload_real.php:71\nStack trace:\n#0 D:\\projects\\my_project\\vendor\\composer\\autoload_real.php(71): Composer\\Util\\ErrorHandler::handle(2, 'require(C:\\User...', 'C:\\Users\\Mukhta...', 71, Array)\n#1 D:\\projects\\my_project\\vendor\\composer\\autoload_real.php(71): require()\n#2 D:\\projects\\my_project\\vendor\\composer\\autoload_real.php(61): composerRequiredc8412b933c3488a0bbfad0ab059a147('abede361264e2ae...', 'C:\\Users\\Mukhta...')\n#3 D:\\projects\\my_project\\vendor\\autoload.php(7): ComposerAutoloaderInitdc8412b933c3488a0bbfad0ab059a147::getLoader()\n#4 in D:\\projects\\my_project\\vendor\\composer\\autoload_real.php on line 71\nWarning: Uncaught ErrorException: require(D:\\projects\\my_project\\vendor\\composer/../markbaker/complex/classes/src/functions/abs.php): failed to open stream: No such file or directory in D:\\projects\\my_project\\vendor\\composer\\autoload_real.php:71\nStack trace:\n#0 D:\\projects\\my_project\\vendor\\composer\\autoload_real.php(71): Composer\\Util\\ErrorHandler::handle(2, 'require(C:\\User...', 'D:\\projects\\my_project...', 71, Array)\n#1 D:\\projects\\my_project\\vendor\\composer\\autoload_real.php(71): require()\n#2 D:\\projects\\my_project\\vendor\\composer\\autoload_real.php(61): composerRequiredc8412b933c3488a0bbfad0ab059a147('abede361264e2ae...', 'D:\\projects\\my_project...')\n#3 D:\\projects\\my_project\\vendor\\autoload.php(7): ComposerAutoloaderInitdc8412b933c3488a0bbfad0ab059a147::getLoader()\n#4 in D:\\projects\\my_project\\vendor\\composer\\autoload_real.php on line 71\nPHP Fatal error: composerRequiredc8412b933c3488a0bbfad0ab059a147(): Failed opening required 'D:\\projects\\my_project\\vendor\\composer/../markbaker/complex/classes/src/functions/abs.php' (include_path='C:\\xampp\\php\\PEAR') in D:\\projects\\my_project\\vendor\\composer\\autoload_real.php on line 71\nFatal error: composerRequiredc8412b933c3488a0bbfad0ab059a147(): Failed opening required 'D:\\projects\\my_project\\vendor\\composer/../markbaker/complex/classes/src/functions/abs.php' (include_path='C:\\xampp\\php\\PEAR') in D:\\projects\\my_project\\vendor\\composer\\autoload_real.php on line 71\n\nI know the problem with this package (markbaker/complex) but I can't solve this issue. Any Help?\nphp & laravel versions:\nPHP 7.3.27\n\nLaravel Framework 8.37.0"
] | [
"php",
"laravel",
"composer-php"
] |
[
"Find the largest common part of two strings using Vim script",
"I have two string variables. The second string is a changed version of the first. Like this:\n\nlet a = 'this is a string'\nlet b = 'oh this is another string'\n\n\nI would like to find the largest substring that is in both.\n\nIn the example the result would be this is a.\n\nWhat is the easiest way to do this in Vim, considering the variables may contain an arbitrary line of text?\n\nMy initial idea was to concat both strings\n\n\nthis is a string|oh this is another string\n\n\nand then use matchlist() with this regex:\n\n\n\\v(.+).*\\|.*\\1\n\n\nUnfortunately, the group in the parentheses just matched ' string'."
] | [
"regex",
"vim",
"regex-greedy"
] |
[
"How to make it run through the 3 validations before being able to send the form action to an address",
"My code currently validates that the name/email and postcode is valid before being able to send when there is NO address that the information is meant to go to in the form action =\"\". But when I put the address it's meant to go to it completely skips the validation and just sends whatever, empty or not empty.\n\nTrying to re-position the form action, but really have no idea.\n\n<html>\n<head>\n<title>Online Food Delivery Form</title>\n<h1>Online Food Delivery Form</h1>\n</head>\n<body>\n<form action=\"http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi\" \nmethod=\"get\" onsubmit=\"return validation();\">\nName* : <input type=\"text\" name=\"name\" id=\"name\">\n<br />\n<br />\nEmail* : <input type=\"email\" name=\"email\" id=\"email\">\n<br />\n<br />\nPostcode* : <input type=\"text\" name=\"postcode\" id=\"postcode\" size=\"10\">\n\n<input type=\"reset\" value=\"Reset\"></button>\n<input type=\"submit\" name=\"submit\" value=\"Submit\"/>\n</form>\n<div id=\"eresult\" style=\"color:red;\"></div>\n<script type=\"text/javascript\">\n\nfunction validation(){\nvar name = document.getElementById('name').value;\nvar email = document.getElementById('email').value;\nvar postcode = document.getElementById('postcode').value;\nif(name=='' || postcode=='' || email==''){\ndocument.getElementById(\"eresult\").innerHTML = \"Name, Email and Postcode \nare required.\";\nreturn false;\n}\nelse if(name.length<3){\ndocument.getElementById(\"eresult\").innerHTML = \"Name must be more than 3 \ncharacters.\";\nreturn false;\n}\nelse if(postcode.length<4){\ndocument.getElementById(\"eresult\").innerHTML = \"Postcode must be atleast \n4 characters.\";\nreturn false;\n}\nelse {\nreturn true;\n}\n}\n</script>\n</body>\n</html>\n\n\nExpected results is for the code to validate that the email/name and postcode is correct before sending the information to the designated site. But it's doing complete opposite."
] | [
"javascript",
"forms",
"validation"
] |
[
"Animated transform from three lines menu to cross",
"I have a three-line animated menu that switches to a cross when you clicked on it. First you see the three lines go to one, and then switch to a cross. But I want skip the step from three lines to one.\n\nHow can I do that? \n\nHere's the fiddle http://jsfiddle.net/adyocsm9/\n\n\r\n\r\n$(document).ready(function() {\r\n $(document).on('click', \".lines-button\", function() {\r\n $('.lines-button').addClass('close');\r\n });\r\n $(document).on('click', \".lines-button.close\", function() {\r\n $('.lines-button').removeClass('close');\r\n });\r\n});\r\nbody {\r\n background: #000;\r\n padding-right: 100px; /* inserted padding so stackoverflows fullscreen button does not overlay */\r\n}\r\n.lines-button {\r\n position: relative;\r\n float: right;\r\n overflow: hidden;\r\n margin: 0;\r\n padding: 0;\r\n width: 96px;\r\n height: 56px;\r\n font-size: 0;\r\n text-indent: -9999px;\r\n -webkit-appearance: none;\r\n -moz-appearance: none;\r\n appearance: none;\r\n box-shadow: none;\r\n border-radius: none;\r\n border: none;\r\n cursor: pointer;\r\n -webkit-transition: background 0.3s;\r\n transition: background 0.3s;\r\n}\r\n.lines-button:focus {\r\n outline: none;\r\n}\r\n.lines-button span {\r\n display: block;\r\n position: absolute;\r\n left: 18px;\r\n right: 18px;\r\n height: 8px;\r\n background: white;\r\n border-radius: 0.57143rem;\r\n}\r\n.lines-button span::before,\r\n.lines-button span::after {\r\n position: absolute;\r\n display: block;\r\n left: 0;\r\n width: 100%;\r\n height: 8px;\r\n background-color: #fff;\r\n border-radius: 0.57143rem;\r\n content: \"\";\r\n}\r\n.lines-button span::before {\r\n top: -15px;\r\n}\r\n.lines-button span::after {\r\n bottom: -15px;\r\n}\r\n.lines {\r\n background: none;\r\n}\r\n.lines span {\r\n -webkit-transition: background 0s 0.3s;\r\n transition: background 0s 0.3s;\r\n}\r\n.lines span::before,\r\n.lines span::after {\r\n -webkit-transition-duration: 0.3s, 0.3s;\r\n transition-duration: 0.3s, 0.3s;\r\n -webkit-transition-delay: 0.3s, 0s;\r\n transition-delay: 0.3s, 0s;\r\n}\r\n.lines span::before {\r\n -webkit-transition-property: top, -webkit-transform;\r\n transition-property: top, transform;\r\n}\r\n.lines span::after {\r\n -webkit-transition-property: bottom, -webkit-transform;\r\n transition-property: bottom, transform;\r\n}\r\n.lines.close {\r\n background: none;\r\n}\r\n.lines.close span {\r\n background: none;\r\n}\r\n.lines.close span::before {\r\n top: 0;\r\n -webkit-transform: rotate(45deg);\r\n -ms-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n}\r\n.lines.close span::after {\r\n bottom: 0;\r\n -webkit-transform: rotate(-45deg);\r\n -ms-transform: rotate(-45deg);\r\n transform: rotate(-45deg);\r\n}\r\n.lines.close span::before,\r\n.lines.close span::after {\r\n -webkit-transition-delay: 0s, 0.3s;\r\n transition-delay: 0s, 0.3s;\r\n}\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\r\n<button class=\"lines-button lines\">\r\n <span></span>\r\n</button>"
] | [
"jquery",
"css",
"css-transitions",
"css-transforms"
] |
[
"Why are there multiple calls to my function when it has been called only once during iteration?",
"I am working on an Android application which uses Xerces for Iteration. I have a custom method which is called to store a filtered set of data values in it after being iterated through via a while loop. Part of the specific while loop is as follows:\nwhile((n = iterator.nextNode())!= null) {\n ... //other code\n\n object.customMethod(tagName, n.getNodeValue()); //occurs only once per iteration\n Log.i("TAG", tagName + ": " + n.getNodeValue())\n\n ...//other code\n}\n\nThe customMethod received a key and value pair and saves them as Strings using Android's SharedPreferences system. At the moment of being called, the method actually has the key=>value pair, but it appears the method is being called more than once during the same iteration loop. I came to know this after printing out the logcat sample showing the output after each call within customMethod due to having blanks/nulls saved in the preferences when I fetched them later. Why is this happening? A sample output is as shown:\n\nTAG inserted: 500.00 //log call right after insertion within customMethod()\nTAG vc:limit: 500.00 //log call after returning from customMethod()\nTAG inserted:\nTAG inserted:\nTAG inserted: //other calls, which I want to know how and why they are occurring\n\nAll the above occurred during a single iteration of the while loop. Anyone know why this is happening? Something else, it seems the code right after the insertion only runs once, but only the code within the customMethod() gets called several times during the iteration. The custom method is as shown below:\npublic boolean customMethod(String key, String val) {\n boolean inserted = prefs.edit().putString(key, val).commit(); //prefs is global\n Log.i("TAG", (inserted == true ? "inserted: " + val : "not inserted"));\n return inserted;\n}\n\nEdit: The full while loop as requested:\nprivate void setSelectedID(int pos)\n{\n ...\n String id = IDs[pos];\n ...\n\n NodeList descElements = MainActivity.root.getElementsByTagName(VCard.DIRECTORY); //DIRECTORY is a String constant\n Element desc = (Element) descElements.item(0);\n NodeIterator iterator = ((DocumentTraversal)MainActivity.doc).createNodeIterator(desc, NodeFilter.SHOW_ALL, null, true);\n\n Node n;\n VCard object = new VCard(this);\n\n while((n = iterator.nextNode())!= null)\n {\n if(n.getNodeType() == Node.CDATA_SECTION_NODE || n.getNodeType() == Node.TEXT_NODE)\n {\n String tagName = n.getParentNode().getNodeName();\n if(object.containsKey(tagName))\n {\n Element e = (Element) n.getParentNode();\n if(e.hasAttribute("id") && e.getAttribute("id").equals(id))\n {\n object.customMethod(tagName, n.getNodeValue());\n Log.i("TAG", tagName + ": " + n.getNodeValue())\n }\n }\n }\n }\n}"
] | [
"java",
"android"
] |
[
"Custom filter in ASP.NET MVC 5 does not affect",
"I have written this the below filter to log and handling exceptions in my MVC 5 app:\n\n[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]\npublic sealed class HandleAndLogErrorAttribute : HandleErrorAttribute {\n\n public override void OnException(ExceptionContext filterContext) {\n if (filterContext == null)\n throw new ArgumentNullException(\"filterContext\");\n if (filterContext.IsChildAction) {\n LogChildActionException(filterContext);\n return;\n }\n if (filterContext.ExceptionHandled || !filterContext.HttpContext.IsCustomErrorEnabled)\n return;\n var exception = filterContext.Exception;\n if (!ExceptionType.IsInstanceOfType(exception))\n return;\n var controllerName = (string)filterContext.RouteData.Values[\"controller\"];\n var actionName = (string)filterContext.RouteData.Values[\"action\"];\n LogActionException(controllerName, actionName, exception);\n if (new HttpException(null, exception).GetHttpCode() != 500)\n return;\n var model = new HandleErrorInfo(filterContext.Exception, controllerName, actionName);\n var exceptionContext = filterContext;\n var viewResult = new ViewResult {\n ViewName = View,\n MasterName = Master,\n ViewData = new ViewDataDictionary<HandleErrorInfo>(model),\n TempData = filterContext.Controller.TempData\n };\n exceptionContext.Result = viewResult;\n filterContext.ExceptionHandled = true;\n filterContext.HttpContext.Response.Clear();\n filterContext.HttpContext.Response.StatusCode = 500;\n filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;\n }\n\n private void LogActionException(string controllerName, string actionName, Exception exception) {\n // log here\n }\n\n private void LogChildActionException(ExceptionContext filterContext) {\n // log here\n }\n}\n\n\nAnd I add this filter instead of the original one:\n\npublic class FilterConfig {\n public static void RegisterGlobalFilters(GlobalFilterCollection filters) {\n filters.Add(new HandleAndLogErrorAttribute ());\n }\n}\n\n\nBut it seems it does not affect at all:\n\npublic class TestController : Controller {\n\n // I even tried this line:\n // [HandleAndLogErrorAttribute]\n // and also this one:\n // [HandleAndLogErrorAttribute(ExceptionType = typeof(Exception))]\n public ActionResult Index() {\n try {\n var i = new[] { 1, 2, 3, 4 };\n var j = i[10];\n } catch {\n throw new HttpException();\n // I also tried:\n // throw new Exception();\n // and\n // throw;\n }\n return null;\n }\n}\n\n\nI did put a break-point at OnException() method. But it never get called. Do you know what is going on there? What am I missing? Thanks in advance.\n\nHere is my other configs:\n\nIn Global.asax.cs\n\npublic class MvcApplication : System.Web.HttpApplication {\n void Application_Error(object sender, EventArgs e) {\n // I tried this line too:\n //Server.ClearError();\n // but nothing changed!\n }\n}\n\n\nIn web.config\n\n<system.web>\n\n <!-- I also tried false -->\n <trace enabled=\"true\"/> \n\n <!-- I also tried Off -->\n <customErrors mode=\"On\" redirectMode=\"ResponseRedirect\">\n <error statusCode=\"404\" redirect=\"/404.html\"/>\n </customErrors>\n\n <!-- I also tried true -->\n <compilation debug=\"false\" targetFramework=\"4.5\"/>\n\n</system.web>\n\n<system.webServer>\n\n <!-- I also tried Detailed -->\n <httpErrors errorMode=\"Custom\">\n <remove statusCode=\"404\"/>\n <error statusCode=\"404\" path=\"/404.html\" responseMode=\"ExecuteURL\"/>\n </httpErrors>\n\n</system.webServer>\n\n\nAnd of-course, I tried to run application with/without debugging enabled and Debug/Release mode too."
] | [
"c#",
"asp.net-mvc",
"asp.net-mvc-5.2",
"asp.net-mvc-custom-filter"
] |
[
"Partitioning Related Rows into Groups",
"I have some legacy product data that has proven difficult to work with. The products can be sold with 1, 2 or 3 parts, and the way the system was designed, parts 2 and 3 for an ordered product were simply subsequent rows after the first row for that product. \n\nHere is some sample data....\n\n----------------------------------------------------------\nOrderId Sku Type Row_Id OtherColumns...\n----------------------------------------------------------\n123 001 Double 0 Other stuff..\n123 001 Double 1 Other stuff..\n123 001 Double 2 Other stuff..\n123 001 Double 3 Other stuff..\n123 002 Single 4 Other stuff..\n123 003 Triple 5 Other stuff..\n123 003 Triple 6 Other stuff..\n123 003 Triple 7 Other stuff..\n123 001 Double 8 Other stuff..\n123 001 Double 9 Other stuff..\n123 002 Single 10 Other stuff..\n123 002 Single 11 Other stuff..\n123 002 Single 12 Other stuff..\n123 002 Single 13 Other stuff..\n\n\nThe old software (VB) deals with this by iterating over the rows and looking forward as it loops, getting the information it needs from the rows, and then skips them.\n\nFast forward 8 years...I have inherited this system in my new job and have rewritten the system from the ground up. The problem I'm having is getting that legacy data into my new format.\n\nI'm looking for a way to select the same data, and partition it by the appropriate segment numbers. I've used RANK() OVER(PARTITION BY) with no success. I think I'm just not doing it right.\n\nIdeally, I'd like to be able to generate a result set that looks like this: (NOTE the Segment column)\n\n-------------------------------------------------------------------\nOrderId Sku Type Row_Id Segment OtherColumns...\n-------------------------------------------------------------------\n123 001 Double 0 1 Other stuff..\n123 001 Double 1 2 Other stuff..\n123 001 Double 2 1 Other stuff..\n123 001 Double 3 2 Other stuff..\n123 002 Single 4 1 Other stuff..\n123 003 Triple 5 1 Other stuff..\n123 003 Triple 6 2 Other stuff..\n123 003 Triple 7 3 Other stuff..\n123 001 Double 8 1 Other stuff..\n123 001 Double 9 2 Other stuff..\n123 002 Single 10 1 Other stuff..\n123 002 Single 11 1 Other stuff..\n123 002 Single 12 1 Other stuff..\n123 002 Single 13 1 Other stuff..\n\n\nIdeally, I'd like to avoid cursors or loops. I'll be using the query to migrate millions of records that are derived from multiple tables.\n\nThanks in advance for your help.\n\nEDIT\nI've updated the sample data to show that I do indeed have back to back groups that I need to isolate."
] | [
"tsql"
] |
[
"Value of archives is different in iOS 6 and iOS 7",
"The value of archives is different in iOS 6 and iOS 7 when I archive MyDTO.\nWhy does this happen?\n\nMyDTO.h\n\n@property (nonatomic, strong) NSString *aaa;\n@property (nonatomic, strong) NSString *bbb;\n\n\nMyDTO.m\n\n- (void)encodeWithCoder:(NSCoder *)encoder\n{\n [encoder encodeObject:_aaa forKey:@\"aaa\"];\n [encoder encodeObject:_bbb forKey:@\"bbb\"];\n}\n\n\nMyMethod\n\n- (void)test {\n MyDTO *myDTO = [[MyDTO alloc] init];\n myDTO.aaa = @\"1\";\n myDTO.bbb = @\"2\";\n\n //data is different in iOS 6 and iOS 7\n NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myDTO];\n}\n\n\n\n\nEdit\n\nError occurs in the following steps.\n\n\nArchive of DTO (iOS 6)\nUp version of OS (iOS 6 -> iOS 7)\nDearchive of DTO (iOS 7) <- Error!\n\n\nError Log\n\n[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x48, 0xfffffff2, 0xffffffd7, 0xffffff89, 0xffffff80, 0xffffffa8, 0x70, 0xffffff8d)\n\n\nNormal in the following steps.\n\n\nArchive of DTO (iOS 6)\nDearchive of DTO (iOS 6) \n\n\nOR\n\n\nArchive of DTO (iOS 7)\nDearchive of DTO (iOS 7)\n\n\nI assumed that the value of archives is different is due."
] | [
"ios",
"objective-c",
"ios6",
"archive",
"ios7"
] |
[
"Primefaces commandButton is not showing dialog after ajax form refresh",
"I need your help and guidance on fixing the issue of showing the dialog after refreshing the form by using ajax. I am having a dataTable that it is showing a number of requests and onclick of the commandButton view, a dialog will be shown that contains some information. And onclose of the dialog, the form will be refreshed and the dataTable will get the updated information from the database. However for the first time, the dialog will be shown and the form will be refreshed by closing the dialog.\n\nIf I tried to click again on the view commandButton on the second time, the commandButton will not show any dialog and will not seem to do an action. Even the log it is not showing anything.\n\nHere is my xhtml:\n\n<h:form id=\"Requests\">\n <p:dataTable id=\"PendingRequests\" var=\"hr\" value=\"#{hrd.pendingRequests}\"\n filteredValue=\"#{hrd.filteredPendingRequests}\">\n <p:column headerText=\"Req. Date\" sortBy=\"#{hr.requestDate}\"\n filterMatchMode=\"contains\" filterBy=\"#{hr.requestDate}\">\n <h:outputText value=\"#{hr.requestDate}\" />\n </p:column>\n <p:column>\n <f:facet name=\"header\">View</f:facet>\n <p:commandButton id=\"submitbutton\" update=\":Requests:#{hr.dialogueName} \"\n oncomplete=\"PF('#{hr.certificateDialogue}').show()\" icon=\"ui-icon-search\"\n title=\"View\">\n <f:setPropertyActionListener value=\"#{hr}\" target=\"#{hrd.selectedRequest}\" />\n </p:commandButton>\n </p:column>\n </p:dataTable>\n <p:dialog id=\"CertificateDialog\" header=\"Cert1\" widgetVar=\"CertificateDialog\">\n <p:ajax event=\"close\" update=\":Requests\" listener=\"#{hrd.UpdateDatatable}\" />\n </p:dialog>\n</h:form>\n\n\nThis method will be called onclose of the dialog .The UpdateDatatable method code is:\n\nlistPendingRequests.clear();\nlistPendingRequests = new ArrayList<PendingRequests>();\nPreparedStatement ps = null;\nString sql = \"\";\n\ntry {\n con = DBConn.getInstance().getConnection(\"jdbc/hr\");\n\n // SQL Statement\n ps = con.prepareStatement(sql);\n ResultSet result = ps.executeQuery();\n while (result.next()) {\n PendingRequests pendingList = new PendingRequests();\n\n requestDate = result.getString(\"REQ_DT\");\n\n pendingList.setRequestDate(requestDate);\n\n listPendingRequests.add(pendingList);\n\n RequestContext.getCurrentInstance().update(\"Requests\");\n }\n} catch (Exception e) {\n System.err.print(e);\n e.printStackTrace();\n}"
] | [
"ajax",
"jsf",
"primefaces"
] |
[
"Connect to different connection strings in same \"using\"",
"I have a model with 2 different lists like:\n\n public IList<PurchaseOrderPreliminaryDesignModel> DesignList { get; set; } = new List<PurchaseOrderPreliminaryDesignModel>();\n\n public IList<PurchaseOrderPreliminaryVendorModel> VendorList { get; set; } = new List<PurchaseOrderPreliminaryVendorModel>();\n public PurchaseOrderPreliminaryDesignViewModel AddDesignList(IEnumerable<PurchaseOrderPreliminaryDesignModel> model)\n {\n ((List<PurchaseOrderPreliminaryDesignModel>)DesignList).AddRange(model);\n return this;\n }\n\n public PurchaseOrderPreliminaryDesignViewModel AddVendorList (IEnumerable<PurchaseOrderPreliminaryVendorModel> model)\n {\n ((List<PurchaseOrderPreliminaryVendorModel>)VendorList).AddRange(model);\n return this;\n }\n\n\nSo I fill first list using method:\n\n public PurchaseOrderPreliminaryDesignViewModel GetPreliminaryDesignList(string jobNumber)\n {\n try\n {\n PurchaseOrderPreliminaryDesignViewModel DoGetDesigns()\n {\n using (var connection = _connectionManager.GetOpenConnection(_configuration.GetConnectionString(FirstConnectionString)))\n {\n var rModel = new PurchaseOrderPreliminaryDesignViewModel();\n var designList = connection.Query<PurchaseOrderPreliminaryDesignModel>(\"[dbo].[usp_PurchaseOrder_Preliminary_Design]\", param: new\n {\n LegacyKey = jobNumber\n }, commandType: CommandType.StoredProcedure);\n\n rModel.AddDesignList(designList);\n return rModel;\n }\n }\n return DoGetDesigns();\n }\n catch (Exception ex)\n {\n throw ex;\n }\n }\n\n\nAs you can see I'm using FirstConnectionString in my using method, so I connect to one database to fill first list. Now I want to fill the other list but with different connection.\n\nMy question is how can I connect to second string to fill other List? I mean in the same using do something like:\n\nvar vendorList = connection2.Query<PurchaseOrderPreliminaryVendorModel>(\"mystore\", param: new\n {\n Parameter = jobNumber\n }, commandType: CommandType.StoredProcedure);\n\n\nthen in return use like:\n\nrModel.AddDesignList(designList).AddVendorList(vendorList);\n return rModel;\n\n\nHow can I achieve that? Regards"
] | [
"c#",
"asp.net-core",
"dapper"
] |
[
"JQuery relative positioning of one element to another",
"<div class=\"bgdiv\"></div>\n<div class=\"fgdiv\"></div>\n\n<a href=\"#\" class=\"mainlink\">LINKA</A>\n\n\nThe bgdiv has no styles at all so these and ZIndex need to be assigned(the others already have z-index properties) and then needs to be assigned a height and width which is \"x\" amount of pixels bigger than link A.\n\nThe bgdiv would then be positioned behind link A and in front of fgdiv so that the bgdiv directly surrounding the link(visually), with a similar effect to padding.\n\nhas anybody got any ideas on how this could be achieved?\n\nEDIT:\n\nSo the image above is as if I'd just clicked on the login button.\nThe green bar div which was initially behind the grey rectangle link surrounder div has now been \"moved up a layer\", but is still behind the text \"login\""
] | [
"jquery",
"css",
"css-position"
] |
[
"PodioContact::get_for_app - depreciation whats the alternative?",
"I am using 'PodioContact::get_for_app' to get info using the api and have had trouble getting to the contacts which have filled in a web form with other api calls (ie the people who fill in the form are not podio users and therefore do not appear on in the org or workspace connections/contacts)\n\nI have noticed that podio creates a profile for them and the information entered is converted to just a profile_id but this id does not match any of the id (user or profile) I have for the orgs/apps/workspace users.\n\nI have found that the only way to get to this list of users and profile ids is to use:\n\nhttps://developers.podio.com/doc/contacts/get-space-contacts-on-app-79475279\n\nI have tried various other ways to get this list but only get the ones connected to the workspace who have full logins eg:\n\nPodioSpaceMember::get_all\nPodioContact::get_for_space\nPodioContact::get_all\nPodioContact::get_for_org\n\n\nI am concerned that this api call is being depreciated as I do not see how to retrieve a list of these users otherwise.\n\nIs there an alternative way to get to a list of these users before this is depreciated?"
] | [
"php",
"podio"
] |
[
"Names of `out` variables in a fragment shader",
"I'm having some problem understanding one line in the most basic (flat) shader example while reading OpenGL SuperBible.\n\nIn chapter 6, Listing 6.4 and 6.5 it introduces the following two very basic shaders.\n\n6.4 Vertex Shader:\n\n// Flat Shader\n// Vertex Shader\n// Richard S. Wright Jr.\n// OpenGL SuperBible\n#version 130\n\n// Transformation Matrix\nuniform mat4 mvpMatrix;\n\n// Incoming per vertex\nin vec4 vVertex;\n\nvoid main(void) \n { \n // This is pretty much it, transform the geometry\n gl_Position = mvpMatrix * vVertex;\n }\n\n\n6.5 Fragment Shader:\n\n// Flat Shader\n// Fragment Shader\n// Richard S. Wright Jr.\n// OpenGL SuperBible\n#version 130\n\n// Make geometry solid\nuniform vec4 vColorValue;\n\n// Output fragment color\nout vec4 vFragColor;\n\n\nvoid main(void)\n { \n gl_FragColor = vColorValue;\n }\n\n\nMy confusion is that it says vFragColor in the out declaration while saying gl_FragColor in main(). \n\nOn the other hand, in code from the website, it has been corrected to 'vFragColor = vColorValue;' in the main loop.\n\nWhat my question is that other then being a typo in the book, what is the rule for naming out values of shaders? Do they have to follow specific names?\n\nOn OpenGL.org I've found that gl_Position is required for the out of the vertex shader. Is there any such thing for the fragment shader? Or it is just that if there is only one output, then it will be the color in the buffer? \n\nWhat happens when there is more then one out of a fragment shader? How does the GLSL compiler know which one to use in the buffer?"
] | [
"opengl",
"glsl",
"shader",
"fragment-shader",
"vertex-shader"
] |
[
"Mayavi curved arrow between two 3d points",
"Can I create a curved arrow in mayavi between two points?\nThis is a line I created using vtk\n\nar1 = visual.arrow(x=x1, y=y1, z=z1)\narrow_length = np.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2 + (z2 - z1) ** 2)\nar1.actor.scale = [arrow_length, arrow_length, arrow_length]\nar1.pos = ar1.pos / arrow_length\nar1.axis = [x2 - x1, y2 - y1, z2 - z1]\n\n\n\n\nAnd I would like it to be curved, i.e"
] | [
"python",
"vtk",
"mayavi",
"mayavi.mlab"
] |
[
"Yocto PHP5 image Installation",
"I has a project which controls camera with pwm while sending data from the Webserver .I'm using Yocto dizzy branch for to generate sdcard image for Wandboard Quad . Kernel version is 3.10.17 .\n\nI used php code to post the data to the test.py file so I need the php package for wandboard to make it understandable for test.py file then I will write some python code to send pwm depending on data's but in yocto I couldn't figure out how to add this functionality to the sdcard image. I worked about 4 day about that but I couldn't find any solution .Do you know how can I apply this functionality ?\n\nThanks.."
] | [
"php",
"linux",
"yocto"
] |
[
"Rails 3. How to add files to the initialisation?",
"I was wondering how you added files to be included in the initialisation of a rails app. \n\nAt the moment I'm keeping a few files in the model folder because I know the are including.\n\nHow do you specify any file to be included, I would rather the files are in lib folder."
] | [
"ruby-on-rails"
] |
[
"\"Battery saver\" feature killing my music service",
"I'm building a music streaming app for Android.\n\nIn this app, I have a Service which is responsible for playing audio from an HTTP server. Before playing, I make sure to startForeground() and acquire a partial WakeLock, so that my service isn't killed. I also get a WifiLock, just in case.\n\nThe service works fine... as long as my phone isn't on \"battery saving mode\". The minute I turn on battery saving and disconnect my phone from power source, my service is killed with fire!\n\nUnfortunately it doesn't even seem that onDestroy() is called, so my notification from startForeground() stays visible, even if the service is dead.\n\nThe phone is a Samsung Galaxy S6, with Android 6.0.1 on it.\n\nTwo questions:\n\n\nIs there a way I can keep the service alive despite the battery saver thingy?\nIf not, I'd like to know at least when my service is killed, so that I can do a bit of cleanup (remove notification & internal stuff).\n\n\nAny suggestions?"
] | [
"android",
"service",
"streaming"
] |
[
"WPF XAML Designer crash in VS2012",
"I working on a very big solution with more than 80 projects.\nMy XAML designer crash each time a change been made on the Window.\nOnly if kill the process 'XDesProc.exe' and reload it again it start showing the designer again until the next change.\n\nI'm using VS2012 UP2.\n\nPlease help me.\n\nThanks!"
] | [
"c#",
"wpf",
"visual-studio-2012"
] |
[
"How to call a codeigniter helper function using JQuery AJAX?",
"I have a function defined in my helper function in codeigniter that returns the formatted price when val and currency id is passed to it.\n\nif(!function_exists('format_price')){\nfunction format_price($val,$curency_id=NULL){\n $CI =& get_instance();\n $CI->load->model('currency_model');\n if ($curency_id) {\n $Result=$CI->currency_model->getcurrency($curency_id);\n $dec_place=round($Result['decimal_place']);\n $value=number_format((float)$val,$dec_place,'.',',');\n return $Result['symbol_left'].$value .\" \".$Result['symbol_right'];\n }\n else{\n $Result=$CI->currency_model->getDefaultCurrency();\n $dec_place=round($Result['decimal_place']);\n $value=number_format((float)$val,$dec_place,'.',',');\n return $Result['symbol_left'].$value .\" \".$Result['symbol_right'];\n }\n }\n}\n\n\nWhat I need is to call this function through ajax in javascript code.\nis this possible without a controller, or do I have to make a controller?"
] | [
"javascript",
"php",
"jquery",
"ajax",
"codeigniter"
] |
[
"How to convert object dtype to int dtype of tokenized text data as numbers. I have tried .astype, pd.to_numeric, isinstance(x,str) too",
"This is the snip of my movie review dataset which got tokenized as numbers in the text column:\n\nHow to convert the column text dtype from object to\nint?"
] | [
"python",
"classification",
"dtype"
] |
[
"when outputting rspec to file in documentation format, how do I insert newlines?",
"I am outputting rspec documentation to a file and want it to be in markdown (e.g. the top level requirements have a #, the other context have ##), but markdown needs to have a newline between headers to make it more readable.\n\nIs there a way to do that? Or any other way to make the output a readable form of documentation for the intended specs?"
] | [
"ruby",
"rspec"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.