texts
sequence
tags
sequence
[ "Access C drive using C++ programming", "I have a project that must hide a file into an image , first I used command prompt and it goes well. Now I am trying to apply this commands using C++ programming language, but each time it gives me that system can't find the specified path although it exists and work well using command prompt.\n\nThis my code: \n\nsystem(\"cd\\\\\"); \\\\access C\nsystem(\"cd x\"); \\\\X is name of folder in C\nsystem(\"copy /b pic.jpg + file.rar NEWPICTURE.jpg\");\n\n\nThis is the source of commands: http://www.instructables.com/id/How-to-Hide-Files-Inside-Pictures/" ]
[ "c++" ]
[ "In Android, a possible black screen may occur as switching activity", "I did some experiments on investigating Activity switching life cycle, and found there's a situation a \"black screen\" will occur. If I'm wrong please kindly correct me. \n\nTwo Activities A & B. Launch to B from A.\n\n03-06 13:04:52.811: I/LOG(32125): pause A begin\n03-06 13:04:53.811: I/LOG(32125): pause A return\n03-06 13:04:53.813: I/LOG(32125): focus A begin\n03-06 13:04:58.813: I/LOG(32125): focus A return\n\nIn the window, shows the view of Activity A.\n\n03-06 13:04:58.829: I/LOG(32125): create B begin\n03-06 13:04:58.845: I/LOG(32125): create B return\n03-06 13:04:58.846: I/LOG(32125): start B begin\n03-06 13:04:59.847: I/LOG(32125): start B return\n\nThe view of Act A is hide, it is now shown by Activity B, but it's actually a \"black screen\" rather than the \"actual genereated layout\" in Activity B\n\n03-06 13:04:59.847: I/LOG(32125): resume B begin\n03-06 13:05:00.847: I/LOG(32125): resume B return\n03-06 13:05:00.968: I/LOG(32125): focus B begin\n03-06 13:05:05.968: I/LOG(32125): focus B return\n\nUntil this point, the \"actual generated layout\" of Activity B is shown here.\n\n03-06 13:05:06.044: I/LOG(32125): A onSaveInstance\n03-06 13:05:06.044: I/LOG(32125): stop A begin\n03-06 13:05:07.044: I/LOG(32125): stop A return\n\n\nBelow is the code in my Activity A & B. I use Thread.sleep to simulate the long period task. ( Maybe this is not an appropriate way make the simulation? )\n\n@Override\nprotected void onStart() {\n super.onStart();\n Log.i(\"LOG\",\"start B begin\");\n try {\n Thread.sleep(5000,0);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n Log.i(\"LOG\",\"start B return\");\n}\n\n@Override\nprotected void onResume() {\n super.onResume();\n Log.i(\"LOG\",\"resume B begin\");\n try {\n Thread.sleep(5000,0);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n Log.i(\"LOG\",\"resume B return\");\n}\n\n@Override\nprotected void onStop() {\n super.onStop();\n Log.i(\"LOG\",\"stop B begin\");\n try {\n Thread.sleep(3000,0);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n Log.i(\"LOG\",\"stop B return\");\n}\n\n@Override\nprotected void onPause() {\n super.onPause();\n Log.i(\"LOG\", \"pause B begin\");\n try {\n Thread.sleep(3000,0);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n Log.i(\"LOG\",\"pause B return\");\n}\n\n@Override\npublic void onWindowFocusChanged(boolean hasFocus) {\n super.onWindowFocusChanged(hasFocus);\n Log.i(\"LOG\",\"focus B begin\");\n try {\n Thread.sleep(5000,0);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n Log.i(\"LOG\",\"focus B return\");\n}\n\n\nFrom above experiments, I came up with some conclusion and design strategies.\n\n\nDon't do too much things on Act B onResume & onFocus, or else users will see \"black screen\".\nFollowing by (1), do it in Act B \"onStart\" in instead. It's better to let user feel the delay with there's a view shown by previous Act A than seeing a \"black screen\".\nAsyncTask is definitely the solution. Show the view to user is top priority, data applied afterward.\n\n\n\n\nHowever, there's also a scenario like this: \nA chart application. User see the \"chart(layout)\" in the Activity, but the latest data hasn't filled in yet because the second thread is still fetching the data (maybe because it's too heavy). \n\nUser will see a blank chart at this point. To avoid this, we can then get the data prior to the creation of Activity. Either do this in the previous Activity or in the beginning of Application. To smooth the user experience.\n\n\n\nDid any one find this \"black screen\" pitfall as well? Or did I understand things incorrectly? Thank you very much!" ]
[ "android", "lifecycle" ]
[ "Please suggest Ionic Application Template", "I want to develop a mobile application using ionic and angular js, an application just like this one:\nhttps://play.google.com/store/apps/details?id=com.vanity.iqbal&hl=en\n\ncan I do that with ionic and angular? If so, Please suggest a template for this.\n\nThank you," ]
[ "android", "angularjs", "ionic-framework", "mobile-application" ]
[ "How can I filter data based on roles in firestore?", "I am trying to filter data from a document in firestore based on a role of a user. Let's consider I have a document named Company which contains data like a name and billing information. I have a user with the role Employee and he should be able to access the name of the Company but not the billing information. A user with the role Admin should be able to see the entire data.\n\nCompany Document in collection:\n\ncompanyId123: {\n name: \"Awesome Company\",\n creditCard: \"12345678\"\n}\n\n\nRoles: Different access levels for admins and employees.\n\nIs there anyway to adjust the data available to users based on their roles? What are the best practices?" ]
[ "firebase", "google-cloud-firestore", "nosql", "firebase-security" ]
[ "Casablanca with boost 1.56 fails due to -Werror", "I'm trying to build Casablanca with boost 1.56, but my build keeps failing due to boost warnings turned error by Casablanca's -Werror flag\n\nFor example:\n\nCXX=g++ BOOST_ROOT=${boost} cmake .. -DCMAKE_BUILD_TYPE=Release\n\n\nYields errors like (far too many to show)\n\n/home/matt/workspace/opal2/o2linux64/Libs/boost/1.56/include/boost/system/error_code.hpp:222:36: error: ‘boost::system::errno_ecat’ defined but not used [-Werror=unused-variable]\n static const error_category & errno_ecat = generic_category();\n ^\n/home/matt/workspace/opal2/o2linux64/Libs/boost/1.56/include/boost/system/error_code.hpp:223:36: error: ‘boost::system::native_ecat’ defined but not used [-Werror=unused-variable]\n static const error_category & native_ecat = system_category();\n ^\ncc1plus: all warnings being treated as errors\nmake[2]: *** [src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o] Error 1\n\n\nI can't seem to find any remedy on google, though I have found posts where people have built with 1.56 and don't mention disabling Werror in src/CMakeList.txt (which incendentally seems to allow the code to build)" ]
[ "c++", "boost", "casablanca" ]
[ "Can't get .bat to run with PHP on WAMP localhost", "I've been busting my head against the wall on this one for hours and I can't make any progress. \n\nRight now I've simmered down my problem to the simple (maybe?) task of trying to get a PHP script to run a .bat program, on localhost. I'm using WAMP. \n\nThis is my current PHP file:\n\n<?php system('cmd /c C:\\Users\\user\\Desktop\\open.bat'); ?>\n\nThat's all there is in it. My .bat file, which is on the desktop, contains:\n\nnotepad.exe C:\\Users\\user\\Desktop\\test.txt\n\nAnd then I have a simple text file called test.txt on the desktop. I can run the .bat file from the command line and it works fine, but nothing from within the PHP. \n\nThere's numerous other threads here asking how to run a .bat from PHP (ex: How do you run a .bat file from PHP?), and I've tried pretty much every technique I've read about online, and NOTHING WORKS. \n\nEx, I've tried \n\nexec('open.bat') (with the .bat in the same directory), shell_exec(), changing around the locations of files, paths, I really don't know what's up with it. I'm not running PHP in safe mode. \n\nPerhaps there's some configuration that I should know about that will allow it to run? Or maybe I'm missing something painfully obvious..." ]
[ "php", "batch-file", "exec" ]
[ "Sphinx and blockdiag: non-English characters give UnicodeEncodeError", "I have an RST file to compile with Sphinx.\n\nI have a block diagram there.\n\nI want to give non-english names to some of its nodes.\n\n.. blockdiag::\n\n diagram {\n \"UberMega\" -> \"HellSotona\" -> \"KakoDemon\" -> \"Кролики и котятки\";\n }\n\n\nAlas, it gives me an error:\n\n File \"C:\\Python2\\lib\\site-packages\\blockdiag\\imagedraw\\png.py\", line 282, in textlinesize\n size = self.draw.textsize(string, font=None)\n File \"C:\\Python2\\lib\\site-packages\\PIL\\ImageDraw.py\", line 282, in textsize\n return font.getsize(text)\nUnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-5: ordinal not in range(256)\nWARNING: blockdiag error: UnicodeEncodeError caught (check your font settings)\n\n\nHow can I cope with it?" ]
[ "python", "python-sphinx" ]
[ "Angular i18n - routing to locale client side - deploying subverted Angular index.html", "Please critique this idea for setting up internationalized Angular project. This is Angular 11.\nI'm using the Angular I18N (https://angular.io/guide/i18n) method up to the point of deployment. From there, I essentially subvert the formal Angular way to what I think is a simpler set up.\nBackground:\nWe are using the Angular I18N to isolate strings, move them to xliff files, translate them, build localized copies of the application, and using LOCALE_ID to make sure the date, decimal, etc pipes appropriately localize (https://angular.io/api/core/LOCALE_ID).\nThe ng build --prod --localize builds N copies of the application with each one in a different folder. N is the number of locales specified in angular.json: /projects/.../i18n/locales plus the sourceLocale. E.g., if my source is 'en-US' and I have 'es' and 'fr' defined, the distribution has three folders 'en-US/', 'fr/', 'es/'.\nAn observation that will be important shortly is that each folder has many files which are nearly all identical. In our case, each folder has about 70 files totaling about 1 MB. Across folders, the files are identical except index.html and main.###.js. The index.html differs only by <html lang...> and <base href...>.\nEverything up to here follows the Angular documentation (https://angular.io/guide/i18n) and works fine.\nIf you deploy at this point, your application may be accessed by users by specifying their language of choice in the URL. .../your-app/en-US, .../your-app/es, etc. There are no files at root, so .../your-app displays nothing.\nAngular recommends configuring your server to redirect to the appropriate folder based on the http header value for accept language. That might work for some. We have a couple of issues with that: (1) access to server set up is limited, therefore it is preferable that we do the redirect client side. (2) The browser language is not necessarily the best choice. We want users to be able to set the language for the application. Until the user tells us, we will accept the browser language as a default. But the user override is important.\nMy first idea was to move all the files from /en-US into root. Now, there's a default application at .../your-app/. That can redirect based on language. However, to handle deep links would require a router imbroglio to be avoided.\nThe Plan\nMy current idea which seems to be working well is, after the build in the dist folder:\n\nMove all the files from en-US to root.\n\nMove es/main.###.js to ../main.es.###.js, fr/main.###.js to ../main.fr.###.js, etc.\n\nDelete all the subfolders. (Note how much smaller the distribution is now.)\n\nAlter index.html as follows:\n\n\n4a. Update <base href='/'>\n4b. Include a script which detects the user's preferred language.\n4c. In JS, create a script element, set the source to main.?lang?.###.js, body.appendChild(script).\n4d. Remove from the end of body <script src="main.###.js></script>\nThis works well. Deep links work fine. No routing to configure.\nAnyone see issues?\nObviously one is: "Angular might change things in the future that break this." But that's ALWAYS a problem." ]
[ "angular", "internationalization" ]
[ "How to set height of a Ext JS grid.Grid's headercontainer?", "I want to set and fix height of headercontainer in my grid.\nWhitch configs to do it? header: config for grid.Grid does not exist\nNow it look like a bag:" ]
[ "extjs", "grid", "extjs4", "sencha-touch", "extjs6" ]
[ "IE 10 Windows Phone Responsive Redirect Loop", "I have used Twitter Bootstrap to make responsive my web stie and on my phone Lumia 920 it's not working. I found a solution in JavaScript:\n\n(function() {\n if (\"-ms-user-select\" in document.documentElement.style && navigator.userAgent.match(/IEMobile\\/10\\.0/)) {\n var msViewportStyle = document.createElement(\"style\");\n msViewportStyle.appendChild(\n document.createTextNode(\"@-ms-viewport{width:auto!important}\")\n );\n document.getElementsByTagName(\"head\")[0].appendChild(msViewportStyle);\n }\n})();\n\n\nBut I have redirect loop on my PC (this script should be run only in IE 10 mobile). The problem is in line: \n\ndocument.createTextNode(\"@-ms-viewport{width:auto!important}\")\n\n\nBecause if I comment this line everything works fine but... responsive on IE mobile.\nI added in my CSS:\n\n@-ms-viewport{\n width: device-width;\n}" ]
[ "windows-phone-8", "responsive-design", "internet-explorer-10" ]
[ "How enable scroll bar for only few item listBox?", "I have a listbox i want that except first index all other items are scrollable. \nI have a sample code here. Here my list box first item is behaing like header of list box. So now i dont want to scroll header. and rest of item's should be scrollable.`\n\n<ListBox x:Name=\"FieldOrderListBox\" Grid.Row=\"1\" Grid.Column=\"0\" Grid.ColumnSpan=\"2\" HorizontalAlignment=\"Stretch\" \n VerticalAlignment=\"Stretch\" HorizontalContentAlignment=\"Stretch\" SelectedIndex=\"0\" IsSynchronizedWithCurrentItem=\"True\"\n ScrollViewer.VerticalScrollBarVisibility=\"Auto\" ScrollViewer.HorizontalScrollBarVisibility=\"Hidden\" SelectionChanged=\"FieldOrderListBox_SelectionChanged\">\n <ListBox.Resources>\n <SolidColorBrush x:Key=\"{x:Static SystemColors.ControlBrushKey}\" Color=\"#FF479EF3\"></SolidColorBrush>\n </ListBox.Resources>\n <ListBox.ItemTemplate>\n <DataTemplate x:Name=\"MyTemplate\">\n <Grid Margin=\"-5,-1,0,0\">\n <Grid.ColumnDefinitions>\n <ColumnDefinition Width=\"Auto\" SharedSizeGroup=\"FieldName\" MinWidth=\"10\" MaxWidth=\"300\"/>\n <ColumnDefinition Width=\"2\"/>\n <ColumnDefinition Width=\"*\"/>\n </Grid.ColumnDefinitions>\n <Grid.Style>\n <Style TargetType=\"{x:Type Grid}\"> \n <Style.Triggers>\n <DataTrigger Binding=\"{Binding RelativeSource={RelativeSource PreviousData}}\" Value=\"{x:Null}\"> \n <Setter Property=\"TextBlock.TextAlignment\" Value=\"Center\"/> <Setter Property=\"Background\" Value=\"#E5E5E5\"/>\n <Setter Property=\"TextBlock.Foreground\" Value=\"Black\"/>\n <Setter Property=\"Border.BorderThickness\" Value=\"0.5,0.5,0,2\"/>\n <Setter Property=\"Border.BorderBrush\" Value=\"Black\"/>\n <Setter Property=\"Border.Margin\" Value=\"0,-1,0,0\"/>\n <Setter Property=\"Border.Padding\" Value=\"5,0,0,5\"/> \n </DataTrigger>\n </Style.Triggers>\n </Style>\n </Grid.Style>\n <Border BorderBrush=\"Black\" Grid.Column=\"0\" BorderThickness=\"0.5,0.0,0.5,0.5\" IsHitTestVisible=\"False\" OverridesDefaultStyle=\"False\">\n <TextBlock Text=\"{Binding Name}\" Grid.Column=\"0\" ToolTip=\"{Binding Name}\" Margin=\"5,0,2,0\" VerticalAlignment=\"Center\"/>\n </Border>\n <GridSplitter Grid.Column=\"1\" Width=\"2\" HorizontalAlignment=\"Left\" Background=\"DarkGray\" Margin=\"-2,0,-1,0\"/>\n <Border BorderBrush=\"Black\" BorderThickness=\"0,0.0,0.5,0.5\" Margin=\"-2,0,0,0\" Padding=\"0,5,0,0\" Grid.Column=\"2\">\n <TextBlock Text=\"{Binding AliasName}\" Grid.Column=\"1\" ToolTip=\"{Binding AliasName}\" Margin=\"5,0,2,0\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Stretch\"/>\n </Border>\n </Grid>\n </DataTemplate>\n </ListBox.ItemTemplate>\n</ListBox>" ]
[ "wpf", "user-controls", "listbox", "wpf-controls" ]
[ "Best ways to add security vulnerability checks in spring boot apis", "I have a problem, I use spring with the multitenant database. I have written rest api and using spring token for validating the user. For all API's we are passing the module id's get/put/delete operations. Here I would like to add a common security check like securityInterceptor. What is the best way to add security checks in spring so that no one can see data of different tenants?" ]
[ "spring", "spring-security" ]
[ "How to pass header and Body value using HttpWebRequest in C#?", "Im trying to POST API credentials data to API through HttpWebRequest class in C#, like i have to pass \"Content-Type:application/x-www-form-urlencoded\" in Header, then have to pass \"grant_type:client_credentials,client_id:ruban123,client_secret:123456\" in Body to get response/token (as described in API reference).\n\nBellow i attached work which i did\n\n public class DataModel\n {\n public string grant_type { get; set; }\n public string client_id { get; set; }\n public string client_secret { get; set; }\n }\n static void Main(string[] args)\n {\n\n try\n {\n DataModel dm = new DataModel();\n dm.grant_type = \"client_credentials\";\n dm.client_id = \"ruban123\";\n dm.client_secret = \"123456\";\n\n var credentials = dm.grant_type + dm.client_id + dm.client_secret;\n\n #region Http Post\n string messageUri = \"https://sampleurl.apivision.com:8493/abc/oauth/token\";\n HttpWebRequest request = (HttpWebRequest)WebRequest.Create(messageUri);\n request.Headers.Add(\"Authorization\", \"Basic \" + credentials);\n request.ContentType = \"application/json\";\n request.Method = \"POST\";\n using (var streamWriter = new StreamWriter(request.GetRequestStream()))\n {\n string jsonModel = Newtonsoft.Json.JsonConvert.SerializeObject(dm);\n streamWriter.Write(jsonModel);\n streamWriter.Flush();\n streamWriter.Close();\n }\n HttpWebResponse response = (HttpWebResponse)request.GetResponse();\n\n Stream responseStream = response.GetResponseStream();\n\n string jsonString = null;\n\n using (StreamReader reader = new StreamReader(responseStream))\n {\n jsonString = reader.ReadToEnd();\n Console.WriteLine();\n reader.Close();\n }\n\n #endregion Http Post\n }\n\n catch (Exception ex)\n {\n }\n }[API REFERENCE][1]" ]
[ "c#", "api", "integration", "httpwebresponse" ]
[ "Sort SQL JOIN results in PHP arrays", "I got 2 relational tables:\n\ntable \"categories\"\nid int(11)\ntitle varchar(255)\n\ntable \"posts\"\nid int(11)\ntitle varhcar(255)\ncategory_id int(11) // foreign key\n\n\nIf I select the \"categories\" table, I would like to get a PHP array with al the categories (as in \"SELECT * categories\") but including an inner array with all its posts:\n\nArray (\n /* first category */\n [0] = Array (\n [id] => 1\n [title] => \"Rock\"\n /* all its posts */\n [posts] => Array (\n [0] = Array(\n [id] = 100\n [title] = \"Rock post title\"\n [category_id] = 1\n )\n [1] = Array(\n [id] = 101\n [title] = \"Other rock post title\"\n [category_id] = 1\n )\n )\n /* second category */\n [1] = Array (\n )\n/* ... */\n)\n\n\nIf I just made a \"join\" query I get all the results combined, something like:\n\nid title id title category_id\n1 Rock 100 \"Rock post title\" 1\n2 Rock 101 \"Other rock post\" 1\n3 Rock 102 \"Final rock post\" 1\n\n\nI don't want to make multiple queries, because I think is inefficient. \n\nIs there anyway to achive the desire result with one query? \n\nI know CakePHP manage to return relational tables results in this format, so I'm looking to achieve the same result." ]
[ "php", "mysql", "join", "multidimensional-array" ]
[ "Hourly cronjob unwanted skips", "I have a cronjob that is scheduled hourly to execute a php file. It normally works without issue but sometimes it skips hours randomly. This morning it did this:\n\n[03-Aug-2015 00:00:02 America/Denver] runHourly triggered\n[03-Aug-2015 01:00:03 America/Denver] runHourly triggered\n[03-Aug-2015 02:00:02 America/Denver] runHourly triggered\n[03-Aug-2015 05:02:25 America/Denver] runHourly triggered\n\n\nIt's never skipped 3 hours in a row before...\n\nI don't have access to check any cronjob logs because I'm using my shared hosting panel to setup the job.\n\nI've entered a support ticket for the issue but is there something else I could do in order to ensure it's run every hour? Are there alternatives to cronjobs? What would cause this?" ]
[ "php", "cron" ]
[ "mysql query to find every occurrence of a non-ascii character in a table column and replace it with its HTML equivalent", "I have a column that contains HTML strings and has characters like ® and ™ in it. I want to replace all such characters with their HTML equivalent. Is this possible?" ]
[ "sql", "mysql", "non-ascii-characters" ]
[ "questions on ObjectBox data model rename", "Say I want to rename property "user" to "customer". I understand that I can add @Uid of "user" at the new property name. Like:\n@Uid(123985252953064306)\nString customer;\n\nSo I presume during the next build and run of my app, "user" in the database is renamed to "customer". My first questions are: can I then remove @Uid(123985252953064306) from my code for further builds? I guess the answer is yes if the app is only used by myself? So to maintain compatibility for endusers of the app, I still need to keep the @Uid annotation in the code. Is it correct?\nMy next question is: what if later I want to rename "customer" to "client"? Should I add an additional @Uid at the new property? Like:\n@Uid(123985252953064306)\n@Uid(124568645726267383)\nString client;" ]
[ "migration", "database-migration", "objectbox" ]
[ "Is there a way to accept multiple arities of callback in Rust?", "I'm trying to implement syntax sugar for my library so that someone can write .render(|image| { … }) instead of .render(|(), image| { … }) if they have no interesting state management going on. I thought I would be able to do this by implementing a trait for all FnMut(&State, &Image), and having a unit implementation for FnMut(&Image). Unfortunately, I get \"conflicting implementation\" errors when I try to implement this, because there's no reason something can't implement both of those FnMut traits.\n\nMy current attempt looks like this:\n\ntrait RenderCallback<State> {\n fn render(&mut self, state: &mut State, image: &mut Image);\n}\n\nimpl<F, State> RenderCallback<State> for F\nwhere\n F: FnMut(&mut State, &mut Image),\n{\n fn render(&mut self, state: &mut State, image: &mut Image) {\n self(state, image)\n }\n}\n\nimpl<F> RenderCallback<()> for F\nwhere\n F: FnMut(&mut Image),\n{\n fn render(&mut self, state: &mut State, image: &mut Image) {\n self(&mut (), image)\n }\n}\n\n\nIs there some way to achieve this effect?" ]
[ "types", "rust" ]
[ "PostgreSQL: Save query results to file and get number of saved rows, windows/odbc", "I am trying to save query results to text file automatically, without looping through reader object in VB.NET with using ODBC windows connection.\nBut I can't find how!\n\nThat's what I try so far:\n\nmCmd = New OdbcCommand( _\n\"SELECT my_id FROM \" & myTable & \" WHERE myflag='1' \\o 'c:/a_result.txt'\", mCon)\nn = mCmd.ExecuteNonQuery\n\n\nBut that don't work at all.\nPlease advice or code example how to get it.\n\nAnd second...\nIt will be ideally that with saving results to text I get a number of saved rows in variable 'n'.\nAs for now I get only 0 or 1 depends if query was successful or not.\n\nEDIT:\nAfter some fighting I found a way for do this with more or less success.\nTo txt file:\n\nmCmd = New OdbcCommand( _\n\"COPY (SELECT my_id FROM \" & myTable & \" WHERE myFlag='1' \" & _\n\"ORDER BY my_id) TO 'c:/a_result.txt' DELIMITER AS '|'\", mCon)\n\n\nTo csv file:\n\nmCmd = New OdbcCommand( _\n\"COPY (SELECT my_id FROM \" & myTable & \" WHERE myFlag='1' \" & _\n\"ORDER BY my_id) TO 'c:/a_result.csv' WITH CSV\", mCon)\n\n\nThat works, but I am not able to escape quotes and '\\' so I got double signs in output file.\nIf someone with experience know how to achieve escaping and changing delimiter for csv files I would be glad to see it on given example.\n\nVariable 'n' after query contain a number of exported rows." ]
[ "postgresql" ]
[ "Acumatica -Sales Order - Prevent Automatic Updating of Fields When Changing Customer", "I was wondering if anyone knew of a way to prevent certain fields from updating with default/stored data when updating the Customer field on the Sales Order page under a certain condition.\n\nMy Goal: When on the Sales Order page, if a certain Order Type is selected (in this case, the order type that signifies it is a Sales Order created and sent from our website), changing the Customer Field does not update/overwrite the Financial Settings or the Shipping Settings. This is because the Financial and Shipping settings fields are populated and sent from the website, and may have more specific information than the stored Customer information.\n\nI want to keep the loading of default data for other tabs/fields, but keep the customer-entered billing and shipping info." ]
[ "acumatica" ]
[ "Replace wrong xml-comments with Regex", "I am dealing with a bunch of xml files that contain one-line-comments like this: // Some comment.\nI am pretty sure that xml comments look like this: <!-- Some comment --> \nI would like to use a regular expression in the Atom editor to find and replace all wrong comment syntax.\n\naccording to this question, the comment can be found with (?<=\\s)//([^\\n\\r]*) and replaced with something like <!--$1-->. There must be an error somewhere since clicking replace button leaves the comment as is, instaed of replacing it. Actually I can't even replace it with a simple character.\nThe find and replace works with a different regex in the \"Find\" field:\nFind: name.*\nReplace: baloon \n\nIs there anything I can write in the \"Find\" and \"Replace\" field to achieve this transformation?" ]
[ "regex" ]
[ "How do __builtin_ia32_unpcklps/hps and __builtin_ia32_movlhps/hlps work?", "I am looking optimized ways to do matrix transpose on CPU only with a known cache set number and block size. I found that the Intel intrinsic functions contained a low-level transpose of a 4x4 matrix. As follows:\n\n#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \\\ndo { \\\n __v4sf __r0 = (row0), __r1 = (row1), __r2 = (row2), __r3 = (row3); \\\n __v4sf __t0 = __builtin_ia32_unpcklps (__r0, __r1); \\\n __v4sf __t1 = __builtin_ia32_unpcklps (__r2, __r3); \\\n __v4sf __t2 = __builtin_ia32_unpckhps (__r0, __r1); \\\n __v4sf __t3 = __builtin_ia32_unpckhps (__r2, __r3); \\\n (row0) = __builtin_ia32_movlhps (__t0, __t1); \\\n (row1) = __builtin_ia32_movhlps (__t1, __t0); \\\n (row2) = __builtin_ia32_movlhps (__t2, __t3); \\\n (row3) = __builtin_ia32_movhlps (__t3, __t2); \\\n} while (0)\n\n\n\nThe functions its using are built-in GCC compiler functions which use the UNPCKHPS/LPS and MOVLHPS/HLPS x86 assembly commands. That I understand and I roughly understand how those commands would work together to transpose the 4 rows.\n\nHowever, I wanted to test these functions and so I copy this into my code and edited it slightly.\n\nI found that simiply subsituting the function into the arguments with out using a temporary varible broke the function. Here is an example of that:\n\n#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \\\ndo { \\\n __v4sf __r0 = (row0), __r1 = (row1), __r2 = (row2), __r3 = (row3); \\\n __v4sf __t1 = __builtin_ia32_unpcklps (__r2, __r3); \\\n __v4sf __t2 = __builtin_ia32_unpckhps (__r0, __r1); \\\n __v4sf __t3 = __builtin_ia32_unpckhps (__r2, __r3); \\\n (row0) = __builtin_ia32_movlhps (__builtin_ia32_unpcklps (__r0, __r1), __t1); \\\n (row1) = __builtin_ia32_movhlps (__t1, __builtin_ia32_unpcklps (__r0, __r1)); \\\n (row2) = __builtin_ia32_movlhps (__t2, __t3); \\\n (row3) = __builtin_ia32_movhlps (__t3, __t2); \\\n} while (0)\n\n\n\nDoes anyone know why this would happen? Normally, if you change the order of function calls (assuming that they aren't operating on the same pointer) cannot effect execution." ]
[ "c", "gcc", "assembly", "sse", "built-in" ]
[ "Creating a recursive function which outputs a different datatype and can use it on each call?", "I have a template class, as below:\n\npublic class Collections<T, U>\n {\n public Dictionary<T,U> collection;\n public Collections()\n {\n collection = new Dictionary<T,U>();\n }\n }\n\n\nMy data structure contains a number of collections, which are then collections of them selves such as:\n\nShareCollection = Collections<int, SiteCollection>\nSiteCollection = Collections<int, WebCollection>\nWebCollection = Collections<int, ListCollection>\nListCollection = Collections<int, ItemCollection>\nItemCollection = Collection<int, string>\n\n\nIn my actual code, I then call a function which takes the top level collection as an input argument, does something with this collections first value, then calls a second function with the argument as the second collection:\n\nvoid ShareCollectionIterator(ShareCollection s)\n{\n //Code\n SiteCollections si = ShareCollection[SiteGuid];\n SiteCollectionIterator(SiteCollection si)\n}\n\nvoid SiteCollectionIterator(SiteCollection si)\n{\n //Code\n WebCollectionIterator w = SiteCollection [WebGuid];\n WebCollectionIterator(w)\n}\n\nvoid WebCollectionIterator(WebCollection w)\n...\n\n\nAnd so on until it has gone through each of the collections. I have therefore made 6 functions where the basics of the code is the same. Is there a way I can change this so the code is only written out once and can just call itself at the end and pass in the next collection? \nI tried to make and enumerator then at a counter in the function, but I couldn't get the enumerator to act as a classname. Any help would be greatly appreciated." ]
[ "c#", "templates", "recursion" ]
[ "Which encryption password does cryptography.fernet uses?", "I am making a program which encrypts and decrypts texts. I am using Python 3.7 and cryptography.fernet library. Also I want to enter some information about encryption. But I didn't understand which encryption does Fernet uses.\nHere is my sample code which I am used in my project. I want to encrypt with 256-bit (AES-256) key but the key which this code generates is longer than 32 characters. It's 44 characters. But in official web site of cryptography library it says this code generates 128-bit key. What is the name of this 44 character (352-bit) key? Or is there any way for 256-bit symmetric encryption without PyCrypto?\nif __import__("sys").version_info.major == 2:\n from Tkinter import *\n from Tkinter import messagebox\n from Tkinter import ttk\n from Tkinter.ttk import *\nelse:\n from tkinter import *\n from tkinter import messagebox\n from tkinter import ttk\n from tkinter.ttk import *\nfrom cryptography.fernet import Fernet\nfrom platform import release\nimport pyperclip\nimport os\nimport base64\nfrom cryptography.hazmat.primitives import hashes\nfrom cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC\nimport time\nfrom datetime import datetime\nimport sys, os, traceback, types\n\ntextEncrypt = "Secret Data"\npassword = "Password"\nsalt = os.urandom(16)\nkdf = PBKDF2HMAC(algorithm=hashes.SHA256(),length=32,salt=salt,iterations=100000)\nkey = base64.urlsafe_b64encode(kdf.derive(password))\nfernet = Fernet(key)\nencryptedText = fernet.encrypt(textEncrypt.encode())\n\nHere is the key which this code generates: aAT_LESBw_ZGlPA52cj4zQd6jBdx6gk5RmQWbpLY7e0=" ]
[ "python-3.x", "encryption", "python-cryptography", "fernet" ]
[ "Custom annotation in MapKit", "I have an application that displays events on a map. Map annotations should be custom set with two images. The first one is a pin with a specific color and the second one, which goes in front of the pin is the icon of represents the type of event. Can I add two images to a view and display that view in place of the default pin? Or do I have to generate an image for each of the possibilities?" ]
[ "ios", "mapkit" ]
[ "More appropriate solution than a nested dictionary?", "I'm struggling with my app, which handles bus routes. I get, at a every single bus stop, every future departure of the busses leaving from there, the departure includes direction and time of departure. I want to be able to get all the times a bus leaves in a given direction, I've done it so far by creating a nested dictionary, however, I was wondering if you can do it smarter? This is what I got so far\n\nvar dict = [String: [String : [String]]]()\n\n\nSo it would be something like:\n\nvar dict = [\"Busname\": [\"Direction\" : [\"time1\", \"time2\", \"time3\"]]]()\n\n\nIs there a smarter way? Or is this the way to go? I want to get a list of times of departures of the given bus with the given direction." ]
[ "swift", "dictionary" ]
[ "WP7 7.1 (Mango) Database Versioning", "I have a class structure that's saved to the local SQL DB on the phone. In the next version of the app, the class structure has changed.\n\nHow does the SQL DB deserialize the data into the changed objects/structure?" ]
[ "database", "windows-phone-7" ]
[ "No longer able to execute python code in Vscode", "Suddenly vsCode on Mac Mojave stopped running any python code.\nrunning a simple print(1) produces the following error:\n\n\n cd /Users/sammy/Code/python/Socratica ; env \"PYTHONIOENCODING=UTF-8\"\n \"PYTHONUNBUFFERED=1\" python\n /Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/ptvsd_launcher.py\n --default --client --host localhost --port 49677 /Users/sammy/Code/python/Socratica/lambda1.py 1\n \n Traceback (most recent call last): File\n \"/Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/ptvsd_launcher.py\",\n line 45, in \n main(ptvsdArgs)\n \n File\n \"/Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/main.py\",\n line 265, in main\n wait=args.wait)\n \n File\n \"/Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/main.py\",\n line 258, in handle_args\n debug_main(addr, name, kind, *extra, **kwargs)\n \n File\n \"/Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/_local.py\",\n line 45, in debug_main\n run_file(address, name, *extra, **kwargs)\n \n File\n \"/Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/_local.py\",\n line 79, in run_file\n run(argv, addr, **kwargs)\n \n File\n \"/Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/_local.py\",\n line 140, in _run\n _pydevd.main()\n \n File\n \"/Users/sammy/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevd.py\",\n line 1936, in main\n if setup['cmd-line']: TypeError: 'NoneType' object is not callable\n\n\nI am using the first option this launch.json file\n\n{\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \"Python: Current File (Integrated Terminal)\",\n \"type\": \"python\",\n \"request\": \"launch\",\n \"program\": \"${file}\",\n \"console\": \"integratedTerminal\"\n },\n {\n \"name\": \"Python: Attach\",\n \"type\": \"python\",\n \"request\": \"attach\",\n \"port\": 5678,\n \"host\": \"localhost\"\n },\n {\n \"name\": \"Python: Module\",\n \"type\": \"python\",\n \"request\": \"launch\",\n \"module\": \"enter-your-module-name-here\",\n \"console\": \"integratedTerminal\"\n },\n {\n \"name\": \"Python: Django\",\n \"type\": \"python\",\n \"request\": \"launch\",\n \"program\": \"${workspaceFolder}/manage.py\",\n \"console\": \"integratedTerminal\",\n \"args\": [\n \"runserver\",\n \"--noreload\",\n \"--nothreading\"\n ],\n \"django\": true\n },\n {\n \"name\": \"Python: Flask\",\n \"type\": \"python\",\n \"request\": \"launch\",\n \"module\": \"flask\",\n \"env\": {\n \"FLASK_APP\": \"app.py\"\n },\n \"args\": [\n \"run\",\n \"--no-debugger\",\n \"--no-reload\"\n ],\n \"jinja\": true\n },\n {\n \"name\": \"Python: Current File (External Terminal)\",\n \"type\": \"python\",\n \"request\": \"launch\",\n \"program\": \"${file}\",\n \"console\": \"externalTerminal\"\n }\n ]\n}\n\n\nI removed the python extension and reinstalled it but that didn't help.\nThanks" ]
[ "python-3.x", "visual-studio-code" ]
[ "Json schema validation in soapUI using groovy", "I have encountered the problem with the Json response validation in soapUI. I have service, that returns json responses, I hve schema for this service. \n1. Can I use the Json schema in soapUI? If yes, then how? (All my attempts to configure it was failed)\n2. Can I perform validation using the groovy scripts? I have found several possible solutions in internet (gitHub), but I got the errors when try to run the scripts.\n\nSuch scripts as:\n1.\ndef json = new JsonSlurper().parseText(\"\"\"\\\n {\n \"givenName\" : \"Alexander\",\n \"familyName\" : \"De Leon\"\n }\n \"\"\")\n\nuse(JsonSchema){\n json.schema = 'http://json-schema.org/card'\n assert json.conformsSchema()\n}\n\n\ndouesn't work. I am getting the error: No such property JsonSchema for class.\n\n\n\nUsing the scripts as described here, gives also no results: http://forum.soapui.org/viewtopic.php?f=5&t=24829&p=57104&hilit=schema&sid=695d82ac14104f727529196faecca2e4#p57104\n\n\nError: groovy.lang.MissingMethodException: No signature of method: Script29.eval()\n\nIf some one performs validation of Json responses in soapUI using groovy, or any other approaches, then could you please share your experience?\n\nThanks!" ]
[ "json", "groovy", "soapui", "jsonschema" ]
[ "ImageButtons being squished when my drag and drop ImageButton is moved", "So I have 4 normal imagebuttons that I have set up and then a 5th imagebutton that is a drag and drop. I want the 4 non drag and drop imagebuttons to stay in a particular spot no matter what happens with the imagebutton that is drag and drop. When I move my drag and drop imagebutton, the other imagebuttons get moved and are being squished also. \n\nAny idea how I can move this drag and drop imagebutton without affecting the other imagebuttons in any way? \n\nHere is my xml:\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:id=\"@+id/gllayout\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\"\n android:orientation=\"vertical\" \n android:background=\"@drawable/mars\" >\n\n<TextView\n android:id=\"@+id/scores\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\" />\n\n<ImageButton\n android:id=\"@+id/mainHut\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:background=\"@drawable/mainhut\" />\n\n<ImageButton \n android:id=\"@+id/polarCapButton1\"\n android:orientation=\"vertical\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:background=\"@drawable/polarcap\" />\n\n<ImageButton \n android:id=\"@+id/polarCapButton2\"\n android:layout_marginTop=\"-70dp\"\n android:layout_marginLeft=\"575dp\"\n android:orientation=\"vertical\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:background=\"@drawable/polarcap\" />\n\n<ImageButton \n android:id=\"@+id/spaceRockButton1\"\n android:layout_marginTop=\"100dp\"\n android:orientation=\"vertical\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:background=\"@drawable/spacerock\" />\n\n<ImageButton \n android:id=\"@+id/spaceRockButton2\"\n android:layout_marginTop=\"-140dp\"\n android:layout_marginLeft=\"520dp\"\n android:orientation=\"vertical\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:background=\"@drawable/spacerock\" />\n\n<ImageButton\n android:id=\"@+id/meteor\"\n android:visibility=\"invisible\"\n android:orientation=\"vertical\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:background=\"@drawable/meteor\" \n android:layout_marginTop=\"-100dp\"\n android:layout_marginLeft=\"400dp\" />\n\n</LinearLayout>\n\n\nHere is the code for my drag and drop imagebutton:\n\n mainHut = (ImageButton) findViewById(R.id.mainHut);\n mainHut.setOnTouchListener(new OnTouchListener()\n {\n @Override\n public boolean onTouch(View v, MotionEvent event) \n {\n if (event.getAction() == MotionEvent.ACTION_DOWN)\n {\n mainHutSelected = true;\n }//end if\n\n if (event.getAction() == MotionEvent.ACTION_UP)\n {\n if (mainHutSelected == true)\n {\n mainHutSelected = false;\n }//end if\n }//end if\n else if (event.getAction() == MotionEvent.ACTION_MOVE)\n {\n if (mainHutSelected == true)\n {\n LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(v.getWidth(), v.getHeight());\n params.setMargins((int)(event.getRawX() - event.getRawY() / 2), (int) (event.getRawY() - v.getHeight() * 1.5), (int) (event.getRawX() - v.getWidth() / 2), (int) (event.getRawY() - v.getHeight() * 1.5));\n v.setLayoutParams(params);\n }//end if\n }//end else\n\n return false;\n }//end onTouch function\n\n });//end setOnClickListener\n\n\nThanks in advance for the help." ]
[ "java", "android", "mobile", "drag-and-drop", "imagebutton" ]
[ "Optimal setting for socket send buffer for sending image files on Netty", "I'm looking into implementing a HTTP image server in Netty and I was wondering what the optimal Send Buffer Size should be:\n\nie. bootstrap.setOption(\"sendBufferSize\", 1048576);\n\n\nI've read How to write a high performance Netty Client but I was wondering what are the consequences of setting this value too small or too large.\n\nThe images I serve are mostly around 100K to 5MB (avg 1MB). I'm thinking a large (1MB) value would cause the OS memory to be filled with TCP buffered data but is there a performance penalty of setting it to a small value (ie. 8192KB)?" ]
[ "sockets", "tcp", "netty" ]
[ "Jquery with arrow function", "I apologise if this is a duplicate. Im a little confused as to what the difference is with this \n\n$('.child_panel').on('click', () => {\n console.log(this);\n});\n\n\nand with this\n\n$('.child_panel').on('click', function() {\n console.log(this);\n });\n\n\nTo it seems that the binding to of the context to this is only occurring in the second case and not the first. Can someone please explain what the difference is and what the proper way to do it would be in the case of the arrow function.\n\nThanks!" ]
[ "javascript", "jquery" ]
[ "Bootstrap3 affix navbar below 100% width image scrolls up then returns to original position", "I have the affix set on a navbar below a full width hero image, the desired result is the navbar scrolls up and as soon as it touches the top of the page it sticks. \nThe problem is, the image height is dynamic, it's a full width image, so I can't set a fixed pixel height for the offset. I'm using jquery to set the offset based on the navbar position but the navbar jumps back down to it's original position as soon as it gets to the top. \n\nThis CSS should position my navbar when .affix is applied\n\n#navbar-wrapper.affix {\ntop: 0px;\nposition: fixed;\nwidth: 100%;\n}\n\n\nThis is the jQuery to generate the affix\n\n$(function() {\n $('#navbar-wrapper').height($(\"#nav\").height());\n});\n\n$('#nav').affix({\n offset: $('#nav').position()\n});\n\n\nHere is a jsfiddle:\nhttp://jsfiddle.net/MarkMarine/q3J56/4/\n\nI did some editing per the response below (and tweaked it a little)\nThe fix for me was selecting the height of the .hero-image class for the affix offset, not the position of the navbar.\n\n$('#navbar-wrapper').affix({\noffset: {\n top: $('.hero-image').height()\n }\n});\n\n\nThank you!!!\nupdated jsfiddle for posterity\n\nhttp://jsfiddle.net/MarkMarine/q3J56/7/" ]
[ "jquery", "twitter-bootstrap-3", "affix" ]
[ "Null reference exception while iterating over a list of StreamReader objects", "I am making a simple Program which searches for a particular Name in a set of files.I have around 23 files to go through. To achieve this I am using StreamReader class, therefore, to write less of code, I have made a \n\nList<StreamReader> FileList = new List<StreamReader>();\n\n\nlist containing elements of type StreamReader and my plan is to iterate over the list and open each file:\n\nforeach(StreamReader Element in FileList)\n{\n while (!Element.EndOfStream)\n {\n // Code to process the file here.\n }\n}\n\n\nI have opened all of the streams in the FileList.The problem is that I am getting a \n\n\n Null Reference Exception \n\n\nat the condition in the while loop.\n\nCan anybody tell me what mistake I am doing here and why I am getting this exception and what are the steps I can take to correct this problem?" ]
[ "c#", ".net", "file-io", "nullreferenceexception", "streamreader" ]
[ "Cancel/Force Stop an Input and Output stream executed through SwingWorker", "I wanted to stop the Input and Output stream executed through SwingWorker doInBackground. Whenever I cancel the task, it's still create the file (see the code below). The task is simple, \"for every file name (a String) specified, output this file with the given name\" (something like that).\n\nI wrote the IO stream in a separate package/class. So the code is like:\n\npublic class ResourceFileExtract(String outputFile) {\n InputStream inputStream = null;\n OutputStream outputStream = null;\n try {\n inputStream = getClass().getResourceAsStream(\"/resources/someFile\");\n outputStream = new FileOutputStream(outputFile);\n byte[] bytes = new byte[1024];\n int numbers;\n while ((numbers = inputStream.read(bytes)) > 1) {\n outputStream.write(bytes, 0, length)\n }\n outputStream.flush();\n outputStream.close();\n inputStream.close();\n } /* Other codes here */\n}\n\n\nThe SwingWorker setup.\n\nprivate class BackgroundTask extends SwingWorker<Integer, String> {\n @Override\n protected Integer doInBackground() {\n /* Some codes here */\n if (!isCancelled()) {\n for (/* Loop statement */) {\n try {\n // Input and Output stream called from a class...\n ResourceFileExtract fileExtract = new ResourceFileExtract(specifiedOutputName);\n System.out.println(\"Done (file extracted successfully)\");\n } catch (IOException ex) {\n System.out.println(\"Error (unable to read resource file)\");\n return 0;\n }\n }\n } else {\n // These texts are not printed in console...\n System.out.println(\"Cancelled (I/O streaming stopped)\");\n return 0;\n }\n return 0;\n }\n}\n\n\nSwingWorker executed with:\n\nJButton start = new JButton(\"Start\");\nstart.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent evt) {\n BackgroundTask bgTask = new BackgroundTask();\n bgTask.execute();\n }\n});\n\n\nAnd cancelled with:\n\nJButton stop = new JButton(\"Stop\");\nstop.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent evt) {\n bgTask.cancel(true);\n }\n});\n\n\nWhile debugging the program, the cancellation message is not printed in the console, meaning the task is not cancelled whenever I hit the cancel button and the output file still created with the success message. How can I stop this one? Any help?" ]
[ "java", "swingworker" ]
[ "Receive product groups and products with one query", "I have two tables:\n\nProduct\n------------------------------------\nid group_id name quick_select\n------------------------------------\n1 1 product1 1\n2 3 product2 0\n3 5 product3 1\n\nProduct_group\n-----------------------\nid name parent_id\n-----------------------\n1 group1 0\n2 group2 0\n3 group3 1\n4 group4 1\n5 group5 3\n\n\nI making a navigation system for quick select products. I show categories to user and user can navigate in them by clicking category button, then goes level down to subcategory and goes down so many levels that finally it can't go deeper - then I show products. First I show root categories where there's products under them and under those root categories subcategories, subsubcategories and so on. \n\nIn my query I want select all root categories (where parent_id=0), if there's products in them and in their subcategories and subsubcategories and so on, where quick_select must be 1 in product table. And I don't know the deepness of categories - how many levels there are.\n\nIs it possible with one query? Or do I need to do two queries?\n\nI made so far, with this query:\n\nSELECT pg.id, pg.name, pg.parent_id AS parent_id\nFROM product_group AS pg\nLEFT JOIN product AS p ON pg.id = p.group_id\nWHERE pg.parent_id = 0 AND p.id IS NOT NULL AND p.quick_select = 1\nGROUP BY pg.id\n\n\nBut I don't receive root categories which subcategory is empty, which subcategory is empty and under this is one more subcategory with products with quick_select=1.\n\nSorry for my bad english.\n\nI want to receive all categories where products with quick_select=1 are, not products\n\n-- Category\n| |\n| product\n|\n-- Category\n |\n Category\n |\n Category\n |\n multiple products" ]
[ "sql", "sqlite" ]
[ "Use Dism v10 of ADK on Srv2012r2 inside a script", "What I Want to achive: I want to update a batch of wim-files via a scheduled task. Therfore I mount the wims, add the update-packages and dismount the wims. So far no problem via the dism-module included in PoSh4 on Windowsserver 2012r2.\n\nProblem: \n\nThis does not work with wim-files of Windows 10, because the dism-version used via the module is lower (6.3.x) than the necessary version of the wim-image (10.x). \n\nWhat I tried:\n\n1) Remove the stock dism-module via remove-module dism and import the dism-module via Import-Module 'C:\\Program Files (x86)\\Windows Kits\\10\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM'. Running Get-WindowsEdition -Online -verbose still delivers dism version 6.3.x\n\n2) Use C:\\Program Files (x86)\\Windows Kits\\10\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM\\dism.exe in the script via $env:path or via -f and &. In the fist attempt, dism didnt get the arguments I tried to apply. In the second attempt, dism does not get recognized as a command.\n\nThere must be some thing I overlooked, but I cant figure it out.\n\nHow does the code need to look like? Args could be e.g.: \n\n$mountpath = 'd:\\autoupdating' \n$package = 'D:\\updates\\whatever.cab' \n$dismcommands = \"/image:$mountpath /add-package /packagepath:$package \n\nSolution:\n\nPoSh or DISM has heavy problems when getting $dismcommands like I wanted it. DISM does not recognize the string as available commands. You can bypass this easiely by going\nDISM.exe \"/image:$mountpath /add-package /packagepath:$package\" which works without a problem.\nFurthermore you need to modify the $env:Path variable to target C:\\Program Files (x86)\\Windows Kits\\10\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM\\. I've done this by backing up $env:Path, resetting it and restoring it after I finished working on an WIn10.wim." ]
[ "powershell", "dism" ]
[ "subset rows + context", "I haven't been able to figure out an easy way to include some context ( n adjacent rows ) around the rows I want to select.\nI am more or less trying to mirror the -C option of grep to select some rows of a data.frame.\n\nEx: \n\na= data.frame(seq(1:100)) \nb = c(50, 60, 61)\n\n\nLet's say I want a context of 2 lines around the rows indexed in b; the desired output should be the data frame subset of a with the rows 48,49,50,51,52,58,59,60,61,62,63" ]
[ "r", "subset" ]
[ "Android NDK - Android studio gradle undefined reference to __android_log_write", "I am trying to debug a JNI C function by inserting log messages, but I can't get it to work. To start with I am just trying to modify the hello-jni example that comes with Android Studio. This is the modified code:\n\n#include <string.h>\n#include <jni.h>\n#include <android/log.h>\n\njstring\nJava_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,\n jobject thiz )\n{\n#if defined(__arm__)\n #if defined(__ARM_ARCH_7A__)\n #if defined(__ARM_NEON__)\n #if defined(__ARM_PCS_VFP)\n #define ABI \"armeabi-v7a/NEON (hard-float)\"\n #else\n #define ABI \"armeabi-v7a/NEON\"\n #endif\n #else\n #if defined(__ARM_PCS_VFP)\n #define ABI \"armeabi-v7a (hard-float)\"\n #else\n #define ABI \"armeabi-v7a\"\n #endif\n #endif\n #else\n #define ABI \"armeabi\"\n #endif\n#elif defined(__i386__)\n #define ABI \"x86\"\n#elif defined(__x86_64__)\n #define ABI \"x86_64\"\n#elif defined(__mips64) /* mips64el-* toolchain defines __mips__ too */\n #define ABI \"mips64\"\n#elif defined(__mips__)\n #define ABI \"mips\"\n#elif defined(__aarch64__)\n #define ABI \"arm64-v8a\"\n#else\n #define ABI \"unknown\"\n#endif\n\n __android_log_write(ANDROID_LOG_ERROR, \"TEST_TAG\", \"Error here\");\n\n return (*env)->NewStringUTF(env, \"Hello from JNI ! Compiled with ABI \" ABI \".\");\n}\n\n\nAnd this is my Android.mk file:\n\nLOCAL_PATH := $(call my-dir)\n\ninclude $(CLEAR_VARS)\n\nLOCAL_MODULE := hello-jni\nLOCAL_SRC_FILES := hello-jni.c\nLOCAL_LDFLAGS := -llog\n\ninclude $(BUILD_SHARED_LIBRARY)\n\n\nWhen I use the ndk-build script the libhello-jni.so files get built no problem. When I try to build the project in Android Studio I get the following gradle error message\n\nInformation:Gradle tasks [:app:assembleDebug]\n:app:preBuild\n:app:compileDebugNdk\nC:\\Android\\projects\\hello-jni\\app\\build\\intermediates\\ndk\\debug\\obj/local/arm64-v8a/objs/hello-jni/C_\\Android\\projects\\hello-jni\\app\\src\\main\\jni\\hello-jni.o: In function `Java_com_example_hellojni_HelloJni_stringFromJNI':\nhello-jni.c:(.text.Java_com_example_hellojni_HelloJni_stringFromJNI+0x24): undefined reference to `__android_log_write'\nError:error: ld returned 1 exit status\nmake.exe: *** [C:\\Android\\projects\\hello-jni\\app\\build\\intermediates\\ndk\\debug\\obj/local/arm64-v8a/libhello-jni.so] Error 1\nError:Execution failed for task ':app:compileDebugNdk'.\n> com.android.ide.common.internal.LoggedErrorException: Failed to run command:\nC:\\Android\\android-ndk-r10c\\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\\Android\\projects\\hello-jni\\app\\build\\intermediates\\ndk\\debug\\Android.mk APP_PLATFORM=android-19 NDK_OUT=C:\\Android\\projects\\hello-jni\\app\\build\\intermediates\\ndk\\debug\\obj NDK_LIBS_OUT=C:\\Android\\projects\\hello-jni\\app\\build\\intermediates\\ndk\\debug\\lib APP_ABI=all\nError Code:\n2\nOutput:\nC:\\Android\\projects\\hello-jni\\app\\build\\intermediates\\ndk\\debug\\obj/local/arm64-v8a/objs/hello-jni/C_\\Android\\projects\\hello-jni\\app\\src\\main\\jni\\hello-jni.o: In function `Java_com_example_hellojni_HelloJni_stringFromJNI':\nhello-jni.c:(.text.Java_com_example_hellojni_HelloJni_stringFromJNI+0x24): undefined reference to `__android_log_write'\ncollect2.exe: error: ld returned 1 exit status\nmake.exe: *** [C:\\Android\\projects\\hello-jni\\app\\build\\intermediates\\ndk\\debug\\obj/local/arm64-v8a/libhello-jni.so] Error 1\nInformation:BUILD FAILED\nInformation:Total time: 3.297 secs\nInformation:2 errors\nInformation:0 warnings\nInformation:See complete output in console\n\n\nI've tried the suggestions given in this question, but I still get the same error: What is the Log API to call from an Android JNI program?\n\nWhat am I doing wrong?\n\nI'm using Android Studio 0.8.9 and NDK r10c." ]
[ "android-studio", "gradle", "android-ndk", "linker-errors", "android.mk" ]
[ "How to loop through webdriverjs elements until element has text value", "I am trying to work out how looping in WebDriverJs works with promises.\n\nSay you had the following html:\n\n <div id=\"textelements\">\n <span onclick=\"spanClicked('Rock')\">Rock</span>\n <span onclick=\"spanClicked('Paper')\">Paper</span>\n <span onclick=\"spanClicked('Scissors')\">Scissors</span>\n </div>\n\n\nUsing WebDriverJs I wanted to find the span with text 'Scissors' and click it.\n\nThe easiest thing would be to make sure the source html had appropriate identifiers, but say that couldn't be changed, what would the WebDriverJs code look like given the html above.\n\nI have tried the following:\n\nfunction clickElementWithText(driver, textValue) {\n driver.findElements(webdriver.By.css('#textelements span')).then(function(spans) {\n for (var i = 0; i < spans.length; i++) {\n var matched = spans[i].getText().then(function(text) {\n console.log('Text value is: ' + text);\n return text === textValue;\n });\n console.log(matched);\n if (matched === true) {\n console.log('clicking!');\n spans[i].click();\n return;\n }\n }\n });\n}\n\nvar webdriver = require('selenium-webdriver');\nvar driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();\ndriver.get('http://webdriverjsdemo.github.io/');\nclickElementWithText(driver, 'Scissors');\n\n\nThe issue is that matched doesn't equal true when being evaluated even though it should have been set to true.\n\nAny ideas what is happening?" ]
[ "javascript", "selenium", "webdriverjs" ]
[ "How to highlight every second row of listview?", "Is it possible to highlight every second row in list view with some color? For example I have a listview with data from data table, bound to it. So I want to leave the first row background to be white and then second to be blue (for example), then the third would be white, the fourth blue again and so on. Also I would like this effect to continue automatically when I add new items to list view." ]
[ "c#", "wpf", "listview", "listviewitem" ]
[ "How to load edit fields from another view in MVC", "I'm working on simple practice web app with 2 models: Company & Customer - both have their own views. In the Edit view for Company, I want to load the edit form from the Customer view so the user can update Company & Customer at once. \n\nThe Company/Edit view displays a list of customers (I loaded customers data using a view model for Company & Customer). There's an \"Edit\" icon next to each customer's name in the 'customer-info' div. Clicking the button will load editor forms from the Customers/Edit view onto the Company/Edit view. \n\nAm I structuring this correctly or is there a better way to combine both model's data so that the user can edit them simultaneously? \n\nNote: I am using MVC Entity Framework Core & Visual Studio 2017 to build this app." ]
[ "c#", "asp.net-mvc", "visual-studio", "entity-framework", "visual-studio-2017" ]
[ "Error: [$injector:unpr] Unknown provider: RequestsServiceProvider <- RequestsService http://errors.angularjs.org/1.3.13/", "I am getting above error In spite of defining my service name to all necessarily palaces.\n\nhere is my app.js \n\n\r\n\r\nvar app = angular.module('ionicApp', [ 'ionic', 'ngCordova', 'checklist-model' ])\r\n\r\napp.config(function($stateProvider, $urlRouterProvider) {\r\n });\r\n\r\napp.run([\r\n '$rootScope',\r\n 'ngCart',\r\n 'ngCartItem',\r\n 'store',\r\n '$window',\r\n '$ionicPlatform',\r\n 'RequestsService',\r\n function($rootScope, ngCart, ngCartItem, store, $window,\r\n $ionicPlatform, RequestsService) {\r\n $ionicPlatform.ready(function() {\r\n\r\n pushNotification = window.plugins.pushNotification;\r\n window.onNotification = function(e) {\r\n\r\n console.log('notification received');\r\n\r\n switch (e.event) {\r\n case 'registered':\r\n if (e.regid.length &gt; 0) {\r\n var device_token = e.regid;\r\n alert(device_token);\r\n RequestsService.register(device_token).then(\r\n function(response) {\r\n alert(JSON.stringify(response));\r\n alert(\"register!\");\r\n });\r\n }\r\n break;\r\n case 'message':\r\n alert('msg received');\r\n alert(JSON.stringify(e));\r\n break;\r\n\r\n case 'error':\r\n alert('error occured');\r\n break;\r\n }\r\n };\r\n window.errorHandler = function(error) {\r\n alert('an error occured');\r\n }\r\n\r\n pushNotification.register(onNotification, errorHandler, {\r\n 'badge' : 'true',\r\n 'sound' : 'true',\r\n 'alert' : 'true',\r\n 'senderID' : 'your sender id',\r\n 'ecb' : 'onNotification'\r\n });\r\n\r\n });\r\n $rootScope.$cart = {\r\n items : []\r\n };\r\n if (angular.isObject(store.get('cart'))) {\r\n ngCart.$restore(store.get('cart'));\r\n } else {\r\n ngCart.init();\r\n }\r\n } ]);\r\n\r\n\r\n\n\nMy index.html :-\n\n\r\n\r\n&lt;html ng-app=\"ionicApp\"&gt;\r\n&lt;head&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=\"utf-8\"&gt;\r\n&lt;meta name=\"viewport\"\r\n content=\"initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width\"&gt;\r\n&lt;title&gt;App-name&lt;/title&gt;\r\n\r\n&lt;link href=\"lib/ionic/css/ionic.css\" rel=\"stylesheet\"&gt;\r\n&lt;link href=\"css/style.css\" rel=\"stylesheet\"&gt;\r\n&lt;script type=\"text/javascript\" charset=\"utf-8\"\r\n src=\"js/PushNotification.js\"&gt;&lt;/script&gt;\r\n \r\n&lt;script src=\"lib/ionic/js/ionic.bundle.js\"&gt;&lt;/script&gt;\r\n&lt;!-- cordova script (this will be a 404 during development) --&gt;\r\n&lt;script src=\"lib/ngCordova/dist/ng-cordova.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"js/ng-cordova.min.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"cordova.js\"&gt;&lt;/script&gt;\r\n&lt;!-- your app's js --&gt;\r\n&lt;script src=\"js/app.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"js/checklist-model.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"js/controllers.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"js/services.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"js/cart.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"js/RequestsService.js\"&gt;&lt;/script&gt;\r\n\r\n&lt;script src=\"js/angular-translate.min.js\"&gt;&lt;/script&gt;\r\n\r\n&lt;/head&gt;\r\n&lt;body ng-controller=\"MainCtrl\"&gt;\r\n\r\n &lt;ion-nav-view&gt;&lt;/ion-nav-view&gt;\r\n\r\n&lt;/body&gt;\r\n&lt;/html&gt;\r\n\r\n\r\n\n\nHere is my RequestsSerice.js :-\n\nhttp://piratepad.net/ep/pad/view/ro.B4M$J6oZcip/latest\n\nI would like to tell you that initially every thing was working fine but after updating cordova to latest version my app stops functioning.\n\nI have checked the spellings too , but still getting the above error while running the code." ]
[ "javascript", "angularjs" ]
[ "Abysmally slow performance of caret package, with multicore", "I am going through the book \"Applied Predictive Modeling\" by the author of the caret package.\n\nThe first example of a training on a svm takes hours to run on my 64 bit i7 16 GB xubuntu desktop [I gave up after 4 hours]. Since this is a \"toy\" dataset [800 rows, 42 variables], there sure must be a way to run this in a reasonable amount of time. \n\nlibrary(caret)\ndata(GermanCredit)\n\nlibrary(doMC)\nregisterDoMC(8)\n\nGermanCredit &lt;- GermanCredit[, -nearZeroVar(GermanCredit)]\nGermanCredit$CheckingAccountStatus.lt.0 &lt;- NULL\nGermanCredit$SavingsAccountBonds.lt.100 &lt;- NULL\nGermanCredit$EmploymentDuration.lt.1 &lt;- NULL\nGermanCredit$EmploymentDuration.Unemployed &lt;- NULL\nGermanCredit$Personal.Male.Married.Widowed &lt;- NULL\nGermanCredit$Property.Unknown &lt;- NULL\nGermanCredit$Housing.ForFree &lt;- NULL\n\n## Split the data into training (80%) and test sets (20%)\nset.seed(100)\ninTrain &lt;- createDataPartition(GermanCredit$Class, p = .8)[[1]]\nGermanCreditTrain &lt;- GermanCredit[ inTrain, ]\nGermanCreditTest &lt;- GermanCredit[-inTrain, ]\n\nset.seed(1056)\nsvmFit = train(Class ~ ., \n data = GermanCreditTrain,\n method = \"svmRadial\")\n\n\nQuestion: if this code is correct, how can it be run in a reasonable amount of time?" ]
[ "r", "performance", "multicore", "r-caret" ]
[ "can not add text box input in table", "I have the following code :\n\nhttp://plnkr.co/edit/RqLurBaCsgjQjOYMtl8r?p=preview\n\nhere there is a textbox and when user add something to the textbox and push add button then the entered text should be added to the table Here is my javaScript code:\n\nvar app = angular.module('app', []);\napp.factory('Service', function() {\n var typesHash = [ {\n id : '1',\n name : 'lemon',\n price : 100,\n unit : 2.5\n }, {\n id : '2',\n name : 'meat',\n price : 200,\n unit : 3.3\n } ];\n var service = {\n addTable : addTable,\n getData : getData,\n\n\n };\n return service;\n function addTable(data) {\n\n typesHash.push(data);\n }\n function getData() {\n return typesHash;\n }\n});\napp.controller('table', function(Service) {\n //get the return data from getData funtion in factory\n this.typesHash = Service.getData();\n this.testData = {\n id : '1',\n name : \"test\",\n price : 100,\n unit : 2.5\n };\n //get the addtable function from factory \n this.addTable = Service.addTable;\n});\n\n\nhere as far as testData is static as follow it works:\n\nthis.testData = {\n id : '1',\n name : \"test\",\n price : 100,\n unit : 2.5\n };\n\n\nbut here the text in the textbox is not added so I changed the above code as follow:\n\nthis.testData = {\n id : '1',\n name : $(\"#txt\").val(),\n price : 100,\n unit : 2.5\n };\n\n\nthe name gets nothing and row is added but name spot is empty?\n\nJust a quick note that this is a simpler version of my real code and I have a reason to use factory. \nCan ahyone help me to find out why this table does not connect to textbox correctly?" ]
[ "angularjs", "angularjs-directive", "angularjs-ng-repeat" ]
[ "Is it possible to check if onSnapshot() has found changes before actually fetching?", "When I am navigating to a page, I am passing some parameters such as \"Discounts\" and I am displaying that number in the render() but I am calling onSnapshot() right in the begin of navigating to that class. Now, I would like to display in the begin ONLY the value of the parameter and in case there are changes fetch it.\n\nP.S. the reason behind this is that I am trying to reduce the number of fetches as much as possible.\n\n check_amount_left() {\n const getSelected = this.props.navigation.state.params;\n var ref = db().collection('discounts').where(\"rest_id\", \"==\", getSelected.rest_id)\n ref.onSnapshot((querySnapshot =&gt; {\n var amount = querySnapshot.docs.map(doc =&gt; doc.data().amount);\n this.setState({\n check_for_amount: amount.toString()\n });\n }));\n}\n\n\nRender method: \n\nrender(){\n const getSelected = this.props.navigation.state.params;\n return(\n &lt;View&gt;\n {getSelected.amount}\n &lt;/View&gt;\n )\n}" ]
[ "javascript", "reactjs", "firebase", "react-native", "google-cloud-firestore" ]
[ "How do i XPATH or CSS scrape a Web-Page by utilizing the drop-down menu? (Using Selenium)", "Okay so I'm fairly new to coding in python and I am having trouble with getting my code to fetch a url, goto it, and then using the drop-down menu i would like it to select the option &quot;All&quot;. Which is the first selection\nThe website page that I am trying to scrape is: https://www.nba.com/stats/players/advanced/?sort=GP&amp;dir=-1\nMy code is doing everything it's supposed to do, but whenever it does click the dropdown menu it just doesn't select the first option on the menu. I'm so confused could someone guide me help or a better/simpler route to achieve my goal.\nThanks to any helpers,\nCode:\n\nfrom selenium.webdriver.support.ui import Select\n\nfrom bs4 import BeautifulSoup\n\nimport pandas as pd\n\nfrom selenium.webdriver.common.by import By\n\nfrom selenium.webdriver.support.ui import WebDriverWait \n\nfrom selenium.webdriver.support import expected_conditions as EC\n\ndriver = webdriver.Firefox()\n\nurl = r&quot;https://www.nba.com/stats/players/advanced/?sort=GP&amp;dir=-1&quot;\n\ndriver.get(url)\n\nwait = WebDriverWait(driver, 30)\n\nwait.until(EC.element_to_be_clickable((By.XPATH,&quot;//button[.='I Accept']&quot;))).click()\n\nWebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, &quot;/html/body/main/div/div/div[2]/div/div/nba-stat-table/div[1]/div/div/select&quot;))).click()```" ]
[ "python", "css", "selenium", "selenium-webdriver", "xpath" ]
[ "Sequelize-CLI: Running a migration", "When I am running a migration on this class I want to be able to assign an id and a UUID. Setting the id as primary key and the UUID with a defaultvalue. However, when I run the sequelize db:migrate command I'm getting the highly vague error: \n\n\n val.replace is not a function:\n\n\nHere is my code:\n\n'use strict';\n\nmodule.exports = (sequelize, Sequelize) =&gt; {\n const projects = sequelize.define('projects',\n {\n id: {\n type: Sequelize.UUID,\n allowNull: false,\n primaryKey: true,\n unique: true\n },\n uid: {\n type: Sequelize.UUID,\n allowNull: false,\n defaultValue: Sequelize.UUIDV4,\n\n },\n client: {\n type: Sequelize.STRING(255),\n allowNull: false\n },\n name: {\n type: Sequelize.STRING(255),\n allowNull: false\n },\n\n},\n{\n tableName: 'projects',\n freezeTableName: true,\n underscored: false,\n // don't forget to enable timestamps!\n timestamps: true,\n // I don't want createdAt\n createdAt: 'dateCreated',\n // I want updatedAt to actually be called updateTimestamp\n updatedAt: 'dateModified',\n // And deletedAt to be called destroyTime (remember to enable paranoid for this to work)\n deletedAt: 'dateDestroyed',\n // Paranoid will not delete tables from cascade only add delete to active\n\n});\n\n return projects;\n};" ]
[ "sequelize.js", "sequelize-cli" ]
[ "How to set minimum year value in Sonata Admin Bundle date form field", "I'm using Sonata Admin Bundle with Symfony2. I have a datetime field. This is my piece of code. Pretty simple.\n\n-&gt;add('passportIssueDate', 'date')\n\n\nBut in the form I can select Year value only from 2008 to 2018.\nIs there a way to set different range?\nThanks in advance." ]
[ "symfony", "sonata-admin" ]
[ "Best python UI package for simple graph simulations (TSP simulation, etc...)", "I've never done any UI programming in python before. What is the best (read most intuitive, easy to use, functional) UI package for python for doing simulations? \n\nI'll be doing a simulation of TSP right now. So I'll have a graph (nodes and edges) where the edges are rapidly changing, along with some selection boxes to choose different styles of the algorithm, choose the number of nodes, etc..\n\nI've already written this code with a command line interface and I'm hoping for something pretty seamless to port in a gui :)" ]
[ "python", "user-interface" ]
[ "Repetition in obtaining data", "Hi, I'm trying to get the data from the next page: Page.. I want to load in my RecyclerView the chapter number (in this case there are 121 chapters) and the url. But, I haven't been able to get it all right.\n\nThis is the code for the Body of the page when searching (I simplified it so that only the li from chapter 120 is visible but there is more li below that):\n&lt;li class=&quot;list-group-item p-0 bg-light upload-link&quot; data-index=&quot;0&quot;&gt;\n&lt;h4 class=&quot;px-2 py-3 m-0&quot;&gt;\n&lt;div class=&quot;row&quot;&gt;\n&lt;div class=&quot;col-10 text-truncate&quot;&gt;\n&lt;a style=&quot;display: block;&quot; class=&quot;btn-collapse&quot; onclick=&quot;collapseChapter('collapsible490362')&quot; role=&quot;button&quot;&gt; Capítulo 120.00&lt;/a&gt;\n&lt;/div&gt;\n&lt;/div&gt;\n&lt;/h4&gt;\n&lt;div style=&quot;display: block;&quot; id=&quot;collapsible490362&quot;&gt;\n&lt;hr class=&quot;mx-0 my-1&quot;&gt;\n&lt;div class=&quot;card chapter-list-element&quot;&gt;\n &lt;ul class=&quot;list-group list-group-flush chapter-list&quot;&gt;\n&lt;li class=&quot;list-group-item&quot;&gt;\n&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;col-2 col-sm-1 text-right&quot;&gt;\n&lt;a href=&quot;https://lectortmo.com/view_uploads/599487&quot; class=&quot;btn btn-default btn-sm&quot;&gt;\n&lt;span class=&quot;fas fa-play fa-2x&quot; style=&quot;color:#2957ba&quot;&gt;&lt;/span&gt;\n&lt;/a&gt;\n&lt;/div&gt;\n&lt;/div&gt;\n&lt;/li&gt;\n&lt;/ul&gt;\n&lt;/div&gt;\n&lt;/div&gt;\n&lt;/li&gt;\n\nThe data I want is the chapter number:\nCapítulo 120.00\nCapítulo 119.00\netc\n\nAnd this is how I am parsing the data:\n@Override\n protected ArrayList&lt;TMODatosSeleccion&gt; doInBackground(Void... voids) {\n String url = getIntent().getStringExtra(&quot;valor&quot;);\n\n tmoDatosSeleccions.clear();\n try {\n Document doc = Jsoup.connect(url).get();\n\n Elements data = doc.select(&quot;div.row&gt;.col-10.text-truncate&quot;);\n Elements dataDos = doc.select(&quot;div.col-2.col-sm-1.text-right&quot;);\n for (Element e1 : data) {\n String numeroCap = e1.select(&quot;a&quot;).html();\n numeroCap = numeroCap.replaceAll(&quot;\\\\&lt;.*?\\\\&gt;&quot;, &quot;&quot;).trim();\n for(Element e2 : dataDos){\n String urlManga = e2.select(&quot;a&quot;).attr(&quot;href&quot;);\n tmoDatosSeleccions.add(new TMODatosSeleccion(numeroCap, urlManga));\n }\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n return tmoDatosSeleccions;\n }\n\nCould someone tell me how I can do it correctly? Since when viewing the data in the TextView it looks like this:\n\nAlways see Caítulo 120.00" ]
[ "android", "android-studio", "jsoup" ]
[ "Changing FirefoxProfile() preferences more than once using Selenium/Python", "So I am trying to download multiple excel links to different file paths depending on the link using Selenium.\nI am able to set up the FirefoxProfile to download all links to a certain single path, but I can't change the path on the fly as I try to download different files into different file paths. Does anyone have a fix for this?\n\nself.fp = webdriver.FirefoxProfile()\nself.ft.set_preferences(&quot;browser.download.folderList&quot;, 2)\nself.ft.set_preferences(&quot;browser.download.showWhenStarting&quot;, 2)\nself.ft.set_preferences(&quot;browser.download.dir&quot;, &quot;C:\\SOURCE FILES\\BACKHAUL&quot;)\nself.ft.set_preferences(&quot;browser.helperApps.neverAsk.saveToDisk&quot;, (&quot;application/vnd.ms-excel))\nself.driver = webdriver.Firefox(firefox_profile = self.fp)\n\nThis code will set the path I want once. But I want to be able to set it multiple times while running one script." ]
[ "python-2.7", "selenium-webdriver" ]
[ "How to access externally to consul UI", "How can I access to consul UI externally?\n\nI want to access consul UI writing \n\n&lt;ANY_MASTER_OR_SLAVE_NODE_IP&gt;:8500\n\nI have try doing a ssh tunnel to acces:\nssh -N -f -L 8500:localhost:8500 [email protected]\n\nThen if I access http://localhost:8500\nIt works, but it is not what I want. I need to access externally, without ssh tunnel.\n\nMy config.json file is the next:\n\n{\n\"bind_addr\":\"172.16.8.216\",\n\"server\": false,\n\"datacenter\": \"nyc2\",\n\"data_dir\": \"/var/consul\",\n\"ui_dir\": \"/home/ikerlan/dist\",\n\"log_level\": \"INFO\",\n\"enable_syslog\": true,\n\"start_join\": [\"172.16.8.211\",\"172.16.8.212\",\"172.16.8.213\"]\n}\n\n\nAny help?\nThanks" ]
[ "consul" ]
[ "Boost.Python - problem wrapping C++ overloaded operator", "Using Boost.Python, I am trying to wrap a operator overload method \"+\".\n\nI have got the following class from https://www.tutorialspoint.com/cplusplus/cpp_overloading.htm:\n\n class Box {\n public:\n double getVolume(void) {\n return length * breadth * height;\n }\n void setLength( double len ) {\n length = len;\n }\n void setBreadth( double bre ) {\n breadth = bre;\n }\n void setHeight( double hei ) {\n height = hei;\n }\n\n Box operator+(const Box&amp; b) {\n Box box;\n box.length = this-&gt;length + b.length;\n box.breadth = this-&gt;breadth + b.breadth;\n box.height = this-&gt;height + b.height;\n return box;\n }\n\n\n private:\n double length; // Length of a box\n double breadth; // Breadth of a box\n double height; // Height of a box\n};\n\n\nHowever, when I try to wrap the overloaded operator using the following:\n\nBOOST_PYTHON_MODULE(test)\n{\n namespace python = boost::python;\n\n\n python::class_&lt;Box&gt;(\"Box\") \n .def(\"setLength\", &amp;Box::setLength )\n .def(\"setBreadth\", &amp;Box::setBreadth)\n .def(\"setHeight\", &amp;Box::setHeight )\n .def(\"getVolume\", &amp;Box::getVolume )\n .def(self + Box()); \n\n}\n\n\nI get this error:\n\ntest.cpp:47:10: error: ‘self’ was not declared in this scope\n .def(self + Box());\n\nAccording to https://www.boost.org/doc/libs/1_40_0/libs/python/doc/tutorial/doc/html/python/exposing.html#python.class_operators_special_functions I cannot find what I am doing wrong.\n\nAny suggestions?\n\nThanks!\n\nOS: Fedora 29 - 64 bit." ]
[ "python", "c++", "python-3.x" ]
[ "Changing single cell color with ngClass", "I'm having a hard time here with ngClass as I'm new to angular. I've got a table set up that generates rows dynamically from a database using ng-repeat, with span and input elements that hide/show based on editing/not editing the cell (imagine microsoft excel).\n\n&lt;tr&gt;\n &lt;th class=\"row_head\"&gt;Row Title&lt;/th&gt;\n &lt;td ng-click=\"edit = true\" ng-repeat=\"item1 in JSONobject | orderBy: '_id'\" &gt;\n &lt;span ng-hide=\"edit\"&gt;{{ item1.key.value1 }}&lt;/span&gt;\n &lt;input ng-show=\"edit\" class=\"editing-cell\" ng-model=\"item1.key.value1\" ng-blur=\"edit = false; \" ng-enter=\"saveData(item1._id, item1.key); edit = false\" type=\"text\" /&gt;\n &lt;/td&gt;\n&lt;/tr&gt;\n\n&lt;tr&gt;\n &lt;th class=\"row_head\"&gt;Row Title&lt;/th&gt;\n &lt;td ng-click=\"edit = true\" ng-repeat=\"item2 in JSONobject | orderBy: '_id'\" &gt;\n &lt;span ng-hide=\"edit\"&gt;{{ item2.key.value2 }}&lt;/span&gt;\n &lt;input ng-show=\"edit\" class=\"editing-cell\" ng-model=\"item2.key.value2\" ng-blur=\"edit = false; \" ng-enter=\"saveData(item2._id, item2.key); edit = false\" type=\"text\" /&gt;\n &lt;/td&gt;\n&lt;/tr&gt;\n\n\nand so on. \n\nI want to set it so on blur (data not saved) the cell turns red, and alternatively on save - turns green.\n\nThe issue i'm running into with ngClass is if i just go with:\n\nng-class=\"{'saved': saved, 'notSaved': notSaved}\"\n\n\nIt changes the background color of EVERY cell, rather than just the cell edited. \n\nI do not have this issue with ng-hide and ng-show, even though they appear to be a similar scenario with changing the boolean value of 'edit'. They still stick to their specific cell.\n\nAny help would be appreciated." ]
[ "angularjs" ]
[ "Get Onvif events with Python from IP camera", "I have an IP camera that sends motion events.\nWith the Onvif Device Manager I can also see these events.\nHowever, I am failing to get these events with a Python script.\nStarting point is the Github project: https://github.com/FalkTannhaeuser/python-onvif-zeep\nIf I read it correctly from the documentation, first you have to execute a function called 'CreatePullPointSubscriptionRequest'.\nAs a response you get 'CreatePullPointSubscriptionResponse'.\nThen you can execute the function 'PullMessagesRequest'.\nCan someone send me a code snippet to register for an event (all or filtered) and then read the events?\nThis is what I have so far:\nfrom onvif import ONVIFCamera\nmycam = ONVIFCamera('192.168.0.2', 80, 'user', 'passwd', '/etc/onvif/wsdl/')\n\nresp = mycam.devicemgmt.GetHostname()\nprint('My camera`s hostname: ' + str(resp.Name))\n\nevent_service = mycam.create_events_service()\nprint(event_service.GetEventProperties())\n\nsubscription = event_service.CreatePullPointSubscription()\n\npullpoint = mycam.create_pullpoint_service()\nreq = pullpoint.create_type('PullMessages') # Exception: No element 'PullMessages' in namespace http://docs.oasis-open.org/wsrf/rw-2. Available elements are: - \nreq.MessageLimit=100\nprint(pullpoint.PullMessages(req))" ]
[ "python", "onvif", "python-onvif" ]
[ "How can i get date string from Date in \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\" format?", "I need to return date string is same format I retrieve it, but after converting to Date and back it lose few characters\n\nvar dateStr = \"2019-08-02T11:46:46.5117312Z\"\n\nlet formatter = DateFormatter()\nformatter.calendar = Calendar(identifier: .iso8601)\nformatter.locale = Locale(identifier: \"en_US_POSIX\")\nformatter.timeZone = TimeZone(secondsFromGMT: 0)\nformatter.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\"\n\nlet date = formatter.date(from: dateStr)\n\n var str = formatter.string(from: date!) // ===&gt;&gt;&gt; \"2019-08-02T11:46:46.511Z\"" ]
[ "ios", "swift" ]
[ "How to perform Async await in the below code", "I need clarifications about how to solve the below code using async and await and future API in dart.\n\nvoid main() \n{ \n print(\"Program starts\"); \n printdart(1); \n print(\"Program finishes\"); \n} \nprintdart(int temp) \n{ \n int i; \n for(i=temp;i&lt;=1000;i++) \n { \n print(\"dart\"); \n if(i%10==0) \n { \n printangular(i+1); \n break; \n } \n } \n} \nprintangular(int temp) \n{ \n int i; \n for(i=temp;i&lt;=1000;i++) \n { \n print(\"angular\"); \n if(i%10==0) \n { \n printdart(i+1); \n break; \n } \n } \n} \n\n\nHow to implement async and await in dart" ]
[ "flutter", "dart" ]
[ "how to create database file(.sqlite) using Sqlite for Android?", "i have created table using Sqlite3.and also inserted record in that table.its running successfully.but now i have created another table in same database..and written class for it.\nnow data is not inserted in another table though i have created table in same database and written respective code for it n XML as well.\ni have given toast message after inserting record.it showing me record inserted successfully at position -1..and showing error like this \"table is not exists or file encrypted.\"\nand also if i tried to create table using Sqlite cmd then table is created but i am not getting where that file get stored??? \ncan anyone tell me how to solve this problem.?\nif you want code then will put here..\n\nThanks in Advance---" ]
[ "android" ]
[ "Rails not processing JSON params in get request", "When you post JSON as parameters, Rails normally does all the parsing for you if you specify Content-type: application/json in the header. \n\nIs this the same for get requests?\n\nIn the following rspec request spec, the params sent as JSON are not being parsed despite the correct header. Why? \n\n@headers = { 'CONTENT_TYPE' =&gt; 'application/json' }\nget cases_path(query_params), params: params.to_json, headers: @headers" ]
[ "ruby-on-rails", "json", "ruby", "rspec" ]
[ "How to make Phonegap connect to localhost", "I am working with phonegap for the first time to build hybrid mobile app with back-end(php, mysql). So i am doing a test on how phonegap can connect to php on localhost to send and retrieve data. But no data was retrieved, I have reduced my codes to the this and i see no errors in both ajax call and php code. So i guess it should be the way phonegap connects to backend that i am getting wrong, please help.\n\nhtml form and ajax call:\n\n &lt;form id=\"form1\"&gt;\n &lt;input type=\"text\" id=\"email\" /&gt;\n &lt;input type=\"password\" id=\"password\" /&gt;\n &lt;input type=\"submit\" name=\"login\" id=\"login\" value=\"Login\"&gt; \n &lt;/form&gt;\n\n &lt;script type=\"text/javascript\"&gt;\n $(\"form\").submit(function(){\n var data= (\"#form1\").serialize();\n $.post(\"http://localhost/securityapp/login.php\",data,function(response){\n alert(response);\n });\n\n });\n\n &lt;/script&gt;\n\n\nphp file:\n\n &lt;?php\n include 'db.php';\n session_start();\n if ($_POST ) {\n echo $_POST;\n\n }\n\n\n ?&gt;\n\n\nBasically it is meant to alert to values sent to php script as the response but it is not doing so, network tab says 200 for status. what am i doing wrong? I feel phonegap isn't connecting to the url defined" ]
[ "php", "ajax", "cordova", "phonegap" ]
[ "Jenkins using old node version to build project", "I am working on an existing job that builds a project using node but it looks like it will need to run on v8.11.1 specifically. \n\nhere are the following commands we use on Jenkins:\n\nsource ~/.profile\necho 'Install required packages'\nnpm install -g bower gulp nodemon\nnpm install\nbower install\n\n\necho 'Building production code'\ngulp build\n\n\nIt build our project successfully but only uses version 6.11.2\n\n/home/jenkins/.nvm/versions/node/v6.11.2/bin/bower -&gt; /home/jenkins/.nvm/versions/node/v6.11.2/lib/node_modules/bower/bin/bower\n/home/jenkins/.nvm/versions/node/v6.11.2/bin/gulp -&gt; /home/jenkins/.nvm/versions/node/v6.11.2/lib/node_modules/gulp/bin/gulp.js\n/home/jenkins/.nvm/versions/node/v6.11.2/bin/nodemon -&gt; /home/jenkins/.nvm/versions/node/v6.11.2/lib/node_modules/nodemon/bin/nodemon.js\n\n\nI have tried downloading node v8.11.1 to the /home/jenkins/.nvm/versions/node/, copying gulp, nodemon and bower to the bin directories and using nvm alias default v8.11.1 to switch my node versions \n\nThough, when I run the project it always runs on the older version. What could I do to force it to run to the 8.11.1 version?" ]
[ "node.js", "jenkins", "gulp", "bower", "nodemon" ]
[ "Change Pull To Refresh Activity Indicator", "I have an ActivityIndicator on my tableView which appears when I pull to refresh.\n\nI was wondering if I can change the color of the spinning indicator, here is my implimentation:\n\noverride func viewDidLoad() {\n refreshData()\n super.viewDidLoad()\n self.refreshControl?.addTarget(self, action: #selector(handleRefresh(refreshControl:)), for: UIControlEvents.valueChanged)\n\n}\n\nfunc handleRefresh(refreshControl: UIRefreshControl) {\n self.tableView.reloadData()\n self.refreshData()\n sleep(2)\n refreshControl.endRefreshing()\n\n}" ]
[ "ios", "swift", "swift3", "tableview", "uirefreshcontrol" ]
[ "Return an element as a string outputs undefined", "All the code is in this jsfiddle, the problem is that the function does not return the expected value, but it does print it on console, I'm not sure what am I doing wrong, any ideas?\n\nEDIT: This is all the code, I'm returning html but never get its value\n\n//Returns all assistants to specific event\nfunction getAssistants(id) {\nlet uri = \"https://api.myjson.com/bins/uqndk\";\n$.getJSON(uri, function(data) {\nlet html = \"\";\n\n$.each(data.events[id].assistants, function(index, value) {\n if (value == 'undefined' || value == null) {\n html = '&lt;li class=\"collection-item\"&gt;No hay asistentes registrados.&lt;/li&gt;';\n } else {\n html += '&lt;li class=\"collection-item\"&gt;' + value.name + '&lt;/li&gt;';\n }\n});\n\n//console.log(html);\n\nreturn html;\n});\n}\n\n$(\"#assistants\").append(getAssistants(1));" ]
[ "javascript", "jquery", "html", "function" ]
[ "How can I use hypertools plot the dynamic graphic about mouse trajectory according to time?", "I find a powerful tool in kaggle which is hypertools. I find that it can plot dynamic graph. Just a single line code.\n\nhyp.plot(temps, normalize='across', animate=True, chemtrails=True)\n\n\n\n\nSorry, the format .gif is more than 2MB. So I turn it into picture.However, you can watch this gif in this. I think this is petty cool. However, I do not know how use this tools to plot for my data. My data is a list of tuple (x, y, t) like this:\n\narray([[ 353., 2607., 349.],\n [ 367., 2607., 376.],\n [ 388., 2620., 418.],\n [ 416., 2620., 442.],\n [ 500., 2620., 493.],\n [ 584., 2620., 547.],\n [ 675., 2620., 592.],\n [ 724., 2620., 643.],\n [ 780., 2620., 694.],\n [ 822., 2620., 742.],\n [ 850., 2633., 793.],\n [ 885., 2633., 844.],\n [ 934., 2633., 895.],\n [ 983., 2633., 946.],\n [ 1060., 2633., 1006.],\n [ 1144., 2633., 1063.],\n [ 1235., 2633., 1093.],\n [ 1284., 2633., 1144.],\n [ 1312., 2633., 1210.],\n [ 1326., 2633., 1243.],\n [ 1333., 2633., 1354.],\n [ 1354., 2633., 1408.],\n [ 1375., 2646., 1450.],\n [ 1452., 2659., 1492.],\n [ 1473., 2672., 1543.],\n [ 1480., 2672., 1954.]])\n\n\nHow can I use this powerful tool to plot mouse trajectory?" ]
[ "python", "plot" ]
[ "Catch specific exceptions with try...except", "I have some code to rename a whole bunch of files and move them to a new directory using os.rename(). Its fairly simple, nothing flashy. It worked until I had some overlap in batches and there were duplicate files, this raised a WindowsError. Since the code worked in all otherways, I did\n\ntry:\n os.rename(...)\nexcept WindowsError:\n print \"Duplicate file {}\".format(fileName)\n\n\nThis worked fine, except that it implies that all WindowsErrors are from duplicate files. The result was that when another aspect of my script broke, it failed essentially silently. \n\nHow can I employ try...except to catch only specific exceptions? If its not possible, what workarounds exist?" ]
[ "python", "python-2.7" ]
[ "How does session managment work in spring?", "I can't really understand the concept of this.\nTake a look what I have:\n\n@PostMapping(\"/login\")\npublic ModelAndView login( @ModelAttribute UserLoginDTO userDto, HttpSession session) {\n if (authenticateService.loginCheck(userDto.getUsername(), userDto.getPassword())) {\n session.setAttribute(\"sessionid\",123);\n return new ModelAndView(\"redirect:/profile\");\n } else {\n return new ModelAndView(\"signin\",\"error\",\"Invalid username or password combination, or the user does not exist.\");\n }\n}\n\n\nI have set a sessionID to the session. When the user navigates around the website, how do I know that it is the same user?\n\nDo I have to store the sessionID on server side in a ConcurrentHashMap?\nAnd when there is a page switch I should do this?\n\nif (conHashMap[...] == session.getId()) {...}\nelse //redirect to login page \n\n\nAlso on logout, do I just remove the element from the hashmap and call for session.invalidate()?\n\nOr is there a way of doing this without using hashmaps at all?" ]
[ "http", "session", "session-management" ]
[ "How to implement external filter in angular ui-grid?", "I have an application in Angular. In application using ui-grid and want to do filters to every column.\nI already did a search for the whole table, and it's work. There is my html:\n\n&lt;div class=\"col-md-12\" ng-controller=\"FlatController as flat\"&gt;\n &lt;div class=\"search-wrapper\"&gt;\n &lt;div class=\"search-box\"&gt;\n &lt;input type=\"text\" class=\"form-control\" ng-model=\"flat.searchText\" ng-change=\"flat.refreshData()\" placeholder=\"Search...\"&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;div class=\"ui-grid-wrapper\"&gt;\n &lt;div ui-grid=\"flat.gridOptions\" ui-grid-resize-columns ui-grid-auto-resize id=\"grid1\" class=\"grid\"&gt;&lt;/div&gt;\n &lt;/div&gt;\n&lt;/div&gt;\n\n\nIt's my controller:\n\nangular.module('flatCtrl', ['flatService', 'ngTouch', 'ui.grid', 'ui.grid.resizeColumns', 'ui.grid.moveColumns', 'ui.grid.autoResize', 'ngSanitize', 'ui.select', 'ui.date'])\n .controller('FlatController', ['Flat', 'socketio', '$filter', function(Flat, socketio, $filter){\n\n vm = this;\n Flat.allFlat()\n .success(function(data){\n vm.flats = data;\n vm.gridOptions = {\n data: data,\n columnDefs: [\n {field: 'id', displayName: 'Id', visible: false},\n {field: 'creator', displayName: 'Creator', visible: false},\n {field: 'typelocal', displayName: 'Typ lokalu', visible: true},\n {field: 'country', displayName: 'Kraj', visible: true},\n {field: 'city', displayName: 'Miejscowość', visible: true},\n {field: 'district', displayName: 'Dzielnica', visible: true}\n ]\n };\n vm.refreshData = function() {\n vm.gridOptions.data = $filter('filter')(vm.flats, vm.searchText, undefined);\n };\n });\n\n\nMaybe who knows how to add inputs in my html for every ui-grid column?" ]
[ "javascript", "angularjs", "mongodb", "express", "angular-ui-grid" ]
[ "How do I add jumping to my game", "import pygame\nimport time\npygame.init()\n\ndisplay_width = (1000)\ndisplay_height = (480)\n\n\nblack = (255,50,0)\nwhite = (0,60,7)\nblue = (0,205,205)\n\nkled1_width = 30\nkled1_height = 45\n\nground1_height = 300\n\nscreen = pygame.display.set_mode((display_width,display_height))\npygame.display.set_caption(\" kled \")\nclock = pygame.time.Clock()\n\ngameDisplay = screen\n\nkled1IMG = pygame.image.load(\"IMG.png\")\n\ndef kled1(x,y):\n gameDisplay.blit(kled1IMG,(x,y))\n\n\ndef game_loop():\n\n x = (1)\n y = (340)\n\n\n x_change = 0\n\n y_change = 0\n\n\n gameExit = False\n\n while not gameExit:\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n gameExit = True\n\n if event.type == pygame.KEYDOWN:\n if event.key == pygame.K_LEFT:\n x_change = -5\n\n elif event.key == pygame.K_RIGHT:\n x_change = 5\n\n elif event.key == pygame.K_UP:\n y_change = -15\n\n elif event.key == pygame.K_DOWN:\n y_change = 5\n\n if event.type == pygame.KEYUP:\n if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT or event.key == pygame.K_LEFT and pygame.K_r or event.key == pygame.K_RIGHT and pygame.K_2:\n x_change = 0\n if event.type == pygame.KEYUP:\n if event.key == pygame.K_UP or event.key == pygame.K_DOWN:\n y_change = 0\n\n\n x += x_change\n y += y_change\n\n gameDisplay.fill(blue)\n\n pygame.draw.rect(gameDisplay, white, [1, 400, 1000,ground1_height])\n\n kled1(x,y)\n\n#prevents from going into ground\n if y &gt; ground1_height:\n y_change = 0\n\n pygame.display.update()\n clock.tick(30)\n\ngame_loop()\npygame.quit()\nquit()\n\n\nHow would I make my code so that if I press ▲ once, the image moves up 15 spaces from the image's current position, and then goes down 15 spaces after about .5 seconds? Essentially, it is a jumping game like Mario that I will add platforms and other things to it. Also, I want to know how to make sure you can't double jump while in the air! Sorry that I am not a good programmer, I just need help for this game. \n\nI am using Python 2.7" ]
[ "python", "python-2.7", "pygame" ]
[ "error in getting time from php to as3", "this is my as3 code to get time from server:\n\nvar date_loader:URLLoader = new URLLoader();\nvar date_urlreq:URLRequest = new URLRequest(\"http://ixfa08.gigfa.com/mytime.php\");\ndate_loader.load(date_urlreq);\ndate_loader.addEventListener(Event.COMPLETE, onServerTimeLoad);\nfunction onServerTimeLoad(e:Event)\n{\n trace(date_loader.data); \n}\n\n\nand this is my php code:\n\n&lt;?php\nprint time();\n?&gt;\n\n\nand this is the result after trace in flash cs6:\n\n&lt;html&gt;&lt;body&gt;&lt;h2&gt;Checking your browser..&lt;h2&gt;&lt;script type=\"text/javascript\" src=\"/aes.js\" &gt;&lt;/script&gt;&lt;script&gt;function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&amp;&amp;arguments[0].constructor==Array?arguments[0]:arguments,e=\"\",f=0;f&lt;d.length;f++)e+=(16&gt;d[f]?\"0\":\"\")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers(\"f655ba9d09a112d4968c63579db590b4\"),b=toNumbers(\"98344c2eee86c3994890592585b49f80\"),c=toNumbers(\"d753a2b8b06e14eaba68f691c541eff7\");document.cookie=\"__test=\"+toHex(slowAES.decrypt(c,2,a,b))+\"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/\";location.href=\"http://ixfa08.gigfa.com/mytime.php?ckattempt=1\";&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;\n\n\nwhere is my mistake ? I want get server time from php" ]
[ "php", "actionscript-3", "flash" ]
[ "Converting HTML Element into 'Node' type", "I'm working on a HTML project. Basically saving HTML nodes to a JavaScript's Object to append them inside a element. Here's my HTML, JavaScript and the error.\n\nHTML\n\n...\n &lt;div id=\"holder\"&gt;&lt;/div&gt;\n...\n\n\nJavaScript\n\nvar _handler = {};\nvar _holder = document.getElementById('holder');\nvar some_example = [{\"id\":\"item_1\"}, {\"id\":\"item_2\"}]\n\nfunction create(tag, id) { /*Created a DOMObject */\n var elem = document.createElement(tag);\n _handler[id] = elem;\n}\nfunction spawn() {\n for (var k in _handler) {\n _holder.appendChild(_handler[k]); //&lt;----- Here's the error occurring, given at very last.\n }\n}\nfunction main() { /* Main function */\n for (var x=0;x &lt; some_example.length;x++) {\n create('div', some_example.id);\n }\n spawn();\n}\n\n\nSorry for that little complicated script. Anyways, all the work going great but, appendChild does the bobo given below:\n\nError\n\n\n Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.\n\n\nHope, you guys have any idea. Thank You." ]
[ "javascript", "html" ]
[ "Error on using Search function from purchase.order.line in Odoo 14", "I have an action like so:\n. . .\n&lt;record id=&quot;confirm_action&quot; model=&quot;ir.actions.server&quot;&gt;\n&lt;field name=&quot;name&quot;&gt;Confirm&lt;/field&gt;\n&lt;field name=&quot;binding_model_id&quot; ref=&quot;my_module.model_purchase_order_line&quot;/&gt;\n&lt;field name=&quot;model_id&quot; ref=&quot;my_module.model_purchase_order_line&quot;/&gt;\n&lt;field name=&quot;state&quot;&gt;code&lt;/field&gt;\n&lt;field name=&quot;code&quot;&gt;\n action = records.confirm_line()\n&lt;/field&gt;\n&lt;/record&gt;\n. . .\n\nand I have this code in my model:\nclass purchase_order_line_inherit(models.Model):\n_inherit = &quot;purchase.order.line&quot;\n\ndef confirm_line(self):\n for line in self:\n purchase_orders = self.env['purchase.order.line'].search(['product_id.id','=',line.product_id.id])\n\nHere is the error:\n\nOdoo Server Error\nTraceback (most recent call last):\nFile &quot;/home/odoo/odoo/odoo/addons/base/models/ir_http.py&quot;, line 237, in _dispatch\nresult = request.dispatch()\nFile &quot;/home/odoo/odoo/odoo/http.py&quot;, line 683, in dispatch\nresult = self._call_function(**self.params)\nFile &quot;/home/odoo/odoo/odoo/http.py&quot;, line 359, in _call_function\nreturn checked_call(self.db, *args, **kwargs)\nFile &quot;/home/odoo/odoo/odoo/service/model.py&quot;, line 94, in wrapper\nreturn f(dbname, *args, **kwargs)\nFile &quot;/home/odoo/odoo/odoo/http.py&quot;, line 347, in checked_call\nresult = self.endpoint(*a, **kw)\nFile &quot;/home/odoo/odoo/odoo/http.py&quot;, line 912, in call\nreturn self.method(*args, **kw)\nFile &quot;/home/odoo/odoo/odoo/http.py&quot;, line 531, in response_wrap\nresponse = f(*args, **kw)\nFile &quot;/home/odoo/odoo/addons/web/controllers/main.py&quot;, line 1733, in run\nresult = action.run()\nFile &quot;/home/odoo/odoo/odoo/addons/base/models/ir_actions.py&quot;, line 629, in run\nres = runner(run_self, eval_context=eval_context)\nFile &quot;/home/odoo/odoo/odoo/addons/base/models/ir_actions.py&quot;, line 498, in _run_action_code_multi\nsafe_eval(self.code.strip(), eval_context, mode=&quot;exec&quot;, nocopy=True) # nocopy allows to return 'action'\nFile &quot;/home/odoo/odoo/odoo/tools/safe_eval.py&quot;, line 346, in safe_eval\nraise ValueError('%s: &quot;%s&quot; while evaluating\\n%r' % (ustr(type(e)), ustr(e), expr))\nException\nThe above exception was the direct cause of the following exception:\nTraceback (most recent call last): File\n&quot;/home/odoo/odoo/odoo/http.py&quot;, line 639, in _handle_exception\nreturn super(JsonRequest, self)._handle_exception(exception) File &quot;/home/odoo/odoo/odoo/http.py&quot;, line 315, in _handle_exception\nraise exception.with_traceback(None) from new_cause ValueError: &lt;class 'TypeError'&gt;: &quot;'int' object is not subscriptable&quot; while\nevaluating 'action = records.confirm_line()'\n\nWhat I want to do is just to get data of purchase order lines that has the same product as the line I selected before. What did I do wrong?\nIt is giving me the error from this line purchase_orders = self.env['purchase.order.line'].search(['product_id.id','=',line.product_id.id])." ]
[ "odoo", "odoo-14" ]
[ "Meteor Autoform Select2 set value", "I'm using the Meteor autoform select2 package and I'm trying to figure out how to set a selected value. Currently trying the following but then I can't see the rest of the countries list\n\noptions: function () {\n var user = Meteor.users.findOne();\n if (user &amp;&amp; !_.isEmpty(user.profile.country)) {\n return {value: user.profile.country};\n }\n\n return countriesList;\n}" ]
[ "meteor", "jquery-select2", "meteor-autoform", "telescope" ]
[ "A2 regional quota limit on Google Compute Engine doesn't increase", "I am trying to set up an a2-highgpu-1g instance in us-central1-a on Google Compute Engine.\nI got the following error when setting the instance up: - Quota 'A2_CPUS' exceeded. Limit: 0.0 in region us-central1.\nTherefore i requested an A2 CPU quota increase in the region us-central1.\nIt got automatically approved, but in the approvement e-mail it says: CPUS_ALL_REGIONS | GLOBAL | 12, which is different from what i requested.\nAlso the A2 CPU limit in the us-central1 region is still at 0. How can i get this limit increased?\nThanks!" ]
[ "google-cloud-platform", "virtual-machine", "google-compute-engine", "quota" ]
[ "obfuscate values in python", "Lets say I have the following strings\n\na = \"123456\"\nb = \"#$%[{\\\"\nc = \"ABCDEFG\"\n\n\nI need to convert these three string into a \"d\" string with the following properties\n\n\nThe \"d\" string is obfuscate (it does not need to be encrypted)\nThe \"d\" string can be converted into the a,b,c string (it is reversible)\nThe \"d\" string should be fast to compute\nThe \"d\" string should be as short as possible\n\n\nSo far what I do is something like this\n\nd = a+\"|\"+b+\"|\"+c\nd = base64.encode(d)\n\n\nSo far this accomplishes the first three requirements, but not the third one, as base64 tends to make strings pretty big.\n\nI have been also looking at other solutions\n\n\nUse XOR encryption\nConsider using CRC32 as some questions (Reversing CRC32) states that it might be possible to revert it, however, I am not sure about it.\n\n\nFinally note that the \"obfuscation\" part is done by python and the \"restoration\" part is done by php.\n\nAny ideas?" ]
[ "php", "python", "encoding", "hash" ]
[ "I need help understanding the rest and spread operator", "This is the code: \n\nconst Pipe = (...fns) =&gt; fns.reduce((f,g) =&gt; (...args) =&gt; g(f(...args)));\n\n\nSo by (...fns) the fns arguments becomes an array right? in this part:\n\n (f,g) =&gt; (...args)\n\n\nwhere did args came from? is there a default args parameter? and I cannot read this part: \n\n(...args) =&gt; g(f(...args))\n\n\nI just cannot wrap my head with this nesting and what reduce does here is so confusing." ]
[ "javascript", "ecmascript-6" ]
[ "Python override 3rd party package single file", "What is the best way to override python any 3rd party package single file?\n\nSuppose. \n\nI have a package called foo. Foo contains file tar.py which have an import line.\n\ntar.py\n\nfrom xyz import abc\n# some code\n\n\nhow do I replace that single line import\n\n# from \nfrom xyz import abc\n# to \nfrom xyz.xy import abc\n\n\ni want to change this line outside virtualenv in python project" ]
[ "python", "python-3.x" ]
[ "Index 0 out of bounds for length 0", "Here i am getting this error:\nException in thread &quot;main&quot; java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0\npublic static void main(String[] args) {\n Scanner keyboard = new Scanner(System.in);\n String input = keyboard.nextLine();\n System.out.println(input);\n while(true){\n if(args[0].equals(&quot;k&quot;)){\n System.out.println(&quot;k&quot;);\n }\n }\n}" ]
[ "java" ]
[ "Why is dummy '0' row created after pd.read_csv()?", "Why there is an additional row named '0' after read_csv?\n\nIn the following code, I saved df1 to csv file and read it back. However, there is an additional row named '0'. How can I avoid it? \n\nd1 = {'a' : 1, 'b' : 2, 'c' : 3}\ndf1=pd.Series(d1)\nprint('\\ndf1:'); print(df1)\n\n&gt; df1:\n&gt; a 1\n&gt; b 2\n&gt; c 3\n&gt; dtype: int64\n\ndf1.to_csv(\"df1.csv\")\ndf1=pd.read_csv(\"df1.csv\", index_col=0, header=None)\nprint('\\ndf1:'); print(df1)\n\n&gt; df1:\n&gt; 1\n&gt; 0 &lt;&lt;&lt;&lt;---- ????\n&gt; a 1\n&gt; b 2\n&gt; c 3" ]
[ "python", "pandas" ]
[ "\"Operation not permitted on IsolatedStorageFileStream\" issue in Windows Phone", "I have saved video file in IsolatedStorage and play it using Media Element in Windows Phone 8. For the first time, it executes very well and run successfully and I am able to play video,\n\nThe problem is that, whenever I play for the second time, I am getting error like this:\n\n\"Operation not permitted on IsolatedStorageFileStream\"\n\n\nSee my code :\n\n string mediafile = \"asaqwrereertrtyrzxxcvcvvbvbv+qwwezzxzxz\";\n byte[] PlayByte = Convert.FromBase64String(mediafile);\n MemoryStream stream = new MemoryStream(PlayByte, 0, PlayByte.Length);\n\n\n IsolatedStorageFileStream isfStream = new IsolatedStorageFileStream(audioName, FileMode.OpenOrCreate,FileAccess.ReadWrite, IsolatedStorageFile.GetUserStoreForApplication());\n isfStream.Write(stream.ToArray(), 0, stream.ToArray().Length);\n isfStream.Close();\n Uri uri = new Uri(isfStream.Name.ToString());\n MediaElement1.Source = uri;\n MediaElement1.Play();" ]
[ "c#", "windows-phone-8", "isolatedstorage" ]
[ "run docker commands from command prompt versus jenkins script", "I have a test Ubuntu server with docker-machine installed. I have a number of docker containers running on the servers. Including a Jenkins container. I run jenkins with the following command\n\ndocker run -d --name jenkins -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker --restart=always -p 8080:8080 -v ~/jenkinsHome:/var/jenkins_home docker-jenkins\n\n\nI am working on managing my images through Jenkins. I can start all but one of my containers via Jenkins shell script. The one container that fails appears to start in the script (I do a docker PS after the docker run in script). However, the container stops after the script completes. I am using the same docker run command that works on the command prompt, but it fails in Jenkins script:\n\nsudo docker run -d --net=host -v ~/plex-config:/config -v ~/Media:/media -p 32400:32400 wernight/plex-media-server\n\n\nI have double checked folder permissions and they are correct. Can anyone direct me to possible reasons the run command is failing in Jenkins, but not at the command prompt?" ]
[ "jenkins", "docker" ]
[ "AsyncCassandraOperations examples", "I am reading up on AsyncCassandraOperations to perform async inserts to improve performance based on another post here. But I am unable to find a lot of help on google or spring data documentation. \n\nPreviously I was using Cassandra Repository for all data extraction and insert/updates which I found to be super slow. As per recommendation I am now using AsyncCassandraOperations for the insert operation alone, but it wont let me. I encounter required a bean of type 'org.springframework.data.cassandra.core.AsyncCassandraOperations' error.\n\nWhat would be the correct way to use AsyncCassandraOperations please?\n\n@Autowired private MyRepository repository_name;\n@Autowired private AsyncCassandraOperations acops;\npublic void persist(List&lt;POJO&gt; l_POJO)\n{\n System.out.println(\"Enter Persist: \"+new java.util.Date());\n\n List&lt;l_POJO&gt; l_POJO_stale = repository_name.findBycol1AndStale(\"sample\",false);\n\n l_POJO_stale.forEach(s -&gt; s.setStale(true));\n\n l_POJO_stale.forEach(s -&gt; acops.update(s));\n\n try \n {\n acops.insert(l_POJO);\n } \n catch (Exception e) \n {\n System.out.println(\"Error in persisting new data\");\n }\n}" ]
[ "spring-boot", "cassandra", "spring-data" ]
[ "does anyone know the implementation details for how Chrome monitors changes to DOM elements in javascript and replicates them in the GUI?", "Here's my understanding - feel free to correct.\nSo you have some HTML, rendered in the browser.\n&lt;h1 id=&quot;header&quot;&gt; hi. &lt;/h1&gt;\n\nand in js, you select that html element and create a DOM element, a special JS object that represents the HTML element.\nlet h1 = document.querySelector(&quot;#header&quot;)\n\nyou make a change to the DOM element in JS.\nh1.innerText = 'NEW STUFF'\n\nThe browser reacts to this change, and replicates the change in the viewport - presumably, it changes the source HTML and that triggers a re-render of the whole document.\nQuestion - specifically, How does the browser monitor changes to DOM elements and their properties?\nany help is much appreciated." ]
[ "javascript", "html", "google-chrome", "dom", "internals" ]
[ "Are you able to launch an app from hardware press in iOS?", "I'm saying that with the app not running (fresh boot, or stopped), is there a way for me to program it to start running after some hardware button combo-press? (ex. \"Volume+\" 3 times, \"Home\" 3 times.)\n\nSecond Part: \n\nWhat about if the app had been run, but then put into the background, and the phone was locked; would a hardware button combo-press work to have the app do anything?\n\nEssentially I'm exploring ways to discreetly communicate with an app via hardware buttons without requiring the User to view the screen. (ex. In the pocket)" ]
[ "ios", "button", "volume", "launch" ]
[ "SSAS named calculation referencing another table", "I'm doing a multidimensional analysis in the SSAS VS tool. I have two tables, animal animal_intake. Animal is identified with animal_id and animal_intake references animal using animal_id. What I want to acomplish id to create named calculation in view that will have the information about the age of animal at the intake day. In order to calculate age, I have to reference animal birth date in animal_intake named calculation. Based on solution described in documentation [https://docs.microsoft.com/en-us/sql/analysis-services/multidimensional-models/define-named-calculations-in-a-data-source-view-analysis-services?view=sql-server-2017#creating-named-calculations] I have created following query for named calculation\n\n(SELECT [ANIMAL].[birth_date] FROM [ANIMAL] WHERE [ANIMAL].[animal_id] =[animal_id])\n\n\njust to get access to animal birthdate. Unfortunately, when I click \"explore data\" VS presents following error\n\nSubquery returned more than 1 value. This is not permitted when the subquery follows =, !=, &lt;, &lt;= , &gt;, &gt;= or when the subquery is used as an expression.\n\n#\n\n\nI don't understand what is the problem - animal_id is a primary key of ANIMAL table and birth_date field has NOT NULLconstraint. Therefore for given naimal_id there has to be exactly one result for the query.\n\nHere are simplified tables from my db.\n\nANIMAL\n\nCREATE TABLE [ANIMAL] (\n [animal_id] CHAR(7) PRIMARY KEY,\n [birth_date] DATE REFERENCES [DATE]([exact_date]) NOT NULL\n);\n\n\nANIMAL_INTAKE\n\nCREATE TABLE [ANIMAL_INTAKE] (\n [animal_id] CHAR(7) NOT NULL REFERENCES [ANIMAL],\n [stay_number] TINYINT NOT NULL,\n [intake_date] DATE REFERENCES [DATE]([exact_date]) NOT NULL,\n PRIMARY KEY ([animal_id], [stay_number]),\n);" ]
[ "ssas", "calculation", "named" ]
[ "Chrome DevTools listen to multiple selections of the same element in the elements panel", "In my Google Chrome DevTools Extension I try to listen to the selections in the DevTools panel \"Elements\". In particular, it should be possible to listen to the selection of the already selected element.\n\nMy current implementation method revolves around the function chrome.devtools.panels.elements.onSelectionChanged. The function name already suggests that it is only possible to react to elements that are not currently selected. \nTherefore I tried to reset or remove the current selection with the help variable $0, to be able to listen to the same element again - unfortunately without success.\n\nMy goal is to somehow listen to every click/selection in the elements panel. In summary, I am looking for an onSelection listener instead of an onSelectonChange listener.\n\nEDIT #1\n\nHere's my code I've tried:\n\nchrome.devtools.panels.elements.createSidebarPane(\n \"Selector\",\n function(sidebar) {\n // It fires if I'm selecting a specific DOM element via the elements panel the first time\n // It won't fire if I'm selecting the same DOM element again\n chrome.devtools.panels.elements.onSelectionChanged.addListener(() =&gt; {\n chrome.devtools.inspectedWindow.eval(`(${getSelector})()`,\n selector =&gt; {\n console.log(selector)\n // Here I tried to reset the current selection...\n // I've already debugged it: I can assign a value to $0, \n // but this implies that the value remains constant even \n // after a new selection.\n chrome.devtools.inspectedWindow.eval('$0 = undefined')\n })\n })\n }\n)\n\n\nI am wondering if there is a way to change the selector programmatically..." ]
[ "javascript", "google-chrome", "google-chrome-extension", "google-chrome-devtools" ]
[ "Content script not getting executed for URL that has a hashtag (and no www)?", "This problem seems to have been sort of resolved, as long as the URL of the page you're injecting your javascript into starts with www. What do you do if it doesn't? Here's the relevant part of my manifest:\n\n\"content_scripts\": [\n {\n \"run_at\": \"document_start\",\n \"matches\": [\"https://groups.google.com/forum/?fromgroups=#!newtopic/opencomments-site-discussions\"],\n \"js\": [\"postMsg.js\"]\n }\n],\n\n\nThe problem, according to another stackoverflow post, is because the URL of the page doesn't begin with 'www'. Does that mean that you can't inject javascript into secure pages whose URL doesn't begin with 'www', or is there another way? This had never been a problem in the past, because my extension had run with Version 1 manifests.\n\nForgot to add the content script:\n\nvar subject = document.getElementById(\"p-s-0\");\n\nsubject.setAttribute(\"value\", \"foo\"); \n\n\nThe element with ID \"p-s-0\" is the Subject field in the Google Groups Post page, so the field should display \"foo\"." ]
[ "javascript", "google-chrome-extension", "hashtag", "content-script" ]
[ "Is it possible to detect Keyboard focus events globally?", "The following events can be used, but, they must be attach for each element:\n\nGotKeyboardFocus, LostKeyboardFocus\n\nIs there a way in .NET WPF to globally detect if the focused element changed ? without having to add event listeners for all possible elements ?" ]
[ "wpf" ]
[ "brew: unable to install mumps on mac", "I am trying to install ipopt by:\n\n\n brew install ipopt.rb --with-openblas\n\n\nand I got the following error:\n\n\n ==> Installing dependencies for ipopt: mumps\n \n ==> Installing ipopt dependency: mumps\n \n ==> Downloading http://mumps.enseeiht.fr/MUMPS_5.1.1.tar.gz\n \n Already downloaded: /Users/yufeiliu/Library/Caches/Homebrew/mumps-5.1.1.tar.gz\n \n ==> make alllib LIBEXT=.dylib AR= -dynamiclib -Wl,-install_name -Wl,/usr/local/Cellar/mumps/5.1.\n \n Last 15 lines from /Users/yufeiliu/Library/Logs/Homebrew/mumps/01.make:\n \n clang -fPIC -I../include -O -c symbfac.c -o symbfac.o\n \n clang -fPIC -I../include -O -c interface.c -o interface.o\n \n clang -fPIC -I../include -O -c sort.c -o sort.o\n \n clang -fPIC -I../include -O -c minpriority.c -o minpriority.o\n \n dynamiclib -Wl,-install_name -Wl,/usr/local/Cellar/mumps/5.1.1_1/lib/libpord.dylib -undefined dynamic_lookup -o libpord.dylib graph.o gbipart.o gbisect.o ddcreate.o ddbisect.o nestdiss.o multisector.o gelim.o bucket.o tree.o symbfac.o interface.o sort.o minpriority.o \n \n make[2]: dynamiclib: No such file or directory\n \n make[2]: [libpord.dylib] Error 1 (ignored)\n \n echo libpord.dylib\n \n libpord.dylib\n\n\nif [ \"./PORD/lib/\" != \"\" ] ; then \\\n cp ./PORD/lib//libpord.dylib lib/libpord.dylib; \\\n fi;\n\n\n\n cp: ./PORD/lib//libpord.dylib: No such file or directory\n \n make[1]: *** [lib/libpord.dylib] Error 1\n \n make: *** [c] Error 2\n \n If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):\n https://github.com/brewsci/homebrew-science/issues\n\n\nDoes anyone know how to solve this?" ]
[ "homebrew" ]
[ "C++ Passwd, Root Priviledges", "I have written a c++ script that disables or enables users within a Solaris environment. This is done by calling the passwd through\n\nsprintf(cmd, \"/usr/bin/passwd -l %s\", argv[1]);\n\n\nHowever the script is not executed by root, but by another user.\nWhile the script executes the passwd changes are not done. Seems this is an issue with the user permission on passwd.\n\nHowever it seems that only root can modify passwd. Is this true? Can something else be done? In the sense that passwd can be modified by other users?" ]
[ "c++", "permissions", "solaris", "passwd" ]
[ "Store forms in session and back button", "I'm trying to achieve the following scenario:\n\n1. user display the page addBook.php\n2. user starts filling the form\n3. but when he wants to select the book Author from the Author combo box, the Author is not yet created in the database so the user clicks a link to add a new Author\n5. user is redirected to addAuthor.php\n6. the user fill the form and when he submits it, he goes back to addBook.php with all the previous data already present and the new Author selected.\n\n\nThe things is: I have scenarios where there is more than one level of recursion. (Example: Add Book => Add Author => Add Country)\n\nHow can I do that?\n\nAt step #3, the link submit the form so that I can save it in session.\nTo handle recursion, I can use a Stack and push the current from on the Stack each time I click a link. And pop the last form of the Stack when the user completes the action correctly or click a cancel button.\n\n\nMy problem is:\n\nHow can I handle the back button of the browser?\nIf instead of clicking the \"cancel\" button, the user click on the back button, how could I kown that I need to pop the last element?\n\nDo you known some common pattern to achieve that?" ]
[ "php", "back-button" ]
[ "passing a multi dimensional array to Insert in Codeigniter Model", "{\n \"word\": [\"w1\", \"w2\"],\n \"meaning\": [\"m1\", \"m2\"],\n \"parts_of_speech\": [\"p1\", \"p2\"],\n}\n\n\nThis is the Data i have in Model which is now assigned to $data variable\n\nIn above $data each word index has corresponding Meaning in meaning array, and each word index has corresponding parts_of_speech in parts_of_speech array index. In this way always length of word,meaning,parts_of_speech arrays remain same\n\nI have tried the following methods to insert into table\n\n$this-&gt;db-&gt;insert('table_words', $data); \n\n$this-&gt;db-&gt;insert_batch(\"table_words\",$data);\n\n\nbut it happened errors" ]
[ "php", "codeigniter", "multidimensional-array", "model", "associative-array" ]
[ "UIView to UIImage using UIGraphicsImageRenderer wrongly renderer image with alpha", "I'm converting a UIView to UIImage, to set it as navigationBar background.\n\nThats view has an gradient layer, and when i use setBackgroundImage(_ backgroundImage: UIImage?, for barMetrics: UIBarMetrics) using the converted view, navigation gets a little transparent, something like 0.8 alpha\n\nHere's the code that i'm using:\n\nlet navBackground = UIView(frame: CGRect(x: UIApplication.shared.statusBarFrame.origin.x, \n y: UIApplication.shared.statusBarFrame.origin.y, \n width: UIApplication.shared.statusBarFrame.width, \n height: UIApplication.shared.statusBarFrame.height+self.navigationController!.navigationBar.frame.size.height))\nlet gradient: CAGradientLayer = CAGradientLayer()\ngradient.colors = [UIColor(red:0.16, green:0.22, blue:0.49, alpha:1.0).cgColor, UIColor(red:0.31, green:0.53, blue:0.78, alpha:1.0).cgColor]\ngradient.locations = [0.0, 1.0]\ngradient.startPoint = CGPoint(x: 0, y: 1)\ngradient.endPoint = CGPoint(x: 1, y: 0)\ngradient.frame = navBackground.bounds\nnavBackground.layer.insertSublayer(gradient, above: nil)\nlet imgBackground = navBackground.asImage()\n self.navigationController?.navigationBar.setBackgroundImage(imgBackground, for: UIBarMetrics.default)\n\n\nasImage() it's a UIView extension that convert UIView to UIImage:\n\nextension UIView {\n\nfunc asImage() -&gt; UIImage {\n\n let renderer = UIGraphicsImageRenderer(bounds: bounds)\n return renderer.image { rendererContext in\n layer.render(in: rendererContext.cgContext)\n }\n\n}!\n\n\nResult: sample" ]
[ "ios", "swift", "swift4.2", "image-rendering" ]
[ "How to specify Trust store and trust store type for Spark JDBC connection", "I am new to Spark and we are currently using the spark-java to create orc files from Oracle database. I was able to configure the connection with \n\nsqlContext.read().jdbc(url,table,props)\n\n\nHowever, I couldn't find any way in the properties to specify the trustStore or trustStoreType. Can someone help me about how to specify these properties?\n\nI already tried populating the properties as\n\n props.put(\"trustStore\", \"&lt;PATH_TO_SSO&gt;\");\n props.put(\"trustStoreType\", \"sso\");\n\n\nBut it didn't work for me\n\nUpdate1:\nI have tried what user8371915 has suggested and also placed the sso file in both my executor nodes. I am still getting the following exception (abridged version)\n\noracle.net.ns.NetException: The Network Adapter could not establish the connection\n at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:470)\n at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:506)\n at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)\n at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)\n at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452)\n at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)\n ... 23 more\nCaused by: oracle.net.ns.NetException: Unable to initialize ssl context.\n at oracle.net.nt.CustomSSLSocketFactory.getSSLSocketFactory(CustomSSLSocketFactory.java:325)\n at oracle.net.nt.TcpsNTAdapter.connect(TcpsNTAdapter.java:117)\n at oracle.net.nt.ConnOption.connect(ConnOption.java:159)\n at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:428)\n ... 28 more\nCaused by: oracle.net.ns.NetException: Unable to initialize the trust store.\n at oracle.net.nt.CustomSSLSocketFactory.getTrustManagerArray(CustomSSLSocketFactory.java:413)\n at oracle.net.nt.CustomSSLSocketFactory.getSSLSocketFactory(CustomSSLSocketFactory.java:309)\n ... 31 more\nCaused by: java.security.KeyStoreException: sso not found\n at java.security.KeyStore.getInstance(KeyStore.java:851)\n at oracle.net.nt.CustomSSLSocketFactory.getTrustManagerArray(CustomSSLSocketFactory.java:401)\n ... 32 more\nCaused by: java.security.NoSuchAlgorithmException: sso KeyStore not available\n at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)\n at java.security.Security.getImpl(Security.java:695)\n at java.security.KeyStore.getInstance(KeyStore.java:848)\n ... 33 more" ]
[ "oracle", "apache-spark", "truststore", "spark-jdbc" ]
[ "JAR generated by warbler cannot access included internal JAR library", "I have a JRuby project that connects to an Oracle database using JDBC via Oracle's ojdbc6.jar library. The code works well when run using JRuby 1.6.6 on Windows 7 and JRuby 1.6.5.1 on OS X Lion. I'm trying to create a standalone JAR file using warbler. After running warble jar it includes the ojdbc6.jar but for some reason it does not load/access it. It seems the internal classpath is incorrect or I'm not configuring something right.\n\nFollowing directory structure exists.\n\nC:\\my_jruby_project\\bin\\my_jruby_file.rb\nC:\\my_jruby_project\\lib\\java\\ojdbc6.jar\nC:\\my_jruby_project\\Gemfile\n\n\nC:\\my_jruby_project\\Gemfile:\n\nsource :rubygems\ngem 'activerecord', '&gt;= 3.2.3'\ngem 'activerecord-jdbc-adapter', '&gt;= 1.2.2'\ngem 'ruport', '&gt;= 1.6.3'\n\n\nC:\\my_jruby_project\\bin\\my_jruby_file.rb\n\nrequire 'ruport'\nrequire 'java'\n\njava_import 'oracle.jdbc.OracleDriver'\njava_import 'java.sql.DriverManager'\n....\n\n\nAfter generating the JAR file: \n\njruby -S warble jar\n\n\nI execute the jar and get the following error:\n\nC:\\my_jruby_project&gt;java -jar my_jruby_project.jar\nNameError: cannot load Java class oracle.jdbc.OracleDriver\n for_name at org/jruby/javasupport/JavaClass.java:1205\n get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34\n java_import at file:/C:/Users/DAVIDH~1.OPE/AppData/Local/Temp/jruby8647327738550400677extract/\njruby-core-1.6.7.jar!/builtin/javasupport/core_ext/object.rb:46\n (root) at file:/C:/my_jruby_project/my_jruby_project.jar!/my_jruby_project/bin/my_jruby_file.rb:4\n load at org/jruby/RubyKernel.java:1058\n (root) at file:/C:/my_jruby_project/my_jruby_project.jar!/my_jruby_project/bin/my_jruby_file.rb:1\n require at org/jruby/RubyKernel.java:1033\n require at file:/C:/my_jruby_project/my_jruby_project.jar!/META-INF/main.rb:36\n (root) at &lt;script&gt;:3\n\nC:\\my_jruby_project&gt;\n\n\nThe generated JAR includes the lib/java/ojdbc6.jar but it seems internal file or path pointers are not configure correctly.\n\nAppreciate any assistance. Thanks!" ]
[ "jar", "jruby", "warbler" ]
[ "Accessing data return by onActivityResult in onCreate function", "In Android/Kotlin, I am launching a new activity with startActivityForResult in my onCreate function, and get the returned variable (let's called it X) from onActivityResult outside of the onCreate function. Subsequently i want to access the variable X in the onCreate function to display it on the screen. However it never displays the data as if it were empty.\n\nAny ideas of what I might be doing wrong? Thanks\n\nHere is the code. When the user clicks on notesView it launches a new activity (Notes2Activity) where the user can enter its note in a full screen. Then upon validation of the note the code return to the previous activity where I am trying to edit the content of NotesView to returnNotes, but the app crashes.\n\noverride fun onCreate(savedInstanceState: Bundle?) \n{\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_new_contact)\n\nval notesView: TextView\nnotesView = findViewById&lt;TextView&gt;(R.id.inputNotes)\n\nnotesView.setOnClickListener {\n val intent = Intent(this, Notes2Activity::class.java)\n startActivityForResult(intent,2)}}\n\noverride fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {if (resultCode == Activity.RESULT_OK) {\n if(data != null) {\n val returnNotes: String = data.getSerializableExtra(\"notesEntered\") as String\n var returnNotesInputs = returnNotes\n notesView.setText(\"\")\n notesView.append(returnNotes)\n Log.d(TAG, \"note returned to newContactActivity is: $returnNotes\")}}\n else if (resultCode == Activity.RESULT_CANCELED) \n {Log.d(TAG, \"user clicked canceled in Notes2Activity\")}\n}" ]
[ "android", "kotlin", "oncreate", "onactivityresult" ]
[ "Accessing a thread's private memory in OpenMP", "According to the OpenMP Memory Model, the following is incorrect:\n\nint *p0 = NULL, *p1 = NULL;\n#pragma omp parallel shared(p0,p1)\n{\n int x;\n // THREAD 0 // THREAD 1\n p0 = &amp;x; p1 = &amp;x;\n *p1 ... *p0 ...\n}\n\n\nMy example looks like the following though:\n\nint *p0 = NULL, *p1 = NULL;\n#pragma omp parallel shared(p0,p1)\n{\n int x;\n // THREAD 0 // THREAD 1\n p0 = &amp;x; p1 = &amp;x;\n #pragma omp flush\n\n #pragma omp barrier\n *p1 ... *p0 ...\n #pragma omp barrier\n}\n\n\nWould this be incorrect? I cannot find something in the memory model that would disallow this.\n\nI assume that my toy example is correct, as in the memory model in 3.1 they allow a task to have access to a private variable as long as the programmer ensures that it is still alive. Given the fact that tasks can be untied, they can in theory execute within a different worker thread, therefore allowing an OpenMP thread access to the private memory of another." ]
[ "c++", "c", "multithreading", "openmp" ]
[ "Position to the right when it's float to the left", "I have a menu and a logo on the header, and I am struggling to make the logo to be at the far edge of the left side of the website and the menu to the edge of the right side. \n\nThe problem is, when both of them are displayed as inline-block which means they are going to float to the default orientation which is left, I can't figure out a way to change this, please help. \n\nHere's the CSS code: \n\n/*Header*/\n.wrapperHeader{\n background-color: #FFFFFF;\n border-bottom: 1px solid #DDDDDD;\n\n width: 100%;\n padding: 15px 0px;\n z-index: 1000;\n}\n\n.content{\n width: 1000px;\n max-width: 100%;\n margin: auto;\n} \n\n.header-logo, #logoImage{\n width: 250px;\n max-width: 100%;\n\n display: inline-block;\n vertical-align: middle;\n}\n\n/*Main Menu*/\n.header-menu{\n width: 690px;\n max-width: 100%;\n\n display: inline-block;\n vertical-align: middle;\n}\n\n#MainMenu li{\n position: relative;\n padding: 15px;\n display: inline-block;\n right: 0px;\n}\n\n\nNote: in the html, the logo is in a section and the menu is in anther section and both of them are inside a divide. \n\nHTML code: \n\n&lt;header&gt;\n &lt;div class=\"wrapperHeader\"&gt;\n &lt;div class=\"content\"&gt;\n &lt;section class=\"header-logo\"&gt;\n &lt;a href=\"index.html\"&gt;&lt;img id=\"logoImage\" src=\"assets/elements/logo.png\" alt=\"LOAI Design Studio Logo\"/&gt;&lt;/a&gt;\n &lt;/section&gt;\n &lt;section class=\"header-menu\"&gt;\n &lt;nav id=\"MainMenu\"&gt; \n &lt;ul&gt;\n &lt;li&gt;&lt;a class=\"active\" href=\"index.html\"&gt;Home&lt;/a&gt;&lt;/li&gt;\n &lt;li id=\"PortfolioMenu\"&gt;&lt;a id=\"Portfolio\" href=\"#\"&gt;Portfolio&lt;/a&gt;\n &lt;ul class=\"subMenu\"&gt;\n &lt;li&gt;&lt;a href=\"web-design.html\"&gt;Web Design&lt;/a&gt;&lt;/li&gt;\n &lt;li&gt;&lt;a href=\"visual-identity.html\"&gt;Visual Identity&lt;/a&gt;&lt;/li&gt;\n &lt;li&gt;&lt;a href=\"photography.html\"&gt;Photography&lt;/a&gt;&lt;/li&gt;\n &lt;/ul&gt;\n &lt;/li&gt;\n &lt;li&gt;&lt;a href=\"testimonials.html\"&gt;Testimonials&lt;/a&gt;&lt;/li&gt;\n &lt;li&gt;&lt;a href=\"about.html\"&gt;About Me&lt;/a&gt;&lt;/li&gt;\n &lt;li&gt;&lt;a href=\"contact.html\"&gt;Get In Touch&lt;/a&gt;&lt;/li&gt;\n &lt;li&gt;&lt;a class=\"getStartedButton\" href=\"get-started.html\"&gt;Get Started&lt;/a&gt;&lt;/li&gt;\n &lt;/ul&gt;\n &lt;a href=\"#\" id=\"SmartMenu\"&gt;Menu&lt;p id=\"SmartMenu-logo\"&gt;LOAI Design Studio&lt;/p&gt;&lt;/a&gt;\n &lt;/nav&gt;\n &lt;/section&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;/header&gt;" ]
[ "css", "position" ]
[ "I want to use jsp variables in another jsp file", "for example, I have one.jsp file and two.jsp file.\nand two.jsp has a variable (int a) then, I want to use this variable &quot;a&quot; in one.jsp.\nI wrote : &lt;%@include file=&quot;/two.jsp&quot; %&gt; in one.jsp.\nthen page loaded http status 500 internal server error.\nand it said Exception while processing [/two.jsp].(I don't know it is right in English, I have a Korean message.)\nso I re-wrote : &lt;jsp:include page=&quot;two.jsp&quot; /&gt; in one.jsp.\nand then same thing loaded on my page.\nand it said Exception while processing [/two.jsp] again.\nI think something that i don't know was missed or my way was wrong (or both).\nhow can I use jsp variables in another jsp file?" ]
[ "jsp" ]
[ "How to pass arguments to a fragment using bottom navigation view and Android Navigation component?", "Is it possible to pass and access arguments in a fragment using a bottom navigation view and the Navigation component? \n\nI'm using a one activity with many fragments approach where my top level fragment requires an argument(Usually done via the newInstance generated method). I've had a look at the Navigation component developer guide and the codelab but it only mentions using safeargs and adding argument tags in the destinations and actions. \n\nHere's my navigation graph:\n\n&lt;navigation xmlns:app=\"http://schemas.android.com/apk/res-auto\" \n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\" \n app:startDestination=\"@id/homeFragment\"&gt;\n\n &lt;fragment android:id=\"@+id/homeFragment\"\n android:name=\"uk.co.homeready.homeready.HomeFragment\"\n android:label=\"fragment_home\"\n tools:layout=\"@layout/fragment_home\"&gt;\n &lt;!--Do I create an argument block here?--&gt;\n &lt;/fragment&gt;\n\n &lt;fragment android:id=\"@+id/calculatorFragment\"\n android:name=\"uk.co.homeready.homeready.CalculatorFragment\"\n android:label=\"fragment_calculator\"\n tools:layout=\"@layout/fragment_calculator\"/&gt;\n\n &lt;fragment android:id=\"@+id/resourcesFragment\"\n android:name=\"uk.co.homeready.homeready.ResourcesFragment\"\n android:label=\"fragment_resources\"\n tools:layout=\"@layout/fragment_resources\"/&gt;\n\n&lt;/navigation&gt;\n\n\nBottom Navigation View menu:\n\n&lt;menu xmlns:android=\"http://schemas.android.com/apk/res/android\"&gt;\n\n &lt;item\n android:id=\"@+id/homeFragment\"\n android:icon=\"@drawable/ic_home_black_24dp\"\n android:title=\"@string/title_home\"/&gt;\n\n &lt;item\n android:id=\"@+id/calculatorFragment\"\n android:icon=\"@drawable/ic_baseline_attach_money_24px\"\n android:title=\"@string/title_calculator\"/&gt;\n\n &lt;item\n android:id=\"@+id/resourcesFragment\"\n android:icon=\"@drawable/ic_baseline_library_books_24px\"\n android:title=\"@string/title_resources\"/&gt;\n\n&lt;/menu&gt;\n\n\nMainActivity:\n\noverride fun onCreate(savedInstanceState: Bundle?) {\n ...\n val navController = Navigation.findNavController(this, \n R.id.nav_host_fragment)\n bottom_navigation.setupWithNavController(navController)\n ....\n}\n\n\nactivity_main.xml\n\n&lt;android.support.constraint.ConstraintLayout&gt;\n &lt;fragment\n android:id=\"@+id/nav_host_fragment\"\n android:name=\"androidx.navigation.fragment.NavHostFragment\"\n app:layout_constraintBottom_toTopOf=\"@id/bottom_navigation\"\n app:defaultNavHost=\"true\"\n app:navGraph=\"@navigation/nav_graph\"/&gt;\n\n &lt;android.support.design.widget.BottomNavigationView\n android:id=\"@+id/bottom_navigation\"\n app:menu=\"@menu/bottom_navigation\"/&gt;\n\n&lt;/android.support.constraint.ConstraintLayout&gt;\n\n\nHomeFragment\n\noverride fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {\n val argument = //TODO access argument here\n ...\n}" ]
[ "android", "android-fragments", "bottomnavigationview", "android-jetpack", "android-architecture-navigation" ]