Powerful Full Text Search Engine – Part 1 Lucene Introduction

Introduction of Lucene

I have heard of Lucene and its powerful full text search capability many times. Today, I decide to take a look at it. Before I dive into the user guide, I went to Google Tech Talk to find a video related to Lucene first. Here is what I found: 

After I finished this video, I found Lucene a really great tool for me. So, I decided to have a deeper look at it. After a quick search,  I found a great blog that showed me how to use Lucene with Digg. With Solr on top of Lucene, you can make Lucene available as RESTful Web Service. It is so awesome, isn’t it? In this article, I will list you all the information I found during my little research on Lucene and I hope you will feel it useful.

» Read more…

Grid Computing – Part 1 Introduction

Introduction from Cameron Purdy

 

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.

» Read more…

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

» Read more…

Business Intelligence – Part 1 Pentaho

Getting into Business Intelligent World

When I dig deeper in business intelligence, I found out that it is a huge topic ranging from reporting to data mining. Like all the knowledge acquisition plan, I put a series of milestones for myself. If you are interested, here is my list:

Get and prepare your data

  • Data collection – log processing, web services (SOAP and REST), RSS, screen scraping and more.
  • Data preparation and crunching – ETL (Kettle)
  • Data storage – data warehousing

Visualize your data

  • Reporting and Charting (Pentaho as server and Flex as frontend)

Analysis your data

  • Data modeling
  • Data analysis (OLAP)

Get smart of your data

  • Collective intelligence
  • Data mining

» Read more…

SQL Tips for MySQL

Control Flow in SQL

SELECT name AS Name, category AS Category,
IF(winter>500, "Sells", "Slow")
AS Trend FROM sales;

http://www.roseindia.net/mysql/mysql5/flow-control-constructs.shtml

Rename tables

RENAME TABLE table1 TO table2;

Add a user

connect mysql
INSERT INTO user VALUES(‘%’,'monty’,PASSWORD(‘some_pass’);
FLUSH PRIVILEGES;

Monitoring

The number of mysql processes running at any given time should be monitored. I do this manually from time to time, using SHOW PROCESSLIST in mysql. I had a problem in the past with processes never expiring and the number of connections maxed out. Set timeout to resolve this. Put report id and user id in the comment before running the sql. So, you can trace back what the report the sql for and who issued it when you need to kill it or analyze how to fix it.

Create a table from other table

CREATE TABLE emps2 as select * from emps;

One downside to this approach on both MySQL and Oracle is that it doesn’t make an exact replica of the table, for example any index against the table will not be receated for the new table.

CREATE TABLE emp5 like emp;

The downside of this method is that the data isn’t copied across in the way it is using an SQL statement in the create. But it’s easy to do that using a command like follows.

INSERT INTO emps5 select * from emps;

Flex Remoting and Session Management

Power of BlazeDS

Recently, I found out that Adobe has released BlazeDS (subset of LiveCycleDS) that has 4 main advantages:

  1. AS3 to Java object communication (no XML passes back and forth is needed!)
  2. Boost up performance b/c AMF is a binary protocol
  3. Built-in proxy support that gets around the cross domain security issue from Flex in ease.
  4. Allow push messaging

I have followed the guideline and set it up. Now my Flex application can call my Java object method without passing xml back and forth. It is awesome! During the setup process, you may experience your flex cannot find the destination set up in the server.

The error “[MessagingError message=’Destination ‘SomeBean’ either does not exist or the destination has no channels defined (and the application does not define any default channels.)’]”.

The trick here is to add a services argument to the mxmlc call, something of the form below should do the trick! 

-services “[local path to your java project]/WEB-INF/flex/services-config.xml”

Now you may start enjoying how AS3 talks to your Java Object. However, if  we bypass the Servlet layer in the code, how can we carry session across remote method calls? Great that I have found out how to handle it via this article. In short, you can access Session from your Java object via:

FlexContext.getFlexSession()

Here is the quote I got from the BlazeDS developer guide.

The FlexContext class is useful for getting access to the session and the HTTP pieces of the session, such as the HTTP servlet request and response. This lets you access HTTP data when you use a Flex application in the context of a larger web application where other classes, such as JSPs or Struts actions, might have stored information.

The FlexSession class provides access to an ID and also provides setAttribute and getAttribute functionality. This is useful for storing data on the server that doesn’t have to go back to the client. However, FlexSession is not cluster-aware; if a client connects to a different server in the cluster, the client receives a new FlexSession. Nothing stored in the FlexSession attributes is persisted for clustering purposes. The FlexSessionListener class is useful for monitoring who is connected. You add a listener by using the static method to track new connections being made. You receive a reference to the session that was added. Each session can then report when it is destroyed to those same listeners. You use this for monitoring connections that close, and also to clean up resources.

When I looked into the source of FlexContext, I noticed that it leverages ThreadLocal to store context info like request, response and session.

    private static ThreadLocal sessions = new ThreadLocal();
    /**
     * The FlexSession for the current request.  Available for users.
     */
    public static FlexSession getFlexSession()
    {
        return (FlexSession)sessions.get();
    }

Reference

Below are some of the useful references I have read so far:

  1. Jim Boone’s Blog

 

Power up Salesforce UI via Flex

Get started

Follow the steps below to get your first Flex salesforce app up in Salesforce.

  1. Register a developer edition account from Salesforce. Note: Dev account never expires but the account does come with a few limitations. You can only have two users, one an admin account so that you can build and install applications and the other a normal user account so you can test your work from the perspective of a normal user. The account has a 2MB data limit and you can send mass email. However, It is totally fine for playing around all the features that Salesforce provides.
  2. Download the Flex Salesforce Toolkit (ie. force.com-air_flex-1.0.zip). This toolkit provides the needed libraries to communicate directly with your salesforce.com database records from within a Flex application, using native ActionScript packages and returning strongly typed classes.The documentation on the classes can be found here.
  3. In this zip file, there is a library called as3Salesforce.swc in the bin directory just off the root of this zip file. It is the library you need to associate to your Flex project.
  4. Create a Flex project and include the swc library in it.
  5. You can follow this screencast to get your first project up.

What you can do after that?

Now you have your Flex application run locally in Salesforce. Here is my TODO list and the solutions of each one.

  1. Run your app under your own website and pull info from Salesforce using the same api.
  2. Run your app under Salesforce and have it pulled data from your system thru Flex Remoting (HTTPService, WebService, RemoteObject…etc).
  3. Can we use the API to pull Salesforce metadata like SControl?
  4. How can we provide our application via Apex Exchange?
  5. How can we use the Salesforce Flex AIR Toolkit to make have your application deal with Salesforce in offline mode? Look into this article.

What Flex gives you but not original Salesforce UI?

Now you know how to integrate Flex with Salesforce. But what problems that Flex helps us solving but not the original Salesforce UI?

  1. Capture user events on the fly and display additional fields or populate bunch of fields.
  2. Visual the data via Flex charting.
  3. Full control on the layout, and look and feel.

  

Tomcat Performance Tuning

Most companies I have worked for use Tomcat as Servlet Container. It is de facto standard just like how Apache been used as Web Server. However, most of us just drag our war file to the webapp folder and use Tomcat with all the settings as default out of the box. It works fine in development environment but may not in production. This article will give you advice in several areas:

  1. Production Tomcat Architecture
  2. Tuning tomcat for performance
  3. Resolving problems which affect availability

» Read more…

Part 1 – Spring Security Architectural Review

My Web application needs both authentication and role-based authorization features. And our user profile is currently stored in an OpenLDAP server. I am looking for a security framework that can help me to integrate LDAP and provide these security features with the least amount of effort. On top of that, I want to achieve this without polluting my business logic with security code (ie. via AOP). At my first glance, Spring security (aka. acegi security) looks promising to me. After evaluating it a bit more, I believe it does provide what I need for my project. So, I started creating a prototype and gave it a trial. In this article, I will go over the steps I took to build my prototype and I will provide you the necessary explanation to move forward alongside. Hopefully, you will get over the initial learning curve as quick as possible with this guide. » Read more…

Page 5 of 12« First...3456710...Last »