Questions

How to customize the back button on ActionBar

I have been able to customize the action bar's background, logo image and text color using suggestions from these: [Android: How to change the ActionBar "Home" Icon to be something other than the app ...

21 Aug at 17:41

Sort an array in Java

I'm trying to make a program that consists of an array of 10 integers which all has a random value, so far so good. However, now I need to sort them in order from lowest to highest value and then pri...

1 Aug at 04:37

Checking if a string array contains a value, and if so, getting its position

I have this string array: ``` string[] stringArray = { "text1", "text2", "text3", "text4" }; string value = "text3"; ``` I would like to determine if `stringArray` contains `value`. If so, I want t...

8 May at 04:36

How to expand a list to function arguments in Python

Is there syntax that allows you to expand a list into the arguments of a function call? Example: ``` # Trivial example function, not meant to do anything useful. def foo(x,y,z): return "%d, %d, %...

9 Mar at 10:14

Android How to adjust layout in Full Screen Mode when softkeyboard is visible

I have researched a lot to adjust the layout when softkeyboard is active and I have successfully implemented it but the problem comes when I use `android:theme="@android:style/Theme.NoTitleBar.Fullscr...

Regex select all text between tags

What is the best way to select all the text between 2 tags - ex: the text between all the '`<pre>`' tags on the page.

22 Jun at 18:9

multiple packages in context:component-scan, spring config

How can I add multiple packages in spring-servlet.xml file in `context:component-scan` element? I have tried ``` <context:component-scan base-package="z.y.z.service" base-package="x.y.z.controller" ...

14 Jun at 08:38

How to split a string in Haskell?

Is there a standard way to split a string in Haskell? `lines` and `words` work great from splitting on a space or newline, but surely there is a standard way to split on a comma? I couldn't find i...

19 Nov at 01:43

SQL - using alias in Group By

Just curious about SQL syntax. So if I have ``` SELECT itemName as ItemName, substring(itemName, 1,1) as FirstLetter, Count(itemName) FROM table1 GROUP BY itemName, FirstLetter ``` This would b...

1 Oct at 16:46

Java: Integer equals vs. ==

As of Java 1.5, you can pretty much interchange `Integer` with `int` in many situations. However, I found a potential defect in my code that surprised me a bit. The following code: ``` Integer cdiC...

Differences between ExpandoObject, DynamicObject and dynamic

What are the differences between `System.Dynamic.ExpandoObject`, `System.Dynamic.DynamicObject` and `dynamic`? In which situations do you use these types?

Set the absolute position of a view

Is it possible to set the absolute position of a view in Android? (I know that there is an `AbsoluteLayout`, but it's deprecated...) For example, if I have a 240x320px screen, how could I add an `Ima...

makefile execute another target

I have a makefile structured something like this: ``` all : compile executable clean : rm -f *.o $(EXEC) ``` I realized that I was consistently running "make clean" followed by "clear" in...

16 Jul at 17:23

How can I get LINQ to return the object which has the max value for a given property?

If I have a class that looks like: ``` public class Item { public int ClientID { get; set; } public int ID { get; set; } } ``` And a collection of those items... ``` List<Item> items = get...

6 Jul at 17:39

Capture iframe load complete event

Is there a way to capture when the contents of an iframe have fully loaded from the parent page?

1 Jul at 12:46

One class per file rule in .NET?

I follow this rule but some of my colleagues disagree with it and argue that if a class is smaller it can be left in the same file with other class(es). Another argument I hear all the time is "Even ...

12 Mar at 18:51

Difference between byte vs Byte data types in C#

I noticed that in C# there are both a and data type. They both say they are of type and represent an 8-digit unsigned integer. What are the differences (if any) between the two, and why you would u...

30 Nov at 08:49

Run a string as a command within a Bash script

I have a Bash script that builds a string to run as a command ``` #! /bin/bash matchdir="/home/joao/robocup/runner_workdir/matches/testmatch/" teamAComm="`pwd`/a.sh" teamBComm="`pwd`/b.sh" includ...

16 Sep at 11:37

How to set background color of a View

I'm trying to set the background color of a View (in this case a Button). I use this code: ``` // set the background to green v.setBackgroundColor(0x0000FF00 ); v.invalidate(); ``` It causes the B...

28 May at 19:37

How to add 'ON DELETE CASCADE' in ALTER TABLE statement

I have a foreign key constraint in my table, I want to add ON DELETE CASCADE to it. I have tried this: Doesn't work. EDIT: Foreign key already exists, there are data in foreign key column. The e...

15 Oct at 11:44

How do I ZIP a file in C#, using no 3rd-party APIs?

I'm pretty sure this is not a duplicate so bear with me for just a minute. How can I programatically (C#) ZIP a file (in Windows) without using any third party libraries? I need a native windows call...

3 Jun at 01:1

How to access parent Iframe from JavaScript

Well, I have an IFrame, which calls a same domain page. My problem is that I want to access some information from this parent Iframe from this called page (from JavaScript). How can I access this Ifra...

23 Jul at 14:54

How to return multiple objects from a Java method?

I want to return two objects from a Java method and was wondering what could be a good way of doing so? The possible ways I can think of are: return a `HashMap` (since the two Objects are related) or...

2 Jul at 09:30

How can I select random files from a directory in bash?

I have a directory with about 2000 files. How can I select a random sample of `N` files through using either a bash script or a list of piped commands?

1 Jul at 17:14

What is the string concatenation operator in Oracle?

What is the string concatenation operator in Oracle SQL? Are there any "interesting" features I should be careful of? (This seems obvious, but I couldn't find a previous question asking it).

29 Jun at 21:28