Continuous input problem in Hollow Knight

Question: I'm using an XBOne controller on OS X Catalina (i heard people on windows also have this problem sometimes). Every minute or two the keys suddenly stop responding until I pause-unpause the game. Please don't tell me to turn on native controller support (i have already done this and without that setting the game doesn't respond to the controller at all)
EDIT: none of the answers below actually helped.
Answer: Hollow Knight seems to have an issue with Xbox controllers in general. I've done some research and found the following articles:
https://steamcommunity.com/app/367520/discussions/0/135510669595742997/ :

Right click steam and open up "big picture". Once there, click the "gear" in the top right. Open up controller options, and enable xbox 360 configurations. Unplug your controller after you've saved it, and you're ready to go!* - This seemed to work for many people.

https://www.reddit.com/r/HollowKnight/comments/6h3ygw/strange_controller_issue/ :

I quit the game, opened Steam Big Picture mode, DISABLED the Xbox controller configuration and then quit Big Picture mode. The controls in HK were just about perfect and how I remember them from a week ago. I then turned OFF v-sync and that improved things even more.* - The issue was that buttons kept on triggering repeatedly

https://steamcommunity.com/app/367520/discussions/0/1735468061755004608/ :

enable "generic controller support" in settings then define layout, and you should be good to go* - This was from someone using an Xbox 360 controller emulator.
Answer:
Set your controller to enable pairing (For PS4 controllers, hold down the PS button and the Share button until the light on the rear of the controller).
Click the Apple logo in the top left corner of your screen.
Select System Preferences.
Click Bluetooth.
Click Connect.
Answer: For me what solved this was plugging the controller into the computer with a cable. No more loss of control and I feel like the response time is also better.
Answer: I found an easy solution.
Remap controller buttons as keyboard input. Remap the analog stick as keyboard arrows and all other buttons mirroring your keyboard setup.
After doing that I never had problems again.
Have fun.
Answer: I had this same problem.
What fixed it for me was switching to another controller.


What or where is "Foriaul"?

Question: An obscure word I have run across is "Foriaul". What is this?
Comment: Going out on several limbs here: this looks to be Dutch and the words (among them "Foriaul") set in different type seem to be names of Italian regions. I'd guess they mean Friuli: https://en.wikipedia.org/wiki/Friuli
Comment: This is not German!
Comment: Downvoted for not providing a source or link.
Comment: Looks like old Dutch, indeed. And Foriaul is probably Friaul, indeed, as described here: https://de.wikipedia.org/wiki/Friaul
Comment: @BjörnFriedrich I have found the same word in old German books, I just don't have a scan of them.
Comment: @Mac Yes, that looks right.
Answer: The text is not in modern German, sure. But at first glance this short excerpt looks like it might be an older form of German like Middle High German, Early New High German, low German, or perhaps some early form of Dutch.
The word used in this text is in a different typeface than the majority of the text. That is a first indication that it is a word of foreign origin, as it was customary to write pure German words in fraktur, foreign words in antiqua.*
Looking at the text  as it appears in the screenshot – a transcript would be nice; or a source link – we see several of these words appear:

Venetia, Lampardia, Treviser, Foriaul, Histria, Venetien, Christi.

Nearly a literal transcript can be found in: Marcus van Vaernewyck: "De historie van Belgis", D.J. Vanderhaeghen, Gent 1829. If it is this author's text, it is apparently as old as the other find below: Marcus van Vaernewijck,  (Gent, 21 december 1516 - aldaar, 20 februari 1569) Text below looks like an update with modernised orthography and wording.
Niet te min heeft Venetien daer veel voordeel uyt getrokken, en deze oorlogen hebben grootelyks tot haere aengroeying gestrekt, ter oorzaek dat menigvuldige ryke en magtige familien uyt Italien en Lombardien derrewaerds kwamen gevlugt, om veyliger te zyn, mids deze stad, als eene maen of blaesbalg, aen alle zyden omringd is van de zee. Naer de verstooring van verscheyde omliggende steden, heeft dit land zynen eersten naem verloren, zoo dat het niet meer Venetien genoemd wierd, maer Lampardien en eensdeels Treviserpalen, ook Foriaul en eensdeels Ristrien, maer men bleef de stad nog altyd Venetien noemen. Zy is eerst 466 jaeren naer Christus geboorte herbouwd, en tot op dezen tyd merkelyk aengegroeyd, dagelyks met pragtige gestigten en paleyzen verheerlykt wordende; zoo dat zy in magt en rykdom sedert grootelyks toegenomen heeft.

Most of these are names of places or people on the Italian peninsula.
Foriaul is also used in German texts at the time. For example in the  Die Schedelsche Weltchronik (deutsch):178 as a name for a region:

DIe hungern zohen erstlich durch teuetsche land vnd darnach durch galliam alle ding verwueestende. Nachfolgend machten sie inen die Bulgaros zinsper. Darnach erschwemmeten die wassergueße des vngezewmten barbarischen volcks vber die maß vil lewt vnd land. Sie zohen auch durch foriaul in welschs land vnd verhereten vnd verwueesteten alle ding mit prannd vnd rawb.

Which brings us to the meaning of this non-German word:
It is Friuli in English or Friaul in German. A location in now Northern Italy, previously under Habsburg control and before that Venetian. That matches the context of the text that mainly describes geography. For the time this word was in use in this form, the date of the Schedelsche Weltchronik is given as 1493. This coincides with Lampardia as a place name for Lombardy:

Der Landesname lautet
  mlat. Langobardia
  ahd. Langbarton 'bei den Langobarden' = Italien
mhd. Lampardie, Lampartenlant

The modern equivalent of Foriaul is located here:

The name for the region is derived from the ancient Roman town Forum Iulii, now called Cividale del Friuli in Italian and Östrich in German.
Note that the text itself says that the region used to be called Histria, that means it probably included parts of the adjacent Istria, as shown in these two maps:

 Source left: Herzogtum Friaul source right: Patria del Friuli
For completeness, the transcript of the screenshot reads:

… soo heeft dat landt den name verwisselt ende niet meer Venetia, maer Lampardia eensdeels Treviser
   pale. Item Foriaul, en eensdeels Histria gheheeten : maer de Stadt blyft naer't landt Venetien ghenoemt / ende is eerst na de gheboorte Christi vier hondert lbj iaren weder.

And finally, as commentator @R.Schmitz put it, assuming the text is indeed either old Dutch or the closely related Flemish and using the much younger transcript:

Ironically, the explanation of what it means is in the sentence itself. I only learned dutch as a second language, so no guarantees, but I also encountered no difficulties translating this. I kept the location names in the original because who knows if the english translations will mean exactly the same: "Following the destruction of several surrounding cities, this land lost its first name, so that it's not called Venetien anymore, but instead Lampardien and sometimes Treviserpalen, also Foriaul and sometimes Ristrien, but people always kept calling the city Venetien." – R. Schmitz

* "Pure German", as we saw, is not to be taken literal here, as it is apparently a Flemish text.
Comment: **Ironically, the explanation of what it means is in the sentence itself.** I only learned dutch as a second language, so no guarantees, but I also encountered no difficulties translating this. I kept the location names in dutch because who knows if the english translations will mean exactly the same. "Following the destruction of several surrounding cities, this land lost its first name, so that it's not called `Venetien` anymore, but instead `Lampardien` and sometimes `Treviserpalen`, also `Foriaul` and sometimes `Ristrien`, but people always kept calling the city `Venetien`."

What or where is "Foriaul"?


How do you transfer Google Music from one account to another?

Question: I spent days, maybe even weeks, uploading my music to Google Music, and now that it's available for Google Apps users, I'd love to be able to transfer it to my primary google account instead of spending/wasting time doing it again. Is this possible?
Comment: I expect that will be nigh impossible. Imagine the piracy implications if you uploaded 20,000 tracks to your locker, then were able to simply transfer that locker to all and sundry.
Comment: I agree there are some piracy concerns, but I would be willing to agree to have the songs deleted from the first account after transfer, and even to jump through a couple of hoops. Sadly this is only a problem because of Google's years of treating Apps customers like the proverbial "red-headed step child". Perhaps I should just bite the bullet and re-upload.
Answer: I am sorry to say so, but what you are asking for is clearly not possible. It is a great privacy, piracy breach and not only Google but all the companies that I know of, do not allow transfer of any kind of digital data from one account to another.
Answer: Basically, you can't and I don't think Google has any plans to implement this anytime soon.
As of January 2013

Data Move
You can move information from one account to another for the following
  products.

AdWords
Blogger
Bookmarks (Export and import)
Contacts (Export and    import)
FeedBurner
Finance: Export and Import
iGoogle (To transfer    data, create your own backup and restore it to the new account    through XML)
Picasa Web Albums
Places (bulk upload)
Reader
YouTube

For any other product, transferring product information is currently unavailable. This may change over time, so check back here for
  updates. You may find that sharing options listed below may be helpful
  as well.

See reference: Moving product data


Saving multiple animations in the same action

Question: My problem is very basic, that's why I can't find a solution on the internet.
I'm making a 2D animation in Blender. My character consists of various sprites like a thigh, calf,head, body etc. So when I animate I have to change the rotation of each sprite separately. I wanted it all to be saved under the same Action (like on YT tutorials, but they always animated only one sprite) but apparently an Action can store only one value of a transform, meaning that if I rotate the thigh at 20 degrees, the rest of the sprites would have to be rotating at 20 degrees as well to be saved under the same Action. Is there a way to save a whole animation under a specific name to be easily discerned among others in future? Thanks in advance!
Comment: Hi, try adding some more info about your specific setup, maybe some relevant image of rig and/or settings...
Answer: You can have multiple properties animated in one action. An action will animate the same property on any object it is assigned to, this means you will need one action for each object unless you want them to move exactly the same.
The easiest solution would be to use an armature. You can parent each existing object to a single bone or you can join the objects into one, the mesh pieces don't have to be connected, and have the armature bones move different parts of the mesh. This will bring all of the animation into the one action.


How do I discover how my process was started

Question: We've got a winforms LOB application, which under normal circumstances should be started from a launcher that should do basic version checks and download any updated components, before spawning the main process.
One problem we're seeing is that some members of staff have found it loads faster by not running the update application, however this can lead to people not having the latest features and causes all manner of headache to support.
What I'd like to be able to do is to throw up a warning if they haven't gone in through the initialise application. Ideally, I'd like to be able to do this without having to change the update application (as that means going and installing a new MSI on each client), and the approach that springs out is to find some way of finding information about the process that started "me" and check against a white/black list, forever I can't seem to find a way to do this?

Aside: Of course, if I did resort to changing the update application, I'd probably change it to either pass a pre-shared secret as a command line argument, or better still, change the application such that I could just load it as a class library and instantiate the relevant class via reflection. ClickOnce has been ruled out as it does not support being installed for multiple users
Answer: See here: How to get parent process in .NET in managed way
From the link:
using System.Diagnostics;
PerformanceCounter pc = new PerformanceCounter("Process",
"Creating Process ID", Process.GetCurrentProcess().ProcessName);
return Process.GetProcessById((int)pc.NextValue());

[Edit: Also see the System.Diagnostics FAQ for some more information about this. Thanks to Justin for the link.]
Comment: Link to System.Diagnostics FAQ

http://msdn.microsoft.com/en-us/netframework/aa569609.aspx#Question3
Comment: Works perfectly, even if it is a case of closing the gate after the horse has bolted...
Answer: I find if your process - which I assume you have control over - checks its version number vs the latest released version number (placed somewhere central db/ftp wherever u look for the update) , then you have all that logic in one place. I think that would be a simpler solution.
Comment: For the record, we do have a diagnostics screen that the support staff can pull up that highlights in big nasty redness if anything is deemed out of date. I wanted to catch the culprits ahead of time :)
Answer: You can use PInvoke with a Kernel32 method to find the parent process and check to see if it matches your updater.  Source.  Code, in case it goes away:
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
static class myProcessEx
{
    //inner enum used only internally
    [Flags]
    private enum SnapshotFlags : uint
    {
    HeapList = 0x00000001,
    Process = 0x00000002,
    Thread = 0x00000004,
    Module = 0x00000008,
    Module32 = 0x00000010,
    Inherit = 0x80000000,
    All = 0x0000001F
    }
    //inner struct used only internally
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
    private struct PROCESSENTRY32
    {
    const int MAX_PATH = 260;
    internal UInt32 dwSize;
    internal UInt32 cntUsage;
    internal UInt32 th32ProcessID;
    internal IntPtr th32DefaultHeapID;
    internal UInt32 th32ModuleID;
    internal UInt32 cntThreads;
    internal UInt32 th32ParentProcessID;
    internal Int32 pcPriClassBase;
    internal UInt32 dwFlags;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)]
    internal string szExeFile;
    }

    [DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
    static extern IntPtr CreateToolhelp32Snapshot([In]UInt32 dwFlags, [In]UInt32 th32ProcessID);

    [DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
    static extern bool Process32First([In]IntPtr hSnapshot, ref PROCESSENTRY32 lppe);

    [DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
    static extern bool Process32Next([In]IntPtr hSnapshot, ref PROCESSENTRY32 lppe);

    // get the parent process given a pid
    public static Process GetParentProcess(int pid)
    {

    Process parentProc = null;
    try
    {
        PROCESSENTRY32 procEntry = new PROCESSENTRY32();
        procEntry.dwSize = (UInt32)Marshal.SizeOf(typeof(PROCESSENTRY32));
        IntPtr handleToSnapshot = CreateToolhelp32Snapshot((uint)SnapshotFlags.Process, 0);
        if (Process32First(handleToSnapshot, ref procEntry))
        {
        do
        {
            if (pid == procEntry.th32ProcessID)
            {
            parentProc = Process.GetProcessById((int)procEntry.th32ParentProcessID);
            break;

            }
        } while (Process32Next(handleToSnapshot, ref procEntry));
        }
        else
        {
        throw new ApplicationException(string.Format("Failed with win32 error code {0}", Marshal.GetLastWin32Error()));
        }
    }
    catch (Exception ex)
    {
        throw new ApplicationException("Can't get the process.", ex);
    }
    return parentProc;
    }

    // get the specific parent process
    public static Process CurrentParentProcess
    {
    get
    {
        return GetParentProcess(Process.GetCurrentProcess().Id);
    }
    }

    static void Main()
    {
    Process pr = CurrentParentProcess;

    Console.WriteLine("Parent Proc. ID: {0}, Parent Proc. name: {1}", pr.Id, pr.ProcessName);
    }
}

Answer: First, if your staff has people smart enough to figure out that the launcher is slow and how to get around it, I bet they will find out some 'secret' command line switch, too. I would consider that approach a waste of time.
Second, I think the answer form Chris Marasti-Georg goes into the rigth direction: You have to figure out the name of the parent process, i.e. the process that launched your app. I have no specific idea on how to do this, but WMI seems like a good place to start.
Edit: Simon P Stevens answered that part.
Third, I suppose you are aware of this, but I will say it anyway: Your problem is the launcher. If it is so slow that normal users find a way to get around it, it is just too slow. Your best solution is not ti fix the main app, but to fix the launcher.
Edit: See Anders Karlsson's answer for a better mechanism.
Comment: The "too slow" bit is mostly the result of pulling updates over a WAN. These updates are already distributed to convenient geographical locations, and are also gzipped. For the record, I don't like the preshared secret approach
Comment: The way I understood your question, I thought that the loader was *always* slow, not only when it was actually performing an update. I stand corrected ;-)


How can I prove that only there continuous odd prime are $3,5,7$?

Question: How can I prove that the only prime number $p$, such that $ p,p+2,p+4$ are primes is 3?
Comment: **Hint:** All primes except for $2$ and $3$ are of the form $6n\pm1.$
Comment: @Lucian that's a great hint ... and easy to prove, too.
Comment: Hint: 1+2 =3.  2+4 =6.  Is that too obscure a hint?.
Comment: Even easier.  Any prime but 3 is of form 3m +1 or 3m +2.  (And 1+2 =3 and 2 +4 =6).
Answer: Hint: Assume you have found such a prime, and then look at divisibility by some small, other prime.
Comment: It was a _hint_! The hint was posted one minute ago - you should think about it a little longer than that. To be explicit: There exists a prime $q$ with this property: For any $p$, one of the three numbers $p$, $p+2$ and $p+4$ iis divisible by $q$.
Comment: I don't understand...
Answer: Out of any three numbers chosen of the form $ p, p+2, p+4$. One of them will be a multiple of three. Here's the reasoning for this.
Out of any three consecutive numbers, one of them has to be a multiple of 3. If none of them were a multiple of 3, then it implies there are two consecutive multiples of three separated by a distance greater than three !
Out of the three numbers, $p-1, p-2, p-3$, one of the three is a multiple of 3.
If p-1 is a multiple of 3, then p+2 is a multiple of 3.
If p-2 is a multiple of three, then p+4 is a multiple of 3.
If p-3 is a multiple of 3, then p is a multiple of 3.
Of all the multiples of 3, only 3 is a prime number. So if we want to check for a sequence of primes of that form, it must include three or else it is composite. We could try the sequence, $1,3,5$. But, 1 is not a prime number. So, that leaves $3,5,7$ as the only sequence.
Hence, proved.
This result is simple, but powerful. However, there is no intuitively obvious reason that there aren't infinitely many primes of the form $p, p+2, p+6$ or $p, p+4, p+6$. Even though the problems looks only slightly harder, it is nearly insolvable ! That's the beauty of mathematics. We don't have to look very far for something we don't know.
Answer: Hint: one of the three numbers $p$, $p+2$, $p+4$ must be divisible by $3$.


Daily Cron for a month in Debian

Question: How to make a Daily Cron only for a month? I want to run a certain command everyday at 2PM but want to run It only for a month, and after the month it should stop on its own. How to make it?
Comment: Have you tried anything or getting any error. show us the error.
Answer: Create a file e.g. /etc/cron.d/onlyfor1month
Put this into that file:
0 14  * 12 * root /this/is/run/everydayofthemonth/at2pm
0 15 31 12 * root rm -f /etc/cron.d/onlyfor1month

The first line runs the job every day in December at 2pm, as root (change the root if it should be run as another user).
The second line runs on the 31st of December at 3pm (also as root, this must be root) and removes the cron file, so that it won't cause the job to be run again next December.

Daily Cron for a month in Debian


Will brand matter between a rear derailleur and front derailleur?

Question: I had a crash recently that destroyed my 8 speed sensah reflex rd. I replaced it with a 9 speed shimano sora for a bit of upgrade but after 4 tune ups by the mechanic its still not right. Just so discouraged pls help. I noticed also that my rd hanger is kind of a little bent or not straight enough will this matter? Thank so much in advance...
Answer: I believe you are referring to the shifter, not the front derailleur. The shifter connects to the derailleur with a cable
Sensah Reflex is an 8 speed system with components designed to be interchangeable with Shimano 8 /9 speed.
http://www.disraeligears.co.uk/Site/Sensah_Bicycle_Components_2020_page_6.html
Probably the Sora RD is slightly better quality, not because it is 9 speed but generally Shimano have better manufacturing standards and shifting quality than most other brands, though Sensah doesn't seem to be terrible at all.
There is no difference between an 8 speed and a 9 speed RD so that part is fine. (Often a 9 speed is a more expensive part and made from lighter materials , but that's all)
Given that you still have shifting problems and have identified that the derailleur hanger is bent, it is obvious that that is the source of your problem. So find a replacement derailleur hanger, keep your Sora RD. If you can't find a replacement hanger perhaps you can straighten it, but given your mechanic has failed to do so replacement seems a better option.
https://www.parktool.com/blog/repair-help/rear-derailleur-hanger-alignment
Answer: If the derailleur hanger is bent, it certainly does matter. It is a very common source of shifting problems, particularly after crashes. Even a small visible bend is bad.
No matter how good the derailleur itself is, if the hanger is bent, you won't get good shifting. It should be straightened using a dedicated tool (it can be done without in a coarse way, but not that well) or it can be replaced. The hangers are made to be replaced but can be frame-specific. If you cannot find a spare easily, take it to a bike shop and let it be replaced or straightened.
However, if your mechanic didn't notice the bent hanger, consider that it can be the case that either a) it is not bent after all, or b) the mechanic is not good enough and it is better to take your bike elsewhere.
To answer the title: No, the brand often does not matter between 7,8 and 9 speed rear derailleurs. Just keep the same number of speeds on the shifter and on the cassette. The exception may be some SRAM 1:1 groupsets, Campagnolo, Microshift Advent and some other. If it says Shimano compatible, it should be the same.
Comment: Campagnolo is incompatible too, and there are two incompatible types of Campagnolo 9-speed. The wide compatibility between 7-9/10 speed Shimano an exception, not rule.
Comment: @ojs Certainly not just Shimano, many other third parties too, SRAM also in those not 1,1, also some no-name or OEM like BTWIN, or indeed, the RD the OP had, Sensah Reflex. Campy is something special for racing bikes and does not really make 7-9 speed groupsets anyway, veloce is 9 speed.. This was a side note only later added to my answer.
Comment: Ok, I thought bicycles made before 2000 still exist. My mistake.
Comment: @ojs This is about replacement parts for a current cheap bicycle, not about middle-end bikes in the 2000s or high-end bikes from 1990s. Who is gonna buy a Campy 9-speed Veloce (8-speed are really vintage now) for a bike with no-name Asian 8-speed components?
Comment: Someone who finds a great deal on eBay and has read that all 8 speed derailleurs are compatible? In the other direction, at one point you could buy 8-speed Dura-Ace cassettes really cheap because it had the reputation that it's incompatible with everything, when actually only derailleurs and shifters were incompatible.
Answer: The bent derailleur hanger will undoubtedly give you shifting issues. The mechanic should be able to sort that out easily with a special alignment device.
Comment: They are normally compatible. Some are even sold as 7/8/9 speed in one unit.
Comment: Sounds good, thanks.


DS2413 One Wire IC read and store the addresses of individual IC's

Question: Hy,
Here I using 10 DS2413 to control gpios, it works very well with arduino ,I read the 10 ic address and store it in a 2D array, I want to control the individual IC using their address .Here all works well. My problem is the Ic address are not store in arrange wise manner. For ex, I have 10 IC's, Each IC's have unique address, The address of first IC1 is store in arr1, address of ic2 is arr2 and address of ic3 is store in arr3..... what i need is If i Swap the IC1 and IC2 the address of IC2 is store in arr1 and IC1 address is store in arr2.
Comment: Can you show us the sketch you're using?
Comment: 1-wire has no concept of bus position, only the logical order of the ROM addresses.
Answer: The OneWire system has no concept of the arrangement of the bus. All it knows is the addresses, and it always searches for those addresses in a pre-defined order.
No matter what arrangement you have on the bus the devices will always be found in the same order.
You can think of it akin to a teacher taking the register in class. They call out the names in alphabetical order and the pupils answer (if they are there). All it tells the teacher is who is there and who isn't. It doesn't give them any information about where in the class the pupil is sat.
You can read more about how the address searching is done here.


Issue when using a custom font - "native typeface cannot be made"

Question: I'm trying to use a font I found on the internet, but the problem is that I get an FC with "native typeface cannot be made".
Here is the code in the getView of my ListVIew:
        holder.tv_SuraName   =(TextView)convertView.findViewById(R.id.Start_Name);
        holder.tv_SuraName.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "suralist_font.ttf"));

Can anyone tell me why can I use the custom rom? You can get it HERE .. the file is .ttf
Answer: My problem was incorrect placement of the assets folder.
When using Android Studio the assets folder should be inside of the source sets e.g.

src/main/assets/

Found in this answer
Comment: This is the answer. Just saved my time. THanks!
Answer: The font file is either corrupt or unsupported for some reason. You can drop it on the SD card and load it from file, to make sure it's not a problem with your assets.
Comment: I just tried from File and now the font works! But this means I have a problem with my assets folder, will this affect anything else? Is there a way to fix this problem?
Comment: As a side note: Android studio users need to create an assests folder in src/main because of gradle build rather than the build/assets folder.   http://stackoverflow.com/questions/18302603/where-to-place-assets-folder-in-android-studio/18302624#18302624
Comment: Shouldn't affect other stuff. You can try rebuilding your apk, but not sure what exactly is the problem. Maybe it fails to decompress the file? Try using the newest Android SDK.
Comment: how to drop it out on sdcard ? when a random person is downloading my app from the play store?
Answer: There are basically 4 things that can cause this:

You use the wrong extension
You have to place the fonts in the assets folder and not inside assets/fonts/
You misspelled the fonts
The fonts need to be lowercase (in my case the solution was to rename MyFont.ttf to myfont.ttf, strange)
Comment: In my case, I was using Bootstrap and the font needed to be copied at the **root of the assets folder**. Your answer helped figured it out so +1.
Comment: In my case the problem was lowercase
Comment: Mine was number two. Good point that might help a lot of people
Answer: Double check the extension isn't in caps, ie. suralist_font.TTF
Fonts often come seem to come that way and it might be overlooked.
Comment: Just helped me out with that! :)
Comment: this solved the problem for me too, the bebas font file is something like BEBAS___.TFF -- thanks a lot!
Answer: I had this same problem, I created mine in assets>fonts>whatever.ttf and was getting the same error.  I added the fonts extension (fonts/whatever.ttf) and it fixed the problem in every case.
 holder.tv_SuraName   =(TextView)convertView.findViewById(R.id.Start_Name);
 holder.tv_SuraName.setTypeface(Typeface.createFromAsset(mContext.getAssets(),    "fonts/suralist_font.ttf"));

Answer: Rather old thread, but I want to add one more reason this can happen: You have to set the content view before calling typeface. See example below
Does not work:
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        TextView title = (TextView)findViewById(R.id.tvTitle);
        Typeface font = Typeface.createFromAsset(this.getAssets(), "fonts/whatever.ttf");
        title.setTypeface(font);

        setContentView(R.layout.main);
    }

Does work!
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); // <-- call before typeface

        TextView title = (TextView)findViewById(R.id.tvTitle);
        Typeface font = Typeface.createFromAsset(this.getAssets(), "fonts/whatever.ttf");
        title.setTypeface(font);
    }

Comment: `fonts/whatever.ttf` part saved me. Thanks!
Answer: I am using android studio, in my case problem was with the path of assets folder, in Eclipse path for assets folder is res/assets/ but in Android Studio its src/main/assets/
So, i just move my font file to this path and finally problem solved.
Answer: Either your font file is corrupt else you making some mistake in spelling while calling your file name. I had same issue, it was because file name specified in asset folder was

roboto_black.ttf

and while declaring in java file, i have been spelling it as:

roboto_blak.ttf

If your .ttf files are in asset folder,then use:
Typeface type_bold = Typeface.createFromAsset(getAssets(), "roboto_black.ttf");

Else if it is in fonts folder, then use:
type_bold = Typeface.createFromAsset(getAssets(), "fonts/roboto_black.ttf");

Hope it helps!
Answer: As CommonsWare states in this answer

I would guess that there is a problem with the font itself. That error
  will be triggered when native code in the OS attempts to load the
  typeface.

Anyway try this one:
holder.tv_SuraName = (TextView)convertView.findViewById(R.id.Start_Name);
Typeface Font = Typeface.createFromAsset(this.getAssets(),"suralist_font.ttf");
holder.tv_SuraName.setTypeface(Font);

Answer: Hope this will help
Typeface.createFromAsset leaks asset stream: http://code.google.com/p/android/issues/detail?id=9904
Answer: I had the same problem with COMIC.TTF from comic sans ms of Windows.
Since the original file I placed in assets/fonts folder was in uppercase as spelt above, I had to type it exactly in uppercase.
     Typeface.createFromAsset(getAssets(), "fonts/COMIC.TTF");
it turns out the problem was caused by the lower case:
     Typeface.createFromAsset(getAssets(), "fonts/comic.ttf");
Answer: Please note that this is due to either a corrupt file or you have placed the file in the wrong folder.
According to Android documentation here

main/assets/
  This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.

Therefore your folder structure should be yourmodule/main/assets (e.g. a***pp/main/assets*** )
Answer: What worked for me was first changing my font name to only lower case and underscore: from Amatic-Sc.ttf to amatic_sc.ttf.
Then in the set.TypeFace method change assets/fonts/amatic_sc.ttf to just fonts/amatic_sc.ttf.
Answer: I've been debugging forever on this error in Android Studio. Clean and rebuilding the project after adding the fonts to the assets directory fixed the issue for me.
Answer: Just did a build --> clean and it started rendering .
Answer: I had same issue which happened on Android 4.0.3-4.0.4 (100% reproducible on emulator IceCreamSandwich mips 4.0.3).
The problem was that TTF fonts, that I had, were not correct, despite almost all Android versions were able to load those TTF font. So I used https://cloudconvert.com/woff-to-ttf (since I had woff files as well) to make new TTF fonts, which solved my problem.


"Beforehand" vs. "in advance".

Question: Are "beforehand" and "in advance" totally interchangeable? Or are there cases where one of them is more suitable than the other?
Answer: "Totally" interchangeable, no.
Although in advance and beforehand have similar meanings, one takes complements and the other does not.
In advance of planting, they added fertilizer to the soil.
Beforehand of planting.... ungrammatical
They evacuated in advance of the hurricane.
They evacuated beforehand (of) the hurricane ungrammatical
Answer: In my experience (native American English speaker), the word beforehand is not really used as it is typically defined. I was actually surprised when I looked here and saw "in advance" and "in anticipation" included in the definition. I don't feel those nuances when I hear "beforehand".
I'm actually having a difficult time explaining beforehand simply because it isn't often used in everyday language. I think the best way to understand it is something like: beforehand is a way to avoid using a prepositional phrase. For example, you could state:

I'll finish the report before the meeting.

OR

I'll finish the report beforehand.

They both have the same meaning and I don't detect any significant difference in nuance. However, the second would only be stated if it is clear that you are talking about a meeting (because it was discussed earlier).
Also, I'm not confident if this sensation is shared, but I believe that beforehand sounds slightly lazy (and consequently a little less formal). It sounds like you are sacrificing explicitness and clarity for ease.
In advance is a bit easier to understand. In advance always implies that you are doing something earlier than absolutely necessary.
Answer:
Are "beforehand" and "in advance" totally interchangeable?

I guess, no.

Are there cases where one of them is more suitable than the other?

Yes, there are.

Thanks in advance.

is correct but I've never heard someone saying

Thanks beforehand.
Comment: Can you think of any other situation except these two examples?
Comment: Could you provide some examples or references to back up your assertions why these are **not** normally interchangeable?  One data point does not decide a trend, and "thanks before" might just be an exception.
Comment: @Andrew: I never claimed it to be a trend. OP asked if there's any case where the two aren't interchangeable and I simply provided an example. What part of my answer made you think that I'm talking about a trend?
Comment: @7_R3X  "I guess, no".  I'm just asking if you can improve the answer to where it's less of a *guess*, based on personal anecdote.

"Beforehand" vs. "in advance".


Should outlier detected before or after train test split

Question: Outliers are usually first detected using Boxplot, then the suspicious observations may be sent to experts for justification - justify whether they are true outliers (contaminated data) or leverage points.
Suppose I need to perform model selection in a cross validation fashion. Should the outlier detection and justification done before or after data split?
If it should be done within cross validation, does it mean that in each round of cross-validation, I need to ask the experts to justify the outliers?
Answer: IMHO, both is possible.

You may say that you work entirely on a clean data set, i.e. all data you admit has been checked beforehand to not contain outliers.

E.g. some instruments I work with have a measurement mode where the software already checks for particular types of outliers and automatically replaces the suspicious measurement by a fresh one. This would be clear from the reported measurement parameters/SOP.
IMHO it is also OK to clean your data set manually as described as long as you clearly state this limitation and as long as it is an acceptable limitation for the task at hand.
Personally, I consider this the counterpart to ending the analysis/model development with an internal validation/verification (e.g. test data split off at the beginning) rather than a full validation study or external validation (by someone outside your organization).

Doing the outlier detection inside cross validation explicitly makes it part of your model, like any other pre-processing step that applies a quality filter.
In this case, consider setting up your outlier detection as a completely automatic sub-model and treating the expert opinion as reference for verfication/validation of your outlier-filter sub-model.

There's a 2nd decision hidden here: do you exclude outliers only from training but not from prediction, or do you exclude them from both?
IMHO almost everything is allowed during training - but you absolutely need to perform an honest verification/validation.
To me, it is thus acceptable to exclude suspicious data or confirmed outliers from training if you think this will overall result in a better model. But unless you can argue that such points will be caught by a quality filter for application use, you need to assess your model's predictions on these data points. I then usually report performance in detail: overall performance, fraction of bad data points, performance for good data and performance for outliers.

In any case, it is extremely important to be clear how this cleaning procedure affecty your model and predictions. In particular, whether the cleaning procedure has the potential to create an artificially easy problem.

does it mean that in each round of cross-validation, I need to ask the experts to justify the outliers?

I assume the expert is giving their judgment for each data point separately without looking at other.
In that case, I'd treat this as another type of reference label which is unknown for all data at the beginning and updated on the fly as suspicion arises. That is, when a data point comes up as suspicious, you look up that reference information. If its status is known already (i.e. the expert has seen it already) you proceed on this information, if its unknown, ask the expert and update the reference information.
(You may also decide to always ask the expert and then have a look at how consistent their judgment is. Particularly, if the type of outlier you're looking at is not very obvious)

IMHO asking expert opinion from an application point of view makes sense mostly iff:

the opinion is needed for training, but no outlier filter is considered for application use
the opinion is needed for verification/validation of the outlier filter, and during application use any data identified as suspicious by this filter is marked as "suspicious" as part of the prediction.

In other words, if expert opinion is part of your predicition procedure, application use will require an expert being around. This would often be considered an unacceptable limitation.
Comment: Thank you very much for your opinion. Does it mean that I can perform outlier detection and verification on overall train + validation sets? After that, I will train my model on train set and test performance on the validation set?


Regex Performance Optimization Tips and Tricks

Question: After reading a pretty good article on regex optimization in java I was wondering what are the other good tips for creating fast and efficient regular expressions?
Comment: I would like to mention [Boolean Sequence](https://github.com/NaturalIntelligence/BooleanSequence) which currently supports less symbols of RE but they are fast and flexible and full of many useful features. You can write your own matchers to add more features or to make them more fast. They also do auto optimization and you can see how they are evaluated using json or json based graphs.
Answer:
Use the non-capturing group (?:pattern) when you need to repeat a grouping but don't need to use the captured value that comes from a traditional (capturing) group.
Use the atomic group (or non-backtracking subexpression) when applicable (?>pattern).
Avoid catastrophic backtracking like the plague by designing your regular expressions to terminate early for non-matches.

I created a video demonstrating these techniques.  I started with the very poorly written regular expression in the catastrophic backtracking article (x+x+)+y.  And then I made it 3 million times faster after a series of optimizations, benchmarking after every change.   The video is specific to .NET but many of these things apply to most other regex flavors as well:
.NET Regex Lesson: #5: Optimization
Answer: Use the any (dot) operator sparingly, if you can do it any other way, do it, dot will always bite you...
i'm not sure whether PCRE is NFA and i'm only familiar with PCRE but + and * are usually greedy by default, they will match as much as possible to turn this around use +? and *? to match the least possible, bear these two clauses in mind while writing your regexp.
Answer: Know when not to use a regular expression -- sometimes a hand coded solution is more efficient and more understandable.
Example: suppose you want to match an integer that's evenly divisible by 3.  It's trivial to design a finite state machine to accomplish this, and therefore a corresponding regex must exist, but writing it out is not so trivial -- and I'd sure hate to have to debug it!
Comment: you mean this: `(((0|3|6|9)|((1|4|7)(0|3|6|9)*(2|5|8)))|(((2|5|8)|((1|4|7)(0|3|6|9)*(1|4|7)))((0|3|6|9)|((2|5|8)(0|3|6|9)*(1|4|7)))*((1|4|7)|((2|5|8)(0|3|6|9)*(2|5|8)))))*`? (Yeah, I made a DFA and then GNFA then regex :p)
Comment: Yes... but it is trivial in some numeric systems. :-P
Comment: Use a fast implementation when you have no backreferences. https://swtch.com/~rsc/regexp/regexp1.html


Pantone and process mismatches

Question: I am having a headache with a brand palette from a client, the values in which don't match Pantone's colour finder values on their website nor my Adobe CC colour books.  For example, when I select type 2748 into the Pantone Solid Colour book in Photoshop (brought in from previous version), the CMYK, RGB and Hex values are way off. I wondered if it was the Pantone+ Solid Colour book, but equally none of these are correct.  When I type 2748 into the Pantone+ Colour Bridge Coated colour book in Photoshop, I get the CMYK values in the brand palette, but they don't match Pantone's values for 2748CP on the Pantone website. Has anyone come across this before?
Visual from the brand palette for ref.
Answer: In my experience brand color palettes are often inaccurate and overly simplified.
This is probably done to make it easier to use for amateurs and keep people on a "need to know basis", but it does not ensure color likeness across different media.
When you start to understand just a little bit about color management, it can actually be very confusing when the color guidelines are simplified.
Let's go through the Pantone, CMYK and RGB/HEX numbers separately and do a little detective work.
Pantone
The brand palette doesn't specify whether the Pantone colors are printed on coated or uncoated paper. It basically just tells you to always use those three Pantone inks, no matter which paper you print on. So the effective color will differ depending on which paper you print on.

Either the designers deliberately chose to not care about that color difference or they aren't aware of the difference.
CMYK
The CMYK colors seem to come from the values you get if you use the color book PANTONE+ Color Bridge Coated that comes with Adobe's applications:

For some reason unknown to me, this is not the same values you get if you find the same colors on Pantone's web site in the PANTONE Color Bridge Coated library:
https://www.pantone.com/color-finder/2748-CP
https://www.pantone.com/color-finder/711-CP
https://www.pantone.com/color-finder/2985-CP
(The numbers might match if you download the software available from Pantone's web site, but I don't have it installed on this computer, so I can't check.)
The brand palette doesn't specify which CMYK color profile it follows. It doesn't even tell you if the CMYK numbers are intended for coated or uncoated paper. The given CMYK numbers will look different when printed on different kinds of paper by print houses following different standards. Here are some random examples:

RGB
The RGB values seem to come from the PANTONE Formula Guide Coated library on Pantone's website:
https://www.pantone.com/color-finder/2748-C
https://www.pantone.com/color-finder/711-C
https://www.pantone.com/color-finder/2985-C
Again no RGB color profile is given, but we can probably assume that it's supposed to be sRGB.
(The HEX codes are just another way of writing the RGB values.)
So what to do?
Pfew, what a mess. I totally understand your confusion, I often find myself in a similar situation trying to faithfully follow the brand guidelines, only to discover that  they just don't make completely sense. What to do really depends on how deeply you want to get involved. It's hard for me to answer without knowing what exactly your job is.
If you are producing a whole array of products on different kinds of media and the company demands you to match the colors, this brand palette isn't really a useful tool to accomplish that. It will take much more work to account for all the different situations. If they are really serious (and willing to pay for it) perhaps they should consult the company who made the brand palette.
If you are just doing a smaller job for the company perhaps you should just follow the guidelines and if something goes wrong with the colors you can at least say that you did as instructed.
Sometimes I would even alter the colors slightly myself without telling the client, if I knew that it would produce a better result.
In the end, the shortcomings of the brand palette might be a deliberate choice from the designers. That they have prioritized simplicity and ease of use over color likeness. That they have chosen to accept some error margin as long as the colors are more or less consistent.
Comment: A comprehensive answer, thank you for taking the time.

You've reassured me that this is not my misinterpretation, rather it is a confusing guide I'm presented with.  I've been working freelance in design for print and digital for 17 years now, but doubted myself this time as the guide had come from a large agency, plus Pantone keeps reinventing the books so maybe I'd fallen behind. I didn't like to question the agency in case it was my ignorance!
Comment: As for what I'm aiming to achieve, I am producing digital and print resources and the end result is to ensure they all match to the customer's eye.  I'm not the only creative in the team, but considered the lead perhaps, and I've voiced my concerns to the client who is happy for me to re-define the brand colours for all to follow.
Comment: What I was unsure about is setting different values for different outputs, as Scott suggests below, which I've never come across before. I'm the only one managing print, so I can ensure the visual results dependant on coated/uncoated, and I'd produce a RGB guide for those creating for web and office documents.  I'm uncomfortable with this route though, it feels messy and open to error.  Am I old-fashioned?
Comment: This is a complicated subject. Not easy to go in depth in comments. But if we keep commenting eventually we will get the option to convert the comments to a chat room. That might happen.
Comment: In general, ensuring the exact same colors on different media is hard (= expensive) to achieve. To reach perfection you'll need to perhaps iterate through several "rounds" of palettes, trying to find colors which can be reproduced on the different media you work with (coated/uncoated paper, fabric, metal, plastic, stickers etc.), make test prints on all materials, measure the deviation, fire the subcontractors who can't deliver a pleasing result, adapt the palette, make new test prints and so on. Honestly, I've never worked for clients of that caliber.
Comment: In real life (less rich clients) we can live with a compromise. Do our best to select values that will *theoretically* look alike on print and live with some error margin. I don't have "the answer" to what to do in your case. I just point out the problems.  I can just say that if you print the same Pantone ink or the same CMYK values on different kinds of paper, they *will* for sure not look 100% alike. If you on the other hand try to make different values for coated/uncoated and for different printers you will *probably* get better color likeness (if possible).
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/119282/discussion-between-wolff-and-annach).
Answer: Your system's color profiles alter values Photoshop will use for auto-conversion. It's common for your system's auto-conversion to not match some stated value by an online conversion tool.
Online, digital, automated converters cal also be wrong. Doesn't matter who makes it.. Pantone, Adobe, Joe Coder... they just aren't always accurate visually because all they are doing is pumping numbers into a formula and spitting out new numbers.
I start with Pantone number for the color I want.
I then see what the auto-conversion determine for CMYK and RGB...
If the CMYK/RGB color is unacceptable, I manually pick the the color I think is best, ignoring any auto-conversions.
Color, to me, is often more about the visual when choosing.
Comment: @AnnaCh Your system will tend to be a bit more visually accurate if it's well calibrated. Online converters are simply going number to number and not factoring any color profile. It's the profile that matters for auto conversion. A bad profile can *easily* make Adobe's in-app conversion just as "off".
Comment: Thanks for answering Scott, I initially thought this is what the designer might have done, but visually they're not consistent. I do however think this might be the best route for me to take it forward - to select the values that appear accurate to the eye against the Pantone defined for solid coated.  I was concerned this wasn't professional to do, but I may be stuck in the old days so am reassured to hear you work in this way.
Comment: Scott, when you say you see what the auto-conversion determines, do you mean Adobe's conversion?  I've spent some time considering if the pantone refs in this palette and their secondary one are Pantone+ Colour Bridge Coated (as suggested by Wolff above) and the process values suggested in Adobe do match visually, so I think that's my safe route forward, to amend the RGB and Hex in the guide. The Pantone website values in their Colour Finder tool are very different, however, so do I just shrug it off and follow Adobe as truth?
Comment: When you both talk about "trusting your eyes" you must mean comparing what you see in a *physical* Pantone color book with the *preview* of CMYK you have on your screen right? This requires having a color calibrated screen and knowing the right CMYK profile to use.
Comment: @Wolf Yes. My calibration is solid and I keep it that way so I can trust my screen. Of note is I have physical samples I can check against regularly. If something is "off" is generally so minute I'm the only one who notices or it's due to a different substrate than I specified.

Pantone and process mismatches


Must I limit my expected salary to a maximum percentage increase over my current salary?

Question: I am currently looking at switching jobs in Germany and plan to speak to recruiters soon. Is there a maximum percentage increase in salary that I must limit my expected salary to? Are there laws or regulations governing a salary increase in Germany?
Answer: No, there is no such law and no other regulation. You can state any number you seem fitting as your expected salary in negotiations. Unlike other countries, your current salary is not a measurement of your future salary in Germany.
You are not required to give your current salary to anybody. Most likely, your current contract contains a clause that makes sure you don't. Although those clauses do not hold up in court, people in Germany are used to the fact that they are not supposed to talk about their salary and most would consider it rude even to be asked. What you make now is irrelevant. The only thing that counts is what you want to make in the position discussed.
Answer: Disclaimer: I am from Germany.
Your current salary is a protected private information. That means your new employer has no right to know it, and you can lie if they ask it with no legal repercussions. Its in the same category as asking if you have job unrelated chronic diseases or family plans.
Furthermore, there is no law governing how much of a salary hike you can get or limiting that.
Additional Source (Compilation of case law and interpretation from an attorney's website) [in German] here.
Comment: @nvoigt I added some sourcing to this.
Comment: @Lilienthal I'm unsure. I could rewrite my answer to be less focused on the country tag, but nvoigt's answer would still be. You more or less invalidated it with your edit.
Comment: @Lilienthal It boils down to reaffirming my "There are some questions (this one included) that the employer is not allowed to ask and in which you can legally lie when they are asked"
Comment: How is "I am from Germany" a "Disclaimer" in this case? What are you "disclaiming"?
Comment: The source you added does not seem to mention anything about previous salaries.
Comment: @Philipp Previous salary falls under private matters not directly related to the future employment, the article cites sources for this. The article in general is more on _all_ private matters as far as the employer is concerned. As for why I added that disclaimer, its because the information in my answer is very specific to germany and may not apply in other countries, and I like to disclose factors that influence my answers heavily (like my being from germany).
Answer: In some jobs , there are regulations and policies. For a example they clearly mentioned that this country engineers were paid 1/10 times lower than in USA.
Unless a situation like that, there is no point to declare your own limits.
It's about business, and you show know how to demand yourself with your skills and realistic.


Boolean function, what is the purpose of DNF and CNF?

Question: Boolean functions can be expressed in Disjunctive normal form (DNF) or Conjunctive normal form (CNF). Can anyone explain why these forms are useful?
Comment: Perhaps to make logic implementable with NAND or NOR gate circuitry!!
Comment: but logic is implementable with NAND and NOR also in Non-standard form
Answer: CNF is useful because this form directly describes the Boolean SAT problem, which while NP-complete, has many incomplete and heuristic exponential time solvers. CNF has been further standardized into a file format called the "DIMACS CNF file format", from which most solvers can operate on. Thus for example, the chip industry can verify their circuit designs by converting to DIMACS CNF, and feeding in to any of the solvers available. The Tseitin Transformation can convert circuits to an equisatisfiable CNF.
DNF is not as useful practically, but converting a formula to DNF means one can see a list of possible assignments that would satisfy the formula. Unfortunately, converting a formula to DNF in general, is hard, and can lead to exponential blow up (very large DNF), which is evident, because there can be exponentially number of satisfying assignments to a formula.
While CNF can be succinct compared with DNF, it is sometimes hard to reason with, because it can lose structure when converted from a circuit for example, and so another succinct form would be useful. The and-inverter graph data structure was designed for this purpose; it can more closely model the structure of circuits, and is thus much easier to reason with in some types of formulas. However there are not many solvers that operate on it.
Other forms include:

Binary Decision Diagram
Propositional directed acyclic graph
Negation normal form
Others (wikipedia)
Answer: It helps to express the functions in some standard way. With that, it's easier to automatically go through many algorithms.
Both forms can be used, for example, in automated theorem solving, namely CNF in the resolution method.


Am I shooting myself in the foot if I use Mercurial for Rails development?

Question: I'm a Rails developer and I prefer Mercurial over Git. However, I know that the Rails community is very pro-Git. So my question is it possible that my choice of version control system would turn back some developers?
Answer: Honestly, hg and git are fairly similar. For hiring and collaborating, it shouldn't matter too much (though the workflows differ a little bit).
The big sticking point, honestly, would be GitHub. If you plan on open-sourcing your projects, GitHub is the way to go. It's a massive community, and it's frequently searched for libraries and projects by a huge amount of developers. It seems ridiculous that third-party repository hosting would have an effect on which source control systems to use, but if you're an independent dev looking to make a name for yourself, there's no better way to go (right now) than GitHub.
(Apologies for making this sound like a GH advertisement - I am in no way affiliated with GitHub).
Comment: Oh, also, there are tools for converting between git and hg... you could use hg for your normal dev, and then import it into git to post to GitHub.
Comment: Yeah, I think it's important to mention GitHub (and of course I would use it if only for the gems). I am aware that they are very similar but I have a slight preference towards Hg.
Comment: And that's your prerogative. Hg is a perfectly valid source control tool. It's distributed, it's fast, and there is a good community for it. Heck, StackExchange uses it (check out [the FogBugz page](http://www.fogcreek.com/fogbugz/) to watch a video of Joel Spolsky speaking about FB and Kiln/Hg).
Answer: In my opinion, you shouldn't choose a version control tool because of a service, you should choose a tool because the tool itself is what you really really need and it makes sense for you.
I guess it could come down to this: how hard do you want to allow the history of changes to be modified?. This maybe the main difference between both systems, Git lets its users go trigger-happy with bashing at the history while Mercurial is more conservative.
Although... maybe this has changed a little, as Mercurial has become better at this through phases and they can protect you from an unwanted rebase (yes, there is rebase in Mercurial, see the rebase extension and the histedit extension which is now officially supported). Mercurial has less power tools, like git obliterate, still, chances are that you won't need the extra power (which IMHO, can sometimes lead to bad practices if your organization doesn't set the rules of when and why should you go at the change history).
You should also consider if the people you want to work with uses Windows, in this case I'd say Mercurial is a friendlier and more seamless experience.
Other than the previous, if you know Git you know hg (maybe with the most notable difference that Mercurial stages your changes automatically). If you know hg, you can learn Git pretty fast.
As far as repository management goes, Bitbucket is not bad at all, but I personally prefer something more governable like Rhodecode.
Finally, there is some interoperability between both systems (see HgGit and about using hg convert), so you could work with both and figure what is best for your project later. A good example is Rhodecode: the guy that maintains Rhodecode (which works well for both Git and hg) personally uses Mercurial and has a Bitbucket and a Github mirror (his main repo is in his Rhodecode instance), here are some stats:
Bitbucket mirror: 63 forks + 289 followers
Github mirror: 10 forks + 47 watchers
Don't let others hype you into something, try it out yourself and see what works for you, as you can migrate out of Mercurial into Git and viceversa if you need it.
In summary, I guess my advice would be is: keep using hg, put a github mirror, see what sticks and go with the flow.


How did Hitler get the idea for the title "My Struggle"?

Question: Are there any records elaborating on how Hitler came up with the title for his book? Were there any previous books he was emulating or alluding to? Was he influenced by some literary style in his environs? Or, does he give any account somewhere, in conversation or letters, of what thinking/gestation process caused the idea to come into his head. Why did he like it, why did he choose it for a title (perhaps there were alternative ideas for a title), and why did he settle on it?
Answer: According to Richard Cohen in the New York Times:

Its original title was "A Four-and-a-Half-Year Struggle Against Lies, Stupidity and Cowardice," but Hitler's publisher, Max Amann of Franz Eher Verlag, who had been Hitler's company commander during World War I, persuaded him to use the shorter version.

This appears to be a widely accepted fact, as an internet search of the alternate title phrase turns up many corroborating sources.

How did Hitler get the idea for the title “My Struggle”?


Restrict Access to wordpress page

Question: Basically on my website launch I will be offering users a lot of app promo codes to get apps free. However, I want to know if there is a way that I can make it so that once they have clicked a page they are unable to access any of the others and get all the promo codes basically. So once they have one they are prevented from doing any more.
Thanks,
Harry
Answer: I dont think this is possible, because you can't denie a random visitor of your website access to a page if they just read an other page.
Maybe it would be possible if you make sure visitors can only read pages if they got an account. That way you can instal a page restric plugin and edit it yourself by adding a variable that checks how many posts are read and activites the page restrict plugin when x posts are read.
Never done something like this myself, and i dont see why you wouldnt provide all your promo codes to everyone, but thats your own choise:p
I might be completely wrong, but this is what i think.
Answer: There is a wordpress plugin called S2Members to help you restrict pages/posts from guest users.

Restrict Access to wordpress page


Liquid Limit of Soil through Atterberg Tests

Question: My lab is evaluating the liquid, plastic, and shrinkage limits of some soil samples and we are following this video provided by the Missouri University of Science and Technology. The video indicates we should conduct at least 3 tests where it takes 15-20, 20-25, and 25-30 hits of the Casagrande Apparatus to close the gap that we make via the grooving tool. And this video also explains that the liquid limit is defined as the moisture content in which it takes 25 hits of the Casagrande Apparatus to close the divide made by the grooving tool.  We have been doing our best to turn our soil sample into a "uniform paste" through adding water as the video indicates, and even when that is the case, on a consistent basis, it takes fewer than 10 hits for the gap to be closed. Bottom line: My question is could there be soil samples where their liquid limits are lower than what the Atterberg Limit and Casagrande Apparatus method could detect? I do recognize the possibility of user error on our part, that we can continue to refine our technique on making the soil sample a "uniform paste." Thanks in advance!
Answer: You have to run the test at various moisture contents.  Plot the number of hits vs. moisture content and then extrapolate to 25 hits to find the moisture content at the liquid limit.
The ASTM D4318 standard should be followed.  However, there is always some operator-dependence and an alternative is the cone penetration test described in BS 1377-1/2.
Comment: Hi, sorry for the late response, thank you so much for your advice and suggestions! The test soil we have been using seemed to have a liquid limit that consistently required less than 10 hits, but fortunately our soil samples have proven to feature liquid limits that require hits between 15 to 35 hits. Have an awesome day!
Answer: According to BS EN ISO 17892-12:2018 there are three methods to determine liquid limit and plasticity index of soils. Previously, BS 1377 PART 2:1990 used the definitive method of a cone penetrometer. This method superceded the Cassagrande method after 1975 (Smith's Elements of Soil Mechanics, 9th Ed, 2014, pp11-13)

The problem with the Cassagrande method is that it is highly dependant on the person doing the test and therfore far less reliable than the cone penetrometer test.
Considering the variable results of the Cassagrande method, I would hazard a statement of "yes" because there are soils that cannot release their water content completely due to their molecular alignment and ionic bonds which are also affect by Van der Waal's (pronounced fun-dur-Varl's) forces too.


Does ChEMBL have a specific definition for what they mean with "Max phase for indication"?

Question: ChEMBL lists various properties at pages for substances. I would like to copy some of the data that resides under "Max phase for indication" over to Wikidata. For that it would be good to know the exact definition that ChEMBL uses for "Max phase for indication". Unfortunately I can't find it on their website. Is a definition available somewhere?
Comment: @Gerhard OK, I see your point. I'll retract my close vote.
Answer: This refers to the phase a compound has "achieved" in a clinical trial.
Phases are typically ordered from 1 to 4
(although phases 1-3 are most talked about, as they are needed to bring a drug to market):

Phase 1: Testing of drug on healthy volunteers for dose-ranging
Phase 2: Initial testing of drug on patients to assess efficacy and
  safety
Phase 3: Testing of drug on patients to assess efficacy, effectiveness
  and safety (larger test group)
Finally, there is Phase 4 (referred to in your example), which is
  after a drug has been approved (by e.g. the FDA or the EMEA): here,
  the effects of a drug while used on the general patient population are
  monitored.

See also https://en.wikipedia.org/wiki/Phases_of_clinical_research
Your example has been approved (i.e. it can be brought to market, or might already be available), while others might still be in ongoing clinical trials. Others might have been "killed" earlier due to e.g. toxicity or side effects. Or have not even entered clinical trials (which would be the majority of compounds).
https://en.wikipedia.org/wiki/Phases_of_clinical_research
Comment: This answer partly tells me what I already know and partly is wrong and doesn't answer the question. The "max phase" is "4 (Approved)" but that's not what's written in the "Max phase for indication" line. My example scores differently for different illnesses for the "Max phase for indication". More importantly the Wikipedia article doesn't tell me whether ChEMBL only counts FDA or EMA registered trials or whether it counts trials more broadly.
Comment: @Christian: I'd suggest emailing EBI's helpdesk in this case, as they will be the only ones who can give you a definite answer.
Comment: @Christian This post got a community bump so I'll weigh in with my understanding: Gerhard's answer seems to be right on, and I don't see anything besides numbers 1-4 in the column you are talking about. Indeed, this is different for different indications: in your example, Risperidone has been in phase 4 trials for anorexia, but only in a phase 2 trial for cocaine dependence.


How to sync files on 2 computers using an ethernet cable (offline)?

Question: I have a laptop running Ubuntu 12.04 and a netbook running Ubuntu 12.10.
I want to sync some folders from my laptop on my netbook, connecting them with an ethernet cable.
Both computers are offline, and I don't want to (eventually) share files through my office LAN.
What options do I have? Can I use Unison? What do I have to do in order to "connect" the two computers? (i.e. I have to manually set IPs on them, IPv4 settings, and so on).
Answer: You do need to set IP addresses manually, both on netbook and notebook.  The addresses must be on the same subnet.
As for the sync, you may use RSYNC over SSH to achieve this.  The command is as follow:
$ rsync -avzgroupP -e ssh origin_folder login@dst_machine:destination_folder

Pay attention to the folder notation.  If you add the / to the end of the directory, RSYNC will start to copy/put files from this point on but if you omit the /, then RSYNC will copy the folder itself and onward.
Answer: Using Timo Kluck's instruction (-> see below!) I was quickly able to set up a connection between my two laptops.
However rsync proved not to work for me like this. But I found another solution on the internet, using a adhoc http server:

On the computer where the file you want to transfer is located: cd into the directory where the file is located
then execute the command
python -m SimpleHTTPServer 8000

in the same terminal window. This starts up a simple HTTP Server reachable on port 8000 which makes accessible the files in the current folder you cd'ed to, and also the subfolders.
To transfer the file, on the other computer, in terminal execute the command
wget -r [ip of server computer]:[port number chosen above]/[file name]

where you could replace [file name] also with [subfolder1]/[subfolder2]/[file name 2] if you want to download a file out of a subfolder.

With this method I was able to get 60 - 100 MB/s.
Answer: Here's how to set up the network connection.

connect both computers using any ethernet cable.
on each computer do the following:

select your network icon and choose the 'Edit...' option
choose 'Add...' in the 'Cable' tab
in the IPv4 tab, select 'Manual' for the method, and add the data
ip-address: 192.168.1.1    (and 192.168.1.2 for the other computer)
netmask: 255.255.255.0

leave the rest empty
uncheck the box 'automatically connect'
call your new connection something like "point-to-point connection (ip-address 192.168.1.1) and choose 'Save'

select this connection on both computers
Use rsync as in fboaventura's answer

It may seem easier to just assign the ip-address and netmask using ifconfig. However, I found out that my network dropped all the time, and I think that was because of NetworkManager interfering. The method above lets NetworkManager be aware of the way you want it to be set up.


How does negative velocity and positive acceleration exactly and vice versa slow down objects?

Question: I am kinda confused how does negative velocity(-v) and positive acceleration(+a) exactly and vice versa slow down objects?
i have a thought about it please let me know if i am correct.
according to newtons first law of motion an object at rest or moving at a constant velocity will continue to move at constant velocity unless no external force acts upon it. and force causes acceleration so can i say that imagine an car moving at constant velocity in the west direction due to breakes all of its resultant force acts in the east and so that causes a positive acceleration in east and this stops the car?
and am i also correct about the brakes part, and if possible can anyone tell me about the way how brakes work according to physics and which direction is the resultant force in this case of brakes?
Answer: You seem to be confusing velocity, which is a vector, and its norm.
Newton's first law is about constant vector velocity:

constant norm: the object moves with constant speed
constant direction: the motion remains along a given direction

Newton's second law states that an object can keep moving with constant velocity either because no force is applied upon it, or because the sum of the forces is zero.
Let's return to your example of a point-like mass moving to the west. Let's define an $x$ axis oriented from east to west. It means that velocity is:
$$\vec{v}=v\,\vec{e}_x$$
with $v>0$ (at least at first). For this system to slow down, $v$ has to decrease, which means that the acceleration must be:
$$\vec{a}=a\,\vec{e}_x$$
with $a<0$ because acceleration is the derivative of velocity with respect to time, and a decreasing function has a negative derivative.
Newton's second law then states that the object must feel a force with the same direction as the acceleration, which is eastward in the case.
Generally speaking, when you want to find out whether a motion is accelerated or decelerated:

If $\vec{a}.\vec{v}>0$, the motion is accelerated.
If $\vec{a}.\vec{v}<0$, the motion is decelerated.

This result is probably more natural with kinetic energy, as this energy's derivative yields precisely $\vec{a}.\vec{v}$.
Answer: Consider a numerical example.
At time $t=0\,s$ the constant acceleration of a body is $+2\,\rm m\,s^{-2}$ due East whilst it is travelling at a velocity of $6\, \rm m \,s^{-1}$ due West.
So at time $t=0\,s$ the magnitude of the velocity of the body (its speed) is $6\, \rm m \,s^{-1}$.
Using the kinematic equation for constant constant acceleration $v=u+a\,t$ and taking the direction East as positive, after a time of $2\,\rm s$ the velocity of the body is $-6+2 \times 2 = -2 \,\rm m\,s^{-1}$.
So now the speed of the body is $2 \,\rm m\,s^{-1}$ ie the car has slowed down in the sense that its speed has decreased.


Why do certain groups withdraw/ donate electron to double bond or conjugated system in resonance effect?

Question: Why for the Resonance effect certain group of substituents/functional group donate electron from the double bond or to a conjugated system while some withdraw electron from the double bond or to a conjugated system? What causes the groups/substituent to withdraw or donate electron causing +R and -R effect?
Answer: Generally, it is observed that if there are lone pair(s) present on the atom of function group directly attached to to the conjugated system, then $+R$ effect is observed.
If the same atom has double bonds or dative bonds with another atom, then $-R$ effect is observed.
Example: –$\ce{OH}$ shows +R due to 2 lone pairs on Oxygen.
— $\ce{NO2}$ shows -R due to one double bonds between Nitrogen and Oxygen, and one dative bond from Nitrogen to another Oxygen.
Answer: Withdrawing an electron from a conjugated system is usually favoured when the withdrawing group has a higher electronegativity than the group from which the electron is withdrawn This is also termed as -M effect. For example : double bond O attached to carbon withdraws electrons

resonates to

But an atom or group containing lone pairs may also donate it's lone pair to form a coordinate (dative) bond and here elctronegativity does not matter (if the atom can accomodate another bond (like double bond O does not form a dative bond with carbon) (to help conjugation) This is also termed as +M effect. For example : OH attached to carbon donates it's lone pair to form a coordinate bond

resonates to

some groups show both +M,-M effect (which have both a double bond (to show -M effect) and a lone pair (to show +M effect)), like NH=NH, phenyl, et cetera.
Comment: This answer unfortunately suffers from the same issues as the others you recently posted. The concept is called resonance, which has nothing to do with resonating.


How to instantly change name of variable for all references in project

Question: I am working on some game in VS10, and I want to change the name of some variable, because I want to expand the game, however there is so much references to it, that I don't know from where to start. Is there any hotkey in VS10 that will do this in a moment for me? I know there is NetBeans hotkey CTRL+H, but this doesn't work for VS10.
Comment: Possibly you can right click on that variable name and try to find "refactor" sort of thing.
Comment: Visual Assist X from http://www.wholetomato.com/ will allow you to do this sort of refactoring pretty easily.  I don't believe there is a way to do it without some sort of addon.
Comment: I don't know if this works in the VC++ editor, but try renaming the variable and not moving the cursor. If a little blue box appears beneath the cursor, hover over it with the mouse and pick "Rename to ...". If there is no blue box, ignore me.
Answer: First, any variable should always be declared and used in the smallest of scope.
In VS2010, whenever you rename a variable, it will prompt you whether you want all references to this variable is to be so renamed.  A little red bar will appear underneath the name where you changed it.  Move your mouse to that bar and an icon will appear with "Options to update references to the renamed object".  You can choose between renaming all right away or with preview.
(The ability to rename all references to the renamed variable disappears when you go and rename another different variable.  Perhaps there is a way to go back to an older rename but I have not found it.)
I tried renaming a public property of a class.  The automatic renaming works too for references to that public property, at least when both are within the same code file.
Answer: As Retired Ninja said in his comment, you pretty much need add-ons for Visual Studio (like Visual Assist X).
Installing Visual Assist will give you a menu like this:

... where the "Find References" button searches for all references to that variable/function/namespace/etc and replaces it (not just a plain text search).
Other alternative is to open the "Find and Replace" window (press Ctrl+F), and click "Quick Replace". From there you can do a plain text search and replace (there's also wildcard and regex support (under "Find Options->Use:), if that helps).
Comment: In the stock Visual Studio, right clicking a variable name and you have the option of Find All References Ctrl+K,R , and it will list all references to that variable in the Find Symbol Results window.
Answer: There is CTRL+H in VS10 too. If you press it on the right side pops out panel which is basically interface for what you want to do about the modification. It has everything included, to modify that name only in the document/s which is/are currently opened, or even in the whole project. Bad thing is that replaces that name with everything it encounters, except for header name. So if I have something like fruit.h and I want to rename it in apple.h, everything will be renamed to apple.h except the name file, so it will throw an exception that aformentioned header couldn't be found.
Comment: I don't support this answer, as search-and-replace ≠ rename-a-variable. The latter is a better solution, but might not have been supported in the version of VS2010 you were using. I believe it's been a feature of Pro versions for about a decade--maybe more.
Comment: Moved this out of the question, where the asker had added it as an edit. If this is the asker's preferred solution, it should be added as an answer, then chosen as the answer.


How to factor analyze two binary variables only

Question: Normally when I do factor analysis, I have a whole bunch of variables that need to be reduced. But here I only have two binary variables (yes/no) that I need to reduce into one interval factor. Is Principle Components / Factor Analysis appropriate for this? When I do it, my extraction communalities are really high. I might need a reference to back this up with reviewers.
Answer: It is normally considered that three is the minimum number of variables to conduct factor analysis; amongst elsewhere this is maintained in the Wikipedia article (which has a reference) and in some (most? all?) statistical software.
There is no reason however that you can't do principal components analysis (which is not the same as factor analysis, although closely related) to identify which principal component explains most of the variance, even if you only have two binary variables.  The correlations between the two can still be calculated.
See for example the below, where Bin1 and Bin3 are correlated binary variables.  The first principal component explains most of the variance, and naturally is equally weighted on both of the original variables.
<code>> eg <- data.frame(
+ Bin1 =sample(c(0,1),1000, replace=TRUE),
+ Bin2 =sample(c(0,1),1000, replace=TRUE))
>
> eg$Bin3 <- ifelse(runif(1000)>.2, eg$Bin1, eg$Bin2)
> cor(eg)
            Bin1        Bin2      Bin3
Bin1  1.00000000 -0.05206971 0.8081088
Bin2 -0.05206971  1.00000000 0.1404252
Bin3  0.80810881  0.14042523 1.0000000

> mod <- princomp(eg[,c("Bin1", "Bin3")])
> ld <- mod$loadings
> attach(eg)
> plot(jitter(Bin1), jitter(Bin3), bty="l",
main="Jittered version of binary data,\nwith first principal component shown")
> grid()
> lines(Bin1, ld[2,1]/ld[1,1] * (Bin1-mean(Bin1)) + mean(Bin3), col="red")
</code>
The scatterplot of the two binary correlated variables (points are jittered):

<code>> summary(mod)
Importance of components:
                          Comp.1     Comp.2
Standard deviation     0.6722961 0.21901598
Proportion of Variance 0.9040544 0.09594559
Cumulative Proportion  0.9040544 1.00000000
> par(mfrow=c(1,2))
> plot(mod)
> biplot(mod)
</code>
Component eigenvalues, left, and biplot (loadings+scores), right:
Comment: I provided titles for your plots, please check. The line on the scatterplot seems to be a regression line (right?); if so it might be mistakenly taken as the 1st PC.
Comment: @Grrr, in addition to Peter's answer you might want to read my opinion [here](http://stats.stackexchange.com/questions/19591/factor-analysis-on-binary-data-and-summated-scales/19595#19595) (with further link there)
Comment: Yes, it's the regression line.  If I get round to it I will change it to the first principal component. Of course in this case it will be very similar, due to the symmetrical nature of the data.
Comment: Now it's been changed from a regression line to the 1st PC.  I nicked some code from a very useful blog on this topic at http://www.cerebralmastication.com/2010/09/principal-component-analysis-pca-vs-ordinary-least-squares-ols-a-visual-explination/


Car key got wet and is broken how do i start my car

Question: My car key for my Toyota Camry was accidentally put through the washing machine and now no longer works. How can I fix this?
Answer: Sorry to say but you've probably fried the electronics in the key.
If you haven't already I recommend taking the fob apart (i.e. removing the battery) and placing it in a bag of rice for 24-48 hours to ensure it is fully dried out, you can then reassemble with a fresh battery and attempt to reprogram the fob to the car, if this doesn't work then the fob is likely toast and you'll need to replace it. You can either go through a main dealer to get a new one and have them code it to the car (this is likely to be rather expensive I'm afraid) or you can try buying a replacement off eBay or similar and try programming it yourself using the steps in the above link.


Do naturally spawned animals affect the limit of animals I spawn from spawn eggs?

Question: I'm playing on Creative mode and am planning to build a farm, so I plan on using spawn eggs. If there are already animals in the world ( spawned naturally) do I have to kill them all before I use the spawn egg? Or will they not have an effect?
Answer: The use of spawn eggs ignores most of the checks for whether something should be able to spawn somewhere. In particular, no check is made for amount of mobs already spawned. You can use spawn eggs to create hundreds, thousands, or even millions of mobs in an area; the only limit will be the processing power and memory needed to handle them.
Answer: There is no mention of the spawn limit on the Spawn Egg page, and no mention of a Spawn Egg failing to create the desired mob (due to that limit).
Additionally, I know from experience (and online images) that it is possible to create vast farms (that would override the maximum for passive creatures).
Thus, your spawn eggs should perform as expected.
Answer: No, there is no limt on how many animals that you can spawn. Althouth if you spawn too many on a slow computer you may experience some lagging, etc.


How to fix 'Modifier is disabled, skipping apply' error?

Question: I've tried to answer this question: Removing Armature and Keeping pose and apply the Armature Modifier, when suddenly the  'Modifier is disabled, skipping apply' error window appeared. How to fix it, so I may apply the modifier?
Answer: Without proper settings a modifier is "disabled" as it can't perform it's task. To enable a modifier, suitable options need to be chosen - for the armature modifier that is assigning an armature to it.

Given that the modifier is not doing anything you could also delete it without effect.
Answer: Check if your viewport is set to 0. Just turn it up to see the effect of the modifier.
This worked for me for Subdivision surface modifier
Comment: I had this problem with the SubSur but not lucky. My solution was to copy the object and armature to another file and the SubSur worked. Mysterious...
Comment: That was the ticket for me.   Subsurf modifier can't work if Viewport Max Subdivision is set to 0.

Render > Simplify > Viewport > Max Subdivision


Whats the value for EDI and Jokers romance?

Question: I want them to love each other, but I fudged up and didn't get them to hook up on their own. How can I edit my save so they get together?
Comment: The usual editors have user-friendly checkboxes to select romances without need to know a value or whatever
Answer: If you are just asking about Save File Editor then you can just use the checkboxes for romance.
However if you have played ME2 then you have multiple occasions where you can basically you can convince Joker to work in co-operation with EDI. On ME3 whenever you land Citadel then talk to EDI and Joker and many times they will ask about their romance, you can give them good inputs to nourish the romantic relation between them. That way they slowly and steadily develop affection for each other.
Also in ME3 Ending, if you have enough points then you get a third option and if you select that then you get to see them being together in the end. I am not going to spoil that decision for you or the circumstances so not telling it briefly. :)


Why we don't have macroscopic fields of Higgs bosons or gluons?

Question: Why is it that there exists a classical macroscopic field of photons and gravitons but not that of $Z, W^{\pm}$ bosons, gluons or Higgs boson?
Answer: There are slightly different answers for each particle type.

Macroscopic photon and graviton fields can exist because these forces are long-ranged, which is directly related to the force carriers being massless. The $W$ and $Z$ bosons are extremely massive, so they're very short ranged and we can't see their effects on a macroscopic scale.
Another problem is that classical macroscopic fields arise from quantum fields through coherent states, which require many particles. Since the $W$ and $Z$ are so heavy, this is impossible at everyday energies.
Gluons are massless, but there's no macroscopic gluon field because the strong interaction becomes stronger at low energies, strong enough to bind color charged particles together. As a result, every macroscopic object we see has exactly zero color charge, so we see no gluon field.
The Higgs boson is massive, but there is a macroscopic Higgs field, in the sense that the field value is nonzero due to spontaneous symmetry breaking. You are, in some sense, measuring this field every time you measure the mass of an elementary particle. However, you can't make macroscopic waves in the Higgs field (i.e. excitations about the constant field value) for the same reason as the $W$ and $Z$.
Comment: While gluons have no rest mass, there is evidence that gluons acquire mass dynamically in the infrared limit and are only truly without mass in the ultraviolet limits (of course, gluons always have mass-energy). See this 2011 paper on point:  http://iopscience.iop.org/article/10.1088/0954-3899/38/4/045003/meta;jsessionid=A2A3DFE8922191345D1C95A6D967EDA9.c3.iopscience.cld.iop.org
Comment: "gluons acquire mass dynamically in the infrared limit" Whoa!
Comment: Nice answer - the only thing lacking would be a mention that the "bind" described in the third paragraph (confinement) is qualitatively different from the bound that e.g. an electron and a proton have through the electromagnetic force.
Comment: I'm not sure you can still talk about gluons in the infrared limit. The gluons appear in the Lagrangian description in the ultraviolet limit only, and if you want to write an effective theory at low energy, the "particles", ie the degrees of freedom that appear in the effective Lagrangian, have nothing to do with gluons.
Comment: Also note that photons and gravitons are stable, while W, Z and Higgs are extremely short-lived.


@Id @GeneratedValue but set own ID value

Question: I have a table with a generated id, but in some cases I would like to set it on my own. Can I, somehow, force Hibernate to ignore the @GeneratedValue?
Comment: Yes, Hibernate does not care if the id is set or not - a value is generated anyway.
Comment: This does not seem to work for me, my entity still gets a generated id, although i use merge
Comment: Don't forget to say entity=merge(entity). The returned entity is the managed one; the original one remains unmanaged.
Comment: I knew I'd seen this before somewhere: http://stackoverflow.com/questions/89439/bypass-generatedvalue-in-hibernate - use `merge()` rather than `persist()`
Comment: Have you tried it, see what happens?
Comment: @woezelmann Show your mapping and how do you save a new Entity, please. Thanks
Answer: It may be an overkill but have you thought about writing your own CustomIDGenerator which probably subclasses say the AutoGenerator of hibernate and exposes a couple of methods where you can set the id of the next class object to be generated so for example
class MyGenerator extends .... {

public void setIdForObject(Class clazz, Long id) {
    //once you use this API, the next time an object of
    //type clazz is saved the id is used
}

public void setIdForObject(Class clazz, Long id, Matcher matcher) {
    //once you use this API, the next time an object of
    //type clazz is saved and the matcher matches yes the id will be
    //assigned. Your matcher can match properties like name, age etc
    //to say the matched object
}
}

This could get complicated but at the least is possible as per hibernate doco
Comment: On the hibernate.org forums, there is a user that wrote his Generator class for this exact scenario: https://forum.hibernate.org/viewtopic.php?p=2404032
Comment: I stumpled upon this request looking for a solution to the exact same question (though I am using EclipseLink instead of hibernate).

I started using a custom ID generator but (at least in my EclipseLink scenario) there is one problem: How do I know if the object that needs to be persisted already has an ID or not?

I don't have the entity object in my custom ID generator at hand. So I can't determine if I need to generate a new ID - in case the object does not have one. Or if I just return the id the object already has (or maybe null or whatever is necessary).
Comment: Add-on to my comment before:

In EclipseLink, when creating an own Sequence generator there is a method called `shouldAlwaysOverrideExistingValue` which can be overridden. This seems to be a possible solution.
Although it feels a little uncomfortable to override things I do not completely oversee and also didn't find any documentation to other than this [bug](https://bugs.eclipse.org/bugs/show_bug.cgi?id=300556)  entry.
Answer: create your own identifiergenerator/sequencegenerator
public class FilterIdentifierGenerator extends IdentityGenerator implements IdentifierGenerator{

@Override
public Serializable generate(SessionImplementor session, Object object)
        throws HibernateException {
    // TODO Auto-generated method stub
    Serializable id = session.getEntityPersister(null, object)
            .getClassMetadata().getIdentifier(object, session);
    return id != null ? id : super.generate(session, object);
}

}

modify your entity as:
@Id
@GeneratedValue(generator="myGenerator")
@GenericGenerator(name="myGenerator", strategy="package.FilterIdentifierGenerator")
@Column(unique=true, nullable=false)
private int id;
...

and while saving instead of using persist() use merge() or update()
Answer: Although this question was asked quite a while ago, I found the perfect answer for it in this post by @lOranger, and wanted to share it.
This proposal checks if the object's current id is set to something other than null, and if so, it uses it, otherwise, it generates it using the default (or configured) generation strategy.
It's simple, straight forward, and addresses the issue brought up by @Jens, of one not being able to retrieve the object's current id.
I just implemented it (by extending the UUIDGenerator), and it works like a charm :-D
Answer: For you use case, you can manually add this no user.
One way to do it is to put the insert operation on a file named "./import.sql" (in your classpath).
Hibernate will go execute these statements when the SessionFactory is started.
Comment: @Emmanuel Bernard He said: **but, in some cases,** i would like to set it on my own. If you define how Hibernate should save an Entity (through "/.import.sql" file), so its automatic generation of identifier will not work, do not ?
Comment: No it's unrelated, import.sql is plain SQL so you can do what you want, including updating the sequence or table id if needed


What would life (some of it humanoid) be like on a planet with high amounts of silver?

Question: The planet I'm developing has iron in low supply but a high concentration of silver. The planet is habitable for humans and for story reasons the sentient race must be humanoid. Is it feasible for blood to be silver based?
Comment: What does "low supply" mean? Without easily accessible iron deposits, I'm afraid that any kind of technological development will be very very difficult. Human civilization really took off on the technological development path because we had access to plentiful iron deposits, enabling the production of cheap metal tools and weapons. Silver won't do as a replacement for iron, because it is extremely soft -- silver tools and weapons won't be very useful.
Comment: Welcome to the site, Sam! As-written, I'm tempted to vote to close this question as too broad. Right now it asks about both biology and technology - two huge categories in and of them selves. Would it be possible to edit the post to focus on one of these questions?
Answer: I'm no biochemist, but I don't think silver is a viable alternative to iron.
Silver is quote:

a very inactive metal. It does not react with oxygen in the air under normal circumstances.

Assuming your native life breathes oxygen, silver is not a suitable replacement. Perhaps your natives breathe in sulfur compounds, which would be more reactive with silver - but such an environment would likely prohibit habitability for humans. Life on a human-habitable planet seems to be confined to oxygen-breathers, unless someone else can find a clever, non-toxic-to-humans, silver-compatible biology.
In the absence of iron, you could base your blood on copper instead. We see copper-based blood on Earth in many invertibrates, incluidng spiders, crabs, and octopuses. These creatures employ a protein called hemocyanin, which produces very alien, blue blood.
Check out this picture of horseshoe crabs being bled, and marvel at the azure liquid oozing out. This stuff is medically valuable, so scientists harvest a lot of it.

Copper-based blood is a completely feasible replacement for iron-based blood. Imo, your biggest problem is explaining an iron-deficient planet.