texts
sequence | tags
sequence |
---|---|
[
"Need help creating a dummy WSResponse object (Scala + Play)",
"I have a code sample as below where I am using WSClient to make API calls. I am using 2.5.x and Scala 2.11.11 (using WSClient provided by Play not stand-alone). In an exception condition I need to return WSResponse object to the caller of this method. From documentation I found Ahc package which provides AhcWSResponse. Any idea how can I create the WSResponse object ? I tried based on a link as below but that does not work.\n\nHow to create a WSResponse object from string for Play WSClient\n\ndef fetchData (request: WSRequest): Future[WSResponse] = { \n request.withQueryString(\"apitoken\" -> token).get().flatMap { dataResponse =>\n if (dataResponse.status == 200) {\n Future(Ok(dataResponse.json))\n } else if (dataResponse.status == 400) {\n ...\n }\n }.recover {\n case e: Exception =>\n //need to return a WSResponse object - how do i create one here \n }\n}"
] | [
"scala",
"playframework",
"ws-client"
] |
[
"How to define a region within a property in prism",
"I have a ContentControl hosting a region, which is within a property. The problem is, prism does not find the region manager on this ContentControl.\n\n<MyView>\n <MyView.Menu>\n <MyMenu>\n <ContentControl prism:RegionManager.RegionName=\"AppBarRegion\" />\n </MyMenu>\n </MyView.Menu>\n</MyView>\n\n\nIs there a way to fix this problem?\n\nThanks for help,\nEny"
] | [
"wpf",
"prism"
] |
[
"OCaml assertion fail",
"Hey everyone I'm new to OCaml and having some problems. So I'm trying to do a recursive function that takes a non-empty list and returns the last element. My list can be any data type though.\nHere is what I have right now and it's currently failing on the assertion statement saying "This expression has type int but an expression was expected of type int list.\nlet rec last l = match l with\n\n[] -> []\n\n|[x] -> [x]\n\n|_::t -> last t ;;\n\nassert(last [1; 2; 3; 4] = 4);;\n\nassert(last ["a"; "b"; "c"; "d"] = "d");;"
] | [
"ocaml"
] |
[
"Can't create a BIN FIle in forms application using BinaryWriter",
"I am having an issue that is perplexing me. I used the follow lines of codes in a simple Console app that produces a correctly formatted BIN File shown below. When I moved this code into my Forms Application, into an event handler, it now produces a BIN file that is very incorrect.\n\nThe code is identical in both programs I have debugged through the forms application and it sends the correct bytes to the BinaryWriter. However, a bad result is produced when in the Forms Application.\nDoes anyone know why this would produce a bad result.\n\nstring datastream = strStreamData;\nstring[] DataStream_Array = datastream.Split(' ');\nstring[] RawData = new string[DataStream_Array.Length - 21];\n\nfor (int index = 0; index < DataStream_Array.Length - 21; index++)\n{\n RawData[index] = DataStream_Array[index + 20];\n}\n\nusing (BinaryWriter bin = new BinaryWriter(File.Open(\"MyBiN.bin\", FileMode.Create)))\n{\n foreach (string data in RawData)\n {\n byte databyte = Convert.ToByte(data, 16);\n bin.Write(databyte); \n }\n}\n\n\nIs there a problem using an event handler with this code inside?\n\nThis is the correctly formmated BIN file from the Console Application\n\n\nThis is the result from my Forms App from inside the event handler"
] | [
"c#",
"visual-studio-2010",
"bin"
] |
[
"Node Express proxy getting Status Code: 404 Not Found instead of 200 success code",
"My server.js file looks like below:\n\nconst express = require('express');\nconst http = require('http');\nconst path = require('path');\n//const request = require('request');\nconst app = express();\nvar cors = require('cors')\napp.use(cors())\n\napp.all('*', function(req, res, next) {\n res.header(\"Access-Control-Allow-Origin\", \"*\");\n res.header(\"Access-Control-Allow-Headers\", \"Origin, X-Requested-With, Content-Type, Accept\");\n res.header(\"access-control-allow-credentials\", \"true\"),\n // res.header(\"access-control-allow-methods\", \"GET, POST, PUT, DELETE, PATCH, OPTIONS\"), \n res.header(\"access-control-allow-methods\", \"GET, POST, PUT, DELETE, PATCH, OPTIONS\"),\n\n next();\n});\n\nvar corsOptions = {\n origin: 'http://localhost:8080',\n optionsSuccessStatus: 200\n}\n\nconst port = process.env.PORT || 3001;\n\napp.use(express.static(__dirname + '/dist/myApp'));\n\napp.get(\"/*\", (req, res) => res.sendFile(path.join(__dirname)));\n\napp.post(\"/dashboard\", cors(corsOptions), function(req, res) {\n console.log(req.headers); // the posted data\n console.log(req.query.module);\n res.sendStatus(200)\n});\n\nconst server = http.createServer(app);\n\nserver.listen(port, () => console.log('Running......'));\n\n\nWhen i do node server.js and hit http://localhost:3001/ hit in browser i am getting my page what i mentioned a /dashboard in this same file.\n\nBut i am getting Status Code: 404 Not Found.\nURL is showing in network tab is http://localhost:3001/student/allstudent. \n\nWhat else i should changes? if start with proxy.conf.json with 4200 port it will work fine. but now i am not starting as a proxy.conf.json because i am starting node server.js. can some help me. should we provide any proxy for express is different than angular node server."
] | [
"node.js",
"angular",
"express"
] |
[
"Counting number of words in a file",
"I'm having a problem counting the number of words in a file. The approach that I am taking is when I see a space or a newLine then I know to count a word.\n\nThe problem is that if I have multiple lines between paragraphs then I ended up counting them as words also. If you look at the readFile() method you can see what I am doing. \n\nCould you help me out and guide me in the right direction on how to fix this?\n\nExample input file (including a blank line):\n\nword word word\nword word\n\nword word word"
] | [
"java",
"algorithm",
"loops",
"io"
] |
[
"How to make dictionary out of complex column of dataset?",
"So I have this column = Test_Label in my dataset. (See Screenshot 1 to see part of the column)\n\n\nI'm trying to make a dictionary for each row. \nMy desired list, I believe should look like this for each row\n\nFor example. Below is my column.\n\n\n1 None\n2 None\n3 None\n4 None\n5 COMP=off,CONTROLLER=4310\n6 TEMP=25,SOAK=15,CONTROLLER=4310\n7 DSA=1,HSDIG=0\n8 VBAT=3.00,BGSEL=typ,CMON=none,POWER_MODE=buck,REVISION=ac,TEST=copy_settings,CS=bb\n9 REVISION=ac,TEST=copy_settings,CS=bb\n13 REVISION=ac,TEST=copy_settings,CS=bb\n\n\nHere is a list I just created out of my data. I think this will help to copy to IDE.\n\n[['None'],\n ['None'],\n ['None'],\n ['COMP=off,CONTROLLER=4310'],\n ['TEMP=25,SOAK=15,CONTROLLER=4310'],\n ['DSA=1,HSDIG=0'],\n ['VBAT=3.00,BGSEL=typ,CMON=none,POWER_MODE=buck,REVISION=ac,TEST=copy_settings,CS=bb'],\n ['REVISION=ac,TEST=copy_settings,CS=bb'],\n ['REVISION=ac,TEST=copy_settings,CS=bb']]\n\n\nfor the above column, my desired dictionary would something look like this for each row.\n\n{'None': 1}\n{'None': 1}\n{'None': 1}\n{'COMP': 'off', 'CONTROLLER'=4310}\n{'TEMP': 25, 'SOAK' : 15,'CONTROLLER' :4310 }\n{'REVISION': 'ac', 'TEST':'copy_settings','CS':'bb' }\n{'REVISION': 'ac', 'TEST':'copy_settings','CS':'bb' }\n\n\n\nThough, I'm not able to create my dict like above.\nI'm also posting my code here.\n\n# Create an empty list \nRow_list =[] \n\n# Iterate over each row \nfor rows in Dataframe.itertuples(): \n # Create list for the current row \n my_list =[rows.Test_Label] \n # append the list to the final list \n Row_list.append(my_list) \n\n\nres = []\nfor list in Row_list:\n res.append(str(list[0]).split(','))\n\n\nnew = []\nfor l in res:\n new.append([x.split('=') for x in l) \nnew\nA2 = [(element + [1])[:7] for element in new]\nA2\ndict(A2)\nTypeError: unhashable type: 'list'\n\n\nCan someone help me out with it?"
] | [
"python",
"list",
"dictionary"
] |
[
"Ember is not defined after minification",
"Trying to compile a Ember.js application using the brunch command: brunch b production\n\nWhen executing the public/index.html in a chrome, I'm told Ember is not defined. I've already seen jshint complains: 'Ember' is not defined\nbut that doesn't seem to be helping me.\n\nNot really sure what supporting information may be of help, but the app is live at http://reillyjoinery.acidic.co.nz/\n\nThis is my brunch config.js: http://pastebin.com/dYdveKpt"
] | [
"javascript",
"ember.js",
"brunch"
] |
[
"how to get max depth of a xsd using xsom\\dom\\jaxb?",
"how to get max depth of a xsd using xsom.\n\nFor e.g: total number of elements under each complex types of the xsd?\n\nAlso if as complex types is there under that complex types the number of element + attributes under that......using dom\\xsom\\jaxb\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" attributeFormDefault=\"unqualified\">\n <xs:element name=\"root\" type=\"root\">\n <xs:annotation>\n <xs:documentation>\n Comment describing your root element\n </xs:documentation>\n </xs:annotation>\n </xs:element>\n\n <xs:complexType name=\"root\">\n <xs:sequence>\n <xs:element name=\"element_count\" type=\"xs:string\"></xs:element>\n <xs:element name=\"employee\" type=\"employee\" maxOccurs=\"unbounded\" minOccurs=\"0\"></xs:element>\n </xs:sequence>\n </xs:complexType>\n\n <xs:complexType name=\"employee\">\n <xs:sequence>\n <xs:element name=\"name\" type=\"xs:string\"></xs:element>\n <xs:element name=\"ID\" type=\"xs:string\"></xs:element>\n <xs:element name=\"Addresses\" type=\"addresses\" maxOccurs=\"1\" minOccurs=\"0\"></xs:element>\n </xs:sequence>\n </xs:complexType>\n\n <xs:complexType name=\"addresses\">\n <xs:sequence>\n <xs:element name=\"address\" type=\"address\" maxOccurs=\"unbounded\" minOccurs=\"0\"></xs:element>\n </xs:sequence>\n </xs:complexType>\n\n <xs:complexType name=\"address\">\n <xs:sequence>\n <xs:element name=\"line1\" type=\"xs:string\"></xs:element>\n <xs:element name=\"line2\" type=\"xs:string\"></xs:element>\n <xs:element name=\"city\" type=\"xs:string\"></xs:element>\n <xs:element name=\"type\" type=\"xs:string\"></xs:element>\n </xs:sequence>\n </xs:complexType>\n</xs:schema>"
] | [
"java",
"xml",
"xsd",
"xsom"
] |
[
"how to completely remove gesture recognizers",
"I'm trying to remove three gesture recognizers attached to a uiscrollview. \n\nI list them using\n\nNSArray * activeScrollViewGRecs = [theScrollView gestureRecognizers];\nNSLog (@\"activeScrollViewGRecs count: %d\",[activeScrollViewGRecs count]);\n\n\nI get the three listed.\n\nThen I remove them with:\n\nfor (UIGestureRecognizer *recognizer in activeScrollViewGRecs)\n{\n NSLog (@\"recognizer: %@\",recognizer.description);\n recognizer.enabled = NO;\n [theScrollView removeGestureRecognizer:recognizer];\n}\n\n\nThen I list them again, and get a zero count. They should be gone/removed, right ?\nWhy would then the view continue to respond (and gesture methods getting called) to the same touches/swipes. Is there some kind of a \"flushing\" mechanism that needs to happen before they're gone for good ?\n\nthis is how they get created:\n\ntapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handle1:)];\ntapGesture.cancelsTouchesInView = NO; tapGesture.delaysTouchesEnded = NO; \ntapGesture.numberOfTouchesRequired = 2; tapGesture.numberOfTapsRequired = 2; \n[self.view addGestureRecognizer:tapGesture]; [tapGesture release];\n\nswipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handle2:)];\nswipeGesture.cancelsTouchesInView = NO; swipeGesture.delaysTouchesEnded = NO; swipeGesture.delegate = self;\nswipeGesture.direction = UISwipeGestureRecognizerDirectionLeft;\n[self.view addGestureRecognizer:swipeGesture]; [swipeGesture release];\n\n\nthanks"
] | [
"objective-c",
"ios",
"uigesturerecognizer"
] |
[
"Can't get custom response filter attribute to trigger",
"I get the request filter attribute to trigger but the response filter never does. What am I missing?\n\n[MyResponse]\n[MyRequest]\npublic class MyService : Service\n{\n public object Get(RequestDto request)\n {\n return new {foo = \"bar\"};\n }\n}\n\npublic class MyResponseAttribute : ResponseFilterAttribute\n{\n public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto)\n {\n var x = requestDto;\n }\n}\n\npublic class MyRequestAttribute : RequestFilterAttribute\n{\n public override void Execute(IHttpRequest req, IHttpResponse res, object responseDto)\n {\n var x = responseDto;\n }\n}"
] | [
"servicestack",
"filterattribute"
] |
[
"Speeding up Julia's poorly written R examples",
"The Julia examples to compare performance against R seem particularly convoluted. https://github.com/JuliaLang/julia/blob/master/test/perf/perf.R\n\nWhat is the fastest performance you can eke out of the two algorithms below (preferably with an explanation of what you changed to make it more R-like)?\n\n## mandel\n\nmandel = function(z) {\n c = z\n maxiter = 80\n for (n in 1:maxiter) {\n if (Mod(z) > 2) return(n-1)\n z = z^2+c\n }\n return(maxiter)\n}\n\nmandelperf = function() {\n re = seq(-2,0.5,.1)\n im = seq(-1,1,.1)\n M = matrix(0.0,nrow=length(re),ncol=length(im))\n count = 1\n for (r in re) {\n for (i in im) {\n M[count] = mandel(complex(real=r,imag=i))\n count = count + 1\n }\n }\n return(M)\n}\n\nassert(sum(mandelperf()) == 14791)\n\n## quicksort ##\n\nqsort_kernel = function(a, lo, hi) {\n i = lo\n j = hi\n while (i < hi) {\n pivot = a[floor((lo+hi)/2)]\n while (i <= j) {\n while (a[i] < pivot) i = i + 1\n while (a[j] > pivot) j = j - 1\n if (i <= j) {\n t = a[i]\n a[i] = a[j]\n a[j] = t\n }\n i = i + 1;\n j = j - 1;\n }\n if (lo < j) qsort_kernel(a, lo, j)\n lo = i\n j = hi\n }\n return(a)\n}\n\nqsort = function(a) {\n return(qsort_kernel(a, 1, length(a)))\n}\n\nsortperf = function(n) {\n v = runif(n)\n return(qsort(v))\n}\n\nsortperf(5000)"
] | [
"r",
"optimization",
"julia"
] |
[
"How do I get the active ChildWindow of an application?",
"I have this problem: I have an handler to the mainWindow of a certain application, and I want to simulate a keypress on that application...\n\nI'm using sendMessage/postMessage api calls to do this. The reason why I don't use the .Net SendKeys function or the keybd_event of the win32 api, is that they simulate the keypress at a global level. In my case, the target application is not the top-active one (other application may be running in a higher z-level, hence covering the target app).\n\nThe problem with sendMessage and postMessage is that you must pass the handler of the exact childwindow where you want the key to be pressed. For example, in notepad, if I send the key to the handler of the mainWindow, nothing happens, I have to send the key to the handler of the child window that basically consists of the white canvas where you can write.\n\nObtaining the handler to the active child window is the problem. In the beginning, I was using the GetTopWindow or GetWindow(GW_CHILD) api calls, as it returns the most active child window. What I was doing was to keep calling the GetWindow(GW_CHILD) until I got a childwindow that had no more childWindows. This works ok for some applications like notepad or paint. However, in some cases (like firefox for example), it doesn't work. The reason for that is that the parent window has the whole firefox area, and its childwindow has the opened WebPage (like google). So, when I ask for the most active child window of the mainWindow, it returns the only child window it has, which is the one corresponding to the Webpage area. It only works if the active window is that one (like if the user is writing something on a textbox of a certain page). But if what is active is, let's say, the address bar, it doesn't work because the active window is not the child window but actually the parent... and I can't get this information programatically.\n\nI actually found a way of doing this, using the GetGUIThreadInfo api call, using the following code:\n\n // get thread of the main window handle of the process\n var threadId = GetWindowThreadProcessId(firefox.MainWindowHandle, IntPtr.Zero);\n\n // get gui info\n var info = new GUITHREADINFO();\n info.cbSize = (uint)Marshal.SizeOf(info);\n if (!GetGUIThreadInfo(threadId, out info))\n throw new Win32Exception();\n\n // send the letter W to the active window\n PostMessage(info.hwndActive, WM_KEYDOWN, (IntPtr)Keys.W, IntPtr.Zero);\n\n\nAnd it works very well: If the address bar is active, it sends a \"W\" letter to the address bar. If the search textBox of google is active, it sends the \"W\" letter to it... Perfect! However, this method can't be used by me for a simple reason:\nIf the target application is not the active window of the operating system, the ThreadInfo structure comes empty. For example, if I'm targetting firefox, it works if firefox is active (the top-most application, the focused/active one), but if, let's say, notepad is on top of firefox, it doesn't work, it is unable to get the active window handler.\n\nI know I can solve this by using the setForegroundWindow api call to activate the target application and then capture the handler of the active child-window but I didn't want to have to bring the target app to the foreground.\n\nI've also tried other techniques like AttachThreadInput() and GetFocus() api calls, which also works, but has the same problem: If the target application is not the active windows application, it doesn't work.\n\nSo basically I need to find some way of getting the handler to the active childwindow of an application even if that application is not the top-active one.\n\nAny ideas?\nThanks"
] | [
"c#",
"winapi",
"user32",
"childwindow"
] |
[
"Shade section between two curves in JSXGraph",
"How can I shade the section between two curves in JSXGraph\nCurves Screenshot\n\nlet board = JSXGraph.createPlot({boundingbox: [-5,5,8,-2], axis: true, grid: true, zoom: {needShift: true}, pan: {needTwoFingers: true}});\nlet func1 = board.create('functiongraph', [(x) => {return 2 * x**2}, -5, 5], {name: 'f1'});\nlet func2 = board.create('functiongraph', [(x) => {return 3 + x**2}, -5, 5], {name: 'f2'});\n\n\nWhat I know is possible:\n\n\ngenerate then shade a polygon that approximates the curve\n\n\nhttps://groups.google.com/forum/#!searchin/jsxgraph/shade%7Csort:date/jsxgraph/h8yC0qSG3UE/ayGGps1JBgAJ\n\nshade the area between a function and the x-axis using integral\n\n\nhttps://jsxgraph.uni-bayreuth.de/docs/symbols/Integral.html\n\nthe shade circle intersections (but I don't understand how it works)\n\n\nhttps://jsxgraph.uni-bayreuth.de/wiki/index.php/Fill_the_intersection_area_of_two_circles"
] | [
"jsxgraph"
] |
[
"using the form helper for multilpe records",
"I have a table called specs. I need to edit multiple rows from it in one form and save it at once.\n\n// table structure\nspecs [id, name, value, owner_id]\n// controller part\n$data = $this->Spec->find('all'); // skipping the conditions and other sub-code\n$data = set::combine(...);\n/*\nresult, keyed using the spec[id] column.\narray (\n [3] = array(id=>...),\n [22] = array(id=>...)\n)\n*/\n\n\nNow I'm not sure how to continue.\nI know how to build a form ready to CREATE new multiple records(Model.{n}.fieldname), but how can i create an \"edit\" form that will allow the saveAll()?\n\ntrying to iterate through the result array gets the form close.. but i can't see the values of fields in the input elements.."
] | [
"cakephp-1.3",
"formhelper",
"multiple-records"
] |
[
"Sum in tree view odoo 9",
"I need sum row in tree view, and add where condition if is it possible!\n\nMy tree view:\n\nrow | field_1 | field_2\n\n1 | 8 | Messi\n\n2 | 8 | Messi\n\n3 | 8 | Ronaldo\n\n4 | 8 | Ronaldo\n\nHow sum only for Messi and only for Ronaldo and get result 16\n\nIn below span I get 32\n\n<span t-esc=\"sum(line.field_1 for line in doc.my_ids)\" widget=\"float_time\"/>\n\n\nAny solution?\n\n<span t-esc=\"Messi\"/> 16\n<span t-esc=\"Ronaldo\"/> 16"
] | [
"odoo",
"odoo-10",
"odoo-9",
"qweb"
] |
[
"X-Frame-Options: Post on Twitter from Facebook application",
"I want to be able to post on users Twitter feed from a Facebook app i'm developing at the moment but seem to be having trouble. When I call my the tmhOAuth PHP script to authenticate ask for permissions on Twitter I get the following error:\n\nRefused to display document because display forbidden by X-Frame-Options\n\n\nTmhOAuth works perfectly when its called directly from the browser. Its the header function that fails inside the Facebook iframe.\n\nAny idea whats going on?"
] | [
"php",
"facebook",
"twitter",
"x-frame-options"
] |
[
"ANTR error(208): The following token definition can never be matched because prior tokens match the same input:",
"I am new here and I am also new at ANTLR. I am getting this error for a long time and I couldn't find the reason for it. Please help me!!\n\nerror(208): MPL.g:16:1: The following token definition can never be matched because prior tokens match the same input: CHAR, IF, ELSIF, ELSE, THEN, PRINT \n\n grammar mpl;\nINT : ('0'..'9')+;\nFLOAT: ('0'..'9')+ '.' ('0'..'9')*;\nINTEGER : 'int';\nFLOT : 'float';\nCHARAC : 'char';\nBEGIN : 'begin';\nEND : 'end';\nVAR : ('a'..'z'|'A'..'Z')+('0'..'9')*;\nCHAR : ('a'..'z'|'A'..'Z')+;\nIF : 'if';\nELSIF : 'elsif';\nELSE : 'else';\nENDIF : 'end if';\nTHEN : 'then';\nPRINT : 'print';\nSEMICOLON: ';';\nCOLONS : ':';\nOPERATOR: ('+'|'-'|'*'|'/');\nRELATIONAL: ('=='|'<'|'>'|'>='|'<='|'!=');\nASSIGN: '=';\n\nprogram : BEGIN decleration* statement* END;\ndecleration : int|float|char;\nint : INTEGER COLONS (VAR(ASSIGN INT)?)+ SEMICOLON;\nfloat : FLOT COLONS (VAR(ASSIGN FLOAT)?)+ SEMICOLON;\nchar : CHARAC COLONS (VAR(ASSIGN CHAR)?)+ SEMICOLON;\n\nstatement : ifstatement|assign|print;\nstatement2: assign|print;\ncondition\n : identifier RELATIONAL identifier THEN;\nifstatement: IF condition\n statement2*\n (ELSIF condition statement2*)* (ELSE statement2*)? ENDIF SEMICOLON; \nidentifier: VAR|INT|FLOAT|CHAR;\nprint : PRINT identifier SEMICOLON;\nassign : VAR ASSIGN equation;\nequation: (VAR|INT|FLOAT|CHAR)| (VAR|INT|FLOAT|CHAR) OPERATOR (VAR|INT|FLOAT|CHAR);"
] | [
"antlr"
] |
[
"What is FTP ACCT command for?",
"The FTP protocol has quite some commands that can be used:\n\nABOR - abort a file transfer\nCWD - change working directory\nDELE - delete a remote file\nLIST - list remote files\nMDTM - return the modification time of a file\nMKD - make a remote directory\nNLST - name list of remote directory\nPASS - send password\nPASV - enter passive mode\nPORT - open a data port\nPWD - print working directory\nQUIT - terminate the connection\nRETR - retrieve a remote file\nRMD - remove a remote directory\nRNFR - rename from\nRNTO - rename to\nSITE - site-specific commands\nSIZE - return the size of a file\nSTOR - store a file on the remote host\nTYPE - set transfer type\nUSER - send username\n\n\nand\n\nACCT - send account information\nAPPE - append to a remote file\nCDUP - CWD to the parent of the current directory\nHELP - return help on using the server\nMODE - set transfer mode\nNOOP - do nothing\nREIN - reinitialize the connection\nSTAT - return server status\nSTOU - store a file uniquely\nSTRU - set file transfer structure\nSYST - return system type\n\n\nWhat I am interested in, is the ACCT command. Even tough it is not implemented in all FTP servers, it has to come from somewhere. What is its purpose?\n\nFrom RFC 959:\n\n ACCOUNT (ACCT)\n\n The argument field is a Telnet string identifying the user's\n account. The command is not necessarily related to the USER\n command, as some sites may require an account for login and\n others only for specific access, such as storing files. In\n the latter case the command may arrive at any time.\n\n There are reply codes to differentiate these cases for the\n automation: when account information is required for login,\n the response to a successful PASSword command is reply code\n 332. On the other hand, if account information is NOT\n required for login, the reply to a successful PASSword\n command is 230; and if the account information is needed for\n a command issued later in the dialogue, the server should\n return a 332 or 532 reply depending on whether it stores\n (pending receipt of the ACCounT command) or discards the\n command, respectively.\n\n\nThis does not help me much either. Anyone bother shedding some light into this? \n\nIs it just a possibility to pass a string to be matched on the server?\nI.e. to create groups which be be given different access rights or something?"
] | [
"ftp",
"protocols",
"rfc"
] |
[
"How do I uninstall node using nvm or how uninstall one version of nodejs?",
"I have two versions of node.js installed (10.16.3 and 12.14.1) I use nvm to switch between both. Please how do I uninstall version 10 successfully without affecting version 12?"
] | [
"node.js",
"nvm"
] |
[
"Including hidden data in an HTML page for javascript to process",
"I produce a complex HTML summary report from data in a database which could be a summary of maybe 200,000 rows in the database. The user can click a link to request an Excel version.\n\nWhen they do a JS script extracts the key components of the report and stuffs them into a form in a hidden iframe. This form submits to a server-side script which generates the Excel version of the report (without the graphics etc).\n\nAs the calculations for the report are complex and \"costly\" it makes sense not to run them again to create the Excel version as all the data is on the page already. Also the user may have customised the report once it is loaded and I can use JS to pass those preferences to the form as well so the Excel doc reflects them too.\n\nThe way I am doing this is to include the following for each component of the report that transfers to a row in the Excel version. I've hijacked an HTML tag that isn't otherwise used. \n\n <code id=\"xl_row_211865_2_x\" class=\"rowlabel\">Musicals}{40%}{28.6%}{6</code>\n\n\nThe code element above is a summary of the row below in the HTML report which becomes one row in the Excel doc and includes the label and various data elements. There may be a thousand or more such elements in one report. \n\n\n\nAs the data contains text I've had to use something like }{ as a field separator as this is unlikely to occur in any real text in the report. I have code set to display:none in the CSS.\n\nWhen the user wants an Excel version of their report the JS code searches the HTML for any <code> elements and puts their className and innerHTML in the form. The className indicates how to format the row in Excel and the data is then put into adjacent cells on the Excel row.\n\n\n\nThe HTML report shows one percentage base (they can toggle between them) but the user preference when requesting an Excel version was to include both.\n\nIs there a better way of doing this?\n\n(As this is a part of a complex web app no user is going to turn CSS off or lack javascript or they wouldn't get this far)\nADDED: I can't use HTML5 as the users are corporates often on older browsers like IE6"
] | [
"javascript",
"html",
"embed"
] |
[
"Github search by created",
"I am using the following link to search using curl. My intention is to get results which are sorted by creation.\n\nMy sample query is as follows:\n\ncurl 'https://api.github.com/search/repositories?q=arrow&sort=created' > results.txt\n\n\nWhen I search the 'results.txt', I get results which are not ordered by creation dates."
] | [
"curl",
"github-api"
] |
[
"Sends SMS link without a preview in messaging app",
"So, from what I've seen people have been doing dots to stop the site image preview:\n-'This is my message .https://mylink.com/.'\n\nNow this seems to work on iOS and it filters it, but on android google messaging app it doesn't work. I still get the previews.\nOn my note default messaging app it works, but it shows the dots. Any other good ideas to stop the preview.\n\nWe also shorten the link and track when someone clicks on it, so if it loads the preview it shows up as a click and the preview image sometimes we can't control, so we don't want to show it."
] | [
"android",
"ios",
"sms",
"twilio"
] |
[
"SQLITE TABLE Create error",
"I'm working off of an example to learn node.js/sqlite3, shown here: https://github.com/mapbox/node-sqlite3/blob/master/examples/simple-chaining.js\n\nIn the example, the table only has only column, and I wanted to extend it so the table has three columns--for username, password, and login count. \n\nSo I changed the original code, here:\n\nfunction createTable() {\n console.log(\"createTable lorem\");\n db.run(\"CREATE TABLE IF NOT EXISTS lorem (info TEXT)\", insertRows);\n}\n\n\nto this:\n\nfunction createTable() {\n console.log(\"createTable lorem\");\n db.run(\"CREATE TABLE IF NOT EXISTS lorem (info TEXT, name TEXT)\", insertRows);\n}\n\n\nbut when trying to fill it with values, I get an error: \n\n~:dev$ node chaining.js \ncreateDb chain\ncreateTable lorem\ninsertRows Ipsum i\n\nevents.js:72\n throw er; // Unhandled 'error' event\n ^\nError: SQLITE_ERROR: table lorem has 1 columns but 2 values were supplied\n~:dev$ \n\n\nAm I creating the table incorrectly? I referred to the SQLITE api, as well as W3schools, but none seem to indicate that I'm doing it incorrectly. \n\nI've provided my code below:\n\n/**\n * Shows how to use chaining rather than the `serialize` method.\n */\n\"use strict\";\n\nvar sqlite3 = require('sqlite3').verbose();\nvar db;\n\nfunction createDb() {\n console.log(\"createDb chain\");\n db = new sqlite3.Database('chain.sqlite3', createTable);\n}\n\n\nfunction createTable() {\n console.log(\"createTable lorem\");\n db.run(\"CREATE TABLE lorem (info TEXT, name TEXT)\", insertRows);\n}\n\nfunction insertRows() {\n console.log(\"insertRows Ipsum i\");\n var stmt = db.prepare(\"INSERT INTO lorem VALUES (?, ?)\");\n\n for (var i = 0; i < 10; i++) {\n stmt.run(\"Ipsum \" + i, \"lala \" + i);\n }\n\n stmt.finalize(readAllRows);\n}\n\nfunction readAllRows() {\n console.log(\"readAllRows lorem\");\n db.all(\"SELECT rowid AS id, info, name FROM lorem\", function(err, rows) {\n rows.forEach(function (row) {\n console.log(row.id + \": \" + row.info + \": \" + row.name);\n });\n closeDb();\n });\n}\n\nfunction closeDb() {\n console.log(\"closeDb\");\n db.close();\n}\n\nfunction runChainExample() {\n createDb();\n}\n\nrunChainExample();"
] | [
"javascript",
"sql",
"database",
"node.js",
"sqlite"
] |
[
"How to mount Docker container volumes to different path?",
"Container #1 runs with a volume defined for /data, and I'd like to use the run option --volumes-from to mount this volume to another container, but I'd like to change the path for the second container.\n\nIn other words /data from container #1 should be mounted to /custom/data inside container #2.\n\nIs that possible? Is there a solution for this?\n\nThanks!"
] | [
"docker",
"lxc"
] |
[
"Upload a file to s3 bucket with REST API",
"Doing this with S3 SDK makes it simple. But want to go with S3 REST API(Read some advantages with this). \n\nI have gone through with S3 API documentation and find difficult to code using it. I am totally new to this type of coding wherein it uses Request Parameters, Request Headers, Response Headers, Authorization, Error Codes, ACL etc. It also provided sample examples but could not find a way how to use those examples and do coding.\n\nCan any one help where to start and end so that I can code for all CRUD operations on S3 using API. An example for uploading image file will helps me in better understanding."
] | [
"java",
"amazon-s3"
] |
[
"Adding class to Opencart action file",
"Actually I am trying to add class (Controllerjournal3flashsale) to action.php I want this class because I am using dynamic block from journal 3 theme and it's not working when i add block under layout it's showing only that dynamic block content instead of showing rest of the page content together. I tried so many ways but giving error:\n\nError is:\n\nFatal error: Uncaught Error: Class 'Controllerjournal3flashsale' not found in /home/mywebsite/storage_aelive/modification/system/engine/action.php:71 Stack trace: #0 /home/mywebsite/storage_aelive/modification/system/engine/loader.php(27): Action->execute(Object(Registry), Array) #1 /home/mywebsite/public_html/catalog/controller/journal3/blocks.php(133): Loader->controller('journal3/flash_...', Array) #2 /home/mywebsite/public_html/live/library/journal3/opencart/modulecontroller.php(149): ControllerJournal3Blocks->beforeRender() #3 /home/mywebsite/public_html/catalog/controller/journal3/blocks.php(18): Journal3\\Opencart\\ModuleController->index(Array) #4 /home/mywebsite/storage_aelive/modification/system/engine/action.php(79): ControllerJournal3Blocks->index(Array) #5 \n/home/mywebsite/storage_aelive/modification/system/engine/loader.php(27): Action->execute(Object(Registry), Array) #6 \n/home/mywebsite/public_html/live/library/journal3/opencart/controller.php(112): Loader->controller('journal3/blocks', Array) #7 /home/clearan in /home/mywebsite/storage_aelive/modification/system/engine/action.php on line 71\n\n\nAnd the action.php file code is here:\n\nclass Action {\n private $id;\n private $route;\n private $method = 'index';\n\n /**\n * Constructor\n *\n * @param string $route\n */\n public function __construct($route) {\n $this->id = $route;\n\n $parts = explode('/', preg_replace('/[^a-zA-Z0-9_\\/]/', '', (string)$route));\n\n // Break apart the route\n while ($parts) {\n $file = DIR_APPLICATION . 'controller/' . implode('/', $parts) . '.php';\n\n if (is_file($file)) {\n $this->route = implode('/', $parts); \n\n break;\n } else {\n $this->method = array_pop($parts);\n }\n }\n }\n\n /**\n * \n *\n * @return string\n *\n */ \n public function getId() {\n return $this->id;\n }\n\n /**\n * \n *\n * @param object $registry\n * @param array $args\n */ \n public function execute($registry, array $args = array()) {\n // Stop any magical methods being called\n if (substr($this->method, 0, 2) == '__') {\n return new \\Exception('Error: Calls to magic methods are not allowed!');\n }\n\n $file = DIR_APPLICATION . 'controller/' . $this->route . '.php'; \n $class = 'Controller' . preg_replace('/[^a-zA-Z0-9]/', '', $this->route);\n\n // Initialize the class\n if (is_file($file)) {\n include_once(modification($file));\n\n $controller = new $class($registry);\n } else {\n return new \\Exception('Error: Could not call ' . $this->route . '/' . $this->method . '!');\n }\n\n $reflection = new ReflectionClass($class);\n\n if ($reflection->hasMethod($this->method) && $reflection->getMethod($this->method)->getNumberOfRequiredParameters() <= count($args)) {\n return call_user_func_array(array($controller, $this->method), $args);\n } else {\n return new \\Exception('Error: Could not call ' . $this->route . '/' . $this->method . '!');\n }\n }\n}"
] | [
"php",
"opencart",
"journal"
] |
[
"How to move table row in jQuery?",
"Say I had links with up/down arrows for moving a table row up or down in order. What would be the most straightforward way to move that row up or down one position (using jQuery)?\n\nThere doesn't seem to be any direct way to do this using jQuery's built in methods, and after selecting the row with jQuery, I haven't found a way to then move it. Also, in my case, making the rows draggable (which I have done with a plugin previously) isn't an option."
] | [
"javascript",
"jquery",
"html",
"dom"
] |
[
"Facebook login button showing after 1 second page loaded",
"I am trying to learn Facebook login and find how can I integrate to a asp.net MVC project. First, I am trying to learn in normal html version in my website I used Facebook login button from docs. But when my page loaded it takes 1 or 2 seconds to show my Facebook button. How can I solve this problem. My code is:\n\n<!DOCTYPE html>\n<html>\n<head>\n<title>Facebook Login JavaScript </title>\n<meta charset=\"UTF-8\">\n<body>\n<script>\n\n window.fbAsyncInit = function() {\n FB.init({\n appId : '2194615170807288',\n autoLogAppEvents : true,\n xfbml : true,\n version : 'v3.2'\n });\n // FB.getLoginStatus(function(response) {\n // statusChangeCallback(response);\n // });\n };\n\n (function(d, s, id) {\n var js, fjs = d.getElementsByTagName(s)[0];\n if (d.getElementById(id)) return;\n js = d.createElement(s); js.id = id;\n js.src = 'https://connect.facebook.net/tr_TR/sdk.js#xfbml=1&version=v3.2&appId=2194615170807288';\n fjs.parentNode.insertBefore(js, fjs);\n}(document, 'script', 'facebook-jssdk'));\n\n function checkLoginState() {\n FB.getLoginStatus(function(response) {\n statusChangeCallback(response);\n });\n }\n\n function statusChangeCallback(response) {\n // The response object is returned with a status field that lets the\n // app know the current login status of the person.\n // Full docs on the response object can be found in the documentation\n // for FB.getLoginStatus().\n if (response.status === 'connected') {\n // Logged into your app and Facebook.\n FB.api('/me?fields=id,first_name,last_name,email', function(response) {\n document.getElementById(\"fname\").value = response.first_name;\n document.getElementById(\"lname\").value = response.last_name; \n document.getElementById(\"email\").value = response.email; \n });\n } \n else {\n document.getElementById(\"fname\").value =\"\";\n document.getElementById(\"lname\").value =\"\"; \n document.getElementById(\"email\").value =\"\"; \n }\n }\n</script>\n<div>\n <form>\n First name:<br>\n <input type=\"text\" name=\"firstname\" id=\"fname\"><br>\n Last name:<br>\n <input type=\"text\" name=\"lastname\" id=\"lname\"><br>\n Mail:<br>\n <input type=\"text\" name=\"mail\" id=\"email\"><br>\n </form>\n\n</div>\n<div class=\"fb-login-button\" data-max-rows=\"1\" data-size=\"large\" data-button-type=\"continue_with\" data-show-faces=\"false\" data-auto-logout-link=\"false\" data-use-continue-as=\"true\" scope=\"public_profile,email\" auth_type=\"rerequest\" onlogin=\"checkLoginState();\"></div>\n\n<fb:login-button scope=\"public_profile,email\" auth_type=\"rerequest\" onlogin=\"checkLoginState();\">\n</fb:login-button>\n\n</body>\n</html>"
] | [
"javascript",
"facebook",
"facebook-javascript-sdk",
"facebook-sdk-4.0"
] |
[
"Installing drivers to another windows",
"I have one drive (C:\\) with Windows 2008. Is that possible to install drivers to this Windows while booting from WinPE (another OS)? I couldn't find any software to do this.\nSo what I'm trying to do is install drivers to one Windows while booting from another Windows on separate disks."
] | [
"windows",
"driver",
"winpe"
] |
[
"Absolutely positioned child overflow parents borders",
"I have an absolutely positioned (child) element in a relative (parent) container. I want the absolutely positioned element to span the entire width of its container, including padding and borders.\n\nThe border/padding may be different sizes, so I do not want to hardcode an offset.\n\nIs such a thing possible?\n\n<div>\n <ul>\n <li>Test</li>\n <li>Test 2</li>\n <li>Test 3</li>\n </ul>\n</div>\n\n\nul {\n position: absolute;\n left: 0;\n right: 0;\n background-color: red;\n border-bottom: 3px solid blue;\n}\n\n\nHere's a JSFiddle outlining the issue"
] | [
"css",
"position",
"css-position"
] |
[
"Installing Python module with pip",
"I'm trying to install a module called Scrapy. I installed it using\n\npip install Scrapy\n\n\nI see the 'scrapy' folder in my /usr/local/lib/python2.7/site-packages, but when I try to import it in a Python program, is says there is no module by that name. Any ideas as to why this might be happening?\n\nEDIT: Here is the output of the pip command: \n\n Downloading/unpacking Scrapy\n Downloading Scrapy-0.20.0.tar.gz (745kB): 745kB downloaded\n Running setup.py egg_info for package Scrapy\n\n no previously-included directories found matching 'docs/build'\nRequirement already satisfied (use --upgrade to upgrade): Twisted>=10.0.0 in /usr/local/lib/python2.7/site-packages (from Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): w3lib>=1.2 in /usr/local/lib/python2.7/site-packages (from Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): queuelib in /usr/local/lib/python2.7/site-packages (from Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): lxml in /usr/local/lib/python2.7/site-packages (from Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /usr/local/lib/python2.7/site-packages (from Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /usr/local/lib/python2.7/site-packages (from Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): zope.interface>=3.6.0 in /usr/local/lib/python2.7/site-packages (from Twisted>=10.0.0->Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/local/lib/python2.7/site-packages (from w3lib>=1.2->Scrapy)\nRequirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg (from zope.interface>=3.6.0->Twisted>=10.0.0->Scrapy)\nInstalling collected packages: Scrapy\n Running setup.py install for Scrapy\n changing mode of build/scripts-2.7/scrapy from 644 to 755\n\n no previously-included directories found matching 'docs/build'\n changing mode of /usr/local/bin/scrapy to 755\nSuccessfully installed Scrapy\nCleaning up...\n\n\nWhen I run /usr/local/bin/scrapy I get the usage for the command and the available commands. I noticed that I have a python2.7 and python2.7-32 in my /usr/local/bin, and I remember installing the 32 bit version because of a problem with Mavericks. \n\nHere is the output of python /usr/local/bin/scrapy:\n\nTraceback (most recent call last): File \"/usr/local/bin/scrapy\", line 3, in <module> from scrapy.cmdline import execute ImportError: No module named scrapy.cmdline \n\n\nAnd head /usr/local/bin/scrapy:\n\n#!/usr/local/opt/python/bin/python2.7 from scrapy.cmdline import execute execute()"
] | [
"python",
"import",
"module",
"scrapy"
] |
[
"Django : How to filter users with username__iexact by default?",
"Implementing username case-insensitive :\n\nI want to implicitly imply iexact when querying for user :\n\nuser = User.objects.get(username = 'yugal') # Lowercase\nuser.id # 1\n\nuser = User.objects.get(username = 'YUgal') # Mixcase\nuser.id # 1\n\n\nHow can I achieve this ? { somehow with UserManager }\n\nNote:\n\n\nAlso, django.shortcuts.get_object_or_404 seems to use it as User.objects.get_query_set().all().get(). How can we make it work ?"
] | [
"python",
"django",
"orm"
] |
[
"How to change the colour of a Button(Material UI) upon setting it as disabled dynamically?",
"I have a button in a React table which gets disabled based on the value in an adjacent column.\nFor example, if the value in the adjacent column is Claimed, then the button gets disabled, however if it has the value Failed or is blank, the button can be clicked.\nRight now, Im able to disable button..however the color of the button isnt changing. Im using Material UI React components for the button.\nHow to change the colour of the button when its disabled? \n\nThe code is as shown below:\n\n <FlatButton\n label=\"CLAIM\"\n disabled={\n item.status === \"Claimed\" ||\n item.status === \"Progress\" ||\n item.status === \"Resolved\"\n }\n onClick={//Some action here}\n labelStyle= {\n {\n color: '#FFFFFF',\n fontWeight: 600,\n fontSize: 11,\n }}\n style= {\n {\n borderRadius: '2px',\n width: '60px',\n border: 'solid 1px #d8dde3',\n backgroundColor: '#00bfa5',\n }}"
] | [
"javascript",
"reactjs",
"button",
"material-ui"
] |
[
"addArrangedSubview and resizing the StackView",
"I'm trying to add view to a StackView with a button:\n\nimport UIKit\n\nclass ViewController: UIViewController {\n\n @IBOutlet weak var stackOutlet: UIStackView!\n @IBOutlet weak var buttonOutlet: UIButton!\n\n override func viewDidLoad() {\n super.viewDidLoad()\n // Do any additional setup after loading the view, typically from a nib.\n }\n\n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n // Dispose of any resources that can be recreated.\n }\n\n @IBAction func buttonAction(_ sender: AnyObject) {\n let newView = UIView(frame: CGRect(x: 0, y: 0, width: 240, height: 128))\n newView.heightAnchor.constraint(equalToConstant: 128)\n newView.widthAnchor.constraint(equalToConstant: 240)\n newView.backgroundColor = UIColor.green\n\n stackOutlet.addArrangedSubview(newView)\n stackOutlet.heightAnchor.constraint(equalToConstant: stackOutlet.frame.size.height + 128)\n print(stackOutlet.subviews.count)\n }\n}\n\n\nThe number of subviews is increasing, but nothing is changing on the screen. I suspect that my StackView doesnt resize properly right ?"
] | [
"ios",
"swift",
"uistackview"
] |
[
"How to capture $false in ValidateScript()",
"I have a function that validates user input and it works as expected. Returns $true when correct and Throws an error when not.\n\nSince I would like to return the results (True and False) to be used elsewhere, Is it possible to capture $false from ValidateScript()?\n\nTried various operations like if/else and tried searching but did not find anything relevant.\n\nfunction Check-Input-ShareName {\n [CmdletBinding()]\n Param(\n [Parameter(Mandatory)]\n [ValidateNotNullOrEmpty()] \n [ValidateScript({\n if ($_ -match '(?=^[a-zA-Z].{3,30}$)(?![_-].+)(?!.+[_-]$)(?!.*[_-]{2,})[^<>[\\]{}|\\\\\\/^~%# :;_,$@%*?\\0-\\cZ]+$') {\n $true\n } else {\n #Throw \"$_ is invalid Share Name.\" this works and throws error when I uncomment\n $false\n }\n })]\n [string]$ShareName\n )\n\n Process {\n if ($true) {\n Write-Host 'True'\n return $ShareName\n }\n\n if ($false) {\n Write-Host 'True'\n return 'invalid'\n }\n\n\nI would like if its false to return false so I can take action on that elsewhere."
] | [
"powershell-4.0"
] |
[
"Pandas Dataframe or Panel to 3d numpy array",
"Setup:\n\npdf = pd.DataFrame(np.random.rand(4,5), columns = list('abcde'))\npdf['a'][2:]=pdf['a'][0]\npdf['a'][:2]=pdf['a'][1]\npdf.set_index(['a','b'])\n\n\noutput:\n\n c d e\na b \n0.439502 0.115087 0.832546 0.760513 0.776555\n 0.609107 0.247642 0.031650 0.727773\n0.995370 0.299640 0.053523 0.565753 0.857235\n 0.392132 0.832560 0.774653 0.213692\n\n\nEach data series is grouped by the index ID a and b represents a time index for the other features of a. Is there a way to get the pandas to produce a numpy 3d array that reflects the a groupings? Currently it reads the data as two dimensional so pdf.shape outputs (4, 5). What I would like is for the array to be of the variable form:\n\narray([[[-1.38655912, -0.90145951, -0.95106951, 0.76570984],\n [-0.21004144, -2.66498267, -0.29255182, 1.43411576],\n [-0.21004144, -2.66498267, -0.29255182, 1.43411576]],\n\n [[ 0.0768149 , -0.7566995 , -2.57770951, 0.70834656],\n [-0.99097395, -0.81592084, -1.21075386, 0.12361382]]])\n\n\nIs there a native Pandas way to do this? Note that number of rows per a grouping in the actual data is variable, so I cannot just transpose or reshape pdf.values. If there isn't a native way, what's the best method for iteratively constructing the arrays from hundreds of thousands of rows and hundreds of columns?"
] | [
"python",
"numpy",
"pandas"
] |
[
"How to use a variable in filename",
"I am trying to use the current date & time as a file name for my spreadsheet file but I keep on getting the error \"no such file or directory exists.\"\nBelow is the code that I tried to use:\n\nwb = Workbook()\ndest_filename = time.strftime(\"%d/%m/%Y_%H:%M.xlsx\")\nwb.save(filename = dest_filename)"
] | [
"python"
] |
[
"Python twtter-bot hosting?",
"I built a python weather using tweepy and it works fine but it needs me to run the script with my computer.\nHow can I deploy my python script on a 'server' or something so I don't need to run the script 24/7 on my laptop ?\nThanks for help !"
] | [
"python",
"hosting",
"tweepy"
] |
[
"MySQL JOIN Statement to filter rows by selected linked attributes",
"lets say i have the following two MySQL-Tables:\n\nitem: _ID,_CAT_ID,...\n\nitem_attribute:\n _ID,_ITEM_ID,...\n\ni want to (filter items) get ONLY items which have ALL selected attributes (1,32,555,...an array of selected attributes )\n\nsomething like this:\n\nSELECT _I.* \nFROM item _I\nINNER JOIN item_attribute _IA\nON (_I._ID = _IA._ITEM_ID AND (_IA._ID=1 OR _IA._ID=132, ...))\nWHERE _I._CAT_ID=? ORDER BY _I._LAST_UPDATE ASC;\"\n\n\nthis \"wrong\" statement returns items when one(due to OR) of the linked ids found, what i want is: only items which have all linked attributes.\n\nif i change \n\n(_IA._ID=1 OR _IA._ID=132 OR...) \n\n\nto \n\n(_IA._ID=1 AND _IA._ID=132 AND ...)\n\n\nno matches and this makes sense, but how to rewrite the statement to get correct matches?\n\nUPDATE:\n\nhere is a sqlfiddle: http://sqlfiddle.com/#!9/0f8ebe/6\n\nCREATE TABLE item\n (`id` int, `pid` int, `name` varchar(55))\n;\n\nINSERT INTO item\n (`id`, `pid`, `name`)\nVALUES\n (1, 2, 'A'),\n (2, 2, 'B'),\n (3, 2, 'C')\n;\nCREATE TABLE att\n (`id` int, `pid` int, `name` varchar(55))\n;\n\nINSERT INTO att\n (`id`, `pid`, `name`)\nVALUES\n (7, 1, 'red'),\n (7, 3, 'red'),\n (2, 1, '30cm'),\n (1, 3, '40cm'),\n (5, 2, 'blue'),\n (1, 2, '40cm')\n;\nSELECT * \nFROM item;\n\nSELECT * \nFROM att;\n\n/* expected: items which are red AND 40cm, result should be then only item C (id=3)*/\n\nSELECT _I.name \nFROM item _I\nINNER JOIN att _IA\nON (_I.id = _IA.pid AND (_IA.id=7 AND _IA.id=1))\nWHERE _I.pid=2 GROUP BY _I.id;\n\n\nSOLUTION http://sqlfiddle.com/#!9/0f8ebe/8 (using Drews Answer):\n\nSELECT _I.name,count(_IA.id) as theCount \nFROM item _I\nINNER JOIN att _IA\nON (_I.id = _IA.pid) AND _IA.id in (7,1)\nWHERE _I.pid=2\ngroup by _I.id\nhaving theCount=2"
] | [
"mysql",
"join"
] |
[
".htaccess to defined routing for php system",
"i have a php based system that uses this setup at the moment\n\n.htaccess\n\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteCond %{REQUEST_URI} !^/index.php \nRewriteRule ^(.*)$ index.php?route=$1 [L,QSA]\n\n\nPHP\n\n<?php\n$route = explode('/',(isset($_GET[\"route\"]))? $_GET[\"route\"]:\"home\");\n...\nsome other stuff based on route parts\n...\n$route = implode(\"/\", $route);\n... \n#load content\ninclude(includes/$route/index.php);\n\n\nand this sends and request to route so \n\ndomain.net/this/is/the/page => route = this/is/the/page\ndomain.net/this/page => route = this/page\ndomain.net/page => route = page\n\n\nand then from this php will load a file from the includes folder and that controls the content of the system.\n\n$route = this/is/the/page => loads => includes/this/is/the/page/index.php\n$route = this/page => loads => includes/this/page/index.php\n$route = page => loads => includes/page/index.php\n\n\nand so on this works great for my system but i have had thoughts on expanding this more dynamically so if i want dynamic duplicate of it i can just create a new includes folder sort of thing\n\nso my question to the wonderful people of StackOverflow how can i go about this my thinking of it is \n\ndomain.net/{copy}/{this/is/the/page}\n//would output this\n$server = copy;\n$route = this/is/the/page\n\ndomain.net/{copy2}/{this/page}\n//would output this\n$server = copy2;\n$route = this/is/the/page\n\ndomain.net/{copy2}/{this/page}\n//would output this\n$server = copy2;\n$route = this/page \n\ndomain.net/{copy2}/{page}\n//would output this\n$server = copy2;\n$route = page\n\n\nso the first one is say $server and all trailing after that is the path $route\n\ndomain.net/[server]/[path/to/file]\n\n\nthus making managing the system with multiple versions of it easier for me.\n\nother than that all i can think of is just making a new domain and copying it to that domain location and just make all the adjustments needed for that version of it for the client.\n\nam i just thinks crazy or can this be done."
] | [
"php",
".htaccess",
"url-rewriting"
] |
[
"Why is string.Split(';') valid but string.Split(':',StringSplitOptions.RemoveEmptyEntries) is not?",
"I'm confused which overload string.Split(';') is resolving to; I don't think ';' is a char array is it?\n\nHowever, this is compiling OK but if I try to add a 2nd StringSplitOptions parameter no appropriate overload is found.\n\nI don't like having to do new char []{';'} is it avoidable?"
] | [
"c#",
".net",
".net-4.0"
] |
[
"custom buttons on uiwebview(iphone)",
"I want to add custom button on webView. they should also should be there when i try anything in url.\n\nhow is it possible?? \n\nbasically i want to put buttons on uiwebView and they are custom buttons\n\n//edited code... \n\nI am doing this...here link is appearing but method is not getting called...and there wasnot any error in your code ..:)\n\nNSString *imagePath = [[NSBundle mainBundle] resourcePath];\nimagePath = [imagePath stringByReplacingOccurrencesOfString:@\"/\" withString:@\"//\"];\nimagePath = [imagePath stringByReplacingOccurrencesOfString:@\" \" withString:@\"%20\"];\n\nNSString *HTMLData = @\"<html<a href=\\\"button://dosomething\\\" class=\\\"buttonStyle\\\">Click me!</a>--></style><br><br>\";\n\n[webView loadHTMLString:HTMLData baseURL:[NSURL URLWithString: [NSString stringWithFormat:@\"file:/%@//\",imagePath]]];\n\n\nand then\n\n- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType \n{\n // only do something if a link has been clicked...\n if (navigationType == UIWebViewNavigationTypeLinkClicked) { \n\n // check if the url requests starts with our custom protocol:\n if ([[[request URL] absoluteString] hasPrefix:@\"button://\"]) {\n // Do custom code\n return NO;\n } \n }\n return YES;\n}"
] | [
"iphone",
"objective-c",
"ios",
"uiwebview"
] |
[
"Bulk data call using RXJS in nodejs",
"I want to send a bulk of data and after completing it, want to move to the next one. For example: \nI have this function: \n\nasync function test() {\n await sample.sampleStructure()\n await sample.sampleDataAdd()\n await sample.sampleDataGet()\n}\n\n\nWhere I am calling the 3 functions for each call. But I wanted to send for example 200 data for await sample.sampleDataAdd() and if the first 200 data response is 'Success' then it will send the rest of the 200 datas. After completing 1000 datas, I want to move on to the next function call.\nSo I looked and I think RXJS can provide the solution. But I am not use if is it possible to use the filter and next for this scenario. \n\nasync function test() {\n await sample.sampleStructure()\n // let observable = Observable.range(1,1000)\n let observable = Observable.create()\n observable\n .filter(aysnc function () {\n await sample.sampleDataAdd()\n })\n .subscribe({\n .next: async function () {\n // await sample.sampleDataAdd()\n },\n .error: function (error) {\n console.log(error)\n }\n })\n\n\nI am very new at rxjs, so there are lots of mistakes as well. Please can anyone help me regarding this matter ?"
] | [
"javascript",
"node.js",
"rxjs",
"rxjs6",
"rxjs-observables"
] |
[
"rake assets:precompile cannot load such file -- uglifier error",
"I want to run my application in production mode, when I pre-compile my assets using following command \n\nRAILS_ENV=production bundle exec rake assets:precompile\n\n\nI am getting following error:\n\nMYPCC:/media/New Volume/Rails$ RAILS_ENV=production bundle exec rake assets:precompile\n/home/.rvm/rubies/ruby-1.9.3-p448/bin/ruby /home/.rvm/gems/ruby-1.9.3-p448@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets\n rake aborted!\n cannot load such file -- uglifier\n (in /media/New Volume/Rails/app/assets/javascripts/application.js)\n /home/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in `load_dependency'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.1.1/lib/sprockets/bootstrap.rb:45:in `expand_js_compressor'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.1.1/lib/sprockets/bootstrap.rb:18:in `block in run'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.1.1/lib/sprockets/compressors.rb:14:in `call'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.1.1/lib/sprockets/compressors.rb:14:in `compressor'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.1.1/lib/sprockets/compressors.rb:18:in `compress'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/sprockets-2.0.4/lib/sprockets/processing.rb:265:in `block in js_compressor='\n /home/.rvm/gems/ruby-1.9.3-p448/gems/sprockets-2.0.4/lib/sprockets/processor.rb:29:in `call'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/sprockets-2.0.4/lib/sprockets/processor.rb:29:in `evaluate'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'\n /home/.rvm/gems/ruby-1.9.3-p448/gems/sprockets-2.0.4/lib/sprockets/context.rb:175:in `block in evaluate'\n\n\nMy Gemfile contains:\n\ngroup :assets do\n gem 'therubyracer'\n gem 'sass-rails', \" ~> 3.1.0\"\n gem 'coffee-rails', \"~> 3.1.0\"\n gem 'uglifier'\nend\n\n\nRun\n\nbundle install\n\n\nPlease suggest.."
] | [
"ruby-on-rails",
"ruby",
"ruby-on-rails-3",
"passenger"
] |
[
"PHP Google Search Console API Add Link",
"When I looked "https://console.developers.google.com/apis", "https://developers.google.com/webmaster-tools/search-console-api-original/v3/libraries" and "https://github.com/googleapis/google-api-php-client", I didn't understand anything.\nHow can I add my sitelinks to Google Search Console with PHP?\nFor example:\n\nhttps://wwww.lipsum.com/my-post-1\nhttps://wwww.lipsum.com/my-post-4\nhttps://wwww.lipsum.com/my-post-7\n\nHow do I add these links to Search Console with PHP? Can you tell me that code?\nThank you."
] | [
"php",
"api",
"google-search-console"
] |
[
"Public entity properties in zend 2 documentation - is it good?",
"I was writing app with zend 2 framework. I had not worked with it, some time ago done small app maybe with zend 1.\n\nI see what is not usual to me - public properties. I thought this is bad. But zend is showing such examples:\n\nnamespace Album\\Model;\n\n class Album\n {\n public $id;\n public $artist;\n public $title;\n\n public function exchangeArray($data)\n {\n $this->id = (!empty($data['id'])) ? $data['id'] : null;\n $this->artist = (!empty($data['artist'])) ? $data['artist'] : null;\n $this->title = (!empty($data['title'])) ? $data['title'] : null;\n }\n }\n\n\nhttps://framework.zend.com/manual/2.3/en/user-guide/database-and-models.html\n\nIs is good for this case? Why?"
] | [
"oop",
"zend-framework2"
] |
[
"Resize Breaks Page Layout",
"I've set jQuery's accordion ui widget to fill space and resize on demand. Whenever the resize takes place, the accordion cuts through the page footer, which I've 'fixed' to the bottom of the page. I've also tried setting the footer to: #footer {position: absolute; bottom: 0; } but on resize the footer moves nearly to the middle of the page. Does anyone have any ideas/suggestions on how I can handle the resize so the newly sized accordion does NOT pass through the footer?"
] | [
"javascript",
"jquery",
"css",
"jquery-ui"
] |
[
"not equal condition does not work in javascript",
"Does anybody have an idea why the following condition does not work in javascript?\n\nif ($(this).is(':checked') && this.name != 'AllgS') {\n $('#'+this.name+'colors').show('slow');\n} \nelse {\n $('#'+this.name+'colors').hide('slow');\n}\n\n\nThe second condition is not excepted, but I don't get an error message.\nUsing \n\nif ($(this).is(':checked') && this.name == 'AllgS') {\n $('#'+this.name+'colors').show('slow');\n} \nelse {\n $('#'+this.name+'colors').hide('slow');\n} \n\n\nworks...\n\nEDIT: \nthe whole function is \n\n$('.Kennzahl').click(function(){\n if ($(this).is(':checked') && this.name != 'AllgS') {$('#'+this.name+'colors').show('slow');} else {$('#'+this.name+'colors').hide('slow');}\n if ($(this).is(':checked') && this.name == 'AllgS') {$('#'+this.name+'colors').show('slow');} \n else {\n if ($('#AllgS').prop('checked') == false && $('#BerufS').prop('checked') == false)\n $('#'+this.name+'colors').hide('slow');\n else {}\n }\n\n });"
] | [
"javascript",
"conditional-statements"
] |
[
"Rails 4 + Datatables: Ajax-datatables-rails gem will not update table",
"I am trying to use the ajax-datatables-rails gem found here with no luck. My table shows up, and has the right data (for the first page), but when I attempt to search, sort, or change pages, no table data gets updated. \n\nAm I missing something simple?\n\nView\n\n<table id=\"users-table\" data-source=\"<%= users_path(format: :json) %>\">\n <thead>\n <tr>\n <th>ID</th>\n <th>Name</th>\n <th>Email</th>\n <th>Admin?</th>\n <th>Employee?</th>\n <th>Client?</th>\n </tr>\n </thead>\n <tbody>\n </tbody>\n</table>\n\n\nController\n\ndef index\n respond_to do |format|\n format.html \n format.json { render json: UserDatatable.new(view_context) }\n end\nend\n\n\nDatatable\n\nclass UserDatatable < AjaxDatatablesRails::Base\n # uncomment the appropriate paginator module,\n # depending on gems available in your project.\n # include AjaxDatatablesRails::Extensions::Kaminari\n include AjaxDatatablesRails::Extensions::WillPaginate\n # include AjaxDatatablesRails::Extensions::SimplePaginator\n\n def sortable_columns\n # list columns inside the Array in string dot notation.\n # Example: 'users.email'\n @sortable_columns ||= [\n 'users.id', \n 'users.name',\n 'users.email',\n 'users.admin',\n 'users.employee',\n 'users.is_client'\n ]\n end\n\n def searchable_columns\n # list columns inside the Array in string dot notation.\n # Example: 'users.email'\n @searchable_columns ||= [\n 'users.id', \n 'users.name',\n 'users.email',\n 'users.admin',\n 'users.employee',\n 'users.is_client'\n ]\n end\n\n private\n\n def data\n records.map do |record|\n [\n # comma separated list of the values for each cell of a table row\n # example: record.attribute,\n record.id, \n record.name, \n record.email, \n record.admin, \n record.employee, \n record.is_client\n ]\n end\n end\n\n def get_raw_records\n # insert query here\n User.all\n end\n\n # ==== Insert 'presenter'-like methods below if necessary\nend\n\n\njs\n\n$('#users-table').dataTable({\n \"processing\": true,\n \"serverSide\": true,\n \"ajax\": $('#users-table').data('source')\n \"pagingType\": \"full_numbers\"\n // optional, if you want full pagination controls.\n // Check dataTables documentation to learn more about\n // available options.\n});"
] | [
"jquery",
"ruby-on-rails",
"ruby",
"ajax",
"datatable"
] |
[
"Read and copy specific chunks of text in python",
"I have seen several similar questions on SO (copying trigger lines or chunks of definite sizes), but they don't quite fit to what I'm trying to do. I have a very large text file (output from Valgrind) that I'd like to cut down to only the parts I need.\n\nThe structure of the file is as follows: they are blocks of lines that start with a title line containing the string 'in loss record'. I want to trigger only on those title lines that also contain the string 'definitely lost', then copy all the lines below until another title line is reached (at which point the decision process is repeated).\n\nHow can I implement such a select-and-copy script in Python?\n\nHere's what I've tried so far. It works, but I don't think is the most efficient (or pythonic) way of doing it, and so I'd like to see faster approaches, as the files I'm working with are usually quite large. (This method takes 1.8s for a 290M file)\n\nwith open(\"in_file.txt\",\"r\") as fin:\nwith open(\"out_file.txt\",\"w\") as fout: \n lines = fin.read().split(\"\\n\")\n i=0\n while i<len(lines):\n if \"blocks are definitely lost in loss record\" in lines[i]:\n fout.write(lines[i].rstrip()+\"\\n\")\n i+=1\n while i<len(lines) and \"loss record\" not in lines[i]:\n fout.write(lines[i].rstrip()+\"\\n\")\n i+=1\n i+=1"
] | [
"python",
"regex",
"file-io"
] |
[
"Querying Azure Storage - Code issues",
"I am having a problem with the first few lines of code that setup an Azure Table Storage Query.\n\nMy code is:\n\nCloudStorageAccount account;\n\nstring CloudStorageAccountName = ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n\n// Create the table client.\nMicrosoft.WindowsAzure.StorageClient.CloudTableClient tableClient = account.CreateCloudTableClient(); // conflicting\n\n// Create the CloudTable object that represents the \"people\" table.\nCloudTable table = tableClient.GetTableReference(\"people\"); // conflicting\n\n\nThe third and fourth lines of code (not comments) call the CreateCloudTableClient() and GetTableReference() respectively. I cannot get these to resolve at the same time. \n\nFor the first statement, CreateCloudTableClient() returns a CloudTableClient from the WindowsAzure.StorageClient.dll. The second statement returns a CloudTable from the same DLL. However, the DLL does not include a class called CloudTable, only the WindowsAzure.Storage.Table.dll does, so there is a compiling error on the line that runs GetTableReference().\n\nIf I change the CloudTableClient assembly to Storage.Table.dll, that throws a compile error on CreateCloudTableClient(). So one way or the other, I can't get it to work, these two DLLs are fighting. This code is referenced my multiple articles so I'm not sure what I'm doing wrong. I have tried using var instead of the class references but I have the same problem. Somehow the compiler interprets var as Storage.Table.CloudTable - why? beyond me. I am using the latest version of the SDK (2.7)."
] | [
"c#",
"azure",
"azure-storage",
"azure-table-storage"
] |
[
"CRSError: Invalid projection: epsg:4326: for geopandas",
"I am using anaconda for geopandas.\nHowever, everytime I try to use epsg:4326:, it gives an error.\nCRSError: Invalid projection: epsg:4326: (Internal Proj Error: proj_create: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name)\n\nHow can I solve this problem?\nI tried:\nfrom functools import partial\nfrom pyproj import Proj, transform\nproj_4326 = Proj(init="epsg:4326")\nproj_3857 = Proj(init="epsg:3857")\n\nI also tried to reset the environment:\nconda update anaconda\n\nbut they both gave the same CRSError\nMy versions are:\nimport sys\nimport pyproj\nimport geopandas\n\nprint(sys.version)\nprint(pyproj.__version__)\nprint(geopandas.__version__)\n\n3.8.5 (default, Sep 4 2020, 02:22:02) \n[Clang 10.0.0 ]\n2.6.1.post1\n0.8.2\n\nHow can I resolve this?"
] | [
"python",
"geopandas",
"epsg"
] |
[
"CSS don't work in WordPress",
"I am trying to create my own them in WordPress. I added index.php and style.css in root folder. I am trying change backgound color but nothing happened.\n\nindex.php\n\n <!DOCTYPE html>\n<html <?php language_attributes(); ?>>\n <head>\n <meta charset=\"<?php bloginfo( 'charset' ); ?>\" />\n <title><?php wp_title(); ?></title>\n <link rel=\"profile\" href=\"http://gmpg.org/xfn/11\" />\n <link rel=\"stylesheet\" href=\"<?php bloginfo('stylesheet_url'); ?>\" type=\"text/css\" />\n <link rel=\"pingback\" href=\"<?php bloginfo( 'pingback_url' ); ?>\" />\n <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>\n <?php wp_head(); ?>\n </head> \n <body>\n <p>Hello</p>\n </body>\n</html>\n\n\nstyle.css\n\n /* Theme Name: Test */\n\nbody{\n background-color: red;\n}\n\n\nIt is working when I change CSS style in 'site customizer/CSS' tab, or when i add css style directly in html body tag.\n\nWhat is wrong?"
] | [
"css",
"wordpress"
] |
[
"Does Akka-Alpakka Ftp library support to get file from URL?",
"I'm using https://github.com/akka/alpakka/tree/master/ftp/src this library for Ftp client. I have the url of the file as a path. But as I see from the code implementation, they support only java.nio.file.Path in the function. \n\nval ftpSettings = FtpSettings(host, port, NonAnonFtpCredentials(userName, pass), passiveMode = true)\nFtp.fromPath(\"Path object\", ftpSettings)\n\n\nBut I don't have a local file. I have only url for the file. Is there a possibility to get the file via url?"
] | [
"ftp",
"akka",
"akka-stream",
"java.nio.file"
] |
[
"Amazon S3 static hosting issues - driving me crazy",
"I am setting up a custom domain on Amazon S3. I have followed all the steps, and I can get to my page through their links. I also set up DNS in Cloudflare, and it resolves to Amazon.\n\nHere is the issue.\n\nI can get to my site the following ways:\nhttp://www.example.com.s3.ca-central-1.amazonaws.com/index.html\nor \nhttp://www.example.com/index.html\nIt works great!\n\nHowever, when I take out the \"index.html\" extension, and go to the following links:\nhttp://www.example.com.s3.ca-central-1.amazonaws.com\nor \nhttp://www.example.com\n\nIt displays \"This XML file does not appear to have any style information associated with it. The document tree is shown below.\"\n\nI have been wrestling with this for a few days now and can't figure it out. I want my web page to load WITHOUT index.html extension at the end of the domain.\n\nHelp, and thanks!"
] | [
"amazon-s3",
"amazon"
] |
[
"Read and make calculations with textfield input SwiftUI",
"I want to make calculations with inputs from 2 different Textfields and put the output in a Text. See code:\n\n@State var input1: String = \"\"\n\n@State var input2: String = \"\"\n\nvar calculation : Double {\n let calculationProduct = Double(input1) * Double(input2)\n return calculationProduct\n}\n\nvar body: some View {\nVStack{\n TextField(\"\", text: $input1)\n TextField(\"\", text: $input1)\n\nText(\"\\(calculation)\")\n}\n\n\nThe problem is the code won't compile, i get different compile errors, for example: \"Binary operator '*' cannot be applied to two 'Double?' operands\".\n\nWhat goes wrong?"
] | [
"ios",
"swift",
"swiftui"
] |
[
"how i get the id from a XML file jquery",
"my xml:\n\n<stuffs>\n<unit id=\"code\">10</unit>\n</stuffs>\n\n\nmy jquery ajax:\n\n $.ajax({\n type: \"POST\",\n url: \"xml/test.xml\",\n dataType: \"xml\",\n success: function(xml) {\n $(xml).find('stuffs').each(function(){\n\n ... the code are here ...\n\n });\n }\n\n\ni'm trying to get the values from <unit> using the ID:\n\nvar unit = $(this).find('unit').attr('id');\nvar unitIdVal = $(\"#\"+unit).text();\nalert(unitIdVal);\n\n\nbut, nothing he found.\n\ni dont know if is the same method of a comun jquery stuff's\nbecause i try to get the value direct using\n\nvar unitIdVal = $(\"#code\").text();\n\n\nbut, nothing again.\n\nty"
] | [
"jquery",
"xml"
] |
[
"Determine which tables are locked",
"I have to following problem. I have an application where users can login and do some things like adding new item. I also have statistics in Reporting Services. The problem is that statistic is time consuming and when it is executed, users cannot make new items. In my sql query for statistic I have all select statements decorated by WITH nolock statement. However I can see some tables are locked using Activity Monitor. Is it correct that I see them in locked by objects tab? How can I figure out which tables are locked?\nWhen I use the following statement:\n\nSELECT * FROM MyTable WITH (nolock)\n\n\nI can also see this query locks MyTable table. Please help me."
] | [
"sql",
"sql-server",
"reporting-services"
] |
[
"How to assign resources to a Task in a bug tracker application under development",
"What are your ideas and suggestions on how to assign Issues in bug tracker application to individual developers when a new Issue is created?\n\nIf the settings should be stored in a database, what would the table look like?\nWhat will trigger the resource assignment?\nFor example, when the user clicks the submit button, we look into the assignment settings table to figure out who the developer is for the ProjectId and IssueTypeId, and insert the UserId of the developer into the IssueResource table.\nWhat if there are more than developers assigned to a IssueType in a Project, how do we handle this scenario?\n\nMy Tables\n\nIssue\nIssueId UserId ProjectId Description\n\nIssueType\nIssueTypeId Description\n\nIssueResource\nIssueResourceId UserId IssueId"
] | [
"architecture"
] |
[
"Qt nested ListView or can I use TreeView",
"I am working on a project where I want to have a GUI like this:\n\n\nI have a list of my class (the blue one), and it has a list of the green class, so far my C++ structure is good, and I can get data from C++ in qml and vice versa, but I am not sure how to make the GUI work correct, I have triede with nested ListViews, but it seems like that I have no access to the outer ListView model from the inner ListView..\n\nI am pretty new to qml, and yesterday I found the TreeView, but to me it looks like that is only usefull if you have a table structure. Is there some qml that I dont know about that can help me with this?\n\nI have tried this with nested ListViews, the idea beeing that the inner ListView get a object of the green class as model.\n\nListView {\nid: userView\nanchors.fill: parent\nmodel: myModel\ndelegate: Rectangle {\n width: 900\n height: 200\n Column {\n id: col\n anchors.left: parent.left\n anchors.right: parent.right\n\n Item { height: 10 }\n Text {\n text: model.type + \" \" + model.name\n }\n Row {\n spacing: 8\n Button {\n id: addLevel\n width: 80\n text: \"Add Level\"\n enabled: setVisible\n elevation: 1\n backgroundColor: Theme.primaryColor\n onClicked: {\n myModel.insertLevel(index)\n }\n }\n Button {\n id: delTariff\n width: 80\n text: \"Delete User\"\n enabled: setVisible\n elevation: 1\n backgroundColor: Theme.primaryColor\n onClicked: {\n myModel.removeTariff(index)\n }\n }\n Button {\n id: delLevel\n width: 80\n text: \"Delete Level\"\n enabled: setVisible\n elevation: 1\n backgroundColor: Theme.primaryColor\n onClicked: {\n myModel.removeLevel(index, 0)\n }\n }\n }\n Text {\n text: model.levels\n }\n Row {\n spacing: 8\n Repeater {\n model: myModel.levelStructModel(userView.index)\n Rectangle {\n height: 30\n width: 30\n color: \"blue\"\n }\n }\n }\n }\n}\n\n\nI also have problem with the program craching after adding or deleting stuff, I tried add the QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership) in the contructor of myModel, but without any luck."
] | [
"c++",
"qt",
"listview",
"treeview",
"qml"
] |
[
"How might I implement immediate text submission when the enter key is pressed in a textarea?",
"Duplicate:\n\nSubmitting data from textarea by hitting “Enter”.\n\n\nI've got a textarea and a submit button:\n<textarea id="chat"></textarea>\n<input type="submit" value="Submit" onclick="send_msg();">\n\nThe value of the of the texarea is submitted when Enter is hit:\n textarea.onkeyup = function(e) {\n alert(e.keyCode);\n e = e || window.event;\n if (e.keyCode === 13) {\n send_msg();\n }\n return true;\n }\n\nProblem is to make the textarea submit its value prior to letting the cursor to jump to the next line. How's it possible to do that?"
] | [
"javascript",
"input",
"textarea"
] |
[
"Need Java Annotation to enforce javac -source option at compile time",
"We have some general utility classes in our large Java codebase that have to be deployed as a library in an environment where Java 1.6 is the only option. When this library is built, on infrequent occasions, we compile them with a Java 8 compiler with the -source option set to 1.6. The problem is, we've had to deal with compile errors that occur because someone has added code to the classes that use 1.7 or later Java language features. This happens because during the course of normal development, this code is developed and deployed in a Java 8 environment.\nWhat I'm wishing for is a built-in annotation that will cause compilation to fail if it contains any code that is not 1.6-compatible, regardless of the compiler version in use or the runtime version it's targeting. Unfortunately, that doesn't seem to exist. Would it be possible to create a custom annotation for this? None of the literature I've found on custom annotations talks about creating custom annotations that do their thing at compile time."
] | [
"java",
"annotation-processing"
] |
[
"How can a .NET code know whether it is running within a web server application?",
"I have a library code, which should be aware whether it is executed in the context of a web server or standalone application server.\n\nThe obvious that comes to mind is to check the name of the application configuration file and if it is web.config - then this is a web server, otherwise - standalone application server.\n\nAnother way is to look for something like \"Temporary ASP.NET files\" in the path of the shadow folder.\n\nBut I dislike both of these, since they seem too hacky and fragile. Is there a robust way to do what I want?\n\nThanks. \n\nP.S.\n\nOne may define a dedicated app config setting - IsWebServer, but I dislike it even more.\n\nEDIT:\n\nWhile looking for a solution to another problem, I think I solved this one - the details are here"
] | [
".net",
"asp.net"
] |
[
"How to get CPU usage in WMI using C++?",
"I have read most questions like this .But there are still some problems when try get the value of cpu usage in WMI using c++.\n\nI have tried two ways to solve this problem:\n\n\nquery the value of PercentProcessorTime in Win32_PerfFormattedData_PerfOS_Processor.But the value is much bigger than I want . It can reach 10802692. some pieces of my code:\n\n\n\n\nhres = m_pWbemSvc->ExecQuery(\nbstr_t(\"WQL\"),\nbstr_t(\"SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor where Name='_Total' \"),\nWBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,\nNULL,\n&m_pEnumClsObj\n);\n\nhres = m_pWbemClsObj->Get(L\"PercentProcessorTime\", 0, &vtProp, 0, 0);\n wcout << \"CPU Usage : \" << vtProp.ullVal << endl;\n VariantClear(&vtProp);\n\n\n\nget the some data form Win32_PerfRawData_PerfOS_Processor,then using the formula.However,when I try this method , I always get same value about PercentProcessorTime and TimeStamp_Sys100NS.That is to say N1=N2 and D1=D2.I think there must be some wrong in my code\n\n\n\n Formula - (1- ((N2 - N1) / (D2 - D1))) x 100\n\n\n\n\nunsigned __int64 N1;\nunsigned __int64 D1;\nunsigned __int64 N2;\nunsigned __int64 D2;\nbool result = false;\n\n\nif (getCPUData(&N1, &D1))\n{\n Sleep(1000);\n\n if (getCPUData(&N2, &D2))\n {\n result = true;\n }\n}\n\n//(1 - ((N2 - N1) / (D2 - D1))) * 100;\n\n\n\n\nbool WMI_Util::getCPUData(unsigned __int64 *N, unsigned __int64 *D)\n{\nHRESULT hres;\nULONG uReturn = 0;\nVARIANT vtProp;\nm_pEnumClsObj = NULL;\nbool result = false;\n\n\nhres = m_pWbemSvc->ExecQuery(\n bstr_t(\"WQL\"),\n bstr_t(\"SELECT * FROM Win32_PerfRawData_PerfOS_Processor where Name='_Total' \"),\n WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,\n NULL,\n &m_pEnumClsObj\n );\n\nif (FAILED(hres))\n{\n wcout << L\"Query for operating system name failed.\"\n << L\" Error code = 0x\"\n << hex << hres << endl;\n m_pWbemSvc->Release();\n m_pWbemLoc->Release();\n CoUninitialize();\n}\nelse{\n\n m_pWbemClsObj = NULL;\n\n while (m_pEnumClsObj)\n {\n hres = m_pEnumClsObj->Next(WBEM_INFINITE, 1, &m_pWbemClsObj, &uReturn);\n\n if (0 == uReturn)\n break;\n\n hres = m_pWbemClsObj->Get(L\"PercentProcessorTime\", 0, &vtProp, 0, 0);\n *N = vtProp.ullVal;\n VariantClear(&vtProp);\n\n hres = m_pWbemClsObj->Get(L\"TimeStamp_Sys100NS\", 0, &vtProp, 0, 0);\n *D = vtProp.ullVal;\n VariantClear(&vtProp);\n\n m_pWbemClsObj->Release();\n\n }\n result = true;\n}\nreturn result;\nReleaseWMI();\n}\n\n\nAs for initialization of WMI, I followed the step1-5 in MSDN. Do I need to get the value of them in two different WMI connection? In current situation , I just query the class in two different time .Is this reason why I always get the same value?"
] | [
"c++",
"wmi",
"cpu-usage"
] |
[
"Extracting JSON data to PDF file",
"I am trying to extract the data that I receive from a REST client in a JSON format into a PDF file. I know that I need to format it in columns/sections so first I need to convert to a text format, but is there a way to do that in Ruby? If so, does anyone have an example? \n\nHere is the format of the JSON data that I am getting from the REST API: \n\n{\"id\"=>123456, \"documentKey\"=>\"xyz\", \"globalId\"=>\"xyz\", \"itemType\"=>1234,\n\"project\"=>123, \"createdDate\"=>\"2015-02-20T00:11:56.000+0000\",\n\"modifiedDate\"=>\"2015-02-20T00:11:56.000+0000\",\n\"lastActivityDate\"=>\"2016-03-02T16:23:52.000+0000\",\n\"createdBy\"=>1234, \"modifiedBy\"=>12342,\n\"fields\"=>{\"name\"=>\"Introduction\",\n \"globalId\"=>\"Text\",\n \"documentKey\"=>\"Text-2\",\n \"description\"=>\"Some introduction\"\n }\n}"
] | [
"json",
"ruby",
"rest",
"pdf"
] |
[
"Condition WHERE in hiveql query which returns no result",
"I ran three very similar queries in hue which use hiveql, two of these have a condition (opposite contitions). I don't understand at all the results:\n\nselect \n distinct \n product_id,\n price,\n rang,\n if(rang=1, 1, 0)\nfrom (\n select \n distinct \n product_id, \n price,\n row_number() OVER (PARTITION BY product_id order by col1 desc nulls last, col2 desc nulls last) rang\n from offer.offer_price\n) op\n\n\n==============> return 1 row :\n\nproduct_id price rang c4\nprod_1 12.99 1 1\n\n\n========================================================\n\nselect \n distinct \n product_id,\n price,\n rang,\n if(rang=1, 1, 0)\nfrom (\n select \n distinct \n product_id, \n price,\n row_number() OVER (PARTITION BY product_id order by col1 desc nulls last, col2 desc nulls last) rang\n from offer.offer_price\n) op\nwhere if(rang=1, 1, 0)=1\n\n\n==============> return 0 row\n\nselect \n distinct \n product_id,\n price,\n rang,\n if(rang=1, 1, 0)\nfrom (\n select \n distinct \n product_id, \n price,\n row_number() OVER (PARTITION BY product_id order by col1 desc nulls last, col2 desc nulls last) rang\n from offer.offer_price\n) op\nwhere if(rang=1, 1, 0)=0\n\n\n==============> return 1 row :\n\nproduct_id price rang c4\nprod_1 12.99 1 1\n\n\n========================================================\n\nWhy the third query returns the same result than the first query whereas the rang = 1? Does someone know why?\n\nThank you so much.\n\nEmilie"
] | [
"sql",
"hiveql",
"where-clause",
"hue",
"partition-by"
] |
[
"How to solve , error if 'domain' in method_res: TypeError: argument of type 'bool' is not iterable?",
"i'm running this code, which is supposed to remove element that meet a certain requirement from a list while iterating through it:\n\[email protected]\[email protected]('stage_a_id','selection_id','cause_id','location_id','batch_id')\ndef _change_domain_causeid(self):\n\n if self:\n self.stage_a_id=self.selection_id.stage_id\n arrTransferSeed = []\n if self.stage_a_id.code == 'PN':\n batchTransferPn =self.env['estate.nursery.batchline'].search([('batch_id.id','=',self.batch_id.id),('location_id.id','!=',False)])\n for a in batchTransferPn:\n arrTransferSeed.append(a.location_id.id)\n elif self.stage_a_id.code == 'MN':\n batchTransferMn = self.env['estate.nursery.transfermn'].search([('batch_id.id','=',self.batch_id.id)])\n for b in batchTransferMn:\n stockLocation = self.env['estate.block.template'].search([('id','=',b.location_mn_id[0].id)])\n stock= self.env['stock.location'].search([('id','=',stockLocation.inherit_location_id[0].id)])\n idlot= self.env['estate.nursery.batch'].search([('id','=',self.batch_id.id)])\n qty = self.env['stock.quant'].search([('lot_id.id','=',idlot[0].lot_id.id),('location_id.id','=',stock[0].id)])\n if qty[0].qty > 0:\n arrTransferSeed.append(b.location_mn_id.id)\n return {\n 'domain': {'cause_id': [('stage_id.id', '=',self.stage_a_id.id)],\n 'location_id': [('id','in',arrTransferSeed)]},\n }\n return True\n\n\nand show error like this :\n\nargument of type 'bool' is not iterable odoo\n\n\nhow can i resolved my problems?"
] | [
"python-2.7",
"odoo-9"
] |
[
"send email with attachment using jquery ajax and php",
"I have created a program to send email with attachment. First I create it without ajax. Then it worked properly. But when I used jquery ajax for it not work. When I click apply button nothing happen. My code is below.\n\n<form action=\"sendemail.php\" enctype=\"multipart/form-data\" method=\"post\">\n <h1 class=\"cta-title\">Its a Call To Action</h1>\n <div class=\"cta-desc\">\n <input type=\"text\" value='<?= $row['catogary'];?>' readonly style=\"width: 75%\"><br><br>\n <input type=\"text\" value='<?= $row['company_name'];?>' readonly style=\"width: 75%\"><br><br>\n <input type=\"text\" value='<?= $row['location'];?>' readonly style=\"width: 75%\"><br><br>\n <input type=\"text\" value='<?= $row['qulification'];?>' readonly style=\"width: 75%\"><br><br>\n <input type=\"text\" value='<?= $row['catogary'];?>' readonly style=\"width: 75%\"><br><br>\n <input type=\"text\" value='<?= $row['indate'];?>' readonly style=\"width: 37.5%\">&nbsp;\n <input type=\"text\" value='<?= $row['expdate'];?>' readonly style=\"width: 37.5%\"><br>\n <input type=\"text\" id=\"email\" name=\"email\" value='<?= $row['email'];?>'><br>\n <input type=\"file\" name=\"uploaded_file\" id=\"uploaded_file\" class=\"text-center center-block well well-sm\">\n <input type=\"button\" id=\"btn\" name=\"btn\" class=\"btn btn-primary\" value=\"Apply\">\n </div>\n <script>\n $('#btn').click(function () {\n $.ajax({\n method:\"POST\",\n url:\"sendemail.php\",\n data:{email:$('#email').val()},\n success:function (data) {\n alert(data);\n return false;\n }\n });\n });\n </script>\n </form>\n\n\nsendmail.php\n\n <?php\n $email2=$_POST['email'];\n require_once('PHPMailer/PHPMailerAutoload.php');\n $mail = new PHPMailer;\n $mail->IsSMTP(); // enable SMTP\n $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only\n$mail->SMTPAuth = true; // authentication enabled\n$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail\n$mail->Host = \"smtp.gmail.com\";\n$mail->Port = 465; // or 587\n$mail->IsHTML(true);\n$mail->Username = \"[email protected]\";\n$mail->Password = \"uwucst14xxxx\";\n$mail->SetFrom(\"[email protected]\");\n$mail->FromName = \"Internship Management\";\n\n$mail->addAddress($email2);\n/\n$mail->addReplyTo(\"[email protected]\", \"Reply\");\n\n$mail->isHTML(true);\n\n$mail->Subject = 'CV for internship Vacancy';\n$mail->Body = \"Attached\";\nif (isset($_FILES['uploaded_file']) && $_FILES['uploaded_file']['error'] == UPLOAD_ERR_OK) {\n\n $mail->AddAttachment($_FILES['uploaded_file']['tmp_name'],$_FILES['uploaded_file']['name']);\n}\n\nif(!$mail->send())\n{\n echo \"Mailer Error: \" . $mail->ErrorInfo;\n\n}\nelse\n{\n echo 'Successfully Applied for vacancy';\n}\n?>"
] | [
"php",
"jquery",
"ajax"
] |
[
"How to Plot Image Log-Chromaticity Plot in Python OpenCV",
"I am trying to create a 2D log chromaticity plot in python with OpenCV. The same question was asked here\n\nHow to compute 2D log-chromaticity?\n\nbut it was never answered.\n\n(ASIDE: A guess was made that the axes must be log instead of linear, but this is incorrect as the paper uses negative coordinates, and log axes cannot be negative. Also, I was desparate and tried plt.xscale('log') and plt.yscale('log'), but it didn't work).\n\nThis work is based off this paper:\n\nhttps://www.cs.sfu.ca/~mark/ftp/Eccv04/\n\n(I re-mention it below)\n\nMy Code:\n\nimport numpy as np\nimport cv2\nimport os\nimport matplotlib.pyplot as plt\n\nroot = r'.\\path\\to\\root'\nroot = r'my_img.jpg'\n\nif __name__ == '__main__':\n\n img = cv2.imread(os.path.join(root, fl))\n\n cv2.imshow('Original', img)\n cv2.waitKey(0)\n\n b, g, r = cv2.split(img)\n\n img_sum = np.sum(img, axis = 2) # NOTE: This dtype will be uint32.\n # Each channel can be up to\n # 255 (dtype = uint8), but\n # since uint8 can only go up\n # to 255, sum naturally uint32\n\n # \"Normalized\" channels\n # NOTE: np.ma is the masked array library. It automatically masks\n # inf and nan answers from result\n\n n_r = np.ma.divide(1.*r, g)\n n_b = np.ma.divide(1.*b, g)\n\n log_rg = np.ma.log( n_r )\n log_bg = np.ma.log( n_b )\n\n plt.scatter(l_rg, l_bg, s = 2)\n plt.xlabel('Log(R/G)')\n plt.ylabel('Log(B/G)')\n plt.title('2D Log Chromaticity')\n plt.show()\n\n\nInput:\n\nColor Checker Chart\n\nResult:\n\nMy Log Chromaticity Plot\n\nExpected Result:\n\nFinlayson Log Chromaticity Plot\n\nThe expected result was taken from this paper (\"Intrinsic Images by Entropy Minimization\", by: Finlayson, G., et. al.):\n\nhttps://www.cs.sfu.ca/~mark/ftp/Eccv04/\n\n(Paper also mentioned above)\n\nCan you help me please?!"
] | [
"python",
"image",
"opencv",
"colors",
"rgb"
] |
[
"Create new untitled file and set language mode",
"I have this macro\n\n\"macros\": {\n \"newScratchFile\": [\n \"workbench.action.files.newUntitledFile\",\n \"workbench.action.editor.changeLanguageMode\"\n ]\n},\n\n\nWhich used to work great with this extension but it appears Microsoft broke it as some point in time.\n\nNow when I activate it, I do get a new untitled file, and the language mode popup opens for a split second but then disappears before I get a chance to type anything.\n\nIs there a way to fix my macro so the language picker remains open?"
] | [
"visual-studio-code"
] |
[
"I need help creating a class to store data for my entire project including user controls",
"I am still very new to WPF and I've spent a week trying to understand MVVM with not very much luck, but I am not specifically trying to follow those rules, I just need to store information into a class so all of my user controls can access it and also change it. \nThis is what I have so far:\n\nnamespace WpfApplication2.Funtions\n{\n public class Binder : INotifyPropertyChanged\n {\n #region INotifyPropertyChanged Members\n\n public event PropertyChangedEventHandler PropertyChanged;\n\n private void OnPropertyChanged(string propertyName)\n {\n if (PropertyChanged != null)\n {\n PropertyChanged(this, new PropertyChangedEventArgs(propertyName));\n }\n }\n #endregion\n\n private string _Test_String;\n public string Test_String \n { \n get { return _Test_String; }\n set { _Test_String = value; OnPropertyChanged(\"Test_String\"); }\n }\n\n }\n}\n\n\nUser control:\n\npublic partial class UserControl1 : UserControl\n{\n\n //Funtions.Binder _B = new Funtions.Binder();\n\n public UserControl1()\n {\n InitializeComponent();\n }\n\n private void button1_Click(object sender, RoutedEventArgs e)\n {\n MainWindow MW = new MainWindow();\n textBox1.Text = MW._B.Test_String;\n }\n}\n\n\nMainwindow:\n\npublic partial class MainWindow : Window\n{\n\n public Funtions.Binder _B = new Funtions.Binder();\n\n public MainWindow()\n {\n InitializeComponent();\n _B.Test_String = \"HELLO\";\n }\n\n private void button1_Click(object sender, RoutedEventArgs e)\n {\n _B.Test_String = \"Hello from main\";\n }\n\n\n\n}\n\n\nI see what is happening here, the user control is creating a new instance of MainWindow so it is NOT the same value, but how do I actually access the same Binder instance that MainWindow created from usercontrol1 so that it can read and change it? or if I can't achieve what I want this way how should I go about doing it? I know there has got to be a very simple solution to this. I don't want to use the project Settings.\n\nPlease don't mind the super noob question but I've been stuck for days now, I just need a simple explanation and solution and I'll be on my way. \nThank you."
] | [
"c#",
"wpf",
"data-binding"
] |
[
"batch file with relative path and close command prompt",
"I try this code :\n\nstart /d \"D:\\test\\CONTOH\\DATA\\QGIS2\\bin\\\" qgis.bat\n\n\nbased on :\nBat file to run a .exe at the command prompt\n\nBut, I want to be relative path, something like this :\n\nstart /d %~dp0\\DATA\\QGIS2\\bin\\qgis.bat\n\n\nbased on :\nrelative path in BAT script\n\nbut, nothing happen. So, can someone give me information, what is wrong?"
] | [
"batch-file"
] |
[
"Special Characters from SQLite DB",
"I read from a sqlite db to my iphone app. Within the texts sometimes there are special characters like 'xf2' or 'xe0' as I can see in the debugger in the char* data type. When I try to transform the chars to an NSString Object by using initWithUTF8String, I get a nil back.\n\nHow can I transform such special characters?"
] | [
"iphone",
"objective-c",
"sqlite"
] |
[
"How do I disable the animation in Bottom Navigation View when icons are clicked?",
"I am using the default BottomView Navigation bar for my application which has 4 buttons and they have an awful shifting animation, and there doesn't seem to be a method in the compat lib. to disable it. Please help.\n\nP.s I don't want to use third party bottom navs."
] | [
"android",
"android-animation",
"bottomnavigationview"
] |
[
"Iterating Through Links With Selenium WebDriver w/ C#",
"I have a project to click through specific links on a web page using Selenium WebDriver with C# and I'm struggling to find a clean way to iterate through them with an array that accounts for specific cases. \n\nI understand how to do basic driver.FindElement(By.XPath(\" \"));\n\nBut I'm not sure how I could create a WebElement Array to feed a foreach statement that would search By.TagName(\"a\") in specific div classes without pulling every link on the page.\n\nExample of what the header of the website looks like:\n\n<header>\n <div id=\"ContainerTopStrip\">\n <div class=\"ContainerWidth\">\n <div class=\"headerMenu\">\n <a href=\"Account/IntakeLogin\" title=\"Report\">Report</a>\n <a href=\"/rfs\" title=\"Request\">Request</a>\n <a href=\"javascript:void(0);\" onclick=\"openFullWindow();\" title=\"Lookup\">Lookup</a>\n </div>\n </div>\n </div>\n</header>\n\n\nBasic example of what I have just using findelement:\n\nusing System;\nusing NUnit.Framework;\nusing OpenQA.Selenium;\nusing OpenQA.Selenium.Support.UI;\nusing OpenQA.Selenium.Chrome;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main()\n {\n using (IWebDriver driver = new ChromeDriver(\"C:\\\\\"))\n {\n driver.Navigate().GoToUrl(\"xxx\");\n driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60);\n\n driver.FindElement(By.XPath(\"//a[text()=\\\"xxx\\\"]\")).Click();\n // TODO: Figure out how to assert route change occurred\n\n driver.FindElement(By.XPath(\"//a[text()=\\\"xxx\\\"]\")).Click();\n driver.Navigate().Back();\n\n driver.FindElement(By.XPath(\"//a[text()=\\\"xxx/I\\\")]\")).Click();\n driver.Navigate().Back();\n\n Console.WriteLine(\"This is what happens when you don't know how to make an array.\");\n driver.Quit();\n } \n }\n}\n\n\nSo to summarize:\n\nNeed help finding a way to create an array that could find specific links to be clicked in a loop because that seemed like the neatest solution after searching for awhile now. If there is a better suggestion available, I'm open to it. Just completely new to C#/Selenium in general."
] | [
"c#",
".net",
"selenium-webdriver",
"visual-studio-code"
] |
[
"SimpleInjector Request Scope from Service layer",
"I have a multi-tier application where my implementation of my DbContext and UnitOfWork is lying in my service layer. This layer does not have a reference to System.Web.\n\nTogether with the implementations lies my CompositionRoot class which is referred from my UI layer, using extensions, to initialize all my injections.\n\nBut my DbContext and UnitOfWork requires a request scope, and I am not able to set this like the example below, since I do not have access to HttpContext or WebRequestLifestyle. \n\nShould I move this RegisterEntityFramework(...) extension to my UI layer in order to use request scope, or should I just reference the System.Web in my service layer - or another approach? \n\nI am new to Dependency Injection so maybe I just being too paranoid about what the best practices are in such senario.\n\nServiceLayer/EntityFramework/CompositionRoot.cs\n\npublic static class CompositionRoot\n{\n public static void RegisterEntityFramework(this Container container)\n {\n var lifestyle = Lifestyle.CreateHybrid(\n lifestyleSelector: () => HttpContext.Current != null, // HttpContext not available\n trueLifestyle: new WebRequestLifestyle(),\n falseLifestyle: new LifetimeScopeLifestyle()\n );\n\n var contextRegistration = lifestyle.CreateRegistration<EntityDbContext, EntityDbContext>(container);\n container.AddRegistration(typeof(EntityDbContext), contextRegistration);\n container.AddRegistration(typeof(IUnitOfWork), contextRegistration);\n }\n}\n\n\nUILayer/App_Start/CompositionRoot.cs\n\npublic static class RootComposition\n{\n public static void Configure()\n {\n var container = new Container();\n container.RegisterEntityFramework(); // extension\n\n container.RegisterMvcControllers(Assembly.GetExecutingAssembly());\n container.RegisterMvcAttributeFilterProvider();\n\n container.Verify();\n\n DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));\n GlobalConfiguration.Configuration.DependencyResolver = new WebApiDependencyResolver(container);\n }\n}"
] | [
"c#",
"entity-framework",
"dependency-injection",
"simple-injector"
] |
[
"VBA Find (LookAt=xlWhole) will always return an error",
"I have a search function in a VBA code that searches column A. Column A is filled with acronyms and the corresponding rows in Column B are the meanings for that acronym.\n\nI have a user form setup that the user can enter an acronym and if it is in the file, it will show a message box saying what that acronym means.\n\nI am trying to search for an exact match of the acronym the user enters, via this line:\n\nRange(\"A:A\").Find(acro, LookAt = xlWhole).Select\n\n\nHowever, when I run it, even if I copy a cell containing an acronym and paste it into the user form text box, it will act as if it could not find it and follows my On Error handle.\n\nWhat did I do wrong that made it unable to find the acronym string I am looking for?\n\nThank you!"
] | [
"vba",
"excel",
"find"
] |
[
"ElasticSearch Score Function Depending on Neighbor Documents",
"I have an ElasticSearch index with 2 mappings (types).\nIn the app I need to display a paginated feed containing items of both types.\nCurrently the items are sorted just by creation date, but I also want to have control on how the items alternate with each other on the page.\nFor example, I want to set a rule for sequence \"3 items of type A, 1 item of type B, and so on\".\nI need it to make sure items of both types are displayed on each page and equally distributed across the pages.\n\nBut as far as I see it's not possible to access another documents in custom score function script.\n\nOf course it's easy to implement directly in the app logic, but it's not clear how to implement pagination using this way.\n\nAny ideas on how to achieve that?"
] | [
"elasticsearch"
] |
[
"cannot use $rootScope.$new() in testing directive",
"I have a unit test for my directive:\n\ndescribe('Directive: ov-tabs', function() {\n var $compile, scope,subScope, element, template, doc,timeout,window;\n beforeEach(module('ngnms.ui.tabs','layout.html'));\n beforeEach(inject(function(_$compile_, $rootScope,$templateCache, $timeout,$document, $window) {\n template = $templateCache.get('layout.html');\n $templateCache.put('template/tab-layout.html', template);\n $compile = _$compile_;\n timeout = $timeout;\n window = angular.element($window);\n doc = $document;\n scope = $rootScope.$new();\n\n var html =\n '<ov-tabset ov-tabs=\"items\" on-tab-selected=\"tabSelectCallback\" on-tab-closed=\"tabClosedCallback\"></ov-tabset>';\n\n element = angular.element(html);\n $(element).appendTo($('body'));\n //------------------------------------------init scope\n //add 12 items to scope\n //-------------------------------------------end init scope\n $compile(element)(scope);\n scope.$digest();\n\n }));\nit('some thing true',function(){});\n var lis = element.find('li');\n expect(lis.length).toEqual(12);\n})\n\n\nThe result throw error for interact with DOM\nIf i change \"scope = $rootScope.$new();\" to \"scope = $rootScope;\" they'll work fine!\n\nI want test sope to $destroy(). Because $rootScope cannot invoke $destroy()\n\nERRORS log here!"
] | [
"javascript",
"unit-testing",
"angularjs",
"angularjs-directive"
] |
[
"Installing PostgreSQL 9.1 on Red Hat 6.1 x86_64 requires already installed libs",
"I'm following what is described here to install PostgreSQL 9.1 on a Red Hat 6.1\nWhen I launch yum install postgresql91-server it complains that libssl.so.10 and libcrypto.so.10 are missing, while I've verified that they're available under /usr/lib64/\n\nHere it is the errors I get:\n\n\n postgresql91-server-9.1.12-1PGDG.rhel6.x86_64\n \n --> Finished Dependency Resolution\n \n Error: Package: postgresql91-libs-9.1.12-1PGDG.rhel6.x86_64 (pgdg91)\n\n Requires: libcrypto.so.10(libcrypto.so.10)(64bit)\n\n \n Error: Package: postgresql91-server-9.1.12-1PGDG.rhel6.x86_64 (pgdg91)\n\n Requires: libcrypto.so.10(libcrypto.so.10)(64bit)\n\n \n Error: Package: postgresql91-libs-9.1.12-1PGDG.rhel6.x86_64 (pgdg91)\n\n Requires: libssl.so.10(libssl.so.10)(64bit)\n\n \n Error: Package: postgresql91-server-9.1.12-1PGDG.rhel6.x86_64 (pgdg91)\n\n Requires: libssl.so.10(libssl.so.10)(64bit)\n\n \n Error: Package: postgresql91-9.1.12-1PGDG.rhel6.x86_64 (pgdg91)\n\n Requires: libssl.so.10(libssl.so.10)(64bit)\n\n \n You could try using --skip-broken to work around the problem\n You could try running: rpm -Va --nofiles --nodigest\n\n\nWhat do I miss?"
] | [
"postgresql",
"redhat",
"yum"
] |
[
"Visual Studio metadata filenames are inconsistent",
"The following seems to be a Visual Studio 2017 bug. I will post it here to see if there are alternative explanations.\n\nSometimes Visual Studio will create a file with a file name ending in .cache and sometimes it will end with .Cache. The difference is only in the aspect of capitalization.\n\nAn example is this file, starting at a Visual Studio project directory.\n\n../ListEditor/obj/Debug/ListEditor.csproj.GenerateResource.cache\n\nIf there is something in the operation of Visual Studio that can avoid this bug I would like to know.\n\nThe following is \"background\" information about why this matters to me and is not essential to my inquiry.\n\nThis inconsistency in the file name is has no effect on the operation of Visual Studio and Windows because the operating system is case-insensitive. However, it does have a subtle effect in the intersection of robocopy and cygwin and diff --recursive. \n\nSuppose a backup is made and verified as follows.\n\nrobocopy c:\\users\\joe\\documents d:\\windowsbackup\\documents /XJ /MIR\n\ndiff --recursive --brief /cygdrive/c/Users/joe/Documents /cygdrive/d/windowsbackup/Documents\n\nrobocopy's economizing heuristic is that a copy is needed if there is a change to the size or timestamp of a file. In other words, robocopy is not perfect, but the verification is intended to catch robocopy's mistakes. These mistakes are admittedly unlikely when nobody is messing with the system clock and programs are not back-dating. However, when a large quantity of data is copied performing a verification might be considered prudent in order to detect corruption. Visual Studio needlessly alternating between .cache and .Cache creates a problem for the verification. Since the diff verification happens in cygwin, which is case-sensitive, the following will be output.\n\nOnly in /cygdrive/c/users/joe/Documents/source/repos/Auna4/ListEditor/obj/Debug: ListEditor.csproj.GenerateResource.cache\n\nOnly in /cygdrive/d/windowsbackup/Documents/source/repos/Auna4/ListEditor/obj/Debug: ListEditor.csproj.GenerateResource.Cache\n\nSo diff found a difference but it is not the kind of difference we care about and furthermore it declines to verify the file contents to detect corruption. One solution involves writing a script to collect the diff output and pass it to cygwin cmp to do the content verification that cygwin diff declined to do. (Diff is used because it supports recursion but cmp does not.)\n\ncmp /cygdrive/c/users/joe/Documents/source/repos/Auna4/ListEditor/obj/Debug/ListEditor.csproj.GenerateResource.cache /cygdrive/d/windowsbackup/Documents/source/repos/Auna4/ListEditor/obj/Debug/ListEditor.csproj.GenerateResource.Cache\n\nThe bottom line: robocopy is probably okay when there is no human nor programmatic altering of the system clock but for large amounts of data detecting corruption is nice to have but not readily attainable with the \"default\" tools given the Visual Studio file name bug. cygwin already stretches the definition of \"default\" tool. For my purposes, the most popular system is often the default choice if I am concerned about bugs and support. I think cygwin was very popular before Microsoft added the Linux subsystem to Windows. (At the moment, I cannot remember why I used cygwin instead of the Windows 10 Linux subsystem.)\n\nEdit: Note this is also happening with the 'MyProgram.exe.config' file which more recently appears as 'MyProgram.exe.Config'."
] | [
"visual-studio",
"cygwin",
"robocopy"
] |
[
"Laravel 5.5 empty object",
"Good afternoon guys, I'm having an issue I don't know if you have the same trouble, I upgrade my Laravel project and now all routes like this\n\nRoute::get('detail/client/{client}', \"controller@method\")\n\n\nare breaking everything because the object instanced in the controller comes empty...\n\npublic function detail(FileRequest $request, Client $client){\n\n dd($client) // empty object\n}\n\n\nIf someone can help me with this please. If I remove the Client model and make the dd then return the ID of the object i.e \"594\""
] | [
"php",
"laravel",
"laravel-5",
"laravel-5.5"
] |
[
"Python append several data frames into one inside function",
"I'm scrapping info about coins. I need to append all scrapped data to one Dataframe. \n\nI have following code:\n\nimport bs4 as bs\nimport urllib.request\nimport pandas as pd\n\ndef scraping_func(coin_id):\n \"\"\" \n This function recives \"coins_id\" from \"coins_to_scrape list\".\n It scrapes all data that I need and puts it to \"df\" Dataframe\n Then it saves this Dataframe to excel file (%coin_id%.xlsx)\n The last lines of the function are: (I cut my code because it's big) \n \"\"\" \n df = df[['Country', 'Value', 'Year', 'Metal', 'Marks', 'Mintage', 'Krause', 'Price', 'Quality', 'Details', 'Avers', 'Revers', 'Gcoins_link']]\n excel_name = '{}.xlsx'.format(coin_id) \n df.to_excel(excel_name) \n for i in dfs:\n dfs = df.append(dfs, ignore_index=True)\n dfs.to_excel('adfasdf.xlsx')\n\ncoins_to_scrape = [514, 515, 179080, 45518, 521, 111429] # The list of ID that I need to scrape\nfor i in coins_to_scrape: # For each coin in the list\n scraping_func(i) # call the \"scraping_func\" function \n\n\nIt works great. But this code creates separate excel document for each coins that I'm passing to the function. But there are thousands coins to scrape so I'd like to append each Dataframes to the one and then save it to the excel file. \n\nI tried to find a solution on the internet but I couldn't."
] | [
"python",
"python-3.x",
"pandas",
"dataframe"
] |
[
"Uninitialized constant error in Rspec with Rails 3.0.5",
"I'm trying to set up a Rspec test for a simple controller for pages on Rails and got the following error:\n\n /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/backward_compatibility.rb:20:in `const_missing': uninitialized constant Object::PagesController (NameError)\nfrom /var/lib/gems/1.9.1/gems/rspec-expectations-2.0.1/lib/rspec/expectations/backward_compatibility.rb:6:in `const_missing'\nfrom /media/sf_ruby/tapa-g/spec/controllers/pages_controller_spec.rb:3:in `<top (required)>'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `load'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `block in load_spec_files'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `map'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `load_spec_files'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:18:in `run'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:55:in `run_in_process'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:46:in `run'\nfrom /var/lib/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:10:in `block in autorun'\n\n\nI get this error whatever the command line I type, i.e.:\n\nbundle exec rspec spec/controllers/pages_controller_spec.rb \nrake spec\nrspec spec/\n\n\nI have the following test in the spec/controllers/pages_controller_sprec.rb file:\n\nrequire 'spec_helper'\n\ndescribe PagesController do\n render_views\n\n describe \"GET 'home'\" do\n it \"should be successful\" do\n get 'home'\n response.should be_success\n end\n end\nend\n\n\nAnd my controller in app/controllers/pages_controller.rb file look like:\n\nclass PagesController < ApplicationController\nskip_authorization_check \n\n def home\n @title = \"Home\"\n end \n\n\nend\n\n\nwith other actions but not relevant here.\n\nHere are the gems in my Gemfile:\n\nsource 'http://rubygems.org'\n\ngem 'rails', '3.0.5'\ngem 'will_paginate', '3.0.pre2'\ngem 'jquery-rails', '>= 1.0.12'\ngem \"paperclip\", \"2.4.5\"\ngem \"rake\", \"0.8.7\"\ngem \"devise\"\ngem \"cancan\"\ngem 'aws-s3'\ngem 'acts_as_tree'\n\ngroup :development do\n gem 'rspec-rails', \"2.0.1\"\n gem 'annotate'\n gem 'faker', '0.3.1', :require => false\n gem 'populator', '1.0.0'\n gem 'ruby-debug19'\nend\n\ngroup :test do\n gem 'webrat', '0.7.1'\n gem \"capybara\"\n gem 'rspec', '2.0.1'\n gem 'factory_girl_rails', '1.0'\nend\n\n\nI'm under Rails 3.0.5 with ruby 1.9.2.\n\nI don't have a clue of here to look at. I already uninstall the rspec and rspec-rails gems and reinstall them without much success. I don't have neither autotest nor Spork installed to run the tests.\n\nDoes anybody have an idea?\n\nMany thanks!"
] | [
"ruby-on-rails",
"rspec",
"rspec-rails"
] |
[
"Datatable: changing row color based on the data",
"I created a database i have a table im calling all rows from datatable and im wanting to set all rows color to situation. For example \nif situation is \"ACTIVE\" it should change the color green.\nelse situation='PROCESSING' color ='YELLOW'\nelse situation='NONE' color ='RED'\n\n\r\n\r\n<table class=\"table\" id=\"table\">\r\n \r\n <tr>\r\n <th>ID</th>\r\n <th>Company</th>\r\n\r\n <th>Situation</th>\r\n </tr>\r\n\r\n\r\n<?php \r\n\r\n$ques = $conn->query(\"SELECT * FROM company \"); \r\n\r\nwhile ($result = $ques->fetch_assoc()) { \r\n\r\n$id = $result['id'];\r\n$companyname = $result['companyname'];\r\n$situation = $result['situation'];\r\n\r\n\r\n?>\r\n \r\n <tr>\r\n <td><?php echo $id; ?></td>\r\n <td><?php echo $companyname; ?></td>\r\n <td><?php echo $situation; ?></td>\r\n </tr>\r\n\r\n<?php \r\n} \r\n\r\n?>\r\n\r\n</table>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<script>\r\n$(document).ready( function() {\r\n $('#table').dataTable( {\r\n \"fnRowCallback\": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {\r\n if ( aData['2'] == \"NONE\" )\r\n {\r\n $('td', nRow).css('background-color', 'red' );\r\n }\r\n else if ( aData['2'] == \"ACTIVE\" )\r\n {\r\n $('td', nRow).css('background-color', 'green');\r\n }\r\n else if ( aData['2'] == \"PENDING\" )\r\n {\r\n $('td', nRow).css('background-color', 'yellow');\r\n }\r\n else\r\n {\r\n $('td', nRow).css('background-color', 'orange');\r\n }\r\n }\r\n } );\r\n} );\r\n</script>\r\n\r\n\r\n\n\nI m expecting the output should be with color"
] | [
"php",
"mysql",
"database",
"datatable"
] |
[
"How to clear fields after post back in asp.net mvc?",
"I am wondering how do I clear fields after a postback in asp.net mvc? Like right now when validation errors occur the fields stay populated with whatever a user would entered. This is fine however, when no validation errors occur I want the all the fields to clear and a message to display.\n\nSo right now I have the success displaying by using ViewData but not sure how to get the fields to clear."
] | [
"c#",
".net",
"asp.net-mvc"
] |
[
"Android Studio signed apk not install and not display Admob ads",
"I created an Android app and created Admob ads. While the app is running or installing it works without any problems, but when I sign the app and try to install it, the message appears as in the picture.\n\n\n\nThank you very much for your help."
] | [
"java",
"android",
"android-studio",
"admob",
"apk"
] |
[
"How to get data of Post.user not the logged in User",
"I am currently working on a blog project for learning purposes, I am trying to get the total number of posts made by a specific user. In my model I have set the User who makes a Post as Author.\nIn the Post detail page I am trying to show the total number of Posts made by this specific author but I am getting the data of the logged in User who is viewing the page.\nThe reason for this is using self in the get context data but I am not sure how to fix it so I need some explanation on how to amend this error in code.\nHere is the Post Model:\nclass Post(models.Model):\n title = models.CharField(max_length=100, unique=True)\n content = RichTextUploadingField(null=True, blank=True)\n author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='author')\n\nHere is the views.py:\nclass PostDetailView(DetailView):\n model = Post\n template_name = "blog/post_detail.html" \n\n def get_context_data(self, *args, **kwargs):\n context = super(PostDetailView, self).get_context_data()\n post = get_object_or_404(Post, slug=self.kwargs['slug'])\n\n num_post = Post.objects.filter(author=self.request.user).count()#<--- No. of Posts made by an author\n\n context["num_post"] = num_post #<--- No. of Posts made by a user\n\n return context\n\nMy question: How to show the data of the post detail author not the logged in user\nThank you"
] | [
"python",
"django"
] |
[
"Change type of record column in BigQuery",
"I have a table in BigQuery with a RECORD type column. This RECORD column is just a RECORD, it's not a REPEATED column. I would like to change the type of one of the elements in the record. My record is defined as:\n\nproduct_action RECORD NULLABLE\nproduct_action.action_type INTEGER NULLABLE\nproduct_action.checkout_step INTEGER NULLABLE\n\n\nI would like to change the type of ACTION_TYPE from INTEGER to STRING, but I don't know how to do it. I know it involves selecting and casting to a new table, but I don't know the right syntax. There is a very similar question here with an answer\nHow to change the col type of a BigQuery repeated record\nbut it's only for REPEATED records and was not able to change it to RECORD only (not REPEATED).\n\nThanks!"
] | [
"google-cloud-platform",
"google-bigquery"
] |
[
"How to parse CSV that is passed as a parameter to a method",
"I have a string that contains content of CSV file.\nI need to extract those values to my objects.\nI don't get CSV from CSV file I receive it as a parameter (data).\nAnd in exmple they use file.csv to parse data.\nI have tried to load it in MemoryStream but without luck.\n\npublic string methos(string data)\n {\n CsvFileDescription inputFileDescription = new CsvFileDescription\n {\n SeparatorChar = ',',\n FirstLineHasColumnNames = true\n };\n\n CsvContext cc = new CsvContext();\n\n MemoryStream mStream = new MemoryStream(System.Text.ASCIIEncoding.Default.GetBytes(data));\n\n IEnumerable<Data datas=\n cc.Read<Data>(mStream, inputFileDescription);\n\n\nAlso I don't know if I pick good framework to parse CSV to custom objects but to me it's important that values can have commas and that framework can handle that."
] | [
"c#",
"linq",
"csv",
"memorystream"
] |
[
"Mat-Checkbox not unchecking when clicking on border",
"I am using mat-checkbox and when I click on the border of the checkbox it doesnt uncheck it. The value of the checkbox switch but visually it doesnt check or uncheck the checkbox."
] | [
"angular",
"checkbox",
"angular-material"
] |
[
"How to update report in access with bound dataset automatically?",
"I have a single entry output from a paradox table which is imported into Access. Now I have created a report and done the databinding within the report to the dataset from Paradox. When work is done in Paradox the single entry output changes...\nHow do I open up access and have the values from the report update automatically without having to reimport the table manually?\n\nThe objective is that when access is opened the report comes up immediately for inspection before printing."
] | [
"excel",
"ms-access",
"vba",
"paradox"
] |
[
"Google App Engine (python) - Connecting to local datastore via python script",
"I've been able to connect from a local script directly to the Google App Engine (GAE) ndb store on the server as described in this article.\n\nBut I'm trying to do the same thing to access my local dev server but am not able to. My dev API server runs at http://localhost:42020 but when I try to connect using the following command:\n\n$ remote_api_shell.py -s http://localhost:42020\n\n\nI get the following error:\n\nTraceback (most recent call last):\n File \"/home/myuser/google_appengine/remote_api_shell.py\", line 127, in <module>\n run_file(__file__, globals())\n File \"/home/myuser/google_appengine/remote_api_shell.py\", line 123, in run_file\n execfile(_PATHS.script_file(script_name), globals_)\n File \"/home/myuser/google_appengine/google/appengine/tools/remote_api_shell.py\", line 150, in <module>\n main(sys.argv) \n File \"/home/myuser/google_appengine/google/appengine/tools/remote_api_shell.py\", line 146, in main\n appengine_rpc.HttpRpcServer)\n File \"/home/myuser/google_appengine/google/appengine/tools/remote_api_shell.py\", line 74, in remote_api_shell\n rpc_server_factory=rpc_server_factory)\n File \"/home/myuser/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py\", line 874, in ConfigureRemoteApi\n app_id = GetRemoteAppIdFromServer(server, path, rtok)\n File \"/home/myuser/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py\", line 569, in GetRemoteAppIdFromServer\n response = server.Send(path, payload=None, **urlargs)\n File \"/home/myuser/google_appengine/google/appengine/tools/appengine_rpc.py\", line 424, in Send\n f = self.opener.open(req) \n File \"/usr/lib/python2.7/urllib2.py\", line 401, in open\n response = self._open(req, data)\n File \"/usr/lib/python2.7/urllib2.py\", line 419, in _open\n '_open', req) \n File \"/usr/lib/python2.7/urllib2.py\", line 379, in _call_chain\n result = func(*args) \n File \"/usr/lib/python2.7/urllib2.py\", line 1211, in http_open\n return self.do_open(httplib.HTTPConnection, req)\n File \"/usr/lib/python2.7/urllib2.py\", line 1181, in do_open\n raise URLError(err) \nurllib2.URLError: <urlopen error [Errno -2] Name or service not known>\n\n\nIs it not possible to connect locally?"
] | [
"python",
"google-app-engine"
] |
[
"React—add a click listener to dangerouslySetInnerHTML sub-element",
"I have this html text:\n\n\"<span id='capo' class='capo' data-capo=3>Capo 3</span>\"\n\n\nThis is part of a larger html that is inserted via dangerouslySetInnerHTML\n\nAnd I have a listener like this:\n\ncomponentDidMount() {\n document.getElementById('capo').addEventListener('click', this.changeKey);\n}\n\n\nHowever this only works for one click—after that the listener doesn't exist. I'm guessing because React has replaced the component (since I change the state in this.changeKey), and therefore the listener no longer exists.\n\nHow do I reliably set a listener for React components?"
] | [
"reactjs"
] |
[
"Add custom CSS to my Polylang widget and remove bullets - using WordPress",
"I am desperately trying to remove the bullets that appear in front of the flags. I am using WordPress and I've added this Polylang feature as a widget in my header. I tried to post a screenshot but I can't upload images yet.\n\nI would also like to custom css this widget but I have tried everything I can think of and nothing is happening. Basically this is placed on the left side of my page when I want it on the right side. Here is the code I used in the my_functions php:\n\nfunction my_widgets_init() {\n\n) );register_sidebar( array(\n'name' => __( 'Header Area', 'your-theme' ),\n'id' => 'sidebar-2',\n'description' => __( 'An optional widget area for your site header', 'your-theme' ),\n'before_widget' => '<div id=\"%1$s\" class=\"headwidget %2$s\">',\n'after_widget' => \"</div>\",\n'before_title' => '<h3>',\n'after_title' => '</h3>',) );\n}\nadd_action( 'widgets_init', 'my_widgets_init' );\n\n\nAnd here is the code used in header.php\n\n <div class=\"span12\" id=\"polylang-2\">\n <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-2') ) : ?> <?php endif; ?></div>\n\n\nI tried entering Custom CSS from the WP admin widgets panel, i have no idea how to code from here I guess cause nothing ever changes... I have already done a lot of customization to my site so I am ok with CSS, it's more finding where to make changes I have trouble with. And php is not my forte yet.\n\nThanks for all your help."
] | [
"css",
"wordpress"
] |
[
"SQL:How to extract the correct date value from a file after bulk insert into a table and get total of amounts?",
"I did a bulk insert into a table.\n\nAll the data is inserted into Data column\n\nI have the something like that inside of a data column:\n\n1451678889 1451678889 2017092 2017092 500,000.00 10,000.00\n1451678889 1451678889 2017091 2017091 500,000.00 10,000.00\n1451678889 1451678889 2017092 2017092 500,000.00 10,000.00\n\n\nNow, I need to get a date from 2017092 in the yyyy-mm-dd format:\nwhere 2017 - year and 92 is a number of the day in this year.\n\nAlso, I will need to get totals grouped by date.\n\nWhen executing this query:\n\nselect substring([data],34,15) from Staging_Table where ltrim(rtrim(substring([Data],42,5))) = '92'\n\n\nI get the correct string 2017092\n\nWhen trying to do that to test the logic:\n\nselect dateadd(day, ltrim(rtrim(right('2017092',3))) - 1, DATEFROMPARTS(left('2017092',4) + 0, 1 ,1))\n\n\nI get this: 2017-04-02 , which is the correct date for year 2017 and day 92\n\nNow, when substituting '2017092' with the actual data from the table:\n\nselect dateadd(day,ltrim(rtrim(right(substring('1451678889 1451678889 2017092 2017092',34,15),3))) - 1, DATEFROMPARTS(left(substring('1451678889 1451678889 2017092 2017092',34,15),4) + 0, 1,1))\n\n\nor querying the actual table:\n\nselect dateadd(day,right(ltrim(rtrim(substring([Data],34,15))),3) - 1, DATEFROMPARTS(left(substring([Data],34,15),4) + 0, 1, 1)) from Staging_Table\nwhere ltrim(rtrim(substring([Data],42,5))) = '92'\n\n\nI'm getting some strange result: 0002-04-02 - with the wrong year.\n\nWhat am I doing wrong?"
] | [
"sql",
"bulkinsert",
"sql-server-2016"
] |
[
"Resource Injection error in JSF",
"I'm using @PostConstruct and a method named init to do some intialization, but when I do any kind of intialization it gives me the following error.\n\n\"An error occurred performing resource injection on managed bean myBean\"\n\n\nFollow is the code:\n\n@PostConstruct\nvoid init() {\n myList.add(\"test\");\n}"
] | [
"java",
"jsf",
"jsf-2"
] |
[
"Can't detect 1080p and higher video url from Youtube",
"I am trying to make a Youtube video downloader by using this php script. I have got it from here.\n\nhttps://github.com/jeckman/YouTube-Downloader \n\nIt works fine and shows direct link up to 720p resolution to download. But unable to detect URL over 720p even though 4k quality is available.\nSo if I want to make 1080p, 1440p, 2160p quality available what will I do.\n\nCurrent script demo \n\nhttp://loader.neq3.com/"
] | [
"php",
"curl",
"youtube"
] |
[
"lookup in dictionary returns unexpected value",
"i have some objects, each object has a point,I created a dictionary for it(I'm not sure if its a best practice),now I want to get the point based on the value,here is what I have done\n var x = new Dictionary< EnemisEntity,int>()\n {\n\n {new EnemisEntity{enemyType="banzai_Bill"},200 },\n {new EnemisEntity{enemyType="beach_koopa" },400 },\n {new EnemisEntity{enemyType="big_boo"},800 },\n {new EnemisEntity{enemyType="blargg"},1600 },\n\n };\n var m= x.FirstOrDefault(f => f.Key.Equals("big_boo")).value;\n\nm supposed to return me 800 but it gives me 0,can you please tell me first of all if its a right way I'm doing and second why it gives me zero"
] | [
"c#"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.