Log in

View Full Version : Coding / Programming / Scripting / etc



Dark Bring
December 8th, 2007, 09:52 am
This thread is for the programmers on Ichigo's to share snippets of our latest programming-related activities! and our programming-related frustrations! >.<

FAQ
Q: I'm a complete beginner, which programming language should I learn?
A: Python (http://www.python.org/).

Q: What are the best tutorials for learning Python?
A: In order of ascending difficulty, the three most popular Python tutorials are Snake Wrangling for Kids (http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/), Think Python (http://www.greenteapress.com/thinkpython/thinkpython.html) or Dive Into Python (http://diveintopython3.org/). Personally, I recommend Think Python. Your mileage may vary.

USEFL POSTS
[Coding Utilities (http://forums.ichigos.com/showpost.php?p=387742&postcount=12)] by [M (http://forums.ichigos.com/member.php?u=2340)]

HanTony
December 8th, 2007, 10:06 am
I imagin this place will be used by about 6 people.
Myself included though. I got my maple program and will be learning some real programming in the new year.

Dark Bring
December 8th, 2007, 10:06 am
Name of Programming Language: eC (also: Ecere C)
Platforms: Currently Windows, Linux and Mac OS X (through X11).
License: Freeware - "semi-closed source, about to adopt BSD license" [link (http://www.ecere.com/Vanilla/comments.php?DiscussionID=17)]
[Wikipedia Article Link (http://en.wikipedia.org/wiki/EC_(programming_language))] ¦ [Official Website (http://www.ecere.com/)] ¦ [Official Blog (http://www.ecere.com/blog/)]

Saw this on programming.reddit.com yesterday. My school teaches Java, so I'm learning other languages on my own, and I've read enough about the cons of C and C++ to consider trying eC.

The SDK comes with an IDE, so I tried out the sample demos (open projects then compile source code from samples folder). This looks promising. I might not have to use Java and JOGL [link (http://en.wikipedia.org/wiki/Java_OpenGL)] after all, but that will mean giving up on the LWJGL (Lightweight Java Game Library) [link (http://lwjgl.org/)].

Toshihiko
December 10th, 2007, 02:44 am
I'm very much more reserved, but I do have a physics engine and log in system I'm working on... The log in is Java.

HopelessComposer
December 10th, 2007, 06:44 am
I'm still learning C#. Incidentally, I got all hyped up about it about ten minutes before I saw this thread, and decided to go buy a nice thick book on it tomorrow. Web tutorials just aren't teaching me everything I need to know. Not fast enough anyway.

Wish me luck!

Noir7
December 10th, 2007, 02:28 pm
Bahh.

Half-a-year ago I'd really have needed a thread like this. I was still in school studying PHP and C++/C#.

Well, good idea for a thread :)

HopelessComposer
December 10th, 2007, 03:14 pm
Bahh.

Half-a-year ago I'd really have needed a thread like this. I was still in school studying PHP and C++/C#.

Well, good idea for a thread
Now you can just use this thread to help people like me out! =D
Heheh.

Dark Bring
December 11th, 2007, 08:59 am
I need to tidy up my source files. @_@

Also: Monsters of the Programming World [link (http://blogoscoped.com/archive/2007-12-10-n70.html)]

isantop
December 11th, 2007, 10:07 pm
Language 1
Name: TI-BASIC (Version TI-83+/TI-84+)
Platform: TI-83 and compatible TI Graphing Calculators
Licence: I think the actual language is closed-source, but making closed-source programs for it is practically impossible.
Notes: My current major Project is COS (Calculator Operating System, even though it's just a simplistic shell.) I've been working on it for about 3 or 4 months now. If you guys want, and it's allowed, I'll try to post it up here.

Language 2
Name: Java
Platform: We work on Macs, I use My laptop (linux) sometimes.
IDE: BlueJ

Dark Bring
December 12th, 2007, 08:39 pm
Licence: I think the actual language is closed-source, but making closed-source programs for it is practically impossible.XD


Notes: My current major Project is COS (Calculator Operating System, even though it's just a simplistic shell.) I've been working on it for about 3 or 4 months now. If you guys want, and it's allowed, I'll try to post it up here.Why not? If you think it might be too long just throw up a link or something.


IDE: BlueJI really should be using this instead of Netbeans, but something tells me that I'll be spending alot more time on GVim instead. :\

Also:
The Dutch governement has seen the light. Today an action plan was approved by the parliament, which pushes Open Standards and Open Source. [link (http://www.omat.nl/drupal/our-governement-has-seen-light-open-standards-and-)]O:

Neko Koneko
December 12th, 2007, 09:25 pm
Language: C#
Platform: Windows, .NET
License: none yet, as I've yet to release anything
Current projects: Butter Cheese and Eggs (Nuts 'n Bolts, on hold), MiWri (Mission Writing tool for the RP).

Language: QuickBasic
Platform: MS-DOS
License: OSS, no license
Projects: None (had to do it for school)

M
December 12th, 2007, 10:23 pm
Coding utilities
(more will be added later)

Editors
Vi (http://en.wikipedia.org/wiki/Vi) (CLI/GUI |ALL) -- Because it is a hella powerful editor that is available on all platforms. If you learn this, you'll be at home everywhere.
PSPad (http://www.pspad.com/) (GUI |WIN32) -- A little bit higher profile than most editors, but it boasts the best of features. It works nicely and can integrate with your compiler.
Notepad++ (http://notepad-plus.sourceforge.net/uk/site.htm) (GUI |WIN32) -- Lower profile, and just about as powerful as PSPad.
Shells
Powershell (http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx) (CLI |WIN32) -- By far one of the best things microsoft could have done for Vista. If you've ever worked with bash, powershell will make you feel right at home. Support for shell scripts far more powerful than the MSDOS (emulator).
GDB (http://sources.redhat.com/gdb/) (CLI |ALL) -- Honestly, this isn't a shell. Yet it most certainly is a shell. GDB takes most debuggers and blows them out of the water; IFF YOU CAN USE IT. It's hard as hell to master, and incomparable when learned.
Ch (http://www.softintegration.com/)(CLI |ALL) -- All of you C++ users'll love this. Ever wanted to write C++ in a scripting-like environment? This is it. Most C++ code translates to it 1:1 and with no real performance loss.
Compilers
GCC (http://gcc.gnu.org/) (CLI |ALL) -- Best is always first. This compiler has its little quirks, but once you get used to it, it works as a nice free alternate to MSC. The reason why I say this one is the best is because it works on all platforms. It also has a slight advantage on compile/execution time. The major downside of GCC is the error messages. They are a hell of a lot more cryptic than the MSC.
Perlcc (http://search.cpan.org/~nwclark/perl-5.8.8/utils/perlcc.PL) (CLI |ALL) -- Perl, only in executable form. What more could you ask for?
Mono (http://www.mono-project.com/Main_Page) (CLI |ALL) -- all of the .NET and # languages (except for shitty J#) packaged into one strong compiler. Think of this as the GCC of sharps.

Interpreters
Perl (http://www.perl.org/) -- One of the most powerful and most used scripting languages available, Perl is a language which you can design applications, create a bytecode and then run the program. It's strong, it runs well, and has a huge userbase.
Ruby (http://www.ruby-lang.org/) -- Not the newest kid on the block, but certainly on the rise since the development of rails, Ruby is a language which works much like a mixture of Python and Java. Purely OO, Ruby is an up and coming language that allows rapid development. The only downside is the lack of a really strong userbase.
Python (http://www.python.org/) -- Python is... well... C++ is to Java as Perl is to Python. The userbase is nearly as strong as perl, and the support is very large.
Javascript (http://www.javascript.com/) -- Listed this one here just because eruby (ruby for web development) hasn't nearly the amount of existence as javascript.
PHP (http://www.php.net/) -- A server side language that offers massive control over files and generation, with syntax similar to Python and Perl. Used almost always with an Apache server.

Web Resources
PasteBin (www.pastebin.com) (Web) -- Indisputably the most useful communication tool for coders. This tool allows you to take your source code and post it up online, password lock the code, highlight, AND EVEN SEE DIFF FILES!
Javascript shell (http://www.squarefree.com/shell/shell.html) (Web) -- OMG! Write javascript in it, and watch it evaluate!
MSDN (http://msdn2.microsoft.com/en-us/default.aspx) (Web) -- If you want to program for windows, this thing is beautiful. Otherwise, this is a good general reference.
GTK (http://www.gtk.org/) (GUIToolkit) -- Personally, of all the Crossplatform toolkits, I feel this one is easiest to learn. Powerful, clean, and runs effectively on all platforms.
wxWidgets (http://www.wxwidgets.org/) (GUIToolkit) -- Much more complicated toolkit, but creates native looking programs, and offers much more control than GTK applications.
Boost (http://www.boost.org/) (C++ lib) -- These things are your friend. It takes proprietary and unidesktop coding and makes them into a nice and portable coding. Not to mention, it adds features that have yet to be implemented in the main C libs.
TiddlyWiki (www.tiddlywiki.org) -- What can I say, everything needs a wiki, and this utility stores the wiki all in one html file, and has easy markup; along with not needing any form of a server to run. If you need it to do something more, there are a lot of javascript addons that you can download and install directly into the file. You just can't fail with this.

Neko Koneko
December 12th, 2007, 10:28 pm
All you need:

http://www.microsoft.com/express/

HopelessComposer
December 13th, 2007, 01:25 am
All you need:

http://www.microsoft.com/express/
That made me laugh. I went through M's list and was about to say: "I use...Microsoft Visual Studio."

XD

And pastebin, which M introduced me to.

M
December 13th, 2007, 02:03 am
One problem with Visual Studio. Correction: One problem with IDEs. If you don't like something about it, you're stuck with it. Even though the editor to VS is actually more advanced that VI and Emacs, I don't like it. Actually, I can't stand it. I love the interface, I love how clean the compiler is when you get an error, but the way you have to type and the way it formats, is a killer. Is this superficial? Quite possibly so, but if I'm going to be typing over 20 000 lines of code, I want my interface to be as I want it to be.

Another problem. The cost to get what I have listed up here ranges from 228 (standard) to 771 (pro) USD. Everything I did list, is either free, or has a free version to it. Brilliant for College students that are spending there money on getting a more powerful rig than on buying software. If you have the money to spend, then do so, but until I get rich, I'm going to find free applications as much as I can and spam them when appropriately. Especially when the free is better than the cost.

Another problem. Visual Studio is pre-programed to do things that are not program happy in other environments. Say I'm a worker at a company and I'm using VS2008. My coworker wants me to send a version of my source code over to him. He says he cannot compile the code and that there's some error about "stdafx.cpp" is not found. So instead he sends you his code. You plug it into VS and it compiles clean. You tell him to remove X file here, comment out Y line here, and then tell him to use Z switch here. Now he can compile it. What's the name of the coworker's compiler? Borland. You say that the same can be said about Borland to something else? Wrong! This is why I said that crossplatform coding is really a joke. It's a simple as writing the code as it should be, not as some program tells you how it should be.

It's little things like that that tick me off. You actually have to hack code made in VS to work in other environments, yet you don't have to do anything in the other environments to get it to work. And it's not like the extra lines of code that VS adds does anything special. Omitting them doesn't even cause a change.


I'm really not trying to bash Microsoft, but I'd wish that they would fill the little chinks in the wall.

isantop
December 13th, 2007, 03:08 am
XD

Why not? If you think it might be too long just throw up a link or something.

I really should be using this instead of Netbeans, but something tells me that I'll be spending alot more time on GVim instead. :\

Also:O:

Meh... I might put it up, But I'll have to move the code to my computer first. My calc won't work with my computer yet.


Coding utilities
(more will be added later)

Editors
Vi (http://en.wikipedia.org/wiki/Vi) (CLI/GUI |ALL) -- Because it is a hella powerful editor that is available on all platforms. If you learn this, you'll be at home everywhere.
PSPad (http://www.pspad.com/) (GUI |WIN32) -- A little bit higher profile than most editors, but it boasts the best of features. It works nicely and can integrate with your compiler.
Notepad++ (http://notepad-plus.sourceforge.net/uk/site.htm) (GUI |WIN32) -- Lower profile, and just about as powerful as PSPad.


Honestly, I use Kate for pretty much all of my compuer-based editing. It's a basic (?) text editor, and so painless to use, and it's got all of the features of a lot of other editors out there (Stuff like syntax highlighting, etc).

Neko Koneko
December 13th, 2007, 11:17 am
Visual Studio Express is free. Why do you think I linked to that?

M
December 13th, 2007, 01:11 pm
Overlooked and duely noted. My bad. Though I still don't see Microsoft providing 80% of VS2008(s|p) for free. There has to be something missing. Perhaps a SWIG (http://en.wikipedia.org/wiki/SWIG)-like system?

-checks into it-

Neko Koneko
December 13th, 2007, 05:29 pm
It's probably to make it easier for students to use it and get used to it ;)

On another note, I want to create a character counter for a textfield in X#, but I can't find anything on the internet about it x_x anyone, got an idea of how to do this?

HopelessComposer
December 13th, 2007, 06:24 pm
Oops, I'm still reading that book. It wasn't a one day thing after all, apparently. :heh:
I was busy though! I had stuff to do! It's not my fault! I'm still hot blood!

isantop
December 13th, 2007, 11:13 pm
It's probably to make it easier for students to use it and get used to it ;)

On another note, I want to create a character counter for a textfield in X#, but I can't find anything on the internet about it x_x anyone, got an idea of how to do this?

How does word count work? I wouldn't think it'd be much different from that.

M
December 14th, 2007, 02:06 am
It's probably to make it easier for students to use it and get used to it ;)

On another note, I want to create a character counter for a textfield in X#, but I can't find anything on the internet about it x_x anyone, got an idea of how to do this?

Well, what you could do is export the file string and remove all special characters (as you don't want to have spaces counted), and then do a length test on it. For a sandbox app — in C#, because it appears as though most of the posters here know it, and that Xen is similar to it:

http://mies.pastebin.com/m64692351

Note, this is limited to the maximum size of an INT in your language. In the case of C# it is -2147483648..2147483647 . How to cross this limit makes your task a bit more difficult, but not too difficult. Basically, you'll need to use a character array and have an iterator go through each entry of it.

The hard part is the regular expression checker. Regex in C# wants a string. Converting a character to a string is a bit too process heavy for my liking. I don't recall any methods that can typecast a character datatype. This means that you'd have to preform a hell of a lot of if elif and else statements.

The only way to make this pretty and easy is to create a loop statement that will take on the maximum number of characters a string can populate, and then preform a regular expression on it, and add it to another variable (string or char array; your choice, though char array would work better for finding the sum of the lengths). Then, right where you left off in the character array, populate the string again. Lather, Rinse, Repeat. I haven't the time to sandbox an application right now, but I'll certainly work on the "absolute" version of this class.

HopelessComposer
December 14th, 2007, 09:59 pm
My brain finally realized what "NullReferenceUnhandled Exception" means. Do you know how many times my programs have been killed by that exception? I'm so retarded! XD

Oh well, I saved a program from it finally. I was like "Oh....wait a second. That reference... IT'S NULL!"

Hahahahah.
And thanks for the advice M; I went back and reread a bunch of things I didn't fully understand in the Programmer's Heaven book today. I already knew how references and such worked, but rereading the sections on them helped it all sink in, so when I was faced with that horrible exception, my brain had the courage to stand up and say, "Don't run! We know how to fix this one!"

Dark Bring
December 21st, 2007, 12:45 am
Drug Dealers Vs. Geeks [link (http://www.silliness.org/archive/drugsvsgeeks.html)]

T_T

isantop
December 21st, 2007, 09:44 pm
I'm starting a new language! Z80 assembly! Yay!

Actually, my COS calc program is getting slow, so I need something a little faster. And since it's an 8-bit processor, it shouldn't be as hard as learning assembly for say, i386.

Neko Koneko
December 23rd, 2007, 08:28 am
I got the word count sorted by the way, a friend helped me with that. Also got a character count :) It's great having a die-hard programmer for a friend XD

HopelessComposer
December 23rd, 2007, 07:38 pm
I'm the die hard programmer in my group of friends. And I blow. It really sucks; nobody I know programs. = \

M
December 29th, 2007, 10:37 pm
Arg! Finding a library that converts a word document to anything without having microsoft office installed is next to impossible!

Looking at the massively undocumented code for OpenOffice.org makes my head spin! Yet it seems to have the best engine for "guessing" the documents formatting.

Wv2 (abiWord) seems like a good solution, but I keep feeling insecure about not preserving the special formatting in the doc files. And I don't want to think of how it would look with a docx document. Also, Wv2 looks like it's linux only (though abiword might be a good place to start dissecting).


Would anyone else here know of a codekit that can decrypt a doc file decent enough to retain general or referential formatting tags? Preferably LGPL or CC(by) so I don't have to peck at the author for permissions to use it in my own CC license.

isantop
January 3rd, 2008, 06:41 pm
I think Abiword is supposed to be crss-platform, though you may need to use Cygwin to get it to work... (I'm assuming this won't be a problem for you, right?)

M
January 3rd, 2008, 10:51 pm
I'm talking about a code-kit. Basically a project where I can extract (known better as hack) the code into my own program. Also, Wv2 is abiword.

isantop
January 4th, 2008, 02:55 am
Also, Wv2 is abiword.
I know; you said so in your post. That's the reason why I used that example.

I'm not sure what it is today, but for some reason, everybody's been treating me like I'm retarded.

Dark Bring
January 8th, 2008, 09:07 am
I recently discovered that my syllabus includes C (the programming language). :wub:

M
January 8th, 2008, 09:41 pm
Oh god, assembly sucks!

HopelessComposer
January 8th, 2008, 09:57 pm
Oh god, assembly sucks!
Don't use it then. ;3
It's not used for much anymore anyway, is it? Except for like...little programs used in greeting cards and stuff, right? And maybe...parts of drivers or something? Nothing I'd ever have any use for, at least.

Neko Koneko
January 8th, 2008, 11:33 pm
Most keygens, you know, the fancy ones with 8-bit music and such, are written in assembly.

M
January 9th, 2008, 12:26 am
Don't use it then. ;3
It's not used for much anymore anyway, is it? Except for like...little programs used in greeting cards and stuff, right? And maybe...parts of drivers or something? Nothing I'd ever have any use for, at least.

It's used in more things than you could imagine.

Keyboard, mouse, monitor, cd player, tv, vcr, older cellphones, microwaves, timers; basically anything that can be broken down to a relatively small task. And it's a class that's required for my degree. Nothing like a bit of...


.data
x word 0
y word 5

.code
function main proc
mov ax,y
add ax,2
mov bx,4
imul bx
mov x,ax

You don't even get hello world in assembly T_T!

HopelessComposer
January 9th, 2008, 02:15 am
Most keygens, you know, the fancy ones with 8-bit music and such, are written in assembly.
Ah, I didn't know that. Thank god for assembly then.

It's used in more things than you could imagine.

Keyboard, mouse, monitor, cd player, tv, vcr, older cellphones, microwaves, timers; basically anything that can be broken down to a relatively small task. And it's a class that's required for my degree. Nothing like a bit of...
Heh, that is more than I thought it was used for. I knew it was used for really small things (like timers), but I didn't think it was still used for monitors and cd players and stuff.

You don't even get hello world in assembly T_T!
That's horrible! D:

isantop
January 9th, 2008, 06:28 am
Ah, I didn't know that. Thank god for assembly then.

Heh, that is more than I thought it was used for. I knew it was used for really small things (like timers), but I didn't think it was still used for monitors and cd players and stuff.

That's horrible! D:
I'm pretty sure that atleast up till the Gamecube/PS2/'Box generation, Games were written in the console's assembly language. All GB Roms are in Z80 assembly (like my calculator) and you've gotta involve it in an OS somehow, since computers don't understand C++ natively. Up 'till UNIX, there was no such thing as a non-assembly OS. The truth is, it's still the most powerful language out there, since it offers unprecedented control of the processor.

By the way, M. Which assembly is this for. I'm starting up in freelance Z80, but I'm assuming you're taking i386 or X64, since those are the only real popular archs anymore. I'll have to ask him first, but my grandpa knows several assembly languages like they were his first language, so he could help you out if you need it.

Neko Koneko
January 9th, 2008, 08:27 am
I believe assembly is the most advanced way of programming and the best if you want to manually optimize the program.

HanTony
January 9th, 2008, 09:30 am
I'm going to be using R soon so can one of you guys provide something that R can do so that I can see it's mightyness as a n00b @_@

M
January 9th, 2008, 11:29 am
I'm pretty sure that atleast up till the Gamecube/PS2/'Box generation, Games were written in the console's assembly language. All GB Roms are in Z80 assembly (like my calculator) and you've gotta involve it in an OS somehow, since computers don't understand C++ natively. Up 'till UNIX, there was no such thing as a non-assembly OS. The truth is, it's still the most powerful language out there, since it offers unprecedented control of the processor.

By the way, M. Which assembly is this for. I'm starting up in freelance Z80, but I'm assuming you're taking i386 or X64, since those are the only real popular archs anymore. I'll have to ask him first, but my grandpa knows several assembly languages like they were his first language, so he could help you out if you need it.

8088i686x64i base processors (intel 64bit), using tasm or masm as the compiler.

And I don't think Gameboy used assembly. The pure insanity of the development would be astonishingly difficult to do just one pokemon battle. Rather, they used their own version of a high level language, or a front end to the language, such as perl is to C.

Jill-Jênn
January 9th, 2008, 12:22 pm
By the way does anyone know the Caml language? :)

Dark Bring
January 9th, 2008, 06:12 pm
By the way does anyone know the Caml language? :)I know a couple of professors and postgraduates that uses Caml/OCaml. I don't know anything about them beyond their Wikipedia articles. Why?

M
January 9th, 2008, 11:47 pm
By the way does anyone know the Caml language? :)

I know a bit of OCaml , but only because it's the second fastest language out there, and that it looks rather nice --- Syntacticly. Though I can't say I can use it like C, Java, Ruby or Perl...

Jill-Jênn
January 10th, 2008, 05:20 pm
I know a couple of professors and postgraduates that uses Caml/OCaml. I don't know anything about them beyond their Wikipedia articles. Why?It's the language taught in some CPGE (http://en.wikipedia.org/wiki/CPGE). It's a very good language to make great algorithms with binary trees, and other data structure.


I know a bit of OCaml , but only because it's the second fastest language out there, and that it looks rather nice --- Syntacticly. Though I can't say I can use it like C, Java, Ruby or Perl...Second fastest just after C? I didn't know, by the way I'm not sure. Oh maybe because I use Caml Light.

TTIOttio
January 18th, 2008, 04:46 pm
I started programming not too long ago ('bout a week) so I only got about half of this...

Still, I have Visual Studio (got the full ver. for free :D not illegally though, I know someone who has it but doesn't use it. So they gave it to me) and I can do at least something in C#. And I know HTML and javascript, but that doesn't really count does it?

I wrote a D&D dice roller in a couple of days (with help) and it works pretty well. And I know how to add in the extra features that I may want to.

Anyway, what's this whole "assembely" thing?

Dark Bring
January 18th, 2008, 05:24 pm
Anyway, what's this whole "assembely" thing?[Link (http://en.wikipedia.org/wiki/Assembly_language)] to Wikipedia entry.

If you are not born for it, it will break your mind.

Jill-Jênn
January 18th, 2008, 08:42 pm
JavaScript is useful.

HopelessComposer
January 18th, 2008, 09:21 pm
Still, I have Visual Studio (got the full ver. for free not illegally though, I know someone who has it but doesn't use it. So they gave it to me)
Isn't visual studio...free?
And D&D code? Like...Drag and Drop?

isantop
January 18th, 2008, 09:46 pm
[Link (http://en.wikipedia.org/wiki/Assembly_language)] to Wikipedia entry.

If you are not born for it, it will break your mind.
@TTIOttio: It a nutshel, it's the lowest-level, most powerful way of programming a CPU. It offers TOTAL control of the system.

@DB: Can't that be said of programming in general? XD

HopelessComposer
January 18th, 2008, 10:19 pm
@DB: Can't that be said of programming in general?
No, a lot of languages can be learned by even the most inept of programmers.
I mean, I'm learning C# right now, lol.

M
January 19th, 2008, 12:08 am
Gah! My boss wants me to learn SIMPL (Pronounced: Simple) so I can start writing Crestron programs now D: That's 4 language courses in one semester! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!

HopelessComposer
January 19th, 2008, 12:47 am
I'd hate to be you, M. > <

M
January 19th, 2008, 11:39 am
(a.containsIgnoreCase("SHIT")) ? EXAN a SHIFT String.length(a) IN a.indexOf(3) for 7x : null;;

D&D means dungeons and dragons. <--- Geek

Javascript is extremely useful, except for the limitations that don't allow you to write to hard disk. This is both a good and bad limitation for obvious reasons.

And if you really wanna break your mind....


!#/usr/local/brainfuck
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
# outputs "Hello World"

Jill-Jênn
January 19th, 2008, 11:43 am
Lol M do you know Whitespace or Befunge? I think the second is very funny :D

M
January 19th, 2008, 01:01 pm
Befunge actually looks easy to learn and almost possible to make a large program in, compared to other esoteric languages.

TTIOttio
January 19th, 2008, 03:06 pm
D&D means dungeons and dragons. <--- Geek

Yep <----- Geek too. In fact, I made up a new word for it: Neek (meaning a cross between a nerd and a geek) :D

As for assembely, I doubt I'll ever write in that since I don't really do much hardware-based programming for my pc...

Dark Bring
January 20th, 2008, 01:40 pm
What the fOck, people, what the fOck?! [pdf link (http://www.cypherpunks.to/TCPA_DEFCON_10.pdf)]

TTIOttio
January 20th, 2008, 03:26 pm
As time goes on, it seems that we are drawing ever closer to the "no control over ourselves" situation that so many sci-fi novels present. I didn't read all of that, but what I did read makes me hope that their plan fails. Miserably.

M
January 20th, 2008, 05:02 pm
Well I see this working two ways. One: It works and people develop software that works around the chip's hardcoded cryptography. Two: It doesn't work and things remain as they are, increasing software cryptography methods.

Either way, companies that want to protect their software will strive to achieve this. And there will always be those out there to break that protection.

Dark Bring
January 20th, 2008, 05:21 pm
@TTIOttio: The best you can do is to hope?

@M: Either way that's more reason to push for open source hardware.

HopelessComposer
January 20th, 2008, 06:41 pm
I'm not worried. Like M said, people will always try to protect what they create, and others will always find a way around that protection. I don't think much will change, no matter what they do.

Dark Bring
January 20th, 2008, 07:36 pm
Like M said, people will always try to protect what they create, and others will always find a way around that protection. I don't think much will change, no matter what they do.I wouldn't be worried if this was solely about people protecting their own creation.

TTIOttio
January 22nd, 2008, 10:42 am
Who polices the police? Even if they have true intentions, this is just as much a matter of privacy. No-one will ever be entirely happy with this, as there will always be those that try to exploit software/hardware and so the creators will always increase the security. Resulting in less leeway for the rest of us.

Its an endless cycle.

Neko Koneko
January 22nd, 2008, 11:12 am
People, back on the subject of coding now or this thread will be closed. This is not a topic that's supposed to be about licenses, but about coding.

HopelessComposer
January 22nd, 2008, 11:30 am
People, back on the subject of coding now or this thread will be closed. This is not a topic that's supposed to be about licenses, but about coding.
Couldn't you just rename the thread for us? =D

Neko Koneko
January 23rd, 2008, 08:29 am
No. I have no interest in another religion thread but then based on licences.

HopelessComposer
January 23rd, 2008, 05:33 pm
No. I have no interest in another religion thread but then based on licences.
How is this like the religion thread? The religion thread is just full of people making fun of Christianity. Nobody's made fun of anything yet here. = \

M
January 23rd, 2008, 06:24 pm
Licensing is technically a valid topic for programming. Very few programmers do research on this subject and little know the difference between the EULA, CC, GPL, and other software based licenses.

So long as it's about the license itself, and not how programs should have been licensed via XXX license drama, or how microsoft keeps their source code closed, blah blah blah, yada yada yada. Basically, keep it on what the license is, or thoughts, or what licenses you have actually used.



Personally, I use a plethora of licenses for my programs I use, though I've yet to reach a professionalism in my programming to approach the EULA, or other pay-to-get licenses.

I've done CC for my smaller, less time projects such as Simple Open Proofing System (SOPS) which is a markup language for Perl for, well, proofing a document.

I'm planning on using LGPL for the ROBINS project, which is an IWE (Integrated Writing Environment --- yes I made that term up for the project) RP system designed for Bullion Board systems.

I'm not quite certain if I'm required or not to use the GPL for jaBooru, a portable Java image management system based off the Danbooru system, but I'd like to make it a little bit of a tighter license.

Neko Koneko
January 23rd, 2008, 07:19 pm
Licensing and actual coding have nothing to do with eachother. If you want a thread about software licensing, create one.

M
January 24th, 2008, 08:52 pm
I have a quick question for all the power users out there. Which do you prefer: A database system that is hard to access outside of the written program, but offers a speedy and powerful indexing and queuing system (SQL, Oracle, MySQL, HSQL); or An open database system, like XML, that you can easily edit with a text editor, but is slower and more prone to user errors?

The reason being: I'm not quite certain how I should handle information managers. I used to think XML was the route to go, but programs get progressively slower as the markup file gets larger. Not to mention, you have to, basically, recreate a bunch of useful functions that are already provided in a database package (such as a recursive ID change for an element). I do like the speed and power of a database package backend for information managers, but I reeeeeeeeeeealy like the fact that XML is wide open for editing. If the database randomly gets and error, it's a quick jog through a syntax checker utility and you can recover 99.9% of the information pool.

So I ask you: Which do you think is the better of the two systems?

isantop
January 25th, 2008, 05:45 am
I think it depend on the goals of the deployment. If you want something super-reliable, XML. Speedy, xSQL, or equivalent.

Everything's a compromise, I guess. To answer your question, I'd personally prefer a package database, and just make backups. Who knows? Maybe you'll come up with a database system that's both fast (and stays that way), and quick to edit.

Neko Koneko
January 25th, 2008, 06:42 am
Why did you mention SQL 3 times in different forms?

Anyway, I'd go for the safest option, so I guess I'd go for an SQL database. Database that's easy to corrupt = useless.

M
January 25th, 2008, 01:18 pm
(Three different SQLs because they're all slightly different. Not to mention, Oracle and SQL are the only real Database engines and everything else has absolutely no history.

More or less, I listed those off so people that don't realize what the backend to their database is would be able to suggest.)

PorscheGTIII
January 30th, 2008, 03:32 pm
Yay! My first code! ^_^


int ledPin = 9; // LED connected to digital pin 9
int val = 0; // variable to store the read value

void setup()
{
pinMode(ledPin, OUTPUT); // sets the pin as output
Serial.begin(9600);
}

void loop()
{
analogWrite(ledPin,100); // analogWrite values from 0 to 255
delay(15000);
analogWrite(ledPin,225 );
delay(15000);
Serial.print("Hello World!");
}

Dark Bring
February 12th, 2008, 02:45 am
http://www.vulomedia.com/images/2456841nNamcEZAL.jpg

Fufufufufu ~ :3

Luis
February 23rd, 2008, 09:45 am
http://xkcd.com/378/

Thought of you guys (especialy M XD)

TTIOttio
February 24th, 2008, 12:28 pm
https://downloads.channel8.msdn.com/

Too bad you need a windows live account for it :( Otherwise I would have got it...

M
February 24th, 2008, 01:53 pm
I found out earlier this week about that (though my university). One of the smartest moves Microsoft could have ever done. Then again, the express series for developers was pretty sweet too, but I'm really liking the SQL server thing. Makes me feel so much cleaner that I'm using a legal version rather than a mirrored license from work (with permission) of it at home.

random_tangent
February 24th, 2008, 07:16 pm
Grrrrrr, no Australia yet!

HopelessComposer
February 24th, 2008, 11:39 pm
Freaking nice. Looks like being a student might actually offer me some benefit, after all.
Downloading all of it tomorrow. :3

TTIOttio
March 5th, 2008, 08:22 pm
Taken from Linux Format magazine:


What does Ubuntu really mean?*

"Ubuntu means 'orangey Gnome with a rich Debiany nougat centre'"
"The warm smugness experienced by coders after installing a Linux distribution."
"It's African for 'sharks with frickin' laser beams on their heads.' Be afraid."
"Ubuntu really means never having to say you're a Windows user."
"Ubuntu is an ancient African word meaning 'I can't configure Slackware'"
"It means brown. Ubuntu could make itself far more attractive to five-year-olds by being called Ubumtu coz, like, that's really funny!"
"Ubuntu is a mix of tow ancient Aramaic words, the first meaning 'too lazy to look it up', and its more pragmatic alternate, 'Trademark this, fool.'"


:lol:

*(Ubuntu is an African word meaning humanity to others, and is a Linux distribution that was being discussed in the issue that I took this from)

Oh, and a geek joke: There are 10 types of people in this world. Those who understand binary, and those who don't.

:lol:

M
March 5th, 2008, 09:02 pm
Second oldest joke in the geek book.

The First:

Why do programmers confuse Oct. 31 with Dec. 25?

OCT 31 == DEC 25
Octal 31 equals Decimal 25

Neko Koneko
March 6th, 2008, 07:48 am
Ubuntu equals Linux for people who want to be cool enough not to use windows but too cheap to buy a mac and too lazy to look up Linux stuff themselves.

Basically Linux for lazy, wanna-be cool cheapskates :P

edit: hang on, this isn't the OS thread. Post above is totally out of place *roar*

TTIOttio
March 8th, 2008, 09:33 am
It is programming related though...

Anyway, Ubuntu is also for people (like me) who are fed up with windows and want to switch to something reliable. Though it's still a lot harder to use than Windows, Ubuntu (as well as the others in the Ubuntu project) is the most user-friendly of the Linux distros.

Still, lets not get into an OS discussion here...

Neko Koneko
March 10th, 2008, 09:04 am
Still, lets not get into an OS discussion here...

Hypocrite... -_-

On-topic now!

random_tangent
May 13th, 2008, 12:54 pm
*sighs*

Anyone know haskell? I'm meant to, according to my course but it won't go into my brain thus I'm failing and can't do the bloody assignment that's due in 2 days.

M
May 13th, 2008, 01:03 pm
I know a little, but not enough to code with it.

I can help you with algorithm though.

random_tangent
May 14th, 2008, 12:40 am
For background, we're doing a really simple version of the game 'Othello' or 'Reversi' - text-based implementation. My two main problems are thus: I cannot figure out how to represent the board - which is just a series of . X or 0, depending on what piece is there: i.e

. . . . . . . .
. . . xo . . .
. . . ox . . .
. . . . . . . .

So, i need to apply the 'mark' function to... something. lol. But I can't figure out what.

Also - I need an accumulating function that will show which stone(s) are captured in a move, in each direction... and I can see it hovering at the side of my brain, but just can't GET it.


module Othello where

data Stone = Dark | Light | Vacant deriving (Eq, Show)

opponent :: Stone -> Stone
opponent Dark = Light
opponent Light = Dark

type Coord = (Int,Int)

type Board = [[Stone]]

size = 8 :: Int

initial :: Board
initial = replicate ((size-2) `div` 2) (replicate size Vacant) ++
[replicate ((size-2) `div` 2) Vacant ++
[Dark, Light] ++
replicate ((size-1) `div` 2) Vacant] ++
[replicate ((size-2) `div` 2) Vacant ++
[Light, Dark] ++
replicate ((size-1) `div` 2) Vacant] ++
replicate ((size-1) `div` 2) (replicate size Vacant)

putRow :: Stone -> Int -> [Stone] -> [Stone]
putRow piece x (stone:stones)
| x == 0 = piece
| otherwise = piece ++ putRow piece (x-1) stones

put :: Stone -> Coord -> Board -> Board
put piece x (stone:stones) = putRow ()

vacant :: Coord -> Board -> Bool
vacant (x,y) board = mark \= light || dark

access :: Board -> Coord -> Stone
access board (x,y) = error "access not implemented"

gameOver :: Board -> Bool
gameOver board = not (vacant (x,y) board)

count :: Stone -> Board -> Int
count stone = stone : vacant + light + dark

showBoard :: Board -> String
showBoard board = mark

mark :: Stone -> String
mark Dark = " X"
mark Light = " O"
mark Vacant = " ."

-----------------------------------------------------------------

captureN :: Coord -> Stone -> Board -> [Coord]
captureN place stone board = accumN place stone board []

accumN :: Coord -> Stone -> Board -> [Coord] -> [Coord]
accumN [] = []
accumN place stone board [] =

Can anyone think of any algorithms that could work? We have to use the base code provided obviously.

M
May 14th, 2008, 09:38 pm
Perhaps this pseudocode would help:

# ENUMERATE value def array(array()) end
# ENUMERATE player def white, blach, void

encap OthelloModule {
function placeMove (x,y,player)
value[x,y] = player
countIncrease
changeOwn(x,y,player)
function placeMark(x,y,player)
value[x,y]=player
function changeOwn (x,y,player)
loop i when i<BOARD_SIZE_MAX_X
while value NOTEQUAL player AND value NOTEQUAL vacant
placeMark(i,y,player)
countIncrease
end
end
loop i when i<BOARD_SIZE_MAX_Y
while value NOTEQUAL player AND value NOTEQUAL vacant
placeMark(x,i,player)
countIncrease
end
end
function countIncrease
GLOBAL count += 1
}

Basically, you need to have the placed coordinates, then loop through the entire x and y of the matrix using only those indicies. Have a conditional for the positions that are ``vacant'' so that they do not get changed, and go only from the piece you placed to your piece (and only if your piece exists in the row/column). Also, for the count thing, you just need to have an incrementer inside the loops that goes only when the conditional is correct.

Now, I know haskell has this wonderful thing going with recursion, so I'm sure the loops from the above could be done using recursion. There's many different ways you can go about this, but I think a recursive loop when planted at cord x then recursively increasing and marking the positions from y to y*. Just be sure to have the mark appear after the final test to see if you actually scored something. That is, in code:


function recursiveMarkAndStuff(type,x,y,player)
IF value[x,y] EQUALS player
mark[x,y]
GLOBAL count += 1
RETURN player
ELSE
IF type EQUALS 0
recursiveMarkAndStuff(x,y+1,player)
IF type EQUALS 1
recursiveMarkAndStuff(x+1,y,player)
end

def 0 as BLACK
def 1 as WHITE

#...
#init value
#...
recursiveMarkAndStuff(3,4,BLACK)
recursiveMarkAndStuff(4,5,WHITE)

I hope I typed the code right...

M
May 31st, 2008, 01:51 am
Ugh, my C# 'program' (if you can call it that) is finished, but I can't publish it for some reason! I tried just taking the exe out of the debug bin of the project, but that doesn't work. So I tried just running the debug exe straight from the debug folder. Again, no luck. The clock updates and stuff when I run the debug exes, but it won't accept any keyboard input. It just sits there. When I run the project in C#, it runs just fine. Halp anyone? Do you know, M? I don't think you use C# though...
I just checked a few of my other projects too, and none of them run outside of C# either. = \


lol. =D

By saying it works in C#, I'm assuming you mean your IDE, but not outside your IDE. This is an example on just why IDEs are bad things. There are three physical steps (disregarding theoretics) to making a program: Coding, Compiling, Debugging; and Coding, Interpreting, Debugging. IDEs were originally designed around this CCD method of development; you have an editor, a compiler and the debugger are all in one, and they work seamlessly inside a window application.

Your situation isn't a CCD. It's a CID. Dot NET languages do not compile to stand alone applications. Instead, they depend on an interpreted framework. In order to launch your executable, you need to pass it to the interpreter. The microsoft .NET library does this for you automatically. The Mono project, does not. Which implementation of .NET are you using? Also, what is the exact method of what you're doing to launch the application?

HopelessComposer
May 31st, 2008, 02:30 am
By saying it works in C#, I'm assuming you mean your IDE, but not outside your IDE.
Indeed. My terminology is mediocre at best. X3

Your situation isn't a CCD. It's a CID. Dot NET languages do not compile to stand alone applications. Instead, they depend on an interpreted framework. In order to launch your executable, you need to pass it to the interpreter. The microsoft .NET library does this for you automatically. The Mono project, does not. Which implementation of .NET are you using? Also, what is the exact method of what you're doing to launch the application?
Yeah, I always think of C# as a compiling language, just because it has C in the name. A little earlier today, I remembered "Ah, that's right. It's actually using the .NET runner."
I actually think that might be the problem. I wrote the program using MVS2005, but a few weeks ago I tried to install MVS2008, and the installation failed halfway through, so I think there may be some conflict there. I might have the newer version of .NET on my computer, but I might have used the older version to...write my program with.

I dunno, I'm going to look around my computer now and try figuring out what .NET version I'm using. I might have two versions installed right now...
To open my programs, I'm just navigating to their project folders (My Documents->Visual Studio 2005->My Project->etc) and trying all the exe files I can find. (Most of them are in the project's debug folder.)
I hear that's the way to do it, and I'm pretty sure I recall this method working before I tried to install Visual Studio 2008. I'm guessing there's a .NET compatibility issue going on here, like you've guessed.

Ah, and here's a link to my first real program. It's a junker! =D
http://eterna-soft.com/images/LevelUp.exe
In case you're curious/feel like testing it on your computer. It creates a text document to save its state in the same folder you place it. '1,' '2,' and '3' toggle the three activity switches on and off. 'S' saves your progress, and 'L' loads it again. It's basically an overdone stop watch. Kind of embarrassing, actually. I think it'll help me to stop procrastinating though, so whatever. :heh:

I'm not responsible for any injuries, property damage, or loss of life caused by my horrible coding.
Edit: Ah, I don't see any .Net 2.0 folders anywhere. Let me try installing the newest .NET to see what happens...
Edit: Installed .NET 3.5, and the same problems continue. I also tried running the program from the command line, while I had the program's project open in Visual Studio. It ran from the command line, but it was buggy. (Text jittered everywhere.)
I then shut off Visual Studio and tried running the program from the command line again, but then it stopped accepting keyboard input again. Blah!

Ah, also, this is what my output box is giving me when I debug my program from Visual Studio.

'LevelUp.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\Projects\LevelUp\LevelUp\bin\Debug\LevelUp.ex e', Symbols loaded.
The thread '<No Name>' (0x878) has exited with code 0 (0x0).
The program '[1992] LevelUp.vshost.exe: Managed' has exited with code -1073741510 (0xc000013a).
Maybe Visual Studio is linking vshost.exe and my normal exe together for me while it's open or something? When I just build my project, it only mentions the normal exe, without saying anything about the vshost one.

Edit again:
Oops, you know what? Almost all of my other projects work. It's just this one that isn't, for some reason. I'd say it's coded wrong, but I don't understand why it would work when launched from VS, but not when it's launched from the command prompt. Any ideas? = \
If my code is actually broken, and Visual Studio is telling me that it's fine, I'm going to be a little annoyed. Maybe my code is fine by 2005 standards, but not 2008 standards?
Edit edit:
Okay, great. Now my program isn't working at all, no matter where I run it. It looks like the upgrade to .NET 3.5 finished it off. I'm assuming that my IDE debugger was just telling me my code was okay when it really wasn't, but now it knows better because of the update. Now even the debugger is running the program badly, so my program is just broken, I guess. I'll figure it out tomorrow. I think it's because of the way I'm handling threading inside my program. I have a lot of dubious sorts of loops going on, like:


isLooping = true;
while (isLooping == true)
{
ClockUpdate();
InputUpdate();
}


That little snippet is in the "Engine.Run()" method. Right before it, in the Engine.Start() method, I start a few threads to handle the Input and Clock Update methods. I'm going to assume this is where my problem is coming from, because it just.....seems really wrong. Even while my program was working, I was thinking to myself, "this part really doesn't seem like it's coded correctly..."

I'll figure it out tomorrow, I guess.

M
June 1st, 2008, 04:43 pm
Whee~ Database design is fun!


#!/usr/bin/dot -Tpng
digraph mos {

compound=true;

subgraph cluster_mainnode {
node [shape = record];
label = "Main"
mainnodeRoot [label="MAIN"];
mainnodeId [label="ID | Int32" ];
mainnodeAuthor [label="Author | Table" ];
mainnodeDateordered [label="DateOrdered | Time"];
mainnodeData [label="Data | Table" ];
mainnodeGcomment [label="GComment | String" ];
mainnodeValidated [label="Validated | Bool" ];

mainnodeRoot -> mainnodeId;
mainnodeRoot -> mainnodeAuthor;
mainnodeRoot -> mainnodeDateordered;
mainnodeRoot -> mainnodeData;
mainnodeRoot -> mainnodeGcomment;
mainnodeRoot -> mainnodeValidated;

mainnodeAuthor -> authortableRoot;
mainnodeData -> datatableRoot;
}

subgraph cluster_authortable {
node [shape=record];
label = "Author";
authortableRoot [label="AUTHOR"];
authortableUniqname [label="UniqName | String" ];
authortableLastname [label="LastName | String" ];
authortableFirstname [label="FirstName | String" ];
authortableDepartment [label="Department | String" ];
authortablePhone [label="Phone | Table" ];
authortableOffice [label="OfficeNumber | String"];

authortableRoot -> authortableUniqname;
authortableRoot -> authortableLastname;
authortableRoot -> authortableFirstname;
authortableRoot -> authortableDepartment;
authortableRoot -> authortablePhone;
authortableRoot -> authortableOffice;

authortablePhone -> phonetableRoot;
}

subgraph cluster_datatable {
node [shape=record];
label = "Data";
datatableRoot [label="DATA"];
datatableDate [label="Date | Time" ];
datatableDone [label="Done | Bool" ];
datatableWho [label="Who | String" ];
datatableLcomment [label="LComment | String"];
datatableEquipment [label="Equipment | Table"];
datatableLvalidated [label="LValidated | Bool"];

datatableRoot -> datatableDate;
datatableRoot -> datatableDone;
datatableRoot -> datatableWho;
datatableRoot -> datatableLcomment;
datatableRoot -> datatableEquipment;
datatableRoot -> datatableLvalidated;

datatableEquipment -> equipmenttableRoot;
}

subgraph cluster_phonetable {
node [shape=record];
label="Phone";
phonetableRoot [label="PHONE"];
phonetablePrimary [label="Primary | PString" ];
phonetableSeconary [label="Secondary | PString"];
phonetableOthers [label="Others | PString" ];

phonetableRoot -> phonetablePrimary;
phonetableRoot -> phonetableSeconary;
phonetableRoot -> phonetableOthers;
}

subgraph cluster_equipmenttable {
node [shape=record];
label="Equipment";
equipmenttableRoot [label="EQUIPMENT"];
equipmenttableWhich [label="Which | Id"];

equipmenttableRoot -> equipmenttableWhich;

equipmenttableWhich -> edRoot;
}

subgraph cluster_equipmentdatabase {
node [shape=record];
label="Equipment Database";
edRoot [label="EQUIPMENT DATABASE"];
edId [label="ID | Id" ];
edLocation [label="Location | String" ];
edComputer [label="Computer | Table" ];
edMediaplayer [label="Media Device | Table" ];
edDoccam [label="Document Camera | Table"];
edProjector [label="Projector | Table" ];

edRoot -> edId;
edRoot -> edLocation;
edRoot -> edComputer;
edRoot -> edMediaplayer;
edRoot -> edDoccam;
edRoot -> edProjector;

edComputer -> edcomputertableRoot;
edMediaplayer -> edmediaplayertableRoot;
edDoccam -> eddoccamtableRoot;
edProjector -> edprojectortableRoot;
}
subgraph cluster_computertable {
node [shape=record];
subgraph cluster_edcomputertable {
node [shape=record];
label="Computer Data Table";
edcomputertableRoot [label="COMPUTER DATA TABLE"];
edcomputertableModel [label="Model | String" ];
edcomputertableSerial [label="Serial | String"];
edcomputertableIssues [label="Issues | Table"];

edcomputertableRoot -> edcomputertableModel;
edcomputertableRoot -> edcomputertableSerial;
edcomputertableRoot -> edcomputertableIssues;
edcomputertableIssues -> computerissuestableRoot;
}
subgraph cluster_computerissuestable {
node [shape=record];
label="Computer Issues";
computerissuestableRoot [label="COMPUTER ISSUES"];
computerissuestableId [label="Id | Id" ];
computerissuestableProblem [label="Problem | String" ];
computerissuestableSolution [label="Solution | String"];
computerissuestableFixed [label="Fixed | Bool" ];

computerissuestableRoot -> computerissuestableId;
computerissuestableRoot -> computerissuestableProblem;
computerissuestableRoot -> computerissuestableSolution;
computerissuestableRoot -> computerissuestableFixed;
}
}

subgraph cluster_edmediaplayertable {
node [shape=record];
label="Media Player Data Table";
edmediaplayertableRoot [label="MEDIAPLAYER DATA TABLE"];
edmediaplayertableType [label="Type | String" ];
edmediaplayertableModel [label="Model | String" ];
edmediaplayertableSerial [label="Serial | String"];
edmediaplayertableIssues [label="Issues | Table" ];

edmediaplayertableRoot -> edmediaplayertableType;
edmediaplayertableRoot -> edmediaplayertableModel;
edmediaplayertableRoot -> edmediaplayertableSerial;
edmediaplayertableRoot -> edmediaplayertableIssues;

edmediaplayertableIssues -> mediaissuestableRoot;
}

subgraph cluster_eddoccamtable {
node [shape=record];
label="Document Camera Data Table"
eddoccamtableRoot [label="DOCUMENT CAMERA DATA TABLE"];
eddoccamtableModel [label="Model | String" ];
eddoccamtableSerial [label="Serial | String"];
eddoccamtableIssues [label="Issues | Table" ];

eddoccamtableRoot -> eddoccamtableModel;
eddoccamtableRoot -> eddoccamtableSerial;
eddoccamtableRoot -> eddoccamtableIssues;

eddoccamtableIssues -> doccamissuestableRoot;
}

subgraph cluster_edprojectortable {
node [shape=record];
label="Projector Data Table";
edprojectortableRoot [label="PROJECTOR DATA TABLE"];
edprojectortableModel [label="Model | String" ];
edprojectortableSerial [label="Serial | String" ];
edprojectortableBulb [label="Blub Part | String" ];
edprojectortableBulbdata [label="Bulb Data | String"];

edprojectortableRoot -> edprojectortableModel;
edprojectortableRoot -> edprojectortableSerial;
edprojectortableRoot -> edprojectortableBulb;
edprojectortableRoot -> edprojectortableBulbdata;

edprojectortableBulbdata -> bulbtableRoot;

}


subgraph cluster_mediaissuestable {
node [shape=record];
label="Media Player Issues";
mediaissuestableRoot [label="MEDIAPLAYER ISSUES"];
mediaissuestableId [label="Id | Id" ];
mediaissuestableProblem [label="Problem | String" ];
mediaissuestableSolution [label="Solution | String"];
mediaissuestableFixed [label="Fixed | Bool" ];

mediaissuestableRoot -> mediaissuestableId;
mediaissuestableRoot -> mediaissuestableProblem;
mediaissuestableRoot -> mediaissuestableSolution;
mediaissuestableRoot -> mediaissuestableFixed;
}

subgraph cluster_doccamissuestable {
node [shape=record];
label="Document Camera Issues";
doccamissuestableRoot [label="DOCUMENT CAMERA ISSUES"];
doccamissuestableId [label="Id | Id" ];
doccamissuestableProblem [label="Problem | String" ];
doccamissuestableSolution [label="Solution | String"];
doccamissuestableFixed [label="Fixed | Bool" ];

doccamissuestableRoot -> doccamissuestableId;
doccamissuestableRoot -> doccamissuestableProblem;
doccamissuestableRoot -> doccamissuestableSolution;
doccamissuestableRoot -> doccamissuestableFixed;
}

subgraph cluster_bulbtable {
node [shape=record];
label="Bulb Data Table";
bulbtableRoot [label="BLUB DATA TABLE"];
bulbtableId [label="Id | Id" ];
bulbtableChangedate [label="Date | Time" ];
bulbtableHours [label="Hours | Int" ];
bulbtableComments [label="Comments | String"];

bulbtableRoot -> bulbtableId;
bulbtableRoot -> bulbtableChangedate;
bulbtableRoot -> bulbtableHours;
bulbtableRoot -> bulbtableComments;
}
}

http://img131.imageshack.us/img131/49/imagekr4.png

Does anyone know how to make a table in dot? What I want to do is to get rid of all the horizontal clusters and stack them atop one another, making several minor excel-like spreadsheets with relational arrows (that way I can point to the entire spreadsheet rather than having a point to a root which points elsewhere; or having orgasmal arrows going which-what-way). I've been trying for the past hour to figure it out, but I have no clue at all.

HopelessComposer
June 2nd, 2008, 01:12 am
I think you're probably the most computer-knowledgeable person on here, M.
I don't see anyone saving you, sadly. D:

Dark Bring
June 25th, 2008, 10:40 pm
Wow, I didn't know that Graphviz had something like this.

It also reminds me that I have yet to start learning LaTex. :<

PorscheGTIII
September 5th, 2008, 09:26 pm
I'm writing in C++ a program that...


...reads a positive number and then computes and prints the logarithm of the value to base 2.

My program is...


#include <iostream>
#include <cmath>

double M;
double N;
double R;

int b = 2;

using namespace std;

int main()
{
cout<< "This program calculates the logarithm of base 2 of any positive number." <<endl;
cout<< " " <<endl;
cout<< " " <<endl;

cout<< "Please enter a positive number... ";
cin>> M;

cout<< " " <<endl;
cout<< "------------------------------------------------------------------" <<endl;
cout<< " " <<endl;

N = fabs(M); //takes the absolute value of the number entered
R = log(N) / log(b); //calculates the long base 2 of N

cout<< "Answer.......................... " <<R <<endl;

cout<< " " <<endl;
cout<< " " <<endl;

return (0);
}

When I go to compile the program, it tells me that...


1>------ Build started: Project: Prob41, Configuration: Debug Win32 ------
1>Compiling...
1>Prob41.cpp
1>prob41.cpp(26) : error C2668: 'log' : ambiguous call to overloaded function
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(567): could be 'long double log(long double)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(519): or 'float log(float)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(121): or 'double log(double)'
1> while trying to match the argument list '(int)'
1>Prob41 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


What did I do wrong? :heh:

Jill-Jênn
September 5th, 2008, 09:36 pm
It actually works when I compile...
But it must be because b was an int and N a double. Try with:

double b = 2;

Dark Bring
September 5th, 2008, 09:56 pm
I don't know C++ or Visual Studio, but try changing "cmath" to "math" in the directives.

PorscheGTIII
September 5th, 2008, 10:15 pm
It actually works when I compile...
But it must be because b was an int and N a double. Try with:

double b = 2;

double did it. Thanks!

M
September 5th, 2008, 10:40 pm
Also, to add some syntactic sugar:


#include <iostream>
#include <cmath>

namespace prog {
double M, N, R;
const int b = 2;
}
using namespace std;


int main()
{
cout<<"This program calculates the logarithm of base 2 of any positive"
<<" number.\n\n\n"
<<"Please enter a positive number:> ";
cin >> prog::M;
cout<<"\n";

for (int i=0; i<66; i++) cout<<"-";
cout<<"\n\n";
prog::N = fabs(prog::M); //finds absolute value of given number (float)
prog::R = log(prog::N) / log(prog::b); //calculates the log

cout<< "Answer: "<<prog::R<<"\n\n\n";
return 0;
}



Let me explain what I did.

First thing's first, global variables without a namespace is bad. You have three choices, of which one is easier than the other: 1) develop a class which over complicates this program, 2) input them into a function so that they are scoped properly which I did not do, and 3) give them a namespace. I normally choose 3 when dealing with constant variables, and 1 when doing a larger assignment. Realistically, you could just put everything in the namespace inside main and solve all of these problems, but I felt like this would be a good example to explain namespaces a bit.

Second thing that I did, the variable "b" does not change. Ever. By rule of thumb, you should label this as a constant, to ensure that you never try to change it. Also, you only need two variables to actually do this assignment — one, the constant and two a double — but I didn't change this for illustrative purposes.

The third thing I did was apply some sugar to how your sourcecode looks. Lines do not exceed 76 characters in width, consolidated pieces of code, standardized a bit of the spacing, added a eyedrop loop, used some Common User interface rules (the :> for prompts).

The fourth thing I did was removed the block return you were doing.

Fifth thing, you don't need a double for an integer. This code compiles without warning or error in Visual C++ 2008, GCC 4.1.2, and Borland 5.5

Last thing, Newline at the end of the file. Trust me on this, just do it.


If for some odd reason this gives you a warning, you should typecast "b" to a double — which is similar to what Jill-Jen suggested, but not the same. Typecasting is better than hardcasting a variable (for low-level coding reasons) and saves you a lot of trouble in the long run. You can do this by simply placing (double) directly in front of the variable.

And another thing, DarkBring mentioned to drop the C in front of the math include. Do not do this, as it will use the older C Standard Library. The C that proceeds math is making certain that you're using the C++ friendly version of the math library. You may experience problems if you remove the C from the front.

Dark Bring
September 6th, 2008, 02:40 am
And another thing, DarkBring mentioned to drop the C in front of the math include. Do not do this, as it will use the older C Standard Library. The C that proceeds math is making certain that you're using the C++ friendly version of the math library. You may experience problems if you remove the C from the front.So that's where cmath is from. I'm currently picking my way through C so it'll be awhile before I get to C++.

M
September 6th, 2008, 06:05 am
Yep. Theoretically, using C libraries (http://en.wikipedia.org/wiki/C_standard_library) in a C++ project (http://en.wikipedia.org/wiki/C%2B%2B_standard_library) is completely possible, but C++ to C is not always so (for somewhat obvious reasons). What I noticed is that you'll get a lot of warning statements from your compiler when you're using the C libraries. In the case of GCC and using the -Werror switch, or using the Visual compiler and having all warnings marked as errors, this'll kill you. But! it's still a good idea to write error and warning free code.

HopelessComposer
September 10th, 2008, 03:30 pm
Hmm, I'm trudging ahead with that C# book again (on page 200; an epic milestone for me!), and I just ran into events. The book explained them well enough and everything, but I'm still a bit confused with them. Basically, I don't understand why you'd ever need or want to use them. The examples the book gave all made me go "wouldn't this a thousand times simpler just using plain method calls?" If someone has an example or two of something events can be used for that wouldn't be possible otherwise, or has a hypothetical situation where events would be more convenient than normal method calls, or just has an explanation as to how events are different from normal methods behind the scenes, I'd be much obliged. I'm rereading the book and my notes right now to try figuring it out, but I'm in school for most of the day today, so I don't have access to Visual Studio, meaning I can't experiment with this right now, sadly. I'll try figuring this out by myself, since I have nothing better to do, but some examples would be great anyway. Even if I do shed some light on this subject myself, it would be nice to have exmaples from better programmers to help clarify the situation even further.

Thanks guys. =D

Also, the book said that windows apps are "event driven," but they had event driven in quotes. So are windows programs actually driven by events (this seems the case to me), or did the book just mean that windows applications are driven by user interaction through button clicks and such? (Yes, I know button clicks are handled with events, which is why I'm assuming the book really meant what it said, even though it put what it said in quotes just to be a pain in the ass and confuse me for no reason. X3 )

M
September 10th, 2008, 04:41 pm
Simple answer:
It's just the way how OS theory was developed. It automagically works and works well.

In Depth answer:
Methods are useful for gui applications as they allow for optimal code reusage, but they need a way to be called when an action is actually preformed. How would you do that without micromanaging a whole bunch of infinite loops, break statements, and threads to listen to see if the event occurs? Events assist in that, as well as provide a common API for developing systems to react to events, and promotes forwards compatibility.


That is, if you're talking about GUI events. If your talking about events encapsulated for code-to-code, then the try-catch theory applies. Events are a bit overkill for those types of actions.

HopelessComposer
September 10th, 2008, 11:09 pm
Simple answer:
It's just the way how OS theory was developed. It automagically works and works well.

That's about all I figured out, really. XD

In Depth answer:
Methods are useful for gui applications as they allow for optimal code reusage, but they need a way to be called when an action is actually preformed. How would you do that without micromanaging a whole bunch of infinite loops, break statements, and threads to listen to see if the event occurs? Events assist in that, as well as provide a common API for developing systems to react to events, and promotes forwards compatibility.

Ah, thanks for that. My idea of what events are for are a little less vague now. The windows program I tried making last got too obtuse for me because I was using a bunch of loops and threads and things to keep track of what kinds of interactions were taking place in my program. That might have been one place where events could have spared me a lot of headache. I'm at school for another two hours. I'll look more into this when I get home though, and post my...ramblings on the subject. Thanks, M!
Edit: Ooh, I just found this, too. It basically just resays what you've already stated, but I need all the reiteration I can get. I can't wait to get home and mess around with this for real. Yay programming~

The Clock class from the last sample could simply print the time rather tahn raising an event, so why bother with the introduction of using delegates? The advantage of the publisg / subscribe idiom is that any number of classes can be notified when an event is raised. The subscribing classes do not need to know how the Clock works, and the Clock does not need to know what they are going to do in response to the event. Similarly a button can publish an Onclick event, and any number of unrelated objects can subscribe to that event, receiving notification when the button is clicked.

The publisher and the subscribers are decoupled by the delegate. This is highly desirable as it makes for more flexible and robust code. The clock can chnage how it detects time without breaking any of the subscribing classes. The subscribing classes can change how they respond to time changes without breaking the Clock. The two classes spin indepentdently of one another, which makes for code that is easier to maintain.

Edit: Doing pretty good now. Thanks M!

PorscheGTIII
September 13th, 2008, 05:25 am
Nice. I made a program to play Roulette minus red and black bets. I feel so l33t yet it is so far from it. XD

*Waits to be made fun of and criticized*


#include <iostream>
#include <ctime>
#include <iomanip>
#include <cstdlib> //Library used to pause the program to give the effect of a spin.

int x; //Vaiable for user to choose how they want to bet.
int y; //While betting on a specific number, this is the number the user chooses.
int z; //This is the value of the wheel.
int P = 0; //This is used to loop the game while P is 0
int U; //Helps descide if a number is even or odd.
double a; //This is the user's bet.
double BANK = 50.00; //This is how much money the user has to play with. Default is 50.

using namespace std;

int main()
{
while (P==0 && BANK > 0) //This lets the user play another round if they desire or kicks them out of the game if they over withdraw.
{
srand((unsigned)time(0)); //makes a random number based on the time in seconds since 1972
system("cls"); //Clears the screen of any other data.

cout <<"You have $" <<fixed <<setprecision(2) <<BANK <<" in your account." <<endl <<endl; //Displays how much money the user has to play with.


//This is the Menu options for the game.
cout << setw(8) <<"MENU" <<endl;
cout << " 1 - To bet on odd" <<endl;
cout << " 2 - To bet on even" <<endl;
cout << " 3 - To bet on a particular number" <<endl;
cout << "-1 - To quit without betting" <<endl;
cout << "User chooses to: ";
cin >>x;

switch(x) //This switch confirms the bet and asks for a number if user choose "3"
{
case 1: //user chose choice "1"
cout <<endl;
cout <<"User Chooses to Bet on Odd." <<endl;
cout <<"Please Enter Your Bet: $";
cin >>a;

//This shows that all bets are final and asks the user to spin the wheel
cout <<endl;
cout << "All bets are final! To spin the wheel..." <<endl;
system("PAUSE"); //Pauses the program to give the user the effect that they are spinning a wheel.

z = (rand() % 38) + 1; //This is the wheel. It will give a number 1 through 38.

cout <<endl;

if(z == 37 || z == 38) //This loops is for if the wheel lands on any green numbers.
{
if (z==37) //This means the wheel landed on Green 0.
{
cout <<"You have landed on: Green 0." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;

BANK = BANK - a; //This calculates your new BANK total.
z = 0; //This is to kick out of the green number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl;
cin >>P;
}
if (z==38) //This means the wheel landed on Green 00.
{
cout <<"You have landed on: Green 00." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;

BANK = BANK - a; //This calculates your new BANK total.
z = 0; //This is to kick out of the green number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl;
cin >>P;
}
}
if (z < 37 && z != 0) //This loop is for if the wheel lands on anthing but the green numbers and does not all entry if it already went through the green number loop.
{

U = z % 2; //This descides if the number the wheel landed on is even or odd

if (U==0) //This is for if the number landed on is even.
{
cout <<"You have landed on: " <<z <<"." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;

BANK = BANK - a; //This calculates your new BANK total.
z = 40; //This kicks out of the number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl;
cin >>P;
}
if (U==1) //This is for if the number landed on is odd.
{
cout <<"You have landed on: " <<z <<"!" <<endl;
cout <<"Congratulations! You have won: $" <<fixed <<setprecision(2) <<a*2 <<"!" <<endl;

BANK = BANK + a*2; //This calculates your new BANK total.
z = 40; //This kicks out of the number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl;
cin >>P;
}
}

break;

case 2: //user chose choice "2"
cout <<endl;
cout <<"User Chooses to Bet on Even." <<endl;
cout <<"Please Enter Your Bet: $";
cin >>a;

//This shows that all bets are final and asks the user to spin the wheel
cout <<endl;
cout << "All bets are final! To spin the wheel..." <<endl;
system("PAUSE"); //Pauses the program to give the user the effect that they are spinning a wheel.

z = (rand() % 38) + 1; //This is the wheel. It will give a number 1 though 38.

cout <<endl;

if(z == 37 || z == 38) //This loop is for if the wheel lands on any green numbers.
{
if (z==37) //This loop is if the wheel lands on Green 0.
{
cout <<"You have landed on: Green 0." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;
cout <<endl;

BANK = BANK - a; //Calculates the new BANK total.
z = 0; //Kicks out of the green number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
}
if (z==38) //This loop is if the wheel lands on Green 00.
{
cout <<"You have landed on: Green 00." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;
cout <<endl;

BANK = BANK - a; //Calculates the new BANK total.
z = 0; //Kicks out of the green number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
}
}
if (z < 37 && z != 0) //This is for if the wheel lands on a playable number and also does not allow entry after kicking out of the green loop.
{

U = z % 2; //This descides if the number the wheel landed on is even or odd.

if (U==0) //This is if the number landed on is even.
{
cout <<"You have landed on: " <<z <<"." <<endl;
cout <<"Congratulations! You have won: $" <<fixed <<setprecision(2) <<a*2 <<"!" <<endl;
cout <<endl;

BANK = BANK + a*2; //Calculates the new BANK total.
z = 40; //Kicks out of the number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
}
if (U==1) //This is if the number landed on is odd.
{
cout <<"You have landed on: " <<z <<"." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;
cout <<endl;

BANK = BANK - a; //Calculates the new BANK total.
z =40; //Kicks out of the number loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
}
}

break;

case 3: //user chose choice "3" and needs to enter a number to bet on
cout <<endl;
cout <<"User Chooses to Bet on a Specific Number." <<endl;
cout <<"Please Enter a Number from 1 to 36: ";
cin >>y; //Records the number the user wishes to bet on.
cout <<"Please Enter Your Bet: $";
cin >>a; //Records the user's bet.

cout <<endl;
cout<< "All bets are final! To spin the wheel..." <<endl;
system("PAUSE"); //Pauses the program to give the user the effect that they are spinning a wheel.

z = (rand() % 38) + 1; //This is the wheel. It will give a number 1 through 38.

if (z==y) //If the wheel lands on the number the user selected.
{
cout <<endl;
cout <<"You have landed on: " <<z <<"!" <<endl;
cout <<"Congratulations! You have won: $" <<fixed <<setprecision(2) <<a*35 <<"!" <<endl;
cout <<endl;

BANK = BANK + a*35; //Calculates the new BANK total.
z = 0; //Kicks out of the winner loop.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
}
if (z==37) //If the wheel lands on Green 0.
{
cout <<endl;
cout <<"You have landed on: Green 0." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;
cout <<endl;

BANK = BANK - a; //Calculates the new BANK total.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
z = 0; //Kicks out of the Green 0 loop.
}
if (z==38) //If the wheel lands on Green 00.
{
cout <<endl;
cout <<"You have landed on: Green 00." <<endl;
cout <<endl;

BANK = BANK - a; //Calculates the new BANK total.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
z = 0; //Kicks out of the Green 00 loop.
}
if (z < 37 && z != y && z != 0) //If the wheel lands on any number besides the winning number or green numbers. It does not allow entry from the winning or green loops.
{
cout <<endl;
cout <<"You have landed on: " <<z <<"." <<endl;
cout <<"I'm Sorry You Have Lost." <<endl;
cout <<endl;

BANK = BANK - a; //Calculates the new BANK total.

cout <<"Play Again? 0 = YES. 1 = NO THANK YOU." <<endl; //Asks the user for input if they would like to play again.
cin >>P;
z = 0; //Kicks out of the loop.
}

break;

case -1: //User wishes to leave
system("cls"); //Clears all text from the viewing screen.
cout <<endl;
cout <<"You have left with a account ballance of $" <<fixed <<setprecision(2) <<BANK <<"." <<endl;
cout <<"Thank you for playing! Come Again!" <<endl;
cout <<endl;
P = 2; //Kicks out of the while loop.
system("PAUSE");

break;

default: //Please never have this case!!!!
exit(0);
break;
}
if (BANK <= 0) //In the event that the user use all or over withdraws from the bank and tries to play a new game.
{
system("cls"); //Clears the screen of all text.
cout <<endl;
cout <<"I'm sorry, your acount ballance is $" <<fixed <<setprecision(2) <<BANK <<". You cannot afford to play another game." <<endl;
cout <<"You must pay the difference and leave.";
cout <<endl;
cout <<endl;

P = 2; //Kicks the user out of the while loop.
system("PAUSE");
}
if (P == 1) //If the user descides to leave after playing a round.
{
system("cls"); //Clears the screen of all text.
cout <<"You have left with a account ballance of $" <<fixed <<setprecision(2) <<BANK <<"." <<endl;
cout <<"Thank you for playing! Come Again!" <<endl;

P = 2; //Kicks the user out of the while loop.
system("PAUSE");
}
}


return (0);
}

M
September 13th, 2008, 01:00 pm
Stop.
Using.
Global.
VARIABLES!

Also, you can set the precision once for a stream, rather than each time you print (via: cout<<setiosflags(ios::fixed, ios::showpoint, ios::left)<<setprecision(2); ).

OR! you could use printf with this.

printf("You have $ %0.2f in your account.\n", BANK); //Displays how much money the user has to play with.
That allows you to freeform all the precisions and more in the printf syntax. It's a pretty nifty function, and far overshoots sdt::cout.


Perhaps I'll append this post with more when I get more time, but for right now, those are the two things that jump out at me.

PorscheGTIII
September 14th, 2008, 05:09 pm
One thing I can't seem to figure out...

How can I export my program so I can send it to another computer to run that doesn't have Visual Studio 2008 on it? (I'm using Visual Studio 2008.)

M
September 14th, 2008, 09:12 pm
Extract purely the sourcecode files. Then the person has to import the sourcecode in their IDE, or manually compile them with a makefile or directly with a CLC.

HopelessComposer
September 19th, 2008, 02:20 pm
Alright, since I'm at school, and I finished the C# book yesterday, and going to my classes is out of the question, I need something new to do to keep myself busy here. Does anyone know where I can find an online IDE/compiler/whatever for C#? I just want something that will run my programs, and provide a little bit of intellisense for me. I found one, but it didn't seem to work, hahah.

Thanks!

M
September 19th, 2008, 04:43 pm
Windows
C# Express (http://www.microsoft.com/express/vcsharp/)
SharpDevelop (http://sourceforge.net/projects/sharpdevelop/)

Linux
Mono (http://www.mono-project.com/Main_Page) -- .net compiler for Linux
MonoDevelop (http://www.monodevelop.com/Main_Page)

Eclipse
Improve C# (http://www.improve-technologies.com/alpha/esharp)

HopelessComposer
September 19th, 2008, 06:29 pm
Yeah, you gotta download those, though. I was looking for something that would run in a browser. I tried Compilr, but it sucks, lol.

I'll probably just install VS on one of the computer lab computers...

M
September 19th, 2008, 07:53 pm
.....what the fuck?

Run C# in a browser? Isn't that what Silverlight for? I highly doubt you want to learn the new bindings for that, as it's like 90x harder than Flex.

HopelessComposer
September 19th, 2008, 09:10 pm
The fuck:
No, I don't want to use silverlight, because I don't know what it is, and you just said it's different from normal C#. I want something like Compilr, but better. I want an IDE running from a browser that takes my code, compiles/interprets/whatever happens in C#, and gives me the executable. Compilr would be pretty decent, except it doesn't work half the time for me. So I'll just have to install VS2008 on some computer at the back of the computer lab that nobody ever uses. X3

Go try Compilr if you're still confused as to what I'm looking for:
www.compilr.com

M
September 20th, 2008, 12:19 am
I know what you're asking for (and a little better now that I've seen what crap website you are talking about), but it's a bit beyond the ability of Web2.0 to do something like what you're asking for. That's why I went to Silverlight, which is the leadin to Web3.0, but there's nothing in development for that kind of task, nor will there be.

Allow me to explain why:

Editors, yes. I can see that easily being available. Hell we're using one right now, albit it very simple. Most likely you're not going to find something as indepth as you're looking for simply because your browser is NOT a development environment. Your browser is just a prime success in transferring information in a cross platform manner. Trying to do otherwise is mostly futile as it will resolve into something that: 1) isn't want you wanted, 2) is dirt slow and is full of errors (a la your link), or 3) still requires another hard installed environment (often java) to produce your results, and is therefore not solely a browser application.

.NET was designed by Microsoft and therefore Microsoft would have the longest and strongest track record with this. As to follow with that, Visual Studio is their flagship development tool. Do the math.

Allowing for online compilation is something that is still brand new and risks a lot, and I mean a lot, of security. Hackers sit around all day trying to find backdoors into secure online languages such as php, but when you give them the control of making their own executable on the machine means that they can execute the code in a jailed environment (at least if the web admin is smart enough to set one up). A jail is the next level of safeguard, but you're still allowing someone to blaze right past the first security wall. That's like allowing someone into your storm room at your house. Rest assured, Compilr will be killed one way or another in the future.

Irregardless, it's ignorant to code the way you're asking for. Install VS2008e. It works, it compiles, it has intellisense, and it's free. It may not be able to work on a stick (well... it does if you hack some environment variables in windows and put somethings in a bat file), but it works.

Also, to add fuel, not even Java has its own on-the-fly online IDE, which is the leader of all web applications as of our current time.

HopelessComposer
September 20th, 2008, 03:38 am
So I'll just have to install VS2008 on some computer at the back of the computer lab that nobody ever uses. X3
;)
Also, all I wanted was an online editor that would take my code for me, do some simple syntax checking, and then compile that code using the C# compiler that's already on basically any decently updated computer right now. I can already use notepad to write programs on any computer with the .Net framework on it. I just wanted a color-coded internets editor that might have some intellisensing going on as a bonus. I don't think that would be impossible to make, even though you make it sound harder and more dangerous than launching yourself to the moon on a god-damned toboggan. I tried installing VS on a few school computers today, and it was a no-go. I'll have to ask one of the workers there to let me install it on one of the computers soon I guess. In the meantime, sorry for asking if you'd heard of a Compilr type solution that worked a bit better. I didn't realize that such a thing was both an impossible and blasphemous wish. I will correct my ignorant dreaming as soon as possible. =P

PorscheGTIII
September 20th, 2008, 07:32 pm
What would I have to do to make a Win32 Console Application in C++ that when it is initiated it first states that this program will play a sound file after 50 minutes from the next system pause. The system would then pause. The user presses any key to start a timer that will play a sound file after 50 minutes. Once the sound file has been initiated, the system would pause. When the user presses any key, the application will run again for another 50 minutes.

Just a little thing I was trying to figure out to remind me to reset my proxy connection before the hour time limit is up.

M
September 20th, 2008, 08:05 pm
Fun little application... Here's a bit of a template for you to build on.


#include <iostream>
#include <time.h>

namespace a {
/**
* This function simulates a complete program pause for the passed number of
* seconds without feedback or threading.
*
* @precondition Time class included
* @param seconds Total number of seconds to wait
* @return null
*/
void wait (double seconds) {
clock_t end; /* clock holder variable */
end = clock() + (clock_t)(seconds * CLOCKS_PER_SEC); /* takes current time and adds the desired amount of seconds to it */
while (clock() < end) {} /* empty loop that waits until the end time occurs */
}
};

using namespace std;

int main () {
char looping;
double seconds;

do {
cout<<"How many seconds do you want to wait? (int):> ";
cin>>seconds; cout<<"\n";
a::wait(seconds);
cout<<"\a" /* System bell excape */
<<"Would you like to wait again? (y/n):> ";
cin>>looping;
} while (looping != 'n');

return 0;
}

It's not load friendly, but it works for a timed pause.

PorscheGTIII
September 20th, 2008, 09:42 pm
To get the music to play, I included
#include <cstdlib>

When the time came to play the music file, I did...

system("start 01_-_Shio.mp3");
...but I had to include the music file in the directory of the program. I couldn't use cd to go to the directory it was located in for some reason.

EDIT: You wern't kidding about the CPU usage! Task Manager clocks the program in at 50% CPU usage!

M
September 20th, 2008, 09:54 pm
Well, I'm not certain if this is cross platform (aka I'm not in front of a windows computer to test this), but you can call the "sleep" function from time.h. simply replace a::wait(seconds) with sleep(seconds). I know this works in gcc, but the time value for seconds is very much different (between milliseconds and seconds).

And as for what you're doing to play the file, it's the same as a command prompt. So if you want to, you can specify a direct path, or, better yet, give a variable with the path to the file.

PorscheGTIII
September 20th, 2008, 11:32 pm
Yeah...


'sleep': identifier not found

I must be doing something wrong when typing the path. I've tried...


cd C:\Documents and Settings\[user name]\My Documents\My Music

and


cd C:\Documents_and_Settings\[user_name]\My_Documents\My_Music

M
September 20th, 2008, 11:48 pm
For playback, do this:



system("start C:\\Documents\ and\ Settings\\[user\ name\]\\My\ Documents\\My\ Music\\01_-_Shio.mp3");

PorscheGTIII
September 20th, 2008, 11:51 pm
Windows can not find 'C:\Documents'...

:\

M
September 21st, 2008, 12:57 am
Are you escaping everything properly?

Karkaroff
September 23rd, 2008, 12:47 am
Sorry, but this topic is talking about game programming?

M
September 23rd, 2008, 12:55 am
So far it's been about algorithms rather than Game Programming, but I don't see why you cannot talk about that.

Dark Bring
September 23rd, 2008, 12:07 pm
secure online languages such as phplol

M
September 23rd, 2008, 12:39 pm
Well, it's more secure than perl or asp, which were the previous industry standard :\

Alone
September 24th, 2008, 08:59 am
Here's the structure of my code:

<div> 2image, followed by 2 h3's, some spans </div>

Now, I want the background of the h3 to fade in/out on mouseover to a different background.

$(document).ready(function(){
$(".thumbs img").fadeTo("slow", 0.6); // This sets the opacity of the thumbs to fade down to 60% when the page loads

$(".thumbs img").hover(function(){
$(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
},function(){
$(this).fadeTo("slow", 0.6); // This should set the opacity back to 60% on mouseout
});
});

This is the closest thing I found so far - how do I specify the "background" of the h3 that is descendant from div.icon?

so far

$(".icon").hover(function(){
$(this).fadeTo("slow", 1.0); //

will fade my whole div, but

$(".icon h3").hover(function(){
$(this).fadeTo("slow", 1.0);

won't do anything at all :/

And I need to target the bg property specifically. Any ideas?

M
September 24th, 2008, 01:05 pm
1) Could you post the full html code, along with what js toolkits you're using. It looks like you're trying to use script.aculo.us, but I wanna make certain before I go the mile with ya.

2) Use single quotes in javascript when you're not dealing with variable strings (it makes life easier)

3) you should specify a class and "span" it (not div, because you don't want new line side affects) around the h3's. You're depending too much on the DOM (omg, my web design professor would kill me for saying that) structure. You can do it the way you have it, but it takes a lot more effort than just wrapping all your fade elements in a tag and then fading it.

Hell, you could screw the rules and create your own DOM tag.

Alone
September 24th, 2008, 01:32 pm
image: http://i514.photobucket.com/albums/t348/a-lone-trail/Picture10.png

html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>Re-write Slider</title>
<meta http-equiv="Content-Language" content="en-us" />
<meta name="author" content="A Lone Project" />

<style>
* {
margin: 0;
padding: 0
}

body {
width: 900px/*865px*/;
background: #333;
font-family: Verdana, Arial;
color: #000;
margin: auto;
margin-top: 20px;
}

div.sidebar {
width: 341px;
height: 446px;
float: left;
position: relative;
margin-right: 30px; /*space between side and panel*/
margin-left: 0px;
margin-top: 32px;
}

div.icon {
position: relative;
width: 341px;
height: 108px;
}

div#top.icon {
height: 115px;
}

div.sidebar a {
text-decoration: none;
}

/* @end */

/* @group Sidebar H3 */

div.icon h3 {
width: 154px;
min-height: 28px;
font: normal small-caps 18px arialroundedmtbold;
color: #8f8f8f;
text-align: center;
letter-spacing: 5px;
background-color: #000;
border-color: #000;
border-style: solid;
border-width: 80px 7px 0px 7px;
float: left;
padding: 0;
margin: -80px 0 0 5px;
}

div.icon h3.reflect {
margin-left: 0;
}

div.icon:hover h3 {
color: #fff;
backgroun: url(images/h3bg.png);
}

/* @end */

/* @group Sidebar Image */

.sidebar img {
width: 154px;
height: 80px;
float: left;
opacity: 0.6;
margin-right: 7px;
}

img.original {
background-image: url(images/picture.png);
margin-left: 12px;
}

img.reflect {
background-image: url(images/mirrorpicture.png);
margin-left: 7px;
}

div.icon:hover img.original, div.icon:hover img.reflect {
opacity: .9999;
}

/* @end */

/* @group Sidebar Overlays */

div.overlay {
background: url(images/overlay.png) repeat-y;
position: relative;
width: 168px;
height: 446px;
float: left;
margin-top: -446px;
margin-bottom: 0px;

}

span {
width: 168px;
height: 108px;
position: absolute;
}

span.left {
background: url(images/gridleft.png) repeat;
left: 0px;
}

span.right {
background: url(images/gridright.png) repeat;
left: 173px;
}

/* @end */

/* @group Sidebar Rounded Corners */

img.one, img.two, img.three, img.four {
width: 7px;
height: 7px;
margin: 0;
opacity: .9999;
float: left;
}

img.one, img.three {
border-right: 154px solid #000;
margin-left: 5px;
}

img.one {
background: url(images/circle.png) no-repeat 0px 0;
}

img.two {
background: url(images/circle.png) no-repeat -7px 0;
}

img.three {
background: url(images/circle.png) no-repeat 0 -7px;
}

img.four {
background: url(images/circle.png) no-repeat -7px -7px;
}

img#reflect.one {
margin-left: 0;
}

img#reflect.three {
margin-left: 0;
}

/* @end */



div#top.icon span.left, div#top.icon span.right {
top: 7px;
}

span.border {
height: 7px;
width: 168px;
position: absolute;
}

span#topl.border {
background: url(images/gridlefttop.png);
left: 0px;
}

span#topr.border {
background: url(images/gridrighttop.png);
left: 173px;
}

span#bottoml.border {
background: url(images/gridleftbottom.png);
left: 0px;
top: 108px;
}

span#bottomr.border {
background: url(images/gridrightbottom.png);
left: 173px;
top: 108px;
}

span.worktb {
background: url(images/gridright.png);
width: 500px;
position: absolute;
height: 528px;
margin-left: 7px;
}

span.worklr {
background: url(images/gridright.png);
width: 514px;
position: absolute;
height: 514px;
margin-left: 0px;
margin-top: 7px;
}
</style>

</head>
<body>
<div class="sidebar">
<div class="icon" id="top">
<a href="#">
<img src="./glass.png" class="one" id="reflect" />
<img src="./images/glass.png" class="two" />
<img src="./images/glass.png" class="one" />
<img src="./images/glass.png" class="two" />
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">emoh</h3>
<h3>home</h3>
<span class="border" id="topl" />
<span class="border" id="topr" />
<span class="left" />
<span class="right" />
</a>
</div>
<div class="icon">
<a href="#">
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">selpmas</h3>
<h3>samples</h3>
<span class="left" />
<span class="right" />
</a>
</div>

<div class="icon">
<a href="#">
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">setar</h3>
<h3>rates</h3>
<span class="left" />
<span class="right" />
</a>
</div>

<div class="icon" id="bottom">
<a href="#">
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">gne-sur</h3>
<h3>rus-eng</h3>
<img src="./images/glass.png" class="three" id="reflect" />
<img src="./images/glass.png" class="four" />
<img src="./images/glass.png" class="three" />
<img src="./images/glass.png" class="four" />
<span class="left" />
<span class="right" />
<span class="border" id="bottoml" />
<span class="border" id="bottomr" />
</a>
</div>

<div class="overlay" />
</div>
</body>
</html>

M
September 24th, 2008, 02:31 pm
Tell me...
Is this what you're seeing on your side, because as it stands... I can't even begin to reuse what you've written.

http://img300.imageshack.us/img300/7155/whatthehellaf8.th.jpg (http://img300.imageshack.us/img300/7155/whatthehellaf8.jpg)http://img300.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

You're calling a bunch of images that you didn't provide, and please tell me you didn't collectively join them into the above picture, because that's asking for some tender loving... I already had to refactor your code because you're using absolutes for your images as well (big fat BAD).

Oh yeah... refactored source code:


<html>

<head>
<script src="script/jquery-1.2.1.pack.js" type="text/javascript"></script>
<script src="script/jquery-easing.1.2.js" type="text/javascript"></script>
<script src="script/jquery-easing-compatibility.1.2.js" type="text/javascript"></script>
<script src="script/coda-slider.1.1.1.js" type="text/javascript"></script>
<style>
/* @group General */

* { /* Oh Em Gee, why? */
margin: 0;
padding: 0
}

body {
width: 900px/*865px*/;
background: #333;
font-family: Verdana, Arial;
color: #000;
margin: auto;
margin-top: 20px;
}

div.sidebar {
width: 341px;
height: 446px;
float: left;
position: relative;
margin-right: 30px; /*space between side and panel*/
margin-left: 0px;
margin-top: 32px;
}

div.icon {
position: relative;
width: 341px;
height: 108px;
}

div#top.icon {
height: 115px;
}

div.sidebar a {
text-decoration: none;
}

/* @end */

/* @group Sidebar H3 */

div.icon h3 {
width: 154px;
min-height: 28px;
font: normal small-caps 18px arialroundedmtbold;
color: #8f8f8f;
text-align: center;
letter-spacing: 5px;
background-color: #000;
border-color: #000;
border-style: solid;
border-width: 80px 7px 0px 7px;
float: left;
padding: 0;
margin: -80px 0 0 5px;
}

div.icon h3.reflect {
margin-left: 0;
}

div.icon:hover h3 {
color: #fff;
backgroun: url(images/h3bg.png);
}

/* @end */

/* @group Sidebar Image */

.sidebar img {
width: 154px;
height: 80px;
float: left;
opacity: 0.6;
margin-right: 7px;
}

img.original {
background-image: url(images/picture.png);
margin-left: 12px;
}

img.reflect {
background-image: url(images/mirrorpicture.png);
margin-left: 7px;
}

div.icon:hover img.original, div.icon:hover img.reflect {
opacity: .9999;
}

/* @end */

/* @group Sidebar Overlays */

div.overlay {
background: url(images/overlay.png) repeat-y;
position: relative;
width: 168px;
height: 446px;
float: left;
margin-top: -446px;
margin-bottom: 0px;
}

span { /* OMFG look into this */
width: 168px;
height: 108px;
position: absolute;
}

span.left {
background: url(images/gridleft.png) repeat;
left: 0px;
}

span.right {
background: url(images/gridright.png) repeat;
left: 173px;
}

/* @end */
</style>
</head>

<body>
<div class="sidebar">
<div class="icon" id="top">
<a href="#">
<img src="./glass.png" class="one" id="reflect" />
<img src="./images/glass.png" class="two" />
<img src="./images/glass.png" class="one" />
<img src="./images/glass.png" class="two" />
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">emoh</h3>
<h3>home</h3>
<span class="border" id="topl" />
<span class="border" id="topr" />
<span class="left" />
<span class="right" />
</a>
</div>
<div class="icon">
<a href="#">
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">selpmas</h3>
<h3>samples</h3>
<span class="left" />
<span class="right" />
</a>
</div>

<div class="icon">
<a href="#">
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">setar</h3>
<h3>rates</h3>
<span class="left" />
<span class="right" />
</a>
</div>

<div class="icon" id="bottom">
<a href="#">
<img src="./images/iconoverlay.png" class="reflect" />
<img src="./images/iconoverlay.png" class="original" />
<h3 class="reflect">gne-sur</h3>
<h3>rus-eng</h3>
<img src="./images/glass.png" class="three" id="reflect" />
<img src="./images/glass.png" class="four" />
<img src="./images/glass.png" class="three" />
<img src="./images/glass.png" class="four" />
<span class="left" />
<span class="right" />
<span class="border" id="bottoml" />
<span class="border" id="bottomr" />
</a>
</div>

<div class="overlay" />
</div>
</body>
</html>

Alone
September 24th, 2008, 03:00 pm
Updated my html and css code. You should be seeing the spoiler image: empy image boxes are rounded corners!

Absolute is used only for spans

HopelessComposer
October 2nd, 2008, 03:29 pm
I'm having a kind of weird program with C#. Whenever I close my program, it doesn't really close. Ie, it's still open in processes in the task manager, even though it goes away in the application section. Also, if I open the program from Visual Studio, and then close it, it won't stop debugging like a normal program; I have to actually click on "stop debugging," which then prompts VS to close my program down for me, since clicking the x on my form isn't cutting it for some reason.

Is there any way to tell my program to make sure it shuts off and cleans itself off when I close it? Hahah.

I have two threads running in the program; one thread updates a clock using the system time, and changes controls on a windows form. The other thread opens the windows form, sits around waiting for input, etc etc. I think the clock thread may be what's messing my program up; since I want it to update constantly, the clock thread launches an update method that says to repeat "while(true)." I figured my program would close the thread whenever it closes, but maybe not? Is my infinite loop keeping my program from closing properly? Is there a way I can say something like "When my program is closed, end the stupid while loop?"

I tried
if(aReferenceToMyMainForm==null)
{
Thread.CurrentThread.Abort();
Application.Exit();
}

but my program doesn't seem to care...I'm going to check it out more closely after work, but I'm surprised this is a problem at all. I thought .Net was supposed to kill your programs off for you and do garbage collection and all that stuff for you without you asking. My program is so bad that I'm breaking .Net! Nooooo!~!

HopelessComposer
October 30th, 2008, 04:28 am
Hmm, the last one wasn't answered, but here's another anyway. Kind of related:

I have two buttons on a windows form. If I press the first button, it disables the second button (grays it out and everything), has the thread sleep for five seconds, and then re-enables the second button.

Now, in the second button's click event, I have "if(enabled)[change a form label]."
If I click on it when the button's enabled, the label is changed, predictably. If I click on the button when it's grayed out, the button waits five seconds while the thread sleeps, and then goes ahead and changes the label after it's re-enabled. It's basically saving my click event while it sleeps, and then applying it when it wakes up. What the fuck is up with that?

More problems, I swear to God. You'd think disabling a button would disable it. X3
Of course, this is happening in my ridiculously broken multithread program...I'm going to start a fresh form program and see if it does it there, too...

Edit: Alright, I just started a fresh program, and it still does it. So I decided to change the first button's click event so that instead of making the thread sleep, it would simply be "button2.Enabled = !button2.Enabled;" instead. With that set up, the second button wouldn't "save" its click event; it works the way you'd expect. I really don't understand multithreading. I'm assuming that the Form program is using more than one thread, then. Maybe some kind of mysterious manager thread along with a separate thread for each form? I really don't understand multithreading.

Also, is there a way to tell if an object exists on a heap?
Say I do something like this:


MyObject myObject = new myObject();
myObject = null;
GC.Collect();

After the second line, I can no longer refer to MyObject's instance through it's reference, since I set that reference to null, but another part of my program needs to know whether or not that instance is still alive before it can continue. Is there a way for me to find out whether or not an object has been killed by garbage collection? It doesn't seem like I should need to know that, but for some reason, my program seems to depend on it. At least according to my debugger output window. If I do certain things while I have more than one instance of a certain object alive, the program screws up...but if I do those same things after my debugger window WriteLine()'s me "In MyObject's Dispose Method!", then the program runs fine. Do objects have a "I'm being killed!" event? *runs to check*

HopelessComposer
January 10th, 2009, 04:10 am
Jesus, this thread is dead...
REVIVE!~!

I programmed like...all day today. I'd announce my happiness in GC, but I can't, so here I am. I guess now that I'm posting, I may as well ask for help with my last post, since it was never answered, and I could never find any information on the subject with google.

Milyardo
January 27th, 2009, 07:17 pm
What was your last question? (too lazy to use the back button)

HopelessComposer
January 29th, 2009, 08:10 am
Hmm, the last one wasn't answered, but here's another anyway. Kind of related:

I have two buttons on a windows form. If I press the first button, it disables the second button (grays it out and everything), has the thread sleep for five seconds, and then re-enables the second button.

Now, in the second button's click event, I have "if(enabled)[change a form label]."
If I click on it when the button's enabled, the label is changed, predictably. If I click on the button when it's grayed out, the button waits five seconds while the thread sleeps, and then goes ahead and changes the label after it's re-enabled. It's basically saving my click event while it sleeps, and then applying it when it wakes up. What the fuck is up with that?

More problems, I swear to God. You'd think disabling a button would disable it. X3
Of course, this is happening in my ridiculously broken multithread program...I'm going to start a fresh form program and see if it does it there, too...

Edit: Alright, I just started a fresh program, and it still does it. So I decided to change the first button's click event so that instead of making the thread sleep, it would simply be "button2.Enabled = !button2.Enabled;" instead. With that set up, the second button wouldn't "save" its click event; it works the way you'd expect. I really don't understand multithreading. I'm assuming that the Form program is using more than one thread, then. Maybe some kind of mysterious manager thread along with a separate thread for each form? I really don't understand multithreading.

Also, is there a way to tell if an object exists on a heap?
Say I do something like this:
Code:

MyObject myObject = new myObject();
myObject = null;
GC.Collect();

After the second line, I can no longer refer to MyObject's instance through it's reference, since I set that reference to null, but another part of my program needs to know whether or not that instance is still alive before it can continue. Is there a way for me to find out whether or not an object has been killed by garbage collection? It doesn't seem like I should need to know that, but for some reason, my program seems to depend on it. At least according to my debugger output window. If I do certain things while I have more than one instance of a certain object alive, the program screws up...but if I do those same things after my debugger window WriteLine()'s me "In MyObject's Dispose Method!", then the program runs fine. Do objects have a "I'm being killed!" event?
Quoted, because you asked for it. :heh:

pifish
January 30th, 2009, 04:40 am
Do objects have a "I'm being killed!" event?

I think Destructors (http://msdn.microsoft.com/en-us/library/66x5fx1b.aspx) might be what you're looking for.

HopelessComposer
January 30th, 2009, 06:41 pm
I think Destructors might be what you're looking for.
I'm pretty sure I used destructors. But the thread the object was on kept on living...or something.

Know what? Nevermind my question. It was months ago, and the program the question was referring to was wiped out in a harddrive reformatting. It was probably a stupid problem easily fixed by the few extra months of programming experience I've gained since then. If I try rewriting the program, and it still doesn't work, I'll just ask new questions. Thanks for the suggestion though, Phard!

PorscheGTIII
January 31st, 2009, 11:24 pm
I wrote a program for my Anime Club to randomly choose the night's line-up from a list in a .txt file. The problem is, most of the time one of the labels comes up as null for some reason. It's also probably not the best way to write it. :( It's written in C#. Can anyone help?


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.IO;

namespace Anime_Roulette
{
public partial class Form1 : Form
{
//Defining variables for each lable. The string is used to store each line from a .txt file.
String[] x = new String[10];
int i = 0;
int a = 100;
int b = 100;
int c = 100;
int d = 100;
int f = 100;
int g = 100;

public Form1()
{
//This adds the embeded resource picture to the form on start-up.
InitializeComponent();
Graphics gr = pictureBox1.CreateGraphics();
Assembly a = this.GetType().Assembly;
Stream s = a.GetManifestResourceStream("Anime_Roulette.AnimeClub.bmp");
pictureBox1.Image = Image.FromStream(s);

//This shows the Open File Dialouge box on start up to select the .txt file that has the anime line-up.
//Creates a string to read in each line from a .txt file and then sets it to the string array.
openFileDialog1.ShowDialog();
StreamReader sr = new StreamReader(openFileDialog1.FileName);
String r = sr.ReadLine();
while (!sr.EndOfStream)
{
r = sr.ReadLine();
x[i] = r;
i++;
}
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
//Generates two random numbers
Random r = new Random();
a = r.Next(i + 1);
b = r.Next(i + 1);
c = b;

//Randomly choosing six random numbers that represents a line from the .txt file.
while (a == b)
{
b = r.Next(i + 1);
c = b;
}
while (a == c || b == c)
{
c = r.Next(i + 1);
d = c;
}
while (a == d || b == d || c == d)
{
d = r.Next(i + 1);
f = d;
}
while (a == f || b == f || c == f || d == f)
{
f = r.Next(i + 1);
g = f;
}
while (a == g || b == g || c == g || d == g || f == g)
{
g = r.Next(i + 1);
}

//Applys the randomly choosen line of text to the labels.
label2.Text = x[a];
label3.Text = x[b];
label4.Text = x[c];
label5.Text = x[d];
label7.Text = x[f];
label8.Text = x[g];

}
}
}

Milyardo
January 31st, 2009, 11:58 pm
Hi Porsche! How attached to C# are you? I could rewrite this program in a couple minutes in Java or PERL.

PorscheGTIII
February 1st, 2009, 12:38 am
All I know is C# and C++.

Neko Koneko
February 3rd, 2009, 11:12 am
Maybe I should start programming again

HopelessComposer
February 3rd, 2009, 11:49 pm
Maybe I should start programming again
Do it. Ichigos suffers from a severe lack of programmers. As an admin, it's your duty to help fix that! XD

Milyardo
February 10th, 2009, 08:01 am
Do it. Ichigos suffers from a severe lack of programmers. As an admin, it's your duty to help fix that! XD

It doesn't help that as a programmer, I am largely self sufficient, and thus I have no need to ask for help on a forum. Though I love answering questions! HopelessComposer, ask more programming Questions NAO. :w00t:

M
September 23rd, 2009, 03:17 am
:hyper revive:

It was just determined by my Software Engineering team that we're going to be using VS C# with XNA. As some may already know, I'm completely virgin to the .NET languages. While I have a book for learning the language myself (O'Reilly C# in a Nutshell (http://www.amazon.com/dp/0596527578/) with Learning XNA 3.0 (http://www.amazon.com/dp/0596521952/) (yes I'm an O'Reilly buff)), I would like to request some books on the subject that you have both used and liked. The reason being is that I have three clueless teammates that don't quite follow my line of thought and need some outside opinions before recommending them any books.

Neko Koneko
September 23rd, 2009, 08:39 am
I use C# for dummies XD

I also have a question: does anyone know how I can get the current system time using C#?

pifish
September 23rd, 2009, 10:55 am
does anyone know how I can get the current system time using C#?


DateTime time = DateTime.Now;
long sysTime = time.Ticks; I'm guessing that's what you're after

Neko Koneko
September 23rd, 2009, 12:16 pm
What does it make of the time? Does it make it a string or a variable or whatever?

What I want is to create a timer that last for a certain amount of time, let's say 30 minutes. When I start the timer, it has to check the current time (in seconds, so HH:MM:SS) and then every second, check the current time and compare the difference. So if we start at 2:30:30, and the next time I check it's on 2:32:30, two minutes have passed, the program will have to calculate that the difference is 120 seconds (2 minutes) and show that on the timer.

The reason is that I want it to run on my phone to keep track of my break times at work, but whenever my phone goes into standby the timer stops. So it needs to look at the current time in order to run properly.

Taemond
September 23rd, 2009, 02:22 pm
Reading through this thread makes me want to get off my arse and put more effort into programming lol. I do a bit but not much. Say, do any of you know of a good tutorial for learning C++ ?

M
September 23rd, 2009, 02:53 pm
What does it make of the time? Does it make it a string or a variable or whatever?

What I want is to create a timer that last for a certain amount of time, let's say 30 minutes. When I start the timer, it has to check the current time (in seconds, so HH:MM:SS) and then every second, check the current time and compare the difference. So if we start at 2:30:30, and the next time I check it's on 2:32:30, two minutes have passed, the program will have to calculate that the difference is 120 seconds (2 minutes) and show that on the timer.

The reason is that I want it to run on my phone to keep track of my break times at work, but whenever my phone goes into standby the timer stops. So it needs to look at the current time in order to run properly.

The value is an object which doesn't really have any meaning to others, but there are several methods which return what you are looking for.

Actually, it looks like if you use two System.DateTime datatypes, there is a method to compare the two, such as System.DateTime.Compare(varDateTime1, varDateTime2); where this returns a -1, 0, or 1 like a string comparison does.

The DateTime object itself doesn't have operator support, so trying to print it might produce interesting results; but it does have quite a few methods that handle the constructed value as a string (the simplest being ToString).

[source]
MSDN (http://msdn.microsoft.com/en-us/library/system.datetime_methods%28VS.71%29.aspx)

HopelessComposer
September 23rd, 2009, 06:51 pm
What does it make of the time? Does it make it a string or a variable or whatever?

What I want is to create a timer that last for a certain amount of time, let's say 30 minutes. When I start the timer, it has to check the current time (in seconds, so HH:MM:SS) and then every second, check the current time and compare the difference. So if we start at 2:30:30, and the next time I check it's on 2:32:30, two minutes have passed, the program will have to calculate that the difference is 120 seconds (2 minutes) and show that on the timer.

The reason is that I want it to run on my phone to keep track of my break times at work, but whenever my phone goes into standby the timer stops. So it needs to look at the current time in order to run properly.
__________________
You want DateTime.CurrentTime, I think. If I remember correctly from like six months ago, anyway.
For most of the stuff you need to find, you can just use intellisense and read the descriptions, hahah.

You'll probably want to look at the TimeSpan class(struct?) too.

Dark Bring
November 22nd, 2009, 09:49 am
I wish I've spent more time on Perl. :(

M
November 22nd, 2009, 03:45 pm
Oh yeah, I heard Perl, which means I need to stretch my Perl muscle a bit! I had to write a program that takes several metadatas off of a binary number string for an assignment. For your enjoyment, I've posted the code below.


00001 #!/usr/bin/perl -w
00002
00003 #****c* uofm.csc383/BinaryMetadata
00004 # AUTHOR
00005 # Mies Tio Rutle
00008 # COPYRIGHT
00009 # (c)2009 by Ataraxia Project LLD.
00010 # NAME
00011 # BinaryMetadata
00012 # USAGE
00013 # my $var = BinaryMetadata->new(binary-number);
00014 # my $enc = $var->encode;
00015 # DESCRIPTION
00016 # Takes a binary number and calculates:
00017 # o MSB
00018 # o LSB
00019 # o Signed and Unsigned Decimal number and other translations
00020 # on the data. It also has an encode function to transport
00021 # the metadata via YAML.
00022 # INPUT
00023 # binary-number -- Any string that represents a binary number.
00024 # This must have a character 1 or 0 to use.
00025 # RESULT
00026 # Metadata on the passed binary number.
00027 # EXAMPLE
00028 # my $num = new BinaryData('100110');
00029 # print $num; # outputs decimal value
00030 # print $num->print; # Fancy Prints to STDOUT
00031 # print $num.encode # outputs YAML 1.1
00032 # NOTES
00033 # The YAML output format complies with the 1.1 standard, and
00034 # encodes nearly all the calculated data, allowing easy transport.
00035 # The tags used and what they contain are as follows:
00036 # o Value -- The binary number in question
00037 # o LSB -- The Least Significant Bit
00038 # o MSB -- The Most Significant Bit
00039 # o Length -- Length of the binary number
00040 # o Unsigned -- Nested hash table for unsigned representation of the
00041 # binary number.
00042 # o Unsigned.MaxValue -- Maximum representation of the same length.
00043 # o Unsigned.MinValue -- Minimum representation of the same length.
00044 # o Unsigned.Decimal -- Decimal value of the number.
00045 # o Signed -- Nested has hash table for signed represenation of the
00046 # binary number.
00047 # o Signed.MaxValue -- Maximum representation of the same length.
00048 # o Signed.MinValue -- Minimum representation of the same length.
00049 # o Signed.Decimal -- Decimal representation of the number.
00050 #
00051 # BUGS
00052 # There is no error handling within the class. If the wrong
00053 # datatype is passed, it will crash the entire application.
00054 #
00055 #*****
00056 #
00057 package BinaryMetadata;
00058 use strict;
00059 use warnings;
00060
00061 sub DEBUG { return 0; } # Debug Switch
00062
00063 my $var = {}; # Object Structure
00064
00065 # Establshes data structure and calculates decimal value
00066 # using the Little Endian model.
00067 sub new {
00068 my ($self, $value) = @_;
00069 my $length = length scalar $value;
00070
00071 # Reverse number hack
00072 my $rev = reverse ("\n".$value);
00073 chomp $rev;
00074
00075 my $max = {};
00076 $max->{'Signed'} = 0;
00077
00078 #Max value for signed binary
00079 foreach (0..$length-2) {
00080 $max->{'Signed'} += 2**$_;
00081 }
00082 #Max value for unsigned binary
00083 foreach (0..$length-1) {
00084 $max->{'Unsigned'} += 2**$_;
00085 }
00086
00087 # Data Structure to hold Metadata about the number
00088 $var = {
00089 Length => $length,
00090 Unsigned => {
00091 MaxValue => $max->{'Unsigned'},
00092 MinValue => 0,
00093 Decimal => 0,
00094 },
00095 Signed => {
00096 MaxValue => $max->{'Signed'}, # all but final value 1s
00097 MinValue => -1*2**($length-1), # Just the first value 1
00098 Decimal => 0,
00099 },
00100 LSB => substr($value, $length-1, 1),
00101 MSB => substr($value, 0, 1),
00102 Value => $value,
00103 Reverse => $rev,
00104 };
00105
00106 # Regex check for only processing binary numbers
00107 if (not ($var->{Value} =~/^(0|1)*$/)) {
00108 print "Bad input. Exiting..." and exit 0;
00109 }
00110
00111 # Calculates Decimal value up to MSB for unsigned numbers
00112 print "Unsigned Loop:"."\n"."index;current;char;power;add"."\n" if DEBUG;
00113 for (0..$var->{Length}-1) {
00114 my $char = substr($var->{Reverse},$_,1);
00115 if (DEBUG) {
00116 print "\t$_"; #index
00117 print "\t$var->{Unsigned}->{Decimal}"; #Current Value
00118 print "\tIOC: ".$char; #Character
00119 print "\tPower: ".2**($_); #Place Power
00120 }
00121 if ($char eq '1') {
00122 print "\tAdding: ".$char*2**$_ if DEBUG;
00123 $var->{Unsigned}->{Decimal} += 2**$_;
00124 print "\tResult: ".$var->{Unsigned}->{Decimal} if DEBUG;
00125 }
00126 print "\n" if DEBUG;
00127 }
00128
00129 print "Signed Loop:"."\n"."index;current;char;power;add"."\n" if DEBUG;
00130 print "Negative: " if DEBUG;
00131 $var->{Signed}->{Decimal} -= $var->{MSB}*2**($var->{Length}-1);
00132 print $var->{Signed}->{Decimal}."\n" if DEBUG;
00133 for (0..$var->{Length}-2) {
00134 my $char = substr($var->{Reverse},$_,1);
00135 if (DEBUG) {
00136 print "\t$_"; #index
00137 print "\t$var->{Unsigned}->{Decimal}"; #Current Value
00138 print "\tIOC: $char"; #Character
00139 print "\tPower: ".2**($_); #Place Power
00140 }
00141 if (substr($var->{Reverse},$_,1) eq '1') {
00142 print "\tAdding: ".$char*2**$_ if DEBUG;
00143 $var->{Signed}->{Decimal} += 2**$_;
00144 print "\tResult: ".$var->{Signed}->{Decimal} if DEBUG;
00145 }
00146 print "\n" if DEBUG;
00147 }
00148
00149 bless $var,$self;
00150 return $var;
00151 }
00152
00153 # Prints YAML 1.1 encoded data structure
00154 sub encode {
00155 my ($self,$data) = @_;
00156 my $encode = "";
00157 $encode = "---"."\n"; # start record
00158 $encode .= "Yaml Version: 1.1"."\n";
00159 $encode .= "Binary:"."\n";
00160 $encode .= "\tValue: $self->{Value}"."\n";
00161 $encode .= "\tLSB: $self->{LSB}"."\n";
00162 $encode .= "\tMSB: $self->{MSB}"."\n";
00163 $encode .= "\tLength: $self->{Length}"."\n";
00164 $encode .= "\tUnsigned:"."\n";
00165 $encode .= "\t\tMax Value: $self->{Unsigned}->{MaxValue}"."\n";
00166 $encode .= "\t\tMin Value: $self->{Unsigned}->{MinValue}"."\n";
00167 $encode .= "\t\tDecimal: $self->{Unsigned}->{Decimal}"."\n";
00168 $encode .= "\tSigned:"."\n";
00169 $encode .= "\t\tMax Value: $self->{Signed}->{MaxValue}"."\n";
00170 $encode .= "\t\tMin Value: $self->{Signed}->{MinValue}"."\n";
00171 $encode .= "\t\tDecimal: $self->{Signed}->{Decimal}"."\n";
00172 $encode .= "..."."\n";
00173 return $encode;
00174 }
00175
00176 # Prints a Human Readable Table using Big Endian
00177 sub table {
00178 my $str = "";
00179 $str .= "`>' Signifies LSB\n";
00180 $str .= "\tBit\tUnsigned Weight\tUnsigned Answer\n";
00181 for (0..$var->{Length}-2) {
00182 my $char = substr($var->{Value},$_,1);
00183 my $idx = $var->{Length}-$_-1;
00184 $str .= "\t$char\t".2**($idx)."\t\t".$char*2**($idx)."\n";
00185 }
00186 $str .= ">\t".substr($var->{Value},$var->{Length}-1,1);
00187 $str .= "\t".1;
00188 $str .= "\t\t".substr($var->{Value},$var->{Length}-1,1)."\n";
00189 $str .= "\t\t\t\t$var->{Unsigned}->{Decimal}\n";
00190
00191 $str .= "\n---\n";
00192
00193 $str .= "\tBit\tSigned Weight\tSigned Answer\n";
00194
00195 $str .= "\t".substr($var->{Value},0,1);
00196 $str .= "\t".-2**($var->{Length}-1);
00197 $str .= "\t\t".-(substr($var->{Value},0,1))*2**($var->{Length}-1)."\n";
00198 for (1..$var->{Length}-2) {
00199 my $char = substr($var->{Value},$_,1);
00200 my $idx = $var->{Length}-$_-1;
00201 $str .= "\t$char\t".2**($idx)."\t\t".$char*2**($idx)."\n";
00202 }
00203 $str .= ">\t".substr($var->{Value},$var->{Length}-1,1);
00204 $str .= "\t".1;
00205 $str .= "\t\t".substr($var->{Value},$var->{Length}-1,1)."\n";
00206 $str .= "\t\t\t\t$var->{Signed}->{Decimal}\n";
00207 $str .= "---------------------------------------------------\n\n";
00208 return $str;
00209 }
00210
00211 return 1;
00212
00213 # vim: ts=2:
00214


Fun, no?

Dark Bring
November 22nd, 2009, 04:28 pm
I see. :shifty:

All it took for me was a few years in Java and a few hours in Perl for this (Do not learn Perl) (http://ubermonkey.net/blog/2008/02/24#DoNotLearnPerl) to hit home. :cry:

M
November 22nd, 2009, 05:28 pm
Well, I don't believe everything that article mentions. There are times when you want the type safety to be there (Unless you want to write your own typing system in Perl, which I'll tell you now: it is not all that fun). That's why I sorta advocate Ada and OCaml for extremely data secure applications, as you can't use the wrong datatype for actions. Hell, in Ocaml,


# let add a b = a + b;;
val add : int -> int -> int = <fun>


adds ONLY integers, whereas


# let fadd a b = a +. b;;
val fadd : float -> float -> float = <fun>


adds ONLY floats.

Here's the kicker, what happens when you try to call fadd with an integer in one of it's arguments?


# fadd 3.2 1;;
Error: This expression has type int but an expression was expected of type
float

You have to do this


# fadd 3.2 (float_of_int 1);;
- : float = 4.2

Now, you ask, why wouldn't you just use float_of_int all the time? Well look at this...


# fadd 3.2 (float_of_int 1.3);;
Error: This expression has type float but an expression was expected of type
int

Now there's some type security, if I may say so myself.

There's no implicit casting, and all operations are set to the exact type. This does wonders when working with several exacting data structures such as geometric displacement, toupled datatypes, or genetic coding.

an-kun
November 22nd, 2009, 09:44 pm
What's a nice simple thing to try and program first (as an absolute beginner)?

Good idea for a thread by the way Dark Bring.

M
November 23rd, 2009, 02:14 am
What's a nice simple thing to try and program first (as an absolute beginner)?

Good idea for a thread by the way Dark Bring.

There's the covenant "Hello Word" application, where all it does is print out in some way the words "Hello World".

Let's do a few finance themed applications.
You can look into timed user input, such as prompts and manipulations. So something like a tax input form.
Then some flow control using if-then-else statements. Something like a tax bracket calculator.
Then move into repetition processing (loops) such as "doing something X number of times". Preform the above two tasks over 30 entires.
Then add some advanced control combining all of the control structures you've learned. After which, I'd recommend you start learning from a book.

Mushyrulez
November 23rd, 2009, 06:34 am
Seeing how nobody did anything but mention game programming, is anyone here even thinking about programming a game? I'm currently failing at it, using Flash (I don't think anyone even mentioned this before, maybe because it's not 1337 enough?)

Dark Bring
November 23rd, 2009, 12:10 pm
Well, I don't believe everything that article mentions. <snip>I believe in using the right tools for the right task.


What's a nice simple thing to try and program first (as an absolute beginner)?If you're an absolute beginner, read Snake Wrangling for Kids (http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/).


Seeing how nobody did anything but mention game programming, is anyone here even thinking about programming a game? I'm currently failing at it, using Flash (I don't think anyone even mentioned this before, maybe because it's not 1337 enough?)Try implementing Ron Graham's Game (http://laptops.maine.edu/tictactoe.pdf) without a GUI.

Mushyrulez
November 24th, 2009, 04:27 am
GUI as in without a board?

M
November 24th, 2009, 05:22 am
Yeah. Basically, something that prints the board to console, prompts the user for a location, they type it in, the system reprints the board, and then loops. Events are slightly complex for those that don't really want to learn them correctly (and for those that that don't understand why you should use Evt.MouseUp instead of Evt.MouseDown for single clicking).

urcute08
December 3rd, 2009, 05:55 am
O.O
I'm going to enjoy I.S.T. next year... If they teach me this.

Neko Koneko
April 15th, 2010, 09:34 pm
*bump*

Working in C# here. I have a time which works by using a timespan. Every second one second is deducted from this timespan and then it's converted to a string to be displayed in a program. I need to format it cos currently it's shown as "00:30:00". I need to remove the hours (first 00).



{
TimeSpan breaktime = new TimeSpan(0, 30, 0);
TimeSpan lunchtime = new TimeSpan(0, 30, 0);

TimeSpan currentBreaktime;
TimeSpan currentLunchtime;
Timer breaktimer = new Timer();
Timer lunchtimer = new Timer();

public MainWindow()
{
currentBreaktime = breaktime;
currentLunchtime = lunchtime;
InitializeComponent();
ProgressBreak.Maximum = (int)breaktime.TotalSeconds;
ProgressLunch.Maximum = (int)lunchtime.TotalSeconds;
BreakTimeBox.Text = currentBreaktime.ToString();
LunchTimeBox.Text = currentLunchtime.ToString();

breaktimer.Interval = 1000;
breaktimer.Tick += new EventHandler(breaktimer_Tick);
lunchtimer.Interval = 1000;
lunchtimer.Tick += new EventHandler(lunchtimer_Tick);


Simply adding "mm:ss" between the brackets after ToString won't do the trick, I've tried that.

M
April 15th, 2010, 11:59 pm
From what I can tell, there isn't a time formatting unit built into the timespan function (the ToString is the simple one instead of the time one). Most likely the easiest route for you to program is it to piece the time together using the Minutes and Seconds attributes. You could use the DateTime class, but it's a headache to parse time units that are not a complete time string (that is, the complete time formatting in the exact format for your locale: dd/mm/yyyy HH:MM:SS).

I'd recommend a quick and dirty function.


string buildTime(TimeSpan a) {
string ret = ""; // Main String to work with

if ((int)(a.Minutes)/10) { ret += "0" + a.Minutes; } //ensure leading zero
else { ret += a.Minutes; }
ret += ":";
if ((int)(a.Seconds)/10) { ret += "0" + a.Seconds; } //ensure leading zero
else { ret += a.Seconds; }
return ret; //return compiled string
}

If you want to be really cute, you could extend the TimeSpan class and add this as a new method, or override the string method to perform date formatting.