text stringlengths 74 309k |
|---|
{"title":"Validation failed for one or more entities while saving changes to SQL Server Database using Entity Framework","tags":["c#","sql","asp.net-mvc","entity-framework","code-first"],"question_text":"I want to save my Edit to Database and I am using Entity FrameWork Code-First in ASP.NET MVC 3 \/ C# but I am gettin... |
{"title":"Multiline String Literal in C#","tags":["c#","string","shorthand"],"question_text":"Is there an easy way to create a multiline string literal in C#?\nHere's what I have now:\n`string query = \"SELECT foo, bar\"\n+ \" FROM table\"\n+ \" WHERE id = 42\";`\nI know PHP has\n`<<<BLOCK\nBLOCK;`\nDoes C# have someth... |
{"title":"How to get a random number in Ruby","tags":["ruby","random"],"question_text":"How do I generate a random number between\n`0`\nand\n`n`\n?","answer_text":"What is wrong with\n`rand(range)`\n?\nFrom\nRuby Random Numbers\n:\nIf you needed a random integer to simulate a roll of a six-sided die, you'd use:\n`1 + r... |
{"title":"How to reposition chrome developer tools","tags":["google-chrome","google-chrome-devtools"],"question_text":"The tools are opened on the bottom of the chrome window per default. This is a rather bad choice for a wide screen display since there is plenty of empty space to the right but not much vertical space ... |
{"title":"Use different Python version with virtualenv","tags":["python","virtualenv","virtualenvwrapper"],"question_text":"I have a Debian system currently running with python 2.5.4. I got virtualenv properly installed, everything is working fine. Is there a possibility that I can use a virtualenv with a different ver... |
{"title":"Difference between static class and singleton pattern?","tags":["design-patterns","static","singleton"],"question_text":"What real (i.e. practical) difference exists between a static class and a singleton pattern?\nBoth can be invoked without instantiation, both provide only one \"Instance\" and neither of th... |
{"title":"How to open the Google Play Store directly from my Android application?","tags":["android","google-play","store"],"question_text":"I have open the google play store using the follwing code\n`Intent i = new Intent(android.content.Intent.ACTION_VIEW);\ni.setData(Uri.parse(\"https:\/\/play.google.com\/store\/app... |
{"title":"Where is JAVA_HOME on OSX Yosemite (10.10), Mavericks (10.9), Mountain Lion (10.8) or OSX Lion (10.7)?","tags":["java","osx"],"question_text":"Java is an optional package on the latest versions of OSX.\nYet once installed it appears like the\nJAVA_HOME\nenvironment variable is\nnot set properly\n.","answer_te... |
{"title":"Can you explain what \"git reset\" does in plain english?","tags":["git","reset"],"question_text":"I have seen\ninteresting posts\nexplaining subtleties about\n`git reset`\n.\nUnfortunately, the more I read about it, the more it appears that I don't understand it fully. I come from a SVN background and Git is... |
{"title":"Delete with Join in MySQL","tags":["mysql"],"question_text":"`CREATE TABLE `clients` (\n `client_id` int(11),\n PRIMARY KEY (`client_id`)\n);\nCREATE TABLE `projects` (\n `project_id` int(11) unsigned,\n `client_id` int(11) unsigned,\n PRIMARY KEY (`project_id`)\n);\nCREATE TABLE `posts` (\n `post_id` int(11)... |
{"title":"What's the canonical way to check for type in python?","tags":["python","types"],"question_text":"What is the best way to check whether a given object is of a given type? How about checking whether the object inherits from a given type?\nLet's say I have an object\n`o`\n. How do I check whether it's a\n`str`\... |
{"title":"Angular ng-repeat Error \"Duplicates in a repeater are not allowed.\"","tags":["angularjs","ng-repeat"],"question_text":"I am defining a custom filter like so:\n`<div class=\"idea item\" ng-repeat=\"item in items\" isoatom> \n <div class=\"section comment clearfix\" ng-repeat=\"comment in item.comments | rang... |
{"title":"@selector() in Swift?","tags":["swift","selector","nstimer"],"question_text":"I'm trying to create an\n`NSTimer`\nin\n`Swift`\nbut I'm having some trouble.\n`NSTimer(timeInterval: 1, target: self, selector: test(), userInfo: nil, repeats: true)`\n`test()`\nis a function in the same class.\nI get an error in t... |
{"title":"File to byte[] in Java","tags":["java","file-io"],"question_text":"How do I convert a\n`java.io.File`\nto a\n`byte[]`\n?","answer_text":"From\nJDK 7\nyou can use\n`Files.readAllBytes(Path)`\n.\nExample:\n`import java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.nio.file.Path;\nPath path = Paths.g... |
{"title":"CSS selector for first element with class","tags":["css","css-selectors"],"question_text":"I have a bunch of elements with a class name\n`red`\n:\n`<p class=\"red\"><\/p>\n<div class=\"red\"><\/div>`\nI can't seem to select the first element with the\n`class=\"red\"`\nusing the following CSS rule:\n`.red:firs... |
{"title":"preferredStatusBarStyle isn't called","tags":["ios","ios7","uikit","uistatusbar"],"question_text":"I followed\nthis thread\nto override\n`-preferredStatusBarStyle`\n, but it isn't called. \nAre there any options that I can change to enable it? (I'm using XIBs in my project.)","answer_text":"For anyone using a... |
{"title":"Eclipse HotKey: how to switch between tabs?","tags":["eclipse","tabs","hotkeys"],"question_text":"How can I switch between opened windows in Eclipse? There is\nCtrl\n+\nF6\n, but it's asking me which one I want, but I want switch it like tabs in browser or window in operating system (\nCmd\n\/\nWin\n+\nTab\n)... |
{"title":"How to set Bullet colors in UL\/LI html lists via CSS without using any images or span tags","tags":["css","css3","layout","colors","html-lists"],"question_text":"Imagine a simple unsorted list with some\n`<li>`\nitems. Now, I have defined the bullets to be square shaped via\n`list-style:square;`\nHowever, if... |
{"title":"How to write iOS app purely in C","tags":["objective-c","ios","c","cocoa-touch","objective-c-runtime"],"question_text":"I read here\nLearn C Before Objective-C?\nUsually I then replace some Obj-C code with pure C code (after all you can mix them as much as you like, the content of an Obj-C method can be entir... |
{"title":"$rootScope.$broadcast vs. $scope.$emit","tags":["angularjs","angularjs-scope"],"question_text":"Now that the performance difference between\n`$broadcast`\nand\n`$emit`\nhas been eliminated, is there any reason to prefer\n`$scope.$emit`\nto\n`$rootScope.$broadcast`\n?\nThey are different, yes.\n`$emit`\nis res... |
{"title":"Using node.js as a simple web server","tags":["node.js","server","webserver"],"question_text":"I want to run a very simple HTTP server. Every GET request to\n`example.com`\nshould get\n`index.html`\nserved to it but as a regular HTML page (i.e., same experience as when you read normal web pages).\nUsing the c... |
{"title":"Formatting a number with exactly two decimals in JavaScript","tags":["javascript","rounding","decimal-point"],"question_text":"I have this line of code which rounds my numbers to two decimal places. But I get numbers like this: 10.8, 2.4, etc. These are not my idea of two decimal places so how I can improve t... |
{"title":"AngularJS passing data to $http.get request","tags":["angularjs","javascript-framework"],"question_text":"I have a function which does a http POST request. The code is specified below. This works fine.\n`$http({\n url: user.update_path, \n method: \"POST\",\n data: {user_id: user.id, draft: true}\n });`\nI ha... |
{"title":"Remove a symlink to a directory","tags":["linux","file","symlink"],"question_text":"I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it.\nI tried\n`rm`\nand get back\n`rm: cannot remove 'foo'`\n.\nI tried\n`rmdir`\nand got back\n`rmdir: failed t... |
{"title":"How to run process as background and never die?","tags":["linux","background-process"],"question_text":"I connect to the linux server via putty SSH. I tried to run it as a background process like this:\n`$ node server.js &`\nHowever, after 2.5 hrs the terminal becomes inactive and the process dies. Is there a... |
{"title":"Set ImageView width and height programmatically?","tags":["android","android-emulator","android-widget"],"question_text":"How can I set an\n`ImageView`\n's width and height programmatically?","answer_text":"It may be too late but for the sake of others who have the same problem, to set the height of the Image... |
{"title":"Hide strange unwanted Xcode 8 logs","tags":["ios","xcode","ios10","xcode8"],"question_text":"When using the Xcode 8 Beta 1 and creating a new blank project, the following logs appear when running the appliation:\n`2016-06-13 16:33:34.406093 TestiOS10[8209:100611] bundleid: com.appc.TestiOS10, enable_level: 0,... |
{"title":"How should a model be structured in MVC?","tags":["php","oop","model-view-controller","architecture","model"],"question_text":"I am just getting a grasp on the MVC framework and I often wonder how much code should go in the model. I tend to have a data access class that has methods like this:\n`public functio... |
{"title":"Can I have multiple :not() selectors?","tags":["css","css3","css-selectors"],"question_text":"I'm trying to select\n`input`\nelements of all\n`type`\ns except\n`radio`\nand\n`checkbox`\n.\nMany people have shown that you can put multiple arguments in\n`:not`\n, but using\n`type`\ndoesn't seem to work anyway I... |
{"title":"Xcode Product -> Archive disabled","tags":["xcode","provisioning","ad-hoc-distribution"],"question_text":"I have been archiving for ad hoc distribution fine for many months and suddenly today I cannot do so as the Archive menu item is disabled. I have not changed anything. I went through the provisioning setu... |
{"title":"JavaScript function in href vs. onclick","tags":["javascript","href"],"question_text":"I want to run a simple JavaScript function on a click without any redirection.\nIs there any difference or benefit between putting the JavaScript call in the\n`href`\nattribute (like this:\n`<a href=\"javascript:my_function... |
{"title":"How to detect Safari, Chrome, IE, Firefox and Opera browser?","tags":["javascript","browser-detection"],"question_text":"I have 5 addons \/ extensions for FF, Chrome, IE, Opera and Safari.\nI need the code to recognize the user browser and redirect (on click in an install button) to download the corresponding... |
{"title":"How can I get a list of git branches, ordered by most recent commit?","tags":["git","version-control","branch"],"question_text":"I want to get a list of all the branches in a Git repository with the \"freshest\" branches at the top, where the \"freshest\" branch is the one that's been committed to most recent... |
{"title":"How to deal with persistent storage (e.g. databases) in docker","tags":["docker"],"question_text":"How do people deal with persistent storage for your docker containers? I am currently using this approach: build the image, e.g. for Postgres, and then start the container with\n`docker run --volumes-from c0dbc3... |
{"title":"Check if a user has scrolled to the bottom","tags":["javascript","jquery","scroll","pagination"],"question_text":"I'm making a pagination system (sort of like Facebook) where the content loads when the user scrolls to the bottom. I imagine the best way to do that is to find when the user is at the bottom of t... |
{"title":"Java, check whether a string is not null and not empty?","tags":["java","mysql","string","string-comparison"],"question_text":"In my web app, I have a search field where I get some string and a combo box. So, I am sending two arguments to the remote function.\nI want to check that the user input is not null a... |
{"title":"'has_key()' or 'in'?","tags":["python"],"question_text":"I wonder what is better to do:\n`d = {'a': 1, 'b': 2}\n'a' in d\nTrue`\nor:\n`d = {'a': 1, 'b': 2}\nd.has_key('a')\nTrue`","answer_text":"`in`\nis definitely more pythonic.\nIn fact\n`has_key()`\nwas removed in Python 3.x\n.","question_code":["d = {'a':... |
{"title":"Set EditText cursor color","tags":["android","styles","android-edittext","galaxy-tab"],"question_text":"I am having this issue where I am using the Android's Holo theme on a tablet project. However, I have a fragment on screen which has a white background. I am adding an\n`EditText`\ncomponent on this fragmen... |
{"title":"The developers of this app have not set up this app properly for Facebook Login?","tags":["android","ios","facebook","facebook-graph-api"],"question_text":"I'm trying to make login with Facebook available in my script. I've done everything, but when I attempt to login with a Facebook account I get this error ... |
{"title":"Correct way to write line to file in Python","tags":["python","file-io"],"question_text":"I'm used to doing\n`print >>f, \"hi there\"`\nHowever, it seems that\n`print >>`\nis getting deprecated. What is the recommended way to do the line above?\nUpdate\n:\nRegarding all those answers with\n`\"\\n\"`\n...is th... |
{"title":"ElasticSearch, Sphinx, Lucene, Solr, Xapian. Which fits for which usage?","tags":["solr","lucene","elasticsearch","sphinx","xapian"],"question_text":"I'm currently looking at other search methods rather than having a huge SQL query.\nI saw\nelasticsearch\nrecently and played with\nwhoosh\n(a Python implementa... |
{"title":"C++ Functors - and their uses","tags":["c++","functor","function-call-operator"],"question_text":"I keep hearing a lot about functors in C++. Can someone give me an overview as to what they are and in what cases they would be useful?","answer_text":"A functor is pretty much just a class which defines the oper... |
{"title":".NET String.Format() to add commas in thousands place for a number","tags":["c#",".net"],"question_text":"I want to add a comma in the thousands place for a number.\n`String.Format()`\n?","answer_text":"`String.Format(\"{0:n}\", 1234);\nstring.Format(\"{0:n0}\", 9876); \/\/ no digits after the decimal point.`... |
{"title":"vim and NERD Tree extension - adding a file","tags":["vim","nerdtree"],"question_text":"When using the vim editor with the NERDTree plugin to navigate through the tree of your project, is there an easy way to create a new source code file under the currently highlighted directory?\nCurrently I go into my shel... |
{"title":"Howto Uninstall RVM","tags":["ruby","ubuntu-9.10","rvm"],"question_text":"Possible Duplicate:\nHow to remove rvm (ruby version manager) from my system?\nHow can I uninstall (or reinstall) RVM on Ubuntu 9.10? I messed up my current installation.","answer_text":"It\u00e2\u0080\u0099s easy; just do the following... |
{"title":".gitignore exclude folder but include specific subfolder","tags":["git","gitignore"],"question_text":"I have the folder application\/ which I add to the .gitignore. Inside the application\/ folder is the folder application\/language\/gr. How can I include this folder?\nI've tried this\n`application\/\n!applic... |
{"title":"UTF-8 all the way through","tags":["php","mysql","linux","apache"],"question_text":"I'm setting up a new server, and want to support UTF-8 fully in my web application. I have tried in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.\nWhere exactly do I need to set the ... |
{"title":"How do I encode and decode a base64 string?","tags":["c#","base64"],"question_text":"How do I return a base64 encoded string given a string?\nHow do I decode a base64 encoded string into a string?","answer_text":"Encode\n`public static string Base64Encode(string plainText) {\n var plainTextBytes = System.Text... |
{"title":"Local Storage vs Cookies","tags":["html","cookies","httprequest","local-storage"],"question_text":"I want to reduce load times on my websites by moving all cookies into local storage since they seem to have the same functionality. Are there any pros\/cons (especially performance-wise) in using local storage t... |
{"title":"Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist","tags":["c#","asp.net",".net","entity-framework","primary-key"],"question_text":"I am using Entity Framework 1 with .net 3.5.\nI am doing something simple like this:\n`var RoomDetails = context.Rooms.ToList(... |
{"title":"Linking to an external URL in Javadoc?","tags":["java","url","javadoc","hyperlink"],"question_text":"Something like:\n`\/**\n * See {@linktourl http:\/\/google.com}\n *\/`","answer_text":"This creates a \"See Also\" heading containing the link, i.e.:\n`\/**\n * @see <a href=\"http:\/\/google.com\">http:\/\/go... |
{"title":"How does the Java for each loop work?","tags":["java","foreach","syntactic-sugar"],"question_text":"`List<String> someList = new ArrayList<String>();\n\/\/ add \"monkey\", \"donkey\", \"skeleton key\" to someList`\n`for (String item : someList) {\n System.out.println(item);\n}`\nWhat would the equivalent for ... |
{"title":"How to rename a table column in MySQL","tags":["mysql","database","alter-table","mysql-error-1025"],"question_text":"How to rename a table column in table\n`xyz`\n, the columns are:\n`Manufacurerid, name, status, AI, PK, int`\nI want to rename to\n`manufacturerid`\nI tried using PHPMyAdmin panel which is not ... |
{"title":"Standard Android Button with a different color","tags":["android","android-layout"],"question_text":"I'd like to change the color of a standard Android button slightly in order to better match a client's branding.\nThe best way I've found to do this so far is to change the\n`Button`\n's drawable to the follow... |
{"title":"How does a hash table work?","tags":["data-structures","hash","hashtable","modulo"],"question_text":"I'm looking for an explanation of how a hashtable works - in plain English for a simpleton like me!\nFor example, I know it takes the key, calculates the hash (I am looking for an explanation how) and then per... |
{"title":"How do I force Sublime Text 2 to indent two spaces per tab?","tags":["editor","sublimetext2","sublimetext","indentation"],"question_text":"Is there a way to force Sublime Text 2 to always indent two spaces per tab when working with Ruby files?\nI know that indentation can be set under the\n`view -> indentatio... |
{"title":"How can I ensure that a division of integers is always rounded up?","tags":["c#","math"],"question_text":"I want to ensure that a division of integers is always rounded up if necessary. Is there a better way than this? There is a lot of casting going on. :-)\n`(int)Math.Ceiling((double)myInt1 \/ myInt2)`","an... |
{"title":"offsetting an html anchor to adjust for fixed header","tags":["javascript","html","css","anchor","offset"],"question_text":"I am trying to clean up the way my anchors work. I have a header that is fixed to the top of the page, so when you link to an anchor elsewhere in the page, the page jumps so the anchor i... |
{"title":"How to use a keypress event in AngularJS?","tags":["angularjs","angularjs-directive","angular-ui"],"question_text":"I want to catch the enter key press event on the textbox below. To make it more clear I am using a\n`ng-repeat`\nto populate the tbody. Here is the HTML:\n`<td><input type=\"number\" id=\"closeq... |
{"title":"How can I get Eclipse to show .* files?","tags":["eclipse","file","hidden"],"question_text":"By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.","answer_text":"In the pac... |
{"title":"Ruby function to remove all white spaces?","tags":["ruby","string"],"question_text":"What is the Ruby function to remove\nall\nwhite space? Kind of like php's\n`trim()`\n?","answer_text":"If you want to remove only leading and trailing whitespace (like PHP's trim) you can use\n`.strip`\n, but if you want to r... |
{"title":"Undo scaffolding in Rails","tags":["ruby-on-rails","scaffolding"],"question_text":"Is there any way to 'undo' the effects of a scaffold command in Rails?","answer_text":"First\n, if you have already run the migrations generated by the\n`scaffold`\ncommand, you have to rollback it at first.\n`rake db:rollback`... |
{"title":"Easiest way to convert a List to a Set in Java","tags":["java","collections"],"question_text":"What is the easiest way to convert a\n`List`\nto a\n`Set`\nin Java?","answer_text":"`Set<Foo> foo = new HashSet<Foo>(myList);`","question_code":[],"answer_code":["Set<Foo> foo = new HashSet<Foo>(myList);\n"],"retrie... |
{"title":"How do I convert a string to an enum in C#?","tags":["c#","string","enums"],"question_text":"What's the best way to convert a string to an enumeration value in C#?\nI have an HTML select tag containing the values of an enumeration. When the page is posted, I want to pick up the value (which will be in the for... |
{"title":"Complex Git branch name broke all Git commands","tags":["git","zsh","git-branch","parentheses"],"question_text":"I was trying to create a branch from\n`master`\nwith the following command,\n`git branch SSLOC-201_Implement___str__()_of_ProductSearchQuery`\nwhen Git suddenly stopped responding. I suspect the un... |
{"title":"Nginx no-www to www and www to no-www","tags":["redirect","ubuntu","nginx","rackspace","no-www"],"question_text":"I am using nginx on Rackspace cloud following a\ntutorial\n, searched the net and so far can't get this sorted.\nI want www.mysite.com to go to mysite.com as normal in .htaccess for seo and other ... |
{"title":"How do I invoke a Java method when given the method name as a string?","tags":["java","reflection","invoke"],"question_text":"If I have two variables:\n`Object obj;\nString methodName = \"getName\";`\nWithout knowing the class of\n`obj`\n, how can I call the method identified by\n`methodName`\non it?\nThe met... |
{"title":"How to pip install packages according to requirements.txt from a local directory?","tags":["python","virtualenv","pip"],"question_text":"Here is the problem\nI have a requirements.txt that looks like:\n`BeautifulSoup==3.2.0\nDjango==1.3\nFabric==1.2.0\nJinja2==2.5.5\nPyYAML==3.09\nPygments==1.4\nSQLAlchemy==0... |
{"title":"iphone, dismiss keyboard when touching outside of UITextField","tags":["ios","iphone","cocoa-touch","uitextfield","uikit"],"question_text":"I'm wondering how to make the keyboard disappear when the user touches outside of the UITextField?","answer_text":"You'll need to add an UITapGestureRecogniser and assign... |
{"title":"How to solve \"The specified service has been marked for deletion\" error","tags":["windows-services"],"question_text":"I try to remove a Windows Service with\n`sc delete <service name>`\n, and encounter the following error:\n[SC] DeleteService FAILED 1072:\nThe specified service has been marked for deletion.... |
{"title":"How to convert a Unix timestamp to DateTime and vice versa?","tags":["c#","datetime","unix","epoch","data-conversion"],"question_text":"There is this example code, but then it starts talking about millisecond \/ nanosecond problems.\nThe same question is on MSDN,\nSeconds since the Unix epoch in C#\n.\nThis i... |
{"title":"How to use SharedPreferences in Android to store, fetch and edit values","tags":["android","sharedpreferences"],"question_text":"I want to store a time value and need to retrieve and edit it. How can I use\n`SharedPreferences`\nto do this?","answer_text":"To obtain shared preferences, use the following method... |
{"title":"Specify private SSH-key to use when executing shell command with or without Ruby?","tags":["ruby","git","bash","shell","ssh"],"question_text":"A rather unusual situation perhaps, but I want to specify a private SSH-key to use when executing a shell (git) command from the local computer.\nBasically like this:\... |
{"title":"T-SQL: Selecting rows to delete via joins","tags":["tsql","join"],"question_text":"Scenario:\nLet's say I have two tables, TableA and TableB. TableB's primary key is a single column (BId), and is a foreign key column in TableA.\nIn my situation, I want to remove all rows in TableA that are linked with specifi... |
{"title":"Difference between JOIN and INNER JOIN","tags":["sql","sql-server","join","inner-join"],"question_text":"Both these joins will give me the same results:\n`SELECT * FROM table JOIN otherTable ON table.ID = otherTable.FK`\nvs\n`SELECT * FROM table INNER JOIN otherTable ON table.ID = otherTable.FK`\nIs there any... |
{"title":"finding the type of an element using jQuery","tags":["jquery"],"question_text":"In jQuery, if I have a reference to an element, how can I determine what kind of element it is, for example, an input or an dropdown? Is there any way to find out?\nDuplicate:\nHow can I determine the element type of a matched ele... |
{"title":"What is a race condition?","tags":["multithreading","concurrency","terminology","race-condition"],"question_text":"When writing multi-threaded applications, one of the most common problems experienced are race conditions.\nMy questions to the community are:\nWhat is a race condition? How do you detect them? H... |
{"title":"How to check file size in python?","tags":["python"],"question_text":"I am writing a Python script in Windows. I want to do something based on the file size. For example, if the size is greater than 0, I will send an email to somebody, otherwise continue to other things.\nHow do I check the file size?","answe... |
{"title":"How to read embedded resource text file","tags":["c#",".net","embedded-resource","streamreader"],"question_text":"How do I read an embedded resource (text file) using\n`StreamReader`\nand return it as a string? My current script uses a Windows form and textbox that allows the user to find and replace text in ... |
{"title":"Too many 'if' statements?","tags":["java","math","if-statement","formula"],"question_text":"The following code does work how I need it to, but it's ugly, excessive or a number of other things. I've looked at formulas and attempted to write a few solutions, but I end up with a similar amount of statements.\nIs... |
{"title":"Regular Expression for alphanumeric and underscores","tags":["regex"],"question_text":"I would like to have a regular expression that checks if a string contains only upper and lowercase letters, numbers, and underscores.","answer_text":"To match a string that contains\nonly\nthose characters (or an empty str... |
{"title":"How do I retrieve an HTML element's actual width and height?","tags":["javascript","html","xhtml","dhtml"],"question_text":"Suppose that I have a\n`<div>`\nthat I wish to center in the browser's display (viewport). To do so, I need to calculate the width and height of the\n`<div>`\nelement.\nWhat should I use... |
{"title":"Why is this program erroneously rejected by three C++ compilers?","tags":["c++","visual-c++","compiler-errors","clang"],"question_text":"I am having some difficulty compiling a C++ program that I've written.\nThis program is very simple and, to the best of my knowledge, conforms to all the rules set forth in ... |
{"title":"Revert multiple git commits","tags":["git","commit","git-revert"],"question_text":"I have a git repository that looks like this:\n`A -> B -> C -> D -> HEAD`\nI want the head of the branch to point to A, i.e. I want B, C, D, and HEAD to disappear and I want head to be synonymous with A.\nIt sounds like I can e... |
{"title":"Removing duplicate rows in Notepad++","tags":["notepad++"],"question_text":"Is it possible to remove duplicated rows in Notepad++, leaving only a single occurrence of a line?","answer_text":"Notepad++ can do this, provided you wanted to sort by line, and remove the duplicate lines at the same time.\nYou will ... |
{"title":"Get month name from Date","tags":["javascript","date"],"question_text":"How can I generate the name of the month (e.g: Oct\/October) from this date object in JavaScript?\n`var objDate = new Date(\"10\/11\/2009\");`","answer_text":"Shorter version:\n`var monthNames = [\"January\", \"February\", \"March\", \"Ap... |
{"title":"strip non-numeric characters from string","tags":["javascript","string"],"question_text":"Consider a non-DOM scenario where you'd want to remove all non-numeric characters from a string using JavaScript\/ECMAScript. Any characters that are in range 0 - 9 should be kept.\n`var myString = 'abc123.8<blah>';\n\/\... |
{"title":"Python `if x is not None` or `if not x is None`?","tags":["python","coding-style","boolean-expression"],"question_text":"I've always thought of the\n`if not x is None`\nversion to be more clear, but Google's\nstyle guide\nimplies (based on this excerpt) that they use\n`if x is not None`\n. Is there any minor ... |
{"title":"Escape @ character in razor view engine","tags":["razor","asp.net-mvc-3"],"question_text":"I am creating a sample ASP.NET MVC 3 site using Razor as view engine. The razor syntax starts with\n`@`\ncharacter e.g.\n`@RenderBody()`\n. If I write @test on my cshtml page it gives me parse error\nCS0103: The name 't... |
{"title":"Java, 3 dots in parameters","tags":["java","varargs"],"question_text":"What do the 3 dots in the following method mean?\n`public void myMethod(String... strings){\n \/\/ method body\n}`","answer_text":"It means that zero or more String objects (or an array of them) may be passed as the parameter(s) for that f... |
{"title":"How to export PUTTY Sessions list?","tags":["putty"],"question_text":"Is there a way to do this?\nOr I have to take manually every record from Registry?","answer_text":"You can export it simply by:\n`regedit \/e \"%userprofile%\\Desktop\\putty-sessions.reg\" HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Se... |
{"title":"How to lose margin\/padding in UITextView?","tags":["ios","iphone","cocoa-touch","uikit","uitextview"],"question_text":"I have a\n`UITextView`\nin my iOS Application, which displays a large amount of text. I am then paging this text by using the offset margin parameter of the\n`UITextView`\n. My problem is th... |
{"title":"location.host vs location.hostname and cross-browser compatibility?","tags":["javascript","html","window","location","host"],"question_text":"Which one of these is the most effective vs checking if the user agent is accessing via the correct domain.\nWe would like to show a small js based 'top bar' style warn... |
{"title":"Makefile variable assignment","tags":["makefile","gnu-make"],"question_text":"Can anybody give a clear explanation of how variable assignment really works in Makefiles.\nWhat is the difference between :\n`VARIABLE = value\n VARIABLE ?= value\n VARIABLE := value\n VARIABLE += value`\nI have read the\nsection\n... |
{"title":"CSS display: inline vs inline-block","tags":["css"],"question_text":"Possible Duplicate:\nWhat is the difference between display: inline and display: inline-block?\nIn CSS,\n`display`\ncan have values of\n`inline`\nand\n`inline-block`\n. Can anyone explain in detail the difference between\n`inline`\nand\n`inl... |
{"title":"Get Last Day of the Month in Python","tags":["python","date"],"question_text":"Is there a way using Python's standard library to easily determine (i.e. one function call) the last day of a given month?\nIf the standard library doesn't support that, does the dateutil package support this?","answer_text":"I did... |
{"title":"HashSet vs. List performance","tags":[".net","performance","collections","list","hash"],"question_text":"It's clear that a search performance of the generic\n`HashSet<T>`\nclass is higher than of the generic\n`List<T>`\nclass. Just compare the hash-based key with the linear approach in the\n`List<T>`\nclass.\... |
{"title":"Get the current language in device","tags":["android","localization"],"question_text":"How can we get the current language selected in the Android device?","answer_text":"If you want to get the selected language of your device, this might help you:\n`Locale.getDefault().getDisplayLanguage();`","question_code"... |
{"title":"What does the CSS rule clear: both do?","tags":["css","css-float"],"question_text":"What does the following CSS rule do:\n`.clear { clear: both; }`\nAnd why do we need to use it?","answer_text":"I won't be explaining how the floats work here (in detail), as this question generally focuses on\nWhy use\n`clear:... |
{"title":"How do you install Google frameworks (Play, Accounts, etc.) on a Genymotion virtual device?","tags":["android","avd","genymotion"],"question_text":"I'm currently trying out Genymotion and boy, it's so much faster than the ADT emulator.\nBut I need to install Google Play to download some apps into it. How do I... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.