Adams Bros Blog

27Nov/140

Java Script Quick Start Tips and Best Practises

Posted by Trenton

When not specified, much of this knowledge comes from Java Script Patterns by Stoyan Stefanov, and the JavaScript Pocket Reference (3rd Edition) by David Flanagan.  I personally found the JavaScript Pocket Reference to be the most valuable of the two.

This is by no means a comprehensive java script language overview, but it does provide a good bit of technical information for a beginner in the language.  It mostly just covers some key concepts that can help improve code quality, and some gotchas of the language.  It is recommended you have used Javascript a little bit prior to reading this.

I may update this from time to time.

22Nov/140

No Space Left On Device – Linux

Posted by Trenton

So, perhaps you've seen this message, but when you check the space usage, it's just fine.  It's usually because your file system is using a whole bunch of inodes.  So, if you're using your drive space for backups, and those backups require using a lot of inodes, then you'll use up your disk very quickly.

inodes are the pointers at the beginning of the disk, which point to each datablock.  They also contain extra information like file permissions, user, group, etc

Well, let's create a file system that has more inodes, so that this doesn't happen as quickly.

Filed under: Linux Continue reading
18Nov/141

Save Bash History Realtime

Posted by Trenton

I kind of get sick of my work computer dying, and then I lose some history because I forgot to exit my terminal sessions.  I've always used the histappend feature, but this prompt command thing is great. :D  Thank you Stack Exchange.  The other benefit of this is that each terminal immediately receives the new history next time you press enter.

Filed under: Bash Continue reading
15Nov/140

Linux Software RAID

Posted by Trenton

One of my drives in my RAID died, so I went and bought a 3TB drive for a replacement. The RAID is only 1T, so I'll use the rest of it for something else.

It drives me nuts that every site out there describes in great detail how to do different things. Anyone can read the man page, or issue the parted "help mkpart" for example; but what I usually look for is a quick start.  So, here's a quick rundown on how I re-set up the RAID drive. At the bottom is a full rundown on how I think I originally setup the RAID, but don't quote me on it. :D

We run through the basic use of parted and mdadm.

11Nov/140

Git Setup with SSH

Posted by Trenton

This is just a simple rundown of how to setup git properly for SSH use. SSH specific information about how to connect using SSH keys, and things of that nature, are not within the scope of this post. I will update this as I go.

Filed under: git, Linux Continue reading
11Nov/140

git Commit Email Notification

Posted by Trenton

I couldn't really find anything that could get me up and running really quickly with git commit emails. In this blog post we provide a git post-receive-email example.  In our case, our server is CentOS.

Filed under: git, Linux Continue reading
7Nov/140

OpenJPA Standalone Application Quick Start

Posted by Trenton

Finding a decent OpenJPA standalone example is very difficult. The one I've created on github does not provide any sort of complex example, but it at least shows how to get started with a standalone Open JPA application, with a maven build.

Filed under: Java Continue reading
6Nov/140

Derby Command Line Quick Start

Posted by Trenton

While you can find this information on the derby website, in a grossly large Derby Basics document, isn't it nicer to just copy and paste? I just don't understand why developers like to write documents that make you take so much time to get started.

Filed under: Java Continue reading
4Nov/140

ProFTPD for wordpress

Posted by Trenton

In order to make updating wordpress nice and easy, you should install an ftp server.  What we do not account for in this setup, is having more than one wordpress site, or other service, accessible via ftp.

For security, you want to listen only on localhost, regardless of whether you have a firewall, as you should not depend on one level of security.

SocketBindTight                 on
DefaultAddress                  localhost

Some more basic changes that I made...

DefaultRoot                 /var/www/site/
#AuthOrder                 mod_auth_pam.c* mod_auth_unix.c

Lastly, you need to add a user and give them a password.  Always remember that you should never give the apache group write access to everything in /var/www, otherwise you are open to more exploits.

useradd -m -g apache blog
passwd blog
chown -R blog:apache /var/www/site
Filed under: Linux No Comments
4Nov/140

Compress All Log Files

Posted by Trenton

I decided to start being more active with this blog.  I've always wanted a personal indexer for all the things I learn in Linux or software development.  Might as well make this blog that index.

So, you want to gzip all the log files in a particular directory right?  Well, you better be sure that you're not doing that to live files, so just check them with lsof...

find /var/log/somefolder -type f | while read -r file; do lsof "$file"; if [ $? -eq 1 ]; then gzip "$file"; fi; done
Filed under: Bash, Linux No Comments