RafaelWolf.com

The son of "The most interesting man in the world" (Dos Equis )

Browsing Posts in Web & Web Programming

I found an interesting site the other day (forwarded to me from a colleague found here –> WizCrafts).  I decided to implement their IP block technique on my CPanel server.  I happen to host on my own CPanel server (http://flophost.com if you’re interested ;) ) and as a result I have ssh access to it BUT as most CPanel hosting providers go you likely won’t!

Note, I had problems actually implementing a “global” IP block policy because of the way CPanel operates in conjunction with IPTables on my server (or so I suspect!).  If I had a separate firewall I could better implement a global IP block (because it would be separate from CPanel) but I don’t for now so I’m encouraging all to follow these steps to implement the IP block not only with sites I’m using but for others who host on CPanel servers.  If you don’t use CPanel you could likely tweak your .htaccess file in the same way but you’d have to figure out if that’s how your web hosting panel does things and if it doesn’t this .htaccess method should still work anyway…try it and see.

Here we go!

  1. Download my example file here (note it’s a text file) –>  .htaccess example
  2. Edit the text file to meet your needs, maybe you want to delete, add or modify the list?  Check WizCrafts site for updates!
  3. Backup your original .htaccess file, rename it to something like .htaccess.original or download it to a safe place just in case (I recommend downloading it for safe keeping and taking it off your server EVEN THOUGH you’ll get an error if trying to view it; it’s good practice to keep things tidy!)
  4. In the “Wizcrafts_htaccess.txt” file you’ll need to edit just a few lines to match your CPanel installation
    • AuthName YOURDOMAIN.COM<–GOESHERE<–also delete the “GOESHERE” part :)
    • AuthUserFile /home/yourusername/public_html/_vti_pvt/service.pwd
    • AuthGroupFile /home/yourusername/public_html/_vti_pvt/service.grp
  5. Now upload this to your “public_html” folder, rename the “Wizcrafts_htaccess.txt” file to just .htaccess and look at your IP Deny Manager in CPanel.

* Troubleshooting, if you get an “Internal Server Error” like I did it turned out to be my comments bleeding over into being uncommented.  I had a line like this…

# My cool comment, I’m blocking xyz IP’s from
such and so country
# Next comment would come along
then it would bleed over into uncommented land

Turns out that will throw the server into error because it doesn’t understand or know what “such and so country” is SO if you have an “Internal Server Error” after you implement this look over your file and make sure your comments aren’t wrapping!

Have you ever WISHED you could capture a stream of your favorite audio program on the net?  What about capturing your favorite NPR program?  I know I know, they usually make them available for download but some sites don’t, all they do is stream it once and it’s gone forever especially some less popular websites or genres of music.

I found a program on the net call “MPlayer“.  It’s AWESOME!

Once you download it you have to figure out where it installed, if you have Windows XP like me it’s in your program files (C:\Program Files\SMPlayer\MPlayer).  If you open a command prompt and cd there like this…

cd\
cd “Program Files\SMPlayer\MPlayer”

You’re there!

Now you can issue a few commands like this.  These are some streams I helped a buddy hook onto but they’re great examples.

__________________________________________________________________

Captures a stream from The Pulse Rocks – some Christian Rock Music station into a wma file:

mplayer -dumpfile ThePulseRocks.wma -dumpstream -playlist http://www.thepulserocks.com/StreamFiles/wqrp2.asx

Captures a stream from The Pulse Rocks – some Christian Rock Music station into an mp3 file:

mplayer -dumpfile ThePulseRocks.mp3 -dumpstream -playlist http://www.thepulserocks.com/StreamFiles/wqrp2.asx

Although NPR usually makes their shows available for download here is one for WMUK in Kalamazoo, MI:

mplayer -dumpfile WMUK.wma -dumpstream -playlist http://ummedia12.rs.itd.umich.edu:8004/listen.pls

* New – Capture “French in action” from Learner.org :-)

Windows:

mplayer -dumpfile French_03.asf -dumpstream mms://media.scctv.net/annenberg/French_In_Action_03.wmv

mplayer -dumpfile French_04.asf -dumpstream mms://media.scctv.net/annenberg/French_In_Action_04.wmv

Mac (Thanks for my good buddy Mark!):

./Applications/MPlayer\ OS\ X\ 2.app/Contents/Resources/mplayer.app/Contents/MacOS/mplayer -dumpfile French_03.asf -dumpstream mms://media.scctv.net/annenberg/French_In_Action_03.wmv

./Applications/MPlayer\ OS\ X\ 2.app/Contents/Resources/mplayer.app/Contents/MacOS/mplayer -dumpfile French_04.asf -dumpstream mms://media.scctv.net/annenberg/French_In_Action_04.wmv

…etc!  Enjoy!

__________________________________________________________________

You could do a lot of different things with this tool.  One serious challenge is to find the source for your stream.  If WMUK didn’t post their direct link on their help URL I would have struggled to figure it out (but I would have gotten it eventually!).  I might post some methods to find your stream source or just let me know if you need some help!

Lastly, you can even capture streaming video!

Apparently; in WordPress there’s a bug that hasn’t been addressed.  Until it’s fixed I’ve hacked my site to ignore it by commenting out several lines of code that display the “catagories” section.  The problem that others are also having is this…as you make categories so you can properly sort your posts they don’t show up!  For the search engines:  WordPress categorizes not showing.  Back to my post, all I saw was, “Home” and “Uncatagorized”.  This was personally irritating and if I want to waste more time maybe I’ll look into it, but I’m not an “expert” which is why I said “I’ve hacked my site”.  I know enough to be dangerous, LOOKOUT!   I don’t think it’s a MySQL problem, hard disk problem, etc as some have posted if you search for it online although they said it fixed it for them.  It might be a permissions problem but I think that’s unlikely.  Permissions on my WordPress folder tree don’t seem to be it in my mind (but I won’t rule it out either).  If you’re an eager beaver and feel like doing the same thing I did this is what I did.  Oh, this is the site I was looking at when I got the brilliant idea to just change how the template works —> Here.

I commented out code to ignore the categories and only post my “pages” as my links, it’ll work for now since the home page shows everything in the “uncategorized” group anyway.  Now – there is one quirk here but it’s less irritating than the former quirk.  The quirk being, the “Home” link doesn’t get you back to the root page if you click your other page links but for me it’s something I can live with, if they want to go back to the root page they can click the top most URL.

In your theme folder (I’m using “pixel”):  /wp-content/themes/pixel

Edit this file and code, it might not look “exactly” like mine but it’ll be close!:  header.php

Original Code that listed the pages in the upper right hand of the page:

div id=”topright“>
<ul>
<?php wp_list_pages(‘depth=1&title_li=0&sort_column=menu_order’); ?>
<li><a href=”#searchform”>search</a></li>
<li><a href=”#main”>skip to content &darr;</a></li>
</ul>
</div>
<div></div>
</div> <!– Closes header –>

Comment out the PHP with // and leave the rest unless you don’t want it:

<?php // wp_list_pages(‘depth=1&title_li=0&sort_column=menu_order’); ?>

I then edited the code below  to list the pages instead of the categories:

Original Code, not this is NOT the same code we just edited, this code is what should be next in line in your header.php:

<div id=”catnav”>
<div id=”toprss”><a href=”<?php bloginfo(‘rss2_url’); ?>”><img src=”<?php bloginfo(‘template_directory’); ?>/images/rss-trans.png” alt=”<?php bloginfo(‘name’); ?>” width=”65″ height=”24″ /></a></div> <!– Closes toprss –>
<ul id=”nav”>
<li><a href=”<?php echo get_option(‘home’); ?>”>Home</a></li>
<?php wp_list_categories(‘sort_column=name&title_li=&depth=2′); ?>
</ul>
</div> <!– Closes catnav –>

Edit this line and change to list pages, the part in ITALICS is from the original code listing it “topright”:

<?php wp_list_pages(‘depth=1&title_li=0&sort_column=menu_order’); ?>

Results: Took catagories not showing away all together and replaced them with normal page links but on the homepage the uncatagorized posts still show as default which is still sort of a problem but much better than the original problem.  If you rename your originals and keep them you can easily flip back once the real solution is found!  Keep digging and let me know if you find it, I’ll do the same if I find it.

Blackle.com!

No comments

Anyone know why I have a mainly black website or why I really do use Blackle when I can to search instead of Google?  It actually takes less power on your computer monitor / screen to render black than it does other colors, long live dark websites not because I’m a fan of a Gothic culture but because it’s the green thing to do!  Lastly – even though your family will shun you for doing this; set your computer desktop wallpaper to pure black.  If they ask tell them you’d rather see them in person than look at their picture.

Know more about how Blackle saves energy and you can save energy too —> Here!

Categories are NOT WORKING, come on!  I even forced an upgrade which I must say went as smooth as butter, great job WP people.

* The “real” fix is to make your categories, make your post, then put your post into that category!  If your category doesn’t have a post in it WordPress is smart enough not to even show it…brilliant huh?  It’s that simple!  WOW I have egg on my face :-)

Powered by WordPress Web Design by SRS Solutions © 2010 RafaelWolf.com Design by SRS Solutions
7 visitors online now
7 guests, 0 members
Max visitors today: 7 at 07:32 am GMT+5
This month: 14 at 09-07-2010 06:16 pm GMT+5
This year: 36 at 08-30-2010 02:32 am GMT+5
All time: 36 at 08-30-2010 02:32 am GMT+5