Wednesday, November 9, 2011

stock options 101

non-voting stocks

common shares

investor terms sheet

ratchet anti-dilution

more on anti-dilution

Wednesday, September 28, 2011

sQL cookbook

Datetime cookbook

if else in sql

Crystal report 101

Sample 1

CR for MVC


display image

without this line in web.config you're dead.
add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

make sure the above line also appear on
system.webServersection

painful 2
Connection, make sure you use the same servername for development and product and use host file to map them to the correct ip on production server


Google mail setup

1.Sign up as reseller program using reseller.yourcompany.com as the domain account, you need DUNS
number during the registration.

Reseller program will not be able to see Customer PIN under [Support]

Go to add customer page and provide Customer PIN and domain info

2.Sign up for yourcompany.com, provide Customer PIN and domain to reseller.
http://reseller.googleapps.com/add-customer

Both above need verification on account.


After setup, you need to configure email MX setting under [Setup]. Make sure it is setup.

Tuesday, September 27, 2011

Crystal Report

Crystal report  for vs 2010

All you need from here

Redist is for production server

Complete Package is for your visual studio 2010

Basic sample

Thursday, September 1, 2011

process xlsx

you need to use this

and the below connection string

Provider=Microsoft.ACE.OLEDB.12.0; Data Source=  PATH ; Extended Properties=Excel 12.0;

Thursday, August 18, 2011

Monday, August 15, 2011

uploadify control

This control can post session parameters to upload.aspx together with the uploaded files

Parameter like session is crucial to identify which form does it belong to.

Wednesday, August 10, 2011

Loyalty free photos

This gives you free 7 trial

This provide full range of resources for download from template to images

Monday, August 8, 2011

Event Calendar

Good one.


Never tried but looks good

Sunday, August 7, 2011

Paypal Instant Payment Notification (IPN)

This is to handle notification from paypal related to any events.

Before you activate this service in Profile --> Instant Payment Notification Preference, make sure you create a handler page.

Details Document 1

Variable provided

Just create a page to handle the postback from paypal

Paypal Payment Data Transfer (PDT)

Before talking about PDT, the easiest way to enable paypal integration, use the code below.

<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="test@test.com" />
<input type="hidden" name="return" value="paymentdone.aspx">
<input type="hidden" name="cancel_return" value="http://cancel.aspx">
<input type="hidden" name="currency_code" value="SGD">
<input type="hidden" name="custom" value="1188967">
<input type="hidden" name="item_name" value="12 months Membership" />
<input type="hidden" name="amount" value="10.00" />
<input type="submit" value="Buy!" />



After user make payment through payment, user is required to click 'Return to seller website'.

If PDT is enabled under your seller profile, it will return tx (txn id) to your designated return page.

The page return from Paypal will contain the parameter in query string as below.

http://YourReturnWebsite.aspx?tx=0YB16486MY080364E&st=Pending&amt=10.00&cc=SGD&cm=1188967&item_number=

cm is the custom parameter that you put in your 'buying' page. This is useful to identify the transaction your customer made.

With the tx (txn id) given, you can do a http post to paypal again to retrieve the txn details, and the response you can get is something like below, which contain the detail of the transaction.

SUCCESS mc_gross=10.00 protection_eligibility=Partially+Eligible+-+INR+Only address_status=unconfirmed payer_id=NWDEUYU4YEE32 tax=0.00 address_street=1111 payment_date=04%3A57%3A24+Aug+07%2C+2011+PDT payment_status=Pending charset=windows-1252 address_zip=11111 first_name=Tan address_country_code=SG address_name=Henry+Tan custom=1188967 payer_status=unverified business=sales_biz%40email.com address_country=Singapore address_city=Singapore quantity=1 payer_email=test1_1312687433_per%40email.com txn_id=0YB16486MY080364E payment_type=instant last_name=Henry address_state= receiver_email=sales_1312687640_biz%40marketdata360.com receiver_id=L6DQ94PEGKY5S pending_reason=multi_currency txn_type=web_accept item_name=12+months+Membership mc_currency=SGD item_number= residence_country=SG receipt_id=3184-4081-1163-0163 handling_amount=0.00 transaction_subject=1188967 payment_gross= shipping=0.00


The limitation for PDT is that, you wont receive these information if user didnt click on 'return to seller website'

Refer to this article for more details.

one more official site for the variables
Official Paypal site

Friday, August 5, 2011

Design - Red

very clean n nice color combination

black + red combination

Thursday, August 4, 2011

Wednesday, August 3, 2011

JSON Encoding / decoding

very good open source for Json encoding / decoding.

Thursday, July 21, 2011

WCF Rest Compression

need to try this out

WCF REST Consume

Frameworks is provided for WCF Rest service

Detailed description

example 1

Very good example

Monday, June 20, 2011

Org Chart

Light weight org chart from google

Paid version

Quite cool also (free)

many examples

Friday, June 10, 2011

CKEditor

How to include image.

CKEditor1.FilebrowserBrowseUrl = "/ckeditor/ImageBrowser.aspx"
Sample code in asp.net 4.0

Thursday, June 9, 2011

Freetextbox setup

This link show you how to setup freeTextBox editor

Saturday, May 7, 2011

Thursday, May 5, 2011

Extraordinary experience jquery + colorbox + uploadify

A simple control which allows you to upload multiple files using uploadify and display the control with colorbox in ASP.NET, can be a learning of lifetime for you, because you need to know deeply what's going on behind server and client.

Strange behaviour 1:
Imagine you display you display the image via colorbox on custom aspx page (display.aspx), if you include RadScriptManager, you will find that your image galllery page (gallery.aspx), the uploadify couldnt trigger upload.aspx after you upload your files. I suspect it is due to the 'funny' generated html code by asp.net.

Wednesday, May 4, 2011

Multiple upload controls

Uploadify might be your best choice, which use jquery + flash.

Some points to note on this control. If you use it in pages need authentication. Remember to remove security access for your upload.aspx, else you will encounter http 302 !!!!

Telerik Client AJAX callback

Calling from client back to server through AJAX

Wednesday, April 13, 2011

serializing + deserializing your object

Excellent article on this. How to serialize your object to xml and get it back.

Monday, April 11, 2011

Linq nullable

How to use linq projection with custom object for nullable parameter

nullable in linq

Excellent article on how to deal with nullable value

telerik excel export style

Good demo to show you how you can change the look and feel

How to change sheet name.

In ExcelMLExportRowCreated  event,

e.Worksheet.Name = "Some Worksheet Name";

Saturday, April 9, 2011

access denied to MQ

Summary is to change the owner to you and give yourself full access on it.

Full details here

Friday, April 8, 2011

WCF

DataContract  -> control input and output

ServiceContract --> control the method

1. Create a interface (Service Contract) to define the methods available
2. Define Data contract if any
3. Create a host (.svc)to implement the interface
4. Client to consume

WCF + MSMQ

WCF + MSMQ example

MSMQ

MessageQueue messageQueue = null;
if (MessageQueue.Exists(@".\Private$\MyTestingQueues"))
{
messageQueue =
new MessageQueue(@".\Private$\MyTestingQueues");
messageQueue.Label = "Testing Queue 1";
Message objMsg = new Message ();
objMsg.Label = "Test Label";
objMsg.Body = "Content 1";
//messageQueue.Send(objMsg);
//TEST
CondoEntity objEntity = new CondoEntity();
objEntity.ListingGUID = Guid.NewGuid();
objEntity.Name = "test";
messageQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(CondoEntity) });
messageQueue.Send(objEntity);
}
else
{
// Create the Queue
MessageQueue.Create(@".\Private$\MyTestingQueues");
messageQueue = new MessageQueue(@".\Private$\MyTestingQueues");
messageQueue.Label = "Newly Created Queue";
}
messageQueue.Send("First ever Message is sent to MSMQ", "Title");

Friday, April 1, 2011

Selection - Enum

enum ExpenseCategory
{
LocalTravel = 0,
Medical = 1,
Others = 2
}


Load these values with Name into dropdown selection

EnumGetNames(typeof(ExpenseCategory));

Code Generation

This helps you to generate SP and DAL given your data table

Tuesday, March 29, 2011

REST WCF

if your have the following function in WCF. You will need the following input.

[WebInvoke(UriTemplate = "testFunction", Method = "POST",

ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,

RequestFormat =
WebMessageFormat.Json)]

public string testFunction(string test)
{

Expected Header
User-Agent: Fiddler
Host: localhost:5810
Content-Length: 15
Content-Type: application/json

INPUT:
{"test":"1234"}

OUTPUT:
{"testFunctionResult":"hi, 3\/29\/2011 10:46:56 PM 1234"}

You can make use of fiddler to send http post request. This illustrated the WCF REST function with JSON input and output.

Thursday, March 24, 2011

REST WCF

Simple and direct approach

another one

json framework

Simple step to teach you how to implement json framework to parse json string



Example



HTTP POST Restful

NSDictionary *data = [[NSDictionary alloc] initWithObjectsAndKeys:
username, USERNAMEKEY,
password, PASSWORDKEY,
nil];
SBJsonWriter *json = [SBJsonWriter alloc];
NSString *jsonString = [json stringWithObject:data];
NSLog(jsonString);


[data release];
[json release];

//create/send http post request
NSData *postData = [jsonString dataUsingEncoding:NSASCIIStringEncoding];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://abc.appspot.com/api/login/"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];

Full article

Wednesday, March 23, 2011

WCF Restful service basic 101

This tutorial gives you basic overview of WCF Restful with the template.

This looks useful too

iOS Device consume json

REST concept

Training video on wcf endpoint