Bug in minecraft on linux with dual monitors

Posted on 17th June 2013 by admin in Games

I’ve recently updated to Fedora 18. At first I tried Mate, which was ok, but next I gave cinnamon a try. It’s not bad, good features and works well enough. Some minor glitches, but nothing unrecoverable so far. My dual monitors like to switch sides when I reboot, doesn’t seem to save the settings right. It also seems there’s a known bug in minecraft with dual monitors on linux. https://ask.fedoraproject.org/question/23209/minecraft-drops-to-a-black-screen-after-login/ A library minecraft uses called lwjgl to work with opengl, has a glitch. Manually updating minecraft to use version 2.6 of the library fixes this bug.

linux tricks

Posted on 26th January 2013 by admin in Computers

Finding a few interesting bits of information lately. I think it’d be a very good idea to blog them, so I have a reference when I forget..

A few handy system monitoring tools: nmon, dstat, ftop, watch w, pstree, and there’s always the ever awesome htop.

Both my desktop and local server are linux, running similar distros. One amazing little trick is to run a program on the server, but forward the GUI to my desktop and display the program there as if it was running on my desktop. I’ve only used this over gigabit to a local server, but it performs very well. You would never know the program is actually running on a remote machine without knowing where to look. No lag at all, using it for a remote desktop application. I use a program called virt-manager to manage my virtualization server. The problem is, when I run it on my desktop, every window I open it asks for the root password. If I run the program on the server and forward the GUI to my desktop, I only enter the password once when I open the program (I actually connect to localhost with virt-manager.) I remember trying it with video once, but it was a bit choppy.

Here’s the command to run a program remotely and display the GUI locally:

ssh -CX username@hostname programtorun

One last thing. I’ve recently found some people think there’s no possible progress bar when running a filesystem check on linux. I got around to looking into this tonight. Using –help doesn’t show all the options. Looking in man shows the complete documentation. And here’s the command:

fsck -Caf

or, for a single drive/partition

fsck -Ca /dev/sdb

Anti-spam for blogs

Posted on 13th December 2012 by admin in Uncategorized

Someone sent me an anonymous comment on another of my websites, asking how I deal with spam on my blog. I don’t like spending time cleaning out spam, and I don’t like spending my time figuring out how to prevent it. Either way, the spammers are winning and I’m losing time I could spend on useful projects. A while back, I came across a word press plugin called Akismet. Install that and a great majority of the spam goes away. Now, I just log in and clean out the few that still make it in, every few months.

My chosen language for current projects

Posted on 13th December 2012 by admin in Computers, Tech

Looking back, it really took me years to choose a modern programming language to learn. It’s not really surprising, I’m always late to adopt new technology forms, until it’s been proven. Just a few years ago, I preferred RS485 over USB, for example. Now, with a little work, you can build a custom USB device of any kind, and it’ll work great. Tools have greatly improved, and I’m currently very happy with what I’m using. I’ve run into a few limitations so far, but nothing I can’t work around.

I was just cleaning out some spam comments when I found arian’s post, commenting on my old cross-process communication post. It’s always interesting (and frightening) looking back at how I’ve done things in the past. Always interesting code and techniques, but it’s never pretty when you’re making a language do something it was never intended for. Anyway, ugly code aside, it took me a long time to pick a programming language to learn for this major project. Home automation has always been my forte, and this is a project I’ve always dreamed of creating; being my life’s work.

A lot of people hate on java, but it may be unwarranted. A lot of the things people don’t like about it are things that make it great for programmers. It has decent speed and has come a long way since the early versions, which I believe gave it a bad rep. I’ve found, if a java program is unstable or crashes often, it’s not the fault of java, it’s just a poorly written program. If a java program is slow, it’s either a poorly written program, or a slow computer. Java isn’t a speed demon, but it has met my fairly high expectations, and reliable code can be written with a little effort. One thing I like is, once you’ve designed an object of some kind, you can very easily make it reusable in other places of the program, or in other programs. A library can be compiled into the program in more than one way, or can be included as a local jar or a system jar, or sorta like what I plan to do very soon, download a jar automatically and use it in a program. Plugins are almost as easy. They take a little advanced programming to get the jars to load on the fly, but it works extremely well.

When you’re creating a GUI, the controls are actually sub-components of other objects or controls, and custom controls can be created as easily as extending a class and adding a few functions with your code. There are graphical form designer tools you can use, but whether you do or not, you have access to customize the code that creates that window and all the controls it contains. Don’t go thinking I’m a fan-boy. Java does have plenty of its own pit-falls. What I can still say I am, is a .NET basher. I don’t care for .NET/mono, and I’m happy I went with java, but I also don’t have much experience with .NET, which could be part of the reason I don’t like it. I used to hate java like so many others do, but now that I’m using it, I really enjoy it. The lesser of 2 evils. Piece of cake to run on a variety of operating systems, which was something high on my list of requirements for the project I’m doing.

Back to arian’s comment. Communication between threads in a java program is pretty easy. It’s also easy to make unsafe code which can cause very odd and random errors in your program. Threads running in parallel, accessing the same variables, bad things can happen at unsuspecting times if the code isn’t written thread-safe. I do my best not to forget anything when writing my code, but I could drive myself crazy trying to find any threading mistakes I’ve possibly made. The best I can do is try to always keep threading in mind, and be sure the right precautions are in-place wherever threads are involved. If anyone has a better idea, fill me in on your trick to thread-safe coding. The thing about the project I’m doing, everything is multi-threaded, but not everything needs to be thread-safe.

Time for an update!

Posted on 1st November 2012 by admin in Computers, Games

Been quite a while, hasn’t it. Since my last blog post, I’ve taken over a minecraft plugin, and completely rewrote it from the ground. WebAuctionPlus has 8500 downloads since I started working on it, and every day gets closer to 200 live servers running it. It’s sorta like ebay for minecraft items. As long as people keep using it, I’ll keep updating it and adding features. It’s been a fun project. One of the first things I did when starting on this, I’ve made it 5000% faster. I love speed.

Right now, I’m asking myself, why am I running a defrag on a windows VPS that’s running on a solid state drive?.. It looks better anyway. Satisfies my OCD. Speaking of which, had some issues with my server at one point. It needed an OS reinstall. I held off until I got a better hard drive to install the main os on. If you do buy a SSD, don’t skimp on the brand/version. I was up in the air a little bit on what to get, but as soon as it came time to order, I went straight for a recent Intel model. Very reliable and fast chipset. I’m always running out of disk space, but 120gb has been enough to run my few VPS’s and other things. When I first installed this new drive, the speed was everything I could ask for. A fresh linux install booting in under 5 seconds to the login screen. Amazing! And, if for some reason I need windows, I open my virtual machine manager (something like vnc) and I have whatever version of windows I want at my finger tips, ready to boot with the same wonderful speed, since the virtual drives are stored on that same SSD. I know of friends and businesses that run SSD’s in raid 5, which has to be some shocking performance, but raid is one thing I usually stay away from. besides, I can see the speed of a stand-alone SSD lasting me a good 20 years into the future. I doubt this Intel drive will last that long, but I’m happy with the speed of it. Capacity, on the other hand.. like I said, I’m always running out of disk space. One day, not far from now, I will break the 10tb landmark.

Grow Control.. still loving it. I was extremely stubborn giving up vb6, but I finally have this year. I’ll admit, vb6 is a pretty crappy language compared to what else is available, but I did enjoy writing that code. I always found a way to do whatever I needed to do. Grow Control was written in vb6 originally, and it did tons that you’d think the language could never do, but it is really a handicap. Java is giving me the tools I need to create what I originally pictured the project to be. I am, however, realizing more than ever how much time a project like this takes to do it right. I’ve gotten plenty done over the summer, but haven’t had a chance to work on it a whole lot since then. If I get back to work on it soon, I hope to have a functional version released by the end of this year. What I’m hoping is, it’ll attract the attention of a few fellow developers who will love working on the code as much as I do.

The project really is on track to become everything I’ve imagined. One thing I haven’t mentioned yet in this post, WebAuctionPlus and Grow Control are both open source! The bukkit community is great, but still very few other people contribute much to the plugin. I’m really hoping to spark an interest with a few good programmers with Grow Control. It is geared straight at the tinkerer. 3 of the biggest features I wanted in the final product, native support for multiple operating systems, full plugin support, and a client/server model for the entire thing. The version of Grow Control I’ve been working on this year has all 3 and does them well. The server and plugin api are both functional, but I’ve only just begun on the client. The client will likely be the biggest part of the project, but it’s what’s required to do it well. At the moment, one of the biggest reasons I want other developers to start giving some input, I’m in desperate need of other eyes on the plugin api. If I’m designing this entire project around plugins, the api must be done to high standards. I admittedly am fairly new with java. I believe I’m writing good quality code, but when I write something completely new, it likely changes and gets rewritten a few times as the program improves. Grow Control isn’t there yet, but it will eventually need an api change freeze to give other plugin developers a chance to create a set of software for others to use. It will inevitably be, this version of the server works with this version of the plugin, and not be backwards compatible, but this is a problem I plan to at least attempt to avoid.

Another critical part I’m really in need of developer opinions on, the client/server protocol. There is a list of information that needs to be communicated between the Grow Control client and the server. I’ve been thinking lately, I should go with a model that allows multiple protocol versions side by side. The standard java client might use a serialized object to send packets of information, but there are already other clients planned for future upgrades. An API for php will be provided, as well as a full web control panel. There will be smart phone apps also, but most likely, that’ll be java too, so no problem there. I want to give other developers the power and freedom to create a custom gui in any language. The entire course of this project, I’ve been keeping customization in mind.

Something else to note, the new Arduino Due! 16 times more flash, 47 times more ram, and a 5 times faster ARM based processor! The problem with the Arduino Uno was always running out of ram, and trying to rewrite parts of your program or completely removing them to make it fit. This new Arduino does cost a bit more, but it will most likely make it possible for a Grow Control slave, a self-contained hardware based backup for the system. Let me explain. Say your hydroponics table is filling. The pump is running and it’s almost full. Who knows what happens, but the computer crashes, or looses the network connection. Unless you have a hard wired float to turn off the pump, it’s gonna keep on pumping, even after overflow. In an ideal system, the computer (or server) will still do most of the work and thinking, because it has plenty of resources to spare. The Arduino, on the other hand, has a very limited memory. For the price of 2 Arduino’s, you could get a 1tb hard drive. There, I’ve backed up my claim. The computer has the power to become intelligent, in a way. The Arduino Due should have enough resources to at least have a few backup timers and fail-safes. I believe the tough part will be making this extra set of configurations as easy to use as possible, but as always, be extremely powerful to users who want it. This adds so many complexities, it’s not funny. A light timer, for instance, is actually a plugin that communicates with the client and the arduino plugin. But, it’s not always the arduino plugin it will talk to, and it wont always be the Due. There are many other types of hardware, both open and closed source, that will also be supported by Grow Control plugins. Almost all of these other hardware types are interfaces only, and will never be able to make decisions as a backup. So this new configuration will need to integrate right in with the existing system, but may only ever be used by the arduino plugin, only when using the Arduino Due. This is something the plugin API needs to plan for.

Ventrilo Init Script

Posted on 20th February 2012 by admin in Computers, Games

I searched around a bit, but couldn’t find an init.d script for Ventrilo. I found a few, but they all either sucked, or didn’t work. So I picked the best one for a template and improved it. Save this file to /etc/init.d/ventrilo and use the command “service ventrilo start” to start the server.

#!/bin/sh
# Ventrilo script init by Matthew Kemmerer
# For ventrilo server v3.x

VENTPATH=/usr/bin/ventrilo

case “$1″ in
start)
echo “Starting Ventrilo Server.”
cd $VENTPATH
./ventrilo_srv -d
usleep 500000
renice -5 `cat $VENTPATH/ventrilo_srv.pid`
echo “Ventrilo Server Started”
;;
stop)
echo “Shutting Down Ventrilo Server.”
cd $VENTPATH
kill `cat $VENTPATH/ventrilo_srv.pid`
echo “Ventrilo Server Is Now Down”
;;
restart)
echo “Restarting Ventrilo Server…”
cd $VENTPATH
kill `cat $VENTPATH/ventrilo_srv.pid`
usleep 500000
service ventrilo start
echo “Ventrilo Server Restarted”
;;
status)
cd $VENTPATH
./ventrilo_status -c1 -t127.0.0.1
;;
*)
echo “Usage: $0 {start|stop|restart}”
exit 1
esac
exit 0

my idea to further improve multi-monitors

Posted on 11th December 2011 by admin in Computers, Uncategorized

a lot of great inventions come from people just filling a need. I have a need that I think would be a great invention to add to synergy. I’ve seen people describe synergy as a cross between vnc and a kvm switch. this idea kinda adds more vnc to the mix.

my current setup is 2 computers, one linux and one windows. each computer has dual monitors. sometimes when I’m doing some programming on windows, I find myself really wanting a third screen to put up some code or document or something to look off while I do my work on the other 2 windows screens. usually, what I want to put up on the 3rd screen is something that can only be done on windows, so my 2 linux screens go to waste. the easiest solution for me is to grab my windows laptop and use that as a 5th screen. now it’s getting out of hand. I can only fit 3 screens on my desk as it is. vnc somehow has the answer.

here’s my idea. it’s a bit complicated to implement, so it probably wont be seen for a long time, if ever, but it would be an amazing piece of software. start with some kind of virtual screen driver. something that will add a virtual monitor to the system without actual hardware, but instead outputs only to a vnc server of sorts. the opposite system then connects to and displays that vnc server. it multiplies the number of screens you can have on your system, kinda like what a real kvm switch would do. if you have 2 screens and 2 systems, one screen on each, you could use hot keys to switch between dual monitors on each system without a kvm switch. with my current setup, I could turn my main linux screen into a 3rd windows screen, or the other way around. go from 4 to 6 or 8 screens without more monitors.

is there some way to possibly set this up manually? it would need some kind of vnc server that acts like a virtual video driver. they have something like this in virtualization servers already. I can vnc into the virtual systems running on my server, and they have a virtual display driver. on one of my virtual systems, the driver is called Cirrus Logic 5446 Compatible Graphics Adapter. could I add something like that driver to a system that’s not virtual and doesn’t have a host os to talk to. thanks for taking the time to read my thoughts.

EDIT, 30 minutes later: It was so hard to describe my idea, I didn’t think I’d even know what to search for, but I found a solution!! Check out this software http://www.zoneos.com/zonescreen.htm It installs a ZoneScreen Virtual Display Driver, and shows up in the display properties as another screen. It’s hidden of course. There’s no real display adapter, so no place to plug in a real monitor. It comes with a modified TightVNC server and client to run. I installed the driver and set up the 3rd screen and run the server on my windows xp system, then run the client on my fedora linux system with wine. Go to full screen, and it looks like I have 3 monitors on my windows system! More screen space for me to do my work. I love it!

recent aquirements

Posted on 11th December 2011 by admin in Uncategorized

I was using someone elses wireless router for a while, but they took it to use, so I needed one. I got a used Linksys WRT610N. It supports dual band wireless N, which I think is the fastest connection available right now. Not that I need it, I don’t have anything that supports N. The reason I got it, it has a 4 port gigabit switch build in. 2 devices in one, so I don’t have to spend more money in the future on a gigabit switch. The backbone of my network is extremely fast, but has a limited number of gigabit ports, which were all in use by servers and desktops. Setup only took a few minutes. First, I disable most of the router features, DHCP, NAT, and UPNP. This turns the wireless router into a wireless access point. Those features I disabled would only interfere with the existing network I’m plugging it into. Especially DHCP. If left enabled, it will only confuse the other computers and devices on the network, and loss of connectivity is very possible for devices not even using wifi. Next I set up the wireless secutiry, which is always the biggest pain of the whole thing. Once that’s done, it’s safe to plug into the network and start using it. The wireless access point plugs into the netgear managed switch stack, which plugs into the virtualization server running the router software, which finally plugs into the cable modem. All gigabit. Roughly 10 times faster than a standard home network.

Next, something a lot cheaper than a second hand wireless router. This camping stove is actually made out of a soda can. It weights only 11 grams, a few grams less than an empty soda can. You can use 91% rubbing alcohol or heet gas antifreeze. Both of which can be found at any gas station. 1oz of fuel lasts about 8 minutes, but only takes about 5 minutes to boil 2 cups of water. It fits nicely inside my small camping pot, and a full meal can be made in a few minutes with less than a shot glass of fuel. You’d think heet would smell bad and maybe make the food taste bad. Actually, when lit, heet has less of a smell than rubbing alcohol. I don’t smell much of anything after it burns out. Alcohol has a yellow/orange flame. Heet has a blue flame like pictured.

Notes on cross-process communication

Posted on 12th November 2011 by admin in Computers

In my search for the best way to communicate between processes (seperate exe’s), I’ve come across some interesting techniques. I’d like to highlight some of the features and downfalls of what I’ve found for future reference. This quest is just about over, as I’m finishing up my code for this project.

Sockets – The first method that comes to mind is to use a socket. TCP could be used for a stateful connection, or UDP to send information blindly and wait for a response. Localhost can be used for both sending and binding, which avoids hacks from over the network or the internet, but firewall exceptions will still need to be handled on some systems. None of this is very hard to do, but the down side of using a socket is the added overhead on the system. A single port or 2 may not sound like much, but TCP/UDP are complex protocols, which leads me to believe there’s a better way.

Memory Map – A memory map is when an isolated chunk of memory is shared and accessible by multiple processes. I’ve had a prototype project of this working, and seems stable enough to use in the right situation, but timing is a price you’ll have to pay. App A can send information to the shared memory space, but app B doesn’t know of its existence until a timer is triggered to check it. If the receiving app isn’t actively checking the memory space for incoming data, the data will be stuck there clogging the mailbox, so to speak. In this case, your only 2 options are to overwrite the contents, or keep waiting.

Subclassing – Subclassing is when a program inserts its own function in before the normal event handling. Let me try to explain this a little better. Say you click on a window, or type something into a text box. Those events get sent from the Windows OS into the program. Those events can be intercepted by subclassing, sorta like a man in the middle. As it sounds, there is a lot of power that can be harnessed using this method. Along with that power comes a lot of danger. If implemented improperly, your program can crash, or even the IDE (development environment) if you’re running it from there. I’ve found some great code by Paul Caton, on PlanetSourceCode.com, which doesn’t crash the IDE when stopping or pausing the project. I still have yet to see how it performs as part of my full Grow Control project, but I have high hopes. If it fails to meet my expectations, I may have to try moving the subclassing into a DLL or OCX to try preventing crashes while developing.

The second part of subclassing is SendMessage and WM_SETTEXT. This simulates sending an event to the app with a string. This can be captured by the subclass proc function before it makes it to the form. This is easy enough to do with a single line of code. The hard part was grabbing the string back from the captured event. I’ve uploaded my code to PlanetSourceCode, and below is the trick to getting the job done.

l = lstrlen(lParam)
If l Then
Call CopyMemory(sString, lParam, l)
PointerToString = StrConv(sString, vbUnicode)
End If

Mutex – The subclassing method above is what I plan to use, but I think this is worth mentioning too. Mutex stands for mutual exclusion. It’s an api for creating a named lock. Only one mutex can be created with a unique name. (they can be shared, but that’s not what we’re going for here, so nevermind that.) It can’t send strings or commands for communication, but it is very useful for managing the number of instances of an app are allowed to run. Most of the code examples I found on the internet are missing a critical part. You must first run the ReleaseMutex api before CloseHandle. If the handle is only closed and ReleaseMutex isn’t used, the Mutex lock remains until the apps process is ended. This works out fine if you’re only intending to use it to allow a single instance, but it poses a problem if another app is trying to test the lock and not leaving it enforced. Use this api properly and it will prove to be extremely useful.

Handle = CreateMutex(0&, 1&, Name)
If Handle <> 0 Then
If WaitForSingleObject(Handle, 0) = 0 Then
MsgBox Handle
ReleaseMutex Handle
End If
CloseHandle Handle
End If

new cable modem installed

Posted on 29th August 2011 by admin in Computers, Tech

No more residential internet for me. I now have commercial cable internet. I have a new Motorola SurfBoard 6121. So far I’ve figured out that the modem supports gigabit, and it runs open source linux. I have gigabit ethernet from my desktop computer, into the non-blocking network switches, then from there into the server which runs a linux router, then gigabit from the router built into the server, right into the cable modem. So my computer is pretty much connected into the modem at gigabit speed. This is the first time I’ve ever gotten the actual speed I’m paying for! The old cable internet was 15/3MB download/upload. I now have 8/2 and get better speed. I actually get 1000kbs download and 250kbs upload. Ping rates are about the same as before. 30ms to google.com and 20ms to mattsoft.net . Still waiting for the static ip’s to be set up. By plugging in an unknown mac address to the isp’s network, it gives me a residential ip, and testing shows incoming ports are still blocked using this ip. Once the static ip’s are set, there shouldn’t be any blocked ports anymore! I can use port 80 for a web server, 53 for a name server, email server, game servers, streaming servers.. whatever I want to set up will no longer be blocked. More news on the web server move tomorrow once I’m static.