Search Results

Search found 104 results on 5 pages for 'paddy carroll'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • NSArray safeguards

    - by Spider-Paddy
    If there is a chance that an NSArray is empty, is it better to check it and set equal to nil if it's empty when it is assigned or to rather do the check when it is used? e.g. NSArray *myArray; if ([anotherArray count] > 0) <-- Check when assigned myArray = [anotherArray copy]; else myArray = nil; something = [myArray objectAtIndex:x]; or NSArray *myArray; myArray = [anotherArray copy]; if ([myArray count] > 0) <-- Check when used something = [myArray objectAtIndex:x]; Which is better?

    Read the article

  • Rexml - Parsing Data

    - by Paddy
    I have a XML File in the following format: <?xml version='1.0' encoding='UTF-8'?> <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009' xmlns:app='http://www.w3.org/2007/app' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/&quot;DUYGRX85fCp7I2A9WxFWEkQ.&quot;'><id>https://www.google.com/analytics/feeds/websiteoptimizer/experiments/1025910</id><updated>2010-05-31T02:12:04.124-07:00</updated><app:edited>2010-05-31T02:12:04.124-07:00</app:edited><title>Flow Experiment</title><link rel='gwo:goalUrl' type='text/html' href='http://cart.personallifemedia.com/dlg/download.php'/><link rel='alternate' type='text/html' href='https://www.google.com/websiteoptimizer'/><link rel='self' type='application/atom+xml' href='https://www.google.com/analytics/feeds/websiteoptimizer/experiments/1025910'/><gwo:analyticsAccountId>16334726</gwo:analyticsAccountId><gwo:autoPruneMode>None</gwo:autoPruneMode><gwo:controlScript>..... I have to parse and get the data for gd:etag and how do I do it? I was able to get the value using SimpleXML, but i wanted to achieve it in ReXML. Please do advice.

    Read the article

  • Expanding DIV slides behind DIV beneath it...

    - by Paddy
    I'm not sure that I'm going to get an answer here, as I'd need to post a lot of CSS and html to get a working recreation, however... I have structure something like this: <fieldset> <legend>Test A</legend> <h3>Test A</h3> <p> Something here. </p> <div style="display:hidden;">I'm dynamically displayed</div> </fieldset> <fieldset> <legend>Test B</legend> <h3>Test B</h3> <p> Something B here. </p> </fieldset> I have code that toggles the display of my hidden div using jQuery and .show(). This works fine in IE8, firefox and Safari, but when I stick IE8 into compatibility mode, then the first fieldset (Test A) will expand, but the expansion happens behind the second fieldset, which doesn't move (i.e. it slides down behind it). I have quite a bit of CSS in use here, and I'm going to have to go back and unpick the whold lot, which isn't a fun idea. If anybody has any idea of one of the IE7 rendering issues that might be affecting this, then I'd very much appreciate it. (note that there is more to the content in these fieldsets than shown, including floated divs). Quick note - if I stick IE7 into quirks mode, it works (but wrecks the rest of my layout) - in standards mode, I get the above behaviour.

    Read the article

  • Warning generated by UIButton setting code

    - by Spider-Paddy
    I have a for loop setting the background images on buttons, basically the buttons are thumbnail previews of different items & can't be set statically, however the code gives an warning because it runs through all the UIViews but then calls setBackgroundImage which does not apply to all views. The warning is an irritation, I understand what it's complaining about, how can I get rid of it? (I don't want to turn off the warning, I want to fix the problem) // For loop to set button images for (UIView *subview in [self.view subviews]) // Loop through all subviews { // Look for the tagged buttons, only the 8 tagged buttons & within array bounds if((subview.tag >= 1) && (subview.tag <= 8) && (subview.tag < totalBundles)) { // Retrieve item in array at position matching button tag (array is 0 indexed) NSDictionary *bundlesDataItem = [bundlesDataSource objectAtIndex:(subview.tag - 1)]; // Set button background to thumbnail of current bundle NSString *picAddress = [NSString stringWithFormat:@"http://some.thing.com/data/images/%@/%@", [bundlesDataItem objectForKey:@"Nr"], [bundlesDataItem objectForKey:@"Thumb"]]; NSURL *picURL = [NSURL URLWithString:picAddress]; NSData *picData = [NSData dataWithContentsOfURL:picURL]; // Warning is generated here [subview setBackgroundImage:[UIImage imageWithData:picData] forState:UIControlStateNormal]; } }

    Read the article

  • Canvas and HTML5: Supported Browsers?

    - by Paddy
    I am looking at using HTML5 Canvas element for my upcoming project. I want to know what all major browsers (including the versions!, cos i know that the latest builds do support canvas) support the Canvas tag. I don't give a damn about IE. So don't bother reporting IE. :) In this tutorial Drawing shapes - MDC, the quadraticCurveTo section says: quadraticCurveTo(cp1x, cp1y, x, y) // BROKEN in Firefox 1.5 (see work around below) Does that mean that Canvas is supported on Firefox 1.5 and above too?

    Read the article

  • Rendering problem with UITableview

    - by Spider-Paddy
    I have a very strange problem with a UITableview within a navigation controller on the iPhone simulator. Of the cells displayed, only some are correctly rendered. They are all supposed to look the same but the majority are missing the accessory I've set, scrolling the view changes which cell has the accessory so I suspect it's some sort of cell caching happening, although the contents are correct for each cell. I also set an image as the background and that was also only displaying sporadically but I fixed that by changing cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yellow-bar_short.png"]]; (which also only rendered a random cell with the background) to cell.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yellow-bar_short.png"]]; I now need to fix the problem with the accessory only showing on a random cell. I tried moving the code from cellForRowAtIndex to willDisplayCell but it made no difference. I put in a log command to confirm that it is running through each frame. Basically it's a table view (UITableViewCellStyleSubtitle) that gets its info from a server & is then updated by a delegate method calling reload. Code is: -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"%@", [NSString stringWithFormat:@"Setting colours for cell %i", indexPath.row]); // Set cell background // cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yellow-bar_short.png"]]; cell.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yellow-bar_short.png"]]; cell.textLabel.backgroundColor = [UIColor clearColor]; cell.detailTextLabel.backgroundColor = [UIColor clearColor]; // detailTableViewAccessory is a view containing an imageview in this view's nib // i.e. nib <- view <- imageview <- image cell.accessoryView = detailTableViewAccessory; } // Called by data fetching object when done -(void)listDataTransferComplete:(ArticleListParser *)articleListParserObject { NSLog(@"Data parsed, reloading detail table"); self.currentTotalResultPages = (((articleListParserObject.currentArticleCount - 1) / 10) + 1); self.detailTableDataSource = [articleListParserObject.returnedArray copy]; // make a local copy of the returned array // Render table again with returned array data (neither of these 2 fixed it) [self.detailTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; // [self.detailTableView reloadData]; // Re-enable necessary buttons (including table cells) letUserSelectRow = TRUE; [btnByName setEnabled:TRUE]; [btnByPrice setEnabled:TRUE]; // Remove please wait message NSLog(@"Removing please wait view"); [pleaseWaitViewControllerObject.view removeFromSuperview]; } I only included code that I thought was relevant, can supply more if needed. I can't test it on an iPhone yet so I don't know if it's maybe just a simulator anomaly or a bug in my code. I've always gotten good feedback from questions, any ideas?

    Read the article

  • Regarding Authlogic and page redirection.

    - by Paddy
    I am using authlogic for authentication in my Rails app. Have named routes for the frequent actions, viz: map.login "login", :controller = "user_sessions", :action = "new" map.logout "logout", :controller = "user_sessions", :action = "destroy" map.register "register", :controller = "users", :action = "new" map.edit 'user/edit/:id', :controller = "users", :action = "edit" But also in my routes.rb i have these automatically created REST routes too: map.resources :user_sessions map.resources :users The problem now is that a user can login from two different routes. Ex: From, http://localhost/login and also from http ://localhost/user_sessions/new. How do i restrict access only from the named route i have defined and not allow from user_sessions/new?

    Read the article

  • Translate SQL to LINQ query - group/join/filter

    - by Paddy
    I have the following query: SELECT S.[FlowOrder], S.[DESCRIPTION], COUNT(I.ID) FROM WorkFlowStatus AS S INNER JOIN Item AS I ON S.ID = I.StatusID WHERE I.Installation = '1' GROUP BY S.[Description], S.[FlowOrder] ORDER BY S.[FlowOrder] Which gives me the count of an item, grouped by a foreign key to workflow, outputting the descriptive name from my FK table. I've go this far with the LINQ query (using LINQ-to-SQL) in the background: var items = from s in _entities.WorkflowStatus join i in _entities.Items on s.ID equals i.StatusId into Statuses orderby s.FlowOrder select new {s.Description, ItemCount = Statuses.Count() }; How do I get the where clause in the SQL into this LINQ query?

    Read the article

  • Best way to initialise / clear a string variable cocoa

    - by Spider-Paddy
    I have a routine that parses text via a loop. At the end of each record I need to clear my string variables but I read that someString = @"" actually just points to a new string & causes a memory leak. What is the best way to handle this? Should I rather use mutable string vars and use setString:@"" between iterations?

    Read the article

  • LINQ-to-SQL eagerly load entire object graph

    - by Paddy
    I have a need to load an entire LINQ-to-SQL object graph from a certain point downwards, loading all child collections and the objects within them etc. This is going to be used to dump out the object structure and data to XML. Is there a way to do this without generating a large hard coded set of DataLoadOptions to 'shape' my data?

    Read the article

  • Embed form in another website - pitfalls

    - by Paddy
    Scenario: We provide a hosted site that clients pay to use internally (a tool to support their business workflow). We have a requirement to provide a form that the clients can 'embed' in their outward facing site. This form will permit a member of the public to enter some details to register an interest - this data will be pushed to our remote system. Question: I'm currently planning on creating a simple HTML page that the client's web guys can include in a simple fashion on their site (either using an iframe or an object tag). If I do this, am I going to run into difficulties when the user tries to submit the embedded form (as it will be going to different domain to the one they are currently browsing)? I had a look at google adsense and I see that they just provide a link to a JS file that renders their ads - I'm not sure I see the advantage in this, but if anybody has any bright ideas... Whatever technique that gets used, I'll have to authenticate the request as coming from my client's site(s).

    Read the article

  • jQuery .html() vs .text() produce different result in .hover() function

    - by Paddy
    I have a issue where in I am using the .hover() function. If I use .text() fuction to add the html (anchor tag) which I am dynamically creating, it works fine, both the functions are called as desired. But when I use the .html() function instead then the second fuction of .hover() is never been called. var i = 0; textItems = new Array(); ////I am putting the value into textItems using the jquery ajax call ////and i get its value from a .each() function. //.text() implementation $('#textArea-id').hover( function() { $('#textArea-id').text(textItems[i]); }, function() { //-->mouseout function is called here } ); //.html() implementation $('#textArea-id').hover( function() { $('#textArea-id').html(textItems[i]); }, function() { //-->mouseout function is never been called } );

    Read the article

  • First Test Crashes using MSTEST with ASP.NET MVC 1

    - by Trey Carroll
    I'm trying to start using Unit Testing and I want to test the following Controller: public class AjaxController : Controller { ... public JsonResult RateVideo( int userRating, long videoId ) { string userName = User.Identity.Name; ... } } I have a created a TestClass with the following method: [ TestMethod public void TestRateVideo() { //Arrange AjaxController c = new AjaxController(); //Act JsonResult jr = c.RateVideo(1, 1); //Assert //Not implemented yet } I select debug and run the test. When the code reaches the 1st statement: string username = User.Identity.Name; Debugging stops and I am presented with a message that says that the test failed. Any guidance you can offer would be appreciated.

    Read the article

  • Moose read-only Attribute Traits and how to set them?

    - by Evan Carroll
    How do I set a Moose read only attribute trait? package AttrTrait; use Moose::Role; has 'ext' => ( isa => 'Str', is => 'ro' ); package Class; has 'foo' => ( isa => 'Str', is => 'ro', traits => [qw/AttrTrait/] ); package main; my $c = Class->new( foo => 'ok' ); $c->meta->get_attribute('foo')->ext('die') # ro attr trait What is the purpose of Read Only attribute traits if you can't set it in the constructor or in runtime? Is there something I'm missing in Moose::Meta::Attribute? Is there a way to set it using meta? $c->meta->get_attr('ext')->set_value('foo') # doesn't work either (attribute trait provided not class provided method)

    Read the article

  • Ldap query returns null result when deployed.

    - by Trey Carroll
    I'm using a very simple Ldap query in my asp.net mvc 2.0 site: String ldapPath = ConfigReader.LdapPath; String emailAddress = null; try { DirectorySearcher search = new DirectorySearcher(ConfigReader.LdapPath); search.Filter = String.Format("(&(objectClass=user)(objectCategory=person)(objectSid={0})) ", securityIdentifierValue); // add the mail property to the list of props to retrieve search.PropertiesToLoad.Add("mail"); var result = search.FindOne(); if (result == null) { throw new Exception("Ldap Query with filter:" + search.Filter.ToString() + " returned a null value (no match found)"); } else { emailAddress = result.Properties["mail"][0].ToString(); } } catch (ArgumentOutOfRangeException aoorEx) { throw new Exception( "The query could not find an email for this user."); } catch (Exception ex) { //_log.Error(string.Format("======!!!!!! ERROR ERROR ERROR !!!!! in LdapLookupUtil.cs getEmailFromLdap Exception: {0}", ex)); throw ex; } return emailAddress; It works fine on my localhost machine. It works fine when I run it in VS2010 on the server. It always returns a null result when deployed. Here is my web.config: Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config -- section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. -- <!-- -- section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. -- I'm running it under the default app pool. Does anybody see the problem? This is driving me crazy!

    Read the article

  • PerlIO in Windows PowerShell and CMD.exe

    - by Evan Carroll
    Apparently, a Perl script I have results in two different output files depending on if I run it under Windows PowerShell, or cmd.exe. The script can be found at the bottom of this question. The file handle is opened with IO::File, I believe that PerlIO is doing some screwy stuff. It seems as if under cmd.exe the encoding chosen is much more compact encoding (4.09 KB), as compared to PowerShell which generates a file nearly twice the size (8.19 KB). This script takes a shell script and generates a Windows batch file. It seems like the one generated under cmd.exe is just regular ASCII (1 byte character), while the other one appears to be UTF-16 (first two bytes FF FE) Can someone verify and explain why PerlIO works differently under Windows Powershell than cmd.exe? Also, how do I explicitly get an ASCII-magic PerlIO filehandle using IO::File? Currently, only the file generated with cmd.exe is executable. The UTF-16 .bat (I think that's the encoding) is not executable by either PowerShell or cmd.exe. BTW, we're using Perl 5.12.1 for MSWin32 #!/usr/bin/env perl use strict; use warnings; use File::Spec; use IO::File; use IO::Dir; use feature ':5.10'; my $bash_ftp_script = File::Spec->catfile( 'bin', 'dm-ftp-push' ); my $fh = IO::File->new( $bash_ftp_script, 'r' ) or die $!; my @lines = grep $_ !~ /^#.*/, <$fh>; my $file = join '', @lines; $file =~ s/ \\\n/ /gm; $file =~ tr/'\t/"/d; $file =~ s/ +/ /g; $file =~ s/\b"|"\b/"/g; my @singleLnFile = grep /ncftp|echo/, split $/, $file; s/\$PWD\///g for @singleLnFile; my $dh = IO::Dir->new( '.' ); my @files = grep /\.pl$/, $dh->read; say 'echo off'; say "perl $_" for @files; say for @singleLnFile; 1;

    Read the article

  • Asp.net mvc - trying to display images pulled from db \

    - by Trey Carroll
    //Inherits="System.Web.Mvc.ViewPage<FilmFestWeb.Models.ListVideosViewModel>" <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>ListVideos</h2> <% foreach(BusinessObjects.Video vid in Model.VideoList){%> <div class="videoBox"> <%= Html.Encode(vid.Name) %> <img src="<%= vid.ThumbnailImage %>" /> </div> <%} %> </asp:Content> //ListVideosViewModel public class ListVideosViewModel { public IList<Video> VideoList { get; set; } } //Video public class Video { public long VideoId { get; set; } public long TeamId { get; set; } public string Name { get; set; } public string Tags { get; set; } public string TeamMembers { get; set; } public string TranscriptFileName { get; set; } public string VideoFileName { get; set; } public int TotalNumRatings { get; set; } public int CumulativeTotalScore { get; set; } public string VideoUri { get; set; } public Image ThumbnailImage { get; set; } } I am getting the "red x" that I usually associate with image file not found. I have verified that my database table shows after the stored proc that uploads the image executes. Any insight or advice would be greatly appreciated.

    Read the article

  • Is Perl's flip-flop operator bugged? It has global state, how can I reset it?

    - by Evan Carroll
    I'm dismayed. Ok, so this was probably the most fun perl bug I've ever found. Even today I'm learning new stuff about perl. Essentially, the flip-flop operator .. which returns false until the left-hand-side returns true, and then true until the right-hand-side returns false keep global state (or that is what I assume.) My question is can I reset it, (perhaps this would be a good addition to perl4-esque hardly ever used reset())? Or, is there no way to use this operator safely? I also don't see this (the global context bit) documented anywhere in perldoc perlop is this a mistake? Code use feature ':5.10'; use strict; use warnings; sub search { my $arr = shift; grep { !( /start/ .. /never_exist/ ) } @$arr; } my @foo = qw/foo bar start baz end quz quz/; my @bar = qw/foo bar start baz end quz quz/; say 'first shot - foo'; say for search \@foo; say 'second shot - bar'; say for search \@bar; Spoiler $ perl test.pl first shot foo bar second shot

    Read the article

  • How do I join two git repos without a common root, where all modified files are the same?

    - by Evan Carroll
    I have a git-cpan-init of a repo which yielded a different root node from another already established git repo I found on github C:A:S:DBI. I've developed quite a bit on my repo, and I'd like to merge or replay my edits on a fork of the more authoritative repository. Does anyone know how to do this? I think it is safe to assume none of the file-contents of the modified files are different -- the code base hasn't been since Nov 08'. For clarity the git hub repo is the authoritative one. My local repo is the one I want to go up to git hub shown as a real git fork.

    Read the article

  • Gridview delete/edit not working when using select parameter

    - by Brian Carroll
    new to ASP.NET. I created a sqldatasource and set up basic select query (SELECT * FROM Accounts) using the wizard. I then had the sqldatasource wizard create the INSERT, EDIT and DELETE queries. Connected this datasource to a gridview with EDITING and DELETING enabled. Everything works fine. The SELECT query returns all records and I can edit/delete them. Now I need to send a parameter to the SELECT command to filter the records to those with the user's id (pulled from Membership.GetUser). When I add this parameter, the SELECT command works fine, but the EDIT/DELETE buttons in the gridview no longer work. No error is generated. The page refreshes but the records were not updated in the database. I don't understand what is wrong. CODE: <% Dim u As MembershipUser Dim userid As String u = Membership.GetUser(User.Identity.Name) userid = u.ProviderUserKey.ToString SqlDataSource1.SelectParameters("UserId").DefaultValue = userid %> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1"> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /> <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" /> <asp:BoundField DataField="AccountName" HeaderText="AccountName" SortExpression="AccountName" /> <asp:BoundField DataField="DateAdded" HeaderText="DateAdded" SortExpression="DateAdded" /> <asp:BoundField DataField="LastModified" HeaderText="LastModified" SortExpression="LastModified" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CheckingConnectionString %>" DeleteCommand="DELETE FROM [Accounts] WHERE [ID] = @ID" InsertCommand="INSERT INTO [Accounts] ([UserId], [AccountName], [DateAdded], [LastModified]) VALUES (@UserId, @AccountName, @DateAdded, @LastModified)" SelectCommand="SELECT * FROM [Accounts] WHERE [UserId] = @UserId" UpdateCommand="UPDATE [Accounts] SET [UserId] = @UserId, [AccountName] = @AccountName, [DateAdded] = @DateAdded, [LastModified] = @LastModified WHERE [ID] = @ID"> <DeleteParameters> <asp:Parameter Name="ID" Type="Int32" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="UserId" Type="String" /> <asp:Parameter Name="AccountName" Type="String" /> <asp:Parameter Name="DateAdded" Type="DateTime" /> <asp:Parameter Name="LastModified" Type="DateTime" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="UserId" Type="String" /> <asp:Parameter Name="AccountName" Type="String" /> <asp:Parameter Name="DateAdded" Type="DateTime" /> <asp:Parameter Name="LastModified" Type="DateTime" /> <asp:Parameter Name="ID" Type="Int32" /> </UpdateParameters> <SelectParameters> <asp:Parameter Name="UserId"/> </SelectParameters> </asp:SqlDataSource>

    Read the article

  • How do I fix a font compatibilty issue from Mac to Windows, using Adobe Flash CS4?

    - by Michel Carroll
    Hi, I need to edit a Flash movie that somebody else developed in Adobe Flash CS3 on a Mac. I'm using Adobe Flash CS4 on Windows (Vista). However, the font that shows up on my computer is much bigger than on the .SWF that he produced. He used a custom font, which I had to add to my system Fonts folder. Because Adobe Flash detected the right fonts on my computer, it didn't map them to substitute fonts. I verified that Flash is indeed using the same font files that he used. I believe the fonts are being rendered differently because I'm using Windows. How do I fix this?

    Read the article

  • Asp.net mvc retriev images from db and display on Page

    - by Trey Carroll
    //Inherits="System.Web.Mvc.ViewPage<FilmFestWeb.Models.ListVideosViewModel>" <h2>ListVideos</h2> <% foreach(BusinessObjects.Video vid in Model.VideoList){%> <div class="videoBox"> <%= Html.Encode(vid.Name) %> <img src="<% vid.ThumbnailImage; %>" /> </div> <%} %> //ListVideosViewModel public class ListVideosViewModel { public IList<Video> VideoList { get; set; } } //Video public class Video { public long VideoId { get; set; } public long TeamId { get; set; } public string Name { get; set; } public string Tags { get; set; } public string TeamMembers { get; set; } public string TranscriptFileName { get; set; } public string VideoFileName { get; set; } public int TotalNumRatings { get; set; } public int CumulativeTotalScore { get; set; } public string VideoUri { get; set; } public Image ThumbnailImage { get; set; } } I am getting the "red x" that I usually associate with image file not found. I have verified that my database table shows <binary data> after the stored proc that uploads the image executes. Any insight or advice would be greatly appreciated.

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >