I'm trying to export data to a csv file. It should contain a header (from datastack) and restacked arrays with my data (from datastack). One line in datastack has the same length as dataset. The code below works but it removes parts of the first line from datastack. Any ideas why that could be?
s = ','.join(itertools.chain(dataset)) + '\n'
newfile = 'export.csv'
f = open(newfile,'w')
f.write(s)
numpy.savetxt(newfile, (numpy.transpose(datastack)), delimiter=', ')
f.close()
I found out that when pressing back button it gets previous page from browser cache even if I send following headers:
Test1.aspx
Server ASP.NET Development Server/9.0.0.0
Date Wed, 24 Mar 2010 17:49:40 GMT
X-AspNet-Version 2.0.50727
Location Test2.aspx
Cache-Control no-cache, no-store
Pragma no-cache
Expires -1
Content-Type text/html; charset=utf-8
Content-Length 189
Connection Close
Guys, I have a basic WPF application. Contains App.xaml as always and a Mainwindows.xaml.
I've created also some pages like page1/2/3. I want to load for example page1.xaml in mainwindows.xaml. Is this possible? And also want to close it so the content of mainwindow.xaml will stay in there.
I dont want this to be a navigation application with the left/right arrpws at the top.
I am trying to generate tree with fasta file input and Alignment with MuscleCommandline
import sys,os, subprocess
from Bio import AlignIO
from Bio.Align.Applications import MuscleCommandline
cline = MuscleCommandline(input="c:\Python26\opuntia.fasta")
child= subprocess.Popen(str(cline),
stdout = subprocess.PIPE,
stderr=subprocess.PIPE,
shell=(sys.platform!="win32"))
align=AlignIO.read(child.stdout,"fasta")
outfile=open('c:\Python26\opuntia.phy','w')
AlignIO.write([align],outfile,'phylip')
outfile.close()
I always encounter with these problems
Traceback (most recent call last):
File "", line 244, in run_nodebug
File "C:\Python26\muscleIO.py", line 11, in
align=AlignIO.read(child.stdout,"fasta")
File "C:\Python26\Lib\site-packages\Bio\AlignIO_init_.py", line 423, in read
raise ValueError("No records found in handle")
ValueError: No records found in handle
I follow this tutorial here to create RESTful web service on Netbean 6.8. However, when I right click on the project node and select Test RESTful Web Service, the browser pop up, and supposedly my project would be listed on the left, and supposedly I would be able to select it, and test against various function that listed on the right. However, I dont see any of that. Any idea why?
I'm trying to get YUIs DataTable to work using Inline Cell Editing that can Auto Complete.
In this thread:
http://yuilibrary.com/projects/yui2/ticket/2528064
Somebody provides a non-working solution, that seems close.
Has anybody tried to get this to work?
I am in late testing phase of my web application. The application will be tested at a larger scale now.
During this time I want to try and hack my own system and application with some tools, scripts, etc. Mostly some code I can try and execute in the browser. I have backups for the whole system so even down to the kernel can be hacked.
My system is nginx,apache,php,mysql on Linux CentOS.
When putting a favicon on your site, you can apparently use an animated gif, just by changing the gif file’s extension to .ico.
http://www.k-director.com/blog/how-to-add-an-animated-faviconico/
Have you encountered any problems doing this? Have you seen a browser get confused by a gif file with a .ico extension?
I try to play with sockets a bit. For that I wrote very simple "client" and "server" applications.
Client:
import java.net.*;
public class client {
public static void main(String[] args) throws Exception {
InetAddress localhost = InetAddress.getLocalHost();
System.out.println("before");
Socket clientSideSocket = null;
try {
clientSideSocket = new Socket(localhost,12345,localhost,54321);
} catch (ConnectException e) {
System.out.println("Connection Refused");
}
System.out.println("after");
if (clientSideSocket != null) {
clientSideSocket.close();
}
}
}
Server:
import java.net.*;
public class server {
public static void main(String[] args) throws Exception {
ServerSocket listener = new ServerSocket(12345);
while (true) {
Socket serverSideSocket = listener.accept();
System.out.println("A client-request is accepted.");
}
}
}
And I found a behavior that I cannot explain:
I start a server, than I start a client. Connection is successfully established (client stops running and server is running). Then I close the server and start it again in a second. After that I start a client and it writes "Connection Refused". It seems to me that the server "remember" the old connection and does not want to open the second connection twice. But I do not understand how it is possible. Because I killed the previous server and started a new one!
I do not start the server immediately after the previous one was killed (I wait like 20 seconds). In this case the server "forget" the socket from the previous server and accepts the request from the client.
I start the server and then I start the client. Connection is established (server writes: "A client-request is accepted"). Then I wait a minute and start the client again. And server (which was running the whole time) accept the request again! Why? The server should not accept the request from the same client-IP and client-port but it does!
I am looking for ways to store data in a windows form application in C#.
I want to make the input data of a system persistent, so when I close my program and open it again, the data is retrieved.
Which ways are of doing this besides creating a linked database?
Examples are gladly appreciated
regards
Hi,
In one of my application I'm using the WebClient class to download files from a web server. Depending on the web server sometimes the application download millions of documents. It seems to be when there are lot of documents, performance vise the WebClient doesn't scale up well.
Also it seems to be the WebClient doesn't immediately close the connection it opened for the WebServer even after it successfully download the particular document.
I would like to know what other alternatives I have.
Thanks,
Shamika
Hi,
I would like to open a webpage and run a javascript function from within a java app.
For example I would like to open the page www.mytestpage.com and run the following javascript code:document.getElementById("txtEmail").value="[email protected]";submit();void(0);
This works in a browser...how can I do it programatically?
Thanks!
My requirement is to send a link message to mobile via bluetooth in C#. The message should contain some hyperlink. And when the user opens the message it should directly open the link in browser.
It should work without installing any other application on mobile device.
hi,
i"m getting nuts in here.
everytime i try to do even an
ExternalInterface.call('alert','abc');
(which will work on every browser) i get an
object doesent support this propety or method
after the alert appears.
it even happens in the HTML generated by flash without me touching it...
there is any solution?!
thanks!
I see something strange like:
http://github.com/zoul/Finch.git
Now I'm not that CVS / SVN / etc. dude. When I open that in the browser it tells me that I did something wrong. So I bet I need some hacker-style tool? Some client?
(i mean... why not just provide a zip? isn't the world complex enough?)
I have tried to do the following, but the web-service is NOT REST and does not take multi-part. What do I do in order to POST the image?
@response = RestClient.post('http://www.postful.com/service/upload',
{:upload => {
:file => File.new("#{@postalcard.postalimage.path}",'rb')
}
},
{"Content-Type" => @postalcard.postalimage.content_type,
"Content-Length" => @postalcard.postalimage.size,
"Authorization" => 'Basic xxxxxx'
} # end headers
) #close arguments to Restclient.post
Hello all
i need to operate smell web server in my application play flash swf files in my embedded browser , this application will be distributed to local users to desktop users
what is the best way to implement it in desktop application i mean ports / local host ?
Hi,
I am trying to call an Activity from another instance of the activity. The code is supposed to be a simple file browser (part of a larger application). I am using a ListActivity, and when an item (such as a folder) is selected, it is supposed to open it up in the new Activity. I have a feeling it is a problem with the AndroidManifest (which just has the basic tag). Any assistance would be appreciated.
Thanks,
Steve
I am trying to read in a pgm file (512x512 array) and when I read in a larger file I get the error: java.util.NoSuchElementException on reading element (3,97).
I have created a much smaller file to read (23x23) and it reads fine. Is there a size limit? I have checked the file and confirmed that there is an int for the value:
This appears to be the line it crashes at:
fileArray[row][col] = scan.nextInt();
Here is the file:
import java.util.Scanner;
import java.io.*;
public class FileReader
{
public static void main(String[] args) throws IOException
{
String fileName = "lena.pgma";
int width, height, maxValue;
FileInputStream fileInputStream = null;
fileInputStream = new FileInputStream(fileName);
Scanner scan = new Scanner(fileInputStream);
// Discard the magic number
scan.nextLine();
// Discard the comment line
scan.nextLine();
// Read pic width, height and max value
width = scan.nextInt();
System.out.println("Width: " + width);
height = scan.nextInt();
System.out.println("Heigth: " + height);
maxValue = scan.nextInt();
fileInputStream.close();
// Now parse the file as binary data
FileInputStream fin = new FileInputStream(fileName);
DataInputStream dis = new DataInputStream(fin);
// look for 4 lines (i.e.: the header) and discard them
int numnewlines = 4;
while (numnewlines > 0) {
char c;
do {
c = (char)(dis.readUnsignedByte());
} while (c != '\n');
numnewlines--;
}
// read the image data
int[][] fileArray = new int[height][width];
for (int row = 0; row < height; row++) {
for (int col = 0; col < width; col++) {
fileArray[row][col] = scan.nextInt();
System.out.print("(" + row + " ," + col +"): " + fileArray[row][col]+ " ");
}
System.out.println();
}
dis.close();
}
}
any advise would be appreciated.
Hi, I have been creating a cross browser compatible ( = ie 6 + standards complaint browsers ) Online Instant Messenger
What I would like to know is what licensing would I need to protect my code? how would i go about getting a license and where from?
My code is in PHP, and jQuery.
Regards,
Phil
I am working on a browser plug-in for Firefox, and I would like to be able to do some automated testing to make sure that it's handling a variety of different HTML/JavaScript features correctly. Does anyone know of a good downloadable corpus of HTML and/or JavaScript pages that could be used for this type of testing?
Is there a way to allow a user, after he has created a vector graph on a javascript svg canvas using a browser, to download this file to their local filesystem?
SVG is a total new field for me so please be patient if my wording is not accurate.
kind regards,
Jeroen.
Hey
I am connecting a MYSQL database through hibernate and i seem to have processes that are not being killed after they are finished in the session. I have called flush and close on each session but when i check the server the last processes are still there with a sleep command. This is a new problem which i am having and was not the case yesterday. Is there any way i can ensure the killng of theses processes when i am done with a session.
Below is an example of one of my classes.
public JSONObject check()
{
//creates a new session needed to add elements to a database
Session session = null;
//holds the result of the check in the database
JSONObject check = new JSONObject();
try{
//creates a new session needed to add elements to a database
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session = sessionFactory.openSession();
if (justusername){
//query created to select a username from user table
String hquery = "Select username from User user Where username = ? ";
//query created
Query query = session.createQuery(hquery);
//sets the username of the query the values JSONObject contents
query.setString(0, username);
// executes query and adds username string variable
String user = (String) query.uniqueResult();
//checks to see if result is found (null if not found)
if (user == null)
{
//adds false to Jobject if not found
check.put("indatabase", "false");
}
else
{
check.put("indatabase", "true");
}
//adds check to Jobject to say just to check username
check.put("justusername", true);
}
else
{
//query created to select a username and password from user table
String hquery = "Select username from User user Where username = :user and password = :pass ";
Query query = session.createQuery(hquery);
query.setString("user", username);
query.setString("pass", password);
String user = (String) query.uniqueResult();
if(user ==null)
{
check.put("indatabase", false);
}
else
{
check.put("indatabase", true);
}
check.put("justusername", false);
}
}catch(Exception e){
System.out.println(e.getMessage());
//logg.log(Level.WARNING, " Exception", e.getMessage());
}finally{
// Actual contact insertion will happen at this step
session.flush();
session.close();
}
//returns Jobject
return check;
}