Manual Zone
Wednesday, September 6, 2017
Sexism in the viral social media motivational quotes
Sexism in the viral social media motivational quotes
My Sri Lankan Version * |
�Your naked body should only belong to those who fall in love with your naked soul.� ? Charles Chaplin.
The above is a message circulated as a viral image by many in Facebook. The message comes written on top of a considerably attractive female, subtly sexualized and directing this advice towards the female members of the network.
As pointed out by many, your body belongs to you; not to anyone else. Nevertheless, just to balance, I have composed and released this image, which is a Sri Lankan and less sexist version of the original post.
The original viral image |
We have a long way to go, to grow up and overcome this imbalance.
* Special thanks to Kusa Paba crew for the image of the man in the photo. No copyright violations intended.
download file now
Shuffling cards in PHP
Shuffling cards in PHP
The following demonstrates what I believe to be an efficient means of shuffling a deck of cards, using PHP.
$cards = array(array(suit=>Spade, rank=>01), array(suit=>Spade, rank=>02), array(suit=>Spade, rank=>03), array(suit=>Spade, rank=>04), array(suit=>Spade, rank=>05), array(suit=>Spade, rank=>06), array(suit=>Spade, rank=>07), array(suit=>Spade, rank=>08), array(suit=>Spade, rank=>09), array(suit=>Spade, rank=>10), array(suit=>Spade, rank=>11), array(suit=>Spade, rank=>12), array(suit=>Spade, rank=>13), array(suit=>Spade, rank=>14),
array(suit=>Club, rank=>01), array(suit=>Club, rank=>02), array(suit=>Club, rank=>03), array(suit=>Club, rank=>04), array(suit=>Club, rank=>05), array(suit=>Club, rank=>06), array(suit=>Club, rank=>07), array(suit=>Club, rank=>08), array(suit=>Club, rank=>09), array(suit=>Club, rank=>10), array(suit=>Club, rank=>11), array(suit=>Club, rank=>12), array(suit=>Club, rank=>13), array(suit=>Club, rank=>14),
array(suit=>Diamond, rank=>01), array(suit=>Diamond, rank=>02), array(suit=>Diamond, rank=>03), array(suit=>Diamond, rank=>04), array(suit=>Diamond, rank=>05), array(suit=>Diamond, rank=>06), array(suit=>Diamond, rank=>07), array(suit=>Diamond, rank=>08), array(suit=>Diamond, rank=>09), array(suit=>Diamond, rank=>10), array(suit=>Diamond, rank=>11), array(suit=>Diamond, rank=>12), array(suit=>Diamond, rank=>13), array(suit=>Diamond, rank=>14),
array(suit=>Heart, rank=>01), array(suit=>Heart, rank=>02), array(suit=>Heart, rank=>03), array(suit=>Heart, rank=>04), array(suit=>Heart, rank=>05), array(suit=>Heart, rank=>06), array(suit=>Heart, rank=>07), array(suit=>Heart, rank=>08), array(suit=>Heart, rank=>09), array(suit=>Heart, rank=>10), array(suit=>Heart, rank=>11), array(suit=>Heart, rank=>12), array(suit=>Heart, rank=>13), array(suit=>Heart, rank=>14));
$shuffled_cards = array();
while (sizeof($cards) != 0)
{
mt_srand((double)microtime()*1000000);
$card = mt_rand(0, sizeof($cards) - 1);
$shuffled_cards[] = $cards[$card];
unset($cards[$card]);
$cards = array_values($cards);
}
print_r($shuffled_cards);
We start by initializing our deck of fifty-two cards. Each member of our array is an associative array holding the suit and rank of each card. We then initialize a blank array where we will store our shuffled cards.
The while loop will execute until all of the cards have been popped out of our initial array.
At the beginning of each iteration we start a new pseudo-random seed. Then, we get a random number between zero, and the number of cards we have left to shuffle, minus one (because arrays are zero indexed.) Next, we append the randomly selected card to our shuffled array and remove it from our cards array.
When we remove a card from our numerically indexed array, the array becomes sparse. So if the random number was four, then we are left with indexes one, two, three, five, six and so on. If we hit four through another iteration, there would be no value to add to our shuffled array.
To make our array dense again, we can simply call the array_values function on our cards array and assign it back to cards.
This solution buys us a few niceties, compared to other solutions I have come across. First, at any given time a card is only in one array (except the split moment that we are doing the move). The second is that we dont have to worry about our random number being the same as a previously picked random number, and thus waste time picking another number until we hit a unique number.
Finally, this solution is really just an exercise in efficiently shuffling an array. In a real application I would not use this solution at all. PHP comes with a nice little function named, easy enough to remember, shuffle(). So lets take a look at how one should really implement the solution.
$cards = array(array(suit=>Spade, rank=>01), array(suit=>Spade, rank=>02), array(suit=>Spade, rank=>03), array(suit=>Spade, rank=>04), array(suit=>Spade, rank=>05), array(suit=>Spade, rank=>06), array(suit=>Spade, rank=>07), array(suit=>Spade, rank=>08), array(suit=>Spade, rank=>09), array(suit=>Spade, rank=>10), array(suit=>Spade, rank=>11), array(suit=>Spade, rank=>12), array(suit=>Spade, rank=>13), array(suit=>Spade, rank=>14),
array(suit=>Club, rank=>01), array(suit=>Club, rank=>02), array(suit=>Club, rank=>03), array(suit=>Club, rank=>04), array(suit=>Club, rank=>05), array(suit=>Club, rank=>06), array(suit=>Club, rank=>07), array(suit=>Club, rank=>08), array(suit=>Club, rank=>09), array(suit=>Club, rank=>10), array(suit=>Club, rank=>11), array(suit=>Club, rank=>12), array(suit=>Club, rank=>13), array(suit=>Club, rank=>14),
array(suit=>Diamond, rank=>01), array(suit=>Diamond, rank=>02), array(suit=>Diamond, rank=>03), array(suit=>Diamond, rank=>04), array(suit=>Diamond, rank=>05), array(suit=>Diamond, rank=>06), array(suit=>Diamond, rank=>07), array(suit=>Diamond, rank=>08), array(suit=>Diamond, rank=>09), array(suit=>Diamond, rank=>10), array(suit=>Diamond, rank=>11), array(suit=>Diamond, rank=>12), array(suit=>Diamond, rank=>13), array(suit=>Diamond, rank=>14),
array(suit=>Heart, rank=>01), array(suit=>Heart, rank=>02), array(suit=>Heart, rank=>03), array(suit=>Heart, rank=>04), array(suit=>Heart, rank=>05), array(suit=>Heart, rank=>06), array(suit=>Heart, rank=>07), array(suit=>Heart, rank=>08), array(suit=>Heart, rank=>09), array(suit=>Heart, rank=>10), array(suit=>Heart, rank=>11), array(suit=>Heart, rank=>12), array(suit=>Heart, rank=>13), array(suit=>Heart, rank=>14));
shuffle($cards);
print_r($cards);
download file now
Shiny Pokemon are Now in Pokemon GO!
Shiny Pokemon are Now in Pokemon GO!
Shiny Pok�mon are now part of the Pok�mon GO madness! Congratulations to everyone who gets a Shiny on Day 1, it�s crazy luck!
The original leak said the following: �Did you know that if you evolve a Shiny Pok�mon like this Magikarp, the evolved Pok�mon will also be Shiny?� and now it has finally happened!
Before you start your hunt, make sure you visit our ? Pok�mon GO Shiny Chart ? that shows all Shiny variants in Generation I and II. Some Shiny variants are hard to spot, while others are quite obvious.
The first captured Shiny in the world
The credits for first confirmed Shiny Magikarp catch go to Fabien Parent!
What are Shiny Pok�mon?
Shiny Pok�mon are recolors of normal Pok�mon models. In the original Gameboy games they were a much sought after due to their rarity and trading potential. In Pok�mon GO, the same thing has happened.
REMEMBER THE FOLLOWING: Shiny Pok�mon stay Shiny when evolved!
Shiny Pok�mon in Pok�mon GO
Shiny Pok�mon were rumored for months, making guest appearances in APK mines for a while now. We already wrote a whole technical breakdown on Shiny Pok�mon, sharing how they�re implemented and how they work.
Please remember to use your Razz Berry on Shiny Variants and remember that once you catch a Shiny your Pok�dex will show these buttons:
We still have no info if Shiny Pok�mon have any different stats or moves when compared to their normal counterparts. Shiny Pok�mon are usually just different color variants then normal counterparts, however they are incredibly rare.
download file now
Site News and Schedule
Site News and Schedule
I wanted to post a quick note in regards to my posting schedule.
For now, Ill be trying to post the meatier, original content feature posts on Mondays and Thursdays. Tuesday/Wednesday/Friday will most likely have shorter updates depending on whats going on in the gaming universe. Throughout the week Ill be collecting links that I find interesting, and Ill post a list of "weekend reading" on Saturdays.
Well see how it goes, but this is my plan for the next couple of weeks. Ive got a pretty decent list of stuff lined up and Im looking forward to posting all of it.
download file now
Subscribe to:
Posts (Atom)