language-agnostic

Getting started in Firmware development [closed]

旧巷老猫 提交于 2019-12-20 17:15:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . I am a software development guy. Lately I was thinking of trying out some firmware development, as the company I work for is trying to enter that domain. I have many questions regarding firmware devlopment - like: What are the tools used - like IDE? In which language is most of

If I store a binary tree in an array, how do I avoid the wasted space?

拥有回忆 提交于 2019-12-20 16:55:32
问题 Often we need trees in algorithms and I get out a tree with lots of pointers and recursion. Sometimes I need more speed an I put the tree into an 2D array like so: Example of a binary tree stored in an array +-----------------+ |0eeeeeeeeeeeeeeee| //no pointers needed, parent/child, is y dimension, |11 dddddddd| //sibbling is x dimension of the array. |2222 cccc| //The 123 tree is stored root up. |33333333 bb| //Notice how the abc-tree is stored upside down |4444444444444444a| //The wasted

Code Golf: Lights out

爱⌒轻易说出口 提交于 2019-12-20 16:49:17
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The challenge The shortest code by character count to solve the input lights out board. The lights out board is a 2d square grid of varying size composed of two characters - . for a light that is off and * for a light that is on. To solve the board, all "lights" have to be turned off. Toggling a light (i.e. turning off

How do you check if a domain name exists?

寵の児 提交于 2019-12-20 15:20:25
问题 Not only easy ones like .com or .net, but also, .co.uk, .fr, .gov.rw ... ? Should I really make a huge mapping "tld to relevant whois server", or is there an easier way ? 回答1: http://php.net/manual/en/function.checkdnsrr.php if (checkdnsrr('test.nl', 'A')) // or use ANY or for other see above link { echo 'Domain exists'; } else { echo 'Domain does not exist'; } 回答2: http://whois.net/ any good? 回答3: PHP: $URL = "http://www.dotnetindex.com/articles/5261-Article--AJAX-Tips-and-Tricks.asp";

How can race conditions be useful?

半世苍凉 提交于 2019-12-20 12:38:09
问题 One of the answers to the question of what race conditions are mentioned low-level algorithms deliberately using race condition. How can race conditions be beneficial? EDIT: Concurrency and queues are a good example of deliberately not caring about ordering of things, as long as nothing is lost. Any ideas on how "really hairy low-level algorithms do this on purpose" ? 回答1: Not all races are equally bad. The worst kind of race that you can get is reading of partial results. This is what Herb

Code Golf: Frobenius Number

拥有回忆 提交于 2019-12-20 12:18:46
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. Write the shortest program that calculates the Frobenius number for a given set of positive numbers. The Frobenius number is the largest number that cannot be written as a sum of positive multiples of the numbers in the set. Example: For the set of the Chicken McNugget TM sizes [6,9,20] the Frobenius number is 43, as

Scale numbers to be <= 255?

一个人想着一个人 提交于 2019-12-20 12:16:16
问题 I have cells for whom the numeric value can be anything between 0 and Integer.MAX_VALUE . I would like to color code these cells correspondingly. If the value = 0, then r = 0. If the value is Integer.MAX_VALUE , then r = 255. But what about the values in between? I'm thinking I need a function whose limit as x => Integer.MAX_VALUE is 255. What is this function? Or is there a better way to do this? I could just do (value / (Integer.MAX_VALUE / 255)) but that will cause many low values to be

Process Address Space vs Virtual Memory

一个人想着一个人 提交于 2019-12-20 10:55:26
问题 From my understanding by reading several articles I assumed Process Address Space(PAS) and Virtual Memory(VM) are same. Is my understanding flawed? Can some one please shed some light on this and en light me? I am confused. I understand Process Address Space has nothing to do with Ram or Physical memory. But Just confused about PAS and VM. 回答1: First: "memory" is not equal to "address space". Address space is range of posible addresses. I.e. it's 4 Gb for 32-bit pointers and 16 Eb for 64-bit

Best Way to Begin Learning Web Application Design [closed]

ε祈祈猫儿з 提交于 2019-12-20 10:40:09
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm a long time hobbyist programmer interested in getting into web application development. I have a fair amount of personal

What is a “Unit”? [closed]

纵然是瞬间 提交于 2019-12-20 10:36:19
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . In the context of unit testing, what is a "unit"? 回答1: I usually define it as a single code execution path through a single method. That comes from the rule of thumb that the number of unit tests required to test a method is equal to or greater than the method's cyclomatic