943,542 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1265
  • VB.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Jan 17th, 2009
0

How do I share projects on the web?

Expand Post »
I'm starting to get the hang of writing VB.NET code--very simple jobs, but covering some esoteric subject matter. The first two tasks I needed to accomplish came about because I decide to import my (rather large) CD collection onto my new (also rather large) external hard drive; I used Apple’s iTunes. iTunes uses an online database to identify each CD and employs the information to create folder (i.e. album) and track (song) names. These names are truncated and/or abbreviated to fit file systems which only accommodate short file/directory names. Sometimes, the database cannot identify the album; as I have the original in hand, I can supply the missing information; unfortunately, iTunes makes no provision for this! I entered the missing info into a plain text file.

My first program asked for a target folder then inspected it for a text file called titles.txt. If found, it opened the text file and counted the number of .m4a (music) files in the folder. If the text file had the same number of titles as tracks in the folder, it renamed the tracks to match the names. Unfortunately, there are a few illegal characters where file/folder names are concerned. The program has provisions for replacing invalid characters as designated by the user. This worked great for the song titles which were missing!

RenameSongs3.zip


My second task was a bit more daunting! The actual .m4a file contains the complete song title but the file has a truncated/abbreviated name, this is displeasing to my perfectionist eye! I wrote a second program which, when pointed at a folder, looks at every .m4a file in it and all sub-folders it contains, and reads the song name from the file then renames the file appropriately (given that the file system I use may contain very long names and replacing any invalid characters). This required two fairly difficult (for a beginner) sub-tasks—one was to recursively inspect all sub-directories the other was to parse the meta-data in an MP4 (.m4a) file.

tag2file.zip

Years ago I knew how to post code projects on my web page (different OS!) I may be able to figure out how to zip up a project and post it on my website, but what do I need to include, to make the offering useful? I have downloaded tons of code examples and not a single one would compile! Sometimes the code itself was worth reading, but I would like folks to be able to compile and run my examples. I will try zipping the project folder and sticking that on my site.
Last edited by edgar5; Jan 18th, 2009 at 12:00 am. Reason: -ed.--add web links
Similar Threads
Reputation Points: 18
Solved Threads: 2
Light Poster
edgar5 is offline Offline
30 posts
since Dec 2008
Jan 18th, 2009
0

Re: How do I share projects on the web?

Very great you can share them and make communities around them too at http://codeplex.com
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 18th, 2009
0

Re: How do I share projects on the web?

...you can share them and make communities around them too at http://codeplex.com
I had not found codeplex--looks like a good resource for both mining and posting code. Thanks!
Reputation Points: 18
Solved Threads: 2
Light Poster
edgar5 is offline Offline
30 posts
since Dec 2008
Jan 18th, 2009
0

Re: How do I share projects on the web?

and what about http://sourceforge.net/ ?
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 18th, 2009
0

Re: How do I share projects on the web?

and what about http://sourceforge.net/ ?
I'm a member at Sourceforge but do not find it user friendly. For me, as a seeker of sample code, not a single one of at least 15 VB.Net project I got there would compile and run! I think the major changes in VB2008 are the culprits !

I am working on the second project today (tag2file). It is still very rough! Am learning about Try...Catch...Finally. When last I coded (about 8 years ago) they were just showing up and I never really learned the details. Is this proper:



VB.NET Syntax (Toggle Plain Text)
  1. Try
  2. My.Computer.FileSystem.RenameFile(fileNameFull, fileNameWext.ToString())
  3. Catch Ex As ArgumentException
  4. Catch Ex As FileNotFoundException
  5. Catch Ex As PathTooLongException
  6. Catch Ex As IOException
  7. Catch Ex As NotSupportedException
  8. Catch Ex As SecurityException
  9. Catch Ex As UnauthorizedAccessException
  10. MsgBox("Uncaught file rename error. " + Ex.GetType().Name + vbNewLine + "Did NOT rename:" + vbNewLine + fileNameFull)
  11. Finally
  12. MsgBox("Unknown uncaught file rename error. Did NOT rename:" + vbNewLine + fileNameFull)
  13. End Try

or do I have to catch each seperately with its own MsgBox?
Reputation Points: 18
Solved Threads: 2
Light Poster
edgar5 is offline Offline
30 posts
since Dec 2008
Jan 18th, 2009
0

Re: How do I share projects on the web?

Click to Expand / Collapse  Quote originally posted by edgar5 ...
VB.NET Syntax (Toggle Plain Text)
  1. Try...End Try
or do I have to catch each seperately with its own MsgBox?
Ah, now I see! If I want a generic "catch all" I use:
VB.NET Syntax (Toggle Plain Text)
  1. Try
  2. ...
  3. Catch exp As Exception
  4. MsgBox("An error occurred while attempting to load a file. The error is:" + System.Environment.NewLine + exp.ToString() + System.Environment.NewLine)
  5. End Try
Reputation Points: 18
Solved Threads: 2
Light Poster
edgar5 is offline Offline
30 posts
since Dec 2008
Jan 18th, 2009
0

Re: How do I share projects on the web?

You've to. and don't write catch code in Finally (because finally code executed in all cases)
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 18th, 2009
0

Re: How do I share projects on the web?

Click to Expand / Collapse  Quote originally posted by edgar5 ...
VB.NET Syntax (Toggle Plain Text)
  1. Try...End Try
or do I have to catch each seperately with its own MsgBox?
Ah, now I see! If I want a generic "catch all" I use:
VB.NET Syntax (Toggle Plain Text)
  1. Try
  2. ...
  3. Catch exp As Exception
  4. MsgBox("An error occurred while attempting to load a file. The error is:" + System.Environment.NewLine + _
  5. exp.ToString() + System.Environment.NewLine)
  6. End Try
Reputation Points: 18
Solved Threads: 2
Light Poster
edgar5 is offline Offline
30 posts
since Dec 2008
Jan 18th, 2009
0

Re: How do I share projects on the web?

You've to. and don't write catch code in Finally (because finally code executed in all cases)
Ah, " finally code executed in all cases" that was very helpful info!
Reputation Points: 18
Solved Threads: 2
Light Poster
edgar5 is offline Offline
30 posts
since Dec 2008
Jan 18th, 2009
0

Re: How do I share projects on the web?

Exactly and in .net 2.0 and later you can write
vb.net Syntax (Toggle Plain Text)
  1. 'try block
  2. catch..
  3. catch..
  4. catch..
without need to use nested try catch
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Datagrid: New record with identity column
Next Thread in VB.NET Forum Timeline: Useful links information tips for .net newbie





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC