Saturday, November 12, 2011

XML-Motor v0.0.3 ~ mine XML once..... multiple search

released v0.0.3 of xml-motor with following update: http://rubygems.org/gems/xml-motor

Earlier:
  * it just supported one search per every XML data processing
Now:
  * could retrieve processed XML 'Information' once, and search again & again with minimized cost

Now, along-with.....
  * a single method-call search for Tag (w/ or w/o Attribute) in provided XML String or File
You also have the capability to.....
  * fetch the two (or one, depends how you wanna roll) required set of Information mined by providing it XML String
  * then provide that information everytime to search anything, and hence making it way quicker for multiple searches


So, the improved way for multiple searches:

  First, update your 'xml-motor' gem using
    $ gem install xml-motor

  Now, the way to use it
#!/usr/bin/env ruby
require 'xml-motor'

fyl = File.open "myXMLfile.xml"
str = fyl.read
xNodes = XMLMotorEngine._splitter_ str
xTags = XMLMotorEngine._indexify_ xNodes
result1 = XMLMotorEngine.pre_processed_content(
            xNodes, xTags, "h1")

result2 = XMLMotorEngine.pre_processed_content(
            xNodes, xTags, "div", "class='wanted'")

Wednesday, November 9, 2011

[new portable algo] Easy XML Parsing using XML-Motor (currently just in Ruby)

Easy XML Parsing using XML-Motor 
(currently just implemented in Ruby as a Gem)
Using a new, compact algorithm of XML Partsing

===================================================
v 0.0.2
@GitHub: https://github.com/abhishekkr/rubygem_xml_motor

@RubyGems: http://rubygems.org/gems/xml-motor
===================================================

A new short XML Parsing Algorithm implemented in LessThan 200 Ruby lines.
An easy-to-use XML Parser without any Native Dependencies.

[How To Use]

Installing and Loading:
   + $ gem install xml-motor
   + in your ruby code: require 'xml-motor'

Usage:
  + To find values of an xml node from an xml file
      XMLMotor.get_node_from_file [file_name_with_path], [tag_name]
  + To find values of an xml node from an xml string
      XMLMotor.get_node_from_content [xml_data], [tag_name]
  + To find values of an xml node with a tag_name having required attribute
      XMLMotor.get_node_from_content [xml_data], [tag_name], [attr_key=attr_value]

Example Calls As Code:
 + XMLMotor.get_node_from_content "<A i='1'>a<A><B>b<C>c<C><A>ba<A><B>", "A"
     RETURNS: ["a", "ba"]
 + XMLMotor.get_node_from_content "<A i='1'>a<A><B>b<C>c<C><A>ba<A><B>", "B.A"
     RETURNS: ["ba"]
 + XMLMotor.get_node_from_content "<A i='1'>a<A><B>b<C>c<C><A>ba<A><B>", "A", "i='1'"
     RETURNS: ["a"]

===================================================

[Example Code]

require 'xml-motor'

puts XMLMotor.get_node_from_file "eloqjs.htm", "h1"
 
fyl = File.open("elogjs.htm")
XMLData = fyl.read

puts XMLMotor.get_node_from_content XMLData, "div.span"

puts XMLMotor.get_node_from_content XMLData, "div"

===================================================

Thursday, October 20, 2011

http_voodoo_mongo ~ remote control your MongoDB over HTTP

@github: https://github.com/abhishekkr/http_voodoo_mongo

project name: http_voodoo_mongo
platform:     linux
requirement:  ruby

usage: it's a remote controller for your local/remote MongoDB instances working over an HTTP mocking service

What it consists of?

[] a rakefile 'Rakefile' allowing you to auto install and start 'http_voodoo_mongo' as a system service using "rake http_mongo:install" task.

[] a ruby script 'mongo_voodoo.rb' which mocks HTTP Server and allows you control MongoDB using HTTP Requests.

[] a system service script 'mongo_voodoo' which enables you to start||stop||status||restart the Ruby Script as a System Service

*currently I've just added "mongodump" task to it (with & without authorization detail), will slowly add more..... it's all opensource, even you can update if you want


======================================================
a REST API for Remote Controlling MongoDB Server over HTTP using the same 'authentication' as of MongoDB Server

[] need to access the service at HTTP_URL => http://[MongoDB_IP]:30303/

[] Optional GET Request Parameters [name] the username permitted access [pass] the password linked to username [port] the port at which MongoDB Server is running

 ::MongoDB Database Backup 
  http://[MongoDB_IP]:30303/[db_name]?action=dump&dir=[dir]&more_switch=[more_switch]&userniame=[username]&password=[password]&port=[port] 

[] GET Parameters [dir] the directory to take in backup using mongodump [more_switch] any options you wanna add to mongodump command 
======================================================

Tuesday, August 9, 2011

Make *nix automatic re-spawn a process/service if stopped


To make your *nix system automatic re-spawn a process/service if stopped ~

Write a shell script to check for presence of a service and start it if it is not running.
Then attach that shell-script to a cronjob running at frequent intervals.

Example Script to monitor Apache HTTPD web server and start it if is not started ~
#!/bin/sh
pids_=`ps ax | grep /usr/sbin/httpd | grep -v grep | wc -l `
if [ $pids_ -ne 0 ];
then
     echo "Apache is running"
else
     echo "Apache was stopped. Starting..."
     apache_start_=`/etc/init.d/httpd start`
     if [ $? -eq 0 ];
     then
         echo "Apache Started Successfully"
     fi
fi
#############################
 this simply checks for HTTPD process to be present and re-spawn the service in absence of even a single process thread.

There is a wonderful Ruby utility "bluepill" to achieve the same solution in a more advanced and comfortable manner. Cover it sooooon.....

Thursday, July 28, 2011

derailed_cuke ~ now test any website using cucumber as an independent testing utility

GitHub Linkhttps://github.com/abhishekkr/abk-labs.cucumber
[] What is "Cucumber"?
+ http://cukes.info/
Cucumber lets software development teams define the behavior of any application in Business Readable DSL as plain text.
Hence serves as documentation, automated tests and development aid ~ All In One.


[] What is "derailed_cuke"?
+ Project Repo @GitHub


[] How To get "derailed_cuke"? + you could either clone the repo or download compressed project in following ways ~
Clone Repository:
#git clone git://github.com/abhishekkr/abk-labs.cucumber.git


[] Pre-requisites for "derailed_cuke"?
+ Ruby, RubyGems & Bundler Gem installed


[] How to use "derailed_cuke"?
+ The downloaded project would have a directory "abk-labs.cucumber" with a directory "derailed_cuke" inside it.
~~~~~~~~~~
Step#1 Now all you need to do is open a console, change current working directory to "derailed_cukes".|
Step#2 Run "#bundle install" to install all required gems.
|

Step#3 If your ruby binary file is accessible by any name other than 'ruby' {i.e. say you are jruby and thus access it using 'jruby'}; then edit the file "Fcuke.rb" and replace the value of variable "RUBY_BIN" in line number 2 with the name you access your Ruby Binary.
|
Step#4 
Now simple execute "
Fcuke.rb" and by default it will check for two (already present for testing) features checking Google.com and Twitter.com
|
Step#5 
To add custom web-application behavioral tests ~ user will need to write the custom Cucumber Features and respective Step Definitions {as in general scenario for using Cucumber}. For reference present feature and step definitions can be seen & used.

~~~~~~~~~~

[] Where to learn cucumber?
+ http://wiki.github.com/cucumber/cucumber/tutorials-and-related-blog-posts
In current release of "derailed_cuke", user need to know writing Cuke Features and Step Definitions.


………………………………………………………
[] Planned Goals for the Project involves
+ auto-generation of basic tests by analysis of application,
 then major task left would be to add uncovered custom tests
 and tweak the generated tests (if required).


………………………………………………………

Wednesday, June 22, 2011

Host Your Site on Google AppEngine in 7 Easy Steps

Project/Example Site: http://gae-flat-web.appspot.com



Host Your Site on Google AppEngine in 7 Easy Steps:
  1.  Register any $App at Google ApEngine using your Gmail Account
    {as if $App is you Application Name giving you url like $App.appspot.com}

  2.  Download the Python Script 'flat.py' provided on this site or from repo
  3.  Execute #python flat.py $App
  4.  It will created required structure in a dir $App
  5.  Copy all your static site to $App/flat_web/*
  6.  Download "Google AppEngine Python SDK"
  7.  Update this $App using Google AppEngine SDK as
        #python appcfg.py update $Path_to_App

[[ Your own Static Content Website served by Google AppEngine ]]

 It's GitHub Repository: https://github.com/abhishekkr/gae-flat-web

Wednesday, May 25, 2011

Cacti for IT infrastructure monitoring & graphing ~ TechXpress Guide

Cacti for IT infrastructure monitoring & graphing ~ TechXpress Guide

.::Task Details::.
[] Setting up Cacti for IT Infrastructure Service Graphing solution

@Scribd: http://www.scribd.com/doc/54585795/A-TechXpress-Guide-Cacti-for-IT-Service-Monitoring-Graphing?in_collection=3004309

@Slideshare: http://www.slideshare.net/AbhishekKr/an-express-guide-cacti-for-it-infrastructure-monitoring-graphing
A TechXpress Guide Cacti for IT Service Monitoring Graphing