This may seem obvious, but a Rails application is essentially ruby code that will have to be run. Make sure your code is efficient from a Ruby standpoint. Take a look at your code and ask yourself if some refactoring is in order, keeping in mind performance considerations and algorithmic efficiency. Profiling tools are, of …
November 2010 archive
Permanent link to this article: https://blog.openshell.in/2010/11/optimize-your-ruby-code/
Nov 28
Group operations in a transaction
ActiveRecord wraps the creation or update of a record in a single transaction. Multiple inserts will then generate many transactions (one for each insert). Grouping multiple inserts in one single transaction will speed things up. Insead of: my_collection.each do |q| Report.create({:phrase => q}) end Use: Report.transaction do my_collection.each do |q| Report.create({:phrase => q}) end end …
Permanent link to this article: https://blog.openshell.in/2010/11/group-operations-in-a-transaction/
Nov 27
IBM DB2 Security Mechanisms
For every e-business solution, the company should give more sound for database security. The database security plan should define: who is allowed to the instance and/or database where and how a user’s password will be verified authority level that a user is granted commands that a user is allowed to execute data that a user …
Permanent link to this article: https://blog.openshell.in/2010/11/ibm-db2-security-mechanisms/
Nov 27
Locate ASP.Net AJAX AutoCompleteExtender inside TabContainer
ASP.Net Ajax contains rich array of controls used to create an interactive Web experience.While creating a ajax website you might face problems in binding two controls.For example locating AutoCompleteExtender inside the tab Container.Let us see how to solve this above problem. 1. First, create the a script manager in your .aspx page.like this, <asp:ScriptManager ID=”ScriptManager1″ …
Permanent link to this article: https://blog.openshell.in/2010/11/locate-asp-net-ajax-autocompleteextender-inside-tabcontainer/
Nov 27
Configuring JNDI data source in Tomcat
By using Java Naming and Directory Interface (JNDI) service, one can connect resources of different technologies. A typical web application in Tomcat has a file called as context.xml in which the context path (root) of the web application is defined. Usually this file is located in META-INF directory of you web application (see figure 1). …
Permanent link to this article: https://blog.openshell.in/2010/11/configuring-jndi-data-source-in-tomcat/
Nov 26
Prototyping Visualization
if you want to design a website or user interface for a website, one of the fundamental things to do is to make sure you have the interface designed well before you start building. The most general way to plan an interface are to use Wireframes. Wireframes are line drawings, comparable to blueprints, which demonstrates …
Permanent link to this article: https://blog.openshell.in/2010/11/prototyping-visualization/
Nov 24
Find out IP address
We can get the IP address of any visitor by using PHP. Finding the IP address is very important requirement for many scripts where we store the members or visitors details. For security reason we can store IP address of our visitors who are doing any purchases or recording the geographical location of the visitor …
Permanent link to this article: https://blog.openshell.in/2010/11/find-out-ip-address/
Nov 23
Send HTML Mail With PHP
Sending html email in php is extremely easy. All you have to do is call the “mail” function with some extra header. Have a look on example: <?php //define the receiver of the email $to = ‘youraddress@example.com’; //define the subject of the email $subject = ‘Test HTML email’; //create a boundary string. It must be unique //so …
Permanent link to this article: https://blog.openshell.in/2010/11/send-html-mail-with-php/
Nov 23
Single quotes, Double quotes
It’s easy to just use double quotes when concatenating strings because it parses everything neatly without having to deal with escaping characters and using dot values. However, using single quotes has considerable performance gains, as it requires less processing. For Example: <?php //Consider this string $howdy = ‘everyone’; $foo = ‘hello $howdy’; $bar = “hello $howdy”; // Concatenating this strings $howdy = ‘everyone’; …
Permanent link to this article: https://blog.openshell.in/2010/11/single-quotes-double-quotes/
Nov 23
Scripts Execution Time Limits
Putting a time limit on your PHP scripts is a very critical thing. There are times when your scripts will fail, and when they do, you’ll want to use the set_time_limit function to avoid infinite loops and database connection timeouts. The set_time_limit puts a time limit on the maximum number of seconds a script will …
Permanent link to this article: https://blog.openshell.in/2010/11/scripts-execution-time-limits/