Using LINQ to concatenate strings
What is the most efficient way to write the old-school: ``` StringBuilder sb = new StringBuilder(); if (strings.Count > 0) { foreach (string s in strings) { sb.Append(s + ", "); }...
- Modified
- 3 Dec at 05:4
How to do Rounded Corners Image in Flutter
I am using Flutter to make a list of information about movies. Now I want the cover image on the left to be a rounded corners picture. I did the following, but it didn’t work. Thanks! ``` getItem(var...
- Modified
- 26 Dec at 09:37
NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'
When creating a new Angular 5 project: node version: 8.9.2 npm version: 5.5.1 My Command is: ``` npm install -g @angular/cli ``` The Error is: ``` npm ERR! **Unexpected end of JSON input while parsin...
- Modified
- 12 Jul at 08:43
Smart cast to 'Type' is impossible, because 'variable' is a mutable property that could have been changed by this time
And the Kotlin newbie asks, "why won't the following code compile?": ``` var left: Node? = null fun show() { if (left != null) { queue.add(left) // ERROR HERE } } ``` > Smart cas...
- Modified
- 23 Jul at 21:1
ps1 cannot be loaded because running scripts is disabled on this system
I try to run `powershell` script from c#. First i set the `ExecutionPolicy` to `Unrestricted` and the script is running now from `PowerShell ISE`. Now this is c# my code: ``` class Program { pr...
- Modified
- 13 Dec at 09:21
Left align and right align within div in Bootstrap
What are some of the common ways to left align some text and right align some other text within a div container in bootstrap? e.g. ``` Total cost $42 ``` Above total cost should ...
- Modified
- 19 Oct at 12:47
TypeScript Objects as Dictionary types as in C#
I have some JavaScript code that uses objects as dictionaries; for example a 'person' object will hold a some personal details keyed off the email address. ``` var people = {<email> : <'some personal...
- Modified
- 25 Nov at 15:22
Apache and Node.js on the Same Server
I want to use Node because it's swift, uses the same language I am using on the client side, and it's non-blocking by definition. But the guy who I hired to write the program for file handling (savin...
Pure JavaScript: a function like jQuery's isNumeric()
Is there is any function like `isNumeric` in pure JavaScript? I know jQuery has this function to check the integers.
- Modified
- 3 Jan at 20:34
What is the purpose of Android's <merge> tag in XML layouts?
I've read [Romain Guy's post](http://developer.android.com/training/improving-layouts/reusing-layouts.html) on the `<merge />` tag, but I still don't understand how it's useful. Is it a sort-of replac...
- Modified
- 18 Dec at 11:48
C++11 reverse range-based for-loop
Is there a container adapter that would reverse the direction of iterators so I can iterate over a container in reverse with range-based for-loop? With explicit iterators I would convert this: ``` f...
- Modified
- 29 Aug at 20:51
How do I check if a directory exists? "is_dir", "file_exists" or both?
I want to create a directory if it does not exist already. Is using the `is_dir` function enough for that purpose? ``` if ( !is_dir( $dir ) ) { mkdir( $dir ); } ``` Or should I combine `is...
- Modified
- 14 Jan at 23:46
How to Resize a Bitmap in Android?
I have a bitmap taken of a Base64 String from my remote database, (`encodedImage` is the string representing the image with Base64): ``` profileImage = (ImageView)findViewById(R.id.profileImage); by...
How can I check if a key exists in a dictionary?
Let's say I have an associative array like so: `{'key1': 22, 'key2': 42}`. How can I check if `key1` exists in the dictionary?
- Modified
- 20 Apr at 01:29
How do you properly determine the current script directory?
I would like to see what is the best way to determine the current script directory in Python. I discovered that, due to the many ways of calling Python code, it is hard to find a good solution. Here a...
- Modified
- 4 Sep at 01:29
Differences between git pull origin master & git pull origin/master
What is the difference between `git pull origin master` and `git pull origin/master` ?
- Modified
- 21 May at 17:11
Finding and replacing elements in a list
I have to search through a list and replace all occurrences of one element with another. So far my attempts in code are getting me nowhere, what is the best way to do this? For example, suppose my li...
Ruby: Calling class method from instance
In Ruby, how do you call a class method from one of that class's instances? Say I have ``` class Truck def self.default_make # Class method. "mac" end def initialize # Instance met...
- Modified
- 6 Jan at 07:29
How can I percent-encode URL parameters in Python?
If I do ``` url = "http://example.com?p=" + urllib.quote(query) ``` 1. It doesn't encode / to %2F (breaks OAuth normalization) 2. It doesn't handle Unicode (it throws an exception) Is there a bett...
Opacity of background-color, but not the text
How do I make the cross-browser (including Internet Explorer 6) transparency for the background of a `div` while the text remains opaque? I need to do it without using any library such as jQuery, etc...
Where do I find the current C or C++ standard documents?
For many questions the answer seems to be found in "the standard". However, where do we find that? Preferably online. Googling can sometimes feel futile, again especially for the C standards, since t...
How do you format code on save in VS Code
I would like to automatically format TypeScript code using the build-in formatter when I save a file in Visual Studio Code. I'm aware of the following options, but none of them is good enough: - `...
- Modified
- 9 Apr at 11:26
Difference between Amazon EC2 and AWS Elastic Beanstalk
What is the difference between EC2 and Beanstalk? I want to know regarding SaaS, PaaS and IaaS. To deploy a web application in Wordpress I need a scalable hosting service. If there anything better tha...
- Modified
- 6 May at 14:52
AngularJS access parent scope from child controller
I've set up my controllers using `data-ng-controller="xyzController as vm"` I have a scenario with parent / child nested controllers. I have no problem accessing parent properties in the nested html ...
- Modified
- 28 Dec at 06:47