Search Results

Search found 1722 results on 69 pages for 'andrew sullivan'.

Page 41/69 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Skype Mac API - Use AppleScript or 5 year old API?

    - by Andrew
    I have a x86_64 app that I would like to have optionally read Skype status messages. However, the 5 year old skype mac framework is 32-bit, and if there is a way to have that compile within a 64-bit app, I haven't found it. My question is, basically, how should I go about doing this? I really only need to get and set the USERSTATUS AWAY/ONLINE string. Using AppleScript, a "Should Skype allow this" dialog pops up... every time. This is highly inefficient and downright irritating. Advice? I'm considering writing a 32-bit CLI wrapper, but that seems like overkill.

    Read the article

  • PHP: How to copy elements from an associative array and place them at the beginning of the array?

    - by Andrew
    I have an array of countries that I will be using in a select menu: array( [0] => " -- Select -- " [1] => "Afghanistan" [3] => "Albania" [4] => "Algeria" [39] => "Canada" [47] => "USA" ) //etc... I want to copy create copies of the Canada and USA entries and place them at the front of my array. So the array should end up looking like this: array( [0] => " -- Select -- " [47] => "USA" [39] => "Canada" [1] => "Afghanistan" [3] => "Albania" [4] => "Algeria" [39] => "Canada" [47] => "USA" ) //etc... The array keys correspond to their ID in the database, so I can't change the keys. How can I achieve this?

    Read the article

  • POSTDATA, ASIHTTPrequest + instapaper

    - by Andrew
    Hi guys, I'm trying to use ASIHTTPRequest to submit links to instapaper (http://www.instapaper.com/api). I'm able to authenticate but I get a 400 response when trying to submit a link, so I'm clearly in need of figuring how to use postdata. Any help appreciated. Sample code attached. Thanks NSURL *url = [NSURL URLWithString:urlInstapaperAddUrl]; ASIHTTPRequest instapaperAuthRequest = [ASIHTTPRequest requestWithURL:url]; [instapaperAuthRequest setDelegate:self]; [instapaperAuthRequest setRequestMethod:@"PUT"]; NSData temp = [[NSData alloc] initWithData:[@"url=http://www.redhat.com" dataUsingEncoding:NSASCIIStringEncoding]]; [instapaperAuthRequest appendPostData:temp]; [instapaperAuthRequest addBasicAuthenticationHeaderWithUsername:@"myusername" andPassword:@"mypassword"]; [instapaperAuthRequest startAsynchronous];

    Read the article

  • Separate functionality depending on Role in ASP.NET MVC

    - by Andrew Bullock
    I'm looking for an elegant pattern to solve this problem: I have several user roles in my system, and for many of my controller actions, I need to deal with slightly different data. For example, take /Users/Edit/1 This allows a Moderator to edit a users email address, but Administrators to edit a user's email address and password. I'd like a design for separating the two different bits of action code for the GET and the POST. Solutions I've come up with so far are: Switch inside each method, however this doesn't really help when i want different model arguments on the POST :( Custom controller factory which chooses a UsersController_ForModerators and UsersController_ForAdmins instead of just UsersController from the controller name and current user role Custom action invoker which choose the Edit_ForModerators method in a similar way to above Have an IUsersController and register a different implementation of it in my IoC container as a named instance based on Role Build an implementation of the controller at runtime using Castle DynamicProxy and manipulate the methods to those from role-based implementations Im preferring the named IoC instance route atm as it means all my urls/routing will work seamlessly. Ideas? Suggestions?

    Read the article

  • c++ exceptions and program execution logic

    - by Andrew
    Hello everyone, I have been thru a few questions but did not find an answer. I wonder how should the exception handling be implemented in a C++ software so it is centralized and it is tracking the software progress? For example, I want to process exceptions at four stages of the program and know that exception happened at that specific stage: 1. Initialization 2. Script processing 3. Computation 4. Wrap-up. At this point, I tried this: int main (...) { ... // start logging system try { ... } catch (exception &e) { cerr << "Error: " << e.what() << endl; cerr << "Could not start the logging system. Application terminated!\n"; return -1; } catch(...) { cerr << "Unknown error occured.\n"; cerr << "Could not start the logging system. Application terminated!\n"; return -2; } // open script file and acquire data try { ... } catch (exception &e) { cerr << "Error: " << e.what() << endl; cerr << "Could not acquire input parameters. Application terminated!\n"; return -1; } catch(...) { cerr << "Unknown error occured.\n"; cerr << "Could not acquire input parameters. Application terminated!\n"; return -2; } // computation try { ... } ... This is definitely not centralized and seems stupid. Or maybe it is not a good concept at all?

    Read the article

  • Powershell - Splitting variable into chunks

    - by Andrew
    I have written a query in Powershell interrogating a F5 BIG-IP box through it's iControl API to bring back CPU usage etc. Using this code (see below) I can return the data back into a CSV format which is fine. However the $csvdata variable contains all the data. I need to be able to take this variable and for each line split each column of data into a seperate variable. The output currently looks like this: timestamp,"Utilization" 1276181160,2.3282800000e+00 Any advice would be most welcome $SystemStats = (Get-F5.iControl).SystemStatistics ### Allocate a new Query Object and add the inputs needed $Query = New-Object -TypeName iControl.SystemStatisticsPerformanceStatisticQuery $Query.object_name = $i $Query.start_time = $startTime $Query.end_time = 0 $Query.interval = $interval $Query.maximum_rows = 0 ### Make method call passing in an array of size one with the specified query $ReportData = $SystemStats.get_performance_graph_csv_statistics( (,$Query) ) ### Allocate a new encoder and turn the byte array into a string $ASCII = New-Object -TypeName System.Text.ASCIIEncoding $csvdata = $ASCII.GetString($ReportData[0].statistic_data)

    Read the article

  • Rails auto_complete "undefined method `auto_complete_for'" problem

    - by Andrew Wize
    rails - 2.3.8 ruby - 1.8.7 After auto_complete plugin installstion i still have "undefined method `auto_complete_for'" problem! Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$ ruby script/plugin install http://github.com/rails/auto_complete.git --force svn: '/Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins' is not a working copy Initialized empty Git repository in /Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins/auto_complete/.git/ warning: Option "depth" is ignored for github.com/rails/auto_complete.git From github.com/rails/auto_complete * branch HEAD - FETCH_HEAD Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$ after restarting server i get an error on line " auto_complete_for :listings, :name " - undefined method `auto_complete_for' for #

    Read the article

  • Practical Experience using Stripes?

    - by Andrew Whitehouse
    I am coming from an Enterprise Java background which involves a fairly heavyweight software stack, and have recently discovered the Stripes framework; my initial impression is that this seems to do a good job of minimising the unpleasant parts of building a web application in Java. Has anyone used Stripes for a project that has gone live? And can you share your experiences from the project? Also, did you consider any other technologies and (if so) why did you chose Stripes?

    Read the article

  • WCF. BasicHttpBinding Certificates.

    - by Andrew Kalashnikov
    Hello colleagues. I've got some problems. I've created WCF service with basicHttpBinding and hosted by IIS 6.0. <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BindingConfiguration1" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> <security mode="Transport"> <transport clientCredentialType="None" /> </security> </binding> </basicHttpBinding> </bindings> <services> <service name="RegistratorService.Registrator" behaviorConfiguration="RegistratorService.Service1Behavior"> <endpoint address="" binding="basicHttpBinding" contract="RegistratorService.IRegistrator" bindingConfiguration="BindingConfiguration1"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="RegistratorService.Service1Behavior"> <serviceCredentials> <clientCertificate> <authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck"/> </clientCertificate> <serviceCertificate storeLocation="LocalMachine" storeName="My" findValue="CN=Server" /> </serviceCredentials> <serviceMetadata httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> Also I have cert authority on this server and I issue certs for server and client. I server cert at server and client cert at client. When I try consume service from client I get famous: "Could not establish trust relationship for the SSL/TLS secure channel with authority" All sites recommend override ServicePointManager.ServerCertificateValidationCallback by set return value to true. Bu I want decide this issue other right way. My client config: <system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="ClientBehavior"> <clientCredentials> <serviceCertificate> <authentication certificateValidationMode="ChainTrust" revocationMode="NoCheck"/> </serviceCertificate> <clientCertificate findValue="CN=PharmPortal" storeLocation="LocalMachine" storeName="My"/> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IRegistrator" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="Transport"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> </security> </binding> </basicHttpBinding> </bindings> <client > <endpoint address="https://aurit-server2/Registrator.svc" binding="basicHttpBinding" behaviorConfiguration="ClientBehavior" bindingConfiguration="BasicHttpBinding_IRegistrator" contract="ServiceReference1.IRegistrator" name="BasicHttpBinding_IRegistrator" > <identity> <dns value="Server" /> </identity> </endpoint> </client> </system.serviceModel> I set up client certificate. Why i get error?

    Read the article

  • Javascript code for handling Form behaviour.

    - by Andrew
    Hello, Here's how the situation looks : I have a couple simple forms <form action='settings.php' method='post'> <input type='hidden' name='setting' value='value1'> <input type='submit' value='Value1'> </form> Other small forms close to it have value2, value3, ... for the specific setting1, etc. Now, I have all these forms placed on the settings.php subpage, but I'd also like to have copies of one or two of them on the index.php subpage (for ease of access, as they are in certain situations rather frequently used). Thing is I do not want those forms based on the index.php to redirect me in any way to settings.php, just post the hidden value to alter settings and that's all. How can I do this with JS ? Cheers

    Read the article

  • Common lisp, CFFI, and instantiating c structs

    - by andrew
    Hi, I've been on google for about, oh, 3 hours looking for a solution to this "problem." I'm trying to figure out how to instantiate a C structure in lisp using CFFI. I have a struct in c: struct cpVect{cpFloat x,y;} Simple right? I have auto-generated CFFI bindings (swig, I think) to this struct: (cffi:defcstruct #.(chipmunk-lispify "cpVect" 'classname) (#.(chipmunk-lispify "x" 'slotname) :double) (#.(chipmunk-lispify "y" 'slotname) :double)) This generates a struct "VECT" with slots :X and :Y, which foreign-slot-names confirms (please note that I neither generated the bindings or programmed the C library (chipmunk physics), but the actual functions are being called from lisp just fine). I've searched far and wide, and maybe I've seen it 100 times and glossed over it, but I cannot figure out how to create a instance of cpVect in lisp to use in other functions. Note the function: cpShape *cpPolyShapeNew(cpBody *body, int numVerts, cpVect *verts, cpVect offset) Takes not only a cpVect, but also a pointer to a set of cpVects, which brings me to my second question: how do I create a pointer to a set of structs? I've been to http://common-lisp.net/project/cffi/manual/html_node/defcstruct.html and tried the code, but get "Error: Unbound variable: PTR" (I'm in Clozure CL), not to mention that looks to only return a pointer, not an instance. I'm new to lisp, been going pretty strong so far, but this is the first real problem I've hit that I can't figure out. Thanks!

    Read the article

  • Why its not working?

    - by Andrew Hoffmann
    BinaryReader br = new BinaryReader(Console.OpenStandardInput()); BinaryWriter bw = new BinaryWriter(Console.OpenStandardOutput()); int n = br.ReadInt32(); bw.Write(n); always getting this error: Unhandled Exception: System.IO.EndOfStreamException: Failed to read past end of stream. at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x00000] in <filename unknown>:0 at System.IO.BinaryReader.ReadInt32 () [0x00000] in <filename unknown>:0 at Program.Main () [0x00025] in /home/skydos/ACM/Csharp/Csharp/Main.cs:24 Is there any way to make reading data in C# faster from Console?

    Read the article

  • How much user data should be required to grant a password reset?

    - by Andrew Heath
    I'm looking to add password-reset functionality to my site and have been browsing the numerous threads discussing various aspects of that issue here on SO. One thing I haven't really seen clarified is how much information to require from the user for confirmation before sending out the reset email. is email alone enough? email + account username? email + account username + some other identifying value all accounts must input? I don't want my site to seem like an old wrinkly nun with a ruler, but I don't want people to be able to abuse the password reset system willy-nilly. Suggestions?

    Read the article

  • KERN-EXEC 3 when navigating within a text box (Symbian OS Browser Control)

    - by Andrew Flanagan
    I've had nothing but grief using Symbian's browser control on S60 3rd edition FP1. We currently display pages and many things are working smoothly. However, when inputting text into an HTML text field, the user will get a KERN-EXEC 3 if they move left at the beginning of the text input area (which should "wrap" it to the end) or if they move right at the end of the text input area (which should "wrap" it to the beginning). I can't seem to trap the input in OfferKeyEventL. I get the key event, I return EKeyWasConsumed and the cursor still moves. TKeyResponse CMyAppContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) { if (iBrCtlInterface) // My browser control { TBrCtlDefs::TBrCtlElementType type = iBrCtlInterface->FocusedElementType(); if (type == TBrCtlDefs::EElementActivatedInputBox || type == TBrCtlDefs::EElementInputBox) { if (aKeyEvent.iScanCode == EStdKeyLeftArrow || aKeyEvent.iScanCode == EStdKeyRightArrow) { return EKeyWasConsumed; } } } } I would be okay with completely disabling arrow key navigation but can't seem to do this. Any ideas? Am I going about this the wrong way? Has anyone here even worked with the Browser Control library (browserengine.lib) on S60 3.1?

    Read the article

  • "[object Object]" passed instead of the actual object as parameter

    - by Andrew Latham
    I am using Heroku with a Ruby on Rails application, and running from Safari. I have the following Ajax call: $.ajax({ type : 'POST', url : '/test_page', data : {stuff: arr1}, dataType : 'script' }); arr1 is supposed to be an array of objects. There's a console.log right before that, and it is: [Object, Object, Object, Object, Object, ...] However, I got an error on the server side when I made this ajax call. The logs showed 2012-10-01T03:13:34+00:00 app[web.1]: Parameters: {"stuff"=>"[object Object]"} 2012-10-01T03:13:34+00:00 app[web.1]: WARNING: Can't verify CSRF token authenticity 2012-10-01T03:13:34+00:00 app[web.1]: NoMethodError (undefined method `to_hash' for "[object Object]":String): 2012-10-01T03:13:34+00:00 app[web.1]: Completed 500 Internal Server Error in 1ms I'm unable to replicate the error. It's really confusing to me - what would cause that string to sometimes be passed to the server instead of the object?

    Read the article

  • How sophisticated should be DAL?

    - by Andrew Florko
    Basically, DAL (Data Access Layer) should provide simple CRUD (Create/Read/Update/Delete) methods but I always have a temptation to create more sophisticated methods in order to minimize database access roundtrips from Business Logic Layer. What do you think about following extensions to CRUD (most of them are OK I suppose): Read: GetById, GetByName, GetPaged, GetByFilter... e.t.c. methods Create: GetOrCreate methods (model entity is returned from DB or created if not found and returned), Create(lots-of-relations) instead of Create and multiple AssignTo methods calls Update: Merge methods (entities list are updated, created and deleted in one call) Delete: Delete(bool children) - optional children delete, Cleanup methods Where do you usually implement Entity Cache capabilities? DAL or BLL? (My choice is BLL, but I have seen DAL implementations also) Where is the boundary when you decide: this operation is too specific so I should implement it in Business Logic Layer as DAL multiple calls? I often found insufficient BLL operations that were implemented in dozen database roundtrips because developer was afraid to create a bit more sophisticated DAL. Thank you in advance!

    Read the article

  • Keep width even when column changes. (HTML)

    - by Andrew
    I have a login on the left sidebar of my website. When a user is logged in, the sidebar width doesn't remain the same as it was when the user wasn't logged in. Is there a way to keep the width the same? <!-- Start Sidebar --> <td id="sidebar" valign="top" height="400px" style="width: 200px"> <!-- Login Form --> <table id="TABLE2"> <tr> <td valign="top"> <asp:LoginView ID="LoginView1" runat="server"> <LoggedInTemplate> <br /> <br /> You are currently logged in. </LoggedInTemplate> <AnonymousTemplate> <asp:Login ID="Login1" runat="server" BorderPadding="0" BorderStyle="None" BorderWidth="0px" Font-Names="Verdana" Font-Size="0.8em" CreateUserText="Sign Up Now!" CreateUserUrl="http://www.tiltonindustries.com/Tilton/Login/CreateAccount.aspx" Height="1px" PasswordRecoveryText="Forgot your password?" PasswordRecoveryUrl="http://www.tiltonindustries.com/Tilton/Login/ForgotPassword.aspx" TextLayout="TextOnTop" Width="200px" DestinationPageUrl="http://www.tiltonindustries.com/Tilton/default.aspx"> <TitleTextStyle Font-Bold="True" Font-Size="0.9em"/> <InstructionTextStyle Font-Italic="True" ForeColor="Black" /> <TextBoxStyle Font-Size="0.8em" /> <LoginButtonStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" /> <LayoutTemplate> <table border="0" cellpadding="4" cellspacing="0" style="border-collapse: collapse; height: 159px;"> <tr> <td style="height: 176px; width: 135px;"> <table border="0" cellpadding="0" style="width: 219px; height: 1px" id="TABLE1"> <tr> <td align="center" style="font-weight: bold; font-size: 0.9em; color: white; height: 18px; background-color: #990000; text-align: center" colspan="2"> Log In</td> </tr> <tr> <td style="width: 94px; height: 10px;"> </td> <td style="height: 10px; width: 78px;"> </td> </tr> <tr> <td style="width: 94px; height: 20px; text-align: right"> <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label> &nbsp; </td> <td style="height: 20px; text-align: left; width: 78px;"> <asp:TextBox ID="UserName" runat="server" Font-Size="0.9em" EnableViewState="False" Width="100px" MaxLength="20"></asp:TextBox><asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl01$Login1">*</asp:RequiredFieldValidator></td> </tr> <tr> <td style="width: 94px; text-align: right"> <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label> &nbsp; </td> <td style="text-align: left; width: 78px;"> <asp:TextBox ID="Password" runat="server" Font-Size="0.9em" TextMode="Password" Width="100px"></asp:TextBox><asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl01$Login1">*</asp:RequiredFieldValidator></td> </tr> <tr> <td style="height: 20px; width: 94px;"> &nbsp;</td> <td style="height: 20px; text-align: left; width: 78px;"> <asp:CheckBox ID="chkRememberMe" runat="server" Text="Remember Me" Width="104px" /></td> </tr> <tr> <td align="center" style="color: red; width: 94px; height: 20px;"> </td> <td align="center" style="color: red; text-align: left; width: 78px; height: 20px;"> <asp:Button ID="LoginButton" runat="server" BorderStyle="Solid" BorderWidth="1px" CommandName="Login" Font-Names="Verdana" Font-Size="1.0 em" Text="Log In" ValidationGroup="ctl01$Login1" Width="59px" BackColor="Gray" BorderColor="Black" Height="20px" /></td> </tr> <tr> <td align="center" style="width: 250px; color: red; height: 35px; text-align: center;" colspan="2"> <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal></td> </tr> <tr> <td style="height: 26px; width: 94px;"> <asp:HyperLink ID="CreateUserLink" runat="server" NavigateUrl="http://www.tiltonindustries.com/Tilton/Login/CreateAccount.aspx">Sign Up Now!</asp:HyperLink>&nbsp; </td> <td style="width: 78px; height: 26px"> <asp:HyperLink ID="PasswordRecoveryLink" runat="server" NavigateUrl="http://www.tiltonindustries.com/Tilton/Login/ForgotPassword.aspx">Forgot your password?</asp:HyperLink></td> </tr> </table> </td> </tr> </table> </LayoutTemplate> </asp:Login> </AnonymousTemplate> </asp:LoginView> <!-- End Login Form --> <!-- Quick Links --> <br /> <br /> <p style="font-size: 14px; font-weight: bold; color: White"> Quick Links:<br /> </p> <br /> <p id="quicklinks"> <a href="default.aspx">Home</a><br /> <a href="services.aspx">Services</a><br /> <a href="matching.aspx">Color Matching</a><br /> <a href="packaging.aspx">Custom Packaging</a><br /> <a href="decorals.aspx">Decorals</a><br /> <a href="delivery.aspx">Delivery</a><br /> <a href="items.aspx">Items</a><br /> <a href="msds.aspx">MSDS</a><br /> <a href="plant.aspx">Plant Capabilities</a><br /> <a href="standard.aspx">Standard Colors</a><br /> <a href="special.aspx">Special Effects</a><br /> <a href="coatings.aspx">Spray Coatings</a><br /> <a href="warranty.aspx">Warranty</a><br /> <a href="http://www.tiltonindustries.com/Tilton/Login/Login.aspx">My Account</a><br /> <a href="gallery.aspx">Gallery</a><br /> <a href="about.aspx">About</a><br /> <a href="faq.aspx">F.A.Q</a><br /> <a href="links.aspx">Links</a><br /> <a href="careers.aspx">Careers</a><br /> <a href="contact.aspx">Contact</a><br /> <br /> </p> </td> </tr> </table> </td> <!-- End Sidebar -->

    Read the article

  • Excel Automation - creating a new worksheet

    - by Andrew Shepherd
    I am attempting what seems like a simple task: using C# to create a new Excel document containing new worksheets. For some reason, I am getting a strange COM error (0x800A03EC) Has anyone managed to get this to work? Does anyone have suggestions as to how to troubleshoot this? I've isolated this into the minimum amount of code: using Microsoft.Office.Interop.Excel; using System.Diagnostics; namespace ExcelAutomation { public static class ExcelTests { public static void CreateWorksheet() { try { var app = new Microsoft.Office.Interop.Excel.Application(); app.Visible = true; var workBooks = app.Workbooks; var newWorkbook = app.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); Worksheet existingWorksheet = (Worksheet)newWorkbook.Sheets[1]; Worksheet workSheet = (Worksheet)newWorkbook.Sheets.Add ( null, // before existingWorksheet, null, // 1, null //XlSheetType.xlWorksheet ); } catch (System.Runtime.InteropServices.COMException ex) { Trace.WriteLine(string.Format("Caught COMException. Message: \"{0}\"", ex.Message)); } } } } The output window now says: Caught COMException. Message: "Exception from HRESULT: 0x800A03EC"

    Read the article

  • How should I avoid memoization causing bugs in Ruby?

    - by Andrew Grimm
    Is there a consensus on how to avoid memoization causing bugs due to mutable state? In this example, a cached result had its state mutated, and therefore gave the wrong result the second time it was called. class Greeter def initialize @greeting_cache = {} end def expensive_greeting_calculation(formality) case formality when :casual then "Hi" when :formal then "Hello" end end def greeting(formality) unless @greeting_cache.has_key?(formality) @greeting_cache[formality] = expensive_greeting_calculation(formality) end @greeting_cache[formality] end end def memoization_mutator greeter = Greeter.new first_person = "Bob" # Mildly contrived in this case, # but you could encounter this in more complex scenarios puts(greeter.greeting(:casual) << " " << first_person) # => Hi Bob second_person = "Sue" puts(greeter.greeting(:casual) << " " << second_person) # => Hi Bob Sue end memoization_mutator Approaches I can see to avoid this are: greeting could return a dup or clone of @greeting_cache[formality] greeting could freeze the result of @greeting_cache[formality]. That'd cause an exception to be raised when memoization_mutator appends strings to it. Check all code that uses the result of greeting to ensure none of it does any mutating of the string. Is there a consensus on the best approach? Is the only disadvantage of doing (1) or (2) decreased performance? (I also suspect freezing an object may not work fully if it has references to other objects) Side note: this problem doesn't affect the main application of memoization: as Fixnums are immutable, calculating Fibonacci sequences doesn't have problems with mutable state. :)

    Read the article

  • How should I measure Concurrent Licence Usage

    - by Andrew Wood
    Hi I have detailed stats on user access to my system detailing login and logout times as well as machine used, network username etc. I am in need of measuring what I would term a concurrent user licences level based on this information. Now I could take the maximum logged in for any 1 day in a 3 month period say 170 or I could take the average say 133. Does anyone have or know of a formula for working this out or is it as simple as the high water mark which is 170 in my example. A client has recently gone from an unlimited licence to a concurrent licence so I am faced with the task of setting the initial licence level. There is potential for more licence sales in the future so I don't want it set to high and I do want it based on historical data that the system collects rather than guess work.

    Read the article

  • Debug Deserialization on Silverlight Client

    - by Andrew Garrison
    I'm working on a Silverlight client that interacts with a WCF web service. The Silverlight client and the WCF web service are using the same class library for their data entities that they are passing back and forth over the wire. I just added a new entity, and it's not being correctly deserialized on the Silverlight client. My question is, how can I debug the System.ServiceModel.ClientBase as it is deserializing an entity that it received from a WCF web service?

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >