How do I exit a WPF application programmatically?
How is one supposed to exit an application such as when the user clicks on the Exit menu item from the File menu? I have tried: ``` this.Dispose(); this.Exit(); Application.ShutDown(); Application.Exi...
Why is using a wild card with a Java import statement bad?
It is much more convenient and cleaner to use a single statement like ``` import java.awt.*; ``` than to import a bunch of individual classes ``` import java.awt.Panel; import java.awt.Graphics; i...
How do I run Visual Studio as an administrator by default?
I recently discovered that even while logged into my personal laptop as an administrator, Visual Studio does not run in administrator mode and you need to explicitly use . Is there a way to make it r...
- Modified
- 21 Jul at 22:31
How do I run git log to see changes only for a specific branch?
I have a local branch tracking the remote/master branch. After running `git-pull` and `git-log`, the log will show all commits in the remote tracking branch as well as the current branch. However, bec...
- Modified
- 24 Jul at 11:34
Typedef function pointer?
I'm learning how to dynamically load DLL's but what I don't understand is this line ``` typedef void (*FunctionFunc)(); ``` I have a few questions. If someone is able to answer them I would be grat...
How to define multiple CSS attributes in jQuery?
Is there any syntactical way in jQuery to define multiple CSS attributes without stringing everything out to the right like this: ``` $("#message").css("width", "550px").css("height", "300px").css("f...
Enum String Name from Value
I have an enum construct like this: ``` public enum EnumDisplayStatus { None = 1, Visible = 2, Hidden = 3, MarkedForDeletion = 4 } ``` In my database, the enumerations are refer...
Best way to reverse a string
I've just had to write a string reverse function in C# 2.0 (i.e. LINQ not available) and came up with this: ``` public string Reverse(string text) { char[] cArray = text.ToCharArray(); string...
- Modified
- 3 Mar at 22:18
The difference between the Runnable and Callable interfaces in Java
What is the difference between using the `Runnable` and `Callable` interfaces when designing a concurrent thread in Java, why would you choose one over the other?
- Modified
- 19 Sep at 11:33
How to list all functions in a module?
I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it. I want to call the `help` function on each one. In Ruby I can do someth...
- Modified
- 30 May at 18:3
How can I pass an argument to a PowerShell script?
There's a PowerShell script named `itunesForward.ps1` that makes iTunes fast forward 30 seconds: ``` $iTunes = New-Object -ComObject iTunes.Application if ($iTunes.playerstate -eq 1) { $iTunes.Play...
- Modified
- 11 Jul at 22:23
What is "stdafx.h" used for in Visual Studio?
A file named `stdafx.h` is automatically generated when I start a project in Visual Studio 2010. I need to make a cross-platform C++ library, so I don't/can't use this header file. What is `stdafx.h`...
- Modified
- 2 Aug at 18:6
Why can't I define a static method in a Java interface?
Here's the example: ``` public interface IXMLizable<T> { static T newInstanceFromXML(Element e); Element toXMLElement(); } ``` Of course this won't work. But why not? One of the possible i...
- Modified
- 20 May at 12:42
How do I "decompile" Java class files?
What program can I use to decompile a class file? Will I actually get Java code, or is it just JVM assembly code? On Java performance questions on this site I often see responses from people who have...
- Modified
- 9 Aug at 21:21
Is there a printf converter to print in binary format?
I can print with `printf` as a hex or octal number. Is there a format tag to print as binary, or arbitrary base? I am running gcc. ``` printf("%d %x %o\n", 10, 10, 10); //prints "10 A 12\n" printf("%...
Resolving instances with ASP.NET Core DI from within ConfigureServices
How do I manually resolve a type using the ASP.NET Core MVC built-in dependency injection framework? Setting up the container is easy enough: ``` public void ConfigureServices(IServiceCollection ser...
- Modified
- 8 Jul at 12:52
How to convert a SVG to a PNG with ImageMagick?
I have a SVG file that has a defined size of 16x16. When I use ImageMagick's convert program to convert it into a PNG, then I get a 16x16 pixel PNG which is way too small: ``` convert test.svg test.p...
- Modified
- 15 Aug at 16:36
Create a temporary table in a SELECT statement without a separate CREATE TABLE
Is it possible to create a temporary (session only) table from a select statement without using a create table statement and specifying each column type? I know derived tables are capable of this, but...
- Modified
- 29 Aug at 13:44
Text progress bar in terminal with block characters
I wrote a simple console app to upload and download files from an FTP server using the ftplib. I would like the app to show some visualization of its download/upload progress for the user; each time...
How do I force Git to use LF instead of CR+LF under Windows?
I want to force Git to check out files under Windows using just `LF` not `CR+LF`. I checked the two configuration options, but was not able to find the right combination of settings. I want to convert...
- Modified
- 26 Oct at 11:44
How can I process each letter of text using Javascript?
I would like to alert each letter of a string, but I am unsure how to do this. So, if I have: ``` var str = 'This is my string'; ``` I would like to be able to separately alert `T`, `h`, `i`, `s`, et...
- Modified
- 5 Feb at 19:38
Graphviz: How to go from .dot to a graph?
I can't seem to figure this out. I have a .dot file, which is valid according to the syntax. How do I use graphviz to convert this into an image? (note that I'm on Windows, not linux)
How to lose margin/padding in UITextView
I have a `UITextView` in my iOS application, which displays a large amount of text. I am then paging this text by using the offset margin parameter of the `UITextView`. My problem is that the padding ...
- Modified
- 25 Sep at 07:46
Visual Studio Code open tab in new window
I am trying to open a tab in a new window in Visual Studio Code so I can move it to another screen. If I drag the tab the other screen, a file is created. Is there a shortcut to open a tab in a new Vi...
- Modified
- 22 Mar at 07:27
Can't specify the 'async' modifier on the 'Main' method of a console app
I am new to asynchronous programming with the `async` modifier. I am trying to figure out how to make sure that my `Main` method of a console application actually runs asynchronously. ``` class Progr...
- Modified
- 9 Jul at 12:27