Daily Archives

Articles indexed Thursday April 29 2010

Page 13/119 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Rule of precedence == over =

    - by robUK
    Hello, I am just wondering would it be better to do this: if((fd = open(filename, O_RDWR)) == -1) { fprintf(stderr, "open [ %s ]\n", strerror(errno)); return 1; } or this fd = open(filename, O_RDWR); if(fd == -1) { fprintf(stderr, "open [ %s ]\n", strerror(errno)); return 1; } Many thanks for any suggestions,

    Read the article

  • calling actionScript 2 function from C# help!

    - by phancuong87
    I want calling actionScript 2.0 function from c# , I using ExternalInterface.addCallback; In flash: ExternalInterface.addCallback("test", function (text : String) : Void { //code }); in C#: I using shockwave flash object player.CallFunction("" + "myString" + ""); but error: Error HRESULT E_FAIL has been returned from a call to a COM component. in C# I using cs4 and VS2008, please help me!

    Read the article

  • jScrollPane jEditable DOM problems

    - by Kyle Lafkoff
    Hello world, I am having a funky problem. See (this link won't disappear): www.skitzo.org/~el/bugjeditable.png for the firebug output screenshot. Here's my code. I run getJSON() to fetch the info from the PHP which pulls from DB and I fill a div with the result. I have jScrollPane and jEditable so a user can scroll down and click to edit any of the content. It works sometimes and then it doesn't work which makes me wonder if the browser is not interpreting the code properly or if I am misunderstanding fundamental DOM concepts here.... Here is a live current version of the code: http://www.musedates.com/testing.php $().ready(function() { $('#pane1').jScrollPane(); $('#tab_journal').tabs(); $('#tab2').load("/journal_new.php"); var i=0; var row = ''; var k, v, dt; $.getJSON("/ajax.php?j=22", function(data) { row = '<p>'; while(i<data.length) { $.each(data[i], function(k, v) { if (k == 'subject') { row += '<div style="font-size:1.5em; color:#000000;"><div class="editable" style="width:705px;" id="title-'+data[i].id+'">'+v+'</div></div>posted: '+dt+'<br />'; } else if (k == 'dt') { dt = v; } else if (k == 'msg') { row += '<div class="editableMsg" style="width:705px; height:40px;" id="msg-'+data[i].id+'">'+v+'</div></p>'; } }); i++; } $('#pane1').append(row).jScrollPane({scrollbarWidth:10, scrollbarMargin:10, showArrows:true}); }); $('.editable').livequery(function () { $('.editable').editable("/savejournal.php", { submitdata : function() { }, tooltip : 'Click to edit', indicator : '<img src="/UI/images/indicator.gif">', cancel : 'Cancel', submit : 'OK' }); $('.editableMsg').editable("/savejournal.php", { submitdata : function() { }, tooltip: 'Click to edit', indicator : '<img src="/UI/images/indicator.gif">', cancel : 'Cancel', submit : 'OK', type : 'textarea' }); $(".editable,.editableMsg").mouseover(function() { $(this).css('background-color', '#FDD017'); }); $(".editable,.editableMsg").mouseout(function() { $(this).css('background-color', '#fff'); }); }); }); And then the HTML: <div id="tab_container" style="margin:0px 0px 2px 8px;"> <ul id="tab_journal"> <li><a href="#tab1"><span>View / Edit</span></a></li> <li><a href="#tab2"><span>New Entry</span></a></li> </ul> </div> <div id="tab1" style="margin:0px 0px 0px 8px;"> <div id="pane1" class="scroll-pane super-wide"></div> </div> <div id="tab2" style="margin:0px 0px 0px 8px; width:700px;"></div> Thanks world.

    Read the article

  • How do I prevent programmatically the "Program Compatibility Assistant" in Vista (and Windows 7) fro

    - by Asaf
    I develop a C++ program which might use adobe flash, although it is not essential. I use CoCreateInstance to create the flash object, and if it fails, I know flash is not installed so I don't use it. However, in Vista (and I think Windows 7 as well), when flash is not installed, after leaving the application, the "Program Compatibility Assistant" pops up a message saying that "This program requires a missing Windows component" specifying the flash.ocx. Is there a way to prevent this message from appearing? I don't want to force any user to install flash (especially since it's the IE ActiveX, and FireFox users might not have it installed), and my application can operate well without the flash. Plus this message is really annoying when it appears after every run. I don't mean of course disabling the PCA on the user's machine, but programmatically disable this specific appearance on all machines. Any thoughts? Thanks [EDIT:] I followed Shay's lead (thanks), and did some more digging of my own. I added the following XML to the application's manifest: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false"> </requestedExecutionLevel> </requestedPrivileges> </security> </trustInfo> (see also: msdn.microsoft.com/en-us/library/bb756929.aspx) This solved the problem on Vista 64. To solve the same problem on Windows 7, I added the following: <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!--The ID below indicates application support for Windows Vista --> <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> <!--The ID below indicates application support for Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> </application> </compatibility> (See also: blogs.msdn.com/yvesdolc/archive/2009/09/22/the-new-compatibility-section-in-the-application-manifest.aspx) Solved Windows 7. But for some reason, it still happens in Vista 32... I also tried editing the manifest of the specific DLL which causes the problem, but it had no effect. Only the executable's manifest itself affected the problem. So... Vista 32?

    Read the article

  • ClickOnce File will not associate on open from web browser download

    - by mstrickland
    I have a ClickOnce program that associates with a given extension and that works fine if the file is located on the file system. My problem comes in when this file is downloaded from a website. I have a web handler that prompts the user to Click to download the file. Upon clicking the link the user is presenter with an Open or Save Dialog. If the user chooses Open the program will not launch. If the user saves the file to their hard drive and then clicks the file the association will work. Any advice on getting the association to work on the prompt when the user clicks Open or is a Save required? -Edit : Tested this on both IE8 and Chrome with same result.

    Read the article

  • Connecting to a WSE 3.0 Web Service From a WCF Client

    - by Dave
    I'm having difficulty connecting to a 3rd party WSE 3.0 web service from a WCF client. I have implemented the custom binding class as indicated in this KB article: http://msdn.microsoft.com/en-us/library/ms734745.aspx The problem seems to have to do with the security assertion used by the web service - UsernameOverTransport. When I attempt to call a method, I get the following exception: System.InvalidOperationException: The 'WseHttpBinding'.'[namespace]' binding for the 'MyWebServiceSoap'.'[namespace]' contract is configured with an authentication mode that requires transport level integrity and confidentiality. However the transport cannot provide integrity and confidentiality.. It is expecting a username, password, and CN number. In the example code supplied to us by the vendor, these credentials are bundled in a Microsoft.Web.Services3.Security.Tokens.UsernameToken. Here's the example supplied by the vendor: MyWebServiceWse proxy = new MyWebServiceWse(); UsernameToken token = new UsernameToken("Username", "password", PasswordOption.SendPlainText); token.Id = "<supplied CN Number>"; proxy.SetClientCredential(token); proxy.SetPolicy(new Policy(new UsernameOverTransportAssertion(), new RequireActionHeaderAssertion())); MyObject mo = proxy.MyMethod(); This works fine from a 2.0 app w/ WSE 3.0 installed. Here is a snippet of the code from my WCF client: EndpointAddress address = new EndpointAddress(new Uri("<web service uri here>")); WseHttpBinding binding = new WseHttpBinding(); // This is the custom binding I created per the MS KB article binding.SecurityAssertion = WseSecurityAssertion.UsernameOverTransport; binding.EstablishSecurityContext = false; // Not sure about the value of either of these next two binding.RequireDerivedKeys = true; binding.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt; MembershipServiceSoapClient proxy = new MembershipServiceSoapClient(binding, address); // This is where I believe the problem lies – I can’t seem to properly setup the security credentials the web service is expecting proxy.ClientCredentials.UserName.UserName = "username"; proxy.ClientCredentials.UserName.Password = "pwd"; // How do I supply the CN number? MyObject mo = proxy.MyMethod(); // this throws the exception I've scoured the web looking for an answer to this question. Some sources get me close (like the MS KB article), but I can't seem to get over the hump. Can someone help me out?

    Read the article

  • Nhibernate: One-To-Many mapping problem - Cannot cascade delete without inverse. Set NULL error

    - by KnaveT
    Hi, I have the current scenario whereby an Article has only 1 Outcome each. Each Article may or may not have an Outcome. In theory, this is a one-to-one mapping, but since NHibernate does not really support one-to-one, I used a One-To-Many to substitute. My Primary Key on the child table is actually the ArticleID (FK). So I have the following setup: Classes public class Article { public virtual Int32 ID { get;set;} private ICollection<ArticleOutcome> _Outcomes {get;set;} public virtual ArticleOutcome Outcome { get { if( this._Outcomes !=null && this._Outcomes.Count > 0 ) return this._Outcomes.First(); return null; } set { if( value == null ) { if( this._Outcomes !=null && this._Outcomes.Count > 0 ) this._Outcomes.Clear(); } else { if( this._Outcomes == null ) this._Outcomes = new HashSet<ArticleOutcome>(); else if ( this._Outcomes.Count >= 1 ) this._Outcomes.Clear(); this._Outcomes.Add( value ); } } } } public class ArticleOutcome { public virtual Int32 ID { get;set; } public virtual Article ParentArticle { get;set;} } Mappings public class ArticleMap : ClassMap<Article> { public ArticleMap() { this.Id( x=> x.ID ).GeneratedBy.Identity(); this.HasMany<ArticleOutcome>( Reveal.Property<Article>("_Outcomes") ) .AsSet().KeyColumn("ArticleID") .Cascade.AllDeleteOrphan() //Cascade.All() doesn't work too. .LazyLoad() .Fetch.Select(); } } public class ArticleOutcomeMap : ClassMap<ArticleOutcome> { public ArticleOutcomeMap(){ this.Id( x=> x.ID, "ArticleID").GeneratedBy.Foreign("ParentArticle"); this.HasOne( x=> x.ParentArticle ).Constrained (); //This do not work also. //this.References( x=> x.ParentArticle, "ArticleID" ).Not.Nullable(); } } Now my problem is this: It works when I do an insert/update of the Outcome. e.g. var article = new Article(); article.Outcome = new ArticleOutcome { xxx = "something" }; session.Save( article ); However, I encounter SQL errors when attempting to delete via the Article itself. var article = session.Get( 123 ); session.Delete( article ); //throws SQL error. The error is something to the like of Cannot insert NULL into ArticleID in ArticleOutcome table. The deletion works if I place Inverse() to the Article's HasMany() mapping, but insertion will fail. Does anyone have a solution for this? Or do I really have to add a surrogate key to the ArticleOutcome table?

    Read the article

  • Blogger Template not saving after Facebook like changes

    - by David Shellabarger
    I've add the facebook Like button to http://www.goldfishview.com/ and that works great. Its powered by Blogger. Now I want to move it to the end of my posts instead of a the beginning. I move the facebook iframe and the preview looks great, but once I save the template it reverts back to were it was. I've tried in Chrome and Firefox. In Chrome after I click preview the save template button becomes useless and doesn't do anything when I click on it. In Firefox everything looks like it takes, but on page refresh the iFrame goes back to its original position. Am I crazy?

    Read the article

  • Which is the best alternative for Java Serialization?

    - by Alotor
    I'm currently working on a project which needs to persist any kind of objects (of which implementation we don't have any control) so these objects could be recovered afterwards. We can't implement a ORM because we can't restrict the users of our library at development time. Our first alternative was to serialize it with the Java default serialization but we had a lot of trouble recovering the objects when the users started to pass different versions of the same object (attributes changed types, names, ...). We have tried with the XMLEncoder class (transforms an object into a XML), but we have found that there is a lack of functionality (doesn't support Enums for example). Finally, we also tried JAXB but this impose our users to annotate their classes. Any good alternative?

    Read the article

  • Machine Code tutorial for Mac

    - by None
    I want to learn machine code. Not for a specific reason. Just for the heck of it. I was wondering if there were any good machine code tutorials. I have a macbook with a 2.4 GHz Intel Core 2 Duo processor.

    Read the article

  • .NET: How does the use of components in .NET differ to pre-.NET?

    - by Craig Johnston
    How does the use of components in .NET differ to pre-.NET? I see the differences as: .NET components don't have to be centrally registered on a machine and can merely be invoked at run-time from a specified location if .NET components are 'registered' in the GAC, problems asociated with different versions of the same DLL ("DLL hell") are avoided because each version will have its own id/key which is known to the calling program Is the above correct, and what other relevant differences are there?

    Read the article

  • SQL query for the latest record for each day

    - by Mac
    I've got an Oracle 10g database with a table with a structure and content very similar to the following: CREATE TABLE MyTable ( id INTEGER PRIMARY KEY, otherData VARCHAR2(100), submitted DATE ); INSERT INTO MyTable VALUES (1, 'a', TO_DATE('28/04/2010 05:13', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (2, 'b', TO_DATE('28/04/2010 03:48', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (3, 'c', TO_DATE('29/04/2010 05:13', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (4, 'd', TO_DATE('29/04/2010 17:16', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (5, 'e', TO_DATE('29/04/2010 08:49', ''DD/MM/YYYY HH24:MI)); What I need to do is query the database for the latest record submitted on each given day. For example, with the above data I would expect the records with ID numbers 1 and 4 to be returned, as these are the latest each for 28 April and 29 April respectively. Unfortunately, I have little expertise as far as SQL is concerned. Could anybody possibly provide some insight as to how to achieve this? Thanks in advance!

    Read the article

  • static constants return instance of specific class in Flex?

    - by Sang
    So here's what I mean. Let's say I have a class ErrorMessages which holds all my error messages as static constants. So I could access them like ErrorMessages.PASSWORD_INVALID or ErrorMessage.PASSWORD_TOO_SHORT. I want to know if it is possible to have separate classes that hold subset of these constants and access them like ErrorMessages.PASSWORD.INVALID or ErrorMessages.PASSWORD.TOO_SHORT, etc. This way I can more structured static structure and makes it much easier to use autocomplete. I tried few different ways and couldn't figure out if this was possible..

    Read the article

  • Multitasking the Android Way

    [This post is by Dianne Hackborn, a Software Engineer who sits very near the exact center of everything Android. — Tim Bray] Android is fairly unique in the ways it allows...

    Read the article

  • how to download all links at once..

    - by user216112
    hello friends,i want to ask u ..is there any software..that download all the link at once.. like e.g. in w3school.com. if we want to download all the php tutorial at once.someone has told me "tglepote".bt i am getting on the google.plz help

    Read the article

  • Windows 7 BSOD Crashes

    - by Shane Andrade
    I recently upgraded to Windows 7 64 doing a clean install from Vista 64 and ever since I keep getting random blue screen crashes. I have the feeling it's caused by my video card but everything has the most up-to-date drivers for Windows 7 64 bit. Here is the memory dump from my most recent crash: MEMORY_MANAGEMENT (1a) # Any other values for parameter 1 must be individually examined. Arguments: Arg1: 0000000000041790, The subtype of the bugcheck. Arg2: fffffa8001990b90 Arg3: 000000000000ffff Arg4: 0000000000000000 Debugging Details: ------------------ PEB is paged out (Peb.Ldr = 000007ff`fffd9018). Type ".hh dbgerr001" for details PEB is paged out (Peb.Ldr = 000007ff`fffd9018). Type ".hh dbgerr001" for details BUGCHECK_STR: 0x1a_41790 DEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT PROCESS_NAME: csrss.exe CURRENT_IRQL: 0 LAST_CONTROL_TRANSFER: from fffff80002cff26e to fffff80002c8cf00 STACK_TEXT: fffff880`0299ae38 fffff800`02cff26e : 00000000`0000001a 00000000`00041790 fffffa80`01990b90 00000000`0000ffff : nt!KeBugCheckEx fffff880`0299ae40 fffff800`02cc05d9 : fffffa80`00000000 00000000`01e73fff 00000000`00000000 fffff960`0023653f : nt! ?? ::FNODOBFM::`string'+0x339d6 fffff880`0299b000 fffff800`02fa2e50 : fffffa80`09140c90 0007ffff`00000000 00000000`00000000 00000000`00000000 : nt!MiRemoveMappedView+0xd9 fffff880`0299b120 fffff960`002e381b : fffff900`00000000 fffffa80`07c85d10 00000000`00000001 fffff900`c1e56cd0 : nt!MiUnmapViewOfSection+0x1b0 fffff880`0299b1e0 fffff960`002b4fc1 : 00000000`00000000 fffff900`00000000 fffff900`c1e56cd0 00000000`00000000 : win32k!SURFACE::bUnMapImmediate+0x5b fffff880`0299b210 fffff960`002b527b : fffff900`c07fdd10 fffff8a0`00000000 00000000`00000000 00000000`00000000 : win32k!bMigrateSurfaceForConversion+0x5ad fffff880`0299b340 fffff960`002dc3e3 : fffff900`00000000 fffff900`c1e5c010 00000000`00000000 00000000`00000000 : win32k!pConvertDfbSurfaceToDibInternal+0x1cb fffff880`0299b420 fffff960`002b5319 : fffffa80`07c7f470 00000000`00000001 00000000`00000000 00000000`00000282 : win32k!MulConvertChildRedirectionDfbSurfaceToDib+0x53 fffff880`0299b460 fffff960`002b1267 : fffff900`c0132010 fffff900`c0132010 00000000`00000000 00000000`00000000 : win32k!pConvertDfbSurfaceToDib+0x41 fffff880`0299b490 fffff960`002b1b1f : fffff900`c0132010 00000000`00000001 fffff900`c24cc280 fffff900`c0132010 : win32k!bDynamicRemoveAllDriverRealizations+0x4f fffff880`0299b4c0 fffff960`00273bb9 : 00000000`00000000 fffff900`00000000 fffff900`00000000 00000000`00000000 : win32k!bDynamicModeChange+0x1d7 fffff880`0299b5a0 fffff960`000baa2d : 00000000`00000000 00000000`00000000 00000000`00000000 07cd8220`00000003 : win32k!DrvInternalChangeDisplaySettings+0xc7d fffff880`0299b7e0 fffff960`001a2c41 : 00000000`00000040 fffff900`c00bf010 00000000`00000000 07cd8220`00000003 : win32k!DrvChangeDisplaySettings+0x62d fffff880`0299b9c0 fffff960`001a2e9e : fffffa80`07cd8220 00000000`00000000 00000000`00000000 fffff800`02f6fec3 : win32k!xxxInternalUserChangeDisplaySettings+0x329 fffff880`0299ba80 fffff960`001a033a : 00000000`00000000 00000000`00000000 00998b21`81a100b6 00000000`00000040 : win32k!xxxUserChangeDisplaySettings+0x92 fffff880`0299bb70 fffff960`001a053a : 00000000`00000000 00000000`00000001 00000000`00000000 00000000`00000000 : win32k!xxxRemoteSetDisconnectDisplayMode+0x42 fffff880`0299bbb0 fffff960`00183ea6 : 00000000`00000000 fffffa80`06efeb60 fffff880`0299bca0 00000000`00000005 : win32k!xxxRemoteDisconnect+0x1c2 fffff880`0299bbf0 fffff800`02c8c153 : fffffa80`06efeb60 00000000`00000005 00000000`00000020 00000000`00000000 : win32k!NtUserCallNoParam+0x36 fffff880`0299bc20 000007fe`fd6b3d3a : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nt!KiSystemServiceCopyEnd+0x13 00000000`027cf798 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : 0x7fe`fd6b3d3a STACK_COMMAND: kb FOLLOWUP_IP: win32k!SURFACE::bUnMapImmediate+5b fffff960`002e381b f6477401 test byte ptr [rdi+74h],1 SYMBOL_STACK_INDEX: 4 SYMBOL_NAME: win32k!SURFACE::bUnMapImmediate+5b FOLLOWUP_NAME: MachineOwner MODULE_NAME: win32k IMAGE_NAME: win32k.sys DEBUG_FLR_IMAGE_TIMESTAMP: 4a5bc5e0 FAILURE_BUCKET_ID: X64_0x1a_41790_win32k!SURFACE::bUnMapImmediate+5b BUCKET_ID: X64_0x1a_41790_win32k!SURFACE::bUnMapImmediate+5b Followup: MachineOwner

    Read the article

  • iPhone SDK: loading UITableView from SQLite

    - by leon
    Hi, I think I got a good handle on UITableViews and on getting/inserting data from/to SQLite db. I am straggling with an architectural question. My application saves 3 values int the database, there can be many/many rows. However would I load them in the table? From all the tutorials I have seen, at one point entire database is loaded in the NSMutableArray or similar object via performing SELECT statement. Then when -(UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath called, rows required are dolled out from the previous loaded NSMutableArray (or similar stracture). But what i have have thousands for rows? Why would I pre-load them? Should I just query database each time cellForRowAtIndexPath is called? If so, what would I use as an index? Each row in the table will have an AUTOINCREMENT index, but since some rows may be deleted index will not correspond to rows in the table (in the SQL I may have something like this with row with index 3 missing): 1 Data1 Data1 2 Data2 Data2 4. data3 data3 Thanks

    Read the article

  • C++ Char without Limit

    - by Lienau
    I'm pretty well versed in C#, but I decided it would be a good idea to learn C++ as well. The only thing I can't figure out is chars. I know you can use the string lib but I also want to figure out chars. I know you can set a char with a limit like this: #include <iostream> using namespace std; int main() { char c[128] = "limited to 128"; cout << c << endl; system("pause"); return 0; } But how would I make a char without a limit? I've seen chars with * but I though that was for pointers. Any help is greatly appreciated.

    Read the article

  • Changing UIView on orientation change

    - by Designeveloper
    Hey all. I have a fairly simple question. I am developing a "rich" iPad app, and I have two background images specifically designed for landscape and portrait. I'd like this ImageView to automatically change depending on the devices orientation. (like pretty much all of Apples iPad apps). Can anyone point me in the right direction? I'm assuming it would be something I do on viewDidLoad..

    Read the article

  • FindBugs and CheckForNull on classes vs. interfaces

    - by ndn
    Is there any way to let FindBugs check and warn me if a CheckForNull annotation is present on the implementation of a method in a class, but not on the declaration of the method in the interface? import javax.annotation.CheckForNull; interface Foo { public String getBar(); } class FooImpl implements Foo { @CheckForNull @Override public String getBar() { return null; } } public class FindBugsDemo { public static void main(String[] args) { Foo foo = new FooImpl(); System.out.println(foo.getBar().length()); } } I just discovered a bug in my application due to a missing null check that was not spotted by FindBugs because CheckForNull was only present on FooImpl, but not on Foo, and I don't want to spot all other locations of this problem manually.

    Read the article

  • How to get/obtain Variables from URL in Flash AS3

    - by Leon
    So I have a URL that I need my Flash movie to extract variables from: example link: http://www.example.com/example_xml.php?aID=1234&bID=5678 I need to get the aID and the bID numbers. I'm able to get the full URL into a String via ExternalInterface var url:String = ExternalInterface.call("window.location.href.toString"); if (url) testField.text = url; Just unsure as how to manipulate the String to just get the 1234 and 5678 numbers. Appreciate any tips, links or help with this!

    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

  • Can this extension method be improve

    - by Newbie
    I have the following extension method public static class ListExtensions { public static IEnumerable<T> Search<T>(this ICollection<T> collection, string stringToSearch) { foreach (T t in collection) { Type k = t.GetType(); PropertyInfo pi = k.GetProperty("Name"); if (pi.GetValue(t, null).Equals(stringToSearch)) { yield return t; } } } } What it does is by using reflection, it finds the name property and then filteres the record from the collection based on the matching string. This method is being called as List<FactorClass> listFC = new List<FactorClass>(); listFC.Add(new FactorClass { Name = "BKP", FactorValue="Book to price",IsGlobal =false }); listFC.Add(new FactorClass { Name = "YLD", FactorValue = "Dividend yield", IsGlobal = false }); listFC.Add(new FactorClass { Name = "EPM", FactorValue = "emp", IsGlobal = false }); listFC.Add(new FactorClass { Name = "SE", FactorValue = "something else", IsGlobal = false }); List<FactorClass> listFC1 = listFC.Search("BKP").ToList(); It is working fine. But a closer look into the extension method will reveal that Type k = t.GetType(); PropertyInfo pi = k.GetProperty("Name"); is actually inside a foreach loop which is actually not needed. I think we can take it outside the loop. But how? PLease help. (C#3.0)

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >