Questions

Get the current git hash in a Python script

I would like to include the current git hash in the output of a Python script (as a the of the code that generated that output). How can I access the current git hash in my Python script?

18 Dec at 16:7

Build the full path filename in Python

I need to pass a file path name to a module. How do I build the file path from a directory name, base filename, and a file format string? The directory may or may not exist at the time of call. For...

19 Jul at 14:56

How to get the URL without any parameters in JavaScript?

If I use: ``` alert(window.location.href); ``` I get everything including query strings. Is there a way to just get the main url part, for example: ``` http://mysite.com/somedir/somefile/ ``` in...

6 Jun at 20:10

How can I choose a custom string representation for a class itself (not instances of the class)?

Consider this class: ``` class foo(object): pass ``` The default string representation looks something like this: ``` >>> str(foo) "<class '__main__.foo'>" ``` How can I make this display a cust...

1 Feb at 20:7

Converting milliseconds to a date (jQuery/JavaScript)

I'm a bit of a rambler, but I'll try to keep this clear - I'm bored, so I'm working on a , and I'm a little confused over one thing. I want to get the time that a message is entered, and I want to ma...

5 Aug at 12:8

Difference between ObservableCollection and BindingList

I want to know the difference between `ObservableCollection` and `BindingList` because I've used both to notify for any add/delete change in Source, but I actually do not know when to prefer one over ...

How can I suppress "unused parameter" warnings in C?

For instance: ``` Bool NullFunc(const struct timespec *when, const char *who) { return TRUE; } ``` In C++ I was able to put a `/*...*/` comment around the parameters. But not in C of course, where...

14 Nov at 23:37

Difference between CLOCK_REALTIME and CLOCK_MONOTONIC?

Could you explain the difference between `CLOCK_REALTIME` and `CLOCK_MONOTONIC` clocks returned by `clock_gettime()` on Linux? Which is a better choice if I need to compute elapsed time between times...

11 Feb at 13:42

Merge PDF files

Is it possible, using Python, to merge separate PDF files? Assuming so, I need to extend this a little further. I am hoping to loop through folders in a directory and repeat this procedure. And I may...

12 Oct at 01:37

Difference between Pig and Hive? Why have both?

My background - 4 weeks old in the Hadoop world. Dabbled a bit in Hive, Pig and Hadoop using Cloudera's Hadoop VM. Have read Google's paper on Map-Reduce and GFS ([PDF link](http://static.googleuserco...

5 Jan at 13:23

Difference between string object and string literal

What is the difference between ``` String str = new String("abc"); ``` and ``` String str = "abc"; ```

25 Dec at 06:40

Using CSS to insert text

I'm relatively new to CSS, and have used it to change the style and formatting of text. I would now like to use it to insert text as shown below: ``` <span class="OwnerJoe">reconcile all entries</sp...

29 Apr at 23:14

Where does R store packages?

The `install.packages()` function in R is the automatic unzipping utility that gets and install packages in R. 1. How do I find out what directory R has chosen to store packages? 2. How can I change...

29 May at 14:26

How to switch position of two items in a Python list?

I haven’t been able to find a good solution for this problem on the net (probably because switch, position, list and Python are all such overloaded words). It’s rather simple – I have this list: ```...

31 May at 19:20

Convert Existing Eclipse Project to Maven Project

For a project at work, we're considering using the Maven plugin for Eclipse to automate our builds. Right now the procedure is far more complicated than it ought to be, and we're hoping that Maven wil...

17 Mar at 20:36

How can I round a number in JavaScript? .toFixed() returns a string?

Am I missing something here? ``` var someNumber = 123.456; someNumber = someNumber.toFixed(2); alert(typeof(someNumber)); //alerts string ``` does `.toFixed()` return a string? I want to round th...

14 Jan at 00:7

Main differences between SOAP and RESTful web services in Java

For now I have a slight idea about the differences between SOAP and [RESTful](https://en.wikipedia.org/wiki/Representational_state_transfer#RESTful_web_services) services. My question is when I shoul...

14 Jun at 14:36

Setting the filter to an OpenFileDialog to allow the typical image formats?

I have this code, how can I allow it to accept all typical image formats? PNG, JPEG, JPG, GIF? Here's what I have so far: ``` public void EncryptFile() { OpenFileDialog dialog = new ...

2 Aug at 22:27

Text vertical alignment in WPF TextBlock

How do I assign vertical center alignment to the text inside a TextBlock? I found TextAlignment property but it is for horizontal text alignment. How do I do it for vertical text alignment?

7 Apr at 00:26

How can I use MS Visual Studio for Android Development?

Can you use Visual Studio for Android Development? If so how would you set the android SDK instead of .NET framework and are there any special settings or configuration?

8 Nov at 19:45

Simple way to calculate median with MySQL

What's the simplest (and hopefully not too slow) way to calculate the median with MySQL? I've used `AVG(x)` for finding the mean, but I'm having a hard time finding a simple way of calculating the med...

11 Mar at 16:22

Return empty cell from formula in Excel

I need to return an empty cell from an Excel formula, but it appears that Excel treats an empty string or a reference to an empty cell differently than a true empty cell. So essentially I need someth...

28 Mar at 19:53

Visual Studio Post Build Event - Copy to Relative Directory Location

On a successful build, I wish to copy the contents of the output directory to a different location under the same folder. This parent folder is a relative part and can vary based on Source Control se...

Getting the last element of a split string array

I need to get the last element of a split array with multiple separators. The separators are commas and space. If there are no separators it should return the original string. If the string is "how,a...

25 Dec at 15:10

How do I convert a decimal to an int in C#?

How do I convert a decimal to an int?

23 Oct at 23:56