texts
sequence | tags
sequence |
---|---|
[
"Kivy Popup Appearing after function is run instead of before",
"I want to display a popup or modal that says something along the lines of 'please be patient while processing' while the application is performing a function in the background. However the popup appears after the background function has already happened. Below is an example of code that produces this problem.\n\nimport os\nimport time\n\nfrom kivy.app import App\nfrom kivy.uix.modalview import ModalView\nfrom kivy.uix.popup import Popup\nfrom kivy.uix.button import Button, Label\n\n\nclass Poppy(Popup):\n def __init__(self, **kwargs):\n super(Poppy, self).__init__(**kwargs)\n self.content = Label(text='working')\n self.open()\n print(\"Working...\")\n\nclass TApp(App):\n def build(self):\n return Button(text=\"Click to run\", on_press=self.modal_test)\n\n def modal_test(self, event):\n p = Poppy(size_hint=(0.5, 0.5))\n self.printer()\n\n def printer(self):\n print('Popup works')\n time.sleep(5)\n\nTApp().run()"
] | [
"python",
"kivy"
] |
[
"sending receiving images Parse server (Android) and populate in listview keeping order",
"In chat application, I am using Parse server. I want to send text and images.\nImages are not receiving in the same order as it was send to the server due to call back method. I am displaying images in listView when images are retrieved fully via callBAck method. So that, order of images are disturbed.\n\nIn different chat Applications, the imageView is displayed first & then image is displayed after retrieval from server. I want to do something like that."
] | [
"android",
"parse-server"
] |
[
"Parsing XML in IE with jQuery",
"I am having some trouble parsing xml with jQuery. I have a fragment of xml text and I would like to extract a certain node's value. But this isn't working in IE. It works fine in Chrome.\n\n$(function () {\n var xmlText = '<?xml version=\"1.0\" encoding=\"UTF-8\" ?><dog_info><keyspec><keycaps><aes /><v-clock /></keycaps><dog>';\n xmlText += '<dogid>566578105</dogid><memoryinfo><access>read/write</access>';\n xmlText += '<fileid>65524</fileid><size>128</size></memoryinfo></dog></keyspec></dog_info>';\n alert($(xmlText).find(\"dogid\").text()); //this do not work in ie\n})"
] | [
"jquery",
"xml",
"internet-explorer",
"cross-browser"
] |
[
"Problem adding objects to array in iPhone SDK",
"I'm having a problem with adding objects to an NSArray in iPhone SDK. The problem is that it only adds the last object of my NSDictionary. This is the code:\n\nNSArray * processes = [[UIDevice currentDevice] runningProcesses];\nfor (NSDictionary * dict in processes){\n runningprocesses = [[NSMutableArray alloc] init];\n NSString *process = [dict objectForKey:@\"ProcessName\"];\n [runningprocesses addObject:process];\n}\n\n\nWhen I NSLog [dict objectForKey:@\"ProcessName\"] it shows me all the processes but if I try to add them it only adds the last one. What could be happening?"
] | [
"iphone",
"ios",
"cocoa-touch"
] |
[
"reduce output must shrink more rapidly, on adding new document",
"I have couple of documents in couchdb, each having a cId field, such as - \n\n{\n \"_id\": \"ccf8a36e55913b7cf5b015d6c50009f7\",\n \"_rev\": \"8-586130996ad60ccef54775c51599e73f\",\n \"cId\": 1,\n \"Status\": true\n}\n\n\nI have a simple view, which tries to return max of cId with map and reduce functions as follows - \n\nMap\n\nfunction(doc) {\n emit(null, doc.cId);\n}\n\n\nReduce\n\nfunction(key, values, rereduce){\n\n return Math.max.apply(null, values);\n}\n\n\nThis works fine (output is 1) until I add one more document with cId = 2 in db. I am expecting output as 2 but it starts giving error as \"Reduce output must shrink more rapidly\". When I delete this document things are back to normal again. What can be the issue here? Is there any alternative way to achieve this?\n\nNote: There are more views in db, which perform different role and few return json as well. They also start failing on this change."
] | [
"couchdb",
"couchdb-futon"
] |
[
"Retirve Entity Information got exception using session.laod when after session is closed",
"Iam loading the student object using load method after closing the session iam trying to print the Student name in hibernate 3.0.But i got LazyInitializationException: could not initialize proxy - the owning Session was closed.i mentioned the code snipet\n\n Session session=HibernateUtil.currentSession();\n Transaction tx=session.beginTransaction();\n Object o1=session.load(Student.class,new Integer(2));\n tx.commit();\n session.close();\n log.info(\"Student name\"+((Student)o1).getSname());\n\n\nthen i added another attribute lazy=\"true\".But same error has thrown.How to resolve this issue."
] | [
"hibernate"
] |
[
"Can I set the ButtonUI for only a subset of JButton classes?",
"I want to create a button class and use a ButtonUI to render it instead of overriding the paint component method. I do not want to use this ButtonUI for ALL JButtons. Is that possible? I've only ever seen UIManager.put(\"ButtonUI\",\"MyCustomButtonUI\"), but does this affect ALL JButton rendering? Is it possible to limit the scope of the put operation?"
] | [
"java",
"swing",
"user-interface"
] |
[
"Average progress of all the NSURLSessionTasks in a NSURLSession",
"An NSURLSession will allow you to add to it a large number of NSURLSessionTask to download in the background. \n\nIf you want to check the progress of a single NSURLSessionTask, it’s as easy as\n\ndouble taskProgress = (double)task.countOfBytesReceived / (double)task.countOfBytesExpectedToReceive;\n\nBut what is the best way to check the average progress of all the NSURLSessionTasks in a NSURLSession? \n\nI thought I’d try averaging the progress of all tasks:\n\n[[self backgroundSession] getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *allDownloadTasks) {\n\n double totalProgress = 0.0;\n\n for (NSURLSessionDownloadTask *task in allDownloadTasks) {\n\n double taskProgress = (double)task.countOfBytesReceived / (double)task.countOfBytesExpectedToReceive;\n\n if (task.countOfBytesExpectedToReceive > 0) {\n totalProgress = totalProgress + taskProgress;\n }\n NSLog(@\"task %d: %.0f/%.0f - %.2f%%\", task.taskIdentifier, (double)task.countOfBytesReceived, (double)task.countOfBytesExpectedToReceive, taskProgress*100);\n }\n\n double averageProgress = totalProgress / (double)allDownloadTasks.count;\n\n NSLog(@\"total progress: %.2f, average progress: %f\", totalProgress, averageProgress);\n NSLog(@\" \");\n\n}];\n\n\nBut the logic here is wrong: Suppose you have 50 tasks expecting to download 1MB and 3 tasks expecting to download 100MB. If the 50 small tasks complete before the 3 large tasks, averageProgress will be much higher than the actual average progress. \n\nSo you have to calculate average progress according to the TOTAL countOfBytesReceived divided by the TOTAL countOfBytesExpectedToReceive. But the problem is that a NSURLSessionTask figures out those values only once it starts, and it might not start until another task finishes. \n\nSo how do you check the average progress of all the NSURLSessionTasks in a NSURLSession?"
] | [
"ios",
"macos",
"cocoa-touch",
"cocoa",
"nsurlsession"
] |
[
"Regular Expression: Splitting by whitespace while recognizing \" \" as a token",
"I'm using Python. For the following text,\n\nfoo boo \" \" cat\n\nI want to split by whitespaces, but \" \" should be a token.\n\n['foo', 'boo', '\" \"', 'cat']\n\nThis is what I want, but not easy to do. My stupid approach is replacing \" \" with non-spaced symbol... But, I believe it is doable just using RE."
] | [
"python",
"regex",
"python-2.7"
] |
[
"MultipleObjectsReturned: get() returned more than one object on DetailView",
"views.py \n\nclass ArticleDetail(DetailView):\n model = Article\n\n def get_queryset(self):\n public_articles = Article.objects.filter(is_public=True)\n private_authored_articles = Article.objects.filter(is_public=False, author=self.request.user)\n return public_articles.union(private_authored_articles)\n\n\nurls.py\n\npath('articles/<slug:slug>/', views.ArticleDetail.as_view(), name='article-detail')\n\n\nmodels.py\n\nclass Article(models.Model):\n ...\n title = models.CharField(max_length=255, default='', blank=False)\n slug = models.SlugField(unique=True, editable=False)\n def save(self, *args, **kwargs):\n self.slug = slugify(self.title)\n super(Article, self).save(*args, **kwargs)\n\n\nI want users to be able to see a detail view of a specific article identified by a unique slug. A user should have access to the detail view of an article if either it is public or it was authored by the current user and is not public. Author is a foreign key to my user model. I have this same get_queryset() logic in my ListView and it gives me exactly what I want however when I click on any of the articles to request the detail view I get the MultipleObjectsReturned exception. Another note is django_debug_toolbar is saying the view is sending duplicated queries. The number of queries and the number of objects returned are equal so I need to figure out why it is sending duplicate queries, possibly caused by the foreign key relationship."
] | [
"django",
"django-views"
] |
[
"Parse unformatted dates in Python",
"I have some text, taken from different websites, that I want to extract dates from. As one can imagine, the dates vary substantially in how they are formatted, and look something like:\n\nPosted: 10/01/2014 \nPublished on August 1st 2014\nLast modified on 5th of July 2014\nPosted by Dave on 10-01-14\n\n\nWhat I want to know is if anyone knows of a Python library [or API] which would help with this - (other than e.g. regex, which will be my fallback). I could probably relatively easily remove the \"posed on\" parts, but getting the other stuff consistent does not look easy."
] | [
"python",
"python-2.7",
"parsing"
] |
[
"Facebook SDK: Create Project from existing source is empty",
"I have tried to use this tutorial and when I clicked finished, I have noticed that the src was empty, screenshot below: The facebook project in my folder is complete, so my question do I need to manually copy all the files to the folder? And why was this empty?\n\n\n\nEdited:\nI'm using Eclipse Indigo and Android ADT Version 18."
] | [
"android",
"eclipse",
"ubuntu"
] |
[
"Error 1001 using custom installer with Visual Studio 2008",
"I've created a simple winforms app and a custom installer. It all seems simple enough but I get the following popup and error details in the event log.\n\n\n\n\n The description for Event ID 11001 from source MsiInstaller cannot be\n found. Either the component that raises this event is not installed on\n your local computer or the installation is corrupted. You can install\n or repair the component on the local computer.\n \n If the event originated on another computer, the display information\n had to be saved with the event.\n \n The following information was included with the event: \n \n Product: Custom Action Tester -- Error 1001. Error 1001. Exception\n occurred while initializing the installation:\n System.IO.FileNotFoundException: Could not load file or assembly\n 'file:///C:\\Windows\\system32\\Action' or one of its dependencies. The\n system cannot find the file specified.. (NULL) (NULL) (NULL) (NULL)\n (NULL)\n \n the message resource is present but the message is not found in the\n string/message table\n\n\nI have checked C:\\Windows\\system32 and there is no file or folder called Action but there are 3 files called ActionCenter.dll, ActionCenterCPL.dll and ActionQueue.dll\n\nAny ideas how I resolve this error?\n\nEDIT:\n\nFollowing the suggestion of cosmin-pirvu I ran the installer with logging. The area where it appears to error is shown below but I'm still none the wiser as how to resolve the issue.\n\nMSI (s) (40:7C) [09:34:26:523]: Executing op: CustomActionSchedule(Action=_FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install,ActionType=3073,Source=BinaryData,Target=ManagedInstall,CustomActionData=/installtype=notransaction /action=install /LogFile= /targetdir=\"C:\\Test\\Custom Action Tester\\\" /Param1=\"C:\\Test\\TestFile.txt\" /Param2=\"C:\\Test\\\" \"C:\\Test\\Custom Action Tester\\ConfigSetup.dll\" \"C:\\Users\\wildb\\AppData\\Local\\Temp\\CFG66BE.tmp\")\nMSI (s) (40:94) [09:34:26:525]: Invoking remote custom action. DLL: C:\\Windows\\Installer\\MSI85A8.tmp, Entrypoint: ManagedInstall\nMSI (s) (40:F0) [09:34:26:525]: Generating random cookie.\nMSI (s) (40:F0) [09:34:26:557]: Created Custom Action Server with PID 6492 (0x195C).\nMSI (s) (40:D4) [09:34:26:586]: Running as a service.\nMSI (s) (40:D4) [09:34:26:587]: Hello, I'm your 32bit Elevated custom action server.\nDEBUG: Error 2835: The control ErrorIcon was not found on dialog ErrorDialog\nThe installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2835. The arguments are: ErrorIcon, ErrorDialog, \nError 1001. Error 1001. Exception occurred while initializing the installation:\nSystem.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\\Windows\\system32\\Action' or one of its dependencies. The system cannot find the file specified..\nMSI (s) (40!4C) [09:34:29:580]: \nMSI (s) (40:94) [09:34:29:584]: Leaked MSIHANDLE (14) of type 790531 for thread 7244\nMSI (s) (40:94) [09:34:29:584]: Note: 1: 2769 2: _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install 3: 1 \nDEBUG: Error 2769: Custom Action _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install did not close 1 MSIHANDLEs.\nThe installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install, 1, \nCustomAction _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)\nAction ended 09:34:29: InstallExecute. Return value 3.\n\n\nThis was supposed to be a quick win to make life simpler for our users; they didn't want to have to edit config files... but it's turned into a bit of a nightmare. :o(\n\nEDIT 2: \n\nAfter a lot of playing around, the error only presents itself when parameters are specified in the custom action as shown in the picture. The problem is, the custom installer is useless without being able to read the values entered in the preceding install screens."
] | [
"visual-studio-2008",
"custom-action"
] |
[
"\"Execute Code First Migrations\" checkbox disappeared from my publish profile",
"I'm using web deploy to deploy an MVC4 application using EF5 code first. I made a publish profile called \"development\" that uses web deploy for application and database using the 'Execute Code First Migrations' checkbox to run migrations on application startup. The publishing worked great for a while. At some point I added a new publish profile called \"test\" to deploy to another server, which uses the ftp method of deploy and no automatic migrations. This works fine too. However, when I tried to use my old \"development\" publish profile again, VS changes the settings automatically to the dbDacFx way ('Update database' checkbox instead of 'Execute Code First Migrations') and I can't get it back to the way it was.\nThere were some other changes to the project while using the 'Test' profile, but nothing that seems to me like it could cause this. Does anyone know why VS thinks my project doesn't use code first anymore?"
] | [
"asp.net-mvc-4",
"entity-framework-5",
"entity-framework-migrations"
] |
[
"Magento: how to merge two collections while inside the Observer?",
"I need to reorganize the product listing category page.\nI have a date_field attribute in my products that need to follow this ranking:\n\n\nproducts with date_field >= today appears first\nmerge it to products with date_field < today\n\n\nSo, I created an observer for catalog_block_product_list_collection dispatcher with the following code:\n\n$original_collection = clone $observer->getEvent()->getCollection();\n\n$observer->getEvent()->getCollection()\n ->addAttributeToFilter('data_inicio', array('gteq' => date('Y-m-d')));\n\n$collection2 = $original_collection\n ->addAttributeToFilter('data_inicio', array('lt' => date('Y-m-d')));\n\n//and after I will merge both collections by adding each item from $collection2 into $observer\n\n\nBut when applying the same filter again on $collection2 it raises the following error:\n\n\n You cannot define a correlation name '_table_data_inicio_default' more\n than once\n\n\nOnly the first part of the filter works fine.\nIs there a better way for doing that?"
] | [
"magento"
] |
[
"How to prevent caching of static files in embedded Jetty instance?",
"I want to prevent my CSSs from being cached on the browser side. How can I do it in embedded Jetty instance?\n\nIf I were using xml configuration file, I would add lines like:\n\n<init-param>\n <param-name>cacheControl</param-name>\n <param-value>max-age=0,public</param-value>\n</init-param>\n\n\nHow I can turn that into the code? \n\nRight now I start Jetty this way:\n\nBasicConfigurator.configure();\n\nServer server = new Server();\nSocketConnector connector = new SocketConnector();\n// Set some timeout options to make debugging easier.\n// 1 hour\nconnector.setMaxIdleTime( 1000 * 60 * 60 );\nconnector.setSoLingerTime( -1 );\nconnector.setPort( 8081 );\nserver.setConnectors( new Connector[] { connector } );\n\nWebAppContext bb = new WebAppContext();\nbb.setServer( server );\nbb.setContextPath( \"/\" );\nbb.setWar( \"src/webapp\" );\n\nserver.addHandler( bb );\n\n\nI think I should search setControlCache somewhere in the WebAppContext area of responsibility.\n\nAny advices on this?"
] | [
"caching",
"jetty",
"embedded-jetty"
] |
[
"Show options - select using jQuery",
"I have two select lists. How, using jquery, can I show only the options in 2nd select with the same value of an option in 1st select?\n\nE.g - for clothes in 1st select, show only clothes - mens and clothes - ladies from the 2nd list.\n\n<select name=\"cat\">\n <option value=\"1\">clothes</option>\n <option value=\"2\">shoes</option>\n <option value=\"3\">other</option>\n</select>\n\n\nand\n\n<select name=\"prod\">\n <option value=\"1\">clothes - mens</option>\n <option value=\"1\">clothes - ladies</option>\n <option value=\"2\">shoes - mens</option>\n <option value=\"2\">shoes - ladies</option>\n <option value=\"3\">other - mens</option>\n <option value=\"3\">other - ladies</option>\n</select>"
] | [
"jquery",
"html-select"
] |
[
"Apply a request action foreach data angular 2",
"In angular 2, I want to dispatch a request for multiple data.\nFor example I have some user data (2 ids) and want to apply a request for every id.\nMy code:\n\nhandleOnBulkAction(actionId) {\n const dataUser = this.userState.bulkList.map((userId) => {\n return {\n item: userId,\n };\n });\n this.dialogRef.afterClosed().subscribe(result => {\n if (result) {\n dataUser.forEach(user => {\n console.log(user); //it return the id\n this.store.dispatch(new user.DeleteAction({\n user: user.item,\n organisationId: this.organisationId\n }));\n });\n }\n this.dialogRef = null;\n });\n return;\n}\n\n\nAnd it gives the error:\n\nERROR TypeError: user.DeleteAction is not a constructor\n\n\nDo you have any idea?\n\nEDIT:\nactions/user.ts\n\nexport class DeleteAction implements Action {\n type = ActionTypes.DELETE;\n\n constructor(public payload: any) {\n }\n}\n\n\neffects:\n\n@Effect()\ndelete$: Observable<Action> = this.actions$\n.ofType(user.ActionTypes.DELETE)\n.map(toPayload)\n.switchMap((args) => {\n return this.userService.deleteUser(args.user)\n .concatMap(response => [\n new user.DeleteSuccessAction(args.user),\n new organisation.FetchOneAction(args.organisationId)\n ])\n .catch((error) => [\n new layout.HideLoadingAction(),\n new user.ChangeStatusErrorAction(error)\n ]);\n});\n\n\nservice:\n\n public deleteUser(user) {\n return this.http.delete(`${this.userApi}/${user.id}`, {\n withCredentials: true,\n }).map(() => {\n }).catch(this.errorService.handleError);\n }"
] | [
"angular"
] |
[
"Trouble with Java decimal to binary converter",
"I am learning Java and have been trying to build this converter for more than a week, but this attempt sometimes leaves out a necessary 0 and also does not give a result for the input \"1\".\n\nthis code has imported javax.swing.*; // allows for \"JOptionPane.showInputDialog\", a request for typed information plus a message\n\npublic static void main(String[] args) {\n // TODO Auto-generated method stub\n char number;\n int input, length;\n String reversedBinary = \"\", binary = \"\";\n\n input = Integer.parseInt(JOptionPane.showInputDialog\n (\"What number would you like converted to binary?\")); // Requesting user to give input\n\n do { // gets the reversed binary. For instance: 5 = 101\n reversedBinary = reversedBinary + \"\" + input % 2;\n input = input/2;\n } while (input > 0);\n\n length = reversedBinary.length();\n length--; // getting the usable position numbers instead of having length give me the position one ahead\n\n while (length > 0) { // some code to reverse the string\n number = reversedBinary.charAt(length);\n binary = binary + number;\n length--; // \"reversedBinary\" is reversed and the result is input into \"binary\"\n }\n System.out.print(\"The number converted to binary is: \" + binary); // output result\n}\n\n\n}"
] | [
"java",
"binary"
] |
[
"Hybris - Adding new column in cscockpit search result",
"I am customizing the cscockpit for a module Order Search. Presently it shows three fields in the Order Search Result list. This setting is configured in a CockpitGroup.xml file named Order_OrderSearchResult_CockpitGroup.xml (Location: hybris\\bin\\ext-channel\\cscockpit\\resources\\cscockpit\\import\\config)\n\nMy customized project is at location: hybris\\bin\\custom\nHow should I make a custom file of existing CockpitGroup.xml to include my new field?\nThe contents of Order_OrderSearchResult_CockpitGroup.xml are as below:\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<list-view unassigned-group-name=\"Other\">\n <group name=\"General\">\n <property qualifier=\"Order.creationtime\" visible=\"true\"/>\n <property qualifier=\"Order.code\" visible=\"true\"/>\n <property qualifier=\"Order.salesApplication\" visible=\"true\"/>\n </group>\n</list-view>\n\n\nI want to add a new field Order.downloadDate."
] | [
"hybris",
"cs-cockpit"
] |
[
"Is it possible to mock a PECL extension in PHP?",
"I am developing a wrapper for datastax cassandra extension.\n\nSimple usage of the extension is like below which tries to connect to a Cassandra server on 127.0.0.1:9042:\n\n$connection = \\Cassandra::cluster()->build()->connect(); // instance of \\Cassandra\\DefaultSession\n\n\nObviously it gets errors since no running server is available.\n\nI tried to mock all these calls step by step, but it does not work.\nWith package mockery/mockery the main problems are:\n\n\n\\Cassandra, \\Cassandra\\Cluster\\Builder and \\Cassandra\\DefaultSession are all defined as final classes\nAll classes are preloaded, so proxy and partial mocking don't work\nI don't want to run a cassandra server on my machine because it cannot handle such a heavy server and also I want to setup a CI for the package I am developing\n\n\nAny idea of how to handle such situation?"
] | [
"php",
"unit-testing",
"phpunit",
"mockery"
] |
[
"Why is Azure SQL database so expensive?",
"For a small personal coding project I recently created a SQL database in Azure. For the past weeks I have been hardly using the database, out of 2 GB available space I have been using only 13 MB.\n\nHowever, the database costs me 6,70 EUR per day and I don't understand why this is the case. Read a few topics/posts stating that the costs with similar use should be around 5-7 EUR per month, not per day.\n\nThis is the configuration for the database:\n\n\nNo elastic pool\nGeneral purpose, Gen5, 2 vCores\nWest Europe\n\n\nDoes anyone have an idea about what could be causing the costs per month to be so high?"
] | [
"sql",
"azure",
"azure-sql-database"
] |
[
"Why is this expression inside a for-loop acting weird in R?",
"I'm running a for loop with i from 3 to 21. And I'm printing 5 values of 'i' using its index:\n\nfor (i in 3:21 )\n{ \n print(i)\n print(i-2 : i+2)\n\n}\n\n\nThe actual output is:\n\n[1] 3\n[1] 3 2\n[1] 4\n[1] 4 3 2\n[1] 5\n[1] 5 4 3 2\n[1] 6\n[1] 6 5 4 3 2\n[1] 7\n[1] 7 6 5 4 3 2\n[1] 8\n[1] 8 7 6 5 4 3 2 and etc\n\n\nBut I was expecting:\n\n3\n1 2 3 4 5\n4\n4 5 6 7 8 \n5\n5 6 7 8 9 \n6\n6 7 8 9 10 and etc\n\n\nI guess I'm not using the index properly.. Where did I go wrong??"
] | [
"r"
] |
[
"Finding a string within a list",
"So very stuck\nFirstly my HTML is very hard. Sometimes it has missing data like below. My purpose is the get the text after strong (so GOOD, 1:56:5, 1:56.5 etc etc).\nSince the data is jumbled, i potentially want nested if statements so when i construct list my data is true (see below code)\nMissing data HTML\n<td><strong>Track Rating:</strong> GOOD</td>\n<td></td>\n<td><strong>Gross Time:</strong> 1:56:5</td>\n<td><strong>Mile Rate:</strong> 1:56:5</td>\n\nNormal HTML\n<td><strong>Track Rating:</strong> GOOD</td>\n<td><strong>Gross Time:</strong> 2:29:6</td>\n<td><strong>Mile Rate:</strong> 1:58:6</td>\n<td><strong>Lead Time:</strong> 30.3</td>\n\nMy code is below where i want to extract the data from my if statement yet im stuck. Any help appreciated. What im trying to do is collect GOOD here and store it in trackrating and do that for every tracking rating i scrape - if it doesnt exist, i want to store it as blank.\ntableoftimes = race.find('table', class_='raceTimes')\n for row in tableoftimes.find_all('tr'):\n string23 = [td.get_text() for td in row.find_all('td')]\n matching = [s for s in string23 if "Track Rating: " in s]\n if matching:\n trackrating = matching (#want to split to get after : but wont work in list)\n else:\n trackrating = ''"
] | [
"python",
"html",
"beautifulsoup"
] |
[
"Return full results linq grouping query",
"I'm trying to group and still retrieve all the data in the table. I'm still pretty new to Linq and can't seem to tell what I'm doing wrong. I not only want to group the results but I still want to retrieve all the columns in the table. Is this possible?\n\n (from r in db.Form\n orderby r.CreatedDate descending\n group r by r.Record into myGroup\n where myGroup.Count() > 0\n where (r.CreatedDate > lastmonth)\n where r.Name == \"Test Name\"\n select new { r, myGroup.Key, Count = myGroup.Count() }\n )\n\n\nSome how \"r\" loses its context or since I grouped \"r\" it has been replaced. Not sure."
] | [
"c#",
"linq"
] |
[
"Firebase DB, What is the ID Name for Client Built Push IDs",
"In regards to the answer found here, what would be the name of the push ID? I've tried .ref('/parent/{pushId}') & .child(key) all with no luck."
] | [
"firebase-realtime-database"
] |
[
"Close angular material sidenav on any button click inside",
"I have an Angular 4 Material Sidenav on my application, and it has a bunch of buttons in it, some of which call functions, and others route to other pages. \n\nOutside of having every button call the same function which then looks up what function to call (like with a switch on a param sent in), is there a built-in way to have the sidenav close on child click?\n\nHere's what the sidenav looks like:\n\n<md-sidenav #sidenav align=\"end\">\n <br/>\n <span style=\"margin: 17px\">{{auth?.userProfile?.name}}</span> <br />\n <button md-button routerLink=\"/spells\"> All Spells </button> <br />\n <button md-button (click)=\"login()\" *ngIf=\"!auth.authenticated()\">Log In</button>\n <button md-button routerLink=\"/spellbook\" *ngIf=\"auth.authenticated()\"> My Spellbooks </button> <br />\n <button md-button (click)=\"auth.logout()\" *ngIf=\"auth.authenticated()\">Log Out</button>\n</md-sidenav>"
] | [
"angular",
"angular-material2"
] |
[
"Report crash on live deploy, works just fine locally in VS 2013",
"I just migrated a VS2008 app to VS2013. Everything works great locally. However, when deployed, the report I have crashes with the following error:\n\n An error occurred during local report processing.\nThe report definition for report 'myReport' has not been specified\nCould not find file 'D:\\docroot\\appdev\\wsds\\application\\Report\\myReport.rdlc'.\n\n\nCalled from my aspx page as so:\n\n<rsweb:ReportViewer ID=\"myReport\" runat=\"server\" Font-Names=\"Verdana\" \n Font-Size=\"8pt\" Height=\"750px\" Width=\"850px\" >\n <localreport reportpath=\"Report\\myReport.rdlc\">\n <datasources>\n <rsweb:ReportDataSource DataSourceId=\"dsReportStuff\" \n Name=\"reportStuffDataSet_reportStuff\" />\n </datasources>\n </localreport>\n</rsweb:ReportViewer>\n\n\nWhat the even heck is going on? This code worked great on my old '08 install which used report viewer 10. I have upgraded to report viewer 11 due to the migration."
] | [
"visual-studio-2013",
"reportviewer"
] |
[
"how to read user ROLES using XSJS?",
"I would like to know what the session user has access to. For example if user X has access to a particular database or a set of tables. When looking into HANA I see that I have the PUBLIC role that allows me to see the database, how can I pull this information using XSJS so I can perform logic based on those roles? \nI've used $.session.hasSystemPrivilege(\"PRIV\"); but this is different than checking roles. I tried testing for \"INSERT\" for inserting into the database which returned false. I know that I can write to the tables. Looking in to the HANA, the system privileges tab is empty for me. \n\nCould someone give me some guidance here?"
] | [
"hana"
] |
[
"Refer to \"link.path\" while redirecting to root using [routerLink]",
"I have an application that uses a typescript file for setting up links and within the template I use ngFor to interpolate through the links and build a navigation bar. Within those link objects there is a property called link.path containing the path to be redirected to. I use [routerLink] to redirect to the path required, which works fine, but I was not at the root url. I need to achieve this functionality, which appends the child route to the root of the application. However, after changing my implementation to:\n\n[routerLink]= '[\"/link.path\"]'\n\nOn click I am redirected to <URL>/link.path rather than <URL>/<name under link.path> which naturally gives me a not found error.\n\nhow do i change my expression above to show the actual value inside this parameter rather than giving me link.path as a string?\n\ncomponent.ts\n\n// imports, declarations of classes and other stuff.\n\n * @property {array} links\n */\n links: Array<{ text: string, path: string }>;\n\n /**\n * constructor for toolbar component is responsible for initializing translatePipe, dynamic routing and router,\n * as well as adding routes dynamically to the router and the dynamicRouting service\n * @param translate\n * @param router\n * @param dynamicRouting\n *\n */\n constructor(private translate: TranslatePipe, private router: Router, private dynamicRouting: DynamicRoutingService) {\n this.router.config.unshift(\n { path: 'knowledge-base', component: DummyComponent },\n { path: 'home', component: DummyComponent },\n { path: 'settings', component: DummyComponent }\n );\n this.dynamicRouting.addItem({ text: \"home\", path: \"home\" });\n this.dynamicRouting.addItem({ text: \"knowledge_base\", path: \"knowledge-base\" });\n this.dynamicRouting.addItem({ text: \"settings\", path: \"settings\" });\n }\n /**\n * Upon initialization this function fetches the links and inserts the translated\n * text and path to be used by the template\n *\n * @param\n * @return\n */\n ngOnInit() {\n this.links = [];\n let rawData = this.dynamicRouting.getLinks();\n let self = this;\n rawData.forEach(function(data) {\n let text = self.translate.transform(\"generic[toolbar][categories][\" + data.text + \"][label]\");\n self.links.push({ text: text, path: data.path });\n });\n\n //rest of the methods\n\n\nhtml\n\n<app-header\n [fixed]=\"true\"\n [navbarBrandFull]=\"{src: 'assets/logo.png', width: 143, height: 36, alt: 'RT Logo'}\"\n [navbarBrandMinimized]=\"{src: 'assets/logo2.png', width: 35, height: 35, alt: 'RT Logo'}\"\n [sidebarToggler]=\"'lg'\">\n <ul class=\"nav navbar-nav d-md-down-none\" routerLinkActive=\"active\">\n <li class=\"nav-item px-3\" *ngFor=\"let link of links\">\n <a class=\"nav-link\" [routerLink]='[\"/link.path\"]'>{{ link.text }}</a>\n </li>\n </ul>\n <ul class=\"nav navbar-nav ml-auto\">\n </ul>\n</app-header>"
] | [
"angular",
"typescript"
] |
[
"How can I merge route declarations (subdomain or token)?",
"I have a model Model that can be access from many ways: by subdomain or a token\n\n\nhttp://model1.domain.com\nhttp://domain.com/j4h7\n\n\nI have the following routes\n\nresources :model, :constraints => {:model_id => /[a-zA-Z0-9]{4}/} do\n ... (nested resources...)\nend\nresources :model, :constraints => {:subdomain => /.+/} do\n ... (same as above: nested resources...)\nend\n\n\nSo I currently have to duplicate all the routes for the two cases.\n\nIs there any way to declare it only once?"
] | [
"ruby-on-rails",
"subdomain",
"constraints",
"routes"
] |
[
"Using ColdFusion 9's ORM, how do you create a property that converts a database string into a boolean value?",
"I'm working with a legacy database that stores a boolean column as a string, where true is \"Y\" and false is an empty string. How would I map a property so that it's able to convert this value to an actual boolean, but still save to the database as \"Y\" and empty string, for legacy purposes?"
] | [
"hibernate",
"orm",
"coldfusion",
"coldfusion-9"
] |
[
"Custom error messaging on Hibernate Validation",
"I am trying to set up Hibernate Validation in my ecommerce site. \nI have an order object with multiple objects assigned. As the customer goes through the checkout, I want to be able to individually validate these objects - sometimes multiple objects with one form.\n\nFor example, upon submitting the delivery form, the deliveryCharge and deliveryAddress should be validated. If this validation fails, the delivery form will be returned with a list of validation errors.\n\nI can validate the objects via a java implementation, however when I try to view these on the view tier using <form:error /> tag, I am not getting anything.\n\nOrder Model\n\n@Entity\n@Table(name = \"bees_address\")\npublic class Address {\n @OneToOne\n @JoinColumn(name = \"paymentAddress\")\n private Address payment;\n\n @OneToOne\n @JoinColumn(name = \"deliveryAddress\")\n private Address payment;\n\n @Column(name = \"deliveryCharge\")\n private Integer deliveryCharge;\n ...\n\n\nAddress Model\n\n@Entity\n@Table(name = \"bees_address\")\npublic class Address {\n @Size(min=2, max=150)\n @Column(name = \"line1\", length = 150)\n private String line1;\n ...\n\n\nController\n\npublic String updateDelivery(HttpServletRequest request, @ModelAttribute(\"basket\") Order basketUpdate) {\n\n Address deliveryAddress = basketUpdate.getDeliveryAddress();\n\n if (!Validate.isValid(request, deliveryAddress)) {\n logger.info(\"Delivery address does not validate\");\n return \"redirect:/checkout/delivery\"; \n } else {\n /* do stuff here */\n }\n\n return \"redirect:/checkout/payment\";\n}\n\n\nValidation\nHibernate Validation Docs\n\npublic static Boolean isValid(HttpServletRequest request, Address address) {\n ValidatorFactory factory = Validation.buildDefaultValidatorFactory();\n Validator validator = factory.getValidator();\n\n Set<ConstraintViolation<Address>> constraintViolations = validator.validate(address);\n request.getSession().setAttribute(\"formErrors\", constraintViolations);\n\n return constraintViolations.size() < 1;\n}\n\n\nJSP Structure\n\n<form:form action=\"${url}\" method=\"post\" modelAttribute=\"basket\"\n Charge: <form:input path=\"deliveryCharge\" />\n Address: <form:input path=\"deliveryAddress.line1\" />\n <form:error path=\"deliveryAddress.line1\" />\n ...\n\n\nMany thanks"
] | [
"java",
"spring",
"hibernate",
"validation",
"hibernate-validator"
] |
[
"Alternative (to Axis 1.4) WSDL to Java 14 client generator that supports \"RPC/encoded\" format",
"The Problems\nAxis 1.4 & JDK 14\nI'm trying to update our application from Java 8 to Java 14, and in doing so, I discovered that Axis 1.4 seems to generate client code that is no longer valid for the newer version of Java.\nThe issue boils down to Axis' use of com.sun.net.ssl.internal.ssl.Provider... when running on JDK 14, this throws a NoClassDefFoundError:\nCaused by: java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider\n\nRPC/encoded WSDLs\nThe WSDls that I'm trying to parse are from a 3rd party, and unfortunately they are RPC/encoded, which I didn't know until now, is a legacy, seemingly no longer supported, WSDL format.\nThus, my journey to find an alternative to Axis 1.4 - which gladly handles the legacy RPC/encoded format due to it being a very outdated library itself.\n\nThe Attempted Solutions\nLooked For Replacement Jar\nMy first thought, was to research whether or not the com.sun.net.ssl.internal.ssl.Provider lives in a jar in maven central... similar to how some of the other built-in packages were moved to external jars in Java's more recent versions. I found that the package was removed as part of JDK-8218932, but my research fell short, and wasn't able to find a recommended dependency that I could use in it's place.\nOther WSDL to Java Methods\nNext I tried to use some of the other WSDL to Java generators that I found... Unfortunately, they all seem not to support the legacy RPC/encoded format that this 3rd party WSDL is.\njavaws-maven-plugin\n[ERROR] "Use of SOAP Encoding is not supported.\nSOAP extension element on line 46 in file:/<path>/wsdl/kas.wsdl has use="encoded" "\n\ncxf-codegen-plugin\nExecution kas of goal org.apache.cxf:cxf-codegen-plugin:3.3.7:wsdl2java failed:\nRpc/encoded wsdls are not supported with CXF\n\nAxis 2\nDidn't bother attempting, because it clearly states on their website:\n\nNote that Axis2 currently does not support the rpc/encoded style.\n\nAsk The 3rd Party to Update WSDLs\nI plan on reaching out to the 3rd party to see if they could update their WSDLs... however, they seem to currently be generated with Axis 1.3 as they have:\n<!--WSDL created by Apache Axis version: 1.3\n\nI'm not sure how to present to them exactly what they need to do in order to switch their system to a more recent style of WSDL. Additionally, I don't have much confidence in them being willing to change since they have multiple different versions we integrate with, and this would affect all their other clients that have integrations.\n\nThanks\nAny suggestion will be greatly appreciated"
] | [
"java",
"soap",
"wsdl",
"code-generation",
"axis"
] |
[
"Android webview, loading css live file, add local",
"Am using android webview tutorial based create application. how to get local file in live android. Coding given below help me. \n\nString htmlData;\nhtmlData = \"<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"Style.css\\\" />\";\n//lets assume we have /assets/style.css file\nmWebView.loadDataWithBaseURL(\"file:///android_asset/\", htmlData, \"text/html\", \"UTF-8\", null);"
] | [
"android",
"css",
"webview"
] |
[
"Linked List in C, not linking properly",
"So I am trying to link a list together from user input their own file , but when I try printing it only prints the the first line, I believe the problem lies somewhere below in my code fragment, I think currp is not getting currp-next.\n\nwhile ((fscanf( fpin, \"'%[^']' %f %f %d\" ,currp->name, &currp->cost,\n &currp->weight, &currp->dam) ==4 ))\n {\n prev = currp;\n currp->next = malloc(sizeof(item_t));\n assert(currp->next);\n currp = currp->next;\n }\n\n prev->next = NULL;\n free(currp);\n fclose(fpin);\n\n return (itb);"
] | [
"c",
"linked-list"
] |
[
"Return CSV from Api without putting all database results in string",
"So what I want to do is have an api that gets a couple of columns from a big database, and returns them as CSV (text).\nThe problem arises if i try to first get them, then build the csv, because the memory fills up quickly\n(400mb for 800k rows).\nThis is the closest I've gotten to getting it to work, but The format isn't really CSV, It's rows separated by Quotes, and it isn't a single string. \n\n public IEnumerable<string> getCSV()\n {\n\n var names = typeof(AddressBook).GetProperties()\n .Select(property => property.Name)\n .ToArray();\n yield return string.Join(\",\", names);\n foreach( string name in names)\n\n var query = context.AddressBook.Select(x => string.Join(\",\", x.Name, x.Surname, x.BirthDate)).AsNoTracking();\n\n\n foreach (string row in query)\n {\n yield return row;\n }\n\n }"
] | [
"c#",
".net",
"asp.net-core",
"entity-framework-core"
] |
[
"How to user cossou/jasperphp with yii2 generate reports",
"It says Class 'cossou\\JasperPHP\\JasperPHP' not found.\nI used this class as the namespace\n\n$jasper = new JasperPHP;\n\n //jasper ready to call\n $jasper->compile(__DIR__ . '/../../vendor/cossou/jasperphp/examples/hello_world.jrxml')->execute();\n\n // Process a Jasper file to PDF and RTF (you can use directly the .jrxml)\n $jasper->process(\n __DIR__ . '/../../vendor/cossou/jasperphp/examples/hello_world.jasper',\n false,\n array(\"pdf\", \"rtf\"),\n array(\"php_version\" => phpversion())\n )->execute();\n\n // List the parameters from a Jasper file.\n $array = $jasper->list_parameters(\n __DIR__ . '/../../vendor/cossou/jasperphp/examples/hello_world.jasper'\n )->execute();\n\n return $this->redner('view');"
] | [
"php",
"yii2",
"jasper-reports"
] |
[
"Change default of Android Studio build.gradle",
"Currently, when I create a new Android Studio project, the project build.gradle file looks like so (in part):\n\nbuildscript {\n repositories {\n jcenter()\n }\n\n\nBecause I'm behind a firewall, I have to manually change it to this:\n\nbuildscript {\n repositories {\n jcenter {\n url \"http://jcenter.bintray.com/\"\n }\n\n\nNot a big deal, but is there a way to have Android Studio do this by default?"
] | [
"android",
"android-studio",
"jcenter"
] |
[
"For a type Class::Type, can I derive const Class::Type from a const Class?",
"I am implementing a container like:\n\ntemplate<typename T>\nclass Container\n{\npublic:\n using value_type = T;\n ...\n};\n\n\nIs there a good way to derive a const value_type from const Container?\n\nBackground:\n\nI have implemented iterator types via a nested template class:\n\ntemplate<typename Container, typename Value>\nclass iterator_base\n{\npublic:\n ...\n Value& operator*() const;\n\nprivate:\n Container* c;\n};\n\nusing iterator = iterator_base<Container, value_type>;\nusing const_iterator = iterator_base<const Container, const value_type>;\n\n\nwhich works okay, but the second template argument to iterator_base feels redundant."
] | [
"c++",
"c++11",
"constants",
"template-argument-deduction"
] |
[
"ttk equivalent of tix.FileEntry",
"I am looking for a ttk equivalent of tix.FileEntry. As I read, tix is not actively maintained, and it is preferred to use ttk instead. (and tix FileEntry is ugly)\n\nSo what is the ttk cousin of tix.FileEntry?"
] | [
"tkinter",
"ttk",
"tix"
] |
[
"Use 2 advanced data tables sb admin 2",
"I starting using bootstrap sb admin 2. I have a problem in having 2 advanced data tables. the first one is working, i am copy pasting to have a second one and the pagination is lost. Here is the picture\n\n\n\nThe problem is that both have the same id. Is there a solution on this?\n\nThanks!\n\nP.S. Sorry for bad tags I could not find the right ones.."
] | [
"jquery",
"twitter-bootstrap",
"datatables",
"admin",
"frontend"
] |
[
"Using a properties file inside jar on a JSF application",
"I'm developing a JSF application that uses a jar that I already have. This jar holds the application business logic and deals with a database.\nWhen I'm running unit tests in the jar application I could read/write/etc to the database (I have a .properties file with the database connection data).\n\nIn my JSF application I use that jar and when it needs to do some database stuff I get an \"java.io.FileNotFoundException: etc\\nm-hms-recipe.properties (The system cannot find the path specified) exception\".\n\nI already checked and the file is inside the jar that's is being used by my JSF application.\n\nSorry for my English, can anyone help?\nThanks."
] | [
"java",
"jsf",
"jsf-2",
"jar"
] |
[
"How to read hardware-level event information from touchscreen?",
"I'm working on a project to investigate the possibility of adding touch support to an application and so far the findings have been somewhat disappointing. My company uses Scientific Linux 6.4 (Linux kernel 2.6.32) and so far, I've found information suggesting that 2.6.30+ supports multi-touch HID, but I've also seen information suggesting that the multi-touch in this kernel doesn't work with Xorg interfaces.\n\nPutting aside market availability of touchscreens that are compatible with Linux, is there a way we can verify whether or not multi-touch inputs are generated on the system? We have an older ViewSonic touchscreen that has multi-touch capability, and after looking at the output from the evtest tool, I didn't notice any multi-touch events, but I don't know whether evtest is reading the touch events from X or the hardware level.\n\nI have no experience dealing with hardware programming or device drivers, so if anyone could give me some guidance on how to verify multi-touch HID compatibility with our version of Linux, whether we have to write our own driver, or read raw data from somewhere, any information you could provide would be great.\n\nEDIT: The evtest program lists supported events for the device and I don't see anything related to multi-touch, so it doesn't seem like it's supported, but is this an issue with the kernel, the specific device, or something else? The specific monitor I'm testing is a ViewSonic, which is listed as a \"Quanta Optical Touchscreen\" device. I saw somewhere that a driver for Quanta was added in 2.6.34. Am I just out of luck (for this particular device at least)?"
] | [
"linux",
"touch",
"hardware",
"rhel6"
] |
[
"How java HashMap does chaining? how to access all collision values?",
"I have read somewhere that HashMap uses chaining to resolve collisions. But if that is the case. how can i access all the elements with same key value.\n\nFor example :\n\nHashMap<Integer, String> hmap = new HashMap<Integer, String>();\nhmap.put(1, \"1st value\");\nhmap.put(1, \"2nd value\");\nhmap.put(1, \"3rd value\");\nhmap.put(1, \"4th value\");\n\n\nNow, if I do hmap.get(1) it returns “4th Value”\n\nif Indeed it does chaining like\n\n\n Key values 1 “4th Value” ---> “3rd Value”--->”2nd Value”---->\n “1st Value”\n\n\nHow can I get the other values?\n\nhmap.get(1) only returns the 1st value.\n\nMy second question is,\n\nif it does linear chaining. How can I remove any one value for a key. suppose I want to remove “4th value” from my hashmap and want to keep all other values for same key, how can i do it?\n\nif I do \n\n\n hmap.remove(1);\n\n\n, it removes the complete chain."
] | [
"java",
"data-structures",
"collections"
] |
[
"Windows CE 4.0 with Windows Server 2012",
"In my company, we have upgraded the Windows Server 2003 to Windows Server 2012 and we have some thin clients with an old version of RDP and they can't connect to the Server 2012 because when I does, I get this message: Because of a security error, the client could not connect to the remote computer. Verify that you are logged on to the network, and then try connecting again.\n\nOur thin clients are: Compaq Evo T30 and a Neoware CA19 and they have Windows CE 4.0 installed by default.\n\nSearching in internet, I've found this tutorial: http://www.hjgode.de/wp/2014/03/12/windows-server-2012-rds-and-windows-mobile-connection-error/ but I can't apply it to our server because we don't want to have less security.\n\nI've searched everything on internet to configure the Windows CE to be able to connect to our server 2012 but I can't find anything helpful :( Seriously, we don't want to apply the steps of the previous tutorial, we prefer buying new Thin Clients instead of doing that, but it will be better if there is a way to be able to connect to the server 2012 without changing anything in the server.\n\nAnyone can help me? Please, it's very important.\n\nThanks in advance! :)"
] | [
"windows",
"windows-ce",
"windows-server-2012",
"rdp"
] |
[
"How to check if a string begins with a particular string>",
"I am trying to check if a string begins with a particular string. But the below code is not working.\n\n// set @test_date = '123456'\n\nif [[ $var == \"set @test_date =*\" ]]; then\n echo \"true\"\nelse\n echo \"false\"\nfi\n\n\nI found the similar question here, but it not working for me\n\nThanks"
] | [
"linux",
"bash",
"shell"
] |
[
"How to disable TFA (Two factor authentication)",
"I enabled TFA in Joomla 3.2 and it worked fine, but my smartphone is unaccessible.\n\nThen I cannot go in backend and I tried to disable the plugin plg_twofactorauth_totp in database but it stay enabled. \n\nDisabling by rename the folder hide Secret Key input, but I wasn't able to login."
] | [
"joomla",
"google-authenticator"
] |
[
"image rollover effect in jquery?",
"here my code-\n\n$('.smenu li').mouseover( function(){\n var src = $(this).find('a').attr('href');\n $('.hbg').css('background-image', 'url(' + src + ')');\n });\n\n\nhtml code-\n\n<div class=\"smenu\">\n <ul>\n <li ><a href=\"images/hosp.jpg\"><img src=\"images/menu_hosp.jpg\" border=\"0\"></a></li>\n <li ><a href=\"images/edu.jpg\"><img src=\"images/menu_edu.jpg\" border=\"0\"></a></li>\n <li ><a href=\"images/enter.jpg\"><img src=\"images/menu_enter.jpg\" border=\"0\"></a></li>\n <li ><a href=\"images/retail.jpg\"><img src=\"images/menu_retail.jpg\" border=\"0\"></a></li> \n </ul>\n </div>\n\n\nthis is workin fine but how can I set some rollover effects during the image change because now its just change the backgroun image with a flash on mouse over, I want some fade-in fade-out or something else..."
] | [
"jquery",
"image",
"onmousemove",
"fadein",
"fadeout"
] |
[
"How to run a python program from different path in linux",
"I am having 2 python installation one for root user and one for normal user.\nI want to run a python program for root user with the python installation for normal user. how can it be done ?\n\npython -c \"import sys; print '\\n'.join(sys.path)\"\n\n/home/ubuntu/anaconda2/lib/python27.zip\n/home/ubuntu/anaconda2/lib/python2.7\n/home/ubuntu/anaconda2/lib/python2.7/plat-linux2\n/home/ubuntu/anaconda2/lib/python2.7/lib-tk\n/home/ubuntu/anaconda2/lib/python2.7/lib-old\n/home/ubuntu/anaconda2/lib/python2.7/lib-dynload\n/home/ubuntu/anaconda2/lib/python2.7/site-packages\n/home/ubuntu/anaconda2/lib/python2.7/site-packages/Sphinx-1.3.5-py2.7.egg\n/home/ubuntu/anaconda2/lib/python2.7/site-packages/cryptography-1.0.2-py2.7-linux-x86_64.egg\n/home/ubuntu/anaconda2/lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg\n\n\nThis is for the root user\n\nsudo python -c \"import sys; print '\\n'.join(sys.path)\"\n\n/usr/lib/python2.7\n/usr/lib/python2.7/plat-x86_64-linux-gnu\n/usr/lib/python2.7/lib-tk\n/usr/lib/python2.7/lib-old\n/usr/lib/python2.7/lib-dynload\n/usr/local/lib/python2.7/dist-packages\n/usr/local/lib/python2.7/dist-packages/rlp-0.4.6-py2.7.egg\n/usr/local/lib/python2.7/dist-packages/devp2p-0.8.0-py2.7.egg\n/usr/local/lib/python2.7/dist-packages/ethereum-1.6.0-py2.7.egg\n/usr/local/lib/python2.7/dist-packages/ethereum_serpent-2.0.2-py2.7-linux-x86_64.egg\n/usr/lib/python2.7/dist-packages\n/usr/lib/python2.7/dist-packages/PILcompat\n/usr/lib/python2.7/dist-packages/gtk-2.0\n/usr/lib/python2.7/dist-packages/ubuntu-sso-client\n\n\nI want to run a python program using the anaconda python installation. but i dont want to change the path as there are other users using root python installation. In summary i want to run this program as root user with anaconda but without changing the default python installation path for root user."
] | [
"python",
"linux"
] |
[
"Python, pygame, collisions and dictionaries",
"I am using the below code to try and code basic collisions using pygame. Almost all of the built in collision method return python dictionaries which are new to me. Using many internet sources I have discovered how to search a dictionary, however the dictionary returned by the method does not appear to follow the same rules and therefore i am unable to search it for which sprites collide. Either a new collision method or a way to search my dictionary would be very much appreciated.\n\nRED=(255,0,0)\nBLACK=(0,0,0)\nWHITE =(255,255,255)\nGREEN = (0,255,0)\nplayer_health = 10\nenemy_health = 10\ncollision_counter = 0\nattack_counter = 0\nattack = False\n\nimport pygame\n\n#Creating screen and sprites\nall_sprites_list = pygame.sprite.Group()\nall_enemies_list = pygame.sprite.Group()\n\npygame.init()\n\nscreen = pygame.display.set_mode((1,1))\n\nclass Sprites(pygame.sprite.Sprite):\n\n def __init__(self,x,y,img):\n super().__init__()\n\n #Colour and position\n #Set the background colour and set the image to be transparent\n self.image = pygame.Surface([x, y])\n self.image.fill(WHITE)\n self.image.set_colorkey(WHITE)\n\n #Or using an image\n self.image = pygame.image.load(img).convert_alpha()\n\n #Fetch a rectangle that is the same size\n self.rect = self.image.get_rect()\n\n self.mask = pygame.mask.from_surface(self.image)\n\n\ndef AI(self,charX):\n\n #If the player is on the left\n if self.rect.x < charX:\n self.rect.x += 1\n\n #On right\n if self.rect.x > charX:\n self.rect.x -= 1\n\ndef update(self,charX):\n self.AI(charX)\n\n\nimg = \"BadCrab.png\"\n#Creating the first AI sprite with width,height,colour and x,y position\nAI1 = Sprites(30,20,img)\nAI1.rect.x = 0\nAI1.rect.y = 150\n#Adding to to the necessary groups\nall_enemies_list.add(AI1)\n\n#Creating the character sprite with width,height,colour and x,y position\nchar = Sprites(30,20,\"Crab.fw.png\")\nchar.rect.x = 150\nchar.rect.y = 150\n#Adding to to the necessary group\nall_sprites_list.add(char)\n\nscreen = pygame.display.set_mode((800,400))\nclock = pygame.time.Clock()\ncounter = 0\n\nwhile True:\n pygame.event.pump()\n screen.fill(BLACK)\n clock.tick(60)\n pygame.event.pump()\n keys = []\n\n #Getting the keys which are pressed down\n for event in pygame.event.get():\n if event.type == pygame.KEYDOWN:\n keys.append(event)\n\n #Converting the array to a string so it can be searched\n keys=str(keys)\n\n #Using the keys numbern value to determine if it has been pressed\n #Left arrow = 276\n if \"276\" in keys:\n char.rect.x -= 40\n\n #Right arrow = 275\n elif \"275\" in keys:\n char.rect.x += 40\n\n counter += 1\n #Space = 32\n if \"32\" in keys:\n counter = 0\n #Removing orignal sprite and then changing it to the attack sprite\n all_sprites_list.remove(char)\n char = Sprites(30,20,\"Crab_attack.fw.png\")\n char.rect.y = 150\n char.rect.x = charX\n all_sprites_list.add(char)\n attack = True\n #Allwoing the attack sprite to be drawn before replaced by original sprite\n if counter == 12:\n all_sprites_list.remove(char)\n char = Sprites(30,20,\"Crab.fw.png\")\n char.rect.y = 150\n char.rect.x = charX\n all_sprites_list.add(char)\n counter = 0\n attack = False\n\n charX = char.rect.x\n all_enemies_list.update(char.rect.x)\n all_enemies_list.draw(screen)\n all_sprites_list.draw(screen)\n pygame.display.flip()\n\n #Checking for collisions\n collisions = pygame.sprite.groupcollide(all_sprites_list, all_enemies_list,False,False)\n print(str(collisions))"
] | [
"python",
"dictionary",
"pygame",
"collision"
] |
[
"Can you link ng-options values together?",
"Forgive the terminology, but can you link ng-options values together?\n\nThis is what I have:\n\n<select class=\"form-control\" id=\"field_cusPro\" \n name=\"cusPro\" ng-model=\"rentalAgreement.customerProfile\" \n ng-options=\"cusPro as cusPro.Name for cusPro in cuspros track by cusPro.id\">\n <option value=\"\"></option>\n</select>\n\n\nIs there away to do ng-options=\"cusPro as cusPro.Name and cusPro.id for cusPro in cuspros track by cusPro.id. \n\nThat way the options would be like this:\n\n Name1 ID1, Name2 ID2 etc...\n\n\nInstead of just\n\n Name1, Name2, etc..."
] | [
"angularjs",
"ng-options"
] |
[
"EC2 Instance error telling me multiple IAM Roles are attached when I try to change it...?",
"This is a strange one... If I click on the instance id, and then navigate to security, it tells me the instance has role X. Then I back out to view all instances, mark the checkbox for the instance in question, go to Actions -> Security -> Modify IAM Role, and it shows me a different role, role Y. I then try to set it to No IAM Role (or any various role), and I get this error:\n"Multiple roles associated to instance\nThe selected instance has more than one IAM role associated. This usually occurs when the instance is in the process of replacing an existing instance profile association. "\nI have no idea what to do because I didn't think an EC2 instance was supposed to be able to have two roles... nothing can assume two roles at once, anyway. So this feels like a bug... can anyone help me solve this?"
] | [
"amazon-web-services",
"amazon-ec2",
"amazon-iam"
] |
[
"QuillJS: Howto add format for stroke color",
"In a quill 1.3.7 editor I'd like to add a button to select the stroke color.\nWhat I tried is this: Copied this https://github.com/quilljs/quill/blob/develop/formats/color.js and replaced most "Color" by "Stroke":\nimport Quill from 'quill';\nconst Parchment = Quill.import('parchment');\nclass StrokeAttributor extends Parchment.Attributor.Style {\n value(domNode) {\n let value = super.value(domNode);\n if (!value.startsWith('rgb(')) return value;\n value = value.replace(/^[^\\d]+/, '').replace(/[^\\d]+$/, '');\n const hex = value.split(',').map(component => `00${parseInt(component, 10).toString(16)}`.slice(-2)).join('');\n return `#${hex}`;\n }\n}\nconst StrokeClass = new Parchment.Attributor.Class('stroke', 'ql-stroke', {\n scope: Parchment.Scope.INLINE,\n});\nconst StrokeStyle = new StrokeAttributor('stroke', '-webkit-text-stroke-color', {\n scope: Parchment.Scope.INLINE,\n});\nQuill.register(StrokeClass, true);\nQuill.register(StrokeStyle, true);\n\nThe toolbar container options are extended this way: this.colors = [{ 'color': [] }, { 'stroke': [] }, { 'background': [] }];\nThe result is a button without options:\n\nAdding color values like this this.colors = [{ 'color': [] }, { 'stroke': ['#888888'] }, { 'background': [] }]; also does not show selectable color options.\nAnother idea to create a Stroke Selector is like this example: https://github.com/quilljs/quill/blob/develop/formats/italic.js:\nimport Quill from 'quill';\nconst Parchment = Quill.import('parchment');\nconst BackgroundClass = Quill.import('attributors/class/background');\n\nclass StrokeClass extends BackgroundClass {};\nStrokeClass.attrName = 'stroke';\nStrokeClass.keyName = 'ql-stroke';\n\nclass StrokeStyle extends BackgroundStyle {};\nStrokeStyle.attrName = 'stroke';\nStrokeStyle.keyName = '-webkit-text-stroke-color';\n\nQuill.register(StrokeClass, true);\nQuill.register(StrokeStyle, true);\n\nBut this shows an error: Uncaught TypeError: Class extends value #<ClassAttributor> is not a constructor or null\nWhat works is this (unfortunately not thoroughly as it should): when setting attribute values directly at BackgroundClass then the formatting works (as long as there is the -webkit-text-stroke-width set in the overall CSS):\nimport Quill from 'quill';\nconst BackgroundClass = Quill.import('attributors/class/background');\nconst BackgroundStyle = Quill.import('attributors/style/background');\nBackgroundClass.keyName = 'ql-stroke';\nBackgroundStyle.keyName = '-webkit-text-stroke-color';\n\nAs not every browser supports -webkit-text-stroke-width (https://developer.mozilla.org/de/docs/Web/CSS/-webkit-text-stroke-width) the Quill extension ideally sets the style property -webkit-text-stroke and assembles the value with e.g. 1px [selected colorname] or 0px if there is no color selected. Is there any code I can copy from?"
] | [
"quill"
] |
[
"Memory Error at Python while converting to array",
"My code is shown below:\n\nfrom sklearn.datasets import load_svmlight_files\nimport numpy as np\n\nperm1 =np.random.permutation(25000)\nperm2 = np.random.permutation(25000)\n\nX_tr, y_tr, X_te, y_te = load_svmlight_files((\"dir/file.feat\", \"dir/file.feat\"))\n\n#randomly shuffle data\nX_train = X_tr[perm1,:].toarray()[:,0:2000]\ny_train = y_tr[perm1]>5 #turn into binary problem\n\n\nThe code works fine until here, but when I try to convert one more object to an array, my program returns a memory error.\n\nCode:\n\nX_test = X_te[perm2,:].toarray()[:,0:2000]\n\n\nError:\n\n---------------------------------------------------------------------------\nMemoryError Traceback (most recent call last)\n<ipython-input-7-31f5e4f6b00c> in <module>()\n----> 1 X_test = X_test.toarray()\n\nC:\\Users\\Asq\\AppData\\Local\\Enthought\\Canopy\\User\\lib\\site-packages\\scipy\\sparse\\compressed.pyc in toarray(self, order, out)\n 788 def toarray(self, order=None, out=None):\n 789 \"\"\"See the docstring for `spmatrix.toarray`.\"\"\"\n--> 790 return self.tocoo(copy=False).toarray(order=order, out=out)\n 791 \n 792 ##############################################################\n\nC:\\Users\\Asq\\AppData\\Local\\Enthought\\Canopy\\User\\lib\\site-packages\\scipy\\sparse\\coo.pyc in toarray(self, order, out)\n 237 def toarray(self, order=None, out=None):\n 238 \"\"\"See the docstring for `spmatrix.toarray`.\"\"\"\n--> 239 B = self._process_toarray_args(order, out)\n 240 fortran = int(B.flags.f_contiguous)\n 241 if not fortran and not B.flags.c_contiguous:\n\nC:\\Users\\Asq\\AppData\\Local\\Enthought\\Canopy\\User\\lib\\site-packages\\scipy\\sparse\\base.pyc in _process_toarray_args(self, order, out)\n 697 return out\n 698 else:\n--> 699 return np.zeros(self.shape, dtype=self.dtype, order=order)\n 700 \n 701 \n\nMemoryError: \n\n\nI'm new in python, and I dont know whether one needs to manually fix the memory error.\n\nOther parts of my code return the same errors (like training with knn or ann).\n\nHow can I fix this?"
] | [
"python",
"python-2.7",
"numpy",
"scikit-learn",
"canopy"
] |
[
"Flutter: compare current date with date received from api",
"I have an app that receives some data from a api and i want to compare them, but dont know how to do it.\nThe date that comes from the api is in a different template, plus its a string, so i cant compare.\nI want to show a error message if the received date is older than current date.\nHere's how the api date comes (i have printed on console):\nI/flutter ( 5190): 2004-08-26T01:00:00.000Z\n\nAnd here is the DateTime.now on flutter:\nI/flutter ( 5190): 2021-02-19 12:25:16.638505\n\nIs there a way to compare them?"
] | [
"android",
"flutter",
"dart"
] |
[
"How To Manage Meteor App Running On AWS AMAZON EC2",
"I've deployed my Meteor App to AWS AMAZON EC2 in order to test my app in that environment including the newly configured domain name redirection etc...\n\nThings did not work out perfectly when I tried to register a new user and when I tried to verify the email of the new user.\n\nGiven this scenario, I would like to reset the project or reset the users Collections in the mongodb of that Meteor App. Since I would like to be abel to reuse that email I use for testing.....\n\nIn my computer, when I encounter this problem I conveniently enter this command in my project's folder and I get the mongoldb reset:\n\nmeteor reset\n\n\nHow do I find where the app is in the EC2 instance the Meteor app is contained in???\n\nAfter I ssh to the IP address with the paired key, I am allowed access to the instance, but when I do a ls I get nothing and don't know where to start....I was hoping I could just do a meteor reset or find where the mongodb is within that instance and delete the fields or collections I would like to delete.....\n\nHow do I achieve this?\nHow does one manage a Meteor app within this kind of environment such as AWS AMAZON EC2??\n\nThank you..."
] | [
"mongodb",
"meteor",
"amazon-ec2"
] |
[
"Fullcalendar recurring events with special days",
"I am using the Fullcalendar and recurring the events for a client. Everything works fine. But i am wondering how i can set special days for it? Like if there is no event at "25.05.2021", events shouldn't be appeared on this date.\nHere is my JSON file:\n[{"daysOfWeek":[1],"title":"Termin frei","startTime":"10:00","color":false},\n{"daysOfWeek":[1],"title":"Termin frei","startTime":"11:00","color":false},\n{"daysOfWeek":[1],"title":"Termin frei","startTime":"12:00","color":false},\n{"daysOfWeek":[1],"title":"Termin frei","startTime":"13:00","color":false},\n{"daysOfWeek":[1],"title":"Termin frei","startTime":"14:00","color":false},\n{"daysOfWeek":[2],"title":"Termin frei","startTime":"11:00","color":false},\n{"daysOfWeek":[2],"title":"Termin frei","startTime":"12:00","color":false},\n{"daysOfWeek":[2],"title":"Termin frei","startTime":"13:00","color":false},\n{"daysOfWeek":[3],"title":"Termin frei","startTime":"11:00","color":false},\n{"daysOfWeek":[3],"title":"Termin frei","startTime":"12:00","color":false},\n{"daysOfWeek":[3],"title":"Termin frei","startTime":"13:00","color":false},\n{"daysOfWeek":[4],"title":"Termin frei","startTime":"13:00","color":false},\n{"daysOfWeek":[4],"title":"Termin frei","startTime":"14:00","color":false},\n{"daysOfWeek":[5],"title":"Termin frei","startTime":"14:00","color":false}]\n\nand here is the code for my fullcalendar:\ndocument.addEventListener('DOMContentLoaded', function () {\n var calendarEl = document.getElementById('calendar');\n var calendar = new FullCalendar.Calendar(calendarEl, {\n initialView: 'dayGridWeek',\n locale: 'de',\n timeZone: 'Europe/Berlin',\n hiddenDays: [0, 6],\n validRange: {\n start: tomorrow()\n },\n events: '<?php echo getApiUrl(); ?>/available-times/<?php echo $departmentID; ?>',\n headerToolbar: {\n start: 'title', // will normally be on the left. if RTL, will be on the right\n center: '',\n end: 'prev,next' // will normally be on the right. if RTL, will be on the left\n },\n displayEventEnd: true,\n eventTimeFormat: {\n hour: '2-digit',\n minute: '2-digit',\n hour12: false\n },\n eventClick: function (info) {\n window.location.href = "<?php echo WP_HOME . '/terminvereinbaren-details?'; ?>department_id=<?php echo $departmentID\n . '&event_start=';?>" + info.event.start.toISOString()\n },\n });\n calendar.render();\n });"
] | [
"jquery",
"fullcalendar",
"recurring"
] |
[
"eclipse: can't change C/C++ build settings (for adding gprof)",
"I want to analyze a C++ code in eclipse with GPROF.\nI added the code that I want to analyze with \"new -> Makefile Project with Existing Code\" because I got it as open source from the Internet and now I want to profile it. I'm working with gprof and with eclipse for the first time.\n\nMy problem is, that when I go to \"project -> properties -> C/C++ build -> settings\" I don't see anything more than \"Binary Parsers\" and \"Error Parsers\". I can't add flags (e.g. -pg) for the Compiler and Linker. It might have something to do with the Makefile Project?!\n(Unfortunately I can't add my screenshot because of to less reputation).\n\nHow can I use gprof now? Can I add flags to Compiler and Linker somewhere else?\n\nThank you!\naciams\n\nEDIT:\n\nThe Makefile has been created with cmake. So I added -pg to every file that does not begin with \"# CMAKE generated file: DO NOT EDIT!\".\nWhen I build the project again I find -pg in\n\n# compile CXX with /usr/bin/c++\nCXX_FLAGS = -O3 -DNDEBUG -Wall -g -pg\n\n\nbut when I run the program and search for a file named \"gmon.out\" nothing can be found. Do I have to set -pg to the Linker explicitly?\n\nThis is the important part of CMakeLists.txt:\n\nproject()\n#set ( CMAKE_BUILD_TYPE Debug )\nset ( CMAKE_BUILD_TYPE Release )\n#set ( CMAKE_CXX_COMPILER \"icpc\" )\n#set ( CMAKE_CXX_COMPILER \"g++-4.2\" )\nadd_definitions ( -Wall -g -pg)\nif (${CMAKE_SYSTEM_NAME} MATCHES \"Linux\")\n if(${CMAKE_CXX_COMPILER} MATCHES \"icpc\")\n set ( OPENMP_FLAG \"-openmp\" )\n set ( OPENMP_LINK \"-openmp\" )\n else()\n set ( OPENMP_FLAG \"-fopenmp\" )\n set ( OPENMP_LINK \"-lgomp\" )\n endif(${CMAKE_CXX_COMPILER} MATCHES \"icpc\")\nelseif (${CMAKE_SYSTEM_NAME} MATCHES \"Darwin\")\n if(${CMAKE_GENERATOR} MATCHES \"Makefile\")\n find_package ( OpenMP REQUIRED )\n set ( OPENMP_FLAG \"-fopenmp\" )\n set ( OPENMP_LINK \"-lgomp\" )\n #set ( APP_TYPE MACOSX_BUNDLE )\n else()\n set ( OPENMP_FLAG \"-fopenmp\" )\n set ( OPENMP_LINK \"\" )\n endif(${CMAKE_GENERATOR} MATCHES \"Makefile\")\nelse()\n set ( OPENMP_FLAG \"\" )\n set ( OPENMP_LINK \"\" )\nendif()\nset ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} \"${CMAKE_SOURCE_DIR}/cmake/Modules/\")\nset ( CMAKE_PREFIX_PATH \n ${CMAKE_PREFIX_PATH}\n /sw\n /opt\n /opt/local\n /Users/$ENV{USER}/Development\n ./include\n ./lib\n )\ninclude ( ${QT_USE_FILE} )\ninclude_directories (\n ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )\nset ( EXECUTABLE_OUTPUT_PATH build/release )\n\nset_source_files_properties ( test.cpp test2.cpp\n PROPERTIES COMPILE_FLAGS ${OPENMP_FLAG}\n )\nadd_executable ( )\ntarget_link_libraries ()\ninstall ( )\n\n\nThanks!"
] | [
"c++",
"eclipse",
"makefile",
"flags",
"gprof"
] |
[
"Multiple Controllers from a single view",
"I recently started with CakePHP and so far I'm loving it, specially the scafolding and bake.\n\nI'm building a webapp that will manage applications to companies. (i.e., where have I applied to, with whom have I spoke, the status of the application(s), how long ago has it been since I did sent/recieved a communication regarding this application.)\n\nI have a model Application and an Action model. An application has multiple Actions. \n\nWhen you add a new Application, it does not make sense to add \"just\" the application but to add one action. Is there anyway to have my applications add view to connect with two controllers and add the action and application simultaneously?\n\nPlease do let me know if my problem is understandable or if you need further clarification. \n\nThanks."
] | [
"php",
"cakephp",
"cakephp-1.3"
] |
[
"How to internally back-reference 2 variables to php path using htaccess?",
"I have the URL:\n\n\n www.website.com/planets.php?ppp1=mars&ppp2=venus\n\n\nSearching through stackoverflow, I modified one of the existing solutions to externally redirect it like this:\n\nRewriteCond %{THE_REQUEST} ^GET\\s([^.]+)\\.php\\?ppp1=([^&\\s]+)\\&ppp2=([^&\\s]+) [NC]\nRewriteRule ^ %1/%2/%3? [R,L]\n\n\nThis will turn the URL to this:\n\n\n www.website.com/planets/mars/venus\n\n\nNow, everything is working great so far, but I don't know how to setup the back-reference RewriteRule so that when typing \"www.website.com/planets/mars/venus\", that it forwards back to the original URL. In essence, how to back-reference 2 Get variables?"
] | [
"php",
".htaccess"
] |
[
"How can I get index path of cell on switch change event in section based table view",
"I have custom cell having switch in few cells at right side. what I want is to store value of specific cell on switch change event. Table view has number sections so I can't set tag for switch because I need section as well as row to obtain index path.\n\nAny suggestion any alternative but I have to use UISwitch in section based table view.\n\nThanks"
] | [
"ios",
"objective-c",
"uitableview",
"ios7",
"xcode6"
] |
[
"Fatal error: Exception thrown without a stack frame in Unknown on line 0",
"Hello I have a voting system, with many steps using sessions.\n\nwhen we hit session ID '2', I do the following action:\n\n if ($_SESSION['vote_id'] == 1)\n {\n $_SESSION['vote_id'] = 2;\n $vote->generate_Auth($_SERVER['REMOTE_ADDR']);\n\n try\n {\n $_SESSION['auth'] = $vote->getAuth($_SERVER['REMOTE_ADDR']);\n }\n catch (exception $e)\n {\n echo $e->getMessage();\n }\n }\n\n\nAnd these are the functions I am using with this action:\n\nGenerate_auth:\n\n public function generate_Auth($ip)\n {\n $this->gen_auth = self::pre_auth(substr(hash('SHA512', $ip), 0, 6));\n $this->auth = substr(hash('SHA512', $this->gen_auth), 0, 6);\n $this->quickfind = substr(str_shuffle(self::generate_quick_find_code()), 0, 21);\n\n $this->generated_auth = $this->auth;\n $this->generated_quickfind = $this->quickfind;\n\n $this->insert = $this->pdo->prepare\n (\"\n INSERT INTO auths\n (auth_code, sites_voted, voter_ip, date, time, quickfind_code)\n VALUES\n (:code, :sites, :ip, CURDATE(), CURTIME(), :find)\n \");\n\n $this->insert->execute(array\n (\n \":code\" => $this->generated_auth,\n \":sites\" => '1',\n \"ip\" => $ip,\n \"find\" => $this->generated_quickfind\n ));\n }\n\n\nGet auth:\n\n public function getAuth($ip)\n {\n $this->get = $this->pdo->prepare(\"SELECT * FROM auths WHERE voter_ip = :ip LIMIT 1\");\n $this->get->execute(array( \":ip\" => $ip));\n\n if ($this->get->rowCount())\n {\n return $this->get;\n }\n else\n {\n throw new exception (\"An error has occurred!\");\n }\n }\n\n\npre_auth static:\n\n public static function pre_auth($salt)\n {\n $auth = substr(hash('SHA512', $salt), 0, 6);\n return $auth;\n }\n\n\nWhen acting, it gives me this error:\n\nFatal error: Exception thrown without a stack frame in Unknown on line 0\n\nI've never experienced this error before in my life, I 've read about this but didn't get it much.\n\nCan anyone explain? And what is wrong?"
] | [
"php"
] |
[
"Cursor error with postgresql, pgpool and php",
"Hey, I am struggling a bit to determine the exact cause of an error that has been popping up in our release environment. There does not seem to be much dealing with this particular error on Google.\n\nThis is the error message we are getting:\n\n\n SQLSTATE[34000]: Invalid cursor name:\n 7 ERROR: portal \"\" does not exist\n\n\nThe error only pops up when we are using PDO prepared statements. \n\nThis is the setup for our release environment:\n\n\npgpool 3.0.1 (The postgresql backend is in Streaming Replication mode!)\nPHP 5.3.5\nPostgreSQL 9.0 \n\n\nEdit: Architecture is 64bit.\n\nThe same error does not manifest in our test environment (Edit: forgot to mention, the standard test environment uses Postgresql 9.0 without pgpool). Thus, I am led to suspect that pgpool is at least partly suspect. \n\nDoes anyone know what the probable causes for this error are? \n\nEdit: ok, here is an example of the kind of code that causes the error. \n\n$sql = 'SELECT * ';\n$sql .= 'FROM \"myTable\" as \"myStuff\" ';\n$sql .= 'WHERE \"myTable\".\"status\" = 1 ';\n$sql .= 'AND \"myTable\".\"myTableId\" = :tableId ';\n$sth = $this->_db->prepare($sql);\n$sth->bindParam(':tableId', $tableId, PDO::PARAM_INT);\n$sth->execute();\n\n\nEdit: Some log file output;\n\nPostgresql:\n\npostgresql-Sun.log-129- ORDER BY \"id\" \npostgresql-Sun.log:130:ERROR: portal \"\" does not exist\npostgresql-Sun.log-131-ERROR: prepared statement \"pdo_stmt_00000011\" does not exist\npostgresql-Sun.log-132-STATEMENT: DEALLOCATE pdo_stmt_00000011\n\n\npostgresql-Mon.log-82- where \"id\" = 32024\npostgresql-Mon.log:83:ERROR: portal \"\" does not exist\npostgresql-Mon.log-84-ERROR: prepared statement \"pdo_stmt_00000002\" does not exist\npostgresql-Mon.log-85-STATEMENT: DEALLOCATE pdo_stmt_00000002\n\n\npgpool:\n\nLOG: pid 22071: Replication of node:1 is behind 2080 bytes from the primary server (node:0)\nLOG: pid 22071: Replication of node:2 is behind 2080 bytes from the primary server (node:0)\nLOG: pid 13499: pool_send_and_wait: Error or notice message from backend: : DB node id: 0 backend pid: 8470 statement: message: portal \"\" does not exist\nLOG: pid 13499: pool_send_and_wait: Error or notice message from backend: : DB node id: 0 backend pid: 8470 statement: DEALLOCATE pdo_stmt_00000003 message: prepared statement \"pdo_stmt_00000003\" does not exist"
] | [
"php",
"postgresql",
"pdo",
"pgpool"
] |
[
"using XmlHttpRequest,responseText in order to get node js response not working",
"I am trying to build a client & server using node js & ajax... I am trying to get info from my node js server but I don't get it... The xmlhttp.responseText returns nothing.\n\nsite(client side):\n\n<head>\n <title>Testing...</title>\n <script>\n function loadXMLDoc()\n {\n if (window.XMLHttpRequest)\n {// code for IE7+, Firefox, Chrome, Opera, Safari\n xmlhttp=new XMLHttpRequest();\n }\n else\n {// code for IE6, IE5\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n\n //xmlhttp.addEventListener(\"load\", server_test); <-- not working as well...\n xmlhttp.onreadystatechange = server_test;\n xmlhttp.open(\"GET\",\"http://localhost:8001/?web=www.google.com\", true);\n xmlhttp.send();\n }\n\n\n function server_test()\n {\n document.getElementById(\"myDiv\").innerHTML=xmlhttp.responseText;\n }\n </script>\n</head>\n<body>\n <div id=\"myDiv\"><h2>Waiting for response...</h2></div>\n <button type=\"button\" onclick=\"loadXMLDoc()\">Change Content</button>\n</body>\n\n\nserver side:\n\nvar http = require('http'),\nurl = require('url');\n\nhttp.createServer(function(request, response){\n\nconsole.log(\"request recieved\");\nvar web = url.parse(request.url, true).query.web;\nconsole.log(\"Sending info about \" + web);\n\nresponse.writeHead(200, {\"Content-Type\": \"text/plain\"});\nresponse.write(web)\nresponse.end(web);\n\nconsole.log(\"Info sent...\");\n\n\n}).listen(8001);\nconsole.log(\"server initialized\");\n\n\nI searched for hours and I still couldn't find an answer hope I will be able to find it here. Thank you for your help."
] | [
"javascript",
"html",
"node.js",
"ajax"
] |
[
"How to update wp bloginfo('admin_email') via php?",
"Hi I am using manageWP and the admin email address for all sites has changed. I know how to view the admin email address, however I can't seem to find anywhere how to update it.\n\nI did find this, however the pages says that it is not intended to be run directly.\n\nhttps://codex.wordpress.org/Function_Reference/update_option_new_admin_email\n\nAny insight?"
] | [
"php",
"wordpress"
] |
[
"How do I use Greasemonkey to hide an XPath element?",
"I have an XPath /html/body/div[1]/div/div/center[1]/table and I would like to make it so it is no longer visible.\n\nI saw I could use document.evaluate() but I am not sure how to hide it."
] | [
"javascript",
"xpath",
"greasemonkey",
"tampermonkey"
] |
[
"Parsing chat messages as config",
"I'm trying write a function that would be able to parse out a file with defined messages for a set of replies but am at loss on how to do so.\n\nFor example the config file would look:\n\n[Message 1]\n1: Hey\n How are you?\n2: Good, today is a good day.\n3: What do you have planned?\n Anything special?\n4: I am busy working, so nothing in particular.\n My calendar is full.\n\n\nEach new line without a number preceding it is considered part of the reply, just another message in the conversation without waiting for a response.\n\nThanks\n\nEdit: The config file will contain multiple messages and I would like to have the ability to randomly select from them all. Maybe store each reply from a conversation as a list, then the replies with extra messages can carry the newline then just split them by the newline. I'm not really sure what would be the best operation.\n\nUpdate:\n\nI've got for the most part this coded up so far:\n\ndef parseMessages(filename):\n messages = {}\n begin_message = lambda x: re.match(r'^(\\d)\\: (.+)', x)\n with open(filename) as f:\n for line in f:\n m = re.match(r'^\\[(.+)\\]$', line)\n if m:\n index = m.group(1)\n elif begin_message(line):\n begin = begin_message(line).group(2)\n else:\n cont = line.strip()\n else:\n # ??\n return messages\n\n\nBut now I am stuck on being able to store them into the dict the way I'd like..\n\nHow would I get this to store a dict like:\n\n{'Message 1': \n {'1': 'How are you?\\nHow are you?', \n '2': 'Good, today is a good day.', \n '3': 'What do you have planned?\\nAnything special?', \n '4': 'I am busy working, so nothing in particular.\\nMy calendar is full'\n } \n}\n\n\nOr if anyone has a better idea, I'm open for suggestions.\n\nOnce again, thanks.\n\nUpdate Two\n\nHere is my final code:\n\nimport re\ndef parseMessages(filename):\n all_messages = {}\n num = None\n begin_message = lambda x: re.match(r'^(\\d)\\: (.+)', x)\n with open(filename) as f:\n messages = {}\n message = []\n for line in f:\n m = re.match(r'^\\[(.+)\\]$', line)\n if m:\n index = m.group(1)\n elif begin_message(line):\n if num:\n messages.update({num: '\\n'.join(message)})\n all_messages.update({index: messages})\n del message[:]\n num = int(begin_message(line).group(1))\n begin = begin_message(line).group(2)\n message.append(begin)\n else:\n cont = line.strip()\n if cont:\n message.append(cont)\n return all_messages"
] | [
"python"
] |
[
"How to make zero a part of an int array in C?",
"This function works well aside from not accepting 0 because it considers it NULL\n\nvoid addtolist(int list[], int item){\n for(int a=0;a<5;a++){\n if(list[a]==NULL){\n list[a]=item; \n break; \n }\n }\n }\n\n\nIs there any way I can make the array accept zeroes? \nAdditional info: -List- is a simple int array, accepting -item- inputs with scanf"
] | [
"c"
] |
[
"how to generate glut .so file in Linux",
"I would like to generate glut .so file in Ubuntu. I've downloaded the files, extracted them and opened the readme. This is the instructions for Linux\n\nMAKEFILE GENERATION TO BUILD GLUT: <-- IMPORTANT!\n\nUse \"mkmkfiles.sgi\" to put Makefiles using the SGI Makefile conventions\nin place. Use \"mkmkfiles.imake\" to put Makefiles generated from\nImakefiles in place. Run one of these two commands in this directory,\nthen do a \"make\".\n\n\nI don't really understand SGI Makefile. I know Makefile though. Could you please guide me for generating the dll. In the folder, these are the files \n\nadainclude Imakefile mkmkfiles.imake README.fortran README.man\nCHANGES include mkmkfiles.sgi README.glut2 README.mesa\nFAQ.glut lib mkmkfiles.win README.glut3 README.mui\nGlut.cf linux NOTICE README.ibm-shlib README.win\nglutdefs Makefile Portability.txt README.inventor README.xinput\nglutmake.bat Makefile.sgi progs README.irix6 test\nglutwin32.mak Makefile.win README README.irix64bit\nIAFA-PACKAGE man README.ada README.linux\n\n\nI've tried running make but getting errors and there is no CMakeLists. Thank you.\n\nWhen I run ./mkmkfiles.sgi or mkmkfiles.imake, I get this error \n\nbash: ./mkmkfiles.sgi: /bin/csh: bad interpreter: No such file or directory"
] | [
"c++",
"c",
"linux",
"dll",
"makefile"
] |
[
"How to pass both true/false and model in Request.CreateResponse in web Api without altering model",
"public HttpResponseMessage Login(string email, string password)\n {\n bool Isremember = false;\n LogedinUser user = UserHelper.Login(email, password, Isremember);\n if (user.Email == string.Empty)\n {\n return Request.CreateResponse(HttpStatusCode.NotFound, user);\n }\n else\n return Request.CreateResponse(HttpStatusCode.OK, user);\n }\n\n\nNow response am getting,\n\nif user not exists it is like\n\n{\"Id\":0,\"Email\":\"\",\"Password\":\"\",\"UserType\":0,\"OrganizationNumber\":\"\",\"CompanyName\":\"\",\"Name\":\"\",\"Status\":0}\n\n\nan if exist\n\n{\"Id\":0,\"Email\":\"[email protected]\",\"Password\":\"123456\",\"UserType\":2,\"OrganizationNumber\":\"133\",\"CompanyName\":\"testcomp\",\"Name\":\"\",\"Status\":1}\n\n\nhow to append one more parameter to response ie, result:false/true"
] | [
"c#",
"asp.net-web-api"
] |
[
"How to add alias statement",
"How to add alias statement? \nHere is the original code :\n\nDB::table(DB::raw('manager as a'))\n ->leftJoin('parameter as p',function($join){\n $join->on('a.vipStatus','=','p.code') \n })\n ->where('a.active','=','1');\n\n\nand I transfer sql like this\n\n$this->manager\n ->leftJoin('parameter as p',function($join){\n $join->on('manager.vipStatus','=','p.code') \n })\n ->where('manager.active','=','1');\n\n\n$this->manager use __construct() inject a manager table ,\nHow to change manager.vipStatus to a.vipStatus?"
] | [
"mysql",
"laravel",
"alias"
] |
[
"Reading JSON objects in Powershell",
"I need to integrate a JSON file which contains paths of the different objects in a PS script that generates and compares the hash files of source and destination. The paths in the JSON file are written in the format that I have stated below. I want to use the paths in that manner and pipe them into Get-FileHash in PowerShell. I can't figure out how to integrate my current PowerShell script with the JSON file that contains the information (File Name, full path) etc.\nI have two scripts that I have tested and they work fine. One generates the MD5 hashes of two directories (source and destination) and stores them in a csv file. The other compares the MD5 hashes from the two CSV files and generates a new one, showing the result(whether a file is absent from source or destination).\nNow, I need to integrate these scripts in another one, which is basically a Powershell Installer. The installer saves the configurations (path, ports, new files to be made etc etc) in a JSON format. In my original scripts, the user would type the path of the source and destination which needed to be compared. However, I now need to take the path from the JSON configuration files. For example, the JSON file below is of the similar nature as the one I have.\n{\n"destinatiopath": "C:\\\\Destination\\\\Mobile Phones\\\\"\n"sourcepath": "C:\\\\Source\\\\Mobile Phones\\\\"\n"OnePlus" : {\n"files": [\n{\n"source": "6T",\n"destination: "Model\\\\6T",\n]\n}\n"Samsung" : {\n"files": [\n{\n"source": "S20",\n"destination": "Galaxy\\\\S20",\n}\n]\n\nThis is just a snippet of the JSON code. It's supposed to have the destination and source files. So for instance if the destination path is: C:\\\\Destination\\\\Mobile Phones\\\\ and the source path is C:\\\\Source\\\\Mobile Phones\\\\ and OnePlus has 6T as source and Model\\\\6T as destination, that means that the Powershell Installer will have the full path C:\\\\Destination\\\\Mobile Phones\\\\Model\\\\6T as the destination, and C:\\\\Source\\\\Mobile Phones\\\\6T as the source. The same will happen for Samsung and others.\nFor now, the MD5 hash comparison PS script just generates the CSV files in the two desired directories and compares them. However, I need to check the source and destination of each object in this case. I can't figure out how I can integrate it here. I'm pasting my MD5 hash generation code below.\nGenerating hash\n#$p is the path. In this case, I'm running the script twice in order to get the hashes of both source and destination. \n#$csv is the path where the csv will be exported. \nGet-ChildItem $p -Recurse | ForEach-Object{ Get-FileHash $_.FullName -Algorithm MD5 -ErrorAction SilentlyContinue} | Select-Object Hash,\n @{\n Name = "FileName";\n Expression = { [string]::Join("\\", ($_.Path -split "\\\\" | Select-Object -Skip ($number))) }\n } | Export-Csv -Path $csv"
] | [
"json",
"powershell"
] |
[
"Parsing dates with multiple formats",
"The dates returned by imaplib are in the following format:\n\n dates = [\n 'Mon, 27 May 2019 13:13:02 -0300 (ART)',\n 'Tue, 28 May 2019 00:28:31 +0800 (CST)',\n 'Mon, 27 May 2019 18:32:13 +0200',\n 'Mon, 27 May 2019 18:43:13 +0200',\n 'Mon, 27 May 2019 19:00:11 +0200',\n '27 May 2019 18:54:58 +0100',\n '27 May 2019 18:56:02 +0100',\n 'Mon, 03 Jun 2019 10:19:56 GMT',\n '4 Jun 2019 07:46:30 +0100',\n 'Mon, 03 Jun 2019 18:48:01 +0200',\n '5 Jun 2019 10:39:19 +0100'\n]\n\n\nHow can I convert these into say, BST datetimes?\n\nHere's what I've tried so far:\n\ndef date_parse(date):\n try:\n return datetime.strptime(date, '%a, %d %b %Y %H:%M:%S %z')\n except ValueError:\n try:\n return datetime.strptime(date[:-6], '%a, %d %b %Y %H:%M:%S %z')\n except ValueError:\n try:\n return datetime.strptime(date[:-6], '%d %b %Y %H:%M:%S')\n except ValueError:\n return datetime.strptime(date[:-4], '%a, %d %b %Y %H:%M:%S')\n\nfor date in dates:\n print(date)\n parsed_date = date_parse(date)\n print(parsed_date, type(parsed_date))\n print('')\n\n\nHowever I get dates repeated followed by an Traceback (most recent call last): error.\n\nWhat is the best way to clean these dates?\nIs there a imaplib/email function that allows us to return clean dates automatically?"
] | [
"python",
"python-3.x",
"imaplib"
] |
[
"How do I need to modify my WinForms app to also run in the console?",
"I have a .NET WinForms app written in C#. In order to support batch operations, I'd now like to make the app able to run in the console.\n\nIs it possible to have an app that detects on startup whether it is running in the console or not?\n\nWhat modifications do I need to make in order to achieve this behaviour?"
] | [
"c#",
".net",
"winforms",
"console"
] |
[
"py2exe and the file system",
"I have a Python app. It loads config files (and various other files) by\ndoing stuff such as:\n\n_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nCONFIG_DIR = os.path.join(_path, 'conf')\n\n\nThis works fine. However, when I package the app with py2exe, bad things happen:\n\n File \"proj\\config.pyc\", line 8, in <module>\nWindowsError: [Error 3] The system cannot find the path specified: 'C:\\\\proj\\\n\\dist\\\\library.zip\\\\conf'\n\n\nObviously that's an invalid path... What's a more robust way of doing this? I don't\nwant to specify absolute paths in the program because it could be placed in different\nfolders. Should I just say \"if it says the folder name is 'library.zip', then go\none more level down to the 'dist' folder\"?\n\nNote that I have pretty nested directory hierarchies... for example, I have\na module gui.utils.images, stored in \"gui/utils/images.py\", and it uses its path\nto access \"gui/images/ok.png\", for example. Right now the py2exe version\nwould try to access \"proj/dist/library.zip/gui/images/ok.png\", or something,\nwhich just won't work."
] | [
"python",
"configuration",
"file",
"py2exe"
] |
[
"How do I start a branch with the data from a repository that isn't the one I'm using?",
"Say I'm working in one locally but I want one off of github. I added that repo as a remote, but how do I now grab a branch from it, and make a branch out of it to switch to and work on?"
] | [
"git"
] |
[
"GridView paging always shows first page",
"I´m having a weird experience with paging on a GridView.\nI´m trying to lazy load data into my griview by using an updatepanel with a timer and updateprogress attached to it.\nSo basicly what I´m trying to do is when the page with the grid loads I start the timer by enabling it. In the timer_tick event I´m fetching the data and load that into a variable. Then calling databind on the gridview forcing it to bind the data. Here I´m using a LinqDataSource to do that. Lastly I´m updating the UI via the Update method on the updatepanel. \n\nThis all works fine with sorting and filtering on the gridview but when I´m paging it the grid pages like it should but the paging template always stays on the first page (show 1 as active). Any ideas people? Here is some of my code:\n\n <asp:LinqDataSource runat=\"server\" ID=\"OrdersDataSource\" \n OnSelecting=\"OrdersDataSource_Selecting\" AutoPage=\"false\" />\n\n <asp:GridView runat=\"server\" ID=\"OrdersGridView\" AutoGenerateColumns=\"false\" \n DataSourceID=\"OrdersDataSource\"\n AllowPaging=\"true\" AllowSorting=\"true\" PageSize=\"3\">\n\n <Columns>\n\n\n...\n\n<asp:Timer runat=\"server\" ID=\"LazyLoadUpdatePanel\" \n Enabled=\"false\"\n Interval=\"1\" OnTick=\"LazyLoadUpdatePanel_Tick\" />\n\n\n...\n\nprotected void LazyLoadUpdatePanel_Tick(object sender, EventArgs e)\n{\n if (datasource == null)\n {\n System.Threading.Thread.Sleep(2000);\n datasource = customer.Orders;\n OrdersGridView.DataBind();\n OrdersUpdatePanel.Update();\n\n }\n LazyLoadUpdatePanel.Enabled = false;\n}\n\n\nBTW I have tried with autopaging on the datasource and without it. That didn´t do the trick. As I said the paging seems to work, the UI just isn´t showing what it i supposed to."
] | [
"asp.net",
"ajax",
"gridview"
] |
[
"CSS grid scroll snapping every 100vw",
"I'm trying to do scroll snapping on a CSS grid but I'm having no luck. What I want to do is scroll snap every 100vw and repeat and I've tried to add scroll-snap-align: start; to the 20nth item but the scroll snap isn't working at all how do I get scroll snapping to work on a css grid.\n\ncodepen\n\n .grid {\n padding: var(--gutter);\n display: inline-grid;\n grid-gap: calc(var(--gutter) * 1.45);\n grid-auto-flow: column;\n\n grid-template-columns: repeat(auto-fill, 1fr);\n grid-template-rows: repeat(auto-fill, minmax(70px, 1fr));\n height: calc(100vh - 110px);\n z-index: 2;\n position: relative;\n\n scroll-snap-type: x mandatory;\n\n scroll-snap-points-x: repeat(100vw);\n}\n\n.grid__item {\n background: mix(white, black, 95%);\n border-radius: var(--radius);\n transition: scale .5s ease;\n background-position: center center;\n background-size: cover;\n background-repeat: no-repeat;\n position: relative;\n scroll-snap-align: start;\n}"
] | [
"javascript",
"html",
"css"
] |
[
"How to use NLog to write multiple \"data\" files",
"I would like my application to repeatedly write a large amount of data to separate \"log\" files during the application lifetime. (Call each instance of such a file a \"data file\".) The data is written to this file in a single write operation (as it's a string). In the main application log file, the application would write the path name of the data file that it creates, so that I can identify that data file that was created at that point in its execution.\n\nI could create the data file using the .NET file API, but I thought it would be useful to use NLog, as I could enable the writing of the file via configuration. However, I cannot see how to define a Target whose name is unique for each write operation. As an alternative, I could programmatically create a Target and add it to the LogManager's Configuration object each time I write a data file, and then delete the Target afterwards.\n\nThis seems plausible, but before implementing it I'd like to know if others had a similar requirement and how they implemented it."
] | [
"c#",
"nlog"
] |
[
"How to enable USB Serial on multiple activities in android application?",
"I want to make an app that can transfer data to a USB-connected device. The app has multiple activities (and multiple layouts). How can I make it so that I only need to enable USB connection in one activity, then when you go to the next activity you can still transfer data without having to re-enable the USB connection?\n\nI'm using this tutorial as a reference : https://www.allaboutcircuits.com/projects/communicate-with-your-arduino-through-android/\n\nI also use USB Serial Library (as used in the tutorial above) by Github user felHR85. Link : https://github.com/felHR85/UsbSerial/\n\nAppreciate the help! Thanks!"
] | [
"android",
"android-activity",
"usbserial"
] |
[
"Going one directory behind using OS in Python",
"I have a file sample.py in bin folder. Path of bin - /username/packagename/bin\n\nso when i am doing, dir = os.getcwd(), it gives me the path of the bin(mentioned above).\n\nSo, is there a way that i can go one directory behind, that is /username/packagename ??"
] | [
"python",
"python-2.7",
"operating-system"
] |
[
"Parameter Delete in jqGrid",
"i want implement Delete for jqGrid, i have (example) 2 table Request and Item\n\nRequest Fields are RequestId,WayBillNo,Customer\nItem Fields are RequestId,ItemNO,Quantity\nRequest table RequestId is pk and in item table pk are RequestId,ItemNO i write this code for item table\n\nvar requestIdItem=0, itemIdItem=0;\nvar gridItem = $('#listItem');\ngridItem.jqGrid({\n url: 'jQGridHandler.ashx',\n postData: { ActionPage: 'ClearanceItems', Action: 'Fill', requestId: rowid },\n ajaxGridOptions: { cache: false },\n datatype: 'json',\n height: 200,\n colNames: ['RequestId','ItemNo',Quantity],\n colModel: [\n { name: 'REQUEST_ID', width: 100, sortable: true,hidden:true },\n { name: 'ITEM_NO', width: 200, sortable: true }\n { name: 'Quntity', width: 100, sortable: true }\n ],\n gridview: true,\n rowNum: 20,\n rowList: [20, 40, 60],\n pager: '#pagerItem',\n viewrecords: true,\n sortorder: 'ASC',\n rownumbers: true,\n //onSelectRow: function (id, state) {\n // requestIdItem = gridItem.jqGrid('getCell', id, 'REQUEST_ID_ID');\n // alert(requestIdItem);\n // itemIdItem = gridItem.jqGrid('getCell', id, 'ITEM_NO');\n // alert(itemIdItem);\n //}\n //,\n beforeSelectRow: function (itemid, ex) {\n requestIdItem = gridItem.jqGrid('getCell', itemid, 'REQUEST_ID_ID');\n itemIdItem = gridItem.jqGrid('getCell', itemid, 'ITEM_NO');\n\n return true;\n }\n\n});\ngridItem.jqGrid('navGrid', '#pagerItem', { add: false, edit: false, del: true }, {}, {}, {\n //alert(requestIdItem);\n url: \"JQGridHandler.ashx?ActionPage=ClearanceItems&Action=Delete&REQUEST_ID=\" +\n requestIdItem + \"&ITEM_NO=\" + itemIdItem\n}, { multipleSearch: true, overlay: false, width: 460 });\n\n\ni write this code for item table , now i want write code for delete item in Item table i write this code for send parameters value\n\nurl: \"JQGridHandler.ashx?ActionPage=ClearanceItems&Action=Delete&REQUEST_ID=\" +\n requestIdItem + \"&ITEM_NO=\" + itemIdItem\n\n\nbut always send 0 value to server, please help me. thanks all\n\nEDIT01: i change Delete Option For this:\nI see in this page http://stackoverflow.com/questions/2833254/jqgrid-delete-row-how-to-send-additional-post-data user @Oleg write this code \n\ngridItem.jqGrid('navGrid', '#pagerItem', { add: false, edit: false, del: true }, {}, {}, {\n serializeDelData: function (postdata) {\n alert(postdata.id);\n return \"\"; // the body MUST be empty in DELETE HTTP requests\n },\n onclickSubmit: function (rp_ge, postdata) {\n // alert(postdata.id);\n var rowdata = $(\"#listItem\").getRowData(postdata.id);\n alert(rowdata.REQUEST_ID_ID);\n rp_ge.url = 'JQGridHandler.ashx?ActionPage=ClearanceItems&Action=Delete&' +\n $.param({ rr: rowdata.REQUEST_ID_ID });\n\n // 'subgrid.process.php/' + encodeURIComponent(postdata.id) +\n // '?' + jQuery.param({ user_id: rowdata.user_id });\n }\n //alert(requestIdItem);\n // url: \"JQGridHandler.ashx?ActionPage=ClearanceItems&Action=Delete&REQUEST_ID=\" +\n // requestIdItem + \"&ITEM_NO=\" + itemIdItem\n}, { multipleSearch: true, overlay: false, width: 460 })\n\n\nwhen send Data to server send undefined"
] | [
"jqgrid",
"jqgrid-asp.net",
"jqgrid-formatter",
"jqgrid-inlinenav"
] |
[
"jQuery sortable (how to customize the clickable area inside the sortable box)",
"I have this jQuery code:\n\n$(\".right_box_holder\").sortable({ \n update : function () { \n var order = $('.right_box_holder').sortable('serialize'); \n $.get(\"right_menu_functions.php?change_sortorder&\"+order);\n } \n });\n\n\nand this HTML code:\n\n<div class='right_box_holder'>\n <div class='right_box' id='box_0'>\n // sort box 0\n </div>\n <div class='right_box' id='box_1'>\n // sort box 1\n </div>\n <div class='right_box' id='box_2'>\n // sort box 2\n </div>\n</div>\n\n\nAs it is now, I can click anywhere inside .right_box and move it. I want to disable this and make a button / icon inside .right_box which the user have to click on to drag the box. Is this possible?"
] | [
"jquery",
"sorting",
"jquery-ui-sortable"
] |
[
"What is the default \"type\" of parameters in scala? Is it Val?",
"I have a simple class like this.\n\nI haven't specified whether the parameters are val's or var's. \nWhat type of parameters are name and price?\n\n class Car(name:String, price:Float){ \n }"
] | [
"scala"
] |
[
"An exception of type 'System.InvalidOperationException' occurred in Microsoft.EntityFrameworkCore.dll but was not handled in user code",
"I'm trying to call a method from IActionResult using Task.Run. This is the Exception I am getting.\n\n\n An exception of type 'System.InvalidOperationException' occurred in\n Microsoft.EntityFrameworkCore.dll but was not handled in user code:\n 'An exception was thrown while attempting to evaluate a LINQ query\n parameter expression. To show additional information call\n EnableSensitiveDataLogging() when overriding DbContext.OnConfiguring.'\n Inner exceptions found, see $exception in variables window for more\n details. Innermost exception System.NullReferenceException : Object\n reference not set to an instance of an object.\n\n\nInitialization of EntityContext instance:\n\nprivate readonly EntityContext _context; \npublic ApiController (\n UserManager<User> userManager,\n SignInManager<User> signInManager,\n ILoggerFactory loggerFactory,\n IMemoryCache memoryCache,\n EntityContext context,\n IRepository repository,\n Context session,\n IEmailService emailService,\n IHostingEnvironment environment,\n IHttpContextAccessor contextAccessor, ViewRender view, IStringLocalizer<SharedResources> localizer) : base (userManager, signInManager, loggerFactory, memoryCache, context, repository, session, contextAccessor) {\n //_view = view;\n _emailService = emailService;\n this.environment = environment;\n _localizer = localizer;\n this._context = context;\n\n\n}\n\n\nStartup.cs\n\n services.AddEntityFrameworkNpgsql ()\n .AddDbContext<EntityContext> (\n options => options.UseNpgsql (connectionString)\n );\n\n\nCalling method from controller:\n\nif(updated){\n Task t1 = Task.Run(()=>SendEmailAsync(entity,true,responsible,_context));\n }else{\n Task t1 = Task.Run(()=>SendEmailAsync(entity,false,responsible,_context));\n }\n\n\nMethod I am calling:\n\npublic void SendEmailAsync (Activity entity, bool updated, User responsible, EntityContext ctx) {\n\n List<string> emailList = new List<string> ();\n\n var mail = new MailComposer (_emailService, environment, _localizer);\n\n if (responsible.IsSubscriber) {\n emailList.Add (responsible.Email);\n }\n if (entity.Participants.Count > 0) {\n foreach (var item in entity.Participants) {\n var p = ctx.Users.Where(c=>c.Id==item.Participant.Id).FirstOrDefault(); //This is where I am getting an exception.\n if (p.IsSubscriber) {\n emailList.Add (p.Email);\n }\n\n }\n }\n if (emailList.Count != 0) {\n var emailArray = emailList.ToArray ();\n if (updated) {\n mail.SendActivityUpdate (entity, emailArray);\n } else {\n mail.SendActivityCreated (entity, emailArray);\n }\n }\n}"
] | [
"entity-framework",
"asp.net-core",
"ef-code-first"
] |
[
"Adding an Additional Column to SQL Result Set by Using two Que",
"Basically, I want have two separate SQL queries, but I want them to be displayed in the same result set. However, the first query returns several columns and the second query only returns one column. \n\nIf I want the results from the second query to simply be added on as an additional column to the results from the first query, how do I do this? \n\nQuery 1:\n\nSELECT cr.COMMUNICATION_ID, cr.CONSUMER_ID, cr.ACTION_LOG_ID, cal.CONSUMER_ID, cal.TIPS_AMOUNT, cal.LAST_MOD_TIME\nFROM COMMUNICATION_RELEVANCE AS cr\nJOIN consumer_action_log AS cal\nON cr.ACTION_LOG_ID=cal.ACTION_LOG_ID;\n\n\nQUERY 2:\n\nSELECT AVG(TIPS_AMOUNT) AS AVG_TIPS\nFROM CONSUMER_ACTION_LOG\nJOIN COMMUNICATION_RELEVANCE\nON CONSUMER_ACTION_LOG.SENDER_CONSUMER_ID=COMMUNICATION_RElEVANCE.consumer_id;\n\n\nBasically, I want a UNION, but for queries with different number of columns."
] | [
"sql",
"mysql"
] |
[
"Accessing std::vector created in class constructor",
"I am trying to create a class with a std::vector as element. I initialize and populate the vector in the constructor. However when I try to access the vector using this-> form a method in the class, I get an empty vector.\n\nThe code looks pretty much like the following: \n\nmyclass::myclass() { \n std::vector<double> pars(1000);\n for (int i = 0; i < 1000; i++) {\n pars.at(i) = some_value;\n }\n}\n\ndouble myclass::method(int i) {\n return this->pars.at(i); \n}\n\n\nI can see the elements into the vector within the constructor. However, myclass::method(int i) always returns 0 and the array this->pars has size 0. Any suggestion?\n\nI have declared pars in a separate header file as:\n\nclass myclass {\n private:\n std::vector<double> pars;\n ...\n}"
] | [
"c++"
] |
[
"Should I create separate endpoints for bulk CRUD operations REST?",
"If I want to support both single and bulk create, update, delete operations in my REST API, I have two options:\n\nCreate single endpoint for both single and bulk operations, e.g:\n\nPOST docs/\n{content...}\n\nPOST docs/\n[\n {content...},\n {content..,}\n]\n\n\nOr to create separate endpoints for both single and bulk operations, e.g:\n\nPOST docs/\n{content...}\n\nPOST docs/bulk\n[\n {content...},\n {content...}\n] \n\n\nWhich option is better in term of: REST guidelines and design principles, and why? many thanks."
] | [
"rest",
"api",
"api-design"
] |
[
"C++, determine prime number",
"I've started to read a book on C++ yesterday. So far I'm 100 pages and took that number to write my first programm. I've wanted it to find out if a given number is a prime number or not.\n\nI've got 2 questions about it.\n\n\nI know my method is everything else than good. The programm is checking every single number which makes the programm big. What would be the ideal way to do this? Doesn't matter if I understand your answer yet, I'll simply read up the commands later :).\nI've had a huge problem with the \"Result+=1\" line. At first I had i=1, which gave me the following result for the number 7.\n\n1111112\n\n\nWell, I also know why. For the 6 first for loops he found one number (1) and for the last one 2(1,7). But thats obviously not how I wanted it work. I want Result to be some kind of counter. How do I do that?\n\nThe code:\n\n#include <iostream>\nusing namespace std;\n\n\n\n// Hauptprogramm\n\nint main ()\n{\n // Variablen\n int Prime_number;\n int Result = 0;\n\n // Abfragen\n cout << \"Please enter possible prime number: \";\n cin >> Prime_number;\n\n // Rechnen\n for (int i=2; i <= Prime_number ; i++)\n { \n if (Prime_number%i == 0)\n { \n Result +=1;\n }\n }\n\n // Ausgabe\n if(Result == 1)\n {\n cout << \"You got a prime number!\" << endl;\n }\n else\n {\n cout << \"No luck\" <<endl;\n }\n\n return 0;\n}"
] | [
"c++"
] |
[
"Button Counter and store on intranet",
"I've got a short question. I want to develop a little script on our intranet.\nThe requirements are:\n\n\na button, which count +1 if you click on it\njust logged in users can count \nall other users should see the counter\n\n\nI'm a beginner in JS and i only know the localStorage function, but i want to save the counter on the server, so that everybody see's the same status.\n\nThats what I got, but its just the localStorage, so every computer has their own status of the counter.\n\nif (localStorage.getItem(\"counter\")!=null) {\n counter = Number(localStorage.getItem(\"counter\"));\n document.getElementById(\"counterValue\").innerHTML = counter;\n}\n\n\nDo you know what I mean? Thanks for the help and sorry for my bad english :)"
] | [
"javascript",
"php",
"html",
"intranet"
] |
[
"Apache solr 7.4 : \"copyField dest :'text' is not an explicit field and doesn't match a dynamicField",
"I am using Apache Solr 7.4. I am trying to use curl/postman to define some portions of my schema.\n\nI was able to define field type and fields successfully, when I try to define a copy-field I am getting an error : \n\n\"copyField dest :'text' is not an explicit field and doesn't match a dynamicField\n\n\nHere's my field type definition :\n\n \"add-field-type\": {\n\"name\": \"text\",\n\"class\": \"solr.TextField\",\n\"positionIncrementGap\": \"100\",\n\"indexAnalyzer\": {\n \"charFilters\": [{\n \"class\": \"solr.MappingCharFilterFactory\",\n \"mapping\": \"mapping-ISOLatin1Accent.txt\"\n }],\n \"tokenizer\": {\n \"class\": \"solr.KeywordTokenizerFactory\"\n },\n \"filters\": [{\n \"class\": \"solr.LowerCaseFilterFactory\"\n },\n {\n \"class\": \"solr.StopFilterFactory\",\n \"ignoreCase\": \"true\",\n \"words\": \"stopwords.txt\"\n },\n {\n \"class\": \"solr.RemoveDuplicatesTokenFilterFactory\"\n }\n ]\n},\n\"queryAnalyzer\": {\n \"charFilters\": [{\n \"class\": \"solr.MappingCharFilterFactory\",\n \"mapping\": \"mapping-ISOLatin1Accent.txt\"\n }],\n \"tokenizer\": {\n \"class\": \"solr.KeywordTokenizerFactory\"\n },\n \"filters\": [{\n \"class\": \"solr.LowerCaseFilterFactory\"\n },\n {\n \"class\": \"solr.StopFilterFactory\",\n \"ignoreCase\": \"true\",\n \"words\": \"stopwords.txt\"\n },\n {\n \"class\": \"solr.LowerCaseFilterFactory\"\n },\n {\n \"class\": \"solr.RemoveDuplicatesTokenFilterFactory\"\n }\n ]\n}\n\n\n}\n\nI also added a dynamic field :\n\n \"add-dynamic-field\":{\n \"name\":\"*_txt1\",\n \"type\":\"text\",\n \"stored\":true,\n \"indexed\":true\n\n\n}\n\nHere's my field :\n\n \"add-field\": [{\n \"name\": \"path\",\n \"type\": \"string\",\n \"indexed\": \"true\",\n \"stored\": \"false\"\n}\n\n\nIts successful upto this. Now I am trying to add a copy field as below :\n\n\"add-copy-field\":\n {\n \"source\":\"path\",\n \"dest\": \"text\"\n }\n\n\nAnd this is where it is failing. Stuck at this, any help is appreciated. Thanks!"
] | [
"apache",
"solr"
] |
[
"how to get register MBean with method getPlatformMXBean()?",
"I have register mbean by using \n\nManagementFactory.getPlatformMBeanServer().registerMBean(mbean, name);\n\n\nAnd I can see this mbean in jconsole. I want get it by ManagementFactory.getPlatformMXBean(mbean), but it throws Exception \n\n\n mbean not a platform management interface.\n\n\nHow can I get this registered bean?\n\nBelow is the code.\n\npublic void contextInitialized(ServletContextEvent servletContextEvent) {\n System.out.println(\"Registering MBean...\");\n try {\n ObjectName name = new ObjectName(\"common.test:type=MbeanTestImplement\");\n MbeanTestInterface mbean = new MbeanTestImplement();\n ManagementFactory.getPlatformMBeanServer().registerMBean(mbean, name);\n MbeanTestImplement mxbean = ManagementFactory.getPlatformMXBean(MbeanTestImplement.class);\n System.out.println(mxbean.getName());\n } catch (Exception e){\n e.printStackTrace();\n }\n //ManagementFactory.getMBeanserverConnection()\n}\n\n\nMbeanTestInterface extends PlatformManagedObject, and MbeanTestImplement implement MbeanTestInterface.\n\npublic interface MbeanTestInterface extends PlatformManagedObject {\n public String getName();\n}\n\npublic class MbeanTestImplement implements MbeanTestInterface {\n @Override\n public String getName() {\n return MbeanTestImplement.class.toString();\n }\n\n @Override\n public ObjectName getObjectName() {\n return null;\n }\n}"
] | [
"java",
"jmx"
] |
[
"Parsing log entries using awk",
"I get the below logs:\n\n2013-10-24 18:35:49,728 ERROR [xx.xx.xx.xx.xx.xx] (xx.xx.xx.xx.xx) Manila Olongapo Leyte Tacloban has updated their subscriber details. But, the Regional Account Update interface call has failed for the following Local Registries: <br/>Visayas<br/>Data between LRA and the above Local Registries is out of synch as a result.\n\n\nI want the result input to be in the below format. What is the better way to do this — using awk or sed perhaps? Please advise.\n\n$Province$ has updated their subscriber details. However, the Customer Account Update interface call has failed for the following Land Registries:\n$Region Name$"
] | [
"parsing",
"awk"
] |
[
"Rails set a record as read only based on a column value in the record",
"I have a Rails application with a table called Events. When the event is created, a field called maxsynch is set to \"n\". We use Mule to pull those events into another application. When it pulls one of the events, it sets the maxsynch to \"s\".\n\nI'm wondering if I can set the records with maxsynch = \"s\" to read only.\n\nI found the following code on StackOverflow:\n\n def create_or_update\n raise ReadOnlyRecord if readonly?\n result = new_record? ? create : update\n result != false\n end\n\n def readonly?\n new_record? ? false : true\n end\n\n\nThis is supposed to set a record as read-only after it is created (I think). I wanted to start testing by trying this first. Then change the code to define the readonly? as maxsynch = \"s\".\n\nWhen I put that code into my events controller and try to update an event, I get the following error:\n\nuninitialized constant Event::ReadOnlyRecord\n\n\nFrom the line of code:\n\n raise ReadOnlyRecord if readonly?"
] | [
"ruby-on-rails"
] |
[
"Flask doesnt open window on a new tab",
"I am trying to create a flask app and I want to open it in a new chrome tab. Apparently it doesn't work,\nhere is the code:\nimport webbrowser\n\nfrom flask import Flask\napp = Flask(__name__)\n\[email protected]("/")\ndef hello():\n return("Hello World!")\n\ndef open_browser():\n webbrowser.open_new('http://127.0.0.1:5000/')\n\nif __name__ == "__main__":\n app.run(port=5000)\n open_browser()\n\nAny help will be much appreciated."
] | [
"python",
"flask"
] |
[
"Writing specs for grammar in atom editor",
"I have written my own grammar in atom. I would like to write some specs for the same, but I am unable to understand how exactly to write one. I read the Jasmine documentation, but still not very clear. Can someone please explain how to write specs for testing out grammar in atom. Thanks"
] | [
"atom-editor"
] |
[
"Share to React-Native",
"I am trying to have apps on the android device to share to my react-native app. However, I can't find any documentation which can help me so I was wondering if there any way to share content from other apps to my app?\n\nClarification:\n\n\nI am trying to add my app to this list"
] | [
"react-native",
"react-native-android"
] |
[
".setTitle() method doesn't change title",
"I know there are various versions of this question already on stack overflow but none of those could help me. It just won't work\n\nI'm trying to programatically change a UIButtons title here:\n\noverride func viewDidLoad() {\n super.viewDidLoad()\n semesterTableView.dataSource = self\n semesterTableView.delegate = self\n\n topView.addShadow(heightOffset: 1)\n bottomView.addShadow(heightOffset: -2.25)\n bottomView.layer.shadowOpacity = 0.2\n addButton.layer.cornerRadius = 10\n addButton.setTitle(\"Test\", for: UIControlState.normal) //<--- Here\n}\n\n\nAs you can see I'm also adding a corner radius to the button what works, therefore the button is indeed connected (\nas you can see here:Proof of connection\n). Just the title change won't work."
] | [
"swift",
"uibutton"
] |
[
".How to import .pts or .e57 file to matlab",
"I have a pts file with 3d points (x,y,z,r,g,b) that looks like this:\n2392712 \n\n222.37501 121.5225 9.59174 126 112 91\n\n222.64801 121.5295 10.60674 176 166 145\n\n222.41301 121.5185 10.36874 182 171 147\n\n222.65901 121.5945 10.60274 184 178 162\n\n222.39301 121.5225 9.60274 122 111 87\n\n222.49101 121.5245 10.38074 179 173 155\n\n222.43601 121.5225 9.56074 108 96 82\n\n222.61101 121.5275 10.01174 120 118 111\n\n222.39601 121.5165 10.43674 181 172 148\n\n222.31501 121.5145 10.65874 184 174 152\n\n222.32901 121.5225 9.50774 132 120 95\n\n\nI want to read it in MATLAB or there is a way to convert these file from .pts/.e57 to .ply/.pcd in MATLAB or in Python"
] | [
"matlab"
] |
Subsets and Splits