What stars am I seeing in the daytime?

Question: I currently live in the United Kingdom, in an area where the overall elevation is high so while the hills are rolling rather than peaky, they are all well above sea-level. A few weeks ago I was on a height and the sky was crystal clear. It was around 5pm in the afternoon. The moon was almost full and very visible indeed. There were also two 'stars' visible. I didn't have time to dwell on it then but I'm really wondering now what I saw. Stars are also visible here long after sunrise sometimes. In my mind, the obvious candidates are Venus and Sirius A but after many internet searches specifically under those titles and by asking about objects visible in the daytime, it seems that there is little to confirm that they can appear in the daytime (after sunrise). I doubt these stars could be any other candidates though. Could anyone provide specifics?
Answer: It's hard to give a definitive answer to something like this, especially without more concrete information (e.g., a precise date, direction you were looking, how high above the horizon were the stars, etc.) but at the time and location you've indicated, it's possible you saw one of the brighter stars like Sirius, Vega, Procyon, Rigel, or possibly Capella.
Any planets would have been below your horizon at that time.
If you remember more specific details, you can play around with stellarium online to try and recreate your viewing conditions.
Answer: This could well be one of the planets of the solar system. Currently (April 2022), Uranus, Mercury, Jupiter, Venus, Mars and Saturn are in the vicinity of the Sun and visible only at dusk or dawn respectively. Venus and Jupiter certainly are bright enough that one may be able to see them with the naked eye if you happen to look in the exactly right spot.
At 5pm BST in Bristol/UK Venus still above the horizon, and so is Jupiter. Some of the brightest stars might be visible as well if you accidentially look in exactly the right spot with good visibility conditions (like Aldebaran, Rigel, Betelgeuze or Sirius).
Comment: Maybe. But the ISS moves quickly, so a bit hard to mistake for a star. And whether possible can only be estimated by really more detailed location information as its visibility depends a lot from it.
Comment: I wonder if the ISS could have been one of the 'stars'.

What stars am I seeing in the daytime?


Which date in 1999 was "Action Half-Life" first released?

Question: I remember briefly playing a Half-Life mod called "Action Half-Life" in 1999 in one of the few LAN "parties" I ever attended.
I have fuzzy brain pictures of a night-time city environment drenched in blue lighting, a garage, and sniper rifles.
I have made numerous searches such as <code>"Action Half-Life" original release date</code>, but search engines seem to have dropped the entire concept of returning search results that have anything to do with the search query, so I find nothing of value. The closest thing I find is the year "1999", but nothing more accurate than that.
All videos I find on YouTube of the mod/game ring no bells whatsoever. It looks nothing like I remember it from my memory. (No, I'm not confusing it with "Action Quake 2"!)
Can you help me find the exact date when this mod was first published?
Comment: [This mod](https://en.wikipedia.org/wiki/Action_Half-Life)?
Comment: @Joachim Yes. That is the one.
Answer: The first capture of the then official Action Half Life/AHL website (ahl.action-web.net - later on ahl.telefragged.com [that logo looks familiar :)]) that can be found on the WayBackMachine is from the 10th of October 1999 (here), and the first entry on that page is from the 17th of February that year, which talks about the Beta 3 version:

[...] "on to the news: There is no news. Beta 3 will be comming 'REAL SOON NOW' aka 'WHEN IT'S DONE'. I really couldn't say more than that. It's pretty stable at this point. Some annoying bugs here and there."
[...] "You will see AHL beta 3 soon. And eventually v1.0 as well."

(The 'Pre-August News' link at the bottom of the page seems to lead to earlier entries, but the WayBackMachine's earliest snapshot of that link is from 2002.)
Although February 17th 1999 is the earliest date I can find that shows activity on the mod, the mod likely already started being developed in late 1998, directly after the release of Half-Life.
The first publicly available release, however, seems to have been on the 16th of March:

"Hey Action fans. Tonights treat will certainly make you spasm. hehe
The time has finally arrived, I bring you:
Action Half-Life!
Yes, Tonight at 8 pm EST (for europeans: thursday morning 1am GMT) I will start the release party on chat.planetquake.com channel #actionhalflife. At that time I will release the last trailer, and an hour later, you will have Beta 3!
Let the games begin!"

Although this is again about the Beta 3 version, I presume this is considered to have been the official release of the mod.

A couple more useful (?) links:

The team behind AHL's Director's Cut:
https://ministryofaction.net/
An overview of the original mod:
https://web.archive.org/web/20110811061356fw_/http://ahl.telefragged.com/manual/index.html


artificial neural network for vehicular speed prediction based on volume

Question: I an trying to develop a neural network for vehicular speed prediction. my question is how can i train neural network with many input output combination of data?
Answer: I think LSTM based RNN network having series of image data with a speed label, can be useful for training such model and you can try if you get some data set. Please do share your result as well.


berkeleydbje to set authentication

Question: How to set the user authentication on my database application in berkeley db java edition.
Answer: Just saw that this question had gone unanswered. The short answer is that Berkeley DB is an embedded database. It links into your application. There is no concept of user identity or authentication within the BDB library. Authenticating and managing access to the data is a function of the embedding application. In other words, your application should authenticate the user using whatever mechanism works best for you.
In the future you may find that you get faster answers about Berkeley DB products on the Oracle Technology Network forums for Berkeley DB, which can be found here.

berkeleydbje to set authentication


adding multiple content to homepage

Question: I am very new to Drupal. I want to add multiple content to my homepage,very simple,like this structure,I need to add two contents ,Main Content 1 and Main Content 2. I am able to add Main content 1 easily, but how can i add the main content 2 below the main content 1?. Will I be able to do it from the admin panel or I will need to change the theme structure?
Answer: You can easily customize your theme depend upon your requirement
Open up your theme's .info file and you should see some regions like this:
regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second
to add a new region just type in a new one in that .info file. I'd be careful of replacing any though as there are several regions in D7 that are required.
Then you'll need to print out your new region in your page.tpl.php file which goes something like this now:
<?php if ($page['sidebar_first']): ?>

        <?php print render($page['sidebar_first']); ?>

    <?php endif; ?>

Don't forget to clear your cache or you won't see the new region. It really helps to poke around in some other D7 themes and see how they've done things also.
taken from this source http://drupal.org/node/1088718
Answer: Many ways are there to create like this.

Panels module is used to design your home page like this.
views module can create home page like this.
If you have good coding experience then you can define two region there and create two block for your content then use that block. You can use node_level_blocks to create node blocks.

adding multiple content to homepage


Is there a way to send password to the user through 'Welcome (awaiting approval)' email?

Question: I am working on a Drupal site where, i want to send an email to the user providing him with the password. Is it possible.....?
Answer: Dig into these modules and you'll find something worth (quotes included are from their project pages):

Subscriptions:

...enables users to subscribe to be notified of changes to nodes or taxonomies, such as new comments in specific forums, or additions to some category of blog. Once enabled, all nodes will have an additional link that allows the user to change their subscriptions. Users have tab on their user screen to manage their own subscriptions. Users can also set an auto-subscribe function which notifies the user if anyone comments on posts they have made. Admins can turn this on by default.

Notifications:

... This is a complete Subscriptions/Notifications Framework aiming at extendability and scalability. It allows any number of plug-ins defining new event types or subscription types or a different user interface.
Comment: The form i am using is a user registration form
Comment: alter the form and in submit function make use of http://api.drupal.org/api/drupal/includes!mail.inc/function/drupal_mail/7
Answer: Even better, no custom coding: check out the RPT module.
From the description:

This small module provides token [user:password] during user registration. Site administrator allowed to customize the text of the e-mail that is sent to the user after registration.
Answer: i dnt have exact idea about how to solve the issue just seen this text
"Drupal 7 Core itself, doesn't allow to send Mails with the generated password for the User.
As @webchick told in the specific issue: http://drupal.org/node/660302#comment-2592510 it would be OK to have a contrib module, to provide this again.
So in the user.module, the $account->password is still set, but no token for it is generated.
I thought about a single module, for this functionality, but I think inside of loggintobogan it is a lot better.
Attached a patch, which adds the token, so that it can be used inside of the mail with "[user:password]"
on the link  http://drupal.org/node/1165126 hope this would be helpful
Answer: The Registration Password Token module provides a token [user:password] during user registration. Since the site administrator allowed to customize the text of the e-mail that is sent to the user after registration, you can insert this token in the welcome email.
Caveat: Sending passwords with unencrypted email is a security hazard.  This is why Drupal does not provide this function out of the box (as noted by senior core developer webchick: http://drupal.org/node/660302#comment-2592510).
Answer: You cannot get the user's password from what Drupal saves in the database. Drupal doesn't encrypt the password and saves it in the database, but it saves in database the hash of the password, which is the value returned from a one-way function; this means that is not possible to calculate the value that originated the hash.
That is the reason why hashes are saved instead of the passwords: If somebody access the database used by a Drupal site, it is not possible to retrieve the passwords, and access that site as one of the users registered in that site.
but to invite all the user through mail i thnk you can implment it through a custom module by:

Implement hook_cron, this would builds an array containing all emails that match the criteria of your choice.

Loop through the array and send the emails via drupal_mail.


Using octal method,how do I type the exact command I would use to make test.txt have the following permissions dr-xr-x---

Question: Using octal method,type the exact command you would use to make test.txt have the following permissions dr-xr-x---
Comment: That trap question assumes that you cannot have a directory named `test.txt`. That assumption is false.
Comment: Linking/relating: https://unix.stackexchange.com/questions/183994/understanding-unix-permissions-and-file-types
Comment: A directory named test.txt is OK, but d for a file is not possible. read man chmod
Answer: If test.txt is a text-file, you cannot do this.  If it happens be be a directory:
chmod 550 test.txt

Answer: Normally I skip orders that are not questions; but in this case here is exactly what you ordered, using the octal method to type out to a TTY the exact command that I would use.$ printf '\151\156\163\164\141\154\154\040\055\144\040\055\155\040\060\065\065\060\040\164\145\163\164\056\164\170\164\012'
The point where you understand this by yourself, with no further explanation, is the point where Unix shell scripting is becoming second nature.  ☺


hibernate results join left

Question: I've stack over one small thing:
I have two tables in database, which are related - User and UserReference.
In UserReference i have field userid, which is related to id in User.
i have query to mysql with join left:
<code>"FROM User as user left join fetch user.userReferences WHERE login='"+login+"' or email='"+login+"' AND password = '" +password+ "'" ;
</code>
The query is ok and i get results.
I send the results to controller, changing it into list: query.list();
In controller i receive the results and push it into user list.
From the user list i can get info from table User
In table User there is:
<code>@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
public Set<UserReference> getUserReferences() {
    return this.userReferences;
}
</code>
And now - i want to get data from table UserReference which are in user list, becouse my query have JOIN.
How can i do it?
i was trying to do something like this:
<code>List<UserReference> userReference = (List<UserReference>) user.get(0).getUserReferences();
            System.out.println(userReference.get(0).getAge());
</code>
But it doesn't work.
Can you help me ?
Answer: You can't cast a Set to a List,  iterate over the Set to get userRefences instead.

hibernate results join left


how to email username and password to admin of new registration

Question: How can I send username and password of new registration to admin using email.
Answer: You can use an action to do that, but you can't get the password because it's encrypted, unless you catch the password when the registration form is submitted but that's not a good practice.
Why do you need to get the passwords on admin email?
You can always reset password if the user forgot the password.
To send user information when a new user is registered:
add_action( 'user_register', 'send_new_user_info_to_email', 10, 1 );

function send_new_user_info_to_email( $user_id ) {

    $user_info = get_userdata( $user_id );

    $to = get_bloginfo('admin_email');
    $subject = 'New User';
    $body = 'User email:' . $user_info->user_email . '
User pass (encrypted):' . $user_info->user_pass ;
    $headers = array('Content-Type: text/html; charset=UTF-8');

    wp_mail( $to, $subject, $body, $headers );

}

Answer: You cannot send passwords via email because Wordpress encrypts them prior to storage. That's a behavior that can be changed, but you really shouldn't do it. If the admin needs to log into an user's account, you could code something using the wp_set_current_user function, or you can use the User Switcher plugin.


How can I synchronize my Funambol with Thunderbird / Lightning

Question: Under Windows a simple Addon exists with wich I can sync my funambol events and contacts with Thunderbird and Lightning. I couldn't find such a tool for Ubuntu yet but it would be very helpful for me.
Answer: AFAIK, there are only "inofficial" builds of the Funambol add-on for thunderbird. Take a look at memotoo.com's site, there are build for Windows, Linux 32/64 bit and even OS/X. The site is in german, but you can set the language to english using the controls at the very top of the page.

At the first page, look for the buttons to select your application (you may have to scroll until you get the thunderbird icon):

Click on thunderbird icon to get the download links displayed:

Now, just download the add-on that matches your thunderbird and ubuntu version (32/64 bit). There's even a short documentation how to install the add-on (of course, you'll have to adapt the url to point to your funambol provider).

I'm using those add-ons with lucid, oneiric and with Win7 - works like a charm!
Comment: @AndreaBorga: personally, i've dropped funambol and moved to a simple, small caldav/carddav server: [baikal](http://sabre.io/baikal/) - i can strongly recommend it! No need for a thunderbird plugin regarding the calendar; only the address book needs an addon to access the carddav data.
Comment: @AndreaBorga: i'm using the SOGo connector: https://sogo.nu/download.html#/frontends (SOGo Homepage -> Download -> Frontends -> Mozilla Thunderbird, Connector, currently version 31.0.5).
Comment: is there an alternative to funambol these days? They have sadly dropped their support for synching devices...
Comment: Thanks for the tip @tohuwawohu, which add on do you refer to for the phonebook?


A strategy question regarding content types vs. basic pages plus taxonomy/tags

Question: I'm having trouble deciding what makes more sense. I am building a somewhat simple site and so far it seems fairly straightforward to use the basic page content type for nearly everything and add a field for taxonomy (to associate the page with the categories of the main menu) and if needed, tags to further categorize the pages for various views and lists. But is that the best strategy? The end-user is going to have to remember to choose a taxonomy term for each page, and choose the right one. If a tag is needed, they are going to have to remember to add a tag and spell it correctly. People are notoriously unable to do simple things like this without making mistakes. So, would it be better to create separate content types for each main menu category, even if they basically are the same basic page content type? If I did separate content types, I wouldn't have to ask people to select an item in the main menu taxonomy. I would still have to ask them to tag some of the content types, but I could leave that field off for those content types that don't need tags. But then I'd be faced with having to instruct the end-user to select the correct content type before creating a new page.
What is your opinion? Is there a better strategy among these choices or perhaps even another choice I didn't consider?
Answer: You could use radio buttons for your 'content type' taxonomy terms and make it required.  That way your user sees all the content types available and has to pick one.  For your free tagging, you might be able to use a module like Active Tags to make it a bit more accurate as well.


Using one baked texture uv map for other objects of the same overall geometry

Question: I have multiple objects that are walls, all using the same texture, do l have to bake a separate UV map for each or can l reuse the first map, and then apply it to each other wall, there is a link object function, tried it, but only transferred the material not the t baked texture.
regards
Answer: Answer:
1. -name all textures
2. -select object you want material assigned to
3. switch to edit mode on the selected object.
4. go to the materials subsection on the tools bar
5. select material you want on the object
6. press assign - and the material is assigned to the selected object -
material is assigned to the object, and can be viewed in the texture view..
repeat as many times as required.
QED


No respawn screen [how?]

Question: I'm creating a pvp arena map and it's really boring to die and having to press the respawn button over and over and having to go thought the respawn lag etc. How do people get teleported in their spawnpoint when their health is 0? Like how hypixel does it? When you get killed you go staight to your respawn point, no death screen, nothing
Comment: They do it with mods.
Comment: what kind of mobs?
Comment: Mods with a D. And I don't know. Ask the owners, I guess.
Answer: If you didn't want to use a mod, you could just say that having a half heart is effectively dying and teleport them then. To do this, you'd need to run a function (in a datapack, which works well for maps) every tick which checks a scoreboard set to track all players' health and, when the value is 1 (.5 hearts) give them a potion of instant healing and tp them to the location you want for the spawnpoint:
execute as @a[score={health=..1}] at @s run tp @s <position to spawn at>
execute as @a[score={health=..1}] at @s run effect give @s instant_healing 10

I apologize for any syntax errors I made. Note that if a player gets dealt enough damage to put them over the edge, such as receiving n damage at 2 to n health, they will die. This at best will stop some people from having to go through the respawn screen, but the majority would die. To intercept this you'd need mods, as mentioned above, or maybe a plugin, as dying is a coded-in feature. Also, you'd need to set up the health scoreboard like this in a load function: scoreboard objectives add health health.

No respawn screen [how?]


SharePoint syncing but not showing green icon

Question: I have SharePoint documents syncing with my PC but I can't see the green icon which means synchronizing happened or happening. What can be the issue why I can't see that check mark green icon in my PC in SharePoint folder?
Answer: Update the registry to give priority to OneDrive for Business to see the green Overlay . Priority is based on the alphabetical order of the entries. Use this workaround if you want to enable OneDrive for Business to show its icon overlays. This workaround will suppress other icon overlays from other programs, and some programs in future updates may re-suppress OneDrive for Business icon overlays.
try this easy fix Out  Sync icon overlays are missing from OneDrive for Business synced items


Display 3D wireframe over 2D texture on Photoshop?

Question: I have a .obj file with a 3D object and a .tga one with the texture. If I open the .obj in Photoshop and load the .tga as diffuse texture, everything looks fine, but I am having some hard time editing the texture, Specially finding the edge borders.
What I would like to have is, the lines I can see when choosing the "Wireframe" preset on the 3D scene, I would like to see them as a plain 2D over the .tga texture, so I would know where each edge of the 3D object is corresponding to the texture.
Is there any way to do this?
Answer: Yes. Open the 3D file, then open the texture by either clicking on it in the Layers panel or selecting the material in the 3D panel, then in the (Material) properties, click on the icon next to Diffuse and select Edit Texture. The properties panel should now show the painting options, in which You can check UV Overlay to show the vertices (edges) and change the color and opacity.
Bonus: If you open the (Photoshop 3D) file (and material texture) and have the two images side-by-side, when you move the paintbrush over the model, crosshairs will show up on the texture—the same works for painting on the texture (showing crosshairs on the model).


Can a player-controlled Dire Wolf carry another character in its mouth?

Question: A druid in my game can wild shape into a Dire Wolf, which is really handy when you want to run the hell out of somewhere. The question is, can a large beast pick up a willing human in its mouth? Can it run with said human in its mouth? Can it dash? I can't really figure out if there are rules set in place for this or if this gets very much into the realm of house rules.
Answer: It should be possible
Carrying another creature should just be a grapple. To my knowledge, there aren't really rules on "attacking" a friendly creature, but it would be reasonable to guarantee a success on an unresistant target. While grappling, remember that your speed is reduced by half, unless of course you happen to be carrying a small creature (two sizes smaller than a large dire wolf). By RAW, you do not need to take any action to sustain a grapple, so subsequent turns could be used dashing, although your speed is still halved by the grapple. You can release the held creature at any time with no action cost.
Rules for mounts are currently slim (I expect more will be featured in the DMG). What I can say is that a horse is a large beast, and so is a dire wolf. This would imply that a dire wolf could be mounted by a medium creature. However, without a saddle, you will not have advantage when making checks to remain mounted, so if wolf-riding becomes a thing, the party may want to invest in a special saddle.
Comment: +1, grappling is a really neat solution to this problem.
Comment: I think this answer goes in the right direction. Trying to imagine it now I can't really think of how a dire wolf would drag a 150lb character 25' in 6 seconds without doing some damage, but it gives me some ideas. Maybe throwing the character over it's back, requiring some sort of dex save or acrobatics check, and riding is an option. Game night is tomorrow, lots to think about...
Comment: Was more featured in the DMG?
Answer: You can work out the carrying capacity of a creature by its size and strength.
From the Player's Basic rules v0.2, p.60:

Carrying Capacity. Your carrying capacity is your
Strength score multiplied by 15. [...]
Size and Strength. Larger creatures can bear more
weight, whereas Tiny creatures can carry less. For
each size category above Medium, double the creature's
carrying capacity and the amount it can push, drag, or
lift. For a Tiny creature, halve these weights.
Variant: Encumbrance
[...]
If you carry weight in excess of 5 times your Strength
score, you are encumbered, which means your speed
drops by 10 feet.
If you carry weight in excess of 10 times your
Strength score, up to your maximum carrying capacity,
you are instead heavily encumbered, which means your
speed drops by 20 feet and you have disadvantage on
ability checks, attack rolls, and saving throws that use
Strength, Dexterity, or Constitution.

As to the practicality of a creature carrying a person in its mouth, it's not specifically mentioned anywhere, as far as I know.
Another option is having the person ride the Dire Wolf. Though I can't find a rules reference, I believe you can ride creatures one size category larger than you. Humans being Medium and Dire Wolves being Large, this should be possible.
Comment: I would have thought that a Large creature is more likely to *drag* a Medium creature in its mouth than *carry* it. This is liable to cause loss of hit points. Riding would be a far more dignified way to travel by direwolf, if one is conscious enough to manage it...
Comment: Yeah riding would be the way to go, but this strategy has so far been used to evacuate dying characters. You're right about losing hit points though... I might end up ruling that this is not a valid strategy, or at least not one that doesn't hurt the dying player a little bit more.


An analogue of CH for proper classes

Question: Working in NBG set theory, with AC but without Global Choice, we ask for two proper classes A and B such that A strictly injects in B and B strictly injects in P(A); so
Question: In NBG set theory, is it possible to have two distinct proper classes A and B such that A injects in B and B injects in P(A), but P(A) does not inject in B and B does not i ject in A ?
Gérard Lang
Answer: From the answer given by Ali Enayat to my question "Bijective equivalent collections of proper classes in set theory" on 14/04/2013, we see that there exists a model of NBG where the proper class P(On) is such that:
(i) On injects into P(On), that itself injects into P(P(On))=V, but
(ii) V=P(P(On)) does not inject into P(On) that itself does not inject into On.
So that the answer to the question is positive.
Gérard Lang
Comment: It would help to give the answer in the form A=..., B=....

An analogue of CH for proper classes


How to open a Ruby file in terminal?

Question: I have a ruby file saved on my desktop as test.rb.
How can I open it with terminal?
I have already tried to use /home/desktop/test.rb and what I get in response is bash: /home/desktop/test.rb: No such file or directory.
Answer: You can use the ruby command, which calls the Ruby interpreter on your file:
ruby ~/Desktop/test.rb

This way you don't need to make your file executable.
(The tilde symbol ~ is a shorthand for the path to your home folder which is /home/<your-username>.)
If you still need to make your script executable I hope you remembered to type the shebang line on the first line of your script:
#!/usr/bin/ruby

then run chmod +x ~/Desktop/test.rb on the terminal to make test.rb executable.
Comment: If this post answered your question, please mark it as the answer.
Answer: /home/<username>/ is the path of your home-directory. If you start your Terminal, your Shell starts in your home-directory, you can print that path with the command
$ pwd

The you need the path of the Desktop-Folder, try it with
$ ls

Your final command than will probably look like that:
~$ ./Desktop/test.rb

But you should try a tutorial for the Linux shell, like this one: LinuxCommand.org
Comment: Thank you, but it says access denied, what can I do?
Comment: The file isn't executable. Try `chmod +x ./Desktop/test.rb` and after that try to execute the file again. If you want to know more try `man chmod` (can be closed by tipping 'q')
Answer: Your home directory is /home/<your username>/. Your Desktop is /home/<your username>/Desktop.
You forgot the <your username> part of it.
Comment: That didn't quite work.

How to open a Ruby file in terminal?


How can I open Wifi Connection System Dialog?

Question: I want to write a application list AccessPoints and when you click one, a wifi connection dialog will open. I searched in the Internet and found some hint:
startActivity(new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)) – But I can't do it. Please help.
Comment: Try posting more information on what "can't" means. Some idea of what you you want, and how you intend to do it. Would help.
Answer: You can start wifi settings intent using
<code>startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
</code>
Comment: Documentation says: > "In some cases, a matching Activity may not exist, so ensure you safeguard against this."
Answer: There is a Settings activity called WifiSettings, iirc. Launch that activity and it will present the user with a list of open access points, their current power settings and some other misc. stuff.
It appears you're trying to duplicate the functionality of the Meraki WifiStumbler, too -- take a look at that app for ideas.


C# (Windows Phone) Facebook get info

Question: How do I get other info from the user like location, birthday, or gender? I'm using this code as a guide for the project that I'm doing. http://windowsphoneaalto.org/2012/01/facebook-get-information-about-the-user/
I was able to get the user's id and name but I can't get the other information. I tried getting the user's location by adding, string location = result["location"].ToString();
I ended up getting a null value and a keynotfoundexception. This is the piece of code that I'm having issues with.
<code>void _fbClient_GetCompleted(object sender, FacebookApiEventArgs e)
    {
        //Turn the data into Dictionary.
        //If you want to see what the Facebook is returning you can check it
        //with this tool provided by Facebook
        //http://developers.facebook.com/tools/explorer/?method=GET&path=me
        var result = (IDictionary<string, object>)e.GetResultData();
        //Get the ID value
        string id = result["id"].ToString();
        //Get the name value
        string name = result["name"].ToString();
        //Currently the thread running this code
        //is not the UI thread and only UI thread can update
        //UI. So we are calling the UI thread here.
        _page.Dispatcher.BeginInvoke(() => {
            MessageBox.Show(name + " (" + id + ")");
        });
</code>
Answer: As far as i remember you'll need to add that to the facebook apps extended permission and then ask the user to give you the rights to share those details.
Look more for extended permission on facebook will solve your problem

C# (Windows Phone) Facebook get info


Medieval weapons in a steampunk world?

Question: In a world where people have Steam technology, and Airships, how would a society come about having such technologies, yet still mainly use medieval weaponry and fight in pitched battles in the absence of firearms? (If it's even possible at all)
Comment: Just keep chivalry alive. It almost kept the longbow from the battlefield after all.
Comment: @Bookeater and the crossbow too
Comment: No gunpowder? [No problem!](http://web.mit.edu/2.009/www/experiments/steamCannon/ArchimedesSteamCannon.html)
Comment: By not developing gunpowder? Unfortunately all components of it are fairly difficult to vanish. But other explosives require better chemistry, so they might not be invented before steam.
Comment: If I understand it correctly, your question boils down to could advanced steam-based technology predate gunpowder-based weapons? If that's the case, you might clarify your question a bit :)
Answer: Without having a bit more background information on the setting described other than 'steam punk with airships' I'll have to give you a few vague answers, rather than being able to pinpoint a more exact explanation.
I would think that using gunpowder or firearms on an airship would range from insane to borderline suicidal, seeing as a fire would be even harder to put out in the sky compared to a traditional sea faring ship. Even more so if the ship uses any kind of flammable material for buoyancy. Steam powered projectile weapons or pellet guns that use air pressure (and require an attached steam pressure engine) may be too bulky or cumbersome to bring on an airship where you have an exact weight limit beyond which the ship cannot leave the ground.
Having weapons that specifically cannot be used on airships may be enough of a deterrent that they are not deemed to be practical weapons, if airship to airship sky battles are the primary form of warfare in your setting.
Alternately, seeing as steam power is a different tech tree than our own, it's entirely possible that firearms were either never invented, or simply not perfected to the point that they have been in our own real world history. If the only known explosives recipes in your setting are even slightly less powerful, or less predictable, firearms may simply be out of reach until those discoveries are made.
Another possibility, in a world that relies on steam power, high quality metals may be in a high enough demand that it may simply be easier to make cheap iron swords, and wooden bows, rather than expensive finely crafted firearms, and the complex chemicals needed for gunpowder.
Comment: If the airship has a steam engine, gunpower would pose very little **additional** fire hazards.
Comment: +1 for the "high-quality metals in too high demand from steam-gadget engineers to use them for weapons"
Comment: @o.m. I hadn't thought of that, but then gunpowder is still more volatile and sensitive than coal, right? Having multiple sources of possible fire outbreak in an airship would be a major threat if it is ever used in combat.
Comment: The coal burns under normal use of a steam engine, which makes the fire hazard inevitable on any steam powered flammable vessel. Measures needed to deal with that would also protect against any fire hazards from gunpowder. <- my guess what @o.m. intended, possibly entirely wrong
Comment: @VilleNiemi, that's what I meant, except that I didn't explain enough. Compare the fire measures on the Hindenburg, from designated smoking areas to special kitchens.
Answer: There are a few methods for what you want to do. One or a combination can be used.
A) In our world, east Asian is generally accepted as the first location where gun/black powder was first weaponized. This tech spread west via trade, diplomacy and conquest.

You could simply have the culture that learned to use black powder as a weapon either isolated, wiped out or completely refusing to share their knowledge.

B) A disaster. Nothing like a horrible event to get people behind outlawing what was blamed for it.

You could have the "Incident of Blank", "The Blank Disaster of Year" or something similar. (Example: an arsenal exploded and killed numerous important people putting the economy in a tailspin or wiped out a major city). This event must be horrible enough or through propaganda, made to seem horrible enough for people to call for a ban on black powder. Earlier incidents and accidents could be used to further bolster prohibition.

C) Unavailability of a component of black powder.

Charcoal and sulphur would almost be impossible to not exist in a Steam Punk World (or almost any setting for that matter). But pottasium nitrate, aka salt petre, would be easier to at least limit. Guano from bats and birds was the oldest most prevalent natural sources of pottasium nitrate. It is also found in trace amounts in some caves, manure and urine. Though it sounds harsh, just have all most birds and bats extinct or very rare in your world. Maybe an earlier "gun powder craze" led manufacturers to capturing the animals and through their mistreatment or disease died off completely or to near extinction.

The other advantages if using one or more if the above would be additional storyline/plot elements.
-Who was behind the "Blank Disaster of '97"?
- What culture possesses these near legendary weapons that belch fire, lead and steel? Will they leave their homeland and seek to conquer the world?
- Are there any birds/bats left? Where are they?
-A company found the pkans to making blackpowder weapons but need a large salt petre (potassium nitrate) source. Where? And howcan this be done without being investigated by the Crown?
Adventures could center around some or more of these questions.
Hope this helped.
Comment: Nice answer Rex.  Welcome to the site.  Check out the [help] and feel free to join us in [chat]
Answer: By having a strong dislike of gunpowder
This is pretty simple to craft: In your Steampunk world, Airships are the primary military superweapon. Popular fiction and entertainment heavily draw from their lifestyles. Since they are the main component of your military doctrine, weapons and equipment must be designed around their limitations.
Modern airships are filled with Helium. Helium provides the lift/buoyancy of an airship, with the steam engine providing thrust. Helium is used because its not flammable. However, if a society or culture do not have helium and fill its airships with Hydrogen instead, then things get interesting. I recommend reading up to what happened to the Hindenberg for a good example.
Thus storing and using gunpowder based weapons on an airship is seen to be highly dangerous and undesirable. The alternative: Steam weapons. We've seen these things in movies and comic books.
A steam powered machine gun may be a good idea if mounted on an airship or vehicle, but you will never make them practical enough to be man portable. Contrast this with modern firearms: A modern firearms has the advantage of using cartridges, in which both the projectile (bullet) and propellant are housed together as a single unit in a very convenient package. with a steam powered weapon, the user must carry both the weapon and projectiles (say in a magazine), and a backpack containing pressurized steam (to propel them at any speed that is practical enough to use as weapons). These things will be heavy, cumbersome, and not able to fire a whole lot of times.
Therefore, its logical to propose that close range military action (say boarding an enemy airship) will still be done using cutlasses and pikes. With high ranking officers having a gunpowder handgun or two. Support fires will be provided by crew served mounted steam powered weaponry.
I suppose you can make gunpowder widely available to land based artillery forces, but they are very specialized and not available to the wider military/public.
Comment: I would draw the analog to heated shot on wooden warships.  Land batteries frequently used red-hot heated shot, but it was impractical to use frequently on warships, precisely because it was hard to keep that much kindling and keep a furnace that hot, and it was dangerous if mishandled.

Medieval weapons in a steampunk world?


Pineapple store bought can pops when opening, is it safe?

Question: When opening a store bought can of pineapple, it popped loudly.  Is it safe to eat?
Answer: Define "popped"...
In short, the "pop" has to do with different pressure inside and outside the can. Once the can is unsealed or pierced, the pressure evens out, resulting in a sound.
The question that remains is why there was a difference and to guestimate, how much.
A slight difference is fine - probably because the conditions (temperature, pressure) were slightly different at the factory than in in your kitchen.
But there is the - admittedly rare - case where the contents of a can weren't properly pasteurized / conserved. In these cases, bacterial growth might happen, resulting in excess pressure that makes a distinct sound. The food inside may or may not smell "off". There are bacteria like Clostridium botulinum that thrive in anaerobic conditions and produce a tasteless but dangerous poison. So if a can appears bulged or shows signs of excess pressure when opening (or glass jars loose the vacuum seal and don't "pop") it's absolutely advisable to discard the contents.
That said, your pineapple is probably at a very low risk as botulism is way more likely in protein-rich foods like meat, fish and legumes but only you were there when you opened your can and can make an informed decision.
And always remember rule no.1 of food safety:
When in doubt, throw it out.
Comment: Upvoted, comment below Q removed...
Comment: @Fabby Thanks. It's just that we usually play it *very, very safe* here and leave it to each user's discretion how to handle his or her specific situation and make an informed decision. It's like driving without a seatbelt - most likely you will arrive fine, stastistically speaking, but I don't want to be the person who had told the accident victim not to bother with the thing....
Comment: To be specific, if it popped because air was rushing in, that should be fine. There should normally be a bit lower pressure inside, and that difference could be increased if you opened it somewhere significantly colder than the temperature it was canned at. (Homemade canned goods make a sort of suction pop when you pry the lid off, and that's definitely a very good thing.)


Exact statement of the Radon-Nikodym Theorem

Question: I am a bit confused about the exact statement of the Radon-Nikodym Theorem. Suppose that in the usual setup, $v \ll u$. Does it require both $v$ and $u$ to be sigma-finite, or only $u$ to be sigma finite for the theorem to hold?
Answer: You need both measures to be $\sigma$-finite. Suppose you have the collection of Lebesgue measurable sets on $[0,1]$ and let $\mu$ be the counting measure. The only set of measure zero with respect to $\mu$ is the empty set, so every measure is absolutely continuous with respect to $\mu$ and you can show that there is no nonnegative Lebesgue measurable function $f$ on $[0,1]$ for which
$$
m(E)=\int_Ef\,d\mu
$$
where $E$ is any Lebesgue measurable set on $[0,1]$.
Comment: Please clarify one thing. In your answer, the counting measure mu is not sigma finite, so I cannot see how that answers my question. Actually, I am looking for a counterexample, where only mu is sigma finite, nu is absolutely continuous w.r.t mu, but not sigma finite, and the Radon Nikodym Theorem fails.
Comment: You need both measures to be $\sigma$-finite. The counting measure is not $\sigma$-finite and every other measure $\nu$ is absolutely continuous with respect to $\mu$. In particular, the Lebesgue measure is absolutely continuous with respect to $\mu$. So if the Radon-Nikodym result holds in this case, we should be able to find a Lebesgue measurable function such that $m(E)=\int_Ef\,d\mu$, but this is impossible.
Answer: Only $u$ must be $\sigma$-finite. $v$ can be any (signed) measure. The result is proved in Section 2.2 in Ash and Doleans-Dade's book Probability and Measure Theory (2nd edition, 2000).
As a simple illustration, let $\Omega$ be some set and consider the trivial $\sigma$-algebra $\mathcal{F} = \{\emptyset,\Omega\}$. Suppose $u(\Omega) = 1$, $u(\emptyset) = 0$, $v(\Omega) = \infty$ and $v(\emptyset) = 0$. Obviously $u$ is $\sigma$-finite, $v$ is not $\sigma$-finite, and $v$ is absolutely continuous w.r.t. $u$. We can express $v(A) = \int_A g d\mu$, $A \in \mathcal{F}$, where $g = \infty$ is the Radon-Nikodym derivative of $v$ w.r.t. $u$.
The Lebesgue Decomposition Theorem requires both measures to be $\sigma$-finite.


What are these "O-Power" things?

Question: What are O-Powers? How many of them are there? And what do they do? There's a small explanation on the screen, but there's also a meter at the bottom. What does that do?
Answer: O-Powers can be thought of as skills used by the trainer instead of his/her Pokémon.
Unlike a Pokémon's PP, the trainer's energy restores over time. The amount of energy available to use an O-Power is represented by the number of orbs in the bottom bar.
O-Powers can level up when used often. Higher levels mean greater effect, but also greater costs to use.
It is currently unknown how many O-Powers there are in total, but here are the ones I've found so far:

3 minute powers1

Bargain Power: Poké Marts begin a bargain sale in which everything is x% off.a
Prize Money Power: Increases the prize money from battles.
Exp. Point Power: Increases the Exp. Points from battles.
Capture Power: Increases the chance to catch Pokémon.
Encounter Power: Increases the chance of encountering wild Pokémon.b
Stealth Power: Decreases he chance of encountering wild Pokémon.b
Befriending Power: Helps Pokémon grow friendly faster.

Instant powers

HP Restoring Power: Restores the HP of the lead Pokémon.
PP Restoring Power: Restores the PP of the lead Pokémon.

Battle powers2

Attack Power
Defense Power
Sp. Atk Power
Sp. Def Power
Speed Power
Critical Power: Raises the critical hit ratio of the lead Pokémon during battle.

New powers are given to you by a man calling himself <code>[...] Mr. Bonding, the expert on O-Powers.</code> He is usually found in hotels or Poké Centers.

1: Including time spent in combat
2: Only active for the next battle. If more than one are used at once, the effects will be added progressively each turn, e.g: the Pokémon receives an Attack boost during round 1, then a Defense boost during round 2 and so on.
a: x% is 10% for level 1.
b: Cannot be given to others.
Comment: @MadaraUchiha When you encounter another player over Streetpass, or when you're online, you can see a list of "Passersby". There is also a list of "Acquaintances" and "Friends". You can buff anyone that appears in those lists.
Comment: What does "Cannot be given to others" mean? What can be given to others?
Comment: @MadaraUchiha "Giving" an O-Power to someone else is like buffing him/her. Basically, 2 players buffing each other can profit more, than if they used their O-Power on themselves.
Comment: 2 players? I can play with two players? :O How? (Or are you talking about my Friends list?)
Comment: O-Power energy regenerates faster if you have taken steps during the day and it increases up to 4x regeneration rate.
Comment: You can save O-power energy by using it on yourself, then your friends tap on you followed by "Receive O-power". Taking it in turns to be generously selfish will increase the total time you all can be buffed. However this method will slow your O-power leveling so it is best reserved for level 3 powers.
Answer: O-Powers are temporary buffs that you can give to yourself or other players. They have different effects ranging from increased chance for capture to HP restoration. Each O-Power use costs a certain amount of energy, which regenerates over time. Using O-Powers on other people costs less energy than using it on yourself, meaning it's much more efficient to buff other people.

What are these "O-Power" things?


How to disambiguate predictor and predictor variables?

Question: I'm using generalized linear models and generalized nonlinear models in a modeling project, so I refer to the final predictor simply as the predictor. But I find that this is confusing and unclear, as you can also refer to the predictor variables as predictors. Is there another way to refer to the final predictor, or any other way to distinguish the final predictor and predictor variables?
Comment: I think @IsabellaGhement's answer (+1) addresses your concern quite well. Another word you could use is: *prediction machine*.
Answer: I think it's a bit odd to talk about the "final predictor".  Usually, one talks about the "final model" and then elaborates on what predictors were included in that model (relative to the "initial model").
You may find the post available at https://www.theanalysisfactor.com/whats-in-a-name-moderation-and-interaction-independent-and-predictor-variables/ interesting.  The post talks about the terminology "predictor variable" and mentions that there are many subtypes of predictor variables.
If your models are used for prediction, then the terminology "predictor variable" certainly makes sense.  If they are used for explanation (i.e., to uncover and quantify associations), perhaps you could use the terminology "explanatory variable" instead of "predictor variable". If they are used for both explanation and prediction, you could revert back to the "predictor variable" terminology.
In any event, if you make it clear what predictor/explanatory variables you started out with in your "initial model" and what predictor/explanatory variables you were left with in your "final model", there should be no confusion.
Comment: Right, actually that's not what I meant by 'final predictor', but it's probably poor expression on my part. I'm not starting with a full model then reducing it to get a final model, I'm simply refering to the predictor that you get from applying a function to predictor variables
Comment: I see...Then maybe just call it the "transformed predictor" and explain what transformation you used. For instance, if your original predictor was "age" and you log-transformed it prior to including it in your model, then call it "log-transformed age".  If the transformation is more complex, just call it the "transformed predictor".


What is the word for the movement you make when you give someone your hand?

Question: When someone falls down and you give your hand to her but she doesn't hold your hand, what's the proper word for the gesture you've done. You extend your hand? Is "extending a hand" right usage as a verb? Is there a better saying for the movement that you make when you are giving your hand to someone?
Comment: You "offer" your hand.
Comment: Welcome! *Extend* is perfectly fine. You could also say you *hold out* your hand.
Comment: A quick, decisive movement is sometimes described as "thrusting out your hand." Other options are more appropriate when the extension of the hand is less vigorous.
Answer: Both extend and offer are correct and current usage.

"As we were walking I offered her my hand."
"I offered my hand and he shook it."
"I approached him and extended my hand."
"He stared at me for a moment and then reluctantly extended his hand."
Comment: 5 hours before I read the question and thought about an answer, you read my mind and typed the answer.  Kudos for that.
Answer: "Extending your hand" is indeed correct, understood exactly in this way, and of long use for precisely this. At least one dictionary even lists "extend your hand" as a phrase with precisely that meaning. The OED doesn't, but does have a definition:

To stretch forth (the arm or hand). Also, to hold out, put forward (a staff, etc.).

And includes examples of Shakespeare and Dryden using it in this way.
All in all, you couldn't ask for a more apt word choice.
Answer: "Hold out a hand" is one good option I don't see mentioned here. It's more casual and natural than extend or offer.
Here's an example of the exact situation you described:

Renly held out his hand to help Margaery to her feet.

But it can also be used when offering a hand to be shaken:

Alfred held out his hand. Jack hesitated momentarily, then shook it.

This last use is more frequent, but that's just because people shake hands more often than they help each other up.
Answer: Reach out is a useful expression:

Lit. to extend one's grasp outward.

He reached out, but there was no one to take hold of. I reached out and grabbed onto the first thing I could get hold of.
Comment: Nice phrasal verb. I love the example given, very original and refreshing. Used this way, the expression also adds a subtle touch of intention to the action, as in 'I need help' or 'I offer help', as opposed to simply alluding the physical act.
Answer: I suggest proffer.
OED has it as a verb : Hold out or put forward (something) to someone for acceptance e.g. he proffered his hand
and as a noun : (literary) an offer or proposal.


How to remove an account from Google login options?

Question: When I am in the main screen where I get to choose which account, it does not give me the option to remove an account. When I click the arrow, it just signs into that account.
Comment: Ah. You don't actually want to delete an account. You're just looking to remove one of the options from the multi-logon screen, right? You need to log out of all accounts and then re-login to the ones you want. There was a similar question here recently. Let me see if I can find it.
Answer: On the main screen, click "remove" (in the bottom) and then it will ask you which account to remove from the list (x marked next to it).


The error of the natural logarithm

Question: Can anyone explain why the error for  $\ln (x)$ (where for $x$ we have $x\pm\Delta x$) is simply said to be $\frac{\Delta x}{x}$? I would very much appreciate a somewhat rigorous rationalization of this step. Additionally, is this the case for other logarithms (e.g. $\log_2(x)$), or how would that be done?
Answer: Simple error analysis assumes that the error of a function $\Delta f(x)$ by a given error $\Delta x$ of the input argument is approximately
$$
\Delta f(x) \approx \frac{\text{d}f(x)}{\text{d}x}\cdot\Delta x
$$
The mathematical reasoning behind this is the Taylor series and the character of $\frac{\text{d}f(x)}{\text{d}x}$ describing how the function $f(x)$ changes when its input argument changes a little bit. In fact this assumption makes only sense if $\Delta x \ll x$ (see Emilio Pisanty's answer for details on this) and if your function isnt too nonlinear at the specific point (in which case the presentation of a result in the form $f(x) \pm \Delta f(x)$ wouldnt make sense anyway). Note that sometimes $\left| \frac{\text{d}f(x)}{\text{d}x}\right|$ is used to avoid getting negative erros.
Since
$$
\frac{\text{d}\ln(x)}{\text{d}x} = \frac{1}{x}
$$
the error would be
$$
\Delta \ln(x) \approx \frac{\Delta x}{x}
$$
For arbitraty logarithms we can use the change of the logarithm base:
$$
\log_b x = \frac{\ln x}{\ln b}\\
(\ln x = \log_\text{e} x)
$$
to obtain
$$
\Delta \log_b x \approx \frac{\Delta x}{x \cdot \ln b}
$$
Comment: This (nice) answer is correct for the case that $\Delta x\ll x$ but will otherwise fail; see my answer below for why and what to do there.
Comment: @LeFitz On the other hand, if the data *does* have an asymmetric spread about its central value, it is misleading to give an uncertainty which implies a symmetric spread. In such cases one should use notation indicates the asymmetry, such as $y=1.2^{+0.1}_{-0.3}$.
Comment: very right, thx for pointing out, ill add a short note to point out your details on that.
Comment: btw, I looked up the taylor series thing and now I am thinking, why do we bother this at all? Wouldn't it be "infinitely" more precise to simply evaluate the error for the ln (x + delta x) as its difference with ln (x) itself??  I guess we could also skip averaging this value with the difference of ln (x - delta x) and ln (x)  (i.e. take upper bound difference directly as the error) since averaging would dis-include the potential of ln (x + delta x) from being a "possible value". Am I wrong or right in my reasoning?
Comment: its not a good idea because its inconsistent. if you only take the deviation in the up direction you forget the deviation in the down direction and the other way round. in your example: what if df_upp= f(x+dx)-f(x) is smaller than df_down = f(x)-f(x-dx)? giving the result in the way f +- df_upp would disinclude that f - df_down could occur. Also averaging df = (df_up + df_down)/2 could come to your mind. With only 1 variable this is not even a bad idea, but you get troubles when you have a function f(x,y,...) of more input, which is why the method presented in my answer is preferable.
Answer: While appropriate in many important contexts, LeFitz's answer can fail in one important situation, and can lead you astray, for example, when plotting graphs in logarithmic scale.
More specifically, LeFit'zs answer is only valid for situations where the error $\Delta x$ of the argument $x$ you're feeding to the logarithm is much smaller than $x$ itself:
$$
\text{if}\quad \Delta x\ll x\quad\text{then}\quad \Delta\ln(x)\approx\frac{\Delta x}{x}.
$$
However, if this condition fails then the result also fails. The reason for this is that the logarithm becomes increasingly nonlinear as its argument approaches zero; at some point, the nonlinearities can no longer be ignored.
One immediately noticeable effect of this is that error bars in a log plot become asymmetric, particularly for data that slope downwards towards zero. For example:

 (Image source)
This asymmetry in the error bars of $y=\ln(x)$ can occur even if the error in $x$ is symmetric. Consider, for example, a case where $x=1$ and $\Delta x=1/2$. Here you'll observe a value of
$$y=\ln(x+\Delta x)=\ln(3/2)\approx+0.40$$ with the same probability as
$$y=\ln(x-\Delta x)=\ln(1/2)\approx-0.69,$$
although their distances to the central value of $y=\ln(x)=0$ are different by about 70%. In a more radical example, if $\Delta x$ is equal to $x$ (and don't even think about it being even bigger), the error bar should go all the way to minus infinity, as there is a chance that the measured variable be negative. (Unless, of course, you're doing your statistics wrong, and assuming e.g. a symmetric distribution of errors in a situation where that doesn't even make sense.)
In more general terms, when this thing starts to happen then you have stumbled out of the gaussian statistics that underpin most of the standard formulas. In such cases there are often established methods to deal with specific situations, but you should watch your step and consult your resident statistician when in doubt.
If you just want a rough-and-ready error bars, though, one fairly trusty method is to draw them in between $y_\pm=\ln(x\pm\Delta x)$. If you know that there is some specific probability of $x$ being in the interval $[x-\Delta x,x+\Delta x]$, then obviously $y$ will be in $[y_-,y_+]$ with that same probability.
Comment: <3 this is just what I was suspicious of!
Answer: We can just see that the error bar in the logarithm of the data $y=\log x$ can be approximated to $\Delta x /x$ to the first order. If the error in the data $x$ is symmetric, then the upper and lower value of the data within 1$\sigma$ are
$$ x_{\mathrm{upper}}=x+\Delta x/2$$
and,
$$ x_{\mathrm{lower}}=x-\Delta x/2,$$
thus the error in y should be,
$$\Delta y = \log(x_{\mathrm{upper}}) - \log(x_{\mathrm{lower}})=\log(\frac{x+\Delta x/2}{x-\Delta x/2})= \log(1+\Delta x/2x) - \log(1-\Delta x/2x)  \approx \Delta x/x$$
In the last step, Taylor expansion is used to find the error in the $\log (x)$ in the first order in $\Delta x/x$. The expansion can only be cut off to the first term if $\Delta x/(2x) <<1$.

The error of the natural logarithm


Safe Point Thinning Algorithm - How to?

Question: I am relatively new to image processing and am working on a project that requires the thinning of binary images. In the literature, I've seen references to the Safe Point Thinning Algorithm(SPTA) quite a lot, but have failed to find any definitive source to the algorithm, maybe because most of the articles quoted to describe the SPTA are not in the public domain. Can you please explain SPTA for me? Or even point me to (free)resources that do? The pros and cons of the algorithm are welcome. I could also use any alternative algorithm that is "good enough".
Comment: What references have you seen?
Comment: For example, in papers related to unconstrained handwritten character recognition by Hanmandlu et al.
Answer: SPTA seems to be a quite old skeleton algorithm that is even hard to find behind paywalls.
Here is a link to a skeletonization paper that references it and comes with free access : http://dspace1.acs.ucalgary.ca/bitstream/1880/45551/2/1987-287-35.pdf
But roughly speaking the idea of skeleton algorithms is to look of a simple shape "midway" inside the detected blob. For example, if you have detected a rectangle, then its skeleton is going to be the points inside the rectangle that are at equal distance from its boundaries, which makes a shape like this (the part inside the rectangle):
<code>--------
|>----<|
--------
</code>
If it helps, think of the way children draw characters wit just a few strokes...
-- EDIT --
OK, if I had to choose some reference to implement (but I understood from the question that SPTA was actually used, not to be replaced), I would check the papers on this page:
http://www.ensta-paristech.fr/~manzaner/publis.html
Disclaimer: I'm not this guy, I didn't write the papers, but I would start here because:

the papers are available for download
A. Manzanera worked a lot on limited hardware (e.g. embedded stuff), so I guess the algorithms are efficient and not so tricky to implement
Comment: So what algorithm do you suggest that is more modern and efficient than the SPTA to thin handwritten scribbles/signatures?
Comment: OK, I added a link to papers. Please read carefully the disclaimer to understand why this one page.

Safe Point Thinning Algorithm - How to?


Does Google Workspace rely on A records in DNS for anything else apart from bare domain redirect?

Question: I manage a small Google Workspace. In the beginning, many years ago, the primary domain was configured to redirect to the www. subdomain using the relevant Workspace (back then Google Apps?) feature. The DNS records for the domain feature A records pointing to Google IPs, presumably to facilitate the redirection.
Now, there is a need to use the bare domain for other services, and therefore point A records somewhere else. Just the A records, none of the other records (MX, etc.) need to be changed.
Hence the question: does Google Workspace actually rely on A records for anything else apart from bare domain redirect? Will changing the A records affect bare domain email or other Workspace features?
From my research so far, Google's own docs[0] admonish:

Don't change your domain A records if you're using non-Google services with your domain because this will make those services unavailable. Before changing your A records, you should already be hosting your domain's website as a Google Site built in your Google Workspace account. For details, see Set up your "naked" domain address.

[0] https://support.google.com/a/answer/2579934?hl=en
The section appears to imply that there is no reason for A records other than naked domain redirection; hence my question.
Answer: I have changed the A records on the apex. Workspaces hadn't shown any error message so far, and Gmail integration appears to keep working (a couple emails went through since).
Open for more knowledgeable answers, though…


Can papain or any other protease enzyme from other foods be used to dissolve meat by cooking at appropriate temperatures?

Question: Papain and other protease enzymes are frequently used to tenderize meat. However, they usually get cooked without a proper temperature control and the optimal protease temperature (which according to 1 is 55-65 degrees Celsius) is most likely too quickly passed for dissolving meat and only ends up tenderizing it instead. So would an outcome of dissolution of meat be achievable if the ingredients (meat plus papain) are kept at the optimal temperature (55-65 degrees Celsius according to 1) for a much longer duration-say, an hour?
Comment: Are you trying to get rid of a body?
Comment: @dbmag9 no, I'm trying to include meat in my diet but since I do not like chewing meat I'm trying to dissolve it before consuming it.
Answer: Yes, the meat that is in direct contact with the enzyme will be dissolved.
This is why the proteases are usually employed in marinating. You can add freshly pressed papaya juice (or kiwi juice, or whichever source you prefer) to your marinade, and let the meat sit in it. When you take it out, the outermost layer will be mushy and will have taken on a very nice taste. Then you fry your steak. The times can be as short as the one hour you mention, but also much longer, for example overnight.
Comment: The outermost layer can get dissolved but what about the inner layers? As in, if kept at higher temperatures for longer durations, can they be dissolved as well? According to [1] in the question, in normal cooking, the protease degrades beyond 65 degrees Celsius so the high protease activity temperature range (55-65 degrees Celsius) only lasts for a short while.


Why do people say "explain to me", not "explain me"?

Question: Is there any grammatical rule to know which verbs can (or better, must) be sometimes followed by "to"? Some examples are:

Please explain to me why...
She said to me that...

I'm aware I could also say "explain me", but such thing would mean something like "explain what I am" or "give an explanation of myself". However, you could never use "say me". In other cases, it seems both formats are acceptable. An example would be:

"Show me" and "show it to me"

Is there any rule to explain this?
Comment: Why on earth has this question been migrated? It's probably too broad for ELU rather than too basic. I'd just point out that (1) there are different definitions of ditransitivity, some of which include say 'show' in 'he showed me the correct method'; (2) not all of those verbs in the broadest group undergo the dative transformation ('he showed me the correct method' <==> 'he showed the correct method to me' but 'he explained the correct method to me' <=/=> *'he explained me the correct method'; ...
Comment: @BiscuitBoy English. The question isn't only fot the OP, but also for future users with the same concern. FWIW, the OP didn't seem to be a native Spanish speaker either.
Comment: @EdwinAshworth But a doctoral thesis is not what Claudio probably needs. Claudio probably needs some help understanding a very common mistake that folks not fluent in English make. This question is phrased as an ELL question (in my opinion), particularly because the asker is looking for grammatical rules and didn't mention anything about ditransitivity or dative transforms.
Comment: (3) some verbs, not  in ditransitive usages, (eg 'say' as in 'said to me that') need a transitivising preposition; others ('inform') must not have one, and with yet others the situation changes when they undergo the dative transformation.
Comment: @claudiosepulveda - ELU is "English Language and Usage," a Stack Exchange for etymologists. ELL is "English Language Learners," a Stack Exchange site for adults who are learning English as a second (or third or fourth) language. People learning about both sites at the same time are often pointed to [this ELU meta post](http://meta.english.stackexchange.com/questions/3722/what-is-the-difference-between-elu-and-ell/3723#3723).
Comment: (0) No. (a) No; I'm using a 'transitivising preposition' as 'a preposition permitting a recipient to be mentioned in the construction', keeping clear of the "Is X a DO?" bunfight. I've actually seen the term 'pseudo-transitivising preposition' used. (b) Ditransitive usages don't include PPs in one form; in fact they have two NPs, as DO & IO. _He gave me the book_. Some would exclude the isoformal _He baked me a cake_, calling it a benefactive. It uses 'for' in the dative transformation. // (c1) 'He spoke **to** me last Thursday'  (c2) 'He informed **[]** me last Thursday' ...
Comment: (c3) 'He told **[]** me the news last Thursday' <==> 'He told the news **to** me last Thursday.' / For completeness, 'He explained the problem to me last Thursday' is not a dative transformation; 'He explained me the news' is unacceptable (ie 'explain' is not a ditransitive verb). Which restates rather than answers the question.
Comment: @BiscuitBoy I believe there's a duplicate.
Comment: @EdwinAshworth Migration to ELL isn't just for basic questions - folks learning English have some very sophisticated questions. Usually ELL is a better fit when the answer needs to be more focused on practical usage than grammar and syntax. Ditransitivity is an interesting topic, but not all aspects of that topic are particularly useful to a learner. Some parts are, and can be helpful in identifying other verbs that they should look out for, but I don't understand it well enough myself to simplify it.
Comment: @ColleenV My question was 'Why was _this_ question migrated?' Apart from the 'too broad' issue (which I'm sure is still an issue on ELL), the level is at least ELU-standard –  and probably needs a doctoral thesis as a decent answer.
Comment: @ColleenV The question is 'Why do people say "explain to me", not "explain me"?' rogermue here gets as far as saying 'I can't give a simple and clear reason why we have two types. Type 1 might be a simplification of type 2, but was used only with frequent Germanic verbs. But this is a mere guess.' ELU is not a forum restricted to answering questions solely to satisfy a particular enquirer's requests, but is aimed at discovering the best explanation of usages that are mentioned. For a much wider audience.
Comment: I agree with many points Edwin Ashworth made and the point made by ColleenV. After reading the question, I've tried to formulate an answer, but to no avail. This is basically because of the false premises made by the OP. (Please read on, it's interesting.) -- The way I see it, the OP asks a) Why do people say so?; and b) Is there any grammatical rule to know which verbs can be used as such? And even though a) is off-topic on ELL (IMHO), b) is probably worth pursuing, so I did, and soon realized that the OP assumed that for these verbs, if we can say [ S V D to I ], we can say [ S V I D ], too.
Comment: @EdwinAshworth If there's an issue with a particular question getting migrated, it probably should be taken up on [meta.english.se]. We have no control over what y'all migrate here other than bouncing it back if it's not on-topic here. This question is actually on-topic here, even though it's difficult to answer. It's probably on-topic at EL&U too, but parts of your community thought it was better asked here for some reason.
Comment: (cont.) But there are more subtle points that allow (or disallow) this "dative alternative" (aka "dative movement"). Sometimes it's important what kinds of the objects are (people, or things, for that matter), sometimes it depends on which sense of the verb we use. Compare: a) *The cathedral clearly owes a great deal to French design*, b) *The cathedral clearly owes French design a great deal.* Only a) is a valid sentence.
Comment: (cont.) Note that it's not the OP's false to assume this. We all want the language we learn to be logical and readily explainable by rules. IMHO, it's probably the best to learn each verb at a time. Some grammar books may group small sets of related verbs together and explain each group at a time (e.g., *give, send, take, bring*; *advise, recommend, suggest*; *report, explain*, and so on).
Comment: Mr. Ashworth,
Thank you for your kind reply. Could you "explain to me" what ELU stands for?
Thanks again. Regards,
Comment: I think we already have an answer to this question - http://ell.stackexchange.com/a/57955/3463 So possibly it is a duplicate.
Comment: @EdwinAshworth: Can you clarify your point (3) above? If you have a link to an answer or something, where the following questions of mine are answered, I'd like to read that. Otherwise, can you answer these questions in comments: By *'say' needing a transitivizing preposition*, do you mean 'me' is the *direct object* in 'said to me that...' (then what kind of object is the 'that...' clause there?)? And why isn't that a ditransitive usage? // Also, I didn't understand what you meant here: "with yet others the situation changes when they undergo the dative transformation."
Answer: Because underneath it all, the word meant to flatten {something} out and that meaning acquired a figurative meaning "to make clear, easily understood"; the sense that it is a figurative use has been lost with time.
The direct object of "explain" is thus the thing being explained, not the person to whom the explanation is being given.
English is a Germanic-Latinate hybrid.
Answer: According to George Yule, "[w]ith verbs such as describe or explain, we put indirect object after a preposition, not after the verb"
She described the thief to the police.
They explained the plan to us.
Other verbs which fall in this category are admit, announce, mention, murmer, report, shout, suggest, and whisper.
You see they are often verbs of speaking.
She said "Hello" to me. (NOT she said me "Hello".)
Answer:
book, buy, get, cook, keep, bring, make, pour, save, find, give, lend, offer, pass, post, read, sell, send, show, promise, tell

With these verbs, a noun or pronoun right after them has something like an implied "to" or "for" in front of it - it's built-in to the meaning of the verb.  (Except keep - e.g. keep me in the loop no preposition works).
Any other verb, you need the "to" or "for" explicitly expressed.
Answer: The normal verb construction is "Can you get me a newspaper?"
Another type is "Can you explain this sentence to me?".
Type 2 is mostly used with Latin verbs such as
announce confide deliver demonstrate describe dictate distribute entrust explain introduce prefer propose relate suggest (this is only a selection).
Also to say, which is no Latin verb.
I can't give a simple and clear reason why we have two types. Type 1 might be a simplification of type 2, but was used only with frequent Germanic verbs. But this is a mere guess.
Comment: There's also the complication that some verbs (called by some benefactives) taking two objects ('Can you get me a newspaper?') have 'for' in the transformation: 'Can you get a newspaper for me?') (and in fact the transformation may not be available: *'He finished her the cleaning.' And again, 'She's costing me a fortune' doesn't have a prepositional transformation.
Answer: What an interesting question! I can only add this: be literal. In your example,' "Show me" and "show it to me" ', it is worth noting that "show me" is a common-usage abbreviation for the longer "show it to me". With this in mind, when you want to express a thought, in written form, be literal. Expand your wording to include everything you think is necessary to convey your point. Let's go back to the "Show me" example. Some languages will assume the "to". English does not. Therefore, one can not go wrong by using the extra word, "to".


Does direct-digital RF signal generation have a "baseband?"

Question: Semiconductor technology has advanced to the point that the digital representation of a modulated RF signal can be applied directly to a DAC for transmission. Is there, then, any distinction between a "baseband" signal and the RF transmitted signal?
Answer: Yes there is an important distinction which is independent of the semiconductor technology. In radio terminology, "baseband signals" are typically centered on "DC" and as such are required to be complex (such as I and Q) to represent a waveform that does not have a symmetrical spectrum about the carrier (basically nearly every modern waveform where modulation of amplitude and phase is involved) while IF signals and "RF Transmitted" signals can be real to represent these same waveforms.
In general "baseband" is the modulated waveform with DC (f=0) as the carrier while "IF signal" and "RF Transmitted signal" are representations with a non-DC carrier.
Answer: Do you mean either that 1. the sampling bandwidth is large enough to cover the carrier frequency, or 2. demodulation occurs via aliasing when sampling at baseband a modulated signal? I think typically a signal is downconverted to baseband (or upconverted even to a certain frequency) by an analog mixer before sampling. If a signal is sampled at IF, you'll still need to demodulate it digitally. Otherwise it looks as a matter of fact as baseband signal
Comment: A school of thought inclines to think that the "baseband" signal is fictitious since it only exists as a digital representation. Even though a human may type text into a digital system, it never exists as an analog signal that modulates a carrier for conversion to a higher frequency for transmission.
Comment: We definitely invented digital modulations but analog modulations have been invented by nature in order to convey information, think about bird songs
Answer: Terms are going to differ.  I think the best I can come up with is that if the signal occupies a relatively narrow slice of the spectrum then it's "RF".  If it fully occupies the spectrum -- particularly if it has a DC component -- then it's baseband.
So a recording of me talking, from 300Hz to 3kHz, is baseband (that little slice missing around DC doesn't matter much).  A 2.5kHz-wide, SSB-modulated version of me talking, centered around 7.25MHz, is RF, even if it's going out a DAC.
Comment: What if the source of the "voice" was a synthesizer which only exists as a digital representation?
Comment: What do you mean by "synthesizer"?  If you're back to your single tone at RF, with great swaths of spectrum at zero -- then it's not baseband.
Comment: "Synthesizer" as in no analog source; the source "only exists as a digital representation.":The source information has non-zero bandwidth. The RF signal that comprises the source information may be processed to recover the source information.


How do I do a mail merge with Gmail?

Question: How do I do a mail merge with Gmail?
Answer: Labnol has a video tutorial and walkthrough.
The key is that:

you ... setup Mail Merge in Gmail through your Google Docs account

Update
There is an update to the Labnol article that shows how to add attachments - Labnol tutorial
(thanks to mvark)
Comment: This is a great solution - however would like to add attachment/s?
Comment: @CWCarlos - Don't know the answer to that I'm afraid.
Comment: @CWCarlos you can simply put your attachment to the Public folder in Dropbox and adding the link to it as a text in the body. Zip them if there are more than one file for easier download! (www.dropbox.com)
Comment: There is an update to the Labnol article that shows how to add attachments - http://www.labnol.org/internet/mail-merge-with-attachments/18561/
Comment: @mvark - I've updated the answer with your link - thanks.
Answer: Here's an excellent video tutorial on using gmail, google sheets and the free Yet Another Mail Merge add-in to do a mail merge:
Create a Mail Merge with Gmail and Google Drive / Docs
You write a draft email in gmail, use this format to refer to column names in your google sheet when writing the email: $%contact email address% where 'contact email address' is the column name, then click the 'mail merge' button, choose the gmail draft you want to send, test it on yourself if you wish, then send it to everyone in your spreadsheet. Very straightforward.
Answer: I found EmailBee provides an easy way of doing mail merges using your Gmail account:

Click https://www.emailbee.com/Account/Register
Click "Sign in with Google" and go through the account creation process (basically a couple of clicks)
Once you are in, click "mailbox" on the left hand menu and then the "add mail" icon on the top right of the screen and away you go

NOTE: If you want to send to your Gmail contacts you need to import them:

Click contacts on left hand side menu and then add contact on top right
Select the "import" tab, click "google", click next and then click "start import"

If you use Google Chrome they also have a Chrome Extension which runs inside your Gmail client on Chrome.
Answer: One of the easiest ways to do a mail merge in Gmail is to use a Gmail add-on that's can perform mail merges.
The following add-ons are all fairly straightforward to use, and all of them have a free plan:

GMass
MergeMail
YAMM (This is a Google Sheets add-on, but it uses Gmail as well)
Answer: There are basically two ways to mail merge in Gmail. You can either use a Google add-on that will do the job for you or build your own mail merge script with Google Apps Script.
We'll cover both methods in this guide. Even though, if your are just looking for a sending a quick bunch of emails, I will recommend you to use a software built for that purpose which cover most issues and will probably save you lot of time.
Method 1: building a merge in Gmail using Google Apps Scripts
The coding way of sending a mail merge in Gmail requires advanced skills if you want to use the Gmail API. But thankfully, you don't need to. We're going to use Google Apps Script, which makes it really easy to create Google scripts for Google Sheets (and other Google applications).
On top of that, sevaral Google Developer Advocates have already released a great script to help us move forward with the code. Here is the latest version of the open-source code hosted on GitHub written by Martin Hawksey - @mhawksey. We gonna look at it step-by-step just after.
// Copyright Martin Hawksey 2020
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License.  You may obtain a copy
// of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
// License for the specific language governing permissions and limitations under
// the License.

/**
 * @OnlyCurrentDoc
*/

/**
 * Change these to match the column names you are using for email
 * recipient addresses and email sent column.
*/
const RECIPIENT_COL  = "Recipient";
const EMAIL_SENT_COL = "Email Sent";

/**
 * Creates the menu item "Mail Merge" for user to run scripts on drop-down.
 */
function onOpen() {
  const ui = SpreadsheetApp.getUi();
  ui.createMenu('Mail Merge')
      .addItem('Send Emails', 'sendEmails')
      .addToUi();
}

/**
 * Send emails from sheet data.
 * @param {string} subjectLine (optional) for the email draft message
 * @param {Sheet} sheet to read data from
*/
function sendEmails(subjectLine, sheet=SpreadsheetApp.getActiveSheet()) {
  // option to skip browser prompt if you want to use this code in other projects
  if (!subjectLine){
    subjectLine = Browser.inputBox("Mail Merge",
                                      "Type or copy/paste the subject line of the Gmail " +
                                      "draft message you would like to mail merge with:",
                                      Browser.Buttons.OK_CANCEL);

    if (subjectLine === "cancel" || subjectLine == ""){
    // if no subject line finish up
    return;
    }
  }

  // get the draft Gmail message to use as a template
  const emailTemplate = getGmailTemplateFromDrafts_(subjectLine);

  // get the data from the passed sheet
  const dataRange = sheet.getDataRange();
  // Fetch displayed values for each row in the Range HT Andrew Roberts
  // https://mashe.hawksey.info/2020/04/a-bulk-email-mail-merge-with-gmail-and-google-sheets-solution-evolution-using-v8/#comment-187490
  // @see https://developers.google.com/apps-script/reference/spreadsheet/range#getdisplayvalues
  const data = dataRange.getDisplayValues();

  // assuming row 1 contains our column headings
  const heads = data.shift();

  // get the index of column named 'Email Status' (Assume header names are unique)
  // @see http://ramblings.mcpher.com/Home/excelquirks/gooscript/arrayfunctions
  const emailSentColIdx = heads.indexOf(EMAIL_SENT_COL);

  // convert 2d array into object array
  // @see https://stackoverflow.com/a/22917499/1027723
  // for pretty version see https://mashe.hawksey.info/?p=17869/#comment-184945
  const obj = data.map(r => (heads.reduce((o, k, i) => (o[k] = r[i] || '', o), {})));

  // used to record sent emails
  const out = [];

  // loop through all the rows of data
  obj.forEach(function(row, rowIdx){
    // only send emails is email_sent cell is blank and not hidden by filter
    if (row[EMAIL_SENT_COL] == ''){
      try {
        const msgObj = fillInTemplateFromObject_(emailTemplate.message, row);

        // @see https://developers.google.com/apps-script/reference/gmail/gmail-app#sendEmail(String,String,String,Object)
        // if you need to send emails with unicode/emoji characters change GmailApp for MailApp
        // Uncomment advanced parameters as needed (see docs for limitations)
        GmailApp.sendEmail(row[RECIPIENT_COL], msgObj.subject, msgObj.text, {
          htmlBody: msgObj.html,
          // bcc: 'firstname.lastname@example.com',
          // cc: 'firstname.lastname@example.com',
          // from: 'email@example.com',
          // name: 'name of the sender',
          // replyTo: 'email@example.com',
          // noReply: true, // if the email should be sent from a generic no-reply email address (not available to gmail.com users)
          attachments: emailTemplate.attachments,
          inlineImages: emailTemplate.inlineImages
        });
        // modify cell to record email sent date
        out.push([new Date()]);
      } catch(e) {
        // modify cell to record error
        out.push([e.message]);
      }
    } else {
      out.push([row[EMAIL_SENT_COL]]);
    }
  });

  // updating the sheet with new data
  sheet.getRange(2, emailSentColIdx+1, out.length).setValues(out);

  /**
   * Get a Gmail draft message by matching the subject line.
   * @param {string} subject_line to search for draft message
   * @return {object} containing the subject, plain and html message body and attachments
  */
  function getGmailTemplateFromDrafts_(subject_line){
    try {
      // get drafts
      const drafts = GmailApp.getDrafts();
      // filter the drafts that match subject line
      const draft = drafts.filter(subjectFilter_(subject_line))[0];
      // get the message object
      const msg = draft.getMessage();

      // Handling inline images and attachments so they can be included in the merge
      // Based on https://stackoverflow.com/a/65813881/1027723
      // Get all attachments and inline image attachments
      const allInlineImages = draft.getMessage().getAttachments({includeInlineImages: true,includeAttachments:false});
      const attachments = draft.getMessage().getAttachments({includeInlineImages: false});
      const htmlBody = msg.getBody();

      // Create an inline image object with the image name as key
      // (can't rely on image index as array based on insert order)
      const img_obj = allInlineImages.reduce((obj, i) => (obj[i.getName()] = i, obj) ,{});

      //Regexp to search for all img string positions with cid
      const imgexp = RegExp(']+>', 'g');
      const matches = [...htmlBody.matchAll(imgexp)];

      //Initiate the allInlineImages object
      const inlineImagesObj = {};
      // built an inlineImagesObj from inline image matches
      matches.forEach(match => inlineImagesObj[match[1]] = img_obj[match[2]]);

      return {message: {subject: subject_line, text: msg.getPlainBody(), html:htmlBody},
              attachments: attachments, inlineImages: inlineImagesObj };
    } catch(e) {
      throw new Error("Oops - can't find Gmail draft");
    }

    /**
     * Filter draft objects with the matching subject linemessage by matching the subject line.
     * @param {string} subject_line to search for draft message
     * @return {object} GmailDraft object
    */
    function subjectFilter_(subject_line){
      return function(element) {
        if (element.getMessage().getSubject() === subject_line) {
          return element;
        }
      }
    }
  }

  /**
   * Fill template string with data object
   * @see https://stackoverflow.com/a/378000/1027723
   * @param {string} template string containing {{}} markers which are replaced with data
   * @param {object} data object used to replace {{}} markers
   * @return {object} message replaced with data
  */
  function fillInTemplateFromObject_(template, data) {
    // we have two templates one for plain text and the html body
    // stringifing the object means we can do a global replace
    let template_string = JSON.stringify(template);

    // token replacement
    template_string = template_string.replace(/{{[^{}]+}}/g, key => {
      return escapeData_(data[key.replace(/[{}]+/g, "")] || "");
    });
    return  JSON.parse(template_string);
  }

  /**
   * Escape cell data to make JSON safe
   * @see https://stackoverflow.com/a/9204218/1027723
   * @param {string} str to escape JSON special characters from
   * @return {string} escaped string
  */
  function escapeData_(str) {
    return str
      .replace(/[\\]/g, '\\\\')
      .replace(/[\"]/g, '\\\"')
      .replace(/[\/]/g, '\\/')
      .replace(/[\b]/g, '\\b')
      .replace(/[\f]/g, '\\f')
      .replace(/[\n]/g, '\\n')
      .replace(/[\r]/g, '\\r')
      .replace(/[\t]/g, '\\t');
  };
}

Follow the guidelines below to understand how to mail merge in Gmail using Apps Script:
1. Create a copy of the sample mail merge spreadsheet
Open this demonstration spreadsheet and click on "Make a copy" to get your own copy.
2. In your new spreadsheet
Click on Tools > Script editor to open Google Apps Script. From there, you will see that a script is already tied to your spreadsheet. That's because you've made a copy of the previous spreadsheet!
In the script editor, you can update the code as you wish. Changes will be reflected immediately.
Back to copied spreadsheet, update the "Recipients" column with email addresses you would like to use in the mail merge. Replace the cells' value under the "Recipients" column with your own email address for example.
3. Now, open Gmail to create a new draft email
You can use personalized variables, like {{ firstname }} which correspond to column names of the spreadsheet you just copied. This indicates text you'd like to be replaced with data from the copied spreadsheet.
4. Back in the copied spreadsheet, click on the custom menu item called "Mail Merge" and then click on "Send Emails"
This item menu was created by the Apps Script project and will start the mail merge process.
5. A dialog box appears for authorization. Read the authorization notice and continue
Important note: The script we are using has been created and proofread by Google Apps Script teams. Always be super careful when authorizing scripts and third-party apps in general.
When prompted enter or copy-paste the subject line used in your draft Gmail message. Then click OK.
6. Send your emails
You will see that the "Email Sent" column will update with the message status. Back in Gmail, check your Sent folder and review the emails the program just sent for you!

Keep in mind that using a script is at your own risk. Check Gmail's sending limit before sending large volumes of emails. Especailly, be aware that your account can get blocked by Gmail if your emailing activity seems unusual in the eyes of anti-spam filters.
For these reasons, we would recommend using a mail merge solution such as Mailmeteor. Mailmeteor deals with all these aspects for you and ensures that your privacy remains protected.
Method 2: using a mail merge add-on like Mailmeteor
We'll start with a real-life example to show you how to do a mail merge from Gmail using a Google Sheets add-on. In this example, we're using Mailmeteor, the best rated Google mail merge add-on.
1. Get Mailmeteor
All you have to do is to install Mailmeteor from the Google Workspace Marketplace. The Worskpace Marketplace is a place where you can find all the apps compatible with your Google Suite. Mailmeteor is a tool that integrates with Gmail and Google Sheets to merge emails with Gmail.

2. Add contact in Google Sheets
Once Mailmeteor is installed, open a Google Sheets spreadsheet.
First of all, you will need to add recipients to a Google Sheets spreadsheet. This spreadsheet will be the place where you store your contact list. You will also be able to track your campaign metrics from there.
To create a mailing list you can either add your recipients manually or import contacts. To import contacts in Google Sheets, go to Menu > File > Import and select your Excel or .csv file.
Here's a mail merge demo spreadsheet we're going to use:

  Link to mail merge demo spreadsheet

Note: when opening Mailmeteor for the first time, you will be guided through a quick onboarding tutorial. A demo spreadsheet like this one will be created for you.
Let's breakdown how your spreadsheet should look like:
➤ Add column headers on the 1st row
Mailmeteor will pull the information from your spreadsheet to personalize your emails. Each column represents a personalized field. This field will be replaced in your email template.
In our example, we have 4 columns named: firstname, email, company, postscriptum.
Add as many columns as you want and pick any column header name you want. Make sure you have a column named "email".
➤ Fill the columns with your recipients' information
Fill your spreadsheet with your recipients' info. Ensure all email cells are filled with valid email addresses. Apart from the emails, you can leave some cells blank, that is fine! In the example below, some recipients will get a Post Scriptum whereas others won't.

3. Open Mailmeteor from the Add-ons menu in Google Sheets
Once your contact list is ready, open Mailmeteor. To open Mailmeteor go to the menu and select Add-ons> Mailmeteor > Open Mailmeteor.
This is the Mailmeteor interface. It tells you how many emails you can send per day and details related to your campaign. Next, we are going to compose the template that will be used for the mail merge.
4. Compose a new email template
Click on the "Create new template" button. This will open an editor in which you can compose your email. The Mailmeteor editor is the exact same as Gmail, you will find all the actions you need to customize your email.

Now we're going to personalize your email. Personalizing emails is important as it helps make your recipients feel unique when they receive your emails. Using personalization will also dramatically improve your opening rates - and thus the replies you will get.
5. Personalize your emails
A mail merge transforms a standard email template into a personalized email copy. It's done by replacing variables fields within the template with the content from your spreadsheet.
To insert a variable it's easy: add variables using double brackets like this {{ firstname }}
Here is a template you can copy-paste:

Hello {{ firstname }},

I'm glad we could meet lately. As discussed, we are using a brand new mail merge solution called Mailmeteor.

Mailmeteor lets you send hundreds of personalized emails, right from Gmail.

I'd love to let you see some of the features to get your feedback. We want to ensure Mailmeteor would actually help you do your job better at {{ company }}.

Would you have 10-15 minutes free to chat? (I promise to keep the time!). Let me know the time that suits you best.

When adding a variable, always make sure that it matches a header in your spreadsheet.
Once you are satisfied with your template, click the "Save" button.
6. Preview emails before sending
Mailmeteor offers a preview feature that is super helpful to review emails before sending. The preview mode gives you a glimpse of the actual output of your email once personalized for each recipient.

You can also send a test email to yourself. Testing your emails on several devices is a best practice. This will ensure your emails will display correctly in most situations.
7. Send your mail merge
Ready for take-off? It's time to send your mailmerge campaign.
We know that sending your mail merge can be a bit daunting at first. No worries though, if you follow these steps, everything will be alright!

✨ That's it! You are now ready to mail merge emails with Gmail using an add-on such as Mailmeteor ✨
Real-life example:
Here's a real-life example. Watch this teacher use Mailmeteor to mail merge emails to his students:

Mail Merge Tutorial using Mail Meteor Chrome Add-On by Steve Clarck
Now it's your turn
That's it for this guide to mail merge in Gmail. We hope you now better understand this simple yet incredibly powerful tool called mail merge.
This guide is part of an extended guide on Mail merge in Gmail (2021). If you want to learn much more, go check it out!

How do I do a mail merge with Gmail?