May 182017
 

Recently my employer gave me a brand new MacBook. Never had one, but so far I’m impressed and I like it a lot. One thing to know is that MacBooks or MacOS in particular, are not supported by my employer. You can get one, but basically you’re on your own if something breaks (software, hardware is covered).

The first day of using the machine, I noticed a recurring popup, asking me to participate in my employers Device Enrollment Program. Which is weird. The device enrollment program enables organisations to remotely manage the device, so deployment of new software for example is made possible that way. But….MacOS is not supported by my employer, so why the popup?

After some inquiries I learned that I could “safely ignore the popup”. Right. Everytime an annoying popup, distracting me from what I am doing at that moment, cancelling it by clicking on it. And repeat that every ten minutes or so. Not the answer I was hoping for.

There is a way to disable the popup. You need administrator rights and it involves a couple of reboots, but after that, it’s gone. Here’s how.

– Reboot the machine in recovery mode. This can be done by pressing and holding COMMAND + R when the machine reboots
– In recovery mode choose Terminal from the Utilities menu
– In the terminal window, run the command “csrutil disable” and reboot the machine when asked
– After logging in, open a terminal window and give the following commands:
-> sudo mkdir /Library/LaunchAgentsDisabled
-> sudo mkdir /Library/LaunchDaemonsDisabled
-> sudo mv /System/Library/LaunchAgents/com.apple.ManagedClientAgent.enrollagent.plist /Library/LaunchAgentsDisabled/
-> sudo mv /System/Library/LaunchDaemons/com.apple.ManagedClient.enroll.plist /Library/LaunchDaemonsDisabled/
– Now reboot the machine, again in Recovery mode by pressing and holding COMMAND + R while restarting
– From the Utilities menu start a Terminal again, and run the command “csrutil enable”. Reboot the machine when asked

This should do it. You can check if the popup is gone by issuing the following command in a Terminal window:

-> launchctl list | grep enroll

This should come up with no (empty) results.

The “csrutil” tool is to disable or enable the System Integrity Protection. You should re-enable it (so don’t skip the last step), because it gives your system an extra layer of protection.

Oct 192016
 

I’m using node.js on Windows. Not ideal, I know. Installing node modules globally means something else than you might expect. Globally means “not in the project folder”. It does not mean “for all users on this computer”, like you’re used to when installing applications.

Node itself is installed in the “Program Files” folder by default. To enable a Windows-like “global” install, try using:

npm config set prefix "%ProgramFiles%\nodejs"

That way the “–global” directive will install the module in the node folder itself, making it available globally in the node way of thinking and in the Windows way of thinking.

Of course, if you didn’t install node.js in the default folder, just replace the “%ProgramFiles%\nodejs” with yours.

If for some reason you want things back to what it was, remove the prefix by issuing the following command:

npm config rm prefix

Oct 102016
 

My colleague needed to use a function in the database in a query, but found that the function was not defined/reachable in his schema. So the solution is to ask for the function to be granted to you, or to create the function in your schema, or…

…use the new WITH enhancement available from Oracle 12c.

Here is a very simple example, that squares a number and returns it. The function is used in the query. How nice :-p

with
  function s(x in integer) return integer is
  begin
    return x*x;
  end;
  
  q as (select 1 n from dual union all select 2 from dual)
  
  select q.n,s(q.n) from q
/
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!