1.4: Getting Text from User: Loading a Text File - Programming with Text

Поділитися
Вставка
  • Опубліковано 16 гру 2024

КОМЕНТАРІ • 77

  • @suavecito_o7927
    @suavecito_o7927 8 років тому +37

    This guy is a damn beast at programming

    • @suavecito_o7927
      @suavecito_o7927 8 років тому

      +Totally Beyond Me whatever floats your boat xD

    • @cptstubing
      @cptstubing 8 років тому

      Yes he is, but he drinks too much coffee!

    • @lincolnmunene554
      @lincolnmunene554 5 років тому

      @@cptstubing coffee makes him a genius haha

    • @ahmededwin3487
      @ahmededwin3487 3 роки тому

      i know it's pretty randomly asking but does anybody know a good site to watch new tv shows online ?

  • @lucase6077
    @lucase6077 5 років тому +2

    Dan, my code works fine and is shown on the console perfectly but the page won't show it(it's blank). Do you know why this is happening? I'm running a node HTTP server as you showed in a previous video. I'd really like to continue watching this playlist but I cannot skip this lesson.

  • @cptstubing
    @cptstubing 8 років тому +1

    When replacing the contents of rainbow.txt to just random words, I must first change the filename from rainbow.txt to something else, and then update the filename in the sketch.js file.
    It is not enough to just CTRL+A and del the contents of rainbow.txt and add some words to it, CTRL+S, and refresh the webpage. It shows the same contents in the right hand console Array [.....] unless I rename the file all around and refresh.
    Very strange.

  • @regrepsa8857
    @regrepsa8857 4 роки тому

    OMG, I have been searching how to do that for hours, and I understood it pretty easily

  • @AnthonyHarper1200
    @AnthonyHarper1200 4 роки тому

    Hey All
    Very green with JS, stuck on how to load/read multiple files located within a directory(over 70 of them) was able to load one with the preload function ‘loadStrings’, any assistance would be much appreciated.

  • @STLightiix
    @STLightiix 6 років тому +1

    Hi, is there a simple way to append some data to a text file ?

  • @khalidhashimeh
    @khalidhashimeh 8 років тому +2

    Great video. Can you show us how to load text file in JavaScript without using P5 JS framework please? thank you..

  • @Yupppi
    @Yupppi 3 роки тому +1

    Interesting, my console.log(txt) didn't cause any text in the console. I'm struggling a lot, managed to create a simple program on python to read a random text line from a text file in the same folder, then tried to figure out how to make it happen in javascript to get it on webpage, but can't even get to the point where I can read the text file.
    Actually I get error for undefined loadStrings and in general I don't manage to make the text into string format, just a file object.

    • @adrianhajduk6764
      @adrianhajduk6764 2 роки тому

      Same issue. I can't figure out how to just prompt the txt file in console..

  • @carlino821
    @carlino821 8 років тому +2

    Hello Daniel! First of all thanks to teach to us for free all this stuff! I have a problem I can't figure it out. How can I use the loadTable or loadString function combined with the createFileInput function (or drag and drop technic) to let a user to upload a CSV file? Thanks for any help!

  • @almay9962
    @almay9962 5 років тому

    I opened up a text document on notepad and got this > endobj
    147 0 obj

  • @parison813619
    @parison813619 8 років тому

    I didn't understand createFileInput for multiple file access what should i pass in 2nd argument should i pass a callbackfunction for that as well? Shouldn't the documentation also include example code as well googling it I didn't find any results.

  • @kmbcg
    @kmbcg 4 роки тому

    Which playlist is this video from?

  • @beaverjoe9171
    @beaverjoe9171 6 років тому

    p5.js:20602 Failed to load file:///Users/ZhouYi/Desktop/P5/Day12%20AZ%201.1-/1.4%20Loading%20a%20Text%20File/load/rainbow.txt: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
    I tried using live server and chrome or other browser but not work

  • @DuyNguyen-nf3cz
    @DuyNguyen-nf3cz 7 років тому

    Hi your video is damn great and helful, but when I try to modify the text file like you did in 02:15 and hit reload the local server, the string didn't change at all. How can I fix it, thanks

    • @TheCodingTrain
      @TheCodingTrain  7 років тому +2

      Possible your browser is caching? Try in chrome, going to console --> settings --> disable cache while console is open.

    • @DuyNguyen-nf3cz
      @DuyNguyen-nf3cz 7 років тому

      Thanks a lot, it works for me now!

  • @JonMartins
    @JonMartins 8 років тому

    There's probably something wrong with my code, or could it be my Chrome?
    Developer Tools console won't show anything. Just that ">"thing. Is there anything else I need to do?

  • @ClearNinjaFox
    @ClearNinjaFox 8 років тому

    hello Danii, listen how can i do all this in Processing 2.2? sorry i have written allot of p2 to just leave it behind and redo everything in p3 and UP and most lib for p2 dont even exist in most higher versions of processing. so if im going to upgrade anything its going to be after i export my sketch to bring into a real IDE like netbeans or something like VS13 BUT you're still my guy for learning all the time!

  • @rodinsuniga5549
    @rodinsuniga5549 6 років тому +2

    I hope our instructor teaches the way you do! 😭

  • @photelegy
    @photelegy 3 роки тому

    How doex this work in Processing?

  • @bhargavi6351
    @bhargavi6351 7 років тому

    when i enter console.log(table) it shows undefind please help

  • @Andy-xh4jp
    @Andy-xh4jp 8 років тому

    I seem to be getting this in my console:
    Uncaught TypeError: fxn.bind is not a function
    at attachListener (p5.js:11756)
    at p5.Element.mousePressed (p5.js:11079)
    at setup (sketch.js:18)
    at p5. (p5.js:9108)
    at p5. (p5.js:9038)
    at new p5 (p5.js:9320)
    at _globalInit (p5.js:5602)
    sketch.js:18 is :
    button.mousePressed(load);
    I've tried with loadfile and many other names for the button and for the " var button = select('#load');" but nothing seems to work.

    • @Andy-xh4jp
      @Andy-xh4jp 8 років тому

      Turns out, after a bit of debugging that if I replace the HTML button with a p5 button : "
      var button;
      button = createButton('Load File');
      button.mousePressed(loadFile);
      "
      Though it's much more complicated to work around with, it works.

  • @iLlamas1
    @iLlamas1 4 роки тому

    I know that this is old but can someone help me? How do I specify where the createP element is put? Now it's just showing the text inside the body but I want it to be inside a div.

  • @vinitgujarkar6907
    @vinitgujarkar6907 5 років тому

    can you tell how to extract particular word only from text file?

  • @RamRam-po3lq
    @RamRam-po3lq 7 років тому

    how to do it in nodejs and auto update with out run command bro.......any help

  • @jan-philippmarks5926
    @jan-philippmarks5926 6 років тому +3

    loasStrings is undefined, where do you get loadStrings from ???

    • @TheCodingTrain
      @TheCodingTrain  6 років тому +1

      You'll need the p5.js library, see: p5js.org

  • @puphuc9415
    @puphuc9415 7 років тому

    i have a error.
    p5.js:20255 XMLHttpRequest cannot load file:///C:/Users/SNS/Desktop/A2Z/1.4%20Getting%20Text%20from%20User/hh.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
    how can i fix this???

    • @TheCodingTrain
      @TheCodingTrain  7 років тому +1

      You need to run a local server: ua-cam.com/video/UCHzlUiDD10/v-deo.html

    • @puphuc9415
      @puphuc9415 7 років тому

      thank you for all video you made

  • @deadandgone70
    @deadandgone70 4 роки тому +1

    Great video thank you!!! Im thinking of writing a python prgram to write to a text file database and import it to a website!

  • @ginkcs500
    @ginkcs500 8 років тому

    Where do you teach?

  • @samyyoussef8380
    @samyyoussef8380 5 років тому

    fantastic, but how load a comma seperated file or an XML file into array element, like an array for countries and other for capital cities

    • @zephenex4203
      @zephenex4203 5 років тому +1

      I know it's a little bit late but you can use .split() i think it is. and between the brackets you can give a parameter. for example
      str = "England,Canada,Australia"; you can do declare an array let's call this array countries, now do countries = str.split(',');
      As you can see i put a , between the brackets, if your file is separated with a ; replace the , with a ; and so on

  • @abrahemalhofe5698
    @abrahemalhofe5698 5 років тому

    Can you make program get tags from text

  • @jenglinux4948
    @jenglinux4948 6 років тому

    Very nice but i have a question is there a way that a can load a .txt file onto my html by just typing the name instead of a button ( example i have a text file named HELP.txt instead of clicking a button i can just type it and will display it's content to my html after )
    Reason for asking is because i want to create a personal website / career portfolio but i want that website to have a look and feel of a linux terminal (something that like that) I'm hoping you can help me with query because by far this is the only tutorial that i found useful.
    thanks again cheers.

    • @zeus3914
      @zeus3914 6 років тому

      Create a variable to hold the user input, when the user inputs a word and pressed enter use keyPressed() to load the text
      As for adding it to your website you could use the p5 text function or you could use js to edit your html but you will need to google how to do that

  • @bhargavi6351
    @bhargavi6351 7 років тому

    can I use notepad+++ instead of brackets?

    • @killox3371
      @killox3371 6 років тому

      atom is probably better than the both of them see atom.io or to use without installing (no admin rights)
      github.com/atom

  • @iPranav007
    @iPranav007 4 роки тому

    Where is loadStrings defined ?

  • @don-broomarquis5374
    @don-broomarquis5374 5 років тому

    Can I read all text files in the dirctory

    • @zephenex4203
      @zephenex4203 5 років тому

      as long as you give the correct url you can select any txt files

  • @brycejohnson7055
    @brycejohnson7055 8 років тому

    For some reason no matter what i do it always says loading then will never work😥please help i really need this for my game

    • @TheCodingTrain
      @TheCodingTrain  8 років тому +1

      +Bryce Johnson try looking in the JavaScript console for an error message!

    • @brycejohnson7055
      @brycejohnson7055 8 років тому

      When I looked all it says it undefined

    • @brycejohnson7055
      @brycejohnson7055 8 років тому

      I am also emailing you as well I just sent the link to the forums maybe I'll send you a picture of my code

    • @kreendurron
      @kreendurron 8 років тому +1

      I get the same thing. Here is the error.
      p5.js:20199 XMLHttpRequest cannot load file:///C:/Users/kreen_000/Documents/Atom/Projects/learning/1-4/myText.txt. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.p5.loadStrings @ p5.js:20199(anonymous function) @ p5.js:9083preload @ sketch1-4.js:4(anonymous function) @ p5.js:9045p5 @ p5.js:9320_globalInit @ p5.js:5602
      p5.js:20193
      p5.js:20171 undefined

    • @kreendurron
      @kreendurron 8 років тому

      Oh i think its because I was simply opening the html file from windows explorer instead of running the page via live preview on a port.

  • @Keep_quiet_1
    @Keep_quiet_1 3 роки тому

    What is loadStrings? Where is that coming from...

  • @coerai6455
    @coerai6455 7 років тому +3

    Fetch API

  • @MadhuKumar-hi2qs
    @MadhuKumar-hi2qs 3 роки тому

    How to write to text file

  • @jhpk4495
    @jhpk4495 6 років тому +2

    Brilliant Video like always :D

  • @amanmahendroo1784
    @amanmahendroo1784 6 років тому

    Please make an RNN off this feature

  • @nadrojylrach9637
    @nadrojylrach9637 5 років тому

    I

  • @christiancuneo8005
    @christiancuneo8005 4 роки тому

    Great video!
    Maybe lay off the caffeine?

  • @JokingChickenn
    @JokingChickenn 8 років тому +1

    Hi.... First???