text
stringlengths
74
309k
{"title":"How to get full host name + port number in Application_Start of Global.aspx?","tags":["c#","asp.net","url","request","hostname"],"question_text":"I tried\n`Uri uri = HttpContext.Current.Request.Url;\nString host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + \":\" + uri.Port;`\nand it worked well on my local...
{"title":"Structure of a C++ Object in Memory Vs a Struct","tags":["c++","struct"],"question_text":"If I have a class as follows\n`class Example_Class \n {\n private:\n int x; \n int y; \n public: \n Example_Class() \n { \n x = 8;\n y = 9;\n }\n ~Example_Class() \n { } \n };`\nAnd a struct as follows\n`struct\n{\n int ...
{"title":"Limit characters tesseract is looking for","tags":["ocr","tesseract"],"question_text":"Is it possible to limit the set of characters that\ntesseract\nis looking for (e.g. search only for letters a-z)? That would improve my results greatly.","answer_text":"Create a config file (e.g \"letters\") in tessdata\/co...
{"title":"visual studio 2012 incompatiblity and editor package not loading correctly?","tags":["visual-studio","incompatibility"],"question_text":"I used to use vs 2012 for some month without any problem, today when I want to open my c# project , I got this error message:\n`This program has known compatibility issues\n...
{"title":"How do I create a HashCode in .net (c#) for a string that is safe to store in a database?","tags":["c#",".net","database","hashcode","gethashcode"],"question_text":"To quote from\nGuidelines and rules for GetHashCode\nby Eric Lippert:\nRule:\nConsumers of GetHashCode cannot rely upon it being stable over time...
{"title":"Responsive jQuery UI Dialog ( and a fix for maxWidth bug )","tags":["jquery","jquery-ui","responsive-design","jquery-dialog","css"],"question_text":"With many sites leveraging jQuery UI, there are some major shortcomings that have to be overcome because jQuery UI does not support responsive design and there's...
{"title":"How unique is the php session id","tags":["php","session","guid"],"question_text":"How unique is the php session id? I got the impression from various things that I've read that I should not rely on two users never getting the same sessionid. Isn't it a GUID?","answer_text":"It's not very unique as shipped. I...
{"title":"What is the difference between ivars and properties in Objective-C","tags":["objective-c","properties","instance-variables"],"question_text":"What is the semantic difference between these 3 ways of using ivars and properties in objective-c?\n1.\n`@class MyOtherObject; \n@interface MyObject {\n}\n@property (no...
{"title":"asp.net mvc - [HttpPost\/HttpGet] vs. [AcceptVerbs(HttpVerbs.Post\/Get)]","tags":["asp.net-mvc"],"question_text":"are these things the same?\n`[HttpPost\/HttpGet] vs. [AcceptVerbs(HttpVerbs.Post\/Get)]`\nif not where is a difference?","answer_text":"Yes, absolutely the same.\n`[HttpPost\/HttpGet]`\nwere intro...
{"title":"How to get a count of all the files in a git repository?","tags":["git"],"question_text":"How would you get a count of all the files currently in a git repository?","answer_text":"You can get a count of all tracked files in a git respository by using the following command:\n`git ls-files | wc -l`\nCommand Bre...
{"title":"How do execute a .sql script from bash","tags":["mysql","database","linux","bash"],"question_text":"Basically, I need to setup a database from a bash script. I have a script db.sql that does all this. Now how do I run this script from bash?\nDatabase system is mysql","answer_text":"You simply need to start\n`...
{"title":"Why is Count not an unsigned integer?","tags":["c#",".net"],"question_text":"Possible Duplicates:\nWhy does .NET use int instead of uint in certain classes?\nWhy is Array.Length an int, and not an uint\nHi,\nI always wonder why Count isn't an unsigned integer instead of a signed one?\nFor example, take ListVi...
{"title":"AngularJS How to dynamically add HTML and bind to controller","tags":["javascript","angularjs"],"question_text":"I'm just getting started with angularJS and struggling to figure out proper architecture for what I'm trying to do. I have a single page app but\nthe URL always should stay the same\n; I don't want...
{"title":"Purpose of the mine-full and theirs-full commands","tags":["svn"],"question_text":"According to the docs:\n(mc) mine-conflict - accept my\n version for all conflicts (same)\n(tc) theirs-conflict - accept their\n version for all conflicts (same)\n(mf) mine-full - accept my\n version of entire file (even\n non-...
{"title":"How to rotate a Three.js Vector3 around an axis?","tags":["javascript","vector","rotation","three.js"],"question_text":"How to rotate a Three.js\nVector3\nby a certain angle around an axis?","answer_text":"`var vector = new THREE.Vector3( 1, 0, 0 );\nvar axis = new THREE.Vector3( 0, 1, 0 );\nvar angle = Math....
{"title":"Page scroll when soft keyboard poped up","tags":["android","android-layout","android-intent","android-scrollview","android-keypad"],"question_text":"I have a\n`<ScrollView>`\nlayout:\n`<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n a...
{"title":"Run MongoDB server as a service (detached from terminal)?","tags":["service","mongodb"],"question_text":"When I start the MongoDB server (mongod) from terminal it keeps that tab open. How do I go about running it as a service?\nI'm on OSX Lion.\nI like how the rails server script has a -d option to detach it ...
{"title":"Is accessing a global array outside its bound undefined behavior?","tags":["c","undefined-behavior"],"question_text":"I just had an exam in my class today --- reading C code and input, and the required answer was what will appear on the screen if the program actually runs. One of the questions declared\n`a[4]...
{"title":"Functional lenses","tags":["haskell","functional-programming","lenses"],"question_text":"Could someone explain functional lenses to me? It's a surprisingly difficult subject to google for and I haven't made any progress. All I know is that they provide similar get\/set functionality than in OO.","answer_text"...
{"title":"knockout.js access viewModel in javascript function outside viewModel's scope","tags":["knockout.js","data-binding","scope"],"question_text":"I'm wondering if I can access the knockout.js main viewModel from a method outside the scope of the viewModel itself. Take this example:\n`function Employee(data) {\n v...
{"title":"Git tag in branches","tags":["git","tags"],"question_text":"I'm currently working with a repository that has multiple branches.\nWhen I create a tag, does that tag refer to the then-current branch?\nIn other words: Whenever I create a tag, do I need to switch to the desired branch and tag inside that branch s...
{"title":"git merge: apply changes to code that moved to a different file","tags":["git"],"question_text":"I am attempting a pretty beefy git merge maneuver right now. One problem that I am coming across is that I made some changes to some code in my branch, but my colleague moved that code to a new file in his branch....
{"title":"PowerShell and the -contains operator","tags":["powershell","operators"],"question_text":"Consider the following snippet:\n`\"12-18\" -Contains \"-\"`\nYou\u00e2\u0080\u0099d think this evaluates to\n`true`\n, but it doesn't. This will evaluate to\n`false`\ninstead. I\u00e2\u0080\u0099m not sure why this happ...
{"title":"$.cookie is not a function","tags":["javascript","jquery"],"question_text":"When I try to load my page that uses jquery, when the following line is hit:\n`if ($.cookie('compare') != null)`\nI get the error $.cookie is not a function. Has anybody seen this before?","answer_text":"That means that the\n`$.cookie...
{"title":"Hibernate count collection size without initializing","tags":["java","hibernate","lazy-loading"],"question_text":"Is there a way I can count the size of an associated collection without initializing?\ne.g.\n`Select count(p.children) from Parent p`\n(there is a good reason why I cant do this any other way as m...
{"title":"what's design pattern principle in the Android development?","tags":["android","design","design-patterns"],"question_text":"I was a JaveEE developer. Recently I joined an Android development team. The structure of Android confused me. The MVC design pattern doesn't seem to suit for Android development. So wha...
{"title":"Most suitable python library for Github API v3","tags":["python","api","github"],"question_text":"I am looking for a python library for the Github APIv3 suitable for me. \nBackground: I am a python noob with a background primarily rooted in Matlab and C++, and have recently learned to use python-matplotlib.\n...
{"title":"iPhone and OpenCV","tags":["iphone","opencv"],"question_text":"I know that\nOpenCV was ported to Mac OS X\n, however I did not find any info about a port to the iPhone.\nI am not a Mac developer, so that I do not know whether a Mac OS X port is enough for the iPhone.\nDoes anyone know better than me?\nEdit: T...
{"title":"Upload large file in Android without outofmemory error","tags":["android","upload","out-of-memory"],"question_text":"My upload code as below:\n`String end = \"\\r\\n\";\nString twoHyphens = \"--\";\nString boundary = \"*****\";\ntry {\nURL url = new URL(ActionUrl);\nHttpURLConnection con = (HttpURLConnection)...
{"title":"What is the meaning of `auto` value in a CSS property.","tags":["css"],"question_text":"What is the meaning of\n`auto`\nvalue of a CSS property. What happens when value of a CSS property is set to\n`auto`\n?","answer_text":"The value of said property is adjusted\nautomatically\naccording to the content or the...
{"title":"Unexpected behavior of Substring in C#","tags":["c#",".net","string","substring","clr"],"question_text":"The definition of\n`Substring()`\nmethod in .net\n`System.String`\nclass is like this\n`public string Substring(int startIndex)`\nWhere\n`startIndex`\nis\n\"The zero-based starting character position of a ...
{"title":"Android - Keep ListView's item highlighted once one has been clicked","tags":["android","listview","android-listview","highlighting"],"question_text":"So I have an activity with 2\n`ListView`\nwidgets, when you select a value in the first one, the second is populated with values related to the selection in th...
{"title":"Python config parser to get all the values from a section?","tags":["python"],"question_text":"I want to get all the values from a section using config parser\nI used this but it gives only the first value\n`def ConfigSectionMap(section):\n dict1 = {}\n options = Config.options(section)\n for option in option...
{"title":"How to check if a class inherits another (without instanciating an object)?","tags":["javascript","class","inheritance"],"question_text":"`function A(){}\nfunction B(){}\nB.prototype = new A();`\nHow can I check if the class B inherits class A in Javascript ?\n(I would like to avoid instanciating B to use ins...
{"title":"how to generate web service out of wsdl","tags":["c#","wsdl","asmx"],"question_text":"I know this must be answered a lot of times but I didn't get the answer what I'm looking for.\nSo the client provided me the wsdl to generate the web service.But when I used the wsdl.exe command it generated the .cs class ou...
{"title":"Unable to format default MySQL datetime","tags":["javascript","mysql","angularjs","datetime"],"question_text":"My dates come out of the database looking like this:\n`2013-11-21 17:43:20`\nI'm trying to user Angular's date filter to turn them into something prettier, but...\n`{{Objected.created | date:'shortDa...
{"title":"How to open new doc tab labels on the right side in Visual Studio?","tags":["visual-studio"],"question_text":"When I open a new doc, its tab label appears on the left side of the bar. How can I make it appear on the right?","answer_text":"For\nVisual Studio 2012, 2013 and later\n, this setting has moved to th...
{"title":"How to check if a date Object equals yesterday?","tags":["java","date","calendar","java-time"],"question_text":"Right now I am using this code\n`Calendar cal = Calendar.getInstance();\nSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\");\ncal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.ge...
{"title":"Create if an entry doesn't exist, otherwise update?","tags":["php","mysql"],"question_text":"Kinda strange to put it into words that short, heh.\nAnyway, what I want is basically to update an entry in a table if it does exist, otherwise to create a new one filling it with the same data.\nI know that's easy, b...
{"title":"Difference between onload() and $.ready?","tags":["javascript","jquery","onload"],"question_text":"Can you list the difference between\n`onload()`\nand\n`$(document).ready(function(){..})`\nfunctions in the using jQuery?","answer_text":"the\n`load`\nevent (a.k.a \"onload\") on the window and\/or body element ...
{"title":"How can you add query parameters in the ZF2 url view helper","tags":["php","zend-framework2","zend-framework-routing"],"question_text":"I'm attempting to create a url with a query string using a route, like so:\n`$this->url('users') -> \/users\n$this->url('users', ['sort' => 'desc']) -> \/users?sort=desc`\nHo...
{"title":"Testing Paypal subscription IPN","tags":["paypal","paypal-subscriptions","paypal-sandbox"],"question_text":"I'd like to test paypal subscription IPNs, both the ones received when a subscription is created, and the ones sent later with the next payment (such as monthly if the subscription is $x per month).\nHo...
{"title":"Why was the constructor interface of std::vector changed with C++11?","tags":["c++","c++11"],"question_text":"Why was the default argument removed with the new standard? Often I constructed a vector variable like this:\n`std::vector<my_pod_struct> buf(100)`\n. I guess I would get an compiler error with a C++1...
{"title":"Determine which w3wp.exe process belongs to which App Pool in Windows 7 \/ IIS7.5?","tags":[".net","asp.net","iis-7","windows-7",".net-2.0"],"question_text":"I've recently upgraded my development machine from Windows XP to Windows 7. How can I tell which w3wp.exe process belongs to which App Pool on a desktop...
{"title":"How to assert on number of html table rows in ruby using capybara + cucumber","tags":["ruby","cucumber","bdd","capybara"],"question_text":"I am trying to get to grips with BDD web development in Ruby using cucumber + capybara and I am stuck at what should be an easy task - just to check the number of rows in ...
{"title":"What is the Cost of Calling array.length","tags":["java","arrays","premature-optimization"],"question_text":"While updating for loops to for-each loops in our application, I came across a lot of these \"patterns\":\n`for (int i = 0, n = a.length; i < n; i++) {\n ...\n}`\ninstead of\n`for (int i = 0; i < a.len...
{"title":"Why does \"hello\" + + '\/' + \"world\" == \"hello47world\"?","tags":["c#",".net","visual-studio"],"question_text":"For this C#,\n`a==true`\n:\n`bool a = \"hello\" + '\/' + \"world\" == \"hello\/world\";`\nAnd for this C#,\n`b==true`\n:\n`bool b = \"hello\" + + '\/' + \"world\" == \"hello47world\";`\nI'm wond...
{"title":"Impersonate tag in Web.Config in ASP.NET","tags":["asp.net","web-config","impersonation"],"question_text":"I'm using\n`impersonate`\ntag in my web.config in Asp.net 4.0 website.\nBelow is my Web.Config code:\n`<system.web>\n <authentication mode=\"Windows\">\n <identity impersonate=\"true\" \n userName=\"Admi...
{"title":"Why do round() and ceil() not return an integer?","tags":["c++","c","casting","rounding"],"question_text":"Once in a while, I find myself rounding some numbers, and I always have to cast the result to an integer:\n`int rounded = (int) floor(value);`\nWhy do all rounding functions (\n`ceil()`\n,\n`floor()`\n) ...
{"title":"How to pass an array as a parameter to another script?","tags":["arrays","powershell","parameters","arguments"],"question_text":"For some reason, it looks like I cannot pass array of strings as parameter to scriptblock. What am I doing here wrong?\nMy script which is called from another script:\n`param(\n [pa...
{"title":"Are ActionFilterAttributes reused across threads? How does that work?","tags":["asp.net-mvc"],"question_text":"I have been doing some testing with the following code to try and workout how ActionFilterAttributes work:\n`public class TestAttribute : ActionFilterAttribute\n{\n private string _privateValue;\n pu...
{"title":"Using a private class in place of a field - performance\/memory penalty?","tags":["c#",".net"],"question_text":"I'm reviewing someone's code and came across this private class:\n`class CustomType : Dictionary<int, SomeOtherCustomType>\n{\n \/\/ This is empty; nothing omitted here\n}`\nCustomType is then used ...
{"title":"The inverse Fibonacci algorithm?","tags":["algorithm","math","fibonacci"],"question_text":"There are dozens of ways of computing F(n) for an arbitrary n, many of which have great runtime and memory usage.\nHowever, suppose I wanted to ask the opposite question:\nGiven F(n) for n > 2, what is n?\n(The n > 2 re...
{"title":"How can I install a CPAN module into a local directory?","tags":["perl","install","cpan"],"question_text":"I'm using a hosted Linux machine so I don't have permissions to write\ninto the\n`\/usr\/lib`\ndirectory.\nWhen I try to install a CPAN module by doing the usual:\n`perl Makefile.PL\nmake test\nmake inst...
{"title":"Near-Duplicate Image Detection","tags":["image","image-processing","sorting","cbir"],"question_text":"What's a fast way to sort a given set of images by their similarity to each other.\nAt the moment I have a system that does histogram analysis between two images, but this is a very expensive operation and se...
{"title":"RabbitMQ command doesn't exist?","tags":["osx","rabbitmq"],"question_text":"OS: Mac OSX 10.9\nI have\n`rabbitmq`\ninstalled via home brew and when I go to\n`\/usr\/local\/sbin`\nand run\n`rabbitmq-server`\nit states that:\n`rabbitmq-server: command not found`\neven as sudo it states the same error.\nHow do I ...
{"title":"Gson Array of Strings to JsonArray","tags":["java","json","gson"],"question_text":"I'm using Gson and am trying to add a bunch of string values into a\n`JsonArray`\nlike this:\n`JsonArray jArray = new JsonArray();\njArray.add(\"value1\");`\nThe problem is that the add method only takes a\n`JsonElement`\n.\nI'...
{"title":"How to set value in @Html.TextBoxFor in Razor syntax?","tags":[".net","asp.net-mvc","asp.net-mvc-3","razor","html.textboxfor"],"question_text":"I have created an text-box using Razor and trying to set\n`value`\nas follows.\n`@Html.TextBoxFor(model => model.Destination, new { id = \"txtPlace\", value= \"3\" })...
{"title":"Best way to completely destroy a session - even if the browser is not closed","tags":["php"],"question_text":"Is it enough to\n`session_start(); \/\/ Must start a session before destroying it\nif (isset($_SESSION))\n{\n unset($_SESSION);\n session_unset();\n session_destroy();\n}`\nwhen the user selects\n`Log...
{"title":"How to use view flipper with three layouts?","tags":["android","layout","view","android-activity"],"question_text":"I am currently using\n`ViewFlipper`\nfor my main activity with two different layouts. I want to use a third layout, but I can only find the\n`showNext()`\nand\n`showPrevious()`\ncommands. Can so...
{"title":"Most vexing parse: why doesn't A a(()); work?","tags":["c++"],"question_text":"Among the many things Stack Overflow has taught me is what is known as the \"most vexing parse\", which is classically demonstrated with a line such as\n`A a(B()); \/\/declares a function`\nWhile this, for most, intuitively appears...
{"title":"Open external links in the browser with android webview","tags":["android","browser","webview","hyperlink","external"],"question_text":"I have this code, but not because it works, it keeps opening in webview and what I want is that the links do not belong to my website open in your default browser. Any idea? ...
{"title":"PHP : how can use curl instead file_get_contents","tags":["php","curl","file-get-contents"],"question_text":"I use\n`file_get_contents`\nfunction to get and show external link on my specific page.\nIn local everything is OK but my server doesn't support\n`file_get_contents`\nfunction.\nI try to use cURL with ...
{"title":"Correct Apache AddType directives for font MIME types","tags":["apache","fonts","mime","woff","eot"],"question_text":"I\u00e2\u0080\u0099m using @font-face for embedded fonts (thanks\nPaul Irish\n). In trying to fix Chrome\u00e2\u0080\u0099s warning about wrong MIME type for woff fonts, I\u00e2\u0080\u0099ve ...
{"title":"Connection to Db dies after >4<24 in spring-boot jpa hibernate","tags":["java","mysql","jpa","spring-boot"],"question_text":"I have an app that uses spring-boot,jpa-hiberanate with mysql.I am getting this error log\n`Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfu...
{"title":"No newline after div?","tags":["html","css-float","newline"],"question_text":"Is there a way to not have a newline inserted before a\n`div`\nwithout using\n`float: left`\non the previous element?\nMaybe some tag on the\n`div`\nthat will just put it to the right?","answer_text":"There is no\nnewline\n, just th...
{"title":"Use jQuery\/JS to determine the DAY OF WEEK","tags":["javascript","jquery","date"],"question_text":"Is there a method using either JavaScript or jQuery to determine what day of the week it is? For instance, if the date a user picks in the box is a Sunday, I can alert them.\nThanks","answer_text":"`new Date()....
{"title":"How does Lucene work","tags":["lucene"],"question_text":"I would like to find out how lucene search works so fast. I can't find any useful docs on the web. If you have anything (short of lucene source code) to read, let me know.\nA text search query using mysql5 text search with index takes about 18 minutes i...
{"title":"Using Magento Methods to write Insert Queries with care for SQL Injection","tags":["magento","sql-injection"],"question_text":"I am using the Magento's functionality to insert & update queries. My requirement is that I want to take care of SQL Injection, when doing these types of queries. But I'm unable to fi...
{"title":"How to Break from main\/outer loop in a double\/nested loop?","tags":["java","loops","syntax","for-loop","break"],"question_text":"If I have loop in a loop and once if statement is satisfied I want to break main loop, how am I supposed to do that?\nThis is my code:\n`for(int d = 0; d < amountOfNeighbors; d++)...
{"title":"Naming conventions for abstract classes","tags":[".net","naming-conventions","abstract-class"],"question_text":"I distinctly remember that, at one time, the guideline pushed by Microsoft was to add the \"Base\" suffix to an abstract class to obviate the fact that it was abstract. Hence, we have classes like\n...
{"title":"How to create a link inside a cell using EPPlus","tags":["c#","excel","epplus"],"question_text":"I am trying to figure out how to write a Hyperlink inside a cell using EPPlus instead of the cell containing the link text. I need it to be recognized as a link and be clickable.\nAny help is appreciated.","answer...
{"title":"git blame with commit details in emacs","tags":["git","emacs","magit"],"question_text":"From emacs, how can I see the details (e.g. commit message) of the commit that last changed the line at point?\nI have magit installed.","answer_text":"It is not necessary to use magit for this particular operation - vanil...
{"title":"How to add an \"entry point arrow\" to a tab bar controller?","tags":["ios","xcode","interface-builder"],"question_text":"In Xcode 6.2 beta, I am able to make some view controllers such as \"View Controller\" or \"Navigation view controller\" the entry point of my interface by dragging and dropping the \"entr...
{"title":"Entity Framework code-first: migration fails with update-database, forces unneccessary(?) add-migration","tags":["entity-framework","code-first-migrations"],"question_text":"I have a funny effect using migration (EF 5.0) and code-first:\nI created some models with GUID primary keys. (BTW: It is important for ...
{"title":"WSGI vs uWSGi with Nginx","tags":["python","django","nginx","wsgi","uwsgi"],"question_text":"Could anyone please explain pros\/cons when using\nWSGI\nVS\nuWSGI\nwith Nginx.\nCurrently i am building up a production server for the Django website which i have prepared but unable to decide whether should i go wit...
{"title":"GCC -g vs -g3 GDB Flag: What is the Difference?","tags":["c","debugging","gcc","gdb","clang"],"question_text":"When compiling C source code with either gcc or Clang, I always use the\n`-g`\nflag to generate debugging information for gdb.\n`gcc -g -o helloworld helloworld.c`\nI noticed that some people recomme...
{"title":"Table with 100% width with equal size columns. (a variable name)","tags":["html","css"],"question_text":"first of all I am not quite good at web design.\nI have to dynamically create a table with a variable number of columns, determined at runtime.\nCan somebody tell me if it's possible to have a html table w...
{"title":"undefined local variable or method `json' in JBuilder","tags":["ruby-on-rails","json","jbuilder"],"question_text":"When I try get all categories (index action) there is an error:\n`undefined local variable or method `json'`\nBut in show action everything fine. All files has .jbuilder extension.\nHere is contr...
{"title":"How to catch duplicates entries in text file in linux","tags":["linux","grep"],"question_text":"Text file:\n1 1\n2 2\n3 3\n1 1\nI want to catch global like\n`1 1`\nare dublicated now of one row or another","answer_text":"Your question is not quite clear, but you can\nfilter out duplicate lines\nwith\n`uniq`\n...
{"title":"Error: invalid_client no registered origin","tags":["google-api","oauth-2.0","google-drive-sdk","google-drive-realtime-api"],"question_text":"I have installed the Google Drive Realtime API sample files on my web server, following\nthese instructions\n, including generating a client_id in the Cloud Console and...
{"title":"UITableView titleForHeaderInSection shows all caps","tags":["objective-c","uitableview","header","capitalization"],"question_text":"I am using titleForHeaderInSection to show a header for a UITableView section. It worked fine with the iOS6 SDK, but the iOS7 SDK shows the header in all CAPS.\nI guess it's part...
{"title":"How to use PrintWriter and File classes in Java?","tags":["java","printwriter"],"question_text":"I am trying to understand PrintWriter for a small program I'm making, and I cant seem to get java to make the file and then write on it. When I execute the program below it gives me a Filenotfoundexeption error on...
{"title":"How to get UTC time in Python?","tags":["python","datetime"],"question_text":"I've search a bunch on StackExchange for a solution but nothing does quite what I need. In JavaScript, I'm using the following to calculate UTC time since Jan 1st 1970:\n`function UtcNow() {\n var now = new Date();\n var utc = Date....
{"title":"How to Create Grid\/Tile View with CSS?","tags":["css","grid","positioning","css-float","tiles"],"question_text":"For example, I have some class .article, and I want to view this class as grid view. So I applied this style:\n`.article{\n width:100px;\n height:100px;\n background:#333;\n float:left;\n margin:5...
{"title":"Which dialect of Lisp should I learn?","tags":["lisp","dialect"],"question_text":"I know there are a few different dialects of Lisp. Having decided that learning Lisp would be a new intellectual experience, I would like to know which Lisp dialect to learn, and why.\nIs there one which is more popular than the...
{"title":"The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range?","tags":["sql","silverlight","sql-server-2008","silverlight-4.0"],"question_text":"I am working on application contains a datepicker and if I set the time in that picker to a very old value or far in the future when I...
{"title":"C#: Why is a function call faster than manual inlining?","tags":["c#","performance","release","inline","inline-code"],"question_text":"I have measured the execution time for two ways of calculating the power of 2:\n1) Inline\n`result = b * b;`\n2) With a simple function call\n`result = Power(b);`\nWhen runnin...
{"title":"Java image resize, maintain aspect ratio","tags":["java","image","rescale"],"question_text":"I have an image which I resize:\n`if((width != null) || (height != null))\n{\n try{\n \/\/ scale image on disk\n BufferedImage originalImage = ImageIO.read(file);\n int type = originalImage.getType() == 0? BufferedIma...
{"title":"Function composition in Clojure?","tags":["clojure"],"question_text":"Can Clojure implement (g \u00e2\u0088\u0098 f) constructions like Haskell's\n`g . f`\n? I'm currently using workarounds like\n`(fn [n] (not (zero? n)))`\n, which isn't nearly as nice :)","answer_text":"There is a function to do this in\n`cl...
{"title":"Which maximum does Python pick in the case of a tie?","tags":["python","max"],"question_text":"When using the\n`max()`\nfunction in Python to find the maximum value in a list (or tuple, dict etc.) and there is a tie for maximum value, which one does Python pick? Is it random?\nThis is relevant if, for instanc...
{"title":"GZipStream or DeflateStream class?","tags":["c#",".net","compression"],"question_text":"The MSDN documentation tells me the following:\nThe GZipStream class uses the gzip\n data format, which includes a cyclic\n redundancy check value for detecting\n data corruption. The gzip data format\n uses the same compr...
{"title":"Hibernate, List<String>","tags":["java","string","hibernate","list","annotations"],"question_text":"I seem to have problems with mapping a List in Hibernate. In our project there a class\n`Card`\nwith contains a class\n`Answer`\nwith\n`Answer`\ncontaining a\n`List<String>`\n.\nIs a\n`List<String>`\nmappable b...
{"title":"problem on starting cassandra","tags":["java","cassandra"],"question_text":"I download apache-cassandra-0.8.5 for ubuntu and extract it.I read the readme file.\nI try bellow command in shell:\n`bin\/cassandra -f`\nBut it said:\nError: Exception thrown by the agent : java.net.MalformedURLException: Local host ...
{"title":"CSS Filter not working in Firefox","tags":["html","css","css3"],"question_text":"I am trying CSS filter but it does not work in my Firefox (15.0) browser.\nHTML:\n`<div class=\"google\">\n <img src=\"https:\/\/www.google.com\/images\/srpr\/logo3w.png\">\n<\/div>`\nCSS:\n`.google{ \n -moz-filter: grayscale(100...
{"title":"How can I find the amount of seconds passed from the midnight with Java?","tags":["java","time"],"question_text":"I need a function that gives me how many seconds passed from the midnight. I am currently using\n`System.currentTimeMillis()`\nbut it gives me the UNIX like timestamp.\nIt would be a bonus for me ...
{"title":"Print array without brackets and commas","tags":["java","android","arrays","list"],"question_text":"I have previously written a Hangman game for my java class in school. I am now currently porting it to Android and have met a few problems. The original java program wrote all outputs to the console. Now i have...
{"title":"How can I pass arguments to anonymous functions in JavaScript?","tags":["javascript","jquery"],"question_text":"I'm trying to figure out how to pass arguments to an anonymous function in JavaScript.\nCheck out this sample code and I think you will see what I mean:\n`<input type=\"button\" value=\"Click me\" i...
{"title":"Change visual studio caret color","tags":["visual-studio-2012"],"question_text":"I am trying the new Visual Studio 2012 dark theme. When moving the mouse of code I cannot see the cursor, since the code background is black and the mouse cursor is black.\nHow to change the mouse cursor in code files to be white...
{"title":"MSBuild on CI Server can't find AL.exe","tags":["winapi",".net-4.0","msbuild","teamcity"],"question_text":"I'm having a problem on my TeamCity CI build server where during compilation I get the following error:\nC:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\Microsoft.Common.targets(2342, 9): error MSB308...