The online racing simulator
Quote from filur :
The worst kind of indent is ..


if (Value)
{
if (otherValue)
{
hello();
}
}


Bah, thats the One True Method(TM) Granted, I wouldn't do it with 8 spaces, but a tab. To be honest, as long as whatever editor you're using can collapse and highlight parenthesis and brackets, then its not so much of a problem
Quote from bal00 :I'm actually using AutoHotkey (www.autohotkey.com) to do that (selectively send key presses to LFS when using the joystick buttons). Unfortunately I'm not sure which method AHK uses to send the key presses. It's free, so if you don't have a problem with running an extra executable (you can convert the scripts into standalone exes), you could let AHK handle the button presses and selectively send them to either your Insim app or LFS.

Or you could check out PPJoy (http://www.geocities.com/deonvdw/Docs/PPJoyIntro.htm). It's a virtual joystick driver than can take inputs from other apps.

I was wondering if any of you knew how I could get LFS Style mouse steer into games such as rFactor, or any game the accepct a steering wheel as input.

What I want to do is use the mouse to control the cars, and as most games don't have the LFS style mouse steer, it's been a pain in the arse to race other games ( and yes, I do have a wheel, but it's much to slow to be an effective control device. )
Quote from Dygear :I was wondering if any of you knew how I could get LFS Style mouse steer into games such as rFactor, or any game the accepct a steering wheel as input.

I'd like that too. I already tried some time ago using PPJoy app (you can map mouse to virtual joystick ), but rFactor freezed somewhere on the way from menus to racing . I gave up anyway, cause I found some old joystick...
Hey, guys, I need a C++ or Java programmer that is willing to make a replica of the Formula 1 Java Live Timming Thingy. It would be for SimFIA . . . So any one up for the job?
#30 - Shep
I hate having the leading bracket on the same line as the command, like filur's last if.

It makes no sense to me- it is harder to line up the closing brackets when dealing with bigger blocks of code.

Then again I come from a Pascal background, where the words "begin" and "end" were the brackets.
Quote from Shep :I hate having the leading bracket on the same line as the command, like filur's last if.

It makes no sense to me- it is harder to line up the closing brackets when dealing with bigger blocks of code.

Then again I come from a Pascal background, where the words "begin" and "end" were the brackets.

Yup... The only sure way to learn proper indentation is using pascal
You one of those that when you started using another language the first thing you did was try to set the colors of the IDE to something EXACTLY like the old DOS Pascal IDE? I know I am :P
Quote from Dygear :Hey, guys, I need a C++ or Java programmer that is willing to make a replica of the Formula 1 Java Live Timming Thingy. It would be for SimFIA . . . So any one up for the job?

I've been planning to make something like that for the masters of endurance. A kind of software version of the tracker website. Cant promise it will be anytime soon though, Im currently drowned with work for university, and that isnt going to change untill July, and then it is summer and I dont want to be inside programming
I like to keep things tidy:


void nkfsDec(void *data, int size) {
BYTE *k = key;
for(int i=0;i<size;i++) {
((BYTE*) data)[i] -= *k++;
if(*k == 0x00) // End of key, loop
k=key;
}
}

I find this style of indenting to be very readable, and keep the code from being too 'loose' which I find makes it harder to read. I guess thats because the first C code I ever read was indented like this (I think)...
#34 - Shep
Haha, I used Turbo Pascal for everything, so I never did anything in DOS. This was in 2000,

Turbo Pascal for Windows only bolded the reserved words, and made anything in single/double quotes blue.

I use JCreator for my Java work, and I too tried to make it look like TPW I took about a year of from Java, and when I came back I got used to their colorscheme.


When I was programming in C for a course last semester the linux box I was connecting to with PuTTY would color everything- reading red, blue and green text on a black background is hard! I had no idea how to change it.
Quote from Kegetys :I find this style of indenting to be very readable, and keep the code from being too 'loose' which I find makes it harder to read. I guess thats because the first C code I ever read was indented like this (I think)...

My style is the exact opposite of that.

void nkfsDec( void *data, int size ) {
BYTE *k = key;
for ( int i = 0; i < size; ++i ) {
((BYTE*)data)[i] -= *k++;
if ( *k == 0x00 ) {
k = key;
}
}
}

Yes, my tabs are 8 spaces wide. In my opinion making the code look loose makes it easier to read. I overuse horizontal space but I don't like to waste vertical space as much, maybe because I want to see as much code as possible without having to scroll.

So what do your IDEs look like in action? Here's my VC++: http://www.lfs-suomi.com/ikkah/vs.png

Notice the ultrawide code view and the light green background for comments.
Has anyone else here ever tried to build a website engine? It's something I've been messing about with of late. I guess it's just an extension of having a set of useful classes to automate those sorts of things you do in every site, but I'm trying to put it together with a very good extensible design.

What I'm thinking is having a very strong core engine, with all the functionality slotting in as sort of plugins. Just basically a system which allows me to work very fast and never have to write the same code twice... yeah, fat chance.

But anyway, I've got a database abstraction layer (various types of database would 'technically' be supported as plugins, but it reality it only works with MySQL), a template engine (which works really well actually, but doesn't stop me hating template engines), plus lots of different classes to automate logins and sessions and cookies and all that stuff.

Only problem is that every time I work on a new project, I start to use my engine, but find I end up having to rewrite classes at various point. Kinda defeats the purpose... but anyway...

There's really not enough information around about the theory on designing complex web applications, I guess your supposed to know all this stuff anyway, but web sites are kind of different from other programs. I find myself going more and more to traditional program design, just chucking all my HTML stuff in templates (I hate templates, they rarely achieve a decent format/code seperation) and having nothing but pure PHP in my pages....

Ah, just a bit of a off-topic web-programming rant...
Hehe, been there, done that DarkTimes. It is nigh on impossible to make code that is everything to every project for everyone... It just isn't going to happen.

The best you can do is keep it modular so that as little code has to be re-written as possible to facilitate the specific extra features any site needs. If it looks like it might be useful to another site, bung it in the repository with everything else.

That way the only bit you have to re-write (most of the time) is the 'glue' that sticks all of your random code lumps together in to some intelligible (or not sometimes) API.

As for my editor... I usually have no less than 8 or 9 gVim windows open, a couple or three Firefoxes and photoshop, and when I'm debugging CSS about 8 other versions of various browsers. Oh, and not forgetting at least one winamp
Attached images
vim.gif
I've recently been involved in designing and implementing a forum, which could be extended via plugins, to do almost anything. At the end of the day you're always going to get some hacked code that does Just Something(TM) (AKA screenshot code). However, we eventually decided on a kind of event driven system. Basically we looked at a micro kernel as a rough setup, and we ended up with a singleton "kernel" object which would allow external apps to hook into it, and pass event's. Unfortunately in most web-based languages this isn't a good choice - its a hell of a lot slower, but it does give you a lot of flexibility and produces some nice code.

Regarding templates, I totally agree. They're a total klunk most of the time, and I generally have a dislike for them, but they do allow non-techies to get stuck in a lot of the time. I've recently found clearsilver to have some very nice syntax, that most designers or Your Boss(TM), can cope with. Of course, it does tend to require that you're running the php add on, writing your webapp in C, or you've beaten me to writing mod_clearsilver for apache
Would it not be a better idea to have the kernal tell all of it's plugins what it is doing. EX (Kernal says "I want to display a post", post plugin says "Ok I'll make the HTML for you.")
Sry to barge in on this Advanced Stuff.. there's something I have been wondering: Is there any way to get MySQL 5.0x GA & PHP 5.x talking to each other without copying 'libmysql.dll' to an existing PATH directory?

I have PHP installed in 'c:\php' and that path is also in the system PATH environment variable thingy, but PHP would have none of it until I finally conceded and copied 'libmysql.dll' to '\windows\system32'.
I dislike C# and Java due to the way they are setup. I'm more of a procedural man myself. But C# and Java seem to throw that to the side. I never have taken the time to understand classes, and Java and C# live on them. That could be the main problem. I just don't have the time to learn it as of right now. It just seems wrong. I should really buckle down and attempt to learn more about classes, so that I can start using C# and Java.
Quote from Dygear :I'm installing Ubuntu while I'm typing this to you. Now your thinking "Ya so what, you have a lap top or your using a second computer, big deal". No, I'm installing Ubuntu on THIS computer, the computer I'm using to type into the input box is also going about formatting one of my hard drives. I really think this is the best thing that has happend to installing an OS. They have the LiveCD and if you like the OS you can then install it to your hard drive, while still using the LiveCD part. I've got to say, I'm really very impressed.

Yea, and saying that, as soon as I rebooted to go into the OS that I did install on to my hard drive GRUB fails with error 18. We'er going to have to format the hard drive one more time . Oh well. Rember kids, if you'r installing linux, be sure to make a /boot mount point that is less then 1024 cylinders. So I'm going to go do that now ...
Works now .
Quote from Dygear :I dislike C# and Java due to the way they are setup. I'm more of a procedural man myself. But C# and Java seem to throw that to the side. I never have taken the time to understand classes, and Java and C# live on them. That could be the main problem. I just don't have the time to learn it as of right now. It just seems wrong. I should really buckle down and attempt to learn more about classes, so that I can start using C# and Java.

I've been doing a huge amount of C# recently, it wasn't something I'd looked into too much before, but I downloaded C# Express and was pretty blown away with how quick you can develop with it. Windows Forms are just fantastic for getting your application running quickly, you can take all that time you normally spend building the GUI and concentrate on what your program actually does.

OOP programming is something I'm pretty butch with too. I think though that if you're not really using OOP fully or don't fully understand the concepts, then it doesn't really help you make better code than procedural programming does. But if you start to implement it properly and intelligently it can do wonders for your code, when you start to use inheritance, polymorphism and encapsulation correctly, it's hugely powerful. Often though badly written or only partially OOP programs can be more hassle than procedurals stuff...

Java I'm not a fan of to be honest, never got too into it. I'd recommend C# instead by a long way...

NotAnIllusion: If you're running PHP on WinXP then you can just install MySQL as a Windows service, on my Apache installation it didn't need any more configuration then just running through the MySQL install setup. I think you might need MySQL Windows Essentials installer to do that, you can find it at http://dev.mysql.com/downloads/
Quote :NotAnIllusion: If you're running PHP on WinXP then you can just install MySQL as a Windows service, on my Apache installation it didn't need any more configuration then just running through the MySQL install setup. I think you might need MySQL Windows Essentials installer to do that, you can find it at

I do have MySQL installed as a service but the problem was that PHP Not Apache) needed to be configured for it and wasn't co-operating. Couldn't be bothered to find a way to get it working the way I wanted so I copied the necessary file to my system32. I just hate doing that because then even after removing PHP there's a residual file I don't need. Yuck! Thank you though, I'm now well into developing a web GUI in PHP for the dedi server for my uni final year project
Quote from der_jackal :Well, you're not using two languages in your example. You're using the output from two languages.

C and SmallC are two different languages.
The output from two languages ... explain.
Quote from Dygear :C and SmallC are two different languages.
The output from two languages ... explain.

In your resulting program, you're not actually using the language, but the compiled code that was generated by each language compiler (usually as DLLs, in some sort of "machine language"). These can interoperate.
I thought I'd updated this...clearly not.

In the case of using PHP and GTK there are exported functions and wrappers around these functions - which allow the two languages to communicate. These are usually called bindings. You can get GTK bindings for python and php for example, which allow you to use the GTK widget set within either of those languages to create desktop applications. It usually means writing an addon module for your chosen higher level language, such as Python, PHP, to interact with the lower level one.

Using SmallC, or VB, or C# with C is a case of exporting the functions in a standard way from a DLL or SO file, which the languages then recognise, and import. To put it rather simply.

In the case of using something like Javascript or Lua in your own applications, you embed the interpreter engine into your code. This engine will then convert the script into the equivilent "C" at runtime. Using this embedding method you can also define your own functions which can allow you to extend the native libraries of that language.

Clear as mud?
Quote from Dygear :Works now .

Lilo doesn't have this limitation.
I am going to dig up this thread... What I hate in programming is other programmers. They are all younger and more capable than me. I really love technical things and wish I had enough knowledge in programming to make something usefull, but I must be a really slow learner, and I am not academic. I barely finished my college course, and I didn't finish the last one. I envy you all!

At the moment I am trying to dig in to programming theory with Ruby. I find it[Ruby] very easy to remember. I looked at my old GCSE maths revision books yesterday and boy am I clueless, I gotta try and refresh my memory.

As for indentation, I've settled on tabs so anybody can set their editor to space them as they like. I set mine up for 2 spaces

The Off Topic Programming Thread!
(309 posts, started )
FGED GREDG RDFGDR GSFDG