Search Results

Search found 3380 results on 136 pages for 'tim b james'.

Page 63/136 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • request for member view in something not a structure or union

    - by james
    Hi I have this error when i build my application iphone: request for member view in something not a structure or union on [CommuneSlider.view removeFromSuperview]; the code: - (void) CommuneSelected { CommuneDetailsViewController *com = [[CommuneDetailsViewController alloc] initWithNibName:@"CommuneDetailsViewController" bundle:nil]; UINavigationController *navig = [[UINavigationController alloc] initWithRootViewController:com]; [self setCommuneDetails:(CommuneDetailsViewController *) navig]; [navig setNavigationBarHidden:YES]; [com release]; [navig release]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.8]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES]; [CommuneSlider.view removeFromSuperview]; [self.window addSubview:[CommuneDetails view]]; [UIView commitAnimations]; } need HELP

    Read the article

  • Android ViewFlipper + homescreen animation

    - by Tim
    I am trying to use a ViewFlipper and make it act like the home screen(The layout will move with your finger). Check out this for an example. I want to do this with a ViewFlipper that only contains two children so the opposite view should be shown on either side of the current view depending on which way the user moves their finger. This code works but only for 1 direction at a time. This is in onTouchEvent. case MotionEvent.ACTION_MOVE: leftView.setVisibility(View.VISIBLE); rightView.setVisibility(View.VISIBLE); // move the current view to the left or right. currentView.layout((int) (touchEvent.getX() - oldTouchValue), currentView.getTop(), (int) (touchEvent.getX() - oldTouchValue) + 320, currentView.getBottom()); // place this view just left of the currentView leftView.layout(currentView.getLeft() - 320, leftView.getTop(), currentView.getLeft(), leftView.getBottom()); // place this view just right of the currentView rightView.layout(currentView.getRight(), rightView.getTop(), currentView.getRight() + 320, rightView.getBottom()); Which ever of the bottom two lines I put last that direction will work correctly but the other will not. Here is how I set the leftView and rightView: final View currentView = myFlipper.getCurrentView(); final View leftView, rightView; if (currentView == meView) { Log.d("current layout: ", "me"); leftView = youView; rightView = youView; } else if (currentView == youView) { Log.d("current layout: ", "you"); leftView = meView; rightView = meView; }else { leftView = null; rightView = null; } Is it going to be possible to set it up so that the same view is shown on both sides of the current view?

    Read the article

  • Delphi 2010 - Decode Base64 encoded image from XML doc

    - by James
    I am trying to decode a base64 encoded EMF image from an XML document in my application and render it on screen, however, it never seems to appear. If I copy/paste the data from the XML document into Notepad++ and use the Base64 Decode option and save the file as a .emf it opens fine in mspaint. So I think the issue is how I am decoding it. I have tried the following decode methods described in these articles: How to encode / decode Base 64 string http://www.swissdelphicenter.ch/torry/showcode.php?id=1223 I have also tried the TIdDecoderMIME class to no avail. Does anyone know the most reliable way of decoding a base64 encoded string from XML?

    Read the article

  • When using WebBrowser control how do you have the text appear without margins?

    - by Tim Murphy
    I'm using a System.Windows.Forms.WebBrowser control next to textboxes with the left margins of each control aligned on the same X axis. The appearance however is "ugly" because the WebBrowser control inserts a margin/padding around the content of the control. Therefore the text in the WebBrowser control is several pixels to the right of the text in each of the surrounding textboxes. How do you fix this? The Margin setting does not appear to work.

    Read the article

  • Telerik RadEditor for MOSS - How do I suppress min-width inline CSS?

    - by James
    I'm having an issue with the RadEditor for MOSS, I'm really baffled as to the source of this issue. I tried using Firebug to find where any min-* CSS settings are happening and search came up empty, but I know it's happening because the downloaded page markup does not have that inline CSS. I believe that one of the Telerik control emitted Javascripts is what is adding inline CSS style to the top level div of the editor, namely min-height, min-width. This is causing layout issues on my page. My question is why is it doing this, and more importantly how do I prevent this from happening? <div style="height: 300px; width: 100%; min-height: 300px; min-width: 1133px;" class="RadEditor Default reWrapper ms-input"> Related thread

    Read the article

  • LIST<> AddRange throwing ArgumentException

    - by Tim
    Hi all, I have a particular method that is occasionally crashing with an ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.: at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex) at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection) The code that is causing this crash looks something like this: List<MyType> objects = new List<MyType>(100); objects = FindObjects(someParam); objects.AddRange(FindObjects(someOtherParam); According to MSDN, List<.AddRange() should automatically resize itself as needed: If the new Count (the current Count plus the size of the collection) will be greater than Capacity, the capacity of the List<(Of <(T)) is increased by automatically reallocating the internal array to accommodate the new elements, and the existing elements are copied to the new array before the new elements are added. Can someone think of a circumstance in which AddRange could throw this type of exception?

    Read the article

  • Merge FDF data into a PDF file using PHP

    - by James
    Is it possible to merge FDF data with a PDF file using PHP alone? Or is there no option but to use a 3rd party command line tool to achieve this? If that is the case can someone point me in the direction of one? I am currently outputting the FDF file to the browser in the hope that it will redirect the user to the filled in PDF but for some people that is not the case. The FDF contents is being output to the screen, even though I am using header('Content-type: application/vnd.fdf');

    Read the article

  • Why does Silverlight 4 ClientHttp WebRequest prompt the user for a login and password?

    - by James Cadd
    One of the new features of the client http stack in Silverlight 4 is the ability to supply network credentials. When I use this feature Windows shows a "Windows Security" message box that prompts the user for a login and password (text in the box is "The server xx at xx requires a username and password. Warning: This server is requesting that your username and password be sent in an insecure manner (basic authentication without a secure connection)."). I'm setting the login and password as shown below so I'm not sure why this is displayed. My code is: var request = WebRequestCreator.ClientHttp.Create(new Uri("http://myserver:8080/gui/?list=1")); request.Credentials = new NetworkCredential("login", "password"); request.BeginGetResponse(new AsyncCallback(OnRequestComplete), request); If I enter the username and password into the messagebox the request completes successfully. For a number of reasons I'd rather prompt the user for the login and password so I'd like to avoid the messagebox if possible. My setup is Silverlight 4 final, VS 2010 final, Windows 7 x86. The application is out of browser with elevated permissions.

    Read the article

  • Can I encrypt web.config with a custom protection provider who's assembly is not in the GAC?

    - by James
    I have written a custom protected configuration provider for my web.config. When I try to encrypt my web.config with it I get the following error from aspnet_iisreg aspnet_regiis.exe -pef appSettings . -prov CustomProvider (This is running in my MSBuild) Could not load file or assembly 'MyCustomProviderNamespace' or one of its dependencies. The system cannot find the file specified. After checking with the Fusion log, I confirm it is checking both the GAC, and 'C:/WINNT/Microsoft.NET/Framework/v2.0.50727/' (the location of aspnet_iisreg). But it cannot find the provider. I do not want to move my component into the GAC, I want to leave the custom assembly in my ApplicationBase to copy around to various servers without having to pull/push from the GAC. Here is my provider configuration in the web.config. <configProtectedData> <providers> <add name="CustomProvider" type="MyCustomProviderNamespace.MyCustomProviderClass, MyCustomProviderNamespace" /> </providers> </configProtectedData> I want aspnet_iisreg to check my ApplicationBase Bin folder for this assembly. Has anyone got any ideas?

    Read the article

  • JQuery ajax call to httpget webmethod (c#) not working

    - by Tim Jarvis
    I am trying to get an ajax get to a webmethod in code behind. The problem is I keep getting the error "parserror" from the JQuery onfail method. If I change the GET to a POST everything works fine. Please see my code below. Ajax Call <script type="text/javascript"> var id = "li1234"; function AjaxGet() { $.ajax({ type: "GET", url: "webmethods.aspx/AjaxGet", data: "{ 'id' : '" + id + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { alert("success"); }, error: function(msg, text) { alert(text); } }); } </script> Code Behind [System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod(UseHttpGet = true, ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)] public static string AjaxGet(string id) { return id; } Web.config <webServices> <protocols> <add name="HttpGet"/> </protocols> </webServices> The URL being used ......../webmethods.aspx/AjaxGet?{%20%27id%27%20:%20%27li1234%27} As part of the response it is returning the html for the page webmethods. Any help will be greatly appreciated.

    Read the article

  • Complex reporting on subversion (possibly Export Subversion log into database for reporting)

    - by James A. N. Stauffer
    What is the best way to do complex reporting on subversion logs like the following for each file? file, directory, last revision date, previous revision date(where revision date is at least 30 older than last), days diff(between revision dates) Since Subversion allows on revision to change multiple files I assume svn log needs to be run against each file individually. Ideas (that don't seem very good): Shell scripting to produce a csv file to be imported to a DB. The following is a start but doesn't show the filename: find . -name "." -print | xargs -l svn log -l 2 Shell scripting to produce XML and then use XSLT to create CSV to import to a DB. It might use a similar command to above but would still have some of the same limitation. Write a program to just parse the log on the whole directory tree, make one insert to DB per revision/file combination, and then query the DB.

    Read the article

  • pattern matching in Bash

    - by Tim
    Hi, Here is an example to get different parts of a filename bash-3.2$ pathandfile=/tmp/ff.txt bash-3.2$ filename=$(basename $pathandfile) bash-3.2$ echo $filename ff.txt bash-3.2$ echo ${filename##*.} txt bash-3.2$ echo ${filename%.*} ff I was wondering what does ## and % mean in the patterns. How is the patten matching working? Thanks and regards!

    Read the article

  • DockPanel ActivateMDIChild in C#

    - by James
    Hi I have used WeifenLuo.WinFormsUI.Docking Dockpanel in my project. I have three Document Style DockContent (i.e. A, B, C)in my application which has been arranged in tabbed style. On Focus() method of any of this dockContent (i.e. A, B, C) its getting activated and getting focus well. As per requirement i need to hide all three dockcontent(i.e. A, B, C) n need to show other two (i.e. D,E). And then once particular process get over, i close D,E and show A, B, C. Then after On Focus() of C, its focus is not getting set. May i know what could be the reason for the same. Please guide me for the same. Thanks.

    Read the article

  • Silverlight WCF access returning an IList of LLBLGen entities?

    - by Tim
    Hi I'm having a problem passing an entity collection back from LLBLGen to silverlight. My contract looks like this. I don't even know if this is possible. My web service code looks like this: public IEnumerable GetCustomer(long custId, string acctKey) { var toReturn = new WaterWorksCustomersEntity(custId, acctKey); using (var adapter = new DataAccessAdapter()) { adapter.ConnectionString = "data source=CWCPROD.cwc.local;user.."; adapter.FetchEntity(toReturn); } IList customers = new List(); customers.Add(toReturn); return customers; } On the silverlight client I'm doing ... var client = new Service1Client(); client.GetCustomerCompleted +=new EventHandler(client_GetCustomerCompleted); client.GetCustomerAsync(2,"110865"); The compilation is failing with this error: Error 1 The type or namespace name 'ArrayOfXElement' does not exist in the namespace 'AppointmentClientSL.ServiceReference1' (are you missing an assembly reference?) c:\work\Appointment\Appointment\AppointmentClientSL\Service References\ServiceReference1\Reference.cs 63 54 AppointmentClientSL It looks like SL is not able to deal with the data the web service is returning. Can anyone help???

    Read the article

  • Java RMI method synchronization

    - by James Moore
    Hello, I have a class that is stored on the 'server' and multiple clients can call this method. This method returns a class. Now when clients call accessor methods within this class for example a set accessor method. I want the object on the server to be updated and synchronized across all the other clients. How do I use: public synchronized setStatus(String s) { this.status = s; } within java to achieve this. Thanks

    Read the article

  • How should I Test a Genetic Algorithm

    - by James Brooks
    I have made a quite few genetic algorithms; they work (they find a reasonable solution quickly). But I have now discovered TDD. Is there a way to write a genetic algorithm (which relies heavily on random numbers) in a TDD way? To pose the question more generally, How do you test a non-deterministic method/function. Here is what I have thought of: Use a specific seed. Which wont help if I make a mistake in the code in the first place but will help finding bugs when refactoring. Use a known list of numbers. Similar to the above but I could follow the code through by hand (which would be very tedious). Use a constant number. At least I know what to expect. It would be good to ensure that a dice always reads 6 when RandomFloat(0,1) always returns 1. Try to move as much of the non-deterministic code out of the GA as possible. which seems silly as that is the core of it's purpose. Links to very good books on testing would be appreciated too.

    Read the article

  • WatiN File Upload

    - by James Jeffery
    I've hit a snag. I am trying to use WatiN to upload a file. I can load the upload box, but it quickly disappears. The last line of my code at the moment is: ie.FileUpload(Find.ById("profile_file")).Click(); It loads the dialog to select a picture but disappears. Is it possible to set the path of the box automatically example, load "C:/Desktop/image.jpg"? Also, is it possible to wait for the upload to complete before continuing? Help is much appreciated. Thanks.

    Read the article

  • What is the Relative Performance of Pseudo-Class and Custom Selectors?

    - by James Wiseman
    It's my understanding that, in terms of selector speed, that #ID selectors are fastest, followed by element selectors, and then .class selectors. I have always assumed that pseudo-class selectors and custom selectors (those in the form ':selector') are similar to .class selectors, but I realised that I'm just not sure. I realise that this does depend on the complexity of the code within the pseudo-class/custom selector, so I guess I'd like to know the answer with this excluded as factor. Any help would be appreciated. Thanks.

    Read the article

  • iPad Safari's mapping of mouse events to touch events in image-maps

    - by Tim
    My website makes extensive use of image-maps. The images are of pages from a medieval manuscript. The mouseOver event of the AREA tags has a tooltip attached to it, which displays a modern typographic transcription of the ancient script for the line the mouse is hovering over. I just checked my website out on the iPad at the Apple store. The iPad is many respects a joy to use, however, I am wondering about Apple's mapping of the mouseEvents to the finger-touch events. Apple probably had a good reason for doing things as they did, but their choices seem counterintuitive an overly complicated to me. Specifically, the iPad Safari browser clearly was responding to both fingerDown and fingerTap, and in different ways. When I tapped an area of the image-map, the tooltip wired to the mouse-over event pf the AREA tag was displayed, and remained visible until I tapped somewhere else. When I held my finger down on an area of the image-map, the area changed color. So if iPad Safari detects a mouseOver eventhandler, it executes the mouseOver code and apparently prevents the "click" event from propagating, so that if you also have something wired to the click event, it doesn't work? Is that right? But more importantly, why isn't fingerDown the iPad-Safari counterpart for mouseOver? FingerDown seems a more likely candidate than Tap when mapping the mousePOver event. I would have expected things to be mapped in this way: MouseClick : FingerTap (i.e. finger down and then immediately up) MouseOver : FingerDown (finger down and stays on the spot) If Apple had treated fingerDown as the counterpart to mouseOver, then the tooltip could be displayed upon FingerDown and made invisible again on fingerUp, which would be the counterpart to mouseOut. Perhaps someone could enlighten me about the thinking process that led Apple to these particular mouse-to-touch event-mappings? Thanks

    Read the article

  • Entity Framework won't SaveChanges on new entity with two-level relationship

    - by Tim Rourke
    I'm building an ASP.NET MVC site using the ADO.NET Entity Framework. I have an entity model that includes these entities, associated by foreign keys: Report(ID, Date, Heading, Report_Type_ID, etc.) SubReport(ID, ReportText, etc.) - one-to-one relationship with Report. ReportSource(ID, Name, Description) - one-to-many relationship with Sub_Report. ReportSourceType(ID, Name, Description) - one-to-many relationship with ReportSource. Contact (ID, Name, Address, etc.) - one-to-one relationship with Report_Source. There is a Create.aspx page for each type of SubReport. The post event method returns a new Sub_Report entity. Before, in my post method, I followed this process: Set the properties for a new Report entity from the page's fields. Set the SubReport entity's specific properties from the page's fields. Set the SubReport entity's Report to the new Report entity created in 1. Given an ID provided by the page, look up the ReportSource and set the Sub_Report entity's ReportSource to the found entity. SaveChanges. This workflow succeeded just fine for a couple of weeks. Then last week something changed and it doesn't work any more. Now instead of the save operation, I get this Exception: UpdateException: "Entities in 'DIR2_5Entities.ReportSourceSet' participate in the 'FK_ReportSources_ReportSourceTypes' relationship. 0 related 'ReportSourceTypes' were found. 1 'Report_Source_Types' is expected." The debug visualizer shows the following: The SubReport's ReportSource is set and loaded, and all of its properties are correct. The Report_Source has a valid ReportSourceType entity attached. In SQL Profiler the prepared SQL statement looks OK. Can anybody point me to what obvious thing I'm missing? TIA Notes: The Report and SubReport are always new entities in this case. The Report entity contains properties common to many types of reports and is used for generic queries. SubReports are specific reports with extra parameters varying by type. There is actually a different entity set for each type of SubReport, but this question applies to all of them, so I use SubReport as a simplified example.

    Read the article

  • MIPS (or SPIM): Loading floating point numbers...

    - by James
    Hey hey, I am working on a little mini compiler while trying to learn some MIPS here. Here's my issue: MIPS has an instruction li (load immediate) which would work like this li $5,100 which would load 100 into register 5. However, I need to load floats into registers right now and am struggling with figuring out a way to do it...since li $5,2.5 does not work. Anyone have any advice? I am working in C, I was thinking I could somehow get the integer representation of the float I am working with (i.e. so the floats binary representation == the ints binary representation) then load the "integer" into the register and treat it like a float from then on. Maybe its too late but Im stuck right now.

    Read the article

  • WPF - Translate a point relative to MainWindow to it's coordinates relative to a child control

    - by James Cadd
    Is it possible to translate a point relative to MainWindow to be relative to one of its child controls? For example, say a control's upper left corner was located at 500, 500 relative to MainWindow what code would convert that number to (0, 0)? I'd like the solution to be agnostic of the layout mechanism (i.e. not require me to parent the control in a Canvas and use the Top and Bottom methods).

    Read the article

  • iteration in latex

    - by Tim
    Hi, I would like to use some iteration control flow to simplify the following latex code \begin{sidewaystable} \caption{A glance of images} \centering \begin{tabular}{| c ||c| c| c |c| c|| c |c| c|c|c| } \hline \backslashbox{Theme}{Class} &\multicolumn{5}{|c|}{Class 0} & \multicolumn{5}{|c|}{Class 1} \\ \hline \hline 1 & \includegraphics[scale=2]{../../results/1/0_1.eps} &\includegraphics[scale=2]{../../results/1/0_2.eps} &\includegraphics[scale=2]{../../results/1/0_3.eps} &\includegraphics[scale=2]{../../results/1/0_4.eps} &\includegraphics[scale=2]{../../results/1/0_5.eps} &\includegraphics[scale=2]{../../results/1/1_1.eps} &\includegraphics[scale=2]{../../results/1/1_2.eps} &\includegraphics[scale=2]{../../results/1/1_3.eps} &\includegraphics[scale=2]{../../results/1/1_4.eps} &\includegraphics[scale=2]{../../results/1/1_5.eps} \\ \hline \hline 2 & \includegraphics[scale=2]{../../results/2/0_1.eps} &\includegraphics[scale=2]{../../results/2/0_2.eps} &\includegraphics[scale=2]{../../results/2/0_3.eps} &\includegraphics[scale=2]{../../results/2/0_4.eps} &\includegraphics[scale=2]{../../results/2/0_5.eps} &\includegraphics[scale=2]{../../results/2/1_1.eps} &\includegraphics[scale=2]{../../results/2/1_2.eps} &\includegraphics[scale=2]{../../results/2/1_3.eps} &\includegraphics[scale=2]{../../results/2/1_4.eps} &\includegraphics[scale=2]{../../results/2/1_5.eps} \\ \hline ... % similarly for 3, 4, ..., 22 \hline 23 & \includegraphics[scale=2]{../../results/23/0_1.eps} &\includegraphics[scale=2]{../../results/23/0_2.eps} &\includegraphics[scale=2]{../../results/23/0_3.eps} &\includegraphics[scale=2]{../../results/23/0_4.eps} &\includegraphics[scale=2]{../../results/23/0_5.eps} &\includegraphics[scale=2]{../../results/23/1_1.eps} &\includegraphics[scale=2]{../../results/23/1_2.eps} &\includegraphics[scale=2]{../../results/23/1_3.eps} &\includegraphics[scale=2]{../../results/23/1_4.eps} &\includegraphics[scale=2]{../../results/23/1_5.eps} \\ \hline \end{tabular} \end{sidewaystable} I learn that the forloop package provides the for loop. But I am not sure how to apply it to my case? Or other methods not by forloop? Thanks and regards! Update: If I also want to simply another similar case, where the only difference is that the directory does not run from 1, 2, to 23, but in some arbitrary order such as 3, 2, 6, 9,..., or even a list of strings such as dira, dirc, dird, dirb,.... How to make the latex code into loops then? Thanks!

    Read the article

  • Why does async BeginReceiveFrom never time out on a raw socket?

    - by James Hugard
    Writing an asynchronous Ping using Raw Sockets in F#, to enable parallel requests using as few threads as possible. Not using "System.Net.NetworkInformation.Ping", because it appears to allocate one thread per request. Am also interested in using F# async workflows. The synchronous version below correctly times out when the target host does not exist/respond, but the asynchronous version hangs. Both work when the host does respond. Not sure if this is a .NET issue, or an F# one... Any ideas? (note: the process must run as Admin to allow Raw Socket access) This throws a timeout: let result = Ping.Ping ( IPAddress.Parse( "192.168.33.22" ), 1000 ) However, this hangs: let result = Ping.AsyncPing ( IPAddress.Parse( "192.168.33.22" ), 1000 ) |> Async.RunSynchronously Here's the code... module Ping open System open System.Net open System.Net.Sockets open System.Threading //---- ICMP Packet Classes type IcmpMessage (t : byte) = let mutable m_type = t let mutable m_code = 0uy let mutable m_checksum = 0us member this.Type with get() = m_type member this.Code with get() = m_code member this.Checksum = m_checksum abstract Bytes : byte array default this.Bytes with get() = [| m_type m_code byte(m_checksum) byte(m_checksum >>> 8) |] member this.GetChecksum() = let mutable sum = 0ul let bytes = this.Bytes let mutable i = 0 // Sum up uint16s while i < bytes.Length - 1 do sum <- sum + uint32(BitConverter.ToUInt16( bytes, i )) i <- i + 2 // Add in last byte, if an odd size buffer if i <> bytes.Length then sum <- sum + uint32(bytes.[i]) // Shuffle the bits sum <- (sum >>> 16) + (sum &&& 0xFFFFul) sum <- sum + (sum >>> 16) sum <- ~~~sum uint16(sum) member this.UpdateChecksum() = m_checksum <- this.GetChecksum() type InformationMessage (t : byte) = inherit IcmpMessage(t) let mutable m_identifier = 0us let mutable m_sequenceNumber = 0us member this.Identifier = m_identifier member this.SequenceNumber = m_sequenceNumber override this.Bytes with get() = Array.append (base.Bytes) [| byte(m_identifier) byte(m_identifier >>> 8) byte(m_sequenceNumber) byte(m_sequenceNumber >>> 8) |] type EchoMessage() = inherit InformationMessage( 8uy ) let mutable m_data = Array.create 32 32uy do base.UpdateChecksum() member this.Data with get() = m_data and set(d) = m_data <- d this.UpdateChecksum() override this.Bytes with get() = Array.append (base.Bytes) (this.Data) //---- Synchronous Ping let Ping (host : IPAddress, timeout : int ) = let mutable ep = new IPEndPoint( host, 0 ) let socket = new Socket( AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout ) let packet = EchoMessage() let mutable buffer = packet.Bytes try if socket.SendTo( buffer, ep ) <= 0 then raise (SocketException()) buffer <- Array.create (buffer.Length + 20) 0uy let mutable epr = ep :> EndPoint if socket.ReceiveFrom( buffer, &epr ) <= 0 then raise (SocketException()) finally socket.Close() buffer //---- Entensions to the F# Async class to allow up to 5 paramters (not just 3) type Async with static member FromBeginEnd(arg1,arg2,arg3,arg4,beginAction,endAction,?cancelAction): Async<'T> = Async.FromBeginEnd((fun (iar,state) -> beginAction(arg1,arg2,arg3,arg4,iar,state)), endAction, ?cancelAction=cancelAction) static member FromBeginEnd(arg1,arg2,arg3,arg4,arg5,beginAction,endAction,?cancelAction): Async<'T> = Async.FromBeginEnd((fun (iar,state) -> beginAction(arg1,arg2,arg3,arg4,arg5,iar,state)), endAction, ?cancelAction=cancelAction) //---- Extensions to the Socket class to provide async SendTo and ReceiveFrom type System.Net.Sockets.Socket with member this.AsyncSendTo( buffer, offset, size, socketFlags, remoteEP ) = Async.FromBeginEnd( buffer, offset, size, socketFlags, remoteEP, this.BeginSendTo, this.EndSendTo ) member this.AsyncReceiveFrom( buffer, offset, size, socketFlags, remoteEP ) = Async.FromBeginEnd( buffer, offset, size, socketFlags, remoteEP, this.BeginReceiveFrom, (fun asyncResult -> this.EndReceiveFrom(asyncResult, remoteEP) ) ) //---- Asynchronous Ping let AsyncPing (host : IPAddress, timeout : int ) = async { let ep = IPEndPoint( host, 0 ) use socket = new Socket( AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout ) let packet = EchoMessage() let outbuffer = packet.Bytes try let! result = socket.AsyncSendTo( outbuffer, 0, outbuffer.Length, SocketFlags.None, ep ) if result <= 0 then raise (SocketException()) let epr = ref (ep :> EndPoint) let inbuffer = Array.create (outbuffer.Length + 256) 0uy let! result = socket.AsyncReceiveFrom( inbuffer, 0, inbuffer.Length, SocketFlags.None, epr ) if result <= 0 then raise (SocketException()) return inbuffer finally socket.Close() }

    Read the article

  • Quantis Quantum Random Number Generator (QRNG) - any reviews?

    - by Tim Post
    I am thinking about getting one of these (PCI) to set up an internal entropy pool similar to this service who incidentally brought us fun captcha challenges. Prior to lightening my wallet, I'm hoping to gather feedback from people who may be using this device. As there is no possible 'correct' answer, I am making this CW and tagging it as subjective. I'm undertaking a project to help write Monte Carlo simulations for a non profit that distributes mosquito nets in Malaria stricken areas. The idea is to model areas to determine the best place to distribute mosquito nets. During development, I expect to consume gigs if not more of the RNG output. We really need our own source. Is this device reliable? Does it have to be re-started often? Is its bandwidth really as advertised? It passes all tests, as far as randomness goes (i.e. NIST/DIEHARD). What I don't want is something in deadlock due to some ioctl in disk sleep that does nothing but radiate heat. This is not a spamvertisement, I'm helping out of pocket and I really, really want to know if such a large purchase will bear fruit. I can't afford to build a HRNG based on radioactive decay, this looks like the next best thing. Any comments are appreciated. I will earn zero rep for this, please do not vote to close. This is no different than questions regarding the utilization of some branded GPU for some odd purpose. Answers pointing to other solutions will be gladly accepted, I'm not married to this idea.

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >