TH339

1

votes
2

answer
4.7k

views

Problems using multipart_encode (poster library)

I am trying to upload a file using multipart_encode to realize the MIME process. However, I met the following error AttributeError: multipart_yielder instance has no attribute '__len__'. Below are is my approach, I really appreciate if anyone can give me some suggestions. url = "https://pi-user-file...
TH339
1

votes
2

answer
189

views

Python change function input name internaly

I need to create a function which can: Inspect input arguments and get the number of inputs and their values Create a loop, and add string '_in' after each input name Make the new inputs global Assign new inputs with old values I tried to use inspect.getargspec() but it seems like this should be c...
TH339
1

votes
3

answer
3.1k

views

SAS proc univariate for many variables by macro or array

This should be an easy question, but I didn't figure out... I want to get mean and median of many variables by proc univariate as below. It's really time consuming to manually add M_ for mean and MD_ for median to all variables. I am wondering if there any simple approach, such as array to do so? T...
TH339
1

votes
1

answer
3.5k

views

How to escape in HTML5 data-attribute

The data-attribute stuff is new to me and just realized I need to escape space, comma, etc. Can anyone give me some suggestions on my approach? Below is my code: #A list holds all the strings to be sent to data-attribute, #the sequence and length of the list is dynamic, determined by the user #(Th...
TH339
1

votes
2

answer
763

views

jQuery validation plugin checks drop-down, scientific, and elements with similar names

This post is based on my previous question. I had a form with three sections, and use back and next button to hide and show users only one table section at a time. In addition, the next button also serves as validation trigger. My question is: My validation approach failed to check the drop down fi...
TH339
1

votes
2

answer
1.8k

views

jQuery add or remove table row based on inputs

Sorry, if this is too basic. I am trying to add rows to a table if current number of rows are less than a user's demand. At the same time, I need to delete the extra rows if current number of rows are more than a user's need. My code is working, but I think it does not make a lot of sense. So I am...
TH339
1

votes
2

answer
1.9k

views

How to get seleced values by jQRangeSlider

I am trying to integrate jQRangeSlider into my jqplot applications, which means users can slide the x axis and decide the range of plots to be illustrated. However, I am having some difficulties of accessing the selected range. Here is a demo of my approach. It seems like selected values are saved...
TH339
6

votes
2

answer
5.7k

views

Pandas equivalent rbind operation

Basically, I am looping through a bunch of CSV files and in the end would like to append each dataframe into one. Actually, all I need is an rbind type function. So, I did some search and followed the guide. However, I still could not get the ideal solution. A sample code is attached below. For inst...
TH339
1

votes
1

answer
1.9k

views

How to change xticks locations and customize legend using levelplot (lattice library)

I am trying to move the position of x-ticks and x-labels from the bottom of the figure to its top. In addition, my data has a bunch of NAs. Currently, levelplot just remove them and leave them as white space in the plot. I wondering if it is possible to add this NAs to the legend as well. Any sugge...
TH339
5

votes
1

answer
1.5k

views

Alternatives for running SciPy on Google App Engine?

I need to run some statistical tests in my app, which needs functions from scipy.stats. However I found Google App Engine doesn't trust SciPy. So is there any GAE supported libraries which can do some stats calculations e.g. generate random numbers, estimate CDF, run T-tests, check normality, etc....
TH339
4

votes
1

answer
268

views

VBA could find R library

I am trying to use EXCEL as the front end for a R script. So far, I tested my R script in Windows CMD but I could not make it work in VBA. The error message is Error in library(readxl) : there is no package called 'readxl'. So it looks like VBA environment is picky. Any suggestions on fixing this e...
TH339
5

votes
1

answer
2.1k

views

How to add model forms by Django in Google app engine?

I have built a website based on Google App Engine. It includes ten models, doing some simple calculations based on user inputs. Previously, it was coded using Python 2.5 using djangoform.modelform and db.model to handle data. Since Python 2.7 does not support djangoform.modelform, I would like to us...
TH339
2

votes
1

answer
1.9k

views

Cleaning up large XML files in Python (stream parse)

I tried to use Python to cleanup some messy XML files, which does three things: Converting 40%-50% tag names from upper case to lower case Removing NULL between tags Removing empty rows between tags I did this in using BeautifulSoup, however, I ran into memory issues since some of my XML files are o...
TH339
2

votes
2

answer
6.4k

views

jQuery validation error message location

I am using jQuery validation plugin to check my inputs, and having troubles of adjusting the location of the error messages. Here is a demo of my code. I would like to show the error message under the problematic cell, not next to it. I checked the reference and found I should focus on the errorPla...
TH339
2

votes
0

answer
266

views

GAE Launcher (Python) could not start

I believe this is related a number of python packages I have recently installed environmental variables that I have changed. I have re-installed Numpy and GAE, which did not help. So any suggestions on this? Thanks! The GAE log indicated that the failure was lined to file import 2013-12-11 11:45:20...
TH339
3

votes
2

answer
20k

views

jQuery: Conditional show an element based on drop down box selection

I have two related drop-down lists, in which the contents in the second drop-down list depends on the selection made in the first one. For example, in the following HTML code, you will choose application method first. If you choose Aerial as the application method, then you will answer further quest...
TH339
1

votes
1

answer
1.9k

views

jqplot highlighter a line when mouse is over it

I am using jqplot to generate several line plots, and would like to add the highlight feature to it. In detail, once your mouse is over this line, it will highlight itself (change color). I have see this feature in bar plot (example). Is there a way to introduce this to line plot? Here is the demo...
TH339
2

votes
1

answer
626

views

Python solve delay differential equations conditionally

I am using dde23 of pydelay package to solve a delay differential equation. My question: How to code a equation conditionally? For example the target equation has two options: when x>1, dx/dt=0.25 * x(t-tau) / (1.0 + pow(x(t-tau),10.0)) -0.1*x otherwise, dx/dt=0.25 * x I tried two approaches, but it...
TH339
13

votes
4

answer
10.9k

views

keep server running on EC2 instance after ssh is terminated

Currently, I have two servers running on an EC2 instance (MongoDB and bottlepy). Everything works when I SSHed to the instance and started those two servers. However, when I closed the SSH session (the instance is still running), I lost those two servers. Is there a way to keep the server running af...
TH339
3

votes
1

answer
5.4k

views

Shiny R Action Button Controls Reactive Elements

Not sure if I should use this term. Basically, I have a reactive function which displays user uploaded CSV file and I would like to use a action button to fire a plot generation process. At this moment, the plot is always generated on the fly. So I am wondering, in the renderPlot function, how to le...
TH339
12

votes
2

answer
61.3k

views

jQuery update element id

I am new to jQuery and would like to update an element's id. My approach is: select this element by its id overwrite this id with a new value. would you mind telling me where my mistake is? Thanks! Below is the HTML code: Aerial size dist: Very Fine to Fine Fine to Medium (EFED Default) Medium to Co...
TH339
1

votes
1

answer
560

views

VBA Cell Copy Character Limit [duplicate]

This question already has an answer here: Error while copying more than 8202 characters from one cell to another 4 answers Part of my VBA code involves copying and pasting a long string from one cell to the other. My code works fine until if there are too many characters in the source cell. After s...
TH339
2

votes
1

answer
6.9k

views

jqplot group and label several data series with the same name and color

I have a matrix filled with six data series, where I would like to label the first five with the same name 'process a' (also give them the same color), and the left one with 'process b'. So is there a way to do this in jqplot? Thanks for any suggestions. Here is the code and demo: $(document).ready(...
TH339
2

votes
1

answer
756

views

How to translate cURL to Python requests language?

I have some difficulty in translating cURL options into Python requests for uploading a file to a cloud server Picloud. Based on their description, the first step is to POST a request to make a new file to PiCloud to create a ticket for this upload. The second step is to send instructions extracted...
TH339
4

votes
2

answer
184

views

Connection lost when connect R to MySQL using collect

I would like to use dplyr and RMySQL to work with my large data. There is no issues with dplyr code. The problem (I think) is about exporting data out of MySQL to R. My connection is dropped every time even I am using n=Inf in collect. Theoretically, my data should have more than 50K rows, but I can...
TH339
2

votes
1

answer
1.9k

views

Evaluate LaTeX syntax in a loop inside knitr chunk & adjust plot dpi

Sorry if this question is very stupid. I am trying to run regressions and send summary tables and diagnostic plots to a PDF file. I found this package is very helpful, but have two basic questions. Can I use LaTeX to format page inside a Chunk? Is there a way to reduce the size of plots (I need to r...
TH339
2

votes
5

answer
5.3k

views

Jquery insert an image to a HTML table

I want to use jQuery to insert an image after a certain row of a HTML table. I tried to use the appendTo function, but it did not work. I guess its something wrong with my jQuery selector. Can anyone correct my code? Thanks! HTML code: Chemical name:Spinosad Number of time intervals: Logistic model...
TH339
7

votes
1

answer
5.7k

views

Mean on the third dimension in R

Is there any quick way or build-in function in R to calculation the mean values based on the third dimension? For example my array is: , , 1 [,1] [,2] [1,] 1 3 [2,] 2 4 , , 2 [,1] [,2] [1,] 11 13 [2,] 12 14 , , 3 [,1] [,2] [1,] 21 23 [2,] 22 24 My output would be: [,1]...
TH339
3

votes
1

answer
4k

views

How to Show and hide form fields based on a selection from a dropdown menu in Django

I have a question about how to conditional hide or show a field based on the selection of its parent field in Django. **UPDATE: I am able to implement this feature this feature by defining a function in JavaScript, which has been tested with some simple HTML code. However, since my input table is c...
TH339
2

votes
1

answer
1.6k

views

Read space (Tab) separated text files into a matrix (vector)

I need to post process some FORTRAN output files in R. For example, I need to read 20 lines from the output files and ignore spaces. Then convert them to vectors or matrices. I am wondering is there a better way to ignore the spaces and keep the values? Thanks! Here is my Out.txt file (all I need i...
TH339
13

votes
4

answer
12.5k

views

jQuery button validate part of a form at a time

Sorry if I did not explain my problem clearly. I have a form with multiple tables for users inputs. I use next and back buttons to hide and show different tables in order to guide users. Now the problem is: How do I use next button to validate current active table inputs? For example, every time a...
TH339
2

votes
1

answer
1.1k

views

Loading large SAS data into R/Python

Currently, I have a few 50 GB SAS data files (sas7bdat) and I would like to switch previous SAS code to an open source tool like R or Python. The biggest issue is how to deal with those giant files... I tried to export one 50 GB file into a CSV file then used fread in R to load it. However, it crush...
TH339
2

votes
1

answer
256

views

Loss of strings when creates a Numpy Array from a Pandas Dataframe

I am sorry if this is too basic... Essentially, I am using pandas to load a huge CSV file and then convert it to a numpy array for post processing. I appreciate any help! The issue is that some of the strings were missing during the transformation (from pandas dataframe to numpy array). For example,...
TH339
2

votes
2

answer
83

views

jQuery detects which element is visable

I have several tables with similar class names, but only one table is visible at a time. I am having troubles of using jQuery to detect and save the class name of the visible table (I can use .is(':visible') to check and save the class name of the positive ones, but it is kind of cumbersome.). I app...
TH339
3

votes
2

answer
173

views

Spark (Kafka) Streaming Memory Issue

I am testing my first Spark Streaming pipline which processes messages from Kafka. However, after several testing runs, I got the following error message There is insufficient memory for the Java Runtime Environment to continue. My testing data is really small thus this should not happen. After look...
TH339
4

votes
1

answer
2.3k

views

How can I set the S3 object lifecycle using boto?

I have uploaded several files to Amazon S3 using boto. However, I failed to set a lifecycle using statement (I know this can be done using the AWS Management Console, but I need to allow each user to decide how long want to keep the file). The boto API reference for S3 properly documents configure_l...
TH339
7

votes
1

answer
4.2k

views

R memory issue with memory.limit()

I am running some simulations on a machine with 16GB memory. First, I met some errors: Error: cannot allocate vector of size 6000.1 Mb (the number might be not accurate) Then I tried to allocate more memory to R by using: memory.limit(1E10) The reason of choosing such a big number is because memory....
TH339
2

votes
2

answer
4.3k

views

Python subprocess Exec format error

Sorry if this question is dumb. I am using python subprocess statement to call a .bat file in Ubuntu (Natty 11.04), however, I got error messages: Traceback (most recent call last): File "pfam_picloud.py", line 40, in a=subprocess.Popen(src2, shell=0) File "/usr/lib/python2.7/subprocess.py", line 6...
TH339
2

votes
1

answer
135

views

jQuery validation plugin checks inputs between different rows

I am using jQuery validation plugin to check values from two dynamically generated rows. But I am confused by the jquery selection. Below is my broken demo and I appreciate all inputs. My HTML table is something like which is generated based on user selection. Then I need to start from elements name...
TH339
5

votes
1

answer
7.4k

views

jqplot vertical axis label

A really simple question but I could not figure it out... I tried to use jqplot to generate a line plot with vertical y axis label. Based on the example from jqplot web site, all I need is to use this plugin jqplot.canvasAxisLabelRenderer.min.js. I tried it locally, but it did not work. Can anyone g...
TH339

View additional