text
stringlengths
74
309k
{"title":"getting the ng-object selected with ng-change","tags":["angularjs"],"question_text":"Given the following select element\n`<select ng-options=\"size.code as size.name for size in sizes \" \n ng-model=\"item.size.code\" \n ng-change=\"update(MAGIC_THING)\">\n<\/select>`\nIs there a way to get MAGIC_THING to be ...
{"title":"How to check if a database exists in SQL Server?","tags":["sql-server","database","tsql"],"question_text":"What is the ideal way to check if a database exists on a SQL Server using TSQL? It seems multiple approaches to implement this.","answer_text":"Actually it's best to use:\n`if db_id('dms') is not null\n ...
{"title":"Is there an advantage to use a Synchronized Method instead of a Synchronized Block?","tags":["java","multithreading","concurrency","synchronized"],"question_text":"Can any one tell me the advantage of synchronized method over synchronized block with an example?","answer_text":"Can any one tell me the advantag...
{"title":"Backwards migration with Django South","tags":["django","migration","django-south"],"question_text":"Ok, so this seems like a really silly thing to ask, and I'm sure I'm missing something somewhere.\nHow do you perform a backwards migration using South on Django?\nSo I've tweaked my models, created a migratio...
{"title":"Extract File Basename Without Path and Extension in Bash","tags":["linux","bash","unix","filenames"],"question_text":"Given file names like these:\n`\/the\/path\/foo.txt\nbar.txt`\nI hope to get\n`foo\nbar`\nWhy this doesn't work?\n`#!\/bin\/bash\nfullfile=$1\nfname=$(basename $fullfile)\nfbname=${fname%.*}\n...
{"title":"Java - No enclosing instance of type Foo is accessible","tags":["java","inner-classes"],"question_text":"I have the following code:\n`class Hello {\n class Thing {\n public int size;\n Thing() {\n size = 0;\n }\n }\n public static void main(String[] args) {\n Thing thing1 = new Thing();\n System.out.println(\...
{"title":"Undock Chrome Developer Tools","tags":["google-chrome","google-chrome-devtools"],"question_text":"How do I undock the Chrome Developer Tools in Chrome?\nPressing the left bottom corner just moves it to the right side.","answer_text":"Click the vertical ellipsis button ( \u00e2\u008b\u00ae ) then choose the de...
{"title":"How do I test which class an object is in Objective-C?","tags":["objective-c"],"question_text":"How do I test whether an object is an instance of a particular class in Objective-C? Let's say I want to see if object a is an instance of class b, or class c, how do I go about doing it?","answer_text":"To test if...
{"title":"How do you change text to bold in Android?","tags":["android","text","android-textview"],"question_text":"How do you change\ntext\/font\nsettings in an Android\n`TextView`\n? For example, how do you make the text\nbold\n?","answer_text":"To do this in the layout xml:\n`android:textStyle`\nExamples:\n`android:...
{"title":"How do I prevent git diff from using a pager?","tags":["git"],"question_text":"Is there a command line switch to pass to\n`git diff`\nand other commands that use the\n`less`\npager by default?\nI know I can pipe it to cat, but that removes all the syntax highlighting.\nI know I can set the pager in the global...
{"title":"How to handle too long index names in a Rails migration with MySQL?","tags":["mysql","ruby-on-rails","postgresql","indexing","migration"],"question_text":"I am trying to add an unique index that gets created from the foreign keys of 4 associated tables (\nusers\n,\nuniversities\n,\nsubject_names\n,\nsubject_t...
{"title":"Why does calling a method in my derived class call the base class method?","tags":["c#","class","derived-class"],"question_text":"Consider this code:\n`class Program\n{\n static void Main(string[] args)\n {\n Person person = new Teacher();\n person.ShowInfo();\n Console.ReadLine();\n }\n}\npublic class Person...
{"title":"How to test if string exists in file with Bash shell?","tags":["string","bash","file"],"question_text":"I have a file that contains directory names:\n`my_list.txt`\n:\n`\/tmp\n\/var\/tmp`\nI'd like to check in Bash before I'll add a directory name if that name already exists in the file.","answer_text":"`grep...
{"title":"Not class selector in jQuery","tags":["javascript","jquery","jquery-selectors"],"question_text":"Is there a simple selector expression to not select elements with a specific class?\n`<div class=\"first-foo\" \/>\n<div class=\"first-moo\" \/>\n<div class=\"first-koo\" \/>\n<div class=\"first-bar second-foo\" \...
{"title":"Updating a local repository with changes from a Github repository","tags":["git","github"],"question_text":"I've got a project checked locally from github, that remote repo has since had changes made to it. What's the correct command to update my local copy with the latest changes?","answer_text":"probably:\n...
{"title":"Not receiving Google OAuth refresh token","tags":["gdata","gdata-api","access-token"],"question_text":"I want to get the access token from Google.\nThe Google API says\nthat to get the access token, send the code and other parameters to token generating page, and the response will be a JSON Object like :\n`{\...
{"title":"Move an array element from one array position to another","tags":["javascript","arrays"],"question_text":"I'm having a hard time figuring out how to move an array element. For example, given the following:\n`var arr = [ 'a', 'b', 'c', 'd', 'e'];`\nHow can I write a function to move\n`'d'`\nbefore\n`'b'`\n?\nO...
{"title":"Difference between applicationContext.xml and spring-servlet.xml in Spring Framework","tags":["java","spring"],"question_text":"Are\n`applicationContext.xml`\nand\n`spring-servlet.xml`\nrelated anyhow in Spring Framework?\nWill the properties files declared in\n`applicationContext.xml`\nbe available to\n`Disp...
{"title":"Get first and last date of current month with javascript or jquery","tags":["javascript","jquery","date","time"],"question_text":"Possible Duplicate:\nCalculate last day of month in javascript\nWhat is the best way to determine the number of days in a month with javascript?\nAs title says, i'm stuck on findin...
{"title":"How to reset Django admin password?","tags":["django","admin"],"question_text":"I am using Django (version 1.3) and have forgotten both admin username and password. How to reset both?\nAnd is it possible to make a normal user into admin, and then remove admin status?","answer_text":"`manage.py changepassword ...
{"title":"Java Date vs Calendar","tags":["java","date","calendar"],"question_text":"Could someone please advise the current \"best practice\" around\n`Date`\nand\n`Calendar`\ntypes.\nWhen writing new code, is it best to always favour\n`Calendar`\nover\n`Date`\n, or are there circumstances where\n`Date`\nis the more app...
{"title":"Get list from pandas DataFrame column headers","tags":["python","pandas","dataframe"],"question_text":"I want to get a list of the column headers from a pandas DataFrame. The DataFrame will come from user input so I won't know how many columns there will be or what they will be called.\nFor example, if I'm gi...
{"title":"Delete last char of string","tags":["c#","string","char"],"question_text":"I am retrieving a lot of informations in a list, linked to a Database .\nI want to create a string of groups, for someone who is connected to the website.\nI use this to test ... But this is not dynamic so really bad :\nstring strgroup...
{"title":"jQuery animate backgroundColor","tags":["javascript","jquery","colors","jquery-animate"],"question_text":"I am trying to animate a change in backgroundColor using jQuery on mouseover.\nI have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundCol...
{"title":"Get real image width and height with JavaScript in Safari\/Chrome?","tags":["javascript","jquery","safari","google-chrome","webkit"],"question_text":"I am creating a jQuery plugin.\nHow do I get real image width and height with Javascript in Safari?\nFollowing works with Firefox 3, IE7 and Opera 9:\n`var pic ...
{"title":"Exact time measurement for performance testing","tags":["c#",".net","performance","testing"],"question_text":"What is the most exact way of seeing how long something, for example a method call, took in code?\nThe easiest and quickest I would guess is this:\n`DateTime start = DateTime.Now;\n{\n \/\/ Do some wo...
{"title":"A ternary in templates","tags":["javascript","html","angularjs","ternary-operator"],"question_text":"How do you do a ternary with AngularJS (in the templates)?\nIt would be nice to use some in html attributes (classes and style) instead of creating and calling a function of the controller.","answer_text":"Upd...
{"title":"How to measure execution time of javascript code with callbacks","tags":["javascript","node.js","profiling"],"question_text":"I have a piece of javascript code that I am executing using the node.js interpreter.\n`for(var i = 1; i < LIMIT; i++){\n db.users.save({id : i, name : \"MongoUser [\" + i + \"]\"}, fun...
{"title":"How to split last commit into two in Git","tags":["git","version-control"],"question_text":"I have two working branches,\nmaster\nand\nforum\nand I've just made some modifications in\nforum\nbranch, that I'd like to cherry-pick into\nmaster\n. But unfortunately, the commit I want to cherry-pick also contains ...
{"title":"What is the most efficient\/elegant way to parse a flat table into a tree?","tags":["sql","algorithm","recursion","tree","hierarchical-data"],"question_text":"Assume you have a flat table that stores an ordered tree hierarchy:\n`Id Name ParentId Order\n 1 'Node 1' 0 10\n 2 'Node 1.1' 1 10\n 3 'Node 2' 0 20\n ...
{"title":"How do I determine the size of an object in Python?","tags":["python","object","memory","memory-management","sizeof"],"question_text":"In C, we can find the size of an\n`int`\n,\n`char`\n, etc. I want to know how to get size of objects like a string, integer, etc. in Python.\nRelated question:\nHow many bytes...
{"title":"Basic example of using .ajax() with JSONP?","tags":["ajax","json","jsonp"],"question_text":"Please could someone help me work out how to get started with JSONP?\nCode:\n`$('document').ready(function() {\n var pm_url = 'http:\/\/twitter.com\/status';\n pm_url += '\/user_timeline\/stephenfry.json';\n pm_url += ...
{"title":"passing 2 $index values within nested ng-repeat","tags":["angularjs","angularjs-ng-repeat"],"question_text":"So I have an ng-repeat nested within another ng-repeat in order to build a nav menu. On each\n`<li>`\non the inner ng-repeat loop I set an ng-click which calls the relevant controller for that menu ite...
{"title":"Can you nest html forms?","tags":["html","nested-forms"],"question_text":"Is it possible to nest html forms like this\n`<form name=\"mainForm\">\n <form name=\"subForm\">\n <\/form>\n<\/form>`\nso that both forms work? My friend is having problems with this, a part of the\n`subForm`\nworks, while another part...
{"title":"Shortcut to create properties in Visual Studio?","tags":["c#","visual-studio","properties","code-snippets","shortcut"],"question_text":"I have seen some people creating properties in C# really fast, but how they dod it?\nWhat shortcuts are available in Visual Studio (currently using Visual\u00a0Studio\u00a020...
{"title":"Run jar file in command prompt","tags":["java","jar"],"question_text":"Possible Duplicate:\nHow to run a JAR file\nHow do we run a jar file in command prompt?","answer_text":"Try this\n`java -jar <jar-file-name>.jar`","question_code":[],"answer_code":["java -jar <jar-file-name>.jar\n"],"retrieval_text":"\n###...
{"title":"What is the difference between Tomcat, JBoss and Glassfish?","tags":["java","tomcat","jboss","glassfish","enterprise"],"question_text":"I am starting to look into Enterprise Java and the book I am following mentions that it will use JBoss. Netbeans ships with Glassfish. I have used Tomcat in the past.\nWhat a...
{"title":"Try reinstalling `node-sass` on node 0.12?","tags":["node.js","sass","gulp"],"question_text":"I would like to use google web starter kit. I installed node.js v0.12.0,\n`node-sass`\n&\n`gulp`\n.\nAnd then ran:\n`$ sudo npm install`\nWhen I typed\n`gulp serve`\nthen got this error:\n`Using gulpfile ~\/web-start...
{"title":"What do the parentheses around a function name mean?","tags":["c","function","parentheses"],"question_text":"In one of my project source files, I found this C function definition:\n`int (foo) (int *bar)\n{\n return foo (bar);\n}`\nNote: there is no asterisk next to\n`foo`\n, so it's not a function pointer. Or...
{"title":"Why is my Spring @Autowired field null?","tags":["java","spring",null,"nullpointerexception","autowired"],"question_text":"Note: This is intended to be a canonical answer for a common problem.\nI have a Spring\n`@Service`\nclass (\n`MileageFeeCalculator`\n) that has an\n`@Autowired`\nfield (\n`rateService`\n)...
{"title":"How to sort an array of objects with jquery or javascript","tags":["javascript","jquery","sorting","multidimensional-array"],"question_text":"I have an array of objects:\n`var array = [(id, name, value),(id, name, value)]; \/\/and so on`\nHow do I get the array to be sorted in ascending order of the atribute ...
{"title":"Add floating point value to android resources\/values","tags":["android","resources","floating-point"],"question_text":"I'm trying to add a little space between lines to my TextViews using\n`android:lineSpacingMultiplier`\nfrom the\ndocumentation\n:\nExtra spacing between lines of text,\n as a multiplier.\nMu...
{"title":"Get jQuery version from inspecting the jQuery object","tags":["javascript","jquery"],"question_text":"Is there a way to find out what version of jQuery is being used by inspecting the\n`jQuery`\nobject? jQuery is dynamically getting added to my page and I cannot see any reference to it in my markup. If I insp...
{"title":"Edit the root commit in Git?","tags":["git","git-rebase","git-commit","git-rewrite-history","amend"],"question_text":"There's ways to change the message from later commits:\n`git commit --amend # for the most recent commit\ngit rebase --interactive master~2 # but requires *parent*`\nHow can you change the com...
{"title":"Ruby: Can I write multi-line string with no concatenation?","tags":["ruby","code-formatting"],"question_text":"Is there a way to make this look a little better?\n`conn.exec 'select attr1, attr2, attr3, attr4, attr5, attr6, attr7 ' +\n 'from table1, table2, table3, etc, etc, etc, etc, etc, ' +\n 'where etc etc...
{"title":"How to include() all PHP files from a directory?","tags":["php","include"],"question_text":"Very quick n00b question, in PHP can I include a directory of scripts.\ni.e. Instead of:\n`include('classes\/Class1.php');\ninclude('classes\/Class2.php');`\nis there something like:\n`include('classes\/*');`\nCouldn't...
{"title":"Angular IE Caching issue for $http","tags":["javascript","caching","angularjs"],"question_text":"All the ajax calls that are sent from the IE are cached by Angular and I get a\n`304 response`\nfor all the subsequent calls . Though the request is the same, the response is not gonna be the same in my case. I wa...
{"title":"What's the most efficient way to erase duplicates and sort a vector?","tags":["c++","stl","vector","sorting"],"question_text":"I need to take a C++ vector with potentially a lot of elements, erase duplicates, and sort it.\nI currently have the below code, but it doesn't work.\n`vec.erase(\n std::unique(vec.be...
{"title":"\"Bitmap too large to be uploaded into a texture\"","tags":["android","android-layout"],"question_text":"I'm loading a bitmap into an ImageView, and seeing this error. I gather this limit relates to a size limit for OpenGL hardware textures (2048x2048). The image I need to load is a pinch-zoom image of about ...
{"title":"Print Var in JsFiddle","tags":["javascript","jquery","jsfiddle"],"question_text":"How would I print something to the result screen in JsFiddle from my JavaScript. I can't use\n`document.write()`\n, it doesn't allow it, neither\n`print`\n.\nWhat should I use?","answer_text":"To be able to see output from\n`con...
{"title":"Simple logical operators in BASH","tags":["bash","logical-operators"],"question_text":"I have a couple of variables and I want to check the following condition (written out in words, then my failed attempt at bash scripting):\n`if varA EQUALS 1 AND ( varB EQUALS \"t1\" OR varB EQUALS \"t2\" ) then \ndo someth...
{"title":"How can I add CGPoint objects to an NSArray the easy way?","tags":["iphone","objective-c","cocoa-touch","uikit"],"question_text":"I have about 50 CGPoint objects that describe something like a \"path\", and I want to add them to an NSArray. It's going to be a method that will just return the corresponding CGP...
{"title":"window.onload vs document.onload","tags":["javascript","javascript-events"],"question_text":"Which is more widely supported:\n`window.onload`\nor\n`document.onload`\n?","answer_text":"window.onload\nWhen do they fire?\nwindow.onload\nBy default, it is fired when the entire page loads, including its content (i...
{"title":"Using Chrome's Element Inspector in Print Preview Mode?","tags":["google-chrome","print-preview","web-inspector"],"question_text":"I am working on developing a website and need to work on the print view. Typically when I have layout issues I use Chrome's Element Inspector. However this does not exist in print...
{"title":"In jQuery, how do I select an element by its name attribute?","tags":["javascript","jquery","html","radio-button"],"question_text":"I have 3 radio buttons in my web page, like below:\n`<label for=\"theme-grey\">\r\n <input type=\"radio\" id=\"theme-grey\" name=\"theme\" value=\"grey\" \/>Grey<\/label>\r\n<lab...
{"title":"What's the optimum way of storing an NSDate in NSUserDefaults?","tags":["cocoa","datetime","nsdate","nsuserdefaults","nstimeinterval"],"question_text":"There's two ways of storing an NSDate in NSUserDefaults that I've come across.\nOption 1 - setObject:forKey:\n`\/\/ Set\nNSDate *myDate = [NSDate date];\n[[NS...
{"title":"python: list vs tuple, when to use each?","tags":["python","list","types","tuples"],"question_text":"In Python, when should you use lists and when tuples?\nSometimes you don't have a choice, for example if you have\n`\"hello %s you are %s years old\" % x`\nthen x must be a tuple.\nBut if I am the one who desi...
{"title":"Convert java.util.Date to java.time.LocalDate","tags":["java","datetime","java-8","java-time"],"question_text":"What is the best way to convert a\n`java.util.Date`\nobject to the new JDK 8\/JSR-310\n`java.time.LocalDate`\n?\n`Date input = new Date();\nLocalDate date = ???`","answer_text":"Short answer:\n`Date...
{"title":"Is an HTTPS query string secure?","tags":["ssl","https","query-string"],"question_text":"I am creating a secure web based API that uses HTTPS; however, if I allow the users to configure it (include sending password) using a query string will this also be secure or should I force it to be done via a POST?","an...
{"title":"How to get the list of all installed color schemes in Vim?","tags":["list","vim","color-scheme"],"question_text":"Is there a way to get a list of all installed color schemes in Vim? That would make very easy to select one without looking at the\n`.vim`\ndirectory.","answer_text":"Type\n`:colorscheme`\nthen\nS...
{"title":"How to write inline if statement for print?","tags":["python","if-statement","inline"],"question_text":"I need to print some stuff only when a boolean variable is set to\n`True`\n. So, after looking at\nthis\n, I tried with a simple example:\n`>>> a = 100\n>>> b = True\n>>> print a if b\n File \"<stdin>\", li...
{"title":"Which is a better way to check if an array has more than one element?","tags":["php","arrays"],"question_text":"I just need to check if an array has more than one element. \nI am trying to do it this way :\n`if (isset($arr['1']))`\nthe other traditional way is\n`if (sizeof($arr)>1)`\nWhich of the two is bette...
{"title":"Node.js vs .Net performance","tags":[".net","performance","node.js"],"question_text":"I've read a lot about Node.js being fast and able to accommodate large amounts of load. Does anyone have any real world evidence of this vs other frameworks, particularly .Net? Most of the articles i've read are anecdotal or...
{"title":"How to add an object into an array","tags":["javascript","arrays","object"],"question_text":"How can I add\nan object into an array\n(in javascript or jquery)?\nFor example, what is the problem this code?\n`<!-- language: lang-js -->\nfunction(){\n var a = new array();\n var b = new object();\n a[0]=b;\n}`\nI...
{"title":"How to list npm user-installed packages?","tags":["node.js","npm","package-managers"],"question_text":"How do I list the user-installed package ONLY in\n`npm`\n? When I do\n`npm -g list`\nit outputs every package and their dependencies, which is not what I want.","answer_text":"This works pretty well too:\n`n...
{"title":"UIWebView background is set to Clear Color, but it is not transparent","tags":["iphone","objective-c","ios","cocoa-touch","uiwebview"],"question_text":"I'm developing an iOS 4 application using iOS SDK latest version and XCode 4.2.\nI have a XIB with a\n`UIWebView`\nwith\nAlpha = 1.0\n,\nBackground\nset to\nC...
{"title":"Getting attributes of Enum's value","tags":["c#","reflection","enums",".net-attributes"],"question_text":"I would like to know if it is possible to get attributes of the enum values and not of the enum itself? For example, suppose I have the following enum:\n`using System.ComponentModel; \/\/ for DescriptionA...
{"title":"Replace one substring for another string in shell script","tags":["bash","shell"],"question_text":"I have \"I love Suzi and Marry\" and I want to change \"Suzi\" to \"Sara\".\n`#!\/bin\/bash\nfirstString=\"I love Suzi and Marry\"\nsecondString=\"Sara\"\n# do something...`\nThe result must be like this:\n`firs...
{"title":"How can a time function exist in functional programming?","tags":["scala","haskell","f#","functional-programming","clean-language"],"question_text":"I've to admit that I don't know much about functional programming. I read about it from here and there, and so came to know that in functional programming, a fun...
{"title":"How do I read any request header in PHP","tags":["php","http-headers"],"question_text":"How should I read any header in PHP?\nFor example the custom header:\n`X-Requested-With`\n.","answer_text":"`$_SERVER['HTTP_X_REQUESTED_WITH']`\nRFC3875\n, 4.1.18:\nMeta-variables with names beginning with\n`HTTP_`\ncontai...
{"title":"python open built-in function: difference between modes a, a+, w, w+, and r+?","tags":["python"],"question_text":"In the python built-in\nopen\nfunction, what is the exact difference between the modes w, a, w+, a+, and r+?\nIn particular, the documentation implies that all of these will allow writing to the f...
{"title":"Convert boolean to int in Java","tags":["java","casting","boolean","int"],"question_text":"What is the most accepted way to convert a\n`boolean`\nto an\n`int`\nin Java?","answer_text":"`int myInt = (myBoolean) ? 1 : 0;`\n^^\nPS : true = 1 and false = 0","question_code":[],"answer_code":["int myInt = (myBoolea...
{"title":"How do you create a JavaScript Date object with a set timezone without using a string representation","tags":["javascript","timezone"],"question_text":"I have a web page with three dropdowns for day, month and year. If I use the JavaScript Date constructor that takes numbers then I get a Date object for my cu...
{"title":"How to pass an array of integers to ASP.NET Web API?","tags":["c#","arrays","asp.net-web-api"],"question_text":"I have asp.net web api rest service where I need to pass an array of integers. How can this be done in asp.net 4 web api.\n`public IEnumerable<Category> GetCategories(int[] categoryIds){\n\/\/ code ...
{"title":"How to write :hover condition for a:before and a:after?","tags":["css","css-selectors","pseudo-element","pseudo-class"],"question_text":"How to write\n`:hover`\nand\n`:visited`\ncondition for\n`a:before`\n?\nI'm trying\n`a:before:hover`\nbut it's not working","answer_text":"This depends on what you're actuall...
{"title":"How do I shuffle an array in Swift?","tags":["swift"],"question_text":"How do I randomize or shuffle the elements within an array in Swift? For example, if my array consists of 52 playing cards, I want to\nshuffle\nthe array in order to shuffle the deck.","answer_text":"This answer details how to add a Fisher...
{"title":"Get just the filename from a path in a Bash script","tags":["bash","scripting","shell"],"question_text":"How would I get just the filename without the extension and no path?\nThe following gives me no extension, but I still have the path attached:\n`source_file_filename_no_ext=${source_file%.*}`","answer_text...
{"title":"Semaphore vs. Monitors - what's the difference?","tags":["multithreading","semaphore","monitor"],"question_text":"What are the major differences between a\nMonitor\nand a\nSemaphore\n?","answer_text":"A\nMonitor\nis an object designed to be accessed from multiple threads. The member functions or methods of a ...
{"title":"Convert UTC\/GMT time to local time","tags":["c#",".net","datetime","utc"],"question_text":"We are developing a C# application for a web-service client. This will run on Windows XP PC's.\nOne of the fields returned by the web service is a DateTime field. The server returns a field in GMT format i.e. with a \"...
{"title":"How can I get maven-release-plugin to skip my tests?","tags":["maven","maven-release-plugin","maven-surefire-plugin"],"question_text":"How can I get the maven-release-plugin to run without triggering the tests?\nI have tried\n`-Dmaven.test.skip=true`\nand\n`-DskipTests`\nand\n`-DpreparationGoals=clean`\n...ye...
{"title":"Finish all previous activities","tags":["java","android","android-activity","screen","flow"],"question_text":"My application has the following flow screens :\n`Home->screen 1->screen 2->screen 3->screen 4->screen 5`\nNow I have a common\n`log out`\nbutton in each screens\n(\n`Home\/ screen 1 \/ screen 2 \/scr...
{"title":"Fragment over another fragment issue","tags":["android","android-fragments"],"question_text":"When I'm showing one fragment (which is full screen with\n`#77000000`\nbackground) over another fragment (let's call it main), my main fragment still reacts to clicks (we can click a button even if we don't see it).\...
{"title":"Manifest merger failed : uses-sdk:minSdkVersion 14","tags":["android","android-studio","android-gradle","android-5.0-lollipop"],"question_text":"Since downloading the latest SDK and installing Android Studio, my project fails to build. I get the following message:\n`Error:Gradle: Execution failed for task ':S...
{"title":"Unit Testing C Code","tags":["c","unit-testing","testing","embedded"],"question_text":"I worked on an embedded system this summer written in straight C. It was an existing project that the company I work for had taken over. I have become quite accustomed to writing unit tests in Java using JUnit but was at a ...
{"title":"How to revert a \"git rm -r .\"?","tags":["git","git-rm"],"question_text":"I accidentely said\n`git rm -r .`\n. How do I recover from this?\nI did not commit.\nI think all files were marked for deletion and were also physically removed from my local checkout.\nEDIT:\nI could (if I knew the command) revert to ...
{"title":"Get type name without full namespace in C#","tags":["c#","namespaces","typeof"],"question_text":"I have the following code:\n`return \"[Inserted new \" + typeof(T).ToString() + \"]\";`\nBut\n`typeof(T).ToString()`\nreturns the full name including namespace\nIs there anyway to just get the class name (without ...
{"title":"Position a CSS background image x pixels from the right?","tags":["css"],"question_text":"I think the answer is no, but can you position a background image with CSS so that it is a fixed amount of pixels away from the right?\nIf I set\n`background-position`\nvalues of x and y, it seems those only give fixed p...
{"title":"What's the best way to build a string of delimited items in Java?","tags":["java","string"],"question_text":"While working in a Java app, I recently needed to assemble a comma-delimited list of values to pass to another web service without knowing how many elements there would be in advance. The best I could ...
{"title":"MySQL search and replace some text in a field","tags":["mysql"],"question_text":"What MySQL query will do a text search and replace in one particular field in a table?\nie search for 'foo' and replace with 'bar' so a record with a field with the value : 'hello foo' becomes: 'hello bar'.","answer_text":"Change...
{"title":"Does JavaScript have a standard for commenting functions?","tags":["javascript","documentation","comments","ghostdoc"],"question_text":"I am currently writing some client side JavaScript code and wondering how to comment my functions.\nI come from a C# background, where there is an officially recommended comm...
{"title":"Android Fragments and animation","tags":["android","android-fragments","android-3.0-honeycomb"],"question_text":"How should you implement the sort of sliding that for example the Honeycomb Gmail client uses?\nCan\n`TransactionManager`\nhandle this automatically by adding and removing the Fragments, it's kind ...
{"title":"Where are iOS 5 simulator screenshots stored?","tags":["iphone","ios-simulator","screenshot"],"question_text":"I have saved some screenshots in the iPhone Simulator running iOS 5, but I can't find them.\nI had this problem before, and it took me frickin' ages to find them in the file system. Is this so simple...
{"title":"Python style: multiple-line conditions in IFs","tags":["python","coding-style","if-statement"],"question_text":"Sometimes I break long conditions in IFs to several lines. The most obvious way to do this is:\n`if (cond1 == 'val1' and cond2 == 'val2' and\n cond3 == 'val3' and cond4 == 'val4'):\n do_something`\n...
{"title":"Test iOS app on device without apple developer program or jailbreak","tags":["ios","debugging","ios-provisioning"],"question_text":"How can I test an iOS application on my ipod touch without registering for the apple developer program or jailbreaking my ipod?\nNeither is a viable option at the moment.\nI'd li...
{"title":"URL Encoding using C#","tags":["c#",".net","urlencode"],"question_text":"I have an application which I've developed for a friend. It sends a POST request to the VB forum software and logs someone in (with out setting cookies or anything).\nOnce the user is logged in I create a variable that creates a path on ...
{"title":"Python mysqldb: Library not loaded: libmysqlclient.18.dylib","tags":["python","mysql-python"],"question_text":"I just compiled and installed mysqldb for python 2.7 on my mac os 10.6. I created a simple test file that imports\n`import MySQLdb as mysql`\nFirstly, this command is red underlined and the info tell...
{"title":"How to get PID of background process?","tags":["shell","background-process","pid"],"question_text":"I start a background process from my shell script, and I would like to kill this process when my script finishes.\nHow to get the PID of this process from my shell script? As far as I can see variable\n`$!`\nco...
{"title":"How to use java.String.format in Scala?","tags":["java","string","scala","format"],"question_text":"I am trying to use a\n`.format`\nmethod of a string. But if I place %1, %2, etc. in the string, java.util.UnknownFormatConversionException is thrown pointing to a confusing Java source code piece:\n`private voi...
{"title":"dismissModalViewControllerAnimated deprecated","tags":["ios","ios6"],"question_text":"I've just upgraded to XCode 4.5 to update my iOS app to run on the 4 inch display for the iPhone 5, but I'm getting a build error saying\n`dismissModalViewControllerAnimated:' is deprecated`\non the line:\n`[self dismissModa...
{"title":"How can I convert a hex string to a byte array?","tags":["c#","encoding","hex"],"question_text":"Possible Duplicate:\nHow do you convert Byte Array to Hexadecimal String, and vice versa, in C#?\nCan we convert a hex string to a byte array using a built-in function in C# or do I have to make a custom method fo...