Search Results

Search found 208 results on 9 pages for 'gavin simpson'.

Page 6/9 | < Previous Page | 2 3 4 5 6 7 8 9  | Next Page >

  • 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

  • How to extract the last name from [email protected] using Oracle?

    - by Simpson
    Hello - I know this can't be too difficult, but I've tried everything I can think of and cannot get it to work. I need to compare the value of a column (LASTNAME) with a system variable (:VARIABLE), but the variable is an email address, so I need to trim off the "@email.com" and "firstname." Some things I've tried: select * from TABLENAME where LASTNAME LIKE :VARIABLE select * from TABLENAME where LASTNAME IN :VARIABLE I've been able to trim off the @email.com, can't figure out how to trim off FIRSTNAME. at the same time. Thanks!

    Read the article

  • Page loading effect with jquery

    - by Andy Simpson
    Hello all, Is there a way to use jquery (or other method) to display a loading div while page loads? I have a table that is populated using PHP/MySQL and can contain several thousand rows. This is then sorted using the tablesorter plugin for jquery. Everything works fine, however the page can sometimes take 4-5 seconds to fully load and it would be nice to display a 'loading...' message within a div which automatically disappears when whole table is loaded. I have heard of loadmask plugin for jquery - would this be suitable for my needs and if not any alternative? No AJAX calls are being made while loading this table if thats relevant. Thanks in advance Andy

    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

  • Does the order of columns in a query matter?

    - by James Simpson
    When selecting columns from a MySQL table, is performance affected by the order that you select the columns as compared to their order in the table (not considering indexes that may cover the columns)? For example, you have a table with rows uid, name, bday, and you have the following query. SELECT uid, name, bday FROM table Does MySQL see the following query any differently and thus cause any sort of performance hit? SELECT uid, bday, name FROM table

    Read the article

  • Map entries become vectors when piped thru a macro

    - by Gavin Grover
    In Clojure, a map entry created within a macro is preserved... (class (eval `(new clojure.lang.MapEntry :a 7))) ;=> clojure.lang.MapEntry ...but when piped thru from the outside context collapses to a vector... (class (eval `~(new clojure.lang.MapEntry :a 7))) ;=> clojure.lang.PersistentVector This behavior is defined inside LispReader.syntaxQuote(Object form) condition if(form instanceof IPersistentCollection). Does anyone know if this is intended behavior or something that will be fixed?

    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

  • Get more error information from unhandled error

    - by Andrew Simpson
    I am using C# in a desktop application. I am calling a DLL written in C that I do not have the source code for. Whenever I call this DLL I get an untrapped error which I trap in an UnhandledException event/delegate. The error is : object reference not set to an instance of an object But the stack trace is empty. When I Googled this the info back was that the error was being hanlded eleswhere and then rethrown. But this can only be in the DLL I do not have the source code for. So, is there anyway I can get more info about this error? This is my code... in program.cs... AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { Exception _ex = (Exception)e.ExceptionObject; //the stact trace property is empty here.. } finally { Application.Exit(); } } My DLL... [DllImport("AutoSearchDevice.dll", EntryPoint = "Start", ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern int Start(int ASD_HANDLE); An I call it like so: public static void AutoSearchStart() { try { Start(m_pASD); } catch (Exception ex) { } }

    Read the article

  • How to handle dynamic site localizations?

    - by James Simpson
    I've got a website that is currently all in english. It is an online game, so it has a bunch of different pages with static text, as well as a lot of content in a database. I am trying to expand more globally and am gearing up to release some localizations of the site. However, I'm not sure about the best way to go about setting this up so that it'll be the easiest for me to manage and the easiest for users to use as well. Should I be storing the translated texts in a database, or should this be done in a completely different way? If it matters at all, the site is written in PHP and uses MySQL.

    Read the article

  • Validation and Firefox's input caching

    - by Chris Simpson
    When you refresh/reload a page or use the back button, Firefox is kind enough to repopulate your inputs with what was entered before you navigated away. Though this is a nice feature it does not trigger my jquery validation and the unsaved changes warning I add to my pages. Is there a way to either disable this feature in Firefox (without renaming every control every time) or capture the firefox events?

    Read the article

  • Right align text in an image with imagettftext(), PHP

    - by James Simpson
    I am setting up dynamic forum signature images for my users and I want to be able to put their username on the image. I am able to do this just fine, but since usernames are different lengths and I want to right align the username, how can I go about doing this when I have to set x & y coordinates. $im = imagecreatefromjpeg("/path/to/base/image.jpg"); $text = "Username"; $font = "Font.ttf"; $black = imagecolorallocate($im, 0, 0, 0); imagettftext($im, 10, 0, 217, 15, $black, $font, $text); imagejpeg($im, null, 90);

    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

  • Using C# to parse a SOAP Response

    - by Gavin
    I am trying to get the values for faultcode, faultstring, and OrderNumber from the SOAP below <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body> <faultcode>1234</faultcode> <faultstring>SaveOrder:SetrsOrderMain:Cannot change OrderDate if GLPeriod is closed, new OrderDate is 3/2/2010:Ln:1053</faultstring> <detail> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body UserGUID="test"> <m:SaveOrder xmlns:m="http://www.test.com/software/schema/" UserGUID="test"> <Order OrderNumber="1234-1234-123" Caller="" OrderStatus="A" xmlns="http://www.test.com/software/schema/"> Here is my code in C# XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("XMLexample.xml")); var errorDetail = new EcourierErrorDetail { FaultCode = from fc in doc.Descendants("faultcode") select fc.Value, FaultString = from fs in c.Descendants("faultstring") select fs.Value, OrderNumber = from o in doc.Descendants("detail").Elements("Order").Attributes("OrderNumber") select o.Value }; return errorDetail; I am able to get the values for both faultcode and faultstring but not the OrderNumber. I am getting "Enumeration yielded no results." Can anyone help? Thanks.

    Read the article

  • Java: PriorityQueue returning incorrect ordering from custom comparator??

    - by Michael Simpson
    I've written a custom comparator to compare my node classes, but the java priority queue is not returning my items in the correct order. Here is my comparator: public int compare(Node n1, Node n2){ if (n1.getF() > n2.getF()){ return +1; } else if (n1.getF() < n2.getF()){ return -1; } else { // equal return 0; } } Where getF returns a double. However after inserting several Nodes into the priority queue, I print them out using: while(open.size() > 0) { Node t = (Node)(open.remove()); System.out.println(t.getF()); } Which results in: 6.830951894845301 6.830951894845301 6.0 6.0 5.242640687119285 7.4031242374328485 7.4031242374328485 8.071067811865476 Any ideas why this is so? Is my comparator wrong? Thanks. Mike

    Read the article

  • Vim, how to scroll to bottom of a named buffer

    - by Gavin Black
    I have a vim-script which splits output to a new window, using the following command: below split +view foo I've been trying to find a way from an arbitrary buffer to scroll to the bottom of foo, or a setting to keep it defaulted to showing the bottom lines of the buffer. I'm doing most of this inside of a python block of vim script. So I have something like: python << endpython import vim import time import thread import sys def myfunction(string,sleeptime,*args): outpWindow = vim.current.window while 1: outpWindow.buffer.append("BAR") #vim.command("SCROLL TO BOTTOM OF foo") time.sleep(sleeptime) #sleep for a specified amount of time. vim.command('below split +view foo') thread.start_new_thread(myfunction,("Thread No:1",2)) endpython And need to find something to put in for vim.command("SCROLL TO BOTTOM of foo") line

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9  | Next Page >