Thursday, May 03, 2007

Unrecognized attribute 'xmlns'.

this error actually means that the site is running old Framework version,
what you need to do is the following:
1.Open Internet Information Services and navigate to "Default Web Site" (or the site you're using as your default).
2.Right click the Site icon (the one with the globe).
3.Select the ASP.NET tab. You'll see a drop-down with the available versions (if you're getting the error, odds are, you'll see 1.1).
4.Select the proper build of ASP.NET 2.0 (or later, depends on the version you worked on in the developing stage).
5.Restart IIS.

Sunday, January 28, 2007

Change master web server in interdev Project

if you want to start using another web server for your asp projects which you created in interdev 6.0 then you need to change the master web that you set when you created the project.
to do that you should do those steps:
1. release your working copy:
right click on your project-> release working copy
2. on the upper toolbar (File Edit View...) choose Project -> Web Project -> Copy Web Application ... -> set the new server name and the directory you want to creat the project in, un check the Add to existing Web Project and the press OK.
3. now create a new project, in the 2nd stem, choose to use an existeing remote directory!

have a nice programming!

Tuesday, January 16, 2007

How to recognize google visit

do you want to know if this visit is a google visit??
here is a simple asp code to do that:
< % robot=request.ServerVariables("HTTP_USER_AGENT") if (Instr(robot,"Googlebot")<>0) then
...
end if
% >

and this is how to do it with php script

< ? define("SYSTEM_FROM_NAME","Your name"); define("SYSTEM_FROM_EMAIL","Your email"); //---this script will send email to webmaster when google visit your pages. if(isset($_SERVER['HTTP_USER_AGENT']) && eregi("googlebot",$_SERVER['HTTP_USER_AGENT'])) { if ($QUERY_STRING != "") { $url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].'?'.$QUERY_STRING; } else { $url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; } $today = date("F j, Y, g:i a"); $headers = "From: ".SYSTEM_FROM_NAME." <".SYSTEM_FROM_EMAIL.">";
$message="";
$message.="Googlebot is crawling your site:\n";
$message.="Page: $url\n";
$message.="Date: $today \n";
$message.="IP: ".$_SERVER['REMOTE_ADDR']." \n";
mail(SYSTEM_FROM_EMAIL, "googlebot crawle - $url", "$message",$headers);}
? >

Wednesday, November 29, 2006

connecting btrieve database with vb6

you have an old version of btrieve and you want to read data from it?? well, you'r luck if you read this message in the beginning of your search... i lost 3 days of intensive searching.. and finaly found it. and here i share it with you...
well, open vb program and bla bla bla ...
now you should define some consts for easy work:
i suggest you to create a separate modul for this code (that what i did)
DefInt A-Z
Global Const BOPEN = 0
Global Const BCLOSE = 1
Global Const BINSERT = 2
Global Const BUPDATE = 3
Global Const BDELETE = 4
Global Const BGETEQUAL = 5
Global Const BGETNEXT = 6
Global Const BGETGREATEROREQUAL = 9
Global Const BGETFIRST = 12
Global Const BCREATE = 14
Global Const BSTAT = 15
Global Const BSTOP = 25
Global Const BVERSION = 26
Global Const BRESET = 28
Global Const KEY_BUF_LEN = 255

Rem Key FlagsGlobal Const DUP = 1
Global Const MODIFIABLE = 2
Global Const BIN = 4
Global Const NUL = 8
Global Const SEGMENT = 16
Global Const SEQ = 32
Global Const DEC = 64
Global Const SUP = 128
Rem Key Types
Global Const EXTTYPE = 256
Global Const MANUAL = 512
Global Const BSTRING = 0
Global Const BINTEGER = 1
Global Const BFLOAT = 2
Global Const BDATE = 3
Global Const BTIME = 4
Global Const BDECIMAL = 5
Global Const BNUMERIC = 8
Global Const BZSTRING = 11
Global Const BAUTOINC = 15

' now declare the function BTRCALL with do all the I\O with the database
Private Declare Function BTRCALL Lib "wbtrv32.dll" (ByVal OP, ByVal Pb$, Db As Any, DL As Long, Kb As Any, ByVal Kl, ByVal Kn) As Integer

' define some data types for working with the database files
Type typ_byte4 f1(1 To 4) As ByteEnd TypeRem ***************************************************************************
Rem Btrieve Structures
Type KeySpec
KeyPos As Integer
KeyLen As Integer
KeyFlags As Integer
KeyTot As typ_byte4
KeyType As String * 1
Reserved As String * 5
End Type

Type FileSpec
RecLen As Integer
PageSize As Integer
IndxCnt As Integer
NotUsed As String * 4
FileFlags As Integer
Reserved As String * 2
Allocation As Integer
KeyBuf(0 To 1) As KeySpec
End Type

Type StatFileSpecs
RecLen As Integer
PageSize As Integer
IndexTot As Integer
RecTot As typ_byte4
FileFlags As Integer
Reserved As String * 2
UnusedPages As Integer
KeyBuf(0 To 1) As KeySpec
End Type

Type RecordBuffer
' here you should define the structure of the file that you are reading.. in this example i have 3 'fields, one is an id (int) description and another float type
'change this to your data structure
profID As Integer
profDesc As String * 28
profPrice As Double
End Type

Type VersionBuf
Major As Integer
Minor As Integer
Engine As String * 1
End Type

Type typ_PosBlk
f1(1 To 128) As Byte
End Type

' defining variables with the types we created
Global FileBuf As FileSpec
Global DataBuf As RecordBuffer
Global StatFileBuffer As StatFileSpecs
Global BufLen As Long
Global DBLen As Integer

Rem*******Added to Open multiple files
Public iMaxRuns As Integer
Public bFilesCreated As Boolean

Sub PrintLB(Item As String)
' function for printing data on screen
Dim fTxtFileName As String
BtrFrm32.List1.AddItem Item
Rem Added to write info to file
fTxtFileName = App.Path & "\" & App.EXEName & ".log"
Open fTxtFileName For Append As #1
Print #1, Item Close #1
Rem *************
End Sub

sub readDate()
PrintLB ("Btrieve Sample Test Started")
PrintLB ("")
Rem Local variables needed for conversion from byte to long.
Dim loc_RecTot As Long
Dim h_field1 As String
Dim h_field2 As String
Dim h_field3 As String
Dim h_field4 As String
Dim h_total As String
'Rem **************************
FileName$ = "XFACE.BTR"
PosBlk$ = Space$(128)KeyBuffer$ = Space$(KEY_BUF_LEN)
RemRem ***************** Btrieve Create *********************Rem
Rem ************* SET UP FILE SPECS
FileBuf.RecLen = 34
FileBuf.PageSize = 1024
FileBuf.IndxCnt = 2
FileBuf.FileFlags = 0
''Rem ************* SET UP KEY SPECS
FileBuf.KeyBuf(0).KeyPos = 1
FileBuf.KeyBuf(0).KeyLen = 8
FileBuf.KeyBuf(0).KeyFlags = EXTTYPE + MODIFIABLE
FileBuf.KeyBuf(0).KeyType = Chr$(BFLOAT)
FileBuf.KeyBuf(1).KeyPos = 9
FileBuf.KeyBuf(1).KeyLen = 26
FileBuf.KeyBuf(1).KeyFlags = EXTTYPE + MODIFIABLE + DUP
FileBuf.KeyBuf(1).KeyType = Chr$(BSTRING)

'Open File
KeyBufLen = KEY_BUF_LEN
KeyBuffer$ = txtFileName.txt
BufLen = Len(DataBuf)KeyNum = 0
Status = BTRCALL(BOPEN, PosBlk$, DataBuf, BufLen, ByVal KeyBuffer$, KeyBufLen, KeyNum)
If Status <> 0 Then
Msg$ = "Error Opening file! " + Str$(Status)
PrintLB (Msg$)
GoTo Fini
Else
Msg$ = "File Opened Successfully!" PrintLB (Msg$)
End If

BufLen = Len(DataBuf)
KeyBuffer$ = Space$(255)
KeyBufLen = KEY_BUF_LEN
'Status = BTRCALL(BGETFIRST, PosBlk$, DataBuf, BufLen, ByVal KeyBuffer$, KeyBufLen, 0)
If Status <> 0 Then
Msg$ = "Error on BGETFIRST. " + Str$(Status)
PrintLB (Msg$)
Else
Msg$ = "BGETFIRST okay for : " + DataBuf.profDesc PrintLB (Msg$)
End If
'Get Next Record
BufLen = Len(DataBuf)KeyBuffer$ = Space$(KEY_BUF_LEN)
KeyBufLen = KEY_BUF_LEN
Status = BTRCALL(BGETNEXT, PosBlk$, DataBuf, BufLen, ByVal KeyBuffer$, KeyBufLen, 0)
If Status <> 0 Then
Msg$ = "Error on BGETNEXT. " + Str$(Status)
PrintLB (Msg$)
Else
Msg$ = "BGETFIRST okay for : " + DataBuf.profDesc
PrintLB (Msg$)
End If


end sub

Thursday, November 23, 2006

Using Notify Icon Object

notifyIcon1.Icon = new System.Drawing.Icon(@"c:\1.ico");
notifyIcon1.Visible = true;
notifyIcon1.Text = "Test Notify Icon Demo";
notifyIcon1.BalloonTipTitle = "ByRamiX Product";
notifyIcon1.BalloonTipText = "This Product was programmed ByRamiX";
notifyIcon1.ShowBalloonTip(5000);

Tuesday, October 10, 2006

using the data base class

here we built a simple search engine that uses the batabase class that we built before


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace databasetest
{
///


/// Summary description for WebForm1.
///

public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DG1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button BtnSearch;
protected System.Web.UI.WebControls.TextBox txtSearchWord;
db db1;
private void Page_Load(object sender, System.EventArgs e)
{
db1=new db("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("database//freddydb.mdb"));
DG1.DataSource = db1.executeSQL("select * from users");
DG1.DataBind();
db1.closeDBCommand();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.BtnSearch.Click += new System.EventHandler(this.BtnSearch_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void BtnSearch_Click(object sender, System.EventArgs e)
{
try
{
if (txtSearchWord.Text.Trim()!="" )
{
DG1.DataSource = db1.executeSQL("select * from users where username like '"+txtSearchWord.Text+"%' or userfirstName like '"+txtSearchWord.Text+"%' or userLastName like '"+txtSearchWord.Text+"%'");
DG1.DataBind();
db1.closeDBCommand();
}
}
catch (Exception ex)
{
response.write (ex.Message);
}
}
}
}

connecting a database with c# / asp.net

this is the code of database connection and sql executing functions

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

///


/// data base class
///

public class db
{
OleDbConnection gDbConn;
OleDbCommand gDbCmd;
public string error;
public db(string connStr)
{
try
{
gDbCmd = new OleDbCommand();
gDbConn = new OleDbConnection();
gDbConn.ConnectionString = connStr;
error="class built successfully";
}
catch (Exception e)
{
error = "[class constructor] building class faild, error in connecting database error discribe: "+e.Message ;
}
}
public OleDbDataReader executeSQL(String sql)
{
try
{
OleDbDataReader rs ;
gDbConn.Open();
gDbCmd.Connection = gDbConn;
gDbCmd.CommandText = sql;
if (sql.Contains("select") )
rs = gDbCmd.ExecuteReader();
else
{
gDbCmd.ExecuteNonQuery();
rs = null;
}
error = "executeSQL executed successfully";
return rs;
}
catch(Exception e)
{
error = "[execute sql] failed to execute sql statement error discribe:" + e.Message
return null;
}
}
}

an example of using this class here: http://byramix.blogspot.com/2006/10/using-data-base-class.html