Search Results

Search found 2679 results on 108 pages for 'peter smith'.

Page 16/108 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Simple regex split

    - by user1383058
    I have the following string: string = "Peter Pan, Pete Sampras; Little Pete" And I need to split it up by name: split_string = ["Peter Pan", "Pete Sampras", "Little Pete"] I am trying to use re.findall but am having a bit of trouble with it: print re.findall(r'[,;]', string) [";", ";", ";"] What am I doing wrong here and how would I properly use re.findall here or an equivalent to split up the string?

    Read the article

  • preg_replace to capitalize a letter after a quote

    - by Summer
    I have names like this: $str = 'JAMES "JIMMY" SMITH' I run strtolower, then ucwords, which returns this: $proper_str = 'James "jimmy" Smith' I'd like to capitalize the second letter of words in which the first letter is a double quote. Here's the regexp. It appears strtoupper is not working - the regexp simply returns the unchanged original expression. $proper_str = preg_replace('/"([a-z])/',strtoupper('$1'),$proper_str); Any clues? Thanks!!

    Read the article

  • How to bulk insert from CSV when some fields have new line character?

    - by z-boss
    I have a CSV dump from another DB that looks like this (id, name, notes): 1001,John Smith,15 Main Street 1002,Jane Smith,"2010 Rockliffe Dr. Pleasantville, IL USA" 1003,Bill Karr,2820 West Ave. The last field may contain carriage returns and commas, in which case it is surrounded by double quotes. I use this code to import CSV into my table: BULK INSERT CSVTest FROM 'c:\csvfile.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) SQL Server 2005 bulk insert cannot figure out that carriage returns inside quotes are not row terminators. How to overcome?

    Read the article

  • Potential issues using member's "from" address and the "sender" header

    - by Paul Burney
    Hi all, A major component of our application sends email to members on behalf of other members. Currently we set the "From" address to our system address and use a "Reply-to" header with the member's address. The issue is that replies from some email clients (and auto-replies/bounces) don't respect the "Reply-to" header so get sent to our system address, effectively sending them to a black hole. We're considering setting the "From" address to our member's address, and the "Sender" address to our system address. It appears this way would pass SPF and Sender-ID checks. Are there any reasons not to switch to this method? Are there any other potential issues? Thanks in advance, -Paul Here are way more details than you probably need: When the application was first developed, we just changed the "from" address to be that of the sending member as that was the common practice at the time (this was many years ago). We later changed that to have the "from" address be the member's name and our address, i.e., From: "Mary Smith" <[email protected]> With a "reply-to" header set to the member's address: Reply-To: "Mary Smith" <[email protected]> This helped with messages being mis-categorized as spam. As SPF became more popular, we added an additional header that would work in conjunction with our SPF records: Sender: <[email protected]> Things work OK, but it turns out that, in practice, some email clients and most MTA's don't respect the "Reply-To" header. Because of this, many members send messages to [email protected] instead of the desired member. So, I started envisioning various schemes to add data about the sender to the email headers or encode it in the "from" email address so that we could process the response and redirect appropriately. For example, From: "Mary Smith" <[email protected]> where the string after "messages" is a hash representing Mary Smith's member in our system. Of course, that path could lead to a lot of pain as we need to develop MTA functionality for our system address. I was looking again at the SPF documentation and found this page interesting: http://www.openspf.org/Best_Practices/Webgenerated They show two examples, that of evite.com and that of egreetings.com. Basically, evite.com is doing it the way we're doing it. The egreetings.com example uses the member's from address with an added "Sender" header. So the question is, are there any potential issues with using the egreetings method of the member's from address with a sender header? That would eliminate the replies that bad clients send to the system address. I don't believe that it solves the bounce/vacation/whitelist issue since those often send to the MAIL FROM even if Return Path is specified.

    Read the article

  • Getting the name of a Clojure struct type?

    - by j-g-faustus
    When defining a struct type and instance, I can print the value and get the "struct" implementation type: (defstruct person :name :age) (def p (struct person "peter" 30)) user=> p {:name "peter", :age 30} user=> (type p) clojure.lang.PersistentStructMap But is it possible to tell whether p is an instance of the struct type "person"?

    Read the article

  • sql query - how to count values in a row separately?

    - by n00b0101
    I have a table that looks something like this: id | firstperson | secondperson 1 | jane doe | 2 | bob smith | margie smith 3 | master shifu | madame shifu 4 | max maxwell | I'm trying to count all of the firstpersons + all of the secondpersons, if the secondpersons field isn't blank... Is there a way to do that?

    Read the article

  • How to do a join that removes values?

    - by Georg
    Customers Holidays id | name customer_id | start | end ---+------ ------------+--------+------ 1 | Peter 1 | 5 | 10 2 | Simon 1 | 15 | 20 3 | Mary 2 | 5 | 20 How should my SQL query look that out of start=11,end=14 I get these customers: Peter Mary Is this even manageable with a simple SQL join, or do I need to use sub-queries?

    Read the article

  • How to write the content of a dictionary to a text file?

    - by codemonkie
    I have a dictionary object of type Dictionary and trying to use StreamWriter to output the entire content to a text file but failed to find the correct method from the Dictionary class. using (StreamWriter sw = new StreamWriter("myfile.txt")) { sw.WriteLine(dictionary.First()); } I can only retrieve the first element and it is bounded by a square bracket plus a comma separator in between as well: [Peter, Admin] and would be nice to have [Peter Admin] (without the comma)

    Read the article

  • excel change 4 rows / 48 col to 48 rows / 4 col

    - by GoodOlPete
    Hi, I've selected 4 database records of 48 fields into excel as below: FirstName LastName Age Address1 ....................... Andy smith 23 53 high st billy ball 43 23 the avenue charles brown 76 rose cottage dave green 43 station rd I want to display them as firstname andy billy charles dave lastname smith ball brown green age 23 43 76 43 address1.............................. Can anyone suggest how to do this?

    Read the article

  • Convert json data to javascript array - in multi-dimensional sense

    - by AW-GWTF899
    I have a json array say { "People": { "Person": [ {"FirstName": "John", "LastName": "Smith"} {"FirstName": "Joe", "LastName": "Bloggs"} {"FirstName": "Wendy", "LastName": "Deng"} ] } } And I want to convert this into a javascript array (something like this) var persons = [ ["FirstName", "John", "LastName", "Smith"], ["FirstName", "Joe", "LastName", "Bloggs"], ["FirstName", "Wendy", "LastName": "Deng"] ]; How do I accomplish this? Hope my question makes sense and I realise the javascript array initialization may not be the correct way to put it. Thanks.

    Read the article

  • How to merge two single column csv files with linux commands

    - by user1328191
    I was wondering how to merge two single column csv files into one file where the resulting file will contain two columns. file1.csv    first_name    chris    ben    jerry file2.csv    last_name    smith    white    perry result.csv    first_name,last_name    chris,smith    ben,white    jerry,perry Thanks

    Read the article

  • Is there a special character in mySql that would return always true in WHERE clauses?

    - by rm.
    Is there a character, say, $, SELECT * FROM Persons WHERE firstName='Peter' AND areaCode=$; such that the statement would return the same as SELECT * FROM Persons WHERE firstName='Peter' i.e. areaCode=$ would always return always true and, thus, effectively “turns of” the criteria areaCode=... I’m writing a VBA code in Excel that fetches some rows based on a number of criteria. The criteria can either be enabled or disabled. A character like $ would make the disabling so much easier.

    Read the article

  • Java delimiter reader

    - by newbieprogrammer
    I have a colon-delimited text file containing grouped, related data. The People group contains people's names followed by their ages, separated by colons. How can I parse the text and group people according to their ages? The structure is as follows: Group.txt Age:10:20:30:40: Group:G1:10:G2:30:G3:20:G4:40: People:Jack:10:Tom:30:Dick:20:Harry:10:Paul:10:Peter:20: People:Mary:20:Lance:10: And I want to display something like this: G1 Jack Harry Paul Lance G2 Dick Peter Marry G3 Tom G4

    Read the article

  • ruby restrict attr_accessor in subclass

    - by Arivarasan
    I want restrict the access of superclass's method in subclass class Parent attr_accessor :first_name, :last_name def initialize(first_name, last_name) @first_name, @last_name = first_name, last_name end def full_name @first_name + " " + @last_name end end class Son < Parent attr_accessor :first_name def initialize(parent, first_name) @first_name = first_name @last_name = parent.last_name end def full_name @first_name + " " + @last_name end end p = Parent.new("Bharat", "Chipli") puts p.full_name s = Son.new(p, "Harry") s.last_name= "Smith" puts s.full_name here i am getting son's full name as "Harry Smith", but i want "Harry Chipli"

    Read the article

  • How does the hash part in hash maps work?

    - by sub
    So there is this nice picture in the hash maps article on Wikipedia: Everything clear so far, except for the hash function in the middle. How can a function generate the right index from any string? Are the indexes integers in reality too? If yes, how can the function output 1 for John Smith, 2 for Lisa Smith, etc.?

    Read the article

  • JQuery.ajax(): Problem with parameter data when consuming a WCF Service

    - by Torben H.
    Hello, I'm using JQuery to consume a WCF Service. Actually this works fine: var para = ' { "Parameter" : { "ID" : "5", "Name" : "Peter" } }' $.ajax({ type: "POST", contentType: "application/json", data: para, url: url success: success }); But I don't want to pass the data parameter as String and I think it should be possible to pass ist as array in any way. Like that: var para = { "Parameter" : { "ID" : 5, "Name" : "Peter" } } But when I try this I'm getting an error. What I'm doing wrong? Thanks

    Read the article

  • Prepared transactions with Postgres 8.4.3 on CentOS

    - by peter
    I have set 'max_prepared_transactions' to 20 in the local postgres.config and yet the transaction fails with the following error trace (but only on Linux). Since in Windows the same code works seamlessly I am wandering if this isn't an issue of permission. What would be the solution? Thanks Peter 372300 [Atomikos:7] WARN atomikos - XA resource 'XADBMS': rollback for XID '3137332E3230332E3132362E3139302E746D30303030313030303037:3137332E3230332E3132362E3139302E746D31' raised -3: the XA resource detected an internal error org.postgresql.xa.PGXAException: Error rolling back prepared transaction at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:357) at com.atomikos.datasource.xa.XAResourceTransaction.rollback(XAResourceTransaction.java:873) at com.atomikos.icatch.imp.RollbackMessage.send(RollbackMessage.java:90) at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:86) at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:62) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) at java.lang.Thread.run(Thread.java:595) Caused by: org.postgresql.util.PSQLException: ERROR: prepared transaction with identifier "1096044365_MTczLjIwMy4xMjYuMTkwLnRtMDAwMDEwMDAwNw==_MTczLjIwMy4xMjYuMTkwLnRtMQ==" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:299) at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:347)

    Read the article

  • Binding Data to DataGridView in VB.Net

    - by Peter
    Hi, I have a bit of code which loads data from a stored procedure in MS SQL Server and then loads the data to a datagridview, which works fine. What i want is for the code that connects / loads the data to sit in my Database Class and then everything associated with the datagridview to be stored in my Form but i am having problems passing the contents of the bindingsource over to the Form from the Database Class. Form1 Public Class Form1 Dim myDatabaseObj As New Class1() Dim bindingSource1 As New BindingSource() Dim connectString As New SqlConnection Dim objDataAdapter As New SqlDataAdapter Dim table As New DataTable() Dim tabletest As New DataTable() Private Sub loadCompanyList() Try Me.dgv_CompanyList.DataSource = Me.bindingSource1 getCompanyList() Catch ex As NullReferenceException End Try End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load loadCompanyList() End Sub End Class Database Class When i try place the getCompanyList() in a class and then create a new object that references the Form() it does not seem to return any value from the table to the MyForm.BindingSource1.Datasource meaning my datagridview displays not data. ..... Private Sub getCompanyList() Try Dim myForm as new Form() connect_Transaction_Database() objDataAdapter.SelectCommand = New SqlCommand() objDataAdapter.SelectCommand.Connection = connectString objDataAdapter.SelectCommand.CommandText = "sp_GetCompanyList" objDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure Dim commandBuilder As New SqlCommandBuilder(Me.objDataAdapter) Dim table As New DataTable() table.Locale = System.Globalization.CultureInfo.InvariantCulture Me.objDataAdapter.Fill(table) **MyForm.bindingSource1.DataSource = table** Catch ex As DataException MsgBox(ex.Message) Catch ex As NullReferenceException MsgBox(ex.Message) End Try disconnect_Transaction_Database() End Sub If anyone could help. Thank you. Peter

    Read the article

  • I want to merge two PostScript Documents, pagewise. How?

    - by Peter Miehle
    hello, i have a tricky question, so i need to describe my problem: i need to print 2-sided booklets (a third of a paper) on normal paper (german A4, but letter is okay also) and cut the paper afterwards. The Pages are in a Postscript Level 2 File (generated by an ancient printer driver, so no chance to patch that, except ps2ps) generated by me with the ancient OS's Printing driver facilities (GpiMove, GpiLine, GpiText etc). I do not want to throw away two-thirds of the paper, so my idea is: Take file one, two and three, merge them (how?) on new double-sided papers by translate/move file two and three by one resp. two thirds and print the resulting new pages. If it helps, I can manage to print one page of the booklet per file. I cannot "speak" postscript natively, but I am capable of parsing and merging and manipulating files programmaticly. Maybe you can hint me to a webpage. I've read through the manuals on adobe's site and followed the links on www.inkguides.com/postscript.asp Maybe there are techniques with PDF that would help? I can translate ps2pdf. Thanks for help Peter Miehle PS: my current solution: i.e. 8 pages: print page 1, 4 and 7 on page one, 2,5,8 on page two and 3,6,blank on page three, cut the paper and restack. But i want to use a electrical cutting machine, which works better with thicker stacks of paper.

    Read the article

  • Exclude string from wildcard in bash

    - by Peter O'Doherty
    Hi, I'm trying to adapt a bash script from "Sams' Teach Yourself Linux in 24 Hours" which is a safe delete command called rmv. The files are removed by calling rmv -d file1 file2 etc. In the original script a max of 4 files can by removed using the variables $1 $2 $3 $4. I want to extend this to an unlimited number of files by using a wildcard. So I do: for i in $* do mv $i $HOME/.trash done The files are deleted okay but the option -d of the command rmv -d is also treated as an argument and bash objects that it cannot be found. Is there a better way to do this? Thanks, Peter #!/bin/bash # rmv - a safe delete program # uses a trash directory under your home directory mkdir $HOME/.trash 2>/dev/null # four internal script variables are defined cmdlnopts=false delete=false empty=false list=false # uses getopts command to look at command line for any options while getopts "dehl" cmdlnopts; do case "$cmdlnopts" in d ) /bin/echo "deleting: \c" $2 $3 $4 $5 ; delete=true ;; e ) /bin/echo "emptying the trash..." ; empty=true ;; h ) /bin/echo "safe file delete v1.0" /bin/echo "rmv -d[elete] -e[mpty] -h[elp] -l[ist] file1-4" ;; l ) /bin/echo "your .trash directory contains:" ; list=true ;; esac done if [ $delete = true ] then for i in $* do mv $i $HOME/.trash done /bin/echo "rmv finished." fi if [ $empty = true ] then /bin/echo "empty the trash? \c" read answer case "$answer" in y) rm -i $HOME/.trash/* ;; n) /bin/echo "trashcan delete aborted." ;; esac fi if [ $list = true ] then ls -l $HOME/.trash fi

    Read the article

  • Problem with NSUserDefaults and deallocated Instance

    - by Peter A
    Hi, I'm having a problem with NSUserDefaults. I've followed the steps in the books as closely as I can for my app, but still get the same problem. I am getting a *** -[NSUserDefaults integerForKey:]: message sent to deallocated instance 0x3b375a0 error when I try and load in the settings. Here is the code that I have, it is in the App Delegate class. - (void)applicationDidFinishLaunching:(UIApplication *)application { recordingController = [[RecordingTableViewController alloc] initWithStyle:UITableViewStylePlain]; [recordingController retain]; // Add the tab bar controller's current view as a subview of the window [window addSubview:tabBarController.view]; [self loadSettings]; } -(void)loadSettings { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSNumber loop = [defaults objectForKey:@"loop_preference"]; NSNumber play = [defaults objectForKey:@"play_me_preference"]; NSNumber volume = [defaults objectForKey:@"volume_preference"]; } As you can see I am not trying to do anything with the values yet, but I get the error on the line reading in the loop preference. I also get it if I try and read an NSString. Any suggestions would be greatly appreciated. Thanks Peter

    Read the article

  • Dynamic Google Maps API InfoWindow HTML Content

    - by Peter Hanneman
    I am working in Flash Builder 4 with Google Map's ActionScript API. I have created a map, loaded some custom markers onto it and added some MouseEvent listeners to each marker. The trouble comes when I load an InfoWindow panel. I want to dynamically set the htmlContent based off of information stored in a database. The trouble is that this information can change every couple of seconds and each marker has a unique data set so I can not statically set it at the time I actually create the markers. I have a method that will every minute or so load all of the records from my database into an Object variable. Everything I need to display in the htmlContent is contained in this object under a unique identifier. The basic crux of the problem is that there is no way for me to uniquely identify an info window, so I can not determine what information to pull into the panel. marker.addEventListener(MapMouseEvent.ROLL_OVER, function(e:MapMouseEvent):void { showInfoWindow(e.latLng) }, false, 0, false); That is my mouse event listener. The function I call, "showInfowindow" looks like this: private function showInfoWindow(latlng:LatLng):void { var options:InfoWindowOptions = new InfoWindowOptions({title: appData[*I NEED A UNIQUE ID HERE!!!*].type + " Summary", contentHTML: appData[*I NEED A UNIQUE ID HERE!!!*].info}); this.map.openInfoWindow(latlng, options); } I thought I was onto something by being able to pass a variable in my event listener declaration, but it simply hates having a dynamic variable passed through, it only returns the last value use. Example: marker.addEventListener(MapMouseEvent.ROLL_OVER, function(e:MapMouseEvent):void { showInfoWindow(e.latLng, record.unit_id) }, false, 0, false); That solution is painfully close to working. I iterate through a loop to create my markers when I try the above solution and roll over a marker I get information, but every marker's information reflects whatever information the last marker created had. I apologize for the long explaination but I just wanted to make my question as clear as possible. Does anyone have any ideas about how to patch up my almost-there-solution that I posted at the bottom or any from the ground up solutions? Thanks in advance, Peter Hanneman

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >