I always get questions from my coworkers as well as my readers like the ones below.
- Where do I start learning python?
- Why/How should a hardware engineer learn python in 2019?
- How python could be used to eliminate manual tasks?
- Why python is preferred over other scripting languages?
If you check out the link here, its pretty much obvious that javascript and python leads the programming languages race in 2017. Python has its root in almost any major tech domain such as web development, data analytics, machine learning, deep learning, computer vision, natural language processing, audio processing etc., as shown here.
But, what if we use python to design, simulate and implement hardware circuits in silicon? Is it possible to take the amazing advantages that python offer over other hardware related programming languages such as HDL (verilog or vhdl), Tcl, Perl or Shell? Come let’s explore!
Why Python is so popular?
If you are a beginner to the programming world, I would highly suggest you to learn python first. This is because of the following major reasons.
- Simple: Python is simple to learn because its very similar to how we humans think.
- More Productive: Python is highly productive when compared to other languages such as c, c++ or java as it is much more readable, concise, expressive and takes lesser time and effort to write code.
- One-liners: Python has so many one-liners and english-like commands (keywords) that boosts programmers productivity a lot.
- Community: Python has a very big developer friendly community and its very easy to find python developers around the world in platforms such as GitHub or Stack Overflow.
- Libraries: Python has rich set of well documented libraries and frameworks for different tech domains as shown here.
- Open-Source: Python ecosystem is so popular because most of the libraries and frameworks available online are open-source (meaning anyone can use it for their development purposes adhering to the licenses provided).
Despite its advantages, python is much slower compared to languages such as c++. But wait! It’s not a big disadvantage. You can still use python for most of the tasks that require minimal execution time (not speed-intensive applications such as games). That’s why data-intensive domains such as deep learning libraries use python as a high-level wrapper for a human to code and beneath that wrapper, they use C++ for faster execution.
How to learn python for free?
When I started learning python three years back, I used the following resources. I guess, these resources are more than enough to get you comfortable with python.
- HackerRank is the best learning platform for python. You have to learn and solve programs based on levels of difficulty. Once you solve programs here, you will get that confidence in using the language for your own purposes.
- Learn Python - Socratica has an excellent playlist full of neatly made python tutorials in YouTube for free. If you love learning by videos, this is the best ever python tutorial playlist out there.
- Corey Schafer is another awesome YouTube channel that delivers no-bullshit python tutorials.
Other than these, you can check out some extensive list of learning resources that I collected for you here.
Python for Automation
The main use of python lies in automating repeated manual tasks that we perform daily. These manual tasks might include opening a terminal, going to a path, finding some file, parsing some values in that file, putting that parsed value in a csv file and sending a mail with that csv file attached. This is one of the classic examples where you can write a single python script to do all the steps that are mentioned.
Other examples where python scripts can be used are organizing files in a particular path, manipulating strings, csv files, excel spreadsheets etc., sending email and text messages and much more. Automate the boring stuff with python is a great learning resource that you can read on how to do these.
Python for Text Processing
Manipulating text files is a common task in any domain whether you are in VLSI, computer networking, image processing, signal processing etc., Python offers rich set of libraries and modules to do this.
Some of the most commonly used text processing modules in python using which you can manipulate text files (such as CSV files, JSON files, YAML file, HTML files etc.,), perform shell operations, parse large text files, load/store very large text files and manipulate file formats are
- string module
- os module
- sys module
- re module
- csv module
- json module
- yaml module
- h5py module
- bs4 module
Python for Logic Design
Ok cool! Now you understood, python could be used to create automation utilities that involve text processing which reduces time involved in solving repeated manual tasks in your day-to-day work life.
MyHDL
Can python be used in designing hardware circuits which typically need a HDL for writing code? Of course, there is a great open-source python project called MyHDL that turns python into a hardware description and verification language, providing hardware engineers with the power of the python ecosystem.
Moreover, MyHDL designs can be converted to verilog or VHDL automatically and implemented using a standard tool flow. Before getting too much excited about this library, please read What MyHDL is not?
You can check out FPGA designs using MyHDL here. You can check out MyHDL manual here. Also, do read this quora answer.
PyMTL
Another python based hardware modeling framework is PyMTL. Following links provide training resources on using this library.
- Verilog Hardware Description Language
- PyMTL Hardware Modeling Framework Tutorial
- PyMTL CL Modeling Tutorial
- PyMTL/HLS Tutorial
- PyMTL-Based ASIC Toolflow Tutorial
Python for ML/DL in Hardware
Apart from the hypes that machine learning (ML) and deep learning (DL) have created in the recent years, still VLSI domain isn’t deeply affected by ML or DL. This is because, VLSI industry is so complex because of conflicting goals to optimize hardware designs for timing, power and area with lesser time to market.
This is definitely the time to use ML or DL in hardware design, particularly creating ML models for smaller tasks in a bigger design flow. I have documented some of the current research papers and articles related to using ML or DL in VLSI chip design here.
But, for a beginner who is interested to use ML or DL in hardware design, below are the python libraries needed to get started.
Scientific Computing Stack
Machine Learning
Deep Learning
Python for EDA
As far as technology node reduces, the need for electronic design automation tools increases. You can’t design a multi-million instances based design manually. You need EDA tools that helps in implementation.
One particular python project that I found related to EDA was PyEDA. You can watch this YouTube video to learn more about this hobby project by Chris Drake.
Python for Web Dashboards
To analyze your design data which has lots of files with millions of lines, you need a simpler way to look at important metrics, reports and status of your design in a nice looking web interface. Python provides cool libraries to create web dashboards that speeds up your productivity as well as reducing your analysis time.
Using the python libraries given below, and with some HTML, CSS and JavaScript knowledge, you can create beautiful web dashboards to analyze your design data and reduce time to market a lot.
Conclusion
As you can see, python can be used in multiple areas in hardware design. According to me, python has just started to find its place in hardware design. Also, I feel that it will be used by engineers around the world very soon due to its simpler nature. If you have found anything related to python that could be used for hardware design, please leave that in the comments below. Peace!
In case if you found something useful to add to this article or you found a bug in the code or would like to improve some points mentioned, feel free to write it down in the comments. Hope you found something useful here.
Happy learning!


Open Source Projects
Hubot
Hubot is a chat robot for most popular chat networks(gchat,campfire,hipchat,etc). A hubot can do all sorts of neat things and has a decent amount of community contributed scripts.
Cinderella
A Rubygem that sets up a new Mac OSX system for open source development with Chef.
Camo
A simple SSL proxy for images. Useful for making insecure images embedded in websites appear to come from a secure resource.


Beginner Bootcamp for developers, from Zero to Hero
Join The Bootcamp Now!We'll Create SladeDev (it's the site you're on now),
We'll do it all without a single line of custom CSS!
Tailwind makes writing CSS easier and lets us customize our designs faster than any other CSS framework. If you want a CSS framework that has pre-built components, then Tailwind may not be for you. If you want a CSS framework that lets you design quickly and customize your site, then Tailwind is gonna be a lot of fun.
After using Bulma to build
Scotch.io, my CSS files became littered with my own
!important
classes to override the framework's styles. Tailwind doesn't have
the
!important
problem since all our elements are designed on the fly.
Important Note: Tailwind lets us design quickly, but this doesn't mean that you don't need CSS knowledge however. To use Tailwind, you need to have a good understanding of CSS properties. In this course, we will learn Tailwind and we'll also learn CSS conceptsto create good looking designs. Tailwind is the ultimate CSS shorthand, but we still need to learn the CSS, which we'll do in this course.
"This isn't just a Tailwind course. This is also a "learn how to design with CSS" course.
The hardest things about learning Tailwind is memorizing the classes and also knowing which classes go well together. We'll be writing a lot of Tailwind in this course so that the repetition will help us commit Tailwind classes to memory.
Hey there! My name is Slade and I founded a web dev tutorial siteScotch.io. We were able to grow to 4M monthly pageviews and $300,000 yearly revenue. Scotch.io was acquired byDigitalOcean in November 2019. Nowadays I'm in search of the best ways to develop and design a business. Hope you enjoy this course and my other one MakeReactApps.com.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Excepturi laborum
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nobis facilis eius rerum
We'll dive into the most important Tailwind classes and use them a TON. There are a lot of useful classes like spacing, backgrounds, borders, shadows, and typography. We'll type the Tailwind classes many times over to ensure that repeitition is our greatest learning tool.
There's a certain process to designing with Tailwind that we'll take to make our designs look good. Some easy to remember rules are all it takes to get a good design. We'll also talk about ideas and action items to take a good design and make it great.
To be completely honest, I didn't like Tailwind at first. It felt like inline styles to me (and maybe still does). After using it more and more though, I've come to absolutely love it. I dread jumping into a project without Tailwind now.
The site you're on (BeginnerTailwind.com) is built with Tailwind and has 0 custom css. You can take all of the code from this site and use it for your own landing pages or sites! All the code is available to you with course purchase.
I struggle with making things look good and don't consider myself a designer. What I try to do is have a formula for making things look good. I focus on design in this order: spacing, box properties, typography, fun element to pop. We'll talk about this all throughout the course.
Tailwind comes with so many classes. It doesn't make sense to send all of those to our users' browsers. With PostCSS and PurgeCSS, we can shrink the amount of CSS we send to our users. We'll learn how to only send the classes that we actually use so that our bundle sizes can drop to even below 10kb!
Tailwind's benefits really shine when you pair it with a JavaScript library/framework. Extracting classes into components is the recommended way to keep Tailwind DRY (don't repeat yourself). While we could use the @apply() or theme() functions, it forgoes some of the benefits of Tailwind. Namely we are once again creating a custom class and CSS.
Tailwind is easily configurable for our own projects using the tailwind.js config file. We'll explore changing out fonts, colors, sizes, and more so that our Tailwind setups are custom and tailored to our projects.
These components are things you'll have to create in every project.
75 videos at a smooth pace
9.25 hours of learning + building
Source code and CodePens
Use the code in your projects
Access to Discord for support
Lifetime refund guarantee
Yup! You get 50% of every sale that you bring in. You can sign up for a course and turn on affiliate mode from your dashboard at learn.better.dev. Or you can email me at<EMAIL_ADDRESS>This course is aimed at people that have some CSS knowledge and want to learn Tailwind. I do talk through CSS concepts and why we're using certain classes all throughout the course so you don't need to be a CSS expert.
Definitely! All of the code in this course is yours to use in your sites, apps, projects, whatever.
You can login at learn.better.dev. Use the login button in the top right.
I offer a lifetime refund policy. If you ever feel like you didn't gain value from this course, then you can request a refund from your course dashboard (totally automated process, no questions asked).
Yup! 50% off! Email me at<EMAIL_ADDRESS>with your student id and I'll send you a discount code.


NPI provides topographic maps of Svalbard and Jan Mayen served at
geodata.npolar.no/arcgis/rest/services.
These maps can be consumed through various client applications such as
ArcGIS API for JavaScript, Google Maps API, OpenLayers etc. to easily
create a mapping application.
This documentation shows how to quickly setup and develop an interactive
web map application for the Svalbard region using ArcGIS API for
Javascript, including adding place name search, working with map
overlays and popups and dealing with map services. The ArcGIS API for
JavaScript is a lightweight way to embed maps and tasks in web
applications similar to Google Maps API with more advanced
functionalities, such as geoprocessing, network analysis and data
editing.
Audience
This documentation is designed with the assumption that you are familiar
with basic JavaScript programming and mapping concepts (such as Google
Maps). It's also desirable if you make yourself familiar with Esri's
ArcGIS API for Javascript
to take full advantage of the mapping API.
Setting The Map
The easiest way to setup a map of Svalbard using ArcGIS API for
JavaScript is to see a simple example. The following html page displays
a map of Svalbard centered around Longyearbyen:
There are a few steps to follow in order to initialize a map in your web
application:
Setup an HTML document and include esri.css style sheet in the head
section of the document to have styles and various widgets for the
map.
Add reference to the ArcGIS API for Javascript which loads all
symbols and definitions needed for using the API.
Create a div element with a certain id to hold the map. The size
of the map is specified in the style attribute of the div.
Use another script tag to load the mapping modules from ArcGIS
JavaScript API using the dojo.require() function. The initialize
function creates a map instance using the esri.Map module and
connects it with the DIV element created above by referencing it
using the "map" id.
Add a topographic basemap of Svalbard to the map by providing the cached
map service REST URI.
Finally, instruct the API to only execute the initialize() function after
dependencies are fully loaded and the DOM is read, by passing
dojo.ready(). That's it! You now have a working map of Svalbard.
Map Options
At this stage, you didn't pass any optional parameters when creating the
map instance and therefore the map is loaded with the default extent and
zoom level.
Because we often want to center the map on a specific area, create an
initialExtent object to hold the starting extent of the map and add it
to the map instance created above. Use the extent Helper
to create your desired map extent coordinates in JSON.
var intialExtent = new esri.geometry.Extent ({
"Xmin": 477423.89,
"Ymin": 8663685.98,
"Xmax": 553624.05,
"Ymax": 8714486.09,
"spatialReference": {"wkid":25833}
});
// create map instance and add a basemap
var map = new esri.Map("map" {extent: initialExtent});
By default the Esri logo is drawn to the bottom right of the map which
can be turned off by:
var map = new esri.Map("map" {extent: initialExtent, logo: false});
Geocoding Service (search place name)
Norwegian Polar Institute provides the place names API
for looking up place names dynamically from user input. The search results can be used to convert
place names (e.g "Longyearbyen") into geographic coordinates (e.g.
latitude 78.22223 and longitude 15.631533), which you can use to place
markers or position the map.
Autocomplete place names
The YUI autocomplete library
is used to dynamically search for place names as the user types in the input field.
As text is entered, the autocomplete returns place name predictions to
the application in the form of a drop-down pick list which can be used
to help users find and zoom to a specific location.
Requirements: Make sure you add reference the YUI library before
creating the autocomplete instance.
Next, create a new YUI instance for your application and populate it
with the required modules by specifying them as arguments to the
YUI().use() method.
You can use the placenames API within your code as results source via
the http://placenames.npolar.no:80 URL. The results source contains
the input terms and a callback method to execute upon receipt of the
response.
The JSON response is an object in the following form:
{
location: "Svalbard",
title: "Longyearbyen",
terrain: "Bustad",
approved: true,
ident: "8560",
north: 78.22223,
link: "/stadnamn/Longyearbyen?ident=8560",
east: 15.631533,
newer_ident: ""
}
The fields are explained in the place names API.
These fields can also be passed as parameter to narrow the search results.
The example below restricts your autocomplete results to place names
that are approved and within Svalbard:
The last function zooms and adds a graphic marker to the map when a user
selects a place name from the result.
Finally, create a div element above the map div to hold the search
form and add an input element with the geoname_autocomplete id
referenced in the YUI instance.
Map Overlays
Adding Graphics
The ArcGIS JavaScript API also alows to add or draw graphics such as
markers, polylines, polygons, and popups into your map. Those objects
have location coordinates tied to them so that they can move when
zooming or panning the map.
You can create and add a point, polyline, or polygon using the
esri.Graphic object.
When adding graphics to the map, you need to wait for the map to load
first. This can be done by adding a function that runs after the map
finishes loading using the dojo.connect() event handler. The example
below adds a simple point around Longyearbyen where the geometry is set
using esri.geometry.Point(). The coordinates used to create the point
geometry in this sample are in UTM33.
Similar method can be used to create lines, polylines, and polygons.
Drawing on map
If you would like the users to draw a points, lines, or polygons on the
screen and capture that geometry, the easiest is to use Draw toolbar of ArCGIS API for Javascript -
see Esri documentation for details.
Map Service Layers
Norwegian Polar Institute provides various dynamic thematic map services
that can easily be overlayed on the top basemaps. You can use the map
Services Directory to
discover the available map services. Dynamic map services are more flexible than
cached services by providing the user options such as turn on and off layers in the
service, change layer transparency, freely adjust the scale, retrieve layer info
and legend, etc.
To create dynamic layer to a map, you only need to call the
esri.layers.ArcGISDynamicMapServiceLayer() constructor pointing to the
URL of service's REST endpoint (e.g. http://geodata.npolar.no/ArcGIS/rest/services/inspire3/Sjofuglkolonier/MapServer).
//Use the ImageParameters to set the visible layers in the map service during ArcGISDynamicMapServiceLayer construction.
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "png32"; //sets the image format to PNG32.
imageParameters.layerIds = [0]; // we want the layer with id 0 to be visible
imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW;
//Takes a URL to a dynamic map service.
serviceURL = "//geodata.npolar.no/ArcGIS/rest/services/inspire3/Sjofuglkolonier/MapServer";
var dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer(serviceURL, {
"opacity":0.75,
"imageParameters":imageParameters
});
map.addLayer(dynamicLayer);
The above code creates a layer from a dynamic ArcGIS Server map service. The following arguments were passed to the
ArcGISDynamicMapServiceLayer
constructor in order to create the layer:
The URL of the map service. The URL provided in this sample is the Seabird colonies map of Svalbard.
Optional parameters to specify the image format (png, jpg, png32 etc).
An opacity setting that determines the transparency of the layer which is between 0 and 1.
Finally, you need to add that dynamic layer on top of the basemap by calling the map's addLayer() method.


| I l@ve RuBoard |
10.3 Socket ProgrammingNow that we've seen how sockets figure into the Internet picture, let's move on to explore the tools that Python provides for programming sockets with Python scripts. This section shows you how to use the Python socket interface to perform low-level network communications; in later chapters, we will instead use one of the higher-level protocol modules that hide underlying sockets. The basic socket interface in Python is the standard library's socket module. Like the os POSIX module, Python's socket module is just a thin wrapper (interface layer) over the underlying C library's socket calls. Like Python files, it's also object-based: methods of a socket object implemented by this module call out to the corresponding C library's operations after data conversions. The socket module also includes tools for converting bytes to a standard network ordering, wrapping socket objects in simple file objects, and more. It supports socket programming on any machine that supports BSD-style sockets -- MS Windows, Linux, Unix, etc. -- and so provides a portable socket interface. 10.3.1 Socket BasicsTo create a connection between machines, Python programs import the socket module, create a socket object, and call the object's methods to establish connections and send and receive data. Socket object methods map directly to socket calls in the C library. For example, the script in Example 10-1 implements a program that simply listens for a connection on a socket, and echoes back over a socket whatever it receives through that socket, adding 'Echo=>' string prefixes. Example 10-1. PP2E\Internet\Sockets\echo-server.py######################################################### # Server side: open a socket on a port, listen for # a message from a client, and send an echo reply; # this is a simple one-shot listen/reply per client, # but it goes into an infinite loop to listen for # more clients as long as this server script runs; ######################################################### from socket import * # get socket constructor and constants myHost = '' # server machine, '' means local host myPort = 50007 # listen on a non-reserved port number sockobj = socket(AF_INET, SOCK_STREAM) # make a TCP socket object sockobj.bind((myHost, myPort)) # bind it to server port number sockobj.listen(5) # listen, allow 5 pending connects while 1: # listen until process killed connection, address = sockobj.accept() # wait for next client connect print 'Server connected by', address # connection is a new socket while 1: data = connection.recv(1024) # read next line on client socket if not data: break # send a reply line to the client connection.send('Echo=>' + data) # until eof when socket closed connection.close() As mentioned earlier, we usually call programs like this that listen for incoming connections servers because they provide a service that can be accessed at a given machine and port on the Internet. Programs that connect to such a server to access its service are generally called clients. Example 10-2 shows a simple client implemented in Python. Example 10-2. PP2E\Internet\Sockets\echo-client.py############################################################# # Client side: use sockets to send data to the server, and # print server's reply to each message line; 'localhost' # means that the server is running on the same machine as # the client, which lets us test client and server on one # machine; to test over the Internet, run a server on a remote # machine, and set serverHost or argv[1] to machine's domain # name or IP addr; Python sockets are a portable BSD socket # interface, with object methods for standard socket calls; ############################################################# import sys from socket import * # portable socket interface plus constants serverHost = 'localhost' # server name, or: 'starship.python.net' serverPort = 50007 # non-reserved port used by the server message = ['Hello network world'] # default text to send to server if len(sys.argv) > 1: serverHost = sys.argv[1] # or server from cmd line arg 1 if len(sys.argv) > 2: # or text from cmd line args 2..n message = sys.argv[2:] # one message for each arg listed sockobj = socket(AF_INET, SOCK_STREAM) # make a TCP/IP socket object sockobj.connect((serverHost, serverPort)) # connect to server machine and port for line in message: sockobj.send(line) # send line to server over socket data = sockobj.recv(1024) # receive line from server: up to 1k print 'Client received:', `data` sockobj.close() # close socket to send eof to server <IP_ADDRESS> Server socket callsBefore we see these programs in action, let's take a minute to explain how this client and server do their stuff. Both are fairly simple examples of socket scripts, but they illustrate common call patterns of most socket-based programs. In fact, this is boilerplate code: most socket programs generally make the same socket calls that our two scripts do, so let's step through the important points of these scripts line by line. Programs such as Example 10-1 that provide services for other programs with sockets generally start out by following this sequence of calls:
At this point, the server is ready to accept connection requests from client programs running on remote machines (or the same machine), and falls into an infinite loop waiting for them to arrive:
Once we have a client connection, we fall into another loop to receive data from the client in blocks of 1024 bytes at a time, and echo each block back to the client:
After talking with a given client, the server goes back to its infinite loop, and waits for the next client connection request. <IP_ADDRESS> Client socket callsOn the other hand, client programs like the one shown in Example 10-2 follow simpler call sequences. The main thing to keep in mind is that the client and server must specify the same port number when opening their sockets, and the client must identify the machine on which the server is running (in our scripts, server and client agree to use port number 50007 for their conversation, outside the standard protocol range):
Once the client establishes a connection to the server, it falls into a loop sending a message one line at a time and printing whatever the server sends back after each line is sent:
And that's it. The server exchanges one or more lines of text with each client that connects. The operating system takes care of locating remote machines, routing bytes sent between programs across the Internet, and (with TCP) making sure that our messages arrive intact. That involves a lot of processing, too -- our strings may ultimately travel around the world, crossing phone wires, satellite links, and more along the way. But we can be happily ignorant of what goes on beneath the socket call layer when programming in Python.
<IP_ADDRESS> Running socket programs locallyOkay, let's put this client and server to work. There are two ways to run these scripts -- either on the same machine or on two different machines. To run the client and the server on the same machine, bring up two command-line consoles on your computer, start the server program in one, and run the client repeatedly in the other. The server keeps running and responds to requests made each time you run the client script in the other window. For instance, here is the text that shows up in the MS-DOS console window where I've started the server script: C:\...\PP2E\Internet\Sockets>python echo-server.py Server connected by ('<IP_ADDRESS>', 1025) Server connected by ('<IP_ADDRESS>', 1026) Server connected by ('<IP_ADDRESS>', 1027) The output here gives the address (machine IP name and port number) of each connecting client. Like most servers, this one runs perpetually, listening for client connection requests. This one receives three, but I have to show you the client window's text for you to understand what this means: C:\...\PP2E\Internet\Sockets>python echo-client.py Client received: 'Echo=>Hello network world' C:\...\PP2E\Internet\Sockets>python echo-client.py localhost spam Spam SPAM Client received: 'Echo=>spam' Client received: 'Echo=>Spam' Client received: 'Echo=>SPAM' C:\...\PP2E\Internet\Sockets>python echo-client.py localhost Shrubbery Client received: 'Echo=>Shrubbery' Here, I ran the client script three times, while the server script kept running in the other window. Each client connected to the server, sent it a message of one or more lines of text, and read back the server's reply -- an echo of each line of text sent from the client. And each time a client is run, a new connection message shows up in the server's window (that's why we got three). It's important to notice that clients and server are running on the same machine here (a Windows PC). The server and client agree on port number, but use machine names "" and "localhost" respectively, to refer to the computer that they are running on. In fact, there is no Internet connection to speak of. Sockets also work well as cross-program communications tools on a single machine. <IP_ADDRESS> Running socket programs remotelyTo make these scripts talk over the Internet instead of on a single machine, we have to do some extra work to run the server on a different computer. First, upload the server's source file to a remote machine where you have an account and a Python. Here's how I do it with FTP; your server name and upload interface details may vary, and there are other ways to copy files to a computer (e.g., email, web-page post forms, etc.):[3]
C:\...\PP2E\Internet\Sockets>ftp starship.python.net Connected to starship.python.net. User (starship.python.net:(none)): lutz 331 Password required for lutz. Password: 230 User lutz logged in. ftp> put echo-server.py 200 PORT command successful. 150 Opening ASCII mode data connection for echo-server.py. 226 Transfer complete. ftp: 1322 bytes sent in 0.06Seconds 22.03Kbytes/sec. ftp> quit Once you have the server program loaded on the other computer, you need to run it there. Connect to that computer and start the server program. I usually telnet into my server machine and start the server program as a perpetually running process from the command line.[4] The & syntax in Unix/Linux shells can be used to run the server script in the background; we could also make the server directly executable with a #! line and a chmod command (see Chapter 2, for details). Here is the text that shows up in a Window on my PC that is running a Telnet session connected to the Linux server where I have an account (less a few deleted informational lines):
C:\...\PP2E\Internet\Sockets>telnet starship.python.net Red Hat Linux release 6.2 (Zoot) Kernel 2.2.14-5.0smp on a 2-processor i686 login: lutz Password: [lutz@starship lutz]$ python echo-server.py & [1] 4098 Now that the server is listening for connections on the Net, run the client on your local computer multiple times again. This time, the client runs on a different machine than the server, so we pass in the server's domain or IP name as a client command-line argument. The server still uses a machine name of "" because it always listens on whatever machine it runs upon. Here is what shows up in the server's Telnet window: [lutz@starship lutz]$ Server connected by ('<IP_ADDRESS>', 1037) Server connected by ('<IP_ADDRESS>', 1040) Server connected by ('<IP_ADDRESS>', 1043) Server connected by ('<IP_ADDRESS>', 1050) And here is what appears in the MS-DOS console box where I run the client. A "connected by" message appears in the server Telnet window each time the client script is run in the client window: C:\...\PP2E\Internet\Sockets>python echo-client.py starship.python.net Client received: 'Echo=>Hello network world' C:\...\PP2E\Internet\Sockets>python echo-client.py starship.python.net ni Ni NI Client received: 'Echo=>ni' Client received: 'Echo=>Ni' Client received: 'Echo=>NI' C:\...\PP2E\Internet\Sockets>python echo-client.py starship.python.net Shrubbery Client received: 'Echo=>Shrubbery' C:\...\PP2E\Internet\Sockets>ping starship.python.net Pinging starship.python.net [<IP_ADDRESS>] with 32 bytes of data: Reply from <IP_ADDRESS>: bytes=32 time=311ms TTL=246 ctrl-C C:\...\PP2E\Internet\Sockets>python echo-client.py <IP_ADDRESS> Does she? Client received: 'Echo=>Does' Client received: 'Echo=>she?' The "ping" command can be used to get an IP address for a machine's domain name; either machine name form can be used to connect in the client. This output is perhaps a bit understated -- a lot is happening under the hood. The client, running on my Windows laptop, connects with and talks to the server program running on a Linux machine perhaps thousands of miles away. It all happens about as fast as when client and server both run on the laptop, and it uses the same library calls; only the server name passed to clients differs. <IP_ADDRESS> Socket pragmaticsBefore we move on, there are three practical usage details you should know. First of all, you can run the client and server like this on any two Internet-aware machines where Python is installed. Of course, to run clients and server on different computers, you need both a live Internet connection and access to another machine on which to run the server. You don't need a big, expensive Internet link, though -- a simple modem and dialup Internet account will do for clients. When sockets are opened, Python is happy to use whatever connectivity you have, be it a dedicated T1 line, or a dialup modem account. On my laptop PC, for instance, Windows automatically dials out to my ISP when clients are started or when Telnet server sessions are opened. In this book's examples, server-side programs that run remotely are executed on a machine called starship.python.net. If you don't have an account of your own on such a server, simply run client and server examples on the same machine, as shown earlier; all you need then is a computer that allows sockets, and most do. Secondly, the socket module generally raises exceptions if you ask for something invalid. For instance, trying to connect to a nonexistent server (or unreachable servers, if you have no Internet link) fails: C:\...\PP2E\Internet\Sockets>python echo-client.py www.nonesuch.com hello Traceback (innermost last): File "echo-client.py", line 24, in ? sockobj.connect((serverHost, serverPort)) # connect to server machine... File "<string>", line 1, in connect socket.error: (10061, 'winsock error') Finally, also be sure to kill the server process before restarting it again, or else the port number will be still in use, and you'll get another exception: [lutz@starship uploads]$ ps -x PID TTY STAT TIME COMMAND 5570 pts/0 S 0:00 -bash 5570 pts/0 S 0:00 -bash 5633 pts/0 S 0:00 python echo-server.py 5634 pts/0 R 0:00 ps -x [lutz@starship uploads]$ python echo-server.py Traceback (most recent call last): File "echo-server.py", line 14, in ? sockobj.bind((myHost, myPort)) # bind it to server port number socket.error: (98, 'Address already in use') Under Python 1.5.2, a series of Ctrl-C's will kill the server on Linux (be sure to type fg to bring it to the foreground first if started with an &): [lutz@starship uploads]$ python echo-server.py ctrl-c Traceback (most recent call last): File "echo-server.py", line 18, in ? connection, address = sockobj.accept() # wait for next client connect KeyboardInterrupt A Ctrl-C kill key combination won't kill the server on my Windows machine, however. To kill the perpetually running server process running locally on Windows, you may need to type a Ctrl-Alt-Delete key combination, and then end the Python task by selecting it in the process listbox that appears. You can usually also kill a server on Linux with a kill -9 pid shell command if it is running in another window or in the background, but Ctrl-C is less typing. <IP_ADDRESS> Spawning clients in parallelTo see how the server handles the load, let's fire up eight copies of the client script in parallel using the script in Example 10-3 (see the end of Chapter 3, for details on the launchmodes module used here to spawn clients). Example 10-3. PP2E\Internet\Sockets\testecho.pyimport sys, string from PP2E.launchmodes import QuietPortableLauncher numclients = 8 def start(cmdline): QuietPortableLauncher(cmdline, cmdline)() # start('echo-server.py') # spawn server locally if not yet started args = string.join(sys.argv[1:], ' ') # pass server name if running remotely for i in range(numclients): start('echo-client.py %s' % args) # spawn 8? clients to test the server To run this script, pass no arguments to talk to a server listening on port 50007 on the local machine; pass a real machine name to talk to a server running remotely. On Windows, the clients' output is discarded when spawned from this script: C:\...\PP2E\Internet\Sockets>python testecho.py C:\...\PP2E\Internet\Sockets>python testecho.py starship.python.net If the spawned clients connect to a server run locally, connection messages show up in the server's window on the local machine: C:\...\PP2E\Internet\Sockets>python echo-server.py Server connected by ('<IP_ADDRESS>', 1283) Server connected by ('<IP_ADDRESS>', 1284) Server connected by ('<IP_ADDRESS>', 1285) Server connected by ('<IP_ADDRESS>', 1286) Server connected by ('<IP_ADDRESS>', 1287) Server connected by ('<IP_ADDRESS>', 1288) Server connected by ('<IP_ADDRESS>', 1289) Server connected by ('<IP_ADDRESS>', 1290) If the server is running remotely, the client connection messages instead appear in the window displaying the Telnet connection to the remote computer: [lutz@starship lutz]$ python echo-server.py Server connected by ('<IP_ADDRESS>', 1301) Server connected by ('<IP_ADDRESS>', 1302) Server connected by ('<IP_ADDRESS>', 1308) Server connected by ('<IP_ADDRESS>', 1309) Server connected by ('<IP_ADDRESS>', 1313) Server connected by ('<IP_ADDRESS>', 1314) Server connected by ('<IP_ADDRESS>', 1307) Server connected by ('<IP_ADDRESS>', 1312) Keep in mind, however, that this works for our simple scripts only because the server doesn't take a long time to respond to each client's requests -- it can get back to the top of the server script's outer while loop in time to process the next incoming client. If it could not, we would probably need to change the server to handle each client in parallel, or some might be denied a connection. Technically, client connections would fail after five clients are already waiting for the server's attention, as specified in the server's listen call. We'll see how servers can handle multiple clients robustly in the next section. <IP_ADDRESS> Talking to reserved portsIt's also important to know that this client and server engage in a proprietary sort of discussion, and so use a port number 50007 outside the range reserved for standard protocols (0-1023). There's nothing preventing a client from opening a socket on one of these special ports, however. For instance, the following client-side code connects to programs listening on the standard email, FTP, and HTTP web server ports on three different server machines: C:\...\PP2E\Internet\Sockets>python >>> from socket import * >>> sock = socket(AF_INET, SOCK_STREAM) >>> sock.connect(('mail.rmi.net', 110)) # talk to RMI POP mail server >>> print sock.recv(40) +OK Cubic Circle's v1.31 1998/05/13 POP3 >>> sock.close() >>> sock = socket(AF_INET, SOCK_STREAM) >>> sock.connect(('www.python.org', 21)) # talk to Python FTP server >>> print sock.recv(40) 220 python.org FTP server (Version wu-2. >>> sock.close() >>> sock = socket(AF_INET, SOCK_STREAM) >>> sock.connect(('starship.python.net', 80)) # starship HTTP web server >>> sock.send('GET /\r\n') # fetch root web page 7 >>> sock.recv(60) '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\012<HTM' >>> sock.recv(60) 'L>\012 <HEAD>\012 <TITLE>Starship Slowly Recovering</TITLE>\012 </HE' If we know how to interpret the output returned by these ports' servers, we could use raw sockets like this to fetch email, transfer files, and grab web pages and invoke server-side scripts. Fortunately, though, we don't have to worry about all the underlying details -- Python's poplib, ftplib, httplib, and urllib modules provide higher-level interfaces for talking to servers on these ports. Other Python protocol modules do the same for other standard ports (e.g., NNTP, Telnet, and so on). We'll meet some of these client-side protocol modules in the next chapter.[5]
By the way, it's okay to open client-side connections on reserved ports like this, but you can't install your own server-side scripts for these ports unless you have special permission: [lutz@starship uploads]$ python >>> from socket import * >>> sock = socket(AF_INET, SOCK_STREAM) >>> sock.bind(('', 80)) Traceback (most recent call last): File "<stdin>", line 1, in ? socket.error: (13, 'Permission denied') Even if run by a user with the required permission, you'll get the different exception we saw earlier if the port is already being used by a real web server. On computers being used as general servers, these ports really are reserved. |
| I l@ve RuBoard |


--- title: "Resistant Starch Ameliorates Advanced Glycation Endproduct-Induced Albuminuria ina Mouse Model of Type 2 Diabetes" draft: false authors: [] event: '15th Asian Pacific Congress of Nephrology & 52nd Australian and New Zealand Society of Nephrology ASM' event_url: https://apcn2016.com.au/ location: Perth, Australia summary: "15th Asian Pacific Congress of Nephrology & 52nd Australian and New Zealand Society of Nephrology ASM" # Talk start and end times. # End time can optionally be hidden by prefixing the line with `#`. date: "2016-09-18T08:00:00Z" #date_end: "2019-10-02T12:00:00Z" all_day: true publishdate: "2016-09-18" links: - icon: file-alt icon_pack: fa name: Published Abstract url: "pdf/conference/2016_ANZSN.pdf" categories: # - talks tags: - advanced glycation endproducts - resistant starch lastmod: '2019-06-16T02:20:01-07:00' featured: no image: caption: "" focal_point: "" preview_only: no projects: [] ---
Aim: To investigate whether excess consumption of dietary advanced glycation endproducts (AGEs) cause gut dysbiosis, exacerbating renal injury in a type 2 diabetes model.
Background: Long-term excess intake of dietary AGEs contributes to chronic renal injury. Recent research implicates gut dysbiosis in the progression of diabetic nephropathy. However, the role of dietary AGEs in gut dysbiosis and renal dysfunction in the context of diabetes has not yet been explored.
Methods: Six week old diabetic (db/db) and non-diabetic (db/h) mice were randomised (n=12/group) to receive a low AGE (LAGE, unbaked rodent chow) or a high AGE diet (HAGE, baked at 160°C for 1 hour), with or without resistant starch (RS) for 10 weeks. 24-hour urine was collected for the assessment of albuminuria. Intestinal permeability was assessed in-vivo by the clearance of FITC-labelled dextran (500mg/kg body weight).
Results: The high AGE diet exacerbated albuminuria in db/db mice (874.4±154.8 vs 536.2±96.53µg/24h, P<0.05, db/db HAGE vs db/db LAGE), and this AGE-induced increase in albuminuria was attenuated by RS (874.4±154.8 vs 515.5±71.88µg/24h, P<0.05, db/db HAGE vs db/db HAGE + RS). Db/db mice had greater gut permeability compared to db/h mice (2.38±0.32 vs 1.05±0.11µg/ml, P<0.01, db/db LAGE vs db/h LAGE). Furthermore, the high AGE diet tended to increase gut permeability of db/db mice (3.43±0.43 vs 2.38±0.32µg/ml, P=0.06, db/db HAGE vs db/db LAGE), an effect not observed in RS-fed db/db mice.
Conclusions: A high AGE diet led to increased intestinal permeability, which was associated with worsening albuminuria in db/db mice. Resistant starch was protective against high AGE induced albuminuria in db/db mice. These preliminary studies support the notion that dietary AGEs contribute to renal disease via alterations in gut homeostasis.


|
Lua-API++
2015-02-12-3
Lua-API++ library
|
Valset is an STL-compatible container for contiguous Lua stack slots. Its primary use is accepting multiple return values. More...
Inherits noNew.
Public Types | |
| typedef Valref | value_type |
| The Valref objects are not actually stored, but rather created dynamically. | |
| typedef size_t | size_type |
| Index type. | |
| typedef std::ptrdiff_t | difference_type |
| Index difference. | |
| typedef valset_iterator | iterator |
| Normal iterator. | |
| typedef valset_const_iterator | const_iterator |
| Const iterator. | |
| typedef std::reverse_iterator< iterator > | reverse_iterator |
| Reverse iterator. | |
| typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
| Reverse const iterator. | |
| typedef value_type | reference |
| Reference to a value is still a Valref. | |
| typedef const value_type | const_reference |
| Const reference doesn't strictly enforce immutability. | |
Public Member Functions | |
Life cycle | |
| Valset (Temporary src) | |
| Construct from an expression. More... | |
| Valset (const Valref &src) | |
| Copy a value into set (works with Value and Table too). | |
| Valset (Valset &&) | |
| Valset can be returned from functions but not actually moved. | |
| Valset (Context &s) noexcept | |
| Create an empty Valset. More... | |
| Valset (const Valset &src) noexcept | |
| Create copies of values stored in src. | |
| ~Valset () noexcept | |
| Owned stack slots are freed on destruction. | |
Element access | |
| reference | at (size_t index) |
| Checked indexation. More... | |
| const_reference | at (size_t index) const |
| Checked indexation. More... | |
| const_reference | operator[] (size_t index) const noexcept |
| Unchecked indexation. | |
| reference | operator[] (size_t index) noexcept |
| Unchecked indexation. | |
Iterators | |
| iterator | begin () noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | cbegin () const noexcept |
| iterator | end () noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cend () const noexcept |
| reverse_iterator | rbegin () noexcept |
| const_reverse_iterator | rbegin () const noexcept |
| const_reverse_iterator | crbegin () const noexcept |
| reverse_iterator | rend () noexcept |
| const_reverse_iterator | rend () const noexcept |
| const_reverse_iterator | crend () const noexcept |
Capacity | |
| size_t | size () const noexcept |
| Amount of stored values. | |
| bool | empty () const noexcept |
| Check if the container is empty. | |
Modification | |
| template<typename... Types> | |
| void | push_back (Types &&...values) |
| Add values to the end. More... | |
| void | pop_back (size_t amount=1) |
| Remove a value from the end. More... | |
Status query | |
| bool | success () const noexcept |
| Protected call status. More... | |
| bool | isBlocked () const noexcept |
| Blocked status. More... | |
Valset is an STL-compatible container for contiguous Lua stack slots. Its primary use is accepting multiple return values.
This object owns arbitrary number of neighbouring stack slots. It is STL compatible, so it's possible to use standard algorithms with it (also things like back_inserter, range-based for and so on). The values are accessed by indexation with integer indices or through iterators which dereference to Valref.
This class is designed for following uses:
If no values are placed on the stack after the Valset, it is unblocked, which means that new value can be added to its end with push_back, or the last value be removed with pop_back function. Otherwise the Valset is in "blocked" state and cannot be grown or shrunk.
On object's destruction all owned slots are freed (unless it is used to return values from the function).
When put inside value sequence (like function arguments or array content), Valset automatically expands into contained values. But Valset cannot be used in a place that requires single value (like index).
Construct from an expression.
The created Valset will have 1 element inside.
If the expression was a function call that returned multiple values, the Valset will contain all returned values.
If the expression was a protected function call which ended succesfully, the Valset will contain all returned values.
Unsuccesfull protected call will put into Valset error description and the success status will be "false".
|
inline |
Checked indexation.
| std::range | error |
|
inline |
Checked indexation.
| std::range | error |
| void push_back | ( | Types &&... | values | ) |
| void pop_back | ( | size_t | amount = 1 | ) |
|
inlinenoexcept |


The blockchain is an open and transparent public ledger that contains record of every tranasction included into it. Block explorers are the services, helping you track a transaction and giving valuable information on the overall state of the network.
A block explorer represents a website for viewing blockchain and checking transactions. It provides you with all necessary information on any transactions, including it's status and confirmation time.
These data can be found on a Block explorer:
The functions of blockchain explorers vary from service to service. For example, Blockchain.info, in addition to standard options, provides statistics and graphs of indicators of the Bitcoin network.
After making the transaction hash appears in the wallet. Click on the hash to see your transaction on the block explorer.
To check specific transactions from your own wallet or any other address just search for it using block explorer website.
Most likely, if you instantly visit Block Explorer right after sending money, you will see the phrase “Unconfirmed Transaction”. This means your transaction is waiting to be to be approved by miners and included in the blockchain.
At this moment you just need to wait till it gets enough confirmations. Once confirmed its status will change to the “Successfull Transaction”. If you need to send your funds faster - increase network fees.
1. When you need to send money a transaction should be made at first. If you use Atomic Wallet all transactions created locally with your private key and then broadcasted to the node.
2. Node is a server that has a full record of transactions on the blockchain. Once your transaction comes to the node, it’s automatically added to the mempool.
3. Mempool is a pool of transactions waiting to be confirmed. It is like a truck with goods waited to be carried out to its final destination.
4. If other nodes see your transaction it will be also visible on the block explorer with a status “Unconfirmed or Pending Transaction”.
5. The next step: Miners approve your transaction. They just pick it up from the mempool and include it in a block. The block added to the blockchain and your money gets automatically transferred to the other address.
6. The full process for Bitcoin Blockchain often takes 10-30 minutes to get transaction included into the block. After it, you will see on a block explorer that the transaction status changed to “Confirmed”.
Pending Transaction - Transactions waiting to be approved by miners and added to the block.
Successful Transaction - Transaction that has been successfully added to the block.
Rejected transaction - transaction with such low fees that miners will not add it to the blockchain. It will not be visible on the blockchain. All you need to do in this case is resend funds using regular fees.
The recipient address is the address you send funds to.
The Sender address is your address from which you send funds.
You can quickly check the way network handles transactions by looking at the size of the memory. This is an indicator of the remaining work - transactions awaiting inclusion in the block. As the mempool grows, it means the network is full, and transaction may have to wait longer. In addition, network fees will increase.
Is the number of blocks in the chain, counted between the last one and the first one.
Block explorer is a useful tool that helps you determine the state of your transaction and estimate arrival time. This tool allows you to track any cryptocurrency at any time. All you need is to input a hash or your wallet address in a search field. Remember that all your funds are safe on a blockchain! You can always track them in a block explorer.