texts
sequence | tags
sequence |
---|---|
[
"How to do recurring code review efficiently in Bitbucket.org?",
"In our company, we are using Bitbucket cloud edition. I'm wondering, do you guys have some ways of making recurring code review (I once did code review, author fixed comments, and then I come back to review again) more pleasant and easy?\n\nRight now, after I'm going back to code review I have several problems:\n\n\nOld comments are accessible only through button \"Outdated comments\" - I'd prefer have every comment in respective place, when I'm reviewing but it can be marked that it is outdated\nComments on removed files are very hard to review, because they are only accessible through Activity tab on the right - someone forgot doing git mv\nI miss button \"Needs more work\" which indicated that I already reviewed this code review and author didn't do any new commits\nLast but not least - why bitbucket is soooo slow???\n\n\nIf you guys have some ideas how to make reviewing code in Bitbucket cloud better, I'd appreciate hearing your tips.\n\nRegards,\nSebastian"
] | [
"git",
"bitbucket",
"bitbucket-cloud"
] |
[
"Create a strategy based on built-in indicators",
"I can create strategy using built-in methods, like sma or crossover.\nBut can I create strategy which is using built-in indicator? Some like that:\n\nobv = Indicators.OBV() // Trying to use built-in OBV indicator\nobv_sma = sma(obv)\n\nif (crossover(obv, obv_sma)) {\n strategy.entry(\"OBV is high\", strategy.long)\n}"
] | [
"pine-script"
] |
[
"Transferring to ftp site using HttpWebRequest",
"I'm trying to transfer an Excel file to an sftp site and my code executes properly, but I do not see the file on the site.\n\nprivate static void SendFile(string FileName)\n{\n FileStream rdr = new FileStream(FileName + \".csv\", FileMode.Open);\n HttpWebRequest req = (HttpWebRequest)WebRequest.Create(\"http://sftp.somesite.com\");\n HttpWebResponse resp;\n req.Method = \"Post\";\n req.Credentials = new NetworkCredential(\"UN\", \"PW\", \"Domain\");\n\n req.ContentLength = rdr.Length;\n req.AllowWriteStreamBuffering = true;\n Stream reqStream = req.GetRequestStream();\n byte[] inData = new byte[rdr.Length];\n int bytesRead = rdr.Read(inData, 0, Convert.ToInt32(rdr.Length));\n\n reqStream.Write(inData, 0, Convert.ToInt32(rdr.Length));\n rdr.Close();\n}\n\n\nWhat am I doing wrong in the code above?"
] | [
"c#",
".net",
"visual-studio",
"ftp",
"sftp"
] |
[
"Unexpected end of file while trying if else condition",
"I am just starting to learn shell and am getting this error team.sh: line 9: syntax error: unexpected end of file when trying conditional if else:-\n\n #!/bin/sh\n result=2\n tmp=2\n if [ $result == $tmp ]\n echo \"App is running\"\n else\n echo \"App is down\"\n fi"
] | [
"shell"
] |
[
"Why is the top border of this inline element not displaying and why does using float correct this?",
"http://jsbin.com/ofojis/edit#preview\n\nhttp://jsbin.com/ofojis/edit#source\n\n\nWhy is the top border of this inline element not displaying?\nAdding float:left pushes this inline element down and it renders\nwell. How does float:left actually push it down, isn't it\nsupposed to push an element to the left?\nAlso, are you not supposed to use the margin property on inline\nelements like <span>?"
] | [
"css"
] |
[
"Client Socket on Java",
"In most Java client/server examles they use ServerSocket.accept() method to receive messages from the client. This method blocks the thread. This looks good becouse server does not do useless work and can answer immediately. But on the client side they use infinite loop like this:\n\nBufferedReader in = new BufferedReader (new InputStreamReader (socket.getInputStream ()));\nwhile (true)\n{\n String cominginText = \"\";\n try\n {\n cominginText = in.readLine ();\n System.out.println (cominginText);\n }\n catch (IOException e)\n {\n //error (\"System: \" + \"Connection to server lost!\");\n System.exit (1);\n break;\n }\n}\n\n\nThis looks bad because in my mind client does useless work.\nIs there some way to receive a message on the client side without doing useless work and immediately like on server side (may be should use listeners?)\n\n\"What do you mean by useless work? – Braj 31 mins ago \"\n\nfor example checking in loop is button pressed (we should use listener)\n\nwhile (!button.isPressed() ) { } is bad way."
] | [
"java",
"multithreading",
"sockets",
"blocking",
"listeners"
] |
[
"percona replication change master",
"I'm trying to set up replication between two MySQL servers. From the slave I log in as follows:\n\n mysql --host=10.32.8.187 --user=repl --password=********\n\n\nMy CHANGE MASTER statement:\n\nCHANGE MASTER TO \nMASTER_HOST='10.32.8.187', \nMASTER_USER='repl', \nMASTER_PASSWORD='********', \nMASTER_LOG_FILE='mysqld-bin.000006', \nMASTER_LOG_POS=632;\n\n\nBut Im getting the following error:\n\nERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation\n\n\nWhen I run show grants I get the following\n\nGrants for [email protected].% \nGRANT RELOAD, PROCESS, SUPER, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl'@'10.32.8.%' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'\n\n\nSo surely I already have the SUPER privilege?\n\n(I'm running Percona-Server-55.)"
] | [
"mysql",
"percona"
] |
[
"CRUD in Hibernate with one-to-many mapping",
"I have three entities and three tables in database with their relation:\n\n Class person {\n\n int id;\n\n @OneToMany(mappedBy = \"person\", fetch = FetchType.LAZY)\n List<Comment> comments;\n\n @OneToMany(mappedBy = \"person\", fetch = FetchType.LAZY)\n List<CellPhone> cellPhones;\n\n }\n\n Class Comment {\n\n String content; \n\n @ManyToOne\n @JoinColumn(name = \"id\")\n Person person;\n\n }\n\n Class CellPhone {\n\n String mark; \n\n @ManyToOne\n @JoinColumn(name = \"id\")\n Person person;\n\n }\n\n\nDoes Hibernate support me to do something like that ? \n\n\nInsert a new person, it automatically inserts into CellPhone and Comment, not insert by every entity.\nDelete a person with given id, then automatic delete CellPhone and Comment with their relation by id of person ?\nLet's give a person id, it gets person with all Comments and CellPhones ?\nUpdate something in Comment and CellPhone of a person, and save a person, it will save CellPhone and Comment automatically ? \n\n\nIn general, I just want to set/get CellPhone and Comment for person object, and then call getPerson(person), save(person), or delete(person) ect without get(comment), save(comment) or delete(cellPhone)..\n\nPlease help me to clarify it. Thanks."
] | [
"java",
"hibernate"
] |
[
"Java inventory project",
"The question is: \nProject 5. Classes Inventory, ProductItem, ProductShoe, ProductPants, ProductShirt. Class Inventory is a collection of ProductItem instances. Class ProductItem is a base class, with private member unique integer product id and string product item description. Classes ProductShoe, ProductPants and ProductShirt inherit from ProductItem, each of these classes shall have private members reflecting at least three properties (quantity is one of them) for each product and corresponding setter and getter functions. Main application interacts with the user using keystrokes (console application) allowing him/her to list product items, create/show/edit product items.\nCode is as following:\n\n public class ProductItem {\n\n private int productid;\n private int productquantity;\n private String productdesc;\n\n\n //constructor : sets product id,quantity and description to 0 if no parameters given\n public ProductItem()\n {\n productid=0;\n productquantity=0;\n productdesc=\"No description given\";\n }\n\n //overload constructor : sets product id,quantity and description to whatever parameters given\n public ProductItem(int id, int quantity, String desc)\n {\n productid=id;\n productquantity=quantity;\n productdesc=desc;\n }\n\n //sets a new id for productid\n public void setid (int newid)\n {productid=newid;}\n\n //sets a new id for productquantity\n public void setquantity (int newquantity)\n {productquantity=newquantity;}\n\n //sets a new id for productdesc\n public void setdesc (String newdesc)\n {productdesc=newdesc;}\n\n //get function that returns productid\n public int getid()\n {return productid;}\n\n //get function that returns productquantity\n public int getquantity()\n {return productquantity;}\n\n //get function that returns productdesc\n public String getdesc()\n {return productdesc;}\n\n //method to output ProductId\n public void outputid()\n {System.out.println(\"Product Id: \" + productid);}\n\n //method to output ProductQuantity\n public void outputquantity()\n {System.out.println(\"Product Quantity: \" + productquantity);}\n\n //method to output ProductDesc\n public void outputdesc()\n {System.out.println(\"Product Description: \" + productdesc);}\n\n }\n\n__________________________________________________________________\n\nimport java.util.Scanner;\n//\npublic class Inventory extends ProductItem {\n\n //Show item\n public void printitem()\n {\n super.outputid();\n super.outputquantity();\n super.outputdesc();\n }\n\n //create item\n public ProductItem itemcreation()\n {\n ProductItem newitem = new ProductItem();\n Scanner keyboard = new Scanner (System.in);\n int newid;\n System.out.println(\"Enter new value for ID: \");\n super.setid(newid= keyboard.nextInt());\n int newquantity;\n System.out.println(\"Enter new value for Quantity: \");\n super.setquantity(newquantity= keyboard.nextInt());\n String newdesc;\n System.out.println(\"Enter new value for Description: \");\n super.setdesc(newdesc= keyboard.nextLine());\n return newitem;\n }\n\n //edit item\n public void itemediting ()\n {\n\n }\n\n\n\n\nI can not for the life of me fathom how i can have the user edit specific Objects of ProductItem such as ProductShit//ProductShoes//ProductPants or even harder their own created item. Any feed back will be greatly appreciated, this is 25% of my grade -_-"
] | [
"java",
"project",
"editing",
"inventory"
] |
[
"How do I create an ImageButton with a drawable src?",
"I have the following contents in a drawable called gray_button.xml:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n<shape\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:shape=\"oval\" >\n <size\n android:width=\"300dp\"\n android:height=\"300dp\" />\n <solid android:color=\"#666\"/>\n</shape>\n</selector>\n\n\nIn my app's main layout, I have the following section\n\n <ImageButton\n android:id=\"@+id/fab\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"end|bottom\"\n android:src=\"@drawable/gray_button\"\n android:layout_margin=\"160dp\"\n />\n\n\nUnfortunately, the button displays as a small rectangle instead of an oval.\nI am fairly certain I have done something stupid.\n\nHow can I make my button display the drawable properly?\n\n\n\nUpdate: Based on the given answer I've switched the drawable to the following but now it just displays as a large rectangle instead of an oval.\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:shape=\"oval\" >\n <size\n android:width=\"300dp\"\n android:height=\"300dp\" />\n <solid android:color=\"#000\"/>\n</shape>"
] | [
"android"
] |
[
"How to install android application in android without using adb?",
"i have just android terminal\n\n\ni dont have adb to install apk. \ni dont have double click on apk\nand install that application.\n\n\nso is there any command available using that i can install application on android shell?"
] | [
"android",
"apk",
"adb",
"android-install-apk"
] |
[
"Javascript function post and call php script",
"In html I have several buttons which are automatically made for each object in the database with a particular status. Each button gets its own id.\n\necho '<Button id=\"button'.$counter.'\" onClick=\"clickedbutton('.$counter.', '.$row['OrderID'].')\" >'.\"<center>\".$row['OrderID'].\"<br>\".\"</center>\".'</Button>';\n\n\nThe button calls the javascript function clickedbutton and gives it the number of the button and the orderid of that button.\n\nfunction clickedbutton(buttonid,orderid){\nbuttonid = \"button\" + buttonid;\n\n}\n\n\nThis function loads in the number of the button and makes it button0, button1 etc. The orderid is also succesfully passed through. Now in the function I want to call an external php script, but also orderid must be passed through to the script.\n\n<?php\n //connect to database\n include_once('mysql_connect.php');\n\n // Select database\n mysql_select_db(\"test\") or die(mysql_error());\n\n // SQL query\n $strSQL = \"update orders set OrderStatus = 'In Progress' where OrderID = '\" + orderid + \"'\";\n\n mysql_close();\n?>\n\n\nI know about the mysqli protection and all, I will adjust that later. Now I want to focus on the question above, how to call and pass through the variable orderid to the phpscript."
] | [
"php",
"javascript",
"jquery",
"html",
"mysql"
] |
[
"Can't inspect element in frame",
"How to get value in frame, It's not have children so I don't know how to get value in this frame, have any solution for it? I'm using Python with pywinauto, I tried log it but this frame no data too"
] | [
"python",
"pywinauto"
] |
[
"Three.js - dealing with a large number of instances",
"I've been using three.js for a scene with a large number of 200-300 vertices instances (~2000). Right now I introduces some postprocessing effects with the EffectComposer and noticed some slowdowns.\n\nIs there any way to deal with slowness caused by a large number of instances (which are not visible at the same time in the scene at all times)?\n\nI've been creating my instances with\n\nvar newObject = object.clone();"
] | [
"javascript",
"three.js"
] |
[
"Clicking links on just opened pages using javascript",
"I have managed to open a web page with\n\nvar win = window.open(\"http://url.com\", '_blank');\n\n\nNow I want to find and click a link on that page. But\n\nvar link = win.document.getElementByClass(\"\");\n\n\nwon't find anything.\n\nHow can I find and click such a link?\nI only know its (unique) \"class\", but no ID."
] | [
"javascript",
"html",
"click",
"elements"
] |
[
"AWS Glue Python MemoryError",
"I have files in S3 that are checked with a Python script in AWS Glue. For each file I check the first line to see if the format is correct and then I register a row in Redshift in case of error and I move the file path in the same S3 bucket.\nThe code keeps running for each file until it raises an error of MemoryError. I use Maximum capacity = 1 for the Glue job and the files are no bigger than 200MB. If I monitor the memory usage it keeps increasing until a given point, then it keeps processing files until the error raises. Do you know what can be happening?\nfor key in get_matching_s3_keys("bucket", "", "x/x5d",""):\n print (key)\n print (resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)\n\n if( (key.split("/")[2] != "")):\n\n obj = s3.Object('bucket',key)\n filedata = obj.get()['Body'].read()\n gzipfile = BytesIO(filedata)\n \n file = key.split("/")[-1]#.split(".")[0]\n print(file) \n \n try: \n content = gzipfile.read()\n except ValueError:\n print ("read error!") \n \n print("content")\n #print (type(content)) \n fl = str(content).split("\\n")[0]\n #print (fl)\n print("split")\n\n tf = file.split("_")[0] \n cd = file.split("_")[1]\n cc = file.split("_")[2]\n da = file.split("_")[3].split(".")[0]\n ve = key.split("/")[-1].split(".")[1]\n \n tz = pytz.timezone('Europe/Madrid')\n dc = datetime.datetime.now(tz).strftime("%Y/%m/%d %H:%M:%S")\n st = 1\n\n if ";" not in fl:\n de = "error is X"\n res2 = con1.query("INSERT INTO table (x,y,z,zz,zzz,zzzz,yy,yyy,yyyy) VALUES ('"+file+"','"+tf+"','"+cd+"','"+cc+"','"+da+"','"+str(ve)+"','"+dc+"','"+str(st)+"','"+de+"')") \n \n \n #print ("; error!")\n ##fil a file and store it in S3 under \n client = key.split("/")[0]\n\n \n keydes = client+"/x/y/x5d/"+"O_"+file\n #print (keydes)\n content = "error is x "+file\n s3.Bucket('consumsclients').put_object(Key=keydes, Body=content) \n \n keydesfile = cd+"/proc/files/x5d/"+file\n \n #print ("x/"+key)\n #print ("dest: "+keydesfile)\n \n s3.Object("bucket",keydesfile ).copy_from(CopySource="bucket/"+key)\n s3.Object('bucket', key).delete()#delete the file so the process part doesn't treat it\n\nI have tried to use the garbage collector just in case for the variables involved in reading each file. Though the error still appears\ndel filedata\ndel gzipfile\ndel obj\ndel content\ngc.collect()\n\n exec(code, run_globals)\n File "/tmp/glue-python-scripts-6r3bulia/filescontrol.py", line 241, in <module>\nMemoryError\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/tmp/runscript.py", line 142, in <module>\n raise e_type(e_value).with_traceback(new_stack)\n File "/tmp/glue-python-scripts-6r3bulia/filescontrol.py", line 241, in <module>\nMemoryError"
] | [
"python",
"amazon-web-services",
"amazon-s3",
"aws-glue"
] |
[
"Google Timeline Visualization don't change series row height on slider interaction",
"So I've got a timeline with data in it that can be concurrent...\n\n\n\nWhen I move the ChartRangeSlider to a different timeframe, some of the timeline bars will either disappear or show because there is nothing happening in the timeframe that is active.\n\nThese is how the timeline and the range slider are set up. I don't have any event listeners running...\n\n // Configure range slider\n var timelineRangeSlider = new google.visualization.ControlWrapper({\n 'controlType': 'ChartRangeFilter',\n 'containerId': 'timeline-filter',\n 'state': \n {\n 'range': \n {\n 'start': currentTime,\n 'end': fourWeek \n }\n },\n 'options': \n {\n 'filterColumnIndex': 4,\n 'ui': \n {\n 'chartType': 'ScatterChart',\n 'chartOptions': \n {\n 'width': '100%',\n 'height': '50',\n 'chartArea': \n {\n 'width': '80%', // make sure this is the same for the chart and control so the axes align right\n 'height': '80%'\n },\n 'hAxis': \n {\n 'baselineColor': 'none'\n }\n },\n 'chartView': \n {\n 'columns': [4,6]\n }\n }\n }\n });\n\n // Configure timeline\n var timeline = new google.visualization.ChartWrapper({\n 'chartType': 'Timeline',\n 'containerId': 'timeline-chart',\n 'options': \n {\n 'timeline': \n {\n 'showBarLabels': false\n },\n 'width': '100%',\n 'height': '325',\n 'tooltip': \n {\n 'isHtml': true\n },\n 'chartArea': \n {\n 'width': '80%', // make sure this is the same for the chart and control so the axes align right\n 'height': '80%'\n }, \n },\n 'view': \n {\n 'columns': [0,1,2,3,4,5]\n } \n });\n\n\nHow can I stop this from happening, and have each of the four separate rows (one for each series) have a static height that won't change when I interact with the range slider?"
] | [
"javascript",
"charts",
"google-visualization",
"timeline",
"gantt-chart"
] |
[
"How can I replace characters in a string using a pointer? (in c code)",
"How can I replace characters in a string using a pointer? (in c code)\n\nHere's my code:\n\n#include <stdio.h>\n#include <string.h>\n\nunsigned char code[] = \"Hello world!\\n\";\nmain()\n{\n\n printf(\"String Length: %d\\n\", strlen(code));\n printf(\"Original String: %s\\n\", code);\n\n char &code[7] = \"W\"; \n char &code[8] = \"a\";\n char &code[9] = \"l\";\n char &code[10] = \"e\";\n char &code[11] = \"s\";\n\n printf(\"New String: %s\\n\", code);\n\n}"
] | [
"c",
"pointers",
"reference"
] |
[
"How do i move data from one column to another in mongodb?",
"I want to move my data from the column \"demographic.education\" into \"demographic.school\". How could i do this?\n\nFor example:\n\ndb.users.update({\"demographic.education\":{$exists: true, $ne: \"\"}}, {$set: {\"demographic.school\":demographic.education}})"
] | [
"mongodb"
] |
[
"Full screen in WPF application",
"I am developing a WPF application which will be displayed in Full screen.\nIn addition, the application should work on many tablets of multiple dimensions.\nI'd like my application to run in full screen independently from its dimensions.\n\nWhat is the best practice to accomplish this task?"
] | [
"c#",
"wpf",
"xaml",
"fullscreen"
] |
[
"Selection is lost if you scroll beyond the grids buffer zone",
"Selection is lost if you scroll beyond the grids buffer zone (5 pages default).\n\nSteps to reproduce:\n\n\nselect any item from the first page\nscroll through each cached page until a new set of pages are loaded (scroll to pass the buffer zone) - default 5 pages\nselection is lost (see button label - \"Selected (0)\" )\n\n\nextjs version: 6.7.0\n\nsee fiddle"
] | [
"javascript",
"extjs",
"extjs6-classic"
] |
[
"Spreadsheet Upload Variable Empty",
"I am currently trying to debug my web application and came across something that is very puzzling. I have a web application that is live on Hostgator and part of that application parses a XLS Spreadsheet and drops the information in the database. Well the live version works with no problem. When I pulled the web application down to my local machine it seems the variable that holds the spreadsheet is EMPTY!! I didn't change any code whatsoever!! So now Im sitting her asking myself is there something wrong with my server settings? I wanted to post this to see if you guys had any idea why this could be happening. Here is my code \n\npublic function saveSpreadsheet($uploadedFile) {\n if(!empty($uploadedFile) && !empty($uploadedFile['tmp_name'])) {\n if($uploadedFile['error'] == UPLOAD_ERR_OK) {\n $pulledData = $this->extract($uploadedFile['tmp_name']);\n die(debug($pulledData));\n\n\nFor some reason #pulledData is empty on my local machine, but works in the live version. In addition, when I debug uploadedFile I can see results, so uploadedFile being empty is out of the question. Any ideas? \n\nResults from die(debug($uploadedFile)); \n\n Array\n(\n[name] => SLTest1.xls\n[type] => application/vnd.ms-excel\n[tmp_name] => C:\\wamp\\tmp\\phpA7D0.tmp\n[error] => 0\n[size] => 1787904\n)\n\n/**\n * The method that calls extract method on the assigned adapter.\n * \n * @access public\n * @param mixed &$model\n * @param string $file\n * @return void\n */\npublic function extract(&$model, $file = null, $args = array()) {\n $ret = false;\n if (!$file) {\n return $ret;\n }\n $settings = $this->settings[$model->alias];\n $data = $this->_parseFile($file, $settings);\n if (!$data) {\n return $data;\n }\n $spreadsheet = $this->_toArray($data);\n $adapter =& $this->_getInstance($settings);\n if (method_exists($adapter, 'beforeExtract')) {\n $args = $adapter->beforeExtract($args);\n }\n if ($args !== false) {\n if (method_exists($adapter, 'extract')) {\n $ret = $adapter->extract($spreadsheet, $args);\n }\n if (method_exists($adapter, 'afterExtract')) {\n $ret = $adapter->afterExtract($ret, $args);\n }\n }\n\n return $ret;\n}\n\n/**\n * Takes the file path and checks if a file exists. If it doesn't,\n * method returns false. If it does exist the Spreadsheet_Excel_Reader\n * is returned.\n * \n * @access public\n * @param mixed $file\n * @return void\n */\npublic function _parseFile($file, $settings) {\n $path = $settings['file_path'];\n if (strpos($file, '/') !== false) {\n $pieces = explode('/', $file);\n $file = array_pop($pieces);\n $path = str_replace('//', '/', implode('/', $pieces));\n }\n $file = $path.'/'.$file;\n\n if (strpos($file, '.xls') === false && strpos($file, '.xlsx') === false) {\n if (file_exists($file.'.xls')) {\n $file .= '.xls';\n } else if (file_exists($file.'.xlsx')) {\n $file .= '.xlsx';\n } else if(strpos($file, '/tmp/') === false) {\n $file = false;\n }\n }\n\n $data = false;\n if ($file && file_exists($file)) {\n $data = new Spreadsheet_Excel_Reader($file, true);\n }\n return $data;\n}\n\n\nPlease keep in mind I did not write this plugin."
] | [
"php",
"apache",
"cakephp",
"cakephp-1.3"
] |
[
"Which local notification plugin should I be using with phonegap build?",
"It appears that there are four different 3rd party plugins to accomplish local notifications listed within phonegap build:\n\nhttps://github.com/GotCakes/Phonegap-LocalNotification/\n\nhttps://github.com/javamrright/cordova-plugin-local-notifications/\n\nhttps://github.com/simplec-dev/LocalNotification/\n\nhttps://github.com/katzer/cordova-plugin-local-notifications/\n\n(from https://build.phonegap.com/plugins)\n\nI've been using the last of the four (de.appplant.cordova.plugin.local-notification) but I'm curious to know (1) whether one of the other packages is the preferred solution and (2) why are there four independent projects within phonegap/cordova to accomplish the same task...?"
] | [
"cordova",
"phonegap-plugins",
"localnotification"
] |
[
"How to place a link on the middle of a div in height?",
"How do I place the link Refresh on the middle in height of the div nav_bar?\n\n<div id=\"nav_bar\">\n<a class=\"nav\" id=\"refresh\" href=\"#\">Refresh</a>\n</div>\n\n\nHere is a fiddle for more help\nhttp://jsfiddle.net/axuxT/"
] | [
"html",
"css"
] |
[
"What is the best approach for team sign in after user sign in to the application?",
"I have an user sign in option on my app for that i'm using token based approach for the session handling. But now i want to create teams for each users and identify which team his currently logged in into. So what is the best approach for the team related session handling."
] | [
"node.js",
"authentication",
"login"
] |
[
"max execution time on aws with rancher and lb on Laravel nova panel",
"Getting the 504 Gateway Time-out when the request more then 40 seconds. The project is working on AWS with rancher and loadbalancer, I don't think it's important but maybe I missing something here. \nThe server is working on docker with nginx and php7.3-fpm. Laravel project. The problem with the export a lot of data. I've updated php.ini with max_execution_time = 300 and max_input_time = 600, added fastcgi_read_timeout 1200; to nginx conf, and even added ini_set('max_execution_time', '1200'); to exported resource. I have no problem when am runing the server on my local machine, but always the same issue \"Getting the 504 Gateway Time-out - The server didn't respond in time.\" on the server."
] | [
"laravel",
"docker",
"amazon-ec2",
"laravel-nova",
"http-status-code-504"
] |
[
"gmaps4rails: multiple objects (json)",
"In the controller I would like to try something like this:\n\n@json = User.all.to_gmaps4rails\n@json << Admin.all.to_gmaps4rails\n\n\nBut thats not gonna work. Is there a standard implementation how to deal with it?"
] | [
"ruby-on-rails",
"ruby-on-rails-3",
"gmaps4rails"
] |
[
"Left justify the strings in wix",
"I am creating a setup of my one .Net Application using WIX 3.8.\nI am using strings variables for UI part.\nBut i am unable to justify the strings.\nHow can i achieve the it?\n\nBelow is the code sample:-\n\n<Control Id=\"lbl\" Type=\"Text\" Text=\"!(loc.STR)\" X=\"30\" Y=\"200\" Width=\"290\" Height=\"50\" />\n\n\nHere the STR is defined as a localize variable:\n\n<String Id=\"STRDBDROP\">\nIf you are having trouble seeing the Justify options, please make sure that the zoom on your computer is set to 100%. You can change the zoom using the Ctrl\n</String>"
] | [
"string",
"wix",
"windows-installer",
"wix3.8"
] |
[
"Unable to configure views, urls.py SyntaxError: invalid syntax",
"I'm having issue while configuring views and I am following django 1.5 official tutorial.\nHere is my Code for polls/urls.py.\n\nfrom django.conf.urls import patterns, url\n\nfrom polls import views\n\nurlpatterns = patterns ('', \nurl(r'^$', views.index, name='index')\nurl(r'^(?P<poll_id>\\d+)/$', views.detail, name='detail'), \nurl(r'^(?P<poll_id>\\d+)/results/$', views.results, name='reults'),\nurl(r'^(?P<poll_id>\\d+/vote/$', views.vote, name='vote'),\n\n)\n\n\nBelow is my polls/views.py\n\n from django.http import HttpResponse\n\ndef index(request):\nreturn HttpResponse(\"Hello, world. You're at the poll index.\")\n\ndef detail(request, poll_id):\nreturn HttpResponse(\"You’re looking at poll %s.\" % poll_id)\n\ndef results(request, poll_id):\nreturn HttpResponse(\"You’re looking at the results of poll %s.\" % poll_id)\n\ndef vote(request, poll_id):\nreturn HttpResponse(\"You’re voting on poll %s.\" % poll_id)\n\n\nIn polls/urls.py I've also tried \n url(r'^(?P\\d+)/detail/$', views.detail, name='detail'),\ninstead of \n url(r'^(?P\\d+)/$', views.detail, name='detail'),\nError I'm getting is\n\nFile \"C:\\Python27\\Scripts\\mysite\\polls\\urls.py\", line 7\n url(r'^(?P\\d+)/$', views.detail, name='detail'),\n ^\nSyntaxError: invalid syntax\n[31/Dec/2013 06:06:34] \"GET /admin/ HTTP/1.1\" 500 84890\n\nPlease help."
] | [
"python",
"django"
] |
[
"Advice needed with context menu items",
"I have a XML layout which has two edit text fields, one for \"title\" and the the other for \"story\",when the user enters his data in these text fields, and presses the back button , the entry gets saved in a list view as the title set.The list view is present in an activity say A1. Now A1 extends Activity. Also ,whenever an item in the list is \"long clicked\" a context menu appears, which has edit, delete and read buttons. Now if edit button is pressed I need to open another activity which can edit the data entered in the text fields corresponding to the item clicked, Also I'd be needing the id and the position of the item clicked in the list. I am using list variable of type ListView to add my adapter.Also I am checking the edit,delete and read options of the context menu in the \" public boolean onContextItemSelected(MenuItem item) \" procedure, How can I get the id and the position of the item clicked in the edit, read and delete options of the context menu?\n\nhere's some piece of code of activity A1:\n \"\n static id_item_clicked;\n\n@Override\npublic void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\n // here arg3 is the id of the item which is pressed\n registerForContextMenu(arg1);\n final long row_passed = arg3;\n Cursor c = (Cursor) arg0.getItemAtPosition(arg2);\n title = c.getString(c.getColumnIndex(DataHolder.KEY_TITLE));\n story = c.getString(c.getColumnIndex(DataHolder.KEY_STORY));\n ........\n\n@Override\npublic boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2,\n long arg3) {\n // TODO Auto-generated method stub\n id_item_clicked = arg3;\n return false;\n}\n\n\n @Override\npublic void onCreateContextMenu(ContextMenu menu, View v,\n ContextMenuInfo menuInfo) {\n // TODO Auto-generated method stub\n super.onCreateContextMenu(menu, v, menuInfo);\n menu.add(\"EDIT\");\n menu.add(\"READ\");\n menu.add(\"DELETE\");\n}\n\n@Override\npublic boolean onContextItemSelected(MenuItem item) {\n // TODO Auto-generated method stub\n if (item.getTitle() == \"EDIT\") {\n\n int position = list.getSelectedItemPosition();\n long item_id = list.getSelectedItemId();\n\n\n }\n if (item.getTitle() == \"READ\") {\n\n }\n if (item.getTitle() == \"DELETE\") {\n\n }\n return super.onContextItemSelected(item);\n} \""
] | [
"android"
] |
[
"Send alert message(data) from one login user session to another",
"I have a use case where a user (manager) creates a task (1st view) and another logged in user (employee) can view the task created (2nd view). If the employee rejects the task clicking reject button, an alert should notify the manager. How do I achieve this functionality? Thanks for any guidance."
] | [
"django",
"django-templates",
"django-messages",
"django-notification"
] |
[
"Is it possible to have a specific polling URL, to get the HttpSession status, but the polling itself should not extend the session?",
"Is it possible to have a specific polling URL, to get the HttpSession status, but the polling itself should not extend the session?\n\nThe idea is that the UI keeps polling the server, and automatically navigates to the logout page once the session has elapsed.\n\nAlso, is it possible to do this with web sockets? Can a HttpSession die while a WebSocket is still active? In that case, I could push the information to the client when the Session dies.\n\nEdit: To be more specific, I would like to know if there is something built-in in JavaEE: If I configure some exception in web.xml so that the a particular URL will be excluded from extending the HttpSession. In case WebSockets being alive doesn't affect the HttpSession, then I can use the open socket to inform the client that the session has ended."
] | [
"java",
"session",
"servlets"
] |
[
"How to reset the PrimaryLanguageOverride?",
"I have been going through the process of localizing my apps and in doing so I temporarily set the language to Chinese like this:\n\nApplicationLanguages.PrimaryLanguageOverride = \"zh-CN\";\n\n\nHowever, after commenting out the line and rebuilding / re-deploying, now my app is still stuck in Chinese instead of what my development machine's default language at the OS level (English)!\n\nHow do I reset this to go back to the default OS setting?"
] | [
"localization",
"win-universal-app"
] |
[
"What is the proper way to handle imported files in iOS 9?",
"My app includes the ability to open .plist files in it. My info.plist file has all the necessary entitlements, and opening the document in my app works fine. The problem is I don't know the proper way to handle imported files, especially after the application:openURL:sourceApplication:annotation: method is deprecated in iOS 9. Also, it is possible my app will be open to a list of local files when the file is imported, so I need to be able refresh that list when the file is received.\n\nThanks in advance for any help."
] | [
"ios",
"xcode",
"xcode7",
"ios9"
] |
[
"Code-signing fails when using aggregate targets on XCode 6.0/6.1",
"I use the Jenkins Build Server with the XCode plugin to generate my builds.\nAfter upgrading from XCode 5.1.1 I get an odd error with the aggregate target I use to generate all my apps at once, when I run the targets individually, the ipas get generated with no code signing issues.\nHowever when I run the aggregate target that mainly just runs each target sequentially (I don't parallelize the builds) I get this error:\n# Checking original app\n+ /usr/bin/codesign --verify -vvvv /Users/Shared/JenkinsRoot/workspace/XCodeVersionTest/build/MyMobileApp.app\nProgram /usr/bin/codesign returned 1 : [/Users/Shared/JenkinsRoot/workspace/XCodeVersionTest/build/MyMobileApp.app: code object is not signed at all\nIn architecture: x86_64\n]\nCodesign check fails : /Users/Shared/JenkinsRoot/workspace/XCodeVersionTest/build/MyMobileApp.app: code object is not signed at all\nIn architecture: x86_64\n\nDone checking the original app\n### Embedding 'provisioning/MobileEnterpriseABC2014.mobileprovision'\n+ /bin/rm -rf /var/folders/49/9mzjnxjs3fvf8qk6d8fkfsmh0000gn/T/LvDJMwHoHp/Payload/MyMobileApp.app/embedded.mobileprovision\nProgram /bin/rm returned 0 : []\n+ /bin/cp -rp provisioning/MobileEnterpriseABC2014.mobileprovision /var/folders/49/9mzjnxjs3fvf8qk6d8fkfsmh0000gn/T/LvDJMwHoHp/Payload/MyMobileApp.app/embedded.mobileprovision\nProgram /bin/cp returned 0 : []\n+ /usr/bin/codesign -d --entitlements /var/folders/49/9mzjnxjs3fvf8qk6d8fkfsmh0000gn/T/LvDJMwHoHp/entitlements_rawL2sNQDVD /var/folders/49/9mzjnxjs3fvf8qk6d8fkfsmh0000gn/T/LvDJMwHoHp/Payload/MyMobileApp.app\nProgram /usr/bin/codesign returned 1 : [/var/folders/49/9mzjnxjs3fvf8qk6d8fkfsmh0000gn/T/LvDJMwHoHp/Payload/MyMobileApp.app: code object is not signed at all\n]error: Failed to read entitlements from '/var/folders/49/9mzjnxjs3fvf8qk6d8fkfsmh0000gn/T/LvDJMwHoHp/Payload/MyMobileApp.app'\n\nMy build settings are fairly normal and are the same for all targets and the aggregate target.\n\nI can't quite tell what the issue is since the individual targets run perfectly fine, has anyone else run into this issue?\nThis happens in Xcode 6.0.1 and XCode 6.0 but does not happen in Xcode 5.1.1."
] | [
"ios",
"xcode",
"jenkins",
"codesign"
] |
[
"Change status bar color when orientation changes",
"So, I want to change systemNavigationBarColor and statusBarColor dynamically. Here's my attempt:\n\nvoid systemColors(Orientation orientation) {\nprint('orientation changed -> $orientation');\nif (orientation == Orientation.portrait) {\nSystemChrome.setSystemUIOverlayStyle(\n SystemUiOverlayStyle(\n systemNavigationBarColor: Colors.blue,\n statusBarColor: Colors.green,\n ),\n );\n} else {\n SystemChrome.setSystemUIOverlayStyle(\n SystemUiOverlayStyle(\n systemNavigationBarColor: Colors.green,\n statusBarColor: Colors.blue),\n );\n}\n\n\nNow, this function is called every time the orientation changes, before a return statement returning a Scaffold, inside a build function of a StatelessWidget; I've tried a StatefulWidget with the same results. \n\nThe logs confirm it. The orientation that is passed to the function is also the correct one.\n\nHowever, the UI only updates once, the first time the function is called, either in portrait or landscape orientation, and the UI is update with the specified colors for each scenario.\n\nWhen the orientation changes, although the function is called, the UI does not update.\n\nAny ideas why?\n\nThank you in advance :)"
] | [
"android",
"flutter",
"dart"
] |
[
"Segmentation Fault in pointers",
"I was trying to compare both \"arrays\" and \"pointers as arrays\". When I run part1 and part2 separately, they execute fine but when I run the whole code, I get segmentation fault.\n\n#include<stdio.h>\n\nint main(){\n int *p;\n int arr[5],i,var;\n\n //PART-1\n p=&var;\n for(i=0;i<5;i++){\n *(p+i)=i+1;\n }\n\n printf(\"\\n\\nPointers: \");\n for(i=0;i<5;i++){\n printf(\"%d \",*(p+i));\n }\n\n //PART-2\n for(i=0;i<5;i++){\n arr[i]=i+1;\n }\n\n printf(\"Array: \");\n for(i=0;i<5;i++){\n printf(\"%d \",arr[i]);\n }\n\n return 0;\n}\n\n\nThis code runs fine:\n\n#include <stdio.h>\n\nint main()\n{\n int *p;\n int arr[5],i,var;\n\n p=&var;\n for(i=0;i<5;i++){\n *(p+i)=i+1;\n }\n\n printf(\"\\n\\nPointers: \");\n for(i=0;i<5;i++){\n printf(\"%d \",*(p+i));\n }\n\n return 0;\n}"
] | [
"c",
"pointers"
] |
[
"Image file is not displayed, but url location is fetched correctly, also i get a type error in command line",
"from flask import Flask, render_template, request, redirect, url_for, flash\nimport json\nimport os.path\nfrom werkzeug.utils import secure_filename\n\napp=Flask(__name__)\napp.secret_key='h432hi5ohi3h5i5hi3o2hi'\n\[email protected]('/')\ndef home():\n return render_template('home.html')\n\[email protected]('/new', methods=['GET','POST'])\ndef new():\n if request.method == 'POST':\n urls={}\n if os.path.exists('urls.json'):\n with open('urls.json') as urls_file:\n urls= json.load(urls_file)\n\n if request.form['shortname'] in urls.keys():\n flash('hey the short name is already there, so you could try another..')\n return redirect(url_for('home'))\n\n f=request.files['file'] \n fullname=request.form['shortname'] + secure_filename(f.filename)\n f.save('C:/Users/Desktop/PythonFlaskNick/static/user_files/ ' + fullname)\n urls[request.form['shortname']]={'file':fullname} \n\n with open('urls.json','w') as urls_file:\n json.dump(urls,urls_file)\n return render_template('new.html',shortname=request.form['shortname'])\n else:\n return redirect(url_for('home'))\n\[email protected]('/<string:code>')\ndef redirect_to_url(code):\n if os.path.exists('urls.json'):\n with open('urls.json') as urls_file:\n urls = json.load(urls_file)\n if code in urls.keys():\n return redirect(url_for('static', filename='user_files/' + urls[code]['file']))\n\n\nif __name__==\"__main__\":\n app.run(debug=True)\n\n\nI create a html form: home.html with 2 fields: file and shortname and another form:new.html,that simply returns the successful upload of file. Afer uploading the input is push into urls.json file, now am entering localhost:5000/go (where go is shortname for an image file stored in dictionary) it fetches the location correctly but returns 404 error and image file is not displayed, though i have it in my urls.json file. Kindly rectify this problem. And a message in cmd TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement."
] | [
"python-3.x",
"flask"
] |
[
"How to store Japanese kanji character in Oracle database",
"This Japanese character , which has four bytes, is saved as ???? in Oracle database whereas other Japanese characters are saved properly. \n\nThe configuration in boot.rb of my rails application contains:\n\nENV['NLS_LANG'] = 'AMERICAN_AMERICA.UTF8'\n\n\nand sqldeveloper of oracle db has\n\nNLS_LANGUAGE AMERICAN\nNLS_TERRITORY AMERICA\nNLS_CHARACTERSET JA16SJISTILDE\n\n\nThe datatype of the column is NVARCHAR2."
] | [
"ruby-on-rails",
"ruby",
"oracle",
"activerecord",
"cjk"
] |
[
"extract images from pdf using pdfbox",
"I m trying to extract images from a pdf using pdfbox. The example pdf here\n\nBut i m getting blank images only.\n\nThe code i m trying:-\n\npublic static void main(String[] args) {\n PDFImageExtract obj = new PDFImageExtract();\n try {\n obj.read_pdf();\n } catch (IOException ex) {\n System.out.println(\"\" + ex);\n }\n\n}\n\n void read_pdf() throws IOException {\n PDDocument document = null; \n try {\n document = PDDocument.load(\"C:\\\\Users\\\\Pradyut\\\\Documents\\\\MCS-034.pdf\");\n } catch (IOException ex) {\n System.out.println(\"\" + ex);\n }\n List pages = document.getDocumentCatalog().getAllPages();\n Iterator iter = pages.iterator(); \n int i =1;\n String name = null;\n\n while (iter.hasNext()) {\n PDPage page = (PDPage) iter.next();\n PDResources resources = page.getResources();\n Map pageImages = resources.getImages();\n if (pageImages != null) { \n Iterator imageIter = pageImages.keySet().iterator();\n while (imageIter.hasNext()) {\n String key = (String) imageIter.next();\n PDXObjectImage image = (PDXObjectImage) pageImages.get(key);\n image.write2file(\"C:\\\\Users\\\\Pradyut\\\\Documents\\\\image\" + i);\n i ++;\n }\n }\n }\n\n}\n\n\nThanks"
] | [
"java",
"image",
"pdf",
"pdfbox"
] |
[
"Making sure \"Get Value From User\" dialog window is always on top with Robot Framework",
"I've been hitting my head on the wall with Get Value From User. \n\nI wasn't sure it was working, then was told \"Are you sure it's not behind the Terminal window?\". I moved the terminal window, and, there the dialog was.\n\nHow would I make sure that the dialog opened by Get Value From User is always on top with macOSX Terminal?"
] | [
"macos",
"terminal",
"robotframework"
] |
[
"Saas customization api",
"we are creating a saas web service application and wanted to add customization which will allow tenants & users to add custom attributes to an existing entity Or (add custom entities and associate them with custom attributes). \n\nIs it possible? \n\nhow should the web service and UI(consumer application) handle these custom attributes? JSON & XML\n\nwhat should be considered on DB for achieving the same goal?\n\nPlease explain technologies with which we can achieve this and drawbacks of using it for a enterprise level large tenant based application. Open for Java Or .Net Technologies and frameworks. \n\nThank you"
] | [
"api",
"user-interface",
"customization",
"saas"
] |
[
"What can cause IIS app pool to recycle?",
"I am currently experiencing some instability in my session variables and believe the app pool is where the error is coming from. What I cannot find is a list of possible culprits for the issue. What can cause the app pool to recycle on its own, other than a scheduled recycle?"
] | [
"iis-6"
] |
[
"Crossrider ajax post requests having JSON payload are not received correctly in Rails backend",
"I have a JSON object that I want to post to a remote server (Rails). All attempts to send it to the server as 'application/json' fail where POST parameters are converted somewhere to url-encoded string.\nFor example:\n\nappAPI.request.post({\n url: \"http://mybackend\",\n postData: {hello: 'world', foo: 'bar'},\n onSuccess: function(response) {\n console.log(\"postback succeeded with response: \" + response)\n },\n onFailure: function(httpCode) {\n console.log(\"postback failure: \" + httpCode)\n },\n contentType: 'application/json'\n});\n\n\nReturns HTTP 500 with the server complaining from a malformed JSON object:\n\nError occurred while parsing request parameters.\nContents:\n\nMultiJson::LoadError (784: unexpected token at 'hello=world&foo=bar'): \n /Users/hammady/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/json/common.rb:148:in `parse'\n ...\n\n\nWhat else should I do to send the JSON object to my Rails backend?"
] | [
"javascript",
"ruby-on-rails",
"ajax",
"json",
"crossrider"
] |
[
"Creating a path to an asset dynamically",
"The issue is how to get Vue to render the correct path for an asset, if the path to the asset and the assets name is passed through as a props.\n\nExplanation:\nWhen using a Vue component... if passing in props which contain a path and a file name of an asset to be loaded\n\nexport default{\n name: 'NewComponent',\n props: [\"path\",\"file\"],\n computed:{\n calculateCompletePath (){\n return this.path+\"\"+this.file;\n }\n }\n}\n\n\nIf using something like the above in a manner such as:\n\n<template>\n <div>\n <video>\n <source :src=\"calculateCompletePath\" type=\"video/mp4\"/>\n </video>\n </div>\n</template>\n\n\nHow can you get the src portion to render correctly - e.g Vue generates its own string referencing the media folder for example \n\n\n /media/movie.6ac43bcf.mp4\n\n\n\n\nSide note:\nI've read somewhere there is the possibility to using require (<<asset>>) but that doesn't seem to work if used on the computed function e.g. return require (this.path+\"\"+this.file);\n\n\n\nAny ideas how to get this to work?"
] | [
"vuejs2",
"vue-component"
] |
[
"Can I define custom \"surround with\" templates in Visual Studio 2008?",
"Can I define custom \"surround with\" templates in Visual Studio 2008?"
] | [
"visual-studio",
"visual-studio-2008",
"code-snippets"
] |
[
"JMSListener escapes '.' for durable subscriptions",
"With Spring JMS 4.3.19 as well as with 5.2.5 I am trying to set up a JMSListener for durable subscriptions:\n\n@JmsListener(destination = \"test\", subscription = \"Consumer.Test\", connectionFactory = \"factory\")\npublic void receiveFromDurableSub(String message) {\n System.out.println(\"receiveFromTest: \" + message);\n}\n\n\nBut it ends up in Consumer\\\\.Test. For addresses it works somehow.\n\nHow can I avoid those backslashes?"
] | [
"spring-boot",
"spring-jms",
"activemq-artemis"
] |
[
"Subclassed controls not being released",
"We have found a large memory issue in our application. We have subclassed UITextField and add these to all of our main views. The main views are being dealloced correctly, however the dealloc method in our subclass never gets hit. Here is our subclass:\n\nHeader:\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n#import \"MyEntities.h\"\n#import \"MyControlHelper.h\"\n\n@interface MyTextField : UITextField {\n MyControlHelper *myHelper;\n UIView *disabledEffect;\n}\n\n@property (nonatomic, retain) MyControlHelper *myHelper;\n@property (nonatomic, retain) UIView *disabledEffect;\n\n@end\n\n\nImplementation:\n\n#import \"MyTextField.h\"\n\n@implementation MyTextField\n\n@synthesize myHelper;\n@synthesize disabledEffect;\n\n-(id) initWithCoder:(NSCoder *)aDecoder{\n if (self = [super initWithCoder:aDecoder]){\n myHelper = [[MyControlHelper alloc] init];\n [myHelper setBoundTextField:self];\n [myHelper SetupKeyboardListener];\n [self setReturnKeyType:UIReturnKeyDone];\n self.autocorrectionType = FALSE;\n self.delegate = myHelper;\n }\n\n return self;\n}\n\n-(id) init{\n if (self = [super init]){\n myHelper = [[MyControlHelper alloc] init];\n [myHelper setBoundTextField:self];\n [myHelper SetupKeyboardListener];\n [self setReturnKeyType:UIReturnKeyDone];\n self.autocorrectionType = FALSE;\n self.delegate = myHelper;\n }\n\n return self;\n}\n\n-(id)initWithFrame:(CGRect)frame{\n if (self = [super initWithFrame:frame]){\n myHelper = [[MyControlHelper alloc] init];\n [myHelper setBoundTextField:self];\n [myHelper SetupKeyboardListener];\n [self setReturnKeyType:UIReturnKeyDone];\n self.autocorrectionType = FALSE;\n self.delegate = myHelper;\n }\n\n return self;\n\n}\n\n-(void)dealloc{\n self.myHelper = nil;\n self.disabledEffect= nil;\n [super dealloc];\n}\n\n@end\n\n\nAny help would be greatly appreciated.\n\nCheers."
] | [
"iphone",
"ios",
"xcode",
"ipad",
"memory"
] |
[
"What should I call a method checking if two entities refers the same db entity?",
"I have entity objects that are synchronized with a database. I commonly use these entities in three different comparisons:\n\n\nCheck if two entity objects are the same CLR object.\nCheck if all properties of two entity objects are equal.\nCheck if two entity objects refer to the same database entity, even if some properties differ.\n\n\nFor 1 I use Object.ReferenceEquals(). \nFor 2 I overwrite Equals() checking all properties.\nFor 3 I have been a bit inconsistent. Some entities have a \"Match\" method some have a \"IsSame\" method. The logic of the method compares their primary key and if has not been assigned by the database yet, their secondary key (if they have one).\n\nA lot of code scenarios would be easier if I used Equals for comparing keys (e.g. I could check a list just using Contains()), but I would find it confusing, if Equals only compared the keys and didn't check all properties.\n\nMy scenario is an N-Tier system with self-tracking-entities. I often need to update a list of entities or similar with an updated entity arriving from another tier.\n\nIs there a consensus for naming a method checking if two entities refers to the same logical entity? KeyEquals()? SameEntity()?"
] | [
"c#",
".net",
"coding-style"
] |
[
"Show tangled file name in org mode code block export",
"I am doing literate programming in Emacs org mode. When I do the Latex export to a pdf, I would like the name of the file the code gets tangled to to be displayed by each code block. I can't find a suitable header argument in the manual.\n\nHere is my org file:\n\nA piece of Python code:\n#+BEGIN_SRC python :tangle pythontest.py\n print(\"hello\")\n#+END_SRC\n\n\nHere is my .emacs:\n\n(org-babel-do-load-languages\n 'org-babel-load-languages\n '((python . t)))\n\n\nHere is a screenshot of the part of the pdf export with text on it:"
] | [
"emacs",
"org-mode",
"literate-programming"
] |
[
"wait for a thread creation",
"Is there a way to ensure that a thread was created before moving on to other instructions (without using a detour such as sleep())?\n\nI have a loop that looks something like this:\n\nfor(i = 0; i < NUM_THREADS; ++i)\n{\n if(pthread_create(&threads_id_array[i], NULL, ThreadFunction, &args))\n {\n perror(\"pthread_create() error\");\n exit(1);\n }\n args.base += args.offset; \n}\n\n\nWhere base is a pointer to an array. I want to ensure that a thread was created before the promotion of base so that I can be sure that the thread's args.base holds the correct value. Currently, this causes bugs."
] | [
"c",
"multithreading"
] |
[
"\"Could not deduce (MArray (STUArray s) Int (ST s)) from context ()\" when applying runST",
"I'm in the process of learning haskell and came across this problem:\n\nUsing Glasgow Haskell Compiler, Version 6.10.4, for Haskell 98, stage 2 booted by GHC version 6.10.1\n\nCommon beginning of the file\n\n{-# LANGUAGE FlexibleContexts #-}\n\nmodule UPSO where\n\nimport Control.Monad(forM,forM_)\nimport Control.Monad.ST.Lazy (ST,runST)\nimport Data.Array.MArray (MArray, Ix, getBounds, newArray, readArray, writeArray)\nimport Data.Array.ST (STArray,STUArray)\n\nminmax xs@(x:_) = foldr (\\x (l,u) -> (min x l,max x u)) (x,x) xs\n\nmodify a i f = do\n x <- readArray a i\n writeArray a i (f x)\n\nincrement a i = modify a i (+1)\ndecrement a i = modify a i (\\x -> x - 1)\n\nuniquePermutationsM t 0 = return $! [[]]\nuniquePermutationsM t pos = do\n (l,u) <- getBounds t\n perms <- forM [l..u] (\\d -> do\n count <- readArray t d -- t[d]\n if count == 0\n then return $! []\n else do\n decrement t d\n pss <- uniquePermutationsM t (pos-1)\n increment t d\n return $! (map (d:) pss)\n )\n return $! (concat perms)\n\n\nUsing STArray (works)\n\nmkArray :: (Int,Int) -> (ST s) (STArray s Int Int) \nmkArray bounds = newArray bounds 0 \n\nuniquePermutationsST :: [Int] -> ST s [[Int]]\nuniquePermutationsST xs = do\n let bounds@(l,u) = (minmax xs) \n t <- mkArray bounds\n forM_ xs (increment t)\n pos <- sum `fmap` mapM (readArray t) [l..u]\n uniquePermutationsM t pos\n\nuniquePermutations xs = runST (uniquePermutationsST xs)\n\n\nUsing STUArray (doesn't work)\n\nBut when I try to switch to unboxed arrays, I get an error message.\n\nmkArray :: (Int,Int) -> (ST s) (STUArray s Int Int) \nmkArray bounds = newArray bounds 0 \n\nuniquePermutationsST :: [Int] -> ST s [[Int]]\nuniquePermutationsST xs = do\n let bounds@(l,u) = (minmax xs) \n t <- mkArray bounds\n forM_ xs (increment t)\n pos <- sum `fmap` mapM (readArray t) [l..u]\n uniquePermutationsM t pos\n\nuniquePermutations xs = runST (uniquePermutationsST xs)\n\n\nError messages\n\nCould not deduce (MArray (STUArray s) Int (ST s))\n from the context ()\n arising from a use of 'newArray' at UPSO.hs:35:17-33\nPossible fix:\n add (MArray (STUArray s) Int (ST s)) to the context of\n the type signature for 'mkArray'\n or add an instance declaration for (MArray (STUArray s) Int (ST s))\nIn the expression: newArray bounds 0\nIn the definition of 'mkArray': mkArray bounds = newArray bounds 0\n\n\nand also:\n\nCould not deduce (MArray (STUArray s) Int (ST s))\n from the context ()\n arising from a use of 'increment' at UPSO.hs:41:14-24\n\n\nAfter almost two hours of fiddling with the type annotations I hope someone can point me in the right direction. What on earth is going wrong?\n\nThank you for your time."
] | [
"haskell",
"stuarray",
"marray"
] |
[
"Is there value for including the [ValidateAntiForgeryToken] attribute on the Login action?",
"I am in the process of learning ASP.NET Core MVC and the book I am reading includes the following code example:\n\n[HttpPost]\n[AllowAnonymous]\n[ValidateAntiForgeryToken]\npublic async Task<IActionResult> Login(LoginModel loginModel) \n{\n // More stuff goes here.\n}\n\n\nYou can see that the author includes the [ValidateAntiForgeryToken] attribute on the action method. As far as my research goes, there does not appear to be any harm on including the attribute but I also not sure there is a benefit.\n\nBased on my understanding on how the [ValidateAntiForgeryToken] works, it looks like all that its achieving here is preventing a malicious website from logging me in... not sure I see the harm on someone trying to do that.\n\nClearly I am missing something , so my question is, what exactly is the use of the [ValidateAntiForgeryToken] trying to prevent in this specific scenario?\n\nThanks."
] | [
"security",
"asp.net-core-mvc",
"csrf"
] |
[
"Spring - Lazy Injection",
"I am working with version Spring 4.0 and learning DI in Java. I have a Shape interface and once class that implements it:\n\n@Component\n@Lazy\n@Scope(value=\"prototype\")\npublic class Circle implements Shape {\n public Circle() {\n System.out.println(\"Ctor Circle\");\n }\n @Override\n public double GetArea() {\n // TODO Auto-generated method stub\n return 2.0;\n }\n}\n\n\nand simple class which will get the shape in injection\n\n@Service\n@Lazy\npublic class ShapeHolder {\n @Autowired\n //@Lazy\n private Shape cShape; \n\n public ShapeHolder() {\n System.out.println(\"Ctor shapeHolder\");\n }\n}\n\n\nwhen the @Lazy above the field is commented all is working however when it isn't commented, I am getting exception\n\nException in thread \"main\" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shapeHolder': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.base.Interfaces.Shape com.base.services.ShapeHolder.cShape; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice\n\n\nAm I doing something wrong? I want that the injection will be real Lazy."
] | [
"java",
"spring",
"dependency-injection"
] |
[
"Handeling country code from a phone number",
"In my app, I have an sqlite db table that has a \"phone number\" column.\n\nI get the phone number by querying the devices content providers (sometiemes ContactsContract.PhoneLookup.CONTENT_FILTER_URI and sometimes android.provider.CallLog.Calls.CONTENT_URI) and it seems that in some of the cases I get phone numbers with country code, and sometimes without (it seems inconsistent).\n\nBecause of that, when I query my own db, I sometimes do not get results (for example, I stored 99887766 and queried for +199887766).\n\nSo, I would like to remove the country code before storing a number in my db table.\n\nI've google it and got to libphonenumber, but I can't figure out how to use it to do what I want (I can't seem to get my devices correct locale (I always get \"US\") + it seems that this lib makes network transactions; a thing I don't want to do)\n\nSo here are my questions:\n\n\nIs there a way to do what I want (using libphonenumber or in any other way)?\nIs there a way to do what I want without making internet transactions."
] | [
"android",
"android-contentprovider",
"phone-number",
"country-codes"
] |
[
"Issues with running a consul docker health check",
"am running the progrium/consul container with the gliderlabs/registrator container. I am trying to create health checks to monitor if my docker containers are up or down. However I noticed some very strange activity with with health check I was able to make. Here is the command I used to create the health check:\n\ncurl -v -X PUT http://$CONSUL_IP_ADDR:8500/v1/agent/check/register -d @/home/myUserName/health.json\n\n\nHere is my health.json file:\n\n{\n\"id\": \"docker_stuff\",\n\"name\": \"echo test\",\n\"docker_container_id\": \"4fc5b1296c99\",\n\"shell\": \"/bin/bash\",\n\"script\": \"echo hello\",\n\"interval\": \"2s\"\n}\n\n\nFirst I noticed that this check would automatically delete the service whenever the container was stopped properly, but would do nothing when the container was stopped improperly (i.e. durring a node failure). \n\nSecond I noticed that the docker_container_id did not matter at all, this health check would attach itself to every container running on the consul node it was attached to.\n\nI would like to just have a working tcp or http health test run for every docker container running on a consul node (yes I know my above json file runs a script, I just created that one following the documentation example). I just want consul to be able to tell if a container is stopped or running. I don't want my services to delete themselves when a health check fails. How would I do this. \n\nNote: I find the consul documentation on Agent Health Checks very lacking, vague and inaccurate. So please don't just link to it and tell me to go read it. I am looking for a full explanation on exactly how to set up docker health checks the right way. \n\nUpdate: Here is how to start consul servers with the most current version of the official consul container (right now its the dev versions, soon ill update it with the production versions):\n\n#bootstrap server\ndocker run -d \\\n-p 8300:8300 \\\n-p 8301:8301 \\\n-p 8301:8301/udp \\\n-p 8302:8302 \\\n-p 8302:8302/udp \\\n-p 8400:8400 \\\n-p 8500:8500 \\\n-p 53:53/udp \\\n--name=dev-consul0 consul agent -dev -ui -client 0.0.0.0\n\n#its IP address will then be the IP of the host machine\n#lets say its 172.17.0.2\n\n#start the other two consul servers, without web ui\ndocker run -d --name --name=dev-consul1 \\\n-p 8300:8300 \\\n-p 8301:8301 \\\n-p 8301:8301/udp \\\n-p 8302:8302 \\\n-p 8302:8302/udp \\\n-p 8400:8400 \\\n-p 8500:8500 \\\n-p 53:53/udp \\\nconsul agent -dev -join=172.17.0.2\n\ndocker run -d --name --name=dev-consul2 \\\n-p 8300:8300 \\\n-p 8301:8301 \\\n-p 8301:8301/udp \\\n-p 8302:8302 \\\n-p 8302:8302/udp \\\n-p 8400:8400 \\\n-p 8500:8500 \\\n-p 53:53/udp \\\nconsul agent -dev -join=172.17.0.2\n\n# then heres your clients\ndocker run -d --net=host --name=client0 \\\n-e 'CONSUL_LOCAL_CONFIG={\"leave_on_terminate\": true}' \\\nconsul agent -bind=$(hostname -i) -retry-join=172.17.0.2\n\n\nhttps://hub.docker.com/r/library/consul/"
] | [
"docker",
"health-monitoring",
"consul"
] |
[
"How to access the address of base class member in inherited class member functions?",
"I have recently jumped into this whole world of classes, inheritance and templates in C++. But I got stuck. Please suggest me a way to solve this problem.\n\n#include <iostream>\n\nusing namespace std;\n\ntemplate <typename type>\nclass a\n{\nprotected:\n type *b;\n};\n\ntemplate <typename type>\nclass p : public a<type>\n{\npublic:\n void f()\n {\n type **q = &a<type>::b;\n cout << *q << endl; // some other code in reality related to (*q)\n }\n};\n\nint main()\n{\n p<int> obj;\n obj.f();\n return 0;\n}\n\n\nBut it turned out to be unsuccessful:\n\nx.cpp: In instantiation of ‘void p<type>::f() [with type = int]’:\nx.cpp:26:9: required from here\nx.cpp:9:9: error: ‘int* a<int>::b’ is protected\n type *b;\n ^\nx.cpp:18:16: error: within this context\n type **q = &a<type>::b;\n ^\nx.cpp:18:26: error: cannot convert ‘int* a<int>::*’ to ‘int**’ in initialization\n type **q = &a<type>::b;\n ^\n\n\nSo I converted type **q = &a<type>::b; to type* a<type>::* q = &a<type>::b;. Then I got an additional error:\n\nx.cpp: In instantiation of ‘void p<type>::f() [with type = int]’:\nx.cpp:26:9: required from here\nx.cpp:9:9: error: ‘int* a<int>::b’ is protected\n type *b;\n ^\nx.cpp:18:26: error: within this context\n type* a<type>::* q = &a<type>::b;\n ^\nx.cpp:19:13: error: invalid use of unary ‘*’ on pointer to member\n cout << *q;\n ^\n\n\nSo I converted b to a public: member of class a from protected:. But that too gives me an error:\n\nx.cpp: In instantiation of ‘void p<type>::f() [with type = int]’:\nx.cpp:26:9: required from here\nx.cpp:19:13: error: invalid use of unary ‘*’ on pointer to member\n cout << *q;\n ^\n\n\nNow I cant perform further modifications. I would love to know if the original code does not tamper with the class's characteristics of being protected."
] | [
"c++",
"class",
"templates",
"pointers",
"inheritance"
] |
[
"error: cannot convert in arguement passing",
"I have some code like this:\n\ntemplate <class Item,class Key>\nclass bst\n{\n public:\n //bst(const Item& new_item,const Key& new_key);\n\n Key get_key() const {return key;};\n Item get_item() const {return item;};\n bst get_right() const {return *rightPtr;};\n bst get_left() const {return *leftPtr;};\n\n void set_key(const Key& new_key) {key = new_key;};\n void set_item(const Item& new_item) {item = new_item;};\n void set_right(bst *new_right) {rightPtr=new_right;};\n void set_left(bst *new_left) {leftPtr=new_left;};\n\n Item item;\n Key key;\n bst *rightPtr;\n bst *leftPtr;\n private:\n};\n\n\ntemplate <class Item,class Key,class Process,class Param>\nvoid inorder_processing_param(bst<Item,Key> *root,Process f,Param p)\n{\n if(root==NULL)\n {return;}\n else\n {\n inorder_processing(root->leftPtr,f,p);\n f(root->item,p);\n inorder_processing(root->rightPtr,f,p);\n }\n}\n\nvoid perfect(studentRecord s)\n{\nif (s.GPA==4.0)\n {\n cout << s.id << \" \" << s.student_name;\n }\n}\n\nvoid major_m(bst<studentRecord,int>* root)\n{\nif (root->item.major==\"m\")\n {\n cout << root->item.id << \" \" << root->item.student_name;\n }\n}\n\nvoid print_major(bst<studentRecord,int>* root,char* m)\n{\n inorder_processing(root,major_m);\n}\n\n\nit make this error when i run it:\n\nbst.template: In function `void inorder_processing(bst<Item, Key>*, Process) \n [with Item = studentRecord, Key = int, Process = void (*)(bst<studentRecord, \n int>*)]':\nstudentDatabase.cxx:97: instantiated from here\nbst.template:151: error: cannot convert `studentRecord' to `bst<studentRecord, \n int>*' in argument passing\n\n\nhow do i fix it"
] | [
"c++"
] |
[
"Xamarin.Forms JSON object into Listview",
"I'm trying parse this JSON object and bind it to my ListView in Xamarin.Forms.\n\nI'm just totally lost on how to handle it as i'm completely new to Xamarin Forms.\n\nIs there a easier way to do this?\n\nMy returned JSON Object\n\n[\n {\n \"id\": 1,\n \"name\": \"Leanne Graham\",\n \"username\": \"Bret\"\n },\n {\n \"id\": 2,\n \"name\": \"Ervin Howell\",\n \"username\": \"Antonette\"\n }\n]\n\n\nHere is the my Code to handle the REST json response\n\npublic class RestClient\n {\n public RestClient ()\n {\n }\n\n public async Task<User[]> GetUsersAsync () {\n\n var client = new System.Net.Http.HttpClient ();\n\n client.BaseAddress = new Uri(\"http://jsonplaceholder.typicode.com\");\n\n var response = client.GetAsync(\"users\");\n\n var usersJson = response.Result.Content.ReadAsStringAsync().Result;\n\n var rootobject = JsonConvert.DeserializeObject<Rootobject>(usersJson);\n\n return rootobject.Users;\n\n }\n }\n\n\nUsers.cs\n\n public class Rootobject\n {\n public User[] Users { get; set; }\n }\n\n public class User\n {\n public string id { get; set; }\n public string username { get; set; }\n }\n\nListView Form Code\nvar sv = new RestClient ();\n var es = sv.GetUsersAsync();\n Xamarin.Forms.Device.BeginInvokeOnMainThread (() => {\n Debug.WriteLine(\"Found \" + es.Result.Length + \" users\");\n listView.ItemsSource = es.Result;\n });\n\n\nXAML\n\npublic ListViewPage ()\n {\n Title = \"Users\";\n\n var sv = new RestClient ();\n var es = sv.GetUsersAsync();\n Xamarin.Forms.Device.BeginInvokeOnMainThread (() => {\n Debug.WriteLine(\"Found \" + es.Result.Length + \" users\");\n listView.ItemsSource = es.Result;\n });\n\n\n listView = new ListView ();\n listView.ItemTemplate = new DataTemplate(typeof(TextCell));\n listView.ItemTemplate.SetBinding(TextCell.TextProperty, \"username\");\n\n listView.ItemTemplate = new DataTemplate(typeof(ItemCell));\n\n Content = new StackLayout { \n Children = {\n listView\n }\n };\n }"
] | [
"c#",
"json",
"xamarin",
"xamarin.forms"
] |
[
"Knockout checkValue not working",
"In the knockout documentation there is an example of the checkedValue binding which can be used to grab the $data object instead of the value of a checkbox. One version of the view model works while another similar version does not. Is this a bug?\n\nBoth cases use the following HTML:\n\n<!-- ko foreach: items -->\n <input type=\"checkbox\" data-bind=\"checkedValue: $data, checked: $root.chosenItems\" />\n <span data-bind=\"text: itemName\"></span><br>\n<!-- /ko -->\n\n\nThe working view model looks like this: \n\nvar viewModel = {\n items: ko.observableArray([ { itemName: 'Choice 1' }, { itemName: 'Choice 2' }]),\n chosenItems: ko.observableArray()\n};\n\nko.applyBindings(viewModel);\n\n\nexample: http://jsfiddle.net/v2HAg/\n\nThe similar broken view model looks like this:\n\nfunction viewModel() {\n this.items = ko.observableArray([ { itemName: 'Choice 1' }, { itemName: 'Choice 2']);\n this.chosenItems = ko.observableArray();\n}\n\nko.applyBindings(new viewModel());\n\n\nexample: http://jsfiddle.net/dPBeA/"
] | [
"knockout.js"
] |
[
"Docker error dial unix /var/run/docker.sock: no such file or directory",
"I use to have boot2docker installed but recently installed the Docker ToolBox app for the Mac (running 10.11). When I open up iTerm and type docker ps I get the following message. \n\nGet http:///var/run/docker.sock/v1.20/containers/json: dial unix /var/run/docker.sock: no such file or directory.\n* Are you trying to connect to a TLS-enabled daemon without TLS?\n* Is your docker daemon up and running?\n\n\nI use to use boot2docker so I assumed the ToolBox is now needed. I started the app Docker quick start terminal which works only inside their terminal. However, I want to use docker in my own terminal etc.\n\nWhy do I get this error? How to fix?"
] | [
"macos",
"ubuntu",
"docker",
"boot2docker"
] |
[
"Google custom search returning 403",
"I am looking for \"Director of IT\" folks from a specific set of companies. For this, I have set up a custom google search engine to search linkedin's public data. It worked for few initial searches but thereafter started returning 403 (Forbidden).\n\nWhy could this be happening? Could it be because of the pattern of searches generated by the my (python) script - Director of IT XYZ (XYZ generated from a list of companies)?\n\nI have setup payment etc and that is not a problem."
] | [
"google-api"
] |
[
"Why is question mark not working inside %%?",
"I use java jdbc to connect database sql server but the question mark inside %% not working\nThis is my code:\npublic List<Account> findBetween(String search, int start, int size) {\n try {\n ArrayList<Account> list = new ArrayList<Account>();\n String sql = "SELECT * FROM Account WHERE uname LIKE '%?%' ORDER BY user_id OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";\n Connection conn = ConnectDB.openConnection();\n PreparedStatement st = conn.prepareStatement(sql);\n st.setNString(1, search);\n st.setInt(2, start);\n st.setInt(3, size);\n ResultSet rs = st.executeQuery();\n System.out.println(rs.getFetchSize());\n while (rs.next()) {\n list.add(new Account(rs.getInt(1), rs.getString(2), rs.getString(3), rs.getNString(4), rs.getNString(5),\n rs.getNString(6), rs.getString(7), rs.getString(8), rs.getDate(9), rs.getInt(10),\n rs.getBoolean(11)));\n }\n ConnectDB.closeConnection();\n return list;\n } catch (Exception e) {\n e.printStackTrace();\n ConnectDB.closeConnection();\n return null;\n } \n}"
] | [
"java",
"jdbc"
] |
[
"Full text search options for MongoDB setup",
"We are planning to store millions of documents in MongoDB and full text search is very much required. I read Elasticsearch and Solr are the best available solutions for full text search. \n\n\nIs Elastic search is mature enough to be used for Mongodb full text search? We also be sharding the collections. Does Elasticsearch works with Sharded collections?\nWhat are the advantages and disadvantages of using Elasticsearch or Solr?\nIs MongoDB capable of doing full text search?"
] | [
"mongodb",
"solr",
"elasticsearch"
] |
[
"PHP send multiple api requests at once",
"i'm trying to make multiple API calls at once and get data needed from each of them, how can i do it? i want to send about 100 requests at once and grab data from them.\nthis is the code i currently have:\n<?php\n\n$min = 7960265729;\n$max = 9080098567;\n$count = 0;\n\nfor($i = $min; $i <= $max; $i++) {\n try{\n $r = json_decode(file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=EA08B4B2B515A4BAB3D742627CDCC492&steamids=7656119$i"), true);\n $avatar = $r['response']['players'][0]['avatar'];\n $profile = $r['response']['players'][0]['profileurl'];\n if($avatar != null) {\n $count += 1;\n print_r("[$count][$i] $profile \\n");\n }\n }\n catch (Throwable $t){\n continue;\n }\n}\n\n?>\n\nthis makes one api request at a time. how can i change so it can make 100?\nthanks."
] | [
"php",
"api"
] |
[
"MVC Backload File Upload failing in production",
"I've got a .NET 4.5 MVC 5 web application that utilizes Backload 2.0 to help with uploading an Excel file. The controller method works great in my development environment. However, when I moved to my production server, the same method is now failing.\n\nIt's failing because handler.Services.POST is null. All of the other properties off handler.Services are null as well, e.g. GET, etc.\n\nWhat might cause this to happen? Is it an IIS setting? Web.config? What else can I check??\n\nMost of this code was copied from an example that ships with Backload.\n\n [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post | HttpVerbs.Put | HttpVerbs.Delete | HttpVerbs.Options)]\n public async Task<ActionResult> FileHandler()\n {\n try\n {\n // Create and initialize the handler\n var handler = Backload.FileHandler.Create();\n handler.Init(HttpContext.Request);\n\n // Call the appropriate request handlers\n if (handler.Context.HttpMethod == \"POST\")\n {\n // Get the posted file with meta data from the request\n handler.FileStatus = await handler.Services.POST.GetPostedFiles();\n\n if (handler.FileStatus != null)\n {\n var file = handler.FileStatus.Files[0];\n\n DateTime spreadsheetDate;\n\n using (var memoryStream = new MemoryStream((int)file.FileSize))\n {\n await file.FileStream.CopyToAsync(memoryStream);\n\n //TODO: do some stuff...\n }\n }\n\n // Create client plugin specific result and return an ActionResult\n IBackloadResult result = handler.Services.Core.CreatePluginResult();\n return ResultCreator.Create((IFileStatusResult)result);\n }\n\n // other http methods may also be handled\n return new EmptyResult();\n }\n catch (Exception ex)\n {\n return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);\n }\n }"
] | [
"c#",
".net",
"asp.net-mvc",
"backload"
] |
[
"object structure mismatch issue using json fromJson method",
"So here is the issue i facing while converting a complex json to a java\n object. \n\nThe incoming json is something like this: \n\n{\n \"view\": { \n \"unit\": {\n \"sc\": {\n \"private\": 6,\n \"public\": 6\n },\n \"step\": \"PREPARE\",\n \"id\": 3037,\n .....\n} \n\n\nNotice that sc has java keywords private and public as its fields.\nOn the client side i have the following code to consume this json. \n\nString obj = restTemplate.postForObject(url, entity, String.class); \nJsonObject jsonObj = new JsonParser().parse(obj).getAsJsonObject(); \nT objFinal = buildGson(dateFormat).fromJson(jsonObj, PrepareStateObject.class);\n\n\nThe PrepareStateObject is same as the corresponding json the only difference being the sc object.\n\npublic class sc implements java.io.Serializable {\n private static final long serialVersionUID = -952803010396503926L;\n private static final Logger log = LoggerFactory.getLogger(sc.class); \n private Integer _public; \n private Integer _private;\n //....\n} \n\n\nWhen I inspect the jsonObj i can see the whole json with the sc object.\nHowever as expected the fromJson method fails to populate the sc object due to mismatch in field names.\nHow do I achieve this without using a mapper like jackson?"
] | [
"java",
"json",
"spring-boot",
"jackson",
"gson"
] |
[
"ArrayFire Matrix Multiplication Vectorization",
"I am using ArrayFire library for signal processing. I am just curious about how to make more efficient my code. I read vectorization guide in docs, but i just ended up using gfor construct. Is it possible to improve efficiency ? Is there a better way for vectorization ? ( I hope there is :)\nNote : I am aiming CUDA performance.\nHere is the code which i am trying to improve :\n#include <arrayfire.h>\n#include <stdio.h>\n#include <af/util.h>\n\nstatic int proc_size = 1024;\nstatic int fft_size = proc_size * 4;\nstatic int staves = 288;\nstatic int beams = 256;\n\nstatic af::array S;\nstatic af::array B;\nstatic af::array R;\n\nvoid fn()\n{\n gfor ( af::seq i, fft_size )\n R( i , af::span ) = matmul( S( i , af::span ) , B( af::span , af::span , i ) );\n}\n\nint main(int, char **)\n{\n S = af::randn( fft_size , staves , c32 );\n\n gfor ( af::seq i, fft_size )\n S( i , af::span ) = af::randn( 1 , staves , c32 );\n\n B = af::randn( staves , beams , fft_size , af::dtype::c32 );\n R = af::constant( af::cfloat { 0 , 0 } , fft_size , beams );\n\n try\n {\n af::setDevice( 0 );\n af::info();\n\n double time = af::timeit(fn);\n\n printf( "Took %f secs.\\n" , time );\n }\n catch (const af::exception &ex)\n {\n fprintf(stderr, "%s\\n", ex.what());\n throw;\n }\n\n return 0;\n}"
] | [
"c++",
"gpu",
"arrayfire"
] |
[
"Execute several instances of script same time",
"I have a crontable that executes a script with different args\n\n0,5,10 * * * * /path/to/logScript \"script2\"\n0,5,10 * * * * /path/to/logScript \"script1\" \n0,5,10 * * * * /path/to/logScript \"script3\" \n\n\nscript\n\n#!/bin/bash \n script=$1\n\n $script args >/path/tmp/log.out 2>/path/tmp/log.err\n if [ ! -s /path/tmp/log.err ]; then\n echo -n \"$(date) success: \" >> /path/logfile\n cat /path/tmp/log.out >> /path/logfile\n else\n echo -n \"$(date) errors: \" >> /path/logfile\n cat /path/tmp/log.err >> /path/logfile\n fi\n\n\nThe issue that I think i'm having is with the execution of the script in the same time. The script doen't get the right value of return (to know wheter it's stderr or stdout). If i execute the crontable lines one after one in a terminal it works fine but when it's executed automatically the data i get is incorrect. \n\nI tried to solve this by making this changement to crontable but i still have the same issue. \n\n0,5,10 * * * * /path/to/logScript \"script2\"&\n0,5,10 * * * * /path/to/logScript \"script1\"& \n0,5,10 * * * * /path/to/logScript \"script3\"&"
] | [
"bash",
"shell",
"scripting"
] |
[
"cURL cannot connect to localhost but browser can",
"I'm running a Rails app locally (Thin server), and I can connect locally from the browser (localhost:3000), but when I try to use curl, I get:\n\ncurl -H 'id:1' -i 'http://localhost:3000/api/data' -v\n\n* Hostname was NOT found in DNS cache\n* Trying ::1...\n* Adding handle: conn: 0x7fd121808200\n* Adding handle: send: 0\n* Adding handle: recv: 0\n* Curl_addHandleToPipeline: length: 1\n* - Conn 0 (0x7fd121808200) send_pipe: 1, recv_pipe: 0\n* Connection failed\n* connect to ::1 port 3000 failed: Connection refused\n* Trying fe80::1...\n* Connection failed\n* connect to fe80::1 port 3000 failed: Connection refused\n* Failed to connect to localhost port 3000: Connection refused\n* Closing connection 0\ncurl: (7) Failed to connect to localhost port 3000: Connection refused\n\n\nThis used to work just fine, but I recently updated to Mavericks, which I suspect may have broken something. I can also curl successfully from the web."
] | [
"ruby-on-rails",
"curl",
"osx-mavericks",
"thin"
] |
[
"Dashboard on Quicksight",
"Is it a way to build a dashboard on Quicksight to achieve following requirement?\nI have a dataset like this:\nCan I create two tables: table 1 contains ID and User and table 2 will plot the data (line plot). When I click an ID in table, table two will automatically plot the data for certain ID."
] | [
"visualization",
"amazon-quicksight"
] |
[
"android scrollview not working windowSoftInputMode",
"I have one activity and in this activity's windowSoftInputMode is stateAlwaysHidden\n\nandroid:windowSoftInputMode=\"stateAlwaysHidden\"\n\n\ni created custom Xml file and in this xml i have one edittext in top position and one button in bottom position\n\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:fillViewport=\"true\">\n\n<RelativeLayout\n\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:background=\"#ffffff\"\n android:minHeight=\"@dimen/u_base_min_height\">\n\n <LinearLayout\n\n android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\"\n android:background=\"#ffffff\"\n android:minHeight=\"@dimen/u_base_min_height\"\n android:orientation=\"vertical\">\n\n\n <RelativeLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"@dimen/transfer_headerView_height\">\n\n <EditText\n\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_centerHorizontal=\"true\"\n android:layout_centerVertical=\"true\" />\n </RelativeLayout>\n\n\n </LinearLayout>\n\n <LinearLayout\n android:id=\"@+id/bottom_layout\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentBottom=\"true\"\n android:orientation=\"vertical\"\n android:paddingLeft=\"@dimen/u_common_margin_left\"\n android:paddingRight=\"@dimen/u_common_margin_right\">\n\n\n <Button\n android:id=\"@+id/u_done\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"@dimen/u_widget_height\"\n android:background=\"@drawable/rounded_corners_blue\"\n android:text=\"@string/u_register_next\"\n android:textColor=\"#ffffff\"\n android:textSize=\"@dimen/u_common_text_size\" />\n\n\n <View\n android:layout_width=\"match_parent\"\n android:layout_height=\"@dimen/u_common_margin_left\" />\n\n\n </LinearLayout>\n</RelativeLayout>\n\n\n\n\nwhen keyboard is showing i can not show my button whitch is a bottom position,scrollview now working.\ni searched about my problem and i tryed to change windowSoftInputMode in manifest file\n android:windowSoftInputMode=\"adjustResize\"\n\nbut i don't need this solution because my button moving keyboard up when my keyboard is showing...\nhow i can solve my problem? if anyone knows solution please help me\nthanks everyone"
] | [
"android",
"android-edittext",
"android-manifest",
"android-scrollview",
"android-relativelayout"
] |
[
"Using undocumented classes such as NSPreferences in Mac App Store",
"There is an undocumented class called NSPreferences that appears to be used by Safari and Mail, and eases creation of multipage preference pages. \n\nHas anyone had experience using NSPreferences or similar undocumented, but useful and fun, features in an application submitted to Mac App Store?"
] | [
"objective-c",
"cocoa",
"appkit",
"mac-app-store"
] |
[
"Print Variable and date variable that corresponds with the outlier detected.",
"I'm trying to print so I can see the date variable that corresponds with the variable i'm running my double MAD function on. I'm coming from SAS and a new programmer for R. I'm calling the variables from a dataset.\n\nDoubleMAD <- function(x, zero.mad.action=\"warn\"){\n # The zero.mad.action determines the action in the event of an MAD of zero.\n # Possible values: \"stop\", \"warn\", \"na\" and \"warn and na\".\n x <- x[!is.na(x)]\n m <- median(x)\n abs.dev <- abs(x - m)\n left.mad <- median(abs.dev[x<=m])\n right.mad <- median(abs.dev[x>=m])\n if (left.mad == 0 || right.mad == 0){\n if (zero.mad.action == \"stop\") stop(\"MAD is 0\")\n if (zero.mad.action %in% c(\"warn\", \"warn and na\")) warning(\"MAD is 0\")\n if (zero.mad.action %in% c( \"na\", \"warn and na\")){\n if (left.mad == 0) left.mad <- NA\n if (right.mad == 0) right.mad <- NA\n }\n }\n return(c(left.mad, right.mad))\n}\n\nDoubleMADsFromMedian <- function(x, zero.mad.action=\"warn\"){\n # The zero.mad.action determines the action in the event of an MAD of zero.\n # Possible values: \"stop\", \"warn\", \"na\" and \"warn and na\".\n two.sided.mad <- DoubleMAD(x, zero.mad.action)\n m <- median(x, na.rm=TRUE)\n x.mad <- rep(two.sided.mad[1], length(x))\n x.mad[x > m] <- two.sided.mad[2]\n mad.distance <- abs(x - m) / x.mad\n mad.distance[x==m] <- 0\n return(mad.distance)\n}\nDoubleMAD(x)\nDoubleMAD(test_dataset_double_meidan$Sales)\n\n\n`` \n\n`print(test_dataset_double_meidan$Sales[DoubleMADsFromMedian(test_dataset_double_meidan$Sales) > 3])\n\n\nAny help would be appreciated."
] | [
"r"
] |
[
"Join table in oracle database",
"I have 2 tables that showing data Item master and BOM. I would like to join the tables between Item master as T1 and BOM as T2 and the additional table for table BOM as T3. Item master table containing ITM_CD, ITM_TYP (1,2,3,4) where each ITM_TYP represents a code for the first digit on ITM_CD. The thing that I want is like the picture below\n\nCHILD_CD2 value replace to CHILD_CD1 value. So the data should be like this. What query should I fix ? I am very new using oracle query.\n\nHere is mycode;\nSELECT DISTINCT\n T1.ITM_CD,\n T2.C_ITM_CD AS CHILD_CD1,\n T3.C_ITM_CD AS CHILD_CD2\nFROM CM_HINMO_ALL T1\nINNER JOIN (SELECT P_ITM_CD, C_ITM_CD, BOM_PTN FROM SM_BOM_ALL) T2 \nON T1.ITM_CD = T2.P_ITM_CD\n \nLEFT JOIN (SELECT P_ITM_CD, C_ITM_CD, BOM_PTN FROM SM_BOM_ALL) T3 \nON T2.C_ITM_CD = t3.P_ITM_CD\nWHERE 0=0\nAND T2.BOM_PTN IN (1)\nAND T1.ITM_TYP IN (1,2)\nAND T1.ITM_CD = '110100370'\nORDER BY 2"
] | [
"sql",
"oracle11g"
] |
[
"data is not stored in database when follow button is pressed",
"I have a follow button that when I press on it store into follow table followerid and followingid and turned into unfollow\nand when I press on unfollow delete them from follow table \nI used JQuery for this \nbut when I press on the button it turned into unfollow but does not store any data in the data base can you help me find the error please \n\nJQuery \n\nfunction change( el )\n{\nvar input= $('#followingid').val();\nvar input2=$('#followerid').val();\n\n if ( el.value == \"Follow\" )\n {\n $.get(\"follow_button.php\",{following_id:'input',follower_id:'input2'});\n el.value = \"Unfollow\";\n }\n else\n {\n $.get(\"unfollow_button.php\",{following_id:'input',follower_id:'input2'});\n el.value = \"Follow\";\n }\n\n}\n\n\nand this is the follow button \n\n <form action=\"\" method=\"post\" name=\"f1\">\n\n\n\n\n\n\n<input type=\"button\" value=\"<?php \n$sql=\"SELECT * FROM follow WHERE followerid=$id and followingid=$projectid\";\n$q=mysql_query($sql) or die (mysql_error());\n if($num=mysql_num_rows($q))\n echo 'Unfollow';\n else\n echo 'Follow';\n\n ?>\" onclick=\"return change(this);\" />\n </form>\n\n\nand this is follow_button.php page\n\n<?php\n $followerid=$_GET['follower_id'];\n $followingid=$_GET['following_id'];\n\n $sql2=\"INSERT INTO follow (followerid,followingid) VALUES($followerid,$followingid)\"; \n $q2=mysql_query($sql2) or die(mysql_error());\n?>\n\n\nunfollow_button.php page\n\n<?php\n $follower_id=$_GET['followerid'];\n $following_id=$_GET['followingid'];\n\n $sql2=\"DELETE FROM follow WHERE followingid=$following_id and followerid=$follower_id\";\n $q2=mysql_query($sql2); \n?>\n\n\nI review my code several times but I could't find the error ,,I hope you can find the problem\nthanx ..."
] | [
"php",
"jquery",
"html"
] |
[
"Build sum of column occurence in R?",
"I do my first steps with R and try to convert a data frame from this format:\n\n org_unit answer\n1 4712 75\n2 4713 50\n3 4712 75\n4 4713 50\n5 4712 25\n\n\nTo this format\n\n org_unit 100 75 50 25 0\n1 4712 0 2 0 1 0\n2 4713 0 0 2 0 0\n\n\nValid column values of answer are 100, 75, 50, 25, 0.\n\nThanks!"
] | [
"r"
] |
[
"How can i submit a form with a file from URL programmatically",
"I want to submit a form with a file programmatically but i learned there is no way to pass file to input type=\"file\" because of security. So i am searching a way to submit form with file from url. Html is below.\n\n <form class=\"converter-form\" id=\"iri-converter-form\">\n\n <label for=\"iri-converter-input\">Custom Ontology:</label>\n\n <input type=\"text\" id=\"iri-converter-input\" placeholder=\"Enter ontology IRI\">\n <button type=\"submit\" id=\"iri-converter-button\" disabled>Visualize</button>\n </form>\n\n <div class=\"converter-form\">\n\n <input class=\"hidden\" type=\"file\" id=\"file-converter-input\" autocomplete=\"off\">\n\n <label class=\"truncate\" id=\"file-converter-label\" for=\"file-converter-input\">Select ontology file</label>\n <button type=\"submit\" id=\"file-converter-button\" disabled>\n Upload\n </button>\n </div>"
] | [
"javascript",
"html"
] |
[
"create proxmox Vm using c#",
"I am totally new to proxmox VE and i want to create a Vitual Machine inside proxmox using C# console application.\n\nI have search a lot and i only found an API program which has all the functionality but i don't know how to use it. https://github.com/EnterpriseVE/eve2pve-api-dotnet\n\nCan someone help me how to create and delete a vm in proxmox using this API in detail or anyone have any different approach to do this"
] | [
"c#"
] |
[
"MySql Query for fetching first record of every hour in Table",
"I have a table with thousands of records of meter data. Every smart meter will keep on sending data. I want to fetch only the first record of every hour, for each meter.\n\nHere is an example of data in the table:\n\nmeter_id meter_time\n300020013 2014-03-01 02:06:06\n300020013 2014-03-01 02:06:06\n300020013 2014-03-01 02:06:06\n300020013 2014-03-01 02:06:06\n300020013 2014-03-01 02:06:06\n300020013 2014-03-01 02:06:06\n300020007 2014-02-19 16:05:31\n300020007 2014-02-19 16:05:31\n300020007 2014-02-19 16:05:31\n300020007 2014-02-19 16:05:31\n300020007 2014-02-19 16:05:31\n300020007 2014-02-19 16:05:31"
] | [
"mysql"
] |
[
"Weird behavior of malloc",
"I am trying to dynamically initializing a queue. Here is my function.\n\ntypedef struct{\n int size;\n int max_size;\n short * eles;\n} queue;\n\nvoid dump_queue(queue *q)\n{\n //print a bunch of information\n}\n\nvoid init_queue(queue *q, int max_size)\n{\n q = (queue)malloc(sizeof(queue));\n q->size = 0;\n q->max_size = max_size;\n q->eles = (short *)malloc(max_size * sizeof(short));\n int i;\n for(i = 0; i < max_size; i++)\n q->eles[i] = -1;\n dump_queue(q);\n}\n\n\ntask_queue is a global variable. The structure of the routine is like:(not exact code)\n\n//globally defined here but not initialized \nqueue * task_queue;\nvoid init_scheduler()\n{\n init_queue(task_queue, 32);\n\n dump_queue(task_queue);\n //other staff\n}\n\n\nnote that there are two dump_queue, one is init_queue(), the other is after init_queue. Since task_queue is malloced, I expect that two calls of dump_queue should give a same result. But the second one actually reported a SIG_FAULT. \n\nAfter I checked, in the second call of dump_queue, task_queue is actually NULL. Why is that?"
] | [
"c",
"linux",
"struct",
"malloc",
"system"
] |
[
"Trouble relying on third party package imports in my package",
"My package uses ggplot2 extensively to make custom plots. I import ggplot2 in the NAMESPACE file. I can build, install, and load the package into R without errors. But when I call a function from my package, it complains it can't find a function in that imported package. The function that I called had absolute nothing to do with plotting and didn't make use of anything from ggplot2. How can I make function calls from my package work without these types of errors?\n\n\n Error in theme_beata() (from plot.R#14) : could not find function \"theme_classic\"\n\n\nThe first function erroring is:\n\n#' A custom ggplot2 theme for Beata\n#' @import ggplot2\n#' @family themes\n#' inheritParams ggplot2::theme_classic\n#' @export\ntheme_beata <- function(base_size = 14, base_family=\"serif\", ticks = TRUE) {\n\n ret <- theme_classic() +\n theme(axis.line = element_line(size=0.6),\n axis.text = element_text(size = base_size),\n axis.title = element_text(size= base_size + 2),\n title = element_text(size=base_size + 4))\n if (!ticks) {\n ret <- ret + theme(axis.ticks = element_blank())\n }\n ret\n}\n\n\nI am using devtools and roxygen2 to document my package. I also discovered I am now getting this error when running document().\n\n> document()\nUpdating pkg documentation\nLoading pkg\nError in theme_beata() (from plot.R#11) : could not find function \"theme_classic\"\n> traceback()\n13: theme_beata()\n12: as.vector(y)\n11: setdiff(names(theme_gray()), names(new))\n10: ggplot2::theme_set(theme_beata()) at plot.R#25\n9: eval(expr, envir, enclos)\n8: eval(exprs[i], envir)\n7: source_one(file, envir = envir)\n6: source_many(paths, env)\n5: force(code)\n4: in_dir(file.path(pkg$path, \"R\"), source_many(paths, env))\n3: load_code(pkg)\n2: load_all(pkg)\n1: document()\n\n\nFrom reading Hadley's book on packaging, I don't think the DESCRIPTION matters in terms of exports, but below is the bottom part:\n\nDepends: R (>= 3.1.0)\nLicense: file LICENSE\nLazyData: false\nImports:\n dplyr (>= 0.4.0),\n tidyr (>= 0.1.0),\n XLConnect,\n pryr,\n stringr,\n devEMF,\n assertthat,\n grid,\n ggplot2,\n ggthemes,\n GGally,\n broom,\n scales\nSuggests:\n lattice\n\n\nMy NAMESPACE has the following imports:\n\nimport(XLConnect)\nimport(dplyr)\nimport(ggplot2)\nimport(ggthemes)\nimport(stringr)\nimport(tidyr)"
] | [
"r",
"ggplot2",
"packages",
"devtools",
"roxygen2"
] |
[
"How to get network providers name in Appium through Java?",
"Is there any way to fetch network providers name in Appium through java?\nI tried below code to add in my script but I am not sure which class or jar to use for TelephonyManager.\n\nTelephonyManager manager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);\nString carrierName = manager.getNetworkOperatorName(); // alphabetic name of current registered operator\nreturn carrierName;"
] | [
"android",
"appium",
"appium-android"
] |
[
"Alternative to global static data that's not ASP.NET specific",
"I am working on a legacy system that consists of a WinForms application, a set of XML Web Services, and a set of WCF services. Each application is \"internally\" 3-tier, in that the business and data logic were factored out into separate assemblies, but \"externally\" monolithic, since all 3 assemblies are loaded by each application into their own app domain.\n\nThe WinForms application must have come first, because the internal design is littered with global static data that crosses the tier boundaries. The most glaringly bad of these is the logged-in user information. The front-end is expected to \"log in\" a user immediately, and the data later then uses that information on every database read and write. \n\nThis \"works OK\" in the WinForms app, but not surprisingly falls apart in the web services, because parallel incoming requests stomp over each other's static data and very bad things start to happen. So far I've found a number of options for keeping track of global data at the ASP.NET level but they all rely on ASP.NET specific objects like Session or HttpContext, which I can't use. This needs to work in the WinForms application as well.\n\nAre there any other options that are similar to static variables that I could retrofit into the system (with reasonable effort; refactoring the system to be designed properly is currently out of scope)?"
] | [
"c#",
"asp.net",
"winforms"
] |
[
"How does the main method work?",
"I'm the product of some broken teaching and I need some help. I know that there is this thing called the \"main method\" in Java and I'm sure other programming languages. I know that you need one to make your code run, but how do you use it to make your run? What does it do and what do you need to have it put in it to make your code run? \n\nI know it should look something like this.\nBut almost nothing more. \n\nstatic void main(String[] args){\n\n}"
] | [
"java",
"methods",
"main"
] |
[
"How to block creation of MySQL database with name that matches a certain pattern",
"Is there a way to configure MySQL to prevent creation of database schemas with a name that match a certain condition? Ideally, I want to prevent creation with names that match a pattern, but if there is a solution to block names that do not match a pattern I think I can make that work too. For example, I want to block the creation of schemas with names starting with a number."
] | [
"mysql",
"sql",
"mysql-workbench"
] |
[
"Extendscript: Dynamically create dropdown lists and onChange functions for them",
"Here's a challenging one. I'm relatively new to scripting but have an idea I want to get working.\n\nI have a script that is dynamically generating drop-down lists based on an array: each item in that array creates a dropdownlist.\n\n\r\n\r\nfunction getDropDownLists(inputArray, grp) { //input an array and the UI Group we're adding these DDLs to\r\n try {\r\n eval(grp + \"Array = [];\"); //Creates an array to store the DDLs we're about to create\r\n var listName; //Create variable to store name of DDL we're creating as we iterate through inputArray\r\n for (var i = 0; i < inputArray.length; i++) {\r\n listName = grp + \"SrcLevel_\" + i.toString(); //Get the name for the DDL we're about to create\r\n eval('var ' + listName + ' = ' + grp + '.add(\"dropdownlist\",[0,0,150,25])'); //add a DDL for the current array item\r\n eval(listName + '.add(\"item\",\"' + listName + '\")'); //This line creates an item in each dropdown to tell me its name\r\n eval(grp + \"Array[\" + i + \"] = \" + listName + \";\"); //Adds newly created DDL to the storage array\r\n }\r\n } catch (e) {\r\n alert(\"Error on line \" + e.line + \":\\n\" + e.message);\r\n }\r\n }\r\n\r\n\r\n\n\nWhen I call this function (it may not work perfectly here as I've cleaned it up a bit for display purposes) it correctly creates all my dropdownlists. However, I want to create onChange events for each of these to reference the previous one in the created storage array and change its contents. I know how to make the onChange events work if these were known dropdownlists, but every project I'll be working on is different and I'd like to get this to work without having to retool every time the project requirements change.\n\nFor example, when I call getDropDownLists(['mom','dad','baby'],family), I would get three dropdownlists: familySrcLevel_0,familySrcLevel_1,familySrcLevel_2. How would I then create onClick events for each of these dropdownlists, knowing that I won't always know how many there are? Is such a thing possible? It has to be done in Extendscript."
] | [
"javascript",
"extendscript"
] |
[
"Docusign:Callbacks from connect are consolidated instead of separate callbacks",
"We are using Electronic Seal functionality. And we have configured Docusign Connect for callbacks on recipients and envelope events \n\nEnvelope Events : \nEnvelope Signed/Completed, Envelope Declined, Envelope Voided\n\nRecipient Events :\nRecipient Signed/Completed, Recipient Declined\n\nThere are two recipients in this order \n\n\nSigner 2. Electronic Seal\n\n\nWhen signer signs the agreement. The agreement goes for Electronic seal automatically in Docusign.\n\nOur application expects 2 callbacks.\n\nFirst Callback for signer signed - InProcess\n\nSecond Callback for Completed.\n\nBut Docusign Connect is giving us just one consolidated callback of Completed. The InProcess callback never comes to our endpoint.\n\nThis is also very account specific.\nFor our demo account the callbacks are separate, but for our customer's demo account the callbacks are consolidated. \n\nMy Assumption is the higher notification is sent and the lower notification is skipped.\n\n\nIs Envelope Signed/Completed Event higher than Recipient Signed/Completed Event.\nIf I only subscribe to Recipient Signed/Completed events and not Envelope Event will I get both callbacks since these are equal ?\nIs there any other setting in Connect ?"
] | [
"docusignapi"
] |
[
"Xcode 6.3.2 crashes while submiting app to iTuneconnect",
"I am using Xcode 6.3.2. When i try to upload build to iTuneconncet it is crashing every time. This is crash log of xcode\n\n\n\nSolution : As per @kovpas. I try closing xcode workspace and leave just the organizer and then try to upload. Good new is that it works fine. Thanks @Kovpas"
] | [
"ios",
"xcode6"
] |
[
"angular-fullstack PUT will not update in backend",
"I am trying to run a PUT updating the status of an issue from \"unresolved\" to \"resolved\". However, I keep getting TypeError: $scope.details.$update(); is not a function. \n\nI am using the angular-fullstack yeoman generator.\n\nI have tried following different guides here and here. \n\nhere is my code:\n\nupdate function in the API\n\n export function update(req, res) {\n if (req.body._id) {\n delete req.body._id;\n }\n WCS.findByIdAsync(req.params.id)\n .then(handleEntityNotFound(res))\n .then(saveUpdates(req.body))\n .then(respondWithResult(res))\n .catch(handleError(res));\n }\n\n\nfunctions in my controller to retrieve and manipulate the data. \n\n// Search\n $scope.theId = '';\n\n $scope.details = {};\n\n// Pull function\n $scope.getVOC = function () {\n if ($scope.theId.length === 24) {\n $http.get('http://localhost:9000/api/WCS/' + $scope.theId)\n .success(function(data) {\n $scope.details = data;\n });\n } else {\n alert('Please use an existing ID.');\n }\n };\n\n // Put function\n $scope.updateVOC = function () {\n $scope.details.$update();\n };\n\n\nAnd my html:\n\n <form >\n <input ng-model='theId' type='text'>\n <button type=\"submit\" class=\"btn btn\" ng-click=\"getVOC()\">Search</button>\n <button type=\"submit\" class='btn' ng-click='updateVOC()' name=\"button\">Update</button>\n </form>\n\n<div>\n<table class=\"table table-hover table-bordered\">\n<h4>Customer Information</h4>\n<tr>\n <td class=\"col-sm-2\">Name:</td>\n <td>{{details.name}}</td>\n</tr>\n<tr>\n <td>Email:</td>\n <td>{{details.email}}</td>\n</tr>\n<tr>\n <td>Phone:</td>\n <td>{{details.phone}}</td>\n</tr>\n<tr>\n <td>Company:</td>\n <td>{{details.company}}</td>\n</tr>\n<tr>\n <td>Status:</td>\n <td>\n <select class='form-control col-sm-2' ng-model=\"details.resolutionStatus\">\n <option>resolved</option>\n <option>unresolved</option>\n </select>\n </td>\n</tr>\n\n\n\n\nWhen I select the resolved option and click on the updateVOC function it shows on the scope that the resolution status is now 'resolved', but that change does not update the database. I need it to save in the database."
] | [
"javascript",
"angularjs",
"node.js"
] |
[
"Function does not seem to work correctly after modification",
"I am trying to make this work but, I need help on this function. It works great but after I modifed it to show user dashboard with choreos from Temboo i get no results. The two functions are in different php files namely index.php and dashboard.php . Please show me where I could be having errors. Thank you \n\nMain source :https://raw.github.com/matthewflaming/temboo-experiments/master/TumblrOauth/tumblrOauth.php\n\nMy dashboard.php : https://tumblr-app-c9-c9-paulkinobunga.c9.io/dashboard.php \n\nToo see my index.php file replace dahboard.php with index.php\n\nThe Function\n\nfunction getUserInfo($session) {\n\nglobal $AccessToken, $AccessTokenSecret;\n\n// Instantiate the Choreo, using a previously instantiated Temboo_Session object, eg:\n$getUserInformation = new Tumblr_User_GetUserInformation($session);\n\n// Get an input object for the Choreo\n$getUserInformationInputs = $getUserInformation->newInputs();\n\n// Set inputs\n $getUserInformationInputs->setAPIKey(TUMBLR_CONSUMER_KEY)->setAccessToken($AccessToken)->setAccessTokenSecret($AccessTokenSecret)->setSecretKey(TUMBLR_CONSUMER_SECRET);\n\n// Execute Choreo and get results\n$getUserInformationResults = $getUserInformation->execute($getUserInformationInputs)->getResults();\n\nreturn $getUserInformationResults;\n}\n\n\nTo get response I simply say:\n\nRaw response returned by Tumblr:\n\n<?php\n\n// Get current user info for Tumblr\n$currentUserResults = getUserInfo($session);\n\nprint_r($currentUserResults);\n?>\n\n\nTHE MODIFIED FUNCTION\n\nfunction getUserDash($session) {\n\nglobal $AccessToken, $AccessTokenSecret;\n\n// Instantiate the Choreo, using a previously instantiated Temboo_Session object, eg:\n$getUserDashboard = new Tumblr_User_GetUserDashboard($session);\n\n// Get an input object for the Choreo\n$getUserDashboardInputs = $getUserDashboard->newInputs();\n\n// Set inputs\n $getUserDashboardInputs->setAPIKey(TUMBLR_CONSUMER_KEY)->setAccessToken($AccessToken)->setAccessTokenSecret($AccessTokenSecret)->setSecretKey(TUMBLR_CONSUMER_SECRET);\n\n// Execute Choreo and get results\n$getUserDashboardResults = $getUserDashboard->execute($getUserDashboardInputs)->getResults();\n\nreturn $getUserDashboardResults;\n}\n\n\nTo get response I say\n\n //Raw response returned by Tumblr:<br>\n<?php\n\n // Get current user info for Tumblr\n $currentUserResults = getUserDash($session);\n\n print_r($currentUserResults);\n ?>\n\n\nThe two functions are in different php files namely index.php and dashboard.php . Please show me where I could be having errors."
] | [
"php",
"api",
"tumblr",
"user-defined-functions",
"temboo"
] |
[
"Firebase Real-time Database connection from Java -> JavaScript",
"I want to set up a Firebase Real-time Database connection from my Java backend to my JavaScript frontend, but the messages are not pushed to the client.\n\nThe backend Java code looks like this:\n\nFirebaseOptions options = new FirebaseOptions.Builder()\n .setServiceAccount(getServletContext().getResourceAsStream(\"/WEB-INF/xxx.json\"))\n .setDatabaseUrl(\"https://xxx.firebaseio.com\")\n .build();\n\nFirebaseApp.initializeApp(options);\n\n\nDatabaseReference ref = FirebaseDatabase\n .getInstance()\n .getReference();\n\nref.child(\"users\").setValue(\"aaa\");\n\n\nMy javascript code on the frontend looks like this:\n\nvar config = {\n apiKey: \"xxx\",\n authDomain: \"xxx.firebaseapp.com\",\n databaseURL: \"https://xxx.firebaseio.com\",\n storageBucket: \"xxx\",\n messagingSenderId: \"xxx\"\n};\nfirebase.initializeApp(config);\n\nvar database = firebase.database();\n\nvar myRef = firebase.database().ref(\"users\");\n\nmyRef.on('value', function(snapshot) {\n alert(5);\n});\n\n\nIs there something wrong with this code or why are the messages are not pushed? Am I missing something?"
] | [
"javascript",
"java",
"google-app-engine",
"firebase",
"firebase-realtime-database"
] |
[
"Clarification needed with not-equal operator",
"I wrote this program:\n\n#include <iostream>\n\nusing namespace std;\n\nvoid unequalityOperator(){\n\n cout << \"Running unequalityOperator...\" << endl;\n\n bool a = true, b = false;\n\n if ( a != b ) cout << \"!=\" << endl;\n if ( a =! b ) cout << \"=!\" << endl;\n}\n\nint main()\n{\n unequalityOperator();\n\n system(\"pause\");\n return 0;\n}\n\n\nAnd I was surprised that it run and printed both of the strings. So I tried the same thing with some other binary operators like <=, >=, etc. but it didn't work.\nTherefore I would like to understand whether there is a difference between != and =!.\n\nI do know that there are some operators like +=, -=, etc. that work differently and, e.g., the difference between += and =+ is that the addition will occur before or after (respectively) the actual command. And for this reason I suspect that there is difference with the hierarchy in the implementation of these operators, but I am not really sure what. \n\nSo please help me understand."
] | [
"c++",
"operators"
] |
[
"sed stripping hex from start of file including pattern",
"I've been at this most of this afternoon hacking with sed and it's a bit of a minefield.\n\nI have a file of hex of the form:\n\n485454502F312E31203230300D0A0D0AFFD8FFE000104A46494600\n\n\nI'm pattern matching on 0D0A0D0A and have managed to delete the contents from the start of the file to there. The problem is that it leaves the 0D0A0D0A, so I have to do a second pass to pick that up.\n\nIs there a way in one command to delete up to and including the pattern that you match to and save it back into the same file ? \n\nthanks in advance.\n\nID"
] | [
"sed"
] |
[
"Can lego EV3 brick be programmed to get user input?",
"Sorry I am totally new to Lego ev3 Mindstorms, I need to do this for a subject's project.\n\nI am going to program it using ROBOTC language, and to meet my project requirements I am thinking to allow user to enter input to the robot using the EV3 brick. Is it possible to do so? If possible how can I do it? \n\nLastly may I get some online guides to ROBOTC programming for Lego EV3 mindstorms?\n\nSorry for asking so many questions :(\n\nAny help is much appreciated! :)\nThank you very much! :)"
] | [
"lego",
"mindstorms",
"ev3",
"robotc"
] |
[
"Populate variables according to column index and other values",
"I have a dataset containing observations of cases. In reality each case is observed at ten different time periods (P1 to P10) and can be in one of 5 states (1 to 5) at each period.\n\nEach case is in state 1 at P1. A case can only progress from state 1 to 2 to 3 etc, and must pass from 1 to 2 before passing to 3 etc. A case does not necessarily change state during the observed period.\n\nIn my dataset I have the states of each case at P1 and P10 and also know in which period the case attained each state (S2 to S5 e.g. a value for S2 of 5 means the first observation of the case in state 2 was in P5).\n\nMy data is thus as follows:\n\n# Create test dataset #\n\ntest <- as.data.frame(c(1:8))\nnames(test) <- \"Obs\"\n\ntest$P1 <- 1\nfor (i in 2:9){\n test[[paste(\"P\",i,sep=\"\")]] <- NA\n}\ntest$P10 <- c(1,5,3,2,2,5,5,4)\n\ntest$S2 <- c(NA,2,4,9,7,3,3,2)\ntest$S3 <- c(NA,5,8,NA,NA,4,4,3)\ntest$S4 <- c(NA,7,NA,NA,NA,5,8,5)\ntest$S5 <- c(NA,9,NA,NA,NA,10,9,NA)\n\n\nI would like to recreate the sequence of observations P2 to P9 for each case, fill in the blanks so to speak. I tried the following:\n\nfunc <- function(base){\n for(i in 1:nrow(base)){\n if (is.na(base$S5[i])) {\n for (j in 2:9){\n base[[paste(\"P\", j, sep=\"\")]] <- NA\n }\n }\n else {\n for (j in 2:base$S5[i]){\n base[[paste(\"P\", j, sep=\"\")]] <- 5\n }\n }\n }\n base\n}\n\ntest <- func(test)\n\n\nI would like to populate all Pi columns where i <= the value of S5 with 5. Then do the same for S4, S3 and S2. The desired result being :\n\n Obs P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 S2 S3 S4 S5\n1 1 1 1 1 1 1 1 1 1 1 1 NA NA NA NA\n2 2 1 2 2 2 3 3 4 4 5 5 2 5 7 9\n3 3 1 1 1 2 2 2 2 3 3 3 4 8 NA NA\n4 4 1 1 1 1 1 1 1 1 2 2 9 NA NA NA\n5 5 1 1 1 1 1 1 2 2 2 2 7 NA NA NA\n6 6 1 1 2 3 4 4 4 4 4 5 3 4 5 10\n7 7 1 1 1 2 3 3 3 4 5 5 4 5 8 9\n8 8 1 2 3 3 4 4 4 4 4 5 2 3 5 NA\n\n\nAs an addition, once the final transition has occurred for a case, I would like all following values to be the dummy value 9:\n\n Obs P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 S2 S3 S4 S5\n1 1 1 9 9 9 9 9 9 9 9 9 NA NA NA NA\n2 2 1 2 2 2 3 3 4 4 5 9 2 5 7 9\n3 3 1 1 1 2 2 2 2 3 9 9 4 8 NA NA\n4 4 1 1 1 1 1 1 1 1 2 9 9 NA NA NA\n5 5 1 1 1 1 1 1 2 9 9 9 7 NA NA NA\n6 6 1 1 2 3 4 9 9 9 9 5 3 4 5 10\n7 7 1 1 1 2 3 3 3 4 5 9 4 5 8 9\n8 8 1 2 3 3 4 4 4 4 4 5 2 3 5 NA\n\n\nFor this last part I could use :\n\nfor(i in 1:nrow(test)){ \n test$last_chg[i] <- ifelse(is.na(test$S2[i]),NA,max(test[i,c(12:15)], na.rm=T))\n}\n\n\nto obtain the column index of the last state change, but how would I populate all columns to the right of this with 9?"
] | [
"r"
] |
[
"Using SignalR Hubs, connection is lost after some time - why?",
"In my SignalR app, callbacks are fired as expected on a page. If the page is left for some time, callbacks are no longer invoked on that page until it is refreshed.\n\nI suspect that this could be due to the site's session expiring (using a client's session ID to invoke a client notification).\n\nI read here about the KeepAlive functionality and can see some references to it in the SignalR code. I am unclear if a client-side keep-alive needs to be implemented, and if so, how?"
] | [
"c#",
"asp.net-mvc-3",
"signalr",
"keep-alive"
] |
[
"Add new column in existing csv file in c#",
"I need insert new columns into one existing CSV file updated each day and as pipeline delimited\n||||||||||||||||||||||||||||||||||||||||||||||||||\n|Table1||||||||||||||||||||||||||||||||||||||||||||||||| \n|||||||||||||||||||||||||||||||||||||||||||||||||| \nN|IDI |TEST|START DATE HOUR |CAUSE|KIND|NUMB|NAMES| \n1|10704| |21/07/2020 15:05:54|L |MT |2786|NAV | \n2|10660| |21/07/2020 09:27:31|L |MT |4088|PIS | \n|||||||||||||||||||||||||||||||||||||||||||||||||| \n|Table2||||||||||||||||||||||||||||||||||||||||||||||||| \n|||||||||||||||||||||||||||||||||||||||||||||||||| \nN|IDI |TEST|START DATE HOUR |END DATE HOUR |LENGHT |RETURNS |CAUSE|KIND|NUMB|NAMES| \n1|10710| |21/07/2020 19:34:00|21/07/2020 20:19:09|00:45:09| - |L |MT |7806|ACC |\n2|10708| |21/07/2020 18:28:12|21/07/2020 18:28:13|00:00:01| - |T |MT |2600|LIT | \n3|10700| |21/07/2020 14:16:37|21/07/2020 15:19:13|01:02:36|21/07/2020 17:00|L |MT |4435|UHI | \n4|10698| |21/07/2020 14:06:45|21/07/2020 14:07:22|00:00:37|- |B |MT |5789|TYK |\n5|10674| |21/07/2020 10:21:04|21/07/2020 10:44:41|00:23:37|21/07/2020 12:30|T |MT |6699|FGR |\n||||||||||||||||||||||||||||||||||||||||||||||||||\n\nNote that the number of columns between table 1 and table 2 are different on CSV file\nFor table 1 the number of column is 8\nFor table 2 the number of column is 10\nI need adding missing columns into table 1 vs table 2\n\nEND DATE HOUR\nLENGHT\n\nI have tried preprocess csv file into a proper CSV using C#, adding missing columns, but the output is\n\nThe code have adding missing columns even table 2\nHow to do resolve this?\nThis the csv file\nMy code below\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Web.UI;\nusing System.Web.UI.WebControls;\n\npublic partial class _Default : Page\n{\n protected void Page_Load(object sender, EventArgs e)\n {\n int posNewColumn = 5;\n\n string output = @"C:\\Downloads\\import.csv";\n\n string[] CSVDump = File.ReadAllLines(output);\n List<List<string>> CSV = CSVDump.Select(x => x.Split('|').ToList()).ToList();\n for (int i = 0; i < CSV.Count; i++)\n {\n if (CSV[i].Count > posNewColumn)\n {\n CSV[i].Insert(posNewColumn, i == 0 ? "Headername" : "END DATE HOUR");\n }\n else\n {\n CSV[i].Add(i == 0 ? "Headername" : "END DATE HOUR");\n }\n }\n File.WriteAllLines(output, CSV.Select(x => string.Join("|", x)));\n }\n}"
] | [
"c#",
"csv"
] |
[
"Ruby multi-line backtick exec in Windows doesn't work",
"This is what I'm doing:\n\ncmd = \"echo foo\\n echo bar\"\nout = `#{cmd}`\n\n\nIn Linux I have \"foo\\nbar\". In Windows I have \"foo\". Why is that? How to fix?"
] | [
"ruby",
"windows"
] |
[
"Laravel - firstOrCreate not persisting all fields to the DB",
"I am using the firsOrCreate method to persist records if they already don't exists in the DB. This is my function:\n\n return ContentType::firstOrCreate(\n ['name' => $type], ['slug' => str_slug($type, '-')]\n );\n\n\nThe problem I have here is that the new record is created in the DB, but the slug field stays empty. Not sure why is that since the slug is created, because when I do \n\ndd(str_slug($type, '-'));\n\n\nBefore the method firstOrCreate() I do get the slug. \nSo, why it is not persisted to the DB?\n\nI have set up in my model the protect guarded array so, that should not be the problem:\n\n protected $guarded = [\n 'id'\n ];"
] | [
"php",
"laravel"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.