Questions

Getting activity from context in android

This one has me stumped. I need to call an activity method from within a custom layout class. The problem with this is that I don't know how to access the activity from within the layout. ## Profil...

Excel VBA - exit for loop

I would like to exit my `for` loop when a condition inside is met. How could I exit my `for` loop when the `if` condition has been met? I think some kind of exit at the end of my `if` statement, but d...

19 Jun at 05:10

Binding multiple events to a listener (without JQuery)?

While working with browser events, I've started incorporating Safari's touchEvents for mobile devices. I find that `addEventListener`s are stacking up with conditionals. A standard event listener: ...

20 Oct at 12:49

Using "like" wildcard in prepared statement

I am using prepared statements to execute mysql database queries. And I want to implement a search functionality based on a keyword of sorts. For that I need to use `LIKE` keyword, that much I know....

21 Jan at 01:34

How to change a field name in JSON using Jackson

I'm using jackson to convert an object of mine to json. The object has 2 fields: ``` @Entity public class City { @id Long id; String name; public String getName() { return name; } publ...

How to catch an Exception from a thread

I have Java main class, in the class, I start a new thread, in the main, it waits until the thread dies. At some moment, I throw a runtime exception from the thread, but I can't catch the exception th...

16 Mar at 15:37

C# Create New T()

You can see what I'm trying (but failing) to do with the following code: ``` protected T GetObject() { return new T(); } ``` Any help would be greatly appreciated. EDIT: The context was as fo...

18 Jan at 09:36

getActivity() returns null in Fragment function

I have a fragment (F1) with a public method like this ``` public void asd() { if (getActivity() == null) { Log.d("yes","it is null"); } } ``` and yes when I call it (from the Activity...

How to get started with developing Internet Explorer extensions?

Does anyone here have experience with/in developing IE extensions that can share their knowledge? This would include code samples, or links to good ones, or documentation on the process, or anything. ...

Non-recursive depth first search algorithm

I am looking for a non-recursive depth first search algorithm for a non-binary tree. Any help is very much appreciated.

8 Dec at 18:20

How to print binary tree diagram in Java?

How can I print a binary tree in Java so that the output is like: ``` 4 / \ 2 5 ``` My node: ``` public class Node<A extends Comparable> { Node<A> left, right; A data; public N...

String.format() to format double in Java

How can I use `String.format(format, args)` to format a double like below? `2354548.235` -> `2,354,548.23`

8 Mar at 08:46

AutoMapper vs ValueInjecter

Everytime I'm looking for [AutoMapper](http://automapper.codeplex.com/) stuff on StackOverflow, I'm reading something about [ValueInjecter](http://valueinjecter.codeplex.com/). Can somebody tell me t...

Work on a remote project with Eclipse via SSH

I have the following boxes: a) A Windows box with Eclipse CDT, b) A Linux box, accessible for me only via SSH. Both the compiler and the hardware required to build and run my project is only on machin...

How to ALTER multiple columns at once in SQL Server

I need to `ALTER` the data types of several columns in a table. For a single column, the following works fine: ``` ALTER TABLE tblcommodityOHLC ALTER COLUMN CC_CommodityContractID NUMERIC(18,0) ...

13 Jan at 10:35

How can I convert a file pointer ( FILE* fp ) to a file descriptor (int fd)?

I have a `FILE *`, returned by a call to `fopen()`. I need to get a file descriptor from it, to make calls like `fsync(fd)` on it. What's the function to get a file descriptor from a file pointer?

13 Sep at 20:25

Truncating all tables in a Postgres database

I regularly need to delete all the data from my PostgreSQL database before a rebuild. How would I do this directly in SQL? At the moment I've managed to come up with a SQL statement that returns all ...

Where to install Android SDK on Mac OS X?

Where should the Android SDK be installed on Mac OS X?

21 Feb at 14:9

How can I get zoom functionality for images?

Is there a common way to show a big image and enable the user to zoom in and out and pan the image? Until now I found two ways: 1. overwriting ImageView, that seems a little bit too much for such ...

7 Feb at 10:27

GIT clone repo across local file system in windows

I am a complete Noob when it comes to GIT. I have been just taking my first steps over the last few days. I setup a repo on my laptop, pulled down the Trunk from an SVN project (had some issues with...

9 Nov at 09:16

Display the current time and date in an Android application

How do I display the current date and time in an Android application?

16 Dec at 14:47

String was not recognized as a valid DateTime " format dd/MM/yyyy"

I am trying to convert my string formatted value to date type with format `dd/MM/yyyy`. ``` this.Text="22/11/2009"; DateTime date = DateTime.Parse(this.Text); ``` What is the problem ? It has a se...

4 Aug at 01:15

What is the HtmlSpecialChars equivalent in JavaScript?

Apparently, this is harder to find than I thought it would be. And it even is so simple... Is there a function equivalent to PHP's [htmlspecialchars](https://www.php.net/manual/en/function.htmlspecial...

15 Jun at 21:51

How to use C++ in Go

In the new [Go](http://golang.org/) language, how do I call C++ code? In other words, how can I wrap my C++ classes and use them in Go?

22 Nov at 11:40

What's the difference between echo, print, and print_r in PHP?

I use `echo` and `print_r` much, and almost never use `print`. I feel `echo` is a macro, and `print_r` is an alias of `var_dump`. But that's not the standard way to explain the differences.

2 Feb at 11:37