Set ImageView width and height programmatically?
How can I set an `ImageView`'s width and height programmatically?
- Modified
- 23 Jan at 15:15
How do I get a div to float to the bottom of its container?
I have floated images and inset boxes at the top of a container using `float:right` (or `left`) many times. Now, I need to float a `div` to the bottom right corner of another `div` with the normal tex...
How do you disable viewport zooming on Mobile Safari?
I've tried all three of these to no avail: ``` <meta name=”viewport” content=”width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;” /> <meta name=”viewport” content=”width=devi...
- Modified
- 11 Jun at 14:14
Echo tab characters in bash script
How do I echo one or more tab characters using a bash script? When I run this code ``` res=' 'x # res = "\t\tx" echo '['$res']' # expect [\t\tx] ``` I get this ``` res=[ x] # that is [<space...
What is the purpose of .PHONY in a Makefile?
What does `.PHONY` mean in a Makefile? I have gone through [this](http://www.gnu.org/software/make/manual/make.html#Phony-Targets), but it is too complicated. Can somebody explain it to me in simple ...
- Modified
- 18 Sep at 03:0
SQL: How to properly check if a record exists
While reading some SQL Tuning-related documentation, I found this: `SELECT COUNT(*)` : - - Is `SELECT COUNT(*)` really that bad? What's the proper way to verify the existence of a record?
- Modified
- 1 Jun at 19:48
jQuery `.is(":visible")` not working in Chrome
``` if ($("#makespan").is(":visible") == true) { var make = $("#make").val(); } else { var make = $("#othermake").val(); } Make:<span id=makespan><select id=make></select><span id=othermak...
- Modified
- 18 Mar at 20:14
Convert date to datetime in Python
Is there a built-in method for converting a `date` to a `datetime` in Python, for example getting the `datetime` for the midnight of the given date? The opposite conversion is easy: `datetime` has a `...
How can I make Java print quotes, like "Hello"?
How can I make Java print `"Hello"`? When I type `System.out.print("Hello");` the output will be `Hello`. What I am looking for is `"Hello"` with the quotes(`""`).
- Modified
- 29 Sep at 15:55
What are drawbacks or disadvantages of singleton pattern?
The [singleton pattern](https://en.wikipedia.org/wiki/Singleton_pattern) is a fully paid up member of the [GoF](https://en.wikipedia.org/wiki/Design_Patterns)'s [patterns book](https://rads.stackoverf...
- Modified
- 20 Jun at 07:56
pandas groupby, then sort within groups
I want to group my dataframe by two columns and then sort the aggregated results within those groups. ``` In [167]: df Out[167]: count job source 0 2 sales A 1 4 sales ...
Pandas read_csv: low_memory and dtype options
``` df = pd.read_csv('somefile.csv') ``` ...gives an error: > .../site-packages/pandas/io/parsers.py:1130: DtypeWarning: Columns (4,5,7,16) have mixed types. Specify dtype option on import or set lo...
How can I access the value of a promise?
I'm looking at this example from Angular's documentation for `$q`, but I think this probably applies to promises in general. The example below is copied verbatim from their documentation with their co...
- Modified
- 29 Sep at 12:21
How do I conditionally add attributes to React components?
Is there a way to only add attributes to a React component if a certain condition is met? I'm supposed to add required and readOnly attributes to form elements based on an Ajax call after render, but ...
- Modified
- 4 Dec at 03:20
MySQL > Table doesn't exist. But it does (or it should)
I changed the datadir of a MySQL installation and all the bases moved correctly except for one. I can connect and `USE` the database. `SHOW TABLES` also returns me all the tables correctly, and the f...
- Modified
- 25 Nov at 11:12
How can I update state.item[1] in state using setState?
I'm creating an app where the user can design his own form. E.g. specify name of the field and details of which other columns that should be included. The component is available as a [JSFiddle](http:/...
- Modified
- 13 Dec at 14:21
Escape Character in SQL Server
I want to use quotation with escape character. How can I do to avoid the following error when one has a special character? > Unclosed quotation mark after the character string.
- Modified
- 19 Feb at 20:38
Pythonic way to print list items
I would like to know if there is a better way to print all objects in a Python list than this : ``` myList = [Person("Foo"), Person("Bar")] print("\n".join(map(str, myList))) Foo Bar ``` I read thi...
- Modified
- 2 Apr at 16:24
How do I align views at the bottom of the screen?
Here's my layout code; ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width=...
- Modified
- 24 Sep at 10:41
Error in file(file, "rt") : cannot open the connection
I'm new to R, and after researching this error extensively, I'm still not able to find a solution for it. Here's the code. I've checked my working directory, and made sure the files are in the right ...
Serialize an object to XML
I have a C# class that I have inherited. I have successfully "built" the object. But I need to serialize the object to XML. Is there an easy way to do it? It looks like the class has been set up for ...
- Modified
- 13 May at 21:33
jQuery ajax error function
I have an ajax call passing data to a page which then returns a value. I have retrieved the successful call from the page but i have coded it so that it raises an error in the asp. How do i retrieve ...
CSS technique for a horizontal line with words in the middle
I'm trying to make a horizontal rule with some text in the middle. For example: ----------------------------------- my title here ----------------------------- Is there a way to do that in CSS? With...
- Modified
- 26 Aug at 19:35
What is the common header format of Python files?
I came across the following header format for Python source files in a document about Python coding guidelines: ``` #!/usr/bin/env python """Foobar.py: Description of what foobar does.""" __author_...
Best way to initialize (empty) array in PHP
In certain other languages (AS3 for example), it has been noted that initializing a new array is faster if done like this `var foo = []` rather than `var foo = new Array()` for reasons of object creat...
- Modified
- 11 May at 15:28