Search Results

Search found 4763 results on 191 pages for 'adams john'.

Page 84/191 | < Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >

  • How to read a csv file with python

    - by john
    Hello, I'm trying to read a csv file but it doesn't work. I can read my csv file but when I see what I read, there where white space between values. Here is my code # -*- coding: iso-8859-1 -*- import sql_db, tmpl_macros, os import security, form, common import csv class windows_dialect(csv.Dialect): """Describe the usual properties of unix-generated CSV files.""" delimiter = ',' quotechar = '"' doublequote = 1 skipinitialspace = 0 lineterminator = 'n' quoting = csv.QUOTE_MINIMAL def reco(d): cars = {210:'"', 211:'"', 213:"'", 136:'à', 143:'è', 142:'é'} for c in cars: d = d.replace(chr(c),cars[c]) return d def page_process(ctx): if ctx.req_equals('catalog_send'): if 'catalog_file' in ctx.locals.__dict__: contenu = ctx.locals.catalog_file[0].file.read() #contenu.encode('') p = csv.reader(contenu, delimiter=',') inserted = 0 modified = 0 (cr,db) = sql_db.cursor_get() for line in p: if line: logfile = open('/tmp/test.log', 'a') logfile.write(line[0]) logfile.write('\n') logfile.write('-----------------------------\n') logfile.close()

    Read the article

  • .NET photo processing component

    - by John Williams
    Hi folks! I'm looking for a .NET image processing component or an open source alternative to automate the following tasks: Photo capture (webcams and photo cameras) Photo printing (grid/strip modes) Applying photo effects Saving photos AtalaSoft DotImage is quite expensive, any other suggestions are welcome. Thanks J

    Read the article

  • How do I set a ComboBox default *not in the drop down* when a list item begins with the same text as a drop down item?

    - by John Conrad
    Using C#, say you have a ComboBox that has a DropDownStyle set to DropDown (there are items in the drop down but the user can manually enter a value as well). How do you set a default value for the ComboBox that is not in the list of values in the drop down, but begins with text from a possible selection? Normally setting ComboBox.Text works fine, but if there is an item in the drop down that begins with the text you want as the default, it automatically selects the first item in the list that starts with the text. For example: Values in the drop down: c:\program files\ c:\windows\ d:\media\ Default Value Assignment myComboBox.Text = "C:\"; Result Initial value of ComboBox when the form opens is "c:\program files\". So what am I doing wrong? How do I correctly set a default value of an item not in the drop down list that begins with a possible selection?

    Read the article

  • fwrite = unblocking ?

    - by John Michaels
    Since you can't be sure that what you write with fwrite has been written (god thats an awesome sentence) before you call fflush can i consider fwrite a nonblocking write?? And if not, why not and what are my alternatives?

    Read the article

  • How to convert many-to-one XML data to DataSet?

    - by TruMan1
    I have an XML document that has a collection of objects. Each object has a key/value pair of label and value. I am trying to convert this into a DataSet, but when I do ds.ReadXml(xmlFile), then it creates two columns: label and value. What I would like is to have a column for each "label" and the value to be part of the row. here is my sample of the XML: <responses> <response> <properties id="1" Form="Account Request" Date="Tuesday, March 16, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain1.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="2" Form="Account Request" Date="Tuesday, March 17, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John2</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain2.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="3" Form="Account Request" Date="Tuesday, March 18, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John3</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain3.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="4" Form="Account Request" Date="Tuesday, March 19, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain4.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> </responses> How would I convert this to a DataSet so that I can load it into a gridview with the columns: Name, Email, Website, Phone, Place of Birth, Misc, Comments, and Agree to Terms? Then row 1 would be: John, [email protected], http://domain1.com, 999-999-9999, Earth, Misc, , True How can I do this with the XML provided?

    Read the article

  • nested ordered ol lists in html

    - by John
    Hi I have a nested ordered list. <ol> <li>first</li> <li>second <ol> <li>second nested first element</li> <li>second nested secondelement</li> <li>second nested thirdelement</li> </ol> </li> <li>third</li> <li>fourth</li> </ol> Currently the nested elements start back from 1 again, e.g. first second second nested first element second nested second element second nested third element third fourth What I want is for the second elements to be like this: first second 2.1. second nested first element 2.2. second nested second element 2.3. second nested third element third fourth Is there a way of doing this? Thanks

    Read the article

  • CodeGolf: Brothers

    - by John McClane
    Hi guys, I just finished participating in the 2009 ACM ICPC Programming Conest in the Latinamerican Finals. These questions were for Brazil, Bolivia, Chile, etc. My team and I could only finish two questions out of the eleven (not bad I think for the first try). Here's one we could finish. I'm curious to seeing any variations to the code. The question in full: ps: These questions can also be found on the official ICPC website available to everyone. In the land of ACM ruled a greeat king who became obsessed with order. The kingdom had a rectangular form, and the king divided the territory into a grid of small rectangular counties. Before dying the king distributed the counties among his sons. The king was unaware of the rivalries between his sons: The first heir hated the second but not the rest, the second hated the third but not the rest, and so on...Finally, the last heir hated the first heir, but not the other heirs. As soon as the king died, the strange rivaly among the King's sons sparked off a generalized war in the kingdom. Attacks only took place between pairs of adjacent counties (adjacent counties are those that share one vertical or horizontal border). A county X attacked an adjacent county Y whenever X hated Y. The attacked county was always conquered. All attacks where carried out simultanously and a set of simultanous attacks was called a battle. After a certain number of battles, the surviving sons made a truce and never battled again. For example if the king had three sons, named 0, 1 and 2, the figure below shows what happens in the first battle for a given initial land distribution: INPUT The input contains several test cases. The first line of a test case contains four integers, N, R, C and K. N - The number of heirs (2 <= N <= 100) R and C - The dimensions of the land. (2 <= R,C <= 100) K - Number of battles that are going to take place. (1 <= K <= 100) Heirs are identified by sequential integers starting from zero. Each of the next R lines contains C integers HeirIdentificationNumber (saying what heir owns this land) separated by single spaces. This is to layout the initial land. The last test case is a line separated by four zeroes separated by single spaces. (To exit the program so to speak) Output For each test case your program must print R lines with C integers each, separated by single spaces in the same format as the input, representing the land distribution after all battles. Sample Input: Sample Output: 3 4 4 3 2 2 2 0 0 1 2 0 2 1 0 1 1 0 2 0 2 2 2 0 0 1 2 0 0 2 0 0 0 1 2 2 Another example: Sample Input: Sample Output: 4 2 3 4 1 0 3 1 0 3 2 1 2 2 1 2

    Read the article

  • Weather API for web app

    - by john
    Hi, In the weather.com site it has forecast for 10 days. For example, in this url: http://www.weather.com/weather/narrative/GRXX0004 I cannot seem to find a feed for that kind of data. Could I pull a feed for each one of those days? Is there something I am missing? How could I easily parse data for 10 days? Thank you!

    Read the article

  • How can i bundle other files when using cx_freeze?

    - by Mridang Agarwalla
    I'm using Python 2.6 and cx_Freeze 4.1.2 on a Windows system. I've created the setup.py to build my executable and everything works fine. When cx_Freeze runs it movies everything to the build directory. I have some other files that i would like included in my build directory. How can i do this? Here's my structure. src\ setup.py janitor.py README.txt CHNAGELOG.txt helpers\ uncompress\ unRAR.exe unzip.exe Here's my snippet: setup ( name='Janitor', version='1.0', description='Janitor', author='John Doe', author_email='john[email protected]', url='http://www.this-page-intentionally-left-blank.org/', data_files = [ ('helpers\uncompress', ['helpers\uncompress\unzip.exe']), ('helpers\uncompress', ['helpers\uncompress\unRAR.exe']), ('', ['README.txt']) ], executables = [ Executable\ ( 'janitor.py', #initScript ) ] ) I can't seem to get this to work. Do i need a MANIFEST.in file? Thank you.

    Read the article

  • WPF - Binding a color resource to the data object within a DataTemplate

    - by John
    I have a DataTemplate and a SolidColorBrush in the DataTemplate.Resources section. I want to bind the color to a property of the same data object that the DataTemplate itself is bound to. However, this does not work. The brush is ignored. Why? <DataTemplate DataType="{x:Type data:MyData}" x:Name="dtData"> <DataTemplate.Resources> <SolidColorBrush x:Key="bg" Color="{Binding Path=Color, Converter={StaticResource colorConverter}" /> </DataTemplate.Resources> <Border CornerRadius="15" Background="{StaticResource bg}" Margin="0" Opacity="0.5" Focusable="True"> </DataTemplate>

    Read the article

  • Changing Element Value in Existing XML File Using DOM

    - by rylic38
    Hi All, I am trying to find examples of how to change an existing xml files Element Value. Using the following xml example: <book> <title>My Book</title> <author>John Smith</author> </book> If I wanted to replace the author element value 'John Smith' with 'Jim Johnson' in a Python script using DOM, how would I go about doing so? I've tried to look for examples on this, but have failed in doing so. Any help would be greatly appreciated. Regards, Rylic

    Read the article

  • MDX - Using "iif" function in the "Where" section

    - by Duc Duy Nguyen
    Hi I'd like to know how to make that "iif" work. Basically, I need to filter the engineering "product codes" when originator is "John Smith". currentmember is not working or that iif is not working, SELECT { ( [Time].[Fiscal Hierarchy Time Calculations].[Month to Date], [Measures].[Sell - Bookings] ) } ON COLUMNS, [Originators].[Originator One Letter Name].Children ON ROWS FROM [Sales] WHERE ( [Time].[Fiscal Month].&[2010-02-01T00:00:00], IIF ( [Originators].[Originator One Letter Name].CurrentMember = "John Smith", Except ( [Product Codes].[Product Primary Subcategory].Children, [Product Codes].[Product Primary Subcategory].&[ENGINEERING] ), [Product Codes].[Product Primary Subcategory].Children ) ); Any ideas? Thanks in advance. Duy

    Read the article

  • iphone com.apple.product-type.tool

    - by John Smith
    Hello I am having trouble compiling a static library for the iPhone. It worked in the past. It keeps saying "target specifies 'com.apple.product-type.tool' but there is no such product for the 'iphoneos' platform. I have rechecked the static compilation flag.

    Read the article

  • How do I pass a callback function to sqlite3_exec on iOS 5.1?

    - by John Doh
    I am new to both xcode/iOS/Objective-C and sqlite. I am trying to teach myself the basics - and I would like to use the sqlite3 wrapper "sqlite3_exec" for a select query. For some reason, I can't find a simple example anywhere of someone doing this. Basically, the method has a parameter (the third one) for a callback function: int sqlite3_exec( sqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */ ); That's fine. I'm no stranger to callbacks. However, I just can't seem to get the syntax down right. I took over one of the view controllers in my iPad (iOS 5.1) xcode (4.3) project, and made the changes shown below: #import "SecondViewController.h" #import "sqlite3.h" #import "AppState.h" @interface SecondViewController () @end @implementation SecondViewController - (int)myCallback:(void *)a_parm argc:(int)argc argv:(char **)argv column:(char **)column { return 0; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //grab questionnaire names char *sql = "select * from QST2Main order by [Name]"; char *err = nil; sqlite3 *db = [[AppState sharedManager] getgCn]; sqlite3_exec(db, sql, myCallback, nil, &err); } Essentially, I want to run a query when this view first loads, to store some data for later use. But, XCode doesn't like the "myCallback" usage at the bottom there. It says: Undeclared Use of Identifier 'myCallback.' That method is declared in the header file, and I've even tried making it static. Nothing seems to make this error go away. I know I must be doing something fundamentally wrong here, but for the life of me I can't figure out what - I can't even find other code samples in this area that could help me figure out what I'm missing. Many thanks!

    Read the article

  • Personalization in ASP.Net MVC -- friendly URLs, and skinning

    - by larryq
    Hi everyone, I haven't delved into custom generation of friendly URLs in ASP.Net MVC, and was wondering if anyone had suggestions. For example, if John Smith were to create an account on www.example.com, I'd like for his homepage to read www.example.com/JohnSmith -- along with the option for him to choose his URL. The ideal is for this to happen with no intervention on my part in the route maps. Also, does anyone have guidelines on good ways to go to customize an MVC site based on URL? Again, using example.com I'd like for John to choose a color theme and logo for his homepage, then apply it accordingly. Thanks for your tips and suggestions.

    Read the article

  • Open source Mac video streaming server solutions?

    - by John Wright
    In my application, I want to stream videos shot on an iPhone, *.movie files, from a server running on a Mac desktop to an iPhone or iPad client. What are some possible open source servers that do this that are small enough to be shipped or embedded with a downloadable Mac app? There is a product StreamToMe by Matt Gallagher that does this. I noticed a lot of open source alternatives like ffmpeg, VideoLan, and the like but I not sure which one would be good for the Mac.

    Read the article

  • CSS Child selectors in IE7 tables

    - by John
    I'm trying to use the CSS child selector in IE7, and it doesn't seem to work. I have nested tables. My outer table has a class name "mytable", and I want the td's of the outer table to show borders. I don't want the inner table td's to have borders. I think I should be able to have CSS that looks like this: .mytable { border-style: solid } .mytable>tr>td { border-style: solid } But the second line seems to have no effect. If I change the second line to make it less specific, it applies to all the td's - I see too many borders. td { border-style: solid } So I think it really is just an issue with the selectors. Pages like this suggest that IE7 should be able to do what I want. Am I doing something silly? Here's the whole HTML file: <html> <head> <style type="text/css"> .mytable { border-style: solid; border-collapse: collapse;} td { border-style: solid; } </style> </head> <body> <table class="mytable"> <tr> <td>Outer top-left</td> <td>Outer top-right</td> </tr> <tr> <td>Outer bottom-left</td> <td> <table> <tr> <td>Inner top-left</td> <td>Inner top-right</td> </tr> <tr> <td>Inner bottom-left</td> <td>Inner bottom-right</td> </tr> <table> </td> </tr> <table> </body> </html>

    Read the article

  • Implementing Custom Membership Provider Membership User Issues

    - by john doe
    I am trying to implement a custom membership provider and want to change the GetUser method. The problem is that GetUser returns MembershipUser and I want to return MyMembershipUser which has two additional properties FirstName and LastName. I can create a new method in my membership provider which returns MyMembershipUser but then I think it won't make any sense. How would I go about doing this?

    Read the article

  • reuse proxy call data for extjs store

    - by user124118
    I have a xml that i need to bind to XTemplate. The XML structure is as follows John Smith John Doe Johny Byrd I am using Ext.data.Store with proxyurl tot he xml, Ext.data.XML reader to rad the xml and a listener that bind the data to the Xtemplate. The xmlreader needs a root node to be specified and i have to give root name as "Student_Name" It need to bind it to one more store for "Faculty_Name" as the root node. SO i end up calling my service to get xml twice. Is there a way to call service once to get the xml and bind it to two stores with different root nodes.

    Read the article

  • SQL DISTINCT Value Question

    - by CPOW
    How can I filter my results in a Query? example I have 5 Records John,Smith,apple Jane,Doe,apple Fred,James,apple Bill,evans,orange Willma,Jones,grape Now I want a query that would bring me back 3 records with the DISTINCT FRUIT, BUT... and here is the tricky part, I still want the columns for First Name , Last Name. PS I do not care which of the 3 it returns mind you, but I need it to only return 3 (or what ever how many DISTINCT fruit there are. ex return would be John,Smith,apple Bill,evans,orange Willma,Jones,grape Thanks in advance I've been banging my head on this all day.

    Read the article

  • IErrorHandler doesn't seem to be handling my errors in WCF .. any ideas?

    - by John Nicholas
    Have been readign around on IErrorHandler and want to go the config route. so, I have read the following in an attempt to implement it. MSDN Keyvan Nayyeri blog about the type defintion Rory Primrose Blog I have got it to compile and from the various errors i have fixed it seems like WCF is actually loading the error handler. My problem is that the exception that i am throwing to handle in the error handler doesn;t get the exception passed to it. My service implementation simply calls a method on another class that throws ArgumentOutOfRangeException - however this exception never gets handled by the handler. My web.config <system.serviceModel> <bindings> <basicHttpBinding> <binding name="basic"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <extensions> <behaviorExtensions> <add name="customHttpBehavior" type="ErrorHandlerTest.ErrorHandlerElement, ErrorHandlerTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> </behaviorExtensions> </extensions> <behaviors> <serviceBehaviors> <behavior name="exceptionHandlerBehaviour"> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true"/> <customHttpBehavior /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="exceptionHandlerBehaviour" name="ErrorHandlerTest.Service1"> <endpoint binding="basicHttpBinding" bindingConfiguration="basic" contract="ErrorHandlerTest.IService1" /> </service> </services> Service Contract [ServiceContract] public interface IService1 { [OperationContract] [FaultContract(typeof(GeneralInternalFault))] string GetData(int value); } The ErrorHandler class public class ErrorHandler : IErrorHandler , IServiceBehavior { public bool HandleError(Exception error) { Console.WriteLine("caught exception {0}:",error.Message ); return true; } public void ProvideFault(Exception error, MessageVersion version, ref Message fault) { if (fault!=null ) { if (error is ArgumentOutOfRangeException ) { var fe = new FaultException<GeneralInternalFault>(new GeneralInternalFault("general internal fault.")); MessageFault mf = fe.CreateMessageFault(); fault = Message.CreateMessage(version, mf, fe.Action); } else { var fe = new FaultException<GeneralInternalFault>(new GeneralInternalFault(" the other general internal fault.")); MessageFault mf = fe.CreateMessageFault(); fault = Message.CreateMessage(version, mf, fe.Action); } } } public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters) { } public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { IErrorHandler errorHandler = new ErrorHandler(); foreach (ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatchers) { ChannelDispatcher channelDispatcher = channelDispatcherBase as ChannelDispatcher; if (channelDispatcher != null) { channelDispatcher.ErrorHandlers.Add(errorHandler); } } } public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { } } And the Behaviour Extension Element public class ErrorHandlerElement : BehaviorExtensionElement { protected override object CreateBehavior() { return new ErrorHandler(); } public override Type BehaviorType { get { return typeof(ErrorHandler); } } }

    Read the article

  • TableView Cells unresponsive

    - by John Donovan
    I have a TableView and I wish to be able to press several cells one after the other and have messages appear. At the moment the cells are often unresponsive. I found some coed for a similar problem someone was kind enough to post, however, although he claimed it worked 100% it doesn't work for me. The app won't even build. Here's the code: -(UIView*) hitTest:(CGPoint)point withEvent:(UIEvent*)event { // check to see if the hit is in this table view if ([self pointInside:point withEvent:event]) { UITableViewCell* newCell = nil; // hit is in this table view, find out // which cell it is in (if any) for (UITableViewCell* aCell in self.visibleCells) { if ([aCell pointInside:[self convertPoint:point toView:aCell] withEvent:nil]) { newCell = aCell; break; } } // if it touched a different cell, tell the previous cell to resign // this gives it a chance to hide the keyboard or date picker or whatever if (newCell != activeCell) { [activeCell resignFirstResponder]; self.activeCell = newCell; // may be nil } } // return the super's hitTest result return [super hitTest:point withEvent:event]; } With this code I get this warning: that my viewController may not respond to pointsInside:withEvent (it's a TableViewController). I also get some faults: request for member 'visibleCells' in something not a structure or a union. incompatible type for argument 1 of pointInsideWithEvent, expression does not have a valid object type and similar. I must admit I'm not so good at reading other people's code but I was wondering whether the problems here are obvious and if so if anyone could give me a pointer it would be greatly appreciated.

    Read the article

  • How to determine the maximum integer the model can handle?

    - by John Mee
    "What is the biggest integer the model field that this application instance can handle?" We have sys.maxint, but I'm looking for the database+model instance. We have the IntegerField, the SmallIntegerField, the PositiveSmallIntegerField, and a couple of others beside. They could all vary between each other and each database type. I found the "IntegerRangeField" custom field example here on stackoverflow. Might have to use that, and guess the lowest common denominator? Or rethink the design I suppose. Is there an easy way to work out the biggest integer an IntegerField, or its variants, can cope with?

    Read the article

< Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >