text
stringlengths
74
309k
{"title":"Create unique constraint with null columns","tags":["sql","postgresql","database-design",null,"referential-integrity"],"question_text":"I have a table with this layout:\n`CREATE TABLE Favorites\n(\n FavoriteId uuid NOT NULL PRIMARY KEY,\n UserId uuid NOT NULL,\n RecipeId uuid NOT NULL,\n MenuId uuid\n)`\nI wa...
{"title":"Malwarebytes gives trojan warning for basic C# \"Hello World!\" program","tags":["c#","false-positive","trojan"],"question_text":"Basically, I just ran a scan of my computer with\nMalwarebytes\n(updated the definitions before running), and it said my \"helloworld\" program written in C# has a\ntrojan\n.\nI kn...
{"title":"IEnumerable doesn't have a Count method","tags":["c#","asp.net","enumerable"],"question_text":"I have the following method:\n`public bool IsValid\n{\n get { return (GetRuleViolations().Count() == 0); }\n}\npublic IEnumerable<RuleViolation> GetRuleViolations(){\n \/\/code here\n}`\nWhy is it that when I do\n`....
{"title":"Python-equivalent of short-form \"if\" in C++","tags":["c++","python","syntax"],"question_text":"Possible Duplicate:\nPython Ternary Operator\nIs there a way to write this C\/C++ code in Python?\n`a = (b == true ? \"123\" : \"456\" )`\nThanks so much!","answer_text":"`a = '123' if b else '456'`","question_cod...
{"title":"How to delete duplicates on a MySQL table?","tags":["mysql","duplicates"],"question_text":"I need to delete duplicated rows for specified sid on a mysql table.\nHow can I do this with an SQL query?\n`DELETE (DUPLICATED TITLES) FROM table WHERE SID = \"1\"`\nSomething like this, but I don't know how to do it."...
{"title":"Mixing PHP variable with string literal","tags":["php","string","variables"],"question_text":"Does anyone know a more efficient way of doing this?\nSay I have a variable\n`$test`\nand it's defined as:\n`$test = 'cheese'`\nI want to output\n`cheesey`\n, which I can do like this:\n`echo $test . 'y'`\nBut, I wou...
{"title":"iPhone: Detecting user inactivity\/idle time since last screen touch","tags":["iphone","objective-c"],"question_text":"Has anybody implemented a feature where if the user has not touched the screen for a certain time period, you take a certain action? I'm trying to figure out the best way to do that.\nThere's...
{"title":"Telnet is not recognized as internal or external command","tags":["tcp","windows-7"],"question_text":"I am trying to perform port forwarding to connect two emulators using TCP protocol on Windows. Although I have enabled TCP client program from control Panel, \"telnet\" command is not recognized in Command Pr...
{"title":"How to use OR condition in a JavaScript IF statement?","tags":["javascript","if-statement"],"question_text":"I understand that in JavaScript you can write:\n`if (A && B) { do something }`\nBut how do I implement an OR such as:\n`if (A OR B) { do something }`","answer_text":"Simply use doublepipe operator that...
{"title":"Rails auto-assigning id that already exists","tags":["ruby-on-rails","ruby-on-rails-3","postgresql"],"question_text":"I create a new record like so:\n`truck = Truck.create(:name=>name, :user_id=>2)`\nMy database currently has several thousand entities for truck, but I assigned the id's to several of them, in ...
{"title":"pandas: filter rows of DataFrame with operator chaining","tags":["pandas"],"question_text":"Most operations in\n`pandas`\ncan be accomplished with operator chaining (\n`groupby`\n,\n`aggregate`\n,\n`apply`\n, etc), but the only way I've found to filter rows is via normal bracket indexing\n`df_filtered = df[df...
{"title":"Generating a sha256 from the Linux command line","tags":["linux","shell","sha256"],"question_text":"I know the string \"foobar\" generates the SHA 256 hash\n`c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2`\nusing\nhttp:\/\/hash.online-convert.com\/sha256-generator\nHowever the command line s...
{"title":"How does Go compile so quickly?","tags":["performance","compiler-construction","build-process","go"],"question_text":"I've Googled and poked around the Go website, but I can't seem to find an explanation for Go's extraordinary build times. Are they products of the language features (or lack thereof), a highly...
{"title":"Are tuples more efficient than lists in Python?","tags":["python","performance","python-internals"],"question_text":"Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements?","answer_text":"In general, you might expect tuples to be slightly faster....
{"title":"What's the difference between TRUNCATE and DELETE in SQL","tags":["sql","database","truncate"],"question_text":"I wrote up an answer to this question by mistake in response to a question about the difference between DROP and TRUNCATE, but I thought that it's a shame not to share so I'll post my own answer to ...
{"title":"Debugging in Clojure?","tags":["debugging","clojure"],"question_text":"What are best ways to Debug Clojure code, while using the repl?","answer_text":"There's also dotrace, which allows you to look at the inputs and outputs of selected functions.\n`(use 'clojure.contrib.trace)\n(defn fib[n] (if (< n 2) n (+ (...
{"title":"How to remove a empty folder from a project under TFS control?","tags":["visual-studio-2010","visual-studio","tfs","tfs2010"],"question_text":"Suppose I have a project MyLib, under that, I created a folder say Folder1. No file under this folder. \nThe project is connected to TFS.\nThen I want to remove this f...
{"title":"Good examples of python-memcache (memcached) being used in Python?","tags":["python","memcached"],"question_text":"I'm writing a web app using Python and the web.py framework, and I need to use memcached throughout.\nI've been searching the internet trying to find some good documentation on the\npython-memcac...
{"title":"get only part of an Array in Java?","tags":["java","arrays"],"question_text":"I have an array of Integers in Java, I would like use only a part of it. I know in Python you can do something like this array[index:] and it returns the array from the index. Is something like this possible in Java.","answer_text":...
{"title":"The mcrypt extension is missing. Please check your PHP configuration","tags":["ubuntu","phpmyadmin","ubuntu-13.10","linuxmint"],"question_text":"I just followed the tutorial located at\nhttps:\/\/www.digitalocean.com\/community\/articles\/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu\nwhile fixin...
{"title":"How to set a selected option of a dropdown list control using angular JS","tags":["angularjs","drop-down-menu","angular-ngmodel","selected"],"question_text":"I am using Angular JS and I need to set a selected option of a dropdown list control using angular JS. Forgive me if this is ridiculous but I am new wit...
{"title":"Android: How to stretch an image to the screen width while maintaining aspect ratio?","tags":["java","android","layout"],"question_text":"I want to download an image (of unknown size, but which is always roughly square) and display it so that it fills the screen horizontally, and stretches vertically to maint...
{"title":"How to get the host name of the current machine as defined in the Ansible hosts file?","tags":["variables","ansible","ansible-playbook"],"question_text":"I'm setting up an Ansible playbook to set up a couple servers. There are a couple of tasks that I only want to run if the current host is my local dev host,...
{"title":"Can I color table columns using CSS without coloring individual cells?","tags":["html","css"],"question_text":"Is there a way to color spans of columns all the way down. See, starting example below:\n`<table border=\"1\">\r\n <tr>\r\n <th>Motor<\/th>\r\n <th colspan=\"3\">Engine<\/th>\r\n <th>Car<\/th>\r\n <t...
{"title":"How to solve error \"Missing `secret_key_base` for 'production' environment\" (Rails 4.1)","tags":["ruby-on-rails","ruby","heroku","ruby-on-rails-4"],"question_text":"I've created a rails app (rails 4.1) from scratch and I am facing a strange problem that I am not able to solve.\nEvery time I try to deploy my...
{"title":"Returning http status code from Web Api controller","tags":["c#","asp.net-web-api","httpresponse","http-status-codes"],"question_text":"I'm trying to return a status code of 304 not modified for a GET method in a web api controller.\nThe only way I succeeded was something like this:\n`public class TryControll...
{"title":"\"Cloning\" row or column vectors","tags":["python","matlab","numpy","octave","linear-algebra"],"question_text":"Sometimes it is useful to \"clone\" a row or column vector to a matrix. By cloning I mean converting a row vector such as\n`[1,2,3]`\nInto a matrix\n`[[1,2,3]\n [1,2,3]\n [1,2,3]\n]`\nor a column v...
{"title":"How do I use jQuery's form.serialize but exclude empty fields","tags":["javascript","jquery","forms","serialization","input"],"question_text":"I have a search form with a number of text inputs & drop downs that submits via a GET. I'd like to have a cleaner search url by removing the empty fields from the quer...
{"title":"What is a ViewModelLocator and what are its pros\/cons compared to DataTemplates?","tags":["wpf","mvvm","datatemplate","mvvm-light","viewmodellocator"],"question_text":"Can someone give me a quick summary of what a ViewModelLocator is, how it works, and what the pros\/cons are for using it compared to DataTem...
{"title":"Scala: Nil vs List()","tags":["scala"],"question_text":"In Scala, is there any difference at all between\n`Nil`\nand\n`List()`\n?\nIf not, which one is more idiomatic Scala style? Both for creating new empty lists and pattern matching on empty lists.","answer_text":"`scala> println (Nil == List())\ntrue\nscal...
{"title":"Parse String to Date with Different Format in Java","tags":["java","string","date"],"question_text":"I want to convert\n`String`\nto\n`Date`\nin different formats.\nFor example,\nI am getting from user,\n`String fromDate = \"19\/05\/2009\"; \/\/ i.e. (dd\/MM\/yyyy) format`\nI want to convert this\n`fromDate`\...
{"title":"Get last answer","tags":["python"],"question_text":"In many symbolic math systems, such as Matlab or Mathematica, you can use a variable like\n`Ans`\nor\n`%`\nto retrieve the last computed value. Is there a similar facility in the Python shell?","answer_text":"Underscore.\n`>>> 5+5\n10\n>>> _\n10\n>>> _ + 5\n...
{"title":"Push to a non-bare Git repository","tags":["git","git-push","git-non-bare-repository"],"question_text":"I usually work on a remote server via ssh (screen and vim), where I have a Git repository. Sometimes I'm not online, so I have a separate repository (cloned from my remote) on my laptop.\nHowever, I can't p...
{"title":"Using System.Dynamic in Roslyn","tags":["c#","roslyn"],"question_text":"I modified the example that comes with the new version of Roslyn that was released yesterday to use dynamic and ExpandoObject but I am getting a compiler error which I am not sure how to fix. The error is:\n(7,21): error CS0656: Missing c...
{"title":"How to iterate over files in directory with bash?","tags":["bash","filenames"],"question_text":"I need to write a script that starts my program with different arguments, but I'm new to bash. I start my program like this:\n`.\/MyProgram.exe Data\/data1.txt [Logs\/data1_Log.txt]`\n. Here is the pseudocode for w...
{"title":"How do I know who forked my repo on github?","tags":["github","git-fork"],"question_text":"Is there a way to know who has forked by repo on github? I can see the number of forks. Would also like to know who forked my repo and also what kind of changes they made to it. I know they can send me a pull request if...
{"title":"How to listen for Picasso (Android) load complete events?","tags":["java","android","picasso"],"question_text":"Is there a way to listen for events from Picasso when using the builder like:\n`Picasso.with(getContext()).load(url).into(imageView);`\nI'm trying to call\n`requestLayout()`\nand\n`invalidate()`\non...
{"title":"Why doesn't Xcode 4 create any products?","tags":["xcode","ios","xcode4"],"question_text":"Regardless of build configuration, building my iPad app does not actually output a .app file. It does run in the iPad simulator and on a device, but when I hit build or build and run, the binary appears under Products i...
{"title":"actionbar up navigation with fragments","tags":["android","android-fragments","android-actionbar"],"question_text":"I have a tabbed Actionbar\/viewpager layout with three tabs say\nA\n,\nB\n, and\nC\n. In tab\nC\ntab(fragment),I am adding another fragment say fragment\nD\n. with\n`DFragment f= new DFragment()...
{"title":"Haskell error parse error on input `='","tags":["haskell"],"question_text":"I'm new to Haskell and after starting\n`ghci`\nI tried:\n`f x = 2 * x`\nand I obtained:\n`<interactive>:1:4: parse error on input `='`\nwhich I don't understand.\nStrangely, it worked well before. I suppose that I have done misconfigu...
{"title":"Android: Align button to bottom-right of screen using FrameLayout?","tags":["android","layout"],"question_text":"I am trying to put the zoom controls of the map on the bottom right corner of screen. I could do it with RelativeLayout using both\n`alignParentBottom=\"true\"`\nand\n`alignParentRight=\"true\"`\n,...
{"title":"Get mouse wheel events in jQuery?","tags":["javascript","jquery","mousewheel"],"question_text":"Is there a way to get the mouse wheel events (not talking about\n`scroll`\nevents) in jQuery?","answer_text":"`\u00e2\u0080\u008b$(document).ready(function(){\n $('#foo').bind('mousewheel', function(e){\n if(e.orig...
{"title":"Receiver not registered exception error?","tags":["android","broadcastreceiver","illegalargumentexception"],"question_text":"In my developer console people keep reporting an error that I cannot reproduce on any phone I have. One person left a message saying he gets it when they try to open the settings screen...
{"title":"Should I use char** argv or char* argv[] in C?","tags":["c","arrays","pointers","standards"],"question_text":"I'm just learning C and was wondering which one of these I should use in my main method. Is there any difference?\nEdit:\nSo which one is more common to use?","answer_text":"As you are just learning C...
{"title":"Asp.Net MVC: How do I enable dashes in my urls?","tags":["asp.net-mvc"],"question_text":"I'd like to have dashes separate words in my URLs. So instead of:\n`\/MyController\/MyAction`\nI'd like:\n`\/My-Controller\/My-Action`\nIs this possible?","answer_text":"You can use the ActionName attribute like so:\n`[Ac...
{"title":"this certificate was signed by an unknown authority","tags":["ios","xcode","vmware","provisioning-profile"],"question_text":"I need to create ipa file for testing purposes.\nI go to Keychian access -> Certificate assistant -> Request a certificate from a certificate authority and create some.certSigningReques...
{"title":"Should private helper methods be static if they can be static","tags":["java","static","methods","static-methods"],"question_text":"Let's say I have a class designed to be instantiated. I have several private \"helper\" methods inside the class that do not require access to any of the class members, and opera...
{"title":"How to throw a C++ exception","tags":["c++","exception-handling"],"question_text":"I have a very poor understanding of exception handling(i.e., how to customize throw, try, catch statements for my own purposes).\nFor example, I have defined a function as follows:\n`int compare(int a, int b){...}`\nI'd like th...
{"title":"Initialize 2D array","tags":["java","multidimensional-array"],"question_text":"I am trying to initialize a 2D array, in which the type of each element is\nchar\n.\nSo far, I can only initialize this array in the follow way.\n`public class ticTacToe \n{\nprivate char[][] table;\npublic ticTacToe()\n{\n table[0...
{"title":"Casperjs\/PhantomJs vs Selenium","tags":["google-chrome","user-interface","selenium","automation","phantomjs"],"question_text":"We are using Selenium to automate our UI testing. Recently we have seen majority of our users using Chrome. So we wanted to know - pros and cons of using PhantomJS vs Selenium:\nIs t...
{"title":"What is the best way to validate a credit card in PHP?","tags":["php","validation","e-commerce","numbers","credit-card"],"question_text":"Given a credit card number and no additional information, what is the best way in PHP to determine whether or not it is a valid number?\nRight now I need something that wil...
{"title":"Fastest way(s) to move the cursor on a terminal command line?","tags":["bash","terminal","window"],"question_text":"What is the best way to move around on a given very long command line in the terminal?\nSay I used the arrow key or\nCtrl\n-\nR\nto get this long command line:\n`.\/cmd --option1 --option2 --opt...
{"title":"How to replace DOM element in place using Javascript?","tags":["javascript","dom"],"question_text":"I am looking to replace an element in the DOM. For example, there is an \"A\" element that I want to replace with a \"SPAN\" instead.\nHow would I go and do that?","answer_text":"by using\nreplaceChild()\n:\n`<...
{"title":"Strip Non-Alphanumeric Characters from an NSString","tags":["cocoa","cocoa-touch","nsstring","nscharacterset"],"question_text":"I'm looking for a quick and easy way to strip non-alphanumeric characters from an\n`NSString`\n. Probably something using an\n`NSCharacterSet`\n, but I'm tired and nothing seems to r...
{"title":"How to iterate over a TreeMap?","tags":["java","collections","treemap"],"question_text":"Possible Duplicate:\nHow do I iterate over each Entry in a Map?\nI want to iterate over a\n`TreeMap`\n, and for all keys which have a particular value, I want them to be added to a new\n`TreeMap`\n. How can I do this?","a...
{"title":"Open existing file, append a single line","tags":["c#","file"],"question_text":"I want to open a text file, append a single line to it, then close it.","answer_text":"You can use\n`File.AppendAllText`\nfor that:\n`File.AppendAllText(@\"c:\\path\\file.txt\", \"text content\" + Environment.NewLine);`","question...
{"title":"Convert a list to a string in C#","tags":["c#",".net","string","list"],"question_text":"How do I convert a list to a string in C#?\nWhen I execute\n`toString`\non a List object, I get:\nSystem.Collections.Generic.List`1[System.String]","answer_text":"Maybe you are trying to do\n`string combindedString = strin...
{"title":"How do I get my accordion to load with all the menus closed?","tags":["javascript","html","javascript-events","twitter-bootstrap"],"question_text":"I'm trying to follow the example here\nhttp:\/\/twitter.github.com\/bootstrap\/javascript.html#collapse\nI have placed a mockup here\nhttp:\/\/jsfiddle.net\/gqe7g...
{"title":"Can the Twitter Bootstrap Carousel plugin fade in and out on slide transition","tags":["jquery","twitter-bootstrap","carousel"],"question_text":"I have a very basic implementation of the Twitter Bootstrap Carousel plugin on a site that I am working on (http:\/\/furnitureroadshow.com\/). I was just wondering i...
{"title":"XCode4 and Core Data: How to enable SQL Debugging","tags":["sql","ios","core-data","xcode4"],"question_text":"I'm working on a universal iOS app and I'd like to see the raw SQL in the logs when I'm debugging. There is some info\nin this blog post\nabout how to enable raw SQL logging for iOS Core Data developm...
{"title":"Python - When to use file vs open","tags":["python","file"],"question_text":"What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)","answer_text":"You should always use\n`open()`\n.\nAs the\ndocumentation\nstates:\nWhen opening a file, it's preferable\n to use op...
{"title":"How to prevent a click on a '#' link from jumping to top of page in jQuery","tags":["javascript","jquery","html"],"question_text":"Warning: This may be a very stupid question...\nI'm currently using\n`<A>`\ntags with jquery to initiate things like click events, etc.\nExample is\n`<a href=\"#\" class=\"somecla...
{"title":"Sharing Test code in Maven","tags":["maven-2","testing"],"question_text":"How can you depend on test code from another module in Maven?\nExample, I have 2 modules:\nBase\nMain\nI would like a test case in Main to extend a base test class in Base. Is this possible?\nUpdate: Found an\nacceptable answer\n, which...
{"title":"Render a variable as HTML in EJS","tags":["node.js","express","ejs"],"question_text":"I am using the Forms library for Node.js (\nForms\n), which will render a form for me on the backend as so:\n`var signup_form = forms.create({\n username: fields.string({required: true})\n , password: fields.password({requir...
{"title":"Jquery date picker z-index issue","tags":["jquery","jquery-plugins","uidatepicker"],"question_text":"I have a slideshow div, and I have a datepicker field above that div.\nWhen I click in the datepicker field, the datepicker panel show behind slideshow div.\nAnd I have put the script as:\nhttp:\/\/ajax.google...
{"title":"Scheduling recurring task in Android","tags":["android","scheduled-tasks"],"question_text":"I'm designing an app that has a recurring task of sending presence to a dedicated server as long as the app is in foreground.\nIn my searches across the web I saw a few different approaches and wanted to know what is t...
{"title":"How does Content Security Policy work?","tags":["javascript","html","security","http-headers","content-security-policy"],"question_text":"I'm getting a bunch of errors in the developer console:\nRefused to evaluate a string\nRefused to execute inline script because it violates the following Content Security P...
{"title":"How different is Objective-C from C++?","tags":["c++","objective-c"],"question_text":"What are the main differences between Objective-C and C++ in terms of the syntax, features, paradigms, frameworks and libraries?\n*Important: My goal is not to start a performance war between the two languages. I only want r...
{"title":"How to set dialog to show with full screen?","tags":["android","dialog"],"question_text":"I have a GridView which show a lot of images and when I click any image it will show\nfull image\nin a full screen dialog\nPlease tell me how to do that\nthanks.","answer_text":"try\n`Dialog dialog=new Dialog(this,androi...
{"title":"Thread Safe singleton class","tags":["java","multithreading","singleton"],"question_text":"I wrote a below Singleton class. I am not sure whether this is thread safe singleton class or not?\n`public class CassandraAstyanaxConnection {\n private static CassandraAstyanaxConnection _instance;\n private AstyanaxC...
{"title":"Moq: Invalid setup on a non-overridable member: x => x.GetByTitle(\"asdf\")","tags":["c#","nhibernate","nunit","resharper","moq"],"question_text":"Not sure how I can fix this, trying to do a unit test on the method \"GetByTitle\"\nHere are my definitions:\n`public class ArticleDAO : GenericNHibernateDAO(IArti...
{"title":"Break from groovy each closure","tags":["groovy"],"question_text":"Is it possible to \"break\" from a Groovy each Closure?\nOr should I be using a classic loop instead?","answer_text":"Nope, you can't abort an \"each\" without throwing an exception. You likely want a classic loop if you want the break to abor...
{"title":"How to reuse an ostringstream?","tags":["c++","stl","reset","ostringstream"],"question_text":"I'd like to clear out and reuse an ostringstream (and the underlying buffer) so that my app doesn't have to do as many allocations. How do I reset the object to its initial state?","answer_text":"I've used a sequence...
{"title":"Common CSS Media Queries Break Points","tags":["css","responsive-design"],"question_text":"I am working on a Responsive Web Site with CSS Media Queries.\nIs the following a good organization for devices?\nPhone, Ipad (Landscape & Portrait), Desktop and Laptop, Large Screen\nWhat are the common media queries b...
{"title":"Detecting iOS orientation change instantly","tags":["iphone","objective-c","ios","orientation","gyroscope"],"question_text":"I have a game in which the orientation of the device affects the state of the game. The user must quickly switch between Landscape, Portrait, and Reverse Landscape orientations. So far ...
{"title":"Android Preventing Double Click On A Button","tags":["android"],"question_text":"What is the best way to prevent double clicks on a button in Android?","answer_text":"saving a last click time when clicking will prevent this problem.\ni.e.\n`private long mLastClickTime = 0;\n...\n\/\/ inside onCreate or so:\nf...
{"title":"Command-line tool for converting PLIST to JSON?","tags":["objective-c","json","plist"],"question_text":"Is there a command line tool available for converting .plist files to JSON?\nIf not, what would be the approach for creating one using Objective-C or C on a Mac? For instance, there is JSONKit, for Objectiv...
{"title":"C# Passing Function as Argument","tags":["c#","arguments"],"question_text":"I've written a function in C# that does a numerical differentiation. It looks like this:\n`public double Diff(double x)\n{\n double h = 0.0000001;\n return (Function(x + h) - Function(x)) \/ h;\n}`\nI would like to be able to pass in ...
{"title":"How to delete child object in NHibernate?","tags":["nhibernate"],"question_text":"I have a parent object which has a one to many relationship with an IList of child objects. What is the best way to delete the child objects? I am not deleting the parent. My parent object contains an IList of child objects. Her...
{"title":"How to I access an attached property in code behind?","tags":["c#","wpf","code-behind","attached-properties"],"question_text":"I have a rectangle in my XAML and want to change its\n`Canvas.Left`\nproperty in code behind:\n`<UserControl x:Class=\"Second90.Page\"\n xmlns=\"http:\/\/schemas.microsoft.com\/winfx\...
{"title":"How to change a nullable column to not nullable in a Rails migration?","tags":["ruby-on-rails","migration"],"question_text":"I created a date column in a previous migration and set it to be nullable. Now I want to change it to be not nullable. How do I go about doing this assuming there are null rows in that ...
{"title":"Generating a list of which files changed between hg versions","tags":["version-control","mercurial"],"question_text":"I want to generate a list of which files changed between two revisions in a given directory in Mercurial.\nIn particular, I am not interested in\nwhat\nchanged, but\nwhich files\nchanged in th...
{"title":"Difference between if () { } and if () : endif;","tags":["php"],"question_text":"Are there any differences between...\n`if ($value) {\n}`\n...and...\n`if ($value):\nendif;`\n?","answer_text":"They are the same but the second one is great if you have MVC in your code and don't want to have a lot of echos in yo...
{"title":"Eclipse java debugging: source not found","tags":["java","eclipse","debugging"],"question_text":"While debugging a java app in eclipse I receive a \"\nSource not found\n\" error in two cases:\nStepping in to a file in a different project which is already imported\nStepping in to a file in an installed maven r...
{"title":"File Explorer in Android Studio","tags":["android","android-studio"],"question_text":"Can anyone tell where the file explorer is located in android studio ?\nI tried to search in windows menu but there isn't any option like \"show view\" that used to be in eclipse.","answer_text":"You can start Monitor from t...
{"title":"Linux Shell Script For Each File in a Directory Grab the filename and execute a program","tags":["linux","shell"],"question_text":"Scenario :\nA folder in Linux system. I want to loop through every .xls file in a folder.\nThis folder typically consists of various folders, various filetypes (.sh, .pl,.csv,...)...
{"title":"Can I use Python as a Bash replacement?","tags":["python","bash","shell"],"question_text":"I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.\nI've seen mentioned a few places that python is good for this kind of thing, I know a little and I woul...
{"title":"Best implementation for Key Value Pair Data Structure?","tags":["c#","data-structures","collections"],"question_text":"So I've been poking around with C# a bit lately, and all the Generic Collections have me a little confused. Say I wanted to represent a data structure where the head of a tree was a key value...
{"title":"Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor","tags":["maven-2","maven"],"question_text":"`[INFO] [war:war {execution: default-war}]\n[INFO] Packaging webapp\n[INFO] ------------------------------------------------------------------------\n[ERROR]...
{"title":"Expand div to max width when float:left is set","tags":["html","width"],"question_text":"I have something like that:\n`<div style=\"width:100px;float:left\">menu<\/div>\n<div style=\"float:left\">content<\/div>`\nboth floats are neccesary. I want the content div to fill the whole screen minus those 100px for ...
{"title":"Linux c++ error: undefined reference to 'dlopen'","tags":["c++","linux","eclipse"],"question_text":"I work in Linux with C++ (Eclipse), and want to use a library.\nEclipse shows me an error:\n`undefined reference to 'dlopen'`\nDo you know a solution?\nHere is my code:\n`#include <stdlib.h>\n#include <stdio.h>...
{"title":"Angular.js ng-repeat across multiple elements","tags":["javascript","jquery","angularjs","angularjs-ng-repeat"],"question_text":"This question has been partly addressed here:\nAngular.js ng-repeat across multiple trs\nHowever that is just a work-around really, it doesn't actually address the core issue, which...
{"title":"How to resize a UISwitch?","tags":["iphone","cocoa","cocoa-touch"],"question_text":"I have made a\ncustom UISwitch (from this post)\n. But the problem is, my custom texts are a bit long. Is there any way to resize the switch? [I tried\n`setBounds`\n, did not work]\nEdit:\nHere is the code I used:\n`@interface...
{"title":"Get driving directions using Google Maps API v2","tags":["java","android","google-maps","google-maps-android-api-2","directions"],"question_text":"I am trying to get the driving direction between the two positions:\n`LatLng(12.917745600000000000,77.623788300000000000)\nLatLng(12.842056800000000000,7.663096499...
{"title":"maven build failed: Unable to locate the Javac Compiler in: jre or jdk issue","tags":["java","eclipse","maven"],"question_text":"I have my JAVA_HOME set to\n`C:\\Program Files (x86)\\Java\\jdk1.6.0_18`\nAfter I run maven install I get this message from eclipse:\nReason:\n`Unable to locate the Javac Compiler i...
{"title":"How do you pass multiple enum values in C#?","tags":["c#","enums"],"question_text":"Sometimes when reading others' C# code I see a method that will accept multiple enum values in a single parameter. I always thought it was kind of neat, but never looked into it.\nWell, now I think I may have a need for it, bu...
{"title":"What is a .pid file and what does it contain?","tags":["linux","unix","operating-system","system","pid"],"question_text":"I recently come across a file with the extension .pid and explored inside it but didn't find much. The documentation says:\nA Pid-File is a file containing the process identification numbe...
{"title":"codestyle; put javadoc before or after annotation?","tags":["java","coding-style","annotations","javadoc","code-documentation"],"question_text":"I know that it isn't the most vital of issues, but I just realised that I can put the javadoc comment block before or after the annotation. What would we want to ado...
{"title":"Whats the difference between 'weak' and 'assign' in delegate property declaration","tags":["objective-c","ios","ios5","delegates","properties"],"question_text":"Whats the difference between this:\n`@property (nonatomic, weak) id <SubClassDelegate> delegate;`\nand this:\n`@property (nonatomic, assign) id <SubC...
{"title":"How to get mathemical PI constant in Swift","tags":["swift","math","darwin","swift3"],"question_text":"I am trying to find a way to\ninclude the PI constant in my Swift code\n. I already found help in another answer, to\n`import Darwin`\nwhich I know gives me access to\nC functions\n.\nI also checked the\n`Ma...