Hash codes for Realex payment processing
// Create an md5 sum string of this string
static public string GetMd5Sum(string str)
{
// First we need to convert the string into bytes, which
// means using a text encoder.
Encoder enc = System.Text.Encoding.ASCII.GetEncoder();
// Create a buffer large enough to hold the string
byte[] unicodeText = new byte[str.Length];
enc.GetBytes(str.ToCharArray(), 0, str.Length, unicodeText, 0, true);
// Now that we have a byte array we can ask the CSP to hash it
MD5 md5 = new MD5CryptoServiceProvider();
byte[] result = md5.ComputeHash(unicodeText);
// Build the final string by converting each byte
// into hex and appending it to a StringBuilder
StringBuilder sb = new StringBuilder();
for (int i = 0; i < result.Length; i++)
{
sb.Append(result[i].ToString("X2"));
}
// And return it
return sb.ToString().ToLower();
}
XmlSerializer Cache
var xs = new XmlSerializer(typeof(DataSet));
On a first call, this generates a cached serialization assembly. On my PC, this takes 0.2 seconds. However, on subsequent calls,
this line executes in 0.00006959 seconds.
This is how I timed this;
private TimeSpan CreateXMLSerializer(int numberOf)
{
var dtStart = DateTime.Now;
var lNumber = Enumerable.Range(1, numberOf);
foreach (var intIteration in lNumber)
{
var xs = new XmlSerializer(typeof(DataSet));
}
var dtEnd = DateTime.Now;
return dtEnd – dtStart;
}
UGFzc3dvcmQ6
I’ve ever seen in my life.
But where is this used?, on a student project?, nope, it forms the bases of SMTP email authentication.
AUTH {blank} 334 UGFzc3dvcmQ6 18 45 noreply@a.com
AUTH c3R1cGlk 235 Authenticated 19 18 noreply@a.com
and the password is base 64 encoded too.
Terrible.
Mathematically determining your max cpc for adwords
I’m no expert, but this is what I’ve come up with:
1) bid on several hundred keywords at 0.03p each, and let google cancel the ones that are over competitive. This normally creates a spike and a rapid tail
off of visitors, so the success of this plan can only be seen after a few days.
I found that this bottom-feeding approach brings in cheap traffic, but not much of it.
2) Pay the maximum you can afford to bring in as many visitors as possible, whilst making sure the cost per conversion does not exceed nor equal your average profit per conversion.
Google is unusual in the sense of the more visitors you purchase, the higher the cost per visitor gets. Economies of scale are somewhat reversed in this situation. However, if you make £1 a conversion, and it costs 50p per conversion for 1,000 visitors, or 40p a conversion for 100 visitors, then you are still better paying £500 for £1000 profit than £40 for £100 profit.
To calculate your maximim CPA (Cost per Action), then it is take a specific period, i.e. January 2010, say P is your gross profit in January 2010, C is your cost of sales, N is the number of conversions in Jan ’10. Then your Maximum CPA is (P-C)/N
Now, not every click on an ad will result in a conversion, depending on the ticket value of your product, this could be anything from 1% to 50%. Check your conversion rate bettween your visitors (V) and conversions (N) , then divide this into your Max CPA i.e. CPA x N/V to get your Max CPC.
Interestingly, combining both equations nullifies your conversion rate: (P-C)/V – But you’ll still need to have your Max CPA to hand to ensure that no individual keyword exceeds your MAX CPA.
Cost breakdown of Amazon Simple DB
| I uploaded a 1.6 GB database to Amazon Simple DB, and the bill came to just over $5. The most costly part was the upload which took 34 Hours of processing time.
US-East (Northern Virginia) Region |
||||
| $0.00 per Compute-Hour consumed first 25 hours per month |
25 Hrs |
0.00 | ||
|
$0.14 per Compute-Hour consumed beyond first 25 free hours per month |
36.419 Hrs |
5.10 | ||
| $0.00 per GB-Month of storage for first 1 GB-Month |
0.931 GB-Mo |
0.00 | ||
| $0.00 per GB – All data transfer in |
1.647 GB |
0.00 | ||
| $0.00 per GB – first 1 GB / month data transfer out |
0.821 GB |
0.00 | ||
| 5.10 | ||||
Complete breakdowns are available, but don’t have a cost associated with each operation
|
. |
Service | Operation | UsageType | StartTime | EndTime | UsageValue |
|
. |
AmazonSimpleDB | CreateDomain | BoxUsage | 3/9/2010 16:00:00 |
3/9/2010 17:00:00 | 0.0055590278 |
|
. |
AmazonSimpleDB | PutAttributes | DataTransfer-Out-Bytes | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 2280 |
|
. |
AmazonSimpleDB | SelectGet | BoxUsage | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 0.000041146868 |
|
. |
AmazonSimpleDB | ListDomains | Requests | 3/9/2010 16:00:00 |
3/9/2010 17:00:00 | 2 |
|
. |
AmazonSimpleDB | PutAttributes | DataTransfer-In-Bytes | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 4668 |
|
. |
AmazonSimpleDB | ListDomains | DataTransfer-Out-Bytes | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 862 |
|
. |
AmazonSimpleDB | PutAttributes | BoxUsage | 3/9/2010 16:00:00 |
3/9/2010 17:00:00 | 0.0001324322 |
|
. |
AmazonSimpleDB | DeleteDomain | Requests | 3/9/2010 16:00:00 |
3/9/2010 17:00:00 | 1 |
|
. |
AmazonSimpleDB | ListDomains | DataTransfer-In-Bytes | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 836 |
|
. |
AmazonSimpleDB | DeleteDomain | DataTransfer-Out-Bytes | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 378 |
|
. |
AmazonSimpleDB | ListDomains | BoxUsage | 3/9/2010 16:00:00 |
3/9/2010 17:00:00 | 0.0000143518 |
|
. |
AmazonSimpleDB | DeleteAttributes | Requests | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 3 |
|
. |
AmazonSimpleDB | DeleteDomain | DataTransfer-In-Bytes | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 426 |
|
. |
AmazonSimpleDB | DeleteAttributes | DataTransfer-Out-Bytes | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 1158 |
|
. |
AmazonSimpleDB | DeleteDomain | BoxUsage | 3/9/2010 16:00:00 | 3/9/2010 17:00:00 | 0.0055590278 |
|
. |
AmazonSimpleDB | CreateDomain | Requests | 3/9/2010 16:00:00 |
3/9/2010 17:00:00 | 1 |
Mail enable ME-I0129 error
Authenticating User: a@b.com using Authentication Provider Credentials
04/01/10 12:43:19 ME-I0129: Account b.com Mailbox a@b.com prevented from sending email as a@c.com
04/01/10 12:43:23 ME-I0070: (recv) socket [780] was gracefully closed during [MAIL] command by the remote client xxx.xxx.xxx.xxx
04/01/10 12:43:23 ME-I0074: [780] (Debug) end of conversation
Fix:
Start > Run > mailenable.msc
Open Servers / Localhost / Connectors / SMTP
Right Click
Security
Uncheck "Authenticated senders must use valid sender address"
Restart "MailEnable SMTP Connector" from Control Panel / Administrative tools / Services
XBox 360 Halo3 Reach code generator
http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=230455976792
Eh hem, but I don’t have an xBox, so it’s for sale.
Read Wii Game DVD from windows
Open up imgBurn, press discovery.
You get some disc info on the right hand side:
MATSHITA DVD-RAM UJ880AS 1.50 (ATAPI)
Current Profile: DVD-ROM
Disc Information:
Status: Complete
Erasable: No
Sessions: 1
Sectors: 2,294,912
Size: 4,699,979,776 bytes
Time: 510:00:62 (MM:SS:FF)
Supported Write Speeds: 2x, 4x, 6x, 8x
TOC Information:
Session 1… (LBA: 0)
-> Track 01 (Mode 1, LBA: 0 – 2294911)
-> LeadOut (LBA: 2294912)
Pre-recorded Information:
Manufacturer ID: DAXON016S
Physical Format Information (Last Recorded):
Disc ID: 0@P-!-00
Book Type: DVD-R
Part Version: 5
Disc Size: 120mm
Maximum Read Rate: Not Specified
Number of Layers: 1
Track Path: Parallel Track Path (PTP)
Linear Density: 0.267 um/bit
Track Density: 0.74 um/track
First Physical Sector of Data Area: 196,608
Last Physical Sector of Data Area: 2,491,519
Last Physical Sector in Layer 0: 0
Performance (Write Speed):
Descriptor 1…
-> B0: 0x00, B1: 0x00, B2: 0x00, B3: 0x00
-> EL: 2297888 (0x00231020)
-> RS: 2,770 KB/s (2x) – WS: 2,770 KB/s (2x)
Descriptor 2…
-> B0: 0x00, B1: 0x00, B2: 0x00, B3: 0x00
-> EL: 2297888 (0x00231020)
-> RS: 5,540 KB/s (4x) – WS: 5,540 KB/s (4x)
Descriptor 3…
-> B0: 0x00, B1: 0x00, B2: 0x00, B3: 0x00
-> EL: 2297888 (0x00231020)
-> RS: 8,310 KB/s (6x) – WS: 8,310 KB/s (6x)
Descriptor 4…
-> B0: 0x00, B1: 0x00, B2: 0x00, B3: 0x00
-> EL: 2297888 (0x00231020)
-> RS: 11,080 KB/s (8x) – WS: 11,080 KB/s (8x)
etc.
Press Tools > Drive > sector viewer >
Then at LBA 0, offset 0020 you see the Game name i.e. "101-in-1 Party Megamix Wii"
Hello World for Palm Pre
Created with ares, just dropped a "Hello World" label on the form, then pressed Run.
You need to have Sun Virtua Box, and the Palm Emulator installed an running.
This is the source of the main-chrome.js file
opus.Gizmo({
name: "main",
dropTarget: true,
type: "Palm.Mojo.Panel",
h: "100%",
styles: {
zIndex: 2
},
chrome: [
{
name: "label1",
label: "Hello World",
type: "Palm.Mojo.Label",
l: 0,
t: 77,
h: 77,
hAlign: "center",
vAlign: "center"
}
]
});
Mobile version of Google Translate
/// <summary>
/// Translate Text using Google Translate
/// </summary>
/// <param name="input">The string you want translated</param>
/// <param name="languagePair">2 letter Language Pair, delimited by "|".
/// e.g. "en|da" language pair means to translate from English to Danish</param>
/// <param name="encoding">The encoding.</param>
/// <returns>Translated to String</returns>
public static string TranslateText(string input, string languagePair, Encoding encoding)
{
string url = String.Format("http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}", input, languagePair);
string result = String.Empty;
using (WebClient webClient = new WebClient())
{
webClient.Encoding = encoding;
result = webClient.DownloadString(url);
}
string strRegex = @"this.style.backgroundColor=’#fff’..(?<Text>[ws+]+)";
Match m = Regex.Match(result, strRegex);
return m.Groups["Text"].Value;
}
Orginal version from dnknormark.net, but I fixed his regex.
Check out http://translate.freebiesms.mobi/ for a demo