Sunday, August 29, 2010

Ah here is first post about the latest project . " Awesome.FM "

I haven't posted post in a while ...Reason: i was busy coding something :P .

Well.. let me tell you what is this new project i was working on.
It is something for music/videos fans/lover .

The first version is focused on music specifically.
I focused on some of the areas to really make it a good soothing music listening experience.

 Music should be quickly accessible and fast in responding

A music listening source should be quick to access and must be fast in responding to user commands .
Yep .. So to achieve that,  it is a light weight desktop application in Adobe Air around 2 Mega Bytes in size and it is lightning fast in processing because no junk code is there and it all coded for speed as ultimate goal.

Finding music of your taste cant be more easy
Sometime it is hard to find any good new songs , specially of your taste .
But this is not the case with " Awesome.fm ". When ever you open  Awesome.fm client, it shows you most recent listened/liked songs by a huge user-base and filtered by genre.

The genre it covers are  " Blues | Classical | Country & Folk | Electronic | Indie & Alternative | Jazz | More/Other | Pop | World Music | R&B & Soul | Rap & Hip-Hop | Religious | Rock " . enough eh ?


Available in all qualities possible
Okay The app is fast and it can help you find your song .You click played it but .. what about the quality ?? What if i have the slow speed internet connection.
Yeh that was confusion while i was making app. It was hard to guess what could be a feasible quality for every type of users.
To tackle that i offered all qualities available so user can best choose on based of his/her needs .
Trust me..  you can enjoy uninterrupted music even on your dial up  connection :P


It find the songs you will definitely like and auto-plays next
Next thing .Yeh you listened the songs and  it was fun .. but what next ? .. Do i need find a song again .
Answer is "Nop" The app find the songs related to the one you playing and it automatically plays next song when it is finished . cant be easy than this.



Thats all for the first version..

But... wait there is one more thing .It is for the geeks out there our  app supports search operators :D .
Supports search operators
This is one the features i really love .
For the time being it supports only 2 types of operators.More will come soon.

"in" ,"order"
There are limited set of  values for each operator.

in can be : 'film','autos','music','animals','sports','travel','shortmov','videoblog','games','comedy','people','news','entertainment','education','howto','nonprofit','tech','movies','shows','trailers'

order can be : 'relevance','published','viewcount','rating'

Imagine you want to see trailor of inception with highest views.
then do something like the screen shot.


Rules to use operators : 
  • Both Operators can be used same time.
  • An operator can be used with single possible value.
  • Operator use is case insensitive
  • There should be no space in operator and value.
Okay thats all for now .
Stay tuned for more and share with your friends .
Post comments here :P

Download the app here 

Saturday, July 17, 2010

A PHP script to delete files older than a spcecific time.

Okay here is the script written by me , to delete files older than a specific period (say 7 days).

Why i need this script ?
In the current project we need a system that seek and delete older files from FTP directory , older than 7 days .This script should run every week , will set a cron job for that which is not a issue here.

Well too much talking here is the code.

You are free to use/modify this code any way you want.But i am not responsible for any damage done by this code.

So use it only if u know how to use it :P

Any fixes/bugs/help please post in comments below .

<?php
set_time_limit(0);
//This class delets files n folder older than time specified
//Author :  Arshdeep Goswami <arshdeep79@gmail.com>

class DelOldfiles{
 var $older_than = NULL;
 var $total = 0;
 function __construct(){
  $this->older_than = mktime(date("H"),date("i"),date("s"),date("m"),date("d")-7,date("Y"));
 }
//Get all the files of the dir
 private function getAllfiles($dir){
  if(!is_dir($dir)) return false;
  $scaned = scandir($dir);
  array_shift($scaned);
  array_shift($scaned);
  $nsc = array();
  foreach($scaned as $sc)
   $nsc[] = "{$dir}/{$sc}";
  return $nsc;
 }
 
//Get size of the dir
 private function dirSize($directory) {
  $size = 0;
  foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){
   $size+=$file->getSize();
  }
  return $size;
 }
 
//Delete files recursively
 function delRecursive($dir){
  if(!is_dir($dir)) return false;
  $files = $this->getAllfiles($dir);
  if(empty($files)){
   return rmdir($dir);
  }  
  foreach($files as $key => $file){
   if(is_dir($file)){
    $this->delRecursive($file);
   }else if(file_exists($file)){
    unlink($file);
   }
  }
 //Once again calling after clearing file inside.
  return $this->delRecursive($dir);
 }
 
//Delete empty dirs
 function delEmptyDirs($dir){
  if(!is_dir($dir)) return false;
  $files = $this->getAllfiles($dir);
  $d_f = array();
  foreach($files as $key => $file){
   if(is_dir($file)){
    if($this->dirSize($file) > 0)
     $this->delEmptyDirs($file);
    else{
     $this->delRecursive($file);
    }
   }
  }
 }
 
 

//Call to delete every old file  
 public function del($dir){
  if(!is_dir($dir)) return false;
  $files = $this->getAllfiles($dir);
  $d_f = array();
  foreach($files as $key => $file){
   if(is_dir($file)){
    $this->del($file);
   }
   else if(file_exists($file)){
    $time = filemtime($file);
    if($this->older_than > $time){
     unlink($file);
     $total++;
    }
   }
  }
 } 
}


$obj = new DelOldfiles();
$f = $obj->del('D:\WINDOWS');
$f = $obj->delEmptyDirs('D:\WINDOWS');



The first post of SRBB

So here is the post of mine first blog.


Why i started this blog.
Many reasons to start a personal blog  here are some .

To remind myself
I think lots n lots of things each day but at the end of the day i forgat almost 50% of them and next morning the number increases to 70% and after 2-3 days its all blank :P.So there should be something that may remind me that i once thought that shi*.

To see what people think 
Each time you start on an idea it always looks awesome/rocking/cool/kickass to you. But ultimately it is people who will decide if it cool or not. So i wana feedback on what i am doing and what i will be.(I really expecting some cool comments on future posts :P )



To tell what i have learned .
Well i am not a pro tbh. So its good to write what i learned new (will post some code lines or tuts like things).I think it will be helpful for some newb coders to get in the race .



What you can expect from this blog

Nothing specific i can say about where this blog will go in future.But ATM i am really excited writing here .
Few things that you surely will not see here are .

Not copied/inspired thoughts from other blogs/books (thats lame ).
Not promotion of lame stuff.
No emotional crap (thats g*y).

Well i think finished with first post wana write more but have stuff to do . Stay tuned buddies ;)