g1 | g2 | g3 | g4 |
(1,2,x,4) | (1,2,x,4) | (1,2,x,4) | (1,2,x,4) |
(1,2,y,4) | (1,2,y,4) | (1,2,y,4) | (1,2,y,4) |
(a,b,c,d) | (e,f,g,h) | (1,2,3,4) | (i,j,k,l) |
(1,2,z,4) | (1,2,z,4) | (1,2,z,4) | (1,2,z,4) |
Oct 23, 2015
Задача византийских генералов
Википедия: Задача византийских генералов
Labels:
algorithms,
cryptography,
distributed systems
Sep 4, 2015
Aug 19, 2015
“Маркетолог спрашивает программиста: в чём сложность поддержки большого проекта?
Программист: ну представь, что ты писатель и поддерживаешь проект “Война и мир”. У тебя ТЗ — написать главу как Наташа Ростова гуляла под дождём по парку. Ты пишешь “шёл дождь”, сохраняешь, вылетает сообщение об ошибке “Наташа Ростова умерла, продолжение невозможно”. Почему умерла? Начинаешь разбираться. Выясняется, что у Пьера Безухова скользкие туфли, он упал, его пистолет ударился о землю и выстрелил в столб, а пуля от столба срикошетила в Наташу. Что делать? Зарядить пистолет холостыми? Поменять туфли? Решили убрать столб. Получаем сообщение “Поручик Ржевский умер.” Выясняется, что он в следующей главе облокачивается о столб, которого уже нет..”
Программист: ну представь, что ты писатель и поддерживаешь проект “Война и мир”. У тебя ТЗ — написать главу как Наташа Ростова гуляла под дождём по парку. Ты пишешь “шёл дождь”, сохраняешь, вылетает сообщение об ошибке “Наташа Ростова умерла, продолжение невозможно”. Почему умерла? Начинаешь разбираться. Выясняется, что у Пьера Безухова скользкие туфли, он упал, его пистолет ударился о землю и выстрелил в столб, а пуля от столба срикошетила в Наташу. Что делать? Зарядить пистолет холостыми? Поменять туфли? Решили убрать столб. Получаем сообщение “Поручик Ржевский умер.” Выясняется, что он в следующей главе облокачивается о столб, которого уже нет..”
Labels:
fun
Jun 22, 2015
Jun 8, 2015
Parallel Programming
Amdahl's law
The speedup of a program using multiple processors in parallel computing is limited by the time needed for the sequential fraction of the program. For example, if a program needs 20 hours using a single processor core, and a particular portion of the program which takes one hour to execute cannot be parallelized, while the remaining 19 hours (95%) of execution time can be parallelized, then regardless of how many processors are devoted to a parallelized execution of this program, the minimum execution time cannot be less than that critical one hour. Hence the speedup is limited to at most 20×.
Gustafson–Barsis' law
Says that computations involving arbitrarily large data sets can be efficiently parallelized.
The speedup of a program using multiple processors in parallel computing is limited by the time needed for the sequential fraction of the program. For example, if a program needs 20 hours using a single processor core, and a particular portion of the program which takes one hour to execute cannot be parallelized, while the remaining 19 hours (95%) of execution time can be parallelized, then regardless of how many processors are devoted to a parallelized execution of this program, the minimum execution time cannot be less than that critical one hour. Hence the speedup is limited to at most 20×.
Gustafson–Barsis' law
Says that computations involving arbitrarily large data sets can be efficiently parallelized.
Labels:
design patterns,
laws,
parallel programming,
principles
Jun 2, 2015
May 21, 2015
May 13, 2015
May 5, 2015
У скольких целых чисел, лежащих в диапазоне от 1 до 1000, есть цифра 3?
Сначала узнаем, сколько чисел не имеют 3 в своей записи. Для этого на каждое место ставим 9 цифр, не включающие 3 т.е. 9 * 9 * 9 = 729. Если всего чисел 1000, то ответ 1000 – 729 = 271.
http://tproger.ru/problems/count-digit-3-in-numbers-from-1-to-1000/
Labels:
combinatorics,
math
Apr 29, 2015
JIT
JIT in Python via LLVM
http://eli.thegreenplace.net/2015/building-and-using-llvmlite-a-basic-example/
http://eli.thegreenplace.net/2012/08/10/building-and-using-llvmpy-a-basic-example
http://nullprogram.com/blog/2015/03/19/ A Basic Just-In-Time Compiler
http://www.tedunangst.com/flak/post/now-or-never-exec how to add PROT_EXEC on mmap
http://eli.thegreenplace.net/2015/building-and-using-llvmlite-a-basic-example/
http://eli.thegreenplace.net/2012/08/10/building-and-using-llvmpy-a-basic-example
http://nullprogram.com/blog/2015/03/19/ A Basic Just-In-Time Compiler
http://www.tedunangst.com/flak/post/now-or-never-exec how to add PROT_EXEC on mmap
Labels:
jit
Apr 28, 2015
Apr 16, 2015
Mar 25, 2015
Mar 17, 2015
Mar 5, 2015
Feb 24, 2015
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Albert Einstein
Labels:
fun
Feb 11, 2015
Feb 10, 2015
Feb 9, 2015
If Carpenters Were Hired Like Programmers
Interviewer: So, you're a carpenter, are you?Carpenter: That's right, that's what I do.
Interviewer: How long have you been doing it?
Carpenter: Ten years.
Interviewer: Great, that's good. Now, I have a few technical questions to ask you to see if you're a fit for our team. OK?
Carpenter: Sure, that'd be fine.
Interviewer: First of all, we're working in a subdivision building a lot of brown houses. Have you built a lot of brown houses before?
Carpenter: Well, I'm a carpenter, so I build houses, and people pretty much paint them the way they want.
Interviewer: Yes, I understand that, but can you give me an idea of how much experience you have with brown? Roughly.
Carpenter: Gosh, I really don't know. Once they're built I don't care what color they get painted. Maybe six months?
Interviewer: Six months? Well, we were looking for someone with a lot more brown experience, but let me ask you some more questions.
Carpenter: Well, OK, but paint is paint, you know.
Interviewer: Yes, well. What about walnut?
Carpenter: What about it?
Interviewer: Have you worked much with walnut?
Carpenter: Sure, walnut, pine, oak, mahogony -- you name it.
Interviewer: But how many years of walnut do you have?
Carpenter: Gosh, I really don't know -- was I supposed to be counting the walnut?
Interviewer: Well, estimate for me.
Carpenter: OK, I'd say I have a year and a half of walnut.
Interviewer: Would you say you're an entry level walnut guy or a walnut guru?
Carpenter: A walnut guru? What's a walnut guru? Sure, I've used walnut.
Interviewer: But you're not a walnut guru?
Carpenter: Well, I'm a carpenter, so I've worked with all kinds of wood, you know, and there are some differences, but I think if you're a good carpenter ...
Interviewer: Yes, yes, but we're using Walnut, is that OK?
Carpenter: Walnut is fine! Whatever you want. I'm a carpenter.
Interviewer: What about black walnut?
Carpenter: What about it?
Interviewer: Well we've had some walnut carpenters in here, but come to find out they weren't black walnut carpenters. Do you have black walnut experience?
Carpenter: Sure, a little. It'd be good to have more for my resume, I suppose.
Interviewer: OK. Hang on let me check off the box...
Carpenter: Go right ahead.
Interviewer: OK, one more thing for today. We're using Rock 5.1 to bang nails with. Have you used Rock 5.1?
Carpenter: [Turning white...] Well, I know a lot of carpenters are starting to use rocks to bang nails with since Craftsman bought a quarry, but you know, to be honest I've had more luck with my nailgun. Or a hammer, for that matter. I find I hit my fingers too much with the rock, and my other hand hurts because the rock is so big.
Interviewer: But other companies are using rocks. Are you saying rocks don't work?
Carpenter: No, I'm not saying rocks don't work, exactly, it's just that I think nail guns work better.
Interviewer: Well, our architects have all started using rocks, and they like it.
Carpenter: Well, sure they do, but I bang nails all day, and -- well, look, I need the work, so I'm definitely willing to use rocks if you want. I try to keep an open mind.
Interviewer: OK, well we have a few other candidates we're looking at, so we'll let you know.
Carpenter: Well, thanks for your time. I enjoyed meeting you.
NEXT DAY:
Ring...
Interviewer: Hello?
Carpenter: Hello. Remember me, I'm the carpenter you interviewed for the black walnut job. Just wanted to touch base to see if you've made a decision.
Interviewer: Actually, we have. We liked your experience overall, but we decided to go with someone who has done a lot of work with brown.
Carpenter: Really, is that it? So I lost the job because I didn't have enough brown?
Interviewer: Well, it was partly that, but partly we got the other fellow a lot cheaper.
Carpenter: Really -- how much experience does he have?
Interviewer: Well, he's not really a carpenter, he's a car salesman -- but he's sold a lot of brown cars and he's worked with walnut interiors.
Carpenter: [click]
http://www.jasonbock.net/jb/News/Item/7c334037d1a9437d9fa6506e2f35eaac
Interviewer: How long have you been doing it?
Carpenter: Ten years.
Interviewer: Great, that's good. Now, I have a few technical questions to ask you to see if you're a fit for our team. OK?
Carpenter: Sure, that'd be fine.
Interviewer: First of all, we're working in a subdivision building a lot of brown houses. Have you built a lot of brown houses before?
Carpenter: Well, I'm a carpenter, so I build houses, and people pretty much paint them the way they want.
Interviewer: Yes, I understand that, but can you give me an idea of how much experience you have with brown? Roughly.
Carpenter: Gosh, I really don't know. Once they're built I don't care what color they get painted. Maybe six months?
Interviewer: Six months? Well, we were looking for someone with a lot more brown experience, but let me ask you some more questions.
Carpenter: Well, OK, but paint is paint, you know.
Interviewer: Yes, well. What about walnut?
Carpenter: What about it?
Interviewer: Have you worked much with walnut?
Carpenter: Sure, walnut, pine, oak, mahogony -- you name it.
Interviewer: But how many years of walnut do you have?
Carpenter: Gosh, I really don't know -- was I supposed to be counting the walnut?
Interviewer: Well, estimate for me.
Carpenter: OK, I'd say I have a year and a half of walnut.
Interviewer: Would you say you're an entry level walnut guy or a walnut guru?
Carpenter: A walnut guru? What's a walnut guru? Sure, I've used walnut.
Interviewer: But you're not a walnut guru?
Carpenter: Well, I'm a carpenter, so I've worked with all kinds of wood, you know, and there are some differences, but I think if you're a good carpenter ...
Interviewer: Yes, yes, but we're using Walnut, is that OK?
Carpenter: Walnut is fine! Whatever you want. I'm a carpenter.
Interviewer: What about black walnut?
Carpenter: What about it?
Interviewer: Well we've had some walnut carpenters in here, but come to find out they weren't black walnut carpenters. Do you have black walnut experience?
Carpenter: Sure, a little. It'd be good to have more for my resume, I suppose.
Interviewer: OK. Hang on let me check off the box...
Carpenter: Go right ahead.
Interviewer: OK, one more thing for today. We're using Rock 5.1 to bang nails with. Have you used Rock 5.1?
Carpenter: [Turning white...] Well, I know a lot of carpenters are starting to use rocks to bang nails with since Craftsman bought a quarry, but you know, to be honest I've had more luck with my nailgun. Or a hammer, for that matter. I find I hit my fingers too much with the rock, and my other hand hurts because the rock is so big.
Interviewer: But other companies are using rocks. Are you saying rocks don't work?
Carpenter: No, I'm not saying rocks don't work, exactly, it's just that I think nail guns work better.
Interviewer: Well, our architects have all started using rocks, and they like it.
Carpenter: Well, sure they do, but I bang nails all day, and -- well, look, I need the work, so I'm definitely willing to use rocks if you want. I try to keep an open mind.
Interviewer: OK, well we have a few other candidates we're looking at, so we'll let you know.
Carpenter: Well, thanks for your time. I enjoyed meeting you.
NEXT DAY:
Ring...
Interviewer: Hello?
Carpenter: Hello. Remember me, I'm the carpenter you interviewed for the black walnut job. Just wanted to touch base to see if you've made a decision.
Interviewer: Actually, we have. We liked your experience overall, but we decided to go with someone who has done a lot of work with brown.
Carpenter: Really, is that it? So I lost the job because I didn't have enough brown?
Interviewer: Well, it was partly that, but partly we got the other fellow a lot cheaper.
Carpenter: Really -- how much experience does he have?
Interviewer: Well, he's not really a carpenter, he's a car salesman -- but he's sold a lot of brown cars and he's worked with walnut interiors.
Carpenter: [click]
http://www.jasonbock.net/jb/News/Item/7c334037d1a9437d9fa6506e2f35eaac
Labels:
fun
Feb 5, 2015
Jan 23, 2015
Jan 21, 2015
Jan 9, 2015
Software Design Patterns
http://en.wikipedia.org/wiki/Software_design_pattern
http://sourcemaking.com/design_patterns
http://martinfowler.com/eaaCatalog/
http://design-pattern.ru/patterns (ru)
Python Implementations
https://github.com/faif/python-patterns
https://github.com/gennad/Design-Patterns-in-Python
http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Part3.html
Articles
http://habrahabr.ru/post/184156/
http://sourcemaking.com/design_patterns
http://martinfowler.com/eaaCatalog/
http://design-pattern.ru/patterns (ru)
Python Implementations
https://github.com/faif/python-patterns
https://github.com/gennad/Design-Patterns-in-Python
http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Part3.html
Articles
http://habrahabr.ru/post/184156/
Labels:
design patterns
Jan 6, 2015
Subscribe to:
Posts (Atom)