Category Archives: Networking

Poker Programs to Improve your Game

Today more and more aspects of our lives include using some type of a tool or program. It’s not surprising that an industry such as online poker, used for recreational purposes by some, and a money-making means by others, developed these tools early on. Now, after almost 15 years, online poker has changed dramatically to the point that most professional players don’t imagine playing the game without a set of programs on and off the tables.
First, let’s look at a couple of programs you can use off the table to practice and then we’ll more to programs that work on most of the world’s poker clients, like Pokerstars.

Equilab

Equilab is a free equity calculator that everyone from a recreational player to a professional should use. Poker is partly a luck game but it is crucial to know when you should or shouldn’t test your luck. In Equalab you can put it your cards, opponents range (assumed combinations cards) and see where you stand. Maybe it’s 30%, maybe it’s 2%?

FlopZilla

Flopzilla is not free but if you are planning on making money with poker, it’s a worthy one-time investment. It works sort of like Equilab but focuses more on showing how often your opponents, or you, will hit your cards. If there is a monotone flop on the table, after your opponent has 3-bet you, should you be worried he might already have a flush? Even though this is only a simplistic example, the program is very powerful and could improve your game a lot.

PokerTracker and Hold’em Manager

In the world of poker HUDs, these two are the most popular. Two main things about these programs is allowing you to instantly know more about your opponent’s play patterns on the table and allow you to review your play afterwards. Both allow fully customizable, color-coded HUDs where you can put in any information about your opponent’s play from the most basic like raising pre-flop to the most advanced like check-raising on the river in 5-bet pots.


Despite the advantages, there are a couple of drawbacks too. You collect information while on the table, so in order to know more about your opponent, you will have to have him at your tables. The second one is the action. Information is only power when you know how to interpret right. SO, if you decide on using a HUD, take your time, start with basic templates and add more information as you progress as a player.
Some swear by poker programs, other’s say that poker should remain old-school. Whichever side you are on, make sure that poker is fun for you just the way you play. If you are completely new in a poker world, start slow. Maybe from free tournaments and the lowest cash games? At the largest poker site in the world, PokerStars you can play many freerolls every week or other tournaments from $0.01, or 0.01/0.02 cash games. You can download and start playing on PokerStars and many other online poker sites via PokerNews http://cz.pokernews.com/pokerstars/ where you will also get the best bonus to start. Downloading and installing is as easy as any other program. You’ll have to follow the installation steps, create a username and you’ll be set to hit the tables.

ResX comments and random access

If you are working with .resx files in .net, you will no doubt be familar with the ResXResourceReader, ResXResourceWriter and possibly ResXResourceSet. These three classes allow reading and writing of resx files, but they have some annoying limitations:

  1. ResXResourceReader does not provide random access to values (no method taking a string name/key – you have to traverse all entries sequentially to find a value).
  2. ResXResourceReader requires use of resx data nodes to access value comments.
  3. ResXResourceSet provides random access (via the GetObject() method) but has no support for comments via resx data nodes.

These classes have been available since .net 1.0 and it is another example of a software development principle I believe in more each day: ‘Your first attempt at designing [software entity] will be sub-optimal.’.

Unfortunately Microsoft has not done much work in this area other than in .net 2.0 to introduce resx data node support for the ResXResourceReader that enable you to work with entry comments.

If you want to work with resx comments as well as have random access to values, here is a class that derives from ResXResourceReader and provides that functionality:

using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Resources;

namespace ResxUtils
{
	/// <summary>
	/// Extends the ResXResourceReader class with value and comment support.
	/// </summary>
	public class ResXReader : ResXResourceReader
	{
		/// <summary>
		/// Container for a ResX value and comment.
		/// </summary>
		private class ResXValue
		{
			public string Value;
			public string Comment;
		}

		Dictionary<string, ResXValue> _resxEntries;

		/// <summary>
		/// Initializes a new instance of the <see cref="ResXReader"/> class.
		/// </summary>
		/// <param name="resXStream">The resX stream.</param>
		public ResXReader(System.IO.Stream resXStream)
			: base(resXStream)
		{
			Initialize();
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="ResXReader"/> class.
		/// </summary>
		/// <param name="filePath">The file path.</param>
		public ResXReader(string filePath)
			: base(filePath)
		{
			Initialize();
		}

		/// <summary>
		/// Initializes this instance.
		/// </summary>
		private void Initialize()
		{
			UseResXDataNodes = true; // must turn this on to use access resx comments

			_resxEntries = new Dictionary<string, ResXValue>();

			foreach (DictionaryEntry entry in this)
			{
				var node = (ResXDataNode)entry.Value;
				var value = (string)node.GetValue(null as ITypeResolutionService);
				_resxEntries[node.Name] = new ResXValue { Value = value, Comment = node.Comment };
			}
		}

		/// <summary>
		/// Gets the value.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>The value, or null if there is no entry matching the supplied key.</returns>
		public string GetValue(string key)
		{
			if (_resxEntries.ContainsKey(key))
			{
				return _resxEntries[key].Value;
			}

			return null;
		}

		/// <summary>
		/// Gets the comment.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>The comment, or null if there is no entry matching the supplied key.</returns>
		public string GetComment(string key)
		{
			if (_resxEntries.ContainsKey(key))
			{
				return _resxEntries[key].Comment;
			}

			return null;
		}
	}
}

Note: If you run Code Analysis / FxCop over this in .net 4.0, it will complain about several things, in particular LinkDemands are skipped, the class is not named correctly. The class naming rule is a side effect of the base ResXResourceReader class implementing the generic interface IEnumerable, (so can just be suppressed) and the security warnings are due to the CAS policy changes in .net 4.0. I’m not sure there is any way to code around deriving from a class with link demands in .net 4.0 without suppressing security warnings (even adding the SecurityCritical attribute fails, and should be unnecessary anyway).

Windows 7 disconnected network drives

Mapped network drives have always been a buggy area in Windows, probably at least in part because they are still linked to a DOS namespace. From MSDN:

On Windows Server 2003 and Windows XP, the WNet functions create and delete network drive letters in the MS-DOS device namespace associated with a logon session…

Whatever the reason, it is commonly reported that mapped network drives appear as ‘disconnected’ in Windows Explorer (or ‘unavailable’ via net use), and that programs that attempt to use these drive mappings will fail until the user physically clicks on the drive letter in Windows Explorer. Only this user-initiated action will restore the connection and allow other programs to successfully read from the drive letter.

This is a BIG problem!

I initially thought that the mapping of the network drives was being done before some required services had started (such as the Workstation and Server services), so I wrote a program to run on startup that attempted to map a drive and logged all the currently running services if it failed. It would keep trying to map a drive until it succeeded. I hoped it would show me which services needed to be running in order to map a drive, after which I would write a program to wait for those services before attempting to map anything. But, much to my amazement, I found that when the initial drive mapping failed and a subsequent attempt succeeded, the set of running services had not changed! So I could only conclude that there was another element in the equation. After thinking about this for a while, and reading this post, which indicates that Microsoft is apparently trying to address this, I decided ’stuff it’, I’ll just write something that I know will work and is simple.

So I’ve written a small executable called MapDrive.exe to ‘work around’ this problem, described on the following dialog:

Now as you may know since Vista, there is the concept of a split user token, and mapped network drives apply to only one token, so if you map drives as a standard user and then run an elevated process, those network drives are not available to the elevated process. This behaviour is documented by Microsoft, however the solution they offer is both unsupported and unsafe. Other solutions have been proposed here. If you don’t wish to use any of these solutions, you can do this:

1. Run MapDrive.exe as a shortcut from your Startup folder. This will map drives for the standard user token.
2. Run MapDrive.exe as a local group policy logon script using gpedit.msc. This will map drives for the administrator token.

Note: After using this program, you may still see the above balloon popup, simply click the spanner icon, and select ‘Hide icon and notifications’ for ‘Windows Explorer’.

Download the utility for free here.

UPDATE: A few people have asked how to use this program. As stated above, there are two ways, depending on whether you need drives mapped for standard users or admins. If you don’t know what you need, you probably just need to do this for standard users. Here are the steps for both:

1. Copy MapDrive.exe to somewhere on your local hard drive.

Standard Users:
2. Right-click MapDrive.exe and choose ‘Create Shortcut’. This will create a file called ‘MapDrive.exe – Shortcut’ next to MapDrive.exe. Now go Start->All Programs, right-click the ‘Startup’ folder and choose ‘Open’. Now copy the shortcut file you made before to this folder. Now right-click the shortcut file and choose ‘Properties’. Add the drive letter and network share as argument to the end of the ‘Target’ field e.g. “C:\Users\joeblogs\Documents\MapDrive.exe s: \\server\share 20″. You are done, next time you reboot, your s: should be mapped successfully for standard users.

Admin Users:
3. Press Win+R, type gpedit.msc, go User Configuration->Windows Settings->Scripts. Double-click Logon, click ‘Add’ and enter script name (no quotes): “C:\Users\joeblogs\Documents\MapDrive.exe” and script parameters (no quotes): “s: \\server\share 20″, ok, ok, done. You are done, next time you reboot, your s: should be mapped successfully for admin users (i.e. elevated programs).

Network CHMs = Pain courtesy of IE

Despite being around since 1997, CHM files still remain a popular format for program help / documentation as well as ebooks. But opening them from a network drive was outlawed in 2005 after Microsoft released this security update. There was a registry hack workaround to enable it again, however this no longer works in Windows 7. The solution accepted on this thread involves two steps:

1. Add this registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000001

2. In Internet Explorer->Tools->Internet Options and add your network drive into the safe/trusted zones.

Just the thought of firing up IE gives me the security-shivers and I really don’t want to be messing about with ‘trusted zones’ – I don’t trust IE to do anything. I’m surprised the US government hasn’t yet advised its citizens against using IE, like Australia, France and Germany have.

Of course the whole reason this has anything to do with IE is because the built in HH.exe that is the default Html Help viewer on Windows uses IE as the web browser engine to display and navigate the HTML files inside the CHM. So we could avoid this whole problem if there was a CHM viewer that doesn’t use IE at all. Now to the motivation for this post:

Enter xCHM – this is an open-source project that predominantly provides support for viewing CHM files on non-windows platforms, however it has been ported to Windows, so you can kiss HH.exe goodbye, and open your CHMs from any network location without having to hack your registry or mess with IE zones!!

Download the Windows port of xCHM (look under xCHM for Win32).

Internet over copper sucks

I am subscribed to the fastest available ADSL 2+ (24Mbps) connection here in Sydney, and my connection at three different houses I’ve lived in has always been unreliable. Currently where I’m living, the connection actually goes down whenever it starts raining! :? It also frequently goes down just at random, when it’s not raining. P2P seems to worsen the situation (not surprisingly), but usenet is superior anyway, so that’s not a problem anymore. Granted, I am pretty far from the exchange (~4km), hopefully copper will be replaced with optic fibre in the next decade.

So a while back I wrote a small utility that shows an icon in the system tray reflecting whether you can contact (via ping) a remote host (google, or your ISP’s DNS server, for example).

Online icon:

Offline icon:

Clicking the icon shows your the history of ping times:

It can be run on startup, passing the name or IP of the remote host as an argument. For example:

"lookalive.exe www.google.com"

You can also specify the period (in seconds) between pings (default is 1 second), so to ping www.google.com every 5 seconds:

"lookalive.exe www.google.com 5"

If you have multiple hosts you wish to ping, you can run the application multiple times and a spearate icon in the system tray is displayed for each host. To distinguish between them, you can pass a colour:

"lookalive.exe www.google.com 5 blue"

Additional arguments allow calling of an external application and/or showing a balloon notification whenever the state changes and customisation of the system tray icon.

Download the utility for free as an installer or as a standalone EXE.