Search Results

Search found 613 results on 25 pages for 'ray wenderlich'.

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

  • Synchronous HTTP Client with .NET sockets

    - by Ray Wits
    Does anyone know of any open source C# projects or some sample code that implement a synchronous HTTP client using sockets? I'm working on a project where I need a HTTP client using sockets. It can't use WebRequest or WebClient, nor can it use Asynchronous sockets. Don't ask. Also it would ideally be on .NET 2.0, yeah very cutting edge here. I figured the web would have tons of samples for this but suprisingly I couldn't find any. Probably because everyone is fortunate enough to use the built in APIs. If I don't find something I'll have to write it myself, which I don't really want to have to reinvent that wheel.

    Read the article

  • Is private method in spring service implement class thread safe

    - by Roger Ray
    I got a service in an project using Spring framework. public class MyServiceImpl implements IMyService { public MyObject foo(SomeObject obj) { MyObject myobj = this.mapToMyObject(obj); myobj.setLastUpdatedDate(new Date()); return myobj; } private MyObject mapToMyObject(SomeObject obj){ MyObject myojb = new MyObject(); ConvertUtils.register(new MyNullConvertor(), String.class); ConvertUtils.register(new StringConvertorForDateType(), Date.class); BeanUtils.copyProperties(myojb , obj); ConvertUtils.deregister(Date.class); return myojb; } } Then I got a class to call foo() in multi-thread; There goes the problem. In some of the threads, I got error when calling BeanUtils.copyProperties(myojb , obj); saying Cannot invoke com.my.MyObject.setStartDate - java.lang.ClassCastException@2da93171 obviously, this is caused by ConvertUtils.deregister(Date.class) which is supposed to be called after BeanUtils.copyProperties(myojb , obj);. It looks like one of the threads deregistered the Date class out while another thread was just about to call BeanUtils.copyProperties(myojb , obj);. So My question is how do I make the private method mapToMyObject() thread safe? Or simply make the BeanUtils thread safe when it's used in a private method. And will the problem still be there if I keep the code this way but instead I call this foo() method in sevlet? If many sevlets call at the same time, would this be a multi-thread case as well?

    Read the article

  • routing paramenter returns null when only supplying first paramenter in MVC

    - by Ray ForRespect
    My issue is that I customer Map Route in MVC which takes three parameters. When I supply all three or just two, the parameters are passed from the URL to my controller. However, when I only supply the first parameter, it is not passed and returns null. Not sure what causes this behavior. Route: routes.MapRoute( name: "Details", // Route name url: "{controller}/{action}/{param1}/{param2}/{param3}", // URL with parameters defaults: new { controller = "Details", action = "Index", param1 = UrlParameter.Optional, param2 = UrlParameter.Optional, param3 = UrlParameter.Optional } // Parameter defaults ); Controller: public ActionResult Map(string param1, string param2, string param3) { StoreMap makeMap = new StoreMap(); var storemap = makeMap.makeStoreMap(param1, param2, param3); var model = storemap; return View(model); } string param1 returns null when I navigate to: /StoreMap/Map/PARAM1NAME but it doesn't return null when I navigate to: /StoreMap/Map/PARAM1NAME/PARAM2NAME

    Read the article

  • Problem running VBScript from my UIAccess VB app using MSScriptControl

    - by Ray
    I'm trying to run some VBSCRIPT from within my application. This works fine when I run my program from within VB. But once I add "UIAccess=true" to my manifest and digitally sign my exe with my certificate, I am unable to run the code any more. It gives errors when I try to interface with any program saying "429: ActiveX component can't create object: 'myApp.Application'". Anyone have any idea why it would run fine in the IDE but not with an application with uses UIAccess? Here is the code: Dim scriptRunner As New MSScriptControl.ScriptControlClass scriptRunner.Language = "VBScript" scriptRunner.AllowUI = True scriptRunner.Timeout = 3000 scriptRunner.AddCode(scriptStr) scriptRunner = Nothing

    Read the article

  • Is the "message" of an exception culturally independent?

    - by Ray Hayes
    In an application I'm developing, I have the need to handle a socket-timeout differently from a general socket exception. The problem is that many different issues result in a SocketException and I need to know what the cause was. There is no inner exception reported, so the only information I have to work with is the message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond" This question has a general and specific part: is it acceptable to write conditional logic based upon the textual representation of an exception? Is there a way to avoid needing exception handling? Example code below... try { IPEndPoint endPoint = null; client.Client.ReceiveTimeout = 1000; bytes = client.Receive(ref endPoint); } catch( SocketException se ) { if ( se.Message.Contains("did not properly respond after a period of time") ) { // Handle timeout differently.. } }

    Read the article

  • How to check the system is Windows 7 or Windows Server 2008 RC in Wix Installer?

    - by Ray
    Hi there, I am working on a windows installer project. And now I only want the software only can be installed on Windows 7 or Windows Server 2008 RC system, I tried to use this: <Condition Message='Windows Server 2008 R2 or Windows 7 is required'>(VersionNT = 600 AND ServicePackLevel = 1) OR VersionNT = 601 </Condition> but it can still be installed on Windows Vista. Please help! Thank you!

    Read the article

  • Using a Data Management Singleton

    - by Dan Ray
    Here's my singleton code (pretty much boilerplate): @interface DataManager : NSObject { NSMutableArray *eventList; } @property (nonatomic, retain) NSMutableArray *eventList; +(DataManager*)sharedDataManager; @end And then the .m: #import "DataManager.h" static DataManager *singletonDataManager = nil; @implementation DataManager @synthesize eventList; +(DataManager*)sharedDataManager { @synchronized(self) { if (!singletonDataManager) { singletonDataManager = [[DataManager alloc] init]; } } NSLog(@"Pulling a copy of shared manager."); return singletonDataManager; } So then in my AppDelegate, I load some stuff before launching my first view: NSMutableArray *eventList = [DataManager sharedDataManager].eventList; .... NSLog(@"Adding event %@ to eventList", event.title); [eventList addObject:event]; NSLog(@"eventList now has %d members", [eventList count]); [event release]; As you can see, I've peppered the code with NSLog love notes to myself. The output to the Log reads like: 2010-05-10 09:08:53.355 MyApp[2037:207] Adding event Woofstock Music Festival to eventList 2010-05-10 09:08:53.355 MyApp[2037:207] eventList now has 0 members 2010-05-10 09:08:53.411 MyApp[2037:207] Adding event Test Event for Staging to eventList 2010-05-10 09:08:53.411 MyApp[2037:207] eventList now has 0 members 2010-05-10 09:08:53.467 MyApp[2037:207] Adding event Montgomery Event to eventList 2010-05-10 09:08:53.467 MyApp[2037:207] eventList now has 0 members 2010-05-10 09:08:53.524 MyApp[2037:207] Adding event Alamance County Event For June to eventList 2010-05-10 09:08:53.524 MyApp[2037:207] eventList now has 0 members ... What gives? I have no errors getting to my eventList NSMutableArray. But I addObject: fails silently?

    Read the article

  • Can't add or remove object from NSMutableSet

    - by Dan Ray
    Check it: - (IBAction)toggleFavorite { DataManager *data = [DataManager sharedDataManager]; NSMutableSet *favorites = data.favorites; if (thisEvent.isFavorite == YES) { NSLog(@"Toggling off"); thisEvent.isFavorite = NO; [favorites removeObject:thisEvent.guid]; [favoriteIcon setImage:[UIImage imageNamed:@"notFavorite.png"] forState:UIControlStateNormal]; } else { NSLog(@"Toggling on, adding %@", thisEvent.guid); thisEvent.isFavorite = YES; [favorites addObject:thisEvent.guid]; [favoriteIcon setImage:[UIImage imageNamed:@"isFavorite.png"] forState:UIControlStateNormal]; } NSLog(@"favorites array now contains %d members", [favorites count]); } This is fired from a custom UIButton. The UI part works great--toggles the image used for the button, and I can see from other stuff that the thisEvent.isFavorite BOOL is toggling happily. I can also see in the debugger that I'm getting my DataManager singleton. But here's my NSLog: 2010-05-13 08:24:32.946 MyApp[924:207] Toggling on, adding 05db685f65e2 2010-05-13 08:24:32.947 MyApp[924:207] favorites array now contains 0 members 2010-05-13 08:24:33.666 MyApp[924:207] Toggling off 2010-05-13 08:24:33.666 MyApp[924:207] favorites array now contains 0 members 2010-05-13 08:24:34.060 MyApp[924:207] Toggling on, adding 05db685f65e2 2010-05-13 08:24:34.061 MyApp[924:207] favorites array now contains 0 members 2010-05-13 08:24:34.296 MyApp[924:207] Toggling off 2010-05-13 08:24:34.297 MyApp[924:207] favorites array now contains 0 members Worst part is, this USED to work, and I don't know what I did to break it.

    Read the article

  • Chaining Many-To-Many Dimensional Relationships in SSAS

    - by Ray Saltrelli
    I'm developing a cube in SSAS and attempting to model the following relationships: Many Facts to 1 Customer Many Customers to Many Sales Reps Many Sales Reps (Subordinates) to Sales Reps (Managers) Each M2M relationship is facilitated by a bridge table which also acts as a fact table in the cube I have most of this working. I can slice Facts by Customer and by Sales Rep (Subordinate), but when I add Sales Rep (Manager) to the query it appears to return every subordinate/manager combination regardless of whether or not that relationship exists in the bridge table. Any ideas as to what I might be doing wrong?

    Read the article

  • Highlighting a custom UIButton

    - by Dan Ray
    The app I'm building has LOTS of custom UIButtons laying over top of fairly precisely laid out images. Buttonish, controllish images and labels and what have you, but with a clear custom-style UIButton sitting over top of it to handle the tap. My client yesterday says, "I want that to highlight when you tap it". Never mind that it immediately pushes on a new uinavigationcontroller view... it didn't blink, and so he's confused. Oy. Here's what I've done to address it. I don't like it, but it's what I've done: I subclassed UIButton (naming it FlashingUIButton). For some reason I couldn't just configure it with a background image on control mode highlighted. It never seemed to hit the state "highlighted". Don't know why that is. So instead I wrote: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self setBackgroundImage:[UIImage imageNamed:@"grey_screen"] forState:UIControlStateNormal]; [self performSelector:@selector(resetImage) withObject:nil afterDelay:0.2]; [super touchesBegan:touches withEvent:event]; } -(void)resetImage { [self setBackgroundImage:nil forState:UIControlStateNormal]; } This happily lays my grey_screen.png (a 30% opaque black box) over the button when it's tapped and replaces it with happy emptyness .2 of a second later. This is fine, but it means I have to go through all my many nibs and change all my buttons from UIButtons to FlashingUIButtons. Which isn't the end of the world, but I'd really hoped to address this as a UIButton category, and hit all birds with one stone. Any suggestions for a better approach than this one?

    Read the article

  • How to check the system is Windows 7 or Windows Server 2008 R2 in Wix Installer?

    - by Ray
    Hi there, I am working on a windows installer project. And now I only want the software only can be installed on Windows 7 or Windows Server 2008 R2 system, I tried to use this: <Condition Message='Windows Server 2008 R2 or Windows 7 is required'>(VersionNT = 600 AND ServicePackLevel = 1) OR VersionNT = 601 </Condition> but it can still be installed on Windows Vista. Please help! Thank you!

    Read the article

  • Including a List<SpecificType> in a model, and how to populate it

    - by Ray Sülzer
    I currently have two Model classes: class Leaders: List<Leaders> { public string LeaderName { get; set; } public string PrecintName { get; set; } } public class MarketReport { //A list of activists public Leaders leaderlist { get; set; } } Now, I have no idea if I am doing the above correctly, but I want to populate the list within the MarketReport foreach (var store in stores) { MarketReport.leaderlist.AddItem //I want to add an item of type Leader to the list //so that I can pass it to MVC view }

    Read the article

  • How to know record has been updated successfully in php

    - by Lisa Ray
    $sql = "UPDATE...."; if(mysql_query($sql)) { $_SESSION['Trans']="COMMIT"; header("location:result.php"); exit; } else { $_SESSION['Trans']="FAIL"; $_SESSION['errors'] = "Error: Sorry! We are unable to update your Profile, Please contact to PNP HelpDesk."; header("location:result.php"); exit; }//end IF data is getting updated then why compiler is not coming inside IF condition.

    Read the article

  • app engine's back referencing is too slow. How can I make it faster?

    - by Ray Yun
    Google app engine has smart feature named back references and I usually iterate them where the traditional SQL's computed column need to be used. Just imagine that need to accumulate specific force's total hp. class Force(db.Model): hp = db.IntegerProperty() class UnitGroup(db.Model): force = db.ReferenceProperty(reference_class=Force,collection_name="groups") hp = db.IntegerProperty() class Unit(db.Model): group = db.ReferenceProperty(reference_class=UnitGroup,collection_name="units") hp = db.IntegerProperty() When I code like following, it was horribly slow (almost 3s) with 20 forces with single group - single unit. (I guess back-referencing force reload sub entities. Am I right?) def get_hp(self): hp = 0 for group in self.groups: group_hp = 0 for unit in group.units: group_hp += unit.hp hp += group_hp return hp How can I optimize this code? Please consider that there are more properties should be computed for each force/unit-groups and I don't want to save these collective properties to each entities. :)

    Read the article

  • How do I run my application while a UAC dialog window is showing?

    - by Ray
    I have an application that I wrote in .NET. It needs to remain running and have access the desktop that the UAC dialog windows open on and interact with that desktop using keyboard and mouse events. It's sort of like a VNC program. Imagine you are running a VNC program and a UAC window pops up, you want your VNC program to still be able to control the desktop with the UAC window in it so that the user can move the mouse and click the OK button on the UAC dialog. Can anyone tell me how I would go about doing that? Thanks

    Read the article

  • javascript "window.history.forward(1);" not working.

    - by Ray L.
    Hi, I'm trying to prevent the back button from working on one of my asp.net mvc pages. I've read a couple of places that if i put "window.history.forward(1);" in my page it will prevent the back button from working on a given page. This is what I did in my page: <script type="text/javascript"> $(document).ready(function () { window.history.forward(1); }); </script> It doesn't seem to be working. Am I using this incorrectly or is this approach wrong? thanks.

    Read the article

  • Mvc4 webapi file download with jquery

    - by Ray
    I want to download file on client side from api apicontroller: public HttpResponseMessage PostOfficeSupplies() { string csv = string.Format ("D:\\Others\\Images/file.png"); HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new StringContent(csv); result.Content.Headers.ContentType = new MediaTypeHeaderValue ("application/octet-stream"); result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); result.Content.Headers.ContentDisposition.FileName = "file.png"; return result; } 1.How can I popup a download with jquery(octet-stream) from api controller? my client side code: $(document).ready(function () { $.ajax( { url: 'api/MyAPI' , type: "post" , contentType: "application/octet-stream" , data: '' , success: function (retData) { $("body").append("<iframe src='" + retData + "' style='display: none;' ></iframe>"); } }); }); but it was not work!!!Thanks!!

    Read the article

  • 3D coordinate of 2D point given camera and view plane

    - by Myx
    I wish to generate rays from the camera through the viewing plane. In order to do this, I need my camera position ("eye"), the up, right, and towards vectors (where towards is the vector from the camera in the direction of the object that the camera is looking at) and P, the point on the viewing plane. Once I have these, the ray that's generated is: ray = camera_eye + t*(P-camera_eye); where t is the distance along the ray (assume t = 1 for now). My question is, how do I obtain the 3D coordinates of point P given that it is located at position (i,j) on the viewing plane? Assume that the upper left and lower right corners of the viewing plane are given. NOTE: The viewing plane is not actually a plane in the sense that it doesn't extend infinitely in all directions. Rather, one may think of this plane as a widthxheight image. In the x direction, the range is 0--width and in the y direction the range is 0--height. I wish to find the 3D coordinate of the (i,j)th element, 0

    Read the article

  • Using IF LARGE when there is text in column

    - by Ray
    I have an excel column of numbers and texts. I tried to use "IF LARGE" to find top 3 numbers of the column (A1 to A7), and return "Yes" to the cells right next to the top 3 (in column B). But unfortunately, the cells next to the texts also returned "Yes". This is the data: 0.2 0.3 Yes 0.5 Yes 0.1 0.8 Yes asdf Yes jklm Yes This is the code for cell B7: =IF(A7>=LARGE($A$1:$A$7,3),"Yes","") Any suggestions to fix this? thanks in advance

    Read the article

  • Using ethernet cables?

    - by Farhad Yusufali
    I have an HDTV which supports internet connectivity through an ethernet port or wirelessly (but this requires an additional wireless USB adapter, which I don't have). I also have a blue ray player than supports internet connectivity through an ethernet port or wirelessly (natively - no other devices are needed). I want to connect my TV to the internet but my router is too far away. My blueray player however is already connected wirelessly. If I connected my TV to my Blueray player via ethernet, would my TV be able to connect to the internet? To clarify: Wireless Signal - Blue Ray Player - Ethernet Cable - TV Would this work?

    Read the article

  • Screen space to world space

    - by user13414
    I am writing a 2D game where my game world has x axis running left to right, y axis running top to bottom, and z axis out of the screen: Whilst my game world is top-down, the game is rendered on a slight tilt: I'm working on projecting from world space to screen space, and vice-versa. I have the former working as follows: var viewport = new Viewport(0, 0, this.ScreenWidth, this.ScreenHeight); var screenPoint = viewport.Project(worldPoint.NegateY(), this.ProjectionMatrix, this.ViewMatrix, this.WorldMatrix); The NegateY() extension method does exactly what it sounds like, since XNA's y axis runs bottom to top instead of top to bottom. The screenshot above shows this all working. Basically, I have a bunch of points in 3D space that I then render in screen space. I can modify camera properties in real time and see it animate to the new position. Obviously my actual game will use sprites rather than points and the camera position will be fixed, but I'm just trying to get all the math in place before getting to that. Now, I am trying to convert back the other way. That is, given an x and y point in screen space above, determine the corresponding point in world space. So if I point the cursor at, say, the bottom-left of the green trapezoid, I want to get a world space reading of (0, 480). The z coordinate is irrelevant. Or, rather, the z coordinate will always be zero when mapping back to world space. Essentially, I want to implement this method signature: public Vector2 ScreenPointToWorld(Vector2 point) I've tried several things to get this working but am just having no luck. My latest thinking is that I need to call Viewport.Unproject twice with differing near/far z values, calculate the resultant Ray, normalize it, then calculate the intersection of the Ray with a Plane that basically represents ground-level of my world. However, I got stuck on the last step and wasn't sure whether I was over-complicating things. Can anyone point me in the right direction on how to achieve this?

    Read the article

  • How do I get VDPAU working with Ubuntu 9.1?

    - by Brad Robertson
    What do I need to do to get MKV HD videos playing with VDPAU and also Blu-ray discs? Lots of people say you need to compile the latest MPlayer (which I haven't had luck doing) for VDPAU. I found an mplayer ppa that says it has VDPAU compiled into it so I'd like to use that. What packages do I need for playing MKV files and Blu-ray with the video decoding offloaded to my GPU? So far I haven't had any luck with any of the tutorials I've found. I'm just looking for a quick synopsis that will tell me what I'm looking for as I'm kind of shooting in the dark. (I didn't know what VDPAU was until a few days ago.)

    Read the article

  • How do I get VDPAU working with Ubuntu 9.10?

    - by Brad Robertson
    What do I need to do to get MKV HD videos playing with VDPAU and also Blu-ray discs? Lots of people say you need to compile the latest MPlayer (which I haven't had luck doing) for VDPAU. I found an mplayer ppa that says it has VDPAU compiled into it so I'd like to use that. What packages do I need for playing MKV files and Blu-ray with the video decoding offloaded to my GPU? So far I haven't had any luck with any of the tutorials I've found. I'm just looking for a quick synopsis that will tell me what I'm looking for as I'm kind of shooting in the dark. (I didn't know what VDPAU was until a few days ago.)

    Read the article

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