Pages

Wednesday, August 15, 2012

Controllers (ASP.NET MVC)


I had the opportunity to write up a presentation about the Controller part of ASP.NET MVC. With Pro ASP.NET MVC 3 as my guide I whipped up this presentation and some sample code.Feel free to download/read/learn/look at it as you please. 


One of my favorite things about controllers is the ability to return pretty much any type of content that you desire, files, xml, json, whatever. This makes controllers incredibly versatile and allows the developers to give the users power over what they get back (when they want to allow it).


Enjoy.

Friday, February 11, 2011

Mobilificationizing

If you are reading this on a desktop computer, the screen shots are for you. If you have a smartphone or other smaller screened device let me know in the comments how it looks and what does/doesn't work.

I was feeling under the weather recently, and as a result I stayed home from work to sleep longer, take some medicine and get better. After waking up around 10am I realized that there were a few things I was putting off because I didn't have time during the day at work, and most of my free night-time is taken up by a side-project that I've been working on for the last few months (http://studybuddycampus.com) and normal life things.

I took the opportunity to make some changes to my wife's blog about our family. It now has 3 columns and she loves it! Go take a look: http://tommyandalisha.blogspot.com

I finally got around to fixing the obnoxious problem I have when I visit this very site on my phone, the fixed-width sidebar. I know that I haven't been the best at updating and that is partly due to me wanting to play Halo/Call of Duty/etc or just not feeling like I have anything interesting to say. I feel that, as a heavy mobile internet user, I should have a site that looks good on a phone.

My site was slapped together a few years ago using asp.net/c# with master pages. Their was no concern in my mind for a mobile site, luckily master pages are wonderful and all I needed to do was create a duplicate of my existing template and start chopping. First thing I did was move the sidebar on top so that it sits on top of the content it normally flanks. Then I gave each main wrapper a width of 100% so that it would stretch to whatever screen size it was given. I checked it out on my phone and realized that the phone thought the web page was much wider than the phone's screen. I added the following meta tag to prevent this and tell the page to fit the width of the device and not assume a desktop size.




After a few more tweaks to the general layout and adjusting the padding/margins I got the site to look somewhat presentable. I used some fancy jQuery magic to get the sidebar er...menu to show/hide when the arrow in the upper right-hand is touched.



Now all I needed to do was redirect users to the correct master page when visiting my site on a mobile phone. I found the following code online and added it to all pages in need of the mobile layout.



After that was in place I realized that images from my posts were a little bit too wide for the average phone screen. Instead of manually resizing all of my images, I once again turned to jQuery for some help. Using an example I found, I check each image's width, if it is wider than the current width of the body tag, it reduces its size to fit nicely within the confines of the given screen.



All in all the process was fairly painless to convert an existing site, most of the work was getting the formatting correct. In the future I'd like to build a site from the ground up with current mobile browsers in mind, but that's for another sick day...

Thursday, February 3, 2011

HTML 5

Just got some cool new HTML5 stickers to show off. Now it's time to add some new features to my site.

This also serves as a test post with the official Blogger for Android app.


Thursday, December 23, 2010

My Top Android Apps for 2010

As Android has grown in popularity and the range of devices has widened, many of my friends and family have been getting Android phones. This list is supposed be a starting point for those getting a new Android phone or really wanting to get the most out of the phone they already have.

TweetDeck [Free] - By far the quickest and easiest way to view and reply to Twitter/Facebook/Buzz updates on Android.  The columns can be customized to display all updates or only the updates from certain services or people.  They also have a Desktop and Chrome App version.

LauncherPro [Free] - While I appreciate the default homescreen, I can't be limited to just three icons that I can't change. LauncherPro does many things, I can switch the number of homescreens from an unwieldy 7 down to a manageable 3-5. It also gives me secondary actions for all 5 icons on the bottom of the screen, for example if I swipe up on my messaging icon it takes me to the Compose Message screen, saving me time and a few steps.  There are many other reasons, but these are the most prominent.

Angry Birds & Angy Birds Seasons [Free] - Best time waster ever.  Both are free, though they include some semi-obtrusive ads. I would pay good money to go ad free.

Dropbox [Free] - If you are familiar with Dropbox.com you will no doubt love the Android companion app.  Dropbox is a file syncing service that is accessible from pretty much anywhere you have an internet connection.  You add files on the web, phone or computer and within seconds they are accessible on all devices.  This is very useful for backing up files from your phone.  I use it to save pictures taken with my phone in case it gets lost or stolen.

AppBrain [Free] - While the Android Market client recently received a facelift, it still lacks a real web-based component for browsing market content.  Google showed off the web-based market earlier this year, so expect it some time next year.  In the meantime use AppBrain, which lets you browse apps on the web, then queue them up for install on your device. All links to apps on this page go to appbrain.com

Google Maps [Free] - I could not live without Google Maps in my pocket, I would have been lost many times over. The latest update added offline support, new vector-based maps (which take up less memory) and 3D maps for most Android 2.2 devices. Overview of features at Google Mobile Blog.

Movies (by Flixster) [Free] - Great for seeing what is playing at your local cinema, what is being released on DVD/Blu-Ray/Digital Download, and managing your Netflix queue.  You can even log in with your Facebook account and upload reviews of movies to shared with your friends.  Access to showtimes, release dates, trailers and Netflix make this a must-have for entertainment junkies.  Check out the IMDB app if you need info on TV shows.

Gmail [Free] - Yet another app that is being used all day long. I almost like it as much as the full desktop web version.  I use this to triage my mail when not at my computer, and as a scratch-pad note system since Gmail syncs drafts.  The latest update added a refreshed compose screen with support for multiple sender addresses and easier reply options.

CalWidget [Free] - Like Gmail, I have Google Calendar setup in a meticulous manner to help me remember things and make sure I'm not late paying my bills or wishing someone a happy birthday. The default Android calendar widget shows one event for the day, it looks pretty but isn't very useful. CalWidget lets me pick a size so I don't have to take up an entire homescreen, unless I want to. If you have an HTC, Samsung, or Motorola phone, you may already have a decent calendar widget, if not this one is well worth the download.
I probably missed a lot of great apps, this is just a small list that I use very often. Let me know in the comments of your top Android apps.

Saturday, October 2, 2010

How to Create a Custom Shortcut in Android

I'd been wanting a quick and easy way to compose a new email.  I tried my hand at whipping up a simple program that just installed a homescreen shortcut, but ran into namespace issues and didn't feel like putting more than an hour into it.  A few days later while messing around with my homescreen shortcuts/widgets and discovered how to use the Custom Shortcuts option available in some aftermarket launcher programs such as ADW Launcher and LauncherPro.  I've been running CyanogenMod 6 (based on Android 2.2/Froyo) for about a month now, which includes ADW, so my screenshots and examples will reflect that.

Any Android hacks you'd like to share in the comments?


How to Create a "New Email" Shortcut (Google Doc)

On the homescreen and either long-press on empty space or hit Menu, Add:

Select "Custom shortcut" from the list:

Select "Pick your activity":

Select "Activities" (this displays a list of all activities for every installed program):

Tap "Gmail" in the list:

Sift through the various activities available within the messaging app to find "Compose(.ComposeActivityGmail)":

Once you have selected the activity, it will return you to the Custom shortcut dialog.  
Enter a name, if you don't like the default, that will display on the homescreen (you can also change the icon by touching the default icon.)  Hit "Ok" when you are done:

Huzzah! You've added a Custom Shortcut


These instructions relate to semi-stock Android 2.2 your mileage may vary.  You can also do the same for pretty much any other application that has a "Compose..." or "Edit..." activity.  I was able to create a New Gmail, New Event, and New Tweet shortcut, just had to hunt the right activity down in the list (though this didn't work for the default messaging application).  Enjoy!

Thursday, June 17, 2010

2010 Goals - Update (almost 6 Months)

I started a list of goals at the beginning of this year of things I would like to do or accomplish.  We're about half-way through 2010 and I wanted to update my list to see how I'm doing.  Some goals are not ones that I simply achieve and then move on, so I'm not marking those off completely.

  1. Don't use my phone while driving (except to answer a call or navigate) - I've been trying hard to do this, but keep finding excuses to use my phone while I drive.  Still working on this one :(
  2. Add a blog to my sad little website - The fact that you are reading this proves I added a blog component to my site.  It could use some work, but it is here.
    1. Publish 1 technical blog post each month - Yeah this didn't happen.
    2. Post at least once a week - Neither did this, it seems I mixed them up and post only once a month, and not always on something technical.   Blogging on a regular basis is hard.
  3. Only use Twitter on my phone while at work - This lasted about a month, I've been pretty good about reading on my phone and occasionally posting on my computer.
  4. Only check Google Reader at home, or on my phone at breaks. - This lasted about a week, I mostly do it on breaks, so I have scaled back considerably.
  5. Get our house ready for a baby (paint, furniture, etc) - We've painted and are in the process of getting the furniture ready to go.
  6. Help Alisha get her photography business going
    1. New computer/laptop - We've setup my desktop and she's been using that
    2. Photoshop - Not yet - Alisha loves http://picnik.com, it works for most everything she needs.
    3. Camera stuff (umbrella flash, hot shoe flash) - We got another drop-cloth and browsed lighting options
  7. Develop my own Android app, and publish to the market - Boom! (May) and recently updated (June)
  8. Organize the garage (get shelves and such for walls) - Not yet
  9. Organize the Master Closet - Not yet
  10. Organize the front room/office - Not yet
  11. Go through the boxes in the guest closet, toss/store farther away from sight. - Not yet
  12. Buy/make bed frame for master bed. - Not yet
So, I'm half-way through the year and less than half-way through the list, I'll continue updating my Android app, helping Alisha with her Photography business and we'll continue working on the house.  Now, that we are expecting (we found out in March) some of the goals may have to wait in order to accommodate our new child.

Sunday, June 6, 2010

BitDroid v0.5 Has Been Released

My second first update has been released and is ready for immediate consumption/updating.  I've added a dashboard and an "action bar" after reading up on  Android's Evolving UI Patterns on the Android blog.  The dashboard and action bar will continue to evolve as it is developed.

Dashboard

I've also added the ability to shorten a URL, wow, what would a bit.ly app be without the ability to shorten a url...you can also expand bit.ly urls.

Shorten URL



Other changes include validation on the login screen with username and api key and some bug fixes.  Go grab it now and let me know what you think.