PHP Functions to JS

Friday, June 19, 2009

Have you ever encountered a problem in coding your Javascript and can only think using the PHP defined functions as a solution?

Well you're not the only web developer who have experienced that. As a growing programmer, I know I still have a lot to learn, and one of my weakness is the Javascript.

One time, while coding the JS script, I got puzzled on how should I check if the parameter submitted to my JS function is numeric or not. Hurried to finish the task, with no second thoughts I use the is_numeric(var) syntax inside an if statement. When I tried to check the page, it of course returns an error. I review the code and realized that is_numeric() is just one of the common functions I used when coding PHP.

Since, I've been with the same kind of situations a lot of times, I Googled for an application, script, plugins etc. which could help me convert php functions to JS functions and I luckily bumped into this site http://phpjs.org/.

So what is phpjs.org is all about?

PHP.JS is an open source project in which we try to port PHP functions to JavaScript. By including the PHP.JS library in your own projects, you can use your favorite PHP functions client-side.

Using PHP.JS may speed up development for PHP developers who are increasingly confronted with client-side technology.

It also offers added functionality because JavaScript does not natively support higher-level functions such as: md5(), strip_tags(), strtotime(), number_format(), wordwrap().

PHP.JS is nothing fancy like jQuery—they're just offering PHP functions, with all of their original flaws and benefits for whomever needs them.

Here is the PHP is_numeric equivalent function:

function is_numeric( mixed_var ) {
// Returns true if value is a number or a numeric string
//
// version: 904.317
// discuss at: http://phpjs.org/functions/is_numeric
// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// +   improved by: David
// +   improved by: taith
// +   bugfixed by: Tim de Koning
// *     example 1: is_numeric(186.31);
// *     returns 1: true
// *     example 2: is_numeric('Kevin van Zonneveld');
// *     returns 2: false
// *     example 3: is_numeric('+186.31e2');
// *     returns 3: true
// *     example 4: is_numeric('');
// *     returns 4: false
if (mixed_var === '') {
    return false;
}

return !isNaN(mixed_var * 1);
}

You can download the full script at their site.

No server component required. To use PHP.JS you can either:

Kindly Bookmark and Share it:


Nursing Board Exam Results June 2009

Sunday, May 24, 2009
Thousands of Nursing graduates will take the June 2009 nursing board examination. Expected release date would be 2 - 3 months after. In case you wanted to be notified when the results are out, just fill out the form found in the Nursing board exam results website

Kindly Bookmark and Share it:


Sanitary Engineering Board Exam Results February 2009

Sunday, February 15, 2009

The Professional Regulation Commission (PRC) announces that 15 out of 34 passed the Sanitary Engineer Licensure Examination given by the Board of Sanitary Engineering in Manila this February 2009.

Following is the list of Successful Applicants:

ANG, MARVIN DARYL ZORILLA BEDUYA, MARIAN GRACE MUÑOZ BOÑAGA, HERBERT VILLAROSA CALE, FRANKLIN MIRANDA CAMERINO, KRISTAL MAE CAMALIG COMIA, REGE CAGUICLA CRUZ, MA CLARISSA BULAN GO, LEHMAN UYKI M LOPEZ, RICHARD WILSON DEL CASTILLO MANGULABNAN, CZARINA MAY SANTOS MOYAEN, ARIEL PANGESBAN UCHAYAN, RAUL ELAHE UMALI, CELSO JR PALAD UY, RITZY GALBAN YSMAEL, JEFFRY AWING

Kindly Bookmark and Share it:


Dota Latest Map

Monday, January 12, 2009

Warcraft Dota (Defense of the Ancients) is one of the fast evolving game we have today. The map is updated almost every 2 months to make some adjustments on the hero skills, terrain, mode of the game, animations and to fix the bugs which have been identified. I started playing Dota 3 years ago when the map version is still 5.54 and see the latest version we have today! Imagine how the game has evolved. The game have become more challenging and exciting because of the adjustments made, new items added and new heroes.

Below are the changes made from version 6.57b:

########### ## Highlight ## ###########

  • Remade Storm Spirit (see details below)
  • Remade Dirge (see details below)
  • Rewrote many different parts of the core game code to improve the usual performance drop that happens later in the game
  • Added a new experimental command -switch to switch player slots with other players or leavers (requires player agreement, see details below)

######### ## Items ## #########

  • Blademail: Remade (see details below)
  • Cranium Basher: Remade (see details below)
  • Heart: Changed the regen mechanism, it now gives 1% non-stacking passive HP regen
  • Javelin: Cost increased from 1400 to 1500 gold and damage from 16 to 21
  • Demon Edge: Cost reduced from 2600 to 2400 gold
  • Buriza: Recipe cost increased from 1000 to 1200 gold
  • Monkey King Bar: Improved damage from 75 to 80 and chance from 30->35%
  • Rapier: Now requires Demon Edge and Sacred Relic only and provides 200 damage instead of 250
  • Eul's Scepter of Divinity: Recipe cost reduced from 800 to 600 gold
  • Mask of Madness: Amplified damage is now applied at the end instead of within the duration
  • Mask of Madness: Cooldown reduction from 30 to 25 seconds
  • Diffusal Blade: Lowered the Agility bonus from 25 to 22
  • Diffusal Blade: The purge now lasts the same on non-hero units like Spirit Bear as it does on heroes (15->4 seconds)
  • Sentry Wards: True sight range increased by 100
  • Illusion Rune: Now creates 2 images instead of 1, images deal a little less damage
########## ## Heroes ## ########## * Storm Spirit: Remade (see details below) * Dirge: Remade (see details below) * Venomancer: Reworked Shadow Strike (see details below) * Vengeful Spirit: Reworked Terror (see details below) * Bane: Changed how Fiend's Grip works a little (see details below) * Silencer: Curse of the Silent is now an AOE effect * Necrolyte: Now has Heartstopper instead of Diffusion Aura * Windrunner: Removed attack count limit on Focus Fire * Rooftrellen: Living Armor is now castable on structures * Bone Fletcher: Death Pact can now be used on any non-hero unit, not just allied units. * Spirit Breaker: Charge of Darkness' buff indicator on the enemy is now visible to the enemy only when you are 2500 units or closer * Spirit Breaker: Has magic immunity when he reaches maximum speed in Charge of Darkness * Spirit Breaker: Empowering Haste bonus damage is now implemented as +damage visible on your interface * Furion: Sprout can now be directly cast on yourself * Morphling: Morph now gives him a passive +2/4/6/8 Agility and Strength bonus when leveling it up * Pudge: Flesh Heap bonus strength gained from heroes is improved from 0.3/0.6/0.9/1.2 to 0.9/1.2/1.5/1.8 * Axe: Counter Helix cooldown now scales from 0.6 seconds to 0.7/0.65/0.60/0.55 (245761) * Lucifer: Lvl? Death bonus damage is now reduced by magic resistance only rather than both magic resistance and armor * Lucifer: Reduced Doom's cooldown by 20 seconds * Lucifer: Devour' cast range increased a little from 150 to 300 * Bloodseeker: Improved base strength from 18 to 23 * Bloodseeker: Reduced Rupture's cooldown from 100 to 70 seconds * Sven: Improved God's Strength's cooldown from 120 to 80 seconds * Enchantress: Improved base damage by 10 * Drow Ranger: Improved Marksmanship by 3 Agility each level * Viper: Viper Strike's cooldown reduced from 80 to 80/50/30 seconds * Rhasta: Increased cast range on Mass Serpent Ward * Templar Assassin: Improved turn rate * Huskar: Life Break now properly slows magic immune units * Enigma: Reduced Eidolons' bounty * Enigma: Reduced manacost on Midnight Pulse from 135/150/165/180 to 95/110/125/140 * Lone Druid: Improved Spirit Bear's Entangle from 16 to 20% and cooldown from 6 to 5 seconds * Ursa: Enrage bonus damage is now implemented as +damage visible on your interface * Pugna: Reduced Scepter upgraded Life Drain cooldown dramatically * Venomancer: Improved Plague Ward cast range and vision radius * venomancer: Poison Sting damage type is now lethal * Bane: Fiend's Grip now wakes a unit up from Nightmare * Bane: Removed the life degen and enemy suicide mechanism from Enfeeble * Witch Doctor: Voodoo Restoration no longer triggers Essence Aura * Stealth Assassin: Removed ministun and tree destruction on smokescreen * Stealth Assassin: Backstab damage type is now Physical * Proudmoore: Reduced Captain CoCo's Rum movement bonus (30%->10%) * Proudmoore: Ghost Ship cooldown increased from 100/80/60 to a constant 100 * Spectre: Haunt now ends whenever you use Reality * Keeper of the Light: Rescaled Mana Leak cast range (1200->550/700/850/1000) * Naix: Increased Open Wounds manacost from 70/80/90/100 to a constant 110 mana * Visage: Rebalanced Raise Revenants (5/6/7 Max to 4/5/6 Max, Sight radius reduced by 50%, 29/39/49 damage to 40/46/52) * Meepo: Earthbind no longer works on magic immune units * Meepo: Rebalanced Poof (40/80/120/160 -> 60/80/100/120) ################## ## Modes & Commands ## ################## * Changed -vr (-VoteRandom) to make your hero pools include 1 of each Intelligence/Agility/Strength/Melee/Range * Added a new mode -mo(-MeleeOnly) * Added a new mode -ro(-RangeOnly) * Changed -mr(-moderandom) it now picks between RD/SD/VR/ARAI * Added a new command -mines to count the mines placed (250362) * Added a new global command -mc to show multicast rate of any Ogre Magi on the map (194526) * Adjusted -ha (hookaccuracy) to count only enemy hooks ##################### ## Gameplay & Performance ## ##################### * Rewrote camera system so it no longer moves the camera when you respawn if you are in the middle of controlling another unit * Rewrote many different parts of the core game code to improve the usual performance drop that happens later in the game * Dramatically improved performance during Epicenter * Disabled some item manipulation code that is specific to warcraft 1.20e from running on 1.21 and above (this is mechanism that affected droppability of items as soon as you used them until you issue a new command) * Hero selection is now automatically restored when you revive from Aegis * Dramatically improved performance during Echoslam * Rewrote Macropyre for some improved performance * Rewrote Morphling's Waveform. It no longer causes you to lose control * Minor Scorched Earth effect optimization * Rewrote Shadow Word, fixing some minor performance issues and fixing the buff icon to be more responsive to the current state of the effect * Rupture buff icon timing now more accurately represents the status ############# ## Replay Data ## ############# * Added lots of new replay data features for game parsers (see details below) * Endgame replay data actions now automatically done a few seconds after 3 players leave * Fixed some bugs with replay data when host leaves the game ############### ## Cosmetic & Misc ## ############### * Added a new visual effect for Chronosphere (PGRU-Unexpected) * Added a new visual effect for Sentinel Fortify and Scourge Fortify (PGRU-Unexpected) * Couriers now spawn 175 units infront of the hero rather than ontop of the hero * Glyph no longer refreshes in -wtf mode * Randomized the second -test warning message time to prevent some abuses * Techies plays a special fun kill sound when he kills someone with Remote Mines and when he does suicide command near the destination point * Added a new icon for Venomancer's Shadow Strike (236027) * Added a new Alchemist win animation (234249) * Added a new projectile for Lion's attack (Infrisios) * Added a sound to Tidehunter's attack * Added compressed Invoker Skin (241826) * Added a visual effect for Devour * Added a new visual effect for Lucent Beam/Eclipse (PGRU-Unexpected) * Added a new visual effect for Test of Faith when cast on allies (PGRU-Unexpected) * Added a visual effect for the LVL? Death bonus damage * Swapped Penitence and Purification icons (255729) * Added an optimized version of the effect used by Macropyre (PGRU-Unexpected) * Added color coding to the different modes of Ring of Basilius * Changed LVL? Death icon (150665) * Changed Panda's Thunder Clap icon (160613) * Dark Ritual and Death Pact now show the amount they restored with text overhead (258956) * Techies' name now includes the third goblin (77704) * Improved Roshan's Turn Rate * Changed Faerie Dragon's hotkey because of a recent conflict * Changed Undying's hero hotkey to fix an issue with accidentally leveling up attribute bonus level 1 ######## ## Bugs ## ######## * Fixed some unintended sideeffects to sharing control in SD * Fixed a bug with mode entering and -cm * Fixed a bug that allowed you to deny an ally being healed by Shadow Word * Fixed a bug with avalanche hitting a Tossed allied hero * Fixed a minor bug with dummy units interaction with items * Fixed a minor coding bug with Toss * Fixed a very minor bug with Backstab angle calculation * Put a practical limit to prevent mass -roll spams * Temporarily disabled the click disassemble on Perseverance because of some problems. You can still use Courier or Circle of Power to disassemble it * Fixed a minor minimap glitch at taverns area for Scourge Players * Fixed a visual bug when swapping heroes with Kunkka * Fixed an area where you could get stuck while using TP Scroll * Fixed incorrect Gem of Truesight AOE in recent versions * Fixed -omsc * Fixed Phase Boots dispelling Curse of the Silent * Fixed Proudmoore's name/class * Fixed Razor's Tavern Hotkey * Fixed Shadow Wave not bouncing the correct number of times * Fixed some bugs possible when using couriers * Fixed some minor bugs that could cause units to retain control after the game was over * Fixed some minor bugs with Illuminate caster units * Fixed some small inconsistencies between Towers * Fixed the slow duration on Torrent lasting a little longer than intended * Fixed Wall of Replica not working on Magic Immune units * Fixed a few other minor bugs New French and German translations are nearing completion. Other languages are in the works as well. ############# ## Extra Details ## ############# Old Blade Mail ============== Blades of Attack (500) Chainmail (550) Recipe (500) Total: 1550 +15 Damage +5 Armor Passive: 20% melee attack damage (calculated before reductions) returned as magical damage New Blade Mail =============== Broadsword (1200) Chainmail (550) Robe of the Magi (450) Total: 2200 +22 Damage +5 Armor +10 Intelligence Active: 100% all damage (calculated after reductions) returned as magical damage Duration: 4 seconds Cooldown: 15 Manacost 25 Has visual effect to show when it is active Extra Note: Since people regularly misunderstand how this works, the damage returned is reduced twice, first when you get the damage and then again when you deal it back. For example, a 300 damage nuke gets reduced by 25% because of hero resistance, then it gets dealt back as magical damage, being reduced by another 25% (or whatever magical resistance the enemy has). Old Basher: =========== Mithril Hammer (1610) Gauntlets of Strength (150) Recipe (1460) Total: 3220 +30 Damage +3 Strength 15% Bash (10% ranged) for 1.1 seconds Cooldown: 0 Stacks Diminishingly New Basher: =========== Javelin (1500) Gauntlets of Strength (150) Recipe (1450) Total: 3100 +30 Damage +3 Strength 25% Bash (10% ranged) for 1.1 seconds Cooldown: 2 seconds Does not stack with itself or other bash passives Old Fiend's Grip ================= 100/175/250 Manacost 40/60/80 Mana and HP cost per second Lasts 5 seconds 120 Cooldown 100/155/215 DPS New Fiend's Grip ================= 200/300/400 Manacost No HP or MP cost per second Lasts 5 seconds 120 Cooldown 100/155/215 DPS Transfers 5% of enemies max MP per second to you Old Shadow Strike: ================== Decay Damage 10/20/40/50 Initial Damage: 50/70/70/100 Movement Modifier: 50% Decay Power: 3 Interval: 3 Duration 15 Cast Range: 400 Cooldown: 22 Manacost 90/105/120/135 Venomous Gale: =============== Releases a Venomous Gale which poisons enemy units it comes in contact with. Units that are hit by it get a slow/dps like his previous shadow strike AoE: 125 Cast Range/Distance: 800 Cooldown: 22 Manacost 90/105/120/135 Old Terror: =========== Reduces damage and armor of units in an area around you. AoE: 700 Cooldown: 15 Duration: 20 Damage Reduction: 5/10/15/20% Armor Reduction: 2/3/4/5 Wave of Terror: ============= Releases a wave of terror moving forward that reduces enemy units armor and damage. You have vision over the wave as it moves forward. Wave Distance: 1400 AoE: 350 Cooldown: 15 Duration: 20 Damage Reduction: 5/10/15/20% Armor Reduction: 2/3/4/5 Dirge: ======= Attack Range: 100 Strength: 25 + 2.1 Agility: 10 + 0.8 Intelligence: 27 + 2.8 Movement Speed 310 Cast Point 0.45 Hero Class: Strength Decay ------- Dirge saps away the strength of enemy heroes and retains it for a period of time. Steals 4 Strength from each hero for 21/24/27/30 seconds Deals 30/60/90/120 Magical Damage Manacost 70/90/110/130 Cooldown 11/9/7/5 Cast Range 625 AOE: 300 Note: Often missed, note the cooldown Soul Rip --------- Redirects the flow of living energy through a target friend or foe, damaging them or healing them depending on how many units are near it. 25 for each unit. This does not hurt zombies below since they are magic immune. This can target your tombstone. Unit Cap: 5/10/15/20 Cooldown: 25/20/15/10 Manacost: 50/75/100/125 Tombstone ---------- Unholy powers summon a cursed tombstone. Zombies will frequently spawn near each enemy unit and attack them. Zombies have a passive that additively slow their target by 7%. Zombies cannot be controlled. Spawn area: 400/600/800/1000 Frequency: 3 Slow Duration: 2.5 seconds Zombie Stats: HP: 30 Armor: 0 Armor Type: Unarmored Magic Resistance: Immune Damage: 37-45 Attack Type: Pierce Attack Speed: 1.6 Movement Speed: 375 Bounty: 5-7 Deathlust: If the target the zombie is attacking is below 100/200/300/400 hit points, it gains 50% movement and attack speed bonus. Tombstone Duration: 15/20/25/30 Tombstone HP: 150/300/450/600 Tombstone Armor: 10 Tombstone Armor Type: Medium Tombstone Other Stats: Magic Immune, No regen. Tombstone Bounty: 70/90/110/130 Cooldown: 60 Cast Range: 250 Manacost: 120/130/140/150 Flesh Golem ------------ Dirge's hatred for all living beings allows him to transform into a monster. While he's transformed he carries a plague that affects nearby enemy units. Strength of the plague depends on how close the enemy is. Amplifies damage enemy units receive and reduces their movement speed (7%). When a plagued unit dies, its essence is transferred back to the Undying. Cooldown: 90 Duration: 30 Manacost: 100 Plague Aura Damage Amplification: (old plague was 20/25/30%) at max distance (700): 5/10/15% at closest distance (150): 20/25/30% In between is just an even spread between the numbers Units that die under plague release their energy to you. Creeps heal you for 3% and Heroes for 12% of your Max HP. Storm Spirit: ============== Attack Range: 500 Strength: 17 + 1.5 Agility: 22 + 1.8 Intelligence: 23 + 2.6 Movement Speed 295 Static Remnant ----------------- Raijin creates a remnant of himself containing his essence. The Static Remnant will release its stored energy whenever an enemy units comes near it. Lasts up to 12 seconds. Damage: 140/180/220/260 Trigger AOE: 210 Damage AOE: 260 Cooldown: 4 Manacost: 70/80/90/100 Takes 1 second to create after cast. This is not channeling, just time delayed. Electric Vortex ----------------- Storm focuses his energy to rip open a vortex drawing an enemy to it. This process slows the Storm Spirit down for a brief period. Pulls 100/150/200/250 units over 1/1.5/2/2.5 seconds. Your movement is reduced by 50% for 3 seconds. Cast Range: 300 Manacost: 100 Cooldown: 20 Overload --------- Storm Spirit becomes overloaded with electrical energy whenever he casts a spell. The charge is released on his next attack as an electrical burst, dealing damage and slowing nearby units. Slow: 50% as 80% ms Lasts 0.6 seconds (Same stats as old overload) Bonus damage: 30/45/60/75 AOE: 275 Ball Lightning --------------- Storm Spirit becomes enveloped with energy, losing his physical form, and travels until he depletes his mana or chooses to stop. While in this form, he deals damage to nearby units based on how far his electrical form has traversed. Damage, speed and area of effect improves per level. Stops traveling whenever you run out of mana. Deals damage in a small area around you based on distance traveled. Damage: 8/12/16 per 100 units traveled Manacost: (15 + 7% of total manabase) + mana based on distance traveled (10+1% per 100 units) Cast Range: Global Cooldown: 0 Travel speed and damage AoE improves per level. You can cast spells like Static Remnant during your roll if you are quick enough. Specific interactions with spells/projectiles follow the same rules as Waveform does. Replay Data Specs: ================== - "Ban",playerid,heroid: is sent for each time a hero is banned in cm/xl - "id" packets are sent after the mode phase (supports -sp) - "GameStart",1: synced to time 0 ingame (creep spawn time) - "9" packets are now sent each time a hero is picked Switch: ======== If someone wants to switch player slots with an enemy player or leaver, he types -switch . If he types -switch without the slot it lists the possible numbers that can be used. After a player uses this command, no one else can attempt a switch for 60 seconds, to prevent confusion. All players are then presented with a command to enter to accept, something like "-switch accept" or "-ok". If 100% of all player agree , then you take the slot of the player you swapped with and both heroes swap positions. Players have until the 60 seconds are over to accept the offer.

Kindly Bookmark and Share it:


UPCAT and Its Latest Results

Saturday, January 10, 2009

The UPCAT is a five-hour examination consisting of subtests on language proficiency, reading comprehension, mathematics and science. The languages used in the UPCAT are English and Filipino.

Applicants who take the UPCAT are ranked based on their admission grades which are the combined weighted scores in the UPCAT subtests and the high school weighted average. The top-ranking applicants, based on the quota and cut-off grade set by each campus, will qualify.

UPCAT Results will be posted at the Office of Admissions on the 3rd week of January, 2009. You may also visit this page by then for the web version of the UPCAT results, or view and search the UPCAT Results via WAP using your GPRS phones and WAP-enabled devices at http://wap.up.edu.ph/upcat/.

For the latest results of the UPCAT, please visit: http://upcat.up.edu.ph/results/

Kindly Bookmark and Share it: