# Changing the Steam icon in Ubuntu 16.04

The official tray icon for Steam looks good with Ubuntu’s Ambiance theme, however, it doesn’t adjust its color when you change to the Radiance theme.

Luckily, in order to change the icon, all you have to do is replace the existing icon: /usr/share/pixmaps/steam_tray_mono.png

The icon is a 48 x 48 png image, so I suggest you use the same. Originally I tried modifying the colors of the official icon, however, it didn’t seem to look good with the new coloring once it was shrunk down to size.

Instead, I took an alternate icon from another article and modified the color of that one. (Note that the instructions in that article are out-of-date.)

Just save one of these images onto your computer as custom_icon.png, then browse to that folder in the command line. Once you’re in that folder, run the commands below. The last two commands set the permissions and ownership of the file to match the other files in the pixmaps folder. The icon should change within a few seconds of copying it in.

sudo mv ./custom_icon.png /usr/share/pixmaps/steam_tray_mono.png
sudo chmod 644 /usr/share/pixmaps/steam_tray_mono.png
sudo chown root:root /usr/share/pixmaps/steam_tray_mono.png

# Creating Launcher Icons in Ubuntu (14.04)

### TLDR

sudo apt-get install --no-install-recommends gnome-panel
gnome-desktop-item-edit ~/Desktop/ --create-new
sudo mv ~/Desktop/name.desktop /usr/share/applications/

### Full Version

Sometimes programs you want to install in Linux come as nicely packaged deb files, making them easy to install. Other times programs come as a folder with a shell script *.sh inside that you are supposed to run through the command line. This can be annoying, and some of us want to create a launcher icon so that we can search for it in the dashboard or add it to the sidebar.

I’m running Ubuntu 14.04 right now, and here is the easiest way to “install” those kinds of programs without having to manually edit config files or run tons of commands. I’m going to use the installation of the program SmartSynchronize (a file comparison utility) as an example.

• First, download and unzip the program. In the case of SmartSynchronize, we will have a “smartsynchronize” folder as a result.
• Create a new folder called “.bin” inside your home directory, and copy the smartsynchronize folder inside. If you can’t see the folder (folders that start with a dot are hidden folders) then push ctrl-h to view hidden folders.
• Install the ubuntu-panel application. This can be done through the Ubuntu Software Center, or using the command below.
sudo apt-get install --no-install-recommends gnome-panel
• Run gnome-desktop-item-edit with the options below, and use the resulting GUI to create an launcher file. These files end in the “.desktop” extension, but you can’t see the extension if they are on your desktop. They are basically a shortcut to launch a program.
gnome-desktop-item-edit ~/Desktop/ --create-new
• Fill out the information:
• Type: Application
• Name: Don’t use spaces and just type the name of the application. This is the name of the “.desktop” file that will be created in the next step.
• Command: Browse inside the folder you placed in the “.bin” folder, and find file that is used to launch the program. Usually this is a file ending in “.sh” that is inside the downloaded folder called “bin”.
• Comment: This can be anything and isn’t really that useful.
• Icon: Click on the icon to browse for a new icon. Usually the icons are located in the same folder as the file you chose for the command. Just choose the highest resolution icon available.

• You should now have a “<name>.desktop” icon on your desktop. In my case, this created a “smartsynchronize.desktop” folder on my desktop.
• Now all that is left is to copy that file into the correct folder. You need root to do this, so it is easiest to do it using the command line. Just make sure to replace “name.desktop” to the name of the file you created in the last step.
sudo mv ~/Desktop/name.desktop /usr/share/applications/

In Ubuntu 14.04 the changes should be effective immediately. Just search in the launcher for the program name and it should show up. Then you can drag the icon to your launcher if you want.

# How to Compile MPLABX Projects from the Command Line

Within the past couple of years, Microchip has released MPLABX, a Netbeans based IDE for their microcontrollers. The IDE works great and makes it easy to develop and build your projects; however, building releases locally on developer machines is not the ideal way to be releasing software. Continuous Integration (CI) and build servers solve this problem and are in widespread use by the software industry, but I am surprised that I don’t see more embedded developers using them.

I suspect that one of the contributing factors for this is that setting up embedded toolchains can be complicated and time consuming. Continue reading

# How to Change Back to the Keyboard on the Samsung Note 10.1

I just recently bought a new Samsung Note 10.1 tablet, and it is a tablet with a stylus. It has a text input mode where you can write the text by hand and it changes it into typed text. Think back to the old Windows CE devices, but handwriting recognition that actually works surprisingly well.

Anyways, the reason of this post is that, embarrasingly enough, once I switched to the handwriting recognition mode, I couldn’t find any way to switch back to the regular keyboard. It was hard to find a solution when I Googled for it, so I figured I would put it here to help out anyone else having issues.

So, long story short, to close the handwriting recognition keyboard and switch back to the regular typing keyboard on the Samsung Note 10.1, follow these steps (or just look at the picture below):

1. Click and hold on the gear icon (the three little dots actually suggest that you can click and hold for more options)
2. Click on the icon of the keyboard that pops up

# How to Change the Firefox Button Color and Text

Firefox seems to change how the settings for the Firefox button work with every release, meaning that most of the tutorials explaining how to do this are either broken or buggy. Here is another tutorial on how to change the color of the Firefox button, but this time I am going to keep the article up to date with the different versions of Firefox that it works with.

These instructions below have been verified to work with Firefox versions 22-28. Here is how to do it:

1. Start Firefox
2. Click on Firefox Button >> the arrow next to Help >> Troubleshooting Information
3. Under the Application Basics heading, click on the Show Folder button next to Profile Folder.
4. After clicking the Show Folder button, a folder should have opened in your computer’s file manager. Within this folder, manually create a new folder called chrome.
5. Go inside this newly created chrome folder and either:
1. Download the userChrome.css file I have attached to this article and place it into the chrome folder.
2. Create a new file called userChrome.css (inside the chrome folder) and enter the following text into it. (Make sure that you name the file userChrome.css and not userChrome.css.txt or else it won’t work).
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
background: #D4D4D4 !important;
}

color: #FFFFFF !important;
}

display: none !important;
}
6. Restart Firefox and the changes should take place immediately.
7. You can edit the background and color properties, then restart Firefox, to tweak the colors to your liking.

If you have any questions, then either email me directly or ask in the comments below. If there is demand, I can quickly create a video showing how to do it.

Attachment: userChrome.css (right-click on the link, then save it to your computer).

# How to Send a UDP Packet in Python

Recently, I ran across a problem where I wanted to automate the testing of a microcontroller for which I was unable to modify the locked down embedded software. Moreover, the microcontroller could only communicate over an Ethernet network using TCP/IP and UDP. Sending either a TCP or UDP packet onto a network is a very easy thing to do using Python, but takes a little bit of knowledge about networking for it to make sense. In this tutorial I am going to give the most bare-bones and simplest possible way to send a packet of data over a network using UDP.

### Sending a UDP Packet

So, without beating around the bush, here is how to send a UDP packet.

import socket
PORTNUM = 10000

# enter the data content of the UDP packet as hex
PACKETDATA = 'f1a525da11f6'.decode('hex')

# initialize a socket, think of it as a cable
# SOCK_DGRAM specifies that this is UDP
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)

# connect the socket, think of it as connecting the cable to the address location

# send the command
s.send(PACKETDATA)

# close the socket
s.close()

Pretty easy. The only things you would need to change are the IP address you are trying to send the data to IPADDR, the port number you are trying to send the data to PORTNUM, and the data you want to put inside the data of the UPD packet, PACKETDATA. Now, you might be wondering what .decode('hex') is used for.

This is necessary if you want to input the data to be transmitted as hex (which is usually the case in networking). If you didn’t include that statement, the data would be sent as a string (in a different encoding) instead. This would mean that if you looked at the data portion of your packet in Wireshark, you would see something different than what you put inside the string for PACKETDATA.

### Handling Basic Exceptions

Like I said before, this is the most bare-bones way to send a UDP packet over a network. No fancy stuff involved. There is however, one thing that to add that is very helpful. If the socket fails to connect, you will get an exception. One way you can deal with this is to simply ignore any exceptions. This can be done by modifying your UDP script to include a try and except.

try:
# code to try
except:
# do this code if there is any exception, or use 'pass' to do nothing
pass

So then, your new program will look like the following:

import socket

PORTNUM = 10000

# enter the data content of the UDP packet as hex
PACKETDATA = 'f1a525da11f6'.decode('hex')

# initialize a socket, think of it as a cable
# SOCK_DGRAM specifies that this is UDP
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)

try:
# connect the socket, think of it as connecting the cable to the address location

# send the command
s.send(PACKETDATA)
except:
pass

# close the socket
s.close()

Good luck!

# Setting Default Properties for the MathJax Module for Drupal

This is going to be a quick tutorial on how to set default properties and options for the MathJax Module for Drupal. I recently switched my Math (LaTeX) rendering module to MathJax, and I was having a hard time finding information on configuring the default setting with which the math equations would load.

### Finding the File with the Default Settings

The problem with LaTeX is that while the equations look great, often times when viewed on the web, the smaller letters and symbols in math equations can be hard to make out. Luckily for us, MathJax has some nice features which are accessible through a menu when you right-click on an equation. You have options such as enlarging equations on mouseover, saving equations as an image, etc. The downside to the right-click menu is it might not be obvious that such a menu even exists for a user visiting your website.

So, I set upon my quest to make this better. I decided that I would change the default behavior of the equations to enlarge on mouseover since I figured that this would be much easier to discover for a person browsing my site. Unfortunately, the documentation for the MathJax module for Drupal is pretty non-existent. What’s more, the information on the official MathJax is not directly applicable to the MathJax module for Drupal since some files have been renamed and some functions moved. So I am just going to tell you right here. If you want to change the default settings for the MathJax module for Drupal, you will need to put your code in the Mathjax.Hub.Config() function in the mathjax.js file located in the /sites/all/modules/mathjax directory.

You can see a picture below which shows you where to put your code. I added two the lines which are highlighted blue, with the big red arrow pointing at them! The two settings I changed were to make the equations would enlarge on mouseover, and set the delay before enlarging to be 50 ms.

### Where to Find MathJax Options

If you are wondering what kind of settings you can change and where you can find the code for changing these options, you can find it buried down in the official MathJax page over here. Once you have found what you want to change, add it into the mathjax.js file like I showed in the picture above. Make sure that you put your code as a separate line, surrounded in single quotes with a “+” at the end of the line, and don’t forget the comma on the inside of the right-most quote. Just look at the screenshot and you will see exactly what I mean. A small warning, though, is that the last line inside of the Mathjax.Hub.Config() function shouldn’t include the comma that I just told you about. This will supposedly fix some compatibility issues with certain versions of our beloved ? Internet Explorer ?.

### Clearing Drupal’s Cache

Now, before you start telling me that my tutorial is a load of junk and that your changes to the file aren’t taking effect, make sure to clear Drupal’s cache and then refresh the page. Updates to JavaScript files used on a Drupal website won’t take effect until Drupal clears its cache. To do this manually, open up your Drupal administrator menu and go to “administration > configuration > development” and click the “Clear all cahces” button. You can see how it looks in the screenshot below.

Here is any example of a math equation with the default settings applied. As you can see, some of the smaller characters are hard to make out, so hovering your mouse over the equation will make it easier to read. I hope this saves you some trial-and-error and frustratingly digging through files!

$cos(t)=\frac{e^{jt}+e^{-jt}}{2}$

A word of warning however. You will have to re-do any changes you made if you ever update the MathJax module.

# Configuring Thunderbird to Work and Play Nice with GMail

This tutorial is going to explain how to configure Thunderbird 3 to work the best with GMail. In Thunderbird 3, the account creating wizard makes it easy to connect to GMail, but there are a lot of different settings that need to be adjusted to make the program work even better. This tutorial will explain how to adjust all the settings so that Thunderbird will works as smooth and properly as possible with GMail.
As example of a problem, if you don’t specify your search and folder settings properly, you will get duplicate messages making it hard to find aynthing when you search. Another example is that when you delete items through Thunderbird, it will create an additional Trash label in GMail.

One more thing to note: For security reasons, I will not be using any extensions or plugins for Thunderbird. Let’s get started!

The first thing you have to do is configure your actual GMail account. To do this, log into your GMail and then click on the gear icon in the top right corner of your email, then Mail settings. For some reason Google decided to use a nearly identical icon as the settings icon in Internet Explorer 9, so do not confuse the two. You can see where to click in the screenshot below.

Now that you are in the settings, click on the Forwarding and POP/IMAP tab. The settings you want to choose are Enable IMAP, Auto-Expunge on, and Do not limit the number of messages in an IMAP folder. You can see the correct settings in the screenshot below.

Make sure to push Save Changes when you are done with this tab

The last settings we need to change are located under the labels tab. Under System labels you can see your usual GMail labels. In Thunderbird these will show up as folders. For each label that you want to appear in Thunderbird, you need to check the corresponding Show in IMAP checkbox. Under the System labels, check the Inbox, Starred, Sent Mail, Drafts, All Mail, and Spam. Un-check all of the other boxes unless you want them to appear in Thunderbird as a separate folder. I decided to un-check some GMail features like their Important and Chats labels, because part of the reason I use Thunderbird is to get away from all the feature bloat, social networking, and advertising that Google keeps throwing in my face.

Make sure, however, that the all the labels with arrows (except for Starred which is up to you) are checked.

Now that your GMail account is all set up and ready for Thunderbird, we are ready to add the account in Thunderbird. Click on Tools > Account Settings…

Next click on Account Actions > Add Mail Account…

Now type in your gmail settings and push Continue. Thunderbird will automatically configure the server deails, and unless something went wrong, you should see the screenshot below. Make sure that IMAP (remote folders) is selected, and press Create Account.

### Configuring Thunderbird 3 for the Best Settings

Now that your account is created, you could technically start using Thunderbird for your email. But we will make sure that all the settings are set in the best way possible to make work nicely. If you just added your account, the Account Settings window should still be open. If it is not, click on Tools > Account Settings… from the main menu.

#### Server Settings

To start, click on the Server Settings item. The first thing we will do is make sure that deleting messages is handled properly. Under When I delete a message choose Remove it immediately. If you leave it as Move to this folder: Trash, GMail will remove still get rid of the messages from your Inbox, but it will also create a new label called something like Gmail/Trash and tag all of your deleted messages with it. This won’t ruin anything, but why have an extra label that does nothing.

The other settings under Server Settings like Check for new messages at startup, or Check for new messages ever X minutes don’t matter because in IMAP, everything happens in real time automatically. Here is how I have it set:

#### Copies & Folders

Next, click on Copies & Folders. This page is important. Just look at my settings in the image below and set it exactly the same. What you are doing here is telling Thunderbird not to save copies of sent messages, becaues GMail automatically does that for you, and automatically places it in the Sent folder. I am not sure what Message Archives does, but I know that you don’t need it. By setting the Drafts options, we are telling Thunderbird that to save any unfinished emails in to GMail’s Drafts folder on the web. If we left it as the default settings, when you save an un-finished message, it would store locally on your computer. This means that if you logged into GMail from a different computer, the saved message would not be there. I don’t use Templates, so I just set it to GMail so that if I ever did, they would be synced with the GMail server.

Here are the proper settings:

Here is how you set the Drafts folder:

#### Junk Settings

The next thing we have to fix is the spam/junkmail settings. Click on the Junk Settings page and make the settings how I have them in the screenshot below. GMail already has built in spam control which works very well, so we don’t need to use the Thunderbird built in spam control. I have my email posted right on my website, free for anyone to see (including spam-bots crawling the web to harvest emails) and I rarely have a single spam message slip through. Under Move new junk messages to, choose Other and set it to the Spam folder on GMail. This makes any messages marked as Junk (the terminology Thunderbird uses) go into GMail’s spamp folder. This way if a spam message ever slips through, you can mark it as spam simply by clicking the Mark as Junk button within Thunderbird. If you didn’t set this up, marking messages as spam from within Thunderbird has no effect.

Here are the proper settings:

Here is how you set the Spam folder:

#### Synchronization & Storage

Next open the Synchronization & Storage page. Here we are going to make sure that Thunderbird downloads all the messages, regardless of their age, and stores them forever. This way you will have access to all of your email messages, even if you don’t have an active internet connection. It also means that Thunderbird won’t have to re-download the messages if you try to open something that hasn’t been downloaded before. The last thing this does, is that it makes searching from within Thunderbird work very well, since what would be the point of searching if you were only looking at 10 percent of your messages?

Below are the proper settings:

Now we are done with the Account Settings menu, so click on the OK button.

Next we have to do some finishing touches in the Options menu. Click Tools > Options to open it up. Click on the Security icon, and then the Junk tab. Check the box next to When I mark messages as junk > Move them to the account’s “Junk” folder. For some reason, unless you do this, when you mark a message as spam, it will get marked as spam, and just sit there… This makes it so that if you mark a message, it immediately gets tossed in the Spam folder and it’s gone. Here is a screenshot of the settings:

Now while the Options menu is still open, click on the Composition icon, and then the General tab. I left everything here as default for my personal setup, but here is where people might want to change settings. Where it says Auto Save every X minutes, some people like to put it to something more frequent, for example save every minute. The problem with setting it too low is that because Thunderbird is saving the message to the GMail Drafts folder, you will get a message that it is sending something every time it backs up your draft. It can get annoying very fast. Click the OK button to save and exit out of the Options menu.

#### Search Settings

We are nearly done! The last thing we need to do is make sure that when you are searching for messages, that you don’t have duplicate messages coming up. If you have a message in the Inbox, it will automatically also be in All Mail. So when you search, Thunderbird will actually find both, and show you both. To make sure that this doesn’t happen, one by one, perform the following procedure on every folder except All Mail, Drafts, and Sent Mail.

Right click on the folder located in the bar on the left of the program and select Properties. Un-check the box next to Include messages in this folder in Golabl Search results. Push OK.

When you are doing the Spam folder, you should also click on the Synchronization tab, and then un-check Select this folder for offline use. This will keep Thunderbird from download hoards of useless Spam and taking up space on your hard drive. Keep in mind that you will still be able to look inside of this folder just like you would any other folder. The only difference is that you might not be able to do it offline, and sometimes it might take a little longer to load.

#### Favorite Folders

The last thing to do is completely optional, but you can right-click on a folder, and mark it as a Favorite Folder. This way you can mark all the folders you use as favorites, and then you can click the black triangle shaped arrows (I marked it with a red arrow) to change your view.

Keep clicking the arrow until it says Favorites and only shows the folders you marked as a favorite. Doing this lets you hide the Spam folder, which will eventually fill up with hundreds of unread spam messages, and you have to keep right-clicking on it, and then doing Mark Folder Read if you are as compulsive about it as me! Here is how the final setup should look. Nice and neat, and functional.

#### Finishing Touches

The last thing you might want to do is log back into GMail, and delete any of the labels that Thunderbird automatically created before you had it configured like this.

Wow this was long! Hopefully it was worth it and will help you configure Thunderbird to play nice with GMail! If you have any questinos (or if you have some tips that I missed which you would like to share) feel free to leave a comment!