"Id","Title","Body","Tags","CreationDate","Y" 34552656,'Java: Repeat Task Every Random Seconds','

I\'m already familiar with repeating tasks every n seconds by using Java.util.Timer and Java.util.TimerTask. But lets say I want to print \"Hello World\" to the console every random seconds from 1-5. Unfortunately I\'m in a bit of a rush and don\'t have any code to show so far. Any help would be apriciated.

\n',,'01/01/2016 00:21',LQ_CLOSE 34552974,'How to get all the child records from different tables based on given parent ID in sql server','I am having 4 different tables like \r\nselect * from System \r\n \r\nselect * from Set \r\nselect * from Item \r\nselect * from Versions \r\n\r\nNow for each system Id there will be **n no.of Sets**, and foe **each set** there qill be **n no. of Items** and for **each item** there will be **n no.of Versions**.\r\n\r\n**each system has
\r\nn no of set
\r\neach Set has
\r\nn no of Items
\r\neach Item has
\r\nn no of Versions**\r\n\r\n\r\nSo, Now when i give **SystemId** then i have to retrieve all the records from \r\n\r\n**Set and Items of each set and Versions of each Items** in single storedprocedure.',,'01/01/2016 01:44',LQ_EDIT 34553034,'Why are Java Optionals immutable?','

I\'d like to understand why Java 8 Optionals were designed to be immutable. Is it just for thread-safety?

\n',,'01/01/2016 02:03',HQ 34553174,'Text Overlay Image with Darkened Opacity React Native','

I am attempting to overlay a title over an image - with the image darkened with a lower opacity. However, the opacity effect is changing the overlaying text as well - making it dim. Any fix to this? Here is what is looks like:

\n\n

\"enter

\n\n

And here is my code for the custom component (article preview - which the above image is a row of article preview components):

\n\n
//component for article preview touchable image\n/* will require the following\n- rss feed and api\n- user\'s keyword interests from parse In home.js\n- parse db needs to be augmented to include what they heart\n- parse db needs to be augmented to include what they press on (like google news)\n*/\nvar React = require(\'react-native\');\nvar {\n  View, \n  StyleSheet, \n  Text, \n  Image, \n  TouchableHighlight, \n} = React;\n\n//dimensions\nvar Dimensions = require(\'Dimensions\');\nvar window = Dimensions.get(\'window\');\nvar ImageButton = require(\'../../common/imageButton\');\nvar KeywordBox = require(\'../../authentication/onboarding/keyword-box\');\n\n//additional libraries\n\nmodule.exports = React.createClass({\n  //onPress function that triggers when button pressed\n  //this.props.text is property that can be dynamically filled within button \n  /* following props:\n    - source={this.props.source}\n    - onPress={this.props.onPress}\n    - {this.props.text}\n    - {this.props.heartText}\n    - key={this.props.key} \n    - text={this.props.category} \n    - this.props.selected\n  */\n  render: function() {\n    return (\n      <TouchableHighlight \n        underlayColor={\'transparent\'}\n        onPress={this.props.onPress} >\n          <Image \n            source={this.props.source} \n            style={[styles.articlePreview, this.border(\'red\')]}>\n                  <View style={[styles.container, this.border(\'organge\')]}>\n                      <View style={[styles.header, this.border(\'blue\')]}>\n                          <Text style={[styles.previewText]}>{this.props.text}</Text>\n                      </View>\n                      <View style={[styles.footer, this.border(\'white\')]}>\n                        <View style={[styles.heartRow, this.border(\'black\')]}>\n                          <ImageButton\n                              style={[styles.heartBtn, , this.border(\'red\')]}\n                              resizeMode={\'contain\'}\n                              onPress={this.onHeartPress}\n                              source={require(\'../../img/heart_btn.png\')} />\n                          <Text style={[styles.heartText]}>{this.props.heartText + \' favorites\'}</Text>\n                        </View>\n                          <KeywordBox \n                              style={[styles.category, this.border(\'blue\')]}\n                              key={this.props.key} \n                              text={this.props.category} \n                              onPress={this.props.categoryPress}\n                              selected={this.props.selected} />\n                      </View>\n                  </View>\n          </Image>\n      </TouchableHighlight>\n    );\n  }, \n  onHeartPress: function() {\n    //will move this function to a general module\n  }, \n  border: function(color) {\n      return {\n        //borderColor: color, \n        //borderWidth: 4,\n      } \n   },\n});\n\nvar styles = StyleSheet.create({\n  heartText: {\n    color: \'white\', \n    fontSize: 12, \n    fontWeight: \'bold\',\n    alignSelf: \'center\', \n    marginLeft: 5, \n    fontFamily: \'SFCompactText-Medium\'\n  }, \n  heartRow: {\n    flexDirection: \'row\', \n    justifyContent: \'space-around\', \n    alignSelf: \'center\', \n    justifyContent: \'center\', \n  }, \n  heartBtn: {\n    height: (92/97)*(window.width/13), \n    width: window.width/13, \n    alignSelf:\'center\', \n  }, \n  category: {\n    fontFamily: \'Bebas Neue\', \n    fontSize: 10,\n    fontWeight: \'bold\'\n  }, \n  header: {\n    flex: 3, \n    alignItems: \'center\', \n    justifyContent: \'space-around\', \n    marginTop: window.height/30,\n  }, \n  footer: {\n    flex: 1, \n    flexDirection: \'row\', \n    justifyContent: \'space-between\', \n    alignItems: \'center\', \n    margin: window.height/50,\n  }, \n  container: {\n    flex: 1, \n    backgroundColor: \'black\', \n    opacity: 0.6, \n  }, \n  articlePreview: {\n    flex: 1, \n    height: window.height/3.2, \n    width: window.width, \n    flexDirection: \'column\'\n  }, \n  previewText: {\n    fontFamily: \'Bebas Neue\', \n    fontSize: 23,\n    color: \'white\', \n    alignSelf: \'center\', \n    textAlign: \'center\', \n    margin: 5, \n    position: \'absolute\',\n    top: 0,\n    right: 0,\n    bottom: 0,\n    left: 0\n  }, \n\n});\n
\n',,'01/01/2016 02:48',HQ 34553318,'Why ternary operator in swift is so picky?','

The question is very simple, but I just could not find the answer!

\n\n

Why doesn\'t

\n\n
return x == 0? \"\" : \"Hello\"\n
\n\n

compile but

\n\n
return x == 0 ? \"\" : \"Hello\"\n
\n\n

does?

\n\n

This is really weird because all the other operators don\'t need an extra white space. e.g.

\n\n
let x = 1+1\nlet y = 1 + 1\n
\n\n

are the same.

\n\n

I think it has something to do with optionals. But when you use a ? operator on a variable, it must be used like this:

\n\n
let s: String? = nil\nlet x = s?.startIndex\n
\n\n

I mean it must follow another operator, right?

\n',,'01/01/2016 03:30',HQ 34553755,'hide/show fab with scale animation','

I\'m using custom floatingactionmenu. I need to implement scale animation on show/hide menu button like here\nfloating action button behaviour

\n\n

Is there any way to do this ?

\n',,'01/01/2016 05:21',HQ 34554026,'Accessing pointer member of the structure using structure pointer','

I have defined integer pointer inside the structure.And i want to use that member pointer using the structure pointer.My code is as shown below:

\n\n
#include<stdio.h>\n#include<stdlib.h>\n\nstruct abc\n{\n        int *x;\n};\n\nint main()\n{\n\n        struct abc *p = (struct abc*)malloc(sizeof(struct abc));\n        p->x = (int*)malloc(sizeof(int));\n        p->x = 10;\n        printf(\"The value is \%d\\n\",p->x);\n        free(p);\n}\n
\n\n

Now i am getting output as per my expectation.But i have got warning message while compiling.The warning messages are:

\n\n
temp.c:14:7: warning: assignment makes pointer from integer without a cast [enabled by default]\ntemp.c:15:2: warning: format ‘\%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat]\n
\n\n

I have also tried,

\n\n
*p->x = 10\n printf(\"The value is \%d\\n\",*p->x);\n
\n\n

but it is not working.

\n\n

How to solve this warning?

\n',,'01/01/2016 06:21',LQ_CLOSE 34554206,'How To Disable 2nd Saturday 4th Saturday ,Sunday And Holiday Date Using JQuery Calendar',' i want to Disable 2nd Saturday 4th saturday, Sunday And Public Holiday Date Using jQuery calendar \r\n\r\nAll year of 2nd Saturday And 4th Saturday ,Sunday Disable from Calendar\r\n\r\nPlease Help Me',,'01/01/2016 06:55',LQ_EDIT 34554671,'Resizing containers in bootstrap','I am new to bootstrap and i would like to find out how do i automatically resize my image to fit it into the container. And i would like to have a blank background for my container. Currently it is like this \r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n [![enter image description here][1]][1]\r\n\r\nI plugged the whole code from some template form and i was playing around with it. \r\n\r\nI would like to have a container where i could fit the image inside automatically resizing the image.\r\n\r\n\r\n [1]: http://i.stack.imgur.com/s16WB.png',,'01/01/2016 08:32',LQ_EDIT 34554721,'Retrieve all except some data of the another table','I have two table m_master and tbl_appointment\r\n[This is tbl_appointment table][1]\r\n\r\n\r\n[This is m_master table][2]\r\n\r\n\r\n [1]: http://i.stack.imgur.com/c7f7y.png\r\n [2]: http://i.stack.imgur.com/hD6Qf.png',,'01/01/2016 08:43',LQ_EDIT 34554871,'Changing Theme in Windows 10 UWP App Programmatically','

I was able to change theme using this.RequestedTheme = ElementTheme.Dark;\nBut what I need is the whole application level, since this one only change the theme of the current page to dark.

\n\n

Whenever I try this App.Current.RequestedTheme = ApplicationTheme.Dark;\nI always get this error

\n\n
\n

An exception of type \'System.NotSupportedException\' occurred in UWPApp.exe but was not handled in user code

\n
\n\n

Is there such a way that I can change the whole application theme from Light to Dark or vice versa?

\n\n

I\'m using VS2015

\n',,'01/01/2016 09:05',HQ 34554982,'TextBox Value Disappears VB6','I my case I am having two form Form 1 and Form 2.\r\nForm 1 having two Buttons and Form 2 is having one textbox.\r\nOn Button 1 Click event I am writing \"My Text\" in my Form 2 TextBox and on button 2 I am showing Form 2.\r\nWhat is happening is When I close my Form 2 using close [X] button and reopen it value in my Form 2 Textbox Disappears.\r\nPlease Help how can I resolve this,\r\n',,'01/01/2016 09:27',LQ_EDIT 34555135,'Pandas: read_html','

I\'m trying to extract US states from wiki URL, and for which I\'m using Python Pandas.

\n\n
import pandas as pd\nimport html5lib\nf_states = pd.read_html(\'https://simple.wikipedia.org/wiki/List_of_U.S._states\') \n
\n\n

However, the above code is giving me an error L

\n\n
\n

ImportError Traceback (most recent call last)\n in ()\n 1 import pandas as pd\n ----> 2 f_states = pd.read_html(\'https://simple.wikipedia.org/wiki/List_of_U.S._states\')

\n \n

if flavor in (\'bs4\', \'html5lib\'):\n 662 if not _HAS_HTML5LIB:\n --> 663 raise ImportError(\"html5lib not found, please install it\")\n 664 if not _HAS_BS4:\n 665 raise ImportError(\"BeautifulSoup4 (bs4) not found, please install it\")\n ImportError: html5lib not found, please install it

\n
\n\n

I installed html5lib and beautifulsoup4 as well, but it is not working. \nCan someone help pls.

\n',,'01/01/2016 09:55',HQ 34555448,'Reader Always gimme NULL','I\'m so new to C#, I wanna make an application that can easily connect to the SqlServer database, I have a separated DBConnection class, and I want to call this class from any form.\r\n\r\nthe problem is my \"reader\" always give Null\r\n\r\n class DBconnection\r\n {\r\n private SqlConnection conn;\r\n private SqlCommand cmd;\r\n private SqlDataReader rdr;\r\n private DataTable dt;\r\n\r\n\r\n\r\n private SqlConnection MyConnection\r\n {\r\n get\r\n {\r\n if (this.conn == null)\r\n {\r\n this.conn = new SqlConnection(DrivingSchool.Properties.Settings.Default.cdsConnectionString);\r\n }\r\n return conn;\r\n }\r\n }\r\n\r\n private SqlCommand MyCommand\r\n { \r\n get\r\n {\r\n if (cmd == null)\r\n {\r\n cmd = new SqlCommand();\r\n MyCommand.Connection = conn;\r\n }\r\n\r\n return cmd;\r\n }\r\n }\r\n\r\n public DataTable RunQuery(string query)\r\n {\r\n\r\n dt = new DataTable();\r\n MyCommand.CommandText = query;\r\n MyCommand.Connection = conn;\r\n MyConnection.Open();\r\n\r\n rdr = MyCommand.ExecuteReader(CommandBehavior.CloseConnection);\r\n\r\n if(rdr.HasRows)\r\n { dt.Load(rdr); }\r\n\r\n MyConnection.Close();\r\n\r\n return dt;\r\n }\r\n }',,'01/01/2016 10:43',LQ_EDIT 34555603,'MongoDB Failing to Start - ***aborting after fassert() failure','

I am new to Ubuntu (Linux tbh). I encountered problem with starting MongoDB service. I want to created web app using Ruby on Rails and MongoDB but mongo seems to fail to start.

\n\n

I followed this MongoDB installation on Ubuntu all of installation went without problems until I got to sudo service mongod start

\n\n

mongod.log

\n\n
2016-01-01T10:58:15.545+0000 I CONTROL  ***** SERVER RESTARTED *****\n2016-01-01T10:58:15.548+0000 I CONTROL  [initandlisten] MongoDB starting : pid=3868 port=27017 dbpath=/var/lib/mongodb 64-bit host=damian-CX61-0NC-CX61-0ND-CX61-0NF-CX61-0NE\n2016-01-01T10:58:15.548+0000 I CONTROL  [initandlisten] db version v3.0.8\n2016-01-01T10:58:15.548+0000 I CONTROL  [initandlisten] git version: 83d8cc25e00e42856924d84e220fbe4a839e605d\n2016-01-01T10:58:15.548+0000 I CONTROL  [initandlisten] build info: Linux ip-10-187-89-126 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49\n2016-01-01T10:58:15.548+0000 I CONTROL  [initandlisten] allocator: tcmalloc\n2016-01-01T10:58:15.548+0000 I CONTROL  [initandlisten] options: { config: \"/etc/mongod.conf\", net: { bindIp: \"127.0.0.1\", port: 27017 }, storage: { dbPath: \"/var/lib/mongodb\", journal: { enabled: true } }, systemLog: { destination: \"file\", logAppend: true, path: \"/var/log/mongodb/mongod.log\" } }\n2016-01-01T10:58:15.567+0000 E NETWORK  [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted\n2016-01-01T10:58:15.567+0000 I -        [initandlisten] Fatal Assertion 28578\n2016-01-01T10:58:15.567+0000 I -        [initandlisten] \n\n***aborting after fassert() failure\n
\n\n

So what I am doing wrong or its different issue?

\n',,'01/01/2016 11:08',HQ 34555643,'What\'s the best way to store text data?','

I am kinda new to Android development, but I coded a lot of C#(WinF,WPF). I created an quiz app (German words) for app and I\'m not quite sure how to store and load dictionaries (a file, where lines contain 2 words). What is the best way to store these dictionaries? I googled a bit, but didn\'t find exact answers. At the moment I generate the words directly in the code. \nThanks!

\n',,'01/01/2016 11:15',LQ_CLOSE 34555752,'php rearrange array elements based on condition','basically i have this array:\r\n\r\n array(\r\n\t\'08:00-08:40\' => array(\r\n\t\t\'t\' => \'39\',\r\n\t\t\'sub\' => \'COMP\'\r\n\t),\r\n\t\'08:40-09:20\' => array(\r\n\t\t\'t\' => \'17\',\r\n\t\t\'sub\' => \'KIS\'\r\n\t),\r\n\t\'09:20-10:00\' => array(\r\n\t\t\'t\' => \'36\',\r\n\t\t\'sub\' => \'B/ST\'\r\n\t),\r\n\t\'10:20-11:00\' => array(\r\n\t\t\'t\' => \'7\',\r\n\t\t\'sub\' => \'ENG\'\r\n\t),\r\n\t\'11:00-11:40\' => array(\r\n\t\t\'t\' => \'36\',\r\n\t\t\'sub\' => \'B/ST\'\r\n\t),\r\n\t\'11:40-12:20\' => array(\r\n\t\t\'t\' => \'31\',\r\n\t\t\'sub\' => \'HIS\'\r\n\t),\r\n\t\'12:20-13:00\' => array(\r\n\t\t\'t\' => \'26\',\r\n\t\t\'sub\' => \'PHY\'\r\n\t),\r\n\t\'14:00-14:40\' => array(\r\n\t\t\'t\' => \'33\',\r\n\t\t\'sub\' => \'GEO\'\r\n\t),\r\n\t\'14:40-15:20\' => array(\r\n\t\t\'t\' => \'31\',\r\n\t\t\'sub\' => \'HIS\'\r\n\t),\r\n\t\'15:20-16:00\' => array(\r\n\t\t\'t\' => \'20\',\r\n\t\t\'sub\' => \'BIO\'\r\n\t)\r\n)\r\n\r\nMy requirement is that if an **element[\'sub\']** appears twice in the whole array then both instances should be next to each other in the array.\r\n\r\nso for the above array i expect to have the following output:\r\n\r\n array(\r\n\t\'08:00-08:40\' => array(\r\n\t\t\'t\' => \'39\',\r\n\t\t\'sub\' => \'COMP\'\r\n\t),\r\n\t\'08:40-09:20\' => array(\r\n\t\t\'t\' => \'17\',\r\n\t\t\'sub\' => \'KIS\'\r\n\t),\r\n\t\'09:20-10:00\' => array(\r\n\t\t\'t\' => \'36\',\r\n\t\t\'sub\' => \'B/ST\'\r\n\t),\r\n \'11:00-11:40\' => array(\r\n\t\t\'t\' => \'36\',\r\n\t\t\'sub\' => \'B/ST\'\r\n\t),\r\n\t\'10:20-11:00\' => array(\r\n\t\t\'t\' => \'7\',\r\n\t\t\'sub\' => \'ENG\'\r\n\t),\r\n\t\'11:40-12:20\' => array(\r\n\t\t\'t\' => \'31\',\r\n\t\t\'sub\' => \'HIS\'\r\n\t),\r\n \'14:40-15:20\' => array(\r\n\t\t\'t\' => \'31\',\r\n\t\t\'sub\' => \'HIS\'\r\n\t),\r\n\t\'12:20-13:00\' => array(\r\n\t\t\'t\' => \'26\',\r\n\t\t\'sub\' => \'PHY\'\r\n\t),\r\n\t\'14:00-14:40\' => array(\r\n\t\t\'t\' => \'33\',\r\n\t\t\'sub\' => \'GEO\'\r\n\t),\r\n\t\'15:20-16:00\' => array(\r\n\t\t\'t\' => \'20\',\r\n\t\t\'sub\' => \'BIO\'\r\n\t)\r\n)\r\n\r\ni cant figure out how to adapt [this solution][1] to my case..any help much appreciated\r\n\r\n\r\n [1]: http://stackoverflow.com/questions/3286006/reposition-array-elements-based-on-a-condition-in-php',,'01/01/2016 11:34',LQ_EDIT 34556569,'ios/objective-c/xcode: Expand Label based on quantity of text using Storyboard','I have a UIlabel linked to a property that can contain text of many different possible lengths.\r\n\r\nHow can I get the label to expand vertically to accommodate different quantities of text?\r\n\r\nI have set lines to 0 in storyboard. And I\'ve experimented with different heights in the Size Inspector. But the label is not adjusting and I am only seeing one line of text that ends at edge of label.\r\n\r\nWould prefer not to use auto layout if possible unless there is no other way.\r\n\r\nThanks in advance for any suggestions.\r\n\r\n',,'01/01/2016 13:33',LQ_EDIT 34556906,'output FILE ,is this a fault?','\r\nmy code here\r\n\r\n #include \r\n #include\r\n #include\r\n \r\n char filename[100];\r\n FILE *stream, *stream2;\r\n char s[20];\r\n struct date\r\n {\r\n \tint day, month, year;\r\n };\r\n struct employee\r\n {\r\n \tint ID;\r\n \tchar name[100];\r\n \tdate birthdate;\r\n \tchar address[20];\r\n \tchar rank[20];\r\n \tint money;\r\n };\r\n void main()\r\n {\r\n \r\n \t\r\n \terrno_t err;\r\n \r\n \t// Open for read (will fail if file \"crt_fopen_s.c\" does not exist)\r\n \t\r\n \t// Open for write \r\n \terr = fopen_s(&stream2, \"C:/Users/Van/Desktop/LAALAL/fool.txt\", \"w+\");\r\n \tif (err == 0)\r\n \t{\r\n \t\r\n \t\t\r\n \r\n \t\temployee nv;\r\n \t\tstd::cout << \"\\nInput information of an employee:\\n\";\r\n \t\tstd::cout << \"\\tInput ID : \";\r\n \t\tstd::cin >> nv.ID;\r\n \t\tstd::cin.sync();\r\n \t\tstd::cout << \"\\tInput name : \";\r\n \t\tstd::cin.clear();\r\n \t\tgets_s(s);\r\n \t\tgets_s(nv.name);\r\n \t\tstd::cout << \"\\tInput birthdate (Day Month Year ) : \";\r\n \t\tstd::cin >> nv.birthdate.day >> nv.birthdate.month >> nv.birthdate.year;\r\n \r\n \t\tstd::cout << \"\\tInput address: \";\r\n \t\tstd::cin.clear();\r\n \t\tgets_s(s);\r\n \t\tgets_s(nv.address);\r\n \t\tstd::cout << \"\\tInput rank : \";\r\n \t\tstd::cin.clear();\r\n \t\tgets_s(s);\r\n \t\tgets_s(nv.rank);\r\n \t\tstd::cout << \"\\tMoney : \";\r\n \t\tstd::cin >> nv.money;\r\n \t\tstd::cin.sync();\r\n \r\n \t\tstd::fwrite(&nv, sizeof(nv), 1, stream2);\r\n \t\tstd::fclose(stream2);\r\n \t}\r\n \t\r\n \t\r\n }\r\nWell i don\'t meet the problem with code but when i input my information to txt file , i cant read the output in txt file ,here is the picture of my output\r\n[enter image description here][1]\r\nWhat is my problems??\r\nThanks in advance for your time !!!\r\n\r\n\r\n [1]: http://i.stack.imgur.com/gaPqY.png',,'01/01/2016 14:20',LQ_EDIT 34556991,'Pod install displaying error in cocoapods version 1.0.0.beta.1','

My podfile was working but after updating to cocoapods version 1.0.0.beta.1

\n\n

pod install displays following error

\n\n
MacBook-Pro:iOS-TuneIn home$ pod install\nFully deintegrating due to major version update\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\nDeleted 1 \'Embed Pods Frameworks\' build phases.\n- libPods.a\n- Pods.debug.xcconfig\n- Pods.release.xcconfig\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\n- libPods.a\nDeleted 1 empty `Pods` groups from project.\nRemoving `Pods` directory.\n\nProject has been deintegrated. No traces of CocoaPods left in project.\nNote: The workspace referencing the Pods project still remains.\nUpdating local specs repositories\nAnalyzing dependencies\n[!] The dependency `AFNetworking (= 2.6.3)` is not used in any concrete target.\nThe dependency `MBProgressHUD (~> 0.9.1)` is not used in any concrete target.\nThe dependency `PDKeychainBindingsController (~> 0.0.1)` is not used in any concrete target.\nThe dependency `FMDB/SQLCipher` is not used in any concrete target.\nThe dependency `ZXingObjC (~> 3.1.0)` is not used in any concrete target.\nThe dependency `SDWebImage (~> 3.7.2)` is not used in any concrete target.\nThe dependency `SignalR-ObjC (~> 2.0.0.beta3)` is not used in any concrete target.\nThe dependency `CJPAdController (from `https://github.com/nabeelarif100/CJPAdController.git`)` is not used in any concrete target.\nThe dependency `ECSlidingViewController (~> 2.0.3)` is not used in any concrete target.\nThe dependency `VGParallaxHeader` is not used in any concrete target.\nThe dependency `EMString` is not used in any concrete target.\nThe dependency `Google/SignIn` is not used in any concrete target.\nThe dependency `VIPhotoView (~> 0.1)` is not used in any concrete target.\nThe dependency `EncryptedCoreData (from `https://github.com/project-imas/encrypted-core-data.git`)` is not used in any concrete target.\nMacBook-Pro:iOS-TuneIn home$ \n
\n\n

Podfile:

\n\n
source \'https://github.com/CocoaPods/Specs.git\'\nplatform :ios, \'7.0\'\npod \'AFNetworking\', \'2.6.3\'\npod \'MBProgressHUD\', \'~> 0.9.1\'\npod \'PDKeychainBindingsController\', \'~> 0.0.1\'\npod \'FMDB/SQLCipher\'\npod \'ZXingObjC\', \'~> 3.1.0\'\npod \'SDWebImage\', \'~>3.7.2\'\npod \'SignalR-ObjC\',\'~>2.0.0.beta3\'\npod \'CJPAdController\', :git => \'https://github.com/nabeelarif100/CJPAdController.git\'\npod \'ECSlidingViewController\', \'~> 2.0.3\'\npod \'VGParallaxHeader\'\npod \'EMString\'\npod \'Google/SignIn\'\npod \'VIPhotoView\', \'~> 0.1\'\npod \'EncryptedCoreData\', :git => \'https://github.com/project-imas/encrypted-core-data.git\'\n
\n',,'01/01/2016 14:30',HQ 34557209,'How do I make a constructor for a derived class?','

I am trying to make a constructor for a derived class. Doing it this way doesn\'t seem to work:

\n\n
#include <iostream>\n\nclass FirstClass\n{\npublic:\n    int X;\n    FirstClass(int x)\n    {\n        this->X = x;\n    }\n    int getXpow() { return pow(X, 2); }\n\n};\n\nclass SecondClass : FirstClass\n{\npublic:\n    SecondClass(int x)\n    {\n        FirstClass::FirstClass(X);\n    }\n\n    int getXpow() { return pow(X, 3); }\n};\n\nint main()\n{\n    using namespace std;\n    FirstClass FCobj(3);\n    cout << FCobj.getXpow() << endl;\n    SecondClass SCobj(3);\n    cout << SCobj.getXpow() << endl;\n\n    system(\"pause\");\n    return 0;\n}\n
\n\n

because it says at the first { bracket of SecondClass(int x) the following thing Error: no default constructor exists for class \"FirstClass\". And how does constructor inheritance even work?

\n',,'01/01/2016 14:58',LQ_CLOSE 34557363,'how can i create a dynamic tow dimensional array in c++?',' I am using c++ in my lesson and for solving a program i should create an array that may be change in dimensions. \r\nfor example:\r\n\r\n {\r\n int I,J;\r\n cin>>I;\r\n cin>>J;\r\n double X[I][J];\r\n double B[I][J];\r\n }\r\n',,'01/01/2016 15:21',LQ_EDIT 34557587,'Re-exporting ES6 modules in TS 1.7?','

I\'m getting a bit lost in TS re-exports. Say I create a pair of test modules;

\n\n

test1.ts;

\n\n
export function test1() {\n    return \'test\';\n}\n
\n\n

test2.ts;

\n\n
export function test2() {\n    return \'test\';\n}\n
\n\n

I believe I should be able to then do something like this;

\n\n

combined.ts;

\n\n
export * from \'./test1\';\nexport * from \'./test2\';\n\nmodule.exports = {\n    test1: test1,\n    test2: test2\n};\n
\n\n

But, no such luck. There seem to be lots of GitHub issues discussing various approaches to this, including an old hack using export import * from \'./test1\' but they all seem to argue what the ES6 spec really means, and none actually work..

\n\n

What\'s the right way to do a rollup like this? Am I just going down the wrong path to split a module up across files? Are namespaces more appropriate here?

\n',,'01/01/2016 15:50',HQ 34558002,'Haskell Stack Ghci test-suite','

I\'m trying to use stack to load my test-suite in ghci and have it load the QuickCheck and hspec dependency.

\n\n

How can I do this?

\n\n

I\'m using the franklinchen template.
\nhttps://github.com/commercialhaskell/stack-templates/blob/master/franklinchen.hsfiles

\n\n

I have tried
\nstack ghci spec
\nstack ghci test-suite
\nstack ghci --main-is spec

\n\n

I modified the test-suite spec to target the main-is: LibSpec.hs file

\n\n
test-suite spec\n  default-language:    Haskell2010\n  ghc-options:         -Wall\n  type:                exitcode-stdio-1.0\n  hs-source-dirs:      test\n  main-is:             LibSpec.hs\n  build-depends:       base\n                     , chapterexercises\n                     , hspec\n                     , QuickCheck\n
\n',,'01/01/2016 16:48',HQ 34558264,'Fetch API with Cookie','

I am trying out the new Fetch API but is having trouble with Cookies. Specifically, after a successful login, there is a Cookie header in future requests, but Fetch seems to ignore that headers, and all my requests made with Fetch is unauthorized.

\n\n

Is it because Fetch is still not ready or Fetch does not work with Cookies?

\n\n

I build my app with Webpack. I also use Fetch in React Native, which does not have the same issue.

\n',,'01/01/2016 17:21',HQ 34558390,'Why does the reverse() function in the Swift standard library return ReverseRandomAccessCollection?','

Now that I\'ve learned Swift (to a reasonable level) I\'m trying to get to grips with the standard library, but in truth it\'s mainly ελληνικά to me!

\n\n

So a specific question: I have an array of strings and I can call reverse() on it.

\n\n
let arr = [\"Mykonos\", \"Rhodes\", \"Naxos\"].reverse()\n
\n\n

Now naively I thought I\'d get back a type of Array from this. (Ruby for example has a similar method that you pass an array and get back an array)

\n\n

But arr is now actually of type

\n\n
ReverseRandomAccessCollection<Array<String>>\n
\n\n

which is actually a struct, which conforms to CollectionType:

\n\n
public struct ReverseRandomAccessCollection<Base : CollectionType where Base.Index : RandomAccessIndexType> : _ReverseCollectionType\n
\n\n

This means I can do this:

\n\n
for item in arr {\n  print(item)\n}\n
\n\n

but I can\'t do

\n\n
print(arr[0])\n
\n\n

Why is this designed to be this way?

\n\n

Dictionaries in Swift also implement CollectionType, so I can do this:

\n\n
let dict = [\"greek\" : \"swift sometimes\", \"notgreek\" : \"ruby for this example\"].reverse()\n
\n\n

But dictionaries are not ordered like arrays, so why can I call reverse() on dicts?

\n\n

Bonus points if anyone can point me in the direction of where I can read up and improve my Swift stdlib foo, Ευχαριστώ!

\n',,'01/01/2016 17:35',HQ 34558996,'eb deploy does not update the code','

I am trying to deploy an application version but eb deploy command fails with:

\n\n
\n

ERROR: Update environment operation is complete, but with errors. For\n more information, see troubleshooting documentation.

\n
\n\n

I checked the logs, made some changes to the code, committed and deployed again and guess what, it failed again. The logs indicate the same error, disregarding my changes. The error occurs in a file in this directory /var/app/ondeck/app/, when I go check, I can see the previous version is there.

\n\n

I tried deploying using the Elastic Beanstalk dashboard, but somehow the instance is not receiving the new version. Can someone help me with this? Thanks.

\n',,'01/01/2016 18:52',HQ 34559058,'How to create a function that returns a byte array in C++? Arduino project.','I am currently starting to learn C++ via Arduino programming. I am programming an 8*8 LED Matrix, and currently have a semi-working code that uses a joystick to control a dot on screen. Only problem is: its nearly 1000 lines long. It\'s equivalent to writing an 1000 page essay only saying \"Pig, blanket, market\" over and over again until I get to the actual logic involved.\r\n\r\nMy friend suggested to make it shorter, I could make a function which returns a byte. \r\n\r\nHow does one do this?\r\n\r\nhttp://pastebin.com/8ud9ny2U <-- This is my code. !WARNING! Not a pretty code. At all. \r\n\r\nHelp is much appreciated.\r\n',,'01/01/2016 18:59',LQ_EDIT 34559136,'Print list content in a given order','
lt = [\'7,777.7\', \'777.7\', \'77,777.7\', \'77.7\']\n
\n\n

How can I proceed to print the list content like this ?

\n\n
 7,777.7\n   777.7\n77,777.7\n    77.7\n
\n',,'01/01/2016 19:08',LQ_CLOSE 34559402,'c# - List all primes upto 100','Written the below code trying to identify all primes up 100. It\'s outputting 1,2 and 5. Can anyone see any reason why it wouldn\'t continue past the first 3?\r\n\r\nI know there\'s some efficiency tweaks I can do (only odds numbers etc) but just trying to get the core (overkill) concept down first. I\'m a complete noob just trying to enhance my intuition with programming so I know it\'s probably not the most elegant solution but more interested in why it doesn\'t work.\r\n\r\nAppreciate any help.. HAPPY NEW YEAR!\r\n\r\n\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n int q = 100;\r\n for (int i = 1; i < q; i++)\r\n {\r\n if ((q \% i) == 0)\r\n {\r\n bool isPrime = true;\r\n for (int j = 2; j < i; j++) \r\n {\r\n if ((i \% j) == 0)\r\n {\r\n isPrime = false;\r\n }\r\n }\r\n \r\n if (isPrime == true)\r\n { Console.WriteLine(i + \" is a prime number... hopefully.\"); }\r\n \r\n }\r\n }\r\n Console.ReadKey();\r\n }',,'01/01/2016 19:41',LQ_EDIT 34559458,'bluebird.js vs bluebird.core.js what is the difference?','

What is the difference between bluebird.js and bluebird.core.js?

\n\n

When should I use bluebird.core.js instead of bluebird.js?

\n\n

I haven\'t been able to find anything in the bluebird site or elsewhere.

\n',,'01/01/2016 19:49',HQ 34559553,'Create a temporary directory in PowerShell?','

PowerShell 5 introduces the New-TemporaryFile cmdlet, which is handy. How can I do the same thing but instead of a file create a directory? Is there a New-TemporaryDirectory cmdlet?

\n',,'01/01/2016 19:59',HQ 34559616,'how to make sure a file\'s integrity in C#','

I am deploying a file along with a C# application. And I want to make sure that file is same as it was supplied otherwise the C# application will show error. Now, a file\'s creation and modification date can be changed after it is modified. Is there any checksum/hash etc. in C# to make sure file is not changed by user.

\n',<.net>,'01/01/2016 20:10',LQ_CLOSE 34559807,'Stopwatch and ReadKey doesn\'t work properly','I\'m working on my multi threading password cracker, only numbers. It must show the how much time has passed to find the password. I used Stopwatch to find it, but in functions, stopwatch doesn\'t works..\r\n\r\nhere is my code\r\n\r\n using System;\r\n using System.Collections.Generic;\r\n using System.Linq;\r\n using System.Text;\r\n using System.Threading.Tasks;\r\n using System.Diagnostics;\r\n using System.Threading;\r\n\r\n\r\n namespace ConsoleApplication4\r\n {\r\n class Program\r\n {\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n int psw = 14995399;\r\n\r\n\r\n Stopwatch time = new Stopwatch();\r\n\r\n Thread Thread1 = new Thread(islem1);\r\n Thread Thread2 = new Thread(islem2);\r\n Thread Thread3 = new Thread(islem3);\r\n Thread Thread4 = new Thread(islem4);\r\n\r\n time.Start();\r\n\r\n Thread1.Start();\r\n Thread2.Start();\r\n Thread3.Start();\r\n Thread4.Start();\r\n\r\n Thread.Sleep(1000);\r\n\r\n time.Stop();\r\n System.Console.WriteLine(\"Time elapsed: {0}\", time.Elapsed);\r\n Console.ReadKey();\r\n }\r\n\r\n\r\n\r\n\r\n\r\n static void islem1()\r\n {\r\n for (int i = 00000000; i < 25000000; i++)\r\n {\r\n int psw = 14995399;\r\n if (i == psw)\r\n {\r\n System.Console.WriteLine(\"Şifre=\" + i);\r\n \r\n time.Stop();\r\n Console.WriteLine(\"Time elapsed: {0}\", time.Elapsed);\r\n Console.ReadKey();\r\n }\r\n }\r\n }\r\n\r\n\r\n static void islem2()\r\n {\r\n for (int i = 25000000; i < 50000000; i++)\r\n {\r\n int psw = 14995399;\r\n if (i == psw)\r\n {\r\n System.Console.WriteLine(\"Şifre=\" + i);\r\n\r\n time.Stop();\r\n Console.WriteLine(\"Time elapsed: {0}\", time.Elapsed);\r\n Console.ReadKey();\r\n\r\n\r\n\r\n }\r\n }\r\n }\r\n\r\n\r\n static void islem3()\r\n {\r\n for (int i = 50000000; i < 75000000; i++)\r\n {\r\n int psw = 14995399;\r\n if (i == psw)\r\n {\r\n System.Console.WriteLine(\"Şifre=\" + i);\r\n\r\n time.Stop();\r\n Console.WriteLine(\"Time elapsed: {0}\", time.Elapsed);\r\n Console.ReadKey();\r\n }\r\n }\r\n }\r\n\r\n\r\n static void islem4()\r\n {\r\n for (int i = 75000000; i < 100000000; i++)\r\n {\r\n int psw = 14995399;\r\n if (i == psw)\r\n {\r\n System.Console.WriteLine(\"Şifre=\" + i);\r\n\r\n time.Stop();\r\n Console.WriteLine(\"Time elapsed: {0}\", time.Elapsed);\r\n Console.ReadKey();\r\n }\r\n }\r\n }\r\n\r\n }\r\n }\r\n',,'01/01/2016 20:33',LQ_EDIT 34560087,'Vbscript email attachment','I\'m writing a vbscript to send email notification when file arrives in Test folder\r\n\r\nI want to attach that file to my email.please help\r\n\r\nThe file name is not constant,each time a file arrives with different name.\r\nBelow is my code \r\n\r\n\r\nConst PATH = \"F:\\Test\"\r\n\r\ndim fso: set fso = CreateObject(\"Scripting.FileSystemObject\")\r\n\r\ndim folder: set folder = fso.getFolder(PATH)\r\n\r\nif folder.files.Count <> 0 then\r\n\r\nstrSMTPFrom = \"errorfile@test.com\"\r\n\r\nstrSMTPTo = \"test@test.com\"\r\n\r\nstrSMTPRelay = \"127.0.0.1\"\r\n\r\nstrTextBody = \"The attached file arrived in Test folder\"\r\n\r\nstrSubject = \"File arrived in Test folder\"\r\n\r\nstrAttachment = \r\n\r\nSet oMessage = CreateObject(\"CDO.Message\")\r\n\r\noMessage.Configuration.Fields.Item(\"http://schemas.microsoft.com/cdo/configuration/sendusing\") = 2 \r\n\r\noMessage.Configuration.Fields.Item(\"http://schemas.microsoft.com/cdo/configuration/smtpserver\") = strSMTPRelay\r\n\r\noMessage.Configuration.Fields.Item(\"http://schemas.microsoft.com/cdo/configuration/smtpserverport\") = 25 \r\n\r\noMessage.Configuration.Fields.Update\r\n\r\noMessage.Subject = strSubject\r\noMessage.From = strSMTPFrom\r\n\r\noMessage.To = strSMTPTo\r\n\r\noMessage.TextBody = strTextBody\r\n\r\noMessage.AddAttachment strAttachment\r\n\r\noMessage.Send\r\n\r\nend if\r\n\r\n\r\n',,'01/01/2016 21:10',LQ_EDIT 34560768,'Can I throw from class init() in Swift with constant string loaded from file?','

I\'d like my class init() in Swift to throw an error if something goes wrong with loading a file into a string within the class. Once the file is loaded, the string will not be altered, so I would prefer to use let. This works:

\n\n
class FileClass {    \n    var text: NSString = \"\"   \n    init() throws {   \n        do {\n            text = try NSString( contentsOfFile: \"/Users/me/file.txt\", encoding: NSUTF8StringEncoding ) }\n        catch let error as NSError {\n            text = \"\"\n            throw error\n        }      \n    }\n}\n
\n\n

but when I replace

\n\n
var text: NSString = \"\"\n
\n\n

with

\n\n
let text: NSString\n
\n\n

I get an All stored properties of a class instance must be initialized before throwing from an initializer error.

\n\n

I\'ve tried various approaches such as to make text optional

\n\n
let text: NSString?\n
\n\n

but haven\'t found any that work. It it possible to have text be loaded from a file, immutable, and for init() to throw an error? Can I have my cake and eat it three?

\n\n

Many thanks in advance!

\n',,'01/01/2016 22:42',HQ 34560942,'C# - Count a specific word in richTextBox1 and send the result to label1','

I\'m not sure, if this question is unique, but I couldn\'t find the answer that I was looking for.

\n\n

I simply need a C# code that counts how many times a word appear in richTextBox1 and send the result to label1.

\n\n

Example;\nlabel1.text = how many times the word \"house\" appears in richTextBox1.

\n\n

I know that I should try first but believe me I tried and I failed. I am new to this so I hope someone can show me.

\n\n

Regards

\n',,'01/01/2016 23:06',LQ_CLOSE 34561323,'Android: Create bigger Floating Action Button with bigger icon','

I want to create a bigger Floating Action Button (FAB), more than the usual 56 dp, with a bigger icon inside.\n(For my purpose an icon will never be self-explanatory so I will create a png-file containing a short text and use this png as icon.)

\n\n

Increasing the size of the FAB works fine:
\nas i don\'t use the mini-FloatingActionButton, i redefined the mini-button-size.
\nin my layout-xml i specify:

\n\n
<android.support.design.widget.FloatingActionButton\n    ...\n    app:fabSize=\"mini\"\n    ....\n
\n\n

and in the dimensions.xml i redefine the size for the mini-fab:

\n\n
<dimen name=\"fab_size_mini\">80dp</dimen>\n
\n\n

However, I didn\'t manage to get a bigger icon on the FAB.\nI tried icons with different dp\'s from the material icons library - no success. Also setting a padding on the FAB-layout did not work.

\n\n

Any suggestions? Thanks!

\n',,'02/01/2016 00:00',HQ 34561346,'Angular2 exception: Token must be defined','

app/boot.ts

\n\n
import {bootstrap} from \'angular2/platform/browser\';\nimport {AppComponent} from \'./app.component\';\nbootstrap(AppComponent);\n
\n\n

app/app.component.ts

\n\n
import {Component} from \'angular2/core\';\n@Component({\n  selector: \'my-app\',\n  template: \'{{title}}\'\n})\nclass AppComponent {\n  title: \"app\"\n}\n
\n\n

Error:

\n\n
EXCEPTION: Token must be defined!\nSTACKTRACE:BrowserDomAdapter.logError @ angular2.dev.js:23514\nExceptionHandler.call                 @ angular2.dev.js:1147\n(anonymous function)                  @ angular2.dev.js:14801\nNgZone._notifyOnError                 @ angular2.dev.js:5796\ncollection_1.StringMapWrapper.merge.onError @ angular2.dev.js:5700\nrun                                   @ angular2-polyfills.js:141\n(anonymous function)                  @ angular2.dev.js:5719\nNgZone.run                            @ angular2.dev.js:5681\nApplicationRef_.bootstrap             @ angular2.dev.js:14906\nbootstrap                             @ angular2.dev.js:25054\nexecute                               @ boot.ts:4\nu                                     @ system.src.js:4597\nexecute                               @ system.src.js:4597\ny                                     @ system.src.js:4597\n...\n
\n',,'02/01/2016 00:05',HQ 34561614,'Should I use the final modifier when declaring case classes?','

According to scala-wartremover static analysis tool I have to put \"final\" in front of every case classes I create: error message says \"case classes must be final\".

\n\n

According to scapegoat (another static analysis tool for Scala) instead I shouldn\'t (error message: \"Redundant final modifier on case class\")

\n\n

Who is right, and why?

\n',,'02/01/2016 01:07',HQ 34561843,'I need to create an array with numbers given by the user',' System.out.println(\"Please enter a coefficients of a polynomial’s terms:\");\r\n\t\tString coefficents = keyboard.nextLine();\r\n\t\tString[] three = coefficents.split(\" \");\r\n\t\tint[] intArray1 = new int[three.length];\r\n\r\n//Does anyone know how i can make this work because right not it builds but when i run it, it gives me [I@33909752\r\n\r\n//if someone could show me or explain to me what\'s wrong that would help',,'02/01/2016 01:54',LQ_EDIT 34562193,'Form Validation project','

I am working on a project for my company and we are not allowed to alter the HTML in any way. There is already a Page set up in the Using html to do Data Validation. There are to separate forms of validation questions on the page and each form contains its own \"submit\" button. Although both submit buttons have the same \"id\". is there any way to figure out how isolate each button to apply a different \".onclick\" method to them. Thanks in advance.

\n',,'02/01/2016 03:06',LQ_CLOSE 34562200,'How do I make the Kotlin compiler treat warnings as errors?','

I have a Kotlin project where I\'d like to have Kotlin warnings treated as errors. How can I do that?

\n',,'02/01/2016 03:06',HQ 34562473,'Most Pythonic way to kill a thread after some period of time','

I would like to run a process in a thread (which is iterating over a large database table). While the thread is running, I just want the program to wait. If that thread takes longer then 30 seconds, I want to kill the thread and do something else. By killing the thread, I mean that I want it to cease activity and release resources gracefully.

\n\n

I figured the best way to do this was through a Thread()\'s join(delay) and is_alive() functions, and an Event. Using the join(delay) I can have my program wait 30 seconds for the thread to finish, and by using the is_alive() function I can determine if the thread has finished its work. If it hasn\'t finished its work, the event is set, and the thread knows to stop working at that point.

\n\n

Is this approach valid, and is this the most pythonic way to go about my problem statement?

\n\n

Here is some sample code:

\n\n
import threading\nimport time\n\n# The worker loops for about 1 minute adding numbers to a set\n# unless the event is set, at which point it breaks the loop and terminates\ndef worker(e):\n    data = set()\n    for i in range(60):\n        data.add(i)\n        if not e.isSet():\n            print \"foo\"\n            time.sleep(1)\n        else:\n            print \"bar\"\n            break\n\ne = threading.Event()\nt = threading.Thread(target=worker, args=(e,))\nt.start()\n\n# wait 30 seconds for the thread to finish its work\nt.join(30)\nif t.is_alive():\n    print \"thread is not done, setting event to kill thread.\"\n    e.set()\nelse:\n    print \"thread has already finished.\"\n
\n',,'02/01/2016 04:01',HQ 34562496,'Gulp error internal/child_process.js:298 throw errnoException(err, \'spawn\'); Error: spawn EACCES','

I searched for the cause of this error and found that I have to change permissions or run gulp using sudo, but still got the same error.\nCan anyone please help...

\n\n

internal/child_process.js:298\n throw errnoException(err, \'spawn\');\n ^

\n\n

Error: spawn EACCES\n at exports._errnoException (util.js:870:11)\n at ChildProcess.spawn (internal/child_process.js:298:11)\n at exports.spawn (child_process.js:362:9)\n at exports.execFile (child_process.js:151:15)\n at ExecBuffer. (/var/www/conFusion/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/exec-buffer/index.js:91:3)\n at /var/www/conFusion/node_modules/gulp-rev/node_modules/vinyl-file/node_modules/graceful-fs/graceful-fs.js:42:10\n at /var/www/conFusion/node_modules/gulp-cache/node_modules/cache-swap/node_modules/graceful-fs/graceful-fs.js:42:10\n at /var/www/conFusion/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/vinyl-fs/node_modules/graceful-fs/graceful-fs.js:42:10\n at FSReqWrap.oncomplete (fs.js:82:15)

\n',,'02/01/2016 04:05',HQ 34562551,'c++ vector type function implemetation',' class City\r\n {\r\n private:\r\n int id;\r\n string name;\r\n int populations;\r\n int nooftourist;\r\n vector&attractions;\r\n public:\r\n City(int id,string name,int populations,int nooftourist):id(id),name(name),populations(populations),nooftourist(nooftourist){}\r\n void setId(int _id);\r\n void setName(string _name);\r\n int getId();\r\n string getName();\r\n void display(){}\r\n vectorgetAttractions() { return attractions;}\r\n\r\n};\r\n\r\nwhat wrong with my program,i dont understand the vector type function\r\n',,'02/01/2016 04:17',LQ_EDIT 34562708,'Java and enum [Novice]','

I\'ve got ome fail in java enums;

\n\n

I\'d like to have individual id number for specified enum created, but number seems to propagate to next enum object unfortunately.\nLook at my case:

\n\n
enum type{ int i;}\nint id=1;\ntype t1.i=id;\nid=2;\ntype t2.i=id;\n
\n\n

But t1 has got t2 id number, but I want to have different id\'s.

\n\n

Is there any solution in this case ?

\n\n

I inform that it\'s simplification of my case and I can\'t change enum type to class.

\n',,'02/01/2016 04:48',LQ_CLOSE 34562730,'Difference between uwsgi_pass and proxy_pass in Nginx?','

I\'m running uWSGI behind Nginx and have been using proxy_pass to get Nginx to hit uWSGI. Is there any benefit to switch to uwsgi_pass. If so, what is it?

\n',,'02/01/2016 04:54',HQ 34562879,'How to play gif in android from url?','

I want to play animated gif from url in android app like imgur app. Imagur is superb and very fast. I am loading gif with webview but its not up to the mark.

\n',,'02/01/2016 05:21',HQ 34563285,'Filter Name with Starting Letter in C#','here is my code for select details by checking the name given.\r\nhere I want to do name filter by starting letter also.. how can I do it?\r\n\r\nselect * from tblcustomer\r\nwhere \r\ncustomername=case @customername\r\n\t\twhen null then customername\r\n\t\telse @customername',,'02/01/2016 06:31',LQ_EDIT 34563454,'Django ImageField upload_to path','

I\'m having trouble understanding and using Django\'s ImageField.

\n\n

I have a model:

\n\n
class BlogContent(models.Model):\n    title = models.CharField(max_length=300)\n    image = models.ImageField(upload_to=\'static/static_dirs/images/\')\n    description = models.TextField()\n
\n\n

My file system is currently:

\n\n
src\n |---main_project\n |---app_that_contains_blog_content_model\n |---static\n       |---static_dirs\n                |---images\n
\n\n

When I run the server and go to the Admin page, I can add BlogContent objects. After choosing an image for the image field, the image has a temporary name. However, after I save this object I can\'t find the image in the folder specified by the upload_to path.

\n\n

What is the correct way to do this?

\n',,'02/01/2016 06:54',HQ 34563750,'undefined reference to SIGN in C using GCC','

Many questions have been asked here about functions from math.h not being found in C code during compilation and I am facing a similar problem. Having gone through all of them, none seems to apply to my problem. I have some C code in a file called test1.c -

\n\n
#include <math.h>\nint main(void) {\n  int j = SQR(4);\n  int i = (int)(sqrt(16.0));\n}\n
\n\n

Now, I compile this using -

\n\n
gcc -c -o ../../obj/test1.o test1.c -I../../include\n
\n\n

And it produces the .o file.

\n\n

Now, I try and create the executable using -

\n\n
gcc -o ../../bin/test1../../obj/test1.o -I../../include -lm\n
\n\n

But this gives me the error below (most previous questions were solved by the -lm switch but I have that) -

\n\n
../../obj/test1.o:test1.c:(.text+0x13): undefined reference to `SQR\'\n../../obj/test1.o:test1.c:(.text+0x13): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `SQR\'\n
\n\n

Strangely, sqrt works but a host of other functions like SQR, SIGN etc lead to problems (the case doesn\'t matter). Note that these commands were generated by a make file -

\n\n
IDIR =../../include\nCC=gcc\nCFLAGS=-I$(IDIR)\n\nODIR=../../obj\nLDIR =../../lib\n\nLIBS=-lm\n\n_DEPS = nrutil.h\nDEPS = $(patsubst \%,$(IDIR)/\%,$(_DEPS))\n\n_OBJ = test1.o\nOBJ = $(patsubst \%,$(ODIR)/\%,$(_OBJ))\n\n\n$(ODIR)/\%.o: \%.c $(DEPS)\n  $(CC) -c -o $@ $< $(CFLAGS)\n\n../../bin/svdcmp: $(OBJ)\n  gcc -o $@ $^ $(CFLAGS) $(LIBS)\n\n.PHONY: clean\n\nclean:\n   rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~\n
\n\n

I\'m using Cygwin with Windows.

\n',,'02/01/2016 07:39',LQ_CLOSE 34563884,'What does the double backslash mean in a function parameter in Elixir?','

I recently came across a code snippet such as:

\n\n
def loop(ring_pid \\\\ self, nil, true) do\n  #some code \nend\n
\n\n

What do the double backslashes mean? I googled around and found http://elixir-lang.org/getting-started/sigils.html, but that applies to regular expressions not function params.

\n',,'02/01/2016 08:01',HQ 34563947,'Sending a positive octet of zero bits over a socket','I am currently attempting to communicate with an external application over TCP/IP based socket. I have successfully established a connection with the client and received some data. This manual [here][1] states that \r\n\r\n> After this command is received, the client must read an acknowledgement \r\n> octet from the daemon. A positive acknowledgement is an octet of zero bits. A negative acknowledgement is an octet of any other pattern.\r\n\r\nI would like to send a positive acknowledgment and I am sending it this way\r\n\r\n void WriteData(std::string content)\r\n {\r\n send(newsockfd,content.c_str(),content.length(),0);\r\n }\r\n\r\n WriteData(\"00000000\");\r\n\r\nMy question is if I am sending this data corectly ?\r\n\r\n\r\n [1]: https://www.ietf.org/rfc/rfc1179.txt',,'02/01/2016 08:15',LQ_EDIT 34564148,'Compiling SASS in Windows 7','

I\'m planning to use SASS in making a website instead of CSS. I\'m trying to compile a SASS file to CSS. Should I use an application to do so? Or should I use just command prompt?

\n',,'02/01/2016 08:46',LQ_CLOSE 34564198,'any one can help me with this sql syntax error? what should i use near the select statement','Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click\r\n If Len(Trim(TextBox1.Text)) = 0 Then\r\n MsgBox(\"Please Enter Current Odometer For Specified Vehicle\", MsgBoxStyle.Critical, \"Error\")\r\n TextBox1.Focus()\r\n Else\r\n Dim time As DateTime = DateTimePicker1.Value.Date\r\n Dim format As String = \"yy-MM-dd\"\r\n Dim newdate = time.ToString(format)\r\n Dim SQLStatement As String = \"IF EXISTS (SELECT * FROM services_list WHERE vehicle_id=\'\" & Label7.Text & \"\' AND service=\'\" & ComboBox1.Text & \"\') BEGIN UPDATE services_list Set service_date=\'\" & newdate & \"\', note=\'\" & RichTextBox1.Text & \"\', odometer=\'\" & TextBox1.Text & \"\' WHERE vehicle_id=\'\" & Label7.Text & \"\' AND service=\'\" & ComboBox1.Text & \"\' End Else BEGIN INSERT INTO services_list(vehicle_id,service,service_date,note,odometer,milesorkm) VALUES(\'\" & Label7.Text & \"\', \'\" & ComboBox1.Text & \"\', \'\" & newdate & \"\', \'\" & RichTextBox1.Text & \"\', \'\" & TextBox1.Text & \"\', \'\" & Label8.Text & \"\') END\"\r\n Dim Query2 As String = \"Select * from customers_cars where vin_number=\'\" & ComboBox3.Text & \"\'\"\r\n Dim cmd As MySqlCommand = New MySqlCommand(Query2, MySqlConn)\r\n Reader = cmd.ExecuteReader\r\n Try\r\n While Reader.Read()\r\n Dim lastod = Reader.GetInt32(\"last_visit_odometer\").ToString\r\n Label9.Text = lastod\r\n If TextBox1.Text <= Label9.Text Then\r\n MsgBox(\"Incorrect Odometer\")\r\n Else\r\n Reader.Dispose()\r\n cmd.CommandText = SQLStatement\r\n cmd.CommandType = CommandType.Text\r\n cmd.Connection = MySqlConn\r\n cmd.ExecuteNonQuery()\r\n MsgBox(\"Successfully Added!\")\r\n End If\r\n Reader.Dispose()\r\n End While\r\n Catch ex As Exception\r\n MsgBox(ex.Message)\r\n End Try\r\n End If\r\n End Sub',,'02/01/2016 08:57',LQ_EDIT 34564253,'How to make Xcode automatically conform to a protocol','

When I use a prototype table view, I always have to conform to the protocol TableViewDataSource. I always forget what methods I need to implement, so I have to look at the source of the protocol every time. This is really time consuming.

\n\n

I think Xcode must have a feature that automatically implements the needed methods for you, right? Just like IntelliJ IDEA, Eclipse, and Visual Studio.

\n\n

I want to know where can I find this feature. If there\'s isn\'t, is there a workaround for this? At least I don\'t have to open the source code of the protocol each time I conform to it.

\n\n

If you don\'t understand what I mean, here\'s some code:

\n\n

I have a protocol

\n\n
protocol Hello {\n    func doStuff ()\n}\n
\n\n

When I conform to it,

\n\n
class MyClass: Hello {\n\n}\n
\n\n

I often don\'t remember the names of the methods that I need to implement. If Xcode has a feature that turns the above code, into this:

\n\n
class MyClass: Hello {\n    func doStuff () {\n        code\n    }\n}\n
\n\n

Now you understand what I mean? I just want to ask where to find such a feature.

\n',,'02/01/2016 09:05',HQ 34564297,'to get or set the values of controls of a form froma class file','I am new here,\r\ni need to ask that, how can i get the value of a textbox and store it outside the FORM.cs, and to get that value to show it on a label...\r\nit is just for test application.. i want to code that is independent from GUI.\r\nthanks for your help in advance.\r\nhere is what i was trying...\r\n\r\nIn Form.cs\r\n \r\n\r\nprivate void button4_Click(object sender, EventArgs e)\r\n {\r\n \r\n \r\n cueTextBox2.Text = value;\r\n Calling cal = new Calling();\r\n cal.setntags(value);\r\n }\r\n\r\nin Calling.cs\r\n\r\n\r\n public string setntags(string value)\r\n {\r\n \r\n value = tag1;\r\n MessageBox.Show(\"done\");\r\n return tag1;\r\n \r\n }\r\n\r\ni am new in coding.. please help me,.',,'02/01/2016 09:12',LQ_EDIT 34564356,'i am new to pythn and was trying to fix indentation error : this is my code class Cylinder(object):','class Cylinder(object):\r\n self.pi = 3.14\r\n def __init__(self,height=1,radius=1):\r\n self.height = height\r\n self.radius = radius\r\n \r\n def volume(self):\r\n return self.pi * self.radius**2 * self.height\r\n \r\n def surface_area(self):\r\n pass',,'02/01/2016 09:22',LQ_EDIT 34564466,'java mongodb driver how do you catch exceptions?','

I want to be able to detect if a mongo server is available from the java driver for the purpose of reacting to any abnormal events as one would in JDBC land etc. It all works fine when the server is up but I am struggling to understand why it is so difficult to detect errors. I have a feeling its because the mongo client runs in a different thread and it doesn\'t re throw to me or something?

\n\n
try {\n        MongoClient mongoClient = new MongoClient(\"localhost\", 27017);\n        MongoDatabase db = mongoClient.getDatabase(\"mydb\");\n        // if db is down or error getting people collection handle it in catch block\n        MongoCollection<Document> people = commentarr.getCollection(\"people\");\n    } catch (Exception e) {\n        // handle server down or failed query here.\n    }\n
\n\n

The result is

\n\n
INFO: Exception in monitor thread while connecting to server localhost:27017\n
\n\n

With the resulting stack trace containing a few different exceptions which I have tried to catch but my catch blocks still didn\'t do anything.

\n\n
com.mongodb.MongoSocketOpenException: Exception opening socket\nCaused by: java.net.ConnectException: Connection refused\n
\n\n

I am using the java mongodb driver 3.0.4, most posts I read are from an older API with hacks like MongoClient.getDatabaseNames() which throws a MongoException if errors, except this is deprecated now and replaced with MongoClient.listDatabaseNames() which doesn\'t have the same error throwing semantics.

\n\n

Is there a way to just execute a mongo query from the java driver in a try catch block and actually have the exception caught?

\n',,'02/01/2016 09:36',HQ 34564543,'Android Studio Import Failing','Ok guys i am trying to implement spinner in in Android Studio\r\n\r\nThese are my imports\r\n\r\n import android.widget.ArrayAdapter;\r\n import android.widget.EditText;\r\n import android.widget.Spinner;\r\n import android.widget.AdapterView;\r\n import android.widget.Toast;\r\n import android.widget.AdapterView.OnItemSelectedListener;\r\n\r\nThis is my java. Here I get the the setOnItemSelectedListner in red and says cannot be resolved. I am importing it above despite that it is showing. What could be the issue.\r\n\r\n Spinner spinner = (Spinner) findViewById(R.id.spinner);\r\n spinner.setOnItemSelectedListner(this);\r\n\r\nThe whole code is like this....\r\n\r\n\r\n import android.location.Address;\r\n import android.location.Geocoder;\r\n import android.location.Location;\r\n import android.support.v4.app.FragmentActivity;\r\n import android.os.Bundle;\r\n import android.view.View;\r\n import android.widget.ArrayAdapter;\r\n import android.widget.EditText;\r\n import android.widget.Spinner;\r\n import android.widget.AdapterView;\r\n import android.widget.Toast;\r\n import android.widget.AdapterView.OnItemSelectedListener;\r\n import android.widget.AdapterView.OnItemSelectedListener;\r\n import com.google.android.gms.maps.CameraUpdateFactory;\r\n import com.google.android.gms.maps.GoogleMap;\r\n import com.google.android.gms.maps.OnMapReadyCallback;\r\n import com.google.android.gms.maps.SupportMapFragment;\r\n import com.google.android.gms.maps.model.LatLng;\r\n import com.google.android.gms.maps.model.MarkerOptions;\r\n \r\n import java.io.IOException;\r\n import java.util.ArrayList;\r\n import java.util.List;\r\n \r\n public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {\r\n \r\n private GoogleMap mMap;\r\n \r\n @Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_maps);\r\n \r\n SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()\r\n .findFragmentById(R.id.map);\r\n mapFragment.getMapAsync(this);\r\n \r\n }\r\n \r\n \r\n Spinner spinner = (Spinner) findViewById(R.id.spinner);\r\n \r\n spinner.setOnItemSelectedListner(this);\r\n \r\n \r\n List categories = new ArrayList();\r\n categories.add(\"Automobile\");\r\n categories.add(\"Business Services\");\r\n categories.add(\"Computers\");\r\n categories.add(\"Education\");\r\n categories.add(\"Personal\");\r\n categories.add(\"Travel\");\r\n \r\n \r\n ArrayAdapter dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, categories);\r\n \r\n \r\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\r\n \r\n \r\n spinner.setAdapter(dataAdapter);\r\n }\r\n \r\n @Override\r\n public void onItemSelected(AdapterView parent, View view, int position, long id) {\r\n \r\n String item = parent.getItemAtPosition(position).toString();\r\n \r\n \r\n Toast.makeText(parent.getContext(), \"Selected: \" + item, Toast.LENGTH_LONG).show();\r\n }\r\n public void onNothingSelected(AdapterView arg0) {\r\n \r\n }\r\n\r\n',,'02/01/2016 09:46',LQ_EDIT 34565049,'I cant UPDATE datetime to MySQL','

I need a little help.\nI\'m try to UPDATE a datetime to MySQL, but it didn\'t work.

\n\n

The declaration is like this:

\n\n
    $startDate = time();\n    $time = date(\"Y-m-d H:i:s\", strtotime(\'+7 days\', $startDate));\n
\n\n

After this i want to UPDATE, but in MySQL is still blank always.

\n\n

UPDATE:

\n\n
mtquery(\"UPDATE table SET end_time = \".$time.\" WHERE id = \".$table[\'id\'].\"\");\n
\n\n

If i use NOW() instead of \".$time.\", it works perfectly.

\n\n

If someone can help, please write the solution.

\n\n

Thanks,

\n\n

KoLi

\n',,'02/01/2016 10:50',LQ_CLOSE 34565520,'Is it possible to track user activity in his iDevice','As the title Describe to Track,\r\n Is it possible to track every activity of a user in his iphone and display it \r\n \r\nFor example - A user \"X\" unlock his iphone(slide to unlock)
then he make a call after that played a game
then open a camera and taken a picture
then enter some reminder
and finally he close / lock his iphone\r\n\r\nThe challenge is to display all details when user unlock his phone, lock his phone and other activity he has done in his iphone
\r\n\r\n\r\n [Example - user open a UITableView application where the tableview data is populated with those activity like the image below
\r\n.......... \r\nany link or any tutorial for reference\r\nThanks you in advance friends\r\n\r\n[![UITableView][1]][1]\r\n \r\n\r\n\r\n [1]: http://i.stack.imgur.com/zSENr.png',,'02/01/2016 11:46',LQ_EDIT 34565872,'How to delete compiled JS files from previous typescript(.ts) files?','

I am following Angular 2 quick start tutorial. Following is my folder structure -

\n\n
├── gulpfile.js\n├── index.html\n├── js\n|   ├── app.component.js\n|   └── boot.js\n├── source\n|   ├── app.component.ts\n|   └── boot.ts\n├── node_modules\n    ├── module 1\n    └── module 2\n
\n\n

My typescript files are in source/ directory. I\'m compiling it to js/ directory. I\'m using gulp-typescript.

\n\n

The problem is when I, for example, rename the file boot.ts to bootstrap.ts and compile again, corresponding bootstrap.js file is created but the old boot.js file still remains in the js/ directory.

\n\n

Now the folder structure looks like following-

\n\n
├── gulpfile.js\n├── index.html\n├── js\n|   ├── app.component.js\n|   └── bootstrap.js\n|   └── boot.js\n├── source\n|   ├── app.component.ts\n|   └── bootstrap.ts\n├── node_modules\n    ├── module 1\n    └── module 2\n
\n\n

I want to delete this boot.js autonomically via gulp task. How to achieve this?

\n',,'02/01/2016 12:27',HQ 34566061,'AndroidStudio show usage of RAM','

I have seen on other AndroidStudio-pictures, that there is a RAM usage at the right bottom. I tried to setup this statuslist o the bottom. But a rightclick didn`t help me. How can I switch on the RAM usage in AndroidStudio ?

\n',,'02/01/2016 12:49',HQ 34566063,'Why is the const&& overload of as_const deleted?','

On a blog on the progress of C++17 I read the following:

\n\n
\n

P0007 proposes a helper function template as_const, which simply\n takes a reference and returns it as a reference to const.

\n\n
template <typename T> std::add_const_t<T>& as_const(T& t) { return t }\ntemplate <typename T> void as_const(T const&&) = delete;\n
\n
\n\n

Why is the const&& overload deleted?

\n',,'02/01/2016 12:49',HQ 34566111,'How to backspace or delete?','

In Windows 10, when I launch MS PowerShell to ssh through a container in Kitematic at windows, I\'ve noticed that I can\'t backspace or delete, instead I get ^H for backspace instead of actually delete previous character.

\n\n

Do I miss something?

\n',,'02/01/2016 12:55',HQ 34566113,'Has set been deprecated in python 2?','

Has set been deprecated in python?

\n\n

I am learning python online here and trying to implement the following command -

\n\n
x = set([\"Perl\", \"Python\", \"Java\"])\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: \'list\' object is not callable\n
\n\n

So has it been deprecated in python 2.7?

\n',,'02/01/2016 12:55',LQ_CLOSE 34566176,'visualvm fails with \"No jdkhome found\" on Ubuntu 15.10 with Oracle JDK','

I installed Oracle JDK from the webupd8team/java PPA, and then installed the visualvm package. When starting visualvm, I get the following error message:

\n\n
[beni:~]$ visualvm\nNo jdkhome found\n
\n\n

My $JAVA_HOME is set correctly to /usr/lib/jvm/java-7-oracle.

\n\n

Also, when starting visualvm with the jdkhome property set, I get the same error:

\n\n
[beni:~]$ visualvm --jdkhome $JAVA_HOME\nNo jdkhome found\n
\n',,'02/01/2016 13:00',HQ 34566278,'How to correctly share JAX-RS 2.0 client','

To give a little context to my issue...

\n\n

I have a Java EE web application (as a UI / client) that accesses services for data / business logic via a REST interface using the JAX-RS 2.0 client API (Resteasy implementation).

\n\n

Currently I inject a new JAXRS Client instance per request using a RequestScoped CDI managed bean, the thinking being that the client app may call multiple backend resources per request and I reuse the same JAXRS Client for the whole request (although I read somewhere this may not be correct as I am potentially changing the URI for each invocation)

\n\n

The documentation for JAXRS Client seems to suggest that the client is a potentially expensive operation and the app should limit the amount of connections it creates. It also seems to contradict itself and suggest the client should be closed once all the requests to a particular WebTarget are finished.

\n\n

The client application could potentially support thousands of simultaneous users so creating and destroying thousands of \'expensive clients\' does not seem to be the correct approach so am thinking a shared client pool is more appropriate but there doesn\'t seem to be any information on how this should be achieved.

\n\n

All examples appear to show creating a new client for the request and a) closing it after or b) not closing it but not really explaining what happens on a second request.

\n\n

Can you help provide some answers on how you think this would be solved or information on what the best practice for this approach is.

\n\n

Thanks.

\n',,'02/01/2016 13:11',HQ 34566364,'japanese and portuguese language cannot support','My site Japanese supported. But Portuguese language cannot fully display \r\n\r\nDisplay on In�Cio Sobre N�S.\r\n\r\nI have use for header(\'Content-type: text/html; charset=UTF-8\') ;\r\n\r\nthis only Japanese language support.\r\n\r\nI need to both language (Japanese and Portuguese) should be display.\r\n\r\nI need to helper for best solution.\r\n\r\nThanks, \r\n',,'02/01/2016 13:20',LQ_EDIT 34566633,'Display simple text on vertices','

So I am trying to make a simple program (I\'m a student) and it works fine so far, but I can\'t figure out how to display the \"i\" value from the loop in the drawCircle() function in Shapes.cpp

\n\n

code:

\n\n

http://pastebin.com/4kDPNjy8

\n\n

example:\n\"enter

\n\n

When I compile my code right now it looks like on the image to the left, but I want to get something like on the right but I have no idea how to do that kind of stuff or what function should I use for that.

\n\n

Please help

\n',,'02/01/2016 13:54',LQ_CLOSE 34566697,'Set ImageView from Real path','I have the real path of an image which I am retrieving from my Database. I want to set the imageView using the real path (/storage/emulated/0/DCIM/100MEDIA/image.jpg)\r\n\r\nHow can this be done.\r\n\r\n public void getIMG(){\r\n Cursor res = myDb.GetRow(id);\r\n if(res.moveToFirst()){\r\n String path = res.getString(DatabaseHelper.ROWIMG);\r\n /*img.set\'???\'*/\r\n \r\n\r\n }\r\n }\r\n\r\n',,'02/01/2016 14:00',LQ_EDIT 34566724,'Precision issues with dlmwrite / dlmread','

I recently discovered, quite harshly, that Matlab\'s dlmread and dlmwrite don\'t store numerical values at double accuracy. It effects my code, and I need to store big arrays with more precision.

\n\n

A (not) working example :

\n\n
pi1 = pi;\ndlmwrite(\'pi\',pi1);\npi2 = dlmread(\'pi\');\npi1-pi2\n\nans =\n\n-7.3464e-06\n
\n\n

While I\'d expect machine-error answer, of 10^-14 accuracy.

\n\n

I\'d much rather keep using a simple function as dlmwrite, but I will consider other solutions.

\n\n

Thanks

\n',,'02/01/2016 14:03',LQ_CLOSE 34566806,'Why use contextlib.suppress as opposed to try/except with pass?','

Why would one use contextlib.suppress to suppress an exception, instead of try/except with a pass?

\n\n

There is no difference in the amount of characters between these two methods (if anything, suppress has more characters), and even though code is often counted in LOC instead of characters, suppress also seems to be much slower than try/except in both cases, when an error is raised and when it\'s not:

\n\n
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32\nType \"copyright\", \"credits\" or \"license()\" for more information.\n>>> from timeit import timeit\n>>> # With an error\n>>> timeit(\"\"\"with suppress(ValueError):\n    x = int(\'a\')\"\"\", setup=\"from contextlib import suppress\")\n1.9571568971892543\n>>> timeit(\"\"\"try:\n    x = int(\'a\')\nexcept ValueError:\n    pass\"\"\")\n1.0758466499161656\n>>> # With no error\n>>> timeit(\"\"\"with suppress(ValueError):\n    x = int(3)\"\"\", setup=\"from contextlib import suppress\")\n0.7513525708063895\n>>> timeit(\"\"\"try:\n    x = int(3)\nexcept ValueError:\n    pass\"\"\")\n0.10141028937128027\n>>> \n
\n',,'02/01/2016 14:13',HQ 34566901,'In Android Studio 2.0, Cannot find local variable of method in debug mode','

After Updating the android version 1.5 to 2.0 Preview4. Android studio Debugger unable to find the local variable defined in method definition. For reference, find the below screenshot.

\n\n

\"enter

\n',,'02/01/2016 14:23',HQ 34566903,'reading data from serial port c#','I\'m trying to read char from port. writing to the port works perfectly, reading - not so much.\r\nhere is my code:\r\n\r\n private void Com_Port_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)\r\n {\r\n char val;\r\n try\r\n {\r\n val = Convert.ToChar(Com_Port.ReadByte()); // get the new byte from port\r\n \r\n label6.Text = Convert.ToString(val);\r\n\r\n }\r\n catch (Exception) { }\r\n }\r\ncracking my head over it for the past 4 hours.',,'02/01/2016 14:23',LQ_EDIT 34566996,'argument of type\'NoneType\' is not itrable','I want to build a list of words. For each word on each line check to see if the word is already in the list and if not append it to the list. When the program completes, sort and print the resulting words in alphabetical order.\r\nBut when I add sting to list ,it shows \"argument of type\'NoneType\' is not itrable\".What\' worry?\r\n\r\n \r\n\t\tfh = (\"But soft what light through yonder window breaks\"\r\n\t\t\"It is the east and Juliet is the sun\"\r\n\t\t\"Arise fair sun and kill the envious moon\"\r\n\t\t\"Who is already sick and pale with grief\")\r\n\t\tlst = list()\r\n\t\tfor line in fh:\r\n\t\t\twords = line.split()\r\n\t\t\tfor word in line:\r\n\t\t\t\t\tif word not in lst:\r\n\t\t\t\t\t\tlst = lst.append(word)\r\n\t\tlst.sort()\r\n\t\tprint lst',,'02/01/2016 14:32',LQ_EDIT 34566999,'Cannot resolve symbol \'RequestQueue\'','

I am new to android studio and volley library so please bear with me.

\n\n

I\'ve added volley library by GitHub and then and added this line to build gradle file: compile \'com.android.support:appcompat-v7:23.0.1\'

\n\n

And now I am trying some tutorials about request and response from api, but for some reason I cannot make an instance of RequestQueue why? \nI am using Android 4.0.3 IceCreamSandwish

\n\n

Thank you

\n',,'02/01/2016 14:32',HQ 34567027,'Shell script to mail script output in table format','

I am new to shell script. I need your help on below scenario.

\n\n

Script: wc file1 file2 file3 file4

\n\n
results :\n1488 2977 2248 file1\n123  345 657 file2\n123 896 456 file3\n567 987 124 file4\n
\n\n

Now I need to mail this result in below format with header name

\n\n

Here,2nd column is always default value.

\n\n
Filename  Destname rowcount  bytesize\nfile1     default  1488    2248\nfile2     default  123     657\nfile3     default  123     456\nfile4     default  567     124\n
\n\n

Please some one help me to write this script.

\n',,'02/01/2016 14:34',LQ_CLOSE 34567406,'I am getting a StringIndexOutOfBoundsException when I attempt to use array parts from the children classes',' //Ticket parent class\r\n import java.util.ArrayList;\r\n import java.util.Scanner;\r\n import java.io.*;\r\n public class Ticket\r\n {\r\n public Ticket()\r\n {\r\n seatArray = new ArrayList();\r\n \r\n }\r\n public void loadIn()\r\n {\r\n \t //generic seating for plays and concerts\r\n \t seatArray.add(new TicketObject(\"A1\", 40));\r\n seatArray.add(new TicketObject(\"A2\", 40));\r\n seatArray.add(new TicketObject(\"A3\", 40));\r\n seatArray.add(new TicketObject(\"A4\", 40));\r\n seatArray.add(new TicketObject(\"A5\", 40));\r\n seatArray.add(new TicketObject(\"B1\", 35));\r\n seatArray.add(new TicketObject(\"B2\", 35));\r\n seatArray.add(new TicketObject(\"B3\", 35));\r\n seatArray.add(new TicketObject(\"B4\", 35));\r\n seatArray.add(new TicketObject(\"B5\", 35));\r\n }\r\n public String getSeats(int x)\r\n {\r\n \t return seatArray.get(x).getName() + \" $\" + seatArray.get(x).getPrice();\r\n }\r\n protected ArrayList seatArray;\r\n }\r\n //Concert ticket child class\r\n import java.util.ArrayList;\r\n import java.util.Scanner;\r\n import java.io.*;\r\n public class ConcertTicket extends Ticket\r\n {\r\n public ConcertTicket()\r\n {\r\n super();\r\n }\r\n public void loadIn()\r\n {\r\n super.loadIn();\r\n //Special option for concerts\r\n seatArray.add(new TicketObject(\"Backstage Pass\", 100));\r\n seatArray.add(new TicketObject(\"Backstage Pass\", 100)); \r\n seatArray.add(new TicketObject(\"Backstage Pass\", 100)); \r\n seatArray.add(new TicketObject(\"Backstage Pass\", 100)); \r\n seatArray.add(new TicketObject(\"Backstage Pass\", 100)); \r\n }\r\n \r\n }\r\n //Play ticket child class\r\n import java.util.ArrayList;\r\n import java.util.Scanner;\r\n import java.io.*;\r\n public class PlayTicket extends Ticket\r\n {\r\n public PlayTicket()\r\n {\r\n super();\r\n } \r\n public void loadIn()\r\n {\r\n \t super.loadIn();\r\n \t \t //Specialized seating for plays\r\n \t seatArray.add(new TicketObject(\"Box 1\", 150));\r\n \t seatArray.add(new TicketObject(\"Box 2\", 150));\r\n \t seatArray.add(new TicketObject(\"Box 3\", 150));\r\n \t seatArray.add(new TicketObject(\"Box 4\", 150));\r\n \t seatArray.add(new TicketObject(\"Box 5\", 150)); \r\n }\r\n }\r\n //Ticket object for each seat; also used to populate array\r\n public class TicketObject\r\n {\r\n public TicketObject(String inSeatName, int inSeatPrice)\r\n {\r\n seatName = inSeatName;\r\n seatPrice = inSeatPrice;\r\n }\r\n public String getName()\r\n {\r\n \t return seatName;\r\n }\r\n public int getPrice()\r\n {\r\n \t return seatPrice;\r\n }\r\n private String seatName;\r\n private int seatPrice;\r\n }\r\n //Price calculation class\r\n public class Calculations \r\n {\r\n \tpublic static double addTax(int total)\r\n \t{\r\n \t\treturn total * 1.07;\r\n \t}\r\n }\r\n //Tester class\r\n import java.util.Scanner;\r\n public class TicketTester\r\n {\r\n public static void main(String[] args)\r\n {\r\n \t Scanner in = new Scanner(System.in);\r\n \ttry {\r\n //Introduction for user\r\n System.out.println(\"Welcome to the ticket purchasing program!\");\r\n System.out.println(\"You will be able to purchase either a concert or play ticket\");\r\n System.out.println(\"\\n\");\r\n System.out.println(\"Type concert or play to display available seats and deals\");\r\n running = true;\r\n \r\n \r\n \t //Displaying tickets of either a concert or play\r\n \t String answer = in.next();\r\n \t if (answer.equalsIgnoreCase(\"Concert\"))\r\n \t {\r\n \t\t \tConcertTicket journeyConcert = new ConcertTicket();\r\n \t\t \tjourneyConcert.loadIn();\r\n \t\t \tSystem.out.println(\"Seat Price\");\r\n \t\t \tfor(int i=0;i<15;i++)\r\n \t\t \t\t{\r\n \t\t \t\tSystem.out.println(journeyConcert.getSeats(i));\r\n \t\t \t\t}\r\n \t\t \tSystem.out.println(\"\\n\");\r\n \t\t \tSystem.out.println(\"Type in a seat name/option and press enter to reserve it.\");\r\n \t\t \tSystem.out.println(\"Type purchase and press enter to finalize your ticket purchase\"); \r\n \t }\r\n \t else if(answer.equalsIgnoreCase(\"Play\"))\r\n \t {\r\n \t\t \tPlayTicket catsPlay = new PlayTicket();\r\n \t\t \tcatsPlay.loadIn();\r\n \t\t \tSystem.out.println(\"Seat Price\");\r\n \t\t \tfor(int i=0;i<15;i++)\r\n \t \t\t\t{\r\n \t\t \t\tSystem.out.println(catsPlay.getSeats(i));\r\n \t \t\t\t}\r\n \t\t \tSystem.out.println(\"\\n\");\r\n \t\t \tSystem.out.println(\"Type in a seat name/option and press enter to reserve it.\");\r\n \t\t \tSystem.out.println(\"Type purchase and press enter to finalize your ticket purchase\");\r\n \t }\r\n \t else\r\n \t\t System.out.println(\"Enter a valid input\");\r\n \r\n \t //Adding up chosen seat numbers and costs\r\n \t while(running)\r\n \t { \r\n \t String seatChoice = in.next();\r\n \t if ((seatChoice.substring(0,1)).equalsIgnoreCase(\"A\") && seatChoice.length() == 2)\r\n \t \t{\r\n \t\t total = total + 40;\r\n \t\t seats = seats + 1;\r\n \t \t}\r\n \t else if ((seatChoice.substring(0,1)).equalsIgnoreCase(\"B\")&& seatChoice.length() == 2)\r\n \t\t\t{\r\n \t\t total = total + 35;\r\n \t\t seats = seats + 1;\r\n \t\t\t}\r\n \t else if ((seatChoice.substring(0,3)).equalsIgnoreCase(\"Box\")&& seatChoice.length() == 5)\r\n \t\t\t{\r\n \t\t total = total + 150;\r\n \t\t seats = seats + 1;\r\n \t\t\t}\r\n \t else if ((seatChoice.substring(0,14)).equalsIgnoreCase(\"Backstage Pass\") && seatChoice.length() == 14)\r\n \t\t\t{\r\n \t\t total = total + 100;\r\n \t\t seats = seats + 1;\r\n \t\t\t}\r\n \t else if (seatChoice.equalsIgnoreCase(\"Purchase\"))\r\n \t {\r\n \t \t\tSystem.out.println(\"You reserved \" + seats + \" seats at a price of $\" + Calculations.addTax(total));\r\n \t \t\trunning = false;\r\n \t }\r\n \t else\r\n \t\t System.out.println(\"Enter a valid input\");\r\n \t }\r\n \t }\r\n \tfinally {\r\n \t\tif(in!=null)\r\n \t\t\tin.close();\r\n \t\t\t}\r\n \t}\r\n private static Boolean running;\r\n private static int total = 0;\r\n private static int seats = 0;\r\n }\r\n \r\nWhen I run the TicketTester class, everything runs correctly until I attempt to add either a backstage pass or a box office seat. I am given this error:\r\n \"Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 14 \tat java.lang.String.substring(Unknown Source)\tat TicketTester.main(TicketTester.java:67)\" \r\n\r\nFrom this I can see that the error is occurring at the following line, but I don\'t know how to resolve it.\r\n \t else if ((seatChoice.substring(0,13)).equalsIgnoreCase(\"Backstage Pass\") && seatChoice.length() == 14)\r\n\t\t\t',,'02/01/2016 15:14',LQ_EDIT 34567743,'Duplicate file is getting created in linux','

I created a file called file2.txt in Linux, opened it in text editor and saved it. When I closed the text editor I see two files file2.txt and file2.txt~

\n\n

I guess file2.txt~ is temporary file created when I am editing the file2.txt but it should get removed when I finished saving and closed text editor.

\n',,'02/01/2016 15:54',LQ_CLOSE 34567920,'In python-telegram-bot how to get all participants of the group?','

In Python-telegram-bot how to get, if possible, the complete list of all participants of the group at which the bot was added?

\n',,'02/01/2016 16:16',HQ 34568008,'How do I run webpack from SBT','

I\'m developing a Play 2.4 application and would like SBT to run webpack to generate static assets during compilation.

\n\n

I tried https://github.com/stejskal/sbt-webpack but it does\'t seem to work for me.

\n',,'02/01/2016 16:26',HQ 34568011,'Add an element on the last Jekyll loop of posts','

I\'m sure this is simple but cant find the answer.

\n\n

There is a standard Jekyll/Liquid post iterator. How do i use the {\% if \%} statement below to put the <hr> element for each post except the last?

\n\n
<ul class=\"post-list\">\n    {\% for post in site.posts \%}\n      {\% if post.url \%}\n      <br>\n        <li>\n          <h2>\n            <a class=\"post-link\" href=\"{{ post.url | prepend: site.baseurl }}\">{{ post.title }}</a>\n          </h2>\n          <span class=\"post-meta\">{{ post.date | date: \"\%b \%-d, \%Y\" }}</span>\n        </li>\n\n        **** {\% if post != $last \%} ***** How do i do this??\n          <hr>\n        {\% endif \%}\n      {\% endif \%}\n    {\% endfor \%}\n  </ul>\n
\n',,'02/01/2016 16:26',HQ 34568045,'if..else..if..else code not working properly(coding in C)','

I have a question.I think I may have a mistake in my code because my code program(Dev C++) seems not to recognize the \"else if\" statement.

\n\n

Here is the code:

\n\n
#include <stdio.h>\nint main()\n{\nint a = 80;\nif(a == 10);\nprintf(\"value of a is 10\\n\");\nelse if(a == 20);\nprintf(\"value of a is 20\\n\");\nelse if(a == 30);\nprintf(\"value of a is 30\\n\");\nelse\nprintf(\"none of the values match\");\nprintf(\"the real value of a is: &d\", a);\n\nsystem(\"PAUSE\");\nreturn 0;\n}\n
\n',,'02/01/2016 16:28',LQ_CLOSE 34568493,'why datepicker is lost after window.print','I have to print part of my page by `window.print()`.\r\nHere is the code:\r\n\r\n function printDiv(divName) {\r\n var printContents = document.getElementById(divName).innerHTML;\r\n var originalContents = document.body.innerHTML;\r\n document.body.innerHTML = printContents;\r\n window.print();\r\n document.body.innerHTML = originalContents;\r\n }\r\n\r\nI know that copy innerHTML and pasting it after print command can cause lost of event listener. But it can be overcome by a `$(\'body\').on` attachment. But as I am novice to jquery, I do not know how can I use this jquery on method in case of datepicker attachment. So, everytime I print part of my webpage using this type of javascript print method, datepicker is lost and it is not attaching in the desired input fields.\r\n\r\nPlease visit my site to check the situation:\r\n[http://infomamun.xyz][1]\r\n\r\nand click on the `#dob` or other input fields to see the workable datepicker. Then please press `Print` button and cancel or done the print job. After that you can see that there is no datepicker attached on click of `#dob` and other input fields of the table.\r\n\r\nHow to resolve this issue?\r\n\r\n[NB: please don\'t recommend css print system, I have to use this method. Also, please don\'t downvote my Question. I am very novice to jquery]\r\n\r\n\r\n [1]: http://infomamun.xyz',,'02/01/2016 17:15',LQ_EDIT 34568849,'GIT Split Repository directory preserving *move / renames* history','

Let\'s say you have the repository:

\n\n
myCode/megaProject/moduleA\nmyCode/megaProject/moduleB\n
\n\n

Over time (months), you re-organise the project. Refactoring the code to make the modules independent. Files in the megaProject directory get moved into their own directories. Emphasis on move - the history of these files is preserved.

\n\n
myCode/megaProject\nmyCode/moduleA\nmyCode/moduleB\n
\n\n

Now you wish to move these modules to their own GIT repos. Leaving the original with just megaProject on its own.

\n\n
myCode/megaProject\nnewRepoA/moduleA\nnewRepoB/moduleB\n
\n\n

The filter-branch command is documentated to do this but it doesn\'t follow history when files were moved outside of the target directory. So the history begins when the files were moved into their new directory, not the history the files had then they lived in the old megaProject directory.

\n\n

How to split a GIT history based on a target directory, and, follow history outside of this path - leaving only commit history related to these files and nothing else?

\n\n

The numerous other answers on SO focus on generally splitting apart the repo - but make no mention of splitting apart and following the move history.

\n',,'02/01/2016 17:49',HQ 34569489,'Getting proportions from data sets in R','

I have a data set called \'md\' which consists of 40 numbers 1-6, I need to get the proportion that the number 1 appears in the list, I\'ve been looking for ways to get proportions but none of which seem to be relevant to my data set, the proportion is easily calculable, however, it is required to be done in R.

\n',,'02/01/2016 18:52',LQ_CLOSE 34569802,'Using Java, How do I check using orignal image that if shape01(circle) exists in image02(square) after converting both into binary images?','I am newbie to openCV and JAVA. It is been two days I am searching for the solutions continuously.\r\nI want to check form this\r\n[Image][1] that red circle exists inside the square after convert getting following binary images.\r\nSee Binary Images of [circle and square][1]\r\n\r\nPlease help me ASAP. Thanks in advance.\r\n\r\n\r\n [1]: http://i.stack.imgur.com/WrZXq.png',,'02/01/2016 19:27',LQ_EDIT 34570193,'React Native Post Request via Fetch throws Network Request Failed','

I´ve came across the following error. \nAt the moment I developing an Android App with React Native therefore I´m planning to use fetch for doing a post request for me.

\n\n
fetch(\"https://XXreachable-domainXX.de/api/test\", {\n            method: \"post\",\n\n            body: JSON.stringify({\n                param: \'param\',\n                param1: \'param\',\n\n            })\n        }\n    )\n        .then((response) = > response.json()\n    )\n    .\n    then((responseData) = > {\n        ToastAndroid.show(\n        \"Response Body -> \" + JSON.stringify(responseData.message), ToastAndroid.SHORT\n    )\n})\n    .\n    catch((error) = > {\n        console.warn(error);\n})\n    ;\n
\n\n

The app now throws an error:

\n\n
\n

TypeError: Network request failed

\n
\n\n

When I change the code to a GET-Request it´s working fine, in the browser with a window.alert() as a return it´s cool and also the chrome extension Postman returns data correctly.

\n',,'02/01/2016 20:07',HQ 34570584,'Can\'t find Python executable \"/path/to/executable/python2.7\", you can set the PYTHON env variable','
\n

bufferutil@1.2.1 install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can\'t find Python executable \"/path/to/executable/python2.7\", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Linux 3.13.0-74-generic gyp ERR! command \"/usr/bin/nodejs\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\" gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: node-gyp rebuild npm WARN install:bufferutil@1.2.1 Exit status 1 > utf-8-validate@1.2.1 install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can\'t find Python executable \"/path/to/executable/python2.7\", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Linux 3.13.0-74-generic gyp ERR! command \"/usr/bin/nodejs\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\" gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: node-gyp rebuild npm WARN install:utf-8-validate@1.2.1 Exit status 1

\n
\n',,'02/01/2016 20:49',HQ 34570817,'Empty atom in Ecto changeset','

Why in an Ecto changeset method do you set the params to the default :empty atom? e.g.

\n\n
def changeset(user, params \\\\ :empty) do\n   ...\n
\n\n

Does this allow you to call the changeset method with nil for params?

\n',,'02/01/2016 21:15',HQ 34570992,'Getting parent of AST node in Python','

I\'m working with Abstract Syntax Trees in Python 3. The ast library gives many ways to get children of the node (you can use iter_child_nodes() or walk()) but no ways to get parent of one. Also, every node has links to its children, but it hasn\'t links to its parent.

\n\n

How I can get the parent of AST node if I don\'t want to write some plugin to ast library?

\n\n

What is the most correct way to do this?

\n',,'02/01/2016 21:38',HQ 34571454,'What is the mathematical definition of (f(n)) and O(f(n))',' (f(n)) and O(f(n))\r\nCan someone please give the mathematical definition of (f(n)) and O(f(n))?\r\n \r\n',,'02/01/2016 22:40',LQ_EDIT 34571593,'What is .tpl.html files? (angularjs)','

I\'m doing a angularjs blog tutorial, in the code example I see this new file type \"tpl.html\":

\n\n
$routeProvider\n.when(\'/\', {\ntemplateUrl: \'views/post-list.tpl.html\',\ncontroller: \'PostListController\',\ncontrollerAs: \'postlist\'\n})\n.when(\'/post/:postId\', {\ntemplateUrl: \'views/post-detail.tpl.html\',\ncontroller: \'PostDetailController\',\ncontrollerAs: \'postdetail\'\n})\n.when(\'/new\', {\ntemplateUrl: \'views/post-create.tpl.html\',\ncontroller: \'PostCreateController\',\ncontrollerAs: \'postcreate\'\n});\n
\n\n

What is this file type? Is different to html files?

\n',,'02/01/2016 22:58',HQ 34572040,'Restore a mongo DB from a compose.io backup?','

If you download a compose.io backup of a mongodb instance and uncompress the .tar file you end up with .ns and extensions that are single digits. How do you restore the db from these?

\n',,'03/01/2016 00:07',HQ 34572212,'Is there a naming convention for C language implementation only (private) constants?','

Let\'s say that I am writing a library named my, which has a module myString.

\n\n

Publicly exposed functions and constants for myString are declared in myString.h with the following convention:

\n\n
typedef struct myString myString;\nextern const size_t MY_STRING_MAX_LEN;\nmyString *my_string_new();\n
\n\n

Private implementation only functions and struct members are declared in myString.c with the following convention:

\n\n
_grow_buffer(myString *this);\nchar *_buffer;\n
\n\n

My question: Is there a similar convention for private, implementation only constants?

\n\n

For example, _CHUNK_SIZE is what I initially wanted to go with. Then I read that the C language specification says not to use an underscore followed by an uppercase letter at the start of a name, as such names may be used in future versions of the language.

\n\n

I like using the starting underscore convention, as it removes a lot of verbosity. I could use MY_STRING_CHUNK_SIZE or some variation, but that\'s not as pretty IMO.

\n',,'03/01/2016 00:34',LQ_CLOSE 34572496,'Turn Android into USB host','

My exploration here comes from a recent Arduino project.

\n\n

I have an old(ish) Android LG Tribute. I removed the broken screen so now the device is missing visual output. I have rooted it and can control it from shell commands and other ways.

\n\n

I want to write an application for the device to communicate over usb.

\n\n

Basically what I want to accomplish:

\n\n

Plug in USB cord to android. Press button on cord plugged into android device -> Snap picture with devices camera - Output data in visual blinks via LED programmed blink logic for debug.

\n\n

I feel I should be able to handle nearly everything on the device. I just need to know where to begin looking for Android USB output and input programming.

\n\n

Basically want to use my android as a microcontroller...

\n',,'03/01/2016 01:30',LQ_CLOSE 34572553,'Django: AttributeError: \'NoneType\' object has no attribute \'split\'','

I\'m trying to build a static site generator using Django (because its resourceful that way), and right now my problems are dealing with the Django command that is supposed to build my static site content into a directory. Apparently my \'NoneType\' object has no attribute \'split\', but I dont know what that \'NoneType\' object is.

\n\n
(thisSite) C:\\Users\\Jaysp_000\\thisSite\\PROJECTx>python prototype.py build\nTraceback (most recent call last):\n  File \"prototype.py\", line 31, in <module>\n    execute_from_command_line(sys.argv)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\core\\management\\__init__.py\",\n line 338, in execute_from_command_line\n    utility.execute()\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\core\\management\\__init__.py\",\n line 330, in execute\n    self.fetch_command(subcommand).run_from_argv(self.argv)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\core\\management\\base.py\", lin\ne 390, in run_from_argv\n    self.execute(*args, **cmd_options)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\core\\management\\base.py\", lin\ne 441, in execute\n    output = self.handle(*args, **options)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\PROJECTx\\sitebuilder\\management\\commands\\build.py\", li\nne 38, in handle\n    response = this_client_will.get(the_page_url)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\test\\client.py\", line 500, in\n get\n    **extra)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\test\\client.py\", line 303, in\n get\n    return self.generic(\'GET\', path, secure=secure, **r)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\test\\client.py\", line 379, in\n generic\n    return self.request(**r)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\test\\client.py\", line 466, in\n request\n    six.reraise(*exc_info)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\utils\\six.py\", line 659, in r\neraise\n    raise value\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\core\\handlers\\base.py\", line\n132, in get_response\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\PROJECTx\\sitebuilder\\views.py\", line 35, in page\n    return render(request, \'page.html\', context)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\shortcuts.py\", line 67, in re\nnder\n    template_name, context, request=request, using=using)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\template\\loader.py\", line 99,\n in render_to_string\n    return template.render(context, request)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\template\\backends\\django.py\",\n line 74, in render\n    return self.template.render(context)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\template\\base.py\", line 208,\nin render\n    with context.bind_template(self):\n  File \"C:\\Python34\\Lib\\contextlib.py\", line 59, in __enter__\n    return next(self.gen)\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\template\\context.py\", line 23\n5, in bind_template\n    updates.update(processor(self.request))\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\template\\context_processors.p\ny\", line 56, in i18n\n    context_extras[\'LANGUAGE_BIDI\'] = translation.get_language_bidi()\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\utils\\translation\\__init__.py\n\", line 177, in get_language_bidi\n    return _trans.get_language_bidi()\n  File \"C:\\Users\\Jaysp_000\\thisSite\\lib\\site-packages\\django\\utils\\translation\\trans_real.\npy\", line 263, in get_language_bidi\n    base_lang = get_language().split(\'-\')[0]\nAttributeError: \'NoneType\' object has no attribute \'split\'\n
\n\n

It seems that my problem lies in my command file, which I call build. The traceback also brings up my views file, which works well on its own (that is, my html files can be properly served on the local server), but I will include it anyway.

\n\n

build.py

\n\n
import os, shutil\nfrom django.conf import settings\nfrom django.core.management import call_command\nfrom django.core.management.base import BaseCommand\nfrom django.core.urlresolvers import reverse\nfrom django.test.client import Client\n\ndef get_pages():\n    for name in os.listdir(settings.STATIC_PAGES_DIRECTORY):\n        if name.endswith(\'.html\'):\n            yield name[:-5]\n\n\nclass Command(BaseCommand):\n    help = \'Build static site output.\'\n\n    def handle(self, *args, **options):\n        \"\"\"Request pages and build output.\"\"\"\n        if os.path.exists(settings.SITE_OUTPUT_DIRECTORY):\n            shutil.rmtree(settings.SITE_OUTPUT_DIRECTORY)\n        os.mkdir(settings.SITE_OUTPUT_DIRECTORY) \n        os.makedirs(settings.STATIC_ROOT)   \n        call_command(\'collectstatic\', interactive=False, clear=True, verbosity=0)\n        this_client_will = Client()\n\n        for page in get_pages():\n            the_page_url = reverse(\'page\',kwargs={\'slug\': page})      # PROBLEM SEEMS TO GENERATE STARTING HERE\n            response = this_client_will.get(the_page_url)\n            if page == \'index.html\':\n                output_dir = settings.SITE_OUTPUT_DIRECTORY\n            else:\n                output_dir = os.path.join(settings.SITE_OUTPUT_DIRECTORY, page)\n                os.makedirs(output_dir)\n            with open(os.path.join(output_dir, \'index.html\'), \'wb\', encoding=\'utf8\') as f:\n                f.write(response.content)\n
\n\n

views.py

\n\n
import os\nfrom django.conf import settings\nfrom django.http import Http404\nfrom django.shortcuts import render\nfrom django.template import Template\nfrom django.utils._os import safe_join\n\n# Create your views here.\n\ndef get_page_or_404(name):\n    \"\"\"Returns page content as a Django template or raise 404 error\"\"\"\n    try:\n        file_path = safe_join(settings.STATIC_PAGES_DIRECTORY, name)\n    except ValueError:\n        raise Http404(\"Page Not Found\")\n    else:\n        if not os.path.exists(file_path):\n            raise Http404(\"Page Not Found\")\n\n    with open(file_path,\"r\", encoding=\'utf8\') as f:\n        the_page = Template(f.read())\n\n    return the_page\n\ndef page(request, slug=\'index\'):\n    \"\"\" Render the requested page if found \"\"\"\n    file_name = \'{0}.html\'.format(slug)\n    page = get_page_or_404(file_name)\n    context = {\'slug\': slug, \'page\': page} \n    return render(request, \'page.html\', context)   # THE TRACEBACK POINTS AT THIS LINE, TOO\n
\n\n

and just in case it becomes useful to know, here is my urls.py:

\n\n
from django.conf.urls import include, url\n\nurlpatterns = [\n    url(r\'^page/(?P<slug>[-\\w]+)/$\', \'sitebuilder.views.page\', name=\'page\'),\n    url(r\'^page$\', \'sitebuilder.views.page\', name=\'homepage\'),\n]\n
\n\n

I find this frustrating, primarily because this problem seems to be tied to the reverse() function, as seen in the build module, and I havent had a great time using that function for as long as I can remember, but I dont know if this is really my problem. Can someone help me figure out where my issue is coming from and how to solve it (if you have any tips)? It would be much appreciated.

\n',,'03/01/2016 01:41',HQ 34572580,'Get superclass name in ES6','

I have a class, and another class that extends that class.

\n\n
class Shape {\n  constructor() {\n    return this;\n  }\n}\nclass Circle extends Shape {\n  constructor() {\n    super();\n    return this;\n  }\n}\nlet foo = new Circle();\n
\n\n

I can get foo\'s class with

\n\n
let className = foo.constructor.name \n// returns string \'Circle\'\n
\n\n

Is it possible to get the name of foo\'s superclass (\'Shape\') in a similar manner?

\n',,'03/01/2016 01:47',HQ 34572659,'Separate Int from String on file input','

i was wondering if anyone could help me with a little problem in Java:\nI have a file with some equations like:

\n\n
Z=1X1+3X2\n-1X1+5X2<=2\n1X1-1X2<=56\n
\n\n

and so on..

\n\n

and i wanted to read this file and separate the values 1 and 3 (of Z=1X1+3X2) in one string and -1,5,2,1,-1,56 in another.

\n',,'03/01/2016 02:06',LQ_CLOSE 34572819,'I want to insert a couple of sentences into an array','

Like instance, \nin online purchasing a bill is created. I want to insert the items into the array and display it along with the rates. But I am unable to insert the items into the array. How do I do that?

\n',,'03/01/2016 02:45',LQ_CLOSE 34572878,'Elasticsearch Bulk API - Index vs Create/Update','

I\'m using the Elasticsearch Bulk API to create or update documents.

\n\n

I do actually know if they are creates or updates, but I can simplify my code by just making them all index, or \"upserts\" in the SQL sense.

\n\n

Is there any disadvantage in using index (and letting ES figure it out) over using the more explicit create and update?

\n',,'03/01/2016 02:55',HQ 34573137,'Codename one - lib install in NetBeans','

I have downloaded the library for including Toasts in CN1, but I am not sure how to install/add it to NetBeans.

\n\n

Could you guide me?

\n',,'03/01/2016 03:47',LQ_CLOSE 34573248,'How to call SOAP web services from AngularJS','

Is there anyway to call soap web services from angularJS ? is there any service like $http to call SOAP web services?

\n',,'03/01/2016 04:11',LQ_CLOSE 34573279,'How to unzip .gz files in a new directory in hadoop?','

I have a bunch of .gz files in a folder in hdfs. I want to unzip all of these .gz files to a new folder in hdfs. How should i do this?

\n',,'03/01/2016 04:18',HQ 34573527,'how to Mail script output in table format','I am very new to shell scripting. I need your help on below senario.\r\n\r\nI have the script output like below.\r\n\r\n Filename Destname rowcount bytesize\r\n file1 default 1488 2248\r\n file2 default 123 657\r\n file3 default 123 456\r\n file4 default 567 124\r\n\r\nNow I need to mail this ouput in table format with proper indentation. Please help me to write the script for the same. \r\n',,'03/01/2016 05:09',LQ_EDIT 34573546,'Linux, Android, Lack of Compatablility with C','

If android is based on the linux kernel and is basicly a linux distro why can\'t it run C in front end apps. Why can\'t you download linux apps onto android with out special compilers and software. Should it not be built into the system. In some way i know it is becuase look at NetHunter. Its Kali backend with android frontend. So how dose this work? (Im a newb with Linux, just starting, need help, looking for a mentor) Are .DEB files cross platform and can i take a linux app and compile it as a .APK and it will work on android? Help me plz

\n',,'03/01/2016 05:12',LQ_CLOSE 34573779,'es6 - import all named module without alias','

I know that we can import all named modules with alias as below,

\n\n
import * as name from \"module-name\";\n
\n\n

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

\n\n

Actually, I have re-exported my modules in A.js and the same is inherited in B.js. PFB. Now, it\'s two level of inheritance, so it\'s not a big deal to import the named modules. But, when I\'m taking this to 5 level of inheritance (A -> B -> C -> D -> E), I need to import all named modules in all files and need to do the (re)export the same in all. Instead of doing this,

\n\n
    \n
  • Is there any other way to copy scope of all named modules into all level without reiterating the wheel (Import and Export)
  • \n
  • Behind the scene of this design is to make them to follow Opps concept and to avoid the redeclaration of the same modules.
  • \n
\n\n

A.js

\n\n
import React from \'react\';\nimport I18n from \'i18n-js\';\nimport m1 from \'module1\';\nimport m2 from \'module2\';\n\nexport default class A extends React.Component {}\n\nexport {React, I18n, m1, m2)\n
\n\n

B.js

\n\n
import BaseComponent from \'./A\';\nimport {React, I18n, m1, m2) from \'./A;\n\nexport default class B extends A {}\n
\n\n

Is there any way to import all named modules without alias like import {*} from \'./A\' (instead of 2nd in B.js)

\n',,'03/01/2016 05:52',HQ 34573813,'How to Take Database Backup without using phpmyadmin?','

How can I take backup of all tables of a database from ftp without using phpmyadmin and get the backup as a .sql file ??

\n',,'03/01/2016 05:57',LQ_CLOSE 34574349,'SockJS Python Client','

I have a website (Java + Spring) that relies on Websockets (Stomp over Websockets for Spring + RabbitMQ + SockJS) for some functionality.

\n\n

We are creating a command line interface based in Python and we would like to add some of the functionality which is already available using websockets.

\n\n

Does anyone knows how to use a python client so I can connect using the SockJS protocol ?

\n\n

PS_ I am aware of a simple library which I did not tested but it does not have the capability to subscribe to a topic

\n\n

PS2_ As I can connect directly to a STOMP at RabbitMQ from python and subscribe to a topic but exposing RabbitMQ directly does not feel right. Any comments around for second option ?

\n',,'03/01/2016 07:35',HQ 34574650,'what\'s wrong with my while loop code in R?','

I want to using while loop in R.

\n\n

I want to repeat loop until evt>1 and cpr>0, but it doesn\'t work.

\n\n

work_f is function of generating numbers.

\n\n
if((evt>1)&&(cpr>0)){\nwork<-work[order(work$z),]\nobs<-c(1:length(work$z))\nwork<-cbind(work,obs)\n  } else {\n while((evt>1)&&(cpr>0)) {\n  j<-j+1\n  seed<-settings*1000+h+j     \n\n  work_f(studysize = studysize,beta=beta,cutpoint = cutpoint,settings = settigns,p=p,alpha = alpha)\n\n  evt<-data.frame(ftable(work$event))\n  evttr<-data.frame(evt=numeric(1),cpr=numeric(1),csr=numeric(1))\n  if (p==0) {\n    evttr$evt<-evt$Freq[1]; evttr$cpr<-evt$Freq[2]; evttr$csr<-0\n  }else {\n    evttr$evt<-evt$Freq[2]; evttr$cpr<-evt$Freq[3]; evttr$csr<-evt$Freq[1]\n  }\n  evttr[is.na(evttr)]<-0\n  evt<-as.numeric(evttr$evt); cpr<-as.numeric(evttr$cpr)\n\n  if((evt>1)&&(cpr>0)){\n    work<-work[order(work$z),]\n    obs<-c(1:length(work$z))\n    work<-cbind(work,obs)\n  }\n }\n} \n
\n\n

What\'s wrong?

\n',,'03/01/2016 08:23',LQ_CLOSE 34574785,'How to display a button when there is no network and make it disappear when connection is available in Android App Development?','

I am creating an Android app and want to disappear retry button when there is network and it should be visible when there is no network, so the user can retry to load.

\n',,'03/01/2016 08:47',LQ_CLOSE 34574803,'Simple console graphics in C','

I am new to C and I would like to know if it is possible to make colorful console menus with simple graphics, like old DOS programs used to look. I am programming on Windows PC and portability is not important for this one.

\n',,'03/01/2016 08:50',LQ_CLOSE 34575047,'Java - Check if input is of Premitive type','I have to check for each **input**, print out if it is an instance of a *primitive or referenced* type. But I am getting same output each time. Any Help?\r\n\r\n**Note: I do search SO, but no luck.**\r\n\r\nCode:\r\n-----\r\n\r\n public class Demo {\r\n\r\n public static void main(String[] args) throws IOException {\r\n /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n \r\n for(int i=0; i<9; ++i){\r\n String input = br.readLine();\r\n showPremitive(input);\r\n } \r\n }\r\n public static void showPremitive(Object input){\r\n try{\r\n if (input instanceof Short)\r\n System.out.println(\"Primitive : short\");\r\n else if(input instanceof Integer)\r\n System.out.println(\"Primitive : int\");\r\n else if(input instanceof Long)\r\n System.out.println(\"Primitive : long\");\r\n else if(input instanceof Float)\r\n System.out.println(\"Primitive : float\");\r\n else if(input instanceof Double)\r\n System.out.println(\"Primitive : double\"); \r\n else if(input instanceof Boolean)\r\n System.out.println(\"Primitive : bool\");\r\n else if(input instanceof Character)\r\n System.out.println(\"Primitive : char\");\r\n else if(input instanceof Byte)\r\n System.out.println(\"Primitive : byte\");\r\n else \r\n System.out.println(\"Reference : string\");\r\n } \r\n catch (InputMismatchException e){\r\n System.out.println(\"crashing down\"+e);\r\n }\r\n }\r\n \r\n}\r\n\r\n**Output:**\r\n\r\n Reference : string\r\n Reference : string\r\n Reference : string\r\n Reference : string\r\n Reference : string\r\n Reference : string\r\n Reference : string\r\n Reference : string\r\n Reference : string\r\n\r\n',,'03/01/2016 09:27',LQ_EDIT 34575066,'How to prevent CMake from issuing /IMPLIB','

I have a CMake build that sends /IMPLIB to the linker on Windows. This is a problem in my case because the argument to implib is the same path as one of the input files.\nIt looks to me that CMake will always issue /IMPLIB when building with Visual Studio, and the passed argument cannot be modified.\nIs there a way to control this behaviour?

\n',,'03/01/2016 09:30',HQ 34575102,'when website is loaded, get news from txt file',' \r\n\r\nI want this code to get HTML code from a txt file and add it in here:\r\n\r\n
\r\n\r\nThe txt file contains the following:\r\n\r\n
\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t
\r\n\r\nThe function above doesn\'t work but i cant find a way to fix this, please help! Thanks!',,'03/01/2016 09:34',LQ_EDIT 34575561,'Automatically run gulp tasks after saving some of javascript files in Visual Studio','

I have a folder in my asp.net project that contains some javascript files. Just before building project, they are minified and copied to \"wwwroot\" folder using gulp. It works great, but when I make some changes to any of javascript files, I have to restart entire project (to run tasks connected with building) or manually run tasks from \"Task Runner Explorer\".

\n\n

It takes some time and it is quite irritating. Is it some way to run those tasks as soon as I save any of javascript files in this folder?

\n',,'03/01/2016 10:36',HQ 34575618,'Hover effect is backward from image. How hover effect can be forward from image?','[enter image description here][1]\r\n\r\n\r\nHover effect is backward from image. If I adjust the same size of image as
box, hover effect will be completely hidden. Even image presses down

How could hover effect can be forward from image and image and paragraph can be placed inside

?? \r\n\r\n \r\n
\r\n \t\t\r\n \t\t

aaaa

\r\n \t
\r\n\r\n [.colunm5 {\r\n \twidth:340px;\r\n \theight:378px;\r\n \tborder: 1px solid #000000;\r\n \tdisplay:inline-block;\r\n \tposition: relative;\r\n \tbottom:155px;\r\n }\r\n \r\n .colunm5_centered {\r\n \twidth:340px;\r\n \theight:378px;\r\n \tvertical-align: top;\r\n \tmargin: 0;\r\n \ttext-align: center;\r\n }\r\n \r\n .colunm5_centered{\r\n \tvisibility: hidden;\r\n }][2]\r\n\r\n\r\n [1]: http://i.stack.imgur.com/jVdZe.png\r\n [2]: http://i.stack.imgur.com/lKN0K.png',,'03/01/2016 10:44',LQ_EDIT 34575753,'Difference between sprite and texture?','

Can you please explain the difference between texture and sprite? When we zoom in a sprite, it appears blurry because it\'s basically an image. Is it the same for a texture?

\n\n

I read this comment on the image below online:

\n\n
\n

The background layers are textures and not sprites.

\n
\n\n

\"enter

\n\n

Can someone explain?

\n',,'03/01/2016 10:59',HQ 34575897,'Passing a component as an \'argument\' to another component in Angular 2','

I am new to web development and I have just started building an Angular 2 app. At this point I am trying to create some CRUD components/forms but I find my self duplicating a lot of code. I am not going to ask what are the common best practices to avoid code duplication and achieve component reusability when designing CRUD applications with Angular2, because the post will get locked. I will rather focus on one particular aspect:

\n\n

I have a \"CRUD page\" that has a list (it is an html table actually) of resources and several buttons that open up \"create\", \"read\", and \"edit\" forms. The list is a separate component on its own and the create/read/edit separate components as well. Each row of the table includes another component which knows how to render a resource item. I will call this <resource-item> component. However, I have several of those \"CRUD pages\", each page for a different resource. So what I want is to reuse the list component for all the resources. So the first thing to do is to add Inputs or Attributes to the list component in order to control its labels. So far so good.

\n\n

But what about the <resource-item> component? Each resource of my application might have a completely different structure. As a result I will need different components for different resources, e.g.: <resource-a-item>, <resource-b-item>, etc. How can I specify which resource item component I want to use every time I create a list component?

\n\n

Thank you for your time.

\n',,'03/01/2016 11:17',HQ 34576004,'Simple way to reset Django PostgreSQL database?','

I was able to reset a Django PostgreSQL database using the following steps:

\n\n
    \n
  1. Delete migration files
  2. \n
  3. Enter psql command prompt. Connect to database. drop schema public cascade; create schema public;
  4. \n
  5. Step 2 unfortunately seemed to have removed my user role and rights so I went back to the psql command promt and recreated those.
  6. \n
  7. Step 2 also meant I needed to run the following commands in the psql command prompt: grant usage on schema public to public;\ngrant create on schema public to public;
  8. \n
  9. Step 2 also deleted the standard Django users I had created so I needed to recreate these
  10. \n
  11. python manage.py makemigrations && python manage.py migrate
  12. \n
\n\n

I am currently making changes to my models and testing each change. I don\'t have any data I need to keep. Is there an easier way than the above to reset the database when migrations donät work?

\n\n

I would at least like to replace step 2 with something else so that I can skip steps 3-5.

\n',,'03/01/2016 11:28',HQ 34576493,'[Android][Listview] Unable to show my ArrayList data in Listview','The question is... I put my data in ArrayList and adding to ListView. But there has no data show on ListView but I am sure those data has been retrieved.\r\n\r\nThe System output for testing is correct.( my data )\r\n\r\nPlease solve my question...\r\nThere is my partial code: \r\n \r\n public class query_page extends AppCompatActivity {\r\n     public ArrayList show_Location, show_Messages;\r\n     public ListView listView;\r\n\r\n @Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_query_page);\r\n show_Location = new ArrayList();\r\n show_Messages = new ArrayList();\r\n listView = (ListView) findViewById(R.id.listView);\r\n \r\n ParseQuery query = ParseQuery.getQuery(\"Danger\");\r\n query.findInBackground(new FindCallback() {\r\n @Override\r\n public void done(List list, ParseException e) {\r\n if (e == null) {\r\n for (ParseObject j : list) {\r\n show_Location.add(j.getString(\"DangerLocation\"));\r\n show_Messages.add(j.getString(\"DangerMessage\"));\r\n System.out.println(\"Location: \" + j.getString(\"DangerLocation\"));\r\n System.out.println(\"Messages: \" + j.getString(\"DangerMessage\"));\r\n }\r\n ArrayAdapter adapter = new ArrayAdapter(query_page.this, android.R.layout.simple_list_item_1, show_Location);\r\n listView.setAdapter(adapter);\r\n\r\n } else {\r\n System.out.println(\"Exception occur! \");\r\n }\r\n }\r\n });\r\n }\r\n}',,'03/01/2016 12:24',LQ_EDIT 34576542,'Python - none returns from try and except clauses','

the return from this code (date) is \'none\' if an invalid entry is provided, then a valid entry is given. However if a valid entry is given first time, the correct return for date is given. Any tips on how I can solve it?

\n\n
def getDate():\n    date = input(\"Please enter the date in DD/MM/YYYY format: \")\n    try:\n        strptime(date, \"\%d/\%m/\%Y\")\n        return date\n    except:\n        print (\"Invalid Date, please enter again\")\n        getDate()\n
\n',,'03/01/2016 12:30',LQ_CLOSE 34576637,'Notepad-like GUI text editor for Linux/Ubuntu (SSH into an Ubuntu Server 14.04 LTS AWS instance)','

I am not so familiar with Linux/Ubuntu bash command line. I am currently ssh\'ing (using ConEmu) into an AWS instance (Ubuntu Server 14.04 LTS) in order to setup a Jupyter notebook server. However, in a part of the documentation in requires editing a file using the vim editor. Vim seems a but confusing right now to learn and I just need to edit a couple lines.

\n\n

Is there something similar in linux to the windows command line:

\n\n
notepad file_name.txt\n
\n\n

that opens a text file in a GUI for editing/saving. Is there a similar command line argument in Linux? Or something I can install which will give me this ability?

\n\n

Thanks

\n',,'03/01/2016 12:42',LQ_CLOSE 34576659,'NodeJS Express encodes the URL - how to decode','

I\'m using NodeJS with Express, and when I use foreign characters in the URL, they automatically get encoded.

\n\n

How do I decode it back to the original string?

\n\n

Before calling NodeJS, I escape characters.

\n\n

So the string: אובמה

\n\n

Becomes \%u05D0\%u05D5\%u05D1\%u05DE\%u05D4

\n\n

The entire URL now looks like: http://localhost:32323/?query=\%u05D0\%u05D5\%u05D1\%u05DE\%u05D4

\n\n

Now in my NodeJS, I get the escaped string \%u05D0\%u05D5\%u05D1\%u05DE\%u05D4.

\n\n

This is the relevant code:

\n\n
var url_parts = url.parse(req.url, true);\nvar params = url_parts.query;\nvar query = params.query; // \'\%u05D0\%u05D5\%u05D1\%u05DE\%u05D4\'\n
\n\n

I\'ve tried url and querystring libraries but nothing seems to fit my case.

\n\n
querystring.unescape(query); // still \'\%u05D0\%u05D5\%u05D1\%u05DE\%u05D4\'\n
\n',,'03/01/2016 12:44',HQ 34576679,'Python for loop - to iterate or not to iterate?','I\'m writing a hangman game using Python, based on a specific set of instructions. I specifically need to use a for loop in order to replace all the letters in a word with underscores and in fact I am succeeding in doing so. However I have one slight issue, I\'m getting a new line of underscores printed for every letter in my word. Is there a way to get rid of this? Can someone guide me on what is wrong with my logic? Thanks in advance.\r\n\r\n word = \"test\"\r\n\r\n def createBlank(word):\r\n for letter in word:\r\n blanks = \'_\' * len(word)\r\n print(blanks)\r\n\r\nMy result is as you would assume:\r\n\r\n >>> word\r\n \'test\'\r\n >>> createBlank(word)\r\n ____ #<- only need this line to be printed.. is it even possible using a for?\r\n ____\r\n ____\r\n ____',,'03/01/2016 12:47',LQ_EDIT 34576731,'Inherit ES6/TS class from non-class','

Given the class is extended from non-class (including, but not limited to, function),

\n\n
function Fn() {} \n\nclass Class extends Fn {\n    constructor() {\n        super();\n    }\n}\n
\n\n

what are the the consequences? What do the specs say on that?

\n\n

It looks like the current implementations of Babel, Google V8 and Mozilla Spidermonkey are ok with that, and TypeScript throws

\n\n
\n

Type \'() => void\' is not a constructor function type

\n
\n\n

If this is a valid ES2015 code, what\'s the proper way to handle it in TypeScript?

\n',,'03/01/2016 12:53',HQ 34577012,'Creating a stopwatch with redux','

I\'ve been trying to make a stopwatch in react and redux. I\'ve been having trouble trouble figuring out how to design such a thing in redux.

\n\n

The first thing that came to mind was having a START_TIMER action which would set the initial offset value. Right after that, I use setInterval to fire off a TICK action over and over again that calculates how much time has passed by using the offset, adds it to the current time, and then updates the offset.

\n\n

This approach seems to work, but I\'m not sure how I would clear the interval to stop it. Also, it seems like this design is poor and there is probably a better way to do it.

\n\n

Here is a full JSFiddle that has the START_TIMER functionality working. If you just want to see what my reducer looks like right now, here it is:

\n\n
const initialState = {\n  isOn: false,\n  time: 0\n};\n\nconst timer = (state = initialState, action) => {\n  switch (action.type) {\n    case \'START_TIMER\':\n      return {\n        ...state,\n        isOn: true,\n        offset: action.offset\n      };\n\n    case \'STOP_TIMER\':\n      return {\n        ...state,\n        isOn: false\n      };\n\n    case \'TICK\':\n      return {\n        ...state,\n        time: state.time + (action.time - state.offset),\n        offset: action.time\n      };\n\n    default: \n      return state;\n  }\n}\n
\n\n

I would really appreciate any help.

\n',,'03/01/2016 13:25',HQ 34577221,'I am trying to build a small web crawler, but pycharm does not show data','This is the code that I wrote.\r\n\r\n-----\r\n\r\n import requests\r\n from bs4 import BeautifulSoup\r\n \r\n def code_search(max_pages):\r\n page = 1\r\n while page <= max_pages:\r\n url = \'http://kindai.ndl.go.jp/search/searchResult?searchWord=朝鲜&facetOpenedNodeIds=&featureCode=&viewRestrictedList=&pageNo=\' + str(page)\r\n source_code = requests.get(url)\r\n plain_text = source_code.text\r\n soup = BeautifulSoup(plain_text, \'html.parser\')\r\n for link in soup.findAll(\'a\', {\'class\': \'item-link\'}):\r\n href = link.get(\'href\')\r\n page += 1\r\n \r\n code_search(2)\r\n\r\n-----\r\n\r\nMy pycharm version is pycharm-community-5.0.3 for mac.\r\n\r\nIt just says \"Process finished with exit code 0\"\r\n\r\nbut there should be some results if I have wrote the code accordingly...\r\n\r\nPlease help me out here!',,'03/01/2016 13:51',LQ_EDIT 34577818,'Finding any element with specific first coordinate in set >','

I\'m trying to figure out the following problem.

\n\n

Suppose I have the following container in C++:

\n\n
std::set<std::pair<int, int> > my_container;\n
\n\n

This set (dictionary) is sorted with respect to the order < on std::pair<int, int>, which is the lexicographic order. My task is to find any element in my_container that has the first coordinate equal to, say x, and return the iterator to it. Obviously, I don\'t want to use find_if, because I need to solve this in logarithmic time.

\n\n

I would appreciate any advice on how this can be done

\n',,'03/01/2016 14:50',HQ 34578174,'Are there any alternatives to T4 templates and EnvDTE for cross platform asp.net 5 development?','

We currently use T4 templates to generate C# code files based on C# Code (Entity POCO\'s) and the EDMX (in older applications)

\n\n

Moving to ASP.NET 5 with a view to support cross platform development, are there any code generation tools available that can read a projects class & meta data structures, and to generate C# files at design time, similar to T4 templates?

\n',,'03/01/2016 15:27',HQ 34578181,'[Error: Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually','

Im using Cordova in Linux mint 17

\n\n

I installed android sdk , cordova , android studio , nodejs 4

\n\n

problem is here\nwhen i wanna build app in codova and run this on terminal :

\n\n

sudo cordova build android

\n\n

it shows

\n\n
Running command: /home/tnt/hello12/platforms/android/cordova/build \n[Error: Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\nFailed to find \'android\' command in your \'PATH\'. Try update your \'PATH\' to include path to valid SDK directory.]\nERROR building one of the platforms: Error: /home/tnt/hello12/platforms/android/cordova/build: Command failed with exit code 2\nYou may not have the required environment or OS to build this project\nError: /home/tnt/hello12/platforms/android/cordova/build: Command failed with exit code 2\n
\n\n

I put this code

\n\n
 export HOME=\"/home/tnt\"\n    export ANDROID_HOME=\"$HOME/android/sdk/tools\"\n    export ANDROID_PLATFORM_TOOLS=\"$HOME/android/sdk/platform-tools\"\n    export PATH=\"$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH\"\n    export JAVA_HOME=\"/usr/lib/jvm/java-7-openjdk-amd64\"\n    export ANT_HOME=\"/usr/share/ant\"\n    export PATH=\"$ANT_HOME/bin:$PATH\"\n    export ANDROID_HOME=\"/home/tnt/android/sdk/tools\"\n
\n\n

on my

\n\n
/home/tnt/.bash_profile  \n/home/tnt/.bashrc\n/home/tnt/.profile  \n/root/.bash_profile  \n/root/.bashrc\n/root/.profile \n
\n\n

but it wont works

\n',,'03/01/2016 15:28',HQ 34578677,'How to ignore a particular directory or file for tslint?','

The IDE being used is WebStorm 11.0.3, the tslint is configured and works, but, it hangs because it tries to parse large *.d.ts library files.

\n\n

Is there a way to ignore a particular file or directory?

\n',,'03/01/2016 16:16',HQ 34579052,'Godaddy refresh function in php',' ok so im not sure what is wrong with this? (I know the url is currently in this example), but why would this not work? It works fine on localhost, so why not godaddy? \r\n\r\n \r\n\r\nPlz respond asap my site needs to be done today!!',,'03/01/2016 16:51',LQ_EDIT 34579213,'DBSCAN for clustering of geographic location data','

I have a dataframe with latitude and longitude pairs.

\n\n

Here is my dataframe look like.

\n\n
    order_lat  order_long\n0   19.111841   72.910729\n1   19.111342   72.908387\n2   19.111342   72.908387\n3   19.137815   72.914085\n4   19.119677   72.905081\n5   19.119677   72.905081\n6   19.119677   72.905081\n7   19.120217   72.907121\n8   19.120217   72.907121\n9   19.119677   72.905081\n10  19.119677   72.905081\n11  19.119677   72.905081\n12  19.111860   72.911346\n13  19.111860   72.911346\n14  19.119677   72.905081\n15  19.119677   72.905081\n16  19.119677   72.905081\n17  19.137815   72.914085\n18  19.115380   72.909144\n19  19.115380   72.909144\n20  19.116168   72.909573\n21  19.119677   72.905081\n22  19.137815   72.914085\n23  19.137815   72.914085\n24  19.112955   72.910102\n25  19.112955   72.910102\n26  19.112955   72.910102\n27  19.119677   72.905081\n28  19.119677   72.905081\n29  19.115380   72.909144\n30  19.119677   72.905081\n31  19.119677   72.905081\n32  19.119677   72.905081\n33  19.119677   72.905081\n34  19.119677   72.905081\n35  19.111860   72.911346\n36  19.111841   72.910729\n37  19.131674   72.918510\n38  19.119677   72.905081\n39  19.111860   72.911346\n40  19.111860   72.911346\n41  19.111841   72.910729\n42  19.111841   72.910729\n43  19.111841   72.910729\n44  19.115380   72.909144\n45  19.116625   72.909185\n46  19.115671   72.908985\n47  19.119677   72.905081\n48  19.119677   72.905081\n49  19.119677   72.905081\n50  19.116183   72.909646\n51  19.113827   72.893833\n52  19.119677   72.905081\n53  19.114100   72.894985\n54  19.107491   72.901760\n55  19.119677   72.905081\n
\n\n

I want to cluster this points which are nearest to each other(200 meters distance) following is my distance matrix.

\n\n
from scipy.spatial.distance import pdist, squareform\ndistance_matrix = squareform(pdist(X, (lambda u,v: haversine(u,v))))\n\narray([[ 0.        ,  0.2522482 ,  0.2522482 , ...,  1.67313071,\n     1.05925366,  1.05420922],\n   [ 0.2522482 ,  0.        ,  0.        , ...,  1.44111548,\n     0.81742536,  0.98978355],\n   [ 0.2522482 ,  0.        ,  0.        , ...,  1.44111548,\n     0.81742536,  0.98978355],\n   ..., \n   [ 1.67313071,  1.44111548,  1.44111548, ...,  0.        ,\n     1.02310118,  1.22871515],\n   [ 1.05925366,  0.81742536,  0.81742536, ...,  1.02310118,\n     0.        ,  1.39923529],\n   [ 1.05420922,  0.98978355,  0.98978355, ...,  1.22871515,\n     1.39923529,  0.        ]])\n
\n\n

Then I am applying DBSCAN clustering algorithm on distance matrix.

\n\n
 from sklearn.cluster import DBSCAN\n\n db = DBSCAN(eps=2,min_samples=5)\n y_db = db.fit_predict(distance_matrix)\n
\n\n

I don\'t know how to choose eps & min_samples value. It clusters the points which are way too far, in one cluster.(approx 2 km in distance) Is it because it calculates euclidean distance while clustering? please help.

\n',,'03/01/2016 17:09',HQ 34579243,'how to do this on bootstrap','

I am new in using bootstrap and I want to know how to do this in desktop size:

\n\n
 -----------------------\n |  table1 |  table2   |\n -----------           |\n | table3  |           |\n -----------           |\n |  table4 |           |\n -----------------------\n
\n\n

Glad if you would help me.

\n',,'03/01/2016 17:11',LQ_CLOSE 34579676,'How to sum all the numbers that I entered in the console','So my code looks like this \r\n \r\n\r\n\r\nI\'m trying to sum all of the numbers that go up to the number that\'s entered.',,'03/01/2016 17:55',LQ_EDIT 34579839,'Any chance to minify this snippet of code?','Any chance to minify the snippet of code below? Something like `if (!$(\'body#pagina_blog_1 **TO** body#pagina_blog_10).length)....`\r\n\r\nOn-line javascript minifires tools do not help...\r\n\r\n\r\n jQuery(function($){\r\n if (!$(\'body#pagina_blog_1, body#pagina_blog_2, body#pagina_blog_3, body#pagina_blog_4, body#pagina_blog_5, body#pagina_blog_6, body#pagina_blog_7, body#pagina_blog_8, body#pagina_blog_9, body#pagina_blog_10).length) return;\r\n \r\n // do stuff\r\n \r\n });',,'03/01/2016 18:10',LQ_EDIT 34580095,'Using R and plot.ly - how do I script saving my output as a webpage','

I want to make some interactive graphs using R and plot.ly. When I run the following code in R-Studio, it produces an interactive graph.

\n\n
library(plotly)\nset.seed(100)\nd <- diamonds[sample(nrow(diamonds), 1000), ]\nplot_ly(d, x = carat, y = price, text = paste(\"Clarity: \", clarity),\n    mode = \"markers\", color = carat, size = carat)\n
\n\n

After producing this graph, when I click on the \"Export\" button in the Plot window of R-Studio, it gives me the option to save the plot as a webpage. How can I script the process of saving produced plots as webpages? My ultimate goal is to run Rscripts iteratively from inside a bash script to produce multiple webpages.

\n',,'03/01/2016 18:33',HQ 34580136,'Facebook App Login: How to control expiration date of an image URL I got?','

I\'m developing an app, which uses the facebook login. After login the user must set additional informations and a profile picture, with the picture being provided from that logged in facebook account as well. Now the whole account details, including the URL to that profile picture, are saved in my database.

\n\n

To my surprise the profile picture has suddenly stopped working. Opening it\'s URL in a browser gives me this message \"URL signature expired\"

\n\n

https://scontent.xx.fbcdn.net/hphotos-xpa1/v/t1.0-9/p720x720/10846350_10204966809307370_2779189783437306470_n.jpg?oh=245bbada6c23f280a1e531e724be85ed&oe=56894D69

\n\n

Downloading those photos and save them to my own server is not really an option for me. Is there anything I can do to make that URL durable?

\n',,'03/01/2016 18:37',HQ 34580150,'How to print the following with php[preferred] or javaScript?','

So i was asked the following question in an interview. I was able to print the whole xxx thing. but it was not diagonal like the below one. I think it meant to have spaces prints through a loop. Can Someone please help me with this.

\n\n

How to print the following using php or javascript?? Php would be preferred.

\n\n
     xx\n    xxxx\n   xxxxxx\n  xxxxxxxx\n xxxxxxxxxx\n
\n\n

what i was able to get was

\n\n
xx\nxxxx\nxxxxxx\nxxxxxxxx\nxxxxxxxxxx \n
\n\n

through php for loop.

\n',,'03/01/2016 18:38',LQ_CLOSE 34580166,'What codes can I use in order to make music from parse I uploaded play shuffled for an app created by Xcode in swift language?','This is what I have so far...\r\n let query = PFQuery(className: \"Genres\")\r\n //Find objects in the background\r\n query.findObjectsInBackgroundWithBlock({\r\n //store objects in an array\r\n (objectsArray :[PFObject]?, error: NSError?) -> Void in\r\n \r\n let objectIDs = objectsArray\r\n // objects being added to array\r\n for i in 0...objectIDs!.count-1{\r\n // add a new element in the array\r\n self.iDArray.append(objectIDs![i].valueForKey(\"objectId\") as! String)\r\n //store song name in song array\r\n self.NameArray.append(objectIDs![i].valueForKey(\"SongName\")as! String)\r\n self.tableView.reloadData()\r\n \r\n NSLog(\"\\(objectIDs)\")\r\n \r\n }\r\n \r\n })\r\n }\r\n \r\n func grabSong () {\r\n let songQuery = PFQuery(className: \"Genres\")\r\n songQuery.getObjectInBackgroundWithId(iDArray[SelectedSongNumber], block: {\r\n (object: PFObject?, error : NSError?) -> Void in\r\n \r\n if let audioFile = object?[\"SongFile\"] as? PFFile {\r\n let audioFileUrlString: String = (audioFile.url)!\r\n let audioFileUrl = NSURL(string: audioFileUrlString)!\r\n AudioPlayer = AVPlayer(URL: audioFileUrl)\r\n AudioPlayer.play()\r\n }\r\n })\r\n }\r\n',,'03/01/2016 18:40',LQ_EDIT 34580415,'Cross Domain Image upload Angular+laravel','

I have been struggling with image upload on server. I am using ngFileUpload on front end. But I always get

\n\n

\"Response to preflight request doesn\'t pass access control check: No \'Access-Control-Allow-Origin\' header is present on the requested resource\"

\n\n

Angular Code for file Upload :

\n\n
 var uploadFile = function (file) {\n      if (file) {\n\n            if (!file.$error) {\n              Upload.upload({\n                  url: baseUrl+\'upload\',\n                  file: file\n\n\n              }).progress(function (evt) {\n                  var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);\n                  //console.log(evt.total);\n              }).success(function (data, status, headers, config) {\n                  $timeout(function() {\n\n                    console.log(data);\n                    console.log(status);\n                      if(status==200)\n                        {\n\n                          logo_path = data.logo_path;\n\n                        }\n\n                  });\n              });\n            }\n\n      }\n  };\n
\n\n

On Laravel i have configured CORS like this :

\n\n
public function handle($request, Closure $next)\n{\n    header(\"Access-Control-Allow-Origin: http://localhost:8001/\");\n\n    // ALLOW OPTIONS METHOD\n    $headers = [\n        \'Access-Control-Allow-Methods\'=> \'POST, GET, OPTIONS, PUT, DELETE\',\n        \'Access-Control-Allow-Headers\'=> \'Content-Type, X-Auth-Token, Origin\'\n    ];\n    if($request->getMethod() == \"OPTIONS\") {\n        // The client-side application can set only headers allowed in Access-Control-Allow-Headers\n        return Response::make(\'OK\', 200, $headers);\n    }\n\n    $response = $next($request);\n    foreach($headers as $key => $value)\n        $response->header($key, $value);\n    return $response;\n}\n
\n\n

The Normal cross domain POST request works fine. i.e $http.post(). I have tried many different variations of headers on angular but none helps. Also the OPTIONS request returns 200 OK but still preflight response failure message is displayed. Can anyone help me with how to further debug this issue?

\n',,'03/01/2016 19:04',HQ 34581270,'Understanding JavaScript Object(value)','

I understand that the following code wraps a number into an object:

\n\n
var x = Object(5);\n
\n\n

I therefore expect and understand the following:

\n\n
alert(x == 5); //true\nalert(x === 5); //false\n
\n\n

However, I also understand that an object is a list of key/value pairs. So I would have expected the following to be different:

\n\n
alert(JSON.stringify(5)); //5\nalert(JSON.stringify(x)); //5\n
\n\n

What does the structure of x look like? And why does it not appear to be in key/value pair format?

\n',,'03/01/2016 20:31',HQ 34581582,'Does return ends function if ifelse is used?','

I am returning something inside if else statement. Does it ends whole function or only ifelse scope?

\n\n
function user () {\n    if (//first) {\n        return TRUE;\n    }\n    //somecode\n\n    if (//second) {\n        return FALSE;\n    }\n\n    return TRUE;\n}\n
\n\n

In above code if my first condition is true, does it end whole function or only first ifelse scope?

\n',,'03/01/2016 21:03',LQ_CLOSE 34581961,'Android how to notify, when viewpager loads pages?','I have implemented viewpager autoscroll. But this triggers much earlier, even before the page loads/visible to user.\r\n\r\nI want to start the autoscroll, after all the pages visible to user. Please suggest how to handle the notification, when pages visible?\r\n\r\nCheers\r\nAP',,'03/01/2016 21:45',LQ_EDIT 34582991,'Why do we need field if we have property?','i dont know whether this question will end up as a dumb question, \r\nbut, it disturbing me.\r\nSo im reading some articles that emphasize the need of property to encapsulate fields in a class, \r\nif the property can store data (as field does) why do we still need field?\r\nfor example i have this class, \r\n\r\n public class Music\r\n {\r\n public Music() { }\r\n public float musicBPM { get; set; } \r\n public void addBPM()\r\n {\r\n this.muscBPM +=10;\r\n }\r\n }\r\n\r\nits still working like as i have a private field and change its value , right?\r\nso, whats the critical need of field if you can use the property?',<.net>,'03/01/2016 23:49',LQ_EDIT 34583073,'Angular 2 Errors and Typescript - how to debug?','

I\'ve just started a project to learn Angular2 and Typescript+Javascript. I come from a Java background and my approach to debugging projects is usually a combination of stack traces, compile errors, and - on larger projects - lots of test cases. However, much of this doesn\'t seem to directly translate to the world of web-dev; particularly debugging my code that\'s interacting with Angular2\'s libraries.

\n\n

Could anyone suggest any approaches that I can take to debug code working with Angular2? Specifically; how can I see what parts of my HTML/TS is causing issues? I\'ve checked the console, from which I can see that I\'ve broken Angular2, but it doesn\'t seem much more informative from that.

\n\n

Just to clarify; I don\'t want help for this specific instance. I\'d like to learn how to diagnose+fix these problems myself.

\n',,'03/01/2016 23:59',HQ 34583168,'Safe navigation operator (&.) for nil','

As Ruby 2.3 introduces the Safe navigation operator(&.), a.k.a lonely operator, the behavior on nil object seems odd.

\n\n
nil.nil?    # => true\nnil&.nil?   # => nil\n
\n\n

Is that designed to behave like this way? Or some edge case that slipped away when adding the lonely operator?

\n',,'04/01/2016 00:15',HQ 34583224,'What is the right command to convert an mp3 file to the required codec version (MPEG version 2) and bit rate (48 kbps) for Amazon Alexa SSML?','

I am trying to convert an mp3 file to the format expected by the audio tag in the Amazon Alexa SSML markup language as described here: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference

\n\n

The documentation recommends using https://www.ffmpeg.org/ffmpeg.html

\n\n

I tried this command but can\'t find the right codec to use:\nffmpeg -y -i input.mp3 -ar 44100 -ab 48k -codec:a mpeg2 -ac 1 output.mp3

\n\n

I know I need to convert the file because Alexa fails with the following error: The audio is not of a supported MPEG version

\n',,'04/01/2016 00:25',HQ 34583357,'Fastest way to convert a integer to arbitrarily ordered byte arrays in JavaScript?','

I\'m looking to convert the MIN_SAFE_INTEGER through MAX_SAFE_INTEGER range of a JavaScript number (53-bits not including the sign) into a string of bits spread over 7 bytes shifted two to allow for sign and null identifiers.

\n\n

Thus far the best I\'ve come up with is:

\n\n
function toUint8Array(data) {\n    data = data.toString(2);\n    data = new Array(65 - data.length).join(\'0\') + data;\n    var ret = new Uint8Array(data.length / 8);\n    for (var i = 0; i < 8; i++) {\n        ret[i] = 0;\n        ret[i] += (data[i * 8] == \'1\' ? 128 : 0);\n        ret[i] += (data[(i * 8) + 1] == \'1\' ? 64 : 0);\n        ret[i] += (data[(i * 8) + 2] == \'1\' ? 32 : 0);\n        ret[i] += (data[(i * 8) + 3] == \'1\' ? 16 : 0);\n        ret[i] += (data[(i * 8) + 4] == \'1\' ? 8 : 0);\n        ret[i] += (data[(i * 8) + 5] == \'1\' ? 4 : 0);\n        ret[i] += (data[(i * 8) + 6] == \'1\' ? 2 : 0);\n        ret[i] += (data[(i * 8) + 7] == \'1\' ? 1 : 0);\n    }\n    return (ret);\n}\n
\n\n

Fiddle

\n\n

As you can tell right off, this would be abominably slow (and the bits still haven\'t been shifted two places across all 7 active bytes.)

\n\n

Is there any way to do this faster? Ideally by avoiding the string parsing altogether?

\n',,'04/01/2016 00:45',HQ 34583637,'Will the following code removes a relationship by setting the foreign key to 0?','I have a question about entity framework.\r\n\r\nWill the following code removes a relationship by setting the foreign key to 0?\r\n\r\nentity.relationEntityID = 0;',,'04/01/2016 01:35',LQ_EDIT 34583717,'Authentication (Passport) enough for security with Node js backend server?','

Is PassportJS using Facebook Authentication enough for an iOS backend with Node JS?

\n\n

I have the toobusy package as well to decline requests when things get to busy (I\'m guessing it would be good for DDOSes).

\n\n

I\'m thinking of using nginx as a reverse proxy to my Node.JS server as well.

\n\n

What are some more security measures that can scale? Some advice and tips? Anything security related that I should be concerned about that PassportJS\'s authenticated session can\'t handle?

\n',,'04/01/2016 01:51',HQ 34583796,'Android @Intdef for flags how to use it','

I am not clear how to use @Intdef when making it a flag like this:

\n\n
@IntDef(\n  flag = true\n  value = {NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})\n
\n\n

this example is straight from the docs. What does this actually mean ? does it mean all of them are initially set to true ? if i do a \"or\" on the following:

\n\n
NAVIGATION_MODE_STANDARD | NAVIGATION_MODE_LIST\n
\n\n

what does it mean ...im a little confused whats happening here.

\n',,'04/01/2016 02:05',HQ 34583878,'Planning to make web app like Canva','

I want to make app like canva but i dont know where to start, i have good experience in html and css but a basic javascript.

\n\n

I need to know what they use.

\n\n
    \n
  • How to save html data to image like canva functions.
  • \n
  • How they save the data and load it again.
  • \n
\n\n

I already try Html2canvas but problem in images limit.

\n',,'04/01/2016 02:20',LQ_CLOSE 34583925,'Cannot find alphabet symbol','

I\'m trying to compile this code, but I get a cannot find symbol - variable alphabet . I don\'t understand why, because alphabet is being declared its value, that much is apparent. Is there something I\'m missing here? My code aims to encrypt and decrypt messages, by using two keys that work by dividing up the letters so that every other letter is encrypted by one key starting from index 0, and every other letter from the index of 1 is encrypted by another key. These two sets of letters are calculated and weaved back together to form one decrypted string. In any case I\'m only interested in finding out why I get a cannot find symbol - variable alphabeterror. Any other suggestions for my code is appreciated but not necessary. Thanks!

\n\n
public class CaesarCipherTwo {\n    private int encrypt_key = 0;\n    private int key1 = -1;\n    private int key2 = -1;\n    private CaesarCipher cc1;\n    private CaesarCipher cc2;\n    private void generateEncryptionLookup(){\n        String alphabet_uppercase = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n        String alphabet_lowercase = \"abcdefghijklmnopqrstuvwxyz\";   \n\n        String e_alphabet_uppercase = alphabet_uppercase.substring(encrypt_key) + alphabet_uppercase.substring(0,encrypt_key);\n        String e_alphabet_lowercase = alphabet_lowercase.substring(encrypt_key) + alphabet_lowercase.substring(0,encrypt_key);\n\n\n        alphabet = alphabet_uppercase + alphabet_lowercase;\n        e_alphabet = e_alphabet_uppercase + e_alphabet_lowercase;\n    }\n     /**\n     * Setter function for key used by cipher\n     * @param key\n     *            input key\n    **/\n\n    public void set_key(int key){\n        this.encrypt_key = key;\n        this.generateEncryptionLookup();\n\n    }\n    /**\n     * Constructor - Takes in the two keys used for encryption. Use this constructor when you want to use this object for encryption (& then subsequent \n     * decryption of same string)\n     * \n     * @param key1\n     *              Key1 used in encryption process\n     * @param key2\n     *              Key2 used in encryption process\n     */\n\n    public CaesarCipherTwo(int key1, int key2){\n        this.key1 = key1;\n        this.key2 = key2;\n        cc1 = new CaesarCipher();\n        cc1.set_key(key1);\n        cc2 = new CaesarCipher();\n        cc2.set_key(key2);\n\n    }\n\n    /**\n     * Constructor - To be used when you want to use this class for decryption & the method needs to figure out the decryption keys\n     */\n    public CaesarCipherTwo(){\n        cc1 = new CaesarCipher();\n        cc2 = new CaesarCipher();\n    }\n\n    /**\n     * Takes a String as input and encrypts it using 2 keys\n     * @param s \n     *          Input String\n     * @return\n     *          Encrypted String\n     */\n\n    public String encrypt(String s){\n        cc1.set_string_under_action(s);\n        cc2.set_string_under_action(s);\n        String encrypted1 = cc1.encryptString();\n        String encrypted2 = cc2.encryptString();\n        String encrypted = CaesarCipher.interleave(encrypted1, encrypted2);\n        return encrypted;\n\n    }\n\n    /**\n     * Takes a String and decrypts it using 2 keys\n     * @param s\n     *          String input for decryption\n     * @param mode\n     *          Accepts either 1 or 2 as input\n     *          Mode 1 - Use the complement of key used for encryption while doing decryption. Its critical that this mode be used with the same\n     *                   key settings as used while encrypting the String\n     *          Mode 2 - The method figures out the right decryption key to be used \n     * @return\n     *          Decrypted String\n     */\n\n    public String decrypt(String s, int mode){\n\n        String [] decrypt = CaesarCipherTwo.halfOfString(s);\n        cc1.set_string_under_action(decrypt[0]);\n        cc2.set_string_under_action(decrypt[1]);\n        String d1 = cc1.decryptString(mode);\n        String d2 = cc2.decryptString(mode);\n        String d = CaesarCipherTwo.weaveTwoStrings(d1, d2);\n        return d;   \n    }\n\n    /**\n     * Break a string into 2 (alternate chars in each of the 2 resultant strings)\n     * @param s \n     *          Input String\n     * @return\n     *          Returns an array of 2 strings. These are the resultant strings from breaking the input string\n     */\n\n    public static String[] halfOfString(String s){\n        StringBuilder sb1 = new StringBuilder(10000);\n        StringBuilder sb2 = new StringBuilder(10000);\n        String [] decrypt = new String[2];\n\n        for (int i = 0; i<s.length();i++){\n            if (i\%2 == 0){\n                sb1.append(s.charAt(i));\n            }else {\n                sb2.append(s.charAt(i));\n            }\n        }\n\n        decrypt[0] = sb1.toString();\n        decrypt[1] = sb2.toString();\n        return decrypt;\n    }\n\n    /**\n     * This method weaves 2 strings together into a single string. Letters from each of the input strings form alternate letters in final string\n     * @param s1\n     *          First input String\n     * @param s2\n     *          Second input String\n     * @return\n     *          Final resultant String\n     */\n\n    public static String weaveTwoStrings(String s1,String s2){\n        int len = Math.max(s1.length(), s2.length());\n        StringBuilder sb = new StringBuilder(10000);\n\n            for (int i=0; i< len; i++){\n                if (i < s1.length() && i < s2.length()){\n                    sb.append(s1.charAt(i));\n                    sb.append(s2.charAt(i));\n                }else if (i < s1.length() && i >= s2.length()){\n                    sb.append(s1.charAt(i));\n                }else if (i >= s1.length() && i < s2.length()){\n                    sb.append(s2.charAt(i)); \n                }\n            }        \n        return sb.toString();\n\n    }\n}\n
\n',,'04/01/2016 02:27',LQ_CLOSE 34584356,'Add a Foreign Key in PgAdmin','

I have studidtemplates table below:

\n\n

\"enter

\n\n

template_id is the primary_key

\n\n

\"enter

\n\n

I want to create a new table referencing template_id as a foreign key. It is named studidtemplatetextelements. See image below:

\n\n

\"enter

\n\n

I created a column template_id in the second table and want to make it a foreign key referencing template_id in studidtemplates table. I did it by clicking the button in the Constraints tab,pointed by an arrow in the image below.

\n\n

\"enter

\n\n

I notice something different. In \'Referencing\' option there\'s no template_id option available. See image below:

\n\n

\"enter

\n\n

Where am I missing?

\n',,'04/01/2016 03:36',HQ 34584576,'What is the easiest way to use material design in a react-native iOS app?','

I have found these partial implementations on Github as the leading contenders although they have a way to go:

\n\n\n\n

They are lacking some components at this time that I would like to utilize. Is there an alternative solution that I\'m missing?

\n',,'04/01/2016 04:12',HQ 34584578,'TypeScript + ES6 Map + Index signature of object type implicitly has an \'any\' type','

I have the following code in TypeScript:

\n\n
export class Config\n{\n    private options = new Map<string, string>();\n\n    constructor() {\n    }\n\n    public getOption(name: string): string {\n        return this.options[name]; // <-- This line causes the error.\n    }\n}\n
\n\n

And the compiler is giving me this error:

\n\n

Error:(10, 16) TS7017: Index signature of object type implicitly has an \'any\' type.

\n\n

The Map is \'possible\' through es6-shim. I am not quite sure what is going on here. Actually this Map confuses me a little. Map is supposed to come from es6-shim which is supposed to implement es6 functionality. But es6 doesn\'t have static types, right? So, why the Map expects the key/value types as generic arguments? I have seen some people adding a \'noImplicitAny\' flag but I want to solve the problem, not ignore it.

\n\n

Thank you.

\n',,'04/01/2016 04:12',HQ 34584959,'cross or one to many in c#','Table : \r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
NameSelection
Color1,2,3
Shapea,b
Cutx
Rangey
Purity8,9
\r\n\r\n\r\n\r\nI have one key like : Color | Shape | Cut | Range | Purity\r\n\r\nAnd I want to loop on Selection columns and need result like following\r\n\r\n1axy8\r\n1axy9\r\n1bxy8\r\n1bxy9\r\n2axy8\r\n2axy9\r\n2bxy8\r\n2bxy9\r\n3axy8\r\n3axy9\r\n3bxy8\r\n3bxy9\r\n\r\nHow can I loop on selection columns?',,'04/01/2016 05:05',LQ_EDIT 34585362,'How to Type Cast null as Bool in C#?','

I\'m having one null-able bool (bool?) variable, it holds a value null. One more variable of type pure bool, I tried to convert the null-able bool to bool. But I faced an error \"Nullable object must have a value.\"

\n\n

My C# Code is

\n\n
bool? x = (bool?) null;\nbool y = (bool)x;\n
\n',,'04/01/2016 05:48',HQ 34585453,'How to bind raw html in Angular2','

I use Angular 2.0.0-beta.0 and I want to create and bind some simple HTML directly. Is is possible and how?

\n\n

I tried to use

\n\n
{{myField}}\n
\n\n

but the text in myField will get escaped.

\n\n

For Angular 1.x i found hits for ng-bind-html, but this seems not be supported in 2.x

\n\n

thx\nFrank

\n',,'04/01/2016 05:58',HQ 34585896,'the \\b flag not working in javascript regrex','I am new to regular expressions and basically just playing around with them in my brower console , using MDN as a referance , i tried the below regrex:\r\n\r\n /\\bg/g.test(\'me building and him\')\r\n\r\neven if i try `/\\bg/g` , i still get false, WHY ? \r\n\r\nThe MDN definition says the following for `\\b`:\r\n\r\n> Matches a zero-width word boundary, such as between a letter and a\r\n> space. (Not to be confused with [\\b])\r\n> \r\n> For example, /\\bno/ matches the \"no\" in \"at noon\"; /ly\\b/ matches the\r\n> \"ly\" in \"possibly yesterday\".\r\n\r\nSo why is the `g` at the end of building not being matched ? , can anybody explain ? ',,'04/01/2016 06:38',LQ_EDIT 34586069,'ValueError: Series lengths must match to compare when matching dates in Pandas','

I apologize in advance for asking such a basic question but I am stumped.

\n\n

This is a very simple, dummy example. I\'m having some issue matching dates in Pandas and I can\'t figure out why.

\n\n
df = pd.DataFrame([[1,\'2016-01-01\'], \n                   [2,\'2016-01-01\'],\n                   [3,\'2016-01-02\'],\n                   [4,\'2016-01-03\']],\n                   columns=[\'ID\', \'Date\'])\n\ndf[\'Date\'] = df[\'Date\'].astype(\'datetime64\')\n
\n\n

Say I want to match row 1 in the above df.
\nI know beforehand that I want to match ID 1.
\nAnd I know the date I want as well, and as a matter of fact, I\'ll extract that date directly from row 1 of the df to make it bulletproof.

\n\n
some_id = 1\nsome_date = df.iloc[1:2][\'Date\']  # gives 2016-01-01\n
\n\n

So why doesn\'t this line work to return me row 1??

\n\n
df[(df[\'ID\']==some_id) & (df[\'Date\'] == some_date)] \n
\n\n

Instead I get \nValueError: Series lengths must match to compare
\nwhich I understand, and makes sense...but leaves me wondering...how else can I compare dates in pandas if I can\'t compare one to many?

\n',,'04/01/2016 06:52',HQ 34586576,'How to install cakephp3.1.6 on LAMP','I want to install cakephp3 on ubuntu14.0.4 in lamp. I put cakephp3 folder in /var/WWW/ path. When I entered `localhost/cakephp3/`in browser, something is not shown and no error is not.\r\n\r\nwhat should i do??? please help me...',,'04/01/2016 07:36',LQ_EDIT 34586698,'show alertdialog but cover the actionbar','I\'m new in android and I try using alertdialog but always cover the actionbar.\r\nhow can doing something like dropdown menu like the picture shown?\r\n\r\nI[![enter image description here][1]][1]\r\n\r\n\r\n [1]: http://i.stack.imgur.com/dX4lF.png',,'04/01/2016 07:45',LQ_EDIT 34586997,'SQL Update error. Instead of updating, its adding.','//for some reason it won\'t update, instead it will add the new data. \r\nI am a beginner, and I have hard time trying to find out the error. \r\nThank you for the help. \r\n//Read function was working very properly and insert works just fine as well. Its just the update that doesnt work properly, or inserts instead of updating the query or data. \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Document\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n \r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n \r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n \r\n ',,'04/01/2016 08:13',LQ_EDIT 34587067,'Change color of react-big-calendar events','

I need to make a calendar with events and I decided to use react-big-calendar. But I need to make events of different colors. So each event will have some category and each category has corresponding color. How can I change the color of the event with react? \"react-big-calendar

\n\n

Result should look something like this \"react-big-calendar

\n',,'04/01/2016 08:19',HQ 34587121,'Who designed monokai color scheme?','

I am in love with Monokai color scheme. Did the makers of Sublime Text designed it or is it in use before sublime text arrived?

\n\n

The second part of the question is that can I freely copy it for my own editor. Does anybody holds copyright over it?

\n',,'04/01/2016 08:24',LQ_CLOSE 34587254,'Accessing multiple controllers with same request mapping','

Please find my HomeController and DemoController

\n\n
class HomeController{\n@RequestMapping(value=\"index\")\npublic void home(){\n}\n}\n\nclass DemoController{\n@RequestMapping(value=\"index\")\npublic void demo(){\n}\n}\n
\n\n

when I try to send a request to index, which one will get executed?\nI wanted to know how can we have same request mapping value for multiple controllers

\n',,'04/01/2016 08:34',HQ 34587273,'android logcat logs chatty module line expire message','

I am getting lots of this kind of logcat messages related to my application.

\n\n

11-19 19:04:23.872 3327 3440 I chatty : uid=10085 com.xxxx.yyy expire 18 lines

\n\n

What are these log messages? Am I missing my actual application logcat logs here?

\n',,'04/01/2016 08:35',HQ 34587573,'Why do we use print statements while defining a function in python? Does it help in debugging?','

I am learning python programming and I read somewhere that many a times we use return statement without any output for the purpose of seeing the side effects. Could you explain why is that so? For eg.

\n\n
def sum(a, b)\n      print \"enter sum!\"\n      print \"a is\", a\n      a = a + b\n      print \"a is\", a\nprint sum(2, 123)\n
\n\n

What is the necessity of writing a print statement here?

\n',,'04/01/2016 08:59',LQ_CLOSE 34587588,'Need Help UnPIckling as String on Python','I need help UnPickling using Python 3.4.3, and I need to do it as an Integer. However it results in an Error. How do I unpickle data that I saved before as an Integer\r\n def LoadPickle(file):\r\n global shop_revenue\r\n global stock_coke\r\n global stock_mint\r\n global stock_sandwich\r\n shop_revenue = pickle.Unpickler(file)\r\n stock_coke = pickle.Unpickler(file)\r\n stock_mint = pickle.Unpickler(file)\r\n stock_sandwich = pickle.Unpickler(file)',,'04/01/2016 09:00',LQ_EDIT 34588057,'Why does Shake recommend disabling idle garbage collection?','

In the Shake documentation it recommends compiling using the flag -with-rtsopts=-I0 to disable idle garbage collection. Why does Shake recommend that?

\n',,'04/01/2016 09:29',HQ 34588421,'How to log to journald (systemd) via Python?','

I would like logging.info() to go to journald (systemd).

\n\n

Up to now I only found python modules which read journald (not what I want) or modules which work like this: journal.send(\'Hello world\')

\n',,'04/01/2016 09:51',HQ 34588464,'Python: how to capture image from webcam on click using OpenCV','

I want to capture and save a number of images from my webcam using OpenCV. This is my code currently:

\n\n
import cv2\n\ncamera = cv2.VideoCapture(0)\nfor i in range(10):\n    return_value, image = camera.read()\n    cv2.imwrite(\'opencv\'+str(i)+\'.png\', image)\ndel(camera)\n
\n\n

The problem with this is that I do not know when the images are being taken, so a lot of them end up blurry. My question is: Is there a way to have the image taken on the click of a keyboard key?

\n\n

Also is there a better way to take multiple images, instead of range?

\n',,'04/01/2016 09:53',HQ 34588728,'Terminating app due to uncaught exception \'NSInvalidArgumentException\', reason: \'Invalid type in JSON write (NSConcreteData)\'',' Getting an error NSInvalidArgumentException\', reason: \'Invalid type in JSON write . I hope this error when i post image data string in Request.Please help \r\n \r\n\r\n let imageData : NSData!\r\n imageData = UIImagePNGRepresentation(first.image!)!\r\n let base64String = imageData.base64EncodedDataWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength)\r\n \r\n \r\n requestObject[\"pimage1\"] = base64String\r\n \r\n \r\n let jsonData = try! NSJSONSerialization.dataWithJSONObject(params, options: .PrettyPrinted)\r\n\r\nTerminating app due to uncaught exception \'NSInvalidArgumentException\', reason: \'Invalid type in JSON write (NSConcreteData)\'',,'04/01/2016 10:10',LQ_EDIT 34588857,'SAML Signing Certificate - Which SSL Certificate Type?','

We\'re currently developing an SSL solution using SAML 2.0, and until now, have been using self signed certificates for signing the XML requests.

\n\n

However, as we move to production, we want to use a certificate from a certificate authority. But I\'m not really sure what type of certificate to purchase as they are all website centric. For example, single domain, wildcard domain, etc.

\n\n

For example, have been looking at these:\nhttps://www.123-reg.co.uk/ssl-certificates/

\n\n

I\'m fairly knowledgeable when it comes to purchasing SSL certificates for a website. However, as the certificate is just going to be use for signing SAML requests, does it matter which type is purchased? Surely whether it supports a single domain or wildcard domain is irrelevant?

\n',,'04/01/2016 10:16',HQ 34588887,'Firefox rendering my images as the wrong color - but fine in other browsers','

I have built a website however I am having problems with the png\'s in firefox as it is rendering the images as the wrong color. When I inspect the element in dev tool on firefox the images display as the right color which is what I don\'t understand.

\n\n

Could someone help

\n\n

www.forestroad.co.uk

\n',,'04/01/2016 10:18',LQ_CLOSE 34589023,'Undefined index: category_icon_code in line 257','

Hello I am getting Notice Undefined index: in line number 257.\nPlease help. \nHere is code for line number 257.

\n\n
$my_query = new wp_query( $args );\n            while( $my_query->have_posts() ) {\n                $my_query->the_post();\n                global $postID;\n                $current++;\n                $category = get_the_category();\n                $tag = get_cat_ID( $category[0]->name );\n                $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);\n                if (isset($tag_extra_fields[$tag])) {\n                    $category_icon_code = $tag_extra_fields[$tag][\'category_icon_code\']; \n                    $category_icon_color = $tag_extra_fields[$tag][\'category_icon_color\'];\n                    $your_image_url = $tag_extra_fields[$tag][\'your_image_url\'];\n                }\n                if (empty($category_icon_code) || empty($category_icon_color) || empty($your_image_url)) {\n\n                        $tag = $category[0]->category_parent;\n\n                        $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);\n                        if (isset($tag_extra_fields[$tag])) {\n                            if (empty($category_icon_code)){\n                                $category_icon_code = $tag_extra_fields[$tag][\'category_icon_code\'];\n                            }\n                            if (empty($category_icon_color)){\n                                $category_icon_color = $tag_extra_fields[$tag][\'category_icon_color\'];\n                            }\n                            if (empty($your_image_url)){\n                                $your_image_url = $tag_extra_fields[$tag][\'your_image_url\'];\n                            }\n                        }\n\n                    }\n            ?>\n
\n\n

I am getting undefined index for these.

\n\n
$category_icon_code\n$category_icon_color\n$your_image_url\n
\n\n

Thanks in advance.

\n',,'04/01/2016 10:25',LQ_CLOSE 34589033,'Trying to get property of non-object in yii','

I\'m using yii framework and I\'m new in yii and can\'t understand the problem in this code, it is giving error in this code and I just attached the image of my code

\n\n

\"image1\"

\n\n

and when I just try to echo \'<pre>\';print_r($role);echo \'</pre>\'; it just print code like this

\n\n

\"image2\"

\n\n

can\'t understand why this is giving error.

\n',,'04/01/2016 10:26',LQ_CLOSE 34589215,'How to remove edge between two vertices?','

I want to remove edge between two vertices, so my code in java tinkerpop3 as below

\n\n
private void removeEdgeOfTwoVertices(Vertex fromV, Vertex toV,String edgeLabel,GraphTraversalSource g){\n        if(g.V(toV).inE(edgeLabel).bothV().hasId(fromV.id()).hasNext()){\n            List<Edge> edgeList = g.V(toV).inE(edgeLabel).toList();\n            for (Edge edge:edgeList){\n                if(edge.outVertex().id().equals(fromV.id())) {\n                    TitanGraph().tx();\n                    edge.remove();                    \n                    TitanGraph().tx().commit();\n                    return;//Remove edge ok, now return.\n                }\n            }\n        }\n    }\n
\n\n

Is there a simpler way to remove edge between two vertices by a direct query to that edge and remove it? Thank for your help.

\n',,'04/01/2016 10:36',HQ 34589286,'i have json file on local computer i want to use that file in javascript how can i use that in js','>Following is the code snippet which i am trying\r\n\r\n\r\n var json = require(\'dictonery.json\'); //(with path)\r\n console.log(json);',,'04/01/2016 10:40',LQ_EDIT 34589435,'Get the enclosing class of a Java lambda expression','

I have a method that takes a functional parameter, e.g. a Runnable. As it\'s a library method, I want it to use a logger derived from the functional parameter. Calling getClass on the functional parameter works fine for normal classes, and I can getEnclosingClass for nested or anonymous classes; but if it\'s a lambda expression, it returns some obscure name containing $$Lambda$, which I could strip off manually like this:

\n\n
Class<?> type = runnable.getClass();\nString canonical = type.getCanonicalName();\nint lambdaOffset = canonical.indexOf(\"$$Lambda$\");\nif (lambdaOffset > 0) {\n    try {\n        type = Class.forName(canonical.substring(0, lambdaOffset));\n    } catch (ClassNotFoundException e) {\n        // strange, but we can stick to the type we already have\n    }\n}\n
\n\n

As you can see, that\'s not very elegant and probably not portable. I\'ve tried getEnclosingClass, getEnclosingMethod, and getEnclosingConstructor, but they all return null.

\n\n

Any ideas?

\n',,'04/01/2016 10:49',HQ 34589807,'how to give CAKEPHP validation ?',' $name=$_POST[\"name\"];\r\n select * from college where status=\'2\' where name=\'$name\'.\r\n\r\nif condition is true it has to show already exits or else successful msg has to display has to display . Is it possible to give this validation in model part.',,'04/01/2016 11:11',LQ_EDIT 34589908,'Using array values in images?','

I have a some pictures with values of 1 - 10 E.G. img1.png, img2.png etc.

\n\n

I also have some code that returns a number. What I would like is to have the returned number append an image.\nMy code is below and I can\'t get it to work properly. without the image it returns a normal number, but with it I get a blank return.

\n\n
$(\"#ext-row\").append(\"<div class=\'container returnedInfo\'><div class=\'col-md-2 wordValue\'> <img src\'/Content/Images/img\'\" + items[i].WordScore + \".png</div>\n
\n\n

Hope this makes sense

\n\n

Thanks

\n',,'04/01/2016 11:16',LQ_CLOSE 34590038,'Javascript regex to find expression in a line then append to the end of that line','

I am busy parsing a text log to HTML and I am replacing tabs with HTML bullet tags

\n\n

I need a regular expression to identify the beginning of a line and then append something to the end of it. eg:

\n\n
config system accprofile\n    edit \"Number 1\"\n        set mntgrp read-write\n    edit \"read-only\"\n        set mntgrp read\n\nconfig system 2\n    edit \"Number 2\"\n        set mntgrp read-write\n    edit \"read-only\"\n        set mntgrp read\n
\n\n

Needs to be changed to:

\n\n
<ul>\n    <li>config system accprofile</li>\n        <ul>\n        <li>edit \"Number 1\"</li>\n            <ul>\n            <li>set mntgrp read-write</li>\n            </ul>\n        <li>edit \"read-only\"</li>\n            <ul>    \n            <li>set mntgrp read</li>\n            </ul>\n        </ul>\n    <li>config system 2</li>\n        <ul>\n        <li>edit \"Number 2\"</li>\n            <ul>\n            <li>set mntgrp read-write</li>\n            </ul>\n        <li>edit \"read-only\"</li>\n            <ul>\n            <li>set mntgrp read</li>\n            </ul>\n        </ul>\n</ul>\n
\n\n

I can identify the front of each row by searching for \'config\' but I then need to append \\n\\t<ul> to the end of the line.

\n\n

How can I do this?

\n',,'04/01/2016 11:23',LQ_CLOSE 34590168,'What are typescript typings?','

I just started playing with angular 2, and I saw that many projects that are available on the web have a folder called typings. Digging more into the problem I found that it has something to do with https://www.npmjs.com/package/typings package. I read their documentation but I didn\'t understand exactly why do we need typings. Can you provide some example where typings are needed or helpful. \nThanks

\n',,'04/01/2016 11:31',HQ 34590173,'Long and wide data – when to use what?','

I\'m in the process of compiling data from different data sets into one data set for analysis. I\'ll be doing data exploration, trying different things to find out what regularities may be hidden in the data, so I don\'t currently have a specific method in mind. Now I\'m wondering if I should compile my data into long or wide format.

\n\n

Which format should I use, and why?

\n\n

I understand that data can be reshaped from long to wide or vice versa, but the mere existence of this functionality implies that the need to reshape sometimes arises and this need in turn implies that a specific format might be better suited for a certain task. So when do I need which format, and why?

\n\n

I\'m not asking about performance. That has been covered in other questions.

\n',,'04/01/2016 11:31',HQ 34590317,'Disable logging for one container in Docker-Compose','

I have a web application launched using Docker compose that I want to disable all logging for (or at the very least print it out to syslog instead of a file).

\n\n

When my web application works it can quickly generate an 11GB log file on startup so this eats up my disk space very fast.

\n\n

I\'m aware that normal docker has logging options for its run command but in Docker Compose I use

\n\n
\n

Docker-compose up

\n
\n\n

in the application folder to start my application. How would I enable this functionality in my case? I\'m not seeing a specific case anywhere online.

\n',,'04/01/2016 11:39',HQ 34590369,'Formatting a Date String in React Native','

I\'m trying to format a Date String in React Native.

\n\n

Ex: 2016-01-04 10:34:23

\n\n

Following is the code I\'m using.

\n\n
var date = new Date(\"2016-01-04 10:34:23\");\nconsole.log(date);\n
\n\n

My problem is, when I\'m emulating this on a iPhone 6S, it\'ll print Mon Jan 04 2016 10:34:23 GMT+0530 (IST) without any problem. But if I try with the iPhone 5S it prints nothing. And if you try to get the month by using a method like date.getMonth() it\'ll print \"NaN\".

\n\n

Why is this? What is the workaround?

\n',,'04/01/2016 11:41',HQ 34590463,'Java create enum from String','

I have enum class

\n\n
public enum PaymentType {\n\n    /**\n     * This notify type we receive when user make first subscription payment.\n     */\n    SUBSCRIPTION_NEW(\"subscr_signup\"),\n\n    /**\n     * This notify type we receive when user make subscription payment for next\n     * month.\n     */\n    SUBSCRIPTION_PAYMENT(\"subscr_payment\"),\n\n    /**\n     * This notify type we receive when user cancel subscription from his paypal\n     * personal account.\n     */\n    SUBSCRIPTION_CANCEL(\"subscr_cancel\"),\n\n    /**\n     * In this case the user cannot change the amount or length of the\n     * subscription, they can however change the funding source or address\n     * associated with their account. Those actions will generate the\n     * subscr_modify IPN that we are receiving.\n     */\n    SUBSCRIPTION_MODIFY(\"subscr_modify\"),\n\n    /**\n     * Means that the subscription has expired, either because the subscriber\n     * cancelled it or it has a fixed term (implying a fixed number of payments)\n     * and it has now expired with no further payments being due. It is sent at\n     * the end of the term, instead of any payment that would otherwise have\n     * been due on that date.\n     */\n    SUBSCRIPTION_EXPIRED(\"subscr_eot\"),\n\n    /** User have no money on card, CVV error, another negative errors. */\n    SUBSCRIPTION_FAILED(\"subscr_failed\");\n\n    private String type;\n\n    PaymentType(String type) {\n        this.type = type;\n    }\n\n    String getType() {\n        return type;\n    }\n}\n
\n\n

When I try to create enum :

\n\n
PaymentType type = PaymentType.valueOf(\"subscr_signup\");\n
\n\n

Java throws to me error :

\n\n
IllegalArgumentException occured : No enum constant models.PaymentType.subscr_signup\n
\n\n

How I can fix this?

\n',,'04/01/2016 11:46',LQ_CLOSE 34591737,'My program get crazy','

I tried to do a program that random 10000 numbers between 0-6 and check how much times every number get ruffle. It\'s get crazy and print lot\'s of things. please help me thanks!

\n\n
#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n#define ARR_SIZE 10000\n#define NUM_OF_FACES 6\n\nint main()\n{\n    srand(time(NULL));\n    int arrCube[ARR_SIZE];\n    int i=0,counter=0,j=0;\n    for(i = 0; i<ARR_SIZE; i++)\n    {\n        arrCube[i] = rand() \% NUM_OF_FACES;\n    }   \n    for(i=0;i<ARR_SIZE;i++)\n    {\n        counter=0;\n        for(j=i+1;j<ARR_SIZE -1;j++)\n        {\n            if (arrCube[i]==arrCube[j])\n            {\n                counter++;\n            }\n        }\n        printf(\"\%d times \%d showed up\\n\",counter,arrCube[i]);\n    }    \n\n    return (0);\n}\n
\n\n

Another thing: I know that I can do this program with another array instead the nested loop. someone know?

\n',,'04/01/2016 12:58',LQ_CLOSE 34591847,'Text to morse code using jQuery','

I\'ve been tasked with creating a little feature using JavaScript/jQuery that will translate text input by the user into morse code.

\n\n

What would be the most efficient way of going about this?

\n',,'04/01/2016 13:04',LQ_CLOSE 34594876,'Enterprise Distribution Provisioning Profile Expiration','

Our company enterprise provisioning profile is set to expire in a month, but our distribution certificate is set to expire in a few more years. What are our options?

\n\n

Do I need to regenerate a new provisioning profile and create a new build that I have to redistribute?

\n\n

Or is there a simpler option like just sending out the new provisioning profile I generate? or better yet I don\'t have to do anything?

\n\n

Thanks

\n',,'04/01/2016 15:51',HQ 34595322,'Change

tag by user input forever','

\r\n
\r\n
<form action=\"index.php\" method=\"post\">\r\n<input type=\"text\" name=\"content\" style=\"font-size: 25px\" placeholder=\"Name of content\"> //The text for p tag\r\n</form>\r\n\r\n<p></p> //display the inputted text above right HERE
\r\n
\r\n
\r\n

\n\n

Hey,

\n\n

I need to make simple thing. Make an input on a website, and under it, make a <p> tag. Whatever user inputs to this label/input, it will write that between the <p> tag. I know, that there is way in javascript, but i need to make it change forever, that means, when i refresh the page, it will be there, the same message forever. Any way to make it? Better to make it NOT using cross-database systém (in PhP)...

\n\n

Please help

\n',,'04/01/2016 16:17',LQ_CLOSE 34595356,'What does compound let/const assignment mean?','

There is an article Optimization killers in wiki of Bluebird library. In this article there is a phrase:

\n\n
\n

Currently not optimizable:
\n ...
\n Functions that contain a compound let assignment
\n Functions that contain a compound const assignment

\n
\n\n

What does compound let assignment and compound const assignment mean?\nIn ECMAScript 5.1 there was notion of compound assignment but in ECMAScript 2015, it seems there is no notion of any compound assignment there is only regular assignments.

\n\n

I suspect that compound let and const assignment, it is just compound assignment after declaration. For example:

\n\n
let n = 1;\nn += 4;\n
\n\n

Am I right?

\n',,'04/01/2016 16:19',HQ 34595597,'C# send string array over socket','

how can i send an string array over socket tcp from client to server and server to client? i cant find any solutions... i tried to convert the string array to a byte array and back. but i get a out of memory expection...

\n\n
private static byte[] ToByteArray(string[] input)\n{\n    using (var stream = new MemoryStream())\n    using (var writer = new BinaryWriter(stream, Encoding.UTF8))\n    {\n        var rows = input.GetLength(0);\n        writer.Write(rows);\n        for (int i = 0; i < rows; i++)\n        {\n            writer.Write(input[i]);\n        }\n        return stream.ToArray();\n    }\n}\n\nprivate static string[] FromByteArray(byte[] input)\n{\n    using (var stream = new MemoryStream(input))\n    using (var reader = new BinaryReader(stream, Encoding.UTF8))\n    {\n        var rows = reader.ReadInt32();\n        var result = new string[rows];\n        for (int i = 0; i < rows; i++)\n        {\n            result[i] = reader.ReadString();\n        }\n        return result;\n    }\n}\n
\n',,'04/01/2016 16:34',LQ_CLOSE 34595670,'Android studio error: unreported exception Throwable; must be caught or declares to be thrown','

Hello I hope you can help me.

\n\n

My project has 5 errors of the same type.

\n\n

These are methods where there is the error:

\n\n
public fresul BulkImportdbOperatori(SQLiteDatabase db, ArrayList<OperatoriXML> elencoOperatori) {\n        fresul Ret = new fresul(0, BuildConfig.FLAVOR);\n        Throwable th;\n        fresul Ret2 = new fresul(0, BuildConfig.FLAVOR);\n        db.beginTransaction();\n        try {\n            db.execSQL(\"DELETE FROM operatori\");\n            SQLiteStatement insert = db.compileStatement(\"INSERT INTO operatori (codice, alfaoperatore, login, password) VALUES (?, ?, ?, ?)\");\n            for (int i = 0; i < elencoOperatori.size(); i += VERSIONE_DB) {\n                insert.bindString(VERSIONE_DB, ((OperatoriXML) elencoOperatori.get(i)).getCodOp());\n                insert.bindString(2, ((OperatoriXML) elencoOperatori.get(i)).getAlfaOp());\n                insert.bindString(3, ((OperatoriXML) elencoOperatori.get(i)).getLoginOp());\n                insert.bindString(4, ((OperatoriXML) elencoOperatori.get(i)).getPwdOp());\n                insert.execute();\n                insert.clearBindings();\n            }\n            db.setTransactionSuccessful();\n            db.endTransaction();\n            return Ret2;\n        } catch (Exception e) {\n            String errMsg = e.getMessage() == null ? \"bulkInsert failed\" : e.getMessage();\n            Ret = new fresul(-1, errMsg);\n            Log.e(\"bulkInsert:\", errMsg);\n            db.endTransaction();\n            return Ret;\n        } catch (Throwable th2) {\n            th = th2;\n            Ret2 = Ret;\n            db.endTransaction();\n            throw th;\n        }\n    }\n
\n\n

this is the second method:

\n\n
public fresul BulkImportdbSale(SQLiteDatabase db, ArrayList<SaleXML> elencosale) {\n    fresul Ret = new fresul(0, BuildConfig.FLAVOR);\n    Throwable th;\n    fresul Ret2 = new fresul(0, BuildConfig.FLAVOR);\n    db.beginTransaction();\n    try {\n        db.execSQL(\"DELETE FROM sale\");\n        SQLiteStatement insert = db.compileStatement(\"INSERT INTO sale (codice, alfasala, numerotavoli, deltatavoli) VALUES (?, ?, ?, ?)\");\n        for (int i = 0; i < elencosale.size(); i += VERSIONE_DB) {\n            insert.bindString(VERSIONE_DB, ((SaleXML) elencosale.get(i)).getCodSala());\n            insert.bindString(2, ((SaleXML) elencosale.get(i)).getAlfaSala());\n            insert.bindString(3, Integer.toString(((SaleXML) elencosale.get(i)).getNumeroTavoli()));\n            insert.bindString(4, Integer.toString(((SaleXML) elencosale.get(i)).getDeltaTavoli()));\n            insert.execute();\n            insert.clearBindings();\n        }\n        db.setTransactionSuccessful();\n        db.endTransaction();\n        return Ret2;\n    } catch (Exception e) {\n        String errMsg = e.getMessage() == null ? \"bulkInsert failed\" : e.getMessage();\n        Ret = new fresul(-1, errMsg);\n        Log.e(\"bulkInsert:\", errMsg);\n        db.endTransaction();\n        return Ret;\n    } catch (Throwable th2) {\n        th = th2;\n        Ret2 = Ret;\n        db.endTransaction();\n        throw th;\n    }\n}\n
\n\n

This is the third method

\n\n
public fresul BulkImportdbArticoli(SQLiteDatabase db, ArrayList<RepartiXML> elencorep, ArrayList<VariantiXML> elencovar) {\n    fresul Ret = new fresul(0, BuildConfig.FLAVOR);\n    Throwable th;\n    fresul Ret2 = new fresul(0, BuildConfig.FLAVOR);\n    db.beginTransaction();\n    try {\n        int i;\n        String cv;\n        db.execSQL(\"DELETE FROM LinkVariantiArticoli\");\n        db.execSQL(\"DELETE FROM variantiarticoli\");\n        SQLiteStatement insertVariante = db.compileStatement(\"INSERT INTO variantiarticoli (codice, alfavariante, prezzovariante, variantepertutti) VALUES (?, ?, ?, ?)\");\n        for (i = 0; i < elencovar.size(); i += VERSIONE_DB) {\n            cv = ((VariantiXML) elencovar.get(i)).getCodVariante();\n            String av = ((VariantiXML) elencovar.get(i)).getAlfaVariante();\n            double pv = ((VariantiXML) elencovar.get(i)).getPrezzoVariante();\n            boolean gv = ((VariantiXML) elencovar.get(i)).getVariantePerTutti();\n            insertVariante.bindString(VERSIONE_DB, cv);\n            insertVariante.bindString(2, av);\n            insertVariante.bindDouble(3, pv);\n            insertVariante.bindLong(4, (long) boolToInt(gv));\n            insertVariante.execute();\n            insertVariante.clearBindings();\n        }\n        db.execSQL(\"DELETE FROM reparti\");\n        db.execSQL(\"DELETE FROM articoli\");\n        SQLiteStatement insertRep = db.compileStatement(\"INSERT INTO reparti (codice, descrizione, posizione) VALUES (?, ?, ?)\");\n        SQLiteStatement insertArt = db.compileStatement(\"INSERT INTO articoli (codice, descrizione, reparto, prezzo, iva, posizione) VALUES (?, ?, ?, ?, ?, ?)\");\n        SQLiteStatement insertLinkVarArt = db.compileStatement(\"INSERT INTO LinkVariantiArticoli (codice_articolo, codice_variante) VALUES (?, ?)\");\n        for (i = 0; i < elencorep.size(); i += VERSIONE_DB) {\n            insertRep.bindString(VERSIONE_DB, ((RepartiXML) elencorep.get(i)).getCodRep());\n            insertRep.bindString(2, ((RepartiXML) elencorep.get(i)).getAlfaRep());\n            insertRep.bindString(3, Integer.toString(((RepartiXML) elencorep.get(i)).getPosizione()));\n            insertRep.execute();\n            insertRep.clearBindings();\n            for (int y = 0; y < ((RepartiXML) elencorep.get(i)).getElencoArt().size(); y += VERSIONE_DB) {\n                ArticoliXML art = (ArticoliXML) ((RepartiXML) elencorep.get(i)).getElencoArt().get(y);\n                insertArt.bindString(VERSIONE_DB, art.getCodArt());\n                insertArt.bindString(2, art.getAlfaArt());\n                insertArt.bindString(3, ((RepartiXML) elencorep.get(i)).getCodRep());\n                insertArt.bindDouble(4, art.getPrezzoArt());\n                insertArt.bindDouble(5, art.getIvaArt());\n                insertArt.bindString(6, Integer.toString(art.getPosizione()));\n                insertArt.execute();\n                insertArt.clearBindings();\n                for (int K = 0; K < art.getElencoVarianti().size(); K += VERSIONE_DB) {\n                    cv = (String) art.getElencoVarianti().get(K);\n                    insertLinkVarArt.bindString(VERSIONE_DB, art.getCodArt());\n                    insertLinkVarArt.bindString(2, cv);\n                    insertLinkVarArt.execute();\n                    insertLinkVarArt.clearBindings();\n                }\n            }\n        }\n        db.setTransactionSuccessful();\n        db.endTransaction();\n        return Ret2;\n    } catch (Exception e) {\n        String errMsg = e.getMessage() == null ? \"bulkInsert failed\" : e.getMessage();\n        Ret = new fresul(-1, errMsg);\n        Log.e(\"bulkInsert:\", errMsg);\n        db.endTransaction();\n        return Ret;\n    } catch (Throwable th2) {\n        th = th2;\n        Ret2 = Ret;\n        db.endTransaction();\n        throw th;\n    }\n}\n
\n\n

This is the fourth method

\n\n
public fresul BulkImportdbCDP(SQLiteDatabase db, ArrayList<InfoCdpXML> elencoCDP) {\n        fresul Ret = new fresul(0, BuildConfig.FLAVOR);\n        Throwable th;\n        fresul Ret2 = new fresul(0, BuildConfig.FLAVOR);\n        db.beginTransaction();\n        try {\n            db.execSQL(\"DELETE FROM CentriDiProduzione\");\n            SQLiteStatement insert = db.compileStatement(\"INSERT INTO CentriDiProduzione (codice, alfacdp) VALUES (?, ?)\");\n            for (int i = 0; i < elencoCDP.size(); i += VERSIONE_DB) {\n                insert.bindString(VERSIONE_DB, ((InfoCdpXML) elencoCDP.get(i)).getCodCDP());\n                insert.bindString(2, ((InfoCdpXML) elencoCDP.get(i)).getAlfaCDP());\n                insert.execute();\n                insert.clearBindings();\n            }\n            db.setTransactionSuccessful();\n            db.endTransaction();\n            return Ret2;\n        } catch (Exception e) {\n            String errMsg = e.getMessage() == null ? \"bulkInsert failed\" : e.getMessage();\n            Ret = new fresul(-1, errMsg);\n            Log.e(\"bulkInsert:\", errMsg);\n            db.endTransaction();\n            return Ret;\n        } catch (Throwable th2) {\n            th = th2;\n            Ret2 = Ret;\n            db.endTransaction();\n            throw th;\n        }\n    }\n
\n\n

and this is the last

\n\n
public fresul BulkImportdbMsgForCDP(SQLiteDatabase db, ArrayList<MsgForCdpXML> elencoMSG) {\n    fresul Ret  = new fresul(0, BuildConfig.FLAVOR);\n    Throwable th;\n    fresul Ret2 = new fresul(0, BuildConfig.FLAVOR);\n    db.beginTransaction();\n    try {\n        db.execSQL(\"DELETE FROM MsgForCDP\");\n        SQLiteStatement insert = db.compileStatement(\"INSERT INTO MsgForCDP (codice, testo, cdp) VALUES (?, ?, ?)\");\n        for (int i = 0; i < elencoMSG.size(); i += VERSIONE_DB) {\n            insert.bindString(VERSIONE_DB, ((MsgForCdpXML) elencoMSG.get(i)).getCodMSG());\n            insert.bindString(2, ((MsgForCdpXML) elencoMSG.get(i)).getTestoMSG());\n            insert.bindString(3, ((MsgForCdpXML) elencoMSG.get(i)).getCodCDP());\n            insert.execute();\n            insert.clearBindings();\n        }\n        db.setTransactionSuccessful();\n        db.endTransaction();\n        return Ret2;\n    } catch (Exception e) {\n        String errMsg = e.getMessage() == null ? \"bulkInsert failed\" : e.getMessage();\n        Ret = new fresul(-1, errMsg);\n        Log.e(\"bulkInsert:\", errMsg);\n        db.endTransaction();\n        return Ret;\n    } catch (Throwable th2) {\n        th = th2;\n        Ret2 = Ret;\n        db.endTransaction();\n        throw th;\n    }\n}\n
\n\n

Could you help me understand what\'s going on?

\n',,'04/01/2016 16:37',LQ_CLOSE 34596217,'Which regex should I use?','I am trying to fetch the content inside the HTML content fetched from a web page and saved as a string, using Regex. I want to fetch the data for the below format,\r\n\r\n \r\n Data which is want to fetch\r\n \r\nI am using Javascript, which Regex should I use to get the data contained within font tags(opening and closing tags). Take care of the color attribute as I only want to fetch the data from those tags which have that color attribute and value as given in the code ',,'04/01/2016 17:08',LQ_EDIT 34596292,'Bukkit coding - Where will I put the if.senderHasPermission?','Where will i put the permission line in my plugin command code?\r\n\r\nhttp://pastebin.com/BCLyr0Mn\r\n\r\n\r\n',,'04/01/2016 17:12',LQ_EDIT 34596936,'WordPress theme not use after uploading m\'y website on server','I uploaded my WordPress project on my 1&1 server and i\'m very disapointed because all my modification have disapear. My theme is like Virgin.\nSi what can be wrong? Is there something to save before upload my files ?\nThank you',,'04/01/2016 17:54',LQ_EDIT 34596989,'If statement to check array values','

I want to display an answer based on what value in an array the user input matches. So I want the if statement to see if what was entered matches any values in the array.

\n',,'04/01/2016 17:56',LQ_CLOSE 34597186,'Use a different user.email and user.name for Git config based upon remote clone URL','

I configure my global ~/.gitconfig properties user.name and user.email like this:

\n\n

\n\n
git config --global user.email \"mkobit@example.com\" \ngit config --global user.name \"mkobit\"\n
\n\n

This is the default configuration I want for working on personal projects, open source stuff, etc.

\n\n

When I am working on a project from a specific domain, a corporate domain for example, I am configuring it for each repository when I clone it so that it uses a different user.name/user.email:

\n\n
git clone ssh://git@git.mycorp.com:1234/groupA/projectA.git\ncd projectA\ngit config user.email \"mkobit@mycorp.com\"\ngit config user.name \"m.kobit\"\n
\n\n

One decent option would be to setup an alias for cloning these kinds of repositories:

\n\n
git config --global alias.clonecorp \'clone \\ \n        -c user.name=\"m.kobit\" -c user.email=\"mkobit@mycorp.com\"\'\ngit clonecorp ssh://git@git.mycorp.com:1234/groupA/projectA.git\n
\n\n

Both of these can be error prone because they both depend on me being smart and following the right steps. Evidence shows that this is near-guaranteed for me to screw-up sometime.

\n\n

Is there a way to configure Git such that repositories from a certain domain (the mycorp.com in this example) will be configured a certain way?

\n',,'04/01/2016 18:10',HQ 34597229,'google maps API for C#','

im really new in to using APIs so after looking on google maps Api page im not sure if there are APIs designed to be used for C#. I dont need a google maps to be show on my app all i need to know if i can use the google maps API on C#.\nThis is the one i will like to use

\n\n

Ive look for it on many places but all i could find was alternatives to using Gmaps but thats not what i want.

\n\n

¿It is possible to use it?

\n',,'04/01/2016 18:13',HQ 34597576,'CLI 400 error deploying to Google App Engine','

Today I got a new error when trying to deploy my application to Google App Engine via the command line:

\n\n
Updating module [default]...-ERROR: (gcloud.preview.app.deploy) Server responded with code [400]:\n  Bad Request Unexpected HTTP status 400.\n  Your app may not have more than 120 versions.\n  Please delete one of the existing versions before trying to create a new version.\n
\n\n

I am deploying to the top level using --promote, not creating other versions. How do I fix this error?

\n',,'04/01/2016 18:34',HQ 34597768,'Visual Studio 2015- How to disable \"based on your project, we have identified extensions you may find helpful\" message?','

Since the latest update to Visual Studio 2015, I get this message when I open .html or .cshtml files. Clicking \"Don\'t Ask Again\" only disables this until VS is restarted. How can I turn it off permanently?

\n\n

\"enter

\n',,'04/01/2016 18:47',HQ 34597926,'converting daily stock data to weekly-based via pandas in Python','

I\'ve got a DataFrame storing daily-based data which is as below:

\n\n
Date              Open        High         Low       Close   Volume\n2010-01-04   38.660000   39.299999   38.509998   39.279999  1293400   \n2010-01-05   39.389999   39.520000   39.029999   39.430000  1261400   \n2010-01-06   39.549999   40.700001   39.020000   40.250000  1879800   \n2010-01-07   40.090000   40.349998   39.910000   40.090000   836400   \n2010-01-08   40.139999   40.310001   39.720001   40.290001   654600   \n2010-01-11   40.209999   40.520000   40.040001   40.290001   963600   \n2010-01-12   40.160000   40.340000   39.279999   39.980000  1012800   \n2010-01-13   39.930000   40.669998   39.709999   40.560001  1773400   \n2010-01-14   40.490002   40.970001   40.189999   40.520000  1240600   \n2010-01-15   40.570000   40.939999   40.099998   40.450001  1244200   \n
\n\n

What I intend to do is to merge it into weekly-based data. After grouping:

\n\n
    \n
  1. the Date should be every Monday (at this point, holidays scenario should be considered when Monday is not a trading day, we should apply the first trading day in current week as the Date).
  2. \n
  3. Open should be Monday\'s (or the first trading day of current week) Open.
  4. \n
  5. Close should be Friday\'s (or the last trading day of current week) Close.
  6. \n
  7. High should be the highest High of trading days in current week.
  8. \n
  9. Low should be the lowest Low of trading days in current week.
  10. \n
  11. Volumn should be the sum of all Volumes of trading days in current week.
  12. \n
\n\n

which should look like this:

\n\n
Date              Open        High         Low       Close   Volume\n2010-01-04   38.660000   40.700001   38.509998   40.290001  5925600   \n2010-01-11   40.209999   40.970001   39.279999   40.450001  6234600   \n
\n\n

Currently, my code snippet is as below, which function should I use to mapping daily-based data to the expected weekly-based data? Many thanks!

\n\n
import pandas_datareader.data as web\n\nstart = datetime.datetime(2010, 1, 1)\nend = datetime.datetime(2016, 12, 31)\nf = web.DataReader(\"MNST\", \"yahoo\", start, end, session=session)\nprint f\n
\n',,'04/01/2016 18:56',HQ 34597950,'Sass and Compass','

I started working with compass today. I have created a project using sass (that\'s atleast what I entered in the cmd).

\n\n

It made my project, all good. All files are good etc, made them .sass extensions.

\n\n

File Structure: http://prntscr.com/9m2i7s

\n\n

But now (here comes the problem), when I try to enter in some sass code, it\'s giving me an error: http://prntscr.com/9m2isq.

\n\n

I have already found out what the problem is. The project thinks I\'m using scss (where the syntax is without the \';\'s and \'{ }\'s.

\n\n

I don\'t mind working with scss instead of sass, but I find it weird. Because it made sass files for me etc.. and now it\'s wanting me to use scss.

\n\n

Does anyone know how I would maybe be able to use sass instead of scss?

\n\n

Kind Regards!

\n',,'04/01/2016 18:58',LQ_CLOSE 34598268,'Realm Migration doesn\'t work','
    let config = Realm.Configuration(\n        // Set the new schema version. This must be greater than the previously used\n        // version (if you\'ve never set a schema version before, the version is 0).\n        schemaVersion: 1,\n\n        // Set the block which will be called automatically when opening a Realm with\n        // a schema version lower than the one set above\n        migrationBlock: { migration, oldSchemaVersion in\n            // We haven’t migrated anything yet, so oldSchemaVersion == 0\n            if (oldSchemaVersion < 1) {\n                // Nothing to do!\n                // Realm will automatically detect new properties and removed properties\n                // And will update the schema on disk automatically\n            }\n    })\n\n    // Tell Realm to use this new configuration object for the default Realm\n    Realm.Configuration.defaultConfiguration = config\n\n    // Now that we\'ve told Realm how to handle the schema change, opening the file\n    // will automatically perform the migration\n    let realm = try! Realm()\n
\n\n

This was put in application(application:didFinishLaunchingWithOptions:)

\n\n

In my test program, I have changed the fields in my object. I would like to remove everything in the database, and move to the new field types. I\'ve copied the code above from the documentation, but it appears to do nothing. I still get these errors:

\n\n
fatal error: \'try!\' expression unexpectedly raised an error: Error Domain=io.realm Code=0 \"Migration is required due to the following errors: \n- Property types for \'unit\' property do not match. Old type \'string\', new type \'int\'\n- Property \'reps\' has been added to latest object model.\" UserInfo={NSLocalizedDescription=Migration is required due to the following errors: \n- Property types for \'unit\' property do not match. Old type \'string\', new type \'int\'\n- Property \'reps\' has been added to latest object model.}: file   /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.1.101.15/src/swift/stdlib/public/core/\n
\n\n

Any ideas?

\n',,'04/01/2016 19:20',HQ 34598363,'Get public key from SSH server','

I\'m looking for this for a long time.

\n\n

I need to extract and get modulus and exponent from SSH server.

\n\n

For example, I know, that on server xxx.xxx.xxx.xxx is running ssh (I can connect to this server / ping) but I dont know user name and password so cannot log in.

\n\n

I need to get modulus and exponent of public RSA key of this server.

\n\n

I found, that ssh-keyscan can get modulus + exponent (from documentation) but only if ssh-rsa1 is used. If I try to get ssh-rsa(2) public key with ssh-keyscan, I cannot retrieve from output modulus and exponent.

\n\n

Is it possible ?

\n',,'04/01/2016 19:25',HQ 34598541,'How can I add new elements to an array inside of another struct array in C?','

Right now my code looks like this,

\n\n
    typedef struct veiculo\n{\n    char matricula[8];\n    int nreixos;\n    float alturaeixo;\n    int tag;\n    int classe;\n\n}veiculo;\n\ntypedef struct portagem\n{\n    int nome;\n    int kilometros;\n    float preco;\n    float total_recebido;\n    struct veiculo carro[100];\n}portagem;\n\n(...)\n\nint encontrar_ult_elemento(struct veiculo v[]){\n    int d;\n    int i;\n    for(i=0;i<100;i++){\n        if (v[i]!= 0)\n        d++;\n        else\n            return d;\n    }\n}\nvoid guardar_veiculo(struct portagem p[] ,struct veiculo v, int d){\n    int i;\n        if(v.tag==\"1\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[1].carro[n]=v;\n        else if(v.tag==\"2\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[2].carro[n]=v;\n        else if(v.tag==\"3\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[3].carro[n]=v;\n        else if(v.tag==\"4\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[4].carro[n]=v;\n        else if(v.tag==\"5\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[5].carro[n]=v;\n        else if(v.tag==\"6\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[6].carro[n]=v;\n        else if(v.tag=\"7\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[7].carro[n]=v;\n        else if(v.tag=\"8\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[8].carro[n]=v;\n        else if(v.tag=\"9\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[9].carro[n]=v;\n        else if(v.tag=\"10\")\n            encontrar_ult_elemento(p[1].carro[])=n;\n            p[10].carro[n]=v;\n    }\n\n\n    int main()\n{\nstruct portagem portagem1;\nportagem1.nome = 1;\nportagem1.kilometros=14;\nportagem1.preco=1.00;\nportagem1.total_recebido;\n\nstruct portagem portagem2;\nportagem2.nome = 2;\nportagem2.kilometros=15;\nportagem2.preco=1.05;\nportagem2.total_recebido;\n\nstruct portagem portagem3;\nportagem3.nome = 3;\nportagem3.kilometros=7;\nportagem3.preco=1.20;\nportagem3.total_recebido;\n\n(...)\n\n\n\nstruct portagem p[]={portagem1,portagem2,portagem3,portagem4,portagem5,portagem6,portagem7,portagem8,portagem9};\n
\n\n

****I have another functions going on, to ask the user to register the veicule, assigning the respective tag etc...I just don\'t if this is the correct way to do it.\nthanks for your help guys! ****

\n',,'04/01/2016 19:37',LQ_CLOSE 34598563,'MongoDB Print Pretty with PyMongo','

I\'ve looked up print pretty for MongoDB, and i understand how to do it from the shell. What I can\'t find is how to do it with PyMongo, so that when I run it in eclipse, the output will print pretty instead of all in one line. Here\'s what I have right now:

\n\n
  cursor = collection.find({})\n  for document in cursor: print(document)\n
\n\n

This prints everything in my collection, but each document in my collection just prints in one line. How can i change this to get it to print pretty?

\n',,'04/01/2016 19:38',HQ 34598719,'TGraphic.Draw(Canvas, Rect) does not work','I need to insert an image into an ImageList. The image is in a descendant of TGraphicControl (see source code below). The insertion seems to work. However, I get only a white rectangle in the ImageList:\r\n\r\n function InsertCloudImageIntoImageList(AdvCloudImage1: TAdvCloudImage): Integer;\r\n // TAdvCloudImage = class(TGraphicControl)\r\n // WebPicture is TCloudPicture = class(TGraphic)\r\n var\r\n TempBitmap: TBitmap;\r\n R: TRect;\r\n begin\r\n Result := 0;\r\n TempBitmap := TBitmap.Create;\r\n try\r\n TempBitmap.SetSize(16, 16);\r\n R.Width := 16;\r\n R.Height := 16;\r\n R.Top := 0;\r\n R.Left := 0;\r\n \r\n AdvCloudImage1.WebPicture.Draw(TempBitmap.Canvas, R);\r\n Result := Form1.ImageList1.Add(TempBitmap, nil);\r\n finally\r\n TempBitmap.Free;\r\n end;\r\n end;\r\n\r\nI suspect the bug is in the drawing on the bitmap canvas?',,'04/01/2016 19:50',LQ_EDIT 34598845,'i want to get the keys and values of each set using java','

Am new to java i have formed a set of result in

\n\n
       `Map<String, Map<String, List<String>>>`\n
\n\n

now i want to get the keys and values of each set

\n\n

How should get this. anyone please suggest me

\n\n

thanks in advance.

\n',,'04/01/2016 19:58',LQ_CLOSE 34599888,'How do I rename a Google Cloud Platform project?','

Is it possible to rename a Google Cloud Platform project? If so, how?

\n\n

I don\'t need to change the project ID or number. But I do want to change the project name (the name used by/for humans to identify a cloud platform project).

\n\n

Thanks for any tips!

\n',,'04/01/2016 21:09',HQ 34600130,'How to decrease padding in NumberPicker','

How to decrease padding in NumberPicker

\n\n

\"enter

\n\n

I want something like it:

\n\n

\"enter

\n',,'04/01/2016 21:24',HQ 34600544,'Slick Carousel Easing Examples','

I am using Slick Carousel (http://kenwheeler.github.io/slick/), but don\'t know how to incorporate different slide transitions. Does anyone have an example to share?

\n\n

Here\'s what I currently have:

\n\n
    $(\'.slider1\').slick({\n        autoplay:true,\n        autoplaySpeed: 4500,\n        arrows:false,\n        slide:\'.slider-pic\', \n        slidesToShow:1,\n        slidesToScroll:1,\n        dots:false,\n        easing: \'easeOutElastic\',\n        responsive: [\n        {\n          breakpoint: 1024,\n          settings: {\n            dots: false\n          }\n        }]\n    });\n
\n\n

On site - http://lantecctc.businesscatalyst.com/

\n',,'04/01/2016 21:52',HQ 34600588,'I want to use the output of `gcloud` in a script, but the format changes. What should I do?','

I’m using the command gcloud compute instances list in a script, but I’m worried that the exact output format isn’t static. What should I do?

\n',,'04/01/2016 21:56',HQ 34600612,'Weird checkbox behaviour','I\'ve recently solved browser neutral check boxes issue which I was having in IE vs Chrome. we have a theme for the application in the background. theme color get applies if I checked the check box in chrome but not in IE11\r\n\r\nhow should I force or tell the chrome check box to ignore the theme. it\'s working fine in IE but not in chrome that\'s the problem.\r\n\r\nhttp://jsfiddle.net/LnL7b/\r\n\r\n .mycheckbox:checked {\r\n background: url(icon.png)no-repeat center center;\r\n background-size: 100\%;\r\n }\r\n\r\n \r\n [Here\'s how ugly it\'s Chrome][1]\r\n\r\n\r\n\r\n [1]: http://i.stack.imgur.com/ZNEjD.png\r\n ',,'04/01/2016 21:57',LQ_EDIT 34600833,'I want to populate a single element in a 2D array randomly with a single char value?','

How can I randomly choose a single element out of a 2D array and fill that one element with char \'M\'?

\n',,'04/01/2016 22:13',LQ_CLOSE 34600932,'npm - EPERM: operation not permitted on Windows','

I ran

\n\n
npm config set prefix /usr/local\n
\n\n

After running that command,\nWhen trying to run any npm commands on Windows OS I keep getting the below.

\n\n
Error: EPERM: operation not permitted, mkdir \'C:\\Program Files (x86)\\Git\\local\'\nat Error (native)\n
\n\n

Have deleted all files from

\n\n
C:\\Users\\<your username>\\.config\\configstore\\\n
\n\n

It did not work.

\n\n

Any suggestion ?

\n',,'04/01/2016 22:21',HQ 34601532,'Ruby: syntax error, unexpected end-of-input, expecting keyword_end','

I am working on some simple ruby exercises and cannot figure out why I am getting the \"syntax error, unexpected end-of-input, expecting keyword_end\". I keep running over my code and don\'t see what is wrong, although I am new to ruby.

\n\n
def SimpleSymbols(str)\n\n    spec_char = \"+=\"\n    alpha = \"abcdefghijklmnopqrstuvwxyz\"\n\n    str.each_char do |i|\n        if spec_char.include? i\n            next\n        else alpha.include? i \n            if spec_char.include? str[str.index(i) + 1] && if spec_char.include? str[str.index(i) - 1]\n                next\n            else\n                return false\n            end\n        end\n    end\n\n    return true\nend\n\nSimpleSymbols(STDIN.gets.chomp)\n
\n',,'04/01/2016 23:07',LQ_CLOSE 34601554,'Mac spark-shell Error initializing SparkContext','

I tried to start spark 1.6.0 (spark-1.6.0-bin-hadoop2.4) on Mac OS Yosemite 10.10.5 using

\n\n
\"./bin/spark-shell\". \n
\n\n

It has the error below. I also tried to install different versions of Spark but all have the same error. This is the second time I\'m running Spark. My previous run works fine.

\n\n
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).\nlog4j:WARN Please initialize the log4j system properly.\nlog4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.\nUsing Spark\'s repl log4j profile: org/apache/spark/log4j-defaults-repl.properties\nTo adjust logging level use sc.setLogLevel(\"INFO\")\nWelcome to\n      ____              __\n     / __/__  ___ _____/ /__\n    _\\ \\/ _ \\/ _ `/ __/  \'_/\n   /___/ .__/\\_,_/_/ /_/\\_\\   version 1.6.0\n      /_/\n\nUsing Scala version 2.10.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79)\nType in expressions to have them evaluated.\nType :help for more information.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 WARN Utils: Service \'sparkDriver\' could not bind on port 0. Attempting port 1.\n16/01/04 13:49:40 ERROR SparkContext: Error initializing SparkContext.\njava.net.BindException: Can\'t assign requested address: Service \'sparkDriver\' failed after 16 retries!\n    at sun.nio.ch.Net.bind0(Native Method)\n    at sun.nio.ch.Net.bind(Net.java:444)\n    at sun.nio.ch.Net.bind(Net.java:436)\n    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)\n    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)\n    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125)\n    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:485)\n    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1089)\n    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:430)\n    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:415)\n    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:903)\n    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:198)\n    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:348)\n    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)\n    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)\n    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)\n    at java.lang.Thread.run(Thread.java:745)\njava.net.BindException: Can\'t assign requested address: Service \'sparkDriver\' failed after 16 retries!\n    at sun.nio.ch.Net.bind0(Native Method)\n    at sun.nio.ch.Net.bind(Net.java:444)\n    at sun.nio.ch.Net.bind(Net.java:436)\n    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)\n    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)\n    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125)\n    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:485)\n    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1089)\n    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:430)\n    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:415)\n    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:903)\n    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:198)\n    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:348)\n    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)\n    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)\n    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)\n    at java.lang.Thread.run(Thread.java:745)\n\njava.lang.NullPointerException\n    at org.apache.spark.sql.SQLContext$.createListenerAndUI(SQLContext.scala:1367)\n    at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:101)\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)\n    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)\n    at org.apache.spark.repl.SparkILoop.createSQLContext(SparkILoop.scala:1028)\n    at $iwC$$iwC.<init>(<console>:15)\n    at $iwC.<init>(<console>:24)\n    at <init>(<console>:26)\n    at .<init>(<console>:30)\n    at .<clinit>(<console>)\n    at .<init>(<console>:7)\n    at .<clinit>(<console>)\n    at $print(<console>)\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n    at java.lang.reflect.Method.invoke(Method.java:606)\n    at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)\n    at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1346)\n    at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840)\n    at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871)\n    at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819)\n    at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:857)\n    at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:902)\n    at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:814)\n    at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:132)\n    at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:124)\n    at org.apache.spark.repl.SparkIMain.beQuietDuring(SparkIMain.scala:324)\n    at org.apache.spark.repl.SparkILoopInit$class.initializeSpark(SparkILoopInit.scala:124)\n    at org.apache.spark.repl.SparkILoop.initializeSpark(SparkILoop.scala:64)\n    at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1$$anonfun$apply$mcZ$sp$5.apply$mcV$sp(SparkILoop.scala:974)\n    at org.apache.spark.repl.SparkILoopInit$class.runThunks(SparkILoopInit.scala:159)\n    at org.apache.spark.repl.SparkILoop.runThunks(SparkILoop.scala:64)\n    at org.apache.spark.repl.SparkILoopInit$class.postInitialization(SparkILoopInit.scala:108)\n    at org.apache.spark.repl.SparkILoop.postInitialization(SparkILoop.scala:64)\n    at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply$mcZ$sp(SparkILoop.scala:991)\n    at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)\n    at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)\n    at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)\n    at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$process(SparkILoop.scala:945)\n    at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1059)\n    at org.apache.spark.repl.Main$.main(Main.scala:31)\n    at org.apache.spark.repl.Main.main(Main.scala)\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n    at java.lang.reflect.Method.invoke(Method.java:606)\n    at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)\n    at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)\n    at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)\n    at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)\n    at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)\n\n<console>:16: error: not found: value sqlContext\n         import sqlContext.implicits._\n                ^\n<console>:16: error: not found: value sqlContext\n         import sqlContext.sql\n
\n\n

Then I add

\n\n
export SPARK_LOCAL_IP=\"127.0.0.1\"\n
\n\n

to spark-env.sh, error changes to:

\n\n
 ERROR : No route to host\n    java.net.ConnectException: No route to host\n        at java.net.Inet6AddressImpl.isReachable0(Native Method)\n        at java.net.Inet6AddressImpl.isReachable(Inet6AddressImpl.java:77)\n        at java.net.InetAddress.isReachable(InetAddress.java:475)\n...\n<console>:10: error: not found: value sqlContext\n       import sqlContext.implicits._\n              ^\n<console>:10: error: not found: value sqlContext\n       import sqlContext.sql\n
\n',,'04/01/2016 23:09',HQ 34601582,'what is the difference between import and const and which is preferred in commonjs','

I have noticed a bit of switching between using const and import for referencing libraries in node.js applications using es6 syntax with Babel.

\n\n

What is the preferred method and what is the difference between using const and import? Assuming you may be importing the same library in many files/components.

\n\n

const

\n\n
const React = require(\'react\')\n
\n\n

import

\n\n
import React from \'react\'\n
\n\n

Here are the definitions of each but I am still not sure which to use.

\n\n

import

\n\n

The import statement is used to import functions, objects or primitives that have been exported from an external module, another script, etc.

\n\n

const

\n\n

The const declaration creates a read-only reference to a value. It does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned.

\n',,'04/01/2016 23:12',HQ 34603157,'How to get a text from SearchView?','

I need to get a text from SearchView and compare it to strings in my activity\'s ListView and show a Toast if the word in a SearchView is in my ListView. How do I do that? Here\'s my working code for the SearchView:

\n\n
MenuItem ourSearchItem = menu.findItem(R.id.menu_item_search);\n\n        SearchView sv = (SearchView) ourSearchItem.getActionView();\n\n        sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {\n            @Override\n            public boolean onQueryTextSubmit(String query) {\n                return false;\n            }\n\n            @Override\n            public boolean onQueryTextChange(String newText) {\n\n                adapter.getFilter().filter(newText);\n                }\n                return false;\n            }\n        });\n
\n',,'05/01/2016 02:14',HQ 34603355,'Android Device Monitor \"data\" folder is empty','

I have tested creating, inserting and retrieving data into my apps db, and know it works through usage of Log statements.

\n\n

However, I wish to expedite testing and use the Android Device Monitor. However, though the db exists and data is stored, when accessing below, the data folder is empty:

\n\n

\"enter

\n\n

Why would this be the case? How can this be configured to show the db file and contents?

\n',,'05/01/2016 02:40',HQ 34603388,'Should Comparable ever compare to another type?','

I\'m wondering if there\'s ever a valid use case for the following:

\n\n
class Base {}\n\nclass A implements Comparable<Base> {\n    //...\n}\n
\n\n

It seems to be a common pattern (see Collections for a number of examples) to accept a collection of type T, where T extends Comparable<? super T>.

\n\n

But it seems technically impossible to fulfill the contract of compareTo() when comparing to a base class, because there\'s no way to ensure that another class doesn\'t extend the base with a contradictory comparison. Consider the following example:

\n\n
class Base {\n    final int foo;\n    Base(int foo) {\n        this.foo = foo;\n    }\n}\n\nclass A extends Base implements Comparable<Base> {\n    A(int foo) {\n        super(foo);\n    }\n    public int compareTo(Base that) {\n        return Integer.compare(this.foo, that.foo); // sort by foo ascending\n    }\n}\n\nclass B extends Base implements Comparable<Base> {\n    B(int foo) {\n        super(foo);\n    }\n    public int compareTo(Base that) {\n        return -Integer.compare(this.foo, that.foo); // sort by foo descending\n    }\n}\n
\n\n

We have two classes extending Base using comparisons that don\'t follow a common rule (if there were a common rule, it would almost certainly be implemented in Base). Yet the following broken sort will compile:

\n\n
Collections.sort(Arrays.asList(new A(0), new B(1)));\n
\n\n

Wouldn\'t it be safer to only accept T extends Comparable<T>? Or is there some use case that would validate the wildcard?

\n',,'05/01/2016 02:43',HQ 34603680,'What is squeeze testing?','

In the talk \"Beyond DevOps: How Netflix Bridges the Gap,\" around 29:10 Josh Evans mentions squeeze testing as something that can help them understand system drift. What is squeeze testing and how is it implemented?

\n',,'05/01/2016 03:22',HQ 34603937,'Print type of variable in python3.5 on django 1.8','

I am having a hard time of determining the type of my variable since I am used on python2 and have just migrated to python3

\n\n
from django.http import HttpResponse\n\ndef myview(request):\n    x = \"Name\"\n    print (x)\n    print type(x)\n    return HttpResponse(\"Example output\")\n
\n\n

This code will throw an error because of print type(x). However if you changed that syntax line to type(x). The type does not return an output on the runserver of django.

\n',,'05/01/2016 03:59',HQ 34604439,'Reference variables and pointers','Is `int &y=x` same as `int y=&x`?\r\n\r\nAlso in the below code, why is `*s++` giving me some wrong results? I was expecting `*s` value to be 12\r\n\r\nAre `s++` and `*s++` the same?\r\n\r\n #include \r\n using namespace std;\r\n \r\n int main()\r\n {\r\n \tint p=10;\r\n \tint &q=p;\t//q is a reference variable to p\r\n \t//int r=&p;\t//error: invalid conversion from \'int*\' to \'int\'\r\n \tint *s=&p;\t//valid\r\n \tq++;\t\t\r\n \t*s++;\t\t//here even s++ works, and cout<<*s does not give 12 but some lengthy number\r\n \t\t\t\t//and cout<,'05/01/2016 04:58',LQ_EDIT 34604508,'How to create a duplicate of a stack in Java','

My teacher requested that I create a duplicate of a Stack that returns a new Stack containing the same elements and in the same order as the specified Stack.

\n\n

If I am only able to use methods that are unique to Stack, I would pop every element off the Stack and onto a que. Then I would pop from the bottom of the que onto a new Stack and return the new Stack.

\n\n

However, I figured that since Stack inherits from Vector I could just use the addAll() method from Vector!

\n\n

Here is the Java code implementation:

\n\n
public class DuplicateStack {\n\nprivate Stack backStack;\n\npublic Stack duplicateStack(Stack s) {\n    backStack.addAll(s);\n    return backStack;\n}\n
\n\n

This would seem to do all the work for me. Only problem is, I keep getting a nullPointerException when I run this in my main:

\n\n
Stack s1 = new Stack();\ns1.push(\"c\");\ns1.push(\"b\");\ns1.push(\"a\");\n\nDuplicateStack dup = new DuplicateStack();\nStack s2 = dup.duplicateStack(s1);\n\nwhile(!s2.empty())\n    System.out.println(s2.pop());\n
\n\n

The error comes from the addAll() call in my DuplicateStack class.\nSo my question is why am I getting a nullPointerException from the addAll(), and is there any way to make a duplicate copy other than using the method stated earlier (using only Stack unique methods)?

\n',,'05/01/2016 05:05',LQ_CLOSE 34604646,'whick keyword can be used to replace \"FROM\" in sql?','I am trying to bypass a waf ,and whick keyword can be used to replace \"FROM\" in sql ?',,'05/01/2016 05:19',LQ_EDIT 34605166,'Actionscript error :(','im just a beginner at this and i would really appreciate some help :)\r\nThis is my code:\r\n\r\n import flash.events.MouseEvent;\r\n import flash.display.MovieClip;\r\n \r\n var currentButton:MovieClip\r\n button1.addEventListener(MouseEvent.CLICK, mouseClick);\r\n button2.addEventListener(MouseEvent.CLICK, mouseClick);\r\n button3.addEventListener(MouseEvent.CLICK, mouseClick);\r\n button4.addEventListener(MouseEvent.CLICK, mouseClick);\r\n function mouseClick(event:MouseEvent):void {\r\n \tcurrentButton.alpha = 1;\r\n \tcurrentButton.mouseEnabled = true;\r\n \tcurrentButton = event.target as MovieClip;\r\n \ttrace(\"CLICK\");\r\n \tcurrentButton.alpha = 0.7;\r\n \tcurrentButton.mouseEnabled = false;\r\n }\r\n\r\nBut i get this error when i click on a button:\r\nTypeError: Error #1009: Cannot access a property or method of a null object reference.\r\n\tat Untitled_fla::MainTimeline/mouseClick()\r\nsorry if i didnt post this question right, im just new here\r\n',,'05/01/2016 06:03',LQ_EDIT 34605384,'What is the correct way to put multiple controls inside update panel?','

I have one registration form which contains 3 to 4 dropdown controls and 2 datepickers and now when dropdown controls value are selected(selectedindex change are fired)\nthen i dont want my page to postback.

\n\n

I have use update panel to stop this behaviour of post like below:

\n\n
<asp:UpdatePanel ID=\"UpdatePanel1\" runat=\"server\">\n        <ContentTemplate>\n\n      <\%--Update Panel for date picker\%>\n      <asp:UpdatePanel ID=\"UpdatePanelDatepicker\" runat=\"server\">\n                    <ContentTemplate>\n                      <telerik:RadDatePicker ID=\"rdpDate1\" runat=\"server\">\n                      </telerik:RadDatePicker>\n                    </ContentTemplate>\n      </asp:UpdatePanel>\n\n       <\%--Update Panel for Dropdown--\%>\n       <asp:UpdatePanel ID=\"updatepaneldata\" runat=\"server\"> \n                      <ContentTemplate>\n                     <telerik:RadComboBox ID=\"ddlCountry\" runat=\"server\">\n                      </telerik:RadComboBox>\n                    </ContentTemplate>\n      </asp:UpdatePanel>\n\n\n  </ContentTemplate>\n    </asp:UpdatePanel>\n
\n\n

So i just wanted to ask that is this correct way to put multiple controls under update panels??

\n',,'05/01/2016 06:21',HQ 34605604,'Magento Error :There has been an error processing your request ?','I changed the port of mysql 3306 to 3307 and after this localhost url not opening for Magento.\r\n \r\nException printing is disabled by default for security reasons.\r\nError log record number: 1108316134\r\n\r\na:4:{i:0;s:100:\"SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.\r\n\";i:1;s:2928:\"#0 C:\\xampp\\htdocs\\magento\\lib\\Zend\\Db\\Adapter\\Pdo\\Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()\r\n#1 C:\\xampp\\htdocs\\magento\\lib\\Varien\\Db\\Adapter\\Pdo\\Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql->_connect()\r\n#2 C:\\xampp\\htdocs\\magento\\lib\\Zend\\Db\\Adapter\\Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()\r\n#3 C:\\xampp\\htdocs\\magento\\lib\\Zend\\Db\\Adapter\\Pdo\\Abstract.php(238): Zend_Db_Adapter_Abstract->query(\'SET NAMES utf8\', Array)\r\n#4 C:\\xampp\\htdocs\\magento\\lib\\Varien\\Db\\Adapter\\Pdo\\Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query(\'SET NAMES utf8\', Array)\r\n#5 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query(\'SET NAMES utf8\')\r\n#6 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Resource.php(110): Mage_Core_Model_Resource->_newConnection(\'pdo_mysql\', Object(Mage_Core_Model_Config_Element))\r\n#7 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Resource\\Db\\Abstract.php(320): Mage_Core_Model_Resource->getConnection(\'core_write\')\r\n#8 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Resource\\Db\\Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection(\'write\')\r\n#9 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Resource\\Db\\Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()\r\n#10 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Resource\\Db\\Abstract.php(360): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()\r\n#11 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Resource\\Db\\Collection\\Abstract.php(134): Mage_Core_Model_Resource_Db_Abstract->getReadConnection()\r\n#12 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Config.php(1348): Mage_Core_Model_Resource_Db_Collection_Abstract->__construct(Object(Mage_Core_Model_Resource_Website))\r\n#13 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Config.php(1380): Mage_Core_Model_Config->getModelInstance(\'core_resource/w...\', Object(Mage_Core_Model_Resource_Website))\r\n#14 C:\\xampp\\htdocs\\magento\\app\\Mage.php(491): Mage_Core_Model_Config->getResourceModelInstance(\'core/website_co...\', Object(Mage_Core_Model_Resource_Website))\r\n#15 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Abstract.php(208): Mage::getResourceModel(\'core/website_co...\', Object(Mage_Core_Model_Resource_Website))\r\n#16 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\Abstract.php(213): Mage_Core_Model_Abstract->getResourceCollection()\r\n#17 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\App.php(619): Mage_Core_Model_Abstract->getCollection()\r\n#18 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\App.php(477): Mage_Core_Model_App->_initStores()\r\n#19 C:\\xampp\\htdocs\\magento\\app\\code\\core\\Mage\\Core\\Model\\App.php(360): Mage_Core_Model_App->_initCurrentStore(\'\', \'store\')\r\n#20 C:\\xampp\\htdocs\\magento\\app\\Mage.php(684): Mage_Core_Model_App->run(Array)\r\n#21 C:\\xampp\\htdocs\\magento\\index.php(83): Mage::run(\'\', \'store\')\r\n#22 {main}\";s:3:\"url\";s:78:\"/magento/index.php/admin/dashboard/index/key/008099640c2b60fc343428e925bb560f/\";s:11:\"script_name\";s:18:\"/magento/index.php\";}',,'05/01/2016 06:37',LQ_EDIT 34605832,'How to Write Json Array to file using jackson','

I created a Json file where i wanted to write write java object as Array element. Im using jackson.

\n\n
    try{\n           String json;\n           String phyPath = request.getSession().getServletContext().getRealPath(\"/\");\n           String filepath = phyPath + \"resources/\" + \"data.json\";\n           File file = new File(filepath);\n           if (!file.exists()) {\n               System.out.println(\"pai nai\");\n               file.createNewFile();               \n           }  \n           json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(story);\n           Files.write(new File(filepath).toPath(), Arrays.asList(json), StandardOpenOption.APPEND);    \n    } \n
\n\n

This is not what i exactly want .it creates data like

\n\n
{\n  \"storyTitle\" : \"ttt\",\n  \"storyBody\" : \"tttt\",\n  \"storyAuthor\" : \"tttt\"\n}\n{\n  \"storyTitle\" : \"a\",\n  \"storyBody\" : \"a\",\n  \"storyAuthor\" : \"a\"\n}\n
\n\n

I just need to create a Array of Json where i add java object, data should be like this

\n\n
[{\n  \"storyTitle\" : \"ttt\",\n  \"storyBody\" : \"tttt\",\n  \"storyAuthor\" : \"tttt\"\n}\n,{\n  \"storyTitle\" : \"a\",\n  \"storyBody\" : \"a\",\n  \"storyAuthor\" : \"a\"\n}]\n
\n',,'05/01/2016 06:57',HQ 34606196,'Create a post activate script in Conda','

I\'m creating a Django web app and using Conda to manage the required packages and virtual environment. I want to set an environmental variable (the Django settings location) as soon as I activate the environment. It should also change the current directory to my project directory.

\n\n

I previously used virtualenvwrapper and I just added the commands to the postactivate script.

\n\n

How can I achieve this using Conda?

\n',,'05/01/2016 07:20',HQ 34606402,'Printing Different Paterns in Single Program','Here User enter X Coordinate, Y coordinate ,Length L,number n. if user enters n\r\n we have to print \"stright Line\" with (x,y) cordinates, if n=2 print bisecting Lines if n=3 print triangle like.... Here Length purpose is to Print Length of side is equal to L. Is there any solutions for this question please comment because it was asked me for interview?',,'05/01/2016 07:34',LQ_EDIT 34606570,'$_SERVER[\'HTTP_REFERER\'] and RewriteCond \%{HTTP_REFERER}','Some problem.\r\n\r\n.htaccess:\r\n\r\n RewriteEngine on\r\n RewriteBase /\r\n \r\n RewriteCond \%{HTTP_HOST} !^example\\.com\r\n RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]\r\n \r\n RewriteRule ^page([0-9]+).html$ index.php?page=$1\r\n \r\n RewriteRule ^p([0-9]+)-([a-zA-Z0-9_]+).html$ index.php?id_post=$1&title_post=$2\r\n RewriteRule ^([a-zA-Z0-9_\\-]+)/page([0-9]+).html$ index.php?mpoint=$1&page=$2 [L]\r\n RewriteRule ^([a-zA-Z0-9_\\-]+).html$ index.php?mpoint=$1\r\n RewriteRule ^.*.html$ index.php?mpoint=$1\r\n \r\n \r\n RewriteCond \%{HTTP_REFERER} ^www.example111.com$ [NC,OR]\r\n RewriteCond \%{HTTP_REFERER} ^example222.ml$ \r\n RewriteRule .* – [F]\r\n\r\nindex.php \r\n\r\n echo $_SERVER[\'HTTP_REFERER\'];\r\n\r\nresult: http://www.example111.com/xxxx/yyy.html\r\n\r\n**Why RewriteCond dont work?**',<.htaccess>,'05/01/2016 07:46',LQ_EDIT 34606601,'How can I set different opacity of edgecolor and facecolor of a patch in Matplotlib','

I am trying to plot a set of triangles with different orientations and sizes. The inner overlapped shape is what i wanted, which is the darkest area. \nBut when I set opacity (alpha) in mpatches.RegularPolygon, the edges become transparent too. \nHow can I solve this problem?\nThank you!

\n',,'05/01/2016 07:49',HQ 34606682,'How to modify SDK manger path?','[enter image description here][1]\r\n\"Error:Cause: failed to find target with hash string \'android-19\' in: E:\\android\\android_sdk\"\r\nbut I have modified SDK path as \"E:\\android\\android_sdk_19\\Android\\Android\\sdk\",which is shown in the pic below.\r\nI changed Project structure-SDK Location as \"E:\\android\\android_sdk_19\\Android\\Android\\sdk\" too.\r\n[enter image description here][2]\r\nPlease tell me how to fix this problem,thank you!\r\n\r\n\r\n [1]: http://i.stack.imgur.com/B8hEs.png\r\n [2]: http://i.stack.imgur.com/UQZDv.png',,'05/01/2016 07:56',LQ_EDIT 34607210,'How do you add a Root element/Tag in XML using perl','I have a XML data which does not have a root element/tag. Is there a way where you can add a Root tag? This is just an example.\r\n\r\n***Example : Existing XML***\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\nNow I\'d like to add a Root tag/element to this XML using perl\r\n\r\n***What I\'m looking for***\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n**NOTE:** I\'m using XML::Simple module because the perl script is written in such and its tedious to convert to any other XML module as of now. It\'ll be great if we can get an explanation for the answer!\r\n\r\nthanks!',,'05/01/2016 08:30',LQ_EDIT 34607230,'Crashing Pointer Array C++','

Code::Blocks, Win7, C++

\n\n

Hi, I\'m creating an overview project for myself, and an integral part includes doing an Exchange Sort in descending order. I\'ve created a simple trial run to test the concept.

\n\n

Embarrassingly enough, I can\'t get past creating the array without the project crashing. This only happens when I create the array with pointers (My project\'s arrays are pointers, which is why I need this to work). The code compiles fine, but when I run it, I get a Window\'s notification that \"ArrayTest.exe has stopped working\"

\n\n

When I print out each dereferenced value, I get:

\n\n

\"The original order: 1 13 5 7 2 \"

\n\n

When I print out each value\'s address, I get:

\n\n

\"The original order: 0x28ff08 0x28ffc4 0x760c8cd5 0x6aadab61 0xfffffffe \"

\n\n

The last address showed up when using an array length of 6, and crashes as well. Am I blind to a simple error in my code, or is this a hardware issue?

\n\n
//filename ArrayTest\n#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n    int *j[5];\n    (*j)[0] = 1;\n    (*j)[1] = 13;\n    (*j)[2] = 5;\n    (*j)[3] = 7;\n    (*j)[4] = 2;\n\n    cout << \"The original order: \";\n    for (int i = 0; i < 5; i++)\n    {\n        cout << (*j)[i] << \" \";\n    }\n\n     return 0;\n}\n
\n',,'05/01/2016 08:32',LQ_CLOSE 34607877,'What document is Play Store expecting me to upload to show that I\'m not impersonating others?','

My company is currently making an Android application for a local $BigCarManufacturer dealer. We are not impersonating anyone, the application is under the name of \"$BigCarManufacturer $dealer\", and we even cooperated with some guys from $BigCarManufacturer to provide us some web services from their official website. Unfortunately, the application was immediately suspended for impersonation, and now I can only appeal the removal. When I do, I get the option to upload some documents, and the following message:

\n\n
\n

If you selected Intellectual property and impersonation or deceptive behavior above, please provide a document that proves you have the rights to use specific content, icons, images, etc.

\n
\n\n

So what exactly is expected here? The scans of the contract? In what language? The contract doesn\'t exist in English, and is pretty trivial otherwise, basically \"make an app for us, we\'ll pay you X, and use anything you need from our website\". No one was anal enough to specify individual icons, images or anything silly like that since none of those rights were transferred to us in the first place, we are merely using assets to build an app for them.

\n',,'05/01/2016 09:11',HQ 34607935,'How to work with database in asp.net','I am php web developer .now i want to work with asp.net but it\'s very difficult for me to work with databases in asp.net.I need some source link from where i can easily learn asp.net.\r\n----------------------------------\r\n-----------------------------------=\r\n ',,'05/01/2016 09:14',LQ_EDIT 34607961,'Why am I getting \"cannot convert from Dequeu to int\" error?','

I am currently trying to write my first template class as an assignment for my c++ class, but I don\'t understand why I keep getting this error:

\n\n
g++ -c main.cpp\nmain.cpp: In function ‘int main(int, char**)’:\nmain.cpp:12:14: error: cannot convert ‘Dequeu<int>’ to ‘int’ in initialization\n  int ou = i[0];\n
\n\n

main.cpp:

\n\n
#include \"main.h\"\n#include <stdio.h>\n#include <iostream>\n\nusing namespace std;\nint main (int args, char ** argc){\n\n    Dequeu<int>* i = new Dequeu<int>();\n\n    i->push_back (10);\n\n    int ou = i[0];\n\n    cout<<\"i[0]: \"<<ou<<endl;\n}\n
\n\n

with main.h:

\n\n
#include \"Dequeu.h\"\n
\n\n

dequeu.h:

\n\n
#ifndef MAIN_H\n#define MAIN_H\n#endif\n\n#include \"Node.h\"\n#include <stddef.h> //NULL\n\ntemplate<typename T>\nclass Dequeu {\npublic:\n    Dequeu();   ~Dequeu();\n\n    void push_back(T);\n\n    T &operator[] (int i) {\n        if (i<size && i>=0){\n\n            //head?\n            if (i == 0)\n                return head->value;\n            //tail?\n            if (i == size-1)\n                return tail->value;\n\n            //other:\n            Node<T>* temp = head;\n            i--;\n\n            while (i != 0 ){\n                temp = temp->next;\n                i--;\n            }\n\n            return temp->Value();\n        }\n    }\n\nprivate:\n    Node<T> * head;\n    Node<T> * tail;\n    int size;\n};\n\ntemplate<typename T>\nDequeu<T>::Dequeu() {\n    head->nullify();\n    tail->nullify();\n}\n\ntemplate<typename T>\nDequeu<T>::~Dequeu(){\n    Node<T>* temp = head;\n\n    while (temp->Next() != NULL) {\n        temp = temp->next;\n        delete(head);\n        head=temp;\n    }\n}\n\ntemplate<typename T>\nvoid Dequeu<T>::push_back(T t){\n    Node<T>* newNode;\n\n    newNode->Value(t);\n    newNode->prev = tail;\n\n    tail->next = newNode;\n    tail = newNode;\n\n    if (head == NULL)\n        head = tail;\n\n    size++;\n}\n
\n\n

and Node.h:

\n\n
#include <stddef.h> //NULL\n\ntemplate <typename T>\nclass Node {\npublic:\n    Node<T>* prev;\n    Node<T>* next;\n    T value;\n\n    Node(); ~Node();\n\n    void nullify ();\n\nprivate:\n};\n\ntemplate <typename T>\nvoid Node<T>::nullify() {\n    this->value = NULL;\n    this->next = NULL;\n    this->prev = NULL;}\n
\n\n

The last thing I tried was event just returning this->head->value without checking the input integer in operator[].

\n\n

The class is not finished yet, so don\'t wonder why there are only two functions implemented...

\n\n

Please feel free to tell me how to write this code better if you find something very bad in it, I am really bad in this.

\n',,'05/01/2016 09:16',LQ_CLOSE 34608361,'How to reset form validation on submission of the form in ANGULAR 2','

I have to reset my form along with validation. is there any method to reset the state of form from ng-dirty to ng-pristine.

\n',,'05/01/2016 09:38',HQ 34608712,'Dynamicly Button in Android studio','[dynamicly button][1]\r\n\r\n\r\n [1]: http://i.stack.imgur.com/Nnx4B.png\r\n\r\nhey guys, im trying to create an Add button that can create dynamicly button, but i have a problem in \r\nButton mybutton = new Button (this);\r\n\r\ni have no idea why \"this\" can be applied in OnClickListner.\r\nAnyone can help me please ?\r\nThanks before',,'05/01/2016 09:54',LQ_EDIT 34609572,'Is it possible to set a hostname in a Kubernetes replication controller?','

I need to set a static hostname in a Kubernetes replication controller. Docker supports it with some runtime flags, however, Kubernetes replication controllers don\'t appear to support it.\nThe environment: OS - CentOS 6.6\nApproach to use sysctl to change the variable kernel.hostname does not work for a K8s replication controller. The host name is not changed.\nUse:\nsysctl kernel.hostname\nto read the current hostname, and\nsysctl kernel.hostname=NEW_HOSTNAME

\n\n

Is it possible to set a hostname in a Kubernetes replication controller?

\n',,'05/01/2016 10:35',HQ 34609650,'How to split file in windows just like linux','

How can we split file in windows system in command prompt based on size. like linux system we use

\n\n
\"split -b 10M filename.xyz new_filename\"\n
\n',,'05/01/2016 10:39',HQ 34610133,'xUnit Equivelant of MSTest\'s Assert.Inconclusive','

What is the xUnit equivalent of the following MSTest code:

\n\n
Assert.Inconclusive(\"Reason\");\n
\n\n

This gives a yellow test result instead of the usual green or red. I want to assert that the test could not be run due to certain conditions and that the test should be re-run after those conditions have been met.

\n',,'05/01/2016 11:03',HQ 34610787,'Undefined index','

I get Undefined index: image error in this code. Can I know the exact solution? I wanna know workflow from line abc to xyz that I commented in the code using //.Thanks for your help..

\n\n
   <?php session_start();\n  include(\"config.php\");\n if(isset($_SESSION[\'name\']))\n {\nif(!$_SESSION[\'name\']==\'admin\')\n{\nheader(\"Location:login.php?id=You are not authorised to access this page unless you are administrator of this website\");\n}\n}\n?>\n <?php\n  $name=$_FILES[\'image\'][\'name\'];\n $tmp=$_FILES[\'image\'][\'tmp_name\'];\n  $err=$_FILES[\'image\'][\'error\'];\n   }\n if($err==0)\n {\n move_uploaded_file($tmp, $name);\n  //xyz}\n $category=$_POST[\'category\'];\n $title=$_POST[\'title\'];\n$image=$_FILES[\"image\"][\"name\"];\n$content=$_POST[\'content\'];\n}\n<?php\n $qry=mysql_query(\"INSERT INTO articles(title,image,content,category)VALUES(\'$title\',\'$image\',\'$content\',\'$category\')\");\nif(!$qry)\n {\ndie(\"Query Failed: \". mysql_error());\n}\nelse\n{\necho \"Article Added Successfully\";\n}\n ?>\n\n  The form code is here:\n<?php\ninclude(\"config.php\");\n$sql=mysql_query(\"select * from category\");\nif(!$sql)\n{\nmysql_error();  \n}\n?>\n<form action=\"created_article.php\" method=\"post\">\nCategory:\n<select name=\"category\">\n<?php\nwhile($row=mysql_fetch_array($sql))\n{\necho\"<option value=\'\".$row[\'category\'].\"\'>\".$row[\'category\'].\"</option>\";\n}\n?>\n</select>\nTitle:\n<input type=\"text\" name=\"title\"/>\nUpload Image:\n<input type=\"file\" name=\"image\" id=\"image\" />\nContents:\n<textarea name=\"content\" cols=\"100\" rows=\"12\" ></textarea>\n<input type=\"submit\" name=\"button\"  value=\"Submit\" />\n</form>\n
\n\n

I need help with these code, I need to make project and I\'m stuck here, so please kindly I request for your help,

\n',,'05/01/2016 11:35',LQ_CLOSE 34611077,'Save me from writing 500 lines of if/else statements in PHP?','I am in a big trouble,\r\nMe and my friend doing a mini project that.How a Person is popular in his city.\r\n\r\n**My situation**\r\nHow the algorithm should work like\r\nIf a person \"mark\" has 500 friends in his city out of 500,000.\r\n\r\n(500/500,000)*50,000 = 5\r\n\r\nSo 5 in 50,000 people Know him right.\r\n\r\nBut When friends count increase the 50,000 should decrease\r\n\r\nlike:-\r\n\r\nIf \"sam\" has 1000 friends then\r\n\r\n(1000/500,000)*25000 = 5\r\n\r\nSo 5 in 25000 people know his name\r\n\r\nYes we could implement this in if/else condition \r\nIf so then i have to write 500 lines of code.\r\n\r\nIs there is a another way to do this in PHP.\r\n\r\nHelp !\r\n\r\n\r\n\r\n',,'05/01/2016 11:51',LQ_EDIT 34611358,'get position of marker in google maps','I am trying to get the current position that mean longitude and latitude of the marker. First a marker becomes created at the users location and when the user click on the map the previous one becomes deleted and a new one becomes created at the users clickpoint. I tried it by my own with `var lat1 = markers.position.lat(); var lng1 = markers.position.lng();` but that havent work and I get with this the error message `Uncaught TypeError: Cannot read property \'lat\' of undefined`. How can I get the current position of the marker and save it in a variable?\r\n\r\n var markers = [];\r\n \r\n \t // This event listener will call addMarker() when the map is clicked.\r\n \t map.addListener(\'click\', function(event) {\r\n addMarkers(event.latLng); \t\r\n \t\t\r\n });\r\n //draw a marker at the position of the user\r\n \t addMarkers(pos);\r\n \t // Adds a marker to the map and push to the array.\r\n function addMarkers(location) {\r\n var marker = new google.maps.Marker({\r\n position: location,\r\n map: map\r\n });\r\n markers.push(marker);\r\n }\r\n // Sets the map on all markers in the array.\r\n function setMapOnAll(map) {\r\n for (var i = 0; i < markers.length; i++) {\r\n markers[i].setMap(map);\r\n }\r\n }\r\n // Removes the markers from the map, but keeps them in the array.\r\n function clearMarkers() {\r\n setMapOnAll(null);\r\n }\r\n \r\n \r\n \t// Deletes all markers in the array by removing references to them.\r\n \tfunction deleteMarkers() {\r\n \t\tclearMarkers();\r\n marker = [];\r\n }\r\n \t \r\n \r\n ',,'05/01/2016 12:08',LQ_EDIT 34611531,'Element printed shows unexpected value','

This is my code. It calls a few functions but nothing that is related to the issue.

\n\n
int main()\n{\n\n\n\n    srand((unsigned int)time(NULL)); //initializing srand\n\n    struct card *deckAr = createDeck(); //creating the struct card deck array\n\n    for (int i = 0; i < 100000; i++)\n    {\n        shuffleDeck(deckAr);\n    }\n\n\n\n        struct card *player1hand = (struct card*)malloc(sizeof(player1hand));\n        struct card *player2hand = (struct card*)malloc(sizeof(player2hand));\n        struct card *househand = (struct card*)malloc(sizeof(househand));\n\n        player1hand = (struct card*)realloc(player1hand, sizeof(player1hand) * 2);\n        player1hand[0] = deckAr[0];\n        player1hand[1] = deckAr[1];\n\n        printf(\"Card 1 \%s of \%s\\n\\n\", valueName(player1hand[0].suit), suitName(player1hand[0].suit));\n        printf(\"Card 2 \%s of \%s\\n\\n\", valueName(player1hand[1].suit), suitName(player1hand[1].suit));\n        printf(\"\%s of \%s\\n\", valueName(deckAr[0].value), suitName(deckAr[0].suit));\n\n\n    return 0;\n}\n
\n\n

Output:

\n\n
Card 1 Three of Hearts\n\nCard 2 Three of Hearts\n\nTen of Hearts\n
\n\n

Since nothing is manipulating deckAr, shouldn\'t deckAr[0] be the same as player1hand[0]?

\n',,'05/01/2016 12:17',LQ_CLOSE 34611991,'How to package a multi-architecture .NET library that targets the Universal Windows Platform?','

How do I package a Universal Windows Platform library written in C# that offers only architecture-dependent builds? For the sake of illustration, let\'s say that I have some architecture-specific code conditionally compiled in for each architecture (using #if ARM and equivalents).

\n\n

To be clear, no AnyCPU build exists for my library - only x86, x64 and ARM.

\n\n

An equivalent and potentially more common situation is one where I have a dependency on an external library that is only provided as architecture-specific builds (e.g. Win2D). To keep the context simple, let\'s assume there are no dependencies and only my own code is involved - the solution should reduce to the same thing either way.

\n\n
\n

This is a series of questions and answers that document my findings on the topic of modern NuGet package authoring, focusing especially on the changes introduced with NuGet 3. You may also be interested in some related questions:

\n \n \n
\n',,'05/01/2016 12:41',HQ 34612019,'Programmatic SchemaExport / SchemaUpdate with Hibernate 5 and Spring 4','

With Spring 4 and Hibernate 4, I was able to use Reflection to get the Hibernate Configuration object from the current environment, using this code:

\n\n
@Autowired LocalContainerEntityManagerFactoryBean lcemfb;\n\nEntityManagerFactoryImpl emf = (EntityManagerFactoryImpl) lcemfb.getNativeEntityManagerFactory();\nSessionFactoryImpl sf = emf.getSessionFactory();\nSessionFactoryServiceRegistryImpl serviceRegistry = (SessionFactoryServiceRegistryImpl) sf.getServiceRegistry();\nConfiguration cfg = null;\n\ntry {\n    Field field = SessionFactoryServiceRegistryImpl.class.getDeclaredField(\"configuration\");\n    field.setAccessible(true);\n    cfg = (Configuration) field.get(serviceRegistry);\n} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {\n    e.printStackTrace();\n}\n\nSchemaUpdate update = new SchemaUpdate(serviceRegistry, cfg);\n
\n\n

With Hibernate 5, I must use some MetadataImplementor, which doesn\'t seems to be available from any of those objects. I also tried to use MetadataSources with the serviceRegistry. But it did say that it\'s the wrong kind of ServiceRegistry.

\n\n

Is there any other way to get this working?

\n',,'05/01/2016 12:43',HQ 34612223,'Eclipse JFrame empty textField error','I\'m working on eclipse JFrame and my purpose is calculating regression analysis with 26 variables x and y.But i have a problem with textField. For example; if the user have 10 variables x and y after enter the values the other textFields remains blank because of this frame gives an error like // Exception in thread \"AWT-EventQueue-0\" java.lang.NumberFormatException: For input string: \"\" // how can ı fix it ? thanks',,'05/01/2016 12:53',LQ_EDIT 34612415,'What is \".v8flags.3.14.5.9.{Name}\"?','

I am doing a clean install of Windows 10 Professional (x64) and am noticing some peculiar files appearing in the root of my home directory, specifically I see...

\n\n

.v8flags.3.14.5.9.Ciel

\n\n

Ciel is obviously my username; I\'ve tried to do a search on this file and found very little - the best I can tell is that it relates to nodejs, which might make sense because I have Visual Studio 2015 installed.

\n\n

Can anyone else identify what this file is, and if I need to keep it?

\n',,'05/01/2016 13:02',HQ 34612816,'Adobe Air application has black bars on iPhone 6 plus','

I am having problem with my ios air app, shown in picture bellow. I can not get rid of black bars. Despite I added all launching images:

\n\n

Any advice would be great help!

\n\n

Images:

\n\n

\"launching [1]

\n\n

Iphone6 plus screen

\n\n

\"screen [2]

\n',,'05/01/2016 13:24',LQ_CLOSE 34613076,'adding delete button to a div','I am going to add a delete button to new items made. this delete button removes the item my-item from the page without affecting others.\r\n\r\nI have coded like this but I`m not sure if I`m on the right path.\r\n\r\nI`ll be glad if you can help me. :)\r\n \r\n \r\n \r\n \r\n Simple Demo\r\n \r\n \r\n \r\n \r\n \r\n\t
\r\n\t
\r\n\t

Click Me!

\r\n\t
My Text!\r\n\t
\r\n\t
\r\n\t
\r\n\t\r\n\t\r\n\t\r\n ',,'05/01/2016 13:37',LQ_EDIT 34613083,'CNAME and TXT record for same subdomain not working','

I need to add a TXT record for the subdomain test.domain.com in the zone file. In this zone file there is an existing CNAME for the same subdomain. The two records looking like this:

\n\n
test IN CNAME asdf.someotherdomain.com. \ntest IN TXT \"Some text i need to add\"\n
\n\n

But when I try to save this I get an error:

\n\n
dns_master_load: :45: test.domain.com: CNAME and other data\nzone domain.com/IN: loading from master file  failed: CNAME and other data\nzone domain.com/IN: not loaded due to errors.\nstatus: FAIL\n
\n\n

It works if I do it with different subdomains, for example:

\n\n
test IN CNAME asdf.someotherdomain.com. \ntesting IN TXT \"Some text i need to add\"\n
\n\n

I\'m not exactly the best there is when it comes to DNS. Is it not possible to have the same subdomain in this scenario? Or am I missing something?

\n\n

The servers are running bind.

\n',,'05/01/2016 13:37',HQ 34613353,'When I run it I get indentation Errors in many lines, such as line 6 and lines where I put exit(0).','from sys import exit\r\n\r\ndef gold_room():\r\n print \"This room is full of gold, How much do you take?\"\r\n\t\r\n\tnext = raw_input(\"> \")\r\n\tif \"0\" in next or \"1\" in next:\r\n\t\thow_much = int(next)\r\n\telse:\r\n\t dead(\"Man learn to type a number!\")\r\n\t\r\n\tif how_much < 50:\r\n\t print \"Nice, you\'re not greedy, you win!\"\r\n\t\texit(0)\r\n\telse:\r\n\t\tdead(\"You greedy bastard!\")\r\n\r\n\r\ndef bear_room():\r\n\tprint \"There is a bear here.\"\r\n\tprint \"The bear has a bunch of honey.\"\r\n\tprint \"The fat bear is in front of another door.\"\r\n\tprint \"How are you going to move a bear?\"\r\n\tbear_moved = False\r\n\t\r\n\twhile True:\r\n\t\tnext = raw_input(\"> \")\r\n\t\t\r\n\t\tif next == \"take honey\":\r\n\t\t\tdead(\"The bear looks at you and slaps your face off.\")\r\n\t\telif next == \"taunt bear\" and not bear_moved:\t\r\n\t\t\tprint \"The bear has moved from the door and you can go now.\"\r\n\t\t\tbear_moved = True\r\n\t\telif next == \"taunt bear\" and bear_moved:\r\n\t\t\tdead(\"The bear gets pissed off and chews your leg off.\")\r\n\t\telif next == \"open door\" and bear_moved:\t\r\n\t\t\tgold_room()\r\n\t\telse:\r\n\t\t\tprint \"I got no idea waht that means.\"\r\n\r\n\r\ndef cthulhu_room():\r\n\tprint \"Here you see the great evil Cthulhu.\"\r\n\tprint \" He, it, whatever stares at you and you go insane.\"\r\n\tprint \"Do you flee for your life or eat your head?\"\r\n\t\r\n\tnext = raw_input(\"> \")\r\n\t\r\n\tif \"flee\" in next:\r\n\t\tstart()\r\n\telif \"head\" in next:\r\n\t\tdead(\"Well that was tasty!\")\r\n\telse:\r\n\t\tcthulhu_room()\r\n\t\t\r\n\r\ndef dead(why):\r\n print why, \"Good job!\"\r\n\texit(0)\r\n\t\r\ndef start():\r\n\tprint \"You are in dark room.\"\r\n\tprint \"There is a door on your right and left.\"\r\n\tprint \"Which one do you take?\"\r\n\t\r\n\tnext = raw_input(\"> \")\r\n\t\r\n\tif next == \"left\":\r\n\t\tbear_room()\r\n\telif next == \"right\":\r\n\t\tcthulhu_room()\r\n\telse:\r\n\t\tdead(\"You stumble around the room until you starved.\")\r\n\t\t\r\n\t\t\r\nstart()\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\r\n\r\n\r\n\r\n\t\t',,'05/01/2016 13:52',LQ_EDIT 34613530,'how to connect an android application to MySQL database?','

I am developing an android application,and I have create a MySQL database in my computer,and I want to know how can I get the information in android application from the database ?

\n',,'05/01/2016 14:03',LQ_CLOSE 34613761,'detect non ascii characters in a string','

How can I detect non-ascii characters in a vector f strings in a grep like fashion. For example below I\'d like to return c(1, 3) or c(TRUE, FALSE, TRUE, FALSE):

\n\n
x <- c(\"façile test of showNonASCII(): details{\", \n    \"This is a good line\", \"This has an ümlaut in it.\", \"OK again. }\")\n
\n\n

Attempt:

\n\n
y <- tools::showNonASCII(x)\nstr(y)\np <- capture.output(tools::showNonASCII(x))\n
\n',,'05/01/2016 14:15',HQ 34613832,'Is this ER Diagram of a Bank Account correct?','> • Each customer has a name, a permanent address, and a social security\r\n> number. • Each customer can have multiple phone numbers, and the same\r\n> phone number may be shared by multiple customers. • A customer can\r\n> own multiple accounts, but each account is owned by a single customer.\r\n> • Each account has an account number, a type (such as saving,\r\n> checking, etc.), and a balance • The bank issues an account statement\r\n> for each account and mails it to its account owner every month. As\r\n> time goes on, there will be multiple statements of the same account. \r\n> • Each statement has an issued date and a statement ID. All the\r\n> statements of the same account have different statement IDs, but two\r\n> different accounts could have statements with the same statement ID. \r\n> For example, it is possible that account A has a statement with ID\r\n> ‘123\', while account B has another statement with the same ID \'123\'.\r\n\r\n[![enter image description here][1]][1]\r\n\r\nI have a few questions:\r\n\r\n(1) Can Min-Max notation be used in case of any relationships, or, just when there is an indication for that in the description?\r\n\r\n(2) Are my many-to-many relationships portrayed correctly here?\r\n\r\n(3) Could I properly portray the relationships among Account vs Account Statement vs StatementID? \r\n\r\n(4) As per my assumption, Is Account Statement really a weak entity and is `Has` really a weak relation that is dependent on Statement ID? Is issue-date a weak key?\r\n\r\n [1]: http://i.stack.imgur.com/pCyHQ.png',,'05/01/2016 14:18',LQ_EDIT 34614379,'python 2.7 : find nested keys in dictionary','I have several dictionaries , dictionary keys are tupples.\r\n\r\nKeys are always same length in each dictionary. \r\n\r\nI\'d like to find nested keys and print them .\r\n\r\ndictionaries example :\r\n\r\n dic_1 =\r\n {\r\n (u\'A_String\', u\'B_String\', u\'C_String\', u\'D_String\', u\'E_String\'): 111, \r\n (u\'A_String\', u\'B_String\', u\'C_String\', u\'D_String\' ,u\'F_String\'): 112\r\n }\r\n\r\n\r\n dic_2 = \r\n {\r\n (u\'A_String\', u\'B_String\', u\'C_String\', u\'D_String\'): 300, \r\n (u\'A_String\', u\'B_String\', u\'C_String\', u\'F_String\'): 301,\r\n }\r\n\r\n\r\n dic_3 = \r\n {\r\n (u\'A_String\', u\'B_String\', u\'C_String\'): 200, \r\n (u\'A_String\', u\'B_String\', u\'F_String\'): 201,\r\n }\r\n\r\nFirst row in dic_3 is nested in first row in dic_2 and dic_1\r\n\r\nFirst row in dic_2 is nested in first row of dic_1 \r\n\r\nI tried :\r\n \r\n for key in dic_1:\r\n print \'-\',key\r\n for k in dic_2:\r\n if k in tuple(key):\r\n print \'--\', k\r\n for i in dic_3:\r\n if i in tuple(k):\r\n print \'---\', i\r\n\r\nThank you in advance !\r\n',,'05/01/2016 14:43',LQ_EDIT 34614551,'Why Android Fragment showing incompatible?','

I going to add a fragment to an Activity . But its shows following problems . May be it\'s not compatible .Has there any solution ?

\n\n
    media/arifhasnat/1ED0E5663F78E3C1/\nAjkerDeal/CustomNavigation/MyApplication/\napp/src/main/java/navigationdrawer/arifhasnat\n/com/androidcustomnavigationdrawer/\nMainActivity.java:22: error: incompatible types:\n FragmentOne cannot be converted to Fragment\nfragmentTransaction.replace(R.id.frame_one, new FragmentOne()).commit();\n
\n\n

Here my code: Its the Main Activity where i called Fragment class

\n\n
   package navigationdrawer.arifhasnat.com.androidcustomnavigationdrawer;\n\n    import android.os.Bundle;\n\n    import android.support.v4.app.FragmentTransaction;\n    import android.support.v4.widget.DrawerLayout;\n    import android.support.v7.app.AppCompatActivity;\n    import android.widget.ListView;\n\n\n    public class MainActivity extends AppCompatActivity {\n\n        private String[] mNavigationDrawerItemTitles;\n        private DrawerLayout mDrawerLayout;\n        private ListView mDrawerList;\n\n        @Override\n        protected void onCreate(Bundle savedInstanceState) {\n            super.onCreate(savedInstanceState);\n            setContentView(R.layout.nav);\n\n\n            FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n            fragmentTransaction.replace(R.id.frame_one, new FragmentOne()).commit();\n\n\n        }\n\n    }\n
\n\n

Fragment :

\n\n
package navigationdrawer.arifhasnat.com.androidcustomnavigationdrawer;\n\nimport android.app.Fragment;\nimport android.os.Bundle;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\n/**\n * Created by arifhasnat on 1/5/16.\n */\npublic class FragmentOne extends Fragment {\n\n    @Override\n    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n        View view= inflater.inflate(R.layout.fragment1,container,false);\n        return view;\n\n\n    }\n}\n
\n',,'05/01/2016 14:52',LQ_CLOSE 34614584,'setCloseButtonIcon() method doesn\'t change default Close button','

I try to change default icon for Close Button in Chrome custom tabs (CustomTabsIntent.Builder)

\n\n

Simple code for testing:

\n\n
Bitmap closeIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);\nintentBuilder.setCloseButtonIcon(closeIcon);\n
\n\n

But nothing happens. Why? (Nexus 7, Marshmallow)

\n',,'05/01/2016 14:53',HQ 34614653,'Is the arguments object supposed to be an iterable in ES6?','

In ES6, I was trying to use the arguments object as an iterable when passed to the Set constructor. It works fine in IE11 and in Chrome 47. It does not work in Firefox 43 (throws a TypeError: arguments is not iterable). I\'ve looked through the ES6 spec and cannot really find a definition of whether the arguments object should be an iterable or not.

\n\n

Here\'s an example of what I was trying to do:

\n\n
function destroyer(arr) {\n  var removes = new Set(arguments);\n  return arr.filter(function(item) {\n    return !removes.has(item);\n  });\n}\n\n// remove items 2, 3, 5 from the passed in array\nvar result = destroyer([3, 5, 1, 2, 2], 2, 3, 5);\nlog(result);\n
\n\n

FYI, I know there are various work-arounds for this code such as copying the arguments object into a real array or using rest arguments. This question is about whether the arguments object is supposed to be an iterable or not in ES6 that can be used anywhere iterables are expected.

\n',,'05/01/2016 14:57',HQ 34614710,'Why is systemd stopping service immediately after it is started?','

I created a systemd service which should invoke a shell script, when started or on reboot.

\n\n
[Unit]\nDescription=Starts the DCCA index software\n\n[Install]\nWantedBy=multi-user.target\n\n[Service]\nExecStart=/opt/insiteone/bin/indexControl start\nExecStop=/opt/insiteone/bin/indexControl stop\n\n# Execute pre and post scripts as root\n#PermissionsStartOnly=true\nRestart=on-abort\nTimeoutSec=600\n
\n\n

Initially it kept on restarting in infinite loop as soon as it is started, but when i added the TimeoutSec option, it called the ExecStop as soon as the service was started for the first time (started, and then stopped again immediately).

\n\n

Any clue, where i am going wrong?\nP.S: indexControl is a shell script, which starts other processes.

\n',,'05/01/2016 14:59',HQ 34614772,'Change path symbols \\ to / [C++]','I have a string path to my file that I want to execute .\r\nIt is for example :\r\n\r\n E:\\folderA\\folderB\\myfile.exe\r\nIf I write this path and I try to execute file there it says that file doesn\'t exist.\r\n\r\nWhen I write it like that. Then it works.\r\n\r\n \r\n\r\n E:/folderA/folderB/myFile.exe\r\nHow do I change \\ to / ?\r\n\r\n',,'05/01/2016 15:01',LQ_EDIT 34614818,'Angular2 - root relative imports','

I have a problem with imports in angular2/typescript. I\'d like to use imports with some root like \'app/components/calendar\', instead only way I am able to use is something like:

\n\n
//app/views/order/order-view.ts\nimport {Calendar} from \'../../components/calendar \n
\n\n

where Calendar is defined like:

\n\n
//app/components/calendar.ts\nexport class Calendar {\n}\n
\n\n

and this obviously gets much worse the lower in hierarchy you go, deepest is \'../../..\' but it is still very bad and brittle. Is there any way how to use paths relative to project root?

\n\n

I am working in Visual Studio, and relative imports seem to be the only thing that makes VS able to recognize these imports.y

\n',,'05/01/2016 15:04',HQ 34615503,'Vue.js in Chrome extension','

Vue.js in Chrome extension

\n\n

Hi! I\'m trying to make a Chrome extension using Vue.js but when I write

\n\n
<input v-model=\"email\" type=\"email\" class=\"form-control\" placeholder=\"Email\">\n
\n\n

Chrome removes the v-model-part of the code and makes it

\n\n
<input type=\"email\" class=\"form-control\" placeholder=\"Email\">\n
\n\n

Is there a way to prevent this?

\n',,'05/01/2016 15:37',HQ 34615796,'pure Domain Driven Design in PHP project','

In \"PHP World\" there is a weird feeling about infrastructure layer in any DDD application (example) what I could found.

\n\n

I see many examples, when developers using Doctrine2 in infrastructure layer, use Domain entities (from Domain layer) as Doctrine2 models, puting doc comments on top on it, or mention them in config (xml, yml).\nFor instance, Big Blue Book example, this is where domain entities are located: https://github.com/codeliner/php-ddd-cargo-sample/tree/master/CargoBackend/src/Model, and as you can see it\'s highly coupled with Doctrine (look on annotations). Are they ?

\n\n

I\'ve feeling that this is wrong way.

\n\n

What I understood about DDD, is:\nRepository should make a query to persistence layer and pass result to factory to instantiate Aggregate Root entity (Domain model) properly. It means that only Factory knows how specific Aggregate Root might be instantiated, moreover there is a, so called, entities lyfe cycle. It means that not every time Domain entity should be instantiated (hydrated) via __construct.

\n\n

If I have correct feeling, then where is a good example, of proper usage Doctrine2 in DDD-like application?

\n',,'05/01/2016 15:52',LQ_CLOSE 34615898,'React Server side rendering of CSS modules','

The current practice for CSS with React components seems to be using webpack\'s style-loader to load it into the page in.

\n\n
import React, { Component } from \'react\';\nimport style from \'./style.css\';\n\nclass MyComponent extends Component {\n    render(){\n        return (\n            <div className={style.demo}>Hello world!</div>\n        );\n    }\n}\n
\n\n

By doing this the style-loader will inject a <style> element into the DOM. However, the <style> will not be in the virtual DOM and so if doing server side rendering, the <style> will be omitted. This cause the page to have FOUC.

\n\n

Is there any other methods to load CSS modules that work on both server and client side?

\n',,'05/01/2016 15:57',HQ 34616050,'How to check if a char is in the alphabet in C#','

I think the title says enough.

\n\n
void onClickSubmit(char submit)\n{\n     if(submit.//check if it is alphabetical)\n     {\n           //some code\n     }\n}\n
\n\n

how can i check if the char submit is in the alphabet?

\n',,'05/01/2016 16:04',LQ_CLOSE 34616725,'C: non-NULL terminated unsigned char *','I saw [here][1] that it isn\'t possible to find out an unsigned char * length using strlen if it isn\'t NULL terminated, since the strlen function will go over the string but won\'t find any \'\\0\', hence a run-time error. I figure that it is exactly the same for signed char *.\r\n\r\nI saw a code snippet that was doing something like `int len = sizeof(unsigned char *);` but, as I understand, it only gives the size of a pointer - word size. Is it possible to use sizeof in another way to get the result or do I have to get the length somewhere else?\r\n\r\n [1]: http://stackoverflow.com/questions/261431/how-to-find-the-length-of-unsigned-char-in-c',,'05/01/2016 16:38',LQ_EDIT 34616857,'GKMinmaxStrategist doesn\'t return any moves','

I have the following code in my main.swift:

\n\n
let strategist = GKMinmaxStrategist()\nstrategist.gameModel = position\nstrategist.maxLookAheadDepth = 1\nstrategist.randomSource = nil\n\nlet move = strategist.bestMoveForActivePlayer()\n
\n\n

...where position is an instance of my GKGameModel subclass Position. After this code is run, move is nil. bestMoveForPlayer(position.activePlayer!) also results in nil (but position.activePlayer! results in a Player object).

\n\n

However,

\n\n
let moves = position.gameModelUpdatesForPlayer(position.activePlayer!)!\n
\n\n

results in a non-empty array of possible moves. From Apple\'s documentation (about bestMoveForPlayer(_:)):

\n\n
\n

Returns nil if the player is invalid, the player is not a part of the game model, or the player has no valid moves available.

\n
\n\n

As far as I know, none of this is the case, but the function still returns nil. What could be going on here?

\n\n

If it can be of any help, here\'s my implementation of the GKGameModel protocol:

\n\n
var players: [GKGameModelPlayer]? = [Player.whitePlayer, Player.blackPlayer]\nvar activePlayer: GKGameModelPlayer? {\n    return playerToMove\n}\n\nfunc setGameModel(gameModel: GKGameModel) {\n    let position = gameModel as! Position\n    pieces = position.pieces\n    ply = position.ply\n    reloadLegalMoves()\n}\n\nfunc gameModelUpdatesForPlayer(thePlayer: GKGameModelPlayer) -> [GKGameModelUpdate]? {\n    let player = thePlayer as! Player\n    let moves = legalMoves(ofPlayer: player)\n    return moves.count > 0 ? moves : nil\n}\n\nfunc applyGameModelUpdate(gameModelUpdate: GKGameModelUpdate) {\n    let move = gameModelUpdate as! Move\n    playMove(move)\n}\n\nfunc unapplyGameModelUpdate(gameModelUpdate: GKGameModelUpdate) {\n    let move = gameModelUpdate as! Move\n    undoMove(move)\n}\n\nfunc scoreForPlayer(thePlayer: GKGameModelPlayer) -> Int {\n    let player = thePlayer as! Player\n    var score = 0\n    for (_, piece) in pieces {\n        score += piece.player == player ? 1 : -1\n    }\n    return score\n}\n\nfunc isLossForPlayer(thePlayer: GKGameModelPlayer) -> Bool {\n    let player = thePlayer as! Player\n    return legalMoves(ofPlayer: player).count == 0\n}\n\nfunc isWinForPlayer(thePlayer: GKGameModelPlayer) -> Bool {\n    let player = thePlayer as! Player\n    return isLossForPlayer(player.opponent)\n}\n\nfunc copyWithZone(zone: NSZone) -> AnyObject {\n    let copy = Position(withPieces: pieces.map({ $0.1 }), playerToMove: playerToMove)\n    copy.setGameModel(self)\n    return copy\n}\n
\n\n

If there\'s any other code I should show, let me know.

\n',,'05/01/2016 16:44',HQ 34617066,'Passing array (c++)','Code:\r\n\r\n\r\n #include \r\n #include \r\n #include \r\n #include \r\n #include \r\n #include \r\n #include \r\n using namespace std;\r\n \r\n void case1();\r\n void case2();\r\n void case3();\r\n void case4();\r\n void case5();\r\n \r\n //Global variables\r\n \r\n const int MAXROW = 5;\r\n const int MAXCOL = 5;\r\n \r\n int main()\r\n {\r\n \tchar selection;\r\n \tdo //menu\r\n \t{\r\n \t\tcout << \"\\n\\nMENU\\n\";\r\n \t\tcout << \"1. Enter array 5,5 \\n\";\r\n \t\tcout << \"2. Find max and min: \\n\";\r\n \t\tcout << \"3. Average of negatives: \\n\";\r\n \t\tcout << \"4. Product of numbers different from 0 \\n\";\r\n \t\tcout << \"5. Output: \\n\";\r\n \t\tcout << \"6. Exit.\\n\\n\";\r\n \t\tcin >> selection;\r\n \r\n \t\tswitch (selection)\r\n \t\t{\r\n \t\tcase \'1\': {\r\n \t\t\tsystem(\"cls\");\r\n \t\t\tcase1();\r\n \t\t} break;\r\n \r\n \t\tcase \'2\': {\r\n \t\t\t//system(\"cls\"); \r\n \t\t\tcase2();\r\n \t\t} break;\r\n \r\n \t\tcase \'3\': {\r\n \t\t\t//system(\"cls\"); \r\n \t\t\tcase3();\r\n \t\t} break;\r\n \r\n \t\tcase \'4\': {\r\n \t\t\t//system(\"cls\"); \r\n \t\t\tcase4();\r\n \t\t} break;\r\n \r\n \t\tcase \'5\': {\r\n \t\t\t//system(\"cls\"); \r\n \t\t\tcase5();\r\n \t\t} break;\r\n \t\t}\r\n \r\n \t} while (selection != \'6\');\r\n \r\n \treturn 0;\r\n \r\n }\r\n \r\n void case1()\r\n {\r\n \tint A[MAXROW][MAXCOL] = { 0 };\r\n \r\n \tfor (int r = 0; r < MAXROW; ++r)\r\n \t\tfor (int c = 0; c < MAXCOL; ++c) {\r\n \t\t\tcout << \"\\n A[\" << r << \"][\" << c << \"]= \";\r\n \t\t\tcin >> A[r][c];\r\n \t\t}\r\n \r\n }\r\n \r\n void case2()\r\n {\r\n \tint newarr[MAXROW + 1][MAXCOL + 1] = { 0 };\r\n \tint max[MAXCOL] = { 0 };\r\n \r\n \tfor (int r = 0; r < MAXROW; ++r) {\r\n \t\tint minr = A[r][0];\r\n \t\tfor (int c = 0; c < MAXCOL; ++c) {\r\n \t\t\tnewarr[r][c] = A[r][c];\r\n \t\t\tif (minr > A[r][c])\r\n \t\t\t\tminr = A[r][c];\r\n \r\n \t\t\tif (max[c] < A[r][c])\r\n \t\t\t\tmax[c] = A[r][c];\r\n \t\t}\r\n \t\tnewarr[r][MAXCOL] = minr;\r\n \t}\r\n \r\n \tfor (int c = 0; c < MAXCOL; ++c)\r\n \t\tnewarr[MAXROW][c] = max[c];\r\n \r\n \tfor (int r = 0; r < MAXROW + 1; ++r) {\r\n \t\tfor (int c = 0; c < MAXCOL + 1; ++c)\r\n \t\t\tnewarr[r][c] ? cout << newarr[r][c] << \"\\t\" : cout << \" \\t\";\r\n \r\n \t\tcout << \"\\n\";\r\n \t}\r\n \r\n \t{\r\n \r\n \t\t//Function to find average of negatives\r\n \t\tvoid case3();\r\n \t\t{\r\n \t\t\tint negNumber = 0;\r\n \t\t\tdouble average = 0;\r\n \r\n \t\t\tfor (int r = 0; r < 6; ++r) {\r\n \t\t\t\tfor (int c = 0; c < 6; ++c) {\r\n \t\t\t\t\tif (newarr[r][c] < 0) {\r\n \t\t\t\t\t\t++negNumber;\r\n \t\t\t\t\t\taverage += newarr[r][c];\r\n \t\t\t\t\t}\r\n \r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t\tif (negNumber > 0) {\r\n \t\t\t\taverage /= negNumber;\r\n \t\t\t\tcout << \"Average of negatives: \\n\" << average;\r\n \t\t\t}\r\n \t\t\telse\r\n \t\t\t\tcout << \"No negatives.\\n\";\r\n \r\n \r\n \t\t}\r\n \r\n \t\tvoid case4();\r\n \t\t{//Function to find product of numbers different from 0\r\n \t\t\tint count = 0;\r\n \t\t\tint product = 1;\r\n \t\t\tbool f = false;\r\n \r\n \t\t\tfor (int r = 0; r < 6; ++r)\r\n \t\t\t\tfor (int c = 0; c < 6; ++c)\r\n \t\t\t\t\tif (newarr[r][c] != 0)\r\n \t\t\t\t\t{\r\n \t\t\t\t\t\t++count;\r\n \t\t\t\t\t\tproduct *= newarr[r][c];\r\n \t\t\t\t\t\tf = true;\r\n \t\t\t\t\t}\r\n \r\n \r\n \t\t\tif (count != 0)\r\n \t\t\t\tcout << \"\\n Product of numbers different from 0 is: \\n\" << product << endl;\r\n \t\t\telse\r\n \t\t\t\tcout << \"All elements are = 0\";\r\n \r\n \t\t}\r\n \t\tvoid case5();\r\n \t\t{\r\n \t\t\tfor (int r = 0; r < MAXROW + 1; ++r) {\r\n \t\t\t\tfor (int c = 0; c < MAXCOL + 1; ++c)\r\n \t\t\t\t\tnewarr[r][c] ? cout << newarr[r][c] << \"\\t\" : cout << \" \\t\";\r\n \r\n \t\t\t\tcout << \"\\n\";\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n\r\nAs you can see in case1() is the input array. What I wonder how to use this array in all other functions(case2,case3,case4,case5). \r\nI also define several global variables but i want to put them in the function case1().\r\n\r\n(const int MAXROW = 5;\r\nconst int MAXCOL = 5;)\r\n\r\nHow will this happen? How to call them in the menu?\r\n\r\nFor now my error list is full with \"\'A\': undeclared identifier\".\r\n',,'05/01/2016 16:54',LQ_EDIT 34617157,'Is it possible to host telegram on my own server?','

Telegram is a cloud based chat service. All of their clients are open source. I was wondering if there\'s a way to host a \'private\' telegram service on my own server.

\n\n

If not, is there anything out there that can provide all or almost all features that telegram provides?

\n',,'05/01/2016 16:59',HQ 34617269,'How to use Byebug with Sidekiq and Foreman','

I have a rails application in which I use foreman to start my rails and sidekiq servers. Since foreman doesn\'t interact well with regular byebug (you can\'t see the prompt as you type), I have set up remote debugging for both my rails and sidekiq servers. This works perfectly for the rails server, but when I connect to the byebug server for the sidekiq server, I get the following:

\n\n
$ bundle exec byebug -R localhost:58501\nConnecting to byebug server localhost:58501...\nConnected.\n(byebug:ctrl)\n
\n\n

And I\'m unable to catch any byebug breakpoints.

\n\n

According to the documentation, the (byebug:ctrl) prompt means that the program has terminated normally (https://github.com/deivid-rodriguez/byebug/blob/master/GUIDE.md), but sidekiq is running jobs just fine.

\n\n

Is there something incorrect in my configuration, or is sidekiq just not compatible with byebug\'s remote debugging?

\n\n

Procfile:

\n\n
sidekiq: bundle exec sidekiq\nrails: rails server\n
\n\n

config/initializers/byebug.rb:

\n\n
if Rails.env.development?\n  require \'byebug\'\n\n  def find_available_port\n    server = TCPServer.new(nil, 0)\n    server.addr[1]\n  ensure\n    server.close if server\n  end\n\n  port = find_available_port\n\n  puts \"Starting remote debugger...\"\n  Byebug.start_server \'localhost\', port\n  puts \"Remote debugger on port #{port}\"\nend\n
\n\n

Note that when I don\'t use remote debugging, byebug functions fine with sidekiq (although in foreman I can\'t see the prompt as I type).

\n\n

Also note that I\'ve tried using Byebug.wait_connection = true before Byebug.start_server, but I have the same issue.

\n',,'05/01/2016 17:05',HQ 34618039,'How to implement bit error based on percentage in C?','

I\'m stuck at trying to simulate an Binary Symmetric Channel in C.

\n\n

It should work like this: the user enters a number (for example 0.01 = 1\%) which represents error rate. So, for instance, if i read 1001 from file every bit has a chance to change its value to 0/1 respectively depending on the entered percent.

\n\n

Reading from file and writing into another is already working, but I just don\'t know how to make these percentage-based errors happen.

\n\n

Any help is much appreciated, thanks in advance.

\n',,'05/01/2016 17:44',LQ_CLOSE 34618297,'please convert this code in c# for decode bmp file(Please help me)',' i am very poor in English and cpp also so please convert the code in c# or vb I\'m using hdr photography in my C# project, but I cannot convert this code in c++ to C#\r\n\r\n\r\n\r\n\r\n\r\n #include \"define.h\"\r\n \r\n void bmp_read(char *filename, bmp *b)\r\n {\r\n \tFILE *input = fopen(filename, \"rb\");\r\n \tif(input == NULL)\r\n \t{\r\n \t\treturn;\r\n \t}\r\n \tfread(&b->header.type, 2, 1, input);\r\n \tfread(&b->header.size, 4, 1, input);\r\n \tfread(&b->header.reserved1, 2, 1, input);\r\n \tfread(&b->header.reserved2, 2, 1, input);\r\n \tfread(&b->header.offset, 4, 1, input);\r\n \t\r\n \tfread(&b->info.size, 4, 1, input);\r\n \tfread(&b->info.width, 4, 1, input);\r\n \tfread(&b->info.height, 4, 1, input);\r\n \tfread(&b->info.planes, 2, 1, input);\r\n \tfread(&b->info.bits, 2, 1, input);\r\n \tfread(&b->info.compression, 4, 1, input);\r\n \tfread(&b->info.imagesize, 4, 1, input);\r\n \tfread(&b->info.xresolution, 4, 1, input);\r\n \tfread(&b->info.yresolution, 4, 1, input);\r\n \tfread(&b->info.ncolours, 4, 1, input);\r\n \tfread(&b->info.importantcolours, 4, 1, input);\r\n \r\n \tb->info.imagesize\t= b->info.width * b->info.height * 3;\r\n \tb->data\t\t\t\t= new unsigned char [b->info.imagesize];\r\n \tfread(b->data, b->info.imagesize, 1, input);\r\n \r\n \tfclose(input);\r\n }\r\n',,'05/01/2016 18:01',LQ_EDIT 34618504,'How can I pull down a commit from Github (Enterprise) that I don\'t have locally?','

I accidentally did a push --force on the wrong repo (too many termminals open), effectively resetting the master branch back to an earlier commit.

\n\n

Looking at my build system I can see that the commit used to point to XYZ, however I don\'t have that commit locally as I hadn\'t done a pull or fetch recently. The repo is in Github, and I can navigate in Github to view the commit, so I know it is there.

\n\n

How can I pull down the commit so I can reset master back to the right commit without having to bother the dev who pushed that change?

\n',,'05/01/2016 18:13',HQ 34618978,'how to give different file name every time i capture video and write it to file?','

I am newbee in opencv. I am working on part of the project.

\n\n

In the below code, I have used VideoWriter class to store video with name MyVideo.avi as I specified in below code.\nBut every time i capture video it stores with same name i.e it get overridden.\nSo I want to name it with computer date and time.\nplease help me to modify this

\n\n
#include \"opencv2/highgui/highgui.hpp\"\n#include <iostream>\n\nusing namespace cv;\nusing namespace std;\n\nint main(int argc, char* argv[])\n{\nVideoCapture cap(0); // open the video camera no. 0\n\nif (!cap.isOpened())  // if not success, exit program\n{\n    cout << \"ERROR: Cannot open the video file\" << endl;\n    return -1;\n}\n\nnamedWindow(\"MyVideo\",CV_WINDOW_AUTOSIZE); //create a window called \"MyVideo\"\n\n double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video\ndouble dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video\n\ncout << \"Frame Size = \" << dWidth << \"x\" << dHeight << endl;\n\nSize frameSize(static_cast<int>(dWidth), static_cast<int>(dHeight));\n\n VideoWriter oVideoWriter (\"D:/MyVideo.avi\", CV_FOURCC(\'P\',\'I\',\'M\',\'1\'), 20, frameSize, true); //initialize the VideoWriter object \n\n if ( !oVideoWriter.isOpened() ) //if not initialize the VideoWriter successfully, exit the program\n{\n    cout << \"ERROR: Failed to write the video\" << endl;\n    return -1;\n}\n\nwhile (1)\n{\n\n    Mat frame;\n\n    bool bSuccess = cap.read(frame); // read a new frame from video\n\n    if (!bSuccess) //if not success, break loop\n   {\n         cout << \"ERROR: Cannot read a frame from video file\" << endl;\n         break;\n    }\n\n     oVideoWriter.write(frame); //writer the frame into the file\n\n    imshow(\"MyVideo\", frame); //show the frame in \"MyVideo\" window\n\n    if (waitKey(10) == 27) //wait for \'esc\' key press for 30ms. If \'esc\' key is pressed, break loop\n   {\n        cout << \"esc key is pressed by user\" << endl;\n        break; \n   }\n}\n\nreturn 0;\n\n}\n
\n',,'05/01/2016 18:40',LQ_CLOSE 34619145,'Laravel: find out if variable is collection','

I want to find out if a variable is a collection.

\n\n

I can\'t use is_object() because it will be true even if it is not an collection.\nFor now I use this, and it works:

\n\n
if(is_object($images) && get_class($images) != \'Illuminate\\Database\\Eloquent\\Collection\') {\n
\n\n

But I think it\'s so ugly that I spend time asking you about another solution.

\n\n

Do you have any idea?

\n',,'05/01/2016 18:50',HQ 34619256,'Access OBDC Connection to SQL SERVER','I setup a new user with a new computer and installed MS Office. When I open the link to the access DB I get the error \"OBDC - connection to SQL Server Native Client 11.0Path/of/Accessdb\"\r\n\r\nUnfortunately I did not develop the Access DB and have no documentation on how to configure it from the developer',,'05/01/2016 18:56',LQ_EDIT 34619305,'functions calling functions python','def one_good_turn(n):\r\n return n + 1\r\n \r\ndef deserves_another(n):\r\n return n + 2\r\n\r\nI don´t quite understand when it is asked me change the body of deserves_another, so that it always adds 2 to the output of one_good_turn?',,'05/01/2016 18:59',LQ_EDIT 34619539,'Web service integration in Java','

I have created a web application, now i was asked by my professor to integrate it with another application using a provided web service.Given this is my first time working with web services, i read a lot about it(wsdl,SOAP..). But i still seem to be confused about the concept.\nI have 2 application mine and another one. The data saved in my application, needs to be saved in the second application, and i am given a wsdl file.\nI imported the file to eclipse and created the java classes of the wsdl file using Eclipse kepler.\nWhat i need is a bit clarification on how the concept in my case works? The same database should be on both sides? What do i need to do?\nAny help on clarifying this would be much appreciated.

\n',,'05/01/2016 19:15',LQ_CLOSE 34619582,'Generate a Stripe test card token for testing','

I am using Stripe in my app. I want to write an integration test for placing a payment that checks Stripe that a payment was created. I\'m using Stripe.js.

\n\n

In my test I need a card token to perform the test charge. Usually this token would be generated client side with stripe.js and sent in the request to perform the charge. As this is a server-side only test is there some way I can generate a token from within the test?

\n\n

For reference the test would be something like this (uses php but the principle is the same):

\n\n
/** @test **/\npublic function it_creates_a_charge()\n{\n    $order = factory(Order::class)->create();\n    $stripe_token = Stripe::generateToken([\n                                          \'card\' => \'4242424242424242\'\n                                          \'exp\'  => \'04/2017\',\n                                          \'cvc\'  => \'123\'\n                                          ]); // does not exist afaik\n\n    $response = $this->post(\'charges/store\', [\n                \'stripe_token\' => $stripe_token,\n                \'order_id\' => $order->id,\n                //etc\n                ]);\n\n    // assertions...\n}\n
\n\n

Essentially I\'m asking if there\'s something within the Stripe API that allows server-side token generation.

\n',,'05/01/2016 19:18',HQ 34620169,'Swap position of number in a 4 digit number without array','

in 4 digit number how to swap 1 number with 3 and 2 with 4 number\nI need to solve one problem in javascript.Thank you

\n',,'05/01/2016 19:55',LQ_CLOSE 34620317,'Asynchronous classes and its features','

Newbie in programming, I am trying to understand Asynchronous classes and the benefits. What features can be included in a class that supports such operations? With example too

\n',,'05/01/2016 20:05',LQ_CLOSE 34620469,'Safely assign value to nested hash using Hash#dig or Lonely operator(&.)','
h = {\n  data: {\n    user: {\n      value: \"John Doe\" \n    }\n  }\n}\n
\n\n

To assign value to the nested hash, we can use

\n\n
h[:data][:user][:value] = \"Bob\"\n
\n\n

However if any part in the middle is missing, it will cause error.

\n\n

Something like

\n\n
h.dig(:data, :user, :value) = \"Bob\"\n
\n\n

won\'t work, since there\'s no Hash#dig= available yet.

\n\n

To safely assign value, we can do

\n\n
h.dig(:data, :user)&.[]=(:value, \"Bob\")    # or equivalently\nh.dig(:data, :user)&.store(:value, \"Bob\")\n
\n\n

But is there better way to do that?

\n',,'05/01/2016 20:16',HQ 34620482,'C# Reading Paths From Text File Says Path Doesn\'t Exist','

I\'m developing a small command line utility to remove files from a directory. The user has the option to specify a path at the command line or have the paths being read from a text file.

\n\n

Here is a sample text input:

\n\n
C:\\Users\\MrRobot\\Desktop\\Delete\nC:\\Users\\MrRobot\\Desktop\\Erase\nC:\\Users\\MrRobot\\Desktop\\Test\n
\n\n

My Code:

\n\n
class Program\n    {\n        public static void Main(string[] args)\n        {\n\n            Console.WriteLine(\"Number of command line parameters = {0}\", args.Length);\n\n            if(args[0] == \"-tpath:\"){\n\n                    clearPath(args[1]);\n            }\n            else\n                if(args[0] == \"-treadtxt:\"){\n\n                    readFromText(args[1]);\n                }\n\n        }\n\n        public static void clearPath(string path)\n        {\n            if(Directory.Exists(path)){\n\n                int directoryCount = Directory.GetDirectories(path).Length;\n\n                if(directoryCount > 0){\n\n                    DirectoryInfo di = new DirectoryInfo(path);\n\n                    foreach (DirectoryInfo dir in di.GetDirectories())\n                    {\n                        dir.Delete(true); \n                    }\n\n                }\n                else{\n\n                    Console.WriteLine(\"No Subdirectories to Remove\");\n                }\n\n                int fileCount = Directory.GetFiles(path).Length;\n\n                if(fileCount > 0){\n\n                    System.IO.DirectoryInfo di = new DirectoryInfo(path);\n\n                    foreach (FileInfo file in di.GetFiles())\n                    {\n                            file.Delete(); \n                    }\n\n\n                }\n                else{\n\n                    Console.WriteLine(\"No Files to Remove\");\n                }\n\n                }\n            else{\n\n                Console.WriteLine(\"Path Doesn\'t Exist {0}\", path);\n            }\n        }\n\n        public static void readFromText(string pathtotext)\n        {\n                try\n                {   // Open the text file using a stream reader.\n                    using (StreamReader sr = new StreamReader(pathtotext))\n                    {\n                        // Read the stream to a string, and write the string to the console.\n                        string line = sr.ReadToEnd();\n                        clearPath(line);\n                    }\n                }\n                catch (Exception e)\n                {\n                    Console.WriteLine(\"The file could not be read:\");\n                    Console.WriteLine(e.Message);\n                }\n\n        }\n\n    }\n}\n
\n\n

My Problem:

\n\n

When reading from the text file, it says that the first path doesn\'t exist, and prints all the paths to the prompt, despite that I have no Console.WriteLine(). However, if I plug these same paths and call -tPath: it will work. My issue seems to be in the readFromText() I just can\'t seem to figure it out.

\n',,'05/01/2016 20:17',LQ_CLOSE 34620695,'Docker: what is the equivalent of the legacy --link parameter','

I need to connect my db container with my server container. Now I just red about the legacy parameter --link, which works perfect

\n\n
$> docker run -d -P --name rethinkdb1 rethinkdb\n$> docker run -d --link rethinkdb:db my-server\n
\n\n

But, if this parameter will be dropped eventually, how would I do something like the above ?

\n',,'05/01/2016 20:32',HQ 34621006,'How can a file contain null bytes?','

How is it possible that files can contain null bytes in operating systems written in a language with null-terminating strings (namely, C)?

\n\n

For example, if I run this shell code:

\n\n
$ printf \"Hello\\00, World!\" > test.txt\n$ xxd test.txt\n0000000: 4865 6c6c 6f00 2c20 576f 726c 6421       Hello., World!\n
\n\n

I see a null byte in test.txt (at least in OS X). If C uses null-terminating strings, and OS X is written in C, then how come the file isn\'t terminated at the null byte, resulting in the file containing Hello instead of Hello\\00, World!? Is there a fundamental difference between files and strings?

\n',,'05/01/2016 20:50',HQ 34621080,'Finding and removing consonants in a word: my program does not deliver the consonants','\r\nhere is my program\r\n\r\n import time\r\n print(\'hello, i am the consonants finder and i am going to find he consonants in your word\')\r\n consonants = \'b\' \'c\' \'d\' \'f\' \'g\' \'h\' \'j\' \'k\' \'l\' \'m\' \'n\' \'p\' \'q\' \'r\' \'s\' \'t\' \'v\' \'w\' \'x\' \'y\' \'z\'\r\n word = input(\'what is your word: \').lower()\r\n time.sleep(1)\r\n print(\'here is your word/s only in consonants\')\r\n time.sleep(1)\r\n print(\'Calculating\')\r\n time.sleep(1)\r\n\r\n for i in word:\r\n if i == consonants:\r\n print((i), \' is a consonant\')\r\n \r\n\r\nhere Is the output:\r\n\r\n hello, i am the consonants finder and i am going to find he consonants in your word\r\n what is your word: hello\r\n here is your word/s only in consonants\r\n Calculating\r\n>>> \r\n\r\n\r\nhow come the output does not give the consonants\r\n\r\nthis is what the output should be:\r\n\r\n hello, i am the consonants finder and i am going to find he consonants in your word\r\n what is your word: hello\r\n here is your word/s only in consonants\r\n Calculating\r\n hll\r\n',,'05/01/2016 20:55',LQ_EDIT 34621093,'Persist Elastic Search Data in Docker Container','

I have a working ES docker container running that I run like so

\n\n
docker run -p 80:9200 -p 9300:9300 --name es-loaded-with-data --privileged=true --restart=always es-loaded-with-data\n
\n\n

I loaded up ES with a bunch of test data and wanted to save it in that state so I followed up with

\n\n
docker commit containerid es-tester\ndocker save es-tester > es-tester.tar\n
\n\n

then when I load it back in the data is all gone... what gives?

\n\n
docker load < es-tester.tar\n
\n',,'05/01/2016 20:56',HQ 34621375,'DateDiff use current date if enddate is null','

I am calculating two dates and returning days but want to exclude weekends and holidays. I also want to say, if the enddate is null, then use the current date?

\n\n

How do I do that with datediff?

\n',,'05/01/2016 21:16',LQ_CLOSE 34621576,'The background music keep restarting. How to stop it.','

I create a sharedInstance of a background music and initialize it in the viewDidLoad of the first view controller. But when i change the screen (via segue) and come back to the first screen, the music restart. I believe that\'s happen because the viewDidLoad it\'s called again, but i don\'t want the music to keep restarting every time i comeback to this screen.

\n\n

How can i manage to the music keep playing without interfering?

\n',,'05/01/2016 21:31',LQ_CLOSE 34621905,'need help to solve stock market puzzle in java for max profit','need max profit. \r\n\r\nwhat i can modify to get the max profit if i can only buy once and sell once. \r\nmeans if i buy at 5 and sell at 150 then its max profit. \r\n\r\nCurrently what is have done is buy when price is less than next day ,and sell if price is more than next day. \r\n\r\nas obvious We have to keep in mind we can sell only after we buy, means sell index can not be before buy index.\r\n \r\nwhat i have done so far is : \r\n\r\n package com;\r\n \r\n public class Stock {\r\n \r\n \tpublic static void main(String[] args) {\r\n \t\t\r\n \t\tint[] prices = {20,10,70,80,5,150,67};\r\n \t\tint length = prices.length-2;\r\n \t\tint buy=0;\r\n \t\tint sell=0;\r\n \t\tint buyIndex=-1;\r\n \t\tint sellIndex=-1;\r\n \t\t\r\n \t\tint i=0;\r\n \t\tfor (i =0 ; i<=length ;i++ ){\r\n \t\t\t\r\n \t\t\t// buy logic start\r\n if(prices[i]buyIndex){\r\n \t\tbuy= prices[i];\r\n \tbuyIndex=i;\t\r\n \tSystem.out.println(\"buy\"+buy);\r\n \tSystem.out.println(\"buyIndex\"+buyIndex);\r\n \t} \t\r\n } // buy logic finish\r\n \r\n \r\n // sell logic start\r\n if(buy!=0 && i>buyIndex ){\r\n \tSystem.out.println(\"inside sell logic\");\r\n \tif(prices[i]>prices[i+1]){\r\n \t\tsell = prices[i];\r\n \t\tsellIndex = i;\r\n \t\tSystem.out.println(\"sell\"+sell);\r\n \t\tSystem.out.println(\"sellIndex\"+sellIndex);\r\n \t\t\r\n \t}\r\n } // sell logic end\r\n \t\t} // for loop end\r\n \r\n \t} // main end\r\n \r\n }\r\n\r\nout put is \r\n\r\n buy10\r\n buyIndex1\r\n buy70\r\n buyIndex2\r\n inside sell logic\r\n sell80\r\n sellIndex3\r\n buy5\r\n buyIndex4\r\n inside sell logic\r\n sell150\r\n sellIndex5\r\n\r\nPlease help. \r\n',,'05/01/2016 21:54',LQ_EDIT 34622076,'Calling an explicit constructor with a braced-init list: ambiguous or not?','

Consider the following:

\n\n
struct A {\n    A(int, int) { }\n};\n\nstruct B {\n    B(A ) { }                   // (1)\n    explicit B(int, int ) { }   // (2)\n};\n\nint main() {\n    B paren({1, 2});   // (3)\n    B brace{1, 2};     // (4)\n}\n
\n\n

The construction of brace in (4) clearly and unambiguously calls (2). On clang, the construction of paren in (3) unambiguously calls (1) where as on gcc 5.2, it fails to compile with:

\n\n
main.cpp: In function \'int main()\':\nmain.cpp:11:19: error: call of overloaded \'B(<brace-enclosed initializer list>)\' is ambiguous\n     B paren({1, 2});\n                   ^\nmain.cpp:6:5: note: candidate: B::B(A)\n     B(A ) { }  \n     ^\nmain.cpp:5:8: note: candidate: constexpr B::B(const B&)\n struct B {\n        ^\nmain.cpp:5:8: note: candidate: constexpr B::B(B&&)\n
\n\n

Which compiler is right? I suspect clang is correct here, as the ambiguity in gcc can only arise through a path that involves implicitly constructing B{1,2} and passing that to the copy/move constructor - yet that constructor is marked explicit, so such implicit construction should not be allowed.

\n',,'05/01/2016 22:06',HQ 34622082,'Why is a closing brace showing no code coverage?','

I\'ve got a Swift function for which Xcode is showing 0 passes in code coverage. The line is a closing brace (highlighted in red below).

\n\n

Is this a bug in Xcode? If not, what condition do I need to hit to run that line? I thought I was covering all paths through this method.

\n\n

\"Code

\n',,'05/01/2016 22:07',HQ 34622482,'How does ap fromMaybe compose?','

There I was, writing a function that takes a value as input, calls a function on that input, and if the result of that is Just x, it should return x; otherwise, it should return the original input.

\n\n

In other words, this function (that I didn\'t know what to call):

\n\n
foo :: (a -> Maybe a) -> a -> a\nfoo f x = fromMaybe x (f x)\n
\n\n

Since it seems like a general-purpose function, I wondered if it wasn\'t already defined, so I asked on Twitter, and Chris Allen replied that it\'s ap fromMaybe.

\n\n

That sounded promising, so I fired up GHCI and started experimenting:

\n\n
Prelude Control.Monad Data.Maybe> :type ap\nap :: Monad m => m (a -> b) -> m a -> m b\nPrelude Control.Monad Data.Maybe> :type fromMaybe\nfromMaybe :: a -> Maybe a -> a\nPrelude Control.Monad Data.Maybe> :type ap fromMaybe\nap fromMaybe :: (b -> Maybe b) -> b -> b\n
\n\n

The type of ap fromMaybe certainly looks correct, and a couple of experiments seem to indicate that it has the desired behaviour as well.

\n\n

But how does it work?

\n\n

The fromMaybe function seems clear to me, and in isolation, I think I understand what ap does - at least in the context of Maybe. When m is Maybe, it has the type Maybe (a -> b) -> Maybe a -> Maybe b.

\n\n

What I don\'t understand is how ap fromMaybe even compiles. To me, this expression looks like partial application, but I may be getting that wrong. If this is the case, however, I don\'t understand how the types match up.

\n\n

The first argument to ap is m (a -> b), but fromMaybe has the type a -> Maybe a -> a. How does that match? Which Monad instance does the compiler infer that m is? How does fromMaybe, which takes two (curried) arguments, turn into a function that takes a single argument?

\n\n

Can someone help me connect the dots?

\n',,'05/01/2016 22:34',HQ 34622755,'Select all text between quotes, parentheses etc in Atom.io','

Sublime Text has this same functionality via:

\n\n

ctrl+shift+m or cmd+shift+space

\n\n

How do I accomplish the same thing in Atom?

\n',,'05/01/2016 22:55',HQ 34623229,'webpack loaders and include','

I\'m new to webpack and I\'m trying to understand loaders as well as its properties such as test, loader, include etc.

\n\n

Here is a sample snippet of webpack.config.js that I found in google.

\n\n
module: {\n    loaders: [\n      {\n        test: /\\.js$/,\n        loader: \'babel-loader\',\n        include: [\n          path.resolve(__dirname, \'index.js\'),\n          path.resolve(__dirname, \'config.js\'),\n          path.resolve(__dirname, \'lib\'),\n          path.resolve(__dirname, \'app\'),\n          path.resolve(__dirname, \'src\')\n        ],\n        exclude: [\n          path.resolve(__dirname, \'test\', \'test.build.js\')\n        ],\n        cacheDirectory: true,\n        query: {\n          presets: [\'es2015\']\n        }\n      },\n    ]\n}\n
\n\n
    \n
  1. Am I right that test: /.js$/ will be used only for files with extension .js?

  2. \n
  3. The loader: \'babel-loader\', is the loader we install using npm

  4. \n
  5. The include: I have many questions on this. Am I right that anything we put inside the array will be transpiled? That means, index.js, config.js, and all *.js files in lib, app and src will be transpiled.

  6. \n
  7. More questions on the include: When files get transpiled, do the *.js files get concatenated into one big file?

  8. \n
  9. I think exclude is self explanatory. It will not get transpiled.

  10. \n
  11. What does query: { presets: [\'es2015\'] } do?

  12. \n
\n',,'05/01/2016 23:39',HQ 34623257,'What kind of Cloud do I need?','

There\'s a program MetaTrader4 that can run scripts.\nMy script reading data from text files (up to 3 gb) and analyse them. \nIt\'s like Excel vba script analysing sheet\'s data.\nBillions of iterations. Results of calculating stored in another txt file (up to few GBs)

\n\n
    \n
  1. Is it possible to run many instances of MetaTrader4 using cloud (Azure?)
  2. \n
  3. If no I can recode script to Delphi application is that possible for Azure or other cloud service?
  4. \n
\n\n

If so how can I do that? I have a trial in Azure but don\'t know where to start.

\n',,'05/01/2016 23:41',LQ_CLOSE 34623694,'Run code on application startup Phoenix Framework (Elixir)','

Were would you put code which you want to run only when your application/api starts in vanilla Phoenix application? Let\'s say I want to make sure some mnesia tables are created or configure my logger backend. The other thing is runtime configuration. They mention it in documentation but it\'s not clear to me where one would define/change runtime configuration.

\n\n

Endpoint.ex seems like a place where initial configuration is done but by looking at docs I can\'t find any callback that would allow me to run code only once at startup.

\n',,'06/01/2016 00:26',HQ 34624085,'Can I export a Sqlite db using RedBean PHP ORM and Import to MySQL?','

I have a simple web app that I\'ve been building using redbean PHP which has a really simple structure with three bean types:

\n\n

areas\nbuildings\npersons

\n\n

All relationships are exclusive 1:Many. So, a Person belongs to only 1 Building, and a Building belongs to 1 Area.

\n\n
Area\n  BuildingList\n    PersonList\n
\n\n

Currently, I have been developing it using Sqlite3 for ease of development, but I want to move the data to mySQL. I have a lot of data that I\'ve already added.

\n\n

Is there an easy way to use RedBean to Export ALL beans to the new MySql Database?

\n\n

I know I can search for a sqlite -> MySQL/MariaDB converter, but I also potentially want to be able to use this in reverse to make migrating the site super easy to move/backup/change DBs.

\n\n

What I\'ve tried below:

\n\n
R::setup(\'sqlite:/\' . __DIR__ . \'/data/database.db\'); \nR::addDatabase(\'mysql\', $MySqlConn );\n\n$old_datas = R::findAll( \'area\' );\nR::selectDatabase( \'mysql\' );\n\nforeach ($old_datas as $bean) {\n    $new_area = R::dispense(\'area\');\n    $new_area->importFrom( $bean );\n    $id = R::store( $new_area );\n    var_dump( $new_area ); // shows new data\n}\n\nvar_dump( R::findAll( \'area\' ) ); // returns empty array\n
\n',,'06/01/2016 01:12',HQ 34624100,'Simulate display: inline in React Native','

React Native doesn\'t support the CSS display property, and by default all elements use the behavior of display: flex (no inline-flex either). Most non-flex layouts can be simulated with flex properties, but I\'m flustered with inline text.

\n\n

My app has a container that contains several words in text, some of which need formatting. This means I need to use spans to accomplish the formatting. In order to achieve wrapping of the spans, I can set the container to use flex-wrap: wrap, but this will only allow wrapping at the end of a span rather than the traditional inline behavior of wrapping at word breaks.

\n\n

The problem visualized (spans in yellow):

\n\n

\"enter

\n\n

(via http://codepen.io/anon/pen/GoWmdm?editors=110)

\n\n

Is there a way to get proper wrapping and true inline simulation using flex properties?

\n',,'06/01/2016 01:13',HQ 34624174,'Will I be able to test this PHP?','

So I have 2 websites. One is currently hosted on a domain and one is just local on my computer (viewing it using brackets live preview).

\n\n

I used the hosted website (#1) to create a mysql database.

\n\n

Then for my local website (#2) I created a login page and created a index.php document to handle the submission. In the index.php of the local website I told it to connect to the mysql database of the hosted website.

\n\n

Then when I try to preview the local page and submit it, I get this error

\n\n

\"Cannot GET /POST?name=JohnDoe&password=123\"

\n\n

So I am wondering, since my sql database is hosted online, can I actually test my website locally or not?

\n',,'06/01/2016 01:23',LQ_CLOSE 34624363,'Django Bootstrap App differences with the normal Bootstrap','

I read in books and see in tutorials that is better to use a Django Bootstrap example:

\n\n

https://github.com/dyve/django-bootstrap-toolkit

\n\n

https://github.com/dyve/django-bootstrap3

\n\n

Over using a base template with the Original boostrap?

\n\n

But what is the difference? Which one is better?

\n',,'06/01/2016 01:47',LQ_CLOSE 34624636,'Can anyone help me with performance tuning algorithms (queries) for oracle 11g express?','

I am lost with finding examples or algorithms showing the use of performance tuning for oracle 11g express or how is it used in oracle. I have been looking at some youtube videos but most of them just mention what tuning is about and dont show any good examples or use some oracle cmd. (If this is done in oracle cmd I would want to know how to do a performance tuning process)

\n',,'06/01/2016 02:25',LQ_CLOSE 34624978,'Is there easy way to grid search without cross validation in python?','

There is absolutely helpful class GridSearchCV in scikit-learn to do grid search and cross validation, but I don\'t want to do cross validataion. I want to do grid search without cross validation and use whole data to train.\nTo be more specific, I need to evaluate my model made by RandomForestClassifier with \"oob score\" during grid search.\nIs there easy way to do it? or should I make a class by myself?

\n\n

The points are

\n\n
    \n
  • I\'d like to do grid search with easy way.
  • \n
  • I don\'t want to do cross validation.
  • \n
  • I need to use whole data to train.(don\'t want to separate to train data and test data)
  • \n
  • I need to use oob score to evaluate during grid search.
  • \n
\n',,'06/01/2016 03:09',HQ 34625089,'Python equivalent of golang\'s defer statement','

How would one implement something that works like the defer statement from go in python?

\n\n

Defer pushes a function call to a stack. When the function containing the defer statement returns, the defered function calls are popped and executed one by one, in the scope that the defer statement was inside in the first place. Defer statements look like function calls, but are not executed until they are popped.

\n\n

Go example of how it works:

\n\n
func main() {\n    fmt.Println(\"counting\")\n\n    var a *int\n    for i := 0; i < 10; i++ {\n        a = &i\n        defer fmt.Println(*a, i)\n    }\n\n    x := 42\n    a = &x\n\n    fmt.Println(\"done\")\n}\n
\n\n

Outputs:

\n\n
counting\ndone\n9 9\n8 8\n7 7\n6 6\n5 5\n4 4\n3 3\n2 2\n1 1\n0 0\n
\n\n

Go example of a usecase:

\n\n
var m sync.Mutex\nfunc someFunction() {\n    m.Lock()\n    defer m.Unlock()\n    // Whatever you want, with as many return statements as you want, wherever.\n    // Simply forget that you ever locked a mutex, or that you have to remember to release it again.\n}\n
\n',,'06/01/2016 03:21',HQ 34625720,'object twitterBootstrap is not a member of package views.html.helper','

Read from stdout: D:\\PROJECTS\\test\\SimpleRequest5\\app\\views\\products\\editProduct.scala.html:11: object twitterBootstrap is not a member of package views.html.helper\nD:\\PROJECTS\\test\\SimpleRequest5\\app\\views\\products\\editProduct.scala.html:11: object twitterBootstrap is not a member of package views.html.helper\nRead from stdout:

@Messages(\"products.form\")

\n

@Messages(\"products.form\")

\nRead from stdout: ^\n ^

\n',,'06/01/2016 04:36',LQ_CLOSE 34625829,'Change button style on press in React Native','

I\'d like the style of a button in my app to change when it is being pressed. What is the best way to do this?

\n',,'06/01/2016 04:50',HQ 34625888,'How to display date in Month and year format in R','I have a date variable which has date in \"Fri Nov 27 20:17:01 IST 2015\" format. I need to display it as NOv 2015. How can i do that in R? Please help',,'06/01/2016 04:56',LQ_EDIT 34626975,'hi, i want to format sql result in to givin format using sql server','sql result ---->\r\n\r\nid student_name class\r\n1 abc 1A \r\n2 xyz 1A \r\n3 dsk 1A\r\n4 uij 1A\r\n................. \r\n.................\r\n.................\r\n.................\r\n.................\r\nup 1000 results\r\n\r\n\r\nand i want to format data in my specific format\r\n\r\nid1 student_name1 class1 id2 student_name2 class2 id3 student_name3 class3\r\n1 abc 1A 2 abc 1A 3 abc 1A \r\n4 abc 1A 5 abc 1A 6 abc 1A\r\n7 abc 1A \r\n\r\nplease help ........\r\nas soon as posible\r\n\r\nthanks & regards\r\nravi kumar',,'06/01/2016 06:29',LQ_EDIT 34626978,'Laravel framework tutorial','

I\'m a PHP developer and want to learn php laravel framework .\nWhat is the most helpful website to learn Laravel framework ?!

\n\n

Thanks for helping 😊

\n',,'06/01/2016 06:30',LQ_CLOSE 34627900,'IE-9 giving fakepath when using input type file','

I wasn\'t able to read the file in IE-9. I am generating base64 from the url. In all the other browsers it works, except for IE-9. Can anyone please help me with this?\n I am getting c://fakepath/images.jpg in IE-9

\n\n
if((navigator.userAgent.indexOf(\"MSIE\") != -1 ) ||  !!document.documentMode == true )) //IF IE > 10\n      {\n      tmppath = $(\"#hi\").val();\n      console.log(\"only in ie\"+tmppath);\n      }\nelse{\n    var selectedFile = this.files[0];\ntmppath = URL.createObjectURL(event.target.files[0]);\nconsole.log(\"temp path other\"+tmppath);\n}\n\nconsole.log(\"temp path\"+tmppath);\n<input name=\"hello1\" type=\"file\" id=\"hi\" accept=\"image/*\"/>\n
\n',,'06/01/2016 07:37',LQ_CLOSE 34627959,'Draft refuses handshake when using java-websocket library to connect to the coinbase exchange websocket stream','

I am attempting to use the Java-Websocket library by TooTallNate to create a websocket client that receives messages from the coinbase exchange websocket stream. I am porting a program I made in Python to Java because of parallelisation bottlenecks in Python and to my knowledge I am doing things the same in Java as I did in Python. Here is my code to open the connection in Python using this websocket lib (This works as expected):

\n\n
ws = websocket.create_connection(\"wss://ws-feed.exchange.coinbase.com\", 20)\n            ws.send(json.dumps({\n            \"type\": \"subscribe\",\n            \"product_id\": \"BTC-USD\"\n        }))\n
\n\n

Here is my entire Java class:

\n\n
public class CoinbaseWebsocketClient extends WebSocketClient {\n\nprivate final Gson gson = new Gson();\n\nprivate CoinbaseWebsocketClient(URI serverURI) {\n    super(serverURI, new Draft_17());\n    connect();\n}\n\nprivate static URI uri;\nprivate static CoinbaseWebsocketClient coinbaseWebsocketClient;\n\nstatic {\n    try {\n        uri = new URI(\"wss://ws-feed.exchange.coinbase.com\");\n    } catch (URISyntaxException e) {\n        e.printStackTrace();\n    }\n}\n\nprotected static CoinbaseWebsocketClient get() {\n    if (coinbaseWebsocketClient == null) {\n        coinbaseWebsocketClient = new CoinbaseWebsocketClient(uri);\n    }\n    return coinbaseWebsocketClient;\n}\n\n@Override\npublic void onOpen(ServerHandshake serverHandshake) {\n    System.out.println(\"Websocket open\");\n    final JsonObject btcUSD_Request = new JsonObject();\n    btcUSD_Request.addProperty(\"type\", \"subscribe\");\n    btcUSD_Request.addProperty(\"product_id\", \"BTC_USD\");\n    final String requestString = gson.toJson(btcUSD_Request);\n    send(requestString);\n}\n\n@Override\npublic void onMessage(String s) {\n    System.out.println(\"Message received: \" + s);\n}\n\n@Override\npublic void onClose(int code, String reason, boolean remote) {\n    System.out.println(\"Websocket closed: \" + reason);\n}\n\n@Override\npublic void onError(Exception e) {\n    System.err.println(\"an error occurred:\" + e);\n}\n
\n\n

}

\n\n

I know there isn\'t a totally fundamental issue with my Java code because it works as expected when I use ws://echo.websocket.org as the URI instead of wss://ws-feed.exchange.coinbase.com. However when I try to connect to wss://ws-feed.exchange.coinbase.com I get this error:

\n\n
Websocket closed: draft org.java_websocket.drafts.Draft_17@7ca2fefb refuses handshake\n
\n\n

There is no authentication or anything like for this connection as far as I know (I didn\'t provide any in my Python program) so I\'m at a loss as to what the source of this error is.

\n',,'06/01/2016 07:42',HQ 34627992,'Android - Refresh An Activity , but it should not clear previous selection areas','This is code of MainActivity\r\n \r\nlanguages = (Spinner) findViewById(R.id.spin_lang);\r\n languages.setOnItemSelectedListener(new OnItemSelectedListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onItemSelected(AdapterView parent, View v,\r\n\t\t\t\t\tint pos, long id) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tif (pos==1){\r\n\t\t\t\t\tToast.makeText(getApplicationContext(), \"You Selected :\" +languages.getSelectedItem().toString(),Toast.LENGTH_SHORT).show();\r\n\t\t\t\tsetLocale(\"en\");\r\n\t\t\t\t}\r\n\t\t\t\telse if(pos ==2){\r\n\t\t\t\t\tToast.makeText(getApplicationContext(), \"You Selected :\" +languages.getSelectedItem().toString(),Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\tsetLocale(\"de\");\r\n\t\t\t\t}\r\n }\r\n @Override\r\n\t\t\tpublic void onNothingSelected(AdapterView arg0) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t});\r\n\r\nthe method created for change language.\r\n\r\npublic void setLocale(String lang){\r\n \r\n \t mylocal = new Locale(lang);\r\n \t Locale.setDefault(mylocal);\r\n \t Resources res = getResources();\r\n Configuration conf = res.getConfiguration();\r\n conf.locale = mylocal;\r\n \r\n DisplayMetrics dm = res.getDisplayMetrics();\r\n res.updateConfiguration(conf, dm);\r\n }\r\n\r\n\r\n\r\n',,'06/01/2016 07:45',LQ_EDIT 34628088,'I want to assign strings to the student constructor\'s parameters based on what is typed into the JOptionPane','I want to assign strings to the student constructor\'s parameters based on what is typed into the JOptionPane input boxes . I have the user inputted information set to go to a variable but when I try and use those variables as my Parameters for the constructor I get an error. \r\n\r\nThis is the Main\r\n\r\n import javax.swing.JOptionPane;\r\n public class main\r\n {\r\n public static void main (String [] args)\r\n {\r\n \r\n String nameinput ;\r\n String gradeinput ;\r\n String resourceinput ;\r\n String whatMissinginput;\r\n \r\n int infoComformation = 1;\r\n \r\n if ( infoComformation == 1)\r\n { nameinput =JOptionPane.showInputDialog(\"What is the students name\");\r\n gradeinput =JOptionPane.showInputDialog(\"What is the students grade\");\r\n resourceinput =JOptionPane.showInputDialog(\"What resource are you pulling the child out for \");\r\n whatMissinginput =JOptionPane.showInputDialog(\"What subject are you pulling the child out of \");\r\n infoComformation = JOptionPane.showConfirmDialog (null, \"Is this the correct informtion \\n \" \r\n +\"Name = \" + nameinput + \"\\n\" \r\n + \"Grade = \" + gradeinput + \"\\n\"\r\n +\"Resouce = \" + resourceinput + \"\\n\"\r\n +\"Subject Missing = \" + whatMissinginput );\r\n }\r\n else\r\n if (infoComformation == 0)\r\n //THIS IS WHERE THE PROBLEM IS \r\n {student pupil = new student( nameinput, gradeinput ,resourceinput,whatMissinginput); \r\n } \r\n \r\n \r\n }\r\n }\r\n\r\n\r\n\r\nHere is the Constructor Class\r\n\r\n\r\n\r\n import javax.swing.JOptionPane;\r\n public class student\r\n {\r\n\r\n \r\n \r\n public String studentinfo (String nameinput, String gradeinput , String resourceinput,String whatMissinginput )\r\n {\r\n String name =\"\" ;\r\n String grade= \"\";\r\n String resource =\"\";\r\n String whatMissing=\"\";\r\n\r\n \r\n name=nameinput;\r\n grade=gradeinput;\r\n resource=resourceinput;\r\n whatMissing=whatMissinginput ;\r\n \r\n return name+grade+resource+whatMissing;\r\n \r\n\r\n\r\n }\r\n }\r\n\r\nWhat do I Do?',,'06/01/2016 07:51',LQ_EDIT 34628957,'apache cordova game development, is it valid?','

I\'ve been developing a game using libgdx (Java), it\'s basically a super mario game, a few moving objects, some sound effects, could something like that be done with html5 and javascript?

\n\n

I tried searching the world wide web for some info, but didn\'t find a lot, I guess it\'s not common, or even possible?

\n\n

I\'m asking because I want to create non-game apps as well, and will be using apache cordova for those, would be nice to use the same language.

\n',,'06/01/2016 08:52',LQ_CLOSE 34628958,'How do i implement the algorithm below','Get a list of numbers L1, L2, L3....LN as argument\r\nAssume L1 is the largest, Largest = L1\r\nTake next number Li from the list and do the following\r\nIf Largest is less than Li\r\nLargest = Li\r\nIf Li is last number from the list then\r\nreturn Largest and come out\r\nElse repeat same process starting from step 3\r\n\r\nCreate a function prime_number that does the following\r\nTakes as parameter an integer and\r\nReturns boolean value true if the value is prime or\r\nReturns boolean value false if the value is not prime\r\n\r\n\r\nSo far my code is :\r\n\r\ndef get_algorithm_result(num_list):\r\n\r\n largest =num_list[0]\r\n \r\n for item in range(0,len(num_list)):\r\n\r\n if largest < num_list[item]:\r\n \r\n largest = num_list[item]\r\n\r\n return largest\r\n\r\n \r\ndef prime_number(integer):\r\n\r\n if integer\%2==0:\r\n return False\r\n else:\r\n return True\r\n \r\n\r\n\r\n\r\nAfter executing the code i get \r\n\"Test Spec Failed\r\n\r\nYour solution failed to pass all the tests\" \r\n\r\nwhere I\'m i going wrong because i believe my code is correct \r\n\r\n',,'06/01/2016 08:52',LQ_EDIT 34628979,'Format date with \"/\" to \"-\" with javascript','

I have this Javascript function that takes X number of days and returns a date in the past

\n\n
 var GetDateInThePastFromDays = function (days) {\n\n        var today = new Date();\n        _date = new Date(today.getFullYear(), today.getMonth(), today.getDate() - days);\n\n        return _date.toLocaleDateString();\n    }\n
\n\n

That works absolutely fine, but it returns the date as 06/01/2016 but I want it returned as 06-01-2016 but I can\'t seem to find out how to do it correctly.

\n',,'06/01/2016 08:53',LQ_CLOSE 34628999,'swift force-unwrapping exception not propagated','

I\'ve run into this silly behaviour in swift where force-unwrapping an optional does not propagate.

\n\n

From the documentation:

\n\n
\n

Trying to use ! to access a non-existent optional value triggers a runtime error. Always make sure that an optional contains a non-nil value before using ! to force-unwrap its value.

\n
\n\n

To reproduce:

\n\n
func foo(bar:String?) throws{\n    print(bar!);\n}\n
\n\n

And

\n\n
try foo(nil);\n
\n\n

This does not seem logical or consistent to me and I can\'t find any documentation on this subject.

\n\n

Is this by design?

\n',,'06/01/2016 08:54',HQ 34629085,'How to output the name in their id','I have a problem, I want that each id in the foreign key can output the name instead of their id. [Here\'s the image][1]\r\n\r\nHere\'s my code :\r\n\r\n \r\n \t\t\t\t\r\n \t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\r\n \t\t\t\t\t\r\n \t\t\t\t\r\n \t\t\t\t\t\r\n \t\t\t\t
\r\n \t\t\t\t\t\tprepare(\"SELECT * FROM student,school_year where user_type =3 AND student.syearid = school_year.syearid AND school_year.from_year like $YearNow \");\r\n \t\t\t\t\t\t$result->execute();\r\n \t\t\t\t\t\tfor($i=0; $row = $result->fetch(); $i++){\r\n \t\t\t\t\t\t?>\r\n \t\t\t\t\t
\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n //name belong\'s to their id\'s\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\t\r\n \t\t\t\t\t\r\n \t\t\t\t\t\r\n \r\n \t\t\r\n \t\t\t\r\n \t\t\t\t
IDno Lastname Firstname Department Program Action
\" > Running
\t\r\nThanks guys need a help\r\n [1]: http://i.stack.imgur.com/aOWkd.png\r\n\r\n',,'06/01/2016 08:58',LQ_EDIT 34629249,'Inject namespace experimental to std','

Is it bad or good parctice to inject namespace std::experimental into std like following?

\n\n
namespace std\n{\nnamespace experimental\n{\n}\nusing namespace experimental;    \n}\n\n#include <experimental/optional>\n\nint main()\n{\n    std::optional< int > o;\n    return 0;\n}\n
\n\n

Or even in more modern form:

\n\n
#if __has_include(<optional>)\n# include <optional>\n#elif __has_include(<experimental/optional>)\n# include <experimental/optional>\nnamespace std\n{\nusing namespace experimental;    \n}\n#else\n#error !\n#endif\n\nint main()\n{\n    std::optional< int > o;\n    return 0;\n}\n
\n\n

The intention to introduce std::experimental \"sub-namespace\" is clear because std::experimental currently contains a plenty of new libraries. I think it is very likely all them will migrate into namespace std without any substantial changes and user code written currently can rely upon this (am I totally wrong?). Otherwise all this code should be refactored to change from std::experimental:: to std:: in the future. It is not big deal, but there may be reasons not to do so.

\n\n

The question is about both production code and not-too-serious code.

\n',,'06/01/2016 09:08',HQ 34629261,'Django render_to_string() ignores {\% csrf_token \%}','

I am trying to perform unit tests in Django. I have the following form in index.html:

\n\n
<form method=POST>\n  {\% csrf_token \%}\n  <input name=itemT>\n</form>\n
\n\n

And I am testing if the view render the template correctly:

\n\n

views.py

\n\n
def homePage(request):\n    return render(request, \'index.html\')\n
\n\n

tests.py:

\n\n
request = HttpRequest()\n\nresponse = homePage(request)\nif response:\n    response = response.content.decode(\'UTF-8\')\n\nexpectedHTML = render_to_string(\'index.html\')\nself.assertEqual(response, expectedHTML)\n
\n\n

The response has a hidden input field with a csrf token; however, the expectedHTML does not (there is just a blank line at the place of {\% csrf_token \%}). So the assertion always fails.

\n\n

Is it possible to have render_to_string() generate a csrf input field? If so, would the token of response the same as that of expectedHTML?

\n\n

Or, is there any way to ignore the input field such that the test can be successful?

\n',,'06/01/2016 09:09',HQ 34629362,'C++ - create new constructor for std::vector?','

I have written a custom container class which contains a std::vector<double> instance - works nicely. For compatibility with other API\'s I would like to export the content of the container as a std::vector<double> copy . Currently this works:

\n\n
MyContainer container;\n....\nstd::vector<double> vc(container.begin(), container.end());\n
\n\n

But if possible would like to be able to write:

\n\n
MyContainer container;\n....\nstd::vector<double> vc(container);\n
\n\n

Can I (easily) create such a std::vector<double> constructor?

\n',,'06/01/2016 09:15',HQ 34629387,'Checking the value of a key in an hasmap','I would like to know how to check the value of a specific key in an hashmap, for example,\r\nif the hashmap \"map\" contains the key \"Key\" then what is the value of the key \"Key\"?',,'06/01/2016 09:17',LQ_EDIT 34629424,'how to load bitmap directly with picasso library like following','
Picasso.with(context).load(\"url\").into(imageView);\n
\n\n

Here instead of url i want bitmap how can i achieve this.\nlike below-

\n\n
Picasso.with(context).load(bitmap).into(imageView);\n
\n',,'06/01/2016 09:18',HQ 34629540,'TaskStackBuilder.addParentStack not working when I was building a notification','

I did everything as the official docs writes.But when i navigate backwards,the MainActivity(parent) doesn\'t open.Instead, the application closes.

\n\n

here is my code:

\n\n
Intent resultIntent = new Intent(context, TestActivity.class);\n\nTaskStackBuilder stackBuilder = TaskStackBuilder.create(context);\nstackBuilder.addParentStack(TestActivity.class);\nstackBuilder.addNextIntent(resultIntent);\n
\n\n

the manifest is as below:

\n\n
    <activity\n        android:name=\".MainActivity\"\n        android:label=\"@string/app_name\"\n        android:theme=\"@style/AppTheme.NoActionBar\">\n        <intent-filter>\n            <action android:name=\"android.intent.action.MAIN\" />\n\n            <category android:name=\"android.intent.category.LAUNCHER\" />\n        </intent-filter>\n    </activity>\n\n    <activity\n        android:name=\".TestActivity\"\n        android:parentActivityName=\".MainActivity\">\n        <meta-data\n            android:name=\"android.support.PARENT_ACTIVITY\"\n            android:value=\".Main2Activity\" />\n    </activity>\n
\n\n

Thank you.

\n',,'06/01/2016 09:25',HQ 34629574,'Can bash script be written inside a AWS Lambda function','

Can I write a bash script inside a Lambda function? I read in the aws docs that it can execute code written in Python, NodeJS and Java 8.

\n\n

It is mentioned in some documents that it might be possible to use Bash but there is no concrete evidence supporting it or any example

\n',,'06/01/2016 09:27',HQ 34629646,'Configure proxy settings in Notepad++ via Plugin Manager','

I would like to configure proxy settings in Notepad++ to allow downloads from the internet via a proxy. After searching how to do that from the net I understand that I need to do that in the Plugin Manager, via the Settings button. When I go to Plugins>Plugin Manager>Show Plugin Manager>Settings I get the dialog box below which does not give me any option for indicating the proxy settings. How do I get to the point that I need to indicate the proxy settings?

\n\n

\"enter

\n',,'06/01/2016 09:31',HQ 34630253,'c# adding a string to an array','

i want to simply add a string to an array, like this:

\n\n
string[] arrayName = new string[0];\n        arrayName.Add(\"raptor\");\n
\n\n

But this doesn\'t work, can someone help me?

\n',,'06/01/2016 09:59',LQ_CLOSE 34630552,'Why This Query Not Work Properly','why this query not show more than one data.even I have 10/12 data but this line only show 1.check I have limit it 3 but it show only 1\n\n$getAds=mysql_query(\"SELECT * FROM advertises WHERE status=\'RUNNING\' AND adult=\'0\' AND (country LIKE \'\%$test\%\' OR country=\'ALL\') AND (device LIKE \'\%$pabu\%\' OR device=\'ALL\') ORDER BY rand() LIMIT 0,3\");',,'06/01/2016 10:14',LQ_EDIT 34630669,'Python: ImportError: No module named \'HTMLParser\'','

I am new to Python. I have tried to ran this code but I am getting an error message for ImportError: No module named \'HTMLParser\'. I am using Python 3.x. Any reason why this is not working ?

\n\n
#Import the HTMLParser model\nfrom HTMLParser import HTMLParser\n\n#Create a subclass and override the handler methods\nclass MyHTMLParser(HTMLParser):\n\n#Function to handle the processing of HTML comments\n    def handle_comment(self,data):\n        print (\"Encountered comment: \", data)\n        pos = self.getpos()\n        print (\"At line: \", pos[0], \"position \", pos[1])\n\ndef main():\n    #Instantiate the parser and feed it some html\n    parser= MyHTMLParser()\n\n    #Open the sample file and read it\n    f = open(\"myhtml.html\")\n    if f.mode== \"r\":\n        contents= f.read()  #read the entire FileExistsError\n        parser.feed()\n\n\nif __name__== \"__main__\":\n    main()\n
\n\n

I am getting the following error:

\n\n
Traceback (most recent call last):\n  File \"C:\\Users\\bm250199\\workspace\\test\\htmlparsing.py\", line 3, in <module>\n    from HTMLParser import HTMLParser\nImportError: No module named \'HTMLParser\'\n
\n',,'06/01/2016 10:20',HQ 34630823,'IOException -> number format exception',' public static void main(String[] args)throws IOException {\r\n String s =\"12312a\";\r\n int x = Integer.parseInt(s);\r\n System.out.println (x+2);\r\n }\r\nand all what I\'ve got is :\r\n\r\nException in thread \"main\" java.lang.NumberFormatException: For input string: \"12312a\".... \r\n\r\nany hints ?',,'06/01/2016 10:28',LQ_EDIT 34631374,'Structures in C, keytab program','

I am trying to run a c program from C lang by K&R. (chapter 6. before 6.1 exercise)

\n\n

here is the code:

\n\n
#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n#define BUFSIZE 100\n\n#define MAXWORD 100\n#define NKEYS (sizeof keytab)\n\nstruct key {\n    char *word;\n    int count;\n    } keytab[] = {\n        \"auto\", 0,\n        \"break\", 0,\n        \"case\", 0,\n        \"char\", 0,\n        \"const\", 0,\n        \"continue\", 0,\n        \"default\", 0,\n        \"unsigned\", 0,\n        \"void\", 0,\n        \"volatile\", 0,\n        \"while\", 0\n    };\n\n\n\nchar buf[BUFSIZE];\nint bufp = 0;\nint getch(void);\nvoid ungetch(int);\n\n\nint getword(char *, int);\nstruct key *binsearch(char *, struct key *, int);\n\n\n\nmain()\n{\n\n\n    char word[MAXWORD];\n    struct key *p;\n    while (getword(word, MAXWORD) != EOF)\n        if (isalpha(word[0]))           \n        if ((p=binsearch(word, keytab, NKEYS)) != NULL)\n            p->count++;\n        for (p = keytab; p < keytab + NKEYS; p++)\n            if (p->count > 0)\n                printf(\"\%4d \%s\\n\", p->count, p->word);\n        return 0;\n}\n\nstruct key *binsearch(char *word, struct key *tab, int n)\n{\n    int cond;\n    struct key *low = &tab[0];\n    struct key *high = &tab[n];\n    struct key *mid;\n\n\n    while (low < high) {\n        mid = low + (high-low) / 2;\n        if ((cond = strcmp(word, mid->word)) < 0)\n            high = mid;\n        else if (cond > 0)\n            low = mid + 1;\n        else\n            return mid;\n    }\n    return NULL;\n}\n\n\nint getword(char *word, int lim)\n{\n\n    int c, getch(void);\n    void ungetch(int);\n    char *w = word;\n\n    while (isspace(c = getch()))\n        ;\n    if (c != EOF)\n        *w++ = c;\n    if (!isalpha(c)) {\n        *w = \'\\0\';\n        return c;\n    }\n    for ( ; --lim > 0; w++)\n        if (!isalnum(*w = getch())) {\n            ungetch(*w);\n            break;\n        }\n    *w = \'\\0\';\n    return word[0];\n}\n\n\nint getch(void)\n{\n      return (bufp > 0) ? buf[--bufp] : getchar();\n}\n\nvoid ungetch(int c)\n{ \n      if (bufp >= BUFSIZE)\n         printf(\"ungetch: too many characters\\n\");\n      else \n         buf[bufp++] = c;\n}\n
\n\n

I have checked the code like 10 times I cannot find any mistakes. I do understand the logic behind how the code should be working. I am using ubuntu 15.04 and I compile the code through a terminal.

\n',,'06/01/2016 10:55',LQ_CLOSE 34631634,'Oracle data types variations','

I\'m a new beginner to Oracle ,I\'m so confused about the data types .

\n\n
\n\n

I don\'t know the difference between :

\n\n
    \n
  • INT,INTEGER,NUMBER
  • \n
  • CHAR,CHAR VARYING ,CHARACTER,CHARACTER VARYING
  • \n
\n',,'06/01/2016 11:08',LQ_CLOSE 34631806,'Fail during installation of Pillow (Python module) in Linux','

I\'m trying to install Pillow (Python module) using pip, but it throws this error:

\n\n
ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting\n
\n\n

So as the error says, I tried:

\n\n
pip install pillow --global-option=\"--disable-jpeg\"\n
\n\n

But it fails with:

\n\n
error: option --disable-jpeg not recognized\n
\n\n

Any hints how to deal with it?

\n',,'06/01/2016 11:16',HQ 34631956,'Encryption in URL','

I have an URL.\nMy URL type: \"http://myweb.com/id=W5OAGejZ1HpuHri7BB1c\%2BXHSYs2c47eyJFhpmroalPXZ5SUIgeUbqu7hJUVFVwPOA0xRI3ILJVHQ5QgBwtWpE1x0\%2Fq10VVrmduMU5PiYguW1cXog4azzDvjcbb3\%2BVpMDKe5QmvjLgJ9M4TXosTYR\%2FOVzIPvXD\%2BjeTEFtIM2g6siUcPBOeK5ubQh1QYB\%2FCSbgnFsh2mpx3r\%2FXBXI09I4q\%2Be7hDSITcyIeYzFf1LoovBKotYcYSxhrZkbtIz2utl8PbpGa5G49EAwcKyossEo21dumTfkfJFoXUfmhH7amGcqbKUBOvtmhRwaMqrqoR6Vjd\%2FKBCLrszpCRXX\%2FdY6Kg0A7AUUNWdedizKCiDYdYL1IMUZ12od7HZNuHCruWPe43uhoxhjyhzx9oFl4rf6f8aM58b6KDtgiBbDwZNiICltUHq6htdzq2KwPRz8tl0WvZaaV3UC7vkfzfH\%2FsRrv\%2BB8MlsPrW6YfDOwupf0ax\%2BJjc8oy\%2BD\%2BXv53swU5\%2BS0dKQv94sgPNoQKG05oi4\%2BO7M4gcw5Otp7O6qDFv5yhYnywJD8F6CXWUmHU9WoFRGoQnwdDwoMySYsiM4jCT9aq4s08\%2Bx2m8EngPHr36aN7xJbc1yVgJUJjmCea5xCl4Hp6X3h\%2BJMvUm25jbzi9ZXOFHHsp2lboLgXY1cM0b\%2F1azWMaEgWLEXXbhIL36fC\%2FQCQTk\%2FvNnFZJLeye2LVbxBWVpyKxvC9ire1lxm0OrugnhhJle0lDFpl5O1cJwwORx2eUqwdmAJvWqh6SxBPyoxISKoIO6t4gRN\%2BWMCHrwylBTsLvVKqwHdv2ulv88a3HHpOvTWuDlUb\%2B0ADjnhAZ2jnVadSgX3r\%2FQTaWVswD4rfRTPqdzmmHmIdC\%2B\%2BmOiUuMRL9qDXei4kxfeyODgkVJ4P9yEplsB2HfVM9cHU1ks4oq8bXIRb9j\%2FqE\%2FRsEFuQs\%2FfQvBZXjEQK\%2FnUiIHJ\%2BZQcVTEPgsBPcewNjH85vc61WKd\%2B3R6mbFuY4\%2BJUdIt\%2BaUjRohUP8P7R4Bh5WWA\%2F\%2B2odAn1fT5Xkn07XCWmoE5MBBTyFRXQBU6HImYDJ2Gk95xVn65jGrs5XbsKUjYEis1MQe4N59RjA\%3D\%3D\"

\n\n

I want to need decode the line behind the id \"W5OAGejZ1HpuHri7BB.....9RjA\%3D\%3D\". I think it encryption base 64. But when I decode it, it not true. If you know about it, please tell me more info it. Thank you..

\n',,'06/01/2016 11:23',LQ_CLOSE 34632352,'How to convert String [{\"Title\":\"name\",\"Value\":\"Sam\"}, {\"Title\":\"mobile\",\"Value\":\"(606) 87-0238\"}] to Arraylist','I have String like[{\"Title\":\"name\",\"Value\":\"Sam\"}, {\"Title\":\"mobile\",\"Value\":\"(606) 87-0238\"}] want to convert it into Arraylist',,'06/01/2016 11:45',LQ_EDIT 34632845,'Relative import error with py2exe','

I was trying to generate an executable for a simple Python script. My setup.py code looks like this:

\n\n
from distutils.core import setup\nimport py2exe\nsetup(console=[\"script.py\"])\n
\n\n

However, I am getting the error shown in the screenshot. Is there something I could try to fix this? I am using Windows 10.

\n\n

\"enter

\n',,'06/01/2016 12:11',HQ 34632959,'Redirecting command output in docker','

I want to do some simple logging for my server which is a small Flask app running in a Docker container.

\n\n

Here is the Dockerfile

\n\n
# Dockerfile\nFROM dreen/flask\nMAINTAINER dreen\nWORKDIR /srv\n\n# Get source\nRUN mkdir -p /srv\nCOPY perfektimprezy.tar.gz /srv/perfektimprezy.tar.gz\nRUN tar x -f perfektimprezy.tar.gz\nRUN rm perfektimprezy.tar.gz\n\n# Run server\nEXPOSE 80\nCMD [\"python\", \"index.py\", \"1>server.log\", \"2>server.log\"]\n
\n\n

As you can see on the last line I redirect stderr and stdout to a file. Now I run this container and shell into it

\n\n
docker run -d -p 80:80 perfektimprezy\ndocker exec -it \"... id of container ...\" bash\n
\n\n

And observe the following things:

\n\n

The server is running and the website working

\n\n

There is no /srv/server.log

\n\n

ps aux | grep python yields:

\n\n
root         1  1.6  3.2  54172 16240 ?        Ss   13:43   0:00 python index.py 1>server.log 2>server.log\nroot        12  1.9  3.3 130388 16740 ?        Sl   13:43   0:00 /usr/bin/python index.py 1>server.log 2>server.log\nroot        32  0.0  0.0   8860   388 ?        R+   13:43   0:00 grep --color=auto python\n
\n\n

But there are no logs... HOWEVER, if I docker attach to the container I can see the app generating output in the console.

\n\n

How do I properly redirect stdout/err to a file when using Docker?

\n',,'06/01/2016 12:16',HQ 34633100,'OpenGL do stuff when player don\'t look','

I\'m facing this kind of problem: I would like to do something, when player isn\'t looking. For instance, like in SCP, move monster towards player. My question is: How can I check if player does see an object?

\n',<3d>,'06/01/2016 12:24',LQ_CLOSE 34633308,'How to pass parameters to AWS Lambda function','

I know that it is possible to pass parameters to a Java program running on AWS Lambda in order to test it. But I do not know how to pass those parameters if this program gets called by a schedule event.

\n\n

Does anyone know if this is possible? If yes, how?\nI was not able to find anything about it.

\n\n

Thanks in advance

\n',,'06/01/2016 12:35',HQ 34633666,'Use of class/struct to store info in R','

I\'m new to R and wanted to ask what is the best object to use when I want to have classes of data (e.g. \"Event\" class, which contains date, name, etc.).\nI don\'t need any inheritance and no method - only store these fields, and later have a list of these objects. Is class the proper object for me?\nThanks!

\n',,'06/01/2016 12:52',LQ_CLOSE 34633805,'Add Remote option not shown in PyCharm','

I am trying to set up a remote debugger with PyCharm on a Vagrant Machine. \nI am following this PyCharm tutorial. However, the Add Remote option is not available for me. Just Add local and Create VirtualEnv.

\n\n

Any idea why is this happening?

\n',,'06/01/2016 12:59',HQ 34634040,'jQuery image scrolling, selecting and lightbox-like-fx','

I have a webpage in which I need to realize something that looks like the following sketch: \"sketch\"

\n\n

As you can see, there are basically two sections:

\n\n
    \n
  • a side-block (preferably) on the right that serves as image-thumbnails scroller;
  • \n
  • a contents-block on the left (in my draw) in which there are text parts and an image that is selected from the right side-scroller.
  • \n
\n\n

Side scrolling may be achieved by a browser sidebar or (very much preferably better) by apposite up/down buttons.\n When clicking on a different image on the side-scroller that image get shown in place of the previous one.\nLast thing, clicking the image selected shall make it show in full-size (not larger than browser window anyway) with a lightbox-like-effect.

\n\n

Anyone know of a jQuery plugin that already provide all this?

\n\n

Thank you very much.

\n',,'06/01/2016 13:12',LQ_CLOSE 34634366,'Android ActionBar Backbutton Default Padding','

I am creating a custom ActionBar using a RelativeLayout with an ImageButton to the left to replace it. I have downloaded the Back icon from google\'s website to use on the ImageButton

\n\n

The problem is that I need to create a Back button to replace the original ActionBar\'s Back Button, and I need it to be exactly identical to the original ActionBar\'s back button.

\n\n

I am wondering what is the system\'s default padding for the Back button image?

\n',,'06/01/2016 13:30',HQ 34634577,'how to condense a string of numbers','
 char *s = \"1234560000000000078999\";\nunsigned int ss = strlen(s);\nvector<int> num;\nunsigned int i;\nfor (i=0;i<ss;i+=2)\n{\n    num.push_back((s[i] - \'0\')*10 + (s[i+1] - \'0\'));\n}\n
\n\n

i\'m trying to condense a string that only contains numbers and store it in a int vector \nthe idea is to take each couple of numbers int the string and combain them into one integer \nthe problem i had is with numbers that start with zero , for example 1107 only gets stored as 117 and 1100 as 110 \nthe other problem i had is with even numbers ;\nany sultions please\nthank you

\n',,'06/01/2016 13:41',LQ_CLOSE 34634637,'How can I extract price of mobile phone from different ecommerce websites in php','

How can I extract price of mobile phone from different ecommerce websites in php tell me code

\n',,'06/01/2016 13:44',LQ_CLOSE 34634659,'How to properly autostart an asp.net application in IIS10','

I\'m trying to get my ASP.NET application to automatically start whenever the application pool is running.

\n\n

As per the lots and lots of references online I have already done the following:

\n\n
    \n
  • Set the Application Pool to StartMode=AlwaysRunning
  • \n
  • Set the site in question (that belongs to beforementioned Pool) to preloadEnabled=true
  • \n
  • Install the Application Initialization feature to the Windows installation
  • \n
  • Add the <applicationInitialization> node to the web.config\'s <system.webServer> node
  • \n
\n\n

The web application is based on Owin and has a simple log4net logging statement in it\'s Startup.Configuration() method. Now when restarting IIS I see that the w3svc.exe process is running, so I know the StartMode=AlwaysRunning is working. There are however no logging messages in the log file.

\n\n

Navigating to any url (even a nonexisting one) in the application will start the app and add the log line.

\n\n

Because of the actual work that\'s done in the startup of the application I really want the application to truly preload, but I seem to be unable to get it done.

\n\n

Searching this site I have unfortunately not been able to find a solution.

\n\n

Thanks in advance.

\n',,'06/01/2016 13:45',HQ 34635269,'How to pass @Input() params to an angular 2 component created with DynamicComponentLoader','

The DynamicContentLoader docs don\'t explain how I can properly load a child component\'s inputs. Let\'s say I have a child like:

\n\n
@Component({\n  selector: \'child-component\',\n  template: \'<input type=\"text\" [(ngModel)]=\"thing.Name\" />\'\n})\nclass ChildComponent {\n  @Input() thing : any;\n}\n
\n\n

and a parent like:

\n\n
@Component({\n  selector: \'my-app\',\n  template: \'Parent (<div #child></div>)\'\n})\nclass MyApp {\n  thing : any;\n  constructor(dcl: DynamicComponentLoader, elementRef: ElementRef) {\n    dcl.loadIntoLocation(ChildComponent, elementRef, \'child\');\n  }\n}\n
\n\n

How should I go about passing thing into the child component such that the two components can be data bound against the same thing.

\n\n

I tried to do this:

\n\n
@Component({\n  selector: \'my-app\',\n  template: \'Parent (<div #child></div>)\'\n})\nclass MyApp {\n  thing : any;\n  constructor(dcl: DynamicComponentLoader, elementRef: ElementRef) {\n    dcl.loadIntoLocation(ChildComponent, elementRef, \'child\').then(ref => {\n        ref.instance.thing = this.thing;\n    });\n  }\n}\n
\n\n

It sort of works, but they are not synchronised as you would expect.

\n\n

Basically I am trying to achieve the same thing that would have been achieved by using ng-include in angular 1 where the child is a dynamically determined component and shares the model with its parent.

\n\n

Thanks in advance ...

\n',,'06/01/2016 14:15',HQ 34635588,'How do I remove outline on link click?','

When I click a link on my website it is creating an outline around the link like so

\n\n

\"enter

\n\n

I\'ve tried adding:

\n\n
a.image-link:focus { outline: 0; }\n
\n\n

and

\n\n
a {outline : none;}\n
\n\n

But nothing seems to get rid of it. Is there a way to remove it?

\n',,'06/01/2016 14:31',HQ 34636001,'iOS - How to ignore the duplicates in NSMutableArray.','

For example I have an array = [12,13,13,13,14,15,16,16,17];

\n\n

and my output will be 12,13,14,15,16,17.

\n\n

Please help me on this.

\n',,'06/01/2016 14:50',LQ_CLOSE 34636191,'unable to pass the context to the another class in android','[enter image description here][1]ServiceCalls serviceCalls = new ServiceCalls(this, \"ks\");\r\n serviceCalls.execute(requestParams);\r\n\r\n\r\n [1]: http://i.stack.imgur.com/DTjw1.png\r\n\r\nNote:pls check the image.I am not good at english.thanks in advance',,'06/01/2016 14:59',LQ_EDIT 34636423,'syntax error, unexpected end of file in ... on line 31','

I didn\'t have any code here on line 31 in this code so what do you think what\'s the problem here? :)

\n\n
<?php\n\nrequire(\'config.php\');\n\nif(isset($_POST[\'submit\'])) {\n\n$uname = mysqli_real_escape_string($con, $_POST[\'uname\']);\n$pass = mysqli_real_escape_string($con, $_POST[\'pass\']);\n\n$sql = mysqli_query($con, \"SELECT * FROM users WHERE uname = \'$uname\' AND pass = \'$pass\'\");\nif (mysqli_num_rows($sql) > 0) {\n  echo \"You are now logged in.\";\n  exit();\n}\n\n} else {\n\n  $form = <<<EOT\n  <form action=\"login.php\" method=\"POST\">\n  Username: <input type=\"text\" name=\"uname\" /></br>\n  Password: <input type=\"password\" name=\"pass\" /></br>\n  <input type=\"submit\" name=\"submit\" value=\"Log in\" />\n  </form>\n  EOT;\n  echo $form;\n}\n\n\n\n?>\n
\n\n

I think that all my brackets are fine :D

\n',,'06/01/2016 15:11',LQ_CLOSE 34636644,'Creating a Program to pick out random strings from an array','

So, i wanted to create a program that picks out simple strings from an array, it sounded pretty simple to me but then i ran into problems. Here\'s what i wrote:

\n\n
int pickjob;\nstring jobs[] = {Police Officer, Fireman, Vet, Doctor, Nurse, Chemist, Waiter};\njob1 = jobs[rand()\%7];\njob2 = jobs[rand()\%7];\njob3 = jobs[rand()\%7];\ncout << \"Here i found some jobs for you, check them out\\n1.\" << job1 << \"\\n2.\" << job2 << \"\\n3.\" << job3 << \"\\nGo Head and pick one out\" << endl;\ncin >> pickjob;\n//Rest of code is below, i\'ll put it in if you need it ;)\n
\n\n

But my problem was that everytime i ran the program the same jobs appeared everytime (Im a amaetur at C++, so if i sound stupid forgive me), so how do i make a program where it prints out diffrent jobs every time from the array.

\n',,'06/01/2016 15:21',LQ_CLOSE 34636885,'Why are Comma\'s being printed?','Worth Noting that I am New to php. A pure Beginner\r\n\r\nI have a string of names and I want to print them. I\'m using the explode function. It works, however, my commas are being printed with the names and I don\'t want that. How can I make them not print? Any other help is appricated. Also how can I make my code more efficient? \r\n\r\n $input = \'Jrew Low, Bill Wilt, Law Naw, Ing Holp\';\r\n\r\n list($fName, $lName, $fNameTwo, $lNameTwo, $fNameThree, $lNameThree, $fNameFour, $lNameFour) = explode(\' \', $formInputNames);\r\n\tif ($formInputNames == empty($fName) && empty($lName) || empty($fNameTwo) && empty($lNameTwo)){\r\n\t\techo \"No Valid Name\";\r\n\t} else {\r\n // while ($fName == empty($formInputNames)){\r\n // \techo \"something is missing\";\r\n // }\r\n \techo \"First Name: $fName
Last Name: $lName
\";\r\n\techo \"Email Address: $fName$email

\";\r\n\techo \"First Name: $fNameTwo
Last Name: $lNameTwo
\";\r\n\techo \"Email Address: $fNameTwo$email

\";\r\n\techo \"First Name: $fNameThree
Last Name: $lNameThree
\";\r\n\techo \"Email Address: $fNameThree$email

\";\r\n\techo \"First Name: $fNameFour
Last Name: $lNameFour
\";\r\n\techo \"Email Address: $fNameFour$email

\";\r\n }\r\n\r\n\r\nOutput:\r\n\r\nFirst Name: Jrew\r\n\r\nLast Name: Low,\r\n\r\n\r\n\r\n\r\nFirst Name: Bill\r\n\r\nLast Name: Wilt,\r\n\r\nFirst Name: Law\r\n\r\nLast Name: Naw,\r\n\r\nFirst Name: Ing\r\n\r\nLast Name: Holp',,'06/01/2016 15:33',LQ_EDIT 34636934,'Android Data Binding SetSupportActionBar','

Hi I wonder if there is an xml tag for this function using Android Data Binding Library or how to achieve this without findViewById() method

\n\n

Thank You

\n',,'06/01/2016 15:36',HQ 34637034,'Curl -u equivalent in HTTP request','

I\'ve been trying to plug into the Toggl API for a project, and their examples are all using CURL. I\'m trying to use the C# wrapper which causes a bad request when trying to create a report, so I thought I\'d use Postman to try a simple HTTP request.

\n\n

I can\'t seem to get the HTTP request to accept my API Token though. Here\'s the example that they give (CURL):

\n\n
curl -u my-secret-toggl-api-token:api_token -X GET \"https://www.toggl.com/reports/api/v2/project/?page=1&user_agent=devteam@example.com&workspace_id=1&project_id=2\"\n
\n\n

I\'ve tried the following HTTP request with Postman with a header called\napi_token with my token as the value:

\n\n
https://www.toggl.com/reports/api/v2/project/?user_agent=MYEMAIL@EMAIL.COM&project_id=9001&workspace_id=9001\n
\n\n

(changed ids and email of course).

\n\n

Any help on how to use the CURL -u in HTTP would be appreciated, thanks.

\n',,'06/01/2016 15:41',HQ 34637035,'Are global static variables within a file comparable to a local static variable within a function?','

I know declaring a global variable as STATIC will make it visible to the current file. Does the variable retain its data every time functions are called within the file?

\n\n

For example,

\n\n

Let\'s say some file calls func1() below, which modifies the static global variable data and then calls func2() which modifies it again.

\n\n

The next time a file calls func1(), will it be modifying a new data variable struct? or will it preserve the previous data that was modified in the first call?

\n\n
STATIC MY_DATA  Data1;\n\nvoid func1( ){\n   //modify Data1\n   func2(Data1);\n}\n\nvoid func2 (MY_DATA data){\n    // modify data \n}\n
\n',,'06/01/2016 15:41',LQ_CLOSE 34637162,'I wants to add images in repeatbox','i m new in smartface.io software.I wants to add images in repeatbox, can someone help me to add images in repeatbox.\r\n\r\nThanks \r\n',,'06/01/2016 15:48',LQ_EDIT 34637657,'It\'s possible ignore child dependency in Composer config?','

When I run composer install, it will install all my \"require\" and the \"require\" of the other package.

\n\n

My composer.json

\n\n
{\n    \"name\": \"my_app\",\n    \"require\": {\n        \"some/package\": \"0.0.0\"\n    }\n}\n
\n\n

The \"child\" dependency

\n\n
{\n    \"name\": \"some/package\",\n    \"require\": {\n        \"zendframework/zend-mail\": \"2.4.*@dev\",\n        \"soundasleep/html2text\": \"~0.2\",\n        \"mpdf/mpdf\": \"6.0.0\",\n        \"endroid/qrcode\": \"1.*@dev\"\n    }\n}\n
\n\n

I know that it\'s possible ignore the php extensions, but what about these second require package?

\n',,'06/01/2016 16:13',HQ 34637896,'gitk will not start on Mac: unknown color name \"lime\"','

I\'ve installed git on a mac via brew install git. When I try to start gitk I get the following error:

\n\n
Error in startup script: unknown color name \"lime\"\n    (processing \"-fore\" option)\n    invoked from within\n\"$ctext tag conf m2 -fore [lindex $mergecolors 2]\"\n    (procedure \"makewindow\" line 347)\n    invoked from within\n\"makewindow\"\n    (file \"/usr/local/bin/gitk\" line 12434)\n
\n\n

It appears that my Mac doesn\'t have a color named lime.

\n\n

Can I add a lime color to the environment, or is there a better fix?

\n\n

The git version is 2.7.0, and the Mac is running Yosemite 10.10.5

\n',,'06/01/2016 16:27',HQ 34638462,'Using git with ssh-agent on Windows','

I\'m on Windows. I installed git and posh-git (some helpers for Windows PowerShell). I can add keys with ssh-add and can authenticate with github and my webserver. I can also use git from the PowerShell to interact with my repositories.

\n\n

But there is one thing I can\'t do: I use git-plus for the Atom editor. And I don\'t get it to push to my repo. What is my problem?

\n',,'06/01/2016 16:55',HQ 34638895,'iOS app rejected due to copyright issues','

an app I have been working on got rejected by Apple,\nhere is the message I got from Apple when it got rejected:

\n\n

From Apple\n 22.2 - Apps that contain false, fraudulent or misleading representations or use names or icons similar to other Apps will be rejected

\n\n

22.2 Details \nYour app or its metadata contains misleading content.

\n\n

Specifically, the app screenshots and splash screen are from a well known TV show belonging to Keshet without the rights to use it.

\n\n

We’ve attached screenshot for your reference.

\n\n

Next Steps

\n\n

Please remove or revise any misleading content in your app and its metadata.

\n\n

Since your iTunes Connect Application State is Rejected, a new binary will be required. Make the desired metadata changes when you upload the new binary.

\n\n

NOTE: Please be sure to make any metadata changes to all App Localizations by selecting each specific localization and making appropriate changes.*

\n\n

some background,\nI did develop this app for Keshet with permission, but I did not include any kind of permission from Keshet when submitting.\nYes, my bad, I just didn\'t know it was required.

\n\n

Anyway, my question is,\nwould replying to Apple through the resolution center and including a document from Keshet\'s legel dept. be enough to resolve this issue?\nor do I need to go through the whole process again, submitting a new binary etc.?\nor perhaps something else?

\n\n

Also, does this kind of rejection means that every other aspect of the game I submitted is okay?\nbecause they only reacted to the rights to use Keshet\'s properties.

\n',,'06/01/2016 17:18',LQ_CLOSE 34640066,'JSON with document.getElementById()','

I\'m a little confused with this json. I can type in json manually without document.getElementById(\"anID\"); and it works fine. I keep getting unterminated string literal. Can someone show me the correct way of combining [multiple] document.getElementById() and sending them through json?

\n\n
var form = \'{\"first_name\":\"\'+document.getElementById(\"first_name\").value+\'\",\n             \"last_name\":\"\'+document.getElementById(\"last_name\").value+\'\"}\';\n\nvar form = JSON.parse(form);       \n    alert(form[\'first_name\']);\n    alert(form.last_name);\n
\n',,'06/01/2016 18:23',LQ_CLOSE 34640598,'grab all observations from a data set that are present in a second data set based on a linker ID using \%in\% function R','

So, say I have two data sets:

\n\n
d1<- data.frame(seq(1:10),rnorm(10))\ncolnames(d1) <- c(\'id\',\'x1\')\n\nd2<- data.frame(seq(3:7),rnorm(5))\ncolnames(d2) <- c(\'id\',\'x2\')\n
\n\n

Now, say I want a new dataset, d3, that is the data from d1 with values of id that are also present in d2. I\'d like to use a really simple function, something like:

\n\n
d3 <- d1[id \%in\% d2$id]\n
\n\n

Except this is printing an error for me. What is a simple one liner to accomplish this?

\n',,'06/01/2016 18:53',LQ_CLOSE 34641001,'Upcasting in java for non primitive types','Let us consider we have two classes A and B. B is a sub class for A because B extends A. If We create an instance of A Class and assign that in to a A type will contains all the properties of A. Similarly when I create an Instance of B and assign it to B type will get all the properties of B along with properties of A because it is inheriting from A. According to above lines instance of A contains properties a few as compared to properties contains to instance B. That means Instance of B is Bigger than Instance of A.\r\n As Casting should be explicit when narrowing implicit when widening. According to my theory Instance of B is bigger we are trying to store it in A type we need conversion.\r\n \r\n A a1=new (A)B();\r\n The above conversion is taking place implicitly. But my question is how it is implicit, Instance of B is bigger we are trying to convert that to small type which is A. How this is possible??? \r\n\r\nAnswer me with examples thank you in advance. ',,'06/01/2016 19:16',LQ_EDIT 34641003,'Error checking TLS connection: Error checking and/or regenerating the certs','

After I restarted my windows i cannot connect to docker machine running in Oracle Virtual Box.\nWhen i start Docker QuickStart Terminal every thing looks fine, it\'s coming up OK and it gives me this message:

\n\n
docker is configured to use the default machine with IP 192.168.99.100\nFor help getting started, check out the docs at https://docs.docker.com\n
\n\n

but when i do:

\n\n
$ docker-machine ls\nNAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER   ERRORS\ndefault   -        virtualbox   Timeout\n
\n\n

and:

\n\n
λ docker images\nAn error occurred trying to connect: Get http://localhost:2375/v1.21/images/json: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it.\n
\n\n

also when i try to reinitialize my env., i get:

\n\n
λ docker-machine env default\nError checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host \"192.168.99.100:2376\": dial tcp 192.168.99.100:2376: i/o timeout\nYou can attempt to regenerate them using \'docker-machine regenerate-certs [name]\'.\nBe advised that this will trigger a Docker daemon restart which will stop running containers.\n
\n\n

BTW, Regenerating certs also not helping.\nAny idea?

\n\n

Thanks.

\n',,'06/01/2016 19:17',HQ 34641032,'syntax error, unexpected (T_IF)','

Parse error: syntax error, unexpected \'if\' (T_IF) on line 4

\n\n

I really don\'t know what is wrong with my code or why this is happening because I am new to PHP.

\n\n

Line 4 is: if($passcheck == $mypass){

\n\n
    <?php\n    $mypass=\"DaPigeon123\";\n    $passcheck=$_POST[\"password\"]\n    if($passcheck == $mypass){\n    echo \"Welcome,\" .$_POST[\"username\"]. \"! You are now logged in.<br/>\";\n    {\n    else\n    echo \"Sorry, wrong password. <br/>\";\n    ?>\n
\n',,'06/01/2016 19:19',LQ_CLOSE 34641659,'Generic composable Ecto query w/ dynamic field name in query expression','

I\'m trying to allow for passing in a field name and running it in an Ecto query expression dynamically, like so:

\n\n
def count_distinct(query, field_name) when is_binary(field_name) do\n  query\n  |> select([x], count(Map.fetch!(x, field_name), :distinct))\nend\n
\n\n

However, I get this compilation error:

\n\n
(Ecto.Query.CompileError) `Map.fetch!(x, field_name)` is not a valid query expression\n
\n\n

Is there any way to accomplish this?

\n',,'06/01/2016 19:56',HQ 34641694,'Zip only files starting with mprm* into mprm.zip in python','

I am trying to write a code to zip files starting with mprm* to mprm.zip file. My directory has 100 different files with all different types of extension.

\n\n

As in Bash we can do

\n\n
zip -r pathtofile/mprm path2Destination/mprm*\n
\n\n

is there something in python that can achieve same?

\n\n

Thanks!

\n',,'06/01/2016 19:59',LQ_CLOSE 34642165,'This application\'s bundle identifier does not match its code signing identifier','

When I try to build and run the app on the device I get following error App installation failed: This application\'s bundle identifier does not match its code signing identifier.

\n\n

I checked the signing certificates, bundle ids, provision profile, entitlements and everything is correct.

\n\n

\"Error

\n\n

Any Ideas ?

\n',,'06/01/2016 20:29',HQ 34642506,'What is the \'1995-12-17T03:24:00\' for of a datetime called?','

I\'m trying to to create a method that returns a random date in that format in the from today to a year ago. So right now I have

\n\n
var curDate = new Date(),\n    oneYearAgo = curDate-365*24*60*60*1000, \n    randDate = new Date(Math.random() * (CurDate - OneYearAgo) + OneYearAgo);\n
\n\n

But now how do I convert that to a string like in the title? I\'m looking through https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date and can\'t figure it out because I don\'t know what the name of that format is.

\n',,'06/01/2016 20:50',LQ_CLOSE 34642595,'Tensorflow Strides Argument','

I am trying to understand the strides argument in tf.nn.avg_pool, tf.nn.max_pool, tf.nn.conv2d.

\n\n

The documentation repeatedly says

\n\n
\n

strides: A list of ints that has length >= 4. The stride of the sliding window for each dimension of the input tensor.

\n
\n\n

My questions are:

\n\n
    \n
  1. What do each of the 4+ integers represent?
  2. \n
  3. Why must they have strides[0] = strides[3] = 1 for convnets?
  4. \n
  5. In this example we see tf.reshape(_X,shape=[-1, 28, 28, 1]). Why -1?
  6. \n
\n\n

Sadly the examples in the docs for reshape using -1 don\'t translate too well to this scenario.

\n',,'06/01/2016 20:56',HQ 34642947,'How to use Domain Transform Edge-Preserving technique for Image Enhancement in Matlab','I am interested in using this Domain Transform Edge-Preserving Video filtering technique (http://inf.ufrgs.br/~eslgastal/DomainTransform/ - source code available there) for image enhancement in Matlab (2015a).\r\n\r\nAt around 3:12 on a 5-minute video (on the site linked above), they perform detail enhancement. I\'m not sure how to use the filtered image to sharpen/deblur my original image.\r\n\r\nI usually use:\r\nH = padarray(2,[2 2]) - fspecial(\'gaussian\' ,[5 5],2);\r\nsharpened = imfilter(I,H);\r\n\r\nto sharpen images, but I can\'t use imfilter with the filtered image from the edge-preserving technique (I\'ve been testing with the normalized convolution filter from the source code) that I\'m interested in.\r\n\r\nCan anyone advise me on what I can do to make use of this filtered image for sharpening/deblurring? Providing a snippet of code would be appreciated as well if possible. ',,'06/01/2016 21:17',LQ_EDIT 34643620,'How can I split my Click commands, each with a set of sub-commands, into multiple files?','

I have one large click application that I\'ve developed, but navigating through the different commands/subcommands is getting rough. How do I organize my commands into separate files? Is it possible to organize commands and their subcommands into separate classes?

\n\n

Here\'s an example of how I would like to separate it:

\n\n

init

\n\n
import click\n\n@click.group()\n@click.version_option()\ndef cli():\n    pass #Entry Point\n
\n\n

command_cloudflare.py

\n\n
@cli.group()\n@click.pass_context\ndef cloudflare(ctx):\n    pass\n\n@cloudflare.group(\'zone\')\ndef cloudflare_zone():\n    pass\n\n@cloudflare_zone.command(\'add\')\n@click.option(\'--jumpstart\', \'-j\', default=True)\n@click.option(\'--organization\', \'-o\', default=\'\')\n@click.argument(\'url\')\n@click.pass_obj\n@__cf_error_handler\ndef cloudflare_zone_add(ctx, url, jumpstart, organization):\n    pass\n\n@cloudflare.group(\'record\')\ndef cloudflare_record():\n    pass\n\n@cloudflare_record.command(\'add\')\n@click.option(\'--ttl\', \'-t\')\n@click.argument(\'domain\')\n@click.argument(\'name\')\n@click.argument(\'type\')\n@click.argument(\'content\')\n@click.pass_obj\n@__cf_error_handler\ndef cloudflare_record_add(ctx, domain, name, type, content, ttl):\n    pass\n\n@cloudflare_record.command(\'edit\')\n@click.option(\'--ttl\', \'-t\')\n@click.argument(\'domain\')\n@click.argument(\'name\')\n@click.argument(\'type\')\n@click.argument(\'content\')\n@click.pass_obj\n@__cf_error_handler\ndef cloudflare_record_edit(ctx, domain):\n    pass\n
\n\n

command_uptimerobot.py

\n\n
@cli.group()\n@click.pass_context\ndef uptimerobot(ctx):\n    pass\n\n@uptimerobot.command(\'add\')\n@click.option(\'--alert\', \'-a\', default=True)\n@click.argument(\'name\')\n@click.argument(\'url\')\n@click.pass_obj\ndef uptimerobot_add(ctx, name, url, alert):\n    pass\n\n@uptimerobot.command(\'delete\')\n@click.argument(\'names\', nargs=-1, required=True)\n@click.pass_obj\ndef uptimerobot_delete(ctx, names):\n    pass\n
\n',,'06/01/2016 21:58',HQ 34643800,'How to build a release version of an iOS framework in Xcode?','

Let\'s say I do the following:

\n\n
    \n
  1. Open Xcode 7
  2. \n
  3. File | New | Project | Cocoa Touch Framework
  4. \n
  5. Create \"TestFramework\" with the Swift language
  6. \n
  7. Create a file Hello.swift with public func hello() { print(\"Hello\") }.
  8. \n
\n\n

From here, I can build a debug build of the framework (inside the Debug-iphoneos folder), but I cannot figure out how to build the release version of the framework (inside Release-iphoneos). I thought Archive might do it, but it doesn\'t. Pointers please?

\n',,'06/01/2016 22:11',HQ 34644113,'Msg 201, Procedure stp_DespatchedJob, Line 0 Procedure or Function \'stp_DespatchedJob\' expects parameter \'@jobId\', which was not supplied','USE [taxi]\r\nGO\r\n\r\nDECLARE\t@return_value int\r\n\r\nEXEC\t@return_value = [dbo].[stp_DespatchedJob]\r\n\t\t@JobStatusId = NULL\r\n\r\nSELECT\t\'Return Value\' = @return_value\r\n\r\nGO\r\n',,'06/01/2016 22:31',LQ_EDIT 34644117,'Golang struct inheritance not working as intended?','

Check out this sandbox

\n\n

When declaring a struct that inherits from a different struct:

\n\n
type Base struct {\n    a string\n    b string\n}\n\ntype Something struct {\n    Base\n    c string\n}\n
\n\n

Then calling functions specifying values for the inherited values gives a compilation error:

\n\n
f(Something{\n    a: \"letter a\",\n    c: \"letter c\",\n})\n
\n\n

The error message is: unknown Something field \'a\' in struct literal.

\n\n

This seems highly weird to me. Is this really the intended functionality?

\n\n

Thanks for the help!

\n',,'06/01/2016 22:31',HQ 34644264,'Where are the additional command line options in Android Studio version 1.5.1 for the emulator','

After the latest update to AS, the emulator\'s additional command line options are missing. I use this primarily for -http-proxy and -scale commands. Any help in locating these options, or it\'s replacement, would be appreciated.

\n',,'06/01/2016 22:43',HQ 34644612,'Conda - Silently installing a package','

I am trying to automate the process of setting up a development environment with pandas package using conda.

\n\n

I installed conda, created and activated a dev environment. When I tried to install a package as follows, I noticed that there was a prompt to which a user had to key in Y or N (Proceed ([y]/n)?) for the installation to proceed successfully.

\n\n
$ conda install pandas\nFetching package metadata: ....\nSolving package specifications: ..................\nPackage plan for installation in environment /home/miniconda2/envs/pandas_env:\n\nThe following packages will be downloaded:\n\n    package                    |            build\n    ---------------------------|-----------------\n    libgfortran-1.0            |                0         170 KB\n    openblas-0.2.14            |                3         3.5 MB\n    numpy-1.10.2               |           py27_0         5.9 MB\n    pytz-2015.7                |           py27_0         174 KB\n    six-1.10.0                 |           py27_0          16 KB\n    python-dateutil-2.4.2      |           py27_0         219 KB\n    pandas-0.17.1              |      np110py27_0        12.4 MB\n    ------------------------------------------------------------\n                                           Total:        22.3 MB\n\nThe following NEW packages will be INSTALLED:\n\n    libgfortran:     1.0-0             \n    numpy:           1.10.2-py27_0     \n    openblas:        0.2.14-3          \n    pandas:          0.17.1-np110py27_0\n    python-dateutil: 2.4.2-py27_0      \n    pytz:            2015.7-py27_0     \n    six:             1.10.0-py27_0     \n\nProceed ([y]/n)? y\n\nFetching packages ...\nlibgfortran-1. 100\% |###################################################################################################################################################################| Time: 0:00:00 457.23 kB/s\nopenblas-0.2.1 100\% |###################################################################################################################################################################| Time: 0:00:02   1.68 MB/s\nnumpy-1.10.2-p 100\% |###################################################################################################################################################################| Time: 0:00:02   2.42 MB/s\npytz-2015.7-py 100\% |###################################################################################################################################################################| Time: 0:00:00 388.35 kB/s\nsix-1.10.0-py2 100\% |###################################################################################################################################################################| Time: 0:00:00 224.69 kB/s\npython-dateuti 100\% |###################################################################################################################################################################| Time: 0:00:00 493.15 kB/s\npandas-0.17.1- 100\% |###################################################################################################################################################################| Time: 0:00:04   3.24 MB/s\nExtracting packages ...\n[      COMPLETE      ]|######################################################################################################################################################################################| 100\%\nLinking packages ...\n[      COMPLETE      ]|######################################################################################################################################################################################| 100\%\n
\n\n

How can I override these prompts so that the installation takes place silently? I tried using the -f flag but it does not seem to be existing with the conda install command.

\n\n

Thanks in advance!

\n',,'06/01/2016 23:11',HQ 34645131,'How do I run PhantomJS on AWS Lambda with NodeJS','

After not finding a working answer anywhere else on the internet, I am submitting this ask-and-answer-myself tutorial

\n\n

How can I get a simple PhantomJS process running from a NodeJS script on AWS Lambda? My code works fine on my local machine, but I run into different problems trying to run it on Lambda.

\n',,'06/01/2016 23:59',HQ 34645274,'EF query to Oracle throwing \"ORA-12704: character set mismatch\"','

I\'m trying to combine a few columns in EF from Oracle then do a .Contains() over the columns like this:

\n\n
public IEnumerable<User> SearchUsers(string search)\n{\n    search = search.ToLower();\n\n    return _securityUow.Users\n            .Where(u => (u.FirstName.ToLower() + \" \" + u.LastName.ToLower() + \" (\" + u.NetId.ToLower() + \")\").Contains(search))\n            .OrderBy(u => u.LastName)\n            .ThenBy(u => u.FirstName)\n            .AsEnumerable();\n}\n
\n\n

However, I\'m getting this exception:

\n\n
{\n  \"Message\": \"An error has occurred.\",\n  \"ExceptionMessage\": \"An error occurred while executing the command definition. See the inner exception for details.\",\n  \"ExceptionType\": \"System.Data.Entity.Core.EntityCommandExecutionException\",\n  \"StackTrace\": \"   at SoftwareRegistration.WebUI.Controllers.Api.V1.UserContactController.Lookup(String search) in C:\\LocalRepository\\OnlineSupport\\SoftwareRegistration\\trunk\\release\\SoftwareRegistration\\SoftwareRegistration.WebUI\\Controllers\\Api\\V1\\UserContactController.cs:line 40\\r\\n   at lambda_method(Closure , Object , Object[] )\\r\\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\\r\\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\\r\\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\\r\\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\\r\\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\\r\\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()\",\n  \"InnerException\": {\n    \"Message\": \"An error has occurred.\",\n    \"ExceptionMessage\": \"ORA-12704: character set mismatch\",\n    \"ExceptionType\": \"Oracle.ManagedDataAccess.Client.OracleException\",\n    \"StackTrace\": \"   at OracleInternal.ServiceObjects.OracleCommandImpl.VerifyExecution(OracleConnectionImpl connectionImpl, Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)\\r\\n   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, Boolean isDescribeOnly, Boolean isFromEF)\\r\\n   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)\\r\\n   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)\\r\\n   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\\r\\n   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)\\r\\n   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\\r\\n   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)\\r\\n   at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)\\r\\n   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\\r\\n   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)\"\n  }\n}\n
\n\n

The columns I\'m querying are all of type VARCHAR2(128) in Oracle.

\n\n

I\'m also using this exact same code in another project and it works. The only difference is that for the project that works I\'m using Oracle.DataAccess and for the one that doesn\'t work, I\'m using Oracle.ManagedDataAccess (I am unable to use Oracle.DataAccess for this project). So I believe there is a bug/problem in the managed driver.

\n\n

I\'m open to solutions or workarounds.

\n',<.net>,'07/01/2016 00:15',HQ 34645315,'How to apply css class to a component element when it\'s created by router-outlet?','

I have DOM that looks something like this:

\n\n
<app>\n    <router-outlet></router-outlet>\n    <project>...</project>\n</app>\n
\n\n

where project element is inserted by the router.

\n\n

How do I add a class to this element?

\n',,'07/01/2016 00:19',HQ 34645537,'Android Espresso not working with Multidex gives \"No tests found\"','

My Espresso tests were running until I had to support multidex.

\n\n

My build.gradle, I have

\n\n
minSdkVersion 14\ntargetSdkVersion 23\nmultiDexEnabled = true\n\ntestInstrumentationRunner \"com.android.test.runner.MultiDexTestRunner\"\n\n\nandroidTestCompile \'com.android.support.test.espresso:espresso-core:2.2.1\'\nandroidTestCompile \'com.android.support.test.espresso:espresso-contrib:2.2.1\'\nandroidTestCompile \'com.android.support.test:runner:0.4.1\'\nandroidTestCompile \'com.android.support.test:rules:0.4.1\'\n\ndexOptions {\n        jumboMode true\n        javaMaxHeapSize \"4g\"\n        incremental true\n    }\n
\n\n

Test1AuthenticationEspressoTest

\n\n
@RunWith(AndroidJUnit4.class)\n@SmallTest\npublic class Test1AuthenticationEspressoTest {\n    @Rule\n    public ActivityTestRule<WelcomeActivity> mActivityRule = new  ActivityTestRule(WelcomeActivity.class);\n\n}\n
\n\n

Here is the Error I get

\n\n
\n

junit.framework.AssertionFailedError: No tests found in\n com.livestrong.tracker.test.Test1AuthenticationEspressoTest

\n
\n\n

Any help will be appreciated. Any one has espresso working with multidex ?

\n',,'07/01/2016 00:45',HQ 34645731,'Export more than one variable in ES6?','

I\'m trying to export more than one variable in ES6:

\n\n

exports.js

\n\n
var TestObject = Parse.Object.extend(\'TestObject\')\nvar Post = Parse.Object.extend(\'Post\')\n\nexport default TestObject\nexport Post\n
\n\n

main.js:

\n\n
import TestObject from \'../store\'\nimport Post from \'../store\'\n\nvar testObject = new TestObject() // use Post in the same way\ntestObject.save(json).then(object => {\n  console.log(\'yay! it worked\', object)\n})\n
\n\n

I understand that there\'s only one default value so I only used default in the first item.

\n\n

However, I get this error message:

\n\n
Module build failed: SyntaxError: /home/alex/node/my-project/src/store/index.js: Unexpected token (9:7)\n   7 | \n   8 | export default TestObject\n>  9 | export Post\n
\n\n

Maybe I\'m doing it the wrong way?

\n',,'07/01/2016 01:08',HQ 34646007,'Only allow form submit of pdf/images not ever blank','

Hi I have a website which the page logic should only accept submit under two conditions:

\n\n

1) if the captcha is actively checked

\n\n

and

\n\n

2) if at least one file is attached (only pdf and image file types are allowed up to three total) are attached.

\n\n

the issue is that we are receiving blank applications however, I am seeing a scenario where you can attach non pdfs/images with a pdf/image and still submit which strips all attachments.

\n\n

proper behavior should be:\nprevent submit if non pdf/image type attached show error message \"Only image or pdf can be uploaded\" and then a message stating this and preventing form submit at the bottom of the page in red just like the other errors.

\n\n

Be polite. Thanks. :-)

\n\n

Page URL: http://www.barona.com/about-barona/community-relations/community-giving-guidelines/

\n\n

PHP (to test replace youremail with your email address, thanks!):

\n\n
<?php\nini_set(\'display_errors\', \'off\');\n$to                 = \'youremail@gmail.com\';\n$from               = \'youremail@gmail.com\';\n$subject            = \'New Application\';\n$allowed_extensions = array(\n    \'.pdf\',\n    \'.jpeg\',\n    \'.jpg\',\n    \'.png\',\n    \'.gif\',\n    \'.bmp\'\n);\n$file1              = \'\';\n$file2              = \'\';\n$file3              = \'\';\n$filename1          = \'\';\n$filename2          = \'\';\n$filename3          = \'\';\n//echo  \"1\"; \nif (!empty($_FILES[\'file1\'][\'name\'])) {\n    //echo  \"File 1 exists\"; \n    $filename1 = $_FILES[\'file1\'][\'name\'];\n    $extension = \'.\' . strtolower(array_pop(explode(\'.\', $filename1)));\n    $size1     = $_FILES[\'file1\'][\'size\'];\n    $mime1     = $_FILES[\'file1\'][\'type\'];\n    $tmp1      = $_FILES[\'file1\'][\'tmp_name\'];\n    if (in_array($extension, $allowed_extensions)) {\n        $file1 = fopen($tmp1, \'rb\');\n        $data1 = fread($file1, filesize($tmp1));\n        // Now read the file content into a variable\n        fclose($file1);\n        // close the file\n        $data1 = chunk_split(base64_encode($data1));\n        // Now we need to encode it and split it into acceptable length lines\n        $file1 = $filename1;\n    } else {\n        $filename1 = \'\';\n    }\n}\n//file 2:\nif (!empty($_FILES[\'file2\'][\'name\'])) {\n    //echo  \"File 2 exists\"; \n    $filename2 = $_FILES[\'file2\'][\'name\'];\n    $extension = \'.\' . strtolower(array_pop(explode(\'.\', $filename2)));\n    $tmp2      = $_FILES[\'file2\'][\'tmp_name\'];\n    $size2     = $_FILES[\'file2\'][\'size\'];\n    $mime2     = $_FILES[\'file2\'][\'type\'];\n    if (in_array($extension, $allowed_extensions)) {\n        $file2 = fopen($tmp2, \'rb\');\n        $data2 = fread($file2, filesize($tmp2));\n        // Now read the file content into a variable\n        fclose($file2);\n        // close the file\n        $data2 = chunk_split(base64_encode($data2));\n        // Now we need to encode it and split it into acceptable length lines\n        $file2 = $filename2;\n    } else {\n        $filename2 = \'\';\n    }\n}\n//File 3:\nif (!empty($_FILES[\'file3\'][\'name\'])) {\n    //echo  \"File 3 exists\"; \n    $filename3 = $_FILES[\'file3\'][\'name\'];\n    $extension = \'.\' . strtolower(array_pop(explode(\'.\', $filename3)));\n    $tmp3      = $_FILES[\'file3\'][\'tmp_name\'];\n    $size3     = $_FILES[\'file3\'][\'size\'];\n    $mime3     = $_FILES[\'file3\'][\'type\'];\n    if (in_array($extension, $allowed_extensions)) {\n        $file3 = fopen($tmp3, \'rb\');\n        $data3 = fread($file3, filesize($tmp3));\n        // Now read the file content into a variable\n        fclose($file3);\n        // close the file\n        $data3 = chunk_split(base64_encode($data3));\n        // Now we need to encode it and split it into acceptable length lines\n        $file3 = $filename3;\n    } else {\n        $filename3 = \'\';\n    }\n}\n//echo  \"2\"; \n//Only allow image or pdf.\n$message = \"<table border=\'1\' style=\'width:80\%\'><tr><td>File 1: </td><td>$filename1</td></tr><tr><td>File 2: </td><td>$filename2<td></tr><tr><td>File 3: </td><td>$filename3</td></tr></table>\";\n// email fields: to, from, subject, and so on\n$headers = \"From: $from\\n\";\n$headers .= \"Reply-To: $to\\n\";\n$headers .= \"BCC: cpeterson@barona.com\";\n// boundary \n$semi_rand     = md5(time());\n$mime_boundary = \"==Multipart_Boundary_x{$semi_rand}x\";\n// headers for attachment \n$headers .= \"\\nMIME-Version: 1.0\\n\" . \"Content-Type: multipart/mixed, html;\\n\" . \" boundary=\\\"{$mime_boundary}\\\"\";\n// multipart boundary \n$message = \"This is a multi-part message in MIME format.\\n\\n\" . \"--{$mime_boundary}\\n\" . \"Content-Type: text/html; charset=ISO-8859-1\\n\" . \"Content-Transfer-Encoding: 7bit\\n\\n\" . $message . \"\\n\\n\";\n$message .= \"--{$mime_boundary}\\n\";\nif (!empty($file1)) {\n    $message .= \"Content-Type: {\\\"application/octet-stream\\\"};\\n\" . \" name=\'$filename1\'\\n\" . \"Content-Disposition: attachment;\\n\" . \" filename=$filename1\\n\" . \"Content-Transfer-Encoding: base64\\n\\n\" . $data1 . \"\\n\\n\";\n    $message .= \"--{$mime_boundary}\\n\";\n}\nif (!empty($file2)) {\n    $message .= \"Content-Type: {\\\"application/octet-stream\\\"};\\n\" . \" name=\'$filename2\'\\n\" . \"Content-Disposition: attachment;\\n\" . \" filename=$filename2\\n\" . \"Content-Transfer-Encoding: base64\\n\\n\" . $data2 . \"\\n\\n\";\n    $message .= \"--{$mime_boundary}\\n\";\n}\nif (!empty($file3)) {\n    $message .= \"Content-Type: {\\\"application/octet-stream\\\"};\\n\" . \" name=\'$filename3\'\\n\" . \"Content-Disposition: attachment;\\n\" . \" filename=$filename3\\n\" . \"Content-Transfer-Encoding: base64\\n\\n\" . $data3 . \"\\n\\n\";\n    $message .= \"--{$mime_boundary}\\n\";\n}\n// send\n$ok = @mail($to, $subject, $message, $headers, \'-fnoreply@yourmailer.com\');\nif ($ok) {\n    //echo \"<p>Thank you for submitting your application to: $to!</p>\";\nheader(\"Location: ../../../about-barona/community-relations/community-giving-guidelines/thanks/\"); /* Redirect browser */\nexit();\n} else {\n    //echo \"<p>mail could not be sent!</p>\";\nheader(\"Location: ../../../club-barona/email-signup/error/\"); /* Redirect browser */\nexit();\n}\n?>\n
\n\n

Wordpress HTML:

\n\n
<h2>COMMUNITY GIVING GUIDELINES & DONATION APPLICATION</h2><p>In an effort to better serve you, Barona will only review requests via an online donation application. To be considered for a donation or sponsorship, you must complete the online application. Requests submitted via email, mail, phone, or fax will not be accepted. All requests will be screened and reviewed for consideration by the Community Relations Committee. In making determinations on contribution requests, the Committee places emphasis on well-managed non-profit organizations and programs. Funding decisions are also based on the quality of the organizations programs and their support of Barona Resort & Casino’s key areas of focus. Additional consideration includes the scope of each program and the overall impact on the community. Barona maintains the flexibility to accommodate new and innovative approaches to meeting the needs of the community.</p><ul><li>Due to the volume of requests received, donation requests for auction and raffle items must be submitted at least 60 – 90 days prior to the date the donation is needed.</li><li>Sponsorship requests should be submitted by October for consideration in the following year, as planning is based on a calendar year.</li><li>Sponsorships exceeding $10,000 must include performance measurement criteria and the requestor must be prepared to submit a report of achievement.</li><li>We will respond to all requests with the decision of the committee, regardless of the outcome within 6 - 8 weeks of review.</li></ul>\n<h3>We generally <b> exclude </b> requests that benefit:</h3>\n<ul> \n    <li>Local sports organizations </li>\n\n    <li>An individual person or family </li>\n\n    <li>General operating expenses </li>\n\n    <li>Political candidates or organizations </li>\n\n    <li>Film or documentary productions </li>\n\n    <li>Memorials, endowments, or grants </li>\n\n    <li>Organizations outside of California </li>\n\n    <li>Travel expenses </li>\n\n    <li>Groups seeking educational or travel grants for contests, pageants, trips or conventions </li>\n\n    <li>Loan or loan guarantees </li>\n\n    <li>Capital improvement or building funds </li>\n  </ul>\n<p><input id=\"chkTerms\" name=\"chkTerms\" onclick=\"validate();\" required=\"required\" type=\"checkbox\" value=\"0\"> I have read and understand the Community Giving Guidelines. Thank you for contacting Barona Resort &amp; Casino regarding a contribution towards your organization. Please note that this online application must be completed in its entirety and, if necessary, submitted with all appropriate supporting documents.</p><form action=\"../../../wp-content/themes/barona/form-to-email.php\" enctype=\"multipart/form-data\" method=\"post\"> \n<div id=\"DonationApplicationFormContent\" style=\"width: 700px; margin: 10px -150px !important; display: none;\">\n<hr />\n<h2>Instructions </h2>\n<p>Follow the directions below to submit your <strong><a href=\"/wp-content/uploads/2015/10/DonationApplicationForm.pdf\" target=\"_blank\">Donation Application Form</a></strong>.</p>\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/G-SDuvlur8o\" frameborder=\"0\" allowfullscreen></iframe>\n\n<h3 style=\"margin: 0;\">Step 1</h3>\n<p>Download the Donation Application Form PDF.<br /><small>Note: Safari users, right click the \"Download Now\" button and select \"Download Linked File As\".</small><br /><br />[easy_media_download url=\"/wp-content/uploads/2015/10/DonationApplicationForm.pdf\" force_dl=\"1\"]</p>\n<h3 style=\"margin: 0;\">Step 2</h3>\n<strong>Print</strong> or <strong>complete</strong> the form using <strong><a href=\"https://get.adobe.com/reader\" target=\"_blank\">Adobe Acrobat Reader</a></strong>. You can download Adobe Acrobat for free at <a href=\"https://get.adobe.com/reader\" target=\"_blank\">https://get.adobe.com/reader</a>\n</p>\n<h3 style=\"margin: 0;\">Step 3</h3>\nClick <strong>Browse</strong> to upload the completed <strong>Donation Application Form</strong> along with any supporting documents (images or PDF).\n</p>\n<h3 style=\"margin: 0;\">Step 4</h3>\n<p>Click the <strong>Submit</strong> button below to complete your submission. <br />\n<br />\nOR \n<br /><br />\nEmail your completed PDF document with any supporting documents to <a href=\"mailto: donationapplicationsbarona@gmail.com\">donationapplicationsbarona@gmail.com</a>.\n</p>\nUpload event brochures, marketing materials or other documents. Upload images or PDF files only. (Limit: 5MB max per file):\n<table>\n<tr style=\"height: 30px;\">\n<td>File 1:<input type=\"file\" id=\"file1\" name=\"file1\"></td>\n</tr>\n<tr style=\"height: 30px;\">\n<td>File 2:<input type=\"file\" id=\"file2\"  name=\"file2\"></td>\n</tr>\n<tr style=\"height: 30px;\">\n<td>File 3: <input type=\"file\" id=\"file3\"  name=\"file3\"></td>\n</tr>\n</table>\n<table>\n<tr >\n<td>\n<div class=\"g-recaptcha\" id=\"rcaptcha\" data-sitekey=\"6Let2wwTAAAAAJaUZQGTCRy6Pv4YYLoQjsLUH6hs\"></div></td>\n</tr>\n<tr>\n<td>\n<div id=\"captcha\" aria-live=\"assertive\"></div></td>\n</tr>\n<tr style=\"height: 80px;\">\n<td><input tabindex=\"11\" title=\"Submit\" type=\"submit\" value=\"Submit\" onclick=\"return get_action(this);\"><input tabindex=\"12\" title=\"Reset\" type=\"reset\" value=\"Reset\"></td>\n</tr>\n</table>\n<label id=\"lblStatus\">*Required.</label></div>\n</form>\n
\n\n

Page source:

\n\n

see page. :-)

\n\n

Please help fix it so no blank applications can be received. as well as only pdf/images allowed before submit. willing to install a js file. please be as thorough and I will select you as top vote/winner. be good my coder friends! Long live privacy!

\n',,'07/01/2016 01:40',LQ_CLOSE 34646021,'RestFuse vs Rest Assured vs MockMVC Rest Service Unit Test Framework','

I\'ve been trying to find a simple all purpose unit test framework for Spring MVC based Rest Services I\'ve written.

\n\n

I\'ve been searching online and narrowed it down to:

\n\n\n\n

I like RestFuse because it\'s mostly annotation based, but rest assured seems to have a easier way of passing parameters and checking responses. And finally being a Spring MVC Rest Service project, I\'m wondering if I should just stick with the already established way of testing Rest Services in Spring with MockMVC.

\n\n

Interested to get any feedback, as well as performance, past experiences and if there\'s anything else I should take into consideration.

\n',,'07/01/2016 01:41',HQ 34646221,'How to get alpha names for my program?','

When you see games in BETA and ALPHA, lets use Minecraft as example, Minecraft when it was in ALPHA the title for the ALPHA versions for Minecraft where like \"Minecraft APLHA C1.2.2_C1.2\" for example. Not that it\'s really important but how do they get the numbers and letters (C1.2.2_C1.2 <- these numbers and letters) and what do they represent for is it numbers that are just kinda random? and how does a person go about to getting those numbers for there program? I normally just go ALPHA 1 - how many updates there is but I find it more professional to have titles like this \"Minecraft APLHA C1.2.2_C1.2\"? Thanks

\n',,'07/01/2016 02:03',LQ_CLOSE 34646237,'Parse Line and Break it into Variables in C#','I have a text file that contain only the FULL version number of an application that I need to extract and then parse it into separate Variables. For example lets say the version.cs contains 19.1.354.6\r\n\r\nCode I\'m using does not seem to be working:\r\n\r\n char[] delimiter = { \'.\' };\r\n string currentVersion = System.IO.File.ReadAllText(@\"C:\\Applicaion\\version.cs\");\r\n string[] partsVersion;\r\n partsVersion = currentVersion.Split(delimiter);\r\n string majorVersion = partsVersion[0];\r\n string minorVersion = partsVersion[1];\r\n string buildVersion = partsVersion[2];\r\n string revisVersion = partsVersion[3];\r\n\r\nBest regards,\r\n\r\nTRI0N',,'07/01/2016 02:05',LQ_EDIT 34646709,'how to change query to entity frame',' \r\ni want to change this sql query to entity frame query\r\n\r\n SELECT dbo.ClassTiming.StartTime, dbo.ClassTiming.EndTime, dbo.Employee.StaffName, dbo.Department.DepartmentName, dbo.Class.ClassName, dbo.Section.SectionName, dbo.WeekDay.DayName\r\n FROM dbo.Timetable INNER JOIN\r\n dbo.ClassTiming ON dbo.Timetable.ClassTimingId = dbo.ClassTiming.Id INNER JOIN\r\n dbo.Employee ON dbo.Timetable.StaffId = dbo.Employee.StaffID INNER JOIN\r\n dbo.Department ON dbo.Timetable.DepartmentId = dbo.Department.id INNER JOIN\r\n dbo.Section ON dbo.Timetable.SectionID = dbo.Section.ID INNER JOIN\r\n dbo.Class ON dbo.Timetable.ClassID = dbo.Class.ID INNER JOIN\r\n dbo.WeekDay ON dbo.Timetable.WeekDayId = dbo.WeekDay.Id ',,'07/01/2016 03:02',LQ_EDIT 34646833,'Any Javascript Expert: Who can add multiple IDs in This Script to Check If CSS does not match redirect Page','Javascript expert,\r\n\r\ni have the below script\r\n\r\n $(\'#copyright, #credit, #doom a\').each(function () {\r\n if ($(this).css(\'font-size\') != \'15px\') {\r\n document.location.href = \"http://www.example.com\";\r\n }\r\n });\r\n\r\nIt check all these IDs Css properties for font-size 15px if not equal then the page will be redirect to example.com\r\n\r\n\r\nNow here what i want, I want to know how can i add **multiple css property** in that script not only the font-size but i also want to include position:relative;height:auto;background:#000; to check it..\r\n\r\nit may be look like this: (this is only example not the working script )\r\n\r\n $(\'#copyright, #credit, #doom a\').each(function () {\r\n if \r\n position:relative;height:auto;background:#000\r\n \r\n { do nothing }\r\n \r\n else\r\n {\r\n document.location.href = \"http://www.example.com\";\r\n }\r\n });\r\n',,'07/01/2016 03:20',LQ_EDIT 34646992,'How to work with xml and java (android)','

How do I make something in xml, and change the value of it in Java?

\n\n

ex:

\n\n
<TextView\n    android:text=\"Hello World!\"\n    android:textSize=\"50dp\"\n    android:layout_marginTop=\"27dp\"\n    android:id=\"@+id/textView\"\n    android:editable=\"true\"\n    android:enabled=\"true\" />\n
\n\n

Now how do I edit the text from being \"Hello World\" to something else in Java?

\n',,'07/01/2016 03:41',LQ_CLOSE 34647303,'Spring RestTemplate with paginated API','

Our REST APIs are returning results in Pages. Here is an example of one Controller

\n\n
@RequestMapping(value = \"/search\", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE + \";charset=UTF-8\")\n@ResponseStatus(HttpStatus.OK)\npublic Page<MyObject> findAll(Pageable pageable) {\n  ...\n}\n
\n\n

Is there an easy way to consume that API with RestTemplate?

\n\n

if we do

\n\n
ParameterizedTypeReference<Page<MyObject>> responseType = new ParameterizedTypeReference<Page<MyObject>>() { };\n\nResponseEntity<Page<MyObject>> result = restTemplate.exchange(url, HttpMethod.GET, null/*httpEntity*/, responseType);\n\nList<MyObject> searchResult = result.getBody().getContent();\n
\n\n

it throws an exception

\n\n
org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not construct instance of org.springframework.data.domain.Page, \nproblem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information at [Source: java.io.PushbackInputStream@3be1e1f2; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.springframework.data.domain.Page, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information\n
\n\n

Thank you in advance

\n',,'07/01/2016 04:18',HQ 34647536,'how to get audio.duration value by a function','

Im my audio player I need to get the duration of my audio track. I need a function that gets src of the audio and returns its duration. Here is what I am trying to do but does not work:

\n\n
function getDuration(src){\n    var audio = new Audio();\n    audio.src = \"./audio/2.mp3\";\n    var due;\n    return getVal(audio);\n}\nfunction getVal(audio){\n    $(audio).on(\"loadedmetadata\", function(){\n        var val = audio.duration;\n        console.log(\">>>\" + val);\n        return val;\n    });\n}\n
\n\n

I tried to split into two functions but it does not work. It would be great if it was as on working function.

\n\n

Any idea?

\n',
\r\n \r\n
',,'05/09/2017 10:04',LQ_EDIT 46053100,'Mock FingerprintManager in Android tests','

Is there a way to simulate or mock FingerprintManager.authenticate()? I want to write instrumented tests for my fingerprint authenticator.

\n\n

I\'m fine if there\'s a solution with a restriction that the tests can be run either on an emulator or a device. I use JUnit 4.12.

\n',,'05/09/2017 10:47',HQ 46053672,'Set secomp to unconfined in docker-compose','

I need to be able fork a process. As i understand it i need to set the security-opt. I have tried doing this with docker command and it works fine. However when i do this in a docker-compose file it seem to do nothing, maybe I\'m not using compose right.

\n\n

Docker

\n\n
docker run --security-opt=seccomp:unconfined <id> dlv debug --listen=:2345 --headless --log ./cmd/main.go\n
\n\n

Docker-compose

\n\n

Setup

\n\n

docker-compose.yml

\n\n
networks:\n  backend:\n\nservices:\n  example:\n    build: .\n    security_opt:\n      - seccomp:unconfined\n    networks:\n      - backend\n    ports:\n      - \"5002:5002\"\n
\n\n

Dockerfile

\n\n
FROM golang:1.8\n\nRUN go get -u github.com/derekparker/delve/cmd/dlv\nRUN dlv debug --listen=:2345 --headless --log ./cmd/main.go\n
\n\n

command

\n\n
docker-compose -f docker-compose.yml up --build --abort-on-container-exit\n
\n\n

Result

\n\n
\n

2017/09/04 15:58:33 server.go:73: Using API v1 2017/09/04 15:58:33\n debugger.go:97: launching process with args: [/go/src/debug] could not\n launch process: fork/exec /go/src/debug: operation not permitted

\n
\n',,'05/09/2017 11:18',HQ 46053761,'CSS3 selectors p.para vs. p .para','

I read the following, but I don;t fully understand the meaning of these selectors. Could you please provide an example showing the difference between them? Thx.

\n\n

\"enter

\n',,'05/09/2017 11:23',LQ_CLOSE 46054019,'Access appsettings.json from .NET 4.5.2 project','

I have two projects, a 1.1.0 ASP.NET Core project and a reference to a 4.5.2 project.

\n\n

I want to get values from the appsettings.json file to my 4.5.2 project. The appsettings.json file is in the core project.

\n\n

Tried this from my 4.5.2 project with no luck:

\n\n
var mailServer = ConfigurationManager.AppSettings[\"MailServer\"];\n
\n\n

How can I access the values from my 4.5.2 project?

\n',,'05/09/2017 11:34',HQ 46054228,'Can constructor template cause ambiguity in the c++17 parameter deduction of class template','

Consider a simple example:

\n\n
template <class T>\nstruct foo {\n    template <template <class> class TT>\n    foo(TT<T>&&) {}\n    foo(foo<T>&&){}\n    foo() {}\n};\n\nint main() {\n    foo      f1(foo<int>{}); //case 1.\n    foo<int> f2(foo<int>{}); //case 2.\n}\n
\n\n

Case 1. causes ambiguity in the template argument deduction of foo class in clang but not in gcc. I thought that template functions (here - constructor) have lower priority in overload resolution. Is it not the case here?

\n\n

Error message:

\n\n
prog.cc:10:14: error: ambiguous deduction for template arguments of \'foo\'\n    foo      f1(foo<int>{}); //case 1.\n             ^\nprog.cc:4:5: note: candidate function [with T = int, TT = foo]\n    foo(TT<T>&&) {}\n    ^\nprog.cc:5:5: note: candidate function [with T = int]\n    foo(foo<T>&&){}\n    ^\n1 error generated.\n
\n\n

[clang demo] [gcc demo]

\n',,'05/09/2017 11:46',HQ 46054318,'Tilde sign in python dataframe','

Im new to python and came across a code snippet.

\n\n
df = df[~df[\'InvoiceNo\'].str.contains(\'C\')]\n
\n\n

Would be much obliged if I could know whats the tilde signs usage in this context ?

\n',,'05/09/2017 11:51',HQ 46054418,'how download Angular4 js','I want to develop my first app with Angular4 technology into PHP Symfony project. I don\'t use NodeJS server for executing JS source code. But the official tutorial angular4 don\'t specified another way for getting angular4 js.\r\n\r\nI don\'t find CDN for Angular4.\r\n\r\nHow can find source code of Angular v4 ?',,'05/09/2017 11:57',LQ_EDIT 46054514,'how can i remove the extra bottom tab bar created in my tabs page','i\'m using xcode and swift to create an iOS app.now i want to create a side bar menu using swreveale framework and i try to add it in one of of bottom tabs pages but when i switch to that tab i have an extra space of bottom tab and i cant remove it.can anyone help?\r\n\r\n\r\nhttp://s9.picofile.com/file/8305617242/Screen_Shot_1396_06_14_at_16_23_27.png\r\n\r\ni mean this black tab above of home tab\r\n\r\n\r\n\r\nthanks!',,'05/09/2017 12:02',LQ_EDIT 46054600,'Android Studio Kotlin Compiler warning','

I found warning in Kotlin Compiler settings

\n\n
\n

Following modules override project settings: app

\n
\n\n

\"enter

\n\n

Project compiles and works perfect but can this warning make affect in future? And how to solve this.

\n\n

Thanks in advance.

\n',,'05/09/2017 12:06',HQ 46055056,'Can i reboot phone without root access on b4a?','How to reboot phone without root access on b4a?\r\nOnly need root access with ML library?\r\nPls help me, i m start learning in b4a.\r\n\r\nCode:\r\n\r\nSub Globals\r\n Dim M as MLfiles\r\nEnd Sub\r\n\r\nSub Activity_Create(FirstTime As Boolean)\r\n M.GetRoot\r\n M.RootCmd(\"reboot\",\"\",Null,Null,False)\r\nEnd Sub',,'05/09/2017 12:31',LQ_EDIT 46055074,'WPF or ASP.NET for creating a simple multiple access application?','

I have read some related articles but didn\'t find a perfectly fitting answer to my questions.

\n\n

I need to create a simple application to perform basic accountancy related operations. The requirement is such that multiple users (in my case up to 5 people) in the same LAN need to be able to work on the same database from their machines. As the application is going to be simple (basic add/subtract operations and storing the results in the database) I wonder whether I need to use ASP.NET or I can use WPF implementing basic communication interface (WCF seems to be a good helper) as I was working mostly with WPF and have only little experience with ASP.NET. To keep simple again, I decided to use SQLite instead of RDMS (like MS SQL Server or MySQL). I read here that it is better to use client/server DB for my purpose but I believe that the scale of my project is so small that eventual latencies will not bother me. What I need to know is whether it is wise to use WPF with SQLite database as a shared network resource and accessed by other users or it is better to dive into ASP.NET for this reason.

\n\n

To sum up my requirements:

\n\n
    \n
  1. The application is very simple in terms of performed tasks (only basic accountancy related operations),
  2. \n
  3. Simple database (SQLite is my choise),
  4. \n
  5. Multiple access but only for few people (up to 3 or 5 people),
  6. \n
  7. The users will be in the same network,
  8. \n
  9. I do not bother about eventual latencies
  10. \n
\n\n

My doubts are:

\n\n
    \n
  1. In my case - will it be wise to use SQLite concurrency embedded mechanism if the traffic is very small (only few people)? In the SQLite docs it is stated that basic concurrency is handled in terms of multiple reading access and only single write access at the same time. However I have never used concurrency in SQL so I would need an opinion of somebody more experienced in this topic,

  2. \n
  3. Is it better to learn more ASP.NET to create a basic client/server app (I would prefer SQLite as DB again) than implementing WPF with some network related stuff like accessing the shared SQLite file or using WCF to achieve the same? I mean, isn\'t it complicating everything too much by prefering WPF over ASP.NET? If the application was supposed to be big, scalable etc. I would definitely stick to ASP.NET but in the case of simplicity of the project and simplicity of creating WPF application using C# and XAML I doubt which technology to use in my particular situation to keep simple in the terms of development.

  4. \n
\n\n

If there is a better solution than the stated above, please mention it (I would prefer to stick with C# but I am open to other suggestions).

\n',,'05/09/2017 12:31',LQ_CLOSE 46056101,'Is it good practice to return available Options for the entity','

I\'m working on a new api and i\'m trying to decide if it would be a good practice to include the list of available options as well as the selected option when returning an entity back from the database.

\n\n

Take for example

\n\n
class car\n{\n   int Id;\n   Type Type;\n   List<Type> Types;\n}\n\nclass Type\n{\n    int Id;\n    string Name;\n}\n
\n\n

I\'ve seen this done both ways, so I was wondering if there was a preference.

\n\n

Thanks

\n',,'05/09/2017 13:22',LQ_CLOSE 46056668,'Ag-Grid Link with link in the cell','

I am building angular 4 app with ag-grid and I am having an issue with trying to figure out how to put a link in the cell. Can anybody help me with that issue?\nThanks

\n',,'05/09/2017 13:49',HQ 46056890,'How to include .Net Core 2.0 in Visual Studio 2017','

I want to create a project in .Net Core 2.0, but some how the Visual Studio 2017 SDK does not displays the .Net Core 2.0 in Target Framework selection drop down list.

\n\n

I have already installed .net Core 2.0 SDK on my machine.

\n\n

Any help would be appreciated.

\n',<.net-core>,'05/09/2017 13:59',HQ 46057103,'How to set linear gradient to background of LaunchScreen.xib in iOS','

Is there any way to set linear gradient to background of LaunchScreen.xib in iOS? Something like background=\"linear-gradient(#000000, #123456)\"?

\n\n
<view contentMode=\"scaleToFill\" background=\"...\">\n    <rect key=\"frame\" width=\"753\" height=\"867\"/>\n</view>\n
\n',,'05/09/2017 14:10',HQ 46057353,'Controlling State from outside of a StatefulWidget','

I\'m trying to understand the best practice for controlling a StatefulWidget\'s state outside of that Widgets State.

\n\n

I have the following interface defined.

\n\n
abstract class StartupView {\n  Stream<String> get onAppSelected;\n\n  set showActivity(bool activity);\n  set message(String message);\n}\n
\n\n

I would like to create a StatefulWidget StartupPage that implements this interface. I expect the Widget to do the following:

\n\n
    \n
  1. When a button is pressed it would send an event over the onAppSelected stream. A controller would listen to this even and perform some action ( db call, service request etc ).

  2. \n
  3. The controller can call showActivity or set message to have the view show progress with a message.

  4. \n
\n\n

Because a Stateful Widget does not expose it\'s State as a property, I don\'t know the best approach for accessing and modifying the State\'s attributes.

\n\n

The way I would expect to use this would be something like:

\n\n
Widget createStartupPage() {\n    var page = new StartupPage();\n    page.onAppSelected.listen((app) {\n      page.showActivity = true;\n      //Do some work\n      page.showActivity = false;\n    });\n  }\n
\n\n

I\'ve thought about instantiating the Widget by passing in the state I want it to return in createState() but that feels wrong.

\n\n

Some background on why we have this approach: We currently have a Dart web application. For view-controller separation, testability and forward thinking towards Flutter we decided that we would create an interface for every view in our application. This would allow a WebComponent or a Flutter Widget to implement this interface and leave all of the controller logic the same.

\n',,'05/09/2017 14:23',HQ 46057456,'How to turn have a .json file as a string in C#','

So I have this .json file: temp_file.json

\n\n

Now all I need to do is get whatever is in this .json file, and put it in a string using C# in Visual Studio 2017.

\n\n

That\'s it.

\n\n

I don\'t want it to be turned into a object of a certain class or whatever. Just get whatsever in the file, right into a string.

\n\n

A lot of other questions/answers I have stumbled upon are about desirializing and serializing etc. I don\'t need that. Just turn the .json file in to a string. No need to write it to a console or whatsoever.

\n\n

Somewhy I just cant lay my finger on it. It sounds simple to do...

\n',,'05/09/2017 14:28',LQ_CLOSE 46058004,'Python making list of lists from list','

My code now: random_lst = [1,2,3,4,5,6,7,8,9]

\n\n

What\'s practical way in Python to make list of lists from list?

\n\n

My goal: [[1,2,3],[4,5,6],[7,8,9]]

\n',,'05/09/2017 14:55',LQ_CLOSE 46058212,'HOW TO MAKE LINKS, BUTTONS, DIVS HOVER ON A MOBILE DEVICE?','I\'m a beginner in HTML/CSS and I am having trouble making elements hover on a mobile device. \r\n\r\nIn my CSS, I type something like:\r\n\r\n .button:hover {\r\n background-color: #fff;\r\n }\r\n\r\nThis seems to hover fine on my desktop, however on my iPhone and other touch devices, I can\'t seem to make the button hover which makes you feel detached from the website when you click on buttons and links etc.\r\n\r\nI hope someone can help me on this– I would appreciate any possible solutions.\r\n\r\nKind regards,\r\n\r\nBilly',,'05/09/2017 15:07',LQ_EDIT 46058457,'Can\'t install laravel installer via composer','

I\'m trying to install laravel installer with the composer on my Ubuntu PC, but I get this error during the installation. `Your requirements could not be resolved to an installable set of packages.

\n\n
  Problem 1\n    - laravel/installer v1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.\n    - laravel/installer v1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.\n    - Installation request for laravel/installer ^1.4 -> satisfiable by laravel/installer[v1.4.0, v1.4.1].\n\n  To enable extensions, verify that they are enabled in those .ini files:\n    - /etc/php/7.0/cli/php.ini\n    - /etc/php/7.0/cli/conf.d/10-opcache.ini\n    - /etc/php/7.0/cli/conf.d/10-pdo.ini\n    - /etc/php/7.0/cli/conf.d/20-calendar.ini\n    - /etc/php/7.0/cli/conf.d/20-ctype.ini\n    - /etc/php/7.0/cli/conf.d/20-exif.ini\n    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini\n    - /etc/php/7.0/cli/conf.d/20-ftp.ini\n    - /etc/php/7.0/cli/conf.d/20-gettext.ini\n    - /etc/php/7.0/cli/conf.d/20-iconv.ini\n    - /etc/php/7.0/cli/conf.d/20-json.ini\n    - /etc/php/7.0/cli/conf.d/20-phar.ini\n    - /etc/php/7.0/cli/conf.d/20-posix.ini\n    - /etc/php/7.0/cli/conf.d/20-readline.ini\n    - /etc/php/7.0/cli/conf.d/20-shmop.ini\n    - /etc/php/7.0/cli/conf.d/20-sockets.ini\n    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini\n    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini\n    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini\n    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini\n  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.\n`\n
\n\n

The error appears then I use this comment:

\n\n
composer global require \"laravel/installer\"\n
\n',,'05/09/2017 15:20',HQ 46058544,'\"document is not defined\" in Nuxt.js','

I am trying to use Choices.js within a Vue component. The component compiles successfully, but then an error is triggered:

\n\n
\n

[vue-router] Failed to resolve async component default:\n ReferenceError: document is not defined

\n
\n\n

In the browser I see:

\n\n
\n

ReferenceError document is not defined

\n
\n\n

I think this has something to do with the SSR in Nuxt.js? I only need Choices.js to run on the client, because it\'s a client only aspect I guess.

\n\n

nuxt.config.js

\n\n
build: {\n  vendor: [\'choices.js\']\n}\n
\n\n

AppCountrySelect.vue

\n\n
<script>\nimport Choices from \'choices.js\'\n\nexport default {\n  name: \'CountrySelect\',\n  created () {\n    console.log(this.$refs, Choices)\n    const choices = new Choices(this.$refs.select)\n    console.log(choices)\n  }\n}\n</script>\n
\n\n

In classic Vue, this would work fine, so I\'m very much still getting to grips with how I can get Nuxt.js to work this way.

\n\n

Any ideas at all where I\'m going wrong?

\n\n

Thanks.

\n',,'05/09/2017 15:24',HQ 46058546,'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'','

I am trying install typescript with command npm install -g typescript, and returns this error :

\n\n
    npm ERR! Error: EACCES: permission denied, access \'/usr/lib/node_modules\'\n    npm ERR!     at Error (native)\n    npm ERR!  { Error: EACCES: permission denied, access \'/usr/lib/node_modules\'\n    npm ERR!     at Error (native)\n    npm ERR!   errno: -13,\n    npm ERR!   code: \'EACCES\',\n    npm ERR!   syscall: \'access\',\n    npm ERR!   path: \'/usr/lib/node_modules\' }\n    npm ERR! \n    npm ERR! Please try running this command again as root/Administrator.\n    npm ERR! Linux 4.4.0-93-generic\n    npm ERR! argv \"/usr/bin/nodejs\" \"/usr/bin/npm\" \"install\" \"-g\" \"typescript\"\n    npm ERR! node v6.11.2\n    npm ERR! npm  v3.10.10\n    npm ERR! path npm-debug.log.1024969454\n    npm ERR! code EACCES\n    npm ERR! errno -13\n    npm ERR! syscall open\n\n    npm ERR! Error: EACCES: permission denied, open \'npm-debug.log.1024969454\'\n    npm ERR!     at Error (native)\n    npm ERR!  { Error: EACCES: permission denied, open \'npm-debug.log.1024969454\'\n    npm ERR!     at Error (native)\n    npm ERR!   errno: -13,\n    npm ERR!   code: \'EACCES\',\n    npm ERR!   syscall: \'open\',\n    npm ERR!   path: \'npm-debug.log.1024969454\' }\n    npm ERR! \n    npm ERR! Please try running this command again as root/Administrator.\n\n    npm ERR! Please include the following file with any support request:\n    npm ERR!     /npm-debug.log\n    jramirez@jramirez:/$ ^C\n    jramirez@jramirez:/$ npm install typescript\n    npm WARN checkPermissions Missing write access to /\n    /\n    └── typescript@2.5.2 \n\n    npm WARN enoent ENOENT: no such file or directory, open \'/package.json\'\n    npm WARN !invalid#1 No description\n    npm WARN !invalid#1 No repository field.\n    npm WARN !invalid#1 No README data\n    npm WARN !invalid#1 No license field.\n    npm ERR! Linux 4.4.0-93-generic\n    npm ERR! argv \"/usr/bin/nodejs\" \"/usr/bin/npm\" \"install\" \"typescript\"\n    npm ERR! node v6.11.2\n    npm ERR! npm  v3.10.10\n    npm ERR! path /\n    npm ERR! code EACCES\n    npm ERR! errno -13\n    npm ERR! syscall access\n\n    npm ERR! Error: EACCES: permission denied, access \'/\'\n    npm ERR!     at Error (native)\n    npm ERR!  { Error: EACCES: permission denied, access \'/\'\n    npm ERR!     at Error (native) errno: -13, code: \'EACCES\', syscall: \'access\', path: \'/\' }\n    npm ERR! \n    npm ERR! Please try running this command again as root/Administrator.\n    npm ERR! Linux 4.4.0-93-generic\n    npm ERR! argv \"/usr/bin/nodejs\" \"/usr/bin/npm\" \"install\" \"typescript\"\n    npm ERR! node v6.11.2\n    npm ERR! npm  v3.10.10\n    npm ERR! path npm-debug.log.2387664261\n    npm ERR! code EACCES\n    npm ERR! errno -13\n    npm ERR! syscall open\n\n    npm ERR! Error: EACCES: permission denied, open \'npm-debug.log.2387664261\'\n    npm ERR!     at Error (native)\n    npm ERR!  { Error: EACCES: permission denied, open \'npm-debug.log.2387664261\'\n    npm ERR!     at Error (native)\n    npm ERR!   errno: -13,\n    npm ERR!   code: \'EACCES\',\n    npm ERR!   syscall: \'open\',\n    npm ERR!   path: \'npm-debug.log.2387664261\' }\n    npm ERR! \n    npm ERR! Please try running this command again as root/Administrator.\n\n    npm ERR! Please include the following file with any support request:\n    npm ERR!     /npm-debug.log\n
\n\n

Additionaly I run also npm install typescript (without -g), but doesnt\' work, or exists anything other way to install typescript?\nMy OS is Linux Ubuntu 16.04.\nI seldom use node and don\'t know like to fix this issue.

\n\n

My question is : Exactly, what directories needs that permmisions ?

\n',,'05/09/2017 15:24',HQ 46059226,'Upload image with HttpClient','

Problem

\n\n

I try to upload an image with angular\'s HttpClient to API Content-Type: multipart/form-data (angular v4+). Is it supported? How to do it?

\n\n

The upload works with XMLHttpRequest when using module like ng2-fancy-image-uploader. I would prefer to use a custom method with HttpClient which i could put into a http service together with other methods for accessing API.

\n\n

Here is what i have tried so far:

\n\n

model.service.ts

\n\n
import { Injectable } from \'@angular/core\';\nimport { HttpClient, HttpHeaders, HttpResponse } from \'@angular/common/http\';\nimport \'rxjs/add/operator/toPromise\';\n\n@Injectable()\nexport class ModelService {\n  constructor(private http: HttpClient) { }\n\n  public async updateAvatar(file: File): Promise<void> {\n\n    // headers\n    const headers = new HttpHeaders()\n      .append(\'Content-Type\', \'multipart/form-data\');\n\n    const formData: FormData = new FormData();\n    formData.append(\'avatar\', file, file.name);\n\n    const response: HttpResponse = await this.http\n      .patch(\'https://example.com/avatar\', formData, { headers, observe: \'response\' })\n      .toPromise();\n\n    console.log(response.status);\n  }\n}\n
\n\n

avatar-uploader.component.ts

\n\n
import { Component, ElementRef, OnInit, ViewChild } from \'@angular/core\';\nimport { ModelService } from \'./path/to/model.service\';\n\n@Component({\n  selector: \'app-avatar-uploader\',\n  template: \'<input type=\"file\" #fileInput (changes)=\"uploadAvatar()\">\'\n})\nexport class AvatarUploaderComponent implements OnInit {\n\n  @ViewChild(\'fileInput\') fileInputElement: ElementRef;\n\n  constructor() { }\n\n  ngOnInit() { }\n\n  public async uploadAvatar() {\n    const file: File = this.fileInputElement.nativeElement.files[0];\n\n    await this.model.updateAvatar(file);\n  }\n\n}\n
\n\n

This version sends a request to (express) API, but multer (a library for parsing multipart/form-data requests) fails to parse the request.

\n\n

So i guess i either use the HttpClient incorrectly, or it doesn\'t support multipart/form-data requests.

\n\n

I guess one could send base64 encoded file or use XmlHttpRequest, but i ask specifically about HttpClient\'s ability to do it.

\n',,'05/09/2017 16:03',HQ 46059366,'Best way to add \"display: flex\" to flexslider2 [wordpress plugin] slide?','

I want to add \"display: flex\" to flexslider2 slides but the plugin\'s javascript sets the slides to \"display: block\" so I can\'t just declare that in my wp theme stylesheet because the javascript\'s style declarations take precedence over the stylesheet\'s. I can go in and change the lines of code in the flexslider.js that but then I run into the trouble of having those lines overwritten when the wordpress plugin gets updated. So, what\'s the best way to override javascript css? Should I even be using the flexslider plugin? Is there a better way to use jquery/js to create a slider that I can use flex properties on? It seemed the cleanest and easiest slider plugin to implement as a featured posts slider in wp. Thanks for your help.

\n',,'05/09/2017 16:12',LQ_CLOSE 46059888,'C# ASP.NET Date and Time without jQuery','

I am new to ASP.NET and want to use date and time for the user to enter their desired date. I have looked around and saw people using jQuery but is there another way to implement it nicely?

\n',,'05/09/2017 16:51',LQ_CLOSE 46060671,'restrict a textbox to only integers between 1 and 99','I am trying to add a text box which accepts only integers between 1 and 99. I tried adding a number type element with min and max but that works only when changing the number using the ticker\r\n\r\n \r\n\r\n**May I know a better way to achieve this?**',,'05/09/2017 17:47',LQ_EDIT 46061117,'Why can\'t I pass a sentence value to a jQuery function?','

I am trying to run a function like this:

\n\n

onclick=\"preConfirm(New Lots Avenue,40.660223,-73.896668);\"

\n\n

But I always get an error in the console saying

\n\n

Uncaught SyntaxError: missing ) after argument list

\n\n

What am I doing wrong?

\n',,'05/09/2017 18:19',LQ_CLOSE 46062084,'How to provide multiple StringNotEquals conditions in AWS policy?','

I am trying to write AWS S3 bucket policy that denies all traffic except when it comes from two VPCs. The policy I\'m trying to write looks like the one below, with a logical AND between the two StringNotEquals (except it\'s an invalid policy):

\n\n
{\n   \"Version\": \"2012-10-17\",\n   \"Id\": \"Policy1415115909152\",\n   \"Statement\": [\n     {\n       \"Sid\": \"Allow-access-only-from-two-VPCs\",\n       \"Action\": \"s3:*\",\n       \"Effect\": \"Deny\",\n       \"Resource\": [\"arn:aws:s3:::my-bucket\",\n                    \"arn:aws:s3:::my-bucket/*\"],\n       \"Condition\": {\n         \"StringNotEquals\": {\n           \"aws:sourceVpc\": \"vpc-111bbccc\"\n         },\n         \"StringNotEquals\": {\n           \"aws:sourceVpc\": \"vpc-111bbddd\"\n         }\n       },\n       \"Principal\": \"*\"\n     }\n   ]\n}\n
\n\n

If I use this:

\n\n
\"StringNotEquals\": {\n       \"aws:sourceVpc\": [\"vpc-111bbccc\", \"vpc-111bbddd\"]\n     }\n
\n\n

then at least one of the string comparisons returns true and the S3 bucket is not accessible from anywhere.

\n',,'05/09/2017 19:30',HQ 46062105,'Rounding floats with f-string','

Using \%-formatting, I can specify the number of decimal cases in a string:

\n\n
x = 3.14159265\nprint(\'pi = \%0.2f\' \%x)\n
\n\n

This would give me:

\n\n
pi = 3.14\n
\n\n

Is there any way of doing this using f-strings in Python 3.6?

\n',,'05/09/2017 19:31',HQ 46062243,'Node process object made available to browser client code','

I\'m trying to understand how webpack uses DefinePlugin. I have:

\n\n
new webpack.DefinePlugin({\n  \'process.env.NODE_ENV\': JSON.stringify(\'development\'),\n}),\n
\n\n

and a function:

\n\n
export const foo = () => {\n  console.log(process)\n  console.log(process.env.NODE_ENV)\n}\nwindow.foo = foo\n
\n\n

when I print foo, I see the following in my browser console:

\n\n
ƒ foo() {\n  console.log(process);\n  console.log(\"development\");\n}\n
\n\n

It seems like the variable \"development\" was injected while webpack was compiling the input file. At the same time webpack also injected the process object into the JavaScript code, and the browser did print out the process object when foo was called:

\n\n
{title: \"browser\", browser: true, env: {…}, argv: Array(0), nextTick: ƒ, …}\n
\n\n

My question is, how can the process object, which is a Node concept, be made available to the browser?

\n\n

In fact, if I do:

\n\n
window.process = process\n
\n\n

I can use process.nextTick right inside the browser console! I thought the nextTick function was a Node-specific implementation! Could anybody explain this?

\n\n

Thank you!

\n',,'05/09/2017 19:40',HQ 46062489,'What is ** in Java?','What does the following statement mean?\r\n\r\n INT_MAX**1/3\r\n\r\nFor context I saw this in an Android coding challenge, where it also treats `2^11` as meaning \'2 to the power of 11\' (instead of 2 XOR 11), so it is possible it\'s pseudocode',,'05/09/2017 19:57',LQ_EDIT 46062679,'Right order of doing feature selection, PCA and normalization?','

I know that feature selection helps me remove features that may have low contribution. I know that PCA helps reduce possibly correlated features into one, reducing the dimensions. I know that normalization transforms features to the same scale.

\n\n

But is there a recommended order to do these three steps? Logically I would think that I should weed out bad features by feature selection first, followed by normalizing them, and finally use PCA to reduce dimensions and make the features as independent from each other as possible.

\n\n

Is this logic correct?

\n\n

Bonus question - are there any more things to do (preprocess or transform) \n to the features before feeding them into the estimator?

\n',,'05/09/2017 20:11',HQ 46062747,'Anyone know why this href isn\'t firing the javascript in Internet Explorer?','Can anyone tell me why this href wouldn\'t be firing the javascript in IE11? Works in all other browsers.\r\n\r\n\"\r\n >',,'05/09/2017 20:16',LQ_EDIT 46063268,'Is this battery compatible with the Node MCU ESP8266?','

Is this battery compatible with this NodeMCU ESP8266\n?

\n\n

More details; it was recommended to use this page to get a battery to power the Node ESP8266 but I\'m not sure which models are compatible.

\n',,'05/09/2017 20:58',LQ_CLOSE 46063631,'I have a hard time trying to understand this','
m = 0\nx = 1\nwhile x < 4:\n    y = 1\n    while y < 3:\n        m = m + x + y\n        y = y + 1\n    x = x + 1\nprint(m)\n
\n\n

The output is supposed to be 21 but i dont get it , what am i missing? a little help please

\n',,'05/09/2017 21:30',LQ_CLOSE 46064135,'android studios display name instead of email','How do i make the following code display the name as a welcome instead of the email?? When i just change EMAIL to Name it displys null instead of the name. Any help much appreciated.\r\nIve tried changing email to name but this dosent work i dont know what else to do.\r\n UsersActivity.java (this is what i want to change so it displays the name instead of email)\r\n \r\n package com.delaroystudios.sqlitelogin.activities;\r\n \r\n import android.os.Bundle;\r\n import android.support.v7.app.AppCompatActivity;\r\n import android.widget.TextView;\r\n \r\n import com.delaroystudios.sqlitelogin.R;\r\n \r\n \r\n public class UsersActivity extends AppCompatActivity {\r\n \r\n private TextView textViewName;\r\n \r\n @Override\r\n protected void onCreate(Bundle savedInstanceState){\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_users);\r\n \r\n textViewName = (TextView) findViewById(R.id.text1);\r\n String nameFromIntent = getIntent().getStringExtra(\"NAME\");\r\n textViewName.setText(\"Welcome \" + nameFromIntent);\r\n }\r\n }\r\n \r\n LoginActivity.java\r\n package com.delaroystudios.sqlitelogin.activities;\r\n \r\n import android.content.Intent;\r\n import android.support.design.widget.Snackbar;\r\n import android.support.design.widget.TextInputEditText;\r\n import android.support.design.widget.TextInputLayout;\r\n import android.support.v4.widget.NestedScrollView;\r\n import android.support.v7.app.AppCompatActivity;\r\n import android.os.Bundle;\r\n import android.support.v7.widget.AppCompatButton;\r\n import android.support.v7.widget.AppCompatTextView;\r\n import android.view.View;\r\n \r\n import com.delaroystudios.sqlitelogin.R;\r\n import com.delaroystudios.sqlitelogin.helper.InputValidation;\r\n import com.delaroystudios.sqlitelogin.sql.DatabaseHelper;\r\n \r\n public class LoginActivity extends AppCompatActivity implements View.OnClickListener {\r\n \r\n private final AppCompatActivity activity = LoginActivity.this;\r\n \r\n private NestedScrollView nestedScrollView;\r\n \r\n private TextInputLayout textInputLayoutEmail;\r\n private TextInputLayout textInputLayoutPassword;\r\n \r\n private TextInputEditText textInputEditTextEmail;\r\n private TextInputEditText textInputEditTextPassword;\r\n \r\n private AppCompatButton appCompatButtonLogin;\r\n \r\n private AppCompatTextView textViewLinkRegister;\r\n \r\n private InputValidation inputValidation;\r\n private DatabaseHelper databaseHelper;\r\n \r\n @Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_login);\r\n getSupportActionBar().hide();\r\n \r\n initViews();\r\n initListeners();\r\n initObjects();\r\n }\r\n private void initViews(){\r\n nestedScrollView = (NestedScrollView) findViewById(R.id.nestedScrollView);\r\n \r\n textInputLayoutEmail = (TextInputLayout) findViewById(R.id.textInputLayoutEmail);\r\n textInputLayoutPassword = (TextInputLayout) findViewById(R.id.textInputLayoutPassword);\r\n \r\n textInputEditTextEmail = (TextInputEditText) findViewById(R.id.textInputEditTextEmail);\r\n textInputEditTextPassword = (TextInputEditText) findViewById(R.id.textInputEditTextPassword);\r\n \r\n appCompatButtonLogin = (AppCompatButton) findViewById(R.id.appCompatButtonLogin);\r\n \r\n textViewLinkRegister = (AppCompatTextView) findViewById(R.id.textViewLinkRegister);\r\n }\r\n \r\n private void initListeners(){\r\n appCompatButtonLogin.setOnClickListener(this);\r\n textViewLinkRegister.setOnClickListener(this);\r\n }\r\n \r\n private void initObjects(){\r\n databaseHelper = new DatabaseHelper(activity);\r\n inputValidation = new InputValidation(activity);\r\n }\r\n \r\n @Override\r\n public void onClick(View v){\r\n switch (v.getId()){\r\n case R.id.appCompatButtonLogin:\r\n verifyFromSQLite();\r\n break;\r\n case R.id.textViewLinkRegister:\r\n Intent intentRegister = new Intent(getApplicationContext(), RegisterActivity.class);\r\n startActivity(intentRegister);\r\n break;\r\n }\r\n }\r\n \r\n private void verifyFromSQLite(){\r\n if (!inputValidation.isInputEditTextFilled(textInputEditTextEmail, textInputLayoutEmail, getString(R.string.error_message_email))) {\r\n return;\r\n }\r\n if (!inputValidation.isInputEditTextEmail(textInputEditTextEmail, textInputLayoutEmail, getString(R.string.error_message_email))) {\r\n return;\r\n }\r\n if (!inputValidation.isInputEditTextFilled(textInputEditTextPassword, textInputLayoutPassword, getString(R.string.error_message_email))) {\r\n return;\r\n }\r\n \r\n if (databaseHelper.checkUser(textInputEditTextEmail.getText().toString().trim()\r\n , textInputEditTextPassword.getText().toString().trim())) {\r\n Intent accountsIntent = new Intent(activity, UsersActivity.class);\r\n accountsIntent.putExtra(\"EMAIL\", textInputEditTextEmail.getText().toString().trim());\r\n emptyInputEditText();\r\n startActivity(accountsIntent);\r\n }\r\n \r\n else {\r\n Snackbar.make(nestedScrollView, getString(R.string.error_valid_email_password), Snackbar.LENGTH_LONG).show();\r\n }\r\n }\r\n \r\n private void emptyInputEditText(){\r\n textInputEditTextEmail.setText(null);\r\n textInputEditTextPassword.setText(null);\r\n }\r\n }\r\n \r\n RegisterActivity.java\r\n package com.delaroystudios.sqlitelogin.activities;\r\n \r\n import android.os.Bundle;\r\n import android.support.design.widget.Snackbar;\r\n import android.support.design.widget.TextInputEditText;\r\n import android.support.design.widget.TextInputLayout;\r\n import android.support.v4.widget.NestedScrollView;\r\n import android.support.v7.app.AppCompatActivity;\r\n import android.support.v7.widget.AppCompatButton;\r\n import android.support.v7.widget.AppCompatTextView;\r\n import android.view.View;\r\n \r\n import com.delaroystudios.sqlitelogin.R;\r\n import com.delaroystudios.sqlitelogin.helper.InputValidation;\r\n import com.delaroystudios.sqlitelogin.model.User;\r\n import com.delaroystudios.sqlitelogin.sql.DatabaseHelper;\r\n \r\n \r\n public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {\r\n \r\n private final AppCompatActivity activity = RegisterActivity.this;\r\n \r\n private NestedScrollView nestedScrollView;\r\n \r\n private TextInputLayout textInputLayoutName;\r\n private TextInputLayout textInputLayoutEmail;\r\n private TextInputLayout textInputLayoutPassword;\r\n private TextInputLayout textInputLayoutConfirmPassword;\r\n \r\n private TextInputEditText textInputEditTextName;\r\n private TextInputEditText textInputEditTextEmail;\r\n private TextInputEditText textInputEditTextPassword;\r\n private TextInputEditText textInputEditTextConfirmPassword;\r\n \r\n private AppCompatButton appCompatButtonRegister;\r\n private AppCompatTextView appCompatTextViewLoginLink;\r\n \r\n private InputValidation inputValidation;\r\n private DatabaseHelper databaseHelper;\r\n private User user;\r\n \r\n @Override\r\n protected void onCreate(Bundle savedInstanceState){\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_register);\r\n getSupportActionBar().hide();\r\n \r\n initViews();\r\n initListeners();\r\n initObjects();\r\n }\r\n \r\n private void initViews(){\r\n nestedScrollView = (NestedScrollView) findViewById(R.id.nestedScrollView);\r\n \r\n textInputLayoutName = (TextInputLayout) findViewById(R.id.textInputLayoutName);\r\n textInputLayoutEmail = (TextInputLayout) findViewById(R.id.textInputLayoutEmail);\r\n textInputLayoutPassword = (TextInputLayout) findViewById(R.id.textInputLayoutPassword);\r\n textInputLayoutConfirmPassword = (TextInputLayout) findViewById(R.id.textInputLayoutConfirmPassword);\r\n \r\n textInputEditTextName = (TextInputEditText) findViewById(R.id.textInputEditTextName);\r\n textInputEditTextEmail = (TextInputEditText) findViewById(R.id.textInputEditTextEmail);\r\n textInputEditTextPassword = (TextInputEditText) findViewById(R.id.textInputEditTextPassword);\r\n textInputEditTextConfirmPassword = (TextInputEditText) findViewById(R.id.textInputEditTextConfirmPassword);\r\n \r\n appCompatButtonRegister = (AppCompatButton) findViewById(R.id.appCompatButtonRegister);\r\n \r\n appCompatTextViewLoginLink = (AppCompatTextView) findViewById(R.id.appCompatTextViewLoginLink);\r\n }\r\n \r\n private void initListeners(){\r\n appCompatButtonRegister.setOnClickListener(this);\r\n appCompatTextViewLoginLink.setOnClickListener(this);\r\n }\r\n \r\n private void initObjects(){\r\n inputValidation = new InputValidation(activity);\r\n databaseHelper = new DatabaseHelper(activity);\r\n user = new User();\r\n }\r\n \r\n @Override\r\n public void onClick(View v){\r\n switch (v.getId()){\r\n case R.id.appCompatButtonRegister:\r\n postDataToSQLite();\r\n break;\r\n case R.id.appCompatTextViewLoginLink:\r\n finish();\r\n break;\r\n }\r\n }\r\n \r\n private void postDataToSQLite(){\r\n if (!inputValidation.isInputEditTextFilled(textInputEditTextName, textInputLayoutName, getString(R.string.error_message_name))) {\r\n return;\r\n }\r\n if (!inputValidation.isInputEditTextFilled(textInputEditTextEmail, textInputLayoutEmail, getString(R.string.error_message_email))) {\r\n return;\r\n }\r\n if (!inputValidation.isInputEditTextEmail(textInputEditTextEmail, textInputLayoutEmail, getString(R.string.error_message_email))) {\r\n return;\r\n }\r\n if (!inputValidation.isInputEditTextFilled(textInputEditTextPassword, textInputLayoutPassword, getString(R.string.error_message_password))) {\r\n return;\r\n }\r\n if (!inputValidation.isInputEditTextMatches(textInputEditTextPassword, textInputEditTextConfirmPassword,\r\n textInputLayoutConfirmPassword, getString(R.string.error_password_match))) {\r\n return;\r\n }\r\n \r\n if (!databaseHelper.checkUser(textInputEditTextEmail.getText().toString().trim())) {\r\n \r\n user.setName(textInputEditTextName.getText().toString().trim());\r\n user.setEmail(textInputEditTextEmail.getText().toString().trim());\r\n user.setPassword(textInputEditTextPassword.getText().toString().trim());\r\n \r\n databaseHelper.addUser(user);\r\n \r\n // Snack Bar to show success message that record saved successfully\r\n Snackbar.make(nestedScrollView, getString(R.string.success_message), Snackbar.LENGTH_LONG).show();\r\n emptyInputEditText();\r\n \r\n \r\n } else {\r\n // Snack Bar to show error message that record already exists\r\n Snackbar.make(nestedScrollView, getString(R.string.error_email_exists), Snackbar.LENGTH_LONG).show();\r\n }\r\n \r\n \r\n }\r\n \r\n private void emptyInputEditText(){\r\n textInputEditTextName.setText(null);\r\n textInputEditTextEmail.setText(null);\r\n textInputEditTextPassword.setText(null);\r\n textInputEditTextConfirmPassword.setText(null);\r\n }\r\n \r\n }\r\n \r\n InputValidation.java\r\n package com.delaroystudios.sqlitelogin.helper;\r\n \r\n import android.app.Activity;\r\n import android.content.Context;\r\n import android.support.design.widget.TextInputEditText;\r\n import android.support.design.widget.TextInputLayout;\r\n import android.util.Patterns;\r\n import android.view.View;\r\n import android.view.WindowManager;\r\n import android.view.inputmethod.InputMethodManager;\r\n \r\n \r\n public class InputValidation {\r\n \r\n private Context context;\r\n \r\n public InputValidation(Context context){\r\n this.context = context;\r\n }\r\n \r\n public boolean isInputEditTextFilled(TextInputEditText textInputEditText, TextInputLayout textInputLayout, String message){\r\n String value = textInputEditText.getText().toString().trim();\r\n if (value.isEmpty()){\r\n textInputLayout.setError(message);\r\n hideKeyboardFrom(textInputEditText);\r\n return false;\r\n } else {\r\n textInputLayout.setErrorEnabled(false);\r\n }\r\n return true;\r\n }\r\n \r\n public boolean isInputEditTextEmail(TextInputEditText textInputEditText, TextInputLayout textInputLayout, String message){\r\n String value = textInputEditText.getText().toString().trim();\r\n if (value.isEmpty() || !Patterns.EMAIL_ADDRESS.matcher(value).matches()){\r\n textInputLayout.setError(message);\r\n hideKeyboardFrom(textInputEditText);\r\n return false;\r\n \r\n }else {\r\n textInputLayout.setErrorEnabled(false);\r\n }\r\n return true;\r\n }\r\n \r\n public boolean isInputEditTextMatches(TextInputEditText textInputEditText1, TextInputEditText textInputEditText2, TextInputLayout textInputLayout, String message ){\r\n String value1 = textInputEditText1.getText().toString().trim();\r\n String value2 = textInputEditText2.getText().toString().trim();\r\n if (!value1.contentEquals(value2)){\r\n textInputLayout.setError(message);\r\n hideKeyboardFrom(textInputEditText2);\r\n return false;\r\n }else {\r\n textInputLayout.setErrorEnabled(false);\r\n }\r\n return true;\r\n }\r\n \r\n private void hideKeyboardFrom(View view){\r\n InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);\r\n imm.hideSoftInputFromWindow(view.getWindowToken(), WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);\r\n }\r\n }\r\n \r\n User.java\r\n package com.delaroystudios.sqlitelogin.model;\r\n \r\n \r\n public class User {\r\n \r\n private int id;\r\n private String name;\r\n private String email;\r\n private String password;\r\n \r\n public int getId(){\r\n return id;\r\n }\r\n \r\n public void setId(int id){\r\n this.id = id;\r\n }\r\n \r\n public String getName(){\r\n return name;\r\n }\r\n \r\n public void setName(String name){\r\n this.name = name;\r\n }\r\n \r\n public String getEmail(){\r\n return email;\r\n }\r\n \r\n public void setEmail(String email){\r\n this.email = email;\r\n }\r\n \r\n public String getPassword(){\r\n return password;\r\n }\r\n \r\n public void setPassword(String password){\r\n this.password = password;\r\n }\r\n }\r\n \r\n Databasehelper.java\r\n package com.delaroystudios.sqlitelogin.sql;\r\n \r\n import android.content.ContentValues;\r\n import android.content.Context;\r\n import android.database.Cursor;\r\n import android.database.sqlite.SQLiteDatabase;\r\n import android.database.sqlite.SQLiteOpenHelper;\r\n \r\n import com.delaroystudios.sqlitelogin.model.User;\r\n \r\n \r\n public class DatabaseHelper extends SQLiteOpenHelper{\r\n \r\n private static final int DATABASE_VERSION = 1;\r\n \r\n private static final String DATABASE_NAME = \"UserManager.db\";\r\n \r\n private static final String TABLE_USER = \"user\";\r\n \r\n private static final String COLUMN_USER_ID = \"user_id\";\r\n private static final String COLUMN_USER_NAME = \"user_name\";\r\n private static final String COLUMN_USER_EMAIL = \"user_email\";\r\n private static final String COLUMN_USER_PASSWORD = \"user_password\";\r\n \r\n private String CREATE_USER_TABLE = \"CREATE TABLE \" + TABLE_USER + \"(\"\r\n + COLUMN_USER_ID + \" INTEGER PRIMARY KEY AUTOINCREMENT,\" + COLUMN_USER_NAME + \" TEXT,\"\r\n + COLUMN_USER_EMAIL + \" TEXT,\" + COLUMN_USER_PASSWORD + \" TEXT\" + \")\";\r\n \r\n private String DROP_USER_TABLE = \"DROP TABLE IF EXISTS \" + TABLE_USER;\r\n \r\n public DatabaseHelper(Context context){\r\n super(context, DATABASE_NAME, null, DATABASE_VERSION);\r\n }\r\n \r\n @Override\r\n public void onCreate(SQLiteDatabase db){\r\n db.execSQL(CREATE_USER_TABLE);\r\n }\r\n \r\n @Override\r\n public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){\r\n db.execSQL(DROP_USER_TABLE);\r\n onCreate(db);\r\n }\r\n \r\n public void addUser(User user){\r\n SQLiteDatabase db = this.getWritableDatabase();\r\n ContentValues values = new ContentValues();\r\n values.put(COLUMN_USER_NAME, user.getName());\r\n values.put(COLUMN_USER_EMAIL, user.getEmail());\r\n values.put(COLUMN_USER_PASSWORD, user.getPassword());\r\n \r\n db.insert(TABLE_USER, null, values);\r\n db.close();\r\n }\r\n \r\n public boolean checkUser(String email){\r\n String[] columns = {\r\n COLUMN_USER_ID\r\n };\r\n SQLiteDatabase db = this.getWritableDatabase();\r\n String selection = COLUMN_USER_EMAIL + \" = ?\";\r\n String[] selectionArgs = { email };\r\n \r\n Cursor cursor = db.query(TABLE_USER,\r\n columns,\r\n selection,\r\n selectionArgs,\r\n null,\r\n null,\r\n null);\r\n int cursorCount = cursor.getCount();\r\n cursor.close();\r\n db.close();\r\n \r\n if (cursorCount > 0){\r\n return true;\r\n }\r\n return false;\r\n }\r\n \r\n public boolean checkUser(String email, String password){\r\n String[] columns = {\r\n COLUMN_USER_ID\r\n };\r\n SQLiteDatabase db = this.getWritableDatabase();\r\n String selection = COLUMN_USER_EMAIL + \" = ?\" + \" AND \" + COLUMN_USER_PASSWORD + \" =?\";\r\n String[] selectionArgs = { email, password };\r\n \r\n Cursor cursor = db.query(TABLE_USER,\r\n columns,\r\n selection,\r\n selectionArgs,\r\n null,\r\n null,\r\n null);\r\n int cursorCount = cursor.getCount();\r\n cursor.close();\r\n db.close();\r\n \r\n if (cursorCount > 0){\r\n return true;\r\n }\r\n return false;\r\n }\r\n }\r\n\r\n',,'05/09/2017 22:23',LQ_EDIT 46064205,'why am I getting the error \"Can\'t find string terminator \'\"\' anywhere before EOF when running very basic Perl script on MacOSX?','I am getting the error Can\'t find string terminator \'\"\' anywhere before EOF when running the following script on Mac OSX. Note that this script was copied directly from a Mac forum...\r\n\r\n#!/usr/bin/perl\r\n print \"Hi there!\\n”',,'05/09/2017 22:31',LQ_EDIT 46064433,'CUDA_HOME path for Tensorflow','

The Tensorflow linux installation instructions say:

\n\n
\n

Ensure that you create the CUDA_HOME environment variable as described\n in the NVIDIA documentation.

\n
\n\n

I cannot find any mention of CUDA_HOME in the NVIDIA instructions for cuDNN v6 or in the NVIDIA CUDA Toolkit install instructions. Does anyone know how this variable should be set on linux?

\n',,'05/09/2017 22:58',HQ 46065150,'Multiply a float with a double','

I try to do a very simple thing, just multiply two numbers a float and a double.\nI get the message can\'t convert a double to float... Thank you

\n\n
float tax = 0f;\ntax = 0.14 * 26818;\n
\n',,'06/09/2017 00:40',LQ_CLOSE 46065664,'How can the nested loops of unknown layers be implemented by recursion?','

int m =10;

\n\n
    int n = 9;\n\n    int p = 4;\n\n    int q = 7;\n\n    for(int i=0;i<m;i++){\n\n        int a = i;\n\n        for(int j=0;j<n;j++){\n\n            int b = j;\n\n            if(b==a){\n\n                continue;\n\n            }\n\n            for(int k=0;k<p;k++){\n\n                int c = k;\n\n                if(c==b || c==a){\n\n                    continue;\n\n                }\n\n                for(int l=0;l<q;l++){\n\n                    int d = l;\n\n                    if(d==c || d==b || d==a){\n\n                        continue;\n\n                    }\n\n                    System.out.println(\"i=\"+i+\",j=\"+j+\",k=\"+k+\",l=\"+l);\n\n                }\n\n            }\n\n        }\n\n    }\n
\n\n

For example, the code fragment is a four layer nested loop, and the loop between has data dependencies, and nested layers is uncertain, how it will achieve through the recursive (nested is uncertain)?

\n',,'06/09/2017 01:53',LQ_CLOSE 46065819,'Remove top navigation bar for certain screens','

Is there a way of removing the top navigation bar for specific screens only? I am using react-navigation.

\n\n

I already tried the following:

\n\n
header: { visible: false }\n
\n\n

but it only hides the navbar. The space of the navbar is still cannot be used.

\n\n

Thanks in advance!

\n',,'06/09/2017 02:18',HQ 46065993,'Segmentation Fault in C when reading a file full of ints','

I am simply trying to open a file and read the ints and print the array. However, a segmentation fault shows up. I am not sure what I am doing wrong.

\n\n
int main (int argc, char *argv[])\n{\n   int size;\n   int i;\n   FILE* p = fopen(argv[1], \"r\");\n   fscanf(p, \"\%d\", &size);\n   int a[size];\n\n   for(i=0; i<size; i++)\n   {\n      a[i] = fscanf(p,\"\%d\",&a[i]);\n\n   }\n\n   for(i=0;i<size;i++)\n  {\n      printf(\"\%d\", a[i]);\n  }\n\n}\n
\n\n

Any help will be appreciated. Thanks.

\n',,'06/09/2017 02:45',LQ_CLOSE 46066782,'Stuck at VS\'s unable to start program','So I am new to C, so I was writing really basic code on Visual Studio. The first program (Hello World) worked out perfectly. But when I added a second program (a loop) I can an \"unable to start program, System could cannot find the file specified\"\r\n\r\nExact error (I added the 3 dots in the file path for privacy reasons)\r\n\r\n -----\r\n Microsoft Visual Studio\r\n ---------------------------\r\n Unable to start program \'C:\\Users ... Learning Projects\\Learning\\Debug\\Learning.exe\'.\r\n \r\n The system cannot find the file specified.\r\n\r\nFirst Program:\r\n\r\n #include \r\n //links the program with the standard input output file\r\n //contains functions like printf \r\n \r\n //main function \r\n int main() {\r\n \r\n \tprintf(\"hello World \\n\");\r\n \treturn (0);\r\n }\r\n \r\nSecond Program:\r\n\r\n #include \"stdio.h\"\"\r\n \r\n int main() {\r\n \r\n \tint ch; \r\n \tfor (ch = 75; ch <= 100; ch++) {\r\n \t\tprintf(\"ASCII value = \%d, Character = \%c\\n\", ch, ch); \r\n \t}\r\n \r\n \treturn (0); \r\n }\r\n\r\nThis may be a stupid problem, but I am unable to figure out what is causing it. ',,'06/09/2017 04:27',LQ_EDIT 46067457,'I have 4 SQL tables that all i am using same primary key i need below condition SQL Quey','I have 4 [ client,clientmanager,Employee,project] tables in sql that all tables i am using primarykey for same (clientid) so i like to count list of projects,Employee,clients mangers using \'clientid \" ',,'06/09/2017 05:30',LQ_EDIT 46067783,'Android connect to odoo server','

can anyone help me to solve this, I want to connect to odoo server so that I can use XMLRPC, any related links if I get will be useful

\n',,'06/09/2017 05:56',LQ_CLOSE 46068378,'Regex for complex password','

This question has obviously been asked many times regarding how to make a regex using c# to meet the requirements. I require a regex that..

\n\n
    \n
  • Is at least 8 characters long
  • \n
  • At least 1 upper case character
  • \n
  • 1 number
  • \n
  • 1 special character !@#$\%^&*()
  • \n
  • password not the same as the login name(easy to check)
  • \n
  • not contain more than 2 recurring characters e.g. aaa123
  • \n
\n\n

Trying to work this out myself i was thinking to search for how to do each 1 of these requirements one by one and build the regex up as i go. Is this the right approach?

\n\n

I feel like i could be missing something. I am reading up about regex expressions and how to create a complex one. Your feedback much needed.

\n\n

Thanks.

\n',,'06/09/2017 06:36',LQ_CLOSE 46068744,'Getting error in compiling Unity Universal Windows Platform bulid','I am porting unity game to universal windows platform but during creating build in visual studio get this error.[Error screen is here][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/fctwj.jpg',,'06/09/2017 06:58',LQ_EDIT 46068860,'How do I replace cells with formulas with its calculated value automatically?','I am making a payroll program in Excel and one of my concerns is that the salaries of the employees are searched using the INDEX and MATCH or VLOOKUP function. The problem is if the salaries get updated in the future (e.g. a raise or changes in rates), all the previous entries that used the old salaries will be updated to the new salaries. This is a disaster and would make my entire program useless and inefficient. Therefore I need to automatically lock previous calculated cells after a certain time.',,'06/09/2017 07:05',LQ_EDIT 46069047,'AWS products and services naming nomenclature starting with \'Amazon\' vs \'AWS\'','

Just curious to understand if there are any logical reasoning behind in naming AWS products and services. For example, it has been named as AWS Lambda and not Amazon Lambda & it is Amazon S3 and not AWS S3.

\n\n

If you hover over the Products menu in AWS homepage, you can see list of all products and services at a glance prefixed with both \'Amazon\' and \'AWS\'.

\n',,'06/09/2017 07:15',HQ 46069202,'How to create optional RewriteCond in Apache','

i have touble for my .htaccess config., this is part of config:

\n\n
RewriteCond \%{QUERY_STRING} ^token=(.*)\nRewriteRule ^aplikasi/(.*).asp aplikasi.php?halaman=$1&token=\%1\n
\n\n

and result that config is:

\n\n
http://{domain}/aplikasi/{$1}.asp?token={\%1}\n
\n\n

if i using this link:

\n\n
http://{domain}/aplikasi/{$1}.asp\n
\n\n

i have 404 error, i my question is : how to create like that with optional token prameter (i want to \"?token={\%1}\" is optional)

\n',,'06/09/2017 07:24',HQ 46069492,'How to create an user-defined header file ? Hope , I would get that either in C/C++','

I am an beginner in C++ language. I was able to understand the concept of header file , but facing the problem when i wanted to deal with them. I want to create a user-defined header files ?\nExpecting someone to show me a sample of it!

\n\n

Thanks in advance,

\n',,'06/09/2017 07:42',LQ_CLOSE 46069784,'how to place emmbeded link in videos?','I am trying to place an embedded link in offline video.Is there any solution to do that?I tried with quicktime software but it\'s not helping me.Is there any software to put embedded links in videos?If it is please help me its urgent.',
\r\n\r\n/***********************************************\r\n\r\ncontroller angulajs\r\n\r\n$scope.formSupplies = function (dataSupplies) {\r\n\r\n \r\n console.log(dataSupplies);\r\n\r\n \r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n',,'07/09/2017 23:20',LQ_EDIT 46107000,'.finish() is not working inside a nested if statement','

For some reason, I cant use .finish() to end my previous activity inside a nested if statement.

\n\n
if (id == R.id.nav_menu) {\n        MenuFragment menuFragment = MenuFragment.newInstance(\"\", \"\");\n        FragmentManager manager = getSupportFragmentManager();\n        manager.beginTransaction().replace(\n                R.id.layout_for_fragment,\n                menuFragment\n        ).commit();\n    } else if (id == R.id.nav_report) {\n        if(status == 1){\n            SharedPrefManager.getInstance(getApplicationContext()).logout();\n            getApplicationContext().finish();\n            startActivity(new Intent(getApplicationContext(), LoginActivity.class));\n        }\n    }\n
\n',,'08/09/2017 00:43',LQ_CLOSE 46107011,'Why does the exit() function in C \"never fail\"?','

I was reading Head First C and it said \"exit() is the only function that is guaranteed never to return a value and never to fail.\"

\n\n
    \n
  1. Are there other functions in C that are supposed to not return anything that might?

  2. \n
  3. Why is it that exit() never ever fails?

  4. \n
\n',,'08/09/2017 00:45',LQ_CLOSE 46107706,'Kotlin iterator to list?','

I have an iterator of strings from fieldNames of JsonNode:

\n\n
val mm = ... //JsonNode\nval xs = mm.fieldNames()\n
\n\n

I want to loop over the fields while keeping count, something like:

\n\n
when mm.size() {\n  1 -> myFunction1(xs[0])\n  2 -> myFunction2(xs[0], xs[1])\n  3 -> myFunction3(xs[0], xs[1], xs[2])\n  else -> print(\"invalid\")\n}\n
\n\n

Obviously the above code does not work as xs the Iterator cannot be indexed like so. I tried to see if I can convert the iterator to list by mm.toList() but that does not exist.

\n\n

How can I achieve this?

\n',,'08/09/2017 02:25',HQ 46107943,'can\'t display java code on my html website page in a proper formatted way','

I am new to website development so what I am doing is using
tag after each line of code to break the line and giving space in starting to make it as presentable as it is in eclipse but while displaying the entire code it shifts to left. There is no proper formatting. Please provide a way to do this.

\n',,'08/09/2017 02:56',LQ_CLOSE 46108106,'Unable to identify source of java.lang.ClassNotFoundException BaseDexClassLoader','

I have got lot of crash report in my android app from users as I see in the developer console. The stack trace that I see is:

\n\n
java.lang.RuntimeException:\n\n  at android.app.ActivityThread.handleReceiver (ActivityThread.java:2884)\n\n  at android.app.ActivityThread.-wrap14 (ActivityThread.java)\n\n  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1565)\n\n  at android.os.Handler.dispatchMessage (Handler.java:111)\n\n  at android.os.Looper.loop (Looper.java:207)\n\n  at android.app.ActivityThread.main (ActivityThread.java:5728)\n\n  at java.lang.reflect.Method.invoke (Native Method)\n\n  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789)\n\n  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)\nCaused by: java.lang.ClassNotFoundException:\nat dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)\nat java.lang.ClassLoader.loadClass (ClassLoader.java:511)\nat java.lang.ClassLoader.loadClass (ClassLoader.java:469)\nat android.app.ActivityThread.handleReceiver (ActivityThread.java:2879)\n
\n\n

There is no reference to my app\'s package name. I am using Eclipse for my development. Is it something related to multidex. Do I need to switch to Android Studio to solve this. I am unable to understand the basic reason behind the stack trace so that I can look for a solution for it.

\n\n

Note: I have google play services, IAP and OneSignal Sdk added to my app

\n',,'08/09/2017 03:19',HQ 46108186,'Java lottery game efficiency, swing','

I believe this is not the kind of question I should be asking here so I apologize in advance. I have an exam in 2 days and the teacher that was supposed to give me a lesson clearing out all of my questions had to cancel, so now I have no one to ask. I am resolving an exam from last year, and one of the questions is to make a little java program where we pretty much simulate a lottery game of 6 numbers. My question is about efficiency, the exam is written on paper and I feel like if I was to write everything I typed on the computer I would not have enough time, we have 90 minutes and this is only one of the problems, swing is not my strong point so that leads me to think that I could write this in much fewer lines. The public instance variable \'key\' is there to simulate a method from another class that generates a random key that we do not need to implement. We are only allowed to use FlowLayout, BorderLayout, CardLayout and GridLayout.

\n\n

public class Grupo2A extends JFrame {

\n\n
private JPanel panelCont = new JPanel();\nprivate JPanel panelUser = new JPanel();\nprivate JPanel panelResult = new JPanel();\nprivate JPanel p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11;\nprivate JLabel l1, l2, l3, l4, l5, l6, l7, l8, l9;\nprivate JTextField t1, t2, t3, t4, t5, t6;\nprivate JButton b1, b2, b3;\nprivate int[] userKey = new int[6];\nprivate CardLayout cl = new CardLayout();\nprivate GridLayout gl1 = new GridLayout(8, 1);\nprivate GridLayout gl2 = new GridLayout(3, 1);\npublic int[] key = {12, 13, 16, 22, 33, 40};\n\nprivate static final int WINDOW_HEIGHT1 = 600;\nprivate static final int WINDOW_HEIGHT2 = 150;\nprivate static final int WINDOW_WIDTH1 = 300;\n\npublic Grupo2A() {\n    panelCont.setLayout(cl);\n    panelCont.add(panelUser, \"panelUser\");\n    panelCont.add(panelResult, \"panelResult\");\n    panelUser.setLayout(gl1);\n    panelResult.setLayout(gl2);\n    setSize(WINDOW_WIDTH1, WINDOW_HEIGHT1);\n    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n    setLocationRelativeTo(null);\n    add(panelCont);\n\n    createComponents();\n    createPanelUser();\n    createPanelResult();\n    cl.show(panelCont, \"panelUser\");\n    setVisible(true);\n}\n\nprivate void createComponents() {\n\n    l1 = new JLabel(\"Lottery\");\n    l2 = new JLabel(\"1\");\n    l3 = new JLabel(\"2\");\n    l4 = new JLabel(\"3\");\n    l5 = new JLabel(\"4\");\n    l6 = new JLabel(\"5\");\n    l7 = new JLabel(\"6\");\n\n    t1 = new JTextField(10);\n    t2 = new JTextField(10);\n    t3 = new JTextField(10);\n    t4 = new JTextField(10);\n    t5 = new JTextField(10);\n    t6 = new JTextField(10);\n\n    b1 = new JButton(\"Play\");\n    b1.addActionListener(new ActionListener() {\n        @Override\n        public void actionPerformed(ActionEvent ae) {\n            int[] userKey = new int[6];\n            userKey[0] = Integer.parseInt(t1.getText());\n            userKey[1] = Integer.parseInt(t2.getText());\n            userKey[2] = Integer.parseInt(t3.getText());\n            userKey[3] = Integer.parseInt(t4.getText());\n            userKey[4] = Integer.parseInt(t5.getText());\n            userKey[5] = Integer.parseInt(t6.getText());\n            setUserKey(userKey);\n            l8.setText(\"You got \" + correctNumbers() + \" numbers\");\n            l9.setText(\"The key was: \" + Arrays.toString(key));\n            cl.show(panelCont, \"panelResult\");\n            setSize(WINDOW_WIDTH1, WINDOW_HEIGHT2);\n        }\n\n    });\n    b2 = new JButton(\"Clear\");\n    b2.addActionListener(new ActionListener() {\n        @Override\n        public void actionPerformed(ActionEvent ae) {\n            t1.setText(\"\");\n            t2.setText(\"\");\n            t3.setText(\"\");\n            t4.setText(\"\");\n            t5.setText(\"\");\n            t6.setText(\"\");\n        }\n\n    });\n\n    p1 = new JPanel();\n    p2 = new JPanel();\n    p3 = new JPanel();\n    p4 = new JPanel();\n    p5 = new JPanel();\n    p6 = new JPanel();\n    p7 = new JPanel();\n    p8 = new JPanel();\n    p9 = new JPanel();\n    p10 = new JPanel();\n    p11 = new JPanel();\n\n}\n\nprivate void createPanelUser() {\n    p1.add(l1);\n    panelUser.add(p1);\n    p2.add(l2);\n    p2.add(t1);\n    panelUser.add(p2);\n    p3.add(l3);\n    p3.add(t2);\n    panelUser.add(p3);\n    p4.add(l4);\n    p4.add(t3);\n    panelUser.add(p4);\n    p5.add(l5);\n    p5.add(t4);\n    panelUser.add(p5);\n    p6.add(l6);\n    p6.add(t5);\n    panelUser.add(p6);\n    p7.add(l7);\n    p7.add(t6);\n    panelUser.add(p7);\n    p8.add(b1);\n    p8.add(b2);\n    panelUser.add(p8);\n}\n\nprivate void createPanelResult() {\n    l8 = new JLabel(\"You got \" + correctNumbers() + \" numbers\");\n    l9 = new JLabel(\"The key was: \" + Arrays.toString(key));\n    b3 = new JButton(\"Ok\");\n    b3.addActionListener(new ActionListener() {\n        @Override\n        public void actionPerformed(ActionEvent ae) {\n            cl.show(panelCont, \"panelUser\");\n            setSize(WINDOW_WIDTH1, WINDOW_HEIGHT1);\n        }\n\n    });\n    p9.add(l8);\n    p10.add(l9);\n    p11.add(b3);\n    panelResult.add(p9);\n    panelResult.add(p10);\n    panelResult.add(p11);\n}\n\nprivate int correctNumbers() {\n    int cont = 0;\n    for (int i = 0; i < userKey.length; i++) {\n        for (int j = 0; j < key.length; j++) {\n            if (userKey[i] == key[j]) {\n                cont++;\n                break;\n            }\n        }\n    }\n    System.out.println(cont);\n    return cont;\n}\n\nprivate void setUserKey(int[] userKey) {\n    this.userKey = userKey;\n}\n
\n\n

}

\n',,'08/09/2017 03:30',LQ_CLOSE 46108581,'No provider for ChildrenOutletContexts (injectionError)','

I am getting the following error when using Angular CLI to generate a routing module for my application:

\n\n
ERROR Error: No provider for ChildrenOutletContexts!\n    at injectionError (core.es5.js:1169)\n    at noProviderError (core.es5.js:1207)\n    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (core.es5.js:2649)\n    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKeyDefault (core.es5.js:2688)\n    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKey (core.es5.js:2620)\n    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_.get (core.es5.js:2489)\n    at resolveNgModuleDep (core.es5.js:9481)\n    at NgModuleRef_.webpackJsonp.../../../core/@angular/core.es5.js.NgModuleRef_.get (core.es5.js:10569)\n    at resolveDep (core.es5.js:11072)\n    at createClass (core.es5.js:10936)\n
\n\n

I generated the routing module with Angular CLI like this:

\n\n
ng generate module --routing App\n
\n\n

This is the contents of the routing module:

\n\n
import { NgModule } from \'@angular/core\';\nimport { Routes, RouterModule } from \'@angular/router\';\nimport { MyComponent } from \'./my/my.component\';\n\nconst routes: Routes = [\n  {\n    path: \'\',\n    component: MyComponent,\n  },\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule],\n  declarations: []\n})\nexport class AppRoutingModule { }\n
\n\n

And this is what I have in my app.component.html:

\n\n
<div class=\"container\" role=\"main\">\n    <router-outlet></router-outlet>\n</div>\n
\n\n

What can be the reason of this error?

\n',,'08/09/2017 04:18',HQ 46109146,'Website - Coding | Header got rounded-Corners | Typed.js doesnt work','I\'m a complete beginner in creating websites, and that\'s why this problem may be dumb, but just ignore that fact and help me please:\r\nMy Problem is that typed.js doesn\'t work(Like i said i am complete beginner) for some reason, please try to fix that.\r\nSecond Problem is that the Header has rounded Corners, even if i didnt said to do that \r\nCode for Problem 1 :\r\n\r\n \r\n \r\n \t\r\n\t\r\n \r\n\r\nCode for Problem 2:\r\n\r\n \r\n \t
\r\n
\r\n
\r\n
\r\n

Fresh. Designz

\r\n
\r\n
\r\n \t .navbar {\r\n \t\t border-radius: none;\r\n \t \tleft: 0;\r\n \t\t margin:0;\r\n padding:0;\r\n \t\t width: 100\%;\r\n \theight: 50px;\r\n \t\t background: white;\r\n \t\t position: fixed;\r\n \t\t\t z-index: 100;',,'08/09/2017 05:20',LQ_EDIT 46109211,'Cherry-Picking few commits from another branch','

I have a scenario where in i dont want to cherry pick a specific commit but a range of git commits from remote.\nI can do force pull with hard option but that will get all the commits including latest changes from remote.\nPlease suggest, how can i get a pick range of commits from remote.

\n\n
\n\n

For instance, this is what i am trying my head at.

\n\n

git checkout -b newbranch 62ecb3

\n\n

git rebase --onto master 76cada, 56qwqw, 46erer, etc

\n',,'08/09/2017 05:26',HQ 46109358,'how to create a cron expression for every 2 weeks','

Here is cron expression I tried 0 0 0 */14 * ? it is giving following schedules

\n\n

Start Time:- Friday, September 8, 2017 1:25 AM

\n\n

Next Scheduled :-

\n\n
1.  Friday, September 15, 2017 12:00 AM\n2.  Friday, September 29, 2017 12:00 AM\n3.  Sunday, October 1, 2017 12:00 AM\n4.  Sunday, October 15, 2017 12:00 AM\n5.  Sunday, October 29, 2017 12:00 AM\n
\n\n

this expression is working for every 2 weeks in every month, but my requirement is it has to run for every 2 weeks, I mean after executing sept 29th, nxt schedule should be October 13 but it is scheduling for October 1

\n',,'08/09/2017 05:39',HQ 46109453,'when i click on a check box in header all the below checkbox should be checked','[enter image description here][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/5fItf.png\r\n\r\nPlease help me out. My code is\r\n\r\n\r\n\r\nPlease help me out. My code is\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\nPlease help me out. My code is\r\nThis is for my grid id\r\n\r\n ',,'08/09/2017 05:47',LQ_EDIT 46109465,'App not compatible with buildpack - Heroku','

When I run git push heroku master this is what I get:

\n\n
C:\\Users\\Emanuele-PC\\Desktop\\project-mm-beta>git push heroku master\nCounting objects: 3, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100\% (2/2), done.\nWriting objects: 100\% (3/3), 505 bytes | 0 bytes/s, done.\nTotal 3 (delta 0), reused 0 (delta 0)\nremote: Compressing source files... done.\nremote: Building source:\nremote:\nremote: -----> App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz\nremote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure\nremote:\nremote:  !     Push failed\nremote: Verifying deploy...\nremote:\nremote: !       Push rejected to project-mm-beta.\nremote:\nTo https://git.heroku.com/project-mm-beta.git\n ! [remote rejected] master -> master (pre-receive hook declined)\nerror: failed to push some refs to \'https://git.heroku.com/project-mm-beta.git\'\n
\n\n

The code I am trying to deploy is just one file (it\'s a test because it\'s my first time using Heroku) and it\'s written in Python. I have already set the buildpack (python) but it still doesn\'t work. How can I solve?

\n',,'08/09/2017 05:47',HQ 46109620,'HTML How do I change my address bar icon?','

I was wondering what code do I use to change my address bar icon? I have my 16x16.png file ready. It is in the same folder as my home.html on my desktop.

\n\n

Also for the folder being on my desktop, what do I use as the directory? I quite do not understand what to put.

\n',,'08/09/2017 06:00',LQ_CLOSE 46109812,'Steps to Install and run headless chrome browser on centos 6.5 using chrome driver','

I need to install chrome browser on centos 6.5, Here i need to automate some web gui. I have installed chrome driver. Can anyone please provide the steps and download link of chrome-61 and how to install it. My operating system does not have any Gui. Kindly provide the commands.

\n\n

I am using java selenium.

\n\n

Thanks in advance

\n',,'08/09/2017 06:14',HQ 46110872,'using functions in python.... help me! please','I had an assessment for my programming class about calculating insurance using functions. This is the code I was trying to get work but unfortunately I failed:\r\n\r\n import time\r\n \r\n def main(): \r\n print(\'Welcome to \"Insurance Calculator\" \')\r\n type_I, type_II, type_III = inputs()\r\n calculationAndDisplay()\r\n validation()\r\n time.sleep(3) \r\n \r\n def inputs():\r\n try:\r\n type_I = int(input(\"How many Type I policies were sold? \"))\r\n type_II = int(input(\"How many Type II policies were sold? \"))\r\n type_III = int(input(\"How many Type III policies were sold? \")) \r\n except ValueError:\r\n print(\"Inputs must be an integer, please start again\")\r\n inputs()\r\n return type_I, type_II, type_III\r\n \r\n def calculationAndDisplay():\r\n type_I *= (500/1.1)\r\n type_II *= (650/1.1)\r\n type_III *= (800/1.1)\r\n print(\"The amount of annual earned for type_I is: $\", type_I)\r\n print(\"The amount of annual earned for type_I is: $\", type_II)\r\n print(\"The amount of annual earned for type_I is: $\", type_III)\r\n \r\n def validation():\r\n cont = input(\"Do you wish to repeat for another year? [Y/N]: \")\r\n if cont == \'Y\' or cont == \'y\':\r\n main()\r\n elif cont == \'N\' or cont == \'n\':\r\n print(\'Thank You! ------ See You Again!\') \r\n else:\r\n print(\"I\'m sorry, I couldn\'t understand your command.\")\r\n validation()\r\n \r\n main()\r\n\r\n\r\nI eventually got it to work by cramming all of the input, calculation, and display into one function. I just want to know how I could have made it work the way intended.... Thanks (this is my first time posting so I apologise if I made any mistakes while posting).',,'08/09/2017 07:23',LQ_EDIT 46110930,'Write sql query to Entity Framwork',' select * from [InterViewerComment] where commentID in(\r\n select max(commentID) as commentID from [InterViewerComment] where jobID=45 group by qenID) \r\n\r\nThis Query is correct in SQl but i want to re write it in EntityFramwork\r\nbasically i want latest comment for each qenID based on job ID',,'08/09/2017 07:26',LQ_EDIT 46110952,'why printf() is being partial here','I\'m wondering why printf() when provided an array and no formatting options, successfully prints character arrays but while using integer arrays the compiler throws a warning and a garbage value is printed.\r\n\r\nHere\'s my code : \r\n[![enter image description here][1]][1]\r\n\r\n\r\nand here\'s my output :\r\n[![][2]][2]\r\n\r\nwhy this behavior by printf()?\r\n [1]: https://i.stack.imgur.com/BhE4p.png\r\n [2]: https://i.stack.imgur.com/SFfNz.jpg',,'08/09/2017 07:28',LQ_EDIT 46111595,'How can i see new entries without refreshing the page?','In my `page.html` using ngIf , data is fetched from local storage using below code:\r\n\r\n
    \r\n
  • \r\n {{elem.title}} {{elem.description}}\r\n \r\n \r\n
  • \r\n
\r\n\r\n\r\nOn this same page i have a form to add new data, but when i add and save, i have to load the page from menu again to see the new data entered, how can this load instantly ?\r\n\r\nThis is how my page looks -\r\n[![enter image description here][1]][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/4qxFm.png\r\n\r\n> Please guide',,'08/09/2017 08:05',LQ_EDIT 46111656,'Must websockets have heartbeats?','

When I read about websockets, heartbeats are usually mentioned as a must have. MDN even writes about a special opcode for heartbeats.

\n\n

But are heartbeats a mandatory part of websockets? Do I have to implement it or else my websockets will be terminated by the browsers or some other standards?

\n',,'08/09/2017 08:09',HQ 46111749,'Adding a bindingRedirect to a .Net Standard library','

I have a .Net Standard library, and I\'m getting an error when trying to use one of the dependant libraries, which I believe is down to a version conflict. In an old style .Net Class library, I might add something like this:

\n\n
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"Newtonsoft.Json\" publicKeyToken=\"30ad4fe6b2a6aeed\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-10.0.0.0\" newVersion=\"10.0.0.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n</configuration>\n
\n\n

But, I obviously can\'t do that in a Net Standard library; so, my question is, what is the strategy for addressing such issues in the .Net Standard world?

\n',<.net><.net-standard>,'08/09/2017 08:14',HQ 46111834,'Format Curly Braces on Same Line in C++ VSCode','

I\'m using the C++ Extension for VSCode (Visual Studio Code).

\n\n

Currently, I have the setting \"C_Cpp.clang_format_formatOnSave\" set to true.

\n\n

This format\'s my code when I save my C++ file. But the format results in curly braces on new lines rather than on the same line.

\n\n

Current C++ VSCode Formatted

\n\n
for (int i = 0; i < 10; i++)\n{\n    // ...\n}\n
\n\n

What I Want C++ VSCode Formatted Code to Look Like

\n\n
for (int i = 0; i < 10; i++) {\n    // ...\n}\n
\n\n

I also have editor.wrappingIndent set to \"same\".

\n\n

How can I make curly braces in C++ format on the same line in Visual Studio Code?

\n',,'08/09/2017 08:18',HQ 46112258,'How do I get current user in .NET Core Web API (from JWT Token)','

After a lot of struggling (and a lot of tuturials, guides, etc) I managed to setup a small .NET Core REST Web API with an Auth Controller issuing JWT tokens when stored username and password are valid.

\n\n

The token stores the user id as sub claim.

\n\n

I also managed to setup the Web API to validate those tokens when a method uses the Authorize annotation.

\n\n
 app.UseJwtBearerAuthentication(...)
\n\n

Now my question:\nHow do I read the user id (stored in the subject claim) in my controllers (in a Web API)?

\n\n

It is basically this question (How do I get current user in ASP .NET Core) but I need an answer for a web api. And I do not have a UserManager. So I need to read the subject claim from somewhere.

\n',,'08/09/2017 08:41',HQ 46112293,'Event that triggers when the application is forced ended using task manager','

Is there anything I can do with my program wherein I have to do something when my application has been terminated using task manager?

\n\n

I hope you can help me in this matter.

\n\n

Thank you!

\n',<.net>,'08/09/2017 08:43',LQ_CLOSE 46112809,'Is it possible to load and unload jdk and custom modules dynamically in Java 9?','

I am beginner in JPMS and can\'t understand its dynamism. For example, in current JVM instance moduleA.jar is running. moduleA requires only java.base module. Now, I want

\n\n
    \n
  1. to load dynamically moduleB.jar that needs java.sql module and moduleC.jar
  2. \n
  3. execute some code from moduleB
  4. \n
  5. unload moduleB, java.sql, moduleC from JVM and release all resources.
  6. \n
\n\n

Can it be done in Java 9 module system?

\n',,'08/09/2017 09:12',HQ 46112893,'Android Room - Autogenerate Primary Key','

I\'m having an issue that I can\'t find any documentation for with Room for Android and auto generating the primary key.

\n\n

I\'ve got an entity class that looks sort of like this:

\n\n
@Entity\npublic class Preference {\n\n    @PrimaryKey(autoGenerate = true)\n    private int id;\n\n    public void setId(int id) {\n\n        this.id = id;\n\n    }\n\n}\n
\n\n

This is working fine when I\'ve set the id manually but when I don\'t set the primary key I\'m getting an error regarding the primary key being null. Looking at the autogenerated file I can\'t see anywhere that it would auto increment the primary key.

\n\n

So I guess my question is this: can you auto generate a primary key of a private member with a setter or would I need to manually auto generate my key in the setter?

\n',,'08/09/2017 09:16',HQ 46113057,'Swift tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) is not called','I have a Viewcontroller -> UIVIew -> UITableview.\r\n\r\n`tableView(_ tableView: UITableView, numberOfRowsInSection section: Int)` and `tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath)` is called but not `tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)` not called.\r\n\r\n \r\n\r\n class ViewcontrollerA : UIViewController , UITableViewDelegate , UITableViewDataSource {\r\n \r\n override func viewDidLoad() {\r\n super.viewDidLoad()\r\n \r\n self.doctortableView.delegate = self\r\n self.doctortableView.dataSource = self\r\n self.doctortableView.allowsSelection = true\r\n \r\n }\r\n \r\n func callTable() {\r\n \r\n doctortableView.frame = CGRect(......)\r\n view1.addSubview(doctortableView)\r\n doctortableView.isUserInteractionEnabled = true\r\n \r\n self.view.addSubview(view1)\r\n \r\n }\r\n \r\n //Tableview Functions\r\n \r\n //Number of Sections in Table\r\n func numberOfSections(in tableView: UITableView) -> Int {\r\n \r\n return 1\r\n }\r\n \r\n \r\n func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\r\n \r\n var count = Int()\r\n \r\n return count\r\n }\r\n \r\n \r\n func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\r\n \r\n var cell = UITableViewCell()\r\n \r\n return cell\r\n }\r\n \r\n func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\r\n \r\n //This function is not called\r\n }',,'08/09/2017 09:25',LQ_EDIT 46113078,'Pandas - add value at specific iloc into new dataframe column','

I have a large dataframe containing lots of columns.

\n\n

For each row/index in the dataframe I do some operations, read in some ancilliary ata, etc and get a new value. Is there a way to add that new value into a new column at the correct row/index?

\n\n

I can use .assign to add a new column but as I\'m looping over the rows and only generating the data to add for one value at a time (generating it is quite involved). When it\'s generated I\'d like to immediately add it to the dataframe rather than waiting until I\'ve generated the entire series.

\n\n

This doesn\'t work and gives a key error:

\n\n
df[\'new_column_name\'].iloc[this_row]=value\n
\n\n

Do I need to initialise the column first or something?

\n',,'08/09/2017 09:26',HQ 46113376,'Querying in MongoDB Compass','

Just a quick question I hope someone can answer for me.

\n\n

I have a collection in MongoDB containing 84 thousand documents. The data looks something like this:

\n\n

\"Data\"

\n\n

There are several thousand documents containing the word \"BOND\" as the category name such as this:

\n\n

\"More

\n\n

\"Even

\n\n

And many thousands more...

\n\n

Currently in MongoDB Compass I am using the following query:

\n\n
{ \"Category\" : \"BOND\" }\n
\n\n

But of course this just returns 1 document that where the Category is BOND.

\n\n

Can anybody tell me how I can query to find all documents where the field name \"Category\" contains the word \"BOND\" within it?

\n\n

Many thanks,\nG

\n',,'08/09/2017 09:41',HQ 46113432,'Use if in sql-server','I have a small query in my stored procedure:\r\n\r\n(case when t.status =4 and (select top 1 nd.status from tableND nd where nd.Code= t.Code order by nd.ID desc)=4 \r\n then 6 else t.status end) as status \r\nfrom tableTC t\r\n\r\nThe problem is the speed performance too slow. So, I wanna change it into another query.\r\nWhat should i do now ?',,'08/09/2017 09:43',LQ_EDIT 46114050,'if it\'s start of the month...do this?','

I want my code to empty a specific text file, when it is the beginning of each month. I have this code but it doesn\'t seem to work, do I have something wrong with the syntax maybe?

\n\n
public void monthlyCleanse(File f){\n\n    LocalDate localDate = LocalDate.now();\n\n    String d = DateTimeFormatter.ofPattern(\"dd\").format(localDate);\n\n    System.out.println(d);\n\n    if(d.equals(\"01\")){\n\n\n        \"filename.txt\".replace(toString().valueOf(f), \"\");\n    }\n}\n
\n\n

As you can see I am changing the format to only show the day of the month, then I am checking if that day equals \"01\" then do something...which is to empty a text file.

\n\n

Then i am calling it here...

\n\n
    monthlyCleanse(new File(\"filename.txt\"));\n
\n\n

How can i make sure that this file is emptied?

\n',,'08/09/2017 10:12',LQ_CLOSE 46114325,'go lang try exception alternative for protect not crash application','i have on golang application for scrape urls, problems is same time crash and return this error :\r\n\r\npanic: runtime error: slice bounds out of range\r\n\r\n goroutine 1 [running]:\r\n main.dom6(0x187d4140, 0x8, 0x187d4179, 0x5, 0x187c0800, 0x6, 0x13, 0x83007cb)\r\n /root/sswork.go:326 +0x6b\r\n main.sub(0x187d4140, 0x8, 0x84464e0, 0x6, 0x6, 0x187d4140, 0x8, 0x187d4179, 0x5, 0x187c0800, ...)\r\n /root/sswork.go:298 +0xb3\r\n main.main()\r\n /root/sswork.go:615 +0xccb\r\n \r\n\r\non line 298 is this function :\r\n\r\n 294: // try our list of substitutions, if one works return it\r\n 295: func sub(str string, xs []subs, u string, p string, h string) string {\r\n 296:\tfor _, x := range xs {\r\n 297:\t\tif strings.Contains(str, x.pattern) {\r\n 298:\t\t\treturn strings.Replace(str, x.pattern, x.fn(u, p, h), 1)\r\n 299:\t\t}\r\n 300:\t}\r\n 301:\treturn str\r\n 302:}\r\n\r\nhow i can solve my problem for not crash anymore application ?',,'08/09/2017 10:25',LQ_EDIT 46115045,'unable to generate proper output',' \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n\r\nWhat is wrong with above android manifest.xml? \r\nEverytime my app is crashing. I m new to stackoverflow so didnt know how to post so i just copy pasted.\r\n',,'08/09/2017 11:05',LQ_EDIT 46115475,'Remove last string value in foreach loop','

I have a loop in php

\n\n
foreach($Array as $key =>$value) \n {\n     $TotalLine .=  \" Qualification =\".$value.\" OR \";\n }\n  echo $TotalLine;\n
\n\n

Prints

\n\n
  Qualification =1 OR Qualification =2 OR Qualification =3 OR Qualification =4 OR\n
\n\n

Now i need to remove last OR in that line, Desired Output must look like

\n\n
 Qualification =1 OR Qualification =2 OR Qualification =3 OR Qualification =4 \n
\n\n

How to do this. Any help appreciated.

\n',,'08/09/2017 11:28',LQ_CLOSE 46115503,'Canvas in Google Chrome 61.0.3163.79 are too slow on Linux','

I recently updated Google Chrome to the 61.0.3163.79 version and it was suddenly very slow with canvas. This issue only appears on Linux.

\n\n

For exemple, http://vincentgarreau.com/particles.js/ was 60 FPS before the Chrome update, and now it run at 2 FPS.

\n\n

What\'s wrong with the new Google Chrome update ?

\n\n

P.S: Chromium 61.0.3163.79 works fine on my computer.

\n',,'08/09/2017 11:30',HQ 46115901,'Set time but for every day in ruby','I am new to Ruby and I made something to test the time but i dont \r\nknow how i create a fix time for every day.If i would want to use it i would need to change it every day. Got some tips for me?\r\nThis is the Code:\r\n \r\n time1 = Time.new\r\n puts time1.strftime(\"\%H:\%M:\%S\")\r\n # | \r\n # V Change here\r\n t = Time.new(2017, 9, 8, 14, 30, 0)\r\n\r\n dist = ((t - time1) /60 ).round\r\n dist1 = dist/60\r\n dist2 = dist\r\n\r\n while dist2 > 60 \r\n dist2 = dist2 -60\r\n end\r\n puts \"just #{dist1} hours and #{dist2} min left.\"',