texts
sequence
tags
sequence
[ "what is meant by BOM?", "What is meant by BOM ? I tried reading this article but haven't really understood what does it mean. \n\nI read that some text editors put BOM before the beginning of a file. What it is meant for ?" ]
[ "encoding", "byte-order-mark" ]
[ "jQueryUI SelectMenu jumps to top of page when menu is opened/clicked in IE8", "I'm using the jQueryUI SelectMenu with a themeroller and it's working great in Chrome and Firefox. However, in IE8 (my lowest version needed and first IE to test), when I click the menu, the screen jumps to the top of the page, as if I had a bookmark/href to the top of the page (I don't).\n\nWhen I scroll down the page in Firefox or Chrome, then click the select menu, the dropdown appears and I can make a selection. When I repeat the steps in IE8, the page jumps to the top when I click the select menu.\n\nDoes anyone know if this is a bug with the SelectMenu and/or if there's any way to prevent it from happening?\n\nMy code is pretty basic and I'm providing it in case someone notices that I've implemented something wrong in the SelectMenu. I'm generating the content with Powershell (in the 'generated_content' div), in case that's important to anyone. Here's the snippet of HTML:\n\n<div class='wrapper'>\n<h1>Report</h1>\n<h3>Report Run Date: *Date*</h3>\n<hr class='title_separator'>\n\n<div class='selector'></div>\n\n<div class='generated_content'></div>\n\n</div>\n\n\nHere's the snippet of jQuery:\n\n$(document).ready(function() {\n $('.selector').append(\"<span id='space'>Select an item</span>: \");\n $('.selector').append(\"<select label='Select an item:' id='select_item'> </select>\");\n $('#select_item').append(\"<option selected disabled value=''> </option>\");\n $('#select_item').append(\"<option value='all'>All</option>\");\n\n $('#select_item').selectmenu()\n\n var changeSelect = function(event, item) {\n $(this).trigger('change', item);\n };\n\n $('#select_item').selectmenu({change:changeSelect});\n\n $('#select_item').change(function() {\n $('#select_item option:selected').each(function() {\n $('.generated_content').hide();\n\n if ($(this).attr(\"value\")==\"all\") {\n $('.generated_content').show();\n }\n else {\n $('#' + $(this).val()).show();\n } \n });\n });\n});\n\n$(window).load(function() {\n $('#selector').selectmenu('refresh');\n});\n\n\njQuery Versions\n\nI'm currently using jQuery 1.11.2 with jQueryUI 1.11.3. I also tried jQuery 1.9.0 with jQueryUI 1.10.0.\n\nThanks." ]
[ "javascript", "jquery", "jquery-ui" ]
[ "AWS CLI not working for VPN tunnel options", "I am trying to use AWS CLI:\n\naws ec2 modify-vpn-tunnel-options\n\n\nWhen I run it I get the following error:\n\n\n aws: error: argument operation: Invalid choice.\n\n\nBut according to modify-vpn-tunnel-options — AWS CLI Command Reference above should work. \n\nI have searched everywhere on google can't find anything. Does anyone know if there is another way to accomplish this?" ]
[ "amazon-web-services", "aws-cli" ]
[ "Filtering a query using a case statement that returns a list of possible values", "I want to change the filter based on a value, the code would look like this if this was valid syntax:\n\nSELECT\n Value\nFROM\n Table\nWHERE\n ID IN (CASE WHEN <expression> THEN (1,2,3) ELSE (1,2) END)\n\n\nSo I want to select a value, and the filter changes based on some expression. When the expression is true, I want to select all values with an ID of 1, 2, or 3. When the expression is false, I want to select all values with an ID of only 1 or 2. \n\nIt's not a straightforward = but selecting from a list of values which is why it doesn't work. How is this achievable?" ]
[ "sql", "sql-server" ]
[ "CSOM - Get user permissions for root folder of a library", "I am trying to get user permissions for some folder (I don't know which one in advance) in sharepoint document library. I am using code like this:\nvar folder = context.Web.GetFolderByServerRelativeUrl(relativeUrl);\ncontext.Load(folder);\ncontext.ExecuteQuery();\nListItem listItem = folder.ListItemAllFields;\ncontext.Load(listItem);\ncontext.ExecuteQuery();\nvar permissions = listItem.GetUserEffectivePermissions(userLoginName);\ncontext.ExecuteQuery();\n\nThis works for all folders except root folder of a document library. The exception says:\n\nCannot enable method or retrieve property from null object. The object\nreturned by the call stack below is null. ListItemAllFields\n\nIt seems like the root folder does not have a ListItem associated with it? How could I get those permissions for it then?\nThank you in advance." ]
[ "sharepoint-online", "csom" ]
[ "if(isset($_POST['submit'])) doesn't work", "I know there are a lot of questions here with the same title and problem but I've checked all of my syntax and I really have no clue why this doesn't work anymore (some time ago, it did work).\n\n<?php\ninclude_once(\"../../database/db_connect.php\");\ninclude '../../chromephp-master/ChromePhp.php';\ndate_default_timezone_set('Europe/Amsterdam');\n\nsession_start();\n\nChromePhp::log('Start...');\n\nif(!isset($_SESSION['username']) && !isset($_SESSION['password'])) {\n\n ChromePhp::log('Nothing in the SESSION.');\n\n if(isset($_POST['submit'])){\n ChromePhp::log('Lets have a look at the data...');\n (...)\n ChromePhp::log('Login successful!');\n\n header('Location: news.php');\n } else {\n ChromePhp::log('Empty form.');\n }\n\n} else {\n header('Location: news.php');\n}\n?>\n\n\nMy form looks as follows:\n\n<form method=\"post\" action=\"site/users/login\" >\n <input type=\"text\" name=\"username\" value=\"Gebruikersnaam\" /><br /><br />\n <input type=\"password\" name=\"pwrd\" value=\"Wachtwoord\" /><br /><br />\n <input type=\"submit\" name=\"submit\" value=\" Log in \" />\n</form>\n\n\nThe form is on the same page as the PHP code; I point the action to \"site/users/login\" because in the head of the HTML page, I set <base href=\"../../\">.\n\nWhen I submit the form, the page reloads and the log says \"Start...\", then \"Nothing in the SESSION.\" and finally \"Empty form.\".\n\nWhat am I doing wrong? All help is appreciated!\n\nEDIT: This is the content of my htaccess file:\n\nRewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteRule ^([^\\.]+)$ $1.php [NC,L]" ]
[ "php", "html", "forms", "session", "post" ]
[ "Ionic2 - 'this' in constructor execution order", "After struggling with accessing @ViewChild in constructor I've come to an observation I do not understand. It had quite important consequences in my app.\n\nSimplified app.component.ts code to demonstrate the point:\n\nexport class MyApp {\nmyProp: string;\n\nconstructor() {\n console.log( this ); //line A\n console.log( this.myProp ); //line B \n this.myProp = 'my string'; //line C\n}\n\n\nQuestion is: why does line A output the whole app object WITH myProp set to 'my string' while line B shows myProp as undefined?\n\nIn line A 'this' should have myProp as undefined as well since it is only set in line C. \n\nIt is all against code order.." ]
[ "angular", "typescript", "ionic2" ]
[ "check if custom attribute has specific value", "My problem seemed easy at first but i got stuck.\n\nI have some containers (divs) in my page with some custom attributes.\n\n<div class=\"myclass\" myattr1=\"blah\" myattr2=\"text1-text2-text3-text4-\"></div>\n\n\nmyattr1 and myattr2 are defined by me.\n\nAll divs are visible on page load.\n\nNow, depending on user selection from a list, i want to show only the divs with myattrib1=\"blah\" and hide the rest.\n\nI tried the following code, with no success at all\n\n$('#mySelectID').change(function() \n{\nvar startName = $(this).val();\n\n$(\".myclass\").not('[myattrib1!=\"+startName+\"]').toggle();\n\n});\n\n\nThe same approach will be used to filter results by attrib2, but there i will use myattrib2|=\"+startName+\" ( i think this is correct - thats why i have the extra - on the end of myattr2=\"text1-text2-text3-text4-\").\n\nCan anyone advice me on how to properly achieve this kind of filtering?\nthank you!" ]
[ "jquery-selectors" ]
[ "Xcode 7 Library search path warning", "This is the warning that it is showing: \n\n\n directory not found for option '-F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/Developer/Library/Frameworks' \"\n\n\nCan anyone help resolve the warning?" ]
[ "xcode", "xcode7" ]
[ "\"Error : Use of undeclared type MessagingDelegate\" in Firebase messaging", "I have updated my firebase messaging pod recently and followed the Quickstart guide of Firebase to perform necessary changes of upgradation. \n\nI added the new extension AppDelegate : MessagingDelegate extension but getting certain errors." ]
[ "ios", "swift3", "appdelegate", "firebase-notifications" ]
[ "How do I get Google Analytics to track individual images on a slideshow?", "I have a jQuery slideshow, I'm using the cycle plugin. I'm decent with jQuery, but I don't know how I should tie it in with Google Analytics to show me how many times each image is requested.\n\nI've looked around online but I haven't been able to find any good documentation for it.\n\nCan someone give me a simple example and maybe a link to the documentation supporting the example?\n\nThanks!\n\nEdit:\n\nThe key is just to use this code to send an event:\n\n\n_gaq.push(['_trackEvent', 'PageLocation', location.href]);\n\n\nBut you need to have the asyncronous syntax of calling Google Analytics, which will probably look something like this:\n\n\n<script type="text/javascript">\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', 'UA-xxxxxxx-1']);\n _gaq.push(['_setDomainName', 'site.com']);\n _gaq.push(['_trackPageview']);\n\n (function() {\n var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n })();\n\n</script>\n\n\nBTW you might need to wait for the document to be ready / loaded before executing the _gaq.push line :)" ]
[ "javascript", "jquery", "statistics", "google-analytics", "slideshow" ]
[ "simplifying a boolean expression?", "I have these 2 boolean expressions for 2 circuits that I have tried simplifying for a long time and I just cant figure it out. \n\na) AB'C' + ABD + AB'CD'\n\nb) (A+C+D) . (A+B'+C) . (A+B'+C'+D)\n\nI know for a the answer is AB'C' + AB'D' + ABD and then for b the answer is (A+C+D) . (A+B'+C) . (A+B'+D) but I have no idea how to arrive at the solutions for either two. I have tried using the fact that A+A' is 1 as well as the distributive and combining properties but its just not working out. I've been stuck on these last 2 for hours now. I would really appreciate any help anyone can give." ]
[ "boolean-expression", "boolean-operations", "circuit" ]
[ "C list->data doesnt show on terminal", "The console doesnt show the data from my list node.I filled it with chars that i took from a text File.\n\n#include<stdio.h>\n#include<stdlib.h>\n\nstruct list_node{\n char data;\n struct list_node* next;\n};\n\ntypedef struct list_node* node;\n\nnode insert_right(node list,char data)\n{\n node new_node = (node) malloc(sizeof(struct list_node));\n new_node->data = data;\n new_node->next = list->next;\n list->next = new_node;\n return new_node;\n}\n\nint main()\n{\n FILE *fr = fopen(\"dat1.txt\",\"r\");\n node list = (node) malloc(sizeof(struct list_node));\n int i;\n\n while((i = fgetc(fr)) != EOF){ \n insert_right(list,i); \n }\n printf(\"%c\",list->data);\n}\n\n\nThe main problem i think would be in the insert method." ]
[ "c", "list", "file", "struct", "nodes" ]
[ "java.lang.ClassCastException: Help me find whats wrong please", "OK HERE IS XML CODE http://i.imgur.com/PnhxAOB.png\n\nSigh I have been trying to fix this for over an hour i have no idea whats going on.. I get the error on the last row of code: ph0ne= (EditText) findViewById(R.id.testphone);\n\npublic class MyActivity extends Activity {\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_my);\n\n btn1= (Button) findViewById(R.id.buttonGoTonumber);\n btn2= (Button) findViewById(R.id.test3button);\n layHome = (LinearLayout) findViewById(R.id.layHomeddddddd);\n layAddNumer = (LinearLayout) findViewById(R.id.test3LAY);\n ph0ne= (EditText) findViewById(R.id.testphone);\n }\n}\n\n\nedit: for some reason I can't add the XML code.. Here is stackTrace:\n\n java.lang.RuntimeException: Unable to start activity ComponentInfo{com.spiratessgmail.myapplication/com.spiratessgmail.myapplication.MyActivity}: java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.EditText\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)\n at android.app.ActivityThread.access$800(ActivityThread.java:135)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:136)\n at android.app.ActivityThread.main(ActivityThread.java:5017)\n at java.lang.reflect.Method.invokeNative(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:515)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)\n at dalvik.system.NativeStart.main(Native Method)\n Caused by: java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.EditText\n at com.spiratessgmail.myapplication.MyActivity.onCreate(MyActivity.java:33)\n at android.app.Activity.performCreate(Activity.java:5231)\n at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)\n            at android.app.ActivityThread.access$800(ActivityThread.java:135)\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)\n            at android.os.Handler.dispatchMessage(Handler.java:102)\n            at android.os.Looper.loop(Looper.java:136)\n            at android.app.ActivityThread.main(ActivityThread.java:5017)\n            at java.lang.reflect.Method.invokeNative(Native Method)\n            at java.lang.reflect.Method.invoke(Method.java:515)\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)\n            at dalvik.system.NativeStart.main(Native Method)" ]
[ "android", "java.lang.class" ]
[ ".htaccess rewrite domain but keep directory structure and preserve url in address bar", "I have copied a Joomla site from one domain to a new domain.\n\nI want to rewrite the domain name only to keep the directory structure.\n\nAnd I want to keep the original URL in the address bar to preserve SEO ranking.\n\nJoomla is using relative url's, so the real domain name of the new server will not as such be invoked by Joomla.\n\nHow to do this in .htaccess on Apache?" ]
[ "apache", ".htaccess", "joomla" ]
[ "Parallelizing without pickle", "Alex Gaynor explains some problems with pickle in his talk \"Pickles are for delis, not software\", including security, reliability, human-readableness. I am generally wary of using pickle on data in my python programs. As a general rule, I much prefer to pass my data around with json or other serialization formats, specified by myself, manually.\n\nThe situation I'm interested in is: I've gathered some data in my python program and I want to run an embarrassingly parallel task on it a bunch of times in parallel. \n\nAs far as I know, the nicest parallelization library for doing this in python right now is dask-distributed, followed by joblib-parallel, concurrent.futures, and multiprocessing.\n\nHowever, all of these solutions use pickle for serialization. Given the various issues with pickle, I'm inclined to simply send a json array to a subprocess of GNU parallel. But of course, this feels like a hack, and loses all the fancy goodness of Dask.\n\nIs it possible to specify a different default serialization format for my data, but continue to parallelize in python, preferably dask, without resorting to pickle or gnu parallel?" ]
[ "python", "parallel-processing", "dask", "dask-distributed" ]
[ "How to use case on group by result in Oracle-sql", "I have a table containing the below column\n\nperson_id Person_Name Telephone_No City Email_Id Insert_TS\n\n\nand there are certain other column like Alternate_name etc.\nIn this table, whenever there is any update in any of the particular a row is inserted . For example \n\nP01 Radhe 0112311231 Bia [email protected] 09-NOV-2012 15:24:38 \nP01 Radhe Null Bia [email protected] 30-APR-2014 21:26:51 \nP02 Shayam 456897845 Albi [email protected] 30-APR-2014 14:36:03\nP03 Radha Null xyz [email protected] 31-APR-2014 14:36:03\n\n\nMeans, few record contains null in telephone field but all other fields have data\n\nI want to display person_id Person_Name Telephone_No City Email_Id columns such that if there is any row containing telephone_no value not null corresponding to one person_id then the latest record of that should be displayed \nelse\nlatest record of the person should be displayed\n\nto summarize display unique person_id with latest telephone_no for those person which does not have telephone_no latest record should be displayed.\n\nI tried this way :\n\nGet the unique person_id with latest telephone_no -- A\nGet all unique person_id with latest record --- B\n\ndisplay the data as (B-A) + A .\n\nBut that is taking too much time and that does not seems to be efficient .\nPlease suggest a query to fetch the records faster\n\nOther possible way could be using the case statement on group by result like grouping the values by Person_id if there is any telephone_no in each group display the one with latest value otherwise display the latest entry from group" ]
[ "sql", "oracle", "join", "group-by", "case" ]
[ "CSS rounded table corners in Firefox -- issue", "Having an issue applying the rules that rounders the upper-left and upper-right corners in the top heading (one with red background) in Firefox 4.\n\nhttp://jsfiddle.net/gFA4p/10/\n\nIs there some sort of precedence issue that I'm missing?" ]
[ "css", "firefox", "rounded-corners" ]
[ "Can't define new page mode correctly in Conkeror", "I can't seem to get even a basic new page mode working in Conkeror.\n\nIn my .conkerorrc I have this:\n\ndefine_page_mode(\"bz_mode\", \"BZ\");\nauto_mode_list.push([/bugzilla/, bz_mode]);\n\n\nThe documentation suggests (at least to me) that this should be sufficient. But when I visit (say) bugzilla.mycompany.com, I don't see the new mode indicated in Conkeror's mode line.\n\nWhat's the correct way to do this?" ]
[ "conkeror" ]
[ "JavaScript script replaces strings only when a local variable is defined", "This is how the script works:\n\nReads manifest.json file which contains file names\nReads functions.php file to result variable\nLoops through pages array. Within each iteration, creates regular expressions\nStrings matching the regular expressions are searched for in result variable. If a match is found, it is replaced with similar string from manifest.json\nResult variable is written to functions.php file\n\nScript:\n const manifest = fse.readJsonSync("./dist/manifest.json");\n\n fse.readFile("./functions.php", "utf8", function (err, data) {\n if (err) {\n console.log(err);\n }\n let result;\n for (let [i, page] of pages.entries()) {\n\n // page = "index";\n\n const scriptsRegEx = new RegExp(`/dist/scripts.${page}.+?'`, "g");\n const cssRegEx = new RegExp(`/dist/styles.${page}.+?'`, "g");\n result = data\n .replace(scriptsRegEx, `/dist/${manifest[`${page}.js`]}'`)\n .replace(cssRegEx, `/dist/${manifest[`${page}.css`]}'`);\n }\n fse.writeFile("./functions.php", result, "utf8", function (err) {\n if (err) return console.log(err);\n });\n console.log(result);\n });\n\nThe issue:\nIf I run the script as is, no string gets replaced inside functions.php. However, if I uncomment the page = "index" line inside the loop, strings get replaced inside functions.php. In short, the loop doesn't work. What could be the reason?" ]
[ "javascript", "node.js", "wordpress", "for-loop", "webpack" ]
[ "Dynamic Progress bar In WP7", "I have Many Page, and in each page I have to call the web service. for each call I need to show the Progressbar, and after the call returns I need to in visible the progress bar. this has to be done for Each Page. \n\nIs there any way, to Show the Progress bar Dynamically when service call is invoked?\n\nRegards,\nDinesh" ]
[ "windows-phone-7" ]
[ "Is there a bazel rule that supports publishing a go binary?", "On successful build of a go binary (cli) I would like to publish the binary to a repository manager e.g. Artifactory. I have found various references to uploading jar dependencies but nothing specific to the rules_go\nCan anyone point me in the right direction?" ]
[ "bazel", "bazel-rules" ]
[ "BDD - Test something is on every page", "We have a feature in our BDD test suite that describes that a specific link should appear at the top of every page, in our admin system.\n\nHow should we test this? Right now we have a scenario outline run through with 4 examples, 1 is the admin dashboard, and the other three are various actions you can do in the admin like edit something or view a list.\n\nIdeas?\n\nThanks :)" ]
[ "bdd", "behat" ]
[ "java -javaagent: printing java command use guidelines", "I'm trying to set a new agent using:\n\njava -javaagent:agent.jar\n\n\nWhen I run I see the java usage message.\n\nMANIFEST.MF:\n\nManifest-Version: 1.0\nCreated-By: 1.7.0_79 (Oracle Corporation)\nPremain-Class: org.mypackage.Agent" ]
[ "java", "javaagents", "jdk1.7" ]
[ "What if a class has no documented designated initializer?", "I am looking for general guidance on how to handle this situation. Here is a specific example.\n\nI am subclassing UIImageView and I want to override initWithImage to add my own initialization code after having the super class init itself with the supplied image.\n\nHowever, there is no documented designated initializer for UIImageView, so which super class initializer should I call to ensure my subclass is correctly initialized?\n\nIf a class does not designate an initializer, do I:\n\n\nAssume that it is safe to call any of the class's (UIImageView) initializers?\nLook to the super class (UIView) for the designated initializer?\n\n\nIn this case it seems #1 would be the answer as it makes sense to do the following in my overridden initializer:\n\n- (id)initWithImage:(UIImage *)image\n{\n self = [super initWithImage:image];\n if (self) {\n // DO MY EXTRA INITIALIZATION HERE\n }\n return self;\n}" ]
[ "objective-c", "ios", "cocoa-touch" ]
[ "Eclipse: stop code from running (java)", "Sometimes, I'll run a program that accidentally contains an infinite loop or something. Eclipse will let me continue editing the program, but be super slow. How can I stop it? (Do I want to restart the JVM?) Restarting eclipse itself always works, but that breaks my workflow." ]
[ "java", "eclipse", "jvm" ]
[ "Options for populating Vuex before component create in NuxtJS >= 2.12", "Before NuxtJS 2.12, we had two options to fetch data from server\n\nasyncData to pass it to components.\nOr fetch to populate the Vuex store.\n\nNow, starting NuxtJS 2.12 fetch(context) has been deprecated and a new hook fetch is introduced for Vue components.\nIn my application, I populate the Vuex store before page is rendered and then use Vuex getters to fetch properties in the component. I have replace the old fetch with new fetch hook in my component like below.\nasync fetch() {\n let url = `http://localhost:8080/post/id/1`;\n let response = await this.$axios.$get(url);\n if (response != null) {\n //Vuex action\n this.setPostDataAction(response);\n }\n}\n\nSince the fetch hook is called after create. Properties are fetched as null from the store during create phase and the component throws error for null values.\nI want suggestions on what approach should I follow starting NuxtJS >= 2.12 to populate the Vuex and are available during component create?" ]
[ "vue.js", "fetch", "vuex", "nuxt.js" ]
[ "Is return on a generator function still valid if you want to stop yielding?", "Supposed I have this code:\n\ndef yield_values():\n if do_something():\n yield 1\n yield 2\n\n if not do_something_bad():\n yield 3\n return\n\n yield 4\n\n\ndef do_something():\n return True\n\ndef do_something_bad():\n return False\n\nif __name__ == '__main__':\n function_gen = yield_values()\n print(next(function_gen))\n print(next(function_gen))\n print(next(function_gen))\n\n\nThey say that mixing yield and return in a generator function is a bad idea. But in my use case, if do_something_bad returns False already.. I wanted to yield 3 and exit so that the 4 is not yielded anymore.\n\nIs this perfectly legal or should I do another way?\n\nUpdated: Added try/except\n\ndef yield_values():\n if do_something():\n yield 1\n yield 2\n\n if not do_something_bad():\n yield 3\n return \"something\"\n\n yield 4\n\n\ndef do_something():\n return True\n\ndef do_something_bad():\n return False\n\nif __name__ == '__main__':\n try:\n function_gen = yield_values()\n print(next(function_gen))\n print(next(function_gen))\n print(next(function_gen))\n print(next(function_gen))\n except StopIteration as err:\n print(\"Error : \".format(err.value))\n1\n2\n3\nError :" ]
[ "python", "python-3.x" ]
[ "Binding with variable for username/pwd", "I am trying to take login input and pass to our AD server to authenticate a user. I keep getting an error : invalidCredentials, but I have verified the credentials a number of times. Am I using the variables correctly? Any feedback is appreciated. I currently have the following code.\n\n`@app.route('/login', methods=['GET','POST'])\ndef login():\n username = request.form['username']\n password = request.form['password']\n server = Server('dc.ourcompany.com', use_ssl=True, get_info=ALL)\n conn = Connection(server, user='%s' %username, password='%s' %password, raise_exceptions=False)\n conn.open()\n conn.bind()\n if not conn.bind():\n print('error in bind', conn.result)`\n\n\nAnd I am getting the following error: \n\nerror in bind {'dn': '', 'message': '80090308: LdapErr: DSID-0C0903A8, comment: AcceptSecurityContext error, data 52e, v1db1\\x00', 'result': 49, 'referrals': None, 'saslCreds': None, 'type': 'bindResponse', 'description': 'invalidCredentials'}" ]
[ "python-3.x", "flask", "ldap3" ]
[ "Suppressing \"is partial: introduced in iOS\" in parts of code", "My app is available also for iOS9...\n\nwhen declaring however\n\n- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath\n\n\ni get warnings on is partial: introduced in iOS 11.0+, which doesn't make sence in this case, since the method wont be called prior to iOS11\n\ni want to silence the warning for this part of code" ]
[ "ios", "objective-c", "cocoa", "xcode8" ]
[ "Extract and clean 'resendential address' using regex from OCR output of bill scans", "I am attempting to find, extract and clean addresses in a scan of a bill. Addresses begin with string like 'Address: | address | etc. ' and end 4 numerics (postcodes). \n\nRegex:\n\npossible_addresses = list(re.findall(\"^.ddress:[0-9]{4}\", data))\n\n\nAddress: 10 LEWIS ST, BERRI SA 5343" ]
[ "python", "regex" ]
[ "Output the index of the event in the solution when using VectorContinuousCallback in Julia/DifferentialEquations", "I have a dynamical system for which many events could occur. I want to terminate the integration of the trajectory on an event, but I also want to known which event has been activated.\nThe workaround I found is to use a global variable to save the event index in the affect! function. Here is a modified version of the bouncing ball example:\nusing DifferentialEquations\n\nfunction f(du,u,p,t)\n du[1] = u[2]\n du[2] = -p\n du[3] = u[4]\n du[4] = 0.0\nend\n\nfunction condition(out,u,t,integrator) # Event when event_f(u,t) == 0\n out[1] = u[1]\n out[2] = (u[3] - 10.0)u[3]\nend\n\nevent_idx = [0, ] # global variable\nfunction affect!(integrator, idx)\n event_idx[1] = idx\n terminate!(integrator)\nend\n\ncb = VectorContinuousCallback(condition,affect!,2)\n\nu0 = [50.0,0.0,0.0,2.0]\ntspan = (0.0,15.0)\np = 9.8\nprob = ODEProblem(f,u0,tspan,p)\nsol = solve(prob,Tsit5(),callback=cb,dt=1e-3,adaptive=false)\nprintln(sol.retcode)\nprintln(event_idx) # [1]\n\nIs there a better solution for doing this?" ]
[ "julia", "differentialequations.jl" ]
[ "YUI Tooltip not displaying on top of Panel", "Currently having a problem trying to get YUI Tooltips to display on top of a YUI Panel after it is shown that were previously created. The problem is is that the Panel cannot be registered to the overlay manager because it would require a TON of code to be changed and tested extending a hard deadline. The only way to get this to work is to setup the Tooltips after the Panel is shown. Problem there is the amount of code changes that would have to be done to attach another function call. My problem is that I was hoping that I could use the event handling to use \"showEvent\" but I cannot seem to get it to work (I apologize for word count):\n\nvar panel_obj = new YAHOO.widget.Panel('someID', {\n width: \"700px\",\n height: \"500px\",\n close: true,\n draggable: false,\n modal: true,\n constraintoviewport: true,\n visible: false,\n fixedcenter: true \n});\npanel_obj.render();\n\nvar tooltip_name = 'newTooltip1';\nvar element_id = 'htmlElementIDToBecomeTooltip';\n\nfunction createTooltip() {\n window[tooltip_name] = new YAHOO.widget.Tooltip(tooltip_name, {\n context: element_id,\n xyoffset: [15, -15],\n zIndex: 999\n });\n}\n\nfunction successfulScenario() {\n panel_obj.show();\n createTooltip();\n}\n\nfunction failedScenario1() {\n YAHOO.util.Event.addListener(\n 'someID',\n \"showEvent\",\n createTooltip\n );\n}\n\nfunction failedScenario2() {\n createTooltip();\n panel_obj.show();\n}\n\n\nThe only way I have seem to get it working is by running something like successfulScenario(). I'm coming from a jQuery background so I'm still learning YUI. I would love to be able to just extend (subclass) YAHOO.widget.Panel's show() function to call createTooltip but I'm not that much of a guru or I would probably need to change a very large codebase to do it." ]
[ "javascript", "events", "yui", "tooltip", "panel" ]
[ "SQL query suggestion for horizontal wise row union", "A table Family is like\n\nNo. ADD Member Det1 Det2 Det3 Det4\n\n1 Add1 Dad1 q w e r\n1 Add1 Mom1 q w e r\n1 Add1 Chd1 q w e r\n1 Add1 Chd1 q w e r\n1 Add2 Mom2 q w e r\n1 Add2 Chd2 q w e r\n1 Add2 Chd2 q w e r\n\n\nADD here is like family ID unique per family, Member is name of member and family can have any number members.\n\nDesired output:\n\nNo. ADD Member Det1 Det2 Det3 Det4 Member Det1 Det2 Det3 Det4 .. more\n1 Add1 Dad1 q w e r Mom1 q w e r .. more\n2 Add2 Mom2 q w e r Chd1 q w e r .. more\n\n\nI tried with creating alias to number of member\n\nSELECT a.ADD\n ,a.Member\n ,a.Det1\n ,a.Det2\n ,a.Det3\n ,a.Det4\n ,b.bDD\n ,b.Member\n ,b.Det1\n ,b.Det2\n ,b.Det3\n ,b.Det4\nFROM Family a\n ,Family b\nWHERE a.ADD = b.ADD" ]
[ "sql", "sql-server", "tsql" ]
[ "I want to find the lowest difference within the group and return the index.(Python, pandas)", "This is my df.\nindex firmcode year indcode ROA\n 0 a 2006 03 0.1\n 1 b 2006 03 0.2\n 2 c 2006 03 0.4\n 3 d 2006 03 0.7 \n 4 e 2006 07 0.3\n 5 f 2006 07 0.8\n 6 g 2006 07 1.1\n 7 h 2006 07 2.1\n\nI would like it to be as follows(Except for the same company).\nThis is ROA matching the nearest company(in same year, same indcode)\nindex firmcode year indcode ROA diff_min_firmcode\n 0 a 2006 03 0.1 b \n 1 b 2006 03 0.2 a\n 2 c 2006 03 0.4 b \n 3 d 2006 03 0.7 c\n 4 e 2006 07 0.3 f \n 5 f 2006 07 0.8 g \n 6 g 2006 07 1.1 f\n 7 h 2006 07 2.1 g \n\nHow can I get the df['diff_min_firmcode'] column?" ]
[ "python", "pandas" ]
[ "how can i upload a excel file in which two columns contain images using nodejs", "I found how to do it with PHP but I need to do this with nodejs and front end upload excel module on angular, I am using MEAN stack to perform this, please help I am just a beginner with nodejs" ]
[ "php", "node.js", "angular", "xlsx" ]
[ "Sorting rows in Oracle", "I needed some help in knowing whether we can have an option of sorting the rows of the table in Oracle based on the time of insertion.\n\nLike do we use any sorting of function based indexes. \n\nI would like to perform this operation of auto sorting without having to declare any new column for recording time.\n\nDoes the oracle server keep track of that information which i can use for sorting.\n\nThanks in advance" ]
[ "sql", "oracle", "rdbms" ]
[ "Passing information to @With annotation play framework for user authorization", "I am writing an application in play 2.4, before an action is carried out I want to ensure that a user has permission to perform the action.\n\nI am able to retrieve the current user using information in the request header but it would be useful if the actions name could be passed like this for example.\n\n@With(Authorization.class , action=\"create_account\")\npublic static Result createAccount(){\n return ok(\"Account created\");\n}\n\n\nand then authorization could do something like this.\n\npublic class Authorization extends Action.Simple{\n @Override\n public F.Promise<Result> call(Http.Context context) throws Throwable{\n if(action == \"zoom\")\n throw new UnauthorizedExcption(\"You can't do that!\");\n else\n return delegate.call(context);\n }\n\n\nSo essentially my problem is that I need to pass data to the Authorization class. Any solutions to this type of problem?" ]
[ "java", "annotations", "playframework-2.0", "authorization" ]
[ "Formatting the output of document.write() in JavaScript", "I've created a simple calculator which tells you the letter-grade you earned based on the score you got in a class. What I'm trying to do, however, is format the text of document.write(). Instead of simply printing the text, I want it to print out text with a specific sized font, a specific background color within the webpage (just around the output of document.write()) and I also want to underline the output generated.\n\n<html>\n <head><title>Letter-Grade Calculator</title></head>\n <body>\n <h3>Letter-Grade Calculator</h3>\n <script type=\"text/javascript\">\n\n var score = parseFloat(prompt (\"What is your score?\"));\n\n if (score >= 90){\n document.write(\"The score you entered is: \" + score + \". Your letter grade is: A!\");\n }\n else if (score >= 80 && score <= 89.9){\n document.write(\"The score you entered is: \" + score + \". Your letter grade is: B!\");\n }\n else if (score >= 70 && score <= 79.9){\n document.write(\"The score you entered is: \" + score + \". Your letter grade is: C!\");\n }\n else if (score >= 60 && score <= 69.9){\n document.write(\"The score you entered is: \" + score + \". Your letter grade is: D!\");\n }\n else {\n document.write(\"The score you entered is: \" + score + \". Your letter grade is: F!\");\n }\n\n </script>\n </body>\n</html>\n\n\nI've tired assigning the text within each document.write() to a particular variable, then calling that variable inside document.write() (example: say I have a variable 'gradeA' and then set the first if condition to return 'document.write(gradeA);' if true) and then using certain extensions I found online to try to modify the variable. But I wasn't able to get it to output what I needed." ]
[ "javascript", "document.write" ]
[ "C++, what is the purpose of argument type (void*&)?", "I am trying to understand a certain code where I found something hard to understand for me.\n\nvoid BPlusTree::GetKey(int key, void*& keyloc) const {\n keyloc = keys + key * attrLength;\n return 0;\n}\n\n\nThis function calculates the location (memory address) of the key value and store it at keyloc variable.\n\nvoid*& means the reference for a void pointer.\n\nAnd here reference is used to reflect the changed value of keyloc to the outer function which called `GetKey.\n\nAm I right till now?\n\nSo I thought that, in the main function, when it calls GetKey function. It needs to pass (void*) not the (void*&).\n\nint main() {\n.....\nint currPos = 0;\nchar* key = NULL;\nint result = currNode->GetKey(currPos, (void*&) key);\n}\n\n\nWhy is (void*&) used instead of (void*) here?\n\nThank you.\n\n// And I added here example code...\n\n#include <regex>\n#include <iostream>\n#include <stdlib.h>\n\nusing namespace std;\n#include <stdio.h>\n\nvoid foo(int &a, int &b) {\na = 10;\nb = 20;\n}\n\nvoid foo2(int* &c, int* &d) {\n*c = 10;\n*d = 20;\n}\n\nvoid foo3(void* &c, void* &d) {\n*(int*)c = 10;\n*(int*)d = 20;\n}\n\nint main(void) {\nint a = 0;\nint b = 0;\nint* c = new int;\nint* d = new int;\nvoid* e = malloc(sizeof(int));\nvoid* f = malloc(sizeof(int));\n\nfoo(a, b);\nprintf(\"A is %d and B is %d\\n\", a, b);\n\nfoo2(c, d);\nprintf(\"C is %d and D is %d\\n\", *c, *d);\n\nfoo3((void*&)c,(void*&) d); // It works fine\nprintf(\"C is %d and D is %d\\n\", *c, *d);\n\nfoo3((void*)c,(void*) d); // But it does not work\nprintf(\"C is %d and D is %d\\n\", *c, *d);\n}\n\n\nIs the (void*) problematic one?? :D" ]
[ "c++" ]
[ "How to write MYSQL query for user hierarchy relationship?", "I have user table. \n\n\nid - primary key\nuser_id - foreign key (user id)\nname\nusername\nemail\npassword\n\n\ntable relationship\n\n\nsuperadmin\n\nadmin1\n\nmanager1\n\nsalesman1\n\ncustomer1\ncustomer2\n\nsalesman2\n\ncustomer3\ncustomer4\n\n\nmanager2\n\nsalesman3\n\ncustomer5\ncustomer6\n\nsalesman4\n\ncustomer7\ncustom8\n\n\n\n\n\n\n[Question]\nWhen manager logged in then show all users under manager with salesman & customers.\n\nwhen admin logged in then all managers, salesman & customers will be visible.\n\nthis is same for all users. If user have users under him/her, he/she can see all user list.\n\nso I need help to write this type sql query.\n\nI wrote like this - \n\nSELECT t1.id, t1.group_id, t1.name AS superadmin, t2.name as admin, t3.name as manager, t4.name as salesman, t5.name as customer FROM users AS t1 LEFT JOIN users AS t2 ON t2.user_id = t1.id LEFT JOIN users AS t3 ON t3.user_id = t2.id LEFT JOIN users AS t4 ON t4.user_id = t3.id LEFT JOIN users AS t5 ON t5.user_id = t4.id where t3.id = 15\n\n\nI want this will hapen dynamically." ]
[ "php", "mysql", "join" ]
[ "global variable not found in llvm JIT symbol table", "I am trying to get a llvm::Module with a global variable to compile with the KaleidoscopeJIT Compiler, however, I get an error in the symbol lookup from the JIT compiler. (KaleidoscopeJIT.h source code from https://github.com/llvm-mirror/llvm/blob/master/examples/Kaleidoscope/include/KaleidoscopeJIT.h )\nUpon inspection of the Symbol Table in the LegacyRTDyldObjectLinkingLayerBase, I indeed see that the global variable has not been added to Symbol table. Is this because the global variable is uninitialized? If so how should I specify an initializer for a struct using the llvm C++ api?\nI have an IR code generated that looks like this\nModuleID = 'my jit module'\nsource_filename = "my jit module"\ntarget datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"\n\n%g = type { double, double }\n\n@r = external global %g\n\ndefine double @b() {\nentry_b:\n %p = alloca %g, align 8\n %0 = getelementptr %g, %g* %p, i32 0, i32 1\n store double 1.170000e+02, double* %0, align 8\n %1 = load %g, %g* %p, align 8\n store %g %1, %g* @r, align 8\n %2 = load double, double* %0, align 8\n ret double %2\n}\n\nHowever, when the JIT compiler tries to compile the function "b", I get an error saying\nFailure value returned from cantFail wrapped call\nSymbols not found: [ _r ]\n\nThe error occurs when trying to compile the IR code line\nstore %g %1, %g* @r, align 8\n\nas the JIT is not able to find the symbol corresponding to the global variable "r" in the symbol table of the JIT." ]
[ "c++", "compiler-construction", "llvm", "jit" ]
[ "Any downsides to using statically linked applications on Linux?", "I seen several discussions here on the subject, but wanted to ask about my particular situation:\n\nIf I have some 3rd part libraries which my application is using, and I'd like to link them together in order to save myself the hassle in LD_LIBRARY, etc., is there any downside to it on Linux, other then larger file size?\n\nAlso, is it possible to statically link only some libraries, and other (standard Linux libraries) to link dynamically?\n\nThanks." ]
[ "linux", "dynamic", "static", "linker" ]
[ "Bash script echo seems to remove my new lines?", "This is the contents of my file file.txt:\n\nheader\na\nb\nc\n\n\nI have no idea what is going on. This command does not print new lines.\n\necho -e $(tail -n +2 file.txt)\n\n\nThis prints:\n\na b c\n\n\nBut if you write it to file you will clearly see new lines:\n\ntail -n +2 file.txt >> new_file.txt\n\n\ntest.txt\n\na\nb\nc\n\n\nHow do I force echo to print the new lines? I don't think I can use printf here without making some kind of loop." ]
[ "bash", "shell", "unix", "echo" ]
[ "jQuery - altering HTML using remove or replaceWith", "I need to alter some HTML using jQuery - (I have no control over the HTML hence I need to use something client side to make this slight alteration)\n\nIf a <br /> is the first element in a div named 'column', then I need to remove it.\n\nSo:\n\n<div class=\"column\">\n <br />text here lorem ipsum blah<br />\n\n\nWould become:\n\n<div class=\"column\">\n text here lorem ipsum blah<br />\n\n\nNote, I don't want to get rid of all the <br /> tags, only if a <br /> tag directly follows the opening tag.\n\nI had hoped something like this would work, but no joy\n\n$('<div class=\"column\"><br />').replaceWith('<div class=\"column\">');\n\n\nAny help appreciated! Many thanks!" ]
[ "jquery", "html" ]
[ "How to change istio ingress loadbalancer external IP", "I want to change my istio ingress loadbalancer IP but when i try updating the yaml file it is not getting updated\n\nNAME TYPE CLUSTER-IP EXTERNAL-IP\nistio-ingressgateway LoadBalancer 10.123.196.149 52.174.141.126\n\n\nI have to change my EXTERNAL-IP to different IP." ]
[ "kubernetes-ingress", "istio", "nginx-ingress", "azure-load-balancer" ]
[ "Creating and Emailing a PDF via .Net Webpage", "I have a project that requires me to create a webpage that would allow users to fill-in information in a web page, create a pdf of the information( could be the whole HTML ), and email the pdf to someone. \n\nI'm using c# and .Net. Does anyone know of a way to do this or could point me in the right direction." ]
[ "c#", ".net", "pdf" ]
[ "Plot or highlight additional values in facet wrap graph", "I have some time series data, I've used a few functions to find specific x,y coordinates and wish to have them highlighted on the facet plot I've created. Not even sure if it's possible.\n\n# create sample data\nt<-seq(1:100)\na<-rnorm(1:100)\nb<-rnorm(1:100)\nc<-rnorm(1:100)\ng <-as.data.frame(cbind(t,a,b,c))\ng <- melt(g,id=\"t\")\n\n# current facet graph\nggplot(g,aes(x=t,y=value,color=variable))+\n geom_point()+\n facet_wrap(~variable)\n\n\nThis looks along the lines of what I've got right now. But I've also got the additional data below, which is a dataframe of x,y coordinates.\n\n# sample data with x,y coords\nx1 <- c(10,11,15)\ny1 <- c(5,6,9)\nx2 <- c(50,41,35)\ny2 <- c(25,27,19)\nxy<-rbind(x1,y1,x2,y2)\ncolnames(xy)<-c(\"a\",\"b\",\"c\")\n\n\nI'm not sure how to make this happen. I'd like the coordinates to be graphed in their individual plots." ]
[ "r", "ggplot2", "facet", "facet-wrap" ]
[ "Can't get Guice Injector Instance play 2.5 scalatest", "We are using scalatestplus-play 1.5.1 version. \n\nHere is the code snippet for BaseTestClass : \n\ntrait GuiceMock extends Suite with OneAppPerTest with BeforeAndAfterAll {\n\n def injector(): Injector = { app.injector }\n\n override def newAppForTest(testData: TestData): Application = {\n new GuiceApplicationBuilder().configure().configure(configurationMap)\n .disable(classOf[SomeModule], classOf[RedisSentinelModule])\n .bindings(getTestModule())\n .in(Mode.Test).build()\n }\n ...\n}\n\n\nIn my test I need an instance of injector similar to below : \n\ntrait ControllerFixture extends MockitoSugar with GuiceMock { \n ...\n\n val someClient = injector.instanceOf(classOf[SomeClient])\n\n ...\n}\n\n\nBut I am met with a null pointer exception @ this line : \n\n def injector(): Injector = { app.injector }\n\n\nAny pointers ?" ]
[ "scala", "playframework", "guice", "scalatest", "playframework-2.5" ]
[ "Google Smartlock: what to do when PromiseStatus: pending via Javascript in console", "we are integrating Google Smartlock. Every time we run the JS code to enable Smart lock on 1 screen it does nothing at all. And when we trigger it manually we only see this in console log.\n\nPromise {[[PromiseStatus]]: \"pending\", [[PromiseValue]]: undefined}\n\n\njavascript is like this\n\n<script>\n window.onload=function(e){\n var debug = true;\n var always = function() { console.log('Promise resolved: but dont understand how should process: we want/need to login') }\n navigator.credentials.get({password: true, unmediated: true, }).then(function(cred) { \n if (cred) {\n if (cred.type == 'password') { \n var form = new FormData();\n cred.additionalData = form;\n var url = 'domain.com/login';\n fetch(url, {method: 'POST', credentials: cred }).then(function(response) { \n if (response.status == 202) {\n if (debug) { console.log('Login success; reload stopped'); exit; }\n window.location.reload();\n }\n if (debug) { console.log('Server status: ' + response.status); }\n return;\n }).catch(function(err) { console.log('Smartlock Ajax error:'+ err); \n }).then(always, always);\n } // can add federated here\n } else if (typeof cred === \"undefined\") {\n // user clicks cancel or no credentials found\n var expiry = new Date(); expiry.setDate(expiry.getDate() + (1/3600*30));\n document.cookie=\"dontshowagain=true; expires=\" + expiry.toGMTString();\n }\n });\n\n }\n </script>\n\n\nQuestion: Does anyone know what is happening here?\n\nI tested with 1 saved passwd, with 2 saved passwd's. We do see the small key icon next to the URL in Chrome. But it doesn't popup or do anything. \n\nHelp/advise appreciated\n\n\n\n\n\nReferences: \nhttps://support.google.com/accounts/answer/6160273?hl=en" ]
[ "javascript", "android", "google-chrome", "google-smartlockpasswords" ]
[ "Following guides on import AOSP into Android studio, still many errors", "I'm following How to import android source code(AOSP) into Android studio? and (2) https://shuhaowu.com/blog/setting_up_intellij_with_aosp_development.html\n\nI have run \n\n$ cd development/tools/idegen\n$ mm\n$ development/tools/idegen/idegen.sh\n\n\nI have created an SDK configuration with no libraries\n\n\n\nI have set the project to use SDK 1.8 (no libraries)\n\n\n\nI have removed extra dependencies per (2)\n\n\n\nI have sourced ut/target/common/R per (2).\n\nBut there are still tons of errors. For instance WORKING_DIRECTORY/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java\n\n\n\nI cannot build the project either in Android Studio.\n\nI have no problem in building it in command line with \"make\".\n\nHow do I fix errors in the IDE?" ]
[ "android", "android-studio", "android-source" ]
[ "No module named PyQt5.sip", "After upgrading to python-pyqt5 5.12-2 I get this error when I try to import from QtWidgets\n\nfrom PyQt5.QtWidgets import * \n\n\nError:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nModuleNotFoundError: No module named 'PyQt5.sip'\n\n\nAny idea on how can I solve this issue?" ]
[ "python", "python-3.x", "qt", "pyqt", "pyqt5" ]
[ "Angular post request to google got stuck by CORS", "Url : http://local.m2.xxx.com/login\n\nthis.$http.post('https://accounts.google.com/o/oauth2/token', {\n 'code': code,\n 'redirect_uri': '***',\n 'client_id': '******',\n 'client_secret': '****',\n 'grant_type': 'authorization_code'\n }, {\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }\n })\n .success((data, status, headers, config)=> {\n deferred.resolve(data);\n })\n .error((data, status) => {\n deferred.reject(data);\n });\n\n\nI also set Authorized JavaScript origins as http://local.m2.xxx.com\n\nbut still getting XMLHttpRequest cannot load https://accounts.google.com/o/oauth2/token. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '***' is therefore not allowed access. The response had HTTP status code 405.\n\nCant find the solution" ]
[ "javascript", "angularjs", "xmlhttprequest", "google-login" ]
[ "How to emulate PUB/SUB with unix sockets (AF_UNIX, SOCK_DGRAM)?", "I am struggling to make this simple communication working.\n\nI made it with zmq in less than five minutes.\nDoing it with UNIX sockets is a pain (obviously because of my lack of confidence).\n\nThis is the server:\n\n#include <sys/socket.h>\n#include <sys/un.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n\n#include \"streamsocket.h\"\n\nchar *socket_path = \"/tmp/stream\";\nint socket_fd=0;\nstruct sockaddr_un addr;\n\nint main(){\n socket_setup();\n while(1){\n socket_sendstr(\"a\");\n sleep(1);\n }\n}\n\nvoid socket_setup(){\n\n int rc;\n\n memset(&addr, 0, sizeof(addr));\n addr.sun_family = AF_UNIX;\n strcpy(addr.sun_path, socket_path);\n\n if ( (socket_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {\n perror(\"socket error\");\n exit(-1);\n }\n\n rc=bind(socket_fd, (struct sockaddr *) &addr, sizeof(addr));\n if(rc<0){\n perror(\"bind error\");\n exit(-2);\n }\n\n}\n\nint socket_sendstr(char* buffer) {\n int len=strlen(buffer);\n // corrected after suggestion in answer below (rc->len)\n // int rc=write(socket_fd, buffer, rc);\n int rc=write(socket_fd, buffer, len);\n\n if (rc != len) {\n if (rc > 0) fprintf(stderr,\"partial write\");\n else {\n perror(\"write error\");\n //exit(-1);\n }\n }\n}\n\n\nAnd this is the client:\n\n#include <sys/socket.h>\n#include <sys/un.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n\nint main(){\n char * server_filename = \"/tmp/stream\";\n char * client_filename = \"/tmp/stream-client\";\n\n struct sockaddr_un server_addr;\n struct sockaddr_un client_addr;\n\n int rc;\n\n memset(&server_addr, 0, sizeof(server_addr));\n server_addr.sun_family = AF_UNIX;\n strncpy(server_addr.sun_path, server_filename, 104); \n\n memset(&client_addr, 0, sizeof(client_addr));\n client_addr.sun_family = AF_UNIX;\n strncpy(client_addr.sun_path, client_filename, 104);\n\n // get socket\n int sockfd = socket(AF_UNIX, SOCK_DGRAM, 0);\n\n // bind client to client_filename\n rc = bind(sockfd, (struct sockaddr *) &client_addr, sizeof(client_addr));\n if(rc==-1) perror(\"bind error\");\n\n // connect client to server_filename\n rc = connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr));\n if(rc==-1) perror(\"connect error\");\n\n\n char buf[1024];\n int bytes=0;\n while(bytes = read(sockfd, buf, sizeof(buf))){\n printf(\"%s\\n\",buf);\n }\n\n close(sockfd);\n}\n\n\nWhat I am doing wrong?\n\nAt the moment the client does not print anything.\n\nEDIT1: correct wrong \"rc\" in server write( , ,rc) to write( , ,len)\n\nEDIT2: as client does not work socat either:\n socat UNIX-CLIENT:/tmp/stream -\n\nso I think that the problem could be in the server." ]
[ "c", "sockets", "unix-socket" ]
[ "Filamanaging limited to Cpanel Filemanager?", "I am renting hosting (and URL) from a company (hostgator) which gives me cpanel as my default way of entering the website.\n\nAm i limited to using the Cpanel File Manager in browser to sort my files?\n\nIs there another way. For example linking a physical folder on my desktop to a file manager folder (inwhich they automatically update filemanager when i edit the folder in windows?). If other forms exist how safe are they for the health of my desktop and the files on my server?\n\nMy issue is i really dont think filemanager in cpanel is a very good user experience (viewing, sorting etc).\n\nThank you all for your help." ]
[ "html", "cpanel", "file-manager" ]
[ "How to get value of selected parameter on parameter change event in tableau Javascript API", "I have following code can anyone help me upon this:\n\n $(document).ready( \n function(){ \n viz = loadReport('<?php echo $url; ?>', 'viz', $(window).height()-$('#viz').offset().top-10, '100%','<?php echo ($login->hide_toolbar==1?true:false); ?>','<?php echo ($login->hide_tabs==1?true:false); ?>', function(){\n viz.addEventListener(tableau.TableauEventName.TAB_SWITCH, onTabSwitch);\n viz.addEventListener(tableau.TableauEventName.PARAMETER_VALUE_CHANGE, onParameterValueChange);\n prepareSavedViewState();\n });\n\n }\n);\n\n function onParameterValueChange(e){\n //e.preventDefault();\n //alert(e.getEventName());\n //alert(e.getParameterName());\n //alert(e.getParameterName().getCurrentValue());\n //alert(e.getCurrentValue());\n //alert(e.Parameter.getCurrentValue());\n //alert(Parameter.getCurrentValue());\n alert(e.getParameterAsync().getCurrentValue());\n}\n\n\nI am trying to get value of selected parameter of tableau dashboard on live server but not getting the value. Actually parameter object is working fine but not understanding how to get value." ]
[ "javascript", "dom-events", "tableau-api" ]
[ "Simple inheritance question in Objective-C", "I have two Objective-C classes and one is derived from the other as\n\n@interface DerivedClass : BaseClass\n{\n}\n\n\nThe code section below belongs to BaseClass:\n\n- (id)init {\n if (self = [super init]) {\n [self configure]; \n } \n return self;\n}\n\n- (void) configure{} //this is an empty method\n\n\nAnd the code section belongs to the DerivedClass:\n\n-(void) configure{\n NSLog(@\"derived configure called\");\n}\n\n\nNow, when I say derivedInstance = [DerivedClass new]; and watch the call stack, I see that the configure method of my derived class gets called at the [self configure] line of the base's init method.\n\nI'm an Objective-C noob and I'm confused about how a method of a derived class gets called from the method of a base class. \"self\" keyword is explained to be the same thing as \"this\" keyword of some languages but I think this explanation is not completely correct, right?" ]
[ "objective-c", "inheritance", "message", "self" ]
[ "Why does `mask_` neutralize `timeout`?", "I finally was able to track a weird bug I was having down to the (at least to me) surprising interaction between mask and timeout:\n\nimport System.Timeout\nimport Control.Exception\n\nack :: Int -> Int -> Int\nack m n | m == 0, n >= 0 = n + 1\n | m > 0, n == 0 = ack (m - 1) 1\n | m > 0, n > 0 = ack (m - 1) (ack m (n - 1))\n\ntryack :: Int -> Int -> IO (Maybe Int)\ntryack m n = timeout 100000 {- uS -} $ evaluate $ ack m n\n\nmain :: IO ()\nmain = do\n a <- tryack 3 11\n print a -- Nothing\n\n b <- mask_ $ tryack 3 11\n print b -- Just 16381 after a few seconds\n\n\nThis strikes me as a rather \"non-compositional\" interaction, as it means that if a library internally uses timeout, an externally applied mask somewhere up the call-chain may cause the library to malfunction.\n\nSo is this a (known) deficiency in the implementation of timeout or is it intentional?" ]
[ "exception", "haskell", "exception-handling", "timeout" ]
[ "How can I compile multiple C++ files to use them with Python ctypes?", "I have a little problem with the compilation of multiple C++ on Windows.\nI implemented four classes in C++ for cryptography with gmp. I want to call them from Python with ctypes.\nI wrote a cpp file with the extern keyword:\n\n#include \"integer.h\"\n#include \"modular_number.h\"\n#include \"padic_number.h\"\n#include \"rational_number.h\"\n\nextern \"C\" {\n __declspec(dllexport) ModNum* newModNum(const char * n, const char * p) { return new ModNum(Integer(n), Integer(p)); }\n __declspec(dllexport) const char* getModValue(const ModNum& mod){ return mod.getValue().getValue(); }\n\n __declspec(dllexport) RationalNum* newRationalNum(const char* mpq) { return new RationalNum(mpq); }\n __declspec(dllexport) const char* getRationalValue(const RationalNum& rat){ return rat.getValue(); }\n\n __declspec(dllexport) PadicNum* newPadicNum(const char* n, const char* base) { return new PadicNum(Integer(n), Integer(base)); }\n __declspec(dllexport) const char* getPadicValue(const PadicNum& padic){ return padic.getValue().getValue(); }\n}\n\n\nI compiled my files with:\n\nmingw32-g++ -fexceptions -g -fexpensive-optimizations -flto -O3 -Weffc++ -Wextra -Wall -std=c++14 -fPIC -Og -IC:\\MinGW\\include -flto -s -lgmp -lmpfr -lpthread -c -fPIC *.cpp -I\"C:\\Program Files\\Python38-32\\include\" -I\"C:\\Program Files\\Python38-32\\libs\"\n\nmingw32-g++.exe -shared -Wl,-dll -o numeric.dll *.o -lgmp -lmpfr -lgmpxx -static\n\n\nBut when I use these commands in Python:\n\nimport ctypes;\nx = ctypes.DLL(\"./numeric.dll\");\n\n\nThe variable x does not have the functions: newModNum, getModValue, etc...\nCould anyone tell me what I'm doing wrong? I get no error and I do not understand.\nMy other files are common C ++ files with header and implementation.\n\nThanks in advance and have a nice day!" ]
[ "python", "c++", "ctypes", "gmp" ]
[ "Flink on EMR - no output, either to console or to file", "I'm trying to deploy my flink job on AWS EMR (version 5.15 with Flink 1.4.2). However, I could not get any output from my stream.\nI tried to create a simple job:\n\nobject StreamingJob1 {\n def main(args: Array[String]) {\n val path = args(0)\n val file_input_format = new TextInputFormat(\n new org.apache.flink.core.fs.Path(path))\n file_input_format.setFilesFilter(FilePathFilter.createDefaultFilter())\n file_input_format.setNestedFileEnumeration(true)\n\n val env = StreamExecutionEnvironment.getExecutionEnvironment\n val myStream: DataStream[String] =\n env.readFile(file_input_format,\n path,\n FileProcessingMode.PROCESS_CONTINUOUSLY,\n 1000L)\n .map(s => s.split(\",\").toString)\n\n myStream.print()\n // execute program\n env.execute(\"Flink Streaming Scala\")\n }\n}\n\n\nAnd I executed it using the following command:\n\n\n HADOOP_CONF_DIR=/etc/hadoop/conf; flink run -m yarn-cluster -yn 4 -c my.pkg.StreamingJob1 /home/hadoop/flink-test-0.1.jar hdfs:///user/hadoop/data/\n\n\nThere was no error, but no output on the screen except flink's INFO logs.\n\nI tried to output to a Kinesis stream, or to an S3 file. Nothing was recorded.\n\n myStream.addSink(new BucketingSink[String](output_path))\n\n\nI also tried to write to a HDFS file. In this case, a file was created, but with size = 0.\nI am sure that the input file has been processed using a simple check:\n\nmyStream.map(s => {\"abc\".toInt})\n\n\nwhich generated an exception.\n\nWhat am I missing here?" ]
[ "amazon-emr", "flink-streaming", "sink" ]
[ "Populating an excel file from word vba", "I'm writing a macro that will populate an excel file with user inputs from active x controls in word. I've got almost everything working except that I keep getting an error message when I try and select cell A1 in the sheet that I want to use in the workbook. Here is the code:\n\n Workbooks.Open (\"mypath\\myfile.xlsm\")\n Workbooks(\"myfile.xlsm\").Activate\n Worksheets(\"sheet1\").Select\n Range(\"A1\").Select\n Do Until (IsEmpty(ActiveCell.Value))\n ActiveCell.Offset(1, 0).Select\n Loop\n ActiveCell.Value = n\n ActiveCell.Offset(0, 1).Value = a\n ActiveCell.Offset(0, 2).Value = b\n ActiveCell.Offset(0, 3).Value = c\n Columns(\"D:D\").EntireColumn.AutoFit\n Columns(\"A:A\").EntireColumn.AutoFit\n Columns(\"B:B\").EntireColumn.AutoFit\n Columns(\"C:C\").EntireColumn.AutoFit\n Workbooks(\"myfile.xlsm\").Save\n Workbooks(\"myfile.xlsm\").Close\n\n\nThe variables in this block of code are the values of the active x controls and are located much further up in the sub. This block of code is a small part of an if statement within the sub. Anyhow, when I take Range(\"A2\").Select out of the code, it works just fine except for the fact that the information that I want to input does not go to the right spot (since it didn't select range A1 to begin with).\n\nThe error I get is type mismatch 4218." ]
[ "vba", "excel", "ms-word" ]
[ "Tracking non-idle time spent on active tab in Google Chrome for a given domain", "I've never done any Chrome extension development for, but I'd like to monitor how long a certain tab is active showing a page originating from a given domain.\n\nWhere should I start? And perhaps there is already an extension tool for this?" ]
[ "google-chrome-extension", "time-tracking" ]
[ "How use C# to send Key Down & Key Down to another application", "I have a solution that I'm using to send key inputs to another application, however when I send \"Key Down\" it doesn't actually hold that key down, I would need to basically spam \"key down\" in some kind of update loop.\n\nI would appreciate it if anyone could show me how I might (using winforms) send a fake Key Down to another application, but I'm not looking for a keystroke.\n\n\r\n\r\n[DllImport(\"user32.dll\")]\r\n public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);\r\n [DllImport(\"user32.dll\")]\r\n public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);\r\n [DllImport(\"user32.dll\")]\r\n public static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);\r\n\r\n public static void SendKeystroke(Keys k)\r\n {\r\n const uint WM_KEYDOWN = 0x100;\r\n\r\n IntPtr WindowToFind = FindWindow(null, \"application\");\r\n\r\n IntPtr result3 = SendMessage(WindowToFind, WM_KEYDOWN, ((IntPtr)(ushort)k), (IntPtr)0);\r\n }\r\n\r\n public static void EndKeyStroke(Keys k)\r\n {\r\n const uint WM_KEYUP = 0x101;\r\n\r\n IntPtr WindowToFind = FindWindow(null, \"application\");\r\n\r\n IntPtr result3 = SendMessage(WindowToFind, WM_KEYUP, ((IntPtr)(ushort)k), (IntPtr)0);\r\n }" ]
[ "c#", "input", "keyboard", "key" ]
[ "How to print a decimal number up to n decimal values neglecting 0's if any at the end?", "I am trying to print the values of two numbers up to 4 decimal places excluding 0's if any at the end.\n\na= 0.125\nb= 0.256325\n\nprint(\"%.4f\" %round(a,4))\nprint(\"%.4f\" %round(b,4))\n\n\nThis gives me 0.1250 and 0.2563 but I want only 0.125 for a and 0.2563 for b\n\nI expect:\n\nif a is 0.125, 0.1250 or 0.125000, I should get only 0.125 as output and for all the other cases I can get 4 non zero values after \".\"" ]
[ "python", "printing", "number-formatting" ]
[ "How are multiple conditional statements evaluated in Python?", "If I need to evaluate multiple conditional statements, is it faster to use a nested series of if statements or to place all conditions within a single if statement separated by and? For example:\n\nx=[True, False, False, True]\ny=[0,1,2,3]\n\nfor i in list(range(len(x))):\n if x[i] and expensive_computation(y[i]):\n do_something\n\n if x[i]:\n if expensive_computation(y[i]):\n do_something\n\n\nWill the first conditional statement if x[i] and expensive_computation(y[i]) check the Boolean value of expensive_computation(y[i]) if x[i] is already False?" ]
[ "python", "python-3.x" ]
[ "Having issue on loading complex attributes data into array of array", "I have a set of element that has some data attributes. I am able to load single data attributes to an array of array dataAraay but on data-size which is like group of arrays in string format I don't know how to load them into the dataArray to exactly looks like\n\ndataArray = [\n [\"1\",\"true\",\"X1\",\"48\",\"14\",\"139\", \"android\"], \n [\"1\",\"true\",\"X1\",\"49\",\"15\",\"135\",\"51\",\"15\",\"140\",\"ios\"],\n [\"1\",\"true\",\"X1\",\"49\",\"800\",\"135\",\"51\",\"200\",\"140\",\"52\",\"14\",\"141\" \"windows\"]\n]\n\n\nHow can I fix this?\n\n\r\n\r\nlet dataArray = [];\r\n\r\n$(\".data\").each(function(){\r\ndataArray.push([ $(this).data('number'),\r\n $(this).data('avaiable'),\r\n $(this).data('brand'),\r\n // I have issue here on loading the zies into each array\r\n $(this).data('app')\r\n ]);\r\n\r\n});\r\nconsole.log(dataArray);\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<div class=\"data\" data-number=\"1\" data-avaiable=\"true\" data-brand=\"X1\" data-size=\"[48, 14,139]\" data-app=\"android\" ></div>\r\n<div class=\"data\" data-number=\"3\" data-avaiable=\"false\" data-brand=\"M200\" data-size=\"[49,15,135],[51,15,140]\" data-app=\"ios\" ></div>\r\n<div class=\"data\" data-number=\"5\" data-avaiable=\"true\" data-brand=\"T500\" data-size=\"[49,800,135],[51,200,140],[52,16,141]\" data-app=\"windows\" ></div>" ]
[ "javascript", "jquery", "html" ]
[ "How to integrate VS Code theme to WebStorm", "I am using \"Popping and Locking\" color theme in VS Code and I want to use same theme in WebStorm also. But VS Code is using .vsix extention and WebStorm is using .icls\n\nHow can I convert .vsix to .icls or how can I use same theme in WebStorm. Am I have to do it manually?" ]
[ "visual-studio-code", "themes", "webstorm" ]
[ "hide() function does not hide the image when is needed", "<ul id=\"ulBack\">\n <li><img data-src=\"coffee/01.jpg\" class=\"place\"></li>\n <li><img data-src=\"coffee/02.jpg\" class=\"place\"></li>\n <li><img data-src=\"coffee/03.jpg\" class=\"place\"></li> \n</ul>\n\n\n\n $('#btnNext').click(function () {\n $('#slide').hide();\n if (n < xlen) {n+=1;}\n else {n=0};\n change();\n border();\n });\n\nfunction change(){\n var goImg = $('#ulBack img' + ':eq(' + n +')').attr('data-src');\n $('#slide').attr('src', goImg);\n};\n\n\nAt the end of border() function I have: \n\n$('#slide').show(); \n\n\nSo, I want firstly hide the slide, then do all other things, and finally - show the slide. \n\nBut, it is evident that after clicking next button, program waits something, probably executes the rest of code, and then, at the end, just quickly hides and shows the slide, which is not the intention. \n\nYou can see here" ]
[ "jquery", "hide" ]
[ "Activate and Deactivate Favorite icons in Flutter", "I have this block of code. It includes List of tiles with country name and also includes favorite icon. I want the favorite icon to Activate and Deactivate on click. Please check this code and tell me what's wrong with the code or correct the code.\n\nimport 'package:flutter/material.dart';\nimport 'package:shared_preferences/shared_preferences.dart';\n\nvoid main() => runApp(\n MyApp(),\n );\n\nclass MyApp extends StatelessWidget {\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n home: Scaffold(\n appBar: AppBar(\n title: Text(\"Favorite Item\"),\n ),\n body: FavoriteItem(),\n ),\n );\n }\n}\n\nclass FavoriteItem extends StatefulWidget {\n @override\n _FavoriteItemState createState() => _FavoriteItemState();\n}\n\nclass _FavoriteItemState extends State<FavoriteItem> {\n @override\n Widget build(BuildContext context) {\n\n List<bool> _isFavorited = [];\n\n List<String> countryList = [\n 'India',\n 'America',\n 'Australia',\n 'Russia',\n 'Japan',\n 'China',\n 'Nepal',\n ];\n return Center(\n child: ListView.builder(\n itemCount: countryList.length,\n itemBuilder: (context, index) {\n return ListTile(\n title: Text(\n countryList[index],\n ),\n trailing: IconButton(\n onPressed: () => setState(\n () => _isFavorited[index] = !_isFavorited[index]),\n icon: _isFavorited[index]\n ? Icon(Icons.favorite)\n : Icon(Icons.favorite_border),\n ),\n );\n },\n ),\n );\n }\n}" ]
[ "flutter" ]
[ "Autofill date in html using jquery", "Table which has a \"date-inputfield\"(normal input type=\"date\" ta) and \"Add button\"(which creates new date-field)\n\nI'm using code from this website:\n\nI've just added an datefield\nLink to the code\n\nI found this solution but it lacks add button and how to increment the date over and over again.\n\njs fiddle code \n\nProblem I'm facing:\nuser has to fill date everytime he clicks Add button\n\nWhere I need help:\nI want user to fill the first date-field\nand when he clicks Add the date gets incremented by one\nand again he clicks Add the previous date gets incremented\n\nfor eg: \n\n\nuser enters 01/01/2018\nclicks add (new date-field generates)\nthe date field is set to 02/01/2018\nclicks add again (new date-field generates)\nthe date field is set to 03/01/2018\n\n\nas long as he clicks add button date keeps incrementing\n\nI have tried on(),prev(),closest() jquery method to target the previous date but nothing seems to work I even tried stepUp() method of javascript but i get tangled on how to target the previous date. I also thought of using moment.js,date.js but i don't know how to increment the date in dynamically created date field\n\nI've stuck in this problem for over a week.\nany suggestion on how I can improve my web development skill\nthanks:D\n\n<div id='holder'> </div>\n\n\n$(\"#holder\").append('<input id=\"date1\" />');\n$(\"#holder\").append('<input id=\"date2\" />');\n\n\n$('#date1').datepicker();\n$('#date2').datepicker();\n\n$('#date1').change(function(){\n var date1 = $('#date1').datepicker('getDate');\n var date = new Date( Date.parse( date1 ) ); \n date.setDate( date.getDate() + 1 );\n\n var newDate = date.toDateString(); \n newDate = new Date( Date.parse( newDate ) );\n\n $('#date2').datepicker('setDate', newDate );\n})" ]
[ "javascript", "jquery", "html", "date" ]
[ "Difference between two MySQL databases which are on two different remote machines (mysqldiff usage clarification)", "I just want to find out the difference between two mysql databases which are on two different remote machines, I know mysqldiff can be used for this kind of purpose, and I am using it. But the problem is, I can find the difference between the db on my (or local) machine with a remote database, But, If both databases , for which we want to find the difference are on two different remote machines, it is not possible (or I dont know how to use it). can anybody tell me how to achieve this.\n\nThanks in advance" ]
[ "mysql", "database" ]
[ "Is it possible to integrate B2C AD with Azure SQL server", "Is it possible to integrate Azure B2C with Azure SQL server for Authentication and Authorizations? Does Azure SQL server also supports B2C or the AD support is for ON-PREMISE supported AD only?" ]
[ "azure-active-directory", "azure-ad-b2c" ]
[ "Why does calling Stored Procedure in c# give InvalidOperationException when runs fine in SSMS?", "I have the following method calling an SP from C# app:\n\npublic bool CheckEmail(string email)\n {\n bool success = false;\n string name;\n\n\n using (SqlConnection con = new SqlConnection(Internal_Audit_Capture.Properties.Settings.Default.Intenal_AuditDB))\n {\n con.Open(); \n try\n {\n using (SqlCommand command = new SqlCommand(\"IntAudit.p_checkEmail\", con))\n {\n\n\n command.CommandType = CommandType.StoredProcedure;\n command.Parameters.Add(new SqlParameter(\"@email\", maskedTextBox1.Text.Trim()));\n command.Parameters.Add(\"@success\", SqlDbType.Bit).Direction = ParameterDirection.Output;\n command.Parameters.Add(\"@name\", SqlDbType.VarChar).Direction = ParameterDirection.Output;\n command.ExecuteNonQuery();\n success = (bool)command.Parameters[\"@success\"].Value;\n name = (string)command.Parameters[\"@name\"].Value;\n }\n\n return success;\n }\n\n catch (Exception ex)\n {\n MessageBox.Show(ex.ToString());\n return success;\n }\n }\n }\n\n\np_checkEmail queries the following table:\n\n[IntAudit].[LOGINDETAILS](\n[ID] [int] IDENTITY(1,1) NOT NULL,\n[NAME] [varchar](30) NOT NULL,\n[PASSWORD] [nvarchar](30) NOT NULL,\n[ADMIN] [bit] NULL,\n[EMAIL] [varchar](50) NOT NULL,PRIMARY KEY CLUSTERED ([ID] ASC))\n\n\nAnd it's code is:\n\ncreate procedure IntAudit.p_checkEmail\n@email varchar(50),\n@success bit OUTPUT,\n@name varchar(30) OUTPUT\nas\n\nset nocount on;\n\nif(exists(select 1 from [IntAudit].[LOGINDETAILS] where [EMAIL] = @email))\n begin\n select @name = [NAME] from [IntAudit].[LOGINDETAILS] where [EMAIL] = @email\n set @success = 1\n return\n end\nelse\n begin\n set @name = null\n set @success = 0\n return\n end\n\ngo\n\n\nRunning the checkEmail method gives a System.InvalidOperationException: String[2]: size property has invalid size of 0 error. Executing the procedure in SSMS runs fine though. The method is mean't to check for an email address in the table and return the username, if the address entered by the user exists. I have tried changing the data types but I still get the same error. Is there anything I am missing?\n\nEDIT: Exception Details:\n\nSystem.InvalidOperationException: String[2]: the Size property has an invalid size of 0.\n\nat System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)\n\nat System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 startCount, Boolean inSchema, SqlParameterCollection parameters)\n\nat System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC& rpc)\n\nat System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)\n\nat System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)\n\nat System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)\n\nat System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\n\nat Internal_Audit_Capture.ForgotPassword.CheckEmail(String email) in C:\\Internal Audit\\Internal Audit Capture\\Internal Audit Capture\\ForgotPassword.cs:line 41" ]
[ "c#", "winforms", "visual-studio", "tsql" ]
[ "Lacking await operators?", "Error comes up for the method requiring await operators but where do I put them and what is an await operator and async and Task? :)\n\n public async void OnLocationChanged(Location location)\n {\n\n _currentLocation = location;\n if (_currentLocation == null)\n {\n _locationText.Text = \"Unable to determine your location. Try again in a short while.\";\n }\n else\n {\n _locationText.Text = string.Format(\"{0:f6},{1:f6}\", _currentLocation.Latitude, _currentLocation.Longitude);\n as\n\n }\n }\n\n\nI want specific help in the example above :)" ]
[ "c#", "asynchronous", "xamarin" ]
[ "Include Guard still inserting Global Variables", "I have 3 *.c files (file1.c, file2.c and file3.c) and 1 *.h file (file3.h) in a project (Visual Studio).\n\n/*******************************\nfile3.h\n********************************/\n#ifndef FILE3_H\n#define FILE3_H\nint gintVariable = 400;\n#endif\n\n\n\n\n/*******************************\nfile1.c\n********************************/\n#include \"file3.h\"\n#include <stdio.h>\n#include <conio.h>\n\nint modifyGlobalVariable(void);\nvoid printGlobalVariable(void);\n\nint main(void)\n{\n modifyGlobalVariable();\n printGlobalVariable();\n printf(\"Global variable: %d\\n\", gintVariable++);\n getch();\n return 0;\n}\n\n\n\n\n/*******************************\nfile2.c\n********************************/\n#include \"file3.h\" \n\nint modifyGlobalVariable(void) \n{ \n return gintVariable++; \n}\n\n\n\n\n/*******************************\nfile3.c\n********************************/\n#include \"file3.h\"\n#include <stdio.h>\n\nvoid printGlobalVariable(void)\n{\n printf(\"Global: %d\\n\", gintVariable++);\n}\n\n\nWhen I build the solution in VS, it is giving error as \"_gintVariable already defined in file1.obj\".\n\nI did check in the pre-processor output, the gintVariable is included in all the *.c files even though I have included include guards.\n\nWhat mistake I am doing?" ]
[ "c", "global-variables", "include-guards" ]
[ "Minimize function with Scipy minimize", "Trying to obtain the d value (integer) for which the Std_Diff objective function is minimal, using Scipy minimize. \n\nMy code:\n\ndef Std_Diff(d):\n return std(diff(df['BN'].values,d));\n\nfrom scipy.optimize import minimize\nb=(3,)\nres = minimize(Std_Diff,(1,), method='SLSQP', bounds = b)\n\nThe **df['BN'].values** are \nOut[72]: \narray([ 2, 2, 2, 2, 3, 2, 7, 5, 7, 11, 8, 2, 11, 7, 15, 8, 7,\n 12, 21, 19, 32, 35, 40, 35, 21, 19, 25, 20, 40, 80, 99], dtype=int64)\n\n\nError is\n\n\n IndexError: too many indices for array\n\n\nIn case I do not use bounds:\n\nres = minimize(Std_Diff,(1,), method='SLSQP')\n\n\nI get another error: \n\n> in _minimize_slsqp(func, x0, args, jac, bounds, constraints, maxiter,\n> ftol, iprint, disp, eps, callback, **unknown_options)\n> 368 fx = float(np.asarray(func(x)))\n> 369 except:\n> --> 370 raise ValueError(\"Objective function must return a scalar\")\n> 371 # Compute the constraints\n> 372 if cons['eq']: ValueError: Objective function must return a scalar." ]
[ "python", "scipy" ]
[ "Creating a log file with current time", "I am trying to do something similar to Appending current time to a new log file each time log4j is initialized.\nI am using log4c for logging. I would like to be able to create a new log file with each execution of the application. Is it possible to do this, by only modifying the log4crc config file.\nAll help will be greatly appreciated\n\nps: The tag I wanted to used is log4c, but it isn't there in SO" ]
[ "c", "logging", "log4c" ]
[ "Koa doesn't parse 'body' from fetch POST request", "Here's the javascript code that request POST data to my server. when I print out the body data, It seems works fine, but Koa doesn't even parse 'body' from the request(using koa-bodyparser). I have no idea why this happens, It literally worked like a week ago.\n\nBrowser\n\njQuery(document).ready(function($) {\n $(\".mypage_container .btn-block\").click(async() => {\n let payload = {\n email: $('#username').val(),\n password: $('#password').val(),\n country: $('#CountriesDropDownList').val(),\n firstname: $('#firstname').val(),\n lastname: $('#lastname').val(),\n gender: checkGender(),\n address1: $('#address1').val(),\n zipcode: $('#zipcode').val(),\n mobile: $('#mobile').val(),\n newsletter: newsLetter()\n }\n\n let option = {\n method: \"POST\",\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(payload)\n }\n\n try {\n let res = await fetch('/signup', option)\n } catch (e) {\n console.error(\"failed to send signup request\", e)\n }\n })\n\n})\n\n\nServer\n\nrouter.post('/signup', async (ctx, next) => {\n let data = ctx.request.body\n\n console.log(ctx.request.body, ctx.request) // says undefined on first variable, request info without 'body' from the request.\n try {\n let user = new User(data)\n await user.save()\n ctx.body = data\n } catch (e) {\n console.error(e)\n }\n})" ]
[ "javascript", "node.js", "fetch", "koa", "koa2" ]
[ "Entity Framework connection string is being rewritten when website is published", "When publish a MVC website via Visual Studio it rewrites the connection string for Entity Frameworks with an invalid one.\n\nIt appears to be the same invalid one it created when I first imported the database model (not code first) The correct connection string is in my local web.config, and there are no changes being made by the web.release.config file.\n\nCorrect connection string:\n\n<add name=\"Entities\" connectionString=\"metadata=res://*/Models.MODModels.csdl|res://*/Models.MODModels.ssdl|res://*/Models.MODModels.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost;initial catalog=R4S-MOD;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"\" providerName=\"System.Data.EntityClient\" />\n\n\nGenerated connection String:\n\n<add name=\"Entities\" connectionString=\"Data Source=localhost;Initial Catalog=R4S-MOD;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework\" providerName=\"System.Data.EntityClient\" />" ]
[ "c#", "asp.net-mvc", "entity-framework" ]
[ "remove all occurrences of a given number from an array in C", "I'm trying to solve this question :\n\nYou've got an array of integers of somewhat SIZE - i.e, arr[SIZE].\nWrite a function which remove all occurrences of a given number x\nfrom an array\n\nI've wrote this function (below) which is suited for a case that the number is of 1 and only occurrence but not for multiple and I'm struggling to find a breakthrough for the last case (multiple occurrences) . My way of thinking was : in case of match - shift left one index all the element which are to the right side of the match and return the user a "new" size.\nFor the example below : { 3, 0, 5, 6, 6 }; and the number 5 the result will be (and indeed is) : { 3, 0, 6, 6 } , but for : { 3, 0, 5, 5, 6 }, I've got : { 3, 0, 5, 6 }. I know why do I get it but I don't know how to fix it. I tried using a flag which will give the indication of whether I have two adjacent match element and if it is loop again on this index\nCan someone please guide me to a solve ?\n#include <stdio.h>\n\n#define SIZE 5\nint arr[SIZE] = { 3, 0, 5, 6, 6 };\n\nint remove_occurences(int x)\n{\n int i, j;\n int removed = 0;\n\n for (i = 0; i < SIZE; i++)\n {\n if (arr[i] == x)\n {\n removed++;\n for (j = i; j < (SIZE - 1) ;j++)\n {\n arr[j] = arr[j+1];\n }\n }\n }\n return (SIZE - removed);\n}\n\nint main()\n{\n int new_length;\n int i;\n\n new_length = remove_occurences(5);\n for (i = 0; i < new_length; i++)\n {\n printf("%d ", arr[i]);\n }\n return 0;\n}\n\nThanks" ]
[ "arrays", "c" ]
[ "Changing original vector does not change it in a collection", "Why do I get different output? How can I fix this? I want the trainingVector[0] to reference A.\n\nvector<double> A(4,0);\nvector<vector<double > > trainingVector;\nA[0]=1;\ntrainingVector.push_back(A); \nA[0]=2;\ncout << A[0] << endl ;\ncout << trainingVector[0][0] << endl ;" ]
[ "c++", "pointers", "reference" ]
[ "I keep getting segmentation errors when I pass the capitol H flag through the command line, can anyone spot the segmentation error?", "this is my main class that accepts a h or H command line parsing and should print the contents of a hexidecmal header\n#include "p1-check.h"\n\nint main (int argc, char **argv)\n{\nFILE *file;\n\nelf_hdr_t h;\nint c;\n\nwhile ((c = getopt (argc, argv, ":if:hH")) != -1)\n{\nswitch (c)\n{\ncase 'h':\nusage_p1(argv);\nbreak;\ncase 'H':\n\n\nfile = fopen(optarg, "rb");\nread_header(file, &h);\ndump_header(h);\nfclose(file);\nbreak;\ndefault:\nreturn EXIT_SUCCESS;\nbreak;\n}\n}\n}\n\nI have a program that takes in command line arguments and a path to an elf file and displays the content of them using a struct. The elf header file is set up to have 16 bytes. Of those bytes, every two bytes describes something else about the header (version, entry point, etc) and the last four bytes hold a magic number that tells you it's the end of the file. The bytes are all in hex.\nbool read_header (FILE *file, elf_hdr_t *hdr)\n{\n if (hdr != NULL && file != NULL && fread(hdr, sizeof(*hdr), 1, file) == 1)\n {\n fread(hdr, sizeof(*hdr), 1, file);\n if (hdr->magic == 0x00464C45)\n {\n return true;\n }\n }\n return false;\n}" ]
[ "c" ]
[ "How can I combine the multiple strings in to one cell by using a reference cell in VBA?", "I have a VBA macro code that returns search results given a search criteria by using the AutoFilter syntax. \n\nThe purpose of this code is to search literature results and return all the results directly to Excel. \n\nThe problem I am running in to is that the current code is simply listing all the authors in the entire search results sheet and listing them in column A, one author at a time. \n\nFor each title there are multiple authors, so I would like to use a function to combine all author results for a corresponding article title into one cell. \n\nHow can I change my current code to use the last cell which is identified by \"SO\", as a reference point to combine all the authors as a string and return them into one cell. \n\nSub ReturnFAUResults()\n\n Dim r As Range\n\n Application.ScreenUpdating = True\n\n With Worksheets(\"Sheet1\") ' reference results sheet\n If IsEmpty(.Range(\"A1\")) Then .Range(\"A1\").Value = \"dummy header\" ' if A1 is empty, put a \"dummy\" header to make AutoFilter work properly\n\n .AutoFilterMode = False\n With .Range(\"B1\", .Cells(.Rows.Count, 2).End(xlUp)).Offset(, -1) ' reference referenced sheet column A range from row 1 down to column B last not empty cell\n .SpecialCells(xlCellTypeBlanks).Formula = \"=R[-1]C\" ' fill referenced range blank cells with the same value as the not empty cell above\n .AutoFilter Field:=1, Criteria1:=\"=FAU\"\n On Error Resume Next\n Set r = .Resize(.Rows.Count - 1, 1).Offset(1, 1).SpecialCells(xlCellTypeVisible)\n On Error GoTo 0\n If Not r Is Nothing Then r.Copy Worksheets(\"Search Results\").Range(\"A7\")\n .Parent.AutoFilterMode = False\n\n .SpecialCells(xlCellTypeFormulas).ClearContents ' clear cell with formulas\n If .Range(\"A1\").Value = \"dummy header\" Then .Range(\"A1\").ClearContents ' remove any \"dummy\" header\n End With\n End With\n\nApplication.ScreenUpdating = True\nEnd Sub" ]
[ "excel", "vba" ]
[ "WireCloud does not access marketplace", "I could manage to install a FIWARE instance but I cannot retrieve data from the FIWARE Marketplace.\nI have been following this: Forge.Fiware.org WireCloud\nbut it just says : Connection error: No resources retrieved.\nI'm using the URL : https://marketplace.lab.fiware.org as mentioned in the tutorial, but I notice that when I use it in my browser, I need to login first. From the WireCloud instance, I have not been prompted to enter a login/password, is this the cause of the problem ? How can I solve this ?\nThanks." ]
[ "fiware", "fiware-wirecloud" ]
[ "Is there an alternative to Cocoa Sourceview for Qt on Mac?", "Would anyone happen to know if Cocoa SourceView exists for Qt on Mac? I can't seem to find any info online and am not sure if this needs to be written by hand. Any help would be appreciated. Thanks!" ]
[ "c++", "macos", "qt", "cocoa", "widget" ]
[ "TreeView Bold Node (C#)", "I just have a quick question, actually, I just want to know if it’s possible to check if a node from a treeview is in Bold?\nBecause I can’t find a solution on the Internet.\n\nI have try this in my code :\n\n foreach (TreeNode node in nodesTvMsg)\n {\n\n if (node.NodeFont.Bold == true)\n {\n MessageBox.Show(\"BOLD\");\n } \n}\n\n\nbut it also works for those who are not bold and I also have this mistake :\nThe object reference is not defined to an instance of an object.\n\nThank in advance ;)" ]
[ "c#", "treeview" ]
[ "Silverlight Out of Browser Application making Http Requests through a proxy", "When running Silverlight 3.0 in OOB mode, you don't have to worry about any proxy authentication as the browser normally takes care of this.\n\nIf I've installed a Silverlight app in OOB mode, is there any way to authenticate against a proxy?" ]
[ "silverlight", "proxy", "out-of-browser" ]
[ "Socket programming- connecting several servers together", "For a project for Uni, we are building a very simple and basic distributed data-storage. So we started with a basic client-server connection which worked just fine. \nThe next part of the project is to connect several servers together so that (in the end) each server will be responsible for a different range of the stored data. \n\nI have written a very small method that creates a new socket for between the server and every other server. We were instructed to give the servers time to start before trying to connect to them. \nBut the method keeps throwing java.net.ConnectException: Connection refused (Connection refused).\n\nstatic void connectToOtherServers(int myPort) {\n\n for (int i = 0; i < ports.length; i++) {\n boolean isConnected = false;\n\n while (!isConnected) {\n try {\n if (myPort != ports[i]) {\n Socket socket = new Socket(addresses[i], ports[i]);\n sockets.add(socket);\n isConnected = true;\n }\n else if (myPort == ports[i]) {\n isConnected = true;\n }\n } catch(IOException e) {\n e.printStackTrace();\n try {\n Thread.sleep(1000);\n System.out.println(\"sleeping\");\n } catch(Exception e2) {\n e2.printStackTrace();\n }\n }\n }\n }\n}\n\n\nAnd the constructor of the class has already a listening socket for incoming connections.\n\npublic App (int port) throws IOException {\n selector = Selector.open();\n heineStore = new HeineStore();\n\n // Setup server socket for listening\n serverSocket = ServerSocketChannel.open();\n serverSocket.socket().bind(new InetSocketAddress(port));\n serverSocket.configureBlocking(false);\n\n // Register acceptor for OP_ACCEPT events\n SelectionKey key = serverSocket.register(selector, SelectionKey.OP_ACCEPT);\n key.attach(new Acceptor(heineStore));\n}\n\n\nHope any of you guys have suggestions on how to solve this problem.\n\nEDIT: I tried connecting a client to the first server and then starting all other servers (3 other servers), they all connected to the first server (that established a connection with a client) but then they are stuck in the loop while trying to connect to each other.\nOne of the requirements for the project though, is that the servers are first established a connection to one another and only then connect to a client." ]
[ "java", "sockets", "nio", "serversocket" ]
[ "Laravel queue listener times out", "On my Linux server I have the following cron:\n\n* * * * * php /var/www/core/v1/general-api/artisan schedule:run >> /dev/null 2>&1\n\n\nThe CRON works correctly. I have a scheduled command defined in my Kernel.php as such:\n\n protected function schedule(Schedule $schedule)\n {\n $schedule->command('pickup:save')\n ->dailyAt('01:00');\n $schedule->command('queue:restart')->hourly();\n }\n\n\nThe scheduled task at 1AM runs my custom command php artisan pickup:save. The only thing this command does is dispatch a Job I have defined:\n\n public function handle()\n {\n $job = (new SaveDailyPropertyPickup());\n dispatch($job);\n }\n\n\nSo this job is dispatched and since I am using the database driver for my Queues, a new row is inserted into the jobs table.\n\nEverything works perfectly up to here.\n\nSince I need a queue listener to process the queue and since this queue listener has to run basically forever, I start the queue listener like this:\n\nnohup php artisan queue:listen --tries=3 &\n\n\nThis will write all the logs from nohup to a file called nohup.out in my /home directory\n\nWhat happens is this: The first time, queue is processed and the code defined in the handle function of my SaveDailyPropertyPickup job is executed.\n\nAFTER it is executed once, my queue listener just exits. When I check the logs nohup.out, I can see the following error:\n\nIn Process.php line 1335:\n\n The process \"'/usr/bin/php7.1' 'artisan' queue:work '' --once --queue='default' \n --delay=0 --memory=128 --sleep=3 --tries=3\" exceeded the timeout of 60 seconds.\n\n\nI checked this answer and it says to specify timeout as 0 when I start the queue listener but there are also answers not recommending this approach. I haven't tried it so I dont know if it will work in my situation.\n\nAny recommendations for my current situation?\n\nThe Laravel version is 5.4\n\nThanks" ]
[ "php", "laravel", "laravel-5.4" ]
[ "how to have different description meta tags for each site with master.html", "I am following the advice on \n\nhttp://haacked.com/archive/2009/04/03/tipjar-title-tags-and-master-pages.aspx/\n\nto get different title tags for each page on my website. I use \n\n<head runat=\"server\">\n <title>\n <asp:ContentPlaceHolder ID=\"titleContent\" runat=\"server\" />\n </title>\n\n\n...\n\nin my master.html and \n\n{% extends \"master.html\" %}\n\n<asp:Content ContentPlaceHolderID=\"titleContent\" runat=\"server\">\nMy site\n</asp:Content>\n\n\nfor all my pages. My question is how can I also have different description tags for each page?" ]
[ "html", "asp.net" ]
[ "Why is tab bar not displayed correctly after being pushed animatedly from another view?", "I am pushing a tab bar controller into using a standard animated push segue on iOS 8, but here is what happens:\n\n\n\nSee the tab bar, it's cut halfway. If I invalidate layout using setNeedsLayout, layoutSubviews etc nothing works (I've even tried dispatching it after 2 seconds after view appears). If I tap home button and then come back, it re-layouts and displays correctly. This happens only the the segue is animated, if I make the same segue non-animated, the problem doesn't occur. How can I get rid of this behavior?" ]
[ "ios", "ios8", "segue", "uistoryboard", "uistoryboardsegue" ]
[ "Cluster standard errors for ordered logit R polr - values deleted in estimation", "I am quite new to R and used to pretty basic application. \nNow I have encountered a problem I need help with:\n\nI am looking for a way to cluster standard errors for an ordered logistic regression (my estimation is similar to this example)\n\nI already tried robcov and vcovCL and they give me similar error messages:\n\n\nError in meatCL(x, cluster = cluster, type = type, ...) : number\nof observations in 'cluster' and 'estfun()' do not match \nError in u[, ii] <- ui : number of items to replace is not a multiple of replacement length\n\n\nMany thanks in advance!\n\nEdit:\nI found some more information about the missing values but that does not seem to be the problem - because it persists even if I work around it using this answer, or when use a dataset without NA's. Just as in the example below. The problem seems to be that polr does not give me the residuals as part of the output. How can I work around this? \n\n dat <- read.dta(\"https://stats.idre.ucla.edu/stat/data/ologit.dta\")\n length(dat$apply)\n twenty <- seq(from=1, to=20, by=1)\n dat$clustervar<-sample(twenty, size=400, replace=TRUE)\n\n\n\n m <- polr(apply ~ pared + public + gpa, data = dat, Hess=TRUE)\n vcovCL <- function(x, cluster.by, type=\"sss\", dfcw=1){\n # R-codes (www.r-project.org) for computing\n # clustered-standard errors. Mahmood Arai, Jan 26, 2008.\n\n # The arguments of the function are:\n # fitted model, cluster1 and cluster2\n # You need to install libraries `sandwich' and `lmtest'\n\n # reweighting the var-cov matrix for the within model\n require(sandwich)\n cluster <- cluster.by\n M <- length(unique(cluster))\n N <- length(cluster)\n stopifnot(N == length(x$residuals))\n K <- x$rank\n ##only Stata small-sample correction supported right now\n ##see plm >= 1.5-4\n stopifnot(type==\"sss\")\n if(type==\"sss\"){\n dfc <- (M/(M-1))*((N-1)/(N-K))\n }\n uj <- apply(estfun(x), 2, function(y) tapply(y, cluster, sum))\n mycov <- dfc * sandwich(x, meat=crossprod(uj)/N) * dfcw\n return(mycov)\n }\n vcovCL(dat, m, dat$clustervar)\n\n\nThis gives me:\n\nError: N == length(x$residuals) is not TRUE\nCalled from: vcovCL(dat, m, dat$clustervar)" ]
[ "r", "regression", "logistic-regression" ]
[ "php if else statement: display data if there are results from either 2 functions", "I'd really appreciate some help with this code as I can't get it to work properly. \n\nI have two separate functions that both check a table in my database for data against an ID that is fetched from the page's URL. On displaying the information, I want to use an IF ELSE statement to check if there are results from either of those functions, and if there are no results, post nothing, and if there are results, post the results.\n\nBelow are my functions:\n\nfunction getArtistsBySongId($id) {\n $query = \"SELECT * FROM `Credit_To_Artist` AS c2a \n INNER JOIN `Credits` AS cr ON cr.credit_id = c2a.credit_id\n INNER JOIN `Artist` AS a ON a.artist_id = c2a.artist_id\n LEFT OUTER JOIN `Song` AS s ON s.song_id = c2a.song_id\n LEFT OUTER JOIN `Remix` AS r ON r.remix_id = c2a.remix_id\n LEFT OUTER JOIN `Project` AS p ON p.project_id = s.project_id\n WHERE c2a.song_id = $id\n ORDER BY a.artist_name ASC\";\n\n $res = mysql_query($query);\n\n $artists = Array();\n $artisttoid = Array();\n $songtoid = Array();\n\n while( $row = mysql_fetch_array($res) ) {\n $artist = $row[artist_name];\n $credit = $row[credit_name];\n $songcr = $row[song_id];\n\n if(!array_key_exists($artist, $artists) ) {\n $artists[$artist] = Array();\n $artisttoid[$artist] = $row[artist_id];\n $songtoid[$songcr] = $row[song_id];\n }\n\n $artists[$artist][] = $credit;\n\n } \n return array($artists, $artisttoid, $songtoid);\n}\n\nfunction getGroupsBySongId($id) {\n $query = \"SELECT * FROM `Credit_To_Artist` AS c2a \n INNER JOIN `Credits` AS cr ON cr.credit_id = c2a.credit_id\n INNER JOIN `Artist_Group` AS ag ON ag.group_id = c2a.group_id\n LEFT OUTER JOIN `Song` AS s ON s.song_id = c2a.song_id\n LEFT OUTER JOIN `Remix` AS r ON r.remix_id = c2a.remix_id\n LEFT OUTER JOIN `Project` AS p ON p.project_id = s.project_id\n WHERE c2a.song_id = $id\n ORDER BY ag.group_name ASC\";\n\n $res = mysql_query($query);\n\n $groups = Array();\n $grouptoid = Array();\n $song2id = Array();\n\n while( $row = mysql_fetch_array($res) ) {\n $group = $row[group_name];\n $credits = $row[credit_name];\n $songcred = $row[song_id];\n\n if(!array_key_exists($group, $groups) ) {\n $groups[$group] = Array();\n $grouptoid[$group] = $row[group_id];\n $song2id[$songcred] = $row[song_id];\n }\n $groups[$group][] = $credits;\n } \n return array($groups, $grouptoid, $song2id);\n }\n\n\nAt the moment I have this code:\n\n<?php\nif ((getArtistsBySongId($id) != NULL) OR (getGroupsBySongId($id) != NULL)) {\n include 'songs/getsongcredits.php';\n}\n?>\n\n\nWhile the code works in displaying my data, it seems to be ignoring my IF statement, and just posting what's in the include. Would someone be able to let me know the correct way to do this? Thanks in advance." ]
[ "php", "function", "if-statement", "null" ]
[ "git clone doesn't import all remote branches", "After I clone from a bare git repository, my imported local repository doesn't have all the branches in it. Following is the architecture.\n\n\n\nHere are the steps how this bare repository came into being.\n\n\nI had an existing repository (a in the figure). I did some branch\nfiltering within this branch to rule out some useless directories.\nCreated a new empty bare repository (b in the figure) using git init --bare new_repo.git\nIn the a local repository, I changed the remote URL using git remote set-url origin /path/new_repo.git.\nPushed the content of a to b using the command git push origin '*:*' and got success.\nAt this stage running the command git branch -r shows all the remote branches correctly.\nNow when I clone b (bare repository), the cloned local repository (c in the figure) gets created and it has the correct directory structure. But the problem is that when I try to list all the remote branches using git branch -r, it lists only the master branch.\n\n\nWhy doesn't the cloned repository have all the remote branches and how can I have all those imported?" ]
[ "git", "git-branch", "git-clone", "git-bare" ]
[ "How do I check the page name in an if statement?", "I have two pages (default.aspx and view.aspx) and want to add a class to an anchor tag depending on page name. The code would be something like the following, but I'm not sure what to put for the condition part of the if statement when I have pagename=\"default.aspx\".\n\n<li><a href=\"make.aspx\" <% if(pagename=\"default.aspx\") { %>class=\"open\"<% } %>><i class=\"icon-comment-alt\"></i> Make Request</a>\n<li><a href=\"view=.aspx\" <% if(pagename=\"view.aspx\") { %>class=\"open\"<% } %>>><i class=\"icon-folder-open-alt\"></i> View Requests</a></li>" ]
[ "c#", "asp.net" ]
[ "breakpoints in flask jinja templates", "Is there a way to put breakpoints in a jinja template that is being rendered from flask ? Maybe something that can enable you do inspect the variables that are available to the template at various points in the template ? Ive seen a blog that says you can do it in django https://opensourcehacker.com/2013/05/16/putting-breakpoints-to-html-templates-in-python/ was hoping for something similar with flask." ]
[ "python", "debugging", "flask", "jinja2" ]
[ "How to update after successful build-gnuradio?", "After successfully building gnuradio using the build-gnuradio script (Using the build-gnuradio script), is there a way to update and build everything new without starting over?\n\nE.g., some way to do all the right git pulls and build/install everything based on the changed files/dependencies." ]
[ "git", "build", "installation", "gnuradio" ]
[ "How to track transactions on ethereum using node application and fire a function on complete transaction", "I am trying to run a function if I got the ether on my wallet.\nI am using geth and nodejs. Can someone suggest me how to do that." ]
[ "blockchain", "go-ethereum" ]
[ "How do I programmatically remove a mask that was defined in Flash Professional?", "I realize this is a total newbie question, but it is driving me crazy...\n\nIn Flash Professional I have a movie clip, say 1000px high and 50px wide. I have it contained within (under) a mask layer where the mask is 100px high and 50px wide. In my program I move the movie clip vertically and as expected it is masked such that I only see 100px vertically. \n\nMy question is: how do I remove the mask from my movie clip? When I debug inspect the movie clip in Flash Builder, its .mask property is null. But it is masked... \n\nWhat am I missing?\n\nThanks in advance,\n\nGreg" ]
[ "flash", "actionscript", "flash-cs5", "mask" ]
[ "Deleting localstorage element via multiple buttons", "So i am using localStorage to add buttons to my html page. When the button is clicked, i want the corresponding entry of localStorage to be deleted.\n\nMy code so far:\n\nfor(let i=0;i<localStorage.length;i++)\n {\n var rem=document.createElement(\"button\");\n rem.innerHTML='<i class=\"fa fa-trash-o\" aria-hidden=\"true\"></i>';\n rem.setAttribute('background-color','white');\n rem.setAttribute('id',localStorage.key(i));\n rem.setAttribute('class','delbuttons');\n document.body.appendChild(rem);\n }\n\n\nSo if a button with a particular id is clicked, i want that corresponding key in localStorage to be deleted. I want the onclick for all buttons. \nSo far what i have thought of is:\n\nvar delb=document.getElementsByClassName(\"delbuttons\").addEventListener(\"click\",del);\n\n\nfunction del()\n{\n localStorage.removeItem('key');\n}\n\n\nI am stuck here and i don't know how to proceed further. I am ok with alternative methods (jQuery is fine too!)" ]
[ "javascript", "html", "event-handling", "local-storage" ]