Dynamically Created iFrame Loads Wrong Source URL on Reload / Refresh

This is a known FF bug.

Ref­er­ence this URL for the exact bug and it’s sta­tus: https://bugzilla.mozilla.org/show_bug.cgi?id=279048

There should be few hacks to avoid this bug but here is one solu­tion using Javascript.

Run fol­low­ing after all iFrames are generated/written.

var f=document.getElementsByTagName("iframe");

for(var i=0;i<f.length;i++){
     if(f[i].src.substr(f[i].src.length-1)=="#") f[i].src=f[i].src.substr(0,f[i].src.length-1);
     else f[i].src=f[i].src+"#";
}

Basi­cally loops through all iFrames and add # to URL source.
By doing so updates Fx with the cor­rect URL instead of any cached ones.

Magento Login Keep Redirecting Back (Cant Login)

Mine hap­pened when I installed the Magento on Local­host (Apache).

Prob­lem:

I had a new instal­la­tion of magento. But I was unable to login as an admin­is­tra­tor. I went to the admin login page, entered cor­rect user­name and pass­word but was redi­rected to the same login page. I could not enter the dash­board page. Error mes­sage is dis­played when I enter wrong user­name or pass­word. But noth­ing is dis­played and I am redi­rected to the same login page when I insert cor­rect user­name and password.

Solu­tion:

I googled and found these solutions:-

1) Use 127.0.0.1 instead of local­host in your url, i.e. using http://127.0.0.1/magento/index.php/admin instead of
http://localhost/magento/index.php/admin . But this didn’t solve my problem.

2) Since I am using Win­dows XP, I was sug­gested to open “host” file from
C:\WINDOWS\system32\drivers\etc and have 127.0.0.1 point to some­thing like magento.localhost or even 127.0.0.1 point to http://www.localhost.com . But this also didn’t work either.

3) This solu­tion finally helped me out of this prob­lem. The solu­tion was to mod­ify the core Magento code. Open app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Com­ment out the lines 80 to 83. The line num­ber may vary accord­ing to the Magento ver­sion. But these lines are present some­where near line 80.

// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()//,
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

Update (For Magento 1.4.*)

In Magento 1.4, you have to com­ment code from line 86 to 98 in app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Like this:

/*  if (!$cookieParams['httponly']) {
	unset($cookieParams['httponly']);
	if (!$cookieParams['secure']) {
		unset($cookieParams['secure']);
		if (!$cookieParams['domain']) {
			unset($cookieParams['domain']);
		}
	}
}

if (isset($cookieParams['domain'])) {
	$cookieParams['domain'] = $cookie->getDomain();
} */

Add www using .htaccess redirect

If you are like me, where your web­site shows two dif­fer­ent ver­sions when access­ing your domain with www and with­out www, then you may want to redi­rect all access with­out www to the cor­rectly show­ing ver­sion with www.
This may sound very con­fus­ing to some peo­ple… so here is another way to explain it.

If you add below code to your .htac­cess (this is the file name) on your root folder of your domain, it will redi­rect:
Access to your web­site using (yourdomain.com) to (www.yourdomain.com).

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Disable Right Mouse Click in Flash on Facebook App AS3

import flash.display.StageQuality;
stage.quality = StageQuality.BEST;
stage.showDefaultContextMenu=false;

Just add below line of code into Action­script class of your action­script 3 flash file.

stage.showDefaultContextMenu=false;

How to Restore Desktop Recycle Bin / Trash

Have you acci­den­tally removed the trash bin from your desktop?

Here is how you can restore it.

  • Click Start -> Run -> type Con­trol desk.cpl„@Web and press Enter
  • In the Desk­top Icon Set­tings dia­log, enable the Recy­cle Bin checkbox
  • Click OK

Page Conditioning — Wordpress Theme Editing

If you are start­ing to learn about Word­press theme edit­ing, you will prob­a­bly come across a sit­u­a­tion where you need to iden­tify which page is being dis­played to add or remove spe­cific image or asset to that par­tic­u­lar page. For exam­ple, you may want to find out if the cur­rent page is Home­page or Con­tact us page.

In this case, you need to add page conditioning.

It is actu­ally stan­dard fea­ture of Word­press but not many peo­ple are aware that there already is a page setup in Word­press web­site on this exact topic.

Visit fol­low­ing page to read about page con­di­tion­ing in detail: http://codex.wordpress.org/Conditional_Tags

RUN commands for Windows XP / Windows VISTA

For all those geeks out there includ­ing myself who wants to look cool with short­cut or quick run com­mands, below are the com­mands for fre­quently accessed pro­gram / tools on Win­dows. Most will work for Vista as well.

Pro­gram / Tool
Run Com­mand
Acces­si­bil­ity Controls access.cpl
Acces­si­bil­ity Wizard accwiz
Add Hard­ware Wizard hdwwiz.cpl
Add/Remove Pro­grams appwiz.cpl
Admin­is­tra­tive Tools con­trol admintools
Adobe Acro­bat (if installed) acro­bat
Adobe Designer (if installed) for­mde­signer
Adobe Dis­tiller (if installed) acrodist
Adobe ImageReady (if installed) imageready
Adobe Pho­to­shop (if installed) pho­to­shop
Auto­matic Updates wuaucpl.cpl
Blue­tooth Trans­fer Wizard fsquirt
Cal­cu­la­tor calc
Cer­tifi­cate Manager certmgr.msc
Char­ac­ter Map charmap
Check Disk Utility chkdsk
Clip­board Viewer clip­brd
Com­mand Prompt cmd
Com­po­nent Services dcom­c­nfg
Com­puter Management compmgmt.msc
Con­trol Panel con­trol
Date and Time Properties timedate.cpl
DDE Shares dde­share
Device Man­ager devmgmt.msc
Direct X Con­trol Panel (if installed)* directx.cpl
Direct X Troubleshooter dxdiag
Disk Cleanup Utility clean­mgr
Disk Defrag­ment dfrg.msc
Disk Man­age­ment diskmgmt.msc
Disk Par­ti­tion Manager diskpart
Dis­play Properties con­trol desktop
Dis­play Properties desk.cpl
Dis­play Prop­er­ties (w/Appearance Tab Preselected) con­trol color
Dr. Wat­son Sys­tem Trou­bleshoot­ing Utility drwtsn32
Dri­ver Ver­i­fier Utility ver­i­fier
Event Viewer eventvwr.msc
Files and Set­tings Trans­fer Tool migwiz
File Sig­na­ture Ver­i­fi­ca­tion Tool sigverif
Find­fast findfast.cpl
Fire­fox (if installed) fire­fox
Fold­ers Properties fold­ers
Fonts con­trol fonts
Fonts Folder fonts
Free Cell Card Game free­cell
Game Con­trollers joy.cpl
Group Pol­icy Edi­tor (XP Prof) gpedit.msc
Hearts Card Game mshearts
Help and Support helpctr
Hyper­T­er­mi­nal hyper­trm
Iex­press Wizard iex­press
Index­ing Service ciadv.msc
Inter­net Con­nec­tion Wizard icwconn1
Inter­net Explorer iex­plore
Inter­net Properties inetcpl.cpl
Inter­net Setup Wizard inetwiz
IP Con­fig­u­ra­tion (Dis­play Con­nec­tion Configuration) ipcon­fig /all
IP Con­fig­u­ra­tion (Dis­play DNS Cache Contents) ipcon­fig /displaydns
IP Con­fig­u­ra­tion (Delete DNS Cache Contents) ipcon­fig /flushdns
IP Con­fig­u­ra­tion (Release All Connections) ipcon­fig /release
IP Con­fig­u­ra­tion (Renew All Connections) ipcon­fig /renew
IP Con­fig­u­ra­tion (Refreshes DHCP & Re-Registers DNS) ipcon­fig /registerdns
IP Con­fig­u­ra­tion (Dis­play DHCP Class ID) ipcon­fig /showclassid
IP Con­fig­u­ra­tion (Mod­i­fies DHCP Class ID) ipcon­fig /setclassid
Java Con­trol Panel (if installed) jpicpl32.cpl
Java Con­trol Panel (if installed) javaws
Key­board Properties con­trol keyboard
Local Secu­rity Settings secpol.msc
Local Users and Groups lusrmgr.msc
Logs You Out Of Windows logoff
Mali­cious Soft­ware Removal Tool mrt
Microsoft Access (if installed) msac­cess
Microsoft Chat win­chat
Microsoft Excel (if installed) excel
Microsoft Front­page (if installed) frontpg
Microsoft Movie Maker moviemk
Microsoft Paint mspaint
Microsoft Pow­er­point (if installed) pow­erpnt
Microsoft Word (if installed) win­word
Microsoft Syn­croniza­tion Tool mob­sync
Minesweeper Game win­mine
Mouse Prop­er­ties con­trol mouse
Mouse Prop­er­ties main.cpl
Nero (if installed) nero
Net­meet­ing conf
Net­work Connections con­trol netconnections
Net­work Connections ncpa.cpl
Net­work Setup Wizard netsetup.cpl
Notepad notepad
Nview Desk­top Man­ager (if installed) nvtuicpl.cpl
Object Pack­ager pack­ager
ODBC Data Source Administrator odbccp32.cpl
On Screen Keyboard osk
Opens AC3 Fil­ter (if installed) ac3filter.cpl
Out­look Express msimn
Paint pbrush
Pass­word Properties password.cpl
Per­for­mance Monitor perfmon.msc
Per­for­mance Monitor perf­mon
Phone and Modem Options telephon.cpl
Phone Dialer dialer
Pin­ball Game pin­ball
Power Con­fig­u­ra­tion powercfg.cpl
Print­ers and Faxes con­trol printers
Print­ers Folder print­ers
Pri­vate Char­ac­ter Editor eud­cedit
Quick­time (If Installed) QuickTime.cpl
Quick­time Player (if installed) quick­time­player
Real Player (if installed) realplay
Regional Set­tings intl.cpl
Reg­istry Editor regedit
Reg­istry Editor regedit32
Remote Access Phonebook ras­phone
Remote Desk­top mstsc
Remov­able Storage ntmsmgr.msc
Remov­able Stor­age Oper­a­tor Requests ntmsoprq.msc
Resul­tant Set of Pol­icy (XP Prof) rsop.msc
Scan­ners and Cameras sticpl.cpl
Sched­uled Tasks con­trol schedtasks
Secu­rity Center wscui.cpl
Ser­vices services.msc
Shared Fold­ers fsmgmt.msc
Shuts Down Windows shut­down
Sounds and Audio mmsys.cpl
Spi­der Solitare Card Game spi­der
SQL Client Configuration cli­confg
Sys­tem Con­fig­u­ra­tion Editor sysedit
Sys­tem Con­fig­u­ra­tion Utility mscon­fig
Sys­tem File Checker Util­ity (Scan Immediately) sfc /scannow
Sys­tem File Checker Util­ity (Scan Once At The Next Boot) sfc /scanonce
Sys­tem File Checker Util­ity (Scan On Every Boot) sfc /scanboot
Sys­tem File Checker Util­ity (Return Scan Set­ting To Default) sfc /revert
Sys­tem File Checker Util­ity (Purge File Cache) sfc /purgecache
Sys­tem File Checker Util­ity (Sets Cache Size to size x) sfc /cachesize=x
Sys­tem Information msinfo32
Sys­tem Properties sysdm.cpl
Task Man­ager taskmgr
TCP Tester tcptest
Tel­net Client tel­net
Tweak UI (if installed) tweakui
User Account Management nusrmgr.cpl
Util­ity Manager util­man
Win­dows Address Book wab
Win­dows Address Book Import Utility wab­mig
Win­dows Backup Util­ity (if installed) ntbackup
Win­dows Explorer explorer
Win­dows Firewall firewall.cpl
Win­dows Magnifier mag­nify
Win­dows Man­age­ment Infrastructure wmimgmt.msc
Win­dows Media Player wmplayer
Win­dows Messenger msmsgs
Win­dows Pic­ture Import Wiz­ard (need cam­era connected) wiaacmgr
Win­dows Sys­tem Secu­rity Tool syskey
Win­dows Update Launches wupdmgr
Win­dows Ver­sion (to show which ver­sion of windows) win­ver
Win­dows XP Tour Wizard tourstart
Word­pad write

Free Game Design Scripts For Flash

Philip Rad­van has cre­ated an amaz­ing resource of FREE game related .fla exam­ples to down­load and use how­ever you like! This one gets two thumbs up from me. There are some excel­lent scripts under the effects cat­e­gory which I have per­son­ally used (non-game related).

Go check it out here:

http://www.freeactionscript.com/game-scripts/

Here are the AS2 links: (there are a few as3 scripts on his site).

Game Weapons

Effects Ani­mated

Effects Dynamic

Enemy AI Engine

Game Engine

Images/BitmapData

Inter­face

Math

Secu­rity

Sound

How to Show Facebook Share Summary/Blurb/Description

Face­book share image or descrip­tion not show­ing up?
Blurb about your arti­cle not showing?

Make sure you include these meta tags in your shared/linked pages.

<meta name="title" content="Page Title" />
<meta name="description" content="Description about the page, which will appear as the description of the link in Facebook." />
<link rel="image_src" href="Image URL of the thumbnail to appear on Facebook." />

How To Round A Number In AS3

Use below code to round up any num­ber to the spe­cific place.

function roundToNearest(roundTo:Number, value:Number):Number{
     return Math.round(value/roundTo)*roundTo;
}

Essen­tially you divide by the num­ber you want to round to which will give you a dec­i­mal num­ber. Then round that (essen­tially remov­ing the dec­i­mal) and mul­ti­ple by the round­ing num­ber to get you right back to where you were.

Exam­ple:

roundToNearest(100, 1234);
1234/100 = 12.34
Math.round(12.34) //12
12*100 = 1200