Thursday, September 13, 2012

Windows XP Rename Tool

In the stone ages, on Windows XP, if you try to rename something like BerlinXYZ.rdl to SydXYZ.rdl, using command prompt:
rename Berlin* Syd*

it will not work since it will rename the files to SydlinXYZ.rdl

Where it has some junk characters after the Syd prefix.

A very nice free renaming tool without install is called:
Lupas Rename 2000

*Comand prompt's rename will work properly if you're on Windows 7.

Tuesday, March 27, 2012

Salesforce Data Tools

Here's a list of tools when working with Salesforce data, ie importing/exporting data
http://ezrakenigsberg.com/

Here's a few tools for dealing with 15 to 18 digits salesforce IDs
https://docs.google.com/spreadsheet/ccc?pli=1&key=0Ar3Bg2QuV-_IdEtzSXBrWTZiNUZxRlRoV0tYM3RoZ2c&hl=en#gid=0

Choosing the Appropriate Raid Level for Your Need

Here's an article that will help you choose a Raid level that's suitable for your needs.
http://www.techrepublic.com/blog/datacenter/choose-a-raid-level-that-works-for-you/3237

For large SATA drives, consider Raid 6 or 10 to avoid losing a lot of data.  However, Raid 5 has better performance.

Another solution is Raid 5 with synchronise mirroring

Things to consider includes:
Costs/Capacity Available
Read/Write Performance
Redundancy/Availability



Choose a RAID level that works for you

Takeaway: When choosing a RAID level for a new array, there are a number of important points that you need to take into consideration. Scott Lowe outlines these points.
In four recent TechRepublic blogs, we extolled the good and the bad about various RAID levels. From me, you learned about why I really like RAID 50 in a number of circumstances, why RAID 60 may or may not be overkill, and why RAID 10 might be a better choice than RAID 6 even though it’s more expensive. My fellow TechRepublic contributor Rick Vanover shared some pointers on when to choose RAID 5 and when to choose RAID 6.

RAID level considerations

When choosing a RAID level for a new array, there are a number of important points that you need to take into consideration, including:
  • Application performance needs. Not every application is created equal. Some applications are light on I/O needs, while others thrash the storage system all day long. Make sure you choose a RAID level that matches the workload.
  • Capacity needs. Different RAID levels all result in different amounts of net usable space remaining after accounting for RAID overhead. If capacity is your primary driver, that will affect your choice of RAID.
  • Cost. Performance costs money, and capacity costs money — achieving the necessary balance between cost and performance is your job. Choosing the right RAID level can play a big part in achieving this balance.
  • Availability needs. Every business is different. Perhaps your business is willing to pay a little more to ensure less downtime than another business. In these cases, you need to pick a RAID level that matches the system’s availability needs demanded by your organization.

The balance

Let’s look at each of these considerations and consider how various RAID levels meet the objectives for each point raised. We’re going to stick with relatively common RAID levels.
You’ll notice that I placed an asterisk next to two entries in each category below; the asterisks denote the “winners” in each category. You’ll also notice that RAID 0 “wins” a lot; however, I would never recommend RAID 0 for production use.
Application performance
  • * RAID 0. From a performance perspective, RAID 0 beats the rest since there is no RAID overhead, and the disk system is able to aggregate all of the disks into a single, high performance storage pool.
  • * RAID 1/10. In most cases, RAID 10 provides excellent performance since data can be read from multiple disks at the same time, suffering a little only when the workload calls for a whole lot of small sequential writes. For general raw performance for pretty much any kind of workload, RAID 1 and 10 are excellent choices. RAID 1 by itself is a two disk system that doesn’t get a huge performance boost, but it wouldn’t likely be used in a large array, anyway.
  • RAID 5/50. For heavy read workloads, RAID 5/50 provide very good performance. However, on heavy write workloads, RAID 5/50’s need to write parity information begins to noticeably affect overall storage performance. In a rebuild situation, RAID 5/50 can suffer a heavy performance hit until the rebuild operation completes.
  • RAID 6/60. Like other RAID levels, read performance under RAID 6 is very good, but write performance takes an even bigger hit than it does with RAID 5 due to dual parity write needs. Rebuild operations can have a major performance impact.
Capacity
  • * RAID 0. Since no parity information is stored and there is no mirroring, RAID 0 provides excellent capacity. You get full use of all of the disks in the array — 100% utilization.
  • RAID 1/10. With RAID 1/10, you take a full 50% capacity hit due to the need to retain a mirrored copy of the data. RAID 1/10 carry the largest capacity penalty, but this is often offset by its very good read/write performance.
  • * RAID 5/50. One reason RAID 5 remains so popular is because of its capacity overhead, which results in the loss of only one disk worth of capacity. Under RAID 5/50, you will lose up to 33% of total raw capacity (three disk RAID 5 configuration), depending on how you create your volumes.
  • RAID 6/60. RAID 6 is growing in popularity, but it carries greater capacity overhead than RAID 5. With RAID 6, two disks worth of space is required for parity, so you take a capacity hit of up to 50% (four disk RAID 6 configuration).
Cost
  • * RAID 0. From a capacity and a performance standpoint, RAID 0 carries by far the lowest price tag. With no RAID overhead and maximized performance, the $/TB or $/IOPS metrics are fantastic under RAID 0.
  • RAID 1/10. From a capacity perspective, RAID 1/10 carries a hefty cost, but from a performance perspective, it’s only a little worse than RAID 0. Although you lose 50% of your usable space under RAID 1/10, you retain high performance levels, making this RAID level very popular for a variety of uses.
  • * RAID 5/50. RAID 5/50 has become an almost de facto standard when one needs to add RAID and doesn’t really care about the characteristics. All RAID controllers support RAID 5, and the RAID 5 capacity overhead isn’t too bad, especially as more disks are added to the array. From a performance perspective, you do lose a lot of IOPS on write workloads, making RAID 5 a bit more expensive than RAID 0, 1, and 10 when it comes to supporting write workloads.
  • RAID 6/60. Expensive in every way, RAID 6 can result in capacity overhead matching RAID 1/10 (50%), and it also carries a hefty write penalty — it’s even worse than RAID 6.
Availability
  • RAID 0. On the availability front, RAID “zero” lives up to its name. It shouldn’t even be called RAID; it’s really just a bunch of disks (JBOD). If any disk in the array fails, you can kiss your data goodbye. Although RAID 0 provides great performance and maximum capacity, it includes zero data protection capability.
  • * RAID 1/10. RAID 1/10 - mirroring - is a highly available configuration. All data are written to two disks in the array, so you can lose multiple disks — as long as you lose the “right” ones — and remain functional on a single copy of the data.
  • RAID 5/50. RAID 5 provides reasonable availability and is often enough for many organizations. With RAID 5, your array can lose a single disk and remain functional, although in a degraded state. If you lose a second disk, your data is gone. RAID 50 provides a little more protection. Each individual RAID 5 subarray in the RAID 50 can lose a single disk and remain functional. In theory, you could lose a single disk in each and every subarray and remain functional.
  • * RAID 6/60. RAID 6/60 provide very high levels of availability since you can lose two disks in each RAID 6 array and remain functional.

My take

If you really don’t know what RAID level to choose, go with RAID 50 if capacity is more important than performance (unless you’re talking mostly sequential reads, in which case RAID 50 is awesome) or RAID 10 if both random and sequential read/write performance trumps capacity. If data protection is your primary concern, RAID 6/60 should be at the top of your list.

Sunday, March 11, 2012

Getting Salesforce Data from External App

Salesforce encourages developers to authenticate using OAuth.

However, if you are creating a windows service to get data from SF, you'll need to choose the username/password flow.
https://ap1.salesforce.com/help/doc/en/remoteaccess_oauth_username_password_flow.htm

The Steps include:
1) Add new application via Setup -> Develop -> Remote Access
Under this method, the callback URL will not be used.

2) Perform a POST request
To get the authentication token:


https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82Hn
FVVX19KY1uA5mu0QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret=1955279925675241571&username=username@salesforceInstance.com&password=SFpassword

3) Parse return JSON and get access_token

{"id":"https://login.salesforce.com/id/00Dx0000000BV7z/005x00000012Q9P",
"issued_at":"1278448832702","instance_url":"https://na1.salesforce.com",
"signature":"0CmxinZir53Yex7nE0TD+zMpvIWYGb/bdJh6XfOH6EQ=","access_token":
"00Dx0000000BV7z!AR8AQAxo9UfVkh8AlV0Gomt9Czx9LjHnSSpwBMmbRcgKFmxOtvxjTrKW1
9ye6PE3Ds1eQz3z8jr3W7_VbWmEu4Q8TVGSTHxs"}

4) Perform a GET request

https://ap1.salesforce.com/services/data/v20.0/sobjects/Account/0019000000B8JxR?fields=AccountNumber,BillingPostalCode

User-Agent: Fiddler
Authorization: OAuth  access_token
Host: ap1.salesforce.com

Monday, February 27, 2012

Salesforce Converting 15digits ID to 18 digits ID via Formula

Sometimes you'll need to convert the 15 digits ID to 18 digits for external programs to compare IDs.


ExistingFifteenDigitsId 
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( 
IF(FIND(MID(audit_survey__r.audit__r.Id,1,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,2,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,3,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,4,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,5,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) 
)+1,1) 
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( 
IF(FIND(MID(audit_survey__r.audit__r.Id,6,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,7,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,8,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,9,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,10,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) 
)+1,1) 
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( 
IF(FIND(MID(audit_survey__r.audit__r.Id,11,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,12,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,13,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,14,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) 
+IF(FIND(MID(audit_survey__r.audit__r.Id,15,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) 
)+1,1)

Tuesday, February 21, 2012

Creating your Own Dropbox Server

Since hard drive space is relatively cheap these days, and if you have a server running 24/7, you can consider the following file sync software to create one/two/n-way sync.

Syncrify - uses "rsync" to copy data.  Useful if file versioning is not required(only in paid version and is fairly expensive).
Delta copy - ditto
Allway Sync - free but only support folders available in the file system (no native http/ftp support)
Good Sync - Not free for >100 files, but support file versioning and have native http/ftp support.

Tuesday, February 14, 2012

Assembla SVN

If you are familiar with SVN, you can have 1GB of repository space on Assembla with unlimited users for FREE.  This is perfect for most homebrew projects.

Tuesday, January 3, 2012

Remote Desktop to Your Home Computer Behind a Corporate Firewall

Most corporate firewalls will ban websites such as logmein.  However, they usually won't ban your home URL or your static internet IP address provided by your ISP.

Scenario 1 - Basic Firewall with Non-Restricted Access over HTTPS
For smaller enterprises, they might allow unrestricted outbound access over port 443.  If this is the case, setup your home router to accept port 443(HTTPS) and redirect that to your local PC on port 3389(RDP).

Scenario 2 - Via Citrix XenDesktop
Citrix's XenDesktop Express is free and allow up to four concurrent users to connect to four remote desktop.  It will require seperate servers though, ie
-Desktop Delivery Controller (DDC)
-Provisioning Server for Desktop

Scenario 3 - Terminal Services Gateway
Microsoft 2008 Server can act as a TS gateway and allow external clients to connect to the TS gateway and talk to computers behind the gateway.

Wednesday, November 23, 2011

Runas Different Credentials In Command Prompt

Sometimes you need to run an executable as a different user via command prompt:
- in scripts
- in Windows 2008 (not 2008 R2), you cannot use shift right click to "run as different user"

Windows come with a command line tool called "runas", which allow users to execute anything as a different user, in the following syntax
runas /user domain\username "full path to exe"

ie.
runas /user domain\username "c:\temp\temp.exe /a /l /r"

Tuesday, November 15, 2011

Active Directory MMCs and Command Line Tools

Administration Tools on your Windows XP/7:
If you need to manage/export data from AD outside of your windows server, install:
- the "Windows Server 2003 Administration Tools Pack" (for windows 2003 AD servers)
http://www.microsoft.com/download/en/details.aspx?id=16770

OR

- the "Remote Server Administration Tools for Windows 7" (for windows 2008 AD servers)
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=7887

They provide Active Directory related MMCs and Directory Services command line tools.

Quickly Exporting AD Information
Dsquery.exe allows you to find any users/groups/OUs/computers etc based on their name/attributes
http://technet.microsoft.com/en-us/library/cc732952(WS.10).aspx

Examples:
To retrieve all AD Groups with the prefix "foo"
dsquery group -name foo*

To retrieve all the users in the container "Users", domain "microsoft.com"
dsquery user cn=users,dc=microsoft,dc=com

Other AD Command Line Tools
Microsoft has also allowed you to perform most basic AD operations such as adding users/groups, resetting passwords, deleting accounts/groups via the command-line tools
http://support.microsoft.com/kb/322684

Thursday, October 27, 2011

Execute Large SQL files

sqlcmd -d [DatabaseName] -S [ServerName] -i [sql script file] -o [output file]

Saturday, September 3, 2011

Mobile Development Resources

Flex Resources
The following Flex ebooks are not too hard to find on the www:
  • Flex in a week 4.5
  • Adobe Flex 4.5 Fundamentals: Training from the Source
  • Flash Builder 4 and Flex 4 Bible
  • Enterprise Development with Flex (Adobe Dev Lib) 2010

Why MonoTouch And Mono For Android

Visual Studio Themes - Dark Background

If you are using a mild VS theme which has a grey background and light brown text:

you may have problems with some html tags having the same color as its text.  You need to change the "default" color 0x020000000 to your desired color.
http://www.hanselman.com/blog/ChangingYourColorsInVisualStudioNETBlackVersusWhite.aspx

The standard options to look out for are options-fonts->

  • Razor
  • Plain Text
  • Line Numbers
  • Comments
  • Identifier
  • Keyword
  • Operator
  • String
  • UserTypes

Removing Empty Folders In Command Prompt

For a quick way to batch remove all empty folders, "cd" into that folder and perform the following:

for /f "usebackq delims=" %d in (`"dir /ad/b/s | sort /R"`) do rd "%d"

Please backup the source folder before doing so, just in case.  Afterwards, you can use beyond compare and order by folder size to compare the results.

Tuesday, August 30, 2011

Salesforce Long Text Area and Formulas

If you try to create a formula on a "Long Text Area" field, salesforce does not support this.

One workaround is to create a new field and another workflow to perform a "field update" on this:
Step 1) Create a new field with data type of "Text Area (Long)"

Step 2) Create a workflow with the following settings:

Evaluation Criteria -> select "Every time a record is created or edited"
Rule Criteria -> select "Formula evaluates to true" and type "true"


Step 3) Select "Add Workflow Action" -> "New Field Update"

Step 4) Select the newly created field as the "Field To Update" and select "Use a formula to set the new value" under "Specify New Field Value"

Step 5) You can now enter in a formula that reference other "Long Text Area" fields.  The results will be posted to the new field of type "Long Text Area".

Reasons Behind This Solution
Basically this allows complex logics, ie perform formula calculations on a long text field, to be offloaded to a  workflow which runs on the background.  As a normal formula needs to be calculated very often and can slow down the page on each load/save, shifting the calculations to workflow helps salesforce lower the CPU usage.

Quickly Selecting Data from Salesforce Using System Log

If you just want to quickly see some data in your salesforce instance, you can execute soql queries by opening the Setup-> "System Log" and type in the following

System.debug ( [select Dealer_group_display__c from Account where Id = '001M0000005OFab']);
System.debug( UserInfo.getSessionId() );

This saves you from opening the Apex dataloader.

Developing Native Mobile Applications For Multiple Devices

If you are like me who needs to develop mobile applications, but doesn't want to stick with just one platform, you can try the following products:
PhoneGap http://www.phonegap.com/
Developers create a mobile version of their application using HTML 5 / Javascripts / CSS.  PhoneGap compile this as a native device application which can be hosted in the respective app stores.  The advantage is you are programming in HTML 5 which can than also be hosted as a mobile version of your website.  PhoneGap is free but does take a bit of configuration.

Adobe Flash Builder 4.5 http://www.adobe.com/devnet/flex/articles/mobile-development-flex-flashbuilder.html
For small applications, Adobe's latest Flash Builder 4.5.1 update allow developers to create a mobile Flex project.  It is fairly easy to learn for basic functionalities and is powerful enough to call external webservices and meet other real-life requirements.

Both products allow you to deploy to iPhones/iPads/Androids/Blackberry Tablets as native applications.

The advantage of developing uses these instead of just having a mobile version of your website is that you can minimise network traffic and provide a better user experience after the application is downloaded/installed.

Wednesday, May 18, 2011

DreamFactory migration steps

The following is just one way to migration an installation (ie OpenWealth).

1) Install package onto the new site
2) Use Monarch to migrate data across
3) Migrate page layout

Salesforce Migration Order/Best Practices

A snippet from Dream Factory's Snapshot documentation:

In order to achieve maximum results with your deployment, it is recommended that you follow the documented order of operations that is detailed below for Asset SnapShot Push. This order will minimize the errors generated by contingent dependencies and relationships in your Org. Carefully read any error messages and make adjustments as necessary. If you need to be able to push individual object fields then use the Object SnapShot Push.

1.    Objects: All *
2.    Apex Classes
3.    Apex Components
4.    Apex Pages
5.    Apex Triggers
6.    S-Controls
7.    Page Layouts
8.    Static Resources
9.    Letterheads
10.    Workflows **
11.    Report Types
12.    Home Page Web Links
13.    Home Page Components
14.    Home Page Layouts
15.    Custom Tabs
16.    Custom Labels
17.    Custom Applications
18.    Custom Object Translation
19.    Custom Sites
20.    Profiles: All ***
   
   
* This will push all Object fields plus their related Record Types, Web Links, Validation Rules, Search Layouts and List Views. These settings can also be pushed individually if needed.

** Users tied to workflows must be created in the Destination Org prior to pushing

*** This will push all Profile metadata plus the related settings including: Application Visibility, Field Level Security, Layout Assignments, Object Permissions, Record Type Visibility and Tab Visibility. These settings can also be pushed individually if needed.

Thursday, May 5, 2011

VMware vConverter Cannot Find Your Hard Drive

After you have installed vConverter, it may not be able to find any partition on your machine that needs to be converter.  This is caused by Windows UAC!

If you run the vConverter "As Administrator", vConverter will then see your hard drive.

http://communities.vmware.com/thread/285316