text
stringlengths
74
309k
{"title":"Is there any difference between a GUID and a UUID?","tags":["guid","uuid"],"question_text":"I see these 2 acronyms thrown around, and I was wondering if there are any differences between a GUID and a UUID?","answer_text":"The\nsimple answer\nis:\nno difference\n, they are the same thing. Treat them as a 16 by...
{"title":"How to print out the method name and line number and conditionally disable NSLog?","tags":["objective-c","cocoa","cocoa-touch","xcode","nslog"],"question_text":"I'm doing a presentation on debugging in Xcode and would like to get more information on using NSLog efficiently.\nIn particular, I have two question...
{"title":"AJAX request return 200 OK but error event is fired instead of success","tags":["javascript","jquery","asp.net","ajax","json"],"question_text":"I have implemented an AJAX request on my website which I am calling from a webpage. It always returns\n200 OK\nbut jQuery executes the error event. I tried a lot of t...
{"title":"HTML Input=\"file\" Accept Attribute File Type (CSV)","tags":["html","csv","file-upload","input","content-type"],"question_text":"I was hoping someone can help me out.\nI have a file upload object on my page:\n`<input type=\"file\" ID=\"fileSelect\" \/>`\nwith the following excel files on my desktop:\nfile1.x...
{"title":"How to break out of jQuery each Loop","tags":["jquery","loops"],"question_text":"How do I break out of a jQuery\n`each`\nloop?\nI have tried:\n`return false;`\nIn the loop but this did not work. Any ideas?","answer_text":"To\n`break`\na\n`$.each`\nloop, you have to return\n`false`\nin the loop callback.\nRetu...
{"title":"What is the difference between a deep copy and a shallow copy?","tags":["language-agnostic","copy","deep-copy","shallow-copy"],"question_text":"What is the difference between a deep copy and a shallow copy?","answer_text":"Breadth vs Depth; think in terms of a tree of references with your object as the root n...
{"title":"How does Facebook Sharer select Images and other metadata when sharing my URL?","tags":["facebook","opengraph","facebook-sharer"],"question_text":"When using Facebook Sharer, Facebook will offer the user the option of using 1 of a few images pulled from the source as a preview for their link. How are these im...
{"title":"Why is [] faster than list()?","tags":["python","performance","list","instantiation","literals"],"question_text":"I recently compared the processing speeds of\n`[]`\nand\n`list()`\nand was surprised to discover that\n`[]`\nruns\nmore than three times faster\nthan\n`list()`\n. I ran the same test with\n`{}`\na...
{"title":"How can I get last characters of a string using JavaScript","tags":["javascript"],"question_text":"I have\n`var id=\"ctl03_Tabs1\";`\nUsing JavaScript, how might I get the last five characters or last character?","answer_text":"You'll want to use the Javascript string method\n`.substr()`\ncombined with the\n`...
{"title":"How to convert std::string to lower case?","tags":["c++","string","c++-standard-library"],"question_text":"I want to convert a\n`std::string`\nto lowercase. I am aware of the function\n`tolower()`\n, however in the past I have had issues with this function and it is hardly ideal anyway as use with a string wo...
{"title":"Propagate all arguments in a bash shell script","tags":["bash","scripting"],"question_text":"I am writing a very simple script that calls another script, and I need to propagate the parameters from my current script to the script I am executing.\nFor instance, my script name is\n`foo.sh`\nand calls\n`bar.sh`\...
{"title":"Escape string for use in Javascript regex","tags":["javascript","regex","escaping"],"question_text":"Possible Duplicate:\nIs there a RegExp.escape function in Javascript?\nI am trying to build a javascript regex based on user input:\nfunction FindString(input) {\n var reg = new RegExp('' + input + '');\n \/\/...
{"title":"JavaScript variable number of arguments to function","tags":["javascript","function","arguments","argument-passing"],"question_text":"Is there a way to allow \"unlimited\" vars for a function in JavaScript?\nExample:\n`load(var1, var2, var3, var4, var5, etc...)\nload(var1)`","answer_text":"Sure, just use the\...
{"title":"JQuery .each() backwards","tags":["javascript","jquery","arrays","reverse"],"question_text":"I'm using JQuery to select some elements on a page and then move them around in the DOM. The problem I'm having is I need to select all the elements in the reverse order that JQuery naturally wants to select them. For...
{"title":"jQuery\/JavaScript to replace broken images","tags":["javascript","jquery","html","brokenimage"],"question_text":"I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser.\nHow do I use jQuery to get the set of images, filte...
{"title":"git replacing LF with CRLF","tags":["git"],"question_text":"Running git on a Windows XP machine, using bash. I exported my project from SVN, and then cloned a bare repository.\nI then pasted the export into the bare repositories directory, and did a:\n`git add -A`\nI then got a list of messages saying:\nLF wi...
{"title":"What is the difference between the `COPY` and `ADD` commands in a Dockerfile?","tags":["docker"],"question_text":"What is the difference between the\n`COPY`\nand\n`ADD`\ncommands in a Dockerfile, and when would I use one over the other?\n`COPY <src> <dest>`\nThe COPY instruction will copy new files from\n`<sr...
{"title":"Managing CSS Explosion","tags":["css","organization"],"question_text":"I have been heavily relying on CSS for a website that I am working on. Right now, all the CSS styles are being applied on a per tag basis, and so now I am trying to move it to more of an external styling to help with any future changes.\nB...
{"title":"What's the simplest way to git a list of conflicted files?","tags":["git","git-merge","git-conflict-resolution"],"question_text":"I just need a plain list of conflicted files.\nIs there anything simpler than:\n`git ls-files -u | cut -f 2 | sort -u`\nor\n`git ls-files -u | awk '{print $4}' | sort | uniq`\n?\nI...
{"title":"How to 'insert if not exists' in MySQL?","tags":["php","sql","mysql","performance","primary-key"],"question_text":"I started by googling, and found this\narticle\nwhich talks about mutex tables.\nI have a table with ~14 million records. If I want to add more data in the same format, is there a way to ensure t...
{"title":"Rename a file in C#","tags":["c#","file","rename"],"question_text":"How do I rename a file using C#?","answer_text":"Take a look at\nSystem.IO.File.Move\n, \"move\" the file to a new name.\n`System.IO.File.Move(\"oldfilename\", \"newfilename\");`","question_code":[],"answer_code":["System.IO.File.Move(\"oldfi...
{"title":"jQuery get textarea text","tags":["javascript","jquery","ajax"],"question_text":"Recently I have started playing with jQuery, and have been following a couple of tutorials. Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were able to make a 'console' on my w...
{"title":"Fragment MyFragment not attached to Activity","tags":["android","android-fragments","actionbarsherlock"],"question_text":"I've created a small test app which represents my problem.\nI'm using ActionBarSherlock to implement tabs with (Sherlock)Fragments.\nMy code:\n`TestActivity.java`\n`public class TestActivi...
{"title":"How to build a query string for a URL in C#?","tags":["c#",".net","url","query-string"],"question_text":"A common task when calling web resources from a code is building a query string to including all the necessary parameters. While by all means no rocket science, there are some nifty details you need to tak...
{"title":"How to open a Bootstrap modal window using jQuery?","tags":["javascript","jquery","twitter-bootstrap"],"question_text":"I'm using Twitter's Bootstrap modal window functionality. When someone clicks submit on my form, I want to show the modal window upon clicking the \"submit button\" in the form.\n`<form id=\...
{"title":"How can I make a method return an argument that was passed to it?","tags":["java","mockito"],"question_text":"Consider a method signature like:\n`public String myFunction(String abc);`\nCan Mockito help return the same string that the method received?","answer_text":"You can create an Answer in Mockito. Let's...
{"title":"parse float with two decimal places","tags":["javascript"],"question_text":"I have the following code. I would like to have it such that if price_result equals an integer, let's say 10, then I would like to add two decimal places. So 10 would be 10.00.\nOr if it equals 10.6 would be 10.60. Not sure how to do ...
{"title":"Difference between malloc and calloc?","tags":["c","malloc","calloc"],"question_text":"What is the difference between doing:\n`ptr = (char **) malloc (MAXELEMS * sizeof(char *));`\nor:\n`ptr = (char **) calloc (MAXELEMS, sizeof(char*));`\nWhen is it a good idea to use calloc over malloc or vice versa?","answe...
{"title":"How to determine if a type implements an interface with C# reflection","tags":["c#","reflection","interface"],"question_text":"Does\nreflection\nin\n`C#`\noffer a way to determine if some given\n`System.Type`\ntype models some interface?\n`public interface IMyInterface {}\npublic class MyType : IMyInterface {...
{"title":"Finding the number of days between two dates","tags":["php"],"question_text":"How to find number of days between two dates using PHP?","answer_text":"`$now = time(); \/\/ or your date as well\n$your_date = strtotime(\"2010-01-01\");\n$datediff = $now - $your_date;\necho floor($datediff \/ (60 * 60 * 24));`","...
{"title":"Correct way to add external jars (lib\/*.jar) to an IntelliJ IDEA project","tags":["java","intellij-idea"],"question_text":"When creating a new Java project in IntelliJ IDEA, the following directories and files are created:\n`.\/projectname.iml\n.\/projectname.ipr\n.\/projectname.iws\n.\/src\/`\nI want to con...
{"title":"Failure [INSTALL_FAILED_ALREADY_EXISTS] when I tried to update my application","tags":["android","install"],"question_text":"when I tried to update my applcation with new version that has same signature as previous one, shows above error.\nWhat I am missing?","answer_text":"If you install the application on y...
{"title":"How can I use Python to get the system hostname?","tags":["python","hostname"],"question_text":"I'm writing a chat program for a local network. I would like be able to identify computers and get the user-set computer name with Python.","answer_text":"Use\n`socket`\nand its\n`gethostname()`\nfunctionality. Thi...
{"title":"New self vs. new static","tags":["php","static","late-static-binding"],"question_text":"I am converting a PHP 5.3 library to work on PHP 5.2. The main thing standing in my way is the use of late static binding like\n`return new static($options);`\n, if I convert this to\n`return new self($options)`\nwill I ge...
{"title":"How can I tell if I'm running in 64-bit JVM or 32-bit JVM (from within a program)?","tags":["java","jvm","jni","64bit","32-bit"],"question_text":"How can I tell if the JVM my application runs in is 32 bit or 64-bit? Specifically, what function or preference do I access to detect this within the program?","ans...
{"title":"How do I escape a single quote in SQL Server?","tags":["sql","sql-server","sql-server-2005","tsql"],"question_text":"I'm trying to insert some text data into a table in SQL Server 9.\nThe text includes a single quote.\nHow do I escape that?\nI tried using two single quotes, but it threw me some errors.\neg.\n...
{"title":"JavaScript: location.href to open in new window\/tab?","tags":["javascript"],"question_text":"I have a JavaScript file from a third party developer. It has a has link which replaces the current page with the target. I want to have this page opened in a new tab.\nThis is what I have so far:\n`if (command == 'l...
{"title":"\"Find next\" in vim","tags":["vim","editing"],"question_text":"To search forward in vim for\n`cake`\n, I'd type\n`\/cake`\n, but the cursor jumps to the first match when I press return.\nIs there a vim command analogous to \"find next\"?","answer_text":"It is\nn\nfor next and\nN\nfor previous.\nAnd if you us...
{"title":"Multiple line code example in Javadoc comment","tags":["java","html","javadoc"],"question_text":"I have a small code example I want to include in the Javadoc comment for a method.\n`\/**\n * -- ex: looping through List of Map objects --\n * <code>\n * for (int i = 0; i < list.size(); i++) {\n * Map map = (Map...
{"title":"Fixing \"The breakpoint will not currently be hit. No symbols have been loaded for this document.\"","tags":["c#",".net","visual-studio","debugging","breakpoints"],"question_text":"C# desktop application on express edition. Worked then didn't work 5 seconds later.\nI tried the following.\nEnsure debug configu...
{"title":"What is TypeScript and why would I use it in place of JavaScript?","tags":["javascript","typescript"],"question_text":"Can you please describe what the TypeScript language is?\nWhat can it do that JavaScript or available libraries cannot do, that would give me reason to consider it?","answer_text":"1000ft vie...
{"title":"JavaScript: min & max Array values?","tags":["javascript"],"question_text":"How can I easily obtain the min and max values from a JavaScript Array?\nExample code:\n`var arr = [100, 0, 50];\n\/\/ something like (but it doesn't have to be)\narr.min(); \/\/ return 0\narr.max(); \/\/ return 100`","answer_text":"H...
{"title":"Copy tables from one database to another in SQL Server","tags":["sql","sql-server","copy","migrate","database-table"],"question_text":"I have a database called foo and a database called bar. I have a table in foo called tblFoobar that I want to move (data and all) to database bar from database foo. What is th...
{"title":"PHP: show a number to 2 decimal places","tags":["php","formatting","numbers","rounding","number-formatting"],"question_text":"What's the correct way to round a PHP string to 2 decimal places?\n`$number = \"520\"; \/\/ It's a string from a DB\n$formatted_number = round_to_2dp($number);\necho $formatted_number;...
{"title":"Ineligible Devices section appeared in Xcode 6.x.x","tags":["ios","xcode6"],"question_text":"After installing\nXcode 6\nmy devices moved to greyed-out section\n`Ineligible Devices`\nand I can't select them as deploy target:\nUpdate:\nThis error occurs in all versions of\n`Xcode 6.x.x`\n.\nThere are so many di...
{"title":"UILabel Align Text to center","tags":["ios","text","alignment","uilabel"],"question_text":"How do I align text in\n`UILabel`\n?","answer_text":"From\niOS 6\nand later\n`UITextAlignment`\nis deprecated. use\n`NSTextAlignment`\n`myLabel.textAlignment = NSTextAlignmentCenter;`\nSwift Version\n`myLabel.textAlignm...
{"title":"Java - Convert integer to string","tags":["java","string","numbers","int"],"question_text":"Given a number:\n`int number = 1234;`\nWhich would be the \"best\" way to convert this to a string:\n`String stringNumber = \"1234\";`\nI have tried searching (googling) for an answer but no many seemed \"trustworthy\"...
{"title":"Upgraded to AppCompat v22.1.0 and now getting IllegalArgumentException: AppCompat does not support the current theme features","tags":["android","appcompat"],"question_text":"I've just upgraded my app to use the newly released v22.1.0 AppCompat and I'm now getting the following exception when I open my app.\n...
{"title":"The difference between the 'Local System' account and the 'Network Service' account?","tags":["windows","security"],"question_text":"I have written a Windows service that spawns a separate process. This process creates a COM object. If the service runs under the 'Local System' account everything works fine, b...
{"title":"What's the difference between a POST and a PUT HTTP REQUEST?","tags":["http","post","put"],"question_text":"They both seem to be sending data to the server inside the body, so what makes them different?","answer_text":"HTTP PUT:\nPUT puts a file or resource at a specific URI, and exactly at that URI. If there...
{"title":"What's the purpose of using braces (i.e. {}) for a single-line if or loop?","tags":["c++","c","coding-style","curly-braces","defensive-programming"],"question_text":"I'm reading some lecture notes of my C++ lecturer and he wrote the following:\nUse Indentation \/\/ OK\nNever rely on operator precedence - Alwa...
{"title":"Email validation using jQuery","tags":["jquery","validation"],"question_text":"I'm new to jQuery and was wondering how to use it to validate email addresses.","answer_text":"You can use regular old javascript for that:\n`function isEmail(email) {\n var regex = \/^([a-zA-Z0-9_.+-])+\\@(([a-zA-Z0-9-])+\\.)+([a-...
{"title":"How do you overcome the svn 'out of date' error?","tags":["svn"],"question_text":"I've been attempting move a directory structure from one location to another in Subversion, but I get an\n`Item '*' is out of date`\ncommit error.\nI have the latest version checked out (so far as I can tell).\n`svn st -u`\nturn...
{"title":"compilation warning: no rule to process file for architecture i386","tags":["objective-c","xcode","cocoa-touch","compiler-construction"],"question_text":"How can I resolve this warning?\n`[WARN]warning: no rule to process file '$(PROJECT_DIR)\/MyApp\/MessageCell.h' of type sourcecode.objj.h for architecture i...
{"title":"How to disable an Android button?","tags":["android","layout","button"],"question_text":"I have created a layout that contains two buttons, Next and Previous. In between the buttons I'm generating some dynamic views. So when I first launch the application I want to disable the \"Previous\" button since there ...
{"title":"What non-programming books should programmers read?","tags":["research"],"question_text":"This is a\npoll\nasking the Stackoverflow community what\nnon-programming\nbooks they would recommend to fellow programmers.\nPlease read the following before posting:\nPlease post only\nONE BOOK PER ANSWER\n.\nPlease\ns...
{"title":"How do I get the name of a Ruby class?","tags":["ruby-on-rails","ruby","rails-activerecord"],"question_text":"How can I get the class name from an ActiveRecord object?\nI have:\n`result = User.find(1)`\nI tried:\n`result.class\n# => User(id: integer, name: string ...)\nresult.to_s\n# => #<User:0x3d07cdc>\"`\n...
{"title":"How to get ELMAH to work with ASP.NET MVC [HandleError] attribute?","tags":["asp.net-mvc","logging","elmah"],"question_text":"I am trying to use ELMAH to log errors in my ASP.NET MVC application, however when I use the [HandleError] attribute on my controllers ELMAH doesn't log any errors when they occur.\nAs...
{"title":"Role of Bias in Neural Networks","tags":["artificial-intelligence","machine-learning","neural-network"],"question_text":"I'm aware of the Gradient Descent and the Back-propagation Theorem. What I don't get is: When is using a bias important and how do you use it?\nFor example, when mapping the\n`AND`\nfunctio...
{"title":"SQL join: where clause vs. on clause","tags":["sql","join","where-clause","on-clause"],"question_text":"After reading it, this is\nnot\na duplicate of\nExplicit vs Implicit SQL Joins\n.\nThe answer may be related (or even the same) but the\nquestion\nis different.\nWhat is the difference and what should go in...
{"title":"Why is this program valid? I was trying to create a syntax error","tags":["perl"],"question_text":"I'm running 32 bit ActiveState 5.14.2 on Windows 7. I wanted to mess around with a git pre-commit hook to detect programs being checked in with syntax errors. (Somehow I just managed to do such a bad commit.) So...
{"title":"How to connect to SQL Server database from JavaScript in the browser?","tags":["javascript","sql-server","database-connection"],"question_text":"Can anybody give me some sample source code showing how to connect to a SQL Server 2005 database from JavaScript locally? I am learning web programming on my desktop...
{"title":"How to find the php.ini file used by the command line?","tags":["php","easyphp"],"question_text":"I need to enable pdo_mysql in my EasyPhp environment, so I went to php.ini file and uncommented the following line:\n`extension=php_pdo_mysql.dll`\nUnfortunately I still have the same problem.\nI'm using the CLI ...
{"title":"target=\"_blank\" vs. target=\"_new\"","tags":["html"],"question_text":"What's the difference between\n`<a target=\"_new\">`\nand\n`<a target=\"_blank\">`\nand which should I use if I just want to open a link in a new tab\/window?","answer_text":"Use \"_blank\"!\nAccording to the\nHTML5 Spec\n:\nA\nvalid brow...
{"title":"Generate .pem file Used to setup Apple PUSH Notification","tags":["ios","push-notification","apple-push-notifications","pem"],"question_text":"I tried and tried to generate\n`.pem`\nfile , every time generating\n`certificates`\nfrom client's account and then generating\n`.pem`\nfile using terminal, but its of...
{"title":"if\/else in Python's list comprehension?","tags":["python","list-comprehension"],"question_text":"How can I do the following in Python?\n`row = [unicode(x.strip()) for x in row if x is not None else '']`\nEssentially:\nreplace all the Nones with empty strings, and then\ncarry out a function.","answer_text":"Y...
{"title":"Can I use non existing CSS classes?","tags":["html","css","w3c-validation","web-standards"],"question_text":"I have a table where I show\/hide a full column by jQuery via a CSS class that doesn't exist:\n`<table>\n <thead>\n <tr>\n <th><\/th>\n <th class=\"target\"><\/th>\n <th><\/th>\n <\/tr>\n <\/thead>\n <...
{"title":"How to grep Git commit diffs or contents for a certain word?","tags":["git","search","grep"],"question_text":"In a Git code repository I want to list all commits that contain a certain word. I tried this\n`git log -p | grep --context=4 \"word\"`\nbut it does not necessarily give me back the filename (unless i...
{"title":"How to connect to my http:\/\/localhost web server from Android Emulator in Eclipse","tags":["android","android-emulator"],"question_text":"What can I do in Eclipse's Android emulator to connect it to my localhost web server page at\n`http:\/\/localhost`\nor\n`http:\/\/127.0.0.1`\n?\nI've tried it, but the em...
{"title":"How do I check if a JavaScript array value is empty or null?","tags":["javascript","arrays"],"question_text":"Will this work for testing whether a value at position \"index\" exists or not, or is there a better way:\n`if(arrayName[index]==\"\"){\n \/\/ do stuff\n}`","answer_text":"All arrays in Javascript con...
{"title":"How do you find a min \/ max with Ruby?","tags":["ruby","enumerable"],"question_text":"I want to do something simple and straightforward, like\n`min(5,10)`\n, or\n`Math.max(4,7)`\n. Are there functions to this effect in Ruby?","answer_text":"You can do\n`[5, 10].min`\nor\n`[4, 7].max`\nThey come from the\nEnu...
{"title":"How to develop or migrate apps for iPhone 5 screen resolution?","tags":["ios","iphone","screen","iphone-5"],"question_text":"The new iPhone 5 display has a new aspect ratio and a new resolution (640 x 1136 pixels).\nWhat is required to develop new or transition already existing applications to the new screen ...
{"title":"Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement","tags":["sql","sql-server","sql-server-2005","tsql"],"question_text":"Is there any way in which I can clean a database in SQl Server 2005 by dropping all the tables and deleting stored procedures, trig...
{"title":"Java int to String - Integer.toString(i) vs new Integer(i).toString()","tags":["java","string","int"],"question_text":"Sometimes java puzzles me.\nI have a huge amount of\nint\ninitializations to make.\nWhat's the\nreal\ndifference?\n`Integer.toString(i)`\n`new Integer(i).toString()`","answer_text":"`Integer....
{"title":"How to remove a key from Hash and get the remaining hash in Ruby\/Rails?","tags":["ruby-on-rails","ruby","ruby-on-rails-3","hashmap"],"question_text":"To add a new pair to Hash I do:\n`{:a => 1, :b => 2}.merge!({:c => 3}) # => {:a=>1, :b=>2, :c=>3}`\nIs there a similar way to delete a key from Hash ?\nThis wo...
{"title":"How do I specify different Layouts in the ASP.NET MVC 3 razor ViewStart file?","tags":["asp.net-mvc","layout","asp.net-mvc-3","razor"],"question_text":"I would like to have 2 separate Layouts in my application. Let say one is for the Public section of the website and the other is for the Member side.\nFor sim...
{"title":"Convert Set to List without creating new List","tags":["java","performance","list","set"],"question_text":"I am using this code to convert a\n`Set`\nto a\n`List`\n:\n`Map<String, List> mainMap = new HashMap<String, List>();\nfor(int i=0; i<something.size(); i++){\n Set set = getSet(...); \/\/return different ...
{"title":"Node.js quick file server (static files over HTTP)","tags":["node.js","http","fileserver"],"question_text":"Is there Node.js ready-to-use tool (installed with\n`npm`\n), that would help me expose folder content as file server over HTTP.\nExample, if I have\n`D:\\Folder\\file.zip\nD:\\Folder\\file2.html\nD:\\F...
{"title":"How to get current datetime on Windows command line, in a suitable format for using in a filename?","tags":["windows","datetime","command-line","batch-file"],"question_text":"EDIT\n: Now that it's 2016 I'd use powershell for this unless there's a really compelling backwards-compatible reason for it, particula...
{"title":"Where does Console.WriteLine go in ASP.NET?","tags":["asp.net","iis","console.writeline"],"question_text":"In a J2EE application (like one running in WebSphere), when I use\n`System.out.println()`\n, my text goes to standard out, which is mapped to a file by the WebSphere admin console.\nIn an ASP.NET applica...
{"title":"How to detect iPhone 5 (widescreen devices)?","tags":["iphone","ios","objective-c","screen","device"],"question_text":"I've just upgraded to XCode 4.5 GM and found out that you can now apply the '4\" Retina' size to your view controller in the storyboard.\nNow if I want to create an application that runs on b...
{"title":"scp (secure copy) to ec2 instance without password","tags":["ssh","amazon-ec2","scp","pem"],"question_text":"I have an EC2 instance running (FreeBSD 9 AMI ami-8cce3fe5), and I can ssh into it using my amazon-created key file without password prompt, no problem.\nHowever, when I want to copy a file to the inst...
{"title":"how to install an older version of package via NuGet?","tags":["nuget","nuget-package"],"question_text":"I want to install an older version of a package (\n`Newtonsoft.Json`\n) but NuGet rolls back.\n`PM> Install-Package Newtonsoft.Json -Version 4.0.5\nSuccessfully installed 'Newtonsoft.Json 4.0.5'.\nInstall ...
{"title":"How to cherry-pick multiple commits","tags":["git","git-rebase","cherry-pick"],"question_text":"I have two branches. Commit\n`a`\nis the head of one, while the other has\n`b`\n,\n`c`\n,\n`d`\n,\n`e`\nand\n`f`\non top of\n`a`\n. I want to move\n`c`\n,\n`d`\n,\n`e`\nand\n`f`\nto first branch without commit\n`b`...
{"title":"How does the @property decorator work?","tags":["python","properties","decorator","python-internals"],"question_text":"I would like to understand how the built-in function\n`property`\nworks. What confuses me is that\n`property`\ncan also be used as a decorator, but it only takes arguments when used as a buil...
{"title":"Remove directory from remote repository after adding them to .gitignore","tags":["git","github","gitignore"],"question_text":"I committed and pushed some directory to github. After that, I altered the\n`.gitignore`\nfile adding a directory that should be ignored. Everything works fine, but the (now ignored) d...
{"title":"How to compare strings in Bash script","tags":["linux","bash","scripting"],"question_text":"I need to compare a variable to some string (and do something if they match).","answer_text":"Try this:\n`if [ \"$x\" == \"valid\" ]; then\n echo \"x has the value 'valid'\"\nfi`\nIf you want to do something when they ...
{"title":"Retrieving the last record in each group","tags":["sql","mysql","group-by","greatest-n-per-group"],"question_text":"There is a table\n`messages`\nthat contains data as shown below:\n`Id Name Other_Columns\n-------------------------\n1 A A_data_1\n2 A A_data_2\n3 A A_data_3\n4 B B_data_1\n5 B B_data_2\n6 C C_d...
{"title":"What's the difference between getPath(), getAbsolutePath(), and getCanonicalPath() in Java?","tags":["java"],"question_text":"What's the difference between\n`getPath()`\n,\n`getAbsolutePath()`\n, and\n`getCanonicalPath()`\nin Java?\nAnd when do I use each one?","answer_text":"Consider these filenames:\n`C:\\t...
{"title":"How do you pass a function as a parameter in C?","tags":["c","function","pointers","syntax","parameters"],"question_text":"I want to create a function that performs a function passed by parameter on a set of data. How do you pass a function as a parameter in C?","answer_text":"Declaration\nA prototype for a f...
{"title":"Node.js Error: Can't set headers after they are sent","tags":["javascript","node.js","express"],"question_text":"I'm fairly new to Node.js and I am having some issues.\nI am using Node.js 4.10 and Express 2.4.3.\nWhen I try to access\nhttp:\/\/127.0.0.1:8888\/auth\/facebook\n, i'll be redirected to\nhttp:\/\/...
{"title":"What's the shebang\/hashbang (#!) in Facebook and new Twitter URLs for?","tags":["facebook","url","twitter","fragment-identifier","hashbang"],"question_text":"I've just noticed that the long, convoluted Facebook URLs that we're used to now look like this:\n`http:\/\/www.facebook.com\/example.profile#!\/pages\...
{"title":"Listing only directories using ls in bash: An examination","tags":["bash","directory","ls"],"question_text":"This command lists directories in the current path:\n`ls -d *\/`\nWhat exactly does the pattern\n`*\/`\ndo?\nAnd how can we give the absolute path in the above command (e.g.\n`ls -d \/home\/alice\/Docu...
{"title":"Javascript regex multiline flag doesn't work","tags":["javascript","regex"],"question_text":"I wrote a regex to fetch string from html, but it seems the multiline flag doesn't work.\nthis is my pattern and I want to get the text in h1 tag.\n`var pattern= \/<div class=\"box-content-5\">.*<h1>([^<]+?)<\\\/h1>\/...
{"title":"Assertion failure in dequeueReusableCellWithIdentifier:forIndexPath:","tags":["ios","objective-c","iphone","uitableview"],"question_text":"So I was making an rss reader for my school and finished the code. I ran the test and it gave me that error. Here is the code it's referring to:\n`- (UITableViewCell *)tab...
{"title":"The backup set holds a backup of a database other than the existing","tags":["sql-server"],"question_text":"I am trying to restore a SQL Server backup file for my database, but it is throwing an error as follow:\nThe backup set holds a backup of a database other than the existing\nMy database in SQL Server 20...
{"title":"When should I write the keyword 'inline' for a function\/method?","tags":["c++","inline","one-definition-rule"],"question_text":"When should I write the keyword\n`inline`\nfor a function\/method in C++?\nAfter seeing some answers, some related questions:\nWhen should I\nnot\nwrite the keyword 'inline' for a f...
{"title":"Remote origin already exists on 'git push' to a new repository","tags":["git","github","git-push","git-remote"],"question_text":"I have my project on GitHub at some location,\n`git@github.com:myname\/oldrep.git`\n.\nNow I want to push all my code to a new repository at some other location,\n`git@github.com:ne...
{"title":"How do I write stderr to a file while using \"tee\" with a pipe?","tags":["linux","bash","unix"],"question_text":"I have below a command which will print the output of\n`aaa.sh`\nto the screen while also writing\nstdout\nto\n`bbb.out`\n; however I would also like to write\nstderr\nto a file named\n`ccc.out`\n...
{"title":"How to find string in project in Android Studio?","tags":["android","search","intellij-idea","android-studio"],"question_text":"This may be a really stupid question, but I just can't figure it out. I've just started using Android Studio (IntelliJ), and I now look for the feature to find the occurrence of a st...