Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

Pcube

@Pcube
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • while (true) and for (; ; ) [modified]
    P Pcube

    That's incorrect. This code will only hang a single core machine if there are no interrupts to force context switching (which is the case on the vast majority of machines that run an OS, anyway). Also, this code is useful to spawn a thread that continuously polls hardware. If you have a piece of hardware that can change its output at any given time, but you're not sure when, you can spawn the equivalent to a listener thread to capture (sample) changes at the output. In fact, this code is useful in many "thread listener" type scenarios, such as when a server is idling and listening for clients...

    The Lounge hosting cloud question

  • random unique number [mysql]
    P Pcube

    If you're assigning a random number to every entry in the table (i.e. every single time you add an entry you associate a random number with it) then a good mechanism to use is the LFSR - Linear Feedback Shift Register. An n-bit LFSR will iterate through 2^n numbers in a fixed (deterministic) sequence (thus, not very random, but it might suit your purposes for uniqueness) and guarantees to loop back to the first number outputted after 2^n iterations. I'm a little rusty on the details, but it should definitely guarantee that you don't exhaust every number for a "long" time. Xilinx has a good app note on this: http://www.xilinx.com/support/documentation/application_notes/xapp052.pdf[^]

    Database question mysql lounge
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups