Translate

Thursday, February 05, 2015

Considering a naive coding area

One problem I don't think gets addressed enough is how badly some people are educated, especially when it comes to code. And if it is public on the web then yeah, it can reflect on you, so I thought I would help out with a common area which has turned into a pet peeve of mine, and that is when I see implementations of bad prime counting approaches publicly online.

The reason I search on the subject is I figured out over a decade ago a really simple approach to counting prime numbers that tweaked techniques previous known, resulting in a simple iterative summation, which is so simple I can give it in a single line:

With ints or longs--where pj is the jth prime:

P(x,n) = x - 1 - sum for j=1 to n of {P(x/pj,j-1) - (j-1)}

It counts primes when n equals the count of primes up to sqrt(x), so if n is greater than the count of primes up to and including sqrt(x) then n is reset to that count.

For example P(100,4) = 25. You can just code up from the instructions given and verify easily enough. Notice you'd need 4 primes--2, 3, 5 and 7.

And I've posted that before. Actually I post about it a LOT, but am mentioning it now to highlight just how bad it can really be out there. And how often people learn crappy things in coding.

It is the fastest, short prime counting algorithm available on the planet.

The only other things as short are not as fast. The algorithms that are faster are not as short.

I like to call finds of mine that are better than anything else in the world, my toys. I use them to critique what other people do.

Notice it involves extremely basic math, so claiming you're not good at math is not a valid excuse. If you know how to divide and how to throw away remainders then you can comprehend it. Using ints or longs is so the computer will do that throwing the remainder away for you.

And it can be optimized which bored me decades ago as I realized it then just approached the currently known fast prime counting algorithms. I get bored with known. I prefer the unknown.

So if you dare post ANYTHING about counting primes, and I find it, and it is naive, especially the most horrendous which is to just divide a long list of numbers by every prime, then unfortunately I will think less of you, and wherever you got your education.

And I think that worth mentioning to help people who may not realize that yeah, such things might get noticed. I know I notice them. And it is such a preventable thing. Don't post naive coding practices. Just don't.

Oh yeah, if you want to know how fast your code should be if you dare to post prime counting code, I put up a post with a benchmark. That is with somewhat optimized code.

Sorry, just a little bit irritated. And yes, I dutifully worked to get my algorithm widely known, like with what I'm doing here. Keep talking about it, but these things can take a while. But some people labor under the misconception that they actually are learning good things, when they aren't even learning quasi-decent in an advanced world where a lot more is known than you are necessarily being taught.

So yeah, a LOT of the point of this post is to highlight the algorithm. It IS the best in the world as described but I'm having problems getting it properly acknowledged and that's sad. It's a lot more fun to code than anything else for counting prime numbers, especially at the basic level, while being faster than anything else available for its size.

I'm using this example as it's very demonstrative I think.

Is it really an issue if you have some pathetic prime counting code I come across? I don't know. Probably not. But I am being honest, I do see it at times, and just wonder what people are thinking. Or better yet, wish they were being taught better, since better is available.


James Harris

Friday, January 30, 2015

Why I like transparency

The idea of transparency comes up a lot around web issues, which to me is just committing yourself to giving people information they need to make an informed decision, so it's a great thing. Now there can be questions about what information is actually needed, but when you are working with folks instead of fighting or trying to fool them, then those can be worked out.

Now here's what I think is a fascinating article on the subject about Reddit:

Reddit hops on to the transparency bandwagon, releases its first report


Where I've linked back to the article on TechSpot.

What jumped out at me immediately was how few requests Reddit got from the government. Quoting from the article:

"... Reddit received a mere 55 requests for data on 78 of its users last year..." (italics mine)

That is amazing to me, but let's contrast with what the article says about someone else:

"Considering that Reddit boasts more than 174 million users, the number of requests the company received is quite low. In contrast, Google’s latest transparency report revealed they had received 3,105 government requests..."

And Reddit didn't even honor all of them or accept requests not to disclose:

"Reddit says that several government requests it receives contain demands to withhold notice from users that carry no legal weight, adding that the company actively disregards these non-binding demands..." (italics mine)

I loved that one.

Kind of have the feeling the government recognizes diminishing returns on pushing Reddit around.

I really like transparency and cheer reports that give people information they need! And that information can tell you quite a bit about so many things of importance.


James Harris

Wednesday, January 28, 2015

Computers don't care about race

Made a post where I gave my position on diversity in coding, and to me the reality of writing code for computers is extremely important though often lost in commentary on the subject, as computers don't care about any of that stuff. Computers don't care about race, or sex or any of those things that trip up human beings.

And I have thought that to myself while working through compiler errors which the compiler dutifully shows me, over and over again even when I'm struggling for some reason through a massive debugging session which I hate. Prefer pristine code that just runs right from the start, which I actually have more of now, but starting out, there was that dread when doing the compile and screen would fill with compiler errors.

And the compiler didn't snicker at me. Didn't suggest that maybe I just wasn't good enough.

Computers offer that wonderful arena where this brilliant device with awesome computing power will just try to do what you tell it to do. No backtalk. No snide remarks. No questioning your worth as a human being.

So to me writing computer code is where discriminated against people should go! Because the computer is like this brilliant friend which JUST DOES NOT CARE about that stuff.

And only merit should matter when it comes to writing computing code as in actuality that's all that matters anyway.

Computers are tearing down divides like race and sex or other irrelevant stuff. Because if you hire some guy because he looks like you versus someone who can write brilliant code then you will pay the price down the line.

And the difference between good coders and crappy coders is so huge there is no hiding it.

A good coder can do in days what a team of crappy coders can't do in a year.

And I assure you, if you have people paying millions for development, and they have the metrics to see that Team A, which just randomly happens to be very diverse, can code with half the price or less, than Team B, where all the team look the same, they will go with Team A. Without hesitation.

Being someone who has been in the position of looking at what happens in the real world, hey, I was a Java team lead. Got picked out of a diverse group of people, but reality was the people from this country were mostly white guys. Others were from India and Pakistan.

Being in charge of that team was a fascinating experience and I learned everything I need to know about diversity in coding, where it's simple: computers don't care about that stuff.


James Harris

Monday, January 26, 2015

So what about diversity in coding?

Put up a post doing my own survey of social media and wow, that thing roared up the Beyond Mundane charts, and is the top post in the last 30 days. Thank you for all who were interested.

That helps me think more about posts that matter to people other than me, as a goal of this blog is finding community in shared interest. I share things that interest me with the idea that it might be of interest to others as well. Helps to know what others might find interesting!

And I made two posts where the first one ended up at #8 (and for those wondering about these rankings they are from the right and down on your screen, where the most popular posts are listed). In that post I talked about the idea of Superstar code and mentioned Linus Torvalds as a code hero, and today, wouldn't you know, found out he had been in the news recently!

And if you want to chase that link and read what that article said, fine, but what caught my attention was the issue of diversity in coding. It's not a subject I talk about much on my own though it has relevance to me, but my main position is: merit is what matters.

Given that plenty of other people say the same thing and I am agreeing with that part of what Linus Torvalds said, it raises the question of why some people think this way and others push the issue of racial diversity and more women coders in a way that may appear to challenge the position that only merit matters.

But you see, forcing merit as the only thing that matters is the way to diversity.

That way people who want to code for a living can focus on learning how, getting really great at it, and not be concerned that won't matter because of their sex or race or ethnicity.

So what about my experience in the workplace?

Will admit spent a lot of time when I was working as a coder, and actually in other jobs, where there were few people of my race. And I have worked with female coders, and even lead one when I was a Java lead developer and she ended up being my best coder.

So what gives? What is my opinion about why so little diversity in the coding world, if merit is what matters, really?

Look at someone like Steve Jobs--who I like to bring up as he's a great example--and consider what he was doing when he was 12. He had unbelievable access to top technology. The fire was sparked in him at a young age with direct experience. That is typical of top coders.

Not willing to claim I'm a top coder, but when I was 12, yup, was coding. Had an early computer on which I learned BASIC like so many others. But also had a community college course on BASIC. Later had a computer course at Duke University on structured C, when I was 16. And would code after school when I was in high school on the computer lab computers though I didn't take any of the school's computer courses as I saw them as too primitive for me.

ALL kids should be coding when they are 12, as that seems to be a key age, and as I'm not a developmental scientist I put that as an opinion, but in case after case of top people that age seems to pop up. Like, even with Albert Einstein, going to another arena. It seems to be a critical age to focus on high level abstract reasoning, which includes coding, and mathematics.

(Someone should do a survey and see how many coders were started by age 12.)

And so ALL kids should get classes in writing code for computers just like they all get classes on reading and writing and arithmetic.

Some of them will get that spark and keep working at it, and become top coders.

And that's it.


James Harris

Sunday, January 25, 2015

My social media survey

Been thinking more abstractly about social media lately, so it seems worth it to get more concrete and talk out more of my own personal reality with it across various social media accounts. Not considering blogs social media though technically they are. For me my blogs are more the stable zone. They're the base around which I do other things.

Maybe my least used account is my belated MySpace one, which I checked recently, because I think they emailed me or something. And haven't found myself going back, so I'm not sure if they fixed what I think was the biggest reason Facebook beat them, as in my opinion, it was JUST the stream.

To me the stream is the most important thing to consider across any social media account.

And the stream is the flow of updates, like on Twitter is the line of tweets, or updates on Facebook, or photos in Instagram. The biggest social media that doesn't have a conventional stream for me is Pinterest, but they do have a stream. It's not conventional in that Pinterest gives you a two-dimensional view of new pins.

Why is the stream so important? Novelty.

Here's a tweet I made which shows you what I think of novelty.


You take away the novelty and you lose that thing that keeps people constantly checking the social media accounts, just to see if there's something new. Which is probably why I'm going to check my Facebook accounts several more times today. Without that stream of updates, you lose that novelty.

My Twitter stream is my most addictive one. Probably check it hundreds of times a day at times, so sometimes have to schedule breaks from it.

On Google+ was frustrated scrolling down through their stream as it's too detailed. They seem to be cutting off the stream at some point now, which actually helps. I kind of wish they'd let you have a digest version.

Oh yeah, the digest version is anyway you can scrunch down the data in the stream to make it more accessible so you can scan rapidly through it. On Google+ I get bogged down. There's so much rich content that I reflexively ignore some, like videos, refusing to click on them, unless they're really enticing. That's not a good thing.

Have talked about my most used already, where things are least public on Facebook and Instagram in that on Facebook I deleted my public profile on me as I got frustrated trying to figure out what to put on it--and now it's back, just kind of random. And haven't posted to my Instagram in a long time though I get on it every day, to do Likes! I like, liking on Instagram, maybe more than anywhere else, so it's more of a follow experience.

Created a new public profile on Facebook for my math ideas, and it has one Like, mine.

Facebook is an arena of frustration for me.

Only social media area worse? YouTube.

Have some practice videos on YouTube so really don't care, but it's as bad as Facebook, where can go for long periods where I get no Likes on Facebook for things, on YouTube can get zero views. But I am pondering why. Guess technique has something to do with it, along with other things.

My social media presence can be puzzling where more web analytics has helped me out a lot, so I will admit that my most dominate account in terms of views and apparent influence is my Twitter account, followed by my Google+ account, where you can see views now, followed by my Pinterest account.

And I will admit my Pinterest account gets a bit over 800 views per month, so not talking big numbers, but better than public on Facebook or YouTube, by like, infinity.

I'm spending more time trying to figure out Pinterest than anything else, as I think the potential is greatest.

Why not put up links to all these in this post? Why bother? I'm talking things out.

And those are the social media accounts most worth discussing where I have others, where so far there is far less activity or it's more experimental.

Biggest point I think? The stream is the thing.

What pulls people to constantly check, and check, to see if something interesting happened?

The stream.

And by far for me the biggest thrills come on Twitter where things can just get, well completely wild.

Oh yeah, so didn't talk follower counts at all. Well, mostly I don't worry about followers. Not surprisingly that doesn't help to get a lot of them. On Twitter have 120 at time of this post. Don't disclose Google+ follow numbers. On Pinterest have 4.

Yeah, I don't worry about followers which is good as I don't have bragging rights there. Hardly worth mentioning the numbers, eh?


James Harris