Smit Shah

Below is a sniplet of code I used to download the entire FTP folder with sub folders and files.

You will need to download the DLL from http://www.codeproject.com/KB/IP/FtpClient.aspx

Simply copy paste the code below onto a console application, and you should be set to go.

Please note, you may have to do some error checking for your specific application.

The code below has not been tested and is a simple POC.



Imports System
Imports System.IO
Imports System.IO.File
Imports System.IO.FileInfo
Imports System.IO.Directory
Imports System.IO.DirectoryInfo
Imports System.Drawing

Module Module1

Private Sub DownloadEverything(ByVal FTPFolder As String, ByVal LocalFolder As String)
 Dim myFtp As New Utilities.FTP.FTPclient("hostname", "username", "password")
 Dim FTPDirectories = myFtp.ListDirectory(FTPFolder)
 For Each FTPDirectory In FTPDirectories
  With New DirectoryInfo(FTPDirectory)
   CreateDirectory(LocalFolder & "\" & .Name)
   DownloadEverything(FTPFolder & "/" & .Name, LocalFolder & "\" & .Name)
  End With
 Next
 Dim FTPFiles = myFtp.ListDirectoryDetail(FTPFolder).GetFiles
 For Each FTPFile In FTPFiles
  myFtp.Download(FTPFile, LocalFolder & "\" & FTPFile.Filename)
 Next
End Sub

Sub Main()
 Dim sLocalFolder As String = "C:\Temp\"
 Dim sRemoteFolder As String = "/"
 DownloadEverything(sRemoteFolder, sLocalFolder)
End Sub

End Module
I was stumped today when my ASP.Net site started creating this error

__doPostBack is not defined

I had no idea as to what was causing it.
After numerous searches and a lot of links later, I hit the target.

The reason it generated that error is simple, there are no controls on the page that are set to do a postback, so the postback function does not get sent to the client.

However, you can force the page to send the function to the client by one simple line in your page_load function


ClientScript.GetPostBackEventReference( <YOUR CONTROL NAME>, "")
In my case I have a repeater and hence
ClientScript.GetPostBackEventReference(rptPosts, "")

Hope this helps and saves you some trouble.
Using mainstream technology on any project helps sustainibility. The amount of effort increases exponentially as the complexity increases. General rule of thumb I follow is the KISS concept. Keep It Simple Stupid. The simpler the project, the lower the risk of failure. Lesser is the effort required.
And just like that, in one day I got a 30% jump in traffic.

Lets keep them coming...
I have been having a good last few weeks with over 500 visitors to my website daily.
All of a sudden I see it drop from 700 to 450 in two days... wonder what the Google Gods liked or disliked on the site that it droped as quickly as it did.

Hope they are pleased again and bring back those visitors.

Apple launched its first version of iPod in 2001. It revolutionized how people listen to music. It CREATED a market that did not exist before that.

Apple created a new smart phone market with their launch of the iPhone. The created a market for touch screen phones.

Microsoft had their Windows Mobile OS in the market for years before. I owned a HTC Smartphone sold under T-Mobile's brand name in 2004, way before the iPhone was released in 2007.

Today, there are talks about Apple releasing iPhone 5.

Talking about more recent times, I recently purchased an Android Tablet (Acer A500), a Windows Tablet (Acer W500) and an iPad 2. I have also owned a Windows Phone 7 for over 7 months.

I like the home screen that the Windows Phone 7 offers. It is easier to scroll through the home screen than flipping through it like the Android and iOS versions do.

The biggest difference that I noticed though, was the ability of a windows or an android phone to navigate BACK to the previous screen. I have been so used to the back button at the bottom of my screen, that I naturally gravitate towards that button incase I did something wrong.

Try doing that with your iOS device. Well, you cant. You are relying on the application developer to allow you to go back. Even when the button is available, it is not always on the same location. BIG MISS on this MR JOBS.

Apple is trying to create its own closed world, but restricting its systems, and softwares with APIs that are not as extensive as the Android or Windows systems.

All in all, Apple is a great brand, and it has a great loyal customer base. But, you have to do something COOL to reclaim that "innovator" spot.

Till than... Apple has run its course.

Jim Cramer of Mad Money is an IDIOT. He has no idea where the market is going...

A few months ago he recommended buying Citigroup(C) for 5$ and said it is going to 8

The stock has since been going in the opposite direction.

He needs to pull his head out of his @$$ and look at the world arround him.

What a joker.

Like he says on his show, he is an entertainer...

What can I say, I didnt listen to other bloggers and am paying through the nose for it.

I come from a science background.

Every event, every action can be explained by a cause, a reason for it happening.

However, there are times when we can not explain why or how an event occured.

We call them Miracles, Luck etc.

 

Along the same line of thinking, while programming, we try to address all possible scenarios. 

We parse, and process all possible values to avoid unexpected results.

However, even than, we have "unhandled exceptions"

Shouldnt we rather call them "act of god?"

What do you think of the pseudo code below?

 

Try

  Dim Data as String

  Process.Information(Data)

  return "Success"

Catch God as Exception

  return "Act of God"

End Try

 

Finally....

The Picturify.com site is up.

Along with the site, I have also added an API for public usage.

The information can be accessed at http://www.picturify.com/API.aspx

It is an easy to use Microsoft.Net webservice.

This will generate a QR code for the text provided to it.

Your feedback is appreciated.

I have had this domain for some time.

Thinking about adding a tool that would allow users/visitors to generate dynamic images.

Working on the feature list currently.

Will have something up shortly.

1  2  3  4  
                                                                                         
This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet/ BOL /Other sites that are authorities in their field. Me or employer do not endorse any tools, applications, books, or concepts mentioned on the site. I have documented my personal experience on this site. The information on this site may not be up to date or accurate at times, if you are not sure or have a question, please contact me to verify information.