#javascript replace character in string
Explore tagged Tumblr posts
Text
How to replace a character at a particular index in JavaScript ?

To replace a character from a string there are popular methods available, the two most popular methods we are going to describe in this article. The first method is by using the substr() method. And in the second method, we will convert the string to an array and replace the character at the index. Both methods are described below: Approach 1: Using the substr() method: The substr() method is used to extract a sub-string from a given starting index to another index. This can be used to extract the parts of the string excluding the character to be replaced. The […]
0 notes
Text
Daily JavaScript Challenge #JS-121: Detect Consecutive Duplicates in a String
Hey fellow developers! 👋 Welcome to today’s JavaScript coding challenge. Let’s keep those programming skills sharp! The Challenge Difficulty: Medium Topic: String Manipulation Description Write a function removeConsecutiveDuplicates that takes a string as input and returns a new string with all groups of consecutive duplicate characters replaced by a single character. Ready to…
0 notes
Text
Working with Strings in JavaScript
This topic provides an in-depth exploration of strings in JavaScript, a fundamental data type used to represent and manipulate text. JavaScript strings are immutable sequences of characters. This topic covers the creation and initialization of strings, as well as various methods and properties available for string manipulation. Practical examples illustrate common operations such as concatenation, slicing, searching, replacing, and converting case. Additionally, the topic delves into advanced string handling techniques using template literals and regular expressions, equipping you with the skills to effectively manage text data in your JavaScript applications.
0 notes
Text
Regular Expression
A regular expression, commonly called a “regexp”, is a sequence of characters that define a search pattern. It is mainly for use in pattern matching with strings, or string matching (i.e. it operates like a “find and replace” command). While it is a very powerful tool, it is also very dangerous because of its complexity.

Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems."(super classic joke in the industry)
One thing you have to be careful with is that different languages use different regexp engines. That means that a regexp in Python, for example, will be interpreted differently in Javascript:
Regular expressions are everywhere and software engineers, no matter their positions, will have to use them during their careers. System administrators and DevOps are the ones using them the most because they are very handy for log parsing.
Read about regexp:
http://www.regular-expressions.info/
http://www.w3schools.com/jsref/jsref_obj_regexp.asp Play with regexp (or compose them):
Ruby: http://rubular.com/
PHP/Javascript/Python: https://regex101.com/
0 notes
Text
I rather enjoyed Code Geass despite its many, many, many flaws, to a great extent because it's the only work I can really think of that takes the "Magneto side" of the Professor-X-vs-Magneto dynamic; and that the "change the system peacefully from within" guy knows, at some unconscious level, that his cause is hopeless and he's only sticking to it so strongly in hopes of fulfilling his deep-seated death wish.
That said, this also provides me the chance to mention something I've been meaning to post: the "Western names" bit. Code Geass is pretty bad on this front, but far from the worst, particularly when you note that a number of the odd given names are in fact real surnames, like Lelouch, Nunnally, and Rivalz — and there are plenty of Mackenzies, Kennedys, and Madisons out there. (There's no excuse for Schneizel, though.)
Gundam has some real weird ones — but then it has the whole "future sci-fi names" thing going (plus Casval's Obviously Fake Pseudonyms). The Nasuverse gets even weirder, but almost all of them are wizards, belonging to their own insular wizard culture (which apparently thinks names like "Sola-Ui Nuada-Re Sophia-Ri," "Darnic Prestone Yggdmillennia," "Marisbury Animusphere" and "Jubstacheit von Einzbern" are perfectly reasonable). But it's hard to top monikers like Freezing's Satellizer L. Bridget, or Baccano's Jacuzzi Splot.
Off and on for over a year now, I've been manually scraping various fandom wikis gathering a big list of "Western character names" from anime and manga (plus a couple of Chinese mobile games). I used to try feeding this list into a Markov chain (an order-3 character-by-character one) that I wrote up in javascript years ago. (Only, now the method I used to load the content of a text file into a javascript string variable is no longer supported in current browsers for security reasons, and I haven't figured out the modern replacement yet.)
While the results were a lot of gibberish, or else just names from the list recreated, I did occasionally get some notable results, the top examples of which I have saved, and will now present here for your amusement (with some commentary in square brackets):
Aenola von Zeppendelg [very much in keeping with the common pseudo-German pseudo-nobility thing]
Albridge Kiddenburg
Arcia di Raine
Argriffon O'Land
Arslina S. Drostor
Barth Bazilvato
Beatt Shake [And here's the "random English words as name" entry]
Bennia Rodriscogne
Britz Shaftman [The Engrish is strong with this one]
Charcia Harony
Cony Blandoba
Dance Octus ["random English word as name" take two]
Donova B. Kylenberg
Eleary von Jose [presumably pronounced, in the German manner, as /ˈjoː.zə/, not Spanish /xoˈse/]
Elith Gassenbereson
Elynn Breelson [I can easily see someone spelling "Ellen" that way]
Elysitra C. Shamburg
Emillenda Framón
Esmelia Rotobine
Eugraclavia A. Irew ["Eugraclavia" is so very an anime character name]
Fairention Ohank-Albareaux [And just where on Earth — or what other planet — would this name be from?]
Fleur Gascard [Some of them are quite normal and reasonable, occasionally]
Gadokie Pickle [This remains my absolute favorite]
Grunessa Orvestat
Harlette Walkenzeed
Henry Cygnallia
Ingarune la Celyn
Jando Abengau
Judiadonne Winneström
Juliya Kriegor [Not quite Russian, not quite German…]
Kate Clockmorster [I can totally see "Clockmorster" as a surname descended from some obscure Medieval profession.]
Kihamerica Nöll
Larastra Beeferrie
Larcia Armondick
Lelotte von Bolivia [Interestingly, "Bolivia" does not appear in the source text — it looks to be composed via overlapping substrings from "Bolic" and "Olivia"]
Levy Kravendy [This one's fun to say out loud]
Locket Squit ["random English word" take 3, with added Jacuzzi Splot-level silliness]
Lucy Donatalis
Makia J. Grave
Marinico Fordy
Maristephiez Twift
Maxwelle Frantallia [I can totally see someone using "Maxwelle" as a feminine form of Maxwell]
Melo Mirulyne-Krugelweizer [What even is that double surname?]
Nemaillia Folkwyb
Neodylan Vladivlad [My second favorite; should totally be a Gundam character]
Orgo MacNear
Pronch Dorelet
Redis Schrönn
Riddy Mirard
Roberg Asberg
Roston Knutmight [Put "Knutmight" up there with "Clockmorster"]
Sephild Waldarl
Shakira Öswell [Not only is "Shakira" not in the original list, it looks to have required substrings from three different names to produce]
Sharlee Albertoilenda
Sila Medrini
Solenno Bastarosa
Susie Gloristophilia [The juxtaposition of the perfectly normal given name with ridiculously-implausible surname]
Syda Barters
Sylpha Martlee
Tequille Richenhein [Like "tequila" crossed with "Shaquille"]
Thorna Fiorrevík
Timmy Squimpton
Uriam Sisguy
Vans Torris ["random English word" take 4]
Wulf Lavenicoda
Yagelas Lusilovsky
Ziske Oxforton [Would this supposedly be British?]
Will we ever get anything quite like Code Geass again?
I don't think it's possible.
Code Geass is Japanese nationalist propaganda disguised as a global political drama, disguised as a military mecha show, disguised as yaoibait, disguised as a teen melodrama, disguised as a high school romcom, disguised as a Pizza Hut commercial...
...except those layers aren't layers at all, but are instead comingled in a giant snake ball of insanity.
The lead writer, Ichirō Ōkouchi, only ever worked as an episode writer for other shows prior to Code Geass, and never took the helm of an anime series ever again. And it shows.
The minute-to-minute pacing is impeccable from a mechanical standpoint, with tension and stakes rising to ever-higher peaks, balanced out by the slow simmers of the b-plot and c-plot. It keeps the viewer on the edge of their seat at all times. Meanwhile, the large-scale plot is the most off-the-wall middle school nonsense I've ever seen, continually surprising the viewer by pulling twists too dumb to have ever have been on their radar—and therefore more effective in terms of raw shock value.
"Greenlight it!" was the mantra of this anime's production. It must have been. It has, in no particular order, all of the following:
Character designs from CLAMP, the foremost yaoi/BL group in Japan at the time—for characters who are only queer insofar as they can bait the audience, and only straight insofar as they can be more misogynist to the female cast.
Speaking of the female cast, hoo boy the fanservice. We've all seen anime girls breast boobily, with many cases more egregious than Code Geass, but there's something special about it happening immediately after—or sometimes in the middle of!—scenes of military conflict and ethnic cleansing.
Pizza Hut product placement everywhere, in every conceivable situation. High-speed chases, light slice-of-life scenes, intimate character moments, all of it. Gotta have Pizza Hut.
The anime-only Pizza Hut mascot, Cheese-kun. He wears a fedora.
The most hilarious approximations of European names—which I would love to see more often, frankly. Names like, I dunno, "Count Schnitzelgrübe zi Blanquezzio."
A depiction of China that is wholly removed from any modern reality, with red-and-gold pagodas, ornamental robes, scheming eunuchs, and a brainwashed child empress. There's a character named General Tsao, like the chicken.
Inappropriate free-form jazz in the soundtrack, intruding at the most unexpected times.
A secret cabal not unlike the Illuminati, run by an immortal shota with magic powers, holding influence all across the world, at the highest levels of government. They matter for approximately three episodes.
An unexpected insert scene of a schoolgirl using the corner of a table to masturbate. She's doing it to thoughts of her crush, the princess Euphemia—because she believes Euphemia to be as racist as she herself is, and that gets her off. This interrupts an unrelated scene of our protagonist faction planning their next move, which then resumes as if uninterrupted.
Said schoolgirl, in a fit of hysteria, threatens to detonate a worse-than-nuclear bomb in the middle of her school. She then goes on to develop an even more destructive version of that bomb, and become a war criminal, in a chain of cause-and-effect stemming from the moment she finds out that Euphemia wasn't actually that racist.
A character called "the Earl of Pudding."
A premise that asks us to believe that the name Lelouch is normal enough that he didn't need to change it when he went into hiding as an ordinary civilian. "No, that's not Prince Strimbleford von Vanquish! That's our classmate, Strimbleford Smith."
The collective unconscious, a la Carl Jung, within which the protagonist fights his villainous father for control over the fate of humankind. After this is over, the anime just keeps going for about ten more episodes.
An episode in which a mech tosses a giant pizza.
A gay yandere sleeper agent who can manipulate the perception of time.
Chess being played very badly, even to the untrained eye. Lelouch frequently checkmates his opponent by moving his king. This goes hand-in-hand with the anime's crock of bad chess symbolism.
A fictional drug that can most succinctly be described as "nostalgia heroin."
Roller-skating mecha in knightly armor, and some of the most sickass mecha fight choreography that I've seen.
I could go on and on, but I think you get the picture. This anime is what the average Westerner in 2006 thought anime was, and it was made in a confluence of factors that cannot be replicated. I've never had so much fun watching something that I found so... insulting. Repugnant. Ridiculous. Baffling. I love it sincerely.
Catch me cosplaying Lloyd Asplund at a con sometime, or maybe even the big gay loser himself, Lelouch vi Britannia.
5K notes
·
View notes
Text
Twine Sugarcube 101
AKA, all you need to make a Twine game (I swear to god)
I’ve seen a lot of people go “Twine is too complicated for me :(” and give up before they’ve even started. And that makes me sad, partly because they’re giving up on a really cool hobby, and also because that’s false! It’s absolutely not too complicated for you!
I think the problem is that people look up Twine, see the documentation, and go “There’s way too much there! I can’t learn all that!” Well guess what- you shouldn’t learn all that, at least not yet. As a beginner you can skip pretty much all of this:
(Ignore <<linkappend>> too, forgot to crop that one out)
That’s a lot more manageable, right? Below the cut, I’ll let you know how to use all those remaining important things to make your story! Warning- it’s quite long! You might want to read it in sections! And while I’ll try to keep it entertaining, it’s also a coding tutorial, so... y’know. Might not be the most exciting read if you aren’t trying to learn Twine.
Welcome to below the cut!
First off, make sure your story format is set to Sugarcube 2. On the right side of the home screen (with all your stories), click format and choose the one labeled “Sugarcube 2.x.x” then open a new story with the green button! Here’s what you’ll see and what it all means:
Passages are all like individual web pages that you navigate between to play the game. When they’re linked together they’ll be shown like this:
Anything you write in a passage will just be shown on screen as plain text, no code required! But if you want to make anything more than just one passage with a bunch of text, you’ll have to link passages together with...
Links!
A link is composed of two parts- the text you see on screen, and the name of the passage you’re attaching it to. These are enclosed in [[double square brackets]], with a vertical bar | or a little arrow -> between them. If you want to show the passage name instead of alternative text, you can just put the passage name in square brackets alone! So this in the editor:
[[Visible text|Passage name]]
[[Visible text->Passage name]]
[[Passage name]]
Will look like this in the story:
Visible text
Visible text
Passage name
And all of them will lead to the passage labeled “Passage name.” You don’t even need to create the passage- when Twine sees that you’ve linked to a passage that doesn’t exist, it’ll add that passage for you.
That’s all you need to know! Technically, all you need to do to make a Twine story is add those fancy links between passages. If you add your awesome writing skills, that story will be super cool!
...but you want to do some fancy shit, right? Well let me introduce you to the next step up in complexity,
Variables!
“Variable” is a fun, code-y way to say “a bit of information that can change.” You could say they... vary.
Variables are useful for keeping track of information. If the player chooses to be blonde instead of a redhead, you might want to bring that up again- but you probably don’t want to write an entirely separate story based on that choice, right? So instead you save that information as a variable.
In Twine, variables are written as words with a $ in front of them. So my hair colour variable might be “$hairColour.” If you just write the variable out without any code, Twine will print the information you put into the variable. So if $hairColour is set to “blonde,” this...
She had $hairColour hair.
Will become...
She had blonde hair.
The value in a variable can be a boolean (ie. true or false), a number, or a string (like “blonde” or “any other string of characters”). They can also be fancy stuff like arrays, but we won’t be touching on that.
You can use variables to keep track of a lot of things! For instance...
How much money the player has
Whether a player has a key
What the player’s name is
I keep mentioning the value of a variable or “setting” it, but how do you do that? Well, one way is to add it to a link. If you want a link to set hair colour to blonde, for instance, you could write [[Blonde|Next passage][$hairColour to “blonde”]]. Clicking on that link would forward the player to “Next passage” and set the value of $hairColour to “blonde.”
There is a better way of doing it, however, but we’ll need to talk about...
Macros!
A macro is a snippet of code that runs when you put a special code word inside these <<spiky boys>>. You can write your own macros with JavaScript if you’re smart, find them on the internet if you’re even more smart, or just use the ones that come built in with Sugarcube.
The ones we’ll be talking about, and the ones that are the most important for most Twine games, are <<set>>, <<if>>, and <<link>>.
<<set>>
The <<set>> macro allows you to, you guessed it, assign a value to a variable. For instance, if you want to set $hairColour to blonde... well, that’s all you need to do! It’s just:
<<set $hairColour to “blonde”>>
It’s important to remember with the <<set>> macro that strings (collections of different characters) require quotation marks around them to show the code that it isn’t a number or a true/false value. If you put quotes around a number and try to do math with that variable, you’ll get a big ol’ error message.
If you’re using numbers, you can also use JavaScript operators in place of “to.” Each one will perform a calculation on the variable if that variable is a number, and then replace the variable with the result. If you want to add $5 to the player’s $money, you could use this:
<<set $money += 5>>
The “+=“ will add the number on the right to the variable on the left. “-=“ will do the same for subtraction, “*=“ for multiplication, and “/=“ for division. Easy enough, just don’t forget the = sign after the usual symbol!
By default, the <<set>> macro will be executed as soon as the page it’s on loads. Sometimes that’s useful, but sometimes you would rather the player click a link that sets a variable- like if they choose a hair colour. You might also want the same link to set multiple variables, like subtracting money and giving them an item when they use a shop. How do we do that?
<<link>>
The <<link>> macro is also pretty simple. All it does is create a link, and when that link it pressed it executes whatever is inside of it. Here we’ll be using it with <<set>>, but you can use it with all kinds of different macros and even nest some of them to do really complicated stuff!
As an example, we want the player to click “buy key,” give the player the key, and subtract $5 from their money. Here’s how we do it:
<<link “Buy key”>>
<<set $key to true>>
<<set $money -= 5>>
<</link>>
The text the player will click is in quotation marks, and after all of the macros we need to execute we have to close off the code by adding <</link>>. Easy, right?
But other than printing them on the screen, what can you actually use those variables for? Well, for that we’ll be using...
<<if>>
The <<if>> macro is my favourite, hands down, because it’s an easy way of accomplishing hard stuff. Simply put, <<if>> will check if the thing you asked about is true, and if it is, it will do whatever you put inside of it.
Here’s a simple example:
<<if $key is true>>
[[Use the key|Progress]]
<</if>>
Whatever is inside the <<if>> macro will be executed if the “if” statement is true. In this case, the link “Use the key” will be printed on the screen only if the player has the key. This also applies to code- if you put a <<set>> macro inside, that macro would only set a variable if the player has the key.
Now here’s a more complicated example, to show everything the <<if>> macro is capable of. Here we also want to check if they’ve already opened the door, and display alternate text if they have no key and the door is locked.
<<if $key is true>>
[[Use the key|Progress]]
<<elseif $doorOpen is true>>
[[Walk through|Progress]]
<<else>>
You need to find a key.
<</if>>
I’ll break it down line by line to tell you what each thing does.
<<if $key is true>>
This line is the only necessary one- it checks whether $key has been set to true. You can check for any value that a variable can be, like a number, true/false, or a string. You can also check for other things with this macro- for instance, “isnot” will check that the variable isn’t equal to the value on the right. “gt” or “lt” will check if the variable is greater/lesser than the value on the right, and “gte” or “lte” will check if it is greater than or equal to the value.
<<elseif $doorOpen is true>>
This line allows us to check for something else within the same <<if>> macro. Once the game has checked the original <<if>> and found that it is false, it will move on to checking each <<elseif>> until it finds one that is true. You can have as many <<elseif>>s as you need, and they can check the same variable or different variables, but only the first true one will be executed! And, of course, you can’t use <<elseif>> on its own- it’s stuck to the <<if>> macro!
<<else>>
This line is the last resort- if the original <<if>> and any <<elseif>>s have all been false, the game will execute whatever is after <<else>>. Because of this, there can only be one <<else>> line within any <<if>> macro! If you don’t have an <<else>>, nothing at all will be executed, so whether you include one depends on the situation.
<</if>>
This closes off the <<if>> macro. Nothing special, but very important! Put it after the last piece of code or bit of text you want the macro to control.
Phew. That’s it! That’s all I wanted to show you!
Now, HOMEWORK!
Okay, not homework, just practice. Here are some things you can try building to practice all these tools and get comfortable with how they work!
A store system with different items for different amounts of money
A character creation screen, followed by a description of your character (with variables!)
A puzzle that requires you to choose the right answer to proceed
If you have any trouble, need to ask any questions, or if something in this tutorial wasn’t clear to you, please let me know- you can DM me or send me an ask anytime and I’m happy to answer any Twine questions you have. I hope this was of use to you, and have fun making games <3
#told you i was making a tutorial!#not crosshollow#tutorial#game dev#twine game#twine#interactive fiction#gamedev
2K notes
·
View notes
Photo
Recreating the Google Homepage
An Odin Project Challenge
Diversifying Education
Until recently, I have focused solely on building projects for freeCodeCamp. While these experiences are certainly valuable, I wanted to extend the reach of my education (while also teaching myself how to multitask with separate goals in mind.) This intention brought me to the Odin Project. Here, I have learned a bit of Git and have now completed a Google Webpage clone. The following will detail some lessons absorbed from this experience.
Git Basics(, very basically)
My knowledge of Git is still very minuscule. At this point, I am capable of cloning remote repositories to my local repository with ‘git clone ([email protected]:username/example.git)’.
Once the desired repository is within my target directory (and any adjustments have been made), ‘git add (file.ext)’ [track specific file] | ‘git add -A’ [track all changes] | ‘git add .’ [track new files and modifications without deletions] | ‘git add -u’ [track modifications and deletions without new files])’ will appropriately stage new, deleted or modified elements. This indicates a move from ‘working tree’ to ’staging area.’
After all of my intended files and folders are safely moved to the staging area, I am then prepared to commit to my local repository. This can be achieved by using the command ‘git commit -m “-insert-message-here-”’ [each message will document progress].
Intermittently, I am able to use ‘git status’ to ensure I know the current state of my elements within the working tree, staging area and local repository.
Lastly, when my information has been modified, moved from ‘working tree’ to ‘staging area’ and from ‘staging area’ to ‘local repo’… I then have the option of pushing all material to a remote repository (Git Hub) by way of ‘git push origin main’. This final command will tell Git (DVCS) to push the elements in question onward to the pre-set location (origin: declared previously with the cloned SSH key) and to do so on the (main) branch.
Finally, ‘git log’ will display pertinent info (in regard) to each of my commits. These distinctions are: unique commit hashes, author, date and messages.
I have integrated a few more Git tools into my workflow. I will quickly state those, but wait until I have a more balanced comprehension of Git before going into depth about functionality. They are as follows: ‘git fetch’ [retrieves references/objects only] | ‘git pull’ [retrieves references/objects and merges] | ‘git reset - -soft HEAD~1’ [undo last commit without altering recent modifications of current branch HEAD] | ‘git reset - -hard HEAD~1’ [undo last commit and recent modifications of current branch HEAD].
Any time I updated my ‘README.md’ file during this project, I used ‘vi’ (screen-oriented visual editor). The editor can be opened with the command: ‘vi file.ext’. In command mode: ‘i’ will allow insertion of text, ‘:w’ saves modifications, ‘:q’ exits the editor, ‘:wq’ concatenates both previous commands and ‘esc’ shifts from ‘edit’ back to ‘command mode’.
In addition, ‘touch (file.ext)’ [create a new file within the current directory] | ‘echo “-insert-string-here-” >/>> file.ext [replaces all text with new string/adds string onto next line in a file]’ | ‘sed ’s/find/replace/’ file.ext’ [find and replace certain characters/strings]’ | ‘sed -i -e ’s/-insert-string-here-//g’ [edit/remove certain characters/strings in-place]’ | ‘> file.ext then ^C’ [clear all text from file] | ‘(dquote) resolved with !’.
Coding the Webpage
The Google homepage is relatively simple to recreate (after having already demonstrating many requisite techniques in previous projects.) That said, I will share some new processes and maneuvers I learned over the course of this challenge which helped me deploy a more polished final result.
As I created my files for HTML, CSS and JavaScript, I added a ‘reset.css’ file with ‘Meyer CSS reset v2’. This removed all default browser styles and allowed for full control of any CSS I would later add.
Using pseudo-class selectors (hover and focus,) my anchors and buttons became more customizable. The instances where I used these allowed me to better dial into the signature Google-page-experience.
Two JavaScript events (onmousedown | onmouseup) enabled me to call functions which let me achieve the click behavior of my ‘sign-in’ button.
As a bonus to the development of this project, I learned how to better create textual images with Photoshop. With attention to anti-aliasing, image size (width | height) and pixel density, I now understand how to implement smoother edges in these cases.
Conclusion
After completing this webpage, I am comfortable executing all I have learned until now. Of course, this is a small fraction of what is yet to come. However, I sense noticeable momentum and confidence after finishing this challenge. Now, onward to the next assignment.
1 note
·
View note
Text
Ok firstly I can code and secondly this is actually quite doable
Like first gather a bunch of quotes, sort them based on how many people aren't in them, put said sorted quotes into their respective lists, format the quotes to have strings where the names of the characters are and that’s prep done
When asking for the amount of names use that to determine the quotes for use, when asking for the names themselves randomly assign each name a number and use that to replace the strings in the formatted quotes
Finally print all of this out to the terminal or if it’s on a website add it to a textbox(most likely a div)
Like I could probably do it kinda python although it would probably be better to use java/javascript (idk which is used for websites) and then host it on a website using github
I just had a stupid idea.
Inspired by this post
I can't code worth a chip of flaming chull dung, but I'll do what I can, so here's what we should do: we should create a new incorrect quotes generator using samples from our own WIPs, and then have everyone run their characters through it and turn it into like a tag game where you create three incorrect quotes using the generator and then propose one from your own writing to be added into it or something. Get the vision?
Anyway, here's who I'm recruiting for my crack idea that may never get off the ground (Note: I started working on it right after typing those words. I'm not very far, but progress is being made. If someone else thinks they can get it all coded and stuff before I get it done [which you'd probably be right in thinking], feel free and I'll hand the reins over to you): All my mutuals. All of 'em. Feel free to bring more people into this as well.
So to begin with the tagging: @tildeathiwillwrite, @somethingclevermahogony, @the-ellia-west, @smudged-red-ink (wake up pls I'm still worried), @aesthetic-writer18,
@pastellbg (ik you're not a writing mutual exactly but I said all), @illarian-rambling, @lunaeuphternal, @thewritingautisticat, @aalinaaaaaa,
@elizaellwrites, @cybercelestian, @pluppsauthor, and @corinneglass!
...
I'm not exactly sure what you're supposed to do with this information quite yet, but... I dunno. It's still very possible I'll forget about this within the week, so someone make sure to remind me I started another stupid project, k?
125 notes
·
View notes
Text
javaScript Replace () | javaScript String Replace All
javaScript Replace () | javaScript String Replace All
Metode ganti string Javascript (). Dalam tutorial ini, kami akan menjelaskan metode javascript string.replace () dengan definisi metode ini, sintaksis, parameter, dan beberapa contoh.
Ganti String JavaScript ()
Definisi: – Metode JavaScript string replace () mencari string untuk nilai yang ditentukan atau ekspresi reguler, atau kata kunci, dan mengganti string pencarian yang cocok ke string yang…
View On WordPress
#javascript replace ()#javascript replace all instances#javascript replace all spaces#javascript replace character#javascript replace character in string#javascript replace function#javascript replace regex#javascript replace special characters#javascript replace text#javascript replaceall
0 notes
Text
Url Encoder / Decoder
For optimum performance, use a URL encoder and decoder. Now, HTML decoding or javascript URL encoding is simple.
URL Decode Encode is a simplistic web application that does exactly what it says: it quickly and easily decodes from URL encoding and encodes into it. You may easily URL-encode your data or decode it into a format that can be read by humans.
You can encode or decode a string of text using the free URL-encoder-decoder tool.
Every website owner must make use of a tool for free URL encoding and decoding. Website URLs must be uniformly encoded for compatibility to be achieved globally. There are two methods for handling the large mapping array of characters used in URLs: first, encoding the text of strings into a series of bytes using the UTF-8 encoding, and second, changing every byte that is not an ASCII letter or digit to HH%.
Best URL Encoder/Decoder.
Best URL Encoder Decoder allows you to simply encode or decode any string of characters by placing it in the blank text box. And once users click the "Submit" button, it will be encoded/decoded by the guidelines of the Uniform Resource Identifier. When preparing any kind of media or data, such as when submitting HTML form data, the encoding/decoding tool is used. The encoding system is known as percent-encoding.
https://importantseotools.com/url-encoder-decoder
Online URL Encoder Decoder tool is very helpful for adding special characters to a URL parameter.
When adding special characters to a URL parameter, commonly known as percent-encoding and often referred to as it is quite helpful to use an online URL Encoder Decoder tool. Replace any forbidden characters with the percent sign (a%) and an additional pair of hexadecimal numbers during the URL encoding process. The source of an email campaign or newsletter can be determined via URL decoding.
0 notes
Text
Best json formatter

BEST JSON FORMATTER REGISTRATION
BEST JSON FORMATTER CODE
BEST JSON FORMATTER FREE
The data structure is simple to comprehend.
For most programming languages, a gazillion JSON libraries are available for.
Parsing is simple, particularly in JavaScript.
Unlike XML, it’s lightweight because it doesn’t use a complete markup structure.
It’s readable by humans if it’s formatted correctly.
There are lots of reasons why you would like JSON to be used:
This JSON formatter online can also be used as a JSON lint.
Store data for the last Formatted JSON locally in Browser Local Storage.
It’s the only JSON tool that displays the image in a tree view on the Image URL hover.
It helps to verify JSON via Error Messages online.
BEST JSON FORMATTER CODE
If the JSON is invalid, it will search the correct JSON code for errors and point out the errors. You can paste or upload the data from your computer to JSON Parser Online. It will automatically detect invalid JSON documentation or syntax automatically and get instant results in an easy-to-read format. All you require to do is paste your JSON code into the specified space. JSON formatter is an online application that uses the online JSON schema validator to validate JSON code.
BEST JSON FORMATTER REGISTRATION
No need for installation or registration is necessary! Online JSON Tools JSON Formatter It’s quick and easy with such apps, fill in the editor and click on the desired action button. This can be useful for embedding JSON in code, for instance. Finally, you can also use JSON data to escape/unescape. It’s also possible to minify your JSON (The opposite of pretty JSON, it removes all unnecessary characters). Your JSON data is automatically checked when you fill in the editor, and a message tells you whether or not your JSON is correct. These tools are also a validator and a JSON checker: you can check JSON online without pressing. This tool allows JSON to be read and debugged easily by humans. For a human (without line breaks), JSON strings are not always very readable, mainly if they are bulky. To help debug JSON, the JSON formatter tool was developed. It is a widespread data format with a diverse range of applications, such as serving as a replacement for XML in AJAX systems. It is an open standard file format and data exchange format that uses human-readable text to save and transmit data objects consisting of attribute-value and array data types. JSON is “self-describing” and easy to understand. JSON is often used when information is sent from a server to a webpage. No data will be stored in our server.JSON is a lightweight form for storing and transporting data. Yes, our JSON formatter online tool is privacy friendly and formatting JSON is done locally in your browser. Copy the JSON formatted code by clicking on copy button. To use JSON Formatter online, paste your tidy JSON code inside the input box, then select indent and click on format JSON button. It can be used as JSON validator, editor and viewer tool. JSON Formatter is an online tool that can be used to format JSON.
SQL formatter – SQL formatter beautifies tidy SQL with your desired indentation level.
CSS Formatter – Use this CSS formatter online tool to format/beautify CSS code.
JavaScript Formatter – Online JS formatter helps to format or beautify JavaScript.
It also be used as JSON formatter and validator.
JSON Formatter– Online JSON formatter helps to quickly format JSON.
HTML formatter – Online HTML formatter beautifies ugly/tidy HTML code by making it readable and pretty, with proper indentation level.
Online tools to format JSON, JS, CSS, HTML and SQL
You can use this JSON formatter as JSON validator, JSON viewer or JSON editor.
It allows you to copy formatted JSON data.
It allows you to upload JSON file and format it instantly.
It’s the best JSON formatter online tool to format/beautify your JSON.
Choose indentation level ( 4 spaces by default) as your choice to format your JSON code.
JSON formatter supports 5 indentation levels: 2 spaces, 3 spaces, 4 spaces, 8 spaces and tabs.
This JSON formatter beautifies JSON locally on your device, which means no data is uploaded to the server.
BEST JSON FORMATTER FREE
Free and easy-to-use online JSON formatter tool for developer.If you Want to format or beautify JSON? then simply paste your JSON file in the code editor and let JSON formatter format, validate and print your JSON data into pretty, human-readable format.Step 4: Feel free to use the quick copy button to copy the code.Step 3: If you’ve done it correctly, the formatted JSON code should now appear in the output box (bottom side).Step 2: Click the “Format JSON” button and wait for the JSON formatter tool to finish formatting your code.Step 1: Paste your JSON code inside the input box (top side).

0 notes
Text
Save a custom template in racerender

#Save a custom template in racerender code#
Download our Success PowerPoint Templates because It will Raise the bar of your Thoughts. Just enter your specific text and see your points hit home. Download our People PowerPoint Templates because Our PowerPoint Templates and Slides will help you be quick off the draw. Download our Leadership PowerPoint Templates because You can Be the star of the show with our PowerPoint Templates and Slides. Use them and give your group a sense of your logical mind. Download our Business PowerPoint Templates because Our PowerPoint Templates and Slides are created with admirable insight. Let our PowerPoint Templates and Slides provide the fuel for your ascent. We present our business people vector 3d men sport team PowerPoint Slides.Download our Sports PowerPoint Templates because You aspire to touch the sky with glory. People Business 3d Men Pyramid PowerPoint Slidesīusiness People Vector 3d Men Sport Team PowerPoint Slides The prominent colors used in the PowerPoint template are White, Gray, Black. Download and present our Future PowerPoint Templates because Our PowerPoint Templates and Slides will let you Clearly mark the path for others to follow.Use these PowerPoint slides for presentations relating to 3d, abstract, acrobat, athlete, background, business, businessman, character, competition, concept, corporation, cute, each, finance, form, graphics, grey, guy, human, humorous, illustration, image, isolated, leader, little, man, management, people, person, pyramid, rank, render, small, sports, success, team, top, white, work. They will unfurl your brilliant plans to your audience. Download our Success PowerPoint Templates because You can Flag mark the road ahead with our PowerPoint Templates and Slides. Present our Teamwork PowerPoint Templates because You can Stir your ideas in the cauldron of our PowerPoint Templates and Slides. Our PowerPoint Templates and Slides will provide you the necessary glam and glitter. Download our People PowerPoint Templates because They will Put your wonderful verbal artistry on display. Use them and effectively satisfy the desires of your audience. We present our people business 3d men pyramid PowerPoint Slides.Download our Business PowerPoint Templates because Our PowerPoint Templates and Slides will fulfill your every need. If you want to have more control on the layout, use DIV and SPAN with CSS styles, e.g.People Business 3d Men Pyramid PowerPoint Slides Since JsRender template tags use tags inside the selected text is literal "field", it is a placeholder to be replaced by actual field names in the table.Įxample 1 - Custom Template in Add/Edit/Search/View page or Extended Search in List page To let you create your Custom Templates easily, ASP.NET Maker supports the following Custom Template Tags. The customizable regions are highlighted as follows:Ĭustom Template also supports Summary Report (but not Crosstab Report): Your Custom Template can make use of its features to display the field values.Ĭustom Templates let you customize the layout of the fields originally placed in the main HTML table of the page, they cannot customize HTML outside those regions. The client side template is further rendered by JsRender (see Third-Party Tools) which is a third-party JavaScript template engine optimized for high-performance pure string-based rendering. In other words, it is simply re-arrangement of existing HTML parts in browser.ĭuring script generation, ASP.NET Maker converts your Custom Template to a client side template and outputs JavaScript to render the template.
#Save a custom template in racerender code#
If a Custom Template is provided, ASP.NET Maker splits the original code in many small client side templates enclosed by tags so it is possible to re-assemble HTML from the small client side templates by JavaScript based on your provided Custom Template. Note Custom Templates do NOT support Internet Explorer.

1 note
·
View note
Text
Logging Breakdown
It’s almost certain that any code you write will have a bug in it. There’s a lot things that can help with finding them and one of those things is logging to the console. Most programming languages have a function called something like “print” or “log” to output data and messages while the program is running.
The way logging works on StoryDevs is a little more complicated. For brevity I’m just going to describe how logging works in the browser and skip how it’s done on the server.
Simple Logging
In JavaScript we use the console object which has a few different ways to log things. For example if you have a script with a line of code that reads:
console.log(“Hi there!”);
If you open up Chrome’s dev tools (shortcut is F12) and go to the “Console” tab you’ll see this:
Note how it says “script.js:2342” on the far right. This tells us where the line of code that logged this information is. It can be useful when you’re trying to figure out where an error is coming from, especially if you have thousands of lines of code. The “script.js” part refers to the file name and “2342” is a line in that file.
Default Logging Is Nice
The default methods for console are nice because you can log things other than just text. You can essentially log anything and it’ll look pretty good in the console. For example let’s say we have the following array:
let a = [“Some string”, 52, true];
And then we log it:
console.log(a);
The console will output this:
Any time you log something like an array or an object you’ll be able to expand it to see what it contains. Again, useful for debugging.
I Log A Lot
So much, in fact, that I find typing “console.log()” kind of annoying. So I made a function called “log” which works exactly the same and just has a different name:
There’s actually another way to do this which is:
let log = console.log;
Either way you can now write:
log(“My message…”);
And it’ll work. The second way actually avoids a problem I’m about to show you with the first approach but we’re doing it the first way to illustrate a point.
Remember how console.log tells you the file and the line you logged from? Well the problem with creating your own function named “log” and then calling console.log inside it is that it’ll always list the same line: the one that console.log is on.
So let’s say we have the following code:
This is what the result will be:
Notice how on the right it says the array was logged from line 3, not line 7 where we actually did our logging. In fact, if you defined the log function in another file it’d even list that file instead of the one you logged from. This isn’t what we want! So why did I do it this way and how do I get around it?
Why I’m Doing It The Hard Way: Part 1
To explain this I need to show you how I work. When I write JavaScript for StoryDevs I try to sort the code into a few broad categories and then make each category its own file. So here’s my JavaScript folder (there’s three other folders inside it but just ignore those):
Each file does stuff related to its name. For example, columns.js contains all the code related to StoryDevs’ columns. When the site is public I don’t want all the code split up like this.
Firstly, it makes understanding the code a lot easier because the code is logically organised. StoryDevs will skew left (politically speaking) and I don’t want it to be easy to make a “without-the-politics” (i.e., right-leaning in this climate) knock-off of StoryDevs. I want them to have to cobble together disparate code or write it themselves :)
The second reason is that one big file compresses better than several smaller files. The basics of compression is that it finds a repeating pattern in the text and then replaces it with a smaller code. To allow for uncompressing a little dictionary is kept which tells us what pattern each code refers to.
Let’s say we have this file:
If we zip this it’s smaller than if you have two zipped files with the functions split between them. The larger the files get the more true this is. Combining all my JavaScript files into one big file and then compressing it results in a 10% smaller zip. That’s a decent saving for a file that will be requested a lot.
The third reason is it’s just nicer to only have to link to one script file! I don’t have to remember to include a new JavaScript file if I happen to make a new one.
What Does This Have To Do With Logging!
Remember earlier when we logged something and it showed us the line number and the file name? Well if you combine all your files into one big file before it’s sent that means the logging info will be incorrect. It will log the big file’s name (I simply call it “script.js”) and the line number won’t be the original line number.
So if we have a file, “little_1.js”:
And we write a helper program that joins it with “little_2.js” (this is basically what I do on the server):
We’ll get this:
What was previously line 1 in “little_2.js” is now line 10 in our new automatically generated script. The script itself doesn’t know which parts of it originally belonged to which file. Both these things make debugging harder. So to get around this I add a little extra info at the bottom of my big script file:
As I build the single script file from the smaller script files I save each file’s name and the number of lines it contains to an object. Then I write this object at the very end of the file. Using this, a bit of math allows us to figure out the appropriate name and number to use when logging.
Why I’m Doing It The Hard Way: Part 2
Okay now I’m actually going explain this! Remember how there’s two ways to create a function called “log”? There was this way:
And this way:
let log = console.log;
And the first one has a problem in that it will also think the logging is occurring on the line where console.log is rather than from where you’re calling log from. Despite this, I chose to do it that way because I need to do that math to work out the file name and line number anyway before logging.
If you look at the second approach to creating a log function, all it’s doing is saying “‘log’ now means ‘console.log’” — it doesn’t allow us to jam more code into it. Whereas in the first approach you can write as much code as you want before the logging takes place. And boy do I do that:
Let’s break this down. First I start out by creating an error object. I’m doing this because an error object contains the stack property. Now, in programming there’s something called the “call stack” and this is what stack refers to. It’s a list of all the functions that were called to get to this point in your code.
Here’s an example of what it looks like if we log err.stack:
Keep in mind it starts from the most recent function call. If you were to say this in plain English you might say, “There was an error in the ‘log’ function which was called by ‘init_actionables’ which itself was called by ‘dynamic_content_init’ [. . .]” and so on.
The err.stack property of an error is a string, which means you can call string methods on it. For example, we could do err.stack.toLowerCase() which would make all the text it logs lower case. In my case I call split on it:
First, what’s “\n” mean? That’s an invisible character computers use to mark where a new line begins. It’s inserted every time you hit your enter key. See how when we logged err.stack above it’s on multiple lines? That means the string contains “\n” characters.
When I call the string’s split method and pass in “\n” it means “split this string where the new line characters are”. It results in you getting back an array of strings. So if we log err.stack.split(“\n”) we get this:
Instead of one long string we now have six strings. Because we divided the original string by its lines, we now have the name of one function per line as well as the file name and line number it was called from. (The exception is the first string that just says “Error.”)
So, err.stack.split(“\n”) results in an array of strings. Because this error was created inside the log function we know the first function will always be log. The one after that (the third element) will always contain a string describing the function that called log.
So we get the third index of the array (which is 2 because it starts from 0) and then call trim on it. The trim function just gets rid of whitespace padding on the left or right of a string. As you can see above there’s some leading whitespace that we don’t want.
Finally, we assign the result of all these operations to line. So right now line contains the string:
“at init_actionables (http://localhost:8080/js/script.js:2532:5)”
What we want from this string is the function name and the line number. So with the next bit of code we start to extract the line number:
We’re take the string we assigned to line, call the split method on it (passing it a space character), and then store the result in parts. After this the contents of parts is an array containing separate strings that were previously joined by spaces:
(Incidentally, this is why I called trim beforehand — there would be four empty strings before “at” because of the four leading spaces. So I got rid of them to make the array easier to think about.)
Okay, let’s speed things up a bit. The next few lines are doing something similar to the previous ones:
First we grab the last element in the parts array and assign it to source. To get the last element of an array you have to get the arrays length (parts.length) and then subtract one from it. The last index of an array that is 3 elements long is “2” as most programming languages have arrays that count from zero.
That means source now contains the string:
“(http://localhost:8080/js/script.js:2532:5)”
Next, we break source into parts, dividing it anywhere a “:” appears. Note that I name it “source_parts” instead of overwriting parts because I still need parts for something I’ll do later. So source_parts now looks like this:
Then we grab the fourth element (index 3) and assign it to abs_line (the name stands for “absolute line”). This is the line number of where log was called in the big script we built earlier. Now abs_line contains “2532” as a string value. The next part looks complicated but it’s not too bad.
First we define some variables source_file, rel_line, and total. I give total a default value of “0” because I’m gonna do math with it. The reason I define these outside the loop is that any variable created inside the loop only exists for that iteration of the loop. I need total (and the other variables) to persist after that.
Next we start the loop. The object script_meta was the thing we defined at the very end of the big script that listed all the names of the JavaScript files and how many lines they contain. It looked like this:
Each time we loop, the fn variable (which stands for “filename”) is assigned a key from the script_meta object, starting from “column.js” through to “tools.js.” Next we assign the result of subtracting total from abs_line to rel_line (“rel_line” stands for “relative line”). Since abs_line is 2532 and total is 0 we get 2532.
UTTERLY POINTLESS YOU FOOL. Well hey hold on. Next we grab the total line count associated with the current file by indexing script_meta with fn. If this were the first iteration of the loop fn would be “column.js” so script_meta[fn] would result in 526. Then we add this to total, making it 526 as well. Then…
...we have this little conditional. It says “if the total so far is higher than the absolute line (the line we logged from in the big file) then do this.” Then we say source_file is the current file name and use break, a keyword for ending loops early and continuing with the rest of the code after the loop.
In essence what we’re doing is going through script_meta and adding each file’s line count to total. Then we check if total has become higher than the line number we logged from in the big script file. If it has, we know that it must have originally been in this file because all the scripts were added together in alphabetical order.
The abs_line we logged from was 2532. Let’s visualise what the loop does:
Here we can see that once we get to “main.js” our total line count jumps to 4121, which is above abs_line’s 2532. That means the line was originally in the file “main.js” before we joined it together with the others. So our conditional tests true and kicks us out of the loop with break.
Now the two variables defined outside the loop (source_file and rel_line) contain the original source file name and the correct line number relative to the original file. That thing we were doing at the beginning of the loop:
rel_line = abs_line - total;
Was to figure out what the original line number was. If you subtract the total line count of the files so far from the line you logged from in the big file you’ll wind up with the original line. It’s telling us what the line number would be if you were logging from that file.
This results in source_file being “main.js” and rel_line being 192:
2532 - (526 + 1690 + 124) = 192
Christ, Can You Break This Up With Another Header Or Something
Yeah, sorry. I honestly didn’t think this wouldn’t take so long. I regret this post and my life as wel , ,
A Nicer Section
Next, a simpler part of the log function:
Again, we’re defining a variable before using it in the conditionals below so that it still exists outside those blocks. Then we ask if parts is longer than 2. What the hell is parts?! This is the thing we were saving for later. It’s the array we got by pulling out a line from the error’s call stack:
We’re checking its length because it can either be 2 or 3. In this case the function on this line has a name “init_actionables” but there’s a thing in JavaScript (and other languages) called an “anonymous function.” Basically they’re functions without names. If the function is anonymous parts will have a length of 2.
So if parts has a length of 2 we make the caller’s name “anonymous” otherwise we grab the second item and make that the caller’s name. Either way we now have a name!
Lastly, we have this:
The console object has methods other than just log. The group and groupEnd methods mark the start and end of a group respectively when logging to the console. Anything you log to the console after calling group will be nested under the heading you give it.
And that means the result of calling log like this:
Shows up in the console like this:
Woohoo! We have the correct file name, line number, and even the function name that log was called within. Over to the right you’ll see it says 5234 which is where console.group and console.log are logging from in the script file (which we don’t care about!)
As with the original console.log we can still log complex objects and have them display nicely:
Summary
That’s a lot so let’s recap:
Logging is useful for debugging.
StoryDevs has multiple JavaScript files. Before sending them to the user they’re combined into one big file because it compresses better, among other reasons.
A little bit of metadata that preserves the file names and their line counts is saved at the end of the big file.
When you use console.log the console will show you which file logged the message and from what line.
That file name and line number will be incorrect because we combined all the files into one big file.
Therefore, we need to do a little bit of parsing and math to work out the original file name and line number, using the metadata we saved earlier.
Conclusion
Well that’s it. It should be noted that I wrote this for myself in one afternoon so it’s not intended to be super robust. It’s only been tested in Chrome and I don’t care if it doesn’t work perfectly elsewhere at the moment.
Anyway, I hope someone finds this interesting/useful because my wrists hurt!
StoryDevs is a place for developers of story-focused games and visual novels to find each other and collaborate. The site is under development but handle reservations are open: www.storydevs.com/reserve
Website: www.storydevs.com Patreon: https://www.patreon.com/jakebowkett Twitter: https://twitter.com/storydevs Discord: https://discord.gg/A2jtNqE Email: [email protected]
7 notes
·
View notes
Text
Reasons Why Swift Will Sweep The Development Zone?
Programming languages evolve with time and those mobile app development companies who don’t make the shift with evolution, never make the cut. In the coming future, iOS application development will witness a new dawn with Swift. Swift won't just replace Objective-C once it involves developing apps for the Mac, iPhone, iPad, Apple Watch, however it'll conjointly replace C for embedded programming on Apple systems.
Swift definitely has the qualities to turn out as the best programming language iOS has ever witnessed. It is being used to create highly optimised and functional applications for iPhone, iPad, Mac etc. Keep reading to identify the reasons of why Swift is the future of iPhone application development.
1) Easy to decipher:
Swift is very close to natural everyday English in its approach to other programming languages. This aspect makes it easier for programmers functioning in JavaScript, Python, C# and C++ to make a shift to Swift.
2) Secure:
One intriguing part of Objective-C is the manner by which pointers—especially nil (invalid) pointers—are taken care of. In Objective-C, nothing happens on the off chance that you attempt to call a strategy with a pointer variable that is nil (uninitialised). The articulation or line of code turns into a no-task (no-operation), and keeping in mind that it may appear to be valuable that it doesn't crash, it has been an enormous wellspring of bugs. A no-operation prompts eccentric conduct, which is the foe of developers endeavouring to discover and settle an irregular crash or stop the sporadic conduct.
3) Less code - more output:
Swift diminishes the measure of code that is required for dreary explanations and string control. In Objective-C, working with content strings is exceptionally verbose and requires numerous means to consolidate two snippets of data. Quick embraces current programming dialect highlights like including two strings together with a "+" administrator, which is absent in Objective-C. Support for consolidating characters and strings like this is basic for any programming dialect that presentations content to a client on a screen.
4) Open to experimenting:
Swift gives the advancement group an immediate method to impact a dialect that will be utilised to make applications, inserted frameworks (if Apple ever licenses an implanted structure and chip for outsiders), and gadgets like the Apple Watch.
5) Dynamic libraries:
Dynamic libraries have never been bolstered on iOS until the dispatch of Swift and iOS 8, despite the fact that dynamic libraries have been upheld on Mac for quite a while. Dynamic libraries are outside to the application executable, however, are incorporated into the application package downloaded from the App Store. It decreases the underlying size of an application as it is stacked into memory since the outer code is connected just when utilised.
Hire Swift developers for a swift iOS application development experience. Reach out to us if you have any queries!
#iPhone App Developers#iOS App Developers#iPhone app development company#mobile app development company#iOS application development company#iPhone application development company
2 notes
·
View notes