I hope this doesn't qualify as a programming question. (If it does, I'm truly sorry.) I work for a university, and my department hires students (I am one myself) for web and database development. We use ASP .NET, but most of the students we hire only know PHP, C++, or Java, which are part of the CS curriculum here. I'm trying to come up with a training program, mainly to introduce new employees to ASP.NET and C#. I'm open to anything - website tutorials, books, videos, etc. If anyone has recommendations on materials or methods it would be hugely appreciated. Are there any that you have found to be particularly helpful? dan :)
dnmanner
Posts
-
Teaching .NET -
Picking Up C# or How I typed my fingers to the bonebetterc wrote: But I really had to grin when I googled to find that to get my application path I needed to enter: string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); Environment.CurrentDirectory also gets the application path. It's a bit easier on the keyboard. :) betterc wrote: I think we need a contest on what is the longest statement possible in c# to retrieve a smiple result. There are 8 dots between the = sign and the ; in the above snippet. I once came across (alright, wrote :|) this code to decrypt a file:
string Decrypted = System.Text.ASCIIEncoding.ASCII.GetString(new System.Security.Cryptography.TripleDESCryptoServiceProvider().CreateDecryptor(System.Text.Encoding.ASCII.GetBytes(xdoc.SelectSingleNode(System.Configuration.ConfigurationSettings.AppSettings["key"]).InnerText), System.Text.Encoding.ASCII.GetBytes(xdoc.SelectSingleNode(System.Configuration.ConfigurationSettings.AppSettings["iv"]).InnerText)).TransformFinalBlock(System.Convert.FromBase64String(System.IO.File.OpenText(System.Configuration.ConfigurationSettings.AppSettings["filepath"]).ReadToEnd()), 0, System.Configuration.ConfigurationSettings.AppSettings["length"]));
Dan -
Registering Controls DynamicallyHello, :) We have custom controls we use on practically every ASP .NET page. This means placing the Register directive on every page, which seems inefficient. Is there a way to do this dynamically, for instance, registering the tag prefix in web.config or machine.config or storing the controls in the global assembly cache, so that custom controls can be added just like built-in controls? Many thanks, Daniel
-
split "C:\hello" "C:\h\ddd"You might want to try either of these methods: 1. Using Regular Expressions
Dim s As Regex = New Regex("\""([^\""]*)\""(?:\s)*") Dim match As Match = s.Match(w) ' where w is the string mentioned While (match.Success) ' match.Groups(1).Value will contain the string match = match.NextMatch() End While
2. Since filenames can't contain strings, you can replace " " sequence with a single character, trim the quotation marks at the beginning and end of the string, and use the Split function, as follows (assume w is the string that holds the folder names):Const quotchar As String = """" w = w.Trim(quotchar) ' remove quotes from start and end w = w.Replace(""" """, quotchar) ' replace " " with " Dim stringarray As String() = w.Split(quotchar) ' Now just invoke split and save to array
Hope this helps. :)