Archive for giugno, 2011

Bitcoin black friday

What is happening in the market for Bitcoin in my opinion can be explained easily if one considers how the market is still small, but how big are the interests against the development of a peertopeer coin without masters and with no state control. If i was a banker, a federal reserve, a credit card owner, paypal or a gold reserve owner for now I can invest very little money to cause a depression in the bitcoin market. Mtgox has a volume of some hundreds of thousands. I can easily buy bitcoin at 20 and sell at 15, rebuy at 15 and sell at 10. I will lose maybe some million dollars but this it is very very little in comparison to what I might lose in the future if bitcoin establishing themselves as digital money currently used. Some day ago there was Bilderberg Group reunion, i think some of the speech were about bitcoin and their risk for the establishement. Now someone is working on bitcoin… Could this stop the bitcoin economy? Surely a big deflation was a big advertising for bitcoin and now depression can stop enthusiasm of some folks but bitcoin are still a great idea and i hope there will a future for them because we all need their freedom.

Multilanguage flash

I recently created the multi-language version of a flash game that I had developed. Practically I had to change all the texts from static to dynamic so you can change their text. In addition, all messages sent by the program, had to be changed from fixed strings to variables. Most important of all, I had to implement a system that would make it easier to edit a text, add a new language, make sure that the user could click a button and change the language throughout the site. Logically, I decided to put all the text of the site in external files. I could have used XML file for this but I did not like their verbosity. I wanted something more like ini files that are normally used for this function. Searching the net I found an open source library that, among many other things, has a class that does just what I needed. The library is called Spring ActionScript and is the porting from Java to actionscript of an open source project. The class in question, then, is Properties. The documentation says in this respect: “The Properties class Represents a collection of properties in the form of key-value pairs.” Perfect! It was just what I was looking for. The class has only three methods, but just what I needed:

getProperty (key: String): String
Gets the value of property That corresponds to the given key.

load (url: String): void
Loads a collection of properties from an external file.
setProperty (key: String, value: String): void
Sets a property.

To be honest, I not even need the third method for this purpose.

At this point, I created my ini files. They are simple key and value pairs. Like this

! License free.
! Note : All ini files need to be saved as UTF-8
TITLE                    Title
MESSAGE                  Message
MSG_1                    Click "Close" or try to change the language
MSG_2                    You clicked "Close"
SELECT_LANGUAGES         Select the language
CLOSE                    CLose

I also created another ini to tell the program which languages ​​are present and how are named their files, here it is:

it        it-IT.language.ini
gb        en-EN.language.ini
es        es-ES.language.ini

Well, now I had to create a class that would manage everything. I created a singleton class (a design pattern that I hope all of you already know) so that was easily recalled by all classes of the program. Uhm, maybe it’s better than, if you are interested, you downloaded the zip with all the sample files so I can explain what I did without having to put all the code in the article.
Ok, first, have a look at what is inside the zip. There is the fla and swf of the example, the two external library i used in the code, the flashDevelop project, the 4 ini file used by the swf, a folder with all the flag for any type of language you could use in your project and a classes folder with all the source code. Do you think it’s enough? :)
Let’s see what the main class Languages does.
When Languages ​​is instantiated the first time, it creates a Properties, which will contain the names of the languages ​​that you have set into languages.ini and load it. Once loaded, set the current language to the first language found in languages.ini otherwise, in my case, set as default Italian. Then load the ini files for that language and, once done, does the dispatch of an event to warn that the language is loaded. You can now use the method getSentence to receive the string corresponding to a key for the current language. Another useful method of this class is changeLanguage that allows you to change the current language. Besides this main class I have also provided a class that allows you to automatically display the flags for the languages ​​present so you can easily change the language. The code, although it does not contain comments, it should be clear enough. However, if you have questions, contact me.

I accept Bitcoins

Have you heard about Bitcoins?

Bitcoin accepted

According to Wikipedia “Bitcoin is a digital currency created in 2009 by Satoshi Nakamoto. The name also refers both to the open source software he designed to make use of the currency and to the peer-to-peer network formed by running that software.

Unlike other digital currencies, Bitcoin avoids central authorities and issuers. Bitcoin uses a distributed database spread across nodes of a peer-to-peer network to journal transactions, and uses digital signatures and proof-of-work to provide basic security functions, such as ensuring that bitcoins can be spent only once per owner and only by the person who owns them.

Bitcoins can be saved on a personal computer in the form of a wallet file or kept with a third party wallet service, and in either case bitcoins can be sent over the Internet to anyone with a Bitcoin address. The peer-to-peer topology and lack of central administration are features that make it infeasible for any authority (governmental or otherwise) to manipulate the quantity of bitcoins in circulation, thereby mitigating inflation.”

In the past days I read a lot about bitcoins and I decided to accept them as kind of payment for my work. At actual change rate I will charge you 4 bitcoins/hour, less may be for big jobs.

I could also accept bitcoin donation if someone want to contribute… :)

My bitcoin address is 18kdp6EPHQjXZHWcgC3kdXw8cEQpgt3fKH
so fell fre to send me some bitcoin cents!!!

Return top