Weekend Links

I’d planned to spend the weekend writing up a new programming article for the site but it got a little hi-jacked by another project I was working on. On Friday, I needed to figure out how to generate ZIP files from a website and just couldn’t put it down for the weekend. The situation is one where the site is generating multiple text files for download and I want the user to be able to download all the files as one ZIP file.

So, naturally I hit Google and started looking up code libraries, preferably free ones, and I was able to find a couple. Of the two I tried, I’m thinking I prefer DotNetZip which made it really simple to generate a ZIP file with the exact files I needed – like this simple:


using Ionic.Zip;

protected void ZipTest()
StreamWriter swFile;
ZipFile newZip = new ZipFile();
string zipFN;
string streamFN;
int fileNumber = 1;


for (int x = 1; x <= 3; x++)
{
streamFN = Server.MapPath("~/Output") + "\\" + fileNumber.ToString("0000") + ".txt";
swFile = new StreamWriter(streamFN);
swFile.WriteLine("File " + DateTime.Now.ToFileTime());
swFile.WriteLine("Created on " + DateTime.Now.ToString());
swFile.Flush();
swFile.Close();
newZip.AddFile(streamFN, "");
fileNumber++;
}


zipFN = Server.MapPath("~/Output") + "\\ZipFile.zip";
newZip.Save(zipFN);

}

Most of this code has to do with generating the text files for testing. The items in Bold declare the new ZIP file object, add the new files to it as they’re created and then saves the ZIP file. It worked within 15 minutes after I downloaded it unlike the other product that kept creating invalid ZIPs and had me running around the Net researching regular expression syntax which ended up not working anyway. I can’t fully vouch for DotNetZip as I’ve only just started using it but so far, I’m happy.


As I said, I also ended up doing a bit of research on regular expressions which are used to define search patterns in text samples such as file names and text files, etc.. An example would be the following:

^FILE.+\.txt$

This example could be used to search a list of files for any file names starting with “FILE” and ending with “.txt”. Using the REGEX class in .NET, you can quickly find matches for patterns like this one in blocks of text.

Regular expressions have a bit of a learning curve that goes with them so it helps to find a good introduction. One such introduction is Zytrax.com’s “Regular Expressions: A Simple User Guide and Tutorial” which I found to be clear and helpful in putting together the example above. Another cheat sheet can be found on RegExLib.com.


My other bit of fun for the weekend was coming home on Friday and finding that my copy of Visual Studio 2010 Professional had been delivered. (I know. I’m such a geek.) I’ve used it professionally at a couple different companies now and finally decided to get it for home use since I didn’t want to be limited to the 2010 Express versions. Amazon.com seems to have dropped the price on it and I’m guessing that has something to do with Visual Studio 11 being in beta. I’ll have to check that out at some point but for now, I’m happy with 2010 which is proven and stable.

Posted in Programming | Comments Off

Microsoft Access for Beginners / JobSearch 2010

I’ve started to see some sales of the eBook version of “Microsoft Access for Beginners” and was happy to hear from one of the readers today, despite the fact that he was reporting a problem …

It seems there was an issue with the Access 2007 / 2010 version of the program that I believe had to do with differing installations of Access 2007.  I’ve corrected the problem and the corrected version is available for download.

Whether or not you’ve bought the book, JobSearch 2010 is definitely worth a look.  This is a free program designed with Access 2007 that helps to organize your job search by enabling you to store complete information on every job lead in one place, track the progress of individual leads and follow-up on opportunities more effectively.  If you don’t have Microsoft Access, there’s a version that includes the Access 2007 run-time, a free version of Microsoft Access that will enable you to run the program and change data while preventing any design changes to the program.

For more information, check out the download page where you’ll find links to all the versions available and a program manual to help you get started.

Posted in Uncategorized | Comments Off

Learning PHP

One of the projects I started late last year was learning some non-Microsoft technologies, one being PHP; a scripting language that is used behind websites in order to provide more dynamic features than ordinary HTML is capable of.  PHP has been in use since  1995 and is one of the most widely available web technologies.  If you depend on outside web hosting services to host a website like I do, you can pretty much count on your hosting service supporting PHP scripting.

My own experience  with PHP is still at the academic stage and certainly not ready to be advertised on the resume but the basics of the language aren’t hard to learn, especially for someone already familiar with basic programming concepts.  A basic example of a PHP  script would look something like this:

<?php
 echo "Today's date is ".date("l, F d, Y").".";
?>

This script could be inserted anywhere  in the body of an HTML web page and would produce the following output:

Today’s date is Sunday, April 08, 2012.

The opening and closing <?php … ?> tags are what signal to the PHP processor on the web server that the content between the tags is to be processed as PHP code.  Pages using  PHP scripting are also often named with a .php extension instead of the normal .htm or .html extensions.   The echo command on the second line instructs PHP to  output the following content to the page and it calls the date() function which outputs the current date and formats it as needed.

Aside from being a relatively easy language to learn, PHP is also easy in terms of cost and resources.  No special software is needed beyond your favorite HTML or text editor and there’s a wealth of information on the web.  As with other languages, it’s just a matter of learning some basics and then getting in there and working with it to get experience.

I like having a reference book at my side so I recommend the above book; Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide) by Robin Nixon. This book will also give you an introduction to the Javascript scripting language and the MySQL database environment, two other important technologies in web development.

As I said, there’s a lot of good information on the web, too.

W3 Schools has an introduction and reference to PHP:
http://www.w3schools.com/php/php_intro.asp.

I also like to start with Wikipedia when learning about a new subject. I find that, at the very least, it can point me in new directions.
http://en.wikipedia.org/wiki/PHP

If you’re interested in programming and want to work on websites, PHP is a valuable skill to have.  As an exercise, go to one of the larger job search sites like CareerBuilder.com or Monster.com and do a keyword or skill search on the job listings for PHP.  This is a helpful way to gauge the demand for any skill.

Posted in Uncategorized | Comments Off

Bringing things up to date …

Every so often, I remember that I have a blog attached  to the site and I make new promises to myself to keep it up to date but it doesn’t seem to happen that often.

2011 was a busy year for me which was one reason I didn’t update the blog much.  It’s easier to post quick thoughts to Facebook than deal with the expectations of a blog entry.  Those updates tend to get lost in the ether, though, and if I’m going to spend time and effort writing interesting things, I’d rather use them for my own promotion than Facebook’s.

After working independently for an extended period, last year started with a new full-time job that looked like an interesting opportunity.  I did manage to gain some extra experience with ASP.NET while acting as the sole developer on an online solution for the company and consulting on other applications.  The position was not without its drawbacks, however, and at the end of September I had my first experience of anticipating exactly when the axe was going to fall.  When I left for the day one Thursday, I made sure to clean out my desk and sure enough, the layoff came early the next day.

Microsoft Access for BeginnersI hit the ground running, though. By the end of October, in addition to updating my resume and other job search fun, I’d completed the project to turn the Microsoft Access for Beginners series into an eBook. On October 31, it went live on Amazon.com as my first Kindle offering and I’ve started to see some sales. I probably should have added a dedication to Starbucks where I spent so many hours staying caffeinated while editing material and figuring out how to get around formatting issues.

I decided to see how the book plays on Amazon.com before reformatting for other outlets and I was a little sick of looking at the project so I moved on to other things including setting up a Facebook page for Drewslair.com.  After sending out some more resumes, my phone started ringing off the hook and by the beginning of December, I’d landed a new contract as a programmer at a local company.  I actually managed to get two job offers within 24 hours which was a new experience for me.  The other one would have meant moving to Jacksonville and I decided  to stay local.

So, since December, I’ve been gaining a lot more experience developing ASP.NET web applications with Visual Studio 2010 and SQL Server 2008.  Having a regular work schedule again where I could leave the job behind at the end of the day was nice for awhile but I’ve also found it’s inherently limiting. I need to start accomplishing things on my own again so I’m looking at dusting off some of those  projects that I put on hold to accommodate the day job and seeing what I can do with them.

More updates here would probably be a really good start …

Posted in Uncategorized | Comments Off

Speaking of links …

Here’s one I found today in the Wall Street Journal on studies into the nature of happiness … one more of those studies that essentially tell us our grandparents were right after all.

Is Happiness Overrated?
Study Finds Physical Benefits to Some (Not All) Good Feelings

The message I take away from this one is pretty simple:  If you’re obsessed with being happy, you probably won’t be but if you manage your life well and do the right things, happiness will be the reward.   It’s a familiar principle that works with other things like love, money, respect from your peers, etc …

Study Finds Physical Benefits to Some (Not All) Good Feelings

Posted in Uncategorized | Leave a comment

March already?

I thought about taking the blog down when I realized how long it had been since I posted here but instead, I decided to say goodbye to Facebook for awhile and devote those misspent energies to something a little more productive.

I started a new full-time job in January, which is another reason I’ve been away.  Aside from the steady paycheck, it’s been a good opportunity to work on a new programming project.  In this case, a web-based purchasing system complete with a SQL Server back-end, web services, a typed dataset providing the classes and a decent amount of leeway in design.  It’s also been a refreshing change from Access 2007 as I’ve been able to update my .NET skills with Visual Studio 2010.

Still, I’ve been getting a little restless off-hours and finally decided to kick myself back into gear.  A steady gig (with an hour commute each way) opens the door to the temptation of kicking back with Netflix during too many nights and that eventually leads to a very sad place so I’m trying to dust off a side project or two again and see what I can do with them.  I really should go back to that Microsoft Access eBook I was working on back in December but working  on SQL Server / Visual Studio during the day and Microsoft Access at night sounds a little too much like a double life to me and a backwards one at that.

So for now, I’ll just try to write a little something here each day.  It might be something new I’ve discovered in .NET or maybe just an interesting link I’ve found during the odd moment when I needed to wrench my mind away from stored procedures and shared functions …

Posted in Programming | Leave a comment

Switching between Access 2010 windows

A visitor to the site asked about using ALT-TAB to switch between open Access windows.  This refers to the “Windows in Taskbar” feature which was available in Access prior to Access 2007.  You could set Access to display a button for every open Access window on the Windows Task Bar and use the standard ALT-TAB to switch between them.  I usually disabled it because I didn’t like all of those taskbar buttons for the same program.

This feature is no longer present in Access 2007 / 2010, although it’s still available for Word and Excel.  One option that is still available is the Ctrl-F6 key combination.  Using Ctrl-F6 or Shift-Ctrl-F6 (for reverse order) you can switch between all open windows in your Access program, including forms, open tables and the database widow.

Using Ctrl-F6 in Access, you can switch between multiple=

Of  course, I usually design Access applications to keep only a couple windows open at a time and my forms have links or buttons that take the user back to the appropriate menu or screen.  During design time, though, or when you’re creating a quick and dirty app for analysis, this can come in handy.

Posted in Uncategorized | Leave a comment

While wandering aimlessly on Amazon …

Here’s an interesting idea for a holiday gift …

1970′s Retro Candy Gift Box

Having grown up in the 70s, I remember things like FreshenUp gum and Pop Rocks although I always liked chocolate the best and went for the candy bars.  They also have gift packs for the other decades from the 40s to the 90s.

Posted in Uncategorized | Leave a comment

So … what else has been happening?

I got a little sidetracked from the series of articles that I was planning on the development of JobSearch 2010. Actually, after finishing development on it, I might have been a little tired of looking at it and felt like doing something different. With all the features available in the program, however, it’s a rich source of material for articles and I still plan on getting back to it.

Meanwhile, I’ve been reviewing some of the other articles on the site and making some improvements where possible. If you’re new to Microsoft Access or need to explore a new area of it such as query building or report design, check out the Microsoft Access for Beginners series, the most popular feature on Drewslair.com.

Once you’re comfortable with Access, the next step is to learn about Visual Basic for Applications which will help you program more advanced features into your database programs. You can get started with VBA by checking out the Programming Microsoft Access series which explains the purpose of VBA, how to work with the development environment and various programming concepts.

Posted in Uncategorized | Comments Off

JobSearch 2010 Update

JobSeach 2010 is now out of beta testing and version 1.01 is available for download.  If you’re looking for a job or know someone who is, this is a great tool that can help you maximize your search.  JobSearch 2010 includes contact management, lead tracking and flexible reporting all in one program … and it’s FREE!  No obligation, no registration, no charge!

If you’d like to know more and maybe download JobSearch 2010, check it out at:

http://www.drewslair.com/jobsearch2010.shtml

Posted in Uncategorized | Comments Off