text
stringlengths
74
309k
{"title":"C++ code file extension? .cc vs .cpp","tags":["c++","filenames"],"question_text":"I have seen C++ code saved as both\n`.cc`\nand\n`.cpp`\nfiles. Is there a difference between the two?\nThe\nGoogle style guide\nseems to suggest\n`.cc`\n, but provides no explanation.\nI am mainly concerned with programs on Linu...
{"title":"Calculate the execution time of a method","tags":["c#",".net","timer","io","stopwatch"],"question_text":"Possible Duplicate:\nHow do I measure how long a function is running?\nI have an I\/O time-taking method which copies data from a location to another. What's the best and most real way of calculating the e...
{"title":"How does facebook, gmail send the real time notification?","tags":["comet"],"question_text":"I have read some posts about this topic and the answers are comet, reverse ajax, http streaming, server push, etc.\nHow does incoming mail notification on Gmail works?\nHow is GMail Chat able to make AJAX requests wit...
{"title":"Git merge master into feature branch","tags":["git"],"question_text":"Lets say we have the following situation in git:\nA created repository:\n`mkdir GitTest2\ncd GitTest2\ngit init`\nSome modifications in the master take place and get commited.\n`echo \"On Master\" > file\ngit commit -a -m \"Initial commit\"...
{"title":"How would I get a cron job to run every 30 minutes?","tags":["linux","osx","cron"],"question_text":"I'm looking to add a\n`crontab`\nentry to execute a script every 30 minutes, on the hour and 30 minutes past the hour or something close. I have the following, but it doesn't seem to run on 0.\n`*\/30 * * * *`\...
{"title":"UIRefreshControl without UITableViewController","tags":["objective-c","ios","uitableview","ios6","uirefreshcontrol"],"question_text":"Just curious, as it doesn't immediately seem possible, but is there a sneaky way to leverage the new iOS 6\n`UIRefreshControl`\nclass without using a\n`UITableViewController`\n...
{"title":"What is path of JDK on Mac ?","tags":["osx","java"],"question_text":"Im using Mac only at work and I need to set JAVA_HOME to proper path of JDK. I downloaded JDK, installed it and now I can't find it anywhere. I was looking at the internet for the solution, but there is no folder Libraries\/Java.","answer_te...
{"title":"Ruby ampersand colon shortcut","tags":["ruby"],"question_text":"Possible Duplicate:\nWhat does map(&:name) mean in Ruby?\nIn Ruby, I know that if I do:\n`some_objects.each(&:foo)`\nIt's the same as\n`some_objects.each { |obj| obj.foo }`\nThat is,\n`&:foo`\ncreates the block\n`{ |obj| obj.foo }`\n, turns it in...
{"title":"What is the Liskov Substitution Principle?","tags":["oop","definition","solid-principles","design-principles","lsp"],"question_text":"I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?","answer_text"...
{"title":"Specify an SSH key for git push for a given domain","tags":["git","ssh","gitolite"],"question_text":"I have the following use case: I would like to be able to push to\n`git@git.company.com:gitolite-admin`\nusing the private key of user\n`gitolite-admin`\n, while I want to push to\n`git@git.company.com:some_re...
{"title":"App.Config Transformation for projects which are not Web Projects in Visual Studio 2010?","tags":["visual-studio",".net-4.0","app-config","slowcheetah","web-config-transform"],"question_text":"For Visual Studio 2010 Web based application we have Config Transformation features by which we can maintain multiple...
{"title":"HTTP Test server that accepts GET\/Post calls","tags":["http","post"],"question_text":"I need a live test server that accepts my requests for basic information via HTTP GET and also allows me to POST (even if its really not doing anything). This is entirely for test purposes.\nA good example is\nhere\nit easi...
{"title":"Force \"portrait\" orientation mode","tags":["android","screen","orientation","landscape","portrait"],"question_text":"I'm trying to force the \"portrait\" mode for my application because my application is absolutely not designed for the \"landscape\" mode.\nAfter reading some forums, I added these lines in m...
{"title":"Xcode iOS project only shows \"My Mac 64-bit\" but not simulator or device","tags":["ios","xcode","xcode4"],"question_text":"This just started happening that my iOS project is only showing \"My Mac 64-bit\" rather than the Simulator or my iPhone to build to. I have no idea why this is happening. I do not thin...
{"title":"WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive)","tags":["html","asp.net","visual-studio","word-count"],"question_text":"I'm building a web application using Visual Studio 2012. \nI'm attempting to add word count...
{"title":"How to remove all .svn directories from my application directories","tags":["linux","shell"],"question_text":"One of the missions of an export tool I have in my application, is to clean all\n`.svn`\ndirectories from my application directory tree. I am looking for a recursive command in the Linux shell that wi...
{"title":"In Sublime Text 2, how do I open new files in a new tab?","tags":["osx","sublimetext"],"question_text":"When I'm editing with files on the server, and I click to edit them, if I'm editing multiple files (say an HTML file and a CSS file) but they open in new windows, which, on my small laptop display is a litt...
{"title":"On input change event?","tags":["javascript","jquery","html"],"question_text":"When using jquery\n`.change`\non an\n`input`\nthe event will only be fired when the input loses focus\nIn my case, I need to make a call to the service (check if value is valid) as soon as the input value is changed. How could I ac...
{"title":"How do you keep parents of floated elements from collapsing?","tags":["html","css","layout","css-float"],"question_text":"Although elements like\n`<div>`\ns normally grow to fit their contents, using the\n`float`\nproperty can cause a startling problem for CSS newbies:\nif floated elements have non-floated pa...
{"title":"Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:\/\/\/tmp\/mysql.sock) in","tags":["php","mysql","database"],"question_text":"I'm trying to connect to my MySQL DB with the Terminal on my Apple (With PHP).\nYesterday it worked fine, and now I suddenly get this error (See ...
{"title":"What is the $$hashKey added to my JSON.stringify result","tags":["javascript","jquery","json","angularjs"],"question_text":"I have tried looking on the\nMozilla JSON stringify\npage of their docs as well as here on SO and Google but found no explanation. I have used JSOn stringify many time but never come acr...
{"title":"How to get height of entire document with JavaScript?","tags":["javascript"],"question_text":"Some documents I can't get the height of the document (to position something absolutely at the very bottom). Additionally, a padding-bottom on seems to do nothing on these pages, but do on the pages where height will...
{"title":"Duplicate ID, tag null, or parent id with another fragment for com.google.android.gms.maps.MapFragment","tags":["android","android-fragments","android-maps","illegalargumentexception"],"question_text":"I have an application with three tabs.\nEach tab has its own layout .xml file. The main.xml has its own map ...
{"title":"Making the iPhone vibrate","tags":["ios","cocoa-touch","avfoundation","vibration"],"question_text":"How can the iPhone be set to vibrate once?\nFor example, when a player loses a life or the game is over, the iPhone should vibrate.","answer_text":"From \"\niPhone Tutorial: Better way to check capabilities of ...
{"title":"ViewPager and fragments \u00e2\u0080\u0094 what's the right way to store fragment's state?","tags":["android","design-patterns","android-fragments","android-viewpager"],"question_text":"Fragments seem to be very nice for separation of UI logic into some modules. But along with\n`ViewPager`\nits lifecycle is s...
{"title":"SVG fill color transparency \/ alpha?","tags":["colors","svg","transparency","alpha","fill"],"question_text":"Is it possible to set a transparency or alpha level on SVG fill colours?\nI've tried adding two values to the fill tag (changing it from fill=\"#044B94\" to fill=\"#044B9466\"), but this doesn't work....
{"title":"Detecting arrow key presses in JavaScript","tags":["javascript","keyboard-events"],"question_text":"How do I detect when one of the arrow keys are pressed? I used this to find out:\n`function checkKey(e) {\n var event = window.event ? window.event : e;\n console.log(event.keyCode)\n}`\nThough it worked for ev...
{"title":"'console' is undefined error for Internet Explorer","tags":["javascript","internet-explorer","internet-explorer-8","firebug"],"question_text":"I'm using Firebug and have some statements like:\n`console.log(\"...\");`\nin my page. In IE8 (probably earlier versions too) I get script errors saying 'console' is u...
{"title":"How can I get the Google cache age of any URL or web page?","tags":["html","url","hyperlink","website","web-scraping"],"question_text":"In my project I need the Google cache age to be added as important information. I tried to search sources for the Google cache age, that is, the number of days since Google l...
{"title":"dyld: Library not loaded: @rpath\/libswiftCore.dylib","tags":["ios","xcode","swift"],"question_text":"I am trying to run a Swift app on my iPhone 4s. It works fine on the simulator, and my friend can successfully run it on his iPhone 4s. I have iOS 8 and the official release of Xcode 6.\nI have tried\nRestart...
{"title":"jQuery 1.9 .live() is not a function","tags":["javascript","jquery","function","live","deprecated"],"question_text":"I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the\n`.live()`\nstops working.\nI get the error\n`TypeError: $(...).live is not a function`\n.\nIs there any method I can u...
{"title":"How to run two jQuery animations simultaneously?","tags":["javascript","jquery","animation"],"question_text":"Is it possible to run two animations on two different elements simultaneously? I need the opposite of this question\nJquery queueing animations\n.\nI need to do something like this...\n`$('#first').an...
{"title":"Why does this for loop exit on some platforms and not on others?","tags":["c","debugging","undefined-behavior","buffer-overflow"],"question_text":"I have recently started to learn C and I am taking a class with C as the subject. I'm currently playing around with loops and I'm running into some odd behaviour w...
{"title":"CSS Selector that applies to elements with two classes","tags":["css","css-selectors"],"question_text":"Is there a way to select an element with CSS based on the value of the class attribute being set to two specific classes. For example, let's say I have 3 divs:\n`<div class=\"foo\">Hello Foo<\/div>\n<div cl...
{"title":"Error executing command 'ant' on Mac OS X 10.9 Mavericks when building for Android with PhoneGap\/Cordova","tags":["android","cordova","ant","osx-mavericks"],"question_text":"Today I tried PhoneGap\/Cordova with\nMac OS X Mavericks\n. Building for iOS went just fine, but building for Android wasn't without so...
{"title":"JSON datetime between Python and JavaScript","tags":["javascript","python","json"],"question_text":"I want to send a datetime.datetime object in serialized form from Python using\nJSON\nand de-serialize in JavaScript using JSON. What is the best way to do this?","answer_text":"You can add the 'default' parame...
{"title":"Printing leading 0's in C?","tags":["c","printf"],"question_text":"I'm trying to find a good way to print leading 0's, such as 01001 for a zipcode. While the number would be stored as 1001, what is a good way to do it?\nI thought of using either case statements\/if then to figure out how many digits the numbe...
{"title":"Set the value of a input field with javascript","tags":["javascript","forms","input"],"question_text":"How would you set the default value of a form input text field in JavaScript?","answer_text":"This is one way of doing it:\n`document.getElementById(\"mytext\").value = \"My value\";`","question_code":[],"an...
{"title":"How to escape text for regular expression in Java","tags":["java","regex","escaping"],"question_text":"Does Java have a built-in way to escape arbitrary text so that it can be included in a regular expression? For example, if my users enter \"$5\", I'd like to match that exactly rather than a \"5\" after the ...
{"title":"Encrypting & Decrypting a String in C#","tags":["c#"],"question_text":"What is the most modern (best) way of satisfying the following in C#?\n`string encryptedString = SomeStaticClass.Encrypt(sourceString);\nstring decryptedString = SomeStaticClass.Decrypt(encryptedString);`\nBUT with a minimum of fuss involv...
{"title":"How to detect what .NET Framework versions and service packs are installed?","tags":[".net","installation","version-detection"],"question_text":"A similar question was asked\nhere\n, but it was specific to .NET 3.5. Specifically, I'm looking for the following:\nWhat is the correct way to determine which .NET ...
{"title":"git remote add with other ssh port","tags":["git","ssh","port"],"question_text":"In git, how I can add a remote origin when my host use a different ssh port?\n`git remote add origin ssh:\/\/user@host\/srv\/git\/example`","answer_text":"You can just do this:\n`git remote add origin ssh:\/\/user@host:1234\/srv\...
{"title":"Hide text using css","tags":["css"],"question_text":"I have a tag in my html like this:\n`<h1>My Website Title Here<\/h1>`\nUsing css I want to replace the text with my actual logo. I've got the logo there no problem via resizing the tag and putting a background image in via css. However, I can't figure out h...
{"title":"HTML colspan in CSS","tags":["css"],"question_text":"I'm trying to construct a layout similar to the following:\n`+---+---+---+\n| | | |\n+---+---+---+\n| |\n+-----------+`\nwhere the bottom is filling the space of the upper row.\nIf this were an actual table, I could easily accomplish this with\n`<td colspan...
{"title":"How to check if the URL contains a given string?","tags":["javascript","jquery","url"],"question_text":"How could I do something like this:\n`<script type=\"text\/javascript\">\n$(document).ready(function () {\n if(window.location.contains(\"franky\")) \/\/ This doesn't work, any suggestions?\n {\n alert(\"yo...
{"title":"Check a collection size with JSTL","tags":["java","jsp","jstl"],"question_text":"How can I check the size of a collection with JSTL?\nSomething like:\n`<c:if test=\"${companies.size() > 0}\">\n<\/c:if>`","answer_text":"From:\nhttp:\/\/java.sun.com\/products\/jsp\/jstl\/1.1\/docs\/tlddocs\/fn\/tld-summary.html...
{"title":"Listview Scroll to the end of the list after updating the list","tags":["android","listview","scroll"],"question_text":"I would like to make sure that the list is scrolled all the way to the bottom, after I have updated the listview by using listAdapter, so that it displays the last element entered in the lis...
{"title":"Calling C\/C++ from python?","tags":["c++","python","c"],"question_text":"What would be the quickest way to construct a python binding to a C or C++ library?\n(using windows if this matters)","answer_text":"I like\nctypes\na lot,\nswig\nalways tended to give me\nproblems\n. Also ctypes has the advantage that ...
{"title":"In PHP, how do you change the key of an array element?","tags":["php","arrays","associative-array"],"question_text":"I have an associative array in the form\n`key => value`\nwhere key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a coun...
{"title":"How to check if PHP array is associative or sequential?","tags":["php","arrays"],"question_text":"PHP treats all arrays as associative, so there aren't any built in functions. Can anyone recommend a fairly efficient way to check if an array contains only numeric keys?\nBasically, I want to be able to differen...
{"title":"How to read lines of a file in Ruby","tags":["ruby","line-endings"],"question_text":"I was trying to use the following code to read lines from a file. But when reading a\nfile\n, the contents are all in one line:\n`line_num=0\nFile.open('xxx.txt').each do |line|\n print \"#{line_num += 1} #{line}\"\nend`\nBut...
{"title":"Shortcut to Apply a Formula to an Entire Column in Excel","tags":["excel","excel-formula"],"question_text":"If I select a cell containing a formula, I know I can drag the little box in the right-hand corner downwards to apply the formula to more cells of the column. Unfortunately, I need to do this for 300,00...
{"title":"How to get xdebug var_dump to show full object\/array","tags":["php","xdebug"],"question_text":"I am using\nxdebug\n(php_xdebug-2.1.2-5.3-vc9.dll) on\nWAMP\n. When I use\n`var_dump`\non a large object or variable it does not show the full variable.\n`array\n'node' => \n array\n 'my_form' => \n array\n 'form' ...
{"title":"How to change title of Activity in Android?","tags":["android","android-activity"],"question_text":"I am using\n`Window w = getWindow();\nw.setTitle(\"My title\");`\nto change title of my current Activity but it does not seem to work.\nCan anyone guide me on how to change this?","answer_text":"Try setTitle by...
{"title":"receiver type *** for instance message is a forward declaration","tags":["iphone","ios","objective-c","forward-declaration"],"question_text":"In my iOS5 app, I have\n`NSObject`\n`States`\nclass, and trying to init it:\n`states = [states init];`\nhere is\n`init`\nmethod in\n`States`\n:\n`- (id) init\n{\n if ((...
{"title":"How to get the name of the current method from code","tags":["c#","introspection"],"question_text":"I know you can do\n`this.GetType().FullName`\nEdit courtesy of @Pasi Savolainen\nTo get\nMy.Current.Class\nBut what can I call to get\nMy.Current.Class.CurrentMethod","answer_text":"Call\n`System.Reflection.Met...
{"title":"Resizing an image in an HTML5 canvas","tags":["javascript","html5","canvas","image-resizing"],"question_text":"I'm trying to create a thumbnail image on the client side using javascript and a canvas element, but when I shrink the image down, it looks terrible. It looks as if it was downsized in photoshop with...
{"title":"Merge, update, and pull Git branches without using checkouts","tags":["git","git-merge","git-pull","git-checkout"],"question_text":"I work on a project that has 2 branches, A and B. I typically work on branch A, and merge stuff from branch B. For the merging, I would typically do:\n`git merge origin\/branchB`...
{"title":"Where are my postgres *.conf files?","tags":["postgresql","configuration","ubuntu-8.04"],"question_text":"I have recently reinstalled postgresql 8.3 on my Ubuntu 8.04 after update. Used EnterpriseDB package. I can connect to the database locally, I see system DB postgres but I can't configure it because I can...
{"title":"jQuery UI DatePicker to show month year only","tags":["jquery","jquery-ui","date","jquery-ui-datepicker"],"question_text":"I am using jQuery date picker to display the calendar all over my app. I want to know if I can use it to display the month and year (May 2010) and not the calendar?","answer_text":"Here's...
{"title":"Why doesn't JUnit provide assertNotEquals methods?","tags":["java","junit","assert"],"question_text":"Does anybody know why JUnit 4 provides\n`assertEquals(foo,bar)`\nbut not\n`assertNotEqual(foo,bar)`\nmethods?\nIt provides\n`assertNotSame`\n(corresponding to\n`assertSame`\n) and\n`assertFalse`\n(correspondi...
{"title":"What's the opposite of 'make install', ie. how do you uninstall a library in Linux?","tags":["makefile","uninstall"],"question_text":"While running\n`.\/configure --prefix=\/mingw`\non a MinGW\/MSYS system for a library I had previously run\n`'.\/configure --prefix=\/mingw && make && make install'`\nI came ac...
{"title":"How to debug JavaScript\/jQuery event bindings with Firebug (or similar tool)","tags":["javascript","jquery","javascript-events","event-handling","firebug"],"question_text":"I need to debug a web application that uses jQuery to do some fairly complex and messy\nDOM\nmanipulation. At one point, some of the eve...
{"title":"How do you create a read-only user in PostgreSQL","tags":["postgresql"],"question_text":"I'd like to create a user in PostgreSQL that can only do SELECTs from a particular database. In MySQL the command would be...\n`GRANT SELECT ON mydb.* TO 'xxx'@'%' IDENTIFIED BY 'yyy';`\nWhat is the equivalent command or ...
{"title":"How can you detect the version of a browser?","tags":["javascript","browser","version","browser-detection"],"question_text":"I've been searching around for code that would let me detect if the user visiting the website has Firefox 3 or 4. All I have found is code to detect the type of browser but not the vers...
{"title":"Replace \\n with actual new line in Sublime Text","tags":["sublimetext2","sublimetext","sublimetext3"],"question_text":"How can I replace\n`\\n`\nin Sublime Text with real in-editor displayed new line so:\n`foo\\nbar`\nbecomes:\n`foo\nbar`\nin the editor when I view the file in it.","answer_text":"Turn on Reg...
{"title":"Android toolbar center title and custom font","tags":["android","android-toolbar"],"question_text":"I'm trying to figure out the right way to use a custom font for the toolbar title, and center it in the toolbar (client requirement).\nAt the moment, i'm using the good old ActionBar, and I was setting the titl...
{"title":"In Java, how do I parse XML as a String instead of a file?","tags":["java","xml","string","file","parsing"],"question_text":"I have the following code:\n`DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xmlFile);`\nHow can I get it to parse XML contained within a String instead of a file?","ans...
{"title":"Can I apply the required attribute to <select> fields in HTML5?","tags":["javascript","html5","select","required"],"question_text":"How can I check if a user has selected something from a\n`<select>`\nfield in HTML5?\nI see\n`<select>`\ndoesn't support the new\n`required`\nattribute... do I have to use JavaSc...
{"title":"How do you do relative time in Rails?","tags":["ruby-on-rails","ruby"],"question_text":"I'm writing a Rails application, but can't seem to find how to do relative time, i.e. if given a certain Time class, it can calculate \"30 seconds ago\" or \"2 days ago\" or if it's longer than a month \"9\/1\/2008\", etc....
{"title":"Assignment operators in R: '=' and '<-'","tags":["r","assignment-operator","r-faq"],"question_text":"What are differences in the assignment operators '=' and '<-' in R? I know that operators are slightly different as this example shows\n`x <- y <- 5\nx = y = 5\nx = y <- 5\nx <- y = 5\n# Error in (x <- y) = 5 ...
{"title":"when to use StringBuilder in java","tags":["java","string","performance"],"question_text":"It is supposed to be generally preferable to use a\n`StringBuilder`\nfor string concatenation in Java. Is this always the case?\nWhat I mean is this: Is the overhead of creating a\n`StringBuilder`\nobject, calling the\n...
{"title":"How to count total lines changed by a specific author in a Git repository?","tags":["git"],"question_text":"Is there a command I can invoke which will count the lines changed by a specific author in a Git repository? I know that there must be ways to count the number of commits as Github does this for their I...
{"title":"Upgrading Node.js to latest version","tags":["node.js","upgrade"],"question_text":"So, I have Node.js installed and now when I tried to install Mongoosejs I got an error telling me that I don't have the needed version of Node.js (I have v0.4.11 and v0.4.12 is needed).\nHow can I upgrade to this version? I sup...
{"title":"Clicking URLs opens default browser","tags":["android","url","android-webview","android-websettings"],"question_text":"I have loaded an external URL in my\n`WebView`\n. Now what I need is that when the user clicks on the links on the page loaded, it has to work like a normal browser and open the link in the s...
{"title":"C# generics syntax for multiple type parameter constraints","tags":["c#","generics"],"question_text":"Possible Duplicate:\nGeneric methods and multiple constraints\nI need a generic function that has two type constraints, each inheriting from a different base class. I know how to do this with one type:\n`void...
{"title":"Make iframe automatically adjust height according to the contents without using scrollbar?","tags":["html","iframe","height","scrollbar"],"question_text":"For example:\n`<iframe name=\"Stack\" src=\"http:\/\/stackoverflow.com\/\" width=\"740\"\n frameborder=\"0\" scrolling=\"no\" id=\"iframe\"> ...\n<\/iframe...
{"title":"Default value of Boolean in java","tags":["java","boolean","default-value"],"question_text":"Possible Duplicate:\nWhy is Java's default value for Boolean set to true?\nWhat is the default value of\n`Boolean`\n(primitive wrapper) in Java?","answer_text":"The default value any Object reference is\n`null`\nThe d...
{"title":"Are PHP short tags acceptable to use?","tags":["php","coding-style","php-shorttags"],"question_text":"Here's the information\naccording to the official documentation\n:\nThere are four different pairs of\n opening and closing tags which can be\n used in PHP. Two of those,\n`<?php ?>`\nand\n`<script language=\...
{"title":"jquery set checkbox checked","tags":["jquery","checkbox"],"question_text":"I already tried all the possible ways, but I still didn't get it working.\nI have a modal window with a\n`checkbox`\nI want that when the modal opens, the\n`checkbox`\ncheck or uncheck should be based on a database value. (I have that ...
{"title":"How do you kill all current connections to a SQL Server 2005 database?","tags":["sql-server","sql-server-2005"],"question_text":"I want to rename a database, but keep getting the error that 'couldn't get exclusive lock' on the database, which implies there is some connection(s) still active.\nHow can I kill a...
{"title":"Finding the direction of scrolling in a UIScrollView?","tags":["iphone","ios","cocoa-touch","uiscrollview"],"question_text":"I have a\n`UIScrollView`\nwith only horizontal scrolling allowed, and I would like to know which direction (left, right) the user scrolls. What I did was to subclass the\n`UIScrollView`...
{"title":"Deserialize json object into dynamic object using Json.net","tags":["c#",".net","json.net"],"question_text":"Is it possible to return a dynamic object from a json deserialization using json.net? I would like to do something like this:\n`dynamic jsonResponse = JsonConvert.Deserialize(json);\nConsole.WriteLine(...
{"title":"Android timer? How?","tags":["android","timer"],"question_text":"Can someone get a simple example of updating textfield every second or so?\nI want to make a flying ball and need to calculate the ball coordinates every second, that's why I need some sort of timer.\nI don't get anything from\nhere\n.","answer_...
{"title":"AngularJs ReferenceError: $http is not defined","tags":["angularjs","javascript-framework","angular-http"],"question_text":"I have the following angular function\n`$scope.updateStatus = function(user){ \n $http({\n url: user.update_path, \n method: \"POST\",\n data: {user_id: user.id, draft: true}\n });\n};`\...
{"title":"How to set value of input text using jQuery","tags":["javascript","jquery","html","asp.net-mvc-3"],"question_text":"I have an input text which is this:\n`<div class=\"editor-label\">\n @Html.LabelFor(model => model.EmployeeId, \"Employee Number\")\n<\/div>\n<div class=\"editor-field textBoxEmployeeNumber\">\n...
{"title":"Initializing a static std::map<int, int> in C++","tags":["c++","stdmap"],"question_text":"What is the right way of initializing a static map? Do we need a static function that will initialize it?","answer_text":"Using C++11:\n`#include <map>\nusing namespace std;\nmap<int, char> m = {{1, 'a'}, {3, 'b'}, {5, '...
{"title":"Getting exact error type in from DbValidationException","tags":[".net","entity-framework","entity-framework-4.1","ef-code-first"],"question_text":"I have the situation where I'm initializing my model in DatabaseInitializer() for EF 4.1 and get this annoying error\n`\"Validation failed for one or more entities...
{"title":"How do I add a property to a JavaScript Object using a variable as the name?","tags":["javascript"],"question_text":"I'm pulling items out of the DOM with jQuery and want to set a property on an object using the id of the DOM element. For example:\n`obj = {};\njQuery(itemsFromDom).each(function() {\n element ...
{"title":"Should composer.lock be committed to version control?","tags":["git","version-control","composer-php"],"question_text":"I'm a little confused with\n`composer.lock`\nused in an application with a repository.\nI saw many people saying that we should not\n`.gitignore`\n`composer.lock`\nfrom the repository.\nBut ...
{"title":"How do you launch the JavaScript debugger in Google Chrome?","tags":["javascript","google-chrome","debugging","google-chrome-devtools"],"question_text":"When using Google Chrome, I want to debug some JavaScript code. How can I do that?","answer_text":"Try adding this to your source:\n`debugger;`\nIt works in ...
{"title":"How do I create a SHA1 hash in ruby?","tags":["ruby","hash","sha1"],"question_text":"SHA Hash functions","answer_text":"`require 'digest\/sha1'\nDigest::SHA1.hexdigest 'foo'`","question_code":[],"answer_code":["require 'digest\/sha1'\nDigest::SHA1.hexdigest 'foo'\n"],"retrieval_text":"\n### TITLE:\nHow do I c...
{"title":"jQuery's .click - pass parameters to user function","tags":["jquery","function","parameter-passing"],"question_text":"I am trying to call a function with parameters using jQuery's .click, but I can't get it to work.\nThis is how I want it to work:\n`$('.leadtoscore').click(add_event('shot'));`\nwhich calls\n`...
{"title":"Android emulator doesn't take keyboard input - SDK tools rev 20","tags":["android","android-emulator"],"question_text":"I've upgraded the SDK tools to revision 20 (from 18) and since the upgrade, the emulator doesn't seem to accept input from laptop's keyboard. But only using the emulator's own 'soft' keyboar...
{"title":"Xamarin 2.0 vs Appcelerator Titanium vs PhoneGap","tags":["cordova","titanium","xamarin","appcelerator"],"question_text":"After all IDE evolutions (all platforms on topic are changed) of this year, i'm looking to understand what is the state of technology for those platforms.\nWhat are strengths and weaknesse...
{"title":"Is Ruby pass by reference or by value?","tags":["ruby-on-rails","ruby","pass-by-reference"],"question_text":"`@user.update_languages(params[:language][:language1], \n params[:language][:language2], \n params[:language][:language3])\nlang_errors = @user.errors\nlogger.debug \"--------------------LANG_ERRORS---...
{"title":"What is the difference between i++ and ++i?","tags":["c#"],"question_text":"I've seen them both being used in numerous pieces of C# code, and I'd like to know when to use\n`i++`\nor\n`++i`\n(\n`i`\nbeing a number variable like\n`int`\n,\n`float`\n,\n`double`\n, etc). Anyone who knows this?","answer_text":"The...
{"title":"How to install python3 version of package via pip on Ubuntu?","tags":["python","ubuntu","python-3.x","ubuntu-12.04","pip"],"question_text":"I have both\n`python2.7`\nand\n`python3.2`\ninstalled in\n`Ubuntu 12.04`\n.\nThe symbolic link\n`python`\nlinks to\n`python2.7`\n.\nWhen I type:\n`sudo pip install packag...
{"title":"How to insert Tab character when expandtab option is ON in VIM","tags":["vim"],"question_text":"When I'm in INSERT mode and I have expandtab option switched on pressing tab results in inserting configured number of spaces.\nBut occasionally I want to insert tab character itself.\nDo you know how to do this?",...
{"title":"How to delete a localStorage item when the browser window\/tab is closed?","tags":["javascript","jquery","html5","local-storage"],"question_text":"My Case: localStorage with key + value that should be deleted when browser is closed and not single tab.\nPlease see my code if its proper and what can be improved...