text
stringlengths
226
34.5k
Output a function in tkinter that prints Question: I have created a function, which takes two arguments, prints multiple statements out and eventually returns an answer. It works great in the python shell. I am using tkinter (python 3.4.1) to create a user friendly program for consumers to use my function. I wish to h...
Sending information gathered from questionnaire to a Python document? Question: I'm brand new to both Python and StackOverflow, and I have a problem that has been stumping me for the past couple of hours. I am making a peer-evaluation script for my high-school class. When you run the script, you input your classmate's...
Python TKinter: Not moving to next frame and not saving variables and radio buttons not saving answers Question: Okay, so the main issues are as follows: I am not able to move from frame three to four all of a sudden; When I have my buttons call the commands, they are not saving the names or checking if the answers are...
write a Python 3 list to .csv Question: I have a list that i need to write to a .csv Yes, i have done a LOT of looking around (of course i found [this link](http://stackoverflow.com/questions/9372705/how-to-write-a-list-to-a-csv- file) which is close to the target, but misses my case) You see `writerows` is having all ...
IntegrityError not caught in SQLAlchemy event listener Question: I'm building a simple database driven blog with Flask and SQLAlchemy. In the model for the blog postings I define title and slug attributes: class BlogPost(Model): ... title = Column(String(80)) slug = Column(String(...
How to unset or disable hyperlinkctrl in wxpython only on some conditions Question: I have created hyperlinkctrl on my panel.Under some conditions it should be hyperlink but other cases it should be just text not link. How to do this? self.Author = wx.HyperlinkCtrl(self, -1, "", "~") if true: ...
Handling argparse conflicts Question: If I import a Python [module](https://github.com/paulcalabro/api- kickstart/blob/master/examples/python/config.py) that is already using **argparse** , however, I would like to use **argparse** in my script as well ...how should I go about doing this? I'm receiving a _unrecognized...
How to check if a date period is embraced by another date period in python? Question: What is the most pythonic way to check if a date period is embraced by another date period in python? for example start_1 = datetime.datetime(2016, 3, 16, 20, 30) end_1 = datetime.datetime(2016, 3, 17, 20, 30) ...
Similar function to to_scipy_sparse_matrix in Julia sparse matrices functions Question: I would like to ask if there is equivalent function in **Julia** language and its [functions](http://docs.julialang.org/en/release-0.3/stdlib/arrays/?highlight=sparse#sparse- matrices) for sparse matrices to [to_scipy_sparse_matrix]...
Python Regex Matching Question: I am inputting a text file (Line)(all strings). I am trying to make card_type to be true so it can enter the if statement, however, it never enters the IF statement. The output that comes out from the print line is: imm48-1gb-sfp/imm48-1gb-sfp imm-2pac-fp3/imm-2pac-fp3...
Compile python module imports Question: I have a problem. I write a python script to make my work faster and now I want to share it with my team. I don't want them to mess with some imports that are missing in the basic python installation. I know there is a way to compile python to exe, but I wonder if I can compile ...
Python inverted dictionaries Question: I'm currently writing a function that takes a dictionary with immutable values and returns an inverted dictionary. So far, my code is getting extremely simple tests right, but it still has some kinks to work out def dict_invert(d): inv_map = {v: k for ...
Error with executing CGI script - writable directory for matplotlib Question: I know that the similar problem was solving in this topic: [Setting Matplotlib MPLCONFIGDIR: consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data](http://stackoverflow.com/questions/9827377/setting-matplotl...
Appending the byte representation of a float to a python bytearray Question: I am using python with ctypes to read an array of bytes and store this in a python bytearray. This array is then transmitted as a UDP packet. I would like to append the time to this array of bytes, and believe the way to do this is to do: ...
How to more efficiently search through an acoustid database with over 30 million rows? Question: I'm currently playing around with an open source music recognition project called acoustid. I've imported a table with over 30 million rows(300gb of data) but it takes A TON of time to simply SELECT these rows. Currently, s...
Google App Engine: ImportError: No module named appengine.ext Question: I am trying to write a test for my GAE programme which uses the datastore. Following [Google's Documentation](https://cloud.google.com/appengine/docs/python/tools/localunittesting), I see that I should be adding the path to my SDK into my PYTHONPAT...
How do I resolve debug/release conflict after installing opencv under anaconda Question: Tried to get started with OpenCV under Python today, although I have no experience with the former and very little experience with the latter. Since I am inexperienced, I followed a canned approach for the install, as detailed belo...
BeautifulSoup not reading entire HTML obtained by requests Question: I am trying to scrape data from a table of sporting statistics presented as HTML using the BeautifulSoup and requests libraries. I am running both of them on Python 3.5. I seem to be successfully obtaining the HTML via requests because when I display ...
Building a StructType from a dataframe in pyspark Question: I am new spark and python and facing this difficulty of building a schema from a metadata file that can be applied to my data file. Scenario: Metadata File for the Data file(csv format), contains the columns and their types: for example: id,int,...
python3 interpreter gives different results than script for scipy.misc.imread Question: I am trying to read image data into Python as a matrix. To this extent, I am trying to use `scipy.misc.imread('image.jpg').astype(np.float)`. When I execute the proper sequence of steps from a `python3` interpreter, everything wor...
Python iteration over non-sequence in an array with one value Question: I am writing a code to return the coordinates of a point in a list of points. The list of points class is defined as follows: class Streamline: ## Constructor # @param ID Streamline ID # @param Points list of p...
Install BeautifulSoup on python3.5, Mac , ImportError:No module named 'bs4' Question: I want to install BeautifulSoup, I use python3.5 on Mac I have tried many methods: I try to download `beautifulsoup4-4.4.1.tar.gz` from official website,and in terminal type: > $ cd [my path] > > $ sudo python3.5 ./setup.py insta...
Adding new line to data for csv in python Question: I'm trying to scrape data from <http://www.hoopsstats.com/basketball/fantasy/nba/opponentstats/16/12/eff/1-1> to create a CSV file using Python 3.5. I've figured out how to do so, but all the data is in the same row when I open the file in excel. im...
EventFilter for Drop-Events within QTableView Question: I try to create a QTableView that can handle drop events. For reasons of application architecture, I want that to be done by an eventFilter of mine (that handles some QAction-triggers for clipboard interaction as well). But the drop-event does not seem to get thro...
python, pandas, csv import and more Question: I have seen many questions in regards to importing multiple csv files into a pandas dataframe. My question is how can you import multiple csv files but ignore the last csv file in your directory? I have had a hard time finding the answer to this. Also, lets assume that the...
Python regular expression syntax error Question: I am trying to write a regular expression that will match a `-` (dash), followed by as many letters as it possibly can. What I have at the moment, is the following: `exp = (-[a-z A-z]*)`. I am getting a `SyntaxError: invalid syntax` error though. Answer: try placing ...
Python counter to text file Question: So im trying to analyse a log file and extract information from it. One of the things im trying to do is extract a list of IP addresses that have more than 30 failed attempts. In this a failed attempt is one that starts with the line failed password for. I have an idea for this th...
Cython : How wrap C function that takes a void* pointer / how to call it from python Question: i'am trying to wrap some functions defined in a dll using Cython , the difficulty is that lots of this functions use pointers to void* , here is an example of functions prototype : ---------------"header.h"----...
Testing Equality of boto Price object Question: I am using the python package boto to connect python to MTurk. I am needing to award bonus payments, which are of the Price type. I want to test if one Price object equals a certain value. Specifically, when I want to award bonus payments, I need to check that their bonus...
How to construct a callable from a Python code object? Question: _Realize this is a rather obscure question, so I'll explain why I'm looking into this._ A Python jit compiler takes a callable and returns a callable. This is fine, however - the API I'm currently working with uses a Python code object. A simplistic an...
GET request working through Python but not through Postman Question: I am trying to use the Mailman 3 REST API, but I need to call it from Spring's Rest Template in a java class, or for testing purpose from Postman. In Python, I can call the API by: >>> from httplib2 import Http >>> headers = { ....
PyYAML with Python 3.x Question: I've a problem using the _yaml_ (PyYAML 3.11) library in Python 3.x. When I call `import yaml` I get the following error: Python 3.4.3+ (default, Oct 14 2015, 16:03:50) [GCC 5.2.1 20151010] on linux Type "help", "copyright", "credits" or "license" for more inform...
Issues with activating models in Django Question: I'm following this tutorial <https://docs.djangoproject.com/en/1.9/intro/tutorial02/> to learn Django. Here is the code for my model.py file. from __future__ import unicode_literals from django.db import models # Create your models here ...
`subprocess.call` operates differently to running command directly in shell Question: I have the following command in Python, which I wrote with the aim of copying only `.yaml` files from a `source` directory (on the network) to a local `target` directory: import subprocess as sp cmd = ['rsync',...
How to write symbol in csv file? Question: I am trying to write username and symbol into my csv file from python code,but whenever my loop come to that line it skip that record and write next record in the file.Thank you in advance. Please help me in writing symbol into csv file For example: I want to write(Simeon Mil...
Unable to import nltk on mac os x Question: I had successfully installed nltk [from this site](http://www.nltk.org/install.html). And just to validate i am able to import it from the terminal. But when i execute my python script from the Spyder it gives me following error in Spyders terminal File "/Prate...
Displaying JSON specific JSON result in Python Question: I'm new with Python and have the following code: def doSentimentAnalysisAndPrint(keyval): import urllib data = urllib.urlencode(keyval) u = urllib.urlopen("http://text-processing.com/api/sentiment/", data) js...
How to detect ASCII characters on a string in python Question: I'm working on a tool in maya where at some point, the user can enter a comment on the textField. This comment will later be used as part of the filename that's gonna be saved. I work in France so the user might use some accentuated characters as "é" or "à"...
looping through folder of csvs python Question: I have been looking for sometime now and I have not had any luck. Here is my issue: I have a network drive filled with folders with sub-folders of CSVs. Eventually, these csvs need to get imported into a database. Based on the structure there is one row (the second line o...
How to block size of last column in treeview gtk3 Question: Below a demo treeview. I would like to fixed the width of the last column. After a lot of test with different command, I ask help. <https://andrewsteele.me.uk/learngtk.org/tutorials/python_gtk3_tutorial/html/treeviewcolumn.html> it's said: The sizing of the...
How to build a package out of a class Question: I have written a class called editClass which works fine. The class is completely defined in the file editClass.py. The constructor is given by: def __init__(self,filename): self.File=filename I want now to build a package that only contains t...
Reverse Dictionary. Output keeps changing Question: So I have to write a function that receives a dictionary as input argument and returns a reverse of the input dictionary where the values of the original dictionary are used as keys for the returned dictionary and the keys of the original dictionary are used as value ...
Python exceptions and regex Question: I have an expression which I'm using to raise exceptions in the code, except one case where this expression is allowed: searchexp = re.search( r'^exp1=.*, exp2=(.*),.*', line ) I want to raise an exception whenever this condition is hit except one case when I w...
conditional frequency distribution nltk Question: I'm a complete newbie and learning to use python using the natural language toolkit. I have been trying to analyze a text in terms of most common words in it. Specifically, I am trying to make a graph of the most frequent long words (more than 6 letters) in it. Could an...
Time between button press and release in python? Question: I am trying to time from the start of a button press to the end of a button press on GPIO (in order to differentiate between a long press and a short press). I want to use a callback to get the button presses immediately and without polling. Here is what I trie...
Provide a password for the "git push" command in GitPython Question: In Python, using [GitPython](https://github.com/gitpython- developers/GitPython), I need to `git push` to a HTTPS remote repository on BitBucket. After running the `repo.git.push()` command, it will return _-as expected-_ : > bash: /dev/tty: No such...
Looking to find specific phrases in file using Python Question: I am aware that there are some quite similar posts about this on the forum but I need this for a quick scan of a text file. I have to run 500 checks through a 1 GB file and print out lines that contain certain phrases, here is my code: impor...
Python path.exists and path.join Question: Python 2.7: Struggling a little with path.exists import os import platform OS = platform.system() CPU_ARCH = platform.machine() if os.path.exists( os.path.join("/dir/to/place/" , CPU_ARCH) ): print "WORKED" # Linux LD...
Bypass Referral Denied error in selenium using python Question: I was making a script to download images from comic naver and I'm kind of done with it, however I can't seem to save the images. I successfully grabbed the images via urlib and BeasutifulSoup, now, seems like they've introduced hotlink blocking and I can't...
Changing all occurences of similar word in csv python Question: I want to replace one specific word, 'my' with 'your'. But seems my code can only change one appearance. import csv path1 = "/home/bankdata/levelout.csv" path2 = "/home/bankdata/leveloutmodify.csv" in_file = open(path1,"rb") ...
Debugging a request/response in Python flask Question: I am new to [python2 flask](http://flask.pocoo.org/) & I am tasked to pretty print & save the entire HTTP request and response to file. I don't quite understand how to print/inspect the request object, let alone the response. from flask import Flask,...
Easiest way to plot data on country map with python Question: Could not delete question. Please refer to question: [Shade states of a country according to dictionary values with Basemap](http://stackoverflow.com/questions/36118998/shade-states-of-a- country-according-to-dictionary-values-with-basemap) I want to plot d...
Continued Fractions Python Question: I am new to Python and was asked to create a program that would take an input as a non-negative integer n and then compute an approximation for the value of e using the first n + 1 terms of the continued fraction: I have attempted to decipher the question but can't exactly understa...
Python Reportlab units, cm and inch, are translated differently Question: If I draw two PDF files with ReportLab (vers. 3.2.0) with either cm or inch settings I get two different PDFs. I have two functions that to me look exactly equal. In one I place the text into position (5.0*inch, 10.0*inch) and in the other I pla...
Access Google spreadsheet from Google Appengine with service account : working once per hour Question: I have implemented the python code here below based on the documentation in order to access a spreadsheet accessible through a public link. It works once every hour. If I execute a few seconds after a success, I recei...
How to properly update xlwings Question: After xlwings is updated from `0.6` to `0.7.0`, I have the following problem. **Although xlwings works** , when I click **Import Python UDFs** , I get an error that tells: > Run-time error '1004' Cannot run the macro... The macro may not be available in this workbook or all m...
How to delete a specifil line by line number in a file? Question: I'm trying to write a simple Phyton script that alway delete the line number 5 in a tex file, and replace with another string always at line 5. I look around but I could't fine a solution, can anyone tell me the correct way to do that? Here what I have s...
Parsing Python JSON with multiple same strings with different values Question: I am stuck on an issue where I am trying to parse for the id string in JSON that exists more than 1 time. I am using the requests library to pull json from an API. I am trying to retrieve all of the values of "id" but have only been able to ...
Using data from pythons pandas dataframes to sample from normal distributions Question: I'm trying to sample from a normal distribution using means and standard deviations that are stored in pandas DataFrames. For example: means= numpy.arange(10) means=means.reshape(5,2) produces: ...
Does Spark discard ephemeral rdds immediately? Question: Several sources describe RDDs as _ephemeral_ by default (e.g., [this s/o answer](http://stackoverflow.com/a/25627654/5108214)) -- meaning that they do not stay in memory unless we call cache() or persist() on them. So let's say our program involves an ephemeral ...
What algorithm used in interp1d function in scipy.interpolate Question: So i was writing a python program for my numerical course, and I had to code a cubic spline program. So i implement the formula for cubic spline given in books like [Numerical methods by Chapra and canale](http://rads.stackoverflow.com/amzn/click/0...
Having issues with using mysql SELECT in a function Question: Started learning mySQL and got stuck on why this command is not working. I had success with UPDATE commands and SELECT * outside the function so I am guess I am making a mistake in calling the function or perhaps the %s needs to be different... My google foo...
Detecting faces from camera using Opencv Python Question: I am currently trying to detect face from my laptop camera but for some reason the code I found is not giving a result. The code is starting the webcam and not giving any errors but no rectangles are drawn for the faces. No faces are being detected hence the for...
Running a function in each iteration of a loop as a new process in python Question: I have this: from multiprocessing import Pool pool = Pool(processes=4) def createResults(uniqPath): *(there is some code here that populates a list - among other things)* for uniqPath in...
How to connect() with a non-blocking socket? Question: In Python, I would like to use `socket.connect()` on a socket that I have set to non-blocking. When I try to do this, the method always throws a `BlockingIOError`. When I ignore the error (as below) the program executes as expected. When I set the socket to non-blo...
Python - flask - understanding behaviour of routing / flash() Question: I'm new to this. I can't understand why the app doesn't seem to be able to keep hold of data that was randomly generated. get_question() returns a dict with 2 key:value pairs. The question/answer are randomly generated from this function. Every tim...
Alias to Launch Python .py Script Question: I am trying to create an Alias to launch mystepper6.py and moveit.py and sudo ps ax by placing the following alias' in sudo nano ~/.bashrc (Note: I am using Python 2 for this script.) reboot='sudo reboot' ax='sudo ps ax' runstepper='python home/pi/myste...
Why am I getting a "None" in my Python code? Question: I'm trying to loop through six Wikipedia pages to get a list of every song linked. It gives me this error when I run it in Terminal: Traceback (most recent call last): File "scrapeproject.py", line 31, in <module> print (getTableLinks(m...
How to access upper left cell of a pandas dataframe? Question: Here is my Python's Pandas dataframe. How can I access the upper left cell where `"gender"` is in and change the text? `"gender"` is not in `names.columns`. So I thought this might be `names.index.name` but that was not it. import pandas as p...
Qt Designer promoted widget layout Question: I am using Qt Designer for designing my user interfaces, and I want to build custom widgets which could be a combination of existing qt widgets such as a QLabel and QPushButton attached screenshot [![enter image description here](http://i.stack.imgur.com/flgxH.png)](http://...
How to force an automatic reload of the library from inside IPython notebook Question: I'm just learning IPython Notebook, using a pre-existing Python library I've written. At the beginning of my notebook, I'm importing it in the normal way. However, I'm still modifying this library. I notice that changes I'm making t...
Different results for linalg.norm in numpy Question: I am trying to create a feature matrix based on certain features and then finding distance b/w the items. For testing purpose I am using only 2 points right now. data : list of items I have specs : feature dict of the items (I am using their values of keys as featu...
Python: Is it meaningful to import sub-package? Question: This statement is from [Python 3 Doc](https://docs.python.org/3/tutorial/modules.html): > Note that when using from package import item, the item can be either a > submodule (or subpackage) of the package ... It says we can `from package import subpackage`. H...
Python load list from file and print random selection Question: I have a file called `projects.txt` that contains the following line of code: ['Apollo', 'Astro', 'Aurora', 'Barcelona'] I use the following Python2 code to load the file and try to print a random selection but I'm always getting just ...
python pool doesn't work Question: I'm trying to use multithreading and in order to keep it simple at first, i'm running the following code: import multiprocessing as mp pool = mp.Pool(4) def square(x): return x**2 results=pool.map(square,range(1,20)) As i un...
Can continuous random variables be converted into discrete using scipy? Question: If I initialize a subclass of `scipy.stats.rv_continuous` , for example `scipy.stats.norm` >>> from scipy.stats import norm >>> rv = norm() Can I convert it into a list of probabilities with each element represent...
Pandas complex processing with groupby Question: My data is grouped by id. In each group, it is sorted by colB. The logic I need to implement is as follows: If colA is blank, and colD is either (2,3, or 4), then create a column called 'flag' and set flag = 1 in the last non-zero row of colC. Set the flag to 0 in all t...
import a module with a variable Question: Hello dear programmers Python language. I have a question about importing modules in another module with Python 2.7. I want to know how to import a .py module in the form of a variable. In fact, I would like to import a module based on the needs of my main module to limit the ...
Three nested for loops in python fail Question: I am trying to write a HTML Form brute forcer with three Nested For loops, one for IP one for USER and one for PASSWORDS, however my code tries all correct user:pass combinations for the first IP address, write three times the found one and then fails. I would like to try...
To_CSV unique values of a pandas column Question: When I use the following: import pandas as pd data = pd.read_csv('C:/Users/Z/OneDrive/Python/Exploratory Data/Aramark/ARMK.csv') x = data.iloc[:,2] y = pd.unique(x) y.to_csv('yah.csv') I get the following error: Attrib...
Logic error in python turtle Question: I am coding in python 3.2 turtle and I have this beautiful drawing of a tank. and I know how to move it left and write. However, when trying to make the tank move up and down. I am faced with the problem that it goes up but if I let go and press the up button again. It turns to th...
How to tune parameters in Random Forest ? (Python Scikit Learn) Question: class sklearn.ensemble.RandomForestClassifier(n_estimators=10, criterion='gini', max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features='auto', max_leaf_nodes=None, bootstrap=True, oob_score=False...
How to parse a number as either an int or a float, depending on required precision? Question: Requirements: 1. Input can be either string or number 2. If input could be treated as an int without loss of precision, cast to int 3. If input could be treated as a float, cast to float Here is the section of code w...
Run Multiple Spider sequentially Question: Class Myspider1 #do something.... Class Myspider2 #do something... The above is the architecture of my spider.py file. and i am trying to run the Myspider1 first and then run the Myspider2 multiples times depend on some conditions. How Could I do th...
How to create a pandas DataFrame from its indexes and a two variable function? Question: This is a common pattern I've been using: rows = ['Joe','Amy','Tom'] columns = ['account_no', 'balance'] def f(row, column): '''Fetches value from database''' return np.random.random() ...
Error when trying to install plotly Question: pip install plotly Gave me a permissions error sudo pip install plotly Worked and installed plotly, tried to 'import plotly' , ImportError: No module named 'plotly' * * * now when i do this again: pip install plotly "R...
Converting Python 3 libraries to be used in 2.7 Question: I'm following a tutorial which is coded in Python 3 and the author uses from urllib import parse which gives me an error. I've tried using Google and reading up about the library but can't seem to find equivalent. All my code for project is...
unable to run more than one tornado process Question: I've developed a tornado app but when more than one user logs in it seems to log the previous user out. I come from an Apache background so I thought tornado would either spawn a thread or fork a process but seems like that is not what is happening. To mitigate thi...
python 3.5 pass object from one class to another Question: I am trying to figure out how to pass data from one class into another. My knowledge of python is very limited and the code I am using has been taken from examples on this site. I am trying to pass the User name from "UserNamePage" class into "WelcomePage" cla...
How to wait a page is loaded in Python Selenium Question: try: next_page_elem = self.browser.find_element_by_xpath("//a[text()='%d']" % pageno) except noSuchElementException: break print('page ', pageno) next_page_elem.click() sleep(10) I have a page contains information ...
Implementing Regular expressions in Python Question: I have a code like this. <td class="check ABCD" rowspan="2"><center><div class="checkbox {{#if checked}}select{{else}}deselect{{/if}}" id="{{id}}" {{data "tool"} <td class="check" rowspan="2"><center><div class="checkbox {{#if checked}}select...
calculating the total of row 4 in excel csv file python Question: I cant find the total of row 4 in a csv file my code is to enter a code which is searched in a csv file which is then written to a new csv file in order for it to be printed as a receipt my problem is in the last few lines this is my code until know: ...
Python how remove the name of the parent object from function names Question: I have a .py file with my own functions, which I run on ipython on several machines. The problem is that in some platforms I can call functions like sin(), size(), plot() without the prefix of the parent class name and on other platforms I ne...
selenium TimeoutException: Message: python Question: I have the following code, and trying to connect to itunesconnect using selenium from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait driver = webdriver.Firefox() driver.get("https://itunesconnect...
String alignment in Tkinter Question: I want a message box in Python which shows the concatenated string text. I want the text is left aligned but it doesn't. I tried `ljust()` and `{:<14}` etc. But it still not aligned. It seems like this: [![enter image description here](http://i.stack.imgur.com/hqBRg.png)](http://...
How to validated a boost::python::object is a function signature with an argument Question: How to validated a boost::python::object argument is a python function signature with an argument? void subscribe_py(boost::python::object callback){ //check callback is a function signature ...
SQLite database gets locked by SELECT clause Question: I have a python script which creates a database and then enters an infinite loop which runs once per second quering the database with some selects. At the same time I connect to the database with a sqlite cli and try to make an update but I get a database is locke...
wx.SetTextForeground doesn't set DC color properly in wxPython Question: I have the following code and I'm trying to change the text color of DC. I have searched the internet and found that SetTextForeground should be used for this, but somehow I'm unable to make it work. import wx class GUI(): ...
How to set relative path to executive script Question: I want to set relative path to folder with my executive script that will works from any machine without hardcoding absolute path to file. So far I have following: import os path_to_folder = os.path.realpath('.') When I run my script from `P...
python-serial OSError: [Errno 11] Resource temporarily unavailable Question: I am using Arduino Nano to serial communicated with ODROID (single-board computer installed Ubuntu 14.04). The Arduino code: void setup() { Serial.begin(9600); // set the baud rate Serial.println("Ready"); // print...