Wednesday, January 7, 2009

Merging Last.fm and Spotify

Many of you have probably heard of Last.fm, and some of you have also heard of Spotify. These are both great music streaming applications. Merging these two would undoubtly produce something that is greater than the sum of it parts. But what would that look like?



First, a quick summary of the two:

Spotify (portmanteau of spot and identify) is a Sweden-based proprietary music streaming program, which allows listening to specific music without delay via browsing artists, albums or created playlists. Spotify currently cooperates with Universal Music Group, Sony BMG, EMI Music, Warner Music Group, Merlin, The Orchard og Bonnier Amigo and more. So there is a huge selection of music that is just waiting for the user. There are exceptions though. You cannot find i.e. The Beatles, Pink Floyd and Metallica.

Last.fm is a UK-based Internet radio and music community website, founded in 2002. It claims over 21 million active users based in more than 200 countries. Using a music recommendation system called "Audioscrobbler", Last.fm builds a detailed profile of each user's musical taste by recording details of all the songs the user listens to, either on the streamed radio stations or on the user's computer or some portable music devices. This information is transferred to Last.fm's database ("scrobbled") via a plugin installed into the user's music player. The profile data is then displayed on the user's profile page. The site offers numerous social networking features and can recommend and play artists similar to the user's favourites.

Clearly, both of these applications have their advantages and disadvantages. With last.fm you cannot listen to spesific music unless you have these files on your own computer. You can however listen to music that's related to other music, that is i.e. if you like the american prog band Cairo (which is a great band) you can listen to a radio station named Cairo which contain similar artists. This is a great way to just explore new artists which you are more probable to like compared to random music, but you can't choose exactly what track to listen to. It seems that Last.fm has all the features that Spotify doesn't have and vice versa. This is no surprise however since Last.fm has built an application based on having access to the music through radio stations only. Having this as a starting point changes the focus and something more than a music player emerges.

The first step in the right direction has already been taken. On December 18, 2008, Spotify announced on their blog that they've added scrobbling as a feature in their application. Excerpt from blog:

Almost immediately after launch we started getting heaps of requests from people who wanted to be able to scrobble the music they were playing on Spotify to Last.fm (Last.fm is a cool music recommendation site for those of you who don’t know). The demand was so high that people started creating their own solutions to scrobble, which were cool but a little hard to install and run for the average user.


Spotify is not currently freely availible to the public. You can however get an invite if you have a little luck. Three hours ago the norwegian IT-website Hardware.no announced 100 free invites but they were taken away in just twenty minutes or so. There is a great demand. If you cannot get an invite, check out this article on downloading through a proxy (link).

We think the demand for better Last.fm integration will increase steadily as more users (especially Last.fm users) get to know Spotify a little better. There is reason to believe that Spotify will open to the public in the near future, and there's also rumours about an iPhone application being developed.

Monday, November 24, 2008

Photosynth - interesting initiative from Microsoft

On August 20, 2008, Microsoft officially released Photosynth to the public, allowing users to upload their images and generate their own Photosynth models. What is photosynth?

Photosynth is a software application from Microsoft Live Labs and the University of Washington that analyzes digital photographs to build a three-dimensional point cloud of a photographed object.

Pattern recognition components compare portions of images to create points, which are then compared to convert the image into a model. Users are able to view and generate their own models using a software tool available for download at the Photosynth website.

Here is an excellent video presentation from ted (please select flash version below):



So why is this interesting? Well, often we do not know what can emerge from new technologies like this. But one of the most obvious reason why this is interesting, is because it connects digital images together with respect to the content. This basically means that we're creating a large scaled network of images which is browsable and searchable. And over time we can develop very presice 3D-models of cities and certain objects around the world. Maybe this data and these models can help us develop better navigational tools and synthetic vision for other scientific fields, such as robotics.


_________________________________________________________
Further reading and sources:
Original website of video
Wikipedia - Microsoft Live Labs Photosynth
Photosynth website

Saturday, July 12, 2008

Monkey eating marshmallow using only its mind

The monkey uses a robotic arm, which it controls using only signals from its brain.

So why would a monkey be eating marshmallows with a semi cyborg arm? The answer is simple. It's hungry for a snack, and its arms are stuck. What options are there, but to utilize a robotic arm to fulfill its sweet desires? Not many, and it seems the monkey is pleased with this innovative solution.



This innovation could benefit people with paralysis and spinal cord injuries. The goal is to make a prosthetic device for people with total paralysis, and ultimately to better understand brain complexity.

Scientific experiments with animals are often topics of ehtical discussions. We contacted Michele D. Baum a resource person from the university conducting this experiment to ask a couple of questions (University of Pittsburgh Schools of the Health Sciences).

Q: How were the monkeys treated?
A: "...I can tell you that the monkeys are well cared for. Primate research is expensive, with each individual monkey costing more than $10,000. Beyond that, the U.S. National Institutes of Health and other funders invest large amounts of money into research that is often animal-based. It would not make sense to mistreat the monkeys. They are very well cared for."

Q: Is surgery required to interpret the signals from the brain of a monkey?
A: "The monkeys do have small arrays of electrodes, about the size of half a thumbtack, implanted on the surface of their brains. The electrodes themselves are very thin -- no wider than a human hair. The brain is not exposed. The brain also has no pain sensors and the implant is not painful to the monkey. Researchers often work with the same animal for many years. If the animal was not comfortable, it would not work, and the data collected would not be valid."

Thank you for your answers.


_________________________________________________________
Further reading and sources:
Mind over matter
Science Daily - Mind over matter

Tuesday, June 10, 2008

The basics of Java

The list of guides and tutorials describing the basic features of Java is endless (not literally of course). Instead of making yet another complete tutorial covering the basics of Java, this lecture will only briefly introduce the basics of Java. If you are a somewhat experienced programmer this short introduction might very well be all you are looking for. If not, that is, you are new to programming in general, it is recommended that you read one of the more careful tutorials available online covering the basics of Java, for instance Suns tutorials.

Assumptions

In the following I will assume your knowledge about common programming terms, for instance like pointers, variables, methods, constructors, classes and objects, and their attributes. How declaration of these are done in Java will on the other hand be shown.

Installing an IDE
An integrated development environment (IDE) is, simply put, a software combining the process of editing, compiling and executing. In an IDE the editor is typically a graphical text editor with spell checking, syntax highlighting and code folding, and the IDE makes compiling and executing the application effortless.

For beginners not known to the basics of compiling and execution it is not recommended to use an IDE, but instead only download the Java SE Development Kit (JDK) from here. The JDK includes Java Runtime Environment (JRE), which is required to run Java applications. For other users it is recommended to download the JDK bundled with NetBeans IDE from the same site. Alternative IDEs for Java is Eclipse and JCreator. It is interesting to note that both NetBeans and Eclipse is mainly written in Java.

Installing the JDK or the IDE is like installing any other application, so I trust you are able to do this without any guidance.

If you have decided to install only the JDK you need to add "installation/location/bin" to your global path and, if it is not already present, add "." to your class-path (the "." will make a Java-class able to use other classes in the same directory). The coding itself is the same as if you had installed an IDE, only you will be writing in a simple text editor and should save the code file as plain text, for instance as a text file named "MySource.java". Compiling a Java source code is done by writing "javac MySource.java" in a command line prompt positioned in the same directory as your saved source code, and execution can then be performed by writing "java MySource".

Creating the your first Java application
If you installed the NetBeans IDE you can create a new project by choosing "New Project..." in the "File"-menu. Select "Java" in field below "Categories:" and "Java Application" below "Projects:". Proceed to the next step by selecting "Next >". Here write the name of the project. By default NetBeans will create one package, a collection of classes, by the name of the project. The main class, the class that will be executed by the runtime environment, is by default simply named "Main". Normally this is not anything to fuss about, so simply click the "Finish"-button after typing the name of the project.

NetBeans will now display the initial class named "Main" (or whatever you decided to name your main class). The code between "/*" and "*/" are comments to the programmer. The code between "/**" and "*/" are also comments, but in addition these comments will be included in the automatically generated Java documentation if it is present just prior to protected or public classes, methods or object/class variables. If only the rest of a line is to be commented, one simply writes "//", these comments will not be included in the documentation. Viewing the code in light of these facts, there are only five lines of code:

1   package javaapplication1;
2 public class Main {
3 public static void main(String[] args) {
4 }
5 }

The first line simply states that this class is a part of a package, here "javaapplication1". The second line creates a class, here named "Main", by the statement "class Main", and that this class is set to be visible to the entire system, that is, "public". Line three creates a method named "main". This will be the entry point of your application, that is, the runtime environment will always provide control to this method in your main class. It should be declared "public", meaning that it is visible to the system, "static", that is, being a method bound to the class itself, and "void", meaning that it does not return anything. The parameter "String[] args" states that the invoker should provide a (possibly empty) list of multiple elements, called an array, of the type "String", that is a standard text object of possibly multiple characters. The elements of this array will be the arguments the executor provides, if you are executing the program from a command line prompt, the elements is the text written after "java MySource", for instance "java MySource argument1 argument2" will result in a list of two elements. The list can be accessed by the variable "args", which is a pointer. Line four and five indicates the end of the "main"-method and the "Main"-class, respectively.

Lets make the application display "Hello world!". This is simply done by adding the following code between line three and four above:
3.1           System.out.println("Hello world!");

"System" is here a class, like "Main", "out" is a class (static) variable representing a "PrintStream"-object, while "println" is a method in the class "PrintStream".

You can now execute the application in NetBeans by pressing "F6" or by choosing "Run Main Project" from the "Run"-menu. In the output field "Hello world!" should be displayed along with some information about the compiling and execution.

Essential notes about Java-codes
In Java all code must be placed inside classes. The variables declared at the root of a class is unique for each instance of the class if it is not declared "static", then it is bound to the class and common for all its instances.

Inside a class, a static method may only invoke another static method (or itself). This is because the static method does not belong to a object, but to the class itself, so it would not have known in which object the non-static method should be invoked. On the other hand, non-static methods can invoke both static and non-static methods.

To access members of a different class, one needs to inform uniquely the environment in which the member should be accessed. To access a static variable "var" in the class "MyClass", one simply writes "MyClass.var". In order to access a non-static variable "var2" in the same class, one needs to inform in which class instance, that is, in which object, the variable should be accessed. A object pointer to the class is then used, name it for instance "obj", and access is then granted by writing "obj.var2". This object pointer can be declared as following
MyClass obj = new MyClass(...)

where "..." indicates the arguments to the constructor of the class.

The same applies to the methods. To invoke a static method "myMethod()" in "MyClass" one simply writes "MyClass.myMethod()". The non-static method "anotherMethod()" can be invoked by the use of an object pointer "obj" of the class, and write "obj.anotherMethod()". Arguments to the method is placed within the brackets. Multiple methods can be declared with the same name as long as the parameters differ, in number or type. Note that two methods can not both have the same parameters, thought they return different types.

Both variables declared at the root of a class and methods (who must be declared at the root of a class) have access level modifiers. These modifiers determine whether other classes can use these variables or invoke these methods. There are four types of modifiers; "public", "protected", "package" and "private". If declared public "public" it is visible to all classes (as long as the system know where to look for the class). On the other end "private" indicates that only the class itself may access this member. "package", a access level obtained by not using any modifier, states that all classes inside this package should be able to access this member, while "protected" also includes any subclass of this class, even if it is not inside the same package.

Classes may be declared without a modifier or with the modifier "public". The effect of these options are the same as for variables and methods as described above.

Inside a method one may declare new variables. These can not have access level modifiers and are only visible before the closuring bracket corresponding to the first previous starting bracket. The interval a variable is visible is called the scope of the variable. If a variable of the same name is already declared, the use of this name will refer to the first previously declared variable of that name, that is, the variable latest declared.

If you were able to keep up with this introduction you should be able to start programming in Java, thought no-one expects you to be an expert at the time, if you have a half-shaky grip of the syntax, you are probably only a couple of hours of test-programming away from being able to code most applications with the use of the Suns application program interface (API), provided that you know an algorithm for each challenge in question. If you feel not smart at all on Java, it is recommendable that you read a more careful introduction tutorial to Java before proceeding to the next lectures. These lectures will be more advanced and not explain any basics of programming in general, but only the subjects in question, which can be program-technical, like multi-threading, or implementation of efficient algorithms for solving specific problems.

Monday, June 2, 2008

All about lithium-ion-based batteries

Modern portable electrical devices typically use batteries based on lithium-ion or its evolved technology lithium-ion polymer. Older devices used nickel-cadmium- or nickel metal hydride-based batteries. The similarities in advised use between these technologies are not only distinct, but almost complementary, in the meaning that the ideal use of one is (close to) the worst case use of the other. After looking into the history and the resulting myth, advice of proper use of lithium-ion will be presented, and finally we will conclude by looking into the future. Our main focus is on lithium-ion-based batteries in modern laptops.

History and basics

In 1983 the first commercial portable computer running on batteries became available. It used a battery technology based on nickel-cadmium (NiCd). In the next decade batteries based on nickel metal hydride (NiMH) and lithium-ion (LiON) became publicly available. For some time they fought nose-to-nose for customer's acceptance, ultimately leading to the victory of the LiON-based technology. As a result, most portable computers and digital cameras use LiON-based batteries, while mobile phones are typically based on a battery technology evolved from the LiON-technology called lithium-ion polymer (Li-poly), which are more robust to physical damage and cheaper to produce.

The advantages of the LiON-based batteries is its superb energy to weight ratio relative to its competitors, its slow in-use degeneration rate and the lack of a so-called "memory effect", which is both present in NiCd- and NiMH-based batteries. However, there is a great drawback. Batteries based on LiON-technology are ageing from the moment they are manufactured, regardless of whether they are charged or not. This means that an older, but unused battery will last shorter than a identical battery manufactured more recently. However, this disadvantage does not seems to frighten as much as its advantages attract, resulting in a wide use of LiON technology in many portable electrical devices.

In use, a lithium-ion typically lasts between two and three years or 300 to 500 full discharges/charges. The discharge/charge rate presented here is not depended on complete discharge/charge cycles, that is, if half of the battery's capacity is used twice, the sum of these uses counts as one, not two, full discharge/charge. It should be stated that these numbers are not based on the ageing or degenerating previously commented alone, but also on the average use of these batteries. With optimal use one can expect much better result because the degeneration can be somewhat delayed, but more importantly, the degeneration can be, and in most cases are, greatly accelerated.

Myth and the effect of its use
Since a flawed use of NiCd- or NiMH-based batteries often resulted in a distinct lack of power, these batteries' need for full discharge/charge cycles have become publicly known. That is, these batteries ideal use were to fully discharge the batteries before recharging, and during recharging neither use or cancellation were recommended. These batteries were said to remember early charges or discharges, a memory which resulted in lack of power. This effect was and is widely referred to as the batteries "memory effect", and indeed, such improper use of these batteries will result in high degeneration rate.

LiON-based batteries do not provide such a memory effect. Nevertheless, most people still believe this effect is present in all or most batteries still in use, indeed including the batteries used in devices such as laptops. Not only is this a wrong understanding, but the use of this "knowledge", or should we say myth, is also the main contribution resulting in the accelerated degeneration. That is, fully discharging and recharging LiON-based batteries can and often will have crucial effect on the batteries duration.

If close to fully or fully discharged, a LiON-based battery's internal safety circuit opens and it becomes unusable in the sense that it will not recharge. If it is not fully discharged, there exists some boost functions that can be able to reactivate the protection circuit and make the battery recharge. Standard chargers will not perform such a boost. Furthermore, if the battery is fully discharged and has been in such a state form months, a boost function will probably not only fail, but may also be dangerous. In addition, a LiON-based battery is expected to degenerate faster when close to fully discharged than if kept at a somewhat higher charge level rate.

On the other hand, fully charging the battery is also not recommendable. Thought it is not the charging itself that is the problem, the result of keeping a battery fully charged is crucial. As noted, any LiON-based battery degenerates from the day it was manufactured, however, a fully charged battery degenerates much faster, especially in combination with a warm environment. In a environment of 60 degrees Celsius a fully charged battery will within three months typically degenerate to 60 % of its capacity, while a 40 % charged battery in the same environment will only degenerate to 75 % after a year. From these numbers it should be clear keeping LiON-based batteries fully charged will greatly accelerate its degeneration, and indeed, most users who try to follow the old battery-friendly tip of full discharge/charge cycles keep the charger connected after the battery is fully charged, thus resulting in accelerated degeneration.

Proper use
As noted, LiON-based batteries degenerate much faster when kept close to fully or fully charged. In special situation when extra battery life is needed, like on long trips and so on, one must by all means fully charge the battery. Thought, in such situations the battery should be charged only shortly prior to departure in order to keep the battery fully charged as short as possible. However, in normal situations when one simply sits by the outlet, an easy, but not optimal, solution is to disconnect the charger before the charge level reaches 80 % of full capacity. This should also be done prior to journeys where full battery life is not needed.

To avoid the opening of safety circuits and acceleration of degeneration, it is also recommendable to reconnect the charger when charge level is approximately 20 %. Again, if an outlet is not available and the laptop is needed for use, one must of course keep using the laptop. However, it should be a good reason for forcing the last 5 % out of the battery, since both the danger for opening safety circuits and the level of degeneration increase dramatically while approaching a fully discharged state.

The heuristic of disconnecting and reconnecting the charger is often easy to apply, but does not offer the best result. In the case when one is sitting nearby the outlet, which normally is the typical case, the best solution is to disconnect the battery itself. The battery should be disconnected when the charge level is approximately 40 % and stored properly (see "Storing of lithium-ion batteries"). Please note that disconnecting the battery, thought good for the battery itself, increase the risk of loosing your work to what is present for desktop computers. That is, if one has disconnected the battery and the power fails, the laptop will immediately power off, not leaving any "Do you wish to save the changes" or alike. However, thought varying between each location, normally the power is quite stable, so this downside may not be preponderant.

Storing
As is the case in the recommended use of these batteries, nor in storing is it wise to keep the battery at high or low charge level. The recommended storage charge level is 40 %. The reason this charge level is somewhat high is to keep the battery's protection circuit operational during prolonged storage. Thus, if you plan to store the battery for a shorter period, it might be wise to keep it at a lower charge level, say 20 to 30 %.

The storage environment's temperature can be vital for the battery. Thought freezing the battery is not a good idea, the battery should be kept coldly, about 0 degrees Celsius is a generally good rule of thumb.

To see the effect of these rules of thumb, we previously commented the decreased degenerating achieved by storing a battery at a lower charge level, that is, a fully charged battery stored in a 60 degrees Celsius environment will typically degenerate to 60 % within three months, while a battery stored at 40 % charge level will typically only degenerate to 75 % within a year. Furthermore, if the environment had been of 0 degrees Celsius, one could expect the battery to only degenerate to 98 % in a year, which under the circumstances must be stated as an acceptable degeneration rate. Finally it should be noted that the longer one plans to store the battery, the more important it is to keep these guidelines.

Digital memory
As commented, LiON-based batteries does not possess the "memory effect" present in both NiCd- and NiMH-based batteries. Nonetheless, there is a effect present in these batteries referred to as "digital memory", referring to the memory of a fuel estimate present in many devices using batteries, including both laptops and mobile phones. Short discharges and recharges does not provide synchronization of the fuel estimate and battery's state-of-charge. The effect of this "digital memory" is not related physically to the battery, as was the case for the "memory effect", but it will make the fuel estimate increasingly less accurate. To avoid this effect one performs a calibration by fully discharged and then recharge the battery. To eliminate the failure caused by the "digital memory", it is often recommended to perform a calibration once every 30 charge.

Does lithium-ion-based batteries belong to the future?
Since it became commonly available, the use of LiON-based batteries have been discussed, and still is, thought its competitor based on NiMH is not much used. The technology behind the LiON-based batteries have been continuously developed, and the development is still in progress. By obvious reasons it is of particularly interest to decrease the natural ageing of the LiON-based batteries, and progress has been achieved.

Thought development and progress, it should not come as a total surprise if a new technology claim the battery-throne in the near future. After all, the progress of existing technology typically only results in modest improvements, while users and scientists keep dreaming of laptops lasting weeks – or maybe years. Having said that, progress has been unexpectedly slow in the field of new battery technologies for the consumers marked, so it might remain with the dreams for yet some years to come.

_______________________________________________________
History of laptops
Is lithium-ion the ideal battery?
Lithium-ion polymer battery
All about laptop batteries
How to prolong lithium-based batteries
Sweet Nanotech Batteries: Nanotechnology Could Solve Lithium Battery Charging Problems

Tuesday, May 27, 2008

Fun with programming - JavaScript

This is a great example of creative programming. Check out this neat JavaScript.

Instructions. Enter a website that contains a lot of pictures (example). Then copy this script into your adress line, and hit enter.

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0);

Neat!

_______________________________________________________
Further reading and source:
StopGeek - Neat trick with JavaScript

Phoenix lands on Mars

24 hours ago NASA's Phoenix spacecraft landed on Mars. It's the first successful Mars landing without airbags since Viking 2 in 1976.

So, what is there do be done on Mars? Well, there is plenty of information to be gathered. The complement of the Phoenix spacecraft and its scientific instruments are ideally suited to uncover clues to the geologic history and the biological potential of the planet. Phoenix will be the first mission to return data from either polar region providing an important contribution to the overall Mars science strategy "Follow the Water".

Follow the water?
Without a clear presence of surface water, it may seem like a strange name for a Mars exploration. How can we follow water, when it doesn't seem like there is any to be found?

Following the water really means looking for scientific evidence that water was present in the past or is present today, either below the surface or possibly in rare locations near small, hydrothermal vents like those we might find at Yellowstone. Our Mars missions have already sent back views of the Martian surface that seem to show evidence of dry riverbeds, flood plains, rare gullies on Martian cliffs and crater walls, and sedimentary deposits that suggest the presence of water at some point in the history of Mars.

Illustration of the Phoenix landing
Illustration of the Phoenix landing

The Phoenix will contribute to our overall picture of Mars. It will help us to determine if life ever arouse on Mars, and to understand its climate and geology. In addition it could also contribute to the preparations for human exploration.

_______________________________________________________
Further reading and source:
NASA - Phoenix Mars Lander

Dagbladet (Norwegian)