New Technologies

  • Java
  • Javascript
  • DTML
  • Dot Net
  • ASP .Net
  • C# .Net
  • PHP
Your Ad Here

Thursday, December 18, 2008

Got a packet bigger than 'max_allowed_packet' bytes mysql

 

set global max_allowed_packet=1000000000;
set global net_buffer_length=1000000;

set this from putty.

set-variable=record_buffer=16M

set this in my.cnf

 

Monday, December 15, 2008

Top 10 URLS

 

1 google.com 135M+ U.S. monthly people. The site attracts a more affluent, more educated audience.
2 yahoo.com 124M+ U.S. monthly people. The site appeals to a more educated crowd.
3 msn.com 91M+ U.S. monthly people. The site caters to a adult, more educated audience.
4 live.com 90M+ U.S. monthly people. The site appeals to a more educated crowd.
5 wikipedia.org 77M+ U.S. monthly people. The site is popular among a more educated, younger audience.
6 aol.com 75M+ U.S. monthly people. The site caters to a very slightly female biased, younger crowd.
7 youtube.com 70M+ U.S. monthly people. The site appeals to a more youthful following.
8 myspace.com 67M+ U.S. monthly people. The site is popular among a more female, teen and young adult audience.
9 microsoft.com 66M+ U.S. monthly people. The site attracts a skewing older audience.
10 ebay.com 59M+ U.S. monthly people. The site is popular among a more affluent, slightly male slanted, adult following.
11 amazon.com 46M+ U.S. monthly people. The site appeals to a more educated following.
12 facebook.com 45M+ U.S. monthly people. The site appeals to a more affluent, teen and young adult, very slightly female biased following.
13 about.com 45M+ U.S. monthly people. The site is popular among a very slightly female biased audience.
14 mapquest.com 45M+ U.S. monthly people. The site appeals to a slightly female slanted, more educated, more affluent group.
15 blogspot.com 43M+ U.S. monthly people. The site attracts a more educated following.
16 nextag.com 43M+ U.S. monthly people. The site is popular among a more affluent, more educated, skewing older audience.
17 craigslist.org 40M+ U.S. monthly people. The site attracts a very slightly male biased, fairly wealthy audience.
18 ask.com 39M+ U.S. monthly people. The site appeals to a slightly more female than male audience.
19 answers.com 37M+ U.S. monthly people. The site appeals to a more youthful, more educated following.
20 adobe.com 34M+ U.S. monthly people. The site attracts a slightly female slanted, skewing older audience.
21 photobucket.com 34M+ U.S. monthly people. The site appeals to a slightly more female than male, teen audience.
22 go.com 34M+ U.S. monthly people. The site appeals to a more affluent group.
23 reference.com 32M+ U.S. monthly people. The site caters to a teen, more educated audience.
24 wordpress.com 31M+ U.S. monthly people. The site is popular among a youthful crowd.
25 information.com 30M+ U.S. monthly people. The site is popular among a slightly female slanted crowd.
26 cnn.com 29M+ U.S. monthly people. The site attracts a more educated, rather male, fairly wealthy audience.
27 windows.com 29M+ U.S. monthly people. The site attracts a skewing older following.
28 walmart.com 26M+ U.S. monthly people. The site caters to a very slightly female biased audience.
29 paypal.com 26M+ U.S. monthly people. The site caters to a adult, fairly wealthy audience.
30 blogger.com 24M+ U.S. monthly people. The site caters to a more educated audience.
31 flickr.com 23M+ U.S. monthly people. The site appeals to a slightly male slanted audience.
32 att.com 22M+ U.S. monthly people. The site is popular among a very slightly female biased audience.
33 target.com 21M+ U.S. monthly people. The site appeals to a somewhat female audience.
34 imdb.com 21M+ U.S. monthly people.
35 comcast.net 21M+ U.S. monthly people. The site appeals to a more affluent, skewing older, very slightly female biased audience.
36 geocities.com 21M+ U.S. monthly people.
37 bizrate.com 20M+ U.S. monthly people. The site caters to a skewing older, more affluent audience.
38 bankofamerica.com 18M+ U.S. monthly people. The site attracts a adult, more affluent, more educated crowd.
39 yellowpages.com 18M+ U.S. monthly people. The site attracts a adult, rather female following.
40 smileycentral.com 17M+ U.S. monthly people. The site is popular among a younger, more female following.
41 webmd.com 16M+ U.S. monthly people. The site attracts a skewing older, more female audience.
42 nytimes.com 16M+ U.S. monthly people. The site appeals to a skewing older, fairly wealthy, very slightly male biased, more educated audience.
43 ehow.com 15M+ U.S. monthly people. The site attracts a slightly more female than male audience.
44 pbs.org 15M+ U.S. monthly people. The site caters to a more educated audience.
45 apple.com 15M+ U.S. monthly people. The site appeals to a younger, fairly wealthy, very slightly female biased group.
46 weather.com 15M+ U.S. monthly people. The site attracts a fairly wealthy, adult, more educated audience.
47 whitepages.com 14M+ U.S. monthly people. The site caters to a skewing older, very slightly female biased following.
48 yahoo.net 14M+ U.S. monthly people. The site attracts a more educated, more affluent, adult audience.
49 classmates.com 14M+ U.S. monthly people. The site is popular among a slightly more female than male, skewing older group.
50 nbc.com 14M+ U.S. monthly people. The site caters to a slightly female slanted crowd.
51 chase.com 14M+ U.S. monthly people. The site attracts a adult, slightly female slanted, more affluent, more educated audience.
52 careerbuilder.com 14M+ U.S. monthly people. The site is popular among a slightly female slanted group.
53 mywebsearch.com 14M+ U.S. monthly people. The site appeals to a largely female audience.
54 evite.com 13M+ U.S. monthly people. The site caters to a somewhat wealthy, more educated, very slightly female biased crowd.
55 monster.com 13M+ U.S. monthly people. The site caters to a very slightly female biased following.
56 capitalone.com 13M+ U.S. monthly people. The site is popular among a very slightly female biased, adult audience.
57 download.com 13M+ U.S. monthly people. The site is popular among a very slightly male biased audience.
58 usps.com 13M+ U.S. monthly people. The site caters to a adult, more educated following.
59 barackobama.com 13M+ U.S. monthly people. The site appeals to a more African American, fairly wealthy, skewing older, more educated, somewhat female crowd.
60 newsweek.com 12M+ U.S. monthly people. The site is popular among a fairly wealthy, more educated, slightly more male than female, skewing older following.
61 verizonwireless.com 12M+ U.S. monthly people. The site is popular among a slightly female slanted, fairly wealthy crowd.
62 bestbuy.com 12M+ U.S. monthly people. The site attracts a very slightly male biased crowd.
63 tripod.com 12M+ U.S. monthly people.
64 shopzilla.com 12M+ U.S. monthly people. The site appeals to a skewing older, slightly female slanted crowd.
65 wellsfargo.com 12M+ U.S. monthly people. The site appeals to a slightly female slanted crowd.
66 merriam-webster.com 12M+ U.S. monthly people. The site attracts a more educated, fairly wealthy audience.
67 hp.com 12M+ U.S. monthly people. The site attracts a skewing older audience.
68 metacafe.com 12M+ U.S. monthly people. The site appeals to a slightly male slanted, younger crowd.
69 comcast.com 12M+ U.S. monthly people. The site is popular among a adult, slightly female slanted, fairly wealthy audience.
70 linkedin.com 12M+ U.S. monthly people. The site caters to a very slightly male biased, middle aged, more affluent, more educated following.
71 digg.com 11M+ U.S. monthly people. The site appeals to a more male audience.
72 foxnews.com 11M+ U.S. monthly people. The site is popular among a fairly wealthy, more educated, slightly more male than female, skewing older audience.
73 reunion.com 11M+ U.S. monthly people. The site attracts a rather female, skewing older audience.
74 pronto.com 11M+ U.S. monthly people. The site appeals to a skewing older group.
75 typepad.com 11M+ U.S. monthly people. The site caters to a more educated, more affluent audience.
76 jcpenney.com 11M+ U.S. monthly people. The site appeals to a primarily female, skewing older following.
77 nih.gov 11M+ U.S. monthly people. The site appeals to a more educated, skewing older, somewhat female audience.
78 netflix.com 10M+ U.S. monthly people. The site caters to a adult, very slightly female biased, more educated audience.
79 wikimedia.org 10M+ U.S. monthly people. The site caters to a slightly more male than female, teen, more educated audience.
80 addresses.com 10M+ U.S. monthly people. The site appeals to a very slightly female biased, skewing older audience.
81 ups.com 10M+ U.S. monthly people. The site is popular among a adult, more affluent following.
82 symantec.com 10M+ U.S. monthly people. The site caters to a skewing older crowd.
83 smarter.com 10M+ U.S. monthly people. The site caters to a slightly more female than male, 50+ audience.
84 dell.com 10M+ U.S. monthly people. The site is popular among a skewing older, more educated audience.
85 ezinearticles.com 10.0M+ U.S. monthly people.
86 allrecipes.com 9.8M+ U.S. monthly people. The site caters to a mostly female group.
87 findstuff.com 9.8M+ U.S. monthly people. The site caters to a slightly female slanted audience.
88 time.com 9.8M+ U.S. monthly people. The site is popular among a somewhat male, more educated, more affluent, skewing older audience.
89 people.com 9.7M+ U.S. monthly people. The site caters to a more affluent, slightly female slanted crowd.
90 huffingtonpost.com 9.7M+ U.S. monthly people. The site attracts a more educated, middle aged, rather male, more affluent crowd.
91 gamespot.com 9.5M+ U.S. monthly people. The site appeals to a more male, teen audience.
92 washingtonpost.com 9.5M+ U.S. monthly people. The site appeals to a skewing older, fairly wealthy, slightly more male than female, more educated audience.
93 webcrawler.com 9.4M+ U.S. monthly people.
94 circuitcity.com 9.4M+ U.S. monthly people. The site attracts a adult audience.
95 job.com 9.3M+ U.S. monthly people. The site caters to a more African American, somewhat female group.
96 hulu.com 9.3M+ U.S. monthly people. The site caters to a slightly male slanted audience.
97 ticketmaster.com 9.0M+ U.S. monthly people. The site attracts a slightly female slanted, more affluent following.
98 overstock.com 9.0M+ U.S. monthly people. The site attracts a rather female, more affluent, skewing older following.
99 local.com 8.9M+ U.S. monthly people. The site caters to a skewing older, very slightly female biased audience.
100 nfl.com 8.9M+ U.S. monthly people. The site is popular among a more male, more affluent group.

Configuring Windows 2000 IIS for CGI

 

·  Install Windows Internet Information Server (IIS) (Windows XP screen shots)

  1. Start > Settings > Control Panel > Add/Remove Programs
  2. Add/Remove Windows Components

Check the box for Internet Information Server (IIS); click the “Details…” button to select IIS components:

Windows XP

These are the components I installed, however you should not need FTP or SMTP if you only want to test CGI scripts:

Windows XP

 

Windows XP

[TOP]


· 

Test the Server

  1. Assumptions:
    • %SystemDrive% = C: <!–
    • %SystemRoot% = C:\WINNT –>
    • %UserDomain% = LOCALHOST

Use the SET command in a Command Prompt window to check your settings.
Make applicable adjustments if %SystemDrive% or %UserDomain% have different values on your system.

  1. Create a simple HTML document in the default server directory.

server_test.html in the default server directory C:\Inetpub\wwwroot\

<html>
<head>
<title>Server Test</title>
<!-- server_test.html -->
</head>
<body>
The server is working
</body>
</html>
  1. Enter http://localhost/server_test.html in your browser to test the server

If the IIS is installed and working you should see your test document displayed in the browser:

Testing Internet Information Server (IIS)

 

 

·  [TOP]


· 

Install Perl

Download a current Perl binary distribution from www.activestate.com
The following are direct download links for ActiveState’s binaries for recent major versions of Perl. You may want to install more than one version depending on your need/desire to have a version compatible with the Perl you use on a Unix system.

Other ActiveState links:

See Introduction to Perl for additional information about installing ActivePerl and other Perl binary distributions on Windows operating systems.

[TOP]


· 

Configure the Server

  1. See assumptions under “Test the Server” and make adjustments as necessary
  2. You must be logged on as Administrator to configure IIS
  3. The default location for CGI scripts is C:\Inetpub\Scripts\
  4. The URL to access scripts is http://localhost/scripts/script_name
  5. Start > Settings > Control Panel > Administrative Tools   Internet Services  Manager
    Note: You may find it convenient to drag the Internet Services Manager menu item to the Desktop with the right mouse button and create a shortcut.
  6. Click on the “+” to expand *localhost in the left pane

Right-click and select Start or Stop as required to start or stop services.

Starting and Stopping localhost services

  1. You only need Default Web Site to test CGI scripts. For security reasons you probably want to stop the services except when you are testing scripts so your server is not open to the Internet if you have an “always on” connection.
  2.  

Click on Default Web Site in the left pane to expand all the items in the right pane; right-click on the Scripts folder and select Properties;

Click the “Create” button in the Virtual Directory tab so that the “Configuration” button is available (the “Create” button will change to “Remove”:

IIS Virtual Directory tab after clicking 'create'

  1. Click the “Configuration” button and look for Perl file extensions in the App Mappings tab (usually .pl and .plx)
    If you are using a Perl binary other than ActiveState, or if you installed ActivePerl from a ZIP file rather than the Windows installer, the extensions for Perl source files will probably not be present, in which case use the “Add” button to add a new mapping

Select the .pl extension and click the “Edit” button or, if no Perl extensions were listed, click the “Add” button.

Perl and Python extensions in the Virtual Directory App Mappings tab

Edit or Add a new Application Extension Mapping as follows:

Perl extensions in the Virtual Directory App Mappings tab

j.        Notes:

    • Edit the path to your Perl executable as required.
      You may have multiple Perl installations; edit the path to reflect the installation/version you are currently using.
    • The ActivePerl installation does not include the -T switch to perl.exe as shown; however it must be part of the command line if you use it in the shebang line in your scripts.
      If you are adding a new extension mapping be sure to include the -T switch.
    • If adding a new Application Extension Mapping be sure to enter the fields exactly as shown. Note in particular the arguments “%s” %s. I cannot find any definitive documentation for the syntax, but this is what works.

[TOP]


· 

Test the Server and CGI

  1.  

Create a simple Perl script named cgi_test.pl in C:\Inetpub\Scripts\ as follows:

#!/usr/bin/perl -T
# cgi_test.pl
 
use warnings;
 
print "content-type: text/html\n\n";
    # Important! extra blank line after header
print "CGI is working";
  1. Enter http://localhost/scripts/cgi_test.pl in your browser

If CGI and the Perl script are working you should see the following displayed in the browser:

Testing CGI

c.       Notes:

    • Under Windows and IIS the path information in the shebang line is not required or used;
      #!perl -T
      is perfectly valid.
    • However. if you are testing scripts that will ultimately be uploaded to a Unix server you may want to use the same shebang that your Unix server requires, such as
      #!/usr/bin/perl -T
      Windows will read the command line switches and ignore the path.

[TOP]


· 

Internet Services Manager “Run As” Shortcut

You want to be able to manage IIS, such as starting and stopping services, but do not want to log off your user account, log on as Administrator to do a simple task, then log off and back on to your user account again. And you definitely do not want to do your daily development work in the Administrator account.

You could navigate to Internet Services Manager via the Start Menu, press the shift key while right-clicking on the Internet Services Manager menu item, and get the “Run As” prompt; however, better to create a shortcut to do all that for you.

  1. From your normal user account create a shortcut to Internet Services Manager
  2. Start > Settings > Control Panel > Administrative Tools > Internet Services  Manager
  3. Holding down the right mouse button drag the Internet Services Manager menu item onto the Desktop and select “Create Shortcut(s) Here”

Right-click on the shortcut, select properties, and check the “Advanced” button.

Check “Run with different credentials”

Run with different credentials

When you use the shortcut you will be prompted for the user account and password to run the application. The default is Administrator, which is usually what you want.

Run As Other User

[TOP]


· 

Create new IIS Virtual Directory

You want to be able to create, add, and edit scripts, however you do not want to do your development work under the Administrator account; and you do not want to log out of your user account, log on as Administrator to copy files to the default scripts folder, then log back on to your user account. Solution: create a IIS Virtual Directory that is accessible from your user account.

  1. Open the Internet Services Manager snap-in and create a new Virtual Directory
  2. Right-click on Default Web Site in the left pane, select New > Virtual Directory
  3. Work through the Virtual Directory Creation Wizard

Choose a Virtual Directory Alias (this will be the path following the LOCALHOST domain: http://localhost/usr-cgi

Virtual Directory Alias

Choose a Web Site Content Directory where you have access from your normal user account.

Virtual Directory Creation

When you get to the Access Permissions step in the Wizard be sure to check the “Execute…” box in addition to the Read and Run boxes already checked by default.

Virtual Directory Access Permissions

  1. After you have created the new virtual directory you must also configure it just like the Default Directory above. See 4. Configure the Server above.

 

Three easy ways to optimize your MySQL queries

 

Any database programmer will tell you that in high-traffic database-driven applications, a single badly-designed SQL query can significantly impact the overall performance of your application. Not only does such a query consume more database time than it ideally should, but it can have an exponential effect on the performance of other application components.

Optimizing query performance is as much a black art as a science, as heavily dependent on the developer's intuition as on hard statistical performance data. Fortunately, databases likes MySQL come with some tools to aid the process, and this article discusses three of them briefly: using indexes, analyzing queries with EXPLAIN, and adjusting MySQL's internal configuration.

#1: Using indexes

MySQL allows you to index database tables, making it possible to quickly seek to records without performing a full table scan first and thus significantly speeding up query execution. You can have up to 16 indexes per table, and MySQL also supports multi-column indexes and full-text search indexes.

Adding an index to a table is as simple as calling the CREATE INDEX command and specifying the field(s) to index. Listing A shows you an example:

Listing A


mysql> CREATE INDEX idx_username ON users(username);
Query OK, 1 row affected (0.15 sec)
Records: 1  Duplicates: 0  Warnings: 0

Here, indexing the username field of the users table ensures that SELECT queries which reference this field in their WHERE or HAVING clause will run a little faster than in the pre-indexed state. You can check that the index was created (Listing B) with the SHOW INDEX command:

Listing B


mysql> SHOW INDEX FROM users;
--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name     | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| users |          1 | idx_username |            1 | username    | A         |      NULL |     NULL | NULL   | YES  | BTREE      |         |
--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
1 row in set (0.00 sec)

It's important to note that indexes are a double-edged sword. Indexing every field of a table is usually unnecessary, and is quite likely to slow things down significantly when inserting or updating data because of the additional work MySQL has to do to rebuild the index each time. On the other hand, avoiding indexes altogether isn't such a great idea either, because while this will speed up INSERTs, it will cause SELECT operations to slow down. There is thus always a trade-off to be made, and it's wise to consider what the primary function of the table will be (data retrieval or data edit) when designing the indexing system.

#2: Optimizing query performance

When analyzing query performance, it's also useful to consider the EXPLAIN keyword. This keyword, when placed in front of a SELECT query, describes how MySQL intends to execute the query and the number of rows it will need to process to successfully deliver a result set. To illustrate, consider the following simple example (Listing C):

Listing C


mysql> EXPLAIN SELECT city.name, city.district FROM city, country WHERE city.countrycode = country.code AND country.code = 'IND';
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------------+
| id | select_type | table   | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------------+
|  1 | SIMPLE      | country | const | PRIMARY       | PRIMARY | 3       | const |    1 | Using index |
|  1 | SIMPLE      | city    | ALL   | NULL          | NULL    | NULL    | NULL | 4079 | Using where |
+----+-------------+---------+-------+---------------+---------+---------+-------+------+-------------+
2 rows in set (0.00 sec)

Here, the query is structured as a join between two tables and the EXPLAIN keyword describes how MySQL will process the join. It should be clear the current design will require MySQL to process only one record in the country table (which is indexed) but all 4079 records in the city table (which isn't). This then suggests scope for improvement using other optimization tricks - for example, adding an index to the city table as follows (Listing D):

Listing D


mysql> CREATE INDEX idx_ccode ON city(countrycode);
Query OK, 4079 rows affected (0.15 sec)
Records: 4079  Duplicates: 0  Warnings: 0

And now, when you re-run the query with EXPLAIN, you'll see a noticeable improvement (Listing E):

Listing E


mysql> EXPLAIN SELECT city.name, city.district FROM city, country WHERE city.countrycode = country.code AND country.code = 'IND';
+----+-------------+---------+-------+---------------+-----------+---------+-------+------+-------------+
| id | select_type | table   | type  | possible_keys | key       | key_len | ref   | rows | Extra       |
+----+-------------+---------+-------+---------------+-----------+---------+-------+------+-------------+
|  1 | SIMPLE      | country | const | PRIMARY       | PRIMARY   | 3       | const |    1 | Using index |
|  1 | SIMPLE      | city    | ref   | idx_ccode     | idx_ccode | 3       | const |  333 | Using where |
+----+-------------+---------+-------+---------------+-----------+---------+-------+------+-------------+
2 rows in set (0.01 sec)

As this illustrates, MySQL now only needs to scan 333 records in the city table to produce a result set -- a reduction of almost 90 percent! Naturally, this translates into faster query execution time and more efficient usage of database resources.

#3: Adjusting internal variables

MySQL is so open that it's fairly easy to further fine-tune its default settings to obtain greater performance and stability. Some of the key variables that should be optimized are listed below.

  • Altering Index Buffer Size (key_buffer)
    This variable controls the size of the buffer used when handling table indices (both read and write operations). The MySQL manual recommends that this variable be increased "to as much as you can afford" to ensure you get the best performance on indexed tables, and recommends a value equivalent to about 25 percent of the total system memory. This is one of the more important MySQL configuration variables and if you're interested in optimizing and improving performance, trying different values for the key_buffer_size variable is a good place to start.
  • Altering Table Buffer Size (read_buffer_size)
    When a query requires a table to be scanned sequentially, MySQL allocates a memory buffer to this query. The read_buffer_size variable controls the size of this buffer. If you find that sequential scans are proceeding slowly, you can improve performance by increasing this value, and hence the size of the memory buffer.
  • Setting The Number Of Maximum Open Tables (table_cache)
    This variable controls the maximum number of tables MySQL can have open at any one time, and thus controls the server's ability to respond to incoming requests. This variable is closely related to the max_connections variables -- increasing this value allows MySQL to keep a larger number of tables open, just as increasing max_connections increases the number of allowed connections. Consider altering this value if you have a high-volume server which receives queries on multiple different databases and tables.
  • Deciding A Time Limit For Long Queries (long_query_time)
    MySQL comes with a so-called "slow query log", which automatically logs all queries that do not end within a particular time limit. This log is useful to track inefficient or misbehaving queries, and to find targets for optimization algorithms. The long_query_time variable controls this maximum time limit, in seconds.

The previous discussion should give you some insight into three tools you can use to analyze and optimize your SQL queries, and help you squeeze better performance out of your application. Go on and try them out -- and happy optimizing!

 

How to make Apache run ASP.NET / ASP.NET 2.0

Even worked with ASP.NET 2.0 Site !

Following are the instruction to make Asp.Net work under apache:

– Install Apache 2.0.54

– Install Mod_AspDotNet

– Add at the end of C:\Program Files\Apache Group\Apache2\conf\httpd.conf the following lines

#asp.net
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo

<IfModule mod_aspdotnet.cpp>
# Mount the ASP.NET /asp application
AspNetMount /SampleASP "c:/SampleASP"
#/SampleASP is the alias name for asp.net to execute
#"c:/SampleASP" is the actual execution of files/folders  in that location

# Map all requests for /asp to the application files
Alias /SampleASP "c:/SampleASP"
#maps /SampleASP request to "c:/SampleASP"
#now to get to the /SampleASP type http://localhost/SampleASP
#It'll redirect http://localhost/SampleASP to "c:/SampleASP"

# Allow asp.net scripts to be executed in the /SampleASP example
<Directory "c:/SampleASP">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex index.htm index.aspx
#default the index page to .htm and .aspx
</Directory>

# For all virtual ASP.NET webs, we need the aspnet_client files
# to serve the client-side helper scripts.
AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4

<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>
#asp.net

– Create a directory c:\SampleASP and insert in it the index.aspx

– Restart apache server :
Start-> Apache HTTP Server 2.0.54 ->
Control Apache Server -> Restart

– Open Explorer and navigate to http://localhost/SampleASP/index.aspx

If everything worked fine you should get a nice asp.net page working.

— index.aspx —

<%@ Page Language="VB" %>
<html>
<head>
<link rel="stylesheet"href="intro.css">
</head>
<body>
<center>
<form action="index.aspx" method="post">
<h3> Name: <input id="Name" type=text>
Category:  <select id="Category" size=1>
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>
</h3>
<input type=submit value="Lookup">
<p>
<% Dim I As Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Sample ASP.NET TEST</font> <br>
<% Next %>
</form>
</center>
</body>
</html>

 

Set Cron in Ubuntu (Linux)

What is Cron?

Cron is a daemon used for scheduling tasks to be executed at a certain time. Each user has a crontab file, allowing them to specify actions and times that they should be executed. There is also a system crontab, allowing tasks such as log rotation and locate database updating to be done regularly.

The following directions tell you how to set up scheduled tasks the traditional way using the command line, but it is much easier to use the Gnome Scheduled tasks tool in System –> Preferences

What is Crontab?

A crontab is a simple text file that holds a list of commands that are to be run at specified times. These commands, and their related run times, are controlled by the cron daemon and are executed in the system’s background. More information can be found by viewing the crontab’s man page.

Using Cron

To use cron, simply add entries to your crontab file.

Crontab Sections

Each of the sections is separated by a space, with the final section having one or more spaces in it. No spaces are allowed within Sections 1-5, only between them. Sections 1-5 are used to indicate when and how often you want the task to be executed. This is how a cron job is laid out:

minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command

01 04 1 1 1 /usr/bin/somedirectory/somecommand

The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January. An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used. Code:

01 04 * * * /usr/bin/somedirectory/somecommand

The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.

Comma-seperated values can be used to run more than one instance of a particular command within a time period. Dash-seperated values can be used to run a command continuously. Code:

01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand

The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.

The “/usr/bin/somedirectory/somecommand” text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved.

Crontab Options

  • The -l option causes the current crontab to be displayed on standard output.
  • The -r option causes the current crontab to be removed.
  • The -e option is used to edit the current crontab using the editor specified by the EDITOR environment variable.

After you exit from the editor, the modified crontab will be checked for accuracy and, if there are no errors, installed automatically. The file is stored in /var/spool/cron/crontabs but should only be edited via the crontab command.

Further Considerations

The above commands are stored in a crontab file belonging to your user account and executed with your level of permissions. If you want to regularly run a command requiring a greater level of permissions, set up a root crontab file using:

sudo crontab -e

Depending on the commands being run, you may need to expand the root users PATH variable by putting the following line at the top of their crontab file:

PATH=/usr/sbin:/usr/bin:/sbin:/bin

It is sensible to test that your cron jobs work as intended. One method for doing this is to set up the job to run a couple of minutes in the future and then check the results before finalising the timing. You may also find it useful to put the commands into script files that log their success or failure, eg:

echo "Nightly Backup Successful: $(date)" >> /tmp/mybackup.log

For more information, see the man pages for cron and crontab (man is detailed on the BasicCommands page). If your machine is regularly switched off, you may also be interested in at and anacron, which provide other approaches to scheduled tasks. For example, anacron offers simple system-wide directories for running commands hourly, daily, weekly, and monthly. Scripts to be executed in said times can be placed in /etc/cron.hourly/, /etc/cron.daily/, /etc/cron.weekly/, and /etc/cron.monthly/. All scripts in each directory are run as root, and a specific order to running the scripts can be specified by prefixing the scripts’ filenames with numbers (see the man page for run-parts for more details). Although the directories contain periods in their names, run-parts will not accept a file name containing one and will fail silently when encountering them (bug #38022). Either rename the file or use a symlink (without a period) to it instead.

Advanced Crontab

The Crontabs discussed above are user crontabs. Each of the above crontabs is associated with a user, even the system crontab which is associated with the root user. There are two other types of crontab.

Firstly, as mentioned above anacron uses the run-parts command and /etc/cron.hourly, /etc/cron.weekly, and /etc/cron.monthly directories. However anacron itself is invoked from the /etc/crontab file. This file could be used for other cron commands, but probably shouldn’t be. Here’s an example line from a ficticious /etc/crontab:

00 01 * * * rusty /home/rusty/rusty-list-files.sh

This would run Rusty’s command script as user rusty from his home directory. However, it is not usual to add commands to this file. While an experienced user should know about it, it is not recommended that you add anything to /etc/crontab. Apart from anything else, this could cause problem if the /etc/crontab file is affected by updates! Rusty could lose his command.

The second type of crontab is to be found in /etc/cron.d. Within the directory are small named crontabs. The directory is often used by packages, and the small crontabs allows a user to be associated with the commands in them.

Instead of adding a line to /etc/crontab which Rusty knows is not a good idea, Rusty might well add a file to /etc/cron.d with the name rusty, containing his cron line above. This would not be affected by updates but is a well known location.

When would you use these alternate crontab locations? Well, on a single user machine or a shared machine such as a school or college server, a user crontab would be the way to go. But in a large IT department, where several people might look after a server, then /etc/cron.d is probably the best place to install crontabs - it’s a central point and saves searching for them!

You may not need to look at /etc/crontab or /etc/cron.d, let alone edit them by hand. But an experienced user should perhaps know about them and that the packages that he/she installs may use these locations for their crontabs.

Tips

crontab -e uses the EDITOR environment variable. to change the editor to your own choice just set that. You may want to set EDITOR in you .bashrc because many commands use this variable. Let’s set the EDITOR to nano a very easy editor to use:

export EDITOR=nano

There are also files you can edit for system-wide cron jobs. The most common file is located at /etc/crontab, and this file follows a slightly different syntax than a normal crontab file. Since it is the base crontab that applies system-wide, you need to specify what user to run the job as; thus, the syntax is now:

minute(s) hour(s) day(s)_of_month month(s) day(s)_of_week user command

It is recommended, however, that you try to avoid using /etc/crontab unless you need the flexibility offered by it, or if you’d like to create your own simplified anacron-like system using run-parts for example. For all cron jobs that you want to have run under your own user account, you should stick with using crontab -e to edit your local cron jobs rather than editting the system-wide /etc/crontab.

It is possible to run gui applications via cronjobs. This can be done by telling cron which display to use.

00 06 * * * env DISPLAY=:0. gui_appname

The env DISPLAY=:0. portion will tell cron to use the current display (desktop) for the program “gui_appname”.

And if you have multiple monitors, don’t forget to specify on which one the program is to be run. For example, to run it on the first screen (default screen) use :

00 06 * * * env DISPLAY=:0.0 gui_appname

The env DISPLAY=:0.0 portion will tell cron to use the first screen of the current display for the program “gui_appname”.

Crontab Example

Below is an example of how to setup a crontab to run updatedb, which updates the slocate database: Open a term, type “crontab -e” (without the double quotes) and press enter. Type the following line, substituting the full path of the application you wish to run for the one shown below, into the editor:

45 04 * * * /usr/bin/updatedb

Save your changes and exit the editor.

Crontab will let you know if you made any mistakes. The crontab will be installed and begin running if there are no errors. That’s it. You now have a cronjob setup to run updatedb, which updates the slocate database, every morning at 4:45.

Note: The double-ampersand (&&) can also be used in the “command” section to run multiple commands consecutively.

45 04 * * * /usr/sbin/chkrootkit && /usr/bin/updatedb

The above example will run chkrootkit followed by updatedb at 4:45am daily - providing you have all listed apps installed.

 

Apache FOP- PDF RTF generation for JAVA

Apache FOP

Domain path: for examples and packages:

\\domain\JAVA\CODE LIBRARY\FOP_PDF_RTF_generationpackage

Introduction

Apache FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects (XSL-FO) and an output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PS, PCL, AFP, XML (area tree representation), Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF.

Render Diagram

A beta release of the latest version of FOP (0.95) is now available. After a short testing period it will become the third stable release after the large redesign effort and will implement a large subset of the XSL-FO Version 1.1 W3C Recommendation.

Support for each of the standard’s objects and properties is detailed in FOP Compliance. Download options include a precompiled version, source code, and many example files to get you started. Resources include links to XSL-FO introductions and many other useful references. A checklist for Getting Help will guide you toward maximizing the usefulness of FOP.

FOP is proud to be part of Apache’s XML Graphics project.

Demonstration

Formatting Diagram

This image is a demonstration of a real two page document. The xml data on the left is formatted into the two pages on the right. The document contains static areas that appear on every page, an external graphic, a footnote on the first page, and a table that goes across both pages.

FOP uses the standard XSL-FO file format as input, lays the content out into pages, then renders it to the requested output. One great advantage of using XSL-FO as input is that XSL-FO is itself an XML file, which means that it can be conveniently created from a variety of sources. The most common method is to convert semantic XML to XSL-FO, using an XSLT transformation.

FOP Objectives

The goals of the Apache FOP project are to deliver an XSL-FO to PDF formatter that is compliant to at least the Basic conformance level described in the W3C Recommendation from 05 December 2006, and that complies with the November 2001 Portable Document Format Specification (Version 1.4) from Adobe Systems.

Conformance to the XML 1.0 Recommendation, XSLT 1.0 Recommendation and the XML Namespaces Recommendation is understood. Other relevant documents, such as the XPath and XLink Working Drafts, are referenced as necessary. The FOP Project will attempt to use the latest version of evolving specifications.

 

(mysql.info)Command-line options

mysqld Command-line Options
---------------------------
 
`mysqld' accepts the following command-line options:
 
`--ansi'
     Use ANSI SQL syntax instead of MySQL syntax.  Note: ANSI mode.
 
`-b, --basedir=path'
     Path to installation directory. All paths are usually resolved
     relative to this.
 
`--big-tables'
     Allow big result sets by saving all temporary sets on file.  It
     solves most 'table full' errors, but also slows down the queries
     where in-memory tables would suffice.  Since Version 3.23.2, MySQL
     is able to solve it automatically by using memory for small
     temporary tables and switching to disk tables where necessary.
 
`--bind-address=IP'
     IP address to bind to.
 
`--character-sets-dir=path'
     Directory where character sets are.  Note: Character sets.
 
`--chroot=path'
     Chroot `mysqld' daemon during startup.  Recommended security
     measure. It will somewhat limit `LOAD DATA INFILE' and `SELECT ...
     INTO OUTFILE' though.
 
`--core-file'
     Write a core file if `mysqld' dies.  For some systems you must also
     specify `--core-file-size' to `safe_mysqld'. *Note `safe_mysqld':
     safe_mysqld.
 
`-h, --datadir=path'
     Path to the database root.
 
`--default-character-set=charset'
     Set the default character set.  Note: Character sets.
 
`--default-table-type=type'
     Set the default table type for tables.  Note: Table types.
 
`--debug[...]='
     If MySQL is configured with `--with-debug', you can use this
     option to get a trace file of what `mysqld' is doing.  Note:
     Making trace files.
 
`--delay-key-write-for-all-tables'
     Don't flush key buffers between writes for any `MyISAM' table.
     Note: Server parameters.
 
`--enable-locking'
     Enable system locking.  Note that if you use this option on a
     system which a not fully working lockd() (as on Linux) you will
     easily get mysqld to deadlock.
 
`--enable-named-pipe'
     Enable support for named pipes (only on NT/Win2000/XP).
 
`-T, --exit-info'
     This is a bit mask of different flags one can use for debugging the
     mysqld server;  One should not use this option if one doesn't know
     exactly what it does!
 
`--flush'
     Flush all changes to disk after each SQL command.  Normally MySQL
     only does a write of all changes to disk after each SQL command
     and lets the operating system handle the syncing to disk.  Note:
     Crashing.
 
`-?, --help'
     Display short help and exit.
 
`--init-file=file'
     Read SQL commands from this file at startup.
 
`-L, --language=...'
     Client error messages in given language.  May be given as a full
     path.  Note: Languages.
 
`-l, --log[=file]'
     Log connections and queries to file. Note: Query log.
 
`--log-isam[=file]'
     Log all ISAM/MyISAM changes to file (only used when debugging
     ISAM/MyISAM).
 
`--log-slow-queries[=file]'
     Log all queries that have taken more than `long_query_time'
     seconds to execute to file.  Note: Slow query log.
 
`--log-update[=file]'
     Log updates to `file.#' where `#' is a unique number if not given.
     Note: Update log.
 
`--log-long-format'
     Log some extra information to update log.  If you are using
     `--log-slow-queries' then queries that are not using indexes are
     logged to the slow query log.
 
`--low-priority-updates'
     Table-modifying operations (`INSERT'/`DELETE'/`UPDATE') will have
     lower priority than selects.  It can also be done via `{INSERT |
     REPLACE | UPDATE | DELETE} LOW_PRIORITY ...' to lower the priority
     of only one query, or by `SET OPTION SQL_LOW_PRIORITY_UPDATES=1'
     to change the priority in one thread.  Note: Table locking.
 
`--memlock'
     Lock the `mysqld' process in memory.  This works only if your
     system supports the `mlockall()' system call (like Solaris).  This
     may help if you have a problem where the operating system is
     causing `mysqld' to swap on disk.
 
`--myisam-recover [=option[,option...]]] where option is any combination'
     of `DEFAULT', `BACKUP', `FORCE' or `QUICK'.  You can also set this
     explicitely to `""' if you want to disable this option. If this
     option is used, `mysqld' will on open check if the table is marked
     as crashed or if if the table wasn't closed properly.  (The last
     option only works if you are running with `--skip-locking').  If
     this is the case `mysqld' will run check on the table. If the
     table was corrupted, `mysqld' will attempt to repair it.
 
     The following options affects how the repair works.
 
     DEFAULT              The same as not giving any option to
                                   `--myisam-recover'.
     BACKUP               If the data table was changed during recover,
                          save a                     backup of the
                          `table_name.MYD' data file as
                            `table_name-datetime.BAK'.
     FORCE                Run recover even if we will loose more than
                          one row                     from the .MYD file.
     QUICK                Don't check the rows in the table if there
                          isn't any                     delete blocks.
 
     Before a table is automatically repaired, MySQL will add a note
     about this in the error log.  If you want to be able to recover
     from most things without user intervention, you should use the
     options `BACKUP,FORCE'.  This will force a repair of a table even
     if some rows would be deleted, but it will keep the old data file
     as a backup so that you can later examine what happened.
 
`--pid-file=path'
     Path to pid file used by `safe_mysqld'.
 
`-P, --port=...'
     Port number to listen for TCP/IP connections.
 
`-o, --old-protocol'
     Use the 3.20 protocol for compatibility with some very old clients.
     *Note Upgrading-from-3.20::.
 
`--one-thread'
     Only use one thread (for debugging under Linux).  Note: Debugging
     server.
 
`-O, --set-variable var=option'
     Give a variable a value. `--help' lists variables.  You can find a
     full description for all variables in the `SHOW VARIABLES' section
     in this manual.  Note: SHOW VARIABLES.  The tuning server
     parameters section includes information of how to optimize these.
     Note: Server parameters.
 
`--safe-mode'
     Skip some optimize stages.  Implies `--skip-delay-key-write'.
 
`--safe-show-database'
     Don't show databases for which the user doesn't have any
     privileges.
 
`--safe-user-create'
     If this is enabled, a user can't create new users with the GRANT
     command, if the user doesn't have `INSERT' privilege to the
     `mysql.user' table or any column in this table.
 
`--skip-concurrent-insert'
     Turn off the ability to select and insert at the same time on
     `MyISAM' tables. (This is only to be used if you think you have
     found a bug in this feature).
 
`--skip-delay-key-write'
     Ignore the `delay_key_write' option for all tables.  Note: Server
     parameters.
 
`--skip-grant-tables'
     This option causes the server not to use the privilege system at
     all.  This gives everyone _full access_ to all databases!  (You
     can tell a running server to start using the grant tables again by
     executing `mysqladmin flush-privileges' or `mysqladmin reload'.)
 
`--skip-host-cache'
     Never use host name cache for faster name-ip resolution, but query
     DNS server on every connect instead.  Note: DNS.
 
`--skip-locking'
     Don't use system locking.  To use `isamchk' or `myisamchk' you must
     shut down the server.  Note: Stability.  Note that in MySQL
     Version 3.23 you can use `REPAIR' and `CHECK' to repair/check
     `MyISAM' tables.
 
`--skip-name-resolve'
     Hostnames are not resolved.  All `Host' column values in the grant
     tables must be IP numbers or `localhost'.  Note: DNS.
 
`--skip-networking'
     Don't listen for TCP/IP connections at all.  All interaction with
     `mysqld' must be made via Unix sockets.  This option is highly
     recommended for systems where only local requests are allowed.
     Note: DNS.
 
`--skip-new'
     Don't use new, possible wrong routines.  Implies
     `--skip-delay-key-write'.  This will also set default table type
     to `ISAM'.  Note: ISAM.
 
`--skip-symlink'
     Don't delete or rename files that a symlinked file in the data
     directory points to.
 
`--skip-safemalloc'
     If MySQL is configured with `--with-debug=full', all programs will
     check the memory for overruns for every memory allocation and
     memory freeing.  As this checking is very slow, you can avoid
     this, when you don't need memory checking, by using this option.
 
`--skip-show-database'
     Don't allow 'SHOW DATABASE' commands, unless the user has *process*
     privilege.
 
`--skip-stack-trace'
     Don't write stack traces.  This option is useful when you are
     running `mysqld' under a debugger. Note: Debugging server.
 
`--skip-thread-priority'
     Disable using thread priorities for faster response time.
 
`--socket=path'
     Socket file to use for local connections instead of default
     `/tmp/mysql.sock'.
 
`--sql-mode=option[,option[,option...]]'
     Option can be any combination of: `REAL_AS_FLOAT',
     `PIPES_AS_CONCAT', `ANSI_QUOTES', `IGNORE_SPACE', `SERIALIZE',
     `ONLY_FULL_GROUP_BY'.  It can also be empty (`""') if you want to
     reset this.
 
     By specifying all of the above options is same as using -ansi.
     With this option one can turn on only needed SQL modes. Note: ANSI
     mode.
 
`transaction-isolation= { READ-UNCOMMITTED | READ-COMMITTED | REPEATABLE-READ | SERIALIZABLE }'
     Sets the default transaction isolation level.  Note: SET
     TRANSACTION.
 
`-t, --tmpdir=path'
     Path for temporary files. It may be useful if your default `/tmp'
     directory resides on a partition too small to hold temporary
     tables.
 
`-u, --user=user_name'
     Run `mysqld' daemon as user `user_name'.  This option is
     _mandatory_ when starting `mysqld' as root.
 
`-V, --version'
     Output version information and exit.
 
`-W, --warnings'
     Print out warnings like `Aborted connection...' to the `.err' file.
     Note: Communication errors.

 

Your Ad Here