Friday, 20 July 2012
Monday, 18 June 2012
Android: Motorola Issue with Listview
Motorola Droid X and maybe other models, have an issue with ListView that you will not see the background when you don't have an item inside.
On this link you can follow the discussion and the solution, if you don't want to read all the thread and understand how to fix the problem, you can read below how fix it.
Solution:
On your ListView you need to add four parameters that makes your ListView transparent when you dont have any items
Layout
Color reference
On this link you can follow the discussion and the solution, if you don't want to read all the thread and understand how to fix the problem, you can read below how fix it.
Solution:
On your ListView you need to add four parameters that makes your ListView transparent when you dont have any items
Layout
android:background="@color/transparent" android:cacheColorHint="@color/transparent" android:descendantFocusability="afterDescendants" android:overScrollFooter="@null"
Color reference
<color name="transparent">#00000000</color>
Thursday, 24 May 2012
[Git] Clone the local repositor
You can clone your local repositor somewhere without any authentication, just find out what is your path of the repo.
git clone --no-hardlinks <repo path>
[Git] Restore file or directory
Git has a great system to restore a file that you maybe deleted, you can check what is the last commit about the file/directory:
git rev-list -n 1 HEAD -- <file_path>
If you want to restore it you can use this simple command and in a few seconds your file/directory will be backgit checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"
Friday, 11 May 2012
Android: Force gallery refresh
This is a simple broadcast to force the gallery refresh instead of wait that you plug a usb cable or remount the sdcard:
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+
Environment.getExternalStorageDirectory())));
Basically the code does a fake action and the gallery will update the pictures.Friday, 4 May 2012
Convert a String to an Integer
I think that a lot of people is looking for a function to convert a string to an integer because the function ATOI works only with char.
This is the solution for you project with Arduino:
int stringToNumber(String thisString) {
int i, value, length;
length = thisString.length();
char blah[(length+1)];
for(i=0; i<length; i++) {
blah[i] = thisString.charAt(i);
}
blah[i]=0;
value = atoi(blah);
return value;
}
Wednesday, 16 November 2011
REGEXP: Validate IP
The validation of the IP it's very simple, you need a Regular expression and put it into the function preg_match, this is an example:
function checkIP($ip) {
return preg_match("/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/i", $ip);
}
Subscribe to:
Posts (Atom)