texts
sequence
tags
sequence
[ "Explicit instantiation of templated class in source file not working", "I'm trying my hand at some template stuff, and the first thing I wanted to do was to separate templated classes into .hpp and .cpp files. All examples I've found say to just include\n\ntemplate class Foo<int>;\n\n\nat the bottom of the .cpp-file, but I can't get this to work. Here is a minimal example:\n\nfoo.hpp\n\n#pragma once\n\ntemplate<typename T>\nclass Foo\n{\npublic:\n Foo(T t);\n\nprivate:\n T _t;\n};\n\n\nfoo.cpp\n\n#include \"foo.h\"\n\ntemplate<typename T>\nFoo<T>::Foo(T t) : _t(t) {}\n\ntemplate class Foo<int>; // explicit instantiation\n\n\nmain.cpp\n\n// main.cpp\n#include \"foo.hpp\"\n\nint main()\n{\n Foo<int> a(5);\n}\n\n\nThis does not compile, but gives an error undefined reference to 'Foo<int>::Foo(int)'\n\n$ g++ main.cpp -o main\nC:\\msys64\\tmp\\cc4EtmTs.o:main.cpp:(.text+0x1a): undefined reference to `Foo<int>::Foo(int)'\ncollect2.exe: error: ld returned 1 exit status\n\n\nI'm using MSYS2, with gcc 8.3.0 (Rev2, Built by MSYS2 project). Any idea what I'm doing wrong?" ]
[ "c++", "templates" ]
[ "How to serialize ArrayList of objects?", "I want to serialize an arraylist of Item but it doesn't work....\n \n my Item class extends Stuff class and has some subclasses.\n \n all of my classes implement Serilalizable.\n \n i have this part :\n\ntry{\n// Serialize data object to a file\nObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(\"MyData.ser\"));\nout.writeObject(myData);\nout.close();\n\n// Serialize data object to a byte array\nByteArrayOutputStream bos = new ByteArrayOutputStream() ;\nout = new ObjectOutputStream(bos) ;\nout.writeObject(myData);\nout.close();\n\n// Get the bytes of the serialized object\nbyte[] buf = bos.toByteArray();\n} catch (IOException e) {\n}\n\n \n my classes :\n\npublic class Stuff implements Serializeable{\n....\nsome protected fields\n.\n.\n}\n\npublic class Item extends Stuff implements Serializable{\n...\n..\n.\n} and some subclasses of Item:\n\npublic class FirstItem extends Item implements Serializable{\n...\n}\n\npublic class SecondItem extends Item implements Serializable{\n...\n} ... I want to serialize an object contains ArrayList of <Item> that has objects of Item's subclasses (FirstItem,SecondItem,...)\n\n \n i think informations are sufficient...\n\n\nit's just a little mistake and now works correctly...\nI'm sorry for my stupid question.\n\nThank you for your answers." ]
[ "java", "serialization", "arraylist", "subclass", "extend" ]
[ "create ListView of files after deleting and recreating of new files", "I have a folder within the cache folder of my application. When I click on a sync button that calls the tasks. It then connects to a server and request the latest information. These are returned to me in json format. I then want to clear the folder of the contents of the files that are no longer in the returned json. In testing I delete all child objects of the folder and recreate them. I use an Async task to do this. But after, it doesn't always return all contents of the folder. I sometimes have to press sync twice.\n\nThe json format\n\n {\n \"success\" : \"1\",\n \"forms\" : [\n {\n \"cid\" : \"3\",\n \"name\" : \"File 1\",\n \"fid\" : \"1\"\n },\n {\n \"cid\" : \"3\",\n \"name\" : \"File 2\",\n \"fid\" : \"2\"\n },\n {\n \"cid\" : \"3\",\n \"name\" : \"File 3\",\n \"fid\" : \"3\"\n }\n ]\n }\n\n\nThe code below is the code I use to delete the files.\n\n String[] children = homeDir.list();\n for(int i = 0; i < children.length; i++){\n new File(homeDir, children[i]).delete();\n }\n\n\nThis is what I use to get the json from the server\n\n JSONObject json = jParser.makeHttpRequest(files, \"GET\", params);\n\n\nThen I go through the json and create the file using the name as reference.\n\n JSONArray files = json.getJSONArray(TAG_FILES);\n\n for(int i = 0; i < files.length(); i++){\n JSONObject c = files.getJSONObject(ii);\n String fileName = c.getString(TAG_NAME);\n\n createfile(fileName);\n }\n\n\nBelow is the code of the Async task that scans the HomeDir and then updates the ListAdapter with the files found. \n\n static File homeDir;\n File Userfolder = new File(cache + \"/\" + uid);\n\n ArrayList<HashMap<String, String>> filesList = new ArrayList<HashMap<String, String>>();\n\n\n private class UpdateList extends AsyncTask<String,String,String>{\n\n @Override\n protected String doInBackground(String... params) {\n\n try{\n\n File directory = homeDir;\n\n File[] files = directory.listFiles();\n for(int i = 0; i < files.length; i++){\n String name = files[i].getName();\n\n HashMap<String, String> files = new HashMap<String, String>();\n\n\n files.put(\"name\", name);\n filesList.add(files);\n }\n\n }catch(NullPointerException e){\n e.printStackTrace();\n }catch(Exception e){\n e.printStackTrace();\n }\n\n return null;\n }\n\n protected void onPostExecute(String file_url){\n try{\n runOnUiThread(new Runnable(){\n public void run(){\n ListAdapter adapter = new SimpleAdapter(\n MainActivity.this,\n filesList,\n R.layout.activity_main,\n new String[] {\"name\"},\n new int[]{R.id.fileName}\n );\n setListAdapter(adapter);\n }\n });\n }catch (Exception e){\n e.printStackTrace();\n }\n }\n\n }\n\n\nAlthough the above code sometimes will only display a few items out of the list of files that are in the directory. When I check the directory the files are there. If I restart the process, all files will appear in the list. Do it again it repeats the problem of only showing a few files.\n\nThanks in advance" ]
[ "android", "android-asynctask", "listactivity" ]
[ "Add tabcontrol to dynamically created tab control in winforms", "I've a tabcontrol on my page with 2 tabs. Now I want to create another tabcontrol dynamically and want to add the existing tab control to dynamically created tab control tabs.\n\nIs is possible? I'm not able to add this.\n\nHere is my code:\n\n TabControl tbdynamic = new TabControl();\n TabPage tbpaagedynamic = new TabPage();\n tbpaagedynamic.Controls.Add(statictabcontrol);\n tbdynamic.TabPages.Add(tbpaagedynamic);\n\n\nAny idea?" ]
[ "c#", "winforms" ]
[ "Send custom value/data to PayPal (Express Checkout)", "I am following this tutorial PHP Shopping Cart to PayPal (Express Checkout). Can anyone tell me how can I send any custom/additional data/value to paypal e.g. I want to send an Order Number and a Customer ID that belongs to a particular order among these 4 variables as below:\n\n$paypal_data .= '&L_PAYMENTREQUEST_0_QTY'.$key.'='. urlencode($_POST['item_qty'][$key]);\n$paypal_data .= '&L_PAYMENTREQUEST_0_AMT'.$key.'='.urlencode($_POST['item_price'][$key]);\n$paypal_data .= '&L_PAYMENTREQUEST_0_NAME'.$key.'='.urlencode($_POST['item_name'][$key]);\n$paypal_data .= '&L_PAYMENTREQUEST_0_NUMBER'.$key.'='.urlencode($_POST['item_code'][$key]);" ]
[ "php", "paypal", "express-checkout" ]
[ "Toggle jQuery .animate function?", "I'm trying to create a situation where on click, menu items slide out then spread out vertically. I've kind of achieved this but when the menu is closed and reopened, the menu items pickup where they left off and spread out even further!\n\nHow do I toggle or reset the vertical movement?\n\nMy jQuery:\n\n $('.box').click(function(){\n $('.tab1').toggle(\"slide\", { direction: \"left\"}, 500);\n $('.tab2').toggle(\"slide\", { direction: \"left\" }, 500);\n $('.tab3').toggle(\"slide\", { direction: \"left\" }, 500);\n});\n $('.box').click(function(){\n $('.tab1').animate({top:'+=50px'}); \n $('.tab3').animate({top:'-=50px'}); \n});\n\n\nhtml:\n\n<div class=\"square\">\n <div class=\"box\">\n CLICK\n <div class=\"tab1 tab\"></div>\n <div class=\"tab2 tab\"></div>\n <div class=\"tab3 tab\"></div>\n </div>\n</div>\n\n\ncss:\n\n.square{\n margin-left:100px;\n}\n.box{\n position:relative;\n width:150px;\n height:150px;\n background-color:#000;\n color:#fff;\n text-align:center;\n\n }\n\n.tab{\n width:70px;\n height:40px;\n background-color:grey;\n display:none;\n}\n.tab1{\n position:absolute;\n right:-70px;\n top:50px;\n}\n.tab2{\n position:absolute;\n right:-70px;\n top:50px;\n}\n\n.tab3{\n position:absolute;\n right:-70px;\n top:50px;\n}\n\n\nJSFiddle" ]
[ "javascript", "jquery" ]
[ "How does strtok_s tokenize a char*?", "It seems to have modified the original string that I wanted to split specifying tokens.\n\nhow does it return back a substring if it can't copy from memory?\n\nI'm also looking for an alternative that accepts a const char* Or doesn't modify the orignal string.\n\nOr is it safe to just const_cast the string to remove the const property and let it be handled by strtok_s(char*, const char*, char**).?" ]
[ "c" ]
[ "WebAPI Serialization problems when consuming Recurly Rest API which returns XML", "I'm new to the ASP.Net Web API. I'm trying to interact with the Recurly REST based API and I am getting errors like below during my ReadAsAsync call which is the point I believe it attempts to serialize the response.\n\n{\"Error in line 1 position 73. Expecting element 'account' from namespace 'http://schemas.datacontract.org/2004/07/RecurlyWebApi.Recurly'.. Encountered 'Element' with name 'account', namespace ''. \"}\n\n\nHere is my HttpClient implementation, simplified for brevity:\n\n public class RecurlyClient\n {\n readonly HttpClient client = new HttpClient();\n\n public RecurlyClient()\n {\n var config = (RecurlySection)ConfigurationManager.GetSection(\"recurly\");\n\n client.BaseAddress = new Uri(string.Format(\"https://{0}.recurly.com/v2/\", config.Subdomain));\n\n // Add the authentication header\n client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(\"Basic\", Convert.ToBase64String(Encoding.ASCII.GetBytes(config.ApiKey)));\n\n // Add an Accept header for XML format.\n client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application/xml\"));\n }\n\n public T Get<T>(string id)\n {\n var accounts = default(T);\n\n // Make the request and get the response from the service\n HttpResponseMessage response = client.GetAsync(string.Concat(\"accounts/\", id)).Result; // Blocking call!\n\n if (response.IsSuccessStatusCode)\n {\n // Parse the response body. Blocking!\n accounts = response.Content.ReadAsAsync<T>().Result;\n }\n\n return accounts;\n }\n }\n\n\nAnd here is my model:\n\n [XmlRoot(\"account\")]\n public class Account\n {\n [XmlAttribute(\"href\")]\n public string Href { get; set; }\n\n [XmlElement(\"account_code\")]\n public string AccountCode { get; set; }\n\n [XmlElement(\"state\")]\n public AccountState State { get; set; }\n\n [XmlElement(\"username\")]\n public string Username { get; set; }\n\n [XmlElement(\"email\")]\n public string Email { get; set; }\n\n [XmlElement(\"first_name\")]\n public string FirstName { get; set; }\n\n [XmlElement(\"last_name\")]\n public string LastName { get; set; }\n\n [XmlElement(\"company_name\")]\n public string Company { get; set; }\n\n [XmlElement(\"accept_language\")]\n public string LanguageCode { get; set; }\n\n [XmlElement(\"hosted_login_token\")]\n public string HostedLoginToken { get; set; }\n\n [XmlElement(\"created_at\")]\n public DateTime CreatedDate { get; set; }\n\n [XmlElement(\"address\")]\n public Address Address { get; set; }\n }\n\n\nAnd an example of the XML response from the service:\n\n<account href=\"https://mysubdomain.recurly.com/v2/accounts/SDTEST01\">\n <adjustments href=\"https://mysubdomain.recurly.com/v2/accounts/SDTEST01/adjustments\"/>\n <invoices href=\"https://mysubdomain.recurly.com/v2/accounts/SDTEST01/invoices\"/>\n <subscriptions href=\"https://mysubdomain.recurly.com/v2/accounts/SDTEST01/subscriptions\"/>\n <transactions href=\"https://mysubdomain.recurly.com/v2/accounts/SDTEST01/transactions\"/>\n <account_code>SDTEST01</account_code>\n <state>active</state>\n <username>myusername</username>\n <email>[email protected]</email>\n <first_name>First name</first_name>\n <last_name>Last name</last_name>\n <company_name>My Company Name</company_name>\n <vat_number nil=\"nil\"></vat_number>\n <address>\n <address1>My Address Line 1/address1>\n <address2>My Address Line 2</address2>\n <city>My City</city>\n <state>My State</state>\n <zip>PL7 1AB</zip>\n <country>GB</country>\n <phone>0123456789</phone>\n </address>\n <accept_language nil=\"nil\"></accept_language>\n <hosted_login_token>***</hosted_login_token>\n <created_at type=\"datetime\">2013-08-22T15:58:17Z</created_at>\n</account>" ]
[ "asp.net", "xml", "rest", "asp.net-web-api" ]
[ "How to export or retrieve Google Adwords data displayed in the main chart/graph?", "I'm attempting to download a month's work of daily data (broken up by day - see graph) that is displayed in Google Adwords administration page, but having no luck. There are downloadable buttons, but only show data below the graphs, not data in the graphs themselves.\nSee the attached picture of a Google graph that shows daily clicks, impressions, etc. Where do I get the DATA for this? Is this possible without having to get involved with their API? (I need a report tomorrow)" ]
[ "graph", "google-ads-api" ]
[ "bin/sh failed with exit code 1", "So I have a project that I have been working on in swift. When I run it on the simulator everything works perfectly. When I try to build and run on my phone I get this error\n\nI have deleted derived data.\nCleaned build with cmd+shift+alt+k\nDeleted from my phone and tried to reinstall everything\nNothing wokrs\n\n\n bin/sh failed with exit code 1\n\n\nI have attached a screenshot of what xcode says\n\n\n\nAny help would be appreciated" ]
[ "ios", "code-signing" ]
[ "Formatting dataframe to rows based on keys in a column", "I have a data-frame like one below:\n\ntag_id value time_stamp\ntag_1 1 2017-05-01 00:00:00\ntag_2 2 2017-05-01 00:00:00\ntag_3 3 2017-05-01 00:00:00\ntag_1 4 2017-05-01 00:10:00\ntag_2 5 2017-05-01 00:10:00\ntag_3 6 2017-05-01 00:10:00\n\n\nI want to format it as under, can someone please help?\n\ntime_stamp tag_1 tag_2 tag_3 \n2017-05-01 00:00:00 1 2 3\n2017-05-01 00:10:00 4 5 6" ]
[ "python", "pandas" ]
[ "Run a ClickOnce application from a webpage without user action", "We have a Java based web-application and also the same application written in C# which should be run if the java-checker finds out that there's no Java installed on the client machine. The idea is to run the C# ClickOnce application automatically, without any user action, once the Java checker reports that there's no Java installed on the machine. Is that possible and if yes - how?" ]
[ "c#", "javascript", "clickonce" ]
[ "iOS split keyboard messes up cordova webview", "I am working on a hybrid app using Cordova and Ionic the app works fine on all iOS devices except iPad that too with split key board\n\nThe problem i face is posted here you can see the image in the post.\n\nI tried to do some research and found out this\n\nAlso on stack overflow I found out this preference in config see answer but this is not documented neither does it work\n\nPlease help" ]
[ "ios", "cordova", "ipad", "keyboard", "ionic" ]
[ "Listing variables from external script python without the built-in and imported variables", "I'm writing a python script that gets parameters from a json file, opens a template script specified by one of the parameters (from a set of options), and generates a new python script replacing some of the template script with the parameters given in the json. \n\nI'm currently trying to list all variables from the template as follows:\n\nlist = [item for item in dir(imported_script) if not item.startswith(\"__\")]\n\n\nSo I can use the list to iterate over the variables and write them in the new script.\n\nProblem: this result list also contains the imported modules from the mentioned imported template script. I've also tried with imported_script.__dict__ and vars(imported_script) but these solutions yield to the same. There is also the option of using help(imported_script) which returns the metadata of the script, but until now I haven't found a correct way to get what would be the equivalent to help(imported_script).DATA.\n\nQuestion: Is there a more efficient way of listing the imported script variables so I get specifically the user declared variables?\n\nMore context: I'm using Airflow to generate workflows. Airflow reads a python script that specifies how the workflow (known as DAG in airflow) should be constructed. The script should be in a specific folder so airflow can make the workflow. The specifications of how the workflow should be constructed are given in a json file and vary every time the user wants to generate a workflow, so I must read this json file and then write a new script reusing the code from the template (at least that's the way I've been told to do it). There are several scripts from which I could take the code to reuse and in the future there could be even more (It's dynamic). The script to be chosen depends on one of the parameters in the json." ]
[ "python", "import", "module", "metaprogramming", "airflow" ]
[ "Android Spinner dropdown with value", "I have been searching for an example/demo on spinner showing display text tie with value/id.\nEg.\nAB ItemAB\nBC ItemBC\nCD ItemCD\nThe screen will show list of dropdown of ItemAB, ItemBC... but when I get the value it should give the code AB, BC or CD.\nMost of the example I show were simple_spinner_dropdown_item.\nI am not sure what words to search for this example, I tried spinner custom layout without success. \nThanks." ]
[ "android" ]
[ "Show the Redux state React", "I don't know why my console.log(el) display elements of filters object like array - just names as string type. \n\nmapReducer.js\n\nconst initState = {\n filters: {\n basen: {\n active: true,\n name: 'BASEN'\n },\n koszykowka: {\n active: true,\n name: 'KOSZYKÓWKA'\n },\n pilka_nozna: {\n active: true,\n name: 'PIŁKA NOŻNA'\n },\n pilka_reczna: {\n active: true,\n name: 'PIŁKA RĘCZNA'\n },\n siatkowka: {\n active: true,\n name: 'SIATKÓWKA'\n },\n tenis: {\n active: true,\n name: 'TENIS'\n }\n }\n}\n\n\nobjectFilters.js\n\n{Object.keys(this.props.filters).map((el, i) => {\n console.log(el)\n return(\n <ObjectFiltersElement \n key={i} \n name={el.name} \n active={el.active} \n changeFilterHandler={(el) => (this.changeFilterHandler(el))}\n />\n )\n })}\n\n\nobjectFiltersElement.js\n\n<div className={elementStyle} onClick={() => props.changeFilterHandler(props.name)}>\n {props.name}\n</div>\n\n\nAnd console.log(el) give me this:\n\n\nElements of filters not as objects but as strings.\n\nWhen I am tring get to active or name of object I got undefinded.\n\n console.log(\"THIS.PROPS.FILTERS\", this.props.filters)" ]
[ "reactjs", "redux" ]
[ "I can use value preg_match only once", "I have a preg_match command ;\n\n<?php\n $content = \"<span class='hotels'><div id='general_parcel_id'></div></span>\";\n $wanted=preg_match ('/<span class=\\'hotels\\'>(.*?)<\\/span>/', $content, $result);\n $resultant = $result[1];\n?>\n\n\nNote : <div id='general_parcel_id'></div> prints an id for each product on the page.\n\nand finally I want to use this $resultant variable, for a database connection. \n\nEx.\n\n$dbase = mysql_fetch_array(mysql_query(\"select * from hotex WHERE parcel_id = '$resultant'\"));\n\n\nbut this is not possible. Write the result as variable once. Only once\n\nThank you in advance ..." ]
[ "php", "html", "variables", "preg-match" ]
[ "android start activity from background thread", "My app creates a timer task (background thread) and periodically need to display something. Main screen maybe hidden later by other apps. I found out (AFAIRemember on stackoverflow) that for making toast notification I need to use runOnUiThread runnable(just Toast.makeText crashed the app).\n\nNow I want my background thread to be able to collect user input. I created activity class with layout and call it via intent\n\nIntent intent = new Intent(this, screen2.class);\nstartActivityForResult(intent, 1);\n\n\nWhen main screen is active, my new screen shows fine. But when main screen hidden, my other screen is hidden and I see it only when I make my app active again via Recents button.\n\nI tried to run intent for second screen via runOnUiThread runnable - same result - new screen hidden until my app is active.\n\nHow can background thread display some activity on screen (UI thread)?\n\nP.S. \n\nIntent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\nstartActivity(takePictureIntent); \n- displayes camera screen hidden, whereas action call below bring call screen on top of other app currently on screen\n\ncallIntent.setData(Uri.parse(\"tel:\" + Uri.encode(\"+79851559700\")));\n\n callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n\n callIntent.setPackage(\"com.android.phone\");\n try {\n startActivity(callIntent);\n\n\nAdding Intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); to camera intent made camera screen display from background timer tast, however it did not made my activity to do it.\n\nChanging to intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); made second screen appear on foreground however somehow it replaced main screen." ]
[ "android", "multithreading", "user-interface", "background-process" ]
[ "GraphFrames detect exclusive outbound relations", "In my graph I need to detect vertices that do not have inbound relations. Using the example below, \"a\" is the only node that is not being related by the anyone. \n\na --> b\nb --> c\nc --> d\nc --> b\n\n\nI would really appreciate any examples to detect \"a\" type nodes in my graph.\n\nThanks" ]
[ "apache-spark", "graphframes" ]
[ "Coordinate translation issues", "I've been handed a csv file containing a series of coordinates, from which lines should be drawn on top of a bitmap grid; I can get the values out and convert them into ints for the DrawLine function, etc, just fine.\n\nThe problem is that these coordinates are basically percentages; x:0.5 and y:0.5 represent dead centre (being 50% of X and 50% of Y) and x:1.0/y:1.0 would be in the top right regardless of the absolute dimensions of what is being plotted on to (in this instance a 1000x1500 bitmap). In addition screen/window coordinates start in the top left which doesn't affect the x-axis but the y-axis needs to be somehow inverted.\n\nSo what do I need to do to the coordinates to get them to plot correctly? To be honest I've got the X-axis working fine, it's the Y-axis giving me the problems.\n\n(The window containing the bitmap is 1600x1600, FWIW.)" ]
[ "c#", "coordinates", "transform" ]
[ "Running PHP Scripts in R", "There's a PHP library that I'm really interested in using. However, there's no R implementation of it nor do I see an interpreter between the two. I've searched on Google but it seems like most implementations are either displaying R plots or figures on a webpage via PHP or passing command-line arguments to each script. R blogger article about PHP and R seemed to be geared towards building a web application. \n\nI've seen reticulate package achieve similar this within Python, but I was hoping we have something like this for PHP. \n\nI've thought of a method of passing it through via exec(paste0('php ', <script>), but I don't think that's the best direction to take. \n\nAre there better ways to implement this?" ]
[ "php", "r", "command-line-interface" ]
[ "NodeJS npm install pg failed", "Im trying to npm install pg on my ubuntu virtual machine and i got error:\n\n> [email protected] install /usr/local/lib/node_modules/core/node_modules/pg\n> node-gyp rebuild || (exit 0)\n\ngyp: binding.gyp not found (cwd: /usr/local/lib/node_modules/core/node_modules/pg) while trying to load binding.gyp\ngyp ERR! configure error \ngyp ERR! stack Error: `gyp` failed with exit code: 1\ngyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)\ngyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)\ngyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)\ngyp ERR! System Linux 3.11.0-12-generic\ngyp ERR! command \"nodejs\" \"/usr/bin/node-gyp\" \"rebuild\"\ngyp ERR! cwd /usr/local/lib/node_modules/core/node_modules/pg\ngyp ERR! node -v v0.10.15\ngyp ERR! node-gyp -v v0.10.9\ngyp ERR! not ok \nnpm ERR! \nnpm ERR! Additional logging details can be found in:\nnpm ERR! /root/npm-debug.log\nnpm ERR! not ok code 0\n\n\nnodejs -v\nv0.10.15\nnpm -v\n1.2.18\n\n\nAny idea how to fix it?" ]
[ "node.js", "installation", "npm", "gyp" ]
[ "Mean between n and n+1 row in pandas groupby object?", "I have a groupby object:\n\n col1 col2 x y z\n0 A D1 0.269002 0.131740 0.401020\n1 B D1 0.201159 0.072912 0.775171\n2 D D1 0.745292 0.725807 0.106000\n3 F D1 0.270844 0.214708 0.935534\n4 C D1 0.997799 0.503333 0.250536\n5 E D1 0.851880 0.921189 0.085515\n\n\nHow do I sort the groupby object into the following:\n\n col1 col2 x y z\n0 A D1 0.269002 0.131740 0.401020\n1 B D1 0.201159 0.072912 0.775171\n4 C D1 0.997799 0.503333 0.250536\n2 D D1 0.745292 0.725807 0.106000\n5 E D1 0.851880 0.921189 0.085515\n3 F D1 0.270844 0.214708 0.935534\n\n\nAnd then compute the means between Row A {x, y, z} and Row B {x, y, z}, Row B {x, y, z} and Row C {x, y, z}... such that I have:\n\n col1 col2 x_mean y_mean z_mean\n0 A-B D1 0.235508 0.102326 0.58809\n1 B-C D1 ... ... ...\n4 C-D D1 ... ... ...\n2 D-E D1 ... ... ...\n5 E-F D1 ... ... ...\n3 F-A D1 ... ... ...\n\n\nI am basically trying to computationally find the midpoints between vertices of a hexagonal structure (well... more like 10 million). Hints appreciated!" ]
[ "python", "pandas", "pandas-groupby", "rolling-computation", "rolling-average" ]
[ "Redirect python stdout to a tempfile", "I am aware of: Redirect stdout to a file in Python?\nI'm asking how to go about the following:\nIn [2]: with tempfile.NamedTemporaryFile() as tmp:\n ...: contextlib.redirect_stdout(tmp):\n ...: print('this')\n\nWhich errors with:\nTypeError: a bytes-like object is required, not 'str'\n\nFrom the docs (https://docs.python.org/3/library/contextlib.html#contextlib.redirect_stdout):\n\nContext manager for temporarily redirecting sys.stdout to another file or file-like object.\n\nSearching for which gave me this post: What is exactly a file-like object in Python? which states:\n\nAn object exposing a file-oriented API (with methods such as read() or write()) to an underlying resource\n\nWhich made me think perhaps the following would work:\nIn [2]: with tempfile.NamedTemporaryFile() as tmp:\n ...: contextlib.redirect_stdout(tmp.file):\n ...: print('this')\n\n\nas tmp.file has read and write from dir(tmp.file) (so, is "file like" ? ).\nThis still errors though, with the same error message.\nSo, how should I go about redirecting standard out to a temporary file?" ]
[ "python", "stdout" ]
[ "Comparisons of Oracle DATE column with java.sql.timestamp via JOOQ", "I am using jooq to build queries for Oracle. Everything works fine except for dates:\n\npublic static void main(String[] args) throws SQLException {\n java.sql.Timestamp now = new java.sql.Timestamp(new Date().getTime());\n Connection con = DriverManager.getConnection(... , ... , ...);\n final Factory create = new OracleFactory(con);\n Statement s = con.createStatement();\n s.execute(\"create table test_table ( test_column DATE )\");\n s.execute(\"insert into test_table values (to_date('20111111', 'yyyymmdd'))\");\n\n // -- using to_date\n ResultSet rs = s.executeQuery(\"select count(1) from test_table where test_column<to_date('20121212', 'yyyymmdd')\");\n rs.next();\n System.out.println(\"\"+rs.getInt(1));\n rs.close(); \n\n // -- using a preparedstatement with java.sql.timestamp\n PreparedStatement ps = con.prepareStatement(\"select count(1) from test_table where test_column<?\");\n ps.setTimestamp(1,now);\n rs = ps.executeQuery();\n rs.next();\n System.out.println(\"\"+rs.getInt(1));\n rs.close();\n\n // -- using jooq with java.sql.timestamp\n final org.jooq.Table<org.jooq.Record> table = create.tableByName(\"TEST_TABLE\");\n final org.jooq.SelectSelectStep sss = create.select(create.count());\n final org.jooq.SelectJoinStep sjs = sss.from(table);\n final org.jooq.SelectConditionStep scs = sjs.where(create.fieldByName(\"TEST_COLUMN\").lessThan(now));\n System.out.println(scs.toString());\n rs = s.executeQuery(scs.toString());\n rs.next();\n System.out.println(\"\"+rs.getInt(1));\n rs.close();\n\n s.close();\n\n}\n\n\nGives the following output:\n\n 1\n 1\n select count(*) from \"TEST_TABLE\" where \"TEST_COLUMN\" < '2012-12-12 19:42:34.957'\n Exception in thread \"main\" java.sql.SQLDataException: ORA-01861: literal does not match format string\n\n\nI would have thought that JOOQ would check the type of Object in lessThan(Object)\nto determine whether it can come up with a reasonable conversion, but apparently it\njust does an Object.toString() in this case. I also remember that I never had issues with date queries via JOOQ in MySQL (although this is a while back). What am I doing wrong?" ]
[ "oracle", "date", "jooq" ]
[ "PropertyResource injection from execution directory?", "I'm using Spring to inject a resource file from src/main/resources with:\n\n@PropertySource(\"classpath:/app1/abc.properties\")\n\nNow I'd like to move the file to the root of the excution directory, thus outside the jar. So that properties can be modified without having to alter the jar.\nHow can this be done?" ]
[ "java", "spring" ]
[ "Search for a text starting with a character and of specific length", "$sourceArray = array('venkat', 'bala', 'vignesh', 'vardan', 'harishv');\n\n\noutput must be an array which has values starting with 'v' and of length 6 chars.\n\nFollowing must be the output array for the above sourceArray as input \n\n$outputArray = ('venkat','vardan');\n\n\nI tried preg_grep('/^([v.]{6,6})/',$sourceArray)); which returned my an empty array.\n\nCan anyone tell me where I went wrong?" ]
[ "php", "regex" ]
[ "Unable to invoke native functions from the javascript, in Phonegap", "This is what I did:\n\n1) Installed Cordova version 2.0.0\n\n2) My XCode Version is 4.3.3\n\n3) Created a phone gap project by ./create command. \n\n4) in index.html:\n\n<script type=\"text/javascript\">\n\n function nativePluginResultHandler (result) \n { \n alert(\"SUCCESS: \\r\\n\"+result ); \n } \n\n function nativePluginErrorHandler (error) \n { \n alert(\"ERROR: \\r\\n\"+error ); \n } \n\n function callNativePlugin( returnSuccess ) \n { \n alert(\"Invoking..\");\n HelloPlugin.callNativeFunction( nativePluginResultHandler, nativePluginErrorHandler, returnSuccess ); \n } \n</script>\n\n\n<h1>Hey, it's Cordova!</h1> \n<button onclick=\"callNativePlugin('success');\">Click to invoke the Native Plugin with an SUCCESS!</button> \n<button onclick=\"callNativePlugin('error');\">Click to invoke the Native Plugin with an ERROR!</button> \n\n\n5) Inside HelloPlugin.js:\n\nvar HelloPlugin = { \n callNativeFunction: function (success, fail, resultType) { \n echo \"Welcome\";\n return Cordova.exec( success, fail, \"com.mycompany.HelloPlugin\", \"nativeFunction\", [resultType]); \n } }; \n\n\n6) HelloPlugin.m:\n\n#import \"HelloPlugin.h\"\n\n@implementation HelloPlugin\n\n- (void) nativeFunction:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { \n //get the callback id \n NSString *callbackId = [arguments pop]; \n NSLog(@\"Hello, this is a native function called from PhoneGap/Cordova!\"); \n NSString *resultType = [arguments objectAtIndex:0]; \n CDVPluginResult *result; \n if ( [resultType isEqualToString:@\"success\"] ) \n { \n result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @\"Success :)\"]; \n [self writeJavascript:[result toSuccessCallbackString:callbackId]]; \n } else { \n result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString: @\"Error :(\"]; \n [self writeJavascript:[result toErrorCallbackString:callbackId]]; \n }\n} \n\n@end\n\n\n7) HelloPlugin.h:\n\n#import \"Cordova/CDVPlugin.h\"\n#import \"Cordova/CDV.h\"\n\n@interface HelloPlugin : CDVPlugin\n\n\n- (void) nativeFunction:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;\n\n\n@end\n\n\n8) In Cordova.plist, I added the the following key/value:\n\ncom.mycompany.HelloPlugin HelloPlugin\n\n\nThe problem is that the native function from the HelloPlugin is not getting invoked at all. \n\nWhat am I missing here?\n\nHelp would be really appreciated." ]
[ "objective-c", "ios5", "cordova", "ios4", "phonegap-plugins" ]
[ "custom Linux kernel build failure in vmware workstation", "While trying to compile/build and boot custom kernel inside vmware workstation, while booting new kernel, it fails and falls to shell with error "failed to find disk by uuid".\nI tried this with both ubuntu and centos.\n\nThings I tried but didn't help\n\n\ncheck mapping by uuid in boot entry and existence in directory.\ninitramfs-update\nreplaced root=uuid=<> with /dev/disk/sda3\n\n\nis it issue with vmware workstation?\nhow can it be rectified..??" ]
[ "linux-kernel", "vmware-workstation", "ubuntu-15.04" ]
[ "Upgrading Jython from 2.2.1 version to 2.5.2, possible risks", "We want to upgrade our version of Jython to 2.5.2. After reading documentation and testing, it seems like the only thing we have to do is to add the encoding magic comment in the beginning of each python file, i.e. #encoding=utf-8\n\nIt seems too easy but I am afraid of possible errors appearing in the future.\n\nHas anyone gone through this? Any backward compatibilities?\n\nThanks!" ]
[ "python", "upgrade", "jython", "backwards-compatibility", "jython-2.5" ]
[ "Return number of entries that have non-zero decimal places", "Representative dataframe:\n X\n 15.00\n 12.01\n 14.24\n 4.00\n 23.05\n 67.00\n\nI there a way I can use the sum() function to return the frequency of cells that have non-zero decimal places (i.e.: entries in X that are not whole numbers?).\nIn the above examples, this would be 3 entries." ]
[ "r" ]
[ "How do I unit test Javascript files that call library functions defined externally?", "Let's say I have my awesome.html file with\n\n<head>\n<script .. abc-library.js>\n<script .. app.js>\n</head>\n\n\nand I would like to unit-test my own file, app.js.\n\nbut inside my app.js, I am calling something defined in abc-library.js, say like this\n\n...\nhandy_function_from_abcjs(\"do something here\");\n...\n\n\nOf course when I load my awesome.html in the browser, it works fine because I defined my handy_function before app.js, so my app.js sees it...\n\nBut, problem when I run the unit test on app.js, because it only loads app.js alone, and it will fail because it can't find handy_function's definition.\n\nHow is this kind of situation solved in those javascript unit test definitions? This is always encountered right?\n\nI hit into this problem now when I am using karma to test out my beginner AngularJS app." ]
[ "javascript", "unit-testing" ]
[ "android - where to save history and autocomplete values", "my history objects only have 2 fields (id + name). i have to save them. i used sharedpreferences because this is just perfect to save key-value pairs. problem is..there is no possibilty to change to location where the files are saved. i dont want to save them into the sharedpref folder because i want to give the user of the app the possibility to delete all history entries. i have to check which files are history files and which files are preferences files used by the app. this is no proble..but dirty imo. on the other hand..my history files shouldnt be in sharedpref folder..they have nothing to do in that folder..\n\nthe other possibility is to store the data in internal storage as xml for example. i would have to write a serializer and parser.\n\nthe third possibility (i just remembered writing this question)is to save it via Java Properties. this is probably the easiest solution. its like sharedpref\n\nthe last possibility is to store it in sqlite. i dont know..my data is so tiny..and i use a databae to store it? \n\nmy question is simply..what do u recommend to use and why. what do you use? same question belongs to the autocomplete values. id like to save the values the user once entered in a textfield. where to save them? where do you save such data?\n\nthx in advance" ]
[ "android", "storage", "sharedpreferences" ]
[ "How to count occurence of partly-matching words with VB.NET?", "I am using VB 9.0 to split a text file and then count occurrences of the term <sequence>. Supposing I want also to count occurrences of the same term in a different format, e.g. <sequence and then group them together such that I output the result to a text box, i.e.\n\ntxtMyTerms.Text=<sequence>+<sequence\n\n\nHow to do it? My current code is as follows:\n\n Dim str As String = txtSource.Text\n Dim arr As String() = str.Split(Nothing)\n Dim searchTerm As String = \"<sequence>\"\n\n 'create query to search for the term <sequence>\n Dim matchQuery = From word In arr Where word.ToLowerInvariant() = searchTerm.ToLowerInvariant() Select word\n\n ' Count the matches.\n Dim count As Integer = matchQuery.Count()\n txtMyTerms.Text = count.ToString()" ]
[ "regex", "split", "linq-query-syntax" ]
[ "How to use testng to test serivce with session read and write?", "My service needs to get object from session like this:\n\n @Service(\"UsageService\")\n @Scope(value=\"session\") \n public class UsageServiceImpl implements UsageService\n {\n @Override\n public void doAnalysis()\n {\n // get data from session\n ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();\n HttpSession session = attr.getRequest().getSession();\n ......\n }\n }\n\n\nTest code like this\n\n@ContextConfiguration(locations = { \"test-context.xml\" })\n@Transactional\npublic class UsageServiceImplTest extends AbstractTestNGSpringContextTests\n{\n @Autowired\n private UsageService service;\n\n @Test\n public void testAnalysis()\n {\n service.doAnalysis(null);\n }\n}\n\n\nAnd I have followed http://tarunsapra.wordpress.com/2011/06/28/junit-spring-session-and-request-scope-beans/'s suggestion add this to test-context.xml\n\n <bean class=\"org.springframework.beans.factory.config.CustomScopeConfigurer\">\n <property name=\"scopes\">\n <map>\n <entry key=\"session\">\n <bean class=\"org.springframework.context.support.SimpleThreadScope\" />\n </entry>\n </map>\n </property>\n </bean>\n\n\nWhen I run text I got this error:\n\njava.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.\n\n\nAs error messages says:I am refering request attributes outside of an actual web request due to I launch service by testng not a http request,how can I make service with session read-write testable?" ]
[ "spring", "session", "testng" ]
[ "Selecting initial centroids in Kmeans in R", "I am using k means for clustering of users. I want to further improve my clusters formed by selecting initial centroids myself.\n\nSince in a dataframe kmeans allot random rows as initial centroids and that impact final clusters formed.\n\nIs there a way to assign initial centroids manually in R ? I used elbow method to get optimal number of clusters.\n\nMy code here:\n\nfor (i in 2:15) wss[i] <- sum(kmeans(db, \n centers=i, iter.max = 20)$withinss)\nplot(1:15, wss, type=\"b\", xlab=\"Number of Clusters\",\n ylab=\"Within groups sum of squares\")\n\nfit <- kmeans(db, 7)\naggregate(db, by=list(fit$cluster),FUN=mean)\nmydata <- data.frame(db, fit$cluster)" ]
[ "r", "cluster-analysis", "k-means" ]
[ "Background Fetch does not execute on device", "I have an Xamarin IOS Application for which I want to implement a background fetch. When I trigger it on the simulator it works as expected. But on the device it is never executed.\n\nIn the AppDelegate \"FinishedLaunching\" I set the interval to the minimum:\n\n UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);\n\n\nand I've implemented the perform fetch method:\n\npublic override async void PerformFetch(UIApplication application,\n\nAction<UIBackgroundFetchResult> completionHandler)\n {\n UIBackgroundFetchResult fetchResult;\n try\n {\n Debug.Write(\"Start background fetch.\");\n bool canResolve = Mvx.CanResolve<IBusinessFacade>();\n\n if (!canResolve) return;\n var businessFacade = Mvx.Resolve<IBusinessFacade>();\n\n //Nach Zeitstempel neu laden\n var reloadChangesResult = await businessFacade.ReloadByTimestamp();\n\n //Aktualisieren der Kontakte\n ReloadContactsFromAddressBook();\n var resultReload = await businessFacade.ReloadContacts();\n\n //Ich Kontakt neu laden und bei Änderung Service notifizieren\n var reloadMeResult = await businessFacade.ReloadMeContact();\n if (reloadMeResult.Success)\n {\n if (reloadMeResult.Result.AnyValueChanged || reloadMeResult.Result.HashChanged)\n {\n var updateMeResult = await businessFacade.UpdateMeContactToService();\n }\n }\n\n //Notifikationen laden\n var reloadRequestsResult = await businessFacade.ReloadRequests();\n\n //Pusk aktualisieren\n var pushResult = await businessFacade.RegisterPush();\n\n // check if there where new data downloaded.\n if (reloadChangesResult.Result || reloadRequestsResult.Result)\n {\n fetchResult = UIBackgroundFetchResult.NewData;\n }\n else\n {\n fetchResult = UIBackgroundFetchResult.NoData;\n }\n }\n catch (Exception ex)\n {\n Debug.Write(ex);\n Analytics.TrackEvent(\"Exception: Background Fetch\", new Dictionary<string, string>\n {\n {\"Exception\", ex.ToString()}\n });\n fetchResult = UIBackgroundFetchResult.Failed;\n }\n\n completionHandler(fetchResult);\n }\n\n private async void ReloadContactsFromAddressBook()\n {\n var addressBook = new AddressBookService();\n var dbFactory = new DbFactory();\n var contactDataService = new ContactDataService(new ContactRepository(dbFactory), new SettingsAdapter(new Settings()));\n\n var phonebookContacts = addressBook.GetAllContacts();\n\n HashSet<string> contacts = new HashSet<string>((await contactDataService.GetAllContacts()).Select(r => r.IdAddressbook));\n\n var listNewContacts = phonebookContacts.Where(c => !contacts.Contains(c.AddressBookId));\n\n foreach (var contact in listNewContacts)\n {\n ContactEntity ce = new ContactEntity\n {\n IdAddressbook = contact.AddressBookId,\n DisplayName = contact.DisplayName,\n IdService = 0,\n DisplayImage = contact.Image,\n DisplayBirthDate = contact.Events.FirstOrDefault(r => r.EventType == Models.Enums.EventType.Birthday)?.EventDate ?? DateTime.MinValue,\n DisplayPhoneNumber = string.Empty\n };\n await contactDataService.SaveContact(ce);\n }\n }\n\n\nBackground modes are enabled in my info.plist:\n\n<key>UIBackgroundModes</key>\n<array>\n <string>fetch</string>\n <string>remote-notification</string>\n</array>\n\n\nI target IOS 10 and above.\nXamarin IOS Version: 11.6.1.3\n\nWhat could be wrong here?" ]
[ "ios", "xamarin.ios", "background-fetch" ]
[ "Dynamically change new folder name if folder with same name already exists", "Is there an way to dynamically change a new folder name if a folder with the same name already exists? For example, if I were to create a new file using fso.CreateFolder, would there be any way for the script to check for the folder and add an extra character, e.g from (\"example\") to (\"example a\"). I realize that I could use a file name from a variable and add characters like so:\n\ndim filename\nfilename = (\"example\")\nfolderexists = fso.FolderExists(filename)\n\nif (folderexists) then\nfso.CreateFolder(filename + \"a\")\nelse\nfso.CreateFolder(filename)\nendif\n\n\nbut this would only work once, and after that would just continue to create and overwrite (filename + \"a\"). I would like the script to be able to detect, so for example:\n\nfirst folder = (filename)\nsecond folder = (filename + \"a\")\nThird folder = (filename + \"aa\")\nfourth folder = (filename + \"aaa\")\n\n\nand so forth." ]
[ "vbscript" ]
[ "Trailing slash removal opening full directory", "I'm trying to remove the trailing slash of all urls. Whatever htaccess script lines I try, it always redirects to what seems the full server directory.\nexample.com/XYZ/ weirdly redirects to example.com/customers/b/7/3/example.com/httpd.www/XYZ – Not found.\n\nBasically, I'm not using any subdirectories but getting data out of a database according to what's the last string after the last slash. So the \"Not found\" error is ok, because there actually isn't an existing folder.\n\nI'm new to htaccess, so I was just trying out whatever lines I found.\n\nRewrite so that anything opens index.php and not a folder (which works fine without trailing slash, Engine is on):\n\nRewriteRule ^([a-zA-Z0-9_-]+)$ index.php?$1\nRewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?$1\n\n\nI failed by using this to remove the slash:\n\nRewriteRule ^(.+)/$ /$1 [R=301,L]\n\n\nSo basically what I'm trying to do is:\n\n\nOpen any url as index.php. For example example.com/XY doesn't actually redirect but show/open index.php (I think I achieved that with above two lines)\nWhile doing so, I'm trying to also remove the trailing slash from e.g. example.com/XY/, so example.com/XY and example.com/XY/ both show/open index.php\n\n\nThanks for your wisdom!" ]
[ ".htaccess", "mod-rewrite", "redirect" ]
[ "How to run a Server without using a while loop?", "I'm trying to make a server program using the DatagramSocket and DatagramPacket classes, but my current code uses an ugly while loop which also freezes my program while the server runs, but the server runs fine with no problems. Anyway the code is below. Is there anyway I can use something different than a while loop or prevent the while loop from preventing any other code in the program to execute?\n\nprotected void run() {\n try {\n socket = new DatagramSocket(port);\n socket.setBroadcast(true);\n } catch (Exception e) {\n e.printStackTrace();\n stopServer(); //stop the server\n return; \n }\n while(isRunning()){ //hate this loop\n try {\n byte[] buf = new byte[256];\n DatagramPacket packet = new DatagramPacket(buf, 256);\n socket.receive(packet);\n DatagramPacket serverPacket;\n byte[] serverBuf;\n byte hb = 0;\n byte lb = packet.getData()[0];\n int e = ((int)hb<<8)|((int)lb&0xFF); //translate byte to int\n switch(e) {\n case 2:\n //do something\n break;\n case 5:\n //do something\n break;\n case 7:\n //do something\n break;\n default:\n //default stuff\n break;\n }\n } catch (Exception e) {\n System.out.println(\"Fatal Server Error:\");\n e.printStackTrace(); \n stopServer(); //stop the server\n return; //stop the method\n }\n }\n}" ]
[ "java", "multithreading", "datagram" ]
[ "Making versions match in angular 2", "I'm using the angular 2 quickstart application from Angular.io: https://github.com/angular/quickstart\n\nAnd I'm trying to make some basic additions to it. Specifically I would like to use the PrimeNG module to display data using a DataTable component: http://www.primefaces.org/primeng/#/datatable\n\nTo do this, I add \"primeng\": \"1.0.0-beta.17\" to package.json under dependencies, which now looks as follows:\n\n\"dependencies\": {\n\"@angular/common\": \"~2.1.0\",\n\"@angular/compiler\": \"~2.1.0\",\n\"@angular/core\": \"~2.1.0\",\n\"@angular/forms\": \"~2.1.0\",\n\"@angular/http\": \"~2.1.0\",\n\"@angular/platform-browser\": \"~2.1.0\",\n\"@angular/platform-browser-dynamic\": \"~2.1.0\",\n\"@angular/router\": \"~3.1.0\",\n\"@angular/upgrade\": \"~2.1.0\",\n\n\"angular-in-memory-web-api\": \"~0.1.4\",\n\"bootstrap\": \"^3.3.7\",\n\"systemjs\": \"0.19.24\",\n\"core-js\": \"^2.4.1\",\n\"reflect-metadata\": \"0.1.2\",\n\"rxjs\": \"5.0.0-beta.12\",\n\"zone.js\": \"^0.6.25\",\n\n\"primeng\": \"1.0.0-beta.17\"\n},\n\"devDependencies\": {\n\"concurrently\": \"^3.0.0\",\n\"lite-server\": \"^2.2.2\",\n\"typescript\": \"^2.0.3\",\n\"typings\": \"^1.4.0\",\n\n\"canonical-path\": \"0.0.2\",\n\"http-server\": \"^0.9.0\",\n\"tslint\": \"^3.15.1\",\n\"lodash\": \"^4.16.2\",\n\"jasmine-core\": \"~2.5.2\",\n\"karma\": \"^1.3.0\",\n\"karma-chrome-launcher\": \"^2.0.0\",\n\"karma-cli\": \"^1.0.1\",\n\"karma-htmlfile-reporter\": \"^0.3.4\",\n\"karma-jasmine\": \"^1.0.2\",\n\"karma-jasmine-html-reporter\": \"^0.2.2\",\n\"protractor\": \"^3.3.0\",\n\"rimraf\": \"^2.5.4\"\n\n\n},\n\nRunning npm install now causes a version conflict during the typings install stage:\n\nnpm ERR! peerinvalid The package reflect-metadata does not satisfy its siblings' peerDependencies requirements!\n\nnpm ERR! peerinvalid Peer [email protected] wants reflect-metadata@~0.1.8\n\nnpm ERR! peerinvalid Peer [email protected] wants [email protected]\n\n\nGeneral question: this is just one example of a problem I encounter regularly while trying to get angular 2 to work. What is the best practice for avoiding and resolving version conflicts like these? I have tried manually updating the versions until everything fits, but this is like playing a game of whack-a-mole where each conflict I deal with causes 3 others to pop up. Is there some systematic way to go about it?\n\nSpecific question: why does npm mention \"[email protected]\" and \"[email protected]\" when I have different versions of these specified in package.json? I could understand if one of them was somehow internally referenced by primeng, but not both when they raise this versioning conflict.\n\nupdate: deleting the node_modules and typings directories in my project directory and running \"npm install\" again made this conflict disappear. However, I am still interested in hearing about best practices and explanations for this problem.\n\nI'm very new to angular 2 so please do not hesitate to elaborate on any answers you may give." ]
[ "angular", "versions", "primeng" ]
[ "Why does my Collection.find().count() always returns 0 at client?", "I have a Collection containing 1.7 million documents. When executing count() on server side console I get correct results.\n\nmeteor:PRIMARY> db.postcodes.find().count();\n1737697\nmeteor:PRIMARY>\n\n\nWhereas at the browser console I always get zero for count() and for findOne() returns undefined. \n\ninsecure package has not been removed. And count() and findOne() are working for other smaller Collections.Not much code is present at the moment. Apart from the default html, js, css. Only a couple of line of code is present. I have model.js living in its own folder (neither in Server nor in Client) that has \n\nPostCodes = new Mongo.Collection('postcodes');\nHello = new Mongo.Collection('hello');\n\n\nAll the Collections I have at the moment is\n\nmeteor:PRIMARY> db.getCollectionNames();\n[\n \"hello\",\n \"meteor_accounts_loginServiceConfiguration\",\n \"parttimejobs\",\n \"postcodes\",\n \"system.indexes\",\n \"users\"\n]\nmeteor:PRIMARY>\n\n\nPackage I have are\n\nautopublish 1.0.3 \nian:accounts-ui-bootstrap-3 1.2.69 \ninsecure 1.0.3 \nmeteor-platform 1.2.2 \ntwbs:bootstrap 3.3.5 \n\n\nSample document\n\nmeteor:PRIMARY> db.postcodes.findOne(); \n{ \n \"_id\" : ObjectId(\"559933dc4a8617644069fa5b\"), \n \"postcode\" : \"AB10 1AB\", \n \"latitude\" : 57.149079, \n \"longitude\" : -2.096964, \n \"county\" : \"\", \n \"district\" : \"Aberdeen City\", \n \"ward\" : \"George St/Harbour\", \n \"constituency\" : \"Aberdeen North\", \n \"loc\" : [ \n -2.096964, \n 57.149079 \n ] \n}" ]
[ "mongodb", "meteor" ]
[ "Saving an entity with one-to-one relation in JPA", "I have an entity Request:\n@Entity\npublic class Request {\n\n @Id\n @GeneratedValue\n private Long id;\n\n @OneToOne\n private Candidate candidate;\n\n ...\n}\n\n\nTo create and save above entity into JPA repository, I will be doing something like following:\nCandidate candidate = candidateRepository.findById(requestUpdate.getCandidate()).orElse(null);\n\nRequest request = new Request(candidate);\nRequest save = requestRepository.save(request);\n\nAs Request table in DB stores FK for candidate, I think it should be enough to set an id. But JPA expects me to set candidate object. This forces me to query candidate repository.\nIs it necessary to query for candidate from candidate repository to save Request\nor\nIf I have candidate id available, can't I set it directly ?" ]
[ "java", "spring", "jpa", "spring-data-jpa", "hibernate-mapping" ]
[ "Monitoring multiple folders in one 'syncFolderItems' operation?", "Is it possible to monitor several folders in one 'syncFolderItems' operation?\nI tried it, but It doesn't seem to work.\nFor example, this:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\n xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\">\n <soap:Body>\n <SyncFolderItems xmlns=\"http://schemas.microsoft.com/exchange/services/2006/messages\">\n <ItemShape>\n <t:BaseShape>Default</t:BaseShape>\n </ItemShape>\n <SyncFolderId> \n <t:DistinguishedFolderId Id=\"drafts\"/>\n <t:DistinguishedFolderId Id=\"inbox\"/>\n\n\n </SyncFolderId>\n\n <MaxChangesReturned>500</MaxChangesReturned>\n </SyncFolderItems>\n </soap:Body>\n</soap:Envelope>\n\n\ndoesn't work :(\n\nis it possible? \nThanks :)" ]
[ "soap", "exchange-server", "exchangewebservices", "exchange-server-2007" ]
[ "How to restore empty simulators list in Xcode", "I recently updated to Xcode 10.3 and now the list of simulators is empty.\n\nHow do I get the full list of simulators restored?" ]
[ "xcode", "xcode10.3" ]
[ "WPF DataGrid resizing inner column header causes extreme scrolling", "I have found a behavior with the stock WPF DataGrid that I can't explain or prevent, but it feels like a bug. I am curious if anyone has run into this and what the fix or workaround is.\nSteps to Reproduce:\n\nWhen using a DataGrid with several columns (4 in my test app), resize headers so that the horizontal scrollbar is displayed.\nScroll all the way to the right.\nStart resizing any column that isn't the first or last column.\nResize the column towards the left to its minimum.\nThen drag it to the right and you'll see the column is resized to an extreme width.\n\nIt is somewhat hard to get the column back to an appropriate size. Below is a simple WPF application below to demonstrate the problem.\nMainWindow.xaml\n<Window x:Class="TestGridColumnSpacing.MainWindow"\n xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\n xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\n xmlns:d="http://schemas.microsoft.com/expression/blend/2008"\n xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"\n xmlns:local="clr-namespace:TestGridColumnSpacing"\n mc:Ignorable="d"\n Title="MainWindow"\n Height="450"\n Width="750">\n\n <Grid>\n <DataGrid x:Name="TheDataGrid" AutoGenerateColumns="False">\n <DataGrid.Columns>\n <DataGridTextColumn Header="Field 1" Binding="{Binding Field_1}" />\n <DataGridTextColumn Header="Field 2" Binding="{Binding Field_2}" />\n <DataGridTextColumn Header="Field 3" Binding="{Binding Field_3}" />\n <DataGridTextColumn Header="Field 4" Binding="{Binding Field_4}" />\n </DataGrid.Columns>\n </DataGrid>\n </Grid>\n</Window>\n\nMainWindow.xaml.cs\nnamespace TestGridColumnSpacing\n{\n using System.Windows;\n\n public partial class MainWindow : Window\n {\n public MainWindow()\n {\n InitializeComponent();\n\n this.Loaded += MainWindowLoaded;\n }\n\n private void MainWindowLoaded(object sender, RoutedEventArgs e)\n {\n this.TheDataGrid.Items.Add(new { Field_1 = "", Field_2 = "", Field_3 = "", Field_4 = "Step 1: Using right thumb on Field 4 header, resize enough to make horizontal scrollbar visible if not visible already." });\n this.TheDataGrid.Items.Add(new { Field_1 = "", Field_2 = "", Field_3 = "", Field_4 = "Step 2: Scroll horizontal scrollbar entirely to the right." });\n this.TheDataGrid.Items.Add(new { Field_1 = "", Field_2 = "", Field_3 = "", Field_4 = "Step 3: Using right thumb of Field 3, resize to the right.\\nThis will increase the width of Field 3. Notice normal manner of the scrollbar's size changing." });\n this.TheDataGrid.Items.Add(new { Field_1 = "", Field_2 = "", Field_3 = "", Field_4 = "Step 4: Using right thumb of Field 3, resize the column leftward until Field 3 approaches its minimum width.\\nYou'll notice when all of Field 4 is in view, Field 3 will continue to collapse and appear to shrink towards Field 4." });\n this.TheDataGrid.Items.Add(new { Field_1 = "", Field_2 = "", Field_3 = "", Field_4 = "Step 5: At this point, continue using the right thumb of Field 3 to resize the column.\\nNotice exaggerated resizing of the scrollbar."});\n }\n }\n}\n\nI have looked for a solution or other developers talking about it, but I can't find any mention, which is surprising due to how easy it is to reproduce. Please share any information you have for the solution." ]
[ "c#", "wpf", "datagrid", "wpf-controls" ]
[ "How to change the spreadsheet order in Sharepoint", "I have a survey in Sharepoint 2010. Now i added a new question . Then I went to survey settings to make sure that this question is order 1 . However when i export the survey to excel spreadsheet , this question is the in the last column ?\n\nin the survey itself , the new question appears the first , order 1(BTW there is no branching ) .\n\nHowever when i export it to spreadsheet it it the last . How can make this question to be the first in the spreadsheet either ?" ]
[ "sharepoint" ]
[ "How can I validate dsym file of xcode build?", "I extract Dsym file from the xarchive of release version and uploaded on crittercism but not able to find the symbolic crash report from the tool. \n\nI contact crittercism helpDesk and all I come to know that I need to upload dsym file with all symbols... so, how can I validate that the file which I'm uploading is valid or not?\n\nBuild setting : GCC_GENERATE_DEBUGGING_SYMBOLS : Yes\n\nFile extract step : organizer > xarchive > release build > show package contents > dsyms > dsym.file" ]
[ "xcode", "undefined-symbol", "crittercism", "dsym" ]
[ "Whats the difference between observing a variable and a function", "When I observe from Fragment A a variable in my viewmodel\nval fetchTopicsList = liveData(Dispatchers.IO) {\n emit(Resource.Loading())\n try {\n emit(repo.getIdeas())\n }catch (e:Exception){\n emit(Resource.Failure(e))\n }\n }\n\nAnd I navigate to Fragment B and come back to Fragment A the observer will fire again but the new data will not be fetched.\nNow, if I change that declaration to a function declaration\nfun fetchTopicsList() = liveData(Dispatchers.IO) {\n emit(Resource.Loading())\n try {\n emit(repo.getIdeas())\n }catch (e:Exception){\n emit(Resource.Failure(e))\n }\n }\n\nWhen I do the same (go from Fragment A to Fragment B and come back) the observer will trigger again and pull the data again from the server.\nWhy the function fires again while the variable just keeps the first fetched data ?" ]
[ "android", "kotlin", "mvvm", "viewmodel", "android-architecture-components" ]
[ "How to easily obtain the latency of proxies with only a few lines of code in python?", "I am making something in one of my scripts that should be able to weed out all of my proxies that are slow. The proxies are stored on each line a file called proxies.txt. I want to be able to specify the maximum latency in milliseconds with a variable. I saw a similar question here Python requests find proxy latency but it was unanswered. If there is a way to do this please let me know." ]
[ "python", "python-3.x", "proxy", "latency" ]
[ "Python, Tkinter, tkFont: Label resize", "I am trying to get the label to be underlined only when the mouse is over it. I am having trouble with most of it. I think there is an easier way to do this but i have never played around with tkFont. The labels also get resized when the mouse leaves the label.\n\nfrom Tkinter import *\nimport tkFont\n\ndef move1(event):\n f = tkFont.Font(lbl1, lbl1.cget(\"font\"))\n f.configure(underline = True)\n lbl1.configure(font=f)\n\ndef _move1(event):\n f.configure(underline = False)\n lbl1.configure(font=f)\n\ndef move2(event): \n f = tkFont.Font(lbl2, lbl2.cget(\"font\"))\n f.configure(underline = True)\n lbl2.configure(font=f)\n\ndef _move2(event):\n f.configure(underline = False)\n lbl2.configure(font=f)\n\ndef move3(event): \n f = tkFont.Font(lbl3, lbl3.cget(\"font\"))\n f.configure(underline = True)\n lbl3.configure(font=f)\n\ndef _move3(event):\n f.configure(underline = False)\n lbl3.configure(font=f)\n\n\n\nroot=Tk()\nroot.geometry('100x100+100+100')\n\nf = tkFont.Font()\nlbl1 = Label(root, text='Label 1')\nlbl1.bind('<Enter>', move1)\nlbl1.bind('<Leave>', _move1)\nlbl1.pack()\nlbl2 = Label(root, text='Label 2')\nlbl2.bind('<Enter>', move2)\nlbl2.bind('<Leave>', _move2)\nlbl2.pack()\nlbl3 = Label(root, text='Label 3')\nlbl3.bind('<Enter>', move3)\nlbl3.bind('<Leave>', _move3)\nlbl3.pack()\n\nmainloop()" ]
[ "python", "binding", "fonts", "tkinter", "label" ]
[ "http::request to internal link return nil", "I'm trying to call internal action using http::request, but it always giving nil in it's response.body.\n\nHere is the code in the view file,\n\n<%= @res.body.html_safe %>\n\n\nHere is the code in controller\n\ndef index2\n require \"net/http\"\n require \"uri\"\n\n url = URI.parse(\"http://localhost:3000/\")\n\n req = Net::HTTP::Post.new(url.request_uri)\n req.set_form_data({'email'=>'[email protected]', 'pass'=>'zeas2345'})\n http = Net::HTTP.new(url.host, url.port)\n\n @res = http.request(req)\nend\n\n\nand the result is\n\n\n NoMethodError in Main#index2\n\n\nShowing D:/WORK/ERP_BALIYONI/app/views/main/index2.html.erb where line #5 raised:\nundefined method `body' for nil:NilClass\n\n2: \n3: %>\n4: \n5: <%= @res.body.html_safe %>\n\n\nI'm quite confused because when I change the url into\n\nurl = URI.parse(\"http://localhost3000.org/\")\n\n\nit works.\nCan you help me find the problem?" ]
[ "ruby-on-rails", "httprequest" ]
[ "java.lang.NullPointerException: null value in entry: url=null Selenium Webdriver", "I am trying the following simple code, which works as per expectation on my localmachine \n\npublic class NewTest \n{\n\n @Test\n public void f() throws IOException\n { \n\n Properties obj = new Properties();\n FileInputStream fileobj = new FileInputStream(\"C:\\\\selenium_Automation\\\\data_links.properties\");\n obj.load(fileobj);\n\n System.setProperty(\"webdriver.chrome.driver\", \"c:\\\\drivers\\\\chromedriver.exe\");\n WebDriver driver = new ChromeDriver();\n driver.get(obj.getProperty(\"crm_url\"));\n\n System.out.println(\"Complete\");\n }\n\n}\n\n\nbut when i try the same code on a different machine i get the following \n\n FAILED: f\n java.lang.NullPointerException: null value in entry: url=null\nat com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)\nat com.google.common.collect.SingletonImmutableBiMap.<init>(SingletonImmutableBiMap.java:39)\nat com.google.common.collect.ImmutableBiMap.of(ImmutableBiMap.java:57)\nat com.google.common.collect.ImmutableMap.of(ImmutableMap.java:80)\nat org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:306)\n\n\nThe code works fine if i replace (obj.getProperty(\"crm_url\")) with the actual URL, but i have several different links stored in the properties file and i need them to be read from that place. What i am doing wrong can some please tell me the reason behind the NUll pointer expection for the URL" ]
[ "selenium-webdriver", "nullpointerexception", "selenium-chromedriver" ]
[ "Bringing Google search results into Google Sheets using Regex instead of ImportXML", "I am tracking keywords for Google search results in Google sheets. \n\nWhen using importXML it looks like I am getting limited for the amount of XML I can import as I am getting #N/A in cells after a certain amount of use.\n\nI found this custom code by @joshbradley that use of custom scripts to use regex instead of XPath which is meant to get around any limitation. Credit to Josh.\n\nEssentially this goes in the script editor:\n\n function importRegex(url, regexInput) {\n var output = '';\n var fetchedUrl = UrlFetchApp.fetch(url, {muteHttpExceptions: true});\n if (fetchedUrl) {\n var html = fetchedUrl.getContentText();\n if (html.length && regexInput.length) {\n output = html.match(new RegExp(regexInput, 'i'))[1];\n }\n }\n // Grace period to avoid call limit\n Utilities.sleep(1000);\n return unescapeHTML(output);\n}\n\n\nThen you call the script like this\n\n=importRegex(\"https://example.com\", \"<title>(.*)<\\/title>\")\n\n\nFrom here, I am trying to adapt the following code taken from GDS (Credit to Tara) that brings in Google search results but use the custom importregex approach above instead of importxml.\n\n=ARRAYFORMULA(REGEXEXTRACT(IMPORTXML(\"https://www.google.co.uk/search?q=\"& SUBSTITUTE(B$1, \" \", \"+\") &\"&pws=0&gl=UK&num=50\", \"//h3[@class='r']/a/@href[contains(.,'url')]\"), \"\\/url\\?q=(.+)&sa\\b\"))\n\n\nUpdate\n\nHere are two approaches I have tried (second has the array) but neither are working.\n\n=importRegex(\"https://www.google.co.uk/search?q=\"& SUBSTITUTE(B$1, \" \", \"+\") &\"&pws=0&gl=UK&num=50\", \"//h3[@class='r']/a/@href[contains(.,'url')]\"), \"\\/url\\?q=(.+)&sa\\b\"))\n\n=ARRAYFORMULA(REGEXEXTRACT(importRegex(\"https://www.google.co.uk/search?q=\"& SUBSTITUTE(B$1, \" \", \"+\") &\"&pws=0&gl=UK&num=50\", \"//h3[@class='r']/a/@href[contains(.,'url')]\"), \"\\/url\\?q=(.+)&sa\\b\"))\n\n\nIf it helps I have put a link to a Google sheet with the importregex script working here" ]
[ "regex", "web-scraping", "google-sheets", "google-sheets-importxml" ]
[ "Facing problems with the atoi function if used repeatedly", "I have to find the frequency of digits {0,1,2,3,4,5,6,7,8,9} in a given string, I'm using atoi function to convert the character to an integer and I'm having problems with the atoi function when the input string is large (tried this with different test cases of varying length),\n\nfor example if the input string is \n\n1v88886l256338ar0ekk\n\n\nmy code works properly and the answer is \n\n1 1 1 2 0 1 2 0 5 0\n\n\nwhere the 1st digit indicates the frequency of 0 and so on upto 9,\n\nbut if the input string is\n\n9139f793308o0lo66h6vc13lgc697h0f6c32lu84445972k0o0l033od17c083yn5051d6j319hyo8j939n28d913015ns6zx5653x01211x12ch2526o65sg7xw6302141q9203s22l336319ll9yx4b597mr318a7943906750j4u152067nq83ne9f24thu96yd05173l47c803roxci45615f0w53i1sz913jj6za733l73tw6r66mq6p44sfhjr26h8e801z8zlcx2l1e65r2879xj3w3acv216196uq158o663y7oz2i5378v0v5w17762451t424352m23026r9o202i9785382o159e4gu1c8561157z5f1vqs5755465b8u728u956434mv944885li456628a994u7j5278m269n1pk8e46940q834h06il6h447888tr7ig72z10fe09k5g98h9bgt6z40v42s16pt6k3l3v45i83i01b9448g554741w766f2q7v31i085488h060e710p53076c6nm98pi946g8j2n6j8x29qa1ad48172y0u4818121p686bud89741201p54087u56g8scerv9pvhuo09re477zfb224i2c1325bj58jx4bk7b009f6446j5i95474p266i503r670n631x6940gwl71ejbx47imx576129248901765rnpu6l80084t0j1839f5y3409w2n403fu6ogw1170jmb6o5l520vg0703e0\n\n\nupon reaching the end of the string the atoi function returns wrong values \n\nfor example,\n\nmy code uses atoi to convert char text to an integer and stores it into int num \n\nat the beginning the function works fine,\n\ntext is 9 num is 9 \ntext is 1 num is 1 \ntext is 3 num is 3 \ntext is 9 num is 9 \ntext is 7 num is 7 \ntext is 9 num is 9 \ntext is 3 num is 3 \ntext is 3 num is 3 \ntext is 0 num is 0 \ntext is 8 num is 8 \ntext is 0 num is 0 \n.\n.\n.\n\n\nand upon nearing the very end of the string the function returns\n\n.\n.\n. \ntext is 2 num is 2 \ntext is 4 num is 4 \ntext is 0 num is 0 \ntext is 3 num is 30 \ntext is 6 num is 60 \ntext is 1 num is 10 \ntext is 1 num is 10 \ntext is 7 num is 70 \ntext is 0 num is 0 \ntext is 6 num is 61 \ntext is 5 num is 51 \ntext is 5 num is 51 \ntext is 2 num is 21 \ntext is 0 num is 1\ntext is 7 num is 71 \ntext is 0 num is 1 \ntext is 0 num is 1 \ntext is 3 num is 31 \n\n\nIf I replace int num = atoi(&text) with int num = text - '0' my program works perfectly for all test cases,\n\nso can someone please tell me what went wrong and whether I have used the function incorrectly.\nPlease keep in mind I just want to know why atoi didn't work, hence I'm not looking for replacements for the function. \n\nI've included the snippet of my code below\n\r\n\r\n#include <stdio.h>\r\n#include <string.h>\r\n#include <math.h>\r\n#include <stdlib.h>\r\n#include <ctype.h>\r\n\r\nint main() {\r\n int arr[10] = {0};\r\n char text;\r\n text = getchar();\r\n while(text != EOF)\r\n {\r\n if(isdigit(text))\r\n {\r\n printf(\"text is %c \",text);\r\n int num = atoi(&text);\r\n printf(\"num is %d\\n \",num);\r\n for(int i =0; i<10;i++)\r\n {\r\n if(num==i)\r\n {\r\n arr[i]++;\r\n //printf(\"arr[%d] is %d\\n\", i,arr[i]);\r\n break;\r\n }\r\n }\r\n }\r\n text = getchar();\r\n }\r\nfor(int i=0; i<10;i++)\r\n{\r\n printf(\"%d \",arr[i]);\r\n} \r\n return 0;\r\n}\r\n\r\n\r\n\n\nThanks in advance for taking the time to read and answer my question" ]
[ "c" ]
[ "UI datepicker won't close on keys (arrow, enter)", "I have a grid that tabs around the page with arrow keys. A couple of fields are date type. On tab or click I replace the contents with a unique input box and then on blur...replace back. ie. inline editing.\n\nthe date picker pops up but I can't get it to remove on keys. It won't destroy itself. Thanks for the help in advance.\n\nctrl.datepicker({\ndefaultDate: \"+1w\",\nchangeMonth: true,\nnumberOfMonths: 1,\nonClose: function (dT) {\n // do work\n}\n}).focus();\n\n\nctrl.on({\n'blur': function () {\n // puts the html back and sets value\n ctrl.datepicker('destroy');\n},\n'keydown': function (k) {\n if (k.which == 27) {\n $(this).blur();\n return;\n }\n if (k.which == 9) {\n k.preventDefault();\n }\n if (k.which == 13 || k.which == 37 || k.which == 38 || k.which == 39 || k.which == 40 || k.which == 9) {\n $(this).blur();\n that.handleColumnTab(e, k.which); // this tabs the grid up down left right etc.\n return;\n }\n}\n});" ]
[ "javascript", "jquery", "datepicker" ]
[ "Android design patterns, Singletons per-object class in Realm for composition?", "I'm designing an android app in realm that graphically charts data, using a very straight forward object class representation:\n\n@RealmClass\npublic class Graph implements RealmModel {\n @PrimaryKey\n private String UUID;\n public RealmList<DataSet> dataSets;\n}\n\n@RealmClass\n public class DataSet implements RealmModel {\n @PrimaryKey\n private String UUID;\n public RealmList<DataPoint> dataPoints;\n}\n\n@RealmClass\n public class DataPoint implements RealmModel {\n private String UUID;\n}\n\n Basically Graph.Contains DataSets.Contains DataPoints\n\n\nI'd like to run realm in it's own thread, separate from the UI. I'm considering using the Singleton design pattern to manage all 3 levels of data. There could be 1 singleton per-realm-model, 3 singletons in total, or there can be one master singleton. \n\nIn both cases, the singletons will have the traditional sup'd up List methods available from RealmModel, \n\n realm.executeTransaction(new Realm.Transaction(){\n @Override\n public void execute(Realm realm){\n realm.copyToRealm(graph);\n }\n });\n\n\nalong with other methods I create:\n\npublic void bulkAdd() {\n @Override\n public void execute(Realm realm){\n for(int i=0; i<100;i++){\n //doStuff();\n... });\n\n\nBefore/After that operation I want to use the Factory Pattern to manage the details of creating and configuring each of the RealmModels. So my question is, should I create 3 singletons, an instance for each RealmModel, 1 master singleton that manages all RealmModels, or use another design pattern?\n\nA side-note, non-priority is that I would also like to take advantage of async if possible, ie:\n\n private void asyncAddQuote() {\n ...\n AsyncTask<Void, Void, Void> remoteItem = new AsyncTask<Void, Void, Void>() {\n @Override\n protected Void doInBackground(Void... params) {...\n\n\nBut I don't know which overall composition of design patterns are best for this application. I need to keep in mind that Realm transactions are limited to one thread. I need to drive UI elements like RecyclerView in the UI thread. In certain modes the application runs as a Service, so in service mode my realm needs to be on the service thread. \n\nI've built the Graph singleton up to recyclerview level and I'm about to build the rest. I want to avoid gottchas when codding the compositional/control layer. I would appreciate your thoughts on design patterns and options for overall composition. Thanks!" ]
[ "java", "android", "multithreading", "design-patterns", "realm" ]
[ "Reverting a commit only a specific branch, while keeping the \"merged data\"", "Say I have two branches A and master. A feature has accidentally been added, and completed, to branch A (which is also working on a different feature that is in a working state/merged to master but needs to be continued on later).\n\nNow I wish to remove the commit(s) that produced the new feature from A while keeping the master state in the current HEAD. Ideally something like:\n\ngit checkout A\ngit revert HEAD~2..HEAD\n\n\nHowever wouldn't this also revert the HEAD of master branch?" ]
[ "git", "git-revert" ]
[ "Header Directories in VS2010", "Let's say I have a solution/project called myTest, which just has a myTest.cpp file. In some completely separate folder (a Subversion folder on my desktop, for example), I have a myTest.h file.\n\nIn Xcode, I can drag myTest.h into the \"Groups and Files\" pane and I will be able to use myTest.h by putting #include \"myTest.h in myTest.cpp.\n\nIs there any similar functionality for Visual Studio 2010? Dragging the file into the \"Solution Explorer\" pane does not work. I can set the \"Include Directories\" property, but then I have to use #include <myTest.h> rather than #include \"myTest.h\". This will cause portability problems later." ]
[ "c++", "visual-studio-2010", "directory" ]
[ "Why Menu \"Action\" showing duplicate options of one window action in Odoo 10?", "I have created a menu Under \"Actions\" which is running fine on local machine server but where i updated this code on server , the new created option showing twice. Please guide me how to resolve" ]
[ "openerp", "odoo-10" ]
[ "javascript - Read audio stream", "client.html\n<!doctype html>\n<html>\n <head>\n <script src="https://unpkg.com/[email protected]/dist/peerjs.min.js"></script>\n </head>\n <body>\n <script>\n var peer = new Peer();\n var record = false;\n var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;\n getUserMedia({video: true, audio: true}, function(stream) {\n console.log(stream)\n var call = peer.call('epalxeis', stream);\n call.on('stream', function(remoteStream) {\n console.log(remoteStream)\n // Show stream in some video/canvas element.\n if(record==false){\n record=true;\n const recorder = new MediaRecorder(remoteStream);\n console.log("Recording");\n // fires every one second and passes an BlobEvent\n \n recorder.ondataavailable = event => {\n\n // get the Blob from the event\n const blob = event.data;\n console.log(blob);\n };\n\n // make data available event fire every one second\n recorder.start(1000);\n }\n \n });\n }, function(err) {\n console.log('Failed to get local stream' ,err);\n });\n \n </script>\n\n </body>\n</html>\n\nserver.html\n<!doctype html>\n<html>\n <head>\n <script src="https://unpkg.com/[email protected]/dist/peerjs.min.js"></script>\n </head>\n <body>\n <script>\n var peer = new Peer("epalxeis");\n \n var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;\n peer.on('call', function(call) {\n getUserMedia({video: true, audio: true}, function(stream) {\n call.answer(stream); // Answer the call with an A/V stream.\n call.on('stream', function(remoteStream) {\n // Show stream in some video/canvas element.\n });\n }, function(err) {\n console.log('Failed to get local stream' ,err);\n });\n });\n \n </script>\n\n </body>\n</html>\n\nIn client.html local stream recording works: const recorder = new MediaRecorder(stream); but remote stream recording doesn't const recorder = new MediaRecorder(remoteStream);\nHow can i fix that?" ]
[ "javascript", "html", "peerjs" ]
[ "How to delete rows of data using sequelize?", "So I have the following router in a pug file called books.js, in this router I am using the Sequelize ORM to find a row of data based on the id in order to deleted\n\n /* - Deletes a book. Careful, this can’t be undone. \nIt can be helpful to create a new “test” book to test deleting.\n\ncreate the post /books/:id/delete route*/\nrouter.post('/:id/delete', function(req, res, next){\n Book.findOne({where: {id: req.params.id}}).then(function(book){\n return book.destroy();\n }).then(function(){\n res.redirect('/books/'); \n })\n});\n\n\nthis is the form inside a pug file called update-book.pug where I have a button that once pressed it should delete the row of data and redirect to /books\n\nform(action=\"/books/\" + book.id , method=\"post\" onsubmit=\"return confirm('Do you really want to delete this book?');\")\n\n\nOnce I press the delete button, I get the 200(ok) status code, but my browser stays in the same page\n\n\n\ncan someone help? for reference this is my repo https://github.com/SpaceXar20/sql_library_manager-updated" ]
[ "javascript", "node.js", "sequelize.js" ]
[ "Text Search for Rails 3 on Heroku - Texticle vs acts_as_tsearch vs acts_as_indexed", "I am building a Rails 3 application that will be hosted on Heroku.\n\nTo implement full text search, these are the free alternatives that I have come across:\n\nTexticle\n\nacts_as_tsearch\n\nacts_as_indexed\n\nMy application is going to be data intensive with a lot of read and writes. Search is also going to be used a lot. \n\nSearch is going to be across different models.\n\nWhich one will be the best in terms of performance and scaling?\n\nAre there any other free and better alternatives?\n\nIs it better to go for a IndexTank or WebSolr (that Heroku recommends) instead?\n\nThanks in advance!" ]
[ "ruby-on-rails", "search", "heroku", "full-text-search", "pg-search" ]
[ "Infinite Loop or Early terminating do while loop", "I have been fighting with this program for awhile now. It has started to compile correctly, but when I run it as it is, it says \"Your bill is __\" infinitely. When I change the initial response value it refuses to run. I'm at a lose as to how to fix it.\n\n/* Savannah Moore\n CSCI 1301\n 2/11/2013\n Internet Package Code: Code determines customer's final pricing. */\nimport java.util.Scanner;\n\npublic class internet{\n public static void main(String[] args){\n double hours, price;\n int internet;\n String response, check=\"Yes\";\n\n\n Scanner kb = new Scanner(System.in); /* This sections questions the user as to which package they have bought. */\n System.out.println(\"Our internet packages include:\");\n System.out.println(\"Package 1: For $9.95 per month, 10 hours of access are provided. Additional hours are $2.00 per hour.\");\n System.out.println(\"Package 2: For $13.95 per month, 20 hours of access are provided. Additional hours are $1.00 per hour.\");\n System.out.println(\"Package 3: For $19.95 per month, unlimited access is provided.\");\n System.out.println(\"Please enter your package number:\");\n internet=kb.nextInt();\n System.out.println(\"Please enter your total hours used:\");\n hours=kb.nextDouble(); \n response = \"Yes\";\n\nwhile(check.compareToIgnoreCase(response)== 0)\n {\n switch (internet)\n {\n case 1: \n { if (hours > 10)\n price = (hours-10)*2 + 9.95; /* This adds the additional hours to the user's price at the current overage rate. */\n else \n price = 9.95;\n }\n System.out.println(\"Your bill is $\" +price); \n break; \n case 2: \n { if (hours > 20)\n price = (hours-20) + 13.95;\n else \n price = 13.95;\n }\n System.out.println(\"Your bill is $\" +price); \n break; \n case 3:System.out.println(\"Your bill is $19.95\"); \n break; \n default: System.out.println(\"This package choice is invalid.\");\n\n System.out.println(\"Would you like to compare your price with that of another package? Yes or No\"); /* This gives the user the ability to stop the loop. */\n response=kb.nextLine();\n response=kb.nextLine(); \n }\n }\n\n System.out.println(\"Thank you for using us as your internet service provider. Have a nice day!\");\n }\n }" ]
[ "java", "infinite-loop", "do-while" ]
[ "how to looping DTO in array to get result arrayList?", "I am new in Java and Spring\nhow to loop / get result for this \n\n[\n WhatsappContatcsDTO(whatsappid = 11111111111, name = John Dee), \n WhatsappContatcsDTO(whatsappid = 16315551234, name = Kerry Fisher)\n]\n\n\nbecause i get that result from query jpa via @Query?\ni do like to get result object from those result query \n\ni like to get result here when i hit my server : \n\n[\n { name: \"John Dee\", whatsappid: \"11111111111\"},\n { name: \"Kerry Fisher\", whatsappid: \"16315551234\"} \n]\n\n\nthis is my service : \n\npublic List<WhatsappContactVO> allContacts() {\n List<WhatsappContactVO> finalResult = new ArrayList<>();\n\n List<WhatsappChat> resultPerKey = whatsappChatRepository.findAllContact();\n for(WhatsappChat data: resultPerKey) {\n WhatsappContactVO result = modelMapper.map(resultPerKey, WhatsappContactVO.class);\n\n finalResult.add(result);\n }\n\n return finalResult;\n}" ]
[ "java", "spring", "spring-boot", "jpa" ]
[ "Android - How to limit a imageview size by width and keep the scale", "Here is my problem: I am working on a RelativeLayout view, which contains a imageview:\n\n<RelativeLayout\n android:layout_width = \"match_parent\"\n android:layout_height=\"wrap_content\"\n android:orientation=\"vertical\"\n android:background=\"@drawable/drawable_card_bg\">\n\n ...\n\n <ImageView\n android:id=\"@+id/photo\"\n android:layout_width=\"fill_parent\" <-- ?\n android:layout_height=\"wrap_content\" <-- ?\n android:scaleType=\"centerCrop\"\n android:src=\"@drawable/test_img\"\n />\n</RelativeLayout>\n\n\nI want the image view can fill width of the RelativeLayout and keep the ratio, but my code above doesn't work. I was wondering how should I change the code to achieve this?" ]
[ "android", "android-layout" ]
[ "lldb - How to use the TUI", "I have just found that lldb has a gui command that brings up a nice UI for command line debugging. However, I have no idea how to use it and could not find any reasonable documentation.\n\n(llvm) gui\n\n\nBrings up this kind of interface:\nlldb interface\n\nHowever, I cannot figure out how to interact with it, eg. send a command to step to the next line. Any idea? I am using Mac OSX Catalina, iterm2 and tmux." ]
[ "c++", "debugging", "lldb", "tui" ]
[ "Caching page based route in Rails?", "I'm trying to implement caching in my Rails application. A view in my controller generates a really large list of items based on a parameter passed in. This large list doesn't change very often, so I'd like to cache it based on the route.\n\nExample:\n\nconfig/routes.rb:\n\nget \"policies/available/:country\" => 'policy#available', :format => :json\n\n\npolicy_controller.rb:\n\nclass PolicyController < ApplicationController\n\n def available\n country = params[:country]\n @policies = VideoPolicy.available_in_country country\n respond_to do |format|\n format.html\n format.json{\n render :json => @policies.to_json\n }\n end\n end\nend\n\n\nCalling \"polices/available/US\" would cache the JSON result for that route, then calling \"polices/available/CA\" would cache a second JSON result for that second route. (a.k.a. one result cached per-route, but for the same view/controller.)\n\nHow would I accomplish this? Some form of page/action/fragment caching?" ]
[ "ruby-on-rails", "caching" ]
[ "Configuration Key Value Store", "I'm in the planning stages of a script/app that I'm going to need to write soon. In short, I'm going to have a configuration file that stores multiple key value pairs for a system configuration. Various applications will talk to this file including python/shell/rc scripts. \n\nOne example case would be that when the system boots, it pulls the static IP to assign to itself from that file. This means it would be nice to quickly grab a key/value from this file in a shell/rc script (ifconfig `evalconffile main_interface` `evalconffile primary_ip` up), where evalconffile is the script that fetches the value when provided with a key.\n\nI'm looking for suggestions on the best way to approach this. I've tossed around the idea of using a plain text file and perl to retrieve the value. I've also tossed around the idea of using YAML for the configuration file since there may end up being a use case where we need multiple values for a key and general expansion. I know YAML would make it accessible from python and perl, but I'm not sure what the best way to access it from a quickly access it from a shell/rc script would be. \n\nAm I headed in the right direction?" ]
[ "perl", "configuration-files", "yaml", "key-value" ]
[ "MVC DropDownListFor not setting value in case of model containing list", "I have a model as under\nclass MyModel \n{\n public List<SomeSetting> Settings {get; set;} = List<SomeSetting> ();\n}\n\nclass SomeSetting // This will contain two properties only at the moment\n{\n public List<MyProperty> Properties { get; set; } = new List<MyProperty>();\n}\n\npublic MyProperty \n{\n public string Name { get; set; }\n public string Value { get; set; }\n}\n\nThis model is populated in the controller\nmodel = new MyModel();\n\nvar SomeSetting1 = new SomeSetting();\nSomeSetting1.Properties.Add(new MyProperty () { Name = "X", Value = "XX" })\nSomeSetting1.Properties.Add(new MyProperty () { Name = "Y", Value = "YY" })\nmodel.Settings.Add(SomeSetting1);\n\nvar SomeSetting2 = new SomeSetting();\nSomeSetting2.Properties.Add(new MyProperty () { Name = "X1", Value = "XX1" })\nSomeSetting2.Properties.Add(new MyProperty () { Name = "Y1", Value = "YY1" })\nmodel.Settings.Add(SomeSetting2);\n\nreturn View(model);\n\nThere is a constants file that has all property names\nclass MyConstants {\n public const string[] ALL_VALID_PROP_NAMES = new string[] { "X" , "Y", "Z", "X1", "Y1", "Z1" }\n}\n\nNow I have created a dropdown list for this model in the view\n@for (var inx = 0; inx < Model.Settings.Count; inx++)\n{\n @Html.DropDownListFor(model => model.Settings[inx].Properties[0].Name, new \n SelectList(MyConstants.ALL_VALID_PROP_NAMES), htmlAttributes: new { @class = "form-control"})\n\n @Html.DropDownListFor(model => model.Settings[inx].Properties[1].Name, new \n SelectList(MyConstants.ALL_VALID_PROP_NAMES), htmlAttributes: new { @class = "form-control"})\n\n}\n\nWhen the user sets a value on UI, values are set in my model in the respective list-objects.\nBut when the model containing values is given to UI, the actual values are not being selected in the dropdown.\nAny clue ?" ]
[ "c#", "asp.net-mvc" ]
[ "MVC Framework for ASP.net 3.0?", "I am currently stuck with ASP.net 3.0, which means that I cannot use ASP.net MVC and ADO.net EF. While I can replace EF with Subsonic or ActiveRecord, I wonder what you guys recommend for MVC? I am interested in nice URLs and separation between View and Controller, two things that I always found hard with Webforms.\n\nFor now, I will give Castle MonoRail a spin, but if you have more suggestions i'd be happy as well." ]
[ ".net", "asp.net" ]
[ "How to perform stock updation process in Django Oscar", "I was going through the code for the stock record model here, and above the num_allocated field it says in the comment, \n\n#: The amount of stock allocated to orders but not fed back to the master\n#: stock system. A typical stock update process will set the num_in_stock\n#: variable to a new value and reset num_allocated to zero\n\n\nSo, how do I do the stock update process as specified in the comment when the product is out of stock?I need to set the num_in_stock variable to new value and set the num_allocated to zero.\n\nSo far if the order is being shipped, I call the consume_stock_allocations() method in the EventHandler Class and the num in stock for the products in the order is being reduced.\n\nIf someone has implemented this please do share some code or some example as I am new to oscar." ]
[ "django", "python-3.x", "django-oscar" ]
[ "P4V/P4 sync a workspace folder to depot", "In my local workspace folder, I add/update/delete files and want them synchronise to depot. The number of files is large, and I want P4V/P4 to automatically detect and synchronise it, just like SVN/Git.\n\nHowever it seems not very easy in Perforce for this simple purpose... Checking out the whole folder in P4V only detect the updated files, \"Mark for Add\" can detect added files, but there seems to be no way to detect deleted files, other than manual \"Mark for Delete\".\n\nI found that P4 has a sync command, but it seems only from depot to workspace?\n\nAny help please?\n\nWorkspace in P4V:\n\n\n\nDepot in P4V:" ]
[ "sync", "perforce", "workspace", "p4v", "depot" ]
[ "How can I check if database update is required before update module", "Is there any good way for it? Like check some specific code in module." ]
[ "drupal", "drupal-7", "drupal-modules" ]
[ "C++, Allegro, Ubuntu, and libpng/LoadPNG", "I've been looking around for quite a while, but I haven't quite been able to hit on a source answering my question. I want to use PNGs with Allegro. I know about libpng and loadpng for Allegro, but I don't know what to do with these. Obviously, I'm new to this. Can anyone explain to me how to download these resources, where to put them, how to link to them, and possibly how to use them. I think I should be able to figure out how to use them once everything is set up. I'm using g++, Ubuntu 12.04, Allegro 4.2.2." ]
[ "c++", "ubuntu", "libpng", "allegro" ]
[ "Jquery UI autocomplete - using value from a previous select field", "I want to autocomplete a Cities text input, but only search for cities in the country that was previously selected. The code I have seems like it should work, but it's not sending the correct country value.\n\nThe form:\n\nCountry: <select name='country' id='country'>\n <option value='US'>USA</option>\n <option value='UK'>United Kingdom</option>\n </select><br/>\nCity: <input type='text' name='city' id='city' />\n\n\nThe js:\n\n$( \"#city\" ).autocomplete({\n source: \"searchCities/\" + $('select#country option:selected').val(),\n minLength: 2\n });\n\n\nThe URL structure should be 'searchCities/UK?term=foo' and the SQL statement is searching for the value of 'term' where the country code is 'UK'. If I type in the URL manually, it works without a problem (limiting to only the country)... and the autocomplete works in the form. However, it returns ALL cities without limiting by the country code.\n\nIs there something I may be missing? Or maybe a better way to accomplish this? Thanks!" ]
[ "php", "jquery-ui", "autocomplete" ]
[ "Does Objective-C have views?", "The rejection of a recent edit I suggested gave me doubts about something I thought I knew on Objective-C.\n\nI've lived under the assumption that the UIViews are part of iOS, that iOS is a descendant of Objective-C and that Objective-C has no default kits with any views.\n\nI've tried some Google and Stack Overflow searches, but the results didn't seem trustworthy and were mostly about UIViews. Wikipedia seems to mention nothing about this .\n\nDoes Objective-C have views? Or is that, as I assumed before, a common misunderstanding?" ]
[ "objective-c", "ios", "views" ]
[ "While running the app in debug view, is there anyway you can click on a component in code and have it highlighted in the app (or vice versa)?", "While running the app in debug view, is there anyway you can click on a component in code and have it highlighted in the app (or vice versa)?\n\nEdit: For instance on a website you can view the inspector and highlight the element that is currently under the cursor, etc. Trying to find the same thing for flutter." ]
[ "flutter" ]
[ "onload event for dynamically created iframe never fires in IE", "I have an issue with IE where the iframe's \"onload/load\" events will not fire when I dynamically create the iframe, set its source to a pdf and append it to the document. \n\nThe reason I need to listen for the event is because I need to hide the iframe until the frame has loaded and then use some effects to fade it into view.\n\nI've got this to work in every browser I've tested in (Chrome, Firefox, Safari, mobile Safari), but it will not work in IE8->IE11.\n\nI've seen lots of posts about how IE doesn't fire the onload event, and from what I've gathered, the following should be working:\n\n// listen for when the iframe's content has been loaded...\nif (window.addEventListener)\n iframe.addEventListener(\"load\", framedContentLoaded, false);\nelse if (window.attachEvent)\n iframe.attachEvent(\"onload\", framedContentLoaded);\nelse\n iframe.onload = framedContentLoaded;\n\n\nHowever, my function framedContentLoaded never gets fired in IE.\n\nI've created a fiddle that reproduces the issue: http://jsfiddle.net/s5TUU/" ]
[ "javascript", "internet-explorer", "iframe" ]
[ "C++ how to check if elements in an array are equal?", "I am trying to write a program which checks if all the values in an array are equal using a for loop but I cannot figure out a way for the if statement to check if each value in the array are equal other than constantly repeating \"if a[i] == a[1] && a[i] == a[0]\" and so on. I do not want to do that as i want it to work for any array of any size. Any help is much appreciated!\n\n for (unsigned i = 0; i < val; i++){\n if (a[i] == a[0])\n return true;\n else\n return false;\n }" ]
[ "c++", "loops", "for-loop" ]
[ "Is it wrong to throw something other than an Error in javascript?", "In exceptional circumstances in javascript code, you can break out of the current control flow by throwing, e.g.:\n\nthrow new Error('Something unexpected occurred.');\n\n\nWhat's the point of instantiating an Error, when you can also just throw a String:\n\nthrow 'Something unexpected occurred.';" ]
[ "javascript", "error-handling", "exception-handling" ]
[ "Is there an equivalent annotation for OnDelete in JPA2", "import org.hibernate.annotations.OnDelete;\n\n@OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)\nList<Foo> foos;\n\n\nIs there an equivalent JPA2 annotation for the Hibernate annotation OnDelete?" ]
[ "hibernate", "jpa", "jpa-2.0" ]
[ "Define custom height for tab of Facebook application with iFrame", "In the advanced options of my app, I put Canvas Height at Fluid or Fixed at [any value]px and my iFrame is always still locked at 800px.\n\nWhat am I doing wrong? I have no code inside my page that dictate a height for the canvas." ]
[ "facebook", "facebook-apps" ]
[ "change azure virtual machine operating system from windows to ubuntu. How I can change OS?", "I have problem. I need to change my microsoft azure virtual machine operating system. I had a windows vm template , so what i need to write in a code ( Json) to change OS ??? Or some other ways (portal , powershell ect) ? Thanks for help me) \n\nP.s my English is bad i`m sorry..." ]
[ "azure", "operating-system", "virtual-machine", "azure-virtual-machine" ]
[ "how to drag and drop from one HTML table to another?", "I am looking for some miracle right now, since I am on really on a tight schedule and really need a script that would alow users to drag and drop 'rows' from one HTML table to another. And after all the \" draggin & dropin' \" a save button should simply add the newly dropped items to the real backend MySQL through a php script! \n\nI would really appreciate it if someone out there could help me!! \ncheers! \nAli" ]
[ "javascript", "html", "dhtml" ]
[ "Reading XLSX data in SpringBatch", "I have an xlsx file that has to be read and the date field needs to be written to MYSQL DateTime column.\n\nThe date in the excel file is in the format \" 2018-08-06 16:32:58\"\n\nBut when I read it using PoiItemReader and then convert it in a custom rowmapper, I get the below exception :\n\njava.text.ParseException: Unparseable date: \"1533553378000\"\n at java.text.DateFormat.parse(DateFormat.java:366)\n at org.springframework.batch.item.excel.RowMapperImpl.mapRow(RowMapperImpl.java:63)\n\n\nI feel that this is due to PoiItemReader not being able to read the date field correctly. Please note that I have tried converting it into sql date using SDF.\n\nCode: https://github.com/vishwabhat19/TimeWorkedData.git\n\nShould i be using XSSFWorkbook instead ? And if I do how would i push this into a Reader? My project is a spring batch project and it needs a InputReader object.\n\nThank you in advance." ]
[ "apache-poi", "spring-batch", "xssf", "spring-batch-excel" ]
[ "2D geometry outline shader", "I want to create a shader to outline 2D geometry. I'm using OpenGL ES2.0. I don't want to use a convolution filter, as the outline is not dependent on the texture, and it is too slow (I tried rendering the textured geometry to another texture, and then drawing that with the convolution shader). I've also tried doing 2 passes, the first being single colorded overscaled geometry to represent an oultine, and then normal drawing on top, but this results in different thicknesses or unaligned outlines. I've looking into how silhouette's in cel-shading are done but they are all calculated using normals and lights, which I don't use at all.\n\nI'm using Box2D for physics, and have \"destructable\" objects with multiple fixtures. At any point an object can be broken down (fixtures deleted), and I want to the outline to follow the new outter counter.\nI'm doing the drawing with a vertex buffer that matches the vertices of the fixtures, preset texture coordinates, and indices to draw triangles. When a fixture is removed, it's associated indices in the index buffer are set to 0, so no triangles are drawn there anymore.\nThe following image shows what this looks like for one object when it is fully intact.\nThe red points are the vertex positions (texturing isn't shown), the black lines are the fixtures, and the blue lines show the seperation of how the triangles are drawn. The gray outline is what I would like the outline to look like in any case.\n\n\n\nThis image shows the same object with a few fixtures removed.\n\n\n\nIs this possible to do this in a vertex shader (or in combination with other simple methods)? Any help would be appreciated.\n\nThanks :)" ]
[ "opengl-es", "2d", "opengl-es-2.0", "glsl", "outline" ]
[ "Modern double reference", "I've been learning a bit of modern C++, improving my code style and stuff, then I got to that part where I actually don't understand certain thing.\nIt is basically anything with double reference:\n\nfor (auto&& i = 0; i <= iNumber; ++i){\n std::cout << vecStrings[i] << std::endl; \n}\n\n\nvs\n\nfor (auto i = 0; i <= iNumber; ++i){\n std::cout << vecStrings[i] << std::endl; \n}\n\n\nwhat is the difference here? i've tried a lot of stuff, but it doesn't really act any different." ]
[ "c++" ]
[ "Setting the default orderby for an entity in the mapping file?", "Is it possible to set the default order-by column to use in the NHibernate mapping file? Unless explicitly defined I want to order all specific entities by the Name column automatically.\n\nI've seen that it can be done on collections but thats not what I'm after in this case." ]
[ "nhibernate", "sql-order-by", "hbm" ]
[ "Make edit XML cause server to restart", "Any edits in web.config file cause IIS to restart the site, am I right?\nSo I need to setup my custom XML in such way that edits in it also cause the site to be restarted. Is it possible?" ]
[ "asp.net-mvc", "asp.net-mvc-4" ]
[ "Unable to use 2 way binding on SELECT element in Angular JS programmably", "I am having the hardest time getting two way binding to work for SELECT elements. I am trying to change the selected element programmably. I've found several Stackoverflow examples for binding the change event for SELECT, but I've not been many going the other way, where your application code changes the selected element. \n\nThere have been a few that I've found that use ng-repeat on an OPTION element but I've a) not been able to get it to work, and b) does not seem to be the \"Angular Way\".\n\nHTML Code:\n\n<div ng-controller=\"SIController\">\n<select id=\"current-command\" ng-model=\"currentCommand\"\nng-options=\"c as c.label for c in availableCommands track by c.id\"></select>\n<button ng-click=\"changeSelectedOption()\">Select \"open\"</button>\n\n\n\n\nController Code:\n\nvar myApp = angular.module('myApp', []);\n\nfunction SIController($scope) {\n\n $scope.availableCommands = [\n {id: 'edit', label: 'Edit'},\n {id: 'open', label: 'Open'},\n {id: 'close', label: 'Close'}\n ];\n\n $scope.currentCommand = \"close\";\n $scope.changeSelectedOption = function() {\n $scope.currentCommand = 'open';\n }; \n};\n\n\nI can verify that $scope.currentCommand is changing when the button is clicked, but the OPTION does not seem to be getting selected.\n\nFiddle here" ]
[ "javascript", "angularjs", "angularjs-ng-model", "angularjs-ng-options" ]
[ "Locating ASDF systems on disk", "When trying to use an mpd interface for common lisp, the corresponding asdf system having been named simply \"mpd\", I came across a peculiar problem. When I loaded the system, it would appear to succeed, yet when I tried to use the functions, it would claim they were undefined. Experimentally, I tried to rename the system \"cl-mpd\", and load that, only to find that it worked. I therefore concluded that ASDF were loading a different system, also named \"mpd\". Generally wanting to avoid such hackery as renaming systems, I looked for the offending system in the installation directories for quicklisp, to no avail. I searched for it in my home folder, with no success.\n\nSo now I ask you: is there a way to get the location of an ASDF system on disk?" ]
[ "common-lisp", "asdf" ]
[ "Converting 3x32x32 size numpy image array to 32x32x3 and saving to actual image in Python", "I have an image in a numpy array of shape (3072,1) or (3,32,32). This consists of first 1024 values corresponds to Red component followed by 1024 Green component followed by 1024 Blue component. These 1024 values corresponds to 32x32 size image. I want to know is there any pythonic way or shortcut to convert this array to 32x32x3 size array so that I can save the array to actual image?\n\nThe problem here is if I just reshape it with size(32x32x3) by \n\nx = numpy.reshape(x,(32,32,3))\n\n\nthen the pixel values will be jumbled up and I won't get the actual image after saving since the original image was of shape (3,32,32)\n\nI just want to save the array into actual image." ]
[ "python", "arrays", "numpy", "image-processing", "reshape" ]
[ "Don't see line numbers using Valgrind inside Ubuntu (Vagrant+Virtualbox)", "I am currently reading and fallowing along the \"Learn C The Hard Way\"-book. On exercise 4 I have to install Valgrind. I first did this locally on my Macbook running Maverick, but I received a warning that Valgrind might not work 100%.\n\nSo now I tried it with Vagrant (using VirtualBox) with an Ubuntu 12.04 box. You can check out the exact Vagrantfile (setup) and the exercise files here on my github repo.\n\nThe problem:\nI don't see the line numbers and instead I get something like 0x40052B.\n\nI compiled the files by doing the fallowing:\n\n$ make clean # Just to be sure\n$ make\n$ valgrind --track-origins=yes ./ex4\n\n\nI pasted the result to pastebin here.\n\nI found the fallowing 3 questions on SO that (partly) describes the same problem, but the answer's and there solutions didn't work for me:\n\n\nValgrind not showing line numbers in spite of -g flag (on Ubuntu 11.10/VirtualBox)\nHow do you get Valgrind to show line errors?\nValgrind does not show line-numbers\n\n\nWhat I have tried sofar:\n\n\nAdded libc6-dbg\ninstalled gcc and tried compiling with that instead of cc.\nadded --track-origins=yes to the valgrind-command\nAdded (and later removed) compiling with -static and -oO flags \n\n\nSo I am not sure where to go from here? I could try and install the latest (instead of v3.7) off gcc manually although that looked rather difficult.\n\nedit:\n@abligh answer seems to be right. I made this with kaleidoscope:\n\nOn the left side you see the result of: valgrind --track-origins=yes ./ex4 and on the right side the result of valgrind ./ex4.\n\nI guess I still need to learn allot about c and it's tools." ]
[ "c", "ubuntu", "valgrind", "vagrant", "line-numbers" ]
[ "Mapping View and Table in hibernate", "I have a table and primary key is DocId. And I have a view which also have a docId. And the entity and view is mapped in the below fashion.\nHow can I map ClaimInferredValues in Claim Entity? So Claim can bring all inferred vales for that docId\n@Entity\n@Table(name = "CLAIM")\npublic class Claim {\n\n @Id\n @Column(name = "DOC_ID")\n private String docId;\n \n ...\n .....\n }\n \n@Entity\n@Immutable\n@Table(name = "V_CLAIM_INFERRED_VALUES")\npublic class ClaimInferredValues {\n\n@EmbeddedId ClaimInferredValuesId ClaimInferredValuesId;\n....\n....\n}\n\n\n@Embeddable\npublic class ClaimInferredValuesId implements Serializable {\n\n @Column(name = "inferredInfoKey")\n private String inferredInfoKey;\n\n @Column(name = "inferredInfoValue")\n private String inferredInfoValue;\n\n @Column(name = "DocId")\n private String docId;\n \n ------\n ---\n \n \n }" ]
[ "hibernate", "jpa" ]
[ "Cannot login into gitolite server to clone, but can connect via ssh", "While there are several questions with similar symptoms, none are exactly the same, nor do the solutions presented there solve my issue.\n\nI have set up gitolite successfully, as far as I am aware, using these instructions, and after overcoming this issue. The host user is git, and I have set up the following .ssh/config file on my workstation:\n\nHost admin\n Hostname server.com\n User git\n IdentityFile ~/.ssh/admin\n\n\nHost dev\n Hostname server.com\n User git\n IdentityFile ~/.ssh/micha\n\n\nI can ssh using the admin config with ssh admin and get the following response:\n\nstdin: is not a tty\nhello admin, this is git@hostname running gitolite3 v3.5.1-2-g962e465 on git 1.7.10.2\n\n R W gitolite-admin\n R W testing\nConnection to xxx.xxx.xxx.xxx closed.\n\n\nWhenever I try to clone the gitolite-admin repo, however I get the following response:\n\nCloning into 'gitolite-admin'...\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\n\nAccording to the previous ssh response, I do have access rights. I have also verified that the git user is owner of the repository files on the server. After researching this, I have changed local GIT_SSH from TortoisePlink.exe to C:\\Program Files (x86)\\Git\\bin\\ssh.exe and still get the same response. All the following variations of the clone command elicit the same response:\n\n\n'git clone admin:gitolite-admin'\n'git clone admin:gitolite-admin.git'\n'git clone admin:repositories/gitolite-admin'\n'git clone admin:~/repositories/gitolite-admin'\n'git clone ssh://admin:gitolite-admin'\n'git clone git@admin:gitolite-admin'\nall sorts of permutations of the above variations.\n\n\nI am now at a loss as to how to overcome this problem." ]
[ "git", "ssh", "gitolite" ]
[ "Data structure for working out free time given used time", "Preamble: I've got a car park with a hundred spaces. I store reservations as free-form start and end times against specified spaces. We currently let people query the car park for a specific time and can easily tell them if there's a free space. But I now have a requirement to advertise how many free spaces there are for 1 hour slots from 7-7, for a span of 5 days. Using the existing query would mean I needed to do 60 queries which is too slow to do interactively and seems just too boggy to do non-interactively.\n\nSo I'm looking for a way to map the time between bookings, and then coerce that into slot availability which I can store separately. This process might be a bit boggy in itself but it might also make querying the database for specific availability somewhat faster.\n\nWhat I want to do is define a day and then \"subtract\" bookings for that day and be left with a list of available time ranges around those bookings, that I can then go onto coerce into hour-long slots.\n\nI'm halfway through doing this myself by starting from a given time, ranging up to the first booking, skipping to the end, and repeating until I hit the end of the slot but it's pretty dull stuff and I'm struggling to believe this hasn't been done before. I'm using Python but I'm happy to port. Something like...\n\ntoday = Day(start=datetime.time(7), end=datetime.time(19))\nprint(today.ranges)\n# [(datetime.time(7), datetime.time(19))]\n\nday.subtract(datetime.time(12), datetime.time(13))\nprint(today.ranges) \n# [(datetime.time(7), datetime.time(12)), (datetime.time(13), datetime.time(19))]\n\n\nI realise I'm probably drifting into a level of specificity where it might only benefit me, but this idea of ranging and splitting time is where I need help. Any ideas?" ]
[ "python", "data-structures", "time" ]
[ "How might I be able to access a nested struct within a doubly linked list?", "I am trying to use a doubly linked list with a header struct. I believe the header struct is simply supposed to hold a count of how many structs have been created in the list, and the first and last nodes. Now I see two problems. One is connecting the header struct to the subsequent structs and the second is accessing a nested struct that i have within my list nodes (sentry). If anyone could shed some light on what I might be doing wrong it would be greatly appreciated. Code is below. \n\n#include <iostream>\nusing namespace std;\ntypedef struct sentry sentry; \n\nstruct stud{\n string name;\n char grade;\n};\n\nstruct slist {\n int length;\n sentry *first;\n sentry *last;\n};\n\nstruct sentry {\n slist *list;\n sentry *next;\n sentry *prev;\n stud *student;\n};\n\nint main(int argc, char** argv) {\n slist list;\n sentry *n;\n\n n = new sentry;\n\n // Full initialization of the header node.\n list.first = n;\n list.last = n;\n list.length = 0;\n\n n->prev = NULL;\n n->next = NULL;\n n->list = list->last;\n n->student->name = \"test\";\n n->student->grade = 'A';\n\n cout << n->student->name << '\\n';\n cout << n->student->grade << '\\n';\n\n return 0; \n}" ]
[ "c++", "c", "struct", "linked-list", "doubly-linked-list" ]
[ "How do I allow specific attributes on tags with JavaScript?", "I have a string, for example: <div style='text-align:center;' otherattr=\"script\">\n\nI want to allow specific attributes, for example allowing only the style attribute.\n\nIt should return: <div style='text-align:center;'>\n\nI want to allow the attributes style, href, src, and align.\n\nThanks a lot." ]
[ "javascript", "regex", "attributes" ]
[ "How to Customize Jenkins Views", "I would like to add multiple boolean parameters in a jenkins job as a checklist. I don't want to add each one in a new separate div. I was wondering if I could manipulate the HTML/CSS of jenkins in order to group these multiple boolean parameters, maybe give each group a header as well.\n\nHere is an image of what I have in mind." ]
[ "jenkins", "jenkins-plugins", "jenkins-cli" ]