Question on the double slit experiment

Question: Out of curiosity I wanted to ask what people think about this idea. I understand that when we do the double slit experiment and observe the particle, we get a wave collapse because of the observed certainty, do you think the exact same thing would happen if instead of detecting where the particle is, we detect all of the places it isn't?
Comment: What looks like a wave is actually billions of individual coherent photons. If you measure any of those photons  before they make it to the screen then they will not contribute to the pattern. There is no such thing as a light wave without individual photons.
Comment: I can't think of any way to do this measurement.  It sounds fundamentally impossible.  If so, the question doesn't make sense.  What is the result of an experiment that can't be done?
Answer: The wave function collapses because you obtain the information where the particle is located. The same holds true if you identify all the places where the particle is not. Because then, you know where the particle has to be located.
Comment: Thanks, this backs up what I was thinking myself. :)
Answer: The generally accepted view in quantum theory is that information about which way the
quantum system travelled, and interference fringe visibility is complimentary.
The wavelike property of light (or in general matter) is documented by well-visible interference fringes, whereas the particle-like property is evident if one can tell along which way the interferometer has been traversed by photons (particles).
There are many ways to retrieve path information. Some of them include:

Placing a detector near the slit.
By measuring the atom's recoil in Young-type optical experiments.
From the spontaneously emitted photon in atom optics.
From the idler photon with a photon pair being involved.

No matter how, any attempt to gain the complete information of which-way will eventually destroy the visibility of fringes. Quantum mechanics dictates that if one is performing
any sort of measurement on a photon, its wave function collapses. The photon then acts like a particle thereby destroying the previously observed interference pattern.
Comment: Thank you very much on this detailed explanation. I did think this myself, however I do know quantum is quite strange and do not have the means or money to experiment myself. :)

Question on the double slit experiment


Migrate Ubuntu 16.04 to larger drive and convert to BTRFS and add swap

Question: I'm able to dd my Ubuntu installation from an SD card to my finally-arrived SSD and boot it, but as soon as I resize the partition (using gparted from a livecd), it stops booting. I've tried reinstalling grub2 and nothing. It works again when I dd from the SD again, but I can't get the partition expanded. I'm using ext2, but I want to convert it to btrfs and also add a swap partition.
Comment: Is your SD a bootable? Does it have a 'live' system on it, or a regular install? A 'live' system is a special case with a compressed read-only root file-system. For you SSD, you probably don't want a 'live' system, you want a regular Linux install.
Comment: It is a regular install. Since this post I've expanded by partition, but btrfs doesn't work and I can't find a decent guide to make it work as my boot partition
Comment: I use btrfs a lot as my root file-system, but I still use a smaller ext4 as my boot partition (containing the kernel, initrd, grub or extlinux). Booting directly from btrfs is still not fully supported, I think.
Answer: I would recommend creating a 2GB ext4 boot partition on the SSD, then copying your kernel and initrd into that.
If you want to just copy your SD rootfs onto the SSD, I don't think dd is the best approach. I do something like:
mkdir /bind
mount -o bind / /bind
cd /bind
cp -a . /path/to/new/root/subvol/

Then you will have to edit the new fstab to make sense,
LABEL={ssd-btrfs-label}  /  btrfs noatime,subvol={new-root-subvol}
LABEL={ssd-boot-label}   /boot ext4 noatime

then, boot to the new rootfs by booting from your sd, and editing the kernel command-line to add/change:
 root=LABEL={btrfs-filesystem-label}
 rootflags=noatime,subvol={new-root-subvol}

After booting into your new system, you can use grub-install to install the boot-loader properly on the SSD.
Depending on your kernel and hardware, you can tweak performance with other mount options:
 lazytime,nodatacow


Connecting Arduino To mains

Question: How would iconnect my Arduino Mega to house Mains, without buying a transformer, and having to make a whole setup for that.  Can i just use a regular phone adapter?  Or is 1 Amp too large (or 2 Amps).
Answer: Amps tell you how much current you can draw from the power supply, or "how much it can do".
You can hook up 3Amps power supply to a device that draws 1Amp and it will work ok, still having 2 amps of reserve.
You must pay attention to power supply voltage and keep it in specified range.
Arduino Mega has recommended input voltage of 7-12V, so you must deliver at least 7V. There are plenty of cheap wall power supplies with voltage regulation from 1.5V to 12V.
How much current it will draw depends on your application, but I doubt that you can suck more than 0,5-1A in a typical application.
Comment: Okay, so that is what I thought, because I have read this before that it depends what the device wants.  But then i also saw someone say that it will hurt the Arduino.  But thanks for the clarification!
Comment: Note that the ~7v minimum concerns the power connector.  An Arduino can also be powered with an already regulated 5v via the USB connector.  If a phone "charger" (really USB power supply) is doing what it is supposed to, and properly isolated, that would work.  But some things sold as phone charges reportedly do not do what they are supposed to or lack sufficient isolation to be safe.

Connecting Arduino To mains


Are the latest iPod Nanos running iOS?

Question: The current version of the iPod Nano looks a lot like it is running the iOS. Is it actually running a scaled-down version of the software on the iPhones, or is it just a themed version of the classic iPod software?
Comment: Does not, and has not. Though the familiarity is quite remarkable for a completely different OS, no?
Comment: That it is. I was trying to figure out if there was any chance of Apple ever letting developers port apps over to the device. Checking my email on a watch would be awesome.
Comment: No it wouldn't. Reading song information is not bad. Reading an e-mail of any length is absurdly bad on a screen that small.
Answer: According to this article, an Apple spokesman stated that the touch-screen iPod Nano does not run iOS.

Are the latest iPod Nanos running iOS?


My wireless keyboard / mouse doesn't have enough range, what can I do?

Question: Tried many different wireless keyboard / mouse combos. Their advertised range is often huge, but even at half that distance performance is quite poor. Is there any way to improve it?
Comment: More information on what you have tried so far, and what frequencies they use would be nice.
Answer: Couple things I can think of...

Get both the mouse/keyboard & the antenna as far away from anything electrical as possible, TV, fridge, microwave,computer itself & ensure direct line-of-sight from antenna to keyboard/mouse.
Make sure everything has fresh batteries.
Maybe try a USB Extender cable to get the antenna nearer. Like this one - http://www.maplin.co.uk/p/nikkai-pure-connectivity-usb-20-a-male-to-a-female-5m-l11bt [example only, there are many types available]
Comment: Good answer.  Does battery strength matter for this?  Or is the circuit digital: on if sufficient power / off of insufficient power?
Comment: Anecdotally, I've found tired old alkaline batteries will adversely affect the transmission range over quite a period of time. Smarter Li-ion no difference until the last day or so of life. I have discovered that the newer 'universal' type dongles seem a little more robust & less prone to range falloff, though I don't have enough hardware tech knowledge to know how/why that may be.
Answer: The USB dongle that comes with the wireless key / mouse is often directional. It doesn't work equally well in all directions. You need to position the dongle in such a way that the dongle will point at you in the direction of maximum range.
To determine that direction, find a USB port where the slit of the port is oriented in the horizontal direction. Plug the dongle in it, so that the dongle is jutting out also in a horizontal direction along its axis. The side of the dongle now facing up is often the direction where the range is maximal. That's usually the side where you're holding your thumb when you plug the dongle into the port. It's also often the side where the company logo is printed.
E.g., for this dongle, it's the side with the name of the company and the Bluetooth logo:

What you need now is a short USB cable. Plug the dongle into the cable, and the cable into the computer. Now rotate the dongle until it's facing you with the side where the range is maximal. Glue it in place somehow. Now enjoy the better range.
If that side doesn't work well for your dongle, find a position that improves the range.
Also, make sure there are as few objects as possible between keyboard and dongle. E.g., if your computer is across the room from you, plug the dongle (via the short cable) into the front panel of the PC case. Or, if you only have USB ports on the back of the PC, bring the dongle to the front with a cable. Then rotate the dongle to find the best range, and glue it in place.
The improvements with this simple technique can sometimes be dramatic, even with cheap keyboard/mouse combos (within reason).
P.S.: In some cases, also the keyboard can be a little directional. It is sometimes the case that the keyboard has somewhat better range in a direction pointing down. If the PC is sitting under your desk, that's perfect. But if it's sitting across the room, in front of you, next to the TV screen, it's sometimes beneficial to tilt the keyboard back a little, so its bottom is slightly angled forward. Anyway, this is less important than positioning the dongle - so do that first, that's where the biggest gains are.
In general (not always, but as a rule of thumb), the wireless peripherals assume the PC is sitting under your desk, so that's the direction where they try to optimize things.

EDIT: When all else fails, just get a more expensive keyboard. Those tend to have better range.
Answer: Bluetooth mouse range reduction fix:
On my new computer, USB ports are USB 3.0 (blue).  After many experiments, it was determined the cause was USB 3.0 5 Gbps driver interference.
The fix is really simple.  Either get a USB 2.0 cable extension or a USB 2.0 hub.  These do not contain the USB 3.0 driver.  Your wireless bluetooth mouse range will be restored!


Twitter says I have XXX number of tweets and I don't have any...

Question: I tried to delete all of my 300ish tweets and there are like 100ish left but Twitter says I don't have any tweets. How do I fix that?
Comment: Your title appears to say the opposite of the question body?
Answer: This is and issue with Twitter not the client. The only way to fix this is to:

( Did not say how long you have been waiting) Most likely wait it out ( it may be experience lots of traffic, therefore making it lag)
Send in a complaint letter to Twitter support.
Refresh the page (if you haven't already done so)

That's all you can really do, as I said before it's not a problem you can really control because there are so many Twitter users it can cause the servers to lag:(. Hope this helps:)


Can I save my highlights?

Question: I got a sick win a few minutes ago and can watch the highlights in the highlights section. Is there a way to save them somewhere?
Comment: I've been using the recording feature of the Windows 10 Game Bar to get around this for the time being. http://windows.microsoft.com/en-us/windows-10/keyboard-shortcuts-for-game-bar. At least until (if?) there is a built-in way to do this.
Comment: i guess you're playing it on pc - if you played on a ps4, by using the **share** button you can save the last 15 minutes of gameplay
Comment: @WayneEra I can use W10's DVR feature (or any screen recorder like obs) too, however Im asking if there is an official, ingame way to do it.
Comment: @ardaozkal yeah i know, but your question has already been answered...
Answer: Update: As of update 1-13 in PTR, you can now export highlights.

With the above, players can now record any of their "Top 5" or "Recently Captured" highlights, exporting them as a video file to their gaming platform's designated media library (on console) or directory (on PC). On PC, players will also have the option to select the quality at which these highlights are exported, supporting up to 4K at 60 FPS for Windows 8 or higher operating systems, and up to 1080p on Windows 7.

This is done by going to the highlights section and clicking the record option.
Comment: @Fluttershy yes... like the surface of the sun is a bit hot.
Comment: Great quick answer
Comment: That's a shame. This feels like a bit of an oversight.
Answer: With the recent overhaul of the Highlights system it is now possible to export highlights as video files. It is also possible to record your own highlights, in addition to the automatic ones. Highlights no longer expire as soon as the client is closed, although they do still eventually expire — they must be exported to be saved permanently.

To export a highlight to save it permanently, go to the Highlights section from the main menu and press the "record" button on the highlight you want to export. (Click elsewhere to review the highlight.) This will present a dialog that can be expanded for settings to control the quality of the export — it will be re-rendered in non-real-time, so you can select the highest settings even if your computer would never really be able to play with them.

The exported videos will be added to your Documents folder, under Overwatch/Videos/Overwatch/.
Answer: I had the same issue, but sadly in the beta it's still not available as a feature. Though I'd love to save how I ressed 3 teammates at once with Mercy, or how I smashed a certain pain in the ass opponent in the wall with Reinhardt. Or just simply a few multikills with Bastion.
As for screen recording, if you use win 10, it already has a screen recording function for games, should work with Overwatch too. On basic settings, the recording can be started/stopped with the windows key + alt + R shortcuts. (Or at least I hope these are the basic controls for it, my PC offered me these as basic)
Comment: I do that ATM but I'd prefer an ingame feature to accept as answer. Still upboted
Answer: What I did was I opened OBS and just recorded the Overwatch window while playing the Highlight!
Hope this helps!

Can I save my highlights?


Wordpress self hosted site asking to login again when used www

Question: I am logged in to my wordpress self hosted site at https://example.net it works fine but when I open https://www.example.net, it asks me to login again how do i fix?
Answer: Each subdomain requires separate authentication. Although you can leave your server set to allow both the "www.example.net" subdomain and the "root" domain "example.net", you'll run into issues both with authentication and with SEO, because Google also sees "www.example.net" as a different URL than "example.net".
It's best practice to decide which version you prefer, then set up your .htaccess file to redirect all requests of one to the other. That way you only have to log in once, and search engines as well as visitors will all get the same version of your URLs.
If you prefer www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

If you prefer no subdomain:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Place whichever one you prefer above the default WordPress block in your site root's .htaccess file.


Exactly how do the contents of a furnace affect a comparator?

Question: Can someone tell me how the contents of a furnace affect a comparator?  I want to create some automation in vanilla Minecraft, but don't know how the mechanics work.
Answer: This page has a paragraph specific to the power output through a comparator on a furnace.
It's pretty confusing, though.
Basically, for the full 15 signal you need something in all 3 slots of the furnace. If you're feeding in smeltables and fuel (assuming they are in the right places, and full), then anything above 10 would mean that there is something that has completed smelting.
That is probably over-simplified, but I hope that helps.
To further attempt to answer your question; The contents are summed and the resulting value of all contents are output through the comparator.
Comment: I put a comparitor on a hopper that feeds coal into the furnace. You don't get the amount of coal in the furnace, but you can tell when the feed hopper is empty.
Comment: Perhaps someday, but currently no. I expect Mojang isn't interested in easing the automation. They're providing very basic tools that do very basic things, then allowing human creativity to work out solutions for complex problems. It's part of the fun, but I agree - it's a frustrating kind of fun. Not fun for everyone.
Comment: and there is no way to just for it to just judge the amount of coal for instance by putting the comparitor on a specific side
Comment: That is a very good solution. That could cause an issue if you use more than one fuel type, because there's no way to tell in that case if you have a stack or less already in the furnace. With only one fuel type, that should work perfectly.


Why is direct money transfer to other people accounts so expensive?

Question: I see from a similar question that in the US and Canada wire transfer are even more expensive than in Europe where I live. But I am interested in the situation in Europe even though their cost is strange even outside Europe, after all they use the same infrastructure used by all the other payment systems.
Answer: In order to send a wire transfer, the money backing it must be available at the sending bank's account at their respective national central banks. That would be a branch of the US Federal Reserve for US Dollars, and a national bank member of the European Central Bank for Euros.
In essence, a wire transfer is an immediate adjustment on the books of the central bank. SWIFT is a "messaging system" over which banks communicate what adjustments to make but does not actually move money.
Banks must have a positive balance by the end of the day, or else they must borrow cash at relatively high interest rates. In contrast, credit cards, ACH/SEPA payments, debit networks, etc. have a minimum 24 hour clearing cycle, thus the bank has at least a day to come up with the money, e.g. by selling investments or holding on to more cash from a previous day.
The US Federal Reserve is paying 0.10% interest, which is tiny versus other investments. Worse, the European Central Bank's deposit interest rate is currently -0.50%. They charge banks 1/2 percent to keep that money around.
In the US, there is a significant opportunity cost to having that cash immediately available, in the Eurozone, there is an actual cash cost. In both cases, the costs are charged back to the customers who use telegraphic transfers as expensive fees.
Comment: If you make an international transfer between two countries in the EU it is not immediate, but it is even more expensive than a transfer within the country.
Comment: @FluidCode You have the same problem as one of the other commenters in the previous post that you are getting multiple European payment systems confused, in part because banks don't use technical terms and automatically select what is most beneficial for them. Wires are always instant. If it's not instant, it's something like SEPA, a card-network based system (Visa Debit/Electron), or a third-party/national system.
Comment: SEPA rules for immediate transfers between countries became effective recently, but they had no impact on the fees.
Comment: @FluidCode If by "recently" you mean a decade ago, since there was a deadline to be on SEPA by December 2010.
Comment: I well remember that my bank notified recently that by SEPA requirement the international transfer became immediate, but I won't try to prove it because it's pointless to keep discussing this point when the whole answer seems a lame excuse. Such are the accounting/borrowing costs that when you involve third parties like Visa or PayPal adding their fees the transfer is still cheaper? Does not add up.


Very simple Latitude/Longitude to WGS84 conversion

Question: As from here, I'm using the OpenTopography API to download a geoTiff heightmap, and it uses 4 WGS84 Coordinates, but the map I've supplied to the user gives back longitude/latitude coordinates. I'm very new to GIS, so I was wondering if there was some kind of equation for converting them.
Comment: Commonly, a bounding box is specified as the SW corner and the NE corner- that is, 2 coordinates. However, as @Spacedman explains, this site uses the 4 "lines" that define the box- the southern and northern extents (latitude) and the western and eastern extents (Longitude). You can extract 4 unique coordinates where these intersect, but you only need 2 to define the box- S and W, and N and E. They are all latitude-longitude and require no equation to convert.
Comment: @LeighBettenay Thanks! I've recently just figured this out, and I'm sure it would be a massive help to anyone else.
Answer: "WGS84" coordinates are (usually) latitude and longitude.
There are lots of different definitions of latitude and longitude, based on different earth shapes or different reference points for 0 longitude. What's called "WGS84" is usually a specific standard for lat-long, more formally called "EPSG Coordinate Reference System Code 4326".
These are the coordinates used by GPS location systems, and should be the default lat-long system for any new data. Sometimes you find older data based on a different earth-shape model or a non-standard 0 longitude meridian. But what I see on that web page API is (99.999%) probably all "WGS 84 lat-long".


Cross-Validation gives different result on the same data

Question: I have done Cross-Validation by crossval function in matlab on my data, but when I run the Cross-Validation many times, it give me a different results, so is that normal? Or, is something  wrong going on?  I think that the  initialization of certain parameters differ from  time to time, also the data, which is divided by cross-validation is different. If so, which result of cross-validation must be taken, the best, worst, or the mean results?
Comment: I'm not familiar with that particular function but most CV procedures randomly shuffle the data before splitting it up into folds. So you should expect to get slightly different answers each time. There may be a function argument which stops the random shuffling. Also you can repeat the CV multiple times and take the mean results, this is what the `R` package `caret` typically does.
Comment: @Jeff, there are a differnce in the results up to 15%, is this normal ?
Comment: I think it would depend on the structure/size of the data. If the data was quite small then yes, I think there could be quite different results between runs.
Comment: To @jeff 's point, the issue with getting "different answers" with CV is finite data samples. It is only in theory that information approaches an asymptotic limit. However, with some software you are able to run and rerun the CV on the same folds which would control for the "different answers each time."
Comment: Cross validation can gives different answer when run many times. See documentation [here](http://www.mathworks.com/discovery/cross-validation.html) and [corss validation](http://www.mathworks.com/help/bioinfo/ref/crossvalind.html)
Answer: Cross validation (usually) works by repeatedly selecting a subset of the data to leave out, fitting a model using the data that was not left out and then evaluating the estimated model using the left out data.
If the subset of the data that is left out is selected at random, then the results may differ from run to run. You can try setting a seed if you want to get the same results every time you run cross validation.
As for the question of which result should be taken, you probably want the mean.


Fan is constantly on when power supply plugged, but goes silent when only on battery

Question: Problem
Fan is constantly on when a laptop is plugged and not charging. Not noisy, but definitely audible.
However, it occasionally stays silent (spinning slower or not spinning at all) when laptop is not plugged or still charging.
Question
How to achieve the same when the machine stays plugged and isn't charging ?
Perhaps the solution is as simple as this: https://askubuntu.com/a/300921/69296

Machine:

HP Elitebook 8470p
Ubuntu 13.10 LTS (clean install, actually Lubuntu flavour, but it doesn't make a difference)
intel i5-3360M
uname -a: Linux elite 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
8GB RAM
sata3 SSD
AMD Radeon HD 7570M
power_method: profile, power_profile: auto
Answer: I have a HP 4510s laptop. The fan control works ok under Windows. Does not work under any tried Linux distro/version. Under Linux/Ubuntu, the fan runs at some very low speed. This is not sufficient to keep CPUs cool enough under higher load.
I tried most of the hints from the internet regarding the Linux laptop fancontrol, none worked. To list, I tried lm_sensors, pwmconfig, acpi_os= setting and numerous other things to no avail. And I've updated BIOS and there's nothing except "Fan always on on AC" and it does not do the trick.
It is possible to get the system temps using lm_sensors. Furthermore, there are fan control points at
/sys/devices/virtual/thermal/cooling_device*/cur_state (* from 0-4 are active)
I ended up taking the famous tp-fancontrol (for IBM ThinkPads) script from
http://thinkwiki.org/wiki/ACPI_fan_control_script
and botched it up as hp-fancontrol. I don't remember enough from my automation studies (it was 20 years ago) so it turned out very simple. But it seems to work so far. There are lots of left-over code still and it's ugly as ****. I installed it as /usr/bin/hp_fancontrol and added trigger to /etc/rc.local like this
# Start hp-fancontrol on multiuser
/usr/bin/hp-fancontrol -l -d

exit 0

I'd be very grateful for anything better, even if it is just the control_loop part, so please comment. Also, be gentle and read the disclaimers (ugly as... above and code itself). The QUIET seems not to work, it breaks DAEMONIZE.
#!/bin/bash

# hp-fancontrol 0.1
# Based on tp-fancontrol (http://thinkwiki.org/wiki/ACPI_fan_control_script)
# Provided under the GNU General Public License version 2 or later or
# the GNU Free Documentation License version 1.2 or later, at your option.
# See http://www.gnu.org/copyleft/gpl.html for the Warranty Disclaimer.

# This script dynamically(?) controls fan speed on some HP laptop models
# (ProBook 4510s) according to user-defined temperature thresholds.  It
# implements its own decision algorithm, overriding the any embedded
# controller.
#
# Run 'hp-fancontrol --help' for options.
#
# For optimal fan behavior during suspend and resume, invoke
# "hp-fancontrol -u" during the suspend process.
#
# WARNING: This script relies on undocumented hardware features and
# overrides nominal hardware behavior. It may thus cause arbitrary
# damage to your laptop or data. Watch your temperatures!
#
# WARNING: The list of temperature ranges used below is much more liberal
# than the rules used by the embedded controller firmware, and is
# derived mostly from anecdotal evidence, hunches and wishful thinking.
# It is also model-specific (see http://thinkwiki.org/wiki/Thermal_sensors).

# Temperature ranges, per core:
# (min temperature: when to step up from 0-th fan level,
#  max temperature: when to step up to maximum fan level)
THRESHOLDS=( #  Core
# min  max   #  ----
  43   65    #  0
  43   65    #  1
)

# LEVELS=0 - 31 (5 bits)             # Fan speed levels
ANTIPULSE=1                          # Prevent fan pulsing noise
                                     # (reduces frequency of fan RPM updates)

OFF_THRESH_DELTA=3 # when gets this much cooler than 'min' above, may turn off fan
MIN_THRESH_SHIFT=0 # increase min thresholds by this much
MAX_THRESH_SHIFT=0 # increase max thresholds by this much
MIN_WAIT=180       # minimum time (seconds) to spend in a given level before
                   # stepping down

HP_ACPI=/sys/devices/virtual/thermal/cooling_device

PID_FILE=/var/run/hp-fancontrol.pid
LOGGER=/usr/bin/logger
INTERVAL=3        # sample+refresh interval
SETTLE_TIME=6     # wait this many seconds long before applying anti-pulsing
RESETTLE_TIME=600 # briefly disable anti-pulsing at every N seconds
SUSPEND_TIME=5    # seconds to sleep when receiving SIGUSR1

SEP=','           # Separator char for display

WATCHDOG_DELAY=$(( 3 * INTERVAL ))
HAVE_WATCHDOG=false
HAVE_LEVELCMD=true

QUIET=false
DRY_RUN=false
DAEMONIZE=false
AM_DAEMON=false
KILL_DAEMON=false
SUSPEND_DAEMON=false
SYSLOG=false

usage() {
    echo "
Usage: $0 [OPTION]...

Available options:
   -s N   Shift up the min temperature thresholds by N degrees
          (positive for quieter, negative for cooler).
          Max temperature thresholds are not affected.
   -S N   Shift up the max temperature thresholds by N degrees
          (positive for quieter, negative for cooler). DANGEROUS.
   -t     Test mode
   -q     Quiet mode
   -d     Daemon mode, go into background (implies -q)
   -l     Log to syslog
   -k     Kill already-running daemon
   -u     Tell already-running daemon that the system is being suspended
   -p     Pid file location for daemon mode, default: $PID_FILE
"
    exit 1;
}

while getopts 's:S:qtdlp:kuh' OPT; do
    case "$OPT" in
        s) # shift thresholds
            MIN_THRESH_SHIFT="$OPTARG"
            ;;
        S) # shift thresholds
            MAX_THRESH_SHIFT="$OPTARG"
            ;;
        t) # test mode
            DRY_RUN=true
            ;;
        q) # quiet mode
            QUIET=true
            ;;
        d) # go into background and daemonize
            DAEMONIZE=true
            ;;
        l) # log to syslog
            SYSLOG=true
            ;;
        p) # different pidfile
            PID_FILE="$OPTARG"
            ;;
        k) # kill daemon
            KILL_DAEMON=true
            ;;
        u) # suspend daemon
            SUSPEND_DAEMON=true
            ;;
        h) # short help
            usage
            ;;
        \?) # error
            usage
            ;;
    esac
done
[ $OPTIND -gt $# ] || usage  # no non-option args

# no logger found, no syslog capabilities
$SYSLOG && [ ! -x $LOGGER ] && SYSLOG=false || :

if $DRY_RUN; then
    echo "$0: Dry run, will not change fan state."
    QUIET=false
    DAEMONIZE=false
fi

thermometer() { # output list of temperatures
    # 2 basic temperatures from CPU cores:
    CPU0=`/usr/bin/sensors | /usr/bin/awk '/Core 0/ { print $3 }' | sed -e s/[^0-9]//g`
    CPU1=`/usr/bin/sensors | /usr/bin/awk '/Core 1/ { print $3 }' | sed -e s/[^0-9]//g`
    echo -n "$CPU0 $CPU1 ";
    return 0
}

speedometer() { # output fan speed RPM
    read F0 < /sys/devices/virtual/thermal/cooling_device0/cur_state
    read F1 < /sys/devices/virtual/thermal/cooling_device1/cur_state
    read F2 < /sys/devices/virtual/thermal/cooling_device2/cur_state
    read F3 < /sys/devices/virtual/thermal/cooling_device3/cur_state
    read F4 < /sys/devices/virtual/thermal/cooling_device4/cur_state
    FAN=$(($F4+$F3*2+$F2*4+$F1*8+$F0*16))
    echo -n $FAN;
    return 0
}

setlevel() { # set fan speed level
    local LEVEL=$1
    if ! $DRY_RUN; then
        if $HAVE_LEVELCMD; then
        BLEVEL=$(echo "obase=2;$LEVEL" | bc)
        LEN=$(echo ${#BLEVEL})
        BLEVEL5=`echo "0000"$BLEVEL`
        B5=${BLEVEL5:(-5)}
        echo ${B5:0:1} > /sys/devices/virtual/thermal/cooling_device0/cur_state
        echo ${B5:1:1} > /sys/devices/virtual/thermal/cooling_device1/cur_state
        echo ${B5:2:1} > /sys/devices/virtual/thermal/cooling_device2/cur_state
        echo ${B5:3:1} > /sys/devices/virtual/thermal/cooling_device3/cur_state
        echo ${B5:4:1} > /sys/devices/virtual/thermal/cooling_device4/cur_state
    else
        case "$LEVEL" in
        (auto)        LEVEL=0x80 ;;
        (disengaged)  LEVEL=0x40 ;;
        esac
            #echo 0x2F $LEVEL > $IBM_ACPI/ecdump
    fi
    fi
}

getlevel() { # get fan speed level
    # perl -e 'm/^EC 0x20: .* .(..)$/ and print $1 and exit 0 while <>; exit 1' < $IBM_ACPI/ecdump
    read F0 < /sys/devices/virtual/thermal/cooling_device0/cur_state
    read F1 < /sys/devices/virtual/thermal/cooling_device1/cur_state
    read F2 < /sys/devices/virtual/thermal/cooling_device2/cur_state
    read F3 < /sys/devices/virtual/thermal/cooling_device3/cur_state
    read F4 < /sys/devices/virtual/thermal/cooling_device4/cur_state
    FAN=$(($F4+$F3*2+$F2*4+$F1*8+$F0*16))
    echo -n $FAN;
}

log() {
    # $QUIET || echo "> $*"
    ! $SYSLOG || $LOGGER -t "`basename $0`[$$]" "$*"
}

cleanup() { # clean up after work
    $AM_DAEMON && rm -f "$PID_FILE" 2> /dev/null
    log "Shutting down, fan turned up"
    if ! $DRY_RUN; then
        if $HAVE_LEVELCMD; then
            setlevel 31
        fi
    fi
}

floor_div() {
    echo $(( (($1)+1000*($2))/($2) - 1000 ))
}

set_priority() {
    ! $DRY_RUN && renice -10 -p $$
}

init_state() {
    IDX=0
    NEW_IDX=0
    START_TIME=0
    MAX_IDX=31
    SETTLE_LEFT=0
    RESETTLE_LEFT=0
    FIRST=true
    RESTART=false
}

control_fan() {
    # Enable the fan in default mode if anything goes wrong:
    set -e -E -u
    trap "cleanup; exit 2" HUP INT ABRT QUIT SEGV TERM
    trap "cleanup" EXIT
    trap "log 'Got SIGUSR1'; setlevel 0; RESTART=true; sleep $SUSPEND_TIME" USR1

    init_state
    log "Starting dynamic fan control"

    # Control loop:
    while true; do
        # Get readouts
        TEMPS=`thermometer`
        $QUIET || SPEED=`speedometer`
        $QUIET || ECLEVEL=`getlevel`
        NOW=`date +%s`
        if echo "$TEMPS" | grep -q "[^ 0-9$SEP\n-]"; then
            echo "Invalid character in temperatures: $TEMPS" >&2; exit 1;
        fi

    OLDLEVEL=$ECLEVEL
    NEWLEVEL=$OLDLEVEL
    CHANGE=0

    for TEMP in $TEMPS; do
        if [ $TEMP -gt 430 ] ; then
        if [ $OLDLEVEL -lt 31 ] ; then
            CHANGE=$(($CHANGE+1)) ;
            # NEWLEVEL=$(($OLDLEVEL+1)) ;
        fi
        elif [ $TEMP -gt 410 ] ; then
                # No change between 41-43C
        CHANGE=$(($CHANGE)) ;
        else
        if [ $OLDLEVEL -gt 0 ] ; then
            CHANGE=$(($CHANGE-1)) ;
            # NEWLEVEL=$(($OLDLEVEL-1)) ;
        fi
        fi
        NEWLEVEL=$(($OLDLEVEL+$CHANGE)) ;
        if [ $NEWLEVEL -gt 31 ] ; then
        NEWLEVEL=31 ;
        fi
        if [ $NEWLEVEL -lt 0 ] ; then
                NEWLEVEL=0 ;
            fi
            OLDLEVEL=$NEWLEVEL ;
        done

        # Interrupted by a signal?
        if $RESTART; then
            init_state
            log "Resetting state"
            continue
        fi

        # Transition
        if [ "$ECLEVEL" != "$NEWLEVEL" ]; then
            START_TIME=$NOW
            log "Changing fan level: $ECLEVEL->$NEWLEVEL  (temps: $TEMPS)"
        fi

        setlevel $NEWLEVEL

        sleep $INTERVAL

        IDX=$NEW_IDX
        FIRST=false
    done
}

if $KILL_DAEMON || $SUSPEND_DAEMON; then
    if [ -f "$PID_FILE" ]; then
    set -e
    DPID="`cat \"$PID_FILE\"`"
    if $KILL_DAEMON; then
            kill "$DPID"
        rm "$PID_FILE"
        $QUIET || echo "Killed process $DPID"
    else # SUSPEND_DAEMON
        kill -USR1 "$DPID"
        $QUIET || echo "Sent SIGUSR1 to $DPID"
    fi
    else
        $QUIET || echo "Daemon not running."
        exit 1
    fi
elif $DAEMONIZE ; then
    if [ -e "$PID_FILE" ]; then
        echo "$0: File $PID_FILE already exists, refusing to run."
        exit 1
    else
        set_priority
        AM_DAEMON=true QUIET=false control_fan 0<&- 1>&- 2>&- &
    echo "$0: Starting as daemon"
        echo $! > "$PID_FILE"
        exit 0
    fi
else
    [ -e "$PID_FILE" ] && echo "WARNING: daemon already running"
    set_priority
    control_fan
fi

Comment: Ok, been running the above for a while now. Noticed that a bash script takes a lot of resources and turned it into c++ daemon. Contact me if you need it for your PC.
Answer: Fan speed settings explicitly not under the control of OS or I might be wrong.
But there are few utilities which I know for Windows. However some BIOSs give you options to control the fan behaviour. You should check for those options in BIOS first.
Using utilities which would change the behaviour of some crucial hardware is not recommended.
Comment: The only BIOS setting I have is "Fan always on when on AC power". Of course I have it unchecked
Comment: @vucalur Many of my friends have HP systems and they all point about the same issue. However their systems have AMD on board.


How make Licence Key for Mac Address to protect my php application

Question: I am  developing hotspot system using php language ,
and now I want to sell this system but how can I protect my system from be re selling by the buyer and I want to make sure that the license key is used by the right machine with right mac address ,that mean the license key can not be used more than one time.
how can I do that  , I don't have any idea
Answer: MAC address isn't a reliable data source for license binding. In most cases user can change MAC address of the network card, and bypass your security this way.
You can use more complex algorithm to bind license to the PC. Get motherboard type, CPU type, RAM type, and MAC type. Compute some kind of hash of all this data, and generate license based on it.
Unfortunatelly, then your legitimate user would change the hardware, he/her would have to inform you and ask for a new license code.
I assume, that your system is Linux, so you can get all the info about system, by calling shell commands from php.
Get CPU information:
<code>$cpu = array_filter(
    array_unique(
        split("\n",
            shell_exec('cat /proc/cpuinfo | grep "model name\|vendor_id"')
        )
    )
);
print_r($cpu);
</code>
It will output something like:
<code>Array
(
    [0] => vendor_id    : GenuineIntel
    [1] => model name   : Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz
)
</code>
To get info about motherboard, you can run shell command "sudo dmidecode -t 2" (you'll have to give your php user (www-data) access right to run sudo dmidecode)
To get memory info, command should be "sudo dmidecode -t 17"
Comment: thank you for your reply but do you have any example or any resources that can help me on this point
Comment: Added example and some commands. Actually it's quite easy


Java get point location from angle change

Question: This may be an issue that I simply do no know the proper terminology to research the answer to this, I am pretty sure the solution is a function of trig.
I have a method which accepts an X/Y position coordinate and an angle in degrees.  It should return an updated X/Y based on the rotation angle provided.
For example, A point is usually located at x=0,y=2 (top middle).  Now I need to rotate it to it's side by 90 degrees.  In my mind I know it's location is now x=2,y=0 (middle right) but I do not know the equation to produce this.
I think I need to first determine the quadrant of the starting point, and then perform the proper trig function from there.  This is for a game I am developing using libgdx which is where the Vector2 object comes from.
I have come this far:
public Vector2 getPointsRotated(Vector2 startPoint, float angle){
    Vector2 newPoint = new Vector2(0,0);

    // determine the starting quadrant
    int quad=0;
    if((startPoint.x>=0)&&(startPoint.y>=0)){quad=0;}
    if((startPoint.x<0)&&(startPoint.y>=0)){quad=1;}
    if((startPoint.x<0)&&(startPoint.y<0)){quad=2;}
    if((startPoint.x>=0)&&(startPoint.y<0)){quad=3;}

    if(quad==0){
        // doesn't work
        newPoint.x = (float) ((newPoint.x)* (Math.sin(angle)));
        newPoint.y = (float) ((newPoint.y)* (Math.cos(angle)));
    }
    // ...
    // other quadrants also don't work
    // ...
    return newPoint;
}

Thanks for any help.
Update:
I have been avoiding and returning to this problem for a few days.  Now after finally posting the question here I figure it out within minutes (for ppl using libgdx anyway).
Libgdx provides a rotate function for Vector2s
so something like:
Vector2 position = new Vector2(0,2);
position.rotate(angle);

works perfectly.
Answer: I find rotation matrices are very helpful for this sort of problem.
https://gamedev.stackexchange.com/questions/54299/tetris-rotations-using-linear-algebra-rotation-matrices


Why am I not losing weight?

Question: I'm stumped. I'm 32 yrs old and my weight has gone up and down over the last 10 years but I've never had trouble getting it off when I workout and count calories. I'm currently 5'5 160 lbs. My normal/ideal weight is 135.  I've been working out 5-7 days a week, strength and cardio (when it's 7 days I generally just walk a mile or two with my dog) eating 1100-1300 calories of healthy, non processed, whole foods, no sweets or junk, I'm mindful of macronutrients, drink 32-64 oz of water every day (water is the only thing I drink except for 1 or 2 cups of black coffee in the morning) I don't drink alcohol or smoke and I get at least 8 hrs of sleep a night. It's been a month of dieting and working out now and I haven't lost even a single ounce, and my clothes fit me exactly the same.  What could I possibly be doing wrong here? I've scoured articles online and it's always "too much" of something (exercise, water, calories) or "not enough". I'm frustrated and disheartened! Please help!!
Comment: I'm going to disagree with @AlexL and the rest of answers here and say that your issue is probably that you're miscalculating the calories that you're eating. I don't care how much your metabolism slows down by having such a huge caloric deficit (which is not healthy, as pointed out): if you truly were on 1200 calories while working out every day of the week for 30 days you would have lost a shit-ton of weight. Hell, you'd have lost it while in a coma.
Comment: I think you're the one getting confused. It doesn't matter how much her metabolism gets slowed down because of the huge caloric deficit, it will not be any slower than while in a coma (which is what her BMR would be), and based on my decent guess of her BMR I'm saying that she'd be losing weight even in that situation.
Comment: You're probably not eating enough. Combined with working out as much as you are (so your burning even more than you eat), your body is likely down regulating your metabolism, making it harder to lose weight. Calculate your TDEE and then eat at 10% - 20% below that to lose your weight.
Comment: @Antrim: not necessarily true. When I first started trying to lose weight a few years ago I frequently ate less than 1200 calories along with cycling 30+ miles every day or so. My weight only decreased for about 6 weeks doing that, before it stalled.
Comment: @AlexL I don't know what was your weight or stats, and that may have been possible if you were really small. Otherwise, it's likely you miscounted your calories. Cristey's BMR is around 1400-1500 kcal/day, and that's without accounting for the 5-7 days a week of exercise. If she had been eating 1200 kcal/day for a month, she **definitely** would have lost weight.
Comment: @Antrim: Don't confuse BMR with TDEE. Her body requires closer to 2000 (approximately) calories each day to support her activity level. That leaves her with a very large deficit which will cause a down-regulation of her metabolism. However there isn't enough information to definitively say why she hasn't lost weight in the month (because I agree that something should have been lost) due to so many variables that could affect a lack of weight loss.
Comment: What antrim says: the metabolic adaptation does NOT entirely offset the calorie shortage, it's still a shortage!
Answer: Like @AlexL, I'm worried that you're not eating enough, and that your body is adapting by shorting some processes, rather than burning fat.
What you have to understand, is that in order to be healthy, you have to have a healthy diet. Too many people try to lose weight by trying diets that exclude this and that. The problem there is that they're excluding important nutrients, vitamins and minerals, simply because the food also has, say, sugar.
You seem to be in the habit of counting calories, and that's very good! But try to make sure of these things;

Your diet includes sugars. Good sources are fruits. Bad sources, I think you know.
Your diet includes fats. Good sources are fish, nuts, seeds, and for dinner, use olive oil when you fry meats.
Your diet includes proteins. Good sources are meats and fish. Again, dinner should cover this.

If you cover all this, and keep track of your calories, you'll be able to tweak it. For instance, if you try consuming 1500 calories/day for a month(*), and your weight stays the same, lower it to 1400, and try that for a month.
(*) When I say a month, that's because noticable changes take a while. Any fluctuations in weight from week to week should not be used as a statistic, because it's subject to far too many factors.
And as always, any venture to change your body is NOT going to yield results in just a few months. I always say, give it a year. It sounds like a lot, but if you can't stay disciplined for a year, whatever you accomplish in one month, is going to be lost the next. For the changes to be permanent, you need to keep your discipline. This goes for all of us, whether we're losing or gaining weight.
I sincerely wish you all the best, but you're the one who has to go fetch.
Pep talk over.
Answer: The answer to your question might be- you're lacking some calories. You should eat at least 1800 a day if you're on a diet. Normal intake for grown men is around 2000 calories a day. If your body is spending more energy than it has, it's possible that, after some time, your body will react. That means that your body will be too "afraid" that it won't get enough energy, so it will store all the calories it can. The result is, you're not losing any weight (or you just don't see the changes). So, the main recommendation for you is - eat more!
Answer: eating that amount of calories and training 5-7 days a week could force the body to go into starvation mode and stockpile whatever weight it can in order to counteract the effects of malnutrition.
alternatively, if you've been doing the same stuff forever you could be in plateau mode - where you're so accustomed to your current program that you're going to realize diminished returns until you move on to something new.
what's your macro ratio look liek? you could try a high-fat/low-carb macro ratio. supposedly good for weight loss, but i wouldn't recommend it without adding a couple hundred gross calories, first. unless you want to be really tired and irritable all the time.
Answer: Thanks everyone, for your input and advice!! I want to first mention that, I am a stickler for measuring everything. I use a food scale, measuring cups/spoons etc so that I know EXACTLY how much food I'm eating. Not only for the sake of calorie counting but also portion control and to keep track of my macros ingested as I intend to lose weight the healthy way and not just a "crash" diet. So the chance that I'm miscalculating and OVER eating was very slim. I have lost 20-30 lbs a couple of different occasions before in my life so I'm no stranger to how this works. However, in the past I was not AS active as I have been this time around. Therefore, 1100- 1200 this time was just not enough fuel. I took @AlexL 's advice and upped my calories to 1400-1500 a day. Since then, 4 days ago, I've lost 4.5 lbs. Every morning I wake up in down another pound. I don't expect to stay on that trend DAILY but at least the scale is moving now!! I also added a protein shake to my daily routine. So far so good and I'm feeling pretty optimistic!!! ☺

Why am I not losing weight?


Best practice for displaying multiple views in a single page

Question: I am working on a Drupal 7 website where there are many pages which utilize multiple views.
The way I am doing this right now is by creating a page from Drupal admin panel, and in the edit mode of that page I am calling views_embed_view to display those multiple views.

Other ways I could do this is by creating a template for that page, and putting my code inside the template.
Yet another way is to use View Fields View (https://drupal.org/project/views_field_view) and embed the second view inside the first one.
I want to know, performance wise which is the best practice?
Answer:
Create view for main page, then attach all other views to it.
Use panels and add all required views.

For Performance you need to optimized your views and monitor using Devel tool.
Cheers!!!


Difference between "valued" and "valuable"

Question: Please explain the difference between "valued" and "valuable" when talking about goods. Which of them should be used to indicate intangible value and which to indicate price? For example, if a product is very useful and inexpensive, is it "valued" or "valuable"?
Comment: Well, technically "valuable" means capable of having a value assigned, while "valued" means having had a value assigned.
Comment: @HotLicks: It may be capable of having a value assigned, but that is only because it **has value**. Something that has value is valuable. Assignment of a specific value (e.g. a grade or a quantity of money) is a way to indicate that something has value (is valuable), and it can serve as proof that it is valuable, but it is not what makes the item valuable. Assigning value is especially a way to measure *how* valuable it is considered to be.
Answer: Typical uses of valued are:

The item was valued at $5000

… which means that it was judged to be worth $5000.

He was a valued member of the team

… which means that he was a useful member whose value to the team is appreciated by others.
Typical uses of valuable are:

It was a valuable item, being valued at $5000.

… "valuable" here meaning worth a lot of money.

He was a valuable member of the team.

… meaning pretty much the same as before, except that there's no implication that others appreciate his value.
Answer: Valuable means something is likely to be valued by a lot of people.
Valued means it's definitely already valued by some people.
If a product is inexpensive, it may be valued by those who own it, but it can hardly be valuable.
Answer: I disagree with the accepted answer, by @Ricky.
I would say that a thing that is valuable has value. It is not that it is "likely" to have value or that "many people" have valued it. It is enough that it has value for one person for it to be valuable to that person.
See the examples given in the answer by @ralph.m.

Adjective: valuable  val-yoo-u-bul

Having great material or monetary value especially for use or exchange
"a valuable diamond"
Having worth, merit or value
"a valuable friend";

worthful

-- WordWeb

Adjective: valued  val-yood

(usually used in combination) having value of a specified kind
"triple-valued"
Held in great esteem for admirable qualities especially of an intrinsic nature
"a valued friend";

precious

-- WordWeb
Answer: -"This object looks valuable, I wonder how much it is worth."
-"I'll tell you, it is valued at £20."
Comment: Please explain your answer in full. How does this demonstrate the difference between the two words?


Struggling with finding matrices such as AC = AD when C is not equal D and A has no elements equal to zero.

Question: I tried to find matrices that will satisfy the condition of AC = AD when C is not equal D and A has no elements equal to zero, however I could find any right option since when it comes to system of equations it becomes tough since non of the A entries are 0 and I can't find the right elements of C and D. Please help or describe a functioning algorithm of finding those matrices
Comment: Hint: try choosing an $A$ that maps every vector to a multiple of $(1,1)^T$.
Comment: Find matrices $R,S$ such that $R$ has no zeros but $RS=0$. Then find matrices $X,Y$ such that $X-Y=S$. $2\times2$ will do. Thinking about the rank of $R$ will help.
Comment: What's most important is to start with a matrix $A$ whose determinant is equal to zero. Then your quest should have a happy ending.
Comment: Thanks @ Gerry Myerson , your method works well. Could you explain in liitle more a detail ho did you come to this formulas such as RS = 0 and X-Y = S? Based on what? Is it kind of similar to explanation of Ahmed S. Attaalla?
Answer: Since $A(C-D)=0$, you just need to find an $A$ with nontrivial null space (maybe that'll be more clear if you think about $C-D$ as a matrix with vectors $v_1,v_2,..,v_n$ as columns).
As an example how one might do that. Consider the $2$ by $2$ matrix,
$$A=\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}$$
Obviously the first row minus the second row gives $\mathbf{0}$, so $\begin{pmatrix} 1 \\ -1 \end{pmatrix}$ is in the null space. So let $C$ and $D$ be any two matrices such that:
$$C-D=\begin{pmatrix} 1 \\ -1 \end{pmatrix}$$
Or,
$$C-D=\begin{pmatrix} 1 & 1 \\ -1 & -1 \end{pmatrix}$$
Or,
$$C-D=\begin{pmatrix} 1 & 1 & 1 \\ -1 & -1 &-1 \end{pmatrix}$$
Etc...
Comment: Hello, Ahmed, thanks for you answer, I tried to find C and D matrices based on that and it worked well. I am not sure though if I get right the thing about nontrivial null space , so is it considered to be nontrivial if the difference between row and column is equal to 0 for matrix A? Is that a general rule? And then we just find a vector oh matrice, where row is not equal to coulmn? Let's say, could have we taken C - D = ( 1 -2) instead?
Comment: Hi, Dan. If you consider the system $Ax=0$, where $x$ is a column vector, the different solutions together form what we call the "Null space of Matrix A". Notice that $x=0$ will always be a solution, and so it will always be in the null space. We call $x=0$ the "trivial" solution. If we can find an $x$ that is not zero, than we have found a "nontrivial" solution. So what we mean when we say $A$ has nontrivial null-space, is that $x=0$ isn't the only solution to $Ax=0$. @DanF. Let me know if you need further clarification. Thanks!
Comment: So yeah, I think I get it know, in our case we have C-D instead of x in the system Ax = 0? and we have to make sure that C-D is not zero, i.e. non-trivial?
Comment: That's right since we need that $C \neq D$ we need to make sure that $C-D \neq 0$, but yet solves $A(C-D)=0$. @DanF.
Comment: Got it. Thanks @Ahmed S. Attaalla


What's the 'Frequent' sort function?

Question: What is the function of the 'Frequent' sorting option on the Questions tab?
Comment: Roughly, the questions listed earlier are those that have more pages on-site linking to them. But I don't know more exactly than that, so am posting this as a comment rather than an answer.
Comment: @msh210, alright, I'll take my question over to meta.SO.
Comment: In theory you should get answers here also: SE is insistent that the sites' Meta sites are just as good. (And if you post a bug report or feature request here, and it's not something that's already been dealt with at MSO, then the mods here are supposed to call it to SE staff members' attention.) De facto, though, more people who will know an answer or have suggestions will see it on MSO. So in general it might be wiser to ask there. In this case, I'll be glad to advertise your question among some other SE people and see if it gets any answers -- unless you've asked on MSO already. Have you?
Comment: ...Ah, I see you have. Re-asked at http://meta.stackexchange.com/q/172726.
Comment: @msh210  I already asked over there (and got an answer).
Answer: Since you then asked the same question on Meta Stack Overflow, I'll quote Oded's answer from there so this doesn't stay unanswered:

When many questions are closed as a duplicate of one specific question, that question is a "Frequent" question - that is, it has been asked, in different guises, frequently. In addition, if the question is linked to from another question, it is one of the "Frequently" linked to questions.
In essence the sort is for questions that have been linked to often within the site.
If you hover over the tab, the tooltip is "questions with the most links" - that is, with many  questions linking to it.

What's the 'Frequent' sort function?


why can't i move certain apps from sd card to internal memory on android LG-L38c touchscreen phone?

Question: Why are some apps i download and install saving to sd card instead of internal memory? I have more space on internal than sd card and it won't let me move some apps to internal memory.
Answer: In the Manifest of the .apk file, developers can specify where they prefer there app to go. When that request can be met (technically), it will. The different possibilities include e.g.

no preference set: Goes to "internal storage"
preferExternal: Goes to SDCard (if available), else internal storage
set to "auto": if the app has widgets or declares services, it goes to internal storage. Otherwise it depends on device settings.

See also my answers here and here – the latter answer also details how you can (partially) override this.


How to finish my report?

Question: I need some advice since the advice I have so far received from my friend can be considered dangerous. I was finishing up my report and although I was late my supervisor accepted the report. The problem is that I made a few changes to the report which I didn't incorporate within my presentation and forgot to add a few things within the report. Now I want to make these amendments, however after talking with my supervisor she said I had submitted my report and I could not revise it. My friend suggested that I re-upload the report and presentation with the updated amendments. I am confused, I want to finish my report to the best of my abilities, however I don't want to break my supervisor's trust. What do I do?
Comment: This has nothing to do with the workplace. In any case, we can't tell you what you should do. You need to be an adult and make your own decisions, and be accountable for those decisions.
Comment: Supervisor referring to an academic supervisor? is this taking place at work or in college? If the latter then as Gregory said we don't handle those environments.
Comment: Echoing Lilienthal and Gregory if this is an *academic* setting such as school or college (which it sounds like) then we can't really address that here - but [Academia SE](https://academia.stackexchange.com/) would be a good place to look instead.
Comment: Supervisor said no. Do not upload. If you re-upload against her express recommendation, and you are found out, this will be an assessment offence. If the presentation happens afterwards and differs, you can highlight the deviations in the presentation (if such deviations are permitted). If they are not permitted, don't make them.
Answer: Your supervisor may have already marked the report you submitted, so reuploading may make no difference. It will probably be time-stamped, so it will be obvious if he does check, and he's told you not to, so don't.
If you give a presentation in the future, it's OK to talk about new information or corrections but you should make it clear that it is a change and why. If you just contradict your report you look like you don't know what you're talking about. If you say "I've since discovered X, which has changed my view about Y" you should pick up some extra marks.
Answer: You submitted late - this implies poor planning.
Your supervisor has been generous in allowing a late submission, although you don't mention if there are any penalties.
Why would you expect to be able to change a submission at all, whether late or not? Your supervisor has clearly told you that you cannot make changes.
When you present be careful of discrepancies - they are easily noticed and may cost you in points or trust or respect.

How to finish my report?


Design Patent US D697,706 - human hand umbrella handle

Question: I think there is likely prior art for Design Patent US D697,706, "Handle":

Here is an example of a 19th century Chinese human hand umbrella handle:

Source: AncientPoint.com
Comment: I don't think the example given is prior art, but it suggests that this idea is not exactly new and there may well be prior art out there.
Comment: The information in [this question regarding novelty in Design Patents](http://patents.stackexchange.com/q/13221/14622) might help in determining whether it is Prior Art. The handle in this photo depicts a closed hand, but the patent figure depicts an open hand, I'm not sure if that is relevant.
Answer: In this case, the design of the handle is from a cast of a model named Bridget. That is extremely specific.

From Giving a Hand to the Umbrella Business? (February 24, 2012)

Each Bridget has a handle created from a cast of a model named Bridget, "sanded by hand to a satin finish." The body of the umbrella is imported from Italy has a black canopy with a translucent amber tip. And each of the 400 Bridgets comes etched with the name "Bridget" and along with a serial number. Suggested retail: $349.

Now, consider the phrase:

an overall design that an ordinary observer would likely find substantially the same

United States Court of Appeals for the Federal Circuit, Case No. 11-CV-1846, May 14, 2012.
which is from the ruling on the Apple vs. Samsung Electronics design patent infringement case. Now, I'm not claiming that this is an official test for novelty of a design patent, but if this is how infringement is tested, then it makes sense that the phrase would also apply to novelty tests of new designs.
I have spent over an hour looking through every image on Google that matched combinations of "hand", "handle" and "umbrella", and I am convinced that there are no other umbrellas out there with a similar design. Aside from the actual product line that utilizes this design patent, the one cited in the question is the closest one I could find.
The company that filed this design patent creates high-end products, which makes them a target for counterfeiters, and so it is only natural that they would seek to protect their new product lines. This is a perfect case for a Design Patent. It is narrow in scope, and it will be used to do exactly what Design Patents are intended for: to prevent cheap knock-offs that the consumer cannot differentiate between.
I'm going to make a judgement call here, and state that the only people who should be concerned about this particular design patent are those who seek to create counterfeit goods based on that exact design. If they want to work around this design patent, they need to produce something that the consumer can differentiate between when making a purchase.


OS upgrade from Ubuntu Core 15.04 to Ubuntu Core 16.04 support

Question: Is OS upgrade from Ubuntu Core 15.04 to Ubuntu Core 16.04 supported? Will an 15.04 application snap work on 16.04 ubuntu core .
Answer: To upgrade your system from Ubuntu Core 15.04 to Ubuntu Core 16 you will need to contact the manufacturer of the device you are targeting. They will have a migration procedure available.
A 15.04 application snap will not work on Ubuntu Core 16. There are migration guides available to help port it over.
Comment: I have Ubuntu Core installed on a Raspberry Pi. There used to be a "snappy" command, but this seems to be gone now? - What replaces it?


Securing a modem - computer connection

Question: I'd like to connect a pc directly to a dsl modem.
I know that routers can be hacked and e.g. DNS requests can be redirected. But what can be done to hack a modem (without a router!) and what can I do to prevent these attacks? I also read (though without any references) that a router provides more security compared to a modem because of NATing. Are there any more security benefits of a router? And does this outweigh the additional attack surface from the router firmware?
If I go without a router do I need to invest more in the security of the directly attached computer instead?
Comment: There is a lot of material on this exact topic on the Internet. Have you done any reading or research? As it stands, answers will simply point you to external resources.
Answer: Believe it or not the modem isn't usually the attack vector because they often need physical access to be hacked. A wireless router is usually the attack vector because it opens itself up. If you're going to be the safest you can, you'd get a router(either wireless or wired) and put it between you and the computer. These extra jump steps make it harder for people t find your computer without knowing the exact configuration and often make you safer. To make it the safest you can get though I'd suggest a firewalled router, and if it is wireless and you don't need the wireless, turning off wireless. This is usually the best practice to protect a single wired connection in a residential environment.
Of course you could also go the extra mile and set up your own PF-sense box and just connect to that from your modem to your computer. But at that point you're literally building a router.

Securing a modem - computer connection


Parallel WCF calls to multiple servers

Question: I have a WCF service (the same one) running on multiple servers, and I'd like to call all instances in parallel from a single client. I'm using ChannelFactory and the interface (contract) to call the service. Each service has a local <endpoint> client defined in the .config file.
What I'm trying to do is build some kind of generic framework to avoid code duplication.
For example a synchronous call in a single thread looks something like this:
    Dim remoteName As String = "endpointName1"
    Dim svcProxy As ChannelFactory(Of IMyService) = New ChannelFactory(Of IMyService)(remoteName)
    Try
        svcProxy.Open()
        Dim svc As IMyService = svcProxy.CreateChannel()
        nodeResult = svc.TestRemote("foo")
    Finally
        svcProxy.Close()
    End Try

The part I'm having difficulty with is how to specify and actually invoke the actual remote method (eg "TestRemote") without having to duplicate the above code, and all the thread-related stuff that invokes that, for each method.
In the end, I'd like to be able to write code along the lines of (consider this psuedo code):
Dim results as Dictionary(Of Node, ExpectedReturnType)
results = ParallelInvoke(IMyService.SomeMethod, parameter1, parameter2)

where ParallelInvoke() will take the method as an argument, as well as the parameters (paramArray or object() .. whatever) and then go run the request on each remote node, block until they all return an answer or timeout, and then return the results into a Dictionary with the key as the node, and the value as whatever value it returned.
I can then (depending on the method) pick out the single value I need, or aggregate all the values from each server together, etc.
I'm pretty sure I can do this using reflection and InvokeMember(), but that requires passing the method as a string (which can lead to errors like calling a non-existing method that can't be caught at compile time), so I'd like to see if there is a cleaner way to do this.
Thanks
Comment: Not sure exactly what you want to do, but you can Examine the client-side proxies generated by WCF's svcutil and you'll see how you can program at a lower level to invoke services passing names like "TestRemote".  If you want to specifically *avoid* that, then using reflection will work, and it doesn't require passing literal strings. you can interrogate the client-side proxy to see which methods are available and invoke them that way.
Answer:  public static TResult MakeCall<TService, TResult>(Func<TService, TResult> method,  string remoteName)
        {
            // try not to create the factory object for each call, it can be a singleton
            var factory = GetFactory<TService>(remoteName);
            TService proxy = default(TService);
            TResult result = default(TResult);
            try
            {
                proxy = factory.CreateChannel();
                result = method(proxy);
            }
            finally
            {
                // proxy disposal is a bit tricky in WCF and you might need to read more about Close/Abort
                 Close(proxy);

            }
            return result;
        }

which lets you call any method on any interface without having to duplicate the plumbing code.
public interface IMyService
        {
            int Sum(int a, int b);
            int Max(int a, int b);
        }

public interface IMyService2
            {
                bool Test(string value);
            }
   static void Main(string[] args)
        {
            var a = 12;
            var b = 12;
            var r1 = MakeCall((IMyService proxy) => proxy.Sum(a, b),  "endpoint1");
            var a1 = 12;
            var b1 = 14;
            var r2 = MakeCall((IMyService proxy) => proxy.Max(a1, b1), "endpoint1");
            var r3 = MakeCall((IMyService2 proxy) => proxy.Test("test"), "endpoint2");
        }

You can use MakeCall as a building block for your end solution.
Answer: One way to do this is to use:
System.Threading.ThreadPool.QueueUserWorkItem( ... )
Look here for the VB syntax:
http://msdn.microsoft.com/en-us/library/4yd16hza.aspx
Put the aysnc code in the WaitCallback.
Comment: That would be inside of the ParallelInvoke() method in my above example -- but still doesn't help with choosing which method (eg, TestRemote()) without having to duplicate all the surrounding code for each method.
Comment: Yes, you're right, I didn't answer all of your question.  See Cheeso's comment above for the actual answer.

Parallel WCF calls to multiple servers


Can't get file dropping to work in mfc dialog

Question: I have a simple mfc project built on a CDialog. I also have a class I call CDroppable that inherits from CStatic with an added OnDropFiles()-function.
What I do is I add a normal CStatic to my dialog, add a control variable, then change the control variable in the .h-file of the dialog to be a CDroppable instead of CStatic (I think this is fairly standard). I also modify the Accept Files behavior to true for the CStatic.
In my opinion this should mean that if I drag a file over the dialog anywhere outside the accepting window I should get the "invalid" icon, and inside the accepting window I should be able to drop it. That is at least how it worked in VS2005.
However now in VS2010 I can't get it to work. The entire application displays the invalid drag icon. I can set Accept Files on the dialog itself and it will accept files correctly, but I don't want the entire dialog to accept files, I want CDroppable to accept files.
Is it some obvious thing I have missed to activate? Some setting that needs to be changed?
MFC, making simple things impossible (tm)
Comment: I found out what was wrong myself, but I can't post an answer and close this in another 8 hours... figures.
Answer: Actually I found what was wrong.
I had a group box around the droppable area to indicate where it was. This was obviously a stupid idea as even though I had set it to transparent which I assumed would be enough, it still was in the way of the droppable area. I had to set it to disabled and after that it magically worked.
Sorry to take your time.


Thermostat wiring: heat and fan of but AC not cooling & 2 disconnected wires!

Question: I moved to a new home last winter. I have a PTAC unit. Fan is working well, same with the heat over the winter. The building has changed the building's system to cooling for the summer but unfortunately I'm not getting any cold air out of the unit, only the fan blowing ambient air through the unit.
I removed the thermostat and I'm seeing two wires that are not connected but I can't seem to be able to find if that can be the issue. It seems orange and yellow wire can be related to cooling, but when researching it seems the wiring color is not standard (e.g. blue for Y1?).
Does the picture make sense to anyone? I'm thinking those two wires are probably the culprits!
Thank you for your help!
Comment: Does the building have a maintenance man/service you can check with?   Maybe check a neighbor's thermostat.
Comment: Can you post photos of the wiring at the furnace end please?
Answer: It's fine that the orange and yellow are not connected; this assumes they are not connected to anything inside the furnace.
Running 7 wires for a thermostat is normal for future enhancement of either your HVAC system or the thermostat itself. The additional benefit of running too many wires is that if there is a faulty or broken wire like red then you can just repurpose a different color without running a brand new t-stat wire. If you only ran 5-wire and red turned out to be faulty then you need to run a whole new wire; hopefully 7-wire this time ;-)
Yes, there are generally accepted colors for stuff but there's nothing physically wrong with using "wrong" colors as long as they land in the correct terminals at both ends of the wire.
You'll notice there's some gray tape on the blue wire which is a standard wire color for cooling in an A/C unit. The yellow should have been used but whatever.
The only way to truly know which wires go where is to read the manuals: thermostat, furnace, and A/C unit. G needs to land on G at both ends of the wire regardless of wire color.
To me everything looks fine here. You need to add pictures of the wiring inside the furnace and in the A/C unit. If you're not able/willing to do this then you need to call a professional.


Is there any platform like Booking.com that accepts payments with a Maestro Card (Debit Card)?

Question: I've been trying to book a hotel room, I've tried with many hotels, but at the payment phase, all of them ask for payments using either Visa or MasterCard, while I have Maestro.
Can Anyone help concerning this matter? Do you know any website where there is a variety of paying methods?
The thing is that I need that booking to present it as a proof of booking for the visa procedures!
Thank you in advance
Comment: Your bank should be able to help you get a MasterCard, depending on what country you're in.
Comment: Depends on the country I think. In the Netherlands there's a (widely used) [service](https://www.ideal.nl/en/) to pay via (maestro) debit card online (on many websites, including booking.com).
Comment: May sites that say MasterCard actually also include Maestro cards (which use the same network), though this is not universal. You may want to try with your existing card and see if it's accepted.
Answer: Have you tried contacting the hotels directly?
They should be able to tell you whether they accept debit cards or not, you might even get a better price for booking it directly with them.
On the Booking.com website there's a section with payment options all the way at the bottom of the listing.
Most hotels require a credit card as they'll place a hold on your card for the cost of 1 night in case you're a no-show.
At the end of the day it's at the hotel's discretion which payment methods they accept.
You could also check if the hotel accepts PayPal and link your debit card to a PayPal account.
According to the Booking.com customer support page (Find information -> Payment -> What payment methods are accepted?) some locations do indeed offer PayPal as an accepted payment method.


De-coupled dataflow is in Java EE design pattern?

Question: One of project that I am working on having this kind of designed pattern, one bean is defined and used by jsp/action/service classes, that is, used by presentation and business logic layer, while there is another bean is defined and used by DAO layer, called "entity", regardless of the content of these two bean are virtually same, I am told by using two beans is required by Java EE design pattern, to decouple each layers. What I understand about de-couple is implemented by the work-flow of classes as well as class hierarchy, but for data-flow, using same bean is straight-forward and smooth, and one of the reason introduce POJO for DAO layer is to assure this transformation is smooth. Please share your expertise about that are benefit will gain by de-couple this data-flow and what drawbacks will have by using same bean in dataflow?
Answer: It doesn't really make sense to use something you don't need just because it's trendy or conforms to whatever, but having it future proof might be worth the trouble.
What you actually have over there is a Domain Model (the non-entity beans) and entities. This is a must have when you deal with a complex Domain Logic, instead of putting the logic inside the entities, you put it inside the Domain Logic POJOs or when your data is rather complex and you can't actually map a DM bean directly to the database, you need multiple entities for doing that. A Domain Model also helps with inheritance.
Now, if your beans are exactly the same, you either have a very simple model or you don't use the Domain Model properly, take your pick, you know what you've got over there.
You should have a look at the Domain Model "pattern", for instance under Chapter 9 in the classic "Patterns of Enterprise Application Architecture"
Answer: The guys who told you "using two beans is required by Java EE design pattern" are wrong. You can if you want to, some people are fanatical about doing it that way all the time, but it has never been required.
(It might have been they were thinking of pre-EJB3 entity beans, which could not be exposed to the presentation layer so some kind of mapping to a DTO was required. But that has been obsolete for a long time now. Even at the time avoiding entity beans and using JDBC was common.)
Here's an article I like on using DTOs in layered applications.
I've talked to people who strongly favored using a separate bean for the presentation layer, the biggest concern in favor of mapping entities to separate presentation-layer beans was that the persistent objects had methods on them that when called caused changes to the datastore, and they needed to guarantee that those methods couldn't be called from the presentation layer. To me that means they missed the point of using POJOs for persistence, which is that they can encompass business logic (that is, methods changing the state of the object graph) but they don't have any dependencies on the infrastructure. Gavin King and company went to a lot of trouble so they wouldn't have to put a save method on their persistent entities, and there they go putting a save method on their persistent entities, in doing so necessitating a ton of work to make sure nobody misuses the methods that shouldn't have been there in the first place.
Answer: Java EE (not J2EE these days) would suggest using JPA for data access (replacing Entity Beans) wrapping the JPA layer behibd a Session EJB Facade.I think your question amounts to a decision about the types uses in that facade, the DTOs passed in and out. Could those DTOs be JPA beans or should we use separate class?
JPA beans are just annotated POJOs and hence they can reasonably be passed up to a JSP/Servlet layer. In simple cases that's what I see happening. As the business logic becomes more interesting I'm noticing that sometimes we need more business focused objects as the DTOs, and so then yes I do you separate objects.
My advice: design the Session Bean Facade in terms of what makes sense to the caller, if it transpires that the JPA objects work, then use them.
Comment: one problems that using a separate bean instead of directly from DAO is, the business layer logic could be quite complicated and it requires multiple DAO layer access, sometimes these DAO layer access are having overlaps, that is, may having same query executed, by using same bean, in our case, are hibernate entities, DAO layer would get benefit using cache, in our case, is hibernate first level cache, but we won't get it in our project as the bean transferred back to DAO are not entity bean, as business layer always made a copy of beans from DAO. Any comments?
Comment: Sorry, I don't follow the argument. Each time we go to the JPA layer it can decide whether or not to use the cache. We may pay the cost of recreating the DTO from the cache, but compared with a DB call that's surely small?


What do I need to buy to get the full experience of Total Annihilation?

Question: I'm considering buying a copy of the RTS classic Total Annihilation, and I was wondering: What do I need to buy to get "the full experience"? Just The Core Contingency, or do I need the game and its two expansions to play?
Comment: a better title is in place
Comment: This reads like game-rec to me, or at least like it's way too subjective (what is "the full experience"?).
Answer: TA is awesome just by itself! The game is (was) totally revolutionary at the time and the ability to create endless units is one of the funniest aspects of the game.
The expansions are not necessary, but it's nice to have them when you want to see new units, etc.
Buy the full game with the expansion packs. Install it without them, play for a while and then install them.
Comment: yes, they do need the full game.
Comment: so, the expansion packs need the original to run?
Comment: I'm pretty sure you need the original game installed to make them work.
Comment: CC added some interesting new units, but as I recall, they were game-breaking-ly powerful. Especially the full-auto mega turret thing. If you could keep that powered, you were unstoppable. Fun though!
Comment: You are talking about the "Rapid fire plasma cannon" Buzzsaw and Vulcan. In fact if you knew it's location you could easily bomb that to oblivion with aircrafts or nukes.
Comment: If your opponent *lets* you get a Krogoth or a Vulcan up and running, they deserve to die horribly.
Answer: If you want to play with mods, install a better AI or install community-released bug-fix patches, you better get it with the Core Contingency expansion, as most mods and game patches require it or will work much better with it. Battle Tactics is more or less optional as it is mostly just new campaign and skirmish maps, anyway.
And if you're gonna buy it, better buy the GOG.com version as it is setup to be fully-patched (CD check removed and modified to play music without CD, among other fixes) and readily used on Modern OSes.
Answer: Get the base game and The Core Contingency and you are good to go.
Check out http://www.tauniverse.com/play-ta/ for info on how to play online.
Where to play online
For multiplayer, all you need is TA itself (as well as the IP address of the person / party who is hosting the game), but you can organize games over instant messaging programs, like AOL Instant Messenger (AIM), ICQ, or Windows Live Messenger (MSN). However, if you'd rather play or organize games with the help of a specific gaming client or site, check out
GameRanger
PhoeniX WorX
WarZone
Required downloads
TA 3.1c patch: Upgrades TA to the latest version (3.1c).
500 unit limit patch: Changes the maximum in-game unit limit per side to 500.
Extra Cavedog units: The 6 post-3.1c patch official Cavedog units packed into 1 file.
Extra Cavedog maps: All the extra maps Cavedog released after the expansions packed into 1 file.
TA Demo Recorder (99b2): The latest version of the TA Demo Recorder, adding several functions to TA, like shared LOS for allies, cheat detection, and game recording so you can watch replays again later.
Comment: Can you copy some of that information here rather than leaving it at a link? =]
Answer: Well I suppose it depends on your definition of "the full experience".
If you're looking to get a bigger range of units and maps, then I highly recommend the expansion packs. Although that being said, the original game already has a huge selection of units and maps.
Basically, if you can buy some kind of pack that includes the expansions, then there is no reason not to buy it. Otherwise, the original game is fantastic and will keep you entertained for ages.
Comment: My definition of "the full experience" includes an active multiplayer community. I could be wrong, but I think the free remake, TAspring, has more people playing it right now.
Comment: @james: i've looked at TA spring, and while it looks cool, the comunity was just a "little" too hardcore for me.
Answer: I suggest you to buy the GOG (named Commander Pack) version. It works well with Win 7 for example and it has all the expansion packs.
If you tried that out you can get some mods for your TA. For example I really like THE PACK and TAESC.
I have an original copy of TA from 1997 too, but I think that now you should get the one from GOG.


Do I need to add a number prefix when I am not in the uk

Question: I am going Dubai on monday and need to put my mobile number on my suitcase.
I am from the UK.
Do I need to put my number with a +44770XXXXXXX or just 0770XXXXXXX.
Or do I need to put the country code of Dubai? instead of UK.
so that airport staff can contact me if my luggage gets lost.
Answer: For all phone numbers, whether for local or for international consumption, you can always use the international version, with the + and country code.
Without the international code, they can not see which country the phone number is for and might assume it is for a different one, which will result in a failure to reach you.
You do NOT need to change the number, your phone number does not change while you are abroad, it will keep the +44 start.
If there is a country with a phone system where the + does not work, as it does on land lines, they know what to replace the + with.
The best way to add your phone number and address to your bag is to do it in a closed tag, which can be opened when needed but which does not show your address and phone number to all.
Besides, you can use a 'home' address which is not yours but someone who will be home while you are traveling.
There are special tags around which will hide your address, but you can also use a normal luggage tag where people can see what you write.
Just write your name and mobile number (or just name and 'information inside') where it will be visible and more information on the back.
That can be your holiday address, a home address where someone will be while you are on holiday, your work address if work is alright with your case being dropped off there at need, or even your home address if you have no alternatives.
It is also easy to make your own if you can get hold on suitable card or plastic, write, fold over and make a note on the outside it holds your details. You can tape it closed or punch a few holes in and thread a cord though.
Answer: Your (mobile) phone is a UK one. Thus, to unambiguously identify it as a UK phone outside of the UK, you need to add the UK's country code — whether you are in Dubai, Ireland, the US or Australia.
Never ever leave out your home country's country code from your phone number if you are going abroad. Many countries prefix their area codes with a 0; in Germany, the area code 0770 corresponds to the area South of the towns of Villingen-Schwenningen and Donaueschingen. Thus, always write +44 for UK.
If you added the country code for Dubai and somebody attempts to call you, they would end up calling a Dubai phone.
Answer: If you want a person located abroad to call a UK number, then yes you need the +44 prefix. There is no way for a foreign telephone company to know magically that 077... is a UK number.

Or do I need to put the country code of Dubai?

Your telephone number will stay the same wherever you are in the world, no matter which network you connect to. (Unless you change the SIM card of course.) You don't adopt the local prefix.

so that airport staff can contact me if my luggage gets lost.

Airport staff are not going to look at your bag or call the number on it if it gets lost or misplaced. The baggage handlers use the barcode they print to direct your baggage around, and if those get ripped off, they just put the bag away until someone comes looking for it.
As pointed out by Willeke, taxis and hotels may indeed take the time to call the number, or check that the name on the bag is yours when you pick it up.
Also, I know you did not say this, but do not write your address on your suitcase. That just tells people that your address is likely to be unguarded for the next week or two.
Comment: Luggage gets lost in other places than in airports, like on trains, left in taxis, forgotten in hotels, and all of those places rather use a phone number than trying to trace someone through the airline tag which might be left on it.
Comment: @pnuts If your bag is delayed or misrouted, it will be rerouted using World Tracer to the address you give at the baggage desk when you report it missing. The only vague time it might be useful is identifying a single bag if the tag and auxiliary barcodes have been removed—but there are better identifying marks than your own address for that.
Comment: @Willeke Fair point about the phone number, I shall amend that.
Comment: @pnuts In 2014 I lost three bags permanently and had several more lost for weeks at a time. The only positive side was that I had a several complete new wardrobes courtesy of BA, AF, KL and AA. I also had another bag follow me around Europe and North America for a few weeks, usually an airport behind. All they do is send it to the place that you put on World Tracer. Believe me, no airline does anything proactively to find your bag.
Comment: @pnuts If they had delivered it to my home address, I would not have been able to collect it since I was away. :)


Robotic simulator with haptic, proprioceptive, force/torque, joint sensors

Question: I am looking for a robotic arm simulator or a humanoid simulator which has haptic, proprioceptive, force/torque, joint sensors or even more sensors in the arm. Is there any free option?
Answer: There are lots of free robotics simulators out there.  This question lists a lot of them: Robotics Simulator.
But from what i think you want, you probably want a simulator with a physics engine back-end like Gazebo or Microsoft Robotics Studio.  For arms / grasping, i will also mention GraspIt! http://www.cs.columbia.edu/~cmatei/graspit/ and OpenRAVE http://openrave.org/.  Although i am not sure OpenRAVE includes physics.
I am not sure what kind of haptics you are interested in, but i doubt these simulators are accurate enough to simulate surface textures.  i think you will find that these simulators are pretty crude.  I'd say that all the simulators that allow to to build and control joints will therefore allow you to measure joint torques and angles giving you proprioception.  Some of these simulators will allow you to create and add custom sensors to the arms.


Plugin options table,is the data serialized

Question: I am planning on building a plugin and i need to know if the data stored in the options table i will create for the plugin will be serialized or it will be in the ordinary sql format.
Answer: It totally depends on what data is being stored in the option, maybe_serialize will determine in the option is holding a singular static value, such as true/false, 0/1, empty string, whatever(it's called when an option is created or updated).. it will serialize when dealing with objects and arrays, singular values are not serialized.
The get_option function is equipped to deal with this however and will unserialize(or not) as necessary for you(using maybe_unserialize) when it's called, which basically does the inverse of maybe_serialize.
Hope that helps..
EDIT: Confirmed - checked source, above information is correct regarding serialization.
Answer: I am pretty sure it is searilized.
update_option() function serailizes the data passed.
The get_option() function deseralizes it.
Answer: Depends on some factors.
If you're storing options in the db trough WP's API, like using add_option() then the data is automatically serialized by WP if the option is a array.
(same happens in widgets)
If you don't want serialized data then just don't pass arrays to add_option. If you have multiple options you could serialize it yourself and send it as a string before you pass it to the function...