Tuesday

constant array in c#


static readonly ArrayList a = new ArrayList() { "1", "2", "3", "4", "5", "6", "7", "8" };
public bool CheckIfContains(uint i)
{
return a.Contains(""+i);
}

Thursday

cut avi files (freeware , mac included)

1.Download mcoder

from developer site:

or mencoder for MACOS


2.After unpacking mencoder run following command in unpacked directory.
(first time is start-time , second is duration.)

>mencoder -ss 00:08:57 -endpos 00:08:12 -ovc copy -oac copy file2cut.avi  -o result.avi

Tuesday

template engine .net

 
using System.Collections;

namespace Business.CustomerServices
{
public class SimpleTemplateEngine
{

public string ReadFile(string f)
{
System.IO.StreamReader file = new System.IO.StreamReader(f);
string testxmldata = file.ReadToEnd(); file.Close();
return testxmldata;
}


public string RenderFile(Hashtable values, string fileName)
{
return Render(values, ReadFile(fileName));
}


public string Render(Hashtable values, string template)
{
foreach (DictionaryEntry entry in values)
{
template = template.Replace("{$" + entry.Key + "}",""+ entry.Value);
}
return template;
}

}

}

Monday

wcf test client visual studio 2010

here is simple wcf service tester source:
    
using System;
using System.ServiceModel;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Business.CustomerServices;
using Business.WebService;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
namespace BusinessWeb.Tests
{
[TestClass]
public class CreateAccountTester
{
[Test]
[Timestamp]
public void CreateAccount_Test()
{

var endpointAddress = new EndpointAddress(@"http://it003/CreateAccount/Service.svc");
var basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.MaxReceivedMessageSize = 2147483647;
basicHttpBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
var s = ChannelFactory<IService>.CreateChannel(basicHttpBinding, endpointAddress);

// now I can call webservice
NewAccountResp newAccountResp = s.CreateAccount(_newAccountArgs);
Console.WriteLine(newAccountResp.AuthResponse);
}
}
}

Thursday

ninject singleton behavior

      
using Ninject.Core;
[TestClass]
public class NinjectTestClass
{

[TestMethod]
public void NinjectTestMethod()
{
// ninject mapping
var module = new InlineModule(
m => m.Bind<IDataProvider>().To<TestProvider>().Using(new SingletonBehavior()),
//....


ninject example

       
using Ninject.Core;
[TestClass]
public class ChangePaymentSourceTest
{


[TestMethod]
public void PaymentSourceChange()
{
// ninject mapping
var module = new InlineModule(
m=>m.Bind<IDataProvider>().To<TestProvider>(),
m=>m.Bind<IFeeCanceller>().To<FeeCanceller>(),
m=>m.Bind<IFeeCreator>().To<FeeCreator>(),
m => m.Bind<IAccountSynchroniser>().To<AccountSynchroniser>(),
m => m.Bind<IPaymentSourceChanger>().To<PaymentSourceChanger>()
);
//creation ninject kernel
var kernel = new StandardKernel(module);
// creation provider- test provider in our case
var provider = kernel.Get<IDataProvider>();

// getting data
IAccountBusinessObject account = provider.GetAccountBusinessObject(new AccountIdentity() { customer = 1, sub = 1 });
IInvoiceOriginator i = provider.GetInvoiceOriginator(1);
UserInfo userInfo = provider.getUserInfo(1);

var changer = kernel.Get<IPaymentSourceChanger>();
i = changer.ChangePaymentSource(userInfo, account,i, 2, 3, 1);

// 5.Synchronise account
var synchroniser = kernel.Get<IAccountSynchroniser>();
synchroniser.Synchronize(account);

Scope scope = provider.BeginTransaction();
provider.SaveInvoiceOriginator(i, scope);
provider.SaveAccountBusinessObject(account, scope);
provider.CommitTransaction(scope);
}
}

Tuesday


Я тут недавно прбежался по регистраторам. Самые дешевые


shareit
4.9% + $1 или 8.9% (мин. $1)
перевод на счет стоит $2

пэйпро
4.9% + $1
перевод на счет стоит $21
PayPro Global


фастспринг
5.9% + $.95 или 8.9%.
(Правда у фастспринга для неамериканских покупателей только карточки и paypal)
FastSpring


Есть еще esellerate и swreg которые еще дешевле, но там как я понял на дешевой комиссии они будут extended download ползователям втюхивать


Avantage

BMT Micro

Plimus

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...