Thursday, December 9, 2010

Israel 21c post on the tierx application

Prepare for a revolution in social media marketing 

By Jeremy Last

A groundbreaking product from an Israeli on-line marketing service is set to revolutionize the way social media is utilized by the corporate world.

Once the exclusive realm of a handful of computer geeks, over the last five years social media networks have been transformed into an Internet phenomenon with hundreds of millions of members.
Businesses across the globe are aware of the potential inherent in these networks to connect with customers, but few have been able to take full advantage of the ever-growing databases belonging to websites like Facebook and Twitter.
Now a groundbreaking product, developed by Israel's on-line marketing service provider Valueshine, is set to revolutionize the way social media is utilized by the corporate world.
Valueshine's Tier-x software enables companies to turn every customer into a business partner, generating their own profits through the power of social media networking.
These partners are able to bring in more customers, and earn money, through the simple marketing power of personal recommendations. Customers use social networks such as Facebook and Myspace as well as email accounts like YahooMail and GMail to invite friends to join their mini-network.
Taking the gaming world by storm
The gaming industry has been the first to jump in. Six months after Tier-x's January launch, Valueshine has already built a bespoke version for leading online poker site, owned by British-based Internet gaming conglomerate PartyGaming.
Called the Noble Partners Program, it is the first time ever that players are able to earn consistent dividends from online poker even when they're not playing. This innovation is taking the Internet gambling world by storm.
Valueshine's chief technical officer Gilad Manor was a key member of the team that developed Tier-x. He joined Valueshine in 2009 when it had been providing boutique on-line marketing services for high-tech companies, focusing on affiliate recruitment and management for six years.
"The obvious trend we saw was that the world is going social - in the gaming industry, entertainment world, in news, even in the way people shop, Manor tells ISRAEL21c. "The network is becoming global and local at the same time. People have friends from all around the globe while staying in close contact with the same group of people. The strength of community-based services is on the rise."
It was this realization which prompted the creation of Tier-x and encouraged Noble Poker to get involved. Previously, on-line poker sites generally attracted players through advertising and search engine optimization. But Noble Partners relies on a far more reliable source - word of mouth.
A new approach to business
Launched in mid-August, the product already boasts hundreds of members and Manor is excited by the potential impact the Partners Program could have on the entire on-line poker industry. "This new approach could change the way Internet poker companies do business. It's very exciting," says Manor.
Unlike other referral schemes, the Noble Partners Program pays players every month rather than giving them a one-off bonus, and the money earned is real cash. Once they become Noble Partners, players create their own networks and then earn a percentage whenever their friends play, with the cash paid directly into their Noble Poker account each month.
Manor has been "exhilarated" by the response to the launch of Tier-x and sees the success of Noble Partners as only the tip of the iceberg. "From the early, positive reactions we've been getting, I think it has already changed the way things work in on-line poker.
"I think the conventional ways of recruiting new players in the gaming industry, particularly in the poker industry, are worn out. The poker room companies are all using the same methods and nobody has any edge. The Noble Partners Program is an edge no one else has right now."
A major change in marketing practices
Valueshine is currently building similar products for other companies and industries. According to Manor: "The advantages of advertising through word-of-mouth marketing rather than the cumbersome traditional advertising methods can be applied to most businesses. We can see hotels and restaurants, credit card and insurance companies getting involved.
"People are tired of the traditional advertising they are subjected to day in, day out, on the Internet, on the television, on billboards. You naturally build a wall and defend yourself from that mass exposure to information. But in spite of that you always rely on a good word from a friend. If a friend recommends something and enjoys it you are more likely to use that and join that group yourself. That is what we are building on," he tells ISRAEL21c.
Manor is particularly enthused by Valueshine's placing itself on the cutting edge of what could be a major change in marketing practices. "The on-line social revolution is extremely exciting, and it's a great feeling to be part of this global change with a solution like Tier-x. The circle is widening and that's easy to understand when considering the massive scale Tier-x can reach."

Original post at Israel21c


Tuesday, November 30, 2010

Where is Zed?

Yesterday, I said goodbye to a dear friend.

I will remember him for the joy, and for the good times.
love you, Shay!

Look over us.

Thursday, November 11, 2010

Rails Application variable II

Ah, it turns out that my heist and ignorance in Ruby and Rails I missed out on the Rails.cache options.
All you need is...

  def self.alive? (id)
    if!=nil and ( -<10
  def self.present(id)


Sunday, October 31, 2010

Rails Application variable

It almost seemed that there was no easy way out of putting application scope variables in the database.
But there is a way out:
    if Thread.main[:uuid] == nil
    uid = Thread.main[:uuid] += 1

This code accesses the mail thread of the rails process and puts a variable on it. (the thread is an object and can have key => value sets)
And since rails has only one main thread... its shared with all the threads underneath.

Good Luck

Friday, October 29, 2010

Multilingual Support for Flex

Some Cowboy coding techniques for supporting multilingual flex interfaces:
Instead of the usual form (from an Adobe development center post):
...text="{resourceManager.getString('resources', 'POSTDISPLAY_POST_TITLE')}"...
My label looks like:
Which is so much shorter and nicer to read when you are coding.

The gS is actually a static object (i.e. hash map) that I load with all the key:value pairs of the language.
Once you declare gS as [Bindable] you can replace the object at runtime with other languages, resulting with the replacement of all the strings in the application.

Note: the compiler issues a warning that since you are using square brackets, the GUI object will not be able to detect changes in the data source. Well, it does.

Independent on Sundays

Thursday, October 28, 2010

"localhost" Server isn't working? Blame Skype!

Skype is the DevilIt took me a while to reach this grim conclusion, The Skype client blocks quite allot of communication ports on the machine its running on. Apache Tomcat, WAMP and RoR are effected (as far as i can tell).

Kill the Skype process.

Good Luck.

Wednesday, October 27, 2010

Exporting from SQLServer to SQL insert script

The problem:
Export data from an MS SQL server to an SQL script of insert statements

It appears that there is no built in option for performing such a simple a task. After all, SQL is the common protocol for SQL based databases.

What i did manage to find is a script (stored procedure) for SQLServer 2000 and SQLServer 2005
The original post and instructions are available here.

Good luck

Sunday, October 24, 2010

AAdmin - Flex on Rails Agile Admin Application

The AAdmin is a little project I'm developing on the side, for Valueshine which in essence is a fast Administration Application based on a Ruby on Rails back-end and a Flex Web front-end.

I love fast development mainly because I'm a lazy son of a batch file and for some reason, I feel that Ruby and Rails was made just for people like me.

Having a server side application that 70% of its tasks sum up to persistence functionality just screamed scaffolding to me. the only obvious difference is that for the sake of using a flex client, i would have to skip over the default view machinery, that are generated by the rails scaffold.

Pre Programming:
I've created the alternative controller template so scaffolding command would generate an XML based web service.
to match that I've written an ActionScript client side that talks CRUD on the one side and hands out a set of a-sync methods on the other side.

The application, is based on the two elements described above, let me have a RoR restful web services that would accommodate a rich client.

The server:
I have employed a standard scaffold script generation with a tweak to the controller template. this change bypasses the standard view that is created by Rails to relay on pure XML rendering.
there is one extra controller that is utilized for configuration data purpose. I use it for authentication, and to extract the entities structure xml file.

The Client:
This part is where the quick admin app comes to play. the AAdmin client enables all CRUD functionality on a list of entities, predefined in an entity xml.
the client logs in, extracts the entity xml file, and presents the table structure and functionality according to the definitional in the file.

Screen shoots:
AAdmin Login Screen.

The CRUD Data View

The Create and Edit screen


Wednesday, October 20, 2010

Flex for Rails Scaffolding (cont) - the controller template

I've made a little improvement  to my development process, in such a way that the scaffolding i do for creating the web services I later use for my flex client are generated in their final form without the need to adjust them.
What i did was make some changes to the controller scaffold template.
The controller.rb template file is located at: [Ruby Home]\lib\ruby\gems\1.8\gems\rails-2.3.4\lib\rails_generator\generators\components\scaffold\templates

Backup the original (or pick it up from here).
Download the modified template

The Template should end up looking like:

class <%= controller_class_name %>Controller < ApplicationController
  # GET /<%= table_name %>
  # GET /<%= table_name %>.xml
  def index
    @<%= file_name %> = <%= class_name %>.all
   render :xml => @<%= file_name %>

  # GET /<%= table_name %>/1
  # GET /<%= table_name %>/1.xml
  def show
    @<%= file_name %> = <%= class_name %>.find(params[:id])
    render :xml => @<%= file_name %>

  # GET /<%= table_name %>/new
  # GET /<%= table_name %>/new.xml
  def new
   @<%= file_name %> = <%= class_name %>.new
   render :xml => @<%= file_name %>

  # GET /<%= table_name %>/1/edit
  def edit
    @<%= file_name %> = <%= class_name %>.find(params[:id])
   render :xml => @<%= file_name %>

  # POST /<%= table_name %>
  # POST /<%= table_name %>.xml
  def create
    @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
    if @<%= file_name %>.save
      render :xml => {:notice => '<%= class_name %> was successfully created.'}
      render :xml => {:notice => @<%= file_name %>.errors}

  # PUT /<%= table_name %>/1
  # PUT /<%= table_name %>/1.xml
  def update
    @<%= file_name %> = <%= class_name %>.find(params[:id])

    if <%= file_name %>.update_attributes(params[:<%= file_name %>])
      render :xml => {:notice => '<%= class_name %> was successfully updated.'}
      render :xml => {:notice => @<%= file_name %>.errors}

  # DELETE /<%= table_name %>/1
  # DELETE /<%= table_name %>/1.xml
  def destroy
    @<%= file_name %> = <%= class_name %>.find(params[:id])
    @<%= file_name %>.destroy

    render :xml => {:notice => '<%= class_name %> was successfully deleted.'}

Friday, September 24, 2010

Flex For Rails Scaffold

I’ve written a little component for connecting flex with rails scaffold as close as possible.

Step 1: Create a scaffold for Card

Within your rails application run the script:
./script/generate scaffold card id:integer timeStamp:timestamp data:text

(data types with Ruby and mySQL)

Step 2: Change the Card controller

Edit the Card Controller found at: myApp/app/controllers/cards_controller.rb and remove all view elements. this will make the controller omit pure XML structures

should result with the controller looking like:

class CardsController < ApplicationController
  # GET /cards
  # GET /cards.xml
  def index
    @cards = Card.all
    render :xml => @cards

  # GET /cards/1
  # GET /cards/1.xml
  def show
    @card = Card.find(params[:id])
    render :xml => @card

  # GET /cards/new
  # GET /cards/new.xml
  def new
    @card =
    render :xml => @card

  # GET /cards/1/edit
  def edit
    @card = Card.find(params[:id])
    render :xml => @card

  # POST /cards
  # POST /cards.xml
  def create
    @card =[:card])
      render :xml => {:notice => 'Card was successfully updated.'}
      render :xml => {:notice => @card.errors}


  # PUT /cards/1
  # PUT /cards/1.xml
  def update
    @card = Card.find(params[:id])

    if @card.update_attributes(params[:card])
      render :xml => {:notice => 'Card was successfully updated.'}
      render :xml => {:notice => @card.errors}


  # DELETE /cards/1
  # DELETE /cards/1.xml
  def destroy
    @card = Card.find(params[:id])
    render :xml => {:notice => 'Card was successfully updated.'}


Step 3: Client Side

To connect to the Rails server use an intermediate adapter called

For testing, use the ServiceTester.mxml

good luck

Monday, September 13, 2010

Passing a Byte Array through JSON

Its a well known issue when communicating complex structures between client and server, using the JSON encoding.
I've encountered it when attempting to transfer an encrypted Byte Array back and forth between a client and server, that communicate via JSON.

What doesn't work:
Base64 encodings and conversions to string formats

What does work:
Converting the Byte[] to a number array and back

Here is an example code in Flex (works just as well in Java / PHP / Python etc)

Independent on Sundays

Saturday, August 14, 2010

Flex List Item Renderer Repetition

The Flex implementation of lists, data grids, and advanced data grids generate a fixed amount of item renderer components that usually match the first visible set of elements in the list.
This implementation might cause that elements in the list seem to repeat them selves once you scroll down.

This is because although the items data is different, since its display object hasn't been properly refreshed, it shows the data it has from its previous appearance.
To solve this follow these guidelines:
1. do not set data inline i.e. mx:label text="{data.text}"
2. implement the renderers updateDisplayList method to set all the data in place

that's it,
good luck

Thursday, April 1, 2010

Flex Directory Compression

Here is an example for compression and decompression of files and directories using the DEFLATE compression algorithm. 

The structure I have created for the file structure in the compressed file is arbitrary.  for each file it describes the name and data witch is a byte array of the file content. Directories do not have a data attribute, but children that recursively describe files with in.  

Download the source code here

Download the example AIR application here

When running the example, drag and drop a file or directory into the upper box, this will catch the link and create a compressed version of the file in the application storage directory (i.e. /AppData/Roaming/Deflator/Local Store)

To extract the file back, click on the compressed file in the list and click the extract button. This will recreate the file or directory on your desktop.

Please note: that if the original file is still on the desktop when you extract, you will have an error. so if you deflated something from the desktop, make sure you rename it before you extract

Good luck.

Wednesday, March 24, 2010

First Steps for Apache Pivot, Java-based RIA Framework

Apache Pivot is an open source project, which attempts to create a modern, rich client development platform in Java. Pivot started off as an R&D effort at VMWare in 2007 and was released as an open-source project in June 2008 under the Apache 2.0 license. Pivot then joined the Apache Incubator in January 2009 and graduated as a top-level Apache project in December 2009. Pivot is currently driven entirely by the software development community.
Read more on InfoQ

Sunday, March 21, 2010

GigaSpaces XAP 7.1 EA: Elastic Middleware, Data Querying and Spring 3.x

GigaSpaces XAP is a distributed application server with an in-memory data grid. The XAP 7.1 release includes a number of themes: an Elastic Middleware Service, enhanced virtualization compatibility, data querying, an updated web-based management application, embedded Spring 3.0, and performance improvements. InfoQ explored this EA release to learn more.

Friday, March 5, 2010

Protect Your Passwords! A beta release

The past month I have spent time developing a little desktop application for safe guarding web account details. This application helps in maintaining a well organized database of secret account information and free text notes, in an ordered and easy to find manner.

What makes it so safe?

This application installs on your local desktop, so the information you type into it never leaves your computer. This application encrypts everything you put into it using a high, U.S. government approved standard called AES-128 (Advanced Encryption Standard). This application uses the password you provide as part of the encryption key ensuring no one else can breach the critical information you have, unless he has your password. It’s important to remember that nothing is 100% safe, but it helps not to be the easiest pray.

This beta release includes:
· An encrypted database, using AES-128
· Managing records for web accounts, mail accounts, software registration and general notes
· Managing categories for organizing the records (including custom categories)

The next release (not a beta) will include:
· File attachments (you will be able to drag in and out files and the system will encrypt/decrypt them accordingly)
· Backups (you would be able to have temporal backups and retrieve data in case the computer got corrupted, all backups are fully protected)
· Any cool feature I get from people using it (email me for special requests:

Installing the Protect Your Passwords! application
The installation process is very simple; and it works for all major Operating systems (i.e. windows, Mac and Linux) just follow the instructions on the badge:

To intsall this application please follow these two steps
1. Install Adobe Air
2. Download and run Protect Your Password

Or download directly and run installation manually.

 After installing you will find the following icon on your desktop:
Double click it, to run the application. After consenting on the disclaimer, you will be asked to enter your master password in a screen shown in figure 1

Figure 1: Master Password Creation.

The master password is the one password you will need to remember from now on, and better not forget. The master password is used as the key for the encryption of the file containing all the vital data. This means that the encryption is unique to you. The master password registration screen requires you to enter a password of a certain minimum length. While typing your master password the password strength indicator will let you know who safe your password is.

Using the application
Once the master password is entered, the next time you open this application you will be asked to enter your master password in order to unlock the application, see figure 2.

Figure 2: the login screen

Failing to provide the correct password for over 4 times locks the application, as displayed in figure 3. The reason for this is to make life harder for hackers using automation software to try and guess your password.

Figure 3: a locked application, no further attempts are allowed until the application is restarted

Important note: If you forget your master password, there is no way to retrieve the data, not even me, since I will have to have the correct password to decrypt the database.

After logging in, the application dashboard is opened up, where you have shortcuts to all the important features of the application, as displayed in figure 4. 

Figure 4: the application dashboard

From the dashboard you can:
· Search for a protected record, the search is either by a search phrase or by category
· Create a new record
· Create your own categories, delete existing categories (deleting a category doesn’t delete the records that were related to it)
· Change your master password

Not yet in this version: the settings screen for advanced configuration

Searching for Records:
To find a record you are looking for, you may either click on the category it belongs to, or click the search records button. This will move you to the search screen displayed in figure 7.
The new record button will move you to the details screen for entering a new record, displayed in figure 6

The new category button will open up a popup for entering a label for a new category as shown in the following figure 5

Figure 5: creating a custom category

Removing an existing category envolves right clicking on the category you would like to remove and selecting “delete”.
Clicking the change master password button on the dashboard directs you to the master password screen as displayed in figure 1. Failing to complete this form will leave you with the previous password.
Creating a new record is done by the new record screen depicted in figure 6

Figure 6: creating a new record

The record form is structured from two input arias, once for standard details, as displayed in figure 6, and the other is for free text notes, which is accessible by clicking on the “Notes” bar in the bottom of the details screen.

Note that when entering a new account, the details form allows you to create a random password to use on the web account. Since you don’t have to remember the special password, it’s easier to have web accounts that are even more secure. Choose the length of password you would like to have and click on the “Generate” button to render a unique password.
For convenience, you can put the web address (URL) of the site for the web account. This is saved for later quick access but is not mandatory.
The tags have no significant use for now, but in later releases, I intend to have advanced searched and categorization according to these tags, so it might be useful to start tagging your information.
Exiting the application or this screen without clicking on the save button; will result in loss of the changes.

The search screen, as shown in figure 7 allows you to look for a particular record of information either by selecting a category, or by a search phase, or a combination of both.

Figure 7: the search screen

Once you found the record you were looking for, there are several functionality shortcuts you can access on the record display:
· Navigate to the web account site by clicking the label. This feature is available only if you entered a valid URL in the link filed on the details form, as shown in figure 6. If you left the field empty, then clicking on the label will open the record for editing
· Copy USER NAME to clipboard, this is available to you only if you put the user in the user field in the details form
· Copy PASSWORD to clipboard, this is available to you only if you put the user in the password field in the details form.
· The little x button is for deleting the record
· The little pencil button is for opening the record for editing

Clicking on any of the category icons on the side will automatically change the search result to include the selected category.
That’s it for now, please remember that I welcome any suggestion warmly, feel free to send your suggestions to my mail at: or by posting it as a response on this blog.

Sunday, February 14, 2010

Flex Asynchronous Ciphering using as3crypto

Built myself a little password safe application based on Adobe AIR, and one of the features I wanted to put into it was to store encrypted files. I downloaded the as3crypto package from google code, and had my encryption/decryption functionality ready and working in an hour.

It was working smoothly right until I tries to use  it on a slightly larger file (a 6.7Mb image file) when the application froze and i got the “Not responding” message on the title of the application window. The application defrosted after a while and the file was processed properly, but it had the GUI locked for far too long.

No worries, I said to myself, all I need is some background process to do the dirty work while the GUI stays free for working with me.

Its a shame that Adobe Flex do not support multi threads.

Eventually I worked around this problem and wrote a component that interlaces calls to whatever function you give it, so the GUI wont freeze. (see my post on flex multi threading workaround).
Then I took to the task of making my ciphering class work a chunk at a time. After a superficial profiling session I came to the conclusion that the reading and writing of the files are by far cheaper operations then the ciphering, so the steps used in the solution are:

  • Initiate everything: read source file into memory
  • Interlace on encrypt and decrypt for a small chunk at a time
  • Finalize: write file 

Note: I made a lenient assumption that I wouldn't store a file I cant open all at once.

When I put everything together, it didn't work. I kept crashing on decryption and got an error saying: Error: PKCS#5:unpad: Invalid padding value. expected [252], found [152]
I had a vague  idea what this meant, but no idea what I was doing wrong. The answer came to me an hour after i posted a mayday question on stack overflow. so I posted the answer too:
the encryption and decryption actions change the actual chunk size. in the processChunck method, the ByteArray length before encryption was 16400 and after changed to 16416. using the decrypt changes the ByteArray length from 16416 back to 16400.
hence the solution i chose was to use two numeric values, one for each method used.
I have no idea why this happens, its not the padding (tested it with Crypto.getPad("none")).
So now I'm sharing it with the world (or rather with the 6 other people who viewed the question in stack overflow so far)

  • Download and add the as3crypto package from google code  into your project
  • Create an interlacing component that would call the async-crypto in pace with the GUI frame rate (or use what i wrote: here)
Download the source for the CryptoAsync and add it into your project.
Usage example:
var aCrypt:CryptoAsync = new CryptoAsync("C:/screen.jpg","C:/xxx.crp",key,CryptoAsync.ENCRYPT);
var aCrypt:CryptoAsync = new CryptoAsync("C:/xxx.crp","C:/result.jpg",key,CryptoAsync.DECRYPT);
  • key is a string of your liking
  • asyncTread is an instance of AsyncThreadComponent you can find here

good luck

Friday, February 12, 2010

Flex AS3 Multi Treading Workaround

Its well known that the current versions of Flex (using either the flash or AIR players) do not provide support for multithreading. Everything you do is loaded on the same main thread that is running the GUI too.
This restriction means that if you have to do a dutiful task, the GUI actually stops responding to the user and  your app may even get the “Not Responding” label in the title bar while its off processing.
The way to bypass this issue is to follow two guidelines
  • Break down the big process in to smaller, manageable runs. this means that if you have a loop that each iteration is taxing, you would want to call that loop one iteration at a time.
  • Call the single iteration in a way that interlaces with the GUI refresh rate.
Here is a simple GUI component that you may place on your application, to invoke calls on some other process without hampering the responsiveness of the GUI.
The method you call by this component has to be in the nature of:
public function runFunction(data:Object):Boolean

Download zip file for AsyncThreadComponent

Paste this on your app:
<view:AsyncThreadComponent id="asyncThread" />
When you want something to be invoked, create an object and pass the method:

Independent on Sundays