Noizeramp

  • Home
  • Archive
  • Posts
  • Tags
  • Scripted sorting in Elasticsearch

    22 October 2020 ⋅ 3 min read ⋅ rails

    In some of our projects where we need flexible fuzzy search capabilities with weighted results we use Elasticsearch. It indexes everything you throw at it, then gives you tools to search it flexibly.

    In this short article I share the approach we used to sort the weighted output additionally basing on certain criteria.

    Read more

  • YAML you may have never known

    23 October 2014 ⋅ 1 min read ⋅ yaml rails

    The collection of cool things you can do in YAML.

    Read more

  • Rails 2.1 Is Out

    1 June 2008 ⋅ 1 min read ⋅ technology rails

    Rails

    3 hours ago Rails 2.1 was finally released into the wild, and there’s the officials report for your reading pleasure. I’m still a bit concerned about the RSpec compatibility, but since I already found a sufficient replacement – Shoulda and Mocha – there may not be as many worries.

    So, let’s give it a round of aplause. Great job!

  • Little Luck With Rails 2.1 Yet

    20 May 2008 ⋅ 1 min read ⋅ technology rails

    Rails

    Following the concise yet complete instructions on how to start using the Rails 2.1.0 release candidate from the awesome Getting Rails 2.1 RC1 podcast, I gave it a very quick spin today in one of my projects.

    Right after the installation one of the gems refused to work. It was HAML – an excellent HTML builder extension – that blamed Rails for not having some hook registration function call. Taking the latest master copy from github of HAML (which is 1.9.0 there at the moment) solved the problem, but then something else jumped out. RSpec doesn’t work very well with Rails 2.1 at its present state, and every controller test was yelling at me.

    Let’s say, it was a bad luck and hopefully I’ll do better next time when they finally release the thing. Got back to Rails 2.0.2 for now.

  • Rails, TinyMCE and JavaScript in IFrame

    17 April 2008 ⋅ 3 min read ⋅ technology rails

    Browsers developed some really bizarre means of user data protection over the year of evolution. One of many is the JavaScript cross-domain protection. If you load a web-page into an IFRAME and access its DOM model or the model of the parent document from the loaded page, you get what you deserve – a permissions violation error that looks like ”Permissions Exception” (in IE) and ”uncaught exception: Permission denied to get property …” or similar in (FireFox). All is simple and clear once you know what to expect. It’s all logical. Today however I faced something different, really different and odd.

    Read more

  • Ruby / Rails: Zen Testing With Autotest and XOSD

    29 November 2007 ⋅ 2 min read ⋅ technology rails

    Lately I watched the Rest series of excellent Peepcode screencasts and fell in love with that nice marriage of Autotest and Growl they have on Mac.

    If you don’t know what Autotest is, imagine the RSpec tester spinning in the background and watching the files you change. Once it sees something new, it runs corresponding specs and displays all usual “X examples, Y failures, Z pending” in its output. Then it looks for more changes and makes another specs run. Pretty useful.

    Read more

  • Rails: Haml and Sass

    30 October 2007 ⋅ 2 min read ⋅ technology rails

    Hey fans of everything concise. My finding of today is Haml and Sass which is a quickly growing replacement for Rhtml (and plain HTML) and CSS. Just check the syntax sample on their main page and admit it, it’s much simpler and cleaner than plain (R)HTML. Everything has a meaning, everything cuts to chase.

    Haml can be used with Ruby on Rails as a plug-in that transparently adds the support to your ActiveViews. You simply rename your views from .rhtml to .haml and start deleting redundant code. In case of CSS, you place your .sass in the stylesheets folder and they are automatically compiled on demand. One thing I haven’t figured out yet is whether they do every time, or once per change to save performance.

    Haml and Sass are also used in the StaticMatic toolkit, which is exactly how I discovered them. The toolkit lets you put together static sites lighting fast. You simply write your pages in Haml, model your stylesheets in Sass, preview and do a final build. As the result of building you get a bunch of little cute HTML files and CSS stylesheets ready for upload to the site. If you, like me, still like static sites and want to save time on bringing them up and maintaining, it’s your choice.

    Let me know what you think. A couple of lines is fine.

  • Rails: Foreign keys and more useful plug-ins

    29 July 2007 ⋅ 1 min read ⋅ rails

    The default Rails framework seems not support the foreign keys in database migrations and that’s a big omission. You are bound to deal with raw SQL to add these or end up with complex (and often ugly) code to emulate them.

    Recently I found a very nice plug-in that adds foreign keys functionality to the migration classes. The syntax looks native and doesn’t stand out prominently. It is also clever enough to recognize some basic intentions, like ‘user_id’ being a reference to the ‘users’ table etc.

    Check their other rails works too. They look handy!

  • Rails: Malformed Header From Script

    29 July 2007 ⋅ 1 min read ⋅ rails
    If you developed your application with WebBrick, deployed it to Apache and seeing something like below in your web server error log, make sure to check that you don’t have any output to console (like ‘puts’) left in the code. [Sat Jul 28 07:11:05 2007] [error] [client xxx.yyy.zzz.xxx] malformed header from script. Bad header=["a"]: dispatch.fcgi Whatever you output goes to the header section of the response and most probably the web server won’t understand it.

    Read more