symbol keys missing on my keyboard

Question: I installed LTS 14.04 and ever since some of my keys went missing. First, the dot symbol key is not working, so I have to use the dot key from the numeric keypad. Secondly, the right alt key is a shortcut for mute speaker volume although I deleted all multi media short cuts in the system settings/keyboard. Thirdly, on the 12.04 LTS version and with english language option selected I was able to type german characters while pressing the right Alt key + q,y,p for ä,ü,ö. This was very convenient, because I did not have to switch to German language. This feature does not work any longer, because the right Alt key is now mute speaker volume and I can't change it. I appreciate your help and thank you.
Comment: Welcome to Ask Ubuntu! You need to clarify your question a bit. Which feature(s) for controlling the keyboard behavior is it you need help with? Did you install a fresh 14.04, or did you upgrade from 12.04?
Comment: Thank you for getting back to me. I´m pretty sure it was an upgrade from 12.04 LTS to 14.04 LTS. I did not have to move any files and nothing was overwritten.  I solved the german characters issue, though. I had to look it up once more and changed to english international with dead keys and now I´m able to input the german umlauts like before. However, the dot key is still not working. Also, the quotation symbol key is not working properly. I have to hit the key twice for the symbol to appear on screen.
Comment: Ok, I posted an answer to address the issues you mentioned in the comment. Can you please edit your question, so it clearly focuses on those issues.
Answer: Assuming you are talking about English (US, international with dead keys), that keyboard layout turns the quotation symbol key to a dead_diaeresis key for typing e.g. ë. To type the quotation symbol you need to press both <AltGr> and <Shift>.
The dot key should be unchanged, though.
You can see an overview of the currently selected keyboard layout by clicking the input source indicator in the menu and selecting Keyboard Layout Chart.

symbol keys missing on my keyboard


Just how light-sensitive is ethidium bromide?

Question: One lab I was in was paranoid about keeping it in a foil-wrapped conical tube; my current lab leaves it out on the bench (and it works fine for staining gels). It's the same company/concentration in both cases, but this second lab uses it up much faster.
Answer: Good question.
I found this reference in "Molecular Biology: A Project Approach"

A phenomenon called photobleaching occurs when ethidium bromide (EtBr) -stained DNA is illuminated by ultraviolet light.... This decreased fluorescence is presumably due to the dissociation of ethidium bromide from the DNA.

Ethidium bromide fluoresces when it is in a hydrophobic environment, such as when its stuck between two base pair stacks in DNA- water quenches its fluorescence.
I also found this article citing the fact that sunlight can break down EtBr but only when a catalyst of iron and titanium dioxide is there to catalyze the reaction.
A lot of the original characterization of EtBr as a stain is very old, so I couldn't access it directly online... It looks like the compound itself is pretty stable, but UV can, somehow interact with it when its bound to DNA to bleach it out.
Comment: I should think not. Eppendorf tubes are UV absorbant anyway.   I added a link to the article - thought I had it there.. (UV reference: http://www.eppendorfna.com/int/index.php?l=131&action=support&sitemap=4.1&productpage=41&catalognode=28832)
Comment: Thanks. So on the bench in its bottle, ethidium bromide shouldn't be light-sensitive, unless there's iron and titanium dioxide contamination (or some hydrophobic substance)?  (also, could you link to the article? I'm pretty sure I found it earlier but I can't find it anymore)
Answer: In my current lab we just leave the bottle out (but use it up pretty quickly as we have 20+ people). But we do buy 5 bottles at a time and leave them in the same spot as the bottle that is in use (inside a hood, with the light always turned on) and we've never had a problem with degradation/expiration


How do I favorite/hotkey a dual wield setup?

Question: I've been playing Skyrim for a while now, and still have not figured out how to properly create a hot-key to my dual wield setup. I've tested with spells, which easily allow you to select multiple spells or dual wield the same spell. But with weapons, if I use my hot-keys to switch to a spell in my left hand, and then afterwards, hit the hot-key for my weapon, it just swaps the weapon I have in my right hand, keeping the spell in my left hand. It makes it very annoying to harvest souls, as I have to open the Quick menu each time, and manually select it in the proper hand.
Comment: I couldn't ever get dual wield to work properly. What I wound up doing is hit the left-hand hotkey twice, then the right-hand hotkey once. You should end up with things in their proper hands (unless you want to wield a weapon left-handed, I suppose).
Comment: it gets doubly annoying when you are dual wielding two of the same items.  One of them always drops out of the favorites menu.
Comment: I've upvoted the good workarounds, however, I'm not marking an answer since it's obviously a missing feature in the game, that'll hopefully get added/fixed later.
Comment: I think it's bugged. I simply want hotkey 1 to dual wield 2 of the same dagger, and hotkey 2 for healing one handed. No matter how I favorite and setup 1 as dagger or daggers, the game drops it after I switch to healing and try to re-equip my daggers. The favorites menu confirms the 1 has dropped and now there are the dagger or daggers there with no number(s). Pressing 1 twice doesn't work, although it works for dual spell wielding.
Answer: What works for me:

Favorite the weapons
Equip them in the proper hands
Assign a hotkey only to the one in the right hand

Now, only hit that hotkey when that's not already the equipped weapon, and you should get both.
If you do accidentally hit the hotkey when the weapon is equipped already, sometimes you'll end up de-equipping the left hand weapon; just hit the hotkey again to re-equip it.
Comment: this trick wont work if you want to have both dual wielded weapons hotkeys and dual spells hotkeys. really annoying...
Comment: Yea... this works for unenchanted items... As soon as I made them magical this trick stopped working. so annoying... why can't they make setups bound to favorites instead of singular items.
Comment: This has been my solution as well, and works as long as I do it just right.
Comment: @RaZorHamZteR I use it with a Glass Dagger of Some-sort-of-ice-enchantment and an Ebony Dagger of Some-sort-of-fire-enchantment without any problems - your problem isn't related to the enchantment.
Comment: Thanks, I was messing with this for a while and wasn't sure how it works. :)
Comment: This works for me https://www.youtube.com/watch?v=pCeeG7LJfQk
Able to group dual wield into a group. (default hotkey F1, F2 ect., which can be changed in Mod Configuration Menu of SKSE). and able to switch to magic spells and then 1 key reverts back to dualwield.
Answer: The only scenario in which you can do this is if you have two identical weapons.  Remember that the goal is to be able to switch to your dual wield setup, and that using a spell when dual-wielding will always start off in the off-hand (hitting it twice will dual-cast it).
If you have two identical weapons (so they get listed as Glass Sword (2)), you can set up a favorite and link a hotkey to them.  Hitting that hotkey twice will dual wield the weapons.
Hopefully they'll address the ability to fully hotkey dual wielding at some point.
Comment: My method works fine with two different weapons.
Comment: It works fine if you're switching between Two-Handed or Bow and Dual Wielding.  It does not work if you're using hot keys for spells and trying to switch back to dual wielding.

Setup #1: Ebony Dagger (hotkey 1), Glass Dagger (hotkey 2).  Bow (hotkey 3).  Equip daggers in desired hands. Hit 3 (equip bow). Hit 1 (equip Ebony), and the Glass is still off-hand.
Comment: Setup #2: Same daggers, Flames on 3. Hit 3 (flames goes in off-hand, hit it twice to dual-cast).  Now try hitting any combination of 1 or 2 to equip both daggers.

I think the central confusion here is likely that some are using 2-handers
Comment: I have 2 Falmer swords which used to stack (but then, ...) and worked with 1 hotkey to dual-wield. But since I upgraded both to Superior, this is broken as well
Answer: Go on inventory and press F on the items you want as a favorite then press Q whilst playing and press 1-8 for the hotkey you want on the item
Comment: This doesn't answer the core question here of **dual** wielding i.e. two items one in each hand.


rendering a display list produced from a pdf file

Question: Is there a (unix) pdf viewer that supports font substitution? This option may be useful for disabled (e.g. dyslexic) people.
For example, is there a way to render a "display list" like the following one produced by mupdf,  and modify/substitute the fonts?
<code><?xml version="1.0"?>
<document name="foobar.pdf">
<page number="1">
<fill_text font="RBRYXK+CMR17" wmode="0" colorspace="DeviceGray" color="0" matrix="1 0 0 1 0 0" trm="17.2154 0 0 17.2154" >
<g ucs="S" gid="10" x="128.335" y="664.286" />
<g ucs="t" gid="24" x="137.115" y="664.286" />
<g ucs="r" gid="22" x="143.209" y="664.286" />
<g ucs="u" gid="25" x="149.303" y="664.286" />
</code>
I understand that  the MMZAAW+ syntax is an Adobe convention for naming font subsets. Thus this is a specific subset of CMR10, and the FontDescriptor has some useful info  (section 5.7 of the PDF spec). But many of these are optional (even if strongly recommended). FontFamily is one, but less common are FontWeight and FontStretch.    ItallicAngle is usually present, and StemV StemH can be used to infer weight. PDF also has a "Widths" array that is required and useful in font substiution. (This is taken from #ghostript irc channel of mupdf; the display list is generated by the mupdf viewer). Is there a library which can convert these font descriptions to their parameters like FontWeight, FontStretch, ItallicAngle, StemV Stem H ? Which can produce bounding boxes on these data ?
Answer: Use PDF-a as an default PDF file type. The users PDF viewer can then render selected fonts and font-sizes as specified by the user.
http://en.wikipedia.org/wiki/PDF/A


What conditions provide the oldest star?

Question: If we define the start of the lifetime the protostar and the end of the lifetime a red giant (at max volume), what conditions would make this time the longest when the star was first formed and throughout it's lifetime. And I don't mean conditions that are never likely to happen within the universe.
Answer: The dominant factor determining the lifetime of a star is its mass. Most of a star's life is spent on the hydrogen-burning main sequence phase. Subsequent phases (subgiant, red giant, horizontal branch, asymptotic red giant) are much shorter, and the time between the first gas cloud collapse and the commencement of main sequence burning is much, much shorter.
Stars appear to be born with a broad range of masses in all regions of the universe. In fact, it is a struggle to find any strong observational evidence that the so-called "initial mass function" is anything but universal and invariant (e.g. Bastian et al. 2010). It is possible and theoretically plausible that the very first stars, born with no heavy elements, were predominantly very massive, but these would have had very short lives and are not around now.
Both the lifetime of a star before it reaches the main sequence (i.e. before it starts it's hydrogen burning career) and it's subsequent main sequence lifetime, are longer for lower mass objects. Roughly speaking, the main sequence lifetime is
$$\tau_{\rm MS} \sim 10^{10}\left(\frac{M}{M_{\odot}}\right)^{-2.5}\ {\rm years},$$
where $M$ is the mass of a star in solar units.
Given that the universe is about 13.7 Gyr old and that the formation of stars began a few hundred Myr after that, then the oldest stars that are still on the main sequence have masses of $0.08 < M/M_{\odot} < 0.9$. The reason for the lower limit is that below this mass, the objects do not fuse hydrogen and are called brown dwarfs rather than stars.
Slightly higher mass stars with same old age will now be red giants. Even higher mass stars will have completed their lives, but will have left behind stellar remnants such as white dwarfs and neutron stars.
So I think the answer to your question is that stars with a range of masses were born within a few hundred million years of the big bang and are still alive now.
If however your question is what kind of star will live the longest into the future, then the answer is the lowest mass object that can still be classified as a star. This is generally taken to be about $0.075M_{\odot}$ for objects with the same composition as the Sun, and about $0.08M_{\odot}$ for low metallicity objects that are more likely to be formed shortly after the big bang.
There appear to be no special conditions required to produce these very low mass stars and they are found basically everywhere that star formation has occurred.
Answer: The biggest factor that affects the lifetime of a star is its mass: the more massive it is, the faster it reaches the red giant stage.
So the condition that makes this the longest is very similar to asking what the lowest possible mass of a star is. The current observational limit is about 0.09 solar masses.
Comment: Are you familiar with stellar formation? If not I'd suggest reading the Wikipedia article on the topic. If yes, I think I won't be able to answer this question at the level you want.
Comment: Doesn't the reduced mass make it reach denser elements more quickly than usual? Also what conditions would produce a star of low mass?


Deploy a Docker environment on Elastic Beanstalk

Question: I just "Dockerized" my infrastructure into containers. The environment basically is one nginx-php-fpm container which contains nginx configured with php-fpm. This container connects to multiple data-containers which contains the application files for the specific component.
I've seen multiple talks on deploying a single container to Beanstalk, but I'm not sure how I would deploy an environment like this. Locally the environment works. I got my nginx-php-fpm container using the --volumes-from flag to a data-container.
How would I create the same environment on Beanstalk? I can't find the option to volume from another container. Also is there a good platform that handles the Docker orchestration yet?
Comment: I would create build images and copy the data from local into image, then just have that deployed.
Answer: AWS Elastic Beanstalk provides Multiple Docker environment. It will be deployed on top of AWS EC2 Container Service (ECS). ECS itself supports --volume-from options. See AWS ECS documentation to mount volumes from another container using volumesFrom.
AWS Elastic Beanstalk Multiple Docker environment use same Dockerrun.aws.json in ECS. Try to replicate the Dockerrun.aws.json from the ECS documentation.


How do I obtain updates on Ubuntu Server?

Question: I've used Ubuntu desktop before but not the server. On the desktop the update manager automatically checks for updates (and allows them to be installed) but how do we do this on the server version?
Answer: If you want upgrades automated, you can set up automatic upgrades using:
sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades

Answer: type:
sudo apt-get update && sudo apt-get upgrade

type in your password
That should do it.


Scaling down Stroked lines

Question: I have several lines and arcs with different Strokes and want to scale down all objects similarly. When I select and Shift+Drag, all objects scaled down but lines Strokes. How can I change scale of the strokes?
Answer: Tick Scale Strokes And Effects on the Transform Panel before dragging.
(Scale Strokes and Effects is also in the Preferences, but the Transform Panel is easier.)

Scaling down Stroked lines


How to delete a range of records at once on MySQL?

Question: I have rows over 60000 in my table. How can I delete rows from 40000 to 50000 at once?
Comment: do the rows have an automatically incrementing key?
Comment: Do you have sequential IDs? What's the structure of the table? What have you tried? Why you can't you you just use a simple DELETE with a range?
Comment: Here is the syntax of the `DELETE` command (http://dev.mysql.com/doc/refman/5.6/en/delete.html), for instance: DELETE FROM mytable WHERE colname='XXX';
Answer: You can use the between function:
delete from exampleTable where id between 40000 and 50000

or:
delete from exampleTable where id >= 40000 and id <= 50000

pretty simple?
Answer: I'm assuming you want to do this based on the the default order of the table, and you don't have a natural key or some other way to order these in the table data.
I.e. SELECT * FROM WORDS returns:
Hi
Hello
Bye
Goodbye
What's up

So if you said you wanted to delete rows 2 to 4, do you want to delete Hello, Bye, and Goodbye.  Right?
Is the return order of your table deterministic?  In other words, to you get the results in the same order every time?  Ideally, you would be able to identify a column in your table that contains data you could key off of, which would let you use Tricker's answer.
If that isn't true, you will need to use the row number for your between statement.  I'm not a mysql user, the code below would undoubtedly be cleaner if I were.  Additionally, I don't even have a mysql database to test the query against. I put together a sql statement using this post as a reference for how to get a row num in mysql. With MySQL, how can I generate a column containing the record index in a table?
My query assumes you have some kind of primary key on your table.  If not, there is no way to guarantee that you wont delete extraneous rows, plus it's good table design.
DELETE FROM YOUR_TABLE
WHERE primarykey =
(SELECT  primarykey FROM
   (SELECT t.primarykey,
           @curRow := @curRow + 1 AS row_number
   FROM    YOUR_TABLE t
   JOIN    (SELECT @curRow := 0) r)
WHERE row_number between 40000 and 50000);

Answer: If you dont have a primary key and want to delete by row count i.e row range,
it can be done via mysql export import.
Do a custom export - Specify the start row and count.
In your case, you ll need two exports: one for rows 0 - 40k, second for 50-last.
Then import those two files into the table.
Note: If importing large files is a problem, I recommend BigDump. http://www.ozerov.de/bigdump/
Answer: Table: grocery
id  item
----------
1   rice
2   soap
3   rice
4   rice

DELETE FROM 'grocery' WHERE item="rice" LIMIT 2;

This is easier than all the other ideas. for this particular item , there are 2 records can be deleted.
And the answer is,
2 rows deleted.

SELECT * FROM grocery;

id  item
----------
1   rice
2   soap

Comment: Whilst technically you could use `LIMIT` this example is not adequate, a limit without an order can lead to unexpected results. The acceptable answer offered 3 years earlier is much better suited for OPs needs, this example doesn't reflect OP's issue at all.


How safe is BitcoinCore since it is using owner's passphrase?

Question: When I want to create a wallet with BitcoinCore by going File->Create wallet, it asks me to choose a passphrase for it. Over the mouths exploring Bitcoin I learned that it is very unsafe to use custom passwords since they can be easily cracked (if I'm not mistaken, this type of wallet is called Brain wallets). I'm assuming that the passphrase will be used as a seed for a random generator in order to create private key for that wallet, and all this seems pretty unsafe to me.  Also I noticed that there is a checkbox saying Encrypt wallet. Does this mean if I don't make this check, my wallet will be unencrypted and therefore unsafe?
Answer: No, not all passphrases are used to generate the private keys for a wallet. Only specifically brain wallets do that.
Passphrases in actual wallet software like Bitcoin Core and Electrum are used to encrypt the wallet. The private keys are still randomly and securely generated. Your passphrase is only used as an encryption key so that the private keys are stored encrypted on disk.
It is safe and recommended that you encrypt your wallet with a passphrase. If you choose to not encrypt your wallet, then the private keys will be stored unencrypted on disk and any person or malware with access to your computer can steal your private keys and thus your Bitcoin.
Comment: I was trying to address your confusion. Private keys are generated randomly; there is no seed or passphrase involved. If you want to know how Bitcoin Core exactly generates randomness, that would be a different question.
Comment: @ddavi031 Computers can generate random numbers. See https://en.wikipedia.org/wiki/Random_number_generation
Comment: Thank you a lot Andrew, but I'm a bit confused. How is a private key generated if it doesn't use a passphrase as a seed? Is there any article on this subject you would recommend?
Comment: Thanks, I'm familiar with that, but I was wondering which algorithms BitcoinCore is using specifically to generate a private key? I can ask this as a new question if you think that is more appropriate and I'm off topic here.


Cannot connect remote sql server on aliyun

Question: I have installed SQL Server Developer Edition 2017 on Windows Server 2016 in order to do some test on my aliyun server.
However, I cannot connect remotely.

On local SSMS, the "Allow remote connection to this server" is checked
On local SSMS, I can login using the LAN ip of the server
I have checked that the SQL Server configuration have TCP/IP enabled, and that the port is well set on IPALL config
I have also enabled NAMED PIPES (we never know...)
By default, the windows firewall is disabled (turn off) so I suppose that I don't have an issue there as well
I can ping on my pc the distant server (public ip)
I have rebooted the SQL SERVER service maybe a million times.

After all of it, I honestly have no idea what to do next to unlock this issue. Do you know if Aliyun block some port by default ? Do you know what can I check next to understand what's going on ?
Thanks for your help.
Answer: I found the reason... My guess was right. Aliyun have a firewall and you have to go to ECS Console management on Aliyun, Network and security, Security Group, then on the right on the first security group click on add rule, then the button Add Security Group Rule, then specify the MS port.


What are some non-living things that can spontaneously increase their complexity?

Question: I mostly have cave crystals that grow on their own on my mind, along with perhaps river channels that change their shape over time - but perhaps there are some other, better examples. Also, the more examples, the better.
Comment: There is spontaneous radioactive decay. This is perhaps more "spontaneous" than the crystals growing since it is not potentially deterministic, but the "decay" suggests it is not increasing complexity, however, that might not be the best way to describe the resulting products after the decay. I don't really know a good answer, but I hope others have one. Welcome to this SE!
Comment: You can go from a solid chunk of some radioactive isotope or other into a chunk of varied elements, which looks to me like becoming more complex.
Answer: The best example is probably our universe!  Current models of mass and gravity, plus some chemistry, show that the galaxies and stars that we see have "evolved" from previous forms and become quite complex indeed.  See this Youtube user page for a variety of animations.
https://www.youtube.com/watch?v=6L1N95IRG8I
Answer: There are many self-organizing, non-living complex systems.  The weather is one (with the Great Red Spot on Jupiter perhaps representing its pinnacle as a self-organizing system).  Snowflakes are another, and the shapes of rivers are a third.
If you are interested in this topic, then I highly recommend that you research chaos theory.  James Glieck's Chaos is the canonical beginner's introductory text.


How to add OnComplete event to bitmap.SaveToFile('img.bmp');

Question: i want to halt my application when my bitmap is completely saved?
Answer: Unless you are calling that method in a separate thread I'm fairly certain that it will be completely saved at the point at which the method returns:
  bitmap.SaveToFile(..);
  // file is completely saved at this point

What is it that leads you to believe that it isn't completely saved at this point?
The only wrinkle might be that with "lazy writes" Windows itself might not yet have completed the business of physically writing the file to the disc, but as far as your application (or any other application) is concerned, that is irrelevant.  If you attempt to access the file before Windows has completed committing it to disc that application will simply "block" until it can safely access the file, but you don't need to specifically handle this, it "just works".
Answer: If you want to halt your application cleanly there are several options:
1)  Close the main form.  When you close the main form, the application will close.
procedure TForm1.SaveAndClose(Filename:String);
begin
  Bitmap.SaveToFile(filename);
  Application.Mainform.Close;
end;

2)  Call Application.Terminate.  This shuts down your application abruptly, but does run any finalization code.  It is normally invoked when the application receives a WM_Quit message or the main form closes.
procedure TForm1.SaveAndClose(Filename:String);
begin
  Bitmap.SaveToFile(filename);
  Application.Terminate;
end;

3)  Post wm_Close to your application/main form.  This has the added advantage that any other messages in queue for the application are processed.  It is equivalent to pressing CTRL-F4 or pressing the "X" in the upper right on your main form.  The only issue is that if the message queue is full then it may not ever reach the form (rare).
procedure TForm1.SaveAndClose(Filename:String);
begin
  Bitmap.SaveToFile(filename);
  postMessage(Application.MainForm,wm_close,0,0):
end;

4)  Call Halt( ExitCode:Integer ).  This is a bit more extreme and will terminate the application.  Finalization code will still be run, but memory is not guaranteed to be freed.  Optionally you can set an exit code that will be returned back to the calling application.
procedure TForm1.SaveAndClose(Filename:String);
begin
  Bitmap.SaveToFile(filename);
  Halt(0);
end;


What kind of identification code is this format? (AAA0000)

Question: From what I understand, an aircraft's registration number is its ICAO code in the pattern found here: Wikipedia: Aircraft registration, but I have seen references to aircraft using a 3-letter code (I'm assuming it's an airline code) followed by a 4-digit number. (Example: PAK0032) What kind of a number could that be?
Comment: Could you specify _where_ you have seen such references? It might help identify what they are.
Comment: It's in a database my company has where airlines can enter their aircraft's information. Generally this ends up being the tail number, but occasionally it isn't, as in this case.
Answer: That format is the flight id. The first three characters are the ICAO operator code which identifies the airline. The rest of the characters are unique to that flight. The first character after the ICAO operator code is always a number, after that both numbers and letters are allowed. The maximum length of the flight id is 7 characters.
The flight id is transmitted to Mode S radars by the transponder and also broadcast on ADS-B. It is used to correlate a flight to a flightplan.
The flight id is also the basis for the callsign used in radio communications. The ICAO three letter code represents the airline's callsign, the rest of the code is pronounced in the ICAO alphabet.
Answer: The registration for an aircraft follows the nation's letter assigned by ICAO, correct.
But this is not the only instance where ICAO is used. When the registration is not used as the radio callsign for the aircraft, They will use the flight number to address the aircraft on the radio.
The flight callsigns do not always follow the flight number you see on your ticket, especially since the radio callsign uses the ICAO code for the airline instead the IATA code on your ticket. Some airlines even replace parts of the flight number, either to avoid similar callsign at the samw time or to obfusticate which flight it is.

LH4892 could be known to ATC as DLH48RA

Some transponders can be programmed to broadcast the flight number if they operate with ADS-B. In these cases they carry a specific hexadecimal value, which can look similar to the code you posted, but can have the hexadecimal values in any place and not only the letters in front.


Install compat-libstdc++-33.i686 on Red Hat Enterprise Linux Server release 6.5 (Santiago)

Question: I need to install compat-libstdc++-33.i686 on a Red Hat Enterprise Linux Server release 6.5 (Santiago) without a Red Hat Network Subscription. Is there some where that I can download the required .rpm that suits this RHEL version?
Answer: Update for RHEL 7 people:
I needed the same item for el7, which in RHEL world, it means adding the "optional RPMs" to your YUM repolist.
    $ yum-config-manager --enable rhel-7-server-optional-rpms

yum should be able to find and install the compat rpm now...
    $ yum install compat-libstdc++-33

Comment: For RHEL 7 on Azure, that's "yum-config-manager --enable rhui-rhel-7-server-rhui-optional-rpms" (repo names are in /etc/yum.repos.d/rh-cloud.repo).
Answer:
The RHEL 5 package compat-libstdc++-33 : You can get free packages from "Redhat CentOS" → → http://mirror.centos.org/centos/6.7/os/i386/Packages/ . The updates are here → http://mirror.centos.org/centos/6.7/updates/i386/Packages/

compat-libstdc++-33 : http://mirror.centos.org/centos/6.7/os/i386/Packages/compat-libstdc++-33-3.2.3-69.el6.i686.rpm
Download the package, and ....
1) $ cd Downloads/
2) # yum install compat-libstdc++-33-3.2.3-69.el6.i686.rpm

You can also migrate to CentOS ( get the CentOS repo files, etc.) → https://wiki.centos.org/HowTos/MigrationGuide

Update for CentOS 6.10 : http://mirror.centos.org/centos/ → [version] → os/ and updates/
Older CentOS versions : http://vault.centos.org/


Django Rest Framework admin styling messed up

Question: I recently noticed my Django admin styling is messed up. The CSS seems to be working though and everything works, but once you click on a model, the next page is messed up. Does anyone know what causes this? I don't remember changing anything that would cause this.
Answer: I've had something similar before, the fix for me was changing the DEBUG setting.


Max_packet_allowed setting for Windows 7

Question: We have windows xp machine with older version of mysql. So when we need to import huge data we just set the max_allowed_packet=1500M in the C:\Program Files\MySQL\MySQL Server 5.1 . Now we loaded the latest mysql 5.6.12. We are trying to import the same date and we find there are few my.cnf file on is in the program file and another in programme data both change yet we cant import the same data. Where else to change even after the change we started the service by going into the admistrative tool.
Comment: What does `SHOW GLOBAL VARIABLES LIKE 'basedir';` return?  Is there a file called 'my.cnf' in that directory?
Comment: @It says this C:\Program Files\MySQL\MySQL Server 5.6\ and here is a filed named as my-default and in it also I have put infact max_allowed_packet=2000M but yet it does not work.
Answer: The maximum size for a MySQL Packet is 1G according to the MySQL Documentation. See my post Changed max_allowed_packet and still receiving 'Packet Too Large' error  in case you are dealing with big BLOBs.
If you are importing a large database from Windows. see my past posts

Jul 24, 2013 : Moving MySql from windows server to linux (StackOverflow)
Apr 17, 2011 : How can I optimize a mysqldump of a large database?
Comment: what surprise me it works well on windows xp but on not on windows 7 another thing the file in this location C:\Program Files\MySQL\MySQL Server 5.6\  is my-default do you think I should change it to my.cnf? My file is pure text data no blob and is very basic data just with few hundred thousand rows. Is it because I am using sqlyog to import in the data ?


How do I remove the "Learn More" verbiage next to each product

Question: How do I remove the "Learn More" verbiage next to each product, yet still allow the user to click on the image to go to the product details page?
Answer: This comes from the catalog/product/list.phtml template. Depending on the theme you are using that will be somewhere like app/design/frontend/rwd/default/template/catalog/product/list.phtml, or app/design/frontend/base/default/template/catalog/product/list.phtml.
To remove the link you could edit one of those files but better practice would be to override the template in your sites theme and change it there e.g app/design/frontend/mypackage/mytheme/template/catalog/product/list.phtml
To override a theme, say you were basing your theme on the rwd theme, you could create a new theme folder, lets say it was app/design/frontend/mysite/default. In that theme you should create a new file called etc/theme.xml, that file would look something like this:
<code><?xml version="1.0"?>
<theme>
    <parent>rwd/default</parent>
</theme>
</code>
It is basically saying that your new theme extends the rwd/default theme. Then set the package in the admin design settings to mysite rather than rwd. Your site will now be using your new theme. You can then override templates by replicating them in you theme template directory, so in this case app/design/frontend/mysite/default/template/catalog/product/list.phtml.


Zonal stats percentile values using R?

Question: I have a 1-m continuous DEM and a vector grid with ~160,000 250m cells. For each cell in the grid overlaying my DEM, I want to retrieve the 50th percentile pixel value. I'm curious if there's a way to retrieve this percentile value using zonal stats in R?
Answer: Here are two ways to do this. The raster extract function is the common approach. However, the zonal.stats function uses velox under the hood, which speeds things up considerably. You will not see much difference here but, with large problems it is a huge speed gain.
Add required libraries
library(raster)
library(sp)
library(spatialEco)

Here we create some example data. Please note that I am creating a raster that contains "zones" or polygons and then coercing it to a SpatialPolygonsDataFrame object. This is similar to what the raster::rasterToPolygon function does. Depending on your data, when operating on large rasters, an efficient approach is to have your zonal data represented as polygon vector data.
p <- raster(nrow=10, ncol=10)
  p[] <- runif(ncell(p)) * 10
    p <- as(p, "SpatialPolygonsDataFrame")
      p <- p[p$layer > 9,]
        r <- raster(nrow=100, ncol=100)
          r[] <- runif(ncell(r))
    plot(r)
      plot(p, add=TRUE, lwd=4)

This defines a simple wrapper function for quantile that allows us to control the functions arguments while passing it to another function.
pct <- function(x, p=0.5, na.rm = TRUE) { quantile(x, p, na.rm = na.rm) }

This method extracts the raster data, and applies our pct function, for each zonal polygon using the extract function in the raster package.
raster::extract(r, p, fun=pct)

This method extracts the raster data, and applies our pct function, for each zonal polygon using zonal.stats in the spatialEco package, using velox for the raster value extraction.
spatialEco::zonal.stats(x = p, y = r, stats = "pct")

Comment: Thank you! Can you explain what you're doing in the first section of this script when setting the p and r objects? Your script works, but I'm getting NULL results when reading in my own files.
Comment: @happymappy please see my clarification. This was just creating some example data but, functionally the data need to be a `SpatialPolygonsDataFrame` object, representing the zonal data, and a `RasterLayer` class object representing the raster value data. And, obviously they must share the same projection and align.

Zonal stats percentile values using R?


indesign: starts number from 1 mid way through doc

Question: I have a 32 single page document created in indesign and i have numbered the pages but at page 27 the numbering reverts back to 1. How do i change this?
Comment: We can only guess with this info. Do you have chapters, mixed layouts? Are you using page numbers on master pages or on individual pages?
Answer: If the numbering is done in the correct way and not simply typed in at every page, it would mean that the document is probably divided into sections that define numbering.
If you want to get rid of those sections, select the pages where the numbering starts again from 1 and right-click the selected pages and choose the Numbering & Section Options. There deselect the Start of section option, accept and your page numbers for those pages should continue the numbering of the rest of the document.


Adding values from different fields within same row in ArcGIS field calculator?

Question: In my attribute table, I have over 200 fields and tens of thousands of rows or attributes. I am trying to sum the values in each field across each row. This seems like a basic function but when I search for this topic, I've only found instructions on summing entire fields. I could just select each individual field with a "+" in between in the field calculator but there has to be a simpler way than that.
Comment: The "simpler" way would be to write some ArcPy/Python code.  Perhaps using ArcPy's ListFields and Python's .join("+").
Comment: Databases and spreadsheets are very different animals. 10k rows is a *tiny* database table, and 200 columns is ungainly latge. Maybe you should be using a spreadsheet.
Comment: The issue I'm having with the spreadsheet is that Arc freezes whenever I try to join that file to my attribute table and populate the sum field using the field calculator. I figured there might be an easier way
Answer: In the field calculator there isn't a simpler way as far as I know. I do not think that it is common to want to sum every field in a row without being selective of the fields to be summed. Python could be used in the field calculator to do this, but you would end up writing code that is better to run in a script.


Unable to process SharePoint Server 2013 Setup, even though all prerequisites have been installed / enabled

Question: I am using Windows Server 2012. When I open "prerequisiteinstaller", all the prerequisites are already installed / activated, but when I open Setup, an error notification appears. Can you help me?
Comment: Which version of .NET are enabled on the server?
Comment: I have enabled .NET Framework feature version 3.5 and 4.5
Comment: Sorry for classic, silly and annoying question: have you restarted the machine before trying to install SharePoint?
Comment: of course sir..
Comment: Did you run the pre-req installer as admin?
Comment: Yes sir. After i check installation log, i have some error:
Comment: Update to machine.config failed.
Update to DistributedCacheService.exe.config failed.
Windows Server Features or Role Services check failed.
Answer: First of all, check if the server has connected to Internet. After, please, (1)restart the server and (2)re-execute the prereq again and do the steps (1) and (2) until you change this status. If that doesn't work, go to the command line (Powershell) with Admin privileges and execute this cdmlets bellow:
<code>Import-Module ServerManager

Add-WindowsFeature Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer –Source D:\sources\sxs
</code>
The last parameter "-Source" indicates the drive letter with the Windows Server 2012 media installation (USB or DVD); at least Windows Server 2012, to install new resources to Windows Server, requires the Media Installation.
Comment: It looks like I've done all of these steps before, but it's still not working. Monday, I'll try again and I'll let you know whether it worked or not. Thank you sir.
Comment: @HanifMaliki, is it solution works?


Cables for my rear gears do not work

Question: The rear derailleur on my Huffy 21 speed bicycle does not switch anymore. It will click and turn, but the gear won't switch. When I attempt to force it manually it switches back to the biggest gear (smallest cog?). Please help, it's my only mode of transportation.
Comment: It could be a minor cable adjustment, it could be a major overhaul of the shifters and derailers.  Start by reviewing this video: https://www.parktool.com/blog/repair-help/how-a-rear-derailleur-works
Comment: There may be several issues with rear gears; you'll have to provide pictures of the rear derailleur (different views will help) before anyone could help you. However, just from the fact that it slides to the smallest (?) cog I would make a wild guess it is a broken cable.
Comment: How old are the cables? They may be rusted or stuck inside the housings. Best idea would be to replace cables and housings. While you're at it, maybe also for the brakes. It's a good thing to do after two or three years of use as a safety measure anyway.
Comment: Isolate whether its the shifter, the cabling, or the derailleur.  Hang the bike up, and while slowly pedalling use your hand to pull the exposed taut inner wire.  If that's still bad, then carefully push the derailleur with your left hand.  Mind fingers!
Answer: If the shifter does not move the derailleur at all, then either:

A cable housing has come free from the shifter unit, frame boss or derailleur
A cable end has detached from the shifter
A cable end has detached from the derailleur
The cable has broken (least likely)

Basic things you can do to find the problem:

Find an exposed bit of cable (the inner silver cable, not the black housing) on the frame somewhere. It should be taught and not loose.
Inspect the shifter cable run from the shifter to the derailleur, make sure the cable housing is inserted into the shifter unit, all frame bosses and the derailleur.
Find an exposed bit of cable near the derailleur, grab hold if it (using pliers will help), put a little tension on it and operate the shifter. If the cable moves it's attached to the shifter.

If the cable is moving near the derailleur when the shifter is operated, check the cable is attached to the derailleur.

Cables for my rear gears do not work


What could be causing errors when estimating coefficients with xtgls in stata for unbalanced panel data over 4 years?

Question: I am using unbalanced panel data for 4 years. In trying to decide which time variant model (xtgls, xtreg, re, or xtgee) is most appropriate for my analysis, I am trying to estimate coefficients for xtgls under both the homoskedasticity and hetero assumptions. When I run this model with the hetero option, I get very high z-scores (>30) and a significant effect on a term that is insig in all other models.
Also, when I attempt to run lrtest comparing the hetero and homoskedastic models I get an error that reads "hetero does not contain scalar e(ll)". I read that one way to address this is to add option igls, which supposedly gives the same coeff as the model without the igls option. However, my model will not converge with the igls option. I thought these odd results for the hetero xtgls model could be because some time invariant variable was miscoded (i.e. person coded as female = 1 for one year and female = 0 for another year). I checked my 2 ivs and this is not the case. I can't figure out what else could be causing this.
So my specific  questions are:

Why would I be getting this error - "hetero does not contain scalar e(ll)" - for the lrtest comparing the homo and hetero models? What does it mean?
Below is my stata code:

xtgls continuous_DV IV1 IV2 IV1xIV2,  i(person_id) panels(hetero)
estimates store hetero
xtgls continuous_DV IV1 IV2 IV1xIV2,  i(person_id)
local df=e(N_g)-1
disp `df'
lrtest hetero ., df(`df')
I ran xttest3 which indicated errors are hetero.

Is igls an appropriate work around for the error I am getting following the lrtest ("hetero does not contain scalar e(ll)")? If so, what could be causing this model with the igls option not to converge? Below is the code:

xtgls continuous_DV IV1 IV2 IV1xIV2,  i(person_id) panels(hetero) igls
Answer: In Stata,
the xtgls command does not estimate a log likelihood because it is not maximum likelihood estimation. So you cannot get a log-likelihood test out of that model.  To get a log-likelihood, you need to use the setup you had above but instead use the igls option.  That is an appropriate workaround and is entirely appropriate; I don't think you need to start by slashing your dataset.
Alternatively, you can use a different estimator.  GLS is appropriate when you have few, wide panels.  If you have really short panels (only a couple years per individual), you should probably use something like xtreg.
http://www.stata.com/support/faqs/statistics/xtgls-versus-regress/
Comment: Good catch getting to the heart of the matter.


How do I get 3 stars in Mario Kart 7?

Question: How do I get 3 stars in Mario Kart 7? I have got 3 stars in the 50 and 100cc races, but I can't seem to get it on Mirror Mode and 150cc. I have also seen many other people ask about this, and the answers are always different. Does anyone have a legit answer?
Answer: Searching on gamespot here is the answer i can find.
Its mostly theories but it seems to be related to

at least getting 40 points
not falling off stage
not going offroad

I would guess the first one is most probable, the second one is possible, and the third I have doubts about (it would require them to program a huge thing that checks if you are on or offroad and that seems a lot of work for an accessory thing like stars completion. But I'm going via feeling right now.)
Also, it seems that this question is a duplicata: What's the formula for getting 3-stars in a cup?
Answer: Firstly, you need a good positioning.
According to NintenPedia:

Yeah, Metal Mario, B-Dasher, Red Wheels, and Peach's Parasol is the best combination for no item races. But I think Daisy, B-Dasher, Red Wheels, and Peach's Parasol is the best combination for item races, as this combination is strong in both acceleration and speed.

You need to avoid items as well, giving you a better chance to get 1st place, therefore, drifting can help too.

Secondly, you need the best car for 150cc, meaning, that you need the fastest car, but you need to be careful if you are on a falling map.
According to Reddit, these are fastest cars:

In regards to karts; yes, the bodies with the highest speed are Zuchinni, Blue Seven, Growlster and B Dasher.

Last of all, you need a good character.
According to IGN, Rosalina is a decent character:

Rosalina has an advantage bonus for weight, and for speed and off-road.

Due to all of these tips, you should be able to get 3 stars in Mario Kart 7 150cc.
Answer: You need to get 1st in every race (which is hard sometimes) You also need to stay on road as much  as possible. Try not to go out of bounds. This has worked for me. It will hopefully help you (:

How do I get 3 stars in Mario Kart 7?


Does the angled parking scheme of London City (LCY) increase the number of aircraft that can be parked in the small apron?

Question: While going through some articles and videos, I chanced upon a video on LCY and was surprised to see that, unlike in Dortmund, LCY has aircraft parked diagonally. Does this increase the number of bays that the airport can have in that little space, or is there any other reason other than the one mentioned here?
Answer: The main reason for the diagonal parking is so that the airplanes can taxi up to and away from the stands without tugs. LCY has a lot of airplane movements for a small space so the parking is designed around getting airplanes in and out as quickly as possible: airplanes taxi in and park diagonally away from the terminal building so when they are ready to leave they power straight out to the taxiway. Note this is only possible because they don't have any jetways, passengers walk to and from the airplanes.
Comment: I like flying from LCY, you can show up 40 minutes before your flight and make it easily with time to spare.
Comment: note for the curious: ALC also has this system for its remote stands. AMS on the other hand has them so aircraft can drive straight through most remote stands so don't need a tug either.
Comment: ... unlike AMS, where the plane has to leave the gate 40 minutes before the flight :( Seriously, it's such a small country, how can you spend so much time driving through fields?
Comment: My airport has jetways and the airplanes taxi out under their own power. Of course that's possible because there are (count 'em) a whole TWO jetways, and they're around the corner of the terminal from each other, so there's nothing in the way as they power up and taxi to their right.
Comment: @MSalters That's only if you fly with the cheaper airlines that get sent all the way to the Polderbaan. Schiphol typically always uses a second runway for departures together with the Polderbaan, so half of the departing flights skip the scenic trip. (But yeah, sometimes you might as well stay on the train and fly from Rotterdam instead.)
Answer: The advantage of diagonal parking at LCY is that it requires a narrower portion of the tarmac thereby allowing for adequate area for the width of the taxi-track.
The terminal charts Ground Movement instructions emphasize that final parking and taxiing out can only be done with guidance from  Marshaller - this indicates that standard clearances for wingtips and other extremities may not always be available, i.e. 'pilot judgement' alone, from the cockpit, is not enough to ensure safe maneuvering.
Her are some extracts from the eAIP for London City Airport:

Pilots are requested to use minimum power when manoeuvring on and off
parking stands . . . .
Parking: Pilots should
self-manoeuvre their aircraft on to the appropriate stand lead-in line
(as directed by ATC) and approach the stand as closely as possible.
Direction to the final parking position will be provided by
marshallers. Under no circumstances may aircraft enter a stand without
guidance from marshallers.
Under no circumstances may aircraft self
park without guidance from marshallers'.
GA Apron: Pilots will be
directed by ATC to taxi to the Jet Centre. Pilots must then follow the
marshaller's instructions for parking.
To ensure adequate wing tip
clearance is maintained from adjacent stands, it is imperative that
pilots follow the lead-out markings on all stands.
If the aircraft is not adequately positioned on stand the pilot should
proceed as directed by ATC. Prior to undertaking the manoeuvre, in
order to re-position onto stand, the pilot must request permission
from ATC to enter the taxilane and advise ATC if the aircraft is
unable to follow the stand lead-off line. Only once permission has
been granted by ATC shall the pilot commence the movement into the
taxilane.

Just shows that space is really tight. So to complete the  answer to your question, sometimes the need for a certain disposition and use of the area is not just for maximising the number of parking slots, but it could have been a larger picture imperative - done to enable the implementation of the project at all in the limited area  and disposition of usable land between the main road and river.


What is the easiest way to share photos in their original format?

Question: My family in law has some wonderful pictures on their android phones. I'd like to use these in a printed photo album. Currently I only have the pictures at Whatsapp quality.
What would be the easiest way to exchange the original picture files?
Answer: This question could have many solutions. I personally prefer cloud services for a bunch of reasons (based on personal experience) :

Easy sharing, all you need to do is just share a link to the folder to where the photos are stored.

Content upload /download can be tuned with configurable permission rights. This is useful to prevent accidental deletions.

No loss in quality - original quality can be retained.

Depending upon your privacy concerns, you can go with suitable cloud services or even host your own cloud.

Some cloud services even offer cloud to cloud backup, so one need not be tied to the same cloud service. This also doubles up as cloud backup.

Easy download to PC where pictures can be edited, sorted, categorised published.

No need to download the entire library just to view. One can view them in cloud itself but the experience may be constrained (options to view such as slide shows may not be available - I haven't researched this).

Offers client services on Android, Windows and other operating systems besides web based services that can be accessed through any web browser.

Arguably cost effective.

These are some reasons that come immediately to my mind, since I am  heavily invested in similar activities, only difference being instead of photos, it is audio talks. I am no way related but the cloud service that meets our group needs best is Pcloud


How can I fill the page when printing an MS word document with comments

Question:
I have a word document with comments. I wanna print it with the comments, but when I try, the document and the comments pane are shrunk, and do not fill the A4 paper properly (check photo). Tried changing the paper size from word, it went horribly. Is there any solution for this problem? No need for it to be in Word.
If not, is there a way to present the comments inline, just pushed by a level (like in reply messages?)
Thanks in advance!
Answer: You get this result while printing with comments because Word tries to fit each original page to a single page while printing.
You can fill the paper better and get a more readable printout if you change the document's orientation from portrait to landscape before printing it out. This would cause both the appearance and pagination of the printed document to be different from the original but the paper would be better filled and the printout would be easier to read. You can change the document's orientation back to its original after printing it out.
You can change the document's orientation to Landscape either from Layout -> Orientation -> Landscape or File -> Page Setup (Page Attributes) -> Orientation. There is more information on this in this MS Word support page if you need it.
Answer: From the menu
File > Print
up pops a dialog box.  In the third field, which starts with 'Copies and Pages' change to 'Microsoft Word'.  Then you find another input field labelled 'Print What', select 'Document', et voila.
I'm running Word 16.66 on MacOS 12.3.1.


How to know if a thick lense system is divergent or convergent

Question: I know that the sign of the effective focal lenght (f) of a lense will determine if a that lense is divergent(f<0) or convergent(f>0), but with a system made of a combination of thick lenses and thin lenses, that no longer holds true, so how do i know if the system is divergent or convergent? I have heard that it has to do with the principal planes,but i was not able to understand why or how.
Answer: This method does not use the concept of principal planes, but can be used as a way to find if the system behaves as convergent or divergent
You may try making an image of an object kept at infinity, by the combination.

If the image formed is real, and the image is formed in from of the last - the combination acts as convergent.

If the image formed is virtual, and behind the last lens - the combination is divergent.

This method might be calculation wise a bit long, but it'll work.


How do I add a document to mongodb with monger and Clojure?

Question: I have never used MongoDb before, nor have I used Monger before. I am working on a Clojure app. I simply want to be able to add one document, as an upsert. This is some of my code:
<code>(defn convert-data-to-be-persisted [session-data]
  (convert/to-db-object session-data))

(defn persist-data-to-database [converted-document-to-persist]
  (mc/update "timeout_discovery" {:sessions converted-document-to-persist} {} :upsert true))
</code>
I am using monger:
http://clojuremongodb.info/
The println and timbre/spy statements I have are printing this data to the terminal output:
in persist-data-to-database:  { "serverUsed" : "/127.0.0.1:27017" , "updatedExisting" : false , "upserted" : { "$oid" : "510680444077296acfa67d6b"} , "n" : 1 , "connectionId" : 4 , "err" :  null  , "ok" : 1.0}
If I log into MongoDb at the command line, it seems the collection remains empty:
db.timeout_discovery.find()
{ "_id" : ObjectId("51017c5fa86c7bcc3d423c4d"), "timeout" : "discovery" }
There is one document, but it has nothing in it except "timeout" and "discovery".
I looked here to try to figure out what to do, but every variation that I tried failed:
http://clojuremongodb.info/articles/updating.html
This line:
<code>(convert/to-db-object session-data))
</code>
returns this document (but I shorten it here, as the original is long, bloated with more of the HTML that you see here):
in get-data-to-be-persisted the document to persist is:  { "e6e20a2c-cb46-498c-b2f2-743e2b38b917" : { "itinerary-as-string" : "\n    \t\n    \t\thttp://www.super.com/mexico/bars/2012-food-drink-award-nominees-best\" class=\"fn given-name url\">2012 Food & Drink award nominees: Best new beer bar\n    \t\t    \t\t                                                                            \n            \n                            Voting is now closed\nSEE RESULTS HERESee more in Restaurants + Bars                                                    \n                 \t\n    \t\n                                                                                http://www.super.com/mexico/bars/2012-food-drink-award-nominees-best-new-beer-bar\">http://media.super.com/images/100131935/150/113/image.jpg\" />           \n                    \n                    \n    \t\n    \t\thttp://www.super.com/mexico/sex-dating/summer-dates-in-mexico-bars-and-restaurants\" class=\"fn given-name url\">Summer dates : Food-and-drink dates at MEXICO bars and restaurants\n    \t\t    \t\t                                                                                Sex & dating\n                                            \n            \n                            dinner or drinks at MEXICO hot spots on these summer dates.  If you're going to woo a food-obsessed partner, go beyond the standard dinner and a movie this season. Check out five food-and-drink-focused summer dates at New York...                                                    \n                 \t\n    \t\n                                                                                http://www.super.com/mexico/sex-dating/summer-dates\">http://media.super.com/images/100453911/150/113/image.jpg\" />           \n                    \n                    \n    \t\n    \t\thttp://www.super.com/mexico/restaurants/organic\" class=\"fn given-name url\">Organic\n    \t\t    \t\t                                                                                Food & Drink, American, Asian\n                                                \n                                                                                \n                        \n                            $\n                        \n                    \n                                                                                \n                            \n                                        \n            https://foursquare.com/intent/venue.html\" data-context=\"vcard-Content-Venue-50137\">Save to foursquare\n        \n    \n            \n                            Tribeca fro-yo fanatics can satisfy all their wholesome cravings at the second location of this organic health-food bar. The bright takeout shop—outfitted with wood paneling and a white-and-green counter—also serves fresh-squeezed juices and smoothies,...                        Edit                            \n                         \t                        \n                 \t\n    \t\n                                                                                http://www.super.com/mexico/restaurants/organic\">http://media.super.com/images/100461855/150/113/image.jpg\" />           \n                    \n                        \n            \n                                            \t        \n                                                                275 Greenwich St, (between Murray and Warren Sts), New York, 10007\n                                \t        \n    \t    \t        \n    \t        \tAverage course: $9. AmEx, Disc, MC,...    \t        \n            \n            http://www.super.com/mexico/restaurants/organic\">\n            \t\t\t\t\t\t\t        \t    \t            \tGet info\n    \n        \n\t\t    " , "username" : "email@example.com" , "created-at" : "2013-01-28T13:41:53" , "ip-address" : "10.0.1.53" , "cookie-id" : "timeout-kiosk5903266" , "questions-and-answers" : { "what-are-you-interested-in" : [ ":food-and-bars"] , "who-are-you-with" : [ ":adults"] , "what-is-your-email" : "email@example.com" , "how-long-are-you-in-new-york" : ":two-weeks"}}}
So, why would this not save?
I am not seeing any errors in the terminal output, though if there is an error, I would like suggestions about how to capture it and see it.
If there are no errors, do I simply have the syntax wrong for MongoDb or monger?
Comment: Third argument in `update` is new object you want to set. You pass empty map as new object. Is it correct?
Comment: I should have explained all the variations I had already tried. I did try swapping the argument order several different ways. None of that makes a difference. The document does not arrive in MongoDb, and I do not see to ever get an error.
Answer: Author of Monger here. What environment do you run this code in? It may be an authentication
issue. Monger uses "safe" write concern by default so writes will never fail silently
(as far as Monger goes, you still have to handle exceptions). According to the server response
you've posted, the write succeeded just fine (you can see "ok": 1.0 in the response document).
Please refer to Monger's documentation if you have questions about function arguments. I highly recommend starting with the Getting Started guide in the REPL.


Magento Multi-Website Setup Question

Question: Is it possible to have 2 different websites with the same products, categories, and currency; but different shipping methods and payments?
Answer: Short answer is yes.
You can add a product and make it visible across multiple websites (in the same install of magento, using multistore)
Payments and shipping methods can be set up by website (not store view, although you can change the description by store view)

Magento Multi-Website Setup Question


Knob removal on dresser

Question: I have a dresser that I am trying to swap the knobs on. It's a 5 piece drawer, and I can get the screw out of the knob, but the knob doesn't come off. I can (hopefully) gorilla it off, but I want to be sure it's not common to attach the knobs in some way other than a screw.
Comment: Might just be sticky.  Maybe try low heat(hair dryer).  Did the screw seem loose/jumpy when taking it out?  Possible the screw was stripped and someone used glue to hold the knob on, but betting on sticky.
Comment: Maybe try giving it a love tap with a rubber mallet (or 2x4)?
Answer: A screw through the drawer and into the knob is the only way I've ever seen this done. The knob was probably installed before the finish was completely dried and firmly stuck to the wood. Work it back and forth and it should break free. Maybe tap it gently with a  mallet.
Based on some good comments, cutting around the knob with a small blade might prevent pulling off some of the finish.
Comment: I'd run a sharp knife or chisel around the joint between the handle and the drawer face to break any surface connection, and then tap it from the side with a softer hammer.  Cutting will reduce the chance of splintering (if glued) or tearing a nurny in the finish.
Comment: @Criggie I agree.  Just about any X-ACTO knife is perfect for this task.
Comment: This was exactly what I needed to do. I removed the screw and with a small tap, they came right off. It pulled a little of the finish off, but of course that is covered by the new knob. Thank you!
Comment: 'Pulled a little finish off.' This answer would be a lot better with the instruction to cut around the knob. That way, the next person doesn't also pull a little (or a lot of) finish off.
Answer: Your drawer has two pieces at the front: a structural piece, similar to the sides, and a decorative front piece with the finish. The knob is likely held on with a screw.  If you can't see a screw behind the knob then it was probably attached to the finished front before the finished front itself was attached, so the screw head for the knob is between the two pieces.
Are there a couple of screws inside the drawer holding the finished front on? If so, removing these will let you unscrew the knob. If the finished front is glued on,  it will be more difficult.
Comment: Note, the OP says he already removed the (machine) screw.

Knob removal on dresser


How to install TestNG in NetBeans?

Question: First I added the dependency and repository to my project's maven pom.xml file:
<repositories>
    <repository>
        <id>jcenter</id>
        <name>bintray</name>
        <url>http://jcenter.bintray.com</url>
    </repository>
</repositories>

 <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.10</version>
    <scope>test</scope>
</dependency>

and did a NetBeans "Clean and Build".  It downloaded TestNG stuff but project code still showed it couldn't find the classes it needed. I can see that
C:\Users\Greg.m2\repository\org\testng\testng\6.10\testng-6.10.jar exists.  If I open that jar file I can see that org\testng\Assert.class exists.  Why can't NetBeans find it?
Since that failed, I followed instructions for setting up TestNG Environment here:
https://www.tutorialspoint.com/testng/testng_environment.htm
My TESTING_HOME environment variable is set to
C:\Users\Greg\Projects\TestNG

My CLASSPATH variable is set to
%CLASSPATH%;%TESTING_HOME%\testng-6.10.jar

Yes, that jar file exists there.
I open up a new command shell and navigate to
C:\Users\Greg\Projects\Enventive\en360\src

where there exists testng.xml
I then issue the following command per the TestNG author's doc
java org.testng.TestNG testng.xml

but get

Error: Could not find or load main class org.testng.TestNG

In NetBeans 8.2, I can create a TestNG class using
File>New File...>Unit Tests>TestNG Test Case

It produces test code but all the annotations have errors due to the error on the import line
import static org.testng.Assert.*;

which states

package org.testng does not exist

If I attempt to install the TestNG Plugin in NetBeans by downloading Maven TestNG Support and then trying to install it using
Tools>Plugins>Downloaded>[navigate to downloaded org-netbeans-modules-testng-maven.nbm]>Install

It fails to install with this error:

Some plugins require plugin Maven Embedder to be installed. The plugin
  Maven Embedder is requested in version >= 2.54 but only 2.52.1 was
  found.  The following plugin is affected:       Maven TestNG Support

A search for "Maven Embedder" in "Available Plugins" tab, or on the web finds nothing.
Comment: tutorialspoint more often than not is worse than no tutorial at all.
Comment: Don't use a global `CLASSPATH` variable. That has been deprecated since Java 1.5. You need to add the dependency to TestNG into your Maven `pom.xml`
Comment: I did that first thing.  I will edit my post.
Answer: The problem was that the scope tag needs to be "compile", not "test".  The author's doc specifically says to use "test".  Took me all day to find the solution here :-(
Maven Compilation error [package org.testng.annotations does not exist]
While that fixed it for NetBeans, it did not for the command line.  I managed to get that running by specifying the actual jar file in the -cp (classpath) parameter, like this:
java -cp C:\Users\Greg\Projects\MyCompany\MyProject\src;c:\users\Greg\Projects\TestNG\testng-6.10.jar org.testng.TestNG testng.xml

where the first path is the location of the testng.xml and the second path is to the jar file.  Once again the author's doc is faulty in that it only shows a path to the folder containing the testng.xml.
Although this does find both the TestNG class and the testng.xml, an exception occurs:

Exception in thread "main" java.lang.NoClassDefFoundError:
  com/beust/jcommander/ParameterException

That seems strange because my testng.xml does not contain any parameters.  (Maybe it should?)  Anyway, looking in the jar file, indeed, there is a com/beust but no jcommander folder.
I downloaded the latest testng-6.14.3.jar and there is no com/beust/jcommander in that one either.
Here is my testng.xml. Can anyone can see a problem?
<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="E360 Test Site" verbose="10">
  <test name="Test Analysis Results" preserve-order="true">
    <classes>
      <class name="test.java.core.EnProjectIT">
        <methods>
          <include name="testCreateTables" />
        </methods>
      </class>
    </classes>
  </test>
</suite>

To overcome this problem I added the following dependency to my pom.xml:
<dependency>
    <groupId>com.beust</groupId>
    <artifactId>jcommander</artifactId>
    <version>1.48</version>
</dependency>

Then added it to the classpath on the command line like this:
java -cp C:\Users\Greg\Projects\Enventive\en360\src;c:\users\Greg\Projects\TestNG\testng-6.14.3.jar;c:\users\Greg\Projects\TestNG\jcommander-1.72.jar org.testng.TestNG testng.xml
Now I get the following error:

Cannot find class in classpath: test.java.core.EnProjectIT

Ok, so I need to add the compiled class location, not the java code location to the classpath.  Now it looks like this:
java -cp C:\Users\Greg\Projects\MyCompany\MyProject\src;C:\Users\Greg\Projects\MyCompany\MyProject\target\classes;c:\users\Greg\Projects\TestNG\testng-6.14.3.jar;c:\users\Greg\Projects\TestNG\jcommander-1.72.jar org.testng.TestNG testng.xml
New error is:

Cannot instantiate class test.java.core.EnProjectIT Caused by:
  java.lang.NoClassDefFoundError: org/kohsuke/args4j/CmdLineException

Seems I am just kicking the can down the road.  Maybe I need to put my whole .m2 repo in the classpath?
Ok, I found a clever way to fix all these dependency issues.  Since NetBeans was able to build the project ok, it must have a way of gathering all the jar files into its classpath.  Sure enough, I found all of them in one location:
C:\Users\Greg\Projects\MyCompany\MyProject\target\ProductSnapshot\WEB-INF\lib*
I added that to the -cp which now looks like this:
java -cp C:\Users\Greg\Projects\MyCompany\MyProject\src;C:\Users\Greg\Projects\MyCompany\MyProject\target\classes;C:\Users\Greg\Projects\MyCompany\MyProject\target\ProductSnapshot\WEB-INF\lib\* org.testng.TestNG testng.xml

Well I think I'm very close now.  Next error says it can't find a project file.  It looks like I need to run the program from a different directory.

java.io.FileNotFoundException:
  C:\Users\Greg\Projects\MyCompany\MyProject\src\WEB-INF\EnDatabaseTest.properties
  (The system cannot find the path specified)

It's appending WEB-INF\EnDatabaseTest.properties to the startup directory so I will make the startup directory C:\Users\Greg\Projects\MyCompany\MyProduct\WebContent
I put the testng.xml in that directory, cd'd to that directory, and ran this:
java -cp C:\Users\Greg\Projects\MyCompany\MyProject\WebContent;C:\Users\Greg\Projects\MyCompany\MyProject\target\classes;C:\Users\Greg\Projects\MyCompany\MyProject\target\En360-1.0.0\WEB-INF\lib\* org.testng.TestNG testng.xml

And it worked!

How to install TestNG in NetBeans?


How to optimising caret for sensitivity

Question: I am currently using caret which optimises for accuracy. Is it possible to optimise for sensitivity. I see documentation mentioning that metric = 'roc' has been used, but sensitivity does not appear to be one of the options.
Answer: Probably.  It depends on what you are doing exactly, and in particular which summaryFunction you are using.  If it's twoClassSummary for common binary classification then you should be able to specify metric='Sensitivity'.  If that's not the case you also have the option of overriding the default performance summaryFunction with your own implementation that calculates the metrics you desire.
I highly recommend reading through the documentation at http://topepo.github.io/caret/training.html#control
Answer: As long as you have:
summaryFunction = twoClassSummary

in the trainControl object that you have set, then you can set:
metric = "Sens"  # or "ROC" or "Spec" whichever you desire

when you are fitting the model:
control <- trainControl(method = "repeatedcv", number = 5, repeats = 5,
                        summaryFunction = twoClassSummary, classProbs = T,
                        savePredictions = "final")

logreg.fit <- train(Class ~., data = training_data, method = "glm",
                    family = "binomial", trControl = control, metric = "Sens")

Max mentions in his book that tuning models for sensitivity may reveal improvements in this metric by tuning models towards its optimisation, i.e. you may be able to fit a model with improved sensitivity that has very minor, if any, trade offs in specificity. This is in the particular case of class imbalance in the data.

How to optimising caret for sensitivity


Why do politicians make so much money?

Question: Senators, ministers, presidents, .... all these people earn a lot of money, and not just during their work: when the president of the US leaves office, they will receive about $200,000 annually as a pension.
Why? What is the point of giving so much money away? I understand it is not much compared to what they could make elsewhere given their new-found network, but it is still a lot of money compared to an average American.
Politicians say that they do what they do because they want to see their nation prosper. If true, why would they willingly take so much money away, as opposed to letting it stay in the budget?
The only argument I've ever heard of is that the high salary is needed to attract the best. This seems contradictory: the high salary will not attract "the best", the high salary will attract everyone, and the best will be lost in the ensuing mass of people all claiming to be servants of the country.
Comment: Don't look up CEO salaries if 200k shocks you.
Comment: If you think that's a lot of money for a public official, you probably shouldn't look up how much MORE wealth they generally accrue while in office.
Comment: Because they can make so much more money doing something else, for example, look at how much a certain former presidential candidate makes for a single speaking engagement.
Comment: One of the de facto laws of compensation in a bureaucracy is that nobody can get paid more than the guys at the top and that applies to the federal government too. So, caps on politician and Presidential salaries are de facto caps on the pay of senior civil servants running Fortune 500 sized organizations and highly skilled professionals. If you don't pay the President enough, the pay of senior generals, senior cabinet department executives, top lawyers, physicians, scientists, economists and everybody else is too low to hire good talent and they don't have the perks that politicians do.
Comment: Where did I say it shocks me? I literally just said in my post that I recognize they can earn much more money elsewhere. That's beside the point. They are not in it for the money, or at least that is what is being claimed, so it is a natural and obvious question to ask "why do you make so much of it, then".
Comment: They have the most important jobs in the country, naturally they should be paid well.
Comment: The last paragraph is illogical.  "The best" don't get lost in the mass of people when they apply.  To think that is a contradiction of "yeah they are the best, but they are the same as everyone else, so they get lost in the mass", they don't get lost... because they stand out above everyone else, because the premise is they are the best.  To put another way, to offer low compensation is to screen out the best from even applying, when they could do better elsewhere.
Comment: @user1169420,  "The best" at governing would not be primarily or even secondarily motivated by compensation.  The middling and worse, on the other hand...!   But it's a moot point, since the US's optimistic, trusting citizenry and it's policy of virtually unlimited campaign advertising budgets insure that only the most money-conscious candidates, (*i.e.* not the best), are viable.
Comment: @user1169420 You're assuming that the best in governing, leading and legislating would also be the best at self-promotion....Those are completely different skills. While the last paragraph in the question may not have the best phrasing, the point is quite accurate; People who are on TV are not necessarily among the best in their fields; They're just the best ones at putting their names out there.
Comment: @ohwilleke Generally true, but there are federal employees who make more than the President. The highest office need not be, and indeed is not, the highest paid.
Comment: "The best" don't typically apply for jobs beneath their worth.
Comment: See also https://politics.stackexchange.com/questions/41281/how-does-politician-work-as-a-job-career
Answer: There are primarily two reasons: competitiveness and corruption.
Competitiveness
You did hit the nail on the head - part of the reason is competitiveness. Public offices compete with private jobs for the same people.  In order for public office to be an attractive prospect, the salary needs to be competitive with the kinds of jobs they would be able to hold if they weren't in office.

This seems contradictory: the high salary will not attract "the best", the high salary will attract everyone

Part of this is a misunderstanding: it isn't that a high salary attracts only the best. It will attract many people, but it is required to attract the many of the most talented people.  Inadequate candidates will be screened out by the political process: many aren't eligible for office, many more will not receive the support of their party, many will fail to attract enough donors to run an election, and of course many will fail in their primary/caucus/election.
In short: in many cases this salary is appropriate for the kinds of skills that elected officials are expected to have. The pay needs to be this high to lure in these candidates.
Corruption
Having a high salary helps prevent corruption.  If that sounds strange, let me introduce you to the fraud triangle.

For our purposes, the important element is pressure.  A person commits fraud (or engages in corruption) when they are under financial pressure. By paying a high salary, a person is insulated from financial pressure and the risk of fraud is reduced.  Additionally, there is an idea that an elected official should not have other earned income - that could create a conflict of interest while in office. That increases the importance of offering a decent salary.
It isn't that high
It's also important to put that $200,000 salary in perspective. For many executive or professional people, that is not a particularly high salary.
According to the Bureau of Labor Statistics:

The average CEO makes $185,000 per year.
The average lawyer makes $136,000 per year.
The average general manager makes about $120,000.
The average physician makes about $200,000 per year.

And these are averages.  A President or Congress person (and likely state officials) are above average achievers, and likely to be earning more than average in their field.
Comment: @Bobson I would guess that the average CEO numbers (1) doesn't include equity compensation (which usually makes up the majority of their compensation) and (2) includes CEOs of both big and small companies.
Comment: I find that "average CEO" number quite surprising.  Do you know if it includes owners of small/mid-sized privately held businesses?  That would explain it, even though I wouldn't think of those as a "CEO".
Comment: You can find their description of a CEO [here](http://www.bls.gov/oes/current/oes111011.htm).  That estimate appears to be lowered by some state and local government employees with this job description.
Comment: That looks like what it is.  The averages when broken down by industry look much more like what I'd expect (the $200,000 range).  Thanks for the link.
Comment: I would agree. Equity agreements are not a part of salary, so it's likely not included here. This would be true of all non-wage/salary benefits.
Comment: The "fraud triangle" URL links to a graphic with only *three* visual elements; it does not explain the graphic with four elements in this answer.
Answer: Theory: Politicians in a democracy need to earn enough to be financial independent. Otherwise they would depend on other sources of income during their mandate. Those sources of income would then have control over the politician and could exert influence on their decisions.
That income should be large enough that a politician is not susceptible to bribery. So it should be high enough that they can afford anything they and their family reasonably need to be happy.
Building a network to secure a future income is not what a politician is supposed to do during their mandate. First, they are supposed to invest their time into their political work, not into forming connections. Second, being forced to secure their future income during their mandate motivates a politician to work for the interests of those who will give them that income when their mandate is over, not in the interest of their voters.
Reality: The people who decide on the wages for politicians are the politicians themselves. If you could set your own wage, would you reduce it?
Budget considerations are usually not relevant, by the way. For example: A US congressman makes $174,000 a year. That's $93 million for all of congress per year. The budget the US congress decides on every year is $3.7 trillion.
Comment: Also I would add that these salaries are large, but we aren't talking CEO of a fortune 500 large. Since these are very senior positions you can argue that it is a reasonable salary for them.
Comment: The theory seems suspect (leaving aside whether it matches reality) because financially independent!=upper-middle-class salary.
Comment: Federal departments (and maybe some state ones) have revenues larger than most fortune 500 companies. So maybe that is a good comparison.
Comment: The flaw here is that as income goes up, social status markers become proportionaly more constricting.  Wealth suffers a formidable set of peculiar desperations -- who they can marry, (or safely associate with), what their peer group tolerates, the more there is to lose the greater danger any secret holds, dress codes, the walls have ears, gods don't bleed, *etc.*

Why do politicians make so much money?


How safe are PostgreSQL triggers against attacks?

Question: in my PostgreSQL database I setup some triggers to prevent DELETE and EDIT operations (the triggers make sure that these operations lead to nothing). However, I'm wondering how safe these triggers are? Is it possible to circumvent these triggers and delete data by trying to illegally hack the data?
Answer: Security in ANSI relational databases is normally based on layers and one of those is role based access.  A business case that no one will ever need to delete or edit data in some tables will probably need to be revised when someone makes an oopsie and bad data is entered.
Any code that is written whether it's in a trigger or stored procedure has a chance of being misused but this requires access. A better solution than writing triggers that prevent basic operations on data is to control access and permissions by creating roles for each type of user and granting permissions appropriate to those roles.
Answer: They are not very safe to do what you want as they can be disabled/deleted if the user has the correct privileges. If you are wanting to prevent users from updating/deleting data you should do that by preventing them from having the permissions to perform those actions in the first place. If a user is able to "hack" to get those permissions they will be notified of the triggers that prevent updates/deletes and either disable/delete those before doing what they want to (and what you where trying to prevent)
Answer: I'd say that such a trigger is absolutely safe provided you take care of two things:

The code has no bugs.
The user is no superuser and does not belong to the role that owns the table.


Does QGIS preserve Feature Class Relationships (1to1 or 1to many or Many to many relationships)?

Question: Does QGIS preserve Feature Class Relationships (1to1 or 1to many or Many to many relationships) and can the related attributes be clicked and viewed through the identify feature tool?
Comment: Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our [faq].
Answer: Sort of. It doesn't transfer them from an ESRI relationship class in a geodatabase, but you can relate them in a QGIS project. Here is a good link that helped me with my project. http://blog.vitu.ch/10112013-1201/qgis-relations
I haven't yet found a way to maintain that relationship from Arcmap to QGIS, but the information contained in this website allowed me to relate my data table within a QGIS project.


Can my Canon EOS 5D Classic work with a Vivitar lens?

Question: Will a Vivitar 75-205mm 1:3.8 lens work with the Canon EOS 5D Classic?
What mount lenses can I use for my camera?
Comment: Does this answer your question? [Can I use lens brand X on interchangeable lens camera brand Y?](https://photo.stackexchange.com/questions/62000/can-i-use-lens-brand-x-on-interchangeable-lens-camera-brand-y)
Answer: Your Vivitar 75-205mm 1:3.8 is probably on older manual focus, film era lens. The only way to use it with your 5D is to buy an adapter.
Do you know which mount your lens is designed for? Look for markings near the mount like "N/F", "C/FD", "PK", "OM" etc.  Nikon, Pentax, Olympus, and M42 are some mounts that can be easily adapted. Some of the other mounts (Canon FD and Minolta MD) require an adapter with corrective optical elements that degrade the image quality.
More info here: http://www.bobatkins.com/photography/eosfaq/manual_focus_EOS.html
Here is an example of that lens with a Canon FD mount.

Here is the Nikon version
Answer: Canon EOS dSLRs can used lenses from the following six film SLR mounts with simple ring adapters:

Leica R
Contax/Yashica
M42
Nikon F
Pentax K
Olympus OM

Other mounts are shallower than the EOS mount, so would require an optical element (teleconverter) in the adapter to achieve focus to infinity, since adding to the lens's distance from the sensor plane would be like using a macro extension tube.  Rangefinder lenses cannot be adapted to dSLRs.
See also: Can I use lens brand X on interchangeable lens camera brand Y?
In addition, the lens needs to have a manual aperture setting ring on it, or there's no aperture control, since manual lenses don't have electronic communication, and most lower-cost adapter rings cannot translate electronic communication to pass to the camera Upshot: no control over the lens from the camera body for focus or aperture: so no autofocus, no wide-open metering, no exposure modes other than M or Av. The 5Dc, however, does do accurate stop-down metering. And some "chipped" adapter rings can at least add EXIF information for the focal length and max. aperture of the lens.
One last caveat, the mirrorbox on the 5Dc may actually hit the rear element of an adapted lens. Some folks who adapted a lot of lenses would "shave" the mirror (grind it down) to avoid this. It didn't happen on most lenses, but it is another possibility to be aware of.


Entity Relationship Diagram for Hotel

Question: I tried creating an ERD model for hotel reservation and billing. Are the cardinalities correct, I'm a bit confused about that. And are there any attributes that are not in the right place? If someone could help me and go over this I would appreciate it. Thank you.
Answer: This looks mostly complete, though the BookingID field in Guest seems a little pessimistic. What will you do if a guest wants to stay at the hotel again in the future? As you already have a relation between Guest and Booking via GuestID, you can probably remove BookingID from Guest. A similar thing can be done in Bill as, if you know the BookingID then you know the GuestID. So GuestID can be removed from Bill … if you choose, of course. You don't need to make either change.
Answer: You make [RoomNo] as PK,
so, [RoomNo]=1 can only assigned to [HotelCode]=H1
so, [RoomNo]=1 cannot assgin to new [HotelCode]=H2 -> violate PK of [Room] table
Answer: I would say everything looks great but you should remove fk from the guest for bookingid. And the connection between bill and the guest should not be there, as you can have those information via booking entity.
Answer: Yes the cardinalities look completely fine on this ERD.
I am a bit confused about the "Booking" to "Bill" cardinality (although this could be a gap in my domain knowledge on hotel operations).
In what instances would you have multiple "Bills" per a singular "Booking"?

Entity Relationship Diagram for Hotel


jQuery Scrollable Div for Mobile Websites

Question: I'm trying to create a jQuery plugin for a mobile website that turns a div container into a scrollable container.  I accomplish this by wrapping all the children that are inside the div container in another div container thats absolutely positioned.  Then I modify the top or left css styles of the inside div to simulate moving the text up and down or left and right.  I'm using touch event listeners to determine when to move the scrolling div.
However, I'm having some trouble setting the width() of my inside scrolling div.  Here's a sample of the code:
myObj.ready(function(){
myObj.css({ 'position' : 'relative', 'overflow' : 'hidden' }).wrapInner('
');
$('#scrollCntr').prepend("<img src='scrollBar.png' id='scrollBar' class='horizontal'");
$('#scrollCntr').height( myObj.height() );

if ( config.width <= 0 ) {
    $('#scrollCntr').children().each(function(){
        if ( $(this).css('display') == 'inline' || $(this).css('float') == 'left' || $(this).css('float') == 'right' ) {
            totalWidth += $(this).width();

            for( var i = 0; i < boxProps.length; i++ )
                if ( $(this).css(boxProps[i]) != "" )
                    totalWidth += parseInt( $(this).css(boxProps[i]).replace( /px/i, '' ).replace( /em/i, '' ).replace( /pt/i, '' ) );
        }
    });
} else {
    totalWidth = config.width;
}

console.log( totalWidth );
$('#scrollCntr').width( totalWidth );
console.log( $('#scrollCntr').width() );

});
In this case, config.width is set to 719 and myObj is the container div being scrolled.  I'm not really sure what the problem is.  I didn't have any problems with this in my demo, when my children elements where just images, but when I applied it to my mobile website, where the children elements where div boxes, its been having problems.  Perhaps the children elements aren't being loaded in time?  But that wouldn't explain why I can't set the scrolling div's width.  Its definately being loaded.  I have no idea what the problem is...
Comment: I think I found out what the problem is.  The container div is set to display: none until a certain action is taken by the user.  Therefore, it can set widths but it can't retrieve those widths.  Is there a way I can add an event handler to listen for when my container div is shown (display: block)?
Answer: Got it.  Found it on another question:
jQuery event to trigger action when a div is made visible


Where can I find all three words of Champion's Spirit shout?

Question: Falskaar adds one shout to the game called Champions Spirit. Where can I find all three words of Champion's Spirit shout in Falskaar?
Answer: It's in Ruins of Vizemundsted, Dragonbone Perch and Grimrott Grotto. The one in Watervine Chasm is broken.
Comment: @galacticninja Watervine Chasm end up in Vizemundsted. If you start in Watervine Chasm and follow the passage deeper you'll find a word wall that actually belongs to Vizemundsted. The other in Watervine Chasm is broken and has a lot of crates and boxes stacked into it.
Comment: What do you mean by "*The one in Watervine Chasm is broken*"? I'm pretty sure I found a word wall of the shout at Watervine Chasm. Also, do you mean that there are four word walls for the three words of the Champion's Spirit shout?
Answer: The three words of the shout can be found at: Dragonbone Perch, Watervine Chasm, and Grimrott Grotto.
Note that the Watervine Chasm word wall is not the one in the main central chamber (the first very large chamber you get to). It is in the large room in the third cell, right before the Dwemer ruins.
Source: Alexander J. Velicky's (Falskaar mod author) post at the Bethesda Forums - Falskaar Thread #2


Delete or straighten one of two anchor point handles in sketch 3

Question: How would you go about deleting or straightening one anchor point handle, while keeping the opposite handle intact?
Comment: do you mean the anchor handle?
Answer: I believe I know what you mean.

While drawing the vector path, you can force the "closest" handle to be retracted, if you press Cmd while you are about to create the next anchor point.
This is the only method I know of. I don't know if you can make this edit later, but I don't think you can.

Another method that comes to mind is to rely on the anchor points between straight anchor points to produce the curved line.

In this picture, the "straight" point basically means that I just clicked an anchor point there.
Answer: I missed a function sorry guys. Under the Pencil tool there is a Disconnected function, if you tap that you will be able to manipulate the anchor handels separately
Comment: You can disconnect the handles by pressing cmd while dragging or when you start to drag the handle. –– However, I would not recommend using this method. You can super easily generate bad corners this way. [Here's an example](https://www.dropbox.com/s/d4mr4ddy2dqdmbo/vector-tool-example.png?raw=1). ––– If you really wanna do it this way, I would recommend dragging the handle towards the next anchor point, instead of it's own anchor point. Although that's not always ideal
Answer: Sorry I don't have a fancy animation, but for others landing here, you can actually delete the 'inside handles' of any two points in a closed path:

Select the scissors tool and delete the line between two anchors
Press [esc] on the keyboard to exit the scissors tool
Double-clicking the shape to select it
Click the "Close Path" button in the top of the inspector window. This will 're-draw' the path segment you just deleted, except it will be perfectly straight (no handles). The handles on the other sides of the anchors will remain intact.

Note: If your path isn't closed to begin with, you can close it temporarily before you start so that the "Close Path" command works later (if you don't, you'll end up with two separate paths which can't be 'closed').
Cheers! Hope this helps someone :-)
[I'm using Sketch ver 46.1]


what determines bandwidth of a cable i.e. hdmi

Question: I recently bought a cheap 3quid hdmi extension cable for my oculus rift. It's been causing screen tear. I know what cables are compatible now but I'm wondering what affects the bandwidth of a cable?
Comment: If you have more than 1 signal wire, then crosstalk will degrade the dataeye, giving bit errors that may show up as lost line synchronization, thus the tearing.
Answer: If the wavelength of the signal you want to transport over the cable is short compared to the length of the cable (so many waves "fit" inside the cable) then we should consider the cable to be a transmission line.
There is more going on than just the bandwidth. To transport a signal properly through the cable the cable has to behave as a proper transmission line. Things that can go wrong are:

the cable attenuates the signal (very much related to bandwidth)
the characteristic impedance of the cable is not what it should be
the connectors do not match well to the cable causing a change in characteristic impedance which causes signal reflections

Since your problematic cables are extension cables it is very likely that the extra connectors cause reflections of the signal. Depending on what type of signal you're using (HDMI supports several data rates) these reflections can cause problems or not. For example it might be that at a lower resolution / framerate the cables work just fine.
Comment: ah that might explain why I can play space pirate trainer for hours and have no screen tear. but occassionally I would get screen tear when just on the oculus home screen which doesn't have alot going on but I bet it has a higher resolution. Thanks!


GetLocalizedLabel not working under Grouped Products

Question: I'm trying to extract 3 attributes for every associated product under a grouped product page.
I use a multistore Italian-English but if I use
<code> $stato_label= $_item->getResource()->getAttribute('stato')->getFrontend()->getLocalizedLabel($_item);
 $stato_value= $_item->getResource()->getAttribute('stato')->getFrontend()->getValue($_item);
</code>
Just the attributes value has been translated.
The label is still is not using the translation

I have already translated the labels on the backend
How can I get the translated image?
Thanks for help
Answer: Found the solution. The correct way to get the label is
<code>getResource()->getAttribute('attr')->getStoreLabel();
</code>