Fast File Loading

October 25, 2006 @ 0:41 | In Programming | 17 Comments | del.icio.us digg devbump rss

Reading data efficiently from Hard Disk and DVD units is vital for video games and one of the more important problems to solve in the next generation of games. While we are getting 20x performance in processing power and memory size, we are only getting 4x performance improvement in data devices (dvd for consoles).

I describe in this post how to efficiently read raw data from disk (hdd, dvd) oriented towards streaming files in a realtime application (although the concepts are useful in other areas). The platform used is Win32, but all the topics covered could be easily ported to other platforms.

Click to read the full article



Fon Community

October 3, 2006 @ 2:07 | In Internet, Linux | 2 Comments | del.icio.us digg devbump rss

My host is joining the Fon Movement, a free WiFi community oriented towards sharing home internet connections to the world. Sharing your connection allows you to use any Fon node in the world for free.

There are already lots of nodes around the globe. You can check your neighborhood here.

What really impressed me is that they are selling is FON Social Router (La Fonera) for just 5 €/$. A 802.11g router with a linux 2.4.0 inside! I couldn’t resist such a bargain.

If you live in Spain, like me, Pc Actual is offering the router, 400 skypeout minutes, skype starter kit and a guide of Pc Tricks in this page.

And now, waiting for it…



UPS for Linux

September 5, 2006 @ 2:37 | In Linux | No Comments | del.icio.us digg devbump rss

I’m tired of the electric shortages I am suffering these days at home (where this blog an other services I use frequently are hosted) so I decided to buy an Uninterruptible Power Supply (UPS) for my server. Without doing too much investigation I bought a unit from Belkin: FH6350efUNV.

I’m really surprised with the Quality-Price ratio offered by this product. For less than 60€ I have an unit that properly notifies events (on battery event, on line power event, on low battery event, etc), mails me when each of this events get fired and monitors UPS status in real time. And all of this compatible with my Gentoo Linux.

Programs for Linux that come with the product are binaries without source code. I found troubles with some of them (I was unable to send customized mails) so I started looking for a open source solution. And here I faced NUT.

Network UPS Tools is a collection of programs for monitoring and administering UPS hardware under Linux using a client/server architecture. After hours investigating (Belkin FH6350efUNV unit is not officially supported by the last version 2.0.1) I discovered the driver that worked perfectly with my hardware: Powermust Driver. Powermust reports all the information (with the exception of the temperature variable) I had with the propietary software distributed by Belkin. All the notification system works perfectly with this driver.

So, if you are looking for a cheap and effective UPS unit for your linux, I really recommend buying one of the Belkin F6H series.



Best C++ Books

August 11, 2006 @ 22:01 | In Books, Programming | 3 Comments | del.icio.us digg devbump rss

Scott Meyers (author of the Effective C++ saga) has written on his blog a list of the most important C++ books written to date. I had this same idea and may be this is a good time to publish my list so you can compare. This is my personal ranking of the five best C++ books:

  • The C++ Programming Language
    The C++ Programming Language

    Although I have not read the last Special 3rd Edition (it is in my list of books to be bought), I always have the 3rd edition handy as my C++ reference book. It is written in a academic style ready to be consulted whenever you have questions about all the language details.

  • Effective C++
    Effective C++

    I wrote a mini review of this book months ago.
    If you are a serious C++ programmer this book is a must read for you. If you haven’t read it stop wasting your time reading this blog and get a copy of the book. Effective C++ is the perfect book to accompany your main C++ book. Although intended to be your secondary book on C++, Effective C++ will learn you more that simple C++ tricks

  • C++ Coding Standards. 101 Rules, Guidelines, and Best Practices
    C++ Coding Standars

    I also wrote a review for this.
    The book is more high-level than other related books (Effective C++, Modern C++ Design, Exceptional C++) and all the topics about C++ can be found in those books. You won’t find new topics or advices. But this book is about standars for your development team. In fact, it is designed to be used as a basic for your team’s coding standards. You can get good ideas from this book to be discussed with your team (and in fact, you do not have to agree all of them): coding conventions, hungarian notation, automated build system, version control, code reviews, etc.

  • Exceptional C++
    Exceptional C++

    The book version of the Guru of the Week webpage created and written by Herb Sutter. This book includes expanded versions of the first 30 issues on that popular page.

  • Modern C++ Design
    Modern C++ Design

    Template Metaprogramming in C++ was born with this book. This book will open your mind to choose the red pill. Even if you think templates will do more harm than good in your team at least you should read this book to know the enemy. The book describes an actual C++ library called Loki. I have work in lots of projects where subparts of that library was being used. This book is the hardest of the five, be prepared!



Debugging Applications

July 15, 2006 @ 18:36 | In Books, Programming | No Comments | del.icio.us digg devbump rss

Debugging Applications for Microsoft .NET and Microsfot Windows
Author: John Robbins
Pages: 801
Published: 2003

If you read MSDN, you probably read the column Bugslayer written by John Robbins. I’m a fan of Bugslayer so when I discovered this book I couldn’t resist to buy and read it.

This book is the Holy Bible for debugging. Seriously, I didn’t think someone could write more than 800 useful pages about debugging before reading Debugging Applications. 80% of the book is dedicated to Native Programming and the rest is for Managed Programming. Both using Microsoft Visual Studio 2003.

The book is divided in four parts. The first part is about general debugging topics not related with Windows: What Are Bugs?, Debugging Process, Bug Tracking Systems, Regression Tests, Defensive Programming (the chapter dedicated to assertions should be a must read for every member of a programming team).

The second part is about Win32 and .NET debugging support with two chapters entirely dedicated to native code: x86 assembly, symbols, dump files, windbg…

Third part is about Tools for debugging. It describes how to extend the Visual Studio IDE, introducion to Add-Ins and profiling API for .NET.

The fourth part is entirely dedicated to Native Code Techniques: Crash Handlers, Windows Services, Multithread Deadlocks, Automated Testing, C Run-Time Library and Working Set are the more relevants topics.

I really recommend this book. John Robbins is an expert and it is demonstrated in a very well written book. I really enjoyed reading this book.

By the way, the next revision of this book will be break into two books: one for the managed and one for native. The .NET version is already available for presale in Amazon

Rating: 9 / 10



Setting up a Symbol Server

July 6, 2006 @ 2:27 | In Programming | 5 Comments | del.icio.us digg devbump rss

Debug symbols allow you to have better debugging sessions. They have information about the functions contained in executables and dynamic libraries and provide you with information to get clean call stacks. A Symbol Server allows the debugger to load the correct symbols, binaries and sources automatically.

In this article, I describe how to set up a Symbol Server for your programming team to store symbols (from the operating system, third party libraries and from your own libraries), binaries and source code to improve the productivity of the team and the service given to your clients.

Click to read the full article



10 Security Guidelines to protect your server box in Internet

June 9, 2006 @ 2:47 | In Internet, Linux | No Comments | del.icio.us digg devbump rss

I’m not an expert system administrator, but it is one of my hobbies. I describe here a checklist of things I have learned playing with my linux box (the one I use for my blog) in the last years. Although the guidelines are generic to any Operating System the examples given are specific for Gentoo Linux. I expect to help anyone configuring a secure server.

Click to read the full article



C++ Coding Standards

May 30, 2006 @ 1:22 | In Books, Programming | 1 Comment | del.icio.us digg devbump rss

C++ Coding Standards. 101 Rules, Guidelines, and Best Practices
Author: Herb Sutter, Andrei Alexandrescu
Pages: 220
Published: 2005

Although a little bit tired of reading gem style books (Effective C++, Game Programming Gems, AI Game Programming Wisdom, GPU Gems, ShaderX, …) the authority of the authors made me find time to read C++ Coding Standards. Definitely, it was well invested time.

The book is divided in twelve sections (Organizational and Policy Issues; Design Style; Coding Style; Function and Operators; Class Design and Inheritance; Construction, Destruction, and Copying; Namespaces and Modules; Templates and Genericity, Error handling and Exceptions; STL: Containers; STL: Algorithms; Type Safety) each one having ten topics (more or less).

The book is more high-level than other related books (Effective C++, Modern C++ Design, Exceptional C++) and all the topics about C++ can be found in those books. You won’t find new topics or advices. But this book is about standars for your development team. In fact, it is designed to be used as a basic for your team’s coding standards. You can get good ideas from this book to be discussed with your team (and in fact, you do not have to agree all of them): coding conventions, hungarian notation, automated build system, version control, code reviews, etc.

Definitely, this book will help to improve the code quality of a team. My recommendation: read it.

Rating: 8 / 10



Efficient update of stl containers

May 17, 2006 @ 23:08 | In Programming | 6 Comments | del.icio.us digg devbump rss

Update: Fixed some bugs in the sample code.
Update: Note added in the third option about the hint.

I have seen dozens of times code like this to update an entry in a map:

typedef std::map<std::string, int> Items;
Items items;

Items::iterator it = items.find(”counter”);

if(it == items.end())
{
   items.insert(std::make_pair(”counter”, 1));
}
else
{
   it->second++;
}

The problem with this code is that you are traversing the map two times if the item is not found in the map, one for the first find and one more for the insert.

You can improve the code with something like this:

std::pair<items ::iterator, bool> res = items.insert(std::make_pair(”counter”, 1));

if(!res.second)
{
   (*res.first).second++;
}

This is notably better. You only traverse the map one time. But there is still a problem with this code: you are creating the pair even when you do not need it. In this case the pair is simple and its creation is not a problem, but imagine a pair with more complex objects hard to create. You can avoid the creation with a code like this:

Items::iterator lowerBound = items.lower_bound(”counter”);

if(lowerBound != items.end()
   && !(items.key_comp()(”counter”, lowerBound->first)))
{
   lowerBound->second++;
}
else
{
   items.insert(lowerBound, std::make_pair(”counter”, 1));
}

Although being more efficient, this code is more obscure, so in case you do not need those nanoseconds you can live with the more clear second option. Apart from being more obscure, the hint is only that, a hint. The implementation can ignore it. As noted by Steven in the comments below, Visual Studio ignores it for the hash_map, hast_set containers.



Running your own server (@home)

May 15, 2006 @ 17:44 | In Internet, Linux | 7 Comments | del.icio.us digg devbump rss
http://entland.homelinux.com/images/zen.jpg

I wanted to start a topic (the first on Linux, I promise more on this) about the hardware machine where this blog is hosted: a machine installed in one corner of my living room. I bought the box to be the server for all my machines at home (personal computer, media center, videogame consoles, ip camera, fileserver…). Being network security one of my hobbies I am always playing with security tools. That is one of the reasons why I decided to host this blog in my home server: to play with a new toy. :-)

In the past, whenever I installed a linux distribution (SUSE most of the times) I always finished mutating it to my own distribution due to the fact that these clasic distributions evolve too slow. This was frustrating and time consuming for me because I had to mantain lot of packages and some big changes (gcc, glibc) could break the system. When I was starting to build my own personal distribution (based on Linux From Scratch) I discovered Gentoo. Gentoo Linux is the perfect distribution to me. It is based on source (every package you install must be compiled) and it is continuously evolving like an organic system.

This is the current hardware configuration for my Linux Box:

I have an internet connection with a dynamic IP. To be always accessible I’m using the services from DynDNS.

And that is enough for today, my next article on this topic will be about tips & tricks on security to avoid to be owned. :-o



Wed, 20 Aug 2008 20:02:08 +0200 / 21 queries. 2.076 seconds / 3 Users Online

gentoo link wordpress link apache link PHP link website stats

Theme modified from Pool theme. Valid XHTML and CSS