You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!

Author Search Results: 'CronoMan'

We found 2,987 matches.


<< < > >>

Viewing 1-30 of 2,987 matches. 1 | 2 | 3 | 4 | 5 | 6 | 753100

1.

None

Topic: Magic Numbers... Again

Posted: 12/03/09 03:43 AM

Forum: Programming

At 12/3/09 12:24 AM, Peaceblossom wrote: So, basically past ranting, to promote some discussion, do you think small numbers (0, 1, 2) should be represented by variables holding constants?

The point of using constants instead of magic number, is to help you later in development, for instance if you need to change a "magic number" later, to test different scenarios or whatever. Numbers that simply won't change because if they do, the program will not function as intended, don't need to be constants; like for instance the incremental number of a for-loop
It's not always bad to use magic numbers in an application; it depends on the context
Using a constant in a for-loop will only worsen the readability of the application, for instance; in order to understand what a for-loop does, you'll need to know the contents of a constant - that's bad coding

There are two benefits of using constants instead of magic numbers;
1 : you can change the value of a single constant, instead of doing a search & replace all over
2 : it's a way of identifying what the number represents, so you don't need to scratch your head
If none of these two points are viable for a number (because it will never change and the number is plainly obvious) there is no reason to put it in a constant.

Some people have a tendency to get locked up in certain things they have been told, like when I went to college, I got subtracted a grade on an assignment, because I used frames in a html document. Why? Because the teacher for some reason had banned frames, so you can't even use frames when it's appropriate. Same thing goes for GOTO's, even though in most cases it's bad coding to use labels, in other cases labels are appropriate. For instance, if you catch an exception inside a function because the connection to the SQL database got lost for a moment, it might be appropriate to go to a specific line inside the function to do just a part of it over again, without losing context. Then labels are appropriate.
Being a constant-nazi is no way of magically improving the coding style of an application, it has to be used in the right way, and used correctly in the appropriate context

Although, in most cases, putting the number in a constant will be the appropriate action :P


2.

None

Topic: Vb.net Browser Help With Boolean

Posted: 12/02/09 05:50 AM

Forum: Programming

At 12/1/09 05:24 PM, Bryden1122 wrote: Hey I'm new here somone recommended me to post here.
This is a post from another forum:

Hey everyone I am making a Browser in VB 2008 and I am making it so that a form pops up on start-up. There is a check-box on the form that when it is checked that shouldn't show again.
So I am using Boolean for one of the first times in my life and this is what I have:

On the Thing that pops up:
If CheckBox1.Checked = True Then
My.Settings.Start = True
End If
If CheckBox1.Checked = False Then
My.Settings.Start = false
End If
My.Settings.Save()

Change this to

My.Settings.Start = CheckBox1.Checked
My.Settings.Save()
On the Browser loading:

If My.Settings.Start = False Then
Settingchange.Show()
End If

If's evaluate boolean expressions, = false is unecessary as it will "translate" into if (My.Settings.Start = False) = True Then..., use the NOT operator instead; If Not My.Settings.Start Then ..
The NOT operator is simpler, because it will only invert the value, not do any comparisons

[hr]
My.Settings.Start is the Boolean setting.
So am I doing it right or do I have to use -1 and 0 instead of True and false. Or do I have to do it any other way?

-1 and 0 were VB6 and earlier, boolean is not an integer datatype in .NET (well, technically it is, but they are abstracted)

Boolean datatypes are either True or False, they are never a number
0 is not the same as False, and -1 is not the same as True

Speaking of True, False, -1 and 0;
The reason why True was -1 and False was 0 in earlier versions of Basic, is so that they can use a single operator for both bitwise and logical expressions. The bitpattern for -1 will be 111111111111 and zerp will obviously be 000000000, so doing operations on these types of data, it doesn't matter if your doing logical or bitwise operations, because they will both yield the same result, so therefore there are only bitwise "logical" operators in VB6 and earlier


3.

None

Topic: DirectDraw fail

Posted: 12/01/09 03:02 AM

Forum: Programming

At 11/30/09 09:27 PM, imdead597 wrote: Thats basically what memset(dest_ptr,0,win_width) is supposed to do but it fails at it.

You are probably miscalculating the size of the segment

Still; isn't there a function in ddraw for surfaces that is called clear(color) ?


4.

None

Topic: Java: Object Orientated

Posted: 11/30/09 04:39 AM

Forum: Programming

At 11/28/09 02:34 PM, Sun-and-Moon wrote: Umm I think when you instantiate a new object from a class they all have the same properties based on how you defined that class. However, you can add/remove properties of an instantiated object from the class after it has been created. Not 100% sure though

A class has a specified set of properties of method, which can be extended using inheritance
A class can only extend one superclass, but can implement any number of interfaces (which in themselves do not contain code, only definitions of functions that a class is guaranteed to contain)
But not during runtime


5.

None

Topic: DirectDraw fail

Posted: 11/30/09 04:23 AM

Forum: Programming

At 11/29/09 02:06 PM, imdead597 wrote: I know DirectDraw is deprecated, but I'm learning from Tricks of the Windows Gaming Programming Gurus so it can't be helped. For some reason, whenever I try to clear the back buffer, C++ tells me that I can't write to this memory.

That is because you can't write directly to that memory
In order to directly access it, you need to use surface->LockBits or whatever it is called
DirectDraw resides in sepearate memoryspace, so if you try to do anything with any of the pointers ddraw uses internally, you'll get a message like illegal operation, or the memory cannot be "written" etc
Just fill a black rectangle over the screen instead (which will also be faster, since ddraw is hardware-accelerated)


6.

None

Topic: [C] Help

Posted: 11/30/09 04:17 AM

Forum: Programming

At 11/29/09 11:38 PM, dburford11 wrote: Can someone point me to a tutorial for calling .dll's from C (not C++)

i've tried google, but it always just comes up C++

Why are you using C ?

Anyways; http://msdn.microsoft.com/en-us/library/
ms684175
(VS.85).aspx
If you include windows.h it should also work with C


7.

None

Topic: Midi/Mid Music Files

Posted: 11/27/09 10:37 AM

Forum: Programming

At 11/27/09 08:45 AM, Mariosy wrote: Take tis Midi converter to convert to wav or mp3

This thread is five years old


8.

None

Topic: Assembler tutorial

Posted: 11/24/09 04:08 AM

Forum: Programming

At 11/23/09 09:36 AM, Chubays wrote: Please can you advise me some good assembler tutorial?

x86? x64? 8088? arm? atmel? ppc?
masm? nasm? mbasm?


9.

None

Topic: Good programmer = Bad mathematician

Posted: 11/13/09 05:02 AM

Forum: Programming

I think programming requires a different method of abstract thought


10.

None

Topic: Visual Basic Database Help

Posted: 11/11/09 03:53 AM

Forum: Programming

At 11/10/09 03:56 PM, SilvaWolf wrote: Can anyone help?

RecordSet?

Are you using VB6 or VB.NET?


12.

None

Topic: Coding for instant e-mail in blog

Posted: 11/05/09 06:28 AM

Forum: Programming

That script uses an email client (mailto:)
You need to do this with serverside scripting and an smtp-server


13.

None

Topic: Installed Linux, want to program.

Posted: 10/30/09 11:09 AM

Forum: Programming

At 10/30/09 10:58 AM, UnknownFear wrote:
At 10/30/09 10:41 AM, DeviantSpaceMan wrote: So in what ways is Ubuntu or any Linux operating system better for programming?
Not sure as I haven't programmed in Ubuntu, but to me it has that "programmy" environment to it. For instance, I love using the Terminal and running things with it.

Heh..

In my opinion, Linux isn't in any way or form better for programming; windows has a much wider range of available development tools, a much bigger library and an infinitely larger userbase
On Linux, you are more or less forced to either use C/C++ or Java, unless you want to go for one of those icky scripting languages


14.

None

Topic: Macintosh and python

Posted: 10/30/09 06:36 AM

Forum: Programming

At 10/29/09 04:27 PM, DanielZ wrote: And for the record, I don't use a Mac because I want to be limited or because of the looks. I use it because it does what I need it to, and the UI works rather well. I don't feel limited in any way on my Mac.

I love mac, how it looks so sleek and how it almost cost me a month salary. I especially enjoy when I minimize and restore applications, it just looks so damn cool, with minimal impact on annoyance.
I switched to mac because all the cool people use mac, and I've been told by them that there are alot of handy applications that don't come in PC version, that I absolutely must have. At first, I was irritated because none of my regular applications worked, like visual studio, sql server, strip poker plus, textpad and lots of others, but then I realised I could just stop using them. After all, it was M$ that had brainwashed me into believing that those applications were any good. Now, I can use python and PostgreSql instead, and I can play strip poker on web. It's basically almost exactly the same thing.
At first, I was very uncomfortable with all the brilliant design elements, because it obviusly makes me feel more comfortable, and therefore more productive.
People get way too hung up in words like "limitations", "unsupported hardware" and "useless sparkling distractions", but that's just jealousy because they simply can't afford one themselves! And besides, there is at least five applications that are not supported by windows, but only by mac. And mac also has hundreds of programmers worldwide! If it's not supported yet, it will be within the next decade or so. I can see tons of reasons why everybody should stop supporting M$ and instead start using macs; you get exclusive access to Apple-branded hardware that will allow you to spend more money on basically the same thing, thus supporting the development of this fine operating system!
And it basically supports almost all the same things windows does, with only a couple of hundred thousand exceptions - and face it, you don't need those applications and hardware anyway, it's just a gimmick from goddamned moneygrabbing M$. Also, Mac has a much more intelligent way of IPC communication than windows; use TCP! You think that TCP was invented for network? Think again! It works just as well for communicating with the windowing system as it does for network. I'm frankly glad I don't have to use the M$ GetProcAddress again to communicate with programs and libraries residing outside of my applications domain. Come on, why make something that directly addresses a problem, if you can find a workaround that will require less technical planning?
Also, Apple has some great products, like the iPod and the iPhone, which some ignorant people criticize for being "technically inferior" and "apple-bound", but this is just lies. Well, I suppose that iPod and iPhone are only accessible by iTunes, and that they mostly only support macintosh formats, and that iTunes specifically downloads songs for iPod and iPhone, preventing them from being played on what people claim are superior products, like say Creative Zen (although just people say this because they are pumped full of propaganda) because the Zen let's you convert your movies and play them on it by using a completely free application that is bundled on the CD, and that it supports more common video formats, like DivX, XviD and the container format avi and asf, but that is just stupid. I, as a mac-owner, can guarantee you, that if you have a mac, and you have an iPod or iPhone, you won't have any problems! Only people stupid enough to pick Windows or Linux are having this ridicolous problem. If you want to use iPod and iPhone, install iTunes and stop being such a baby!

It's not a flamewar until someone starts flaming

15.

None

Topic: Macintosh and python

Posted: 10/29/09 10:25 AM

Forum: Programming

I have now switched from windows and C# to macintosh and python.
I figured that if you needed an operating system that only gives you the minimum of what you need, mac os would be your first choice choice.
There were some times I got pissed at windows, because when I needed to alter the hosts file for debugging purposes, I had to click "start->run" and if I were lucky enough to remember, type "notepad c:\windows\system32\drivers\etc\hosts"
Of course, on mac os you can't do this, without consulting the Great Oracle (Tools->Terminal sudo /Applications/TextEdit.app/Contents/MacO S/TextEdit /etc/hosts, which should be quite obvious), and bluntly put, that's the way it should be. And of course, by purchasing Macbook Pro, I could spend 4 times the amount on basically the same thing I would've got if I purchase a PC with better specs. "Why is this so great?" you may ask, well, it gives me a good basis to brag, and pretending to be better than everyone else. Which is something I now enjoy on a daily basis.
It also looks very nice, and that's a giant plus for anyone that wants to get shit done. The thing about macintosh, is that it supports almost everything windows support, which would be the final nail in the coffin for M$. There are also products available that Apple Mac OS integrates perfectly with, like the Apple iPod and the Apple iPhone. iTunes plays nearly all of the formats I need it to, and so does QuickTime. And you can get fullscreen-support in QuickTime just by paying a small, one-time fee of a merely $40. I mean, what's to discuss here?
What used to annoy me on Windows, was that the only choice you were left with among browsers when you first installed windows, was IE. No wonder why M$ got sued by EU! Mac, on the other hand, you get Safari instead, which is quite obviously a more attractive browser.
Also, now I have access to macintosh-only applications in the ten-fold! Like archicad and.. at least a dozen more.

Now, I've switched from C# to python as a programming platform. The reason behind this is that 1: C# is not available for Mac OS and 2 : C# is bloated.
All these years I have been brainwashed by the majority and M$ that object orientation is in most cases a superior architecture compared to procedural programming. There are many reasons that this is not true; 1 : In a procedural language, the execution is linear; ie you will always know where the next step of the code is. 2 : procedural languages tend to take you off the architecture, and let you worry about the code instead. I also am no longer chained down by bloated software like Visual Studio and the .NET framework.
Also, there are certain finesses in python that makes it a brilliant tool for any application; it has a vast library available to me, the code needs no compilation, and all the tools are completely free.
People have come to me, and asked me how I could do this, and not recognize that C# is a proper programming language, and python is a scripting language best suited for small segments of code and how python does not address the need of a proper structure in order to create large scale applications or the fact that python shitload slower than C# in any measurement nor does it give any proper angle to optimize the code itself; and I can see how they would think that, but this is just simply not true. I mean, if you live in the middle ages, you would need performance, because the computers of that age sucked ass compared to the hyper-computers we have today. I mean, in all cases in human history, the popularity of a product is always inverse in relation to how awesome it is, right? The C syntax and structure is reserved for dinosaurs; the fortran-pascal-basic-ish structure of python is the language of tomorrow! Who needs curly brackets when you can use tab, right?


16.

None

Topic: C++ fastest way to read iostream?

Posted: 10/29/09 09:40 AM

Forum: Programming

My advice would be to read the entire file into memory, and then parse from there.
I believe it should be plausible to get the time down to under a second
If you read the entire file, you make the hardware work in your favor. After all, the harddrive + our friend the DMA controller, can deliver 50MB per second, and your file is 800k?
Going through a linear char array of 800 000 elements should be fairly straightforward

At least in my spectacularly brilliant mind

17.

None

Topic: c++ conversion trouble

Posted: 10/29/09 09:22 AM

Forum: Programming

At 10/28/09 10:28 PM, Glaiel-Gamer wrote: still doesnt make sense to me that you're casting a pointer type (char*) to an integer type (long)

A pointer is actually an integer, doesn't matter what type it points to. It could be double * and it would still be an integer ;)

SendMessage's two parameters, wParam and lParam are used for several things. They have chosen to use long, so that you can basically send any datatype that is less than 64bit. In this case, you cast a pointer to long, because the parameters are of long datatype, but in the other end (the receiving window) it will be cast back from long to wchar_t * or whatever datatype it uses.
C++ doesn't matter what is actually stored in the parameter, there is no bounds checking and no safe types. Therefore, you could for instance cast a double to long, and as long as the receiving application is aware that there should be a floating point there all will be well
Since C++ does not support run-time generics (C++ templates are compile-time) there is no proper way of sending different datatypes in the same function without using function overloading, which would require both ends to implement the same function on different datatypes, which basically is a waste of time for both the programmers and the application

And that's why you have to typecast! :P


18.

None

Topic: c++ conversion trouble

Posted: 10/28/09 07:32 AM

Forum: Programming

At 10/27/09 10:59 PM, Glaiel-Gamer wrote: why are you casting the string (a char* ) to a long?

Because SendMessage takes two long parameters, wParam and lParam

Try using a unicode string (wchar_t, and std:wstring)


19.

None

Topic: Netbeans Help - Java Program

Posted: 10/27/09 04:30 AM

Forum: Programming

At 10/26/09 06:15 PM, UnknownFear wrote: Can anyone give me some help with this? Please?

System.in.readln()


20.

None

Topic: Need help with javascript...

Posted: 10/26/09 07:14 AM

Forum: Programming

if you need to execute javascript that resides within another IFrame, I think you'll have to use the eval function.. window.frames["fsda"].eval("alert(Return Cookie());")

Although, I could be wrong. Ask google :P


21.

None

Topic: Sorting Algorithm

Posted: 10/23/09 05:52 AM

Forum: Programming

I'm making a game called fnelda
and by using bubblesort, I needed 18 000 sprites in the same view simultaneously before the framerate dropped below 60fps (where each sprite got sorted by y, so I could draw them in the right order)
And I'm betting you probably don't have that amount of movieclips in your scene
Of course, that's in a completely different language, and the performance is probably a shitload better than AS, but the point is that you probably won't need more than bubblesort. Implementing quicksort, bitsort etc is quite a hassle compared to bubblesort, as you'll need to write binary trees and whatnot and you'll have less time to spend focusing on the content itself

But obviously, this is up to you :P It's fun to write new algorithms anyway, and you'll learn new approaches to common problems


22.

None

Topic: Proper Way To Link Folders Html

Posted: 10/21/09 09:05 AM

Forum: Programming

At 10/21/09 08:26 AM, DeviantSpaceMan wrote: Well guys I've got a pretty solid idea on how to use HTML and CSS. I'm going to learn javascript now, but for future reference when it comes to it which is the preferred language between ASP and PHP?

Depends on who you ask :P
I've completely stopped using PHP after I started with ASP.NET, but the majority of the population on this forum use PHP


23.

None

Topic: Proper Way To Link Folders Html

Posted: 10/20/09 06:22 AM

Forum: Programming

At 10/20/09 05:36 AM, DeviantSpaceMan wrote: Thanks Cronoman this fixed the problem straight away. But, should I always use forward slashes, or only use them when I have to go back a folder?

On the internet, always use forward slashes. Backslashes are only used on Windows and OS/2, which explains why they only work in IE :P


24.

None

Topic: . zip files/compression down side?

Posted: 10/20/09 05:05 AM

Forum: Programming

And it will take a longer time to decompress


25.

None

Topic: Proper Way To Link Folders Html

Posted: 10/20/09 03:11 AM

Forum: Programming

At 10/19/09 04:29 PM, Relish wrote: The single quotes around the URL are unecessary.

They are necessary if there are spaces in the filename


26.

None

Topic: Need a Programmer, please :D

Posted: 10/19/09 10:06 AM

Forum: Programming

Flash forum


27.

None

Topic: Proper Way To Link Folders Html

Posted: 10/19/09 06:57 AM

Forum: Programming

Use forward slashes instead of backslash

background-image: url('..\Pictures\SpaceMan.gif')
instead, write
background-image: url('../Pictures/SpaceMan.gif')
Spaceman, I always wanted you to go, into space man

28.

None

Topic: Css Style Sheets Affect Headers?

Posted: 10/19/09 05:31 AM

Forum: Programming

I'd suggest you should change the H's to match the design of the website
Making classes and defining special elements in special area's for the H's is unnecessary. You could just as well use

<span class="fdsa">fdsa</span>

instead of using the H's, if some special rule applies. If you also have a wysiwyg-editor for your site, it's a pain in the ass to apply specific classes for specific columns or whatever. The more generic the CSS file is, the better - so you won't have a billion lines of CSS to maintain. H's are headers for text, they should look the same across the page


29.

None

Topic: mysql

Posted: 10/07/09 10:21 AM

Forum: Programming

strings (varchar, nchar, nvarchar, text etc) must be enclosed in single-quotes in sql


30.

None

Topic: Database Theory: Item ownership?

Posted: 10/05/09 05:59 AM

Forum: Programming

At 10/5/09 05:49 AM, citricsquid wrote: The method I've been using whenever I've needed to do this before is to have a new table called "favourites", in this table there is a user ID column and an item ID column, when a user favourites an item it adds like so:

This is a standard many-to-many relation, and you do not need to worry about the performance, just make sure you index the fields; make both fields primary keys in the favorite table

you can find the item if you know the user id;
select * from item inner join favorite on favorite.itemid = item.itemid where favorite.userid = @userid
Should not cause you any performance issues, even with millions of rows

So you're doing it right ;)


All times are Eastern Standard Time (GMT -5) | Current Time: 01:42 PM

<< < > >>

Viewing 1-30 of 2,987 matches. 1 | 2 | 3 | 4 | 5 | 6 | 753100