Search Results

Search found 1525 results on 61 pages for 'pair'.

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

  • Find the element with the most "neighbors" in a sequence

    - by Bao An
    Assume that we have a sequence S with n elements <x1,x2,...,xn>. A pair of elements xi,xj are considered neighbors if |xi-xj|<d, with d a given distance between two neighbors. So how can find out the element that has most neighbors in the sequence? (A simply way is sorting the sequence and then calculating number of each element but it's time complexity is quite large): O(nlogn) May you please help me find a better way to reduce time complexity?

    Read the article

  • Why is my keyboard messed up in Eclipse?

    - by Xi
    Hi there: I am trying to type in a pair of angle brackets in Eclipse, like "<". However it shows up as a single quotation and a dot, like "'.". I tried a couple of times and found out that the angle bracket is actually located at back-slash's position. Why is this happening? How can I change it back? Thanks in advance. Xi

    Read the article

  • How to apply style in WPF Controls ?

    - by Amit
    Hello All, I am beginner on WPF and need your help. Problem: I have 4 buttons on the form and need to apply 2 different style on pair of 2 buttons. Is there any way we can achive this ? please provide me sample if possible... Thanks in advance...

    Read the article

  • Determining line orientation using vertex shaders

    - by Brett
    Hi, I want to be able to calculate the direction of a line to eye coordinates and store this value for every pixel on the line using a vertex and fragment shader. My idea was to calculate the direction gradient using atan2(Gy/Gx) after a modelview tranformation for each pair of vertices then quantize this value as a color intensity to pass to a fragment shader. How can I get access to the positions of pairs of vertices to achieve this or is there another method I should use? Thanks

    Read the article

  • jQuery is not defined on my staging server but works fine on my local

    - by Tony
    If you pop open this page with your javascript console, you'll notice a bunch of JS errors. I don't get these errors in my local environment and it seems like it is happening because $ is not defined. I have tried to mimic my local environment exactly on staging by using the same environment.rb file and removing all JS caching but it is making no difference. Can anyone tell why jQuery is crapping out? It might be something really stupid, but I need a second pair of eyes.

    Read the article

  • MATLAB image corner coordinates & referncing to cell arrays

    - by James
    Hi, I am having some problems comparing the elements in different cell arrays. The context of this problem is that I am using the bwboundaries function in MATLAB to trace the outline of an image. The image is of a structural cross section and I am trying to find if there is continuity throughout the section (i.e. there is only one outline produced by the bwboundaries command). Having done this and found where the is more than one section traced (i.e. it is not continuous), I have used the cornermetric command to find the corners of each section. The code I have is: %% Define the structural section as a binary matrix (Image is an I-section with the web broken) bw(20:40,50:150) = 1; bw(160:180,50:150) = 1; bw(20:60,95:105) = 1; bw(140:180,95:105) = 1; Trace = bw; [B] = bwboundaries(Trace,'noholes'); %Traces the outer boundary of each section L = length(B); % Finds number of boundaries if L > 1 disp('Multiple boundaries') % States whether more than one boundary found end %% Obtain perimeter coordinates for k=1:length(B) %For all the boundaries perim = B{k}; %Obtains perimeter coordinates (as a 2D matrix) from the cell array end %% Find the corner positions C = cornermetric(bw); Areacorners = find(C == max(max(C))) % Finds the corner coordinates of each boundary [rowindexcorners,colindexcorners] = ind2sub(size(Newgeometry),Areacorners) % Convert corner coordinate indexes into subcripts, to give x & y coordinates (i.e. the same format as B gives) %% Put these corner coordinates into a cell array Cornerscellarray = cell(length(rowindexcorners),1); % Initialises cell array of zeros for i =1:numel(rowindexcorners) Cornerscellarray(i) = {[rowindexcorners(i) colindexcorners(i)]}; %Assigns the corner indicies into the cell array %This is done so the cell arrays can be compared end for k=1:length(B) %For all the boundaries found perim = B{k}; %Obtains coordinates for each perimeter Z = perim; % Initialise the matrix containing the perimeter corners Sectioncellmatrix = cell(length(rowindexcorners),1); for i =1:length(perim) Sectioncellmatrix(i) = {[perim(i,1) perim(i,2)]}; end for i = 1:length(perim) if Sectioncellmatrix(i) ~= Cornerscellarray Sectioncellmatrix(i) = []; %Gets rid of the elements that are not corners, but keeps them associated with the relevent section end end end This creates an error in the last for loop. Is there a way I can check whether each cell of the array (containing an x and y coordinate) is equal to any pair of coordinates in cornercellarray? I know it is possible with matrices to compare whether a certain element matches any of the elements in another matrix. I want to be able to do the same here, but for the pair of coordinates within the cell array. The reason I don't just use the cornercellarray cell array itself, is because this lists all the corner coordinates and does not associate them with a specific traced boundary.

    Read the article

  • Code Sign error after renewing my certificate

    - by thierryb
    Hello, my certificate has just expired. I renewed it on Team section, then renew provisioning profile, and reinstall them on my keychain and xcode, and then I get this error : Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the login keychain What should I do ? Thanks a lot Thierry

    Read the article

  • blue tooth programming on android

    - by user121196
    I currently use blue tooth api on android and am able to pair with regular devices(eg. my pc with built-in blue-tooth). However it doesn't get a response when trying to connect to it. What is the meaning of connect in blue tooth? is this a built-in protocol of bluetooth?

    Read the article

  • AspxPivotGrid Group column header

    - by eugene4968
    I want to be able to add a parent column header to each pair of columns shown below. So I want it to look like this: Grand Total OnHand Available Anyone know a way to do this? I know you can group columns together but I'm wondering how I can apply a label to those groups. Alternatively, if theres no way to do that, I could just override the "Grand Total" display text. The only problem is I can't get it aligned above its correct columns.

    Read the article

  • Validating key/certificate pairs with M2Crypto when a certificate chain is needed

    - by Charles Duffy
    M2Crypto.X509.X509 objects have a verify(pkey) method, which provide a means of testing that a given certificate does in fact sign a specified key. This is a good and useful thing -- except that sometimes the certificate I want to verify in this way is invalid without the use of an intermediate certificate, which this API does not appear to allow a way to specify. Is there an alternate means of validating a certificate / private key pair which will work even when the certificate is unable to stand alone?

    Read the article

  • node.js database

    - by Justin
    I'm looking for a database to pair with a node.js app. I'm assuming a json/nosql db would be preferable to a relational db [I can do without any json/sql impedence mismatch]. Considering couchdb mongodb redis Anyone have any views / war stories re compatiability/deployability of the above with node.js ? Any clear favourites ?

    Read the article

  • Need Help With Simple Regex

    - by npinti
    I have strings of this type: text (more text) What I would like to do is to have a regular expression that extracts the "more text" segment of the string, so far I have been using this regular expression: "^.*\\((.*)\\)$" Which although it works on many cases, it seems to fail if I have something of the sort: text (more text (even more text)) What I get is: even more text) What I would like to get instead is: more text (even more text) (basically the content of the outermost pair of brackets.) Thanks

    Read the article

  • how to detect whether strings are not captured for localization in .po files i.e no equivalent entry

    - by Manjushree
    Hi we have some queries regarding localization/.po files 1 We want to detect the missing strings or strings which are not being captured for L10N. how we can detect that? is that any method or command to update the strings 2 Locale files (.po) for "cn-zh" or another Locale are not complete (missing strings) 3 String has been captured for L10N but does not have a matching pair in .po files

    Read the article

  • Efficient way to store tuples in the datastore

    - by Drew Sears
    If I have a pair of floats, is it any more efficient (computationally or storage-wise) to store them as a GeoPtProperty than it would be pickle the tuple and store it as a BlobProperty? If GeoPt is doing something more clever to keep multiple values in a single property, can it be leveraged for arbitrary data? Can I store the tuple ("Johnny", 5) in a single entity property in a similarly efficient manner?

    Read the article

  • for x in y, type iteration in python. Can I find out what iteration I'm currently on?

    - by foo
    Hi, I have a question about the loop construct in Python in the form of: for x in y: In my case y is a line read from a file and x is separate characters. I would like to put a space after every pair of characters in the output, like this: aa bb cc dd etc. So, I would like to know the current iteration. Is it possible, or do I need to use a more traditional C style for loop with an index?

    Read the article

  • JQuery and JSON - Add element

    - by Villager
    Hello, I have a JSON variable defined as: var myCollection = { "data": [ { "name":"Joe", "id":"1" }, { "name":"Bill", "id":"2" }, { "name":"Dave", "id":"3" } ] }; I have a JavaScript function that is responsible for adding items to the data element in myCollection. However, I'm not sure how to add a name/id pair to the collection via JavaScript. Can someone show me how to add to a JSON collection via JavaScript? Thank you!

    Read the article

  • Write PEM encoded certificate in file - java

    - by user1349407
    Good day. I recently create X.509 certificate by using bouncy castle API. I need to save the certificate result rather than display the result. I tried to use FileOutputStream, but it does not work. regards the result is like follows -----BEGIN CERTIFICATE----- MIICeTCCAeKgAwIBAgIGATs8OWsXMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNVBAMT... -----END CERTIFICATE----- The code is belows import java.io.FileOutputStream; //example of a basic CA public class PKCS10CertCreateExample { public static X509Certificate[] buildChain() throws Exception { //create the certification request KeyPair pair = chapter7.Utils.generateRSAKeyPair(); PKCS10CertificationRequest request = PKCS10ExtensionExample.generateRequest(pair); //create a root certificate KeyPair rootPair=chapter7.Utils.generateRSAKeyPair(); X509Certificate rootCert = X509V1CreateExample.generateV1Certificate (rootPair); //validate the certification request if(!request.verify("BC")) { System.out.println("request failed to verify!"); System.exit(1); } //create the certificate using the information in the request X509V3CertificateGenerator certGen = new X509V3CertificateGenerator(); certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis())); certGen.setIssuerDN(rootCert.getSubjectX500Principal()); certGen.setNotBefore(new Date(System.currentTimeMillis())); certGen.setNotAfter(new Date(System.currentTimeMillis()+50000)); certGen.setSubjectDN(request.getCertificationRequestInfo().getSubject()); certGen.setPublicKey(request.getPublicKey("BC")); certGen.setSignatureAlgorithm("SHA256WithRSAEncryption"); certGen.addExtension(X509Extensions.AuthorityKeyIdentifier, false, new AuthorityKeyIdentifierStructure(rootCert)); certGen.addExtension(X509Extensions.SubjectKeyIdentifier, false, new SubjectKeyIdentifierStructure(request.getPublicKey("BC"))); certGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(false)); //certGen.addExtension(X509Extensions.KeyUsage, true, new BasicConstraints(false)); certGen.addExtension(X509Extensions.KeyUsage, true, new KeyUsage(KeyUsage.digitalSignature | KeyUsage.keyEncipherment)); certGen.addExtension(X509Extensions.ExtendedKeyUsage, true, new ExtendedKeyUsage(KeyPurposeId.id_kp_serverAuth)); //extract the extension request attribute ASN1Set attributes = request.getCertificationRequestInfo().getAttributes(); for(int i=0;i!=attributes.size();i++) { Attribute attr = Attribute.getInstance(attributes.getObjectAt(i)); //process extension request if(attr.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest)) { X509Extensions extensions = X509Extensions.getInstance(attr.getAttrValues().getObjectAt(0)); Enumeration<?> e = extensions.oids(); while(e.hasMoreElements()) { DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); X509Extension ext = extensions.getExtension(oid); certGen.addExtension(oid, ext.isCritical(), ext.getValue().getOctets()); } } } X509Certificate issuedCert = certGen.generateX509Certificate(rootPair.getPrivate()); return new X509Certificate[]{issuedCert, rootCert}; } public static void main(String[] args) throws Exception { X509Certificate[] chain = buildChain(); PEMWriter pemWrt = new PEMWriter(new OutputStreamWriter(System.out)); pemWrt.writeObject(chain[0]); //pemWrt.writeObject(chain[1]); pemWrt.close(); //write it out //FileOutputStream fOut = new FileOutputStream("pkcs10req.req"); //fOut.write(chain[0].toString()); //fOut.write() //System.out.println(chain[0].toString()); //fOut.close(); } }

    Read the article

  • stxxl Assertion `it != root_node_.end()' failed

    - by Fabrizio Silvestri
    I am receiving this assertion failed error when trying to insert an element in a stxxl map. The entire assertion error is the following: resCache: /usr/include/stxxl/bits/containers/btree/btree.h:470: std::pair , bool stxxl::btree::btree::insert(const value_type&) [with KeyType = e_my_key, DataType = unsigned int, CompareType = comp_type, unsigned int RawNodeSize = 16384u, unsigned int RawLeafSize = 131072u, PDAllocStrategy = stxxl::SR, stxxl::btree::btree::value_type = std::pair]: Assertion `it != root_node_.end()' failed. Aborted Any idea? Edit: Here's the code fragment void request_handler::handle_request(my_key& query, reply& rep) { c_++; strip(query.content); std::cout << "Received query " << query.content << " by thread " << boost::this_thread::get_id() << ". It is number " << c_ << "\n"; strcpy(element.first.content, query.content); element.second = c_; testcache_.insert(element); STXXL_MSG("Records in map: " << testcache_.size()); } Edit2 here's more details (I omit constants, e.g. MAX_QUERY_LEN) struct comp_type : std::binary_function<my_key, my_key, bool> { bool operator () (const my_key & a, const my_key & b) const { return strncmp(a.content, b.content, MAX_QUERY_LEN) < 0; } static my_key max_value() { return max_key; } static my_key min_value() { return min_key; } }; typedef stxxl::map<my_key, my_data, comp_type> cacheType; cacheType testcache_; request_handler::request_handler() :testcache_(NODE_CACHE_SIZE, LEAF_CACHE_SIZE) { c_ = 0; memset(max_key.content, (std::numeric_limits<unsigned char>::max)(), MAX_QUERY_LEN); memset(min_key.content, (std::numeric_limits<unsigned char>::min)(), MAX_QUERY_LEN); testcache_.enable_prefetching(); STXXL_MSG("Records in map: " << testcache_.size()); }

    Read the article

  • Visual Studio 2010 RTM started giving me 'does not exist in the current context errors'

    - by Hurricanepkt
    Just installed the trial version of Visual Studio 2010 RTM. Now I keep getting : The name 'NoPanel' does not exist in the current context Errors (where no panel is just about any control in the .aspx file) also I got several errors trying to deploy pages and it would not send the .cs file over ...or pdfs in the Content directory (even though I had copy always set)... This is happening on a pair of mixed ASP.NET MVC and Webforms sites.

    Read the article

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