Python Google App Engine 301 Redirect if Path

Thursday, February 28, 2013

Want to redirect part of your domain to a new subdomain, but leave certain pages the same? Don’t do what I did. In fact, if you’ve found this post, consider me surprised, because my SEO has taken a tumble because I carelessly used a JavaScript redirect.

Here’s the scenario. I wanted visitors to wellsb.com to see my new personal landing page written with Python and Google App Engine. That means, I had to relocate my blog from wellsb.com to blog.wellsb.com.

Obviously, I can’t redirect the entire domain, but I also didn’t want people who run into an old link on the web to hit a dead-end.

I don’t have access to server-side settings, so that option is out of the question. The wrong thing to do is use conditional JavaScript redirects. The right thing to do is a very simple, SEO friendly solution. Just add this code (modify as needed) to your main app engine handler, just inside def get(self):

if self.request.path.startswith('/post/'):
    import urlparse
    to_server="blog.wellsb.com"
    scheme, netloc, path, query, fragment = urlparse.urlsplit(self.request.url)
    url = urlparse.urlunsplit([scheme,to_server, path, query, fragment])
    self.redirect(url, permanent=True)
This gives a 301 redirect to the appropriate blog post if somebody tries to access the old wellsb.com/post/* instead of the new blog.wellsb.com/post/*. Everything else remains unchanged.

Side Stage on Nexus 7 Ubuntu Touch

Saturday, February 23, 2013

So you’ve set up Ubuntu Touch on your Nexus 7, only to find out you don’t have that nifty side-stage feature. Fortunately, there’s an easy solution. Follow along: SSH into your device per Ubuntu’s instructions. Tip: Use the following command to retrieve your local IP address: adb shell ifconfig wlan0

Now that you are connected to your device, it might be a good idea to make a backup of /usr/bin/ubuntu-session

sudo cp /usr/bin/ubuntu-session /usr/bin/ubunt-session.bak
Tip: The root password is phablet

Now let’s make a simple modification
sudo vi /usr/bin/ubuntu-session
Scroll down to the line that reads elif [ “$device” == “grouper” ]; then
Change both instances of GRID_UNIT_PX=14 to
GRID_UNIT_PX=12
Now restart the ubuntu-session service
sudo service ubuntu-session restart
image  imageUbuntu Side Stage and Multi-User on Nexus 7
As you can see, this is all in portrait mode still, so I’ll have to work to get it in landscape mode.

Also, the app running beneath the phone app is one I wrote up real quickly. A beautiful thing about Ubuntu is just how easy it is to develop for this OS, even with the SDK only in alpha. Networking, for example, is seamless— none of the async madness required with Android

Set Ubuntu Touch System time

Saturday, February 23, 2013

Have Ubuntu Touch on your phone or tablet and want to know how to set the clock? Simple! Just SSH into your device per Ubuntu’s instructions. Tip: Use the following command to retrieve your local IP address:

adb shell ifconfig wlan0
Now that you are connected to your device, simply execute the following command and follow the on-screen instructions:
sudo dpkg-reconfigure tzdata
Tip: The root password is phablet

Camping with Electronics (Solar Panel + Battery)

Friday, February 01, 2013

Sometimes we go camping to get away. Other times, we still want to be connected to the outside world. If you’ve spent any time camping in that second category, you realize how precious battery life can be. Fortunately, you can squeeze extra juice out of your electronic devices in all weather conditions with a couple purchases. For about $100, you can have a solar panel and a backup battery.

Solar Panel

One of the first items I considered before camping in Senegal for a couple weeks was a solar panel. I wanted it to have a sufficient current output (and regulated voltage output!) to be able to charge my devices directly. This means, 5V / 2A. I decided the Instapark 10 Watt Solar Panel would do the job! It folds up into a convenient package, and when unfolded reveals 3 monocrystalline solar panels. It features two standard USB ports for charging multiple devices simultaneously, and it works beautifully.

Backup Battery
A solar panel is great if you plan on camping in a very sunny place, but you can’t always rely on that. That’s where this 12000mAh backup battery comes in. You can charge this huge battery pack during the day with your solar panels, and then charge up to four devices simultaneously at night! What if you have a streak of rainy days and can’t recharge your battery pack? This battery’s capacity is large enough to charge my phone 8 times before depleting.

Custom Android UI Views for Beautiful Apps

Thursday, January 31, 2013

If you are serious about Android Development, you probably know about AndroidViews.net. If you are just getting started, I want to share this very helpful resource. AndroidViews helps you integrate beautiful widgets and form views in your application. Have you seen a nice design element that you’d like to use in your application? Don’t re-invent the wheel. You can probably find it on AndroidViews. Want a nice sliding ribbon menu like the Google+ App? There are options for that. In most cases, it’s as easy as adding the source as a library and including it in your project.

Google Now Cards UI

Android Views also has a helpful Libraries page where you can find other useful implementations, such as ActionBarSherlock. The Android Action Bar is a window element that was implemented in API level 11. Rather than check android versions and only implementing the action bar on post-Honeycomb devices, ActionBarSherlock allows you to maintain a consistent Action Bar across all versions of Android. Simply include the library and follow these usage instructions.
You must declare your activity to extend any of the activity classes that start with ‘Sherlock’ (e.g., SherlockActivity, SherlockFragmentActivity). Interaction with the action bar is handled by calling getSupportActionBar() (instead of getActionBar()).
If you have questions about integrating these elements into your project, please leave a comment. These resources proved very valuable in my recent Android application.

Hangouts, Phone Calls And Google Voice Thanks For All Of...

22 Hours Ago
Hangouts, phone calls and Google Voice

Thanks for all of your feedback on last week's Hangouts launch. I wanted to quickly talk about 1) making/receiving phone calls in Gmail, and 2) Google Voice support more generally.

1) Today's version of Hangouts doesn't yet support outbound calls on the web and in the Chrome extension, but we do support inbound calls to your Google Voice number. We're working hard on supporting both, and outbound/inbound calls will soon be available. In the meantime, you can continue using Google Talk in Gmail.

2) Hangouts is designed to be the future of Google Voice, and making/receiving phone calls is just the beginning. Future versions of Hangouts will integrate Google Voice more seamlessly.


View Poston Google+

Introducing Android Studio: An Ide Designed To Make You Faster...

May 15 | 12:33PM
Introducing Android Studio: an IDE designed to make you faster and more productive as an app developer. 

#io13     #keynote     #io13android  


View Poston Google+

Officials In Mali Say They'll Send A New Camel To...

April 10 | 10:30AM
Officials in Mali say they'll send a new camel to the French president Francois Hollande after one he was given as thanks for sending troops to repel Islamist rebels,  was killed and eaten by its supposed custodians. Mr Hollande was presented with the original camel in February during a visit to newly liberated desert town of Timbuktu.


View Poston Google+

So, Imagine My Dismay When I Found This Article (In...

March 13 | 08:20PM
So, imagine my dismay when I found this article (in Google Reader, no less) that says there will be no more Google Reader after more spring cleaning. I used GReader all day, every day. It sits in a pinned tab in my browser.

In light of this outrageous tragedy (albeit not unexpected), I now have to ask for your suggestions for an alternative RSS reader. One that syncs between desktop/web and mobile. Without all that crazy fluff (that ends up only showing me select articles, but since it shows them in a very pretty way, the developer thinks I will just let it slide). Something simple and functional. I can just add all my tech feeds, news feeds, etc to different folders. Browse the items, sorted by date. Read the ones that interest me. Mark the rest as read. And then rinse and repeat with new items next time I have a spare moment.

Suggestions?

#SaveGoogleReader    #GoogleReader   #Reader  


View Poston Google+

Since Google+ Cover Photos Received A Makeover, I Decided To...

March 07 | 11:57AM
Since Google+ cover photos received a makeover, I decided to create a new one.  Interestingly, I discovered a few bugs with how it handles animated gif timing.  

For display on my profile, the frame delays I specify don't actually belong to the desired frame.  They belong to the previous frame.

In addition, the preview ignores the timing for the last frame. If you click through on the image, you'll see that the actual gif timing is different from what you see in the preview.

I have chosen to optimize my .gifs for the preview at the expense of the full-size click-through.  If these bugs are sorted out, I'll have to redeclare my timings.

#coverphoto   #googleplusupdate  


View Poston Google+