Menu Close

Author: Luca

5 JQuery Infinite Scrolling Demos

by JQuery4you.com

Here are 5 demos which you could use as the barebones for your next infinite scrolling project. I’ve been playing around with infinite scrolling for one of my projects and I’ve tried a few jQuery plugins which can manage the “endless scroll” showing items, posts, rss feeds, tweets or anything really. The content can be generated dynamically from JavaScript but most commonly loaded from a server script using AJAX. Also I found that Firefox 8 only detects the scroll upto 99.85% of the screen which was strange.

Infinite Scrolling Demo 1

This demo uses the jQuery Masonry plugin together with the Infinite Scroll plugin. The Masonry plugin really is good for obtaining fluid layouts definately recommend it for that. The infinite scroll plugin by Paul Irish is good at loading pages which already exist such as page.html, page2.html, page3.html but it can’t handle dynamic generated content such as hitting the same page.php file with appended parameters page.php?data=xxx. Just bear that in mind if you go with this option.

infinitescroll1

 

Configuring a SOCKS Proxy and Tunneling With Dante

Obtaining Dante from repository

Dante is a fully functional SOCKS proxy server and as such has many nobs. Fortunately, setting up a basic configuration that will allow tunneling of things like HTTP is relatively simple. If you’re running Debian GNU/Linux, simply run:

# apt-get update
# apt-get install dante-server

Configuring Dante

remember! Dante is a SOCKS host NOT an HTTP proxy, you are going to get all sorts of weird errors if you get this wrong.

The configuration file is locate in

# cat /etc/danted.conf

 

Convert a UNIX timestamp to a datetime with MySQL

by electrictoolbox.com

Dates and times can be stored as an integer value as a UNIX timestamp. This isn’t a particularly human readable format but can be converted in MySQL to a datetime value using the FROM_UNIXTIME function.

Dates and times as timestamps

Back when I first started using MySQL and PHP and created an ecommerce system that was used on a number of websites, I decided to store datetimes as a UNIX timestamp for whatever reason. This made it easy to use the PHP date function to format the dates but is not so useful when browsing data in the database or selecting date ranges in a query. I no longer do this and always store date times as a datetime field type now.

Converting integer timestamp to a datetime

In my old ecommerce system there was a table called “orders” with a column called “date_ordered” which was a UNIX timestamp stored as an integer. To convert this to a datetime as part of the SELECT query this needs to be done:


SELECT other fields here, FROM_UNIXTIME(date_ordered)
FROM orders
WHERE ...

 

The integer field will now be represented in the resultset as a datetime string in the format YYYY-MM-DD HH:MM:SS.

scp command line to securely copy files over ssh, between Linux, Mac or Windows

by garron.me

SCP Introduction

scp stands for secure cp (copy), which means you can copy files across ssh connection. That connection will be securely encrypted, it is a very secure way to copy files between computers

You can use scp to copy files from or to a remote server. You can also copy files from one remote server to another remote server, without passing traffic through your PC.

You can use scp on Linux, Mac and Windows (using WinSCP).

Hide Apache version from hackers

A first line of defense in web application world is to hide as much info as possible from HTTP headers!

In this article we will see how easy it is to hide apache’s version number.

1. Keep a backup of file /etc/apache2/apache2.conf.

2. Open /etc/apache2/apache2.conf file for edit. For ubuntu users issue the following command:

sudo nano /etc/apache2/apache2.conf

Hosting multiple websites with Apache2

by debian-administration.org

One of the most common Apache2 questions I’ve seen on Debian mailing lists is from users who wonder how to host multiple websites with a single server. This is very straightforward, especially with the additional tools the Debian package provides.

We’ve previously discussed some of the tools which are included in the Apache2 package, but what we didn’t do was show they’re used from start to finish.

There are many different ways you can configure Apache to host multiple sites, ranging from the simple to the complex. Here we’re only going to cover the basics with the use of the NameVirtualHost directive. The advantage of this approach is that you don’t need to hard-wire any IP addresses, and it will just worktm. The only thing you need is for your domain names to resolve to the IP address of your webserver.

 

Servername in Apache2

Towards the end of the install you will see this warning:

apache2: Could not reliably determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName

Although I’ll be going into some detail about the options and settings available in the main apache configuration file, let’s fix that warning straight away.

Open the main apache config:

sudo nano /etc/apache2/apache2.conf

At the bottom of the file add the following:

ServerName demo

Change the ServerName to your Slice hostname or a FQDN (remember this demo Slice has a hostname of ‘demo’).

Once done, save apache2.conf and gracefully restart Apache (this method of restarting won’t kill open connections):

sudo apache2ctl graceful

Now the warning has gone. Nice.