« first day (532 days earlier)      last day (2723 days later) » 

Anonymous
00:08
Super productivity!!!
Anonymous
I finished that script that converts flat files to LDAP entries (via ActiveLDAP gem)
Anonymous
I am writing up a gist of the rake file now.
02:27
anybody ever heard if alchemy cmd?
alchemy cms?
 
4 hours later…
06:36
Morning. I might have heard the name but I haven't actually used it
 
2 hours later…
08:41
I am unable to read the query parameters in a path with params[:my_key]
Why?
09:30
7
A: Hash whose values are array size

Cary SwovelandOne way: h = { 1 => [1,1,1], 2 => [3,4,5], 7 => [9,12] } h.merge(h) { |*_,a| a.size } #=> { 1 => 3, 2 => 3, 7 => 2 }

Nice answer
09:46
Yes he always gives nice answers :)
Cary should also be in this room ;)
 
1 hour later…
10:53
@fivedigit humm
I am trying to integrate this keith-wood.name/datepick.html Whenever I am trying to click on the field github.com/aruprakshit/sampl_admin/blob/master/app/admin/… getting error - in my browser console "Uncaught TypeError: elems.sortable is not a function" Any idea what wrong I did ?
Good day
Any body knows how to reference CDN hosted js inside the activeadmin
@fivedigit Good good day!
:)
Seems like a missing dependency, unless elems would be null
Any hints where it is wrong
Try to add a require in your application.js. Perhaps sortable isn't required by default. //= require jquery-ui/sortable
10:59
humm
let me try
Or do you have a //= require jquery-ui in there already?
I don't have the gem
I just loaded them using the CDN link
I can see also the module you said is present in the browser asset dir in the source tab
Hmmm.
Are the files from the CDN loaded before the rest?
Async loading could cause issues too
means?
how to check it ?
It would be easiest to just read the HTML source.
11:06
ok
If the code using the sortable dependency is loaded before the jQuery UI code, it might already be executing code that needs that dependency.
I remember having plenty of issues with async loading (usually in combination with development mode). If they do load async, the <script> tags will have an async attribute
Well that does look good.
Try opening up the JS console and run something like $('.test').sortable()
Just to verify sortable is required properly. I'm assuming it works, so the issue is most likely elsewhere.
11:12
Yup.. not working.. But nice lesson to test..
thanks for the trick how to test
Yes I am getting the same error
Oh doh! jQuery UI is loaded before jQuery.
so how to fix it... :/
Where are you getting jQuery UI from?
I cannot see it in your project on Github :)
And ActiveAdmin is nice enough to load those Javascripts last >_>
Did you try this to force jquery to be loaded before everything else? github.com/activeadmin/activeadmin/wiki/…
Then you also need to make sure jquery isn't loaded again.
Cause if it's loaded for the second time, it removes references to all registered jQuery UI plugins, leading to the same error
I think jquery is already loaded twice atm
11:19
ok..
No I didn't try it
@fivedigit what exactly I need to do.. ? Now I am confused.. since last 3 days I am trying to atleast work one multidatepicker plugin ,.. but I am helpless. Those didn't meet what I need.. so I am exploring if I can use this.. but this one I am not ablt to load only :/
@fivedigit any rescue lines ?
I'm reading through the Javascript asset manifests. :)
the active_admin/base require in your application.js should be enough to make sure jquery and jquery ui dependencies are loaded.
But after that, you're loading jquery again in your application.js
Try removing these lines from application.js:
//= require jquery
//= require jquery_ujs
then how files which are using application.js file will work ?
@onebree You ended up brute-forcing it, I see. What happened?
11:31
and remove this line: config.register_javascript 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'
@ArupRakshit sorry, can you rephrase the last question?
@fivedigit All jquery files came from that link only.. If I remove the CDN link, how all Jquery modules will come ?
rephrased
@Kitler I like this answer better because it isn't tricky. But Cary's answer does please me for how clever it is.
@WayneConrad While we are thinking business logic all nice tricks goes away of head... :)
gist.github.com/aruprakshit/f87132b118f6a4dd709a <-- The long list of javascripts seem to suggest that they are in fact loaded as assets. Active admin also seems to depend on jquery and some parts of jquery UI
jquery and jquery UI are specified as dependencies in the ActiveAdmin gemspec: github.com/activeadmin/activeadmin/blob/master/…
So you don't need to load it from the CDN afterall :)
ok
good good finding
let me kick the CDN out then
11:38
That alone should be enough actually. Sprockets will simply ignore the duplicate requires of jquery and jquery_ujs :)
Okay that was a bit of a detour. But I hope it works though :)
@fivedigit It WORKS \o/
Hooray! \o/
now I need to go to test something else.. :/
have you used this plugin before ?
11:39
ActiveAdmin?
no the multidatepicker plugin
No I haven't, sadly
For my work project, we've got an interface where a start and end date can be picked, but they're simply the native Chrome date pickers on two different date fields.
@fivedigit ok.. My client is so hard.. he want all in the same datepicker
My previous try with other datepicker.. stackoverflow.com/questions/31066328/… .. it went well.. only one part it didn't work.. which is why I posted it .. But it seems my question has no value :)
11:43
This datepicker plugin seems to be very good though
Yes... But I want multiple datepicker one
@Cereal Humm The SO post came from that only.. and this github.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/issues/…
I tried things... but not worked well for me.. :/ I am fed up now
If I had to guess, $('#booking_start_date').multiDatesPicker('resetDates', 'disabled'); is causing the problem
Does multiDatesPicker not only accept one parameter as an object?
didn't get you
11:52
The definition of the method
 $(element_or_selector).multiDatesPicker(options_to_initialize_datepicker_and_multidatepicker);
it is there to refresh the calender so that next ajax response dates can be set
options_to_initialize_datepicker_and_multidatepicker is the only parameter
In that line above, you're sending two string literals
only the addDates in the hooks not working as expected
Now.. why booking date is getting skipped ?
Started POST "/admin/hotels" for ::1 at 2015-06-26 17:24:54 +0530
Processing by Admin::HotelsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"HLR9hI2RvmvXpFJ/TatJRgR1fVEAyFnth4N27ZxpFSY2PZlvyOqBON3bgG0Xa3QetCf5U5hzodWighD3sO+5AA==", "hotel"=>{"name"=>"test3", "booking_date"=>"06/30/2015"}, "commit"=>"Create Hotel"}
   (0.1ms)  begin transaction
  SQL (0.3ms)  INSERT INTO "hotels" ("name", "created_at", "updated_at") VALUES (?, ?, ?)  [["name", "test3"], ["created_at", "2015-06-26 11:54:54.826987"], ["updated_at", "2015-06-26 11:54:54.826987"]]
Oh okay
I permit the params also github.com/aruprakshit/sampl_admin/blob/master/app/admin/… why it is not going to the DB
?
@Cereal Regarding the SO post... I know I did something wrong.. But not able to track it.. :/ That's why I am hopeless and trying to figure out if this new plugin works for me or not
ok.. permit params worked after restarting the server.. :)
12:08
I didn't actually read the SO post. I just got in
@fivedigit forgot to say one thing to you.. that is "Thank you very much!"
Ah you're welcome! ;)
12:59
Hope anybody used it before... I am trying enable specific dates only.. and using keith-wood.name/datepick.html as a plugin.. But it seems the callback is not working.. any idea how to achieve it ? here goes my code : github.com/aruprakshit/sampl_admin/blob/master/app/assets/…
13:15
I m adding a dynamic word to an array of predefined prefixes, this is what I have so far, works but looks a bit clunky
permissions = ['view_', 'add_', 'edit_', 'remove_'].map { |w| "#{w}#{permission}" }
Any more elegant suggestions or is this fine?
You could use a word array: permissions = %w(view_ add_ edit_ remove_).map { |w| "#{w}#{permission}" } but other than that, it looks good :)
362
Q: Ruby: what does %w(array) mean?

thedeenoI'm looking at the documentation for FileUtils. I'm confused by the following line: FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6' What does the %w mean? Can you point me to the documentation?

cool thanks
Though you could of course replace the string interpolation with concatenation: permissions = %w(view_ add_ edit_ remove_).map { |prefix| prefix + permission }
Would make it a bit less heavy to read
Went with concatenation, cheers
13:35
@fivedigit You could move the underscore into the string, but that's good.
Yeah true. Though the variant without quotes is surprisingly pleasant to see :)
Yes, I'd go for the %w(...) syntax as well.
13:51
double quotes are just too damn ugly
Note to self %w does not need to be followed by single quotes
refactoring the factories controller code, mainly generates the test data for our front end tests, everything went up in flames :P
Three cheers for git checkout -- .
It's ctrl/cmd+z on steroids ;)
@Cereal how long was the process for work documents to go from Canada to NH?
14:38
woop managed to get ~150 lines out
Oh, dang. You can't pass any-old callable object to something expecting a block. It's telling me it has to be a Proc.
Here's the clever thing I was trying to do:
class Foo

  def initialize(keeper)
    @keeper = keeper
  end

  def call(i)
    i == @keeper
  end

end

a = [1, 2]
foo = Foo.new(1)
a.select(&foo)     # wrong argument type Foo (expected Proc) (TypeError)
Yay, Migraine. See, I told you that Ruby causes Migraines.
I got it! I remembered that the & operator calls #to_proc. So:
class Foo

  def initialize(keeper)
    @keeper = keeper
  end

  def to_proc
    Proc.new do |i|
      i == @keeper
    end
  end

end

a = [1, 2]
foo = Foo.new(1)
p a.select(&foo)
It gets harder to program when you can't see properly.
15:12
Been working on a pr for the past day and a half, reviewing at 6:15pm on a friday isn't a very good idea :P
@Kitler Heh, yeah.
gonna leave it till monday
Probably end up redoing most of the stuff
Enjoy your weekend guys, I m out
@Kitler Seeya, have a good weekend.
I don't think I've ever seen the &block argument not get set when a method was called with a block. Weird.
This has got to be a Ruby bug...
Anonymous
15:40
@WayneConrad What do you mean by brute-forcing it?
No, it's not a bug. It's me calling the wrong method. Heh.
@onebree I mean that big case statement
Anonymous
How is it brute force though? I have only heard of that term with password cracking.
Anonymous
I wanted a case statement because it seemed cooler than an if statement. Also, dries up saying elsif attr ~= /xyz/ every line and changing what xyz is
What I mean is that most of those "when" statements could be condensed into this:
when /^(\w+)=(.*)$/
  key, value = $1, $2
  @contact.send("#{key=}", value)
Anonymous
Oh, wow. That is cool. HOWEVER, the lines I looked for are not the only ones. Some lines were legacy (like 'office_type') and not used in our LDAP tree.
15:46
Then this:
when /^(\w+)=(.*)$/
  key, value = $1, $2
  writer = "#{key=}"
  @contact.send(writer, value) if @contact.respond_to?(writer)
Anonymous
I do not know if @contact can respond to an attribute, because this is ActiveLDAP and their documentation is not the best. (Long but not written well).
Anonymous
I would have written it different if it was for ActiveRecord.
Anonymous
ActiveLDAP still uses x.find(:all) method, and does not accept x.where().
Anonymous
I actually put in an issue that the site should be overhauled. I do not want to waste my time making a PR if they do not want it or will never look at that issue (which they wont probs)
#respond_to is built-in. All objects have it.
Anonymous
15:51
And weird thing, my rep 2 days ago was 185 or something. Yesterday SO says I gained 20 rep or whatever, but it overall decreased. I cannot find that significant of a change in my rep history. But it was weird because yesterday I got like 3 Q/A upvotes
Anonymous
@WayneConrad is it a Ruby method? Thing is, I THINK with this ActiveLDAP stuff, some values must be present. While others can be added, so it will technically respond to an attribute even if I do not want it.
Oh, ok.
Anonymous
I want my rep back at 185 :-(
@JonathanMusso NH? I haven't traveled for work yet. Maybe you're thinking of someone else
Sometimes they recalculate rep.
Anonymous
16:01
@WayneConrad Why? To account for deleted entries? Why wouldn't that show up on my rep history though?
212
Q: How do I audit my reputation?

Jeff AtwoodIf I am concerned that my reputation score is incorrect, how can I audit it, or get a report of a detailed breakdown of my reputation? Return to FAQ index

Anonymous
Why is the FAQ index linked in the question?
I can't find what I'm looking for on meta... about recalcs. You might want to ask where your rep went on meta.
Anonymous
stack overflwo meta?
Anonymous
I do not have proof though that my rep changed.
Anonymous
16:04
I checked the web archive and nothing recent enough. Whatever.
Anonymous
It's only 10 points.
I've noticed my rep go up and down
Never thought anything of it since I rarely do anything on the main site
16:41
@Cereal Lol, you must be right. You are still in New Brunswick? Or am I thinking of someone else XD
I'm still in NB
Sweet, where at Moncton?
My buddy used to work for IBM in Moncton for 10 years, just recently now in his second year at the Cooperators insurance
Omics
Very cool. You guys have some tech jobs out that way?
Not overly. There's a couple of startups
16:50
Can you recommend any sites to discover these places?
I haven't a clue
Kijiji I guess
17:25
is anyone here good at geometry?
what are you doing
Geometry. Isn't that the class where I proved that I'm no good at proofs?
Hi, a simple doubt.
I'm deploying using Cap
I get an error
An error occurred while installing pg (0.17.1), and Bundler cannot continue
You're missing a package that the pg gem needs. Probably... think think think. Might be the postgresql client libraries.
I don't have my database on the server where I have code, it's on rds
17:34
Right, but you still need the client libraries. the pg gem is just a thing wrapper around the client C library.
@WayneConrad that's right, but is it compulsion ?
since my DB resides somehwere else
sudo apt-get install libpq-dev
Yes, it's required. You're not installing the database, just the C library needed to talk to it over the network.
ok that cmd is not related to just pg I believe is it right ?
Are you going to keep second guessing me, or are you going to install that library so that you can deploy? :D
Here's the description of libpq-dev:
 Header files and static library for compiling C programs to link
 with the libpq library in order to communicate with a PostgreSQL
 database backend.
The pg gem is a native extension that wraps the libpq library.
ok that sums it for me, ok let me run that and deploy .. )
17:38
If that doesn't work, then I'll eat crow and try to figure out what the problem is.
before you suggested I was thinking I would group pg gem to development evironment and give a try
I'm guessing that didn't work.
bundle seems to be successfull )
no I did not try my guess ;)
Woohoo, I got to be right! I like being right now and then.
Better than that, I like getting the problem solved.
super thumpsup, seems its taking a while to precompile , holding too loooongg.
17:45
It takes a minute or so to build a native gem.
Oh, you mean precompiling assets? That takes forever
oh is it, its mins now
y is that
is the connection lost
i'm thinking
Just let it sit. Deployment can take a long time.
oh I just Interrupted, restarting..
18:03
more than 5 mins its holding (
I've seen assets precompile take 30 minutes.
ohhhhhh, just another doubt, gems are installed in bundle folder when using cap.
what if I navigate to current dir in server and run bundle
it installs in ?
I don't know.
18:31
SO logo right now
text(thickness+"", x - 1 + offsetX - 2, y - 1 + offsetY, 6, 6);
Oops
What was I thinking...
19:07
thickness+"" ???
19:19
The text function takes a string as the first parameter
Oh, this isn't Ruby.
The camelCase should have been my clue.
19:44
Fizzbuzz using nothing but lambda expressions. This is by @Kevin over in the Python room. And here's the "source". Ain't it pretty?
20:18
This logo can stay forever ;) Nothing beats a good rainbow :)
Take note of the alt title ;)

« first day (532 days earlier)      last day (2723 days later) »