vendredi 1 mai 2020

How to make a website scroll vertically slowly while still keeping control of scrolling

I am making a Ruby on Rails website. I would like to implement a functionality that when a user clicked a button, the website would scroll down slowly. I have looked at similar options but most of what I've found takes control of the scrolling away from the user until it ends. I want the user to still be able to scroll wherever they want to while that automatic scroll is happening. Here is an example: https://www.ukulele-tabs.com/uke-songs/vance-joy/riptide-uke-tab-31868.html

Any ideas?

Thanks!




Reading Remote XML Elements with Different Namespaces

So I'm making this webpage that displays dynamic data pulled remotely using XML. But this was no regular XML, this time the elements got namespaces prefixed to the tags. And I can't seem to read the elements without having errors everywhere.

Here is the remote XML when read through my browser:

<search-results
        xmlns="http://www.w3.org/2005/Atom"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:prism="http://prismstandard.org/namespaces/basic/2.0/">
        <opensearch:totalResults>2</opensearch:totalResults>
        <entry>
                <dc:title>Spider-Man</dc:title>
                <dc:creator>Stan Lee</dc:creator>
                <prism:publicationName>Marvel Comics</prism:publicationName>
        </entry>
        <entry>
                <dc:title>Spawn</dc:title>
                <dc:creator>Todd Macfarlane</dc:creator>
                <prism:publicationName>Image Comics</prism:publicationName>
        </entry>
</search-results>

I am trying to print out the opensearch:totalResults, as well as dc:title, dc:creator and prism:publicationName for each entries. What I managed to do without error currently is just read the remote file and display it in the raw XML format to my browser. This is going nowhere, so your kind help is much appreciated! Also, I think I need to learn more about XML namespaces... :(

   <?php
        $options = array('http' => array('method' => "GET",'header' => "Accept: application/xml\r\n"               ));
        $context = stream_context_create($options);
        $url = 'https://api.evian.com/content/search/mambo?query=ID(50409)';
        $searchResult = simplexml_load_string(file_get_contents($url, false, $context)) or die("Error: Cannot create object");

        var_dump($searchResult);
?>



Not able to change tag without error heroku

OK this might be user error but whenever I try to change the title tag on my Heroku website I get an application error. I followed the tutorial on the Heroku website to make a node.js website that commits to GitHub which then serves to heroku. All I did was change the title tag in the header.ejs file and now when I open my page I get an application error. Here's what the output is in my console when I push to Heroku

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 482 bytes | 482.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  12.x
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.16.3...
remote:        Using default npm version: 6.14.4
remote:
remote: -----> Restoring cache
remote:        - node_modules
remote:
remote: -----> Installing dependencies
remote:        Installing node modules
remote:
remote:        > ejs@2.7.4 postinstall /tmp/build_c695ccb72d0772c3b509ad9fd8557d1d/node_modules/ejs
remote:        > node ./postinstall.js
remote:
remote:        added 145 packages in 3.217s
remote:
remote: -----> Build
remote:
remote: -----> Caching build
remote:        - node_modules
remote:
remote: -----> Pruning devDependencies
remote:        removed 84 packages and audited 139 packages in 1.734s
remote:        found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 23.7M
remote: -----> Launching...
remote:        Released v22
remote:        https://flamegames.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/flamegames.git
   302eafd..030aebf  master -> master




How to keep track of users' hobbies/interests in semi-structured way?

Sorry in advance for the long question. I'm not sure the best way to ask it.

I am building a social networking platform with the Django/Python web framework. On it, users can create a profile and list their interests or hobbies. I want to match users together based on the number of exact matches and similar matches of their hobbies to create a "compatibility score".

For example, there might be a Music category with Jazz, Rock, and Hip Hop genres as well as a Sports category with Football, Basketball, and Soccer, etc.

I want there to be a somewhat "standard" list of interests/hobbies so I can analyze them to create a compatibility score. Should I create a standard set of interests and set True/False for every hobby for every user? Or could I only store the hobbies that each user is interested in, but use auto-complete so when a user starts typing their interests, they get prompted to input them in a standard way?

Or should I allow them to store their interests/hobbies as free text and use some NLP analyzer to create a compatibility score? If so, what should I use for that?




Running website in apache without registered domain

I have a question about apache and a Ubuntu server. How will I setup the website on the Ubuntu server showing it like : http://123.45.67.89/website-demo/

What guide or article can I follow or if someone would be so kind to point me into the right direction.

Much appreciated.




Putting JsonValue in a JsonObject, I'm receiving a NullPointerException [duplicate]

I'm trying for the first time to enter some JsonValue in a JsonObject. The main focus is to create in an output file an array containing "x" number of json object. When I try to do this, I receive a NullPointerException. Someone could help me?

            JsonObject jObj = new JsonObject(); 
            JsonValue nome = "hey";
            JsonValue cognome = "hoy";
            jObj.put("nome", nome);
            jObj.put("cognome", cognome);


            FileOutputStream fileOutput = new FileOutputStream("C:\\Users\\francesco.campanile\\Desktop\\Eclipse workspace\\CreazionePropedeutiche\\src\\Prop1.json");  
            JsonWriter jWriter = Json.createWriter(fileOutput);
            jWriter.writeObject(jObj);
            jWriter.close();



How do I run a Python script on the Azure server?

I am new to Microsoft Azure. I created a bot in Python that takes a message in Messenger from a page that I created in Facebook, processes each message posted, into a function that produces output to present back to Messenger (through Webhook).

Since I have no web space, my Python script is ran locally on my machine, and I am using local hosting to 'communicate' back and forth in Messenger and using my local hosting address for my Webhook link. I also need the script running locally on my machine and local hosting in order for my bot to work in Facebook Messenger.

I was wondering if there is a way to run my script directly from a server on Azure when and if I get web space, instead of from my machine locally (as I THINK Azure is the place to do this from), and how do I run my script from there instead on a 'constant basis'? Thank you for any assistance.