I am making a text adventure and would like the command line window to be a specific size when you run the .py file in the command line window. eg. 300 wide by 250 height. I found a thread on here that shows how to specify the text colour which I also wanted to know. [url]http://www.daniweb.com/forums/post1150939.html#post1150939[/url] Can anybody help? Thanks.

Member Avatar
Member Avatar
+0 forum 11

Consider my post in this thread... https://www.daniweb.com/programming/software-development/threads/508038/how-to-change-this-program-to-fully-oop Consider this code... int main() { srand(time(NULL)); char enter; // game starts Player player; // title cout << "Welcome to Zombie War." << endl << "Press [ENTER] to start."; cin.get(); // player name cout << "Please enter your name: "; cin >> player.playerName; // ask how many zombies cout << "How many zombies do you wish to fight? "; cin >> player.zombieCount; cout << "Get ready to fight for your life, " << player.playerName << "!" << endl; Line 5 above ("game starts" comment) is line 19 in the OP's code since I …

Member Avatar
Member Avatar
+0 forum 1

Hey Guys, So using a webform textarea I am passing some data into PHP. This data is basically 4 columns of an excel sheet and potentially unlimited rows. Now I want to be able to go through this data, select each of the four individual elements from each row, insert these as a new row into a MySQL database and do this for each row pasted into the original textarea. I was told that Excel separates new lines with a '\n' character and each column with a '\t' separator. So my approach was to use `$rows=explode('\n',$data)` and then explode each …

Member Avatar
Member Avatar
+0 forum 6

Hello, I'm in a beginning Java class, and I am lost :( My homework calls for me to write a program that takes an integer (of unknown length) and prints it one digit per line, like: 5 6 9 8 6 4 3 I have been googling this for hours to no avail. The code below is something I tried based on my failed attempts to google the correct method and it is returning 11 errors. I have also tried System.out.println with charAt, and that didn't work for me either. I have the most basic of knowledge and am not …

Member Avatar
Member Avatar
+0 forum 17

I need to make some KML code that is basically a coloured track. So far I have worked out that it either has to be lots of small lines or placemarks. However usually with this there is no way to use the time bar. Is there a way to be able to have lots of small lines/placemarks that are affected by the timebar. Thank you.

Member Avatar
Member Avatar
+0 forum 1

Hi. In my CMS, when i type a content for a new post in the textarea, like this: one two three four five six and then click the submit button, it will save in the db table like the way i have typed, every word in a separate line. But when the script echo the post on the page, i see all words are in one line like this: one two three four five six Why? Do i have to type tags like <br> while typing the content on the text area?! But users must feel free to write their …

Member Avatar
Member Avatar
+1 forum 13

Hello, me again :) With this code: >>> from BeautifulSoup import BeautifulSoup >>> import urllib2 >>> url = urllib2.urlopen('http://www.python.org').read() >>> soup = BeautifulSoup(url) >>> links = soup('a') >>> print links A list of links printed into the terminal. I want to send the list into a text file, i tried this: >>> with open('python-links.txt.', 'w') as f: ... f.write(links) But there was an error: File "<stdin>", line 2, in <module> TypeError: expected a character buffer object What is the problem? How can fix that? -------------------------------------------------------------------- And one more question; as that list looks like this: (I will copy only small …

Member Avatar
Member Avatar
+0 forum 3

I copied this code from page 11 of http://personal.denison.edu/~krone/cs173/files/PythontoC++.pdf and assigned it to a Python string. Alas there are still line numbers. How could I use Python to remove these? Help, I have a mental block. s = ''' 1 #include <iostream> 2 using namespace std; 3 4 int gcd(int u, int v) { 5 int r; 6 while (v != 0) { 7 r = u % v; // compute remainder 8 u = v; 9 v = r; 10 } 11 return u; 12 } 13 14 int main( ) { 15 int a, b; 16 cout << …

Member Avatar
Member Avatar
+0 forum 2

**Read title.** username = base64.b64encode(username)+'\n' This is what I thought would have worked, but it comes up with an error, "TypeError: can't concat bytes to str", meaning that I cannot add +'\n' to the end of the code. If there is anyway anyone knows how to write the byte of base64.b64encode(username) to a file line by line, please help!

Member Avatar
Member Avatar
+0 forum 2

I have two python script the first once contains my def callers and my command line arguments. The second one contains my defs that i want to use the command line arguments in. I was wondering if there was a way to call the command line arguments into the second script cause they do call some of the items that are needed in the second one from the comman line.

Member Avatar
Member Avatar
+0 forum 8

Hello. I am a complete newbit to Python. I am trying to read a text file (which is actually an svg file) and add a line to the text file. I would also like to remove certain text from the file. I am trying to edit some of the tags in the file. Here is the code that I have so far. I have only figured out how to read the file and append to it. But I don't know how to do actual edits. def main(): f = open("F01.svg", "r") if f.mode == 'r': fl = f.readlines() for x …

Member Avatar
Member Avatar
+0 forum 2

Do you know if I can change of line in a list of lists? tareas = [] > otraTarea = [tarea,year,month,day, hour, minute, second, microsecond,str(cuando),cuando] `+'\n'+ []`(this is what i have tried) #I have tried to concatenate two lists, but the program returns a message, in which it's explained that I have to convert my list into a string format, and I donĀ“t want that. #I want something like: [tarea,year,month,day, hour, minute, second, microsecond,str(cuando),cuando] [tarea,year,month,day, hour, minute, second, microsecond,str(cuando),cuando] [tarea,year,month,day, hour, minute, second, microsecond,str(cuando),cuando] # normally it is shown like: # [[tarea,year,month,day, hour, minute, second, microsecond,str(cuando),cuando],[tarea,year,month,day, hour, minute, second, microsecond,str(cuando),cuando],[tarea,year,month,day, …

Member Avatar
Member Avatar
+0 forum 1

how to draw 2 parallel line in visual baisc 6.0 which have same height.. suppose picture box height is 200 then first line starting cordinate is 0,100 and second line cordinate is 100,200.. how we draw..

Member Avatar
Member Avatar
+0 forum 2

Hi Team, Please hekp me with the OCILogon error. Im using WampServer Version 2.2. I have a script which connects to 10g and 11g database and it works perfect from the browser. Now i want to automate the php script via batch file which will be windows 7 schedule task. I have set the classpath to C:\wamp\bin\php\php5.4.3 for php. While executing script it gives "Call to undefined function OCILogon() in c:\wamp\www\cps_auto\testauto.php on line 6. PHP Stack trace: php 1.(main) c:\c:\wamp\www\cps_auto\testauto.php:0 Please help need it urgently.

Member Avatar
Member Avatar
+0 forum 2

I'm hoping this is the right place to get some expert advice on putting an app together. I have a Beaglebone Black (BBB, a credit card sized Linux platform) that collects bursts of sensor data. Even though I'm relatively new to Linux, I'm pretty comfortable with the data collection end of the application. But I want to give people nearby access to the data displayed as a line chart along with some additional calculations. My current thinking is that I'll run a server on the BBB that users can browse to using a PC, tablet, or smart phone, that provides …

Member Avatar
Member Avatar
+0 forum 8

okay so hi, my problem is on (i think) case 3(the delete), it actually works when you input a movie title of example: armageddon(2012), but if you input a title that has spaces in between example: when i met your mother(2009), it just crashes. i don't know what to do anymore, although i made sure that i get the whole line, not the byCharacter or string. the other cases are working fine.this is not a homework.:) #include<iostream> #include<string> #include<vector> #include<algorithm> #include<fstream> #include<iterator> #include<stdlib.h> #include "MovieTime.h" //made a struct of movie,mainly a title and years. using namespace std; int main() { …

Member Avatar
Member Avatar
+0 forum 6

okay i have a file with data orgainzed like this in a dat file to be read: apple.0.0.end. and i want it to be read by char until it sees "." then print that, then read again repeated until the end of the line. so i can show the data like this: name? : apple noun? (0 for yes; 1 for no): 0 eatable? (0 for yes; 1 for no): 0 can this be done? how? and explain like im 5 years old for future reference.

Member Avatar
Member Avatar
+0 forum 2

I have a text file that I open and attempt to read the individual lines. I have used the same code before on other files with no problem, but for some reason, this particular file is strange. When I do the following command; Line Input #1, read_string the string read_string contains the entire sequence of each line in the file concatenated together. When I look at the special chararcters of the file I do see a cariage return. But just so you know what the file looks like, here are the first few lines, k_arr[8'h1C]= {10'b001111_0100,10'b110000_1011} ; k_arr[8'h3C]= {10'b001111_1001,10'b110000_0110} ; …

Member Avatar
+0 forum 0

Hi i need windows command line to find all files that end with .jpg.pdf and remove the .jpg part so it will be pure .pdf at the end, i have following line for /R %DIR% %%i in (*.jpg.pdf) do set without=%i:~0,-8% & rename %%i "%%without.pdf" It should remove last 8 characters and then rename file with .pdf extension for some reason it creates without variable with this content '~0,-8without' any idea how to execute these two commands in one for loop? the '&' doesnt do the trick for some reason... Thanks

Member Avatar
Member Avatar
+0 forum 3

HI, I am trying to set the consecutive pixels to a specific color so as to obtain a line. Though, I know there is a built in function for drawing the line, but I am interested to do it without using any GL primitive. This is the display function as of now. Here I thought that changing limits from -250 to 250 instead of -1.0 to 1.0 will do the job but to no avail. In this code I am just getting a point a the centre of the window. Any help is appreciated as to how make a line …

Member Avatar
+0 forum 0

So I wrote a cool little python script for terminal commands that I get sick of entering. Most of the script is explained in docstrings and comments. Looking for useful terminal commands or things I missed or could have done better. I'm actually quite proud of it. :) #!/usr/bin/env python '''Local refers to the host computer[127.0.0.1], System refers to the system, [run] runs the command in a host network enviroment.''' __default__ = "/" __pythondefault__ = "/Users/self/Desktop/Python3" __vers__ = 1.0 __auth__ = "SirPrinceKai" import os from fabric.api import * def Erase(): print "Removes the bits and pieces from your trash can." …

Member Avatar
Member Avatar
+1 forum 4

Hello, I'm a starter in Python and I need help. I'm trying to ask the user to input as much text as he/she likes until he/she types EOF (end of file) on a separate line. Once he/she does, the program should end. I started on my code and below is what I have so far. I'm using the 'for' loop in my code, is that correct? #Set textInput to 0? textInput = 0 #Use the 'for' loop to keep looping. for i in textInput: #Prompt for user text input. Is this in the right spot? textInput = input() #If the …

Member Avatar
Member Avatar
+0 forum 1

Okay, so I've been working on a program where you add planets to a solar system and try to get them to orbit a sun. What I need, and have been having great troubles with figuring out, is a 'guide line' to show you where your planet is going to be going before you actually click to place it in the level. I'm looking for something kind of like the line on angry birds just before you release your finger that shows you where the bird is going to go. I don't need the actual code for this. just the …

Member Avatar
Member Avatar
+0 forum 5

I have a .Net web application where any uncaught exceptions get handled via the Application_Error event in Global.asax. Here, I email myself details of any uncaught exceptions that sneak through. My problem is that while I am getting the error messages just fine, I am not getting the line numbers in the stack trace to denote where the error is happening. The Application_Error code is as follows: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Error ' Fires when an error occurs Dim Context As System.Web.HttpContext = HttpContext.Current Dim Ex As System.Exception = Context.Server.GetLastError.GetBaseException Dim Path As String …

Member Avatar
Member Avatar
+0 forum 3

im trying to get this script to draw a line from the center of the rectangle to the mouse BUT i only want it to draw about 10 pixels out. how can i find that point that is 10 pixels(or points) out? code so far: import pygame from pygame.locals import * import math pygame.init() screen = pygame.display.set_mode((640, 480)) red = (255,0,0) green = (0,255,0) blue = (0,0,255) darkBlue = (0,0,128) white = (255,255,255) black = (0,0,0) pink = (255,200,200) x = 5 y = 5 username = "Bob" delta = 0 print len(username) running = 1 while running: for event …

Member Avatar
Member Avatar
+0 forum 2

Can you please help !! Here, you see that const int size=25; Actually, How can i use infinite number like (n). I used "n" like bellow int n; const int size = n; however it only takes 8 values. My txt file can contained different value(n) evrytime, so, i dont want to keep the const int size fixed. please help me. If I keep const int value, i can't use for more/less number. To da this always i have to change const int size value. the software given bellow. #include<iostream> #include<fstream> #include<string> #include<cstdlib> #include<cmath> #include<iomanip> #include <windows.h> using namespace std; …

Member Avatar
Member Avatar
+0 forum 8

Hi, I am trying to write a program which read a certain input in a particular format and then gives an ouput. I wrote a code to read the file. Input is something like this. X 20 60 80 90 X 78 98 97 96 X 34 35 43 23 Y 76 87 34 Y 65 76 72 Z 13 70 39 So my reading function read the input and then it counts the number lines with X and Y. Now, when I wrote two different funcions to read X and Y lines. When I am finished reading the X …

Member Avatar
Member Avatar
+0 forum 4

sir i want to get data between to tag... example:(showing in my view source) <img class='stat_icon' src='/images/green.png'> **data to be extracted**</a> or like <input type=hidden name=timestamp value='**data to be extracted**'> for the first example i wrote like: Imports System.Text.RegularExpressions Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim requestt As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("my desired link") Dim responsee As System.Net.HttpWebResponse = requestt.GetResponse() Dim sr As System.IO.StreamReader = New System.IO.StreamReader(responsee.GetResponseStream()) Dim sourcecodee As String = sr.ReadToEnd() Dim pattern1 As String = "<img class='stat_icon' src='/images/red.png'> " & _ "(.*)</a>" Dim m As Match = Regex.Match(sourcecodee, pattern1) If m.Success Then …

Member Avatar
Member Avatar
+0 forum 4

I just wanted to show the basic usage of docopt, a module that makes parsing command-line arguments so much easier. I'm not affiliated with the creators of docopt, but I'm certainly thankful for their work and happy to post this little snippet. I will point you to [docopt.org](http://docopt.org) for more information because there is so much more you can do with this module, that I'm not showing you here. Watch the video, it was an eye-opener for me. Also, if you'd like to install docopt you can go to their [github repo](https://github.com/docopt/docopt) to download and install it. Try running this …

Member Avatar
+1 forum 0

I'm not well conversant with java or AJAX, but how can i read each line of a string display each line of question and answers at a time, after a user have answered the question id displays the next question upto the last one. Im using fget () n php to read line by line but dont know how to display one question and its respective answers at a time and be able to keep track of each submitted questions. Kindly assist with this I would highly appreciate. Here are the codes that I have: <?php $openFile = fopen("questionandanswers.txt", "r") …

Member Avatar
Member Avatar
+0 forum 9

The End.