Jan 082016
 

I was looking for icons to use in MenuItems in a WPF menu and found that there are a lot of questions on how to do that. It’s not very difficult, so maybe the documentation is not too clear about it.

Create a folder in your project, for example “res” or “resources” or “images”. Put some graphics files in there by right-clicking on the folder, choosing Add and then choosing Add existing items.

To use these images in your XAML, follow this example:

 <MenuItem Header="E_xit" Click="btnCancel_Click">
   <MenuItem.Icon>
    <Image Source="Resources/Exit.png" Width="20" />
  </MenuItem.Icon>
</MenuItem>

In my project, the images are in the Resources folder. And that’s all there is to it.

Dec 102015
 

As .NET developers we all know the problem: an external library/framework comes in an x86 and in an x64 flavor, so referencing one excludes building for the other and vice versa. Here’s an excellent blog post how to solve that. What surprises me, is that this post is from 2010, and Visual Studio still does not support referencing both platforms in one go.

Nov 162015
 

When you are a developer, you probably know this problem: you need to send mails from your application, but you cannot just use your company’s mailserver for developing/testing purposes. So you end up using Gmail or even installing a mailserver on your development PC.

When you’re using Windows, you probably don’t need to. There is this great *free* tool that enables you to receive mail via SMTP. It does not send mail, but you can view what the mailmessage was, including a option to view the headers etc. It’s called Papercut. It hides conveniently in your system tray. Go check it out!

Sep 102015
 

The default Oracle 12c database installation (that a lot of developers will use without going into the advanced setup) is a bit strict. For instance you can’t just create users that don’t comply to the user naming policies. But what about “sys” or “system”? They don’t comply either!

Add the following to your script:

alter session set "_ORACLE_SCRIPT"=true;

Things should work now. Basically you’re acting like you’re an Oracle supplied script now. And we know the rules don’t apply to Oracle, right?

Aug 262015
 

With ulimit -n you can see what the maximum number of open files can be. As superuser you can change that -per session- with the ulimit command, but an ordinary user can not do that. Therefore, you need to change the /etc/security/limits.conf file. For instance:

* soft nofile 10000
* hard nofile 10000

Meaning that the hard and soft limit are now increased to 10000. I didn’t know that this does not change the limits for the superuser. The asterisk (*) is not intended to change superuser limits. Instead, repeat both lines, changing the asterisk to the word root. You might need a reboot for that, but that’s all.

I needed this for Neo4j and was surprised to see that normal users could have more open files than the superuser. No more, I say, no more!

Mar 312015
 

You know how internet surfing works. You read something, click on some links, and finally you don’t even know where you came from. Anyways. That made me try WildFly, the AS formerly known as JBoss AS.

And you know the drill. Download zipfile, unpack, goto bin folder and start. Browse to localhost/something.

Can’t find the console. Well shit.

Do you have an NVidia videocard in your system, and did you install all the drivers and stuff? You probably have NVidia Networks Service as one of you running processes. Kill it. Now restart WildFly and browse to the console.

You’re welcome.

Nov 092014
 

I edited /etc/sudoers without visudo, and made a mistake. That will prevent you from successfully using sudo again. No real harm done, but it takes rebooting to get it fixed.

1) reboot in recovery mode (press escape when booting so the grub options are shown)
2) drop to a root shell (option in the recovery menu)
3) mount -o rw,remount /
4) visudo (emacs based editor)
5) reboot the system

You should be up and running again!

Sep 182014
 

You can’t use ROW_NUMBER() in an update statement in SQL Server, so:

UPDATE TheTable
SET    TheColumn = ROW_NUMBER();

won’t work. But sometimes that’s just what you want. This will do the trick:

UPDATE  Target
SET     TheColumn = RowNum
FROM
(
    SELECT  t.TheColumn, ROW_NUMBER() OVER(ORDER BY t.ID) AS RowNum
    FROM    TheTable t
	WHERE    ...
) AS Target;
Jun 242013
 

I extended my PC with two old monitors I got from my sister/brother-in-law. An HP1955 and an HP2035, with resolutions up to 1280×1024 and 1600×1200 respectively. Since my main screen is FullHD (1920 x 1080), Eyefinity on the RadeOn 7970 will set the height of all to 1024 when you put them in a group. Giving me a total resolution of 3840×1024. Not the best the card can do, but the best in this setup.

To save me the trouble of constantly setting up the group and gaming, and then switching back to a normal extended desktop (with max resolutions on each monitor), I created two presets in the Catalyst Control center. Easy. Just do your setup, go to Presets (second item in the accordion) and click on Add Preset. Name the preset so you can recognize it. Do another setup and add it too. Now you can switch between the presets by right-clicking on the system tray icon of the Catalyst Control Center and selecting “Invoke preset”. Choose the appropriate preset, and you’re done.

Apr 142013
 

In my last post I said Grid did not support FullHD mode, but with a little tweaking it does. Grid is an older game, and it probably can’t read all the hardware info from the newer graphics cards. Mine has 3GB of RAM, but the restrictions in Grid won’t allow you to go beyond a width of 1280 when your system has less then 270MB. So Grid must not understand 3000MB.

Here’s how to change the config files. Make a backup of each file first, in case you screw things up.

1) c:\steam\steamapps\common\Grid\system\hardware_settings_restrictions.xml
Find the line containing:

<res mem="270" maxWidth="1280" />

and change the value of maxWidth to 1920.

2) {userdocuments}\Codemasters\GRID\hardware_settings_info.xml
Add the 1920×1080 resolution by adding the following lines:

<resolution width="1920" height="1080" aspect="normal">
    <refreshRate rate="50" />
    <refreshRate rate="60" />
</resolution>

3) {userdocuments}\Codemasters\GRID\hardware_settings_config.xml
In the graphics_card section, change the resolution settings to something like this:

<resolution width="1920" height="1080" aspect="16:9" fullscreen="true" 
            vsync="1" oldWidth="1920" oldHeight="1080">
    <refreshRate rate="60" />
</resolution>

Start GRID. It should work. It will ask you if you want to keep the new resolution of 1920×1080 and after that you’re good to go. Have fun.