« first day (600 days earlier)      last day (2655 days later) » 

06:31
Morning
Morning
06:59
Most of the time N+1 queries are good to get rid of. If performance measuring indicates an issue somewhere, then there's a good proof-backed reason to optimize a query. :)
 
4 hours later…
10:59
Hi
hi
Is there any code sample which I can use to upload files using ajax ?
I have multiple file fields on site to upload doc,txt, or xls files
i am using blueimp right now but it uses node.js code which i can not use
and i didnt find any ruby code for blueimp jquery file uloader
11:13
@Vikram my guess is that server-side it looks like a normal file upload
Anonymous
12:01
Morning
good morning
Anonymous
cleaning the desk and computer off.... it is FILLED with dust bunnies
Anonymous
12:17
What do you suggest I do? Right now I am using mysql2 to query the db and find all objects with script_id XYZ, and var_val LIKE %ABC% (asterisk thing). However, I cannot think of a great way to organize the data. Should I just load the rails env and use ActiveRecord to get it over with?
Anonymous
I am thinking using ActiveRecord will be easier because I am familiar with it and no need for manually doing crazy queries
you need to display the info in your app? then yeah I would use Rails? Unless there is another way to do it..
Anonymous
No, it is an offline script just to analyze some info from our databse
Anonymous
Morning @JoelL
12:21
Hey good morning
hmmm. perhaps the way you are currently doing it Hunter or using Rails Console...or quickly inside the app..best to stick with what you know if time is a factor
Anonymous
@JonathanMusso Given a file outside the app directory, how do I include the Rails environment in that file? (It will be under ./scripts for 1-3 time use or something)
Hmm I have never done this I am searching for an answer
Anonymous
Okay thanks. Yeah I am sooo lazy to Google, it is something I need to do more
Anonymous
btw I do not like Google's new logo. It looks like Century Gothic font, which I hate.
12:28
No one really likes change. I don't like it either
12:39
change ftw
13:02
@HunterStevens I use ActiveRecord without rails... it works fine.
Anonymous
How do you use activerecord without rails?
ActiveRecord is just a library
Anonymous
oh true
Anonymous
so just require the gem?
Anonymous
Meh I am so far into this program, I will refactor later...
13:06
If you include the active_record_migrations gem in your activerecord-without-rails project, you'll get the usual rake tasks you know and love.
^ It'll never get refactored if you put it off
Speaking from experience
Refactoring is a dish best served hot.
Anonymous
I do not want rake tasks, I want to access database objects from queries..
Anonymous
And I DO refactor when needed. I just would rather complete my current train of thought and make sure it works before modifying it
I only know of datamapper and activerecord for ruby DSLs
I'm sure there are others
Anonymous
13:09
Just used a can of air on my desktop... BAD idea -- used it on the back of the tower and got a smoke cloud of dust... But hey it is clean(er)
Anonymous
I have been using mysql2, which lets you name the myself client, database, etc and call direct queries
@HunterStevens I'm a huge fan of "todo" comments which I use to create a stack of things I think need to be done, without having to go off track and do them right away. So same here... I like to stick to the task.
Anonymous
I do that too. TODO and FIXME and stuff
@HunterStevens The rake tasks are for setting up your test and dev database, grabbing the production schema, etc. Very useful.
Anonymous
Oh okay, well that is why I figured to directly connect to the databse
13:14
Hey all, first time in here, I'm curious what background you all have in ruby, how long you've been writing it and if you earn money from it. I'm interested in the demographics of who ends up in Stack Overflow chat. I'm totally self-taught from online courses/Stack Overflow in Ruby, just passed 2 years of coding, and earn money through a startup which I run now thanks to my ruby skills. Anyone else?
Anonymous
Self-taught in Ruby, knew it before my job, but learned a LOT more (and Rails) with my job. Been working since October 2014. First programming job (not internship)
Since Ruby 1.6, make a living from it.
@user2792268 I don't know any :)
I wrote it for two weeks and stopped. I earn money writing web apps in Flash/JavaScript
Self taught and making a living from it for about a year now.
basically I'm a statistical anomaly
13:18
Ok so 5/5 for people coding for money, interesting. Even though I "enjoy" the coding I do and find it really interesting, I wouldn't write code if it wasn't making me money. I suppose that makes places like this more professional development than hobby group
I code because I like it, I go home and write code for free after work.
I intentially don't code when I get home so I don't burn out and loathe my job
What kind of work does everyone do with ruby?
If I weren't making a living writing code, I'd do it anyhow.
Anonymous
For a hobby, I try to update my blog, which is about my adevntures in programming. I learn in my free time. I do not "make" anything of huge importance, but I also read a lot of ruby or other news.
13:20
The primary focus of SO chat seems somewhat escapist to me. A good 80% of the time we're off topic, so it is more just for chilling with like minded individuals who can help you when you randomly get stuck while you work.
Anonymous
@Cereal Same. I reserve learning code (ruby or otherwise) for the weekend if I have time... Like I will this weekend. #LaborDay2015.
I'll code if I have a good idea, or am in a competition, or something. But other than that, I keep the code for working.

I enjoy coding, and I don't care what I'm coding, it's all fun, so it's fine for me
@Cereal I try to do something completely different when writing code at home, like games or learning something new.
Anonymous
@CuddleBunny SO Ruby chat is like that. Other rooms are more strict, but also because they have more people (so must be on topic) or are not as active (meaning all conversation should be on topic)
@JoelL I did one Rails app last month.
@HunterStevens Yeah, I mostly spend time here and C#, both rooms are similar other than the population gap. I avoid rooms that take themselves too seriously.
@user2792268 You might find more hobbyists in the teenage programmers room.
13:24
@JoelL like I said I have my own startup, so basically I've written some software that it's totally up to me to add new features to it. The latest complete version rolls in the dough while I build upgrades to a newer version until that too is finished, then I upgrade clients and start a new upgrade on the side and the cycle repeats
Anonymous
@CuddleBunny Yeah, like the unix&linux site in its entirety
I'm not particularly interested in the hobbyist side of coding, I don't think coding will ever be a purely entertaining task for me
@user2792268 what does your startup do?
Online management of patient data for medical practices
Anonymous
To answer for @JonathanMusso, he has done freelance web design, but is currently in a Rails Bootcamp. He is learning Ruby and Rails. I THINK he has a client already for a rails app, but I am not sure. Otherwise he does not have a job powered by Ruby
13:26
@user2792268 i am in the medical field as well...
I think most hobbyist programmers still have goals in mind so it is not like watching TV
It is like saying your hobby is home improvement
For example, I made an Arduino powered button for my dog that activates a laser pointer attached to a servo for her to chase
TIL dogs chase laser pointers
Anonymous
Yeah, I want to get to the point of being hobbyist where I build my own things, but I am taking it slow. I have a list of goals though... In no order: (1) Rails Tutorial book, (2) FreeCodeCamp (MEAN stack), (3) Linux Bible (learn sysadmin stuff).
Anonymous
@Cereal You didn't know? They chase bright light spots, too... It is something with enough contrast that looks different for them, and they want to play. Same with cats... And small children
@JoelL medicine could really use a hand from technology, but most doctors don't have the time. At the risk of increasing my competition, I suggest finding a doctor who is tech savvy and has a bit of vision and asking them how their life could be made easier
13:29
@HunterStevens I know cats, didn't know dogs
never tried
If you can find something that reduces the time they spend on paperwork, you can sell it to them at half the cost reduction and congratulations you are now self-employed
speaking of animals
Anonymous
@user2792268 Yeah, doctors and practices would rather use the stoneage software OR already-made iPad apps
Anonymous
what is the link of? I am at work
@user2792268 i write code for a EMR company
13:30
It's a crow riding a windshield wiper
not looking to start my own business at the moment
is that Electromagnetic radiation EMR or med record EMR?
med record
haha well then we're competitors
Anonymous
I work in telecom, where most of my code/tests is for a webapp that lets customers configure their office phones and stuff
13:33
@HunterStevens xD
When I code for fun, it's totally like watching TV. I write a parser for FORTRAN 77. Or something else equally useless.
One function
o.o
Anonymous
Minified js?
@user2792268 Pardon my manners... I forgot to say: Welcome!
Cobol =D
13:36
@WayneConrad glad to be here
Anonymous
@user2792268 when you get the chance, customize your stack overflow profile/name. The one you have now is based on your userid
I actually kinda like it
Sweet jesus
My physical presence isn't so lacking that my online presence needs to be "xXxThunderGodxXx"
I guess it might make me easier to refer to though, so there is that
It's late (at least where I am), goodnight all
@user2792268 The only problem is that userNNNNNNNN carries the connotation of incompetence. So when you came rolling in all scientific and stuff I was just all:
'night
13:41
@user2792268 g'nite. I hope to see you back again, no matter what username you have.
Anonymous
@user2792268 That looks familiar... I think I have seen that on PSN.
Anonymous
@CuddleBunny Exactly, Most users that keep the default name are throwaway accounts with spam or questions that are SPOONFEED ME EVERYTHING
@WayneConrad what kind of code do you write for your job?
I have a ruby project with spec folder. I want to run all spec files except a particular file.

How can i skip or run that file after all others?

I am using rspec.
Anonymous
TIL that creating a gist with *.csv and appropriate data, it becomes a searchable spreadsheet
Neat
Anonymous
This is GREAT because my boss wants the data in an easy to read way. I created tmp CSV files in my program and pasted into gist, figuring I can just open it up in libre office. Well, now he can see the results formatted richly too
@JoelL At this job, data transformation. Fetch data from the web, reshape it, and write it to a database.
Is that like data scraping?
@vjdhama Rspec has an --exclude-pattern switch that might help.
14:01
@WayneConrad thanks. I'll take a look.
It's good to see people writing tests.
Anonymous
I hear a lot of people using Python for data scraping lately... Or web crawling.
I think that Perl must be good at data scraping also.
Anonymous
What IS data scraping? Just reading a webpage and taking data based on surrounding text or HTML elements?
14:19
@HunterStevens pretty much
sometimes feeds too
Anonymous
Interesting... It seems inefficient. Feeds seem better, IMO.
or even image files
with OCR
Anonymous
OCR is amazing.
it is
I had to do some data scraping in an e-learning course because the talent department always gets the short end of the stick and HR wouldn't place some data they needed in a feed so we needed to scrape it from an intranet page
Anonymous
a course about e-learning? Or an online course?
14:25
a course on their intranet talent website
Anonymous
oh so it is not open to the public?
sometimes it is
Anonymous
Oh okay. What language did they focus on?
it was actually for car tires
Anonymous
LOL
14:27
learning about how they are designed
Anonymous
I would just watch "how it's made" for that
and how to compare their brand to others, sales stuff
I hate that show. It makes time disappear.
Anonymous
It is a great show to fall asleep to, especially when it is the normal narrator.
You see "Next on How It's Made, <Something Cool>" and proceed to wait 45 minutes for it to actually happen during which you will invariably see something else "worth" waiting for D:
and they never show just one, it is always like a 15 hour marathon of the show
Anonymous
Yes, at night, which makes it a great show to sleep to
14:29
I do courses on just about everything, we have big clients like Coca Cola. I get to learn about a lot of random stuff
Anonymous
By courses do you mean actual courses, or like training modules?
Anonymous
14:41
If I want to require ActiveRecord and mysql2 in my program, do the classes need to be in the program? Like, do I need to copy my models into my program? Thank you
@HunterStevens what is the best way to go about sorting records? Create a custom scope to take all records with name of "example-string" and attach it to a button in my view?
and yap after reading that I do not think I explained it well enough lol
Anonymous
One sec just on a trsin of thought
Anonymous
15:09
To sort records, you can do this with active record: SomeModel.all.sort, where it looks at the id by default. Otherwise you can override that by doing include Comparable in the class, and redefining <=>.
Anonymous
Why do you need records sorted? Is this for a model, view, or controller?
15:20
Avoid SomeModel.all.sort; it reads every record and then sorts them. Better, usually, is to make the database do the sorting using the #order modifier on a query.
@HunterStevens most of them are training modules, but some of them are administered in a classroom setting either at a company or in a school
I also like to sort records client side. Because I don't have to pay for client CPU cycles :)
Haha! Good point.
@HunterStevens It's for the view, need to sort by vehicle manufacturer
Anonymous
Then do what Wayne suggested... Check the Rails Guides for active record dsl and order
Anonymous
@WayneConrad what is the difference, if any, on the view: @tenants.all.sort vs @tenants.(order_operation), where the default sort is to the name of the tenant (not id)
15:35
The difference is in which CPU is going to do the work. The database's, or yours. Also, the database may be able to do it much quicker, if the sort field is indexed.
Anonymous
Which one does database or my cpu?
Anonymous
Database is the order query?
Yes
Anonymous
Is it possible for Rails scopes to be like, where(activity == 0), when activity is a method in the model (not an attribute)
15:55
an attribute is a method on the model...
i would just rename one of them
#where has to work against database columns or expressions. To filter on methods of the model, use #select or #find.
Anonymous
I figured it out.. I just made a method lol
Any tips on running daily ETL jobs heroku postgresql?
 
1 hour later…
17:21
I like this question:
1
Q: Local language and SEO friendly urls in Ruby on Rails 4

AnubixI have problem with renaming urls for local language in Ruby on Rails 4. I am writing all apps (backend) in English, I think its good practise. For frontend I just use local language, but problem is in Rails 4 that I don't know how to rename URls to local language. I have url like this www.websi...

Anonymous
17:51
# Is it possible to make this simpler?
tenant = Tenant.find(id).nil? ? nil : Tenant.find(id)
tenant = Tenant.find(id)
@HunterStevens ^
@Cereal Just beat me to it
Anonymous
irb(main):019:0> tenant = Tenant.find(154576)
  Tenant Load (0.7ms)  SELECT  `tenants`.* FROM `tenants` WHERE `tenants`.`id` = 154576 LIMIT 1
ActiveRecord::RecordNotFound: Couldn't find Tenant with 'id'=154576
Anonymous
THAT is the issue I am having.
Anonymous
Not being able to find an object raises an exception... back to using mysql2 instead, I guess
17:57
Tenant.where(id: id).first
Anonymous
Great thinking!
Anonymous
IDK why my active record script is returning different results than my straight up sql script... I would trust my mysql script better, since it is more thought out
My test suite was taking 3:30 to run. Got it down to a fast subset that runs in 0:15, and the full suite takes 1:00. Yay for the VCR gem!
Anonymous
Our suite is 1 hr about
18:19
That's forever.
Anonymous
18:54
I think my department has 1 year reviews. Assuming so, does anyone have suggestions? This is my first prog job and will be completing my first year in October.
19:14
Try to make a good impression on your peers.
Anonymous
During the review process? Leading up to it? Or all the time?
Anonymous
I am an individual worker and do not often interact with others, unless (90% the time) it is a work question.
All the time but especially leading up
Anonymous
I would say I make a good impression now, because like I said, I do not get involved much, unless work related
Make excuses to impress people.
Anonymous
19:22
I am of least experience.. How do I impress people? They all know the same as I do with tech news and stuff
Anonymous
TIL: Prepending a constant with :: will call the constant at the top most level/namespace.
Impress them with the breadth of your knowledge and by the voracity of your appetite for learning. And always make your strongest effort interpersonally.
I don't think it is right to assume that everyone is up to date on the news. I scroll through approximately 800 headlines a day on my RSS app and my co-workers inform me of cool things all the time
Much of the time people won't talk about something they read because they assume no one else is interested. But if someone brings it up they will jump on the chance.
There are always off-topic things to discuss like movies for example too.
But in the end, if you want to have a strictly all work relationship nothing speaks louder than results.
Yes results are good
If you have in any ways a similar aura at work as you do in chat, I'd hire you
but I'm a cool boss, I think we're an endangered species
19:36
I've only had cool bosses.
Anonymous
@CuddleBunny I read about news heading XYZ in the morning (6:30am). Then around 11am everyone finds out. But Like I said I am mainly busy and do not socialize much, only 1/10 things I ask are "socializing" questions.
Anonymous
@CuddleBunny I really appreciate that, thank you. I do not ask much of others for learning... I research online before asking, unless it is (our) source code specific.
Anonymous
I do not know how my results pan out. I have been steered away from testing (my original tasks) in the past couple months to work on smaller features and tests... or this past month was to create a cron-job ruby script, and now it is to grab/organize some databse info into a CSV
Anonymous
if results = PRs opened, I would say I am not doing well compared to others. If results includes effort, not comparing to others, because IDK how they work or stuff, but I would say I have improved over time since my employment
Improvement is important too, I've had underlings that were by no means good at their job but had improved considerably since starting.
Do your PRs get code reviewed there?
Anonymous
19:46
Our code review process is a yes or no, and if a no things are noted in the PR to change.
I see. I think it will work out, most of the time the first official review is about establishing a base point
A good reviewer will critique where they think you started, where they think you are, and where they think you should be next year and offer advice to help you achieve that.
Anonymous
thanks for the advice everyone.
Anonymous
Are there questions to ask during a 1yr review? If the reviewer does not mention those things, should I ask where he sees my progress?
definitely, it shows you care about being better
The important two are "Where am I now?" and "Where should I be by the next milestone?"
If you get vague answers you can ask what they think your strengths and weaknesses are
Poor reviewers may not have even thought about it that way and forcing them to do so may improve their opinion of you as they're forced to acknowledge your work
Anonymous
20:07
I do not want to sound like I am better than my reviewer, or like I am a know-it-all, or that I am testing them.
Your reviewer may be as new to being a reviewer as you are to being reviewed. The question that C.B. are suggestion are not out of line, and may be very helpful.
Anonymous
Okay, thank you again everyone. I will write these down when I get home.
20:53
Yeah, I don't think you'd offend them unless you went all "But how would you do it any better..."
21:55
The docker page needs a dose of "get to the point"
Anonymous
22:40
hi guys! The author of practicing ruby reads my blog! :D
23:26
@HunterStevens How cool is that!
Anonymous
23:47
he is giving me a lot of advice over twitter DM :-) He is SO nice and patient and helpful

« first day (600 days earlier)      last day (2655 days later) »