PHPNews

How to open various desktop applications from nodejs

The most commonly opened resources in a program are files, urls and database connections. he ‘Opn’ package allows you to open stuff like websites, files, executables in their respective desktop applications. The package is cross-platform. I usually use the package during testing phase – opening various resources, …

Continue reading »

Written by code-diesel - - Aggregated on Thursday September 6, 2018


Dash

Build beautiful web-based interfaces in Python. Dash is a Python framework for building analytical web applications. No JavaScript required. The post Dash appeared first on codediesel .

Continue reading »

Written by code-diesel - - Aggregated on Saturday September 1, 2018


Tuples in Python

Tuples are one of the core object types in Python. Although tuples may seem like lists, they are often used in different situations and for different purposes and unlike lists they are immutable. Syntactically they are enclosed in parenthesis (or without them) instead of square brackets like lists, but they …

Continue reading »

Written by code-diesel - - Aggregated on Wednesday August 15, 2018


List Comprehensions in Python

Lists are a versatile Python data structure and allows various sequence operations. Besides the usual, Lists also include a powerful operation called as ‘list comprehension’ which allows us to process various list structures, like a matrix or nested arrays or lists. It allows you to concisely form a new list by …

Continue reading »

Written by code-diesel - - Aggregated on Wednesday August 15, 2018


Working with zip files in Python

Since I started working with computers, my favorite file format was ‘zip’, popularized by the Windows PKZIP program. The idea of compressing data into shorter versions of themselves was a fascinating idea. Then, I was ignorant of the mathematical foundations of information theory, so it seemed like magic. I spent …

Continue reading »

Written by code-diesel - - Aggregated on Wednesday August 15, 2018


How to connect to MySQL in Python

Connecting to MySQL from Python offers many solutions, but I like the official MySQL connector. You can install the module using pip. sudo pip install mysql-connector-python Once the module is installed you can connect to MySQL using the following code. import mysql.connector   cnx = mysql.connecto…

Continue reading »

Written by code-diesel - - Aggregated on Tuesday August 14, 2018


How to check for DNS server speeds

As you may know DNS is a system by which a browser or other software converts a domain name to a IP4 or IP6 address. Each time we access a website the browser needs to convert the domain name to a IP4/IP6 address using a DNS server. The DNS server configured on your computer could be automatically selected by your …

Continue reading »

Written by code-diesel - - Aggregated on Tuesday August 7, 2018


Quickly find all links on a web page

The following PHP script will quickly find all the links on a web page, removing any duplicates and also giving the total count for any duplicate links found. $html = file_get_contents('https://www.example.com/');   $dom = new DOMDocument();   /* Sending any errors to the void */ @$dom->loadHTML($html);   /…

Continue reading »

Written by code-diesel - - Aggregated on Wednesday July 25, 2018


How do MVC routers work

A MVC Router class or a Dispatcher inspects the URL of an HTTP request and attempts to match individual URL components to a Controller and a method defined in that controller, passing along any arguments to the method defined. Below is shown a simple PHP router class which gives a general overview of how a router …

Continue reading »

Written by code-diesel - - Aggregated on Tuesday July 24, 2018


Convert CSV to Excel in PHP

During a recent data conversion project I needed to convert around 250 CSV files to Excel (xls) format. As this was a PHP project I decided to write a small PHP script using the PhpSpreadsheet library. Installation Use composer to install PhpSpreadsheet into your project: composer require phpoffice/phpsp…

Continue reading »

Written by code-diesel - - Aggregated on Thursday July 12, 2018


Writing WordPress posts in Markdown

WordPress allows you to write your posts using Markdown. This feature is available using Jetpack. If you write some of your eBooks or other documents using Markdown, and need to transfer some of the same content to a WordPress blog than this feature is extremely useful. No need to again create a different HTML version …

Continue reading »

Written by code-diesel - - Aggregated on Wednesday July 4, 2018


Free datasets for testing database engines

Below is a small list of free datasets with which you can test your database queries or use it for learning and practicing sql query optimization or other things. I’ve recently started reading some database books, specially by Joe Celko , and needed some medium size datasets on which I could run the sql queries …

Continue reading »

Written by code-diesel - - Aggregated on Monday July 2, 2018


PHP Simple HTML DOM Parser Script

In this post I have explained some elements to scrap data from external websites. Simple HTML DOM parser is a PHP 5+ class which is useful to manipulate HTML elements. This class can work with both valid HTML and HTML pages that do not pass W3C validation. You can find elements by ids, classes, tags and many more. …

Continue reading »

Written by code-diesel - - Aggregated on Thursday June 21, 2018


Face detection using jQuery

Face detection is a common feature in most digital cameras today; the white or red square that pops around someones face when we are focusing the camera on that person. Face detection algorithms enables the software to pinpoint the locations and sizes of human faces in digital images, whatever the surrounding objects …

Continue reading »

Written by code-diesel - - Aggregated on Wednesday June 20, 2018


Rendering text tables with NodeJS

A recent data project required the program to emit data tables from node which could be piped to other processes. easy-table is one such package which provided a nice way to output text tables in the console. Installation is using npm. $ npm install easy-table A small example code is given below. …

Continue reading »

Written by code-diesel - - Aggregated on Monday June 18, 2018


How to access Gmail using Python

In a previous post we saw how you could access Gmail in NodeJS. In this post we will see how we can access Gmail using Python. Turning on the Gmail api You first need to enable Gmail api and get the required OAuth credentials from your Google account. The steps which are shown below. 1 . Use this wizard …

Continue reading »

Written by code-diesel - - Aggregated on Monday June 18, 2018


Combinatorial row pairing in databases

While working on a database design I came across the problem of finding combinations or ‘cartesian product’ between all the rows between one table to another table, but not repeating the same permutations. Take the ‘Teams’ table below which lists four cricket teams. We want to create a combination list of matches …

Continue reading »

Written by code-diesel - - Aggregated on Monday June 11, 2018


How to read and create zip files in nodejs

As I’ve been working on a small project for the past few months, mostly related to backend processing – files, databases etc. The small part of the project needed the ability to read and write zip files. I found the jsZip npm package adequate for my requirement. This allows me to quickly read and write zip files. …

Continue reading »

Written by code-diesel - - Aggregated on Monday June 4, 2018