Questions

Question mark and colon in JavaScript

I came across the following line ``` hsb.s = max != 0 ? 255 * delta / max : 0; ``` What do the `?` and `:` mean in this context?

Regular expression to limit number of characters to 10

I am trying to write a [regular expression](http://en.wikipedia.org/wiki/Regular_expression) that will only allow lowercase letters and up to 10 characters. What I have so far looks like this: ``` pa...

24 Nov at 14:41

jQuery remove options from select

I have a page with 5 selects that all have a class name 'ct'. I need to remove the option with a value of 'X' from each select while running an onclick event. My code is: ``` $(".ct").each(function()...

16 Jan at 17:25

Efficient Algorithm for Bit Reversal (from MSB->LSB to LSB->MSB) in C

What is the most efficient algorithm to achieve the following: `0010 0000 => 0000 0100` The conversion is from MSB->LSB to LSB->MSB. All bits must be reversed; that is, this is endianness-swapping...

29 Jan at 03:53

Finalize vs Dispose

Why do some people use the `Finalize` method over the `Dispose` method? In what situations would you use the `Finalize` method over the `Dispose` method and vice versa?

23 Nov at 04:33

ASP.NET MVC JsonResult Date Format

I have a controller action that effectively simply returns a JsonResult of my model. So, in my method I have something like the following: ``` return new JsonResult(myModel); ``` This works well, e...

13 Mar at 07:18

How would I get a cron job to run every 30 minutes?

I'm looking to add a `crontab` entry to execute a script every 30 minutes, on the hour and 30 minutes past the hour or something close. I have the following, but it doesn't seem to run on 0. ``` */30...

26 May at 16:45

Is there any significant difference between using if/else and switch-case in C#?

What is the benefit/downside to using a `switch` statement vs. an `if/else` in C#. I can't imagine there being that big of a difference, other than maybe the look of your code. Is there any reason wh...

20 Jun at 09:12

How do you remove Subversion control for a folder?

I have a folder, `c:\websites\test`, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of th...

24 Feb at 13:14

Can I set a breakpoint on 'memory access' in GDB?

I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in othe...

What's the difference between markForCheck() and detectChanges()

What is the difference between `ChangeDetectorRef.markForCheck()` and `ChangeDetectorRef.detectChanges()`? I only [found information on SO](https://stackoverflow.com/a/37643737/1267778) as to the dif...

26 Jun at 21:18

ffmpeg overwrite output file if exists

I ran: ``` ffmpeg -i input.flac output.mp3 ``` This prompts: > File 'output.mp3' already exists. Overwrite? [y/N] y How do I automatically say "yes"?

14 Jul at 20:30

How to pass arguments to entrypoint in docker-compose.yml

I use this image: dperson/samba The image is defining its own entrypoint and I do not want to override it. I need to pass arguments to the entrypoint, easy with docker only: ``` docker run ... dperson...

15 Jan at 17:35

Angular2 @Input to a property with get/set

I have an Angular2 component in that component it currently has a bunch fields that have @Input() applied before them to allow binding to that property, i.e. ``` @Input() allowDay: boolean; ``` Wha...

13 Mar at 10:29

What does ${} (dollar sign and curly braces) mean in a string in JavaScript?

I haven't seen anything here or on MDN. I'm sure I'm just missing something. There's got to be some documentation on this somewhere. Functionally, it looks like it allows you to nest a variable inside...

How to use moment.js library in angular 2 typescript app?

I tried to use it with typescript bindings: ``` npm install moment --save typings install moment --ambient -- save ``` test.ts: ``` import {moment} from 'moment/moment'; ``` And without: ``` np...

3 Feb at 00:4

How to remove provisioning profiles from Xcode

Does anyone know how to remove previously installed provisioning profiles from Xcode? I have seen [this link](https://stackoverflow.com/questions/922695/removing-provisioning-profile-from-xcode), but...

How to connect to LocalDB in Visual Studio Server Explorer?

I can't believe I couldn't find a working solution to this after an hour of searching. I'm following [this article](http://www.dotnetcurry.com/showarticle.aspx?ID=941) on Entity Framework 6.0 which gi...

Check Redis server version

I've found in [Redis site](http://redis.io/topics/quickstart) this command: > $ redis-server and that should give me (according to the site): ``` [28550] 01 Aug 19:29:28 # Warning: no config file spe...

17 Feb at 23:10

php stdClass to array

I have a problem to convert an object stdClass to array. I have tried in this way: ``` return (array) $booking; ``` or ``` return (array) json_decode($booking,true); ``` or ``` return (array) j...

21 Nov at 07:50

AngularJS ng-class if-else expression

With `AngularJS` I'm using `ng-class` the following way: ``` <div class="bigIcon" data-ng-click="PickUp()" ng-class="{first:'classA', second:'classB', third:'classC', fourth:'classC'}[call.State]"/>...

15 Mar at 01:41

SQL JOIN and different types of JOINs

What is a SQL `JOIN` and what are different types?

22 Feb at 13:58

Laravel 4: how to "order by" using Eloquent ORM

Simple question - how do I order by 'id' descending in Laravel 4. The relevant part of my controller looks like this: ``` $posts = $this->post->all() ``` As I understand you use this line: ``` ->...

9 Jul at 16:13

How is attr_accessible used in Rails 4?

`attr_accessible` seems to no longer work within my model. What is the way to allow mass assignment in Rails 4?

18 Nov at 06:54

Regular expression to allow spaces between words

I want a regular expression that prevents symbols and only allows letters and numbers. The regex below works great, but it doesn't allow for spaces between words. ``` ^[a-zA-Z0-9_]*$ ``` For exampl...

20 Apr at 11:20