I present to the world my latest invention, FBChatAT. A Facebook Chat Inline Auto Translation tool for Google Chrome. (If you don't use Chrome then click here, install, and be set free.)
When you receive a message in Facebook Chat, the extension will automatically translate that message into your native language, then insert the translated text underneath the original message. This allows you to review/read the original messages and translation simultaneously while you chat.
Secondly.. To type in your native language and have it automatically translated out: An extra textbox is provided at the bottom left of the screen. Type into this box your text will be translated and shown in the space provided above. If/when you are happy with your outgoing message, press 'enter'. This will push the translated text into the current active chat flyout/window. Press 'enter' a second time to push the message into the chat stream.
The default native and foreign languages are English and Traditional Chinese respectively. You can set your preferred languages in the options page of the extension. (Right click FB button in toolbar and choose options).
You may find the full source for this extension on GitHub.
This extension uses Google Translate for the translation.
This idea stemmed from something I've wanted to try for quite a while. That is to train a pet to do something, maybe even something convoluted or unnecessary, to get food or a treat.
Well I finally have the opportunity to build such a contraption. We recently adopted an orphan cat, and have also recently acquired a lot of spare time. So here's the goal. A small machine that dispenses treats when the cat pushes a button. Some design goals:
Large container for cat pellets that empties FIFO style.
Some controlled mechanism of dispensing above-mentioned pellets.
Sensor feedback to indicate when pellets had left the machine.
UI feedback to indicate state of machine. (Ready, Dispensing, Done)
Easy UI for animal to prompt pellet dispensation.
It ended up looking like this..
The cat is meant to press the paddle and then wait for their surprise to pop out the hole. The machine body is made from a cake box and cardboard. Everything was stuck together with cello-tape. Not the best building materials I know but that's all I had at the time.
I thought it was going to be really easy to teach my cat to interface with the machine... Turns out he got impatient quite quickly, and was probably more fascinated with the sound of the spinning motor, than the treats popping out the front.
A breakdown of the electrical components I used:
Arduino Nano
ULN2004A Darlington Array
Some colored LEDS
Resistors. I think anything between 0.5k to 2k should be fine.
Photoresistor.
Stepper motor of your choice
Power source suited to your motor
The following is what I cooked up around the Arduino. A lot of this was trial and error as I am a programmer and not an electrician. Needless to say this was all a large learning curve (which is what I wanted).
The final Arduino Sketch ended up looking like the below. It wasn't all that I'd hoped it would be; I had gotten fed up several times with trying to monitor time based operations on the Arduino. My sketch always seemed to end up dying after a few hours?.. After a while of hopeless debugging I resigned to just removing the offending bits of code. Sad I know, but actually not too bothered since this is all for the cat. The initial more-feature-complete-sketch can be found here. That still has the photoresistor feedback and some other time based functions in it.
int motorPin1 = 2; int motorPin2 = 3; int motorPin3 = 4; int motorPin4 = 5; int spinDelay = 25; // the delay between motor steps int spinAmount = 220; // how many steps should the motor turn? int motorState = 0; boolean motorDirection = true; // used to alternate between motor directions
int redLight = 6; int greenLight = 8;
int buttonPin = 12; // the pin that the pushbutton is attached to int buttonState = 0; // current state of the button
Pushing a button or paddle turned out to be way complicated. I thought a nice big paddle was going to be easy for the cat to just stomp on with his feet. I don't think I could have been more wrong. As intuitive as buttons are to humans, they make no sense to animals. Next time I would place the push button in or on the area where the pellets exit the machine. For a -long- time my cat tried to extract pellets out the machine by pushing his paw in the exit hole. This makes a lot of sense now looking back.
I certainly wouldn't use cardboard and cello-tape to build again. The hardest part to manufacture was a device to let pellets out of the store in a controlled fashion. Moreover, a machine like this needs to be built out of something solid and heavy; More than once we came through to the living room to see the machine knocked over with pellets everywhere.
This class is designed on the assumption that your barcode scanner hardware will act like a keyboard. As a barcode is scanned a series of keypress events will be generated by the device. If these key events are in fast enough succession (the order of milliseconds), then it can be assumed that a scanner device pushed the series of key events. Otherwise it is just normal human input and will be ignored by the barcode reader class.
How to use
Include the following code in the head of your web page.
Last year Robyn and myself travelled to Cape Town. This is a picture of the town called Kalk Bay. We stayed there for two nights in a B&B just opposite the Brass Bell. This is a great town for perusing second hand shops and finding antiques. For the fishing village it is, there is a vibrant young culture.
Information abundant: information pools, information pockets, information streams, information databases; Information sources of so many types delivered in so many formats. I have too much information to manage it properly. Well, when I say 'properly' I mean there's too much to remember all of it, digest all of it, to take full potential of all the data being delivered to me.
I am a child of the information age: When I wake up in the morning the first thing I do is get behind my computer to catch up with the world around me. I've got social networks, business networks, email accounts, and am a programmer so have a multitude of other internet services and jobs running on schedules. I need(read want) to know certain things at certain times. If a client has requested my attention via email I need to know as soon as possible. If it's my mothers birthday I need to know 7am in the morning. If my web server goes down, I need to know five minutes ago.
With so many online services and so many of them offering an RSS/Atom stream about nearly everything; An RSS reader does a good job on keeping me up to date with 66.67% of my knowledge source. But even reading my master RSS feed every morning doesnt provide all the information I need, but more importantly it doesnt invoke some simple actions that I find repetitive when I come across certain data.
I have a facebook account; I want to be alerted of birthdays in the early morning.
I follow some twitterers'; I only want to view tweets that are re-tweeted.
I have family members on Flickr and Picasa; If they post photos then I want to see them, better yet funnel them straight to my wireless photo frame in one merged Media RSS stream.
I've got an AreMySitesUp account: I need to urgently know when my servers are unavailable.
I've got Gtalk, Skype and AIM acocunts...
I have setup FTP locations that clients drop work in...
I've got several email accounts...
I follow several open source projects on forums, bug trackers, and version releases...
I run several projects and each of those have several checks and balances in place to make sure all is in order.
I could go on, but the point is made. I've got so many sources of information of varying types and each hold a certain level of importance or urgency to me. Now I want a central way to organise all of this; A way to manage and schedule my information.
I am a programmer; I'm going to make something. An information engine. This engine will:
I'm often travelling around the world in Google Maps Street View. From the Eiffel Tower to the The London Eye. When Street View first hit the Maps product I was absolutely amazed.
Since first reading about all the legal and privacy ramifications of this technology I've had a personal quest to find a person that somehow missed the fuzzy face filter. Up until now it's been a very unsatisfying search - thank you Google; But today I'll be collecting my quest points and moving on. The following cyclists face was found after reading Google's post on their trikes and the new LegoLand footage. Even though its not a fully disclosed face, its the the most clear example of one I have come to finding.
Guess they missed this because of the glasses. Maybe on purpose as well, but if that's the case then I'm kind of surprised because it's surely safer (legally) just to blur faces with glasses or any other obstruction as well.
Javscript on the serverside,.. it's happening; I'm drawn in by its beauty.
My workplace requires I base our web applications on a Microsoft product foundation. Not that I've got anything against Microsoft (I do, but even so..), I just prefer more of the non Microsoft founded languages. I'm also a dynamic language fanatic. C# and friends is great, but it just doesn't fit my bill (I am looking forward to playing with more of the Iron** products they pushing out now; very interesting combo.)
What I love about Javsacript: It tends to be platform, vendor and pretty much all round - neutral. It's a dynamic, flexible and powerful syntax. I'm sold on it. Even better when it comes to web apps, now I'm playing with JS on the clientside and serverside; The consistency is awesome.
I've started building my take-over-the-world-its-so-powerful-framework; and it's in Javscript; On a Microsoft platform... [Awkward silence]
It's still all quite new to me, and I can't quite believe its working so well in our work context. I've basically setup a platform neutral interface of JS objects. I then create all application and framework objects above that. Below the interface sits a layer to allow all of the above to run on the MS JScript engine.
One thing (large thing) I haven't addressed is the ServerJS standard that's in formulation. Someday,.. but for now I'm just playing around. For example; I can now execute code on the server that looks something like this:
function getUsers(type) { return $(['getUsers', 'usertype=' + type], function() { var s = { title: 'Users of Type: ' + type, data: new Array() }; db.query('select * from grv_user').each(function(o) { s.data.push(o); }); return s; }); }
This example function prepares a response object (that will be JSON'ized), reads a list of data from the default database, and handles caching of this result in a tag based cache.
I'm personally quite happy with my new playground; I can squeeze a lot of functionality into a few lines. (Not that that's the point, but my RSI appreciates it). The serverside framework I've put in place includes a stripped version of the MooTools Framework. Fabulous!
Recently I installed Fedora 10 and ran into some difficulty trying to install the correct drivers for my graphics card - a GeForce 6800. After much searching, and re-installing a couple times, I found these simple steps to be my answer.
Yesterday I bought my first digital photo frame. It's a Kodak W1020. It has its ups and downs (imho), and I've been stirring up some ideas for this new gizmo of mine.
The major ups:
It's wireless
It reads from media rss streams
Without too much hassle I plugged in the power, latched into my home wireless network, and had connected to my Flickr account. Soon after I connected to the open net the frame asked if I wanted to upgrade my firmware - I did so and it was painless and easy; I would reccomend doing this.
My major downs:
My second button on the vertical menu does not work. Darnit!! Most of the time it is used as a play button and I can get around not having it... but its just damned annoying.
Minimum change time of 3 seconds... would like it to be smaller (I'll explain why later).
I cannot get my (vertical) images to 'Fill screen'? (Image's can either leave space either side or get cropped in order to fill display real estate.. I prefer fill screen)
So I'm happy with the purchase but I think they've got a couple things to fix for the firmware upgrades.
Congrats and crits aside.. Here's my latest idea: Since the frame can read and display images from a properly formatted media-RSS feed, host such an RSS service on a machine on the same local network as the frame.
This RSS feed could/would be the aggregation of interesting media sources such as my Flickr stream, my contacts photos, youtube videos, etc. Further more I would like to be able to plugin RSS feeds that provide small amounts of textual info, like microblogging feeds or news headlines. The textual info should be rendered to an image, which is then cached on the stream server, and can then be picked up by the digital frame.
This is all a means to an end. The main idea here is that now I can write a small app that polls my email accounts. Then when I get an email I can push an alert to a text rss stream, which will feed into my RSS engine thingy, render the relevant picture, and ultimately get displayed on my digital picture frame sitting in front of me on my desk.
Further down the line I thought it would be great to hook the frame up to my VOIP client. So as I get a call, the frame should display who's calling me with a pretty picture of them. The problem here is latency of the picture change on the frame. 3 second changes for something more realtime as this is not practical. One last idea,.. Winamp plugin: on song change - display song details?..
The more I develop this idea in my head the faster it grows - cant wait to make this (or for someone else to make it first).
It seems the web is awaking to the concept of interoperability between service providers. I read somewhere, and so true it is, that it's ironic how, in a sense service provision is returning to the 'mainframe'. The web as a platform offers so many advantages over the desktop platform, but in many regards the desktop is still the home to the user. So; how can we get the web up to speed - not to replace the desktop, but to be as comfortable, secure and integrated as the desktop? What do we need? What does the user want? What do I want? Here's a couple of ideas... It's not an exhaustive list; It's just some ideas. The web in the future:
Everything is open
Everything is decentralized
User space is shared and accessible
The user has control of their own information
So How do we decentralize our systems in an open manner? Security and data integrity is a critical issue shaping the web. Decentralization and openness always comes coupled with policies and procedures. So how do we share personal and business intelligence in a fair and controlled manner? If a user has permission to view or mash information on one system, how can we securely let him reference that information from another system? (I realize this is a paragraph of questions,...) It is becoming more frequent to perform more of our daily work functions online; The trend of remote storage and processing is undeniable. The internet computing cloud is storming. I myself do not store email, pictures, video or music on my local computer; All of these are provided by -free- online services. In my work environment 4 out of the 6 regular applications I use all reside on the intranet. Another interesting thing to watch is the commercial adoption of social engineering (or more generally any 'Web2.0') platforms. Work environments, at least the ones I've worked in, either embrace the evolving web, or try and firewall it out. I always enjoy hearing of success stories from organisations that have embraced the evolving web; One of the examples that spring to mind is that of the micromessaging arena. Many companies now use Twitter et al to communicate within their organisation - and find it very effective. There are now many comercial micromessaging platforms that offer packages to willing corporates that want the paid support. So what - Why am I mentioning this?
I believe the web is the dominant application domain now - and if your industry doens't fit into this rather swooping statement then, I beg to argue, that it most likely will in the future. Now I can either be in the company that waits to see what happens with the web and design my business around accordingly, or I can storm ahead and be on the forefront of the evolving web platform. Gotto admit - I prefer setting trends rather than following them. What do I want my web platform to be? As a starting point I'm just going to throw together another list. This will be a few things that I would like to see out of a web framework, and the web in general. [Some are slightly redundant, but I thought it coloured in the picture nicely]
I, as a user, want control.
As a user, when I open my browser (or log on to the internet per say), I want to have access to all my information, all the time.
I need a clear entry point or a mechanism to manage my online life.
I want a platform that will abstract (hence simplify) the communication between different flavours of the same product type. Example: Which Instant Messenger do you use? AIM, Gtalk, Skype, SIP, Gizmo, XMPP? What about your friends? This issue has been cordially addressed with the applicaiton of XMPP and multi-protocol clients, but this is an example of the open web and the need to find common ground between service providers.
I want to be able to choose where I store my personal data and for that data to be seemlessly accessible from everywhere else I go. Exmaple: If I'm at work, I do infact want to set my web-desktop background to that picture of my wife and kids. Sure some business policies will prohibit personal data accessability, but for those work environments that aren't so, dare I say 'old-school', as to lock down everything, I want this accessability.
I want clear ownership of some of my information. Example: I want to store my financials and budgets on my FTP server at home, but these should be as readily available to myself, as my online photo album. [And no,.. I don't want to carry around a portable FTP client on USB.] I want a web-desktop that seemlessly integrates with my online data, and my personal data at home.
Some people are technical,... some are not. This is a fact of life. If the system does fit a decentralized model, the take-home installer should be simple to setup. I want to addon to my web desktop system and code new plugins - My sister does not; She just wants to click once and install - Furthermore, my mother doesn't understand what installing is, she just wants to logon to a hosted solution.
My web-desktop system I host at home, the one I subscribe to online, and the one we use at work should in some manner communicate and synchronize.
I want to access my web-desktop from a plethora of different devices; Such as my computer, mobile phone, UMPC, or any other capable computing device.
Well some might say that these things are highly improbable. How will the world accept such infusion between all of a persons online life?
Will business's ever let me have access to my personal desktop (or portions thereof) at work?
How many end users actually understand the concept of decentralization? (Few would be my guess.) I tried to explain OpenID's to my wife once and she could not see the purpose of it.Worst case scenario,.. lets just wait for my generation to pass. I would put money on it that in ten years every site will be OpenID enabled. The problem with most users in this 'internet generation', is that even though we all know how to use a computer , unless there's a need to know, we don't want to. It seems the best time to teach a generation of users new concepts, is in their infancy. In some ways this makes me sad that the digital-experience I yearn to have will only really become a reality for the next generation.
So what do I want? I want a desktop for the web. A platform for integrating all my online escapades into a web platform. My very own personal web desktop.
So this is what I've managed to do with some simple image comparison thus far... I've repackaged it all to try make some sense of it; The sample apps reside in com.b22222.app.webcam; The most informative app probably being WebCamState.java
I've simply zipped my source folder. I use eclipse at this present time and have left my project settings file in the archive. The sample apps require java's JMF to be installed on the system.
What are my goals? I want to design some kind of (physical) contact free input system; This system should be as functional as, or more than the standard keyboard and mouse. Now that's the main goal... A bunch of other possibilities have come alive since I've been tinkering around. I can now set my camera facing the front door and get email alerts at work (with pictures of the culprit) when motion is detected at home. I've also got plans in the pipe to design a kinetic sculpture that reacts to motion in front of it. The list continues.
Where am I now? I can continually read from a live stream of webcam video and dismantle the picture into more pliable data. With this data I can pick up motion hotspots, primitive edge detection (particularly bad on blunt edges), and some noise reduction. All this is demo'ed in the attached library of code. Please keep this in mind that I develop in spare time by myself who has never studied image or video in large depth - I mostly only design as much I need to progress onto my next goal.
Most general application settings end up in my settings.ini file. This might be a good place to start tinkering with values if you want to poke and prod my library. I had tried to use a neural network to interpret webcam input but it never really worked. I have left my code there in case I revisit that idea. The neural net library I used is called Joone and is freely downloadable.
Details of how I dismantle an image: Although I have copied the code in several places throughout, the best piece of code to reference this process is probably com.b22222.routine.ImageHelper. A BufferedImage (Raw Image pixel data) is drawn from the webcam source. This image is converted into what I called a State object. A State is simply a 2d array of integers. At the moment this array represents the brightness on the pixels from the image. (I plan to somehow incorporate hue difference into this as well in the future.) From here you should partly forget that you are working with images, but rather arrays of numbers. I did this so that from here our code could be used for any map of numbers - Say cloud patterns, or temperature maps. (Not that I ever intend to go down this road myself)
A Comparison is an object drawn from the difference of two States. If I remember correctly I just subtracted one array from the other. We now have a new array of numbers representing the difference between to images. This may help two fold; a) I'm obviously searching for motion, and b) if 70% of an image rarely changes then we want to consciously ignore it.
Next a primitive EdgeDetector object can process the change map to emphasize the edges of island and lines. This is not an essential stage and could quite likely be taken out if it is silencing too much useful data.
After that I found two statistics of the data in the array: The average, and the *standard-deviation. Then using these multiplied by factors specified in the settings file, if the value in the array is not greater than the average + std-dev, then it is set to zero. This helps clean up small noise generated through subtle light differences, etc.
The array that is now left contains data that is somewhat usefull to me. And hopefully you :-)
*Ps: I always mixed up standard deviantion and variance. It's one of the two. I think.
This can all be seen in action in the com.b22222.app.webcam.WebCamState class. Instructions for use: Run the app. Wait for the video feed to register in the left window. (Mine usually takes a few seconds). Then click the left button titled 'Capture Base Image'. This will set the image to compare against for motion detection. Now click the right button titled 'Start Compare...'.
Here is a demo of when I tuned my settings to pick up my black pen against a white wall. (The red circles are rendered onto the image in areas of interest. The double green circle is the center of gravity of the points of interest)
What do I plan on doing next? Creating a more 'opaque' input interface. This interface would expose some events and hide all of the workings by the libraries described above. This interface will most likely provide some kind of coordinate information. I would also like to provide, but have no idea how, a polygon best representing the image input.
Long term? I'm thinking of a menu/list based input system. A user would navigate from menu to menu choosing options which would either automate keyboard input or mouse input. This is in part a resignation because I don't think getting pixel perfect mouse positioning will be viable with webcam input; but storing keyboard/mouse inputs in templates, sequences and menus could reduce work for repetitive actions normally done on these devices.