Mongol Coder

Monday, January 23, 2012

Кодыг дахин бичих?

Test Driven Development - Тест хөтлөгчтэй хөгжүүлэлт
Refactor - дахин бичих
Unit test - Нэгжийн тест

Тест хөтлөгчтэй хөгжүүлэлтийг хэрэгжүүлэх үед шинэ метод эсвэл класс бичиж буй үндсэн зорилго нь зөвхөн өгөгдсөн тестийг давах явдал байдаг. Энэ үед таны орхих, бүр мартах ёстой зүйлүүд бол кодыг гоё харагдуулах, ухаалгаар, гайхамшигтай санаа олж бичих, дахин ашиглах боломтой байлгах зэрэг юм. Та эхний ээлжинд зүгээр л бүх тестийн үр дүнг "ногоон" болгох хэрэгтэй. Дараагийн шат бол харин бичсэн кодоо сайжруулах. Энэ бол бодит байдалд нийцсэн үр дүнтэй аргачлал. Олон хөгжүүлэгчид эхнээс нь кодоо үзэмжтэй гоё болгохын тулд маш их цаг зарцуулдаг. Үр дүнд нь тэд ямар нэг зайлшгүй байх ёстой функциональ шаардлагыг мартаж орхигдуулна. Орхигдсон хэсгийг нөхөж оруулахдаа дахиад л цаг зарцуулж гоё болгосон кодоо эвдэнэ. Иймээс кодоо гоё болгоно гэхээсээ өмнө бизнесийн шаардлага бүрэн хангагдсан байх ёстой гэдэг зарчмыг мөрдлөгө болгох хэрэгтэй. Нэгжийн тест нь танд кодоо "дахин бичих" явцад ямар ч өөрчлөлт орсон таны код бизнес шаардлагаа бүрэн хангаж байгаа гэдэгт итгэлтэй байхад туслана. Энэ бол "аюулгүй дахин бичилт" гэдэг ухагдахууны үндэс.

Tuesday, October 11, 2011

Oracle 11R2 RAC on Windows 2008 server

Hello all,

I'm sharing information about how oracle rac is installed on windows 2008 server enterprise edition R2. A few months ago, i configured it successfully on VMWare server environment with shared disks.
Finally, i tested it on 2 Dell server R810 with E7540 (48 cores, 128gb ram) and Dell Equallogic 6510 storage of 14tb capacity with RAID 10.

While configuration phase of installation, i ended up with windows dead blue screen many times. (DRIVER_IRQL_NOT_LESS_OR_EQUAL) The reason of this error was Oracle Grid infrastructure can not be installed on servers with more 32 cores. So i turned of Turbo HT and oracle grid infrastructure installation completed smoothly. After installation you can patch grid with 10637621 and re-enable turbo to 48 cores. If you see this blue screen, page 7 of the second pdf below can help you.

You can use following document for installation & troubleshooting.
http://www.mits.mn/RACGuides_Rac11gR2OnWindows.pdf
http://www.mits.mn/WTRB_11g.pdf

PS: Take care of database version. If you download oracle by the time you will download 11g 2.0.1 version. When you try to patch 10637621 on it, it will require you to install oracle.rdbms.rsf, 11.2.0.2.0 component. So don't use 11g2.0.1, use version 11g2.0.2. It seems not preferred to patch 11g2.0.2 on 11g2.0.1. It's recommended to install freshly. You can download it from metalink, it's not listed current on public download page. WTRB_11g.pdf is guide to patch 11g2.0.2, not 11g2.0.1.

Sunday, January 2, 2011

Change MaxItemsInObjectGraph value on server and client side

When i was working with WCF + XPO i faced with the following problem.

CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '20.20:29:58.9889422'.

It was caused by large amount of data retrieved from the server which MaxItemsInObjectGraph configuration value set to default(65535). I googled so much and finally found the solution for this. By changing MaxItemsInObjectGraph to enough value on server and client side, it was solved.

Server side:
SqlConnection conn = new SqlConnection("Initial Catalog=flight; Data Source=NEU\\SQLEXPRESS; Integrated Security=SSPI;Persist Security Info=False");

IDataStore sourceDataStore = XpoDefault.GetConnectionProvider(conn,AutoCreateOption.DatabaseAndSchema);

DataStoreServerProxy publicationObject = new DataStoreServerProxy(sourceDataStore);

Uri baseAddress = new Uri("net.tcp://0.0.0.0:1234/");
serviceHost = new ServiceHost(publicationObject, baseAddress);
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
binding.SendTimeout = new TimeSpan(500, 30, 0);
binding.ReceiveTimeout = new TimeSpan(500, 30, 0);
binding.OpenTimeout = new TimeSpan(500, 30, 0);
binding.CloseTimeout = new TimeSpan(500, 30, 0);
binding.MaxReceivedMessageSize = 2147483647;

serviceHost.AddServiceEndpoint(typeof(IDataStoreContract), binding, "XPOService");

serviceHost.Open();
foreach (OperationDescription operation in serviceHost.Description.Endpoints[0].Contract.Operations)
{
var behavior = operation.Behaviors.Find();
if (behavior != null)
behavior.MaxItemsInObjectGraph = 2147483647;
}


Client side:

NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);

binding.MaxReceivedMessageSize = 2147483647;
binding.SendTimeout = new TimeSpan(500, 30, 0);
binding.ReceiveTimeout = new TimeSpan(500, 30, 0);
binding.OpenTimeout = new TimeSpan(500, 30, 0);
binding.CloseTimeout = new TimeSpan(500, 30, 0);


ChannelFactory factory = new ChannelFactory(binding, "net.tcp://localhost:1234/XPOService");
foreach (OperationDescription operation in factory.Endpoint.Contract.Operations)
{
var behavior = operation.Behaviors.Find();
if (behavior != null)
behavior.MaxItemsInObjectGraph = 2147483647;
}


DataStoreClientProxy remoteDataStore = new DataStoreClientProxy(factory.CreateChannel());

// Initialize XPO to use that reference
XpoDefault.DataLayer = new SimpleDataLayer(remoteDataStore);
XPClassInfo[] ClassInfos = { Session.DefaultSession.GetClassInfo(typeof(City)), Session.DefaultSession.GetClassInfo(typeof(CityArea)) };
XpoDefault.DataLayer.UpdateSchema(false, ClassInfos);

Wednesday, March 24, 2010

Coding Rule

Here, i decided to write my coding rules to code as i prefer, subsequently.

1. In any function or procedure body don't write more than 40 rows.
It can help you view entire function in 1 page.
2. Use 0 function status value on perfect success, 1< on application errors, -1 or -1> on runtime errors.
3. Use layer or interface as soon as possible.
This can help you make updates on online apps.
4. Always log. On every start of a function, log parameters and after generated result, log result
This is your key to secure coding.
5. Naming convention is key to fast coding. Create your own or pick any from experts' templates

Sunday, March 21, 2010

Google Maps - /* Guardian removed escaped content */

Last week, while i was loading Google Map in intranet web site, there was a syntax error in javascript loaded from http://maps.gstatic.com/intl/en_ALL/mapfiles/208a/maps2.api/main.js, and was not showing google map.
I found that firewall replaced some codes with "Guardian removed escaped content" text. I told our security deparment to unblock gstatic.com, i got rid of the problem. We use SmoothWall fire, it's latest updates were changed or configured to replace javascript comment with the text. Maybe this post can help someone who faced the same problem with me :)

Wednesday, January 20, 2010

How to include .net offline installer in setup projects

When we try to install VS.NET Setup project to another computers it requires .net framework installation files to be downloaded from internet. When connection is slow or no connection it's headache.
It's made easy and perfect in VS 2008 without any custom bootstraps. To do follow these easy steps.
Right click on Setup project's name, and click on Properties menu. So you will see following window.



Click Prerequisites button and you'll see this window.


Check required components from the checkbox list, select 2nd radio button named 'Download prerequisites from the same location as my application' and click OK to complete. I offer you check Windows Installer 3.1.

After all rebuild your setup project and you will see DotnetFX35, WindowsInstaller3_1 folders in your output directory(Debug or Release).
When you run setup.exe, it will check WindowsInstaller3.1 and install it if not present; this requires system reboot. After rebood, it will check .net framework and install if not present, and then it will install main application.

That's all folks

Friday, November 13, 2009

Source Control Hosting Comparison


I'm searching for Source control hosting that fits for me and my friends. It's about at most 7 of my friends and should be available of unlimited projects. I've finally chosen these hosts listed below. All of them seem have enough space and rich features /compared to others no listed here and prices/

.

www.codespaces.com

Prices and Plans

Code Spaces is "Pay as you go", so simply pick a plan that suits your teams size and needs, and you're ready to go.
Feature
Enterprise
Large Team
Small Team
Micro ISV
Mini
Cost / Month
$79.99
$49.99
$29.99
$9.99
$2.99
Disk Space
10GB
3GB
2GB
1GB
250MB
Users
Unlimited
25
10
4
2
Projects
Unlimited
100
50
10
4
Subversion Repositories
Unlimited
100
50
10
4
Real Time Backups
YES!
YES!
YES!
YES!
YES!
Secure Access
YES!
YES!
YES!
YES!
YES!
Repository Permissions
YES!
YES!
YES!
YES!
YES!
Project Management
YES!
YES!
YES!
YES!
YES!
Issue Tracking
YES!
YES!
YES!
YES!
YES!
Task Management
YES!
YES!
YES!
YES!
YES!
Wiki's
YES!
YES!
YES!
YES!
YES!
Web Based SVN Browser
YES!
YES!
YES!
YES!
YES!
Forums
YES!
YES!
YES!
YES!
YES!
Personalized URL
YES!
YES!
YES!
YES!
YES!
Project Portals
YES!
YES!
YES!
YES!
YES!
Card Walls
YES!
YES!
YES!
YES!
YES!
 
www.assembla.com

Pricing/Plans

ENTERPRISE

Make an organization more agile

$249/mo

  • Unlimited users
  • 100 spaces
  • 50 GB
  • Pro management tools

PROFESSIONAL

Manage a project-based company

$99/mo

  • Unlimited users
  • 20 spaces
  • 20 GB
  • Pro management tools

GROUP


$49/mo

  • 40 users
  • 10 spaces
  • 5 GB
  • Pro management tools

SINGLE

For one important project

$24/mo

  • 40 users
  • 1 spaces
  • 2 GB
  •  

METERED

For small teams

$3/user/mo

  • $3 per user per space
  • Pay per space
  • $0.30 per 100 MB
  •  

www.xp-dev.com

Pricing Plans

Subscription Plan
Free
Pro
Small

Pro
Medium

Pro
Large

Enterprise
Small

Enterprise
Medium

Enterprise
Large

Space
200MB
1GB
4GB
10GB
20GB
40GB
100GB
Private Projects
2
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Public Projects
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Users
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
SSL Access (secure)







Advertisement Free







Real-time Backups







Nightly Off-site Encrypted Backups







Bug Tracking







Search Filters
4
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Unlimited
Wiki Pages







Forums







Blogs







File Attachments







Fast & Secure Trac Project Hosting







Import/Export Repositories at anytime







Integration with Basecamp, FogBugz, Lighthouse & Twitter







Price
Yearly payments are
entitled to a 20% discount.

Free

$5/month
$48/year

$15/month
$144/year

$30/month
$288/year

$50/month
$480/year

$100/month
$960/year

$200/month
$1920/year

OptionalReal-time Backups to Amazon S3
$2/month
$19.20/year

$2/month
$19.20/year

$2/month
$19.20/year

$2/month
$19.20/year

$2/month
$19.20/year

$2/month
$19.20/year

$2/month
$19.20/year

Yearly payments are entitled to a 20% discount