texts
sequence | tags
sequence |
---|---|
[
"How to design for reduced register usage in Numba Cuda Kernels?",
"UPDATE: The original question below remains a good quesiton asking about general design principles for GPU programming in Numba and it is not quite the same as predicting register usage. I have also since discovered there's no need to predict register usage since there is an undocumented command in Numba that tells you the register usage exactly. THis can allow one by trial an error to reduce register use, but converting that to general intuition and strategies for register use what this question is asking. The links added before this question claiming answers contian incorrect information that don't answer this question. Those links and the comments on this quesiton simply claim, completely incorrectly, that register use can't be determined from numba. This is absolutely incorrect, there is a not-yet-documented private method numba supplies to do exactly that. This question isn't asking that. It's asking how one strategically designs up front to minimize register use.\n\nIf a kernel uses more than 64 registers then on many cuda devices one can't use the maximum number of available threads. I find that my code also seems to use way more registers than I would guess from scanning it visually for the number of intermediate results. Even loops add lots to the register count.\n\nSo how can one see what lines of code are the culprits in using registers? \n\nI'd settle for some rules of thumb or even better if there was a way to look at the numba IR available in the kernel.inspect_types() output. \n\nIS there some equivalence between the $ sigil variables in the Numba IR code and registers?\n\nI realize I can get get the total register count for a kernel by looking at the ._func.info and _.fun.get().attr and that's helpful. But it doesn't tell you what aspect in your code is causing the number of registers to balloon. \n\nSo I want a way to either be able to guess better or actually see it in the Numba IR.\n\nAny insights?\n\nFOr concreteness, here is a trivial example of this someone posted:\nhttps://gist.github.com/sklam/0e750e0dea7571c68e94d99006ae8533\n\nWhen I say rules of thumb I am thinking that maybe they might look like this\n\n\nAdd one for every fetch from global memory not going into shared\nmemory\nadd one for every binary operator like + or *\nAdd one for every input variable name (e.g. a pointer to global)\nadd one for every local variable.\n\n\nBut In practice I see more register's used than that would account for. And I also see the register count go up quite a lot when I include a loop or an if-statement. Thus I know I'm not doing it right. \n\nBottom line How can I skillfully reduce register counts? \nI realize that optimizing compilers might be doing tricks to re-order code or choose when to make a variable a register or main memory, but still I think there ought to be rule one can follow to try to reduce register usage"
] | [
"python",
"cuda",
"numba",
"register-allocation"
] |
[
"How to block other url for forcing user to reset password spring security 4",
"I'm using spring security 4 for login and reset password functionality.I'm able to do login successfully but after that i have to redirect user to password reset page if his password get expired.For that i'm calling one handler after successfully authenticated but the issue with it that is all urls are now open and user can go to other urls without changing password.\n\nhere my all config files\n\nsecurity config file \n\n <beans:beans xmlns=\"http://www.springframework.org/schema/security\"\n xmlns:beans=\"http://www.springframework.org/schema/beans\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xmlns:property=\"http://www.springframework.org/schema/lang\"\n xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n http://www.springframework.org/schema/beans/spring-beans-4.0.xsd\n http://www.springframework.org/schema/security\n http://www.springframework.org/schema/security/spring-security-4.0.xsd\">\n\n <!-- Spring MVC based authentication, login page etc. -->\n <http pattern=\"/rs/login\" security=\"none\"/>\n <http>\n <intercept-url pattern=\"/**\" access=\"hasRole('ROLE_ADMIN')\"/>\n <form-login login-page=\"/rs/login\" login-processing-url=\"/j_spring_security_check\"\n authentication-failure-url=\"/login\"\n authentication-success-handler-ref=\"ResetHandler\"/>\n <logout logout-success-url=\"/login\"/>\n <csrf disabled=\"true\"/>\n </http>\n\n <!-- Declared authentication manager -->\n <authentication-manager alias=\"authenticationManager\">\n <authentication-provider ref=\"AuthenticationManager\" />\n </authentication-manager>\n\n <!-- Bean implementing AuthenticationProvider of Spring Security -->\n <beans:bean id=\"AuthenticationManager\" class=\"authentication.rest.AuthenticationManager\">\n </beans:bean>\n\n </beans:beans>\n\n\nHere my success handler \n\n @Component\n public class ResetHandler implements AuthenticationSuccessHandler\n {\n private AuthenticationSuccessHandler target = new SavedRequestAwareAuthenticationSuccessHandler();\n\n public void onAuthenticationSuccess(HttpServletRequest request,\n HttpServletResponse response, Authentication auth) {\n\n\n if (checkCredentialExpired(auth.getPrincipal())) {\n try\n {\n response.sendRedirect(\"/RESTfulExample/rs/resetPassword\");\n } catch (IOException e)\n {\n e.printStackTrace();\n }\n } else if (\n else{\n try\n {\n target.onAuthenticationSuccess(request, response, auth);\n } catch (IOException e)\n {\n e.printStackTrace();\n } catch (ServletException e)\n {\n e.printStackTrace();\n }\n }\n }\n\n public void proceed(HttpServletRequest request,\n HttpServletResponse response, Authentication auth) {\n try\n {\n target.onAuthenticationSuccess(request, response, auth);\n } catch (IOException e)\n {\n e.printStackTrace();\n } catch (ServletException e)\n {\n e.printStackTrace();\n }\n }\n }\n\n\nAt this page i'm redirecting to reset page successfully but if some one use other urls those are now open as we have call this handler after success,\n\nI also tried to call it in failure handler like credentials are expired check if true then return failure but then i'm not able to check either they fail due to credentials failure or due to password expired check.\n\nplease help me with this"
] | [
"java",
"spring-mvc",
"spring-security"
] |
[
"Junit console output to log",
"I want to know,\n\nHow can I get Junit console output to log file?\n\nAs example, I have put Assert.equals() methods. I want to know passed method and what are the failed methods also. I tried to find method to do that, but I was unable."
] | [
"java",
"unit-testing",
"testing",
"junit",
"junit4"
] |
[
"Javascript function not defined at onkeyup in my code",
"I have wrote a javascript function to search and filter elements But it says in console log that function not defined at onkeyup\n\nTHe Function should get text in search box check if this text is a substring of any of a string in div's inside container if its a substring then keep element as it is otherwise hide it\nInstead its not working and says function not definet at onkeyup\n\n\r\n\r\n function myfunction(){\r\n var container, divwithtext , textinbox, textinboxincapital, boxsearch;\r\n container=document.getElementById(\"container\");\r\n divwithtext=container.getElementsByTagName(\"div\");\r\n boxsearch=container.getElementById(\"searchbox\");\r\n textinbox=boxsearch.value.toUpperCase();\r\n console.log(textinbox);\r\n for(i=0 ; i<length.divwithtext; i++)\r\n {\r\n textindiv=divwithtext[i].textContent || divwithtext.innerText;\r\n if(textindiv.toUpperCase().indexOf(textinbox) > -1){\r\n divwithtext[i].style.display=\"\";\r\n }\r\n else{\r\n divwithtext[i].style.display=\"none\";\r\n }\r\n }\r\n }\r\n<style>\r\n .container{\r\n background-color:pink;\r\n width:60%;\r\n position:absolute;\r\n left:20%;\r\n\r\n }\r\n\r\n .imagebox{\r\n width:13vw;\r\n height:35vh;\r\n background-color:green;\r\n display:inline-block;\r\n margin-left:7%;\r\n margin-bottom:5%;\r\n color:white;\r\n }\r\n .searchbox{\r\n width:80%;\r\n height:50px;\r\n margin-bottom:1%;\r\n margin-top:1%;\r\n margin-left:7%;\r\n\r\n }\r\n\r\n </style>\r\n <div class=\"container\" id=\"container\">\r\n <input type=\"text\" class=\"searchbox\" placeholder=\"Search Here\" onkeyup=\"myfuction()\" id=\"searchbox\" /><br>\r\n <div class=\"imagebox\" name=\"box\" style=\"background:url('adult-beach-casual-736716.jpg'); background-size:100% 100%; color:black;\">PEXELS<br>Tim Savage</div>\r\n <div class=\"imagebox\" name=\"box\" style=\"background:url('attractive-beautiful-beauty-415829.jpg'); background-size:100% 100%;\">PEXELS<br>PIXABAY Girl</div>\r\n <div class=\"imagebox\" name=\"box\" style=\"background:url('beautiful-beauty-blurred-background-1239291.jpg'); background-size:100% 100%;color:black; text-align:right;\">PEXELS <br>Daniel Xavier</div>\r\n <div class=\"imagebox\" name=\"box\" style=\"background:url('adult-boy-casual-220453.jpg'); background-size:100% 100%;color:black;\">PEXELS <br>PIXABAY Boy</div>\r\n <div class=\"imagebox\" name=\"box\" style=\"background:url('beautiful-brunette-cute-774909.jpg'); background-size:100% 100%; color:black;\">PEXELS<br>Bruce Mars</div>\r\n <div class=\"imagebox\" name=\"box\" style=\"background:url('facial-hair-fine-looking-guy-614810.jpg'); background-size:100% 100%;\">PEXELS<br>Simon Robben</div>\r\n </div>"
] | [
"javascript",
"html",
"css",
"input"
] |
[
"Linux network driver port to ARM",
"I have a Linux network driver that was originally written for 2.4 kernel. It works perfect.\n\nI want to port it to kernel 2.6.31 and then to ARM Linux with same kernel i.e. 2.6.31. I have actually done some minor changes to the driver so that it is able to compile under kernel 2.6.31 and it also loads and unloads without crashing. It also cross compiles for the ARM Linux. But I am unable to test it on ARM so far.\n\nHow do I check that the driver is fully compatible with the target kernel, and what considerations shall be made to make it compatible with ARM.\n\nThe driver is a virtual network device driver.\n\nThanks in advance."
] | [
"linux",
"cross-platform",
"arm",
"porting",
"embedded-linux"
] |
[
"Uber like seek bar android",
"I want to create the same thing as Uber did with seek bar\n\n\n\nIs there any library that can help me achieve this?"
] | [
"android",
"layout",
"styles",
"seekbar"
] |
[
"Refactor Python script into an isolatable method",
"Is it possible to refactor this script such that it exists as a completely independent method? \n\nimport json\nimport requests\nfrom collections import defaultdict\nfrom pprint import pprint\n\ndef hasNumbers(inputString):\n return any(char.isdigit() for char in inputString)\n\n# open up the output of 'data-processing.py'\nwith open('job-numbers-by-location.txt') as data_file:\n\n # print the output to a file\n with open('phase_ii_output.txt', 'w') as output_file_:\n for line in data_file:\n identifier, name, coords, number_of_jobs = line.split(\"|\")\n coords = coords[1:-1]\n lat, lng = coords.split(\",\")\n # print(\"lat: \" + lat, \"lng: \" + lng)\n response = requests.get(\"http://api.geonames.org/countrySubdivisionJSON?lat=\"+lat+\"&lng=\"+lng+\"&username=s.matthew.english\").json()\n\n\n codes = response.get('codes', [])\n for code in codes:\n if code.get('type') == 'ISO3166-2':\n country_code = '{}-{}'.format(response.get('countryCode', 'UNKNOWN'), code.get('code', 'UNKNOWN'))\n if not hasNumbers( country_code ):\n # print(\"code: \" + country_code + \", jobs: \" + number_of_jobs)\n output_file_.write(\"code: \" + country_code + \", jobs: \" + number_of_jobs)\n output_file_.close()\n\n\nI've been trying to make it so that I can include it as a component of a much larger process."
] | [
"python",
"refactoring"
] |
[
"Call a Windows Forms .NET EXE from PHP",
"I've seen many posts on stackoverflow but none of them helped.\n\nI was (am) trying to run a .NET Windows Forms application (it doesn't contain any forms/GUI/dialogs/so but because of the nature of app it has to be Windows Forms). I tried shell_exec(), exec(), passthru(), etc. but all of them failed (they take infinitely long time and PHP Script never terminates)\n\nThen, I tried running a simple C++ (unmanaged) console application - it WORKED and returned correct output and return code.\n\nThen, I thought, maybe I could call this C++ EXE and let it further call a Windows application (i.e. in C++ using SYSTEM(\"path_to_exe.exe\");)\nIt worked fine when I compiled it, but again,\n\nwhen PHP calls this console (with new code to run a .NET EXE), PHP again takes infinte time and never stops. Why?\n\nIs there any one way I can successfully run my .NET EXE on Server from PHP?\n\nThanks a lot!"
] | [
"php",
".net",
"exe"
] |
[
"How to get new slide to slide over previous slide in Bxslider?",
"I'm using Bxslider for my div slider. But I need my next slide to slide over my old slide - effectively once a slide has animated in it remains there stacked on top of the others that went before it.\n\nWhen prev slide button is pressed then it needs to animate out - similar to this effect: http://storiesbylove.com (don't try it out on a tablet though).\n\nDoes anyone know how to do this with boxslider?"
] | [
"javascript",
"jquery",
"slider",
"bxslider"
] |
[
"Google App Engine memcache.Client.cas() keeps returning False for missing key",
"The following is part of a Python Flask application running on Google App Engine:\n\[email protected]('/blabla', methods=['GET'])\ndef blabla():\n # memcache.add('key', None) # this \"fixes\" it! \n memcache_client = memcache.Client()\n while True:\n value = memcache_client.gets('key')\n if value is None: # First time\n updated_value = 'Bla'\n else:\n updated_value = value + ', bla'\n if memcache_client.cas('key', updated_value):\n return updated_value\n\n\nStarting with an empty cache, if we make consecutive GET requests to /blabla, I would expect the requests to return:\n\nBla\nBla, bla\nBla, bla, bla\n.\n.\n\n\n(If for some reason at some point between .gets() and cas() the cache gets flushed, then I would expect the sequence to restart, no problem.)\n\nBut we don’t get anything because memcache_client.cas() keeps returning False forever, so the program gets stuck in the while-loop. Apparently this happens because the key 'key' does not exist in the beginning.\n\nI know this because if I uncomment the memcache.add('key', None), it sort-of works, because then the key exists and .cas() is happy and returns True. But if right between the .add() and the .gets() some other process were to flush the cache, we’d be back to where we started from, with a missing key, and .cas() would go back to returning False indefinitely. So it is not a good solution.\n\nWhy doesn’t .cas() work if the key is missing in the beginning? Or at least, why doesn’t .cas() accept an initial_value= parameter, like its sibling decr()? Is it a bug or a feature? I can’t find this documented properly anywhere, except that Guido van Rossum alludes to it in his single blog post on the matter—reffering to an assert he makes that the .gets() does not return None, he says:\n\n\n Aside 2: The assert is kind of naive; in practice you'll have to somehow deal with counter initialization.\n\n\nDank je wel Guido—does anyone know how, please?"
] | [
"python",
"google-app-engine",
"caching",
"google-app-engine-python"
] |
[
"How avoid negative numbers during datediff",
"Have table where have time like : 15:30 , want select data from table in 15 minute interval but only possitive, I try :\n\nselect id from myTbl\nwhere type = 2 and DATEDIFF(mi,my_time,LEFT(CAST(GETDATE() as time),5)) <= 15\n\n\nFor example if my_time = 15:55 and LEFT(CAST(GETDATE() as time),5)) = 16:45 in response i have -50 and its <= 15 but i need comparison only possitive , when i try ABS it dont help me because when time in response is -14 ABS take it +14 and its <=15 . So i have 28 minute interval (-14 and 14). Is it possible tu avoid all negative numbers ? and comparison only if it is possitive"
] | [
"sql-server",
"sql-server-2008",
"tsql"
] |
[
"Maven Sonarqube Plugin: Multithreading",
"Since maven supports multithread builds, would it be possible to also run sonar multithreaded? (e.g. mvn sonar:sonar -T 4 )\n\nI ran it and while the module reported success, it reports back as the overall build failing with java.util.concurrent.ExcutionException: java.lang.NullPointerException\n\nThoughts?"
] | [
"multithreading",
"maven",
"parallel-processing",
"sonarqube"
] |
[
"Integrating phpmyadmin with Openstack Trove database as a service solution",
"I am looking for installing a private cloud using openstack. For dbaas part I chose trove. Because of the lack of any GUI (I am unable to ask clients to using trove via command line) I want to install phpmyadmin on another host and ask clients to connect to phpmyadmin for operations on their DBs. Unfortunately I could not manage to integrate trove and phpmyadmin. I am able to login to phpmyadmin panel via root mysql username but for other users, which are created in horizon, it is not possible. Would you please guide me through integrating phpmyadmin or another gui for using operations on trove?\n\nBest regards."
] | [
"mysql",
"phpmyadmin",
"cloud",
"openstack"
] |
[
"Sending HTTP request using Guzzle",
"I am trying to send a post request using Guzzle 6 http client. I am sending two requests one with content type as application/x-www-form-urlencoded (form_params in Guzzle) and the other as application/json (json in Guzzle).\n\nI initialise the client as below (forms_params and json respectively):\n\n$data1 = array(\"c1\" => \"a\", \"c2\" => null)\n$client = new Client();\n$response = $client->post(\n \"http://localhost/callback\",\n array(\n \"form_params\" => $data1, // send as x-www-form-urlencoded\n )\n);\n\n\n$data2 = array(\"c1\" => \"a\", \"c2\" => null)\n$client = new Client();\n$response = $client->post(\n \"http://localhost/callback\",\n array(\n \"json\" => $data2, // send as json\n )\n);\n\n\nThe response that I receive does have not identical data/body:\n\nOutput for form_params : Data -> {\"c1\":\"a\"}\n\nOutput for json : Data -> {\"c1\":\"a\",\"c2\":null}\n\nI am not understanding why it does not send identical data for above requests. Could this be a bug in Guzzle? Is there any way to solve this (apart from removing nulls before sending request)?\n\nUPDATE : As requested endpoint code (both requests are read using same code)\n\nif ($$_SERVER[\"CONTENT_TYPE\"] == \"application/json\") {\n $jsonstr = file_get_contents(\"php://input\");\n $formData = json_decode($jsonstr, true);\n} else {\n $formData = $_POST;\n}\necho \"Data -> \" . json_encode($formData);\n\n\nUPDATE 2 : I went through the links provided in comments about this being expected behaviour in Guzzle.\n\nBut why I asked this question in first place is because I faced an issue of signature mismatch. \n\nWhen I send the request, I add a header with a signature which is nothing but hash_hmac(\"sha256\", json_encode($data), \"secret_key\"). So I get different signatures when sending data as json and form_params (since the data received is different in case of form_params as null values are discarded/not sent). First, I thought it might be because of a bug in Guzzle but it isn't.\n\nIs there anyway to solve this signature issue?"
] | [
"php",
"json",
"guzzle",
"guzzle6"
] |
[
"Hibernate : merge an object detached from the session",
"I work on a client-server application that works like that :\n\n1- the client calls the server to get a object from the DB\n\n2- the server opens a hibernate session and get() an entity. Then closes the session.\n\n3- in order to reduce the data transfered through the network, only a part of the data is copied into a Data Transfer Object.\n\n4- the client updates the data, and send the Data Transfer Object back to the server.\n\n5- the server converts the DTO to a new entity.\n\n6- so the question is: \n\nHow to persist/merge the data from the client with the data from the database without overiding non-null values stored in the DB ?\n\nDo I need to use update() ? merge() ? do I need to use the \"dynamic-update=true\" property ?"
] | [
"java",
"hibernate"
] |
[
"Why adding after() text each time twice on click using jQuery?",
"I have few questions, when i click on particular question Add Answer button display. After display button i click on button to get answer according to question which i already clicked using jQuery after() like given below:-\n\nIt is working but not properly \n\nwhen i click on first question than click on button, it is give one answer, it is ok\n\nbut when i click on second question than click on button is give answer two time, it is not ok \n\nI want just single answer for each question, how can i do that?\n\n\r\n\r\n$(function(){\r\n $('button').hide();\r\n $('.questions').click(function(){\r\n $('button').show();\r\n var $QuestionClick = $(this);\r\n\r\n $('button').click(function(){\r\n $QuestionClick.after('<p>This is text</p>')\r\n });\r\n \r\n });\r\n});\r\n.questions{ background:#f1f1f1; border:#ccc; padding:10px;}\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n\r\n<button>Add Answer</button>\r\n\r\n\r\n<p class=\"questions\">Question 1</p>\r\n<p class=\"questions\">Question 2</p>\r\n\r\n\r\n\n\nAnswer will be appreciated!"
] | [
"javascript",
"jquery"
] |
[
"Improving trial division primality test using 6k+/-1 rule",
"I was going through the basics of trial division primality test, and hence, implementing it in code. The performance of the algorithm can be increased using many tricks like:\n\n1) running the trial division only up to square-root(n)\n\n2) trading memory for time by creating a sieve up to square-root(n), and then running the trial division only on the primes in the created sieve\n\nBut nowhere did I find the idea of returning the result as composite if the value of n%6 (n mod 6) if found out to be 1 or 5 (using the 6k +/- 1 rule). Will using this rule in our prime number determination test not improve its performance? If yes, why hasn't it been mentioned anywhere? If no, why is it so?\n\nThanks."
] | [
"algorithm",
"primes",
"primality-test"
] |
[
"How to pass list as parameter in parallel process using concurrent.futures",
"I have the following codes. In principle, I'd like to iterate long_list\nand apply a function procedure(), which takes a value and another list short_list as parameter:\n\ndef procedure(par1, the_short_list):\n \"\"\"\n Description of procedure\n \"\"\"\n o1, o2 = par1.split(\" \")\n out = []\n for sl in the_short_list:\n output = sl * int(o1) * int(o2)\n out.append(output)\n return out\n\n\n\nlong_list = [str(v) + \" \" + str(w) for v, w in enumerate(range(0,10))]\nshort_list = range(10,15)\n\n#--------------------------------------------------\n# Sequential\n#--------------------------------------------------\nfor i in long_list:\n out = procedure(i, short_list)\n print (out)\n\n\nIt produces this result:\n\n[0, 0, 0, 0, 0]\n[10, 11, 12, 13, 14]\n[40, 44, 48, 52, 56]\n[90, 99, 108, 117, 126]\n[160, 176, 192, 208, 224]\n[250, 275, 300, 325, 350]\n[360, 396, 432, 468, 504]\n[490, 539, 588, 637, 686]\n[640, 704, 768, 832, 896]\n[810, 891, 972, 1053, 1134]\n\n\nNow what I want to do is to parallelize the process by breaking the long_list and run procedure() in parallel and finally gather the results.\n\nI tried this code:\n\n#--------------------------------------------------\n# Parallel\n#--------------------------------------------------\nimport concurrent.futures\nwith concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:\n future = executor.submit(procedure, long_list, short_list)\n print(future.result())\n\n\nBut it gives this error.\n\nTraceback (most recent call last):\n File \"test.py\", line 33, in <module>\n print(future.result())\n File \"/home/ubuntu/anaconda2/lib/python2.7/site-packages/concurrent/futures/_base.py\", line 462, in result\n return self.__get_result()\n File \"/home/ubuntu/anaconda2/lib/python2.7/site-packages/concurrent/futures/thread.py\", line 63, in run\n result = self.fn(*self.args, **self.kwargs)\n File \"test.py\", line 6, in procedure\n o1, o2 = par1.split(\" \")\nAttributeError: 'list' object has no attribute 'split'\n\n\nWhat's the right way to do it? \n\nI expect the output to be the same with sequential version. And when apply with much larger long_list it will run faster."
] | [
"python",
"parallel-processing"
] |
[
"How do I write a clean Makefile?",
"The Makefiles that I have dealt with, for the most part, are complex and hide a lot of relationships. I have never written one myself, and was wondering if anybody had some tips on writing a Makefile that is easy to read and reusable?"
] | [
"makefile"
] |
[
"How to preload an image using jQuery",
"Hi I have a project in which one of the pages has a gallery. Something like that:\n\n <div id=\"gallery\" class=\"sections\">\n <img src=\"Images/Image1.jpg\" class=\"thumbnails\">\n <img src=\"Images/Image2.jpg\" class=\"thumbnails\">\n <img src=\"Images/Image3.jpg\" class=\"thumbnails\">\n etc...\n </div>\n\n\nI would like to preload these images so that when you access the gallery page they are already loaded. I know you can do this by using javascript. Something along the lines of:\n\nvar myImage = new Image();\nmyImage1.src = \"Images/Image1.jpg\";\netc...\n\n\nWhat I am unsure about is the next step. Do I remove the src from the html and add an id, like so:\n\n <div id=\"gallery\" class=\"sections\">\n <img id=\"image1\" class=\"thumbnails\">\n <img id=\"image2\" class=\"thumbnails\">\n <img id=\"image3\" class=\"thumbnails\">\n etc...\n </div>\n\n\nand then do something like that:\n\n$('#image1').append(myImage1);\n\n\nThis hasn't worked... I have also tried:\n\n$('#image1').attr('src','Images/Image1.jpg');\n\n\nAnd that hasn't worked either.\n\nI have had a look around and there are plenty of tutorials about how to make a function that preloads your images etc... but I am not quite there yet. I just would like to know how to do it on a one by one basis for now and then maybe create a function. Thanks."
] | [
"javascript",
"jquery",
"html",
"image",
"preload"
] |
[
"Javascript React Component with 2 returns depending on condition",
"I have a react component and have a condition on it.\n\nI want to have a different return jsx depending on the condition result.\n\nThis is what I've got but it's only returning the last one.\n\nHere's the code:\n\nimport React, { Component } from 'react';\nimport { Redirect } from 'react-router';\n\nclass Login extends Component {\n constructor(props) {\n super(props);\n this.state = {\n isLoggedIn: sessionStorage.getItem('isLoggedIn'),\n redirect: false,\n };\n }\n\n render() {\n\n if (!this.state.isLoggedIn) {\n\n return (\n <div>\n <h1>You are NOT logged in</h1>\n </div>\n );\n\n } else {\n\n return (\n <div>\n <h1>You ARE logged in</h1>);\n </div>\n\n }\n }\n}\n\nexport default Login;\n\n\nHow can I fix this?"
] | [
"javascript",
"reactjs"
] |
[
"Realtime collabrative whiteboard drawing in android?",
"There are many examples for creating real-time collaborative whiteboard drawing in web, if i want to do it in android which should work with iOS app also.\nmost of the links which i saw is web-based:\n\nhttps://github.com/JohnMcLear/draw\nhttps://github.com/mirceageorgescu/Real-time-canvas\nhttps://github.com/byrichardpowell/draw\nhttps://github.com/cshum/aerosketch\nhttps://github.com/MikeMcQuaid/Whiteboard\nhttps://github.com/gipsyblues/Go-Drawingboard\n\n\nlike this there are lots of projects based on web,webrtc,nodejs and loading webview in android. If i want to do in native android from where i have to start."
] | [
"android",
"canvas",
"real-time",
"whiteboard"
] |
[
"Attribute on root element in a JAX-WS service",
"I'm trying to annotate a java class which will in the input param in an JAX-WS based web service.\n\nThe following is the input class\n\n@XmlRootElement\nclass InputClass\n @XmlAttribute\n private String type;\n @XmlElement\n private String id;\n\n\nand the service operation signature:\n\n@WebResult(name = \"success\")\npublic boolean operation(@WebParam(name = \"input\") InputClass input);\n\n\nThis gives input xml that look like this:\n\n<input>\n <id type=\"something\">an_id</id>\n</input>\n\n\nIs there any way to map the InputClass so that it produces XML that look like this:\n\n<id type=\"something\">an_id</id>"
] | [
"java",
"xml",
"jaxb",
"jax-ws"
] |
[
"Trying to multithread SSH connections",
"I have a bunch of server out there and I endavoured to create a php script to ssh all my servers, collect the last log entry and insert all results into a database.\n\nI am using phpseclib to connect to the server, and one by one it works fine, but because I have a lot of them I though why not use threads ?\n\nWell i am not quite sure what I am missing here but here what I got so far. outside of thread everything works fine but as soon as I thread NET_SSH2->login everything falls appart and nothing works.\n\nHere my code any clues on what I missing ?\n\nThanks\n\n<?php \nset_time_limit(0);\ninclude('Net/SSH2.php');\n\nclass poller extends Thread{\n\nprivate $tid;\nprivate $tip_array;\npublic $tresult;\n\npublic function __construct($tid,$tip_array)\n{\n $this->tid = $tid;\n $this->tip_array = $tip_array;\n}\n\npublic function run()\n{\n $i=1;\n foreach ($this->tip_array as $ip){\n $temp_result[$i][0]=$ip;\n $ssh = new Net_SSH2($ip[0]);\n if (!$ssh->login('user', 'pass')) {\n $temp_result[$i][1]= $ssh->isConnected() ? 'bad username or password' : 'unable to establish connection';\n } \n $temp_result[$i][2]=$ssh->exec(' grep \"Device\" syslog.messages | tail -1'); \n $i++;\n }\n $this->tresult=$temp_result;\n} \n}\n\n$i=1;\n$rows=array(array(\"1.1.1.1\", \"2.2.2.2\"), array(\"3.3.3.3\", \"4.4.4.4\"));\n\nforeach ($rows as $row){\n $threads[$i] = new poller($i,$row);\n $threads[$i]->start();\n $i++;\n}\n\nforeach ($threads as $thread)\n{\n $thread->join();\n echo '############Thread'.$thread->tid.'############';\n print_r($thread->tresult);\n echo '##############################';\n}\n?>"
] | [
"php",
"phpseclib",
"php-pthread"
] |
[
"Flask app throws internal server error randomly",
"I have setup a flask app that fetches data (using psycopg2) from my Postgres and returns it in a JSON format, when hitting the relevant URL. It works fine most of the time, but after a random number of executions it returns :\n\n**Internal Server Error**\n\nThe server has encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.\n\n\nThe app is hosted in an EC2 t2.micro, while the Postgres is an AWS RDS. Any ideas would be highly appreciated.\n\nUpdate\n\nIn EC2 logs, I have seen the following Psycopg2 error\n\n psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block\n\n\nSeems there's an error in the query, but shouldn't be as it runs properly most of the time."
] | [
"python",
"flask",
"amazon-ec2",
"psycopg2"
] |
[
"How to use dynamic table in SQL query \"Select * From $var; \" $var is fetching from another file",
"In below code i want to use $var as tablename, and the vale for $var is coming from another file. $var value is the name of table. So i want the dynamic tablenaame in sql query. but when i am executing following code then sql query is not taking $var value. But when i am declaring $var value in this file as static value then it is executing correctly. so please help me ...how to use variable as tablename in sql query.\n\ninclude_once(\"set_team.php\");\n// Create connection\n$conn = mysqli_connect($server, $username, $password, $database);\n// Check connection\nif ($conn->connect_error) {\n die(\"Connection failed: \" . $conn->connect_error);\n} \n\n\nob_start();\necho $table;\n$var = ob_get_clean();\n\n$sql = \"SELECT * FROM $var\";\n$res = mysqli_query($conn,$sql);\n$result = array();\n\n\nwhile($row = mysqli_fetch_array($res)){\narray_push($result,\narray('name'=>$row[1]\n));\n}\n echo json_encode(array(\"result\"=>$result));\n\n\n$conn->close();"
] | [
"php",
"mysql",
"sql"
] |
[
"Too many redirects rewrite loop",
"To redirect my visitors to https I used this rule in my web.config:\n\n <rewrite>\n <rules>\n <clear />\n <rule name=\"HTTP to HTTPS redirect\" stopProcessing=\"true\">\n <match url=\"(.*)\" /> \n <conditions>\n <add input=\"{HTTPS}\" pattern=\"off\" ignoreCase=\"true\" />\n </conditions>\n <action type=\"Redirect\" redirectType=\"Found\" url=\"https://{HTTP_HOST}/{R:1}\" />\n </rule>\n </rules>\n </rewrite>\n\n\nBut I get errors (too many redirects) when I try to visit the website, it seems it gets stuck in a loop. \n\nhttps://example.com and https://www.example.com are ok. \n\nBut these addresses result in an error: \n\n\nexample.com & www.example.com \nhttp://example.com & http://www.example.com\n\n\nCan anyone help me with this?"
] | [
"redirect",
"iis",
"url-rewriting"
] |
[
"convert comma separated string to list using linq",
"I have 3 comma separated strings FirstName, MiddleInitial, LastName\n\nI have a class NameDetails:\n\npublic class NameDetails\n{\n public string FirstName { get; set; }\n public string MiddleInitial { get; set; }\n public string LastName { get; set; }\n}\n\n\nI have the values for strings as:\n\nFirstName =\"John1, John2, John3\"\nMiddleInitial = \"K1, K2, K3\"\nLastName = \"Kenndey1, Kenndey2, Kenndey3\"\n\n\nI need to fill the NameDetails List with the values from the comma separated strings. \n\nAny linq for this? I need this for my asp.net mvc (C#) application."
] | [
"c#",
"linq",
"string"
] |
[
"JTable Nimbus Look and Feel - how to make it clear which cell has focus",
"When editing data in a JTable (Nimbus L & F), as the user tabs from cell to cell, it is not obvious which cell has focus. How can I make it clearer which cell has focus? I know there are a number of properties that can be set to modify Nimbus - does anyone know which property I want?\n\nThe screen shot below has only one property set to something other than the default:\n\nUIManager.put(\"Table.showGrid\", true);"
] | [
"java",
"swing",
"jtable",
"nimbus",
"tablecelleditor"
] |
[
"RootProject and ProjectRef",
"I have been trying to find more information on RootProject and ProjectRef, but looks like it is not mentioned at all in sbt documentation.\n\nI understand that if you are referencing a root project you should use RootProject and ProjectRef when you are referencing a sub-project. However it is not clear how the behavior will be different between them. Can somebody please help explain?\n\nAlso the fact that it is not documented, does it mean that RootProject and ProjectRef are not the recommended way to reference other sbt projects?\n\nThanks."
] | [
"sbt"
] |
[
"I am using formsauthentication in my application but it is not working",
"Below is my code for forms authentication in asp.net but some time it is not working means some time user is not logged in\n\nFormsAuthentication.SetAuthCookie(authentificationString, rememberLogin);\n\n string cookieName = FormsAuthentication.FormsCookieName;\n HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[cookieName];\n if (authCookie != null)\n {\n System.Web.HttpContext.Current.Response.Cookies[cookieName].Domain = Utilities.ResponseManager.CookieDomain;\n }\n\n\nIt is working fine in my local machine but when I deploy on my server then it is not working.\n\nis it any iss setting or something else..\nwhat I need to do for this.\n\nbelow is web.config code\n\n\n \n\n\nand local machine having IIS 6.0 and Server having IIS 7.0\n\nPlease help me out on this problem"
] | [
"c#",
"asp.net"
] |
[
"Tornado frame src not working",
"I am using Tornado and I have the following code:\n\nclass UserHandler(RequestHandler):\n def get(self):\n user = self.get_argument(\"username\")\n self.set_cookie(\"user\", user)\n out = tableize(user)\n self.render('chat.html',table=out)\n\n\nnow, chatter.html looks like this:\n\n<iframe src=\"{{ static_url('mess.html') }}\" width=\"500\" height=\"400\"></iframe>\n\n\nwhere mess.html is:\n\n<div id=\"chat\">\n {% for x in table %}\n <b> x </b>\n {% end %}\n</div>\n\n\nMy question is, how do I pass the 'table' argument to mess.html? I can't figure out how to make it display properly."
] | [
"python",
"tornado"
] |
[
"Setting a LIMIT on a JOIN in MySQL",
"I created the following query in order to produce a two-level navigation,\nLevel one - categories \nLevel two - subcategories\n\nEx. category - Year<br />\nsubcategories - 2013, 2012, 2011, 2010, 2009\n\n\nIt looks like this:\n\n$query = \"\n SELECT categories.Category, categories.idCat, subcategories.subCategory, subcategories.idSub \n FROM \n categories \n JOIN \n cat_sub ON categories.idCat = cat_sub.idCat\n JOIN \n subcategories ON subcategories.idSub = cat_sub.idSub\n ORDER BY \n categories.idCat DESC,subcategories.idSub DESC\";\n\n\nThe tables looks like this: \n\ncategories(idCat, Category)\n\nsubcategories(idSub, subCategory)\n\ncat_sub(idCat, idSub)\n\n\nI want to LIMIT the amount of subcategories to three, while keeping categories unlimited.\nAny help would be much appreciated!\n\nEx. ONLY DISPLAY\ncategory - Year\n subcategories - 2013, 2012, 2011\n\nHope I made things a bit more clear.\n\nThanks,\nAleks"
] | [
"mysql",
"sql",
"join"
] |
[
"How to send information Google Checkout through an API?",
"Has any one integrated Google Checkout? I have already tried with example provided on Google Checkout help and it working fine but I want to send credit card information and other informations like address, name, etc from my web site through an API. I am not finding any way to do this."
] | [
"google-checkout"
] |
[
"phpmyadmin - stacked charts broken",
"In phpmyadmin 4.2.2 and 4.0.4, I cannot recreate three column stacked charts as per the documentation:\nhttp://wiki.phpmyadmin.net/pma/Charts#Three_columns\n\nSELECT\n 225 AS 'Amount',\n 'Tele2' AS 'Operator',\n '2009-11' AS 'Month' UNION\nSELECT 653, 'Omnitel', '2009-11' UNION\nSELECT 1157, 'Tele2', '2009-12' UNION\nSELECT 855, 'Omnitel', '2009-12' UNION\nSELECT 569, 'Tele2', '2010-01' UNION\nSELECT 253, 'Omnitel', '2010-01' UNION\nSELECT 282, 'Tele2', '2010-02' UNION\nSELECT 455, 'Omnitel', '2010-02' UNION\nSELECT 2960, 'Tele2', '2010-03' UNION\nSELECT 3552, 'Omnitel', '2010-03'\n\n\nIs suppose to return this:\n\n\nHowever, this is what I get: (\"Series\" setting, which is obscured in the image below, is set to \"Amount\")\n No possible configuration of Stacked enabled/disabled or X-axis as 'operator' creates the expected result."
] | [
"mysql",
"charts",
"phpmyadmin",
"pchart"
] |
[
"c# generic, covering both arrays and lists?",
"Here's a very handy extension, which works for an array of anything:\npublic static T AnyOne<T>(this T[] ra) where T:class\n{\n int k = ra.Length;\n int r = Random.Range(0,k);\n return ra[r];\n}\n\nUnfortunately it does not work for a List<> of anything. Here's the same extension that works for any List<>\npublic static T AnyOne<T>(this List<T> listy) where T:class\n{\n int k = listy.Count;\n int r = Random.Range(0,k);\n return listy[r];\n}\n\nIn fact, is there a way to generalise generics covering both arrays and List<>s in one go? Or is it know to be not possible?\n\nCould the answer even (gasp) encompass Collections?\n\nPS, I apologize for not explicitly mentioning this is in the Unity3D milieu. For example "Random.Range" is just a Unity call (which does the obvious), and "AnyOne" is a completely typical extension or call in game programming.\nObviously, the question of course applies in any c# milieu."
] | [
"c#",
"arrays",
"generics",
"unity3d"
] |
[
"Cannot install ruby using RVM in Cygwin - curl SSL cert problem",
"I'm trying to install ruby using RVM in Cygwin, but I'm getting the error:\n\n\n curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:\n error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed\n More details here: http://curl.haxx.se/docs/sslcerts.html\n\n\ni've looked at this question: Curl Certificate Error when Using RVM to install Ruby 1.9.2\n\nbut unfortunately the solution doesn't work for me because curl-config --ca doesn't show anything. I checked with curl-config --configure and it seems the package was compiled with the --without-ca-bundle\n\nhow can I work around this?"
] | [
"ruby",
"curl",
"cygwin",
"rvm"
] |
[
"How to send \"Ctrl+Q\" event to other app when use QProcess launch it?",
"I have a app A. In A, have two button : Open and CLose. \n\n\nWhen I click Open button, it show other App - for example, name :B.\nWhen I click Close button, my app send \"CTRL+Q\" event to close B app.\n\n\nI write code by Qt and VS2010. I use QProcess to show B. But I don't want to use QProcess::kill or close() to close B app. I want to send \"CTRL+Q\"event to close B app because I have some code in B app what free memory.\nThanks for helping!\n\nP/s: In B App , I wrote if you press CTRL+Q , app close.\n\nResolve :\nI don't find how to send \"CTRL+Q\" event but if you close other app, you should use \"QProcess::terminate()\". Don't use close or kill because it kill your other app."
] | [
"qt",
"qprocess"
] |
[
"Overlapping div's when using textarea on mobile",
"In the images below I believe the problem to be self explanatory. The content works perfectly up until trying to enter text. Any advice on what is causing this would be appreciated. Sorry the images are so large. I have removed some HTML (the logo, menu and hidden navbar) for easier reading\n\n\n <section class="contact-background" id="particles-js" >\n</section>\n <section class="contact-page">\n<div class="contact-container">\n <h1>Get In Touch</h1>\n <div class="border"></div>\n <p>I'll get back to you promptly</p>\n <form class="contact-form" action="contactform.php" method="POST">\n\n <input class="contact-form-text" type="text" id="name" name="name" placeholder="Full name" tabindex="1" required>\n <input class="contact-form-text" type="email" name="email" placeholder="Your E-mail" tabindex="2" required>\n <input class="contact-form-text" type="text" id="subject" name="subject" placeholder="Subject" tabindex="3" required>\n <textarea class="contact-form-text" id="message" name="message" placeholder="Message" tabindex="4"></textarea>\n <button class="contact-form-button" type="submit" name="submit" value="Send">Send</button>\n\n </form>\n</div>\n</section>\n\n body{\n display: inline-block;\n width: 100%;\n height: 100%;\n position: absolute;;\n} \n\n#particles-js{\n background-size: cover;\n height: 100%;\n width: 100%;\n position: absolute;\n}\n\n .contact-page{\n height: 100%;\n width: 100%;\n}\n\n .contact-container{\n height: 100%;\n width: 100%;\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n}\n\n.contact-form{\n display: flex;\n max-width: 60rem;\n padding: 2rem;\n flex-direction: column;\n align-items: center;\n}"
] | [
"css",
"mobile",
"layout",
"overflow"
] |
[
"Using EntityFramework Core 2.2 to seed data that has a database generated key",
"I'm using EF Core 2.2, using a code first approach. \n\nI have my entity class:\n\npublic class Client\n{\n [DatabaseGenerated(DatabaseGeneratedOption.Identity)]\n [Key]\n public int ClientID { get; set; }\n public string Name { get; set; }\n}\n\n\nand I'm seeding my data like so:\n\nvar client = new Client { Name = \"TestClient\"};\nmodelBuilder.Entity<Client>().HasData(client);\n\n\nBut I receive an error when trying to add a migration:\n\n\n The seed entity for entity type 'Client' cannot be added because a\n non-zero value is required for property 'ClientID'. Consider providing\n a negative value to avoid collisions with non-seed data.\n\n\nThe ClientID should be automatically generated and I don't want to specify it. Is there a workaround to this or has this functionality simply not been implemented yet?"
] | [
"entity-framework-core",
"ef-core-2.2",
"entity-framework-core-migrations"
] |
[
"GWT/Hibernate: java.lang.NoClassDefFoundError: org/hibernate/Interceptor",
"I am trying to initialize a Hibernate session in my project-web-server. For that I am using a library I wrote project-data-model that is linked as dependency in maven:\n\nproject-web-server pom.xml:\n\n <dependency>\n <groupId>com.preoject.server</groupId>\n <artifactId>project-data-model</artifactId>\n <version>0.0.1-SNAPSHOT</version>\n </dependency>\n\n\nHibernateSession.java is therefore in project-data-model; this is how I use it in project-web-server:\n\npublic class ServerConfig implements ServletContextListener {\n\n public void contextInitialized(ServletContextEvent event) {\n try {\n HibernateSession.initialize();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n public void contextDestroyed(ServletContextEvent event) {\n // Do stuff on shutdown.\n }\n}\n\n\nEven though I referenced the data model project as dependency I am getting a java.lang.NoClassDefFoundError exception:\n\njava.lang.NoClassDefFoundError: org/hibernate/Interceptor\n at java.lang.Class.forName0(Native Method)\n at java.lang.Class.forName(Unknown Source)\n at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)\n at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:65)\n at com.project.datamodel.HibernateSession.initialize(HibernateSession.java:19)\n at com.project.web.server.ServerConfig.contextInitialized(ServerConfig.java:14)\n ...\n\n\nI can't figure out what I have to do here. The folder war/WEB-INF/lib does not contain any Hibernate related libraries; could that be the problem? I'm not sure because I have added the Hibernate dependencies to the parent pom.xml:\n\n <dependency>\n <groupId>org.hibernate</groupId>\n <artifactId>hibernate-core</artifactId>\n <version>4.0.1.Final</version>\n </dependency>\n <dependency>\n <groupId>org.hibernate</groupId>\n <artifactId>hibernate-validator</artifactId>\n <version>4.2.0.Final</version>\n </dependency>\n <dependency>\n <groupId>org.hibernate.common</groupId>\n <artifactId>hibernate-commons-annotations</artifactId>\n <version>4.0.1.Final</version>\n <classifier>tests</classifier>\n </dependency>\n <dependency>\n <groupId>org.hibernate.javax.persistence</groupId>\n <artifactId>hibernate-jpa-2.0-api</artifactId>\n <version>1.0.1.Final</version>\n </dependency>\n <dependency>\n <groupId>org.hibernate</groupId>\n <artifactId>hibernate-entitymanager</artifactId>\n <version>4.0.1.Final</version>\n </dependency>"
] | [
"java",
"hibernate",
"maven",
"gwt"
] |
[
"Javascript/JQuery Execute Javascript Only On Page Focus",
"Is it possible in javascript to only execute javascript if the user is on the actual tab/page?\n\nLike if he switches to another tab then the javascript process will be paused and when he returns to the tab the javascript will continue the process."
] | [
"javascript",
"process",
"execution"
] |
[
"Psycopg2 not installing on Mac M1",
"The problem is that psycopg2 isn't installing inside a Virtual Env for a project running with Python and Django on a Mac M1.\nDjango-heroku is trying to install that dependency but is not working on M1.\nThanks!"
] | [
"python",
"django",
"heroku",
"psycopg2"
] |
[
"Converting a transaction log into a data frame for cohort analysis",
"EDIT: Now made reproducible by using a publicly available dataset.\n\nI would like to take a transaction log e_log, with the following schema: \n\nrequire(BTYD)\ne_log <- dc.ReadLines(system.file(\"data/cdnowElog.csv\", package=\"BTYD\"),2,3,5)\ne_log[,\"date\"] <- as.Date(e_log[,\"date\"], \"%Y%m%d\")\ne_log$cust<-as.integer(e_log$cust)\n\nhead(e_log)\n cust date sales\n1 1 1997-01-01 29.33\n2 1 1997-01-18 29.73\n3 1 1997-08-02 14.96\n4 1 1997-12-12 26.48\n5 2 1997-01-01 63.34\n6 2 1997-01-13 11.77\n\n\nWhere each instance is a transaction and cust is the customer id, date is the transaction date and sales is the sales amount, and transform it into the following schema (note that the columns are not ordered):\n\ncust trans_date sales birth date_diff\n1 1 1997-01-01 29.33 1997-01-01 0 days\n2 1 1997-01-16 0.00 1997-01-01 15 days\n3 1 1997-08-27 0.00 1997-01-01 238 days\n4 1 1997-09-11 0.00 1997-01-01 253 days\n5 1 1998-04-23 0.00 1997-01-01 477 days\n6 1 1997-08-17 0.00 1997-01-01 228 days\n\n\nWhere cust is the customer id, trans_date is the transaction date in year/month/day, sales is the sum of sales for a given trans_date and cust, birth is the date of acquisition, and date_diff is the number of days elapsed from when the customer was acquired to the trans_date. In this schema, the primary key is cust and date_diff. There should be a row for every customer, for every day elapsed since the customer was acquired up until the maximum date in the dataset (i.e. the final observation time), regardless of whether there was a sale on a given day. The goal is to see sales as a function of days elapsed from acquisition.\n\nI have created a function that converts a transaction log to the above schema, but its slow, crude, and inefficient (not to be too hard on my self):\n\nrequire(BTYD)\ncohort_spend.df<-function(trans_log){ \n\n###create a customer by time spend matrix \nspend<-dc.CreateSpendCBT(trans_log)\n\n###coerce to data.frame\nsdf<-data.frame(spend)\n\n###order elog by date, create birth index\ne_ord<-trans_log[,1:2][with(trans_log[,1:2],order(date)),]\nbirth<-by(e_ord,e_ord$cust,head,n=1)\nbirthd<-do.call(\"rbind\",as.list(birth))\n\ncolnames(birthd)<-c(\"cust\",\"birth\")\n\n###merge birth dates to customer spend data frame\nsdfm<-merge(sdf,birthd,by=\"cust\")\n\n###difference transaction date and birth date to get days elapsed \n###from acquisition\nsdfm$date<-as.Date(sdfm$date)\nsdfm$diff<-sdfm$date-sdfm$birth\nsdfm2<-sdfm[sdfm$diff>=0,]\ncolnames(sdfm2)<-c(\"cust\",\"trans_date\",\"sales\",\"birth\",\"date_diff\")\nreturn(sdfm2)}\n\n\n\ndesired_schema<-cohort_spend.df(trans_log=e_log)\n\nhead(desired_schema)\ncust trans_date sales birth date_diff\n1 1 1997-01-01 29.33 1997-01-01 0 days\n2 1 1997-01-16 0.00 1997-01-01 15 days\n3 1 1997-08-27 0.00 1997-01-01 238 days\n4 1 1997-09-11 0.00 1997-01-01 253 days\n5 1 1998-04-23 0.00 1997-01-01 477 days\n6 1 1997-08-17 0.00 1997-01-01 228 days\n\nsystem.time(cohort_spend.df(trans_log=e_log))\n user system elapsed \n 46.777 0.967 47.768 \n\n\nI've included the function so that you can reproduce my results. Again, the output is correct, I'm simply looking to refactor; If you can think of a cleaner way to get the desired result, please share.\n\nNOTE: the desired schema should be derived entirely from the transaction log, with no need for external data."
] | [
"r",
"refactoring"
] |
[
"How to create program to flash PIC microcontrollers?",
"I am working on a project where I need to write a GUI using c# to flash PIC 18f4550.\n\nI know firmware programming using c. But this one requires me to go more deeper into the mechanism behind flashing. How should I approach this problem? Is there any resources that I can use to start with? \n\nDo I need to create driver(PC) to make the communication between PIC and PC?\nOn pic side I need to modify the bootloader I think. \n\nThanks for the help.. Much appreciated.."
] | [
"microcontroller",
"pic"
] |
[
"How to call another HTML file using swipe.js?",
"using SwipeJS how can I call a different html? For example using the following code to swipe pages I use it as index.html and I want to call other three inside like page1.html page2.html and page3.html Is that possible?\n\n<div id='slider' class='swipe'>\n <div class='swipe-wrap'>\n <div class=\"page\">\n Page 1\n </div>\n <div class=\"page\">\n Page 2\n </div>\n <div class=\"page\">\n Page 3\n </div>\n </div>\n</div>"
] | [
"javascript",
"jquery",
"html",
"swipe",
"swipe.js"
] |
[
"Why would Perl's printf output the format specifier rather than the formatted number?",
"I'm trying to debug a problem on a remote user's site. We've narrowed it down to a problem with formatted output in Perl. The user swears up and down that\n\nperl -e 'printf \"Number: %lG\\n\", 0.1'\n\n\nprints\n\nNumber: %lG\n\n\nnot \n\nNumber: 0.1\n\n\nThe user reports that their Perl is version 5.8. The oldest version I have around is 5.8.1, and it seems to behave correctly.\n\nAny guesses? Misconfiguration? Module conflicts?"
] | [
"perl"
] |
[
"How can I prevent a flex container from overflowing/underflowing?",
"I have a flexbox container that can be resized by dragging. How can I prevent that container from overflowing (getting too small and starting to hide some items) or underflowing (getting too large and showing blank space)?\n\nIn the following example, the container should stop shrinking when all items reach 18px height (except the last one), and stop expanding when all items reach their maximal heights (no blank space should appear).\n\n\r\n\r\nconst resizable = document.querySelector('.flex');\r\nlet startHeight = NaN;\r\nlet startY = NaN;\r\n\r\nresizable.addEventListener('mousedown', e => {\r\n startHeight = resizable.getBoundingClientRect().height;\r\n startY = e.pageY;\r\n});\r\n\r\nwindow.addEventListener('mousemove', e => {\r\n if (isNaN(startY) || isNaN(startHeight)) {\r\n return;\r\n }\r\n \r\n resizable.style.height = (startHeight + e.pageY - startY) + 'px';\r\n});\r\n\r\nwindow.addEventListener('mouseup', () => {\r\n startHeight = startY = NaN;\r\n});\r\n.flex {\r\n display: flex;\r\n flex-direction: column;\r\n overflow: hidden;\r\n border: 1px solid black;\r\n cursor: ns-resize;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n.item-1 {\r\n background: red;\r\n height: 40px;\r\n max-height: 60px;\r\n flex: 1;\r\n}\r\n\r\n.item-2 {\r\n background: blue;\r\n flex: none;\r\n}\r\n\r\n.item-3 {\r\n background: green;\r\n height: 50px;\r\n max-height: 50px;\r\n flex: 1;\r\n}\r\n\r\n.item-4 {\r\n background: yellow;\r\n height: 30px;\r\n flex: none;\r\n}\r\n<div class=\"flex\">\r\n <div class=\"item-1\">\r\n Item 1\r\n </div>\r\n <div class=\"item-2\">\r\n Item 2\r\n </div>\r\n <div class=\"item-3\">\r\n Item 3\r\n </div>\r\n <div class=\"item-4\">\r\n Item 4\r\n </div>\r\n</div>\r\n\r\n\r\n\n\nA pure CSS solution would be preferred. The solution should allow shrinking the container so that all the items are at their minimal size, and expanding it so that all of them occupy their maximal size. Hardcoding a minimal and maximal height in the container's CSS is not acceptable. I am seeking a generic solution."
] | [
"javascript",
"css",
"flexbox"
] |
[
"URL Rewriting on static pages",
"I have a Wordpress blog with permalink. I created a static page which shows a table of products (www.abc.xx/database/). If a user clicks on one of the products, it opens a new static page named 'product' that retrieves and shows information about the product by its id from the database. The URL is www.abc.xx/database/product?id=1.\n\nBut I would like to have a URL like www.abc.xx/database/product/my-product instead of www.abc.xx/database/product?id=1? Could someone explains how it works? \n\nUPDATE:\n\nI played a little bit around with some solutions posted on blogs. I added the following snippet to my functions.php file.\n\nadd_filter('rewrite_rules_array', 'add_rewrite_rules');\nfunction add_rewrite_rules($aRules) {\n $aNewRules = array('database/product/([^/]*)/?$' => $wp_rewrite->index .'index.php?pagename=product&product-name=$matches[1]');\n $aRules = $aNewRules + $aRules;\n return $aRules;\n}\n\nadd_filter('query_vars', 'add_query_vars');\nfunction add_query_vars($aVars) {\n $aVars[] = 'product-name';\n return $aVars;\n}\n\n\nOn the product page site I added\n\nif(isset($wp_query->query_vars['product-name'])) {\necho urldecode($wp_query->query_vars['product-name']);\n}\n\n\nNow, if I call www.abc.xx/database/product/my-product, the product page opens but \"my-product\" is not shipped. The \"product-name\" var is not set. Any hint?"
] | [
"php",
"wordpress",
"url-rewriting"
] |
[
"JSON feed not populating source for autocomplete",
"Noticed lots of people having this issue! not any of them seemed to help my problem though!\n\nMy JSON feed is http://menu.the-dot.co.uk/getingredients.php?func=json\n\nI've got a fiddle setup at http://jsfiddle.net/OwenMelbz/xgQnQ/ with the code to test\n\n$(function() {\n$(\"#food\").autocomplete({\n source: \"http://menu.the-dot.co.uk/getingredients.php?func=json\",\n minLength: 2,\n dataType: \"json\",\n select: function(event, ui) {\n log(ui.item ? \"Selected: \" + ui.item.value + \" aka \" + ui.item.id : \"Nothing selected, input was \" + this.value);\n }\n});\n});\n\n\nthis is literally copy and pasted from the demo page on jqueryui.com apart from dataType added and source added, as well as the selector changing!\n\nBasically, you type in the box using this feed. Nothing comes up. you type in the box using source: myArray it works, anyone see my issue with the code and demos i've provided?\n\nthanks"
] | [
"jquery",
"json",
"autocomplete",
"external"
] |
[
"Style list item onMouseOver - React.js",
"I just started with React and I am currently building a Tic Tac Toe game for learning purposes. When the user hovers over a square which is a list item, I want that square to have a background image. So far I am able to do it only if I manipulate the DOM directly like this:\n\nevent.target.style = <bacgroundImageUrl>\n\n\nwhich of course is an anti-pattern in React\n\nHere is what my state looks like:\n\nstate = {\n gameInProgress: true,\n player1Active: false,\n player2Active: false,\n board: [1, 2, 3, 4, 5, 6, 7, 8, 9],\n squareHovered: false,\n player1Winner: false,\n player2Winner: false,\n player1BgImg: null,\n player2BgImg: null,\n tie: false,\n winner: false\n}\n\n\nThis is what's inside my render function:\n\n<Board>\n<Squares\n bg={\n this.state.player1Active\n ? this.state.player1BgImg\n :this.state.player2Active\n ? this.state.player2BgImg\n : null}\n hovered={(event) => this.hoverOverSquare(event)}\n notHovered={(event) => this.notHoverOverSquare(event)}\n clicked={(event) => this.fillSquare(event,\n this.state.player1Active\n ? this.playersData.player1Sign\n : this.state.player2Active\n ? this.playersData.player2Sign\n : null\n )}/>\n</Board>\n\n\nAnd also the component:\n\nconst Squares = (props) => {\nlet squares = [];\n\nfor(let i = 1; i < 10; i++){\n squares.push(\n <li\n id={i}\n key={i}\n style={props.bg}\n onClick={props.clicked}\n onMouseLeave={props.notHovered}\n onMouseOver={props.hovered}\n className=\"box\">\n </li>\n )\n}\n\n return squares;\n}\n\n\nAs you may already know this applies background image to all list items(squares). So, I am just not able to find a way of solving this. Any help and criticism will be greatly appreciated. Thanks!"
] | [
"javascript",
"reactjs"
] |
[
"How to get all my playlists with SoundCloud API",
"I'm using the iOS SDK provided by SoundCloud. My issue is the following : i can't get my playlists. Indeed, there a few weeks, everything was working properly but now my jsonResponse object is nil.\nHere is an excerpt of my code :\n\n//Get soundcloud account to launch request\nSCAccount *account = [SCSoundCloud account];\nSCRequestResponseHandler handler;\nhandler = ^(NSURLResponse *response, NSData *data, NSError *error) {\n NSError *jsonError = nil;\n NSJSONSerialization *jsonResponse = [NSJSONSerialization\n JSONObjectWithData:data\n options:0\n error:&jsonError];\n if (!jsonError && [jsonResponse isKindOfClass:[NSArray class]]) {\n //response treatment\n }\n\nNSString *resourceURL = @\"https://api.soundcloud.com/me/playlists.json\";\n[SCRequest performMethod:SCRequestMethodGET\n onResource:[NSURL URLWithString:resourceURL]\n usingParameters:nil\n withAccount:account\n sendingProgressHandler:nil\n responseHandler:handler];\n\n\nI don't understand because the two following requests return results: \n\n\n/Me (about my soundcloud account)\n\n\nNSString *resourceURL = @\"https://api.soundcloud.com/me.json\";\nRequest with this URL return an NSDictionary which contains some informations such as the number of playlists (return 61 playlists)\n\n\n/Tracks (get tracks)\n\n\nNSString *resourceURL = @\"https://api.soundcloud.com/me/tracks.json\";\nRequest with this URL return an NSArray which contains some informations about my tracks\n\nSo, i am wondering if the url to get all playlists of my account with soundcloud api would not have changed ? \nThank you in advance for your answers."
] | [
"ios",
"objective-c",
"json",
"soundcloud"
] |
[
"How do I find out what volume a given NTFS path is on when using mount points?",
"I have an Exchange server with lots of mountpoints. Given the path to the database files is there a way to find out what volume they are on? The problem is that they are typically not at the volume mount point, but further down the tree. I'm using Powershell, so I need a solution preferably using WMI but could also use any .NET or COM objects."
] | [
".net",
"powershell",
"com",
"ntfs"
] |
[
"Ionic / Angular - Refresh articles on app resume",
"I have developed a News App using Ionic / Angular. Here is the code for the News Tab:\n\n<ion-view view-title=\"News\">\n <ion-content class=\"padding\">\n <ion-refresher pulling-text=\"Actualizează articolele\" on-refresh=\"doRefresh()\">\n </ion-refresher>\n <a class=\"article\" ng-repeat=\"article in articles\" href=\"#/tab/news/{{article.id}}\">\n <img ng-src=\"{{article.image}}\" class=\"article-image\">\n <h2 class=\"article-title\">{{article.title}}</h2>\n <p class=\"article-published\">{{article.published}}</p>\n <p class=\"article-intro\">{{article.intro}}...</p>\n </a>\n </ion-content>\n</ion-view>\n\n\nAnd here is the controller:\n\n.controller('NewsCtrl', function($scope, Articles) {\n Articles.all().then(function(articles) {\n $scope.articles = articles\n });\n $scope.doRefresh = function() {\n Articles.all().then(function(articles) {\n $scope.articles = articles\n });\n $scope.$broadcast('scroll.refreshComplete');\n };\n})\n\n\n$scope.articles = articles reads the articles from an external JSON file.\n\nSo I have the pull to refresh option working but there is one problem. If a user keeps the app open in the background I would like the articles to be refreshed when the user opens the app again. Someone can help me achieve this?"
] | [
"javascript",
"angularjs",
"ionic-framework"
] |
[
"How to work with momentjs?",
"First time I am using momentjs for date&time problem. \nHere my problem is that I have to calculate date and maximum slots between the given time period. \n\nTC1 : for 30 mins it is working fine, but 15 mins it is giving wrong result. \n\nHere is my code : \n\nlet moment = require('moment');\n\nlet start_date= moment(\"2018-02-01\"); \nlet end_date = moment(\"2018-02-02\"); \nlet start = start_date.date();\nlet end = end_date.date(); \n\nconst start_time = 12; // in 24hr \nconst end_time = 13; // in 24hr \nconst duration = 30; \nconst duration_slot = (duration===5)?12:(duration===10)?6:(duration===15)?4:(duration===20)?3:(duration===30)?2:(duration===45)?1:0;\nlet slotNumber=1;\nlet counter=duration;\n\nwhile(start < end){ // days count \n let arslots = [];\n const nextDay = start_date.add(1, 'days');;\n\n for(let h=start_time;h<end_time;h++){ // checking start hours to maximum hours \n\n let jsonObj = {};\n jsonObj.slotId = slotNumber++;\n\n nextDay.hours(h);\n nextDay.minutes();\n jsonObj.slot_start_time = nextDay.format();\n\n nextDay.hours(h);\n nextDay.minutes(duration);\n jsonObj.slot_end_time = nextDay.format();\n\n arslots.push(jsonObj);\n\n for (let m = 1; m < duration_slot; m++) {\n\n let jsonObj1 = {};\n jsonObj1.slotId = slotNumber++;\n\n nextDay.hours(h);\n nextDay.minutes(duration);\n jsonObj1.slot_start_time = nextDay.format();\n\n counter += counter;\n\n nextDay.hours(h);\n nextDay.minutes(counter);\n jsonObj1.slot_end_time = nextDay.format();\n\n arslots.push(jsonObj1);\n }\n counter = 0;\n }\n start++;\n }\n console.log(\" ::: \", arslots) \n}\n\n\noutput of 30 mins for 1 day is correct for the both slots 1 & 2.\n\n[ { slotId: 1,\n slot_start_time: '2018-02-02T12:00:00+05:30',\n slot_end_time: '2018-02-02T12:30:00+05:30' },\n { slotId: 2,\n slot_start_time: '2018-02-02T12:30:00+05:30',\n slot_end_time: '2018-02-02T13:00:00+05:30' } ]\n\n\noutput of 15 mins for 1 day : \n\n [ { slotId: 1,\n slot_start_time: '2018-02-02T12:00:00+05:30',\n slot_end_time: '2018-02-02T12:15:00+05:30' },\n { slotId: 2,\n slot_start_time: '2018-02-02T12:15:00+05:30',\n slot_end_time: '2018-02-02T12:30:00+05:30' },\n { slotId: 3,\n slot_start_time: '2018-02-02T12:15:00+05:30',\n slot_end_time: '2018-02-02T13:00:00+05:30' },\n { slotId: 4,\n slot_start_time: '2018-02-02T12:15:00+05:30',\n slot_end_time: '2018-02-02T14:00:00+05:30' } ]\n\n\nfor the slotId 3 : time should be start with 12:45:00 and \n for the slotId 4 : time should be start with 13:15:00 \n\nCan anyone help me ? Where I am doing wrong? \n\nThanks"
] | [
"javascript",
"node.js",
"datetime",
"momentjs"
] |
[
"How to create a condition in protractor for when an element exists or not",
"I'm using Protractor JS. And the site is written in Angular JS.\n\nSo I have a toggle switch. And I noticed the value in the toggle switch goes from true to false and \nfalse to true when you switch it off or on.\n\nI am trying create a condition when Protractor visits my page when it sees the toggle switch 'off' it will turn it 'on'. If the toggle switch is already 'on', it will first turn it 'off' then turn it 'on' again.\n\nI came up with this code, but for some reason it is not working:\n\n if( expect(element(By.id('toggle-switch')).element(By.css('[value=\"false\"]')).isDisplayed()) ) {\n element(By.id('toggle-switch')).click();\n console.log('in the if')\n }\n\n else{\n element(By.id('toggle-switch')).click();\n browser.sleep(3000);\n element(By.id('toggle-switch')).click();\n console.log('in the else')\n }\n\n\nThis code appears to work only for the if statement. For some reason it will never go to the else. Here is the error I'm receiving:\n\nNoSuchElementError: No element found using locator: By.cssSelector(\"[value=\\\"false\\\"]\")\n\nSo then I tried\n\n.isPresent() instead of .isDisplayed()\nI don't receive the above error anymore, but for some reason when using .isPresent() it always goes to the if statement and only runs that, and never the else statement. No errors displayed.\n\nIf there is a better way please let me know. This seems very limiting to not be able to create proper conditions in this framework."
] | [
"javascript",
"jquery",
"angularjs",
"selenium-webdriver",
"protractor"
] |
[
"Why python prints integers as float numbers in this program",
"def hailstone(n):\n print(n,end=' ')\n \n while n!=1:\n if n%2==1:\n n=3*n+1 \n print(n,end=' ')\n else:\n n=n/2\n print(n,end=' ')\n \nhailstone(7)\n\n\nOutput: 7 22 11.0 34.0 17.0 52.0 26.0 13.0 40.0 20.0 10.0 5.0 16.0 8.0 4.0 2.0 1.0\n\nHello, I wonder why python prints these integer numbers as float numbers after 22. Thanks."
] | [
"python",
"python-3.x"
] |
[
"Why print num is always zero in emu8086",
"When I input numbers on my 2 variables I think it doesn't read it, so mov has 0 value.\n\nNo problem compiling.\n\nHere's my code:\n\ninclude 'emu8086.inc'\norg 100h\n\ndefine_print_string\ndefine_scan_num \ndefine_print_num \ndefine_print_num_uns\ndefine_clear_screen\n\n.model small\n.data\n\n;data\na db \"oops\",0\nb db 0dh,0ah,\"enter first number: \",0\nc db 0dh,0ah,\"the sum is :\",0\nd db 0dh,0ah,\"Press 1 if adiition\",0\ne db 0dh,0ah,\"Press 2 if subtraction\",0\nf db 0dh,0ah,\"the diffirence is: \",0\ng db 0dh,0ah,\"enter second number: \",0\nh db 0dh,0ah,\"\",0\nnum1 dw 0\nnum2 dw 0\nresult dw 0\n\n;code\n.code\n\nstart:\nlea si,a\ncall print_string\nlea si,d\ncall print_string\nlea si,e\ncall print_string\nmov ah,1\nint 21h\ncmp al,'1'\nje addi\ncmp al,'2'\nje subt\ncmp al,'?'\nje start\n\n;input number 1\nproc enter1\nlea si,b\ncall print_string\ncall scan_num\nmov ax,num1\nret\nendp enter1\n\n;input number 2\nproc enter2\nlea si,g\ncall print_string\ncall scan_num\nmov bx,num2\nret\nendp enter2 \n\naddi:\ncall enter1\ncall enter2\nadd ax,bx\nlea si,h\ncall print_string\nlea si,c\ncall print_string\ncall print_num\n\nsubt:\n\nend1:\n\nend\n\n\nscreenshot"
] | [
"assembly",
"x86-16",
"emu8086"
] |
[
"R in SQL Server: Output data frame into a table",
"This probably has a simple answer but I cannot figure it out as I'm still getting a hang of working with R in SQL Server. I have a piece of code that reads in data from a SQL Server table, executes in R and returns a data frame. \n\nexecute sp_execute_external_script\n @language=N'R',\n @script=N'inp_dat=InputDataSet\n inp_dat$NewCol=max(inp_dat$col1,inp_dat$col2)\n new_dat=inp_dat\n OutputDataSet=new_dat'\n @input_data_1=N'select * from IM_COMP_TEST_SQL2016.dbo.temp_table';\n\n\nI want to insert new_dat into a SQL Server table (select * into new_table from new_dat). How do I go about this? Thanks in advance."
] | [
"sql",
"sql-server",
"r",
"sql-server-2016"
] |
[
"$http data from service to controller",
"iam searching for a way to transfer the requested data from my service to the controller. a simple return data dont work....i wondering why?\n\ntest.factory('DataService', function($http, $log) {\n\n return {\n\n getEmployees: function( ) {\n\n $http({method: 'GET', url: 'php/data.php'})\n .success ( function ( data, status, header, config ){\n\n //return data\n\n })\n .error ( function ( data, status, header, config ){\n\n $log.log ( status );\n\n })\n\n },\n\n getTest: function( ) {\n\n return \"test123\";\n\n }\n\n };\n\n});\n\n\ntest.controller('employees', function ( $scope, DataService ) {\n\n $scope.test = DataService.getEmployees();\n\n});\n\n\nThank you. Robert"
] | [
"angularjs"
] |
[
"How to add a loader to the following Django website (Python)?",
"The hi.html takes the data and the views.py process the data sending the result to result.html which takes much time to load, till the page is loaded full I want to load a loader or any Gif to make it interactive.\nViews.py\nfrom __future__ import unicode_literals\nfrom django.http import HttpResponse\nfrom django.shortcuts import get_object_or_404\nfrom django.shortcuts import render\nfrom demoapp.flipkart import *\nfrom demoapp.amzsel import *\n# Create your views here.\ndef hi(request):\n return render(request, 'demoapp/hi.html', {})\n\ndef search(request):\n del extractedflip[:]\n del extractedaz[:]\n hello = request.GET.get('search')\n initialflipkart(hello)\n initialaz(hello)\n datamatch=zip(extractedaz, extractedflip)\n context = {'datamatch': datamatch}\n return render(request, 'demoapp/result.html', context)\n\nresult.html\n <div class="container12">\n {% for ab in datamatch %}\n {% for c in ab %}\n {% for a in c %}\n<div class="col-xs-12 col-md-6">\n \n <!-- First product box start here-->\n <div class="prod-info-main prod-wrap clearfix">\n <div class="row">\n <div class="col-md-5 col-sm-12 col-xs-12">\n <div class="product-image"> \n <img src="{{ a.imglink }}" class="img-responsive"> \n <span class="tag2 hot">\n {{ a.SITE }}\n </span> \n </div>\n </div>\n <div class="col-md-7 col-sm-12 col-xs-12">\n <div class="product-deatil">\n <h5 class="name">\n <a href="{{ a.link }}">\n {{ a.name}}\n </a>\n <a href="{{ a.link }}">\n <span></span>\n </a> \n\n </h5>\n <p class="price-container">\n <span>₹{{ a.price }}</span>\n </p>\n <span class="tag1"></span> \n </div>\n <div class="description">\n <p></p>\n </div>\n <div class="product-info smart-form">\n <div class="row">\n <div class="col-md-12"> \n <a href="{{ a.link }}" class="btn btn-danger">{{ a.SITE }}</a>\n <a href="{{ a.link }}" class="btn btn-info">Buy</a>\n </div>\n <div class="col-md-12">\n <div class="rating">Ratings:\n \n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <!-- end product -->\n</div>\n{% endfor %} \n {% endfor %}\n {% endfor %}\n\nI have read some documentations from official page but it seems very confusing, can someone please give me its easy - understandable for beginner like solution."
] | [
"python",
"django",
"web",
"django-templates",
"loader"
] |
[
"How to build tess-two (fork of tesseract tools for android)",
"How to use the this for tesseract I found here? I am following the readme in that file, but I don't know how to build the project. Specially I am confused where to type this:\ncd tess\ncd tess-two\nndk-build\nandroid update project --path .\nant release\n\nI'm not sure if it's gonna work on cmd or do I need something else to build this."
] | [
"android",
"ocr",
"tesseract"
] |
[
"Django Rest Framework Doesn't escape Html Entity Problem",
"I wrote the django blog and api.\n\nWhen i started the postman and then wrote the api url it returns correct values except content i have issue with content content is returning &ouml . It's turkish charset &ouml=ö\nHow can i fix this problem ?\n\napi/serializers.py:\n\nclass MakaleSerializer(serializers.ModelSerializer):\n Yazar = serializers.CharField(source=\"Yazar.username\")\n class Meta:\n model = Makale\n fields = ('__all__')\n def to_representation(self, instance):\n data = super().to_representation(instance)\n data['İçerik'] = strip_tags(instance.İçerik)\n return data \n\n\napi/views.py:\n\nclass MakaleRudView(APIView):\n def get(self, request):\n makale = Makale.objects.all()\n serializer = MakaleSerializer(makale , many=True)\n return Response(serializer.data)\n\n\nand the postman or drf(Django Rest Framework returns :\n\n {\n \"id\": 26,\n \"Yazar\": \"gorkem\",\n \"Başlık\": \"Atatürk'ün Samsuna Çıkışı 2\",\n \"İçerik\": \"Atat&uuml;rk&#39;&uuml;n Samsuna &ccedil;ıkışı sırasında T&uuml;rkiye Cumhuriyeti&#39;nin\",\n \"Olusturma_Tarihi\": \"2020-05-29T09:10:43.874477+03:00\",\n \"makal_resim\": null\n },"
] | [
"django",
"django-rest-framework"
] |
[
"How to configure Spring Boot with multiple RabbitMQ?",
"I have 3 RabbitMQ clustings for different functionality.Now I want to consume these RabbitMQ clustings message in my spring boot project,What can I do?"
] | [
"spring",
"spring-boot",
"rabbitmq"
] |
[
"fixed aspect ratio in div, no matter the screen",
"I have a div I would like to mantain aspect ratio 2:1 no matter the screen size and ratio are.\n\nThis is my choice (discarding other previous options)\n\n\r\n\r\n.mydiv{\r\n\r\n background-color: red;\r\n width: 100%;\r\n position: absolute;\r\n height: 50%;\r\n}\r\n<div class=\"mydiv\">\r\n this should be a fixed aspect ratio div\r\n </div\r\n\r\n\r\n\n\nI tried media queries and this: https://www.w3schools.com/howto/howto_css_aspect_ratio.asp but it is not what I'm looking for because of the white padding space"
] | [
"css",
"media-queries"
] |
[
"installing packages in docker containers",
"I am wondering how to install packages inside docker containers. My usecase is, that I have a jenkins server with few kinds of agents, including a docker agent template, that causes a docker container to be created and used for each build without a label by default, if no virtual machine environment is necessary. The problem is, how to, in a secure way if possible, install dependencies before a build in such a docker container? I don't think having many images each for a different project with separate needs is a nice idea, and modifying a single image each time some project needs a dependency will probably bloat that image in case I will need many of those. But normally, for security reasons, there is no root access inside of a container. How to cope with this situation/what are possible options?"
] | [
"docker",
"jenkins"
] |
[
"Deciphering FTPS conversation",
"Here is a real life conversation (with IP, Hostname and ports masked) between the product I support and the z/OS based FTPS Server:\n\nOur product uses Java FTP libraries from EnterpriseDT\n\n---> SYST\n215 MVS z/OS 011100 is the operating system for Connect:\n---> PORT 111,111,111,111,11,111\n200 PORT command successful.\n---> LIST\n150 Opening data connection.\nValidating the server certificate when connecting to 'ftp.abc.com'.\nSuccessfully validated the SSL server certificate when connecting to 'ftp.abc.com'\n226 List complete. Closing data connection. 1 batches listed.\nNo input files found on server.\n\n\nI don't understand the last two lines of the conversation. Why do I only receive a list and not the actual file?"
] | [
"ftps",
"enterprisedt"
] |
[
"Use clip:rect on button in HTML",
"I am trying to load a image to a button using CSS.\n\nI seem to be able to make the button size work etc. but I can't seem to get the image to show correctly.\n\nMy icons.png has 8 icons and I only want to display one of them on the button.\nI am trying to use clip:rect to select just one of them but it doesn't seem to be working.\n\nIt seems to be showing all the icons on the button where I thought using clip:rect would allow me to select just one of the icons in my image.\n\nDoes anyone know where I have gone wrong?\n(Note: I can't use jQuery for this)\n\nHere is my CSS and HTML I am using.. \n\n<style type=\"text/css\">\n.button1\n{\n position:absolute;\n left: 20px;\n width:100px; \n height:100px;\n top:20px;\n clip:rect(0px,100px,100px,0px); /* rect(top, right, bottom, left) */ \n cursor: pointer; /* hand-shaped cursor */ \n cursor: hand; /* for IE 5.x */ \n}\n\n</style>\n\n\n<body bgcolor=\"#DFDFDF\">\n\n <button class=\"button1\"><img src=\"icons.png\"/></button>\n\n</body>\n\n\nThis is what it is doing.."
] | [
"html",
"css"
] |
[
"How to press the keys on keyboard without using keyboard in Objective-C?",
"I want my program to press certain keys on my keyboard without me doing it physically.\nfor example, button in my app for (command + UP) if user press the button, my app will do same thing in the keyboard .\nHow i do this?"
] | [
"objective-c",
"cocoa"
] |
[
"Ideas for cmd to delete content of documents folder WIN 10?",
"I want to create a .bat file with a command line inside that deletes all content of the C:\\Users\\Documents folder. I only want to delete the entire content of the folder, not the folder itself.\nWhy do I need this? Our company helps unemployed people find jobs and they use our laptops to create CVs and application lettres. They forget to delete their data (most of them don't really know how to use a computer) so I am trying to automate this process with a .bat file and a scheduled task (run script when user logs in).\nIf the laptops were WIN10 Pro, I would have used group policies in AD, but these computers are WIN10 home.\nAny Ideas? Thank you for your help."
] | [
"batch-file",
"cmd",
"directory",
"command"
] |
[
"Alpha and inner movieclips",
"I have a movieclip singleCircle which is a child of doubleCircle. Both circles are 100% black. Now when I set the alpha of doubleCircle, instead of treating the movieclip as a whole, it seems to be setting the alpha on each of the children, resulting in a darker part where they overlap.\n\n\n\nWhy does this happen and moreover, how can I set the alpha while preventing this from happening. It seems to me when I set the alpha on this specific object, an overlap shouldn't be visible, e.g. it should treat the object as a whole instead of assigning it to every child seperately\n\nI also tried:\n\n\nputting doubleCircle inside another movieclip container and setting the alpha on that\ntinting the doubleCircle black and set the alpha\ncache as bitmap on doubleCircle\n\n\nall of them result in the same overlap effect"
] | [
"flash",
"alpha",
"movieclip"
] |
[
"Why does date.valueOf() == date result in false?",
"Why does date.valueOf() == date result in false, but a = {}; a.valueOf() = () => 3; a.valueOf() == a result in true?"
] | [
"javascript"
] |
[
"RaptureXML iterate:usingBlock warning and crash",
"I'm parsing an XML file which looks like this:\n\n<partie numero=\"1\">\n <exercice numero=\"1\" libelle=\"blabla\"></exercice>\n <exercice numero=\"2\" libelle=\"anything\"></exercice>\n</partie>\n\n\nI'm using the Rapture XML Library, so as explained on GitHub, I do the following :\n\nRXMLElement *rxmlPartie = [rxmlParties child:@\"partie\"];\nNSArray *rxmlUnExercice = [rxmlPartie children:@\"exercice\"];\n\n\nI can print correctly the \"numero\" attribute from partie with this line :\n\n NSLog(@\"Partie #%@\",[rxmlPartie attribute:@\"numero\"] );\n\n\nBut when I try to use the iterate method on my NSArray :\n\n[rxmlPartie iterate:@\"partie.exercice\" usingBlock: ^(RXMLElement *exercice) {NSLog(@\"Exercice: %@ (#%@)\", [exercice attribute:@\"libelle\"], [exercice attribute:@\"numero\"]);}];\n\n\nI get a warning, and the the application crash, saying :\n\n-[RXMLElement iterate:usingBlock:]: unrecognized selector sent to instance 0xc67f870\nTerminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [RXMLElement iterate:usingBlock:]: unrecognized selector sent to instance 0xc67f870'\n\n\nDid I forget to import something, or do I implement the method in a bad way?\n\nThe same error happens if i try to use iterateWithRootXPath...\n\nThanks for your help!!"
] | [
"ios",
"xml",
"nsarray",
"loops"
] |
[
"PDO::quote with nulls, bools, and more",
"PDO::quote always seems to slap on two single quotes regardless of the type of value I pass it, or the parameter type I set.\n\ne.g.,\n\n$x = null;\necho $pdo->quote($x,PDO::PARAM_NULL); // ''\n\n\nThus I've extended the PDO class with my own function,\n\npublic function quote($value, $parameter_type=PDO::PARAM_STR) {\n if(is_null($value)) return 'NULL';\n elseif(is_bool($value)) return $value ? 'TRUE' : 'FALSE';\n elseif(is_int($value)||is_float($value)) return $value;\n return parent::quote($value, $parameter_type);\n}\n\n\nHave I missed any cases? Is there any harm in doing this?\n\nDo the different parameter types ever do anything?"
] | [
"php",
"pdo"
] |
[
"In Rails 3, want to get the HTML output of calling a controller's action",
"Is it possible for me to call a controllers action programatically and get the HTML output?"
] | [
"ruby-on-rails"
] |
[
"node.js XmlHttpRequest opens localhost:1337 why and how to solve?",
"I want to grab data from a website every 15 minutes and save it in a database. The code nodejs \n with XmlHttpRequest works but is also opening website localhost:1337 (with error not availiable and\n permission denied).\n question, why is the website opened, and can I solve it?\n are there perhaps other possiblities to grab data from website, for instance if data changes on \n website then nodejs receives marks that wbsite changed and runs?\n\nMy code:\n---\nvar XMLHttpRequest = require('node-http-xhr');\nvar mysql = require('mysql');\nvar request = require(\"request\");\n\nvar con = mysql.createConnection({\nhost: \"localhost\", user: \"pieter\", password: \"XXX\", database: \"test\"\n});\nconsole.log('Testing');\nsetInterval(function () {\n\nvar xmlhttp = new XMLHttpRequest();\nxmlhttp.onreadystatechange = function () {\nif (this.readyState == 4 && this.status == 200) {\n var body = JSON.parse(this.responseText);\n console.log(body.dht22.temperature);\n var sql = \"INSERT INTO weerdata( binnentemp,binnenvocht, luchtdruk, buitentemp, buitenvocht) \n Values (\" + body.dht22.temperature + \",\" + body.dht22.humidity + \",\" + body.dht22.pressure + \",\" \n + body.dataWV.tempPJ + \",\" + body.dataWV.lvPJ + \")\";\n con.query(sql, function (err, result) {\n if (err) throw err;\n console.log(\"1 record inserted\");\n });\n }\n};\nxmlhttp.open('GET', 'http://192.168.192.36/json', true);\nxmlhttp.send();\n}, 90000);\n\n---"
] | [
"node.js",
"xmlhttprequest"
] |
[
"Unexpected error - MembershipCreateStatus.InvalidQuestion",
"I try to create user without passwordQuestion and answer. \n\nBut I always get an error \n\n\n MembershipCreateStatus.InvalidQuestion\n\n\nstring question = string.Empty;\nstring answer = string.Empty;\nMembershipUser membershipUser = Membership.CreateUser(user.Login, password, user.ContactInfo.EMail, question, answer, false, out createResult);\n\n\nweb.config\n\n requiresQuestionAndAnswer=\"false\""
] | [
"asp.net",
"security"
] |
[
"Ecrion after rendering from PDF input to TIFF keeps files in use",
"I'm using a webservice to convert from PDF to TIFF using Ecrion Ultrascale, everything works fine except that I've just noticed that the output file(the rendered file) is still in use after conversion is completed, does anyone knows why this is happening and how can I resolve this issue?\n\n[WebMethod]\n public void ConvertPDF2Tiff(string fileName, bool createFolder, string folderName)\n {\n string filename = Path.GetFileNameWithoutExtension(fileName);\n string path = Path.GetDirectoryName(fileName);\n String inFilePath = fileName;\n String outFilePath;\n if (createFolder)\n {\n outFilePath = Path.Combine(path, \"temp\", filename + \".tif\");\n }\n else\n {\n outFilePath = Path.Combine(path, filename + \".tif\");\n }\n Stream outStm = null;\n Directory.CreateDirectory(Path.Combine(path, \"temp\"));\n // Open the out stream\n outStm = new FileStream(outFilePath, FileMode.Create);\n\n // Initialize data source\n Stream sw = File.OpenRead(inFilePath);\n IDataSource input = new XmlDataSource(sw, Engine.InputFormat.PDF);\n\n // Initialize rendering parameters\n RenderingParameters p = new RenderingParameters();\n p.CompressionAlgorithm = Engine.CompressionAlgorithm.LZW;\n p.OutputFormat = Engine.OutputFormat.TIFF;\n\n // Render the TIFF\n Engine eng = new Engine();\n eng.Render(input, outStm, p);\n sw.Close();\n outStm.Close();\n }\n\n\nThanks in advance."
] | [
".net",
"ecrion"
] |
[
"Rhomobile APP VersionCode problem",
"I am trying to upload a test application to AndroidMarket. The deal is that I want to upload APKs for all versions, 1.6,2.0 and so on. But always I get error\n\nThe new apk's versionCode (10000) already exists.\n\nIt seams that always when building RhoHub sets VersionCode 10000.\nHow to fix this problem, and upload to Android Market all versions?"
] | [
"android",
"rhomobile"
] |
[
"Html mail form doesn't send mail",
"im having some problems with this form:\n\n<form action=\"mailto:[email protected]\" method=\"post\" enctype=\"text/plain>\n <div class=\"field half first\">\n <label for=\"fname\">Pénom</label>\n <input name=\"fname\" id=\"fname\" type=\"text\" placeholder=\"Veuillez insérer votre prénom\" required>\n </div>\n <div class=\"field half first\">\n <label for=\"name\">Nom</label>\n <input name=\"name\" id=\"name\" type=\"text\" placeholder=\"Veuillez insérer votre nom\" required>\n </div>\n <div class=\"field half first\">\n <label for=\"email\">Email</label>\n <input name=\"email\" id=\"email\" type=\"email\" placeholder=\"Veuillez insérer votre email\" required>\n </div>\n <div class=\"field half first\">\n <label for=\"phone\">Téléphone (portable)</label>\n <input name=\"phone\" id=\"phone\" type=\"text\" placeholder=\"Veuillez insérer votre téléphone portable\" required>\n </div>\n <div class=\"field half first\">\n <label for=\"dept\">Department</label>\n <div class=\"select-wrapper\">\n <select name=\"dept\" id=\"dept\">\n <option value=\"1\">Maintenance</option>\n <option value=\"1\">Administration</option>\n <option value=\"1\">Ressources humaines</option>\n </select>\n </div>\n </div>\n <div class=\"field\">\n <label for=\"message\">Message</label>\n <textarea name=\"message\" id=\"message\" rows=\"6\" placeholder=\"Veuillez insérer votre message, notre équipe sera ravie de vous répondre au plus vite !\" required/>\n </div>\n <ul class=\"actions align-center\">\n <li>\n <input value=\"Envoyer ;)\" class=\"button special\" type=\"submit\">\n </li>\n </ul>\n</form>\n\n\nIt just DOESNT send mails, i have tried many different methods but it stills not working. can someone help me? im just starting at this."
] | [
"html",
"forms",
"email"
] |
[
"Splitting by consecutive delimiter in text file",
"I have a text file:\n\nJohn|Hopkins|||31\nSage|Jen|42\n\n\nAnd I want to read it into python and split by ‘|’\n\nSo I want something like:\n\n[['John', 'Hopkins', '31'], ['Sage', 'Jen', '42']]\n\nfile = open('mytxt.txt', 'r')\nfile_2 = file.readlines()\n\nlst=[]\nfor line in file_2:\n line=line.strip('\\n')\n line=line.split('|')\n lst.append(line)\nprint(lst)\n\n\nI’m getting:\n\n[['John', 'Hopkins', '', '', '31'], ['Sage', 'Gen', '42']]\n\n\nAs seen, there are '' present in the first list due to consecutive ||.\n\nHow do I modify the split statement to cater for single | and consecutive |||?"
] | [
"python",
"python-3.x"
] |
[
"Regex: match everything before image",
"url1: /dir-images/no1/top-left.gif\nurl2: /test-1/test-2/test\n\nI want to match the path before the last slash if it is an image file(url1), aka /dir-images/no1/\nand match the whole path if it is not(url2), /test-1/test-2/test\n\ntried ^([\\=\\/\\.\\w-]+\\/)+ this could get path before the last slash no matter what is after it.."
] | [
"regex",
"inverse"
] |
[
"SBT. How to run node.js package from task?",
"I am trying to run some node.js packages, while building scala project via scala.system.process. Let it be yarn -v.\n\nlazy val ttt = taskKey[Unit](\"Some task\")\nttt := {\n import scala.sys.process._\n\n Seq(\"yarn.cmd\", \"-v\").!\n}\n\n\nOutput:\n\nmodule.js:549\n throw err;\n ^\n\nError: Cannot find module 'C:\\Users\\08407540\\IdeaProjects\\test\\node_modules\\yarn\\bin\\yarn.js'\n at Function.Module._resolveFilename (module.js:547:15)\n at Function.Module._load (module.js:474:25)\n at Function.Module.runMain (module.js:693:10)\n at startup (bootstrap_node.js:188:16)\n at bootstrap_node.js:609:3\n\n\n\n\nBut running from Main method is OK:\n\n\nHow to make SBT run packages, like from scala source code?"
] | [
"scala",
"sbt"
] |
[
"Any Workaround to MKUserTrackingModeFollowWithHeading Bug in iOS6?",
"I'm desperately looking for a workaround to the well documented bug in MapKit in iOS6 that makes MKUserTrackingModeFollowWithHeading effectively unusable at higher magnifications:\n\nThere is a very simple example project [here].(https://dl.dropboxusercontent.com/u/316978/MapKitBug.zip)\n\nSteps to reproduce:\n\n\nTap the MKUserTrackingModeButton to zoom in to your location.\nTap to zoom in closer 2 or 3 times.\nTap MKUserTrackingModeButton to select MKUserTrackingModeFollowWithHeading\n\n\nIssues:\n\nThis mode will not 'stick' and almost always exits after a matter of seconds (1-20). \nThe Blue 'Your Location' Annotation 'vibrates' and seems to move slightly from its central position whilst it's in MKUserTrackingModeFollowWithHeading.\n\nNote that this is increasingly a problem as you zoom in. At the default magnification (which you are taken to when first tapping the MKUserTrackingModeButton Button, it is not so much of a problem.\n\nAn obvious workaround would be to limit zoom level, but unfortunately I need full zoom in my application."
] | [
"ios",
"cocoa-touch",
"mapkit",
"mkusertrackingmode"
] |
[
"Print a list that contains Chinese characters in Python",
"My code looks like :\n\n# -*- coding: utf-8 -*-\n\nprint [\"asdf\", \"中文\"]\nprint [\"中文\"]\nprint \"中文\"\n\n\nThe output in the Eclipse console is very strange:\n\n['asdf', '\\xe4\\xb8\\xad\\xe6\\x96\\x87']\n['\\xe4\\xb8\\xad\\xe6\\x96\\x87']\n中文\n\n\nMy first question is: why did the last line get the correct output, and the others didn't?\n\nAnd my second question is: how do I correct the wrong ones (to make them output real characters instead of the code that begins with \"x\") ? \n\nThank you guys!!"
] | [
"python",
"utf-8",
"character-encoding",
"codepages",
"gbk"
] |
[
"Entity Framework CTP5 and Ninject as my IOC",
"Is it possible in Entity Framework CTP5 to construct retrieved persisted entities via an IOC container?\n\nI'm using Ninject and it's tied in fine with MVC, but I need to inject some services into my domain objects when they are constructed for some business rules.\n\nI'd rather do this using constructor injection than method or property injections."
] | [
"entity-framework",
"ioc-container",
"ninject",
"entity-framework-ctp5"
] |
[
"Display Paragraph with same format(With line Break)",
"I store two paragraphs in sql server in same field. My Problem is while retrieving data from database and display in the report it display both paragraphs as single Paragraph. But while using TextArea it displays good. but Is there any options to display Paragraphs as i stored in HTML"
] | [
"c#",
"html"
] |
[
"Right padding on absolutely positioned scrolling div",
"I have an absolutely positioned parent div who's top, right, bottom and left attributes all equal 0px so that it resizes with the browser. If it's contents exceeds the document width or height then it displays scrollbars (as it should in this application).\n\nThis parent div also has top, right, bottom and left padding of 20px so that there is always a white margin around it's contents.\n\nThis parent contains another div that for test reasons is set to 2000px X 2000px and has a different background colour to the parent.\n\nNow the parents top, bottom and left 20px padding is working fine, but the right padding isn't appearing, which is confusing the hell out of me. This peculiarity is happening across all modern browsers, so it must be something serious I'm missing.\n\n<div id=\"parent\" style=\"position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; padding: 20px; overflow: auto; background-color: #FFFFFF;\">\n\n <div id=\"child\" style=\"width: 2000px; height: 2000px; background-color: #666666;\">\n\n This divs width and height is deliberately set higher than the document/window width to cause the parents scrollbars to appear. \n\n </div>\n\n</div>\n\n\nSo, question is: how can I get the right padding of the parent to apply?"
] | [
"css",
"padding",
"css-position"
] |
[
"Type error when asigning tuple in do notation in haskell",
"This is the haskell code I have:\n\nmyFold:: ([a] -> (b, [a])) -> [a] -> [b]\nmyFold fn [] = []\nmyFold fn lst = do\n (ast, newLst) <- (fn lst)\n myFold fn newLst ++ [ast]\n\n\nI think everybody who knows haskell will get what I want to do. However this code is wrong and I really don't get why. The compiler complains that the types don't match in the line (ast, newLst) <- (fn lst) and I cannot see what's wrong.. Can somebody point me to how the syntax must be? Also I am pretty sure that there are better ways to do this so please feel free to provide alternatives."
] | [
"haskell"
] |
[
"Query CONTAINS not working only selecting where equals",
"Queries using contains have recently stopped working correctly. \nWhen value in source data column is 1,2,3 and the query is WHERE B contains '3'\n\nSee test sheet here:\nhttps://docs.google.com/spreadsheets/d/1tCJBerHOmVfKbtb81JEyWEp6ZYP0EXyJqG-_7zVWpLw/edit?usp=sharing\n\nUpdate\nIt appears that google is now first applying the Number Formatting to the cell then running the QUERY. Ensure your data column is set to PLAIN TEXT."
] | [
"google-sheets-query"
] |
[
"How to Specify a SQL Server Computed Column in TypeORM Entities?",
"I want to create a SQL Server table with computed columns using TypeORM entities, but I could not find computed columns in the TypeORM documentation under the section of column types for mssql.\nHow to set a column type as a computed column in TypeORM entities?\nIf it is not supported yet in TypeORM, is there any workaround? Thank you"
] | [
"node.js",
"sql-server",
"database",
"orm",
"typeorm"
] |
[
"Upgrading Alfresco Enterprise from 3.3.3 to 4.2.x - how do I verify which service packs have been applied?",
"I am considering upgrading Alfresco to the latest version (4.2f) and the image below from Alfresco upgrade paths implies that this is possible.\n\nWe have Alfresco Enterprise version 3.3.3 installed.\n\nHow can I verify that the latest service pack has been applied for 3.3.x? Is there a list somewhere of service packs?"
] | [
"alfresco"
] |
[
"How to set baud rate to high speed on android",
"I am using an android device with built in serial ports, I would like to drive the port at ~3Mb/s, using stty from busybox I have set the speed to 406800b/s but cant get it up to 921600b/s; ./busybox stty -F /dev/ttyS0 921600 returns invalid argument. Typing ./busybox stty -F /dev/ttyS0 returns \n\nspeed 460800 baud;\nintr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;\neol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = \n^W;\nlnext = <undef>; flush = <undef>; min = 1; time = 0;\n-brkint -icrnl -imaxbel\n-isig -icanon -echo\n\n\nI think it should be possible to set it too much higher rates as the /sys/class/tty/ttyS0/uartclk is 104000000 so I think much higher speeds should be possible.\n\nAre there any other ways to set the speed, I have tried microcom but that doesn't actually change the speed despite not returning an error. I have an oscilloscope attached to the serial to confirm the speed."
] | [
"android",
"linux",
"serial-port"
] |
[
"Why is continue making the iteration stop?",
"I don't know why the iteration is stopping once I place a continue. If I replace continue with console.log() it's working fine. What I am trying to do is to return true if all elements are the same, and false otherwise.\n\nfunction isUniform(de) {\n for(var i=0;i<de.length;i++) {\n if (de.indexOf(de[i])===0) {\n continue;\n }\n else {\n return false\n }\n }\n return true;\n}\n\narr =[1,1,1];\nisUniform(arr);"
] | [
"javascript",
"arrays",
"sorting"
] |
[
"get real-time data from iButton to python script",
"I need to develop a Python script that takes temperature and humidity data from the iButton DS1923 in real-time, using Bluetooth. So the idea is to have a real-time plot updated everytime new data is read.\nDoes anyone know if it is possible?\nThanks"
] | [
"python",
"raspberry-pi"
] |
[
"How to get the relative position in set bit",
"For simplicity to express, I assume the warp size is 8.\nI have mask 10110110, returned by __ballot function, like above:\n\nint cond = xxxx ? 1 : 0;\nmask = __ballot(cond);\n\n\nNow, I need the relative position in thread collection which thread satisfy the condition.\n\nIn the example above, the lane id = {1,2,4,5,7} satisfied the condition.\nBut, how to calculate the relative position with mask. For example, I have a function below:\n\nmask = 10110110\nfunction(mask, 1) -> 0\nfunction(mask, 2) -> 1\nfunction(mask, 4) -> 2\nfunction(mask, 5) -> 3\nfunction(mask, 7) -> 4\n\n\nHow to implement this function by bitwise operation ?"
] | [
"c++",
"c",
"cuda",
"bit-manipulation"
] |
[
"How to Change CSS style of the same element that is NOT Hovered",
"HTML\n\n<ul id=\"menu\">\n <li><a href=\"#\">Home</a></li>\n <li><a href=\"#\">Categories</a>\n <ul>\n <li><a href=\"#\">1</a></li>\n <li><a href=\"#\">2</a></li>\n <li><a href=\"#\">3</a></li>\n <li><a href=\"#\">4</a></li>\n </ul>\n </li>\n <li><a href=\"#\">Work</a></li>\n <li><a href=\"#\">About</a></li>\n <li><a href=\"#\">Contact</a></li>\n </ul>\n\n\nCSS\n\n#menu li{\n width:80px;\n}\n#menu li:hover {\n width:200px;\n}\n\n\nI want to set the width of OTHER <li>s THAT ARE NOT HOVERED to 60PX while one of them are Hovered, and then set width back to 80PX when all of them are not hovered.. how Would I do that?"
] | [
"javascript",
"jquery",
"html",
"css"
] |
[
"How to load Google Place Autocomplete after selecting an input field",
"How can I load Google Places Autocomplete after a user selected the input field?\nhttps://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform\n\nI don't want to load it every time a user is visiting my website. I am using jquery and want to \"inject/load\" the google library and my code once a user has selected the input field. How can I do this?\n\nEdit 1:\nThis is my first try to load a script with jquery.\n\n$(document.head).append($('<script>', { src: url }));\n\n\nNot sure if it is working an all browsers."
] | [
"lazy-loading",
"googleplacesautocomplete"
] |
[
"How to change the hover effect for react-bootstrap navbar link?",
"I want to change the hover effect from white to green colour, but I cant sem to find the exact css code for it.\n<Navbar fixed='top' collapseOnSelect expand="md" variant="dark" className="animate-navbar nav-theme justify-content-between">\n <Navbar.Brand href="#home" className='logo'>Anis Agwan</Navbar.Brand>\n <Navbar.Toggle aria-controls="responsive-navbar-nav" />\n <Navbar.Collapse id="responsive-navbar-nav">\n <Nav className="ml-auto">\n <Nav.Link href="#home">Home</Nav.Link>\n <Nav.Link href="#about">About Me</Nav.Link>\n <Nav.Link href="#timeline">Timeline</Nav.Link>\n <Nav.Link href="#projects">Projects</Nav.Link>\n <Nav.Link href="#skills">Skills</Nav.Link>\n <Nav.Link href="#contact">Contact</Nav.Link>\n </Nav>\n </Navbar.Collapse>\n </Navbar>\n\nThis is my CSS part\n.nav-theme {\n background-color: #212121;\n font-size: 20px;\n \n}\n\n.animate-navbar {\n box-shadow: 1px 1px 1px hsla(240, 20%, 8%, 0.973);\n animation: moveDown 0.5s ease-in-out;\n \n}\n\n\n.logo {\n color: #64dd17;\n}"
] | [
"javascript",
"css",
"reactjs",
"react-bootstrap"
] |
[
"Can I bind an attribute to web component?",
"If I have global @observable var myObservable = 'foo'; I can pass it to web component like this:\n\n <x-component my-attribute=\"{{myObservable}}\"></x-component>\n\n\nand it's passed to XComponent.myAttribute before the WebComponent.created() lifecycle method. The problem is when I change the myObservable = 'bar'; the XComponent.myAttribute isn't changed.\n\nIs this type of binding possible somehow? Or is the WebComponent.attributeChanged(...) the key for this (when it's implemented by the Web UI team)?"
] | [
"dart",
"dart-webui"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.