To prevent posts from a certain category from showing up on your front page in Wordpress, put this in your index.php (or the template where you want to exclude a category from your page, maybe archive.php) BEFORE the loop:
< ?php query_posts($query_string . '&cat=-53'); ?>
The category number to exclude in my example is 53. You can replace that number with whichever category you want to exclude. To exclude more than one category, just separate with a comma, so:
< ?php query_posts($query_string . '&cat=-53,-13'); ?>
To determine the category’s number, just open your admin panel, and go to –posts–categories and then hover your mouse pointer over the category in question, while watching the status bar of your browser, or just click on one of the category names there. The last bit in the url is the category number, like “cat_ID=53″
I wanted to exclude all video posts from my front page cannabisfantastic.com because they sort of block the news and other content. By using this method, I can still have a video category but the video posts don’t automatically show up on top distracting from my other posts. See the The Loop page at the Wordpress Codex for more information.
Exclude a Category from the Front Page in Wordpress
January 22nd, 2010Dell Inspiron 2500 With Intel 82815 Graphics xorg.conf for 1024×768
September 8th, 2009Just install Xubuntu 8.04 and use the following for your /etc/X11/xorg.conf.
To do that, simply back up your existing xorg.conf . . .
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
And then . . .
sudo gedit /etc/X11/xorg.conf
–paste in the following, and then save:
Section "Files"
EndSection
#
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
#
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection
#
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
EndSection
#
Section "Device"
Identifier "Intel Corporation 82815 CGC [Chipset Graphics Controller]"
Driver "intel"
BusID "PCI:0:2:0"
EndSection
#
Section "Monitor"
Identifier "Generic Monitor"
Option "DPMS"
HorizSync 31.5-48.5
VertRefresh 40-70
EndSection
#
Section "Screen"
Identifier "Default Screen"
Device "Intel Corporation 82815 CGC [Chipset Graphics Controller]"
Monitor "Generic Monitor"
DefaultDepth 16
SubSection "Display"
Modes "1024x768" "800x600" "640x480"
EndSubSection
EndSection
#
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
#
# Uncomment if you have a wacom tablet
# InputDevice "stylus" "SendCoreEvents"
# InputDevice "cursor" "SendCoreEvents"
# InputDevice "eraser" "SendCoreEvents"
InputDevice "Synaptics Touchpad"
EndSection
Backing up MYSQL databases using mysqldump – HahA! – Easier than it looked.
May 22nd, 2009This worked for me:
Back up:
mysqldump -u USERNAME DATABASE > BACKUP-FILENAME -p
Then you have to type the mysql user’s password, and voila a dump file is created. I named my file something.sql .
Now to import that file, I will test the following:
mysql -u USERNAME -p DATABASE < BACKUP-FILENAME
Yes, it works. My database appeared to be completely restored in a test.
ASPI Layer for Windows XP – Use ForceASPI 1.7
May 20th, 2009CDex finally works under the ASPI layer after I used Forceaspi to install aspi 4.60.
Click to continue reading “ASPI Layer for Windows XP – Use ForceASPI 1.7″
Geforce FX 5200 In Ubuntu Intrepid Ibex 8.10
November 20th, 2008I have just now got my graphics going in hi res. on my Geforce FX 5200 AGP card. I used some program months ago to configure 8.04 but I can’t remember it . . . Anyway today I activated the nvidia driver #173 in the “restricted drivers” manager and then rebooted, but that didn’t do the trick. I was still stuck in ol’ 640×480. I replaced xorg.conf with my old xorg.conf that was created by that unremembered program. That did it. Now it’s pretty and I do have 3d . . .
Here is my xorg.conf . . . you can try using it, or part of it. I remember I had the hardest time getting my fx 5200 to work the first time. This time I’m documenting it here. (edit) By the way, we have a report below that this technique worked in Karmic Koala.
One way you can try this is in a terminal. First copy your existing xorg.conf:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup01
Then do this to open the xorg.conf file in a text editor
sudo gedit /etc/X11/xorg.conf
What I did is I replaced all of the text in the file with the following:
# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg
#
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
#
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
EndSection
#
Section "Device"
Identifier "Configured Video Device"
Boardname "nvidia"
Busid "PCI:1:0:0"
Driver "nvidia"
Screen 0
EndSection
#
Section "Monitor"
Identifier "Configured Monitor"
Vendorname "Dell"
Modelname "Dell E196FP"
Horizsync 31.0-83.0
Vertrefresh 56.0-76.0
modeline "640x480@60" 25.2 640 656 752 800 480 490 492 525 -vsync -hsync
modeline "640x480@72" 31.5 640 664 704 832 480 489 491 520 -vsync -hsync
modeline "640x480@75" 31.5 640 656 720 840 480 481 484 500 -vsync -hsync
modeline "800x600@56" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync
modeline "800x600@72" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync
modeline "800x600@75" 49.5 800 816 896 1056 600 601 604 625 +hsync +vsync
modeline "800x600@60" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
modeline "832x624@75" 57.284 832 864 928 1152 624 625 628 667 -vsync -hsync
modeline "1024x768@75" 78.8 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
modeline "1024x768@70" 75.0 1024 1048 1184 1328 768 771 777 806 -vsync -hsync
modeline "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -vsync -hsync
modeline "1152x864@75" 108.0 1152 1216 1344 1600 864 865 868 900 +hsync +vsync
modeline "1280x1024@75" 135.0 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync
modeline "1280x960@60" 102.1 1280 1360 1496 1712 960 961 964 994 -hsync +vsync
modeline "1280x1024@60" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
modeline "1280x960@75" 129.86 1280 1368 1504 1728 960 961 964 1002 -hsync +vsync
modeline "1400x1050@60" 122.61 1400 1488 1640 1880 1050 1051 1054 1087 -hsync +vsync
modeline "1400x1050@75" 155.85 1400 1496 1648 1896 1050 1051 1054 1096 -hsync +vsync
modeline "1600x1200@65" 175.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
modeline "1600x1200@60" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
modeline "1792x1344@60" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync
Gamma 1.0
EndSection
#
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
Defaultdepth 24
SubSection "Display"
Depth 24
Virtual 1792 1344
Modes "1280x1024@60" "1280x960@75" "1280x960@60" "1400x1050@60" "1280x1024@75" "1400x1050@75" "1152x864@75" "1600x1200@65" "1024x768@60" "1600x1200@60" "1024x768@70" "1792x1344@60" "1024x768@75" "832x624@75" "800x600@60" "800x600@75" "800x600@72" "800x600@56" "640x480@75" "640x480@72" "640x480@60"
EndSubSection
EndSection
#
Section "ServerLayout"
Identifier "Default Layout"
screen 0 "Default Screen" 0 0
EndSection
Section "Module"
Load "glx"
Load "v4l"
EndSection
Section "device" #
Identifier "device1"
Boardname "nvidia"
Busid "PCI:1:0:0"
Driver "nvidia"
Screen 1
EndSection
Section "screen" #
Identifier "screen1"
Device "device1"
Defaultdepth 24
Monitor "monitor1"
EndSection
Section "monitor" #
Identifier "monitor1"
Gamma 1.0
EndSection
Section "ServerFlags"
EndSection
Then save the file and close gedit and then cross your fingers and reboot!
IGAL – a Great Command-line Image Gallery Maker
October 2nd, 2008To install on Ubuntu do:
sudo apt-get install igal2
Then use the igal2 --help command
for parameters. Basically cd to the directory you have placed your gallery photos, and then
run the command. Here’s an example:
igal2 -a -c -f -n -p 9 -r -w 3 -x -y 220 --bigy 700 --www
Here’s a result:
http://piercechristie.com/mwimages/index.html
MAD_SECURITY – “precondition failed” error on Wordpress post action
May 26th, 2008May 26, 2008 — Until I “fixed” this problem, on this Wordpress 2.5.1 blog hosted on textdrive, If I typed “FTP” and “server” in the main text field of the “New Post” page, and then published or saved my post, I got “Precondition Failed”
Try this on your wordpress blog.
Make a new post.
Type anything in the title field.
Type the words
“FTP” and “server” in the main text field you can type any other content too, but put those two words together and you will not be able to save your post. (edit: It appears that the only word that I really had trouble was “FTP ” – with the space after and without the quotes. I have heard of people having problems with words commonly found in porn spam and also some seemingly-innoccuous words such as “picture”)
Try to publish your test post.
Do you get the “Precondition Failed” error?
Precondition Failed The precondition on the request for the URL /blog/wp-admin/post.php evaluated to false.
Update – I think it’s mod_security that causes that message. See
this Wordpress Support Page
Also see this Joyent help page
I tried creating a .htaccess file in my public_html directory using the rules suggested there. According to that, you can disable MOD_SECURITY with the following in your .htaccess file:
SecFilterEngine Off
This made it so that at one point I was able to post the word “FTP” alone in a post, which was impossible before. However, I didn’t want to completely disable MOD_SECURITY if I didn’t have to, so,
I tried this in my .htaccess instead, as Joyent suggested at the url above:
SecFilterEngine On
SecFilterSelective "REQUEST_URI" "/blog/wp-admin/post.php" "allow,nolog"
SecFilterSelective "POST_PAYLOAD" "FTP ,FTP,SSH ,SSH" "allow,nolog"
(Note that the above code consists of three lines, and the lines begin with SecFilt…. I will have to make a few adjustments to the theme CSS to make my blog wider . . .)
And that one worked! I don’t think I need the post.php entry so I may remove that line. Anyway it worked.
I am told that MOD_SECURITY is used for spam filtering, and there are many recommendations to disable mod_security as a workaround for this type of problem. However I don’t know. I am rather experimenting here. I’m glad I didn’t have to completely disable it.
I’m tempted to think that overall rules (on my server) are too strict or need tweaking. Or that I need to make a custom filter of my own. However, one would think that one could blog the word “FTP” server without having to rewrite apache rules. When the 3rd and 5th blog posts I made failed, I started thinking “What’s the use? I got me a blog that I can’t post on!”
So here are some suggestions for some rules to put in your .htaccess file so that MOD_SECURITY will be generally functional, and allow apache to allow posts about FTP SSH, etc…
Status: MOD_SECURITY enabled. Blog works. All good.
To implement this solution on your own blog, edit (or create, if it doesn’t exist) a file called .htaccess in the web root of your blog and add the above code to it. .htaccess files define per-directory rules for the apache web server. The .htaccess file which I added to fix my blog is in the folder which contains my Wordpress folder. I think that if you put the file in your actual blog folder it will work as well.
How to Make Ubuntu’s Terminal Open Wider
May 24th, 2008Ubuntu comes with a nice set of programs preinstalled. One of them is Gnome-Terminal. By default, gnome-terminal opens too narrow a window for me. Right away after installing Ubuntu I find myself typing (or pasting) lots of commands and I prefer to be able to fit a decent-sized command at the command-line without it wrapping to the next line. Read on to learn how to make an easy shortcut button for a custom-sized Gnome Terminal.
I learned that the window size can be specified when calling Terminal – Just go:
gnome-terminal --geometry 150x22
The “geometry” refers to the size of the program window. It is expressed in characters rather than pixels. I have a small-screen laptop and I like the above parameters. I use that command as a launcher button in my panel. To do that, right-click your panel at a place where you want the launcher-button. Click “Add to Panel”. Click “Custom Application Launcher”. For ‘Type’, Choose “Application”. Type Terminal or whatever you want to call it under “Name” and paste the above command into the “Command:” area. Modify the “150×22″ to suit your needs. “150″ is the width and “22″ the height. Then click “OK” and you’ve got yourself a custom gnome-terminal button! Of course, it’s easy to change the parameters of your new button by right-clicking it and choosing “Properties” to modify them. The properties, I mean.
Ubuntu: Zoneminder 1.23.3 – How to Install it on Gutsy 7.10
May 15th, 2008Here’s my Zoneminder 1.23.3 install log. I put together this HOWTO so I could share the method I used but I mainly took the notes for when I want to know how to install zoneminder on Ubuntu 7.10 again. I’m sure it’s incomplete. Look at the documentation at the official web site for more help. By the way, for those who don’t know, Zoneminder is a video security surveillance system that runs on Linux and provides web access and automatic motion-detection with unlimited cameras. All you need is cheap cameras, and a decent computer. More information on Zoneminder is available on http://zoneminder.com. Also see this page, although for my situation, some of the tweaking described there was unnecessary. And this wiki has a good explanation of how to set up MYSQL for zoneminder
HARDWARE
I’m using a bttv card, real cheap on ebay, for a capture card. 4 ports on it. I think it’s bt878. My computer is a 3 GHz sony vaio desktop. Basically I just plugged in the capture card, removed the modem, and connected my monitor and keyboard, along with the network cable. . . Let’s move on . . .
INSTALL SERVER OPERATING SYSTEM:
Install Ubuntu 7.10 – Server Edition
You will need “LAMP SERVER” and “SSH SERVER” when you install your ubuntu server.
After installing the basic server, I went ahead and installed ubuntu-desktop. I intended originally to use this machine as a Desktop as well as a server, so:
$ sudo apt-get install ubuntu-desktop
LAMP stands for Linux, Apache, MYSQL, and PHP. Those are pretty good abbreviations. I suggest everyone know what they stand for. MYSQL is a database server. Zoneminder uses a MYSQL database. When installing the LAMP option you will be asked to create a MYSQL root password. Write that down. You are going to need it later to create MYSQL a login for Zoneminder.
-Later I disabled startup of X, for a headless system. See instructions later in this document.
INSTALL ZONEMINDER
This is how I got it:
Download and install a necessary library (alt link)
and
the zoneminder package for ubuntu 7.10 (alt link)
–Note: You have to do the following to configure Apache properly for Zoneminder:
sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
SET UP NETWORK
Then I set up my network using the ubuntu gui network applet. I’m sure there’s an easier way, but I simply set up a static IP address (google “local IP addresses” for more info) and for gateway I put in the local address of my DSL modem (router) which happens to be 192.168.0.1 Commonly your netmask will be 255.255.255.0.
I set up OPENDNS on my server too, by following the instructions here:
(link)
PORTS for HTTP AND SSH
One action I recommend is to set up apache to listen on a custom port. In my Ubuntu 7.10 I did it this way.
$ sudo nano /etc/apache2/ports.conf
–write the port you want to use instead of port 80, which is the traditional port for a webserver. If your server is not to be used by the entire Tubes, which is true in my case as it’s a private video surveillance box, you can avoid not a few script-kiddie-type attacks by locating your server off the beaten path so to speak.
Here’s what my /etc/apache2/ports.conf looks like:
Listen 31290
<IfModule mod_ssl.c>
Listen 443
</IfModule>
While you’re at it, you might as well tell your ssh server to listen on a custom port as well, thus avoiding lots of potential attempted logins from script-kiddies and hackers all over the Tubes.
$ sudo nano /etc/ssh/sshd_config
Just place the port number you wish to use after the word Port under where it says “# What ports, IPs and protocols we listen for”
Mine says:
Port 32644
Leave the rest of the stuff alone in there and save the file.
PORT FORWARDING -
My server is behind a NAT router, otherwise known as an Actiontec GT701-WG DSL modem. To make the server available to the Tubes, it will be necessary to forward http traffic from the internet directly to the server machine on my network. This sounds difficult but is really easy and can be done through the router or DSL modem’s web configuration interface. Simply log in and go to the page where you get to forward ports. Then forward ports. Since everyone’s router is different, and since if you don’t have a NAT router, I will leave this part up to you. If you have trouble, google the model name or number of your router, along with “forward port” and you will find some helpful information.
CONFIGURE DYNAMIC DNS -
This is so that users can always access your server using a url instead of an IP address which is dynamically-updated and may change, thereby rendering your server inaccessible.
To configure my dynamic DNS entry I first created an account at dyndns.org. See
https://www.dyndns.com/support/kb/using_ddclient_with_dyndns_services.html
I set up a hostname such as myubuntuserver.dyndns.org under “host services” and chose “Host with IP address”
Then I entered the external IP address of my server. Once this account was set up I ssh’d into my server and -
Install ddclient
$ sudo apt-get install ddclient
–debconf attempts to configure using wizardry in the install script. If your zm server is connected directly to the Tubes, you can fill in the blanks as you go along and the resulting /etc/ddclient.conf file will most likely be effective. However, I discovered a web-based configurator at dyndns.org which helped by generating a suggested /etc/ddclient.conf(Wizardry again, but pretty well done.)
Here is the resulting /etc/ddclient.conf – you can use it if you replace the email address, PASSWORD, and LOGIN, and the hostname near the bottom. This works for me. My server is behind an actiontec DSL modem/router.
## ddclient configuration file
daemon=600 # check every 600 seconds
syslog=yes # log update msgs to syslog
mail-failure=whoever@gmail.com # Mail failed updates to user
pid=/var/run/ddclient.pid # record PID in file.
## Detect IP with our CheckIP server
use=web, web=checkip.dyndns.com/, web-skip=’IP Address’
## DynDNS username and password here
login=LOGIN
password=PASSWORD
## Default options
protocol=dyndns2
server=members.dyndns.org
## Dynamic DNS hosts
myhost.dyndns.org
DISABLE X
I discovered that due to an unknown memory leak, I got freezes of my whole machine – first firefox crashed, then X. Workaround! Disable X! I decided to place this server upstairs in another part of the building for security, anyway, so using it as a Desktop box is not going to happen, and I don’t need to figure out why it broke.
As recommended on ubuntuforums.org to set “Do not run Xserver at boot” – I did this-
$ sudo mv /etc/rc2.d/S30gdm /etc/rc2.d/D30gdm
$ sudo /etc/init.d/gdm stop
to shut down the X server
Wow! With no X-server running the load average dropped from upwards of 1 and sometimes 9 to less than .4! Zoneminder works great!
AFTER INSTALL
You access the control panel with a browser- at http://localhost/zm or replace “localhost” with the IP address of the Zonealarm server. You probably should set up your Zoneminder to use authorization – users will have to log in to see or use the system. The second system option, ZM_OPT_USE_AUTH found under “Options” will allow you to set that up. Please remember to have your password memorized before turning this on. I FORGOT mine, and it was a good thing that I remembered my MYSQL password, so I could reset the Zoneminder password.
Addendum:
Until recently, I had not discovered why my monitors would not properly display camera output at 640×480 resolution. I found recommendations to increase shared memory size. Check here for how. But remember to reboot. And reboot after setting the resolution in your Zoneminder monitor to 640×480. The “ipcrm” command is supposed to be helpful for this but a reboot did the trick for me.
Please feel free to comment below here. Your thoughts are welcome.
EDIT: Two things:
One, I have run into the problem of 32000-file-limit of ext3 filesystem – I may have to switch to the reiser file system or upgrade to the newest zoneminder which offers deep-storage options.
Two, I was looking for ways to reduce the server’s CPU load- to make it work more efficiently. Zoneminder shows the CPU load for your server at the top right corner of the console page. Mine was shoting up pretty high whenever I turned on modect for more than one of my IP cams. Someone posted on the Zoneminder forums about some an IJG JPEG library with x86 SIMD extensions. I decided to try installing them. After following the procedure outlined below, which I learned at the zoneminder forums, I experienced a dramatic reduction in load, due pesumably to more efficient processing, allowing me to use more than one camera at higher FPS!
All I did was the following and then restarted ZM from the console.
[code]
wget http://cetus.sakura.ne.jp/softlab/jpeg-x86simd/sources/jpegsrc-6b-x86simd-1.02.tar.gz
tar xzvf jpegsrc-6b-x86simd-1.02.tar.gz
wget http://internap.dl.sourceforge.net/sourceforge/nasm/nasm-2.02.tar.gz
tar -xvf nasm-2.02.tar.gz
cd nasm-2.02
[/code]
Install some developer libraries so we can compile:
[code] sudo apt-get install libc6-dev g++ gcc
./configure
make
sudo make install
cd ../jpeg-6bx/
./configure --enable-shared
make
sudo make install
ldconfig
[/code]