What is a good pattern for using a Global Mutex in C#?

What is a good pattern for using a Global Mutex in C#?

The Mutex class is very misunderstood, and Global mutexes even more so.What is good, safe pattern to use when creating Global mutexes?One that will workRegardless of the locale my machine is inIs guaranteed to release the mutex properlyOpti

Handle file download from ajax post

Handle file download from ajax post

I have a javascript app that sends ajax POST requests to a certain URL. Response might be a JSON string or it might be a file (as an attachment). I can easily detect Content-Type and Content-Disposition in my ajax call, but once I detect th

How can I develop for iPhone using a Windows development machine?

How can I develop for iPhone using a Windows development machine?

Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?The only other way I can think of doing this is to run a Mac VM image on a VMWare server running on Windows, although

Reference — frequently asked questions about PDO

Reference — frequently asked questions about PDO

What is this?This is a list of frequently asked questions regarding PHP Data Objects Why is this?As PDO has some features unknown to a regular PHP user, questions regarding prepared statements and error handling in PDO are quite frequent. S

What is a debugger and how can it help me diagnose problems?

What is a debugger and how can it help me diagnose problems?

This is intended to be a general purpose question to assist new programmers who have a problem with a program, but do not know how to use a debugger to diagnose the cause of the problem.This question covers two classes of more specific ques

How can I upload files asynchronously?

How can I upload files asynchronously?

I would like to upload a file asynchronously with jQuery. This is my HTML:FileAnd here my Jquery code:$(document).ready(

AngularJS set button text based on condition in ng-repeat

AngularJS set button text based on condition in ng-repeat

I'm trying to learn Angular by converting a piece of working jQuery/AJAX code. It's an activity viewer inside a table that basically displays a message with a button to 'Mark Read' or 'Mark Unread' based on the condition. I'm having trouble

AngularJS: Set the model to be = {} again doesn't clear out input type='url'

AngularJS: Set the model to be = {} again doesn't clear out input type='url'

I have a fiddler setup, when i click a reset button it should clear out the input controls, this seems to work but not when the input type='url'Here is the fiddlerIs there an issue or something that I am not understanding.When I set $scope.

UIButton - On touch change image

UIButton - On touch change image

When I touch the button at that time I want to change image & when i release the touch button image is as it is.I want to apply below code but it's not with my expectation.please give me any suggestion..... -(IBAction)actionEnter:(id)send

rails + carrierwave + fog + S3 socket error

rails + carrierwave + fog + S3 socket error

I'm having this problem trying to use S3 services with fog and the Jquery File Upload (https://github.com/blueimp/jQuery-File-Upload)The error Excon::Errors::SocketError (getaddrinfo: nodename nor servname provided, or not known (SocketErro

Switching from Eclipse to IntelliJ: Is there a way to split tool windows?

Switching from Eclipse to IntelliJ: Is there a way to split tool windows?

Having used Eclipse for more years than I care to admit, I'm currently trying to get adjusted to IntelliJ 12 but I'm having a hard time with the totally different UI metaphors/concepts. I'd like to be able to have a window layout like this:

Black area on UIWebView during load

Black area on UIWebView during load

I noticed that my UITabBar gets a dark-gray color when I preform loadRequest in my UIWebView.If I scroll my WebView during loadRequest there is a black area How can I remove this? 1:I've had this problem before, and it's related to the

Override save_model on Django InlineModelAdmin

Override save_model on Django InlineModelAdmin

I have a model that has a user field that needs to be auto-populated from the currently logged in user. I can get it working as specified here if the user field is in a standard ModalAdmin, but if the model I'm working with is in an InlineM

Java -classpath option

Java -classpath option

Will the use of -classpath option with java, add to or replace the contents of the CLASSPATH env variable? 1:Using the classpath variable it overrides the CLASSPATH of Environment variable but only for that session. If you restart the ap

Body set to overflow-y:hidden but page is still scrollable in Chrome

Body set to overflow-y:hidden but page is still scrollable in Chrome

I'm having an issue with the overflow-y property in Chrome. Even though I've set it to hidden, I can still scroll the page with the mouse wheel.Here is my code:html,body { overflow-y: hidden;}#content { position: absolute; width: 100%;}.

What's the deal with [ComVisible] default and public classes COM exposure?

What's the deal with [ComVisible] default and public classes COM exposure?

MSDN has this article about [ComVisible] attribute. I don't quite get what happens when one sets [ComVisible(true)].MSDN says The default is true, which indicates that the managed type is visible to COM. This attribute is not needed to mak

SwiftyJSON object back to string

SwiftyJSON object back to string

I'm using the SwiftyJSON library to parse JSON into swift objects. I can create the JSON object and read and write to it// Create json object to represent libraryvar libraryObject = JSON(["name":"mylibrary","tasks":["Task1","Task2","Task3"]

Image rounded corners in QML

Image rounded corners in QML

To my surprise, the Image component has no radius property. I tried emulating the rounded corners by putting the image in a rounded Rectangle, but it does not clip the corners.Rectangle { anchors.right: rectContentBg.left anchors.top:

How does one declare the type of an Android preference?

How does one declare the type of an Android preference?

I have a preferences.xml that looks like this: When I do sp.getString("sample", "3.0"), it works fine and returns a string, but it shouldn't be a string, it should be a float. Running sp.getFloat("sample", 3.0f) throws a ClassCastException

MySQL operating hierarchical data

MySQL operating hierarchical data

I have MySQL table structure:CREATE TABLE IF NOT EXISTS `categories` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(10) unsigned NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL DEFAULT '', `is_working` tinyint(1) un

CardView elevation not working on Android 5.1.1

CardView elevation not working on Android 5.1.1

I am using CardView inside a RecyclerView.After reading a lot I ended up with following 'NOT WORKING' code only on Android 5.1.1. On Android Version prior to this one its working nice.

Conversion of SVG into PNG/JPEG/BMP and Vice Versa?

Conversion of SVG into PNG/JPEG/BMP and Vice Versa?

Code in PHP to convert SVG into Other Image Formats and opposite?? 1:Well, you'll probably want to use the ImageMagick or GD functions. But be aware that you can't convert from PNG/JPEG/BMP to SVG, that's a one-way street.Edit: Elaborati

Simple Horizontal Bar Graph using php

Simple Horizontal Bar Graph using php

I have seen a facebook application in which clicking on a radio button renders a graph.As you can see below:alt text http://img684.imageshack.us/img684/539/poll1.png alt text http://img694.imageshack.us/img694/3415/poll2.pngI wanted to know

How do I get a tabbed pane component in JSF 2.0 (Sun Mojarra)

How do I get a tabbed pane component in JSF 2.0 (Sun Mojarra)

I am learning/using JSF 2.0 (Sun Mojarra) now and I want to have a tabbed pane in my webapp (single tabs could named be General, Detail1,Detail2,...).How do I achieve this? I haven't found any documetation for this so far :( 1:Others hav

Encoding a screenshot into a video using FFMPEG

Encoding a screenshot into a video using FFMPEG

I'm trying to get the pixels from the screen, and encode the screenshot into a video using ffmpeg. I've seen a couple of examples but they either assume you already have the pixel data, or use image file input. It seems like whether I use s