Which Programming Language Should I Learn?

This question is asked by many new aspiring programmers. There's been many different answers to this question. Some people explain that the language isn't as important as a basic understanding of algorithms and programming paradigms. I agree with this, but it's no the complete picture.

What are you going to be doing with your programming skill? Are you going to use it to obtain a full-time job? Are you going to use it to work on your own projects in your free time? Many people would answer that they have some great app idea that they want to implement. Others can't even tell you why they want to learn to program.

If you are planning to make money in some way from your new skill, you'll probably want to look into which languages are most in demand. For instance, I program in PHP and Javascript because that seems to be what I can find the most work doing. The slippery slope of this is that you eventually move into specializing in a specific language even more. If you are working with PHP as a full time job, you rarely have an opportunity to explore new languages. You're also unable to claim experience in other languages because you've spent years working with one in particular.

So, my advice is to explore other languages as often as possible. If you are starting out, pick a language that has a lot of online discussion. Something like Java or Python would do nicely. These are well supported, very commonly discussed, and are easy enough to learn. Use this first language to learn specific things about programming. You can learn the syntax of the language as you learn algorithms and paradigms. Explore the language enough to understand the concepts of programming. You don't have to become an expert in the language, but you should focus on understanding the abstract ideas used in modern programming.

I started out learning Perl and Bash scripting a long time ago. I soon changed over to VBScript and VB.NET because I was working for a Microsoft shop and needed to do some scripting and app development. I lacked a lot of the basic knowledge that I should have been working on, but I thought that I needed to learn languages.

A language is nothing more than a set of syntactical rules for structuring your thoughts. Think of learning French. You could teach someone all the words needed to speak French. You could teach them how to structure a sentence, but that isn't enough for the person to know how to communicate. Take this English sentence as an example:

You jumped over the computer.

It's a complete sentence. It has a subject, a verb, and is a complete thought. However it wouldn't make sense if you were to say that after being asked:

Are you coming over after work?

You have all the necessary skills to create a full working sentence, but you have no idea how to communicate with another human. That is similar to learning a programming language. You can write "Hello, World", but can you do something as simple as writing a recursive algorithm? Can you find more efficient ways to do things? There's a lot more to programming than the language. The language is only important later on when you need to choose a better tool for a specific task. You may need to write a website with a lot of real time interactions. NodeJS. You may want to write a game for iOS. Objective C or Swift. You may need to write an Android app. Java. You may need to write some mission critical optimized system code. C, C++, or Assembly. You may need to interface with some off the wall E-Ticket system and generate some Excel reports on a Windows-only domain. VBScript or .NET.

The point is unless you are in the same job for the rest of your life and the world doesn't change, you'll probably end up needing to know a dozen or so languages at least. An introduction to programming, should be in pure pseudocode, because I think beginning programmers get too caught up in the language and miss the more important details of programming that is being taught.

At the same time, I've had introductory to programming type classes that I look back on now and realize that the teachers had no idea what they were trying to teach. They didn't even understand the concepts themselves enough to explain them to someone else.


No Comments

Why Pay for PHPStorm or Other JetBrains IDE?

If you spend any amount of time working on code, you probably have a favorite text editor or IDE. Everyone has their own opinions. Everyone has applications with which they are  more familiar. I've went through a few different choices over the last few years, but the one I've stayed with 95% of the time during the last two is PHPStorm from JetBrains, which is uncharacteristic of me, because if there's a free version of some category of application, I'll usually make that free version work, rather than pay for commercial software. There's a ton of free IDEs and text editors. Why would I spend money on PHPStorm? Over the next few paragraphs, I'll go into detail as to why I can no longer function at 100% efficiency in any other editor. I'll also mention some things that I wish were better in PHPStorm. When I discuss the good things about PHPStorm, remember that no single thing is the reason I use and pay for the IDE. It's the overall combination of all the features that I like. Most of these individual features are available in other editors. Where PHPStorm shines is it's ability to deliver all the features I want and need in a single application.

An IDE Needs to be Organized!

There's a lot to be said about the readability and organization of an IDE. A modern text editor needs tabs. It also needs the ability to split the active editor window to see code side-by-side. PHPStorm has both of these features. It also has project and structure views which are collapsible. It has an amazing find feature that can be used to search the entire project or within a specific directory. It can search for files or text within those files, and this search is fast. It has a built-in terminal which is also collapsible. It has complete support for working with various SQL databases directly from within the IDE. There's no need to open up a command line database interface or another app like MySQL Workbench. All of that is built into the IDE.

The IDE stays out of your way while you work.

I typically have my editor window taking up most of the screen with all the different panels collapsed. When I need those various features, they are there, but they aren't getting in my way all the time. The version control integration is nice as well, though I usually do all of that from the command line. It shows you the current branch that you have checked out in the lower right of the window, which has come in very handy at times. You can also enable an option which shows the memory usage of the IDE and allows you to click to force a garbage collection or lower this memory usage. All menus are effective and all panels stay out of your way when you don't need them.

Great Shortcuts

I mentioned that I keep most of my panels collapsed in PHPStorm. This is possible because I rarely need them. You may be used to navigating through a project and opening files by finding them in their directory structure within the project, using a project directory tree panel of some sort. PHPStorm has this view, but I rarely need it. I usually know the name of the file I'm wanting to open. The only time I need the project view is when I can't remember the name of the file I need to edit. For all other times I use one of three different shortcuts.

Ctrl + Shift + N

This shortcut searches for file names specifically within the project. The search is very smart as well. If you have a file named user-login-modal.html for instance, and you just remember that it's named something like 'loginmodal', the search is smart enough to know you want user-login-modal.html. I use this shortcut more than any other, because I'm always jumping between different files and this is the simplest/fastest way to find them. Usually I can type about three or four characters and have the correct files as my first choose in its list.

Ctrl + Shift + F

This is a super find utility. It's fast, because PHPStorm indexes your project. It allows you to find any text within all the text of your project. This is especially useful if you have some method name that you want to refactor across your entire code base and you can't remember every specific place that it's used. I use this shortcut all the time.

Double Shift

This quick shortcut is the "ultimate super search everything" feature. You just double tap the shift key. It's like a combination of the previous two shortcuts I've mentioned. So why not just use this one all the time? I honestly can't give you a good reason that I don't use this feature more often, other than to say that before I used PHPStorm I used Netbeans predominantly, and if I remember correctly, it had the same ctrl + shift + n shortcut to open files. So, I was used to using that already. I haven't switched to double shift completely because I forget it's there most of the time. I may have to focus on using it more often now that I've brought it up.

There are other shortcuts that I use but haven't mentioned, and there are probably many that I don't use but could really benefit from utilizing. Everyone should dig through their IDE to get to know all of its features.

Easy Re-factorization

PHPStorm makes it very simple to refactor code. You can refactor anything throughout your code base with just a few keystrokes. If you highlight some text within your editor and hit Shift + F6, you will see a "Rename" dialog which allows you to change the text throughout the project. You can preview the changes before you implement them. If you rename a file, the IDE will search for it's usage throughout the project and give you a preview of refactoring that it can automatically do for you as well. You can also disable these auto-refactoring if you need to. It's just great that it's there.

Multiple Cursor

This is my favorite new-ish text editor feature that has become popular on many editors. It has become essential for me. I first started using multi-cursors in SublimeText. Soon all new text editors had the feature. SublimeText may not have been the first to have this feature, but it was definitely one of the first to do it well. PHPStorm's implementation is very close to the SublimeText implementation and very usable. However, it can get a little slow if you are trying to use more than 20 or so cursors. SublimeText doesn't get slow for me until I'm using about 1500 cursors. However, I rarely need more than ten. So PHPStorm's implementation works well for most things. If I can't do it in PHPStorm, I'll open up Sublime and take it from there. This is rare.

All Other Modern IDE/text Editor Features

All of the features I've mentioned so far are important for me. There are other features that are a must for me as well, that I should also mention.

  • An IDE should have code completion. PHPStorm is the best I've seen in this regard. There's no SublimeText plugin that can even get close to the intelligent code completion that PHPStorm has, or at least I've not found one.
  • Syntax highlighting and good color schemes is a must. I tend to like the default PHPStorm color scheme. I spend a lot more time trying out new color schemes in all text editors than I like to admit. I prefer light color schemes in PHPStorm for some reason. Most of the time I prefer dark. The main point here is to be able to differentiate between the various different "parts of speech" in the programming language, and this works very well in PHPStorm.
  • PHPStorm also has great source code auto-formatting options and makes it simple to reformat code to your preferred code style.

So, you've heard many things that I like about PHPStorm. As I said earlier, no single feature that I've listed is the reason I pay for PHPStorm. It's a huge combination of these features that makes it worth it to me. Netbeans has great code-completion, but doesn't have multi-cursor (or at least didn' the last I checked), and its white space display characters are ugly, if you are showing them. SublimeText has great multi-cursor and the text in the editor itself looks better to me, but it also doesn't have the database integration that PHPStorm has or code-completion that I consider usable. There may be plugins or packages that facilitate both of these, but I need to spend my time coding as much as possible, not digging for plugins that actually work well. PHPStorm has plugins as well, but it comes with everything you really need without adding any plugins, typically. SublimeText is a text editor first and the plugins are used to make it more like an IDE. I'd use SublimeText if I could find good plugins that facilitate most of the features that I've mentioned in this post. You'll find out more about that in a bit. Because even though I predominantly use PHPStorm, there are still times when I open SublimeText.

Why haven't I mentioned any other editors or IDEs besides Netbeans and SublimeText?

Well give me a chance and I will. Quite simply, I've tried just about every editor there is out there. I've tried most of the IDEs. I've given them all the opportunity to convince me. However, today I only use three editors/IDEs regularly. Surprisingly enough, Netbeans isn't one of them. Netbeans was my main IDE for a year or two. I still like it, but I haven't had it installed in a long time. After I switched to PHPStorm, I've not needed it. I also switched to IntelliJ for my Java dev work that I was doing on Netbeans before. Today I mainly use PHPStorm, SublimeText, and Vim.

Ah Vim! I hear some of you getting ready for an editor flame war. I love Vim. I like to use it for simple editing tasks on the command line where I don't have another editor available. You can make Vim do just about anything you want. However, I still prefer using a ready-to-go IDE like PHPStorm for every-day coding.

If PHPStorm is so great, why do I still use SublimeText Occasionally?

Here is where I give you the bad things I've found about PHPStorm and why I still use a simple text editor like SublimeText at times. It won't take long. There isn't a lot, but it would be GREAT if these were addressed by JetBrains.

Large Text Files

PHPStorm can't open up unusually large text files. It will flat out tell you that the file is too large for it to open. This occurs for me when I try to edit a 3.5GB MySQL dump file. Sublime has trouble loading it as well. Vim, however, will take it's time and chew it right up. Bravo for Vim! There is probably an option in PHPStorm to allow it to open large files, but I've not found it, and this is such an infrequent necessity for me that I haven't bothered to dig for it.

Large amount of Cursors

You can add a few hundred cursors on PHPStorm very easily, but good luck typing more than a single character ever 20 seconds or so if you do. It gets noticeable slow at multi-cursor as you add more. It takes a lot to slow down SublimeText in this regard.

I Honestly Hate Most Java Apps

I use SublimeText when I can, because I REALLY REALLY hate most Java-based applications, and I would much rather use SublimeText for this reason. PHPStorm is written in Java which brings with it some good things (like portability), but also some bad things. With enough hardware, you can overlook most of the bad, but I would much rather use a native application over one that runs on the JVM. I'm not a big fan of the look and feel of Java apps. The font rendering in Linux can be terrible, especially if you are using OpenJDK. Switching to Oracle's official JDK seems to fix most of these font-rendering issues. Java apps tend to be bloated and sluggish. There are a few things to consider about this. Java apps require little to no porting to run on different architectures. Java is a very easy language, and the easier a language is, typically, the easier it is for a bad programmer to code something in it (trust me, I know PHP has this same problem). Which leads to a higher population of un-optimized software. However, this really isn't the case with most good Java applications. They are just slower than native apps. It's nearly impossible for them not to be slower. The JVM adds a thick layer of overhead.

Finally the Main Reason I Pay for PHPStorm

It's not expensive. It's priced very reasonably. I originally purchased a personal license for $25 my first year. Renewal is around $53/yr. They just switched to a subscription model and offered two years for the price of one to current license holders. I jumped all over that. They also give their IDE away to students and open source developers...free. I've looked at KomodoIDE as well, and even though their prices have come down, it's still not where JetBrains products are. Komodo offers their full IDE which has support for most languages at $99 for a student or personal freelancer licence. However, that's a one time payment and it doesn't come with upgrades. PHPStorm's licensing gives you free upgrades during the whole year. Also, while Komodo harps on their complete package IDE's multi-language support, I tend to prefer an IDE specific to what I'm doing. PHPStorm has support for all the languages a PHP developer could be using: HTML, SQL, CSS, Javascript, XML, etc. I don't need my IDE to support Python or Java, because I don't code in either of them on a regular basis, and since I have an edu email address, I can get all of the other JetBrains products for free if I need them for personal projects. If I were to suddenly become a Python developer, I'd pay the $53 and get a year subscription to PyCharm (the JetBrains python IDE).

Also one last note... The new JetBrains subscription model isn't just available in yearly terms. There's also monthly. For a single user PHPStorm license, it's only $8.90/month for new users. You can get all of JetBrains products for $24.90/month. This is a great deal. I like to support great products, especially when they make my life easier. JetBrains lured me in two years ago with their special "half-off" offer. Now I'm hooked and gladly pay their low subscription price.

If you aren't convinced to give them a shot, know that this entire post sounds like one huge commercial for their product, and they aren't paying me or coercing me into writing it one bit. I really feel this strongly about their IDE. It makes my coding more enjoyable and more efficient. If I find something better, I'll use it. Until then, take my money JetBrains! I love your products.

, , , ,

No Comments

Safari 9 CSS Not Rendering Correctly

If your code doesn't use lesshat.less, then this won't pertain to your issue probably. In my work on https://draftorpass.com, I had an issue with CSS rendering on our lobby page in the newest version of OS X and iOS. The problem only showed itself in Safari. Safari was reporting various issues with parts of the CSS, but none of that was even related to the issue. After four hours of trying various things, I decided to run our main CSS file through csslint.net. The very first error lead me straight to the root of the issue. There was an unexpected semi-colon.

Safari is way more picky than most other major browsers. Chrome, IE, and Firefox all just ignored this issue. I'm not sure how much I like this strict behavior of Safari. In the last couple of months it has caused me two issues that were hard to track down. I remember a few years ago, IE was the browser that seemed hard to get right. Now it seems that Safari is the biggest nuisance.

Front-end development is something I really try to avoid as much as possible because of these type of issues. The frond-end designer which originated this problem hasn't been working on the project in over a year. It's not really his fault. However, his use of one function from the lesshat library is what caused our site to break on all new Safari browsers. It jacked up all of the CSS just because the function added a semi-colon where it shouldn't have. I would blame the lesshat library itself, but I mainly blame Safari. Being strict about things is great usually, but not when it breaks most of the CSS on a page.

The fix? Just don't use the lesshat keyframes function in any of your less files. Avoid it if you want your site to work in Safari.

Now I'm off to see if I can create a better fix to submit to them.

No Comments

PHPStorm Fonts in Linux

This is just a quick note as there are many suggestions online for fixing fonts in Java apps in Linux. Some require you to change some startup config options like Dawt.useSystemAAFontSettings. These are helpful, but there's one MAJOR under-emphasized change that will help tremendously. Switch to Oracle Java. Most Linux distributions use OpenJDK by default these days. This is where my font rendering problems were. I wondered why Java seemed to suck at rendering fonts in Linux... Well this is the major culprit. Don't ask me the specifics because I don't have time to dig and find the root of the problem. I can just tell you that it's a good first step to switch to Oracle Java before doing all the other things you see online to fix the problem.

No Comments

PHPStorm or other JetBrains Product Multi-select In Linux

If you have trouble using the default ALT + Button1 click keymap in Linux to add to a multi-cursor selection in PHPStorm or any other JetBrains product, you may be able to adjust the default keymap, but if you are like me, you could just as easily use an easier approach. Just add the "super" or "windows" key to the combination. So, try Super + ALT + Button1. That works for me as the desktop environment doesn't see it as an ALT + Button1 click, but PHPStorm does. Using ALT + button1 click alone causes issues for me because the Cinnamon desktop in LinuxMint already has ALT + Button1 mapped to something else, namely window move. I would change this but I actually like having that available if I need it.

No Comments

Back to Linux

I have had an on again, off again love affair with Linux since 1998. It has been an enlightening experience plagues with numerous installations and CD/DVD ISO burns. I remember the first real exposure I had to Linux. I was living with my grandfather. I was working in a factory. My hobbies were computers and playing guitar. There wasn't a lot to my life at that time. I worked, wasted money, and slept. I also chatted on IRC quite a bit. Back then, I was still on dialup so that was about the best thing to do with my internet connection.

I had a friend who some could call a bad influence, but to me, at the time, he felt like a mentor and older advisor. He knew all the ins and outs of IRC, especially on the Undernet IRC network. He went by the nick "Fud", short for "fear, uncertainty, and doubt".  He had Eggdrop IRC bots and Energy Mech IRC bots. He had shell accounts. He had knowledge of things to which I'd never been exposed.

I wanted to create my own IRC bots. So he introduced me to the idea of shell accounts. I remember configuring my first Eggdrop bot. That seemed like the most complicated thing I'd ever attempted. It didn't help that I was configuring the bot in an operating system that I'd never been exposed to at all...Unix. Unix was a mysterious word to me because I'd had no college classes and my high school had barely covered DOS.

I had learned DOS on my own. I didn't have any friends who knew DOS. My dad had bought government surplus 8088 computer and when we turned it on, we were greeted with a command line. We didn't have a clue, so I typed "help" and pressed enter. The output presented to me with that command is how I learned DOS. I felt like such a hacker, mainly because it was a retired government computer and I thought I may be able to find some kind of interesting data on it. It was really a cool way to learn DOS.

Jumping back to '98 when I was first getting into Linux, I was presented with a command prompt that looked nothing like the familiar DOS prompt that I had used before. Typing "help" didn't help. Luckily I had Fud there to help get me started with basic commands. Some were similar to DOS. Others where completely different. I was used to typing cd to change directory but in DOS to change to the parent directory (move up the directory structure) you can type cd.. all together. In Linux this would give you an error. It was required to put a space between the cd and the .. which took some getting used to.

I loved the idea of Linux right from the beginning. I felt excited mainly because I was learning Unix, that mysterious operating system that serious computer geeks knew about and a rural hick like myself had never seen. I was also excited to break the chains from Microsoft. I mean imagine it, an operating system that's completely free. Since I'd always wanted to be a programmer, there was also the added bonus that the source code was also available for most of the programs that came with the OS. Side note: I know some of you are chomping at the bit to tell me that Linux is the kernel, not the OS. Get over it. Everyone calls it Linux.

Ah my early days with Linux. Like I said earlier, I was still on dial-up, which presented two problems. First, downloading Linux was impossible. An ISO file of Linux was at least the full size of a CD-ROM back then, and for some distributions it was multiple disks for an install. It takes a very long time to download 720 megabytes when your download speed is roughly three or four kilobytes per second. So the only real way to try out many different distributions was to order them from places like CheapBytes. I bought a pack of about 10 different distros and tried them all. It included: Debian, Slackware, Red Hat, Mandrake, and others.

The second problem with dial-up and Linux dealt with dial-up modems themselves. Most modems at that time were "WinModems". They weren't "hardware" modems. They were interfaces for phone lines and such, but the actual modem functionality was handled by Windows itself. They were hardware interfaces for software modem code. These wouldn't work in Linux, and honestly they weren't as good as real hardware modems. Most WinModems used a PCI bus, and the hardware modems used the older ISA bus. The hardware modems also usually had hardware DIP switches for configuring interrupt settings and such. Hardware modems were superior, but WinModems were cheaper. So most people were using WinModems. The first thing a new Linux user back then had to do was purchase a hardware modem.

I dual-booted back then, but still stayed primarily in Windows. There was still very little compatibility with lots of hardware and commercial games just weren't available. However, I was able to learn a lot during that time. I started learning Perl. I created my own IRC bot in Perl. My first preferred Linux distribution coming from Windows was Mandrake. At the time, it used KDE and was pretty user-friendly. I learned to hate RPM. Mandrake changed its name to Mandriva, and at some point decided to charge for using it. So I switched to Debian.

I love Debian. It has been my favorite grand-daddy Linux distribution since I moved away from Mandrake. I've tried just about every major distribution that exists. Some of my favorites along the way were Gentoo, Arch, and Sabayon. However, as soon as Ubuntu came out, I, like many other Linux users, switched to it. It quickly became the most popular distribution. Ubuntu took Debian, which was already pretty easy to use, and made it even easier. Around 2004 or 2005, I started using Ubuntu 100% of the time at home. This went on for about three years. In 2007 I took a desktop support role in the IS department of the Manufacturing company I had been working at for about 9 years. Most of this desktop support dealt with Windows, so Windows became a primary OS on my home computer once again.

I've glossing over many things during this, but it's so I could get to this point. I started working for myself as a web developer and internet marketer in 2009. At that time, I had the personal freedom to use whatever operating system I saw fit to use. I used both Windows and Linux, but gravitated toward Linux most of the time. As a developing environment for web applications Linux is by far my favorite. My career path was gradually moving in a direction that allowed me to use Linux full time. I interviewed for a position with a travel agency in 2011 as a PHP developer. I went to work there and was pleasantly surprised that everyone was using their favorite OS on their work machines. Some people were using Windows 7. Others were using a flavor of Linux. I picked Ubuntu and installed it on my work machine.

It was around this time that Ubuntu started using Unity as its main desktop environment. I'd been very content using Gnome 2. Unity brought cool features with it, but it also seemed to be a huge buggy mess. I had many problems with it, both at work and at home. I switched to XFCE at work for a bit, but eventually switched to Windows 7. That's where I stayed. After seven months of working for that travel agency, I decided that Orlando, FL just wasn't for me (I had moved to Orlando to take the job), and I moved back to north GA. I was again working for myself, but this time I continued using Windows 7. Oh I tried to use Linux, but I had so many issues with the new desktop environments and the new forks of Xorg that I just gave up on it.

These distributions were all trying to make their desktops work well on mobile devices. As a result, they made things suck on the desktop. Gnome 2 had been perfectly stable and usable. I really liked it. Now Gnome 2 wasn't an option. You could use Gnome 3 in classic mode which made it look like Gnome 2 a bit, but that wasn't really the problem. It wasn't that I didn't like the new look. It was beautiful. The problem was that it just didn't work well. Dual screens worked fine and dandy in Gnome 2. Unity and Gnome 3 choked on them, or just handled things poorly. The push toward mobile device integration by the Linux community, nearly killed desktop Linux for me. I hated it. I was so mad at it, not that there was an actual entity to be mad at. I was just mad at what I viewed as pure stupidity.

We had Android. It was already the ultimate Linux mobile platform, but everyone else wanted to get in on the action as well. This could have been accomplished by having a separated mobile desktop environment, but nah, we need to force everyone to change. We need to take perfectly stable working desktop environments and throw them out, replacing them with desktop environments meant for mobile devices that are unstable.

I'd like to point out that of the major desktop operating systems, the only entity that got this right was Apple. They made iOS for their mobile devices and OS X stayed on the desktop. Sometimes change isn't a good thing. Apple got this transition correct. Microsoft screwed the pooch with their Windows 8 introduction as well. What were all these people thinking? Did they think the desktop was already dead and that everyone was already using only mobile devices?  I think they lost sight of the fact that people still listen to radio, even though TV was invented. People still watch TV even though desktop computers and the internet were invented. People still use desktop computers even though mobile devices are now in wide-scale use. Why would you screw over the primary user of your operating system just to try to get a foothold in a mobile device market which is already dominated by Apple and Android? Let me backtrack a little there. I'm not saying that they should try to obtain some market share in the mobile device market. I'm saying that they should have wrecked their desktop environment to do so.

Between 2012 and September of 2015, I used Windows 7 nearly 100% of the time. Occasionally, I would install a new version of Ubuntu or LinuxMint, hoping that it would be good enough to turn me from my Windows desktop. After all, I was programming and my projects revolved around LAMP stacks. I still used Linux, but it was in the form of virtual machines with no desktop environment. I had completely given up on the Linux desktop.

In early September 2015, I installed LinuxMint on a spare 120GB SSD, and for some reason everything just worked again. The Cinnamon desktop, which I had tried out a few times during my Windows 7 years, seemed to be stable and user-friendly. I left Windows installed on my main 500GB SSD just in case. Three weeks passed and I hadn't booted into Windows.

Today, I reinstalled LinuxMint. This time, I removed Windows and set that 500GB SSD as my /home partition. I'm again Windows free and loving it. Sure, there will be some Steam games that I can no longer play because there are no Linux versions, but I also don't have Windows 10 spying on my every move. I also now have a much better working environment for my development work.

So for anyone else who may have given up on Linux a few years ago, go give it another shot. You may enjoy it.

No Comments

Safari doesn’t load/show a base64 encoded image.

Normally when I run into a road block while coding, I can find the solution rather quickly via Google. Most of the time that solution is at stackoverflow. It's pretty easy to overcome most things this way. However, there are some times when you just run into a problem that few people have talked about online. That becomes rather frustrating. It reminds me of the days before the internet, or at least before Google, when finding information was much more difficult. We take that for granted a lot these days.

Hopefully this post will find it's way to the top of Google search results for some of the keywords I used in my searches. One example is the following error I was seeing when I inspected the element in Safari.
Failed to load resource: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -10.)

You see I had a chevron icon added to a custom select box in a web site I'm working on. The chevron icon showed up in every browser except for Safari. Safari just complained that it couldn't load the image. Here's the exact CSS I used for the image:


It worked fine in every browser (including IE mind you) except for Safari.

I'll cut to the chase. Base64 requires the number of characters in the encoded string to be divisible by 3. If you count all the characters starting with "iVBORw0KG..." all the way to "e1fe9ead", you'll see that the base64 string is 371 characters long. I remember that I got this chevron and the base64 encoded css directly from a website which automatically encoded the image for me. 371 isn't divisible by 3 evenly. However, 372 is. The solution to this problem is to pad your string at the end. I added an equal sign (=) to the end of the string, making it 372 characters long total. Now Safari likes it. Hope that helps. If you are having this same issue, you'll either need to add one or two equal signs, whichever amount makes the total character count divisible by 3.

, , , , , , ,

No Comments

Network Doesn’t Work on a Linux Guest Virtual Machine After Switching Hosts

I've ran into this problem a few times and I thought I'd make a note of it here on the blog. It's a simple fix. The scenario is that you have just started your VM from a different host OS environment than it was running in previously. This problem is specific to a Linux guest using the networking service to manage networking. You may also not notice this issue if you are using DHCP. I'm not sure. My addresses are static, so I'm specifying the network device in the configuration. You may find that the network doesn't start properly and that the boot up sequence stalls waiting on it. This is because the MAC address for the virtual network device has changed and udev is trying to use the old one. So if your old network device was eth0, it's not long usable and the new one at eth1 is your new virtual network device.

That being said, there are two fixes. One is very simple and the other is only slightly less simple but a better approach. First you can just change your network config to use eth1 instead of eth0. That'll work but if you switch hosts a few times you'll accumulate quite a few unusable network devices and you'll by using eth9 before long.

The better solution is to edit:
Remove all lines which contain SUBSYSTEM="net", which will probably be all the non-commented lines in the file.
Reboot the machine and when it comes back up udev will see the single network device and add it back as eth0.

, , , ,

No Comments

The Do’s and Don’ts of Tutorial Youtube Videos

Youtube allows anyone to broadcast themselves. While it's awesome, there are a few things that everyone should know before recording and uploading a video to Youtube. I watch many tutorials and such on Youtube so many of the things in this list pertain to those types of videos. So, let's get started with my rules of Youtube!

1.) Introductions

Don't start your tutorials with "What is up guys?"

This is especially true if you are extremely nerdy sounding. I don't have anything against nerds. I'm one myself. I do have a problem with people trying to sound cool.

Do try to be professional.

If you are making tutorial videos, try to present yourself as professional as possible. We aren't watching your video because we want you as a friend. We don't want to go hang out and drink a few beers. We do want to learn something. I understand that you are making the video voluntarily and mostly for free (unless you get tons of views and great ad revenue.

2.) Recording from a phone

Don't hold your phone vertically.

This causes your video to look horrible on youtube. Refer to this link for more information on Vertical Video Syndrome.

Do hold your phone horizontally.

ALWAYS record your videos this way. There's is never a proper time to record a video vertically with your phone. It doesn't look good anywhere.

3.) Preparation

Don't make a tutorial without first trying what you are supposed to be teaching.

I can't tell you how much time I've wasted watching coding tutorials where the guy would have a bug that he couldn't fix within a few moments, or he may be teaching something and winging it. In fact, most of the tutorial videos I've watched on Youtube are from people who are totally trying to teach something off-the-cuff.

Do edit your videos for brevity and details.

Even if you make a typo, you should edit out your search for the cause of your issue. Cut that time out and just show where the bug was located and what you did to fix it. Edit out long pauses and interruptions. Edit out your frustrated remarks when something doesn't work how you expected. Have a cheat sheet beside you details the steps you are presenting. Make sure you have went through the presentation before hand and have a working copy of all the code you plan to present. Keep your videos short. Make your videos address specific points. Record your videos, keeping the recorded time below 15 minutes, and then attempt to edit out 5 minutes worth of "ums" and other pauses, interruptions, and mishaps. You'll get a less-than-10-minute video nearly every time. A ten minute video is easier for your viewers. They can take in the information better with shorter, to-the-point videos.

4.) Communication

Don't use Notepad or other on screen text in tutorials.

There are two reasons I say this. First, if I wanted to read, I'd just go look for a written tutorial on the subject. Secondly, if your video isn't HD, it's nearly impossible to read the text, unless you are using 48 point font.

Do use a high quality microphone

There are some great USB condenser mics on the market for less than $50. One of these, along with a pop filter, will be extremely beneficial. Headsets tend to pick up your breathing, and your breaths sound like waves crashing into the shore. It takes a lot of intricate editing to remove all of these breaths. Get a good mic and you can avoid most of this work.

5.) Self-criticizing

Don't spend half the video apologizing for your mistakes or making excuses for the poor quality of you video.

"I'm sorry. I can't believe I did that. How stupid of me. I'm half asleep. I have to work all day tomorrow. I hope to have another video out by tomorrow. Whoops I'm sorry for the delay. I've been busy." These are not adding to the quality of your tutorial.

Do remove your mistake and talk briefly about some of the related pitfalls which others may experience.

Again, edit those mistakes out. They don't add to your video. They subtract from it. They use up valuable time you could spend teaching. If you run into a problem with your code or whatever you are trying to teach, just edit it out and explain that it happened and you removed it. Then touch on some of the problems others may have. It's pretty simple

6.) Knowledge of the material

Don't teach something that you barely grasp yourself.

I've seen Java tutorial videos from people who didn't fully understand the definition of class and object. It's also common that they don't know what the keywords static and final actually do. If you don't have a clear understanding of object-oriented programming, don't attempt to explain it. You'll only confuse your viewers even further.

Do make sure that you know your stuff!

If at any point in your video you say something along the lines of, "It's pretty complicated, but basically it's..." If you can't explain something in simple terms, you probably shouldn't even mention it, because you honestly don't understand it yourself. At least look up definitions for the words you are using.

7.) Ending the video

Don't spend the last five minutes of the video saying bye to your viewers.

This one is very important. Going on and on about when your next video is going to come out or asking everyone to like your video and leave comments are just a few things that drive me nuts at the end of videos.

Do give a 10 second or less closing.

Tell everyone thanks for viewing, and quickly tell them what the next video will cover. You may even squeeze in something about what was learned in the current video. Either way, keep it short, sweet, and to the point. Don't ramble. It's very unprofessional.

8.) Low resolution and zooming

Don't record a 1080p display and keep it zoomed to the full screen size the entire time.

This is especially true with coding tutorials. If I'm required to play back the video at 1080p just to make out the text you are typing, then I'm going to pass up you video.

Do use recording software that allows you to zoom in and out during the editing process.

Zoom in and out based on what the viewer needs to see. If you are typing something, make sure the editor is zoomed in so your viewers can see the text. If the viewer ever needs to see the full screen, then that is the time to show it to them. Any other time, zoom and pan.

9.) Swearing

Don't use swear words.

Cussing adds nothing to the video. It only removes some of your credibility.

Do remove and try to refrain from cussing.

Tutorial videos should focus on learning/teaching a skill. Being profession adds credibility to your video. Cussing is one of the most unprofessional things you can do in a video. I'm not someone who's against cussing. I just think that it's better to edit out any swear words to keep everything professional.



No Comments

Starting a Diet

I've decided to start trying to lose weight. I'm around 240lbs which is very overweight for someone 5'9". I've set a few goals for myself and today I started on my trip toward those goals. I'm going to detail my journey on my personal website, but I'm going to have to build that site first. So I'm going to post my first few entries here. I'll link to the other site once I have it up in a few days.

My ultimate goal is to get below 160lbs. That's quite a trip from 240. So my first goal is to get below 200lbs. I've set that goal for 3 months. I may be able to get there faster, but that's my conservative time frame. To reach this first goal, I'm cutting my calorie intake down to 1200 per day. I estimate that my current calorie intake is around 3000 calories per day. At that rate, I have stayed at 240 for around two years. So it's safe to say that my body currently burns around 3000 calories per day.

It won't stay at 3000 calories per day because as I lose weight my body will stop burning so many calories, unless I increase my daily activity. Since I'm lazy and overweight, exercise isn't something I'll focus on at first. I have to drop my weight through diet so that I'll feel more comfortable exercising and increasing my general daily activities.

Looking at my current diet, I can find quick ways to reduce my calorie intake. One thing that instantly comes to mind is to remove my soda intake and replace it with water. The problem with that is that water gives me intense heartburn for some reason. I think this is mainly do to my current diet, and I'll be compensating for this at first using heartburn medication. I'll also be drinking milk or juice a couple times per day. When counting calories, it's important to remember your drink calorie intake as well. A glass of whole milk is around 140 calories. Even skim milk is over 100 calories per glass. A glass of orange juice is around 110.

Which leads me to my 1200 calories per day. These calories have to be spaced out in such a way to keep me from getting hungry. I also have to incorporate low-calorie filling foods. So my plan thus far is to eat 6 meals per day each at an average of 200 calories. So when I drink orange juice or milk, I'm only left with 100 calories for the actual food. I'm using oatmeal to help with this. Oatmeal is around 10 calories per table spoon. In meals where I will be drinking milk or juice, I will be eating 4 tablespoons of oatmeal with a small pinch of sugar or honey...a very small pinch. This will give me at most 50 calories for the food and 110 calories for the drink. I'm eating once every three hours starting with when I wake up.

For example my schedule for today is (I woke up at 2am):

2am: Milk(110 cal) + Oatmeal (no sugar, 3 tablespoons - 30 cal) = 140 calories

I missed my 5am schedule because I was grocery shopping for low calorie foods, but I ate and changed my schedule when I got back home.

6:20am: Tuna (70 cal), Mayo(one teaspoon for flavor in tuna - 45 cal), saltines(60 cal) = 175 calories

So far, I'm at 315 calories for the day. I have four more meals scheduled:

8:00am: Orange juice(110 cal), Blueberries(1/2 cup - 40 cal), Oatmeal (with dash of sugar - 50 cal) = 200 calories

9:00am: Gelatin Snack = 39 calories

11:00am: Low calorie frozen dinner = 220 calories

1pm: Milk (110 cal), Soup (chicken noodle homestyle = 88 cal) = 198 calories

3pm: Gelatin Snack(39 cal), Tuna (70 cal), Mayo (45 cal), saltines (60 cal) = 214 calories

That will be my final meal of the day, and it will bring my total calories for the day to 1186. I hope that I can make the stretch between 3 and 6pm without getting hungry. I'm going to try to go to sleep around 6pm. I may move the gelatin snack from 3pm to 5pm. That may help. For now, I'm off to get my OJ and oatmeal going. After I eat, I'll be working on my calorie counting site. I'll make another post about it in a bit.

No Comments