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:
/etc/udev/rules.d/70-persistent-net.rules
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.

»crosslinked«

, , , ,

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

My first Electronic Composition

I've been getting into chiptunes and other electronic music lately. So, I thought I'd try my hand at some electronic music. Check out my Warm Up Song.

,

No Comments

Force user to login method in Codeigniter without checking Session in every method.

If you need to secure every method of a Codeigniter controller, you can do it with one line instead of checking the session in every method before doing anything else. In the constructor of the controller simply check that $this->router->fetch_method is not equal to your login method and that a user isn't logged in. If you meet both of these criteria, redirect to the login method.

, ,

No Comments

Emerson Portable Ice Maker Doesn’t Work – Possible fix!

We bought an Emerson Ice maker about two years ago because the built-in ice maker in our freezer stopped working, and I'm a huge consumer of ice. So, I wanted a dedicated ice maker. It worked well for a few months. Then it decided that it didn't want to make ice. I should have sent it back but I decided to tear it apart and try to fix it.  I wasn't able to really get anywhere with it. So, I put it back together and plugged it back up and miraculously enough it started working again.

Since then, I discovered why it was failing to make ice. I post this because there may be someone else out there with the same problem from their Emerson Ice Maker.

The problem I have stems from the 120mm exhaust fan used in this device. I'm no expert on refrigeration, but I think this fan has to be running in order for the thing to make ice correct. It puts out a lot of heat. With my very basic knowledge of thermal dynamics, I'm assuming that this is how the ice is made. It removes the heat, thus reducing temperature and creating ice.

This fan is the exact fan used in a lot of computers. So if it isn't running, you may need to replace it. However, I took a shortcut that seems to have worked, a little trick I've learned from working on computers. You can give it a try if you want. It's pretty simple.

The fan has a sticker in the center. This should have some sort of logo on it, but it also has a second purpose. It holds a little rubber cap in place. Under that cap are the bearings for the fan. If you oil the bearings and replace this sticker, the fan may start to work again. You can get to the fan by removing the cover. I won't go into details here how to do that, because I don't have enough time to write the detailed instructions. It's pretty easy to do. In my case the fan grill was almost broken completely out. So, I just finished it off for easy access to the fan.

"What can you use to oil the bearings", you may ask. I used baby oil, because it's basically mineral oil with a little fragrance. You can use mineral oil and there are some actual products that are made for greasing fan bearings. There are a ton of videos on Youtube on how to do this to a regular computer fan.

I hope this helps. If it does, leave a comment! I like to hear when I help.

 

, ,

11 Comments

Java ServerSocket Close Accept() Throws Socket Closed Exception

So, I am creating a simple multi-threaded game server (generic client/server) app in Java. I ran into a problem with threading that I thought I would post about. It may help someone else save a few hours of their time.

I have a class called TCPServer which implements Runnable (used for Java threading) and serves as a socket listener for my server. It waits for connections and then adds those connections to a connection manager. Each connection starts its own thread. The thing about threads is that they are easy to make, but melt my mind when it comes to managing them correctly. I thought I had a good handle on it. I did actually, but it made me think I was crazy for a few hours none-the-less.

So in my main class I have a command that starts the TCPServer. It creates a new one and then in the constructor, I start the thread. Well, as you may know, Thread.stop() is a deprecated and shunned method. Don't use it. I thought I was going to have to, but I forced myself to find the real reason for my issue.

Let me discuss the issue. The thread starts and a while loop checks a variable called receivingConnections. Theoretically, if this variable is set to false, it should break out of the thread and everything should be hunky dorey. I created a stop method which set this variable to false and then closed the ServerSocket.

Here's where the fun began. When I issued the command to execute the stop method, I kept getting a "socket closed" exception. This was being caught on the accept() method of ServerSocket. I couldn't figure out why it was throwing the exception. The socket was closed, true... but why did it keep trying to use the accept() method after the socket is closed.

I thought that it was due to the receivingConnections variable not being volatile. I changed this but still ran into the same issue.

The answer is rather crazy. You see, ServerSocket's accept() method just waits for a connection. The while loop that it was in was just stalled waiting on a new connection. Closing the socket triggered the exception. Even though right before the accept() method was called, I was checking if the socket was closed. My guess is that the accept() method simply starts its own infinite loop and waits on the new connection. As far as I can see, there's no way to break out of that.

The solution... set your flag variable to false. In my case it was the receivingConnections variable. Create a new client socket connection to the server and close it immediately. Then you can safely close the ServerSocket. This fools the accept() method, which forces an iteration of your while loop, which sees that your flag is now false, breaking out of the loop.

, ,

2 Comments

LAMP Web Development Tutorials

I recently started creating a series of online courses for LAMP web development called "LAMP Web Development from the Ground Up". These courses are available at Udemy.com. The first one concentrates on HTML, CSS, and Javascript. It's an introductory course. The second course is in development and will focus on Linux. If you are interested in learning how to develop web applications in a LAMP environment check it out. The first course can be found here: LAMP Web Development From the Ground Up Course 1.

No Comments

Visual Studio Won’t Create a New C++ Project

I had a problem with Visual Studio after a service pack update. I was unable to create a C++ project. The project dialog would just disappear and then come right back. I'm not sure if the SP1 update caused the issue, if it was a combination of SP1 and a custom installation directory of Visual Studio, or something entirely unrelated. I searched for a fix all over the internet and came up blank. I decided to try uninstalling and reinstalling Visual Studio. However, once the uninstaller opened I decided to give the repair a try. After repairing the installation and rebooting, I can now create C++ projects again. So if you are having a similar problem, give that a shot. It worked for me. Sometimes it's a simple fix.

, ,

No Comments

GM48 #6 Submission – Ant Agonists

Last week I decided once and for all that I'm going to get into game development. I have a lot to learn, don't get me wrong, but it's a real fun thing to get into and I'm nearing the point where I have the skills to do it. My main problem is my art skills are lacking quite a bit at the moment. I'm concentrating on sprite creation for 2D games and modeling/texturing for 3D games. Monday of last week (April 8, 2013) I found out about Unity3D. I fell in love with it. Up until this point, I've been working with Java to make mini-games, as a learning experience, but I don't really like mucking about with setting up Java. I dislike working with class paths, and I don't particularly care for the distribution side of software that is created with Java. I may still venture into that but I want to turn out some actual games first.

Unity3D allows you to create your games in a GUI environment and it handles scripting quite well using your choice of C# and Javascript. It is actually quite nice. I was amazed that I could write some C# and the variables turned into interface options inside Unity itself. The problem for me at this point is that I don't have great modeling skills, but I've started watching Blender tutorials to develop that skill. So for a couple of days I was working on Blender. Then I happened upon a post about Game Maker. I've always been interested in many types of games 2D as well as 3D, and I wanted to get my hands dirty with some 2D sprite making. It occurred to me that it would be a good idea to make a few 2D games before diving into 3D.

I tried out the free versions of both Unity3D and Game Maker Studio. At this point I should point out another feature of both of these products that really drives me toward utilizing them instead of hand-coding games from scratch. They both offer exporting to various platforms. With Game Maker you have to pay for the ability, but you can write your game once and export to Windows, Windows 8, Linux, Mac OSX, Android, and HTML5. With Unity3D you can export to a ton of things with the free version, including XBox360, Windows, Mac, Android, and iOS. However, there are some things you don't get with the free version like some shaders. The cost of the non-free version of Unity3D is also $1500. For some reason I think that price point is a little high for their maximum profit. I could be wrong, but if Unity went for $200, I would have already bought it, and I'm sure there would be thousands of others who would fork over that much for it.

At any rate, after using Game Maker for a couple of hours I decided it is something I want to devote some time with, so I purchased the pro version on Thursday (April 11). The next day I found out that there was going to a 48 hour Game Maker competition on the /r/gamemaker subreddit. I entered it and after 48 hours of writing a game with a tool that I had just bought, this is what I came up with. I give you Ant Agonists.

No Comments