Questions

Android: Getting a file URI from a content URI?

In my app the user is to select an audio file which the app then handles. The problem is that in order for the app to do what I want it to do with the audio files, I need the URI to be in file format....

1 Nov at 22:22

How do I check if file exists in Makefile so I can delete it?

In the clean section of my `Makefile` I am trying to check if the file exists before deleting permanently. I use this code but I receive errors. What's wrong with it? ``` if [ -a myApp ] then rm...

29 Mar at 07:25

How to get a property value based on the name

is there a way to get the value of a property of a object based on its name? For example if I have: ``` public class Car : Vehicle { public string Make { get; set; } } ``` and ``` var car = ne...

1 Apr at 01:10

How do I correctly detect orientation change using Phonegap on iOS?

I found this orientation test code below looking for JQTouch reference material. This works correctly in the iOS simulator on mobile Safari but doesn’t get handled correctly in Phonegap. My project is...

25 Apr at 22:54

How to iterate through range of Dates in Java?

In my script I need to perform a set of actions through range of dates, given a start and end date. Please provide me guidance to achieve this using Java. ``` for ( currentDate = starDate; currentDat...

28 Jul at 16:58

How to view the SQL queries issued by JPA?

When my code issues a call like this: ``` entityManager.find(Customer.class, customerID); ``` How can I see the SQL query for this call? Assuming I don't have access to database server to profile/...

26 Sep at 15:18

Export to CSV via PHP

Let's say I have a database.... is there a way I can export what I have from the database to a CSV file (and text file [if possible]) via PHP?

22 Nov at 19:32

Download data URL file

I'm playing with the idea of making a completely JavaScript-based zip/unzip utility that anyone can access from a browser. They can just drag their zip directly into the browser and it'll let them dow...

2 Apr at 06:12

Convert int to ASCII and back in Python

I'm working on making a URL shortener for my site, and my current plan (I'm open to suggestions) is to use a node ID to generate the shortened URL. So, in theory, node 26 might be `short.com/z`, node ...

26 Jan at 17:42

Reducing MongoDB database file size

I've got a MongoDB database that was once large (>3GB). Since then, documents have been deleted and I was expecting the size of the database files to decrease accordingly. But since MongoDB keeps all...

25 May at 13:10

How to compile a static library in Linux?

I have a question: How to compile a static library in Linux with `gcc`, i.e. I need to compile my source code into a file named out.a. Is it sufficient to simply compile with the command `gcc -o out.a...

28 Dec at 13:0

Inline comments for Bash?

I'd like to be able to comment out a single flag in a one-line command. Bash only seems to have `from # till end-of-line` comments. I'm looking at tricks like: ``` ls -l $([ ] && -F is turned off) -a...

7 Mar at 12:28

Count table rows

What is the MySQL command to retrieve the count of records in a table?

23 Jun at 22:20

Quickest way to convert XML to JSON in Java

What are some good tools for quickly and easily converting XML to JSON in Java?

21 Sep at 11:14

How can I delete a query string parameter in JavaScript?

Is there better way to delete a parameter from a query string in a URL string in standard JavaScript other than by using a regular expression? Here's what I've come up with so far which seems to wor...

28 Oct at 05:23

Copying files from one directory to another in Java

I want to copy files from one directory to another (subdirectory) using Java. I have a directory, dir, with text files. I iterate over the first 20 files in dir, and want to copy them to another direc...

18 Jul at 11:58

How do you mock out the file system in C# for unit testing?

Are there any libraries or methods to mock out the file system in C# to write unit tests? In my current case I have methods that check whether certain file exists and read the creation date. I may nee...

6 Jul at 14:42

How can I get the browser's scrollbar sizes?

How can I determine the height of a horizontal scrollbar, or the width of a vertical one, in JavaScript?

12 Apr at 11:16

Getting the application's directory from a WPF application

I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF `Application` object?

2 Jun at 08:53

How do I concatenate multiple C++ strings on one line?

C# has a syntax feature where you can concatenate many data types together on 1 line. ``` string s = new String(); s += "Hello world, " + myInt + niceToSeeYouString; s += someChar1 + interestingDecim...

Is there a way of setting culture for a whole application? All current threads and new threads?

We have the name of the culture stored in a database, and when our application starts, we do ``` CultureInfo ci = new CultureInfo(theCultureString); Thread.CurrentThread.CurrentCulture = ci; Threa...

23 Jan at 16:12

How to create Windows EventLog source from command line?

I'm creating an ASP.NET application that will log some stuff to Windows EventLog. To do this an event source has to be created first. This requires administrative priviledges so I cannot do it in the ...

15 Jan at 13:22

How to change default database in SQL Server without using MS SQL Server Management Studio?

I dropped a database from SQL Server, however it turns out that was set to use the dropped database as its default. I can connect to SQL Server Management Studio by using the 'options' button in the ...

How do you exit from a void function in C++?

How can you prematurely exit from a function without returning a value if it is a void function? I have a void method that needs to not execute its code if a certain condition is true. I really don't ...

15 Apr at 10:44

Visual Studio C# statement collapsing

When editing really long code blocks (which should definitely be refactored anyway, but that's beyond the scope of this question), I often long for the ability to collapse statement blocks like one ca...

30 Jul at 17:57