texts
sequence
tags
sequence
[ "AD Microsoft Login 400 bad request headers too long ASP.net MVC", "My asp.net mvc application works as expected on localhost and logs in on every browser with ease. I am using Azure Active directory to log in to the application, I published my application to a web server and now I get a 400 bad request from every browser.\n\nI have tried clearing the cache with no luck.\nI increased the maxRequest and time.\n\n<httpRuntime targetFramework=\"4.6.1\" maxRequestLength=\"2097151\" executionTimeout=\"2097151\"/>\n\n\nI noticed that the browser is attempting to log in but the request is sent over 40 times. I managed to get it working sometimes but once the request is sent to microsoft.login I get the same error.\n\nDoes anyone know of a solution to my problem?\n\nThanks in advance, Adam." ]
[ "c#", "asp.net-mvc", "browser", "webserver", "azure-active-directory" ]
[ "Addon-sdk websocket keeps disconnectiong", "I want to open permanent websocket connection to a server in firefox extension. So I've created page-mod in main.js\n\n_stickyInterface = pageWorker.Page({\n contentURL : self.data.url('wsInterface.html')\n});\n\n\ninterface looks this way:\n\n<html>\n<head>\n <script>\n //const HOST = 'ws://localhost:9099';\n const HOST = 'ws://10.0.0.32:9099';\n // subprotocol-key: used when server handles communication of more applications.\n // With subprotocol is server able to delegate messages for this purpose\n //const STICKY_SUBPROTOCOL_KEY = \"Myris_JsApi\"; \n const STICKY_SUBPROTOCOL_KEY = 'sticky-protocol';\n // internal identifier of this app\n const APP_KEY = \"Myris_Chrome\";\n\n var _connection = null;\n\n var _requestQueue = [];\n\n _connection = new WebSocket(HOST, STICKY_SUBPROTOCOL_KEY);\n\n _connection.onopen = function () {\n\n console.log(\"Sticky Interface: Connection opened.\");\n var JSONObject = new Object;\n JSONObject.appKey = APP_KEY;\n\n _connection.send(JSON.stringify(JSONObject));\n console.log('sent');\n };\n\n _connection.onerror = function (evt) {\n console.log(\"Error \");\n console.log(evt);\n _connection.close();\n }\n\n //ok\n _connection.onclose = function (evt) {\n console.log(\"Close \");\n _connection.close();\n }\n\n _connection.onmessage = function(evt) {\n console.log('MESSAGE');\n }\n\n\n </script>\n</head>\n<body></body>\n</html>\n\n\nConnection is opened, messages are received. But client keeps disconnecting. There is no error message in browser console. Except for these lines (and I think the last two appeard after connection disconnected)\n\nReferenceError: reference to undefined property permissions['private-browsing'] self.js:50\n1413381004615 Services.HealthReport.HealthReporter WARN Saved state file does not exist.\n1413381004615 Services.HealthReport.HealthReporter WARN No prefs data found.\n\n\nand even after then, with some timeout\n\n\"Error \" StickyInterface.html:30\nerror { target: WebSocket, isTrusted: true, NONE: 0, CAPTURING_PHASE: 1, AT_TARGET: 2, BUBBLING_PHASE: 3, ALT_MASK: 1, CONTROL_MASK: 2, SHIFT_MASK: 4, META_MASK: 8, currentTarget: WebSocket } StickyInterface.html:31\n\"Close \" StickyInterface.html:37\nThe connection to ws://10.0.0.32:9099/ was interrupted while the page was loading. StickyInterface.html:17\nGET http://localhost/extensions-dummy/blocklistURL [HTTP/1.1 404 Not Found 13ms]\n\n\nConnection fails, even with no activity mage. Using freshy installed Firefox 33." ]
[ "javascript", "firefox", "websocket", "firefox-addon", "firefox-addon-sdk" ]
[ "Scala- How can I read some specific bytes from a file?", "I'd like to encrypt a text(about 1 MB) and I use the max length of RSA keys(4096 bits). However, the key seems too short. As I googled, I got to know that the max size of text that a RSA can encrypt is 8 bytes shorter than the length of the key. Thus, I can only encrypt 501 bytes in this way. So I decided to divide my text into 2093 arrays (1024*1024/501=2092.1).The question is how can I pour the first 501 bytes into the first array in scala?Anyone who can help me this out?" ]
[ "scala" ]
[ "Text input has focus but doesn't update what I type until after I scroll", "I have a page with an HTML5 video. When I open the Bootstrap modal login dialog with the page scrolled to zero, everything works as expected. When I scroll down the page or open the dialog after scrolling, the username and password input boxes sort of freeze: I can enter text but I won't see it until after I scroll again. The blinky caret will also freeze unless I'm scrolling around the page. If I remove the video tag then everything works fine. This only happens in Chrome (I'm using Version 38.0.2125.104 m). I'm also using AngularJS.\n\nHave any of you encountered a problem like this?" ]
[ "angularjs", "html", "twitter-bootstrap" ]
[ "How to save command line file as .txt file every time. In CMD need to display the speedtest output save the those command line as .txt file", "This is the program as given below\n\nimport os\nimport time\n\n\nindex=0\nfile=open(\"out_{index}.txt\", 'a')\nwhile True:\nps=os.system(f\"speedtest.exe\")\nfile.append(ps)\nindex+=1\ntime.sleep(4)" ]
[ "python-3.x", "networking", "automation" ]
[ "SLide Div in from left and div our from right on link click", "I'm trying to get this effect on a navigation div... http://www.vogue.co.uk/topic/vogue-view (click the menu and filters icons) I have this\n\nvar boxes = $('ul.topLevelNavigation');\n\n$('.button').click(function(e) {\n e.preventDefault();\n var box = $($(this).attr('href'));\n if (!box.hasClass(\"current\")) {\n var current = $('.current');\n current.stop().animate({left: '150%',}, 500 ).removeClass('current');\n box.stop().animate({left: '50%',}, 500 ).addClass('current');\n }\n});\n\n<div id=\"topNavigation\">\n<ul class=\"topLevelNavigation\">\n <a href=\".topLevelNavigation1\" class=\"button\"><li>Link #1</li></a>\n <a href=\".topLevelNavigation2\" class=\"button\"><li>Link #2</li></a>\n <a href=\".topLevelNavigation3\" class=\"button\"><li>Link #3</li></a>\n <a href=\".topLevelNavigation4\" class=\"button\"><li>Link #4</li></a>\n <a href=\".topLevelNavigation5\" class=\"button\"><li>Link #5</li></a>\n <a href=\"#box1\" class=\"button\"><li>Link #6</li></a>\n <a href=\"#box1\" class=\"button\"><li>Link #7</li></a>\n <a href=\"#box1\" class=\"button\"><li>Link #8</li></a>\n <a href=\"#box1\" class=\"button\"><li>Link #9</li></a>\n <a href=\"#box1\" class=\"button\"><li>Link #10</li></a>\n </ul>\n <ul class=\"topLevelNavigation2\">\n <li>Link #1</li>\n <li>Link #2</li>\n <li>Link #3</li>\n <li>Link #4</li>\n <li>Link #5</li>\n <li>Link #6</li>\n <li>Link #7</li>\n <li>Link #8</li>\n <li>Link #9</li>\n <li>Link #10</li>\n </ul></div>\n\n\nCSS\n\n#topNavigation {\nmargin-top:50px;\ntop: 0;\noverflow:hidden;\npostition:absolute;\n}\nul.topLevelNavigation {\nmargin-left: 18px;\nlist-style: none;\n}\nul.topLevelNavigation2, ul.topLevelNavigation3, ul.topLevelNavigation4, {\nmargin-left: -55px;\n}\nul.topLevelNavigation li {\ncolor: #ccc;\nfont-size:24px;\nmargin:5px 0 10px 0;\nborder-bottom: 1px solid #ccc;\npadding-bottom: 10px;\n }\n\n\nA you can see here, it's not working http://keithfrenchdesigns.com/RunwayMag/index.html\n\nI'm pretty new to jQuery, so any help would be amazing!" ]
[ "javascript", "jquery", "html", "css" ]
[ "Starling ImageLoaderCache onComplete", "I am using the image loader cache (http://forum.starling-framework.org/topic/imageloader-with-cache-system) class to load an image remotely and save it in cache however I need to apply a mask using PixelMaskDisplayObject to the image and need to wait for it to complete loading however unsure how to apply an oncomplete event listener. The below doesn't fire.\n\nThanks\n\n// Load remote image into cache\nthis.profileImage = new ImageLoaderCache();\nthis.profileImage.source = \"http://pathtoimage.com/profile.jpg\";\nthis.profileImage.addEventListener(starling.events.Event.COMPLETE, onImageLoadComplete);" ]
[ "actionscript-3", "air", "starling-framework" ]
[ "Use Hibernate or not?", "Hi i have an application in which i want to select data from the table and if not found generate new value and insert into database,and then again the loops stats over check for the next value and so on. This will be done around billion of times for a new request.\n\nSo should i use hibernate or simple JDBC ??\n\nand in hibernate should i use \n\n session.saveOrUpdate(obj);\n\n\nor \n\n session.save(obj);\n\n\nand one more thing i would like to ask is that for each insert do i have to initialize my table class object(new Mytable)? of only set the values will do?\n\nlike\n\n MyTable obj=new Mytable();\n obj.setName(\"dasd\");\n obj.set...\n\nobj.save();\n\n\nor can i just initialize it once\n\n `MyTable obj=new Mytable();`\n\nand in a loop put\nfor(...\nobj.setName(\"dasda\");\nobj.save\n\n)" ]
[ "java", "hibernate", "jdbc" ]
[ "RxJava. Call onError after onNext", "I want to call onNext and then call the onError method. But I can not do it. Can anybody help me? Example:\n\nObservable.create(new ObservableOnSubscribe<String>() {\n @Override\n public void subscribe(ObservableEmitter<String> e) throws Exception {\n e.onNext(\"value\");\n e.onError(new Exception(\"exc\"));\n }\n})\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Consumer<String>() {\n @Override\n public void accept(@NonNull String s) throws Exception {\n Log.v(\"TAG\", s);\n }\n }, new Consumer<Throwable>() {\n @Override\n public void accept(@NonNull Throwable throwable) throws Exception {\n Log.v(\"TAG\", throwable.getLocalizedMessage());\n }\n });\n\n\nOutput: exc\n\nThrad.sleep(500) helps me, but i think this is the wrong way" ]
[ "android", "rx-java" ]
[ "javascript extract email text-parts before and after", "I need to extract an email from a string.\nThe desired output is an array containing the text part before the email,\nthe email,\nand the text after the email.\n\nselection = 'Integer lectus nisi, facilisis sit [email protected] eleifend nec, pharetra ut augue.';\n\npart[0] = 'Integer lectus nisi, facilisis sit ';\npart[1] = '[email protected]';\npart[2] = ' eleifend nec, pharetra ut augue.';\n\n\nWhat i have so far is a function extracting the email but i also need the parts before and after.\n\nfunction extractEmails(selection){\n return selection.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9._-]+)/gi);\n};\n\n$output = extractEmails(selection); //returns '[email protected]'\n\n\nHow can this be done? Thanks!" ]
[ "javascript", "string", "email", "extract" ]
[ "How to load a part of composite keeping others static?", "I have a form in SWT where I have five different composites based on one parent composite.Each of the composite contains different widgets like a single textbox / a combo box / a combination of text and combo etc.\n\nNow the problem is when I click on the button I want to change my third composite to carry a different widget keeping others static.Now I can't reload from the beginning as I want current values of the other widgets to be displayed.How can I fetch only that composite,dispose it and create a new widget in place of that.\n\nCreating and hiding the widget is difficult to consider as it is dynamic to at what place we want to redraw.\n\nHere is the snippet.\n\n formComposite=new Composite(parentComposite,SWT.BORDER_SOLID);\n formLayout=new GridLayout(5,false);\n fromComposite.setLayout(formLayout)\n item.create(formComposite) //Here item is the widget (combo/textbox/combination text/combo)\n\n formComposite1=new Composite(parentComposite,SWT.BORDER_SOLID);\n formLayout1=new GridLayout(5,false);\n fromComposite1.setLayout(formLayout)\n item1.create(formComposite1))\n\n formComposite2=new Composite(parentComposite,SWT.BORDER_SOLID);\n formLayout2=new GridLayout(5,false);\n fromComposite2.setLayout(formLayout)\n item2.create(formComposite2))\n\n formComposite3=new Composite(parentComposite,SWT.BORDER_SOLID);\n formLayout3=new GridLayout(5,false);\n fromComposite3.setLayout(formLayout)\n item3.create(formComposite3))\n\n formComposite4=new Composite(parentComposite,SWT.BORDER_SOLID);\n formLayout4=new GridLayout(5,false);\n fromComposite4.setLayout(formLayout)\n item4.create(formComposite4))\n\n\nNow how can I replace item3 with a different item to be created keeping others static in their place?" ]
[ "java", "layout", "swt" ]
[ "Example of Sidecar Application for Microservices", "Is Spring cloud config server an example of sidecar application for microservices?" ]
[ "spring", "spring-boot", "spring-cloud", "microservices" ]
[ "I am trying to install package manipulate : message = not available for r 3.1.1", "windows 7 -pro \nr studio 0.98.945\nr 3.1.1\n\nI am trying to install manipulate:\n install.packages(\"manipulate\").\n\nWarning in install.packages :\n package ‘manipulate’ is not available (for R version 3.1.1)\n\nis this package not available or is something wrong in my machine or how to get it ?\n\nthanks for all update/help\nbest regards, Guy Przytula" ]
[ "r" ]
[ "How do i add multiple markers in xamarin using for each loop with a list model", "I am trying to add pins on my Xamarin android application. I have already set up the map and I need to create pins from a list array that contains the latitudes and longitudes. I know it's quite simple but I'm stuck here.\nBelow is my sample code.\npublic class Farmers\n {\n public int farmers_id { get; set; }\n public string Farmer_name { get; set; }\n\n public double Long { get; set; }\n public double Lat { get; set; }\n } \n\n private void AddMarker()\n {\n List<Farmers> farmers =GetFarmers();\n\n\n foreach (Farmers p in farmers)\n {\n //HOW TO ADD NEW PINS FOR EACH FARMER ON THE MAP WITH FARMER NAME AS LABEL\n\n }\n }\n\nI'm using Xamarin.Forms.Maps. The issue is more of how to loop." ]
[ "c#", "xamarin", "xamarin.forms.maps" ]
[ "Integration between Rally and Robot framework?", "Does anybody know of an integration between Rally ALM and robotframework?\n\nI'm looking for something that would log test results in robotframework back to Rally test cases.\n\nWith the pyral rally module for Python, seems like it could be fairly straightforward." ]
[ "rally", "robotframework" ]
[ "How the ServerSOAPFaultException has to be handled? how it is different from handling SOAPFaultException?", "While consuming the 3rd party WebServices I am able to handle the SOAPFaultException for example to handle sessiontimeout But Sometimes the same webservices are resulting ServerSOAPFaultException. \n\nCan someone explain me how it is different from SOAPFaultException and how to deal with this exception?\n\ncom.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Your session has timed-out. Please see the server log to find more detail regarding exact cause of the failure.\n com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)\n com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)\n com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)\n com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)\n com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)\n com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)\n com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)\n com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)" ]
[ "java", "web-services", "soap", "wsdl", "soapfault" ]
[ "Use initialization list with boost-parameter", "The following code will not compile because in the last call to 'demo' the compiler cannot deduce a type from the initialization-list. \n\n#include <boost/parameter/name.hpp>\n#include <boost/parameter/preprocessor.hpp>\n#include <iostream>\n#include <array>\n\nBOOST_PARAMETER_NAME(arg)\n\nBOOST_PARAMETER_FUNCTION(\n (void),\n demo,\n tag,\n (optional\n (arg, (std::array<int, 3>), (std::array<int,3>{}))\n )\n )\n{\n std::cout << arg[1] << std::endl;\n}\n\n\nint main()\n{ \n demo();\n demo(_arg=std::array<int,3>({1,2,3}));\n // 28:14: error: no match for 'operator=' \n // (operand types are 'const boost::parameter::keyword<tag::arg>' \n // and '<brace-enclosed initializer list>')\n demo(_arg={1,2,3});\n}\n\n\nIs there a way to combine initialization-lists with boost-parameter without adding an explicit call to the constructor of array?" ]
[ "c++", "initializer-list", "boost-parameter" ]
[ "Set boolean value to FALSE for each row in query with 'HAVING'?", "(Sorry about the phrasing of the title.)\n\nI have the following SQL query that retrieves all the rows I want:\n\nSELECT\n app_activity.name \nFROM\n app_chatmessage\nJOIN\n app_activity ON app_chatmessage.activity_id = app_activity.id\nGROUP BY\n app_activity.name\nHAVING\n COUNT(app_chatmessage.owner_id) = 1;\n\n\nNow, the table app_chatmessage also has a column seen. I'd like to set this column to FALSE for all the rows returned by the aforementioned query. How do I do that?" ]
[ "sql", "postgresql" ]
[ "How to fix this JOIN query?", "I have this query:\n\nSELECT * \nFROM people \nJOIN pets ON people.id = pets.owner_id;\n\n\nIt returns results for people who have pets. But not all people have pets. I want the query to return all persons from the people table and IF they happen to have pets to return the pets also.\n\nBut since pets are optional, how can I make this query return even people with no pets?" ]
[ "mysql", "sql" ]
[ "What is the cache miss rate for an optimal matrix transpose?", "If I have an M x N matrix and an L1 cache of size K what cache miss rate does an optimal matrix transpose have. Obviously I am looking for something that is a function of M and N (and possibly K, though that is maybe too complex) rather than a specific number.\n\nI am asking because I have a lot of matrix data that has to be processed in both directions and I would like a rule of thumb to know when it is worth while keeping both the original data and a transpose in memory." ]
[ "algorithm", "performance", "optimization", "memory-management", "cpu-cache" ]
[ "Adding new content to a session", "I have an asp.net dropdown list and an asp.net gridview control.\n On changing the dropdownlist element , a new row is fetched from the database.\n\nI am storing this in a session .Next time there is a change in the dropdownlist element , there will\nbe a new row fetched from the database and I would like to add that row too , to the session.\n\nI have the dropdownlist_selectedIndexchanged event below :\n\nprotected void ddlClient_SelectedIndexChanged(object sender, EventArgs e)\n {\n int x = int.Parse(ddlClient.SelectedValue);\n\n DataSet ds = GetRowFromDatabase( x);\n Session[\"old\"] = ds;\n ((DataSet)Session[\"old\"]).Merge(ds);\n\n gridview.DataSource = Session[\"old\"] ;\n gridview.DataBind();\n\n}\n\n\nI cannot figure out how to keep appending my rows in the session variable, each time my dropdownlist changes ?" ]
[ "c#", "asp.net", "visual-studio-2010", "sql-server-2008", "session" ]
[ "while loop - Sql Logic", "Input\n\n date | username | program | workflow | Pending_Audits |Audits_Carry_Forward\n\n 31-07-2018 | ram | Pre pay | Sisi | -1 | -12 \n 27-07-2018 | ram | Pre pay | Sisi | -111 | 0\n 25-07-2018 | ram | Pre pay | Sisi | -16 | -14\n\n\nI have the above table I'm writing a while condition to update the Audits_Carry_Forward column from the given date. \n\nThe logic is to update the given date's audits_carry_forward into the next row pending_audits column which has the same program and workflow with respect to the given date \n\nDesired Output:\n\n date | username | program | workflow | Pending_Audits |Audits_Carry_Forward\n\n 31-07-2018 | ram | Pre pay | Sisi | -1 | -111 \n 27-07-2018 | ram | Pre pay | Sisi | -111 | -16\n 25-07-2018 | ram | Pre pay | Sisi | -16 | -14\n\n\nso in this case i want to update the Pending_audits data of '25-07-2018' to the audits_carry_forward that are above the given date.\n\nThe sql Logic I tried\n\nDECLARE @date DATE = '2018-07-25' \nDECLARE @username VARCHAR(100)= 'ram' \nDECLARE @program VARCHAR(100)= 'Pre pay' \nDECLARE @workflow VARCHAR(100)= 'Sisi' \nDECLARE @a INT \n\nWHILE ( @date <= Cast(Getdate() AS DATE) ) \n BEGIN \n SET @a = (SELECT Count(*) \n FROM dbo.homehealthpp1 \n WHERE username = @username \n AND program = @program \n AND workflow = @workflow \n AND date = @date) \n\n IF ( @a = 1 ) \n BEGIN \n UPDATE dbo.homehealthpp1 \n SET audits_carry_forward = (SELECT pending_audits \n FROM dbo.homehealthpp1 \n WHERE username = @username \n AND program = @program \n AND workflow = @workflow \n AND date = @date) \n WHERE username = @username \n AND program = @program \n AND workflow = @workflow \n AND date = Cast(Dateadd(d, 1, @date) AS DATE) \n END \n\n SET @date = Cast(Dateadd(d, 1, @date) AS DATE) \n END \n\n\nThe above case works when the date is sequentially present. but it doesn't work for the scenarios where the date is not sequential like the above case." ]
[ "sql", "sql-server-2008", "while-loop" ]
[ "Why should I use Interfaces in Typescript", "Can anyone tell me why should I use Interface in Typescript and what are they?\n\nExample with Interface:\n\ninterface Person {\n firstName: string;\n lastName: string;\n}\n\nclass Student {\n fullName: string;\n constructor(public firstName: string, public lastName: string) {\n this.fullName = firstName + \" \" + lastName;\n }\n}\n\nfunction greeter(person : Person) {\n return \"Hello, \" + person.firstName + \" \" + person.lastName;\n}\n\nlet student = new Student(\"John\", \"Smith\");\nconsole.log(greeter(student));\n\n\nOUTPUT: Hello, John Smith\n\nExample without Interface same output:\n\nclass Student {\n fullName: string;\n constructor(firstName: string, lastName: string) {\n this.fullName = firstName + \" \" + lastName;\n }\n}\n\nfunction greeter(person : Student) {\n return \"Hello, \" + person.fullName;\n}\n\nlet student = new Student(\"John\", \"Smith\");\nconsole.log(greeter(student));\n\n\nOUTPUT: Hello, John Smith\n\nWhy is interface useful in this particular case? I find it hard to understand use of interface in typescript. Any detailed explanation is very appreciated!" ]
[ "javascript", "typescript" ]
[ "Urllib2 downloads broken binary data", "Here is sample code of downloading images using urllib2:\n\nfor photo in getListOfPhotos('Anouk'):\n with open(photo[0]+'.jpg','w+') as f:\n response = urllib2.urlopen(photo[1])\n answer = response.read()\n while answer:\n f.write(answer)\n f.flush()\n answer = response.read() \n\n\n(assuming that photo is list where first item is file name and second item is link)\n\nBut I get broken pictures (with green lines, red squaers etc). What's wrong?" ]
[ "python", "urllib2" ]
[ "Replace special strings from all columns of data.frame in R using dplyR", "My data frame looks like this\nvalue <- c(0,0.1,0.2,0.4,0,"0.05,",0.05,0.5,0.20,0.40,0.50,0.60)\ntime <- c(1,1,"1,",1,2,2,2,2,3,3,3,3)\nID <- c("1,","2,","3,",4,1,2,3,4,1,2,3,4)\n\ntest <- data.frame(value, time, ID)\ntest\n\n value time ID\n1 0 1 1,\n2 0.1 1 2,\n3 0.2 1, 3,\n4 0.4 1 4\n5 0 2 1\n6 0.05, 2 2\n7 0.05 2 3\n8 0.5 2 4\n9 0.2 3 1\n10 0.4 3 2\n11 0.5 3 3\n12 0.6 3 4\n\nI want to replace the "," from all columns with "" but I am still getting an error\nError in UseMethod("tbl_vars") :\nno applicable method for 'tbl_vars' applied to an object of class "character"\nI would like my data to look like this\n value time ID\n1 0.00 1 1\n2 0.10 1 2\n3 0.20 1 3\n4 0.40 1 4\n5 0.00 2 1\n6 0.05 2 2\n7 0.05 2 3\n8 0.50 2 4\n9 0.20 3 1\n10 0.40 3 2\n11 0.50 3 3\n12 0.60 3 4\n\nEDIT\ntest %>% \nmutate_all(~gsub(",","",.))" ]
[ "r", "dplyr", "tidyverse", "tidyr" ]
[ "Angular 4: watch controller variable", "Let's say i have an old code, which i don't wanna to change. I have three server-calls, to get some data, and i have to run some code after all this three methods succeed. I've added variable, and i wanna listen on it's changes (ngOnChanges won't work).\n\nHere is code:\n\nngOnInit() {\n this.loadedReq = 0; // When this var is 3 - then all requests passed, and i have to run some custom code, how to watch on this variable?\n\n this.getCars();\n this.getModels();\n this.getTypes();\n}\n\ngetCars() {\n return this.myService.getCars(this.clientId)\n .subscribe((response) => {\n this.loadedReq++;\n });\n}\n\ngetModels() {\n return this.myService.getModels(this.clientId)\n .subscribe((response) => {\n this.loadedReq++;\n });\n}\n\ngetTypes() {\n return this.myService.getTypes(this.clientId)\n .subscribe((response) => {\n this.loadedReq++;\n });\n}\n\nsomeMethodWhenAllLoaded(){}\n\n\nis it possible somehow? without changing methods (i mean implement huge RxJs logic on responses etc)?\n\nif not, then how to create a workaround here?" ]
[ "angular", "typescript", "rxjs" ]
[ "How to implement lstm with fully connected neural network on both input and outputs using tflearn?", "I need to implement a lstm where both the input and outputs are passed through fully connected neural network? Right now, I am jumping through hoops to implement this. I need to know if this will work and if it can be implemented more efficiently\n\n inputs = tflearn.input_data(shape=[None, seq_len, ip_dim]) ## (samples, timesteps, ip_dim)\n net = tflearn.reshape (inputs, new_shape = [-1, ip_dim])\n net = tflearn.fully_connected(net, 300, weights_init = tflearn.initializations.xavier())\n net = tflearn.reshape (net, new_shape = (-1, seq_len, 300))\n\n net = tflearn.gru(net, 400, activation='relu',return_seq = True, dynamic = False, weights_init = tflearn.initializations.xavier())\n net = tf.concat(net, axis = 0)\n\n net = tflearn.fully_connected(net, self.a_dim, weights_init = tflearn.initializations.xavier())" ]
[ "tensorflow", "lstm", "tflearn" ]
[ "Why is mod_rewrite adding var/www/html to the resulting url", "I am trying to make my service backward compatible, since I have moved the service to a new path internaly, I still want the users to access it with the old url as not all of them have knowledge of this change.\n\nI can accomplish what I want if I add [R] flag at the end of my rewrite rule but it redirects the url on the client side, which I don't want.\n\nMy rewrite code:\n\n<IfModule mod_rewrite.c>\n RewriteEngine On\n RewriteRule ^/old-path(.*)$ /new-path/$ [L]\n</IfModule>\n\n\nAlthough this rule results in the following url:\n\n\n /var/www/html/new-path\n\n\nSample request looks something like:\n\n\n https://host-name/old-path/param1/param2/param3/param4\n\n\nand rewrite rule should just replace old-path with the new-path.\n\nCan anyone give me some clues about what am I doing wrong? and how can I fix it?\n\nThanks in advance!" ]
[ "apache", ".htaccess", "mod-rewrite", "url-rewriting" ]
[ "SQL want to avoid repeated rows", "I have a table like this:\n\nEmployee\n| id | name | department |\n| 01 | Joe | Network |\n| 02 | Sam | Quality |\n| 03 | Mark | Network |\n| 04 | Pete | Quality |\n\n\nAnd other table like this:\n\nHours\n| id | date | hours |\n| 01 | 1/1/11 | 7 |\n| 02 | 1/2/11 | 15 |\n| 03 | 1/5/11 | 13 |\n| 01 | 1/7/11 | 5 |\n| 01 | 1/11/11 | 9 |\n| 02 | 1/11/11 | 11 |\n| 03 | 1/12/11 | 14 |\n| 04 | 1/12/11 | 14 |\n\n\nI want to query this: show the person who achieve the max total hours from each department (sorted from the max to the min)\n\n| id | Name | Department | totalhours |\n| 03 | Mark | Network | 27 |\n| 02 | Sam | Quality | 26 |\n\n\nMy current code doesnt work, just showsme the total hours of each person:\n\nSELECT e.name, e.department, SUM(h.hours) AS total\nFROM employee e JOIN hours h ON e.id = h.id\nGROUP BY e.name, e.department\nORDER BY total DESC;\n\n\nWhat i need to do? \n\ni tried something like this...\n\nSELECT e.name, e.department, t.total\nFROM (\n SELECT e2.department, SUM(h.hours) AS total\n FROM employee e2 JOIN hours h ON e2.id=h.id \n GROUP BY e2.department, h.hours\n ) t JOIN employee e JOIN hours h ON e.id=h.id ON e.department = t.department AND t.total = h.hours\n\nORDER BY t.total DESC;\n\n\nBut this shows crazy results ( i think my code is crazy lol)\n\nPLEASE HELP!!\nThanks!!" ]
[ "sql", "database", "postgresql" ]
[ "How do I create an \"internet calendar subscription\" for Outlook?", "Currently, the user adds a \"new internet calendar\", but it's a one-time download of the ICS file. I want the user to click a button to get his personal calendar added as a subscription to Outlook. I want the automatically updating \"internet calendar subscription\".\n\nLike in SharePoint, the button called \"Connect to Outlook\" which adds the calendar you're viewing to your Outlook as an automatically syncing calendar." ]
[ "asp.net-mvc-4", "outlook", "icalendar" ]
[ "Running PHP script from the command line", "How can I run a PHP script from the command line using the PHP interpreter which is used to parse web scripts?\n\nI have a phpinfo.php file which is accessed from the web shows that German is installed. However, if I run the phpinfo.php from the command line using - php phpinfo.php and grep for German, I don't find it. So both phps are different. I need to run a script which the php on which German is installed.\n\nHow can I do this?" ]
[ "php", "command-line" ]
[ "AES encrypt not working in php", "below code runs in PHP it will returns empty string. But same query run in mysql it shows some values.\n\n<?php\n $encrypt_query = \"select aes_encrypt('$string','$key') as encrypt_data\";\n $encrypt_result = mysql_query($encrypt_query); \n print_r($encrypt_result);// it returns resource id #7\n $row = mysql_fetch_array($encrypt_result);\n return $row['encrypt_data'];//it return empty\n?>" ]
[ "php" ]
[ "Error: read ECONNRESET , while running the python child process from nodejs", "I am getting the error while running python child process on EC2 Ubuntu from node js. The spawned child process is never invoked by node.js, however things are working perfectly fine on local.\nWe initially were getting an EPIPE error, until we used 'sudo apt-get install libfontconfig' which then produced this error below:\n\nevents.js:160\n throw er; // Unhandled 'error' event\n ^ //error Error: read ECONNRESET\n at exports._errnoException (util.js:1020:11)\n at Pipe.onread (net.js:568:26)\n\n\n\n //child process \n urlCrawlJob(hostname, pageCounter+1, accessToken); //recursive calling of the function\n\n\n var process = SPAWN('python', [PATH.join(__dirname,\"../pyScripts/crawler.py\")]),\n\n data = body.customers;\n dataString = '';\n\n console.log(`Spawned child pid: ${process.pid}`);\n process.stdout.on('error', function (err) {\n console.log('stdout error: ', err);\n console.log(err.code);\n });\n\n process.stdout.on('data', function(data){\n dataString+=data\n console.log(dataString);\n });\n process.stdout.on('end', function(){\n\n console.log(\"ending child process -----> call url\");\n\n });\n process.stdin.write(JSON.stringify({\"data\":data,\"hostname\":hostname}));\n process.stdin.end(); \n\n //python script\n\n## process_init.py\n\n#crete seperate function, impletment oop concepet\n\nimport sys, json, pymongo, os\n\n\n#defaukt address, email, phnNo, total spe\n\nprint \"==> in crawler python\"\n\n#print sys.args[0];\n\ndef main():\n data = json.load(sys.stdin)\n hostname = data['hostname'];\n customerData = data['data'];\n\n print hostname\n\n\n collection = dbConnection(hostname)\n\n\n #isFile = open(\"/crawlerResult/\"+hostname+\".txt\",\"w+\")\n\n\n pwd = os.getcwd()\n\n print pwd\n file = open(pwd+\"/crawlerResult/\"+hostname+\".txt\", \"a++\")\n\n iteratingData(customerData, file, collection)\n\n\n print \"=====\\n\\n\"\n client.close(); #close the db connection\n sys.stdout.flush(); \n\ndef dbConnection(hostname):\n\n #opening connection with db\n client = pymongo.MongoClient('127.0.0.1', 27017) ; # TODO: if connection already open do not open neew one\n # print client\n db = client[\"customerLTV\"];\n print db\n collection = db[hostname];\n return collection\n\n\ndef iteratingData(customerData, file, collection):\n\n count = 0\n data = {}\n for i in customerData:\n #print i\n count += 1\n #print len(i[\"addresses\"]);\n\n try:\n\n\n strdata = {}\n strdata[count] = data \n strdata = json.dumps(strdata)\n file.write(strdata + \"\\n\") \n\n\n data.pop('_id', None)\n collection.insert(data) \n data = {}\n except Exception, e:\n print str(e)\n\n print count;\n\n\n\n\n#start process\nif __name__ == '__main__':\n main()" ]
[ "python", "node.js", "amazon-ec2" ]
[ "Indy HTTP: Cannot change Host header", "I'm trying to change Host header before sending get request to a website. I do that using this code:\n\nIdHTTP1.Request.HOST := 'example.com';\nmemo1.Text := IdHTTP1.Get('http://stackoverflow.com');\nshowmessage(IdHTTP1.Request.Host); // Expected to be example.com but it's stackoverflow.com \n\n\nI've got a big problem here. Even though I change Host header before getting URL, Host header will change to stackoverflow.com again. What am I doing wrong? I want to change request header to example.com.\n\nThanks" ]
[ "delphi", "http", "indy", "indy10", "delphi-xe7" ]
[ "jQuery table row filter - hide and show at the same time", "I have a table which contains a column with keywords and a select field (css class .filter) with options and values that correspond to those keywords.\n\nIt works fine until I change the select field to another option. With the following code everything is hidden obviously. But to add a .show() for every row before the hiding does not work (nothing gets hidden anymore). To show the selected rows after hiding does not work either.\n\n$(\".filter\").change(function () {\n if ($(this).val() != \"all\") {\n $(\"tbody\").find(\"tr:not(:contains('\"+$(this).val()+\"'))\").hide(); //hide everything except what contains the selected option\n\n } else {\n $(\"tbody\").find(\"tr:hidden\").show(); // reset the filter and show everything\n }\n });" ]
[ "jquery", "hide", "show" ]
[ "what causes the difference in interpretation of = and == in a shell script?", "I recently updated to Ubuntu 13.04 and one of my shell scripts broke with this:\n\n#!/bin/sh \n...\nif [ \"$SHOW_USAGE\" == \"true\" ]; then\n\n./install.sh: 248: [: false: unexpected operator\n\n\nNow, I understand that I can fix this by replacing the double-equal ('==') with a single equal ('='), but what caused this difference in Ubuntu behavior between 13.04 and previous Ubuntu releases? And is there a way to restore the more flexible interpretation that the previous releases had?" ]
[ "linux", "shell", "ubuntu" ]
[ "What is the difference between pull and clone in git?", "What is the difference between doing (after mkdir repo and cd repo):\n\ngit init\ngit remote add origin git://github.com/cmcculloh/repo.git\ngit fetch --all\ngit pull origin master\n\n\nand\n\ngit clone git://github.com/cmcculloh/repo.git\n\n\nI mean, obviously one is shorter, but other than that are they basically doing the same thing?" ]
[ "git", "clone", "pull" ]
[ "How to expire refresh token after 15 minutes on grails spring security rest application", "We are working in a Grails 3.2.12 project using Spring Security Core(3.0.0) and Spring Security Rest plugin(2.0.0.M2) for user authorization and access control.\n\nNow, we need to implement a way to expire the user access after 15 minutes of inactive in the system.\n\nThe project is configured to expire the access token 15 minutes after login and the refresh token process is inactive, so, the user need to login again.\n\nThe problem is that refresh token never expire by default, and if we implement the refresh token process, the user access never expire.\n\nWhat is the solution that we planned: We will change the expiration time of access token for 5 minutes, and create an expiration time for the refresh token for 15 minutes.\n\nThere are any way to create an expiration time for the refresh token on grails spring security rest plugin?" ]
[ "grails", "spring-security-rest" ]
[ "How to retain a variable when page expires", "Hi have a variable stored on the session which contains information on which stylesheet to use. \n\nWhen the session times out I want to retain the same stylesheet on the \"sessionExpired\" page. How is the best way to do this?" ]
[ "jsf-2.2" ]
[ "Excel filter duplicate items in column and sum values", "For example:\n\n|Apples|2|\n|Apples|3|\n|Pears |4|\n|Pears |2|\n\n\nWould result in:\n\n|Apples|5|\n|Pears |6|\n\n\nBut they are not grouped like this.\n\nI've been asked to do this for a friend, I'm a Linux user and I'd usually do this kind of thing in Python, but they need it in their Excel spreadsheet. I'd expect a VB macro would be the way this is done, but any method is fine." ]
[ "excel" ]
[ "Amazon Cloudfront private distribution - links to images inside CSS", "I created a private distribution in Cloudfront to prevent hotlinking. I managed to create links to my objects with signed URL which is working fine now.\n\nMy only concerns, is that images link inside my css stylesheets are not working because they are not signed. So if I have, for instance:\n\nbackground-image: url('../img/bg.png');\n\n\nThe background image is not going to show up since the stylesheet does not include a signed url, and therefore, Cloudfront refuses to serve the content.\n\nIs there anything I can do to prevent this ?" ]
[ "php", "amazon-s3", "amazon-web-services", "amazon-cloudfront" ]
[ "Storing test files in the test project", "I wrote some tests that use XML files. I have two project one with code, the second with tests. I would like to store this XML files (they contain some data used during the tests) in the test project. But it is not possible because it seems that only files from src project are loaded to a device. Does anyone know the way to solve this problem ?" ]
[ "android", "xml", "unit-testing", "android-testing" ]
[ "Spring Webflux - aop - How to get request/response body", "I am using Spring-webflux to create RouterFunction and Handler. I have \n@Aspect for My handler functions as follow to store ServerRequest body and ServerResponse body in in database.But when try to get Object my request is getting hanged. Is there any sample code to achieve this functionality. \n\n@Around(\"@annotation(Log\")\npublic Object log(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {\n Object o = proceedingJoinPoint.proceed();\n ServerRequest serverRequest = ServerRequest.class.cast(proceedingJoinPoint.getArgs()[0]);\n Mono<Customer> customerMono = serverRequest.bodyToMono(Customer.class);\n Customer customer = customerMono.block() //Request Hanged here\n log.info(\"customer\" + customer);\n return o;\n}" ]
[ "spring", "spring-boot", "spring-webflux" ]
[ "Javascript for text highlight tooltip in mobile browsers", "I want to open a tooltip beside text selected in a mobile browser (e.g., Chrome in Android). Since text selection in mobile browsers does not trigger mouse events, I cannot use mouseup event.\n\ndocument.addEventListener(\"selectionchange\", function(event) {\n\n var text = window.getSelection().toString();\n var tooltip = document.getElementById('tooltip');\n var x = event.clientX; // The problem\n var y = event.clientY; // The Problem\n tooltip.innerHTML = text;\n tooltip.style.top = x + 'px';\n tooltip.style.left = y + 'px';\n});\n\n\nThe problem is that ClientX and ClientY do not work with selectionchange.\n\nCheck the JSFiddle." ]
[ "javascript", "mobile-browser" ]
[ "midl cannot find C preprocessor cl.exe", "I am trying to compile my arith.idl file with midl. I am running windows 7 pro.\n\nHere is the command I launch in a powershell prompt:\n\nPS> 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\midl.exe' .\\arith.idl\n\nMicrosoft (R) 32b/64b MIDL Compiler Version 7.00.0555\nCopyright (c) Microsoft Corporation. All rights reserved.\n64 bit Processing .\\arith.idl\nmidl : command line error MIDL1005 : cannot find C preprocessor cl.exe\nPS>\n\n\nI am quite a noob at windows RPC programming, I would highly appreciate some help. I have read this but this does not resolve anything (same symptoms). I have also tried specifying the preprocessor cl.exe with this command:\n\nPS C:\\> & 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\midl.exe' /cpp_cmd 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\cl.exe' C:\\Users\\$e\\Desktop\\MIDL\\arith.idl\n\nMicrosoft (R) 32b/64b MIDL Compiler Version 7.00.0555\nCopyright (c) Microsoft Corporation. All rights reserved.\nProcessing C:\\Users\\philippe.CHIBOLLO\\Desktop\\MIDL\\arith.idl\nPS C:\\>\n\n\nThis command does not return anything and \n\necho $?\n\n\nreturns False\n\nEDIT:\n\nThe execution of the vcvarsall.bat file does not change anything. Here is the output of the powershell command I launched:\n\nPS C:\\> & 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat'\nSetting environment for using Microsoft Visual Studio 2010 x86 tools.\nPS C:\\> & 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\midl.exe' /cpp_cmd 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\cl.exe' C:\\Users\\$me\\Desktop\\MIDL\\arith.idl\nMicrosoft (R) 32b/64b MIDL Compiler Version 7.00.0555\nCopyright (c) Microsoft Corporation. All rights reserved.\nProcessing C:\\Users\\$me\\Desktop\\MIDL\\arith.idl\nPS C:\\> echo $?\nFalse\nPS C:\\>" ]
[ "windows", "powershell", "rpc", "midl" ]
[ "Increasing file upload size and solving 413 error for nginx in AWS Elastic Beanstalk for .NET Core", "I am using Elastic Beanstalk and searching for an in-code solution to increasing user file upload max size. Right now I get "413 Request Entity too large if I try" to upload say a picture of 10+MB. Nginx as a proxy server is automatically denying the request. I am using Amazon Linux 2 as the OS.\nSSH solutions will not work for me as EC2 instances may go down at any point and redeploy without this file (storage is ephermal) which is bad for my users.\nThe solutions provided here do not seem to work for .NET Core either, with the mix of config and conf files. One comment mentioned that I could try updating the web .config file and so I did, placing it inside /.platform/ with the content:\n<?xml version="1.0" encoding="utf-8"?>\n<configuration>\n\n <bindings>\n\n <basicHttpBinding>\n\n <binding maxBufferPoolSize="2147483647"\n\n maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">\n\n <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"\n\n maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />\n\n <security mode="TransportCredentialOnly">\n\n <transport clientCredentialType="Ntlm" />\n\n </security>\n\n </binding>\n\n </basicHttpBinding>\n\n </bindings>\n\n</configuration>\n\nBut this does not have any effect on the upload limit.\nI have also tried adding a .sh script in .platform/hooks/postdeploy, hoping to modify instance after deployment with:\n#!/bin/bash\nsudo echo "client_max_body_size 100M;" > /etc/nginx/conf.d/proxy.conf\nsudo nginx service restart \n\nBut this causes the deployment to fail with "exec format error", changing the shebang to #!/bin/sh or #!/usr/bin/bash did not help either.\nDoes anyone know what I can do to increase file size limits with .NET Core, or make Amazon Linux 2 accept bash scripts?" ]
[ "amazon-web-services", "nginx", ".net-core", "amazon-elastic-beanstalk" ]
[ "Passing in Params to JS.ERB file from controller? [Rails 3]", "I am trying to allow users to \"import\" saved Missions into a Syllabus post. A Syllabus has many Missions, and the Syllabus form is a nested form where the user can 'Add Missions,' which will append a new Missions textbox. \n\nWhen I \"import\" missions, I want the javascript to\n 1. click \"add missions\" link (which adds a nested form) \n 2. input values of the \"imported missions\" into the ckeditor textbox.\n\n_IMPORT_FORM.HTML.ERB\n\n <%= form_tag(import_missions_path, :method => :post, :id => \"import-js\" ) do |f| %>\n <ul>\n <% current_user.folders.find_by_order(1).missions.each do |mission| %>\n<li> <%= check_box_tag \"mission_ids[]\", mission.id %>\n <%= mission.id.to_s + \". \" + mission.title %> </li>\n <% end %>\n </ul>\n <%= submit_tag \"Import \", :class => 'btn btn-primary' %>\n<% end %>\n\n\nthis then goes to SYLLABUSES#IMPORT\n\ndef import\n@missions_hash = []\n #loop through each mission id from :missions_id\nparams[:mission_ids].each do |id|\n @missions_hash << Mission.find(id)\nend\nrespond_to do |format|\n format.html { redirect_to edit_syllabus_path(@syllabus), notice: \"imported\" }\n format.js { render 'folders/import.js' }\nend\nend\n\n\nwhich I then want to render IMPORT.JS.ERB file, and pass in the @missions_hash. The code below is probably wrong, and this is where I need help fixing it.\n\nIMPORT.JS.ERB\n\n//loop for each mission passed in \n<% @mission_hash.each do |mission| %>\n //click add missions\n $('#add-missions-button').trigger('click');\n //pass in mission.title & mission.content to form textbox value\n<% end %>\n\n\nWhat is the correct syntax to pass in the Ruby params into this Javascript.erb file? Also, I want to copy the 'title' and 'content' of the imported Missions into the newly added mission form box:\n\n <%= f.text_field :title, :class =>'row span6' %>\n <%= f.cktext_area :content, :toolbar => 'MyToolbar', :class => 'row span6', :rows => '5', :placeholder => \"What is the first step a learner should do? (e.g. Watch an intro video, read certain article)\" %>\n\n\nHow would I copy it into the values of these textboxes, so the user can edit it after importing?\n\nI realize this question is badly organized, but I tried to make it as simple as possible without explaining the entire background. I'm still a beginner so please understand.." ]
[ "javascript", "ruby-on-rails", "ruby-on-rails-3", "forms", "parameters" ]
[ "Conversion of Json String by converter vs deserialization", "I have a client server application where client sends data in json string format, when I receive the message I want this message to be converted to concrete type[defined in different assembly], here I have two options:\n\nuse type converter to convert string to concrete type.\nuse a deserializer to convert to concrete class.\nI tried to understand which option is better but could not get any concrete comparisons.\nCan anybody please explain the advantage and limitations of both?" ]
[ "c#", "json", ".net", "deserialization", "converters" ]
[ "what is the range of apache tomcat listener ports?", "I am aware of using netstat cmd in unix to find out the ports that are in use. But I am wondering how to determine the range of available apache tomcat listener ports to deploy an HTTP web application ?" ]
[ "tomcat" ]
[ "How can I hide a table in a particular database?", "In my database I have a table called Price.\n\nI want to hide this table. Is this possible ?" ]
[ "security", "sql-server-2008" ]
[ "QT-creator 2.8 wont deploy to android, ant clean debug failed", "I just downloaded qt-creator 2.8 and tried deploying my current android project only to get the error: :-1: error: Packaging Error: Command '/usr/bin/ant clean debug' failed.Exit code: 1\n\nI ran ant clean and ant clean debug manually and they worked fine. I also deployed the same project using qt-creator 2.7.1 successfully so I don't think its a java file issue but rather a Qt-creator related one. The same error reproduces regardless of the project, even with a qt hello world. I've tried deleting all of the build and android folders and rebuilding but that didn't work either. \n\nDoes anyone know why it wouldn't work? \n\nMy system is: 3.8.0-23-generic #34-Ubuntu SMP Wed May 29 20:22:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux" ]
[ "android", "c++", "qt", "ant", "qt-creator" ]
[ "Trying to accurately measure 3D distance from a 2D image", "I am trying to extract out 3D distance in mm between two known points in a 2D image. I am using square AR markers in order to get the camera coordinates relative to the markers in the scene. The points are the corners of these markers. \n\nAn example is shown below:\n\n\n\nThe code is written in C# and I am using XNA. I am using AForge.net for the CoPlanar POSIT\nThe steps I take in order to work out the distance:\n\n1. Mark corners on screen. Corners are represented in 2D vector form, Image centre is (0,0). Up is positive in the Y direction, right is positive in the X direction.\n\n2. Use AForge.net Co-Planar POSIT algorithm to get pose of each marker:\n\n float focalLength = 640; //Needed for POSIT\n float halfCornerSize = 50; //Represents 1/2 an edge i.e. 50mm\n AVector[] modelPoints = new AVector3[]\n {\n new AVector3( -halfCornerSize, 0, halfCornerSize ),\n new AVector3( halfCornerSize, 0, halfCornerSize ),\n new AVector3( halfCornerSize, 0, -halfCornerSize ),\n new AVector3( -halfCornerSize, 0, -halfCornerSize ),\n };\n CoplanarPosit coPosit = new CoplanarPosit(modelPoints, focalLength);\n coPosit.EstimatePose(cornersToEstimate, out marker1Rot, out marker1Trans);\n\n\n3. Convert to XNA rotation/translation matrix (AForge uses OpenGL matrix form):\n\n float yaw, pitch, roll;\n marker1Rot.ExtractYawPitchRoll(out yaw, out pitch, out roll);\n\n Matrix xnaRot = Matrix.CreateFromYawPitchRoll(-yaw, -pitch, roll);\n Matrix xnaTranslation = Matrix.CreateTranslation(marker1Trans.X, marker1Trans.Y, -marker1Trans.Z);\n Matrix transform = xnaRot * xnaTranslation;\n\n\n4. Find 3D coordinates of the corners:\n\n //Model corner points\n cornerModel = new Vector3[]\n {\n new Vector3(halfCornerSize,0,-halfCornerSize),\n new Vector3(-halfCornerSize,0,-halfCornerSize),\n\n new Vector3(halfCornerSize,0,halfCornerSize),\n new Vector3(-halfCornerSize,0,halfCornerSize)\n };\n\n Matrix markerTransform = Matrix.CreateTranslation(cornerModel[i].X, cornerModel[i].Y, cornerModel[i].Z);\n cornerPositions3d1[i] = (markerTransform * transform).Translation;\n\n //DEBUG: project corner onto screen - represented by brown dots\n Vector3 t3 = viewPort.Project(markerTransform.Translation, projectionMatrix, viewMatrix, transform);\n cornersProjected1[i].X = t3.X; cornersProjected1[i].Y = t3.Y;\n\n\n5. Look at the 3D distance between two corners on a marker, this represents 100mm. Find the scaling factor needed to convert this 3D distance to 100mm. (I actually get the average scaling factor):\n\n for (int i = 0; i < 4; i++)\n {\n //Distance scale;\n distanceScale1 += (halfCornerSize * 2) / Vector3.Distance(cornerPositions3d1[i], cornerPositions3d1[(i + 1) % 4]);\n }\n distanceScale1 /= 4;\n\n\n6. Finally I find the 3D distance between related corners and multiply by the scaling factor to get distance in mm:\n\n for(int i = 0; i < 4; i++)\n {\n distance[i] = Vector3.Distance(cornerPositions3d1[i], cornerPositions3d2[i]) * scalingFactor;\n }\n\n\nThe distances acquired are never truly correct. I used the cutting board as it allowed me easy calculation of what the distances should be. The above image calculated a distance of 147mm (expected 150mm) for corner 1 (red to purple). The image below shows 188mm (expected 200mm). \n\n\n\nWhat is also worrying is the fact that when measuring the distance between marker corners sharing an edge on the same marker, the 3D distances obtained are never the same. Another thing I noticed is that the brown dots never seem to exactly match up with the colored dots. The colored dots are the coordinates used as input to the CoPlanar posit. The brown dots are the calculated positions from the center of the marker calculated via POSIT.\n\nDoes anyone have any idea what might be wrong here? I am pulling out my hair trying to figure it out. The code should be quite simple, I don't think I have made any obvious mistakes with the code. I am not great at maths so please point out where my basic maths might be wrong as well..." ]
[ "c#", "math", "graphics", "xna", "computer-vision" ]
[ "How to find a predicted number in the multiple linear regression model?", "The Question asked me to find the predicted number of passengers for the average ship \n\nI've calculated out the β using matrix operations and the lm function in R to estimate the model. But how to calculate a predicted number for the average ship? Thanks \n\ncship <- read.csv(\"C:/Users/Yuxi Liu/Desktop/cruise_ship.dat.csv\")\ncolnames(cship)=c(\"ShipName\",\"CruiseLine\",\"Age\",\"Tonnage\",\"passengers\",\"Length\",\"Cabins\",\"pdensity\",\"crew\")\ncship_model = lm(passengers ~ Age + Tonnage + Length, data = cship)\ncoef(cship_model)\nn = nrow(cship)\np = length(coef(cship_model))\nX = cbind(rep(1, n), cship$Age, cship$Tonnage, cship$Length)\ny = cship$passengers\n\nt(X) %*% X\nt(X) %*% y\n\n(beta_hat = solve(t(X) %*% X) %*% t(X) %*% y)\n\ncship_model = lm(passengers ~ Age + Tonnage + Length, data = cship)\ncship_model" ]
[ "r", "linear-regression", "prediction" ]
[ "Select Same Column From 2 Tables into 1 Column in View", "I have two column with the same name in different tables. \nI want to join them into one column in a view. \n\nHere my first table stocks:\n\n+----------+------------+------------+---------+----------------+--------+\n| stock_id | stock_cost | stock_left | item_id | purchasedtl_id | trx_id |\n+----------+------------+------------+---------+----------------+--------+\n| 1 | 1000 | 0 | 1 | 1 | 1 |\n| 2 | 1000 | 5 | 1 | 2 | 2 |\n| 3 | 1000 | 1 | 1 | 3 | 4 |\n+----------+------------+------------+---------+----------------+--------+\n\n\nSecond table stocks_out\n\n+-------------+----------------+--------------+---------+----------+------------+--------+\n| stockout_id | stockout_price | stockout_qty | item_id | stock_id | saledtl_id | trx_id |\n+-------------+----------------+--------------+---------+----------+------------+--------+\n| 1 | 2000 | 1 | 1 | 1 | 1 | 3 |\n+-------------+----------------+--------------+---------+----------+------------+--------+\n\n\nAnd I want to join them to be like this trx_id, trx_no, trx_closetime, trx_type stock_id, stock_cost, stockout_id, stock_out_cost, stockout_price, item_id\n\nitem_id is the field I want to join in one column. \n\nThe current Query is : \n\nselect `transactions`.`trx_id` AS `trx_id`,`transactions`.`trx_no` AS `trx_no`,`transactions`.`trx_closetime` AS `trx_closetime`,`transactions`.`trx_type` AS `trx_type`,`stocks`.`stock_id` AS `stock_id`,`stocks`.`stock_cost` AS `stock_cost`,`stock_out`.`stockout_id` AS `stockout_id`,`stock_out`.`stockout_price` AS `stockout_price` from ((`transactions` left join `stocks` on(`stocks`.`trx_id` = `transactions`.`trx_id`)) left join `stock_out` on(`stock_out`.`trx_id` = `transactions`.`trx_id`)) order by `transactions`.`trx_closetime`;\n\n\nAnd the current result: \n\n+--------+---------------------+---------------------+----------+----------+------------+-------------+----------------+\n| trx_id | trx_no | trx_closetime | trx_type | stock_id | stock_cost | stockout_id | stockout_price |\n+--------+---------------------+---------------------+----------+----------+------------+-------------+----------------+\n| 1 | 02002-02-170415-001 | 2017-04-15 19:40:03 | 2 | 1 | 1000 | NULL | NULL |\n| 2 | 02002-02-170415-002 | 2017-04-15 19:40:13 | 2 | 2 | 1000 | NULL | NULL |\n| 3 | 02002-01-170415-001 | 2017-04-15 19:40:57 | 1 | NULL | NULL | 1 | 2000 |\n| 4 | 02002-02-170415-003 | 2017-04-15 19:41:14 | 2 | 3 | 1000 | NULL | NULL |\n+--------+---------------------+---------------------+----------+----------+------------+-------------+----------------+" ]
[ "mysql", "sql", "select", "join", "view" ]
[ "How to implement the user authentication module in open mct?", "I am trying to implement the user authentication module in open mct iot tools by NASA.\nSo here the story is simple\nThere are 3 levels for user levels, admin, manager, user.\nWhen each of leveled user access with their password, then they can only see their specific page according to their role." ]
[ "iot" ]
[ "Android MapView: problem with method zoomToSpan for ItemizedOverlay", "I am using the following code to zoom to view all point on a MapView:\n\nmMapController.zoomToSpan(myOverlay.getLatSpanE6(), myOverlay.getLonSpanE6());\n\n\nIt works, except a problem that it only considers points but not overlays, thus gives me the following result:\n\n\n\nIs there anyway to deal with this? I was thinking that manually add/subtract some latitude/longitude to/from getLatSpanE6()/getLonSpanE6(), but this is going to be dirty and I don't know how much should I add/subtract. Does anyone have any ideas?\n\nThanks!" ]
[ "android", "overlay", "zooming", "android-mapview", "html" ]
[ "calculate overlap in timestamp in R", "I want to calculate the overlap between two timestaps ranges with \"overlap\" function. And save if there is overlap, and the interval of the overlap in a data table.\n\nI've tried to work with the function to understand how it works, trying this code.\n\n> a = c(as.Date(\"2012-01-03 18:00:00\"), as.Date(\"2012-02-03 18:00:00\"))\n> b = c(as.Date(\"2012-02-01 19:00:00\"), as.Date(\"2012-03-03 18:00:00\"))\n> Overlap(a,b)\n[1] 2\n\n\nThe problem is that only takes into account days and no the time. I would like to use the time as well." ]
[ "r", "timestamp", "overlap" ]
[ "ImageView inside RelativeLayout not obbeing its parent height", "I have the following code in create_button.xml:\n\n<RelativeLayout \n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_height=\"60dp\" \n android:layout_width=\"wrap_content\"\n android:padding=\"3dp\"\n android:background=\"@color/green\">\n <ImageView\n android:id=\"@+id/test_button_image\"\n android:layout_width=\"wrap_content\"\n android:src=\"@drawable/backImage\"\n android:contentDescription=\"@string/app_name\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentTop=\"true\">\n </ImageView>\n</RelativeLayout>\n\n\nThis piece of code is included as a fragment of an application as follows:\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:orientation=\"horizontal\"\n android:baselineAligned=\"false\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\" >\n\n <include android:id=\"@+id/buttonCreate\"\n layout=\"@layout/create_button\"\n android:layout_weight=\"1\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\">\n </include>\n</LinearLayout>\n\n\nBut my image is not obbeing to the RelativeLayout layout_height of 60dp and it's expandig to its full original height.\n\nI tried to change its layout_height to match_parent, with no luck. It expands full screen height.\n\nHow can I make this image to be the same height as its parent RelativeLayout?" ]
[ "android" ]
[ "Bash script capturing output to terminal", "I want to capture into my bash script (in a variable) the output of some command that prints its output to terminal. I have tried the following: \n\nTEST_OUT=`the_command ARG1` #Nope\n\n#Putting the line \"the_command ARG1\" into a separate script, testing2.sh,\n\nTEST_OUT=$(./testing2.sh) #Nope\n\ntesting2.sh\nTEST_OUT=$? #Nope\n\n\nI am 100% sure that when I run... \n\n> the_command ARG1\n\n\n...in a terminal, it prints to the terminal exactly the information I want to capture.\n\nThank you for any help!" ]
[ "string", "bash", "shell" ]
[ "Microsoft SQL Server 2017 Installation Stuck", "I have tried installing different version of Microsoft SQL Server but for some reason the installation sticks at RunningAction: InitializeMsiAction." ]
[ "sql-server", "sql-server-2017" ]
[ "How to get text value by span using javascript", "I want to get text value "user detail - 205 users" by the span , but i can not change the code by adding id or class , can i use javascript to get this ?\n<span style="color: rgb(0, 189, 12);">"user detail - 205 users"</span>" ]
[ "javascript", "jquery", "ajax", "typescript" ]
[ "Can we run sql server profiler with out creating prf*.tmp files?", "SQL server profiler creates prf*.tmp files on C:\\user\\username\\appdata\\local\\temp folder which is configured in TEMP and TMP environment variables. But the tool when used for a longer time leads to system disk running out of space.\nI can't change the environment variables as there are many other applications using this temp folder configuration.\nIs there no way to run the sql server profile without writing the prf*.tmp files to C:\\ drive?" ]
[ "sql-server-profiler" ]
[ "How does input() function actually work?", "I know that print writes decoded string on stdout, something like this in Python:\n\n>>> def alt_print(*arg):\n... [x.decode(sys.stdin.encoding).encode(sys.stdout.encoding) for x in arg]\n... sys.stdout.write(''.join(arg) + '\\n') if len(arg) < 2 else sys.stdout.write(str(arg) + '\\n')\n\n\n\n\nBut it's still hard to understand how does input function actually capture data? \n\nDoes it use different process to first print the string and then while loop on another process to listen to the stdin?\n\nNote: I couldn't find answer of this on stackoverflow, my question is how does input specifically works!" ]
[ "python", "stdin" ]
[ "installments with the exact sum", "is there any way to accurately calculate the installments? remembering that the sum of these parcels shall be the total value of the? I usually do a loop which will split and burn in the database, if the number of parcels is 4, I record four records .. but I want to know if there is any way that I can piecemeal parts that final sum is accurate, as X = 500, P = 3, if I dividor (500 / 3), 166.666 will give ... but the result is that I hope to get something like: X = 500, P = 3, p¹ = 150: p² = 150, p³ = 200\n\nLegend: X = Order Value, P = Number of Parcels. , p¹, p², p³ = parcel 1, 2 and 3\n\nRemember, the value of the order, will never be exact, I get 2598.90, 2038.80 .. etc." ]
[ "php", "numbers", "sum", "parcel" ]
[ "Ensuring data is in date order using 2 paged lists", "I have a 2 streams of data both of which contain date information.\n\nI get 10 items from the first which is a SQL database and 10 items from the second which is a Twitter feed.\n\nWhen a request comes in to get more data it then retrieves the next 10 items from each source. \n\nThe problem I have spotted is that second set of 10 items from the database source may have newer items than the first 10 from Twitter so you have data that looks like this\n\nDB - Today\nDB- Today \\\\1st result set\nTwitter - Yesterday\nTwiter - Yesterday\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nDB - Today\nDB - Today \\\\2nd result set\nTwitter - 3 days ago \nTwitter - 4 days ago\n\n\nThis obviously doesn't make much sense when a user sees it as the dates are out.\n\nThe only thing I can think is to retrieve all the data from twitter rather than 10 records at a time and then using LINQ do a concatenation of database data and twitter data and then order by date.\n\nCan anyone think of a better way?" ]
[ "c#", ".net", "linq", "twitter" ]
[ "JQuery not working for container with 100vh", "I'm trying to make my entire container(mainContainer, containing a 100vh full screen video and a text overlay) to the left using a click on a div class(next hvr-forward) using jquery.\n\nhttps://jsfiddle.net/Lo7xto2t/6/\n\n$('.next').click(function() {$('.mainContainer').animate({\"margin-right\": '-=200'});});\n\n\nUsed the code above but its not working. Have tested it with css:borders so it is not a jquery problem.\n\nHTML: \n\n<div class = \"mainContainer\">\n <video poster =\"poster.png\" autoplay loop>\n <source src =\"images/video.mp4\" type =\"video/mp4\">\n <source src =\"video.webm\" type =\"video/webm\"> \n </video>\n <div class = \"overlayAll\">\n <div class = \"text\"> \n We are BLXCK Co.\n </div>\n </div>\n</div>\n\n\nCSS:\n\nvideo {\nposition: fixed;\ntop: 50%;\nleft: 50%;\ntransform: translate(-50%, -50%);\nmin-width: 100%;\nmin-height: 100%;\nwidth: auto;\nheight: auto;\nz-index: 1;\nbackground: transparent;\nbackground-size: cover;\n}\n.mainContainer{\nheight: 100vh;\nposition: absolute;\nopacity: 1;\n}\n.overlayAll {\nz-index: 1;\nposition: absolute;\nbackground: rgba(0,0,0,0.3);\ntop: 0;\nbottom: 0;\nleft: 0;\nright: 0; \nheight: 120vh;\n}\n.text {\nposition: fixed;\nmax-width: 50vw;\nmin-width: 50vw;\ntop: 30vh;\nbottom: 30vh;\nleft: 15vw;\ncolor: white;\nfont-family: \"HelveticaNeue-Bold\", Helvetica, Arial, sans-serif;\nfont-size: 12vw;\ndisplay: flex;\nline-height: 0.8em;\nflex-direction: column;\njustify-content: center;\nalign-items: center;\n}\n\n\nAlso have used Inspector but it seems my mainContainer is not moving. Are there any other ways to move the entire container to the left upon a mouse click like a slider?" ]
[ "javascript", "jquery", "video" ]
[ "Visual studio publish to azure Error", "I did some research before posting. I think it has to do with publishing the project from a different workspace and namespace. Regardless, I tried deleting the bin manually, cleaning the project, rebuilding and publishing, however nothing seems to work." ]
[ "azure", "visual-studio-2013" ]
[ "Static Field as Null when mocking Enums with PowerMock", "I have written a Thread Pool and I am not able to write the Junits(PowerMock) for that class.\n\npublic enum ThreadPool {\nINSTANCE;\n\nprivate static final String THREAD_POOL_SIZE = \"threadpool.objectlevel.size\";\nprivate static TPropertyReader PROP_READER = new PropertyReader();\nprivate final ExecutorService executorService;\nprivate static final ILogger LOGGER = LoggerFactory\n .getLogger(ReportExecutorObjectLevelThreadPool.class.getName());\n\nThreadPool() {\n loadProperties();\n int no_of_threads = getThreadPoolSize();\n executorService = Executors.newFixedThreadPool(no_of_threads);\n\n}\n\npublic void submitTask(Runnable task) {\n executorService.execute(task);\n}\n\nprivate static void loadProperties() {\n try {\n PROP_READER.loadProperties(\"Dummy\");\n } catch (final OODSystemException e) {\n LOGGER.severe(\"Loading properties for app failed!\");\n }\n}\n\nprivate int getThreadPoolSize() {\n return Integer.valueOf(PROP_READER\n .getProperty(THREAD_POOL_SIZE));\n}\n}\n\n\nWhile Mocking this class I am getting NullPointerException in the line PROP_READER.loadProperties(\"DUMMY\");\n\nMy Test Case is:-\n\nPowerMockito.whenNew(PropertyReader.class).withNoArguments().thenReturn(mockPropertyReader);\nPowerMockito.doNothing().when( mockPropertyReader,\"loadProperties\",anyString());\nmockStatic(ThreadPool.class);" ]
[ "java", "junit", "mockito", "powermock" ]
[ "Mirror Front-facing camera in browser", "How can I distinguish between the front and environment facing cameras in browsers ? I am trying to mirror the user facing camera but keep the environment facing camera as is.\n\nI've tried a few ideas:\n\n\nUsing getusermedia({video: {facingMode : {exact: \"user\"}}}) but it seems like facingMode property is empty in most browsers)\nUse the Camera label to look for \"front\". This might work for Tablets or laptops with two cameras but laptops with only front facing cameras will not have it." ]
[ "javascript", "html", "typescript" ]
[ "Can -pthreads (gcc) or -mt (sun studio) or similar options cause problems?", "I'm working on a build for an old project that wasn't maintained well at all; it's more or less a hodgepodge of hundreds of independent projects that get cobbled together. Naturally, that means there's a lot of inappropriate things going on.\n\nThere's probably 50-100 executables, and around 300 shared/static libraries. Some of the libraries are built with the -mt flag (sun studio; -pthreads appears to be the gcc equivalent), others aren't.\n\nThis seems potentially problematic to me. Suppose I have libA.so and libB.so -- A was built with -mt, but not B. I expect if the application linked against A & B is single-threaded there won't be any problems (feel free to correct me on that). However, if the app is threaded then this situation opens a fun can of worms.\n\nI'm inclined to just build everything with -mt and have done with it. Most of the office agrees with this plan, but there's one dissenter. My expectation is that this will just create a potential degradation in performance, but at the moment performance is already abysmal because of the poor state of this project; so I'm not worried about that.\n\nIn short: are there any potential pitfalls with doing this?" ]
[ "multithreading", "thread-safety", "pthreads" ]
[ "REST API Explore: How to get same list ordered like the search on Foursquare Website?", "I'm using the REST API (venues platform) to get a list of the top 5 venues per destination and category, like they are listed in the search results on the foursquare website.\n\nFor example i do the following request using the explore api endpoint:\nhttps://api.foursquare.com/v2/venues/explore?near=zurich,CH&query=College %26 University\n\nI'm using the apias a not authenticated. I do not pass a radius, to get the default radius.\n\nNow the results from the api is as follows:\n1. ETH Hönggerberg HIL\n2. Technopark\n3. Kantonsschule Stadelhofen\n4. Zürcher Hochschule der Künste, Departement Musik\n5. Klubschule Migros\n\nWhen i search on the Foursquare Website as follow (not logged in!):\nhttps://foursquare.com/explore?near=Zurich%2C%20CH&q=College%20%26%20University\n\nI get the following results listed on the website:\n1. SBB Digital\n2. Technopark\n3. ETH Hönggerberg HIL\n4. EF Education First\n5. Klubschule Migros\n\nIs it possible to get the same list, as shown on the website (in the same order) also from the api? If yes? how can i do that? how do i call the api or how do i have to sort the results from the api to get the same list? \n\nFirst i tried to sort the api results by the rating field, but that doesn't do the trick at all. Because in this example no one of the first 30 results does have any rating.\n\nThank you in advance for your help!\nGreets\nTom" ]
[ "api", "foursquare" ]
[ "Match a specific string with several constants using Regex", "There are now different requirements to the regex I am looking for, and it is too complex to solve it on my own.\n\nI need to search for a specific string with the following requirements:\n\n\nString starts with \"fu: and ends with \"\nIn between those start and end requirements there can be any other string which has the following requirements:\n\n2.1. Less than 50 characters\n\n2.2. Only lower case\n\n2.3. No trailing spaces\n\n2.4. No space between \"fu: and the other string.\n\n\nThe result of the regex should be cases where case no' 1 matches but cases no' 2./2.1/2.2/2.3/2.4 don't.\n\nAt the moment I have following regex: \"fu:([^\"]*?[A-Z][^\"]*?)\",\nwhich finds strings with start with \"fu: and end with \" with any upper case inbetween like this one:\n\n\"fu:this String is wrong cause the s from string is upper case\"\n\n\nI hope it all makes sense, I tried to get into regex but this problem seems to complex for someone who is not working with regex every day.\n\n[Edit]\n\nApparently I was not clear enough. I want to have matches which are \"wrong\".\nI am looking for the complement of this regex: \"fu:(?:[a-z][a-z ]{0,47}[a-z]|[a-z]{0,2})\"\n\nsome examples:\n\nMatch: \"fu: this is a match\"\n\nMatch: \"fu:This is a match\"\n\nMatch: \"fu:this is a match \"\n\nNO Match: \"fu:this is no match\"\n\nSorry, its not easy to explain :)" ]
[ "regex" ]
[ "Change the color of one pixel of an UIImage without creating a new UIImage/CGImage", "All solutions I've found for doing this (like this one Change color of certain pixels in a UIImage ) suggest to create a new uiimage, but I want to modify directly a pixel in the uiimage without creating a new one. Is there a way to do this ?\nIt seems that cgimage is not mutable, but is there a way to create an image from a pixel data buffer, and modifying this pixel data buffer would directly modify the image ?" ]
[ "swift", "uiimage", "uikit", "cgimage" ]
[ "Spark: Why is createGlobalTempView() Method Not Available in spark-shell", "In spark-shell, the 2 methods createGlobalTempView() and createOrReplaceGlobalTempView() are not available for datasets; can anyone tell me this would be the case. Obviously even in spark-shell, we can create new sessions as in spark.newSession. So, why are these 2 methods not available? The code below shows you what I mean:\n\nscala> spark.range(100).create\ncreateOrReplaceTempView createTempView\n\nscala> spark.range(100).create" ]
[ "apache-spark", "dataset" ]
[ "Querying a collection of rectangles for the overlap of an input rectangle", "In a multi-dimensional space, I have a collection of rectangles, all of which are aligned to the grid. (I am using the word \"rectangles\" loosely - in a three dimensional space, they would be rectangular prisms.)\n\nI want to query this collection for all rectangles that overlap an input rectangle.\n\nWhat is the best data structure for holding the collection of rectangles? I will be adding rectangles to and removing rectangles from the collection from time to time, but these operations will be infrequent. The operation I want to be fast is the query.\n\nOne solution is to keep the corners of the rectangles in a list, and do a linear scan over the list, finding which rectangles overlap the query rectangle and skipping over the ones that don't.\n\nHowever, I want the query operation to be faster than linear.\n\nI've looked at the R-tree data structure, but it holds a collection of points, not a collection of rectangles, and I don't see any obvious way to generalize it.\n\nThe coordinates of my rectangles are discrete, in case you find that helpful.\n\nI am interested in the general solution, but I will also tell you the properties of my specific problem: my problem space has three dimensions, and their multiplicity varies wildly. The first dimension has two possible values, the second dimension has 87 values, and the third dimension has 1.8 million values." ]
[ "algorithm", "search", "data-structures", "geometry" ]
[ "Open .pdf, .docx, .xlsx, etc with default device application in React Native", "I am trying to open .pdf, .docx, .xlsx and other similar files using React Native.\n\nI am currently downloading the files from an amazon s3 bucket to the device, then attempting to open them on the device using react-native-fetch-blob android.actionViewIntent(res.path(), mimeType).\n\nThis works fine with images, but with anything else I'm getting the following error:\n\n\nError: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///storage/emulated/0/Android/data/myappname/files/1475.pdf typ=application/pdf flg=0x10000000 }\n\n\nEDIT: For anyone here who would like to see the implementation that ended up working (using react-native-file-system and react-native-fetch-blob):\n\nconst fileType = fileDownloadPath.split('.').pop();\nconst SavePath = Platform.OS === 'ios' ? RNFS.DocumentDirectoryPath : RNFS.ExternalDirectoryPath;\nconst mimeType = getMimeType(fileType); // getMimeType is a method (switch statement) that returns the correct mimetype\nconst path = `${SavePath}/${filename}.${fileType}`;\nconst android = RNFetchBlob.android;\n\nRNFS.downloadFile({\n fromUrl: url,\n toFile: path,\n}).promise.then(() => {\n android.actionViewIntent(path, mimeType)\n .then((success) => {\n console.log('success: ', success)\n })\n .catch((err) => {\n console.log('err:', err)\n })\n});" ]
[ "android", "react-native" ]
[ "Why does TStringList have BeginUpdate and EndUpdate?", "I understand that using BeginUpdate and EndUpdate on VCL controls such as TListBox speeds up the process of populating the control with Items as it prevents the control from being repainted, until EndUpdate is called.\n\nExample:\n\nprocedure TForm1.AddItems;\nvar\n i: Integer;\nbegin\n Screen.Cursor := crHourGlass;\n try\n for i := 0 to 5000 do\n begin\n ListBox1.Items.Add('Item' + IntToStr(i));\n end;\n finally\n Screen.Cursor := crDefault;\n end;\nend;\n\n\nThe above will have a delay because the Listbox is allowed to be repainted, but the delay can be shorted by preventing repainting like so:\n\nprocedure TForm1.AddItems;\nvar\n i: Integer;\nbegin\n Screen.Cursor := crHourGlass;\n try\n ListBox1.Items.BeginUpdate;\n try\n for i := 0 to 5000 do\n begin\n ListBox1.Items.Add('Item' + IntToStr(i));\n end;\n finally\n ListBox1.Items.EndUpdate;\n end;\n finally\n Screen.Cursor := crDefault;\n end;\nend;\n\n\nNow I tested this using a TStringList:\n\nprocedure TForm1.AddItems;\nvar\n SL: TStringList;\n i: Integer;\nbegin\n SL := TStringList.Create;\n try\n Screen.Cursor := crHourGlass;\n try\n SL.BeginUpdate;\n try\n for i := 0 to 5000 do\n begin\n SL.Add('Item' + IntToStr(i));\n end;\n finally\n SL.EndUpdate;\n end;\n\n ListBox1.Items.Assign(SL);\n finally\n Screen.Cursor := crDefault;\n end;\n finally\n SL.Free;\n end;\nend;\n\n\nIt seems that regardless if the TStringList uses BegindUpdate and EndUpdate, the list is populated at approximately the same speed..\n\nAre they really needed though as the TStringList is performed in memory and not visually. Should I use BeginUpdate and EndUpdate on a TStringList anyway, is it good practice to do this?\n\nI feel silly for asking this but why does the TStringList have the procedures BeginUpdate and EndUpdate?\n\nI think I may have answered my own question here, either way I would like to hear your views.\n\nThanks :)" ]
[ "delphi", "library-design" ]
[ "How to download VODs concurrently", "I have the following code and it successfully downloads whatever list of YouTube URLs I have:\nimport os, pytube\n\n\nyoutube_URLs = ['https://www.youtube.com/watch?v=MPlGWKm-jdg', 'https://www.youtube.com/watch?v=PPWFSCWJL_0']\n\ncurrent_dir = os.getcwd()\n\n\ndef youtube(url_list):\n if not os.path.exists(current_dir + '/youtube_videos/'):\n os.mkdir(current_dir + '/youtube_videos/')\n\n for i in url_list:\n youtube = pytube.YouTube(i)\n video = youtube.streams.first()\n video.download(current_dir + '/youtube_videos/')\n\nBut as you can see, it downloads them sequentially and this isn't ideal. How can I make this process concurrent? If I have a list of 5 VOD URLs, how can I download all 5 at the same time?" ]
[ "python", "multithreading", "concurrency" ]
[ "xml appears white when textview centred", "For some strange reason, when I centre the Hint of my EditText using gravity centre, the view of my XML turns white as shown:\n\n\n\nBut when I unclick centre, the colour goes back to normal, if anyone can point me in the right direction on how to fix this, I would appreciate it. When I run the app, the colour appears as normal (if I use gravity centre).\n\n\n\nXML is as follows:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\nxmlns:tools=\"http://schemas.android.com/tools\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:background=\"@color/facebookBlue\"\ntools:context=\"com.test.practise.TeamActivity\">\n\n\n<TextView\n android:id=\"@+id/textView\"\n android:layout_width=\"290dp\"\n android:layout_height=\"41dp\"\n android:layout_above=\"@+id/textView2\"\n android:layout_centerHorizontal=\"true\"\n android:layout_marginBottom=\"30dp\"\n android:gravity=\"center\"\n android:text=\"Bournemouth University\"\n android:textColor=\"@android:color/background_light\"\n android:textSize=\"24sp\"\n tools:layout_editor_absoluteX=\"65dp\"\n tools:layout_editor_absoluteY=\"105dp\" />\n\n<TextView\n android:id=\"@+id/textView2\"\n android:layout_width=\"129dp\"\n android:layout_height=\"34dp\"\n android:layout_marginBottom=\"70dp\"\n android:gravity=\"center\"\n android:text=\"Team Mode\"\n android:textColor=\"@android:color/background_light\"\n android:textSize=\"24sp\"\n tools:layout_editor_absoluteX=\"128dp\"\n tools:layout_editor_absoluteY=\"169dp\"\n android:layout_above=\"@+id/et_team\"\n android:layout_centerHorizontal=\"true\" />\n\n\n<EditText\n android:id=\"@+id/et_team\"\n android:layout_width=\"232dp\"\n android:layout_height=\"37dp\"\n android:layout_centerHorizontal=\"true\"\n android:layout_centerVertical=\"true\"\n android:background=\"@android:color/background_light\"\n android:ems=\"10\"\n android:hint=\"Team Name\"\n android:imeOptions=\"actionDone\"\n android:inputType=\"text\"\n android:singleLine=\"true\"\n tools:layout_editor_absoluteX=\"78dp\"\n tools:layout_editor_absoluteY=\"258dp\" />\n\n<android.support.v7.widget.AppCompatButton\n android:id=\"@+id/btn_submit_team\"\n android:layout_width=\"239dp\"\n android:layout_height=\"43dp\"\n android:layout_alignEnd=\"@+id/et_team\"\n android:layout_alignLeft=\"@+id/et_team\"\n android:layout_alignRight=\"@+id/et_team\"\n android:layout_alignStart=\"@+id/et_team\"\n android:layout_below=\"@+id/et_team\"\n android:layout_marginTop=\"38dp\"\n android:background=\"@color/colorPrimaryDark\"\n android:elevation=\"23dp\"\n android:text=\"OK, go!\"\n android:textColor=\"@android:color/background_light\"\n tools:layout_editor_absoluteX=\"75dp\"\n tools:layout_editor_absoluteY=\"325dp\" />\n\n<TextView\n android:id=\"@+id/tv_login\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentBottom=\"true\"\n android:layout_alignParentLeft=\"true\"\n android:layout_alignParentStart=\"true\"\n android:layout_marginBottom=\"23dp\"\n android:layout_marginLeft=\"27dp\"\n android:layout_marginStart=\"27dp\"\n android:text=\"Admin? Click Here\"\n android:textColor=\"@android:color/background_light\"\n tools:layout_editor_absoluteX=\"39dp\"\n tools:layout_editor_absoluteY=\"475dp\" />\n\n<ProgressBar\n android:id=\"@+id/progress\"\n style=\"@style/Base.Widget.AppCompat.ProgressBar\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentLeft=\"true\"\n android:layout_alignParentStart=\"true\"\n android:layout_below=\"@+id/btn_submit_team\"\n android:layout_marginTop=\"26dp\"\n android:indeterminate=\"true\"\n android:visibility=\"invisible\" />" ]
[ "android", "xml", "android-layout" ]
[ "Pagiantor on a search function", "I tried to add a Paginator of 5 posts to the current function but I always have developed with the ListView functions, in which is way easier to implement a pagiantor. Any suggestion?\n def search(request):\n query = request.GET.get("q", None)\n qs = DeathAd.objects.all()\n if query is not None:\n qs = qs.annotate(\n full_name = Concat('nome', Value(' '), 'cognome'),\n full_cognome = Concat('cognome', Value(' '), 'nome')\n ).filter(\n Q(nome__icontains=query) |\n Q(cognome__icontains=query) |\n Q(full_name__icontains=query) |\n Q(full_cognome__icontains=query)\n )\n \n context = {\n "object_list": qs,\n }\n template = "search.html"\n return render(request, template, context)" ]
[ "django", "function", "paginator" ]
[ "Add WebClient to form", "In Visual Studio 2017, you can add components to a System.Windows.Forms.Form like System.ComponentModel.BackgroundWorker:\n \nMy question is: Can you also do this for System.Net.WebClient? I know I can add a public instance to the top of my class:\n\npublic partial class FrmMain : Form {\n WebClient wc;\n\n public FrmMain() {\n InitializeComponent();\n }\n\n\nbut I would like it to be defined by Visual Studio, in the InitializeComponent() method.\n\nIs this possible? Thanks in advance!" ]
[ "c#", ".net", "winforms", "custom-controls", "webclient" ]
[ "OCaml Redefining Infix Operator", "An exercise questions asks for an explanation as to why this won't work. Obviously from running the code I see that it doesn't, but I don't see in this case why. The error doesn't clarify much!\n\n# let (+) x y z = x + y + z in 5 + 6 7;;\nError: This expression has type int\n This is not a function; it cannot be applied.\n\n\nThanks!" ]
[ "functional-programming", "ocaml", "infix-notation" ]
[ "Android: Find location from location name. Is Android's geocoder the correct way?", "I am trying to build a location based application which shows google map and allows the user to search a location by writing an address (as google maps does).\n\nI have been trying to use android's geocoder to do this, and it finds some addresses. However, one of the first addresses that i tried (vaasankatu, helsinki, finland), it didn't find when I searched by street name (vaasankatu). Also one other street name that I have tried does not return any results. If I add the city (helsinki), or the country (finland) after the street name, then geocoder finds addresses.\n\nGoogle maps web app and android app find the addresses without any problem just by searching by the street name. I am wondering whether I could somehow make geocoder to return the address when it is searched by the street name? I could of course try to find out the current city with the geocoder and attach it after the query, but this seems a bit like a hack, is there a better way?\n\nI am also a bit worried about the geocoder documentation, which says: \n\n\n \"The Geocoder class requires a backend service that is not included in\n the core android framework. The Geocoder query methods will return an\n empty list if there no backend service in the platform. Use the\n isPresent() method to determine whether a Geocoder implementation\n exists.\"\n\n\nI don't quite understand what that means.. So is there a big portion of phones that don't support geocoder? The text seems to suggest there might be, but why would there be such an api then at all..? Should I use another api alltogether? Is, for example Google geocoding api for web services usually used? Or places api?" ]
[ "android", "google-maps", "google-geocoder" ]
[ "Visual Studio setup project, setting path but not seen in command window", "I have a setup project in which I have a custom action that is adding the target folder to the path. Nothing special, works ok, adds it to the path.\n\nHowever if I then open a cmd window it's not available. If I psexec and try to directly run something that is in the folder it isn't found.\n\nI logged off the box and on again and it turned up in the cmd echo %PATH% command however this isn't really an option in production.\n\nI will probably be installing the msi via psexec and then I want to then make a second call using something in that folder.\n\nso \n\npsexec \\machine-name msiexec /I setup.msi /qn\npsexec \\machine-name exeinabovemsi\n\nIs there something I need to do to flush the path out, it is in the \"My Computer -> Properties -> Advanced -> Environment Variables -> Path\" list as soon as the msi has installed, just doesn't turn up in the new cmd windows etc.\n\nThanks\n\nAlan" ]
[ "visual-studio-2008", "environment-variables" ]
[ "How to read String from a command Line and Not to accept an integer as an arguement", "Am trying to get an argument from a command line using Java\nFor example, \n\n\n java nameOfTheProgram name1 name2\n\n\nThe Program should Only read string and not accept any int number \nfor example : \n\n\n java nameOfTheProgram name1 5 / ---- \n\n\nI wanted the program to crush such that it only accepts String \n\nI tried to use String name1 = String.valueOf(args[0]); -- it's working perfect, but it accepts 5 as an argument" ]
[ "java" ]
[ "(new to JavaGameMaking)Libgdx random spawning of rectangle(sprite?)", "i want to know how to make a way to spawn multiple different a sprite or rectangle. is it using array?For now the code below spawn the same rectangle(sprite) that spawn at random location every second. so i want it choose itself randomly different rectangle(sprite)? \n\npublic class Chibi implements ApplicationListener {\nTexture fallL;\nOrthographicCamera camera;\nSpriteBatch batch;\nArray<Rectangle> chibis1;\nlong lastDropTime;\n\n\n\n@Override\npublic void create() { \n //Load image \n fallL = new Texture(Gdx.files.internal(\"fallL.png\"));\n\n camera = new OrthographicCamera();\n camera.setToOrtho(false,800,400);\n\n batch = new SpriteBatch();\n\n chibis1 = new Array<Rectangle>();\n spawnChibi();\n}\n\nprivate void spawnChibi() {\n Rectangle chibi1 = new Rectangle();\n chibi1.x = MathUtils.random(0, 800-64);\n chibi1.y = 480;\n chibi1.width = 64;\n chibi1.height = 64;\n chibis1.add(chibi1);\n lastDropTime = TimeUtils.nanoTime();\n\n}\n\n@Override\npublic void dispose() {\n fallL.dispose();\n bgMusic.dispose();\n points.dispose();\n lvup.dispose();\n batch.dispose();\n}\n\n@Override\npublic void render() { \n Gdx.gl.glClearColor(1, 1, 1, 1);\n Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\n\n camera.update();\n\n batch.setProjectionMatrix(camera.combined);\n\n batch.begin();\n for(Rectangle chibi1 : chibis1){\n\n batch.draw(fallL, chibi1.x, chibi1.y);\n }\n batch.end();\n\n if (TimeUtils.nanoTime() - lastDropTime >1000000000) spawnChibi();\n //process user input\n Iterator<Rectangle> iter = chibis1.iterator();\n while(iter.hasNext()){\n Rectangle chibi1 = iter.next();\n chibi1.y -= 200*Gdx.graphics.getDeltaTime();\n if(chibi1.y + 64 < -60) iter.remove();\n\n }\n\n\n}\n\n@Override\npublic void resize(int width, int height) {\n}\n\n@Override\npublic void pause() {\n}\n\n@Override\npublic void resume() {\n}\n}\n\n\nalso keep in mind that im new to this java game making and java. :)" ]
[ "java", "random", "libgdx" ]
[ "How to set value from server in Input and change it?", "I have this input, and by default there should be value from server\n const [nameValue, setNameValue] = useState("");\n\n <TextField\n id="outlined-read-only-input"\n label="Display Name"\n variant="outlined"\n value={nameValue !== '' ? nameValue : name || '' }\n onChange={(e) => setNameValue(e.target.value)}\n onBlur={() => setName({ variables: { name: nameValue } })} \n />\n\nname - server response\nnameValue - new value that I need to send to the server\nBut when I try to change value and 1 sign remains and I want to erase it, the value returned by default\nProblem is here value={nameValue !== '' ? nameValue : name || '' } but I don't know how to fix it\nexport const getMeData = gql`\n query {\n me {\n apsTraining\n backgroundCheck\n city\n contactPreference\n dateOfBirth\n email\n familyCupSignedUp\n gender\n id\n name\n phone\n programWaiver\n state\n stripeEnabled\n zip\n }\n }\n`\nconst { data } = useQuery(getMeData);\nconst name = data ? data.me.name : null" ]
[ "javascript", "reactjs" ]
[ "Spring @Scheduled task in multiple timezones", "I have a client that operates across the US (in all time zones). I need to run a task at 2AM in each time zone. This task needs time zone as input to fetch records only related that zone.\n\n@Scheduled annotation has timezone value, that works of one timezone at a time. \n\nI do not want to duplicate the code by having 4 separate tasks for each zone." ]
[ "java", "spring", "spring-boot", "scheduler", "taskscheduler" ]
[ "Shared Preferences removing data after one time use", "I am using Power Preferences in an android application because of storing a list of data in the key-value format and has been working great for me\n\nRecently have added two other simple key-value pairs one is for the UUID of the device and the second for a custom generated id\n\nthere are no issues with the UUID as it is stored once on the first time using the app and retrieved many times\nbut with the custom generated id I can store it and use it perfectly only one, on the second time retrieving the key-value pair is removed for some reason generating a new id every alternate time\n\ncode for setting the power preferences\n\nString deviceDBID = data.getDevicedbid();\nPowerPreference.getFileByName(powerPrefFile).putString(powerPrefDeviceDBID, deviceDBID);\n\n\ncode for retrieving the power preferences\n\nString deviceID = PowerPreference.getFileByName(powerPrefFile).getString(powerPrefDeviceDBID);\n\n\nThanks" ]
[ "android", "sharedpreferences" ]
[ "Python crash, glibc detected /zope/z_if_algerie/Python-2.6/bin/python: munmap_chunk(): invalid pointer", "I run Plone 4.1.3 on a linux 3.2.13-xxxx-std-ipv6-64 with python 2.6.\n\nPlone is in ZEO, with pound and apache.\n\nAfter browsing my website, I've got an error (in the terminal) :\n\n*** glibc detected *** /zope/z_if_algerie/Python-2.6/bin/python: munmap_chunk(): invalid pointer: 0x00000000040e70b0 ***\n\n\nAnd all zeoclients are stoped.\n\nHere is the link to the full traceback.\n\nSomeone know what's going on ?\n\nThank you !" ]
[ "python", "linux", "plone", "glibc", "zope" ]
[ "Line breaks in TMemo on a form with Default button", "I have a form in an application written using FireMonkey. On that (modal) form there's an OK button for which I have set Default property to True. There's also a memo component. Now if type press enter while typing in the memo, then the form is closed instead of inserting line break into memo.\n\nWhat I would like to accomplish, is that when enter (or shift+enter or smth like that) is pressed in memo component, then line break is enter. In other components, where you cannot type line breaks, I would still like hitting enter to close the form. The best I have found thus far is adding following code into forms OnCloseQuery action:\n\nif (Focused.GetObject.ClassName = 'TMemo') and (ModalResult = mrOk) then\nbegin\n CanClose := False;\n Memo := TMemo(Focused.GetObject);\n Memo.InsertAfter(Memo.CaretPosition, sLineBreak, [TInsertOption.ioMoveCaret,\n TInsertOption.ioCanUndo]);\nend\nelse\n CanClose := True;\n\n\nThis works, but there's now there's a small annoying delay after hitting enter and before the line break appears. Also I would like solution, that would be less hacky.\n\nI should also point out, that I also have forms which contain the OK button, but not the memo component, however a memo will be moved to that form at runtime by changing its parent property." ]
[ "delphi", "firemonkey-fm2" ]
[ "How to generate DATE from 2 columns to use as selector in MySQL", "I have month and year columns separately in a table, named m and y.\n\nNow I want to select the records, for example between 2016-08 and 2018-10 (day is not important and that was the reason I have month and year columns)\n\nSo I'm looking for a command like below but no success, is there any MySQL function to achieve this?\n\nSELECT * FROM mytable WHERE DATE(`y`,`m`) BETWEEN '2016-08-01' AND '2018-10-01'" ]
[ "mysql", "date", "multiple-columns" ]
[ "SHA1 hash binary (20) to string (41)", "I have a function that creates a binary sha1, but I need a result as a 40-byte string, (+1 for null-t).\nIs there a better way of converting it to string, than this?\n\nunsigned char hash_binary[20] = \"\\xFF\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\x01\";\nchar hash_string[41];\nint i;\n\nfor(i = 0;i < 20; i++)\n sprintf( hash_string + i*2, \"%02X\", hash_binary[i] );\n\nhash_string[40] = 0;\n\n\nThis calls sprintf 20 times. How can I avoid it?" ]
[ "c" ]
[ "How to use a combination of column values to filter data and create subsets?", "I'm new to python and would like some help in scaling a project I'm working on.\n\nI have a data set with 25 columns. I need to filter that data by the unique combinations of 3 particular columns. Then name each of the unique filters as a subset (preferably just the combo of the values in each of the 3 columns).\n\nSo, I have the code to find the unique combinations of just the three columns that I need. I thought that would be a good start.\n\nunique = m_nlsn[['Market Break','Demographic', 'Playback Period']].drop_duplicates(subset=['Market Break','Demographic', 'Playback Period'])\n\n\nNow, I need to know how do I use these unique combinations to filter and name subsets? For instance, if I have 10 unique combinations, I want 10 different subsets based on the values in those 3 particular columns. See below I was filtering the unique combinations MANUALLY.\n\ncomp_hh_live = m_nlsn.loc[(m_nlsn['Market Break'] == \"Composite\") \n & (m_nlsn['Demographic'] == \"Household\")\n & (m_nlsn['Playback Period'] == \"Live | TV with Digital | Linear with VOD\")]\n\n\nAll help is greatly appreciated." ]
[ "python", "pandas", "dataframe", "pandas-groupby" ]
[ "Xcode10: Code signing \"SKMaps.framework\" failed on application Archive time", "Application distribution archive failed in Xcode 10, It's working fine in Xcode 9.\n\nPlease check below screenshot." ]
[ "ios", "objective-c", "code-signing", "xcode10", "skmaps" ]
[ "Replace N/A or 0 with blank in VLOOKUP", "I want to replace every N/A or 0 with a blank after executing VLOOKUP.\n\nDim myLastRow As Long\n\nActiveSheet.UsedRange\n\nmyLastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row\n\nRange(\"S2\").Select\nActiveCell.Formula = \"=IF(ISNA(VLOOKUP(C[-16],Blad1!C[-16]:C[6],17,FALSE)),\"\",IF(VLOOKUP(C[-16],Blad1!C[-16]:C[6],17,FALSE)=0,\"\",VLOOKUP(C[-16],Blad1!C[-16]:C[6],17,FALSE)))\"\nSelection.AutoFill Destination:=Range(\"S2:S\" & myLastRow), Type:=xlFillDefault\n\n\nThis does not work for me, I'm getting an error, but I don't know what exactly is wrong. \n\nActiveCell.Formula = \"=VLOOKUP(C[-16],Blad1!C[-16]:C[6],17,FALSE)\"\n\n\ndoes work, but the conditional function does not." ]
[ "vba", "excel" ]
[ "JSON response into input value", "I have the following code which returns a JSON array. I'm having issues putting the values into HTML inputs:\n\n$('#button-validate').live('click', function() {\n $.ajax({\n url: 'index.php?route=sale/customer/addressValidation&token=<?php echo $token; ?>',\n type: 'post',\n dataType: 'html',\n data: 'shipping_address_1=' + encodeURIComponent($('input[name=\\'address[1][address_1]\\']').val()) + '&shipping_address_2=' + encodeURIComponent($('input[name=\\'address[1][address_2]\\']').val()) + '&shipping_city=' + encodeURIComponent($('input[name=\\'address[1][city]\\']').val()) + '&shipping_region=' + encodeURIComponent($('select[name=\\'address[1][zone_id]\\']').val()) + '&shipping_zip=' + encodeURIComponent($('input[name=\\'address[1][postcode]\\']').val()),\n beforeSend: function() {\n $('.success, .warning').remove();\n $('#button-history').attr('disabled', true);\n $('#history').prepend('<div class=\"attention\"><img src=\"view/image/loading.gif\" alt=\"\" /> Validating</div>');\n },\n complete: function() {\n $('#button-history').attr('disabled', false);\n $('.attention').remove();\n },\n success: function(data) {\n if (data['error']) {\n $('div#warning').attr('display', false);\n $('div#warning').after('<div class=\"warning\" style=\"display: none;\">' + json['error'] + '</div>');\n\n }else{\n $('#shipping_address_1').val(html['shipping_address_1']);\n $('#shipping_address_2').val(html['shipping_address_2']);\n $('#shipping_city').val(html['shipping_city']);\n $('#shipping_zip').val(html['shipping_zip']);\n }\n }\n });\n});\n\n\nThe JSON array looks like this in Firebug:\n\n[{\"shipping_address_1\":\"21497 CROZIER AVE\",\"shipping_address_2\":\"\",\"shipping_city\":\"BOCA RATON\",\"shipping_region\":\"FL\",\"shipping_zip\":\"33428\"}]" ]
[ "php", "jquery", "ajax", "json" ]
[ "How do I use shutil to make a python file copy itself after doing a calculation?", "So I have a python program that writes prime numbers into a csv file. I now want my python file to make a copy of itself after it runs everything, as a backup for when I tweak around with the original file.\n\nI've gotten away with not knowing this so far by making the python program make a new .py file and then writing everything inside it, but this is super inefficient. I'd like it to be cleaner and less complicated.\n\nI've heard a little bit about using shutil.copyfile, but I'm not too sure about how to use it. Is shutil.copyfile the best way to make my python file copy itself, or is there a better way?" ]
[ "python", "file", "copy", "backup", "shutil" ]
[ "is it possible to autolayout the width of the UISlider", "I am using PureLayout to put a UISlider between 2 buttons as below:\n\n\n[self.slider autoPinEdge:ALEdgeLeading toEdge:ALEdgeTrailing ofView:self.leftButton withOffset:10.0f];\n[self.slider autoPinEdge:ALEdgeTrailing toEdge:ALEdgeLeading ofView:self.rightButton withOffset:10.0f];\n[self.slider autoAlignAxisToSuperviewAxis:ALAxisHorizontal];\n\n\nIs it possible that the UISlider automatically sets its width between the leftButton and the rightButton ?" ]
[ "objective-c", "uislider", "pure-layout" ]
[ "Declaring a Brushes variable for input", "I currently have the following method\n\npublic void printTitle(string title){\n // settings for stringformat\n g.DrawString(title, drawFontTitle, Brushes.White, x, y, stringFormatTitle);\n}\n\n\nHowever, I am trying to let the input define the color of the title, like so:\n\npublic void printTitle(string title, Brushes titleColor){\n // settings for stringformat\n g.DrawString(title, drawFontTitle, titleColor, x, y, stringFormatTitle);\n}\n\n\nAnd it would be used like this:\n\nprintTitle(\"Title Text\", Brushes.White);\n\nHowever, I think there is an issue when declaring the Brushes titleColor that's causing an error." ]
[ "c#", "graphics", "colors", "bitmap" ]