clocKwize

Activity Graph

Page 1 of 23 | Next »

2015-11-11

[13:39:44] clocKwize: has joined #RubyOnRails
[13:39:44] clocKwize: has joined #ruby
[14:12:47] clocKwize: Read error: Connection reset by peer

2015-09-10

[12:55:20] clocKwize: has joined #RubyOnRails
[12:55:20] clocKwize: has joined #ruby
[12:55:57] clocKwize: Max SendQ exceeded
[12:56:38] clocKwize: has joined #RubyOnRails
[12:56:38] clocKwize: has joined #ruby
[12:57:13] clocKwize: Max SendQ exceeded

2015-08-12

[08:11:28] clocKwize: has joined #ruby
[08:11:50] clocKwize: has joined #RubyOnRails
[08:12:03] clocKwize: Max SendQ exceeded

2015-08-10

[16:25:40] clocKwize: has joined #ruby
[17:42:55] clocKwize: Quit: My Mac has gone to sleep. ZZZzzz???
[18:45:35] clocKwize: has joined #ruby
[19:28:16] clocKwize: Quit: My Mac has gone to sleep. ZZZzzz???
[20:28:55] clocKwize: has joined #ruby
[20:29:42] clocKwize: Max SendQ exceeded

2015-07-27

[14:10:52] clocKwize: has joined #ruby
[14:26:06] clocKwize: Quit: Textual IRC Client: www.textualapp.com

2015-07-22

[06:09:16] clocKwize: Quit: My Mac has gone to sleep. ZZZzzz???
[07:37:42] clocKwize: has joined #ruby
[08:55:10] clocKwize: Quit: My Mac has gone to sleep. ZZZzzz???
[08:59:02] clocKwize: has joined #ruby
[15:31:46] clocKwize: Quit: My Mac has gone to sleep. ZZZzzz???

2015-07-21

[17:29:06] clocKwize: has joined #ruby

2015-05-29

[19:59:06] clocKwize: has joined #ruby
[20:19:38] clocKwize: Quit: My Mac has gone to sleep. ZZZzzz???
[20:25:19] clocKwize: has joined #ruby
[20:32:24] clocKwize: Ping timeout: 252 seconds
[20:34:34] clocKwize: has joined #ruby
[20:46:51] clocKwize: Ping timeout: 246 seconds

2015-04-01

[08:24:34] clocKwize: I'm trying to set up internationalization, I've got my routes set up so they can optionally take a :locale parameter which works, I've overridden default_url_options in ApplicationController to include the current locale in all urls, but when I call blah_path in my views, it doesn't execute my default_url_options and always returns {}, so the locale doesn't get in to the links on the page
[08:24:40] clocKwize: Anyone seen something like this?
[08:24:45] clocKwize: the guide makes it sound so simple :D
[08:25:26] clocKwize: yep, thought I'd explain first :D
[08:26:38] clocKwize: last time someone posted something on a gist, Uber got their database hacked
[08:29:25] clocKwize: though by the sound of it, they had the database connection stirng in the pasted, code, so less of a hack and more of someone stumbling across a gist a being like "wth? whats this.."
[08:32:55] clocKwize: universa1: https://gist.github.com/brightbits/b513606003b8079143e5
[08:39:21] clocKwize: universa1: Yeah, that don't work for me ;'(
[08:54:00] clocKwize: universa1: its getting here: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/url_for.rb#L90

2014-07-11

[12:47:59] clocKwize: does rails 2 still get security updates?
[12:53:06] clocKwize: elaptics: hadn't seen that before .. I wasn't really asking for me though, was just wondering considering selvait90 asked about 2.3.8
[12:58:39] clocKwize: selvait90: going for 2 to 3 will be biggest step.. then to 4 shouldn't be bad ;p

2014-07-09

[10:03:24] clocKwize: it would be great if rails had a way of creating a ruby-calculated column value
[10:03:59] clocKwize: so you could do class Blah < ActiveRecord::Base ; calculate :blah_column, with: -> { |blah| blah.x * blah.y }
[10:04:12] clocKwize: and every time you save, it would use this value and it wasn't writable from code
[10:05:17] clocKwize: instead of a before_save :set_blah_column_to_x_multiplied_by_y
[10:09:50] clocKwize: yes, it would clean my shit up
[10:36:03] clocKwize: workmad3: I'd probably just run the lambda every time you try and save, expecting it to be a simple operation ;p
[10:48:54] clocKwize: heroes_path(@hero)
[10:48:59] clocKwize: items_path(@item)
[10:51:14] clocKwize: http://apidock.com/rails/ActionController/Base/url_for
[10:51:35] clocKwize: actually this http://apidock.com/rails/ActionDispatch/Routing/UrlFor/url_for
[10:52:08] clocKwize: link_to @hero will give you a link to the right url, so see how that does it
[10:56:25] clocKwize: man haven't used Capistrano in years..
[12:57:18] clocKwize: frank_o: js.erb makes the baby jesus cry

2014-07-01

[15:00:06] clocKwize: guys, I have a column in my database that I want set by the AR models, I don't want it to be possible to change it
[15:00:16] clocKwize: and I don't feel like a before_save :set_my_field is very nice
[15:00:36] clocKwize: is there any way to say "this column should always have this calculated value for this instance of MyModel"
[15:01:01] clocKwize: universa1: its constant for that instance of MyModel
[15:01:24] clocKwize: it could be a calculated value in the database, like CONCAT of several other feilds
[15:01:54] clocKwize: before_save :set_my_field ; def set_my_field ; self.my_field = "feed:#{md5_of(url)}" ; end
[15:02:12] clocKwize: universa1: doesn't AR look at self.attributes for dirtyness etc
[15:02:27] clocKwize: so overriding the attribute by name will not have an effect, except for other users of the class looking at it
[15:03:00] clocKwize: universa1: I need to be able to query against it
[15:03:48] clocKwize: I think there should be a way to not have a column user-writable, but always come from a calculated value
[15:04:58] clocKwize: Sigma00: its based off the url field, so if someone updates that, it should change
[15:05:16] clocKwize: universa1: yes but relying on some other code to not allow something to touch my model in a certain way is asking for trouble

2014-06-26

[15:08:51] clocKwize: hmmm, a recruiter appears to be using a modified copy of my CV to find new clients
[15:09:29] clocKwize: indeed.. I'll take it as a compliment
[15:10:16] clocKwize: yeah, looks nowhere near as good as mine :p
[15:11:39] clocKwize: found out because they put AOL for a project I've recently worked on (It wasn't AOL, but I have worked there on other projects) and the recruiter knows another guy who works at AOL and me...
[15:16:47] clocKwize: Add lib to your load_path - but thats kind of an anti-pattern... If its a module, is it a concern? stick it in controllers/concerns and it'll autoload it
[15:17:21] clocKwize: mikecmpbll since when?
[15:17:54] clocKwize: ahh, I mean the auto_load_path, not load_path :)

2014-06-24

[08:29:41] clocKwize: We have a big of code that just redirects and tracks - we want to redirect ASAP, but then submit tracking information separately, but it seems a bit much for a background queue - is it messy to use Thread.new { track }
[08:35:17] clocKwize: Demerzel: yeah, I kind of agree, but then I don't think the cost of pushing something to redis is going to be much less time and resources required to transfer to a queue and have another process unqueue and execute it is probably overkill for the time it takes to do each one..
[08:37:01] clocKwize: yeah probably correct
[08:37:19] clocKwize: I would have put it in a queue, I didn't write the code (just reviewing a PR)
[08:39:30] clocKwize: maybe it would be fine in an after_filter? If a server returns a redirect response, the browser will process it straight way..
[08:41:25] clocKwize: "After" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running.
[08:41:45] clocKwize: "about to be sent to the client" - you sound correct
[08:46:01] clocKwize: I just told the guy to execute it inline - its only storing a single db record..
[08:46:22] clocKwize: think he is worrying far too much and it'll bite us in the ass for some reason

2014-06-20

[13:49:20] clocKwize: hi guys, with rspec, how do I spy on an existing class? so I can do expect(Blah).to have_received(...) ?

2014-06-18

[13:07:55] clocKwize: I'm using rspec expectation (expect_any_instance_of(Blah).to recieve(:woop).with([1, 2]) --- is there any way to make it not care if it receives [2,1] or [1,2]?

2014-06-04

[08:48:34] clocKwize: You can override the permissions used in CarrierWave.configure block
[08:53:30] clocKwize: maybe, it doesn't say the default in README but it shows how to change it, so I can only assume it has a default and doesn't just allow the OS to decide

2014-06-03

[20:37:02] clocKwize: hey guys, I've just set up a new rails 4 app, setting session[:user_id] in 1 action, them accessing it from a before_action in another action, and its empty... I can't work out why.. any idaes?
[20:37:57] clocKwize: https://gist.github.com/brightbits/a352eaafbc6a16d0a0b8
[20:38:30] clocKwize: set user_id in user#update, then call another action, which uses current_user, but at that point session[:user_id] is nil
[20:41:06] clocKwize: uid is a facebook uid, its loading or creating a user based on the facebook uid
[20:41:12] clocKwize: and then storing the id of that user in the session
[20:52:44] clocKwize: anyone know what I'm doing wrong
[20:54:25] clocKwize: I'm not losing my session id

2014-05-16

[10:33:29] clocKwize: krz: looks like you want (properties -> free_trail_exire_at')::TIME
[10:33:30] clocKwize: or something
[10:33:50] clocKwize: looks like its trying to cast "free_trial_expire_at" to a time
[10:34:00] clocKwize: instead of the value of that key in the hstore properties

2014-05-15

[10:57:38] clocKwize: I'm having trouble getting a single url (failing with a ZLib error) can anyone else pull this url through ruby? Chrome handles it fine but the deflate inflation fails through ruby for me.. http://www.pioneerelectronics.com/piocda/rssServlet?pressReleaseChannelId=4915acaf8f6b3b210VgnVCM1000003367a8c0RCRD
[12:59:03] clocKwize: I've managed to break net::http
[12:59:32] clocKwize: found a url that uses deflate encoding, but doesn't conform exactly to the standard
[12:59:45] clocKwize: ruby blows up with Zlib::DataError, browsers handle it anyway
[13:07:46] clocKwize: osx is where its at
[13:07:48] clocKwize: best of both worlds
[13:09:05] clocKwize: I've no experience with that, aren't there any third party ones?
[14:17:59] clocKwize: mikecmpbll: I wouldn't do controller tests if I had integration tests, but other way round you can easily hide strange errors
[15:02:52] clocKwize: crankharder: why don't you insert some dummy documents in to the database?
[15:06:06] clocKwize: crankharder: the fact that its hard to do and not many people do it probably means its the wrong way to go about testing your code
[15:06:56] clocKwize: Morkel: yeah use a background processing thing, I wouldn't use Thread.new
[15:08:24] clocKwize: crankharder: no, but out of experience, I know several pitfalls to trying to stub another libraries objects in such a way to get the result you want. you are relying on those things not changing internally, and having complex set up to make it happen.. why not just do what most people do and use database_cleaner and factory girl to setup your scenario..
[15:09:48] clocKwize: Morkel: maybe, but there aren't many alternatives, if you want things to execute outside the flow of a HTTP request reliably.
[15:11:13] clocKwize: Morkel: it is a bit complex to set up and have a worker running etc just for email, but you are likely to need background jobs in most projects anyway :)
[15:12:50] clocKwize: Morkel: I like sidekiq, its pretty simple and works well, has a nice ui
[15:13:04] clocKwize: yes, workmad3 raises a good solution if you have that kind of environment
[15:13:13] clocKwize: would be a lot simpler
[15:17:59] clocKwize: crankharder: I didn't say it wasn't possible, I just said its probably not the best way to do it. Just because you can shoot yourself in the face with a handgun doesn't mean you should, even though the gun supports it :D

2014-05-09

[09:32:57] clocKwize: hey guys, I'm using fields_for, i want a button specific to those fields, but when i do f.submit, then name is just submit? I want it to be like the fields.. collections[2][publish]
[09:33:06] clocKwize: so I know whats been pressed for what etc..

2014-05-08

[10:48:30] clocKwize: whats broken?

2014-05-07

[06:40:51] clocKwize: with these 2 models: https://gist.github.com/brightbits/277b28b9ebb9c1e06f3b - what would be the best way to store the type field in the database, and know correctly when to update it? (its logic being based on the contents of the has_many relation)
[06:44:42] clocKwize: sevenseacat: true true, I'll call it something else, like collection_type
[06:44:49] clocKwize: but, how should I best know when to update it?
[06:44:54] clocKwize: no, its a string
[06:44:59] clocKwize: before save of the filter?
[06:45:57] clocKwize: the code has changed ;p
[06:46:47] clocKwize: hmm, how do you touch a model

2014-04-04

[13:18:36] clocKwize: whats the best way to run a complex query and have it return active record objects?
[13:18:56] clocKwize: I need to run 2 queries, union them and order the result, then load them as Collection objects

2014-04-01

[11:13:34] clocKwize: hmmm, chrome doesn't have any kind of easter egg for a server that returns a 418 I'm a teapot status code
[11:15:35] clocKwize: ACTION reverts return head(418) from the codebase
[11:19:01] clocKwize: andywww: use prawn, if you don't use prawn, stay away from the html to pdf things
[11:19:33] clocKwize: they work really well but there is little room to tweak anything and its really hard to get things perfect
[11:27:11] clocKwize: mhogarth: why do you need that?
[11:28:08] clocKwize: garbage collection happens at an unspecified time, not when references are released from that object.. so usually its not a great way to do it
[11:28:58] clocKwize: there isn't an equivalent of IDisposable which is probably what you want right?
[11:29:04] clocKwize: no using statements etc
[11:29:25] clocKwize: though I really like that feature of c#
[11:35:56] clocKwize: it looks interesting, but I haven't touched it, I agree with elaptics... simple is not AR ;p
[11:40:13] clocKwize: shashank_rs: default: "x
[13:14:04] clocKwize: guys, how would I override a method on a module, then un-override it at another point?

2014-03-31

[15:43:29] clocKwize: nothing is easy
[15:43:54] clocKwize: the more complex the thing, the harder it will be. computers are bloody complex, therefore everything on them is complex by default
[15:44:04] clocKwize: staples are a good example of this

2014-03-25

[11:57:15] clocKwize: anyone used postgres hstore stuff in rails 4? I'm using it but all types come back as strings, I'd like them to come back in the original type if possible
[11:58:05] clocKwize: be good to do store_accessor :settings, :a => :string, :b => :integer, :c => :datetime and have it cast them

2014-03-19

[15:52:31] clocKwize: guys, anyone know how to stub a builder type method?
[15:52:45] clocKwize: e.g. one that takes a block and calls it with a config object
[15:52:47] clocKwize: to set it up
[15:52:54] clocKwize: I want to check its giving it the right settings

2014-03-17

[11:05:23] clocKwize: does anyone know a good way to do multiple table inheritance? I just tried acts_as_relation but it doesn't seem to work when I want a has_many :mti
[11:43:38] clocKwize: DaniG2k: have you looked at embed.ly's extract API
[11:44:34] clocKwize: its way way more effort than you want to consider doing it yourself
[11:52:02] clocKwize: we are writing our own one, but only because we are spending $5000+ per month on embed.ly :)
[11:52:56] clocKwize: we've basically got a list of most extracted domains and are writing parsers for the top ones, falling back to embed.ly if we haven't implemented one yet
[11:53:39] clocKwize: in our experience
[11:53:42] clocKwize: its very good
[11:53:48] clocKwize: 95% of the time
[11:54:00] clocKwize: but the other 5%, you're screwed as you have no control :)
[11:54:40] clocKwize: DaniG2k: no, sorry, its part of a service we are building http://www.cronycle.com
[11:54:54] clocKwize: DaniG2k: something like that, yeah
[11:55:10] clocKwize: our use case is a bit more complicated, as we need a title, a short summary and the content, plus all relevant images :P
[11:55:40] clocKwize: in some cases
[11:55:47] clocKwize: you don't know what images are relevant, are adverts, etc
[11:56:13] clocKwize: <title> isn't always the relevant title of the content :)
[11:56:22] clocKwize: sometimes it is
[11:56:43] clocKwize: but you know, websites are built for people, not computers
[11:58:03] clocKwize: but embed.ly is very good, for small volume and just works :)
[11:58:21] clocKwize: as many as you pay for
[11:58:26] clocKwize: we do hundreds of thousands

2014-03-11

[14:33:22] clocKwize: anyone know why a has_many through returns nil,
[14:33:31] clocKwize: anyone ever seen that?
[14:33:49] clocKwize: no error, just nil, eve though the thing its looking at has things in it, but if that was empty, i'd expect it to return an empty proxy
[14:37:14] clocKwize: nevermind, there was a method with the same name returning nil

2014-03-05

[08:36:16] clocKwize: thought a test failed as I watched the ....'s go past
[08:36:21] clocKwize: then I realised I'd pressed F by accident
[09:31:18] clocKwize: you're in rails ..

2014-03-04

[09:47:54] clocKwize: ugh man I feel like shit

2014-02-27

[14:50:58] clocKwize: lan party weekend \o/
[14:51:08] clocKwize: 1 hour till I can leave work and prepare
[14:59:58] clocKwize: the originals are
[15:00:02] clocKwize: Age of Empires 2
[15:00:05] clocKwize: Unreal Tournament
[15:00:15] clocKwize: the new games are
[15:00:19] clocKwize: Worms Clan Wars
[15:00:22] clocKwize: Left for Dead 2
[15:00:45] clocKwize: been playing with these guys since early 00's
[15:01:01] clocKwize: we all used to play in UT clan together when we were teenagers
[15:01:15] clocKwize: now we are all growd up and still have a LAN once in a while :D
[15:01:49] clocKwize: mikecmpbll: that is what we played, we were pretty high up in ClanBase UT 99 iCTF UK ladder (in several clans over the years)
[15:02:50] clocKwize: my clan was ]iCUK[, we were #1 for a while, and top 3 for a long time.. then the main clan that all the other guys were in was .mD-
[15:03:22] clocKwize: heh GkC love
[15:05:15] clocKwize: heh, godlike in a war.. good times
[15:23:19] clocKwize: hypnosb: that depends, do you ever need to query upon it?
[15:24:21] clocKwize: hypnosb: it gets complicate and messy, I don't see why people don't just use another table for things like this ;p
[15:25:16] clocKwize: hypnosb: databases are good at storing a shit ton of rows, thats what they do
[15:57:14] clocKwize: masscrx: that'll only return 1
[15:57:33] clocKwize: I'm assuming you have 2 models, Purchase and PurchaseItem
[15:57:43] clocKwize: can't you just do @purchase.items

2014-02-20

[11:34:44] clocKwize: hmm, what would be the best way to order some objects by their id, based on the order of that ID in another array?
[11:35:57] clocKwize: say I have [5, 2, 3, 4, 1] and I want to order [{id: 1, ..}, {id: 2, ..}, {id: 3, ..}, {id: 4, ..}, {id: 5, ..}] so it was [{id: 5, ..}, {id: 2, ..}, {id: 3, ..}, {id: 4, ..}, {id: 1, ..}]
[11:43:03] clocKwize: docs.sort_by { |doc| ordered_ids.index(doc["id"]) }.reverse
[11:43:05] clocKwize: would that do it
[11:43:17] clocKwize: well, don't answer that question
[11:43:25] clocKwize: but i think thats easier, unless I'm missing something
[11:44:18] clocKwize: only slightly :p
[11:47:42] clocKwize: workmad3: because index will return 0 for the first, item, which will put it last ?
[11:47:54] clocKwize: or will it go first..
[14:00:12] clocKwize: laters taters

2014-02-17

2014-02-13

[10:53:29] clocKwize: Youtube is red Facebook is blue Pornhub is down You'll Have to do
[10:54:03] clocKwize: I like how I'm getting paid to research this.
[11:44:24] clocKwize: $750 for a pro licence seems reasonable to be honest.. its toy money single one off payment that'll be less than the cost of 2 developer days, that'll save a developer spending a lot longer trying to find the issue, fixing it, working out alternative solutions etc..
[11:48:24] clocKwize: universa1: possibly, but is it broken? jobs failing in an unrecoverable way (stack overflow, heroku killing the process because of memory usage, seg faults) isn't really much it can do to fix this. The thing pro adds that fixes it is job tracking, so it knows if it never completes and the process it was running in is no longer running it retries too or something..
[13:49:25] clocKwize: timmi_qt: I'd say a room always needs to be part of a building? :p
[13:53:43] clocKwize: def project ; self.room.try(&:project) || self.probe.try(&:project) ; end
[13:53:49] clocKwize: would do it I guess
[14:03:30] clocKwize: timmi_qt: sorry was afk, maybe just have an unassociated_room table which links project<->room when there is no building?
[14:03:43] clocKwize: I dunno >.<
[14:03:49] clocKwize: hard to say without seeing it all