Popular recipes tagged "network" but not "file_share"http://code.activestate.com/recipes/tags/network-file_share/2016-07-07T17:52:15-07:00ActiveState Code RecipesPrint Directly from web application to POS/EPS thermal printer (PHP) 2014-09-01T14:55:56-07:00imam feriantohttp://code.activestate.com/recipes/users/633541/http://code.activestate.com/recipes/578925-print-directly-from-web-application-to-poseps-ther/ <p style="color: grey"> PHP recipe 578925 by <a href="/recipes/users/633541/">imam ferianto</a> (<a href="/recipes/tags/kasir/">kasir</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/over/">over</a>, <a href="/recipes/tags/php/">php</a>, <a href="/recipes/tags/pos/">pos</a>, <a href="/recipes/tags/printer/">printer</a>, <a href="/recipes/tags/tiketing/">tiketing</a>). Revision 2. </p> <p>this php script will printout barcode label directly from the web by phpscript</p> Installed Modules (Perl) 2015-07-17T04:18:15-07:00Roger Mbiama Assogohttp://code.activestate.com/recipes/users/4178746/http://code.activestate.com/recipes/579084-installed-modules/ <p style="color: grey"> Perl recipe 579084 by <a href="/recipes/users/4178746/">Roger Mbiama Assogo</a> (<a href="/recipes/tags/application/">application</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/network/">network</a>). </p> <p>Additional Perl modules are installed on the server (aside from the standard libraries) run from a web broswer.</p> Wait for network service to appear (Python) 2014-11-06T07:29:12-08:00Mohammad Taha Jahangirhttp://code.activestate.com/recipes/users/4188847/http://code.activestate.com/recipes/578955-wait-for-network-service-to-appear/ <p style="color: grey"> Python recipe 578955 by <a href="/recipes/users/4188847/">Mohammad Taha Jahangir</a> (<a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/socket/">socket</a>). </p> <p>This script allows you to wait until specified port is opened on remote server. This can be useful in automation jobs - restarting server, wake on lan etc. It can also be used for monitoring distant service/site.</p> <p>The main problem that this script solves is that you need to handle two different timeouts when opening probing socket, and it is not described in python documentation. See <a href="http://bugs.python.org/issue5293" rel="nofollow">http://bugs.python.org/issue5293</a> for more information.</p> Teach your computer a few tricks (Python) 2014-09-11T06:25:14-07:00Alexander Pletzerhttp://code.activestate.com/recipes/users/4190754/http://code.activestate.com/recipes/578932-teach-your-computer-a-few-tricks/ <p style="color: grey"> Python recipe 578932 by <a href="/recipes/users/4190754/">Alexander Pletzer</a> (<a href="/recipes/tags/anl/">anl</a>, <a href="/recipes/tags/back/">back</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/neural/">neural</a>, <a href="/recipes/tags/propagation/">propagation</a>). </p> <p>Following is an artifical neural network program that takes any number of inputs and any number of hidden layers, and spits out an output. It applies back propagation with regularization to minimize the cost function. A gradient descent algorithm tries to find the minimum of the cost function in the landscape of weights. </p> Read text data from the network port (Python) 2012-12-04T20:17:59-08:00anatoly techtonikhttp://code.activestate.com/recipes/users/4168147/http://code.activestate.com/recipes/578355-read-text-data-from-the-network-port/ <p style="color: grey"> Python recipe 578355 by <a href="/recipes/users/4168147/">anatoly techtonik</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>Here is a way to wait for incoming text on some port and print it to the screen. This is the best technique I could come up with.</p> WebSocket interface (Python) 2012-11-25T16:52:21-08:00Nick Farohttp://code.activestate.com/recipes/users/4184363/http://code.activestate.com/recipes/578348-websocket-interface/ <p style="color: grey"> Python recipe 578348 by <a href="/recipes/users/4184363/">Nick Faro</a> (<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/socket/">socket</a>, <a href="/recipes/tags/websocket/">websocket</a>). Revision 2. </p> <p>This tries its best to be a replacement for the regular <code>socket</code> module.</p> <p>It supports only sending and receiving but should be useful enough.</p> <p>The only real difference should be that you can't specify the number of bytes is received, instead do</p> <pre class="prettyprint"><code>for message in socket.recv(): print(message) </code></pre> <p>Revision 2: Added proper message receiving. Previously it just requested a ton of data. Now it reads 2 bytes, determines the length, then requests that much.</p> Genetic Algorithm in Python source code - AI-Junkie tutorial (Python) 2012-06-19T12:59:13-07:00David Adlerhttp://code.activestate.com/recipes/users/4182015/http://code.activestate.com/recipes/578128-genetic-algorithm-in-python-source-code-ai-junkie-/ <p style="color: grey"> Python recipe 578128 by <a href="/recipes/users/4182015/">David Adler</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/artificial/">artificial</a>, <a href="/recipes/tags/genetic/">genetic</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/neural/">neural</a>, <a href="/recipes/tags/python/">python</a>). Revision 5. </p> <p>A simple genetic algorithm program. I followed this tutorial to make the program <a href="http://www.ai-junkie.com/ga/intro/gat1.html." rel="nofollow">http://www.ai-junkie.com/ga/intro/gat1.html.</a></p> <p>The objective of the code is to evolve a mathematical expression which calculates a user-defined target integer.</p> <hr /> <p>KEY:</p> <p>chromosome = binary list (this is translated/decoded into a protein in the format number --> operator --> number etc, any genes (chromosome is read in blocks of four) which do not conform to this are ignored.</p> <p>protein = mathematical expression (this is evaluated from left to right in number + operator blocks of two)</p> <p>output = output of protein (mathematical expression)</p> <p>error = inverse of difference between output and target</p> <p>fitness score = a fraction of sum of of total errors</p> <hr /> <p>OTHER:</p> <p>One-point crossover is used.</p> <p>I have incorporated <strong>elitism</strong> in my code, which somewhat deviates from the tutorial but made my code more efficient (top ~7% of population are carried through to next generation)</p> Batch Local Network Messaging System (Batch) 2012-02-03T01:41:41-08:00Alexander James Wallarhttp://code.activestate.com/recipes/users/4179768/http://code.activestate.com/recipes/578028-batch-local-network-messaging-system/ <p style="color: grey"> Batch recipe 578028 by <a href="/recipes/users/4179768/">Alexander James Wallar</a> (<a href="/recipes/tags/alex/">alex</a>, <a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/batch_file/">batch_file</a>, <a href="/recipes/tags/dos/">dos</a>, <a href="/recipes/tags/messaging/">messaging</a>, <a href="/recipes/tags/messenger/">messenger</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/wallar/">wallar</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/wired/">wired</a>, <a href="/recipes/tags/wired_network/">wired_network</a>). Revision 3. </p> <p>This is a Batch Local Messaging System that can be used to send messages between computers that share the same file system.</p> <p>There are three files in the code below. They are separated with dashed lines. There is a comment on the top of each segment of code indicating the file name that the code needs to be saved as. They need to be saved as three separate batch files in the same folder. </p> <p>The first file, MessengerMain.bat will ask you for your name and then an address. The name should be whatever you wish your screen name to be. The address needs to be the path of the FOLDER that is shared between you and the other computer that you are communicating with. Once these pieces of information are entered, two screens will appear. The first is the Sender screen and the other is the Receiver screen. </p> <p>How does it work? The MessengerMain.bat file will create two text files, Name.txt and Address.txt, that will hold your user name and the common folder address. It will then use the START command to run Sender.bat and Receiver.bat. Sender.bat will create a text file named msgtext.txt in the address folder you specified in MessengerMain.bat. If there is already a file of this sort in existence in the address folder, it will overwrite it. Once this file is created, any message you enter will be saved in the msgtext.txt file after the name you entered (%name%: %msg%). Sender.bat the CLS (clears) the screen and asks you for another message continuously. Receiver.bat is very similar. Receiver.bat, first off, reads the Address.txt file and the Name.txt file to find your information given in MessengerMain.bat just like Sender.bat does. It will count the number of lines in the msgtext.txt file and will clear the whole screen and print out the whole contents of the file if the number of lines in msgtext.txt increases. So basically you are writing to a shared file and reading from a shared file. </p> <p>Example:</p> <p>I have a folder called MSGFolder located in the folder as I have my MessengerMain.bat, Receiver.bat, and Sender.bat files. I then run MessengerMain.bat by double clicking on the icon. I enter Alex for my Name and MSGFolder as the Address. I then double click MessengerMain.bat again and enter the name Bob for Name and MSGFolder for Address. Once you do this you can type in either of the Sender.bat interfaces and it will show up as if you are talking. </p> dhcp query (Python) 2011-04-10T15:41:14-07:00hassanehttp://code.activestate.com/recipes/users/4177610/http://code.activestate.com/recipes/577649-dhcp-query/ <p style="color: grey"> Python recipe 577649 by <a href="/recipes/users/4177610/">hassane</a> (<a href="/recipes/tags/dhcp/">dhcp</a>, <a href="/recipes/tags/ipv4/">ipv4</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/querying_dhcp_for_free_ip_address/">querying_dhcp_for_free_ip_address</a>). </p> <p>a simple python script that sends a dhcp discover packet and recieves the dhcp offer that contains a suggested ip address, gateway, dns servers and displays them.</p> Show all the telecommuting jobs from the Python Job Board (Python) 2011-12-09T07:38:28-08:00Victor Yanghttp://code.activestate.com/recipes/users/627255/http://code.activestate.com/recipes/577979-show-all-the-telecommuting-jobs-from-the-python-jo/ <p style="color: grey"> Python recipe 577979 by <a href="/recipes/users/627255/">Victor Yang</a> (<a href="/recipes/tags/html/">html</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/screenscrape/">screenscrape</a>). </p> <p>It is running as a cronjob on a VPS(Virutal Private Server). The output html can be served by any web server. </p> Send an HTML email with embedded image and plain text alternate (Python) 2011-06-12T18:38:14-07:00soham vaghelahttp://code.activestate.com/recipes/users/4178285/http://code.activestate.com/recipes/577751-send-an-html-email-with-embedded-image-and-plain-t/ <p style="color: grey"> Python recipe 577751 by <a href="/recipes/users/4178285/">soham vaghela</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>HTML is the method of choice for those wishing to send emails with rich text, layout and graphics. Often it is desirable to embed the graphics within the message so recipients can display the message directly, without further downloads.</p> <p>Some mail agents don't support HTML or their users prefer to receive plain text messages. Senders of HTML messages should include a plain text message as an alternate for these users.</p> <p>This recipe sends a short HTML message with a single embedded image and an alternate plain text message.</p> Send an HTML email with embedded image and plain text alternate (Python) 2011-06-12T18:38:47-07:00soham vaghelahttp://code.activestate.com/recipes/users/4178285/http://code.activestate.com/recipes/577752-send-an-html-email-with-embedded-image-and-plain-t/ <p style="color: grey"> Python recipe 577752 by <a href="/recipes/users/4178285/">soham vaghela</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>HTML is the method of choice for those wishing to send emails with rich text, layout and graphics. Often it is desirable to embed the graphics within the message so recipients can display the message directly, without further downloads.</p> <p>Some mail agents don't support HTML or their users prefer to receive plain text messages. Senders of HTML messages should include a plain text message as an alternate for these users.</p> <p>This recipe sends a short HTML message with a single embedded image and an alternate plain text message.</p> ASIO Proxy (Python) 2011-04-17T15:08:30-07:00Aaron Riekenberghttp://code.activestate.com/recipes/users/4177692/http://code.activestate.com/recipes/577663-asio-proxy/ <p style="color: grey"> Python recipe 577663 by <a href="/recipes/users/4177692/">Aaron Riekenberg</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>TCP proxy implemented using asio.</p> ASIO (Python) 2011-04-17T15:03:23-07:00Aaron Riekenberghttp://code.activestate.com/recipes/users/4177692/http://code.activestate.com/recipes/577662-asio/ <p style="color: grey"> Python recipe 577662 by <a href="/recipes/users/4177692/">Aaron Riekenberg</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>Asynchronous TCP socket service</p> NBD server in python (Python) 2011-02-08T20:59:23-08:00Dima Tisnekhttp://code.activestate.com/recipes/users/4068698/http://code.activestate.com/recipes/577569-nbd-server-in-python/ <p style="color: grey"> Python recipe 577569 by <a href="/recipes/users/4068698/">Dima Tisnek</a> (<a href="/recipes/tags/analyze/">analyze</a>, <a href="/recipes/tags/block/">block</a>, <a href="/recipes/tags/device/">device</a>, <a href="/recipes/tags/disk/">disk</a>, <a href="/recipes/tags/io/">io</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/nbd/">nbd</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>Linux Network Block Device server in Python</p> <p>This is a simplified version based on Kragen Sitaker's <a href="http://lists.canonical.org/pipermail/kragen-hacks/2004-May/000397.html" rel="nofollow">http://lists.canonical.org/pipermail/kragen-hacks/2004-May/000397.html</a></p> <p>Close is never actually called, at least not on the same connection -- linux C nbd-client -d seems to stall, perhaps it tries to open another socket?</p> <p>This code doesn't check for error conditions, failed reads/writes, past end of disk, etc.</p> <p>It prints io requests, you can analyze filesystem and user program io patterns.</p> Monkey-patch execnet with more ssh settings, port, identity file, non-interactive (Python) 2011-01-15T16:35:00-08:00Dima Tisnekhttp://code.activestate.com/recipes/users/4068698/http://code.activestate.com/recipes/577545-monkey-patch-execnet-with-more-ssh-settings-port-i/ <p style="color: grey"> Python recipe 577545 by <a href="/recipes/users/4068698/">Dima Tisnek</a> (<a href="/recipes/tags/batchmode/">batchmode</a>, <a href="/recipes/tags/execnet/">execnet</a>, <a href="/recipes/tags/identity/">identity</a>, <a href="/recipes/tags/key/">key</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/noninteractive/">noninteractive</a>, <a href="/recipes/tags/port/">port</a>, <a href="/recipes/tags/public/">public</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/ssh/">ssh</a>). </p> <p>execnet ( <a href="http://codespeak.net/execnet/" rel="nofollow">http://codespeak.net/execnet/</a> ) is pretty cool, but its ssh support needs a few tweaks, here they are.</p> <p>This snipped is a monkey patch, not a diff, import it and you can use execnet.makeportgateway instead of makegateway.</p> <p>Adapt to your needs even more!</p> Send an HTML email with embedded image and plain text alternate (Python) 2006-01-29T18:40:36-08:00darrin massenahttp://code.activestate.com/recipes/users/1987292/http://code.activestate.com/recipes/473810-send-an-html-email-with-embedded-image-and-plain-t/ <p style="color: grey"> Python recipe 473810 by <a href="/recipes/users/1987292/">darrin massena</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>HTML is the method of choice for those wishing to send emails with rich text, layout and graphics. Often it is desirable to embed the graphics within the message so recipients can display the message directly, without further downloads.</p> <p>Some mail agents don't support HTML or their users prefer to receive plain text messages. Senders of HTML messages should include a plain text message as an alternate for these users.</p> <p>This recipe sends a short HTML message with a single embedded image and an alternate plain text message.</p> Simplest example of serving a browser request (Python) 2010-10-15T21:17:30-07:00Kaushik Ghosehttp://code.activestate.com/recipes/users/4166965/http://code.activestate.com/recipes/577428-simplest-example-of-serving-a-browser-request/ <p style="color: grey"> Python recipe 577428 by <a href="/recipes/users/4166965/">Kaushik Ghose</a> (<a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/webserver/">webserver</a>). </p> <p>This is the simplest way I have found of sending information from a python program to a browser</p> IP and MAC addresses (Python) 2016-07-07T17:52:15-07:00Jean Brouwershttp://code.activestate.com/recipes/users/2984142/http://code.activestate.com/recipes/577191-ip-and-mac-addresses/ <p style="color: grey"> Python recipe 577191 by <a href="/recipes/users/2984142/">Jean Brouwers</a> (<a href="/recipes/tags/ios/">ios</a>, <a href="/recipes/tags/ip/">ip</a>, <a href="/recipes/tags/ipv4/">ipv4</a>, <a href="/recipes/tags/mac/">mac</a>, <a href="/recipes/tags/macos/">macos</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/python2_4/">python2_4</a>, <a href="/recipes/tags/python3_5/">python3_5</a>, <a href="/recipes/tags/uuid/">uuid</a>, <a href="/recipes/tags/windows/">windows</a>). Revision 3. </p> <p>This module collects all IP and MAC addresses from several available sources on the underlying system. See the module documentation for more details, supported Python releases and platforms.</p> IP address and CIDR mask conversion to network and broadcast (Python) 2010-08-25T21:37:16-07:00Rafael Zanellahttp://code.activestate.com/recipes/users/4165925/http://code.activestate.com/recipes/577375-ip-address-and-cidr-mask-conversion-to-network-and/ <p style="color: grey"> Python recipe 577375 by <a href="/recipes/users/4165925/">Rafael Zanella</a> (<a href="/recipes/tags/cidr/">cidr</a>, <a href="/recipes/tags/ipv4/">ipv4</a>, <a href="/recipes/tags/mask/">mask</a>, <a href="/recipes/tags/network/">network</a>). Revision 2. </p> <p>Convert dotted-quad IPv4 addresses along with CIDR mask to host-byte-order long integer ip, network and broadcast, along with their dotted-quad IPv4 representation.</p>