Tuesday, March 10, 2009

BCP function

You can use this BCP function easily to import/export from the MS SQL database.

usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character type]
[-N keep non-text native] [-V file format version] [-q quoted identifier]
[-C code page specifier] [-t field terminator] [-r row terminator]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values]
[-h "load hints"]

Here's an example to export the data from the database.
- with trusted connection
bcp "dbname.dbo.tablename" out "dev_tablename.bcp" -e error.log -c -S servername -T -k

- with username and password
bcp "dbname.dbo.tablename" out "dev_tablename.bcp" -e error.log -c -S servername -U username -P password -k


Here's an example to import the data to the database.
- with trusted connection
bcp "dbname.dbo.tablename" in "dev_tablename.bcp" -e error.log -c -S servername -T -k

- with username and password
bcp "dbname.dbo.tablename" in "dev_tablename.bcp" -e error.log -c -S servername -U username -P password -k

- with username and password and order clause
bcp "dbname.dbo.tablename" in "dev_tablename.bcp" -e error.log -c -S servername -U username -P password -k -h "ORDER (TheDate DESC)"

Monday, February 16, 2009

Select Nth Row

SQL Query:
SELECT TOP 1 name FROM (SELECT TOP 9 name FROM master..syslogins ORDER BY name ASC) sq ORDER BY name DESC -- gets 9th row

MSSQL Injection Cheat Sheet

Looping in MSSQL
declare @index integer
set @index = 0
while @index < 10
begin
select 'loop counter = ', @index
set @index = @index + 1
end

Friday, February 6, 2009

Find computer using IP

On command prompt we can type this:

NSLOOKUP

it will show the computer name.

Tuesday, February 3, 2009

Cannot delete file: cannot read from source file or disk


When we receive this kind of error what to do??
The files within this folder is somehow corrupted.
First step is to fix it.
1. Open command prompt (Start -> Run -> cmd)
2. Type chkdsk /F E:\
It will fixed by itself.

Thursday, January 8, 2009

PHP Get User Information

Class features:
* Get User Browser.
* Get User Operating System.
* Get User IP.
* Get User Country.
* Get User Referral + Search Engine.
* Get User Language.
* Check if Flash enabled.
* Check if JavaScript enabled.
* Check user speed (bandwidth).

Download the file.

Reference: here

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 134 bytes)

When you received this kind of error in PHP

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 134 bytes) in /home/www/domains/www.salzwimmer.at/html/gb/PYG.php on line 181


Here's how to resolve in xampp:
1. Enable the Rewrite module.
Open %XAMPP%\apache\conf\httpd.conf in notepad and search for mod_rewrite. You will find a line like:
#LoadModule rewrite_module modules/mod_rewrite.so

Remove the # from the beginning. It will now look:
LoadModule rewrite_module modules/mod_rewrite.so

Restart the Apache web server through XAMPP control panel.

2. Find php.ini in your folder
Change the memory_limit to 64M
Here are the files that I changed:
%XAMPP%\php\php.ini
and
%XAMPP%\apache\bin\php.ini

Find a line like:
memory_limit = 32M ; Maximum amount of memory a script may consume (16MB)

Change to
memory_limit = 64M ; Maximum amount of memory a script may consume (16MB)


Save the file and restart the Apache web server.
You should be able to resolve this error.

To check on the configuration:
1. Go to localhost/xampp
2. Click on the phpinfo()
3. Find for memory_limit
4. See if it's 64M instead of 32M

Friday, December 12, 2008

Sun Ray Effect

This is what I have been searching for long....
At last, i found it.


Click here to view the tutorial.