0

Hey, I'm looking to learn more back-end managing as I'm primarily a front-ender. So, maybe you could suggest some learning resources? Idealy free, but I know it's not always possible. I've already completed a couple of courses on the internet mainly https://www.bitdegree.org/course/sql-course and been on YouTube, Google (that's how I ended up here), but couldn't find anything else.

Thank you!

0

hi everyone

i have not been here in a while. so here I am practicing building a forensic managment java application but the thing, i am trying to connect to the database, so, like i am importing the codes that would help connect to the database, like I mean the connection, the preparedstatement and the resultset and for some reason am getting errors, is it because that java is not finding the it or wat.

the errors stating that it cannot find the symbol, I am only importing.

0

Ok, here's my take. I don't want to "give a solution", but a few ideas...

<?php
/*
 * To use simple_html_dom on remote sites...
 * Remember to remove offset parameter on line 76 (or alternatively set its default value to 0):
 * FROM
 * $contents = file_get_contents($url, $use_include_path, $context, offset);
 * TO
 * $contents = file_get_contents($url, $use_include_path, $context);
 *
 */
require_once 'simple_html_dom.php';

function getHTML( $id, $url )
{
    $scrape = file_get_html( $url );
    $data = [];
    foreach ($scrape->find('table[class="tocArticle"] tbody') as $html) {
        $data[] = $id;
        //title
        $data[]  = $html->children(0)->children(0)->plaintext;
        //assuming you want download url of document of interest (DOI??)
        $data[] = $html->children(0)->children(1)->children(1)->href;
        //authors
        $data[] = preg_replace('# {2,}#', ' ', $html->children(1)->children(0)->plaintext );
        //pages
        $data[] = $html->chidren(1)->children(1)->plaintext;
    }
    $html->clear();
    unset($html);
    return $data;
}

function getRecords( $con, $first, $last )
{
    $query1 = "SELECT id, url FROM volume_issue where id between :first and :last";
    $sql = $con->prepare($query1);
    $sql->execute([':first' => $first, ':last' => $last]);
    $insert = [];
    while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
        //Careful this function may cause script to time out if many iterations
        $insert[] = getHTML($row['id'], $row['url']);
    }
    return $insert;
}

//Inserts citations to Citations table with structure...
// id | vi_id (FK on volume_issue table) | title | authors | doi | pages
// Notice no repeated data from first table - this is not required in a relational setting
function addCitations( $con, $valueArray )
{
    $records = count( $valueArray )/5;
    $values = rtrim( str_repeat('(?,?,?,?,?),', $records ), ',' );
    $query2 = "INSERT INTO citations (vi_id, title, authors, doi, pages) VALUES $values";
    $sql ...
0

With the help of colleague & css-tricks I ended up with following code with some problems.

index.php

<p>Sound Link:- http://soundbible.com/mp3/cartoon-birds-2_daniel-simion.mp3</p>
<a href="#" class="birds">Cartoon Birds</a>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="main.js"></script>

script.js

var src = {
  "birds" : {
    url : "audio/cartoon-birds-2_daniel-simion.mp3"
  } 
};

var soundContext = new AudioContext();

for(var key in src) {
  loadSound(key);
}

function loadSound(name){
    "use strict";
  var sound = src[name];

  var url = sound.url;
  var buffer = sound.buffer;

  var request = new XMLHttpRequest();
  request.open('GET', url, true);
  request.responseType = 'arraybuffer';

  request.onload = function() {
    soundContext.decodeAudioData(request.response, function(newBuffer) {
      sound.buffer = newBuffer;
    });
  };

  request.send();
}

function playAudio(name, options){
    "use strict";
  var sound = src[name];
  var soundVolume = src[name].volume || 1;

  var buffer = sound.buffer;
  if(buffer){
    var source = soundContext.createBufferSource();
    source.buffer = buffer;

    var volume = soundContext.createGain();

    if(options) {
      if(options.volume) {
        volume.gain.value = soundVolume * options.volume;
      }
    } else {
      volume.gain.value = soundVolume;
    }

    volume.connect(soundContext.destination);
    source.connect(volume);
    source.start(0);
  }
}    

main.js

jQuery(document).ready(function($) {
 "use strict";

playAudio("birds"); 

$('a.birds').on('click', function(e) {
  e.preventDefault();
  playAudio("birds", { volume: .5});
});

})(jQuery);

This code is working well for me. Have some issues. See below

  1. struggling with soundOn = true/false checking
  2. struggling with function toggleSound() { } (universal mute/unmute button)
  3. struggling with adding var audiotypes = { }
  4. code for .on('click',function(e) { }); is working well, but for jQuery(document).ready(function($) { playAudio("birds"); })(jQuery); is playing sound only once when window is opened, it does not plays any sound on page refresh.
  5. play any sound only if soundOn = true ...
0

One day a column in one of the tables will be added, removed or renamed. What's going to break? Nobody knows. If you do this in one place there are undoubtedly other hacks, and they add up and form your technical debt. It's better to pay it off sooner rather than later.

0

Probably not the most efficient way, but if it is working for individual id values then enclose your code in a loop that iterates over the range of values and change your SQL statement from using BETWEEN to = , like so:

$start = 1;
$end = 2;
for ($tmpID = $start; $tmpID <= $end; $tmpID++) {

$query1 = "SELECT * FROM volume_issue where id = {$tmpID}";
$sql = $con->prepare($query1);
$sql->execute();
$sql->SetFetchMode(PDO::FETCH_ASSOC);
while ($row = $sql->fetch()) {
    $volume_issue_id = $row['id'];
    $url = $row['url'];
    $volume_issue = $row['volume_issue'];
    $journal_title = $row['journal_title'];
    $html2 = file_get_html($url);
    $html2 = file_get_html($url);
    foreach ($html2->find('table[class="tocArticle"]') as $div2) {
        $DOM = new DOMDocument();
        $DOM->loadHTML($div2);
        $Detail = $DOM->getElementsByTagName('td');
        $i = 0;
        $j = 0;
        foreach ($Detail as $sNodeDetail) {
            $aDataTableDetailHTML[$j][] = trim($sNodeDetail->textContent);
            $j = $i % count($aDataTableDetailHTML[$j]) == 0 ? $j + 1 : $j;
        }
    }
}
$result = [];
foreach ($aDataTableDetailHTML as $key => $value) {
    foreach ($value as $key1 => $value1) {
        echo '<pre>';
        $result[$key1][] = $value1;
    }
}
array_walk($result, function(&$item) {
    $item = implode('|', $item);
});
foreach ($result as $ref) {
    $newref[] = explode('|', $ref);
}
print_r($newref);
foreach ($newref as $key => $values) {
    $title = $values[0];
    $authors = str_replace(',            ',', ',$values[2]);
    $pages = $values[3];
    $doi = $values[4];
    $query2 = "INSERT INTO citations (title,authors,journal_title,volume_issue,pages,doi) VALUES (:title,:authors,:journal_title,:volume_issue,:pages,:doi)";
    $sql2 = $con->prepare($query2);
    $sql2->execute(array(
        ':title' => $title,
        ':authors' => $authors,
        ':journal_title' => $journal_title,
        ':volume_issue' => $volume_issue,
        ':pages' => $pages,
        ':doi' => $doi,
    ));
}

}
0

I already put a link to css and it still does not works out.

<html>
<head>

<link rel="stylesheet" href="anime-master/documentation/assets/css/documentation.css">
<link rel="stylesheet" href="anime-master/documentation/assets/css/anime.css">

<script src="anime-master/anime.min.js"></script>

<script>
    var cssSelector = anime({
    targets: '#cssSelector .el',
    translateX: 250
});
</script>

<script>
    var el = document.querySelector('#JSarray .el-01');

    var JSarray = anime({
        targets: [el, '#JSarray .el-02', '#JSarray .el-03'],
        translateX: 250
    });
</script>
</head>
<body>

HTML

<div id="cssSelector">
  <div class="line">
    <div class="square el"></div>
  </div>
</div>

<div id="JSarray">
  <div class="line">
    <div class="square el-01" style="transform: translateX(250px);"></div>
  </div>
  <div class="line">
    <div class="square el-02" style="transform: translateX(250px);"></div>
  </div>
  <div class="line">
    <div class="square el-03" style="transform: translateX(250px);"></div>
  </div>
</div>

</body>

</html>
0

Thanks

My Code

var audiotypes = {
    "mp3": "audio/mpeg",
    "mp4": "audio/mp4",
    "ogg": "audio/ogg",
    "wav": "audio/wav"
}

function audio(sound) {
    var audio_element = document.createElement('audio')
    if (audio_element.canPlayType) {
        for (var i = 0; i < arguments.length; i++) {
            var source_element = document.createElement('source')
            source_element.setAttribute('src', arguments[i])
            if (arguments[i].match(/\.(\w+)$/i))
                source_element.setAttribute('type', audiotypes[RegExp.$1])
            audio_element.appendChild(source_element)
        }
        audio_element.load()
        audio_element.playclip = function() {
            audio_element.pause()
            audio_element.currentTime = 0
            audio_element.play()
        }
        return audio_element
    }
}

var playAudio = audio('audio/wav/InThePark.wav', "audio/mp3/InThePark.mp3");

playAudio.playclip();

Working Example

You can here sound when page is loaded. It can be used for actions like click, hover.

jsfiddle adele hello

I'm not asking to write whole code for me. I need help to modify my code. I want to add some more functionalities to my code.
I'm trying something like following.

1. soundOn = true/false
2. var audiotypes = {
        "mp3": "audio/mpeg",
        "mp4": "audio/mp4",
        "ogg": "audio/ogg",
        "wav": "audio/wav"  
    }
3. var sounds = {
      "sound1" : {
        url : "audio/sound1.wav"
      },
      "sound2" : {
        url : "audio/sound2.mp3",
      },
      "sound3" : {
        url : "audio/sound3.ogg"
      },
      "sound4" : {
        url : "audio/sound4.mp4"
      }
    };
4. function loadSound(name){
    //code to initialize sound with name and url
        var sound = //name
        var url = //url

    }
5.  function playAudio(name, options) { 
        var sound = //name
        var soundVolume = //volume

        //code to check soundOn is true
    }
6. function toggleSound() {
    //stop all playing sound and reset them to start position
    //Or Enable all sounds to play  
    //Set soundOn = true/false
    }

7. To play a sound, Call function as follows,

    playAudio("sound1");

        OR ...
0

I am guessing (since I don't have tables to verify with) that the problem is that in the below select you have two tables named p, the ledgertable and the result of the select. If I try this with MySQL, I get an error. If you find this is not the problem, I would recommend changing it anyhow because it looks really confusing.

( 
                  SELECT p.trandate,p.voucherno,p.itemno,p.itemname, SUM(isnull(p.recieve,0)) Recieve,
                          SUM(isnull(p.issue,0)) Issue,SUM(isnull(p.returnback,0)) Returnback
                  FROM ledgertable p
                  GROUP BY p.itemno,p.ITEMNAME,p.trandate,p.voucherno) p
0

Hello all,

I am trying to understand how to use animation.js:

This is what I did:

And the result is only HTML text. I expect to see : http://animejs.com/documentation/#functionBasedDuration

The first animation appears. I wonder what's lacking. My link to the js is already correct:

<html>
<head>

<script src="anime-master/anime.min.js"></script>

<script>
    var cssSelector = anime({
    targets: '#cssSelector .el',
    translateX: 250
});
</script>

</head>
<body style="background-color: gray;">

HTML

<div id="cssSelector">
  <div class="line">
    <div class="square el"></div>
  </div>
</div>

</body>

</html>
0

It appears as if you want folk to write your code and functions. That's pretty rare. But on topic about your new item 1, it can be simple or complicated.

Simple: Mute all playing items. Too many examples at https://www.google.com/search?q=HTML5+MUTE+SOUND+BUTTON

I worry here you are asking everyone to code this for you. This is usually done with you go with a For Hire type post with a well done RFQ and a price. If you are asking for code, that usually ends badly. Almost all members are to help you learn or to help you past a bad bug. Since muting and such in HTML5 is rather well done I worry you just want code.

0

@All Thanks

As I said I'm working on themes, where I need to use low volume of background music. So I want to control Volume, Play/Stop of background music. (HTML Audio/Video DOM volume Property)

Also I'm adding some sound effects to actions - click, hover as well as appearing/diappearing of overlay. I’ve added my working code(at the end) in my last post. It works, but I need something more, like website examples I provided in my posts.

No need to install Greensock, just try my code in my last post

I'm explaining my goals

Need to create following functions

1. soundOn= (if true play all sounds when they are called,  if false no background music, no sond effects on events/actions)
     Purpose:-  all sound effects on website to play or not. 

2. var audiotypes = { }
    Purpose:-  Code to define  valid audio file type to be played

3. function playAudio() {  }
    Purpose:-  code to play all audio files, it may called as,  
    var sound1 = playAudio({
        if (audioOn) {
            src: ["src/sound1.wav", "src/sound1.mp3"],
            volume: 0.5
           } 
    });

4. function toggleSound() { }
    Purpose:- play, stop all audio (A universal mute/unmute button)

These are some basic requirements

Four Point Summary

1. soundOn = true/false

2. var audiotypes = { }

3. var sound1 = playAudio({
            if (audioOn) {
                    src: ["src/sound1.wav", "src/sound1.mp3"],
                    volume: 0.5
            }  
     });

4. function toggleSound() { }

Hope I’ve cleared goals or points, I'm trying to work on.

0

I revived your post but I still don't see any need for those libraries. HTML5 and Javascript seem to do what you ask.

Your revived post is full of code and such but you need to really nail what the problem is. That is, call out what line of code fails, what the error message is and really reduce it to the smallest possible example. I doubt anyone will install Greensock just to try it out. Maybe but I would not count on it.

Read "Composing a good question" at https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question