Interfaces — What's the point?
The reason for interfaces truly eludes me. From what I understand, it is kind of a work around for the non-existent multi-inheritance which doesn't exist in C# (or so I was told). All I see is, you p...
Switch statement for greater-than/less-than
so I want to use a switch statement like this: ``` switch (scrollLeft) { case (<1000): //do stuff break; case (>1000 && <2000): //do stuff break; } ``` Now I know that either of tho...
- Modified
- 12 Feb at 08:44
Reflection - get attribute name and value on property
I have a class, lets call it Book with a property called Name. With that property, I have an attribute associated with it. ``` public class Book { [Author("AuthorName")] public string Name ...
- Modified
- 9 Jul at 21:45
Adding attribute in jQuery
How can I add an attribute into specific HTML tags in jQuery? For example, like this simple HTML: ``` <input id="someid" /> ``` Then adding an attribute disabled="true" like this: ``` <input id="...
Can I use multiple "with"?
Just for example: ``` With DependencedIncidents AS ( SELECT INC.[RecTime],INC.[SQL] AS [str] FROM ( SELECT A.[RecTime] As [RecTime],X.[SQL] As [SQL] FROM [EventView] AS A CRO...
- Modified
- 13 Dec at 22:35
Autocompletion in Vim
I'm having trouble with autocompletion. How can I get a code suggestion while I'm typing? I usually develop in PHP, Ruby, HTML, C and CSS.
- Modified
- 20 Jul at 00:33
Generating a SHA-256 hash from the Linux command line
I know the string "foobar" generates the SHA-256 hash `c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2` using [http://hash.online-convert.com/sha256-generator](http://hash.online-conv...
How to get the function name from within that function?
How can I access a function name from inside that function? ``` // parasitic inheritance var ns.parent.child = function() { var parent = new ns.parent(); parent.newFunc = function() { } re...
- Modified
- 20 Jul at 21:46
Are parameters in strings.xml possible?
In my Android app I'am going to implement my strings with internationalization. I have a problem with the grammar and the way sentences build in different languages. For example: > "5 minutes ago" - E...
- Modified
- 20 Jun at 09:12
What resources are shared between threads?
Recently, I have been asked a question in an interview what's the difference between a process and a thread. Really, I did not know the answer. I thought for a minute and gave a very weird answer. T...
- Modified
- 6 Jul at 07:34
SELECT DISTINCT on one column
Using SQL Server, I have... ``` ID SKU PRODUCT ======================= 1 FOO-23 Orange 2 BAR-23 Orange 3 FOO-24 Apple 4 FOO-25 Orange ``` I want ``` 1 FOO-23 Orange 3 FOO-24...
- Modified
- 1 Apr at 17:53
Comparison of full text search engine - Lucene, Sphinx, Postgresql, MySQL?
I'm building a Django site and I am looking for a search engine. A few candidates: - Lucene/Lucene with Compass/Solr- Sphinx- Postgresql built-in full text search- MySQl built-in full text search S...
- Modified
- 16 Dec at 20:53
How do I list loaded plugins in Vim?
Does anybody know of a way to list up the "loaded plugins" in ? I know I should be keeping track of this kind of stuff myself but it would always be nice to be able to check the current status.
await is only valid in async function
I wrote this code in `lib/helper.js`: ``` var myfunction = async function(x,y) { .... return [variableA, variableB] } exports.myfunction = myfunction; ``` Then I tried to use it in another file...
- Modified
- 9 Jul at 11:37
Generate a UUID on iOS from Swift
In my iOS Swift app I want to generate random UUID () strings for use as a table key, and this snippet to work: ``` let uuid = CFUUIDCreateString(nil, CFUUIDCreate(nil)) ``` Is this safe? Or is ...
- Modified
- 25 Apr at 19:40
Get form data in React
I have a simple form in my `render` function, like so: ``` render : function() { return ( <form> <input type="text" name="email" placeholder="Email" /> <input type="p...
- Modified
- 14 Feb at 02:19
When should I use a table variable vs temporary table in sql server?
I'm learning more details in table variable. It says that temp tables are always on disk, and table variables are in memory, that is to say, the performance of table variable is better than temp table...
- Modified
- 21 Jan at 10:15
Is Python strongly typed?
I've come across links that say Python is a strongly typed language. However, I thought in strongly typed languages you couldn't do this: ``` bob = 1 bob = "bob" ``` I thought a strongly typed lan...
- Modified
- 15 Jun at 02:7
How can I repeat a character in Bash?
How could I do this with `echo`? ``` perl -E 'say "=" x 100' ```
What is the default value for enum variable?
An enum variable, anyone know if it is always defaulting to the first element?
Convert array of integers to comma-separated string
It's a simple question; I am a newbie in C#, how can I perform the following - I have ``` int[] arr = new int[5] {1,2,3,4,5}; ``` I want to convert it to one string ``` string => "1,2,3,4,5" `...
How do I use the conditional operator (? :) in Ruby?
How is the conditional operator (`? :`) used in Ruby? For example, is this correct? ``` <% question = question.size > 20 ? question.question.slice(0, 20)+"..." : question.question %> ```
- Modified
- 5 May at 13:15
How to use java.String.format in Scala?
I am trying to use a `.format` method of a string. But if I place %1, %2, etc. in the string, java.util.UnknownFormatConversionException is thrown pointing to a confusing Java source code piece: ``` ...
Getting "type or namespace name could not be found" but everything seems ok?
I'm getting a: > type or namespace name could not be found error for a C# WPF app in VS2010. This area of code was compiling fine, but suddenly I'm getting this error. I've tried removing the Projec...
- Modified
- 22 Jun at 13:11
'setInterval' vs 'setTimeout'
What is the main difference between [setInterval](https://developer.mozilla.org/En/window.setInterval) and [setTimeout](https://developer.mozilla.org/en/window.setTimeout) in JavaScript?
- Modified
- 16 Aug at 18:57