text
stringlengths
74
309k
{"title":"Is there a way to inspect the current rpath on Linux?","tags":["linux","rpath"],"question_text":"I'm aware that it is possible to use 'readelf -d | grep RPATH' to inspect a given binary from the shell, but is it possible to do this within a process?\nSomething like (my completely made up system call):\n`\/* g...
{"title":"How to clear the content of an IFRAME?","tags":["javascript","html","iframe"],"question_text":"How do I clear the content of my IFRAME element, using javascript, without loading a blank page into it?\nI can figure out to do this:\n`iframe_element.src = \"blank.html\"`\n, but there must be a better, instant, m...
{"title":"Git revert local commit","tags":["windows","git","msysgit"],"question_text":"I have a git repo hooked up in phpstorm on windows. I committed a few change sets then pushed them to our \"central repo\". After this I have then made a few more commits. I no longer want these commits that have not been pushed to t...
{"title":"How can a Format-String vulnerability be exploited?","tags":["c","security","format-string"],"question_text":"I was reading about vulnerabilities in code and came across this\nFormat-String Vulnerability\n.\nWikipedia\nsays:\nFormat string bugs most commonly appear when a programmer wishes to\n print a string...
{"title":"Google Search from a Python App","tags":["python","api","google-search-api"],"question_text":"I'm trying to run a google search query from a python app. Is there any python interface out there that would let me do this? If there isn't does anyone know which Google API will enable me to do this. Thanks.","answ...
{"title":"Real world example about how to use property feature in python?","tags":["python","oop","properties","python-decorators"],"question_text":"I am interested in how to use\n`@property`\nin Python. I've read the python docs and the example there, in my opinion, is just a toy code:\n`class C(object):\n def __init_...
{"title":"Reseting generator object in Python","tags":["python","generator","yield"],"question_text":"I have generator object returned by multiple yield. Preparation to call this generator is rather time-consuming operation. That is why I want to reuse generator several times.\n`y = FunctionWithYield()\nfor x in y: pri...
{"title":"Why doesn't jQuery use requestAnimationFrame?","tags":["jquery","requestanimationframe"],"question_text":"Some browsers support\n`requestAnimationFrame`\n, so why not use it? After all, it's been\nsupported since Google Chrome 10\n. Despite that, jQuery\ndoes not seem to be using it\n. I've found a\nbug repor...
{"title":"Can't stop animation at end of one cycle","tags":["animation","webkit","css3"],"question_text":"I'm making a CSS animation at the minute, and in it I'm moving stuff and want it to stay at the end position until the user moves their mouse away.\n`body {\n background: url('osx.jpg');\n padding: 0;\n margin: 0;\...
{"title":"What is a good example to differentiate between fileprivate and private in swift3","tags":["swift","private","swift3","access-specifier"],"question_text":"https:\/\/lists.swift.org\/pipermail\/swift-evolution\/Week-of-Mon-20160328\/013664.html\nhas been helpful in understanding what the new access-specifiers ...
{"title":"In Python, how do I loop through the dictionary and change the value if it equals something?","tags":["python","dictionary"],"question_text":"If the value is None, I'd like to change it to \"\" (empty string).\nI start off like this, but I forget:\n`for k, v in mydict.items():\n if v is None:\n... right?`","a...
{"title":"When to use addChildViewController vs pushViewController","tags":["iphone","uiviewcontroller","pushviewcontroller","addchild"],"question_text":"I just watched a 2011\n`WWDC`\npresentation on \"Implementing UIViewController Containment\" (\nhere's a link to the video\n)\nThey mentioned both of these ways of ad...
{"title":"Why does PDFKit\/wkhtmltopdf hang but renders PDF as expected when Rails app is killed?","tags":["ruby-on-rails-3","pdf","osx-mountain-lion","wkhtmltopdf","pdfkit"],"question_text":"Background\nAfter reading around it seemed to me that\nPrawn\nis out and\nwkhtmltopdf\nis in. It also seems like the\nPDFKit\nan...
{"title":"Is there a shorter way to require a file in the same directory in ruby?","tags":["ruby","path","require"],"question_text":"Is there a shorter way to require a file located in the same directory (as the script being executed)?\n`require File.expand_path(File.dirname(__FILE__) + '\/some_other_script')`\nI read ...
{"title":"In C# check that filename is *possibly* valid (not that it exists)","tags":["c#","validation","file"],"question_text":"Is there a method in the System.IO namespace that checks the validity of a filename?\nFor example,\n`C:\\foo\\bar`\nwould validate and\n`:\"~-*`\nwould not\nOr a little trickier,\n`X:\\foo\\b...
{"title":"JPA 2 CriteriaQuery, using a limit","tags":["java","sql","jpa","persistence","limit"],"question_text":"I am using JPA 2. For safety reasons, I am working type safe with CriteriaQuery's (and thus, I am not searching for any solutions of typed queries and so on).\nI have recently come across an issue in which I...
{"title":"Regex to check string contains only Hex characters","tags":["java","regex","validation"],"question_text":"I have never done regex before, and I have seen they are very useful for working with strings. I saw a few\ntutorials\n(for example) but I still cannot understand how to make a simple Java regex check for...
{"title":"Is there an elegant way to Invert a Bit value in an SQL insert Statement?","tags":["sql","sql-server","bit-manipulation"],"question_text":"I'm converting some data in SQL Server:\n`INSERT INTO MYTABLE (AllowEdit)\n(Select PreventEdit from SOURCETABLE)`\nso I need to inverse the bit value from source table. I ...
{"title":"How to change navbar collapse threshold using Twitter bootstrap-responsive?","tags":["css","ruby-on-rails-3","twitter-bootstrap"],"question_text":"I'm using Twitter Bootstrap 2.0.1 in a Rails 3.1.2 project, implemented with bootstrap-sass. I'm loading both the\n`bootstrap.css`\nand the\n`bootstrap-responsive....
{"title":"\"fatal: Not a git repository (or any of the parent directories)\" from git status","tags":["git","repository","clone","git-clone","git-status"],"question_text":"This command works to get the files and compile them:\n`git clone a-valid-git-url`\nfor example:\n`git clone git:\/\/cfdem.git.sourceforge.net\/gitr...
{"title":"Why is the new Tuple type in .Net 4.0 a reference type (class) and not a value type (struct)","tags":["performance","class","struct",".net-4.0"],"question_text":"Does anyone know the answer and\/or have an oppinion about it?\nSince tuples would normally not be very large I would assume it would make more sens...
{"title":"How to access at request attributes in JSP?","tags":["jsp","jstl","el"],"question_text":"Currently I use:\n`<%\nfinal String message = (String) request.getAttribute (\"Error_Message\");\n%>`\nand then\n`<%= message %>`\nHowever I wonder if the same can be done with EL or JSTL instead of using a scriptlet.","a...
{"title":"Atomically appending a line to a file and creating it if it doesn't exist","tags":["php"],"question_text":"I'm trying to create a function (for purposes of logging)\n`append($path, $data)`\nthat\ncreates $file if it doesn't exist and\natomically appends $data to it.\nIt has to\nsupport high concurrency,\nsupp...
{"title":"NuGet Behind Proxy","tags":["c#","msbuild","nuget"],"question_text":"I figure out that NuGet allows proxy settings configuration since 1.4 version. But, I can't find any command line example.\nI'm trying to run some build and NuGet can't connect.\nHow to configure the proxy settings in the command line?","ans...
{"title":"Do something every x minutes in Swift","tags":["ios","swift","setinterval","intervals","repeat"],"question_text":"How can I run a function every minute?\nIn JavaScript I can do something like\n`setInterval`\n, does something similar exist in Swift?\nWanted output:\nHello World once a minute...","answer_text":...
{"title":"Compare two JSON objects in Java","tags":["java","json","junit"],"question_text":"I'm looking for a JSON paring library that supports comparing two JSON objects ignoring child order, specifically for unit testing JSON returning from a web service against an expected value.\nDo any of the major JSON libraries ...
{"title":"How to mute an html5 video player","tags":["javascript","jquery","html5","video","mute"],"question_text":"I've found how to pause and play the video using jquery\n`$(\"video\").get(0).play();\n$(\"video\").get(0).pause();`\nBut I can't find the mute button, if there isn't a jquery solution, I'm fine with just...
{"title":"How to suppress Java warnings for specific directories or files such as generated code","tags":["java","eclipse","suppress-warnings","generated-code"],"question_text":"I'm using a parser generator that creates somewhat ugly code. As a result my Eclipse project has several dozen warnings emanating from generat...
{"title":"HTTP Content-Type Header and JSON","tags":["javascript","php","json","http"],"question_text":"Ok so I have always been trying to avoid using most of the HTTP protocol's properties or how ever you may please to call them for the sake of fear of the unknown. However I said to myself that I'm going to face fear ...
{"title":"Are there any differences between these two higher-order function definitions?","tags":["c++","c"],"question_text":"Are there any differences among 4 statements in main?\nI feel only apply2(&func) makes sense. However, all 4 return the same value.\n`int func(void) \n{\n return 1;\n}\nint apply1( int f1(void) ...
{"title":"Why does Heroku log using the server time rather than the Rails time zone?","tags":["ruby-on-rails","logging","time","timezone","heroku"],"question_text":"UPDATE: Ok, I didn't formulate a good Q to be answered. I still struggle with heroku being on -07:00 UTC and I at +02:00 UTC.\nQ: How do I get the log writ...
{"title":"Custom sort logic in OrderBy using LINQ","tags":["c#",".net","linq","sorting","sql-order-by"],"question_text":"What would be the right way to sort a list of strings where I want items starting with an underscore '_', to be at the bottom of the list, otherwise everything is alphabetical.\nRight now I'm doing s...
{"title":"How To Make iPhone App compatible with multiple SDK (firmware) versions","tags":["iphone","iphone-sdk-3.0","compatibility","ios4"],"question_text":"With iOS4 coming out soon, I have already planned to include an iAd in a future update of an app of mine. I assume that this will make my app unusable for anyone ...
{"title":"In Haskell, when do we use in with let?","tags":["haskell","scope","whitespace","where-clause","let"],"question_text":"In the following code, the last phrase i can put a \"in\" in front. Will it change anything? Another question: If i decide to put \"in\" in front of the last phrase, do i need to indent it? I...
{"title":"Joomla! 3 installation freezes at creating database table","tags":["mysql","installation","wampserver","freeze","joomla3.0"],"question_text":"I am trying to install Joomla! 3.2.1 on my system but the installation freezes half way through. I've downloaded and installed the Wamp Server 2.4 and wanted to locally...
{"title":"SQL grouping by month and year","tags":["sql","sql-server"],"question_text":"I'm not sure what should I write in the following SQL query to show 'date' column like this: \"month-year\" - \"9-2011\".\n`SELECT MONTH(date) + '.' + YEAR(date) AS Mjesec, SUM(marketingExpense) AS SumaMarketing, SUM(revenue) AS Suma...
{"title":"Integral operators quot vs. div","tags":["haskell"],"question_text":"Type class Integral has two operations\n`quot`\nand\n`div`\n, yet in the Haskell 2010 Language Report it is not specified what they're supposed to do. Assuming that\n`div`\nis integral division, what does\n`quot`\ndifferently, or what is the...
{"title":"jQuery - How to dynamically add a validation rule","tags":["jquery"],"question_text":"Hey,\nI'm trying to dynamically add a validation rule to some dynamic controls:\n`$(\"input[id*=Hours]\").rules(\"add\", \"required\");`\nHowever this line gives me the following error:\n$.data(element.form, \"validator\") i...
{"title":"Android Studio don't know where is Java","tags":["java","android","ubuntu","android-studio"],"question_text":"I am getting this error:\nCannot run program \"\/usr\/lib\/jvm\/java-1.7.0-openjdk-i386\/bin\/java\" (in directory \"\/home\/sergiy\/.AndroidStudioPreview\/system\/compile-server\"): error=2, No such ...
{"title":"How to switch between hide and view password","tags":["android","passwords"],"question_text":"Is there a clever way to let the user switch between hide and view password in an android EditText?\nA number of PC based apps let the user do this.","answer_text":"To show the dots instead of the password set the Pa...
{"title":"NSDictionary with ordered keys","tags":["iphone","objective-c","cocoa"],"question_text":"I'm curious if this is a situation any other folks have found themselves in. I have an NSDictionary (stored in a plist) that I'm basically using as an associative array (strings as keys and values). I want to use the arra...
{"title":"Fading elements in and out without changing the layout of the page","tags":["jquery","css","layout"],"question_text":"The normal behavior when using\n`fadeIn`\nand\n`fadeOut`\nis to use\nthe\n`display`\nproperty\n. However, this changes the layout of the page.\nHow can I make\n`fadeIn`\nand\n`fadeOut`\nnot mo...
{"title":"drawRect circle and animate size\/color","tags":["ios","ios5","core-animation","quartz-graphics"],"question_text":"I am drawing a circle in the\n`-drawRect:`\nmethod of my\n`UIView`\nusing the standard\n`CGContextFillEllipseInRect()`\ncode. However, I would like to slightly pulse (make larger and smaller) and...
{"title":"Difference between an LL and Recursive Descent parser?","tags":["parsing","grammar","context-free-grammar","recursive-descent","ll"],"question_text":"I've recently being trying to teach myself how parsers (for languages\/context-free grammars) work, and most of it seems to be making sense, except for one thin...
{"title":"Removing non-repository files with git?","tags":["git"],"question_text":"I'm writing Autotools code and in the process of development, tons of files are generated.\nIs there anyway to tell git to remove all files from a directory that are not part of the repository?\nThanks!","answer_text":"You can use\ngit-c...
{"title":"Windows Phone 8 Startscreen Tile sizes and margins","tags":["windows-phone","windows-phone-8"],"question_text":"I was wondering if someone knows the exact measurements of the new Windows Phone 8 Startscreen (for 480x800), i.e. margins (top, left & right, between tiles) and the edge length of all three differe...
{"title":"Haskell composition (.) vs F#'s pipe forward operator (|>)","tags":["haskell","f#","functional-programming","composition"],"question_text":"In F#, use of the the pipe-forward operator,\n`|>`\n, is pretty common. However, in Haskell I've only ever seen function composition,\n`(.)`\n, being used. I understand t...
{"title":"addClass - can add multiple classes on same div?","tags":["jquery"],"question_text":"jQuery add multiple class\nThis is my current code, I know its wrong code\n`$('.page-address-edit').addClass('test1').addClass('test2');`","answer_text":"`$('.page-address-edit').addClass('test1 test2 test3');`\nRef- jQuery",...
{"title":"\"Unable to open log device '\/dev\/log\/main': No such file or directory\"","tags":["android","android-2.3-gingerbread"],"question_text":"I am new to Android development and bought a cheap Huawei Sonic (U8650 apparently) so I could test my first attempts at making an app on an actual device.\nHowever, whenev...
{"title":"How is malloc() implemented internally?","tags":["c","memory","malloc","system-calls","sbrk"],"question_text":"Can anyone explain how\n`malloc()`\nworks internally?\nI have sometimes done\n`strace program`\nand I see a lot of\n`sbrk`\nsystem calls, doing\n`man sbrk`\ntalks about it being used in\n`malloc()`\n...
{"title":"MongoDB aggregation framework match OR","tags":["mongodb","aggregation-framework"],"question_text":"Is it possible to do an OR in the $match?\nI mean something like this:\n`db.articles.aggregate(\n { $or: [ $match : { author : \"dave\" }, $match : { author : \"john\" }] }\n);`","answer_text":"`$match: { $or: ...
{"title":"What is the difference between MySQL Server and MySQL Client","tags":["mysql","linux","ubuntu"],"question_text":"In Ubuntu I normally install both but what are the differences between the client and server for MySQL","answer_text":"The mysql server package will install the mysql database server which you can ...
{"title":"Round money to nearest 10 dollars in Javascript","tags":["javascript","decimal","rounding","money"],"question_text":"How can I round a decimal number in Javascript to the nearest 10? My math is pretty rubbish today, it could be the 2 hour sleep :\/\nSome sample cases\n`$2823.66 = $2820\n$142.11 = $140\n$9.49 ...
{"title":"JavaScript - cannot set property of undefined","tags":["javascript"],"question_text":"My code:\n`var a = \"1\",\n b = \"hello\",\n c = { \"100\" : \"some important data\" },\n d = {};\n d[a][\"greeting\"] = b;\n d[a][\"data\"] = c;\n console.debug (d);`\nI get the following error:\nUncaught TypeError: Cannot ...
{"title":"warning: iPad: Icon-72.png: icon dimensions (0 x 0)","tags":["objective-c","ios","xcode","ipad"],"question_text":"I got this problem: \"warning: iPad: Icon-72.png: icon dimensions (0 x 0) don't meet the size requirements. The icon file must be 72x72 pixels, in .png format (-19014)\" when build for archive the...
{"title":"Auto start print html page using javascript","tags":["javascript","html","printing"],"question_text":"Is there anyway to automatically run\n`javascript:window.print()`\nwhen the page finishes loading?","answer_text":"`<body onload=\"window.print()\">`\nor\n`window.onload = function() { window.print(); }`","qu...
{"title":"How to pass the id of an element that triggers an `onclick` event to the event handling function","tags":["javascript","html"],"question_text":"How do I pass the id of an element that triggers an\n`onclick`\nevent to the event handling function.\nI am doing something like this-\n`<link onclick=\"doWithThisEle...
{"title":"Migration to change default value for a field and change all existing record's value to new default value only if it has old default value.","tags":["mysql","ruby-on-rails"],"question_text":"I need to change the default value of a field from 0 to 3, but the catch is i have thousands of records already and wan...
{"title":"How should I set the default proxy to use default credentials?","tags":[".net","proxy"],"question_text":"The following code works for me:\n`var webProxy = WebProxy.GetDefaultProxy();\nwebProxy.UseDefaultCredentials = true;\nWebRequest.DefaultWebProxy = webProxy;`\nUnfortunately,\n`WebProxy.GetDefaultProxy()`\...
{"title":"C# - What will I miss if I start with .NET 2.0?","tags":["c#"],"question_text":"I got a book named \"Pro C# 2005 and the .NET 2.0 Platform, Third Edition by Andrew Troelsen\".\nI am wondering whether I should buy the \"Pro C# 2010 and the .NET 4 Platform, Fifth Edition\" instead. Since, the latest version of ...
{"title":"Why should I use foreach instead of for (int i=0; i<length; i++) in loops?","tags":["c#","java",".net","loops","foreach"],"question_text":"It seems like the cool way of looping in C# and Java is to use foreach instead of C style for loops.\nIs there a reason why I should prefer this style over the C style?\nI...
{"title":"Monkey Patching in Rails 3","tags":["ruby-on-rails"],"question_text":"What is the preferred way to Monkey Patch in Rails 3?\nI just want to add a method to the String class. I'm more looking at where to place the file.","answer_text":"The initializer directory is a good place to collect all those little scrap...
{"title":"How can I change the font of layout (XML) editor in Eclipse?","tags":["java","xml","eclipse","xml-editor"],"question_text":"I know how to change the font of \"java editor\" in Eclipse in\nWindows-> Preferences-> Appearance-> Colors and Fonts\nbut I could not find option for changing the font of \"layout edito...
{"title":"Performance ConcurrentHashmap vs HashMap","tags":["java","collections","hashmap"],"question_text":"How is the performance of ConcurrentHashMap compared to HashMap, especially .get() operation (I'm especially interested for the case of only few items, in the range between maybe 0-5000)?\nIs there any reason no...
{"title":"What's the best open source game to learn from?","tags":["open-source"],"question_text":"This question has been preserved for historical reasons, but it is not\n considered on-topic, so don't use it as an excuse to post something\n similar.\nMore info at\nhttp:\/\/stackoverflow.com\/faq\n.\nFor me to read co...
{"title":"Why does select SCOPE_IDENTITY() return a decimal instead of an integer?","tags":["sql-server","primary-key","scope-identity"],"question_text":"So I have a table with an identity column as the primary key, so it is an integer. So, why does\n`SCOPE_IDENTITY()`\nalways return a decimal value instead of an int t...
{"title":"Detect Scroll Up & Scroll down in ListView","tags":["android","android-listview","scrollbar"],"question_text":"I have the following requirement:\nAt first, data for page no: 2 is fetched from the server & the items\nare populated in a ListView.\nConsidering that both the prev page & next page are available in...
{"title":"How do you request static .html files under the ~\/Views folder in ASP.NET MVC?","tags":["asp.net-mvc","asp.net-mvc-routing"],"question_text":"I want to be able to request static\n`.html`\nfiles which are located in the\n`~\/Views`\nfolder.\nAccording to the documentation, the routing system checks to see if ...
{"title":"How to make rounded percentages add up to 100%","tags":["algorithm","math","percentage"],"question_text":"Consider the four percentages below, represented as\n`float`\nnumbers:\n`13.626332%\n 47.989636%\n 9.596008%\n 28.788024%\n -----------\n 100.000000%`\nI need to represent these percentages as whole numbe...
{"title":"How can I check if a file exists using Emacs Lisp?","tags":["emacs","elisp"],"question_text":"I would like emacs to mark files that are generated as read-only when they're opened. The part of the puzzle that I'm missing is how to check if a file \"exists\". I currently have the following:\n`;;\n;; get file ex...
{"title":"Instantly detect client disconnection from server socket","tags":[".net","c#","sockets","tcp","connection"],"question_text":"How can I detect that a client has disconnected from my server?\nI have the following code in my\n`AcceptCallBack`\nmethod\n`static Socket handler = null;\npublic static void AcceptCall...
{"title":"Haskell function execution time","tags":["haskell"],"question_text":"Is there a simple method to compute time of function execution in Haskell?","answer_text":"Simplest things is to just do ':set +s' in ghci, and then you can see the execution time of anything you run, along with memory usage.","question_code...
{"title":"Android: why setVisibility(View.GONE); or setVisibility(View.INVISIBLE); do not work","tags":["android"],"question_text":"I want my\n`DatePicker`\nand the button to be invisible in the begining. And when I press my magic button I want to setVisibility(View.Visible);\nThe problem here is when I\n`setVisibility...
{"title":"Oracle JDBC intermittent Connection Issue","tags":["java","oracle","jdbc"],"question_text":"I am experiencing a very strange problem\nThis is a very simple use of JDBC connecting to an Oracle database\n`OS: Ubuntu\nJava Version: 1.5.0_16-b02\n 1.6.0_17-b04\nDatabase: Oracle 11g Release 11.1.0.6.0`\nWhen I mak...
{"title":".NET TimeZoneInfo from Olson time zone","tags":["c#",".net","timezone"],"question_text":"How can I convert the following into a System.TimeZone or System.TimeZoneInfo?\n`{\n \"timeZone\": \"America\/Los_Angeles\", \n \"currentOffsetMs\": -25200000\n}`\nThis is data I'm getting back from a 3rd party web servic...
{"title":"Is there an Eclipse plugin to run system shell in the Console?","tags":["shell","eclipse-plugin"],"question_text":"Do you know of any Eclipse plugin to run a system shell in the included console?\nIt would be awesome. Dolphin, KDE's file navigator, has this feature, you can press F4 and a console shows locate...
{"title":"Python Requests and persistent sessions","tags":["python","python-requests"],"question_text":"I am using the\nrequests\nmodule (version 0.10.0 with Python 2.5).\nI have figured out how to submit data to a login form on a website and retrieve the session key, but I can't see an obvious way to use this session ...
{"title":"What is the difference between $.each(selector) and $(selector).each()","tags":["jquery","each"],"question_text":"What is the difference between this:\n`$.each($('#myTable input[name=\"deleteItem[]\"]:checked').do_something());`\nand this:\n`$('#myTable input[name=\"deleteItem[]\"]:checked').each(function() {...
{"title":"Getting Site Matching Query Does Not Exist Error after creating django admin","tags":["python","django","django-admin","django-sites"],"question_text":"I'm going through the standard Django tutorial to create an admin for an app. After commenting the admin related stuff in settings and running syncdb I'm gett...
{"title":"What is NHibernate?","tags":["asp.net","database","nhibernate"],"question_text":"As a followup to my\nprevious question\n. I am an ASP.NET Programmer, and am wondering how NHibernate would help me get my job done easier and more quickly than it would otherwise. Pretend I know nothing about NHibernate. What is...
{"title":"Is it possible to configure Paperclip to produce HTTPS urls?","tags":["ruby-on-rails","ruby-on-rails-3","paperclip"],"question_text":"I'm using Paperclip to manage user-uploaded images on a site that is served entirely under HTTPS. In order to avoid the silly security warnings on IE7\/IE8, I need to also serv...
{"title":"How to debug when running Robolectric tests in Android Studio?","tags":["android","debugging","gradle","android-studio","robolectric"],"question_text":"I need to run debug while my tests execution in Android Studio + Robolectric.\nEach time I try to run them by selecting\n`debug`\nfor the\n`test`\ntask from G...
{"title":"How do you set your Cocoa application as the default web browser?","tags":["objective-c","cocoa"],"question_text":"How do you set your Cocoa application as the default web browser?\nI want to create an application that is launched by default when the user clicks on an HTTP or HTTPS link in other applications ...
{"title":"How to capture stdout output from a Python function call?","tags":["python","stdout","capture"],"question_text":"I'm using a Python library that does something to an object\n`do_something(my_object)`\nand changes it. While doing so, it prints some statistics to stdout, and I'd like to get a grip on this infor...
{"title":"Is there a convenient function in objective-c \/ cocoa-touch to find a lowest number?","tags":["objective-c","cocoa-touch"],"question_text":"I have two numbers, and need to get returned the lower one. Is there any function I could use? Sure it's a easy task, I could do an if-statement. I just want to know.","...
{"title":"Create new variables from array keys in PHP","tags":["php","arrays","variables"],"question_text":"Suppose I have an array, like this:\n`$foo = array('first' => '1st',\n 'second' => '2nd',\n 'third' => '3rd');`\nHow can I pick the keys out of the array and make them their own variables?\nFor example, the array...
{"title":"How do I choose the last 2 items in a list with css nth-child?","tags":["css","css3","css-selectors"],"question_text":"Is it possible? If not, is there a way to do it with jQuery?","answer_text":"It is possible with CSS3. Consider the markup:\n`<ul>\n <li><a href=\"\">First item<\/a><\/li>\n <li>Second item<\...
{"title":"Generic way to detect if html form is edited","tags":["javascript","jquery","html"],"question_text":"I have a tabbed html form. Upon navigating from one tab to the other, the current tab's data is persisted (on the DB) even if there is no change to the data.\nI would like to make the persistence call only if ...
{"title":"How to count identical string elements in a Ruby array","tags":["ruby","arrays","count","element"],"question_text":"I have the following\n`Array = [\"Jason\", \"Jason\", \"Teresa\", \"Judah\", \"Michelle\", \"Judah\", \"Judah\", \"Allison\"]`\nHow do I produce a count for each\nidentical element\n?\n`Where:\n...
{"title":"What is the difference between NIB and XIB Interface Builder file formats?","tags":["cocoa","interface-builder"],"question_text":"What is difference between nib and xib in Interface Builder files?","answer_text":"As of Interface Builder version 3, a new file format (with extension .xib) has been added, which ...
{"title":"Heroku rails Procfile","tags":["ruby-on-rails","heroku"],"question_text":"I am very new to Heroku.\nI uploaded my Rails app to Heroku and would like to run it with Thin instead of Webrick. Following\nHeroku\u00e2\u0080\u0099s guide\nI am supposed to use\n`web: bundle exec rails server thin -p $PORT -e $RACK_E...
{"title":"How to change the border color(un-focused) of an EditText?","tags":["android","colors","android-edittext","border"],"question_text":"I changed the background color of the EditText to transperant. Now the EditText looks invisible when not focused. So how can I change the un-focused border color of EditText?\nW...
{"title":"How to save Console.WriteLine output to text file?","tags":["c#"],"question_text":"I have a program which outputs various results onto a command line console.\nHow to save the outputs to a text file via Stream Reader or other methods?\n`System.Collections.Generic.IEnumerable<String> lines = File.ReadAllLines(...
{"title":"Converting from signed char to unsigned char and back again?","tags":["c++","c","jni"],"question_text":"I'm working with JNI and have an array of type jbyte, where jbyte is represented as an signed char i.e. ranging from -128 to 127. The jbytes represent image pixels. For image processing, we usually want pix...
{"title":"Returning an NSString from an NSError","tags":["objective-c","nsstring","nserror"],"question_text":"I am using the\n`NSURLRequest`\nclass in my iPhone app, and the method that calls it returns an\n`NSString`\nwhich is great for when the connection goes through ok, but the issue is I need to convert the NSErro...
{"title":"how to add icon in alert dialog before each item?","tags":["android"],"question_text":"I am using an AlertDialog (see the below code). Now I want to put an image before each text.\nFor example, email icon then text \"Email\", Facebook icon then text \"Facebook\", etc.\nUsing the following code, how can I add ...
{"title":"C++ class member callback simple examples","tags":["c++","function","callback","member"],"question_text":"I know this has been asked so many times, and because of that it's difficult to dig through the cruft and find a simple example of what works.\nI've got this, it's simple and it works for\n`MyClass`\n...\...
{"title":"How to convert DATE to UNIX TIMESTAMP in shell script on MacOS","tags":["linux","osx","date","shell"],"question_text":"On Linux you can convert a date like \"2010-10-02\" to a unix timestamp in shell script by\n`date -d \"2010-10-02\" \"+%s\"`\nSince Mac OS does not have the equivalent\n-d\nfor\ndate\n. How d...
{"title":"Code cleanup in netbeans","tags":["java","ide","netbeans","formatting"],"question_text":"Is there something similar to the Eclipse cleanup rules (Preferences > Java > Code Style > Clean Up) in NetBeans?\nThe cleanup rules in eclipse will allow you to clean things up like organizing imports, removing unnecessa...
{"title":"Javascript Object push() function","tags":["javascript","json"],"question_text":"I have a javascript object (I actually get the data through an ajax request):\n`var data = {};`\nI have added some stuff into it:\n`data[0] = { \"ID\": \"1\"; \"Status\": \"Valid\" }\ndata[1] = { \"ID\": \"2\"; \"Status\": \"Inva...