Daily Archives

Articles indexed Tuesday June 1 2010

Page 23/125 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Creating XSD Dynamically in C Sharp

    - by Nave
    I have two inputs. I get as input one XML file. I have to create an XSD file for this XML file. This XML file has tags which depend on another input. But that XML file should have certain tags for sure. For example, the XML file has the following structure : <A <B <C...</C <D...</D <E <F...</F <G...</G </E </B </A Here, in this XML file, A,B and E tags should be present compulsarily. But the tags C and D inside the B tag and tags F and G inside the E tag depends on another input. So I shoud create an XSD dynamically(i know that A,B and E tags should be present and I do know about the other tags from the other input) and validate the input XML file against the XML Schema. Can someone temme how I can do this in C Sharp?

    Read the article

  • Serial Communication between Java RXTX and Arduino

    - by SharpBarb
    I'm trying to communicate between my PC (Windows 7 using Netbeans and RXTX) with an Arduino Pro, using the serial port. The Arduino is actually connected to the PC using an FTDI cable. The code is based on the Java SimpleRead.Java found here. Currently the Arduino simply prints out a string when it starts up. My Java program should print the number of bytes that have been read and then print out the contents. The Java program works, sort of... If the string is long (10 bytes or so) the output will get broken up. So if on the Arduino I print Serial.println("123456789123456789"); //20 bytes including '\r' and '\n' The output of my Java program may look something like: Number of Bytes: 15 1234567891234 Number of Bytes: 5 56789 or Number of Bytes: 12 1234567891 Number of Bytes: 8 23456789 I'm thinking it's a timing problem, because when I manually go through the code using the debugger, the result string is always what it should be: one 20 byte string. I've been messing with various things but I haven't been able to fix the problem. Here is the part of the code that is giving me problems: static int baudrate = 9600, dataBits = SerialPort.DATABITS_8, stopBits = SerialPort.STOPBITS_1, parity = SerialPort.PARITY_NONE; byte[] readBuffer = new byte[128]; ... ... public void serialEvent(SerialPortEvent event) { if (event.getEventType() == SerialPortEvent.DATA_AVAILABLE) { try { if (input.available() > 0) { //Read the InputStream and return the number of bytes read numBytes = input.read(readBuffer); String result = new String(readBuffer,0,numBytes); System.out.println("Number of Bytes: " + numBytes); System.out.println(result); } } catch (IOException e) { System.out.println("Data Available Exception"); } }

    Read the article

  • query structure - ignoring entries for the same event from multiple users?

    - by Andrew Heath
    One table in my MySQL database tracks game plays. It has the following structure: SCENARIO_VICTORIES [ID] [scenario_id] [game] [timestamp] [user_id] [winning_side] [play_date] ID is the autoincremented primary key. timestamp records the moment of submission for the record. winning_side has one of three possible values: 1, 2, or 0 (meaning a draw) One of the queries done on this table calculates the victory percentage for each scenario, when that scenario's page is viewed. The output is expressed as: Side 1 win % Side 2 win % Draw % and queried with: SELECT winning_side, COUNT(scenario_id) FROM scenario_victories WHERE scenario_id='$scenID' GROUP BY winning_side ORDER BY winning_side ASC and then processed into the percentages and such. Sorry for the long setup. My problem is this: several of my users play each other, and record their mutual results. So these battles are being doubly represented in the victory percentages and result counts. Though this happens infrequently, the userbase isn't large and the double entries do have a noticeable effect on the data. Given the table and query above - does anyone have any suggestions for how I can "collapse" records that have the same play_date & game & scenario_id & winning_side so that they're only counted once?

    Read the article

  • EVP_PKEY from char buffer in x509 (PKCS7)

    - by sid
    Hi All, I have a DER certificate from which I am retrieving the Public key in unsigned char buffer as following, is it the right way of getting? pStoredPublicKey = X509_get_pubkey(x509); if(pStoredPublicKey == NULL) { printf(": publicKey is NULL\n"); } if(pStoredPublicKey->type == EVP_PKEY_RSA) { RSA *x = pStoredPublicKey->pkey.rsa; bn = x->n; } else if(pStoredPublicKey->type == EVP_PKEY_DSA) { } else if(pStoredPublicKey->type == EVP_PKEY_EC) { } else { printf(" : Unkown publicKey\n"); } //extracts the bytes from public key & convert into unsigned char buffer buf_len = (size_t) BN_num_bytes (bn); key = (unsigned char *)malloc (buf_len); n = BN_bn2bin (bn, (unsigned char *) key); for (i = 0; i < n; i++) { printf("%02x\n", (unsigned char) key[i]); } keyLen = EVP_PKEY_size(pStoredPublicKey); EVP_PKEY_free(pStoredPublicKey); And, With this unsigned char buffer, How do I get back the EVP_PKEY for RSA? OR Can I use following ???, EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp, long length); int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);

    Read the article

  • formtastic - :string field value as Array and not found-s

    - by Alexey Poimtsev
    Hi, is there any possibility to send from formtastic form value of :string field like - semantic_form_for :project do |form| - form.inputs do = form.input :task_ids, :as => :string as Array? Currently value of this field is sending as String and i'd like to no parse this string in controller. Also, could you give me idea - if task with submitted id is not found - what is best way to catch this situation - validation in controller or what?

    Read the article

  • Can we execute steps conditionally in a JMeter script?

    - by Phanindra K
    I have recorded a sequence of steps to be executed for testing my web application, in a JMeter .jmx script. (The recording tool used was BadBoy). It is possible that one of the steps might return an error response in the HTTP response content. In this case, I need the script to stop execution of that thread. However, since the error page is customized, JMeter does not recognize this as an error and proceeds to the next steps. Is there any way to check for certain keywords, for example, and decide if the response is an error?

    Read the article

  • How to OpenWebConfiguration with physical path?

    - by aron
    hi, I have a win form that creates a site in IIS7. One function needs to open the web.config file and make a few updates. (connection string, smtp, impersonation) However I do not have the virtual path, just the physical path. Is there any way I can still use WebConfigurationManager? I need to use it's ability to find section and read/write. System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration Thanks!!

    Read the article

  • Creating an Android View with a particular style programmatically

    - by Casebash
    How can I create a view with a particular style programmatically (not in XML)? I tried using this [View (Context context, AttributeSet attrs, int defStyle)][1], but I don't know what to parse in for the second argument. Passing in null results in the View not being displayed [1]: http://developer.android.com/reference/android/view/View.html#View(android.content.Context, android.util.AttributeSet, int)

    Read the article

  • url helper diificulty

    - by user281180
    Can anyone help me for the following: I am having the error message. How can I correct that? Error 4 Use of unassigned local variable 'url' on the url.Action... UrlHelper url; string fullUrl = url.Action( "Details", "test", new {test.ID } ); Thanks

    Read the article

  • differing methods of alloc / init / retaining an object in objective-c

    - by taber
    In several pieces of sample objective-c code I've seen people create new objects like this: RootViewController *viewController = [[RootViewController alloc] init]; self.rootViewController = viewController; // self.rootViewController is a (nonatomic,retain) synthesized property [viewController release]; [window addSubview: [self.rootViewController view]]; Is that any different "behind the scenes" than doing it like this instead? self.rootViewController = [[RootViewController alloc] init]; [window addSubview: [self.rootViewController view]]; Seems a bit more straightforward/streamlined that way so I'm wondering why anyone would opt for the first method. Thanks!

    Read the article

  • getting HtmlTextWriter of a control

    - by lissa
    is it possible to get HtmlTextWriter of a control? if no, then how can i call the RenderEndTag of a control in code behind? i am facing a problem in my application. i extended the listbox user control and override its RenderEndTag event. if i used the new listbox (Mylistbox) normally inside a WebPage, everything works fine. but when i put Mylistbox in a Webusercontrol and include the Webusercontrol in a WebPage, the RenderEndTag of the control is not called for some reason. so i guessed that i should explicitly call 'RenderEndTag' of the control. to do so i need to pass an HtmlTextWriter...

    Read the article

  • warning: (Internal error: pc 0x804a6b0 in read in psymtab, but not in symtab.) g++

    - by Sriram
    Hi, I am trying to debug a program using ddd. When I try to enter any function, or within main() itself, I get the following warning: warning: (Internal error: pc 0x804a6b0 in read in psymtab, but not in symtab.) This warning flashes whenever I try to move to another instruction using 'n' or enter or leave a function. I have tried to look this up in other forums, but with no conclusive answer. The code I am trying to debug runs into several files and I am not sure if I can post the entire code here. I am using g++ version: g++ (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2) Any help on this is most welcome. Thanks, Sriram.

    Read the article

  • in Visual C# 2010 express what is the most reliable way to detect windows OS Architecture (x86,x64)

    - by NightsEvil
    i am using Visual C# 2010 express and i need the most reliable way (on button click) and in .NET 2.0 framework to detect if windows is currently x86 or x64 in a message box.. up till now i have been using this code but i need to know if there is a more accurate way? string target = @"C:\Windows\SysWow64"; { if (Directory.Exists(target)) { MessageBox.Show("x64"); } else { MessageBox.Show("x86"); }

    Read the article

  • How to hide parent tabbar when pushing controller in navigationController

    - by Yannis
    Hi all, I have an application with a tab bar controller and each view contains a navigation controller. My MainWindow looks as follows: Everything works fine as it is but I noticed a problem when pushing a details view to the navigation controller. In the didSelectRowAtIndexPath for a tableviewcontroller that belongs to the tab bar controller (the one called Latest in the image) I am doing this: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ArticleViewController *articleController = [[ArticleViewController alloc] initWithNibName:@"ArticleView" bundle:nil]; [self.navigationController pushViewController:articleController animated:YES]; [articleController release]; articleController = nil; } The ArticleViewController has its own tabbar because it needs to display different things. The problem is that when I push the ArticleViewController into the navigationController I see both tabbars at the bottom of the view. Is there any way I can solve this problem? Thanks in advance

    Read the article

  • Is there a difference between plain text emails, and multipart emails with only plain text?

    - by Brian Armstrong
    I'm using Rails to send emails and I just want to send a plain text email (there is no corresponding HTML part). I've noticed that if I just have one file named email.text.plain.erb it actually generates a multipart email with one part (the plain text part) like this: Content-Type: multipart/alternative; boundary=mimepart_4c04a2d34c4bb_690a4e56b0362 --mimepart_4c04a2d34c4bb_690a4e56b0362 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline text of the email here... --mimepart_4c04a2d34c4bb_690a4e56b0362-- But if I take out the text.plain part and name it email.erb ActionMailer generates a regular plain text email without multipart like this: Content-Type: text/plain; charset=utf-8 text of the email here... Both work fine most of the time (so this is kind of nitpicky), but I guess my question is whether the second one is more correct. My goal here is just to make sure deliverability is as high as possible across a wide variety of devices and email clients. I've read that plain text emails can have slightly better deliverability rates than html and was just curious if throwing in this multipart (even if it only contained a plain text part) might throw off some of the dumber email clients. Thanks for your help!

    Read the article

  • Recreating Cookies on another Domain

    - by Bill
    Hi, I have a site on A.com and an iframe on B.com which reads info from A.com. I realize that there is some problems with third party cookies, iframes and P3P - particularly in Safari [my problem] Is it possible to instead, use AJAX or a hidden iFrame to pass the cookie information from A.com to B.com which will then "recreate" another cookie with the same information on the iframe in B.com. I am trying to do this for authenication - i.e. a user is logged in on A.com and then goes to b.com and the iframe is also logged in ? I was hoping to perhaps pass the data in a hidden iframe and "recreate" the cookie in the iframe on B.com using JavaScript?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >