Jarrett's Tech Blog
-
Email Signature in Android Fixed
Exchange Email Client Missing
SignatureI know many people (including myself) that use the email client in Android for personal and business use. Yes, it is lame that there is no signature support. It is a popular issue on the Android issue tracker. I hear all sorts of work arounds, such as copy and paste the signature from a text file. Well, instead of using the workaround, I decided to fix the issue.
The Fix & Source
I've mentioned before that the best thing about Android is that it is open and anyone can view the source. For example, here is the source to the Android email app. Because it is a built-in application, you must download the entire Android source code in order to make changes to the Email app. Once I downloaded the source, I made the following changes:
- Update storage mechanism to store a signature with each account
- Update account settings to add signature preference
- Update new email compose to automatically insert the signature
- New Support for reply, and forward
You can view the source code of these changes on my GitHub.
Download Email.apk for Android 2.1 (Nexus One, Droid, Root Only)
Unfortunately, because this is a built-in application, you can't update this application from the market (this will likely be fixed in next Android release). You can only update this application if you have root access to your phone. If you do have root access, download the Email.apk and push it your phone. Because the Email app is always running in the backround, you should do this from recovery, otherwise you'll need to re-enter all your accounts.
adb shell mount /system -o remount,rw adb push download/Email.apk /system/app/Email.apk
Or, you can download directly to your phone using the barcode below. You'll need to copy it into the /system/app folder with a program like Root Explorer.
-
Making an Ajax Form with jQuery in ASP.NET MVC
The latest release of jQuery 1.4 makes it even easier to create an Ajax form in ASP.NET MVC. The process involves creating two partial views, one for the form and one for successful post of the form. Then, we'll create an action method for handling form posts. Finally, we'll wire up the jQuery events to make it post within the page.
Create the Form Partial View
First, create a view model to hold the form values.
public class ContactViewModel { public string Name { get; set; } public string Email { get; set; } public string Phone { get; set; } public string Message { get; set; } }Next, create a basic HTML form with validation messages as shown below (call it ContactForm.ascx).
<%@ Control Language="C#" AutoEventWireup="true" Inherits="ViewUserControl<ContactViewModel>" %> <div id="contact"> <h4>Send A Message</h4> <form method="post" action="<%= Url.Action("SendMessage", "Contact") %>"> <fieldset> <label for="name">Name <small>(required)</small></label><%= Html.ValidationMessage("name") %> <%= Html.TextBox("name", Model.Name) %> <label for="email">Email <small>(required)</small></label><%= Html.ValidationMessage("email") %> <%= Html.TextBox("email", Model.Email) %> <label for="phone">Phone</label><%= Html.ValidationMessage("phone") %> <%= Html.TextBox("phone", Model.Phone) %> <label for="message">Message <small>(required)</small></label><%= Html.ValidationMessage("message")%> <%= Html.TextArea("message", Model.Message, 4, 100, null) %> <%= Html.ValidationMessage("error") %> <input type="submit" value="Send Message" /> </fieldset> </form> </div>Now include this form into any view with Html.RenderPartial("ContactForm", new ContactModel());
Also create a success partial view (call it ContactSuccess.ascx):
<%@ Control Language="C#" AutoEventWireup="true" Inherits="ViewUserControl<ContactViewModel>" %> <div id="contact"> <h4>Thank You!</h4> <p class="response"><strong>Your message was sent successfully.</strong> We will get back to you as soon as possible.</p> <p> Name: <%= Model.Name %><br /> Email: <%= Model.Email %><br /> Phone: <%= Model.Phone %><br /> Message: <%= Model.Message %> </p> </div>This view will replace the form upon successful form submission.
Handle SendMessage Action
Create a new ContactController class and add the following action method:
[AcceptVerbs(HttpVerbs.Post)] public ActionResult SendMessage(ContactViewModel model) { ValidateContactModel(model); if (this.ModelState.IsValid) { try { // get contact configuration SendContactMessage(model); return PartialView("ContactSuccess", model); } catch (Exception ex) { //TODO: log/notify error ModelState.AddModelError("error", "An unexpected error occured, please contact the webmaster."); } } return PartialView("ContactForm", model); }This code will validate the contents of the form post and then send the message. If there are any errors, it will redisplay the form. Otherwise, it'll display the contact success partial view.
Note: model validation and sending email is outside the scope of this article, see here for the code.
Wire jQuery Event for AJAX Form
Finally, let's add the jQuery code to bottom of the page. If you'd like, you can put this in a javascript file and link to it.
$(document).ready(function () { $('#contact form').live('submit', function () { $.post($(this).attr('action'), $(this).serialize(), function (data) { $("#contact").replaceWith($(data)); }); return false; }); });This code uses the updated live event support on form submits to easily wire up the submit button. The submit button does an AJAX post to the action. The action will return either the same form (with errors) or the success partial view. It replaces the current form with the response data. Since we are using the live event support, we do not have to worry about re-wiring the submit event each time the error form is returned.
You can see the entire source code in the AtomSite source code.
-
Android Market Needs Gift Cards
As of today, the only valid purchasing method on the Android Market is the use of a credit card. Android needs gift cards to expand access to the Android Market. If there were gift cards, people could gift apps and more people (especially the young) could buy apps. I am more likely to buy an app with a gift card than my own credit card. iTunes gift cards are everywhere (literally in almost every store) which increases exposure to Apple's brand. Google needs this too!
Expand Access with Gift Cards
If there were Android gift cards, it would expand access to the market for young people or people that do not have a credit card. Lets face it, kids buy games and there are not many parents that let their kid link their credit card to their phone. If there were gift cards, parents could buy their kids a gift card or kids could buy a gift card with their own money.
Also, some people, for whatever reason, may not have a credit card or want to use a credit card on the internet. These people need an alternative method to buy apps on the market since cash is out of the question.
Gift Card Culture
The gift card business has boomed due to what I believe is a gift card culture. I don't know about you, but what do you give to the dad that has everything? That is easy, get them a gift card to Bass Pro Shops, right? I'll admit, I give gift cards to people because it is easier than trying to pick something out for them.
Receiving a gift card is never as personal as getting a physical gift, but sometimes it is preferable. For example, I love technology. Technology is easy for me to buy because I understand it. However, it is too complex for my grandmother to gift an SSD to me. So I love it when I get a Newegg, Best Buy, or Amazon gift cards. Also, I am more likely to make a larger purchase when using a gift card.
Free Android Brand Advertising
iTunes gift cards are everywhere. I've seem them at every major retailer, wholesale clubs, grocery stores, drug stores, and gas stations. Because they are so easy to find and buy they make a perfect last minute gift. Good advertising is in-your-face-advertising and Apple has succeeded here.
Google should introduce gift cards to the Android Market as soon as possible. Let's expand the market!
More Links
-
Intel SSD Deal and Price Watch
I'm in the market for an SSD but the prices are still sky high. I'd like to do a fresh install on my desktop machine and install Windows 7. My current Vista install is running out space due to the WinSxs folder. A new SSD would be a perfect reason for a reinstall and a nice speed boost.
I've been running an SSD in my laptop for about 5 months and I love it. The speed and battery life is incredible.
Back in August 2009, I was lucky to snag an Intel X25-M G2 from Newegg for $229.
The price immediately sky rocketed right after my purchase it and it hasn't settled back down since.
I just installed this cool new extension for Chrome called The Camelizer. It watches the price of products at various web sites and shows a graph. I'll definitely use this tool to find the right time to buy.
Update: I was watching the OCZ Agility drive with Camelizer and it notified me of a recent price drop. I was extremely tempted as it also came with a mail-in rebate the lowered the price to $129. This is a great deal for a 60GB SSD. However, I just didn't feel the time was right as I haven't found a cheap copy of Win7 yet. Anyway, within a few hours it sold out!
-
Output Large Result Sets to Excel 2007 from SSIS 2005
I was recently in a situation where I needed to output a large amount of data to an excel file. This file is generated periodically and used by business analysts. We are using SSIS 2005 and the BAs are using Office 2007. Since the report would be bigger than 65,536 row limit of 2003 format, we needed to use 2007 format.
You'll need to start your data flow with an OLE DB Source as according to this thread it is required for compatibility.
Next, in the Connection Managers, create a New OLE DB Connection. Choose Microsoft Office 12.0 Access Database Engine OLE DB Provider. For now, leave the details blank and click OK to continue.
Note: you'll need Office 2007 installed or the 2007 Office System Driver: Data Connectivity Components
You'll notice that it looks like you are using a database connection instead of the typical Excel Connection you used for Excel 2003.
Select your new connection and view the properties. Change the connection string to the value below.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES";
Don't forget to change the file path in the connection string.
Next, I recommend you truncate any large columns to 255 using a Derived Column transformation. Also, use a Data Conversion transformation to convert all strings to unicode strings.
Now, that your data is in the correct format, let's clean up the column names. I use a Union All transformation and delete the old columns and rename the derived and converted columns. These last couple steps make the data more compatible with Excel.
Finally, your ready to dump the data to an Excel 2007 file using an OLE DB Destination. Choose your new connection you made earlier. For the name of the table or view, choose New to create a new worksheet in the Excel 2007 workbook output. In the CREATE TABLE script, you can rename the worksheet if desired.
Because of the cleanup, you'll have a simple one to one mapping. Now you can output more than 65k rows into an Excel file from SSIS 2005.
-
Getting Started with Android
I've been following Android since it was released in late 2008. I was excited because I knew the potential was limitless. One year later, both me and my wife got our first Android phones, the Verizon Motorola Droid. It only took a year for Android to mature into greatness, but it still has a way to go. I'll discuss some of the basics of using Android and share some of my favorite tips and applications.
Tip: buy your phone online and save $$$ (we got ours from Amazon).
Why I Like Android
Android is built on top of a solid foundation of openness and optimism. Computer geeks like me love the piece of mind that comes with knowing you can change/fix anything you don't like about your phone. Android allows you customize anything about the phone. Also, Google is pushing for an ecosystem where all devices are treated equal. The future of the cell phone is not 2 year contracts or nickle and dime calling plans. We will no longer need voice plans, just a monthly data plan. Android will enable this. If not 2010, 2011.
Before You Start
With Android, your data lives in the cloud. For the best experience, before you get your new Android phone, you should update your contacts on your Gmail account. Still using Hotmail? Now is a good time to switch.
The contacts manager in Gmail works really well. It isn't pretty and there does seem to be some missing features, but it gets the job done.
- Organize your contacts into Groups (Family, Friends, Co-workers, Business, etc)
- Clean up your contacts, put the proper first and last name in for everyone
- Add phone numbers, addresses to your contacts so you can easily call or navigate to the contact
- You can batch import from a CSV file (we batch imported our old wedding invitation spreadsheet)
- Add pictures to your contacts so they show on the phone (Note: your phone will pull a picture from Facebook but the picture is usually too small to see clearly)
- Crop pictures of contacts to just their face so it is easier to recognize when they are small
Things to Know About your Droid
The Droid is a great phone, but there are few things you should know about it.
- There is a button on the top to turn the screen on and off (I didn't know at first because my wife turned it on for the first time).
- The screen and OS support multi-touch but it is not enabled. When I first held the phone, my finger would inadvertently touch the side of the screen and my other finger would not register swipes and taps. So make sure when you hold the phone, your fingers aren't touching the side of the screen.
- The gold button on the side is the camera button. Just hold it down to start the camera. Hold it down again to focus and take a picture. Be patient.
- Before taking pictures, wipe the lens with a clean cloth as my lens is usually smudged from handling it.
- There is protective plastic behind the sliding screen. It will come off eventually. No big deal.
Things to Know About the Android OS
- The notifications take place at the top the screen. You can drag this down to see more info about the notification or clear the notifications.
- Hold down the home button to switch between recent applications.
- Hold down the search button to do voice searches.
- Touch and hold down anywhere there is a blank spot on the desktop to add shortcuts and widgets to the desktop. You can swipe between three desktops. Take advantage of all three.
- Make sure you use the toggle widget to manage your battery usage.
-
- The icons from left to right are: Wifi, Bluetooth, GPS, Sync, Brightness
- Airplane mode will use the least amount of battery.
- The phone charges way faster from the AC wall than from your computer
My Desktops
- The middle screen is where I keep the main apps that I use on a daily basis. This is also where I have the Power Control widget that is very important for controlling battery usage.
- The right screen is where I keep shortcuts for directly calling people, mostly my family.
- The left screen is where I access my music and news and check my calendar.
Accessories
I received a multi-media dock as a present and I keep it at my desk at work. I love it. The phone easily slides in and out and it keeps my phone charged. My wife has the car dock and she loves it as well.
If you have the docks then you can't really use protective cases. All the protective cases for the the Droid seem crappy anyway probably because it is physically difficult to make a decent case for a slider phone. Anyway, the screen is Gorilla glass which makes it very difficult to scratch.
Applications
- Bump - this application is great for exchanging photos and
contact information. You can even bump iPhones.
- Barcode scanner, Google Goggles - take pictures of barcode and QR codes or with goggles you can take pictures of stuff and it will figure out what it is. You can even download new applications to your phone by taking a picture of the 2D barcode.
- Google Voice - replaces my old cell-phone number and gives me Gmail like functionality for my voice mail. When anybody calls my Google Voice number, it rings my cell, both my work numbers, and it rings on my computer at home.
- Corporate Email - Android has decent support for corporate email with exchange access. It isn't the complete exchange experience, but it works.
- FlingTap Done - A nice TODO list app that has some neat features.
- Google Maps w/ Google Latitude - the maps application is great. It supports street view, and with latitude, you can see where your friends are at. Now, when my wife meets me at the restaurant, I know when she'll arrive.
- Tracks - record the GPS locations of your jogs, walks, car rides, etc.
- Music - with all the internet based music apps, you don't
really need to put music on your phone. I like Last.fm and Slacker
radio. Pandora is starting to have too many comercials. Also, you
can easily buy songs from Amazon MP3 or just listen to 30 seconds
of all the "Hot" songs.
- Podcasts - I use Google Listen for my podcast needs. Ironically, the search function isn't that great.
- Newsrob - Although I prefer to use Google Reader on my laptop to keep up with my favorite blogs, this app does the job when I'm on the go and it stays in sync with Google Reader.
- USA Today and NPR News - good news apps.
- Google Talk, Facebook, Swift - these apps let me IM, keep in touch with friends and tweet.
- OpenSudoku, Shortyz (cross word), Robot Defense (tower
defense), Devilry Huntress (bejeweled), Labyrinth Lite, Totemo are
all fun puzzle/strategy games.
- Nesoid and SNesoid are great emulators for some retro Nintendo and Super Nintendo gaming.
- SchottGunn and The Schwartz Unleashed turn your phone into a light saber and a shotgun.
- Flixster Movies - goto app for when we feel like going to the movies.
-
Comparison of YUI Compressor for .Net to Microsoft Ajax Minifier
Microsoft just released the Microsoft Ajax Minifier for minifying javascript files. Since I've been using the Yahoo! UI Library: YUI Compressor for .Net to do this in AtomSite, I thought it would be great to compare the two to see which is best. I'm mainly interested in the file size reduction but it would be nice to know any speed differences as well.
The Test
This method allows me to test compress some javascript using any method I pass into the Func delegate and capture the results.
To get a reasonable sample of the performance I minified 3 different files with each method 1000 times. I attempted to configure both algorithms to produce the smallest output possible.
The Results
From these results you can see that Microsoft AJAX Minifier creates smaller files in about the same amount of time. Note, both algorithms have been set in aggressive, or hypercrush, mode to rename variables and perform other tweaks for reducing file size. The Microsoft AJAX Minifier seemed to have more granular options for tweaking output. However, the YUI Compressor is open source so you could add additional options if you need them.
The Comparison
Scorecard Speed Size Reduction Options CSS & JS Support Build Task Open Source YUI Compressor
Microsoft AJAX Minifier
And the Winner is..
It depends. I suggest using the Microsoft AJAX Minifier as it produces smaller files. However, the YUI Compressor.Net better satisfies my needs as it can minify both JS and CSS files. So, when I need to minify dynamic combinations of both types of files, I'll use Yahoo! UI Library: Compressor for .Net. When I need to do one-time minification during a build or prior to deployment, I'll use the Microsoft AJAX Minifier.
Download
I've uploaded the test solution and console app so you can run the tests yourself.
JsMinTest.zip (291KB) fixed
More Reads
- Ajaxian reviews output differences: Microsoft Ajax Minifier VS YUI Compressor
- YUI Compressor home page
- Scott Gu's Announcement: Announcing Microsoft Ajax Library (Preview 6) and the Microsoft Ajax Minifier
- Stephen Walther: Using the New Microsoft Ajax Minifier
Check out how I am using minification and combination in AtomSite to speed up page load time.
-
Publish Photos with Live Photo Gallery to Picasa Online
The following guide will assist you in posting your favorite photos online for you friends and family to enjoy. It will also show you how to geotag those photos as to see where the photo was taken on the map.
Step 1: Import Photos from Camera
You should already have Windows Live Photo Gallery installed on your machine. If not, you can download it from Microsoft.
Tip: when downloading, uncheck the MSN Toolbar and anything else you don't need from the install.
Once the photo gallery application is installed, plug your camera into your computer to transfer your photos. You should see the following window pop up.
Select Import Pictures and Videos using Windows Live Photo Gallery.
The next screen will allows you to name and tag the photos you are importing. It is important to add this information to your photos so you organize and find them later. If you've taken photos over series of days on different subjects, you'll want to choose the first option. Otherwise, the second option is best when all the photos on your camera are similar.
Since my subjects are different, choose the first option.
For each group of photos, type a name and some tags. The name is similar to an album name and this is where all the photos will be stored on your computer. The tags help describe what is in the photo. Example tags: Dog; Cat; Pet; Nature; Landscape; Vacation; Flower; Food
Click import to load the photos onto your computer.
Step 2: Fix and Rate Photos
Now you should see photos inside Windows Live Photo Gallery. Go through your photos and Fix them by cropping or adjusting the exposure and colors. Each time you look at a photo, you should add any additional tags or even a caption to the photo. Now you can rate your photos. Here is how I rate my photos.
Rating Description No Stars Don't even rate photos that are below average * Stars This is an ok photo, but not good enough to show off ** Stars This is a good photo with substantial meaning, personal album *** Stars This is a great photo people should see, share online album **** Stars This is a best in class photo, wall hanger ***** Stars This is an extremely rare excellent photo, magazine cover Step 3: Publish Photos Online
Now that your photos are well tagged, you can publish them online to share with everyone. I use Picasa, but you can also use Flickr, Facebook, Smugmug, and others. You'll likely need a plugin to publish to these online services. See Listing of Publish Plugins for Windows Live Photo Gallery.
Since I am using Picasa, I'm going to download the Picasa plugin. Once it is installed, you are now ready to upload your photos.
Next, select all the photos you want to upload to a single album. You can choose your best photos by filtering them with the stars.
Once you've selected the photos you want to upload, click Publish and choose Publish on Picasa Web Albums.
Login with your Google account.
Now you can choose an existing album or create a new album. Type in a name and optional description. Also, I recommend that you limit the max photo size to 1600 or lower to speed up the uploads (and keep people from stealing full resolution copies of your photos).
Click OK to start uploading.
Once your photos are uploaded, you can view them online.
Step 4: Set Location of Photos
Choose a photo from your new album. Click the Add Location link on the right side of the photo.
Type in the location of where you took the photo. Zoom in on the map and click the exact location to mark where you took the photo. It is very helpful to switch to satellite mode. Usually, in satellite mode, you can zoom in for an extremely accurate geotag.
Now you can add the location to the rest of your photos in the album.
Tip: It is best to do this photo-by-photo in succession since the locations are usually near each other on the map.
Once you've marked all the locations of your photos, you can see where they were taken on the album map.
Congratulations, now you can email the link to your new online photo album and wow your family and friends.
-
Get Value of Checkbox using jQuery to Enable Button
Reading the value of a checkbox in jQuery is not obvious. You must use a special selector :checked and then check if the value is undefined.
//checked var checked = $('input[type=checkbox]:checked').val() != undefined; //unchecked var unchecked = $('input[type=checkbox]:checked').val() == undefined;The typical use case for this code is when you want the user to check the "I agree to the terms and conditions" before they can continue. For example:
$(function() { $('#agree').click(function() { var satisfied = $('#agree:checked').val(); if (satisfied != undefined) $('#continue').removeAttr('disabled'); else $('#continue').attr('disabled', 'disabled'); }); });The above code finds the checkbox and binds to the click event. When the user checks or un-checks the checkbox, it finds the continue button and enables or disables it based on the value of the checkbox.
Update - A more elegant way
//checked var checked = $('input[type=checkbox]').is(':checked');Change Textbox Readonly Value via Checkbox using jQuery
Another case you may want to enable or disable a textbox based on the value of the checkbox.
$(function() { $('#isOther').click(function() { var other = $('#isOther:checked').val(); if (other != undefined) $('#other').removeAttr('readonly'); else $('#other').attr('readonly', 'readonly'); }); });The above code changes the readonly property on the textbox when the checkbox is changed by the user.
-
Tiny HTPC Movie and Hulu Box Part 5 Conclusion
The two 50mm fans arrived and I put them into their new home. To line them up in the back, I raised them up on a small piece of wood and tie-wrapped them into place. They are the perfect height for the case. I used some aluminum to fill in the blank spaces. I got lazy at the end and used a wood block to plug the last space.
The HTPC made too much noise with these new fans so I made a couple modifications:
- Change fans to run from 5 volt instead of 12 volt (from 5000rpm down to 2100rpm) see here
- Remove some of the metal blocking the PSU fan
The noise is now on par with the original Xbox. I plan to replace the PSU fan with a silent 40mm fan from FrozenCPU to further reduce the noise.
I also removed the casing over the PSU and organized the wires for better air flow. I taped over some of the rear holes so the air would enter from the front and travel across the motherboard.
Temps CPU 1 CPU 2 Northbridge Idle 32 C 33 C 48 C Load 58 C 60 C 55 C The Rear
The motherboard IO panel fit perfectly between the top and bottom of the case.
The Front
I lightly sanded the sharp edges of the black plexi-glass. I did not have any extra fine sandpaper so I used a buffing pad to get a smooth matte match with the case.
The keyboard is a Logitech diNovo Mini and compliments the case really well. The Zotac ITX motherboard allows you to enter the BIOS using the Delete key. So even though the keyboard doesn't have function keys, it will still work in the BIOS.
Here it is in it's final resting place on the fireplace mantel. You can see the Wii on the right for comparison.
I'm very happy with how the custom modded case turned out. The motherboard, PSU, fans, buttons, and black plexiglass all came together much better than I expected. It is a cool, quiet, and beautiful computer. Most of all, it plays every file format and can run video from any website perfectly.
I recently installed Boxee and I've been watching some 1080p files and listening to Pandora all within the same interface. Boxee is definitely the future of the HTPC.