text
stringlengths
74
309k
{"title":"Do copyright dates need to be updated?","tags":["server-side","copyright-display"],"question_text":"Every now and then I see a web site that has an old copyright date. In my mind, I always think \"Look at the sucker who forgot to update his copyright year!\" Then, while I was hard-coding a copyright year into...
{"title":"javascript - accessing private member variables from prototype-defined functions","tags":["javascript"],"question_text":"Is there any way to make \"private\" variables (those defined in the constructor), available to prototype-defined methods?\n`TestClass = function(){\n var privateField = \"hello\";\n this.n...
{"title":"TabLayout tab selection","tags":["android","android-design-library"],"question_text":"How to select tab in TabLayout programmatically?\n`TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);\n tabLayout.setupWithViewPager(viewPager);`","answer_text":"If you know the index of the tab you want to select, y...
{"title":"How to order by with union","tags":["sql"],"question_text":"Is it possible to order when the data is come from many select and union it together.Such as\n`Select id,name,age\nFrom Student\nWhere age < 15\nUnion\nSelect id,name,age\nFrom Student\nWhere Name like \"%a%\"`\nHow can I order this query by name.\nS...
{"title":"Any way to exit bash script, but not quitting the terminal","tags":["linux","bash"],"question_text":"When I use\n`exit`\ncommand in a shell script, the script will terminate the terminal (the prompt). Is there any way to terminate a script and then staying in the terminal?\nMy script\n`run.sh`\nis expected to...
{"title":"How to achieve code folding effects in Emacs?","tags":["emacs","elisp","code-folding"],"question_text":"Whats the best way to achieve something like code folding, or the type of cycling that org-mode uses. What would be the best solution in elisp to create this type of behavior?\nEDIT:\nI'm sorry I was not cl...
{"title":"How do you change a hashed password using asp.net membership provider if you don't know the current password?","tags":["asp.net","membership-provider"],"question_text":"Problem, there's no method:\n`bool ChangePassword(string newPassword);`\nYou have to know the current password (which is probably hashed and ...
{"title":"Associativity of \"in\" in Python?","tags":["python","syntax","python-2.x"],"question_text":"I'm making a Python parser, and this is\nreally\nconfusing me:\n`>>> 1 in [] in 'a'\nFalse\n>>> (1 in []) in 'a'\nTypeError: 'in <string>' requires string as left operand, not bool\n>>> 1 in ([] in 'a')\nTypeError: 'i...
{"title":"Friend scope in C++","tags":["c++","friend"],"question_text":"If I have three classes, A, B, C. A and B are friends (bidirectionally). Also, B and C are friends (bidirectionally). A has a pointer to B and B has a pointer to C. Why can't A access C's private data through the pointer?\nJust to clarify: This is ...
{"title":"Correct way to delete cookies server-side","tags":["http","cookies"],"question_text":"For my authentication process I use py-bcrypt to create a unique token when a user logs in and put that into a cookie which is used for authentication.\nSo I would send something like this from the server:\n`Set-Cookie: toke...
{"title":"How to differentiate between iphone4 and iphone 3","tags":["ios","ccsprite"],"question_text":"I am trying to build a game for the iphone using cocos2d engine. I wanted to know how can I tell a difference whether the user is using iphone 4 or iphone 3 as I wanted to load hi-resolution graphics for the iphone4 ...
{"title":"Hidden Features of Visual Studio (2005-2010)?","tags":["visual-studio","text-editor","hidden-features"],"question_text":"Visual Studio is such a massively big product that even after years of working with it I sometimes stumble upon a new\/better way to do things or things I didn't even know were possible.\nF...
{"title":"Netbeans: how to change @author","tags":["netbeans","javadoc","netbeans-7"],"question_text":"When creating a new class or interface in Netbeans IDE, an \"@author ....\" tag appears. How to change its value? If possible, I would like to change it by using Netbeans menu and not by editing some config files :) I...
{"title":"Table is marked as crashed and should be repaired","tags":["mysql","database","wordpress","table"],"question_text":"I am getting this error in wordpress phpMyadmin\n`#145 - Table '.\/DB_NAME\/wp_posts' is marked as crashed and should be repaired`\nWhen I login to phpMyadmin, it says wp_posts is \"in use\"\nMy...
{"title":"Creating a simple XML file using python","tags":["python","xml"],"question_text":"What are my options if I want to create a simple XML file in python? (library wise)\nThe xml I want looks like:\n`<root>\n <doc>\n <field1 name=\"blah\">some value1<\/field1>\n <field2 name=\"asdfasd\">some vlaue2<\/field2>\n <\...
{"title":"How to redirect to a different domain using NGINX?","tags":["redirect","nginx","vhosts"],"question_text":"How can I redirect\n`mydomain.com`\nand any subdomain\n`*.mydomain.com`\nto\n`www.adifferentdomain.com`\nusing NGINX?","answer_text":"server_name\nsupports suffix matches using .mydomain.com syntax:\n`ser...
{"title":"Realistic usage of the C99 'restrict' keyword?","tags":["c","gcc","c99","restrict-qualifier"],"question_text":"I was browsing through some documentation and questions\/answers and saw it mentioned. I read a brief description, stating that it would be basically a promise from the programmer that the pointer wo...
{"title":"Margin while printing html page","tags":["html","css","printing","stylesheet"],"question_text":"I am using a separate style-sheet for printing. Is it possible to set right and left margin in the style-sheet which set the print margin (i.e. margin on paper).\nThanks.","answer_text":"You should use\n`cm`\nor\n`...
{"title":"Linux scripting: hiding user input on terminal","tags":["linux","bash","scripting"],"question_text":"I have bash script like the following:\n`#!\/bin\/bash\necho \"Please enter your username\";\nread username;\necho \"Please enter your password\";\nread password;`\nI want that when the user types the password...
{"title":"Initializing C# auto-properties","tags":["c#","initialization","automatic-properties"],"question_text":"I'm used to writing classes like this:\n`public class foo {\n private string mBar = \"bar\";\n public string Bar {\n get { return mBar; }\n set { mBar = value; }\n }\n \/\/... other methods, no constructor ...
{"title":"Sorting a Python list by two criteria","tags":["python","sorting"],"question_text":"I have the following list created from a sorted csv\n`list1 = sorted(csv1, key=operator.itemgetter(1))`\nI would actually like to sort the list by two criteria: first by the value in field 1 and then by the value in field 2. H...
{"title":"Pattern to avoid nested try catch blocks?","tags":["c#","design-patterns","try-catch","monads"],"question_text":"Consider a situation where I have three (or more) ways of performing a calculation, each of which can fail with an exception. In order to attempt each calculation until we find one that succeeds, I...
{"title":"Any way to limit border length?","tags":["css","css3"],"question_text":"Is there any way to limit the length of a border. I have a\n`<div>`\nthat has a bottom border, but I want to add a border on the left of the\n`<div>`\nthat only stretches half of the way up.\nIs there any way to do so without adding extra...
{"title":"Handle ModelState Validation in ASP.NET Web API","tags":["c#","asp.net-web-api"],"question_text":"I was wondering how I can achive model validation with ASP.NET Web API. I have my model like so:\n`public class Enquiry\n{\n [Key]\n public int EnquiryId { get; set; }\n [Required]\n public DateTime EnquiryDate {...
{"title":"MySQL select with CONCAT condition","tags":["mysql","select","condition","where","concat"],"question_text":"I'm trying to compile this in my mind.. i have a table with firstname and lastname fields\nand i have a string like \"Bob Jones\" or \"Bob Michael Jones\" and several others.\nthe thing is, i have for e...
{"title":"Android: How to Enable\/Disable Wifi or Internet Connection Programmatically","tags":["android"],"question_text":"Using the Connectivity Manager Class we can get access to either wifi or Internet Network:\n`ConnectivityManager connec = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);\n\/\/...
{"title":"How can I get the UITableView scroll position so I can save it?","tags":["iphone","objective-c","uitableview","uiscrollview"],"question_text":"Is there any way to find out which\n`UITableViewCell`\nis at the top of the scroll window?\nI'd like to get the current scroll position so that I can save it when the ...
{"title":"Automatically remove Subversion unversioned files","tags":["svn","build-automation"],"question_text":"Does anybody know a way to recursively remove all files in a working copy that are not under version control? (I need this to get more reliable results in my automatic build VMware.)","answer_text":"this work...
{"title":"Does python urllib2 automatically uncompress gzip data fetched from webpage?","tags":["python","gzip","urllib2"],"question_text":"I'm using\n`data=urllib2.urlopen(url).read()`\nI want to know:\nHow can I tell if the data at a URL is gzipped?\nDoes urllib2 automatically uncompress the data if it is gzipped? Wi...
{"title":"linq to entities case sensitive comparison","tags":["c#",".net","entity-framework-4","linq-to-entities"],"question_text":"This isn't a case-sensitive comparison in Linq to entities:\n`Thingies.First(t => t.Name == \"ThingamaBob\");`\nHow can I achieve case sensitive comparison with Linq to entities?","answer_...
{"title":"Why java Arrays use two different sort algorithms for different types?","tags":["java","algorithm"],"question_text":"`Arrays.java`\n's sort method uses quicksort for arrays of primitives and merge sort for arrays of objects. I believe that most of time quicksort is faster than merge sort and costs less memory...
{"title":"Windows GUI tool for sqlite3?","tags":["windows","user-interface","sqlite3"],"question_text":"Im using the bundled sqlite3 version for rails and i wonder if there is an equivalent to phpmyadmin?\nHow else am i going to see what is in the database?","answer_text":"Check out:\nDB Browser for SQLite\n(formerly k...
{"title":"What's wrong with nullable columns in composite primary keys?","tags":["database","database-design"],"question_text":"ORACLE does not permit NULL values in any of the columns that comprise a primary key. It appears that the same is true of most other \"enterprise-level\" systems.\nAt the same time, most syste...
{"title":"How to have stored properties in Swift, the same way I had on Objetive-C?","tags":["ios","swift","associated-object"],"question_text":"I am switching an application from Objective-C to Swift, which I have a couple of categories with stored properties, for example:\n`@interface UIView (MyCategory)\n- (void)ali...
{"title":"pyplot scatter plot marker size","tags":["matplotlib","marker","scatter"],"question_text":"In the pyplot document for scatter plot:\nmatplotlib.pyplot.scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, faceted=True, verts=None, hold=None, **kwargs)\...
{"title":"How do you uninstall all your bower packages?","tags":["javascript","bower"],"question_text":"Sometimes it's useful to rebuild an entire site and force bower to reinstall new versions of all the packages in bower.json.\nHowever, there doesn't seem to be any way of doing that:\nAttempt #1:\n`$ bower uninstall\...
{"title":"How does Jekyll date formatting work?","tags":["liquid","jekyll"],"question_text":"I'm using Jekyll to generate a simple site.\nI want the date field to display in the format\n`12 September 2011`\n.\nI've found, through some creative googling, a bit of date-format manipulation, but nothing that seems to get m...
{"title":"Is it possible to start activity through adb shell?","tags":["android"],"question_text":"I want to start activity through adb shell. So that I can launch a specific activity that is needed","answer_text":"Launch adb shell and enter the command as follows\n`am start -n yourpackagename\/.activityname`","questio...
{"title":"HTML - Display image after selecting filename","tags":["html","file-upload"],"question_text":"Possible Duplicate:\nPreview an image before it is uploaded\nI have a form that allows me with\n`<input type=\"file\" name=\"filename\" accept=\"image\/gif, image\/jpeg, image\/png\">`\nto browse and select a file.\n...
{"title":"Objective-C: init vs initialize","tags":["objective-c","initialization","init","initializer"],"question_text":"In Objective-C, what is the difference between the\n`init`\nmethod (i.e. the designated initializer for a class) and the\n`initialize`\nmethod? What initialization code should be put in each?","answe...
{"title":"Difference between Visual Basic 6.0 and VBA","tags":["vba","vb6"],"question_text":"What is the difference between the two. I always thought VBA is somewhat 'crippled' version of VB, but when a friend asked me the other day I had no idea what the actual differences are.\nAlso, when you use, for example, Excel,...
{"title":"Common class for AsyncTask in Android?","tags":["android","android-asynctask"],"question_text":"I have a common class say for eg Class A which extends\n`AsyncTask`\nand has all the methods implemented i.e.\n`onPreExecute`\n,\n`doinbackground`\nand\n`onPostExecute`\n.\nNow, there are other classes which want t...
{"title":"How to populate options of h:selectOneMenu from database?","tags":["database","jsf","selectonemenu"],"question_text":"I am creating a web application, where you have to read a list of objects \/ entities from a DB and populate it in a JSF\n`<h:selectOneMenu>`\n. I am unable to code this. Can someone show me h...
{"title":"How do I split a string into an array of characters?","tags":["javascript","string"],"question_text":"`var s = \"overpopulation\";\nvar ar = [];\nar = s.split();\nalert(ar);`\nI want to string.split a word into array of characters.\nThe above code doesn't seem to work - it returns \"overpopulation\" as Object...
{"title":"onActivityResult RESULT_OK can not be resolved to a variable in android?","tags":["android","android-fragments"],"question_text":"I am trying to launch camera in fragment but onActivityResult in fragment doesn't resolve RESULT_OK. What should i do?\nI am launching camera using:\n`public static final int CAMER...
{"title":"Convert List<DerivedClass> to List<BaseClass>","tags":["c#","list","inheritance","collections","covariance"],"question_text":"While we can inherit from base class\/interface, why can't we declare a\n`List<>`\nusing same class\/interface?\n`interface A\n{ }\nclass B : A\n{ }\nclass C : B\n{ }\nclass Test\n{\n ...
{"title":"Javascript swap array elements","tags":["javascript","arrays"],"question_text":"Is there any simpler way to swap two elements in an array?\n`var a = list[x], b = list[y];\nlist[y] = a;\nlist[x] = b;`","answer_text":"You only need one temporary variable.\n`var b = list[y];\nlist[y] = list[x];\nlist[x] = b;`","...
{"title":"How can I obfuscate my Perl script to make it difficult to reverse engineer?","tags":["perl"],"question_text":"I've developed a Perl script that has a confidential business logic.\nI have to give this script to another Perl coder to test it in his environment. He may try to extract the logic in my program. So...
{"title":"TreeMap sort by value","tags":["java"],"question_text":"I want to write an comparator that will let me sort TreeMap by value instead of the default natural sorting. i tried something like this, but can't find out what went wrong:\n`import java.util.*;\nclass treeMap {\n public static void main(String[] args) ...
{"title":"Unit Testing of private methods in Xcode","tags":["objective-c","cocoa","xcode","tdd","ocunit"],"question_text":"I'm trying out test driven development in a toy project. I can get the tests working for the public interface to my classes (although I'm still on the fence because I'm writing more testing code th...
{"title":"How do you compare structs for equality in C?","tags":["c","struct","equality"],"question_text":"How do you compare two instances of structs for equality in standard C?","answer_text":"C provides no language facilities to do this - you have to do it yourself and compare each structure member by member.","ques...
{"title":"Iterate over each line in a string in PHP","tags":["php","string"],"question_text":"I have a form that allows the user to either upload a text file or copy\/paste the contents of the file into a textarea. I can easily differentiate between the two and put whichever one they entered into a string variable, but...
{"title":"Difference Between Invoke and DynamicInvoke","tags":["c#",".net","delegates","invoke","dynamic-invoke"],"question_text":"What is the difference between Invoke and DynamicInvoke in delegates? Please give me some code example which explain difference between that two methods.","answer_text":"When you have a del...
{"title":"Visual Studio 2013 and ASP.NET Web Configuration Tool","tags":["visual-studio","visual-studio-2013"],"question_text":"I'm using Visual Studio 2013 and as you probably know there is no ASP.NET Web Configuration Tool. I wanted as always make fast roles etc. I tried enable it using this article:\nhttp:\/\/blogs....
{"title":"What is the most compatible way to install python modules on a Mac?","tags":["python","osx","module","packages","macports"],"question_text":"I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using ...
{"title":"align text using drawInRect:withAttributes:","tags":["ios","nsstring","ios7"],"question_text":"In the iOS 5 version of my app I had:\n`[self.text drawInRect: stringRect\n withFont: [UIFont fontWithName: @\"Courier\" size: kCellFontSize]\n lineBreakMode: NSLineBreakByTruncatingTail\n alignment: NSTextAlignment...
{"title":"SqlDateTime.MinValue != DateTime.MinValue, why?","tags":[".net","sql-server","datetime","types"],"question_text":"I wonder, why SqlDateTime.MinValue is not the same as DateTime.MinValue?","answer_text":"I think the difference between SQL's and .NET's\nDate\ndata types stems from the fact that SQL Server's\nda...
{"title":"select multiple columns in data.table R","tags":["r","data.table"],"question_text":"I couldn't find the answer for this simple question.\nwhat's the equivalent of selecting multiple columns in data.table just like this in data.frame\n`df <- data.frame(a=1,b=2,c=3)\ndf[,2:3]`\nthanks","answer_text":"(For info ...
{"title":"Collections.emptyMap() vs new HashMap()","tags":["java","collections"],"question_text":"What are some of the situations where I can use\n`Collections.emptyMap()`\n? The Documentation says I can use this method if I want my collection to be immutable.\nWhy would I want an immutable empty collection? What is th...
{"title":"Is there a way to pause a CABasicAnimation?","tags":["iphone","core-animation","cabasicanimation"],"question_text":"I have a basic spinning animation of the iPhone. Is there any way that I can \"pause\" the animation so that the position of the view will be maintained? I guess one way of doing this would be t...
{"title":"Change type of varchar field to integer: \"cannot be cast automatically to type integer\"","tags":["postgresql","casting","postgresql-9.1","fieldtype"],"question_text":"I have a small table and a certain field contains the type \"\ncharacter varying\n\". I'm trying to change it to \"\nInteger\n\" but it gives...
{"title":"Proper Repository Pattern Design in PHP?","tags":["php","database","laravel","repository","repository-pattern"],"question_text":"Preface: I'm attemping to use the repository pattern in a MVC architecture with relational databases.\nI've recently started learning TDD in PHP, and I'm realizing that my database ...
{"title":"How do I truly reset every setting in Visual Studio 2012?","tags":["visual-studio-2012"],"question_text":"I am trying to reset every single setting inside Visual Studio as I have completely lost all\nIntelliSense\n. I tried the Tools -> Import\/Export settings -> Reset, but that is not clearing all the settin...
{"title":"Set attribute without value","tags":["javascript","jquery","attributes","attr"],"question_text":"How do I set a data attribute without adding a value in jQuery? I want this:\n`<body data-body>`\nI tried:\n`$('body').attr('data-body'); \/\/ this is a getter, not working\n$('body').attr('data-body', null); \/\/...
{"title":"Using CRON jobs to visit url?","tags":["linux","web-applications","web","cpanel","cron-task"],"question_text":"I have a web application that has to perform a repeated tasks, Sending messages and alerts, I, already, use a script page do those tasks when it loaded in the browser i.e\nhttp:\/\/example.com\/tasks...
{"title":"Linq to EntityFramework DateTime","tags":["c#","linq","entity-framework","datetime"],"question_text":"In my application I am using Entity Framework.\nMy Table\n`-Article\n-period\n-startDate`\nI need records that match =>\n`DateTime.Now > startDate and (startDate + period) > DateTime.Now`\nI tried this code b...
{"title":"Compiling C++ on remote Linux machine - \"clock skew detected\" warning","tags":["c++","linux","makefile"],"question_text":"I'm connected to my university's small Linux cluster via PuTTY and WinSCP, transferring files using the latter and compiling and running them with the former. My work so far has been per...
{"title":"Ruby class types and case statements","tags":["ruby","duck-typing","case-statement"],"question_text":"What is the difference between\n`case item.class\nwhen MyClass\n # do something here\nwhen Array\n # do something different here\nwhen String\n # do a third thing\nend`\nand\n`case item.class\nwhen MyClass.cl...
{"title":"Android ListView Text Color","tags":["android","listview"],"question_text":"I am trying to set the ListView textColor to black, since I am using a white background.\nHere is my MailActivity\n`public class MailActivity extends ListActivity {\n String[] listItems = { \"Compose\", \"Inbox\", \"Drafts\", \"Sent\"...
{"title":"For Loop on Lua","tags":["loops","for-loop","lua"],"question_text":"My assignment is how to do a for loop. I have figured it out in terms of numbers but cannot figure it out in terms of names. I would like to create a for loop that runs down a list of names. Following is what I have so far:\n`names = {'John',...
{"title":"How do I change read\/write mode for a file using Emacs?","tags":["emacs","file","file-permissions"],"question_text":"If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs?","answer_text":"M-x toggle-read-only\nOn my Windows box, that amounts to Alt-x to bring u...
{"title":"How do I compare two strings in Perl?","tags":["perl","string-comparison"],"question_text":"How do I compare two strings in Perl?\nI am learning Perl, I had this basic question looked it up here on StackOverflow and found no good answer so I thought I would ask.","answer_text":"See\nperldoc perlop\n. Use\n`lt...
{"title":"How can I validate a string to only allow alphanumeric characters in it?","tags":["c#","regex"],"question_text":"How can I validate a string using Regular Expressions to only allow alphanumeric characters in it?\n(I don't want to allow for any spaces either).","answer_text":"Use the expression:\n`^[a-zA-Z0-9]...
{"title":"Android Studio - supplied javaHome is not a valid folder","tags":["java","android-studio","java-8"],"question_text":"I decided to update my JDK to Java 8, and installed to the default location of\n`C:\\Program Files\\Java\\jdk1.8.0`\nwith a\n`jre`\nsubdirectory.\nI wasn't sure how Android Studio worked out th...
{"title":"What is a wrapper class?","tags":["design-patterns","wrapper"],"question_text":"What is a wrapper class?\nHow are such classes useful?","answer_text":"In general, a wrapper class is any class which \"wraps\" or \"encapsulates\" the functionality of another class or component. These are useful by providing a l...
{"title":"Find index of a value in an array","tags":["c#","arrays","linq"],"question_text":"Can linq somehow be used to find the index of a value in an array?\nFor instance, this loop locates the key index within an array.\n`for (int i = 0; i < words.Length; i++)\n{\n if (words[i].IsKey)\n {\n keyIndex = i;\n }\n}`","a...
{"title":"Icon already includes gloss effects","tags":["ios","ios5","icons"],"question_text":"I have a problem with the gloss effect in app icon at iOS 5 beta 5, in iOS 4 it's show the effect not gloss, but iOS5 shows the glosss effect. I put the option\n`Icon already includes gloss effects = YES`\n, but simply does no...
{"title":"Can I change a private readonly field in C# using reflection?","tags":["c#","reflection","field","readonly"],"question_text":"I am wondering, since a lot of things can be done using reflection, can I change a private readonly field after the constructor completed its execution?\n(note: just curiosity)\n`publi...
{"title":"C++ versus D","tags":["java","c++","c","d"],"question_text":"Is the\nD language\na credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing?\nThe main reason I ask is that with the new c++ standard (c++0x) almost here, ...
{"title":"Convert text into number in MySQL query","tags":["mysql","sql"],"question_text":"Is it possible to convert text into number within MySQL query? I have a column with an identifier that consists a name and a number in the format of \"name-number\". The column has VARCHAR type. I want to sort the rows according ...
{"title":"\"401 Unauthorized\" on a directory","tags":["asp.net","asp.net-mvc","iis","iis-7"],"question_text":"I assume this is an IIS error, as this doesn't happen if I run the project on my local machine.\nI have my stylesheets at\n`~\/Content\/css`\nAny files in that directory won't load on the page, and when I navi...
{"title":"Set default value of an integer column SQLite","tags":["android","database","sqlite","android-sqlite"],"question_text":"I am creating an SQLite database in android.\n`db.execSQL(\"CREATE TABLE \" + DATABASE_TABLE + \" (\" + KEY_ROWID\n + \" INTEGER PRIMARY KEY AUTOINCREMENT, \" + KEY_NAME\n + \" TEXT NOT NULL...
{"title":"The 3 different equals","tags":["javascript","php","comparison","operators"],"question_text":"What is the difference between\n`=`\n,\n`==`\n, and\n`===`\n?\nI think using one equal sign is to declare a variable while two equal signs is for a comparison condition and lastly three equal signs is for comparing v...
{"title":"Get Image Height and Width as integer values?","tags":["php"],"question_text":"I've tried to use the PHP function\ngetimagesize\n, but I was unable to extract the image width and height as an integer value.\nHow can I achieve this?","answer_text":"Try like this:\n`list($width, $height) = getimagesize('path_to...
{"title":"LAST_INSERT_ID() MySQL","tags":["mysql","insert","lastinsertid"],"question_text":"I have a MySQL question that I think must be quite easy. I need to return the LAST INSERTED ID from table1 when I run the following MySql query:\n`INSERT INTO table1 (title,userid) VALUES ('test',1); \nINSERT INTO table2 (parent...
{"title":"how get yesterday and tomorrow datetime in c#","tags":["c#","datetime"],"question_text":"I have a code:\n`int MonthNow = System.DateTime.Now.Month;\nint YearNow = System.DateTime.Now.Year;\nint DayNow = System.DateTime.Now.Day;`\nHow can I get yesterday and tomorrow day, month and year in C#?\nOf course, I ca...
{"title":"Why are primes important in cryptography?","tags":["cryptography","primes"],"question_text":"One thing that always strikes me as a non-cryptographer: Why is it so important to use Prime numbers? What makes them so special in cryptography?\nDoes anyone have a\nsimple\nshort explanation? (I am aware that there ...
{"title":"iPhone CoreData: How can I track\/observe all changes within a subgraph?","tags":["iphone","core-data","nsmanagedobject","nsmanagedobjectcontext"],"question_text":"I have a NSManagedObjectContext in which I have a number of subclasses of NSManagedObjects such that some are containers for others. What I'd like...
{"title":"Converting an int to std::string","tags":["c++","string","int"],"question_text":"What is the shortest way, preferably inline-able, to convert an int to a string? Answers using stl and boost will be welcomed.","answer_text":"You can use\nstd::to_string\nin C++11\n`int i = 3;\nstd::string str = std::to_string(i...
{"title":"Write a number with two decimal places SQL server","tags":["sql","sql-server","decimal","number-formatting"],"question_text":"How do you write a number with two decimal places for sql server?","answer_text":"try this\n`SELECT CONVERT(DECIMAL(10,2),YOURCOLUMN)`","question_code":[],"answer_code":["SELECT CONVER...
{"title":"Force DOM redraw\/refresh on Chrome\/Mac","tags":["javascript","css","osx","dom","google-chrome"],"question_text":"Every once in a while, Chrome will render perfectly valid HTML\/CSS incorrectly or not at all. Digging in through the DOM inspector is often enough to get it to realize the error of its ways and ...
{"title":"How to set UICollectionViewDelegateFlowLayout?","tags":["ios","uicollectionview","flowlayout"],"question_text":"A UIViewController maintains a reference to a UICollectionView. The controller should modify the built-in flow layout using the UICollectionViewDelegateFlowLayout.\nIt's pretty easy to set the view'...
{"title":"How do I view all ignored patterns set with svn:ignore recursively in an svn repository?","tags":["svn","awk","grep"],"question_text":"I see it is possible to view a list of properties set on every directory within an SVN repository using proplist and the -R flag (recursive) and -v flag (verbose):\n`svn propl...
{"title":"How do you create an asynchronous method in C#?","tags":["c#","async-await","c#-5.0"],"question_text":"Every blog post I've read tells you how to consume an asynchronous method in C#, but for some odd reason never explain how to build your own asynchronous methods to consume. So I have this code right now tha...
{"title":"How to retrieve user's current city name?","tags":["iphone","objective-c","core-location"],"question_text":"How do you retrieve the user's current city name?","answer_text":"As of iOS 5\n`MKReverseGeoCoder`\nis Deprecated!\nSo you want to use\n`CLGeocoder`\nwith\n`CLLocationManager`\n, very simple and works w...
{"title":"generating GUID without hyphen","tags":["c#","winforms"],"question_text":"I am generating a GUID using the following statement in my code\n`byte[ ] keyBytes = Encoding.UTF8.GetBytes( Guid.NewGuid( ).ToString( ).Substring( 0, 12 ) );`\nBut, when a GUID is generated, I find that it contains the hyphen character...
{"title":"Why does flowing off the end of a non-void function without returning a value not produce a compiler error?","tags":["c++","c","gcc","compiler-construction","g++"],"question_text":"Ever since I realized many years ago, that this doesn't produce an error by default, (in gcc at least) I've always wondered why?\...
{"title":"C# PredicateBuilder Entities: The parameter 'f' was not bound in the specified LINQ to Entities query expression","tags":["c#","linq-to-entities","predicatebuilder"],"question_text":"I needed to build a dynamic filter and I wanted to keep using entities. Because of this reason I wanted to use the PredicateBui...
{"title":"android adb, retrieve database using run-as","tags":["android","database","shell","adb","android-sqlite"],"question_text":"On a non-rooted android device, I can navigate to the data folder containing the database using the\n`run-as`\ncommand with my package name. Most files types I am content with just viewin...
{"title":"Method FloatMath.sqrt() not found","tags":["android","android-6.0-marshmallow"],"question_text":"I'm using the new Android Marshmallow SDK and the method\n`FloatMath.sqrt()`\nis gone. What should I use now?","answer_text":"The documentations say this:\nHistorically these methods were faster than the equivalen...