text
stringlengths
74
309k
{"title":"Switch without break","tags":["java","switch-statement","findbugs"],"question_text":"I have some switch statement as shown below. Notice there is no break.\nFindbugs is reporting error on the second case statement only. \nThe error is : Switch statement found where one case falls through to the next case.\n`s...
{"title":"Enable-Migrations installation error","tags":["entity-framework","visual-studio-2012","entity-framework-5","code-first-migrations"],"question_text":"I'm running into a problem when enabling migrations on one of my projects.\nI execute\n`Enable-Migrations`\ncommand from the Nuget Console and receive an error s...
{"title":"How to implement FosOAuthServerBundle to secure a REST API?","tags":["symfony2","oauth-2.0","fosoauthserverbundle"],"question_text":"I would like to provide a RESTful API secured with OAuth2 using FOSOAuthServerBundle and I'm not really sure about what I have to do.\nI followed basic steps\nfrom the documenta...
{"title":"TNS-12505: TNS:listener does not currently know of SID given in connect descriptor","tags":["oracle","jdbc","listener","tnsnames"],"question_text":"I'm trying to connect to Oracle 10.2.0 from NetBeans, using the following connection string:\n`jdbc:oracle:thin:@localhost:1521:XE`\nThe weirdest part is that eve...
{"title":"show diff between commits","tags":["git","git-diff"],"question_text":"I am using git on Ubuntu 10.4.\nI have made some commits to my master.\nHowever, I want to get the difference between these commits. All of them are on my master branch.\nFor example:\n`commit dj374\nmade changes\ncommit y4746 \nmade change...
{"title":"BCL (Base Class Library) vs FCL (Framework Class Library)","tags":["c#",".net","terminology"],"question_text":"What's the difference between the two? Can we use them interchangeably?","answer_text":"The Base Class Library (BCL) is literally that, the base. It contains basic, fundamental types like\n`System.St...
{"title":"Cucumber Capybara scroll to bottom of page","tags":["cucumber","capybara"],"question_text":"I'd like to use my Cucumber\/Capybara setup to test endless scroll by driving a browser and scrolling to the bottom of the page to ensure that the new content is loaded. Is there a way to do this?","answer_text":"You c...
{"title":"Parsing of html string using jquery","tags":["jquery"],"question_text":"I am trying to parse this html through jQuery to get data1, data2, data3. While I do get data2 and data3 I am unable to get data3 with my approach. I am fairly new to jQuery so please pardon my ignorance.\n`<html>\n<body>\n <div class=\"c...
{"title":"What is the purpose of constraint naming","tags":["sql","database","constraints","naming"],"question_text":"What is the purpose of naming your constraints (unique, primary key, foreign key)?\nSay I have a table which is using natural keys as a primary key:\n`CREATE TABLE Order\n(\n LoginName VARCHAR(50) NOT N...
{"title":"Can we use match to check the type of a class","tags":["scala","pattern-matching","match"],"question_text":"I'm new to scala, and I'm learning the\n`match`\nkeyword now.\nI wanna know if we can use the keyword\n`match`\nto check the type of a class. My code is:\n`object Main {\n def main(args: Array[String]) ...
{"title":"COUNT(*) from multiple tables in MySQL","tags":["mysql","count"],"question_text":"How do I go about selecting COUNT(*)s from multiple tables in MySQL?\nSuch as:\n`SELECT COUNT(*) AS table1Count FROM table1 WHERE someCondition\nJOIN?? \nSELECT COUNT(*) AS table2Count FROM table2 WHERE someCondition\nCROSS JOIN...
{"title":"split string after x characters","tags":["php","split"],"question_text":"How to split $string after 5 characters into an array\nexample:\n`$string=\"123456789\";`\nexpected output\n`$output[0] contain \"12345\";\n$output[1] contain \"6789\";`","answer_text":"If you need to split a string after\nevery\n5 chara...
{"title":"Material \"close\" button in Toolbar instead of Back","tags":["android","android-actionbar","material-design"],"question_text":"I have seen in Google's Inbox App, composing a new email, in the toolbar instead of the back button (an arrow) it has a \"close\" button (see picture).\nHow can I achieve this?","ans...
{"title":"Difference between Chocolatey and NuGet","tags":["nuget","chocolatey"],"question_text":"Is\nChocolatey\na higher version of\nNuGet\nor a different package manager? Where should I put my open source app? NuGet or Chocolatey?","answer_text":"NuGet is designed to allow you to easily add code libraries to your pr...
{"title":"Creating a 3x3 grid with auto layout constraints","tags":["ios","xcode","interface-builder","autolayout"],"question_text":"Xcode has said there are no layout issues but as you can see there is. I have tried everything. Apple docs, YouTube, Google, etc. It seems I am doing it right however maybe the order I'm ...
{"title":"Tools for creating Class Diagrams","tags":["class","diagram"],"question_text":"Please suggest tools for creating Class Diagrams with the following criteria:\nIt should be platform-independent because I use Linux and the file is expected to be edited by other members of the team using Windows\/Mac\nFree, becau...
{"title":"What is the difference between Platform driver and normal device driver..?","tags":["c","linux-kernel","linux-device-driver"],"question_text":"I previously had a thought about the platform driver as well as normal device driver like :\nPlatform driver is for those devices that are on chip. and ,\nNormal devic...
{"title":"What exactly is super in Objective-C?","tags":["objective-c","super","objective-c-runtime"],"question_text":"As far as I know, it's a pointer to the superclass. It's hard-wired with the superclass, and not dynamically figured out at runtime. Would like to know it more in detail...\nAnyone?","answer_text":"`su...
{"title":"Scripting SQL Server permissions","tags":["sql-server"],"question_text":"I want to copy all the permission I've set on stored procedures and other stuff from my development database to my production database. It's incredibly cumbersome, not to mention error prone, to do this all by hand through the SSMS GUI t...
{"title":"format date in c#","tags":["c#",".net","datetime","formatting"],"question_text":"How can I format a date as\n`dd\/mm\/yyyy`\nor\n`mm\/dd\/yy`\n?\nLike in VB\n`format(\"dd\/mm\/yy\",now)`\nHow can I do this in C#?","answer_text":"It's almost the same, simply use the\n`DateTime.ToString()`\nmethod, e.g:\n`DateT...
{"title":"How do I make Makefile to recompile only changed files?","tags":["c","makefile","recompile"],"question_text":"I have been struggling a bit to get make to compile only the files that have been edited. However I didn't have much success and all the files get recompiled. Can someone explain me why?\nMy files are...
{"title":"Named parameters in JDBC","tags":["java","jdbc","named-parameters"],"question_text":"Are there named parameters in JDBC instead of positional ones, like the\n`@name`\n,\n`@city`\nin the ADO.NET query below?\n`select * from customers where name=@name and city = @city`","answer_text":"JDBC does not support name...
{"title":"jQuery: document ready fires too early for my requirements","tags":["jquery","document-ready"],"question_text":"I am developing a site based all around photos. Some areas of this site require calculations based on image dimensions in order to work correctly. What i have found is that document ready is firing ...
{"title":"How to invalidate cache data [OutputCache] from a Controller?","tags":["c#","asp.net-mvc","asp.net-mvc-3","caching"],"question_text":"Using ASP.Net MVC 3 I have a Controller which output is being cached using attributes\n`[OutputCache]`\n`[OutputCache]\npublic controllerA(){}`\nI would like to know if is poss...
{"title":"Are Windows Forms old tech?","tags":["wpf","winforms"],"question_text":"It is time to write the GUI for my project, and I am wondering what technology to use. I did most of my .NET GUI development in .NET 1 & 2, so I know\nWindows Forms\nreasonably well. I am vaguely aware of\nWPF\n, but not yet attempted to ...
{"title":"Java: is there no AtomicFloat or AtomicDouble?","tags":["java","concurrency","atomic"],"question_text":"I have found\n`AtomicInteger`\n,\n`AtomicLong`\n, but where is\n`AtomicFloat`\n(or\n`AtomicDouble`\n)? Maybe there is some trick?","answer_text":"The API docs for the\n`java.util.concurrent`\npackage\nstate...
{"title":"Show default value for editing on Python input possible?","tags":["python","input"],"question_text":"Is it possible for python to accept input like this:\nFolder name: Download\nBut instead of the user typing \"Download\" it is already there as a initial value. If the user wants to edit it as \"Downloads\" al...
{"title":"Stream as a return value in WCF - who disposes it?","tags":[".net","wcf","stream","idisposable"],"question_text":"Let's say I have the following WCF implementation:\n`public Stream Download(string path)\n{\n FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read);\n return stream;\n}`\nWho's ...
{"title":"How do I create a MVC Razor template for DisplayFor()","tags":["asp.net-mvc","asp.net-mvc-3","razor","asp.net-mvc-4"],"question_text":"I have a couple of properties in my view model that are display-only but I need to retrieve their values using jQuery to perform a calculation on the page. The standard\nHtml....
{"title":"PostgreSQL delete all content","tags":["postgresql"],"question_text":"Hello I want to delete all data in my postgresql tables, but not the table itself. \nHow could I do this?\nThanks","answer_text":"Use the\n`TRUNCATE TABLE`\ncommand.","question_code":[],"answer_code":[],"retrieval_text":"\n### TITLE:\nPostg...
{"title":"MPI recv from an unknown source","tags":["mpi","distributed-programming"],"question_text":"I am implementing in MPI a program in which the main process (with rank=0) should be able to receive requests from the other processes who ask for values of variables that are only known by the root. \nIf I make MPI_Rec...
{"title":"android: how to remove the back\/home button in the action bar","tags":["android"],"question_text":"Hi everyone I am having difficutlies trying to remove the back\/home button from the action bar.\n`getActionBar().setDisplayShowHomeEnabled(false); \/\/disable back button\n getActionBar().setHomeButtonEnabled(...
{"title":"A proper wrapper for console.log with correct line number?","tags":["javascript"],"question_text":"I'm now developing an application, and place a global\n`isDebug`\nswitch. I would like to wrap\n`console.log`\nfor more convenient usage.\n`\/\/isDebug controls the entire site.\nvar isDebug = true;\n\/\/debug.j...
{"title":"Does a UNIQUE constraint automatically create an INDEX on the field(s)?","tags":["mysql","sql","indexing"],"question_text":"Should I\ndefine a separate index\non the\n`email`\ncolumn (for searching purposes), or is the index is \"automatically\" added along with\n`UNIQ_EMAIL_USER`\nconstraint?\n`CREATE TABLE ...
{"title":"AngularJS: Basic example to use authentication in Single Page Application","tags":["javascript","angularjs","authentication","login"],"question_text":"I am new to\nAngularJS\nand gone through their tutorial and got a feel for it.\nI have a backend for my project ready where each of the\n`REST`\nendpoints need...
{"title":"JavaScript at bottom\/top of web page?","tags":["javascript","webpage"],"question_text":"I was just using the plugin \"Yslow\" for Mozilla Firefox, and it told me that I should put JavaScript at the bottom. I have heard this before but haven't really thought about it too much. Is there really an advantage in ...
{"title":"Using special auto start servlet to initialize on startup and share application data","tags":["servlets","initialization","data-sharing"],"question_text":"I need to get some configuration and connect to external resources\/objects\/systems somewhere and store it in application scope.\nI can see two ways to se...
{"title":"How to center jquery ui buttons?","tags":["jquery","jquery-ui"],"question_text":"Adding this to CSS does not work:\n`.ui-dialog-buttonpane { text-align: center; }`\nThe buttons are still on the right side.\nWhat should I do?","answer_text":"Ok. I also needed to remove the float. This works:\n`.ui-dialog .ui-d...
{"title":"Using findOne in mongodb to get element with max id","tags":["mongodb"],"question_text":"I am trying to retrieve one element from a mongo collection, the one with the greatest _id field. I know this can be done by querying:\n`db.collection.find().sort({_id: -1}).limit(1)`\nBut it kind of seems unelegant and I...
{"title":"Validate image from file in C#","tags":["c#",".net","image","file-io"],"question_text":"I'm loading an image from a file, and I want to know how to validate the image before it is fully read from the file.\n`string filePath = \"image.jpg\";\nImage newImage = Image.FromFile(filePath);`\nThe problem occurs when...
{"title":"How to use DataAnnotations ErrorMessageResourceName with custom Resource Solution","tags":["c#","asp.net-mvc","validation","resources","data-annotations"],"question_text":"I'm building a MVC web application with C#. Since the site will be multilingual, I've implemented my own ResourceManager. This class is re...
{"title":"itunesconnect using application loader behind a firewall","tags":["iphone","ios","itunesconnect","application-loader"],"question_text":"I was trying to upload the app store build zip file of my app to app store.\nWhen using behind my office firewall, the TCP\/IP connection failed.\nI need to know what exact p...
{"title":"Convert String text to Bitmap","tags":["android","image","bitmap"],"question_text":"Is it possible to convert string text that is inside an\n`EditText`\nbox into a Bitmap? In other words, is there any way to convert string text into a Bitmap that means the text will display as an image?\nBelow is my Code:\n`c...
{"title":"What is a void pointer in C++?","tags":["c++","void-pointers"],"question_text":"Possible Duplicate:\nWhat is a void pointer and what is a null pointer?\nI often see code which resembles something like the following:\n`void * foo(int bar);`\nWhat does this mean? Does it mean that it can return\nanything\n? Is ...
{"title":"How do I subtract two dates in Django\/Python?","tags":["python","django","datetime","date","time"],"question_text":"I'm working on a little fitness tracker in order to teach myself Django. I want to graph my weight over time, so I've decided to use the Python Google Charts Wrapper. Google charts require that...
{"title":"Is it possible to store the address of a label in a variable and use goto to jump to it?","tags":["c","pointers","label","goto","memory-address"],"question_text":"I know everyone hates gotos. In my code, for reasons I have considered and am comfortable with, they provide an effective solution (ie I'm not look...
{"title":"Relative URL to a different port number in a hyperlink?","tags":["html"],"question_text":"Is there a way without Javascript \/ server-side scripting to link to a different port number on the same box, if I don't know the hostname?\ne.g.:\n`<a href=\":8080\">Look at the other port<\/a>`\n(This example does't w...
{"title":"How to determine whether a year is a leap year in Python?","tags":["python","python-2.7"],"question_text":"I am trying to make a simple calculator to determine whether or not a certain year is a leap year.\nBy definition, a leap year is divisible by four, but not by one hundred, unless it is divisible by four...
{"title":"Cannot renew an Ad Hoc profile before it expires because no certificate matches the certificate ID","tags":["xcode","provisioning","ad-hoc-distribution"],"question_text":"My Ad Hoc profile is about to expire in 14 days. There is a a \"renew\" button for my ad hoc profile in the organizer but when I click it I...
{"title":"How to install SimpleJson Package for Python","tags":["python","simplejson"],"question_text":"http:\/\/pypi.python.org\/pypi\/simplejson\nI am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get ...
{"title":"How can I make git ignore future revisions to a file?","tags":["git","gitattributes"],"question_text":"I have created a default version of a file included in a git repository. It's important that when someone clones the repository, they get a copy of this file. However, I would like to set git so that it igno...
{"title":"Serializing python object instance to JSON","tags":["python","json","serialization","pickle"],"question_text":"I am trying to create a JSON string representation of a class instance and having difficulty. Let's say the class is built like this:\n`class testclass:\n value1 = \"a\"\n value2 = \"b\"`\nA call to ...
{"title":"How to detect page scroll to a certain point in jQuery?","tags":["jquery"],"question_text":"Imagine this is my page:\n`<p>hello<\/p>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<br \/>\n<p class=\"myPara\">My Paragraph<\/p>`\nHow can I alert a message wh...
{"title":"A Regex to match a SHA1","tags":["git","sha1"],"question_text":"I'm trying to match SHA1's in generic text with a regular expression.\nIdeally I want to avoid matching words.\nIt's safe to say that full SHA1's have a distinctive pattern (they're long and a consistent length) - so I can match these reliably - ...
{"title":"HTML\/CSS text background transparent but text not","tags":["html","css","text","opacity"],"question_text":"So I am having a problem. I have looked around and looked around but no luck. I would like to make the background of my body transparent but leave the text non transparent. As it is right now I keep mak...
{"title":"Specflow error: Force regenerate steps possible?","tags":["bdd","specflow"],"question_text":"Is it possible to \"force\" regenerate step definitions for a specflow feature file? I have created this feature file but cannot generate all steps. Am getting a message that all steps are already bound but when I run...
{"title":"What is neko any way?","tags":["haxe","neko"],"question_text":"I have started to use haxe to convert my action script 3 projects into NME, but, I like to know please what is neko in the world of linux? I searched for it, I found its an animated cat!\nCan any one please explain to me?","answer_text":"Neko\nfor...
{"title":"font size is not working in my d3.js code","tags":["d3.js"],"question_text":"i am writing d3.js for generating many charts and graphs.. but when there is no data i am just appending svg a text and writting \"no data to display\" and assigning some attributes like x y dy etc.. similarly font-size but except fo...
{"title":"composer laravel create project","tags":["php","laravel","composer-php"],"question_text":"I'm trying to use laravel, when I start a project and type\n`composer create-project \/Applications\/MAMP\/htdocs\/test_laravel`\nin terminal it shows\n`[InvalidArgumentException] \nCould not find package \/applications\...
{"title":"@property\/@synthesize equivalent in swift","tags":["ios","objective-c","swift","ios8"],"question_text":"We used to declare\n`property`\nto pass data between classes as following:\n`.h file (interface file)\n@property (nonatomic) double topSpeed;\n.m file (implementation file)\n@synthesize topSpeed;`\nNow the...
{"title":"What is the exhaustive list of all \"android.intent.action\" actions available in the Android SDK?","tags":["android","android-intent","action"],"question_text":"Hi fellows,\nI'd like to know if there is some exhaustive reference of all Intent actions defined in the standard Android SDK ? I'm thinking of the ...
{"title":"Npm module \"grunt-contrib-imagemin\" not found, Is it installed?","tags":["gruntjs","yeoman","bower"],"question_text":"I run into this error, when I try to do build a project with \"grunt build\".\nThere seems to be no problem when I test the project by doing \"grunt server\".\nThe project has been scaffolde...
{"title":"What is the advantage of Class-Based views?","tags":["django","django-class-based-views"],"question_text":"I read today that Django 1.3 alpha is shipping, and the most touted new feature is the introduction of\nclass-based views\n.\nI've read the\nrelevant documentation\n, but I find difficult to see the\nbig...
{"title":"Android WebView Cookie Problem","tags":["android","cookies","webview"],"question_text":"I have a server that sends my android app a session cookie to be used for \nauthenticated communication. I am trying to load a WebView with a URL \npointing to that same server and I'm trying to pass in the session \ncooki...
{"title":"Android ListView in Fragment","tags":["android","android-listview","android-fragments","listactivity"],"question_text":"I am trying to create a list of items which contains an image and some description for the image in each individual. After which, the list will be place in a\n`fragment`\ninside the applicat...
{"title":"how to listen for changes in Contact Database","tags":["android"],"question_text":"I am trying to listen for any change in the contact database.\nSo I create my contentObserver which is a child class of\n`ContentObserver`\n:\n`private class MyContentObserver extends ContentObserver {\n public MyContentObserve...
{"title":"Mercurial (hg) equivalent of git reset (--mixed or --soft)","tags":["mercurial"],"question_text":"what would be an equivalent mercurial command (or workflow) for\n`git reset --mixed HEAD^`\nor\n`git reset --soft HEAD^`\ni.e. I want leave the working tree intact but get the repository back into the state it wa...
{"title":"Recursively iterate over all the files in a directory and its subdirectories in Qt","tags":["c++","qt"],"question_text":"I want to recursively scan a directory and all its sub-directories for files with a given extension - for example, all *.jpg files. How can you do that in Qt?","answer_text":"I suggest you ...
{"title":"Can't get site root url in asp mvc","tags":["javascript","asp.net-mvc","asp.net-mvc-3","razor"],"question_text":"I need to get site root url in razor page in javascript code:\n`...\nvar siteRootUrl = '@Url.Content(\"~\")';\n...`\nBut all I get from this is '\/'.","answer_text":"To get the current host with po...
{"title":"Code Golf - Banner Generation","tags":["language-agnostic","code-golf","rosetta-stone"],"question_text":"When thanking someone, you don't want to just send them an e-mail saying \"Thanks!\", you want to have something FLASHY:\n`Input: THANKS!!\nOutput:\nTTT H H AAA N N K K SSS !!! !!! \n T H H A A NNN K K S !...
{"title":"Does Spring Data JPA have any way to count entites using method name resolving?","tags":["java","spring-data-jpa"],"question_text":"Spring Data JPA\nsupports counting entities using specifications. But does it have any way to count entities using method name resolving? Let's say I want a method\n`countByName`...
{"title":"Python requests exception handling","tags":["python","exception","http-request","python-requests"],"question_text":"How to handle exceptions with python library requests?\nFor example how to check is PC connected to internet?\nWhen I try\n`try:\n requests.get('http:\/\/www.google.com')\nexcept ConnectionError...
{"title":"Just uploaded Android App: How long before app shows in Android Market search?","tags":["android","google-play"],"question_text":"I've just uploaded a new app to the android market. However when I try to download it to my phone through the Android market, it doesn't appear!\nPlease can someone with knowledge ...
{"title":"Are Python threads buggy?","tags":["python","multithreading"],"question_text":"A reliable coder friend told me that Python's current multi-threading implementation is seriously buggy - enough to avoid using altogether. What can said about this rumor?","answer_text":"Python threads are good for\nconcurrent I\/...
{"title":"Python: How would you save a simple settings\/config file?","tags":["python","json","settings","config","ini"],"question_text":"I don't care if it's JSON, pickle, YAML, or whatever.\nAll other implementations I have seen are not forwards compatible, so if I have a config file, add a new key in the code, then ...
{"title":"How to write html code inside <?php ?>","tags":["php","html"],"question_text":"I want to create table inside php script .. Is there any way that i could create table inside php script.?\n`<?php html code to create table ?>`","answer_text":"You can do like\nHTML in PHP :\n`<?php\n echo \"<table>\";\n echo \"<t...
{"title":"how to fix seekbar-bar-thumb-centering-issues","tags":["android","seekbar"],"question_text":"I have set thumb image of a seek bar but my thumb looks little below of seek bar. How to set thumb at proper position of a seekbar. Have a look on the attached image\n`<SeekBar android:id=\"@+id\/PP_Player_SeekBar\" \...
{"title":"How to change inside background color of UISearchBar component on iOS","tags":["ios","objective-c","customization","uisearchbar","background-color"],"question_text":"I know how to remove\/change\n`UISearchBar`\nbackground color around search field:\n`[[self.searchBar.subviews objectAtIndex:0] removeFromSuperv...
{"title":"Swift UIView background color opacity","tags":["ios","swift","uiview","alpha"],"question_text":"I have a\n`UIView`\nwith a\n`UILabel`\nin it. I want the UIView to have white background color, but with an opacity of 50%. The problem whith setting\n`view.alpha = 0.5`\nis that the label will have an opacity of 5...
{"title":"Spread vs MPI vs zeromq?","tags":["api","networking","messaging","distributed","cluster-computing"],"question_text":"In one of the answers to\nBroadcast like UDP with the Reliability of TCP\n, a user mentions the\nSpread\nmessaging API. I've also run across one called\n\u00c3\u0098MQ\n. I also have some famil...
{"title":"Redis and Memcache or just Redis?","tags":["ruby-on-rails","memcached","heroku","redis"],"question_text":"I'm using memcached for some caching in my Rails 3 app through the simple\n`Rails.cache`\ninterface and now I'd like to do some background job processing with redis and resque.\nI think they're different ...
{"title":"How to update values using pymongo?","tags":["python","mongodb","pymongo"],"question_text":"I've a mongodb collection in this form:\n`{id=ObjectId(....),key={dictionary of values}}\nwhere dictionary of values is {'a':'1','b':'2'.....}`\nLet dictionary of values be\n`'d'`\n.\nI need to update the values of the...
{"title":"Alternatives to type casting when formatting NS(U)Integer on 32 and 64 bit architectures?","tags":["ios","objective-c","printf","nsinteger"],"question_text":"With the 64 bit version of iOS we can't use\n`%d`\nand\n`%u`\nanymore to format\n`NSInteger`\nand\n`NSUInteger`\n. Because for 64 bit those are typedef'...
{"title":"CouchDB Authorization on a Per-Database Basis","tags":["security","couchdb"],"question_text":"I'm working on an application supported by CouchDB. Essentially, I want to create a database for each individual user of my app. To accomplish this, the admin user will create the database, but going forward, the use...
{"title":"Why do abstract classes in Java have constructors?","tags":["java","constructor","abstract-class"],"question_text":"Why does an\n`abstract`\nclass in Java have a\n`constructor`\n?\nWhat is it constructing, as we can't instantiate an\n`abstract`\nclass?\nAny thoughts?","answer_text":"A constructor in Java does...
{"title":"How to find the child class name from base class?","tags":["c#","reflection","inheritance"],"question_text":"At\n`run-time`\n, inside\n`base class`\n, how to find the current child class name ?","answer_text":"Get the type of the current object, then its name.\n`this.GetType().Name`","question_code":[],"answe...
{"title":"Rails belongs_to many models","tags":["ruby-on-rails","activerecord","belongs-to"],"question_text":"I did find some questions on SO about Rails associations that are somewhat like my question, but for the life of me I can't seem to understand how to use\n`belongs_to`\nmultiple models.\nHere's the\ntable struc...
{"title":"How do I get 'puma' to start, automatically, when I run `rails server` (like Thin does)","tags":["ruby-on-rails","puma"],"question_text":"Normally, when you run\n`rails server`\nit starts Webrick. If you install the 'thin' gem, then 'thin' starts instead. I would like to do the same thing with the 'puma' serv...
{"title":"Download attachment from Outlook and Open in Excel","tags":["excel","excel-vba","outlook","email-attachments"],"question_text":"I'm trying to download and then open an Excel spreadsheet attachment in an Outlook email using VBA in Excel. \nHow can I:\nDownload\nthe one and only attachment from the first email ...
{"title":"How can you disable Git integration in Visual Studio 2013 permanently?","tags":["git","visual-studio-2013"],"question_text":"I know that you can disable git integration by using the Tools \/ Options dialog, but what I've noticed is that this setting doesn't seem to persist across sessions; i.e., as soon as cl...
{"title":"When is File.join useful?","tags":["ruby"],"question_text":"From reading the documentation, it's apparent that File.join joins the given parameters with the \/ character.\nWhen is using this, as opposed to\n`filenames.join('\/')`\n, beneficial?","answer_text":"There is another, subtle difference:\n`File.join(...
{"title":"Select random row(s) in SQLite","tags":["sql","sqlite"],"question_text":"In MySQL, you can select X random rows with the following statement:\n`SELECT * FROM table ORDER BY RAND() LIMIT X`\nThis does not, however, work in SQLite. Is there an equivalent?","answer_text":"`SELECT * FROM table ORDER BY RANDOM() L...
{"title":"How can I change the extension name in a string with bash?","tags":["bash"],"question_text":"I want to translate the following python code to bash. The code changes the extension name to .html and runs Safari to open it.\n`#!\/usr\/bin\/env python\nimport os.path\nimport os\noldName = $TM_FILEPATH\n(name, ext...
{"title":"Customizing an Admin form in Django while also using autodiscover","tags":["python","django","forms","django-admin","customization"],"question_text":"I want to modify a few tiny details of Django's built-in\n`django.contrib.auth`\nmodule. Specifically, I want a different form that makes username an email fiel...
{"title":"Can I specify my explicit type comparator inline?","tags":["c#",".net","linq","lambda"],"question_text":"So .NET 3.0\/3.5 provides us with lots of new ways to query, sort, and manipulate data, thanks to all the neat functions supplied with LINQ. Sometimes, I need to compare user-defined types that don't have ...
{"title":"javascript - replace dash (hyphen) with a space","tags":["javascript","regex"],"question_text":"I have been looking for this for a while, and while I have found many responses for changing a space into a dash (hyphen), I haven't found any that go the other direction.\nInitially I have:\n`var str = \"This-is-a...
{"title":"byte[] to image android","tags":["android","image","byte"],"question_text":"My issue is as follows :\nI have stored a few pictures into the sqlite database, using the blob format, which seems to work ok. now i want to get my pictures out of the DB and put then back into images... to complicate the matter, the...
{"title":"Create an Array in Swift from an NSData Object","tags":["ios","arrays","swift","nsdata"],"question_text":"I'm trying to store an array of integers to disk in swift. I can get them into an NSData object to store, but getting them back out into an array is difficult. I can get a raw\n`COpaquePointer`\nto the da...
{"title":"Why MAMP doesn't display errors?","tags":["php","error-handling","mamp"],"question_text":"OK this is getting very frustrating. MAMP used to display errors but then stopped. I decided to do a fresh install of it as I couldn't figure it out. I check my PHP version, running 5.4.4 and go to that folder and change...
{"title":"replacing NA's with 0's in R dataframe","tags":["r"],"question_text":"I've been playing around with the airquality dataset in R and figuring out how to remove lines with missing values. I used the following command:\n`complete.cases(airquality)\nAQ1<-airquality[complete.cases(airquality),]`\nHow do I go about...