X-Istence's blog

X11 mouse button pressed

For a Rube Goldberg device I needed a way to know if a mouse button was pressed on the root window of an X11 screen. Here is the code for it:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <unistd.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>

int main() {

        Display *dsp = XOpenDisplay( NULL );
        if( !dsp ){ return 1; }

        int screenNumber = DefaultScreen(dsp);

        long eventMask = StructureNotifyMask;
        XSelectInput( dsp, DefaultRootWindow(dsp), eventMask );

        XEvent evt;

        eventMask = ButtonPressMask|ButtonReleaseMask;
        XSelectInput(dsp, DefaultRootWindow(dsp), eventMask); // override prev 

        do{
                XNextEvent( dsp, &evt );   // calls XFlush()
                if ( (evt.type == ButtonRelease) || (evt.type == ButtonPress) )
                exit(2);
        } while( 1 );

return 0;
}

Compile: gcc -lX11 -L/usr/local/include x11.c -o x11-mousebutton

Upon a mouse button being pressed it will exit 2, so using that return value in some script you can execute a command. For example, to open a CD rom drive so a domino falls over.

Boooo

Surprise!!!

It seems I have not blogged in a while. I don't know how many of you know that I have moved into a house with 6 other guys, which is going great. THe house is awesome, however with that also come some responsibilities which people do not seem to want to take. For example, cleaning the kitchen after using it. Currently it smells really bad, like foul. I need to go clean it since others will not do so, however I am not happy about that, off course. Since the kitchen is really mine, as I am one of the only ones that really cooks I am going to set some new rules. I don't know if I will be able to enforce them or not, but I can try can't I?

School is great, like always, recently did midterms, which were okay, nothing too hard. I am loving this semester, unfortunately our room 244 (Yes, our room) is being renovated so we were kicked out, however that did mean I got to take home quite a bit of free wire, solder and other cool toys to play with over this break. I went and visited the Phoenix FIRST Robotics competition together with Kris, a room mate of mine. That was rather fun, this years game was definitely a challenge for the different teams, and many of them played it extremely well, which was surprising. Then again, I did not get to see the pre-quarter finals matches, so my perspective may be skewed. I am considering going to visit FIRST robotics at nationals this year just to be there to watch the games!

Well, I am off to clean my room, which is currently in the state of mess. I need to send out the 4"x4" sample of my old air mattress which broke (long story, will explain later, perhaps) so I can get the replacement shipped to me so that I can sleep on something comfortable again. The floor is kind of hard and does not really feel all that great.

RegisterFly.com -- A nightmare story

As most of you know, I gained control of Spammers-paradise.com and spammersparadise.com from Casey when he decided it was not in his best interest to keep going with the site. I know many of you have been pissed off about the fact that the site has been down, however now that the domains are safe at GoDaddy I am not afraid to speak out about what had happened, and why our beloved site is not back up and running.

Just as I had all my domains at RegisterFly, as did Casey. I had slowly started moving my domains away from them for the reason that their website was always slow, and their customer support sucked balls. However Casey stuck with RegisterFly, and why should he not, they at the time provided a service, and that is all he needed. After he handed the domain over to me by pushing the domains into my account, I have had nothing but trouble. I was unable to change the registrant address on the domain to be ICANN compliant, and I was unable to unlock the domain.

The trouble started on January 8th when I noticed the domain was up for renewal in just a few weeks time, I paid GoDaddy to transfer the domains to them, and started setting everything up on the RegisterFly site, that is when I walked into the unlock of domain problem. It took them all of 25 days to unlock my domain, which at the time was around the 2nd or 3rd of February. After that was completed they did not answer my support ticket about the EPP code I required so that I could transfer my domain, on February 12th they made a change to their website, and now the EPP code was listed underneath the registrant info, on the page where you could modify that information. However, the code was invalid, and yet another support ticket was opened. On February 13th I got the new EPP code, and put in the transfer with GoDaddy.

Now, when a transfer is about to happen, they have to provide a link to a page where you can either deny or confirm the transfer, however this webpage that they provided was broken in one big way, if no support personal was at a desk, it would refuse to let the transfer happen automatically, so I had to wait 5 days for the auto "Hey if you don't contact us we will let it be moved" thing to work, after which now the domain is back under my control at GoDaddy.

I am happy to see that there is a community based around the way RegisterFly is stealing from customers, and trying to figure out why the company is slowly destroying itself. I hereby will remove any future recommendations to them, as well as nullifying any old statements about them.

One site that is actively trying to let RegisterFly hear people's complaints is http://registerflies.com/. As a funny side note, they are an SSL certification seller, however their logged in section of the website is using an old certificate that expired 3 days ago. That just makes it look even more as a shady company than it currently is.

spammers-paradise.com should be up and running shortly, definitely will need the sp.com community to help me out and to get it back up and running as it was before. I apologise for not coming out and saying something sooner, however RegisterFly has been known to lose customers domains randomly, just do a Google on RegisterFly to hear the horror stories.

Technorati tag: (To more easily find more horror stories)

SCALE 5x

SCALE 5x is coming up this week. I will be driving to Los Angeles with a group of other UAT students to go have fun at the parties :D.
If anyone else is going to be going, please send me an email if you would like to come meet me in person, if you are unable to find out who I am without actually contacting me first :P. I will most probably have one of my Mac's with me, and my Toshiba Portege. I will also probably be around people wearing UAT Tech Ninja shirts, so if you see a group of people walking around with black shirts, and or UAT hats, come over and ask for me :D.

Well, I am excited to go as you may have noticed, I am really looking forward to the conference, to hear great people talk about Linux and other open source stuff, and to play with new products as well.

FreeSBIE 2.0 on a MacBook Pro

I decided I would take the new FreeSBIE version for a spin, based on 6.2 it was supposed to have support for booting on the new Intel Mac's that don't have legacy hardware support anymore (PS/2 and whatnot). FreesBIE started booting, and that is when I lost all keyboard control. I left my MacBook Pro sit for a good 15 minutes, after which I heard the CD spin down, disappointed I saw that the FreeSBIE logo was still sitting over top of the screen.

Not expecting much, I hit the space bar on my laptops keyboard, and away it went. I was sitting at the console logged in as the FreeSBIE user. My initial thought was dmesg. By accident I typed this on my Bluetooth enabled keyboard, and it really surprised me that it even worked. It had detected my Bluetooth keyboard, and connected to it somehow so it could be used with my MacBook Pro!

After the dmesg I grabbed a USB mouse and plugged it in (using X11 without a right click button is just about as hard as in Windows), as it had not connected to my Bluetooth Mighty Mouse. Upon plugging my mouse in, it recognized it, however it did not start a moused for it. So I had to start it myself:

moused -t auto -p /dev/ums3

Then to make sure it worked, I enabled the console based mouse pointer:

vidcontrol -m on

And moved the mouse around. Sweet it worked.

I then proceeded to try Xorg, with startx as the FreeSBIE user, and it worked. I had a fully working XFCE desktop sitting in front of me. The MacBook Pro is mighty fast running XFCE, I opened up FireFox which took a while to load from the CD, however once in Cache, opening FireFox took merely seconds, which is faster than when running it in Mac OS X where it will sit in the Dock and bounce a few times before opening, then again, FreeBSD had 1.8 GB of ram left over after starting XFCE, Mac OS X takes up at least 700 Mb with all the stuff I normally have running, so that could make the difference.

Everything worked great, two minor things that did not work: Wireless and Wired internet. Just minor :P. That is the reason that right now you are not also looking at screen shots. I don't actually own any USB flash drives, since I transfer all files over the network, and I lose the damn things all the time. According to Mac OS X it is an Atheros based 5424 card, which also supports N. The older model MacBook Pro's with the Core Duo's did have their Wireless card supported, so I am unsure why it is failing, maybe it is because the chipset has changed, the ath_hal does not support it yet. The wired card is not working either, and that is probably since the if_sk driver has not been updated yet. There is an experimental driver in -CURRENT which has better support for the Marvell chipset for the GigBit-E cards, which will be awesome.

I am looking forward to more improvements in FreeBSD to run on the newer hardware, and soon I might be triple booting my MacBook Pro with Mac OS X, Windows, and FreeBSD. It might sound weird, but Mac OS X does not have the same interfaces available in terms of being able to develop for it as Mac OS X, so it makes sense to have it on my main laptop as well.

FreeSBIE has changed a lot since it's 2.0 inception, and certainly still has places it can go, however for what they have packed onto one CD it is very impressive.

It was an experience, and it was a shame wireless did not work, otherwise it would have made it much easier for me to decide to go with it, and do it. We shall see what the future holds for me, and my MacBook Pro.

Remember the tree?

So not too long ago we had a tree online that one could change the lights from on to off, and other such fun items, well here are some stats for the 20 days that it was monitored with Google Analytics:

Average: 4.76 P/V
Visits: 4,323
Pageviews: 20,577

That is twentythousand hits on an embedded system!

Sick thoughts :P

So, I was just thinking, what if I had two 80 GB HD's and a 160 GB HD? I could then gstripe the 80 GB's, and then on top of that stripe those with the 160 GB. Then I'd have around 320 GB or so, I could then gstripe that with a 320 GB HD.

Ohhh the possibilities. By that time, I'd probably just use some sort of gvinum, since apparently it can do raid 5 over hard drives that are not the same size. Something i'd like to eventually do as a way to keep my data safe and a secure.

Sick hackery -- FreeBSD's GEOM is awesome

I was really bored. Which normally results in some destructive thing happening to something I am playing with. This time it was Some of the hard drives in my FreeBSD box. Just a little back-story:

/dev/ad0 - 20 GB
/dev/ad1 - 40 GB
/dev/ad2 - 100 GB
/dev/ad3 - 60 GB
/dev/da0 - 8 GB
/dev/da1 - 8 GB

So, I had already made a gstripe(8) out of the two SCSI drives, da[1|2], however I wanted to see if I could do the same with ad[1|2|3]. As I did not want to resort to gvinum, which is rather heavy, and I was unable to figure out how it worked. The entire point behind gstripe is that since it is striped, the writes/reads are faster since it writes/reads to all the drives at the same time. So first I tried:

gstripe label -v st1 /dev/ad1 /dev/ad2 /dev/ad3

That however complained that it would only use 40 GB's on all of the drives, since the smallest drive in the collection was 40 GB. I then read up on gconcat(8), which concatenates all the drives together to look like one big drive, without the speed improvement of striping. So I figured, since FreeBSD's gstripe is GEOM based, it should not care about what the underlying data sink is, just that it is a device, so just maybe this could work:

gconcat label -v gb100 /dev/ad1 /dev/ad3

So now I had created a 100 GB "hd" at /dev/concat/gb100. I now did what I was planning to do:

gstripe label -v st1 /dev/ad2 /dev/concat/gb100

No problem! :-D. I now had 180.48 GB, of which only about 166 GB was usable. Which is still excellent. As it still came with a speed improvement. Followed up with the standard advice from the handbook I did the following:

bsdlabel -wB /dev/stripe/st1
newfs -U /dev/stripe/st1a
mount /dev/stripe/st1a /mnt

Which got me the following:

/dev/stripe/st1a    180G    5.5G    161G     3%    /mnt

Full:

Filesystem          Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a         496M     63M    393M    14%    /
devfs               1.0K    1.0K      0B   100%    /dev
/dev/ad0s1e         496M    230K    456M     0%    /tmp
/dev/ad0s1f          15G    2.2G     11G    17%    /usr
/dev/ad0s1d         1.4G    115M    1.2G     9%    /var
/dev/stripe/st0a     16G    4.0K     15G     0%    /usr/scsi
/dev/stripe/st1a    180G    5.5G    161G     3%    /mnt

w00tage. Next up I might actually add gdbe(8) or geli(8) even in front of the stripe, so that I will have an encrypted stripe. Talk about stacking. Might give gvinum a try sometime :P

All working:

keyhole# gconcat status
        Name  Status  Components
concat/gb100      UP  ad1
                      ad3
keyhole# gstripe status
      Name  Status  Components
stripe/st0      UP  da0
                    da1
stripe/st1      UP  ad2
                    concat/gb100

Moving my domains

I am moving my domains away from registerfly.com (not linked on purpose) and am moving them to GoDaddy. I was sick and tired of RegisterFly's website loading slower than molasses coming down from a mountain top. The inability to keep my account secure (someone logged into it, I got an email, and immediately change the password).

I apologize if there are any domain hickups in the process. I hope this helps me in the future for when I need to work with my domains, and change the DNS settings. Waiting for the login to happen for over 40 seconds is just not acceptable.

Control the Christmas Tree at UAT

Wanna play with a christmas tree remotely? Turn it on and off in our lobby? Here is your chance, visit http://uatree.0x58.com/index.html to turn the tree on, off, or scroll the lights up and down. And maybe, if the camera is pointing right, you can catch a glimpse of it on there!

Syndicate content