Search Results

Search found 592 results on 24 pages for 'sid xing'.

Page 9/24 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • using markers instead of if and else statement in php

    - by Mac Taylor
    hey guys i need to shorten or better to say ., harden my codes this is my original code : if ($type = "recent") { $OrderType = "sid DESC"; }elseif ($type = "pop"){ $OrderType = "counter DESC"; }else { $OrderType = "RAND()"; } now how can i use markers like this : $OrderType = ($type = "recent") ? "sid DESC" : "counter DESC" ; i tried but i didnt know how to write elseif in marker way

    Read the article

  • Daemonize() issues on Debian

    - by djTeller
    Hi, I'm currently writing a multi-process client and a multi-treaded server for some project i have. The server is a Daemon. In order to accomplish that, i'm using the following daemonize() code: static void daemonize(void) { pid_t pid, sid; /* already a daemon */ if ( getppid() == 1 ) return; /* Fork off the parent process */ pid = fork(); if (pid < 0) { exit(EXIT_FAILURE); } /* If we got a good PID, then we can exit the parent process. */ if (pid > 0) { exit(EXIT_SUCCESS); } /* At this point we are executing as the child process */ /* Change the file mode mask */ umask(0); /* Create a new SID for the child process */ sid = setsid(); if (sid < 0) { exit(EXIT_FAILURE); } /* Change the current working directory. This prevents the current directory from being locked; hence not being able to remove it. */ if ((chdir("/")) < 0) { exit(EXIT_FAILURE); } /* Redirect standard files to /dev/null */ freopen( "/dev/null", "r", stdin); freopen( "/dev/null", "w", stdout); freopen( "/dev/null", "w", stderr); } int main( int argc, char *argv[] ) { daemonize(); /* Now we are a daemon -- do the work for which we were paid */ return 0; } I have a strange side effect when testing the server on Debian (Ubuntu). The accept() function always fail to accept connections, the pid returned is -1 I have no idea what causing this, since in RedHat & CentOS it works well. When i remove the call to daemonize(), everything works well on Debian, when i add it back, same accept() error reproduce. I've been monitring the /proc//fd, everything looks good. Something in the daemonize() and the Debian release just doesn't seem to work. (Debian GNU/Linux 5.0, Linux 2.6.26-2-286 #1 SMP) Any idea what causing this? Thank you

    Read the article

  • OAuth::Problem (parameter_absent)

    - by Sid
    Im working with OAuth 0.3.6 and the linkedin gem for a Rails application and I have this issue where OAuth throws an error saying that OAuth::Problem (parameter_absent). The thing is it doesn't throw the error on every occasion its called and the problem is I am unable to reproduce the issue locally to test it. The documentation says that : [parameter_absent: a required parameter wasn't received. In this case, the response SHOULD also contain an oauth_parameters_absent parameter. ] but the request is generated the same way each time to obtain the tokens so I fail to understand why this happens. Log OAuth::Problem (parameter_absent): oauth (0.3.6) lib/oauth/consumer.rb:167:in `request' oauth (0.3.6) lib/oauth/consumer.rb:183:in `token_request' oauth (0.3.6) lib/oauth/tokens/request_token.rb:18:in `get_access_token' linkedin (0.1.7) lib/linked_in/client.rb:35:in `authorize_from_request' app/controllers/users_controller.rb:413:in `linkedin_save' I have seen a few people facing this issue but I am yet to figure out a way to resolve this. Would appreciate some help on this.

    Read the article

  • WebSphere Application Server 6.1 support for Java 1.6?

    - by El Sid
    Hi, Can I use Java 1.6 with WebSphere Application Server 6.1? IBM's website says no. But I require Java 1.6 for a software application to be deployed and I cannot currently upgrade to Websphere 7.0, or use a different application server (WAS 6.1 is the org standard). what are my options? Thanks.

    Read the article

  • Roaming user profile issues on Server 2008

    - by Alicia White
    I thought I cleared a user's profile from 2008, but it keeps coming back. So, I was looking for the best way to clear a roaming profile in Server 2008, but I have been unable to find anything. But, I did see the post here: http://serverfault.com/questions/18724/user-profile-keeps-loading-temp-profile I wanted to add a comment to that post, but it was closed as not being related to sysadmin. But, I think it IS related because I dealt with precisely this same problem on our Wndows 2008 terminal server. Here was the issue: we have a user who was getting an "unable to load your roaming profile" type of error at logon in Windows 2008. Looking at the server, we could see her temp profile listed in the profile list while she was loggged (listed as a "temporary" and not a "roaming" profile). While she was logged on, a folder called C:\Users\Temp.DOMAIN existed in the users folder, but that disappeared as soon as she logged out. When this thing happened in 2003, we would clear the contents of the roaming profile folder & delete the temp folder in C:\Documents and Settings. The thing is, 2008 behaves a bit differently. Server 2008 created a new roaming profile folder in the roaming profile folder share: \SERVER\ProfileShare\UserName.V2 The local profile disappears from the profile list in System Properties, so there is no profile to clear Also the local profile folder, C:\Users\Temp.DOMAIN doesn't stay on the server when the user logs out, so we can't delete that as we would normally do when this sort of thing happens in Windows 2003 Despite all of this, every time the user logs back on, the frickin' Temp profile always comes back. One of my team-mates, who is much more experienced with 2008, said I should check the registry for the user's profile in this key (the users are listed by SID): HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\ProfileList I saw the user's SID listed there, but it ended in .BAK. I checked several other servers where she is having the same profile errors: in all cases, her SID ended with .BAK. For example (xxx replacing the LONG SID): HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-xxxxx-xxxx.bak On the server she was logged on to, there were two keys for her profile in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-xxxxx-xxxx and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-xxxxx-xxxx.bak So, here is how I cleared up the issue. I had the user log off. I deleted the apparently bad profiles ending in .BAK from the ProfileList key on each server where it appeared. I made sure her roaming profile folder was empty I made sure that all the TEMP profile folders were gone The user logged back on: no more profile errors! Anyway, I wanted to make a comment on that closed question, but I didn't see any way to re-open the question so I could add it. But, I also would like to know if this is the best practice to clear out a bad roaming profile for Server 2008? I'm having a hard time finding any instructions on line on how best to do this, but this method I used seemed to work. I'd like to find some documentation to give to our Level 1 support staff so they will know how to clear user profiles on 2008 since this seems to be more involved that clearing user profiles in server 2003. Thanks, Alicia

    Read the article

  • Regarding: PKCS7, X509 and DER

    - by Sid
    Hi, I am novice to the "World of cryptography". I started working with OPENSSL. I need some information and basically I do have some doubts. I have a DER format file. I read the file using following command, "openssl x509 -inform DER -in filename.der -text" I got what I supposed to be. Following things I wanted to know: 1. What is the difference between PKCS7, DER and X509 ? (My understanding is, DER is format, X509 is certificate, and PKCS7 is the standard) I wrote a test file which accepts the DER file and outputs the version, serial number, Subject, Validity date before and Validity date after, But I am unable to get certificate verified. Following is the API Used. int i = X509_verify(X509 *x509 , X509_get_pubkey(X509 *x509)); But 'i' value is 'i' < 0(zero) This is why I am getting "Signature verification problems". How to overcome this? In My test file I am unable to read the "Signature Algorithm", "Subject Public Key Info", "X509v3 extensions" and "-----BEGIN CERTIFICATE-----" to "-----END CERTIFICATE-----" Please give some inputs. Thanks in Advance. openSid

    Read the article

  • Shake based application

    - by Sid
    hii frnz, i am developing an application which deletes rows from a table view when the user shakes the iPhone.i have created a navigation based project. now when the user shakes the iPhone i want that the title of navigation bar should change to "DELETE" and a delete button should appear on the navigation bar on the same view (but this operation should take place only when the user shakes the iPhone )otherwise when a user selects a particular row then it should move to next view.I have written the followin code but its not working.plz help me out..... (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //NSLog(@"hiiiii"); if (isShaked == NO) { //logic to move to next view goes here. } else { self.title = @"Delete Rows"; delete=[[UIBarButtonItem alloc] initWithTitle:@"Delete rows" style: UIBarButtonItemStyleBordered target:self action:@selector(deleteItemsSelected)] ; self.navigationItem.rightBarButtonItem=self.delete; MyTableCell *targetCustomCell = (MyTableCell *)[tableView cellForRowAtIndexPath:indexPath]; [targetCustomCell checkAction]; [self.tempArray addObject: [myModal.listOfStates objectAtIndex:indexPath.row]]; //[delete addTarget:self action:@selector(deleteItemsSelected:) forControlEvents:UIControlEventTouchUpInside]; self.tempTableView = tableView; } } -(void)deleteItemsSelected { //for(int i = 0; i <= [tempArray count]; i++) //{ //} [myModal.listOfStates removeObjectsInArray:tempArray]; [tempTableView reloadData]; } checkAction method is a custom cell method which is used to put a tickmark on the row selected

    Read the article

  • Users suddenly missing write permissions to the root drive c within an active directory domain

    - by Kevin
    I'm managing an active directory single domain environment on some Windows Server 2008, Windows Server 2008 R2 and Windows Server 2012 machines. Since a few weeks I got a strange issue. Some users (not all!) report that they cannot any longer save, copy or write files to the root drive c, whether on their clients (vista, win 7) nor via remote desktop connection on a Windows Server 2008 machine. Even running programs that require direct write permissions to the root drive without administrator permissions fail to do so since then. The affected users have local administrator permissions. The question I'm facing now is: What caused this change of system behavior? Why did this happen? I didn't find out yet. What was the last thing I did before it happened? The last action that was made before it happened was the rollout of a GPO containing network drive mappings for the users depending on their security group membership. All network drives are located on a linux server with samba enabled. We did not change any UAC settings, and they have always been activated. However I can't imagine that rolling out this GPO caused the problem. Has anybody faced an issue like that? Just in case: I know that it is for a specific reason that an user without administrative privileges is prevented from writing to the root drive since windows vista and the implementation of UAC. I don't think that those users should be able to write to drive c, but I try to figure out why this is happening and a few weeks ago this was still working. I also know that a user who is a member of the local administrators group does not execute anything with administrator permissions per default unless he or she executes a program with this permissions. What did I do yet? I checked the permissions of the affected programs, the affected clients/server. Didn't find something special. I checked ALL of our GPOs if there exist any restrictions that could prevent the affected users from writing to the root drive. Did not find any settings. I checked the UAC settings of the affected users and compared those to other users that still can write to the root drive. Everything similar. I googled though the internet and tried to find someone who had a similar problem. Did not find one. Has anybody an idea? Thank you very much. Edit: The GPO that was rolled out does the following (Please excuse if the settings are not named exactly like that, I translated the settings into english): **Windows Settings -- Network Drive Mappings -- Drive N: -- General:** Action: Replace **Properties:** Letter: N Location: \\path-to-drive\drivename Re-Establish connection: deactivated Label as: Name_of_the_Share Use first available Option: deactivated **Windows Settings -- Network Drive Mappings -- Drive N: -- Public: Options:** On error don't process any further elements for this extension: no Run as the logged in user: no remove element if it is not applied anymore: no Only apply once: no **Securitygroup:** Attribute -- Value bool -- AND not -- 0 name -- domain\groupname sid -- sid-of-the-group userContext -- 1 primaryGroup -- 0 localGroup -- 0 **Securitygroup:** Attribute -- Value bool -- OR not -- 0 name -- domain\another-groupname sid -- sid-of-the-group userContext -- 1 primaryGroup -- 0 localGroup -- 0 Edit: The Error-Message of an affected users says the following: Due to an unexpected error you can't copy the file. Error-Code 0x80070522: The client is missing a required permission. The command icacls C: shows the following: NT-AUTORITY\SYSTEM:(OI)(CI)(F) PRE-DEFINED\Administrators:(OI)(CI)(F) computername\username:(OI)(CI)(F) A college just told me that also the primary domain-controller (PDC) changed from Windows Server 2008 to Windows Server 2012. That also may be a reason. Any suggestions?

    Read the article

  • Common lisp gray streams

    - by Sid H
    Is there a tutorial on how to use gray streams? I want to create a class that reads from a file while looking for a specific set of bytes. My initial thought was to use gray streams, but could not find any starting information.

    Read the article

  • dbpedia auto-suggest labels

    - by Sid
    Wikipedia has a auto-suggest feature on its search field. If you for instance type in "mars" it lists a few items including Mars, Marseille, Marsh. I am looking to implement something similar working off the latest DBpedia export (wikipedia in database form). If I do a search for all labels in the labels_en.nt file that DBpedia offer that begin with "mars" then, even if I remove ones that redirect on to others that are listed, I end up with a huge list. In trying to understand how wikipedia does this I noticed that I'm actually querying this URL which returns a JSON string. Now my problem is that I don't know how wikipedia narrows the list down. Perhaps it does so based on page popularity. The higher views/edits a page has the higher it goes in this suggestion box. If so, does DBpedia export this information?

    Read the article

  • If the UIApplicationMain() never returns then when does the autorelease pool gets released?

    - by sid
    For code: int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; } Apple's doc clearly specifies: Return Value: Even though an integer return type is specified, this function never returns. When users terminate an iPhone application by pressing the Home button, the application immediately exits by calling the exit system function with an argument of zero. Secondly, in int UIApplicationMain ( int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName ); how can we access the argv from our UIApplication subclass?

    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

  • Cant access log files in production.

    - by Sid
    I was trying to run my application and check for some output on the production.log. However Rails throws this error. Apache log Rails Error: Unable to access log file. Please ensure that /var/www/somefolder/someapp/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed. I have performed the necessary chmod 666 production.log to make it work but I realized that the file is under root access. So my file permissions are -rw-rw-rw- 1 root root 20845 2010-03-18 01:18 production.log Im not sure how to allow Rails to access this file. Im fairly new to managing linux production env so I request you to excuse my ignorance.

    Read the article

  • net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError)

    - by Sid
    ` @@timestamp = nil def generate_oauth_url @@timestamp = timestamp url = CONNECT_URL + REQUEST_TOKEN_PATH + "&oauth_callback=#{OAUTH_CALLBACK}&oauth_consumer_key=#{OAUTH_CONSUMER_KEY}&oauth_nonce=#{NONCE} &oauth_signature_method=#{OAUTH_SIGNATURE_METHOD}&oauth_timestamp=#{@@timestamp}&oauth_version=#{OAUTH_VERSION}" puts url url end def sign(url) Base64.encode64(HMAC::SHA1.digest((NONCE + url), OAUTH_CONSUMER_SECRET)).strip end def get_request_token url = generate_oauth_url signed_url = sign(url) request = Net::HTTP.new((CONNECT_URL + REQUEST_TOKEN_PATH),80) puts request.inspect headers = { "Authorization" => "Authorization: OAuth oauth_nonce = #{NONCE}, oauth_callback = #{OAUTH_CALLBACK}, oauth_signature_meth od = #{OAUTH_SIGNATURE_METHOD}, oauth_timestamp=#{@@timestamp}, oauth_consumer_key = #{OAUTH_CONSUMER_KEY}, oauth_signature = #{signed_url}, oauth_versio n = #{OAUTH_VERSION}" } request.post(url, nil,headers) end def timestamp Time.now.to_i end ` I am trying to do what oauth does in an attempt to understand how to use the Authorization headers. I am also getting the following error. I am trying to connect to the linkedin API. /usr/lib/ruby/1.8/net/http.rb:560:in 'initialize': getaddrinfo: Name or service not known (SocketError) I would really appreciate it if someone could nudge me in the right direction.

    Read the article

  • getElementsByClassName not working on parsed html data in greasemonkey

    - by Sid
    Hi my code is as such var xhReq = new XMLHttpRequest(); xhReq.open("GET", linksRaw, false); xhReq.send(null); var serverResponse = xhReq.responseText; var tempDiv = document.createElement('div'); tempDiv.innerHTML = serverResponse.replace(/<script(.|\s)*?\/script>/g, ''); var plzWork = tempDiv.getElementsByClassName('organizationID').innerHTML; console.log(plzWork); The value of 'plzWork' :-) which is logged to the firebug console is always 'undefined' while the link code is <a class="organisationID" href="orglists.htm">Partner Organisations</a> I'm writing this script in the latest versions of Greasemonkey and FF 3.6 Thanks

    Read the article

  • emacs exporting org file as PDF in batch mode

    - by Sid H
    I'm trying to export a bunch of org mode files to PDF using emacs in batch mode. So far, only export to html seems to work. When I export to html I see the following - U:\tmpd:\programs\emacs-23.1\bin\emacs.exe -batch --visit=Changelog.org --funcall org-export-as-html-batch OVERVIEW Exporting... Exporting... Saving file u:/tmp/Changelog.html... Wrote u:/tmp/Changelog.html HTML export done, pushed to kill ring and clipboard However, there is no function like org-export-as-pdf-batch and so I tried the following. U:\tmpd:\programs\emacs-23.1\bin\emacs.exe -batch --visit=Changelog.org -eval "(org-export-as-pdf \"Changelog.pdf\")" OVERVIEW Exporting to PDF... Exporting to LaTeX... Wrong type argument: number-or-marker-p, "Changelog.pdf" Any ideas on how to export to PDF? My org-mode version is 6.35i with on Emacs 23.1. I'm on WinXP.

    Read the article

  • Efficiency of purely functional programming

    - by Sid
    Does anyone know what is the worst possible asymptotic slowdown that can happen when programming purely functionally as opposed to imperatively (i.e. allowing side-effects)? Clarification from comment by itowlson: is there any problem for which the best known non-destructive algorithm is asymptotically worse than the best known destructive algorithm, and if so by how much?

    Read the article

  • XMPP4R Callbacks dont seem to work

    - by Sid
    Im using xmpp4r and trying to get the hang of a basic chat feature that I wish to implement later in my Rails app. My fundamentals on Ruby Threads is still a bit shaky so I would appreciate any help on this. Though I register the callback i dont get a response from my gmail account. I am able to send a message but my ruby program terminates. In order to prevent it from terminating I tried to stop on of the threads in the program but I cant seem to get it working. require 'rubygems' require "xmpp4r/client" require "xmpp4r/roster" include Jabber def connect client = Client.new(JID::new("[email protected]")) client.connect client.auth("test") client.send(Presence.new.set_type(:available)) client end def create_message(message, to_email) msg = Jabber::Message::new(to_email, message) msg.type = :chat msg end def subscribe(email_id) pres = Presence.new.set_type(:subscribe).set_to(email_id) pres end client = connect roster = Roster::Helper.new(client) roster.add_subscription_request_callback do |item,pres| roster.accept_subscription(pres.from) end def create_callback(client) $t4= Thread.new do client.add_message_callback do |m| puts m.body puts "................................Callback working" end end end puts "Client has connected" msg = create_message("Welcome to the winter of my discontent", "[email protected]") client.send(msg) create_callback(client) def check(client) $t3 = Thread.new do loop do puts "t3 still running........." Thread.current.stop $t4.join end end end check(client)

    Read the article

  • VB.NET Dock problem

    - by Sid
    Whenever I am adding New TableLayoutPanel programmatically in a Panel by setting DockStyle.Top, the last added TableLayoutPanel goes at the top most position of the Panel and the TableLayoutPanel added first comes down. Example: If I add like 1 2 3 4 5 It adds as 5 4 3 2 1 Please help me to fix the problem. The TableLayoutPanels should maintain the order as I am adding. Thanx.

    Read the article

  • Java Conversion of byte[] into a srting and then back to a byte[]

    - by Sid
    I am working on a proxy server. I am getting data in byte[] which i convert into a string to perform certain operations. Now when i convert this new string back into a byte [] it causes unkonw problems. So mainly its like i need to know how to correctly convert a byte[] into a string and then back into a byte[] again. I tried to just convert the byte[] to string and then back to byte[] again (to make sure thats its not my operations that are causing problems). So its like: // where reply is a byte[] String str= new String(reply,0, bytesRead); streamToClient.write(str.getBytes(), 0, bytesRead); is not equivalent to streamToClient.write(reply, 0, bytesRead); my proxy works fine when i just send the byte[] without any conversion but when i convert it from byte[] to a string and then back to a byte[] its causes problems. can some one please help? =]

    Read the article

  • verifying the signature of x509

    - by sid
    Hi All, While verifying the certificate I am getting EVP_F_EVP_PKEY_GET1_DH My Aim - Verify the certificate signature. I am having 2 certificates : 1. a CA certificate 2. certificate issued by CA. I extracted the 'RSA Public Key (key)' Modulus From CA Certificate using, pPublicKey = X509_get_pubkey(x509); buf_len = (size_t) BN_num_bytes (bn); key = (unsigned char *)malloc (buf_len); n = BN_bn2bin (bn, (unsigned char *) key); if (n != buf_len) LOG(ERROR," : key error\n"); if (key[0] & 0x80) LOG(DEBUG, "00\n"); Now, I have CA public key & CA key length and also having certificate issued by CA in buffer, buffer length & public key. To verify the signature, I have following code int iRet1, iRet2, iRet3, iReason; iRet1 = EVP_VerifyInit(&md_ctx, EVP_sha1()); iRet2 = EVP_VerifyUpdate(&md_ctx, buf, buflen); iRet3 = EVP_VerifyFinal(&md_ctx, (const unsigned char *)CAkey, CAkeyLen, pubkey); iReason = ERR_get_error(); if(ERR_GET_REASON(iReason) == EVP_F_EVP_PKEY_GET1_DH) { LOG(ERROR, "EVP_F_EVP_PKEY_GET1_DH\n"); } LOG(INFO,"EVP_VerifyInit returned %d : EVP_VerifyUpdate returned %d : EVP_VerifyFinal = %d \n", iRet1, iRet2, iRet3); EVP_MD_CTX_cleanup(&md_ctx); EVP_PKEY_free(pubkey); if (iRet3 != 1) { LOG(ERROR,"EVP_VerifyFinal() failed\n"); ret = -1; } LOG(INFO,"signature is valid\n"); I am unable to figure out What might went wrong??? Please if anybody faced same issues? What EVP_F_EVP_PKEY_GET1_DH Error means? Thanks in Advance - opensid

    Read the article

  • x509 certificate verification in C

    - by sid
    Hi All, I do have certificates in DER and PEM format, My goal is to retrieve the fields of Issuer and Subject And verify the Certificate with the CA public key and simultaneously verify CA certificate with the Root public key. I am able to retrieve all the details of issuer and subject But unable to verify the certificate. Please help. The API's used, x509 = d2i_X509_fp (fp, &x509); //READING DER Format x509 = PEM_read_X509 (fp, &x509, NULL, NULL); //READING PEM Format X509_NAME_oneline(X509_get_subject_name(x509), subject, sizeof (subject)); //to retrive the Subject X509_NAME_oneline(X509_get_issuer_name(x509), issuer, sizeof (issuer)); //to retrive the Issuer // to store the CA public key (in unsigned char *key)that will be used to verify the certificate (My case Always sha1WithRSAEncryption) RSA *x = X509_get_pubkey(x509)->pkey.rsa; bn = x->n; //extracts the bytes from public key & convert into unsigned char buffer buf_len = (size_t) BN_num_bytes (bn); stored_CA_pubKey = (unsigned char *)malloc (buf_len); i_n = BN_bn2bin (bn, (unsigned char *)stored_CA_pubKey); if (i_n != buf_len) LOG(ERROR," : key error\n"); if (key[0] & 0x80) LOG(DEBUG, "00\n"); stored_CA_pubKeyLen = EVP_PKEY_size(X509_get_pubkey(x509)); For Verification I went through different approaches but unable to verify a) i_x509_verify = X509_verify(cert_x509, ca_pubkey); b) /* verify the signature */ int iRet1, iRet2, iReason; iRet1 = EVP_VerifyInit(&md_ctx, EVP_sha1()); iRet2 = EVP_VerifyUpdate(&md_ctx, cert_code, cert_code_len); rv = EVP_VerifyFinal(&md_ctx, (const unsigned char *)stored_CA_pubKey, stored_CA_pubKeyLen, cert_pubkey); NOTE : cert_code & stored_CA_pubKey is unsigned char buffer. Thanks in Advance

    Read the article

  • Using SQL dB column as a lock for concurrent operations in Entity Framework

    - by Sid
    We have a long running user operation that is handled by a pool of worker processes. Data input and output is from Azure SQL. The master Azure SQL table structure columns are approximated to [UserId, col1, col2, ... , col N, beingProcessed, lastTimeProcessed ] beingProcessed is boolean and lastTimeProcessed is DateTime. The logic in every worker role is: public void WorkerRoleMain() { while(true) { try { dbContext db = new dbContext(); // Read foreach (UserProfile user in db.UserProfile .Where(u => DateTime.UtcNow.Subtract(u.lastTimeProcessed) > TimeSpan.FromHours(24) & u.beingProcessed == false)) { user.beingProcessed = true; // Modify db.SaveChanges(); // Write // Do some long drawn processing here ... ... ... user.lastTimeProcessed = DateTime.UtcNow; user.beingProcessed = false; db.SaveChanges(); } } catch(Exception ex) { LogException(ex); Sleep(TimeSpan.FromMinutes(5)); } } // while () } With multiple workers processing as above (each with their own Entity Framework layer), in essence beingProcessed is being used a lock for MutEx purposes Question: How can I deal with concurrency issues on the beingProcessed "lock" itself based on the above load? I think read-modify-write operation on the beingProcessed needs to be atomic but I'm open to other strategies. Open to other code refinements too.

    Read the article

  • How does the proc in the caches_action if clause get execute

    - by Sid
    I have a newbie kind of question which I cant get my head around. How does the Proc in the if condition of the caches_action get executed for the caches_action method. for example caches_action :show, :if=Proc.new{|x| something} what i dont get its how does this get called. I know i can execute a proc defined as proc= Proc.new by proc.call so i dont understand how this gets called. Second how do I pass conditions like if logged_in? I'd appreciate any help on this

    Read the article

  • How do I read user input in python thread?

    - by Sid H
    I'm trying to read from a thread in python as follows import threading, time, random var = True class MyThread(threading.Thread): def set_name(self, name): self.name = name def run(self): global var while var == True: print "In mythread " + self.name time.sleep(random.randint(2,5)) class MyReader(threading.Thread): def run(self): global var while var == True: input = raw_input("Quit?") if input == "q": var = False t1 = MyThread() t1.set_name("One") t2 = MyReader() t1.start() t2.start() However, if I enter 'q', I see the following error. In mythread One Quit?q Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 522, in __bootstrap_inner self.run() File "test.py", line 20, in run input = raw_input("Quit?") EOFError In mythread One In mythread One How does on get user input from a thread?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >