Search Results

Search found 29 results on 2 pages for 'egarcia'.

Page 1/2 | 1 2  | Next Page >

  • ubuntu 8.04lts + rdiff-backup: Should I install from source instead of using apt repositories?

    - by egarcia
    I'm trying to use rdiff-backup in order to make backup copies of some folders inside an Ubuntu 8.04LTS server. I'm attempting to do the backup on another server with a more modern Ubuntu distro (9.10). I'll call this one the "client". rdiff-backup needs to be installed on both the client and the server. It is available on the apt repositories on both machines, so I installed it using sudo apt-get install rdiff-backup. The problem is that the version installed on the server is older than the one on the client (1.1.15 vs 1.2.8). Thus I get errors when I try do make them work together. So I need both versions to be the same. What is the standard procedure in these cases? Should I attempt to upgrade the version on the server, or downgrade the version on the client? And how whould I do that? In case it is useful, I'd like to point out that the rdiff-backup apt-package has some dependencies - librsync1 & python-support Attaching the errors I got in case they help: rdiff-backup egarcia@test::/var/rails/ohwr/backup /home/kikito/backup/files Warning: Local version 1.2.8 does not match remote version 1.1.15. Exception ' Warning Security Violation! Bad request for function: rpath.make_file_dict with arguments: ['/var/rails/ohwr/backup'] ' raised of class '<class 'rdiff_backup.Security.Violation'>': File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 304, in error_check_Main try: Main(arglist) File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 321, in Main rps = map(SetConnections.cmdpair2rp, cmdpairs) File "/usr/lib/pymodules/python2.6/rdiff_backup/SetConnections.py", line 78, in cmdpair2rp return rpath.RPath(conn, filename).normalize() File "/usr/lib/pymodules/python2.6/rdiff_backup/rpath.py", line 884, in __init__ else: self.setdata() File "/usr/lib/pymodules/python2.6/rdiff_backup/rpath.py", line 908, in setdata self.data = self.conn.rpath.make_file_dict(self.path) File "/usr/lib/pymodules/python2.6/rdiff_backup/connection.py", line 450, in __call__ return apply(self.connection.reval, (self.name,) + args) File "/usr/lib/pymodules/python2.6/rdiff_backup/connection.py", line 370, in reval if isinstance(result, Exception): raise result Traceback (most recent call last): File "/usr/bin/rdiff-backup", line 30, in <module> rdiff_backup.Main.error_check_Main(sys.argv[1:]) File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 304, in error_check_Main try: Main(arglist) File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 321, in Main rps = map(SetConnections.cmdpair2rp, cmdpairs) File "/usr/lib/pymodules/python2.6/rdiff_backup/SetConnections.py", line 78, in cmdpair2rp return rpath.RPath(conn, filename).normalize() File "/usr/lib/pymodules/python2.6/rdiff_backup/rpath.py", line 884, in __init__ else: self.setdata() File "/usr/lib/pymodules/python2.6/rdiff_backup/rpath.py", line 908, in setdata self.data = self.conn.rpath.make_file_dict(self.path) File "/usr/lib/pymodules/python2.6/rdiff_backup/connection.py", line 450, in __call__ return apply(self.connection.reval, (self.name,) + args) File "/usr/lib/pymodules/python2.6/rdiff_backup/connection.py", line 370, in reval if isinstance(result, Exception): raise result rdiff_backup.Security.Violation: Warning Security Violation! Bad request for function: rpath.make_file_dict with arguments: ['/var/rails/ohwr/backup']

    Read the article

  • "io: postinst-must-call-ldconfig" when creating a package

    - by egarcia
    I'm trying to create an ubuntu .deb package for the (pretty awesome) Io Language. I am not the developer of that language, so I'm not familiar with its sourcecode yet. This is my first attempt at creating a .deb file. In order to create the .deb, I'm following these instructions: http://www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html So far I've been able to create a .deb file (io_2010.06.01-1_amd64.deb) and a changes file (io_201.06.01-1_amd64.changes). I'm using lintian to check the changes file, and it reports an issue I don't know how to resolve: $ lintian -Ivi io_2010.06.01-1_amd64.changes ... (lots of messages) I: io: no-symbols-control-file usr/lib/libiovmall.so I: io: no-symbols-control-file usr/lib/libgarbagecollector.so I: io: no-symbols-control-file usr/lib/libbasekit.so E: io: postinst-must-call-ldconfig usr/lib/libiovmall.so N: N: The package installs shared libraries in a directory controlled by the N: dynamic library loader. Therefore, the package must call "ldconfig" in N: its postinst script. N: N: Refer to Debian Policy Manual section 8.1.1 (ldconfig) for details. N: N: Severity: serious, Certainty: certain N: N: Removing /tmp/OYuNShEHYz ... I've read the debian manual 8.8 section. I think I understand what the problem is (I need to make sure that ldconfig is invoked "somewhere", possibly on a place called "posinst") but I don't know how to resolve it (i.e. where this "posinsts" file is and how should I change it). The current way of installing Io in Ubuntu is basically running sudo make install and then sudo ldconfig. Maybe the makefile should be modified so ldconfig is called from it? I don't know. Thanks a lot.

    Read the article

  • ubuntu - Best way of repartitioning a (running) production server

    - by egarcia
    I've got an (externally hosted) production server running Ubuntu LTS. It serves webpages (rails) and has an svn repository accesible through Apache, and a PostgreSQL db. I've got ssh access to the server and root privileges. Most of the "interesting" stuff is located in /var/ : svn repositories are inside /var/svn, web pages under /var/www, etc. Yesterday I was curious about how much disk space had it left, so I did the following: $ df -h Filesystem Size Used Avail Use% Mounted on /dev/md1 950M 402M 500M 45% / varrun 990M 64K 990M 1% /var/run varlock 990M 0 990M 0% /var/lock udev 990M 76K 989M 1% /dev devshm 990M 0 990M 0% /dev/shm /dev/md5 4.7G 668M 4.1G 15% /usr /dev/md6 4.7G 1.4G 3.4G 29% /var /dev/md7 221G 28M 221G 1% /home none 990M 4.0K 990M 1% /tmp My 'var' partition, which holds most of the interesting part, is only 4.7G big. The /home/ partition, on the other hand, is 221G, but it is mostly unused. I should have checked the disk layout before starting installing stuff. Ideally I would need /var/ and /home/ to be "switched" - /home/ should be the one with 4.7G, and /var/ the one with 221G. Is there a way to solve this without having to reinstall the whole thing?

    Read the article

  • 2d trajectory planning of a spaceship with physics.

    - by egarcia
    I'm implementing a 2D game with ships in space. In order to do it, I'm using LÖVE, which wraps Box2D with Lua. But I believe that my question can be answered by anyone with a greater understanding of physics than myself - so pseudo code is accepted as a response. My problem is that I don't know how to move my spaceships properly on a 2D physics-enabled world. More concretely: A ship of mass m is located at an initial position {x, y}. It has an initial velocity vector of {vx, vy} (can be {0,0}). The objective is a point in {xo,yo}. The ship has to reach the objective having a velocity of {vxo, vyo} (or near it), following the shortest trajectory. There's a function called update(dt) that is called frequently (i.e. 30 times per second). On this function, the ship can modify its position and trajectory, by applying "impulses" to itself. The magnitude of the impulses is binary: you can either apply it in a given direction, or not to apply it at all). In code, it looks like this: def Ship:update(dt) m = self:getMass() x,y = self:getPosition() vx,vy = self.getLinearVelocity() xo,yo = self:getTargetPosition() vxo,vyo = self:getTargetVelocity() thrust = self:getThrust() if(???) angle = ??? self:applyImpulse(math.sin(angle)*thrust, math.cos(angle)*thrust)) end end The first ??? is there to indicate that in some occasions (I guess) it would be better to "not to impulse" and leave the ship "drift". The second ??? part consists on how to calculate the impulse angle on a given dt. We are in space, so we can ignore things like air friction. Although it would be very nice, I'm not looking for someone to code this for me; I put the code there so my problem is clearly understood. What I need is an strategy - a way of attacking this. I know some basic physics, but I'm no expert. For example, does this problem have a name? That sort of thing. Thanks a lot.

    Read the article

  • Mongomapper - bootstrapping techniques

    - by egarcia
    I've just begun creating a rails application using mongomapper for my models. I'm wondering what solution should I use for bootstrapping my app with it. All my previous experience is with ActiveRecord & PostgreSQL, in which I have used several gems for bootstrapping. The one I liked the most was bootstrapper (+ factorygirl + faker). Does anyone know whether these work ok with mongomapper? Can anyone suggest better alternatives? Is there anything obvious I need to know when bootstrapping mongodb?

    Read the article

  • rails i18n - translating text with links inside.

    - by egarcia
    Hi there! I'd like to i18n a text that looks like this: Already signed up? Log in! Note that there is a link on the text. On this example it points to google - in reality it will point to my app's log_in_path. I've found two ways of doing this, but none of them looks "right". The first way I know involves having this my en.yml: log_in_message: "Already signed up? <a href='{{url}}'>Log in!</a>" And in my view: <p> <%= t('log_in_message', :url => login_path) %> </p> This works, but having the <a href=...</a> part on the en.yml doesn't look very clean to me. The other option I know is using localized views - login.en.html.erb, and login.es.html.erb. This also doesn't feel right since the only different line would be the aforementioned one; the rest of the view (~30 lines) would be repeated for all views. It would not be very DRY. I guess I could use "localized partials" but that seems too cumberstone; I think I prefer the first option to having so many tiny view files. So my question is: is there a "proper" way to implement this?

    Read the article

  • HTML - Correct way of coding a checkbox with a Label.

    - by egarcia
    I've been using formtastic in order to generate HTML forms on rails applications. My question, however, is really HTML-related. Today I found a strange behaviour on the way formtastic generates checkboxes (fields of type :boolean on formtastic lingo). The rest of the fields (non-checkboxes) are generated this way: <li> <label for="my_textbox_field">My TextBox</label> <input id="my_textbox_field" type="text" ... > </li> Checkboxes, however, are enclosed inside their <label> tags completely - like this: <li> <label for="my_boolean_field"> <input id="my_boolean_field" type="checkbox" ... > This is my boolean field </label> </li> Formtastic phylosophy seems to be based on the Learning to Love Forms presentation. In effect, on slide 36 of that presentation this structure is suggested for checkboxes. I guess in the presentation itself the presenter explained why this was done, but it is not written on the slides. Can anyone tell me why enclosing checkboxes inside their <label> tag might be a good idea, as opposed to putting them outside, like with textboxes?

    Read the article

  • rails + compass: advantages vs using haml + blueprint directly

    - by egarcia
    I've got some experience using haml (+sass) on rails projects. I recently started using them with blueprintcss - the only thing I did was transform blueprint.css into a sass file, and started coding from there. I even have a rails generator that includes all this by default. It seems that Compass does what I do, and other things. I'm trying to understand what those other things are - but the documentation/tutorials weren't very clear. These are my conclusions: Compass comes with built-in sass mixins that implement common CSS idioms, such as links with icons or horizontal lists. My solution doesn't provide anything like that. (1 point for Compass). Compass has several command-line options: you can create a rails project, but you can also "install" it on an existing rails project. A rails generator could be personalized to do the same thing, I guess. (Tie). Compass has two modes of working with blueprint: "basic" and "semantic" usage. I'm not clear about the differences between those. With my rails generator I only have one mode, but it seems enough. (Tie) Apparently, Compass is prepared to use other frameworks, besides blueprint (e.g. YUI). I could not find much documentation about this, and I'm not interested on it anyway - blueprint is ok for me (Tie). Compass' learning curve seems a bit stiff and the documentation seems sparse. Learning could be a bit difficult. On the other hand, I know the ins and outs of my own system and can use it right away. (1 point for my system). With this analysis, I'm hesitant to give Compass a try. Is my analysis correct? Are Am I missing any key points, or have I evaluated any of these points wrongly?

    Read the article

  • vlad the deployer: why do I need a scm folder?

    - by egarcia
    I'm learning to use vlad the deployer and I've got a question. Since I'm still learning I don't know what is pertinent to the question and what isn't, so please bear with me if I'm a little verbose. I've got 2 environments for a new application (test and production) besides my development machine. I've figured out this way to do the initial setup in my vlad.rake: namespace :test task :set set :domain, 'test.myserver.com' end end namespace :production task :set set :domain, 'www.myserver.com' end end This way I can have environment-specific stuff inside the namespaces, and still have shared tasks. For example, this would be the initial setup for test: rake vlad:test:set vlad:setup vlad:update This creates the following folders on my test server: releases/ scm/ shared/ current -> symlink to last release (inside the releases folder) My question is: what's the point of the scm folder? Every time I do vlad:update, the following happens: svn checkout on the scm/ folder above svn export on the /releases/{date} folder update current symlink So scm is a copy of my repository... but then there's an "export" copy of the repository on /releases/{date}. And that is the one used by the application... scm doesn't seem to be used by anyone? Wouldn't I be just fine without the scm folder?

    Read the article

  • Svn - get the list of all repos on a server so I can svnsync

    - by egarcia
    I'm attempting to create a backup of my client's existing svn repositories, which is publicly available over http. If possible, I'd like to be able to make new repositories automatically, from any computer, without having to give console access to the server to external parties (i.e. the users could do a ls on my svn repo dir) My problem is that I need to know the list of svn repositories on the server - it isn't a fixed list, since the user will add new repositories over time. I'm able to list the repositories on an html page via Apache's mod_dav_svn module, using the SVNListParentPath On directive. I got this page: http://svn.ohwr.org/ My question is: what is the easiest way to obtain a usable list of such repositories? I'll need to parse that list in order to make syncs, probably using shell commands. Must I parse the HTML with shell commands, or is there a better way to get that list?

    Read the article

  • Liquid templates - accessing members by name

    - by egarcia
    I'm using Jekyll to create a new blog. It uses Liquid underneath. Jekyll defines certain "variables": site, content, page, post and paginator. These "variables" have several "members". For instance, post.date will return the date of a post, while post.url will return its url. My question is: can I access a variable's member using another variable as the member name? See the following example: {% if my_condition %} {% assign name = 'date' %} {% else %} {% assign name = 'url' %} {% endif %} I have a variable called name which is either 'date' or 'url'. How can I make the liquid equivalent of post[name] in ruby? The only way I've found is using a for loop to iterate over all the pairs (key-value) of post. Beware! It is quite horrible: {% for property in post %} {% if property[0] == name %} {{ property[1] }} {% endif %} {% endfor %} Argh! I hope there is a better way. Thanks.

    Read the article

  • physics game programming box2d - orientating a turret-like object using torques

    - by egarcia
    This is a problem I hit when trying to implement a game using the LÖVE engine, which covers box2d with Lua scripting. The objective is simple: A turret-like object (seen from the top, on a 2D environment) needs to orientate itself so it points to a target. The turret is on the x,y coordinates, and the target is on tx, ty. We can consider that x,y are fixed, but tx, ty tend to vary from one instant to the other (i.e. they would be the mouse cursor). The turret has a rotor that can apply a rotational force (torque) on any given moment, clockwise or counter-clockwise. The magnitude of that force has an upper limit called maxTorque. The turret also has certain rotational inertia, which acts for angular movement the same way mass acts for linear movement. There's no friction of any kind, so the turret will keep spinning if it has an angular velocity. The turret has a small AI function that re-evaluates its orientation to verify that it points to the right direction, and activates the rotator. This happens every dt (~60 times per second). It looks like this right now: function Turret:update(dt) local x,y = self:getPositon() local tx,ty = self:getTarget() local maxTorque = self:getMaxTorque() -- max force of the turret rotor local inertia = self:getInertia() -- the rotational inertia local w = self:getAngularVelocity() -- current angular velocity of the turret local angle = self:getAngle() -- the angle the turret is facing currently -- the angle of the like that links the turret center with the target local targetAngle = math.atan2(oy-y,ox-x) local differenceAngle = _normalizeAngle(targetAngle - angle) if(differenceAngle <= math.pi) then -- counter-clockwise is the shortest path self:applyTorque(maxTorque) else -- clockwise is the shortest path self:applyTorque(-maxTorque) end end ... it fails. Let me explain with two illustrative situations: The turret "oscillates" around the targetAngle. If the target is "right behind the turret, just a little clock-wise", the turret will start applying clockwise torques, and keep applying them until the instant in which it surpasses the target angle. At that moment it will start applying torques on the opposite direction. But it will have gained a significant angular velocity, so it will keep going clockwise for some time... until the target will be "just behind, but a bit counter-clockwise". And it will start again. So the turret will oscillate or even go in round circles. I think that my turret should start applying torques in the "opposite direction of the shortest path" before it reaches the target angle (like a car braking before stopping). Intuitively, I think the turret should "start applying torques on the opposite direction of the shortest path when it is about half-way to the target objective". My intuition tells me that it has something to do with the angular velocity. And then there's the fact that the target is mobile - I don't know if I should take that into account somehow or just ignore it. How do I calculate when the turret must "start braking"?

    Read the article

  • rails i18n - translating text with inside.

    - by egarcia
    Hi there! I'd like to i18n a text that looks like this: Already signed up? Log in! Note that there is a link on the text. On this example it points to google - in reality it will point to my app's log_in_path. I've found two ways of doing this, but none of them looks "right". The first way I know involves having this my en.yml: log_in_message: "Already signed up? <a href='{{url}}'>Log in!</a>" And in my view: <p> <%= t('log_in_message', :url => login_path) %> </p> This works, but having the <a href=...</a> part on the en.yml doesn't look very clean to me. The other option I know is using localized views - login.en.html.erb, and login.es.html.erb. This also doesn't feel right since the only different line would be the aforementioned one; the rest of the view (~30 lines) would be repeated for all views. It would not be very DRY. I guess I could use "localized partials" but that seems too cumberstone; I think I prefer the first option to having so many tiny view files. So my question is: is there a "proper" way to implement this?

    Read the article

  • What should I call the operation that limit a string's length?

    - by egarcia
    This is a language-agnostic question - unless you count English as a language. I've got this list of items which can have very long names. For aesthetic purposes, these names must be made shorter in some cases, adding dots (...) to indicate that the name is longer. So for example, if article.name returns this: lorem ipsum dolor sit amet I'd like to get this other output. lorem ipsum dolor ... I can program this quite easily. My question is: how should I call that shortening operation? I mean the name, not the implementation. Is there a standard English name for it?

    Read the article

  • Rails - handling global site settings

    - by egarcia
    I'm developing a new rails application which is supposed to be installed several times in order to implement several sites. There are some things, like the "Site Title" or the "Default Number of Items per Page" that clearly belong to a "global settings" table / config file. I've made a list of the things I think I'll need: ActiveRecord model that is capable of: Storing different kinds of data. I suppose this would be accomplished encoding the values on a string on the db, probably with a "type" field. Indexing settings by name Validations based on a "type" attribute (i.e. don't accept invalid dates on "date" settings) Validations based on a allows_nil property. A controller that allows me to change settings via views. I'm pretty sure I could implement this myself, but I'm not willing to reinvent the wheel. I've done some searching, but I could only find rails-settings, which doesn't really serve me: I need a proper model & controller so I can use declarative-authorization, and it does not provide any controller or view facilities. Is there a gem or plugin out there that implements what I want, or any library I should look at? Thanks a lot.

    Read the article

  • phppgadmin : How does it kick users out of postgres, so it can db_drop?

    - by egarcia
    I've got one Posgresql database (I'm the owner) and I'd like to drop it and re-create it from a dump. Problem is, there're a couple applications (two websites, rails and perl) that access the db regularly. So I get a "database is being accessed by other users" error. I've read that one possibility is getting the pids of the processes involved and killing them individually. I'd like to do something cleaner, if possible. Phppgadmin seems to do what I want: I am able to drop schemas using its web interface, even when the websites are on, without getting errors. So I'm investigating how its code works. However, I'm no PHP expert. I'm trying to understand the phppgadmin code in order to see how it does it. I found out a line (257 in Schemas.php) where it says: $data->dropSchema(...) $data is a global variable and I could not find where it is defined. Any pointers would be greatly appreciated.

    Read the article

  • Mongomapper - unit testing with shoulda on rails 2.3.5

    - by egarcia
    I'm trying to implement shoulda unit tests on a rails 2.3.5 app using mongomapper. So far I've: Configured a rails app that uses mongomapper (the app works) Added shoulda to my gems, and installed it with rake gems:install Added config.frameworks -= [ :active_record, :active_resource ] to config/environment.rb so ActiveRecord isn't used. My models look like this: class Account include MongoMapper::Document key :name, String, :required => true key :description, String key :company_id, ObjectId key :_type, String belongs_to :company many :operations end My test for that model is this one: class AccountTest < Test::Unit::TestCase should_belong_to :company should_have_many :operations should_validate_presence_of :name end It fails on the first should_belong_to: ./test/unit/account_test.rb:3: undefined method `should_belong_to' for AccountTest:Class (NoMethodError) Any ideas why this doesn't work? Should I try something different from shoulda? I must point out that this is the first time I try to use shoulda, and I'm pretty new to testing itself.

    Read the article

  • QuadTrees - how to update when internal items are moving

    - by egarcia
    I've implemented a working QuadTree. It subdivides 2-d space in order to accomodate items, identified by their bounding box (x,y,width,height) on the smallest possible quad (up to a minimum area). My code is based on this implementation (mine is in Lua instead of C#) : http://www.codeproject.com/KB/recipes/QuadTree.aspx I've been able to successfully implement insertions and deletions successfully. I've turn now my attention to the update() function, since my items' position and dimensions change over time. My first implementation works, but it is quite naïve: function QuadTree:update(item) self:remove(item) return self.root:insert(item) end Yup, I basically remove and reinsert every item every time they move. This works, but I'd like to optimize it a bit more; after all, most of the time, moving items still remain on the same quadTree node most of the iterations. Is there any standard way to deal with this kind of update? In case it helps, my code is here: http://github.com/kikito/passion/blob/master/ai/QuadTree.lua I'm not looking for someone to implement it for me; pointers to an existing working implementation (even in other languages) would suffice.

    Read the article

  • git hooks - regenerate a file and add it to each commit ?

    - by egarcia
    I'd like to automatically generate a file and add it to a commit if it has changed. Is it possible, if so, what hooks should I use? Context: I'm programming a CSS library. It has several CSS files, and at the end I want to produce a compacted and minimized version. Right now my workflow is: Modify the css files x.css and y.css git add x.css y.css Execute minimize.sh which parses all the css files on my lib, minimizes them and produces a min.css file git add min.css git commit -m 'modified x and y doing foo and bar' I would like to have steps 3 and 4 done automatically via a git hook. Is that possible? I've never used git hooks before. After reading the man page, I think I need to use the @pre-commit@ hook. But can I invoke git add min.css, or will I break the internet?

    Read the article

  • Why do mozilla and webkit prepend -moz- and -webkit- to CSS3 rules?

    - by egarcia
    CSS3 rules bring lots of interesting features. Take border-radius, for example. The standard says that if you write this rule: div.rounded-corners { border-radius: 5px; } I should get a 5px border radius. But neither mozilla nor webkit implement this. However, they implement the same thing, with the same parameters, with a different name (-moz-border-radius and -webkit-border-radius, respectively). In order to satisfy as many browsers as possible, you end up with this: div.rounded-corners { border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } I can see two obvious disadvantages: Copy-paste code. This has obvious risks that I will not discuss here. The W3C CSS validator will not validate these rules. At the same time, I don't see any obvious advantages. I believe that the people behind mozilla and webkit are more intelligent than myself. There must be some good reasons to have things structured this way. It's just that I can't see them. So, I must ask you people: why is this?

    Read the article

  • haml - if-else with different identations

    - by egarcia
    Hi everyone, I'm trying to render a calendar with rails and haml. The dates used come from a variable called @dates. It is a Date range that contains the first and last days to be presented on the calendar. The first day is always sunday and the last one is always monday. I'm planning to render a typical calendar, with one column per weekday (sunday is going to be the first day of the week) using an html table. So, I need to put a %tr followed by a %td on sundays, but the rest of the days I just need a %td. I'm having trouble modelling that on haml. This seems to require different levels of identation, and that's something it doesn't like. Here's my failed attempt: %table %tr %th= t('date.day_names')[0] # Sunday %th= t('date.day_names')[1] %th= t('date.day_names')[2] %th= t('date.day_names')[3] %th= t('date.day_names')[4] %th= t('date.day_names')[5] %th= t('date.day_names')[6] # Monday [email protected] do |date| - if(date.wday == 0) # if date is sunday %tr %td=date.to_s - else %td=date.to_s This doesn't work the way I want. The %tds for the non-sunday days appear outside of the %tr: <tr> <td>2010-04-24</td> </tr> <td>2010-04-25</td> <td>2010-04-26</td> <td>2010-04-27</td> <td>2010-04-28</td> <td>2010-04-29</td> <td>2010-04-30</td> I tried adding two more spaces to the else but then haml complained about improper identation. What's the best way to do this? Note: I'm not interested on rendering the calendar using unordered lists. Please don't suggest that.

    Read the article

  • drupal: standard way for creating a slug from a string

    - by egarcia
    Hi there, A slug on this context is a string that its safe to use as an identifier, on urls or css. For example, if you have this string: I'd like to eat at McRunchies! Its slug would be: i-d-like-to-eat-at-mcrunchies- I want to know whether there's a standard way of building such strings on Drupal (or php functions available from drupal). More precisely, inside a Drupal theme. Context: I'm modifying a drupal theme so the html of the nodes it generates include their taxonomy terms as css classes on their containing div. Trouble is, some of those terms' names aren't valid css class names. I need to "slugify" the them. I've read that some people simply do this: str_replace(" ", "-", $term->name) This isn't really a enough for me. It doesn't replace uppercase letters with downcase, but more importantly, doesn't replace non-ascii characters (like à or é) by their ascii equivalents. Is there a function in drupal 6 (or the php libs) that provides a way to slugify a string, and can be used on a template.php file of a drupal theme?

    Read the article

  • rails - Redirecting console output to a file

    - by egarcia
    On a bash console, if I do this: cd mydir ls -l > mydir.txt The operator captures the standard input and redirects it to a file; so I get the listing of files in mydir.txt instead of in the standard output. Is there any way to do something similar on the rails console? I've got a ruby statement that generates lots of prints (~8k lines) and I'd like to be able to see it completely, but the console only "remembers" the last 1024 lines or so. So I thought about redirecting to a file - If anyone knows a better option, I'm all ears.

    Read the article

  • How should I call the operation that limit a string's length?

    - by egarcia
    This is a language-agnostic question - unless you count English as a language. I've got this list of items which can have very long names. For aesthetic purposes, these names must be made shorter in some cases, adding dots (...) to indicate that the name is longer. So for example, if article.name returns this: lorem ipsum dolor sit amet I'd like to get this other output. lorem ipsum dolor ... I can program this quite easily. My question is: how should I call that shortening operation? I mean the name, not the implementation. Is there a standard English name for it?

    Read the article

  • drupal themes: .info file: how do I add more than 1 css file / js file to my theme?

    - by egarcia
    I'm creating a new Drupal theme. Until now, I only needed to include a single css file and a single js file. So my theme.info file had something like this: stylesheets[all][] = css/style.css scripts[] = js/script.js Now I must include jquery and jquery-ui in order to use a calendar date. These come with 2 new javascript files, and 1 additonal css file that I must add to the site. The calendar input form is going to be used in all pages (on a side block) so it is ok for me to load the extra css/javascript on all pages. I think the easiest thing would be to reference them on the .info file itself. At first I tried to just put them there with separate spaces: stylesheets[all][] = css/style.css css/ui-lightness/jquery-ui-1.8.1.custom.css scripts[] = js/jquery-1.4.2.min.js js/jquery-ui-1.8.1.custom.min.js js/reservations.js I emptied drupal's cache and... none of them loaded. I then tried separating each file with a comma, and flushing the cache again. Same result. I've browsed some drupal pages, but could not find how to add several javascript/css files on one theme (they always seem to add just 1 of each). So, how do I include several css/javascript files on the .info file?

    Read the article

1 2  | Next Page >