Archive | 5. Fun RSS feed for this section

Steve, how could you stop Flash on your gadgets?

To many of Flash/Flex programmers, it could be a bad news that Steve Job openly banned Flash on his devices like iPad. His message clearly stated that HTML5 can be used to replace the rich experience of Flash and it will be our future. He may be right about the cons of Flash. Nothing is perfect. However, I am surprised that he took a step further to ban Flash totally. Why couldn't he simply provide an option for users to turn it off if they want? I really doubt about his intent. Whenever I see something like that, it only reminds me what Microsoft did in the old days.

In fact, from his TOS, it stated clearly that the most important reason for Apple to ban Flash is because Apple doesn't want a third party layer of software come between the platform and the developer.

Allowing Flash — which is a development platform of its own — would just be too dangerous for Apple, a company that enjoys exerting total dominance over its hardware and the software that runs on it. Flash has evolved from being a mere animation player into a multimedia platform capable of running applications of its own. That means Flash would open a new door for application developers to get their software onto the iPhone: Just code them in Flash and put them on a web page. In so doing, Flash would divert business from the App Store, as well as enable publishers to distribute music, videos and movies that could compete with the iTunes Store – Brian on wired.com

 
Putting aside Apple's intent, as a consumer, I don't think I want to carry a bigger iPhone (ie. iPad) that doesn't provide me the full web experience. I don't care what HTML5 will turn out, I need to read Flash now because it could take years if not decades for Flash be totally eliminated on Web (I doubt this will happen!). If you really like iPad but still want to see the Flash on it, here is the good news for you. You now can install Frash to get around it.  Below is a video that shows you how to install it and get it work on your iPad.
 

Leave a comment Continue Reading →

Learning Perl – Day 1 (Data Type)

Recently, I need to pick up Perl for some of my projects. After going through some websites and books, I start seeing why some of the tasks could be done much easier in Perl than in Java, the language that I am quite familiar with. Since Perl is loose in data type, not OO-enforced, non-explicit signature plus its syntax is full of symbols, some Perl programmers given the freedom and power without following the best practices could write very illegible code. Although it runs, it could be very hard to maintain. For those who feel the pains, you may like this post . However, I don't want to go extreme on this. I do see its power in text processing and system integration. After taking a look at the extensive CPAN library, I decide to give it a fair trial. Not only that, I will write a series of posts to help you to shorten your learning curve as well. This post I will put my head on Perl data type and its usages.

Data Type

Number and String

# numeric
$var = 123;
$var = 123.34;  #float or double

# very large long unsigned integer like md5 value.
$bignum = Math::BigInt->new("Ox1821231223238234234");

# string - single quote: no interpretation; double quote: interpreted at runtime
$myVar = 'abc';
$myVar = "product price is $price";

Array

@myarray = (1,2,4, 'abc', "abc", $myvar);
print $myarray[0]; #1 is shown

@coins = ("Quarter","Dime","Nickel"); # quotation could be hassle!
@coins = qw(Quarter Dime Nickel);     # remove the quotation headache easily

# To get numeric length of an array, you can use the scalar() function or 
# we can redefine the array as a scalar variable.
$coinlength = @coins;
print scalar(@coins);
print $coinlength;

# array in perl can dynamic growth in size
push(@coins, "Penny");     #add element to the end of the array
unshift(@coins, "Dollar"); #add element to the front of the array
pop(@coins);               #remove last element of the array
shift(@coins);             #remove first element of the array
delete $coins[1];          #delete element with index 1 in the array

@names = split(',',$namelist); #convert csv line in string to array
$namelist = join(",",@names);  #reconstruct via joining them back

@Foods = qw(Pizza Steak chicken burgers);
@foods = sort(@Foods);         #sort the array according to ASCII Numeric

# transform to lowercase as Capital case can mess up the order
foreach $food (@Foods) {
  push(@foods,  "\L$food");
}

# sort it
@foods = sort(@foods);

my $count = 0;
for (@list) {
   $count++ if $_ eq "apple"; # $_ is assigned the current element of the loop
}

# slice the array
my @stuff = qw/everybody wants a rock/;
my @rock  = @stuff[1 .. $#stuff];      # @rock is qw/wants a rock/
my @want  = @stuff[ 0 .. 1];           # @want is qw/everybody wants/

Hash

Hash is also called associative array that is composed of a list of key-value pair entries and the keys here are unique. It is like Map in Java.

%myhash = ('key1' => 'abc', 'key2' => 5, 'key3' => $myvar);

# even number array can convert into hash
# element[i] => element[i+1] where i is 0,2,4..etc
%coins = ( "Quarter", 25, "Dime", 10, "Nickel", 5 );   

$myKey = "Dime";
$coins{$myKey} = 15;  # assign using variable
print $coins{"Dime"}; # output is 15;
print $coins{Dime};   # you can simplify it without quote there

foreach $key (sort keys %coins) {
     print "$key: $coins{$key} \n";
}

$coins{HalfDollar} = .50;   #add new element
delete($coins{HalfDollar}); #delete an element

if ( exists $hash{key} ){
   #retrieve value here
}

# slice a hash
my %table = qw/schmoe joe smith john simpson bart/;
my @friends = @table{'schmoe', 'smith'};   # @friends has qw/joe john/

Subroutine

Parameters passes to subroutine will be stored in @_.  You can create a reference of a subroutine and pass it to a method as function pointer.

sub my_sub{
  my($msg) = @_;
  print "this is my own message: $msg";
}
&my_sub(); #call with option & in front
my_sub('hello world'); #call without & in front and parameter can be dynamic here.

Reference and Dereference

So far so good? Now I am going to show you how to pass by reference rather than pass by value. The reason you want to pass by reference because it is more memory efficient. However, to do that, I have to take you to a trip of syntax mess. It is what gave me a hard time before and I hope I can make it clear so you will not be suffered the pain I had. OK. Lets start! Reference is a scalar that refers to the data stored in another variable of any type, as well as subroutine and methods. It gives you the ability to pass by reference a large variable to a function instead of pass by value.

Reference

$varRef = \$myvar; #varRef now stores the physical address of $myvar
$arrayRef = \@myarray; 
$subRef = \&my_sub;
$arrayRef = [1, 2, 3]; #arrayRef is pointing to the address of an anonymous array

%hash = ('key1'=> 'var1', 'key2' => 'var2'); #regular hash
$rhash = \%hash;  #create reference to the hash
$href = {'key1'=> 'var1', 'key2' => 'var2'}; #reference to anonymous hash

Dereference

To access the content of a reference, there are special ways to do that:

my $name = "Test Users";
my $rname = \$name; 

sub my_func{
  my ($ref) = @_;
  print "Scalar ref value is $$ref";  #dereference 
}

my_func($rname); 
my_func(\$name);

# array can be deference in 2 ways
$arrayRef->[1];
$$arrayRef[1];
@array = @$arrayRef; #the whole array available again for regular usage

print $hash{key1};        # Ordinary hash lookup
print $$rhash{key1};      # hash replaced by $rhash
print $rhash->{key1};     # hash replaced by $rhash

# we are getting ourselves confused via using the syntax of dereference, 
# we could get back the actual value via:
@{array_reference}
%{hash_reference}
${scalar_reference}

print Dumper %$rhash;     # dump the whole hash (valid syntax without the bracket) 
for(keys %{$rhash})       # for more clarity, enclose it in curly brackets.
{
...
}

# map of anonymous subroutines
my %hash = (add => sub {my var1 = @_; print "Add $var1\n"}, 
            substract => sub {my var1 = @_; print "Subtract $var1 \n"} );
# get a function pointer and invoke it using -> if you need to pass parameter(s).
$hash{$add}->(5); 

Confused! Give me a chart!!

I hope that you are still ok. Sometimes you see @varArray in code, it could mean the array itself or the size of it. It depends on the context. If @varArray is under scalar context, it means the length of the array. Otherwise, it means the array itself. To avoid confusion, you can always use scalar(@varArray) to get the size of the array. However, someone may use $#varArray+1 to represent the length of it. In fact, $#varArray means the last index of the array. Since array index is starting from 0, so you add 1 to get the actual size of the array. Below is a chart that I see it quite helpful when I get lost in the Perl syntax.

============================================================================================================
Expression    Context    Variable           Evaluates to
============================================================================================================
$scalar    scalar    $scalar, a scalar   the value held in $scalar
@array            list            @array, an array   the list of values (in order) held in @array
@array            scalar    @array, an array   the total number of elements in @array (same as $#array + 1)
$array[$x]    scalar    @array, an array   the ($x+1)th element of @array
$#array    scalar     @array, an array   the subscript of the last element in @array (same as @array -1)
@array[$x, $y]    list            @array, an array   a slice, listing two elements from @array (same as ($array[$x], $array[$y]))
"$scalar"    scalar          $scalar, a scalar   a string containing the contents of $scalar
"@array"    scalar          @array, an array   a string containing the elements of @array, separated by spaces
%hash            list            %hash, a hash           a list of alternating keys and values from %hash
$hash{$x}    scalar    %hash, a hash           the element from %hash with the key of $x
@hash{$x, $y}    list            %hash, a hash           a slice, listing two elements from %hash (same as ($hash{$x}, $hash{$y})

Real Life Usage

Now you have gone through basically the most common use of Perl syntax. If you are still reading this, congratulation! You can now move a step further to see how it applies to some real life examples. I am going to show how people use Hash because I see it more fun.

#--------- counting ---------
How you generate a histogram of term from a text file?
(1) Convert the text to a list of string term (you could eliminate the punctuation, normalize case, get rid of the stop words as you wish)
(2) Walk through the list and build a map of term with count as value. How? In Java, I will loop thru the list check if the term is there 
    in the map. If not, put it there with count=1. If yes, pull the current count of the term and increment it. In Perl, the syntax is much easier:

my %histogram;
$histogram{$_}++ for @list;  # for loop on the list and each element by default is assigned to $_'
$unique = keys %histogram;   # obtain the number of unique terms
@unique = keys %histogram;   # obtain the list of the keys
@popular = (sort { $histogram{$b} <=> $histogram{$a} } @unique)[0..4];  # obtain top 5 based on the count

#--------- searching ---------
my $index;  
for $index (0..@chambers) {               # linear search
   last if $chambers[$index] == $bullet;  #exist at this condition
}
print "Found at index $index" if $index < @chambers;

NOTICE: we see lot of actions in perl can be controlled by condition followed. If condition returns false, the whole statement will not be executed.

#---------- dispatch table -----------

# Suppose you have a script that does several related things: it manages your to-do list by adding, editing, listing, and deleting to-do items:

>> todo add "Email Samuel about photos"
Output: Todo item 129 created
>> todo done 129
Output: Item 129 marked as done

# You might expect the script to look like:

    my $command = shift @ARGV;
    if    ($command eq "add")  { add(@ARGV)  }
    elsif ($command eq "list") { list(@ARGV) }
    elsif ($command eq "done") { done(@ARGV) }
    elsif ($command eq "edit") { edit(@ARGV) }
    ...
    else { die "Unknown command: $command" }

# That is quite tedious. You could use hash to deal with this since we don't have 'switch' in perl:

    %commands = (
        add  => \&add,
        list => \&list,
        edit => \&edit,
        done => \&done,
    );
    my $action = shift @ARGV;
    if (!exists $commands{$action}) { die "Unknown command: $command" }
    $commands{$action}->(@ARGV);  #dereference the subroutine and use -> for argument passing

Conclusion

Thanks for reading up such a long post. Buy yourself a coffee because you are now equipped an essential skill to write Perl. You may wonder why I haven't shown you how get your environment setup and write the first Hello World program in Perl. I don't do this because there are tons of articles showing you how to do this. Apart from that, I also skip some basic things like conditional control, packaging, library usage, exception handling and etc. I don't cover this because I see the syntax of them quite easy to grasp. Next article, I am planning to cover the power of text processing with some deep dive in regular expression. Stay tune! There will be more symbols to get familiar with. By the way, if you see some weird syntax related to data structure, put a comment on my blog so we can learn from each other.

Leave a comment Continue Reading →

Create a Virtual Company

Nowadays there are many tools available on the Net ranging from IM to cloud computing that certainly lowers the barrier for entrepreneurs like us. Today, I am going to list out the tools that helps me to run my company:

Set up virtual office

  1. Skype – Save you from long distance bill
    • FREE. If you pay a rate, it will let you connect to phone line.
    • When I am tired of typing, it will switch to this.
    • If you like face to face conversion, I would use iChat on Mac. All you need is an AOL account.
  2. Yugma – Web conferencing
    • FREE up to 20 attendees.
    • It has Skype integration.
  3. Free conferencing
    • FREE
    • In case you don’t have internet access or your laptop is not next to you. This is a good tool because it gives you a dedicated line to dail in. However, the number is not TOLL-FREE.
    • Why 712 area code? Check this out
  4. Google tools – all FREE
    • Google doc (shareable)
    • Google calendar (it can sync with my iCal on Mac now. If you use Outlook, you need to install a plugin to do the calendar sync). Follow this guide to set it up.
    • Google email (have gmail to host your mail server – yourname@yourcompany.com)
  5. MediaWiki – good wiki tool for information sharing
  6. Posterous – create your company blog via email :)
  7. iPhone
    • Not FREE
    • I use it for sync email, calendar and access Web.
  8. VNC – Remote desktop tool
    • FREE
    • For Mac, download OSXVine Server from here.
    • If you are using DSL that assigns you IP address dynamically, it is quite a headache to keep track of it. You can obtain a domain name from DynDNS to abstract you from the IP address.
    • By default, VNC server will be listened on port 5900. If you want to do remote desktop outside your subnet, make sure your DSL router open a port for that and forward the request to your machine.
    • Here is a web-based VNC viewer. With that, you can do remote desktop anywhere. Just key in your dynDNS domain and you are done.
    • If you want to make this access security, you can password protected your box via configure the VNS Server.
    • Here is a great article for that.
    • There are people who uses LogMeIn service that provides more remote secure featuers. However, it is NOT FREE. To me, VNC Server is good enough solution.

Build your virtual dev team

  1. Tracs – combine wiki, ticket system, project planning in one
    • FREE
    • A bit complicated to set it up in web hosting company
    • It integrates with Subversion as well
    • Bugzilla is pretty good for issue tracking as well
  2. Dreamhost for web hosting
    • Below $10 per month
    • I currently use it for hosting my own blog and subversion repository.
    • No java support yet.
    • For VPS solution, this one is cheap and my buddy said it is great.
  3. VirtualBox – have several operating system runs on your laptop. Very appealing!
    • FREE
    • I set up Ubundu on my Mac. Full screen, share folders, share mouse. I love it.
    • With this, I can ensure all developers are working on the same environment. Furthermore, I can have dev, qa and production using the same environment.
  4. Omnigraffle – design graphical tool on Mac
    • NOT FREE but cheap
    • Free stencils available on here.
  5.  Amazon AWS
    • Way low cost comparing to hire your own team to make sure your system 24×7
    • Cloud computing allows you scale on demand.
    • Processing power via EC2
    • Storage via S3
    • CDN via CloudFront
    • Messaging via Amazon SQS

 

Leave a comment Continue Reading →

Wiring up Flex, Mate, BlazeDS, Spring, Hibernate and MySQL with Maven 2 – Part 1

Introduction

This article is written on top of the great work that Sébastien Arbogast has done. He has written 3 articles that showed you how to wire up Flex, BlazeDS, Spring, Hibernate and MySQL with Maven as build process. I have included his articles below as your reference.

  1. The Flex, Spring, and BlazeDS full stack – Part 1: Creating a Flex module
  2. The Flex, Spring and BlazeDS full stack – Part 2: Writing the to-do list server
  3. The Flex, Spring and BlazeDS full stack – Part 3: Putting the application together

I have found Sebastien’s work as a good foundation for my own project. To contribute back to the community, I will write a series of articles to show you how can customize and extend the todolist sample.

What is in the Part 1 of the series…

  1. Enhancements on the Maven build process
    • Leverage RSL to factor our the framework swc, so the size of the application swf will be reduced. Apart from that, I also take advantage of Flash Player Cache that is available after version 9 update 3 to cache the framework libraries.
    • Clean up the Flex and BlazeDS dependencies in POM as the latest version of the sdk is available and the BlazeDS dependencies are officially available.
    • Include some common reports for maven site generation
    • Embed Jetty web server in the build process for quick deployment and testing
  2. Document how to get the sample up on Eclipse for development
  3. Use Mate as Flex framework
    • Restructure ToDoList sample to leverage Mate framework
    • Factor out Mate as RSL and integrate it with Maven build process via Flex-mojo plugin.

What are in the coming articles…

  1. In part 2 of this series, I will show you how to use flex-mojo to build a modular Flex application.
  2. In part 3 of this series, I will show you how to test your flex app via FlexUnit (Unit test) and FlexMonkey (Functional test)
  3. In part 4 or this series, I will work on server side. I am planning to add monitoring, caching and security to the server side.

Review “ToDoList” sample

Before I start my journey, let me highlight what Sebastien has done first:

  1. Sebastien’s sample demonstrates how to use Maven as a build process. There are 3 parts or subprojects in his sample. They are:
    • todolist-config (configuration files shared by other subprojects)
    • todolist-ria (Flex frontend)
    • todolist-web (Server side that supports the Frontend)
  2. All these subprojects are considered as modules of the main project (root POM). Finally, they are combined together into war artifact and ready to deploy to Tomcat or other J2EE webapp server.
  3. Flex frontend and backend communicate through a binary RPC protocol – AMF. AMF is considered to be the simplest and fastest remoting approach available in Flex. Recently, Adobe has released BlazeDS as an open source implementation of AMF spec. In this sample, BlazeDS is used. To use BlazeDS, there are few things you need to do:
    • Externalize your POJO service via BlazeDS. This sample shows you how to integrate BlazeDS with Spring
    • Make BlazeDS endpoints availabe to the Net via Servlet.
    • Have frontend and backend shared the same BlazeDS configuration files.
  4. In this sample, you can also find out how to use flex-mojo maven plugin to compile the Flex frontend code into swf. Apart from flex-mojo plugin, there are other two good plugins worth to mention:
    • maven-assembly-plugin - can be used to bundle all the files under a directory into a zip file. It is used by todolist-config to bundle all the configuration files (service-config.xml and remoting-config.xml) into a zip during the package phase.
    • maven-dependency-plugincan be used to unpack the zip file and move to the place you want. It is used by todolist-web to unpack the config zip during the generate-resources phase.

Enhancements on maven POM

I have modified the sample’s maven pom as follows:

  • Link to new repository “Sonatype Forge” in the root POM. So, I can use the new version of flex-mojo and simplify the todolist-ria adobe framework dependencies. Apart from that, I also take away the private repository from Sebastein because BlazeDS libraries are available in official maven repository (Note: The BlazeDS libraries available in official maven repo are in version 3.0 instead of 3.0.0.544. So, you need to modify the webapp pom correspondingly).

    <repositories>
        <repository>
            <id>flex-mojos-repository</id>
            <url>http://svn.sonatype.org/flexmojos/repository/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>flex-mojos-repository</id>
            <url>http://svn.sonatype.org/flexmojos/repository/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

  • Because I link to Sonatype repository, I can have my todolist-ria depends on one flex-framework pom dependency instead of all the swc dependencies. Note that the pom dependency is a way to factor out all the adobe swc dependencies that makes your pom easier to maintain.

        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>flex-framework</artifactId>
            <version>3.1.0.2710</version>
            <type>pom</type>
        </dependency>

  • I include mysql driver as dependency in my webapp pom. I think it is cleaner to bundle it in war. I have also added jetty plugin in the POM so you have a web server embedded in the build process. With this, you can run this sample application right after you check it out from svn (assume you have maven 2 installed). To start jetty, you can issue the following maven command under your webapp project.

project_root> mvn clean install
project_root/jp-web> mvn jetty:run-war

  • I have included some reports that will be shown after site generation. You may not be able to do mvn site-deploy because it is linked to my web hosting site. However, you can modify it for your own sake.

Get the sample up on Eclipse

To develop on Eclipse, you can follow the steps below:

  1. Create Eclipse project file via running the command below at the project root. This will create 2 eclipse projects. One for todolist-ria and one for the webapp. You noticed that I use the -Declipse.downloadSource=true to include the source files of my dependencies in my eclipse project. Therefore, I can get to the source code if needed.

mvn -Declipse.downloadSource=true eclipse:eclipse

  1. Import the projects into Eclipse
  2. Add new variable M2_REPO and set it equals to [home]/.m2/repository
  3. If you have installed Flex Builder plugin to your Eclipse, you can Add Flex Project Nature to the todolist-ria project.
    • Select Application Server Type: J2EE
    • Put check on “Use remote object access service” with LiveCycle Data Service selected.
    • Set up the path. I have my tomcat installed under C:\tools with default 8080 as port. You should make the changes if you installed it differently.
    • Remove the generated main.mxml under the src folder.
    • Set index.mxml under src folder as default Flex application file to run.
    • Use Default Flex SDK in Flex Compiler Configuration instead of Server Flex SDK
    • Right click and select Recreate HTML Template if you see error.
    • After all these, you have configured your Flex application pointing to the webapp server and sharing the BlazeDS configuration files. You can verify in Flex Compiler Configuration’s Additional Compiler Parameters. See whether you see this: -services “C:\tools\tomcat-6.0.16\webapps\jp\WEB-INF\flex\services-config.xml” -locale en_US
    • Move the war to your tomcat’s webapp folder and start it under remote debugging setting. If you are using window, set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8787,suspend=n under your bin/catalina.bat.
    • Start your webapp via bin/startup.bat
    • Put breakpoint under TodoServiceImpl save method and start remote debugger on localhost:8787
    • Right click the index.mxml and Run As Flex Application.
    • Add a new entry and save it on the flex app. :razz: You should see your remote debugger halt at the breakpoint for you to debug.
    • Now you can change your flex code and test it out without leaving your Eclipse. However, if you modify the service in webapp, you need to run “mvn clean install” and deploy the war to the tomcat before your flex code can call your server-side code via AMF.

Use Mate as Framework

If you are not familiar with Mate, click the image below that moves you to a nice presentation.

 

What did I do to restructure the todolist sample to make it Mate app?

  1.  

Download

I have made my work available at: www.solutionhacker.com/wp-content/uploads/todolist-jp-modified.zip

Reference

Below are the references I used for the article:

  1. Flex mojo compiler user guide
  2. Flex mojo dependency scope rules
  3. Flex 3 feature introduction: Flex 3 RSL
  4. Improving Flex application performance using Flash Player Cache
  5. FNA archetype projects 

 

Leave a comment Continue Reading →

Salesforce.com opens up Google Data API

Salesforce + Google

After getting a taste of its power, lets set it up and try it ourselves.

 

Leave a comment Continue Reading →

Hacking Salesforce – Part 2 (Release Management)

Salesforce Release Management

Salesforce always advocates us to make all the changes through its UI. It is nice but hardly a solution for a corporation. In a corporation, we used to develop everything in dev, launch to QA and test it, then launch to production. Salesforce claims its approach can shorten the release cycle. However, I don’t think we want to do thing in this way. For example, if we have hundred of fields to add and the application cannot be used until all of them are in place, what will you do to minimize the impact of users currently using your app? How can we rollback all the changes? How to test the changes before releasing them? Yes, you may get around this via switching layout or making new objects and fields available only for admin user. However, what if we don’t even want our developers accessing production box because the data there is sensitive.

All in all, we want a solution that we are able to develop on our sandbox, test it and push a button to release all the changes to production. To my dismay, I don’t see Salesforce provides us end to end solution in this aspect. To work around, I tell my team to do all the changes in the sandbox (Salesforce provides one if you are in enterprise edition but it only has metadata in it) and manually move the changes to production after test. It is a tedious process and error-prone. Finally, I decide to search around and luckily I found a way to achieve my goal.

Use Force IDE

Force IDE is released that works on the new Metadata API released on Summer 08. It is an awesome tool. Through this, I am able to back up my production metadata in xml format and put them in version control system (ie SVN). With the help of SVN, I am able to tell who has changed what, do a diff on different versions and rollback. It is a great tool for us. But when I look into this tool, I have faced some of the issues. Below are some of my findings:

  1. I cannot remove or rename existing fields.
  2. There is no standard objects.
  3. There is no approval processes
  4. If you custom objects have circular dependency, you cannot simply copy 2 .object files into the object folder and assume Force IDE will resolve it for you.
  5. I cannot move apex classes to production box.
  6. I lose the association between S-Control and button.

However, I am able to get around these via:

  1. Rename and delete fields using SF UI.
  2. Modify the package.xml to enable standard object synchronization. (detail)
  3. Use SF UI to add approval process
  4. Manually create the custom object via SF UI first. Then you can copy all the fields to it via Force IDE.
  5. Apex class cannot push to production unless you test it and deploy it via the migration tool.
  6. Manually associate the S-Control with button via SF UI.

However, although we cannot make release management simply pushing a button, we can live with that as Force IDE already does a lot for us.

Backup Strategy

Now we know how we deal with metadata and simplify the release management via Force IDE. How about backup the data? Salesforce provides us DataLoader tool that we can use to export Salesforce data in CSV file format. Apart from that, you can import the CSV file back to Salesforce. 

 

Leave a comment Continue Reading →

Hacking Salesforce – Part 1 (Resource)

Introduction of Salesforce

My company uses Salesforce as its online CRM solution. And I happen to be in charge of this team. So, I get a chance to mess around with it. The more I look into it, the more I like the idea and infrastructure behind it. I am not going to dig deep into the beauty of its architecture in this post. Instead, I would post some useful resources to get you to start playing with it. To begin with, I would open a developer account in force.com. The developer account gives you all the enterprise edition feature with no time limit. The caveats are that  you can only have 1 admin and 1user account, and your account is limited to several MB storage space only. However, it is good enough to get a good taste of Salesforce. After you sign up, you can go to its invaluable Wiki and Discussion Boards to obtain tips and starter tutorials. Salesforce also made 2 ebooks available. They are:

  1. Introduction to the Force.com Platform – for beginner
  2. Force.com Cookbook – for intermediate user

Now I assume you can do the followings:

  1. Create custom objects and fields via SF UI
  2. Build object relationships
  3. Create validation rule and approval process
  4. Customize the layout for object (very limited without Visualforce)
  5. Create S-Control
  6. Mess around with Salesforce Security Model.

Great! You are now empowered by Salesforce to build a solution for your company. However, you may encounter issues related to its UI limitation like you cannot hide a field when someone selects a particular field on a picklist (resolved by Visualforce) or you cannot populate another object when one object is saved (resolved by Apex Trigger). You may find a way to get around this problem but I bet it is not going to be pretty. If you are interested to unveil the true power of Salesforce, keep reading.

Become a expert user

If you are interested in solving the UI and functionality limitation above, please take a look at the following ebooks:

  1. Apex Developer’s Guide
  2. Visualforce Developer’s Guide

Become a developer

OK. You are like me, the tools above may not satisfy you completely. To fully control its UI, I would use Flex. To fully manipulate the data model, I would like to use its API. If you are interested in building the next killapp on top of Salesforce platform. Here are some of the APIs that you may be interested:

  1. Apex Web Services API – Covers the SOAP API in all its glory. I personally wish this was REST, but SOAP is better than everything but REST.
  2. Apex Metadata API – A newer API, the Metadata API allows us to define the structure (fields and relationships) of our custom objects via XML rather than via the declarative point-and-click interface. Unfortunately there’s no Metadata API available for standard objects (Contacts, Accounts, Opportunities) yet, but I expect that to change this year.
  3. Apex AJAX Toolkit API – The AJAX Toolkit is primarily used with S-Controls, which are being phased out in favor of Visualforce. To be honest, the AJAX Toolkit has always seemed like a workaround hack to me, and hopefully the combination of Visualforce and Apex Code will render it obsolete.

I will keep this post updated for the new features Salesfoce releases in the future. :mrgreen:

  

Leave a comment Continue Reading →