text
stringlengths
74
309k
{"title":"Kaminari & Rails pagination - undefined method `current_page'","tags":["ruby-on-rails","ruby","kaminari"],"question_text":"I searched and searched, but nothing solved my problem. Here's my controller:\n`def show\n @topic = Topic.find(params[:id])\n @topic.posts = @topic.posts.page(params[:page]).per(2) # 2 fo...
{"title":"including rake tasks in gems","tags":["ruby-on-rails","ruby","rubygems","rake","gem"],"question_text":"1) Is there a 'best' place for rake tasks inside of gems? I've seen them in \/tasks, \/lib\/tasks, and I've seen them written as *.rb and *.rake -- not sure which (if any) is 'correct'\n2) How do I make them...
{"title":"Don't change link color when a link is clicked","tags":["html","css","html5"],"question_text":"I have a link in an HTML page:\n`<a href=\"#foo\">foo<\/a>`\nThe color of the link text is originally blue. When the link is clicked, the color of the link text changes to Red first, and then changes back to Blue. I...
{"title":"How to use export with Python on Linux","tags":["python","linux","export"],"question_text":"I need to make an export like this in Python :\n`# export MY_DATA=\"my_export\"`\nI've tried to do :\n`# -*- python-mode -*-\n# -*- coding: utf-8 -*-\nimport os\nos.system('export MY_DATA=\"my_export\"')`\nBut when I l...
{"title":"IDE's for C# development on Linux?","tags":["c#","linux","ide","mono"],"question_text":"What are my options? I tried MonoDevelop over a year ago but it was extremely buggy. Is the latest version a stable development environment?","answer_text":"MonoDevelop 2.0 has been released, it now has a decent GUI debugg...
{"title":"In Quartz.NET is there a way to set a property that will only allow one instance of a Job to run?","tags":[".net","quartz.net"],"question_text":"I have a service that will run every X minutes. If that job takes longer than X minutes for some unforeseen reason I want to make sure that the trigger doesn't kick ...
{"title":"Extracting HoG Features using OpenCV","tags":["opencv","computer-vision","feature-detection","object-recognition","feature-extraction"],"question_text":"I am trying to extract features using OpenCV's HoG API, however I can't seem to find the API that allow me to do that.\nWhat I am trying to do is to extract ...
{"title":"Multi-Level Includes in CodeFirst - EntityFrameWork","tags":["entity-framework","entity-framework-ctp5"],"question_text":"It is working code;\n`IQueryable<Product> productQuery = ctx.Set<Product>().Where(p => p.Id == id).(Include\"Contexts.AdditionalProperties.Field\");`\nBut you know that it could not produc...
{"title":"How do I get class name in PHP?","tags":["php"],"question_text":"`public class MyClass {\n}`\nIn Java, we can get class name with\n`String className = MyClass.class.getSimpleName();`\nHow to do this in PHP? I already know\n`get_class()`\n, but it works only for objects. Currently I work in Active Record. I ne...
{"title":"What is wrong with making a unit test a friend of the class it is testing?","tags":["c++","unit-testing","oop","encapsulation","friend"],"question_text":"In c++; I have often made a unit test class a friend of the class I am testing. I do this because I sometimes feel the need to write a unit test for a priva...
{"title":"Getting raw HTTP Data (Headers, Cookies, etc) in Google Cloud Endpoints","tags":["java","google-app-engine","google-cloud-endpoints"],"question_text":"I am wondering if it is possible to collect raw HTTP data in a Cloud Endpoint. \nI can't seem to find anything in Google's documentation, but App Engine's Twit...
{"title":"Why does Chrome debugger think closed local variable is undefined?","tags":["javascript","google-chrome","google-chrome-devtools"],"question_text":"With this code:\n`function baz() {\n var x = \"foo\";\n function bar() {\n debugger;\n };\n bar();\n}\nbaz();`\nI get this unexpected result:\nWhen I change the c...
{"title":"What's the meaning of 'origin' in 'git push origin master'","tags":["git"],"question_text":"When I run:\n`git push origin master`\n...what is the meaning of\n`origin`\nin this context?","answer_text":"git has a concept of \"remotes\" - these are like easy nicknames for a repository, so you don't have to use i...
{"title":"Convert DataSet to List","tags":["c#","list","ado.net","dataset"],"question_text":"Here is my c# code\n`Employee objEmp = new Employee();\nList<Employee> empList = new List<Employee>();\nforeach (DataRow dr in ds.Tables[0].Rows)\n{\n empList.Add(new Employee { Name = Convert.ToString(dr[\"Name\"]), Age = Conv...
{"title":"push activity on the right when open drawer","tags":["android","facebook","navigation-drawer"],"question_text":"I have implemented drawerlayout which slides from the right but it does not shift the activity the right like facebook does (See below image). How do I push the current activity to the right side wh...
{"title":"How do I start threads in plain C?","tags":["c","multithreading"],"question_text":"I have used fork() in C to start another process. How do I start a new thread?","answer_text":"Since you mentioned fork() I assume you're on a Unix-like system, in which case\nPOSIX threads\n(usually referred to as pthreads) ar...
{"title":"Generating pdf-latex with python script","tags":["python","latex","pdflatex"],"question_text":"I'm a college guy, and in my college, to present any kind of homework, it has to have a standard coverpage (with the college logo, course name, professor's name, my name and bla bla bla).\nSo, I have a .tex document...
{"title":"The application icon does not show on action bar","tags":["android","android-actionbar","icons","appcompat","material-design"],"question_text":"I followed up the instructions of building a new android project and I got a runnable one except a problem with action bar. The problem is that the application icon i...
{"title":"MySQL: Insert datetime into other datetime field","tags":["mysql","datetime","insert"],"question_text":"This sounds so easy, but I am uncertain how to do it best, and Google wouldn't help.\nI have a table with a DATETIME column.\nI would like to SELECT this datetime value and INSERT it into another column.\nI...
{"title":"Parse time of format hh:mm:ss","tags":["java","date","string-parsing"],"question_text":"How can I parse a time of format\n`hh:mm:ss`\n, inputted as a string to obtain only the integer values (ignoring the colons) in java?","answer_text":"I'm sorry if I'm gonna upset anyone with this, but I'm actually gonna an...
{"title":"background image for input type=\"button\"","tags":["html","css","button"],"question_text":"i've been trying to change the background image of the input button through css, but it doesn't work.\nsearch.html:\n`<body>\n <form name=\"myform\" class=\"wrapper\">\n <input type=\"text\" name=\"q\" onkeyup=\"showUs...
{"title":"Automatically quit vim if NERDTree is last and only buffer","tags":["vim","nerdtree"],"question_text":"I have the following in my .vimrc:\n`\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\" Open NERDTree by default\n\"\"\"\"\"\...
{"title":"Custom UIScrollView paging with scrollViewWillEndDragging","tags":["ios","uiscrollview","uikit","uiscrollviewdelegate"],"question_text":"I'm trying to use the new scrollViewWillEndDragging:withVelocity:targetContentOffset: UIScrollView delegate call in iOS 5 but i can't seem to get it to actually respond to m...
{"title":"Neo4J get node by ID","tags":["neo4j"],"question_text":"I am using neo4j for one of my project, there's a node which only has a single property as\n`name`\n, I want to get that node using ID, it already has a ID but when I use this code\n`MATCH (s:SKILLS{ID:65110}) return s`\nIt returns nothing, heres my node...
{"title":"How to terminate a thread blocking on socket IO operation instantly?","tags":["java","multithreading","sockets"],"question_text":"In the context of Java, I create a new thread to read network input when open a GUI window, and when i close the window, i want to release the socket resource and terminate the thr...
{"title":"Global constants in Groovy","tags":["groovy","global-variables"],"question_text":"It is often desired to declare constants at the top of a script that can be referenced anywhere else in the script. In Groovy, it seems that if you declare a constant using final then it isnot accessible in child scopes. What is...
{"title":"Add JIRA Quick Search to Chrome Omnibox","tags":["google-chrome","jira","opensearch"],"question_text":"I would like to search JIRA's \"Quick Search\" from Chrome's Omnibox. This is not the same as this Chrome Omnibox search string:\n`https:\/\/myserver\/jira\/browse\/%s`\nThat string will only open perfectly ...
{"title":"python - checking odd\/even numbers and changing outputs on number size","tags":["python","numbers"],"question_text":"I have a couple of problems to solve for an assignment, and am a bit stuck.\nThe question is to write a program that gets the user to input an odd number (check it's odd), then print an upside...
{"title":"How do I get a keyIterator for a LinkedHashMap?","tags":["java","iterator","linkedhashmap"],"question_text":"By looking at the source code for LinkedHashMaps from Sun, I see that there is a private class called KeyIterator, I would like to use this. How can I gain access?","answer_text":"You get it by calling...
{"title":"Testing whether certain elements are visible or not","tags":["angularjs","karma-runner"],"question_text":"How do I find out if an element is visible or hidden in testacular (jasmine)?\nMy DOM looks like:\n`<div class=\"span5 value-entry\">\n <input type=\"text\" ng-model=\"query.value\" placeholder=\"Enter va...
{"title":"What is The use of moveToFirst () in SQLite Cursors","tags":["android","sqlite","cursor"],"question_text":"I am a programming newbie\nand I found this piece of code in the internet and it works fine\n`Cursor c=db.query(DataBase.TB_NAME, new String[] {DataBase.KEY_ROWID,DataBase.KEY_RATE}, DataBase.KEY_ROWID+\...
{"title":"Get Attribute model by attribute_code in Magento","tags":["magento"],"question_text":"How could I get\n`Attribute model`\n(from:\n`eav_attribute`\ntable) by\n`attribute_code`\nin Magento?\nNotice:\n- I don't care what is entity_type.\nThank you so much.","answer_text":"You have to know entity_type because you...
{"title":"Can a DbContext enforce a filter policy?","tags":["c#","entity-framework-4.1"],"question_text":"I would like to pass a value to the ctor of a DbContext and then have that value enforce \"filtering\" on the related DbSets. Is this possible...or is there a better approach?\nCode might look like this:\n`class Co...
{"title":"Passing array of parameters through get in rails","tags":["ruby-on-rails","http"],"question_text":"How do I pass array of parameters through Get method in rails? Currently my URL loocs like this:\n`http:\/\/localhost:3000\/jobs\/1017\/editing_job_suites\/1017\/editing_member_jobs\/new?ids[]=1025&ids[]=1027`\n...
{"title":"what is difference between MemoryCache vs ObjectCache in .net 4.0?","tags":["c#",".net",".net-4.0"],"question_text":"what is difference between .net 4.0 MemoryCache vs ObjectCache?\nWhere to use which object?","answer_text":"ObjectCache is the abstract class that demonstrates how you should build a Cache that...
{"title":"Pandas: Looking up the list of sheets in an excel file","tags":["python","pandas"],"question_text":"The new version of Pandas uses\nthe following interface\nto load Excel files:\n`read_excel('path_to_file.xls', 'Sheet1', index_col=None, na_values=['NA'])`\nbut what if I don't know the sheets that are availabl...
{"title":"Cordova splash screen remove","tags":["cordova","ionic-framework","phonegap-build","ionic"],"question_text":"Is it possible to disable cordova default splash screen, I have removed the plugin but default splash screen for iphone still is showing and for android white screen is showing.Can this be fully remove...
{"title":"iPhone - Detecting if the iDevice has a front camera","tags":["iphone","camera"],"question_text":"Apple recommends not searching for hardware version, but for the specific feature in which you are interested.\nSo how may I detect if there is a front camera on the device to be able to disable some features ?\n...
{"title":"How to navigate to a bookmark in eclipse 3.4.1?","tags":["java","eclipse","editor","bookmarks"],"question_text":"I am able to set bookmarks in a source file, but are there shortcut keys to navigate to a bookmark ? The\nnavigate\nmenu has a goto line. But that is not useful.","answer_text":"If you check the \"...
{"title":"Should I set max pool size in database connection string? What happens if I don't?","tags":["sql","sql-server-2008","connection-string","connection-pooling"],"question_text":"This is my database connection string. I did not set max pool size until now.\n`public static string srConnectionString = \n \"server=l...
{"title":"Mask an EditText with Phone Number Format NaN like in PhoneNumberUtils","tags":["android","formatting","android-edittext","masking"],"question_text":"I want to make user inputted phone number in an editText to dynamically change format every time the user inputs a number. That is, when user inputs up to 4 dig...
{"title":"TestSuite Setup in jUnit 4","tags":["java","junit","installation","test-suite"],"question_text":"I've managed to find out how to make a TestSuite in jUnit 4, but I really miss the v3 possibility of wrapping a suite in a TestSetup.\nAny ideas as to how to get some @BeforeClass\/@AfterClass setup executed for a...
{"title":"the way to compare string in an efficient way in C++","tags":["c++","string"],"question_text":"Is it efficient to compare a string with another string or string literal like this?\n`string a;\nstring b;\nif (a == \"test\")`\nor\n`if (a == b)`\nMy coworker asked me to use memcmp\nAny comments about this?\nThan...
{"title":"Use SVN Revision to label build in CCNET","tags":["svn","msbuild","cruisecontrol.net"],"question_text":"I am using CCNET on a sample project with SVN as my source control. CCNET is configured to create a build on every check in. CCNET uses MSBuild to build the source code.\nI would like to use the latest revi...
{"title":"How to handle \"Up\" button?","tags":["android"],"question_text":"How to handle \"Up\" button (SDK version 11+)? I am referring to the one at the top of screen, that holds the application icon.\nIn Android Design articles it was named as \"Up button\", but I didn't found it (or similar) in KeyEvent fields.","...
{"title":"Using Require.js without data-main","tags":["javascript","requirejs"],"question_text":"Can I use Require.js in development without using the\n`data-main`\nattribute to load in my initial script? ie.\n`<script data-main=\"scripts\/main\" src=\"scripts\/require.js\"><\/script>`\nI'm finding it difficult for me ...
{"title":"Windows 7 theme for WPF?","tags":[".net","wpf","windows","themes","wpftoolkit"],"question_text":"Is there any way to make a WPF app look like it's running on Windows 7 even if it's running on XP? I'm looking for some kind of theme I can just paste in. I'm aware of the themes project on Codeplex (\nhttp:\/\/ww...
{"title":"batch file Copy files with certain extensions from multiple directories into one directory","tags":["windows","batch-file","command-prompt","xcopy",".doc"],"question_text":"I'm a newbie, so bear with me...\nI am trying to copy all\n`.doc`\nfiles that I have scattered throughout several subdirectories of one m...
{"title":"Webpack can not load font file: Unexpected Token","tags":["css","fonts","webpack"],"question_text":"I have a style.css file that makes use of a font file. And I'm having trouble getting the font file loaded using Webpack. Here is my loader configuration.\n`loaders : [\n {\n test : \/\\.(js|jsx)$\/,\n exclude ...
{"title":"Linker error calling C-Function from Objective-C++","tags":["objective-c","objective-c++"],"question_text":"I've got a weird linker issue. I have code that looks like so:\n`double given_amount = self.modelController.levelCompleteRewardAmount;\n swrve_currency_given(swrve, (CFStringRef)@\"currencyName\", given...
{"title":"How hard is developing for iPhone?","tags":["iphone"],"question_text":"I want to know how difficult is to develop on iPhone plataform. By difficult I want to mean:\nEffort in terms of programmer versus software complexity. To be clear: how many programmers are needed to develop a medium sized app on iPhone?\n...
{"title":"checking if touchend comes after a drag","tags":["javascript","jquery","ios","touch","touch-events"],"question_text":"I have some code which changes the class of a table. On a phone, sometimes the table will be too wide for the screen and the user will drag\/scroll about to see the contents. However, when the...
{"title":"can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1. Make sure all dependencies are added to Gemfile","tags":["ruby-on-rails-4","bcrypt-ruby"],"question_text":"I have Rails 4.0.0 app. When I run bundle install command there is no problem. This is my GemFile.\n`source 'https:\/\/rubygems...
{"title":"Converting a date format in objective C","tags":["iphone","objective-c","ios","nsdate","nsdateformatter"],"question_text":"How can i convert the following date \"Sun Jul 17 07:48:34 +0000 2011\"\nto the following format \"2011-07-17 07:48:34\"?\nI used\n`NSDateFormatter`\nas shown below but it didnt work. It ...
{"title":"Recommended gcc warning options for C","tags":["c","gcc","compiler-errors"],"question_text":"Other than -Wall what other warnings have people found useful?\nhttp:\/\/gcc.gnu.org\/onlinedocs\/gcc-4.3.2\/gcc\/Warning-Options.html","answer_text":"I routinely use:\n`gcc -m64 -std=c99 -pedantic -Wall -Wshadow -Wpo...
{"title":"Swift UItableView Custom cell programatically (documentation)?","tags":["ios","swift","uitableview","cocoa-touch","tableviewcell"],"question_text":"I've been trying to find some documentation\/tutorial\/examples. On how to do an advanced tableview in swift. But I've come up empty besides the endless storyboar...
{"title":"Which is the best Maven Eclipse plugin?","tags":["java","eclipse","maven-2","eclipse-plugin"],"question_text":"There is two available Eclipse plugins for Maven :\nEclipse IAM\n(old name is Q4E)\nm2eclipse\nm2eclipse seems to be the oldest but the more robust. Is there any key differences between the two ?\nWh...
{"title":"What does \"Protocol ... can only be used as a generic constraint because it has Self or associated type requirements\" mean?","tags":["generics","swift","protocols","xcode6"],"question_text":"Update:\nFor the best possible explanation for why this is the way it is\ncheck out this video\n.\nI am trying to cre...
{"title":"PHP Header redirect not working","tags":["php"],"question_text":"`include('header.php');\n$name = $_POST['name'];\n$score = $_POST['score'];\n$dept = $_POST['dept'];\n$MyDB->prep(\"INSERT INTO demo (`id`,`name`,`score`,`dept`, `date`) VALUES ('','$name','$score','$dept','$date')\");\n\/\/ Bind a value to our ...
{"title":"why is merge sort preferred over quick sort for sorting linked lists","tags":["algorithm","quicksort","mergesort"],"question_text":"I read the following in a forum :\nMerge sort is very efficient for\n immutable datastructures like linked\n lists\nand\nQuick sort is typically faster than\n merge sort when the...
{"title":"how to increase the space between the elements in linearlayout in android?","tags":["android","android-layout"],"question_text":"In my application, I had Used linearlayout, inside that I am having 3 EditText elements. Now I want to increase the space(padding) between the Edittext element. Is it possible?","an...
{"title":"Does Python support MySQL prepared statements?","tags":["python","mysql","prepared-statement"],"question_text":"I worked on a PHP project earlier where prepared statements made the SELECT queries 20% faster.\nI'm wondering if it works on Python? I can't seem to find anything that specifically says it does or ...
{"title":"Problem using pow() in C","tags":["c"],"question_text":"Why does the following bit of code work in C:\n`int res = pow(2, 3);\nprintf(\"%d\\n\", res);`\nwhile this other doesn't?\n`int a = 2;\nint b = 3;\nint res = pow(a, b);\nprintf(\"%d\\n\", res);`\nEven if I try\n`double a = 2;\ndouble b = 3;\ndouble res =...
{"title":"Running Python from Atom","tags":["python","atom-editor"],"question_text":"In Sublime, we have an easy and convent way to run Python or almost any language for that matter using\n\u00e2\u008c\u0098\n+\nb\n(or\nctrl\n+\nb\n)\nWhere the code will run in a small window below the source code and can easily be clo...
{"title":"Calling an asynchronous function within a for loop in JavaScript","tags":["javascript","asynchronous","for-loop","closures"],"question_text":"I have the following code:\n`for(var i = 0; i < list.length; i++){\n mc_cli.get(list[i], function(err, response) {\n do_something(i);\n });\n}`\n`mc_cli`\nis a connecti...
{"title":"C# Timer or Thread.Sleep","tags":["c#","timer"],"question_text":"I am running a windows service and using a loop and Thread.Sleep to repeat a task, would it be better to use a timer method?\nIf yes a code example would be great\nI am currently using this code to repeat\n`int curMinute;\nint lastMinute = DateT...
{"title":"Bash syntax error: unexpected end of file","tags":["bash","syntax"],"question_text":"Forgive me for this is a very simple script in Bash. Here's the code:\n`#!\/bin\/bash\n# june 2011\nif [ $# -lt 3 -o $# -gt 3 ]; then\n echo \"Error... Usage: $0 host database username\"\n exit 0\nfi`\nafter running sh file.s...
{"title":"Error in C#: \"an expression tree may not contain a base access\" - why not?","tags":["c#",".net","expression-trees"],"question_text":"I was calling a method that accepts\n`Expression<Func<bool>>`\n.\nAs part of the expression I was passing:\n`this.Bottom == base.lineView.Top`\nThe compiler gave me an error t...
{"title":"Store common query as column?","tags":["postgresql","database-design","view"],"question_text":"Using PostgreSQL, I have a number of queries that look like this:\n`SELECT <col 1>, <col 2>\n , (SELECT sum(<col x>)\n FROM <otherTable> \n WHERE <other table foreignkeyCol>=<this table keycol>) AS <col 3>\nFROM <tb...
{"title":"C# Variable Scoping","tags":["c#","scope"],"question_text":"`if(true)\n{\n string var = \"VAR\";\n}\nstring var = \"New VAR!\";`\nThis will result in:\nError 1 A local variable named 'var'\n cannot be declared in this scope\n because it would give a different\n meaning to 'var', which is already\n used in a '...
{"title":"linux command: SORT, according to field's numerical value","tags":["linux","sorting","command"],"question_text":"Example:\ncontent of File.txt:\n`100 foo\n 2 bar\n 300 tuu`\nWhen using 'sort -k 1,1 File.txt', the order of lines will not changed, though we are expecting :\n`2 bar\n 100 foo\n 300 tuu`\nHow can ...
{"title":"Unable to call App_Code class from a code-behind","tags":["asp.net","mono","code-behind","app-code"],"question_text":"I have a class in a file that's in the \"App_Code\" folder. I'm able to use this in an \"aspx\" file but not from a code-behind file. How do I make it visible to a code-behind?\nNOTE: This is ...
{"title":"Open a file in a tab in vim in readonly mode","tags":["vim","tabs","readonly"],"question_text":"I'm aware of opening files in readonly mode from shell using\n`vim -R`\n, but how to open a file from inside vim in a separate tab (\n`:tabe <filename>`\n) in readonly mode?\nThanks for your time.","answer_text":"`...
{"title":"can't tap on item in google autocomplete list on mobile","tags":["autocomplete","cordova"],"question_text":"I'm making a mobile-app using Phonegap and HTML. Now I'm using the google maps\/places autocomplete feature. The problem is: if I run it in my browser on my computer everything works fine and I choose a...
{"title":"Is there any way to integrate Mylyn with Bitbucket?","tags":["bitbucket","mylyn"],"question_text":"Bitbucket has an issue tracker, can it be turned into Mylyn tasks?","answer_text":"FYI - here is a fork of that original mylyn connector project that is active. I installed it using the wiki notes today and it s...
{"title":"textview.getLineCount always 0 in android","tags":["android","textview"],"question_text":"I'm trying to dynamically resize my textview but getlinecount() method always returns me 0 even after settext() and invalidate(). I'm using the following code:\n`if(convertView == null){\n convertView = lInflater.inflate...
{"title":"Using Modernizr to test for tablet and mobile - Opinions wanted","tags":["mobile","desktop","tablet","modernizr","device-detection"],"question_text":"I want to use Modernizr to detect whether a user is view a site on a desktop, tablet or mobile device.\nMy initial first thoughts are obviously to check screen ...
{"title":"UIWebView didFinishLoading fires multiple times","tags":["iphone","ios","objective-c","xcode","uiwebview"],"question_text":"I have some code that needs to run after the a\n`UIWebView`\nfinishes loading a document. For that I've set the\n`UIWebView`\n's delegate to my controller, and implemented the\n`webViewD...
{"title":"Handling touches inside UIWebview","tags":["iphone","uiwebview"],"question_text":"I have created a subclass of\n`UIWebView`\n, and have implemented the\n`touchesBegan`\n,\n`touchesMoved`\nand\n`touchesEnded`\nmethods.\nbut the webview subclass is not handling the\n`touch`\nevents.\nIs there any method to hand...
{"title":"Entity Framework is Too Slow. What are my options?","tags":[".net","performance","entity-framework","orm"],"question_text":"I have followed the \"Don't Optimize Prematurely\" mantra and coded up my WCF Service using Entity Framework.\nHowever, I profiled the performance and Entity Framework is too slow. (My a...
{"title":"JPA @OneToOne with Shared ID -- Can I do this Better?","tags":["jpa","one-to-one"],"question_text":"I\u00e2\u0080\u0099m working with an existing schema that I\u00e2\u0080\u0099d rather not change. The schema has a one-to-one relationship between tables Person and VitalStats, where Person has a primary key an...
{"title":"Why is `vapply` safer than `sapply`?","tags":["r","apply","r-faq"],"question_text":"The documentation says\n`vapply`\nis similar to\n`sapply`\n, but has a pre-specified type of return value, so it can be safer [...] to use.\nCould you please elaborate as to why it is generally safer, maybe providing examples?...
{"title":"Automatic resizing of the Windows Forms controls","tags":["c#",".net","winforms"],"question_text":"I'm using VS2008's designer for doing this.\nFor example if I've a windows form of size say 500x500 and I added a DataGridView to it (490x490).\nwhen I run this program. and maximize the form, the DataGridView s...
{"title":"Sublime Text: Regex to convert Uppercase to Title Case?","tags":["regex","string","sublimetext","sublimetext3"],"question_text":"I have a bunch of labels in a text file (e.g. MY LABEL:) that I need to make title case.\nI already know how I would make them all lower or upper case.\nFor example:\n`^([A-Z &#]+:)...
{"title":"iPhone AVFoundation camera orientation","tags":["iphone","camera","orientation","avfoundation"],"question_text":"I've been tearing my hair out trying to get the AVFoundation camera to capture a picture in the correct orientation (i.e. the device orientation) but I can't get it to work.\nI have looked at tutor...
{"title":"cakephp OR condition","tags":["php","cakephp"],"question_text":"Originaly\nposted\non cakephp Q&A but i'll put it up here in hope of getting some answers.\nI have a bunch of companies that has a status of 0 as default but sometimes get a higher status. Now i want to use the high status if exists but revert to...
{"title":"ArrayAdapter in android to create simple listview","tags":["android","listview","android-arrayadapter"],"question_text":"I tried to create an\n`Activity`\nin Android, This Activity only contains a\n`ListView`\nnothing else.\nAs I know to fill the listview we need to use an\n`ArrayAdapter`\n.\nSo to understand...
{"title":"jquery check if string starts with 1234","tags":["javascript","jquery"],"question_text":"Thanks for taking the time to answer my question.\nI want to check if a string has exactly 7 characters and starts with \"1234\". How do I do that?\nI know of string.substring but am not sure if I shouold use regex or are...
{"title":"Differences between express.Router and app.get?","tags":["node.js","express"],"question_text":"I'm starting with\n`NodeJS`\nand\n`Express 4`\n, and I'm a bit confused. I been reading the\n`express`\nwebsite, but can't see _when to use a route handler or when to use\n`express.Router`\n.\nAs I could see, if I w...
{"title":"Set window.location with TypeScript","tags":["javascript","jquery","typescript"],"question_text":"I am getting an error with the following TypeScript code:\n`\/\/\/<reference path='..\/..\/..\/Shared\/typescript\/jquery.d.ts' \/>\n \/\/\/<reference path='..\/..\/..\/Shared\/typescript\/jqueryStatic.d.ts' \/>\...
{"title":"How to detect if Console.In (stdin) has been redirected?","tags":["c#","console","redirect","stdin"],"question_text":"I want to write a console application that have a different behavior depending if the input is coming from keyboard or from, say, a file.\nIs it possible? What's the most elegant way to do it ...
{"title":"I can't install intel HAXM","tags":["android","android-studio","intel","hyper-v","haxm"],"question_text":"So, I installed Android Studio and I had no problems with that. However, when I tried to run the emulator, it said that intel HAXM was not installed.\nSo I found the installer, run it, and it even though ...
{"title":"How to provide custom string placeholder for string format","tags":["c#",".net","string","string-formatting"],"question_text":"I have a string\n`string str =\"Enter {0} patient name\";`\nI am using string.format to format it.\n`String.Format(str, \"Hello\");`\nNow if i want patient also to be retrieved from s...
{"title":"How to find out the version of installed cocoa pods?","tags":["osx","cocoapods"],"question_text":"How to find out the version of installed cocoa pods?\nI'm not asking about the version of the cocoa pods\ngem\n, but the version of the pods themselves. Ideally it would say \"pod GreatViewController is installed...
{"title":"Regex date format validation on Java","tags":["java","regex","date","parsing"],"question_text":"I'm just wondering if there is a way (maybe with regex) to validate that an input on a Java desktop app is exactly an string formated as: \"YYYY-MM-DD\".\nI've searched but with no success.\nThank you","answer_text...
{"title":"invoking proc with instance_eval with arguments?","tags":["ruby"],"question_text":"I know this works:\n`proc = Proc.new do\n puts self.hi + ' world'\nend\nclass Usa\n def hi\n \"Hello!\"\n end\nend\nUsa.new.instance_eval &proc`\nHowever I want to pass arguments to proc, so I tried this which does not work:\n`...
{"title":"Image from UIView","tags":["objective-c","uiview"],"question_text":"is there any Possibility to create a image out of a UIView?\nThanks,\nAndreas","answer_text":"`#import \"QuartzCore\/QuartzCore.h\"`\nafter you added the framework to your project. Then do:\n`UIGraphicsBeginImageContext(yourView.frame.size);\...
{"title":"Example images for code and mark-up Q&As","tags":["java","javascript","css","image"],"question_text":"When preparing an\nMCVE\n\/\nSSCCE\nthat involves images, it is useful to have direct access to images.\nThe types of images that would cover most questions are - small images in multiple colors or shapes, an...
{"title":"How to end \/ Force a close to a program (in Clojure)","tags":["clojure","exit"],"question_text":"I am a pretty decent programmer in Java, however I am new to programming in Clojure.\nIn Java, to force an exit of a program, the code used is\n`System.exit(0)`\n. Is there any equivalent to this code is Clojure?...
{"title":"Using NSLog for debugging","tags":["objective-c","xcode","debugging","nslog"],"question_text":"I have the following code snippet in my Xcode:\n`NSString *digit [[sender titlelabel] text];\nNSLog([digit]);`\nI tried to build the application and am getting the following warning message for the line\n`NSLog([dig...