Archive

Archive for November, 2008

Add new record at identity Off

November 24, 2008 ppshein Leave a comment

Today, I was kinda disappointed. Because, the project I got hand-over from my colleague have some SQL error. The case is our customer wanted to add new record to this table; and she set ID of this table as Identity OFF and not set identity. That’s why our customer cannot add new record to this table. That’s why I kept reserching how to add new record to this table. But, I have found one solution.

ET IDENTITY_INSERT myTable ON; INSERT INTO myTable (myId, myCol1)
VALUES (@myId, @myCol1); SELECT myId, myCol1 FROM myTable WHERE (myId =
@@IDENTITY); SET IDENTITY_INSERT myTable OFF;

But it cannot solve my problem. Anyway, I get valuable solution for future.

Categories: Informations, MSSQL Tags: ,

Microsoft Sharepoint

November 17, 2008 ppshein Leave a comment

In these days, my boss urge me to test microsoft sharepoint server for doing customize. As we all know, sharepoint program is written by asp.net (C#). If you don’t know asp.net well, we cannot modify anything except stylesheet. If you wanna modify anything at sharepoint, you must have microsoft sharepoint designer. If you don’t have, you can do nothing at there.

Categories: Informations Tags: ,

Check valid Email with Javascript

November 14, 2008 ppshein Leave a comment

Sometimes, I need to write hotel reservation form with PHP. Honestly, it’s kinda simple and not rush at all. But our major challenge is spam bots, and think about how to prevent nobody can send spam message to our reservation form. For this case, we can prevent in only 2 way. 1) is Image Captcha and 2) is check referer page. For 2) solution is here.

$path_parts = pathinfo($_SERVER['HTTP_REFERER']);
if($path_parts['basename'] == “reservation.html”)

For email validation, we don’t need to feel complicated. And, we don’t want our mail server will be over-loaded for the case of invalid email address. How to prevent? Don’t worry.

Write following code between <head></head>

<script language = “Javascript”>

function echeck(str) {

var at=”@”
var dot=”.”
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert(“Invalid E-mail ID”)
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert(“Invalid E-mail ID”)
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert(“Invalid E-mail ID”)
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert(“Invalid E-mail ID”)
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert(“Invalid E-mail ID”)
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert(“Invalid E-mail ID”)
return false
}

if (str.indexOf(” “)!=-1){
alert(“Invalid E-mail ID”)
return false
}

return true
}

function ValidateForm(){
var emailID=document.frmSample.txtEmail

if ((emailID.value==null)||(emailID.value==”")){
alert(“Please Enter your Email ID”)
emailID.focus()
return false
}
if (echeck(emailID.value)==false){
emailID.value=”"
emailID.focus()
return false
}
return true
}
</script>

Write this code below of <body>

<form name=”frmSample” method=”post” action=”#” onSubmit=”return ValidateForm()”>
<p>Enter an Email Address :
<input type=”text” name=”txtEmail”>
</p>
<p>
<input type=”submit” name=”Submit” value=”Submit”>
</p>
</form>

Categories: Javascript Tags: , ,

Image Navigation with javascript

November 7, 2008 ppshein Leave a comment

New featured section called Planet Wedding 2008 has Image gallery section. As I told in previous posts, I’ve created such new featured section with database less theory. For image gallery, I gotta set image navigation button such as next | previous. Database less theory, it’s too hard to put this navigation link in this section.

Fortunately, I’ve an idea to create this with javascript. It’s neither quite simple nor complicated. Here is javascript coding.

Put following code in JS file.

which_image_loaded = 0;
NUMBER_OF_IMAGES = 8; //number of your image

ImageNames = new Object();
ImageNames.length = NUMBER_OF_IMAGES – 1;

for (counter = 0; counter < NUMBER_OF_IMAGES; counter++)
{
file_number = counter + 1;
filename = (“[your_directory_path]” + file_number + “.jpg”);
ImageNames[counter] = filename;
}

function changeImage(direction)
{
which_image_loaded += direction;
if (which_image_loaded < 0)
{
which_image_loaded = NUMBER_OF_IMAGES – 1;
}

if (which_image_loaded == NUMBER_OF_IMAGES)
{
which_image_loaded = 0;
}

if (document.images)
{
document.SlideShow.src = ImageNames[which_image_loaded];
}

}

Put following code in your HTML file.

<div>
<img src=”thumbnail/1.jpg” name=”SlideShow” border=”0″>
</div>
<div><a href=”javascript:changeImage(-1)”>Previous Image</a> |  <a href=”javascript:changeImage(1)”>Next Image</a></div>

If you want to use this coding, you must do these two following instruction-

  • The file name of images must be numeric and order format like (1.jpg, 2.jpg, 3.jpg, 4.jpg….).
  • All of images must be in the same directory of the same folder.
Categories: Javascript Tags: ,

How do you think of ppshein.wordpress.com?

November 6, 2008 ppshein Leave a comment

I would like to know whether some of articles in my blog are useful for you or not. That’s why I want to survey. Please vote it.

Categories: Informations Tags: ,

Planet Wedding 2008

November 6, 2008 ppshein Leave a comment

Planet Myanmar is going to launch Wedding 2008 section. But, this section is under construction and not launched officially yet. Like old sections, it has Songs section, Articles sections, Blog sections, Guide sections and so on. You can write your own articles and blogs in this page.

Planet Wedding 2008

Planet Wedding 2008

Categories: Informations Tags: , ,