access the data from ajax response.!

access the data from ajax response.!

Is there any body i need little help plz. I’m trying to access ‘id’ from ajax response that is coming from database (in row_array()) but when when i alert it or console it i only get single bracket ( { ). Thanks!

    $.ajax({
                    type : 'post',
                    url : '<?php echo site_url() ?>main_controller/verify_email_for_password_reset',
                    data : {
                        verify : verify
                    },
                    success : function(data)
                    {
                        var html = '<button type="button" id="change_password" data-id = "'+data+'" class="btn btn-block btn-hero btn-noborder btn-rounded btn-alt-success"><i class="si si-user-follow mr-10"></i> Change</button>';
                            $('#test').html(html);
                }
            });
        });



            $('#test').on('click','#change_password',function(){
                var id = $(this).data('id');
                alert(id);

Go to Source
Author: Abdul Basit

Black screen after uninstalled python 2.7

Black screen after uninstalled python 2.7

I’ve uninstalled python 2.7 completely from my Linux Mint Cinnamon. After reboot, the system didn’t turn on. It shows me the screensaver with my account and the space to insert the password. But after the access, all I can see is a black screen with no possibility of access to the terminal.
I’ve tried CTRL+ALT+F1, but nothing happens.

How can I access to the terminal? Should I reinstall Linux from Windows, since my computer has a dual boot with the two systems?

Go to Source
Author: Aurora Blackwood

Which key-value database should I use and why?

Which key-value database should I use and why?

I have an application that scrapes webpages. Once a webpage is scraped, it has a unique identifier which is a string and it has the associated content which is also a string. I need to persist the webpage content, so that the next time I scrape the data for the same webpage I need to know whether the webpage has changed or not.

So either I might be storing the page identifier mapped with its checksum or simply its content. Anyhow, the basic need of storage is simple – a string to string map.

I think it is a use case for a key-value database. Since, my needs are very simple I don’t need a database full of fancy features. What could be a good open source key-value database that suits my simple needs?

Also, is it even necessary to use a database? I can fall back to a file storing the key-value. Will I lose performance if I use a database over a file?

Go to Source
Author: Navjot Singh

DNS zone on CentOS 7 not working

DNS zone on CentOS 7 not working

I have server with CentOS 7, when i have DNS and domain learn-linux.eu. My domain works but only without www.
my /etc/named.conf file

options {
        listen-on port 53 { 127.0.0.1; 193.33.111.185; };
        #listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
        allow-query     { localhost; 193.33.111.0/24; };

        /* 
         - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
         - If you are building a RECURSIVE (caching) DNS server, you need to enable 
           recursion. 
         - If your recursive DNS server has a public IP address, you MUST enable access 
           control to limit queries to your legitimate users. Failing to do so will
           cause your server to become part of large scale DNS amplification 
           attacks. Implementing BCP38 within your network would greatly
           reduce such attack surface 
        */
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.root.key";

        managed-keys-directory "/var/named/dynamic";

        pid-file "/run/named/named.pid";
        session-keyfile "/run/named/session.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "learn-linux.eu" IN {
        type master;
        file "/var/named/learn-linux.db";
        allow-update {none;};
};

zone "111.33.193.in-addr.arpa" IN {
        type master;
        file "/var/named/193.33.111.db";
        allow-update {none;};

};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

My DNS zone:

$TTL 14400
@ IN  SOA     ns1.learn-linux.eu. root.learn-linux.eu. (
                                                13    ;Serial
                                                1H      ;Refresh
                                                15M     ;Retry
                                                2H      ;Expire
                                                1H      ;Minimum TTL
                                                )

;Name Server Information
@      IN  NS      ns1.learn-linux.eu.
learn-linux.eu. IN A 193.33.111.185
www.learn-linux.eu.     IN A 193.33.111.185
;IP address of Name Server
ns1.learn-linux.eu.     IN      A 193.33.111.185
www     IN  A       193.33.111.185

my reverse zone

@ IN  SOA     ns1.learn-linux.eu. root.learn-linux.eu. (
                                                        6    ;Serial
                                                        1H      ;Refresh
                                                        15M     ;Retry
                                                        4H      ;Expire
                                                        1D      ;Minimum TTL
                                                        )
;Name Server Information
@ IN  NS      ns1.learn-linux.eu.

;Reverse lookup for Name Server
185        IN  PTR     www.learn-linux.eu.

command dig www.learn-linux.eu result

 <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.3 <<>> www.learn-linux.eu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43694
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.learn-linux.eu.            IN      A

;; ANSWER SECTION:
www.learn-linux.eu.     14400   IN      A       193.33.111.185

;; AUTHORITY SECTION:
learn-linux.eu.         14400   IN      NS      ns1.learn-linux.eu.

;; ADDITIONAL SECTION:
ns1.learn-linux.eu.     14400   IN      A       193.33.111.185

;; Query time: 0 msec
;; SERVER: 193.33.111.185#53(193.33.111.185)
;; WHEN: Mon May 18 15:15:22 CEST 2020
;; MSG SIZE  rcvd: 97

command dig learn-linux.eu result

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.3 <<>> learn-linux.eu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60013
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;learn-linux.eu.                        IN      A

;; ANSWER SECTION:
learn-linux.eu.         14400   IN      A       193.33.111.185

;; AUTHORITY SECTION:
learn-linux.eu.         14400   IN      NS      ns1.learn-linux.eu.

;; ADDITIONAL SECTION:
ns1.learn-linux.eu.     14400   IN      A       193.33.111.185

;; Query time: 0 msec
;; SERVER: 193.33.111.185#53(193.33.111.185)
;; WHEN: Tue May 19 09:46:35 CEST 2020
;; MSG SIZE  rcvd: 93

named-checkzone

[pawel@learn-linux ~]$ sudo named-checkzone learn-linux.eu /var/named/learn-linux.db
zone learn-linux.eu/IN: loaded serial 13
OK

named status

[pawel@learn-linux pawel]# systemctl status named
● named.service - Berkeley Internet Name Domain (DNS)
   Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-05-19 09:37:45 CEST; 4s ago
  Process: 1593 ExecStop=/bin/sh -c /usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1608 ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS (code=exited, status=0/SUCCESS)
  Process: 1605 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
 Main PID: 1610 (named)
   CGroup: /system.slice/named.service
           └─1610 /usr/sbin/named -u named -c /etc/named.conf -4

May 19 09:37:45 learn-linux.eu named[1610]: zone 111.33.193.in-addr.arpa/IN: loaded serial 8
May 19 09:37:45 learn-linux.eu named[1610]: zone localhost/IN: loaded serial 0
May 19 09:37:45 learn-linux.eu named[1610]: zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0
May 19 09:37:45 learn-linux.eu named[1610]: zone learn-linux.eu/IN: loaded serial 14
May 19 09:37:45 learn-linux.eu named[1610]: zone localhost.localdomain/IN: loaded serial 0
May 19 09:37:45 learn-linux.eu named[1610]: all zones loaded
May 19 09:37:45 learn-linux.eu named[1610]: running
May 19 09:37:45 learn-linux.eu systemd[1]: Started Berkeley Internet Name Domain (DNS).
May 19 09:37:45 learn-linux.eu named[1610]: managed-keys-zone: Key 20326 for zone . acceptance timer complete: key now trusted
May 19 09:37:45 learn-linux.eu named[1610]: resolver priming query complete

On firewall i added 53/udp port.
In /etc/resolv.conf i added

nameserver 193.33.111.185

in /etc/sysconfig/network-scripts/ifcfg-eth0 i added

DNS1=193.33.111.185

But my zone still not working with www and without www. In the company where I bought the domain, I set the ns domain to ns1.learn-linux.eu. What i do wrong? I’ve been trying to fix it since yesterday, but to no avail.

Go to Source
Author: PawelC

Youtube: Move “Watch later” to new Playlist

Youtube: Move “Watch later” to new Playlist

I want to add all search results to a playlist in youtube. The quickest way to do this seems to click the “watch later” icon on every video (1 click). Adding each video to an individual playlist is much slower (4 clicks)

However I want to create individual playlists for different searches, so I want to move all videos from the “watch later” playlist to a new one (simultaneously), so I can keep a structure.

Go to Source
Author: mcExchange

How to determine if particular .NET/ASP.NET version has known vulnerabilities by version-build number using Microsoft resources?

How to determine if particular .NET/ASP.NET version has known vulnerabilities by version-build number using Microsoft resources?

I’m trying to find any list which can help finding if particular ASP.NET version has known vulnerabilities by version-build number. Googling doesn’t help. Is there a known list by microsoft which can help me, containing all existing build numbers (like “ASP.NET Version:2.0.50727.8813”), or any other way of checking if security patches has been already applied, for example the list of security patches with build numbers to which it updates the components?
https://www.cvedetails.com/ doesn’t help because it doesn’t contain build information, only lists major versions.

Go to Source
Author: Vadim

Altering big table with gh-ost on Google Cloud

Altering big table with gh-ost on Google Cloud

We need to add some indexes and one additional column to a large MySQL table.

MySQL is Google Cloud SQL version 5.7.25-google-log.

Some table info:

  • currently holding 1 331 363 322 rows
  • size of the table 409GB
  • size of the index on the table 473GB
  • every day we crate around 2 000 000 new rows and update around 50 000 of old rows
  • no foreign keys

We tried adding indexes directly to this table but we had to stop it because of this issue: https://www.percona.com/blog/2019/06/27/innodb-alter-table-add-index-and-insert-performance/

So, we decided to go with the gh-ost. Currently, this tool is running for 240h31m30s and it is at 51.8% with the current progress of 2.6% per day and it slowing down every day.
To speed up the things we tried to play with chunk-size, Threads_running, dml-batch-size but none of them helped to speed up the things. We only saw an increase in replication lag on replicas.
On Google Cloud SQL instance you can’t enable bin log on the replicas so we had to run it against the master (link, link).

Also, I have created an issue with all parameters that we use and some sample of logs on gh-ost repo: https://github.com/github/gh-ost/issues/845

Is there anything else that we could try to tweak or should we try some other tool?

Go to Source
Author: ffox003

Screen is shifted with Xubuntu

Screen is shifted with Xubuntu

I have a computer with a Ryzen 5 2500U CPU with RX Vega graphics. I created a Xubuntu 20.04 installer and booted it, but now I have this really weird distortion on my screen, where different vertical parts are shifted to the side. The mouse pointer isn’t shifted, so it’s really difficult to click on anything. How do I fix this?

enter image description here

Go to Source
Author: Aaron Franke

CS50 DNA pset6 only works with small.csv, not large.csv

CS50 DNA pset6 only works with small.csv, not large.csv

I’m having troubles finishing this problem, when I include “temp = 0” on line 32, as it currently is, it doesn’t work at all, but when I remove it it only works on small.csv (plus I feel it is necessary anyways). Really confused with what logic is going wrong in this.

from sys import argv, exit
import csv

if len(argv) != 3:
    print("Usage: python dna.py data.csv sequence.txt")
    exit(1)

with open(argv[1], 'r') as csv_file:
    csv_reader = csv.reader(csv_file)
    for row in csv_reader:
        header = row
        header.pop(0)
        break

dictionary = {}

for item in header:
    dictionary[item] = 0

with open(argv[2], 'r') as dna_txt:
    dna_reader = dna_txt.read()

for key in dictionary:
    temp = 0 
    max_count = 0
    for i in range(len(dna_reader)):
        if dna_reader[i : i + len(key)] == key:
            temp += 1
        else:
            if temp > max_count:
                max_count = temp
            temp = 0
        i += len(key)
    dictionary[key] = max_count

with open(argv[1], 'r') as file:
    table = csv.DictReader(file)
    for person in table:
        count = 0
        for dna in dictionary:
            if int(dictionary[dna]) == int(person[dna]):
                count += 1
            else:
                count = 0
            if count == len(header):
                print(person['name'])
                exit(1)

print('No match')
exit(0)

Go to Source
Author: Will H.

When placing an order in a shop, should a shapshop be taken of the products in an order also?

When placing an order in a shop, should a shapshop be taken of the products in an order also?

…to prevent messing up with data updates, such as prices, titles, of the products that are placed in an order.

Namely, a customer buys 3 items: for $5, $10 and $33 and pays for them. All is well. When I as an owner of a shop step in and, before I’ve delivered those products to a customer, decide to descrease the price of the product, say, #2. Its new price will be $8 instead of $10. And I’ll also rename the product #3 a little bit. A customer then would go to a status tracking page and they’ll see updated data. Yes, they’ve paid and the order is being delivered, but the data has already changed in the database. They’ll be consufed.

And so will be I in a year after I’ll have changed the prices again, renamed something, etc… and decide to view history of the orders for a year.

Question 1: is there a practise of making a snaphot of the current prices, names, total order price and other characteristics of the products that constitute an order, as well as other details (chosen shipping rate and shipping method, taxes, discounts, etc) at the moment when it’s being placed? Rather than calculating those dynamically when an “order page” is opened?

If yes, does it have a name? And are there recommendations of how to do it properly?

Question 2: where and how should I store a snaphot?

option #1:

I’d have to create multiple tables then:

  • frozen_products
  • frozen_discounts
  • frozen_shipping_method_and_rates

    etc…

that will have the same structure as their dynamics corresponding ones.

Laborious. Is there a better way?

option #2:

along with an order, in the “orders” table. But how again, given the fact that an order is a single row? For instance, the products in an order is a list. How would I store a list with its characteristics (price, weight, colour, material, what have you) in a row in such a way that’ll be more or less easy to retrieve in the future? Not as a string.

Go to Source
Author: Dajaku

Rotate touchscreen in CLI mode

Rotate touchscreen in CLI mode

I’m asking for the help with my problem. I’m developing a Qt GUI application, that will run on Raspberry Pi 4 as an embedded device. I need to run my app at boot without showing the desktop to the user. My main goal is: when the device is booting, it should display my custom splash screen until my Qt application shows on’ the screen. No desktop visible or any boot text in the process, users doesn’t need to even know it’s a linux and Raspberry Pi that everthing’s running on. So I managed to get rid of all boot messages and logos I don’t need by replacing drivers/video/logo/logo_linux_clut224.ppm in my kernel to my own custom logo graphic, recompiling it and modifying the /boot/cmdline.txt. As I need to prevent the user from interacting the desktop and doesn’t really need it in my project I was advised to run my Qt app in CLI mode, rendering it directly in the framebuffer. So I switched my Raspberry to boot in CLI autologin in raspi-config and add a service which runs my app at boot with a -platform linuxfb option. Everything works as expected, my custom splash screen is displayed for the entire boot until my app shows.

The problem is I need the app to run in portrait mode. Rotating the display was easy, as I only needed to add display_rotate=1 in /boot/config.txt. But the touchscreen stayed in landscape mode and I can’t find a way to rotate it. All the solutions I can find use xinput to rotate the touchscreen or add the Option "TransformationMatrix" to the /usr/share/X11/xorg.conf.d/40-libinput.conf which I can’t use because I don’t have a X server running.

Can anyone tell me how can I rotate the touchscreen without X server?

Thanks.

Go to Source
Author: Piotr

How to send “New Order” email to admin and manager with different email template?

How to send “New Order” email to admin and manager with different email template?

I am new with WordPress and I am just trying to send email to multiple user (admin, manager) but I want to customize the template for both the different user. I want to send email to both of them but the template should be different.

Example:

Admin should receive the email with full details(address, product with price etc) but when manager receives the email then it only includes that you have received an new order from this person, address and product name but should not include the price details on that email.

I have searched a lot regarding this but I have found the solution to include the multiple recipients but not with different templates.

Please anyone suggest me the best solution for this.

Go to Source
Author: Akshay Jain

My application is using a mit licensed code as back-end, so where should i include the license?

My application is using a mit licensed code as back-end, so where should i include the license?

The license is commented in PHP but is it fine that way or do i need to do something else too? As my back-end codes are not open sourced.

Go to Source
Author: Asep Ruswandi