Search Results

Search found 140 results on 6 pages for 'phillip gibson'.

Page 4/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • string maniupulations, oops, how do I replace parts of a string

    - by Joe Gibson
    I am very new to python. Could someone explain how I can manipulate a string like this? This function receives three inputs: complete_fmla: has a string with digits and symbols but has no hyphens ('-') nor spaces. partial_fmla: has a combination of hyphens and possibly some digits or symbols, where the digits and symbols that are in it (other than hyphens) are in the same position as in the complete_formula. symbol: one character The output that should be returned is: If the symbol is not in the complete formula, or if the symbol is already in the partial formula, the function should return the same formula as the input partial_formula. If the symbol is in the complete_formula and not in the partial formula, the function should return the partial_formula with the symbol substituting the hyphens in the positions where the symbol is, in all the occurrences of symbol in the complete_formula. For example: generate_next_fmla (‘abcdeeaa’, ‘- - - - - - - - ’, ‘d’) should return ‘- - - d - - - -’ generate_next_fmla (‘abcdeeaa’, ‘- - - d - - - - ’, ‘e’) should return ‘- - - d e e - -’ generate_next_fmla (‘abcdeeaa’, ‘- - - d e e - - ’, ‘a’) should return ‘a - - d e e a a’ Basically, I'm working with the definition: def generate_next_fmla (complete_fmla, partial_fmla, symbol): Do I turn them into lists? and then append? Also, should I find out the index number for the symbol in the complete_fmla so that I know where to append it in the string with hyphens??

    Read the article

  • How to check if something is stored in CoreData

    - by Terrel Gibson
    Hi I want to be able to tore some information in core data and but i am unsure of how to check if the file was saved properly. I tried using NSLog but it returns null when its called. I have a dictionary which has a uniqueID and a title which I want to save. I pass this in along with the context of the database. I then sort the database to check if it has any duplicates or not, if not then I add the file. +(VacationPhoto*) photoWithFlickrInfo: (NSDictionary*) flickrInfo inManagedObjectContext: (NSManagedObjectContext*) context{ //returns the dictionary NSLog(@"Photo To Store =%@", flickrInfo); VacationPhoto * photo = nil; NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"VacationPhoto"]; request.predicate = [NSPredicate predicateWithFormat:@"uniqueID = %@", [flickrInfo objectForKey:FLICKR_PHOTO_ID]]; NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES]; request.sortDescriptors = [NSArray arrayWithObject:descriptor]; NSError *error = nil; NSArray *matches = [context executeFetchRequest:request error:&error]; if (!matches || [matches count] > 1) { // handle error } else if ( [matches count] == 0){ photo.title = [flickrInfo objectForKey:FLICKR_PHOTO_TITLE]; //Returns NULL when called NSLog(@"title = %@", photo.title); photo.uniqueID = [flickrInfo objectForKey:FLICKR_PHOTO_ID]; //Returns NULL when called NSLog(@"ID = %@", photo.uniqueID); } else { //If photo already exists this is called photo = [matches lastObject]; } return photo; }

    Read the article

  • Arrays not matching correctly

    - by Nick Gibson
    userAnswer[] holds the string of the answer the user types in and is comparing it to answers[] to see if they match up and then spits out correct or wrong. j is equal to the question number. So if j was question 6, answers[j] should refer to answers[6] right? Then userAnswer[6] should compare to answers[6] and match if its correct. But its giving me wrong answers and displaying the answer I typed as correct. int abc, loopCount = 100; int j = quesNum, overValue, forLoop = 100; for (int loop = 1; loop < loopCount; loop++) { aa = r.nextInt(10+1); abc = (int) aa; String[] userAnswer = new String[x]; JOptionPane.showMessageDialog(null,abc); if(abc < x) { userAnswer[j] = JOptionPane.showInputDialog(null,"Question "+quesNum+"\n"+questions[abc]+"\n\nA: "+a[abc]+"\nB: "+b[abc]+"\nC: "+c[abc]+"\nD: "+d[abc]); if(userAnswer[j].equals(answers[j])) { JOptionPane.showMessageDialog(null,"Correct. \nThe Correct Answer is "+answers[abc]); } else { JOptionPane.showMessageDialog(null,"Wrong. \n The Correct Answer is "+answers[abc]); }//else }//if }//for

    Read the article

  • How do I secure a .NET Web Service for use by an iPhone application?

    - by David A Gibson
    Hello, The title says it all, I have a Web Service written in .NET that provides data for an iPhone application. It will also allow the application make a "reservation." Currently it's all internal to the corporate network but obviously when the iPhone application is published I will need ensure the Web Service is available externally. How would I go about securing the Web Service? There are two aspects I'm looking into: Authentication for accessing the web service Protection for the data being transferred I'm no so bothered about the data being passed back and forth as it will be viewable in the application anyway (which will be free). The key issue for me is preventing users from accessing the Web Service and making reservations themselves. At the moment I am considering encrypting any strings in the XML data passed back and forth so only the client can effectively use the web service sidestepping the need for authentication and providing protection for the data. This is the only model I have seen but I think the overheads on the iPhone and even for the web service make for a poor user experience. Any solutions at all would be most welcome? Thanks

    Read the article

  • ActionListener isn't Implementing

    - by Nick Gibson
    JFrameWithPanel is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener public class JFrameWithPanel extends JFrame implements ActionListener I Don't get this code. Book and Java site tells me this is the syntax for the method, but again this error shows up constantly. import javax.swing.*; import javax.swing.JOptionPane; import java.awt.*; import java.awt.event.*; import java.lang.Math.*; import java.lang.Integer.*; import java.util.*; import java.util.Random; import java.io.*; import java.text.*; import java.text.DecimalFormat.*; public class JFrameWithPanel extends JFrame implements ActionListener { JButton button = new JButton("Exit"); public JFrameWithPanel() { super("JFrame with Panel"); JComboBox packageChoice = new JComboBox(); packageChoice.addItem("A+ Certification"); packageChoice.addItem("Network+ Certification "); packageChoice.addItem("Security+ Certifictation"); packageChoice.addItem("CIT Full Test Package"); packageChoice.addActionListener(this); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel pane = new JPanel(); pane.add(button); pane.add(packageChoice); setContentPane(pane); setSize(200,100); setVisible(true); } } then later public class CreateJFrameWithPanel { public static void main(String[] args) { JFrameWithPanel panel = new JFrameWithPanel(); } }

    Read the article

  • In the JSON spec, what does "Since the first two characters of a JSON text will always be ASCII characters" mean?

    - by dan gibson
    The spec is http://www.ietf.org/rfc/rfc4627.txt?number=4627 It contains this: Encoding JSON text SHALL be encoded in Unicode. The default encoding is UTF-8. Since the first two characters of a JSON text will always be ASCII characters [RFC0020], it is possible to determine whether an octet stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking at the pattern of nulls in the first four octets. What does it mean "Since the first two characters of a JSON text will always be ASCII characters [RFC0020]"? I've looked at RFC0020 but couldn't find anything about it. JSON could be {" or { " (ie whitespace before the quote.

    Read the article

  • How do I automatically delete an Excel file after creating it on a server and returning it to the us

    - by David A Gibson
    Hello, I am creating an Excel file on a web server, using OleDb to connect the the physical (well as physical as it can be) file and appending records. I am then returning a FilePathResult to the user via MVC, and would like to delete the physical file afterwards due to data protection concerns over the appended records. I have tried using a File.Delete in a Finally clause but I get a File Not Found error which must mean the file has gone when MVC is trying to send the file to the user. I thought about creating the File as a MemoryStream but I think OleDb needs a physical file to connect to so this isn't an option. Any suggestions on how to delete the file after returning it in one operation? Thanks

    Read the article

  • Arrays not counting correctly

    - by Nick Gibson
    I know I was just asking a question earlier facepalm This is in Java coding by the way. Well after everyones VERY VERY helpful advice (thank you guys alot) I managed to get over half of the program running how I wanted. Everything is pointing in the arrays where I want them to go. Now I just need to access the arrays so that It prints the correct information randomly. This is the current code that im using: http://pastebin.org/301483 The specific code giving me problems is this: long aa; int abc; for (int i = 0; i < x; i++) { aa = Math.round(Math.random()*10); String str = Long.toString(aa); abc = Integer.parseInt(str); String[] userAnswer = new String[x]; if(abc > x) { JOptionPane.showMessageDialog(null,"Number is too high. \nNumber Generator will reset."); break; } userAnswer[i] = JOptionPane.showInputDialog(null,"Question "+quesNum+"\n"+questions[abc]+"\n\nA: "+a[abc]+"\nB: "+b[abc]+"\nC: "+c[abc]+"\nD: "+d[abc]); answer = userAnswer[i].compareTo(answers[i]); if(answer == 0) { JOptionPane.showMessageDialog(null,"Correct. \nThe Correct Answer is "+answers[abc]+""+i); } else { JOptionPane.showMessageDialog(null,"Wrong. \n The Correct Answer is "+answers[abc]+""+i); }//else

    Read the article

  • Unexpected return value

    - by Nicholas Gibson
    Program stopped compiling at this point: What is causing this error? (Error is at the bottom of post) public class JFrameWithPanel extends JFrame implements ActionListener, ItemListener { int packageIndex; double price; double[] prices = {49.99, 39.99, 34.99, 99.99}; DecimalFormat money = new DecimalFormat("$0.00"); JLabel priceLabel = new JLabel("Total Price: "+price); JButton button = new JButton("Check Price"); JComboBox packageChoice = new JComboBox(); JPanel pane = new JPanel(); TextField text = new TextField(5); JButton accept = new JButton("Accept"); JButton decline = new JButton("Decline"); JCheckBox serviceTerms = new JCheckBox("I Agree to the Terms of Service.", false); JTextArea termsOfService = new JTextArea("This is a text area", 5, 10); public JFrameWithPanel() { super("JFrame with Panel"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pane.add(packageChoice); setContentPane(pane); setSize(250,250); setVisible(true); packageChoice.addItem("A+ Certification"); packageChoice.addItem("Network+ Certification "); packageChoice.addItem("Security+ Certifictation"); packageChoice.addItem("CIT Full Test Package"); pane.add(button); button.addActionListener(this); pane.add(text); text.setEditable(false); text.setBackground(Color.WHITE); text.addActionListener(this); pane.add(termsOfService); termsOfService.setEditable(false); termsOfService.setBackground(Color.lightGray); pane.add(serviceTerms); serviceTerms.addItemListener(this); pane.add(accept); accept.addActionListener(this); pane.add(decline); decline.addActionListener(this); } public void actionPerformed(ActionEvent e) { packageIndex = packageChoice.getSelectedIndex(); price = prices[packageIndex]; text.setText("$"+price); Object source = e.getSource(); if(source == accept) { if(serviceTerms.isSelected() = false) // line 79 { JOptionPane.showMessageDialog(null,"Please accept the terms of service."); } else { JOptionPane.showMessageDialog(null,"Thanks."); } } } Error: \Desktop\Java Programming\JFrameWithPanel.java:79: unexpected type required: variable found : value if(serviceTerms.isSelected() = false) ^ 1 error

    Read the article

  • Setting Frame.Content doesn't always work

    - by dan gibson
    I have a Frame control and I'm setting the Content property. If I set it twice, first to one control then to another, it shows the first control instead of the second. If I display a message box after setting it the first time then it works fine (ie it displays the second control). It's like I can only set Content once until the screen has been repainted. Calling Frame.UpdateLayout also doesn't help. What should I call after setting Content so that I can be sure that Content is actually set to what I specify?

    Read the article

  • loop prematurely quitting

    - by Nick Gibson
    This loop works fine but prematurely quits at times. I set a piece of code in it so that I can view the random number. It only closes prematurely when the random number is equal to the highest numbered question the user inputs (Example...a user wants 10 questions, if the random number is 10 the program quits.) I have no idea why since i have it set to if(random number <= the number of questions) for ( int loop = 1; loop < loopCount; loop++ ) { aa = r.nextInt ( 10 + 1 ); abc = ( int ) aa; String[] userAnswer = new String[x]; JOptionPane.showMessageDialog ( null, abc ); if ( abc <= x ) { for ( overValue = 1; overValue < forLoop; overValue++ ); { userAnswer[j] = JOptionPane.showInputDialog ( null, "Question " + quesNum + "\n" + questions[abc] + "\n\nA: " + a[abc] + "\nB: " + b[abc] + "\nC: " + c[abc] + "\nD: " + d[abc] ); if ( userAnswer[j].equals ( answers[j] ) ) { JOptionPane.showMessageDialog ( null, "Correct. \nThe Correct Answer is " + answers[abc] ); } else { JOptionPane.showMessageDialog ( null, "Wrong. \n The Correct Answer is " + answers[abc] ); }//else }//for }//if }//for

    Read the article

  • Array returning Null values

    - by Nick Gibson
    Dunno why it is...heres the coding for it. http://pastebin.org/301343 I know theres a lot of repetitiveness in the coding...but its because the arrays were retuning null so I got tired of messing with them. Everything works until it reaches line 224, which returns null values.

    Read the article

  • Calculations coming out to 0.0?

    - by Nick Gibson
    A simple percentage calculation. It wont return a value except 0.0 and I think once or twice it returned 100.0%. Other than that it won't do a thing. I have tried playing with the code in several different ways and it just wont work. for (int loop = 1; loop < loopCount; loop++) { aa = r.nextInt(10+1); abc = (int) aa; String[] userAnswer = new String[x]; int totalQues = (correctAnswer + wrongAnswer), actualQues = (totalQues - 1); if(abc < x) { userAnswer[abc] = JOptionPane.showInputDialog(null,"Question "+quesNum+"\n\n"+questions[abc]+"\n\nA: "+a[abc]+"\nB: "+b[abc]+"\nC: "+c[abc]+"\nD: "+d[abc]+"\nCorrect Answers: "+correctAnswer+"\nWrong Answers: "+wrongAnswer+"\nTotal Questions: "+totalQues); if(userAnswer[abc].equals(answers[abc])) { correctAnswer++; } else { wrongAnswer++; }//else if(actualQues == x); { score = (correctAnswer / actualQues) * 100; JOptionPane.showMessageDialog(null,"The test is finished."); JOptionPane.showMessageDialog(null,"You scored "+score+"%"); }//if }//if }//for

    Read the article

  • Namespace and class conflict(?)

    - by dan gibson
    This is a bad title for the question, but I'm not quite sure of a better one. I have a namespace called Globals with a class X in it. I also have a class called Globals. When I try to access Globals.X.StaticMember it tries to access the class Globals.X and complains that X doesn't exist. How do I reference the namespace Globals - ie ::Globals.X.StaticMember (:: doesn't compile).

    Read the article

  • C# Windows Mobile 6.5 and TCP connections

    - by Phillip
    Hello, I am developing an application which makes a TCP connection out to our company server to pull down data and provide real-time data updates when the information changes. I am using the .NET Compact Framework for the development and the .NET Framework 3.5 (soon to update to 4.0) for the server-side TCP connection. I want to leave the connection open after the initial data is sent to the device from the server in order to keep the server in contact with the device should data updates need to be sent to the device. We already considered doing a WCF or connect/disconnect type of connection but we believe the overhead on the server for creating the session, transmitting and session cleanup would be unacceptable. (each device would be connecting every 60-90 seconds.) So, leaving the connection open is the best option. What I need to know is, when I leave the TCP connection open, do I need to manually transmit a heartbeat (and if so how do I do that with the .NET Compact Framework) or will the framework/stack do that for me? We have code that allows up to reconnect if the device gets disconnected (from network switching or a voice call) so that is handled. Thanks,

    Read the article

  • Copy .exe to Explorer.exe!

    - by Phillip
    What would happen if an ordinary .exe file is copied to explorer.exe? Will it be automatically running as long as explorer.exe is running? This seems like a major security whole...is it even possible? Does anti-virus protect against that sort of thing?

    Read the article

  • How do I get Java to use the serial port in Linux?

    - by Phillip Gibb
    We make use of a java application that manages a pinpad via the serial port. This works perfectly on windows with the Sun Comm.jar, the supplied dll and the properties file. Now we are attempting to use this solution on Linux (actually it does run on various other flavours of linux out in the field) - with Ubuntu server mode. After much attempts - blood, sweat and almost tears we have this scenario: Java version 1.4.2_17 Linux - Ubuntu Comm libs - Comm3 supplied by sun with the default driver specified An external comm test shows the comm ports: /dev/ttyS0 and /dev/ttyS1 But the java application says unable to open port /dev/ttyS1 (using the RXRT files produces invalid port errors) Has anyone been able to use java 1.4.2 on linux for serial port communication and found a solution that I could apply in my scenario? greatly appreciated Phill

    Read the article

  • How to add handler in dynamic datatemplate

    - by Phillip Ngan
    I am successfully declaring a data template in a code behind as follows: private static DataTemplate CreateTemplate(string sortMemberPath, HorizontalAlignment horzAlignment) { const string xamlFormat = "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" >" + "<StackPanel > " + " <TextBlock Margin=\"2,0\" VerticalAlignment=\"Center\" HorizontalAlignment=\"_HALIGNMENT_\" " + " Text=\"hello there\"> " + " </TextBlock> " + "</StackPanel>" + "</DataTemplate>"; return (DataTemplate) XamlReader.Load(xamlReturned); } But now I want to add a size changed handler by changing the line: + "<StackPanel > " to + "<StackPanel SizeChanged="SizeChangedHandler" > " I have the method "SizeChangedHandler" declared in the code behind. This results in a xaml parse error when the control attempts to load at runtime. I suspect that it can't find the handler "SizeChangedHandler". How can I specify this handler so that the xaml parser is happy.

    Read the article

  • Visual Studio Multi-Targeting (maintaing backwards compatability)

    - by Phillip Benages
    I know in Visual Studio 2008 you can target a specific framework with your projects, but from what I have been told if you open a project originally created in Visual Studio 2003 or 2005 in Visual Studio 2008, it requires you to upgrade the project to a 2008 project to work on it. Does Visual Studio 2010 have this same type of restriction for multi-targeting? It would be very nice being able to use features of 2010 when working in our projects that target different frameworks, but we do not want to force all of our developers to upgrade in order to continue working in these projects.

    Read the article

  • Visual Studio Multi-Targeting (maintaining backwards compatibility)

    - by Phillip Benages
    I know in Visual Studio 2008 you can target a specific framework with your projects, but from what I have been told if you open a project originally created in Visual Studio 2003 or 2005 in Visual Studio 2008, it requires you to upgrade the project to a 2008 project to work on it. Does Visual Studio 2010 have this same type of restriction? It would be very nice being able to use features of 2010 when working in our projects that target different frameworks, but we do not want to force all of our developers to upgrade in order to continue working in these projects.

    Read the article

  • Alternate cause of BadImageFormatException in .NET Assembly?

    - by Phillip Knauss
    I'm working on a .NET 3.5 console application in C# which uses a VC++ unmanaged DLL. It ran without a problem when I worked on it a few weeks ago, but I'm coming back to it today and am now getting a BadImageFormatException ("An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)). My development workstation is running 64bit Windows 7, and I do a fair amount of work with unmanaged code, so I immediately checked that the .NET assembly and the VC++ library both had x86 targets. They did. Just to be sure, I cleaned and rebuilt the VC++ library and the .NET assembly, to no avail. Neither system is doing anything particularly unusual. The VC++ library loads a binary data file and does some mathematical processing on its contents. The .NET assembly has the DllImports for the library and some code to wire it up. This all worked a few weeks ago. So now I'm left wondering if there's some other cause of BadImageFormatException that's less common than an x86/x64 conflict that I might be running into. Thanks.

    Read the article

  • Git-svn: create & push a new branch/tag?

    - by Phillip Oldham
    After cloning an SVN repository using git-svn with the -s option (git svn clone http://server/repo -s), how does one create a branch or tag and have pushed to the relevant branch/tag directory in the repository when dcommiting? For instance; if I were to use git to create a foobar branch locally (git checkout -b foobar) how can I have git-svn create the branch on the server (http://server/repo/branches/foobar)?

    Read the article

  • GUI design for color blindness

    - by Phillip Ngan
    It is common to represent status of an item in a GUI using the colors: red, yellow, green, to mean error, warning, and OK (or something equivalent). However, 7-10% of men have difficulty distinguishing between red and green because of color blindness. So far I've looked at Color Scheme Designer which simulates how people with different color blindnesses would perceive a set of colors, but I'm interested in hearing how you have approached this problem and how successful it was.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >