Friday, September 3, 2010

Php Projects

As a php web developer, you should know that php is probably the language that has the biggest code repository. So no matter what module you want to include in your project there should be an open source solution.
This can help in various ways, but just in case you can’t think of one, here I put a few :
  • Open source is worked by many people, so the result is for sure better than one man’s work
  • You can have free updates to your code, while otherwise you should code the updates each time something new comes up
  • You save development time while your project is getting better
Anyway, after many years as a web developer, I’ve compiled a list of php classes that can be easily integrated in any project and I am regularly use.
Sending Emails
Sending emails is something very common for every web site. Php’s mail() function is good for this, but what if you want to attach a file, or send through an SMTP server, etc? Well in that case you should use phpmailer
User Manipulation
Another common module is the user module. With that you can manipulate users (login, logout, register, etc.) Personally I’ve never found a project that is good enough, so I created my own
Php user class is a module that can be used even in established projects, as it uses variable data for database tables, fields, session variables, etc.
Fetching RSS Feeds
Ever wanted to fetch an rss feed from your project? Well there is always an easy way to fetch a feed but in most cases you need more than that. When that is the case you should definitely use Magpie RSS
Geotargeting
There are many times that you need to know where are your visitors coming from. Maxmind gives a solution to this. For a complete tutorial check this article
Grabbing Remote Content
Some times RSS is not enough so you need to grab the content of a web page and parse it. If you are a huge fun of preg you should not continue reading, but if you are not you definitely need the htmlSQL class The htmlSQL class allow you to access html values with SQL code. Nice huh?
Trackback
Sending and receiving trackbacks is vital for a web site in our age. And in fact it is very easy if you are using a class like php trackback
Template System
Another thing that all sites use is a template. A template engine can save you lots of time, while it can make display changes very easy. A complete template engine that most projects use is Smarty
BBcode
BBcode used to be a functionality for forums, but as more and more sites use it in order to be more friendly to their users, you might want to use BBcode to your site. The problem is that BBcode requires a lot of coding and I am not sure if you have the time for this. If you don’t you’ll find StringParser_BBcode class very useful
Paypal Payment Integration
As you may know paypal has a nice API for developers who want to integrate paypal payments in their sites. The paypal IPN integration class helps you make use of it and start accepting payments in 20 minutes.
Editor Controls
I don’t have a problem to make changes to a site using phpMyAdmin or a simple text area, but when it comes to my clients I have to give them more than that. A javascript WYSIWYG editor is a perfect solution but as it requires countless hours to get it done I would suggest you to use the tinyMCE control
Hope you enjoyed this list. If I forgot something feel free to comment above

Thursday, September 2, 2010

Php Manual

Preface

PHP, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Its syntax draws upon C, Java, and Perl, and is easy to learn. The main goal of the language is to allow web developers to write dynamically generated web pages quickly, but you can do much more with PHP.
This manual consists primarily of a function reference, but also contains a language reference, explanations of some of PHP's major features, and other supplemental information.
You can download this manual in several formats at » http://www.php.net/download-docs.php. More information about how this manual is developed can be found in the 'About the manual' appendix. If you are interested in the history of PHP, visit the relevant appendix.

Authors and Contributors

We highlight the currently most active people on front page of the manual, but there are many more contributors who currently help in our work or have provided a great amount of help to the project in the past. There are a lot of unnamed people who help out with user notes on manual pages, which continually get included in the references, the work of whom we are also very thankful for. All of the lists provided below are in alphabetical order.

Authors and Editors

The following contributors should be recognized for the impact they have made and/or continue to make by adding content to the manual: Bill Abt, Jouni Ahto, Alexander Aulbach, Daniel Beckham, Stig Bakken, Nilgün Belma Bugüner, Jesus M. Castagnetto, Ron Chmara, Sean Coates, John Coggeshall, Simone Cortesi, Peter Cowburn, Daniel Egeberg, Markus Fischer, Wez Furlong, Sara Golemon, Rui Hirokawa, Brad House, Pierre-Alain Joye, Etienne Kneuss, Moriyoshi Koizumi, Rasmus Lerdorf, Andrew Lindeman, Stanislav Malyshev, Rafael Martinez, Rick McGuire, Kalle Sommer Nielsen, Yasuo Ohgaki, Richard Quadling, Derick Rethans, Rob Richards, Sander Roobol, Egon Schmid, Thomas Schoefbeck, Sascha Schumann, Dan Scott, Masahiro Takagi, Yannick Torres, Michael Wallner, Lars Torben Wilson, Jim Winstead, Jeroen van Wolffelaar and Andrei Zmievski.
The following contributors have done significant work editing the manual: Stig Bakken, Gabor Hojtsy, Hartmut Holzgraefe and Egon Schmid.

User Note Maintainers

The currently most active maintainers are: Daniel Brown, Nuno Lopes, Felipe Pena, Thiago Pojda and Maciek Sokolewicz.
These people have also put a lot of effort into managing user notes: Mehdi Achour, Daniel Beckham, Friedhelm Betz, Victor Boivie, Jesus M. Castagnetto, Nicolas Chaillan, Ron Chmara, Sean Coates, James Cox, Vincent Gevers, Sara Golemon, Zak Greant, Szabolcs Heilig, Oliver Hinckel, Hartmut Holzgraefe, Etienne Kneuss, Rasmus Lerdorf, Matthew Li, Andrew Lindeman, Aidan Lister, Hannes Magnusson, Maxim Maletsky, Bobby Matthis, James Moore, Philip Olson, Sebastian Picklum, Derick Rethans, Sander Roobol, Damien Seguy, Jason Sheets, Tom Sommer, Jani Taskinen, Yasuo Ohgaki, Jakub Vrana, Lars Torben Wilson, Jim Winstead, Jared Wyles and Jeroen van Wolffelaar.

Tuesday, August 31, 2010

Php Language

I. What is PHP? * PHP is an open-source server-side scripting language (freely downloadable from php.net and zend.com). PHP version 5.2.14 is available on Webserve (www.indiana.edu, www.iupui.edu, www.iun.edu, and www.iuk.edu). * You can create dynamic web pages with the PHP scripting language. A dynamic Web page interacts with the user, so that each user visiting the page sees customized information. PHP can also be used to create dynamic web pages that are generated from information accessed from a MySQL database. * You can embed PHP commands within a standard HTML page. PHP's syntax is similar to that of C and Perl, making it easy to learn for anyone with basic programming skills. * Another feature that PHP offers is connectivity to most of the common databases. PHP also offers integration with various external libraries, which allow the developer to do anything from generating PDF documents to parsing XML. Return to Top II. Using PHP on Webserve 1. Bang lines are not required and will be ignored if present. (This information is provided for historical purposes as the previous web server environment required bang lines.) 2. You should use .php as the file extension. This refers to only PHP files executed directly via a URL. Include files may use other extensions, such as .inc. If you have PHP files that currently use .php4 extensions, it is strongly recommended that you move toward using .php for these instead. 3. The script must have owner execute permission. For best security, we strongly recommend using permissions set to 700 (only owner has read, write, and execute privileges). For example, where "script.php" is the name of the file containing the script, change the file permission as follows. chmod 700 script.php Return to Top III. Using Sessions in the Webserve Environment By default, when PHP creates a session file it stores it in /tmp. In the Webserve environment, however, you should create a session directory in the login of your account and write the session information there. You will need to do occasional cleanup of any unused session files in your account that aren't deleted. Doing it this way will guarantee session persistence and will prevent potential server issues as a result of filling up /tmp. The specifics of how writing session files to /tmp can impact session persistence in the Webserve environment is provided below. As indicated above, when PHP creates a session file, the default behavior is to store it in /tmp. The /tmp directory is local and independent to each of the backend web servers. Hence, if a request is made to server_1, it stores the session file in its own /tmp. If a subsequent request for the same user ends up going to server_2, it won't find the original session file. The load balancers control how web requests are distributed across the backend web servers. These load balancers are configured to provide session persistence by tracking the IP address of the web browser and the backend web server to which a request is sent. The goal is to send all subsequent requests from a given web browser back to the same backend web server. As a result, normally the PHP session files in /tmp work as expected because the multiple requests for the same user is consistently sent to the same backend web server. However, the load balancers can only cache so much data and eventually older data is overwritten by new incoming requests. This can cause the loss of persistence information. Since PHP allows you to specify the location of the session files (i.e., other than /tmp) you should be sure to create a session directory in the login of your account and write session information there. Doing this will require you to periodically do cleanup of unused session files that are not deleted. Return to Top IV. Troubleshooting When running your scripts, if you receive a 500 Internal Server Error message, please check the following: 1. Check to make sure the file permission is set to 700 (read, write, and execute for owner only). 2. Check the Directory (folder) permission. Setting it to 777 will give you a 500 - Internal Server Error. Set it to 711. 3. When the file/directory permissions are set correctly, and you are still getting a 500 error, it is likely due to line compatibility between the program used to create/upload the file and the Linux server. To correct this, login to the account on Webserve via an SSH client that provides a command line interface and do the following: 1. Move to the directory where your php file is using the 'cd' command (e.g., cd www). 2. Open the file using an editor such as nano and save it by typing Ctrl + o This simple steps may solve your problem because it converts Windows CR/LF (carriage return/line feed) to Unix LF (line feed) or Mac CR to Unix LF. To prevent this problem, you need to change settings/preferences in the program you are using to develop php files. To set preferences in Dreamweaver, go to Edit => Preferences. Select Code Format or HTML Format (depending on the versions). Change Line Breaks to LF (Unix). Return to Top V. Sample PHP Code Place a file containing the code below inside the www directory of your Webserve account and save it as info.php To view the file, you would then provide the web site address to the file. For example: http://www.indiana.edu/~myaccount/info.php It will output information about the current state of PHP, which includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License. Because every system is setup differently, phpinfo() can be used to check configuration settings and for available predefined variables on a given system . For more information see php.net's entry for phpinfo. Return to Top VI. Increasing the Memory Limit You can increase the memory limit with a php.ini file in the same directory as your php script. If you have multiple subdirectories, you will need to place the php.ini file in each subdirectory that has php scripts. In that php.ini file you can specify the memory_limit you wish to set by using: memory_limit = whatever integer you wish You can verify the memory_limit has changed by creating a php info file.

Saturday, August 28, 2010

Asp.net Interview Questions


#61607; .NET

- Difference between asp and asp.net
- How do you do exception management
- If you are using components in your application, how can you handle exceptions raised in a component
- Can we throw exception from catch block
- How do you relate an aspx page with its code behind page
- What are the types of assemblies and where can u store them and how
- What is difference between value and reference types
- Is array reference type / value type
- Is string reference type / value type
- What is web.config. How many web.config files can be allowed to use in an application
- What is differnce between machine.config and web.config
- What is shared and private assembly
- What are asynchronous callbacks
- How to write unmanaged code and how to identify whether the code is managed / unmanaged.
- How to authenticate users using web.config
- What is strong name and which tool is used for this
- What is gacutil.exe. Where do we store assemblies
- Should sn.exe be used before gacutil.exe
- What does assemblyinfo.cs file consists of
- What is boxing and unboxing
- Types of authentications in ASP.NET
- difference between Trace and Debug
- Difference between Dataset and DataReader
- What is custom tag in web.config
- How do you define authentication in web.Config
- What is sequence of code in retrieving data from database
- About DTS package
- What provider ADO.net use by default
- Where does web.config info stored? Will this be stored in the registry?
- How do you register the dotnet component or assembly?
- Difference between asp and asp.net
- Whis is stateless asp or asp.net?
- Authentication mechanism in dotnet
- State management in asp.net
- Types of values mode can hold session state in web.config
- About WebService
- What are Http handler
- What is view state and how this can be done and was this there in asp?
- Types of optimization and name a few and how do u do?
- About DataAdapters
- Features of a dataset
- How do you do role based security
- Difference between Response.Expires and Expires.Absolute
- Types of object in asp
- About duration in caching technique
- Types of configuration files and ther differences
- Difference between ADO and ADO.net
- About Postback
- If you are calling three SPs from a window application how do u check for the performance of the SPS

Tuesday, August 24, 2010

.NET Architecture


Most applications need data access at one point of time making it a crucial component when working with applications. Data access is making the application interact with a database, where all the data is stored. Different applications have different requirements for database access. VB .NET uses ADO .NET (Active X Data Object) as it's data access and manipulation protocol which also enables us to work with data on the Internet. Let's take a look why ADO .NET came into picture replacing ADO.

Evolution of ADO.NET

The first data access model, DAO (data access model) was created for local databases with the built-in Jet engine which had performance and functionality issues. Next came RDO (Remote Data Object) and ADO (Active Data Object) which were designed for Client Server architectures but, soon ADO took over RDO. ADO was a good architecture but as the language changes so is the technology. With ADO, all the data is contained in a recordset object which had problems when implemented on the network and penetrating firewalls. ADO was a connected data access, which means that when a connection to the database is established the connection remains open until the application is closed. Leaving the connection open for the lifetime of the application raises concerns about database security and network traffic. Also, as databases are becoming increasingly important and as they are serving more people, a connected data access model makes us think about its productivity. For example, an application with connected data access may do well when connected to two clients, the same may do poorly when connected to 10 and might be unusable when connected to 100 or more. Also, open database connections use system resources to a maximum extent making the system performance less effective.

Why ADO.NET?

To cope up with some of the problems mentioned above, ADO .NET came into existence. ADO .NET addresses the above mentioned problems by maintaining a disconnected database access model which means, when an application interacts with the database, the connection is opened to serve the request of the application and is closed as soon as the request is completed. Likewise, if a database is Updated, the connection is opened long enough to complete the Update operation and is closed. By keeping connections open for only a minimum period of time, ADO .NET conserves system resources and provides maximum security for databases and also has less impact on system performance. Also, ADO .NET when interacting with the database uses XML and converts all the data into XML format for database related operations making them more efficient.


The ADO.NET Data Architecture

Data Access in ADO.NET relies on two components: DataSet and Data Provider.

DataSet

The dataset is a disconnected, in-memory representation of data. It can be considered as a local copy of the relevant portions of the database. The DataSet is persisted in memory and the data in it can be manipulated and updated independent of the database. When the use of this DataSet is finished, changes can be made back to the central database for updating. The data in DataSet can be loaded from any valid data source like Microsoft SQL server database, an Oracle database or from a Microsoft Access database.

Data Provider

The Data Provider is responsible for providing and maintaining the connection to the database. A DataProvider is a set of related components that work together to provide data in an efficient and performance driven manner. The .NET Framework currently comes with two DataProviders: the SQL Data Provider which is designed only to work with Microsoft's SQL Server 7.0 or later and the OleDb DataProvider which allows us to connect to other types of databases like Access and Oracle. Each DataProvider consists of the following component classes:

The Connection object which provides a connection to the database
The Command object which is used to execute a command
The DataReader object which provides a forward-only, read only, connected recordset
The DataAdapter object which populates a disconnected DataSet with data and performs update


Data access with ADO.NET can be summarized as follows:

A connection object establishes the connection for the application with the database. The command object provides direct execution of the command to the database. If the command returns more than a single value, the command object returns a DataReader to provide the data. Alternatively, the DataAdapter can be used to fill the Dataset object. The database can be updated using the command object or the DataAdapter.

ADO .NET Data Architecture

Component classes that make up the Data Providers

The Connection Object

The Connection object creates the connection to the database. Microsoft Visual Studio .NET provides two types of Connection classes: the SqlConnection object, which is designed specifically to connect to Microsoft SQL Server 7.0 or later, and the OleDbConnection object, which can provide connections to a wide range of database types like Microsoft Access and Oracle. The Connection object contains all of the information required to open a connection to the database.

The Command Object

The Command object is represented by two corresponding classes: SqlCommand and OleDbCommand. Command objects are used to execute commands to a database across a data connection. The Command objects can be used to execute stored procedures on the database, SQL commands, or return complete tables directly. Command objects provide three methods that are used to execute commands on the database:

ExecuteNonQuery: Executes commands that have no return values such as INSERT, UPDATE or DELETE
ExecuteScalar: Returns a single value from a database query
ExecuteReader: Returns a result set by way of a DataReader object


The DataReader Object

The DataReader object provides a forward-only, read-only, connected stream recordset from a database. Unlike other components of the Data Provider, DataReader objects cannot be directly instantiated. Rather, the DataReader is returned as the result of the Command object's ExecuteReader method. The SqlCommand.ExecuteReader method returns a SqlDataReader object, and the OleDbCommand.ExecuteReader method returns an OleDbDataReader object. The DataReader can provide rows of data directly to application logic when you do not need to keep the data cached in memory. Because only one row is in memory at a time, the DataReader provides the lowest overhead in terms of system performance but requires the exclusive use of an open Connection object for the lifetime of the DataReader.

The DataAdapter Object

The DataAdapter is the class at the core of ADO .NET's disconnected data access. It is essentially the middleman facilitating all communication between the database and a DataSet. The DataAdapter is used either to fill a DataTable or DataSet with data from the database with it's Fill method. After the memory-resident data has been manipulated, the DataAdapter can commit the changes to the database by calling the Update method. The DataAdapter provides four properties that represent database commands:

SelectCommand
InsertCommand
DeleteCommand
UpdateCommand

When the Update method is called, changes in the DataSet are copied back to the database and the appropriate InsertCommand, DeleteCommand, or UpdateCommand is executed.

Monday, August 23, 2010

.Net Uses


cPanel is the industry leader for turning standalone servers into a fully automated point-and-click hosting platform. Tedious tasks are replaced by web interfaces and API-based calls. cPanel is designed with multiple levels of administration including admin, reseller, end user, and email-based interfaces. These multiple levels provide security, ease of use, and flexibility for everyone from the server administrator to the email account user.

cPanel is an organization that wins the loyalty of customers around the world by providing feature-rich applications backed by a team of developers, technical support engineers and quality assurance experts that provide stable builds, direct support, and fantastic customer service.

cPanel powers web hosting companies and organizations that have a need to automate and offer competitive hosting services.

cPanel Direct Licensing

cPanel can be installed on any server worldwide. If you currently operate your own servers and wish to purchase the cPanel software directly, it can be purchased online at the cPanel Store. Every direct software purchase receives priority support, installation support, and migration assistance.

Friday, August 20, 2010

.NET Framework and Languages


As mentioned on the .NET Framework page, .NET Framework is designed for cross-language compatibility.
Cross-language compatibility means .NET components can interact with each other irrespective of the languages they are written in. An application written in VB .NET can reference a DLL file written in C# or a C# application can refer to a resource written in VC++, etc. This language interoperability extends to Object-Oriented inheritance.

This cross-language compatibility is possible due to common language runtime. As you read on the .NET Framework page, when the .NET program is compiled, the output of the compiler is not an executable file but a file that contains a special type of code called the Microsoft Intermediate Language (MSIL). This MSIL is a
low-level language which is designed to be read and understood by the common language runtime. Because all .NET executables exist as IL, they can freely operate. The Common Language Specification defines the minimum standards that .NET language compliers must confirm to. Thus, any code compiled by a .NET complier can interoperate with the .NET Framework.

The Common Type System (CTS) defines the rules concerning data types and ensures that code is executed in a safe environment. Since all .NET applications are converted to IL before execution all primitive data types are represented as .NET types. This means that, a VB Integer and a C# int are both represented in IL code as System.Int32. Because both the languages use a common and interconvertible type system, it is possible to transfer data between components and avoid time-consuming conversions.

Languages supported by .NET Framework

The table below lists all the languages supported by the .NET Framework and describes those languages. The languages listed below are supported by the .NET Framework upto the year 2003. In future there may be other languages that the .NET Framework might support.