MS SQL Create Table
October 31, 2007
MS SQL Drop All table
October 31, 2007
I deleted all table in ms sql with:
exec sp_MSforeachtable “DROP TABLE ? PRINT ‘? dropped’ “
very useful if you want to create new table.
And then used the following statements to drop procedures:
create procedure DropSPViews
as
– variable to object name
declare @name varchar(100)
– variable to hold object type
declare @xtype char(1)
– variable to hold sql string
declare @sqlstring nvarchar(1000)
declare SPViews_cursor cursor for
SELECT sysobjects.name, sysobjects.xtype
FROM sysobjects
join sysusers on sysobjects.uid = sysusers.uid
where OBJECTPROPERTY(sysobjects.id, N’IsProcedure’) = 1
or OBJECTPROPERTY(sysobjects.id, N’IsView’) = 1 and sysusers.name =
‘USERNAME’
open SPViews_cursor
fetch next from SPViews_cursor into @name, @xtype
while @@fetch_status = 0
begin
– test object type if it is a stored procedure
if @xtype = ‘P’
begin
set @sqlstring = ‘drop procedure ‘ + @name
exec sp_executesql @sqlstring
set @sqlstring = ‘ ‘
end
– test object type if it is a view
if @xtype = ‘V’
begin
set @sqlstring = ‘drop view ‘ + @name
exec sp_executesql @sqlstring
set @sqlstring = ‘ ‘
end
– get next record
fetch next from SPViews_cursor into @name, @xtype
end
close SPViews_cursor
deallocate SPViews_cursor
original source
Hide / Unhide in JavaScript
October 30, 2007
this will give the basic on how to hide / unhide <div> tag :
Put this script in <head> section:
<SCRIPT TYPE=”text/javascript”>
<!–
function my_papar(nama_element)
{
var myElement = document.getElementById(nama_element);
if(myElement.style.visibility == “hidden”) {
myElement.style.position = “absolute”;
myElement.style.visibility = “visible”;
} else {
myElement.style.position = “absolute”;
myElement.style.visibility = “hidden”;
}
}
function my_hide(nama_element)
{
var c = nama_element;
c = setTimeout(“document.getElementById(‘”+c+”‘).style.visibility = ‘hidden’”, 333);
}
//–>
</SCRIPT>
<body>
<input type=”button” onclick=”my_papar(‘myapit_hide_field’);” value=”Klik Sini”>
<div id=”myapit_hide_field” style=”position: absolute; visibility: hidden;”>
<table><tr>
<td>http://myapit.wordpress.com</td>
</tr></table>
</div>
<ul>
<li><a href=”#” onmouseover=”my_papar(‘menu_satu’);”
onmouseout=”my_hide(‘menu_satu’);”> Menu1</a></li>
<div id=”menu_satu” style=”position: absolute; visibility: hidden;”><br/>
<table><tr>
<td>http://myapit.wordpress.com</td>
</tr></table>
</div>
<li>Menu2</li>
</ul>
</body>
save as “testjs.html” and try click on that button.
good luck.
– by apit
Today’s Idiom(s) / Proverb(s)
October 30, 2007
All that glitters is not gold – Do not be deceived by things or offers that appear to be attractive.
Birds of a feather flock together – People of the same sort of character or belief always go together.
Between the devil and the deep sea – To choose between two equally bad alternatives in a serious dilemma.
Where there’s a will there’s a way – When a person really wants to do something, he will find a way of doing it.
Give the devil his due – Be just and fair-minded , even to the one who does not deserve much or who is unfriendly or unfair; we should punish a person according to his wrongdoings.
“actions speak louder than words” – we learn more from people’s actions than from their words .
“the devil is in the details” - the difficult part is in the many small details …
“rome was not built in one day” – all great works take time to finish …
“a wolf in sheep’s clothing” – a “dangerous” person pretending to be harmless.
“bite your tongue” – to keep yourself quiet and not say what you want to say.
“get up on the wrong side of the bed” – When you have been having a bad day all day.
“the pot calling the kettle black” – You are the pot calling the kettle black when you point to another person and accuse that person of doing something that you are guilty of doing yourself.
“don’t count your chickens (until they’ve hatched)” – means that you can hope certain things happen in the future, but you cannot know for sure that they will happen until they actually do happen.
“beating a dead horse” – when you insist on talking about something that cannot be changed.
“crying wolf” – to call for help when you are not really in danger.
Create Date Based Directory
October 29, 2007
this bat file is use full when u r someone like me ( an unorganize person
)
open notepad and type this code :
@echo off
cls
echo *************************
echo * Cipta Direktori *
echo *************************
Set mm=%DATE:~4,2%
Set dd=%DATE:~7,2%
Set yyyy=%DATE:~10,4%
Set masa=%TIME:~0,2%
set masa2=%TIME:~3,2%
mkdir %yyyy%-%mm%-%dd%-%masa%.%masa2%
echo ….. Berjaya ……
echo [ Nama dir: %yyyy%-%mm%-%dd%-%masa%.%masa2% ]
pause
save as “ciptadir.bat“
double click it to make a directory based on current date.
testes on windows xp & windows Server 2003
–by apit
php log function
October 22, 2007
![]()
Here is the log function that i use in my application(s):
<?php
/*
$handle = fopen(“file.txt”, “r”);
$handle = fopen(“file.gif”, “wb”);
$handle = fopen(“http://www.google.com/”, “r”);
$handle = fopen(“ftp://user:password@example.com/somefile.txt”, “w”);*/
$ip = $_SERVER['REMOTE_ADDR'];
$date = date(“Y-m-d h:ia”);
$txtlog = “log.txt”;
//$page = “”;//$_SERVER[PHP_SELF];
//$page .= $_SERVER['HTTP_REFERER'];
$page = $_SERVER['REQUEST_URI'];
if(is_writable($txtlog)) {
$fp = fopen($txtlog, “a+”);// or die(“Error occured while opening file.”);
//$filedata = fread($fp, filesize($txtlog));
$mystr = “$ip|$date|$page\n”;
//rewind($fp);
fwrite($fp, $mystr);
fclose($fp);
} else {
$fp = fopen(“log.txt”,“a+”);
fclose($fp);
}
?>
– by apit
MySQL load data in file
October 21, 2007
google search technique …
October 21, 2007
————————-
googler
————————-
intitle:text_here
allintitle:text_here
inurl:text_here
site:keyword_site_here
filetype:doc
link:www.myapit.tk
related:www.myapit.mil
cache:www.myapit.mil — looking in google cache
intext:”i hate bill gates”
ok..
you must combine all this technique in order to get the best and accurate search result
examples:
“Index of /”+passwd
“Index of /myapit”
inurl:”wwwroot/”*.”
inurl:edu filetype:xls “markah_exam”
index of ftp + .mdb allinurl:/cgi-bin/blablabla
“Index of /”+ myr OR myR
– by apit
php COM example
October 21, 2007
open notepad and type this :
<?php
$shell = new Com(“Wscript.shell”);
$shell->Run(“notepad.exe”);
$shell = null;
?>
this script will open notepad.exe in server… hmmm
modified it to meet ur requirement
-by apit


