# Friday, October 09, 2009

Software Developer vs Project Manager

I came across a hilarious (full of swearing) video the other day created through Xtranormal.com.  This amazing site gives you all the tools to just plug in a script and direct your own movie, along with amusing generated voices.

Here's my first effort to illustrate the sometimes rocky relationship between developers and project managers...

Watch on Xtranormal.com | Watch on Youtube
posted on Friday, October 09, 2009 10:33:55 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Friday, August 14, 2009

Coder T-Shirts from Geek Casuals

OK - I do T-Shirts, and I'm just plugging my more geeky brand 'Geek Casuals', but some of these may appeal to the .NET audience....





Geek Casuals - Geekwear that geeks wear..


posted on Friday, August 14, 2009 8:43:12 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [1]
# Monday, July 20, 2009

Remote Desktop Clipboard Not Working? - Just restart rdpclip

This one's been bugging me for years.  You know the situation, you're happily using a remote desktop connection, and all of a sudden the clipboard stops working for no apparent reason.

I recently stumbled across a 'fix' for this.  It's more of a workaround than a fix, as you'll need to do it every time the clipboard disappears.

Just look for a process named rdpclip.exe on the machine you're remoting to, and kill it, then restart it.

You should find you're able to copy/paste again. 

posted on Monday, July 20, 2009 12:01:17 PM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]
# Wednesday, June 10, 2009

Making Web Wireframes easier with Visio - The Pixel Dimensions Shape

Many people use Adobe Illustrator or Photoshop for designing Web layouts, but a lot of companies use Visio - especially for higer level 'wireframes'.  One of Visio's problems (<= 2003 anyway) is that it doesn't support pixel units.  This means you'll always be approximating the sizes of content areas and page elements, making the developer's job more difficult.

Enter 'Visio Guy', and the Pixel Unit Line Shape.  This is just a great addition for anyone using Visio.  Before you know it you'll be laying out pixel perfect shapes that the developers will then give you great pleasure in declaring 'this won't work in IE6!' :) 

A thing to note with Visio as well: If you're working with pretty small dimensions then the only way to get really precise is to zoom right in (like 500%), otherwise the whole 'snap/glue' thing will kick in based on the page units (probably mm), regardless of whether you've switched snap/glue off.

posted on Wednesday, June 10, 2009 9:49:48 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]
# Monday, January 19, 2009

The very reason I write in a blog

Some amusement today as I was trying to set up hibernation on my Windows XP box at work.  I was getting a strange error about 'not enough system resources to complete API'.  After a bit of mucking around I realised I'd actually encountered this very same error a while ago.

I actually used my own blog to fix a problem I'd had before and completely forgot about. 

Funny

posted on Monday, January 19, 2009 3:16:04 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Thursday, December 04, 2008

Removing the scrollbar Page Shift from Firefox

This had bugged me for a while.  A lot of sites (including some of the ones I develop) tend to have a fixed width layout these days and some browsers (IE particularly) 'always' has a visible scrollbar.  This means that the available screen width is constant whether the page scrolls or not. 

Firefox on the other hand (and Chrome/Opera/Safari) seem to have this off by default.  This of course seems reasonable until you have a fixed width, centred layout that 'shifts' when you switch from a non-scrolling to a scrolling page.  It's just a bit off-putting.

Fortunately Firefox is configurable and the following will fix that up for you. (I'm sure the other browsers are capable of something similar but I'm not using them much :) )

  1. Find your profile directory (it's bound to be the 'default' one unless you're developing Firefox addons.  You'll normally find it in c:\documents and settings\username\application data\Mozilla\Profiles\xxxxx.default\
  2. Go to the 'chrome' subfolder and create a file called userContent.css (you'll probably find there's a couple of 'example' files there already.
  3. Add the following (Firefox-specfic) line to the file:

    html { overflow: -moz-scrollbars-vertical !important; }

  4. Save the file, exit Firefox and start her up again.  You should now have a permanent scrollbar which eliminates the page shift. 

posted on Thursday, December 04, 2008 10:51:55 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Monday, September 15, 2008

Replacing Notepad with Notepad2

Notepad2 is great - no arguments.  It was only this morning I actually got around to 'replacing' the standard notepad.exe with notepad2.exe.  You'd think it was just a simple rename, but Omar Shahine shows the way...

posted on Monday, September 15, 2008 8:36:04 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]
# Friday, June 06, 2008

Visual Studio Documentation - Have your say

Brad A's just been highlighting the MSDN Survey to get opinions on how Visual Studio and MSDN documentation works (or doesn't) for people.  I added my 2c and it made me think a little about how I access 'help' these days.  Here's what I wrote in the 'other comments' (Q 14 I think).

I generally access MSDN content through google (as it's quicker than accessing the MSDN site, waiting for it to load the TOC, then searching).  It's probably testament to the indexing of the site that a search such as "msdn Path.Combine" will take me straight to the specific page I 'know' I'm looking for.  I guess this means I've got some knowledge of how things are structured and I use that to good effect.  In a simple comparison...

Local Help
Typing Path.Combine into VS.NET code editor - selecting the text and hitting F1 came up with a false start (my current machine doesn't even have the docs installed apart from Enterprise Library 3.1.  It did find some less than useful reference from EntLib!).  I went to Help options and chose 'use online first', and tried again (incidentally I didn't even realise you could pull in your own list of sites to search (Codezone community) - cool).  It chose a different 'Path property' first and took about a minute in total to get to the right 'Path class'.

MSDN Library Site
Opening up the MSDN site (which still feels too heavy in my book - and now curiously like BBC news) and searching for 'Path.Combine' took about the same time (1 min).  This includes opening the browser, loading up the MSDN home page, searching, clicking the first item in the search results, and loading that page.

Google search on MSDN
Opening up Google (admittedly my home page - but I'm looking for speed here) and searching for 'msdn Path.Combine' took 20 seconds.  The first item in the list was what I wanted so got straight to it.  It's also worth noting that Google's become a little fat puppy too with all my iGoogle stuff on it, but it's still way quicker than any of the alternatives.

 

posted on Friday, June 06, 2008 4:44:22 PM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]
# Sunday, April 13, 2008

How do you 'rate' a developer or team lead?

Just going through some old notepads from previous employment and found a table that I'd come up with to 'rate' all the developers in the department (I was a team lead there at the time - I also rated myself and the other team leads).  The purpose was to effectively work out who to put where - i.e. what teams.  It's pretty a simple process, and is essentially a straw poll on some high-level KPI's, but assumes you're experienced, and 'pretty good' yourself, and can recognise/score people objectively and consistently.  If you let personal preference get in there then your results mean nothing.

Each person is scored on 4 categories as some may be stronger in different areas.  Each score is on a scale of 1-10, and the scores are simply added to get the overall rating ( out of 40).  You can obviously make this a percentage etc if you wish.  You could also apply an average to scores given by multiple people.

Developer Categories:

  1. Ability. Raw development ability.  Can they achieve a technical solution?
  2. Discipline. Their 'normal' work practice.  Do they take pride in their work?  Do they lead others in the processes they follow?  how do they work when unsupervised?
  3. Commercial Focus / flexibility,  When faced with a deadline or changing scope do they cope?  Do they think creatively and work with others to keep things on track, potentially adding commercial compromise into their original design?
  4. Control. How do they work under pressure? Do corners get cut, do they fall to pieces, or do they rise to the occasion? 

Team Lead (Technical) Categories:

  1. People leadership. How do they treat their team members?  Do they instil confidence and inspire their team to achieve?  Does their team 'like' them? You have to be careful with the last one, because on its own it shouldn't give a big score.  It's the icing on the cake rather than the meat in the sandwich!.
  2. Getting Stuff Done.  Do they get results?  Does their team get results?  Do they deliver regardless of obstacles and issues?
  3. Upward Management. How well do they communicate changes, issues etc to managers and stakeholders?  Do they 'sit' on issues and hope they'll go away until they 'blow up'?

  Team leads can obviously be rated as developers too...

 

posted on Sunday, April 13, 2008 11:21:33 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]
# Wednesday, April 02, 2008

The best gmail Google Gadget

When I say 'best' - I mean one that allows you to use gmail where you'd otherwise be blocked.  This does everything within the one window rather than opening up gmail (and alerting the company web police).  This requires a bit of real estate so you might want to create another iGoogle tab with one column.

I can probably uninstall Gmail lite from my home box now...

Here it is

 

posted on Wednesday, April 02, 2008 1:40:55 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [1]
# Wednesday, February 20, 2008

Top 10 Application Design Mistakes

Got sent this from a usability guy I sit next to.  Looks very interesting and a lot rings true.

 

posted on Wednesday, February 20, 2008 9:36:54 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Monday, February 11, 2008

Retro : Show popup for new mail in Outlook 2000

This is the sort of thing you shouldn't need to know right..?  'cause you don't use Oulook 2000 any more right..?

My new job still does and as I now can't be bothered to write something (or buy something) to give me the outlook 2003-style 'new message' tray popup I found the following macro for other unfortunates in large companies (companies that take forever to upgrade software) who use this version.  Application_NewMail is an event handler BTW...

Private Sub Application_NewMail()

Dim objNSMapi As NameSpace
Dim objMapiFold As MAPIFolder
Dim objNewMail As MailItem

Set objNSMapi = GetNamespace("MAPI")
Set objMapiFold = objNSMapi.GetDefaultFolder(olFolderInbox)
Set objNewMail = objMapiFold.Items.GetFirst

On Error GoTo CleanExit

ShowMessage:

If MsgBox("You have new mail from " & objNewMail.SenderName & " [" & objNewMail.Subject & "]" & String(2, vbCrLf) & "Would you like to read it now", vbQuestion + vbYesNo, "New Mail Notification") = vbYes Then
    objNewMail.Display
Else
    objNewMail.Close olDiscard
End If

CleanExit:

MsgBox Err.Description

Set objNSMapi = Nothing
Set objMapiFold = Nothing
Set objNewMail = Nothing

End Sub

posted on Monday, February 11, 2008 7:54:14 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Thursday, January 31, 2008

Programmers Fonts

I'd only really tried Monaco (still the favourite) in Visual Studio, but found a good collection of programmer's fonts here.

posted on Thursday, January 31, 2008 12:27:41 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Friday, January 25, 2008

Flags - Do you live in an 'A' Grade Country?

Found this link on Kottke's blog - interesting stuff - it does make you wonder the 'reasons' behind people choosing a flag.

 

posted on Friday, January 25, 2008 10:43:59 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Tuesday, January 15, 2008

Scheduled Shutdown and Wake Up (on LAN) - Part 2

After the first post I've been doing a bit of experimenting with my work machine (new) and also at home (old).  We're all grown ups here so I'm not going to include many screen shots.  Hibernate seems the best option to me as it gives you the most options.  Maintain your state and when you power on, you're back to a 'locked' logon, meaning that even if you decide not to do an automatic wakeup (or your system simply doesn't support it), then your boot up time's likely to be less than a minute in any case - so who cares!

I wanted that extra bit of convenience, so I've got a scheduled hibernate and wakeup now working at work and at home.

As a side note, I love keyboard shortcuts, and so here's a list of shortcuts to Control Panel dialogs.

The procedure for hibernation is the same for all machines, but the wakeup will vary from full support to no support...

Hibernation
  1. Enable Hibernation through Power Options dialog in control panel (Hibernate Tab). Start--> Run --> powerconfig.cpl
  2. If you have 2gb of RAM or more download a Microsoft HotFix from here and install.  Hibernation won't work without it.
  3. Open Device Manager (Start --> Run-->devmgmt.msc) and open the properties of the Network adapter you want to use to control the wake up
  4. Check the 'Allow this device to bring the computer out of standby' box (Power Management Tab)
  5. Ensure 'Wake Up Capabilities' (Advanced Tab) is not set to disabled or none.  Each network adapter will have different capabilities.  The work machine has (Both, Magic Packet, None, Wake up Frame).  The option was already set to 'both' so I didn't make any change.
  6. Create a new scheduled task (Start --> Run --> control schedtasks) called Hibernate with the following in the Run box...
    C:\WINDOWS\system32\rundll32.exe  powrprof.dll,SetSuspendState Hibernate
  7. Go to the Settings Tab, and configure the idle time (if necessary).  I configured the following (which seems to work OK):

    Most of the risk of losing stuff is mitigated by doing a hibernate over a full shut down in any case.  I haven't tested whether the idle time recognises non-UI processes - e.g. say I'm encoding video.  I guess I'll find out one day...
  8. Schedule the task to run at a time when you're comfortable to switch off every day (taking any overnight processes like backups or defrags into account - maybe bring those forward) - remember 'any' time your computer is powered off is a good thing.  I've got the work machine set to go off at 18:00, and the home machine to go off at 23:00.
WakeUp

The work machine (Dell Precision 690 Xeon 3.2ghz, 2gb RAM) responds quite happily to the following :

  1. Create another scheduled task called 'Wake up' (or something equally innovative), and put literally 'any' command line in.  I just fudge the following as it will exit once finished...
    C:\WINDOWS\SYSTEM32\cmd.exe /C dir (This just opens a command shell - runs a dir then exits)
  2. Schedule this to run 'just before' you think you're going to need it every day.  I get in early so the work machine comes on at 07:25 and I don't need the home machine until 19:00 after the kids are in bed.

The home machine (can't remember the spec - but it's older - circa 2004) - the case is actually a 'lot' older, (but recycling is another thread) won't respond at all to the wake up scheduled task, and so based on the C# code posted previously I created a LANWakeup console app (there's plenty of other ones kicking around) to send a magic packet to the MAC Address of my home Network Adapter.  I'll update the post to include this... 

This is then scheduled on my 'other' home machine at 19:00, and this works fine.  The only problem of course is that I then can't turn 'both' machines off overnight as something needs to be 'on' in order to send the wakeup.  The other home machine is also older than the one I've got hibernating and it would need to be 'remotely' woken up too.

Troubleshooting

If you try your hibernate task and it comes straight back on, then it's responding to other network traffic (which happens with some machines apparently - the home one experienced this but not the work one).  In this case do the following:

  1. Go back into Device Manager and the 'Power Management' properties of your Network Adapter, then check 'Only allow management stations to bring the computer out of standby'.  This seems to help the adapter ignore general broadcast traffic and only respond to specific wake up requests (worked for me anyway)

New machines (last 3-4 years) are almost certain to have wakeup capability in some shape or form.  The newer the machine, the more likely it's preconfigured in the BIOS.  If wakeup isn't working in any way then you'll need to go into the BIOS on startup (Del / F2 / Ins - etc) and look for Power Management options.  The previous post had a link on BIOS setup.  If you're dealing with more 'vintage' kit then you'll have to resort to the on-off button to wake the machine up, but I kindof like the idea of that, and may ditch the auto-wakeup in time, as it's a bit lazy really!

posted on Tuesday, January 15, 2008 10:39:42 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Thursday, January 10, 2008

Becoming slightly more environmentally friendly - Scheduled shutdown and Wake up

I leave computers on at home (bad boy), but I have slightly environmental sensibilities, so I've been wondering how I can best retain the convenience of having machines available when I want them, but also conserve energy when they're not being used (assuming of course they're not 'doing' anything overnight).

If you've got the disk space then it seems the best (easiest) option is probably a scheduled 'hibernate' (if idle for n minutes) at night, followed by another 'wake up' task in the morning (with 'wake the computer to run this task').  The wake up task could do an auto logon if you need.  Hibernate actually powers off (Standby doesn't), but effectively writes your system state to disk (using approx same disk space as total RAM).  You need to go into power options first to 'enable' hibernate.

This article explains how to schedule a hibernate - just change the psshutdown options to -h instead of -d. I also don't care if there's a logged on user.  (Actually scratch that - as I found the following command will happily do a hibernate without any other tool - much nicer.... ) 

C:\WINDOWS\system32\rundll32.exe  powrprof.dll,SetSuspendState Hibernate

I also found this, talking about issues with hibernate.

Waking up is a little bit more troublesome and is unlikely to work unless you enable your network adapter to respond to wakeup calls.  This goes into a bit more detail on that.

If you want to go further and just 'shut down' rather than hibernate, then step 1 would be the same - just change the psshutdown options again to -k

If you're completely shut down, you'll need some sort of Wake On LAN capability (something I've never really bothered with before), and I found this code that'll do nicely as a console app.

I haven't decided which way to go yet, as I prefer the idea of a complete shutdown without the need for disk space to write system state to disk, but then you need another machine that's 'on' to wake the shut-down machine back up (potentially defeating the purpose?).  The first (hibernate) option is self-contained within the one machine, and uses a built-in facility to wake the machine up using the system clock.  I also do a backup each night, so I'll maybe bring that forward and schedule a hibernate of all machines.  I'll be interested to see the difference in the electricity usage.  I might post a more full procedure when I'm happy everything's working for me...

 

posted on Thursday, January 10, 2008 10:17:08 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Tuesday, January 08, 2008

Google Gadget for Connex Melbourne Service Status

I was playing around today and knocked up a quick Google Gadget (for use with iGoogle) for people in Melbourne to monitor the status of the train services delivered by Connex.  This is available on the Connex site, but conveniently sits in its own frame and so was easy to port to a 'gadget'.

No real rocket science (and the gadget editor's a bit buggy) - but I love the concept...

Click Add to Google to add it to your iGoogle Page

I've posted it to the 'directory' so it will hopefully be accessible from the main 'gadget search' soon...

posted on Tuesday, January 08, 2008 2:51:53 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Monday, January 07, 2008

Australian BOM Weather Gadget on iGoogle

I'd been looking for a 'proper' Australian Weather gadget for iGoogle, as the default one (presumably US-based) is rather inaccurate at times.  The following are links to two Gadgets linking to BOM (Bureau of Meteorology) data...

http://www.google.com/ig/directory?url=http://bomweathergadget.googlecode.com/svn/trunk/bom.xml&synd=ig (5 day weather forecast)

http://www.google.com.au/ig/directory?q=weather&hl=en&root=%2Fig&dpos=top&url=http://www.projectcomputing.com/resources/ausWeather.xml (Radar Picture)

 

posted on Monday, January 07, 2008 2:20:34 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Saturday, December 29, 2007

RTFM - or Not! Electrical Items are now like software without manuals

I recently (November) bought a cheapy digital camera for my 5 yr old's birthday.  Yes - I know, a 5 year old with a digital camera - where will it stop.  Anyway...

The model was a Samsung S630 (cost $97 AUS), and you'd be forgiven for thinking it had a reasonable manual given it's a budget camera.  A quick look and you realise that there's about 4 pages X lots of languages.

I'd bought a Canon Ixus 2 a few years ago and apart from it having a few plastic bits that proved to be a bit fragile it's served me very well with its rechargeable battery.  We quickly found that the Samsung had 'awful' battery life, and found that this was the general experience of most people with 'cheaper' digital cameras that take AA batteries.  I bought a few Ni-MH batteries and a charger and thought, well if I'm going to get through so many batteries (as my child had the camera permanently strapped to her wrist) they're going to be rechargeable!

No beef with the rechargeables, and we quickly got to the point where we couldn't put 'any' battery in without it immediately showing 'Low Battery' and shutting the camera down.  One obviously smells a rat at this point.  I was all ready to take the thing back to the shop then (after realising I'd misplaced the receipt :-) ) decided to have a quick look for info on this model and its spectacularly poor battery life.

A quick google found reviews on Amazon - so I started to read.  My heart sank as I read review after review quoting the same issues I'd found - but also the lack of support they then had from the supplier leaving them pretty much in the cold - grreeat I thought to myself.  I was still interested however, because there were quite a number of positive reviews also.  Now knowing software like I do I thought what are the odds of a systematic problem as severe as not being able to turn the thing on! being present in about 2 thirds of cameras (about the ratio of bad to good reviews).  I read a couple of 'responses' to the bad reviews and one in particular that had some very simple but vital information that was missing from the manual.  

I charged up my batteries as much as I could then (after the camera actually switched on - but showing 'red' battery life) I found the menu item to switch to Ni-MH batteries, and hey presto I'd suddenly got 3 'bars' wahey!

So the moral of the story is that Google is now 'also' your friend for household appliances with increasingly shoddy manuals.  You may also of course be like me and have Techno-Joy (from the wise words of Eddie Izzard), and have just disregarded the manual anyway!

posted on Saturday, December 29, 2007 2:56:04 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Tuesday, December 04, 2007

Use Outlook to Link to Web Pages, Exchange Public Folders, Anything!

We want to cut down on email traffic and storage so we're suppressing some automated stuff and moving the remainder into public folders that will have a cycling deletion of items over a certain age (as we don't need to keep the info indefinitely).  The problem is that it's a few clicks to access the right folder in Outlook (the enterprise folder structure is quite large).

A little known feature of Outlook is its ability to give access to almost anything (including public folders) from within your mailbox just by creating 'shortcut' folders.

  1. Create a new folder within your mailbox
  2. Right-click - Properties and go to the 'Home Page' tab.
  3. Enter an appropriate URI - this could be a file reference, web page, or any other location, e.g. Outlook Public Folder.  

    Ensure that you tick the 'show home page by default for this folder', as this is what displays the item :-)

    An easy way to get the address of an outlook item is navigate to it - e.g. a Public Folder and use the 'Web' toolbar to retrieve the address (View-->Toolbars-->Web):

    Copy the address and away you go

It's important to note that this is really just Outlook acting like a pseudo browser so you won't be able to navigate down a structure of public folders.  It's still an Outlook folder you've created and it expects you're storing posts or contacts (whatever you specified when you created it), not folders.  Still a pretty useful feature though. 

Another use might be if you hive off all your email from a supplier into a sub folders, the home page of the 'parent' folder could be their web site.  A different way to use favourites and drop your click-count?! 

 

posted on Tuesday, December 04, 2007 10:45:11 AM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Friday, June 29, 2007

Grammar refresher - Using punctuation properly

I've found that I often use colons in technical documentation and emails, yet I've probably never 'really' understood quite how they or semicolons should be used.  I think my school days were after the golden age of English Grammar education (or maybe I just didn't pay attention).

After reading this, I'm now clear on the picture.  I could rephrase that as follows (just to force a semicolon in):

I read this article; I'm now clear on the picture, and shall use semicolons to appear clever.

posted on Friday, June 29, 2007 11:16:27 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]
# Tuesday, March 20, 2007

PrevX - DeleteOld (eh?)

I just found that the top entry in google for 'codebureau' is actually some listing on prevx.com (which I'd never heard of) that's seeming to suggest that DeleteOld (a console app I posted on CodeProject some time ago) is possibly spyware/malware - bloody cheek!  I'd be interested to know how this pops up on that tool, and also whether the .NET code has some flaws that means it can be used in a malicious way.  At least then I could defend myself.

posted on Tuesday, March 20, 2007 1:02:11 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Wednesday, January 31, 2007

Dynamic FTP Scripts

I seem to be getting back to basics at the moment with some of the things I'm doing - and didn't imagine myself having to get an automated FTP update working this week...

My objective was to 'get' files from a remote machine using a folder pattern consisting of the date in an 'yymmdd' format.  I'd forgotten that script files used with ftp (ftp -s:myscript.txt) are dumb text files, and if you want to 'get' from a dynamic location - or dynamic filenames you need to magic something up.

My interest was sparked here, and although I found a C# FTP library on CodeProject that would clearly do the job, and would be cool to use in itself, I was more interested in using 'old skool' lo-tech methods to solve the problem.

I read one article that suggested using batch files to spit out the ftp script.  Excellent idea I thought - so this is what I ended up with.... (I've changed a few details to protect the innocent so if it doesn't quite work it's only due to my own typo :-) )

I won't explain each bit as that would spoil the fun - but the general gist is that FTPReportsForDate is normally run without parameters and it finds files in a specific folder and renames them on the local host.  The process also does other stuff I didn't have time to go into....

FTPReportsForDate.cmd (which accepts a parameter or gets current date if not supplied)

@echo off

echo Creating Log Folder
IF NOT EXIST C:\logs\FTP\ md c:\logs\FTP

echo Removing previous processing date
IF EXIST processingdate.txt del processingdate.txt /F

IF "%1" == "" (
 echo Getting current processing date
 cscript //NoLogo GetCurrentDate.vbs >> processingdate.txt
 echo Transferring File
 FOR /F %%f in (processingdate.txt) do CALL FTPCommand.cmd %%f
)

IF "%1" NEQ == "" (
 echo Transferring File
 CALL FTPCommand.cmd %1
)

FTPCommand.cmd  This constructs the FTP script file and does the FTP itself...

IF EXIST FTPLatestFile.txt del FTPLatestFile.txt /F

Type FTPHeader.txt >> FTPLatestFile.txt
echo cd RP%1.IN >> FTPLatestFile.txt
echo get staticfilename.fil dyn%1.fil >> FTPLatestFile.txt
echo close >> FTPLatestFile.txt
echo bye >> FTPLatestFile.txt

ftp -s:FTPLatestFile.txt >> c:\logs\ftp\transfer_%1.log

FTPHeader.txt This contains the static information used in the FTP script

open 192.168.0.1
myftpuser
myftppwd
prompt
lcd c:\incoming


GetCurrentDate.vbs
gets current date in a yymmdd format in the event we don't pass in a date to FTPReportsForDate.cmd

'Simple script to output todays date in yymmdd format for FTP processing

Function pd(n, totalDigits)
 if totalDigits > len(n) then
  pd = String(totalDigits-len(n),"0") & n
 else
  pd = n
 end if
End Function

Wscript.echo pd(RIGHT(YEAR(date()),2),2) & pd(MONTH(date()),2) & pd(DAY(date()),2)
Wscript.echo
        

posted on Wednesday, January 31, 2007 4:51:13 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]
# Tuesday, March 28, 2006

Back in the saddle

It's been a good while since I wrote a blog entry.  So long in fact that my previous hosting provider (MSDNConnection) closed down without me even noticing!! (December 2005)

This did have the unfortunate side effect of removing all of my posts and so I lost the lot.  What did I learn?  err..  read your Hotmail occasionally rather than just using it to register for stuff on the web that you fear may cause your 'real' address to get spammed!

I'll try and piece the content back together now I've got some space with ASPSpider.  DasBlog works extremely well here as it's XML based and so I've got less chance of losing the lot if the rug's pulled from under my feet again!

Better get to work then...

posted on Tuesday, March 28, 2006 11:32:55 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]