texts
sequence
tags
sequence
[ "Cut an AABB by an OBB", "I have two objects in a 3D space:\n\n\nAABB (Axis Aligned Bounding Box) represented by two 3D points: min & max\nOBB (Orientated Bounding Box) represented by center position point, 3 half sizes and an orientation (quaternion for example)\n\n\nI would like to 'cut' the parts of the AABB which exceeds the OBB. See attached image which represent an OBB and the AABB to cut to the red line:\n\n\n\nI need to have a fast algorithm in order to do real time computation. Do you have any clues to construct a such algorithm ?" ]
[ "algorithm", "3d" ]
[ "Opentab from Url on a spreatsheet", "What I am trying to do is to open several browser tabs, the url will be coming from the cells of a spreadsheet.\n\nI found a good tutorial for that.\nApps Script: Open a new tab with an image - YouTube\n\nI reproduced his code and now I am trying to make a loop,\nbut the loop take only the last element of the list.\n\nThe problem must be simple,\nit must be the way I write my loop but I cant find it.\n\nhere is the code.\n\nfunction openTab2() {\n var selection = SpreadsheetApp.getActiveSheet();\n var data = selection.getDataRange().getValues();\n for (var i = 0; i < data.length; i++) {\n var html= \"<script> window.open( '\" +(data[i][0]) + \"');google.script.host.close(); </script>\";\n var userInterface = HtmlService.createHtmlOutput (html);\n SpreadsheetApp.getUi().showModalDialog(userInterface, 'open Tab')\n}" ]
[ "google-apps-script", "google-sheets" ]
[ "nginx reverse-proxy passthrough SSL accessing sub-folder", "nginx reverse-proxy passthrough SSL accessing sub-folder\nI do have an issue when trying to access a sub-folder behind nginx backend server, but it works for httpd.\nI did not get lucky to find what is missing in my config files.\nexample:-\nhttps://domain1.com (works)\nhttps://domain1.com/xx\nprompts https://domain1.com:8001/xx (server could not be reached .. something like that)\nMy setup scenario:-\n\nnginx reverse proxy\nhttpd backend server\nnginx backend server\n\nnginx reverse-proxy passthrough SSL\nstream {\nmap $ssl_preread_server_name $name {\ndomain1.com http_8001;\ndomain2.com http_8002;\n\n}\nupstream http_8001 {\n server 1.2.3.4:8001;\n }\nupstream http_8002 {\n server 1.2.3.4:8002;\n }\nserver { \n listen 443;\n listen [::]:443;\n proxy_pass $name;\n ssl_preread on;\n }\n\n}\nhttpd backend server (Works)\nListen 8010\n<VirtualHost *:8010>\nSSLEngine on\nServerName domain1.com\nDocumentRoot /some/path\n\n\n#---nginx backend server\nserver {\nlisten 8001 ssl;\nlisten [::]:8001 ssl;\nserver_name domain1.com;\nroot /some/path\nssl_certificate /etc/nginx/ssl/.. \nssl_certificate_key /etc/nginx/ssl/..\nindex index.php index.html index.htm;\n\n}" ]
[ "nginx", "reverse-proxy", "nginx-reverse-proxy" ]
[ "yii2 get label of optgroup when submit", "I have a select box:\n\n<select id=\"issue-users_id\" class=\"form-control\" name=\"Issue[users_id]\">\n <optgroup label=\"user\">\n <option value=\"16\">user</option>\n <option value=\"24\">robo</option>\n </optgroup>\n <optgroup label=\"group\">\n <option value=\"15\">123123</option>\n </optgroup>\n</select>\n\n\nwhen submit form I want to have array like this:\n\nIssue[users_id][user] = value (16, 24)\nor Issue[users_id][group] = value (15)\n\n\nit means I want to get value of optgroup" ]
[ "yii2" ]
[ "Open URL and return to shell", "I'm running a script on python 3 that opens a URL using webbrowser.open() and immediately requires an input from the user. The problem is that the active window is now that of the browser instead of the python shell and an Alt-Tab or click is always required to provide the answer. You can imagine how frustrating it can be for thousands of images. The code is as simple as this:\n\n for rP in images:\n webbrowser.open(rP)\n decision = str(input('Is image '+str(rP)+' ok?')\n\n\nI guess there are three ways of solving this but I can't seem to find an implementation for any of them. I've tried the 'autoraise' option in the webbrowser.open() command to no avail. I'm guessing that either solution will be so simple that I'll be banging my head afterwards. \n\nSo:\nSolution #1: Have a command before the input line that makes the shell window active instead of the browser.\nSolution #2: Open the webpage in the background thus never leaving the shell.\nSolution #3: Give the shell window an \"always on top\" property. \n\nAny ideas?" ]
[ "python", "shell", "openurl", "always-on-top" ]
[ "How to fix html in php echo", "I'm having trouble using the echo function in php. I don't fully understand when double quotes, single quotes, and escaping quotes are necessary. I've tried several variations and I can't seem to get it to show up. I know how to echo basic html, but I've not used classes before, I think that might be the dealbreaker here.\n\nEdit: flagged for being a duplicate, I'm new here, not really sure what to do. But it's not duplicate post, the other post uses elements that I'm not familiar with using, this was just straight html. Thank you.\n\n<?php echo \"<div id=\\\"resume-links\\\" style='display:flex;float:right;''>\n<a class='button button--type-action--size-medium' href='/myaccount' style='margin-right:10px;''>Dashboard →</a>\n<a class='button button--type-action--size-medium' href='#popmake-1301'>Get Featured →</a>\n</div>\n<div id=\\\"resume-link\\\" style='clear:both;float:right;padding-top:10px;font-style:italic;'><p><a href='/article-submissions'>Learn More</a></p></div>\";?>" ]
[ "php" ]
[ "Filtering records from large database in larave5.4", "I am having 1 million records in database with relationships. I need to add filter through range slider.\nin my DB having no.of companies data, every company has employees count.\nnow, i want to filter employees between 10 to 10,000. i am using below query it's takes large amount of time(20mins) to filter.\nHow can i solve this\n\n$company_data =Company::whereBetween('employees',[10,10000])->with('country','industry','company_financial')->skip($request->start)->take($request->length)->get();\n\n\nThanks in advance." ]
[ "mysql", "laravel", "query-optimization" ]
[ "No frameworks detected in IntelliJ IDE when trying to import a project", "I have to add/change some features in a Spring boot api which has a blueprint repository. I downloaded the branch from gitlab and opened the same in IntelliJ. But IntelliJ does not detect any framework. Even the basic spring imports are failing. Also I usually use Maven as build tool, but the project requires me to use Gradle, However I am not allowed to download gradle on their environment(even my local). Can anyone please point me in the right directions please." ]
[ "java", "spring", "spring-boot", "gradle", "intellij-idea" ]
[ "Remove numbers after decimal in javascript", "var randomNumber = (Math.random()*3 + 3.5); randomNumber;\n\nalert(randomNumber)\n\n\nThis piece of code returns a number like \n\n4.589729345235789\n\nI need it to return \n\n4.5\n\nSo need it to remove all the numbers after the decimal except the first one, can anyone show me how to do that?" ]
[ "javascript" ]
[ "Could not resolve to a component implementation in Flex Mobile project", "I just created a Flex Mobile project and I received this error when using an mx:LinkButton:\n\nCould not resolve <mx:LinkButton> to a component implementation.\n\n\nHere is my Application: \n\n<s:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" \n xmlns:mx=\"library://ns.adobe.com/flex/mx\" \n xmlns:s=\"library://ns.adobe.com/flex/spark\">\n\n\n <mx:LinkButton id=\"contactButton\" label=\"Contact\" />\n\n\nActually, none of the mx components are working? This is not good. \n\nI'm using Flex 4.5.1A." ]
[ "apache-flex", "flex4", "flash-builder" ]
[ "WindowsIdentity.Impersonate() confusion", "I have a web application hosted by IIS. it is configured with Form Authentication and Anonymous authentication, and Impersonation is enabled.\nApp Pool account is Network Service. Anonymous account is Costa. Costa is having access to database. NetworkService cannot access database.\n\nThe problem is that Request thread (parent thread) can access the database but sub thread cannot.\n\nTo fix this. I send windows identity object of main thread to sub thread, then I call Impersonate(). Impersonate means \"assign current thread Windows Identity with impersonated account.\nMy question: Is that a good practice? Is there a risk? \n\n\\\\Request thread code (Parent thread)\n\n\\\\WindowsIdentity.GetCurrent() return Costa identity (impersonated)\nrequestFields.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());\nThreadPool.QueueUserWorkItem(LogRequest, requestFields);\n\n\n--\n\n\\\\ Sub thread code that works\nRequestFields requestFields = (RequestFields)obj;\nHttpRequest httpRequest = requestFields.Request;\n\nvar impersonationContext = ((WindowsIdentity)requestFields.CurrentPrincipal.Identity).Impersonate();\n.\n.\n.\nimpersonationContext.Undo();" ]
[ "c#", ".net", "multithreading", "impersonation" ]
[ "adding a php custom field into a php code", "I'm using a PHP code on my wesbiste to get thumbnails of vimeo videos.\nhere is the code :\n\n<?php\n echo '<img src=\"' . get_vimeo_thumb('43096888', 'thumbnail_large') . '\" class=\"image_page_texte_et_medias\" style=\"cursor:pointer\" >';\n ?>\n\n\nI'm using a ACF custom field with the video ID \n\n<?php the_sub_field('vimeo'); ?>\n\n\nWhat I'm trying to do is to replace the ID in my first php code ('43096888') by :\n\n<?php the_sub_field('vimeo'); ?>\n\n\ncan anybody help me with this,\n\nthanks a lot," ]
[ "php", "image", "advanced-custom-fields" ]
[ "How to keep an array after navigation away to another page", "Ok, so I have an array declared as so: \n\n var names_Array = [];\n\n\nThen I am creating a list and that list is composed of the elements in the above array. It is declared as so:\n\n var names_List = new WinJS.Binding.List(names_Array);\n\n\nBased on a condition in my first page. I am adding items to this list, as so:\n\n if (condition) {\n names_List.push({ name: \"xxx\", image: \"image/xxx.png\", ClientID: \"xxxx\" });\n }\n\n\nThen I am moving to another page and my goal is for when I come back to have any of the elements which were added still there. I am aware, as of now that when I go back, the list is empty because of the line:\n\nvar names_Array = [];\n\n\nSo my question is, is there any way to keep the items of the list, when I move away and come back. I realise I need an additional if condition in the first page to determine if this is the first time on the page or if the user has gone away and come back. Something like:\n\nif (first){\n if(condition){\n sort out list;\n }\n}\nelse{\n re-sort out list\n}\n\n\nAny ideas?" ]
[ "javascript", "arrays", "list", "navigation" ]
[ "Consul configuration in docker-compose", "I'm trying to setup a consul cluster locally using docker-compose, and my source of inspiration (this is my first interaction with consul), is this consul.yml. This configuration contains some syntax that I'm seeing for the first time.\nI'm figuring that this\nconsul-agent-1: &consul-agent\n image: consul:latest\n\nserves as some kind of base (like in inheritance) ?\nand this part is the derived ? I don't know how to call it\nconsul-server-bootstrap:\n <<: *consul-agent\n\nPlease correct me if I'm wrong about this assumption.\nBut what I find very strange is this part in consul-agent-1\ncommand: "agent -retry-join consul-server-bootstrap -client 0.0.0.0"\n\nIt does 'something' (I'm not sure what exactly) with consul-server-bootstrap service.\nI don't understand it, I mean if I'm correct that consul-agent-1 serves as some base template for other services, and if consul-server-bootstrap uses the template, isn't this a circular reference ?" ]
[ "docker", "docker-compose", "yaml", "consul" ]
[ "JSON- Regex to identify a pattern in JSON", "I'm new to Python3 and I am working with large JSON objects. I have a large JSON object which has extra chars coming in between two JSON objects, in between the braces.\nFor example:\n{"id":"121324343", "name":"foobar"}3$£_$£rvcfddkgga£($(>..bu&^783 { "id":"343554353", "name":"ABCXYZ"}'\n\nThese extra chars could be anything alphanumeric, special chars or ASCII. They appear in this large JSON multiple times and can be of any length. I'm trying to use regex to identify that pattern to remove them, but regex doesn't seem to work. Here is the regex I used:\n(^}\\n[a-zA-Z0-9]+{$)\n\nIs there a way of identifying such patter using regex in python?" ]
[ "json", "python-3.x", "regex", "large-data" ]
[ "how to continue code execution outside of a callback function?", "I hope I'm using the right words to describe this problem.... Here I have defined an object called TK with a property and method.\n\nvar TK = {\n List: [],\n getSectionA: function(listName) {\n var arrayList = [];\n TK.returnList = $.get(\n 'ajax/test.html', \n { sendName: listName }, \n function(data) {\n }\n ); \n }\n};\n\n\ncalling the function\n\n$(\"#dropDownList\").change(function() {\n TK.getSectionA(fileName);\n\n\n// Here I'm trying to get out of this callback function below and continue normal code execution after assigning the callback return data (resultLists) to a variable (TK.List) but when I alert the array variable TK.List, nothing is displayed.\n\nTK.List = TK.returnList.done(function(data) {\n var resultLists = [];\n $.each(data, function(index, value) {\n if (value == \"false\") {\n return false;\n }\n else if (value == \"\") {\n return false;\n }\n else {\n resultLists[index] = value;\n }\n });\n return resultLists; \n});\nalert(TK.List.join(\"\")) // not displaying" ]
[ "jquery" ]
[ "Replace multiline text wtih sed", "I'm trying to replace a multi-line text which contains XML in all files named pom.xml.\nIn practice, I need to replace this section:\n\n<groupId>javax.enterprise</groupId>\n<artifactId>cdi-api</artifactId>\n\n\nwith:\n\n<groupId>jakarta.enterprise</groupId>\n<artifactId>jakarta.enterprise.cdi-api</artifactId>\n\n\nI've come up with the following sed:\n\nfind . -name pom.xml -exec sed -i 's/\\<groupId\\>javax\\.enterprise\\<\\/groupId\\>\n \\<artifactId\\>cdi-api\\<\\/artifactId\\>/\\<groupId\\>jakarta\\.enterprise\\<\\/groupId\\>\n \\<artifactId\\>jakarta\\.enterprise\\.cdi-api\\<\\/artifactId\\>/g' {} + \n\n\nHowever, from the output it's returned \"command not terminated\".\nI'm not too familiar with multiline replacement, could you suggest any fix or other tool to do it?\nThanks" ]
[ "bash", "sed" ]
[ "allow mixed content coding Error", "I am sending a request from HTTPs url to HTTP. Doing this i am getting error regarding \"allow mixed content\". \n\nI can fix it using browser settings by clicking on Shield icon on url bar and to allow it. \n\nIs there any way to fix this using HTML or Javascript so that user need not to change in Browser setting and it will work without letting user know about this." ]
[ "javascript", "html", "security", "https" ]
[ "how to resolve - Parameter specified as non-null is null", "I have unit test in which I am trying to check is a use case is called with the right parameters but I get an error\njava.lang.IllegalArgumentException: Parameter specified as non-null is null: method com.xx.xxx.clean.orderview.domain.OnStandUseCaseCoroutine$Params.<init>, parameter serviceType\n@Test\nfun `when notifyOnStand is called then we create a TimestampedAction with the correct user id, vehicle, timestamp and pass that to the usecase`() {\n val actionCaptor = argumentCaptor<TimestampedAction>()\n val timestamp = DateTime.now()\n\n every(noServiceRequiredBus.get()).thenReturn(Observable.just(REQUESTED))\n every(timingsUpdater.timestampCalculator(any(), any())).thenReturn(timestamp)\n\n baseOrderViewPresenter.setView(view)\n baseOrderViewPresenter.notifyOnStand()\n\n runBlocking {\n verify(onStandUseCaseCoroutine).run(OnStandUseCaseCoroutine.Params(any(), any(), capture(actionCaptor)))\n }\n}\n\nUse case which will get called when when called baseOrderViewPresenter.notifyOnStand() from tets case\nclass OnStandUseCaseCoroutine @Inject constructor(\n private val orderRepository: OrderRepository,\n private val serviceOrderTypeProvider: ServiceOrderTypeProvider\n) : UseCaseCoroutine<GenericResponse, OnStandUseCaseCoroutine.Params> (){\n\n override suspend fun run(params: Params) =\n orderRepository.notifyOnStandSuspend(serviceOrderTypeProvider.apiPathFor(params.serviceType), params.id, params.action)\n\n data class Params(val serviceType: String, val id: String, val action: TimestampedAction)\n}\n\nPresenter layer which has the call to use case\nprivate fun onstandUseCaseCoroutines(serviceType: String, id: String, action: TimestampedAction, callback: (GenericResponse?) -> Unit) {\n try {\n onStandUseCaseCoroutine(OnStandUseCaseCoroutine.Params(serviceType, id, action)) {\n callback.invoke(it)\n }\n } catch (exception: Exception) {\n onStandResponseErrors()\n }\n}\n\nhow can I fix this please\nI tried changing to bellow code but that did not fix it, I am not sure what to do the capture(actionCaptor) bit if that is the issue\n runBlocking {\n verify(onStandUseCaseCoroutine).run(OnStandUseCaseCoroutine.Params(anyString(), anyString(), capture(actionCaptor)))\n }\n\nAny suggestions please\nThanks\nR" ]
[ "java", "android", "kotlin", "junit", "kotlin-coroutines" ]
[ "Speed up python's request function", "I have a script that takes a list file of query IDs and extracts the organism and sequence from uniprot, the code works well, however it is very slow. I want to process approximately 4 million sequences through it, but it takes around 5 min to parse through 100 sequences:\n\nreal 5m32.452s\nuser 0m0.651s\nsys 0m0.135s\n\n\nThe code uses python's retrieve module. I've read online that I can use the .session() attribute, however when I try this I get the following error:\n\nTraceback (most recent call last):\nFile \"retrieve.py\", line 14, in <module>\nresult = session.get(baseURL, payload)\nTypeError: get() takes exactly 2 arguments (3 given)\n\n\nThe code is listed here:\n\nimport requests\n\nbaseURL = 'http://www.uniprot.org/uniprot/'\n\nsample = open('sample.txt','r')\nout = open('out','w')\n\nfor line in sample:\n query = line.strip()\n payload = {\n 'query': query, \n 'format':'tab',\n 'columns': 'id, entry_name, organism, sequence'\n }\n result = requests.get(baseURL, payload)\n if result.ok:\n out.write(query + '\\t' + result.text[41:] + '\\n')\n\n\nExample input format:\n\nEDP09046\nONI31767\nENSFALT00000002630\nEAS32469\nENSXETT00000048864\n\n\nExample output format:\n\n\n EDP09046 R6X9 A0A251R6X9_PRUPE Prunus persica (Peach) (Amygdalus persica) MEENHAPALESIPNGDHEAATTTNDFNTHIHTNNDHGWQKVTAKRQRKTKPSKADSINNLNKLVPGVTIAGGEGVFRSLEKQSEDRRRRILEAQRAANADADSLAPVRSKLRSDDEDGEDSDDESVAQNVKAEEAKKSKPKKPKKPKVTVAEAAAKIDDANDLSAFLIDISASYESKEDIQLMRFADYFGRAFSAVTAAQFPWVKMFRESTVAKLADIPLSHISEAVYKTSVDWISQRSLEALGSFILWSLDSILADLASQVAGAKGSKKSVQNVSSKSQVAIFVVVAMVLRKKPDVLISILPTLRENSKYQGQDKLPVIVWAISQASQGDLAVGLHSWAHIVLPLVSGKGSNPQSRDLILQLAERILSTPKARTILVNGAVRKGERLVPPSAFEILIGVTFPAPSARVKATERFEAIYPTLKAVALAGSPRSKAMKQVSLQILSFAVKAAGESIPALSNEATGIFIWCLTQHADCFKQWDKVYQENLEASVAVLKKLSDQWKEHSAKLAPFDPMRETLKSFRHKNEKMLASGEDEAHQEKLIKDADKYCKTLLGKSSRGSGCKKSVALAVVALAVGAAVMSPNMESWDWDLEKLRVTISSFFD\n\n\nCan anyone suggest some ways that I may improve this code to make it faster?\n\nThanks in advance!" ]
[ "python", "performance", "python-requests", "bioinformatics" ]
[ "Neo4j csv cypher import", "Im trying to import csv files from disk with cypher commands as shown in the tutorial, but Im getting \"Couldn't load the external resourse at: externalResourceFailure.\nIs there any \"roadmap\" for importing csv in windows from files?\nThank you in advance!" ]
[ "neo4j" ]
[ "How to fix: setState does not work in gastby?", "I'm using gatsby for server side rendering.\n\nHere's my code:\n\nclass BookSearch extends Component {\n\n state = {\n search: '',\n books: '',\n };\n\n componentDidMount() {\n this.loadData()\n }\n\n loadData () {\n axios.get('/books/list')\n .then(response => {\n this.setState({books: response.data.books});\n console.dir(response.data.books);\n })\n .catch(error => {\n this.setState({error: true});\n });\n }\n\n\nUnfortunately, this.setState does not work in gatsby. componentDidMount is not being called when I load the page. What should I do?" ]
[ "reactjs", "gatsby" ]
[ "R: Converting integer to factor returns", "I have a vector vec. It is an integer:\n\ndput(vec)\nc(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, \n0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, \n0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, \n1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, \n0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, \n0L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, \n0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, \n1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, \n0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, \n0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, \n1L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, \n1L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, \n1L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, \n0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, \n0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, \n1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, \n0L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, \n1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, \n1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, \n0L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, \n1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, \n1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, \n1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, \n0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, \n1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, \n1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, \n1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, \n1L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, \n0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, \n1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, \n0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, \n1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, \n0L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, \n1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, \n0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, \n1L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, \n1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, \n0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, \n1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, \n1L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, \n0L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, \n0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, \n0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, \n1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, \n1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, \n0L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, \n0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, \n1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, \n0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, \n1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, \n1L, 1L, 1L)\n\n\nI can convert it to a factor and add levels in separate steps\n\nvec.fac <- factor(vec)\nlevels(vec.fac) <- c(\"A\", \"B\")\n\n\nbut when I try this in a single step\n\nfactor(vec, levels = c(\"A\", \"B\"))\n\n\nevery value becomes <NA>.\n\nQuestion: Why do these approaches produce different outcomes?" ]
[ "r", "na" ]
[ "How can I get the symbols in a package at the time the package is defined?", "In a Perl program I'm working on, the user can specify a Perl module to be loaded which is expected to define a couple (a variable number) of variables. The Perl program then processes these variables, basically treating the package as a plain hash except that the values are all in a namespace. Doing so works fine, i.e. this program prints '2':\n\nuse strict;\nuse warnings;\n\npackage P {\n my $k1 = 'v1';\n my $k2 = 'v2';\n};\n\nmy $n = scalar keys %P::;\nprint \"Number of entries: $n\\n\";\n# print $P::x;\n\n\nHowever, uncommenting the last line makes the program print '3'. I.e. the sheer mentioning of a variable in the package seems to add it to the symbol table.\n\nIs there a way to get the symbol table for a package as it is defined, such that the symbol table consists of just two entries?" ]
[ "perl", "package" ]
[ "Read cookie to login automatic", "I store the cookies when someone is logging in, as below:\n\nList<User> listUser;\n//returns 1 user\nforeach(User u in listUser)\n{\n HttpCookie cookieNickname = new HttpCookie(\"UserNickname\");\n cookieNickname.Value = u.Nickname.ToString();\n cookieNickname.Expires = DateTime.MaxValue;\n Response.Cookies.Add(cookieNickname);\n\n HttpCookie cookiePassword = new HttpCookie(\"UserPassword\");\n cookiePassword.Value = u.Password;\n cookiePassword.Expires = DateTime.MaxValue;\n Response.Cookies.Add(cookiePassword);\n}\n\n\nWhen someone visits the site again, I want to read data from the database which is associated with usernickname-cookie and userpassword-cookie.\n\nThen I want to show the firstname and lastname on a label.\n\nThis is what I tried:\n\nList<User> cookieLoggedInUser;\n\nif (Request.Cookies[\"UserNickname\"] != null && Request.Cookies[\"UserPassword\"] != null)\n {\n //returns 1 user\n cookieLoggedInUser = Database.SignIn(Request.Cookies[\"UserNickname\"].ToString(), Request.Cookies[\"UserPassword\"].ToString());\n\n if (cookieLoggedInUser.Count > 0)\n {\n foreach (User u in cookieLoggedInUser)\n {\n lblFirstName.Text = u.FirstName;\n lblLastName.Text = u.LastName;\n }\n }\n }\n\n\nBut both of the Request.Cookies return null.\n\nWhy is that happening?" ]
[ "c#", "asp.net", "cookies" ]
[ "PDF to Raster image, mistake in render", "I have deployed a PHP application to a new server with more recent version of ImageMagick and PHP, however, the new server (ImageMagick) does a poor job at converting PDF to raster (jpg or png).\n\nHere is the PHP code I run on both servers (with identical input file)\n\n$im = new Imagick();\n$im->setResolution( 72, 72 );\n$im->readImage( 'vector.pdf' );\n$im->setImageFileName('output-old.jpg');\n$im->writeImage();\n\n\nThe generated files look like this\n\nGenerated file on old server (looks correct)\nhttp://i.stack.imgur.com/owai5.jpg\n\nGenerated file on new server (problems)\nhttp://i.stack.imgur.com/xg3kv.jpg\n\nOriginal PDF\nhttps://drive.google.com/file/d/0B9RgJSi9aRIJcUJYd2Z4bzFDTTA/view?usp=sharing\n\nNOTE: same problem occurs when using ImageMagick via command line\n\nconvert vector.pdf output.jpg\n\n\nOld Server Configuration\n\n\nPHP: 5.3.10\nImageMagick: 6.7.6-0 2012-03-16 Q16\nOS: Ubuntu 12.04\n\n\nNew Server Configuration\n\n\nPHP: 5.6.13\nImageMagick: 6.9.2-3 Q16 x86_64 2015-09-23\nOS: CentOs 6.5\n\n\nYou would expect the later version of ImageMagick to work better and would rather use that if possible.\n\nCould the problem be in a configuration file or a dependant library? Will provide more server details if needed." ]
[ "imagemagick" ]
[ "PHP subprocess from nodejs app doesn't output anything", "I try to launch a PHP webserver from my nodejs application written in Typescript. The stdout/stderr of the PHP process must be redirected to a file in order to monitor it using another program.\n\nI followed the documentation here, and wrote this code:\n\nimport * as child_process from \"child_process\";\nimport * as process from \"process\";\nimport * as fs from \"fs\";\n\nlet out = fs.openSync(\"./test.log\", \"a\");\nlet err = fs.openSync(\"./test.log\", \"a\");\n\nlet proc = child_process.spawn(\"php -S 0.0.0.0:8080\", {cwd: \".\", env: process.env, shell: true, stdio: [\"ignore\", out, err]});\n\n\nBut the file test.log stays empty.\n\nThis code works when I execute a process that finishes (like $ php -i), but also with other long running processes like $ ping.\n\nI also tried other solutions ...\n\nlet proc = child_process.spawn(\"php\", [\"-S\", \"0.0.0.0:8080\"], {cwd: \".\", env: process.env, shell: false, stdio: [\"ignore\", out, err]});\n\n\nlet proc = child_process.spawn(\"php\", [\"-S 0.0.0.0:8080\"], {cwd: \".\", env: process.env, shell: true, stdio: [\"ignore\", out, err]});\n\n\n... but none of them worked.\n\nWhat am I doing wrong ? Is it an issue with php or with my nodejs code ?\n\nThanks !" ]
[ "php", "node.js", "typescript" ]
[ "Google SpreadSheet download csv with backslash for escape", "When i download some Sheet of Google SpreadSheet, i get a file with commas for fields, and double quotes for escape special character.\n\nIs it always like that?\n\nCan i change double quotes \n\n\"\"\n\n\nto backslash?\n\n\\\"" ]
[ "google-sheets", "escaping" ]
[ "adding fading effect in facebook fanpage", "I was wondering how this (http://www.facebook.com/Sennheiser) was done in facebook fanpage? It has a fading slider/gallery. Any good links or tutorials that talks about this? \n\nThanks!" ]
[ "javascript", "facebook", "fbml", "facebook-page" ]
[ "Collectionview inside tableview cell indexpath issue", "Im using collection view inside my tableview cell. \n\nFor this I made a tableview cell class and inside it define collectionview. i have 2 secions for collectionview and Im getting the issue right now of setting indexpath as I required indexpath to check which index of collection clicked .\n\n #pragma mark - UITableViewDelegate\n - (void)tableView:(UITableView *)tableView willDisplayCell:(FifaPlanTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {\n [cell setCollectionViewDataSourceDelegate:self indexPath:indexPath];\n }\n\n\ninterface FifaPlanCollectionView : UICollectionView\n@property (nonatomic, strong) NSIndexPath *indexpath;\n@end\n\n\n @interface FifaPlanTableViewCell : UITableViewCell\n @property (weak, nonatomic) IBOutlet FifaPlanCollectionView *collectionViewFifa;\n\n - (void)setCollectionViewDataSourceDelegate:(id<UICollectionViewDataSource, UICollectionViewDelegate>)dataSourceDelegate indexPath:(NSIndexPath *)indexPath;\n\n- (void)setCollectionViewDataSourceDelegate:(id<UICollectionViewDataSource, UICollectionViewDelegate>)dataSourceDelegate indexPath:(NSIndexPath *)indexPath\n{\n self.collectionViewFifa.delegate = dataSourceDelegate;\n self.collectionViewFifa.dataSource = dataSourceDelegate;\n self.collectionViewFifa.indexpath = indexPath;\n\n [self.collectionViewFifa reloadData];\n}\n\n\nAt this point self.collectionViewFifa.indexpath = indexPath; application is crashing saying: \n\nTerminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICollectionView setIndexpath:]: unrecognized selector sent to instance 0x7fa7aa016000'\n\n\nCan anyone let me know what I'm doing wrong here?" ]
[ "ios", "objective-c", "uitableview", "uicollectionviewcell" ]
[ "typescript fn return map object of composed functions", "i'm trying to type a helper function that takes in an object of functions and wrap it in another fn;\n\n\r\n\r\nconst bindFn = (obj, wrapFn) => Object.entries(obj).reduce((carry, [key, fn])=>{\r\ncarry[key] = ( ...args ) => wrapFn(fn.apply(null, args))\r\nreturn carry;\r\n},{})\r\n\r\n\r\n// example of usage\r\n\r\nconst n = bindFn( { sum: (x) => x+1 }, console.log);\r\nn.sum(3); // this should console.log 4\r\n\r\n\r\n\n\nproblem is i have no clue how to type bindFn to return proper type that contains an object with same keys and return types of supplied object. something like\n\ninterface BindFn = {\n[name: keysof obj] : () => Returntype<obj[name]> :D !!! no clue.\n}" ]
[ "typescript", "typescript-typings", "typescript-generics" ]
[ "MSAccess Building UDC.XML for Importing Webservice", "Problem\n\nI'm having difficulty building a Universal Data Connection (UDC) xml file for creating linked table to a web serivce in MSAccess (365 ProPlus, v2002).\n\nBackground:\n\nI've found resources around how to leverage a UDC file and UDC file creation (below). Googling around, I don't see many people doing this over the last decade.\nThe web service I am attempting to consume is Workday, which offers xml/xsd/wsdl/simplexml/csv/rss/gdata/json services. I've confirmed the webservice is functional and it is used in other processes (Python, Excel PowerQuery, etc).\nI am a novice at manipulating XML.\nFor this question, I am only interested in understanding how to get the UDC file functioning for use in establishing this connection inside of MSAccess; please no answers about using VBA to call the webservice, VBA Call Shell (some external script), using excel to pull the webservice/import it, etc.\nI've tried various UCD Connection Type configurations, including XML/Web Service. XML posted, below.\n\nResources Found:\n\n(Using Connection File) https://support.microsoft.com/en-us/office/link-to-a-data-service-5ce2738f-bf36-4490-a015-d1745d102bb8#:~:text=Link%20to%20an%20existing%20Data%20Service%20connection&text=your%20Access%20version%3A-,If%20you're%20using%20the%20latest%20version%20of%20the%20Microsoft,From%20Online%20Services%20%3E%20Data%20Services.\n(MS UDC Schema) https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms772017(v=office.14)#required-properties-by-connection-type\n\nMy Attempt: "UDC.xml"\n<udc:DataSource MajorVersion="2" MinorVersion="0" xmlns:udc="http://schemas.microsoft.com/office/infopath/2006/udc">\n \n <udc:Type MajorVersion="2" MinorVersion="0" Type="XmlQuery"/>\n \n <udc:ConnectionInfo Purpose="ReadOnly">\n \n <udc:SelectCommand>\n <udc:WebUrl>https:\\\\my.workday.url-RAAS</udc:WebUrl>\n </udc:SelectCommand>\n \n <udc:Authentication>\n <udc:UseExplicit CredentialType="Basic">\n <udc:UserId>myID</udc:UserId>\n <udc:Password>myPW</udc:Password>\n </udc:UseExplicit>\n </udc:Authentication>\n \n </udc:ConnectionInfo>\n \n</udc:DataSource>\n\nErrors Received:\nAccess Errors\nRequest\n\nReview my code and offer suggestions to get this working." ]
[ "xml", "ms-access", "webservice-client" ]
[ "How to submit object to delete method in CXF REST?", "I have REST services with cxf.\nMy delete method cannot take a custom object:\n\n\n @DELETE\n @Path(\"/soemPath\")\n @Produces({ \"application/json\", \"application/xml\" })\npublic void deleteStg(@PathParam(\"someId\") String someId, CustomObject customObject) throws InvalidClientIdException, TermsOfUseBusinessException {\n\n\nHowever, I cannot give the customObject (soapui does not have option for this one). If I change the method to update, everything works fine.\nCan you please tell me how should I handle this to be able to transmit customObject as input param?" ]
[ "java", "rest", "cxf" ]
[ "Can Extension Methods Be Called From The Immediate Window", "I ask the question because whenever I attempt to call an extension method from the Immediate window in Visual Studio 2010 I get the following error: \n\n\n System.Collections.Generic.IEnumerable' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)\n\n\nIf the Immediate window doesn't support extension methods, then why is it that when I type my variable (of type IEnumerable<QueryFilter>) followed by a dot, the IntelliSense lists all the extension methods?\n\nThere is nothing wrong with what I am typing in the Command window because if I copy and paste it into my code file and run, it works.\n\nWith Visual Studio 2012 doing the same thing for the same solution works fine. If I switch back to VS2010 and the problem persists." ]
[ "c#", "linq", "visual-studio", "code-contracts" ]
[ "onEdit function not working and throwing 'Cannot read property range of undefined'", "Using a trigger to run this code when the value in cell G2 of my google sheets changes (due to the output of another function) and following the advice of other questions I've essentially overloaded the onEdit function as seen below but I keep getting the error:\n\n\n 'Cannot read property range of undefined'\n\n\nreferring to the e.range.getA1Notation() portion, which shouldn't be an issue given its meant to reference the event passed in as the parameter. I'm a bit stuck here, I've provided the code below as well as a screenshot on how I've configured the trigger: \n\n\n\nfunction onEdit(e) {\n var cellAddress = e.range.getA1Notation();\n if(cellAddress === 'C2'){\n Logger.log('it worked');\n sendEmail();\n }\n}\n\nfunction sendEmail() {\n Logger.log(\"sent email\");\n var sheet = SpreadsheetApp.getActive().getSheetByName('KitchenDuties');\n var cell = sheet.getRange(2,9).setValue(\"emailed 1\");\n}\n\n\n\n\nEDIT: Updated code fixing other issues, same issue with error on line referring to 'e.range.columnStart'\n\nfunction createEditDrivenTrigger(){\n ScriptApp.newTrigger('onMyEdit')\n .forSpreadsheet('my sheet id')\n .onEdit()\n .create();\n}\n\nfunction onMyEdit(e) {\n const sh = e.range.getSheet();\n if(sh.getName()===\"KitchenDuties\" && e.range.columnStart ==3 e.range.rowStart==2){\n sendEmail();\n }\n}\n\nfunction sendEmail() {\n Logger.log(\"sent email\");\n var sheet = SpreadsheetApp.getActive().getSheetByName('KitchenDuties');\n var cell = sheet.getRange(2,9).setValue(\"emailed 1\");\n}" ]
[ "google-apps-script", "google-sheets", "triggers" ]
[ "Removing a widget from its wxPython parent", "The following program has a memory leak (I verified this on a linux system, with the top command)\n\nimport wx\nfrom random import randint\n\nclass MyPanel(wx.Panel):\n def __init__(self,parent):\n wx.Panel.__init__(self,parent)\n self._parent = parent\n self._nb_buttons = 0\n self._main_sizer = wx.BoxSizer(wx.VERTICAL)\n self._ctrl_sizer = wx.BoxSizer(wx.HORIZONTAL)\n self._btns_sizer = wx.BoxSizer(wx.VERTICAL)\n self._btn_tim = wx.Button(self,label=\"Start auto\")\n self._btn_tim.Bind(wx.EVT_BUTTON, self.OnStartStopEvent)\n self._ctrl_sizer.Add(self._btn_tim, 0, wx.CENTER|wx.ALL, 5 )\n self._main_sizer.Add(self._ctrl_sizer, 0, wx.CENTER )\n self._main_sizer.Add(self._btns_sizer, 0, wx.CENTER|wx.ALL,10)\n self.SetSizer(self._main_sizer)\n self._timer1 = wx.Timer(self)\n self.Bind(wx.EVT_TIMER, self.OnTimer, self._timer1)\n self._timer_running = False\n\n def OnStartStopEvent(self,event):\n if self._timer_running: # toggle state of Timer\n self._timer1.Stop()\n self._btn_tim.SetLabel(\"Start\")\n self._timer_running = False\n else:\n self._timer1.Start(200,False)\n self._btn_tim.SetLabel(\"Stop\")\n self._timer_running = True\n\n def AddWidget(self):\n self._nb_buttons += 1 \n label = \"Button %d\" % self._nb_buttons\n name = \"button%d\" % self._nb_buttons\n new_button = wx.Button(self,label=label, name=name)\n self._btns_sizer.Add( new_button, 0, wx.ALL, 5 )\n self._parent._my_sizer.Layout()\n self._parent.Fit()\n\n def RemoveWidget(self):\n if self._btns_sizer.GetChildren():\n self._btns_sizer.Hide(self._nb_buttons -1 )\n self._btns_sizer.Remove(self._nb_buttons -1 )\n self._nb_buttons -= 1\n self._parent._my_sizer.Layout()\n self._parent.Fit()\n\n def OnTimer(self,event):\n n = randint(-3,3)\n if self._nb_buttons < 2: n += randint(0,2)\n if self._nb_buttons > 10: n -= randint(0,3)\n while n > 0:\n self.AddWidget()\n n -= 1\n while n < 0:\n self.RemoveWidget()\n n += 1\n\nclass MyFrame(wx.Frame):\n def __init__(self):\n wx.Frame.__init__(self,parent=None, title=\"Add remove buttons\")\n self._my_sizer = wx.BoxSizer(wx.VERTICAL)\n panel1 = MyPanel(self)\n self._my_sizer.Add(panel1, 1, wx.EXPAND)\n self.SetSizer(self._my_sizer)\n self.Fit()\n self.Show()\n\ndef main():\n app = wx.App(False)\n frame1 = MyFrame()\n app.MainLoop()\n\nif __name__ == '__main__':\n main()\n\n\nThe problem is that in RemoveWidget, the button is removed from the Sizer, but not from the parent wx.Panel.\n\nWhat is the way to remove the wx.Button from the parent (wx.Panel in this case)?\n\nWhen I searched for \"remove wxPython widget\", the answers I found only told how to remove from sizers. (In fact, my code is a variation from http://www.blog.pythonlibrary.org/2012/05/05/wxpython-adding-and-removing-widgets-dynamically/ ).\n\nThere is a RemoveChild method in the wx.Window class, but documentation says it is internal and should not be called by user code (https://wxpython.org/Phoenix/docs/html/wx.Window.html#wx.Window.RemoveChild)" ]
[ "python", "wxpython" ]
[ "how to turn a sorted list into tab delimited values in Python?", "I have a sorted list that looks like this [('100','abc'),('99','bca')]. I want to turn this into something like this into a text file.\n\nabc 100<br>\nbca 99\n\n\nI have tried this \n\nimport csv\nwriter = csv.writer(f, delimiter = '\\t')\nwriter.writerows(d)\n\n\nbut this gives me the output as:\n\n100 abc<br>\n99 bca" ]
[ "python" ]
[ "No Suitable constructor found for File(file)", "I have been getting there error:\n\n error: no suitable constructor found for File(File)\n File file = new File(testFile);\n ^\nconstructor File.File(String,int) is not applicable\n (actual and formal argument lists differ in length)\nconstructor File.File(String,File) is not applicable\n (actual and formal argument lists differ in length)\nconstructor File.File(String) is not applicable\n (argument mismatch; File cannot be converted to String)\nconstructor File.File(String,String) is not applicable\n (actual and formal argument lists differ in length)\nconstructor File.File(File,String) is not applicable\n (actual and formal argument lists differ in length)\nconstructor File.File(URI) is not applicable\n (argument mismatch; File cannot be converted to URI)\n\n\nI do not understand what the error is telling me, could someone please explain?\nThis is my code:\n\n public ShortenWord( File testFile ) {\n try {\n File file = new File(testFile);\n Scanner in = new Scanner(file);\n\n List originalWords = new List();\n List abbWords = new List();\n\n while (in.hasNextLine())\n {\n String line = in.nextLine();\n String[] parts = line.split(\",\");\n String originalWord = parts[0];\n String abbWord = parts[1];\n }\n }\ncatch (FileNotFoundException e)\n {\n System.out.println(e);\n }\n}\n\n\nAny help on how to fix this error would be greatly appreciated. As I don't have a clue\n:)" ]
[ "java", "java.util.scanner" ]
[ "Java - Listing the index of duplicate values in an int array", "I have to locate and list all duplicate index values in array.\n\nExample:\nint[] array = { 0, 7, 9, 1, 5, 8, 7, 4, 7, 3};\n\n7 is located in three different locations at index 1, 6, and 8. How would I go about modifying my existing code in order to have outputResults.setText() show the location of the duplicate values? outputResults.setText() is JTextField if that helps.\n\nString tmp1 = getNumbers.getText();\n try {\n int search = Integer.parseInt(tmp1);\n for (p = 0; p < array.length; p++) {\n if(array[p]==search) {\n b = true;\n index = p;\n }\n } \n if(b==true)\n outputResults.setText(search + \" was in the following fields of the array \" + index);\n else \n throw new NumberNotFoundException(\"Your number was not found.\");\n\n\n } catch (NumberFormatException ex) {\n JOptionPane.showMessageDialog(getContentPane(), \"You can only search for integers.\");\n\n } catch (NumberNotFoundException ex) {\n JOptionPane.showMessageDialog(getContentPane(), ex.getMessage());\n }\n\n\nAt it's current state, it will only list the last time the duplicate number was located which would be index 8 based on my example. The list of numbers in the array is inputted by the user, and I'm not allowed to sort the values. My original guess was to create a nested loop and whenever it located an duplicated number, add p (current index it's searching) to a new array. I would then list the full array in outputResults.setText() but it gave several warnings and errors when I tried.\n\nThe full code can be found here if needed: http://pastebin.com/R7rfWAv0\nAnd yes, the full program is a mess but it gets the job done and I was having such a headache with it. Also note, in the full program, the professor asked us to throw an exception if a duplicate value was detected as extra credit. I did it, but I commented it out to finish the original assignment so please disregard it." ]
[ "java", "arrays", "eclipse", "exception", "duplicates" ]
[ "When does a new python session in AWS is created?", "I have a scheduled event that triggers a lambda every two minutes in certain hours. Most of the time, as it does from file import lambda_handler, it maintains the same python session. Namely, the global variables are kept between runs.\nEvery several hours(not consistently), it reinitiate a python session.\nThis results in a strange pattern, which I couldn't figure out the reasoning behind it. Is there?" ]
[ "python", "aws-lambda" ]
[ "How do I keep WZZIP from creating a zip that makes a folder when unzipped?", "I'm looking at an automated process (utilizing a \"DOS\" .BAT file) that creates zip files with a simple command like...\n\nwzzip [path][zip file name] [files to be zipped]\n\n...but when a partner receives and unzips these files, it's creating a folder with the name of the zip file and putting the files inside it, and they need (well, or at least prefer) it to just extract the files to the \".\" folder.\n\nIs there a way to get wzzip to use \".\" instead of creating an eponymous folder? The only thing I could see in the options list was to maybe hack something out of -r-p (even though I DON'T actually want it to recurse folders when zipping), but I was hoping there might be a better way.\n\nThe partner company is apparently running Linux, so while I see that wzunzip has an option to set the output folder that MIGHT override the default behavior, I'm not sure what the app they are using might allow." ]
[ "batch-file" ]
[ "Running out of Memory with POS Tagging in R", "I'm hoping there is a better way to do this. I have a data.table with tweets: 8018 of them. I am using data.table function to do POS tagging on each tweet.\n\ndata.table:\n\nTweet\nSample Tweet 1 :)\nsample tweet 2\n\n\nFunction for POS tagging:\n\ntagPOS = function(x) {\n s <- as.String(x)\n sent_token_annotator = Maxent_Sent_Token_Annotator()\n word_token_annotator = Maxent_Word_Token_Annotator()\n a2 = annotate(s, list(sent_token_annotator, word_token_annotator))\n pos_tag_annotator = Maxent_POS_Tag_Annotator()\n a3 = annotate(s, pos_tag_annotator, a2)\n a3w = subset(a3, type == \"word\")\n POStags = unlist(lapply(a3w$features, `[[`, \"POS\"))\n return(paste(POStags,collapse = \" \"))\n}\n\n\nGetting POS:\n\ndat[,c(\"ID\"):= .I]\noptions( java.parameters = \"-Xmx10g\" )\ndat[,c(\"POS\"):= tagPOS(Tweet),by = .(ID)]\n\n\nEven with setting the memory I'm getting this error:\n\nError in .jnew(\"opennlp.tools.postag.POSModel\", .jcast(.jnew(\"java.io.FileInputStream\", : \njava.lang.OutOfMemoryError: GC overhead limit exceeded" ]
[ "r", "twitter", "nlp", "data.table" ]
[ "netty websockets hornetq 2.2.5 fails with latest chrome on Sec-WebSocket-Accept header", "I am trying to run the netty stomp websockets example in the hornetq 2.2.5 distribution but it does not work with Chrome latest version. Chrome shows the following error in the javascript console - \n\nError during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing\n\n\nReading on forums seems to suggest that this is related to Netty itself. I understand that chrome is too fast to adapt to the changing websockets protocol so its complaining about a header not being returned from the server.Netty version with the hornetq distro seems to be 3.2.3. If this related to Netty only? Can this be fixed by using a later version of Netty with the same distibution of hornetq?" ]
[ "google-chrome", "websocket", "netty", "hornetq" ]
[ "HTML Form sending wrong file payload", "Got the following form for an file upload:\n\n<form id=\"uploadCSVForm\" action=\"../admin/account?CSRFToken=$CSRFToken\"\nmethod=\"post\" enctype=\"multipart/form-data\" style=\"opacity: 0;\">\n\n <input id=\"uploadCSV\" type=\"file\" accept=\".csv\" \n onchange=\"javascript:this.form.submit();\"/>\n</form>\n\n\nThe file upload dialog is triggered with jQuery:\n\nfunction importCSV() {\n $('#uploadCSV').click();\n}\n\n\nThe function importCSV() is executed when a specific button is clicked.\n\nWhat I want is, that when the Open button from the file upload dialog is clicked, the chosen file should be send to the server.\n\nWith the code mentioned above the form is sending the following request payload:\n\n------WebKitFormBoundaryB4a9e2nyaO3MNCw2\nContent-Disposition: form-data; name=\"CSRFToken\"\n\nF5VhCnbCTVWhapxZhQJZ\n------WebKitFormBoundaryB4a9e2nyaO3MNCw2--\n\n\nThe request hasn't the payload from the chosen file, instead it has the CSRFToken as payload, which is the value from the action parameter of the form. I can't figure out why." ]
[ "javascript", "jquery", "html", "file-upload", "request" ]
[ "Calling script from Blazor with parameters", "I've been given a script function and would like to partially translate it to C# in a Blazor app\n\n<script> \n function pay() {\n var token = document.getElementById('token').value;\n var card = document.getElementById('card').value;\n var exp = document.getElementById('exp').value;\n var cvv = document.getElementById('cvv').value;\n var paymentData = {\n ssl_txn_auth_token: token,\n ssl_card_number: card,\n ssl_exp_date: exp ,\n ssl_cvv2cvc2: cvv\n };\n\n ConvergeEmbeddedPayment.pay(paymentData);\n return false;\n }\n </script>\n\n\nI want to call the script (that is inside the script above)\n\n ConvergeEmbeddedPayment.pay(paymentData);\n\n\nDirectly from c# . Like so\n\nawait JsRuntime.InvokeVoidAsync(\"ConvergeEmbeddedPayment.pay\", paymentData);\n\n\nThere is some good information here: \n\nhttps://docs.microsoft.com/en-us/aspnet/core/blazor/call-javascript-from-dotnet?view=aspnetcore-3.1\nBut it stops short of helping me.\n\nWhat kind of variable should I pass in the paymentData parameter? And how should I pass it?\nI've tried var , object and string and also tried JsonSerializer.Serialize( ); but no luck \nBased on suggestion from @BurningKarl I tried Dictionary and object[] but \n I get an error saying the content is missing or \"Expected BEGIN_OBJECT but was STRING \"" ]
[ "javascript", "blazor" ]
[ "No matching function call to 'pthread_create' in Xcode", "No matching function call to 'pthread_create'\n\n# include <stdio.h>\n# include <pthread.h>\n\nstring nextProduced;\nstring nextConsumed;\nchar *BUFFER;\nint BufferSize = 10;\nvoid putItemIntoBuffer();\nstring produceItem();\nstring consumeItem();\nvoid *Producer();\nvoid *Consumer();\n\npthread_cond_t Buffer_Not_Full=PTHREAD_COND_INITIALIZER;\npthread_cond_t Buffer_Not_Empty=PTHREAD_COND_INITIALIZER;\npthread_mutex_t mVar=PTHREAD_MUTEX_INITIALIZER;\n\nint main()\n{\npthread_t pro, con;\n\nBUFFER=(char *) malloc(sizeof(char) * BufferSize);\n\npthread_create(&pro,NULL,Producer,NULL);// Creates threads \n\npthread_create(&con,NULL,Consumer,NULL);// Creates threads \n\npthread_join(pro,NULL);\n\npthread_join(con,NULL);\n\n\nreturn 0;\n\n\n}\n\nXcode gives me the error, \"No matching function call to 'pthread_create'\". I dont know what i'm doing wrong. Any help would be greatly appreciated. \n\nI was able to get it to compile but i am now getting this message.\nI do not know what the problem is.\nthread 1, Queue : com.apple.main-thread\n\nlibsystem_c.dylib`strlen:\n0x7fff8d8364e0: pxor %xmm0, %xmm0\n0x7fff8d8364e4: movl %edi, %ecx\n0x7fff8d8364e6: movq %rdi, %rdx\n0x7fff8d8364e9: andq $-16, %rdi\n0x7fff8d8364ed: orl $-1, %eax\n0x7fff8d8364f0: pcmpeqb(%rdi), %xmm0 Thread 1:EXC_ACCESS (code=1, address=0x0) //line in question\n0x7fff8d8364f4: andl $15, %ecx\n0x7fff8d8364f7: shll %cl, %eax\n0x7fff8d8364f9: pmovmskb%xmm0, %ecx\n0x7fff8d8364fd: andl %eax, %ecx\n0x7fff8d8364ff: je 0x7fff8d83650b ; strlen + 43\n0x7fff8d836501: bsfl %ecx, %eax\n0x7fff8d836504: subq %rdx, %rdi\n0x7fff8d836507: addq %rdi, %rax\n0x7fff8d83650a: ret \n0x7fff8d83650b: pxor %xmm0, %xmm0\n0x7fff8d83650f: addq $16, %rdi\n0x7fff8d836513: movdqa (%rdi), %xmm1\n0x7fff8d836517: addq $16, %rdi\n0x7fff8d83651b: pcmpeqb%xmm0, %xmm1\n0x7fff8d83651f: pmovmskb%xmm1, %ecx\n0x7fff8d836523: testl %ecx, %ecx\n0x7fff8d836525: je 0x7fff8d836513 ; strlen + 51\n0x7fff8d836527: subq $16, %rdi\n0x7fff8d83652b: jmp 0x7fff8d836501 ; strlen + 33" ]
[ "c++", "ios", "xcode", "parameters", "pthreads" ]
[ "iPhone safari bottom bar", "I'm having a problem with iPhone safari bottom bar (the one with back and forward buttons, new tab button and other stuff). In my app, I have an absolute positioned button at the bottom of the screen which is 100% width and almost the same height as the safari bottom bar and my button is that way behind the safari bar and not visible. Is there any way to know if the safari bottom bar is there so that I know when to move my content or even better is there a way to remove it completely?\n\nI tried this:\n\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">\n\n\nAnd also the minimal-ui tag but it didn't work." ]
[ "javascript", "html", "iphone", "safari" ]
[ "My application breaks down when I reload the concrete page using react routing", "I have a news web-application and I`m trying to create a publication page, my situation is next, I have a list of publications, then I click on one of them and visit a page with all the information about the publication I clicked on, when I visit this page for the first time, everything is ok, but when I reload it my application breaks down and I see a meaningless error in the console, because after the page is reloaded, instead of loading the page it is trying to load some css file, I dont know how to explain. but when I visit this page for the first time my Sources look like this.\n\n\n\nBut when I reload the page it looks like this.\n\n\n\nAs I said I dont know how to explain everything right, so I'll just provide everything I can.\n\nThe error I have:\n\n\n\nAnd my url:\n\nhttp://localhost:8080/publications/by-id/publication-eight\n\nI hope you guys help me with this." ]
[ "javascript", "reactjs", "url", "routing", "react-router" ]
[ "TextInputLayout com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup", "Hi I have update my sdk and now I can't use TextInputLayout from design support library. It was working fine before I updated.\n\nIt gives error in XML file that Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup\n\nhere is my XML\n\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:paddingBottom=\"@dimen/activity_vertical_margin\"\nandroid:paddingLeft=\"@dimen/activity_horizontal_margin\"\nandroid:paddingRight=\"@dimen/activity_horizontal_margin\"\nandroid:paddingTop=\"@dimen/activity_vertical_margin\"\ntools:context=\"com.example.edittest.MainActivity\" >\n\n<android.support.design.widget.TextInputLayout\n android:id=\"@+id/fNameLayout\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_below=\"@+id/imageView\"\n android:layout_centerHorizontal=\"true\"\n android:layout_marginTop=\"10dp\" >\n\n <EditText\n android:id=\"@+id/fName\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:ems=\"10\"\n android:hint=\"First Name\" />\n</android.support.design.widget.TextInputLayout>\n\n\n\n\nPlease help me out." ]
[ "android", "android-layout" ]
[ "How can a completely fill its parent ?", "Here is the relevant code (doesn't work):\n\n<html>\n<head>\n<title>testing td checkboxes</title>\n<style type=\"text/css\">\ntd { border: 1px solid #000; }\nlabel { border: 1px solid #f00; width: 100%; height: 100% }\n</style>\n</head>\n<body>\n<table>\n <tr>\n <td>Some column title</td>\n <td>Another column title</td>\n </tr>\n <tr>\n <td>Value 1<br>(a bit more info)</td>\n <td><label><input type=\"checkbox\" />  </label></td>\n </tr>\n <tr>\n <td>Value 2</td>\n <td><input type=\"checkbox\" /></td>\n </tr>\n</table>\n</body>\n</html>\n\n\nThe reason is that I want a click anywhere in the table cell to check/uncheck the checkbox.\n\nedits:\nBy the way, no javascript solutions please, for accessibility reasons.\nI tried using display: block; but that only works for the width, not for the height" ]
[ "css" ]
[ "Uninitialized constant FAKER when \"seeding\" db", "I am trying to seed a db using the gem faker but keep getting:\n\nrails aborted!\nNameError: uninitialised constant FAKER\n\n\nwhen running rails db:seed\n\nInitially I though it was a problem with my project so I created a new clean one, added gem 'faker' to the Gemfile, ran 'bundle install` but I have the same error.\n\ndb/seed.rb\n\n50.times do\n name = FAKER::NAME.name\n Item.create(name: name)\nend\n\n\nI also tried to add require 'faker' to the beginning of the seed.rb file but nothing changed.\n\nI checked all the other answers on Stack Overflow, but they don't seem to solve my problem. \n\nAny idea? \n\nRuby: 2.4.0p0\n\nRails: 5.0.1\n\nEDIT: The gem is not installed in the test group as suggested on\nNameError: uninitialized constant Faker ; Ruby on Rails" ]
[ "ruby-on-rails", "ruby", "faker" ]
[ "iterating in a list of dataframe names with pandas", "I have some dataframes defined, they have data (floats) and their names are: \n\ndf_names = ['df_correl_USDCOP','df_correl_USDCLP','df_correl_USDRUB']\n\n\nI also have defined the following lists to be able to plot using a loop:\n\nfigures = ['fig'+str(i+1) for i in range(len(df_names))]\naxes = ['ax'+str(i+1) for i in range(len(df_names))]\n\nfor fig, ax, name in zip(figures,axes,df_names):\n fig,ax = plt.subplots(figsize=(14,10))\n ax.plot(name[:],lw=4)\n\n\nwhen doing this, an error appears as in the loop the dataframe is not recognized as such, but just as a string. \n\nValueError: could not convert string to float: df_correl_USDCOP\n\n\nI was checking this answer, How can I iterate through multiple dataframes to select a column in each in python? but wasn't able to apply it to this example. \n\nThe question is not regarding the plotting itself, but how to iterate trough the dataframe name list and get the \"actual\" dataframe and not a string with its name." ]
[ "python", "pandas" ]
[ "RequireJS dependency undefined in callback method", "I started to use RequireJS, the dependency loads fine but in the callback method all dependencies are undefined.\n\nrequire.config({\n baseUrl: 'js',\n paths: {\n angular: '../lib/angular/angular',\n myApp: 'app',\n states: 'app-states',\n controllers: 'controllers',\n filters: 'filters',\n services: 'services',\n oauth2: 'oauth2'\n //async: 'lib/require/async'\n },\n shim: {\n 'myApp': {\n deps: ['angular']\n },\n 'states' : {\n deps: ['angular', 'myApp']\n },\n 'controllers': {\n deps: ['angular', 'myApp']\n },\n 'filters': {\n deps: ['angular', 'myApp']\n },\n 'services': {\n deps: ['angular', 'myApp']\n } \n }\n});\n\nrequire(['angular', 'myApp', 'states', 'controllers', 'filters', 'services'], function(angular, myApp, states, controllers, filters, services) {\n 'use strict';\n console.log('requireJs done');\n console.log(angular);\n console.log(myApp);\n angular.bootstrap(document, ['myapp']);\n}); \n\n\nIf I just require angular, the callback method is not called. I was wondering why.\n\nrequire(['angular', function(angular) {\n console.log(\"requireJS done\");\n}]);" ]
[ "javascript", "angularjs", "requirejs" ]
[ "How can I check authentication in ajax url?", "Consider the following ajax call:\n\n function drawCharts() {\n var jsonData1 = $.ajax({\n url: \"http://localhost:****/*/*\",\n dataType:\"json\",\n async: false\n }).responseText;\n\n\nMy index.html\n\n<div id=\"chart_div\" title='Speedo Information'></div>\n\n\nI am making an api that converts json data to tabular form using Google Visualization Api.\n\nWhile accessing the url alone the url asks for a user name and password. I have the credentials.\n\nNOTE: The username and password is used to protect the data in the url from unauthorized access.\n\nI need to ask for a user name while opening the index.html page and then display the table." ]
[ "jquery", "ajax", "google-visualization" ]
[ "Update background automatically in UITableView", "I am making an iOS app and It is based on a UITableView. I set the background so that when there is no TableViewCell, the background is a custom background. And when there are TableViewCells, the app changes the background to the color. The problem is, the app has to be force-quit and restarted for the background to change. Is there anyway that I can do this so that is automatically updates the background? Here is my code:\n\n// Check if table view has any cells\nint sections = [self.tableView numberOfSections];\nBOOL hasRows = NO;\nfor (int i = 0; i < sections; i++)\n hasRows = ([self.tableView numberOfRowsInSection:i] > 0) ? YES : NO;\n\nif (sections == 0 || hasRows == NO)\n{\n self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@\"background-app.png\"]];\n\n}\nelse\n{\n self.tableView.backgroundColor = [UIColor whiteColor];\n self.tableView.backgroundView = nil;\n}\n\n\nI put this in my viewDidLoad" ]
[ "ios", "objective-c", "uitableview" ]
[ "AndEngine for Android 2.3", "I'm making a android game for Gingerbread. When i tried downloading AndEngine from official source, it was only available for APK 15+ version. \n\nThe version in incompatible with Gingerbread. I even googled up looking for previous versions but couldn't find one. Help me out !" ]
[ "android", "andengine" ]
[ "css height property as screenSize - 300px;", "I want to create a div that has a height equal to the screen's height, minus 300px.\n\nHow can I do this in CSS without using JavaScript?\n\nBy \"screen height\" I mean the height of the view port, not the display itself." ]
[ "css" ]
[ "Combine RegEx and fill an underminate number of cells", "I have a cell in Excel that holds a long string in cell A1:\n\n\"ABC12+BED58,YZ001\"\n\n\nI have the following regex to match some specific variables in my string\n\nstrPattern = \"[A-Z]{1,3}[0-9]{2,4}\"\n\n\nBasically, I need to write a macro or a function (I would prefer a function actually) that will fill cell A2, A3, A4 like that:\n\nABC12\nBED58\nYZ001\n\n\nThe thing is, there is an undeterminate number of parameters in the string (so for example, it could go all the way through A200).\n\nI'm thinking of a function get_n_variables(str, n) that would return the Nth unique match\n\nHere is my progress so far but the function returns #VALUE!\n\nFunction simpleCellRegex(Myrange As Range) As String\n Dim regEx As New RegExp\n Dim strPattern As String\n Dim strInput As String\n Dim matches As Object\n\n\n strPattern = \"[A-Z]{1,3}[0-9]{2,4}\"\n\n If strPattern <> \"\" Then\n strInput = Myrange.Value\n strReplace = \"\"\n\n With regEx\n .Global = True\n .MultiLine = True\n .IgnoreCase = False\n .Pattern = strPattern\n End With\n\n If regEx.Test(strInput) Then\n Set matches = regEx.Execute(strInput)\n simpleCellRegex = matches(0).SubMatches(0)\n Else\n simpleCellRegex = \"Not matched\"\n End If\n End If\nEnd Function" ]
[ "regex", "vba", "excel" ]
[ "Pytorch: CNN don't learn anything after torch.cat()?", "I try to concatenate Variable in the network with code like this \n\n x = self.layer1(x)\n x = self.layer2(x)\n x = self.layer3(x)\n x = self.layer4(x)\n\n x = x.view(x.size(0), -1)\n x= torch.cat((x,angle),1) # from here I concat it.\n x = self.dropout1(self.relu1(self.bn1(self.fc1(x))))\n x = self.dropout2(self.relu2(self.bn2(self.fc2(x))))\n x = self.fc3(x)\n\n\nAnd then I find my network learn nothing and give acc always around 50%. So I print param.grad and as I expected, they are all nan. Does anyone encounter this thing before?\n\nI ran the code without concatenation before and it works out well. So I suppose this is where the rub is and the system doesn't throw any error or exception. if any other backup info is needed, please let me know.\n\nThank you." ]
[ "pytorch" ]
[ "POST a javascript objet to a PHP file", "I try to post an JS object to PHP, but the PHP says nothing.. It looks like it don't recognize the POST...\n\nHere is the JS :\n\n$('.send').click(function() {\n var Scommand = JSON.stringify(command);// Command is my JS obj\n\n if (commande.type) {\n $.ajax({\n url:'test.php',\n context:$(this),\n type:'POST',\n data:Scommande,\n success : function(data){\n commande = {};\n window.location='test.php';\n }\n });//End Ajax\n }\n else {'PLz specify a type');}\n});\n\n\nAnd my PHP : \n\n<?php\necho $_POST['type'];\n?>\n\n\nIt returns : Notice: Undefined index: type in /Applications/MAMP/htdocs/BackOfficeDavid/test.php on line 2\n\nLike nothing go throw the POST ... Any clue ?" ]
[ "php", "javascript", "jquery" ]
[ "concatinate numpy matrices to get an array with dimension 3", "I want to concatenate numpy matrices that have different shapes in order to get an array with dimension=3.\nexample : \n\nA= [[2 1 3 4]\n [2 4 0 6]\n [9 5 7 4]]\nB= [[7 2 8 4]\n [8 6 8 6]]\n\n\nand result what I need should be like that: \n\nC=[[[2 1 3 4]\n [2 4 0 6]\n [9 5 7 4]]\n [[7 2 8 4]\n [8 6 8 6]]]\n\n\nThanks for help" ]
[ "python", "arrays", "numpy", "matrix" ]
[ "PHP dropdown only selecting the last item in list", "I created a drop down list in PHP and it's selecting the last item of the list and I can't figure out why it's doing this. \n\nWhen I echo the event_id (the value that is returned), it's the last item every time. The list is populated correctly. \n\n$forms = mysql_query(\"select events.event_title, events.event_id, saved_forms.id from events\n INNER JOIN saved_forms on saved_forms.id = events.event_id\n where saved_forms.form_type = 'e' and events.event_by = '$my_username'\"); \n\nwhile($form = mysql_fetch_array($forms)){\n $form_id = $form['event_id'];\n $selection.=\"<OPTION VALUE=\\\"$form_id\\\">\".$form['event_title'].\"</OPTION>\";\n}\n\n?>\n<div id=\"saved_forms\">\n<tr><td><select name =\"saved_form\" value =\"<? echo $form_id; ?>\" onchange=\"showUser(<? echo $form_id; ?>)\">\n<Option value=\"$form_id\"><? echo $selection; ?></Select></td><td>Select Existing Form</td></tr>\n</div>" ]
[ "php", "drop-down-menu" ]
[ "Display info from api to html table", "I have a problem with an api , I've try console.log(response.[\"\"0\"\"].body) to get a respone on console , but it's not working .I need to take all those data from api in my table.\n\nThis is my code:\n\n\r\n\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<script>\r\n Js code\r\n\r\n var root = 'https://jsonplaceholder.typicode.com';\r\n $.ajax({\r\n url: root + '/posts',\r\n method: 'GET',\r\n success: function(response) {\r\n console.log(response);\r\n }\r\n \r\n });\r\n var body = document.getElementsByTagName('body')[0];\r\n var table = document.createElement('table');\r\n body.appendChild(table);\r\n table.setAttribute('id', 'mytable');\r\n var createrow = function(c1,c2){\r\n var row = document.createElement('tr');\r\n row.appendChild(c1);\r\n row.setAttribute('class', 'row')\r\n row.appendChild(c2); \r\n \r\n return row;\r\n }\r\n var createcell = function(value){\r\n var cell = document.createElement('td');\r\n cell.setAttribute('class', 'cell');\r\n cell.innerText=value;\r\n return cell;\r\n }\r\n \r\n \r\n table.appendChild(createrow(createcell('Mihaela'),createcell('11')))\r\n</script>" ]
[ "javascript", "ajax" ]
[ "XAMP: Mysql Connection Stuck", "Lately I developed in ASP.NET MVC\nafter I done my project. When I tried my Xampp today\nThe Mysql module is the only one not working to the module\nthe apache module is working on my xampp\n\nwhy it happens? \n\nI try to change the port of mysql:3306 to 3308\nthen the httpd config I change the port:80 to port:8080\nbut still the xampp says Attempting to start MySQL app...\nif i start the mysql module." ]
[ "mysql", "xampp" ]
[ "Creating case-insensitive indexes on Postgres string array", "I'm using a varchar[] column (varchar array) in Postgres 9.2 to store some tags. While retrieving rows by tags, I want the query to be case insensitive. However, I want to preserve the case to display in the UI (therefore I can't just store everything as lower case).\n\nSo, my question is how do I create a case-insensitive index in Postgres over a varchar array? One possible approach would be to create a functional GIN index on the column. How does one do that? Any other approaches?" ]
[ "postgresql", "postgresql-9.2", "database-indexes" ]
[ "How to print floating points with a number in dart", "I am new in dart programming.\nmain() {\n var a, b, c;\n a = 10;\n b = 5;\n c = a / b;\n print('$a / $b = $c');\n}\n\nThis code will produce 2.0 as output. But if in the same code I want to print 2.00000000 (as much as I need 0 or other numbers in different cases.) then what should I do?\nLike in C programming language we define our syntax:\nprintf(".5f", variable);" ]
[ "dart" ]
[ "(UML) Spring-Statemachine is still running after a statemachine.stop()", "I have a guard in my Spring-Statemachine.\n\n@Bean\npublic Guard<String, String> myGuard() {\n return context -> {\n try {\n String x = null;\n x.length();\n return true;\n } catch (Exception e) {\n context.getStateMachine().setStateMachineError(e);\n context.getStateMachine().stop();\n throw e;\n }\n };\n}\n\n\nThis will of course be a java.lang.NullPointerException.\nSo, after I make a context.getStateMachine().stop(); I was expecting, that the statemachine is stopping. \n\n2017-11-24 18:02:55.783 INFO 30652 --- [nio-8080-exec-1] o.s.s.support.LifecycleObjectSupport : stopped org.springframework.statemachine.support.DefaultStateMachineExecutor@367d6b09\n\n\nSo, it stopped.\nBut than all other guards and states and actions are called afterwards.\n\nBut when an error appeared, I definitely don't want the guard just switch to false, I really want to exit the machine.\n\nThere is only one region. So, as far as I understood it, it should just stop.\n\nIs there any way to handle this? Or is there any way to call something like an \"Exit event\" when this is happening?\n\nI'm thankful for any ideas how to deal with this.\n\nUsing: \n\nspring-boot: 1.5.8\nspring-statemachine-uml 1.2.6" ]
[ "java", "spring", "uml", "state-machine", "spring-statemachine" ]
[ "Open GL 3D library for iOS (and Android)?", "Is there some free and easy to use 3D library for iOS (and Android) that simplifies Open GL ES framework. Just like there is cool WebGL library: ThreeJS for javascript.\n\nSo far I saw Unity but it's not free and I would like something simplified.\n\nMy usage would be setting the scene, meshes, camera, rotating the camera etc..." ]
[ "android", "ios", "opengl-es", "3d" ]
[ "Why does this loop get progressively slower?", "for (i = 0; i < $('body > p font i').length; i++) {\n current = [$('body > p font i').eq(index), $('body > p font i').eq(index).index('body > p font u, body > p font i')];\n getState(current[1]);\n}\n\nfunction getState(index) {\n // Lookup the object's index, then crawl up until you find a match\n while ($('body > p font u, body > p font i').eq(--index).filter('u').length == 0);\n console.log($('body > p font u, body > p font i').eq(index).text());\n}\n\n\nFairly simple question. I'm iterating a jQuery result set against a selector filter until I find a match, climbing up through the result set as I go.\n\nThe longer this loop runs, the slower it becomes, almost exponentially so." ]
[ "javascript", "jquery", "performance" ]
[ "App crashes when access the length of [NSData dataWithContentsOfURL:url]", "Here is the problem:\n\nThe app crashes at the 2nd line, and I got EXC_BAD_ACCESS exception.\n\nNSURL *url = [NSURL URLWithString:@\"...\"];\n\nNSError *error = nil;\nNSData *data = [NSData dataWithContentsOfURL:url \n options:NSDataReadingMapped \n error:&error];\nNSLog(@\"Error: %@\", error);\nNSLog(@\"%@\", [data length]);\n\n\nI got:\n\nError: (null)\nProgram received signal: “EXC_BAD_ACCESS”.\n\n\nAny idea?" ]
[ "iphone" ]
[ "Reading XML tags getting value from inner tag", "I don't know how to explain my situation, I can provide example below. \nI have an XML file to be read in Java, something like this:\n\n<Author AffiliationIDS=\"Aff1\">\n <AuthorName DisplayOrder=\"Western\">\n <GivenName>Wei</GivenName>\n <GivenName>Long</GivenName>\n <FamilyName>\n <Value>Tan</Value>\n </FamilyName>\n </AuthorName>\n</Author>\n\n\nAs you can see the <FamilyName> tag, inside the <FamilyName> tag is surrounded by a Value tag. This is because in the xsd it stated the element as maxOccurs=\"unbounded\" which mean more than one value can be in that element tag. How should I modify the code so that it can read in the <FamilyName> tag and get Value tag element no matter how many occurrence of the Value exist?\n\nExample:\n\n <FamilyName>\n <Value>Sarah</Value>\n <Value>Johnson</Value>\n </FamilyName>\n\n\nThe code look like this.\n\nimport javax.xml.parsers.DocumentBuilderFactory;\nimport javax.xml.parsers.DocumentBuilder;\nimport org.w3c.dom.Document;\nimport org.w3c.dom.NodeList;\nimport org.w3c.dom.Node;\nimport org.w3c.dom.Element;\nimport java.io.File;\n\npublic class ReadXMLFile {\n\n public static void main(String argv[]) {\n\n try {\n\n File fXmlFile = new File(\"/fileaddress/test-1.xml\");\n DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\n DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\n Document doc = dBuilder.parse(fXmlFile);\n\n\n doc.getDocumentElement().normalize();\n\n System.out.println(\"Root element :\" + doc.getDocumentElement().getNodeName());\n\n NodeList nList = doc.getElementsByTagName(\"AuthorName\");\n\n System.out.println(\"----------------------------\");\n\n for (int temp = 0; temp < nList.getLength(); temp++) {\n\n Node nNode = nList.item(temp);\n\n System.out.println(\"\\nCurrent Element :\" + nNode.getNodeName());\n\n if (nNode.getNodeType() == Node.ELEMENT_NODE) {\n\n Element eElement = (Element) nNode;\n\n System.out.println(\"Given Name : \" + eElement.getElementsByTagName(\"GivenName\").item(0).getTextContent());\n System.out.println(\"Family Name : \" + eElement.getElementsByTagName(\"FamilyName\").item(0).getTextContent());\n\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n}" ]
[ "java", "xml", "parsing" ]
[ "read.csv in R doesn't import all rows from csv file", "I have a comma separated dataset of around 10,000 rows. When doing read.csv, R created a dataframe rows lesser than the original file. It excluded/rejected 200 rows. \nWhen I open the csv file in Excel, the file looks okay. The file is well formatted for line delimiters and also field delimiters (as per parsing done by Excel).\n\nI have identified the row numbers in my file which are getting rejected but I can't identify the cause by glancing over them.\n\nIs there any way to look at logs or something which includes reason why R rejected these records?" ]
[ "r" ]
[ "Hosting C# \"Service Library\" in Azure", "I have a C# WCF Service Library that's running properly locally. A client running locally was able to see the service and consume it.\nHowever, when I tried hosting the service in a WebRole and deploying it on Azure, the client was never able to connect to it successfully the same way it did locally! The way I did it was as follows:\n\n// The WCF Service library is in namespace: Root.Library \nUri url = new Uri(\"http://xxx.cloudapp.net:8099/DealerService\"); // tried also without \"DealerService\" but still didn't work\nServiceHost host = new ServiceHost(typeof(Root.Library.DealerService), url));\nhost.AddServiceEndpoint(typeof(Root.Library.IDealerService), new WSHttpBinding(), \"DealerService\");\n\nServiceMetadataBehavior dealerMetaBehavior = new ServiceMetadataBehavior();\ndealerMetaBehavior.HttpGetEnabled = true;\nhost.Description.Behaviors.Add(dealerMetaBehavior);\n\nhost.Open();\n\n\nAnd inside Root.Library, the app.config:\n\n<service name=\"Root.Library.DealerService\">\n <endpoint address=\"\" binding=\"wsHttpBinding\" name=\"dealer\" contract=\"Root.Library.IDealerService\">\n <identity>\n <dns value=\"localhost\" />\n </identity>\n </endpoint>\n <endpoint address=\"mex\" binding=\"mexHttpBinding\" name=\"mex\" contract=\"IMetadataExchange\" />\n <host>\n <baseAddresses>\n <add baseAddress=\"http://xxx.cloudapp.net:8099/\" />\n </baseAddresses>\n </host>\n </service>\n\n\nI also added an Endpoint to the WebRole config (Type:Input, Protocol:http, PublicPort:8099)\n\nCan someone tell me what the problem might be??? this is really confusing me!\n\nThanks a lot!" ]
[ "c#", "wcf", "azure" ]
[ "Git --no-merged with --squash", "I prefer to merge my feature branches with --squash as it lets me track when features were added, and it is usually complete features that I need to bisect on. I find that this gives a very nice representation of the state of the stable branch over time.\n\nHowever, when using --squash branches merged appear under --no-merged instead of under --merged. This makes it sometimes difficult to keep track of the state of each branch (i.e. when it is finished). I do not want to delete the 'finished' branches as it has happened that I have had to check them out to bisect further and also other reasons (sometimes a problem requires multiple paths of attack until it is solved, and I have found it valuable to have that documented).\n\nIt there any way to either:\n\n\nHave --merged and --no-merged recognise that squashed branches have in fact been merged.\n\n\nor\n\n\nArchive merged (squashed) branches in the sense that they will not appear in either listing, but are still available if I need them.\n\n\nI actually do prefer the second solution if possible. There are quite a few non-current branches accumulating and hiding them will make it easier to search the list for the current branch that I am looking for." ]
[ "git", "merge", "branch", "squash" ]
[ "When React functional component re-render, does it reassign assigned values & functions?", "If a code like this re-render by useEffect's dependency,\n\r\n\r\n// ...\nconst Test = () => {\n // ...\n \n const value1 = \"test1\"\n \n const func1 = () => {\n // do something1\n }\n \n useEffect(() => {\n const value2 = \"test2\"\n \n const func2 = () => {\n // do something2\n }\n }, [sth])\n \n return (\n // ...\n )\n}\r\n\r\n\r\n\ndoes value1 & value2 & func1 & func2 reassign to memory?\nI'm curious about it, related to optimizing." ]
[ "reactjs", "use-effect", "rerender" ]
[ "Trying to make button appear onmouseover", "I am trying to make it so that when i mouse over where this button is, it appears.\n\nhere is my code\n\nhtml:\n\n<div class=\"hide\"><button type=\"button\" onmouseover=\"appear()\" id=\"button\">LIGHT!!</button></div>\n\n\ncss:\n\ndiv.appear {display: none;}\n\n\njavascript:\n\nfunction appear(){document.getElementById(\"button\").style.display = \"block\";}" ]
[ "javascript", "visibilitychange" ]
[ "How to change a link address on a PDF page using iText5?", "I want to change the address of the first link on the page 36 of my PDF file. \n\nI can find and read that link but I'm not able to edit it. \n\npublic static void main(final String[] args) {\n final List<byte[]> pdfs = new ArrayList<>();\n final List<String> testfiles = Arrays.asList(\"test.pdf\");\n final String dir = \"C:\\\\hadi\\\\pdf\\\\\";\n for (final String name : testfiles) {\n final File file = new File(dir + name);\n final Path path = Paths.get(file.toURI());\n try (InputStream istream = new FileInputStream(path.toFile())) {\n final byte[] data = ByteStreams.toByteArray(istream);\n pdfs.add(data);\n final PdfReader reader = new PdfReader(data);\n final PdfDictionary pageDictionary = reader.getPageN(36);\n final PdfArray annotations = pageDictionary.getAsArray(PdfName.ANNOTS);\n if (annotations != null && annotations.size() != 0) {\n for (int i = 0; annotations.size() > i; i++) {\n final PdfObject annot = annotations.getDirectObject(i);\n final PdfDictionary annotationDictionary = (PdfDictionary)PdfReader.getPdfObject(annot);\n if (annotationDictionary.get(PdfName.SUBTYPE).equals(PdfName.LINK)) {\n final PdfDictionary annotationAction = annotationDictionary.getAsDict(PdfName.A);\n if (annotationAction.get(PdfName.S).equals(PdfName.URI)) {\n final PdfString destination = annotationAction.getAsString(PdfName.URI);\n final String url = destination.toString();\n System.out.println(url);\n }\n }\n }\n }\n final int n = reader.getNumberOfPages();\n System.out.println(\"Pages : \" + n);\n Files.write(Paths.get(dir + \"new.pdf\"), data);\n } catch (final FileNotFoundException e) {\n e.printStackTrace();\n } catch (final IOException e) {\n e.printStackTrace();\n }\n }\n}\n\n\nPreferably I don't want to completely remove that link and create a new one with all the required info (Rectangle, etc.), just removing the link address and putting a new address instead of the previous one." ]
[ "java", "itext" ]
[ "Algorithm: Find index of 2nd smallest element from an unknown array", "I have been pondering about my homework question for a while. I welcome (and prefer) any suggestions or approach on how to attack this problem.\n\nBasically, I have an array A of size N. We do not know the elements but we know they are distinct. The only thing that I have is a person who will take two indices (i,j) in N. This person will then tell me whether A[j] is < or > A[i]. I want to find the algorithm for finding the index of the 2nd smallest element by asking <= n + log n questions to this person." ]
[ "algorithm", "select" ]
[ "Android: Shared Element Transition with RecyclerView and Viewpager", "I would like to implement a news app with shared element transitions between a RecyclerView and a Viewpager. My app has the following structure:\n\n\nActivity1 displays a RecyclerView. Each element of this list contains an ImageView (the shared element item) and a title of a news.\nActivity2 display the detail page of this news with a big image (the opposite shared element item)\nWhen clicking one of the news items in Activity1 the shared element transition should start and expand the image to the big image, displayed in Activity2.\n\n\nUp to this point, there's no problem. The image expands at the EnterTransition and minimize at ReturnTransition. Now the complicated point. I would like to implement a ViewPager into Activity2, so that the user is able to swipe between the news, that are shown in the ticker.\n\nAfter I have implemented the Viewpager the EnterTransition still works fine, but now the ReturnTransition is broken. This broken transition is caused in the following situation:\n- User presses ticker element 1 (or any other), shared element transition to Activity2 is started.\n- Activity2 is displayed. User swipes through news, till position 20 and presses the back button.\n- Obviously the shared element image at position 20 is currently not visible in the recyclerview, so the ReturnTransition is not working.\n\nI tried to set the current position of the recyclerview in the onActivityReenter of Activity1. If I now return from Activity2 the last visited news element is the first visible item in the recyclerview, but the ReturnTransition with the shared element still isn't working.\n\nAnyone got an idea how to get rid of this problem? Below you find my code:\n\nOnActivityReenter in Activity1\n\n@Override\npublic void onActivityReenter(int requestCode, Intent data) {\n super.onActivityReenter(requestCode, data);\n\n if(requestCode == Constants.NEWSDETAIL_ACTIVITY_RESULT_OK) {\n\n mIsReentering = true;\n mTransitionBundle = new Bundle(data.getExtras());\n\n int oldPosition = mTransitionBundle.getInt(Constants.ACTIVITY_TRANSITION_OLD_ITEM_POS);\n int currentPosition = mTransitionBundle.getInt(Constants.ACTIVITY_TRANSITION_CURRENT_ITEM_POS);\n\n\n if(oldPosition != currentPosition) {\n\n //Scrolls to new position in the recyclerview\n scrollToNews(currentPosition + 1);\n }\n }\n}\n\n\nFinishAfterTransition in Activity2\n\n@Override\npublic void finishAfterTransition() {\n mIsReturning = true;\n\n if(BasicHelper.isLollipop()) {\n getWindow().setReturnTransition(new Slide());\n }\n\n int currentPosition = -1;\n //gets current position of viewpager\n if(currentlyAttached instanceof NewsDetailViewpagerFragment) {\n currentPosition = ((NewsDetailViewpagerFragment) currentlyAttached).getCurrentPosition();\n }\n\n Intent data = new Intent();\n data.putExtra(Constants.ACTIVITY_TRANSITION_OLD_ITEM_POS, getIntent().getExtras().\n getInt(Constants.ACTIVITY_TRANSITION_CURRENT_ITEM_POS));\n data.putExtra(Constants.ACTIVITY_TRANSITION_CURRENT_ITEM_POS, currentPosition);\n setResult(Constants.NEWSDETAIL_ACTIVITY_RESULT_OK, data);\n super.finishAfterTransition();\n}\n\n\nIf you need more code let me know. Thanks for your help." ]
[ "android", "android-viewpager", "android-recyclerview", "shared-element-transition" ]
[ "Delete function Irestreponse with restsharp", "I want to implement a delete function with a Restful API with RestSharp. I have implemended GET and POST function already. But with this delete function I don't get any feedback from the API only a httpresponse. My question is how do I make my code so I can excecute the delete function? I already have this:\n\n// var url = string.Format(\"url\");\n\n// Construct the request.\n// var request = new RestRequest(url, Method.DELETE);\n\n// //IRestResponse<> response;\n// //response = await restClient.ExecuteTaskAsync<>(request);\n// //return response.Data;" ]
[ "asp.net", "api", "restsharp" ]
[ "Spring MVC, and JDBC datasources", "In all the examples you see for configuring the servlet-context.xml in a Spring MVC web-app any datasource required is configured as a bean in this file, probably using a connection pool defined in the container. For example in my servlet-context.xml for my org.springframework.web.servlet.DispatcherServlet I initialize my datasource thusly:\n\n<jee:jndi-lookup id=\"dataSource\"\njndi-name=\"java:comp/env/jdbc/ora1\"\nexpected-type=\"javax.sql.DataSource\"\nresource-ref=\"true\" />\n\n\nIf, in the case where the database is down for some reason, the web-app errors at the initialization stage and throws a yard-and-a-half of Java stack trace into the browser, something like this:\n\njavax.servlet.ServletException: Servlet.init() for servlet appServlet threw exception at \norg.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1214) at \norg.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809) at \norg.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:615) \n\n\n... and so on.\n\nI have 2 questions:\n\n\nIs it possible to trap this error and display something more friendly to the user? I personally doubt it is as the servlet cannot get beyond the init() stage.\nIs is valid NOT to initialize the datasource in the servlet context and do it dynamically from a @Controller as the connection is required? As with more conventional methods e.g:\n\npublic static DataSource getJndiDataSource() throws NamingException {\n Context initialContext = new InitialContext();\n DataSource ds = (DataSource)initialContext.lookup(\"java:comp/env/jdbc/ora1\");\n return ds;\n}\n\n\n\nThanks for any responses!" ]
[ "spring-mvc", "error-handling", "datasource" ]
[ "PHP PDO custom sql query preparation", "I'm having a little problem getting a sql query with prepare on PDO, I have this code:\n\n$portfolio = $db->prepare(\"SELECT * FROM `news`, `:sub` WHERE `news`.`id` = `:sub`.`id_news` AND `page` = `:under` ORDER BY `date` DESC LIMIT :start, :limit\");\n$portfolio->bindParam(':under', $_GET['under'], PDO::PARAM_STR);\n$portfolio->bindParam(':sub', $_GET['sub'], PDO::PARAM_STR);\n$portfolio->bindParam(':start', $start, PDO::PARAM_INT);\n$portfolio->bindParam(':limit', $limit, PDO::PARAM_INT);\n$portfolio->execute();\n\n\nBut this doesn't give any value and my DB has the values correct, any one knows why this doesn't work?\nPS: var $start and $limit are fine, no problem with it cuz it's pagination script, that work very fine in all the pages.\n\nFor exemple i'm in the url: mysite.com/index.php?sub=vid&under=info\n\nso the query should be like this: \n\n\"SELECT * FROM `news`, `vid` WHERE `news`.`id` = `vid`.`id_news` AND `page` = `info` ORDER BY `date` DESC LIMIT 0, 10\"\n\n\nSo for what i understood having this code before should work and still be safe right?\n\nswitch($_GET['sub']){\n case \"vid\":\n $table = \"vid\";\n break;\n case \"img\":\n $table = \"img\";\n break;\n}\n$portfolio = $db->prepare(\"SELECT * FROM `news`, `$table` WHERE `news`.`id` = `$table`.`id_news` AND `page` = :under ORDER BY `date` DESC LIMIT :start, :limit\");" ]
[ "php", "mysql", "pdo" ]
[ "How to get the rectangular coordinates of the annotation using ice pdf viewer", "I need to get the rectangular coordinates of the annotation using ice pdf viewer. Is there anyway to achieve this?" ]
[ "java", "pdf", "icepdf" ]
[ "Object [Object Object] has no method stringify", "I've been working with a fairly simple animation, powered by Adobe Edge Animate, on my site for a while now. I didn't change anything to do with it for the longest time, but something's obviously happened, because now when i run the animation, i get \n\n\n Uncaught TypeError: Object [object Object] has no method 'stringify' edge.2.0.0.min.js\n\n\nfrom Chromes Console Log. I have no idea what this means, but it has something to do with the json. I'm not sure if my image is being loaded, but there's no reason it shouldn't be, since i never changed the path of it. Can somebody tell me what \"Object [object Object]\" is supposed to refer to?\n\nThanks!\n\nP.S My animation setup is just the stage, with about 17 copies of an .svg that i use as a sprite sheet, plus some text. Every single object has animations that includes opacity, top, left, and height.\n\nEDIT:\nHere's what i get when i do a console.log(JSON);\n\n\nIn case you can't read it:\n\nNative.initialize\n$replaceChars: function (a){return JSON.$specialChars[a]||\"\\\\u00\"+Math.floor(a.charCodeAt()/16).toString(16)+(a.charCodeAt()%16).toString(16);\n$specialChars: Object\ndecode: function (string,secure){if($type(string)!=\"string\"||!string.length){return null;}if(secure&&!(/^[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]*$/).test(string.replace(/\\\\./g,\"@\").replace(/\"[^\"\\\\\\n\\r]*\"/g,\"\"))){return null;\nencode: function (b){switch($type(b)){case\"string\":return'\"'+b.replace(/[\\x00-\\x1f\\\\\"]/g,JSON.$replaceChars)+'\"';case\"array\":return\"[\"+String(b.map(JSON.encode).clean())+\"]\";\n__proto__: Object\n\n\nUpdate:\nI think i may have figured it out. In the preloader, i'm calling the dependent files with the full path, so i don't think they get called. But when i fix the path, i get that really annoying \n\nUncaught SyntaxError: Unexpected token < \n\n\nThese files get interpreted as text/html, so now those dependent .js files are full of my html. \n(I'm using Sinatra, with a layout file).\nHere's Chromes message:\n\nResource interpreted as Script but transferred with MIME type text/html: \"http://127.0.0.1/bird_Animations_edgeActions.js\". \n\n\nThis is how the preloader calls those files:\n\n{load:\"/bird_Animations_edge.js\"},{load:\"/bird_Animations_edgeActions.js\"}. \n\n\nNow my question is: How do i get these files to be transferred as scripts?\n\nEdit:\nBecause i confused myself with that, the way Edge Animate works is that it gives you three .js files. One is focused on general stuff, making the object, creating the animations. The second is focused on actions, I.E clicking on an element. The third loads the previous two files, and every other files necessary for the whole page to work, plus some other stuff that i don't know. The third file is then called in the head tag of the page you want the animation to run, with a div in the body of that same page." ]
[ "html", "json", "adobe-edge" ]
[ "How does one initialize/use ember-data by itself (without ember-cli)?", "I'm in a shop where we can't use ember-cli (this saddens me, but it is what it is), and we'd like to use ember-data along side our app. The documentation gets us started, but I can't seem to initialize the store correctly (I think).\n\nHere's what we have:\n\n<script src=\"../ember/ember.debug.js\"></script>\n<script src=\"../ember-data/ember-data.js\"></script>\n<script>\n (function(){\n 'use strict';\n\n window.File = window.File || DS.Model.extend({\n id: DS.attr()\n });\n\n window.store = window.store || DS.Store.extend({\n 'file': window.File});\n })();\n\n window.store.findRecrod('file', 1); // findRecord Doesn't exist\n })();\n</script>\n\n\nThe classes get defined correctly, but the method findRecord doesn't exist. What am I doing wrong?\n\nAm I initializing the store incorrectly, or do I need to register the Model a different way, or is it something else?\n\nWe'd like to use the default JSONAPI adapter, FWIW." ]
[ "javascript", "ember.js", "ember-data", "ember-cli" ]
[ "changing the frame type without loosing data", "I'm using Opencv and I have two frame : cv::frame1 and cv::frame2, when I check their type I get :\n\n frame1.type() is 16 \nframe2.type() is 21\n\n\nmy Question is how can I change the type of frame2 to 16 without losing its data ?? I tried frame2.convertTo() it didn't work .\n\nany Idea ?" ]
[ "c++", "opencv" ]
[ "if class B implements interface C, and class A extends B, does class A need to implement C too?", "I was reviewing some code and stumbled upon this:\n\nexport class A extends B implements C {\n ...\n}\n\n\nAnd then this other class\n\nexport abstract class B implements C {\n ...\n}\n\n\nThen I thought, if class A extends B, and B already implements interface C (as shown below), is it necessary for A to implement C too?\n\nI hope I made myself clear and is not too complicated. \n\nThanks!" ]
[ "typescript", "inheritance", "extends", "implements" ]
[ "ReactJs: How to preload assets and components so that they can be shown when disconnected from internet", "The application checks when a certain websocket goes offline. \nWhenever this happens, a few popups will be shown in order and each with their own functionality. \nThis is the only time these popups will be shown.\n\n\nOn some browsers, not all images will be shown on the popups\nOn other browsers, the 2nd popup will not be shown\n\n\nI cannot prerender anything on the server side. Everything is hosted in an iframe by another party and I have no control over the parent framework or any of the servers.\n\nI have no idea how to start tackling this issue. \n\n\nShould I just render it anyway and hide it in css? (will the browser load / show it or is it optimized to now even download the images)\nShould I create the component but update the z-index?\n... a better solution?" ]
[ "javascript", "reactjs" ]
[ "How to conditionally prevent user from navigating to other tab in mat-tab-group", "I have an angular component which uses an angular material tab group.\n\n<mat-tab-group>\n <mat-tab label=\"First\"> <app-comp1></app-comp1> </mat-tab>\n <mat-tab label=\"Second\"> <app-comp2></app-comp2> </mat-tab>\n <mat-tab label=\"Third\"> <app-comp3></app-comp3> </mat-tab>\n</mat-tab-group>\n\n\nIn a certain tab, user can do some changes and save. If user did some changes and tries to navigate to another tab without saving, I want to ask the user for confirmation to discard changes before navigating to the other tab.\n\nIs there any way to do this?" ]
[ "angular", "angular-material", "mat-tab" ]
[ "Tnesorflow: gradient error for STFT", "The following code gives me error\n\n\nValueError: Dimensions must be equal, but are 400 and 800 for 'gradients/stft/rfft_grad/add_1' (op: 'Add') with input shapes: [1,39,400], [1,39,800].\n\n\n\nimport tensorflow as tf\ndef test_gradient_computation(frame_length, fft_length):\n graph = tf.Graph()\n with graph.as_default():\n x = tf.get_variable('input', [1, 16000], tf.float32)\n x = tf.contrib.signal.stft(\n x,\n frame_length=frame_length,\n frame_step=frame_length // 2,\n fft_length=fft_length\n )\n\n x = tf.abs(x)\n y = tf.ones_like(x)\n\n loss = tf.losses.mean_squared_error(x, y)\n\n optimizer = tf.train.GradientDescentOptimizer(1e-3)\n train_op = optimizer.minimize(loss)\n with tf.Session() as session:\n session.run(tf.global_variables_initializer())\n session.run(train_op)\nn = 400\ntest_gradient_computation(frame_length=n*2, fft_length=n)\n\n\nany idea? Thanks" ]
[ "tensorflow" ]
[ "Extend a python list elements on the list's declaration instead of append", "I have a python list\n\nlist2 = ['three', 'four', 'five']\n\n\nand I want to merge it with a new one declared\n\nlist1 = ['one', 'two', list2, 'six']\n\n\nand take the result of \n\n['one', 'two', 'three', 'four', 'five', 'six']\n\n\ninstead of \n\n['one', 'two', ['three', 'four', 'five'], 'six']\n\n\ncould this be possible within the declaration line?" ]
[ "python-3.x", "list" ]
[ "Why Flex SDK is free and Flash CS4 not ? Where is the trick?", "Why Flex SDK is free and Flash CS4 not ? Where is the trick ?" ]
[ "apache-flex", "flash", "flex3", "adobe", "flash-cs4" ]
[ "Unable to Encapsulate and also ImplementInterface", "I am using C# in Silverlight ( I created a new class folder. However, I do not have the option for incapsulate (i had to type out myself, snippets is another problem) also the resolve and implement option (I am using Visual Studio 2010) Please what am i doing wrong?? Here is a example i am trying to resolve and implement the INotifyPropertyChanged\n\npublic class Person : INotifyPropertyChanged \n{\n\n private string _FirstName;\n public string FirstName\n {\n get { return _firstName; }\n set { _firstName = value; }\n }\n\n private string _greeting;\n public string Greeting\n {\n get { return _greeting; }\n set { _greeting = value; }\n }" ]
[ "c#", "silverlight", "encapsulation" ]
[ "swift build fails to write build files", "Running swift build on any package fails with the following output:\n\n[1/1] Compiling Swift Module 'SynchronousNetworking' (3 sources)\n<unknown>:0: error: failed writing record '_pthread_rwlockattr_t.h-15446MBE1AZWP': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/WP/_pthread_rwlockattr_t.h-15446MBE1AZWP-temp-f543b829\n<unknown>:0: error: failed writing record 'uuid.h-3RIUEBNVXME9Q': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/9Q/uuid.h-3RIUEBNVXME9Q-temp-27e1a4c7\n<unknown>:0: error: failed writing record '_u_int16_t.h-34I7NDL9MUDL': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/DL/_u_int16_t.h-34I7NDL9MUDL-temp-be9fdd22\n<unknown>:0: error: failed writing record 'fmaintrin.h-4B9WQ55UKX7V': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/7V/fmaintrin.h-4B9WQ55UKX7V-temp-f26ea012\n<unknown>:0: error: failed writing record 'CTTextTab.h-X47FKBQ1RXGU': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/GU/CTTextTab.h-X47FKBQ1RXGU-temp-d4fc8399\n<unknown>:0: error: failed writing record 'FoundationOverlayShims.h-2XZL6DVCNMY82': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/82/FoundationOverlayShims.h-2XZL6DVCNMY82-temp-6d359744\n<unknown>:0: error: failed writing record '_uintptr_t.h-1DR8717NVFXXK': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/XK/_uintptr_t.h-1DR8717NVFXXK-temp-8085ec94\n<unknown>:0: error: failed writing record '_ctype.h-B4CEWHC0EQSN': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/SN/_ctype.h-B4CEWHC0EQSN-temp-f0a309d3\n<unknown>:0: error: failed writing record 'poll.h-1QKTQ62SG1WMU': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/MU/poll.h-1QKTQ62SG1WMU-temp-d98445b7\n<unknown>:0: error: writing index record file: failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/RT/CoreGraphics.swiftmodule-KUR2MKSFKTRT-temp-3196c465\n<unknown>:0: error: failed writing record 'IOReturn.h-1M1CBYHRWHC0P': failed to create temporary file: /private/var/tmp/ankafs.0/.build/x86_64-apple-macosx/debug/index/store/v5/records/0P/IOReturn.h-1M1CBYHRWHC0P-temp-f788a88d\n\n\nThe output of ls inside the project directory is:\n\ndrwxrwxrwx 11 anka staff 352 Apr 25 02:21 .\ndrwxrwxrwx 4 root wheel 128 Apr 25 01:00 ..\ndrwxrwxrwx 3 anka staff 96 Apr 23 04:58 .circleci\ndrwxrwxrwx 12 anka staff 384 Apr 23 04:58 .git\n-rwxrwxrwx 1 anka staff 41 Apr 23 04:58 .gitignore\n-rwxrwxrwx 1 anka staff 1075 Apr 23 04:58 LICENSE\n-rwxrwxrwx 1 anka staff 505 Apr 23 04:58 Package.swift\n-rwxrwxrwx 1 anka staff 720 Apr 23 04:58 README.md\ndrwxrwxrwx 3 anka staff 96 Apr 23 04:58 Sources\ndrwxrwxrwx 4 anka staff 128 Apr 23 04:58 Tests\n-rwxrwxrwx 1 anka staff 475 Apr 23 04:58 build.sh\n\n\nWhich shows that it has rwx for all user groups.\n\nIt's also worth noting that only the first swift build results in this error. Subsequent builds complete successfully, until the .build directory is deleted, then it happens again, each time failing for a different set of files.\n\nThe build command is running inside an anka VM, but my guess is that it's just a permissions issues with nothing to do with the fact that it's being run inside a VM." ]
[ "swift" ]
[ "Laravel how to update in Table using LaravelBatch(github)", "Problem is when i press button Update then wanna use Bulk update.\n\n\nI tried this\n\nforeach ($request->input('number') as $key => $value) {\n Choice::updateOrCreate([\n 'user_id' => Auth::id(),\n 'time' => $time,\n 'topic_id' => $key,\n 'question_number' => $value,\n ]);\n }\n\n\nThis is example of LaravelBatch\n\n$table = 'users';\n$value = [\n[\n 'id' => 1,\n 'status' => 'active',\n 'nickname' => 'Mohammad'\n] ,\n[\n 'id' => 5,\n 'status' => 'deactive',\n 'nickname' => 'Ghanbari'\n] ,\n];\n$index = 'id';\nBatch::update($table, $value, $index);\n\n\nMy View\n\n<form method=\"POST\" action=\"{{ route('choices.store') }}\">\n{{ csrf_field() }}\n.................\n<tbody>\n @foreach ($duplicates as $duplicate)\n <tr>\n <td style=\"text-align: center;\">{{ $duplicate->topic->id }}</td>\n <td style=\"text-align: center;\">{{ $duplicate->topic->title }}</td>\n <td style=\"text-align: center;\">{{ $duplicate->total }}</td>\n <td style=\"text-align: center;\">\n <input class=\"form-control\" value=\"0\" type=\"number\" onblur=\"tiin();\" \n min=\"0\" max=\"{{ $duplicate->total }}\" step=\"1\" \n name=\"number[{{ $duplicate->topic->id }}]\"></input>\n </td>\n <td><a href=\"#\" class=\"btn btn-default\">Шинэчлэх</a></td>\n </tr>\n @endforeach\n </tbody>\n</table>\n <br /><button class=\"button btn btn-danger\" type=\"submit\">Update</button>\n</form>\n\n\n\n\nTried this too\n\nforeach ($request->input('number') as $key => $value) {\n $table = 'choices';\n $value = ['topic_id' => $key, 'question_number' => $value, 'time' => $time ];\n $index = 'id';\n }\nBatch::update($table, $value, $index);\n\n\n\n Class 'App\\Http\\Controllers\\Batch' not found\n\n\nbut i already added important things in config/app.php" ]
[ "laravel", "github", "eloquent" ]
[ "Not loading css file in executable jar javafx8", "I am getting an error while I try to run executable jar file.\n\nlis 09, 2014 8:20:34 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged WARNING: Resource \"/styles.css\" not found.\n\n\nWhen I'm running application from IDE, everything is OK. I try a several solution, but neither worked.\n\n1.\n\nscene.getStylesheets().add(getClass().getResource(\"/styles.css\").toExternalForm());\n\n\n2.\n\nscene.getStylesheets().add(\"styles.css\");\n\n\n3.\n\nscene.getStylesheets().addAll(new File(\"/styles.css\").toURI().toString());\n\n\n4\n\n InputStream inputStream = MainApp.class.getResourceAsStream(\"/styles.css\");\n File tempStyleSheetDest = File.createTempFile(\"javafx_stylesheet\", \"\");\n tempStyleSheetDest.deleteOnExit();\n Files.copy(inputStream, tempStyleSheetDest.toPath(), StandardCopyOption.REPLACE_EXISTING);\n scene.getStylesheets().add(tempStyleSheetDest.toURI().toString());\n\n\nAnd another similar. I struggle this a few hours and I have no more ideas. \nI'm using maven, java1.8_u20." ]
[ "java", "javafx" ]
[ "For loop to plyr function", "I have a character array that holds the column names and values for a row in a data frame. Unfortunately, if the value of a specific entry is zero, the column name and value are not listed in the array. I create my desired data frame with this information, but I rely on a \"for loop\".\n\nI want to utilize plyr to avoid the for loop in the working code below. \n\ntypes <- c(\"one\", \"two\", \"three\") # My data\nentry <- c(\"one(1)\", \"three(2)\") # My data\n\n\nvalues <- function(entry, types)\n{\n frame<- setNames(as.data.frame(matrix(0, ncol = length(types), nrow = 1)), types)\n\n for(s1 in 1:length(entry))\n {\n name <- gsub(\"\\\\(\\\\w*\\\\)\", \"\", entry[s1]) # get name\n quantity <- as.numeric(unlist(strsplit(entry[s1], \"[()]\"))[2]) # get value\n\n frame[1, which(colnames(frame)==name)] <- quantity # store\n\n }\n return(frame)\n }\n\n values(entry, types) # This is how I want the output to look\n\n\nI have tried the following to split the array, but I can't figure out how to get adply to return a single row.\n\ntypes <- c(\"one\", \"two\", \"three\") # data\nentry <- c(\"one(1)\", \"three(2)\") # data\n\nframe<- setNames(as.data.frame(matrix(0, ncol = length(types), nrow = 1)), types) \n\narray_split <- function(entry, frame){\n\n name <- gsub(\"\\\\(\\\\w*\\\\)\", \"\", entry) # get name\n quantity <- as.numeric(unlist(strsplit(entry, \"[()]\"))[2]) # get value\n frame[1, which(colnames(frame)==name)] <- quantity # store\n return(frame)\n}\n\nadply(entry, 1, array_split, frame)\n\n\nIs there something like cumsum I should be considering? I want to complete the operation quickly." ]
[ "r", "for-loop", "plyr" ]
[ "Square Connect API Chargebacks/Disputes", "If a merchant experiences a dispute / chargeback, where does that appear in the Square Connect API? As a refund? As a negative payment? Is there another endpoint specifically for this event?" ]
[ "square-connect" ]
[ "Switch between Accounts when hosted on EC2 Instance", "We currently have 2 AWS accounts that we use. For most of the stuff we want to use the AWS account that our web app is hosted on in an EC2 instance so this works fine:\nservices.AddDefaultAWSOptions(this.Configuration.GetAWSOptions());\nservices.AddAWSService<IAmazonSQS>();\nservices.AddAWSService<IAmazonSimpleSystemsManagement>();\n\nHowever, I want to access EC2 instances in another AWS account. I've configured it to work locally using credentials and from following this guide (where it mentions about using multiple services): https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/net-dg-config-netcore.html\nservices.AddDefaultAWSOptions(this.Configuration.GetAWSOptions());\nservices.AddAWSService<IAmazonSQS>();\nservices.AddAWSService<IAmazonSimpleSystemsManagement>();\n\nif (this.WebHostEnvironment.IsDevelopment())\n{\n // This works fine locally, but I don't want to use credential file in production\n var other = this.Configuration.GetAWSOptions("other");\n services.AddAWSService<IAmazonEC2>(other);\n}\nelse\n{\n // How do I register other here without putting a credential file on my ec2 instance?\n services.AddAWSService<IAmazonEC2>();\n}\n\nI'm not sure how to register IAmazonEC2 to use my other account. I don't want to put a credential file on my instance which is how I get it working locally but it doesn't seem right to me on production servers.\nI have configured an IAM role that has access to my other account and given it to my EC2 instance. But how do I translate that IAM role to a profile to use where I am registering IAmazonEC2 above?\nAny help appreciated. Thanks" ]
[ "amazon-web-services", "amazon-ec2", "aws-sdk", "aws-sdk-net" ]
[ "Auto login the customer after registration in magento", "Is there any method or concept that when the customer register in fronted then login auto and redirect to the home page. \n\ni wants to do the things by external (out of magento)." ]
[ "php", "mysql", "magento" ]