text
stringlengths
74
309k
{"title":"Ruby 'require' error: cannot load such file","tags":["ruby","require"],"question_text":"I've one file, main.rb with the following content:\n`require \"tokenizer.rb\"`\nThe tokenizer.rb file is in the\nsame directory\nand its content is:\n`class Tokenizer\n def self.tokenize(string)\n return string.split(\" \"...
{"title":"Create SQLite Database and table","tags":["c#"],"question_text":"Within C# application code, I would like to create and then interact with one or more SQLite databases.\nWhat is the preferred method to initialize a new SQLite database file and open it for reading and writing?\nFollowing the database's creatio...
{"title":"Why (0-6) is -6 = False?","tags":["python","debugging","integer","cpython"],"question_text":"Possible Duplicate:\nPython \u201cis\u201d operator behaves unexpectedly with integers\nToday I tried to debug my project and after a few hours of analysing I'd got this:\n`>>> (0-6) is -6\nFalse`\nbut,\n`>>> (0-5) is...
{"title":"How to center a two-line text in a TextView on Android?","tags":["android","text","textview","multiline","text-alignment"],"question_text":"I want to let it looks like this:\n`| two |\n| lines |`\nHere is the current layout, not working at all.\n`<RelativeLayout\n android:layout_width=\"wrap_content\"\n andro...
{"title":"WAMP\/MySQL errors not in correct language","tags":["php","mysql","phpmyadmin","wampserver"],"question_text":"I've re-installed WAMP multiple times, searched literally hundreds of pages, and its not fixed this issue:\nI've looked inside the phpmyadmin config files, set:\n`$cfg['Lang'] = 'en-utf-8';`\nUninstal...
{"title":"Convert from ASCII string encoded in Hex to plain ASCII?","tags":["python","hex","ascii"],"question_text":"How can I convert from hex to plain ASCII in Python?\nNote that, for example, I want to convert \"0x7061756c\" to \"paul\".","answer_text":"A slightly simpler solution:\n`>>> \"7061756c\".decode(\"hex\")...
{"title":"How to show marker in Maps launched by geo uri Intent?","tags":["android"],"question_text":"I have a application where I want to show different locations (one at the time, picked by user input) by launching Google Maps with their specific geo-coords.\nI'm currently using this: (with real lat. and long. values...
{"title":"HTML: How to create a DIV with only vertical scroll-bars for long paragraphs?","tags":["css","html","overflow"],"question_text":"I want to show terms and condition note on my website. I dont want to use text field and also dont want to use my whole page. I just want to display my text in selected area and wan...
{"title":"How do I get the file name from a String containing the Absolute file path?","tags":["java","file","filenames","filepath"],"question_text":"`String`\nvariable contains a file name,\n`C:\\Hello\\AnotherFolder\\The File Name.PDF`\n. How do I only get the file name\n`The File Name.PDF`\nas a String?\nI planned t...
{"title":"Why does Python allow function calls with wrong number of arguments?","tags":["python"],"question_text":"Python is my first dynamic language. I recently coded a function call incorrectly supplying a wrong number of arguments. This failed with an exception at the time that function was called. I expected that ...
{"title":"C++ inheritance - inaccessible base?","tags":["c++","inheritance"],"question_text":"I seem to be unable to use a base class as a function parameter, have I messed up my inheritance?\nI have the following in my main:\n`int some_ftn(Foo *f) { \/* some code *\/ };\nBar b;\nsome_ftn(&b);`\nAnd the class Bar inher...
{"title":"Have WAMP start automatically upon Windows start-up (without logging on or any UAC interference)","tags":["apache","windows-7","wamp","wampserver"],"question_text":"I'm looking to have WAMP start when I switch on the computer. Ideally it would start without users even having to log on. I've added WAMP to the ...
{"title":"Android emulator freezing OS X v10.9 (Mavericks) with HAXM","tags":["android","osx","android-emulator","haxm"],"question_text":"I just updated to\nOS\u00a0X v10.9\n(Mavericks), and now whenever I start up any of my emulators, as soon as the emulator starts up, my entire computer freezes with a spinning progre...
{"title":"Why do we not have a virtual constructor in C++?","tags":["c++","constructor","virtual-functions"],"question_text":"Why does C++ not have a virtual constructor?","answer_text":"Hear it from the horse's mouth:).\nFrom Bjarne Stroustrup's C++ Style and Technique FAQ\nWhy don't we have virtual constructors?\nA v...
{"title":"what is the difference between GROUP BY and ORDER BY in sql","tags":["sql","mysql","database"],"question_text":"When do you use which in general? Examples are highly encouraged!\nI am referring so MySql, but can't imagine the concept being different on another DBMS","answer_text":"ORDER BY alters the order in...
{"title":"How to pass environment variables to docker containers?","tags":["docker","environment-variables"],"question_text":"I'm new to docker, and it's unclear how to access an external database from a container. Is the best way to hard-code in the connection string?\n`# Dockerfile\nENV DATABASE_URL amazon:rds\/conne...
{"title":"HTML5 Audio stop function","tags":["html5","html5-audio"],"question_text":"I am playing a small audio clip on click of each link in my navigation\nHTML Code:\n`<audio tabindex=\"0\" id=\"beep-one\" controls preload=\"auto\" >\n <source src=\"audio\/Output 1-2.mp3\">\n <source src=\"audio\/Output 1-2.ogg\">\n<...
{"title":"What's the '@' (at symbol) in the Redux @connect decorator?","tags":["javascript","reactjs","decorator","redux"],"question_text":"I am learning Redux with React and stumbled upon this code. I am not sure if it is\nRedux\nspecific or not, but I have seen the following code snippet in one of the examples.\n`@co...
{"title":"How to change text transparency in html\/css?","tags":["html","css"],"question_text":"I'm very new to html\/css and I'm trying to display some text as like 50% transparent. So far I have the html to display the text with full opacity\n`<html><font color=\\\"black\\\" face=\\\"arial\\\" size=\\\"4\\\">THIS IS ...
{"title":"LLVM vs clang on OS X","tags":["c++","c","gcc","llvm","clang"],"question_text":"I have a question concerning llvm, clang, and gcc on OS X.\nWhat is the difference between the llvm-gcc 4.2, llvm 2.0 and clang? I know that they all build on llvm but how are they different?\nBesides faster compiling, what is the...
{"title":"Error :Request header field Content-Type is not allowed by Access-Control-Allow-Headers","tags":["jquery","asp.net-mvc-4","oauth-2.0","asp.net-web-api"],"question_text":"I created an mvc4 web api project using vS2012. I used following tutorial to solve the Cross-Origin Resource Sharing, \"http:\/\/blogs.msdn....
{"title":"How to hide Twitter Bootstrap dropdown","tags":["jquery","twitter-bootstrap"],"question_text":"This is getting annoying \u2014 when I click on an item in a Bootstrap dropdown, the dropdown doesn't close. I have it set up to open a Facebox lightbox when you click the dropdown item but there is a problem with i...
{"title":"Use tnsnames.ora in Oracle SQL Developer","tags":["sql","oracle","tnsnames","oracle-sqldeveloper"],"question_text":"I am evaluating\nOracle SQL Developer\n.\nMy\n`tnsnames.ora`\nis populated, and a\n`tnsping`\nto a connection defined in\n`tnsnames.ora`\nworks fine. Still, SQL Developer does not display any co...
{"title":"Replace transparency in PNG images with white background","tags":["png","imagemagick","alpha-transparency"],"question_text":"I've got some PNG images with transparency, and I need to create versions with the image layer composed onto a white background. I've tried various things with Image Magick \"convert\" ...
{"title":"How do I specify \"close existing connections\" in sql script","tags":["sql","sql-server"],"question_text":"I'm doing active development on my schema in SQL Server 2008 and frequently want to rerun my drop\/create database script. When I run\n`USE [master]\nGO\nIF EXISTS (SELECT name FROM sys.databases WHERE ...
{"title":"Finding sum of elements in Swift array","tags":["arrays","swift"],"question_text":"What is the easiest (best) way to find the sum of an array of integers in swift?\nI have an array called multiples and I would like to know the sum of the multiples. Thank you in advance!","answer_text":"This is the easiest\/sh...
{"title":"Adding ID's to google map markers","tags":["javascript","google-maps"],"question_text":"I have a script that loops and adds markers one at a time.\nI am trying to get the current marker to have an info window and and only have 5 markers on a map at a time (4 without info windows and 1 with)\nHow would I add a...
{"title":"Can I use assert on Android devices?","tags":["android","assert"],"question_text":"I want to use the assert keyword in my android apps to destroy my app in some cases on the emulator, or my device during testing. Is this possible?\nIt seems that the emulator just ignores my asserts.","answer_text":"See the Em...
{"title":"jQuery Chosen reset","tags":["jquery","jquery-plugins","jquery-chosen"],"question_text":"I have a bunch of\n`select`\nelements in a form with which\nI am using the Jquery Chosen plugin\n. How can I reset the form? The following does not work:\n`<input type=\"reset\" \/>`","answer_text":"You'll need to reset t...
{"title":"Can I change the size of UIActivityIndicator?","tags":["iphone","uiactivityindicatorview"],"question_text":"Whatever size i give to it while allocation, it shows fixed size only. Is it possible to increase it?\nCode:\n`activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:\n CGRectMake(142.00, 21...
{"title":"What is the size limit of a post request?","tags":["php","internet-explorer","http","post"],"question_text":"Sorry if this is duplicate,I would think it would be but couldn't find anything.\nI have a flex application that I am posting data back to a php\/mysql server via IE. I haven't run into any problems ye...
{"title":"Why does in_array() wrongly return true with these (large numeric) strings?","tags":["php","arrays"],"question_text":"I am not getting what is wrong with this code. It's returning \"Found\", which it should not.\n`$lead = \"418176000000069007\";\n$diff = array(\"418176000000069003\",\"418176000000057001\");\n...
{"title":"Javascript: best Singleton pattern","tags":["javascript","singleton","design-patterns"],"question_text":"Possible Duplicate:\nSimplest\/Cleanest way to implement singleton in JavaScript?\nI'm using this pattern for singletons, in the example the singleton is PlanetEarth:\n`var NAMESPACE = function () {\n var ...
{"title":"MySQL > Table doesn't exist. But it does (or it should)","tags":["mysql","exists","database-table"],"question_text":"I did change the datadir of a MySQL installation and following some steps it worked fine. Every base I had was moved correctly but one.\nI can connect and USE the database, even SHOW TABLES ret...
{"title":"Difference between Lookup() and Dictionary(Of list())","tags":["c#",".net","vb.net","linq"],"question_text":"I'm trying to wrap my head around which data structures are the most efficient and when \/ where to use which ones.\nNow, it could be that I simply just don't understand the structures well enough, but...
{"title":"What are the rules for evaluation order in Java?","tags":["java","operator-precedence","order-of-evaluation"],"question_text":"I am reading some Java text and got the following code:\n`int[] a = {4,4};\nint b = 1;\na[b] = b = 0;`\nIn the text, the author did not give a clear explanation and the effect of the ...
{"title":"ModelState.IsValid == false, why?","tags":["asp.net-mvc","modelstate"],"question_text":"Where can I find the list of errors of which make the ModelState invalid? I didn't see any errors property on the ModelState object.","answer_text":"As you are probably programming in Visual studio you'd better take advant...
{"title":"What purpose does a <script> tag serve inside of a <noscript> tag?","tags":["javascript","html","noscript"],"question_text":"I've been on a \"view source\" spree lately on websites with interesting design and content. One of those websites,\nSquarespace\n, has blocks of\n`<script>`\ntags inside of a\n`<noscri...
{"title":"Java: Why is the Date constructor deprecated, and what do I use instead?","tags":["java","date","deprecated"],"question_text":"I come from the C# world, so not too experienced with Java yet. Was just told by Eclipse that the\n`Date`\nwas deprecated.\n`Person p = new Person();\np.setDateOfBirth(new Date(1985, ...
{"title":"Sending message to a specific ID in Socket.IO 1.0","tags":["socket.io","socket.io-1.0"],"question_text":"I want to sent data to one specific socket ID.\nWe used to be able to do this in the older versions:\n`io.sockets.socket(socketid).emit('message', 'for your eyes only');`\nHow would I go about doing someth...
{"title":"How to get UITextView to respect newlines in Interface Builder?","tags":["iphone","interface-builder","newline","uitextview"],"question_text":"I have a simple app with a\n`UITextView`\nembedded into a\n`UIScrollView`\n. Interface Builder won't let me add multiple newlines for spacing; when I hit return it see...
{"title":"How can I change or remove HTML5 form validation default error messages?","tags":["html5","validation"],"question_text":"For example I have a\n`textfield`\n. The field is mandatory, only numbers are required and length of value must be 10. When I try to submit form with value which length is 5, the default er...
{"title":"iPhone: Setting Navigation Bar Title","tags":["iphone","objective-c","uinavigationcontroller","uinavigationbar","uinavigationitem"],"question_text":"Hey all. I'm still pretty new to iPhone development, and I'm having a bit of trouble figuring out how to change the title of my Navigation Bar. On another questi...
{"title":"How to completely remove node.js from Windows","tags":["node.js","windows","npm","windows-7-x64"],"question_text":"I uninstalled my previous version of node.js (0.8.11) and downloaded the latest, 0.10.24 from the node.js website and installed it. However, after running\n`node --version`\n, it still indicates ...
{"title":"How to calculate age (in years) based on Date of Birth and getDate()","tags":["sql-server","sql-server-2005","select","date"],"question_text":"I have a table listing people along with their date of birth (currently a nvarchar(25))\nHow can I convert that to a date, and then calculate their age in years?\nMy d...
{"title":"JSON Naming Convention","tags":["json","json.net"],"question_text":"Is there a standard on JSON naming? I see most examples using all lower case separated by underscore (lower_case). But, can you use PascalCase or camelCase?","answer_text":"In this document\nGoogle JSON Style Guide\n(recommendations for build...
{"title":"What is the difference between the states selected, checked and activated in Android?","tags":["android","android-view","selected","checked"],"question_text":"I'd like to know what differs those states. I didn't find any webpage clarifying this.","answer_text":"The difference between Checked and Activated is ...
{"title":"Read fixed width text file","tags":["r","fixed-width"],"question_text":"I'm trying to load this ugly-formatted data-set into my R session:\nhttp:\/\/www.cpc.ncep.noaa.gov\/data\/indices\/wksst8110.for\n`Weekly SST data starts week centered on 3Jan1990\nNino1+2 Nino3 Nino34 Nino4\nWeek SST SSTA SST SSTA SST SS...
{"title":"Why is arr = [] faster than arr = new Array?","tags":["javascript","performance"],"question_text":"I ran this code and got the below result. I curious to know why\n`[]`\nis faster?\n`console.time('using[]')\nfor(var i=0; i<200000; i++){var arr = []};\nconsole.timeEnd('using[]')\nconsole.time('using new')\nfor...
{"title":"Content Security Policy \"data\" not working for base64 Images in Chrome 28","tags":["content-security-policy"],"question_text":"In this simple example I try to set a CSP Header with the meta http-equiv Header. I included a base64 Image and try to make Chrome to load the image.\nThe Internet told mit the data...
{"title":"Best way to \"negate\" an instanceof","tags":["java","syntax"],"question_text":"I was thinking if exist a better\/nicer way to negate a instanceof in Java.\nActually, I do something like:\n`if(!(str instanceof String)) { \/* do Something *\/ }`\nBut, I think that should exist a \"beautiful\" syntax to do this...
{"title":"Programmatically change the src of an img tag","tags":["javascript","html5","image","src"],"question_text":"How can I change the\n`src`\nattribute of an\n`img`\ntag using javascript?\n`<img src=\"..\/template\/edit.png\" name=edit-save\/>`\nat first I have a default src which is \"..\/template\/edit.png\" and...
{"title":"Android SharedPreferences in Fragment","tags":["android","android-fragments","sharedpreferences"],"question_text":"I am trying to read SharedPreferences inside Fragment. My code is what I use to get preferences in any other Activity.\n`SharedPreferences preferences = getSharedPreferences(\"pref\", 0);`\nI get...
{"title":"An item with the same key has already been added","tags":["asp.net-mvc"],"question_text":"I get this error whenever I submit the form also the action method is not being called because of this:\nAn item with the same key has already been added.\nAnd the exception details:\n[ArgumentException: An item with the...
{"title":"Merging two images","tags":["java","image-processing","transparency","alpha"],"question_text":"I need to merge two images (BufferedImage) in Java. It wouldn't be a problem if there was no transparency. The base image already has some transparency. I want to keep this as it is and apply a \"mask\" to it, the s...
{"title":"Use regular expression to find\/replace substring in NSString","tags":["objective-c","ios","regex","ios5"],"question_text":"I would like to use regular expression to find every instances of a regular expression pattern I.e.\n`&*;`\nin my string and remove that from so the return value is the original string w...
{"title":"How to use DockStyle.Fill for standard controls in WPF?","tags":["c#","wpf","tabcontrol","docking"],"question_text":"I'm very new to WPF. I'm used from windows forms, that I create a panel, place controls inside it and give them DockStyle.Fill to max out their size to the surrounding panel.\nIn WPF I want to ...
{"title":"Simple Log to File example for django 1.3+","tags":["django","django-settings"],"question_text":"The release notes say:\nDjango 1.3 adds framework-level\n support for Python\u00e2\u0080\u0099s logging module.\nThat's nice. I'd like to take advantage of that. Unfortunately\nthe documentation\ndoesn't hand it a...
{"title":"Is there a way to chain multiple value converters in XAML?","tags":["wpf","data-binding","xaml","ivalueconverter"],"question_text":"I've got a situation in which I need to show an integer value, bound to a property on my data context, after putting it through two separate conversions:\nReverse the value withi...
{"title":"No ActionBar in PreferenceActivity after upgrade to Support Library v21","tags":["android","android-support-library","preferenceactivity","android-5.0-lollipop"],"question_text":"After I upgraded to the Support Library v21 my ActionBar in my\n`PreferenceActivity`\nis gone.\nDid I miss some attributes in my th...
{"title":"Converting a Pandas GroupBy object to DataFrame","tags":["python","pandas"],"question_text":"I'm starting with input data like this\n`df1 = pandas.DataFrame( { \n \"Name\" : [\"Alice\", \"Bob\", \"Mallory\", \"Mallory\", \"Bob\" , \"Mallory\"] , \n \"City\" : [\"Seattle\", \"Seattle\", \"Portland\", \"Seattle...
{"title":"Can't start site in IIS (use by another process)","tags":["asp.net","iis"],"question_text":"When I try to start a site in IIS it says:\nthe process can't access the file because it used by another process\nI searched in Google and found that another site may have been using Port 80 but in MyIIS I see that onl...
{"title":"Getting rid of \\n when using .readlines()","tags":["python","python-2.7","readline"],"question_text":"I have a .txt file with values in it.\nThe values are listed like so:\n`Value1\nValue2\nValue3\nValue4`\nMy goal is to put the values in a list. When I do so, the list looks like this:\n['Value1\\n', 'Value2...
{"title":"C# - get line number which threw exception","tags":["c#","exception"],"question_text":"In a\n`catch`\nblock, how can I get the line number which threw an exception?","answer_text":"If you need the line number for more than just the formatted stack trace you get from Exception.StackTrace, you can use the\nStac...
{"title":"how to edit .csproj file","tags":["c#",".net","asp.net"],"question_text":"when I am compiling my .csproj file using .NET framework 4.0 MSBUILD.EXE file I am getting an error \"lable01\" not found in the current context of \"website01.csproj\"\nActually I need to add every ASP.NET page with its Code Behind fil...
{"title":"How to localise a string inside the iOS info.plist file?","tags":["ios","xcode","plist","beta"],"question_text":"As you might know the\niOS 8\nrequires\nNSLocationWhenInUseUsageDescription\nkey for using user's location. I have added this key and some general information into my info plist.\nHow can I use tra...
{"title":"Is it possible to send a variable number of arguments to a JavaScript function?","tags":["javascript","varargs"],"question_text":"Is it possible to send a variable number of arguments to a JavaScript function, from an array?\n`var arr = ['a','b','c']\nvar func = function()\n{\n \/\/ debug \n alert(arguments.l...
{"title":"javascript variable reference\/alias","tags":["javascript"],"question_text":"Is it possible in javascript to assign an alias\/reference to a local var someway?\nI mean something C-like:\n`function foo() {\n var x = 1;\n var y = &x;\n y++;\n alert(x); \/\/ prints 2 \n}`\n= EDIT =\nIs it possible to alias argum...
{"title":"Check if a folder exist in a directory and create them using C#","tags":["c#","asp.net","visual-studio"],"question_text":"How can I check if directory\n`C:\/`\ncontains a folder named\n`MP_Upload`\n, and if it does not exist, create the folder automatically?\nI am using Visual\u00a0Studio\u00a02005 C#.","answ...
{"title":"GROUP_CONCAT ORDER BY","tags":["mysql","sql-order-by","group-concat"],"question_text":"I've\na table\nlike:\n`+-----------+-------+------------+\n| client_id | views | percentage |\n+-----------+-------+------------+\n| 1 | 6 | 20 |\n| 1 | 4 | 55 |\n| 1 | 9 | 56 |\n| 1 | 2 | 67 |\n| 1 | 7 | 80 |\n| 1 | 5 | 66...
{"title":"How grunt watch files in sub folders?","tags":["javascript","gruntjs"],"question_text":"My codes folders and files like this, you never know how many sub folders in it:\n`js\/sub1\/a.js\njs\/sub2\/b.js\njs\/sub3\/sub31\/c.js\njs\/sub4\/sub41\/sub411\/d.js`\nHere is part of the Gruntfile.js:\n`grunt.initConfig...
{"title":"How to save a NSImage as a new file","tags":["cocoa","image","osx","file","nsimage"],"question_text":"How can I save a NSImage as a new file (png, jpg, ...) in a certain directory?","answer_text":"You could add a category to NSImage like this\n`@interface NSImage(saveAsJpegWithName)\n- (void) saveAsJpegWithNa...
{"title":"Download image from the site in .NET\/C#","tags":["c#",".net","image","streaming"],"question_text":"I am trying to download images from the site. The code which I am using is working fine while the image is available. If the image it not available it is creating a problem. How to validate availability of the ...
{"title":"Calculate difference between two datetimes in MySQL","tags":["mysql"],"question_text":"I am storing the last login time in MySQL in,\n`datetime`\n-type filed. When users logs in, I want to get the difference between the last login time and the current time (which I get using\n`NOW()`\n).\nHow can I calculate ...
{"title":"argparse: identify which subparser was used","tags":["python","argparse"],"question_text":"I think this must be easy but I do not get it.\nAssume I have the following arparse parser:\n`import argparse\nparser = argparse.ArgumentParser( version='pyargparsetest 1.0' )\nsubparsers = parser.add_subparsers(help='c...
{"title":"Phonegap Application text and layout too small","tags":["javascript","html","css","jquery-mobile","cordova"],"question_text":"I recently build an android app using html, css, javascript and running them through phonegap to create the actual app. One of the problems I encountered in one phone is that the text ...
{"title":"how do I convert an integer to binary in javascript?","tags":["javascript"],"question_text":"I'd like to see integers, positive or negative, in binary.\nRather like this question, but for javascript.\nPrint an integer in binary format in Java","answer_text":"`function dec2bin(dec){\n return (dec >>> 0).toStri...
{"title":"How to show one layout on top of the other programmatically in my case?","tags":["android","android-layout","android-emulator","android-widget","android-manifest"],"question_text":"My main layout\nmain.xml\nsimply contains two LinearLayouts:\nThe 1st\n`LinearLayout`\nhosts a\n`VideoView`\nand a\n`Button`\n,\n...
{"title":"Why are my basic Heroku apps taking two seconds to load?","tags":["ruby","performance","heroku"],"question_text":"I created two very simple Heroku apps to test out the service, but it's often taking several seconds to load the page when I first visit them:\nCropify\n- Basic Sinatra App (\non github\n)\nTextil...
{"title":"sql error errno: 121","tags":["mysql","sql","mysql-error-1064","mysql-error-1005"],"question_text":"`CREATE TABLE `users` (\n `UID` INT UNSIGNED NOT NULL AUTO_INCREMENT ,\n `username` VARCHAR(45) NOT NULL ,\n `password` VARCHAR(100) NULL ,\n `name` VARCHAR(100) NULL ,\n `gender` BIT NULL ,\n `email` VARCHAR(2...
{"title":"Automatic popping up keyboard on start Activity","tags":["android","keyboard","focus","android-edittext"],"question_text":"I got a relative simple question. I have an activity with a lot of EditText's in them. When I open the activity it automatically focusses to the first EditText and displays the virtual ke...
{"title":"How do you properly use namespaces in C++?","tags":["c++","namespaces"],"question_text":"I come from a Java background, where packages are used, not namespaces. I'm used to putting classes that work together to form a complete object into packages, and then reusing them later from that package. But now I'm wo...
{"title":"How can I read input from the console using the Scanner class in Java?","tags":["java","java.util.scanner"],"question_text":"How could I read input from the console using the\n`Scanner`\nclass? Something like this:\n`System.out.println(\"Enter your username: \");\nScanner = input(); \/\/ or something like thi...
{"title":"How to prevent multiple instances of an activity when it is launched with different intents","tags":["android","back-stack","activity-stack"],"question_text":"I've come across a bug in my application when it is launched using the\n\"Open\"\nbutton on the android market. It seems that launching it from the mar...
{"title":"Why does the CheckBoxFor render an additional input tag, and how can I get the value using the FormCollection?","tags":["asp.net","asp.net-mvc"],"question_text":"In my ASP.NET MVC app, I am rendering a checkbox using the following code:\n`<%= Html.CheckBoxFor(i=>i.ReceiveRSVPNotifications) %>`\nNow, I see tha...
{"title":"How to assign the output of a Bash command to a variable?","tags":["bash","shell"],"question_text":"I have a problem putting the content of\n`pwd`\ncommand into a shell variable that I'll use later.\nHere is my shell code (the loop doesn't stop):\n`#!\/bin\/bash\npwd= `pwd`\nuntil [ $pwd = \"\/\" ]\n do\n ech...
{"title":"react-router - pass props to handler component","tags":["javascript","properties","reactjs","react-router"],"question_text":"I have such structure of my React.js app with ReactRouter (\nhttps:\/\/github.com\/rackt\/react-router\n):\n`var Dashboard = require('.\/Dashboard');\nvar Comments = require('.\/Comment...
{"title":"Different return values the first and second time with Moq","tags":["c#","unit-testing","nunit","moq"],"question_text":"I have a test like this:\n`[TestCase(\"~\/page\/myaction\")]\n public void Page_With_Custom_Action(string path) {\n \/\/ Arrange\n var pathData = new Mock<IPathData>();\n var pageModel = new...
{"title":"String strip() for JavaScript?","tags":["javascript","trim","strip"],"question_text":"What's a clean and efficient JavaScript implementation to strip leading and trailing spaces from a string?\nFor example:\n`\" dog\"`\n`\"dog \"`\n`\" dog \"`\n`\" dog \"`\nall get turned into\n`\"dog\"`","answer_text":"Use t...
{"title":"How to zip a whole folder using PHP","tags":["php","zip"],"question_text":"I have found here at stackoveflow some codes on how to ZIP a specific file, but how about a specific folder?\n`Folder\/\n index.html\n picture.jpg\n important.txt`\ninside in\n`My Folder`\n, there are files. after zipping the\n`My Fold...
{"title":"What are the most common font-sizes for H1-H6 tags","tags":["html","css","frontend"],"question_text":"I've always been unsure of where to start as a general best practice baseline. Yes, I know it depends on your design -- but what's most common?\nHere's what I currently have as a starter:\n`h1 { font-size: 24...
{"title":"console.log timestamps in Chrome?","tags":["javascript","google-chrome"],"question_text":"Is there any quick way of getting Chrome to output timestamps in\n`console.log`\nwrites (like Firefox does). Or is prepending\n`new Date().getTime()`\nthe only option?","answer_text":"In Chrome, there is the option is Co...
{"title":"Reposition scroll bar of ListView with padding","tags":["android","listview","scrollbar"],"question_text":"I have a\n`ListView`\nwith padding to the right (and left).\nCurrently the list looks something like this:\n`----------------- |\n| ROW | | |\n|-------------| | |\n| ROW | | |\n|-------------|#| |\n| ROW...
{"title":"How to handle Handler messages when activity\/fragment is paused","tags":["android","android-fragments"],"question_text":"Slight variation on my\nother posting\nBasically I have a message\n`Handler`\nin my\n`Fragment`\nwhich receives a bunch of messages that can result in dialogs being dismissed or shown.\nWh...
{"title":"How to build jars from IntelliJ properly?","tags":["java","intellij-idea","jar","build-process"],"question_text":"I have a project that contains a single module, and some dependencies.\nI'd like to create a jar, in a separate directory, that contains the compiled module. In addition, I'd like to have the depe...
{"title":"Can I disable autolayout for a specific subview at runtime?","tags":["xcode","xcode4","interface-builder","xcode4.3","autolayout"],"question_text":"I have a view that needs to have its frame manipulated programmatically - it's a kind of document view that wraps to its content which is then scrolled and zoomed...
{"title":"Can num++ be atomic for 'int num'?","tags":["c++","c","multithreading","assembly","atomic"],"question_text":"In general, for\n`int num`\n,\n`num++`\n(or\n`++num`\n), as a read-modify-write operation, is\nnot atomic\n. But I often see compilers, for example\nGCC\n, generate the following code for it (\ntry her...
{"title":"How should I escape commas and speech marks in CSV files so they work in Excel?","tags":["java","excel","csv","special-characters"],"question_text":"I'm generating a CSV file (delimited by commas rather than tabs). My users will most likely open the CSV file in Excel by double clicking it. My data may contain...
{"title":"Convert HTML to PDF in .NET","tags":["c#","html","pdf","itextsharp"],"question_text":"I want to generate a PDF by passing HTML contents to a function. I have made use of iTextSharp for this but it does not perform well when it encounters tables and the layout just gets messy.\nIs there a better way?","answer_...
{"title":"Get hours difference between two dates in Moment Js","tags":["javascript","date","momentjs"],"question_text":"I'm able to get the difference between two dates using MomentJs as follows:\n`moment(end.diff(startTime)).format(\"m[m] s[s]\")`\nHowever, I also want to display the hour when applicable (only when >=...