Coding: Fleeting Thoughts

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
felltir
has a sniper scope and a trigger finger.
Posts: 2493
Joined: Tue Mar 04, 2008 5:01 pm UTC
Location: Back in't home town. Never at home.
Contact:

Re: Coding: Fleeting Thoughts

Postby felltir » Sat Feb 14, 2015 10:16 pm UTC

firechicago wrote:
felltir wrote:As a programmer who lives in central London, I can give you a pretty good idea of what you should expect?

I'd expect a junior programmer to be on 25-30, mid level 35 - 45, senior 50+. All in £1000s.

Wow, I'm a little surprised that salaries for programmers are so much lower in the UK than the US. Programmer salaries in even a second-tier US city (Boston, Chicago, Austin, etc.) are substantially higher, and salaries in New York or San Francisco/Silicon Valley would easily be double that. And it's not like living in London is so cheap comparatively.


This is as a salaried programmer. Doubling that should be pretty easy as a contractor.
Spoiler:
RoadieRich wrote:He's a super flexible furry martial artist from London. She is a Rabbit breeding mad scientist from Michigan. They fight crime!
The Great Hippo wrote:I THINK THE SOLAR SYSTEM MIGHT BE AN ATOM OF OXYGEN.


Blog

he/him/his

User avatar
Yakk
Poster with most posts but no title.
Posts: 11128
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby Yakk » Sun Feb 15, 2015 4:14 am UTC

There is a reason London is not a global tech center.

The UK is also substantially poorer than the USA. Both average and medians. Median UK household income is about 2/3 of USA at ppp.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
Link
Posts: 1407
Joined: Sat Mar 07, 2009 11:33 am UTC
Location: ᘝᓄᘈᖉᐣ
Contact:

Re: Coding: Fleeting Thoughts

Postby Link » Sun Feb 15, 2015 5:52 pm UTC

Quick Python 3/PySide question: Python 3 has arbitrary-precision integers, while any integers used with PySide have a limited allowed range (presumably INT_MIN to INT_MAX as defined in limits.h) -- so is there actually any good way to find these limiting values in a Python+PySide program? (By "good", I mean at least portable and efficient.)

User avatar
PM 2Ring
Posts: 3713
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Coding: Fleeting Thoughts

Postby PM 2Ring » Mon Feb 16, 2015 3:17 am UTC

Try sys.maxsize. On my system that has a value of 2147483647 == 231 - 1, but I'm still using Python 2.

Nyktos
Posts: 138
Joined: Mon Mar 02, 2009 4:02 pm UTC

Re: Coding: Fleeting Thoughts

Postby Nyktos » Mon Feb 16, 2015 4:12 am UTC

I get 9223372036854775807 (2^63 - 1) on both Python 2 and 3.

Some digging finds that sys.maxsize is PY_SSIZE_T_MAX which is platform-dependant and definitely not always the same as INT_MAX.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Mon Feb 16, 2015 4:12 am UTC

That'll give you something akin to INT_MAX, but that doesn't get you INT_MIN, or the bounds of any of the other integer types...

There seems to be some magical internal module that's part of ctypes called _testcapi (used in some of the ctypes tests), which includes INT_MAX and friends... but that's obviously not ideal, since it's an undocumented internal module (and specific to CPython, so not really portable).

I'm surprised it's not available as a public part of ctypes, like a property of ctypes.c_int or something...

If you want to estimate, you can go:

Code: Select all

INT_MAX = (1<<(8*ctypes.sizeof(ctypes.c_int)-1))-1
INT_MIN = -INT_MAX - 1
but then you're assuming two's complement and CHAR_BIT==8... but still more portable than just hardcoding 2**63-1...

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
Jplus
Posts: 1721
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Coding: Fleeting Thoughts

Postby Jplus » Mon Feb 16, 2015 9:13 am UTC

firechicago wrote:
felltir wrote:As a programmer who lives in central London, I can give you a pretty good idea of what you should expect?

I'd expect a junior programmer to be on 25-30, mid level 35 - 45, senior 50+. All in £1000s.

Wow, I'm a little surprised that salaries for programmers are so much lower in the UK than the US. Programmer salaries in even a second-tier US city (Boston, Chicago, Austin, etc.) are substantially higher, and salaries in New York or San Francisco/Silicon Valley would easily be double that. And it's not like living in London is so cheap comparatively.

I was surprised by this, too. As far as I can tell these salaries are not any higher than those in the Netherlands, even though life in London is considerably more expensive than life anywhere in the Netherlands. I'm definitely not moving to London. :P
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
Diadem
Posts: 5654
Joined: Wed Jun 11, 2008 11:03 am UTC
Location: The Netherlands

Re: Coding: Fleeting Thoughts

Postby Diadem » Mon Feb 16, 2015 1:06 pm UTC

Jplus wrote:
firechicago wrote:
felltir wrote:As a programmer who lives in central London, I can give you a pretty good idea of what you should expect?

I'd expect a junior programmer to be on 25-30, mid level 35 - 45, senior 50+. All in £1000s.

Wow, I'm a little surprised that salaries for programmers are so much lower in the UK than the US. Programmer salaries in even a second-tier US city (Boston, Chicago, Austin, etc.) are substantially higher, and salaries in New York or San Francisco/Silicon Valley would easily be double that. And it's not like living in London is so cheap comparatively.

I was surprised by this, too. As far as I can tell these salaries are not any higher than those in the Netherlands, even though life in London is considerably more expensive than life anywhere in the Netherlands. I'm definitely not moving to London. :P

They are a bit higher aren't they? A typical junior programmer here would make somewhere between 2000 and 2500 a month. Add to that a 13th month and 8% holiday pay and you get €28K - €35K, which is £21K - 26K. Considering how much more expensive living in London is, it's probably still not worth it to move there though.

The US though. I'm always quite flabbergasted by salaries for programmers in the US. Paying 100K a year to someone fresh out of college, and that's with lower taxes too. Of course your secondary benefits are much worse, but a factor 3 pay difference more than makes up for that.

Maybe I should move to California.
It's one of those irregular verbs, isn't it? I have an independent mind, you are an eccentric, he is round the twist
- Bernard Woolley in Yes, Prime Minister

User avatar
Yakk
Poster with most posts but no title.
Posts: 11128
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby Yakk » Mon Feb 16, 2015 3:09 pm UTC

And that is why California is a tech center.

Because the salaries are high enough that people on the other side of the world who are good at programming think "maybe I should uproot my entire life and move to California".

There are downsides. The property values are ridiculous in the area, possibly even compared to London. (The areas lack decent transit like London has) Small modest suburban homes going for well over a million.

I know a bunch of rather smart people who got lured by both the money, and the implications of the money -- that what you are doing is going to be taken seriously and treated as valuable, and you will be working with lots of people who where lured by the same stuff -- to google, microsoft, adobe, amazon, youtube, etc. Nobody to facebook that I know of.

On the other hand, most everyone I know who made that jump where above par programmers. So maybe you aren't up to snuff. :p~
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
Quercus
Posts: 1806
Joined: Thu Sep 19, 2013 12:22 pm UTC
Location: London, UK
Contact:

Re: Coding: Fleeting Thoughts

Postby Quercus » Mon Feb 16, 2015 3:19 pm UTC

I think what California is to tech, London is to finance - the reason London looks unattractive to programmers is that tech is a secondary business here. The people employing the best people and paying the best money in tech are in California, just as the people employing the best people and paying the best money in finance are in London. I'm pretty sure that investment bankers would consider California to be a less attractive destination than London.

User avatar
Diadem
Posts: 5654
Joined: Wed Jun 11, 2008 11:03 am UTC
Location: The Netherlands

Re: Coding: Fleeting Thoughts

Postby Diadem » Mon Feb 16, 2015 3:36 pm UTC

Yakk wrote:And that is why California is a tech center.

So is Eindhoven, yet salaries here aren't through the roof. So "It's a tech center" can't be the only explanation for high salaries.


Yakk wrote:There are downsides. The property values are ridiculous in the area, possibly even compared to London. (The areas lack decent transit like London has) Small modest suburban homes going for well over a million.

Are you sure that's correct? I did some googling, and it looks like those 1 million dollar homes are anything but small. Detached, 4 bedrooms, multiple bathrooms homes with huge backyards. A million is still steep for a house like that, but something similar would probably be at least half a million over here as well, even in less popular neighborhoods.

I'd say Californian housing prices are about 50%-100% what they are here. Still a good deal, considering the huge difference in wages.

As an aside: Why the hell are there so many houses with more bathrooms than bedrooms? You have separate bathrooms for people sleeping in the hallway?
It's one of those irregular verbs, isn't it? I have an independent mind, you are an eccentric, he is round the twist
- Bernard Woolley in Yes, Prime Minister

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Coding: Fleeting Thoughts

Postby EvanED » Mon Feb 16, 2015 4:56 pm UTC

Diadem wrote:Are you sure that's correct? I did some googling, and it looks like those 1 million dollar homes are anything but small. Detached, 4 bedrooms, multiple bathrooms homes with huge backyards. A million is still steep for a house like that, but something similar would probably be at least half a million over here as well, even in less popular neighborhoods.
Depends the specific area. For example, when you get into Silicon Valley proper, Yakk is pretty much spot on.

If I go to Zillow, uncheck 'potential listings' and 'for rent' and choose 'house' for home type and ignore auctions, then:

  • In Palo Alto, literally the cheapest listing they have is $1,498,000 for a 2 bed, 2 bath, 1,290 sqft house on a 5,749 sqft lot
  • In Sunnyvale, the cheapest is a 3 bed, 1 bath for $700K; that's 1,027 sqft on a 4,965 sqft lot, so smaller than the previous
  • In Sunnyvale, the cheapest with 3 bad, 2 bath is $800K and the square footage is still smaller than the Palo Alto one (1,070 sqft)
  • In Sunnyvale, $1M gets you 3 bed, 2/3 bath, and approaching 2,000 sqft; that's fairly comfortably sized for most people, but I also wouldn't call it "big" by any stretch for a family
  • In Santa Clara, things are a little cheaper than Sunnyvale, but you still need $800K to get above 1,200 sqft
  • In Mountain View, there are a handful of incredibly-suspicious low prices (some are in 55+ communities, another is a mislisted apartment), but other than those the cheapest listing is $995K; that only gets you 3 bed, 1 bath, and 1,150 sqft

There are some cheaper areas, particularly in the east bay, but they are a lot less desirable for a number of reasons

Why the hell are there so many houses with more bathrooms than bedrooms? You have separate bathrooms for people sleeping in the hallway?
Edit: By-and-large I think it's silly too, but there are fairly reasonable ways to wind up with it, especially in places with basements. Suppose you have a 3-bed house where the bedrooms are all on the upper floor. If you have a master bathroom, another upper-floor bath for the other two bedrooms and a ground-floor bathroom; you're already at 3-bed 3-bath. I suspect most families with two kids who have the financial means to actually get a house would consider this as a minimum. (Maybe "most" wouldn't demand a master bath, but many would.) If you add a finished basement and put a bathroom down there too, you're at 3-bed, 4-bath. You could also get there if the two upstairs bedrooms have "his/her" bathrooms.

User avatar
Yakk
Poster with most posts but no title.
Posts: 11128
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby Yakk » Mon Feb 16, 2015 5:25 pm UTC

Diadem wrote:
Yakk wrote:And that is why California is a tech center.

So is Eindhoven, yet salaries here aren't through the roof. So "It's a tech center" can't be the only explanation for high salaries.

Eindhoven is on the wrong scale to compare.

Sure, you get some tech firms -- put a good technical university, and you can seduce the kids to not move far and grab local jobs where they are familiar. Attract locals who don't want to leave the country, and people from poorer countries who will take the massive QoL increase.

The US west coast is having demographic shifts due to programmer immigration in multi-million population regions.
As an aside: Why the hell are there so many houses with more bathrooms than bedrooms? You have separate bathrooms for people sleeping in the hallway?

Half-baths on main floor and/or basement? Add a private bath for each bedroom?

Just a guess.

The thing about SF having a hotter home market than London was ... well, probably wrong. :)
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
Diadem
Posts: 5654
Joined: Wed Jun 11, 2008 11:03 am UTC
Location: The Netherlands

Re: Coding: Fleeting Thoughts

Postby Diadem » Mon Feb 16, 2015 6:39 pm UTC

Why the hell would you need a bathroom in the basement? How often do you find yourself suddenly in such a dire need of a shower? And do you then walk up 2 flights of stairs naked and wet, or do you have robots to bring you a towel and fresh clothes?

I know I'm being snide, but I'm honestly confused. I can see the advantage of 2 bathrooms if you have kids. But to me anything more than that would add negatively to the utility of the house - it's more places to clean.
It's one of those irregular verbs, isn't it? I have an independent mind, you are an eccentric, he is round the twist
- Bernard Woolley in Yes, Prime Minister

speising
Posts: 2353
Joined: Mon Sep 03, 2012 4:54 pm UTC
Location: wien

Re: Coding: Fleeting Thoughts

Postby speising » Mon Feb 16, 2015 6:42 pm UTC

is it possible that "bathrooms" includes toilet only rooms?

User avatar
Sizik
Posts: 1255
Joined: Wed Aug 27, 2008 3:48 am UTC

Re: Coding: Fleeting Thoughts

Postby Sizik » Mon Feb 16, 2015 8:01 pm UTC

speising wrote:is it possible that "bathrooms" includes toilet only rooms?

Which is exactly what a "half-bathroom" is.
she/they
gmalivuk wrote:
King Author wrote:If space (rather, distance) is an illusion, it'd be possible for one meta-me to experience both body's sensory inputs.
Yes. And if wishes were horses, wishing wells would fill up very quickly with drowned horses.

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Coding: Fleeting Thoughts

Postby EvanED » Mon Feb 16, 2015 8:08 pm UTC

speising wrote:is it possible that "bathrooms" includes toilet only rooms?
Ding ding ding.

This is why you have to look at the full description. When you just see something like "3 bed, 3 bath", it's likely that the "3 bath" includes incomplete bathrooms, because "3 bed, 1 full path, 1 3/4 bath, 1 1/2 bath" is too long and too focused on details. If you want to know the breakdown, you can look at the description or the more detailed table about what the listing has.

User avatar
Quercus
Posts: 1806
Joined: Thu Sep 19, 2013 12:22 pm UTC
Location: London, UK
Contact:

Re: Coding: Fleeting Thoughts

Postby Quercus » Mon Feb 16, 2015 9:10 pm UTC

"3/4 bath" ? You've done strange things to the language on your side of the pond - what is wrong with just calling it a shower room?

Also, shouldn't that be 2.25 bath?

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Coding: Fleeting Thoughts

Postby EvanED » Mon Feb 16, 2015 10:22 pm UTC

Quercus wrote:"3/4 bath" ? You've done strange things to the language on your side of the pond - what is wrong with just calling it a shower room?
I'll admit that "3/4 bath" is a bit of a misnomer, but "shower room" over here would usually be used for something with only a shower. But in our defense, would you call what we call a full bath a "toiletbathshowersinkroom"? The name can't perfectly reflect the contents. "Bathroom" here has come to mean where you go to relieve yourself, not where you go to take a bath, which is why even public restrooms with now bathing capabilities at all are more often called "bathrooms" (or why people will say "I'm going to go to the bathroom" sometimes even if you're on a hike miles from the nearest structure).

Also, shouldn't that be 2.25 bath?
In that case, maybe. But more generally that doesn't work so well. Take a house with one full bath and two half baths. For most shoppers, I suspect a distinction between that and a house with two full baths (1 + 1/2 + 1/2 = 2 bath) is more useful to make than between that and one with, say, three full baths; using the same description (3 bath) for the topmost summary of 1+1/2+1/2 and 1+1+1 makes sense.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Mon Feb 16, 2015 10:42 pm UTC

Sizik wrote:
speising wrote:is it possible that "bathrooms" includes toilet only rooms?

Which is exactly what a "half-bathroom" is.

It's called that because you can only bathe half of yourself at a time in a toilet.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
Quercus
Posts: 1806
Joined: Thu Sep 19, 2013 12:22 pm UTC
Location: London, UK
Contact:

Re: Coding: Fleeting Thoughts

Postby Quercus » Mon Feb 16, 2015 10:42 pm UTC

EvanED wrote:
Quercus wrote:"3/4 bath" ? You've done strange things to the language on your side of the pond - what is wrong with just calling it a shower room?
I'll admit that "3/4 bath" is a bit of a misnomer, but "shower room" over here would usually be used for something with only a shower. But in our defense, would you call what we call a full bath a "toiletbathshowersinkroom"? The name can't perfectly reflect the contents. "Bathroom" here has come to mean where you go to relieve yourself, not where you go to take a bath, which is why even public restrooms with now bathing capabilities at all are more often called "bathrooms" (or why people will say "I'm going to go to the bathroom" sometimes even if you're on a hike miles from the nearest structure).


I'd forgotten about that euphemism, that makes more sense now. Rooms with just a shower are quite rare in the UK, at least in domestic settings, so they don't have their own word (in say a gym they would just be referred to as "the showers"). The UK equivalents would be toilet, shower room and bathroom for 1/2, 3/4 and full respectively.

Also, shouldn't that be 2.25 bath?
In that case, maybe. But more generally that doesn't work so well. Take a house with one full bath and two half baths. For most shoppers, I suspect a distinction between that and a house with two full baths (1 + 1/2 + 1/2 = 2 bath) is more useful to make than between that and one with, say, three full baths; using the same description (3 bath) for the topmost summary of 1+1/2+1/2 and 1+1+1 makes sense.


I agree - I was just having a bit of fun. I played around for a second with suggesting the use of something like the octal numeric code for Unix permissions, but couldn't immediately come up with one that would work for arbitrary numbers of bathrooms.

User avatar
Flumble
Yes Man
Posts: 2249
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: Coding: Fleeting Thoughts

Postby Flumble » Mon Feb 16, 2015 10:45 pm UTC

So buying a house with "2 bathrooms" can actually turn out to be 3 toilets and 4 sinks in a garage?

phlip wrote:
Sizik wrote:
speising wrote:is it possible that "bathrooms" includes toilet only rooms?

Which is exactly what a "half-bathroom" is.

It's called that because you can only bathe half of yourself at a time in a toilet.

Oh you! :lol:

speising
Posts: 2353
Joined: Mon Sep 03, 2012 4:54 pm UTC
Location: wien

Re: Coding: Fleeting Thoughts

Postby speising » Mon Feb 16, 2015 10:48 pm UTC

phlip wrote:
Sizik wrote:
speising wrote:is it possible that "bathrooms" includes toilet only rooms?

Which is exactly what a "half-bathroom" is.

It's called that because you can only bathe half of yourself at a time in a toilet.

still unneccessary luxury for this guy: http://lifehacks.stackexchange.com/ques ... ut-bathing

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Tue Feb 17, 2015 12:04 am UTC

10/3+2i bedrooms, √5 bathrooms, lovely view of R'lyeh, all for the cost of 2d10 sanity points.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Link
Posts: 1407
Joined: Sat Mar 07, 2009 11:33 am UTC
Location: ᘝᓄᘈᖉᐣ
Contact:

Re: Coding: Fleeting Thoughts

Postby Link » Tue Feb 17, 2015 6:16 pm UTC

You, sir, name? wrote:10/3+2i bedrooms, √5 bathrooms, lovely view of R'lyeh, all for the cost of 2d10 sanity points.

Huh, I didn't know The PHP Group had expanded into property development.

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 6579
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Coding: Fleeting Thoughts

Postby Thesh » Thu Feb 19, 2015 1:04 am UTC

I've actually been considering moving to Canada; I haven't done the math on salary and cost of living though. Not having to worry about healthcare if I lose my job is one of my biggest concerns.
Summum ius, summa iniuria.

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: Coding: Fleeting Thoughts

Postby ahammel » Thu Feb 19, 2015 2:23 am UTC

Thesh wrote:I've actually been considering moving to Canada; I haven't done the math on salary and cost of living though. Not having to worry about healthcare if I lose my job is one of my biggest concerns.
The biggest tech centres have preposterous rent, unfortunately, and nobody is paying Palo Alto salaries.

Socialised medicine is nice, though.
He/Him/His/Alex
God damn these electric sex pants!

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 6579
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Coding: Fleeting Thoughts

Postby Thesh » Thu Feb 19, 2015 2:38 am UTC

I own here, would rent if I moved. The other option is Colorado, where I'm looking at $1800/mo to rent a house, and am expecting to make closer to $95k-$105k for a senior developer role, and shouldn't see much of a difference in my quality of life after taking into account the lower cost of living in other areas.
Summum ius, summa iniuria.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Thu Feb 19, 2015 4:46 am UTC

So... let's tell a story, of a company that wanted to sell some ad space. But they didn't want to provide ad space on their own website... they wanted to be able to run their ads on all kinds of websites. So they wrote a program they could put on people's computers to inject ads into whatever web page they happened to be looking at.

But then they found out about HTTPS, and how that would stop their ads from appearing - how could they inject their ads into an encrypted channel? Well, that's easy enough - you trick the browser into encrypting its messages with your own certificate, instead of the server's, so you can decrypt it and make your changes. But how do you get the browser to accept your certificate, without complaining? Simple - you just install it as a trusted root certificate with all permissions into the OS, so that everything running on that computer will consider you to be the Ultimate Authority on... pretty much everything.

And so, satisfied that it had managed to put its ads everywhere they wanted, this happy little company sent its program on every computer they sold, causing untold numbers of stability problems and security holes.

If this story sounds ridiculous... well, you may just be familiar with Lenovo Group.

(hat tip to Aaeriele and Xanthir who I saw this from on Twitter...)

[edit] Bonus terrible: Apparently the root cert that this installs is the same for every installation... so if you extracted the private key from the software (which wouldn't be that hard) you can sign something that will be accepted by any Lenovo computer that had this thing installed. Also, the root cert doesn't get removed when you uninstall the software.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
Diadem
Posts: 5654
Joined: Wed Jun 11, 2008 11:03 am UTC
Location: The Netherlands

Re: Coding: Fleeting Thoughts

Postby Diadem » Thu Feb 19, 2015 10:21 am UTC

You're so negative phlip.
Lenovo spokesperson wrote:To be clear, Superfish comes with Lenovo consumer products only and is a technology that helps users find and discover products visually. The technology instantly analyzes images on the web and presents identical and similar product offers that may have lower prices, helping users search for images without knowing exactly what an item is called or how to describe it in a typical text-based search engine.

The Superfish Visual Discovery engine analyzes an image 100% algorithmically, providing similar and near identical images in real time without the need for text tags or human intervention. When a user is interested in a product, Superfish will search instantly among more than 70,000 stores to find similar items and compare prices so the user can make the best decision on product and price.

See, they are not doing this to sell adds! They are doing this to help their customers make the best choices possible!
It's one of those irregular verbs, isn't it? I have an independent mind, you are an eccentric, he is round the twist
- Bernard Woolley in Yes, Prime Minister

User avatar
Flumble
Yes Man
Posts: 2249
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: Coding: Fleeting Thoughts

Postby Flumble » Thu Feb 19, 2015 12:22 pm UTC

Oooh, I like these guys: complete disregard for any form of privacy, integrity, security and ethics.
Where can I apply? :D

To be fair, I don't really like the security risks. Everything should be routed through Lenovo to better guarantee consumer safety (no signing keys on their computer to be misused by hackers) and the software should be installed at a lower level, like a rootkit. It would be awful if a customer accidentally removes the program and his/her computer experience can't be guaranteed.

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 6579
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Coding: Fleeting Thoughts

Postby Thesh » Thu Feb 19, 2015 6:41 pm UTC

Nothing like completely undermining security for the sake of making a buck.
Summum ius, summa iniuria.

User avatar
Xeio
Friends, Faidites, Countrymen
Posts: 5101
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\
Contact:

Re: Coding: Fleeting Thoughts

Postby Xeio » Fri Feb 20, 2015 3:29 pm UTC

Code: Select all

return did = didDictionary[index].Values.ToList()[0]

Well, at first I was just wondering why you would assign to a local variable in a return statement.

But honestly, the Dictionary of Dictionary manipulation is quite worth of its own special moment of WTF.

Also, I did not know you could use a List<int> as a dictionary key. But don't worry, they're not actually using it like a key, they're getting the keys, turning them into a list (hah, already a list, they win), and doing a .Contains to check if the value is in the key list.

User avatar
Xanthir
My HERO!!!
Posts: 5413
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Coding: Fleeting Thoughts

Postby Xanthir » Sat Feb 21, 2015 3:42 am UTC

What's wrong with a dictionary of dictionaries? Nesting data structures is quite basic; it's literally just a tree.

This particular code looks verbose and indirect, but maybe that's because whatever language you're using has silly restrictions on how you can access dictionary values, I dunno.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Sat Feb 21, 2015 10:29 pm UTC

Unless partial application is actually adding some value to your code, composite keys are generally a cleaner solution in my opinion.

Assuming we're talking hash maps, it's also relatively easy to end up with pathological scenarios where you squander a metric fuck-ton of memory on leaf nodes with only one or two entries in them. You also almost always end up performing more reallocation/restructuring operations.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Xanthir
My HERO!!!
Posts: 5413
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Coding: Fleeting Thoughts

Postby Xanthir » Sun Feb 22, 2015 1:00 am UTC

"Partial application" really is pretty common, though. I'll often have nested dicts in Python, where I loop over the higher-level dict, doing work on each entry as well as looping over the nested dict.

I agree that if every use is just two nested loops without any special work done per outer iteration, it's make-work and you should simplify your design. Maybe that's what's happening here; it's impossible to tell from the single line of code.

Worrying about my memory usage is something to be done in a memory profiler afterwards, not something that should twist my code decisions while I'm writing.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Sun Feb 22, 2015 12:09 pm UTC

Xanthir wrote:"Partial application" really is pretty common, though. I'll often have nested dicts in Python, where I loop over the higher-level dict, doing work on each entry as well as looping over the nested dict.

I agree that if every use is just two nested loops without any special work done per outer iteration, it's make-work and you should simplify your design. Maybe that's what's happening here; it's impossible to tell from the single line of code.


Maybe depends on the problem domain? I encounter them very rarely, and usually start with composite keys as a matter of YAGNI, and move to map-of-map if and only if they provide value.

Xanthir wrote:Worrying about my memory usage is something to be done in a memory profiler afterwards, not something that should twist my code decisions while I'm writing.


Deferring performance considerations is not the same as ignoring them. As a developer, you still need to be aware of performance pitfalls. Profilers will only help you so far, and will usually give you pretty hamfisted advice in performance tuning. Often it's good enough to point you in the right direction, but there are many things it will not be able to tell you (such as wasted hash map internals, but also cache thrashing, false sharing, and so on).
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Xeio
Friends, Faidites, Countrymen
Posts: 5101
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\
Contact:

Re: Coding: Fleeting Thoughts

Postby Xeio » Mon Feb 23, 2015 3:47 am UTC

Xanthir wrote:What's wrong with a dictionary of dictionaries? Nesting data structures is quite basic; it's literally just a tree.

This particular code looks verbose and indirect, but maybe that's because whatever language you're using has silly restrictions on how you can access dictionary values, I dunno.
Well, if you never actually use the second dictionary as a dictionary it's pretty stupid... (never accesses by key, only a single key/value pair per dictionary)

It could have been a dictionary of a Tuple and had the same functionality.

True enough that a dictionary or dictionary isn't bad in and of itself though.

User avatar
Xanthir
My HERO!!!
Posts: 5413
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Coding: Fleeting Thoughts

Postby Xanthir » Mon Feb 23, 2015 7:06 am UTC

Okay, good god, that's indeed terrible.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 6579
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Coding: Fleeting Thoughts

Postby Thesh » Wed Feb 25, 2015 2:26 am UTC

So I decided to start learning Ada; the first thing I noticed was my hello world binary is 288K. Yikes.
Summum ius, summa iniuria.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests