Code::Blocks in Linux Mint 17.2 and Ubuntu 14.04


Recently I ran into a problem finding a solution for properly installing Code::Blocks on a Linux Mint 17.2 Cinnamon machine. I had the option to opt in and run the application on a Windows lab machine, but I said nah, I want to expose myself more to the linux environment and I want to be able to use my own laptop. So I went ahead and opted to install Code::Blocks on my Linux Mint 17.2 laptop.

After much searching I came across an obscure reference in a forum post to the problem. What was happening is that when I included printf() and scanf() in my simple terminal application it wouldn’t compile or run, the compiler complained about an assumed reference. Code Blocks would also generate errors in regards to stdio.h and that it couldn’t find the file. After further reading the solution is part of the normal compiler/code blocks installation. I was not aware, I’ve never actually compiled code on linux before. Here is what I did to resolve it.

Start by checking that your gcc is up to date. You might not need to but it is always good to run the install as it will update your gcc if it needs to.

sudo apt-get update
sudo apt-get install gcc

The above if up to date, will skip over the installation and tell you that you already have the latest packages installed.

Now go ahead and install Code::Blocks.

sudo apt-get install codeblocks

This will install the application on your computer and you will be able to run it and create projects. However this is where I initially ran into an issue where if I Included stdio.h in the source it would generate an error. Something along the lines of…

… stdio.h: No such file or directory …

There are two things that you need to do to resolve this. You need to install build-essentials and xterm.

sudo apt-get install build-essentials

The above will install the dependencies such as the stdio.h file, however if you go to compile a simple application and run it in command line or bash you will get another error. Generally an XTerm error. You will need to also install XTerm in order for Code::Blocks to be able to open up a terminal window and execute the application.

sudo apt-get install xterm

Once you have all the above packages installed give it a go and you should be able to execute and run simple c/c++ code.

PC Gaming accessories: Mouse

I’ve always used Logitech mice, except for a long long time ago when I had a dell mouse which i used with one of my first gaming/school PCs. But even prior to that I had used the basic Logitech mice. I’ve tried alternatives but I find that with most companies they don’t have the ergonomics that are necessary for prolonged gaming sessions. Logitech has done ergonomics well on mice for a long time now and it is one of the few companies that still does. I still own my older G5 Laser Mouse and it’s kicking around in one of my drawers as a backup. Somewhere else in a box, stored under my staircase, hidden in there lies an old MX 510 which I picked up at staples while I was in College. The MX 510 replaced my Dell stock mouse. Then a wireless MX700 replaced that, the G5 Laser replaced that, ang again the G700 replaced that. Then recently I thought I broke the G700, I slammed in on my desk in furious moment of rage and frustration, this messed up the scroll wheel functionality. Having thought I broke the scroll wheel I replaced the G700 with a wireless and optical G602 mouse. Yes sometimes I rage when I play games… sometimes.

From my personal experience in over 2 decades of PC gaming I can confidently say that Logitech mice are rock solid, they also have a good ergonomic shape to them. I’ve tried other mice but they just don’t cut it for me like the logitech ones, they don’t have the comfort or reliability. Logitech are comfortable mice and they can take a good beating. Having said this these mice are not without their flaws, I have not found the perfect mouse yet. Even though this migth be somewhat biased on my experience go ahead and check it out.

Also for the heck of it I will toss in a couple notes about the older mice, just to reminisce a little. But mostly this is a comparison of a couple Logitech wireless gaming mice. Note that with most wireless gaming mice from Logitech they are a bit heavier due to the added weight of the batteries. This suits me just fine, I like a bit of a heavier mouse for gaming, a lot of people don’t. If that is the case a wired mouse would be the way to go.

MX510: Great ergonomic feel to the mouse, it is a basic optical mouse and designed for non gaming. I used it for gaming a lot. It was comfortable and light. It’s still in a box in my home.418E7H3ZYHL._SX300_

MX700: This was one of my first forays into the wireless/gaming mouse territory. Great ergonomic feel and shaped much like the MX510, but to be honest I wasn’t happy with this mouse. I paid $120+ for it at the time and kept it for less than a year. I gave it away to someone. The battery life on these was terrible and the performance not much better. I understand sacrificing short battery life for a wireless experience but this mouse had very few benefits to owning it.MX700-930754-0215-R-unit

G5: Solid laser mouse performer, it has an adjustable weight tray that slides in and out of the bottom of the mouse. This was my first laser mouse, I didn’t know what I was missing with optical mice until I bought this. Weight can be adjusted by inserting and removing 1.7g and 4.5g weights into a weight tray the slides in and out of the bottom of the mouse. The threaded cable shielding proved to be a burden, and I had to eventually remove it completely. The cable underneath the shielding would get trapped and fold through the shielding. I would worry that this would make the wire inside the cable tear and this is why I removed it entirely.

G402: Dubbed the Hyperion Fury. Good basic optical mouse, comfortable and good for gaming. Light for the smaller hands as to not over accelerate when aiming or moving. If you are looking for a wired gaming mouse that is non laser this would probably be it. Although the cost of $50+ is a little too much for this. Personally I do not worth the money.logitech-g402-hyperion-furyG602: After having owned laser mice this optical wireless device lacks the smoothness and the precision that I find I get out of laser precision. I find that the profile of this mouse is a little too low as well. Since I like to rest my palm on the mouse, and my hands are rather big, in longer gaming sessions my hand will start to cramp up. The battery life is amazing on this device, it takes 2 double AA batteries, and has a switch on top of the mouse to switch it into performance or endurance mode. Endurance mode allows it to sip juice from one battery at a time, and grants the user 1400 hours of device usage. Performance mode on the other hand allows it to shine in gaming at full power giving you a lesser 250 hours of use. I assume the switch changes the polling rate at which the mouse tracks movement across a surface. Personally I find this mouse ok for gaming, I’m not a fan of optical technology as any imperfections in your polling surface, such as grease and dust will mess with the optical sensor and it’s accuracy. Other than the optical sensor, the mouse it is fully featured and does not lack in other functionality, although the construction feels a little flimsy. The software is ok, just ok, but then again I never use the G software with any of the Logitech devices. I don’t much care for macro functionality as I don’t play MMOs and the software annoys me more than anything else, so it’s never on my system. Since the battery life on this is rather long this device omits the USB cable/charging option like the G700/s has. It’s a shame as the last thing you want to be doing during a gaming session is fumbling for a fresh pair of batteries. One thing to note about this mouse is that the Middle Mouse Button was dead right out of the box. This seems to be a hardware defect as stated by Logitech to one of their user on the forum. This defect also seems to be plaguing a lof of devices across this line of mice, so it is not a matter of getting a lemon out of the bunch but rather a hardware design flaw. Also the G602 has 6 thumb buttons, that’s 4 to many, and since the software is useless, that’s 4 buttons without a function. I haven’t tried it but perhaps they can be mapped directly in game via key bindings.g602_1

G700: The g700 is  a work horse of all the mice I have had. It is solid and takes a beating. Trust me, it knows how to take a beating, I’ve abused this mouse. I like the larger profile on the mouse and it is very comfortable for larger hands in longer gaming sessions. What the g602 lacks the g700 has, precision, comfort, and a short battery life. The batteries don’t last nearly as long as they do in the g602. Having said this unless you do 12 hour gaming sessions that will not be an issue, also unlike the g602 the g700 has a micro USB plug at the front so you can charge the battery and game as if you would with a wired mouse.g700

The G700s is it’s successor with minor alterations to the design, such as the sensor and the coating on the mouse which add better perspiration protection and grip. Mostly cosmetic changes over the G700. Worth every penny you pay for this mouse. I have had my g700 for 3+ years, it hasn’t skipped a beat, it’s amazing for gaming and I highly recommend it. I bought one for my buddy on his Birthday last year, he loves it as well.logitech-g700s-910-003584-rechargeable-gaming-mouse

Mousepad: The surface on which you game makes a huge difference, especially if you are using an optical mouse, not so much with a laser mouse. The optics of a mouse can be impeded by dirt, dust, or any other form of surface that is not uniform. Also try using a glass surface with an optical mouse, it will not happen. A proper mouse pad will not only provide you with a clean surface for a mouse it will also provide you with a surface that gives very little friction and resistance to mouse movement. Your acceleration will not be impeded and depending on the type of mouse pad might actually improve. I prefer the hard mouse pads over the cloth ones they are generally a low resistance surface that aid in mouse precision.mouspad

Mouse software: Do not use the G software with these mice. I noticed that the software resets the mouse values and settings, which was odd, but it did that. As soon as I removed the mouse software, immediately the mouse started functioning properly again. That is a huge fail on Logitech’s part. Other than that I appreciate the mice, they are basic, ergonomic, and for the most part reliable. 

Deploying a WSUS environment with GPO

WSUS or Windows Server Update Services is used on a local network to approve or reject Windows updates and security fixes. The benefits of this system of delivering updates is that it allows you as much or as little control over updates as you want. It’s all about choice. So if you do not want the Windows 10 OS update rolling out to your Windows 7 desktops, you have the ability to prevent that.   

For Server 2012 R2 it’s quite easy to install WSUS. Start up the Server Manager, click Add roles and features, and under Server Roles and Windows Server Update Services select WID Database and WSUS Services. Install the WSUS server role.setup1


Once installed,start up WSUS and you should be greeted by the WSUS Server Configuration Wizard. If that is not the case you can start it manually from the WSUS Options.

There are a few things you should note before you start.setup3

Join the improvement program if you wish. I generally opt out.

Choose the upstream server. If this is your only WSUS server on the network you will synchronize your updates from Microsoft. Otherwise you can opt for another WSUS server on your network.

Set a proxy server if you need to.

Then you will connect to the upstream server by clicking Start Connecting button. This process can take a while and it can actually fail on your first try. Be patient, grab a coffee or something.setup4

Choose the language that you want all your updates in.

Choose which OS or Microsoft Software you want to receive updates for.

Pick which types of updates you want. Generally I pick critical, definition, and security updates.setup7

Configure the Sync Schedule. This sets the time at which WSUS checks for new updates and pulls them down from Microsoft. I generally set this for after business hours.setup8

You can now start the initial sync of Windows Updates for the products you selected, go ahead and grab a long lunch, this can take a while.

Now you can set a couple of other options in the WSUS application. I like to set the Automatic Approvals. This way I’m not approving hundreds of updates every week. I set the Critical and Security updates for WIndows 7 desktops to automatically approve. You can also set it up for a specific group of computers. You can set this group up either manually or via Group Policy. I will cover the group policy method later in the post.setup9

Next go to Computers in WSUS options and select Use Group Policy or registry settings on computers. This option allows you to use group policy to set the computer group membership. This is the preferred method. Close it, the next time the sync runs it should pull all the updates down. Please note that generally during initial setup, when I ran the manual sync it would more often than not fail. I had to wait for WSUS to pull the updates automatically on it’s scheduled evening run.

Now you will have to create two Group Policy Objects. One of the GPOs will be used to set the local update server and other Windows Update options. The other GPO will be used to log users off prior to the updates being applied on the computers. The reason I do this is that the computer will not restart after the updates are pushed if there are any users logged into the computer. The restart is a necessary part of the update.

Here are the things you want to consider when creating these GPOs; when will you be applying these updates, what time of day, which day of the week? These are all questions you should be asking yourself. For instance on my network I schedule my updates for every Wednesday at 10 PM or 22:00. On that same Wednesday evening at 9:30 PM all users are logged off every machine on the network. You don’t want to interfere with your employees but you also don’t want the computer to break from a bad patch or update on a Friday morning. You want to avoid spending the entire Friday and parts of the weekend fixing broken software.

Let’s create the Windows Update policy first:

Open up the Policy Manager either on the server or via Remote Administration Tools.

Create a new policy and name it something like WSUS_Desktops. This will be the desktop update policy and will reside in the OU where all the Network computers are.

Link the new policy to the appropriate OU, it is a good practice to test a policy prior to rolling it out, so maybe first link the GPU to a test OU, or set Item Level Targeting for the time being. This is how I do it on my network.

In the New GPO navigate to Computer Configuration, Policies, Administrative Templates, Windows Components, and Windows Update.GPO1

Open up Windows Update to view the policies in there.GPO2

I only care about 5 of those policies. You can get away with using as few as 2 to push Windows Updates via WSUS using a GPO.

Configure Automatic Updates, this policy setting sets up how the updates are downloaded and how they are scheduled to install. I use option 4 – Auto download and schedule the install. I schedule the install time for every Wednesday at 22:00 or 10pm. Enable it and set the options accordingly for your environment.

Specify intranet Microsoft update service location, this policy setting points the computers to the server where you installed the WSUS application. Please input the http address of the WSUS server and port, for example http://server-name:8530. You don’t need to use a FQDN. If you need to find the port number for your WSUS instance remote into the server where WSUS resides, open IIS Manager, and select Sites, in the right pane you will see all the running websites and which port they are on.GPO3

Enable the policy and input the address in the two fields under the options pane, same address for both the intranet update service and the statistics server.

Automatic Updates detection frequency, this sets the interval at which the desktop computers check back with the WSUS server to see if there are any new windows updates. Default is 22 hours, this setting is optional.

Turn off the upgrade to the latest version of Windows through Windows Update, this will prevent the dreaded Windows 10 update from appearing on your Windows desktop. This is optional but a wise choice if you choose to enable it.

Enable client-side targeting, this policy setting has only one purpose, it is to set the target group in WSUS. Whatever you the group name, this is what the computers that apply this group policy will be sorted under in WSUS. Do not forget to change the Automatic Approvals in WSUS to this group and make sure all the auto approvals are pointing to the right computer group name. The policy will not auto generate the group in WUSUS, you need to manually create it. Once you create it the computers will be auto added to the group.

One thing to consider is that you might want to change the Security Filtering for the GPO. I changed mine to Domain Computers and removed Authenticated Users, since this policy only targets the machines and not the users this made sense. Once the policy is in place for few minutes, you can run the gpupdate command in command line on your test desktop to attempt and update the group policies on said computer.

Then you can check to see which update server the computer is pointing to by running the following command with elevated privileges on the test desktop…

REG QUERY “HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate”

This will show you the WUServer property, which is the Windows Update server address.

If this value or property is not present then then the group policy has not been applied yet, you might need to reboot. Alternatively you can try to manually register the computer with the server using the following command, wuauclt /detectnow.

Once you have that working, now you can create a group policy to log users off before the updates roll out each week. This is necessary as the computers might not reboot if users are still logged on to the desktops during the update process. Users need to log off so that the policy can reboot the PCs and roll out subsequent Windows Updates.

Create a new policy and name it something along the lines of Users Log Off. Link this GPO to the appropriate OU, one where all the network users reside. Again you might want to test the policy first before deploying it to everyone in your Domain. Open the GPO to User Configuration, Preferences, Control Panel Settings, Scheduled Tasks.

Create a new task and call it something along the lines of “Log Off Notify”. This task will notify users 15 minutes prior to logging them off to have them save their work as not to lose it. The task should look similar to the following.

Note the Action for this task is Display a message the message reads “You will be logged off in 15 minutes. Please save and close all your work if you do not wish to lose it.“

In the same Group Policy create another task and call it something along the lines of “Windows Log Off”. This task will log the users off their computers prior to the Windows Updates being applied. It should look like the following.

Note that the Action for this task is Start a program and you are running a force log off command using cmd.exe and switches.

That is it! Run some tests on your test computer to see if the Tasks are being pushed to your workstation. Test the tasks, make sure they work.