Search Results

Search found 305 results on 13 pages for 'philip baker'.

Page 6/13 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Exporting to PNG from Adobe Illustrator cutting off edges

    - by Luther Baker
    I created a 40px x 40px image in Adobe Illustrator CS4. I saved as an .ai file and then tried to export as a PNG. Adobe Illustrator automatically crops the background and tightens the export to a rect around all the objects which if fine. In this case, I am not working edge to edge so my image is not quite 40px wide. But, unfortunately, Illustrator is not exporting the entire image. I end up with an image that is 34px wide. Indeed, the icon I draw starts on the left hand side but the right edge of my object cut off. Any ideas why this is happening? I can't imagine Illustrator CS4 can't correctly to export to PNG.

    Read the article

  • Using a UITextView in a UITableViewCell with a UIKeyboard

    - by Luther Baker
    I have a simple UITableView that has two cells. Cell 0:0 consists of a UITextField we'll call the title and Cell 0:1 consists of a UITextView we'll simply call a note. Cell 0:0 (the text field) is a standard size, one row cell. I'm therefore trying to fill the rest of the screen up with Cell 0:1 so I return a larger height for it. This all displays just fine and I'm using most of the iPhone real estate pretty efficiently at this point. Now, when a user wants to edit one of these cells, he need only click in the appropriate textfield or textview. If a user clicks in the textfield of Cell 0:0, all is well and the keyboard slides up from the bottom. My problem occurs when a user clicks into the the textview (Cell 0:1). No matter what I try, the UITableView wants to slide the entire table view up and that generally put the UITextView in Cell 0:1 halfway out of sight. What I want to do is two fold, I'm registered for when the keyboard will appear and in that method, I'd like to shrink the UITextView in Cell 0:1 as well as shrink the UITableViewCell itself so that the keyboard doesn't have to be smart and think it has to slide the UITableViewCell into view. Unfortunately, no matter what I try, the UITableView slides up. I just want the UITableView to stand still and I want the cell to animate up/shorter with the keyboard. It appears that, by the time the keyboard is actually animating into the screen - it is to late to adjust the cell size. The UIKit has already made up it's mind that it is going to scroll the UITableView.

    Read the article

  • Consuming "Event Tracing for Windows" events

    - by Paul Baker
    An answer to this question has led me to look into using "Event Tracing for Windows" for our tracing needs. I have come across NTrace, which seems to be a good way to produce ETW events from C# code (using the XP-compatible "classic provider" model). However, I am unable to find an easy way to consume these events - to see them in real-time and/or log them to a file. The only way I have found is that described in the NTrace documentation: using a tool which is only available as part of the Windows DDK. In the case of a complex problem in the field, we may need to ask the user to produce a file containing a trace. We can't ask users to download the DDK or carry out a number of complex operations in order to do this. Is there a straightforward, user-friendly way to log ETW events to a file? Also, is it possible for someone to consume ETW events on Windows Vista/7 if they are not running as administrator?

    Read the article

  • Getting JRuby to work in RubyMine

    - by John Baker
    I setup the proper SDK because all my ruby code will compile but RubyMine complains that it can't find the any of my java classes? Is this a flaw or is there a way to get it to recognizewhere the classes are? Here is my code, I have underlined all the things its complaining about require 'java' include_class 'java.awt.event.ActionListener' include_class 'javax.swing.JButton' include_class 'javax.swing.JFrame' class ClickAction include ActionListener def action_performed(event) puts "Button got clicked." end end Is there a way around this because I'd love to buy RubyMine if it's able to inform me of what Java classes and methods I can pick from. Thanks

    Read the article

  • How to Solve N-Queens Problem in Scheme?

    - by Philip
    Hi, I'm stuck on the extended exercise 28.2 of How to Design Programs. Here is the link to the question: http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-35.html#node_chap_28 I used a vector of true or false values to represent the board instead of using a list. This is what I've got which doesn't work: #lang Scheme (define-struct posn (i j)) ;takes in a position in i, j form and a board and returns a natural number that represents the position in index form ;example for board xxx ; xxx ; xxx ;(0, 1) - 1 ;(2, 1) - 7 (define (board-ref a-posn a-board) (+ (* (sqrt (vector-length a-board)) (posn-i a-posn)) (posn-j a-posn))) ;reverse of the above function ;1 - (0, 1) ;7 - (2, 1) (define (get-posn n a-board) (local ((define board-length (sqrt (vector-length a-board)))) (make-posn (floor (/ n board-length)) (remainder n board-length)))) ;determines if posn1 threatens posn2 ;true if they are on the same row/column/diagonal (define (threatened? posn1 posn2) (cond ((= (posn-i posn1) (posn-i posn2)) #t) ((= (posn-j posn1) (posn-j posn2)) #t) ((= (abs (- (posn-i posn1) (posn-i posn2))) (abs (- (posn-j posn1) (posn-j posn2)))) #t) (else #f))) ;returns a list of positions that are not threatened or occupied by queens ;basically any position with the value true (define (get-available-posn a-board) (local ((define (get-ava index) (cond ((= index (vector-length a-board)) '()) ((vector-ref a-board index) (cons index (get-ava (add1 index)))) (else (get-ava (add1 index)))))) (get-ava 0))) ;consume a position in the form of a natural number and a board ;returns a board after placing a queen on the position of the board (define (place n a-board) (local ((define (foo x) (cond ((not (board-ref (get-posn x a-board) a-board)) #f) ((threatened? (get-posn x a-board) (get-posn n a-board)) #f) (else #t)))) (build-vector (vector-length a-board) foo))) ;consume a list of positions in the form of natural number and consumes a board ;returns a list of boards after placing queens on each of the positions on the board (define (place/list alop a-board) (cond ((empty? alop) '()) (else (cons (place (first alop) a-board) (place/list (rest alop) a-board))))) ;returns a possible board after placing n queens on a-board ;returns false if impossible (define (placement n a-board) (cond ((zero? n) a-board) (else (local ((define available-posn (get-available-posn a-board))) (cond ((empty? available-posn) #f) (else (or (placement (sub1 n) (place (first available-posn) a-board)) (placement/list (sub1 n) (place/list (rest available-posn) a-board))))))))) ;returns a possible board after placing n queens on a list of boards ;returns false if all the boards are not valid (define (placement/list n boards) (cond ((empty? boards) #f) ((zero? n) (first boards)) ((not (boolean? (placement n (first boards)))) (first boards)) (else (placement/list n (rest boards)))))

    Read the article

  • UIToolbar UIBarButtonItem Alignment question

    - by Luther Baker
    I need to create a UIToolbar that has two UIBarButtonItems. The 1st button must be centered and the 2nd item must be right aligned. I understand and use Flexible spacing and it works great when I need to balance buttons across the UIToolbar, but with only two buttons, I can't seem to perfectly center the middle button. I've even initialized the view.toolbarItems array with NSArray *items = [[NSArray alloc] initWithObjects:fixed, flex, center_button, flex, right_button, nil]; and set fixed.width = right_button.width ... but still, the center_button is never perfectly centered.

    Read the article

  • Is there an algorithm for converting quaternion rotations to Euler angle rotations?

    - by Will Baker
    Is there an existing algorithm for converting a quaternion representation of a rotation to an Euler angle representation? The rotation order for the Euler representation is known and can be any of the six permutations (i.e. xyz, xzy, yxz, yzx, zxy, zyx). I've seen algorithms for a fixed rotation order (usually the NASA heading, bank, roll convention) but not for arbitrary rotation order. Furthermore, because there are multiple Euler angle representations of a single orientation, this result is going to be ambiguous. This is acceptable (because the orientation is still valid, it just may not be the one the user is expecting to see), however it would be even better if there was an algorithm which took rotation limits (i.e. the number of degrees of freedom and the limits on each degree of freedom) into account and yielded the 'most sensible' Euler representation given those constraints. I have a feeling this problem (or something similar) may exist in the IK or rigid body dynamics domains. Solved: I just realised that it might not be clear that I solved this problem by following Ken Shoemake's algorithms from Graphics Gems. I did answer my own question at the time, but it occurs to me it may not be clear that I did so. See the answer, below, for more detail. Just to clarify - I know how to convert from a quaternion to the so-called 'Tait-Bryan' representation - what I was calling the 'NASA' convention. This is a rotation order (assuming the convention that the 'Z' axis is up) of zxy. I need an algorithm for all rotation orders. Possibly the solution, then, is to take the zxy order conversion and derive from it five other conversions for the other rotation orders. I guess I was hoping there was a more 'overarching' solution. In any case, I am surprised that I haven't been able to find existing solutions out there. In addition, and this perhaps should be a separate question altogether, any conversion (assuming a known rotation order, of course) is going to select one Euler representation, but there are in fact many. For example, given a rotation order of yxz, the two representations (0,0,180) and (180,180,0) are equivalent (and would yield the same quaternion). Is there a way to constrain the solution using limits on the degrees of freedom? Like you do in IK and rigid body dynamics? i.e. in the example above if there were only one degree of freedom about the Z axis then the second representation can be disregarded. I have tracked down one paper which could be an algorithm in this pdf but I must confess I find the logic and math a little hard to follow. Surely there are other solutions out there? Is arbitrary rotation order really so rare? Surely every major 3D package that allows skeletal animation together with quaternion interpolation (i.e. Maya, Max, Blender, etc) must have solved exactly this problem?

    Read the article

  • KeyboardWillShow with UITextView

    - by Philip J
    Here's the setup: I have a textView (txtReply) where the user puts information I have a UIView that contains a scroll view and some labels, as well as the textView (ChatView) When the user selects the textView, then it brings the keyboard up. I use 'keyboardWillAppear' to move the 'ChatView' up so that the text view is still visible. I then have a reply button that submits the message, draws it into the ChatView, and calls [textView resignFirstResponder]. However, when I do this, it calls the keyboardWillHide, my view resizes, then the it brings the keyboard back up again. Is there something special you have to do to get the keyboard to stay hidden? Thanks

    Read the article

  • I keep on getting "save operation failure" after any change on my XCode Data Model

    - by Philip Schoch
    I started using Core Data for iPhone development. I started out by creating a very simple entity (called Evaluation) with just one string property (called evaluationTopic). I had following code for inserting a fresh string: - (void)insertNewObject { // Create a new instance of the entity managed by the fetched results controller. NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [newManagedObject setValue:@"My Repeating String" forKey:@"evaluationTopic"]; // Save the context. NSError *error; if (![context save:&error]) { // Handle the error... } [self.tableView reloadData]; } This worked perfectly fine and by pushing the +button a new "My Repeating String" would be added to the table view and be in persistent store. I then pressed "Design - Add Model Version" in XCode. I added three entities to the existing entity and also added new properties to the existing "Evaluation" entity. Then, I created new files off the entities by pressing "File - New File - Managed Object Classes" and created a new .h and .m file for my four entities, including the "Evaluation" entity with Evaluation.h and Evaluation.m. Now I changed the model version by setting "Design - Data Model - Set Current Version". After having done all this, I changed my insertMethod: - (void)insertNewObject { // Create a new instance of the entity managed by the fetched results controller. NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity]; Evaluation *evaluation = (Evaluation *) [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [evaluation setValue:@"My even new string" forKey:@"evaluationSpeechTopic"]; // Save the context. NSError *error; if (![context save:&error]) { // Handle the error... } [self.tableView reloadData]; } This does not work though! Every time I want to add a row the simulator crashes and I get the following: "NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'" I had this error before I knew about creating new version after changing anything on the datamodel, but why is this still coming up? Do I need to do any mapping (even though I just added entities and properties that did not exist before?). In the Apple Dev tutorial it sounds very easy but I have been struggling with this for long time, never worked after changing model version.

    Read the article

  • NSFetchedResultsController not updating UITableView's section indexes

    - by Luther Baker
    I am populating a UITableViewController with an NSFetchedResultsController with results creating sections that populate section headers and a section index. I am using the following method to populate the section index: - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { return [fetchedResultsController_ sectionIndexTitles]; } and now I've run into a problem. When I add a new element to the NSManagedObjectContext associated with the NSFetchedResultsController, the new element is saved and appropriately displayed as a cell in the UITableView ... except for one thing. If the new element creates a new SECTION, the new section index does not show up in the right hand margin unless I pop the UINavigationController's stack and reload the UITableViewController. I have conformed to the NSFetchedResultsControllerDelegate's interface and manually invoke [self.tableView reloadSectionIndexTitles]; at the end of both these delegate methods: controller:didChangeSection... controller:didChangeObject... and while I can debug and trace the execution into the methods and see the reload call invoked, the UITableView's section index never reflects the section changes. Again, the data shows up - new sections are physically visible (or removed) in the UITableView but the section indexes are not updated. Am I missing something?

    Read the article

  • Fastest way to calculate a 128-bit integer modulo a 64-bit integer

    - by Paul Baker
    I have a 128-bit unsigned integer A and a 64-bit unsigned integer B. What's the fastest way to calculate A % B - that is the (64-bit) remainder from dividing A by B? I'm looking to do this in either C or assembly language, but I need to target the 32-bit x86 platform. This unfortunately means that I cannot take advantage of compiler support for 128-bit integers, nor of the x64 architecture's ability to perform the required operation in a single instruction.

    Read the article

  • clientaccesspolicy.xml not being requested via HTTPS

    - by Philip
    I have a silverlight app that has been using http to communicate w/self-hosted WCF services during development. I am now securing the services via https. I am getting an error I had back at the beginning of the project: "An error occurred while trying to make a request to URI 'https://localhost:8303/service'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details." My clientaccesspolicy.xml file is setup to allow access from http://* and https://*. The only difference is using http vs https. The issue is I can usually see (via Fiddler) the clientaccesspolicy.xml file being requested, but now I cannot. I'm assuming it is failing because of this. Any ideas?

    Read the article

  • The Clocks on USACO

    - by philip
    I submitted my code for a question on USACO titled "The Clocks". This is the link to the question: http://ace.delos.com/usacoprob2?a=wj7UqN4l7zk&S=clocks This is the output: Compiling... Compile: OK Executing... Test 1: TEST OK [0.173 secs, 13928 KB] Test 2: TEST OK [0.130 secs, 13928 KB] Test 3: TEST OK [0.583 secs, 13928 KB] Test 4: TEST OK [0.965 secs, 13928 KB] Run 5: Execution error: Your program (`clocks') used more than the allotted runtime of 1 seconds (it ended or was stopped at 1.584 seconds) when presented with test case 5. It used 13928 KB of memory. ------ Data for Run 5 ------ 6 12 12 12 12 12 12 12 12 ---------------------------- Your program printed data to stdout. Here is the data: ------------------- time:_0.40928452 ------------------- Test 5: RUNTIME 1.5841 (13928 KB) I wrote my program so that it will print out the time taken (in seconds) for the program to complete before it exits. As can be seen, it took 0.40928452 seconds before exiting. So how the heck did the runtime end up to be 1.584 seconds? What should I do about it? This is the code if it helps: import java.io.; import java.util.; class clocks { public static void main(String[] args) throws IOException { long start = System.nanoTime(); // Use BufferedReader rather than RandomAccessFile; it's much faster BufferedReader f = new BufferedReader(new FileReader("clocks.in")); // input file name goes above PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("clocks.out"))); // Use StringTokenizer vs. readLine/split -- lots faster int[] clock = new int[9]; for (int i = 0; i < 3; i++) { StringTokenizer st = new StringTokenizer(f.readLine()); // Get line, break into tokens clock[i * 3] = Integer.parseInt(st.nextToken()); clock[i * 3 + 1] = Integer.parseInt(st.nextToken()); clock[i * 3 + 2] = Integer.parseInt(st.nextToken()); } ArrayList validCombination = new ArrayList();; for (int i = 1; true; i++) { ArrayList combination = getPossibleCombinations(i); for (int j = 0; j < combination.size(); j++) { if (tryCombination(clock, (int[]) combination.get(j))) { validCombination.add(combination.get(j)); } } if (validCombination.size() > 0) { break; } } int [] min = (int[])validCombination.get(0); if (validCombination.size() > 1){ String minS = ""; for (int i=0; i<min.length; i++) minS += min[i]; for (int i=1; i<validCombination.size(); i++){ String tempS = ""; int [] temp = (int[])validCombination.get(i); for (int j=0; j<temp.length; j++) tempS += temp[j]; if (tempS.compareTo(minS) < 0){ minS = tempS; min = temp; } } } for (int i=0; i<min.length-1; i++) out.print(min[i] + " "); out.println(min[min.length-1]); out.close(); // close the output file long end = System.nanoTime(); System.out.println("time: " + (end-start)/1000000000.0); System.exit(0); // don't omit this! } static boolean tryCombination(int[] clock, int[] steps) { int[] temp = Arrays.copyOf(clock, clock.length); for (int i = 0; i < steps.length; i++) transform(temp, steps[i]); for (int i=0; i<temp.length; i++) if (temp[i] != 12) return false; return true; } static void transform(int[] clock, int n) { if (n == 1) { int[] clocksToChange = {0, 1, 3, 4}; add3(clock, clocksToChange); } else if (n == 2) { int[] clocksToChange = {0, 1, 2}; add3(clock, clocksToChange); } else if (n == 3) { int[] clocksToChange = {1, 2, 4, 5}; add3(clock, clocksToChange); } else if (n == 4) { int[] clocksToChange = {0, 3, 6}; add3(clock, clocksToChange); } else if (n == 5) { int[] clocksToChange = {1, 3, 4, 5, 7}; add3(clock, clocksToChange); } else if (n == 6) { int[] clocksToChange = {2, 5, 8}; add3(clock, clocksToChange); } else if (n == 7) { int[] clocksToChange = {3, 4, 6, 7}; add3(clock, clocksToChange); } else if (n == 8) { int[] clocksToChange = {6, 7, 8}; add3(clock, clocksToChange); } else if (n == 9) { int[] clocksToChange = {4, 5, 7, 8}; add3(clock, clocksToChange); } } static void add3(int[] clock, int[] position) { for (int i = 0; i < position.length; i++) { if (clock[position[i]] != 12) { clock[position[i]] += 3; } else { clock[position[i]] = 3; } } } static ArrayList getPossibleCombinations(int size) { ArrayList l = new ArrayList(); int[] current = new int[size]; for (int i = 0; i < current.length; i++) { current[i] = 1; } int[] end = new int[size]; for (int i = 0; i < end.length; i++) { end[i] = 9; } l.add(Arrays.copyOf(current, size)); while (!Arrays.equals(current, end)) { incrementWithoutRepetition(current, current.length - 1); l.add(Arrays.copyOf(current, size)); } int [][] combination = new int[l.size()][size]; for (int i=0; i<l.size(); i++) combination[i] = (int[])l.get(i); return l; } static int incrementWithoutRepetition(int[] n, int index) { if (n[index] != 9) { n[index]++; return n[index]; } else { n[index] = incrementWithoutRepetition(n, index - 1); return n[index]; } } static void p(int[] n) { for (int i = 0; i < n.length; i++) { System.out.print(n[i] + " "); } System.out.println(""); } }

    Read the article

  • Programmer productivity by programming language?

    - by Jason Baker
    In code complete, there's a nice table listing how productive a programmer is depending on language. Jeff Atwood has a nice blog post about it. This chart is at least 4 years old by now. I'm curious: have there been any more recent studies done on this? (insert standard anti-flamewar boilerplate here... we're all adults) Update: I appreciate everyone's opinions on the subject and whether or not this is a relevant question or not. But that's not really what I'm asking for. I'm wanting any studies on the subject. I'm inclined to agree with most of the opinions posted thus far, but I'd like to see if there's any research to back that up. And I'm also aware that choice of programming language is a complicated subject that depends on other factors like developer familiarity. To me, this is all the more reason to have these kinds of discussions backed by research. Also, thanks for the link, Robert Gamble.

    Read the article

  • Best way to learn SQL Server

    - by Jason Baker
    So I'm getting a new job working with databases (Microsoft SQL Server to be precise). I know nothing about SQL much less SQL Server. They said they'd train me, but I want to take some initiative to learn about it on my own to be ahead. Where's the best place to start (tutorials, books, etc)? I want to learn more about the SQL language moreso than any of the fancy point and click stuff.

    Read the article

  • What is the difference between an Abstract Syntax Tree and a Concrete Syntax Tree?

    - by Jason Baker
    I've been reading a bit about how interpreters/compilers work, and one area where I'm getting confused is the difference between an AST and a CST. My understanding is that the parser makes a CST, hands it to the semantic analyzer which turns it into an AST. However, my understanding is that the semantic analyzer simply ensures that rules are followed. I don't really understand why it would actually make any changes to make it abstract rather than concrete. Is there something that I'm missing about the semantic analyzer, or is the difference between an AST and CST somewhat artificial?

    Read the article

  • Where's the Win32 resource for the mouse cursor for dragging splitters?

    - by Luther Baker
    I am building a custom win32 control/widget and would like to change the cursor to a horizontal "splitter" symbol when hovering over a particular vertical line in the control. IE: I want to drag this vertical line (splitter bar) left and right (WEST and EAST). Of the the system cursors (OCR_*), the only cursor that makes sense is the OCR_SIZEWE. Unfortunately, that is the big, awkward cursor the system uses when resizing a window. Instead, I am looking for the cursor that is about 20 pixels tall and around 3 or 4 pixel wide with two small arrows pointing left and right. I can easily draw this and include it as a resource in my application but the cursor itself is so prevalent that I wanted to be sure it wasn't missing something. For example: when you use the COM drag and drop mechanism (CLSID_DragDropHelper, IDropTarget, etc) you implicitly have access to the "drag" icon (little box under the pointer). I didn't see an explicit OCR_* constant for this guy ... so likewise, if I can't find this splitter cursor outright, I am wondering if it is part of a COM object or something else in the win32 lib.

    Read the article

  • ActiveX Control Drag and Drop in C sharp

    - by Philip
    I'm making Windows Form App in C sharp and best control for what I need is ActiveX Control (Calendar). The problem is that I need drag and drop but Control that I use does not have events for it (only positive thing is that it has property "AllowDrop"). (Control is Xtreme Calendar - Codejock)

    Read the article

  • (partial apply str) and apply-str in clojure's ->

    - by Jason Baker
    If I do the following: user=> (-> ["1" "2"] (partial apply str)) #<core$partial__5034$fn__5040 clojure.core$partial__5034$fn__5040@d4dd758> ...I get a partial function back. However, if I bind it to a variable: user=> (def apply-str (partial apply str)) #'user/apply-str user=> (-> ["1" "2" "3"] apply-str) "123" ...the code works as I intended it. I would assume that they are the same thing, but apparently that isn't the case. Can someone explain why this is to me?

    Read the article

  • Can MFMailComposeViewController attach an XML doc to an HTML message?

    - by Luther Baker
    I am creating an email in MFMaiilComposeViewController and if I simply create some html snippets and assign them to the message body - all is well. The resulting email (in GMail and Yahoo) looks like the original HTML I sent. [mailMan_ setMessageBody:body isHTML:YES]; On the other hand, if I also include an XML attachment, my email reader renders everything as plain text … including, the XML inlined. IE: my mail client (GMail, Yahoo) shows the raw HTHML and XML tags - including html tags that I didn't supply - ie: the html, head, body tags the iPhone provides around the content: NSData *opmlData = [[NSData alloc] initWithData:[opml dataUsingEncoding:NSUTF8StringEncoding]]; NSString *fileName = [NSString stringWithFormat:@"%f.opml", [NSDate timeIntervalSinceReferenceDate]]; [mailMan_ addAttachmentData:opmlData mimeType:@"text/xml" fileName:fileName]; I pop3'd the mails to see what was happening and found that WITHOUT an attachment, the resulting html section of the email contains this block: --0-1682099714-1273329398=:59784 Content-Type: text/html; charset=us-ascii <html><body bgcolor="#FFFFFF"><div><h2 style="b while on the other hand, WITH the XML attachment, the iPhone is sending this: --0-881105825-1273328091=:50337 Content-Type: text/plain; charset=us-ascii <html><body bgcolor="#FFFFFF"><div><h2 style="bac Notice the difference? Look at the Content-Type … text/html vs text/plain. It looks like when I include an XML attachment, the iPhone is errantly tagging the HTML version of the body as plain text! Just to clarify, technically, both with and without the attachment, the iPhone also includes this: --0-881105825-1273328091=:50337 Content-Type: text/plain; charset=us-ascii Notebook Carpentry Bathroom floor tile Bathroom wall tile Scrape thinset But this obviously isn't where the problem lies. Am I doing something wrong? What must I do to actually "attach" XML without the iPhone labeling the entire HTML body as plain text. I tried reversing the assignments (attachment first and then body) but no luck. For what it's worth, the email looks perfect from the iPhone's sending interface. Indeed, the HTML renders correctly and the attachment looks like a little icon at the bottom of the message. This problem has more to do with what the iPhone is actually sending.

    Read the article

  • Significant figures in the decimal module

    - by Jason Baker
    So I've decided to try to solve my physics homework by writing some python scripts to solve problems for me. One problem that I'm running into is that significant figures don't always seem to come out properly. For example this handles significant figures properly: from decimal import Decimal >>> Decimal('1.0') + Decimal('2.0') Decimal("3.0") But this doesn't: >>> Decimal('1.00') / Decimal('3.00') Decimal("0.3333333333333333333333333333") So two questions: Am I right that this isn't the expected amount of significant digits, or do I need to brush up on significant digit math? Is there any way to do this without having to set the decimal precision manually? Granted, I'm sure I can use numpy to do this, but I just want to know if there's a way to do this with the decimal module out of curiosity.

    Read the article

  • Fluent NHibermate and Polymorphism and a Newbie!

    - by Andy Baker
    I'm a fluent nhibernate newbie and I'm struggling mapping a hierarchy of polymorhophic objects. I've produced the following Model that recreates the essence of what I'm doing in my real application. I have a ProductList and several specialised type of products; public class MyProductList { public virtual int Id { get; set; } public virtual string Name {get;set;} public virtual IList<Product> Products { get; set; } public MyProductList() { Products = new List<Product>(); } } public class Product { public virtual int Id { get; set; } public virtual string ProductDescription {get;set;} } public class SizedProduct : Product { public virtual decimal Size {get;set;} } public class BundleProduct : Product { public virtual Product BundleItem1 {get;set;} public virtual Product BundleItem2 {get;set;} } Note that I have a specialised type of Product called BundleProduct that has two products attached. I can add any of the specialised types of product to MyProductList and a bundle Product can be made up of any of the specialised types of product too. Here is the fluent nhibernate mapping that I'm using; public class MyListMap : ClassMap<MyList> { public MyListMap() { Id(ml => ml.Id); Map(ml => ml.Name); HasManyToMany(ml => ml.Products).Cascade.All(); } } public class ProductMap : ClassMap<Product> { public ProductMap() { Id(prod => prod.Id); Map(prod => prod.ProductDescription); } } public class SizedProductMap : SubclassMap<SizedProduct> { public SizedProductMap() { Map(sp => sp.Size); } } public class BundleProductMap : SubclassMap<BundleProduct> { public BundleProductMap() { References(bp => bp.BundleItem1).Cascade.All(); References(bp => bp.BundleItem2).Cascade.All(); } } I haven't configured have any reverse mappings, so a product doesn't know which Lists it belongs to or which bundles it is part of. Next I add some products to my list; MyList ml = new MyList() { Name = "Example" }; ml.Products.Add(new Product() { ProductDescription = "PSU" }); ml.Products.Add(new SizedProduct() { ProductDescription = "Extension Cable", Size = 2.0M }); ml.Products.Add(new BundleProduct() { ProductDescription = "Fan & Cable", BundleItem1 = new Product() { ProductDescription = "Fan Power Cable" }, BundleItem2 = new SizedProduct() { ProductDescription = "80mm Fan", Size = 80M } }); When I persist my list to the database and reload it, the list itself contains the items I expect ie MyList[0] has a type of Product, MyList[1] has a type of SizedProduct, and MyList[2] has a type of BundleProduct - great! If I navigate to the BundleProduct, I'm not able to see the types of Product attached to the BundleItem1 or BundleItem2 instead they are always proxies to the Product - in this example BundleItem2 should be a SizedProduct. Is there anything I can do to resove this either in my model or the mapping? Thanks in advance for your help.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >