texts
sequence | tags
sequence |
---|---|
[
"Change time zone by default in JS",
"PHP has a function called date_default_timezone_set it affects GMT that the Date() command used.\n\nIs there a way that it also affects the JS?\n\nI have this function:\n\nfunction calcTime(offset) {\n d = new Date();\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\n nd = new Date(utc + (3600000*offset));\n return nd;\n}\n\n\nMight be called instead to New Date (); problem with her she was good except I want to get New Date();\nBut if I want to pass on parameters so it's more of a problem ... For example,\nnew Date(year, month);\n\nDoes anyone have a solution like in PHP it just affects the New Date(); itself without changing the function be called?"
] | [
"php",
"javascript",
"date"
] |
[
"One Event for all my textBoxes. (VC# Windows Form Application)",
"I've searched a lot on this site and found similar questions but none of the answers could help me. So I'm going to ask myself. I have this code that doesn't work when I want to put all my textBoxes to the same event, here it is:\n\nprivate void OnMouseUp(object sender, MouseEventArgs e)\n{\n TextBox textBox = (TextBox)sender;\n textBox.SelectionLength = 0;\n}\n\n\nI made this code by looking at other answers on this site to similar questions.\nI also made this one by combining answers I found here on this site:\n\nprivate void OnMouseUp(object sender, MouseEventArgs e)\n{\n foreach (Control x in this.Controls)\n {\n if (x is TextBox)\n {\n ((TextBox)x).SelectionLength = 0;\n }\n }\n}\n\n\nWhich also doesn't work...\nCan someone please tell me the easiest way to give the same event to all your textBoxes?"
] | [
"c#",
".net",
"winforms"
] |
[
"Facets in marklogic using java",
"How to get Facets Information from MarkLogic using java API? I tried to figure our by referring to some docs but was unable to get the solution.\nPlease help in finding the solution.\n\nI made an element range Index on json Property named \"integerQuery\" \n \n\nNow trying to get faceted values and names from the code. \n\n DatabaseClient client=DatabaseClientFactory.newClient(\"10.53.195.198\",6010,\"nosql\",new \n DigestAuthContext(\"admin\",\"admin\")); \n\n QueryManager queryManager=client.newQueryManager();\n\n StructuredQueryBuilder queryBuilder=queryManager.newStructuredQueryBuilder();\n\n queryBuilder.jsonProperty(\"integerQuery\");\n StructuredQueryDefinition def=queryBuilder.or();\n SearchHandle handle= queryManager.search(def,new SearchHandle());\n System.out.println(handle.getFacetResult(\"integerQuery\")); //Prints NULL\n\n\nTried using query options with QueryOptionsBuilder but the class was removed in the updated MarkLogic java version.\n\nCan anyone suggest an answer detailed description of the faceted values from element range index ?\n\nI tried to learn from the intro course provided by them but it still uses QueryOptionsBuilder class.\n\nmy json document in database.\n\n{\n \"Name\": \"Flipkart\", \n \"integerQuery\": 7\n}"
] | [
"java",
"nosql",
"marklogic",
"facet",
"marklogic-9"
] |
[
"Why does my class not show in vue but my conditional class does?",
"I want to show two classes in my button. One that is conditional on a Boolean data value like "hideLeftArrow" and another class that shows up as the default like arrowBtn. The conditional class shows but the default class doesn't. What is wrong with my syntax in the following:\n:class="[{ hideArrow: hideLeftArrow }, arrowBtn]"\n\nMy full code for reference\n<template>\n <div class="showcase-container">\n <button\n @click="showRightArrow"\n :class="[{ hideArrow: hideLeftArrow }, arrowBtn]"\n >\n <img alt="left arrow" src="../assets/leftArrow.svg" class="arrow" />\n </button>\n <a\n v-for="game in games"\n :key="game.id"\n :class="{ hideGame: game.hide }"\n :href="game.link"\n target="_blank"\n >{{ game.name }}</a\n >\n <button\n @click="showLeftArrow"\n :class="[{ hideArrow: hideRightArrow }, arrowBtn]"\n >\n <img alt="right arrow" src="../assets/rightArrow.svg" class="arrow" />\n </button>\n </div>\n</template>\n\n<script>\nexport default {\n data() {\n return {\n games: [\n {\n name: "Tryangle",\n link: "https://google.com",\n id: 1,\n hide: false,\n },\n {\n name: "BagRPG",\n link: "https://youtube.com",\n id: 2,\n hide: true,\n },\n ],\n hideLeftArrow: true,\n hideRightArrow: false,\n };\n },\n methods: {\n showLeftArrow() {\n this.hideLeftArrow = !this.hideLeftArrow;\n this.hideRightArrow = !this.hideRightArrow;\n this.games[0].hide = true;\n this.games[1].hide = false;\n },\n showRightArrow() {\n this.hideLeftArrow = !this.hideLeftArrow;\n this.hideRightArrow = !this.hideRightArrow;\n this.games[0].hide = false;\n this.games[1].hide = true;\n },\n },\n};\n</script>\n\n<style lang="scss">\n@import "../styles.scss";\n.showcase-container {\n .hideArrow {\n visibility: hidden;\n }\n .arrowBtn {\n background: none;\n border: 0;\n }\n .hideGame {\n display: none;\n }\n}\n</style>"
] | [
"vue.js"
] |
[
"Installing wordpress in a different directory than root because another CMS is installed there",
"I have a weird situation with a client:\n\nThe root directory has a custom built CMS serving the site.\nThey want to rebuild the site in stages as it is very big.\nSo they want the new site in Wordpress and for the first stage just to build specific pages in Wordpress.\nSo obviously I would install WP in a sub directory or a different directory than root.\nBUT, they want the pages served by WP to not indicate a different URL path so if we create a page called page1 the URL needs to be:\nhttp://domainname.com/page1 not \nhttp://domainname.com/wp/page1\n\nObviously if a browser navigates to:\nhttp://domainname.com/page1\nthe CMS installed in root will try to serve the page and return a 404.\n\nSo my thinking is it must be possible to add a bunch of rules in the root folder htaccess (or with PHP) that check a list if the incoming request is for a URL we indicated in the list is meant to be served from WP, then to pull the files from the WP sub directory (bypassing the CMS installed in root) and rewrite the URL to root.\n\nSo if I go with my browser to:\nhttp://domainname.com/page1\nI will get the WP page\nand if I go with the browser to:\nhttp://domainname.com/wp/page1\nit will server that page but with a 301 redirect to:\nhttp://domainname.com/page1\n\nMakes sense? Anyone know if this is possible?\nI have tried but my htaccess/apache skills are not high enough to solve this one.\n\nThanks"
] | [
"php",
"wordpress",
"apache",
".htaccess"
] |
[
"need some space between 2 tabs in a magento site",
"under banners you can see \" new products\" , \"featured products\", \"best seller\" , \"on sale\" products.\n\nbetweeen new products\" & \"featured products\" ,\n\nI want to add space between \"new arrivals\" and \"featured products\" as in \n\nI want to display some space.\n\nplease help me to style between those 2 tabs.\n\nlet me know if you need any clarifications.\n\nthanks in advance."
] | [
"css"
] |
[
"Templated constexpr variable",
"I want to confirm that this code is legal (or not legal?) C++17.\n#include <iostream>\n\ntemplate<int N> inline constexpr float MyConst;\n\ntemplate<> inline constexpr float MyConst<1> = 1.1f;\ntemplate<> inline constexpr float MyConst<2> = 2.2f;\n\nint main ()\n{\n std::cout << MyConst<1> << '\\n';\n\n return 0;\n}\n\nI don't get errors (and get correct output) if compiled by g++ and MSVC,\nbut Intel and clang give an error:\ntest.cpp(3): error: missing initializer for constexpr variable\n template<int N> inline constexpr float MyConst;\n ^\n\nCompiled with -std=c++17 (/std:c++17 for MSVC).\nTried with latest compilers on godbolt as well as on my local machine."
] | [
"c++",
"templates",
"c++17",
"constexpr"
] |
[
"How do you handle arbitrary namespaces when querying over Linq to XML?",
"I have a project where I am taking some particularly ugly \"live\" HTML and forcing it into a formal XML DOM with the HTML Agility Pack. What I would like to be able to do is then query over this with Linq to XML so that I can scrape out the bits I need. I'm using the method described here to parse the HtmlDocument into an XDocument, but when trying to query over this I'm not sure how to handle namespaces. In one particular document the original HTML was actually poorly formatted XHTML with the following tag:\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n\n\nWhen trying to query from this document it seems that the namespace attribute is preventing me from doing something like:\n\nvar x = xDoc.Descendants(\"div\");\n// returns null\n\n\nApparently for those \"div\" tags only the LocalName is \"div\", but the proper tag name is the namespace plus \"div\". I have tried to do some research on the issue of XML namespaces and it seems that I can bypass the namespace by querying this way:\n\nvar x = \n (from x in xDoc.Descendants()\n where x.Name.LocalName == \"div\"\n select x);\n// works\n\n\nHowever, this seems like a rather hacky solution and does not properly address the namespace issue. As I understand it a proper XML document can contain multiple namespaces and therefore the proper way to handle it should be to parse out the namespaces I'm querying under. Has anyone else ever had to do this? Am I just making it way to complicated? I know that I could avoid all this by just sticking with HtmlDocument and querying with XPath, but I would rather stick to what I know (Linq) if possible and I would also prefer to know that I am not setting myself up for further namespace-related issues down the road.\n\nWhat is the proper way to deal with namespaces in this situation?"
] | [
"html",
"xml",
"linq",
"namespaces",
"linq-to-xml"
] |
[
"Change a text on a woocommerce website using code",
"I'm trying to change the english text \"By submitting this form, you hereby agree that we may collect, store and process your data that you provided\" in the bottom of the page with something else in Arabic. I'm using Wordpress with Woocommerce plugin and divi theme builder.\nthis is the url of the page i'm trying to edit (https://blockchainarabi.com/checkout/)"
] | [
"wordpress",
"woocommerce"
] |
[
"How to make call using Blackberry native sdk C/C++",
"How to make call using Blackberry native sdk C/C++. I can't find library in documentation which can help to make in coming call."
] | [
"blackberry-10"
] |
[
"chat bot for telegram",
"I create a bot for telegrams,\nhe should collect the id of everyone who wrote in the group chat for a certain time, but I can not extract the user's id from the messages, instead I get only the chat id\n\nThe question is how to me from messages sent to the chat to pull only the id of the user who sent the message.\n\nto create a bot I use a python, please, give examples only on it.\n\[email protected]_handler(commands=['MyID'])\n def get_id(msg):\n bot.send_message(msg.chat.id, \"ID USER\\n\")\n bot.send_message(msg.chat.id, msg.chat.id)"
] | [
"python",
"bots",
"telegram"
] |
[
"Makefile for Multiple Executables",
"I'm struggling to create a makefile for two executables\nI want to be able to create a makefile that builds everything and then executes exec1 and exec2\nI've got the following files with the headers included\narray.c: array.h const.h\nexec1.c: exec1.h array.h\nexec2.c: exec2.h array.h\nWhat I currently have for my makefile is:\nMAINS = exec1 exec2\nOFILES = exec1.o exec2.o\n\nall: $(MAINS)\n$(MAINS): %: %.o array.h const.h\n gcc -o $@ $^\n$(OFILES): %.o: %.c %.h array.h const.h\n gcc -c %.c\narray.o: %.c const.h\n gcc -c %.c\n\nBut it's not working. It says there's undefined references to some of the functions defined in array.h"
] | [
"c",
"makefile"
] |
[
"Click to scroll through testimonials",
"List is setup to cycle through testimonials.\nI would like to add left and right arrows to this so users can scroll also. \n\nJS fiddle below with current setup\n\n\r\n\r\n$(document).ready(function() {\r\n var divs = $('li[class^=\"testimonial-\"]').hide(),\r\n i = 0;\r\n\r\n (function cycle() {\r\n divs.eq(i).fadeIn(800)\r\n .delay(5000)\r\n .fadeOut(800, cycle);\r\n\r\n i = ++i % divs.length;\r\n })();\r\n});\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\r\n<ul id=\"testimonials\" style=\"list-style-type: none; padding-left:0;\">\r\n <li class=\"testimonial-1\">\r\n Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.\r\n </li>\r\n\r\n <li class=\"testimonial-2\">\r\n It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing\r\n </li>\r\n</ul>"
] | [
"javascript",
"jquery",
"html"
] |
[
"Combining multiple expressions to dynamically create select expression containing expressions as getters",
"Given an input of two expressions, e.g.:\n\nExpression<Func<Customer,string>> nameExpression = x=>x.Name;\nExpression<Func<Customer,string>> nameExpression = x=>x.MarketSegment.Name;\n\n\nand a \n\nIQueryable<Customer> query = ..//fetch from dbContext;\n\n\nI want to dynamically create an expression that selects these properties from the query.\n\nthe end result would have to execute as follows:\n\nExpression<IQueryable<Customer>,IQueryable<dynamic>> query = query.Select(x=>new{\n x=>x.Name,\n x=>x.MarketSegment.Name\n});\n\n\nI figured out that Expression.New could be an option in this question, but I'm unable to figure out how to pass expressions to it."
] | [
"c#",
"dynamic",
".net-4.5",
"expression-trees",
"linq-expressions"
] |
[
"Function IIF in loop statement",
"I have a working code that loops through the rows of an array then store the values into another array. No problem at the code in fact but I am trying to improve my skills and learn new skills\nThis is the code\nSub Test()\n Dim a, i As Long, j As Long, n As Long\n a = Cells(1).CurrentRegion.Value\n ReDim b(1 To UBound(a, 1) * UBound(a, 2))\n For i = LBound(a) To UBound(a)\n If i Mod 2 = 1 Then\n For j = LBound(a, 2) To UBound(a, 2)\n n = n + 1\n If a(i, j) <> Empty Then b(n) = a(i, j)\n Next j\n Else\n For j = UBound(a, 2) To LBound(a, 2) Step -1\n n = n + 1\n If a(i, j) <> Empty Then b(n) = a(i, j)\n Next j\n End If\n Next i\n Range("M2").Resize(n).Value = Application.Transpose(b)\nEnd Sub\n\nWhat I am trying to do is to compact the nested loop and this is my try\nFor j = iif(i mod2=1,LBound(a, 2) To UBound(a, 2),UBound(a, 2) To LBound(a, 2) Step -1)\n\nBut this seems not to ne valid. Any ideas?"
] | [
"excel",
"vba"
] |
[
"problem in creating php sessions from get variables",
"i have following in my url\nhttp://www.foo.com/?token=foo&tokenid=fooid\nnow i want to get those token and tokenid value and create sessions from both values...\ni have following in my php code\n\n$em = $_GET['token'];\n$emid = $_GET['tokenid'];\n$_SESSION['foo'] = $em;\n$_SESSION['fooid'] = $emid;\n\n\nbut it is not creating sessions ... how can i solve that"
] | [
"php"
] |
[
"Error Domain=NSCocoaErrorDomain Code=3840 \"JSON text did not start with array or object",
"The purpose of this code is to send data to a SQL database using PHP script. \nBut when I try to run it I get the following error:\n\n\n Error Domain=NSCocoaErrorDomain Code=3840 \"JSON text did not start with array or object and option to allow fragments not set.\" UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}\n\n\nThis is my code:\n\n// Send userdata to server side\nlet myURL = NSURL(string: \"http://localhost/userRegister.php\");\nlet request = NSMutableURLRequest(URL:myURL!);\nrequest.HTTPMethod = \"POST\";\nlet postString = \"email=\\(userEmail)&password=\\(userPassword)\";\nrequest.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding);\n\n// Create the task and execute it\n\nlet task = NSURLSession.sharedSession().dataTaskWithRequest(request){\ndata,response, error in\n\n if error != nil{\n print(\"error=\\(error)\")\n return\n }\n\n var err: NSError?\n\n do\n {\n let json = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableContainers) as? NSDictionary\n\n if let parseJSON = json {\n\n var resultValue = parseJSON[\"status\"] as? String\n print(\"result: \\(resultValue)\")\n\n var isUserRegisterd:Bool = false;\n if(resultValue==\"Success\")\n {\n isUserRegisterd = true\n }\n\n var messageToDisplay: String = (parseJSON[\"message\"] as? String)!\n\n if(!isUserRegisterd)\n {\n messageToDisplay = (parseJSON[\"message\"] as? String)!\n }\n\n dispatch_async(dispatch_get_main_queue(), {\n\n var myAlert = UIAlertController(title: \"Alert\", message: messageToDisplay, preferredStyle: UIAlertControllerStyle.Alert);\n let okAction = UIAlertAction(title: \"Oké\", style: UIAlertActionStyle.Default){\n action in\n self.dismissViewControllerAnimated(true, completion: nil);\n }\n myAlert.addAction(okAction);\n self.presentViewController(myAlert, animated: true, completion: nil);\n });\n }\n }\n\n catch\n {\n print(error)\n }\n}\n\ntask.resume()\n\n\nWhat is the problem here?"
] | [
"php",
"sql",
"json",
"cocoa",
"swift2"
] |
[
"What is vector slice in Rust?",
"As per rust doc, string slice is:\n\n\n This string is statically allocated, meaning that it's saved inside our compiled program, and exists for the entire duration it runs.\n\n\nWhat about vector slices? Are these bytecode hardcoded values?\n\nRust doc does not explain properly what vector slice is:\n\n\n Similar to &str, a slice is a reference to another array. We can get a slice from a vector by using the as_slice() method:\n\n\nlet vec = vec![1i, 2i, 3i];\nlet slice = vec.as_slice();"
] | [
"rust"
] |
[
"Populate Pandas Dataframe with normal distribution",
"I would like to populate a dataframe with numbers that follow a normal distribution. Currently I'm populating it randomly, but the distribution is flat. Column a has mean and sd of 5 and 1 respectively, and column b has mean and sd of 15 and 1.\n\nimport pandas as pd\nimport numpy as np\n\nn = 10\ndf = pd.DataFrame(dict(\n a=np.random.randint(1,10,size=n),\n b=np.random.randint(100,110,size=n)\n))"
] | [
"python",
"pandas",
"numpy"
] |
[
"How to bold a string within a string and variables",
"Code\n\nBelow is my Function:\n\nFunction InitialHeading(Optional ByVal Accrual As String, Optional ByVal Status As String, Optional ByVal Description As String, Optional ByVal RecipientAccount As String, Optional ByVal RecipientName As String, Optional ByVal AgreeType As String, Optional ByVal DateFrom As String, Optional ByVal DateTo As String) As String\n\n InitialHeading = \"Accrual: \" & Accrual & \" Agreement Status: \" & Status & \" Date: \" & DateFrom & \" - \" & DateTo & \" Description: \" & Description & \" Rebate Recipient Details: Account - \" & RecipientAccount & \" Name - \" & RecipientName\n\nEnd Function\n\n\nProblem\n\nI want all the non variables to be bold. I want variables Accrual & Status font colour red.\n\nResearch\n\nI have done multiple sarches but the best I can get is setting the entire string ie. InitialHeading ALL bold or ALL red.\n\nOutput\n\nIn the below output the variable Status = \"Open\" and thus the word Open needs to be font = red:\n\nAccrual: 123456 Agreement Status: Open etc etc etc"
] | [
"excel",
"vba"
] |
[
"'Object Required' Error when trying to refer to CheckBox in worksheet",
"I am trying to write a code in excel vba.\n\nI want to change the color of the user selected cell when the checkbox is checked.\n\nI have already written this code but it gives the 'object required' error on the line marked.\n\nSub CheckBox1_Click() \nDim xRng As Range \nSet xRng = Selection\n\nIf CheckBox1.Value = True Then 'This is the error \n xRng.Interior.Color = vbGreen \nEnd If\n\nIf CheckBox1.Value = False Then \n xRng.Interior.Color = xlNone \nEnd If\n\nEnd Sub\n\n\nPlease help me on how to debug this error.\nThanks in advance! :)"
] | [
"vba",
"excel"
] |
[
"Custom ListView Adapter from Firebase",
"I would like to list some user data that I getting from FireBase as name, age, Gender and Birthday. I have a FireBase listener and the list have to refresh every-time the database is changed.\n\nThis is how I sent data to the adapter\n\n private void list(String Name){\n final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mUser);\n mListView.setAdapter(arrayAdapter);\n mUser.add(Name,Age,Gender,Birthday);\n arrayAdapter.notifyDataSetChanged();\n}\n\n\nThis is the layout I want to list\n\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <RelativeLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\">\n <TextView\n android:id=\"@+id/textNameList\"\n android:textSize=\"25dp\"\n android:textAlignment=\"textStart\"\n android:text=\"Name\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:gravity=\"start\"\n android:layout_margin=\"10dp\"/>\n\n<TextView\n android:id=\"@+id/textAgeList\"\n android:textSize=\"15dp\"\n android:textAlignment=\"textStart\"\n android:text=\"Age\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:gravity=\"start\"\n android:layout_margin=\"10dp\"/>\n<TextView\n android:id=\"@+id/textBirthdayList\"\n android:textSize=\"15dp\"\n android:textAlignment=\"textStart\"\n android:text=\"Birthday\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:gravity=\"start\"\n android:layout_margin=\"10dp\"/>\n<TextView\n android:id=\"@+id/textGenderList\"\n android:textSize=\"15dp\"\n android:textAlignment=\"textStart\"\n android:text=\"gender\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:gravity=\"start\"\n android:layout_margin=\"10dp\"/>\n\n\n </RelativeLayout>\n\n\nIf possible I would like to list and Image from database too."
] | [
"android",
"listview",
"firebase",
"firebase-realtime-database",
"adapter"
] |
[
"In Parse.com's Cloud code, asynchronous code is giving variables in for-loop the wrong value",
"I'm trying to save different food names without duplicates on parse.com. However, when I run the code, the database consists of the same 2 or 3 foods over and over, instead of 200 or so unique names.\n\n\n\nBelow is my function. I tried logging the name of the food at two different points, and I get different values. The first point gives the correct name of the food, but the second point only shows either flaxseed muffins or raspberry pie. I think the problem has to do with the code running asynchronously, but I'm not sure how to resolve the issue. \n\nParse.Cloud.define(\"recordFavorite\", function(request, response) {\n\n var foodList = request.params.foodList; //string array of food names\n var Food = Parse.Object.extend(\"Food\");\n var query = new Parse.Query(Food);\n\n for (i = 0; i < foodList.length; i++ ) {\n var name = foodList[i];\n console.log(\"before name is \" + name);\n var query = new Parse.Query(Food);\n query.exists(\"name\", name);\n\n query.find({\n success: function(results) {\n if(results.length == 0){\n var food = new Food();\n food.set(\"name\", name);\n food.save(null, {\n success: function(food) {\n console.log(\"saved with name \" + name);\n },\n error: function(food, error) {\n }\n });\n } else {\n //don't create new food\n\n }\n },\n error: function(error) {\n }\n });\n\n }\n\n});\n\n\nEDIT:\n\nI was able to make some progress by modifying it to the code pasted below. Now it saves all the objects, including duplicates. I noticed that the lines\n\nvar query = new Parse.Query(Food);\nquery.exists(\"name\", name);\n\n\nreturns an array of all the foods and doesn't filter out the objects containing \"name\". (To be clear, this was probably still occurring in the original code, but I hadn't noticed.)\n\nParse.Cloud.define(\"recordFavorite\", function(request, response) {\n\n var foodList = request.params.foodList; //string array of food names\n var foodListCorrected = new Array();\n var Food = Parse.Object.extend(\"Food\");\n\n // Wrap your logic in a function\n function process_food(i) {\n // Are we done?\n if (i == foodList.length) {\n Parse.Object.saveAll(foodListCorrected, {\n success: function(foodListCorrected) {\n\n },\n error: function(foodListCorrected) {\n\n }\n });\n return;\n }\n\n var name = foodList[i];\n var query = new Parse.Query(Food);\n query.exists(\"name\", name);\n\n query.find({\n success: function(results) {\n console.log(results.length);\n if(results.length == 0){\n //console.log(\"before \" + foodListCorrected.length);\n var food = new Food();\n food.set(\"name\", name);\n foodListCorrected.push(food);\n // console.log(foodListCorrected.length);\n } else {\n //don't create new food\n }\n process_food(i+1)\n\n },\n error: function(error) {\n console.log(\"error\");\n }\n });\n\n }\n\n // Go! Call the function with the first food.\n process_food(0);\n\n\n });"
] | [
"javascript",
"asynchronous",
"parse-platform"
] |
[
"How to design domain model with interfaces that are dependent on the model's properties",
"I have a domain model (see example below) that has several interfaces that are determined based upon the value of properties within the model itself. While the code below \"works\" it doesn't feel right. I am sure that there is probably a better approach, but I haven't been able to come up with one. I would be very interested in getting feedback with some alternate approaches.\n\npublic interface IPickListGenerator\n {\n void Execute();\n }\n\npublic class SportsPicklistGenerator : IPickListGenerator\n{\n public void Execute()\n {\n // Do something\n }\n}\n\npublic class EntertainmentPicklistGenerator : IPickListGenerator\n{\n public void Execute()\n {\n // Do something\n }\n}\n\npublic interface IQuestionIsAnswerableDeterminer\n{\n void Execute();\n}\n\npublic class GameQuestionIsAnswerableDeterminer : IQuestionIsAnswerableDeterminer\n{\n public void Execute()\n {\n // Do something\n }\n}\n\npublic class RoundQuestionIsAnswerableDeterminer : IQuestionIsAnswerableDeterminer\n{\n public void Execute()\n {\n // Do something\n }\n}\n\npublic class Pool\n{\n public enum PoolType\n {\n Sports,\n Entertainment\n }\n\n public enum DeadlineType\n {\n Game,\n Round\n }\n\n private IPickListGenerator mPickListGenerator = null;\n private IQuestionIsAnswerableDeterminer mQuestionIsAnswerableDeterminer = null;\n\n public PoolType Type { get; set; }\n public DeadlineType Deadline { get; set; }\n\n public IQuestionIsAnswerableDeterminer IsQuestionAnswerableDeterminer\n {\n get\n {\n if (mQuestionIsAnswerableDeterminer == null) SetPoolSpecificInterfaces();\n return mQuestionIsAnswerableDeterminer;\n }\n }\n\n public IPickListGenerator PickListGenerator\n {\n get\n {\n if (mPickListGenerator == null) SetPoolSpecificInterfaces();\n return mPickListGenerator;\n }\n }\n\n private void SetPoolSpecificInterfaces()\n {\n switch (Type)\n {\n case Pool.PoolType.Sports:\n mPickListGenerator = new SportsPicklistGenerator();\n break;\n case Pool.PoolType.Entertainment:\n mPickListGenerator = new EntertainmentPicklistGenerator();\n break;\n }\n\n switch (Deadline)\n {\n case Pool.DeadlineType.Game:\n mQuestionIsAnswerableDeterminer = new GameQuestionIsAnswerableDeterminer();\n break;\n case Pool.DeadlineType.Round:\n mQuestionIsAnswerableDeterminer = new RoundQuestionIsAnswerableDeterminer();\n break;\n }\n }\n}\n// Example usages:\n var pool = new Pool{ Type = Pool.PoolType.Sports, Deadline = Pool.DeadLineType.Game};\n pool.IsQuestionAnswerableDeterminer.Execute();\n pool.PickListGenerator.Execute();"
] | [
"c#",
".net",
"domain-driven-design"
] |
[
"SetWindowLong Enable/Disable Click through form",
"public enum GWL\n {\n ExStyle = -20\n }\n\n public enum WS_EX\n {\n Transparent = 0x20,\n Layered = 0x80000\n }\n\n public enum LWA\n {\n ColorKey = 0x1,\n Alpha = 0x2\n }\n\n [DllImport(\"user32.dll\", EntryPoint = \"GetWindowLong\")]\n public static extern int GetWindowLong(IntPtr hWnd, GWL nIndex);\n\n [DllImport(\"user32.dll\", EntryPoint = \"SetWindowLong\")]\n public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, int dwNewLong);\n\n [DllImport(\"user32.dll\", EntryPoint = \"SetLayeredWindowAttributes\")]\n public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, int crKey, byte alpha, LWA dwFlags);\n\nvoid ClickThrough()\n{\nint wl = GetWindowLong(this.Handle, GWL.ExStyle);\n wl = wl | 0x80000 | 0x20;\n SetWindowLong(this.Handle, GWL.ExStyle, wl);\n}\n\n\nSo this successfully renders my application \"Click-through\", so it can stay Topmost but I can still click on applications that are behind it.\nPopular piece of code used for it, but my question is, how do I disable it?\n\nHow do I revert it so I can once again click on my application without restarting it?"
] | [
"c#",
".net"
] |
[
"In bash, how do I open a writable file descriptor that's externally redirectable?",
"I'm trying to use bash to open a new descriptor for writing extra diagnostic messages. I don't want to use stderr, because stderr should only contain output from the programs called by bash. I also want my custom descriptor to be redirectable by the user.\n\nI tried this:\n\nexec 3>/dev/tty\necho foo1\necho foo2 >&2\necho foo3 >&3\n\n\nBut when I try to redirect fd 3, the output still writes to the terminal.\n\n$ ./test.sh >/dev/null 2>/dev/null 3>/dev/null\nfoo3"
] | [
"bash",
"file-descriptor",
"io-redirection"
] |
[
"Objective-C Charting Framework",
"I'm in urgent need of an Objective-C/Cocoa/Cocoa Touch framework to handle simple charting; pie chards, histograms etc.\n\nThe only thing that comes close is:\n\nhttp://code.google.com/p/gchart-objc/\n\nBut it seems to be quite an early release and not maintained.\n\nHas anyone created or used such a framework or library."
] | [
"objective-c",
"cocoa",
"frameworks",
"charts"
] |
[
"caching activerecord results just like fragments",
"In my views I do a lot of this:\n\n<% cache(\"sports_menu_\" +session[:lang], {:expires_in => 60.minutes}) do %>\n...... # a load of stuff\n<% end %>\n\n\nHowever I've discovered a lot of time is spent querying the DB for data that doesn't change that often. Is there a way to cache this data in a similar manner?\n\nFor instance:\n\nModel.find(:all, :select => \"only a few fields\", :conditions => \"nasty conditions\", :include => \"some joins\", :order => \"date_time desc\") \n\n\nThis takes about 7 seconds, the main table keeps about 20M records. A lot of users hit this particular action and the query only runs once/hit. But it would make sense caching that for a number of minutes so that for everyone else it will load from the cache. I'm using memcache by the way.\n\nI can't cache the entire action because there are some parameters that change on occasion and some locale-specific code within the view.\n\nI have considered moving that to the view level but don't feel too comfortable about that, it would kind of defeat the point of using Rails.\n\nTIA!"
] | [
"mysql",
"ruby-on-rails",
"memcached"
] |
[
"Linq to Sql - Converting a join and sum from sql to linq",
"I have crawled over several of the various questions on Linq-to-SQL dealing with joins, counts, sums and etc.. But I am just having a difficult time grasping how to do the following simple SQL Statement...\n\nSELECT \n tblTechItems.ItemName, \n SUM(tblTechInventory.EntityTypeUID) AS TotalOfItemByType\nFROM \n tblTechInventory \nINNER JOIN\n tblTechItems ON tblTechInventory.ItemUID = tblTechItems.ItemUID\nGROUP BY \n tblTechInventory.StatusUID, \n tblTechItems.ItemName, \n tblTechInventory.InventoryUID\nHAVING \n tblTechInventory.StatusUID = 26"
] | [
"linq-to-sql"
] |
[
"Are static member variables of templates defined or specialized?",
"This relates to the following question: constexpr differences between GCC and clang\n\nIn the following spinet, is the last line a specialization, a definition, or both?\n\ntemplate<typename T>\nstruct A {\n static const T s;\n};\n\ntemplate<typename T>\nconst T A<T>::s = T(1);\n\n\nThis seems like a definition to me, but the posted question being compiled successfully by gcc has me questioning my assumptions."
] | [
"c++",
"language-lawyer"
] |
[
"C++ - Memory leaks: where is the pointer (meta) information stored?",
"This is a basic question of which I can't find any answer.\n\nGiven the next code, a memory leak will occur:\n\n int main(){\n A* a = new A();\n // 1\n } \n //2\n\n\nLets say that a got the value 1000. That is, the address 1000 on the heap is now taken by an A object. On 1, a == 1000 and on 2 a is out of scope. But some information is missing. \n\nIn real life, the address 1000 is the address of a byte in the memory. This byte does not have the information that it stores a valuable information. \n\nMy questions:\n\n\nwho keeps this information? \nhow is this information is kept?\nwhich component \"knows\" from where to where the pointer a points to? How can the computer know that a points to sizeof(A) bytes?\n\n\nThanks!"
] | [
"c++",
"memory",
"memory-leaks"
] |
[
"Clear fields from a form except 1 object (access VBA)",
"I have a form in Access and i try to make a button that clears the total form.\nit works but not for 1 field because in the database that field has NOT NULL given to it.\n\nthis is my form: http://i.stack.imgur.com/j7EOI.png\n\nWhen i pres on the button [Leeg Velden] \nthen this vba code will be running:\n\nPrivate Sub btnLeegVelden_Click()\n Dim object As Object\n\n For Each object In Screen.ActiveForm\n If Name(object) = \"ibvoorraad\" Then\n Me.ibvoorraad.Value = \"0\"\n Else\n\n If TypeName(object) = \"TextBox\" Then object.Value = \"\"\n End If\n Next object\n\n btnArtikelToevoegen.Enabled = True\nEnd Sub\n\n\nHow can i add some code that will clear all the field but in the field \"Voorraad\" it needs to set it to 0 instead of empty."
] | [
"vba",
"ms-access"
] |
[
"Condition in GROUP_CONCAT selection",
"I have 3 tables and I'm joining them to get some data. \n\n\n-----------------\nTable Name: users\n-------------------------------\n|user_id | user_name |\n-------------------------------\n123 | abc\n-------------------------------\n223 | bcd\n-------------------------------\n323 | cde\n-------------------------------\n\n-----------------\nTable Name: limit\n-------------------------------\nuser_id | limit_id\n-------------------------------\n123 | 1\n-------------------------------\n223 | 2\n-------------------------------\n323 | 3\n-------------------------------\n323 | 4\n-------------------------------\n\n-------------------------\nTable Name: limit_setting\n-------------------------------\nlimit_id | date_limit\n-------------------------------\n1 | 2016-09-29 12:00:00\n-------------------------------\n2 | 2016-09-28 12:00:00\n-------------------------------\n3 | 2016-09-27 12:00:00\n-------------------------------\n1 | 2016-09-27 12:00:00\n-------------------------------\n1 | 2016-09-24 12:00:00\n-------------------------------\n4 | 2016-09-25 12:00:00\n-------------------------------\n4 | 2016-09-26 12:00:00\n-------------------------------\n\n\nI need to get a result like this. I am stuck with the GROUP_CONCAT for the dates column. \nThe date column should have all entries other than the MAX date. If there is only one entry in the limit_setting table for that limit_id then it shouldn't show anything for that user. \ncount_dates : its the number of entries which are there in the limit_setting table. \n\n\n\nDesired output\n\n----------------------------------------------------------------------\nuser_name | dates | count_dates \n----------------------------------------------------------------------\nabc | 2016-09-27 12:00:00 , 2016-09-24 12:00:00 | 3\n----------------------------------------------------------------------\nbcd | | 1 \n----------------------------------------------------------------------\ncde | | 1 \n-----------------------------------------------------------------------\ncde | 2016-09-26 12:00:00 | 2 \n-----------------------------------------------------------------------\n\n\nSELECT PP.`user_name`, count(ESL.Limit_id) as count_dates,\n GROUP_CONCAT(ESL.date_limit SEPARATOR ',') as dates \nFROM users as PP INNER JOIN `limit` as PAL ON PP.Id = PAL.PlayerId\nLEFT JOIN limit_setting as ESL ON ESL.LimitId = PAL.limitId \nGROUP BY PAL.limitId\n\n\nAdditionally i tried with (which returned nothing)\n\nSELECT ESL.date_limit, MAX(date_limit) as max_date, PP.`user_name`, count(ESL.Limit_id) as count_dates, \n GROUP_CONCAT(ESL.date_limit SEPARATOR ',') as dates \nFROM users as PP INNER JOIN `limit` as PAL ON PP.Id = PAL.PlayerId \nLEFT JOIN limit_setting as ESL ON ESL.LimitId = PAL.limitId \nGROUP BY PAL.limitId\nHAVING ESL.date_limit > max_date\n\n\nI tried with Find_in_set but not sure how to use it effectively."
] | [
"mysql",
"group-concat"
] |
[
"Hang on Page Load: Too much Javascript?",
"I've finally fixed some of my Javascript issues, and managed to use only one library now (it was crazy before). \n\nThere's a little bit of a hang in the page load, so I was going to see if you guys noticed anything I could make more efficient in my scripting. It's a little all over the place, so I might have some unnecessary functions. Suggestions?\n\nThanks in advance!\n\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></script>\n<script src=\"player/src/jquery.ubaplayer.js\"></script>\n<script>\n$(document).ready(function() { \n $(\"#ubaPlayer\").ubaPlayer({\n codecs: [{name:\"MP3\", codec: 'audio/mpeg;'}] \n });\n\n $('a[class=video]').click(function () {\n if ($(\"#ubaPlayer\").ubaPlayer(\"playing\") === true) {\n $(\"#ubaPlayer\").ubaPlayer(\"pause\");\n }\n return false;\n });\n})\n</script>\n<script type=\"text/javascript\" src=\"/fancybox/source/jquery.fancybox.pack.js?v=2.1.4\"> </script>\n<script type=\"text/javascript\" src=\"/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.5\"></script>\n<script type=\"text/javascript\">\njQuery(document).ready(function() {\n\n$(\".video\").click(function() {\n $.fancybox({\n 'padding' : 0,\n 'autoScale' : false,\n 'transitionIn' : 'none',\n 'transitionOut' : 'none',\n 'title' : this.title,\n 'width' : 640,\n 'height' : 385,\n 'href' : this.href.replace(new RegExp(\"watch\\\\?v=\", \"i\"), 'v/'),\n 'type' : 'swf',\n 'swf' : {\n 'wmode' : 'transparent',\n 'allowfullscreen' : 'true'\n }\n });\n\n return false;\n});\n});\n</script>\n\n</head>"
] | [
"javascript",
"jquery",
"html",
"audio",
"lightbox"
] |
[
"\"Could not find table 'microposts'\" issue with Michael Hartl Tutorial Chapter 10",
"I'm trying to create a micropost model in chapter 10 of michael hartl's tutorial and I cannot get past the rspec tests. \n\nHere's what I've done:\n\n\nrails generate model Micropost content:string user_id:integer\nrm -f spec/factories/microposts.rb\n\n\nThis is the db migrate file:\n\nclass CreateMicroposts < ActiveRecord::Migration\n def change\n create_table :microposts do |t|\n t.string :content\n t.integer :user_id\n\n t.timestamps\n end\n add_index :microposts, [:user_id, :created_at]\n end\nend\n\n\nThis is the model spec for micropost:\n\nrequire 'spec_helper'\n\ndescribe Micropost do\n\n let(:user) { FactoryGirl.create(:user) }\n before do\n # This code is not idiomatically correct.\n @micropost = Micropost.new(content: \"Lorem ipsum\", user_id: user.id)\n end\n\n subject { @micropost }\n\n it { should respond_to(:content) }\n it { should respond_to(:user_id) }\nend\n\n\nAnd then I did:\n\n\nbundle exec rake db:migrate\nbundle exec rake test:prepare\n\n\nMy error message are these:\n\n1) Micropost\n Failure/Error: @micropost = Micropost.new(content: \"Lorem ipsum\", user_id: user.id)\n ActiveRecord::StatementInvalid:\n Could not find table 'microposts'\n # ./spec/models/micropost_spec.rb:8:in `new'\n # ./spec/models/micropost_spec.rb:8:in `block (2 levels) in <top (required)>'\n\n2) Micropost\n Failure/Error: @micropost = Micropost.new(content: \"Lorem ipsum\", user_id: user.id)\n ActiveRecord::StatementInvalid:\n Could not find table 'microposts'\n # ./spec/models/micropost_spec.rb:8:in `new'\n # ./spec/models/micropost_spec.rb:8:in `block (2 levels) in <top (required)>'\n\n\nSchema\n\nActiveRecord::Schema.define(:version => 20130801225814) do\n\n create_table \"users\", :force => true do |t|\n t.string \"name\"\n t.string \"email\"\n t.datetime \"created_at\", :null => false\n t.datetime \"updated_at\", :null => false\n t.string \"password_digest\"\n t.string \"remember_token\"\n t.boolean \"admin\", :default => false\n end\n\n add_index \"users\", [\"email\"], :name => \"index_users_on_email\", :unique => true\n add_index \"users\", [\"remember_token\"], :name => \"index_users_on_remember_token\"\n\nend\n\n\nI can't figure out the problem because I'm pretty confident I followed the steps in chapter 10 precisely. Maybe it's something from before? \n\nThanks for any help!"
] | [
"ruby-on-rails",
"ruby",
"rspec"
] |
[
"AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client due to mismatching sample rate",
"Does anybody know how to fix this warning message?\n\n\n 07-14 10:38:55.411 V/tracker-audiotest(22426): Recording Thread::run(): start audioRecord recording.\n 07-14 10:45:51.490 \"W/AudioTrack( 607): AUDIO_OUTPUT_FLAG_FAST denied by client due to mismatching sample rate (44100 vs 48000)\"\n\n\nWhen I test the audio latency on Android 4.4, I face a suddenly delay increasing after I saw this warning message. But I don't change the sample rate during the test and the initial setting is in 48kHz. This warning message happen after 7 minutes recording started.\n\nYou can test this project on your device if needed. The project is in GitHub: \n\n\n https://github.com/garyyu/OpenSL-ES-Android-DelayTest"
] | [
"audio",
"real-time",
"low-latency"
] |
[
"t:jscookMenu current item",
"I'm using t:jscookMenu in my JSF 2 application. I managed to make a functional menu so far, but how would I highlight the currently selected menu item for each page?\n\nI'm not bound to Tomahawk, so if someone can propose a working alternative solution, I'll be happy too. The requirements I have for the menu are the following: side menu, sub items for some menue items, highlight while hovering over item, highlight currently selected item, dynamically created items by Java code."
] | [
"java",
"jsf-2",
"java-ee-6"
] |
[
"Required persistence-unit on Payara / Glassfish 5",
"I'm trying to deploy a project which in his persistence.xml contains several persistente-unit.\n\nIn our use-case, we have to deploy in different servers. Most of them just have one of that pool names configured.\n\nOlder versions of Glassfish / Payara allowed us to deploy under this circumstances. \n\nNow the server throws an exception, \"javax.naming.NameNotFoundException: poolName not found\", which doesn't allow us to deploy. It seems to be mandatory to have all persistence pools registered on the server.\n\nIs there some way to tell the server to NOT check if all persistence-unit exists or set persistence-units as not required or something like that?"
] | [
"jakarta-ee",
"glassfish",
"persistence",
"payara"
] |
[
"Change Style from code behind",
"I have this style\n\n<ResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\nxmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">\n\n<Style x:Key=\"MainMenuStyle\" TargetType=\"{x:Type TextBlock}\">\n\n <Style.Triggers>\n <Trigger Property=\"IsMouseOver\" Value=\"True\">\n <Setter Property= \"Foreground\" Value=\"White\"/>\n <Setter Property= \"FontSize\" Value=\"22\"/>\n <Setter Property= \"FontFamily\" Value=\"Arial\"/>\n </Trigger>\n\n <Trigger Property=\"IsMouseOver\" Value=\"False\">\n <Setter Property= \"Foreground\" Value=\"Black\" />\n <Setter Property= \"FontSize\" Value=\"14\"/>\n <Setter Property= \"FontFamily\" Value=\"Verdana\"/>\n </Trigger>\n\n </Style.Triggers>\n\n</Style>\n\n\n\n\nNow, if I want to change the Setter Property Value from code behind how can I do it ?\n\nIn code behind I'd want something like this:\n\nMainMenuStyle.IsMouseOver(True).Foreground = \"Red\"\nMainMenuStyle.IsMouseOver(True).FontSize = 10\n\nMainMenuStyle.IsMouseOver(False).Foreground = \"Green\"\nMainMenuStyle.IsMouseOver(False).FontSize = 100\n\n\nI must use only framework 4. \n\nThank you"
] | [
"wpf",
"xaml"
] |
[
"Tokbox: subscriber seeing yourself in webcan",
"I want to know if tokbox API is possible in some session, the subscriber see yourself in webcam. On side of page.\nThe exemples I have be all of publisher and subscribers (not seeing thenselfes)"
] | [
"web",
"webrtc",
"tokbox"
] |
[
"how to restrict more than one java application icon on taskbar?",
"I have created an application in java which have several forms.\nDuring application start getting open new form on button click event,On windows's taskbar the number of icons of that form getting increases.\nwhat I want is only applicatoin icon should be displayed on task bar whether one form is open or more than one."
] | [
"java",
"swing",
"user-interface",
"awt",
"taskbar"
] |
[
"Template assignment type distinctions",
"Class X contains 2 pieces of data. The templated assignment operator accepts any type and assigns it to member 'd'. However I still want copy assignment to work properly. In MSVC 2010 the line 'b = a;' calls the template assignment operator not the copy assignment. How can I overload assignment to distinguish properly or have the template assignment distinguish internally?\n\nclass X\n{\npublic:\n X() : x(0), d(0.0) {}\n X(X const & that) { x = that.x; d = that.d; } \n\n X& operator=(X const & that) { x = that.x; d = that.d; }\n\n template<typename T>\n X& operator=(T && y) {\n //if (T is X&)\n // operator=(static_cast<X const &>(that));\n //else\n // d = y;\n return *this;\n }\n\n int x;\n double d;\n};\n\nvoid f()\n{\n X a;\n X b;\n\n a = 5;\n a = 3.2;\n b = static_cast<X const &>(a); // calls copy assignment\n b = a; // calls template assignment\n}"
] | [
"c++",
"templates"
] |
[
"Specify decimal places for currency in FORMAT call",
"My database contains fuel unit prices which typically end with a fractional penny value, such as $2.099 per gallon. I use the built-in FORMAT call in order to specify the locale. This doesn't allow me to use currency formatting with more than 2 decimal places. Is there a way to override this? Or am I stuck doing some custom formatting based on many many possible locales?\n\nConsider this example:\n\nDECLARE @fuelPrice FLOAT = 2.099\nSELECT FORMAT(@fuelPrice, 'G', 'en-US') AS 'NoDollarSign'\n ,FORMAT(@fuelPrice, 'C', 'en-US') AS 'WrongDecimalPlaces'\n ,'$2.099' as 'WhatIWant'\n\n\nwhich outputs:\n\nNoDollarSign WrongDecimalPlaces WhatIWant\n2.099 $2.10 $2.099"
] | [
"sql-server",
"globalization"
] |
[
"IsPostBack property of the page never gets false even after page refresh",
"I get stuck in a very unusual problem. I've a code written in C# which is simply checking IsPostBack property on the Page_Load. I know that IsPostBack remains false when page lands for the first time and bocme true only when any control post the form to the server (having runat=sever).\n\nI also know that if we hit refresh, the IsPostBack property should change to false (since refresh is not a postback).\n\nThis is the sample code:\n\nif (!IsPostBack)\n{\n // If I click on any control on the page, and then hit refresh,\n // the code inside this block should execute, but this is not happening.\n // After first postback, I tried refreshing the page for more than\n // ten times, but always finds IsPostBack=true\n\n // ...\n}\nelse\n{\n // ...\n}\n\n\nI clicked on a server side button (a postback), then hit refresh. I assume it will go to the if block but no luck. No matter how many times i hit Refresh on browser, IsPostBack is always true. which is truly an unusual activity I've never seen before.\n\nI would really appreciate any help. I need to know why this is happening, is this a browser related problem or something else? I used mozilla and chrome.\n\nEvery time I hit refresh, I get a warning on both browsers.\n\n\nOn chrome: Confirm form submission\nThe page that you're looking for used info that you entered, returning to that page might cause any action you took to be repeated.Do you want to continue?\nOn mozilla: Confirm\nTo display the page, firefox must send info that will repeat any action...\n\n\nThanks in advance for any kind help.\n\nPraveen"
] | [
"c#",
"asp.net",
"postback"
] |
[
"SQL Query to find MAX values based upon count and some filters",
"Table looks like below :\n\n/* Create a table called test */\nCREATE TABLE test(Id integer PRIMARY KEY,Col_Key text, Ng text, node text);\n\n/* Create few records in this table */\nINSERT INTO test VALUES(1,'key1','g1','n2');\nINSERT INTO test VALUES(2,'key1','g2','n3');\nINSERT INTO test VALUES(3,'key2','g3','n1');\nINSERT INTO test VALUES(4,'key2','g4','n1');\nINSERT INTO test VALUES(5,'key3','g5','n1');\nINSERT INTO test VALUES(6,'key3','g6','n2');\nINSERT INTO test VALUES(7,'key4','g7','n1');\nINSERT INTO test VALUES(8,'key4','g8','n1');\nINSERT INTO test VALUES(9,'key5','g8','n4');\nINSERT INTO test VALUES(10,'key5','g9','n4');\nINSERT INTO test VALUES(11,'key6','g10','n4');\nINSERT INTO test VALUES(12,'key6','g11','n4');\nINSERT INTO test VALUES(13,'key7','g11','n4');\nINSERT INTO test VALUES(14,'key9','q11','n3');\nINSERT INTO test VALUES(15,'key9','q11','n2');\nINSERT INTO test VALUES(16,'key10','q12','n1');\nCOMMIT;\n\n\nI'm trying to get values from the node column which have a maximum count and whose Ng value starts with g.\n\nI have done something like this:\n\nSELECT TEMP.node,COUNT(TEMP.node) FROM (SELECT Col_Key,Ng,node \nfrom test WHERE (Ng LIKE 'g%')) TEMP GROUP BY TEMP.node;\n\n\nwhich gives below result:\n\n\n\nBut, in the result I want only n4 and n1 in result (only node column not count) as they have the maximum count. I am unable to add this part in my query. Please help.\n\nAbove data is just a small piece of data but i will have thousands of rows in my SQL table, so my query should be efficient.\n\nPS :- I tried doing below :\n\nSELECT TEMP2.node,TEMP2.CNT FROM (SELECT TEMP.node,COUNT(TEMP.node) AS CNT FROM (SELECT Col_Key,Ng,node \nfrom test WHERE (Ng LIKE 'g%')) TEMP GROUP BY TEMP.node) TEMP2 WHERE TEMP2.CNT = (SELECT MAX(TEMP2.CNT) FROM TEMP2);\n\n\nbut last part of the query with where clause is wrong as it is unable to find table TEMP2.\n\nbut this WHERE cluase kinds of give idea what i want exaclty.\n\nRESULT should be :\n\nnode \nn1\nn4"
] | [
"mysql",
"sql",
"group-by",
"count"
] |
[
"how to make a multiple node js chat like facebook?",
"well, i have read some tutorials and i have a chat in node js with express and socket io, it works well!!\nso, the way it works is:\na user that opens the url in the port 3000 connects and now cant send messages, if another user connects in the same url and port now can see the new messages an he can send messages too.\ni want to have multiple scenarios like this in the same app, to make something like facebook chat!!,\nthanks!\n\nthis is the code i have:\nserver side:\n\nvar app = require('express')();\nvar http = require('http').Server(app);\nvar io = require('socket.io')(http);\n\napp.get('/', function(req, res){\n\nres.sendFile(__dirname+'/index.html');\n\n});\n\nio.on('connection', function(socket){\nconsole.log('a user connected');\n\nsocket.on('chat message', function(msg){\nio.emit('chat message', msg);\n});\n\n\n socket.on('disconnect', function(){\nconsole.log('user disconnected');\n});\n});\n\n\n\nhttp.listen(3000, function(){\nconsole.log('listening on *:3000');\n});\n\n\nin client side javascript:\n\n var socket = io();\n $('form').submit(function(){\n\n socket.emit('chat message', {message: $('#m').val(), type_msg: 'chat_message'});\n\n $('#m').val('');\n return false;\n });\n\n socket.on('chat message', function(msg){\n\n switch(msg.type_msg){\n case \"chat_message\":\n $('#messages').append($('<li>').text(msg.message));\n break;\n\n case \"user_is_typing\":\n $('#status').val(msg.message);\n break;\n\n case \"user_is_not_typing\":\n $('#status').val(msg.message);\n break;\n } \n });\n\n\n $('#m').keypress(function(){\n\n socket.emit('chat message', {message: \"User is typing! :D\",type_msg: \"user_is_writing\"});\n });\n\n $('#m').keyup(function(){\n\n socket.emit('chat message', {message: \"User in thinking...\",type_msg: \"user_is_typing\"});\n });"
] | [
"node.js",
"socket.io"
] |
[
"Serializing international characters with jQuery ajax form submit consumed by classic asp",
"I'm having massive headaches serializing international characters. I'm updating classic ASP pages which have windows-1252 as charset, when I serialize and send via ajax, my german characters are getting corrupted. Has anyone else run into this? any solutions?"
] | [
"jquery",
"serialization",
"asp-classic"
] |
[
"Ask users to input value for npm script",
"I have an npm script, which is run like that:\nnpm run start:local -- -target.location https://192.1.1.1:8052/\n\nThe URL param is the local IP of a user.\nWhat I would love to have is to ask users to input this value, because it's different for everybody.\nIs it possible? Would be great to do it with vanila npm scripts."
] | [
"npm"
] |
[
"Xamarin.forms Navigation Drawer on button click",
"How to display navigation drawer in xamarin forms on button / icon click.\nI have a button in my detail page and on click i want navigation drawer ISPresented to be true. how can this be done? Thanks in advance"
] | [
"xamarin.forms",
"navigation-drawer"
] |
[
"Best way to convert list to comma separated string in java",
"I have Set<String> result & would like to convert it to comma separated string. My approach would be as shown below, but looking for other opinion as well.\n\nList<String> slist = new ArrayList<String> (result);\nStringBuilder rString = new StringBuilder();\n\nSeparator sep = new Separator(\", \");\n//String sep = \", \";\nfor (String each : slist) {\n rString.append(sep).append(each);\n}\n\nreturn rString;"
] | [
"java",
"string",
"list",
"collections",
"set"
] |
[
"django order by date in datetime / extract date from datetime",
"I have a model with a datetime field and I want to show the most viewed entries for the day today.\n\nI thought I might try something like dt_published__date to extract the date from the datetime field but obviously it didn't work.\n\npopular = Entry.objects.filter(type='A', is_public=True).order_by('-dt_published__date', '-views', '-dt_written', 'headline')[0:5]\n\n\nHow can I do this?"
] | [
"sql",
"django",
"datetime"
] |
[
"Linq To SQL where condition with IEnumerable",
"I have the following query where I want to filter out certain codes for deletion. It is for a payroll program and depending on the user running it, it should only allow deletion of employees under a users list: \n\nIEnumerable<int> employeeIdList; <----contains employee Ids under a certain user\n\nvar processDataTemps = tempProcessDataService.GetAllProcessDataTemps();\n\n\nSample results from above query\n\nCode Name U_Employee_ID U_month U_PD_code U_Amount U_Balance U_taxyear \n0 0 1 2 SYS037 24308.500000 0.000000 2013\n1 1 1 2 SYS014 50470.000000 0.000000 2013\n10 10 8 2 SYS024 7541.000000 0.000000 2013\n13 13 7 2 SYS037 7541.000000 0.000000 2013\n17 17 7 2 SYS024 7541.000000 0.000000 2013\n\n\nMy question is how do I modify the processDataTemps query to return the Codes (Code Column) for only the employee Ids that are contained in the IEnumerable employeeIdList?\n\nIe. Such that if employeeIdList contains only 1 and 7, the modified processDataTemps query should return the Code values 0, 1 and 13 and 17. \n(Using SQL Server 2008)"
] | [
"linq",
"sql-server-2008"
] |
[
"Where is my registrations controller",
"OS: Windows 8.1\nRuby 2.0.0\nRails 4.1\nDevise\n\nAfter I created the application, I installed Devise:\n\nrails g devise:install\nrails g devise:views\n\n\nThe devise views were generated. What I don't have is a registrations controller in the controllers folder. Wasn't devise supposed to create a registrations controller?"
] | [
"ruby-on-rails",
"devise"
] |
[
"Use GetAllIncluding to get multiple levels in a single call",
"Using ABP Repository pattern we are trying to create a single query to retrieve a set of entities, along with their children, and the childrens children\n\nEntity X -> one to many Entity Y -> one to many Entity Z\n\n(think Invoice > InvoiceItem > InvoiceItemParts for example)\n\nThe Abp repository pattern provides for retrieving at least 1 set of children using \n\nresult = _repositoryInvoice.GetAllIncluding(x => x.InvoiceItem)\n\nis there a way using LINQ to include InvoiceItemParts in this 1 query? If not, what is the recommended way to retrieve all child nav properties and all levels using a single call.\n\nThe main goal is making it so we don't have to make multiple round trips to the DB when accessing the child properties along with the child properties of those children.\n\nthanks\njasen"
] | [
"entity-framework",
"automapper"
] |
[
"setting Java List type in React JS's state",
"I have my REST API in Spring Boot (Java). I am using React JS for my Application.\nHere is my Java code for Product class, which has the productComponents variable which is of type List:\nprivate String name;\n@OneToMany(cascade = {CascadeType.ALL})\n@JoinColumn\nprivate List<Product> products;\n\nHere is my Component class:\nprivate Long id;\nprivate String name;\nprivate String unit;\nprivate Double quantity = 0.0;\nprivate Double componentCost = 0.0;\nprivate Double componentPrice = 0.0;\n@DateTimeFormat(pattern = "mm/dd/yyyy hh:mm:ss")\n@LastModifiedDate @CreatedDate\nprivate LocalDateTime createdAt;\nprivate String status;\n\nIn React JS, here is how I have my state:\n this.state = {\n supplier:\n [\n {\n id: 0,\n accountNumber: "Account Number",\n companyName: "Company Name",\n phoneNumber: "Phone Number",\n email: "Email",\n productComponents: [{\n id: "Component ID",\n name: "Component Name",\n unit: "Component Unit",\n quantity: "quantity",\n componentCost: "cost",\n componentPrice: "price",\n createdAt;\n status: "Status"\n }],\n },\n ]\n\nI get an error when I try to set the state in React, specifically, I get the error when I try to set the productComponents variable which of type List in Java, in React's state?\nWhat is a possible solution to such error ?"
] | [
"javascript",
"java",
"reactjs",
"spring",
"spring-boot"
] |
[
"Trying to pass string to javascript from Rails view gives \"missing ; before statement\" error",
"Trying to pass string data produces the desired result in HTML but not sure why I am getting \"missing ; before statement\" error.\n\n<%= javascript_tag do %>\n window.context_user_email = <%= @context_user_email %>;\n<% end %>\n\n\ngives...\n\n<script type=\"text/javascript\">\n//<![CDATA[\n\n window.context_user_email = [email protected];\n\n//]]>\n</script>"
] | [
"javascript",
"ruby-on-rails"
] |
[
"Timestamp comparison in cassandra",
"As shown in the picture querying with exact timestamp(2013-08-01 15:02:56) is not returning any result though a row with that timestamp exists but it returns results with that row when queried for \n\n\n timestamps > '2013-08-01 15:02:56'\n\n\nIs this normal behavior in Cassandra?"
] | [
"timestamp",
"cassandra",
"cql3"
] |
[
"Quartz.NET Daily Time Interval across midnight",
"I have the following configuration settings in my domain model for my scheduled tasks and I am trying to create triggers using Quartz.NET 2.3.3.\n\n\nStart Time TimeSpan\nEnd Time TimeSpan\nRepeat Interval TimeSpan\nWeekdays Enabled DayOfWeek[]\n\n\nI can successfully create a Daily Time Interval Trigger with this information.\n\nvar trigger = TriggerBuilder\n .Create()\n .WithDailyTimeIntervalSchedule(c => c\n .StartingDailyAt(scheduledTask.StartTime.ToTimeOfDay())\n .EndingDailyAt(scheduledTask.EndTime?.ToTimeOfDay())\n .OnDaysOfTheWeek(scheduledTask.WeekdaysEnabled.ToDaysOfWeek().ToArray())\n .WithIntervalInSeconds((int)scheduledTask.RepeatInterval.TotalSeconds)\n .InTimeZone(timeZoneInfo))\n .Build();\n\n\nIt is, however, possible for my configured EndTime to be before the StartTime. For example, 22:30 to 04:00 (running from 10:30 PM until 4:00 AM the following day, repeating at the specified interval, across the midnight boundary). The Daily Time Interval Schedule does not seem to support this. It only fires once, at the start time, and never again.\n\nI have tried using a CronTrigger, as this works across the midnight boundary, but this doesn't support the start/end time of day properly (eg. 0 30-0/30 22-4 ? * * runs every 30 mins from 10:00 PM until 4:30 AM.\n\nIs there any way to create this schedule within Quartz.NET?"
] | [
"c#",
"quartz.net"
] |
[
"while loop getting second value onward not first value? PHP MSQL SP FPDF",
"my while loop starts from the second value onward, it does not show the first value. Please any help would be much appreciated.\n\nwhile loop statement shown below I am using FPDF to export results but I am not sure if this got anything to do with it calling 2nd value onward. \n\n while($dbRow = sqlsrv_fetch_array($dbQuery, SQLSRV_FETCH_ASSOC)) {\n\n $pdf->cell(0,10,'Impact for'.' '.$dbRow['Stakeholder_ID'].' is: '.iconv(\"UTF-8\", \"ISO-8859-1\", \"£\").''.$dbRow['Stakeholder_Return'],0,1 ,'',true );\n }\n\n\nthanks"
] | [
"php",
"sql-server"
] |
[
"Can't call non-static member function from imported class c++",
"My problem is with the line memory.initBoard(); I've instantiated an instance of memory with a constructor, which resolves fine. once I try to call a member function using the dot-notation, I get an error: \n\nUndefined symbols for architecture x86_64:\n \"Board::initBoard()\", referenced from:\n _main in ccpQWFDT.o\nld: symbol(s) not found for architecture x86_64\n\nI've tried removing the Board:: before initBoard in the .cpp file but that did not work. Anyone have any idea why I can't call this member function?\n\nThis is the main function \n\n#include <iostream>\n#include \"Board.h\"\nusing namespace std;\n\nint main(){\nBoard memory(8);\nmemory.initBoard();\nreturn 0;\n}\n\n\nThis is the .h file\n\n#ifndef BOARD_H\n#define BOARD_H\n#include <vector>\n\nclass Board {\n private:\n Board(){}\n public:\n int board_size;\n Board(int size);\n void initBoard();\n };\n#endif\n\n\nThis is the .cpp that goes with the .h file\n\n#include \"Board.h\"\n#include <iostream>\nusing namespace std;\n\nBoard::Board(int size) {\n\n}\ninline void Board::initBoard(){\n\n}"
] | [
"c++",
"non-static"
] |
[
"How do I force a leaflet map to reload all tiles including visible ones?",
"I'm working on a graphing web-app and I've decided that leaflet would make a decent graph view. I have it displaying (sort of) but I need a way to force it to update when the user enters a new formula to graph. \n\nI'm using JQuery as well, but that shouldn't matter. Here is the relevant code:\n\nfunction formulaChange(formula){\n //submits a request to the server to add a graph to display\n map.setView(map.getCenter(),map.getZoom(),true);//doesn't work\n //and neither does:\n //map.fire('viewreset');\n //tiles.redraw();\n}\n\nfunction enterHandler(event){\n if(event.keyCode==13){\n formulaChange(document.getElementById(\"formula\").value);\n }\n\n}\n\nvar map;\nvar tiles;\n$(document).ready(function(){\n map=L.map('plot',{crs:L.CRS.Simple}).setView([0,0],10);\n //url is actually a servlet on the server that generates an image on the fly\n tiles = L.tileLayer('./GraphTile.png?x={x}&y={y}&z={z}&tilesize={tileSize}&{s}', \n {\n maxZoom: 20,\n continuousWorld: true,\n tileSize: 128,\n //subdomains used as a random in the URL to prevent caching\n subdomains: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'\n }\n ).addTo(map);\n});\n\n\nThis works but won't refresh when the user clicks, the event is definitely running (I've omitted other code that updates a text display). It displays properly, but when the user adds a function to display the view never updates and leaflet continues to display cached images, only a new zoom level or panning to an area never before viewed causes it to update the tiles. The question I have is: How do I force leaflet to completely reload everything and drop and reload all the images?\n\nEDIT added another failed attempt"
] | [
"javascript",
"leaflet"
] |
[
"Where is PhantomJS localstorage and WebSQL located on Windows?",
"Where do I find PhantomJS' localstorage and WebSQL data on Windows? I'm unable to create new databases with Phantom's WebSQL, so I suspect it might have run out of space. To remedy the situation I mean to delete its localstorage and WebSQL data."
] | [
"windows",
"phantomjs"
] |
[
"Does there exists a method to render an object using DebuggerDisplayAttribute",
"I have a number of classes that are decorated with DebuggerDisplayAttribute.\n\nI want to be able to add trace statements to Unit Tests that will display instances of these classes.\n\nDoes there exist a method in the .NET Framework that will display an object formatted using DebuggerDisplayAttribute (or fall back to using .ToString() if no DebuggerDisplayAttribute is defined)?\n\nEDIT\n\nTo clarify, I was hoping there might be something built into the Framework. I know I can get the Value property from DebuggerDisplayAttribute, but I then need to format my instance using the format string represented by DebuggerDisplayAttribute.Value.\n\nIf I roll my own, I'd envisage an extension method along the following lines:\n\npublic string FormatDebugDisplay(this object value)\n{\n DebugDisplayAttribute attribute = ... get the attribute for value ...\n if (attribute = null) return value.ToString();\n\n string formatString = attribute.Value;\n\n ??? How do I format value using formatString ???\n return SomeFormatMethod(formatString, value);\n}"
] | [
".net",
"debugging",
"debuggerdisplay"
] |
[
"Install CMake to OpenWrt",
"I need to install CMake to Onion Omega2 SoC. How to do that? System uses opkg manager. What repos I should include?"
] | [
"linux",
"cmake",
"openwrt",
"onion-architecture"
] |
[
"Device tree and GPIO",
"I'm trying to interface a GPIO controller in a kernel driver and I'm not sure if I'm doing everything right.\n\nThis is my device tree code:\n\ngpio_screen1:gpio1@20 {\n compatible = \"nxp,pca9535\";\n gpio-controller;\n #gpio-cells = <2>;\n reg = <0x20>;\n// pinctrl-names = \"default\";\n// pinctrl-0 = <&pinctrl_pca9505>;\n };\n\n screen: screen@0x02000 {\n compatible = \"myscreen,myscreen\";\n #address-cells = <1>;\n #size-cells = <0>;\n reg = < 0x04000 0xF00 >; \n interrupts = <1 2>;\n reset-gpios = <&gpio_screen1 15 0>;\n sleep-gpios = <&gpio_screen1 14 0>;\n clk_sel1-gpios = <&gpio_screen1 10 0>;\n lane_sel-gpios = <&gpio_screen1 9 0>;\n };\n\n\nAnd this is my driver code that registers the GPIO\n\ngpio = of_get_named_gpio(pdev->dev.of_node, \"reset-gpios\", 0);\nif (!gpio_is_valid(gpio)) {\n dev_err(&pdev->dev, \"failed to parse reset gpio\\n\");\n return gpio;\n}\ndev->reset = gpio;\n\n\nIs this initialization correct? \n\nI've been looking at the Documentation for this GPIO controller but it's not very helpful."
] | [
"linux",
"linux-kernel",
"linux-device-driver",
"gpio",
"device-tree"
] |
[
"How to extract article content from a website/blog",
"I'm trying to write a generic function for extracting article text from blog posts and websites.\n\nA few simplified examples I'd like to be able to process:\n\nRandom website:\n\n...\n<div class=\"readAreaBox\" id=\"readAreaBox\">\n <h1 itemprop=\"headline\">title</h1>\n <div class=\"chapter_update_time\">time</div>\n <div class=\"p\" id=\"chapterContent\">article text</div>\n</div>\n...\n\n\nWordpress:\n\n<div id=\"main\" class=\"site-main\">\n <div id=\"primary\" class=\"site-content\" role=\"main\">\n <div id=\"content\" class=\"site-content\" role=\"main\">\n <article id=\"post-1234\" class=\"post-1234 post type-post\">\n <div class=\"entry-meta clear\">..</div>\n <h1 class=\"entry-title\">title</h1>\n <div class=\"entry-content clear\">\n article content\n <div id=\"jp-post-flair\" class=\"sharedaddy\">sharing links</div>\n </div>\n </article>\n </div>\n </div>\n</div>\n\n\nBlogspot:\n\n<div id=\"content\">\n ...\n <div class=\"main\" id=\"main\">\n <div class=\"post hentry\">\n <h3 class=\"post-title\">title</h3>\n <div class=\"post-header\">...</div>\n <div class=\"post-body\">article content</div>\n <div class=\"post-footer\">...</div>\n </div>\n </div>\n</div>\n\n\nWhat I came up with (doc is a Nokogiri::HTML::Document):\n\ndef fetch_content\n html = ''\n ['#content', '#main', 'article', '.post-body', '.entry-content', '#chapterContent'].each do |css|\n candidate = doc.css(css).to_html\n html = [html, candidate].select(&:present?).sort_by(&:length).first\n end\n self.content = html\nend\n\n\nIt works relatively well for the examples I tested with but it still leaves some sharing and navigation links plus it won't work if a page uses more cryptic class names.\n\nIs there a better way to do this?"
] | [
"ruby-on-rails",
"ruby",
"web-scraping",
"nokogiri"
] |
[
"how to prevent xcode5 from switching over to ios7 layout",
"Is it possible to have xcode5 preserve my ios6 project ? I was told it might be possible but i cant get it to work.\n\nWhenever I use my ios6 project on xcode5, the whole UI layout gets messed up because of the topbar. Only way to solve this is to use another laptop with xcode 4.6 on my ios7 device.\n\nThe question is how can I run my ios6 project on xcode5 without wanting it to convert into ios7 layout/sdk ?\n\nThanks."
] | [
"iphone",
"user-interface",
"ios7",
"xcode5"
] |
[
"Table updates from JSON array but sorting alphabetically causes error in Swift 3",
"In my iOS app, I populate a table from an external json file. That works fine now, the problem I am running into is that I need to sort the table alphabetically.\n\nI've added a compare method, and printing it will give me the correct output (a list of results organized by their show_name). However, when I try to append those results to the table, I get an error. \n\nHere's my code: \n\nfunc extract_json(_ data: Data)\n{\n let json: Any?\n do{\n json = try JSONSerialization.jsonObject(with: data, options: [])\n }\n catch{\n return\n }\n\n guard let data_list = json as? NSArray else {\n return\n }\n\n if let shows_list = json as? NSArray\n {\n for i in 0 ..< data_list.count\n {\n if let shows_obj = shows_list[i] as? NSDictionary\n {\n let show_name = shows_obj[\"show\"] as? String\n let show_image = shows_obj[\"thumbnail\"] as? String\n TableData.append(show_name!)\n var sortedArray = TableData.sorted { $0.localizedCaseInsensitiveCompare($1) == ComparisonResult.orderedAscending }\n print(sortedArray)\n\n\nIf I change the TableData.append(show_name!) to TableData.append(sortedArray), I get the error \"Cannot convert value of type '[String]?' to expected argument type 'String'\". \n\nIs there a safer/smarter way to alphabetize my json array by an attribute before loading it into the table (than trying to load it into the TableData and then comparing, like I am now)?"
] | [
"ios",
"swift"
] |
[
"can not run npm run build/deploy",
"I'm trying to deploy my application but is not working. \nMy package.json scripts:\n\n\"scripts\": {\n\"serve\": \"live-server public --port=8091\",\n\"build\": \"webpack\",\n\"dev-server\": \"webpack-dev-server\",\n\"predeploy\": \"npm run build\",\n\"deploy\": \"gh-pages -d build\"\n\n\nError when i run npm run deploy:\n\nENOENT: no such file or directory, stat 'C:\\Users\\Luiz\\Desktop\\udemy\\react-course-projects\\indecision-app\\build'\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! [email protected] deploy: `gh-pages -d build`\nnpm ERR! Exit status 1\nnpm ERR!\nnpm ERR! Failed at the [email protected] deploy script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above."
] | [
"reactjs",
"git",
"github-pages"
] |
[
"Why Cant I Get My CSV File Formatted Correctly?",
"So I have a small VBA application that is meant to take input via a userform then send that data to a CSV file. When i read the data from the split userform textboxes the data will not format as it shows in the resulting excel file. I did some research into this and found that saving as CSV causes this to happen sometimes so i set up a script to show the value of each line in the text box and even if i don't save as a CSV the extra characters are still there. I'm hoping someone on here can tell me why this is happening.\n\nI have tried creating a blank CSV file then writing the data to it \n\nI have tried using a for next loop to grab all the data from the userform without saving it but the characters are still present\n\nI have tried printing to a text file then renaming as CSV\n\nThe csv file the code generates looks great and perfect but when i copy the cells to a text file I get extra characters that should not be there. This is the output I get when copying the cells to a text file\n\nOperation Type Full Name S ID Group ID Email Address Phone Number Extension BO Flag CFlag FFlag MD List Locale\nN \"Test 1\n\" \"Test.1\n\" GroupTest \"[email protected]\n\" \"0000000000\n\" Yes No No en_US\nN \"Test 2\n\" \"Test.2\n\" GroupTest \"[email protected]\n\" \"0000000000\n\" Yes No No en_US\nN Test 3 Test.3 GroupTest [email protected] \"0000000000\n\" Yes No No en_US\n\n\nfor some reason the last row is formatted correctly but I can't figure out why the rest of the rows are not\n\nIt should contain a single row for each user like the below\n\nOperation Type Full Name S ID Group ID Email Address Phone Number Extension BO Flag CFlag FFlag MD List Locale\nN Test 1 Test.1 GroupTest [email protected] 0000000000 Yes No No en_US\nN Test 2 Test.2 GroupTest [email protected] 0000000000 Yes No No en_US\n\n\nThis is how I am pulling the data from the textbox\n\nFor Each ctrl In Me.Controls\n\n If TypeName(ctrl) = \"TextBox\" Then\n\n If ctrl.Name = \"TextBox1\" Then 'Full Name\n\n UserForm1.TextBox1.SetFocus\n\n LCount = UserForm1.TextBox1.LineCount\n\n BoxValue = UserForm1.TextBox1.Text\n\n For i = 0 To LCount - 1\n\n BoxValue = Split(UserForm1.TextBox1, Chr(10))(i)\n\n ActiveWorkbook.Sheets(\"Sheet1\").Range(\"B\" & i + 2).value = BoxValue\n\n Next i\n\n End If\n\n End If\n\nNext ctrl\n\n\nThis has to be something related to how I'm pulling data from the textbox but I can't find the problem."
] | [
"excel",
"csv",
"export-to-csv"
] |
[
"Need Simple way to access XML in VB.Net - Pain with Linq-to-Xml",
"Dim myXDoc As XDocument = _\n \n \n \n \n \n \n \n \n \n \n \n\nI want to access this in a simple way in VB.Net - Like:\n\nDim Integer SizeXStr = CInt(MyZDoc.Cameras(1).Camera_Desc.@SizeX) ' where (1) is an index\n\nWhy isn't this implemented in VB.Net? Better yet, type the values with\na Schema and eliminate the conversion. Is this so hard?\n\nHow do I access, in a simple way, data in XML - this would be VERY VERY useful!\n\nI have been using Query to try to get the values - when I use MsgBox() to display\nresults, they display, but my main Windows Form is Trashed - changed colors, etc.\nThe system has Bugs.\n\nInstead, I have to create an elaborate structure of arrays of objects and read the\nXML line-by-line and do the same for saving - this is the dark ages.\n\nArt"
] | [
"vb.net",
"visual-studio-2008",
"linq-to-xml"
] |
[
"The best way to get all children taxons of a root taxon",
"I'm trying to build a dynamic menu based on the taxons from the root taxon 'Category'. This is the menu I want to get :\n\n\nTaxon A\n\nTaxon A1\nTaxon A2\n\nTaxon B\n\nTaxon B1\n\nTaxon B1a\nTaxon B1b\n\n\n\n\nI coded something which worked this way:\n\nFirst, I overrode the taxon repository\n\nuse Sylius\\Bundle\\...\\TaxonRepository as BaseRepository;\n\nclass TaxonRepository extends BaseRepository\n{\n /**\n * @return \\Doctrine\\Common\\Collections\\ArrayCollection\n */\n public function findForMenu()\n {\n return $this\n ->createQueryBuilder('t')\n ->innerJoin('t.taxonomy', 'ta')\n ->innerJoin('ta.root', 'r')\n ->where('ta.name = :name')\n ->andWhere('t.parent = r')\n ->setParameter('name', 'Category')\n ->getQuery()\n ->getResult();\n }\n}\n\n\nThen, I created a menu builder\n\nclass MenuBuilder\n{\n private $factory;\n private $repository;\n\n public function __construct($factory, TaxonRepository $repository)\n {\n $this->factory = $factory;\n $this->repository = $repository;\n }\n\n public function createMain(Request $request)\n {\n $menu = $this->factory->createItem('root');\n\n foreach ($this->repository->findForMenu() as $taxon) {\n $menu->addChild($this->buildChild($taxon));\n }\n\n return $menu;\n }\n\n private function buildChild(Taxon $taxon)\n {\n $item = $this->factory->createItem($taxon->getName());\n\n foreach ($taxon->getChildren() as $child) {\n $item->addChild($this->buildChild($child));\n }\n\n return $item;\n }\n}\n\n\nIt worked well but because of the lazy loading there were a lot of queries so, I decided to use the behaviour of the ClosureTreeRepository (of Gedmo). I realized that I can't do that as you have to inherit from the repository of Sylius and you cannot inherit from the ClosureTreeRepository of Gedmo.\n\nAny hints on how to get the taxon tree well constructed via the ORM?"
] | [
"doctrine-orm",
"sylius",
"doctrine-extensions"
] |
[
"Scripts loading out of order in Chrome",
"I have an external script followed by an inline script at the bottom of my <body>. It looks like the inline script is running before the external script, which isn't supposed to happen, according to this answer:\n\n\n If you aren't dynamically loading scripts or marking them as defer or\n async, then scripts are loaded in the order encountered in the page.\n It doesn't matter whether it's an external script or an inline script\n - they are executed in the order they are encountered in the page. Inline scripts that come after external scripts have are held until\n all external scripts that came before them have loaded and run.\n\n\nSrc: https://stackoverflow.com/a/8996894/114855\n\nThis is my code:\n\n <script src=\"https://checkout.stripe.com/checkout.js\"></script>\n <script>\n var handler = StripeCheckout.configure({\n key: 'pk_live_HhFqemZFyEUJVorFzYvjUK2j',\n token: function(res) {\n $('#pay_token').val(res.id);\n $('#pay_email').val(res.email)\n $('#pay_amount').val(parseFloat($(\"#amount\").val())*100);\n $('#pay_description').val($(\"#description\").val());\n $('#pay_real').submit();\n }\n });\n\n /* .. */\n </script>\n\n</body>\n\n\nConsole is showing that StripeCheckout is not defined (which the external script should define)\n\n\n\nThis makes sense, since the network tab shows that my external request is still pending. But I'm not sure why the browser didn't wait for checkout.js to be fetched:"
] | [
"javascript",
"html"
] |
[
"How to dynamically populate the fields of a class in Java",
"I know the following is not a good design but it's what I need to resolve\n\npublic final class TestBean {\n\n private String field1;\n private String field2;\n private String field3;\n\n public String getField1() {\n return field1;\n }\n public void setField1(String field1) {\n this.field1 = field1;\n }\n public String getField2() {\n return field2;\n }\n public void setField2(String field2) {\n this.field2 = field2;\n }\n public String getField3() {\n return field3;\n }\n public void setField3(String field3) {\n this.field3 = field3;\n }\n}\n\n\nAnd the fields in the class need to be populated dynamically.\n\nLet say I have a array {\"abc\",\"def\"}, and the class should initiated with field1=\"abc\", field2=\"def\" and field3=\"\"; if the array is {\"a\"} and field1=\"a\",field2=\"\",field3=\"\".\n\nIs it possible to achieve that?\n\n\n\nUpdated: apparently I'm not stating the question well. In reality, the field is not just three, it's from field 1, field 2 to field 15. And then it's not just one field, there is another field call let say name, from name 1 to name 15:\n\npublic final class TestBean {\n\n private String field1;\n private String field2;\n ...\n private String field15;\n\n private String name1;\n private String name2;\n ...\n private String name15;\n\n}"
] | [
"java"
] |
[
"Maven-antrun-plugin 1.4 doesn't send anything trough ftp",
"So I installed this plugin for sending file through ftp. Unfortunately I have to use this version. Here's code in pom.xml\n\n<plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven-antrun-plugin</artifactId>\n <version>1.4</version>\n <executions>\n <execution>\n <id>ftp</id>\n <phase>package</phase>\n <configuration>\n <target>\n <ftp action=\"send\"\n server=\"10.132.30.179\"\n remotedir=\"subsystems\"\n userid=\"radio\"\n password=\"oss\"\n depends=\"yes\"\n verbose=\"yes\">\n <fileset dir=\"C:\\Users\\Michal\\Downloads\\web-framework\">\n <include name=\"*.txt\"/>\n </fileset>\n </ftp>\n </target>\n </configuration>\n <goals>\n <goal>run</goal>\n </goals>\n </execution>\n </executions>\n <dependencies>\n <dependency>\n <groupId>org.apache.ant</groupId>\n <artifactId>ant</artifactId>\n <version>1.9.1</version>\n </dependency>\n </dependencies>\n </plugin>\n\n\nAnd everything works just fine when I invoke 'mvn package'. Package is build and there are no errors. But nothing goes thourgh ftp. Here's what I get on this stage in build. \n\n[INFO] --- maven-antrun-plugin:1.4:run (ftp) @ dist ---\nproject.artifactId\n[INFO] Executing tasks\n[INFO] Executed tasks\n\n\nIs there something wrong with my code?"
] | [
"java",
"maven",
"ftp"
] |
[
"How to display a list as 3 columns for lg screens and 1 column for sm screens",
"On a computer, my list looks like:\n\n\nBut on a phone, it only shows the 1st column and doesn't continue the list as a 1-column list.\n\nI'm using Bootstrap and my code looks like:\n\n <section>\n <div class=\"container\">\n <div class=\"row align-items-start\">\n <div class=\"col-sm-12 col-md-4\">\n <div class=\"p-3\">\n\n <b>Statewide Texas Sites</b><br />\n <a href=\"https://www.touringtexas.com/\" target=\"_top\">Touring Texas</a>\n <br />\n <a href=\"https://www.texas-lakes.net/\" target=\"_top\">Texas Lakes</a>\n <br />\n\n </div>\n </div>\n\n <div class=\"col-sm-12 col-md-4 col-md-push-4\">\n <div class=\"p-3\">\n\n <b>Texas Tourist Areas</b><br />\n <a href=\"https://www.highlandlakes.com/\" target=\"_top\">Highland Lakes</a>\n <br />\n <a href=\"https://www.hill-country.net/\" target=\"_top\">Hill Country Network</a>\n <br />\n\n </div>\n </div>\n\n\n <div class=\"col-sm-12 col-md-4 col-md-push-4\">\n <div class=\"p-3\">\n\n <b>Texas Lakes</b><br />\n <a href=\"https://www.highlandlakes.net/lakeaustin/\" target=\"_top\">Lake Austin</a>\n <br />\n <a href=\"https://www.lake-bridgeport.com/\" target=\"_top\">Lake Bridgeport</a>\n <br />\n\n </div>\n </div>\n </div>\n </div>\n </section>"
] | [
"javascript",
"css",
"size",
"screen"
] |
[
"Installing ORACLE 11 G on WINDOWS 10 machine",
"I was wondering if someone could suggest anything here.\nI am trying to install Oracle 11g on my Windows 10 64 bit machine. On my side I am required to install the 64Bit driver first and for whatever reason it stucks at steps 5 of 7.\nChecking forum and SO, I saw a suggestion to add the below bit of xml to the cvu_prereq.xml file present in the stage/cvu folder. Yet this has not helped.\n<OPERATING_SYSTEM RELEASE="6.2">\n <VERSION VALUE="3"/>\n <ARCHITECTURE VALUE="64-bit"/>\n <NAME VALUE="Windows 10"/>\n <ENV_VAR_LIST>\n <ENV_VAR NAME="PATH" MAX_LENGTH="1023" />\n </ENV_VAR_LIST>\n </OPERATING_SYSTEM>\n\nWhen checking the logs, It seems to stuck each time on 'Get view named [SummaryUI]'.\nFrom the logs it seems my machine fits all the prerequisite.\nINFO: All forked task are completed at state checkPrereqs\nINFO: Completed background operations\nINFO: Moved to state <checkPrereqs>\nINFO: Waiting for completion of background operations\nINFO: Completed background operations\nINFO: Validating view at state <checkPrereqs>\nINFO: Completed validating view at state <checkPrereqs>\nINFO: Validating state <checkPrereqs>\nINFO: Using default Validator configured in the Action class oracle.install.ivw.client.action.PrereqAction\nINFO: Completed validating state <checkPrereqs>\nINFO: Verifying route success\nINFO: Get view named [SummaryUI]\n\nHas anyone any suggestion for this please? I am at a loss as to why it fails on this very step."
] | [
"oracle",
"oracle11g"
] |
[
"In a multi-server environment, if a site has inactivity for more than 15 mn, the server loses connection to PostgreSQL database",
"I get the following errors in airbrake if my staging (2 servers) or production (4 servers) servers have no activity for about 15 minutes. Here are the error messages:\n\n\n ActiveRecord::StatementInvalid: PG::Error: could not receive data from\n server: Connection timed out\n\n\nOR\n\n\n PG::Error: could not connect to server: Connection timed out Is the\n server running on host \"tci-db4.dev.prod\" and accepting TCP/IP\n connections on port 5432?\n\n\nI'm using PostgreSQL as my database. One of the servers also acts as the db server.\n\nEnvironment:\n\nRuby 1.9.3 (This also happened under Ruby 1.8.7, but it is worse since upgrading since the ruby process on the server will go to 100% and stay at 100% until is killed when the server loses the db connection.\n\nRails 3.1.6\n\nPG GEM 0.13.2\n\nPostgres 9.1\n\nPhusion Passenger\n\nThis problem has been happening for over a year, so I'm hoping someone has some insight on how to fix it. Thanks."
] | [
"ruby-on-rails",
"ruby-on-rails-3",
"postgresql",
"webserver",
"postgresql-9.1"
] |
[
"Get NullPointerException after closing application - android",
"I am getting this error after closing (and removing from recent app on my device) my app, it occurs everytime.\n\n09-22 23:44:28.503 4021-4021/? I/art﹕ Late-enabling -Xcheck:jni\n09-22 23:44:28.584 4021-4021/cz.united121.android.revizori D/cz.united121.android.revizori.App﹕ onCreate\n09-22 23:44:28.642 4021-4021/cz.united121.android.revizori D/cz.united121.android.revizori.service.MyUpdatingService﹕ onCreate\n09-22 23:44:28.677 4021-4021/cz.united121.android.revizori D/AndroidRuntime﹕ Shutting down VM\n09-22 23:44:28.679 4021-4021/cz.united121.android.revizori E/AndroidRuntime﹕ FATAL EXCEPTION: main\n Process: cz.united121.android.revizori, PID: 4021\n java.lang.RuntimeException: Unable to start service cz.united121.android.revizori.service.MyUpdatingService@3a7bf84e with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference\n at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2913)\n at android.app.ActivityThread.access$2100(ActivityThread.java:148)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:135)\n at android.app.ActivityThread.main(ActivityThread.java:5312)\n at java.lang.reflect.Method.invoke(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:372)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)\n Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference\n at cz.united121.android.revizori.service.MyUpdatingService.onStartCommand(MyUpdatingService.java:94)\n at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2896)\n at android.app.ActivityThread.access$2100(ActivityThread.java:148)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:135)\n at android.app.ActivityThread.main(ActivityThread.java:5312)\n at java.lang.reflect.Method.invoke(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:372)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)\n\n\nThe line (Log.d(TAG, \"onStartCommand\" + intent.getAction());) which is exception refer is in Service in onStartCommand:\n\n@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n super.onStartCommand(intent, flags, startId);\n Log.d(TAG, \"onStartCommand\" + intent.getAction());\n if (intent.getAction().equals(SERVICE_FORCE)) {\n LOCATION_APROVAL = true;\n if (mLastKnownPosition != null) {\n mTimeAproving.run();\n }\n } else if (intent.getAction().equals(SERVICE_START)) {\n mUpdatingTimer.scheduleAtFixedRate(mTimeAproving, 0, PERIOD_BETWEEN_UPDATING);\n } else if (intent.getAction().equals(SERVICE_STOP)) {\n LOCATION_APROVAL = false;\n mLastKnownPosition = null;\n mUpdatingTimer.cancel();\n mUpdatingTimer.purge();\n }\n return START_STICKY;\n }\n\n\nThank you in advance."
] | [
"java",
"android",
"service",
"nullpointerexception"
] |
[
"Combine multiple rows in a single row by descending order SQL",
"I have this table below:\n\nStyle | Color | Qty\n------------------------\nStyle1 | Red | 10\nStyle1 | Black | 15\nStyle1 | White | 7\nStyle2 | Yellow | 10\nStyle2 | Green | 8\nStyle3 | White | 15\nStyle3 | Black | 20\n\n\nand I want to get a table, which will have Style and then all its colors separated with comma, but in descending order of their available QUANTITIES (Qty); and SUM of Qty in another column. I have the code which gives me almost what I want, but I don't know how to modify it so as I have colors in correct order. \n\nSELECT DISTINCT A.Style, sum(Qty) as SumQty, \n STUFF((SELECT distinct ',' + p.Color \n FROM inv as P \n WHERE A.Style = p.Style \n FOR XML PATH(''), TYPE \n ).value('.', 'NVARCHAR(MAX)') \n ,1,1,'') AS Color \nfrom inv As A \ngroup by A.style\n\n\nResult table should look:\n\nStyle | Color | SumQty\n-------------------------------------\nStyle1 | Black, Red, White | 32\nStyle2 | Yellow, Green | 18\nStyle3 | Black, White | 35\n\n\nI would greatly appreciate any help."
] | [
"sql",
"sql-server"
] |
[
"Store the total json objects into MongoDB",
"Can I store the total json objects into MongoDB?\n\nLike if I am having the URL of that json.\n\nCan anyone tell in Gradle?"
] | [
"json",
"mongodb",
"rest",
"gradle",
"spring-boot"
] |
[
"Show Images table view controller with the Library AlamofireImage Swift 2",
"I'm making an app that works as a reader.\n\nI have a UITableViewController , which show all the news I read a xml, show the title, date, a brief description and a picture. Less image, I show everything right.\n\nI added the AlamofireImage library for images to be displayed. At first they do not appear, but if I charge a reloadData() view, the images appear.\n\nMost of the images are in the correct position , but others out of position and some , just out image. The title, date and description or shown.\n\nI leave the code I use:\n\nif let actualImageView = imageView {\n actualImageView.contentMode = .ScaleAspectFit\n\n let URL = NSURL(string: currentArticleToDisplay.imagen)!\n actualImageView.af_setImageWithURL(\n URL,\n placeholderImage: nil,\n filter: nil\n )\n}\n\n\nThe constraints , I have them defined in the Main.storyboard , because if you put them in code , either charged me at first .\n\nAny idea what could be the problem? Do I need to add more parts of the code ? Is this the correct way to display images ? Is there any library with which it can solve ?\n\nThank you"
] | [
"ios",
"xcode",
"swift",
"swift2"
] |
[
"ConfigureAwait(false) with ADO.Net SQLConnection object",
"I have started using ConfigureAwait(false) with all the async sql objects.\n\nconnection.OpenAsync().ConfigureAwait(false);\ncmd.ExecuteNonQueryAsync().ConfigureAwait(false);\n\n\nBut my concern is, Will there be any implications with this approach?.\n\nAs this will run on a thread pool which is a separate thread from which it got originated i am not sure about the consequences if we dont run it on a single thread.\n\nOur application is wcf service which will process the 1000's of records parallel.\n\nIf some one helps to identity the business scenarios where it could be problem that would be helpful.\n\nThanks"
] | [
"c#",
"sql",
"multithreading",
"async-await",
"configureawait"
] |
[
"Pulling a Value from a webpage",
"I'm wanting to pull a single value from a website, the page in question is just a file with no extension that contains a number, no HTML code - nothing.\n\nAll I want to do is get my program to pull this figure and compare it to it's own version number. What is going to be the best way about fetching this? I wrote a small snippet to download the file and save it in the temp directory and then processing the figure within the downloaded file but there has to be a better way if I'm not mistaken?\n\nI have read about people using SOAP requests but I'm not sure if this is what I want.\n\nAny help would be appreciated."
] | [
"delphi",
"soap",
"version"
] |
[
"Dynamically fetching user credentials for authenticating with ADLS from a spark job",
"Is there a way I can fetch user credentials to authenticate with ADLS from within a spark job. I am trying to write a library that be used by users in their spark job to read data and want to hide implementation details. Also, what would be the best way to get credentials for a user from within spark job?"
] | [
"authentication",
"apache-spark",
"credentials",
"azure-data-lake",
"credential-providers"
] |
[
"How to check if path exists in fluent-ffmpeg?",
"How can i create a folder on a path in fluent Ffmpeg, if the path does not work?\nconst ffmpeg = require("fluent-ffmpeg");\nconst ffmpegInstaller = require("@ffmpeg-installer/ffmpeg");\n\nvar ffmpeg_MP4_as_video = function(inputPath, inputFile, inputFileType, outputPath) {\n var input = inputPath + inputFile + inputFileType;\n console.log(input);\n const output = outputPath + inputFile + ".m3u8";\n console.log(output);\n ffmpeg.setFfmpegPath(ffmpegInstaller.path);\n ffmpeg(input, { timeout: 432000 })\n .addOptions([\n "-profile:v baseline",\n "-level 3.0",\n "-start_number 0",\n "-hls_time 5",\n "-hls_list_size 0",\n "-f hls",\n ])\n .output(output)\n .on("end", () => {\n console.log("end");\n return;\n })\n .run();\n};\n\nffmpeg_MP4_as_video("videos/mp4_to_mp4/", "forest_test", ".mp4", "videos/mp4_to_mp4/");\n\nHere i would like to see, that mp4_to_mp4/some_further_path gets created, if it does not exist ... is this accomplishable through fluent-ffmpeg?"
] | [
"javascript",
"node.js",
"ffmpeg",
"http-live-streaming",
"fluent-ffmpeg"
] |
[
"How to invoke DML trigger to customized OAuth2 table AspNetUser, when new user is created?",
"Thanks to this excellent post, I was able to customize the set of OAuth2 tables for user security.\n\nNow I need to implement DML triggers to these customized tables, such as when a user is created, updated or deleted. What I need to do is to update and manipulate certain values in these tables, and ideally through database scripts and not in VS code. \n\nUnder SSMS/IIS10, is it possible to do so? The triggers I defined are current not invoked when a user is created through the web API.\n\nThank you in advance for any suggestions.\n\nEdited to add:\nThe triggers I have in mind are INSTEAD OF INSERT, INSTEAD OF UPDATE etc."
] | [
"database",
"visual-studio",
"oauth-2.0",
"asp.net-web-api2",
"ssms"
] |
[
"Use AWS SDK Amplify to download folder in S3",
"I'm using amplify to download the folder in S3 but as I see it just provide me method to download a single file not the whole folder like .NET SDK (DownloadDirectoryAsync). Do anyone have the way to do it (or workaround).\n\nThanks in advance."
] | [
"angular",
"typescript",
"amazon-s3",
"aws-amplify"
] |
[
"How to properly use VS auto closing brace feature?",
"I'm using Visual Studio 2013 Ultimate and it automatically adds a closing brace when I type an opening brace. However, it can be quite annoying at times e.g.\n\nif (bFlag)\n Console.Output(\"Hello World\");\n\n\nNow if I wanted to enclose Console.Output code in braces, and enter an opening brace after the if expression, VS automatically places a closing brace there as well e.g.\n\nif (bFlag)\n{}\n Console.Output(\"Hello World\");\n\n\nThis is annoying in that first I have to delete the closing brace and then manually type in closing brace at the end. Is there an automagical way of doing this? I don't necessarily want to disable the auto-close brace feature.\n\nEdit: I'm hoping for a more intelligent solution that automatically adds parenthesis at the end of the expected code block (read: it automatically detects code block). In the example I gave earlier, when I type opening brace after 'if' clause, it should automatically put a closing brace before the 'else' clause etc. If I have to first select all the code and then press a hot-key combo (typically twice), I might as well just manually put the opening/closing braces."
] | [
"c#",
"visual-studio-2013"
] |
[
"Twig PHP Renderer and Tempo JS Renderer together?",
"I have some issues using the Twig engine and the Tempo engine together in a project. \n\n<ul id=\"tweets\" class=\"list-unstyled\">\n <li data-template>\n <img src=\"#\" data-src=\"{{author}}\" />\n <h3>{{uuid}}</h3>\n <p>{{comment}}<span>, {{age}} <small>ago</small></span></p>\n </li>\n </ul>\n\n\nthe {{author}} e.g. must be rendered by Tempo and is filled by an async ajax call. When Twig renders the PHP it fills the bracket tags with empty strings because the tags are unknown or null at this time. Both engines have the same syntax.\n\nAny ideas? Thx in advise."
] | [
"javascript",
"php",
"twig",
"tempo"
] |
[
"Can't locate XML/Writer.pm in @INC . Cant locate DBD/CSV.pm in @INC",
"I tried using CPAN module XML::Writer, but I am getting following error:\nCan't locate XML/Writer.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at testing.pl line 3.\nBEGIN failed--compilation aborted at testing.pl line 3.\n\nI checked for installation of the module using - perldoc XML::Writer and the document doesn't seems to be exist.\nAs I don't have the privilege to install the package as I am not the system administrator.\nI have similar error for DBD::CSV too.\nWhat can be done if a particular CPAN module not available/installed in the server where I am working and how do I install it without admin access?"
] | [
"perl",
"cpan",
"xmlwriter",
"dbd"
] |
[
"Time complexity of Boggle solver",
"Here is a (ugly) algorithm for finding all words in Boggle:\n\nd = {'cat', 'dog', 'bird'}\n\ngrid = [\n ['a', 'd', 'c', 'd'],\n ['o', 'c', 'a', 't'],\n ['a', 'g', 'c', 'd'],\n ['a', 'b', 'c', 'd']\n]\n\nfound = {}\n\nN = 4\n\ndef solve(row, col, prefix):\n if prefix in d and prefix not in found:\n found[prefix] = True\n print prefix\n\n for i in xrange(max(0, row - 1), min(N, row + 2)):\n for j in xrange(max(0, col - 1), min(N, col + 2)):\n c = grid[i][j]\n if c != '#' and not (row == i and col == j):\n grid[i][j] = '#'\n solve(i, j, prefix + c)\n grid[i][j] = c\n\n\nfor row in xrange(N):\n for col in xrange(N):\n c = grid[row][col]\n grid[row][col] = '#'\n solve(row, col, c)\n grid[row][col] = c\n\n\nWhat is the Big-O runtime of this algorithm? I believe it is O((N²)!), but I'm not sure."
] | [
"python",
"algorithm",
"time-complexity",
"big-o",
"boggle"
] |
[
"How to check if an element is in the document with playwright?",
"I want to test if an element had been rendered. So I want expect that if is present. Is there a command for this?\nawait page.goto(‘<http://localhost:3000/>');\nconst logo = await page.$(‘.logo’)\n\n// expect(logo.toBeInDocument())"
] | [
"node.js",
"playwright"
] |
[
"how many spaces are considered in \\t",
"why the number of space is different in case 3\nhow the result is getting effected by \\t character.\n\n(-) refers space by (\\t)\n\ncase 1\n void main()\n {\n int a,b;\n printf(\"%d\",printf(\"hello%d\\t\",scanf(\"%d%d\",&a,&b)));\n }\n\n\nhere the output is>hello2-7\n\ncase 2\n void main()\n {\n int a,b;\n printf(\"%d\",printf(\"hello\\t%d\",scanf(\"%d%d\",&a,&b)));\n }\n\n\nhere the output is>hello-27\n\ncase 3\n void main()\n {\n int a,b;\n printf(\"%d\",printf(\"\\thello%d\",scanf(\"%d%d\",&a,&b)));\n }\n\n\nhere the output is>--------hello27\nWhy in the 3rd case there are 8 spaces."
] | [
"c++",
"c"
] |
[
"HTML canvas saving on mysql database",
"I'm stuck with my code.\n\nProblem: I have canvas and inside it I draw the lines. And after I finished I want that lines to stay in the right place where i left that(before reload website). So I need to send that canvas to mysql data base. But here I stuck. Did I first need to create .png image and then try to send that image information to database? or somehow I can send it right off from code to database by using AJAX? I read a lot of information and I am confused right now.\n\nIf I will use method HTMLgetImageData() and HTMLputImageData() then I need to create some real image in my server? or I can take straight from the canvas? and send to mysql databse? :) \n\nso now I have Canvas in html and some script for drawing the lines: \n\n$(\".widget_body\").on(\"mousedown\", \"canvas\", function() {\n\n var id = $(this).attr(\"id\");\n var canvas = document.getElementById(id);\n var canvas,\n context,\n dragging = false,\n dragStartLocation,\n snapshot;\n\n fitToContainer(canvas);\n\n function fitToContainer(canvas){\n // Make it visually fill the positioned parent\n canvas.style.width ='100%';\n canvas.style.height='100%';\n // ...then set the internal size to match\n canvas.width = canvas.offsetWidth;\n canvas.height = canvas.offsetHeight;\n }\n\n\n function getCanvasCoordinates(event) {\n var x = event.clientX - canvas.getBoundingClientRect().left,\n y = event.clientY - canvas.getBoundingClientRect().top;\n\n return {x: x, y: y};\n }\n\n function takeSnapshot() {\n snapshot = context.getImageData(0, 0, canvas.width, canvas.height);\n }\n\n function restoreSnapshot() {\n context.putImageData(snapshot, 0, 0);\n }\n\n\n function drawLine(position) {\n context.beginPath();\n context.moveTo(dragStartLocation.x, dragStartLocation.y);\n context.lineTo(position.x, position.y);\n context.stroke();\n }\n\n function dragStart(event) {\n dragging = true;\n dragStartLocation = getCanvasCoordinates(event);\n takeSnapshot();\n }\n\n function drag(event) {\n var position;\n if (dragging === true) {\n restoreSnapshot();\n position = getCanvasCoordinates(event);\n drawLine(position);\n }\n }\n\n function dragStop(event) {\n dragging = false;\n restoreSnapshot();\n var position = getCanvasCoordinates(event);\n drawLine(position);\n }\n\n function clearCanvas(event) {\n context.clearRect(0, 0, canvas.width, canvas.height);\n }\n\n\n context = canvas.getContext('2d');\n context.strokeStyle = 'purple';\n context.lineWidth = 4;\n context.lineCap = 'round';\n\n canvas.addEventListener('mousedown', dragStart, false);\n canvas.addEventListener('mousemove', drag, false);\n canvas.addEventListener('mouseup', dragStop, false);\n canvas.addEventListener('dblclick', clearCanvas, false);\n });\n\n\nMaybe somebody can suggest something to me? Maybe something about next steps?What should I have to do from this moment?"
] | [
"javascript",
"php",
"mysql",
"canvas",
"html5-canvas"
] |
[
"Use trigger as assertion in MySQL",
"I have a database and a few tables in MySql. I am trying to implement an Oracle assertion in MySQL using CREATE TRIGGER. I am not sure if I used the proper syntax.\n\nThis is what I have so far, but I'm not sure why it's wrong.\n\nCREATE TRIGGER tg_review_before_insert\nBEFORE INSERT ON review\nFOR EACH ROW\nSET NEW.paper = IF((SELECT * FROM paper P WHERE 3 <>(SELECT COUNT(*)\n FROM review R\n WHERE R.paperid = P.paperid)\n);\n\n\nHere are my tables:\n\nCREATE TABLE paper(\n paperid INT UNSIGNED NOT NULL AUTO_INCREMENT,\n title VARCHAR(50) NOT NULL,\n abstract VARCHAR(250),\n pdf VARCHAR(100),\n PRIMARY KEY(paperid)\n);\n\nCREATE TABLE author(\n email VARCHAR(100) NOT NULL,\n name VARCHAR(50),\n affiliation VARCHAR(100),\n PRIMARY KEY(email)\n);\n\nCREATE TABLE writePaper(\n paperid INT UNSIGNED NOT NULL AUTO_INCREMENT,\n email VARCHAR(100),\n paper_order INT,\n PRIMARY KEY(paperid, email),\n FOREIGN KEY(paperid) REFERENCES paper(paperid),\n FOREIGN KEY(email) REFERENCES author(email)\n);\n\nCREATE TABLE pcmember(\n email VARCHAR(100) NOT NULL,\n name VARCHAR(20),\n PRIMARY KEY(email)\n);\n\nCREATE TABLE review(\n reportid INT UNSIGNED,\n sdate DATE,\n comment VARCHAR(250),\n recommendation CHAR(1),\n paperid INT UNSIGNED,\n email VARCHAR(100),\n PRIMARY KEY(paperid, email),\n FOREIGN KEY(paperid) REFERENCES paper(paperid),\n FOREIGN KEY(email) REFERENCES pcmember(email)\n);\n\n\nHere are the assertions I am trying to implement from Oracle SQL code to MySQL SQL code:\n\nCREATE ASSERTION assert\nCHECK NOT EXISTS(SELECT * FROM paper P WHERE 3 <>(SELECT COUNT(*)\n FROM review R\n WHERE R.paperid = P.paperid)\n);\n\nCREATE ASSERTION atmostfivepapers\nCHECK NOT EXISTS(SELECT * FROM pcmember P WHERE 5 <\n ( SELECT *\n FROM review R\n WHERE R.email = P.email\n )\n);"
] | [
"mysql",
"sql",
"database-trigger"
] |
[
"How to discretize multiple columns in R",
"I'm trying to discretize 274 columns in a table and run naive bayes and decision tree algorithms. How can you discretize many columns at once? My variable smalltrainv3 contains 275 columns, with the first being a factor (levels 0-9) and the being numeric. \n\nWhenever I try to use the discretize function it tells me x must be numeric."
] | [
"r",
"decision-tree",
"naivebayes",
"discretization"
] |
[
"VT-Direct Integration (Mandiri Bill Payment) Expired in 24 hours",
"Using VT-Direct Integration (Mandiri Bill Payment) for a web app in Indo, the problem i am facing is transaction get expired after 24 hours, if customer fails to pay the money with Mandiri Bill Payment, i want to change this to 48 hours, any one with Veritans ? response appreciated. \n\nhere is the api url : \n\nhttps://docs.midtrans.com/en/vtdirect/integration_mbill.html\n\ntransaction = {\n payment_type: 'echannel',\n transaction_details: {\n order_id: id_order,\n gross_amount: total_paid\n },\n item_details: txn_products,\n echannel: {\n bill_info1: \"Payment For: \" + id_order,\n bill_info2: \"debt\"\n }\n};"
] | [
"php",
"node.js",
"payment-gateway",
"loopback"
] |
[
"Normalize tab spaces",
"I have a project that has code that was contributed by many people without a proper policy on tab space (I know, huge mistake.)\n\nWhat's the best way to normalize all tabs to spaces? Optimally some kind of a script that can do this to all files via the command line at once.\n\nI know of Ruby Beautifier, but I didn't have any luck with ERB files (it also doesn't run on 1.9).\n\nThanks in advance\n\nEDIT:\nForgot to say that we use Mac OS X"
] | [
"ruby-on-rails"
] |
[
"Splitting up connections between groups",
"I would like to know the best way to split up the connection command. I have two groups that I want to be modular, an inner group and an outer group. I want the inner group to be a kind of black box where I can switch out or change the inner group without changing all the connections for the outer group. I just want the outer group to have to know the inputs and outputs of the inner group. For an example: \n\nimport numpy as np\nfrom openmdao.api import Group, Problem, Component, IndepVarComp, ExecComp\n\nclass C(Component):\n def __init__(self, n):\n super(C, self).__init__()\n self.add_param('array_element', shape=1)\n self.add_output('new_element', shape=1)\n\n def solve_nonlinear(self, params, unknowns, resids):\n unknowns['new_element'] = params['array_element']*2.0\n\nclass MUX(Component):\n def __init__(self, n):\n super(MUX, self).__init__()\n for i in range(n):\n self.add_param('new_element' + str(i), shape=1)\n self.add_output('new_array', shape=n)\n self.n = n\n\n def solve_nonlinear(self, params, unknowns, resids):\n new_array = np.zeros(n)\n for i in range(n):\n new_array[i] = params['new_element' + str(i)]\n unknowns['new_array'] = new_array\n\nclass GroupInner(Group):\n def __init__(self, n):\n super(GroupInner, self).__init__()\n for i in range(n):\n self.add('c'+str(i), C(n))\n self.connect('array', 'c'+str(i) + '.array_element', src_indices=[i]) \n self.connect('c'+str(i)+'.new_element', 'new_element'+str(i))\n\n self.add('mux', MUX(n), promotes=['*'])\n\nclass GroupOuter(Group):\n def __init__(self, n):\n super(GroupOuter, self).__init__()\n self.add('array', IndepVarComp('array', np.zeros(n)), promotes=['*'])\n self.add('inner', GroupInner(n), promotes=['new_array'])\n for i in range(n):\n # self.connect('array', 'inner.c'+str(i) + '.array_element', src_indices=[i])\n self.connect('array', 'inner.array', src_indices=[i])\nn = 3\np = Problem()\np.root = GroupOuter(n)\np.setup(check=False)\np['array'] = np.ones(n)\np.run()\n\nprint p['new_array']\n\n\nWhen I run the code I get the error that: \n\nNameError: Source 'array' cannot be connected to target 'c0.array_element': 'array' does not exist.\n\n\nTo try to solve this I made 'array' an IndepVarComp in the GroupInner group. However, when I do this I get the error:\n\nNameError: Source 'array' cannot be connected to target 'inner.array': Target must be a parameter but 'inner.array' is an unknown.\n\n\nI know that if I just make the full connection: self.connect('array', 'inner.c'+str(i) + '.array_element', src_indices=[i]) then it will work. But like I said I want GroupInner to be kind of a black box where I don't know what groups or components are in it. I also can't just promote all because the array_elements are different. Is it possible to do this or do you have to do the entire connection in one command?"
] | [
"openmdao"
] |
Subsets and Splits