Convert Excel date format to asp.net DateTime

Posted by Gary Jorgenson | ASP.NET | Thursday 2 October 2008 4:46 pm

I’m working on a project that requires reading an excel spreadsheet, doing some date math, then updating a database. The first part was pretty easy using Infragistics excellent excel componant.  All it requred was the following line:

Dim workbook As Infragistics.Excel.Workbook = Infragistics.Excel.Workbook.Load(NewFilePath)

The problem occurred when I tried to retrieve a date value from the workbook and store it into a DateTime value.  My code blew up with an error saying it could convert Double to DateTime.  Easy enough, I determined that Excel stores date values as a Double representing the number of days from January 1, 1900.  Being the lazy guy I am, I figure some other really smart developer has written a function to convert an excel date to DateTime.  So I set out to google some solutions!

Amazingly I find several interesting links explaining that it’s not so easy.   Eric Carter’s blog had some interesting information, great code samples and links to dig deeper:

http://blogs.msdn.com/eric_carter/archive/2004/08/14/214713.aspx

The first very interesting article he linked to was Eric Lippert’s Blog titled “Fabulous Adventures In Coding”.  Here’s a link:

http://blogs.msdn.com/ericlippert/archive/2003/09/16/53013.aspx

Then another interesting article with some insight into Microsoft and Bill Gates can be found here:

http://www.joelonsoftware.com/items/2006/06/16.html

Having been enlightened by all this, I set out to write a VB version of Eric Carter’s logic when i stumbled on this:

http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/f8870029-4448-48cf-8ae9-71608f0195ab/

Dim d As Date = Date.FromOADate(39051.4387847222)

MessageBox.Show(d.ToString)

DateTime.FromOADate() was all I needed!!

The “OA” stands for OLE Automation compatible.

Anyway,  I’m alittle smarter tonight than I was this morning.  Thanks Eric Carter, Eric Lippert, and Joel Spolsky for such great info!

Tips for buying a new computer!

Posted by Joe Jorgenson | General | Wednesday 24 September 2008 10:27 am

The first thing to do when looking for a new computer is to determine what you plan on using it for. Many people go for the most expensive and flashiest computer they can find. That’s like using a canon to kill a mosquito! Here are some tips that will help with you decision.

1. Laptop versus Desktop

The biggest question is do you need to travel with your computer? Most people will lean towards a laptop in case they ever need to travel with it. This seems like a good decision but keep a few things in mind when looking at that new laptop. They’re generally more difficult to repair. A lot of repair facilities that can fix any problem with a desktop computer do not even try to work on laptops. You will be severely limited if you ever decide to upgrade your machine. Nearly all laptops will allow you to add more RAM (Random Access Memory or System Memory) but with most that’s where it stops.

Laptops are generally more expensive to fix. Because of the small case and unique architecture most laptop’s system components can only be replaced by that exact same part. For instance Apple is fond of retooling their system architecture from model to model. A 7 year old laptop that needs a new system board could easily cost over $800 for the part alone. Once they stop making the part the price goes up quickly. If you were looking at most any desktop unit you could pick a similar system board off the shelf at your local PC store and replace for under $150.

2. Repair-ability

You should always consider what it will cost to repair the computer you are purchasing. Unless you’re able to find that one computer store that promises to sell you a machine that will never break. If you believe that I have a bridge you might be interested in!

Like I said in section 1 laptops generally score very low on the repair-ability scale. The same goes for Compaq and Hewlett Packard machines, in my experience. Compaq was especially fond of coming up with new case design including bridges over the components to hold the power supply or oddly shaped system boards to fit their unique cases.

To find a machine that scores high on the repair-ability scale I like to go for the generic or ‘clone’ models. Micro Electronics sells PowerSpec computers through all of its retail locations, Micro Center. These machines are as generic as they come, which is great when you need to repair it. You can usually grab any power supply, one of a dozen system boards, and any CD drive you would like when it’s time to replace those things.

One warning about clone machines, stay away from units with on-board sound and on-board video. This means that the sound and video cards are built onto the system board. If one of those devices goes bad you will have to replace the whole board to get it done. This will also limit your ability to upgrade those components. So, going with the $300 clone machine seems like a good buy, but you’re shooting yourself in the foot when it comes to repair and the ability to improve the machine!

3. What are you going to use the machine for?

There are so many possible uses for a new computer so I’m just going to cover a couple of scenarios.

Big time gamer – If you’re looking to conquer the universe or become the next Halo 3 champion then you need a system with 3 things. You need an awesome video card, something with at least 256MB of RAM. RAM is also referred to as system memory. This controls the amount of data or applications your computer can process at one time. Think about sitting in front of a desk. The drawers are like your hard drive, the bigger they are the more stuff you can store. The desktop is like your RAM. The bigger it is, the more documents you can lay out at one time. The second thing you will need is plenty of system memory. Your machine should have at least 1gig of RAM. The third thing you will need is a fast processor, preferably something above 2 gigahertz.

Internet Junkie and Chronic Blogger – You don’t need a very fast computer to surf the internet, only a fast connection! Look for a machine that fits your price range above all else. Any computer made after 2005 will allow you to surf the internet and blog to your heart’s content!

Homework and research – The same is true for this group as with the Internet Junkies. You only need a machine that will be reliable and can connect to the internet.

The biggest mistake that people make is over-kill. They buy a $2,000 machine when an $800 one will do everything they will ever need it for.

Gallagher Family Photos

Posted by Jeremy Jorgenson | Photography | Monday 22 September 2008 8:20 am

Talk about a very photogenic family! They were alot of fun to shoot, and now we’re shooting Rachel’s (the oldest daughter) wedding!

Learn to keep swimming in the world of design.

Posted by Eric Meinen | Art & Design | Friday 12 September 2008 2:23 pm

theguardroom.com - a recent redesign.

It’s too easy to get comfortable as a designer. A lot of artists find a style that they like, and before you know it, every website they create comes out looking the same. For a while, this may not be a problem, especially if the style that they have latched onto is “in”. The thing about art and style though, is that it always changes, and what’s “in” now can be “out” tomorrow. (Multiply this speed of change by 100 in the online world.) 

A designer who is not constantly pushing themselves, looking for new trends and learning new tools runs the risk of becoming stale and outdated. The problem is that it’s so easy to get complacent, especially if being a designer is your JOB. That’s why I love working at Robintek, we all love what we do, and our whole team is constantly looking for new ways to do things. That goes for the designers as well as the programmers (who at Robintek are often one in the same.) We specialize in creating custom built websites for our customers, and each design has to be unique AND match our clients’ needs. If all of our sites end up looking the same, we’re doing a great disservice to our customers. Check out our portfolio here - http://www.robintek.com/pages/web/default.asp to see the diversity of our design.

 I see the online world as a giant river, with Robintek paddling upstream and new trends and ideas are constantly flowing towards us. Now, if we latch onto something, we may stay afloat for a while, but eventually we’ll be swept away. If we stop swimming all together, we’ll drown.

The only way to survive in this business is to keep swimming, be aware of what’s going on, keep learning and pushing yourselves. For a designer, don’t be afraid to just surf the net. See what’s out there. There are so many blogs and sites dedicated to web styles and trends. Take online tutorials and join online design communities. Look at what different kinds of medias are doing – for me, print ads and television commercials tend to be a great source of inspiration. Go to an art museum. The classics will always work. A Picasso is not going out of style.

Here are some of my favorite informational and inspirational sources:

http://www.webdesignerwall.com/

http://drawn.ca/

http://bestwebgallery.com/

http://www.flashkit.com/

http://blog.wearpalettes.com/

-Eric Meinen

robintek.com

Custom Web Design versus Generic Templates

Posted by Joe Jorgenson | Art & Design | Friday 12 September 2008 1:51 pm

custom design

Business owners are always looking for ways to save money and make their business profitable. When it comes to creating a website, just like your marketing materials and office space, you should be concerned with the image you are portraying. The more professional your business appears the more credible it is.

A lot of people don’t understand the difference between a custom web site and generic site that was built using a template or inexpensive service. Hopefully, this article will help!

Many people think that creating a custom website is too expensive but let’s look at the advantages of going this route, over using a template. The first and most notable advantage is that a custom built website will have a completely unique design. This design was created just for your company to match your existing branding guide, your industry standards, and with YOUR customers in mind.

A custom website is much more scalable to your needs. Your budget may not allow you to create the end-all website of your dreams right now, but there is a good solution. You can discuss your goals and features that you would like to eventually incorporate into your site with your developer. A good designer will take this into account when building your site. Then you can come up with a plan to implement those features over a 6, 12, or 18 month period.

Before you choose a route, template versus custom, you should sit down and make a list of everything you would like to have on your website as if money was not a concern. When doing this you should look at your competitors websites, look at sites you like to use that might not be associated with your industry, and look at some of the largest companies on the internet like Amazon.com or eBay.com – What are they doing that is making their website so beneficial to their company?

Website maintenance should also be considered. Just because a website template does most of the work, it still leaves plenty for you! A custom site can incorporate a content management system that allows you to post articles, change content in the most visible sections and keep your website up to date. There’s nothing worse than visiting a company’s website that you are considering using and seeing a press release on the homepage from July of 2005! It doesn’t exactly instill confidence in the user.

The last item I would like to point out in the argument for custom sites versus templates is the graphics that are used. When you purchase a website template it comes as a package deal. You are allowed to use the images on the website, but can you use them on your business card-signs-brochures? Having a unified corporate image is an important marketing tool. Your business should decide on a design format, and then stick with it! If the graphics that were included with the template are all low resolution then there isn’t even the option to use them on printed items. You see, a web site’s graphics only need to be 72dpi (dots per inch) while printed graphics need to be 300dpi to appear clear. If a designer creates a website for your business from scratch he/she can produce a high resolution version of every graphic used.

All of that aside, there are several upsides to using template services. If you need to get a website posted quickly and have a very small budget then they are the way to go. You should be aware of the downsides before you commit anything more than a few hundred dollars or too much of your time. It’s also a good idea to consult with a professional once you have posted your site. The web developer can spend a few hours checking for coding errors that could affect search engine placement. Submitting your site to the major search engines or just giving you some tips on maintaining your site or ways to improve it.

Every company has to make the decision for it-self but keep in mind – the internet is here to stay! Those people who effectively market or provide services over the internet will win every time!

-Joe Jorgenson

robintek.com

ASP.NET ResolveClientURL: Outside of Page scope

Posted by Gary Jorgenson | ASP.NET | Monday 1 September 2008 9:48 pm

I have several processes that run outside the scope of a Page object.  It appeared to me that the ResolveClientURL was not available outside the Page context.  In order to get around it, I added the following function to my common library…

Public Shared Function ResolveClientURL(ByVal cPath As String) As String
Dim gc As HtmlGenericControl = New HtmlGenericControl
Return gc.ResolveClientUrl(cPath)
End Function

This takes advantage of the ResolveClientURL method that’s part of HTMLGenericControl.

What is FTP?

Posted by Gary Jorgenson | General | Tuesday 15 January 2008 3:31 pm

The letters FTP stand for File Transfer Protocol.  This is the most common way people transfer files from computer to computer over the internet.

It’s possible to connect to an FTP site using a browser like Internet Explorer or Firefox.  All you have to do is enter ftp:// instead of http:// followed by the address:

Example: ftp://ftp.microsoft.com

 If the site requires a login name and password, it will prompt you.

FTP Client Software 

An FTP client is designed to help you transfer files between two computers over the Internet. Most FTP programs use a “split-window” layout. The window on the left displays files on your computer and the window on the right displays the remote computer. Transferring files can be as easy as dragging-and-dropping files from one window to the next.

Suggested Software

There are several FTP Client programs to choose from. Some free, some not.  As with most software, generally speaking the more it cost, the easier it is to use.

CuteFTP by Globalscape

My personal favorite.  At time of this writing, the home version costs $39.99 and the Pro version costs $59.99

FileZilla

A free FTP client program that is actually quite good.

How do I navigate “My Computer”

Posted by Gary Jorgenson | General | Tuesday 15 January 2008 12:35 pm

What is a drive?

 A drive is where information is stored on the computer.  Years ago it was much simpler as there were only a few types of drives. We had hard drives and floppy drives. Today there are many more options such as CD-ROM, DVD-ROM, Thumb Drives, etc.

 A hard drive or “hard disk” drive is is typically inside the computer. Almost every computer today has at least one hard drive and one CD drive.  The hard drive is usually referred to as the C:\ drive and the CD is drive D:\.  This can get confusing though since computers with more than one hard drive might cause the CD drive to have a different letter designation.

If the computer has a floppy drive, it’s usually referred to as drive A:\.  When you select “My Computer”, you might see a window open similar to below:

mycomputer.jpg

To open a drive, double click on its icon.

What is a folder? 

Folders (sometimes called directories) are used to organize the information on a drive. An easy way to visualize how folders work is to think of them like a tree with branches.  The beginning of the drive is often referred to as the “root”.  You might hear terms like “look on the root of drive C:\”.  Each folder or directory is a branch under the root.  A typical tree view of folders might look like this:

treeview.jpg

To expand a tree branch, click the “+” symbol to the left of the folder icon.

How to pick a domain name

Posted by Jeremy Jorgenson | General | Tuesday 8 January 2008 10:16 am


When starting a new business, one of the first things you must do is choose a title. The same holds true for websites. The title or “domain name” will become an important part of the company brand. Here are some tips for selecting a good domain name:

A. The name should be as short as possible.
thelongestlistofthelongeststuffatthelongestdomainnameatlonglast.com may be a witty name, but it’s not easy to read, not easy to say, and likely not easy to remember. It’s also not likely that you’ll find anything under 5 characters.

B. The name should be hard to misspell.

    Try to find a name that only has one correct spelling. Visitors looking for the online training website “lynda.com” may mistakenly enter “linda.com”. Also avoid names that include common spelling or grammatical errors (”ie” vs “er”, “there, their, they’re”, etc.).

C. The name should be easy to remember

    You may not be able to get the domain name that most closely matches your business. In some cases you might be better off to pick an oddball name. That’s worked pretty well for google and yahoo.

D. The name should not have multiple meanings.

  • Some interesting examples are:
    • Speed of Art (speedofart.com)
    • IP Anywhere (ipanywhere.com)
    • Via Graphics (viagrafix.com)
    • Experts Exchange (expertsexchange.com)

E. Make sure the name is not trademarked or copyrighted.

    If you were lucky enough to land a domain name like generalmotors.com, it’s not likely you’ll get to keep it. The governing body of domain names (ICAAN) has what’s called the Uniform Domain-Name Dispute-Resolution Policy.http://www.icann.org/udrp/udrp.htmIt basically means if you register a domain name and another company disputes your right to it, you might lose the domain name unless you can provide a valid use for it.

F. The name should not include dashes.

G. Always try to register the .com extension, or “Top Level Domain”

    1. What is a Top Level Domain
    The top level domain is the last part of an Internet domain name. These are the letters that follow the last dot of any domain name. For example, the TLD for Robintek.com is “.com”Different kinds of TLD’s
    Country code top-level domain: Generally reserved for a country or independent territoryGeneric top-level domains:

    .com Commercial Open to any person or entity to register.
    .net Network Open to any person or entity to register.
    .org Organization Open to any person or entity to register.
    .info Information Open to any person or entity to register.
    .mobi Mobile Must be used for mobile-compatible sites.
    .biz Business Registration may be challenged if not a commercial entity.
    .name Individuals Registrations may be challenged if not a individual.
    .edu Educational Limited to institutions of learning (mostly US colleges, etc.).
    .gov Governmental Limited to governmental entities and agencies. (mostly Federal Level)

How do you find out if a domain name is available?
You can search for and register domain names using various Domain Name Registrars. These are companies accredited to register domain names. Until 1999, the only company available to register .com, .net, and .org domain names was Network Solutions (http://www.networksolutions.com). Their standard fee was $35/year to register .com. .net, or .org domain names. After 1998, domain name registrations were opened up to several companies, which drove down registration prices. Currently you can register domain names for as little as a few dollars per year. The following is a list of some popular domain name registrars:

A. What about deleted domains?

    If a domain name is allowed to expire, following a brief grace period, it is released back into public domain and can be registered by anyone. There are several websites that provide a search function for deleted domain names. One such website is http://whois.net.

Website Hosting
Once the domain name is registered, the next step is to establish a hosting account. One analogy could be to compare registration/hosting to a library card index system. Suppose you’re the author of a book and you’d like it to be available to the public. You go to the library and ask to place your books “registration” in the card index. That index tells visitors your book name and where it’s located. The index doesn’t however guarantee that your book will be on the shelf. Purchasing a hosting account would be similar to having the librarian assign you a particular spot on the bookshelf. With a website, the hosting account is the actual computer server that where the website is located.

Many domain name registrars also provide hosting. In most cases, when you attempt to register a domain name, the registrar will attempt to sell hosting services as well. It is not necessary to host your website at the same company where you registered the domain name.

 

Setting up spam filters in Outlook 2002

Posted by Gary Jorgenson | General | Sunday 6 January 2008 6:55 pm

We have several processes in place on the server to filter spam emails.  By default, we do not block these emails.  What our server does is insert text into the message header to indicate which emails failed the spam tests.  We have two levels of testing, Sniffer, and X-RBL Warnings.  To take advantage of these filters,  you’ll need to add email rules in Outlook.  Following are instructions for Outlook Version 2002.

Note: This only applies to customers having email accounts with us.

Click on the Tools menu at the top of the screen, then select Rules Wizard:

You should see the following screen:

ruleswizard.png

Click on the New button.  You should see the following screen:

outspam2.png

Select the option to Start from blank rule.

On the next screen, check the option to “Check messages when they arrive

outspam4.png

Click on the Next button.

outspam5a.png

This screen allows you to select one more conditions your rule applies to.  Scroll down this list and check the box next the option “with specific words in the message header”.  The rule description will appear in the white box below.

outspam5.png

Click on the “specific words” link to add a rule:

sn1ffer.jpg

In the box above, add the word “SN1FFER”, click the Add button, then click the OK button.

outspam8.png

On the screen above, you can either choose the option to “move it to a specified folder, delete it, or permanently delete it. If you choose the option to delete it, the system will re-route the messages into the “Deleted Items” folder.  Choosing to permanently delete will delete them immediately.

outspam9.png

If you’ve created a special folder to hold the spam emails, select this folder. Click the OK button.

outspam10.png

The screen above is for exceptions. No changes need to be made here so click the Next button.

outspam11.png

The final screen allows you to give your rule a name. If you’d like to run this rule on messages already in your inbox, check the box labled Run this rule now on messages already in Inbox.”

When you’ve selected the desired options, click the “Finish” button.

Next Page »