python file manipulation
I have a file with entries such as: 26 1 33 2 . . . and another file with sentences in english I have to write a script to print the 1st word in sentence number 26 and the 2nd word in sentence 33. How do I do it? ...
I have a file with entries such as: 26 1 33 2 . . . and another file with sentences in english I have to write a script to print the 1st word in sentence number 26 and the 2nd word in sentence 33. How do I do it? ...
Hi, I'm trying to make a script that automatically starts uploading after the data has been enter in the database(I need the autoId that the database makes to upload the file). When I run the javascript the scripts runs the php file but it fails calling the other php to upload the file. too much recursion setTimeout(testIfToegevoegd()...
I'm trying to help out a friend understand this but even I don't really get what they're doing here. Here's the method I'm trying to explain to him: public void AddDiagonal() { int Addition; for (int f = 0; f < filas; f++) { for (int c = 0; c < columnas; c++) ...
Hello all. My first post here so be please be kind :) I searched SO before posting but I couldn't find an answer (it's possible that my search wasn't the best though) I'm starting to learn C++ and as an exercise decide to implement a simple LinkedList class (Below there is part of the code). I have a question regarding the way the cop...
Hi, I faced a problem while using threading for the first time, In an SWT program in the main thread I have created the GUI and opened the shell, and then a new thread is started to run some logic in the model, and in the model at a certain state there is a method is called in the GUI class... and here it is the problem this method is c...
Hello, I'm taking a beginner C++ course. I received an assignment telling me to write a program that converts an arbitrary number from any base between binary and hex to another base between binary and hex. I was asked to use separate functions to convert to and from base 10. It was to help us get used to using arrays. (We already cover...
I have a media program where from main() i am adding info about book, cd, dvd. every entry for cd,dvd,book has a keyword. Where i am having a problem is adding a keyword to each item. currently i have everything added but keyword. required out put -Book- author: Mark Haddon pages: 240 title: The Curious Incid...
Write a function called listenToPicture that takes one picture as an argument. It first shows the picture. Next , it will loop through every 4th pixel in every 4th row and do the following. It will compute the total of the red, green and blue levels of the pixel, divide that by 9, then add the result to 24. That number will be the note...
How do I do the second line in my main argument? def main(): pic= makePicture( pickAFile()) ### It will print the number of notes to be played(which is the number of pixels in the pic divided by 16, why?)### listenToPicture(pic) def listenToPicture(pic): show(pic) w= getWidth(pic) h= getHeight(pic) for i...
I am trying to create a trapezoid using user inputted options. I know my code may not be the best way but so far it works! My problem is i need the base of the trapezoid to be touching the left side of the output window. What am i doing wrong? #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { ...
Hi, I am trying to implement protein pairwise sequence alignment using "Global Alignment" algorithm by 'Needleman -Wunsch'. I am not clear about how to include 'Blosum62 Matrix' in my source code to do the scoring or to fill the two-dimensional matrix? I have googled and found that most people suggested to use flat file which contain...
Okay, so I have another question on a prolog homework problem I am struggling with. The problem goes as follows: Write a Prolog program that will take a list representing the bits of a binary number, and return the decimal value of the integer that the list represents. Example: valueof([1,1,0,1],X). X = 13 So here's what I hav...
Hello! I hava a file, which consists of a one row: 1 , 1 2 , 1 3 6 , 4 ,... In this representation, spaces separate the integers and commas. This string is so huge that I can't read it with RandomAccessFile.readLine() (almost 4 Gb needed). So that I created a buffer, which can contain 10 integers. My task is to sort all integers i...
I am trying to find an author in a set, and i am having problems doing so. in the library.cpp is where i am adding the information from main() #include "Library.h" #include "book.h" #include "cd.h" #include "dvd.h" #include <iostream> // general functions ItemSet allBooks; ItemSet allCDS; ItemSet allDVDs; ItemSetMap allBooksByAu...
Full disclosure: This is for a homework assignment. This is driving me nuts. I'm writing a Discrete Cosine Transform function and have it basically complete, but I'm running into an IndexOutOfRange exception. Code is below: static int[][] DiscreteCosineTransform(int[][] pIn) { int[][] cosP = pIn; doubl...
I have the following function defined inside my linked list class. The declaration in the header file looks like this: template <typename T> class RingBuffer { ...//stuff static BLink * NewLink (const T&); // allocator }; BLink is a "link" class within the RingBuffer class. The following implementation code: template <typename ...
Im trying to create a method that take 2 int array as the input parameter and returns true if the array are reverse and false otherwise. This is what I have so far but it is wrong. public static void main(String[] args) { int b,a; int[] data1 = {14,-70,-18,88,85,97,-65,13,-71,-12}; int[] data2 = {-12,-71,13,-65,97,85,88,-18,...
Hi! I'm taking CS193P iPhone Development courses, and even if.. I know that I'm pretty late comparing to Stanford's students, I'm doing Assignment 3. My current problem is: My drawRect method does not get called on every setNeedsDisplay... but only on the first. Also, what I noted is that my polygon object is NULL (from PolygonV...
Okay, my last prolog question. It's the common geneaology problem. I am suppose to take a list of facts and have a function called descendant that will return a list that has all the descendants. For example: Given the rules: parent('Bob', 'Tim'). parent('Joe', 'Bob'). The function call: descendant('Joe', X). should re...
I have this code to open multiple files one at a time that is given at the command line, and then if it cannot open one of the files, it closes all the files and exits. /* Opens an array of files and returns a pointer to the first * element (the first file). */ ifstream *OpenFiles(char * const fileNames[], size_t count) { /* If...