Ibraheem Rodrigues

@IbraheemRodrigues (84) • Harris City Academy Crystal Palace
Access Linux terminal in Python or Ruby on Rails
posted to Ask by K_log

Probably a bit late now, but press F1 to open the command palette and then type Open Shell

How do I "push" something to a variabe in a file using nodeJs?
posted to Ask by Coder100

@Coder100 Here's my crash course in persistent data storage:

For your purpose, only the data in the message is important, so we don't need anything else from JS (control flow, variables, functions, errors, etc.).

For that purpose JSON (JavaScript Object Notation) was created, which only features Objects, Arrays, Booleans, Numbers and Strings. A JSON file contains ONE object or array, and so will start with {or [ and end with } or ]. It is good for 'one off ' data, such of config files that will be loaded once on startup or data to be transmitted to another process or across the internet, since it can be read in and evaluated as JS without much extra processing required.

However, the issue if you want to use it to create a database or something similar where there will be an unknown number of data points, and ones that must be added, changed and removed is that you have to worry about opening and closing {}, [] and "", or have to read in the entire data structure, evaluate it, change it, sterilise it (convert it from data in memory to JSON text) and save it to file (which can work well, but is tedious and messy for you to implement). For these cases things like CSV (Comma Separated Values) or SQL databases are used, which function like an excel table - you have a header that defines the data to be stored in each column and below that each row specifies this data for a single datapoint. CSV stores data as text, where as SQL stores stuff as binary data. If you are planning for you application to be big, a SQL database such as SQLite or MySQL would be most efficient, and are worth learning how to use since most applications use them. However for small projects they may not be ideal. The issue with these formats is that you loose the JS-ness of the data, and each data point must follow a rigid, linear (i.e no nested objects/arrays) pattern

To get the best of both worlds, use a database technology that stores data as JSON-like files or provides a translation layer, such as MongoDB (which is used widely in industry alongside NodeJS) or EnMaps (Enhanced Maps, basically JS Maps with a bunch of added features) which can be given a persistence provider to store them on disk. I've used EnMaps and they're pretty cool.

So in conclusion, I'd recommend that you either:

  • Learn SQL and use SQLite, thereby gaining great knowledge of this technology
    or
  • Use node-persist to easily read and write your array (I presume an array) to and from disk.
How do I "push" something to a variabe in a file using nodeJs?
posted to Ask by Coder100

To edit files you likely want to use the fs module.
However what is your use case? If you are storing objects such as the contents of the variable m you likely want to use JSON files.More info about what you are doing would be useful.

Python or Java
posted to Ask by BilalKohistani

You are most likely being taught java to demonstrate the concepts you are being taught, since java is a much lower level language, so slot of the things that come neatly packaged for you in python you have to make yourself, and you can get much better insite into what's actually happening on your CPU. If you have a NEA/coursework project to complete you can usually choose to do it in python java or a flavour of C. From my experience in GCSE CompSci, don't rely on it to teach you software development, for that the best place to learn is on the internet, and if you are looking at a job in software development I'd say that's the best route to take. I've personally never worked on any big projects in java, but have dabbled in it a fair bit.

Two Player 2048: Race w/ Friends!
posted to Share by MikeShi42

A very cool concept, and appears well executed.
A tip I've learnt from this competition: you would have undoubtedly got many more votes had you posted it earlier.

Access Linux terminal in Python or Ruby on Rails
posted to Ask by K_log

Sometimes doesn't seem to work (depending on browser probably) - if so right click in the editor pane and select open command palette at the bottom, then search for Open Shell@nehatkhan786

Self-writing code
posted to Ask by mcko7304

There’s already a bunch of research into neutral networks that can edit and design themselves. I remember seeing a Google talk about how they were using a master network to design slave networks which themselves were then trained, and they yeilded far more efficient and accurate results. I would not be surprised if large algorithms such as the infamous YouTube algorithm already uses these techniques. Many speculate there will soon be a day when all programming will be done by AI, we will merely need to supply a description.

How do I "push" something to a variabe in a file using nodeJs?
posted to Ask by Coder100

@Coder100 As in message templates? or messages that have been sent and are to be recorded.

anyone know how to solve this ?
posted to Ask by SaiKhun

@fullern000 not really helpful :p

OneShot | 🚀Online Space Shooter 👩🏽‍🚀 | 📱Mobile Friendly

@Auhsoj1 That is the down side to online multiplayer, but I might see if I can organise a time/date where I'll get lots of people to play, that way you can ask get there full experience.

Thanks for the vote!

Agar.io
posted to Share by vedprad1

Nice concept, however I found the following bug - if one player makes his way into the other players corner and eats the other, the other then respawns in that corner again, and so is eaten and so respawns and is eaten and this repeats ad infinitum, making the game freeze. Maybe have the player respawn in a random location each time?

July Competition: Create Multiplayer Games
posted to Share by timmy_i_chen

@timmy_i_chen Thought not, but wanted to be absolutely sure. Thanks!

OneShot | 🚀Online Space Shooter 👩🏽‍🚀 | 📱Mobile Friendly

@Nanowrimoijk sadly i am ij the middle of revision for my mock exams tomorrow! Sorry!

OneShot | 🚀Online Space Shooter 👩🏽‍🚀 | 📱Mobile Friendly

@Nanowrimoijk The id is just your connection Id. Also there are no teams, it's largely a free for

I'm Trying to subtract a Variable from a Variable and its not working
posted to Ask by KeeganMcGough

@KeeganMcGough You perform the subtraction correctly, but the only thing that you do with that value is print it. You have not told python to store it as the new value of player1

player1 = player1 - punch will do this.
There is also player1 -= punch1, which is a short hand for the above
So your code should look like:

if (answer == "punch"):
    print ("Player 2 hits Player 1")
    Player1 = Player1 - punch # Perform the subtraction and store it back into the `Player1` var
    print (Player1) # Print this new value
else:
    print ("That is not a move")
AQA GCSE COMPUTER SCIENCE NEA 2018
posted to Ask by NoahSalehi

Unless you are looking for it out of curiosity, the NEA has been scrapped for the 2018/2019 GCSEs. Although you must still complete 20 hours of coding, this is not assessed and will not count for your final 9-1 grade. Your teacher may mark it, but this does not affect your final grade.

I'd recommend spending the 20 hours of programming time actually learning the fundamentals of coding, since one of your written assessments is on programming tasks.

If you wish to dodge doing work, I cannot help you there

The official statement from AQA

anyone know how to solve this ?
posted to Ask by SaiKhun

Not really helping you fix your code, which I think is what you really want to do, but you could use this to dodge the for loop:

foot = 0.01 * (2**n)-1 Where n is the number of nails for the foot

Repl Talk Discord Bot
posted to Share by mat1

link OBAN#6336

OneShot | 🚀Online Space Shooter 👩🏽‍🚀 | 📱Mobile Friendly

@Mooopy I suspect it's the same issue @amasad pointed out, since 504 is a server error. I've added an extra if statement to try and eliviate the error he was reporting, hopefully that fixes it

OneShot | 🚀Online Space Shooter 👩🏽‍🚀 | 📱Mobile Friendly

@Mooopy Can't seem to replicate the issue. Any other information you can give me when this happens?

OneShot | 🚀Online Space Shooter 👩🏽‍🚀 | 📱Mobile Friendly

@Sofia_Ortega You can currently see your coordinates in the top left, the world size is 5000 so the x and y can be anywhere between -2500 and 2500. However the programming convention is that (-2500, -2500) is the top left corner, so bear this in mind.

I may add a map, however I think the coordinates do the job, and the radar arrows around your ship point you to others. Thanks for the suggestion though!

OneShot | 🚀Online Space Shooter 👩🏽‍🚀 | 📱Mobile Friendly

@Indoors420 I've increased the turning speed and the turning drag, so it should handle a bit better now. Give it a try?

👋✨Introduce yourself 🎉😀
posted to Announcements by amasad

Hi, I'm Ibraheem,

I've been programming for around 5/6 years now, and found out about repl.it around a year ago in school, as we used it when our local IDEs wouldn't work (school IT sucks). I've not used it for a while, but since recently coming back to it I've been amazed by the amount of languages it supports and how well the IDE functions. Also really love the live server deployment features. I'm hoping to use this a lot for the coding club I'll be running in school next year.

Probably going to continue to use repl.it as a place to quickly test things, I prefer to work on large projects on my local machine. Also looking forward to the multiplayer games competition and Code Jams - although sadly I'm away for the upcoming one :(

A bunch of my work is on my github: www.github.com/ibraheemr
Also it'd be cool if you'd check out my website: www.ibraheemrodrigues.com (front page under construction, click through to posts or projects)

July Competition: Create Multiplayer Games
posted to Share by timmy_i_chen

Would using feedback from play testers be considered 'not your own work'?