Hilarious, isn't it?
Hilarious, isn't it?
Javascript sprites weren’t as difficult as I thought. With a little bit of help, math, some css, js, images (of course) a decent animation can be shown without using any flash at all. I coupled it in a small class Animator, and wrote a small demo for anybody interested in using it.
Amazing trick with javascript
Goto a page which has lots of images like this.
Now paste the below line in the address bar, and hit Enter.
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0);
Sit back, and watch the fun !
After racking my brains for almost 4 days (yeah I am a slow learner) I finally created a simple Javascript string combination generator
See the demo http://naiksblog.info/stringcombinations.html
I tried modeling the logic to how databases combine sets in a cross join. All rows from left side are combined with all rows from right side.
The script is as below
function combine(a, b) {
var r= new Array();
for(var i= 0, k= 0; i < a.length; i++) {
for(var j= 0; j < b.length; j++) {
if(-1==a[i].indexOf(b[j])) r[k++]= a[i]+ b[j];
}
}
return(r);
}
You can call this as below
function permute() {
var a= "abcd";
var p= new Array();
for(var i= 0; i< a.length; i++) p[i]= a.charAt(i);
var r= p; // Input string as-is is first permutation
for(var i= 1; i< a.length; i++) r= combine(r, p); // Get the permutations
// r.length - Get the combinations
// r contains all combinations as an array
}
Some points worth noting
I created a very simple (but fully working) Tic Tac Toe game to enjoy
http://www best weight loss diet pills.naiksblog.info/tictactoe.html
Much recently to my dismay, I figured out that I cannot remove Symantec’s Endpoint Protection from my own laptop without administrator password. I do not own this password, and I do not want anybody other than me permitting me what to uninstall. Hence I went ahead for manual uninstall according to these instructions (from Symantec’s own site) below-
The instructions are crisp and clear. I could manually uninstall following each step of those instructions, but there is one big trouble. The instructions talk to removing over 100’s of registry keys, values which I believe is sheer impossible manually. Why didn’t Symantec simply provide a small tool which has all those instructions bundled in a simple click-n-go fashion?
I have tried to create a small registry file which can automate the removal of registry entries Uninstall Registry entries for Symantec Endpoint Protection
For all other manual deletion of files, it would be great to write a small AutoIt script compiled to an exe. Maybe sometime later…
1)On solr.master: +Edit scripts.conf: solr_hostname=localhost solr_port=8983 rsyncd_port=18983 +Enable and start rsync: rsyncd-enable; rsyncd-start +Run snapshooter: snapshooter After running this, you should be able to see a new folder named snapshot.* in data/index folder. You can can solrconfig.xml to trigger snapshooter after a commit or optimise. 2) On slave: +Edit scripts.conf: solr_hostname=solr.master solr_port=8986 rsyncd_port=18986 data_dir= webapp_name=solr master_host=localhost master_data_dir=$MASTER_SOLR_HOME/data/ master_status_dir=$MASTER_SOLR_HOME/logs/clients/ +Run snappuller: snappuller -P 18983 +Run snapinstaller: snapinstaller You should setup crontab to run snappuller and snapinstaller periodically.
I came across an interesting cron issue recently. The requirement was to run a job every _first_ Sunday at 12:00PM of each month.
After searching across various sites, skimming through cron manpages, I finally found the following one-liner
0 0 1-7 * 0 <user> <job>
Can you believe this simple solution? The reasoning is that Sun will be between 1 to 7th of each month. Once a Sun comes, the job will execute between 1st and 7th just once. After that any further Sundays will have a date greater than 7, and thus never execute!
Sometimes, the simplest solution is the most elegant. BTW, I had read about many other complicated solutions, such as having your own logic to determine the day, apple script, bash script solutions. I was about to give up, when I hit the jackpot! 😀