/srv/irclogs.ubuntu.com/2010/06/23/#ubuntu-classroom.txt

=== 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
qwebirc12673Is the session on C# tomorrow?16:01
qwebirc12673no one?16:02
sebnerqwebirc12673: today16:02
qwebirc12673hey classbot16:02
qwebirc12673k thanks sebner!16:02
sebnerqwebirc12673: and tomorrow and on friday ;)16:03
sebnernp16:03
oneDoRaits in 5 more hours right?16:04
sebneroneDoRa: 20 UTC so yes16:04
oneDoRathanks16:05
=== yofel_ is now known as yofel
qwebirc45340Hi18:45
=== 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
Raven|Awayisn't it past 20:00 GMT ?20:09
oneDoRatype GMT time on google :D20:09
Raven|Awayah of course.. winter/summertime really messes up my idea of international times20:10
oneDoRalol20:11
pleia2it's UTC, not GMT20:11
juju2143:O20:16
juju2143it:s 19:17 GMY now20:17
juju2143GMT*20:17
pedro3005pleia2, I think UTC = GMT, no?20:17
juju2143yes20:17
oneDoRai thought UTC or GMT dont make much of a difference20:17
juju2143I think so20:17
oneDoRatime to google lol20:17
pedro30057:18pm Wednesday (GMT) - Time in GMT20:18
pedro3005after googling 'utc time'20:18
oneDoRayeh they are the same according to wiki lol20:19
pleia2ah, ok :)20:19
oneDoRaminor differences lol20:19
pleia2anyway, juju2143's class is in 40 minutes20:19
oneDoRacool20:19
juju2143good.20:19
pleia2and classbot will change the topic when it's time :)20:20
juju2143lol20:22
=== BlackZ_ is now known as BlackZ
* directhex wonders what to expect20:43
zkriessedirecthex: something20:44
zkriessealways expect something20:44
juju2143:P20:45
directhexas long as everything's restricted to sensible advice like "install mono-devel and libgtk2.0-cil-dev and monodevelop", i can go play videogames20:47
zkriessemeaning?20:47
directhexmeaning "i like videogames more than heckling"20:48
Raven|AwayWhy is the class about C# and not C++ or C, as I'd expect for ubuntu.20:48
Raven|AwayI like hacking more then videogames, though I can't say I'm not addicted to both ;-)20:49
zkriessehey guys...take this to #ubuntu-classroom-chat20:49
pleia2zkriesse: this session will be an unmoderated one, by request of the instructor20:50
directhexRaven|Away, why not? and c# has more representation in a default ubuntu system than c++20:50
zkriessepleia2: cool20:50
pleia2Raven|Away: if we have someone who can teach C++ or C, I'd be delighted to add them to the schedule :)20:50
pleia2this 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 it20:51
directhexthree day class though, i'm impressed20:51
pleia2so *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 :)20:53
=== Raven|Away is now known as Raven
directhexi could do a class on c shar... wait a second o_o20:55
juju2143hm20:58
juju2143and im not even sure if it's 3 days or 32767 days20:58
juju2143or just 1 day20:58
pleia2juju2143: yeah, just let me know if you need to extend it :) pedro3005 said 3 days was an ok start20:59
juju2143ok20:59
juju2143yeah that was some basic estimation20:59
juju2143oh21:03
juju214320GMT right?21:03
oneDoRayeh21:03
juju2143everyone's ready?21:03
* pleia2 hrms at classbot21:03
* juju2143 spanks ClassBot 21:04
juju2143oh lol it wasn't opped.21:04
pleia2it should auto-op, I'll have to look at why it's not behaving21:05
pleia2but please feel free to begin :)21:05
juju2143ok.21:05
=== Testicle is now known as Karvakalle
juju2143Welcome to Introduction to C# Day 1 (a.k.a. Programmation I)21:06
zkriesseKarvakalle: thank you21:06
zkriesseok pleia2 i'm out21:06
=== 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
juju2143:P21:07
juju2143thx pleia2.21:07
juju2143As you know, C# is an OOP language (my favorite one :P)21:07
juju2143Made by Microsoft as part of .NET Framework, there is a free implementation by Novell called Mono.21:08
juju2143Since everyone here appears to have Ubuntu (hence the channel name), We will use mono.21:09
juju2143but windows users can take this course as well without any problems.21:10
juju2143Also, we will need an IDE. We will use MonoDevelop, but any text editor will do.21:11
juju2143So on Ubuntu, you may want to install mono-complete (2.4.4 on Lucid) and monodevelop (2.2.1 on lucid).21:13
juju2143If you have questions, you can ask them here or on #ubuntu-classroom-chat.21:14
directhex(optional: mono 2.6.3 and monodevelop 2.4 for lucid at badgerports.org)21:15
Cr`emeHi21:15
Cr`eme:o21:15
juju2143directhex, newer versions would be the best, thanks for the link.21:15
Cr`emeDarn I haven't been on Ubuntu for a long time...21:16
juju2143Cr`eme, hehe.21:16
Cr`eme:o21:16
Cr`emeI will log on now21:16
juju2143Now we will begin with our first Hello World.21:16
juju2143Start monodevelop21:16
juju2143(and Cr`eme, there is logs on irclogs.ubuntu.com)21:17
Cr`emeok21:18
Cr`emejuju21:18
Cr`emewhere do i get monodevelop?21:19
directhexapt:monodevelop21:19
juju2143Cr`eme, sudo apt-get install monodevelop mono-complete21:19
Cr`emeok thankyou21:19
directhex(you may want to install libgtk2.0-cil-dev as well, for GUI development, it isn't pulled in automatically on lucid)21:19
Cr`emeok21:20
juju2143yeah directhex, you need this package, or else you would get problems compiling my GTK# example21:21
directhex(it's pulled in automatically with MD 2.4 packages)21:21
juju2143ok.21:22
pedro3005it says package not found in 9.1021:22
Cr`emedarn this is taking forever21:22
juju2143pedro3005, hmmm21:22
pedro3005there is libgtk2.0-dev21:23
juju2143I have 10.04 right now, I can't say21:23
pedro3005and libgtk2.0-cil21:23
juju2143yeah libgtk2.0-dev21:23
pedro3005ok21:23
directhexyou don't need libgtk2.0-cil-dev on 9.10, it'll just work21:23
pedro3005alright, thanks21:24
juju2143Also, you may want to install the documentation, it will be useful.21:24
Cr`emei have one more minute left21:25
juju2143Or you can check them on Microsoft'S website.21:25
juju2143Cr`eme, ?21:25
Cr`emetill the instaltion is done21:25
juju2143ok i'll continue in one minute.21:25
Cr`emejuju2143, is there going to be a day for C++?21:26
tsimpsonCr`eme: if someone volunteers to do a session on it21:26
Cr`emeoh ok21:26
oneDoRaok i think i am done, LoL how do i check if i got it right21:26
Cr`emeok i am done21:27
juju2143ok21:27
juju2143Monodevelop should be in Applications > Programmation > MonoDevelop21:28
oneDoRaok done21:28
Cr`emewhere is aplications?21:28
Cr`eme:O21:28
tsimpsonin Gnome, at the top left of the screen21:28
juju2143Cr`eme, do you even use ubuntu?21:28
Cr`emeoh lol21:29
Cr`ememy bad21:29
Cr`eme>_>21:29
Cr`emesorry21:29
Cr`emei had a brain fart21:29
juju2143lol np.21:29
Cr`emebut there is no program21:29
Cr`emesection21:29
juju2143hmmm21:29
pedro3005sometimes you need to restart gnome, I guess21:29
juju2143I have my Ubuntu in French21:29
Cr`eme:O21:29
juju2143I'm not sure of the English name.21:30
oneDoRait says Programming in my one21:30
pedro3005Programming here too21:30
juju2143ok it's Programming.21:30
micahgDevelopment for me21:30
Cr`emedarn21:30
Cr`emefor somereason i didnt install it21:30
Cr`emed:21:30
juju2143Cr`eme, oh lol.21:30
pedro3005try running from the terminal21:30
Cr`emeok21:30
pleia2Cr`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
Cr`emeok21:31
juju2143pleia2, yeah good idea.21:31
Cr`emewait21:32
Cr`emei got it21:32
Cr`emeit is done installing21:32
juju2143ok21:32
juju2143now we'll move on.21:32
oneDoRayey!21:32
Cr`emeoooh nice program21:32
Cr`eme:o21:32
sopaI'll program in Dev c++, win3221:32
sopars21:32
tsimpsonif we can move general chat to #ubuntu-classroom-chat and keep this channel less cluttered, that will help things move along21:33
juju2143sopa, it have c#?21:33
sopayes21:33
juju2143good then.21:33
sopaI'm in my service computer21:33
sopaonly windows21:33
pedro3005work*21:33
directhexmonodevelop 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
pedro3005:)21:33
juju2143sopa, but I'm not sure it would create a project like in monodevelop21:33
juju2143also you can use Microsoft Visual Studio.21:34
juju2143nearly same thing.21:34
sopaI need to install visual studio here21:35
juju2143Only difference is the graphical interface creator, MSVC have Windows Forms, while MonoDevelop don't have a Windows forms Editor.21:35
Cr`emejuju2143, lets start :o21:36
juju2143There is a free version called Visual C# on MS' website.21:36
juju2143Now open a new console application.21:36
sopagood!21:36
juju2143Day 1: Your first console application.21:37
Cr`emewhere do you open the console application?21:37
Cr`emeon monodevelop?21:37
oneDoRaya21:37
juju2143in MonoDevelop, File > New > Solution...21:38
directhex(File/New/Solution/C# on the left, COnsole Project on the right)21:38
juju2143C# > Console Application21:38
juju2143yep.21:38
directhexenter a project name, hit forward21:38
Cr`emeok then what21:38
oneDoRak21:38
juju2143and now in front of your eyes you should see  a sample hello world code.21:39
juju2143Let's analyse it.21:39
Cr`emeok21:39
sopaok21:40
juju2143The C#compilers works like in Java, the code is semi-compiled.21:40
pedro3005It isn't letting me run the code21:41
juju2143So it compiles C# in an intermediate code, then interpreted in Mono or .NET Framework.21:41
sopai will go to my cellphone21:41
sopaone minute21:41
pedro3005I click build, it builds without error, but Run is grayed out21:41
juju2143That's why the same binary will work on both Windows and Linux.21:41
juju2143pedro3005, hm?21:42
Cr`eme:o21:42
pedro3005juju2143, in monodevelop21:42
pedro3005it doesn't let me run the hello world code21:42
juju2143pedro3005, Ctrl-F5?21:42
pedro3005nothing happens21:42
juju2143check if you have errors in your code21:42
juju2143in your error list21:43
pedro3005021:43
pedro3005:/21:43
pedro3005I didn't alter it one bit21:43
directhexnothing at all in the "application output" panel?21:43
juju2143hmmm21:43
oneDoRajuju do we need to install any special software to run our c# programs on another os?21:43
directhexoneDoRa, you need any kind of .NET framework - so that'd be Microsoft.NET or Mono on Windows, and Mono on Linux/Mac/BSD21:44
juju2143oneDoRa, on Windows, .NET Framework (should be already installed in most recent windows)21:44
juju2143and mono on the rest21:44
oneDoRaoic21:44
oneDoRathanks21:44
pedro3005directhex, I see no such panel.. it used to work a couple days ago21:44
pedro3005damn it21:44
juju2143hmmm21:44
juju2143pedro3005, let'smove on ok21:45
oneDoRapedro3005: it should be right bellow your code21:45
directhexpedro3005, open a console, go to ~/Projects/solutionname/projectname/bin/Debug and try running "mono projectname.exe" manually21:45
tsimpsonpedro3005: try View -> Application output21:45
juju2143pedro3005, what oneDoRa directhex and tsimpson said.21:45
directhexbut yes, i agree, support issues in #ubuntu-classroom-chat would help things move along21:46
juju2143yeah.21:46
juju2143So you have your hello world program.21:46
juju2143It outputs "Hello world!".21:47
juju2143right?21:47
directhexHello World!21:47
aduffy70yes21:47
oneDoRayep21:47
juju2143In the middle of your program you will recognize the "Hello World!" string right21:48
juju2143Console.WriteLine("Hello World!");21:48
pedro3005ok now for some reason it runs21:48
pedro3005:)21:48
juju2143congrats pedro3005 :P21:49
juju2143Now you will wonder, Console.WriteLine would be used for outputting things in the console.21:49
sopaVoltei :)21:49
juju2143You are right.21:49
juju2143So, you know functions, WriteLine is the name, Console is the class in which WriteLine is21:51
juju2143strings are in ""s21:51
directhexWriteLine 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 implicit21:51
juju2143and you have to finish lines with ;21:51
pedro3005sopa, english only in here21:51
juju2143directhex, of course21:52
juju2143lol you would help me.21:52
sopaI forgot how to talk "eu voltei"21:52
juju2143Yes, WriteLine is actually called a method because it's in a class.21:53
PieWaiok21:53
juju2143So we have a namespace, a class and a method in your code.21:53
juju2143You see the Main method? We would call it Whateveryoucalledyourproject.MainClass.Main(args)21:54
juju2143But if you use using like on the top of the file we will actually call it MainClass.Main(args)21:55
juju2143and inside the same class as MainClass we will call it only Main()21:55
juju2143So OOP is useful to organize your code.21:56
juju2143It's kinda handy.21:57
juju2143So on the types.21:57
juju2143You see in front of Main the keyword int.21:57
sirmacikheh... maybe it'll sound little weird but so far it's syntax looks for me like a mix of perl and python...21:58
juju2143So C# is strongly typed, so your function must return an integer.21:58
tsimpsonI have "public static void Main"21:59
juju2143sirmacik, yeah, could be21:59
juju2143tsimpson, yeah21:59
juju2143right it's void21:59
juju2143I changed it for mai21:59
juju2143int21:59
juju2143errata: you have void21:59
juju2143so void tells the fuction that it would return nothing22:00
juju2143If you would have int you will have to write a return 0; line at the end.22:00
juju2143So you have variables.22:03
juju2143At the beginning of the method, the line after Main(), write this: int Answer = 42;22:04
juju2143then modify your WriteLine so it would look like this: Console.WriteLine(Answer);22:05
Pa_trick17public static void Main()22:06
Pa_trick17  {22:06
Pa_trick17    System.Console.WriteLine("Hallo Welt!");22:06
Pa_trick17  }22:06
Pa_trick17between Main() and { ?22:06
sirmacikPa_trick17: yes22:06
directhexPa_trick17, after the {22:06
sirmacikoh22:06
sirmacik:d22:06
Pa_trick17ah, ok thx22:06
sirmaciksorry22:06
directhexPa_trick17, the {} says "everything  inside here is part of the Main method"22:06
juju2143yeah22:07
juju2143after the {22:07
pedro3005what does "static" mean? I forgot22:07
juju2143pedro3005, well see that later.22:07
juju2143Disregard this for now.22:07
juju2143Now compile and run, you should see 42.22:09
juju2143So.22:14
juju2143You know the variables. You can put anything in a variable.22:14
juju2143string var = "some string";22:15
juju2143int Answer = 42;22:15
directhexanything that's of the correct type for that variable, i.e. you can't put "foo" in an int22:15
juju2143You can even put your MainClass in a variable.22:15
juju2143But you can put a string in a int variable.22:15
pedro3005juju2143, the variable type would be what then?22:16
juju2143string22:16
pedro3005I mean when you put a class in a variable22:16
juju2143the calss name22:16
juju2143MainClass var = new MainClass();22:16
directhexpedro3005, 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 called22:17
PieWaiWhen would you use a cinstruction like that?22:17
Pa_trick17sry - you CAN or you CAN'T put a string in a int variable?22:17
tsimpsonPa_trick17: can't22:17
juju2143Yep, everything is object.22:17
directhexPa_trick17, you can put an integer in a string object, but not the reverse22:18
juju2143directhex, you can?22:18
directhexjuju2143, sure. "42" is technically text as well as a number22:18
juju2143yeah.22:18
juju2143but "42" is technically a string, no matter what's in the ""22:19
juju2143while 42 is a number22:19
directhexyes, that's correct22:19
PieWaisure22:19
tsimpsonif I change "int" to "string": Main.cs(32,32): Error CS0029: Cannot implicitly convert type `int' to `string' (CS0029) (helloworld)22:19
juju2143Yep, they can't convert int to string.22:19
juju2143You would use method in Convert class22:20
juju2143such as Convert.ToString()22:20
juju2143So here's the principal types you would use in your code: bool, byte, sbyte, char, decimal, double, float, int, uint, long, object, short, string22:22
directhexyou 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 string22:23
juju2143ulong, ushort22:23
juju2143And generally, every thype have his ".ToString()" method22:23
juju2143like directhex said22:23
directhexbecause all objects inherit (look up inheritance in object-oriented programming) from System.Object, and Object has a ToString()22:24
juju2143you know heritage? Every type I said herits from object22:24
juju2143inherits from object22:24
juju2143and Object have a ToString()22:24
directhex(reference: http://msdn.microsoft.com/en-us/library/system.object.tostring.aspx)22:24
juju2143Lol, ninja'd by directhex.22:24
juju2143Now next thing is if/else22:27
juju2143Ithink everyone who already knows a language knows if/elses.22:27
juju2143It's very simple, like this example:22:28
juju2143if(Answer = 42) {22:28
juju2143Console.WriteLine("The answer is 42");22:28
juju2143}else{22:28
juju2143Console.WriteLine("The answer is NOT 42");22:29
juju2143}22:29
juju2143woops22:29
juju2143first line should be if(Answer == 42) {22:29
juju21432 equal signs22:29
juju2143so try changing 42 to something else22:31
juju2143it will change the output22:31
pedro3005juju2143, okay22:33
pedro3005it works good22:33
juju2143good22:34
juju2143now for loops22:34
juju2143also simple22:34
juju2143for(int i = 0; i < 100; i++)22:35
juju2143{22:35
juju2143Console.WriteLine(i);22:35
juju2143}22:35
juju2143compile and run.22:35
pedro3005good, works the same as C22:35
pedro3005juju2143, but you can declare int i inside the loop?22:36
juju2143yeah, if you already know C or Java, should be easy to catch.22:36
juju2143pedro3005, no22:36
pedro3005you just did22:36
pedro3005for(int i = 0;22:36
juju2143I declared i in the for instruction22:36
pedro3005C complains when I do that22:37
tsimpsonpedro3005: it's like C9922:37
juju2143so the for instruction is separated in 322:37
juju2143int i = 0; is executed before the loop22:37
tsimpsonin normal ANSI C, you need to declare int i _before_ the loop instruction22:37
juju2143 i < 100; is evaluated each time it loops22:38
tsimpsonint i; for(i=0; i<100; i++) { ... }22:38
juju2143tsimpson, in C# you can declare it in the for22:38
tsimpsonwhich makes things much easier :)22:38
juju2143mhm.22:38
juju2143also you can do the same with a while loop22:41
juju2143int i = 0;22:41
juju2143while(i < 100)22:41
juju2143{22:41
juju2143Console.WriteLine(i);22:41
juju2143i++;22:41
juju2143}22:41
pedro3005does do - while work too?22:42
tsimpsonseems to work, yes22:44
juju2143pedro3005, yes22:45
juju2143So you know everything neede to do a console application22:49
juju2143If you type Console. tou will se a list of all the functions in that class, you can play with that22:50
juju2143*you will see22:50
juju2143also notice the Main(string[] args)22:51
juju2143args is actually an array22:51
juju2143args[0] is the first argument22:51
juju2143args[1] is the second and so on22:51
tsimpsonquick question, how can I tell the length of the array?22:53
juju2143array.Length22:55
tsimpsonthanks22:55
juju2143also to do a array variable, you would do string[] var = { "a", "b", "c" };22:55
juju2143or string[] var;22:56
juju2143var[0] = "a";22:56
juju2143and so on22:56
pedro3005is there something like strcpy()?22:56
juju2143strcopy?22:57
pedro3005okay22:57
juju2143string string1 = string222:57
pedro3005so you can do22:57
pedro3005string[] var = "Hello, World!";22:57
pedro3005?22:57
juju2143yes22:57
juju2143wait, no.22:57
juju2143you have to remove the []22:57
pedro3005hm...22:58
pedro3005why?22:58
juju2143or put "Hello Word" in var[0]22:58
juju2143because "Hello, World!" is NOT an array22:58
pedro3005:o22:58
pedro3005okay22:59
pedro3005does C# have pointers?22:59
juju2143no22:59
pedro3005I'm liking it already22:59
juju2143in fact yes22:59
pedro3005:/22:59
juju2143but you would have unsafe things22:59
tsimpsonpedro3005: string is a class, not an array of char ;)22:59
pedro3005so var in this example is an array of strings23:00
tsimpsonsimilar to the C char** or char* argv[]23:00
pedro3005I see23:01
pedro3005:D23:01
juju2143So now you have everything to do some cool console application23:01
juju2143you have Console.ReadLine to read lines23:01
juju2143string variable = Console.ReadLine();23:01
juju2143then Console.WriteLine(variable);23:02
juju2143Homework today: do something wit that.23:03
pedro3005Okay :)23:03
juju2143Tomorrow we'll see GTK# apps.23:03
juju2143And we'll do more than one function.23:03
juju2143Try/catch, converts, etc.23:04
pedro3005god damn it, stopped working yet again23:04
juju2143O_o23:05
juju2143so see ya at the same hour tomorrow.23:05
juju2143at 20-22UTC.23:05
=== 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
aduffy70Thank you, juju214323:05
juju2143You're welcome.23:08

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!