Open Side Menu Go to the Top

04-09-2016 , 11:27 PM
If they're going to have this pointer instead of a class member thing, they owe other programmers a more consistent interface. Those pointers should be private and the objects pointed to should be accessed via either a getter or a reference to the class type. If they are expecting other people to deal with their pointer bull**** just to compile faster then I'd say no.

You're also right about the no default move operator problem. That isn't something I run into a lot personally but it's definitely a consideration.

I don't use a lot of smart pointers but I feel like the move/copy problems could be alleviated with them? But then again the reason I don't use them very much is because when you find yourself reaching for one, you've often ****ed up someplace. A reference counting smart pointer could make the default copy behavior again, I think. I don't know about the default move operations. (You wouldn't have a custom destructor though, the smart pointer would handle the object life cycle)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
04-09-2016 , 11:59 PM
Quote:
Originally Posted by RustyBrooks
Those pointers should be private and the objects pointed to should be accessed via either a getter or a reference to the class type. If they are expecting other people to deal with their pointer bull**** just to compile faster then I'd say no.
Yeah, this is what we've waffled on - the members are private obviously, but sometimes our getters return the pointers directly without dereferencing them. I kinda understand that, it feels gross to write "return *pointerName".

I've heard that sentiment about smart pointers from coworkers too (they generally say "it means you don't know what your ownership is"), but I think there's a pretty stark difference between unique_ptr and shared_ptr in that regard:
- shared_ptr can, if abused, very much be a "I don't know who the **** owns this object" crutch - you could basically turn C++ into bizarro C# if you wanted by wrapping everything in one, and then nothing gets deleted until nothing references it anymore. I don't use it very often, except to leverage situations where you can use weak_ptr's relationship with shared_ptr to pass a handle to another object, which is pretty cool.
- unique_ptr, however, makes your object ownership explicit, and enforced by the language. You have to explictly std::move() a unique pointer to transfer its ownership, and the compiler prevents you from copying them.

One thing that's been a little bit of a pain point for us is passing messages allocated with 'new' down asynchronous callback pipelines. The callback basically has to remember to delete the pointer when it's done with it, and if something bad happens and we have to kill the queue that callback is stashed on (it definitely shouldn't, but happens sometimes and we try to recover gracefully) then that memory is just lost. I think in C++14 you can move objects into lambda captures, so that we could use a unique pointer to transfer ownership more explicitly and in a way where the callback's removal guarantees freeing the memory, whether it ran normally or we killed the queue. But, we're still on C++11.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-10-2016 , 03:49 AM
When you want to test out your new graphing functionality...but it's the middle of the night and nobody's actually trading anything

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-10-2016 , 05:37 AM
@goofyballer - FWIW if I am understanding correctly, I think what you mention about the possibility of a null pointer as a class member ultimately reflects a design that needs improvement as you basically imply.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-10-2016 , 06:28 AM
Quote:
Originally Posted by goofyballer
Yeah, this is what we've waffled on - the members are private obviously, but sometimes our getters return the pointers directly without dereferencing them. I kinda understand that, it feels gross to write "return *pointerName".

I've heard that sentiment about smart pointers from coworkers too (they generally say "it means you don't know what your ownership is"), but I think there's a pretty stark difference between unique_ptr and shared_ptr in that regard:
- shared_ptr can, if abused, very much be a "I don't know who the **** owns this object" crutch - you could basically turn C++ into bizarro C# if you wanted by wrapping everything in one, and then nothing gets deleted until nothing references it anymore. I don't use it very often, except to leverage situations where you can use weak_ptr's relationship with shared_ptr to pass a handle to another object, which is pretty cool.
- unique_ptr, however, makes your object ownership explicit, and enforced by the language. You have to explictly std::move() a unique pointer to transfer its ownership, and the compiler prevents you from copying them.

One thing that's been a little bit of a pain point for us is passing messages allocated with 'new' down asynchronous callback pipelines. The callback basically has to remember to delete the pointer when it's done with it, and if something bad happens and we have to kill the queue that callback is stashed on (it definitely shouldn't, but happens sometimes and we try to recover gracefully) then that memory is just lost. I think in C++14 you can move objects into lambda captures, so that we could use a unique pointer to transfer ownership more explicitly and in a way where the callback's removal guarantees freeing the memory, whether it ran normally or we killed the queue. But, we're still on C++11.
A classic code coupling issue with the design where the coupling is too tight FWIW.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-10-2016 , 05:33 PM
anyone have any thoughts on rxjs? I got a prag prog book on it and have been picking away at it but the learning curve is significant. Just learning the lib is a challenge let alone learning a new approach to modeling programs.

http://xgrommx.github.io/rx-book/con...ods/index.html

130 some instance methods on observables and theres a lot more pieces to the lib than just observables...

not going to stop learning just wondering if anyone has any experience with it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-11-2016 , 11:28 AM
Quote:
Originally Posted by fruit snacks
anyone have any thoughts on rxjs? I got a prag prog book on it and have been picking away at it but the learning curve is significant. Just learning the lib is a challenge let alone learning a new approach to modeling programs.

http://xgrommx.github.io/rx-book/con...ods/index.html

130 some instance methods on observables and theres a lot more pieces to the lib than just observables...

not going to stop learning just wondering if anyone has any experience with it.
I've worked with rxjava which I assume is same api. How good is your JS? Are you writing server side stuff? If you're a node guy it makes sense. If you want to learn reactive programming pick your favorite language with a Rx implemention and write a web service with it.

It helps to have some experience (pain) with scale issues to motivate the need for it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-11-2016 , 12:03 PM
rxjs is too far down the functional rabbit hole for me. I think there's a real possibility of becoming a rxjs developer instead of a javascript developer.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-11-2016 , 03:06 PM
Quote:
Originally Posted by muttiah
How good is your JS? Are you writing server side stuff? If you're a node guy it makes sense.
I'm ok but don't work as a programmer so I sort of hit a steady state of knowledge since the js community moves so fast. I do more of the classic css/jquery type stuff and donk around in real programming because I hope to one day get a better job.

Why do you say you see it being more useful for node? It should help anywhere there is asynch code but currently the front end nerds seem to think it solves alot of their problems. The example of writing drag and drop code with rxjs is pretty impressive imo. So much nicer than managing a bunch of state variables.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 01:40 PM
My google foo and sql foo are failing me. Giving the following data:

user | account
1 | A
1 | A
1 | A
2 | B
2 | C
2 | C

How do I write a query that will return
2 | B
2 | C

and where would the question mark go in that last clause?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 01:45 PM
It's not clear what you're trying to accomplish
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 01:51 PM
I used XCode today. It is strange.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 01:53 PM
I'm trying to find users with multiple accounts in a file of monthly account records. Think of a file of monthly bills for Netflix, I'm looking for users with multiple Netflix accounts. This is where I'm at but it's not filtering out single user/account pairs.

Code:
select distinct(account_id), customer_id from netflix group by account_id, customer_id having count(customer_id) > 1 order by customer_id;
Probably requires some kind of join which is where my SQL pretty much runs out.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 02:09 PM
goofy were you able to try any of my suggestions wrt to the https module or switching to superagent?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 02:16 PM
This should work

Code:
select user, account from netflix 
where user in (
    select user from netflix group by user having count(distinct account) > 1
) 
group by user, account;
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 02:18 PM
If you just want to know which users have multiples, though, just do this
select user, count(distinct account) from netflix group by user having count(distinct account) > 1
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 02:20 PM
Quote:
Originally Posted by kerowo
My google foo and sql foo are failing me. Giving the following data:

user | account
1 | A
1 | A
1 | A
2 | B
2 | C
2 | C

How do I write a query that will return
2 | B
2 | C

and where would the question mark go in that last clause?
http://ideone.com/zSd2tp

Code:
SELECT DISTINCT *
FROM Accounts INNER JOIN (
  SELECT user
  FROM (
    SELECT *
    FROM Accounts
    GROUP BY user, account
  ) temp1
  GROUP BY user
  HAVING COUNT(*) > 1
) temp2 ON temp2.user = Accounts.user;
May be an easier way, but that works... Also note you'd need to change the "*" on the temp1 query to "user, account" explicitly if you have more columns

Last edited by gaming_mouse; 04-12-2016 at 02:27 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 03:37 PM
Thanks guys I'll play with these after I recover from lunch chicken and waffle coma.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 04:14 PM
Quote:
Originally Posted by suzzer99
goofy were you able to try any of my suggestions wrt to the https module or switching to superagent?
Yeah - I added error handling to the request and my site's been running since Sunday with no issues. Thanks!

I'm trying to do as much as I can (within reason) on my own - so far my only dependencies are express, moment-timezone (doing a lot of date manipulation), mongojs, plotly (for making graphs), and socket.io.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 05:04 PM
Cool
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 08:58 PM
Don't think this is real but lol anyway: Recovering from a rm -rf /

Still doesn't beat setting up a 301 redirect from your company's home page to lemonparty and locking everyone out of fixing it for a few days.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-12-2016 , 11:47 PM
Anyone have a problem with this method of changing an object property's name?

Code:
responseBody.data = responseBody.apiResponse;
delete responseBody.apiResponse;
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-13-2016 , 02:00 AM
Quote:
Originally Posted by suzzer99
Don't think this is real but lol anyway: Recovering from a rm -rf /

Still doesn't beat setting up a 301 redirect from your company's home page to lemonparty and locking everyone out of fixing it for a few days.
Lol this is great, thanks.


In like my 2nd month at my last company, I dont remember what command I did but it was pretty close to that on my own comp and wiped out half of my files. It was pretty embarrassing as the newest dev to have to ask the tech guy for help on that one
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-13-2016 , 09:02 AM
JC, this tech interview loop thing is pretty exhausting, 3 done, 2 more to go!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-13-2016 , 10:11 AM
Quote:
Originally Posted by PJo336
Lol this is great, thanks.


In like my 2nd month at my last company, I dont remember what command I did but it was pretty close to that on my own comp and wiped out half of my files. It was pretty embarrassing as the newest dev to have to ask the tech guy for help on that one
In the mists of time, at my first job, we did not use any kind of source control. Our deploy process was
rm -rf deploy_dir; rsync dev_dir/ deploy_dir/
and I got it backwards one time.

We deployed often, so fortunately we did not lose that much. And for some weird reason I had a coworker who liked to print out a lot of our code to look at, so we actually had *paper backups* of a lot of it. We all typed in changes from the paper, even the secretary and our founder.

Took a while to live that one down.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m