Android: Changing TextView alpha transparency across different target SDKs

Sometimes you may need to make a TextView (label) look a little transparent to make emphasis on other parts of your UI. The .setAlpha() function on TextView is not supported after later in the SDK. Here’s a static workaround you can place on some sort of UIUtils class you may have in your project.

* Android devices with SDK below target=11 do not support textView.setAlpha().
* This is a work around.
* @param v – the text view
* @param alpha – a value from 0 to 255. (0=transparent, 255=fully visible)
public static void setTextViewAlpha(TextView v, int alpha) {

Drawable[] compoundDrawables = v.getCompoundDrawables();
for (int i=0 ; i < compoundDrawables.length; i++) { Drawable d = compoundDrawables[i]; if (d != null) { d.setAlpha(alpha); } } } [/java] Enjoy, and above all CODE!

My first Facebook Gift Experience

November 22, I buy a gift for my wife.

I notice the selection is already sizeable, seems like they’ve cut out deals (or just integrated) with Starbucks and other smaller but exclusive brands. I’ve picked a Sarabeth’s Jam, I’m given the option to choose the flavor or to let my wife pick the flavor for herself.

After I’ve done the purchase, I see the gift in the Newsfeed, Facebook has been cool enough not to make it public by default, it’s only been shared with Friends, I can choose to change privacy just like any other post on the newsfeed.

One cool detail that plays with the minds of everyone looking is that the present is still under wraps and it will remain that way until my wife opens the present and sets up a shipping address. They want to make the surprise element last for as long as possible creating attention towards the gifting experience on Facebook.

November 24, the gift has shipped

Maybe their volumes on opening were large, kinks needed to be addressed, it was thanksgiving weekend (not everybody was working), but it took way too long between ordering and shipping.

November 26, gift arrives 4 days later.

How did they manage to squeeze all that on that tiny box?

Notice the details on the packaging, Facebook has made sure to put a signature and to make their brand stay with us to create word of mouth by putting the gift on a Facebook branded cloth bag that you’re not going to trash. In the case of the jam we have the added bonus that the packagers have included 2 gel packs that I get to keep and reuse.

The contents have been very well packed, the Jam jar is safe and the contents delicious.

Have you sent or received a gift on Facebook? How was your experience?

[SOLVED] Kindle Fire HD not being detected by adb

OSX Setup Modify your adb_usb.ini

Open the ~/.android/adb_usb.ini file for editing and add


Save the file.

Note: Make sure there is only one entry per line. If the file does not exist, create the file and make sure you have the required Android SDK prerequisites configured. Restart the ADB server and confirm your Kindle Fire is detected

Open a terminal shell and execute:
[bash]adb kill-server
adb start-server
adb devices[/bash]

Locate Kindle Fire under the device list.

If your Kindle Fire is not being detected, you may need to reboot your computer or log out and log in for the changes to take effect.

Source: StackOverFlow

Get FrostWire 1.0 for Android

If you are getting an Android device this holiday season, we’ve spent the last 5 months building a must-have app for it.

Install FrostWire via Google Play.

Download the .apk installer.

Here’s a few things you can do with our completely re-designed and easy to use file sharing client and media player.

Improved search that integrates with the cloud.

Search results are faster than ever (instant in most cases) and not only you’ll have the most powerful BitTorrent Deep-Smart search[1] featured in previous versions, now FrostWire integrates with popular cloud services where content creators from all over the world share millions of legally available files[2].

The fastest downloads ever on any FrostWire for Android.

Be it on Wi-Fi, 3G or 4G you will experience in most cases downloads that are so fast you won’t even see the progress bar begin to move, by the time the transfer screen is opened the file will already be on your device. Specially when sharing files with other FrostWire devices (PCs too) on the same Wi-Fi network.

Share files between phones, tablets and computers without any networking know-how

You don’t have to use cables or become a computer guru to share files between your phones, tablets or computers. We’ve also been working on FrostWire for desktop so that when you open FrostWire on your phone or computer you will be able to see every device automatically.

Just make files publicly available by opening padlock icons next to the files and every device running FrostWire will be able to download and even stream music or video from each other.

This makes it great for groups of people (work, school, home, party), now you only need to take only one photo and share it with everybody else next time you’re all connected to the same Wi-Fi hotspot.

Sending documents, music, family videos between your mobile, tablet or computer has never been easier or faster, best of all it doesn’t even matter what Operating system you’re running, Windows, Mac, Linux, it doesn’t matter, all you need is FrostWire and a Wi-Fi router. It just works.

World class Gesture Based Music Player

We’ve redesigned our music player for simplicity and convenience. FrostWire’s music player is the world’s first gesture based music player, we built it thinking of drivers in mind, no need to take your eyes off the road if you want to switch songs or pause/resume playback.

On this version we’ve introduced a beautiful new design with a 3D presentation of the album art currently being played. It also has functionality to share or un-share the file you’re currently listening to without having to browse or find the file on your device.

Easier Navigation

We’ve recreated the navigation system on the application, it now has a beautiful animated and responsive slide in menu that will take you anywhere in the app, with room for future functionality, and if you’re playing a song you will be able to see the album art of the song being played.

We’ve also implemented a custom “Back” history handler so that you can backtrack perfectly the screens you’ve navigated as you used the app. You now have random access navigation through the menu, and sequential access navigation through the Android’s back key.

We’ve added new controls to let you instantly filter your own files and see which are being shared on the Wi-Fi network and which aren’t in just one touch.

Install FrostWire on your Android and spread the word, the more the merrier, it’s absolutely free.

Install FrostWire via Google Play.

Download the .apk installer.

[1] FrostWire's Deep-Smart search uses the most popular torrent indexing services to fetch torrent files, then FrostWire opens these files and searches for the individual files indexed by the torrent. As FrostWire searches it remembers the files it's seen in the past to make your next searches instantaneous.

[2] Only on in 2012 it was announced users had shared over 4 million Creative Commons licensed videos. FrostWire also taps on, the internet's biggest sound and music community of content creators, bands, singers and DJs that pay to make their music available for free to the SoundCloud community. If you share your content on YouTube or SoundCloud you're automatically available to the millions of FrostWire users on both Desktop and Android. Integration with more popular cloud services to come in the next releases.

When you download and install FrostWire you must agree that you will not use it for the purpose of copyright infringement otherwise the software won't work. FrostWire condemns copyright infringement. Downloading FrostWire does not constitute permission or a license for obtaining or distributing unauthorized files. It is illegal for you to distribute copyrighted files without permission. If you want to know about legal content you can download and distribute legally please visit,,, and

How to process thousands of WordPress posts without hitting or raising memory limits.

So you need to write a script that processes all the posts in your wordpress database, you don’t need to use the stupid wordpress loop because you’re not writing web facing code, you might just need to fix some metadata on each one of the posts, but every time you iterate through your posts, no matter if you use the wordpress api, or even if you try to fetch the post IDs directly with MySQL and then call “wp_get_post($id)” after a few hundred posts your PHP interpreter dies when it uses all the memory you’ve given it.

You Google and every other clueless php-wordpress-noob that thinks himself of a programmer will give you the “Raise your PHP’s memory limit” or “Do it in parts” answer.

WTF is it with these noobs?

You a programmer used to real programming languages start to curse on the frustration of having to get dirty with this awful language and badly documented wordpress “API”. The noobs don’t understand that you might have to deal with tens of thousands of posts that couldn’t possibly fit in memory and you know…

is the solution to the problem is to free memory?

The WordPress geniuses created this WP Object cache which is used by default whenever you invoke “get_post()” or other functions. The bastards didn’t bother to mention it on the function documentations, nor they bothered to put a little note on how to disable it in case you didn’t need it. This is what happens when you get people that don’t think about all the possible uses of an API.

If you start iterating through a list of IDs, and you start invoking get_post($somePostId,’OBJECT’), and you start to print how much memory is available you will see how get_post() does keep the posts in memory, if you read get_post() and dig further you will see objects being cached in the in-memory WP Object Cache, a half-ass solution would be to invoke wp_cache_flush() every now and then:

$post_ids_cursor = mysqli_query(“select ID from wp_posts where post_status=’publish’ order by post_date desc”);
$n = 0;
$last_memory_usage = memory_get_usage();

while ($row = mysqli_fetch_row($post_ids_cursor)) {
//this son of a bitch caches the post object.
//nowhere on the WordPress documentation for the function it says so
$post = get_post($row[0],’OBJECT’);

$memory_usage = memory_get_usage();
$delta_memory = $memory_usage – $last_memory_usage;
$last_memory_usage = $memory_usage;

echo “($n) ” . $memory_usage . ” ($delta_memory) \n”;


//flush php’s cache every 100 posts, and let’s see what happens.
if ($n % 100 == 0) {
echo “Flush!\n”;

//N post – Memory used – Delta memory used
(0) 30254136 (13984) //start about 28.85MB
(1) 30262280 (8144)
(2) 30269592 (7312)
(3) 30277656 (8064)
(4) 30285720 (8064)
(5) 30293784 (8064)
(6) 30301848 (8064)
(7) 30309928 (8080)
(8) 30318056 (8128)
(9) 30326120 (8064)
(10) 30334184 (8064)

(93) 31054104 (8104)
(94) 31062168 (8064)
(95) 31070232 (8064)
(96) 31078344 (8112)
(97) 31086440 (8096)
(98) 31094552 (8112)
(99) 31102632 (8080) //already here at 29.66MB
(100) 29816984 (-1285648) //bam we’ve freed 1.22MB with the flush call

However this solution is slow, WordPress will use and free unnecessary dynamic memory and it’ll check the cache with no luck every time you get a new object, which is the case of a linear scan like the one we have to do to batch process our posts.

Luckily someone in the wordpress team put a way to disable caching, so the real solution is…

To not use dynamic memory at all if you don’t need it

When you read the code of “wp_post_cache” every time $wp_object_cache->add() is invoked, that code always checks to see if caching has been suspended using a function called “wp_suspend_cache_addition()”

function add( $key, $data, $group = ‘default’, $expire = ” ) {
if ( wp_suspend_cache_addition() )
return false;


This function can be used to turn off the freaking caching, this way you can iterate much faster through all your posts, every object fetched from the database will be kept in the stack of your loop and by not needing to flush or check the cache your processing will be much much faster.

This is how you turn it off:


Hope this helped you process your posts in batch efficiently, leave a tip on the way out if I saved your ass.

No Bad CODE – Files Included to Print your own stickers – #CODE #streetart #wheatpaste #pasteup #streetart

Enjoy and print my latest creation (links at the end) inspired in the coding philosophy of “No Broken Windows” of the book The Pragmatic Programmer

Save the .pngs, print with Photoshop (Fit to Screen)

Single Sticker PNG

Multiple Sticker PNG


Share all you want, no commercial use. If you want to use this design commercially contact me.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License