=== bgs100 is now known as bgs000 === aiufrefvaernvcea is now known as pheezer1 === Chaser__ is now known as Chaser === daker_ is now known as daker === bgs000 is now known as bgs100 [16:01] Is the session on C# tomorrow? [16:02] no one? [16:02] qwebirc12673: today [16:02] hey classbot [16:02] k thanks sebner! [16:03] qwebirc12673: and tomorrow and on friday ;) [16:03] np [16:04] its in 5 more hours right? [16:04] oneDoRa: 20 UTC so yes [16:05] thanks === yofel_ is now known as yofel [18:45] Hi === qwebirc45340 is now known as DSHackerc === apachelogger is now known as darthvader2point === JanC_ is now known as JanC === daker_ is now known as daker === darthvader2point is now known as apachelogger [20:09] isn't it past 20:00 GMT ? [20:09] type GMT time on google :D [20:10] ah of course.. winter/summertime really messes up my idea of international times [20:11] lol [20:11] it's UTC, not GMT [20:16] :O [20:17] it:s 19:17 GMY now [20:17] GMT* [20:17] pleia2, I think UTC = GMT, no? [20:17] yes [20:17] i thought UTC or GMT dont make much of a difference [20:17] I think so [20:17] time to google lol [20:18] 7:18pm Wednesday (GMT) - Time in GMT [20:18] after googling 'utc time' [20:19] yeh they are the same according to wiki lol [20:19] ah, ok :) [20:19] minor differences lol [20:19] anyway, juju2143's class is in 40 minutes [20:19] cool [20:19] good. [20:20] and classbot will change the topic when it's time :) [20:22] lol === BlackZ_ is now known as BlackZ [20:43] * directhex wonders what to expect [20:44] directhex: something [20:44] always expect something [20:45] :P [20:47] as long as everything's restricted to sensible advice like "install mono-devel and libgtk2.0-cil-dev and monodevelop", i can go play videogames [20:47] meaning? [20:48] meaning "i like videogames more than heckling" [20:48] Why is the class about C# and not C++ or C, as I'd expect for ubuntu. [20:49] I like hacking more then videogames, though I can't say I'm not addicted to both ;-) [20:49] hey guys...take this to #ubuntu-classroom-chat [20:50] zkriesse: this session will be an unmoderated one, by request of the instructor [20:50] Raven|Away, why not? and c# has more representation in a default ubuntu system than c++ [20:50] pleia2: cool [20:50] Raven|Away: if we have someone who can teach C++ or C, I'd be delighted to add them to the schedule :) [20:51] this channel welcomes a huge spectrum of contributors for classes, just because we have one class does not mean we're promoting it to the exclusion of others, it just means that someone volunteered to do it [20:51] three day class though, i'm impressed [20:53] so *please* if you have interest in doing a class, let me know or drop by #ubuntu-classroom-backstage where the rest of the classroom volunteers hang out :) === Raven|Away is now known as Raven [20:55] i could do a class on c shar... wait a second o_o [20:58] hm [20:58] and im not even sure if it's 3 days or 32767 days [20:58] or just 1 day [20:59] juju2143: yeah, just let me know if you need to extend it :) pedro3005 said 3 days was an ok start [20:59] ok [20:59] yeah that was some basic estimation [21:03] oh [21:03] 20GMT right? [21:03] yeh [21:03] everyone's ready? [21:03] * pleia2 hrms at classbot [21:04] * juju2143 spanks ClassBot [21:04] oh lol it wasn't opped. [21:05] it should auto-op, I'll have to look at why it's not behaving [21:05] but please feel free to begin :) [21:05] ok. === Testicle is now known as Karvakalle [21:06] Welcome to Introduction to C# Day 1 (a.k.a. Programmation I) [21:06] Karvakalle: thank you [21:06] ok pleia2 i'm out === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - http://wiki.ubuntu.com/Classroom || Support in #ubuntu || Current Class: Introduction to C# Day 1 [21:07] :P [21:07] thx pleia2. [21:07] As you know, C# is an OOP language (my favorite one :P) [21:08] Made by Microsoft as part of .NET Framework, there is a free implementation by Novell called Mono. [21:09] Since everyone here appears to have Ubuntu (hence the channel name), We will use mono. [21:10] but windows users can take this course as well without any problems. [21:11] Also, we will need an IDE. We will use MonoDevelop, but any text editor will do. [21:13] So on Ubuntu, you may want to install mono-complete (2.4.4 on Lucid) and monodevelop (2.2.1 on lucid). [21:14] If you have questions, you can ask them here or on #ubuntu-classroom-chat. [21:15] (optional: mono 2.6.3 and monodevelop 2.4 for lucid at badgerports.org) [21:15] Hi [21:15] :o [21:15] directhex, newer versions would be the best, thanks for the link. [21:16] Darn I haven't been on Ubuntu for a long time... [21:16] Cr`eme, hehe. [21:16] :o [21:16] I will log on now [21:16] Now we will begin with our first Hello World. [21:16] Start monodevelop [21:17] (and Cr`eme, there is logs on irclogs.ubuntu.com) [21:18] ok [21:18] juju [21:19] where do i get monodevelop? [21:19] apt:monodevelop [21:19] Cr`eme, sudo apt-get install monodevelop mono-complete [21:19] ok thankyou [21:19] (you may want to install libgtk2.0-cil-dev as well, for GUI development, it isn't pulled in automatically on lucid) [21:20] ok [21:21] yeah directhex, you need this package, or else you would get problems compiling my GTK# example [21:21] (it's pulled in automatically with MD 2.4 packages) [21:22] ok. [21:22] it says package not found in 9.10 [21:22] darn this is taking forever [21:22] pedro3005, hmmm [21:23] there is libgtk2.0-dev [21:23] I have 10.04 right now, I can't say [21:23] and libgtk2.0-cil [21:23] yeah libgtk2.0-dev [21:23] ok [21:23] you don't need libgtk2.0-cil-dev on 9.10, it'll just work [21:24] alright, thanks [21:24] Also, you may want to install the documentation, it will be useful. [21:25] i have one more minute left [21:25] Or you can check them on Microsoft'S website. [21:25] Cr`eme, ? [21:25] till the instaltion is done [21:25] ok i'll continue in one minute. [21:26] juju2143, is there going to be a day for C++? [21:26] Cr`eme: if someone volunteers to do a session on it [21:26] oh ok [21:26] ok i think i am done, LoL how do i check if i got it right [21:27] ok i am done [21:27] ok [21:28] Monodevelop should be in Applications > Programmation > MonoDevelop [21:28] ok done [21:28] where is aplications? [21:28] :O [21:28] in Gnome, at the top left of the screen [21:28] Cr`eme, do you even use ubuntu? [21:29] oh lol [21:29] my bad [21:29] >_> [21:29] sorry [21:29] i had a brain fart [21:29] lol np. [21:29] but there is no program [21:29] section [21:29] hmmm [21:29] sometimes you need to restart gnome, I guess [21:29] I have my Ubuntu in French [21:29] :O [21:30] I'm not sure of the English name. [21:30] it says Programming in my one [21:30] Programming here too [21:30] ok it's Programming. [21:30] Development for me [21:30] darn [21:30] for somereason i didnt install it [21:30] d: [21:30] Cr`eme, oh lol. [21:30] try running from the terminal [21:30] ok [21:31] Cr`eme: maybe take this to #ubuntu-classroom-chat to get help so juju2143 can move along with the class for others who are participating? [21:31] ok [21:31] pleia2, yeah good idea. [21:32] wait [21:32] i got it [21:32] it is done installing [21:32] ok [21:32] now we'll move on. [21:32] yey! [21:32] oooh nice program [21:32] :o [21:32] I'll program in Dev c++, win32 [21:32] rs [21:33] if we can move general chat to #ubuntu-classroom-chat and keep this channel less cluttered, that will help things move along [21:33] sopa, it have c#? [21:33] yes [21:33] good then. [21:33] I'm in my service computer [21:33] only windows [21:33] work* [21:33] monodevelop is available for windows, linux, and mac os. use the os of your choice. any GUI examples will likely relate to how monodevelop behaves. [21:33] :) [21:33] sopa, but I'm not sure it would create a project like in monodevelop [21:34] also you can use Microsoft Visual Studio. [21:34] nearly same thing. [21:35] I need to install visual studio here [21:35] Only difference is the graphical interface creator, MSVC have Windows Forms, while MonoDevelop don't have a Windows forms Editor. [21:36] juju2143, lets start :o [21:36] There is a free version called Visual C# on MS' website. [21:36] Now open a new console application. [21:36] good! [21:37] Day 1: Your first console application. [21:37] where do you open the console application? [21:37] on monodevelop? [21:37] ya [21:38] in MonoDevelop, File > New > Solution... [21:38] (File/New/Solution/C# on the left, COnsole Project on the right) [21:38] C# > Console Application [21:38] yep. [21:38] enter a project name, hit forward [21:38] ok then what [21:38] k [21:39] and now in front of your eyes you should see a sample hello world code. [21:39] Let's analyse it. [21:39] ok [21:40] ok [21:40] The C#compilers works like in Java, the code is semi-compiled. [21:41] It isn't letting me run the code [21:41] So it compiles C# in an intermediate code, then interpreted in Mono or .NET Framework. [21:41] i will go to my cellphone [21:41] one minute [21:41] I click build, it builds without error, but Run is grayed out [21:41] That's why the same binary will work on both Windows and Linux. [21:42] pedro3005, hm? [21:42] :o [21:42] juju2143, in monodevelop [21:42] it doesn't let me run the hello world code [21:42] pedro3005, Ctrl-F5? [21:42] nothing happens [21:42] check if you have errors in your code [21:43] in your error list [21:43] 0 [21:43] :/ [21:43] I didn't alter it one bit [21:43] nothing at all in the "application output" panel? [21:43] hmmm [21:43] juju do we need to install any special software to run our c# programs on another os? [21:44] oneDoRa, you need any kind of .NET framework - so that'd be Microsoft.NET or Mono on Windows, and Mono on Linux/Mac/BSD [21:44] oneDoRa, on Windows, .NET Framework (should be already installed in most recent windows) [21:44] and mono on the rest [21:44] oic [21:44] thanks [21:44] directhex, I see no such panel.. it used to work a couple days ago [21:44] damn it [21:44] hmmm [21:45] pedro3005, let'smove on ok [21:45] pedro3005: it should be right bellow your code [21:45] pedro3005, open a console, go to ~/Projects/solutionname/projectname/bin/Debug and try running "mono projectname.exe" manually [21:45] pedro3005: try View -> Application output [21:45] pedro3005, what oneDoRa directhex and tsimpson said. [21:46] but yes, i agree, support issues in #ubuntu-classroom-chat would help things move along [21:46] yeah. [21:46] So you have your hello world program. [21:47] It outputs "Hello world!". [21:47] right? [21:47] Hello World! [21:47] yes [21:47] yep [21:48] In the middle of your program you will recognize the "Hello World!" string right [21:48] Console.WriteLine("Hello World!"); [21:48] ok now for some reason it runs [21:48] :) [21:49] congrats pedro3005 :P [21:49] Now you will wonder, Console.WriteLine would be used for outputting things in the console. [21:49] Voltei :) [21:49] You are right. [21:51] So, you know functions, WriteLine is the name, Console is the class in which WriteLine is [21:51] strings are in ""s [21:51] WriteLine is a static method (function, or whatever your favourite language calls it) on the System.Console object. It only needs to say "Console" because the "using System;" line at the top of the code makes it implicit [21:51] and you have to finish lines with ; [21:51] sopa, english only in here [21:52] directhex, of course [21:52] lol you would help me. [21:52] I forgot how to talk "eu voltei" [21:53] Yes, WriteLine is actually called a method because it's in a class. [21:53] ok [21:53] So we have a namespace, a class and a method in your code. [21:54] You see the Main method? We would call it Whateveryoucalledyourproject.MainClass.Main(args) [21:55] But if you use using like on the top of the file we will actually call it MainClass.Main(args) [21:55] and inside the same class as MainClass we will call it only Main() [21:56] So OOP is useful to organize your code. [21:57] It's kinda handy. [21:57] So on the types. [21:57] You see in front of Main the keyword int. [21:58] heh... maybe it'll sound little weird but so far it's syntax looks for me like a mix of perl and python... [21:58] So C# is strongly typed, so your function must return an integer. [21:59] I have "public static void Main" [21:59] sirmacik, yeah, could be [21:59] tsimpson, yeah [21:59] right it's void [21:59] I changed it for mai [21:59] int [21:59] errata: you have void [22:00] so void tells the fuction that it would return nothing [22:00] If you would have int you will have to write a return 0; line at the end. [22:03] So you have variables. [22:04] At the beginning of the method, the line after Main(), write this: int Answer = 42; [22:05] then modify your WriteLine so it would look like this: Console.WriteLine(Answer); [22:06] public static void Main() [22:06] { [22:06] System.Console.WriteLine("Hallo Welt!"); [22:06] } [22:06] between Main() and { ? [22:06] Pa_trick17: yes [22:06] Pa_trick17, after the { [22:06] oh [22:06] :d [22:06] ah, ok thx [22:06] sorry [22:06] Pa_trick17, the {} says "everything inside here is part of the Main method" [22:07] yeah [22:07] after the { [22:07] what does "static" mean? I forgot [22:07] pedro3005, well see that later. [22:07] Disregard this for now. [22:09] Now compile and run, you should see 42. [22:14] So. [22:14] You know the variables. You can put anything in a variable. [22:15] string var = "some string"; [22:15] int Answer = 42; [22:15] anything that's of the correct type for that variable, i.e. you can't put "foo" in an int [22:15] You can even put your MainClass in a variable. [22:15] But you can put a string in a int variable. [22:16] juju2143, the variable type would be what then? [22:16] string [22:16] I mean when you put a class in a variable [22:16] the calss name [22:16] MainClass var = new MainClass(); [22:17] pedro3005, variables are objects. "int" is shorthand for "System.Int32". "string" is shorthand for "System.String". Everything's an object, including your class - and that object's type is whatever the class is called [22:17] When would you use a cinstruction like that? [22:17] sry - you CAN or you CAN'T put a string in a int variable? [22:17] Pa_trick17: can't [22:17] Yep, everything is object. [22:18] Pa_trick17, you can put an integer in a string object, but not the reverse [22:18] directhex, you can? [22:18] juju2143, sure. "42" is technically text as well as a number [22:18] yeah. [22:19] but "42" is technically a string, no matter what's in the "" [22:19] while 42 is a number [22:19] yes, that's correct [22:19] sure [22:19] if I change "int" to "string": Main.cs(32,32): Error CS0029: Cannot implicitly convert type `int' to `string' (CS0029) (helloworld) [22:19] Yep, they can't convert int to string. [22:20] You would use method in Convert class [22:20] such as Convert.ToString() [22:22] So here's the principal types you would use in your code: bool, byte, sbyte, char, decimal, double, float, int, uint, long, object, short, string [22:23] you can actually do this in other ways too, e.g. remember your "Answer" integer? Answer is a System.Int32 object, and as that tgype of object, you can call its "ToString()" method, i.e. Answer is an int, Answer.ToString() is a string [22:23] ulong, ushort [22:23] And generally, every thype have his ".ToString()" method [22:23] like directhex said [22:24] because all objects inherit (look up inheritance in object-oriented programming) from System.Object, and Object has a ToString() [22:24] you know heritage? Every type I said herits from object [22:24] inherits from object [22:24] and Object have a ToString() [22:24] (reference: http://msdn.microsoft.com/en-us/library/system.object.tostring.aspx) [22:24] Lol, ninja'd by directhex. [22:27] Now next thing is if/else [22:27] Ithink everyone who already knows a language knows if/elses. [22:28] It's very simple, like this example: [22:28] if(Answer = 42) { [22:28] Console.WriteLine("The answer is 42"); [22:28] }else{ [22:29] Console.WriteLine("The answer is NOT 42"); [22:29] } [22:29] woops [22:29] first line should be if(Answer == 42) { [22:29] 2 equal signs [22:31] so try changing 42 to something else [22:31] it will change the output [22:33] juju2143, okay [22:33] it works good [22:34] good [22:34] now for loops [22:34] also simple [22:35] for(int i = 0; i < 100; i++) [22:35] { [22:35] Console.WriteLine(i); [22:35] } [22:35] compile and run. [22:35] good, works the same as C [22:36] juju2143, but you can declare int i inside the loop? [22:36] yeah, if you already know C or Java, should be easy to catch. [22:36] pedro3005, no [22:36] you just did [22:36] for(int i = 0; [22:36] I declared i in the for instruction [22:37] C complains when I do that [22:37] pedro3005: it's like C99 [22:37] so the for instruction is separated in 3 [22:37] int i = 0; is executed before the loop [22:37] in normal ANSI C, you need to declare int i _before_ the loop instruction [22:38] i < 100; is evaluated each time it loops [22:38] int i; for(i=0; i<100; i++) { ... } [22:38] tsimpson, in C# you can declare it in the for [22:38] which makes things much easier :) [22:38] mhm. [22:41] also you can do the same with a while loop [22:41] int i = 0; [22:41] while(i < 100) [22:41] { [22:41] Console.WriteLine(i); [22:41] i++; [22:41] } [22:42] does do - while work too? [22:44] seems to work, yes [22:45] pedro3005, yes [22:49] So you know everything neede to do a console application [22:50] If you type Console. tou will se a list of all the functions in that class, you can play with that [22:50] *you will see [22:51] also notice the Main(string[] args) [22:51] args is actually an array [22:51] args[0] is the first argument [22:51] args[1] is the second and so on [22:53] quick question, how can I tell the length of the array? [22:55] array.Length [22:55] thanks [22:55] also to do a array variable, you would do string[] var = { "a", "b", "c" }; [22:56] or string[] var; [22:56] var[0] = "a"; [22:56] and so on [22:56] is there something like strcpy()? [22:57] strcopy? [22:57] okay [22:57] string string1 = string2 [22:57] so you can do [22:57] string[] var = "Hello, World!"; [22:57] ? [22:57] yes [22:57] wait, no. [22:57] you have to remove the [] [22:58] hm... [22:58] why? [22:58] or put "Hello Word" in var[0] [22:58] because "Hello, World!" is NOT an array [22:58] :o [22:59] okay [22:59] does C# have pointers? [22:59] no [22:59] I'm liking it already [22:59] in fact yes [22:59] :/ [22:59] but you would have unsafe things [22:59] pedro3005: string is a class, not an array of char ;) [23:00] so var in this example is an array of strings [23:00] similar to the C char** or char* argv[] [23:01] I see [23:01] :D [23:01] So now you have everything to do some cool console application [23:01] you have Console.ReadLine to read lines [23:01] string variable = Console.ReadLine(); [23:02] then Console.WriteLine(variable); [23:03] Homework today: do something wit that. [23:03] Okay :) [23:03] Tomorrow we'll see GTK# apps. [23:03] And we'll do more than one function. [23:04] Try/catch, converts, etc. [23:04] god damn it, stopped working yet again [23:05] O_o [23:05] so see ya at the same hour tomorrow. [23:05] at 20-22UTC. === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - http://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi [23:05] Thank you, juju2143 [23:08] You're welcome.