How can I edit a huge SQL-dump?

I have a huge SQL-Dump with a lot of statements like

CREATE TABLE ...
INSERT INTO ...

and so on.

I want to edit this file. At first I want to delete all “CREATE TABLE” statements with all attributes. I only want the “INSERT INTO” statements. Is there an easy way? I’m a rookie at this area.

All “INSERT INTO” statements look like this:

INSERT INTO 'xyz' VALUES (a, b, c, d), (e, f, g, h), (c,d,e,g) ...

I want to have it this way at the end:

INSERT INTO 'xyz' VALUES (<tenant_id>, a, b, c, d), (<tenant_id>, e, f, g, h), ...

Is there an easy way to realize that? E.g. with PHP or Regex? And how can I do this?
Thank you!

Posted in Codes & Scripts | Tagged , , | Leave a comment

what length variable?

Hi everyone. i am just start with javascript and i’m on array section. i have an example below:

PHP:
———
// I don’t know whath length variable, please tell me more about it
var cars = ['Audi', 'BMW', 'Toyota'];
console.log(cars[length]); // Audi
———
Thanks

Posted in Codes & Scripts | Tagged , | Leave a comment

ECommerce Gift Website

I am looking for an e commerce website I don\ t care if you want to use one of the free ones out there like opencart etc but it must have these functions

Watered down admin panel basic functions only like adding and removing… Required Skills: Ecommerce Website, Web Design Development

Posted in Custom Requests | Tagged , , | Leave a comment

ECommerce Gift Website

I am looking for an e commerce website I don\ t care if you want to use one of the free ones out there like opencart etc but it must have these functions

Watered down admin panel basic functions only like adding and removing… Required Skills: Ecommerce Website, Web Design Development

Posted in Custom Requests | Tagged , , | Leave a comment

Reading line-by-line file in JavaScript on client side

Could you please help me with following issue.

Goal

Read file on client side (in browser via JS and HTML5 classes) line by line, without loading whole file to memory.

Scenario

I’m working on web page which should parse files on client side. Currently, I’m reading file as it described in this article.

HTML:

<input type="file" id="files" name="files[]" />

JavaScript:

$("#files").on('change', function(evt){
    // creating FileReader
    var reader = new FileReader();

    // assigning handler
    reader.onloadend = function(evt) {
        lines = evt.target.result.split(/\r?\n/);

        lines.forEach(function (line) {
            parseLine(...);
        });
    };

    // getting File instance
    var file = evt.target.files[0];

    // start reading
    reader.readAsText(file);
}

The problem is that FileReader reads whole file at once, which causes crashed tab for big files (size >= 300 MB). Using reader.onprogress doesn’t solve a problem, as it just increments a result till it will hit the limit.

Inventing a wheel

I’ve done some research in internet and have found no simple way to do this (there are bunch of articles describing this exact functionality but on server side for node.js).

As only way to solve it I see only following:

  1. Split file by chunks (via File.split(startByte, endByte) method)
  2. Find last new line character in that chunk (‘/n’)
  3. Read that chunk except part after last new line character and convert it to the string and split by lines
  4. Read next chunk starting from last new line character found on step 2

But I’ll better use something already existing to avoid entropy growth.

Posted in Codes & Scripts | Tagged , , , , , | Leave a comment