text
stringlengths
74
309k
{"title":"Animation when changing textview","tags":["android","animation","textview"],"question_text":"I currently use a major workaround and have two activities switching each time I change the text on a TextView. I am using this code:\n`Weeklytext.this.overridePendingTransition( \n R.anim.slide_in_left, \n R.anim.sli...
{"title":"Why does \"return list.sort()\" return None, not the list?","tags":["python","list","sorting","return"],"question_text":"Purpose:\nAccept a file name\nPrint out the unique words alphabetically\nProblem:\nThe file runs, and I've been able to verify that the\n`findUniqueWords`\ndoes result in a sorted list. How...
{"title":"Check for file exists or not in sql server?","tags":["sql","sql-server","sql-server-2008"],"question_text":"Solution :\nhttp:\/\/www.tech-recipes.com\/rx\/30527\/sql-server-how-to-check-if-a-file-exists-in-a-directory\/\nMade a post about this question using stackoverflow question to help others.\n`id filepat...
{"title":"What is an opaque pointer in C?","tags":["c","pointers"],"question_text":"Possible Duplicate:\nWhat is an opaque value?\nMay I know the usage and logic behind the opaque pointer concept in C?","answer_text":"An opaque pointer is one in which no details are revealed of the underlying data (from a dictionary de...
{"title":"How to escape a pipe char in a code statement in a markdown table?","tags":["table","github","escaping","pipe","markdown"],"question_text":"On GitHub I want to build a table containing pieces of code in Markdown. It works fine except when I put a pipe char (i.e. | ) between the backtick (i.e. ` ) chars.\nHere...
{"title":"Rails Routing (root :to => ...)","tags":["ruby-on-rails","ruby","ruby-on-rails-3","routes","url-routing"],"question_text":"I know how to set the routes root of my rails app to a controller and an action.\nBut how to add an id?\n`\/pages\/show\/1`\nshould be the root.\nHow do I set this?","answer_text":"Had th...
{"title":"Copy folder recursively in node.js","tags":["javascript","node.js"],"question_text":"Is there an easier way to copy a folder and all its content without manually doing a sequence of\n`fs.readir`\n,\n`fs.readfile`\n,\n`fs.writefile`\nrecursively ?\nJust wondering if i'm missing a function which would ideally w...
{"title":"Closing Applications","tags":["c#"],"question_text":"What is best practice when closing a C# application?\nI have read that you can use:\n`Environment.Exit(0); or Application.Exit();`\nBut what is the difference?\nFurthermore, with regards to Environment.Exit(0), I have used exit codes before when working wit...
{"title":"How to read system.net\/mailSettings\/smtp from Web.config","tags":["c#","web-config","smtp","sendmail"],"question_text":"This is my\n`web.config`\nmail settings:\n`<system.net>\n <mailSettings>\n <smtp deliveryMethod=\"Network\" from=\"smthg@smthg.net\">\n <network defaultCredentials=\"true\" host=\"localhos...
{"title":"Java: A two dimensional array is stored in column-major or row-major order?","tags":["java","memory","multidimensional-array","performance"],"question_text":"In Java, is a multidimensional array stored in column-major or row-major order?","answer_text":"Java doesn't have multi-dimensional arrays. It has array...
{"title":"Visual Studio 2010 debug not starting, F5 or click on \"Play\" not working, not doing anything. Waiting 2-3 minutes solves the issue","tags":[".net","visual-studio-2010","debugging","c#-4.0"],"question_text":"I have a relatively simple C# (Framework 4) console application. When I click the \"Play\" icon or hi...
{"title":"How Do I Force Redrawing (drawRect) of a SubView When it Changes Dimensions?","tags":["ios","objective-c","iphone","uiview","uikit"],"question_text":"I have a UIView that contains a row of subclasses of\n`UIView`\n. The subclass has overridden\n`drawRect`\n: and has set\n`contentMode = UIViewContentModeRedraw...
{"title":"What is the branch in the destructor reported by gcov?","tags":["c++","gcc","code-coverage","gcov"],"question_text":"When I use gcov to measure test coverage of C++ code it reports branches in destructors.\n`struct Foo\n{\n virtual ~Foo()\n {\n }\n};\nint main (int argc, char* argv[])\n{\n Foo f;\n}`\nWhen I ...
{"title":"Django: allow line break from textarea input","tags":["html","django"],"question_text":"How do i allow line breaking in textarea input in django to later show this input on page?","answer_text":"linebreaks\nReplaces line breaks in plain text with appropriate HTML; a single newline becomes an HTML line break (...
{"title":"Strange JavaScript idiom - what does \"\/xyz\/.test(function(){xyz;})\" do?","tags":["javascript","regex","function"],"question_text":"John Resig wrote a nifty Class function, swanky. I'm trying to figure out what is going on, and have pretty much everything figured out except a single line:\n`fnTest = \/xyz\...
{"title":"Throwing exceptions in switch statements when no specified case can be handled","tags":["c#","exception","switch-statement"],"question_text":"I've been writing C# for the last 8 years and have become quite the defensive OOP programmer. Working in a statically-typed language, you do things like validate argume...
{"title":"Disable Eclipse ctrl-click","tags":["eclipse"],"question_text":"I'm very used to having\nCtrl\n-click select the word below my cursor and in Eclipse the authors seem to think it's better to make it move to the definition. I disagree, but can't find how\/where to fix this. Searching on the internet and on here...
{"title":"Undefined symbols for architecture armv7 while integrating speechkit of nuance dragon mobile","tags":["ios","speech-recognition"],"question_text":"I integrating my app with speechkit of naunce dragon mobile when run i am below error:\n`Undefined symbols for architecture armv7:\n \"_kCFStreamPropertySSLPeerCer...
{"title":"jQuery draggable and droppable between two containers and sortable","tags":["jquery","jquery-ui-sortable","jquery-ui-draggable","jquery-ui-droppable"],"question_text":"Im trying to develop a small page that has the following functionality:\nPage will have two divs: one being #origin, containing a lot of thumb...
{"title":"Where to put user defined functions in Angular JS?","tags":["javascript","model-view-controller","scope","angularjs"],"question_text":"In my view, I want to render:\n`<p>\n {{ say() }}\n<\/p>`\nWhere\n`say`\nis defined as such:\n`say = function() {\n return \"Hello World\";\n}`\nI can define it in my controll...
{"title":"What are RESTful web services?","tags":["web-services","rest"],"question_text":"Possible Duplicate:\nWhat exactly is RESTful programming?\nWhat are RESTful web services? What would be an example of it?\nWhat is difference between the asmx web services and the WCF restful service?","answer_text":"REST is a cli...
{"title":"Move cursor x lines from current position in vi\/vim","tags":["vim","vi"],"question_text":"Is there a way to move the cursor a relative amount of lines in vi\/vim? Say you have the cursor 10 lines under a block of code you want to remove. If you have the line numbers shown in relative order, it would be nice ...
{"title":"In Python, is it possible to escape newline characters when printing a string?","tags":["python","escaping","newline"],"question_text":"I want the newline\n`\\n`\nto show up explicitly when printing a string retrieved from elsewhere. So if the string is 'abc\\ndef' I don't want this to happen:\n`>>> print(lin...
{"title":"Change Android LogCat font in Eclipse","tags":["android","eclipse"],"question_text":"I can't seem to find the preference for changing the Android's LogCat debug output font in Eclipse. Can it be changed at all? How? I don't mind editing some preference file somewhere by hand, as long as it works.","answer_tex...
{"title":"Visual Studio 2015 break on unhandled exceptions not working","tags":["c#","exception-handling","visual-studio-2015","unhandled-exception"],"question_text":"Visual studio used to have a specific checkbox to \"Break on Un-handled exception\". In 2015 this has been removed (or moved somewhere I cannot find it)....
{"title":"How to store directory files listing into an array?","tags":["bash","shell"],"question_text":"I'm trying to store the files listing into an array and then loop through the array again. \nBelow is what I get when I run\n`ls -ls`\ncommand from the console.\n`total 40\n36 -rwxrwxr-x 1 amit amit 36720 2012-03-31 ...
{"title":"Node.js \"FATAL ERROR: JS Allocation failed - process out of memory\" -- possible to get a stack trace?","tags":["node.js"],"question_text":"Well... I'm back to square one. I can't figure this out for the life of me.\nI'm getting the following error:\n`FATAL ERROR: JS Allocation failed - process out of memory...
{"title":"Service variable not updating in controller","tags":["angularjs"],"question_text":"I have a NavbarCtrl that is outside of ng-view. I have a login controller that talks to a service to get a user logged in. Once the user is logged in, I want the Navbar to update with the user's email address. However for the l...
{"title":"How to create hibernate composite key using annotations","tags":["hibernate","hibernate-mapping","hibernate-annotations","nhibernate-queryover"],"question_text":"I am trying to use\n`hibernate annotations`\nto insert data to a\n`MySQL database`\ntable which doesn't have a primary key defined.\nHowever the fac...
{"title":"Waiting on a Task with a OnlyOnFaulted Continuation causes an AggregateException","tags":["c#","parallel-processing","task","task-parallel-library","pfx"],"question_text":"I have some simple code as a repro:\n`var taskTest = Task.Factory.StartNew(() =>\n{\n System.Threading.Thread.Sleep(5000);\n}).ContinueWit...
{"title":"Capture iOS Simulator video for App Preview","tags":["ios","ios-simulator","ios8","video-capture","screen-capture"],"question_text":"Okay, so we can now submit video previews of our apps on the App Store. According to Apple we should do so with an iOS8 device and\n`OSX 10.10.`\nThe problem is you have to have...
{"title":"How can I create an instance of an arbitrary Array type at runtime?","tags":["c#","reflection","compact-framework",".net-2.0"],"question_text":"I'm trying to deserialize an array of an type unknown at compile time. At runtime I've discovered the type, but I don't know how to create an instance.\nSomething lik...
{"title":"Explode that doesn't return empty strings?","tags":["php"],"question_text":"PHP's explode function returns an array of strings split on some provided substring. It will return empty strings like this:\n`var_dump(explode('\/', '1\/2\/\/3\/'));\narray(5) {\n [0]=>\n string(1) \"1\"\n [1]=>\n string(1) \"2\"\n [...
{"title":"Reschedule timer in android","tags":["android","timer","scheduling"],"question_text":"How can I reschedule a timer. I have tried to cancel the timer\/timertask and and schedule it again using a method. But its showing an exception error:\nException errorjava.lang.IllegalStateException: TimerTask is scheduled ...
{"title":"How to get every possibile pattern of an array of letters","tags":["c#","javascript","algorithm"],"question_text":"Possible Duplicate:\nAre there any better methods to do permutation of string?\nLets say I have the letters\na b c d\nand I want to get every single possible pattern\/combination of these letters...
{"title":"Can you disable rotation globally in an iOS app?","tags":["ios","xcode"],"question_text":"I have an app made up of a lot of view controllers... in the project summary I've set Portrait orientation as the only supported device orientation.\nHowever, the app still gets messed up when turned sideways.\nMy questi...
{"title":"Discard millisecond part from timestamp","tags":["sql","postgresql","casting","timestamp","rounding"],"question_text":"How can I discard\/round the\n`millisecond`\npart, better if the\n`second`\npart is also removed from a\n`timestamp`\nw\/o\n`timezone`\n?","answer_text":"Cast it to\n`timestamp(0)`\nor\n`time...
{"title":"Java equivalent to PHP's preg_replace_callback","tags":["java","php","regex","preg-replace"],"question_text":"I'm in the process of moving an application from PHP to Java and there is heavy use of regular expressions in the code. I've run across something in PHP that doesn't seem to have a java equivalent:\n`...
{"title":"Common Table Expression, why semicolon?","tags":["sql","sql-server","tsql","sql-server-2008","common-table-expression"],"question_text":"Usually in\n`SQL Server`\nCommon Table Expression clause there is semicolon in front of the statement, like this:\n`;WITH OrderedOrders AS --semicolon here\n(\n SELECT Sales...
{"title":"Java \"user.dir\" property - what exactly does it mean?","tags":["java"],"question_text":"I want to use user.dir dir as a base dir for my unit tests (that creates a lot of files). Is it correct that this property points to the current working directory (e.g. set by the 'cd' command)?","answer_text":"It's the ...
{"title":"Change default Python version from 2.4 to 2.6","tags":["python","linux","version"],"question_text":"I'm wanting to use some newer software that requires Python\n`2.6`\n, and we currently have both\n`2.4`\nand\n`2.6`\ninstalled on our dedicated CentOS server, which looks like this:\n`$ which python\n\/usr\/loc...
{"title":"Magento Request - Frontend or Backend?","tags":["php","magento"],"question_text":"How can I tell if the current request is for a backend or frontend page? This check will be done inside an observer, so I do have access to the request object if that helps.\nI considered checking\n`Mage::getSingleton('admin\/se...
{"title":"Map shift-tab in vim to inverse tab in Vim","tags":["vim","map","tabs","key","shift"],"question_text":"I've done some searching and found a wealth of information on binding keys in vim, but I can't find out, for sure, how to map shift-tab. Or what command I need to map it to for it to \"tab backwards\".\nThis...
{"title":"How do you do a \u00e2\u0080\u0098Pause\u00e2\u0080\u0099 with PowerShell 2.0?","tags":["powershell"],"question_text":"OK, I'm losing it. PowerShell is annoying me. I'd like a pause dialog to appear, and it won't.\n`PS W:\\>>> $host.UI.RawUI.ReadKey(\"NoEcho,IncludeKeyDown\")\nException calling \"ReadKey\" wi...
{"title":"Want html form submit to do nothing","tags":["javascript","html","ajax","forms","submit"],"question_text":"I want an html form to do nothing after it has been submitted.\n`action=\"\"`\nis no good because it causes the page to reload.\nBasically i want an ajax function to be called whenever a button is presse...
{"title":"sql: check if entry in table A exists in table B","tags":["sql","exists"],"question_text":"I have a definition table that I know is not being maintained very well, lets call this\n`table A`\n. I have another table (call it\n`table B`\n) that is much smaller and ideally should be a\n`subset of table A`\nbut I ...
{"title":"A long-running Parse operation is being executed on the main thread","tags":["ios","objective-c","parse.com"],"question_text":"I am getting the error:\n\"A long-running Parse operation is being executed on the main thread. Break on warnParseOperationOnMainThread() to debug.\"\nand\n\"Break on warnParseOperati...
{"title":"How is set() implemented?","tags":["python","data-structures","set","cpython"],"question_text":"I've seen people say that\n`set`\nobjects in python have O(1) membership-checking. How are they implemented internally to allow this? What sort of data structure does it use? What other implications does that imple...
{"title":"Emulate Nexus 7","tags":["android","android-emulator"],"question_text":"I want to emulate the Nexus 7, but I can't figure out what values to use.\nSkin: Built-in or custom resolution? What hardware properties should I use?","answer_text":"If you're running the latest version of the plugin (20) then when you'r...
{"title":"How to know whether a RecyclerView \/ LinearLayoutManager is scrolled to top or bottom?","tags":["android","recyclerview"],"question_text":"Currently I am using the follow code to check whether SwipeRefreshLayout should be enabled.\n`private void laySwipeToggle() {\n if (mRecyclerView.getChildCount() == 0 || ...
{"title":"remove whitespace from each array item rails","tags":["ruby-on-rails","ruby","arrays"],"question_text":"I found this code:\n`.each_key {|a| self[a].strip! if self[a].respond_to? :strip! }`\non this website:\nhttp:\/\/granth.ca\/2006\/02\/strip-whitespace\nbut I assume that is for a hash, I am trying to do the...
{"title":"C++ Compare char array with string","tags":["c++","string","string-comparison"],"question_text":"I'm trying to compare a character array against a string like so:\n`const char *var1 = \" \";\nvar1 = getenv(\"myEnvVar\");\nif(var1 == \"dev\")\n{\n \/\/ do stuff\n}`\nThis if statement never validates as true......
{"title":"Interactive text fields with Fabric.js","tags":["html","text","canvas","fabricjs"],"question_text":"I've been playing with Fabric.js a lot in the last few weeks, but regarding text fields I've only found it possible to set the text on creation.\nIs there any possible way to make an interactive text field, or ...
{"title":"Get the page file name from the address bar","tags":["javascript","jquery","html"],"question_text":"I was wondering if it would be possible to get the page name from the address bar using jquery or javascript. I know this can be done using PHP but don't really want to as it is only a html website.\nI.e. if th...
{"title":"iOS CoreBluetooth : centralManager:didConnectPeripheral \/ didFailToConnectPeripheral: not getting called","tags":["ios","objective-c","delegates","bluetooth-lowenergy","core-bluetooth"],"question_text":"I'm pulling my hair out of this problems. I'm trying to\nconnect to BLE devices\n, can't see what I've don...
{"title":"Git error on git pull (unable to update local ref)","tags":["git","command-line-interface"],"question_text":"I only have branch master and im getting this error every time i try to \"git pull\":\n`error: Couldn't set refs\/remotes\/origin\/master\nFrom \/var\/lib\/git\/xxx\/project\n ! a0f80ea..49177a3 master...
{"title":"Laravel Eloquent groupBy() AND also return count of each group","tags":["laravel","laravel-4","eloquent"],"question_text":"I have a table that contains, amongst other columns, a column of browser versions. And I simply want to know from the record-set, how many of each type of browser there are. So, I need to...
{"title":"Using Address Instead Of Longitude And Latitude With Google Maps API","tags":["javascript","google-maps","google-maps-api-3","latitude-longitude","street-address"],"question_text":"I've heard that it is possible to submit an Address instead of Longitude and Latitude and this would be much more feasible for my...
{"title":"C++ Undefined Reference to vtable and inheritance","tags":["c++","inheritance","vtable"],"question_text":"File A.h\n`#ifndef A_H_\n#define A_H_\nclass A {\npublic:\n virtual ~A();\n virtual void doWork();\n};\n#endif`\nFile Child.h\n`#ifndef CHILD_H_\n#define CHILD_H_\n#include \"A.h\"\nclass Child: public A ...
{"title":"python getoutput() equivalent in subprocess","tags":["python","shell","command","subprocess"],"question_text":"I want to get the output from some shell commands like\n`ls`\nor\n`df`\nin a python script. I see that\n`commands.getoutput('ls')`\nis deprecated but\n`subprocess.call('ls')`\nwill only get me the re...
{"title":"Javascript: Uncaught TypeError: Cannot call method 'addEventListener' of null","tags":["javascript","addeventlistener"],"question_text":"I'm trying to do something fairly simple, but for the reason of me probably not being good enough to search documentation, I can't get this to work.\nI have a functioning in...
{"title":"Application Crash on NSIndexPath use in iOS5","tags":["iphone","ios"],"question_text":"`#define PROPERTY_SECTION 0\n#define SUBTOTAL_ROW 0\nUITableViewCell *subtotalCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForItem:SUBTOTAL_ROW inSection:PROPERTY_SECTION]];`\nWhen i debug it in ios 6 ...
{"title":"How to redirect all pages only to index.html using htaccess file and not redirect the image files","tags":["image",".htaccess"],"question_text":"How to redirect all pages (pages only) to index.html using htaccess file and not redirect the image files. For some reason I am using this code and an image file on ...
{"title":"How to log an long long value with NSLog?","tags":["iphone","cocoa","nslog"],"question_text":"How can I do that? What's the format specifier?\nFor example, I have:\n`long long veryLong = \/\/ assume value here\nNSLog(@\"%f\", veryLong); \/\/ of course wrong...`","answer_text":"`long long veryLong = \/\/ assum...
{"title":"How to access\/update $rootScope from outside Angular","tags":["angularjs","rootscope"],"question_text":"My application initializes an object graph in $rootScope, like this ...\n`var myApp = angular.module('myApp', []);\nmyApp.run(function ($rootScope) {\n $rootScope.myObject = { value: 1 };\n});`\n... and th...
{"title":"How to save a dictionary to a file in Python?","tags":["python","file","dictionary","python-3.x"],"question_text":"I have problem with changing a dict value and saving the dict to a text file (the format must be same), I only want to change the\n`member_phone`\nfield.\nMy text file is the following format:\n`...
{"title":"FragmentStatePagerAdapter with ChildFragmentManager - FragmentManagerImpl.getFragment results in NullPointerException","tags":["android","android-fragments","android-support-library"],"question_text":"EDIT 2\nI now managed to get rid of the error with using the trick from here\nhttps:\/\/code.google.com\/p\/a...
{"title":"Full Screen in customize theme","tags":["android","android-theme","android-styles"],"question_text":"My app need to show as full screen, now I know how to add this feature into application tag in Mainfest using\n`android:theme=\u00e2\u0080\u009d@android:style\/Theme.NoTitleBar.Fullscreen\"`\nHowever, I have m...
{"title":"Convert a number to a list of integers","tags":["python","list","integer"],"question_text":"How do I write the\n`magic`\nfunction below?\n`>>> num = 123\n>>> lst = magic(num)\n>>>\n>>> print lst, type(lst)\n[1, 2, 3], <type 'list'>`","answer_text":"You mean this?\n`num = 1234\nlst = [int(i) for i in str(num)]...
{"title":"How to find prime numbers between 0 - 100?","tags":["javascript","math","primes"],"question_text":"In Javascript how would i find prime numbers between 0 - 100? i have thought about it, and i am not sure how to find them. i thought about doing x % x but i found the obvious problem with that.\nthis is what i h...
{"title":"How to get column value from sqlite cursor?","tags":["android","sqlite","cursor"],"question_text":"I am trying to get column value from cursor, this column is generated at run time by calculations inside the query, i am getting null value of this column , i am able to get value of all other columns which exis...
{"title":"What does `T {}` do in Scala","tags":["scala","shapeless"],"question_text":"Browsing Shapeless code, I came across this seemingly extraneous\n`{}`\nhere\nand\nhere\n:\n`trait Witness extends Serializable {\n type T\n val value: T {}\n}\ntrait SingletonOps {\n import record._\n type T\n def narrow: T {} = witn...
{"title":"How can I release locks in Subversion recursively?","tags":["version-control","locking","svn"],"question_text":"I am having a problem with version control in Subversion. I checked out a working copy from respository and got locks on all of its files. Then, without releasing the locks I have deleted the folder...
{"title":"Apache server ignores .htaccess","tags":["php",".htaccess","kohana-3","gentoo"],"question_text":"I'm trying to get a website working on my test environment, but somehow it is not working. I can load the normal index page, but when I want to access \/page\/test it throws an error saying the page does not exist...
{"title":"Executable war file that starts jetty without maven","tags":["java","executable","jetty","manifest","war"],"question_text":"I'm trying to make an \"executable\" war file (\n`java -jar myWarFile.war`\n) that will start up a Jetty webserver that hosts the webapp contained in the WAR file I executed.\nI found\na...
{"title":"IntentService won't show Toast","tags":["android","intentservice","android-toast"],"question_text":"This IntentService I created will show Toasts in onStartCommand() and in onDestroy(), but not in onHandleIntent(). Am I missing something about the limitations of an IntentService?\n`public class MyService exte...
{"title":"A free tool to check C\/C++ source code against a set of coding standards?","tags":["c++","c","coding-style"],"question_text":"It looks quite easy to find such a tool for Java (\nCheckstyle\n,\nJCSC\n), but I can't seem to find one for C\/C++. I am not looking for a lint-like static code analyzer, I only woul...
{"title":"Set the default value in dropdownlist using jQuery","tags":["javascript","jquery","html","css","events"],"question_text":"I have many options in my dropdownlist like:\n`<option value=\"1\">it's me<\/option>`\nI need to select the option who have value\nit's me\ninside the tag, not by attribute like\n`1`\n.\nH...
{"title":"How do I 'run as' 'Network Service'?","tags":["command-line","permissions","batch-file","runas","network-service"],"question_text":"Im trying to run a process as another account. I have the command...\nrunas \"\/user:WIN-CLR8YU96CL5\\network service\" \"abwsx1.exe\"\nbut then this asks for the password. Howev...
{"title":"Android: toggle text color of ToggleButton","tags":["android","android-xml","togglebutton"],"question_text":"To create a custom ToggleButton, I've defined a new style in\n`\/res\/values\/styles.xml`\n:\n`<style name=\"myToggleButton\">\n <item name=\"android:layout_width\">wrap_content<\/item>\n <item name=\"...
{"title":"How to use switch\/case (simple pattern matching) in Scala?","tags":["scala","pattern-matching","switch-statement"],"question_text":"I've found myself stuck on a very trivial thing :-]\nI've got an enum:\n`object Eny extends Enumeration {\n type Eny = Value\n val FOO, BAR, WOOZLE, DOOZLE = Value\n}`\nIn a cod...
{"title":"Python Mechanize select a form with no name","tags":["python","html","forms","mechanize"],"question_text":"I am attempting to have mechanize select a form from a page, but the form in question has no \"name\" attribute in the html. What should I do? when I try to use\n`br.select_form(name = \"\")`\nI get erro...
{"title":"Where is the default \"Welcome Aboard\" page located in my app?","tags":["ruby-on-rails","ruby-on-rails-4"],"question_text":"I scoured my app's directories, and I can't find the html page for the default rails Welcome Aboard page. I also cannot find a route for the default Welcome Aboard page in routes.rb. Ho...
{"title":"Differences between git submodule and subtree","tags":["git","git-submodules","git-subtree"],"question_text":"What are the conceptual differences between using git submodule and subtree?\nWhat are the typical scenarios for each?","answer_text":"submodule is link;\nsubtree is copy","question_code":[],"answer_c...
{"title":"The CSRF token is invalid. Please try to resubmit the form","tags":["php","symfony2","twig"],"question_text":"Im having this error message everytime I try to submit the form:\n`The CSRF token is invalid. Please try to resubmit the form`\nMy form code is this:\n`<form novalidate action=\"{{path('signup_index')...
{"title":"Why use a using statement with a SqlTransaction?","tags":["c#","using-statement"],"question_text":"I've been running into some problems concerning a SqlTransaction I'm using in my code. During my Googling I see many people using a using statement with a SqlTransaction.\nWhat is the benefit and\/or difference ...
{"title":"How to delete history of last 10 commands in shell?","tags":["linux","shell","terminal"],"question_text":"Commands follows\n`511 clear\n 512 history\n 513 history -d 505\n 514 history\n 515 history -d 507 510 513\n 516 history\n 517 history -d 509\n 518 history\n 519 history -d 511\n 520 history`\nI can delet...
{"title":"How to count total number of stored procedure and tables in SQL Server 2008","tags":["sql-server","sql-server-2008-r2"],"question_text":"I have database\n`Test1`\nin SQL Server 2008 R2. On the live server I took backup from there and restore it at our local machine as\n`Test2`\nand added some tables and proce...
{"title":"gcc\/g++ option to place all object files into separate directory","tags":["gcc","g++"],"question_text":"I am wondering why gcc\/g++ doesn't have an option to place the generated object files into a specified directory.\nFor example:\n`mkdir builddir\nmkdir builddir\/objdir\ncd srcdir\ngcc -c file1.c file2.c ...
{"title":"Get the file size in android sdk?","tags":["java","android","file"],"question_text":"I have a problem getting the size of a file. I have the following code:\n`File file = new File(\"\/sdcard\/lala.txt\");\nlong length = file.length();`\nAnd always length is zero, yes zero.\nI am using Android SDK (not sure wh...
{"title":"Remove punctuation from Unicode formatted strings","tags":["python","unicode"],"question_text":"I have a function that removes punctuation from a list of strings:\n`def strip_punctuation(input):\n x = 0\n for word in input:\n input[x] = re.sub(r'[^A-Za-z0-9 ]', \"\", input[x])\n x += 1\n return input`\nI rece...
{"title":"In vim how to map \"save\" to ctrl-s","tags":["vim"],"question_text":"In vim, how can I map \"save\" (\n`:w`\n) to\nctrl\n-\ns\n.\nI am trying \"map\" the command, but xterm freezes when I press\nctrl\n-\ns\n.\nIf I give\nctrl\n-\nv\n,\nctrl\n-\ns\nstill I see only a\n`^`\n, not\n`^S`\n.","answer_text":"Ctrl-...
{"title":"Adding jars to a Eclipse PlugIn","tags":["eclipse","plugins","import","jar"],"question_text":"I try to build a Eclipse plugin that has to use a self written jar which is dependent on other jars, but I don't get the point where to start with handling jars as seperate PlugIns. Anywhere I have to use just the .j...
{"title":"Push item to associative array in PHP","tags":["php","arrays"],"question_text":"I've been trying to push an item to an associative array like this:\n`$new_input['name'] = array(\n 'type' => 'text', \n 'label' => 'First name', \n 'show' => true, \n 'required' => true\n);\narray_push($options['inputs'], $new_in...
{"title":"How can I count runs in a sequence?","tags":["r","count"],"question_text":"In R, what would be the most efficient\/simplest way to count runs of identical elements in a sequence?\nFor example, how to count the numbers of consecutive zeros in a sequence of non-negative integers:\n`x <- c(1,0,0,0,1,0,0,0,0,0,2,...
{"title":"How to read only the first line of a file","tags":["perl","file","readline"],"question_text":"I've been googling for a while, but I cannot find a function the read just first line of a file.\nI need to read first line of a text file and extract the date from it.\nnew to perl.","answer_text":"`open my $file, '...
{"title":"How do I enable line numbers (on the left) everytime I Open Emacs?","tags":["emacs"],"question_text":"I enable them by pressing:\n`M-x linum-mode`\n. How can I \"translate\" that into my.emacs file in order to enable it automatically every time I open EMACS?","answer_text":"Drop\n`(global-linum-mode t)`\ninto...
{"title":"Using Python's list index() method on a list of tuples or objects?","tags":["python","list","tuples","reverse-lookup"],"question_text":"Python's list type has an index() method that takes one parameter and returns the index of the first item in the list matching the parameter. For instance:\n`>>> some_list = ...
{"title":"Find the most popular element in int[] array","tags":["java","arrays"],"question_text":"`int[] a = new int[10]{1,2,3,4,5,6,7,7,7,7};`\nhow can I write a method and return 7?\nI want to keep it native without the help of lists, maps or other helpers.\nOnly arrays[].","answer_text":"Try this answer. First, the ...
{"title":"Why should one not derive from c++ std string class?","tags":["c++","string","inheritance","stl"],"question_text":"I wanted to ask about a specific point made in Effective C++.\nIt says:\nA destructor should be made virtual if a class needs to act like a polymorphic class. It further adds that since\n`std::st...