Thursday 8 December 2011

Execute thread from Java with timeout

In order to execute java thread with timeout, please use following snippet:

    private void executeThreadWithTimeout() {
     try {
      int timeout = 180;
      ExecutorService executor = Executors.newSingleThreadExecutor();
            executor.invokeAll(Arrays.asList(new Task()), timeout, TimeUnit.SECONDS);
            executor.shutdown();
     } catch (Exception e) {
     }
    }
    
    private class Task implements Callable {
        public Integer call() throws Exception {
            try {
             // Task go here
             Thread.sleep(60 * 60 * 1000);
            } catch (Exception e) {
            }
            return 0;
        }
    }
  

Wednesday 7 December 2011

Execute command line process from Java with timeout

In order to execute command line process from Java with timeout, please use following snippet:

 public static void executeCommand(String command, long timeoutInSeconds) throws Exception {
  ExecutorService service = Executors.newSingleThreadExecutor();
  Process process = Runtime.getRuntime().exec(command);
  try {
   Callable call = new CallableProcess(process);
   Future future = service.submit(call);
   int exitValue = future.get(timeoutInSeconds, TimeUnit.SECONDS);
   if (exitValue != 0) {
    throw new Exception("Process did not exit correctly");
   }
  } catch (ExecutionException e) {
   throw new Exception("Process failed to execute", e);
  } catch (TimeoutException e) {
   process.destroy();
   throw new Exception("Process timed out", e);
  } finally {
   service.shutdown();
  }
 }
 
 private static class CallableProcess implements Callable {
 
  private Process p;
 
  public CallableProcess(Process process) {
   p = process;
  }
 
  public Integer call() throws Exception {
   return p.waitFor();
  }
 }
  

Tuesday 8 November 2011

Salesforce DEV 401 Preparation - Day 8

1. App Setup -> Customize

1.5. Leads

1.5.1. Fields

1.5.2. Validation Rules

1.5.3. Triggers

1.5.4. Page Layouts

1.5.5. Field Sets

1.5.6. Search Layouts

1.5.7. Assignment Rules

1.5.8. Settings

1.5.9. Buttons and Links

1.5.10. Lead Processes

1.5.11. Record Types

1.5.12. Web-to-Lead

1.5.13. Auto-Response Rules

Monday 7 November 2011

Salesforce DEV 401 Preparation - Day 7

1. App Setup -> Customize

1.4. Campaigns

1.4.1. Fields
Can only change help text of standard campaign fields.

Can create custom campaign fields.
Marketing user license is required to create new campaign.
1.4.2. Validation Rules
Can add validation rules for campaign object.
1.4.3. Triggers
Can add trigger for campaign object.
1.4.4. Page Layouts

1.4.5. Field Sets

1.4.6. Search Layouts

1.4.7. Buttons and Links
Can override campaign standard buttons with visualforce pages.

Campaign custom buttons and links include 3 kinds:
+ Detail Page Link
+ Detail Page Button
+ List Button
1.4.8. Record Types

1.4.9. Campaign Influence

1.4.10. Campaign Members

1.4.10.1. Fields

1.4.10.2. Validation Rules

1.4.10.3. Triggers

1.4.10.4. Page Layouts

1.4.10.5. Field Sets

1.4.10.6. Buttons and Links

1.4.10.7. Record Types

Sunday 6 November 2011

Salesforce DEV 401 Preparation - Day 6

1. App Setup -> Customize

1.1. Tab Names and Labels

1.1.1. Rename Tabs and Labels
Can change singular label, plural label and 'starts with vowel sound' of standard objects.

Can change record name, singular label, plural label and 'starts with vowel sound' of custom objects. 
Record name changed by 'App Setup -> Customize' is different from one changed by 'App Setup -> Create -> Objects'. 
Record name changed by 'App Setup -> Customize' is used in list views, edit/view forms.
1.1.2. Help Settings
Can change URL of the context-specific Help links on any salesforce.com page. (One for all).
1.2. Home

1.2.1. Home Page Components
Standard components on home page is not editable except 'Messages & Alerts', 'Custom Links'. 
'Custom links' standard component contains up to 15 bookmarks.

There are 3 kinds of custom component which can be added to home page:
+ Links
+ Image/Logo
+ HTML Area

'Links' custom component contains custom links which is created by 'App Setup -> Customize -> Home -> Custom Links'.

'Image/Logo' custom component contains multiple images and text. Images are inserted from document folders.

'Links', 'Image/Logo' custom components are always in Narrow (Left) Column. 
'HTML Area' can be in Narrow (Left) Column or Wide (Right) Column. 
Can not change column kind of 'HTML Area' custom component.
1.2.2. Home Page Layouts
Can assign home page layout to profile. 'Home Page Default' layout is not editable.
1.2.3. Custom Links
Link behaviors include:
+ Display in new window
+ Display in existing window with sidebar
+ Display in existing window without sidebar
+ Display in existing window without sidebar or header
+ Execute JavaScript
1.3. Activities

1.3.1. Task Fields
Can only change help text of task fields. 
Task custom fields are created by using "Activity Custom Fields". 
Task custom field are same as event custom field.
1.3.2. Task Validation Rules
Can add validation rules for task object.
1.3.3. Task Triggers
Can add triggers for task object.
1.3.4. Task Buttons and Links
Can override task standard buttons with visualforce pages.

Task custom buttons and links include 3 kinds:
+ Detail Page Link
+ Detail Page Button
+ List Button
1.3.5. Task Page Layouts

1.3.6. Task Field Sets

1.3.7. Task Record Types

1.3.8. Event Fields

Similar to task fields

1.3.9. Event Validation Rules

Similar to task validation rules

1.3.10. Event Triggers

Similar to task triggers

1.3.11. Event Buttons and Links

Similar to task buttons and links

1.3.12. Event Page Layouts

Similar to task page layouts

1.3.13. Event Field Sets

Similar to task field sets

1.3.14. Event Record Types

Similar to task record types

1.3.15. Activity Custom Fields
Custom field is created for both task and event.
1.3.16. Activity Search Layouts

1.3.17. Activity Buttons
Can override standard button with visualforce page.
There is no activity custom button.
1.3.18. Public Calendars and Resources
Access levels of sharing include:
+ Hide Details - Users can only see availability.
+ Hide Details and Add Events - Users can see availability and add events.
+ Show Details - Users can view the details of events, but they cannot add events or edit existing events.
+ Show Details and Add Events - Users can view the details of events and add events, but they cannot edit existing events.
+ Full Access - Users can view the details of events, add events, and edit existing events.

In order to add event to resource calendar, create event on public calendar or user calendar, 
choose 'Add Invitees' in 'Invite Others' section, search within 'Resources' and insert selected resources.
1.3.19. Activity Settings
+ Enable Group Tasks:
+ Enable Sidebar Calendar Shortcut: show link to calendar on sidebar
+ Enable Creation of Recurring Events: show 'Recurrence' section when create new event
+ Enable Creation of Recurring Tasks: show 'Recurrence' section when create new task
+ Enable Activity Reminders: show 'Reminder' section when create new task or event.
+ Enable Email Tracking:
+ Show Event Details on Multi-User Calendar View:
+ Enable Multiday Events:
+ Show Requested Meetings in the Calendar Section on the Home Tab:
+ Show Custom Logo in Meeting Requests: 
1.3.20. Cloud Scheduler
Add or remove 'New Meeting Request' button to or from the Open Activities related list on contact, lead, and person account page layouts.

Tuesday 1 November 2011

Salesforce DEV 401 Preparation - Day 3

1. Income statement, Statement of cash flows
Create Income statement, Statement of cash flows

Monday 31 October 2011

Salesforce DEV 401 Preparation - Day 2

1. Balance sheet
Create balance sheet report.
Create Balance Sheet object:
+ Name: Text(80)
+ Period: Lookup(Period)
+ Credit: Roll-Up Summary(Sum Journal.Credit)
+ Debit: Roll-Up Summary(Sum Journal.Debit)
+ Amount: Formula(Credit - Debit)

Use Data Loader to insert data: http://www.megaupload.com/?d=J3V4HFCE

Update Journal object:
+ Balance_Sheet: Master-Detail(Balance Sheet)

Use Data Loader and Excel to collect and insert data: http://www.megaupload.com/?d=G54TNI1T

Salesforce DEV 401 Preparation - Schedule

1. 31/10/2011 - 04/11/2011: Build accounting application without coding

2. 07/11/2011: Review functions on [App Setup -> Customize], [App Setup -> Deploy], [App Setup -> Schema Builder], [App Setup -> Installed Packages], [App Setup -> AppExchange Marketplace], [App Setup -> Critical Updates]

3. 08/11/2011: Review functions on [App Setup -> Create], [App Setup -> Develop]

4. 09/11/2011: Review functions on [Personal Setup], [Administration Setup -> Manage Users]

5. 10/11/2011: Review remaining functions on [Administration Setup]

6. 11/11/2011: Build application without coding

7. 14/11/2011: Review functions on [App Setup -> Customize], [App Setup -> Deploy], [App Setup -> Schema Builder], [App Setup -> Installed Packages], [App Setup -> AppExchange Marketplace], [App Setup -> Critical Updates]

8. 15/11/2011: Review functions on [App Setup -> Create], [App Setup -> Develop]

9. 16/11/2011: Review functions on [Personal Setup], [Administration Setup -> Manage Users]

10. 17/11/2011: Review remaining functions on [Administration Setup]

11. 18/11/2011: Build application without coding

12. 21/11/2011: Review functions on [App Setup -> Customize], [App Setup -> Deploy], [App Setup -> Schema Builder], [App Setup -> Installed Packages], [App Setup -> AppExchange Marketplace], [App Setup -> Critical Updates]

13. 22/11/2011: Review functions on [App Setup -> Create], [App Setup -> Develop]

14. 23/11/2011: Review functions on [Personal Setup], [Administration Setup -> Manage Users]

15. 24/11/2011: Review remaining functions on [Administration Setup]

16. 25/11/2011: Build application without coding

17. 26/11/2011 - 30/11/2011: Review mock exams

2nd week: Review and take notes.
3rd week: Review and make questions
4th week: Review and build mock exams
  

Sunday 30 October 2011

Salesforce DEV 401 Preparation - Day 1

I start with building accounting application without coding.

1. Chart of Accounts
Create forms for adding/editing chart of accounts.

Create Account object with following fields:
+ Code: Text(20)
+ Name: Text(80)
+ Kind: Picklist(Assets, Liabilities, Owner's Equity, Operating Revenues, Operating Expenses, 
Non-operating Revenues and Gains, Non-operating Expenses and Losses)

Use data loader to insert data: http://www.megaupload.com/?d=MXVL8LB1

2. Transactions
Create forms which record transactions.

Create Period object:
+ Name: Text(80)
+ Start: Date
+ End: Date
+ Previous: Lookup(Period)

Create Journal object:
+ Name: Text(80)
+ Account: Lookup(Account)
+ Period: Lookup(Period)
+ Credit: Roll-Up Summary(Sum Transaction.Credit)
+ Debit: Roll-Up Summary(Sum Transaction.Debit)
+ Amount: Formula(Credit - Debit)

Create Transaction object:
+ Name: Text(80)
+ Date: Date
+ No.: Number
+ Journal: Master-Detail(Journal)
+ Credit: Currency
+ Debit: Currency
+ Amount: Currency

Create workflow rules that update fields: 
+ Journal.Name = Journal.Period.Name & Journal.Account.Name
+ Transaction.Credit = IF( ISPICKVAL( Journal__r.Account__r.Kind__c , "Operating Revenues" ) ||  ISPICKVAL( Journal__r.Account__r.Kind__c , "Non-operating Revenues and Gains" ), ABS( Amount__c ) , IF( ISPICKVAL( Journal__r.Account__r.Kind__c , "Assets" ) && Amount__c < 0, ABS( Amount__c ) ,  IF( (ISPICKVAL( Journal__r.Account__r.Kind__c , "Liabilities" ) || ISPICKVAL( Journal__r.Account__r.Kind__c , "Owner's Equity" ) ) && Amount__c > 0 , ABS( Amount__c ) , 0  )  ) )
+ Transaction.Debit = IF( ISPICKVAL( Journal__r.Account__r.Kind__c , "Operating Expenses" ) ||  ISPICKVAL( Journal__r.Account__r.Kind__c , "Non-operating Expenses and Losses" ), ABS( Amount__c ) , IF( ISPICKVAL( Journal__r.Account__r.Kind__c , "Assets" ) && Amount__c > 0, ABS( Amount__c ) ,  IF( (ISPICKVAL( Journal__r.Account__r.Kind__c , "Liabilities" ) || ISPICKVAL( Journal__r.Account__r.Kind__c , "Owner's Equity" ) ) && Amount__c < 0 , ABS( Amount__c ) , 0  )  ) )

I prepare for Salesforce DEV 401

After falling first Salesforce DEV 401 exam, I start looking around Internet to find tips for exam. I have found some useful.

1. Developer 401 Force.com Exam - Tips
The developer 401 Force.com Exam is geared toward people who do not know how to code as per say write a trigger or Visual Force Page. 
But does understand what the technical functions are in salesforce.com.
Things needs to be reviewed:
+ Security that is involved on the force.com platform <== Refers to Groups, Roles, Profiles
+ Master/Detail/Lookup relationships
+ Junction Objects
+ relationship between Developer/Full Copy/Config sandbox and Production
+ Matrix Reports (similar to a Pivot table in Excel)
+ DataLoader
+ Import Wizard
+ Know all the Components(See pic below)
Basically go through the setUp area and you should know and understand everything that is there for this exam. 
Remember this exam does not test your code knowledge it is an exam to make sure you undertstand the technical side of things.
Everytime when a developer gets a project, one must think of two things:
+ Can it be done without code <== this is understand the functions of the App.
+ If done in code then what would be affected, as in Relationships between objects, Reports, etc. 

Tuesday 25 October 2011

Demand for a product increases when the prices of its complements decrease

Demand for a product increases when the prices of its complements decrease.
This quote comes from Strategy Letter V (Joel on software). It's useful for selling products.
Every product in the marketplace has substitutes and complements. 
A substitute is another product you might buy if the first product is too expensive. 
Chicken is a substitute for beef. 
If you're a chicken farmer and the price of beef goes up, 
the people will want more chicken, and you will sell more.
When computers become cheaper, more people buy them, and they all need operating systems, 
so demand for operating systems goes up, which means the price of operating systems can go up.
Smart companies try to commoditize their products' complements.
When IBM designed the PC architecture, they used off-the-shelf parts instead of custom parts, 
and they carefully documented the interfaces between the parts in the (revolutionary) IBM-PC Technical Reference Manual. 
Why? So that other manufacturers could join the party. As long as you match the interface, you can be used in PCs. 
IBM's goal was to commoditize the add-in market, which is a complement of the PC market, and they did this quite successfully. 
Within a short time scrillions of companies sprung up offering memory cards, hard drives, graphics cards, printers, etc. 
Cheap add-ins meant more demand for PCs.
When IBM licensed the operating system PC-DOS from Microsoft, Microsoft was very careful not to sell an exclusive license. 
This made it possible for Microsoft to license the same thing to Compaq 
and the other hundreds of OEMs who had legally cloned the IBM PC using IBM's own documentation. 
Microsoft's goal was to commoditize the PC market. Very soon the PC itself was basically a commodity, with ever decreasing prices, 
consistently increasing power, and fierce margins that make it extremely hard to make a profit. The low prices, of course, increase demand.
 Increased demand for PCs meant increased demand for their complement, MS-DOS. 
All else being equal, the greater the demand for a product, the more money it makes for you. 
And that's why Bill Gates can buy Sweden and you can't.

Sunday 16 October 2011

Retrieve CPU brand by C and Win32 API


In order to retrieve CPU brand, information in red square on above photo, please use following code:

string GetCPUBrand() {
 char pszCPUBrand[49];
 memset(pszCPUBrand, ' ', 49);

 _asm {
  mov eax, 80000002h
  cpuid

  // getting information from EAX

  mov pszCPUBrand[0], al
  mov pszCPUBrand[1], ah
  ror eax, 16
  mov pszCPUBrand[2], al
  mov pszCPUBrand[3], ah

  // getting information from EBX

  mov pszCPUBrand[4], bl
  mov pszCPUBrand[5], bh
  ror ebx, 16
  mov pszCPUBrand[6], bl
  mov pszCPUBrand[7], bh

  // getting information from ECX

  mov pszCPUBrand[8], cl
  mov pszCPUBrand[9], ch
  ror ecx, 16
  mov pszCPUBrand[10], cl
  mov pszCPUBrand[11], ch

  // getting information from EDX

  mov pszCPUBrand[12], dl
  mov pszCPUBrand[13], dh
  ror edx, 16
  mov pszCPUBrand[14], dl
  mov pszCPUBrand[15], dh

  mov eax, 80000003h
  cpuid

  // getting information from EAX

  mov pszCPUBrand[16], al
  mov pszCPUBrand[17], ah
  ror eax, 16
  mov pszCPUBrand[18], al
  mov pszCPUBrand[19], ah

  // getting information from EBX

  mov pszCPUBrand[20], bl
  mov pszCPUBrand[21], bh
  ror ebx, 16
  mov pszCPUBrand[22], bl
  mov pszCPUBrand[23], bh

  // getting information from ECX

  mov pszCPUBrand[24], cl
  mov pszCPUBrand[25], ch
  ror ecx, 16
  mov pszCPUBrand[26], cl
  mov pszCPUBrand[27], ch

  // getting information from EDX

  mov pszCPUBrand[28], dl
  mov pszCPUBrand[29], dh
  ror edx, 16
  mov pszCPUBrand[30], dl
  mov pszCPUBrand[31], dh

  mov eax, 80000004h
  cpuid

  // getting information from EAX

  mov pszCPUBrand[32], al
  mov pszCPUBrand[33], ah
  ror eax, 16
  mov pszCPUBrand[34], al
  mov pszCPUBrand[35], ah

  // getting information from EBX

  mov pszCPUBrand[36], bl
  mov pszCPUBrand[37], bh
  ror ebx, 16
  mov pszCPUBrand[38], bl
  mov pszCPUBrand[39], bh

  // getting information from ECX

  mov pszCPUBrand[40], cl
  mov pszCPUBrand[41], ch
  ror ecx, 16
  mov pszCPUBrand[42], cl
  mov pszCPUBrand[43], ch

  // getting information from EDX

  mov pszCPUBrand[44], dl
  mov pszCPUBrand[45], dh
  ror edx, 16
  mov pszCPUBrand[46], dl
  mov pszCPUBrand[47], dh

 }

 pszCPUBrand[48] = '\0';

 return string(pszCPUBrand);
}

Saturday 15 October 2011

Call JSONP with jQuery

In order to call JSONP with jQuery, please use following code

function jsonp() {

  this.request = function(url, args, callbackVar, bufferID) {
    var super = this;
    var callback = 'jsonp_response_' + Math.floor(Math.random() * 100000);
    window[callback] = function(data) {
      super.response(args, data);
      delete window[callback];
    }
    var params = { callbackVar : callback };
    var buffer = $('#' + bufferID);
    buffer.append("<script src='" + url + '&' + jQuery.param(params) + "'></script>");
  }

  this.response = function(args, data) {
  }

}

callbackVar: name of GET variable containing JSONP callback, eg. api.php?jsonp=response
bufferID: id of empty div tag which is used for temporarily adding script tag
args: arguments is passed to callback function

Friday 14 October 2011

Upload file to SharePoint site

In order to upload file to SharePoint site, please use following code:

private String uploadFile(String site, String username, String password, String library, String filename) {
     String tag = "";
     try {
      CopySoapStub stub = SharePointWSDL.newCopy(new URL(site + "/_vti_bin/Copy.asmx"), new CopyLocator());
      stub.setUsername(username);
      stub.setPassword(password);

      String name = (new File(filename)).getName();
      String tagPath = site + "/" + library + "/" + name; 
      FieldInformation[] fis = new FieldInformation[1];
      UnsignedIntHolder uih = new UnsignedIntHolder(new UnsignedInt());
      CopyResultCollectionHolder crch = new CopyResultCollectionHolder(new CopyResult[] { new CopyResult() });

      fis[0] = new FieldInformation();
      fis[0].setInternalName("Title");
      fis[0].setDisplayName(name);
      fis[0].setType(FieldType.Text);
      fis[0].setValue(name);
       
      stub.copyIntoItems(tagPath, new String[] { tagPath }, fis, readFile(filename), uih, crch);
      boolean success = true;
      for (int i = 0; i < crch.value.length; i++) {
       if (CopyErrorCode._Success.equals(crch.value[i].getErrorCode().getValue())) continue;
       logger.error(crch.value[i].getErrorCode().getValue() + " : " + crch.value[i].getErrorMessage());
       logger.info(crch.value[i].getDestinationUrl());
       success = false;
      }
      if (success) {
          tag = tagPath;
      }
     } catch (Exception e) {
      logger.error("", e);
     }
     return tag;
    }
    
    private byte[] readFile(String filename) {
     File file = new File(filename);
     byte[] tag = new byte[0];
     try {
         tag = new byte[(int)file.length()];
         InputStream is = new FileInputStream(file);     
         int offset = 0;
            int numRead = 0;
            while (offset < tag.length && (numRead = is.read(tag, offset, tag.length - offset)) >= 0) {
                offset += numRead;
            }     
     } catch (Exception e) {
      logger.error("", e);
     }
     return tag;
    }

Above code use Java WSDL for SharePoint

You should use domain name in site URL instead of IP.

Using IP will cause error. Please checkout Get 'Object reference not set to an instance of an object' error when upload file to SharePoint

Thursday 13 October 2011

Accessing SharePoint web service requires Basic Authentication

In order to access SharePoint web service through java WSDL, you need to enable Basic Authentication for IIS. 

Please checkout Get '(401)Unauthorized' error when calling SharePoint web service and wsdl2java with Basic Authentication (Axis 1.6.1)

Retrieve list of libraries on SharePoint site

In order to retrieve list of libraries on SharePoint site, please use following code:

private List getLibraries(String site, String username, String password) {
     List tag = new ArrayList();
     try {
      ListsSoapStub stub = SharePointWSDL.newLists(new URL(site + "/_vti_bin/Lists.asmx"), new ListsLocator());
      stub.setUsername(username);
      stub.setPassword(password);
      com.microsoft.schemas.sharepoint.soap.GetListCollectionResponseGetListCollectionResult lcr = stub.getListCollection();
      if (lcr.get_any().length > 0) {
          NodeList children = lcr.get_any()[0].getChildNodes();
          for (int i = 0; i < children.getLength(); i++) {
           Node node = children.item(i);
           String baseType = node.getAttributes().getNamedItem("BaseType").getNodeValue();
           if (!"1".equals(baseType)) continue;
           String template = node.getAttributes().getNamedItem("ServerTemplate").getNodeValue();
           String title = node.getAttributes().getNamedItem("Title").getNodeValue();
           if ("|101|115|109|".indexOf("|" + template + "|") < 0) continue;
           tag.add(title);
          }
      }
     } catch (Exception e) {
      logger.error("", e);
     }
     return tag;
    }
Above code use Java WSDL for SharePoint

Tuesday 11 October 2011

Install java plugin on Ubuntu 10.04.3 LTS

1. Open FireFox or Chromium
2. Go go http://java.com
3. Click on "Free Java Download"

4. Scroll to Linux section
5. Click on "Verify Now" link


6. When you are asked to install missing plugin, choose to install "Icedtea Java Plugin"
7. Close browser and open it again, java is enabled for your browser now.

Wednesday 21 September 2011

Create Lotus Notes form dynamically

In order to create Lotus Notes form dynamically, you can use following code:

  DxlImporter dxl = session.createDxlImporter();
  dxl.setReplaceDbProperties(true); 
  dxl.setDesignImportOption(DxlImporter.DXLIMPORTOPTION_CREATE); 
  dxl.setInputValidationOption(DxlImporter.DXLVALIDATIONOPTION_VALIDATE_ALWAYS);
  try {
    String xml = "Output of DxlExporter which is modified by removing \r\n";
    lotus.domino.Stream stream = s.createStream();
    stream.writeText(xml);
    dxl.importDxl(stream, database);
  } catch (Exception e) {
    logger.error("", e);
  }
  logger.info(dxl.getLog()); // Use this line to view error log from DxlImporter

Thursday 15 September 2011

Clone reputation system of StackExchange.

Recently, I found StackExchange, a system of 63 Q&A sites. I really impress at their reputation system. I would like to have similar one on my website. However, I'm not sure it is allowed by copyright law or not. Maybe I will learn their Theory of Moderation and define new one avoiding using their terms.

+ Reputation --> Trust
+ Peputation privileges --> Trust rank
+ rep unit --> point
+ vote up --> mark up
+ vote down --> mark down
+ upvoted --> up-marked
+ downvoted --> down-marked
+ tag --> interests
+ tag wiki --> interests brochure
+ wiki --> brochure
+ user --> member (customer, provider, idol, consultant)

List of member type:

1. Customer

Customer is member having vocation to ask question.

2. Provider

Provider is member having vocation to answer question.

3. Idol (*)

Idol is popular trusted customer.

4. Consultant

Consultant is popular trusted provider.

** Members must choose their vocation to ask or answer. They will be customer or provider based on their choice. Popular providers will become consultant. Popular customer will become idol. Members can change their vocation but their trust score will be decreased amount of points (*). Trust score after changing must be greater an amount of points (*). Score gained by marking vary in vocation of marked member. For example, question is marked up by customer/idol will gain less score than is marked up by provider/consultant; answer is marked up by provider/consultant will gain less score than is marked up by customer/idol.

Forte (new concept)

Forte is collection of interests that member believe to gain much score from.

List of trust ranks:

1. trusted user (20000) (*)

Trusted users are allowed to perform trusted actions, including:
+ Marking to delete answers with score of -1 or lower
+ Marking to delete questions immediately after they are closed (even if they are new)
+ Editing all interests brochures on the site

More info is here: View ads to get help! (Draft Specification 1)

Sunday 14 August 2011

Open Lotus Notes database by replica id

In order to open a Lotus Notes database which is on same server of specified Lotus Notes database, you can use following snippet.

public Database openDatabaseById(Database srcDb, String replicaId) throws Exception {
    String server = srcDb.getServer();
    DbDirectory dir = srcDb.getParent().getDbDirectory(server);
    Database tagDb = dir.openDatabaseByReplicaID(replicaId);
    return tagDb;
}

Wednesday 10 August 2011

Convert date/time from specified time zone to local time

In order to convert date/time from specified time zone to local time, you can use following snippet.

	private Date toLocalTime(Date src, TimeZone zone) {
		Calendar srcCal = new GregorianCalendar();
		srcCal.setTime(src);
		Calendar gmtCal = new GregorianCalendar(zone);
		gmtCal.set(Calendar.YEAR, srcCal.get(Calendar.YEAR));
		gmtCal.set(Calendar.MONTH, srcCal.get(Calendar.MONTH));
		gmtCal.set(Calendar.DATE, srcCal.get(Calendar.DATE));
		gmtCal.set(Calendar.HOUR_OF_DAY, srcCal.get(Calendar.HOUR_OF_DAY));
		gmtCal.set(Calendar.MINUTE, srcCal.get(Calendar.MINUTE));
		gmtCal.set(Calendar.SECOND, srcCal.get(Calendar.SECOND));
		gmtCal.set(Calendar.MILLISECOND, srcCal.get(Calendar.MILLISECOND));
		Calendar tagCal = new GregorianCalendar();
		tagCal.setTime(gmtCal.getTime());
		return tagCal.getTime();
	}

Friday 5 August 2011

Tran Dinh Thoai, with Gump's approach





Jon Foreman – I Am Still Running

You remember me
before I learned to run
At the kissing tree
before I learned my guns
We were 17
17 years young
I am still running
I am still running

I had no idea the pain would be this strong
I had no idea the fight would last this long
In my darkest fears the rights become the wrongs
I am still running, I am still running I am still running I am still running

Build me a home
inside your scars
Build me a home
Inside your song
Build me a home
inside your open arms
The only place I ever will belong

I am still running
I am still running
I am still running
I am still running
Build me a home
inside your scars
Build me a home
Inside your song
Build me a home
inside your open arms
The only place I ever will belong
The only place I ever will belong
inside your open arms
The only place I ever will belong


Forrest Gump: Stupid is as stupid does.



Mrs. Gump: You have to do the best with what God gave you.



Forrest Gump: My momma always said, "Life was like a box of chocolates. You never know what you're gonna get."



Forrest Gump: My Mama always said you've got to put the past behind you before you can move on.



Forrest Gump: Mama always had a way of explaining things so I could understand them.



Lieutenant Daniel Taylor: Have you found Jesus yet, Gump?
Forrest Gump: I didn't know I was supposed to be looking for him, sir.



Forrest Gump: Now you wouldn't believe me if I told you, but I could run like the wind blows. From that day on, if I was ever going somewhere, I was running!



Forrest Gump: When I got tired, I slept. When I got hungry, I ate. When I had to go, you know, I went.
Elderly Southern Woman on Park Bench: And so, you just ran?
Forrest Gump: Yeah.



[Forrest has finished assembling his rifle]
Forrest Gump: DONE, DRILL SERGEANT!
Drill Sergeant: GUUUUUUMP! Why did you put that weapon together so quickly, Gump?
Forrest Gump: [confused] You told me to, Drill Sergeant?
Drill Sergeant: Jesus H. Christ!
[looks at stopwatch]
Drill Sergeant: This is a new company record! If it wouldn't be such a waste of a damn-fine enlisted man I'd recommend you for OCS! You are gonna be a general someday, Gump, now disassemble your weapon and continue!



Drill Sergeant: Gump! What's your sole purpose in this army?
Forrest Gump: To do whatever you tell me, drill sergeant!
Drill Sergeant: God damn it, Gump! You're a god damn genius! This is the most outstanding answer I have ever heard. You must have a goddamn I.Q. of 160. You are goddamn gifted, Private Gump. Listen up, people...
Forrest Gump: [narrates] Now for some reason I fit in the army like one of them round pegs. It's not really hard. You just make your bed real neat and remember to stand up straight and always answer every question with "Yes, drill sergeant."
Drill Sergeant: ...Is that clear?
Forrest Gump: Yes, drill sergeant!



Forrest Gump: That day, for no particular reason, I decided to go for a little run. So I ran to the end of the road. And when I got there, I thought maybe I'd run to the end of town. And when I got there, I thought maybe I'd just run across Greenbow County. And I figured, since I run this far, maybe I'd just run across the great state of Alabama. And that's what I did. I ran clear across Alabama. For no particular reason I just kept on going. I ran clear to the ocean. And when I got there, I figured, since I'd gone this far, I might as well turn around, just keep on going. When I got to another ocean, I figured, since I'd gone this far, I might as well just turn back, keep right on going.



Mrs. Gump: Remember what I told you, Forrest. You're no different than anybody else is. Did you hear what I said, Forrest? You're the same as everybody else. You are no different.
Principal: Your boy's... different, Miz Gump. His IQ's 75.



Forrest Gump: I'm not a smart man... but I know what love is.



Forrest Gump: Mama always said, dying was a part of life.



Forrest Gump: You died on a Saturday morning. And I had you placed here under our tree. And I had that house of your father's bulldozed to the ground. Momma always said dyin' was a part of life. I sure wish it wasn't. Little Forrest, he's doing just fine. About to start school again soon. I make his breakfast, lunch, and dinner every day. I make sure he combs his hair and brushes his teeth every day. Teaching him how to play ping-pong. He's really good. We fish a lot. And every night, we read a book. He's so smart, Jenny. You'd be so proud of him. I am. He, uh, wrote a letter, and he says I can't read it. I'm not supposed to, so I'll just leave it here for you. Jenny, I don't know if Momma was right or if, if it's Lieutenant Dan. I don't know if we each have a destiny, or if we're all just floating around accidental-like on a breeze, but I, I think maybe it's both. Maybe both is happening at the same time. I miss you, Jenny. If there's anything you need, I won't be far away.



Forrest Gump: [running] I had run for 3 years, 2 months, 14 days, and 16 hours.
[he stops and turns around]
Young Man Running: Quiet, quiet! He's gonna say something!
Forrest Gump: [pause] I'm pretty tired... I think I'll go home now.



[when the bullies from school were chasing him]
Jenny Curran: Run, Forrest! Run!



Jenny Curran: [hearing that Forrest is going to Vietnam] Listen, you promise me something, OK? Just if you're ever in trouble, don't be brave. You just run, OK? Just run away.



Forrest Gump: Those must be comfortable shoes, I bet you could walk all day in shoes like those and not feel a thing.
Nurse at Park Bench: My feet hurt.
Forrest Gump: My momma always said you can tell a lot about a person by their shoes, where the go, where they've been. I've worn lots of shoes, I bet if I think about it real hard I can remember my first pair of shoes.

Tran Dinh Thoai, social networking contacts

You can meet Tran Dinh Thoai on following networks:

Buy Website

Follow Tran Dinh Thoai on Twitter

Tran Dinh Thoai, in Osaka, Japan














Tran Dinh Thoai, on past events

Tran Dinh Thoai, on Veterinarian Job Posting/Matching Website project


This is the first project that he has won and completed (in technology term). Bad business skill has led him to failure with poor rating on RAC site and bad financial status (only receive 44% of money but working time is 4 times longer).



We need an ASP.NET C# website (VS.NET 2008 Professional) created that will allow veterinarian clinics to list available jobs and match possible candidates that have registered in the system.

Please review the attached requirements document for more detail.

Here is a summary of the major requirements of the project but you must follow the Ignyte Standards document completely or the final project will not be accepted.

1) Must be written in C#, ASP.NET, and VS.NET 2008 Professional Edition.
2) Must store this information in a SQL Server 2005 Professional database.
3) Application must provide a commercial quality AJAX interface.
4) Application needs to provide logging and tracing functionality in order to assist in troubleshooting.
5) Must follow Ignyte's coding standards which will be provided.
6) Must utilize Ignyte's Data Layer Generator, which will generate the basic data tier along with basic Insert/Update/Delete/select classes and stored procedures, which will save some development time.
7) Must follow our design methodology which requires screen prototypes to built and approved before moving to the business layer modeling and then data layer modeling, which also must be approved before moving on to the coding.
8) Must utilize the CSLA.NET framework for the business objects (Business Layer Tier).

DO NOT BID ON THIS IF YOU ARE FROM INDIA OR PAKISTAN. WE HAVE NEVER HAD A SUCCESSFUL PROJECT COMPLETED FROM ANY CODERS FROM THESE COUNTRIES AND WE WILL NOT DO BUSINESS WITH THEM AGAIN.

Thanks
Ignyte Software Inc.