200gc Game 4/200

March 7th, 2011 by exhuma.twn

Matchup: PvT (Replay)

Things Learned:

  • Scout earlier, better. I’ve done a much better job in earlier games. This would tell me that I should have …
  • … build my Colossus much earlier!
  • Keep an eye out for drops (again, scouting related)
  • In the macro game, drone production is not over. Continue building!
  • If the money gets high, build infrastructure

Posted in wickedexhuma.255 | 3 Comments »

200gc Game 3/200

March 7th, 2011 by exhuma.twn

Matchup: PvZ (Replay)

Nothing really spectacular to see here. Only noteworthy thing: I start forgetting about drone production in the early mid/macro-game.

Posted in wickedexhuma.255 | No Comments »

200gc Game 2/200

March 7th, 2011 by exhuma.twn

Matchup: PvT (Replay)

Lessons Learned: None

Messed up the Force Field on the early push >_<

This was the first time I played a game right after getting home from work. Clearly, my mind is not up to speed yet. Also, as I haven’t been home all day so the heating has not yet kicked in. My hands were already freezing before even thinking about Starcraft. This is definitely not a good state to play in. Best wait for the weekend. Mid-week gaming may best be done in mid-spring when temperatures are higher. Or,… I could insulate my office… ;)

Posted in wickedexhuma.255 | No Comments »

200gc Game 1/200

March 5th, 2011 by exhuma.twn

Matchup: PvT (Replay)

Lessons learned:

  • If the enemy overcommits to expanding, he may not have a large army. Be more aggressive!
  • Phoenixes against Vikings: Not a good idea! Especially if you don’t have enough.
  • I tend to forget upgrades. This is a) a good way to spend money if your production is already saturated, and b) will make a big difference against a poorly upgraded enemy.
  • Leaving your main production buildings undefended in the early mid-game is not a good idea. It’s better to defend it properly instead of attempting a base trade. Especially against a Planetary Fortress!
  • I should scout the enemy production better

Posted in wickedexhuma.255 | No Comments »

Starting the “200 Game Challenge”

March 5th, 2011 by exhuma.twn

Let’s get started

Today I came across the Starcraft 2 200 Game Challenge (see also here, here, here, here and here). That is, instead of playing blindly, you revisit your games, and blog a quick analysis of it online. It’s a good incentive to actually think about what you were doing.

Following this post, I will do this with each 1v1 game. Now, 200 Games is a lot for me. I don’t get to play a lot. I’m not sure if I will have the perseverance to keep this up until the end. Time will tell.

Note: I will not post the results of the match. That’s not the point, and if you really want to know, you can get that information on replayfu.

My current stats

Bronze Protoss @ 657 points. Current W/L ratio: 53%
I may not continue to update the stats. They are readily available on either battle.net or, with a delay, on sc2ranks.com

Posted in wickedexhuma.255 | 1 Comment »

Change JPA EntityManager connection properties at Runtime

December 30th, 2010 by exhuma.twn

There are many times you want to be able to use different connection options for a JPA EntityManager. The most obvious is different user-credentials (think of a user login-screen and re-using these credentials to connect to the DB), or to make the distinction between development/testing/production environment.

However, if you let Netbeans create the persistence configuration, it will hardcode all connection parameters into the persistence.xml file. When retrieving an EntityManager instance, it will use this information to connect.

If, instead you would like to do this at runtime, you can do the following:

  1. Remove the “properties” tag from the persistence.xml. This may not be necessary, but this will make it clear, that the properties are set inside the code.
  2. Create a “Map<String, String>” which will contain the properties. A list of standard properties can be found in the specs in section 8.2.1.10.
  3. Use this map to create an EntityManagerFactory and use this to create your EntityManager

An example persistence.xml without properties

<?xml version="1.0" encoding="UTF-8"?>                                          
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLo
 <persistence-unit name="myTestPU" transaction-type="RESOURCE_LOCAL">    
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>            
    <class>my.package.Entity1</class>                    
    <class>my.package.Entity2</class>                    
  </persistence-unit>                                                              
</persistence>

In case Netbeans created a method “getEntityManager”, you can safely replace this. Here is an example I currently have in use. The “appConf” instance is a singleton I use to store configuration data in the user’s home folder, and yes, the password is stored in plain-text, but for this test-case I did not need to go any further:

    private EntityManager getEntityManager() {                                  
                                                                               
        Map<String, String> dbProps = new HashMap<String, String>();            
                                                                               
        dbProps.put("eclipselink.logging.level",                                
                appConf.get("eclipselink.logging.level", "INFO").toString());  
                                                                               
        // On linux, the GSSAPI is not available. Use a default user/password  
        // pair to connect                                                      
        if ("Linux".equals(System.getProperty("os.name"))) {                    
            dbProps.put("javax.persistence.jdbc.url",                          
                    String.format("jdbc:jtds:sqlserver://%s/%s",                
                    appConf.get("db.host", "my-default-host"),                          
                    appConf.get("db.database", "my-default-db")));                
            dbProps.put("javax.persistence.jdbc.driver",                        
                    "net.sourceforge.jtds.jdbc.Driver");                        
            dbProps.put("javax.persistence.jdbc.password",                      
                    appConf.get("db.password").toString());                    
            dbProps.put("javax.persistence.jdbc.user",                          
                    appConf.get("db.user", "my-default-username").toString());          
        } else {                                                                
            dbProps.put("javax.persistence.jdbc.url",                          
                    String.format("jdbc:sqlserver://%s;databaseName=%s;integratedSecurity=true",
                    appConf.get("db.host", "my-default-host"),                          
                    appConf.get("db.database", "my-default-db")));                
            dbProps.put("javax.persistence.jdbc.driver",                        
                    "com.microsoft.sqlserver.jdbc.SQLServerDriver");            
        }                                                                      
        appConf.flush();                                                        
                                                                               
        EntityManagerFactory fact = Persistence.createEntityManagerFactory("myTestPU", dbProps);
        return fact.createEntityManager();                                      
   }

This example uses eclipselink. All available properties can be found it the EclipseLink Wiki

Posted in Coding Voodoo | No Comments »

Plain Text markup (HTML, reST, markdown & co)

September 8th, 2010 by exhuma.twn

Two of my personal quests I’ve been on since I started to work are the hunt for a good note-taking system, and the hunt for a good programming font. This post is related to the former…

My preferred medium to write down notes of any kind has been plain-text for a long time. This feels to me like the digital equivalent of pencil & paper. Mostly…

The big advantage being, that it let’s you focus on what’s important. And that is content! But it has one important challenge. How do you represent section headers, bulleted lists, hyperlinks,… in plain text?

While writing plain text files is quick and easy, sometimes you still want to convert it to a more visually appealing style. Say for example you’d like to incorporate it into a web-page, then converting it to HTML would be nice.

Over the years I’ve dealt with quite a few systems used for plain-text markup. Without a question, the most widely known markup language is HTML. Other’s which come to mind are javadoc, phpdocumentor, ROBOdoc and doxygen. While these are meant to document code, I still count them as markup languages as they have constructs to add style or semantics to the content. All of these are pretty useless as tool to write notes as they are stubbornly assuming you are generating text for code.

About ten years back while writing my own CMS, I needed a way to allow users to markup content. Allowing HTML was not an option because it was hard to edit, and hard to explain for non tech-savvy users. Especially at that time, when the Internet was still something most people considered either “Magic” or the “The Work of The Devil”. I didn’t need much. So I concocted my own markup language, and with not even a one-page introduction, people got productive with it.

A few years later I found what I then considered “The Holy Grail” of markup: And that was markdown. It’s really well designed, and the resulting “source” plain text format is very concise and clean. There’s not a lot of “noise” in the document. It is a perfect candidate for a note-taking format. The only thing that is really missing are tables.

Only recently ( about two years back ) did I come across reST (reStructuredText). It’s been around for quite some time, and I’m surprised I didn’t hear from it earlier. And if I had to sum it up in one word, it would be, without any hesitation: Mature! The “source” you write is, very clean and readable. Some parts (f. ex.: section headings) are even cleaner as in markdown, whereas other areas are not (f. ex.: hyperlinks). But it is much more complete than markdown!

One thing neither markdown nor reST can do very well is interlinking of documents. This is where Sphinx comes in. Sphinx is a document generation system which uses a collection of reST files as input. To completely understand it’s inner workings is not very straight-forward. But easy enough. And it pays off. It generates downright beautiful HTML and PDF (through LaTeX) documents.

In summary I would say that I would in any case prefer reST to anything else. It’s simple for basic cases, but complete enough, when the document starts to grow. Unfortunately I have not yet found convincing parsers for PHP. So in that case I’d go with Markdown Extra. If I needed to write really large documents, I’d consider Sphinx. Primarily because the generated HTML pages have an offline JavaScript search included, and because of the nice default style ;)

Posted in Babble | No Comments »

SPSS, MS-SQL2008 & bigint

March 31st, 2010 by exhuma.twn

There seems to be an issue with SPSS while reading data from an MS-SQL-Server instance. Notably with the SQL datatype “bigint”. Assume the following SPSS syntax:

GET DATA
   /TYPE=ODBC
   /CONNECT='DSN=my_dsn;SERVER=server_name;Trusted_Connection=yes;DATABASE=db_name'
   /SQL = 'SELECT year FROM  my_table'
.
EXECUTE.

If the field in question (in this case: “year”) is of SQL-type “bigint” then SPSS will show these values in the majority of the cases as “MISSING”. Sporadically some values appear, but they are completely wrong.

Once the cause is known (problem with the “biging” type), the solution is straight-forward: Cast the type to another appropriate type which is understood by SPSS. Which type you choose obviously depends on the values stored in the affected fields. Casting blindly to “int” may (I haven’t tested this!) resolve in strange results if the values lie outside of the “int” range (-2^31 to 2^31-1). In this case you may need to cast it to something alphanumeric like “varchar” and re-cast it in SPSS into “Numeric”. As said, I haven’t tested this but I thought it might be worth mentioning!

So, here’s the above query with the appropriate cast:

GET DATA
   /TYPE=ODBC
   /CONNECT='DSN=my_dsn;SERVER=server_name;Trusted_Connection=yes;DATABASE=db_name'
   /SQL = 'SELECT CONVERT(int, year) AS year FROM  my_table'
.
EXECUTE.

Note also that in this case you need to add an alias for the column ( “… AS year” ). Otherwise SPSS will return it as “VXXX” (where XXX is a sequential number).

I have tested this solution on all combinations of SPSS 11.5, SPSS 18, SQL-Server 2008 64bit, SQL-Server 2008 Express 32bit. And casting the value worked every time.

Depending on your use, it may be helpful to create views which do the casting. I have not yet tried this, but I don’t see a reason why it shouldn’t work. Additionally, it might be noteworthy that I have only encountered this problem with “bigint” so far. There may be problems with other types as well. I expect, casting them to something else should work there too.

Posted in Coding Voodoo | No Comments »

Making “File Size View” in Konqueror suck less

March 5th, 2010 by exhuma.twn

I’ve been down that road many times: “What folder takes up the most disk space”. Over the time lots of junk accumulates on one’s disk. So far the following one-liner has been a trusty companion:

$ du -s * | sort -n

Some other tools are available of which I don’t remember the names. But why not use something that integrates well with Konqueror in KDE? Like “FSView” (short for file-size view)? Well, for one thing it’s painfully slow, and what makes things worse it’s utterly unreadble. But what I figured out this afternoon, is that the app actually offers some quite nice settings. The buty of Konqueror integration is that the “plugins” can insert thei own menu-items wherever they like. Which is nice, because they then integrate well with already existing menu options. But on the other hand, if you are used to open menu paths like “Plugins -> MyPlugin -> Settings” or “Edit/Tools -> Options -> Plugins” you won’t find them.

In the case of fs-view, the options are neatly tucked away in the “View” menu. Which actually makes perfect sense. But working too much on Windows-inspired user interfaces twisted my mind too much and I go looking into the non-obvious places out of pure habit ;)

Now, to spice up fsview a bit I made the following changes:

  • In the “Visualisation” sub-menu:
    • Set “Nesting” to “Vertical”
    • Set “Border” Width to 3
    • Disabled both options “Enable Rotation” and “Shading”
  • In the “Stop at Area” sub-menu:
    • Set value to “400″
  • In the “Stop at Depth” sub-menu:
    • Set value to “2″

Both “Stop at …” settings limit the number of times fs-view has to redraw/rearrange the grid. This should speed things up and it becomes more readable. The end result looks something like this:

FSView with customizations

FSView with customizations

In any case, running fs-view on folders with a large number of files can be very slow and make konqueror even unresponsive while it’s running. Be patient. In my opinion, if you want to determine the biggest file/folder as quickly as possible, the “du -s” method (as outlined above) is preferrable.

Posted in Linux | No Comments »

Dialog buttons not responding in Eclipse under KDE/GNOME

February 1st, 2010 by wickeddoc

In case you’re running into the same trouble as me, that dialog buttons are not “clickable” anymore under Eclipse, just add the following line to one of your linux startup scripts to fix the problem:

export GDK_NATIVE_WINDOWS=1

Posted in Coding Voodoo | No Comments »

« Previous Entries Next Entries »

Pages

Recent Posts

Categories

Links


Archives

Meta