text
stringlengths
74
309k
{"title":"How to serialize an object to XML without getting xmlns=\"...\"?","tags":[".net","xml-serialization","xml-namespaces"],"question_text":"Is there a way for me to serialize an object in .NET without the XML Namespaces automatically serializing also? It seems that by default .NET believes the XSI and XSD namespa...
{"title":"DateTime.TryParse issue with dates of yyyy-dd-MM format","tags":["c#","asp.net","datetime","date","tryparse"],"question_text":"I have the following date in string format \"2011-29-01 12:00 am\" . Now I am trying to convert that to datetime format with the following code:\n`DateTime.TryParse(dateTime, out dt);...
{"title":"Generic List<T> as parameter on method","tags":["c#","generics","c#-3.0"],"question_text":"How can I use a\n`List<T>`\nas a parameter on a method, I try this syntax :\n`void Export(List<T> data, params string[] parameters){\n}`\nI got compilation error:\nThe type or namespace name 'T' could not be found (are ...
{"title":"Check if a string has at least one number in it using LINQ","tags":["c#","linq"],"question_text":"I would like to know what the easiest and shortest LINQ query is to return true if a string contains any number character in it.","answer_text":"`\"abc3def\".Any(c => char.IsDigit(c));`\nUpdate\n: as\n@Cipher\npo...
{"title":"If else embedding inside html","tags":["php","html"],"question_text":"What is the correct way of embedding if else and elseif conditions inside html?","answer_text":"I recommend the following syntax for readability.\n`<? if ($condition): ?>\n <p>Content<\/p>\n<? elseif ($other_condition): ?>\n <p>Other Conten...
{"title":"jQuery Remove string from string","tags":["javascript","jquery","string"],"question_text":"I am trying to remove a string from a string in jQuery.\nHere is the string:\n`username1, username2 and username3 like this post.`\nI would like to remove\n`username1,`\nfrom this list.\nI tried adding the list to an ar...
{"title":"EProgrammerNotFound exception in Delphi?","tags":["delphi","delphi-2009","delphi-xe7"],"question_text":"In Delphi 2009, SysUtils.pas contains this in line 425:\n`EProgrammerNotFound = class(Exception);`\nIs this simply an\neaster egg\nor something serious?\nWhen should this exception be raised?\nDoes it also ...
{"title":"How can I programmatically remove the 2 connection limit in WebClient","tags":[".net","http","connection","webclient","limit"],"question_text":"Those \"fine\" RFCs mandate from every RFC-client that they beware of not using more than 2 connections per host...\nMicrosoft implemented this in WebClient. I know t...
{"title":"How to get round shape in Android","tags":["android","drawable","shape"],"question_text":"How would I achieve a round shape in Android, like below, through an Android shape drawable:","answer_text":"You need to create a shape\n`drawable`\nin the drawable folder that looks something like:\n`<?xml version=\"1.0...
{"title":"Writing a Python list of lists to a csv file","tags":["python","file","csv","file-io","python-2.7"],"question_text":"I have a long list of lists of the following form ---\n`a = [[1.2,'abc',3],[1.2,'werew',4],........,[1.4,'qew',2]]`\ni.e. the values in the list are of different types -- float,int, strings.How...
{"title":"CSS: Is it correct that text content of a div overflows into the padding?","tags":["css","overflow","padding","hidden"],"question_text":"I expected that the padding inside a div would remain clear of any text. But given the following html\/css, the content-text spills out into the padding;\n`<div class=\"foo\...
{"title":"How to add option to select list in jQuery","tags":["jquery","syntax","select","build","option"],"question_text":"My select list is called\n`dropListBuilding`\n. The following code does not seem to work:\n`for (var i = 0; i < buildings.length; i++) {\n var val = buildings[i];\n var text = buildings[i];\n aler...
{"title":"Adding a directory to tomcat classpath","tags":["tomcat","classpath"],"question_text":"I have a folder in my C: drive as\n`C:\\app_config\\java_app`\nThis folder contains some locale specific property files.\nI have a java class (\n`PrjPropertilesLocator`\n) that loads the property files based on default loca...
{"title":"How to change font color of UISegmentedControl","tags":["iphone","objective-c","cocoa-touch","uisegmentedcontrol"],"question_text":"I try to change font color from white to black for\n`UISegmentedControl`\n(for iOS 4.*)\n`UISegmentedControl *button = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWi...
{"title":"How do exceptions in Haskell work?","tags":["exception","haskell"],"question_text":"In GHCi:\n`Prelude> error (error \"\")\n*** Exception: \nPrelude> (error . error) \"\"\n*** Exception: *** Exception:`\nWhy isn't the first one a nested exception?","answer_text":"The answer is that this is the (somewhat surpr...
{"title":"How to Convert Int to Unsigned Byte and Back","tags":["java","byte","int"],"question_text":"I need to convert a number into an unsigned byte. The number is always less than or equal to 255, and so it will fit in one byte.\nI also need to convert that byte back into that number. How would I do that in Java? I'...
{"title":"AVURLAsset refuses to load video","tags":["ipad","video","ios","avfoundation","ios4"],"question_text":"I'm trying to load a video file into my iPad app as an\n`AVURLAsset`\n, using the asynchronous-loading stuff to wait for it to be ready. Problem is, when I run it, I get a completely generic \"failure\" erro...
{"title":"iPhone ad hoc build using Xcode 4","tags":["ios","xcode4","adhoc"],"question_text":"I just switched to Xcode 4 and need to make an ad hoc build so my customer can test my app. Yet every tutorial I find is based on Xcode 3 and I can't seem to find my way with Xcode 4 on similar settings and actions I need to d...
{"title":"Parallel.ForEach Slower than ForEach","tags":["c#"],"question_text":"Here is the code\n`using(var context=new AventureWorksDataContext())\n {\n IEnumerable<Customer> _customerQuery = from c in context.Customers\n where c.FirstName.StartsWith(\"A\")\n select c;\n var watch = new Stopwatch();\n watch.Start();\n...
{"title":"How to dismiss a DialogFragment when pressing outside the dialog?","tags":["android","fragment","dismiss"],"question_text":"I am using a\n`DialogFragment`\n, and while I have successfully set an image to close (i.e. dismiss) the dialog when pressed, I am having a hard time finding the way to dismiss the dialo...
{"title":"`gem install therubyracer` fails on Mac OS X Lion","tags":["ruby","rubygems","v8"],"question_text":"I would appreciate some help in getting\n`gem install therubyracer`\nto work. Here is the error:\n`$ gem install therubyracer\nBuilding native extensions. This could take a while...\nERROR: Error installing the...
{"title":"Unable to Git-push master to Github","tags":["git","version-control","push"],"question_text":"This question is related to my problem in\nunderstanding rebase, branch and merge\n,\nand to the problem\nHow can you commit to your github account as you have a teamMate in your remote list?\nI found out that\nother...
{"title":"How should one use std::optional?","tags":["c++","boost-optional","c++-tr2"],"question_text":"I'm reading the documentation of\n`std::experimental::optional`\nand I have a good idea about what it does, but I don't understand\nwhen\nI should use it or how I should use it. The site doesn't contain any examples ...
{"title":"What is Join() in jQuery?","tags":["jquery","jquery-selectors"],"question_text":"What is Join() in jquery? for example:\n`var newText = $(\"p\").text().split(\" \").join(\"<\/span> <span>\");`","answer_text":"That's not a jQuery function - it's the regular\nArray.join\nfunction.\nIt converts an array to a str...
{"title":"how to hide a vertical scroll bar when not needed","tags":["html","css","forms"],"question_text":"I have a textarea which is contained in a div as I have jquery hint and wanted to use opacity without changing the border.\nThere is a visible vertical scroll bar how I only want this displayed when I am typing i...
{"title":"How to create duplicate allowed attributes","tags":["c#","attributes"],"question_text":"I'm using a custom attribute inherited from an attribute class. I'm using it like this:\n`[MyCustomAttribute(\"CONTROL\")]\n [MyCustomAttribute(\"ALT\")]\n [MyCustomAttribute(\"SHIFT\")]\n [MyCustomAttribute(\"D\")]\n publ...
{"title":"angle attribute in android gradient","tags":["android","android-layout","android-intent"],"question_text":"I am going through test example. Where for some Image background they are using gradient,\nthe code goes like this\n`<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <shape xmlns:android=\"http:\/\/schemas.a...
{"title":"Read and overwrite a file in Python","tags":["python","file","overwrite"],"question_text":"Currently I'm using this:\n`f = open(filename, 'r+')\ntext = f.read()\ntext = re.sub('foobar', 'bar', text)\nf.seek(0)\nf.write(text)\nf.close()`\nBut the problem is that the old file is larger than the new file. So I e...
{"title":"Finding local maxima\/minima with Numpy in a 1D numpy array","tags":["python","numpy"],"question_text":"Can you suggest a module function from numpy\/scipy that can find local maxima\/minima in a 1D numpy array? Obviously the simplest approach ever is to have a look at the nearest neighbours, but I would like...
{"title":"Convert xlsx to csv in linux command line","tags":["linux","excel","csv","converter","xlsx"],"question_text":"I'm looking for a way to convert xlsx files to csv files in linux, i do not want to use PHP\/Perl or anything like that since I'm looking at processing several millions of lines, so i need something q...
{"title":"Git Diff with Beyond Compare","tags":["git","beyondcompare"],"question_text":"I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest version of the file is loaded and nothing else, so there is not...
{"title":"How do you make an anchor link non-clickable or disabled?","tags":["jquery"],"question_text":"I have an anchor link that I want to disable once the user clicks on it. Or, remove the anchor tag from around the text, but definitely keep the text.\n`<a href='' id='ThisLink'>some text<\/a>`\nI can do this easily ...
{"title":"How to use a WSDL file to create a WCF service (not make a call)","tags":["wcf","wsdl"],"question_text":"I have an old WSDL file and I want to create a server based on this WSDL file.\nThe WSDL is generated from a ASMX (I suppose but I am not sure).\nHow can I achieve this ?\noriginal question\nwhere the OP t...
{"title":"Regex match everything after question mark?","tags":["regex"],"question_text":"I have a feed in Yahoo Pipes and want to match everything after a question mark.\nSo far I've figured out how to match the question mark using..\n`\\?`\nNow just to match everything that is after\/follows the question mark.","answe...
{"title":"Maximum MIMEType Length when storing type in DB","tags":["database","mime-types"],"question_text":"What are people using as the length of a MIMEType field in their databases? The longest one we've seen so far is 72 bytes:\n`application\/vnd.openxmlformats-officedocument.wordprocessingml.document`\nbut I'm jus...
{"title":"How do I scroll a RichTextBox to the bottom?","tags":["c#","winforms","scroll","richtextbox"],"question_text":"I need to be able to scroll a RichTextBox to the bottom, even when I am not appending text. I know I can append text, and then use that to set the selection start. However I want to ensure it is at t...
{"title":"Django Imagefield not working properly via ModelForm","tags":["django","django-forms","django-models"],"question_text":"I'm certain I'm doing something really obviously stupid, but I've been trying to figure it out for a few hours now and nothing is jumping out at me.\nI'm using a ModelForm so I can expose a ...
{"title":"mysql too many indexes?","tags":["sql","mysql","indexing"],"question_text":"I am spending some time optimizing our current database.\nI am looking at indexes specifically.\nThere are a few questions:\nIs there such a thing as too many indexes?\nWhat will indexes speed up?\nWhat will indexes slow down?\nWhen i...
{"title":"Python: using a recursive algorithm as a generator","tags":["python","recursion","generator"],"question_text":"Recently I wrote a function to generate certain sequences with nontrivial constraints. The problem came with a natural recursive solution. Now it happens that, even for relatively small input, the se...
{"title":"No more SideBarEnhancements in Sublime Text 2?","tags":["sublimetext2","sublimetext","package-control"],"question_text":"I'm trying to install SideBarEnhancements in Sublime Text 2 (version 2.0.2 Build 2221), but it doesn't show under Package Control -> Install Package -> SideBarEnhancements.\nChecking on\nGi...
{"title":"How to add favicon in rails 3.2","tags":["ruby-on-rails","favicon"],"question_text":"I know new rails apps come with an empty favicon.ico file. I want to know how I go about adding a favicon. I know you can use the\n`favicon_link_tag`\nhelper, but I am not sure how to populate the favicon.ico file. Do you use...
{"title":"git revert back to certain commit","tags":["git","commit","revert"],"question_text":"how do i revert all my files on my local copy back to a certain commit?\n`commit 4a155e5b3b4548f5f8139b5210b9bb477fa549de\nAuthor: John Doe <Doe.John.10@gmail.com>\nDate: Thu Jul 21 20:51:38 2011 -0500`\nThis is the commit i'...
{"title":"Change text of \"Return\" keyboard button","tags":["ios","cocoa-touch","uikeyboard"],"question_text":"How can I change the standard text of the \"Return\" button to something else?\nI want it to be \"Add\".","answer_text":"Unfortunately, you can change \"Return\" into only one of these predefined labels with ...
{"title":"Upload file to ftp using c#","tags":["c#",".net","file-upload","ftp"],"question_text":"I try upload a file to an FTP-server with\n`c#`\n. The file is uploaded but with zero bytes.\n`private void button2_Click(object sender, EventArgs e)\n{\n var dirPath = @\"C:\/Documents and Settings\/sander.GD\/Bureaublad\/...
{"title":"What does this typedef statement mean?","tags":["c++","typedef"],"question_text":"In a C++ reference page they provide some typedef examples and I'm trying to understand what they mean.\n`\/\/ simple typedef\ntypedef unsigned long mylong;\n\/\/ more complicated typedef\ntypedef int int_t, *intp_t, (&fp)(int, ...
{"title":"function inside function","tags":["python","coding-style"],"question_text":"Simple example. Two methods, one called from another:\n`def method_a(arg):\n some_data = method_b(arg)\ndef method_b(arg):\n return some_data`\nIn Python we can declare\n`def`\ninside another\n`def`\n. So, if\n`method_b`\nis required ...
{"title":"Jquery: how to sleep or delay?","tags":["javascript","jquery"],"question_text":"i want move up the object, delay 1000ms , then hide it,\ni get the code:\n`$(\"#test\").animate({\"top\":\"-=80px\"},1500)\n .animate({\"top\":\"-=0px\"},1000)\n .animate({\"opacity\":\"0\"},500);`\ni use \".animate({\"top\":\"-=0...
{"title":"How to keep a Python script output window open?","tags":["python","windows"],"question_text":"I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can analyze my output. How can I keep it open?","...
{"title":"How to configure a HTTP proxy for svn","tags":["svn","proxy"],"question_text":"I want to check code from the repository\nhttp:\/\/code.sixapart.com\/svn\/perlbal\/\n. I can only access the the repository url by setting a proxy. I guess if I want to get the code from the same URL by svn I need to configure a p...
{"title":"GDB corrupted stack frame - How to debug?","tags":["c","recursion","gdb"],"question_text":"I have the following stack trace. Is it possible to make out anything useful from this for debugging?\n`Program received signal SIGSEGV, Segmentation fault.\n0x00000002 in ?? ()\n(gdb) bt\n#0 0x00000002 in ?? ()\n#1 0x0...
{"title":"Magic number in boost::hash_combine","tags":["c++","algorithm","boost","hash","magic-numbers"],"question_text":"The\n`boost::hash_combine`\ntemplate function takes a reference to a hash (called\n`seed`\n) and an object\n`v`\n. According to the\ndocs\n, it combines\n`seed`\nwith the hash of\n`v`\nby\n`seed ^= ...
{"title":"WPF: How do I set the Owner Window of a Dialog shown by a UserControl?","tags":[".net","wpf","vb.net","dialog","user-controls"],"question_text":"I've got a WPF application with these three types of things...\nWindowMain\nUserControlZack\nWindowModal\nUserControlZack1 sits on my WindowMain...\n`<Window x:Class...
{"title":"How to repeat a string a variable number of times in C++?","tags":["c++"],"question_text":"I want to insert 'n' spaces (or any string) at the beginning of a string in C++. Is there any direct way to do this using either std::strings or char* strings?\nE.g. in Python you could simply do\n`>>> \".\" * 5 + \"lol...
{"title":"presentViewController:animated:YES view will not appear until user taps again","tags":["ios","uiviewcontroller"],"question_text":"I'm getting some strange behaviour with\n`presentViewController:animated:completion`\n. What I'm making is essentially a guessing game.\nI have a\n`UIViewController`\n(frequencyVie...
{"title":"git: Apply changes introduced by commit in one repo to another repo","tags":["git"],"question_text":"I have a\n`repo1`\nand\n`repo2`\non local machine. They are very similar, but the latter is some kind of other branch (\n`repo1`\nis not maintained anymore).\n`\/path\/to\/repo1 $ git log HEAD~5..HEAD~4\n<some...
{"title":"Install parent POM without building Child modules","tags":["java","maven","maven-2","pom.xml"],"question_text":"I have a parent POM in a Maven project, with this structure:\n`parent\n |\n ---------------\n | |\n child1 child2`\nI want to install the POM of the\n\"parent\"\nin the local REPO to allow\nchild1\n...
{"title":"How can it be impossible to \"decrypt\" an MD5 hash?","tags":["hash","md5","encryption"],"question_text":"Possible Duplicate:\nHow come MD5 hash values are not reversible?\nI was reading a question about MD5, and it made me remember something that boggles me. Very simple question, and I'm sorry if it's not a ...
{"title":"Relationship between scipy and numpy","tags":["python","numpy","scipy"],"question_text":"`scipy`\nappears to provide most (but not all [1]) of\n`numpy`\n's functions in its own namespace. In other words, if there's a function named\n`numpy.foo`\n, there's almost certainly a\n`scipy.foo`\n. Most of the time, t...
{"title":"Capybara with :js => true causes test to fail","tags":["javascript","ruby-on-rails-3","capybara"],"question_text":"I'm new to Capybara and testing on Rails in general, so please forgive me if this is a simple answer.\nI've got this test\n`it \"should be able to edit an assignment\" do\n visit dashboard_path\n...
{"title":"How to remove part of a string?","tags":["php","string"],"question_text":"How to trim a part of a string, and save it in a particular string in MySQL using PHP?\nExample:\nIf a string has the value\n`\"REGISTER 11223344 here\"`\nHow can I cut\n`\"11223344\"`\nfrom the string?","answer_text":"If you're specifi...
{"title":"Good ways to sort a queryset? - Django","tags":["python","django","django-models"],"question_text":"what I'm trying to do is this:\nget the 30 Authors with highest score (\n`Author.objects.order_by('-score')[:30]`\n)\norder the authors by\n`last_name`\nAny suggestions?","answer_text":"What about\n`import oper...
{"title":"Explicitly exclude an html element from the tab order","tags":["html","forms","tabindex"],"question_text":"Is there anyway to exclude an element from the tab order of a HTML form.\nSo if i have the following\n`<input type=text name=username>\n<input type=text name=password>\n<input type=button name=forgotpass...
{"title":"Check if database exists in postgreSQL using shell","tags":["postgresql","shell"],"question_text":"I was wondering if anyone would be able to tell me about whether it is possible to use shell to check if a postgresql database exists?\nI am making a shell script and I only want it to create the database if it ...
{"title":"Why are my balls disappearing?","tags":["javascript","canvas","geometry","physics","collision"],"question_text":"Pardon the funny title. I've created a little graphic demo of 200 balls bouncing and colliding, both against the walls and each other. You can see what I have currently here:\nhttp:\/\/www.exeneva....
{"title":"How do I exit a while loop in Java?","tags":["java","while-loop","exit","break"],"question_text":"What is the best way to exit\/terminate a while loop in Java?\nFor example, my code is currently as follows:\n`while(true){if(obj == null){\/\/ I need to exit here}}`","answer_text":"Use\n`break`\n:\n`while (true...
{"title":"JDK on OSX 10.7 Lion","tags":["eclipse","osx","java"],"question_text":"I've instaled the Java for Developer package provided from Apple for 10.7 and java apps are running fine\nbut eclipse cannot find the JDK root path and I cant either.\nAnybody any ideas?","answer_text":"You can download the 10.7 Lion JDK f...
{"title":"javascript jquery radio button click","tags":["javascript","jquery"],"question_text":"I have 2 radio buttons and jquery running.\n`<input type=\"radio\" name=\"lom\" value=\"1\" checked> first\n<input type=\"radio\" name=\"lom\" value=\"2\"> second`\nNow, with a button I can set onClick to run a function. Wha...
{"title":"How can I disable the eclipse server startup timeout?","tags":["eclipse","eclipse-wtp"],"question_text":"By default when using a webapp server in Eclipse Web Tools, the server startup will fail after a timeout of 45 seconds. I can increase this timeout in the server instance properties, but I don't see a way ...
{"title":"Why is rbindlist \"better\" than rbind?","tags":["r","data.table","rbind","rbindlist"],"question_text":"I am going through documentation of\n`data.table`\nand also noticed from some of the conversations over here on SO that\n`rbindlist`\nis supposed to be better than\n`rbind`\n.\nI would like to know why is\n...
{"title":"Multithreading in Bash","tags":["linux","multithreading","bash","shell"],"question_text":"I would like to introduce multithreading feature in my shell script.\nI have a script which calls the function\n`read_cfg()`\nwith different arguments.\nEach of these function calls are independent.\nWould it be possible...
{"title":"Unix find: search for executable files","tags":["bash","unix","terminal","find","find-util"],"question_text":"What type of parameter\/flag can I use with the Unix\n`find`\ncommand so that I search executables?","answer_text":"On GNU versions of find you can use\n`-executable`\n:\n`find . -type f -executable -...
{"title":"Saving core file in gdb","tags":["gdb","core-file"],"question_text":"Is it possible to\nsave\/dump\ncore file using gdb? Sometimes I want to save file to analyze it later.","answer_text":"Issue the 'generate-core-file' command in gdb.\n`(gdb) help generate-core-file\nSave a core file with the current state of...
{"title":"Background tasks in Meteor","tags":["meteor"],"question_text":"I'm wondering, is there is way to implement background taks, maybe with workers pool. Can you show me direction, i'm thinking about writing package for this?","answer_text":"There are several packages to run background tasks in Meteor. From the si...
{"title":"Which HTML5 tags can I use without worrying about browser compatibility?","tags":["html5","browser","cross-browser","compatibility"],"question_text":"I am building a web app for use on PCs. What are the HTML5 tags to stay away from to prevent compatibility issues with Browsers like IE8 and above?\nNote: Most ...
{"title":"Android text view color doesn't change when disabled","tags":["android","colors","android-textview"],"question_text":"When I call setEnabled(false) for a TextView object the text color doesn't change. I expected it will be changed to gray. If I remove the line of \"android:textColor\" in my XML file, it backs...
{"title":"Matching an empty input box using CSS","tags":["css","input","css-selectors"],"question_text":"How do I apply a style to an empty input box? If the user types something in the input field, the style should no longer be applied. Is this possible in CSS? I tried this:\n`input[value=\"\"]`","answer_text":"If onl...
{"title":"What are the best and must-have hg \/ mercurial extensions?","tags":["mercurial"],"question_text":"I've been dabbling with hg \/ mercurial lately, namely in conjunction with Fogcreek's Kiln, and I'm trying to figure out what the must-have extensions are. Its a little tricky sifting through their extension lis...
{"title":"android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawableWithShadow","tags":["android","appcompat","android-cardview"],"question_text":"I tried to use CardView in my Application which worked pretty good within my xml Layout. Since I want to generate them in my code ...
{"title":"Saving NSArray to NSUserDefaults and getting it in NSMutableArray","tags":["iphone","objective-c","ios","cocoa-touch"],"question_text":"How can I save\n`NSArray`\nin\n`NSUserDefaults`\nand then load it back in an\n`NSMutableArray`\nto populate the\n`UIPickerView`\n?\nAlso the issue is that new values would be...
{"title":"Generating a Random Number between 1 and 10 Java","tags":["java","random"],"question_text":"I want to generate a number between 1 and 10 in Java.\nHere is what I tried:\n`Random rn = new Random();\nint answer = rn.nextInt(10) + 1;`\nIs there a way to tell what to put in the parenthesis\n`()`\nwhen calling the...
{"title":"Symfony2 and date_default_timezone_get() - It is not safe to rely on the system's timezone settings","tags":["php","symfony2","timezone"],"question_text":"I have a Symfony2 project. I updated my php to 5.5.7 today and since then, I am getting the\n`Warning: date_default_timezone_get(): It is not safe to rely ...
{"title":"How to get first and last day of previous month (with timestamp) in SQL Server","tags":["sql-server","datetime"],"question_text":"I could not find the solution which gives first and last day of previous month with timestamp. Hope this helps others. If there is already a solution for this problem I apologize.\...
{"title":"How to 'continue' inside a each loop : underscore, node.js","tags":["node.js","loops","underscore.js"],"question_text":"The code in node.js is simple enough.\n`_.each(users, function(u, index) {\n if (u.superUser === false) {\n \/\/return false would break\n \/\/continue?\n }\n \/\/Some code\n});`\nMy questio...
{"title":"How to access Grails configuration in Grails 2.0?","tags":["grails","groovy","grails-2.0"],"question_text":"I have obtained the latest Grails 2.0 milestone, and I am seeing a deprecation warning for the\n`ConfigurationHolder`\nclass:\n`org.codehaus.groovy.grails.commons.ConfigurationHolder`\nThe deprecation m...
{"title":"Why is using if(!$scope.$$phase) $scope.$apply() an anti-pattern?","tags":["angularjs","angularjs-scope"],"question_text":"Sometimes I need to use\n`$scope.$apply`\nin my code and sometimes it throws a \"digest already in progress\" error. So I started to find a way around this and found this question:\nAngul...
{"title":"Maven - deploy webapp to tomcat before JUnit test","tags":["maven","tomcat","junit","maven-2","tomcat7"],"question_text":"I have webapp which provides web service. I want to perform JUnit tests with SoapUI to check if this service is working properly.\nBut to test web service application has to be deployed to...
{"title":"Python: How to send POST request?","tags":["python","post","urllib","httplib"],"question_text":"I found this script online:\n`import httplib, urllib\nparams = urllib.urlencode({'number': 12524, 'type': 'issue', 'action': 'show'})\nheaders = {\"Content-type\": \"application\/x-www-form-urlencoded\",\n \"Accept...
{"title":"How to spread django unit tests over multiple files?","tags":["django","unit-testing"],"question_text":"I have a python-django application\nI'm using the\nunit testing framework\nThe tests are arranged in the file \"tests.py\" in the module directory\nI'm running the tests via\n`.\/manage.py test app`\nNow..\...
{"title":"Let vs. Binding in Clojure","tags":["binding","clojure","let"],"question_text":"I understand that they're different since one works for setting\n`*compile-path*`\nand one doesn't. However, I need help with why they're different.\n`let`\ncreates a new scope with the given bindings, but\n`binding`\n...?","answe...
{"title":"Determine original size of image cross browser?","tags":["javascript","image"],"question_text":"Is there a reliable, framework independent way of determining the physical dimensions of a\n`<img src='xyz.jpg'>`\nresized on the client side?","answer_text":"You have 2 options:\nOption 1:\nRemove the\n`width`\nan...
{"title":"How to listen for preference changes within a PreferenceFragment?","tags":["android","android-fragments","android-activity","sharedpreferences","android-preferences"],"question_text":"As described\nhere\n, I am subclassing PreferenceFragment and displaying it inside an Activity. That document explains how to ...
{"title":"In jQuery, what does $.fn. mean?","tags":["jquery","jquery-plugins"],"question_text":"In jQuery, what does $.fn. mean? I looked this up on google but couldn't find any concrete examples.\n`$.fn.something = function{}`","answer_text":"It allows you to extend jQuery with your own functions.\nFor example,\n`$.fn...
{"title":"How to set the action for a UIBarButtonItem in Swift","tags":["ios","swift","action","uibarbuttonitem"],"question_text":"How can the action for a custom UIBarButtonItem in Swift be set?\nThe following code successfully places the button in the navigation bar:\n`var b = UIBarButtonItem(title: \"Continue\", sty...
{"title":"SQL Server Linked Server Example Query","tags":["sql-server","linked-server"],"question_text":"While in Management Studio, I am trying to run a query\/do a join between two linked servers.\nIs this a correct syntax using linked db servers:\n`select foo.id \nfrom databaseserver1.db1.table1 foo, \n databaseserv...
{"title":"Does Python optimize tail recursion?","tags":["python","recursion","stack","stack-overflow","tail-recursion"],"question_text":"I have the following piece of code which fails with the following error:\nRuntimeError: maximum recursion depth exceeded\nI attempted to rewrite this to allow for tail recursion optim...
{"title":"Using GIT, how can I selectively pull \/ merge changes from another's 'fork'?","tags":["git","merge","pull"],"question_text":"Take this scenario:\nI decide to 'fork' a codebase on github.com, and start doing my routine: Edit - Commit - Push; aka hack hack hack.\nAfter I made some changes, I see some changes a...
{"title":"When should you NOT use a Rules Engine?","tags":["rule-engine"],"question_text":"I have a pretty decent list of the advantages of using a Rules Engine, as well as some reasons to use them, what I need is a list of the reasons why you should NOT use a Rules Engine\nThe best I have so far is this:\nRules engine...
{"title":"Best Way to read rss feed in .net Using C#","tags":["c#","rss"],"question_text":"what is the best way to read rss feeds.\nI am using XmlTextReader to achieve this. Is there any other best way to do it.\n`XmlTextReader reader = new XmlTextReader(strURL);\nDataSet ds = new DataSet();\nds.ReadXml(reader);`\nafte...
{"title":"How to remove characters from a string","tags":["c++","string","character"],"question_text":"For example I have a user input a phone number.\n`cout << \"Enter phone number: \";\nINPUT: (555) 555-5555\ncin >> phone;`\nI want to remove the \"(\", \")\", and \"-\" characters from the string. I've looked at the s...
{"title":"Is there already a Google+ API?","tags":["google-api","google-plus"],"question_text":"I would like to know if there is already a Google+ API available to the developers. I have not yet found something?\nThe API is now here available:\nhttps:\/\/developers.google.com\/+\/","answer_text":"https:\/\/services.goo...