Search This Blog

Tuesday, January 06, 2015

How to make your Wordpress site secure


HOSTING

•  Beware cheap ($5-$10/month) shared hosting accounts.
•  Look for hosts with experience hosting WordPress sites.
•  Look for hosts with solid support.
•  Look for hosts that are transparent: who communicate quickly and post issues online.
•  Make sure your host does regular backups that you can access.
•  Call your potential host to find out which versions of Apache web server, MySQL, and PHP they’re running. Check the version release dates with a Google search.
•  Ask your host for written documents containing their server data backup, failover, and update or maintenance policy. If they don’t have them, find another host.
•  Recommended hosts: WP Engine and ZippyKid


HARDENING AND PROTECTING WORDPRESS

•  To harden your WordPress install, follow these steps.
•  Keep WordPress, themes, and plugins up to date. Always. Period.
•  If you’re unsure about how to update WordPress, themes, and plugins, hire someone to do it for you.
•  Backup your site before you update WordPress, themes, and/or plugins.
•  Disable unused user accounts.
•  Never use “Admin” as your username. Ever.
•  Grant users the minimum privilege they need to do their jobs.
•  Require strong passwords.
•  Use 1Password or KeePass to create strong passwords.
•  Use a different, strong password for every site log in.
•  Lock down the WordPress admin dashboard (/wp-admin) using an .htaccess file.
•  Use SFTP to access your web host.
•  Enable SSL on your WP install.
•  Change your passwords once a month. Set a reminder in your calendar if you have to.
•  Do backups. Recommended: BackupBuddy, VaultPress
•  Set file permissions at 644 and 755 for folders.
•  Ensure that the permissions on wp-config.php are not world readable especially in a shared hosting environment.
•  Consider adding HTTP authentication to your /wp-admin/ area.
•  Read Sucuri.net’s blog.
•  Read Google’s security blog


CHOOSING THE RIGHT PLUGIN

•  Look for WordPress Plugin API hooks, actions, and filters.
•  Look for properly sanitized data and MySQL statements, unique namespace items, use of the Settings API for any plugin settings or options. 
•  Look for plugins that use nonces instead of browser cookies.
•  Check out how quickly the developer responds to support requests.
•  Check out forum threads to see how well the plugin is supported.
•  Is the developer a known and respected member of the community?
•  Look for a plugin that does one or two tasks really well.
•  If two plugins do similar things, choose the one with the higher download count.

YOU’VE BEEN HACKED. NOW WHAT?

•  Take the site offline. Now. That way you avoid getting a bad rap from search engines and antivirus programs.
•  Let your web host know what happened.
•  Make a full backup of the infected site. It’s helpful for reviewing what happened and in case you mess up something during the repair.
•  Change all of your passwords and the authentication keys in the wp-config.php.
•  Remove any old themes, plugins, and unused code from your server.
•  Update all code on your server. Re-install WordPress so all of the WordPress files are overwritten with fresh copies.
•  Reinstall themes or plugins with fresh copies to make sure no malicious code was inserted. 
•  Check that the file permissions on your files are correct, especially wp-config.php and uploads.
•  Remove the rogue code and make sure you check all sites on your hosting account. There are tools that can help scan and clean the infection such as VaultPress. Exploit  Scanner also scans for certain exploits.
•  If you don’t have the ability to fix the infected files the best thing to do is restore from a recent clean backup.
•  Check your server access logs. Search for any bad file names that you found on your server, patterns passed as query strings, or dates/times that may clue you in to when the attack happened. 

Source: CodePoet.com

Please visit my other blogs too: http://edwardanil.blogspot.com for information and http://netsell.blogspot.com for internet marketing. Thanks !!

Sunday, January 15, 2012

Tips on how to avoid or resolve deadlocking on your SQL Server

Deadlocking occurs when two user processes have locks on separate objects and each process is trying to acquire a lock on the object that the other process has. Usualy, they have different incompatible locks which are illegal or conflict (as per the compatible mode on locks).When this happens, SQL Server identifies the problem and ends the deadlock by automatically choosing one process and aborting the other process, allowing the other process to continue. The aborted transaction is rolled back and an error message is sent to the user of the aborted process. Generally, the transaction that requires the least amount of overhead to rollback is the transaction that is aborted.

Identify Deadlock:
  1. Using SQL Profiler
  2. Using System_health extended event(It highly depends on the ring buffer)
  3. Using Server side trace (DBCC TRACEON (1204) )
  4. Using SQL Error Log with a trace
  5. Predefined notification functionalities to log the deadlock info using service broker, extended events etc.
Here are some tips on how to avoid/resolve deadlocking on your SQL Server:
  1. Ensure the database design is properly normalized.
  2. Have the application access server objects in the same order each time.
  3. During transactions, don’t allow any user input. Collect it before the transaction begins.
  4. Avoid cursors.
  5. Keep transactions as short as possible. One way to help accomplish this is to reduce the number of round trips between your application and SQL Server by using stored procedures or keeping transactions with a single batch. Another way of reducing the time a transaction takes to complete is to make sure you are not performing the same reads over and over again. If your application does need to read the same data more than once, cache it by storing it in a variable or an array, and then re-reading it from there, not from SQL Server.
  6. Reduce lock time. Try to develop your application so that it grabs locks at the latest possible time, and then releases them at the very earliest time.
  7. If appropriate, reduce lock escalation by using the ROWLOCK or PAGLOCK.
  8. Consider using the NOLOCK hint to prevent locking if the data being locked is not modified often.
  9. If appropriate, use as low of an isolation level as possible for the user connection running the transaction.
  10. Consider using bound connections.
  11. Adding missing indexes to support faster queries
  12. Dropping unnecessary indexes which may slow down INSERTs for example
  13. Redesigning indexes to be "thinner", for example, removing columns from composite indexes or making table columns "thinner" (see below)
  14. Adding index hints to queries appropriately(I dont prefer this mostly, but it has got its own scope)
  15. Redesigning tables with "thinner" columns like smalldatetime vs. datetime or smallint vs. int
  16. Modifying the stored procedures to access tables in a similar pattern
  17. Keeping transactions as short and quick as possible: "mean & lean"
  18. Removing unnecessary extra activity from the transactions like triggers
  19. Removing JOINs to Linked Server (remote) tables if possible
  20. Implementing regular index maintenance; usually weekend schedule suffices; use FILLFACTOR = 80 for dynamic tables (Needs a good evaluation)
The list really goes on. The solution will vary from situation to situation.

Tuesday, April 26, 2011

Cloud development: 9 gotchas to know before you jump in

Whether developing, testing, or deploying your apps in the cloud, you have to unlearn some beliefs and learn new ones to make it work

Application development and testing in the cloud are gaining popularity, as more businesses launch public and private cloud computing initiatives. Cloud development typically includes integrated development environments, application lifecycle management components (such as test and quality management, source code and configuration management, continuous delivery tools), and application security testing components.

Although technology executives and developers with experience in cloud-based development say there are clear benefits to developing in these environments -- such as costs savings and increased speed to market -- they also caution that there are challenges and surprises to look out for.

[ Get the no-nonsense explanations and advice you need to take real advantage of cloud computing in InfoWorld editors' 21-page Cloud Computing Deep Dive PDF special report. | Stay up on the cloud with InfoWorld's Cloud Computing Report newsletter. ]


Gotcha 1: The cloud doesn't always work like the "real world"
Developers might find that the configuration they use in production is hard to replicate on cloud services. For example, with an application you develop in the cloud before bringing back to run locally, you might need to test against a legacy system that you can't simply copy onto a cloud service

Gotcha 2: Some apps aren't ideal for development in the cloud
The more hard-to-access or hard-to-replicate systems an application integrates with, the more difficult it is to develop and test it on cloud computing resources

Gotcha 3: Developers often dislike the unfamiliar cloud territory
Cloud computing is still relatively new to a lot of organizations, and it can be a disruptive technology, including in the development arena. 

Gotcha 4: Lack of documentation hinders cloud developers
There is a lack of documentation to help developers understand the cloud and the tools and resources that can be used to build applications in that environment.

Gotcha 5: Network issues can bedevil private cloud environments 
Developing in the cloud sometimes means developing in your own private cloud, which may not have the multitenancy and load-movement capabilities that keep your applications available 24/7. Other issues that can affect development and testing involve network delays and latency and the size of network pipes, especially in certain parts of the world. 

Gotcha 6: It's easy to let the meter run unnecessarily on the cloud
Another potential problem is wasting money on cloud fees. Developers can easily forget or neglect to turn off virtual machines they aren't using. When it was on an in-house, capitalized server, this was no big deal. But when it is on usage-metered, leased resources as with public cloud computing, this is a waste of money

Gotcha 7: Cloud licenses can contain surprising deployment restrictions 
Among the nontechnical issues with the cloud that can have an impact on development are licensing restrictions.

Gotcha 8: Integration can be harder to troubleshoot
Integrating new applications with existing ones can be a key part of the development process, and the cloud brings even more challenges from an integration perspective.

Gotcha 9: The cloud's fast pace of change can be hard to keep up with 
Being on a quickly evolving cloud development platform, like Azure, means it's necessary to update best practices frequently

Despite the learning curve, cloud development is appealing
Despite the potential challenges, for many organizations application development in the cloud rather than sticking with traditional methods makes sense, for the same reasons that cloud computing in general makes sense: elasticity of resources and cost, and reduced operational complexity, both of which lead to shorter completion time.

This article, "Cloud development: 9 gotchas to know before you jump in," was originally published at InfoWorld.com


Follow edwardanil on Twitter

Wednesday, January 06, 2010

Data access optimization steps in SQL Server


Use Indexing
  • Apply proper indexing in the table columns in the database
    • Make sure that every table in your database has a primary key.
    • Create non-clustered indexes on columns which are, frequently used in the search criteria, Used to join other tables, Used as foreign key fields , Of having high selectivity (Column which returns a low percentage (0-5%) of rows from a total number of rows on a particular value) or Used in the ORDER BY clause
  • Create appropriate covering indexes
    • Use Database Tuning Advisor’s help while creating covered index
  • Defragment indexes if fragmentation occurs
It's really tempting to create index on all eligible columns in your database tables. But, if you are working with a transactional database (An OLTP system where update operations take place most of the times), creating indexes on all eligible columns might not be desirable every time. In fact, creating heavy indexing on OLTP systems might reduce overall database performance (As most operations are update operations, updating data means updating indexes as well).

A rule of thumb can be suggested as follows: If you work on a transactional database, you should not create more than 5 indexes on the tables on an average. On the other hand, if you work on a Data warehouse application, you should be able to create up to 10 indexes on the tables on an average.



Re-factor TSQLs and apply best practices
  • Move TSQL codes from application into the database server
  • Identify inefficient TSQLs, re-factor and apply best practices
    • Don’t use “SELECT*" in SQL Query
    • Avoid unnecessary columns in SELECT list and unnecessary tables in join conditions
    • Do not use the COUNT() aggregate in a subquery to do an existence check
    • Try to avoid joining between two types of columns
    • Try to avoid deadlocks 
    • Write TSQLs using “Set based approach” rather than using “Procedural approach” 
    • Try not to use COUNT(*) to obtain the record count in the table 
    • Try to avoid dynamic SQLs
    • Try to avoid the use of Temporary Tables, try to use Table variables.
    • Instead of LIKE search, Use Full Text Search for searching textual data 
    • Try to use UNION to implement “OR” operation 
    • Use VARCHAR(MAX), VARBINARY(MAX) and NVARCHAR(MAX) 
    • Do not call functions repeatedly within your stored procedures, triggers, functions and batches.
    • Try to avoid the use of triggers.
    • Try to avoid nested transaction.
    • Understanding the query execution plan
    • Getting rid of the unnecessary Text column in the SELECT list
Apply advanced indexing and denormalization
  • Apply some advanced indexing techniques
    • Implement computed columns and create index on these
    • Create "Indexed Views"
    • Create indexes on User Defined Functions (UDF), using computed columns
    • Create indexes on XML columns
  • Apply de-normalizations, use history tables and pre-calculated columns
Diagnose database performance problems
  • Diagnose performance problem, use SQL Profiler and Performance Monitoring tool effectively.
Optimize database files and apply partitioning
  • Organize the file groups and files in the database
  • Apply partitioning in the big fat tables


Original Source: M.M.Al-Farooque Shubho

Thursday, December 18, 2008

Importance of CSS in web development

CSS style sheets have made it easier to handle web pages during web development. CSS or Cascading Style Sheets as the name suggests is a style sheet that allows you to easily link to other documents in your website. It allows you to retain control over the various elements in different web pages of your website.

CSS only defines the structure and content presentation of a website it has nothing to do with the design of a website. A single CSS sheet can control the font, positioning, colour and style information of an entire website.

9 advantages of using CSS
* Web pages are easier to load and uses less bandwidth
CSS style sheets are preferred by web developers for website development because they are lighter than table layouts, which consumes lots of bandwidth. The style sheet is downloaded only once and stored in the cache memory, so subsequent pages load faster.

* A CSS style sheet compliments well with HTML
HTML is insufficient when used independently in website development, but when combined with CSS they can result in technically stronger web pages.

* CSS allows you to position your element anywhere in the webpage
Web developers love to use CSS because it allows them to position their element where ever they want in the web page. If during any phase of web development the developer feels that particular links or columns are not going well with the situation then it becomes easier for them to position them easily using CSS. CSS reduces the risks associated with maintenance of the website.

* CSS is compatible with all web browsers
CSS is combined with HTML or XHTML by web developers for web application development because it is compatible with all web browsers. The sites that use CSS appear similar in all the web browsers.

* CSS can be used to create print friendly web pages
Most of the web developers love to use CSS for building their HTML based web applications because they allow them to create print friendly web pages. These web pages can be easily printed. The colours, images and other things which are difficult to be printed can be eliminated and printed easily.

* CSS style sheets allows the user to customize the webpage
Now days many websites allow the user to change the layout of the website without affecting the content. The CSS style sheets which are stored externally allow the user to make requisite changes by themselves. Most of the modern browsers give user the liberty to define their own style sheets like changing some font properties etc.

* CSS style sheets makes it easier for your website to feature in search engines
The CSS style sheets are favoured by web developers because they allow them to position their elements as per their wish anywhere in web application. Positioning helps to project the main contents first, so that it is easily captured by web spiders. CSS also gives cleaner HTML codes thus cutting down the job of web spider to search the real content from junk code.

* CSS allows the web pages to have absolute consistency
One of the reasons for using CSS during web development is that they allow consistency to all web pages. All the expressions and texts will get their characteristics from external style sheet. Web developers need not to worry about the change in characteristics of the elements because they can be easily altered at any stage of web development by using CSS.

* CSS lends portability to content
By using CSS you can make separate style sheets for different media. This provides you the great flexibility in presenting your content. CSS allows you to redefine the characteristics of elements in a website to suit the need of the situation. For e.g.: A separate style sheet will allow you to redefine the characteristics of certain elements so that they are easier to be printed. Also the user will never come to know that you had restructured the characteristics for their benefit.

CSS is created to make the things easier for your website and also to give you control over different elements in your website. Utilizing benefits of CSS will give you popular user friendly web pages.

To appreciate the beauty and flexibility of CSS, check out the site, CSSZenGarden.com
The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The code remains the same, the only thing that has changed is the external .css file.

CSS allows complete and total control over the style of a hypertext document. The only way this can be illustrated in a way that gets people excited is by demonstrating what it can truly be, once the reins are placed in the hands of those able to create beauty from structure. To date, most examples of neat tricks and hacks have been demonstrated by structurists and coders. Designers have yet to make their mark. This needs to change.

Original Source:
http://support.fuchsiasoft.org/importance-of-css-in-web-development-t67.html