Search Results

Search found 116 results on 5 pages for 'gavin grover'.

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

  • How can I close a Window using the OS-X ScriptingBridge framework, from Perl?

    - by Gavin Brock
    Problem... Since MacPerl is no longer supported on 64bit perl, I am trying alternative frameworks to control Terminal.app. I am trying the ScriptingBridge, but have run into a problem passing an enumerated string to the closeSaving method using the PerlObjCBridge. I want to call: typedef enum { TerminalSaveOptionsYes = 'yes ' /* Save the file. */, TerminalSaveOptionsNo = 'no ' /* Do not save the file. */, TerminalSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */ } TerminalSaveOptions; - (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. Attempted Solution... I have tried: #!/usr/bin/perl use strict; use warnings; use Foundation; # Load the ScriptingBridge framework NSBundle->bundleWithPath_('/System/Library/Frameworks/ScriptingBridge.framework')->load; @SBApplication::ISA = qw(PerlObjCBridge); # Set up scripting bridge for Terminal.app my $terminal = SBApplication->applicationWithBundleIdentifier_("com.apple.terminal"); # Open a new window, get back the tab my $tab = $terminal->doScript_in_('exec sleep 60', undef); warn "Opened tty: ".$tab->tty->UTF8String; # Yes, it is a tab # Now try to close it # Simple idea eval { $tab->closeSaving_savingIn_('no ', undef) }; warn $@ if $@; # Try passing a string ref my $no = 'no '; eval { $tab->closeSaving_savingIn_(\$no, undef) }; warn $@ if $@; # Ok - get a pointer to the string my $pointer = pack("P4", $no); eval { $tab->closeSaving_savingIn_($pointer, undef) }; warn $@ if $@; eval { $tab->closeSaving_savingIn_(\$pointer, undef) }; warn $@ if $@; # Try a pointer decodes as an int, like PerlObjCBridge uses my $int_pointer = unpack("L!", $pointer); eval { $tab->closeSaving_savingIn_($int_pointer, undef) }; warn $@ if $@; eval { $tab->closeSaving_savingIn_(\$int_pointer, undef) }; warn $@ if $@; # Aaarrgghhhh.... As you can see, all my guesses at how to pass the enumerated string fail. Before you flame me... I know that I could use another language (ruby, python, cocoa) to do this but that would require translating the rest of the code. I might be able to use CamelBones, but I don't want to assume my users have it installed. I could also use the NSAppleScript framework (assuming I went to the trouble of finding the Tab and Window IDs) but it seems odd to have to resort to it for just this one call.

    Read the article

  • Are web-safe colors still relevant?

    - by Gavin Miller
    Since the vast majority of monitors are 16-bit color or more, including mobile devices, does it make sense to even consider web-safe colors when choosing color schemes? Or is it something that ought to be relegated to history as a piece of trivia? For those of you that don't know what web-safe colors are: Another set of 216 color values is commonly considered to be the "web-safe" color palette, developed at a time when many computer displays were only capable of displaying 256 colors. A set of colors was needed that could be shown without dithering on 256-color displays; the number 216 was chosen partly because computer operating systems customarily reserved sixteen to twenty colors for their own use; it was also selected because it allows exactly six shades each of red, green, and blue (6 × 6 × 6 = 216). The list of colors is often presented as if it has special properties that render them immune to dithering. In fact, on 256-color displays applications can set a palette of any selection of colors that they choose, dithering the rest. These colors were chosen specifically because they matched the palettes selected by the then leading browser applications. [Wikipedia]

    Read the article

  • ColdFusion 8: Database Connection Reset Error

    - by Gavin
    I have been getting these intermittent ColdFusion Database connection reset errors and was wondering if anyone had experience with this and had a particular solution that worked? Here is the error: Error Executing Database Query.[Macromedia][SQLServer JDBC Driver]A problem occurred when attempting to contact the server (Server returned: Connection reset). Please ensure that the server parameters passed to the driver are correct and that the server is running. Also ensure that the maximum number of connections have not been exceeded for this server. This doesn't happen with any particular query, the code breaks in different queries every time, returning a SQLState error 08s01. These query's logic are fine, no logic errors etc. I checked the network logs and there were no database server connection refusals at the time of the error. Once the first error occurs, it keeps happening for no more than a minute or so at random times of the day, every few days. I've googled this thing and so far anyone that has had this issue was only on CF6 or 7, which the fixes coldFusion put out are only for CF6 or 7. Server configuration wise: The ColdFusion server is version 8 The database server is SQL Server 2005 Standard The database connections allowed setting is set to unlimited on both SQL Server and ColdFusion Any help would be greatly appreciated, Thanks!

    Read the article

  • In a digital photo, how can I detect if a mountain is obscured by clouds?

    - by Gavin Brock
    The problem I have a collection of digital photos of a mountain in Japan. However the mountain is often obscured by clouds or fog. What techniques can I use to detect that the mountain is visible in the image? I am currently using Perl with the Imager module, but open to alternatives. All the images are taken from the exact same position - these are some samples. My naïve solution I started by taking several horizontal pixel samples of the mountain cone and comparing the brightness values to other samples from the sky. This worked well for differentiating good image 1 and bad image 2. However in the autumn it snowed and the mountain became brighter than the sky, like image 3, and my simple brightness test started to fail. Image 4 is an example of an edge case. I would classify this as a good image since some of the mountain is clearly visible. UPDATE 1 Thank you for the suggestions - I am happy you all vastly over-estimated my competence. Based on the answers, I have started trying the ImageMagick edge-detect transform, which gives me a much simpler image to analyze. convert sample.jpg -edge 1 edge.jpg I assume I should use some kind of masking to get rid of the trees and most of the clouds. Once I have the masked image, what is the best way to compare the similarity to a 'good' image? I guess the "compare" command suited for this job? How do I get a numeric 'similarity' value from this?

    Read the article

  • In a digital photo, detecting if a mountain is obscured by clouds.

    - by Gavin Brock
    The problem I have a collection of digital photos of a mountain in Japan. However the mountain is often obscured by clouds or fog. What techniques can I use to detect that the mountain is visible in the image? I am currently using Perl with the Imager module, but open to alternatives. All the images are taken from the exact same position - these are some samples. My naïve solution I started by taking several horizontal pixel samples of the mountain cone and comparing the brightness values to other samples from the sky. This worked well for differentiating good image 1 and bad image 2. However in the autumn it snowed and the mountain became brighter than the sky, like image 3, and my simple brightness test started to fail. Image 4 is an example of an edge case. I would classify this as a good image since some of the mountain is clearly visible.

    Read the article

  • Scaled live iPhone Camera view in center, "CGAffineTransformTranslate" not working

    - by Gavin
    Hi, I have a little problem which I could not solve. I really hope someone can help me with that. I wanted to resize the live camera view and place it in the center, using the following code below: picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, 0.5, 0.56206); picker.cameraViewTransform = CGAffineTransformTranslate(picker.cameraViewTransform, 80, 120); But all I got was a scaled 1/2 sized view on the top left of the screen. It seems as though "CGAffineTransformTranslate" does nothing at all. The translation didn't work even when I used: picker.cameraViewTransform = CGAffineTransformMake(1, 0, 0, 1, 80, 120); The translation portion seems to have no effect on the live camera view. Hope someone can enlighten me. Thanks.

    Read the article

  • How do I do nested transactions in NHibernate?

    - by Gavin Schultz-Ohkubo
    Can I do nested transactions in NHibernate, and how do I implement them? I'm using SQL Server 2008, so support is definitely in the DBMS. I find that if I try something like this: using (var outerTX = UnitOfWork.Current.BeginTransaction()) { using (var nestedTX = UnitOfWork.Current.BeginTransaction()) { ... do stuff nestedTX.Commit(); } outerTX.Commit(); } then by the time it comes to outerTX.Commit() the transaction has become inactive, and results in a ObjectDisposedException on the session AdoTransaction. Are we therefore supposed to create nested NHibernate sessions instead? Or is there some other class we should use to wrap around the transactions (I've heard of TransactionScope, but I'm not sure what that is)? I'm now using Ayende's UnitOfWork implementation (thanks Sneal). Forgive any naivety in this question, I'm still new to NHibernate. Thanks! EDIT: I've discovered that you can use TransactionScope, such as: using (var transactionScope = new TransactionScope()) { using (var tx = UnitOfWork.Current.BeginTransaction()) { ... do stuff tx.Commit(); } using (var tx = UnitOfWork.Current.BeginTransaction()) { ... do stuff tx.Commit(); } transactionScope.Commit(); } However I'm not all that excited about this, as it locks us in to using SQL Server, and also I've found that if the database is remote then you have to worry about having MSDTC enabled... one more component to go wrong. Nested transactions are so useful and easy to do in SQL that I kind of assumed NHibernate would have some way of emulating the same...

    Read the article

  • Problem Writing Linq2Xml Query

    - by Gavin Draper
    I'm trying to write a Linq2XML query to query the following XML. I need it to pull back all photos for a given GalleryID. <Albums> <Album GalleryId="1" Cover="AlbumCover1.jpg" Title="Album 1"> <Photos> <Photo Title="Image1" URL="img1.jpg" DateAdded="01/01/2010 09:20"/> <Photo Title="Image2" URL="img2.jpg" DateAdded="01/01/2010 09:20"/> <Photo Title="Image3" URL="img3.jpg" DateAdded="01/01/2010 09:20"/> </Photos> </Album> <Album GalleryId="2" Cover="AlbumCover1.jpg" Title="Album 2"> <Photos> <Photo Title="Image1" URL="img1.jpg" DateAdded="01/01/2010 09:20"/> <Photo Title="Image2" URL="img2.jpg" DateAdded="01/01/2010 09:20"/> </Photos> </Album> </Albums> The best I've come up with is XDocument xmlDoc = XDocument.Load(GalleryFilePath); var x = from c in xmlDoc.Descendants("Album") where c.Attribute("GalleryId").Equals(GalleryId) orderby c.Attribute("Title").Value descending select new { Title = c.Element("Photo").Attribute("Title"), URL = c.Element("Photo").Attribute("URL"), DateAdded = c.Element("Photo").Attribute("DateAdded") }; This returns nothing, I'm guessing this is because I'm telling it to query the Album element then trying to loop through the photo elements. Any tips as to how this should be done? Thanks

    Read the article

  • Flash Player - green box with version number

    - by Gavin
    I'm trying to get a very simple Flash video working using SWFembed, and it does work across multiple computers at this point in multiple browsers, but as soon as I pushed it live I got this: http://cl.ly/1EDS I've adjusted file permissions, but it is exactly the same code and files as in another directory on the server. I've seen this a few times (green box with version number), but have not been able to find any reference to it online. Thanks for any suggestions in advance!

    Read the article

  • How to extend the Eclipse Java Editor to add coloured overlays

    - by Gavin Clarke
    I have an idea for an Eclipse plugin which I've been toying with. I need to be able to extend the Eclipse Java Editor component and add coloured overlays to the code based on pluggable external metrics. Unfortunately there doesn't appear to be any kind of syntax highlighting extension point. Does anyone know how I might be able to extend the exisitng eclipse Java Editor to add custom highlighting rules? Bear in mind I'm new to Eclipse plugin programming so please give as much detail as possible.

    Read the article

  • How can I print a web page on a server?

    - by Gavin Schultz
    Suppose I develop a web page using the cool Google visualization API, and it does everything the user wants. They can the parameters, look at the graphs, and print the page to get a reasonable-looking report. All good. Now suppose I want to do the same thing server-side. For example, say we need a set of report generated at a specific time of day, printed to a PDF and emailed to a manager. It's not a user-initiated action, so we don't have a user's browser or their printer. We have a URL that would render the report if we had a browser, and that's it. Is there a good way to do this server-side? Is this just foolish? Has anyone done anything like that before? Do any of the major browsers have APIs that might provide such functionality? Keep in mind too that it's not just static HTML; probably javascript will be running first to shift the DOM around. I know we could implement a whole different reporting engine on the server side to do this, but that will (a) generate reports that look a bit different, and (b) require me to build/maintain two sets of functionality. Instead, I'd be happy if I could just render the page / pages I want in an invisible server-side browser and print it to a PDF (let's mostly ignore that step - I know any number of PDF printer drivers that could do this). I don't really want to do it ugly either - i.e. by starting a browser process and then sending keystrokes directly to the window either - that's just bound to fall apart with a slight nudge. The only related question I found had an answer like that. Any advice appreciated!

    Read the article

  • Alternatives to CAT.NET for website security analysis

    - by Gavin Miller
    I'm looking for an alternative tool to CAT.NET for performing static security scans on .NET code. Currently the CAT.NET tooling/development is at a somewhat fragile stage and doesn't offer the reliability that I'm looking for. Are there any alternative static code analyzers that you use for detecting security issues?

    Read the article

  • Setting ModerationInformation.Status from Approved back to pending removes

    - by Gavin Morgan
    Seeing if anyone else has had this problem and a resolution to it. I have a visual studio sequential workflow on a list (not a library) which does NOT use tasks, the approval process is done through the Approve/Reject OOTB buttons on the list item. The approval is a 2 stage approval, whereby if the 1st stage is completed (via clicking the Approve OOTB button), i reset the ModerationInformation.Status from Approved back to pending then send an email to the 2nd stage approver. My problem is, when i set the the ModerationInformation.Status back to Pending from Approved so there is never an approved version, the Creator loses permissions to view the item, and i get the "cannot find item" error from SharePoint for the person who created the item. The 1st and 2nd level approvers and anyone with approve rights CAN still see the item. Some more background information. the code i am using to update the moderationinformation is I get the properties from the workflow event and get a hook into the listitem properties.Item.ModerationInformation.Status = SPModerationStatusType.Pending; properties.Item.Update(); can anyone help.

    Read the article

  • How do I get the window id and tab number of a Terminal window using AppleScript via the ScriptingBr

    - by Gavin Brock
    I can open a Terminal tab using the following AppleScript: tell application "Terminal" set myTab to do script "exec sleep 1" get myTab end tell This returns a string like: tab 1 of window id 3263 of application "Terminal". This is great, I can see the window id 3263 and tab number 1 (although I don't know how to query myTab to get only these values). In the Cocoa ScriptingBridge, I can do: SBApplication *terminal; SBObject *tab; terminal = [SBApplication applicationWithBundleIdentifier:@"com.apple.terminal"] tab = [terminal doScript:@"exec sleep 1" in:nil] How do I get the window id and tab number from the tab object?

    Read the article

  • Internationalization of static pages with Rails

    - by Gavin
    I feel like I'm missing something really simple and I keep spinning my wheels on this problem. I currently have internationalization working throughout my app. The translations work and the routes work perfectly. At least, most of the site works with the exception of the routes to my two static pages, my "About" and "FAQ" pages. Every other link throughout the app points to the proper localized route. For example if I select "french" as my language, links point to the appropriate "(/:locale)/controller(.:format)." However, despite the changes I make throughout the app my links for the "About" and "FAQ" refuse to point to "../fr/static/about" and always point to "/static/about." To make matters stranger, when I run rake routes I see: "GET (/:locale)/static/:permalink(.:format) pages#show {:locale=/en|fr/}" and when I manually type in "../fr/static/about" the page translates perfectly. My Routes file: devise_for :users scope "(:locale)", :locale => /en|fr/ do get 'static/:permalink', :controller => 'pages', :action => 'show' resources :places, only: [:index, :show, :destroy] resources :homes, only: [:index, :show] match '/:locale' => 'places#index' get '/'=>'places#index',:as=>"root" end My ApplicationController: before_filter :set_locale def set_locale I18n.locale=params[:locale]||I18n.default_locale end def default_url_options(options={}) logger.debug "default_url_options is passed options: #{options.inspect}\n" { :locale => I18n.locale } end and My Pages Controller: class PagesController < ApplicationController before_filter :validate_page PAGES = ['about_us', 'faq'] def show render params[:permalink] end def validate_page redirect_to :status => 404 unless PAGES.include?(params[:permalink]) end end I'd be very grateful for any help ... it's just been one of those days. Edit: Thanks to Terry for jogging me to include views. <div class="container-fluid nav-collapse"> <ul class="nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= t(:'navbar.about') %><b class="caret"></b></a> <ul class="dropdown-menu"> <li><%=link_to t(:'navbar.about_us'), "/static/about_us"%></li> <li><%=link_to t(:'navbar.faq'), "/static/faq"%></li> <li><%=link_to t(:'navbar.blog'), '#' %></li> </ul> </li>

    Read the article

  • How to make GhostScript PS2PDF stop subsetting fonts

    - by gavin-softyolk
    I am using the ps2pdf14 utility that ships with GhostScript, and I am having a problem with fonts. It does not seem to matter what instructions I pass to the command, it insists on subsetting any fonts it finds in the source document. e.g -dPDFSETTINGS#/prepress -dEmbedAllFonts#true -dSubsetFonts#false -dMaxSubsetPct#0 Note that the # is because the command is running on windows, it is the same as =. If anyone has any idea how to tell ps2pdf not to subset fonts, I would be very greatful. Thanks --------------------------Notes ------------------------------------------ The source file is a pdf containing embedded fonts, so it is the fonts already embedded in the source file, that I need to prevent being subset in the destination file. Currently all source file embedded fonts are subset, in some cases this is not apparent from the font name, i.e it contains no hash, and appears at first glance to be the full font, however the widths array has been subset in all cases.

    Read the article

  • Staging server .htaccess for images, css and js

    - by Gavin Hall
    As we build and demo sites on our staging server with individual root folders for each such as /CLIENTNAME, we need to keep all the css, js and internal links for these sites referencing the server root. The following works for one folder each, but not sure how to adapt to work for all folders. Currently AddHandler php5-script .php RewriteEngine On RewriteRule ^(images|css|js)\/(.*) /ONEFOLDER/$1/$2 Would like AddHandler php5-script .php RewriteEngine On RewriteRule ^(images|css|js)\/(.*) /EVERYFOLDER/$1/$2 Many thanks in advance.

    Read the article

  • Efficiently compute the row sums of a 3d array in R

    - by Gavin Simpson
    Consider the array a: > a <- array(c(1:9, 1:9), c(3,3,2)) > a , , 1 [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 , , 2 [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 How do we efficiently compute the row sums of the matrices indexed by the third dimension, such that the result is: [,1] [,2] [1,] 12 12 [2,] 15 15 [3,] 18 18 ?? The column sums are easy via the 'dims' argument of colSums(): > colSums(a, dims = 1) but I cannot find a way to use rowSums() on the array to achieve the desired result, as it has a different interpretation of 'dims' to that of colSums(). It is simple to compute the desired row sums using: > apply(a, 3, rowSums) [,1] [,2] [1,] 12 12 [2,] 15 15 [3,] 18 18 but that is just hiding the loop. Are there other efficient, truly vectorised, ways of computing the required row sums?

    Read the article

  • How much time do PHP/Python/Ruby *programmers* spend on CSS?

    - by gavin
    Not sure about you guys, but I detest working in CSS. Not that it is a bad language/markup, don't get me wrong. I just hate spending hours figuring out how to get 5 pixels to show on every browser, and getting fonts to look like a PSD counterpart. So a question (or two) for programmers out there. How much time (%) do you spend on web markup? Do you tend to do this type of tweaking, or do your designers?

    Read the article

  • EF4 POCO Not Updating Navigation Property On Save

    - by Gavin Draper
    I'm using EF4 with POCO objects the 2 tables are as follows Service ServiceID, Name, StatusID Status StatusID, Name The POCO objects look like this Service ServiceID, Status, Name Status StatusID, Name With Status on the Service object being a Navigation Property and of type Status. In my Service Repository I have a save method that takes a service objects attaches it to the context and calls save. This works fine for the service, but if the status for that service has been changed it does not get updated. My Save method looks like this public static void SaveService(Service service) { using (var ctx = Context.CreateContext()) { ctx.AttachModify("Services", service); ctx.AttachTo("Statuses",service.Status); ctx.SaveChanges(); } } The AttachModify method attaches an object to the context and sets it to modified it looks like this public void AttachModify(string entitySetName, object entity) { if (entity != null) { AttachTo(entitySetName, entity); SetModified(entity); } } public void SetModified(object entity) { ObjectStateManager.ChangeObjectState(entity, EntityState.Modified); } If I look at a SQL profile its not even including the navigation property in the update for the service table, it never touches the StatusID. Its driving me crazy. Any idea what I need to do to force the Navigation Property to update?

    Read the article

  • Default Values Specflow Step Definitions

    - by Gavin Osborn
    I'm starting out in the world of SpecFlow and I have come across my first problem. In terms of keeping my code DRY I'd like to do the following: Have two scenarios: Given I am on a product page And myfield equals todays date Then... Given I am on a product page And myfield equals todays date plus 4 days Then... I was hoping to use the following Step Definition to cover both variants of my And clause: [Given(@"myfield equals todays date(?: (plus|minus) (\d+) days)?")] public void MyfieldEqualsTodaysDate(string direction, int? days) { //do stuff } However I keep getting exceptions when SpecFlow tries to parse the int? param. I've checked the regular expression and it definitely parses the scenario as expected. I'm aware that I could so something as crude as method overloading etc, I was just wondering if SpecFlow supported the idea of default parameter values, or indeed another way to achieve the same effect. Many Thanks

    Read the article

  • Why does my Google maps api v3 and side panel not fill my page upon resizing?

    - by Gavin
    I'm developing a web page and I have a side panel on the left with a search bar and a Google maps api v3 filling the rest of the page to the right. When I make the browser very small vertically, there is a white space between the side panel and the map, and the bottom of the browser. However, the text continues to the bottom of the browser. It looks like: Here's my css code: <style type="text/css"> body {margin:0;} #panel {height:100%; width:300px; position:absolute; padding:0;background-color:#8C95A0;} #header {padding:2px; text-align:center} #address_instruction {position:relative; top:7%; padding:2px; text-align:center} #geocoder {position:relative; top:8%; padding:2px; text-align:center} #toggle_instruction {position:relative; top:22%; padding:2px; text-align:center} #layers {position:relative; top:25%; padding:2px; text-align:center} #layer0 {padding:2px; text-align:center} #layer1 {padding:2px; text-align:center} #layer2 {padding:2px; text-align:center} #link {top:50%; position:relative; padding:2px; text-align:center} #map_canvas {height:100%; left:300px; right:0px; position:absolute; padding:0;} </style> The IDs within #panel refer to the items on the left hand side in the panel. Why don't the side panel background color and map extend to the bottom of the browser?

    Read the article

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