New article up! This time it’s on SQL Server high performance inserts.
Keep in mind, designing your SQL database for rapid inserts is just one type of optimization. There’s lots more, amply demonstrated by the Slashdot article today regarding CouchDB and MySQL. You can continuously become dissatisfied with your database, make adjustments, replace it, and keep going.
Good database design is a continuous process. You must always be looking at what limits your performance, and adjust it to finesse the details.
Java SpringSource is a pretty decent substitute for the Visual Studio and C# I’ve used over the years. I’m still not a huge fan of Eclipse, but when you write high level abstracted MVC-style websites, the end result is pretty solid.
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model)
{
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG,
DateFormat.LONG, locale);
// Get the list of artists from the data layer
SpenceDao sd = (SpenceDao)_ac.getBean("SpenceDao");
model.addAttribute("artists", sd.ListArtists());
// Produce date and title
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate);
model.addAttribute("pagetitle", "The Spence Collection");
// This is for the "home" template
return "home";
}My article for #AltDevBlog this week is about SQL Server performance tuning. Although not every gaming company uses SQL Server for its back end datastore, there are lots of good reasons to use it, and lots of good ways to tune your queries.
http://www.altdevblogaday.com/2012/05/02/sql-server-performance-part-1/
So I installed a CentOS 6.2 server in my closet to store my media files. However, I’d really like to be able to connect to the desktop and play around with the latest Linux UI - so I tried setting up VNC.
Big mistake! VNC is very tricky to set up, and Google has lots of misleading results. Using the first few searches, I was recommended x11vnc, LTSP, K12Linux, and bunches of other things. All of those were tricky and nearly-but not quite-what I wanted.
Turns out the real link I wanted was this: Install VNC Server on CentOS 6. Once I found this page, I got everything set up in five minutes.
I recently built a headless CentOS 6.2 computer to shut up in my closet. While I worried about the hard drives’ temperature, I decided to figure out a way to do a quick check using SSH.
Here’s a shell command that iterates through all hard drives in the system and displays only the temperature readings from their SMART data feeds.
for f in /dev/sd? ; do echo `smartctl -A $f | grep Temp` ; done
Why does this command work? The Linux Shell command “For ($var) in (list); (command); done” iterates (command) once for each thing in the list. On each iteration, it sets $var to one of the values from the list.
In this case, we’re using a file filter - /dev/sd? - which produces all files in the folder /dev/ that match the pattern “sd?”. The question mark matches any single character, so we’re basically looking for three character files that begin with “sd”.
Next, the command we use is surrounded by backwards apostrophes. What the heck is that? In Linux, the backwards apostrophe means “this is actually a sub-command - execute it.” So for each item in the loop I’m calling “smartctl -A $f | grep Temp”. The $f variable is set to the filename that was produced using the filter above - in my case, it matches four files, /dev/sda, /dev/sdb, /dev/sdc, and /dev/sdd.
The command itself has two parts: smartctl, which checks the SATA drive’s SMART status; and the grep part, which searches the output for the word “Temp”. That filters down a few pages of text to just four lines of actual temperature data.
The end result is that the temperature data is the ninth column on the text readout. On my system, it produces this output:
190 Airflow_Temperature_Cel 0x0022 062 046 045 Old_age Always - 38 (Lifetime Min/Max 21/39) 194 Temperature_Celsius 0x0022 038 054 000 Old_age Always - 38 (0 20 0 0)
190 Airflow_Temperature_Cel 0x0022 061 046 045 Old_age Always - 39 (Lifetime Min/Max 23/40) 194 Temperature_Celsius 0x0022 039 054 000 Old_age Always - 39 (0 21 0 0)
190 Airflow_Temperature_Cel 0x0022 056 054 045 Old_age Always - 44 194 Temperature_Celsius 0x0022 099 097 000 Old_age Always - 44
190 Airflow_Temperature_Cel 0x0022 060 048 045 Old_age Always - 40 (Lifetime Min/Max 21/41) 194 Temperature_Celsius 0x0022 040 052 000 Old_age Always - 40 (0 20 0 0)
So all of my hard drives are roughly 38-44C, which is a bit higher than I’d like them to be. I think I will need to add another fan to the case.
Of course, the ideal solution for this is to use an SNMP monitoring system to report on these facts directly; but this lets me do a quick check every so often.
I joined #AltDevBlogADay - my first article, and it’s on interns.
Props to all of you who’ve worked with me to make these internships a success!
Ever since Steve Jobs announced that floppy drives would not exist on the iMac, we’ve been phasing out this once-essential piece of technology.
Now, in order to actually produce usable data off a floppy drive, we have to resort to complex audio processing techniques. Apparently Price of Persia has been saved from the history bin in this method.
Now if only they could bring back MULE! … actually I shouldn’t say that. I’m sure it exists on the app store somewhere.
Very few conversations in videogaming worked quite as well as the ones from Star Control 2:
#(what_about_guy_in_back)
Does that guy in back ever say anything?
#(ABOUT_GUY0) zoqfotpik-289.ogg
Nope.
#(ABOUT_GUY1) zoqfotpik-290.ogg
Not a word.
I love the fact that they designed the conversation system using basic text parsing algorithms. Each line of dialogue could be retrieved with a basic C or C++ string parsing algorithm; and the data structure can be edited using any program that’s capable of reading and writing ASCII.
Good program design is simple design; the kind that you can fix and modify so that the game can grow without having to re-test the entire program.
Interestingly, it looks like the authors may have hardcoded the identifiers connected to most of the dialogue. I’d really have to read through more of the source to know if it was possible to generate new identifiers, or chain conversations together in unique ways.
Finally, a tool I can use to browse gigantic binary files the way I use Notepad++ for text files!
He passed away today. Here’s a great interview from his earlier days.
This guy was hard. He was a tough bastard, and you’ll appreciate how his completely indomitable attitude created the modern PC market, both created and destroyed the Atari videogame bubble in the early ’80s, and led to Bill Gates’ domination of the PC industry for the next twenty years. The book is Brian Bagnall’s Commodore: A Company on the Edge; an extremely intimate view into what led Chuck Peddle to redefine computers with the 6502 and how Jack Tramiel capitalized on it.
He also won an incredible deal out of Bill Gates when he licensed Microsoft Basic for the Commodore PET and all future Commodore products. I bet Bill Gates is still smarting over that one.
It may be obvious how Jack created the modern videogame industry - by providing an inexpensive microprocessor, he created the opportunity for the Atari 2600 to exist. But then, immediately afterwards, he created the Commodore 64, a platform so good and so vulnerable that everyone copied games for it - and the games industry became an immense hobbyist playground. Nobody paid for crummy Atari games anymore when Commodore games could be shared freely; and eventually the modern console industry was born. It ran on a 6502.
Of course, the good times can’t last forever. Steve Jobs pulled a Tramiel by replacing virtually all expensive console games with $0.99 iTunes products; we’re all living with that now. Fortunately, this time around, high quality AAA-level products will continue to exist for us all to enjoy.