Hy all!! Sorry in advance for my bad bad English.
Tonight I did some work on HEM to realize a script that can create an alias for all players in our database, except for Hero. It can be very useful to analyze population tendency, but I have to work more on this because it can be very hard for our machine to analyze this huge sample of hands. So, every help his appreciated
In order to be able to do that, first of all open your HEM and create an alias clicking on Options>Player aliases>Add alias. In the name select whatever you want; then add just one player to the alias (except for a hero nicks obv) and make sure you remember his name. For semplicity, take a name with no special characters. Assume at this point you have add the nick 'Villain' to the alias 'Global'.
Now, you have to open your pgAdmin by Start>All programms>Postgresql 9.0> pgAdmin III.
NB:The directory can change based on your actual version of postgresql
Connect to your database double-clicking on PostgreSQL 9.0. Select your database of interest (for me his SNG HU), then click on Tools>Query tools (or something like that, I don't know the exact traduction cause I use an Italian version).
The first thing to do is to extract the id for our 'Global' alias. To do that, insert this code
Code:
SELECT *
FROM aliases a JOIN players p ON a.player_id = p.player_id
WHERE playername = 'Villain';
You have to replace string Villain with the name of the player added to the alias
Then, click 'F5' to start the query. At this point, you have a table in the lower part of the screen. The first column of this table should be 'aliasplayer_id'. Take this number, it will be useful soon. Assume for simplicity this number is 1234.
At this point delete all the code you have insert and digit this new code
Code:
INSERT INTO aliases
SELECT 1234, P1.player_id
FROM players AS P1
WHERE P1.player_id NOT IN
(
SELECT A2.player_id
FROM aliases AS A2
);
You have to replace 1234 in the second line with the exact id of the alias extracted with the first code
Again, click 'F5' to start the query.
At this point you have to restart your HEM to add the changes. To make sure all it's ok, click again on Options> Player aliases, select 'Global' and verify that there are enough nicknames associated to the alias.
Now, you're able to use this alias... if your machine is strong enough, obv