#I have a whole list of words I could add as a prefix or suffix
Explore tagged Tumblr posts
Text
maplelibras-pkmn -> glacialmaples-pkmn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm probably gonna change my username a few times, just to get a feel of what direction I want to go in before settling on something more permanent.
I'm hoping I'll be able to at least slip in a reference (even if only I understand it) to my current username, but I'm not having much luck. so hopefully I'll be able to settle on something I love soon!!!
#maple crunches#I have a whole list of words I could add as a prefix or suffix#but they're not sounding as good as glacialmaple is rn#if I replace 'glacial' with other words and then add a prefix or suffix it sounds great#but idk I'm really liking glacialmaple#I'll see how I feel abt it when I wake up
0 notes
Note
Hey, so I'm writing a story of my own about my OC Clans, OakClan and WoodClan. Any world-building advice?
Hithere! You didnât really give me a lot of information so I will tell someadvice in no particular order that may help you with your story:
-The firstthing I always like to do is decide where the clans will be located, Plains?Forests? Marshes? Maybe a desert? This helps me decide how a group of wild catsmay have adapted to survive in this conditions.
-If I wereto create a god or a mythology they could pray to; it would be a mythologywhere a lot of its integrates would be related to the place where they live. Maybethey have a motherly kind of goddess that takes the form of plants, maybe theyworship a special tree, maybe they live in plains where they pray to the startsup above, etc.
-Since theyare two clans, how do they differ from each other? This is an important factsince it helps to give a general idea of how the clans works or behave. Justlike Riverclanâs ways are different to Shadowclanâs, what makes these two clansstand for each other? If a warrior from Oakclan and a warrior from Woodclanwere put together, what would easily differentiate them? Maybe Wodclan warriorshave a thinner body because the trees in their territory are thinner and donâtallow a lot of climbing around while Oakclan have huge bodies that they need toclimb everywhere. Maybe Woodclan are really cocky and self-centered and have afighter kind of perspective as a whole while Oakclan is that really religiousgroup that feels in total peace with their spirits and prefers peace over war.
In thissame level, how did these clans came to be? A forest fire that split up the forestand made different cats congregate in two clans? Two different religiouscurrents that made them fight over which one was the right one?
-Since theylive in similar territories, do they catch the same prey? Do they hunt the sameway? Maybe Woodclan are mostly rodent eaters while Oakclan prefers birds. MaybeWoodclan caught its prey by stalking while they hide in dense bushes andOakclan plainly climbs for them.
-When creatinga society something important to mind is whether they are in peace or in war.Are these clans constantly fighting? Do they mostly live in peace? What makesthen fight? Is there any special day where fighting is prohibited?
-Cat behavior.Do you aspire to a maximum realism level? Then think about eliminating medicinecats and adding some more cat like behaviors. Maybe you prefer them to be morehumanlike and keep the medicine cats and adapt human behavior (likecrying or shrugging). A thing I see really often in this fandom is thatpeople tend to follow the canon too much. The warrior code is really flawed,why not change it? The ranks are boring and repetitive, why not add a morecultural rank? Maybe someone who keeps track of the clan history?
-Createyour own naming system. In my opinion, this is extremely important. Using a lotof weird nouns, while poetic and cool looking can look really⊠unprofessional? Andhere I am not referring to cats called Poisonskull, Bloodstrike, etc I amreferring to cats like Lionblaze, Pouncestone, Monthwing, Loudbelly, etc whatdo these names mean? Why do cats with personalities and traits so differentlike Monthwing and Dovewing share the same prefix? What kind of mother namestheir kit Pouncekit? How is there a cat called Wolfkit when they supposedlylive in England?
What Inormally do is really easy, I choose a location, letâs say the IberianPeninsula and use the fauna and flora of that place as prefixes. Now I decidethat the prefixes will always describe the catâs appearance upon birth. Andthen I create a suffix list, a short one, it doesnât have to have thousands ofcool looking words just words that resume the catsâ personality traits and behavior.âfoot for fast and agile cats, -claw for good fighters, -flower for nurturingcats, etc. A good blog I personally recommend to get started on this is @ailuronymy. Go check them out.
These arethe only advices that come to my mind at the moment. I hope they help you andinspire to do your own clans. I would love to hear more about them once you havewritten someinformation so feel free to send it to me if you wish to receive a specific review. Good luck with them!
7 notes
·
View notes
Text
Konosuba Episode 2 Notes
â-sukeâ is a common ending for male names (human and sometimes pets). âChomuâ is the weird sounding bit typical of Crimson Demon names, and doesnât (necessarily?) mean anything itself.
Apparently Chomusuke being female wasnât revealed in the LNs until much later on, but I donât think it much matters beyond the âwhat, I thought she was male this whole time!â joke from the -suke part of the name. Donât quote me on this though.
The word translated as âchildrenâ here is âo-ko-sama.â The usual word for âchild/childrenâ is kodomo, which is what Megumin uses when saying âdonât treat me like a kid!â or whatever. O-ko-sama adds the âhonorable âoââ prefix and the -sama suffix to the base word âkoâ to make an especially polite way of referring to other peopleâs children; one of the most common situations youâll see it is on restaurant menus, where itâs the word used instead of âkidâ in âkidâs menuâ or âkidâs meal.â
Itâs also used sarcastically, like here, to refer to someone with a young/innocent/naive view of whatever. In media especially itâs common when poking fun at young characters who hate being treated like a kid.
The âhonorable âoââ (which can also be âgoâ, it depends on the word youâre attaching it to) is something you stick onto words to kick up the politeness level and/or when speaking in âfeminineâ language (Japanese is a very gendered language in terms of âmen talk like thisâ and âwomen talk like thisâ). However, it too is also sometimes used sarcastically or jokingly, or to soften the tone of something. For example âobakaâ is kind of like a cuter way of calling somebody a baka (not to be confused with âoobaka,â which means like big idiot).
One of the most common words for âballsâ (like, those balls, yes) in Japanese is âkintama,â which translates literally to âgold ball(s)â. So yeah this is a much more obvious balls joke than you might expect.
The phrase she uses here is âcharm point,â which is a Japan-original phrase using English words. Itâs used to describe specific bits of something that are particularly cute/appealing, either naturally or by design. In this case sheâs referring to that hair loop of hers. If you asked a...less scrupulous Japanese Konosuba fan what Aquaâs âcharm pointâ is, theyâd probably bring up the âis apparently going commandoâ thing. A more wholesome example would be Pikachuâs tail and how itâs shaped like a little lightning bolt.
The âAqua is apparently going commandoâ is also a reference to a Japanese meme, âhaitenaiâ (lit. ânot wearing [panties]â), referring to when characters would be drawn in ways where it looked like they werenât wearing underwear but you couldnât tell for sure.
This is a reference to a real-world scam that has plagued Japan for decades. Basically someone will call up random phone numbers, saying âItâs me, itâs me!â and hoping whoever answered the phone will be like âoh itâs my son, whatâs wrong?â From there they convince the (usually quite elderly) target that the caller, posing as their child, has gotten in trouble somehow (lost a briefcase of cash for work, etc.) and urgently needs to borrow some money. Itâs very easy to do account-to-account bank transfers in the Japanese banking system, so they can just give the old person a few details over the phone and have them send money that way.
That may sound kind of absurd, but itâs been a relatively big problem for a long time; there are still police-run awareness campaigns about it even today, and when sending money through an ATM (the most common method), thereâs a warning message you have to go through about this and similar scams.
âYunyunâ sounds strikingly similarly to âtayun tayun,â a common sound effect for...bouncing/swaying breasts. (Itâs not a coincidence, no.)
This is a Japanese meme, âku-koro.â Itâs short for âKu, korose!â which (in context) basically means âUrgh, just kill me!â The original context is that itâs the stereotypical thing for proud female knight characters to say when captured by orcs and about to be subject to certain heinous deeds. Though it started as a porn thing, itâs gotten more mainstream exposure as a gag line in stuff like Konosuba (seen here), Puzzles and Dragons, and various other (non-porn) fantasy series.
Thereâs a NicoDictionary entry for the phrase that lists it as first gaining steam after trending on Twitter in early 2013.
He uses the phrase âoyakusokuâ here, which is a specific technique that is popular in Japanese comedy. Itâs the word for âpromise (yakusoku)â plus the same âhonorable âoââ mentioned above. It basically is the same concept as a running gag, except on a much larger scale; instead of being a gag that runs throughout an episode or series, it runs through entire genres or even across multiple genres.
It generally takes the form of âin X situation, Y happens.â One of the most infamous of them in anime is the âguy walks into a roomâgirl is in the middle of changing clothes in the roomâ girl inflicts violence on the guy.â
In a lot of ways it is similar to âclichĂ©â in English, except itâs a bit broader in scope and doesnât have the negative connotation that calling something cliche generally does; the fact that everyone knows itâs coming is what gives it its value, to some extent. When applied to online communities itâs basically âmemeâ though.
The phrase he uses here is actually used to refer to someone who is dependable and decisive when it counts, so given what heâs saying heâs willing to do here, itâs understandable Meguminâs reaction is âI donât think youâre really using that phrase rightâŠâ
The normal version of the phrase for âIâm backâ is âtadaima,â but Aqua is saying âtadamaâ instead, which is a silly-sounding way of saying it you donât generally see outside the internet.
The normal response to âtadaimaâ is some variant on âokaeri,â and in the second shot sheâs saying âwhereâs my okaeri???â Itâs supposed to be adorable in that Aqua sort of way, though Iâm not sure it quite comes across the same in the translation.
The âLoli-maniacâ here is actually âLolima,â a (blunt) play on his name, Kazuma. Adding â-maâ to the end of a word can also be a way of indicating âa criminal related to whatever the -ma is attached to.â One example is âtoori-ma,â which is a word for someone who causes harm to random people on the street (basically like a serial killer). Toori is from the verb tooru, which means to pass by something (among other things; itâs a very versatile verb). Another is the word for pyromaniac/arsonist, houka-ma, where houka means to set something on fire (in an arson-y kind of way).
The word shes uses here is âbocchi,â which is a term that comes from âhitori-bocchi,â meaning âall alone.â Bocchi itself is slang thatâs caught on a lot in recent years, especially in nerdy communities, and basically means âa person with no friends.â Itâs a phrase youâll see pop up a lot in manga and anime.
These resemble large konpeito, popular star-burst shaped candies. I canât say for sure how intentional it is, but I know my reaction was âlol the first thing she reached for was candy.â
A more direct translation of this itemâs name is âthe crystal that improves your relationship.â The subs seem to imply Yunyun is talking about it like she could use it to make other friends, but in the Japanese sheâs more saying âso this will make me and Megumin get closer?â Likewise, the subs line for Megumin implies she doesnât care about making friends in general, while the Japanese is more âI see no reason to get along better with Yunyun.â
The opening line of the letter in the Japanese implies more âI havenât been able to send reports lately/until now,â which Iâm guessing is a reference to the gap between S1 and S2.
The phrase translated as âside jobsâ here is ânaishoku,â which is a type of job that you do from home. Typically it referred to jobs like mentioned here, folding fake flower or boxes: a company will deliver unfolded ones to your house, you fold them, then they pick them back up and pay you for however many were folded. The fake flowers one in particular is something that gets used in a lot of anime/manga as something super poor households do to earn money for food or whatever. In real life, itâs traditionally work that housewives would do if they had free time/needed to help supplement the family income.
Nowadays it can refer to various other types of work-from-home jobs, though with the nuance of it not being a ârealâ/full-time job, even if you can/could make enough money to live on with it (e.g. streaming/blogging).
15 notes
·
View notes
Photo
Generate Random Alphanumeric Strings in PHP
Let me begin this post by saying that almost no event is truly random. Even the outcome of a classic coin toss could in theory be predicted if we knew the effect of every factor involved, like air friction, gravity, and initial force.
The same thing is applicable to the generation of random numbers and alphanumeric strings. The best we can hope for is to generate numbers and strings that don't seem to follow a pattern and can't be practically predicted by an attacker.Â
In this tutorial, we will cover different techniques for generating random numbers and alphanumeric strings in PHP. Some of them will be cryptographically secure, while others are meant only for casual use, like assigning pseudo-random file names or creating URLs and suggesting usernames.
Generating Random Numbers in PHP
There are three different functions for generating random numbers in PHP. All of them will accept a minimum and maximum possible value for the random numbers and output a random number for you. These are rand($min, $max), mt_rand($min, $max), and random_int($min, $max).
With rand(), the minimum and maximum values of integers you can generate lie between 0 and the value returned by getrandmax(). Before PHP 7.1.0, this function was about four times slower than mt_rand(). However, starting from PHP 7.1.0, it has been made an alias of mt_rand(). Unlike mt_rand(), though, you can set the value of $max to be lower than $min without causing an error.
With mt_rand(), the minimum and maximum values of integers you can generate lie between 0 and the value returned by mt_getrandmax(). It relies on an implementation of the Mersenne Twister to generate random numbers. Watch out, thoughâprior to PHP 7.1.0, this function implemented an incorrect version of the algorithm to generate the numbers. However, it has been fixed in newer versions.
The function became even better in PHP 7.2.0 by getting rid of a modulo bias bug. This means that for some particular seeds, your sequence of random numbers will now be slightly better compared to older versions. Some specialized code might actually rely on this bias, though. If so, you can use the older seed algorithm by calling the mt_srand() function to seed the random number generator and passing MT_RAND_PHP as the value of the second parameter.
The mt_rand() function has a period of 219937â1, which basically means that in best case scenarios you get as many as 219937â1 random numbers before the sequence starts repeating. You should note that repetition of a sequence is not the same as repetition of a particular number. In other words, you might get the same random number twice, but that does not mean that the sequence itself has started repeating. The following sequence is an example:
187 3276 1267 15 1267 34598 3467 125 17
In the above sequence, we had 1267 twice in the output, but that does not mean that the whole sequence started repeating after that. It's unlikely to get the same number repeated so soon in a random sequence, but it is possible!
Cryptographically Secure Random Integers
If you want cryptographically secure pseudo-random numbers, the random_int() function in PHP is your best bet. It will generate random numbers between the provided $min and $max values, which default to PHP_INT_MIN and PHP_INT_MAX. Unfortunately, this function is only available starting from PHP 7.0. For versions before that, you can use this polyfill on GitHub.
Random Floats
Instead of generating random integers, you might also want to generate floats. This can be done effortlessly by simply dividing a random number with a value returned by mt_getrandmax(). The following example will illustrate how to generate a random float between 0 and 1 or between any other minimum and maximum limits.
<?php // Output: 0.69458310943776 echo mt_rand(0, mt_getrandmax())/mt_getrandmax(); function mt_random_float($min, $max) { $float_part = mt_rand(0, mt_getrandmax())/mt_getrandmax(); $integer_part = mt_rand($min, $max - 1); return $integer_part + $float_part; } // Output: 10.199064863938 echo mt_random_float(10, 11); // Output: 35.540808309121 echo mt_random_float(15, 50); ?>
When generating a random float between given limits, we make sure that the random integer numbers do not go above $max - 1. This way, we can be sure that adding the float part will not take the number above the maximum limit.
Seeding the Random Number Generators
One concept that needs a little bit of explanation is seeds. Put simply, these are just numbers that can be used to initialize the rand() and mt_rand() functions before generating any random numbers. The function which seeds rand() is called srand($seed), and the function which seeds mt_rand() is called mt_srand($seed, $mode).
It's important to remember that providing an initial seed value every single time before calling rand() and mt_rand() won't necessarily produce better random numbers. In fact, using the same seed each time will give you the same random number as well!
<?php mt_srand(10); // Output: 1656398468 echo mt_rand(); mt_srand(10); // Output: 1656398468 echo mt_rand(); mt_srand(10); // Output: 1656398468 echo mt_rand(); ?>
Seeding a random number is useful in situations where you want to generate a random but reproducible sequence. The following code snippet generates the same sequence of random numbers when run twice.
<?php mt_srand(10); $count = 0; while($count < 10) { echo mt_rand(0, 100)." "; $count++; } // Output on First Run: // 68 58 68 13 3 48 30 37 96 82 // Output on Second Run: // 68 58 68 13 3 48 30 37 96 82
Generating reproducible random sequences this way can help debug programs which were being tested using random dataâif you keep track of the seed, you can reproduce the same input to figure out what went wrong.
Generating Random Alphanumeric Strings in PHP
There are many ways to generate random alphanumeric strings, and what you use will depend on your needs.
Generate Shuffled Strings
If you want to generate random alphanumeric strings from a fixed set of characters, you can use the str_shuffle($string) function. This function will provide you a randomly shuffled string. Starting from PHP 7.1, the algorithm which determines the random order of characters in the output string has been changed to the Mersenne Twister.
Remember that the random string generated this way is not cryptographically secure. However, the string will still be pretty unpredictable for common use like generating random file names or URLs. Here are a few examples:
<?php $permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyz'; // Output: 54esmdr0qf echo substr(str_shuffle($permitted_chars), 0, 10); $permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; // Output: video-g6swmAP8X5VG4jCi.mp4 echo 'video-'.substr(str_shuffle($permitted_chars), 0, 16).'.mp4'; ?>
Your output will most probably be different in both cases. In the first case, we just shuffled the permitted characters string and then took the first 10 characters of it. In the second case, we added "video" at the beginning of the generated string and ".mp4" at the end.
This method of generating random alphanumeric strings is very easy, but it has a couple of issues. For example, you will never get the same characters in your random string twice. Also, the length of the random output string can only be as long as the input string.
Generate Random Strings
If the problems I listed above are a deal breaker, you might want to look at some other implementations. The following code will solve both these problems.
<?php $permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; function generate_string($input, $strength = 16) { $input_length = strlen($input); $random_string = ''; for($i = 0; $i < $strength; $i++) { $random_character = $input[mt_rand(0, $input_length - 1)]; $random_string .= $random_character; } return $random_string; } // Output: iNCHNGzByPjhApvn7XBD echo generate_string($permitted_chars, 20); // Output: 70Fmr9mOlGID7OhtTbyj echo generate_string($permitted_chars, 20); // Output: Jp8iVNhZXhUdSlPi1sMNF7hOfmEWYl2UIMO9YqA4faJmS52iXdtlA3YyCfSlAbLYzjr0mzCWWQ7M8AgqDn2aumHoamsUtjZNhBfU echo generate_string($permitted_chars, 100); ?>
You can modify it to add particular suffixes and prefixes to the generated random string. People who are using PHP 7 can improve the string generation further by using the cryptographically secure function random_int() instead of mt_rand().
Generate Random Hexadecimal Strings
If you want to generate random hexadecimal strings in PHP, you can also use either the md5($string, $raw_output) or the sha1($string, $raw_output) function. Both of them will generate hashes of a given input string.Â
You will keep getting unique hashes as long as the input is unique. This could be achieved by using the output of a function like time() as the input. By default, md5() will return a 32-character hexadecimal string, and sha1() will return a 40-character hexadecimal string. These can be trimmed to a specific length using the substr() function.Â
Here is an example of the output returned by these functions:
<?php // Output: 36e5e490f14b031e echo substr(md5(time()), 0, 16); // Output: aa88ef597c77a5b3 echo substr(sha1(time()), 0, 16); // Output: 447c13ce896b820f353bec47248675b3 echo md5(time()); // Output: 6c2cef9fe21832a232da7386e4775654b77c7797 echo sha1(time()); ?>
As you can see, generating random and unique hexadecimal strings up to 40 characters long is very easy in PHP.
Generate Cryptographically Secure Random Strings
The three functions to generate random alphanumeric strings that we have discussed so far are not cryptographically secure. Luckily, PHP also has a function called random_bytes($length) to generate cryptographically secure pseudo-random bytes. The $length parameter determines how long the output string should be.
Once you have the output in terms of random bytes, you can use the bin2hex() function to convert them to hexadecimal values. This will double the length of the string.
<?php // Output: b7b33efa07915b60ad55 echo bin2hex(random_bytes(10)); // Output: a2e6cb1f25616324c8a11a2cceb0b47c590949ea echo bin2hex(random_bytes(20)); // Output: 25af3b86e11884ef5e8ef70a0ad06cba81b89ed6af3781a0 echo bin2hex(random_bytes(24)); ?>
Another function that you can use to generate cryptographically secure random bytes is openssl_random_pseudo_bytes($length, &$crypto_strong). The value of the second parameter can be used to determine if the output string will be generated using a cryptographically secure algorithm or not.
Final Thoughts
In this tutorial, we looked at the generation of random numbers and alphanumeric strings in PHP. Generating random numbers can be useful in a variety of situations, like in games where you have to spawn enemy players or randomly give users some clues about letters so they can form a whole word.
Just like random numbers, the generation of random alphanumeric strings can also be pretty helpful in many circumstances. With the help of str_shuffle(), you can choose which set of characters appear in your random strings. With sha1() and md5(), you can easily generate random hexadecimal sequences, and with random_bytes() you can generate cryptographically secure strings. This will allow you to generate meaningful yet randomized filenames and usernames that are hard to guess.
I hope you enjoyed this tutorial. If you have any questions, feel free to ask them in the comments.
by Monty Shokeen via Envato Tuts+ Code https://ift.tt/2BnoflM
0 notes