“This production note bores me”

I hope the coders on Vanguard are more awake than their producers (emphasis mine), from their Update 4 production notes:

We Have Helms!
Visible helmets are making their long awaited debut, and thanks to the hard work of our amazing art team, you’ll have dozens of different models available. From the (actual names of helms will go here along with photos) – there’s a variety of helmets that will compliment almost any armor set. “

So, confession: today I decided to buy Vanguard Saga of Heroes from Direct2Drive – if this box can’t play it, nothing can.

I don’t know that I’m going to get time to play another game right now, but after a couple of weeks I was utterly burned out on Ruins of Kunark. The solo content was excellent fun but there was just nothing to segue you into group play.

I considered buying Guitar Hero 3 or Mass Effect, but I don’t want anything I think I might get hooked on.

My plan is to approach VSoH like a complete gamer. I’ve read nothing online. The only class I remember from beta is the bard, which I somehow didn’t like. I’ve read no lore, and I don’t plan to read any websites or guides. If the game doesn’t tell me, I won’t know.

I’m also dabbling with the notion of redoing playgate – our patcher, as an at home hobby project – probably not a project that will go anywhere since it means re-re-learning some basic Windows programming stuff but … at the very least I might have a better idea how to build a more future-proofed patcher/launcher than the one we have (which struggles with Vista). And unlike the client guys, I can make the host side work the way I want it without having to badger someone else ;)

Any recommendations on Windows programming materials welcome – as much as my curiosity leans towards learning C#, this isn’t the right project for it. I just got done converting all the strcpys and snprintfs and fopens to 2008 strcpy_ses, sprintf_ses and fopen_ses.

I dislike Microsoft’s decision to go to “pass me the address of the place you want me to store this value so I can pass you a success/failure return value”.

FILE* fp = fopen(“file”, “r”);
if ( fp == NULL )
  failed;

becomes

FILE* fp = NULL;
if ( fopen_s(&fp, “file”, “r”) != 0 || fp == NULL )
  failed;

I can understand the separating the return value from the return result but by requiring me to pass in the pointer you create another opportunity for error and force me to do an extra test – it is, after all – bad coding practice to assume pointers aren’t NULL.

24 Comments

C# and the .Net Platform by Andrew Troelsen, you can probably get it from amazon over there. It’s a top resource, I’ve got 1st edition, I think it’s on 4th now.

So, going back to a statement I once told you Oli, I said that I once wanted to be a programmer. You replied, “So did I”.

I still want to, but haven’t done any kind of programming since I was in jr. high (assembler, pascal, basic).

This is aimed at all programmers who read this–>

Where should I start? Should I take a class? Read a book? I want to learn databases, networking, gui stuff in windows.

Any night courses you can do, to get you up to speed where you live? What are you like at self taught stuff?

C# 2008 Express, good start
http://www.microsoft.com/express/vcsharp/

If you want to do databases then I would recommend getting a cheap website with a mySQL database.

Although running before you can walk always trips a lot of people.

The book above that I posted is quite heavy duty. You might find some of the C# Cookbooks a little more easier to follow, they’re set pieces of code you can cut and paste or copy out of the book, they do specific tasks.

^ I’ve been thinking about that… I started out by learning php -> c -> java -> c (yes, again) -> c++ -> c# and now with c# .Net I feel like I’m going insane because I don’t really have any control over the code in the same way I’ve had before.

I’d like to say that you should go with at least java first, but I keep running in to people out at company’s that doesn’t know much more than c# and still make lots of money.

I’m still studying at the university so I’m just taking classes in whatever I feel like learning, but I guess night courses are pretty good too. it’s at least some kind of blowtorch to keep you learning at an even pace.

oh, and google is you friend. got through a game programming class in c++ (without knowing c++) without any books, thanks to google.

Hum
Question (curios): can fp actually be NULL if the call returns with a errno==0?

Don’t know much about VS so far (plan is to change it). But i think this decision is not bad. It just looks like the SUCCEEDED/FAILED macro in ATL/COM subsystem now: S_OK, S_FALSE and more important E_something telling you the reason (and the severity) of the error that occured.

It’s ok to put the rest of the libraries into the same “shape of calling” i believe. Personally i always disliked the GetLastError() idea. I want to know it when it happens, not somehting like: “Huh? Something went wrong! You have to determine, what exactly, in a separate question – if it is still there.”

Sorry… no books since Petzold ( 3.1 :), but there must be some Petzolds for 32s available). Just MSDN and Google (and Borland’s VCL-Source).

@Easting: If you are familiar with Pascal I encourage you to give Delphi a chance. Easy to learn, easy to use, fast… and no limits. And nothing is hidden. One can trace the complete VCL subsystem, which is written in “Delphi” as well and handles all the “messages”, “SDK-calls” and stuff like that. Nice to get into it. The more modern Delphies support .NET as well (since D8, i believe). There are tons of books about “writing components”.

Easting: Find something you really want to create – the problem with picking up coding is that your ease of adoption is generally relative to your level of interest in what you create. If you go to some night class and they teach you how to write a spreadsheet for recording the lecturer’s stamp collection, and you’re not into stamps… You may not really learn a great deal.

It could be anything – a little C/C++/C#/JavaScript app which does something you’d find neat, cool or handy.

You can download Visual Basic Express for free from Microsoft’s site. If you just want to learn to program for your own whims, VB isn’t a bad language. If you want to learn to program to be a programmer, erh, Delphi or Visual C# or Visual C++, and avoid VB like the plague :)

Los: Is it safe to assume that a 3rd party library, even an operating system library, will do the right thing? I’m just very sceptical of any “safety” improvement which involves passing a pointer to a pointer … and especially any coding practice that doesn’t encourage you to check pointers for NULL :)

This is a path that Microsoft had previously taken, and then realized was a bad idea and moved away from. It seems that enough time has passed for their coding teams to forget what a mess was caused by introducing this concept the first time around. (See “Writing Solid Code”). Maybe in Windows 9 they’ll reintroduce hungarian notation :)

I want to make a weather system tool that will take real world weather data, lay it into a precipitation type/intensity grid system, a wind velocity/altitude/directional grid system, and a temperature/altitude grid system. It will use realtime NOAA data feeds.

Example, http://radar.weather.gov/ridge/Conus/RadarImg/

Take X radar image from above, lay it over the map, pull it into my favorite WW2 game and make it rain where it’s raining.

I know, pipe dream….but that’s what I want to do.

Who the hell wants a ‘visible helmet’ when ‘invisible helmet’ is an option?

No kidding!

Hm. What makes you sure that the former fopen returns a NULL for sure, if it failed? You can test the pointer all day long, if the corefunction is buggy. So there has been “no guarantee” as well, and everybody just used it that way. So we all “trusted” it somehow.
I’m sure we will trust the new one as well after a while.

Therefore there is not much difference now, besides that it has the form of

mylocalvar localstore; // <-write me something here
someerrorstates errorstate = call (&localstore,….);
switch (errorstate)

This form seems to spread through the new corefunctions as well. So i don’t quite understand your last passage. I am sorry :) May be an example would help?

However: it’s my memory the system drops it’s result. Personally i prefer it that way. May be that is because the ATLtemplates i use in the COM stuff do it like that since i know them.

That’s not too bad for me. I like it.

Hungarian notation:
The SDK still uses something like that notation in it’s prototypes, doesn’t it?

HANDLE WINAPI FindFirstFile(
__in LPCTSTR lpFileName,
__out LPWIN32_FIND_DATA lpFindFileData
);

Or do you mean something different? Ok, the lpsz has turned into LPCTSTR, which is either a LPCSTR or a LPCWSTR, but it means still the same some #defines later and allows more flexibility (unicode).

Find a project to start with:
Well, that’s true. But it actually can be frustrating, if it can’t be done or you have to learn much more in order to do it, which you don’t know about yet.
Another approach is: Play with it. Place a button, click on it, change the color of the Window. That’s a great success – i’ve been happy :D – and this fast access is very impressive with some IDEs, like VB (had limitations once, now seem to be gone with VB.NET*) and Delphi (never had any) and, as i believe, C#.NET or BCB, and is not as easy with some other (VS 6 :D) . With a little Turbo Pascal knowledge i’ve been able to write a complete (primitive) Texteditor for Windows 3.1 in one evening using Delphi 1.0. That was amazing. Then it started: What if i want *that* line to be red? So the projects will grow with time, and you’ll learn on that way. Today there are trials of nearly everything.

Vote for a preview function!

*) http://en.wikipedia.org/wiki/Anders_Hejlsberg

@BLOO – sometimes you don’t want the girl to know…

…and sometimes you do. :D

Think about your own point, Los.

Old fopen: “if (fail) return NULL;”
New fopen_s: “if (fail) { *fp = NULL; return error; }” – more precision required by the library maintainers: more potential points of failure.

Now, it is possible that someone could write an fopen function that had a “return something-other-than-null” in an error condition, or an error condition they don’t detect that allows it to go ahead and return a file handle.

But at that point its just as probable that the new fopen_s might return one thing and populate fp with another.

To me, this new fopen_s presents more margin for mistakes and requires extra diligence rather than making fopen_s more secure. I get that separating status and data can be a good thing, I’m not convinced that introducing more pointer exchanges is the way. That’s why C++ has exceptions.

Hungarian notation left in the SDK is legacy and is left open to individual designers, although the internal MS guide favors against it.

You should never assume that a function returns “OK, go ahead” AND proper values, its just bad coding practice – thus while fopen_s is probably nice and safe and secure, if you start making that assumption, you will introduce new bugs.

“Your library said SUCCESS, but this pointer was NULL” gets “and you didn’t test for NULL?”

OK, since it’s been 20 years since I did any kind of coding I’m going to take a summer class at the local community college. The course description is as follows:

Beginning Programming: Designed for Computer Science majors, this course affords students a basic understanding of computer programming. Students will utilize accepted programming concepts and perform number system conversions and arithmetic. In addition, they will design and code structured modular programs using design tools such as hierarchy charts, flowcharts, and pseudocode.

This should get me back in the saddle for something in the fall semester. I appreciate the advice guys, sincerely.

Unfortunately i don’t have access to that internal guide. So i just believe you.

No. Wait. Don’t trust anyone :)

But however, i did agree that one should never believe anything. But that function has the same erh… complexety on the maintainer side. Still two ops, but piled together to one formal call. Same precision required. In the first example for old fopen the global Errorcode is not set. Ok, you can say, the error should do it itself in (fail). But then you have to believe something again, and there is a risk an elder errorcode would be overwritten in both cases.

Old fopen:

if (fail)
{
// store something approbiate to be acc.
// by GetLastError();
global errno = error;
return NULL;
}
New fopen_s:


if (fail)
{
*fp = NULL;
return error; // something approbiate
}

So it just switched places imho. But you can do more checks as libmaintainer, if you want to. Example: What if *fp!=NULL is passed? You would be able to identify a “used” handle, don’t know, if they do it, though.

On the user side it would look like:
FILE* fp;
switch (fopen_s(&fp, …))
case 0: if (fp) {do smth nice;}else{FOUND LIB BUG};
case errx: throw (“How dare you?”)
case erry: try again later;
Not too bad for me. It looks better than before as far as i am concerned. Well, that actually doesn’t mean much :)

Personally the best advice is to pick a project that you like and want to do.

If you are only interested in casual programming and not programming for a living, the newer languages are easier to learn and are more web friendly.

To me C and C++ are great for what they do. For me Perl, PHP, Java and Ruby have been enough.

My squads website is my playground for all of my web development playing. The main page pulls data out of the forums and some squad stats that I’ve collected, plus my fumbling around with CSS.

Take the class to get re-acquainted with logic constructs. It’s these methods that you will use in every language

Ruby seems to be an up and coming language. I’ve looked at it but I really didn’t have a reason to play with it so … water off a ducks back. I’m averse to learning anything I don’t have a good reason to learn.

I’m giving it a try, it’s impressed me. Impressed me enough to try automating some task at work with it.

Some of the draw backs of PHP, Ruby really nicely overcomes. Perl has never been windows friendly, Ruby is.

I’ve not done Java desktop like work, but ruby was simple. I’ve done a few scripts that run a query, dumps the results in Excel, then sends the file out by e-mail.

Another task that used to take me 20 minutes to perform now takes 1. I’m up to a plus 30 hours in time savings after 1 month.

The only draw back now for me with ruby is that it doesn’t compile. I could then offload my work to someone else.

I’m not an evangelist, but Ruby has been very easy to pick up and work with. I don’t have to worry about the pointer. Just check so see if they are nil.

Here is a quick example of the squad captures feed.

require ‘net/http’
require ‘xmlsimple’

url = ‘http://web3.wwiionline.com/xmlquery/captures.xml?hours=2’
xml_data = Net::HTTP.get_response(URI.parse(url)).body

data = XmlSimple.xml_in(xml_data)

data[‘cap’].each do |captures|

p captures[‘by’]+”,”+captures[‘squad’]

end

In regards to teaching oneself a language for a particular project:

Say I had some bloody large text files with entries that have people’s names and addresses, what’d be the best way to delete all the entries from particular states and any duplicates that existed?

Probably a number of already existing solutions to this but I’m just to lazy to look ’em up.

if it were in a table of some sort it would be much easier to manipulate…….maybe import it to excel or access as comma deliniated or something like that. Then you can filter/sort/compare and such…

Just meh unedumacated thought…

Define large, are they easily delimited, something that Identifies the different fields?

All of the languages are capable of doing that, some are easier than others.

Perl is probably the strongest for text manipulation, but file i/o on windows is different than on *nix. PHP and ruby do a good job and manipulating text using regular expressions just as good as perl.

My java is limited, I’ve never had the need for this using Java. I’m sure it can do it as well.

I can do it with Excel, though it requires me splitting them into 8 different files and doing a lot of manual work. Was just interested as a sideproject doing it with code.

That’s the attitude. Why do the manual method when you have an opportunity to write a program to do it.

Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: