arugula
@JacobMcPherson1
how do i get the first 11 characters off a string in javascript
samfierycreeper @JacobMcPherson1, you can substring()
let myRandomVariable = "Hello World!!!"
let otherVariable = myRandomVariable.substring(0, 5)
console.log(otherVariable) <-- prints the string "Hello"
Substring is a used for exactly what you're trying to do.
substring(characteryouwanttostartwith, characteryouwanttoendwith)2 years ago
Just a little pyramid generator I made so I could practice my D skills
Blank Repl
If I generate a big pyramid this weird question mark thing replaces some of the blocks (�). Why is this happening?
Ruby
ruiwenge2 I don’t know what it is but I do know the question mark appears sometimes to me as well2 years ago
How would I access the visitor's var in my index.html file?
Ruby
CodingCactus you should use erb files, not html ones
A little example:
main.rb
get "/" do
@randnum = rand(1..10)
erb :index
end
public/index.erb
If you need some explanation, let me know!2 years ago
I've made my own programming lang called Blade, and I've got basic things like output, variables, and math working but I'm gonna need help doing the m
Python
17lwinn Hi, I looked through the language- good job! Does Go have some part in this as a lot of the files end with .Go? Or is this so repl highlights them?2 years ago
Is there any way I can disable them somehow and just make my own errors?
Python
IMayBeMe Yeah, to my knowledge if you use try and except on every operation such as “+” and make your own error under except, it should print that when something goes wrong.2 years ago
When I try to define a variable like t = 5 and do println(t*t) I get an error. Can someone please help me fix this? The problem is in parser.py
Python
IMayBeMe In line 151 try switching the two p.NAME‘s to p.NAME0 and p.NAME1respectively. Also if you want to lower the complexity of your parser, I would recommend adding an interpreting stage and having the parser return an AST2 years ago
VulcanWM Maybe it is because t*t is an integer and you can only print strings?
Try converting t*t into a string2 years ago
It's just giving me a 404 (not found error) in the console, Is there a way I can fix this?
Node.js
OldWizard209 You have to put the path of only src="images/gopher.svg", because your index.html is on the same hierarchical level as the images folder so you don't need to add the path of public.2 years ago
it was working completely fine yesterday night and I haven't changed anything, so why won't it work
Node.js
The error says that the element couldnt be scrolled into view even though I scrolled down
Python
Is it possible to make the console less flickery when you move?
C#
TheBest156 Here, try this. https://stackoverflow.com/questions/5435460/console-application-how-to-update-the-display-without-flicker2 years ago
SixBeeps Yes, but you'll have to do some cursor operations. Instead of clearing, the idea is to place the cursor where the player was before pressing a key and print a space, hence making it disappear. Then, relocate the cursor to the new position and print the player character.2 years ago
MocaCDeveloper There is a trailing new line.
So, on line 13, I figured this would be a easier way to convert from the string to an int, and remove the new line:
let new_num = number.trim().parse::().unwrap();
Now you can remove use std::str::FromStr and use the .parse method to parse the string into the type of i64.
The .trim() method just removes the trailing whitespace/newline.
Your code should now look like:
use std::io;
fn main() {
fn fib(num: i64) -> i64 {
if num ().unwrap();
let mut i = 1;
2 years ago