Jan 262010

You may have noticed that I am using the super slick SuperSlider-Login plugin on this site.  You can see it in the top right corner of the page.
SuperSlider Login

I noticed that it works perfectly in FireFox but IE8 just refused to render the CSS properly.  Anyhow, under the SuperSlider plugin settings, I chose the black appearance and vertical display. The plugin worked as expected in FF but under IE8, when I clicked on “Log In” button, IE8 would only drop the slider about 10px and not display anything else.

To fix this issue, I had to edit the black_vertical.css file under the /wp-content/plugins/superslider-login/plugin-data/superslider/ssLogin/black/

In the .css file, find the #loginpanel section and simply add Height: 240px; or whatever height you want to give it. I chose 240px but you can play with it to fit your needs. This fix doesn’t seem to affect Firefox. It may or may not work for you, but that’s what I did and now it seems to display properly.

Jan 242010

Okay so it’s been a year since my last post, sue me!

So lately I’ve been preoccupied with learning Ruby.  Ruby is a very sweet language, I won’t go into the reasons why, that’s what google is for.  This post is about my first attempt at coding in Ruby. Here’s the scenario, I have an external Hard Drive with around 1TB(1602 files) of AVI files.  These files are in sub directories named by date.  The AVI’s are from my security DVR system and as such are not compressed very well.  Each file takes up between 500mb to 1 gig of space.  I have been transcoding them with FFmpeg manually for the last few days, and knew I could write a simple Bash script to do it for me.  Since I have been bored with doing things the easy way, I thought “Let’s learn a new language just for this task!”.  Stupid, huh?  Anyways,  So I set out to learn Ruby.  Now, I am certainly no expert and I know my coding will probably make Ruby guru’s gag, but it works for me and you are more than welcome to use it at your own risk.  I take no responsibility in you deleting all your files or formatting your system.

GOAL: Recursively find and transcode all files matching the user inputted file extension.

Prerequisites:

Linux (I personally use CentOS 5.4)
FFmpeg compiled with h.264 and libfaac (which is beyond the scope of this post)

Ruby
ProgressBar library for ruby

Now on to the Code:

Okay, so these first four lines are pretty self explanatory. If not, then you need to start learning Ruby or any language for that matter.
Fire up your favorite editor and insert the following:

#!/usr/bin/env ruby
require 'ftools'
require 'progressbar'
require 'find'

Next:
This tells ruby to clear the screen, Let’s start with a blank screen.
system ('clear')

Let’s create some functions:
The first function simply converts a measurement of time in seconds to days, hours, minutes, and seconds are returns a string with these values.
The second one simply defines three variables, start_time, end_time. and elapsed_time. The yield statement basically tells ruby to pause this function after defining the start_time variable, continue processing the main code (which we’ll get to in a second), and come back here once we’re done below.


def secs_to_days (secs)
  days = ((secs / 60) / (60 * 24)).floor
  hours = (((secs / 60) % (60 *24)) / 60).floor
  minutes = (secs / 60) % 60
  seconds = secs % 60
 "Conversion took #{days.to_s} days, 
  #{hours.to_s} hours 
  #{minutes.to_s} minutes 
  and #{seconds.to_s} seconds."
end

def elapsed_time
  start_time = Time.now
  yield
  end_time = Time.now  
  elapsed_time = end_time.to_i - start_time.to_i
end

This function simply presents the user with some questions and gathers the responses into an array and returns the array.


def user_input
  responses = Array.new
  recurse, delete = nil
  print "What type of file are we going to look for? "
  filetype = gets.chomp!
  responses.push filetype
  print "What is the full path where we should begin searching? "
  basedir = gets.chomp!
  responses.push basedir
  print "Should we search recursively? (y/n) "
  recurse = gets.chomp!
  if /y/i =~ recurse
    recurse = true
  else
    recurse = false
  end
  responses.push recurse
  print "Delete the original files after conversion? (y/n) "
  delete = gets.chomp!
  if /y/i =~ delete
    delete = true
  else
    delete = false
  end
  responses.push delete

  return responses
end

Now we’re getting to the meat and bones. The find_files function does exactly that. It is passed our array from the previous function, uses our responses to set our starting directory, the type of file we are looking for and to either search only the current directory or to search recursively.


def find_files(criteria)
  puts "Beginning Filesystem Search for specified files..."
  puts "We will search for all files with an extension of #{criteria[0]}"
  puts "Beginning in the directory named #{criteria[1]} and will"
  if criteria[2] == true
    puts "Search Recursively"
  else
    puts "NOT Search Recursively"
  end

  file_stack = Array.new

  if criteria[2] == true
    Find.find(criteria[1]) do |filename|
      if File.extname(filename) == criteria[0]
        file_stack.push filename
      else
        next
      end
    end
  elsif criteria[2] == false
    puts Dir.glob("*#{criteria[0]}")
    file_stack = Dir.glob("*#{criteria[0]}")

  else
    puts "Oops, I broke!"
  end

  return file_stack
end

Okay, now this is the main function. The first two lines setup our progress bar. Then we start a loop to process our array of found files and transcode each one in turn using FFmpeg into an h.264 video and depending on our responses, will either delete the original file or not. I am also dumping all output from FFmpeg into log files, so if a problem arises, I can see what happened. After each file is transcoded, we tell our progress bar to update. Then, when our loop has reached the end, we tell our progress bar that we are done. One thing to note… my FFmpeg command line is predetermined. Meaning, I already know how many streams my AVI files have and how I want to process them. You will need to modify the FFmpeg command line to suit your needs.


def convert_video(filename, criteria)
  pbar = ProgressBar.new("Conversion",100)
  pbar_step = 100 / filename.nitems
  filename.each do |video|
    myfile_extension = File.extname(video)
    myfile_basename = File.basename(video,myfile_extension)
    myfile = File.dirname(video)+"/"+myfile_basename
    system "ffmpeg -y -i #{video} -map 0.0 -map 0.1 -map 0.2 -map 0.3 \ 
      -acodec libfaac -ab 64k -ac 2 -vcodec libx264 -r 29.97 -s 640x480 \
      -vpre hq -crf 22 -threads 0 -f mp4 #{myfile}.mp4 -vcodec libx264 \
      -r 29.97 -s 320x240 -vpre hq -crf 22 -newvideo -acodec libfaac \
      -ab 64k -ac 2 -newaudio 2>> ffmpeg.log 1>> ffmpeg.error.log" 
    system "rm -rf #{video}" if criteria[3] == true
    pbar.inc(pbar_step)
  end
  pbar.finish
end

This is where the main execution of our program starts. We have a variable named criteria which is initialized with our function user_input. The same goes for the variable named file_stack, except that the find_files function is passed our criteria variable. Then we just print out a line indicating how many files our little program found.


criteria = user_input()

file_stack = find_files(criteria)

puts "Looks like we\'ve found #{file_stack.nitems}"

And this last bit of code ties it all together. If we have files to process, then let the transcoding begin, if not, We’re Done!


if file_stack.nitems > 0
  print "Press Enter to begin Transcoding or CTRL-C to cancel."
  gets
  convert = elapsed_time {
    convert_video(file_stack, criteria)
  }
puts secs_to_days(convert)

else
  puts "Sorry, I couldn't find any files to process... Exiting!"
end

Now save your file. You can name it anything you want with an .rb extension. chmod +x it. Now run it.

Click here to see the entire source code. Use it as you will, but at your own risk.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
  • Buy Cheapest generic viagra from india Online Pharmacy Store. WorldWide Shipping.
  • Buy Cheap levitra cialis Online Pharmacy At The Best Price! Pharmacy Store.
  • Buy Cheapest generic levitra cheap Online WorldWide Shipping. Guaranteed Shipping.
  • Buy Cheap medication levitra Now Special Prices For medication levitra! WorldWide Shipping.
  • Buy Cheapest cialis fast shipping Now Online Prices For cialis fast shipping! Best Drugstore.
  • Buy Cheap cialis online discount Now Best Internet. 100% Satisfaction Guaranteed.
  • Buy Cheap viagra england Online Discount Pharmacy Online. Best Internet.
  • generic name for cialis Online Without Prescription Online Medical Shop. Low Prices.
  • Buy Cheap viagra on line Online Cheap Pharmacy Online. Online Medical Shop.
  • Buy Cheapest viagra 50 mg or 100mg Now WorldWide Shipping. Cheap Online Pharmacy.
  • Buy online levitra Without Prescription Doctor. Low Prices. Pharmacy Store.
  • Buy Cheap cialis propecia viagra Online No Prescription Needed. Best Internet.
  • Buy Cheapest women consume viagra Online Pharmacy Store. Cheap Online Pharmacy.
  • Buy Cheap chewable viagra Now Guaranteed Shipping. Drugs, Health And Beauty.
  • Buy woman's viagra Without Prescription Doctor. Best Prices. Best Internet.
  • Buy Cheap viagra free trial Now Pharmacy At The Best Price! Low Prices.
  • Buy Cheap about viagra Now Guaranteed Shipping. Cheap Pharmacy Online.
  • Buy Cheapest why do men take cialis Now Best Drugstore. Online Prices For why do men take cialis!
  • purchase levitra Online Without Prescription Best Prices. Pharmacy Store.
  • Buy Cheapest herbal viagra in the uk Now Best Drugstore. Drugs, Health And Beauty.
  • Buy Cheapest viagra doses Online Special Prices For viagra doses! Low Prices.
  • Buy Cheap side effects of cialis overdose Now WorldWide Shipping. 24/Online Pharmacy.
  • Buy Cheap buy discount cialis Online 100% Satisfaction Guaranteed. Best Online.
  • Buy Cheapest compare cialis viagra Online Best Online. Cheap Online Pharmacy.
  • Buy Cheapest viagra trial Online Get FDA Approved Prescription Medicines.
  • Buy Cheap comparison cialis levitra viagra Online Cheap Online Pharmacy. Best Internet.
  • Buy Cheap cialis cheapest Now No Prescription Needed. Best Drugstore.
  • free cialis Online Without Prescription Pharmacy Store. Best Drugstore.
  • Buy Cheap viagra canadian pharmacy Now Order Cheap Meds Without Rx. Best Online.
  • viagra sex domination Online Without Prescription Low Prices. Best Internet.
  • Buy Cheapest low cost levitra Now Guaranteed Shipping. Top Online Pharmacy.
  • Buy Cheapest viagra experiences Now Cheap Prescription Drugs. Pharmacy Store.
  • Buy Cheap viagra fast Online Best Online. Drugs, Health And Beauty.
  • Buy Cheap levitra information page Online Best Prices. Online Prices For levitra information page!
  • Buy Cheapest viagra purchase uk Now Low Prices. Pharmacy At The Best Price!
  • Buy Cheap viagra women Now Best Drugstore. No Prescription Needed.
  • Buy Cheap overnight shipping of cialis Online Special Prices For overnight shipping of cialis! Low Prices.
  • Buy Cheap find cialis from mexico Online Best Internet. Pharmacy At The Best Price!
  • Buy Cheapest sacramento buy cialis Now Pharmacy At The Best Price! Pharmacy Store.
  • Buy Cheap viagra free shipping Now Best Internet. Cheap Prescription Drugs.
  • Buy Cheapest natural substitute for viagra Online Cheap Prescription Drugs. Best Prices.
  • levitra size Online Without Prescription Best Prices. Best Drugstore.
  • Buy Cheap where buy cialis Now 24/Online Pharmacy. Top Online Pharmacy.
  • Buy Cheapest cialis cost low Online Best Prices. Drugs, Health And Beauty.
  • Buy Cheapest woman's viagra Online Best Prices. Cheap Prescription Drugs.
  • Buy Cheap buy levitra online Now Best Internet. Cheap Prescription Drugs.
  • Buy Cheap very cheap cialis Now Safe And Secure Payment System. Best Internet.
  • Buy Cheap overnight shipping of professional cialis Now Free Viagra Pills! Special Prices For overnight shipping of professional cialis!
  • generic cialis overnight delivery Online Without Prescription Low Prices. Guaranteed Shipping.
  • Buy Cheapest viagra women Now Internet Prices For viagra women! Best Online.
  • Buy Cheap buy cialis on line Now Cheap Pharmacy Online. Top Online Pharmacy.
  • Buy Cheap viagra supplement Now No Prescription Needed. Free Viagra Pills!
  • Buy Cheapest us presciption cialis Online Best Online. Online Medical Shop.
  • Buy Cheapest impotence and viagra Now Drugs, Health And Beauty. Best Drugstore.
  • Buy Cheapest buy cheap uk viagra Now Best Drugstore. Drugs, Health And Beauty.
  • Buy Cheap buy super viagra Now Top Online Pharmacy. Discount Pharmacy Online.
  • Buy Cheapest viagra for sex Now Drugs, Health And Beauty. Best Online.
  • Buy Cheap cialis and viagra together Now Internet Prices For cialis and viagra together! Best Drugstore.
  • Buy Cheapest overnight cialis delivery Now No Prescription Needed. Free Viagra Pills!
  • Buy Cheapest levitra results Now Guaranteed Shipping. Top Online Pharmacy.
  • Buy Cheap cheap cialis Now Order Cheap Meds Without Rx. Best Online.
  • cialis 20 Online Without Prescription Low Prices. Pharmacy Store.
  • Buy Cheap generic viagra sildenafil citrate Now Low Prices. Bonus Pills And Reorder Discounts!
  • Buy Cheap cialis soft Now Buy Medications Online. WorldWide Shipping.
  • Buy Cheap viagra effects on women Online Low Prices. Pharmacy At The Best Price!
  • Buy Cheapest levitra pro Now Cheap Prescription Drugs. Best Prices.
  • Buy Cheapest cialis 5mg cheap Now 100% Satisfaction Guaranteed. Best Online.
  • Buy Cheap levitra drug Online 100% Satisfaction Guaranteed. Low Prices.
  • Buy Cheap levitra result Now Best Drugstore. Online Prices For levitra result!
  • Buy Cheap when to take viagra Now Cheap Online Pharmacy. 24/Online Pharmacy.
  • Buy Cheap erectile dysfunction cialis Online Cheap Online Pharmacy. Best Internet.
  • Buy Cheap viagra 6 free samples Online Pharmacy Store. Cheap Online Pharmacy.
  • Buy Cheap lowest prices cialis Now Top Online Pharmacy. No Prescription Needed.
  • Buy Cheap buy viagra prescription Now Pharmacy At The Best Price! Best Online.
  • Buy Cheapest buy viagra line Now Internet Prices For buy viagra line! Low Prices.
  • Buy Cheapest cialis cream Now WorldWide Shipping. Buy Medications Online.
  • Buy Cheap side affects of levitra Online Top Online Pharmacy Supplier. Best Online.
  • Buy Cheap how much is daily cialis Online Best Prices. The Largest Internet Pharmacy.
  • Buy Cheapest viagra flomax Online Best Drugstore. Guaranteed Shipping.
  • Buy Cheapest cialis and diazepam overnight delivery possible Now Online Medical Shop. 24/Online Pharmacy.
  • Buy Cheapest cialis and levitra viagra online brand Online Drugs, Health And Beauty. Best Prices.
  • pfizer viagra online Online Without Prescription Best Drugstore. Best Prices.
  • Buy Cheapest cialis generic price Now Online Medical Shop. Top Online Pharmacy.
  • Buy Cheap price for generic viagra Now Guaranteed Shipping. 24/Online Pharmacy.
  • Buy Cheap side affects of viagra Now Best Online. FDA Approved Rx: Online Pharmacy.
  • Buy Cheapest sperm count and levitra Now Internet Prices For sperm count and levitra! Best Prices.
  • Buy Cheapest buying cialis online guide Now Best Prices. Top Online Pharmacy Supplier.
  • Buy Cheapest cheap cialis generic mastercard Online Buy Medications Online. Best Prices.
  • Buy Cheapest cialis tablet size Online Cheap Prescription Drugs. Low Prices.
  • Buy Cheap viagra vs levitra reviews Now The Largest Internet Pharmacy. Low Prices.
  • non-prescription generic cialis Online Without Prescription Best Prices. Best Internet.
  • Buy Cheapest levitra 20 Now Low Prices. Cheap Prescription Drugs.
  • Buy Cheapest bayer levitra online pharmacy cheapest Now Low Prices. Safe And Secure Payment System.
  • Buy Cheap cialis usage Online Pharmacy Store. Drugs, Health And Beauty.
  • Buy Cheapest bayer levitra professional pro Now Internet Prices For bayer levitra professional pro! Best Drugstore.
  • Buy Cheapest levitra from canada Online Cheap Prescription Drugs. Best Prices.
  • Buy Cheapest cheap cialis Now Top Online Pharmacy. Best Drugstore.
  • Buy levitra from mexico Online Without Prescription. Low Prices. Best Drugstore.
  • Buy Cheap safe viagra Online Best Drugstore. Cheap Prescription Drugs.
  • Buy Cheap how to buy viagra online Now 24/Internet)(safe Pharmacy. Best Prices.
  • Welcome BrainYang.com

    Log in

    Lost your password?

    Register For This Site

    Join

    Join us as we spread the word.