Every week, I need to download a database file from my server as a backup copy. Instead of manually connecting to the ftp server every week, browsing to the database folder, downloading (waiting…), moving and renaming it appropriately, I’ll show you how I automated this whole thing using a batch file and an ftp script file.
Windows bundles an ftp program (ftp.exe) with its system files. The ftp program accepts a script file as part of its command line parameters.
Here is the sample script file (call it ftpscript.txt)
get “httpdocs/db/mydatabase.sql” “mydatabase.sql”
Replace (ftpusername) and (ftppassword) with your own ftp account’s username password. The 4th line “hash” displays the download progress using # characters. The 5th line “get” downloads the database file to the local directory from where the script is being executed.
Now we will write a batch file which will run the ftp command with the script file.
Here is the sample batch file (call it downloaddb.bat)
For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set todaysdate=%%c%%a%%b)
ren mydatabase.sql mydatabase_%todaysdate%.sql
ftp -s:ftpscript.txt ftpserveraddress.com
In the above code we go to the local database folder, generate today’s date, append today’s date to the previously downloaded database and then run the script. Replace the ftpserveraddress.com with your own ftp server’s address.
Every time we run the batch file, it will rename the previously downloaded file (with today’s date) and download the new file.
Can a single mouse click satisfy somebody’s hunger? Yes, and without swapping your credit card. This is possible with The Hunger Site.
As part of regular email/blog/news reading every morning, I make sure that I launch this website and click on the “Click Here To Give” button.
Mozilla Firefox has a feature “Open All In Tabs” that opens all bookmarks in a folder at once. So, “The Hunger Site” launches as part of other websites (Gmail, Bloglines etc). No effort to remember or to launch the website explicitly.
When developing programs, make sure you are clear about what to store in registry and what should go in an INI/XML settings file.
Here are the advantages of using an INI/XML file to store your program settings:
- The settings file that is stored as part of programs data files, is easy to backup.
- You customers can copy same settings across multiple computers (laptop, work computer, wife’s computer etc).
- You can easily make a portable version of your program that can run directly from a USB flash drive.
- You can ship the program files and settings file without an Installer. This is useful when the users want to run the program on a computer where they are not allowed to install any program without administrator rights.
Sometimes when coding in Visual Studio, IntelliSense just doesn’t work immediately. You press period (‘.’) and don’t see any response, don’t see any data members listed. This can be quite annoying.
It is normally believed and discussed that IntelliSense cannot be initiated manually. But there is a trick.
If you don’t see the data members listed when it should, just change the configuration from Debug to Release and back to Debug from the Standard toolbar. You will immediately see “Updating Intellisense…” in the status bar.
This is quite a relief sometimes.
I am very much impressed with a stock icons vendor IconDock. They have limited but very nice icon set. What is special about them is that they sell individual icons too.
Their website is very well designed.
Here are some of their limitations (as of today):
- They sell only 16×16, 32×32 and vector sets. It is developer’s responsibilities to use a vector image editing software such as Adobe Illustrator to edit their vector sets to any size they want. Not all developers (especially uISVs) own a license to Adobe Illustrator.
- They do not design custom icons. If you don’t find all the required icons in their icon sets then you are stuck. You can get the additional icons done by them.
Yesterday I wanted to print a .docx file (Microsoft Word 2007 file format). For few seconds I wondered how to convert this document since I didn’t have Office 2007. But then, I quickly forwarded it to my Gmail account. Gmail lets you view .docx file as HTML. That’s it. Cool. Isn’t it?
For the last 4 years my primary computer has been a laptop. Recently I found that laptops are not designed ergonomically. They are designed for portability but prolong usage for few years can damage your wrist, neck, shoulders, back etc.
I have found this document that will help you to setup your laptop ergonomically.
One tool I use quite often when developing products is ClipSpy.
It lets you see the contents of the Clipboard. A clipboard may have multiple formats stored. ClipSpy lets you analyze each format, see its data etc.
Yesterday, it helped me track the format in which Gmail accepts a file attachment via drag and drop (works only in Google Chrome browser). It uses the CFSTR_FILENAME clipboard format.
Earlier, when developing RecentX, it helped me track the clipboard formats that Windows Explorer uses when copying files.
Engadget blog gets you very interesting tech news at your desk. It’s about gadgets such as laptops, desktops, mobile phones, cars or any new electronic items. You can see the market trends and make appropriate decisions for your business. What mobile phone platform is popular, which is not worth concentrating on. This is why I subscribe to this blog.
You definitely must have heard of www.lifehacker.com . It is a must read blog for everybody, from all parts of life.
My main purpose of reading it is to get updates on new software, new web services, new version of existing software, what’s hot, what’s not, free downloads and other industry news.
Add to your blog reader now, if you wish to get the juice of what’s in, what’s out in this industry.