text
stringlengths
74
309k
{"title":"Why use HttpClient for Synchronous Connection","tags":["c#","asp.net","httpclient"],"question_text":"I am building a class library to interact with an API. I need to call the API and process the XML response. I can see the benefits of using HttpClient for Asynchronous connectivity, but what I am doing is pure...
{"title":"Place a button right aligned","tags":["html","css"],"question_text":"I use this code to right align a button.\n`<p align=\"right\">\n <input type=\"button\" value=\"Click Me\" \/>\n<\/p>`\nBut P tags wastes some space, so looking to do the same with span or div.","answer_text":"Which alignment technique you u...
{"title":"How do I tell Git to ignore everything except a subdirectory?","tags":["git","gitignore"],"question_text":"I want to ignore all files in my repository except those that occur in the\n`bin`\nsubdirectory. I tried adding the following to my\n`.gitignore`\n:\n`*\n!bin\/*`\nThis does not have the desired effect, ...
{"title":"Check if something is not in a list in Python","tags":["python","list","conditional-statements"],"question_text":"I have a list of tuples in\nPython\n, and I have a conditional where I want to take the branch ONLY if the tuple is not in the list (if it is in the list, then I don't want to take the if branch)\...
{"title":"How to copy a row and insert in same table with a autoincrement field in MySQL?","tags":["mysql","sql","insert","copy"],"question_text":"I have a table Eg- tab . What I am trying to do is copying a row with an autoincrement column ID=1 and insert the data into same table with a row and column ID=2.\nUsing MyS...
{"title":"Return anonymous type results?","tags":["c#","linq","linq-to-sql"],"question_text":"Using the simple example below, what is the best way to return results from multiple tables using Linq to SQL?\nSay I have two tables:\n`Dogs: Name, Age, BreedId\nBreeds: BreedId, BreedName`\nI want to return all dogs with the...
{"title":"Authentication issue when debugging in VS2013 - iis express","tags":["web-config","windows-authentication","iis-express","visual-studio-2013"],"question_text":"I'm trying to pick up the windows username when debugging in Visual Studio 2013. I am simply using:\n`httpcontext.current.user.identity.name`\nIf I ru...
{"title":"How to remove \"onclick\" with JQuery?","tags":["jquery","attributes"],"question_text":"php code:\n`<a id=\"a$id\" onclick=\"check($id,1)\" href=\"javascript:void(0)\" class=\"black\">Qualify<\/a>`\nHow to remove\n`onclick=\"check($id,1)`\nso \"Qualify\" can not be clicked or \"\n`check($id,1)`\nwon't be fire...
{"title":"How to set default font family for entire Android app","tags":["android","android-fonts"],"question_text":"I'm using the Roboto light font in my app. To set the font I've to add the\n`android:fontFamily=\"sans-serif-light\"`\nto every view. Is there any way to declare the Roboto font as default font family to...
{"title":"android pick images from gallery","tags":["android","gallery","action"],"question_text":"I want to create a picture chooser from gallery. I use code\n`intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);\n startActivityForResult(intent, TFRequestCodes.GALLERY...
{"title":"Struggling between native and phonegap, simple app requirements","tags":["android","jquery","ios","cordova","jquery-mobile"],"question_text":"I'm going to make a native (meaning;\nnot\nin the browser) mobile app. Since I'm a web-developer I'm struggling to decide whether or not I should try Phonegap or just b...
{"title":"accepts_nested_attributes_for child association validation failing","tags":["ruby-on-rails","validation","activerecord","nested"],"question_text":"I'm using accepts_nested_attributes_for in one of my Rails models, and I want to save the children after creating the parent.\nThe form works perfectly, but the va...
{"title":"How to select the first element in the dropdown using jquery?","tags":["javascript","jquery","html"],"question_text":"I want to know how to select the first option in all select tags on my page using jquery.\ntried this:\n`$('select option:nth(0)').attr(\"selected\", \"selected\");`\nBut didn't work","answer_...
{"title":"RegEx: Grabbing values between quotation marks","tags":["regex"],"question_text":"I have a value like this:\n`\"Foo Bar\" \"Another Value\" something else`\nWhat regex will return the values enclosed in the quotation marks (e.g.\n`Foo Bar`\nand\n`Another Value`\n)?","answer_text":"I've been using the followin...
{"title":"Split NSString multiple times on the same separator","tags":["objective-c","string","cocoa-touch","cocoa","nsstring"],"question_text":"I am currently receiving a string like this:\n`@\"Sam|26,Hannah|22,Adam|30,Carlie|32,Jan|54\"`\nAnd I am splitting it like this:\n`testArray = [[NSArray alloc] init];\nNSStrin...
{"title":"Best way of invoking getter by reflection","tags":["java","reflection","getter"],"question_text":"I need to get the value of a field with a specific annotation, So with reflection I am able to get this Field Object. The problem is that this field will be always private though I know in advance it will always ...
{"title":"Difference between `initLoader` and `restartLoader` in `LoaderManager`","tags":["java","android","android-loadermanager"],"question_text":"I'm completely lost regarding the differences between the\n`initLoader`\nand the\n`restartLoader`\nfunctions of the\n`LoaderManager`\n:\nThey both have the same signature....
{"title":"Why does the Java API use int instead of short or byte?","tags":["java","optimization","types","java-api"],"question_text":"Why does the Java API use\n`int`\nif\n`short`\nor even\n`byte`\nwould be sufficient?\nExample: The\n`DAY_OF_WEEK`\nfield in class\n`Calendar`\nuses\n`int`\n.\nIf the difference is too mi...
{"title":"jQuery : eq() vs get()","tags":["jquery","jquery-selectors"],"question_text":"I'm new to jQuery, and I'm wondering what the difference is between jQuery's get() and eq() functions. I may misunderstand what the get() function does, but I thought it odd that I couldn't call a function on the returned on the ret...
{"title":"Prompt Dialog in Windows Forms","tags":["c#",".net","winforms","dialog","prompt"],"question_text":"I am using\n`System.Windows.Forms`\nbut strangely enough don't have the ability to create them.\nHow can I get something like a javascript prompt dialog, without javascript?\nMessageBox is nice, but there is no ...
{"title":"What does java.lang.Thread.interrupt() do?","tags":["java","multithreading"],"question_text":"Could you explain what\n`java.lang.Thread.interrupt()`\ndoes when invoked?","answer_text":"`Thread.interrupt()`\nsets the interrupted status\/flag of the target thread. Then code running in that target thread MAY pol...
{"title":"Difference between reduce and foldLeft\/fold in functional programming (particularly Scala and Scala APIs)?","tags":["scala","scalability","apache-spark","scalding"],"question_text":"Why does Scala, and frameworks like Spark and Scalding have both\n`reduce`\nand\n`foldLeft`\n? So then what's the difference be...
{"title":"How can Xcode 6 adaptive UIs be backwards-compatible with iOS 7 and iOS 6?","tags":["xcode6","adaptive-ui"],"question_text":"I just watched the WWDC video #216, \"Building Adaptive UI with UIKit.\"\nAt about 45:10 Tony Ricciardi talks about changes to IB in Xcode 6 to support the new changes.\nHe says \"You c...
{"title":"how to make a jquery \"$.post\" request synchronous","tags":["javascript","jquery","html"],"question_text":"I\u00e2\u0080\u0099ve been googling this and avoiding this error in my bug fix list for a long time now, but I\u00e2\u0080\u0099ve finally reached the end of the list, the last of which I have to make a...
{"title":"Combining C++ and C - how does #ifdef __cplusplus work?","tags":["c++","c","c-preprocessor","extern-c"],"question_text":"I'm working on a project that has a lot of legacy\nC\ncode. We've started writing in C++, with the intent to eventually convert the legacy code, as well. I'm a little confused about how the...
{"title":"SQL Server 2008: How to query all databases sizes?","tags":["sql","sql-server","tsql","sql-server-2008-r2"],"question_text":"I have MS SQL 2008 R2, 500 databases.\nWhat is the most efficient, easiest and 'modern' way to query all databases sizes.\nThe output should have columns:\nDatabaseName\nDataFilesSize\n...
{"title":"Strange behavior when casting a float to int in C#","tags":["c#","casting","floating-point","int"],"question_text":"I have the following simple code :\n`int speed1 = (int)(6.2f * 10);\nfloat tmp = 6.2f * 10;\nint speed2 = (int)tmp;`\nspeed1 and speed2 should have the same value, but in fact, I have :\n`speed1...
{"title":"What does \"exec sp_reset_connection\" mean in Sql Server Profiler?","tags":["sql-server","database-connection","sqlprofiler","sp-reset-connection"],"question_text":"Trying to understand what Sql Profiler means by emitting \"sp_reset_connection\".\nI have the following, \"exec sp_reset_connection\" line follo...
{"title":"Create a dictionary on a list with grouping","tags":["c#",".net","linq",".net-3.5"],"question_text":"I have the following object in a list:\n`public class DemoClass\n{\n public int GroupKey { get; set; }\n public string DemoString { get; set; }\n public object SomeOtherProperty { get; set; }\n}`\nNow, I want ...
{"title":"Copying Text to the Clipboard using Java","tags":["java","swing","text","clipboard"],"question_text":"I want to copy text from a\n`JTable`\n's cell to the clipboard, making it available to be pasted into other programs such as Microsoft Word. I have the text from the\n`JTable`\n, but I am unsure how to copy i...
{"title":"How do I access previous promise results in a .then() chain?","tags":["javascript","scope","promise","bluebird","es6-promise"],"question_text":"I have restructured my code to\npromises\n, and built a wonderful long\nflat promise chain\n, consisting of multiple\n`.then()`\ncallbacks. In the end I want to retur...
{"title":"Maven - How to compile tests without running them ? ","tags":["maven"],"question_text":"Is there a way in Maven to compile the tests without running them ? I want to use the IDE to run specific tests and not all of them.","answer_text":"How about the\n`test-compile`\nlifecycle phase? It doesn't require any te...
{"title":"Switch to another GIT tag","tags":["git","github"],"question_text":"How do I check out version version\/tag 1.1.4 of the\nrspec bundle\n?\n`cd ~\/Library\/Application\\ Support\/TextMate\/Bundles\/\ngit clone git:\/\/github.com\/rspec\/rspec-tmbundle.git RSpec.tmbundle\nosascript -e 'tell app \"TextMate\" to ...
{"title":"Update just one gem with bundler","tags":["ruby","rubygems","bundler"],"question_text":"I use bundler to manage dependencies in my rails app, and I have a gem hosted in a git repository included as followed:\n`gem 'gem-name', :git => 'path\/to\/my\/gem.git'`\nTo update this gem, I execute\n`bundle update`\nbu...
{"title":"How does Python compare string and int?","tags":["python","types","comparison","python-2.x"],"question_text":"The following snippet is annotated with the output (\nas seen on ideone.com\n):\n`print \"100\" < \"2\" # True\nprint \"5\" > \"9\" # False\nprint \"100\" < 2 # False\nprint 100 < \"2\" # True\nprint ...
{"title":"How to run cron once, daily at 10pm","tags":["bash","cron","system","scheduled-tasks"],"question_text":"I had entered:\n`* 22 * * * test > \/dev\/null`\nHowever, I am being notified via email that this is running every minute.\nI am confused I guess because I thought this was correct for what I am wanting.\nH...
{"title":"Android Compatibility Package doesn't include Activity.getFragmentManager()","tags":["android","android-fragments","android-activity"],"question_text":"I started trying to add fragments to my Android app, which is based on 2.1, using the Android Compatibility Package that just came out on March 3rd. I include...
{"title":"Confused when boost::asio::io_service run method blocks\/unblocks","tags":["c++","boost-asio"],"question_text":"Being a total beginner to Boost.Asio, I am confused with\n`io_service::run()`\n. I would appreciate it if someone could explain to me when this method blocks\/unblocks. The documentations states:\nT...
{"title":"Cookies on localhost with explicit domain","tags":["cookies","setcookie"],"question_text":"I must be missing some basic thing about cookies. On localhost, when I set a cookie on server side\nand\nspecify the domain explicitly as localhost (or .localhost). the cookie does not seem to be accepted by some browse...
{"title":"Rails: Order with nulls last","tags":["ruby-on-rails","ruby-on-rails-3","sorting","activerecord",null],"question_text":"In my Rails app I've run into an issue a couple times that I'd like to know how other people solve:\nI have certain records where a value is optional, so some records have a value and some a...
{"title":"Pythonic way to add datetime.date and datetime.time objects","tags":["datetime","python"],"question_text":"I have two objects that represent the same event instance --- one holds the date, the other the time of this event, and I want to create a datetime object.\nSince one can't simply add date and time objec...
{"title":"Styling twitter bootstrap buttons","tags":["css","button","twitter-bootstrap"],"question_text":"Twitter-Bootstrap buttons are awesomely beautiful.\nTry them out by scrolling over them\nBut they are limited in colors.\nIs there any way I could change the base color of the button while keeping the beautiful hov...
{"title":"Checking if an instance's class implements an interface?","tags":["php","interface","oop"],"question_text":"Given a class instance, is it possible to determine if it implements a particular interface? As far as I know, there isn't a built-in function to do this directly. What options do I have (if any)?","ans...
{"title":"Copy rows from one Datatable to another DataTable?","tags":["c#","datatable"],"question_text":"How can I copy specific rows from DataTable to another Datable in c#? There will be more than one row.","answer_text":"`foreach (DataRow dr in dataTable1.Rows) {\n if (\/* some condition *\/)\n dataTable2.Rows.Add(d...
{"title":"explicit casting from super class to subclass","tags":["java","casting","classcastexception"],"question_text":"`public class Animal {\n public void eat() {}\n}\npublic class Dog extends Animal {\n public void eat() {}\n public void main(String[] args) {\n Animal animal = new Animal();\n Dog dog = (Dog) animal...
{"title":"Some questions about Automatic Reference Counting in iOS5 SDK","tags":["objective-c","ios5","automatic-ref-counting","xcode4.2"],"question_text":"I'm currently developing an app for iPad. The development started for iOS 4.2 and is now continuing (and I think will be completed) for iOS 4.3.\nI just read about ...
{"title":"Why can tuples contain mutable items?","tags":["python","list","tuples","immutability"],"question_text":"If a tuple is immutable then why can it contain mutable items?\nIt is seemingly a contradiction that when a mutable item such as a list does get modified, the tuple it belongs to maintains being immutable....
{"title":"How to center a div with Bootstrap2?","tags":["css","twitter-bootstrap","twitter-bootstrap-2"],"question_text":"http:\/\/twitter.github.com\/bootstrap\/scaffolding.html\nI tried like all combinations:\n`<div class=\"row\">\n <div class=\"span7 offset5\"> box <\/div>\n<\/div>`\nor\n`<div class=\"container\">\n...
{"title":"Homebrew: Error: update-report should not be called directly","tags":["homebrew"],"question_text":"Running\n`brew update`\nI get the following:\n`\/usr\/local\/Library\/brew.sh: line 32: \/usr\/local\/Library\/ENV\/scm\/git: No such file or directory\n\/usr\/local\/Library\/brew.sh: line 32: \/usr\/local\/Lib...
{"title":"Asp.net Identity Validation Error","tags":["asp.net-mvc-5","asp.net-identity"],"question_text":"I want integrate IdentityContext with mydbcontext but i am taking this error\nOne or more validation errors were detected during model generation:\nIvdb.Dal.Concrete.EFCodeFirst.IdentityUserLogin: : EntityType 'Ide...
{"title":"Git for Windows: .bashrc or equivalent config files for Git Bash shell","tags":["windows","git","git-bash"],"question_text":"I've just installed\n`Git`\nfor Windows and delighted to see that it installs\n`Bash`\n.\nI want to customise the shell in the same way I can under Linux (e.g. set up aliases like\n`ll`...
{"title":"How to play video with AVPlayerViewController (AVKit) in Swift","tags":["ios","swift","avfoundation","avplayerviewcontroller","avkit"],"question_text":"How do you play a video with AV Kit Player View Controller in Swift?\n`override func viewDidLoad() {\n super.viewDidLoad()\n let videoURLWithPath = \"http:\/\...
{"title":"Why git can't remember my passphrase under Windows","tags":["windows","git","ssh","cmd"],"question_text":"I have just start using git and i can't get it to remember my passphrase I'm using cmd.exe elevated and my git host is github and i have create a ssh key like that guide on github\nbut i still get\n`*\\su...
{"title":"jQuery Popup Bubble\/Tooltip","tags":["javascript","jquery","html","css"],"question_text":"I'm trying to make a \"bubble\" that can popup when the\n`onmouseover`\nevent is fired and will stay open as long as the mouse is over the item that threw the\n`onmouseover`\nevent OR if the mouse is moved into the bubb...
{"title":"subtle differences between JavaScript and Lua","tags":["javascript","lua"],"question_text":"I simply love JavaScript. It's so elegant (imagine the quiet sound of lovestruck fanboy sighing in the background).\nSo, recently I have played with Lua via the\nl\u00c3\u00b6ve2d\nframework (nice!) - and I think Lua i...
{"title":"Downloading all maven dependencies to a directory NOT in repository?","tags":["maven","download","dependencies"],"question_text":"I started to convert my project to maven because I needed to use a library that was distributed in binary form over maven only, but after banging my head against the wall on it for...
{"title":"JSON and XML comparison","tags":["xml","json"],"question_text":"I want to know which is faster: XML and JSON?\nWhen to use which one ?","answer_text":"Faster\nis not an attribute of JSON or XML or a result that a comparison between those would yield. If any, then it is an attribute of the parsers or the bandw...
{"title":"Static methods in C++","tags":["c++","static-linking"],"question_text":"I am having a little trouble working with static methods in C++\nExample .h:\n`class IC_Utility {\npublic:\n IC_Utility();\n ~IC_Utility();\n std::string CP_PStringToString( const unsigned char *outString );\n void CP_StringToPString( std...
{"title":"C++ Redefinition Header Files (winsock2.h)","tags":["c++","header","redefinition"],"question_text":"How do I prevent from including header files twice? The problem is I'm including the\nin\nMyClass.h\nand then I'm including\nMyClass.h\nin many files, so it includes multiple times and redefinition error occurs...
{"title":"CSV file written with Python has blank lines between each row","tags":["python","csv"],"question_text":"`import csv\nwith open('thefile.csv', 'rb') as f:\n data = list(csv.reader(f))\n import collections\n counter = collections.defaultdict(int)\n for row in data:\n counter[row[10]] += 1\nwith open('\/pythonwo...
{"title":"Exit single-user mode","tags":["sql-server","sql-server-2008-r2"],"question_text":"Currently, my database is in Single User mode. When I try to expand me database, I get an error:\nThe database 'my_db' is not accessible.(ObjectExplorer)\nAlso, when I try to delete the database, I get the error:\nChanges to th...
{"title":"Is it possible to delete an object's property in PHP?","tags":["php","object"],"question_text":"If I have an\n`stdObject`\nsay,\n`$a`\n.\nSure there's no problem to assign a new property,\n`$a`\n,\n`$a->new_property = $xyz;`\nBut then I want to remove it, so unset is of no help here.\nSo,\n`$a->new_property =...
{"title":"Web deployment task build failed","tags":["visual-studio-2010","tfs2010"],"question_text":"Scenario:\nI set up successfully TFS2010 webdeploy task for solution. Everything worked fine until suddendly something went wrong in the deployment task.\nSolution has 2 web projects..those are configured to deploy on b...
{"title":"How do I disable tabs for <a> tag","tags":["javascript","html","javascript-events"],"question_text":"I am using tags for links on a web page. How do I disable tab key from selecting either of them.","answer_text":"Alternatively you could go for plain HTML solution.\n`<a href=\"http:\/\/foo.bar\" tabindex=\"-1...
{"title":"Android Studio failed to open by giving error \"Files Locked\"","tags":["android-studio"],"question_text":"After running once successfully, Android Studio is getting failed to open.\nThe error is:\nFiles in C:\\Program Files (x86)\\Android\\android-studio\\system\\caches are locked. Android Studio will not be...
{"title":"Display a tooltip over a button using Windows Forms","tags":[".net","winforms","button","tooltip"],"question_text":"How can I display a tooltip over a button using\nWindows Forms\n?","answer_text":"The ToolTip is actually a WinForms control that handles displaying tool tips for multiple elements on a single f...
{"title":"Unit Testing AngularJS directive with templateUrl","tags":["angularjs","angularjs-directive","jasmine"],"question_text":"I have an AngularJS directive that has a\n`templateUrl`\ndefined. I am trying to unit test it with Jasmine.\nMy Jasmine JavaScript looks like the following, per the recommendation of\nthis\...
{"title":"CSS: Hover one element, effect for multiple elements?","tags":["css","xhtml","hover"],"question_text":"I'm looking for method for my hovering issue.\n`<div class=\"section\">\n<div class=\"image\"><img src=\"myImage.jpg\" \/><\/div>\n<div class=\"layer\">Lorem Ipsum<\/div>\n<\/div>`\nNow, both classes (image ...
{"title":"Object reference not set to an instance of an object.Why doesn't .NET show which object is `null`?","tags":["c#",".net"],"question_text":"Regarding this .NET unhandled exception message:\nObject reference not set to an instance of an object.\nWhy doesn't .NET show which object is\n`null`\n?\nI know that I can...
{"title":"How to increase heap size of an android application?","tags":["android"],"question_text":"I am writing an Android application which uses several 3D models. Such a model with textures can take up a lot of memory. I found out the manufacturer sets a limit on the heap size an application can use. For example my ...
{"title":"How to make a Java Generic method static?","tags":["java","generics"],"question_text":"The following is a snippet on how to make a java generic class to append a single item to an array. How can I make appendToArray a static method. Adding static to the method signature results in compile errors.\n`public cla...
{"title":"Wrap long lines in Python","tags":["python","string"],"question_text":"How do I wrap long lines in Python without sacrificing indentation?\nFor example:\n`def fun():\n print '{0} Here is a really long sentence with {1}'.format(3, 5)`\nSuppose this goes over the 79 character recommended limit. The way I read i...
{"title":"How can I change the image of an ImageView?","tags":["android","android-imageview"],"question_text":"I have just started learning android. And i don't know How can I change the image of an\n`ImageView`\n? ie it has some Image which was set in the layout but i want to change that image through coding how shoul...
{"title":"Multiple file-extensions searchPattern for System.IO.Directory.GetFiles","tags":["c#",".net","system.io.directory"],"question_text":"What is the syntax for setting\nmultiple file-extensions\nas\n`searchPattern`\non\n`Directory.GetFiles()`\n? For example filtering out files with\n.aspx\nand\n.ascx\nextensions....
{"title":"How is null + true a string?","tags":["c#",".net","string",null,"types"],"question_text":"Since\n`true`\nis not a string type, how is\n`null + true`\na string ?\n`string s = true; \/\/Cannot implicitly convert type 'bool' to 'string' \nbool b = null + true; \/\/Cannot implicitly convert type 'string' to 'bool...
{"title":"iOS - How to set a UISwitch programmatically","tags":["objective-c","ios"],"question_text":"I want to set my UISwitch to on or off programmatically. How would I do that? I am an iOS newbie.","answer_text":"I'm not familiar with a 'checkbox' in iOS, but if you are using a UISwitch, then as seen in the developp...
{"title":"Best way to convert text files between character sets?","tags":["unicode","text","utf-8"],"question_text":"What is the fastest, easiest tool or method to convert text files between character sets?\nSpecifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa.\nEverything goes: one-liners in your f...
{"title":"MySQL error 1449: The user specified as a definer does not exist","tags":["mysql","permissions"],"question_text":"When I run the following query I get an error:\n`SELECT\n `a`.`sl_id` AS `sl_id`,\n `a`.`quote_id` AS `quote_id`,\n `a`.`sl_date` AS `sl_date`,\n `a`.`sl_type` AS `sl_type`,\n `a`.`sl_status` AS `...
{"title":"Difference between \"managed\" and \"unmanaged\"","tags":[".net","windows","unmanaged","managed"],"question_text":"I hear\/read about it sometimes when talking about .NET, for example \"managed code\" and \"unmanaged code\" but I have no idea what they are and what are their differences. What are their differ...
{"title":"Returning JSON from PHP to JavaScript?","tags":["php","javascript","json"],"question_text":"I have a PHP script that's being called through jQuery AJAX. I want the PHP script to return the data in JSON format to the javascript. Here's the pseudo code in the PHP script:\n`$json = \"{\";\nforeach($result as $ad...
{"title":"How to overcome \"datetime.datetime not JSON serializable\" in python?","tags":["python","json"],"question_text":"I have a basic dict as follows:\n`sample = {}\nsample['title'] = \"String\"\nsample['somedate'] = somedatetimehere`\nWhen I try to do\n`jsonify(sample)`\nI get:\nTypeError: datetime.datetime(2012,...
{"title":"Postgres: SQL to list table foreign keys","tags":["sql","postgresql"],"question_text":"Is there a way using SQL to list all foreign keys for a given table? I know the table name \/ schema and I can plug that in.","answer_text":"You can do this via the information_schema tables. For example:\n`SELECT\n tc.cons...
{"title":"Get all columns from all MySQL tables","tags":["mysql"],"question_text":"Is there a fast way of getting all column names from all tables in MySQL, without having to list all the tables?","answer_text":"`select * from information_schema.columns\nwhere table_schema = 'your_db'\norder by table_name,ordinal_posit...
{"title":"What happens when a computer program runs?","tags":["c++","memory","operating-system","x86","computer-architecture"],"question_text":"I know the general theory but I can't fit in the details.\nI know that a program resides in the secondary memory of a computer. Once the program begins execution it is entirely...
{"title":"How to make the python interpreter correctly handle non-ASCII characters in string operations?","tags":["python","unicode"],"question_text":"I have a string that looks like so:\n`6\u00c3\u0082\u00c2\u00a0918\u00c3\u0082\u00c2\u00a0417\u00c3\u0082\u00c2\u00a0712`\nThe clear cut way to trim this string (as I un...
{"title":"When should we use Observer and Observable","tags":["java","observer-pattern","observable","observers"],"question_text":"An interviewer asked me:\nWhat is\n`Observer`\nand\n`Observable`\nand when should we use them?\nI wasn't aware of these terms, so when I came back to home I started to Google about\n`Observ...
{"title":"How can I scale the content of an iframe?","tags":["html","css","dom"],"question_text":"How can I scale the content of an iframe (in my example it is an HTML page, and is not a popup) in a page of my web site?\nFor example, I want to display the content that appears in the iframe at 80% of the original size."...
{"title":"jQuery returning \"parsererror\" for ajax request","tags":["javascript","c#","jquery","asp.net","json"],"question_text":"Been getting a \"parsererror\" from jquery for an Ajax request, I have tried changing the POST to a GET, returning the data in a few different ways (creating classes, etc.) but I cant seem ...
{"title":"How do you pass arguments to define_method?","tags":["ruby","metaprogramming"],"question_text":"I would like to pass an argument(s) to a method being defined using define_method, how would I do that?","answer_text":"The block that you pass to define_method can include some parameters. That's how your defined ...
{"title":"When to clear the cache dir in Android?","tags":["android","caching"],"question_text":"I have an application that displays pictures from the internet (showcase for designer work). I start caching my content in the internal cache directory, but the app content could take about 150 MB in cache size. And what an...
{"title":"How to get a property value based on the name","tags":["c#","asp.net","reflection"],"question_text":"is there a way to get the value of a property of a object based on its name?\nFor example if I have:\n`public class Car : Vehicle\n{\n public string Make { get; set; }\n}`\nand\n`var car = new Car { Make=\"For...
{"title":"Error \"initializer element is not constant\" when trying to initialize variable with const","tags":["c","initialization"],"question_text":"I get an error on line 6 (initialize my_foo to foo_init) of the following program and I'm not sure I understand why.\n`typedef struct foo_t {\n int a, b, c;\n} foo_t;\nco...
{"title":"\"continue\" in cursor.forEach()","tags":["javascript","mongodb","foreach","meteor"],"question_text":"I'm building an app using meteor.js and MongoDB and I have a question about cursor.forEach().\nI want to check some conditions in the beginning of each forEach iteration and then skip the element if I don't h...
{"title":"In AngularJS, what's the difference between ng-pristine and ng-dirty?","tags":["angularjs"],"question_text":"What are the differences between\n`ng-pristine`\nand\n`ng-dirty`\n? It seems you can have both to be\n`true`\n:\n`$scope.myForm.$pristine = true; \/\/ after editing the form`","answer_text":"The\n`ng-d...
{"title":"mysql create user if not exists","tags":["mysql","user","exists","creation"],"question_text":"I have a query to check mysql users list for create new user.\n`IF (SELECT EXISTS(SELECT 1 FROM `mysql`.`user` WHERE `user` = '{{ title }}')) = 0 THEN\n CREATE USER '{{ title }}'@'localhost' IDENTIFIED BY '{{ passwor...
{"title":"Advantages to Using Private Static Methods","tags":["c#","performance"],"question_text":"When creating a class that has internal private methods, usually to reduce code duplication, that don't require the use of any instance fields, are there performance or memory advantages to declaring the method as static?...
{"title":"java: what is this: [Ljava.lang.Object;?","tags":["java","arrays","class","tostring"],"question_text":"I get this when I call\n`toString`\non an object I received from a function call. I know the type of the object is encoded in this string, but I don't know how to read it. What is this type of encoding calle...
{"title":"Serving static files with Sinatra","tags":["ruby","sinatra"],"question_text":"I have one page website only using HTML, CSS and JavaScript. I want to deploy the app to Heroku, but I cannot find a way to do it. I am now trying to make the app working with Sinatra.\n`.\n|-- application.css\n|-- application.js\n|...
{"title":"Gmail SMTP debug: error \"please log in via your web browser\"","tags":["smtp","phpmailer","dreamhost","mediatemple","smtp-auth"],"question_text":"Im having problems with gmail smtp server. I already read many posts here in StackOverflow about that subject.\nThe best post i found about test the connection is\...
{"title":"How to remove all subviews of a view in Swift?","tags":["osx","view","swift"],"question_text":"I'm looking for a simple method to remove at once all subviews from a superview instead of removing them one by one.\n`\/\/I'm trying something like this, but is not working\nlet theSubviews : Array = container_view...