March 29, 2011

How to add a custom NS record to a domain/subdomain in dns-diy.net

- How to add a custom NS to DNSDIY
- How to add a custom NS to dns-diy.net
- Adding Custom NS at dns-diy.net
- Adding Custom NS at OnlineNIC domain

DNS Records:
We have many different type of DNS records and most of these record types are not commonly used. By the way you need to know a little about these
- NS: is name server which specifies a name server for the domain.
- CNAME: Sets an alias for a host name. Like "docs >> CNAME >> ghs.google.com. >> 0 >> 3600" in here means: forward docs.domain.com to custom google document server in behind scene.
- A: Maps a host name to an IP address
- MX: is Mail eXchanger.
- TXT: it's strictly informational.

Solution:
- Login to dns-diy.net in here or any domain control panel
- Find a custom DNS Records Zone (its first page which comes after login)
- Add a new record with
host: 
type: NS
data: ns.yourhost.com
priority: 0
ttl: 3600
- Click update and wait for minutes for works ;-)
DNS-DIY Zone Edit

Test:
If you'd like to check the status of your DNS records for web publishing, you can perform a free nslookup. Here's how:
- Google NS lookup [link].
- Select a search result from top of list.
- Type your domain address in to the field.
- Click Submit, or Lookup.

March 20, 2011

How to fix a row in Excel

How do you fix a row in Excel?
How do you freeze a row in Excel?
How do you fix a column in Excel?
How to fix a row in Excel when you move that one stays fixed?
How fixed column/row in Microsoft Office Excel?

Solution
1- Select Row/Column
2- Select View in ribbon

3- Select Freeze Panes from Window Section
4- Enjoy :-D

March 18, 2011

database does not have a valid owner

Error:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.
------------------------------
BUTTONS:
OK
------------------------------

Solution:
1. Right Click on your database, choose properties
2. Goto the Files
3. Change the owner textbox to "sa"
4. Press OK
5. Enjoy

March 16, 2011

Unmanaged C++ in C#

Questions
- Using Unmanaged C++ Dynamic Library (DLL) in .NET Applications
- Using DllImport for read a unmanaged dll
- How to Create DLL in Visual Studio 2008 in Visual C++ for Using in C#
- Call an Unmanaged DLL from .Net Windows Application
- Call an Unmanaged Visual C++ code from Managed Code like C# or other .NET

Solution
I have received a request from my friend, He wanted to have a solution with an unmanaged library (DLL) as core and a windows form application in C# as an interface. You can find a very simple solution with 2 languages, here.

- Microsoft Visual C++ 2010 (Unmanaged, Dll)
- Microsoft Visual C# 2010 (Managed, Windows Form)

ClassLibrary.h
// ClassLibrary.h
#define DllExport _declspec(dllexport)
extern "C" DllExport int Sum(int, int);
extern "C" DllExport wchar_t getChar(void);
extern "C" DllExport wchar_t* getString(void);

#pragma once
int Sum(int, int);
wchar_t getChar(void);
wchar_t* getString(void);

ClassLibrary.cpp
#include "stdafx.h"
#include "ClassLibrary.h"

int Sum(int a, int b){return a + b;}
wchar_t getChar(){return L'ن';}
wchar_t* getString(){return L"امیرمهدی خادم آستانه";}

part of Form1.cs
[DllImport("c:\\ClassLibrary.dll", CharSet = CharSet.Unicode)]
[return : MarshalAs(UnmanagedType.I4)]
public static extern Int32 Sum(Int32 a, Int32 b);

[DllImport("c:\\ClassLibrary.dll", CharSet = CharSet.Unicode)]
public static extern char getChar();

[DllImport("c:\\ClassLibrary.dll", CharSet = CharSet.Unicode)]
public static extern String getString();

Download
[1] Unmanaged C++ in C# Solution (both of VC and C# projects) download

Add OCX to C#

Questions
- Adding an OCX to a .Net Project
- How to add a OCX in C# Project?
- How to add a OCX in Windows Form Application?
- Adding a VB6 OCX in C# projects

Solution
1- Create a new Windows Form Application
2- goto Menu > Tools > Choose Toolbox Items
3- goto to COM Components tab and find Browse button
4- Add the OCX (you could install the OCX with regsvr32 command)
5- Drag it from toolbox and drop on form and enjoy

March 15, 2011

Speedup SQL

- Normalize Tables
- Avoid using cursors
- Index Columns
- Increase timeouts
- Avoid using un-necessary indexes
- Avoid using GOTO
- Avoid NULLABLE columns
- Avoid TEXT datatype
- Avoid IMAGE datatype
- Avoid SELECT * instead of select columns
- Avoid SELECT max(ID) instead of SCOPE_IDENTITY or IDENT_CURRENT
- Avoid bulk INSERT instead of DTS
- Don't start SP with "sp_"
- Use Analyze Query Plans
- Use of @@ERROR for trap errors
- Use of Count(*) for find number of rows
- Use SET NOCOUNT ON in stored procedures
- Avoid of more DISTINCT, LIKE ORDER BY, OUTER JOIN, UNION
- Avoid of more MATH
- Set Index - Fill Factor (increase percent for static data table with minimum INSERT and DELETE)

References
[1] http://forums.codecharge.com/posts.php?post_id=75008
[2] http://www.techrepublic.com/blog/datacenter/speed-up-sql-server-database-queries-with-these-tips/173

March 12, 2011

Enter Key in Textbox

Problem:
This is a simple and cruise my friend problem in ASP.NET. She want to transfer hit a Enter key event from text-box in html to fire a selective button. It is frequently required to hit enter after user insert a search terms instead of mouse click in Search box.

Solution:
This javascript can solve the problem



  
  
  

Download:
[link] 20110312-Enter Key in Textbox.rar

March 11, 2011

Status: 0xc0000001

Error:
Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:
1. Insert your Windows installation disc and restart your computer.
2. Choose your language settings, and then click "next."
3. Click "Repair your computer."
If you do not have this disk, contact your system administrator or computer manufacture for assistance.
File: \Windows\system32\config\system
Status: 0xc0000001
Info: Windows failed to load because the system registry file is missing, or corrupt.


Solution:
If you got this error in installation processes of Windows Vista or Windows 7 then you must check your memory. I changed the RAM modules and the problems went :-D

March 05, 2011

Microsoft Ajax Minifier and Manual Batch File

You can used of the Microsoft Ajax Minifier into your Visual Studio 2010 without change your project files or follow of strange roadmap (link). With simple batch file you can minified all JS and CSS files and move the new minified files in minified folder. With this simple trick you can Route the CSS and JS files to minified path.
Yes, It's so simple and a tricky solution for easy going people. The hardest part of this solution is the Batch file for minified all JS and CSS files with AjaxMin.exe as Microsoft Ajax Minifier and automatic move and replace in minified folder.
@echo off
md minified
for %%J in (*.js *.css) do @AjaxMin.exe -clobber:true "%%J" -o "minified\%%J"
pause

March 01, 2011

Performance Options after every startup

Errors
- My Performance Options box opens up after every startup system.
- I have tried numerous ways to set the page file size and after reboot everything went.
- I can't set to System managed size because it back to No paging file

Solution
This is a simple, just run this line in RUN or in START MENU search box, just do it and enjoy.
sc config afs start= disabled

Reference
[1] Link