Daily Archives

Articles indexed Thursday June 10 2010

Page 2/121 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • NSZombieEnabled breaking working code?

    - by Gordon Fontenot
    I have the following method in UIImageManipulation.m: +(UIImage *)scaleImage:(UIImage *)source toSize:(CGSize)size { UIImage *scaledImage = nil; if (source != nil) { UIGraphicsBeginImageContext(size); [source drawInRect:CGRectMake(0, 0, size.width, size.height)]; scaledImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } return scaledImage; } I am calling it in a different view with: imageFromFile = [UIImageManipulator scaleImage:imageFromFile toSize:imageView.frame.size]; (imageView is a UIImageView allocated earlier) This is working great in my code. I resizes the image perfectly, and throws zero errors. I also don't have anything pop up under build - analyze. But the second I turn on NSZombieEnabled to debug a different EXC_BAD_ACCESS issue, the code breaks. Every single time. I can turn NSZombieEnabled off, code runs great. I turn it on, and boom. Broken. I comment out the call, and it works again. Every single time, it gives me an error in the console: -[UIImage release]: message sent to deallocated instance 0x3b1d600. This error doesn't appear if `NSZombieEnabled is turned off. Any ideas? --EDIT-- Ok, This is killing me. I have stuck breakpoints everywhere I can, and I still cannot get a hold of this thing. Here is the full code when I call the scaleImage method: -(void)setupImageButton { UIImage *imageFromFile; if (object.imageAttribute == nil) { imageFromFile = [UIImage imageNamed:@"no-image.png"]; } else { imageFromFile = object.imageAttribute; } UIImage *scaledImage = [UIImageManipulator scaleImage:imageFromFile toSize:imageButton.frame.size]; UIImage *roundedImage = [UIImageManipulator makeRoundCornerImage:scaledImage :10 :10 withBorder:YES]; [imageButton setBackgroundImage:roundedImage forState:UIControlStateNormal]; } The other UIImageManipulator method (makeRoundCornerImage) shouldn't be causing the error, but just in case I'm overlooking something, I threw the entire file up on github here. It's something about this method though. Has to be. If I comment it out, it works great. If I leave it in, Error. But it doesn't throw errors with NSZombieEnabled turned off ever.

    Read the article

  • New line or Carraige Return syntax problems

    - by Smoka
    Im pretty new to coding, heres my problem. Results->Text = "G55 > Y" + System::Convert::ToString(destY); "Results" is a System.Windows.Forms.Textbox "multiline btw", or so says VS. That line works fine, but i need a "new line or CR" at the end, so that i can repeat that line with different Literals and a different var in ToString. For days now ive tried different syntax's ive read about, and i cant get it to take any of them. Or even a complete different way to input text into Results-Text that would allow for tidy multiline use. Sidenote: since im using -Text and System::Convert::ToString in VC, would this code be considered just c++ or .net or CLI? to tighten my searches.

    Read the article

  • Can one connection get details of another? Or, how can I get the most detailed pending transaction

    - by bob-the-destroyer
    Is there a Mysql statement which provides full details of any other open connection or user? For this particular case, on myisam tables specifically. Looking at Mysql's SHOW TABLE STATUS documentation, it's missing some very important information for my purpose. For example: remote odbc connection one is inserting several thousand records, which due to a slow connection speed can take up to an hour. Tcp connection two, using PHP on the server's localhost, is running select queries with aggregate functions on that data. Before allowing connection two to run those queries, I'd like connection two to first check to make sure there's no pending inserts on any other connection on those specific tables so it can instead wait until all data is available. If the table is currently being written to, I'd like to spit back to the user of connection two an approximation of how much longer to wait based on the number of pending inserts. Ideally by table, I'd like to get back using a query the timestamp when connection one began the write, total inserts left to be done, and total inserts already completed. Instead of insert counts, even knowing number of bytes written and left to write would work just fine here. Obviously since connection two is a tcp connection via a PHP script, all I can really use in that script is some sort of query. I suppose if I have to, since it is on localhost, I can exec() it if the only way is by a mysql command line option that outputs this info, but I'd rather not. I suppose I could simply update a custom-made transaction log before and after this massive insert task which the PHP script can check, but hopefully there's already a built-in Mysql feature I can take advantage of.

    Read the article

  • What is the purpose of Managers / Transactions?

    - by maxdj
    I'm building a spring application for the first time. I'm running into lots of problems with concurrency, and I suspect that there is something wrong with the way I'm managing the backend. The only difference I can see between my backend code and examples I've seen are manager classes. In my code, I have my model (managed by hibernate) and my DAOs on top of that to do CRUD/searching/etc on the models. In example code I have looked at, they never use the DAO directly. Instead, they use manager classes that call the DAOs indirectly. To me, this just seems like pointless code duplication. What are these manager classes for? I've read that they wrap my code in "transactions," but why would I want that?

    Read the article

  • What advantages can I get from learning C++ if I'm mainly a C# Programmer?

    - by Sergio Tapia
    Hello, Recently I've started to notice a lot of smirks and generally rude comments whenever I mention C#. Everyone I talk to either says learn Python or learn C++. Python is a nice language, I get it. But I don't find much use for it right now (for my use cases), and C++ I heard is a faster language (not sure). So my question is this, what advantage can I get from learning C++ (besides the knowledge and expansion of my horizons), when I mainly program in C#. If anyone can make a legitimate claim, I'll for sure look into learning the language because let's face it, I trust you guys. Thanks so much for all the help.

    Read the article

  • Resolving HttpRequestScoped Instances outside of a HttpRequest in Autofac

    - by Page Brooks
    Suppose I have a dependency that is registered as HttpRequestScoped so there is only one instance per request. How could I resolve a dependency of the same type outside of an HttpRequest? For example: // Global.asax.cs Registration builder.Register(c => new MyDataContext(connString)).As<IDatabase>().HttpRequestScoped(); _containerProvider = new ContainerProvider(builder.Build()); // This event handler gets fired outside of a request // when a cached item is removed from the cache. public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { // I'm trying to resolve like so, but this doesn't work... var dataContext = _containerProvider.ApplicationContainer.Resolve<IDatabase>(); // Do stuff with data context. } The above code throws a DependencyResolutionException when it executes the CacheItemRemoved handler: No scope matching the expression 'value(Autofac.Builder.RegistrationBuilder`3+<c__DisplayClass0[MyApp.Core.Data.MyDataContext,Autofac.Builder.SimpleActivatorData,Autofac.Builder.SingleRegistrationStyle]).lifetimeScopeTag.Equals(scope.Tag)' is visible from the scope in which the instance was requested.

    Read the article

  • Delphi 2010 differs in Canvas transparency compared to Delphi 7?

    - by Tom1952
    I'm porting some very old code from Delph7 to Delphi2010 with a few changes as possible to the existing code base for the usual reasons. First: the good news for anyone who hasn't jumped yet: it's not as daunting as it may look! I'm actually pleased (& surprised) at how easy 1,000,000+ lines of code have moved across. And what a relief to be back on the leading edge! Delphi 2010 has so many great enhancements. However, I'm having a cosmetic problem with some TStringGrids and TDbGrids descendants. In the last century (literally!) someone wrote the two methods below. The first method is used to justify text. When run in Delphi 2010, the new text and the unjustified text to both appear in the cells written to. Of course it's a mess visually, almost illegible. Sometimes, as a result of the second method is use, the grid cells are actually semi-transparent, with text from the window below showing through. (Again, not pretty!) It appears to me that Delphi 2010's TDbGrid and TStringGrid have some differences in the way they handle transparency? I haven't much experience in this area of Delphi (in fact, I have no idea what the 2nd method is actually doing!) and was hoping someone could give me some pointers on what's going on and how to fix it. TIA! Method 1 procedure TForm1.gridDrawCell(Sender: TObject; Col, Row: Integer; Rect: TRect; State: TGridDrawState); {Used to align text in cells.} var x: integer; begin if (Row > 0) AND (Col > 0) then begin SetTextAlign(grdTotals.Canvas.Handle, TA_RIGHT); x := Rect.Right - 2; end else begin SetTextAlign(grdTotals.Canvas.Handle, TA_CENTER); x := (Rect.Left + Rect.Right) div 2; end; grdTotals.Canvas.TextRect(Rect, x, Rect.Top+2, grdTotals.Cells[Col,Row]); end; Method 2 procedure WriteText(ACanvas: TCanvas; ARect: TRect; DX, DY: Integer; const Text: string; TitleBreak: TTitleBreak; Alignment: TAlignment); const AlignFlags: array [TAlignment] of Integer = (DT_LEFT or { DT_WORDBREAK or } DT_EXPANDTABS or DT_NOPREFIX, DT_RIGHT or { DT_WORDBREAK or } DT_EXPANDTABS or DT_NOPREFIX, DT_CENTER or { DT_WORDBREAK or } DT_EXPANDTABS or DT_NOPREFIX); var ABitmap: TBitmap; AdjustBy: Integer; B, R: TRect; WordBreak: Integer; begin WordBreak := 0; if (TitleBreak = tbAlways) or ((TitleBreak = tbDetect) and (Pos(Chr(13) + Chr(10), Text) = 0)) then WordBreak := DT_WORDBREAK; ABitmap := TBitmap.Create; try ABitmap.Canvas.Lock; try AdjustBy := 1; if (Alignment = taRightJustify) then Inc(AdjustBy); with ABitmap, ARect do begin Width := Max(Width, Right - Left); Height := Max(Height, Bottom - Top); R := Rect(DX, DY, Right - Left - AdjustBy, Bottom - Top - 1); { @@@ } B := Rect(0, 0, Right - Left, Bottom - Top); end; with ABitmap.Canvas do begin Font := ACanvas.Font; Brush := ACanvas.Brush; Brush.Style := bsSolid; FillRect(B); SetBkMode(Handle, TRANSPARENT); DrawText(Handle, PChar(Text), Length(Text), R, AlignFlags[Alignment] or WordBreak); end; ACanvas.CopyRect(ARect, ABitmap.Canvas, B); finally ABitmap.Canvas.Unlock; end; finally ABitmap.Free; end; end;

    Read the article

  • How to filter a character stream from an application using PowerShell?

    - by Christian
    A powershell question: I want to extract each line in a character stream produced by an application that matches a certain pattern which in pseudo-code would be something like this: PS <a_ps_command> <the_application_command_for_outputting_the_text_stream> | <my_filter > output_file.txt In my case the application is a CM-tool that outputs the change history of a source file and the (psuedo)pattern should be something like: <a couple of numbers><a name><a time stamp><a line of characters> Cheers, Christian

    Read the article

  • viewing files in python?

    - by Galilsnap
    I am creating a sort of "Command line" in Python. I already added a few functions, such as changing login/password, executing, etc., But is it possible to browse files in the directory that the main file is in with a command/module, or will I have to make the module myself and use the import command? Same thing with changing directories to view, too.

    Read the article

  • NLB Accessed Denied from second server

    - by Igor K
    Hello Have NLB set up and working. Just two servers, web1 and web2. I set up NLB on web1 and can view both machines as Converged. (I had to specify a login/pass to connect to web2). On web2, looking at the NLB Manager, it only shows web2 and says in the log "Accessed Denied. Error connecting to web1". Any ideas how to fix?

    Read the article

  • Disable time and date editing on Windows Mobile

    - by fbm
    Hi, Is there a way to disable time and date editing on a Windows Mobile device (via APIs or the registry)? I have an application using the time and date of a Windows Mobile PDA and I don't want the user to change it (the time and date) - unless - he/she has some kind of administrative rights. I haven't find a way to do it with the menus. Is it possible to do it in any other way? Thanks

    Read the article

  • problem with unicode in javaEE and save question mark in database

    - by Jeus
    when i insert persian information with use JEE6(JSF and JPA) my information save question mark for example "???" === "???" my database is Mysql and my table is UTF-8 . when insert persian data directly in database is correct and save correct. i know that with change one property in JEE my problem go to solved but i don`t know where is it ?

    Read the article

  • How to identify what locked PL/SQL package (Oracle 10.0.4.2)?

    - by Roman Kagan
    I was trying to recompile PL/SQL package and no avail. because something obtained the lock and that wasn't released for long time. As soon as I kill all sessions I was able to recompile but encounter the same behavior (i.e. locked package) and I wonder what tools are avail to identify what could of obtain it and never release it? This happen on (Oracle 10.0.4.2). Greatly appreciate for your help.

    Read the article

  • jQuery: loading reCaptcha into a div via ajax

    - by abdullah kahraman
    Hello, I want to create a form that has a div with id "captcha". When the user enters a wrong password, following code is generated in "login.php" $myCaptcha=recaptcha_get_html($publickey, $error); $xml="<captcha><![CDATA[".$myCaptcha ."]]></captcha>"; echo $xml; recaptcha_get_html($publickey, $error); generates this: <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=xxxx"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=xxxx" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> </noscript> I want to get this code with $.post() and insert it into div "captcha". Doing something like this: $.post("login.php", {requestCaptcha:"yes"}, function(returned){ $("#captcha").html($(returned).text(),"xml"); }); In IE, it does nothing. In Chrome, it clears up whole page and there is only the called reCaptcha script working like a charm. Any ideas?

    Read the article

  • Creating method templates in Eclipse

    - by stevebot
    Is there any way to do the following in eclipse? Have eclipse template a method like the following public void test(){ // CREATE MOCKS // CREATE EXPECTATIONS // REPLAY MOCKS // VERIFY MOCKS } so then I could presumably just use intellisense and select an option like "createtest" and have it stub out a method with the comments similar to the above?My problem is that often myself and other developers I know forgot all the steps we need to follow to do what we dub as a valid unit test for our application. If I could template our test methods to stub out the comments above it would be a big help.

    Read the article

  • Problem using ScriptManager.RegisterStartUpScript in user control - Script Error "function is not de

    - by poojad
    I have a aspx page which contains a User Control uc1 ans within uc1, there is another user control uc2. Now I need to call a javascript function in the uc2's page load. (I understand that the Pages are not properly designed, but I am sorry as this is an old application, I am not supposed to make any changes in the design) I am doing this using ScriptManager.RegisterStartUpScript as I have an update panel, but the function is not being called and the script error "load is not defined" is fired. (load is the javascript function in uc2) Can anyone help me out with this? Thank you.

    Read the article

  • Windows Server 2003 R2 SP2 GPO Conditional Terminal Services Client Redirection

    - by caleban
    We have a lot of mobile/home users with different client side printers attached. Most of these users don't need to print on the client side and we don't want all of these users Terminal Services sessions trying to map their client side printers and we don't want all of these drivers on the Terminal Server. What is the best way to set up around 90 users to have no client side printer redirection and 10 users to have client side printer redirection (to the printers attached to their home computers)? Do I need to create two separate OU's in AD one for redirection and one for no redirection and create two different policies one for each OU? One GPO with Client Server data redirection Do not allow client printer redirection disabled and one enabled? Is it preferrable instead to change each user's AD User Properties Enviroment Client devices Connect client printers at logon setting? Is there any for me to direct "ALL HP Printers" to a single HP Universal Printer Driver, "ALL Canon Printers" to a single Canon Universal Printer Driver, etc without specifying hundreds of unique printer names in the printsub.inf file? Thanks in advance.

    Read the article

  • VNC failure on Xen

    - by BCable
    The following config works and creates a good VM in Xen: # Kernel Setup kernel = "/boot/vmlinuz-2.6.18.8-xenU" # Memory memory = "256" # Disk disk = [ "file:/opt/xen/domains/110/sda1.img,sda1,w", "file:/opt/xen/domains/110/swap.img,sda2,w" ] # container name name = "110" hostname = "boo" # Networking vif = ["type=ieomu, bridge=xenbr0"] # VNC vnc = 1 #vfb = [ 'type=vnc,vncdisplay=2,vnclisten=0.0.0.0,vncpasswd=110' ] # Behavior Settings root = "/dev/sda1" extra = "fastboot" But when I uncomment the VFB line, I get the following error after it hangs for at least 30 seconds: [root@customer 110]# xm create boo.cfg Using config file "./boo.cfg". Error: Device 0 (vkbd) could not be connected. Hotplug scripts not working. Any ideas? Part two of this question: Sometimes it actually works, and a port is opened. When this happens, nmap shows the VNC ports open and I can connect via the VNC client, but it just hangs at "Connection established." and no VNC display shows up. I've tried multiple VNC clients (TightVNC, TightVNC Java Console, RealVNC), but they all fail to connect. Does VNC through Xen require X to be started in order to function? I was under the impression that it would show the console screen, so I'm confused as to why all these issues are occurring. Thanks!

    Read the article

  • WPF DataGrid Printing Scrolled Visuals

    - by RichS
    I've been using the DataGrid (from WPF Toolkit), and have successfully created all of my data. The next step is that I want to print the entire DataGrid (scaled to a single printed page), even though the visible DataGrid in my Window is currently scrolled. When I prepare the DataGrid for printing, I've tried setting the DesiredSize to PositiveInfinity, and then calling Measure(.), to get the needed size of the DataGrid. But, when I call Arrange(.), it only prints the part of the DataGrid control that is currently visible on-screen. I know how to scale it to the correct size, but can't get the non-visible part of the DataGrid to be output to the printer. I've tried rendering to a Bitmap (RenderTargetBitmap), but that has the same problem. I also tried setting the MinHeight and MinWidth to be the same as the DesiredSize to try to /force/ things. But that doesn't work either. All I ever see in my printed page, is what was visible on-screen. Does anyone know how to solve this?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >