I have written some code just to practice verbosity in python. Verbosity is embedded by means of the ArgumentParser module....however, I'd also like to write the stdout to file also when verbosity is disabled : #!/usr/bin/python from optparse import OptionParser from argparse import ArgumentParser import sys def printable1(): print "1" def printable2(): print "2" def printable3(): print "3" def Main1(): printable1() printable2() def Main2(): printable2() printable3() class Logger(object): def __init__(self): self.terminal = sys.stdout self.log = open("logfile2.log", "a") def write(self, message): self.terminal.write(message) self.log.write(message) #te = open('./logfiles.txt','w') # File where you need to keep the logs #class Unbuffered: #def __init__(self, stream): #self.stream …

Member Avatar
+0 forum 0

hi, I'm new in Java and Hadoop. I'm in need of MapReduce code for large EEG data file split in Java. Based on channels(electrodes attached on head) and time, data have to be splitted. In mapper file splitting takes palce and in reducer it process the splitted data. For parallel processing mapper give splitted data to different nodes. Mapper(master node) and slave nodes have reduser. I have an overview of mapreduce code that I given below. I'm quite sure that it may be wrong, because I'm new in Java. Please help me to write map and reduce code. //getfile(File location) …

Member Avatar
+0 forum 0

Hello when i use below program to write and read data from USB mass storage device(flash memory) i am getting following error. I've succeeded with usb_bulk_write() but can't utilize usb_bulk_read(). It returns an error. Set configuration usb_bulk_write: 12 bytes written 33 5b 2 1 0 5 1 3 7 f 7f 1f read failed: libusb0-dll:err [_usb_reap_async] reaping request failed, win error : A device attached to the system is not functioning. usb_bulk_read: -5 bytes read: what is the problem in this code? #include "lusb0_usb.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #define VENDOR_ID 0x13FE #define PRODUCT_ID 0x3600 #define CONFIGURATION 0x01 #define …

Member Avatar
+0 forum 0

I am trying to create a powerpoint quiz that tallies the scores, provides the results e.g. 95 out of 100 and the percentage %, then writes the users name and results to an excel spreadsheet. Oh, and all this has to be done using Office 2007 products. Can anyone help? So far I have: Dim UserName As String Dim numberCorrect As Integer Dim numberWrong As Integer Sub YourName() UserName = InputBox(Prompt:="Type Your Name!") MsgBox " Welcome to the Mortgage Servicing Assessment - Session 1 " + UserName, vbApplicationModal, " Mortgage Servicing Assessment" End Sub Sub Correct() MsgBox " Well Done! …

Member Avatar
+0 forum 0

I am currently writing a Client and server program and I have no idea where when wrong with the write function It calls the function [CODE] writeToclient (int clientFd) { tatic char* win = "you win !"; write (cliendFD , win , strlen(win)+1) ; printf("test"); } [/CODE] it execute the write but it doesnt print the test. Anyone know why?

Member Avatar
+0 forum 0

Hi, this is a clue game in prolog. [B][U]I'm posting it to thank everyone that takes the time to post and help people, like me.[/U][/B] The program is spanish, cause in from México, but it's a clue game. Features: Write and read *.txt files, and use their content to compare data in the input stream. Generate random variables. "If.. then.." prolog structures Fully functional, I recommend you to use GProlog, I haven't tetsed it in SWI-PROLOG [B]Hope helps somebody and if you like, you're welcome to improve it or modify it ONLY under GPL Licence 3.0 or later. [/B] User …

Member Avatar
+0 forum 0

Hello I am currently attempting to write the contents of a .hrm file into a datagridview and place each piece of data into its required column. This is the code I have at the moment which is currently just extracting some data from the .hrm file and placing it in some labels. [CODE]using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string date1 = ""; string starttime1 = ""; string length1 = ""; string maxhr1 = …

Member Avatar
+0 forum 0

Hi,I want to copy a few files to the Windows\winsxs folder ,but in windows vista/7 you cannot write files to that folder, apparently there is a user called "TrustedInstaller" only that user has write access to the folder. TrustedInstaller > Administrator. I tried to use "runas" for my process but still "Access is denied". Is there any way to get the rights to write to that folder by code. Thanks.

Member Avatar
+0 forum 0

I used this to write the matrix into a file: int Nx, Ny, Nz; Array <complex<float>, 3> matrix(Nx, Ny, Nz, ColumnMajorArray<3>()); ...get matrix data... fstream outbin(outname.c_str(),ios::out|ios::binary); outbin.write(reinterpret_cast<char *>(matrix.data()),sizeof(complex<float>)*Nx*Ny*Nz); outbin.close(); Then, I used this to read this matrix, works fine, values and orders are correct too: Array <complex<float>, 3> matrixb(Nx, Ny, Nz, ColumnMajorArray<3>()); fstream inbin(inname.c_str(),ios::binary|ios::in); for (int k=0; k<Nz; k++){ for (int j=0; j<Ny; j++){ for (int i=0; i<Nx; i++){ inbin.read(reinterpret_cast<char *>(&matrixb(i,j,k)),sizeof(complex<float>)); } } } inbin.close(); However, this read all ZEROs in matrixb: Array <complex<float>, 3> matrixb(Nx, Ny, Nz, ColumnMajorArray<3>()); fstream inbin(inname.c_str(),ios::binary|ios::in); outbin.read(reinterpret_cast<char *>(matrixb.data()),sizeof(complex<float>)*Nx*Ny*Nz); inbin.close(); Thank you for pointing out the …

Member Avatar
+0 forum 0

i everyone, I'm trying to send data to arduino(serial) from assembler (8086 -windows). I can read data but write doesn't work. I always receive 80H in AX, this is the code: [code]send proc MOV AH,00 ; init port MOV AL,11101011b ; 9600, N,1 bit stop, 8 bit data MOV DX,00 ; com1 INT 14H MOV AH, 1 ; write function MOV AL, 'S' ; char to send MOV DX, 00 ; com1 INT 14H RET send endp[/code] This is the code to read, which works perfectly [code]recibir proc push bx MOV AH,00 ;inicializar el puerto MOV AL,11110011b ; velocidad 9600, …

Member Avatar
+0 forum 0

The End.