4 methods to Install Gui For Centos 5 and Centos 6

No comments

If you want to install gui(GNOME) on your VPS to VNC connect you choose one method:

1. Oneline to install GUI for Centos 5, 6

Login as superuser and type:

 yum groupinstall "X Window System" "GNOME Desktop Environment"

You will download over 200MB to update.

2. Short oneline to install GUI for Centos

yum install @x11 @desktop

3. Multiline to install destop for Centos

yum groupinstall -y 'X Window System'
yum groupinstall -y 'Desktop'
yum groupinstall -y fonts


4. 4 step to install GUI and VNC


Step1: Install GUI on Centos:
yum -y groupinstall "Desktop"

Step2: Install VNC and firefox on Centos server:
yum -y install tigervnc-server xorg-x11-fonts-Type1 firefox  

Step3: Then you start the VNC server on Centos
Run it as root:
vncserver
Step 4: Type the password and using VNC client to connect.

----------------
Note: If you want the GUI auto start on boot
Please type:
nano /etc/inittab
Change:
id:3:initdefault:
To:
id:5:initdefault:

To start the GUI for Centos manual, you type:
init 5
After that, you type:
startx


No comments :

Post a Comment

[C#] 3 best ways to remove all special characters from string

No comments
You want to remove characters \ /:*?"<>|!@#$%^&() from a string?
Very easy! Follow some method:

1. Remove all special characters
string rExp = "[^\w\d]";
string tmp = Regex.Replace(n, rExp, "");

2. Remove all special characters but allow some
Example: Allow . and _
Regex.Replace(input, "[^a-zA-Z0-9._]", string.Empty)

3. Easy function remove all special characters, but allow "_"

 public static string Remove_Special_Characters(string str)
        {
            StringBuilder sb = new StringBuilder();
            foreach (char c in str)
            {
                if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_')
                {
                    sb.Append(c);
                }
            }
            return sb.ToString();
        }

No comments :

Post a Comment

Debugging mode not can not work with F10 and F11 Visual Studio 2010

No comments
(Continue with fix-debugger-not-working)
When I going to debug with Visual Studio 2010, It work!
But when I want to run line by line at break point. I press F11 and F10... => It not work!!!

Solutions to fix:
1. Install http://support.microsoft.com/default.aspx/kb/957912
2. Change the port of the Visual Studio development server (go to menu Project > Properties > Web > *Server: User Visual Studio Development Server: Specific port = 12345)

No comments :

Post a Comment

What is benchmark?

1 comment
Today, more and more devices appear. Ext: more model smart phone, GPU, CPU, HardDisk,...

What's standard for all?
No! No standard for all, so more benchmark software appear. 

What is benchmark?

It's a software or a system for test or stress test  to compare performance of hardware, software or devices. Many developer using benmark software to improve or evaluate they products(hardware or software). Users using benchmark to compare products to buy best products.

Exp:
- Benchmark GPU to test speed, test temperature.
- Benchmark smartphone for battery life
- .... 

1 comment :

Post a Comment

What is “ops/sec”?

No comments
Today, my friend ask me: "What is ops/sec?"
:D

ops/sec is operations per second. When you test benmark. It's meanoften how many time execute a test in a second.

ops/sec often using for benchmark devices as smartphone, GPU, CPU, read write disk, or test for framework,...

Now you can answer "What is ops/sec?"!

No comments :

Post a Comment

[ASP] Fix "Debugger not working - Authentication error occurred..."

No comments
Coding... coding... and press F5 to debug it...
The message show: "Debugger not working - Authentication error occurred while communicating with the web server" and you can't continue your work!

Some error similar
"Unable to start debugging on the web server. An authentication error occurred while communicating with the web server"
"Error while trying to run project. Unable to start debugging on the web server."

What problems?
Try check some one:
1. Are you register asp.net to IIS?
- Delete the ASPNET account
- Using commad line go to ASP.NET IIS Registration Tool and type "aspnet_regiis -i"
Read more at: http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

2. If you using old system: IIS6, Visual Studio 2008,...
Please read this article: http://support.microsoft.com/kb/896861


No comments :

Post a Comment

[Hosting] SNAPP - Try free cloud hosting platform-as-a-service for .NET applications

No comments

This host had closed!

I feel enjoy when I try this cloud. Now it free for Beta

1. .NET PaaSified

Snapp Systems is an elastic cloud hosting platform-as-a-service for .NET applications. It's the first PaaS to include a configurablestaging and production site. DevOps just became more productive.



2. How it work

  • 1 Deployment

    Deploy your application using FTP, Web Deploy, GIT, or TFS. No deployment learning curve.
  • 2 Staging Site

    Meet the first PaaS that includes a full staging site so you can test your app before it goes live in production.
  • 3 Publish

    No need to redeploy. With a click of a button, publish your staging site to production - immediately or schedule the deployment in the future. We also support deployment hooks too.
  • 4 Production Site

    We provide an elastic scalable production site that you expect in a PaaS. Increase the number of workers when you need to. Now with Hostname support.
  • 5 Application Snapshot

    Publish with peace of mind. When you publish your app to production, we keep an archive of your latest releases.
  • 6 Rollback

    Should something unforeseen happen in production, rolling back to a previous working snapshot is just a click away.
  • 7 Application Monitoring

    Our PaaS comes with exception management tools. Enable this feature and monitor your application exceptions.
  • 8 Reports

    View exception handler reports and get more insight to troubleshoot your app.

3. Review SNAPP cloud

SNAPP provide .Net flatform and free MS SQL Server 
And chart:
Ping from Buffalo


You can using SNAPP beta for testing. 

No comments :

Post a Comment

[Javascript] Make This Site Your Home Page Button

No comments

1. Set homepage only for IE

Make this site your
<a href="javascript:history.go(0)" onClick="this.style.behavior='url(#default#homepage)';
 this.setHomePage('http://aspnet-fix.blogspot.com/');">Home Page</a>
Test: Make this site your Home Page

2. Set homepage for FireFox

If config: signed.applets.codebase_principal_support = true
<script language="javascript"> 
 function setHomepage() 
 { 
  if (document.all) 
     { 
         document.body.style.behavior='url(#default#homepage)'; 
   document.body.setHomePage('http://aspnet-fix.blogspot.com/'); 
   
     } 
     else if (window.sidebar) 
     { 
     if(window.netscape) 
     { 
          try 
          {   
             netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");   
          }   
          catch(e)   
          {   
 alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true"); 
          } 
     }  
     var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch); 
     prefs.setCharPref('browser.startup.homepage','http://aspnet-fix.blogspot.com/'); 
  } 
 } 
</script>
Test: Home Page

3. How about Chrome?

Chrome not allow to set homepage by javascript!

4. Using bookmark

// Add to Bookmark
function add_bookmark( a ) { 
  title = document.title; 
  url = document.location; 
  try { 
    // IE
    window.external.AddFavorite( url, title ); 
  } 
  catch (e) { 
    try { 
      // Mozilla Firefox
      window.sidebar.addPanel( title, url, "" ); 
    } 
    catch (e) { 
      // Opera 
      if( typeof( opera ) == "object" ) { 
        a.rel = "sidebar"; 
        a.title = title; 
        a.url = url; 
        return true; 
      } 
      else { 
        // Unknown (Chrome, Safari,...)
        alert( 'Press Ctrl-D to add page to your bookmarks' ); 
      } 
    } 
  } 
  return false; 
}

<a href="#" onclick="return add_bookmark(this);">Add to bookmarks</a>
Test Add to bookmarks

P/S: Today users don't like set your website to home page, because search engine and many bookmark services

No comments :

Post a Comment

[C#] Remove all special character \ /:*?"<>|!@#$%^&() from a string

No comments
You want to remove characters \ /:*?"<>|!@#$%^&() from a string?
Very easy! Follow some method:

1. Remove all special characters
string rExp = "[^\w\d]";
string tmp = Regex.Replace(n, rExp, "");

2. Remove all special characters but allow some
Example: Allow . and _
Regex.Replace(input, "[^a-zA-Z0-9._]", string.Empty)

3. Easy function remove all special characters, but allow "_"

 public static string Remove_Special_Characters(string str)
        {
            StringBuilder sb = new StringBuilder();
            foreach (char c in str)
            {
                if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_')
                {
                    sb.Append(c);
                }
            }
            return sb.ToString();
        }

No comments :

Post a Comment

Fix error: "Could not load file or assembly 'Microsoft.Web.Extensions..."

No comments
One day, you are coding... And run it! But an error show!

Could not load file or assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
You don\'t worry! And try some solutions

1. Review web.config

- Install the latest Asp.NET Ajax - Open my web.config in my production server and replace this line

<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"></add> 

by
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"></add> 
PublicKeyToken is in capitals....

2. Check your bin folder
Copy the System.Web.Extensions.dll into the app's bin directory if you have.

 3. Install ASP.NET AJAX 1.0
Check you had install it? If not, you download it at ASP.NET AJAX 1.0 

4. If you using Ajaxcontrol toolkit
Download and install it at Ajaxcontrol toolkit

Try one solution or try all until you resolve an error!

No comments :

Post a Comment

[C#] How to fix "object reference not set to an instance of an object"

No comments
Oh! No...
When you coding with .Net. Many time you meet an error: "object reference not set to an instance of an object".
What happen???

Example 1: Convert null to int
string query = "Select * from USERS where ID = '" + txtUID.Text + "'";
SqlCommand cmd = new SqlCommand(query , CN);
int count = (int)cmd.ExecuteScalar();//Error here
What problem? ExecuteScalar return to null when record not found in database. In case, you can using Convert class
Convert.ToInt32(cmd.ExecuteScalar());//It will return 0 when ExecuteScalar() return null
Example 2: Try get object properties when this object is null
var str= null;
if(str!="")// Error here
{
//do some thing
}
Resolve the problem: You can try
var str= null;
if(str !=null && str!="")// Error here
{
//do some thing
}
Or try this
var str= null;
if(!String.IsNullOrEmpty(str))// Error here
{
//do some thing
}
Example: Very much error!
// About 10000 lines
Resole all with
try{
//All code here
}
catch (NullReferenceException ex)
        {
            ShowMessageBox("Error" + ex.Message);
        }

No comments :

Post a Comment