Entity Framework VS LINQ to SQL VS ADO.NET with stored procedures?
How would you rate each of them in terms of: 1. Performance 2. Speed of development 3. Neat, intuitive, maintainable code 4. Flexibility 5. Overall I like my SQL and so have always been a die-har...
- Modified
- 23 Apr at 13:48
How do I read and parse an XML file in C#?
How do I read and parse an XML file in C#?
Rails: How can I set default values in ActiveRecord?
How can I set default value in ActiveRecord? I see a post from Pratik that describes an ugly, complicated chunk of code: [http://m.onkey.org/2007/7/24/how-to-set-default-values-in-your-model](http://...
- Modified
- 23 Jun at 15:4
Is there a constraint that restricts my generic method to numeric types?
Can anyone tell me if there is a way with generics to limit a generic type argument `T` to only: - `Int16`- `Int32`- `Int64`- `UInt16`- `UInt32`- `UInt64` I'm aware of the `where` keyword, but can't...
- Modified
- 16 Dec at 09:40
Typescript: Type 'string | undefined' is not assignable to type 'string'
When I make any property of an interface optional, and while assigning its member to some other variable like this: ``` interface Person { name?: string, age?: string, gender?: string, occupat...
- Modified
- 9 May at 12:24
Mac OS X and multiple Java versions
How can I install an additional java on MacOS? I installed jdk8 and that works fine. But now I need a jdk7 installation for development purposes. When trying to install the old version via DMG file, ...
- Modified
- 16 Aug at 12:19
What is the best way to test for an empty string in Go?
Which method is best (most idomatic) for testing non-empty strings (in Go)? ``` if len(mystring) > 0 { } ``` Or: ``` if mystring != "" { } ``` Or something else?
Git error: "Host Key Verification Failed" when connecting to remote repository
I am trying to connect to a remote Git repository that resides on my web server and clone it to my machine. I am using the following format for my command: ``` git clone ssh://username@domain.example/...
How is Math.Pow() implemented in .NET Framework?
I was looking for an efficient approach for calculating a (say `a = 2` and `b = 50`). To start things up, I decided to take a look at the implementation of `Math.Pow()` function. But in [.NET Reflecto...
Can constructors be async?
I have a project where I'm trying to populate some data in a constructor: ``` public class ViewModel { public ObservableCollection<TData> Data { get; set; } async public ViewModel() { ...
- Modified
- 14 Mar at 19:29
How to set custom validation messages for HTML forms?
I've got the following HTML form: [http://jsfiddle.net/nfgfP/](http://jsfiddle.net/nfgfP/) ``` <form id="form" onsubmit="return(login())"> <input name="username" placeholder="Username" required /> <in...
- Modified
- 21 Feb at 17:13
Get the key corresponding to the minimum value within a dictionary
If I have a Python dictionary, how do I get the key to the entry which contains the minimum value? I was thinking about something to do with the `min()` function... Given the input: ``` {320:1, 321...
- Modified
- 22 Apr at 14:21
How to delete a cookie?
Is my function of creating a cookie correct? How do I delete the cookie at the beginning of my program? is there a simple coding? ``` function createCookie(name,value,days) ``` ``` function setCo...
- Modified
- 6 Jul at 02:25
How do I run all Python unit tests in a directory?
I have a directory that contains my Python unit tests. Each unit test module is of the form . I am attempting to make a file called that will, you guessed it, run all files in the aforementioned test...
- Modified
- 5 Jan at 00:40
How to set a value to a file input in HTML?
How can I set the value of this? ``` <input type="file" /> ```
- Modified
- 18 Jun at 04:21
Passing a single item as IEnumerable<T>
Is there a common way to pass a single item of type `T` to a method which expects an `IEnumerable<T>` parameter? Language is C#, framework version 2.0. Currently I am using a helper method (it's .Ne...
- Modified
- 11 Sep at 07:6
Simplest/cleanest way to implement a singleton in JavaScript
What is the simplest/cleanest way to implement the [singleton pattern](https://en.wikipedia.org/wiki/Singleton_pattern) in JavaScript?
- Modified
- 19 Dec at 21:16
Get lengths of a list in a jinja2 template
How do I get the number of elements in a list in jinja2 template? For example, in Python: ``` print(template.render(products=[???])) ``` and in jinja2 ``` <span>You have {{what goes here?}} produ...
Stripping everything but alphanumeric chars from a string in Python
What is the best way to strip all non alphanumeric characters from a string, using Python? The solutions presented in the [PHP variant of this question](https://stackoverflow.com/questions/840948) wi...
- Modified
- 15 Jan at 05:1
Replace tabs with spaces in vim
I would like to convert tab to spaces in gVim. I added the following line to my `_vimrc`: ``` set tabstop=2 ``` It works to stop at two spaces but it still looks like one tab key is inserted (I tri...
Multiple Updates in MySQL
I know that you can insert multiple rows at once, is there a way to update multiple rows at once (as in, in one query) in MySQL? Edit: For example I have the following ``` Name id Col1 Col2 Row1...
- Modified
- 25 Jun at 20:3
Method List in Visual Studio Code
I've recently started using the Visual Studio Code editor. I'm really loving it, but there's one critical feature (for me) that I haven't been able to find. Is there a method list, similar to the Na...
- Modified
- 8 Jan at 13:29
How can I scroll up more (increase the scroll buffer) in iTerm2?
How can I scroll up more on iterm2 to get full output? At times, for example if I am doing unit tests, the errors are so large than I need to keep scrolling up to which I cannot scroll up anymore but ...
How to Copy Text to Clip Board in Android?
Can anybody please tell me how to copy the text present in a particular textview to clipboard when a button is pressed? ``` @Override protected void onCreate(Bundle savedInstanceState) { super.onC...
- Modified
- 14 Jul at 17:24