This is my custom module: [CODE]class Player(object): def __init__(self, name, score = 0): self.name = name self.score = score def __str__(self): rep = self.name + ":\t" + str(self.score) return rep def ask_yes_no(self, question): response = None while response not in ("y", "n"): response = input(question).lower() return response def ask_number(self, question, low, high): response = None while response not in range (low, high): response = int(input(question)) return response[/CODE] The program: [CODE]import games, random print "Welcome to the world's simplest game!\n" again = None while again != "n": players = [] num = games.ask_number(question = "How many players? (2-5): ", low = …

Member Avatar
Member Avatar
+0 forum 10

I can serialize an object if it's class definition has attributes. So if I have an object whose class does not have attributes, do I serialize the attributes importedi in it's class definition? For example; suppose I have the following class, #ifndef BREAD_H #define BREAD_H #include "EGGS.h"; #include "FLOUR.h"; class BREAD { public: BREAD();~BREAD(); //lame example std::vector<string> selectIngredient(std::vector<FLOUR>grocery); }; #endif How would I go about serializing attributes defined in the FLOUR.h class if incase I have to? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

Hi Dw I'm currently doing a research in how to create a system application file, the program that I'm creating will be visible to screen only when it has been called by the user other then that it will be running but doing nothing other then waiting to be called. So what I'm having a problem with is how to make a system application in VB.NET I want to publish it as a system file and when it installs it can install as system file because I don't want it to be visible at Installed programs tray or explorer just …

Member Avatar
Member Avatar
+0 forum 4

I would like to get **all** Equipment values. *I have used DOM Document.* It is reading **ONLY LAST Element**. *Equipment Id: 28*. I need all three. Thanks in advanced. XML File: <?xml version="1.0" encoding="UTF-8"?> -<Physical> <Catalog> </Catalog> -<Installed> -<Equipment> <Id>26</Id> <Ref>Tew12</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>160</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>30</CharacteristicValue> </Equipment> -<Equipment> <Id>27</Id> <Ref>Tew13</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>165</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>50</CharacteristicValue> </Equipment> -<Equipment> <Id>28</Id> <Ref>Tew14</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>190</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>50</CharacteristicValue> </Equipment> </Installed> </Physical> Expected Result: Id 26 Tilt 30 Id 27 Tilt 50 Id 28 Tilt 50 CODE: http://www.daniweb.com/web-development/php/threads/458094/how-to-get-nodevalue-with-xpathxmlphp

Member Avatar
Member Avatar
+0 forum 21

I use: Python 2.6 and sqlalchemy 0.6.1 This is what I am trying to do: from sqlalchemy.types import ( Integer, String, Boolean ) from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class SampleMeta(type): def __new__(cls, name, bases, attrs): attrs.update({ 'id': Column('Id', Integer, primary_key=True), 'name': Column('Name', String), 'description': Column('Description', String), 'is_active': Column('IsActive', Boolean) }) return super(SampleMeta, cls).__new__(cls, name, bases, attrs) class Sample(Base): __tablename__ = 'Sample' __table_args__ = {'useexisting': True} __metaclass__ = SampleMeta def __init__(self, id, name, description, is_active): self.id = id self.name = name self.description = description self.is_active = is_active def __repr__(self): return "<(%d, '%s', '%s', %r)>" % (self.id, self.name, self.description, self.isactive) …

Member Avatar
Member Avatar
+0 forum 1

Hi I am very new to xml and need some help!! I need to extract a certain value from nodes in an xml file, and then store that value in a variable in php. Have struggled through many internet solutions but are still unsuccessful. Any help would be appreciated. Here are the xml: <root> <sns id="1" type="1" status="0" unit="0" val="21.3" w-min="" w-max="" e-min-val=" 0.00" e-max-val=" 24.31" e-min-dte="00/00/2000 00:00:00" e-max-dte="06/26/2013 10:46:26"/> <sns id="2" type="2" status="0" unit="3" val="23.7" w-min="" w-max="" e-min-val=" 0.00" e-max-val=" 55.62" e-min-dte="00/00/2000 00:00:00" e-max-dte="06/26/2013 10:45:49"/> <sns id="3" type="3" status="0" unit="0" val="-0.2" w-min="" w-max="" e-min-val=" -1.07" e-max-val=" 14.37" e-min-dte="06/28/2013 07:09:53" …

Member Avatar
Member Avatar
+0 forum 1

I dont guess anyone could help me out on setting up my products tables could they? I did search and read through these posts: http://www.daniweb.com/web-development/databases/threads/123850/e-commerce-data-design-issue http://www.daniweb.com/web-development/databases/threads/132796/database-schema-for-a-store But I'm still not sure, Currently my site will only have 3 separate products, each with their own set of attributes. How should I post my ERD? I have it as public on my picasa album. Thanks ahead of time for any help/feedback !!!! Montgomery

Member Avatar
Member Avatar
+0 forum 9

I'm creating a python rest api wrapper to a website, i created a file called api.py, then used called the api using [requests](http://docs.python-requests.org/en/latest/), like so: `requests.get('http://example.com/api', auth=('username','apikey'))` How to create a class nammed Class1, then put the url in it using [urlparse](http://docs.python.org/library/urlparse.html), then create another file called example.py, call the class and let the user put his username and key.

Member Avatar
+0 forum 0

Hi guys, Just looking for some advice on database design. I'm relatively competent in MySQL (competent at a push, haha) and I'm in a bit of a pickle right now when I'm trying to generate products for a Magento store. Well, Magento is where it ends up, I currently use a mass importer called MAGMI which is awesome. My client wishes to convert his stock levels feed (Sage for anyone who's interested) into information on his website without having to do as less data input as possible. He sells electronics and white goods and I've been hooked up with a …

Member Avatar
Member Avatar
+0 forum 1

hi all, I want to update title block attributes of a dwg file using vb.net.please give me the code of this. thank you in advance.

Member Avatar
+0 forum 0

I have an xml file that looks like this; <?xml version="1.0" encoding="utf-8"?> <!--This file is generated by the program.--> <Product ID="23" Name="Soap" test="one"> <Price>10.00</Price> <OtherDetails> <BrandName>X Soap</BrandName> <Manufacturer>X Company</Manufacturer> </OtherDetails> </Product> I can use the following code to read the 'ID', 'Name', and 'test; XmlReader reader = XmlReader.Create("Products.xml"); while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "Product") { textBox1.AppendText(reader.GetAttribute(0)); textBox1.AppendText(reader.GetAttribute("Name")); textBox1.AppendText(reader.GetAttribute("2")); } } reader.Close(); } My problem is, how can I read the value in the elements like '10.00', 'X Soap', and 'X Company'?

Member Avatar
Member Avatar
+0 forum 5

I wrote an XML parser that works great to fit my needs, but I can't retrieve the root attribute nodes no matter what I try! So far I have the following code that works great to retrieve the child tag values: import xml.dom.minidom def parse(filename): xmlDoc = xml.dom.minidom.parse(filename) tag = xmlDoc.getElementsByTagName('date_time')[0].childNodes[0].nodeValue return tag Here is the XML data I'm parsing: <?xml version="1.0"?> <order type="buy" subtype="limit" orderID="7659"> <date_time>03:23:2012:11:50.35</date_time> <userID>Miss.Wanda.Sleeplate</userID> <stock_symbol>BROK</stock_symbol> <shares_ammount>50</shares_ammount> <limit>23.87</limit> </order> What I'm trying to get is the value of the attributes of the root **order** tag (**type, subtype, orderID**) Something like: node = tag.attributes['type'].value print node **>>> buy** …

Member Avatar
+0 forum 0

Hey guys...I have a MySql table like this. and [B]Grade [/B]column is a derived attribute. and it is based on [B]Marks[/B]. u know the basic thing. [CODE]create table Enrolled( student_id char(14), subject_code varchar(10), marks int, grade char(2) );[/CODE] I want to fill the [B]Grade[/B] column based on each student's marks. I don't want to fill it by my self. Can I use a function or a procedure or something? How can I do this? Tell me if i want to make my self more clear...ok..Thankx in advance!

Member Avatar
Member Avatar
+0 forum 6

In Java Create a file using any word processing program or text editor. Write an application that displays the file's name, containing folder size and time of last modification. Save as FileStatistics This is what I have with Attributes errors, what am I missing here ? Thanks <CODE> import java.nio.file.*; import java.nio.file.attribute.*; import java.nio.file.attribute.Attributes; import java.io.IOException; public class FileStatistics { public static void main(String[] args) { Path filePath = Paths.get("C:\\Java\\FileStatistics.txt"); try { BasicFileAttributes attr = Attributes.readBasicFileAttributes(filePath); System.out.println("Creation time " + attr.creationTime()); System.out.println("Last modified time " + attr.lastModifiedTime()); System.out.println("Size " + attr.size()); } catch(IOException e) { System.out.println("IO Exception"); } } } …

Member Avatar
Member Avatar
+0 forum 1

its been 6 days passed since i started making this assignment of mine it is to show how objectdatasource is used, until now, i still cannot getaway with this error, [B][U]The data source for GridView with id 'GridView1' did not have any properties or attributes from which to generate columns. Ensure that your data source has content.[/U][/B] is anybody can help me? and check what is wrong with my codes? [CODE]<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div style="background-color: #FFCC00" > &nbsp;<asp:GridView …

Member Avatar
Member Avatar
+0 forum 4

I'm trying to write out a series of objects as an XML file so they can be read in later. I have all the code to build the XML tree and set all the attributes, etc. I've looked through the whole tree in VS so I know all of my data is there. To write it to a file I use: [CODE] writer.WriteStartDocument(); writer.WriteStartElement("####"); node.WriteTo(writer); writer.WriteEndElement(); writer.Close(); [/CODE] It works - mostly. The last child from most of the branches is missing it's last attribute. The final last child has all of it's attributes, but all the others are missing …

Member Avatar
Member Avatar
+0 forum 6

I am selecting an image as part of a html form. Once selected, jQuery assigns a user-defined attribute of the image to a hidden form variable and passes it to form handler. Neat. Problem is when I dynamically add images that can be selected. I am using live function to ensure that the dynamically added image is highlighted when clicked - but the user-defined attribute is not being grabbed by jQuery. I think that when the page is first loaded, all the existing image attributes are loaded into the DOM, but when extra images are added with ajax, the DOM …

Member Avatar
Member Avatar
+0 forum 6

HI guys, i have split and xml in two parts, and in the root element element of the second one(which in this case is the output) want to add an attribute...but do not have any idea how to do this... my XML:[CODE]<DataSet> <Input> <Order OrderNo="tesco10" DocumentTYpe="0001"/> </Input> <Output> <Order OrderNo="Order1" CompanyCode="ABCD" OrderType="Sales"> <OrderLines> <OrderLine PrimeLine="1"/> </OrderLines> </Order> </Output> </DataSet> [/CODE] my xsl: [CODE]<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/DataSet/Output/Order"> <xsl:copy-of select="."/> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet>[/CODE] the output: [CODE]<?xml version="1.0" encoding="UTF-16"?><Order OrderNo="Order1" CompanyCode="ABCD" OrderType="Sales"> <OrderLines> <OrderLine PrimeLine="1" /> </OrderLines> </Order>[/CODE] desired output: [CODE] <?xml version="1.0" encoding="UTF-16"?> <Order OrderNo="Order1" CompanyCode="ABCD" OrderType="Sales" Value="10USD"> <OrderLines> <OrderLine PrimeLine="1" …

Member Avatar
Member Avatar
+0 forum 1

Hey All, am looking for a way to break an xml Tag line into tag and attributes. Say I have This line [code=xml] <event time="12:30" value="This is a Sample Value" type="event"> </event> [/code] I have this so far [code=python] # Open file to read f=open("myTest2.xml") #start reading File for line in f: linestart=line.find("<") newline=line[linestart:len(line)] #check for XML version if newline[0:2] == "<?": print "XML version Line : "+newline #get start tag if newline[0:1] == "<" and newline[1:2] != "?": x=newline.find(" ") y=newline.find(">") if str(x) == "-1" : temp=newline[1:y] else: temp = newline[1:x] #get attribute list attributeList = newline[x:len(newline)-2] print attributeList.split(" …

Member Avatar
Member Avatar
+0 forum 1

Hi, I was pondering this earlier and wasn't sure if it was possible. Say, for example you had 2 objects; [B]spam[/B] and [B]eggs[/B], and you wanted to create a function to change attributes - e.g. colour. So spam.colour = 'Blue' and eggs.colour = 'Green'. How would you change that attribute using a nice elegant function? An example of my thinking is below (I know it won't work, but hopefully you get my drift). [CODE] def changeColour(objName, colour): [INDENT]objName.colour=colour[/INDENT] [/CODE] I want to be able to change the attribute like this: [CODE]changeColour(spam, 'Blue')[/CODE] This is probably a daft question, and I …

Member Avatar
Member Avatar
+0 forum 1

Hey, I'm new to Python and wondering about the following bit of code. It tells me that the module random has no attribute randint. I've looked at the documentation and such and I think I'm doing it correctly, but obviously something's wrong. Any ideas? Thanks! [code] import random int1=random.randint(1, 6) int2=random.randint(1, 6) print "Die one was "+str(int1) print "Die two was "+str(int2) print "Your total was "+str(int1+int2) [/code]

Member Avatar
Member Avatar
+0 forum 5

Hi There, I have found a very usefull and lightweight code that is made by the famous Tim Van Damme, a Dutch compatriot. Here is the code, i will explain my question beneath. The js that works in combination with the js libary. [CODE]<script language="javascript" type="text/javascript"> jQuery(document).ready(function($) { $('.tabs').each(function () { var $links = $(this).find('a'), panelIds = $links.map(function() { return this.hash; }).get().join(","), $panels = $(panelIds), $panelwrapper = $panels.filter(':first').parent(), delay = 500, heightOffset = 10; // we could add margin-top + margin-bottom + padding-top + padding-bottom of $panelwrapper $panels.hide(); $links.hover(function () { var link = this, $link = $(this); // ignore …

Member Avatar
Member Avatar
+0 forum 7

Hi Im trying to make a script which when I click on the list element... it will replace a big image with anotehr picture. The list element is a thumbnail... and I want to swop the big image with the big version of the thumbnail. Each <li> has a rel attribute... but while I can pull out each <li> from the list, for some reason the following code, yields an 'undefined' value... instead of the big-image-path...? Help! [code] <li rel="kids_beach.jpg"> <img src="http://localhost/stirling/public/content/thumbs/kids_beach_thumb.jpg" border="0" /> </li> [/code] [code=js] //getting all <li> from the list of thumbnails var all_items = list.getElementsByTagName('li'); for(i …

Member Avatar
Member Avatar
+0 forum 2

I have python 3.0 and im trying to get this code to work but I don't believe it is recognizing all the attributes it's supposed to. [CODE]import pygame, sys, random from pygame.locals import * #*******************************************SETUPVAR************************************************** BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) ORANGE = (255,180,0) YELLOW=(230,230,0) #***********************************************DEFINE************************************************* def newscreen(): pygame.init() mainClock = pygame.time.Clock() windowSurface = pygame.display.set_mode((700,600), 0, 32) pygame.display.set_caption('test') BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, …

Member Avatar
Member Avatar
+0 forum 5

Why this Error may happend? I have to readjust huge application and I need the most supposed possibilities which make this kind of error.

Member Avatar
Member Avatar
+0 forum 3

Hello, I'm a Python/SPSS (DANIWEB) beginner and I'm having a hard time getting classes, functions and methods into the right order. I want to write a script for SPSS where I can read text out of an text object from the SPSS-output file. My code looks like this: [CODE=Python] import SpssClient SpssClient.StartClient() OutputDoc = SpssClient.GetDesignatedOutputDoc() OutputItems = OutputDoc.GetOutputItems() OutputDoc.ClearSelection() for index in range(OutputItems.Size()): OutputItems = OutputItems.GetItemAt(index) text = OutputItems.GetTextContents() if text.find(" Number of cases read: 0 Number of cases listed: 0") >= 0: OutputItems.SetSelected(True) SpssClient.StopClient() print "fertig!" OutputDoc.Delete()[/CODE] error Message:[COLOR="Red"] Traceback (most recent call last): File "\\io\userdaten\EPIDEMIOLOGIE\Matthias\- Skripte\DingeEntfernen.py", line 11, …

Member Avatar
Member Avatar
+0 forum 9

Trying to figure out how to parse the attribute value from an RSS feed which contains namespaces? Need to retrieve value "CA" from 'ac:country="CA"' in the code below. Thanks In Advance! [CODE]<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:ac="http://palm.com/app.catalog.rss.extensions"> <channel> <link>http://www.palm.com</link> <title>Device Apps for US</title> <description>Complete list of US Device channel applications for Palm webOS devices</description> <language>en-US</language> <pubDate>Thu, 10 Jun 2010 17:00:26 -0700</pubDate> <lastBuildDate>Thu, 10 Jun 2010 17:00:26 -0700</lastBuildDate> <ac:distributionChannel>Device</ac:distributionChannel> <ac:countryCode>US</ac:countryCode> <ac:feed_format_spec>2</ac:feed_format_spec> <item> <ac:localizations> <ac:localization ac:country="CA" ac:language="en"> <ac:title><![CDATA[BuildaSearch]]></ac:title> <ac:summary><![CDATA[BuildaSearch is the ultimate search solution. Sleek look and feel. Totally customize your search experience. Yahoo!, Yahoo! News, Bing, Bing News, Google, Google News, …

Member Avatar
Member Avatar
+0 forum 4

Hello, I'm trying to write some javascript that will always allow me to float content over a flah player. To do this, the <object> tag needs to have a <param> tag added to set the wmode to transparent, and the <embed> tag needs to have the wmode attribute set to transparent also. So the source will first look like: [CODE] <object width="560" height="340"> <param name="movie" value="http://www.youtube.com/v/V6dScKlrDwU&hl=en_GB&fs=1&"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/V6dScKlrDwU&hl=en_GB&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"> </embed> </object> [/CODE] And I want the javascript to change it to: [CODE] <object width="560" height="340"> <param name="movie" value="http://www.youtube.com/v/V6dScKlrDwU&hl=en_GB&fs=1&"></param> <param name="allowFullScreen" …

Member Avatar
Member Avatar
+0 forum 5

The End.