Thursday, October 27, 2011

Convert datetime in SQL Server

This query gives you examples of possible datetime convertion formats.

Tuesday, October 25, 2011

Creating tabs from DB-query in ext.net

It's not hard storing all the information you need to create tabs from a database-query in ext.net. You can easily store title, filename and tooltip. To get the icon it's not as straight forward as it expects an enum and, of course, you could get the number and save that but it's a bit of a pain.

Instead do this:
foreach (DataRow dr in dt.Rows) {
            pnl = new Ext.Net.Panel();
            pnl.Title = dr["pagename"].ToString();
            pnl.TabTip = dr["description"].ToString();

            // get icon from string
            icon = (Icon)Enum.Parse(typeof(Icon), dr["icon"].ToString());
            pnl.Icon = icon;
            pnl.Layout = "FitLayout";
            pnl.AutoLoad.Url = dr["relative_url"].ToString() + "?d=" + Request.QueryString["d"];
            pnl.AutoLoad.Mode = LoadMode.IFrame;
            pnl.AutoLoad.NoCache = true;
            pnl.Border = false;

            // add to tabpanel
            tpPack.Items.Add(pnl);
        }
where dr["icon"] is the icon name (duh). :)

Monday, October 24, 2011

"Fixing" ebuild using old autotools

MPD (example) added AM_SILENT_RULES (silent build) to its configure.ac not too long ago. This macro is only available in automake 1.11. The ebuild that is in the mpd overlay explicitly state that it wants automake 1.10 and therefore fails. The fix? Install automake >= 1.11 and then change the ebuild like this.

Find the line:
WANT_AUTOMAKE="1.10"
and change it to:
WANT_AUTOMAKE="1.11"
or
WANT_AUTOMAKE="latest"
Mind you, this will make the ebuild mismatch with the manifest and therefore still fail. Report it to the overlay maintainer so they can fix it proper.

In the meantime you can prefix your emerge command with:
FEATURES="-strict"
to bypass the manifest check and force an install.

Saturday, October 22, 2011

Genius!


My friend is a genius!

Bukkit, restart script

The script we use to stop bukkit, tar up the world, render the overviewer map and restart bukkit again. The last part is rather silly as it involves a hacky way of getting a screen going that accepts "-X stuff". Reason is the screen has to have been connected to and detached again for it to work.