Stock Ticker Tape Widget for Android

by Jeremy Huntsman 4. August 2012 10:27

Reviewers' Choice. Stock Ticker Tape Pro Widget for Android Stock Ticker Tape Widget for Android

Recipient of the FileDir.com 2012 Reviewers Choice award, the Stock Ticker Tape Widget for Android is a dual layer scrolling stock ticker similar to the CNBC ticker. It features customizable watchlists with an extremely easy to use stock symbol search feature.  It also features the ability to customize the background and text color of both tickers. The application quickly achieved the #1 spot on the top new paid finance apps on Google Play. The free version is limited to a preset list of high volume stocks and major indices.

Stock Ticker Tape Widget for Android

Free version: Stock Ticker Tape Widget

Pro Version: Stock Ticker Tape Pro Widget

Screen1 Config_Step1 Config_Step2 Config_Step3

Tags:

Stock Ticker Tape Widget

Visual Studio and WinMerge – A Happy Marriage

by Jeremy Huntsman 2. February 2011 01:03

One of my favorite tools is WinMerge, I use it virtually every day. It is an open source directory and file comparison tool that presents the differences both textually and visually in a clean and concise way.  I not only use it for simply comparison tasks, but also for deploying modified files to testing and staging environments.

I few months ago I discovered that WinMerge accepts command line parameters. I always appreciate it when developers create applications that accept command line parameters because it increases the applications usefulness tremendously. Like many developers, spend a significant amount of time in various versions of the VS IDE, therefore I have a simple equation to improve my productivity:

tool that accepts command line parameters + tool I use frequently = create VS external command

As documented here, WinMerge accepts several command line parameters including source (left) and destination(right) paths. By taking advantage of these, you can create an external command that you can execute from the tools menu (I’ve actually taken it a step further and created a WinMerge menu on my main tool bar) as an external command. This automatically brings up WinMerge with your current project as your source and your preconfigured destination. From there, comparison and deployment is just one click away, sweet!

Here’s how:

  1. Download and install WinMerge here.
  2. Open VS , any version will work, I’m using VS 2010.
  3. Go to Tools –> External Tools
  4. Enter the values per the instructions below:
    • WinMerge accepts source and destination command line parameters similar to a basic XCOPY command. So the command is very simple: C:\Program Files\WinMerge\WinMergeU.exe $(ProjectDir) "\\192.168.1.1\c$\MyWebDirectory\MyApplicationDirectory\"
    • For the source path, Visual Studio provides the working project directory through the “$(ProjectDir)” variable. This will open WinMerge using your current project as the source.
    • The destination path is a static value and is whatever directory you wish including UNC shares.WinMerge
  5. Once you’ve edited the command and arguments, give it a useful title and click OK.
  6. You can now open WInMerge from within VS and it will open up with source and destination paths displayed and ready to compare.

WinMerge2

Tags:

Visual Studio | Tips and Tricks

Using the ASP.Net Ajax Abstraction API

by Jeremy Huntsman 6. June 2010 08:49

I’ve been using ASP.net Ajax for several years now. However, I think I’m guilty of just using it for it’s obvious payloads like the update panels and AJAX control toolkit. There of course are several other advantages of it including the abstraction API.

The abstraction API is a feature that allows you to write JavaScript without having to worry about browser dependency. It consists of two client classes: Sys.UI.DomElement and Sys.UI.DomEvent. If you use these classes, you interact with the AJAX abstraction API rather than directly with the browsers API. You call methods within these classes and let the abstraction API do the tedious work of calling the correct function based of the browser that is rendering the page. No more worrying about ‘attachEvent’ vs ‘addEventListener’. Instead you have one clean ‘addHandler’ method from the DomElement class.

Building off an example in one of my favorite books, ASP.Net AJAX in Action, here is a simple but effective way to take something that normally is tedious and make it very simple. Lets improve the user experience and aid in the client side validation process by adding a keyboard handler that prevents certain keys from functioning. Once your JavaScript file is setup and referenced you can do this in one line of code..sweet! I use this in virtually all of my web projects.

1. First create your JavaScript file, this example has three validation functions. In the code snippet below, notice the object ‘evt’ being returned? That is an instance of the DomEvent class and provides a wealth of information. Specifically eight key properties:

DomEvent.rawEvent Underlying event data object.
DomEvent.shiftKey True if Shift key is pressed.
DomEvent.ctrlKey True if Control key is pressed.
DomEvent.altKey True if Alt key is pressed.
DomEvent.button A Sys.UI.MouseButton enumeration indicating if the left, middle, or right mouse button is pressed.
DomEvent.charCode Character code of key pressed.
DomEvent.clientX X coordinate of the mouse.
DomEvent.clientY Y coordinate of the mouse.

 

  1. function onlyAlpha_KeyPress(evt){  
  2.     var code = evt.charCode;  
  3.     if (!((code > 64 && code < 91) || (code > 96 && code < 123))){  
  4.         if (evt.rawEvent.charCode != 0){  
  5.         evt.preventDefault();  
  6.         }  
  7.     }  
  8. }  
  9.  
  10. function onlyNumeric_KeyPress(evt){  
  11.     var code = evt.charCode;      
  12.     if(code < 48 || code > 57){  
  13.         if (evt.rawEvent.charCode != 0){  
  14.         evt.preventDefault();  
  15.         }  
  16.     }  
  17. }  
  18.  
  19. function onlyAlphaNumeric_KeyPress(evt){  
  20.     var code = evt.charCode;  
  21.     if (!((code > 64 && code < 91) || (code > 96 && code < 123) || (code > 47 && code < 58))){  
  22.         if (evt.rawEvent.charCode != 0){  
  23.         evt.preventDefault();  
  24.         }  
  25.     }  

2. Reference your newly created JavaScript file:

  1. <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"> 
  2.     <Scripts> 
  3.         <asp:ScriptReference Path="../JavaScript/AjaxKeyboardHandler.js" /> 
  4.     </Scripts> 
  5. </asp:ScriptManagerProxy> 

3. Put it into action via $addHandler(domElement, eventName, eventHandler):

  1. $addHandler($get('myTextBox'), 'keypress', onlyAlpha_KeyPress)

That’s it. You know have a fully cross browser capable keyboard handler. This normally extremely tedious task can now be implemented in one line. The best thing about it is that it is totally reusable and customizable in all of your projects. Please note a simple keyboard handler is not fail safe and doesn’t prevent simple workarounds like copying and pasting data in your text box so make sure you always validate server side.

See a live example here.

kick it on DotNetKicks.com

Tags: ,

ASP.net | AJAX

10 simple steps to a better ASP.net web project

by Jeremy Huntsman 23. May 2010 05:19

The development team I work with have designed and developed a few large projects recently and we've definitely learned quite a bit from each of them. Many of us work in different locations, have different skill sets, program in both VB.net and C#, but work on the same projects. Based off my personal experience, I'd like to share some tips that have helped me create better software. Any development team could benefit greatly from some simple practices that will increase code reuse, improve standards compliance, increase productivity, and make it easier for team members to maintain each other’s work. This in turn improves the overall quality of our software.

  • Project Structuring
    • Create separate folders for each programming language, C# and VB.net (and of course others if you use). To do this for multiple languages, you need to add a codeSubDirectories node to the compilation section of your web.config file.
    • Below that, create sub folders for each file’s/class’s scope. i.e. a “DataAccess” folder for data access, a “Business Objects” folder for business objects, a “WebServices” folder for Web Services. This will make it easier for team members to locate a specific file/class.

  • Namespacing
    • Namespacing should be used and explicitly declared in each class the team develops. The namespaces should clearly describe the classes function and be grouped according to its role and project. This makes it so much easier to find what your looking for in a large project, not to mention looks nice and clean in the object explorer. For example:
      • MyCompanyName.ProjectName.DataAccess
      • MyCompanyName.ProjectName.BusinessObjects
      • MyCompanyName.ProjectName.Enum

 

  • Inheritance and Basing
    • Repetitive properties and members should be placed in a base class and marked MustInherit(VB.net)/Abstract (C#) to promote reuse. Good candidates would be a "DALBase", "PageBase", and "ErrorLogBase".
    • One instant and no brainer benefit to centralizing your database connections in your "DALBase" class is the headaches it saves during the applications life-cycle and maintenance. One simple change effects how all of your data access code hits the database.

 

  • Implement IDisposable
    • In classes that use managed resources implement IDisposable and do all cleanup in the dispose function.
    • This will improve memory leaks, close any open datareaders, and close any open database connections, etc.

 

  • Data Access Layer
    • The DAL should never represent database columns as an ordinal, i.e. “myDataRecord.GetString(43)”. Columns should always be represented as the textual name of the column i.e. “myDataRecord.GetString(myDataRecord.GetOrdinal("CustomerID"))”.
    • The DAL should not contain any validation, this should be done by the Business Object.

 

  • Business Objects
    • Business objects should be created for frequently used tables and should all be designed in a similar fashion.
    • No database activity should occur in the Business Object.
    • Business objects should simply be a proxy to the DAL and contain validation when setting it’s properties. If the validation is invalid and you haven't created custom exception classes, then at a very minimum throw an exception of ArgumentException(“xyz value is not valid, must be a positive integer”) .
    • Business objects should be validated before sending it to the DAL.
    • I recommend creating a streamlined approach in which each field in the database has a corresponding property. Each Business Object would have one “Save()”, “Delete()”, and shared(VB.net)/static (C#) factory “CreateItem(pass in primary key) as ClassBeingCreated” method.

 

  • Debug with Firefox and Firebug add-on
    • Firefox is more standards compliant than IE and provides a better, which provides you with an immediate view of how compliant your HTML/XHTML is. Chances are that if it renders correctly in Firefox, it will also render correctly in IE, but the opposite is hardly true. Obviously testing in IE should still occur. In case you don't know how to do this, here's a post from ScottGu on how to change the default browser VS uses for debugging: http://weblogs.asp.net/scottgu/archive/2005/11/18/430943.aspx
    • The Firebug add-on for Firefox is absolutely invaluable and a huge time saver for client side debugging especially AJAX.

 

  • Change !DOCTYPE declaration from the VS2005/2008 default of XHTML Transitional to XHTML Strict
    • The XHTML Transitional !DOCTYPE is meant more for transitioning legacy applications from VS2003 or earlier. If you are starting a new web project, best practice recommends you use Strict.
    • This will force you to comply with XHTML 1.0 Strict standards and write more compliant XHTML. Remember, XHTML promotes separating presentation from content so many simple tags like “align” and “center” are not supported. Instead XHTML requires you to use CSS. Here is an excellent resource in determining which tags are not supported in XHTML strict: http://www.blackwidows.co.uk/resources/tutorials/xhtml/attribute-comparison.php.

Old DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

New DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 

  • VB.Net Options
    • I prefer that Option Explicit and Option Strict explicitly be set to “on” in each class. I realize this can be set globally in web.config, but declaring it explicitly in each class leaves no question as to the authors intention.

 

 

I'm hopeful folks find these tips useful. They're simple, but practical and will help you develop a better solution.

 

kick it on DotNetKicks.com

Tags:

ASP.net

Windows Server 2003 FTP User Isolation

by Jeremy Huntsman 22. May 2010 10:31

I was tasked with setting up and FTP site for use by one of our customers. Unfortunetly I have to use the built in FTP features in Windows 2003. The site I was creating needs to be highly secure and have strict control over user access. While researching Windows Server 2003 user FTP setup I found an interesting feature called user isolation. This makes controlling access to your FTP a cinch. When creating your FTP site (I ussually delete the deafult site and create a new one...call me picky), simply select "Isolate Users" from the FTP creation wizard to enable this mode.

Once you have finished the FTP creation wizard, user access control is all about your folder structure. Create a subfolder under your main FTP directory that matches the name of your domain, we'll call it "mydomain". Then, from there, simply create subfolders under the "mydomain" folder that matches the windows user account that needs FTP access. Thats it...logon with a windows account that matches the subfolder you created (don't forget to prefix your username with the domain name mydomain\username) and your in. Super easy to manage!

Tags:

FTP

About the author

I am a software engineer for Applus+ Technologies. I have been working extensively with the .Net Framework, SQL Server, Oracle, and several message queuing technologies for about 8 years. I also am a Windows Media Center enthusiast. I am happily married with two awesome boys.

Jeremy

My Android Apps

OBDII DLC Lookup Tool

Check out my Google Gadgets

Washington Emission Queue Cams

Add to iGoogle

Illinois Emission Queue Cams

Add to iGoogle

And just to prove it can be done in a program we don't operate in...Wisconsin Emission Queue Cams

Add to iGoogle

Tag cloud