How does bitcoin manage the money supply?

Question: All currencies are expanded when institutions begin loaning currency. How will bitcoin limit this growth? In economics there are several definitions of money such as M2, M3, etc.
Comment: People who downvote, please add a comment explaining why, especially when the user is new to the site so that he/she can learn something from it. Thanks!
Comment: Here's a good article related to this topic: http://www.webisteme.com/blog/?p=192
Answer: The number of bitcoins in existence is limited to 21 million. This is the equivalent of M0, the monetary base. Whatever institutions do with it, creating M2, M3 etc. is not something that Bitcoin can or will control.
Here is some more info on the Bitcoin wiki: Controlled Currency Supply
Answer: If I lend a bitcoin to you, you are probably going to want me to transfer it to you. That transfer sends the one bitcoin out of my wallet and into your wallet.
There was no increase in the bitcoin money supply from that.
Let's say that I am a merchant and I sell to you a widget and extend to you payment terms in which you would pay one bitcoin due in 30 days. In this transaction, there were no bitcoins that changed hands or were required in any wallet but there was a debt created for one bitcoin.  This is simply a debt though and is not an increase in the bitcoin money supply.  There was no Bitcoin money created by me in this instance.
Next consider a Bitcoin bank that takes bitcoin deposits and lends out bitcoins.  A Bitcoin bank can only lend out bitcoins from either its investment capital or from customer deposits.  This is unlike a bank that lends out fiat that is created by a central bank.  This Bitcoin bank can still do fractional reserve banking (i.e., only keep a faction of the amount of customer bitcoin deposits) but this does not increase the bitcoin money supply.  There were no bitcoins created by the bank by borrowing from a central bank and then lending them out.
There is the possibility that a Bitcoin bank could issue a check payable in bitcoins to a borrower where the borrower then uses that check for payment to a supplier, for instance.  But that check isn't money and the supplier can refuse to accept it as payment. Thus these checks also do not increase the bitcoin money supply.
If these checks were to begin to circulate as currency, then that is a creation of a financial instrument that is separate from bitcoin.  If the bank were to issue checks for amounts that were not backed with bitcoins then that could be a form of money creation whose supply could be inflated by the debt however that money supply is not the bitcoin money supply and vice-versa.
Comment: You completely misunderstand the definition of money supply vs money base. Your examples are all perfect examples of money supply creation.
Comment: Corone: So you will accept my BTCIOU as payment for a good you sell or service you provide?   If so, I'll take 10 of them.  No, wait ... 100!
Comment: First rule of bitcoin, if you don't know the private key, you don't own the bitcoins.  Everyone with BTC on an exchange, or on Coinbase, or similar, has only got an IOU.  Every day people exchange USD for BTCIOU on Coinbase etc.  Coinbase even allow you to buy things with BTCIOU using off blockchain transactions.  Off blockchain transactions are pretty much the definition of money supply transactions.  Sure you hope that these exchanges and coinbase etc. have 100% backed the IOUs with real bitcoins, but if they didn't, then the money supply could exceed the base.
Comment: So the money supply included Bitcoinnect's $10B "market cap" that existed one day and then that money supply shrunk by $9B the next day when it could no longer be denied that Bitcoinnect was just a ponzi scheme?
Comment: Exactly correct, money supply fluctuations like that are what central banks in controlled currencies are supposed to try and prevent.  At its heart the 2008 credit crisis was a gigantic collapse in the money supply, when the banks admitted that assets they had claimed to have were in fact worthless (sound familiar?).  The central banks responded with quantitative easing to prop up the money supply.  Bitcoin seems to be born out of a belief that such "propping up" is unhealthy, and it is ultimately better for society to take its lumps.
Comment: Somewhere along the way the ideal of "when money supply fluctuates it is wrong that a central authority steps in and manipulates it by fiddling with the base" got confused with "it is wrong that money supply fluctuates".  Bitcoin doens't stop the supply fluctuating and was never meant to, it just prevents a single source messing with the base.  (In fact BTC could never realistically be expected to handle any sensible volume of business without supply multiplication).
Answer: You are right in saying that the money supply of a currency is expanded through lending. It's even possible when the currency solely consists of physical coins. This was already usual practice in ancient banking operations and is nothing new.
Since there is no Bitcoin central bank, there is no reserve requirement and the Bitcoin money supply can theoretically grow indefinitely (the money multiplier is infinite). In my opinion this means the term "fractional reserve banking" does not apply. In the case of Bitcoin we simply speak of lending. FRB only applied, if there was a central bank that sets a reserve ratio like with fiat currencies.
Despite the fact that there is no reserve requirement, Bitcoin lending will probably be limited by the deflationary nature of Bitcoin itself. I just published this article about the topic. A deflationary currency like Bitcoin provides a higher incentive to build savings instead of inducing to borrow money. Therefore lending activities in relation to the monetary base (mined Bitcoins) will remain much smaller than with fiat currencies. The Bitcoin money supply manages itself and should remain at a reasonable level.
Comment: But the assumption of deflation implies a stable multiplier. If MV=PT then fixing the base is insufficient to create deflation. In fact with no reserve requirement, no capital controls and no backing, catastrophic inflation seems the historically most likely end game. Cf wildcat banking.
Answer: Bitcoin is very different in that noone can control the amount of coins.
The system is limited to 21 million coins.
Last coin will be minted in 2140.
How the currency is minted is not something a single person can control.
If you try to change the system you are no longer compatible with the other Bitcoin clients.
The system has rules so that Bitcoins are created as awards to those who contribute their computer power to secure the system and calculate/distribute transactions.
This cost energy and anyone can do this.
This means that its the first truly democratic electronic currency, since there is noone who have monopoly on creating the currency.
It is also akin to looking for gold and finding it, a process you can not control. But anyone can do.
The more resource you spend the more likely you are to find gold. However you are in competition with others doing this and the less energy you spend the more you earn.
There is thus a built in evolution into the system.
Bitcoins are thus not created out of nothing, but out of real energy.
Thus in order to lend out a Bitcoin you must first have it.
Thats how people think the banks work.
FIAT currency is simply created with the press of a button whenever someone takes a loan.
This leads to a constant loss in value, known as inflation which might be good for a country.
But bitcoin is not in a country its on the internet.
97% of the FIAT currency are created "expanded" in the private banking system given out as loans.
That means that of all the currency you have in your hand, 97% of should be payed back to a bank, and even more since the banks also ask for interest rate on this money created out of air.
Bitcoins can not be payed back since they are not created out of a loan.
Since they are not borrowed into existence they do not come with an interest rate.
Bitcoin is the worlds first electronic debt free currency system.
Bitcoin is the only electronic currency someone can truly own, in the sence that it should not be paid back and in the sence that it can be in 100% control of only the owner.
Comment: This sort of gives the impression that you can't have fractional reserve banking with Bitcoin, which is of course not true. Did I misunderstand you William?
Comment: While good, I think your answer could be condensed.


What's a good program to batch resize 100,000 JPEG images?

Question: The program should run in batch mode to resize all files in a folder and then save new files to different folder. An option for setting JPEG quality would be great, too.
Comment: A combination of find and ImageMagic.
Answer: I'm a little surprised that no one has mentioned the easiest, cheapest, and least technical option:
Automator
First, open Automator, which is in your Applications folder.
Next, choose to create a new workflow:

Next, add the following steps to the workflow by dragging and dropping:

When you run this, Automator is going to:

pop up a window asking you to pick some files (as many as you want)
pop up another window asking where you want to save the resized copies
ask you how big you want the resized copies to be.  You'll be able to choose either a fixed size or a percentage.  All the images will be resized to either that size or by that percentage.

(The "show this action when the workflow runs" checkbox means that the workflow is going to pause, display the option, and allow you to change it then)
Once you do that, Automator is going to churn and burn, and when it's done it'll beep at you.
Unfortunately, it doesn't seem to have an option to choose JPEG quality.  However, for the price (free), it's pretty dang convenient.
Comment: It's safe to assume that Automator is, for the purposes of this discussion free because it is reasonable to assume that @mototribe is running OS X. My one concern would be how well Automator would handle 100,000 images but, assuming they're not all in a single folder, I'd just keep feeding it one folder at a time until it was done. I've run this very workflow against *hundreds* of images without difficulty. I see no reason why it wouldn't work against many thousands, as each image is pushed through one-at-a-time, but I'd be in trust but verify mode.
Comment: Yep Automator did the job perfectly. I came here thinking "I have find a command line utility that would batch-resize images"... Sometimes the easiest solution is also the best. Cheers.
Comment: It maybe the least technical for someone who does not use Terminal. And possibly the easiest, But its not the cheapest out of the answers here. Sips is included in the Unix build of the Mac. And ImageMagick is also free.
Answer: I like to use ImageMagick. sips and Automator (which use an identical resizing method) make images look too blurry without additional sharpening in my opinion.
You can install ImageMagick with brew install imagemagick after installing Homebrew or with sudo port install imagemagick after installing MacPorts. Then run a command like this:
mogrify -filter lanczos2 -resize '500x500>' -format jpg -quality 90 -path /tmp/ *.jpg

500x500> makes images wider or taller than 500px fit to 500x500px. 500x would always change the width to 500 px and 500x500^ would make all images at least 500x500px. -path /tmp/ saves the output files to /tmp/ instead of modifying files in place.
Lanczos2 or the 2-lobe Lanczos is very similar to Catrom. Compared to Lanczos (Lanczos3), they are slightly less sharp, produce less ringing artifacts, and produce more Moiré patterns. The default filter for making images smaller is Triangle, which often makes images too blurry in my opinion.
-quality 100 creates files about twice as big -quality 95, which creates files about twice as big as -quality 88.
More information:

http://www.imagemagick.org/Usage/resize/
http://www.imagemagick.org/Usage/filter/
http://lri.me/shell1.txt

Here's a similar command that uses sips:
for f in *.jpg; do sips -Z 500 -s format jpeg -s formatOptions 80 "$f" /tmp/; done

-Z 500 is like 500x500> in ImageMagick.
If others have less than 100,000 images, you might also use Preview:

Preview used to use the same resizing method as sips and Automator, but it has used a different one since 10.7. I prefer ImageMagick's Lanczos2 though.
Comment: I'd like to warn you to use `mogrify`: this converts the files in-place, overwriting the original ones! If anything goes wrong, you have lost your files! Better use `convert` (also from ImageMagick).
Comment: @KurtPfeifle It doesn't if you specify the `-path` option (which `convert` doesn't currently have).
Comment: If you are going for speed then `sips` is maybe the better choice. On a quick test with 1,000 JPGs á ~5 MB resizing to 800px width took ~1 min. with `sips` and ~8 min. with `mogrify` (with disk buffers purged, using GNU Parallel on a quadcore).
Answer: ImageMagick is a command line interface program and made for this purpose. The use and installation of ImageMagick can intimidating, but this image manipulation package is the most powerfull I have encountered so far. As the installation from source can be a hassle for native OS X users I advise you to use Homebrew.
To install ImageMagick using Homebrew run this oneliner in your terminal:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Homebrew is now installed, it is wise to follow the installer's suggestions after installation. Now we install ImageMagick using brew.
brew install imagemagick

ImageMagick is now installed and it's convert program can be used for your purpose. To convert a big jpg image to a smaller png image your can run
convert input.jpg -geometry 800x600 output.png

To answer your question "How to resize all files in a folder and save them in a different folder" you can run the following script.
# create output dir
mkdir -p "../resized"

# Convert all .jpg files in the current folder
for image in *.jpg; do
    convert $x -geometry 800x600 resized/$x
done

ImageMagick can convert over 100 different image formats, and almost all tricks you can do with Photoshop you can do with ImageMagick.
Comment: thanks, that's what I ended up using - however I installed it on Drupal since I'm importing the images into Drupal.
Comment: @the_karel, I just enhanced your previous post. I hope you do not mind.
Answer: Several people have mentioned ImageMagick. Here is a recipe:
For simplicity, assume all the files are in one folder (and the folder contains nothing else). Open a terminal window, cd into this folder, then run
mkdir ../resized
for x in *.jpg; do convert -geometry 800x600 $x ../resized/$x

where you replace the 800x600 by whatever size you want.
Advantages include a great amount of flexibility in ImageMagick's convert, such as the ability to select different quality settings for the target image, or setting the resize option by percentages. Or you can use -geometry 800x800, in which case the aspect ratio will be preserved, but the maximum of the width and height will be 800 pixels.
Disadvantages are the obvious ones: It requires a certain familiarity with the command line, plus a willingness to plough through the command line options of convert for the settings you want. This is not a task for the faint of heart.
Answer: I second Robert's recommendation GraphicConverter. I've been a registered user for 16 years. Its main purpose is batch-processing image editing, and it has a good user interface for designing custom workflows and saving them.
You can also use it in conjunction with Automator, but you probably won't need to.
Here is some information from GraphicConverter's page explaining their batch processing image editing functions.

Batch conversion with additional functions
GraphicConverter offers you sophisticated batch  processing which
fully automates repetitive tasks applied to a selection of pictures:

Convert all the selected source pictures easily and quickly into a new format - regardless of whether there are 5 or 5,000 picture files;
you just define the type of conversion and set the details
During the conversion process you can apply up to 60 additional batch functions such as rotation, resize, change the resolution, etc.
Automate the removal of the Mac OS Ressourcefork before documents are uploaded if there are compatibility problems when the picture
files are placed in the internet
Create catalogs in HTML format for publication in the internet and adjust the colors, sizes, etc. to your individual requirements (see
examples)
Rename a selection of documents according to special criteria  quickly and easily
Join pictures together (e.g. for QuickTime VR)
Insert or extract IPTC information into or out of a variety of  document formats
and much more ...
Answer: This is yet another simple, clean and effective batch image resize script.
If you are dealing with graphics and different resolutions a lot, you can use this script and save it with different values for occasional uses.
Do so, by changing this target_width 120 value to your needs and save the script. Now drag your image(s) onto the saved script-file to start resizing your image(s).

Open Script Editor, and create the following new script:
-- save in Script Editor as Application
-- drag files to its icon in Finder

on open some_items
  repeat with this_item in some_items
    try
      rescale_and_save(this_item)
    end try
  end repeat
end open

to rescale_and_save(this_item)
  tell application "Image Events"
    launch
    set the target_width to 120
    -- open the image file
    set this_image to open this_item

    set typ to this_image's file type

    copy dimensions of this_image to {current_width, current_height}
    if current_width is greater than current_height then
      scale this_image to size target_width
    else
      -- figure out new height
      -- y2 = (y1 * x2) / x1
      set the new_height to (current_height * target_width) / current_width
      scale this_image to size new_height
    end if

    tell application "Finder" to set new_item to ¬
    (container of this_item as string) & "scaled." & (name of this_item)
    save this_image in new_item as typ

  end tell
end rescale_and_save

original source
Answer: Preview is certainly a good solution for some occasional resizing. There are also other nice free options, such as ImageMagic (command-line utility), Preview or something else plus Automator, etc.
However, if this is a part of your job and you need a true flexibility, a special-purpose application will save you a lot of time, and offer much more opportunities.  Many users chose our batch image resizer Resize Sense (http://veprit.com/resizesense) for its outstanding flexibility and convenience.
Disclaimer: I am the developer. You better judge Resize Sense yourself. The introductory video on the product website will tell you exactly what is so special in Resize Sense. There is a free demo version.
Answer: Graphic Converter
The best for this..
Comment: Can you explain why GC is the best option?
Comment: Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
Answer: EDIT: Okay, Aperture is dead. I put it out of its misery long ago.
While I agree that imagemagik is great as a command-line solution, I really like XnConvert for GUI-based batch image conversions. It is lightening fast. They have a companion program, XnViewMP, that is outstanding for viewing images, especially for generating pages of thumbnails. It also has an excellent EXIF facility.

No one has mentioned Apple Aperture.
While by no means the cheapest, it comes with a lot of other things that you may find useful. It basically replaces iPhoto and then some. It does 95% of what photographers commonly use Photoshop for. (It won't do flaming text.)
But unless you need the other things Aperture gives you, I second both the ImageMagick approach -- if you're not intimidated by downloading, installing, and running command-line programs, and the Automator approach is free.
Answer: I usually import all of the pictures into iPhoto and then export them to the different sizes. I have done it on batches of 300 or so images, but never on the scale you are wanting. Still, it may be an option.
Answer: I use wine (and XQuartz) and IrfanView. Of course you could also use imagemagick from the command-line. For wine and imagemagick I would recommend Homebrew.
Comment: Using Wine with a Windows application is really an overkill for something that you can do natively.
Comment: I Suspect they mean they run IrFranView under wine. Wine lets you run Windows software on other operating systems. With Wine, you can install and run these applications just like you would in Windows. The screenshot clearly shows Mac type windows (buttons at top) with PC Window GUI
Comment: I've used Irfanview for over 10 years on the PC and love it. But they don't have a Mac version?


What's video converters are available for Ubuntu?

Question: I need a good video converter application that can convert from/to many video formats. On Windows I found Format Factory to be good. I would like its equivalent or something better on Ubuntu.
Comment: I found that question by dropping: `convert video [software-recommendation]` in the search bar.  the brackets say search for things tagged as.  the others are keywords
Comment: I have found that Format Factory works well in WINE. I'm running Ubuntu 12.04 with WINE 1.4, so I don't know how well FF would run in a different environment. The only problem with it is that it will crash after every conversion you make, but all your files will be in the output folder and you can just start it right back up to do another conversion if you need to.
Comment: Everybody likes ConvertMe! http://gnome-look.org/content/show.php/ConvertMe!?content=153277
Comment: some solutions here are a bit outdated
Comment: I found this resource to be helpful. http://www.real.com/resources/video-converter-software With so much software available, it helped answer some of my questions as to not only what to be looking for in a video converter but also what to be looking for to suite my individual needs.
Answer: There are at least four video converters you can try:

arista | [Install arista]
transmageddon | [Install transmageddon]
ConvertMe!
Handbrake

Arista is a basic converter which you can add new conversion types to through there web site which will give you a new script which you can install adding the new conversion type.
Transmageddon is the development version of arista which gives you the option to choose your specific encoding preferences in the program interface.
ConvertMe! is a very user friendly new frontend for FFmpeg. It comes with widly used presets and gives you a preview of the conversation progress. ConvertMe, intergrates with your Nautilus file manager allowing you to rightclick on an any video file and convert it instantly. View screenshot
Handbrake has a limited number of output formats including mp4 and mkv but there are many more options available and a good description of what these options will do however handbrake is not in the software centre and you will need to add it by adding a PPA*
which can be found at launchpad.
The ppa can be added through the software sources dialogue described here
ppa:stebbins/handbrake-snapshots

Comment: Handbrake is in the ubuntu software center now (14.04).
Comment: still the best solutions?
Comment: As far as I know what were you thinking of converting?
Comment: Don't forget about dmMediaConverter which is a ffMpeg GUI.
http://dmsimpleapps.blogspot.ro/2014/04/dmmediaconverter.html
Comment: Images are gone
Answer: Transmageddon

Transmageddon supports almost any format as its input and can generate a very large host of output files. The goal of the application was to help people to create the files they need to be able to play on their mobile devices and for people not hugely experienced with multimedia to generate a multimedia file without having to resort to command line tools with ungainly syntaxes.
The currently supported codecs are:
Containers:

Ogg
Matroska
AVI
MPEG TS
flv
QuickTime
MPEG4
3GPP
MXT

Audio encoders:

Vorbis
FLAC
MP3
AAC
AC3
Speex
Celt

Video encoders:

Theora
Dirac
H264
MPEG2
MPEG4/DivX5
xvid
DNxHD

It also provide the support for the GStreamer's plugins auto-search.
Winff

WinFF is a graphical user interface for FFmpeg. It will convert almost any video file that FFmpeg will convert. WinFF does multiple files in multiple formats at one time. You can, for example, convert mpeg's, flv's, and mov's into avi's (or DVD/VCD format or MPEG or 3gp etc.) all at once.
This package provides a variety of preset conversion settings for common formats and devices. These presets are intended to hit the "sweet spot" for each individual codec. They have been written with a tip of the balance to quality.
Arista

Arista is a simple multimedia transcoder, it focuses on being easy to use by making complex task of encoding for various devices simple.
Users should pick an input and a target device, choose a file to save to and go. Features:
Presets for iPod, computer, DVD player, PSP, Playstation 3, and more.
Live preview to see encoded quality.
Automatically discover available DVD media and Video 4 Linux (v4l) devices.
Rip straight from DVD media easily (requires libdvdcss).
Rip straight from v4l devices.
Simple terminal client for scripting.
Automatic preset updating.

Comment: Where is the option to convert to 3gp in WinFF? When I select Mobile Phones, it is only converting to audio. The preset has only audio.
Answer: I suggest you to give a try to both FFmpeg and/or Mencoder.
They are very powerful in the sense that you may be able to convert any format in any other format. You can also very extensively fine tune the settings for your codec.
They seem to be mostly suited to run through command-line, but :
1) Ready-to-use scripts can easily be found on the web
2) Some GUI exists to make their use easier. (I know WINFF for FFmpeg and Handbrake, as mentionned by Allan, is also a GUI for FFmpeg)
3) You may find interesting and funny to learn their specific languages and moreover, if you encounter troubles in adjusting some settings with the more user-friendly one, they might be the one which will work for you due the huge variety of their settings.
Comment: one of the actual options for 20.04
Answer:
Convert Audio, Video Files With FF Multi Converter

FF Multi Converter supports the following formats:
audio/video: aac, ac3, afc, aiff, amr, asf, au, avi, dvd, flac, flv, mka, mkv, mmf, mov, mp3, mp4, mpg, ogg, ogv, psp, rm, spx, vob, wav, webm, wma, wmv;

Install FF Multi Converter in Ubuntu

sudo add-apt-repository ppa:ffmulticonverter/stable
sudo apt-get update
sudo apt-get install ffmulticonverter

Webupd8
Answer: Proabably the easiest to use is avidemux.
It has an intuitive graphical interface and can do lots of simple tasks, like convert, cut scenes etc.
Answer: I found Mobile Media Converter (mmc) a truly handy tool, both on Windows as well as Ubuntu. It supports many audio/video formats and supports many mobile or hand-held devices too.
You can found the required version on http://www.miksoft.net/mobileMediaConverterDown.htm
Hope this answered your requirement :)
Comment: It works just fine on 64 bit systems (ia32-libs).
Comment: Even when I also suggest Mobile Media Converter, it won't work in a 64 bit system. They haven't dropped a 64 bit version of this excellent software. However, I upvoted you Chandan.
Answer: As much as I like using mencoder and ffmpeg, I'm finding VLC to be the Swiss army knife of video conversions.
Comment: I agree. After running around in circles, dabbling with avconv, and even trying online converters, I finally was able to convert FLV to MP4 using VLC and the system is so user-friendly, just like Ubuntu is.
Answer: Xilisoft Video Converter

There is no such Video conversion tool for Ubuntu except some but they didn't work for your iphone, blackberry, or Android devices. so what i did i install Wine from Ubuntu software center and then i download & install Xilisoft video converter its a window program  but works Great with wine in Ubuntu and its Supports all the formats of video file. so until now this is the only way to convert the video into other formats i.e., Avi, Mp4 (h.264), 3gp, and all other popular video formats are supported by Xilisoft so used it and Enjoy.
Thanks.
Answer: I really like Vidrop, for me it's the best video converter, fast, with a simple or advance interface depending of your requirements.


Programme to help with face to face diplomacy

Question: Can anyone suggest a programme or website that will allow playing diplomacy with all players on one computer.  Ideally this should not involve logging in and out, or having a window open per player.  I would like to use it purely as a movement judge, so once all orders are submitted on paper, then they can be copied onto the screen, and the "Go" button clicked to show the results (ideally with nice arrows showing where units bounced, convoyed etc.).  I have found many programmes and websites that provide great interfaces for play-by-email or play-by-web for a single player, but nothing for helping with face-to-face games.
Comment: I am not sure if you aren't looking hard enough, or I am misunderstanding how an online web version wouldn't work for you (is logging in really a problem?). It sounds like you only want a hot seat software recommendation. Hot Seat will have some problems with what you said you don't want. You cannot keep each players orders secret from each other (before hitting "Go") without having different windows for each player (if this isn't true, how would you accomplish the secrecy?).
Comment: @user1873 Sorry for not being clearer. The idea is to maintain secrecy by submitting all orders on paper, and then once all have been revealed use the software to play out the moves quickly.
Answer: jDip is an exact fit for that. It is a free java program so can run on any platform.
Comment: Hi dsas!  Thanks for the suggestion - in the end I did use jDip, and it was perfect for my needs.  We then used VNC to relay the map to other computers in conference rooms.
Answer: The kind of software you are looking for exists.

Diplomacy Games Manager - Stewart Cross.
Diplomacy for Windows XP - With Local Area Network support, internet, e-mail.

MSN - Gaming Zone used to support Diplomacy, but something must have happened between Hasbro and Microsoft to change this.
Stewart Cross has an interesting article on the difficulty in creating the Diplomacy GM. If you are looking for reviews of the PC game, you might check GameSpot, or AllGame (although it looks like this site is a data farming site like Answers.com). I would normally use GameFAQs.com, or MobyGames.com, but both don't seem to have much useful information on them.
Comment: +1 Thanks, the first of these looks like it's what I want.  I'll have a look for more details about the second.
Answer: The software I know of is Realpolitik.
I know that at games Dan Burgess has hosted in Chicago, they've used this program (eg see his comment here), but I believe not in lieu of ordinary analogue adjudication over a board. The general setup as I understand it is that a non-playing host loads the moves into Realpolitik and adjudicates, which is synced up to a computer screen in a different negotiation room(s), so that players in that room can see the current position of the board while negotiating. I've never actually see this in progress, if you want more information, I'd contact one of the Windy City Weasels.
Call me skeptical, but I'm not convinced of the advantage of using automatic adjudication (perhaps if I see it in action I'll become convinced, maybe cutting down on errors is one possibility, but not the one mentioned in comments). The orders still needed to be read, and the results assimilated by the players, so I don't see a major time saving (since assimilation usually occurs simultaneously with hand-held adjudication).
Comment: +1 Thanks, this is useful.  I am also planning to use computer screens in negotiation rooms.  I am playing with a group that are all new to the game (and I've only played a handful of games), so I think it will cut down the mistakes too/save us time.  If we adjudicate positions manually we will either spend longer over it (e.g. arguing over bounces and convoys), or we will make more mistakes.
Comment: We actually ended up using jdip (http://jdip.sourceforge.net/), along with vnc to relay the screen to the meeting rooms and a game timer I wrote to mimic the behaviour of http://www.ellought.demon.co.uk/diptimer.htm, but without needing to be full screen.  The order resolution was great - I didn't have to work out why other player's orders had failed - I could just read out the results from the screen.  Anyway - the suggestions in these answers were great, so thanks!


What are the arguments in favor of the "first past the post" system?

Question: With the election results in the UK election finishing up, a lot of people have pointed out that the number of seats some of the parties got in parliament is far disproportionate to their vote share. Thus, ukip got around 10% of the vote (or around 4 million votes), but only 1 seat, whereas the SNp got 56 seats with millions fewer. In response to this, various people have called for electoral reform. What reasons are there not to change the system?
Answer: I think the positive arguments are really a mix.

The current UK system guarantees geographical representation.  It is more difficult to get this with PR.
The current UK system has a clearly identifiable person who represents a clearly specified set of people. Those people can fire (not re-elect) their MP if they think they are not doing a good job.
The current UK system has historically given a majority to one party. This has various advantages over coalition politics. In my view perhaps the most important is that the electorate knows exactly what they are voting for. In coalition politics the policies of the new government are decided after the election.
Some people simply don't want extreme minority views to be represented at all in parliament. For example, PR would have given MPs to the BNP historically (although not in the 2015 election I believe).  The first past the post system ensures that only views that are strongly held by a significant local population are represented in parliament.
Answer: We have that same argument in Canada every election. The argument FOR the system is that, from a regional perspective, the representative did indeed win the most local votes to represent their community. To usurp that by any proportional system removes true local representation. the question then becomes whether local representation is more important than overall proportionality. The answer to that depends on how much local representation can truly affect things like local payments from public coffers, and how independant your local voice is within their party. In Canada it has got really bad where the parties almost always vote as blocks - no matter what. In that case, first past the post fails miserably.
Comment: But even in just the local sense, you can end up with a majority of the voters voting for parties that don't get anything....
Comment: That is true, but democracy does not automatically imply majority except in two-party elections. It implies a plurality, which is not the same thing.
Comment: An approach which would combine the advantages of both PR and FPtP, but which might be hard to "sell" people on, would be to use use a probabilistic method to select among the top vote getters, such that the relative probability of someone winning would be a function of their vote total.  Thus, if one candidate gets 60% of the vote and another candidate 40%, the first candidate should have a higher probability of winning, but the second candidate's probability should be non-zero.  Such an approach would have the advantage of giving candidates an incentive to get as many votes as they can...
Comment: ...even if they had no fear of getting less than 51% of the vote or no hope of getting more than 49%.  In a large assembly, some seats would be swayed by chance, but the likelihood of chance skewing things particularly badly would be remote.  Otherwise, the statistical average results would combine the locality advantages of FPtP with distributions closer to PR (how close they are would depend upon the mapping between vote percentages and probabilities).
Answer: In addition to the argument Michael Broughton has put above, that the MP is the clear first choice of his or her local area, another argument for FPTP is that it usually (not always!) gives a decisive result quickly. Under more proportional systems there is often complex haggling between several parties before a government is formed, involving dramatic concessions to smaller parties in order to get their support.
Comment: That actually makes sense, especially seeing the amount of trouble that just went into the Israeli coalition
Answer: One argument missing from previous answers is the simplicity of the system. How individual votes contribute to the final result is transparent and you only need one round of voting (as opposed to the French system which is still simple and strongly majority-oriented while giving smaller parties a bit more space but requires two rounds of voting – with one or two weeks in-between – for each election). Many alternative systems require complex calculations (e.g. the Irish STV) or lend themselves to strange paradoxes (in Germany, there have been elections in which supporters of a given party in a specific district could have ensured an extra seat for their party of choice by not voting at all).
Note that the almost complete lack of representation for UKIP and other small parties are the clearest evidence for the issues with FPTP. Because the SNP has a local stronghold, it would be very successful in any system. Based on its proportion of the national vote, it could expect at least 30 seats, which is also roughly half the seats for Scotland where it had about 50% of the vote. That's less than the 56 seats it was able to secure in the current system but still quite a lot.
Note that there is a common counter-argument to the simplicity argument, namely that it does not matter whether voters understand how the seats are assigned, as long as the parliament ultimately reflects their preferences.
Comment: @ewkochin It's a bit difficult to explain. First a bit of background. On the whole, the system is mostly PR but half of the MP are elected in a kind of FPTP system, in a constituency. Voters have two "votes" and a ballot looks [like that](https://de.wikipedia.org/wiki/Datei:Btw2009-126.jpg). The second column represents what's called the "second vote" (the most important one, incidentally) and determines the overall share of seats a party gets. The first column is for the constituency's directly-elected representative.
Comment: How does the German issue work out?
Comment: Directly-elected MP are first assigned to their party's overall contingent (which is determined by the PR part of the system). But if there are too many directly elected MP in a province (compared to their party's share of all the seats for that province), they are elected anyway and get what's called an "overhang mandate" (i.e. an extra seat, the exact size of the parliament is not fixed before the election).
Comment: Now, the trick is that the number of seats for a province isn't fixed in advance either. It's assigned based on the total number of valid votes in each province. A party's number of seats is determined at the national level and then shared between the provinces, to be filled first with the directly-elected MPs and then by an extra list of candidates. If you live in a province with many directly-elected MP, your vote does not help elect them (they are elected anyway). But it can mean your province gets more seat to the detriment of other provinces where your party could win seats.
Comment: Many things need to happen together for this to happen but it has, several times, and the law was changed to address it, making the system even more complicated. I think it can still happen in other elections.
Comment: I can honestly say that that is amazing.


Why do anime have manga adaptations? Why don't authors just focus on one medium at a time?

Question: Instead of having to work on both the anime and the manga at the same time, why don't the authors just focus on one?
Comment: The person writing the manga usually doesn't work on the anime adaptation.
Comment: out of curiosity, why do you think the work on more than one thing?
Comment: more money to be made
Answer: For this answer I am going to assume only works which began as an anime and were later adapted into manga are under consideration. This is hard to study nowadays because there are so few anime-original works, but in most of the cases I know of, the manga is just tie-in merchandise for the anime, the same way anime adaptations of manga are tie-in merchandise for the manga, or anime and manga adaptations of light novels and visual novels are tie-in merchandise for the light/visual novel.
Usually, the author of the manga is a contract worker of some sort: the studio hires them to write and draw a manga version of the anime, sometimes while the production of the anime is underway, and sometimes after it's finished. The original team behind the anime doesn't usually work on the manga; their names might be on the cover as a "Story" credit, meaning they're just being acknowledged as the creator of the story. It's the reverse version of seeing "Based on the manga by XX" in the opening credits of an anime. So having a manga adaptation doesn't actually take any effort away from the anime; the two productions go ahead independently, sometimes extremely so. For example, the first manga adaptation of The Vision of Escaflowne was based on an early version of the story from when Yasuhiro Imagawa was attached as director. Imagawa left to direct G Gundam and the production was put on hold, but the manga went ahead with his shounen version of the story, only to become inaccurate later when Kazuki Akane came in and reworked the show as a shoujo series.
Some anime also have spinoff manga, which aren't directly based on the original anime. Evangelion, for example, has Angelic Days, Shinji Ikari Raising Project, and Campus Apocalypse. Madoka has Kazumi Magica, Oriko Magica, Wraith Arc, The Different Story, Homura Tamura, Homura's Revenge, Tart Magica, Suzune Magica, and probably soon the epic crossover Puella Magi Mahoro Magica: The Resurrection. Like the direct adaptation manga, these are passed off to hired help, but they often have valid creative reasons for existing. Angelic Days and Shinji Ikari Raising Project explored the banal world that Shinji creates in his mind in Episode 26 of the anime. Wraith Arc and The Different Story fill in parts of the anime storyline that weren't shown onscreen; Suzune Magica and Tart Magica focus on different characters in the same world; Homura Tamura is a parody. Since manga are cheaper to produce than anime, the spinoff manga are a low-cost way to explore the world of an anime, or create alternative scenarios, or to give hardcore fans something they want that doesn't have wide enough appeal to fund another anime. Some of these spinoff manga, I don't care about, but reading The Different Story totally changed my view of certain characters and events in the anime series, so I'm glad that the anime staff didn't decide to "just focus on one" and allowed the spinoff manga to be made.
Answer: Like @ToshinouKyouko and @JonLin commented, there is more money to be made, while the author don't even have to lift a finger. So, as a working person, why not? You get a chance to earn more with very little, if any, work to do.
Sword Art Online
I'll take SAO as an example. Volume 14 of Sword Art Online (SAO) was sold at 590 JPY per copy and 350,693 copies was sold in 2014 fiscal year (November 18, 2013 - November 16, 2014). The total income for the publisher would be 206,908,870. Sources here and here stated that the average royalty rate for a writer is between 8% to 50%. I didn't manage to find a reference for the Japanese publishing companies. So, let's assume that the royalty is at 10%, Kawahara Reki (SAO's author) would earn 20,690,887 JPY from volume 14 alone. SAO got 3 volumes released per year. Assuming that every volume sold at the same price and number, per year Kawahara-sensei would receive 62,072,661 JPY from the LN alone.
Sword Art Online also has anime adaptation. It was being sold on DVD and BluRay (BR) for 5,800 JPY and 6,800 JPY respectively for the first volume (episode 1 and 2 of first season). Next volumes sold for 6,800 JPY and 7800 JPY respectively. 17,677 copies of the first volume of the second season got sold in a week between 2014 November 10 and 2014 November 16. Volume 1 of the second season of SAO was sold at 6,800 JPY for DVD and 7,800 JPY for BR. It was release on 2014 October 22, that is 3 weeks before. Assuming it gets sold at the same amount for every week, then we get 53,031 copies sold for the first 3 weeks. Total income from BR sells would be 413,641,800 JPY.
Cost per episode is approximated at 15,000,000 JPY per episode (DVD and BR printing cost included). The aforementioned SAO season 2 volume 1 BR has 3 episodes in it, thus it cost about 45,000,000 JPY. The creator got 1.7% of the net revenue (income - production cost), that is 6,266,910.6 JPY (1.7% x 368,641,800). Like I mentioned earlier above, the creator don't have to lift a finger to get that extra income. The anime production house would take care of it. They have a scenario writer and director to make the anime based on the LN.
Now, a LN release only 3 volumes a year, but BR releases 1 volume per month, that is 12 volumes a year. SAO II may only have 9 volumes, but that is still 9 x 6,266,910.6 JPY (56,402,195.4 JPY).
Extra

The KonoSuba LN selling went up after the TV anime aired by approximately 3 times.
I assume Kawahara-sensei's contract earns him royalty at 10% rate. Since he is a best seller, it is possible that his contract earns him more than that rate.
Answer: Generally, when an anime is being produced there is a studio doing the production. There are numerous writers/editors working on it and the author may or may not have creative control of the content.
I would say the work involved also depends on the source material in question. There can be both licensing for an anime and a manga to be produced simultaneously from something like a light novel.
There is also the fact that anime, airing on TV, is subject to stricter guidelines in content. Particularly in regards to violence and nudity.


Recommendations for a bottle supplier

Question: I've been struggling to find a supplier in the UK who sells amber 330ml bottles suitable for European crown caps. I'm looking for glass or plastic bottles preferably of the tall style as opposed to the dumpy Belgian style.
Answer: Go to a brewery that uses the bottles you want and ask them where they buy from. If their seller is not willing to sell to you, ask the brewery if you can buy from/through them.
Answer: If you are looking for bottles suppliers in the UK it can be worth checking out the SIBA directory. Some of these will be able to supply home brew quantities, and if not they may be able to point you towards resellers who can supply sub-pallet quantities.

Recommendations for a bottle supplier


Building gstreamer_ndk_bundle

Question: I'm trying to build gstreamer_ndk_bundle under Ubuntu 12.4 and I'm failing miserably! I have installed all "glib-dev" packages (packages that in their name have glib and dev), and also I have tried to compile/install glib 2.33.1 (latest) from source, but I always get this error:
/home/marko/gstreamer_ndk_bundle/jni/../glib/gobject/gmarshal.c:149: undefined reference to `g_value_get_schar'
collect2: ld returned 1 exit status
make: *** [/home/marko/gstreamer_ndk_bundle/obj/local/armeabi/libgobject-2.0.so] Error 1

This means that glib source doesn't have the definition for g_value_get_schar, and since that function was introduced in glib somewhere after version 2.30.0, my guess is that I am not using proper glib!
I tried to force gstremaer_ndk_bundle to build with sources from the folder /home/marko/glib-2.33.1/ which I compiled/installed by exporting these env vars:
GLIB_GENMARSHAL=/home/marko/glib-2.33.1/gobject/glib-genmarshal
GLIB_COMPILE_SCHEMAS=/home/marko/glib-2.33.1/gio/glib-compile-schemas

Also I changed gmarshal.h so it includes gmarshal.h from the installed glib folder:
#ifndef _marko_glib_loaded
#define _marko_glib_loaded
#include "/home/marko/glib-2.33.1/gobject/gmarshal.h"
#endif

But failed in both cases.

How can I know what glib is used while compiling gstreamer and install the proper one?
How can I force gstreamer_ndk_bundle to use glib sources from the folder I have un-tared/configured/installed and not the system ones, or whatever ones it uses?
I read somewhere that I need gstreamer-devel package if I keep getting this error while compiling. Where can I find that package?! Can't Google it out...
Has anyone EVER built gstreamer_ndk_bundle and lived to tell the tale?
Answer: I set --enable-debug=no flag in glib/Android.mk. And the link error is gone.
Try this.
P.S. You have to start ./setup.sh to reconfigure all the packages.

Building gstreamer_ndk_bundle


Is it possible to get Android on a Nokia e65?

Question:
Possible Duplicate:
Can I install Android on my non-Android device?

Does anybody know if it is possible to get android on a nokia e65?
Thanks for your time
Answer: The Symbian Series 60 operating system running on most of Nokia's high-end phones is very different from the Linux-based operating systems like Android, so someone would have to put a lot of work in to getting it working on devices designed for that. I haven't yet heard of any projects trying to convert any of Nokia's Symbian based phones. One of the primary problems is that Symbian generally runs on far lower powered devices and is a much smaller, simpler piece of software, so I'm not sure that Android could fit into a phone designed for that.
There is a project that aims to get Android working on Nokia's Internet Tablets (the N800 and N900 ranges) called NITdroid. These devices are already running a customised version of Linux (in their case Nokia's Maemo, rather than our Android) so converting them to Android should be possible.


How does Wells Fargo can detect my right account if I have multiple accounts when I am transferring money?

Question: I have 4 different bank accounts with 4 different banks. I wanted to transfer money from my account in Wells Fargo to my account in some other bank ONLINE. But I don't see any option to add my other bank's account number and routing number in wells fargo website. I can add the recipient by first name, last name and email or phone number. My question is, how does wells fargo know what is my right bank account among the 3 other bank accounts, by just using my phone number or email? I feel it too confusing.
Comment: I saw a similar question on this website, but that does not answer what if we have multiple bank accounts and if we want to send money to only 1 account by email or phone.
Comment: What transfer system are you using?  If you're not providing the account number and RTN, then you're doing it through some other system - I would guess SurePay?
Comment: yes, it is WF Sure Pay
Comment: Usually the recipient has to pick their account if it is sent to an e-mail has been my experience in Canada.
Answer: With SurePay, the recipient has to register in order to receive funds.  They will select where the money is deposited.  If you are both the sender and the receiver, I don't know if the system will get confused or not - If it will work at all though, you'll ultimately need to enter the information for the receiving account.
The point of sure pay is to avoid the receiving party needing to give the sender their account information.  The banking system still gets the account information explicitly from both sides.
EDIT:  This post also provides relevant and more detailed information: How does Wells Fargo use my phone number to find my Bank of America account?
Comment: Sorry, I didn't get the answer either by your answer or by the link you provided in your answer. I already know that link. But my question is, for example if I have bank accounts with BoA, Wells Fargo, Citi Bank, US Bank, and I want to transfer money from my wells fargo account to BoA using WF Sure Pay, HOW DOES WELLS FARGO KNOWS that I want to transfer money to BoA account.
Comment: Whoever is the recipient - whether that's you or someone else - needs to register. When you register, you'll have to tell them which (specific)account you want to receive money. Your question seems to be based on a premise that WF automatically detects your accounts at various banks, and that is not true.
Answer: SurePay is not designed to send money from one person to himself.  It is designed to transfer money from one person to someone else.
What SurePay does, is allow you to link an account to a name/email/phone number.  Then, when someone else, who's also linked an account to a name/email/phone number, selects your name/email/phone number to send money to, the money is transferred.
<code>(your account#/ABA #) -> (your email) <-> (their email) <- (their account#/aba #)
</code>
This doesn't buy you anything when transferring money to another of your own accounts.  I won't say it's impossible to use SurePay to do so, but it's definitely not designed to do so, and may not be permitted.
If you could use it for that purpose, you would have to separately register your two accounts, using a separate email for each, and then use the first email to send to the second email; each will have been tied to a different account, so you'll know which is which.
My suggestion would be to follow Wells Fargo's instructions here:

Can I transfer funds to or from my accounts at another institution?

You can transfer money between your Wells Fargo checking and savings accounts and accounts you may have at other U.S. financial institutions. Wells Fargo gives you greater flexibility, convenience, and control to transfer funds where and when you need it. Sign on to Wells Fargo Online and click the Transfers tab to learn more about transferring funds to your account at another financial institution.

As that should give you the official answer, at least.
Comment: OK, Perhaps I want to ask like this. So, what if I want to transfer money to someone using SurePay if that someone has multiple bank accounts with different financial institutions??? How does the system recognizes a particular bank account of that someone from multiple accounts of that someone??????
Comment: And why shouldn't I be that someone?
Comment: I saw your instructions, and I already tried them. If I follow that instructions I can transfer money INTO wells fargo account, but cannot transfer money from wells fargo account.
Comment: @TheGuest If you want to transfer money using SurePay to someone with multiple accounts, it's up to them to associate the correct account with their SurePay ID/email/whatever.  That's the _point_ - you don't know about that detail.  SurePay is not designed as a way to get around paying ACH fees to transfer money between accounts - it's designed as a way to allow you to transfer money to a person without knowing their bank info.
Comment: Yes, I don't about it. That is my question here :)


What are options for Bi-Directional Replication of SQL Azure Database

Question: This questions came from a developer friend who is working with SQL Azure Database.
Scenario: There are two Azure DB servers, one in North America, USA region and another one in South East Asia region. One way replication has been setup for a read-only replica to enable a local client to get data faster. The issue is whenever the client has to write data to the database, they need to write to North America, which incurs large latency issue. As a solution, they want to setup bi-directional replication between two servers to keep them in sync and thus allowing a client to read and write from a server located in their region.
I'm more of SQL Developer than DBA, thus, I'm not familiar with different options that could be available for bi-direction in SQL Azure DB. I have told him about SQL Broker and how I saw it used for near real-time replication and with some effort it could be set up for bi-directional messages, though not sure if it can be implemented in SQL Azure DB.
Answer: There is currently no option within SQL Azure for bi-directional (merge) replication. You could alternatively look at Azure Sql Data Sync or SQL Server on an Azure VM.


JAVA -- Should I use a float or double for 1.5 speed for my player's speed? What should I use in general for positions, etc.?

Question: The title says it all, but I would like to know if I should use a double 1.5 for my velX and velY factor, or a float 1.5 for my velX and velY factor. Also, I would like to know if I should use a double or float for everything such as positions of entities, etc.. Thanks in advance!
Comment: Not going to lie, this is totally a micro optimization. If this is the difference between your game engine being able to keep up with your game or not, then you have made some other very serious errors along the way.
Comment: That depends primarily on your specification - do you require the extra precision? Is the extra memory consumption a problem? ....
Comment: http://stackoverflow.com/q/27598078/1889720
Answer: Both the single-precision 32-bit float type and double-precision 64-bit double type can represent numbers like 1.5 exactly, with no rounding error.
(ie. as 1 * 2^0 + 1 * 2^-1, followed by 22 zeroes in the case of a float, or 51 zeroes in the case of a double)
Neither one can exactly represent a number like one-fifth, 0.2, because its denominator is not a power of two. The closest you can get with a float will be off by about 0.000 000 004, or four-billionths of a unit, and double will get even closer.
Now I don't know about you, but I don't usually tune my game's meshes/colliders/speeds to tolerances of billionths of units, so in practice the precision limits of float don't cause many problems in day-to-day game development calculations, as long as we're working within a few kilometers of the origin of our coordinate system - since both float and double use a sliding scale of precision, staying more precise for values close to zero, and trading-off some precision to represent bigger numbers. You can consult the table in this answer for the precision available in each range.
There are a few cases where the limits do crop up though:

Exact comparisons. Whether you're using float or double, don't use if(myValue == thisTargetValue) - because even a difference of billionths of a unit like we saw above is enough to make this comparison fail.  Compare using ranges instead, so your code is tolerant to some fluctuation in the tiny final digits.
Time. If you measure your time in seconds with a single-precision float, then if your game is left running for a day you'll be in a range where you start to lose millisecond precision, and that's usually enough to make sensitive timing code go haywire. float is fine for accumulating time deltas like "how long has the player held the jump button," but don't use it for your global time. double should be more than sufficient for games played over human lifespans though. This type of error has led to the failure of missile defense systems, so take it seriously. ;)
Big Spaces. Once you go further than a few thousand units from the 0 point of your coordinate system, the precision limits of float tend to become significant. You can see this in Minecraft versions before Beta 1.8 - if you walk far enough in one direction, movement becomes jumpy and the terrain starts getting weird, as the errors grow to reach the sensitivity thresholds of the algorithms being used.
3D rendering and physics engines usually work exclusively in single-precision float types, so changing absolutely everything over to double is generally not feasible. Instead, games with huge worlds usually solve this by breaking the world into chunks, and working with coordinates relative to the center of each chunk, rather than always in reference to the origin of the whole universe. Kerbal Space Program uses a float coordinate space with a "floating origin" that moves to keep the player centered, while an underlying orbital mechanics simulation uses double values for computing the large-scale trajectories.
Accumulated Error. An error of billionths in one calculation isn't much. But if you use that as input into another calculation, then use that output as another input, on and on in a feedback loop, then the errors can accumulate and snowball out of proportion.
A common way this can happen is if you store a transformation matrix for each object, and accumulate changes to the transformation directly into that matrix, without any error-correction. This often manifests as a spinning object gradually flattening or distorting.
Switching to double only delays the issue a little, because it's really a problem with our algorithm, allowing small errors to self-reinforce and magnify up to visible scales. Maintaining a separate, authoritative source value, or applying error-correction as you go, like normalizing direction vectors, can stop these errors from piling up to visible scales.
Answer: A double has a wider range than a float and use more memory.
In your case it properly doesn't matter but the double is often the default option.
You can read more about it here:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
Answer: It pretty much boils down to how precise you want your world to be. Do you need to be able to move exactly 1 mm at a time or are you fine with just a rough estimate? In most cases I would go with floats as they get the job done most of the time, while also allowing for your game to potentially run faster because you only need half the amount of data in cache. If your game is very  physics oriented(think Kerbal space program) then I would suggest using doubles instead.
Answer: It may also depend on 3rd party framework, engines & libraries. I.E. if you use doubles on your data structures, but your library uses floats, you may find that your doing a lot of casting. In turn, this may impact:

Performance: This SO post suggests (down) casting isn't likely to degrade performance. That being said, sometimes microbenchmarks don't accurately portray what happens in actual production code - always profile before & after attempts to optimize.
Precision & Accuracy: Down casting involves a loss of data. Up casting floats essentially fabricates data. Depending on your needs, this may result in precision &/or accuracy problems.
Readability: Unless you've tweaked your compiler / IDE settings, down casts must be explicit, which can clutter up your code & reduce its readability.
Safety: If you have tweaked your settings to permit implicit down casts, you run the risk of allowing unwanted &/or dangerous down casts to slip through.


electrical - preparing smoke detectors for rough inspection

Question: To get past the rough inspection, should I have the wiring for smoke detectors just pulled through the ceiling box (and stripped, pigtailed etc) or should I have the mounting bracket (for the detector) also installed?
Comment: Normally a rough inspection is the wiring and boxes in. No Sheetrock. This is the case in the states I have worked.
Comment: Need more detail, is this a new install in an existing home or did the drywall get put up before the smoke detectors were roughed in?
Comment: It's a rewiring project (hence the requirement for detectors) so the plaster is already there. The question really is whether the brackets (that the detectors will be attached to) are considered part of the rough prep or part of the final. But I think you answered the question - in a new install there would be no drywall so you couldn't mount brackets, so "no, the brackets are not part of the rough". Correct?
Answer: The level of inspection depends on the inspector. Some get weird on a rough inspection with devices attached some love it. If your detector has a quick disconnect so it doesn't have to be unwired for the Sheetrock I would put it in. I regularly would wire outlets and switches that can be stuffed in the box when putting the Sheetrock up and the 2 main inspectors would ask if I wanted a cover or final because they had already verified my wire length & connection methods.
With this said I had 1 inspector that was a total nut case and went berserk with devices connected. After 3 hours on one occasion I called her boss she just had to find something. Only got her on finals after that. If the wiring needs to be disconnected to cover don't hook it up! Because this will be a waste of time.
Last but not least, four things they usually look at on rough inspection. #1 Make sure your wire lengths are 6" or more from the back of the box. #2 double gang or more boxes or a high wire count verify box fill. #3 make sure to correctly staple Romex flat and at proper intervals. Last all drilled holes 1-1/4 away from edge of board. These are the things I notice on rough inspection.
If the inspector fails you on any area ask for the code reference. I'm my state the inspector must cite the reference to write a violation. Whatever you do don't argue just take notes. That's the best advice I can give.
Comment: Thanks for all the advice, especially the four points. About arguing: I saw a quote on another site about arguing with an inspector is like mud-wrestling a pig: the pig enjoys it. Cheers.


Is there a standard height for wall mounting flatscreen TVs?

Question: Is there a standard height for wall mounting flatscreen TVs?
Comment: my "tv wall mount set" suggest to mount so that bottom of the TV is at eye level: https://drive.google.com/file/d/0B4ty0DOtGLeyd0JQWDhxY3JQRTg/edit But in Internet it's often suggested to have center of the screen at eye level, for example http://411buyitnow.com/blog/wp-content/uploads/2012/08/height-watching-tv.gif. I still not sure what's preffered.
Answer: Eye level
The center of the TV should optimally be lined up to your eyes. This will change based on the purpose of the TV. In the kitchen, our TV is about 6 feet off the floor over the counter top because we do a lot of cooking / baking; so we're standing when watching TV.
In the family room, take this measurement when you're sitting on the couch.
Same thing with speakers: place surround sound speakers at roughly the height of when you're sitting down from the floor to your shoulders (for a 6' individual, that's about about 26").
Comment: Thank you Mario, that makes a lot more sense (and looking at history, matches with what it said before @warren's edit.)
Comment: I'm having trouble getting the math and the description in that last bit about the speakers to jive with each other... can one or both of you elaborate on what you're trying to say please?
Comment: Sit down; where ever that may be - on the couch, on a chair, whatever. Take a measurement from the floor to your shoulder and try to put the speakers at about that height. Speaker stands come in all shapes and sizes and if your so inclined, mount the speaker to the wall. Keep in mind, anything AV is objective. No matter how its configured, if you don't like how it sounds or looks, change it to suit your preference.
Comment: I assume TVs would be like computer monitors, where you actually want to bias them a little bit *below* eye level; I've heard instead of having yours eyes centered (1/2 from the top), you want to be closer to 1/3 from the top (2/3 from the bottom)
Answer: This is an answer not to the question you asked, but to the unasked portion that was (imho) incorrectly answered in Mario's otherwise great answer. That's about where to position the speakers.
The general guidance for TV placement at eye level is great, because every one instinctively will sit somewhere where they can see the screen. Sitting relative to the speaker placement is rarely something they think about, so whoever is doing the installation needs to.
A generally accepted pattern is to mount the speakers just above head level for a small intimate space, or significantly above head level for a large space. About the only time you can really get away with them at shoulder level is if you have only a very limited number of seating positions and you have clear lines of projection from every speaker to every ear. (sub excluded.)
It's also important to keep all of the speakers in a single plane throughout the room. Getting them wildly off plane can really mess with some people's sense of balance while watching movies with heavy spatial mixes. (i.e. movies that fully use surround sound and push different sounds to different far corners of the room.)
Answer: My general rule on the height of wall mounted TVs is that it must be higher than the kids can reach, but not to high that it looks like you are looking up at the sky all the time. Of course in some cases you need to also take into account climbing access.
But eye level is also good. Most of the time my TVs are at eye level when you are standing directly in front of the TV. The distance for sitting in front of the TV also plays a part as it will naturally change your angle of viewing using this method. Further away is better.


How to find out what modules are adding links to a menu?

Question: I was wondering if there's any way to find out what modules are adding links to what menus using hook_menu()? I don't care if it's a module or custom code added to Drupal core, I just need to know. There's a link showing up in my main menu and I have no idea what's putting it there. I'd really rather not go through every single module and check their menu hooks.
Answer: You're after module_implements(). It will allow you to specify the hook (in this case 'menu') and then get an array of module names back.
Of course, you'll still need to manually open the files to check, but you should be able to narrow it down from the menu path and title.
It might be worth flushing the caches too.
Comment: The main problem with module_implements for chasing down a menu router entry is that just about every module (or at least a large majority) implements hook_menu for settings pages.  You end up having to examine just about every module anyway.
Answer: To find a particular menu entry, search the menu_router table for the path or something that matches the path if arguments are used, and then use a hook_menu_alter to print the menu item to debug:
function mymodule_menu_alter (&$items)
{
  print_r($items["foo/bar/baz"]);
}

Then look at the page callback index.  If will contain a string with the function name that gets called for that menu item (see hook_menu for more details).  In general, the callback function will closely match the module name.  For example, if the callback is "foo_bar_generate_a_page" then the "foo" or "foo_bar" module owns that menu entry.
Answer: Most text editors (notepad++, sublime text, textmate, etc) have "Find in files" functionality that you can use to search your entire Drupal codebase. Just put in the path you're curious about (e.g., user/login or admin/appearance) and point it to your sites/all/modules folder and it should point out exactly what module's hook_menu is responsible.
If it doesn't find anything, make sure you're not searching for a menu that has arguments. If I wanted to know what module is responsible for node/add/page I would need to make sure to leave off /page since that won't be hardcoded in any hook_menu.


Game-rec and designer intent

Question: Should citations of designer intent alone be sufficient for a valid answer to game-recommendation questions? That is, in the absence of any description of actual play experience?
Comment: Given it's not actually in question whether people are allowed to cite designer intent - we've _always_ done it - perhaps it's better to ask if it is _sufficient_ to cite designer intent (as opposed to experience). After all this is going down in our RPG.SE archives, might as well be accurate and not make people think it's forbidden to cite designer intent.
Comment: Despite the view I've registered, I think this is a great question to get clarity on.
Comment: @doppelgreener good idea, done
Answer: No, game-rec wants what actually works, not what is supposed to work
The game-rec rules rely on one simple premise: you, or someone you can point to, has actually tried what you recommend, and it actually worked.
A statement of designer intent is a statement that something should work, but that does not mean it actually does work. And "actually does work" is the basic requirement of a game-rec answer.
Designers do, of course, play their own games. Designer statements describing their own play of their games are fine, great even. But the statement alone that they meant for a game to be good for some purpose is insufficient.
Comment: is that second-to-last word a typo? Perhaps "is"?
Answer: Game-rec guidelines allow citing other people's experience using a game for the exact use described in a question. Designers are people too.
In practice it's very rare for there to exist clear, citable statements from a game's designer that it functions usefully for X, where X is an exact match for something in a game-rec question, so it's not really an issue. If someone did cite an exact match, it would make for a very good answer.
Comment: @doppelgreener In practice though, whatever an answer literally cites will weigh on its voting. "Designer says it's great" is not excellent experience to cite and won't get votes, while a detailed play report via a designer will carry lots of weight. In sum, I'm really not worried about making up an airtight rule here, because practical application in our site context has got us way covered on that front.
Comment: @doppelgreener However, the context was a couple lines from [Voluntary banners for game-rec answers](http://meta.rpg.stackexchange.com/questions/5639/voluntary-banners-for-game-rec-answers) that are now deleted, so this question has become very hypothetical. I'm comfortable being cavalier/imprecise about this until there is practical relevant examples to deal with. We're much better at deciding things with concrete issues at hand. Lacking concrete relevance, "citing designers is OK, be sure to do it well so the voters don't mangle you" is about as precise as I think this needs to be.
Comment: Citing a developer's experience is different to and better than citing their intent. You're conflating these two in this answer. Intent is theory & motivation, experience is the system actually put to practice.
Comment: @SSD: even better is to be able to cite a designer's intent and compare it to how the game gets played (or what loopholes exist).  This aids GMs in understanding what is "between the lines" in some of in print material that leaves GMs scratching their heads.  (Why did AD&D 1e come to mind just now?)
Comment: The distinction made by @doppelgreener is crucial, and exactly my objection to citations of *intent*. I need to know whether or not they *followed through.*
Comment: @SevenSidedDie Sure, I agree with all of that, but to stay on track, this is a question about whether citing intent is ok, and you've responded saying citing experience is ok, which doesn't make for an answer (it isn't in question whether developer experience is ok). Designer intent has typically been neither here nor there: the minimum requirement is experience, go nuts with quoting whatever intent you want as long as it's a good answer and you've also provided experience.
Comment: @KorvinStarmast That's a good point.
Comment: OK, my question comes down to this: an answer of "I have heard game XYZ would be good for this" would be deleted (unless they cite where they heard that, and the person they cite didn't just hear it, they actually did it). Why does this change if the place they heard it is the developer rather than someone else? Because that is what a citation of intent (sans experience) amounts to. Why should that answer be treated differently. Also, no, this is not hypothetical; the rule about what is and is not acceptable for game-rec is independent of the banners (the banners should just match the options)
Comment: @KRyan I agree on that expression of it. I am thinking more about games that, by structural analysis, are obvious matches for a request's criteria. This happens more with small games, where the focus makes such analyses trivial. But, I don't know how to phrase such a thing without opening the door to exactly the hearsay you're concerned about (and I agree is warranted), so I'm leaving that tiny case for now.

Game-rec and designer intent


What are the pros and cons of the Suzuki method of the piano teaching vs. traditional piano teaching methods?

Question: What is a best and most efficient way to start playing piano? Suzuki method or Traditional? I'm 21 years old.
Answer: (I'm assuming you want to learn classical piano, not popular)
Since you're already 21 years old I would not recommend the Suzuki method.
I don't know it very well but from what I know it's aimed at children.
The Suzuki method is very slow, it relies on the same ability a child uses for learning his native tongue, it relies on a lot of recordings (which may influence the musician towards a fixed style).
Using the pieces selected for the Suzuki method books to study though, can be very good.
It can be a influence from my musical education, but I would go for the traditional method.
The most important thing is to find a teacher who can connect with you.
I started to study the piano when I was 19 years old, I talked with a lot of teachers until I found the one who had the best connection with me.
Do not go for those online piano teaching courses, it's terrible, those courses will teach you how to hit some keys, not how to play beautiful music.
Music is about passion, is about feeling it, understanding it. Only a good teacher, who can connect with you, can pass this passion and this knowledge to you.
Another very important thing is to get a proper piano (or digital piano) as soon as you find out that you want to keep studying.
Do not buy something expensive to start of, you may not like it, but be prepared to buy it as soon as you feel that music is your thing, cheap keyboards can be amazing for popular musicians, but you'll need the control a proper piano gives you to keep a steady progress.
A last tip, don't be afraid of theory. It can be tedious in the beginning, but after getting the hang of it, it will allow you to start experimenting, improvising and exploring your piano. This is a very important skill that many strictly classical students do not have, simply because they never tried.
Well, those were the steps I followed when I started and they proved to be very useful to me.
Answer: I have been teaching for 50 years.  I agree that the important thing about finding a good teacher,  once you know he/she is qualified, is to find that connection.  Do they understand your purpose for wanting to learn piano?  I do not like the Suzuki method for any age.  The music books at the level 2 and above are pretty good,  but I prefer a graded level for folk, classical, rock and hymns.  I ask each student what they would like to play if they could play anything in the world.  This gives me a good idea of where their interests are. The emphasis is intervals, expression, enjoyment, popular, standards,  and sight reading.


How to use the LSTM layer in PPO architecture?

Question: What is the best way of using the LSTM layer in PPO architecture?
Should I use them in the first layer of both actor and critic, or use them just before the final layer of these networks?
Should I feed the architecture with a stack of states (the state stacked with the k previous states)?
Answer: Not sure if you're using TensorFlow-Agents for this, but if you are, there's some nice functionality for this built out using the ActorDistributionRnnNetwork and ValueDistributionRnnNetwork that I've found to be very helpful.  The LSTM architecture is used in both the actor and critic networks.  See this page for more information - hope this helps!


Getting this install error using latest CivicCRM on wordpress

Question: Fatal error: Uncaught Error: Call to undefined function set_current_screen() in /var/www/html/wp-admin/admin-header.php:30
Stack trace:
#0 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php(267): require_once()
#1 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System.php(219): CRM_Utils_System_Base->theme('__construct(-5, 16, Array, 'CREATE TABLE ci...')
#6 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -5, 16, in /var/www/html/wp-admin/admin-header.php on line 30

Comment: Can you check CiviCRM logs for detailed error. It seems u getting some db error for creating tables( already exists) .
Answer: It seems like you have two problems.
As Pradeep mentioned in the comments - it seems like your underlying error is that the install is trying to create a database that already exists.  I can't tell for sure, because the error in #4 is cut off.
Additionally, there's the second error (undefined function) which is unfortunately WordPress-specific and I don't know the solution.  However, completely removing/creating the CiviCRM database again (assuming that it's separate from WordPress) is likely to solve the first problem, and the second problem won't occur.
Comment: I had the exact same exact error; creating a new database in the mysql daemon, assigning the same DB user with all privileges and importing the database dump fixed  it for me. I still don't know the original cause. Hassan's fix didn't work, though others have said it will.
Answer: Try adding following line in functions.php file of your child theme.
require_once(ABSPATH . 'wp-admin/includes/screen.php');
Which wordpress version and civicrm version are you trying?


How to make a conditional SQL statement

Question: I want to make a conditional SQL. I have one table "users" and it has two columns (id, status)
I need to search for users IDs based on their status.
For example :
Every 5 seconds I am querying from the database (by AJAX) as per the below description:
Let us say that I have the below results on my wall (on html):
id1: 1
status2: "A"

id2: 2
status2: "B"

I need to get IDs from table "users" but exclude the IDs from database if their status haven't changed on my wall.
So the algorithm should be:
Get all IDs from table "users" but exclude the IDs (1,2) from database
(if and only if) their status = ("A", "B").

Simply, I need to retrieve all IDs including the IDs (1,2). But for the IDs (1,2): I need to retrieve them in case their corresponding statuses are NOT EQUAL ("A", "B") respectively.
But for IDs other than (1,2) like (3,4,5,...), I need to retrieve them without any condition.
I would greatly appreciate if the solution provides an excellent performance when the database records are huge and the check every 5 seconds.
Answer: If I understand correctly, you want something like this:
WHERE (id IN (1, 2) AND status NOT IN ('A', 'B'))
   OR (id NOT IN (1, 2))

This can be boiled down to the shorter (but, I think, less readable):
WHERE id NOT IN (1, 2) OR status NOT IN ('A', 'B')

Answer: Is that what you are looking for:
SELECT id FROM table1 WHERE id NOT IN
(SELECT id FROM table1 WHERE id IN (1,2) AND status IN ('A','B'))

How to make a conditional SQL statement


Is a vibrating clutch after gearbox replacement normal?

Question: My gear stick was getting stuck when changing gears and the mechanic thought there was a problem with the gearbox, so he took it out and replaced it with a 1.4 gearbox (my car is 1.2). I got the car back last night and I've driven a few times since, but the clutch is vibrating/ shuddering when I change gears. I've never had a problem with the clutch before this.
I'm just wondering if this is normal? Do I need to just give the car a couple of days to "settle" or has the mechanic created a new problem that I need to fix?
MOT is due soon - I'm guessing this won't pass. Thank you for any responses.
Comment: Welcome to Motor Vehicle Maintenance & Repair! Changing out the gearbox for hard shifting is not where I'd have gone first. Did the mechanic change out the clutch with the replacement of the gearbox?
Comment: The MOT test does not examine anything about the engine, clutch, or gearbox except the emissions test, so unless this is so bad that the tester can't drive the car into the test bay or onto the brake tester, it is not a failure issue.
Comment: Aside: make sure the speedo reads correctly, some older vehicles take it from the gearbox.
Comment: Shudders when you Depress or Release the clutch pedal?
Answer: No, that is NOT normal.  Something is now wrong with the clutch as it should work fine from the start after a repair.  I suspect that the clutch may have become contaminated with oil or grease during the transmission swap out or possibly re-installed improperly.
Either way, you should return to the shop that did the work and have them fix the problem.  If the clutch was fine before the transmission change, it should still be fine.  If there was a problem with the clutch or is was worn when they had it apart, they should have advised you of the problem and let you decide to fix it at that time.  The incremental cost to replace a clutch when the transmission is out if minimal since most of the work in a clutch replacement is removing the transmission to get at the clutch.
Comment: Most likely they bent the centre plate when refitting the 'box...
Answer: There are a good few things to take into account when something like a gearbox is swapped, especially for a different version. The other techs cover some of these.
As mentioned clutch contamination or damage are possible causes for the vibration. Unless the clutch has been recently replaced it would have been a good plan to have it replaced during the Gbox swap, as this prevents any unnecessary future work in the same area for a good while.
There could also be an issue, wear or differences between the pilot bearing and spigot shaft diameters, an issue here will cause clutch vibration. The pilot bearing should be checked/replaced during such work to prevent chances of clutch vibration on reassembly.
Return the vehicle to the garage that did the work for you and explain that this is a new fault that has only occured since the repair.


Legal ramifications for writing about fictional relationships with celebs

Question: I'm thinking about developing a blog where the main character is fictional and has fictional relationships with well known celebrities and sports figures.  Are there any legal ramifications for writing about celebs in this manner?
Answer:
I AM NOT A LAWYER.

As long as it is clearly evident that the piece is fictional, my understanding is that you can basically employ celebrities however you like.
Major issues you generally want to avoid are:

libel and defamation
copyright violation
use of likeness without permission

But a fictional account (clearly presented as such, and not using copyrighted works or actual pictures of the celebrity) has none of these problems. See, for example, The Social Network, a dramatized account of the founding of Facebook, which played fast and loose with the facts and was produced without consent or cooperation from its subject, Mark Zuckerberg.
The major thing to watch out for, then, is looking as though your blog is nonfictional. In blog format that'll be a bit hard, because you probably don't want a disclaimer in every post. Make sure you can get something very clear into your design, maybe even a regular line in your RSS feed, to avoid anything approaching misleading appearances - because those could probably get you into trouble. But the act itself, publishing fiction involving real-life public figures - that should be perfectly OK.
Comment: Here's a conversation on the topic that goes into greater depth: http://ask.metafilter.com/106041/How-can-fictional-works-present-unflattering-portrayals-of-living-people-without-legal-comeback
Comment: Can't a celebrity with deep pockets still sue, or the company that has them under contract? No offense meant, but if you're really concerned about this, I suggest asking a lawyer to be safe.
Comment: People with deep pockets can _always_ sue. In this case, my own humble understanding is that they don't have a leg to stand on. But **IANAL**, and legal advice is always fun and educational!
Comment: Hey Standback!  Thanks for your useful insights.
Answer: One question that becomes very important is whether you are being positive or negative about the celebrities. If you are going to suggest that, for example, David Cameron had a gay affair with your lead character, then don't - you will get in trouble. If you are wanting to suggest that your lead character was at an official event that He spoke at, and talked to him about nothing significant, then you should be OK.
Picking up @VictorGs comment, you could use meaningless meetings with current people to provide reminiscences about past ( and dead ) characters that they have met, which can be more racy/ controversial.
I would suggest that there is a link on the blog that makes it clear that this is a fictional account - not necessarily prominent, but noticeable. Also, consider whether you would allow comments - probably not, unless it is critical to your project. YOu could get in trouble for comments that assume the blog is real, I think.
Disclaimer: IANAL.
Answer: IANAL. Courts have ruled that you can say a lot of things about "public figures" and they will not have grounds to sue. That said, if a person with a lot of money found what you said about him offensive, he could still sue you. He might not win, but you would have to hire a lawyer to defend yourself, take time off work to go to court, etc.
As others have noted, I would definitely avoid saying that a real person did something illegal or scandalous unless you want to go to court. If your story has a passing reference to the hero attending a concert by some famous singer or watching a politician give a political speech on television, no big deal. But if you say the politician accepted a bribe from him or he sold cocaine to the singer, I think you're just asking for trouble. If the reference to a celebrity is long, it could still be okay as long as it is innocuous. Like if, say, your hero is in the army, and you say that the president gave him a medal, and you relate some conversation between him and the president where they discuss how he earned the medal without presenting the president in a bad light, I doubt that would get you in trouble.
Comment: @trig Also, and perhaps I should have included this in my answer, I've seen a few court cases where the judge said that as any rational reader would know this was fiction and not a claim that the person really did this or anything like it, it's not libel. But other courts have said differently, so I wouldn't stake my life on that defense.
Comment: Do orgies count as "scandalous"? The "celebrity" section of Nifty has some ... interesting stories.
Comment: @trig Some celebrities would be deeply offended if you said they participated in an orgy, while others would say, "yeah! I wish I could get 20 girls at once like that!" The courts would certainly consider that at least potentially scandalous, so I'd stay away from it. Yes, there's a lot of amateur celebrity fiction that includes scandalous behavior that the writers could be sued for. I'd guess celebrities often figure it's not worth the effort to sue, that by suing they would just turn a story that 20 people have read into national news that a million people would read.
Comment: Girls? At Nifty? (Nifty is a gay erotic fiction site. It does have bi and lesbian sections, but it's mostly gay male. I rarely look at the celebrity ones, because I've never heard of most of the guys featured there, but I suspect that most are straight in real life.)
Comment: @TRiG Ok. I'm not familiar with Nifty and I suppose that among the reasons why I've never heard of it before is that I'm not interested in fiction about celebrities and I'm not gay.
Answer: I am also not a lawyer but have experience in this matter. You may generally use a character in a work of fiction as long as they are in the public limelight. A celebrity, political figure, and so on. It has been upheld in court that since the person is a public figure they are open game for a fictional work. And as previously stated you may not use a picture or graphic representation of the person.
Furthermore, if what you or someone on your blog writes or comments about, you may get into trouble. Your level of tolerance and what offends someone else may be two separate items altogether.
My advice is to only write about persons already dead. I know this is not what you want to do, but here in the United States it's a lot safer. You can legally write ANYTHING you want about a dead person. It can be a story set when the person was alive and you can tell a totally fictionalized account of an event - or use them as a character in a fabricated story.
The caveat here is that you MAY NOT write about a person who is still alive. So if the dead person's wife or children or friends are still alive you have to leave them out of the story. Or get permission from them.
Just some food for thought. :-)
Comment: Your advice regarding writing about persons already dead is not totally correct, at least as far as celebrities are concerned. One state here in the US (California) has restrictions on what you can write about deceased celebrities (See http://en.wikipedia.org/wiki/California_Celebrities_Rights_Act) and New York was entertaining the act at one time as well.
Answer: I'm not a lawyer and my answer is based on the writing workshops I attended years ago.
At workshop, I was told that celebrities in your story ought to be "minor characters" so that the reader doesn't lose focus on your main characters. For instance, you might your main character see a (celebrity) Jane Doe concert with their boyfriend/girlfriend, and then react to something that she might have said or done at such a concert (as long as it is not clearly out of character). Here, the connection with the celebrity is "incidental," and it's understood that such a public figure would say or do things that impact the lives of millions of people, (hopefully) in a positive way. As long as these interactions are "random," your characters can go about their business (and Jane can go about hers) without being "the worse off for the wear."
The problem may arise if you allege that your fictitious character dated Jane, or was her BFF. Then the statements in your novel could potentially impact Jane's life, and if that's the case, it could be actionable, depending on the circumstances.