Περί του blog

Το Digispot είναι online από το 2014, και δημιουργήθηκε με σκοπό να παρέχει γρήγορες και πρακτικές λύσεις σε μικρά, αλλά σημαντικά προβλήματα που αντιμετωπίζουν προγραμματιστές, είτε είναι επαγγελματίες είτε ερασιτέχνες. Εδώ δεν υπάρχουν αναλύσεις ή εκτενείς εξηγήσεις αφού το νόημα είναι ξεκάθαρο για όποιον έχει έστω και ελάχιστη εμπειρία στον τομέα.

Παράλληλα, το Digispot λειτουργεί και ως προσωπικό σημειωματάριο, συγκεντρώνοντας χρήσιμες πληροφορίες και tips για γρήγορη πρόσβαση όταν χρειάζεται.

Όλες οι ερωτήσεις που έχουν γίνει, είτε απαντήθηκαν στα σχόλια είτε μέσα από το παλιό forum. Τα σχόλια είναι ανοιχτά για όποιον χρειάζεται βοήθεια.

Δημοσιεύθηκε στη T-Edit | Σχολιάστε

CWP – Διόρθωση προβλήματος Postfix.

# General
mail_owner = postfix
setgid_group = postdrop
delay_warning_time = 4
smtp_address_preference = ipv4

# Directories
html_directory = no
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
queue_directory = /var/spool/postfix
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man

# Networking
inet_interfaces = all
mydomain = ΤΟDOMAINTOUSERVER
myhostname = ΤΟDOMAINTOUSERVER
mynetworks = $config_directory/mynetworks
mydestination = $myhostname, localhost.$mydomain, localhost
relay_domains = mysql:/etc/postfix/mysql-relay_domains_maps.cf

# Aliases
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
transport_maps = hash:/etc/postfix/transport

# Virtual Mailboxes from MySQL
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf, hash:/etc/postfix/discard_aliases
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_mailbox_uid_maps.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_mailbox_gid_maps.cf
virtual_mailbox_base = /var/vmail
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_alias_domains =
dovecot_destination_recipient_limit = 1

# SASL Authentication
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# TLS
smtp_use_tls = yes
smtpd_use_tls = yes
smtpd_tls_security_level = may
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
smtpd_tls_key_file = /etc/pki/tls/private/hostname.key
smtpd_tls_cert_file = /etc/pki/tls/certs/hostname.bundle

# Restrictions
smtpd_client_restrictions =
smtpd_helo_restrictions =
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_whitelist, check_sender_access hash:/etc/postfix/sender_blacklist
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net
smtpd_helo_required = yes
disable_vrfy_command = yes
smtpd_data_restrictions = reject_unauth_pipelining
unknown_local_recipient_reject_code = 550

# Limits
message_size_limit = 20480000
mailbox_size_limit = 2048000000
anvil_rate_time_unit = 3600s
smtpd_client_message_rate_limit = 500

# Milter (π.χ. spamassassin/clamav)
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
milter_protocol = 2

# Debugging
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
        xxgdb $daemon_directory/$process_name $process_id & sleep 5

Σε όλα τα virtual hosts μπαίνει το 127.0.0.1 γιατί χρησιμοποιεί socket. Με localhost προκαλεί fails.

Φτιάχνουμε και ένα αρχείο discard_aliases προαιρετικά για τα mails του root. Να μην μας πρήζει αν δεν υπάρχει δηλαδή.
root@ΣΕΡΒΕΡΝΑΜΕ discard
admin@ΣΕΡΒΕΡΝΑΜΕ discard

Δημοσιεύθηκε στη Linux | Σχολιάστε

CWP – Πρόβλημα με smtp του host

Στο etc/hosts

# Localhost
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1   autoreply.todomaintouhost

# Your server public IP and hostname
xx.xxx.xx.xxx    todomaintouhost

# Domains hosted on this server
xx.xxx.xx.xxx   domain mail.domain.com
xx.xxx.xx.xxx   domain2 mail.domain.com

Επίσης στην βάση postfix ( μπες phpmyadmin από CWP είναι πιο εύκολο ) και στα domain που θες να στέλνουν

UPDATE `domain` SET `backupmx` = 1;

Για να χρησιμοποιείς το mail domain του κάθε account

🛠️ 1. DNS Records για todomainmou.gr
Ρύθμισέ τα στο panel του domain registrar σου ή στο DNS manager σου:

dns
Αντιγραφή
Επεξεργασία
; Βασικό A record
@ IN A xx.xxx.xx.xxx
www IN CNAME todomainmou.gr.

; Mail subdomain
mail IN A xx.xxx.xx.xxx
smtp IN CNAME mail.todomainmou.gr.
imap IN CNAME mail.todomainmou.gr.
pop IN CNAME mail.todomainmou.gr.

; MX record (πρέπει να δείχνει στο mail)
@ IN MX 10 mail.todomainmou.gr.

; SPF
@ IN TXT “v=spf1 a mx ip4:xx.xxx.xx.xxx ~all”

; DKIM (θα σου το δώσει το CWP)
default._domainkey IN TXT “v=DKIM1; k=rsa; p=MIGfMA…<το public key>…”

; DMARC (προαιρετικό αλλά προτείνεται)
_dmarc IN TXT “v=DMARC1; p=none; rua=mailto:postmaster@todomainmou.gr”
🔒 2. SSL Certificate για mail.todomainmou.gr
Στο CWP Admin Panel:

Email → MailServer Manager → Mail Server SSL → AutoSSL

Επίλεξε το domain todomainmou.gr

Τσέκαρε το mail.todomainmou.gr

Κάνε Generate Let’s Encrypt

✅ Αυτό θα σου εγκαταστήσει SSL για:

mail.todomainmou.gr (SMTP/IMAP)

webmail.todomainmou.gr (προαιρετικά)

📧 3. Φτιάξε mail χρήστη στο CWP
CWP User Panel → Email Accounts → Add

Email: info@todomainmou.gr

Password: δικό σου

Quota: π.χ. 500MB ή unlimited

🔐 4. DKIM για todomainmou.gr
CWP Admin Panel → Email → DKIM Manager

Αν δεν είναι ήδη ενεργό, κάνε generate DKIM για το domain

Αντιγραφή του public key στο DNS (το βλέπεις από το CWP ή το φτιάχνει αυτόματα αν κάνεις bind zone από τον CWP)

📨 5. Ρυθμίσεις Mail Client (π.χ. Outlook / Thunderbird)
Ρύθμιση Τιμή
Email info@todomainmou.gr
Username info@todomainmou.gr
Password [ό,τι έβαλες]
Incoming Mail Server mail.todomainmou.gr
Outgoing Mail Server mail.todomainmou.gr
IMAP Port 993 (SSL)
POP3 Port 995 (SSL)
SMTP Port 587 (STARTTLS)
Authentication Required for SMTP
Encryption SSL/TLS or STARTTLS
📜 6. (Προαιρετικά) /etc/hosts entry
Αν θες local resolve χωρίς DNS:

ini
Αντιγραφή
Επεξεργασία
xx.xxx.xx.xxx mail.todomainmou.gr

Δημοσιεύθηκε στη Linux | Σχολιάστε

Διαμόρφωση Αριθμού Γενικής Λογιστικής

=TEXT(D4;"00\.00\.000\.000\.000")
Δημοσιεύθηκε στη Microsoft Excel | Σχολιάστε

CWP – Προβλήματα σε prefixes των βάσεων

nano /usr/local/cwp/.conf/mysql_user_prefix.conf
Δημοσιεύθηκε στη Linux | Σχολιάστε

CWP Backups με Sync σε Hetzner Storage Box

ssh-keygen -t rsa -b 4096 -f /root/.ssh/backup/id_rsa

Στον Remote mkdir .ssh

Πιθανόν να χρειαστούν δικαιώματα. Καλό είναι οι φάκελοι να φτιάχνονται με Filezilla γιατί η Hetzner δεν δίνει πολλά δικαιώματα στις εντολές.

Μετά ανεβάζεις το δημόσιο κλειδί στο Hetzner Storage Box (.ssh/authorized_keys).

scp /root/.ssh/backup/id_rsa.pub user@user.your-storagebox.de:new_id_rsa.pub
 rsync -avz --no-perms --no-owner --no-group -e "ssh -i /root/.ssh/backup/id_rsa -p 23" /backup/ user@user.your-storagebox.de:Folder/

Τελικά μπορούμε να το βάλουμε σε cron.

export VISUAL=nano
export EDITOR=nano

crontab -e

0 7 * * * rsync -avz --no-perms --no-owner --no-group -e "ssh -i /root/.ssh/backup/id_rsa -p 23" /backup/ user@user.your-storagebox.de:Folder/ >> /var/log/rsync_backup.log 2>&1
Δημοσιεύθηκε στη Linux | Σχολιάστε

Πρόβλημα με το og:image και Yoast

add_image_size('featuredFb', 1200, 630, true);

add_filter( 'wpseo_opengraph_image_size', function( $size ) {
return 'featuredFb';
});


add_filter( 'wpseo_frontend_presentation', function( $presentation ) {
    $presentation->open_graph_images = [
        [
            'url'    => wp_get_attachment_image_url( get_post_thumbnail_id(), 'featuredFb' ),
            'width'  => 1200,
            'height' => 630,
        ],
    ];
    return $presentation;
});
Δημοσιεύθηκε στη Wordpress | Σχολιάστε

Προσαρμογή iframe από συγκεκριμένες πηγές σε μέγεθος οθόνης

<script>
document.addEventListener("DOMContentLoaded", function () {
    var videoIframes = document.querySelectorAll('iframe[src*="youtube.com"], iframe[src*="dailymotion.com"], iframe[src*="vimeo.com"]');

    videoIframes.forEach(function (iframe) {
        // Δημιουργία wrapper γύρω από το iframe, αν δεν υπάρχει ήδη
        var wrapper = document.createElement('div');
        wrapper.style.position = 'relative';
        wrapper.style.width = '100%';
        wrapper.style.paddingTop = '56.25%'; // Αναλογία 16:9
        wrapper.style.overflow = 'hidden';

        // Μετακίνηση του iframe στο wrapper
        iframe.parentNode.insertBefore(wrapper, iframe);
        wrapper.appendChild(iframe);

        // Εφαρμογή στυλ στο iframe
        iframe.style.position = 'absolute';
        iframe.style.top = '0';
        iframe.style.left = '0';
        iframe.style.width = '100%';
        iframe.style.height = '100%';
        iframe.style.border = '0';
    });
});
</script>
Δημοσιεύθηκε στη Css | Σχολιάστε

With

WITH daily_data AS (
    SELECT 
        sub_account,
        ref_date,
        TOTAL_PAYMENTS,
        LAG(TOTAL_PAYMENTS) OVER (PARTITION BY sub_account ORDER BY ref_date) AS prev_day_total
    FROM AB_MIS2.mis.LGS
    WHERE REF_DATE > '2023-12-29'
)
SELECT 
    sub_account,
    ref_date,
    COALESCE(TOTAL_PAYMENTS - prev_day_total, TOTAL_PAYMENTS) AS daily_payments
FROM daily_data
WHERE COALESCE(TOTAL_PAYMENTS - prev_day_total, TOTAL_PAYMENTS)  <> 0
ORDER BY sub_account, ref_date;
Δημοσιεύθηκε στη SQL | Σχολιάστε

Custom πεδίο στην βάση στον πίνακα προϊόντων

<?php
class ProductController extends ProductControllerCore
{
    public function initContent()
    {
        parent::initContent(); // Always call the parent function

        $productId = (int)Tools::getValue('id_product');
        $query = new DbQuery();
        $query->select('onskroutzop');
        $query->from('product');
        $query->where('id_product = ' . $productId);
        $onskroutzop = Db::getInstance()->getValue($query);
        $this->context->smarty->assign('onskroutzop', $onskroutzop);
    }
}

Έπειτα το καλούμε στο tpl

<!-- tcp -->
	{if $onskroutzop == 0} 
		<span class="diathpost" id="red_tcp">Μη διαθέσιμο</span>
	{elseif $onskroutzop == 1}
		<span class="diathpost" id="purple_tcp">Αναμένεται</span>
	{elseif $onskroutzop == 2}
		<span class="diathpost" id="purple_tcp">Κατόπιν Παραγγελίας</span>	
	{elseif $onskroutzop == 3}
		<span class="diathpost" id="lightblue_tcp">Διαθέσιμο για Αποστολή ή Παραλαβή 5 έως 10 Εργάσιμες</span>
	{elseif $onskroutzop == 4}
		<span class="diathpost" id="lightblue_tcp">Διαθέσιμο για Αποστολή ή Παραλαβή 3 έως 5 Εργάσιμες</span>
	{elseif $onskroutzop == 5}
		<span class="diathpost" id="lightblue_tcp">Διαθέσιμο για Αποστολή ή Παραλαβή 1 έως 3 Εργάσιμες</span>
	{elseif $onskroutzop == 6}
		<span class="diathpost" id="lightgreen_tcp">Διαθέσιμο για Αποστολή</span>
	{elseif $onskroutzop == 7}
		<span class="diathpost" id="lightgreen_tcp">Άμεσα Διαθέσιμο</span>
	{else}
		<span class="diathpost" id="purple_tcp">Καλέστε για διαθεσιμότητα</span>
	{/if}	
<!-- tcp -->
Δημοσιεύθηκε στη Prestashop | Σχολιάστε

Related Table Measure

Total Retail Price of Our Stock = 
SUMX(
    'skalidation_beta tcp_products_total_stock',
    'skalidation_beta tcp_products_total_stock'[our_stock] * RELATED('skalidation_beta tcp_products'[product_price])
)
Δημοσιεύθηκε στη Power BI | Σχολιάστε

Φίλτρα Prestashop – Να φαίνονται μόνο τα προϊόντα που είναι σε στοκ

ps_facelet_search/src/adapter/Mysql.php

foreach ($this->getFilters() as $filterName => $filterContent) {
            $selectAlias = 'p';
            if (array_key_exists($filterName, $filterToTableMapping)) {
                $joinMapping = $filterToTableMapping[$filterName];
                $selectAlias = $joinMapping['tableAlias'];
                $filterName = isset($joinMapping['fieldName']) ? $joinMapping['fieldName'] : $filterName;
            }

            foreach ($filterContent as $operator => $values) {
                if (count($values) == 1) {
                    $values = current($values);

                    if ($operator === '=') {
                        if (count($values) == 1) {
                            $whereConditions[] =
                                $selectAlias . '.' . $filterName . $operator . "'" . current($values) . "'";
                        } else {
                            $whereConditions[] =
                                $selectAlias . '.' . $filterName . ' IN (' . $this->getJoinedEscapedValue(', ', $values) . ')';
                        }
                    } else {
                        $orConditions = [];
                        foreach ($values as $value) {
                            $orConditions[] = $selectAlias . '.' . $filterName . $operator . $value;
                        }
                        $whereConditions[] = implode(' OR ', $orConditions);
                    }
							//tcp
		$whereConditions[] = 'sa.quantity > 0'; 
                }
            }
        }

ps_facelet_search/src/filters/Products.php

public function getProductByFilters(
    ProductSearchQuery $query,
    array $selectedFilters = []
) {
    // Load sorting type and direction, validate it and apply fallback if needed
    $orderBy = $query->getSortOrder()->toLegacyOrderBy(false);
    $orderWay = $query->getSortOrder()->toLegacyOrderWay();
    $orderWay = Validate::isOrderWay($orderWay) ? $orderWay : 'ASC';
    $orderBy = Validate::isOrderBy($orderBy) ? $orderBy : 'position';

    // Apply it to the filter
    $this->searchAdapter->setOrderField($orderBy);
    $this->searchAdapter->setOrderDirection($orderWay);

    // Add stock filter to ensure only products in stock are returned
    $this->searchAdapter->addOperationsFilter(
        'in_stock_filter',
        [
            [
                ['quantity', [0], '>'], // Only include products with quantity > 0
            ],
        ]
    );

    $this->searchAdapter->addGroupBy('id_product');
    if (isset($selectedFilters['price']) || $orderBy === 'price') {
        $this->searchAdapter->addSelectField('id_product');
        $this->searchAdapter->addSelectField('price');
        $this->searchAdapter->addSelectField('price_min');
        $this->searchAdapter->addSelectField('price_max');
    }

    // Get full list of matching products
    $fullProductList = $this->searchAdapter->execute();

    // Count them
    $totalProductCount = count($fullProductList);

    // Get pagination
    $productsPerPage = (int) $query->getResultsPerPage();
    $page = (int) $query->getPage();

    // Cut them down by pagination
    $finalProductList = array_slice(
        $fullProductList,
        ($page - 1) * $productsPerPage,
        $productsPerPage
    );

    // And run post filter
    $this->pricePostFiltering($finalProductList, $selectedFilters);

    return [
        'products' => $finalProductList,
        'count' => $totalProductCount,
    ];
}

ps_facelet_search/src/filters/block.php

private function getAttributesBlock($filter, $selectedFilters, $idLang)
{
    $attributesBlock = [];
    $filteredSearchAdapter = null;
    $idAttributeGroup = $filter['id_value'];

    if (!empty($selectedFilters['id_attribute_group'])) {
        foreach ($selectedFilters['id_attribute_group'] as $key => $selectedFilter) {
            if ($key == $idAttributeGroup) {
                $filteredSearchAdapter = $this->searchAdapter->getFilteredSearchAdapter('with_attributes_' . $idAttributeGroup);
                break;
            }
        }
    }

    if (!$filteredSearchAdapter) {
        $filteredSearchAdapter = $this->searchAdapter->getFilteredSearchAdapter();
    }

    // Add a global filter to include only in-stock products
    $filteredSearchAdapter->addOperationsFilter(
        'in_stock_filter',
        [
            [
                ['quantity', [0], '>'], // Filter only products with quantity > 0
            ],
        ]
    );

    $attributesGroup = $this->dataAccessor->getAttributesGroups($idLang);
    if ($attributesGroup === []) {
        return $attributesBlock;
    }

    $attributes = $this->dataAccessor->getAttributes($idLang, $idAttributeGroup);

    $filteredSearchAdapter->addOperationsFilter(
        'id_attribute_group_' . $idAttributeGroup,
        [[['id_attribute_group', [(int) $idAttributeGroup]]]]
    );

    $results = $filteredSearchAdapter->valueCount('id_attribute');
    foreach ($results as $key => $values) {
        $idAttribute = $values['id_attribute'];
        if (!isset($attributes[$idAttribute])) {
            continue;
        }

        $count = $values['c'];
        $attribute = $attributes[$idAttribute];
        $idAttributeGroup = $attribute['id_attribute_group'];
        if (!isset($attributesBlock[$idAttributeGroup])) {
            $attributeGroup = $attributesGroup[$idAttributeGroup];

            $attributesBlock[$idAttributeGroup] = [
                'type_lite' => 'id_attribute_group',
                'type' => 'id_attribute_group',
                'id_key' => $idAttributeGroup,
                'name' => $attributeGroup['attribute_group_name'],
                'is_color_group' => (bool) $attributeGroup['is_color_group'],
                'values' => [],
                'url_name' => $attributeGroup['url_name'],
                'meta_title' => $attributeGroup['meta_title'],
                'filter_show_limit' => (int) $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type'],
            ];
        }

        $attributesBlock[$idAttributeGroup]['values'][$idAttribute] = [
            'name' => $attribute['name'],
            'nbr' => $count,
            'url_name' => $attribute['url_name'],
            'meta_title' => $attribute['meta_title'],
        ];

        if ($attributesBlock[$idAttributeGroup]['is_color_group'] !== false) {
            $attributesBlock[$idAttributeGroup]['values'][$idAttribute]['color'] = $attribute['color'];
        }

        if (array_key_exists('id_attribute_group', $selectedFilters)) {
            foreach ($selectedFilters['id_attribute_group'] as $selectedAttribute) {
                if (in_array($idAttribute, $selectedAttribute)) {
                    $attributesBlock[$idAttributeGroup]['values'][$idAttribute]['checked'] = true;
                }
            }
        }
    }

    foreach ($attributesBlock as $idAttributeGroup => $value) {
        $attributesBlock[$idAttributeGroup]['values'] = $this->sortByKey($attributes, $value['values']);
    }

    $attributesBlock = $this->sortByKey($attributesGroup, $attributesBlock);

    return $attributesBlock;
}
Δημοσιεύθηκε στη Prestashop | Σχολιάστε

Roundcube 500 Internal Error σε CWP

If you’re getting Server error (Internal Server Error) in Roundcube that is because you’ve some incompatible version of the Roundcube mail client is installed on your server which we didn’t currently support. To fix the issue you need to run these commands one by one :

First run the CWP Update script that will ensure you’ve latest version of CWP :

sh /scripts/update_cwp

Second run the CWP roundcube update script :

sh /scripts/mail_roundcube_update

This will install supported version of Roundcube and error will be fixed, if you’re still getting internal error then you need run this script to fix the mail permissions :

/scripts/cwp_api account mail_fix_permissions

* pleas note that on servers with big /var/vmail folder this can take some time

Make sure you also check the logs
/usr/local/cwpsrv/var/services/roundcube/logs/errors.log
/var/log/dovecot.log

Permissions for /var/vmail

chown vmail.mail /var/vmail
chmod 770 /var/vmail
Δημοσιεύθηκε στη Linux | Σχολιάστε

CWP πρόβλημα με DNS Records

chown -R named:named /var/named
chmod 755 /var/named


sestatus

chcon -R -t named_cache_t /var/named
restorecon -RFv /var/named

systemctl restart named
Δημοσιεύθηκε στη Linux | Σχολιάστε

CWP

Default Page

nano /usr/local/apache/htdocs/index.html

Installation

--CentOS 8/ Almalinux 8--
hostnamectl set-hostname srv.example.com
yum install epel-release -y
yum -y install wget
yum -y update
reboot
cd /usr/local/src
wget http://centos-webpanel.com/cwp-el8-latest
sh cwp-el8-latest

Σε κενό μηχάνημα:

vi /etc/resolv.conf

Επικόλληση
nameserver 8.8.8.8
nameserver 8.8.4.4

Esc -> :wq

yum clean all
yum makecache
yum install epel-release -y

--Ίσως χρειαστεί μετά ξανά το epel.
yum install ca-certificates -y
update-ca-trust
Δημοσιεύθηκε στη Linux | Σχολιάστε

Αρχεία μεγαλύτερα από 1GB

find / -type f -size +1G

Δημοσιεύθηκε στη Linux | Σχολιάστε

Εικόνες με ελληνικό url σε WordPress. Πρόβλημα για τα social

SELECT 
    parent.ID AS post_id,             
    parent.post_title AS parent_title, 
    attachment.ID AS attachment_id,    
    attachment.guid AS attachment_url, (image URL)
    attachment.post_title AS attachment_title 
FROM 
    tr_posts AS attachment
LEFT JOIN 
    tr_posts AS parent 
ON 
    attachment.post_parent = parent.ID
WHERE 
    attachment.post_type = 'attachment'
    AND (attachment.post_name REGEXP '[α-ωΑ-Ω]' OR attachment.guid REGEXP '[α-ωΑ-Ω]');
Δημοσιεύθηκε στη Wordpress | Σχολιάστε

Διαδικασία Επαναφοράς Συγκεκριμένου Folder από tar Backup

scp -P 23  userid@userid.your-storagebox.de:folder/2024-10-21/accounts/filename.tar filename.tar


tar -xvf filename.tar 

tar -xvf filename.tar filename/homedir/folder/subfolder --strip-components=3 -C ./subfolder
Δημοσιεύθηκε στη Linux | Σχολιάστε

Scp ή Secure Copy ή Μεταφορά από server με ftp/ssh

scp -P 23 sourcefile.tar user@server.com:folder/destinationfile.tar

scp -P 23  user@server.com:folder/sourcefile.tar destinationfile.tar
Δημοσιεύθηκε στη Linux | Σχολιάστε

Graphs Calendar

Gross Current Graphs = 
var noOfMonths = -MONTH(MAX(Dates[Date]))
var refDate =  MAX(Dates[Date])
var preDates = DATESINPERIOD('Calendar Graphs'[Date];refDate;noOfMonths;MONTH)

var out = CALCULATE([Gross];REMOVEFILTERS(Dates[Month & Year]);KEEPFILTERS(preDates);USERELATIONSHIP('Calendar Graphs'[Date];Dates[Date]))

return out
Δημοσιεύθηκε στη Power BI | Σχολιάστε

Convert Google Maps σε Longtitude Latitude

Συντεταγμένες από Google


37.91134425314302, 23.71307384195016

Long
=SUBSTITUTE(MID(E97; FIND(","; E97) + 2; LEN(E97)); "."; ",")

Lat
=SUBSTITUTE(LEFT(E97;FIND(","; E97) - 1); ".";",")
Δημοσιεύθηκε στη Microsoft Excel | Σχολιάστε

Επαναφορά μόνο για συγκεκριμένο πίνακα mysql αρχείο

Export μόνο η βάση από το tar

tar -xf backupsomething.tar accountname/mysql/dumpfile.sql

grep 'INSERT INTO `ps_image`' dumpfile.sql > ps_image_inserts.sql

Αν θέλεις να μετρήσεις πόσες φορές εμφανίζεται μία εντολή στο αρχείο:

grep -o "INSERT INTO" ps_image_insert.sql | wc -l
Δημοσιεύθηκε στη Linux | Σχολιάστε

Prestashop admin order View Location

/src/PrestashopBundle/Resources/views/Admin/Sell/Order/view.html.twig

Δημοσιεύθηκε στη Prestashop | Σχολιάστε

Υποκατηγορίες στο category.tpl

<!--tcp-->
						<div class="subcategory-grid">
							{if isset($subcategories) && count($subcategories) > 0}
								{foreach from=$subcategories item=subcategory}
									<div class="subcategory">
										<a href="/{$subcategory.id_category}-{$subcategory.link_rewrite}">
											<img src="{$subcategory.image.bySize.Category_Square.url}" alt="{$subcategory.name|escape:'html':'UTF-8'}" />
											<div class="subcategory-caption">{$subcategory.name|escape:'html':'UTF-8'}</div>
										</a>
									</div>
								{/foreach}
							{/if}
						</div>
						<!--tcp-->
Δημοσιεύθηκε στη Prestashop | Σχολιάστε

Logs Filter

journalctl --since "2024-04-09 03:30" --until "2024-04-09 06:00"
Δημοσιεύθηκε στη Linux | Σχολιάστε

Free Space σε Boot δίσκο

package-cleanup --oldkernels --count=1
Δημοσιεύθηκε στη Linux | Σχολιάστε

Leading Zeros

Αριθμός Λογαριασμού =
FORMAT ( Budget8[GL1]; "00" ) & "." &
FORMAT ( Budget8[GL2]; "00" ) & "." &
FORMAT ( Budget8[GL3]; "000" ) & "." &
FORMAT ( Budget8[GL4]; "000" ) & "." &
FORMAT ( Budget8[GL5]; "000" )
Δημοσιεύθηκε στη Power BI | Σχολιάστε

Υπολογισμός Running Total

# All e-Banking Registered = 
VAR SelectedDate = MAX(Dates[Date])  
VAR EndOfMonthDate = EOMONTH(SelectedDate; 0)
RETURN
CALCULATE(
    SUM('Scorecard e-Banking'[Count]);
    ALL('Scorecard e-Banking');
    VALUES('Scorecard e-Banking'[BRANCH_ID]);
    'Scorecard e-Banking'[DateERegistered] <= EndOfMonthDate
)
Δημοσιεύθηκε στη Power BI | Σχολιάστε

Ngnix Mobile Cache

In Custom Code

if ($http_user_agent ~* "(mobile|webos|opera mini)") {
    set $mobile_request 1;
}
proxy_cache_key "$scheme$request_method$host$uri$is_args$args$mobile_request";
Δημοσιεύθηκε στη Linux | Σχολιάστε

Διόρθωση 500 Error στο τελευταίο βήμα πληρωμής

function smartyRender($params, &$smarty)
{
    $ui = $params['ui'];

    if ($ui !== null) {
        if (array_key_exists('file', $params)) {
            $ui->setTemplate($params['file']);
        }

        return $ui->render($params);
    } else {
       //Κατέγραψέ το σε log αν θες. Δεν έχει σχέση με τα στοιχεία που περνιούνται στην παραγγελία.
    }
}
Δημοσιεύθηκε στη Prestashop | Σχολιάστε