What's the difference between a CPU core and a CPU/GPU thread?

Question: I've heard the term core and thread being used synonymously a lot of times. In Minecraft, if you press F3 to show coordinates, it tells you how many threads you have in your CPU but uses the term "core" for them.  I know some things about threads and cores, but they are almost indistinguishable. Both can run programs and have memory, but there are typically more threads and the threads can also appear in GPUs. Is there any difference in architecture between cores and threads?
Comment: core is a hardware term ... thread is a software term
Comment: @jsotola Not always. Intel hyperthreading.
Comment: A core is what a thread runs on.
Comment: I agree with jsotola, in the general sense.  I think that distinction existed long before Intel coined hyperthreading.   But like most things, there are always exceptions & special cases.
Answer: Please read this Wikipedia page.
A CPU core is a unit that can perform instructions.
Most CPU cores can only process one instruction at the same time.
Some CPU cores can process more (usually two) instructions at the same time. Intel calls this hyperthreading, to the operating system (Windows or Linux, etc.) and therefore  the application software (for example: Minecraft) such a CPU looks like it has two (logical) cores since it can process two instructions at the same time. At least, that's what it looks like to the software (operating system and application).
A thread is a "string of instructions" that are processed on one logical CPU core.
So a single-core but hyperthreading CPU can process two instructions at the same time so it can handle two threads at the same time as well.
To complicate things, the software switches (in time) between many threads so usually there are a lot more threads active than there are logical CPU cores present. But that's OK, if processed quickly enough, you wouldn't notice this as a user. This is because most threads (tasks) can wait a little bit for their turn to use the CPU. Only for a quick response a thread might be assigned a higher priority so that it gets preference over other threads.
Comment: Processing two instructions at the same time means you are superscalar, not that you have SMT (hyperthreading).  SMT/hyperthreading means that you process two (or more) threads at the same time (but not necessarily instructions). There are processors out there with SMT that cannot issue from more than one thread at the same time (e.g. Hexagon).
Answer: In terms of Hyperthreading, another core always means another thread is available with which to do work, but an extra thread doesn't necessarily mean an extra core is present.
Think of people as cores and the number of hands they have potential threads. One-handed people are single-threading cores a two-handed people are multi-threading cores
In that case, if you add an extra person, you are unequivocally adding capability of doing at least one extra task simultaneously.
If the person is one-handed they can only handle one task at a time. If the person is two handed they might be able to handle two tasks at a time, depending on what the particular tasks are; It's not a given that they will be able to handle any two pair of tasks simultaneously. Having a single two-handed person is not as performant as having two one-handed people, but sometimes it is cheaper to squeeze more utility out of the one person than to add another person.
Comment: If people are cores, then hands are arithmetic units, and hardware threads are multiple tables in front of the person.  If one table (task) is blocked because it's waiting for delivery of data from across the room, the person can grab something from the other table and do useful work while waiting for inputs for the first task... without having to do a context switch of picking up everything on a table, placing it into a crate, unloading another crate onto the table.  The second table is just there within arm's reach ready to work on.
Answer: Core is physical processor. Multi-threading is capability to run multiple threads on a single core, thus multiple threads have to share resource available by the core.
If thread occupies all resource of the core, another thread cannot run on the same core.
Answer: This answer focusses on CPUs, I do now know enough about GPUs to speak about how GPU vendor use terminology.

Normally the difference is that each "core" has a dedicated set of execution units, while the hardware threads within a "core" share execution units.
Having multiple threads per core, potentially makes it easier to keep the execution units busy, when one thread is waiting on (for-example) a memory fetch the other can still be performing useful processing.
But there are edge cases, for example AMD's bulldozer had "modules", each of which contained two "cores". The "cores" within a module had dedicated resources for integer processing but used shared resources for floating point processing. There were many arguments of whether what AMD called cores really deserved to be called cores, or whether each module should be considered a core with the units within a module being called threads.

In Minecraft, if you press F3 to show coordinates, it tells you how many threads you have in your CPU but uses the term "core" for them.

Systems with multiple CPU chips have been around a lot longer than systems with multiple cores on the same chip, or CPU cores that support multiple threads of execution.
When hyperthreading and multicore came along, they re-used the existing support for multiprocessor systems. The result is that when you look at APIs and data structures used by operating systems and programming environments, they usually use the term CPU for what CPU marketers and PC builders would call a "thread".
It doesn't help that the term "thread" also has a meaning in software. One can talk about "hardware threads" and "software threads" but that very quickly gets tedious.
That said when I look at pictures of the Minecraft debug screen, I don't see what you observe. I see a number at the start followed by a x, but it doesn't explain what that number means. I also sometimes see cores mentioned in the description of the processor type, but in that case they seem to be in-line with the CPU vendors marketing.
Answer: CPU threads don't have all functional units that make a whole CPU (or CPU core). Typically they don't have their own L1 cache but share it with the other threads on the same core. They may also lack their own ALU but have to share it with the other threads on the same core.
If you have a multicore CPU, it's still useful to give each core two threads so there could be one copy operation and one ALU operation executed at the same time per core. More than two threads aren't too useful.
CPU threads are most useful if the software runs multiple threads of related functions and their data in parallel, so all required data can be accessed through the L1 cache. They are less useful when there are context switches.
Comment: Superscalar processors, for example modern x86, will already execute out-of-order to make the most of available execution units. Modern compilers can optimise for this condition. Without hyper-threading (or the equivalent from another manufacturer) you only have one pipeline leading into the execution units, so I'm not sure why you'd change whatever defaults your OS scheduler uses.
Comment: Hyper-Threading is from the 1990ies, when such reordering compilers were exotic at least on the x86 platform. It also works for binary applications. It's a patch fixing the broken PC software model of that time.
Comment: @Janka: automatic reordering was available in hardware on x86 (Intel Pentium Pro, AMD K5, 1996) considerably before hyper-threading (Pentium 4, 2002) and compilers were reordering instructions (aka "instruction scheduling") before either.  In fact, a large number of optimizations (e.g. common subexpression elimination) aren't even possible without reordering.


What to fill basement floor gaps with

Question:
We have some gaps in the basement floor of our new house. They're a few inches deep, seemingly with dirt underneath. There are some others that are less deep as well. Think some crickets are getting in this way. I'm wondering what's a good way to fill them in; sealant, or something like quikrete?
Comment: If the subsoil is clay, moisture content and climate may shift the floor and thus the gap significantly. Hopefully good weeping tiles drain excess moisture into a storm sewer. In a western climate, the dry concrete floor would be framed in 2x4" studs blasted with concrete nails into the concrete floor them framed to the ceiling with a gap for wall movement on large nails. I've never seen such a gain before.
Answer: Be careful. You might have a "floating slab" basement, where the slab exists solely inside the walls. Something like this:
<code>  |wall|                           |wall|
  |    |(========== slab =========)|    |
  |    |~~~~~~~~~~ earth ~~~~~~~~~~|    |
 /     |                           |     \
/      |                           |      \
|footer|                           |footer|
</code>
You can tell by checking the entire perimeter. If you have gaps all around, possibly filled with some sort of squishy material (rubber, oakum, fiberglass, whatever), or possibly covered over with caulk, cement, etc., then you've got a slab that floats inside the basement walls.
In this case, you don't want to do anything that will cause the slab to damage your walls. So don't fill the gaps with cement or anything like that. You can fill the gaps with squishy materials, or you can cover the gaps.
If you fill the gaps with something squishy, you can certainly cover that with a sealant like spray-foam or caulk. (But don't fill the gaps with pure spray-foam!)
Some products you might consider: for small gaps, consider using "backer rod", which is a round foam strip sold to help fill the gaps between window casings and the house framing. It comes in various diameters, so just find a side that is big enough, push it into the gap, and then you can caulk or foam over it.
For larger gaps, consider "concrete expansion joint strips". These are usually inserted between one concrete pour and another to provide a "pad" that will absorb some concrete movement. Typically 4-8 inches tall, and  1/2-1 inch thick. If you got a long open gap that's wide enough, you might be able to jam these strips down in.

What to fill basement floor gaps with


Is it okay to have bonfires on my dormant garden bed?

Question: Is it ok to have bonfires on my garden bed when I'm not growing anything? Should I do anything special with the aftermath or just rake it into the soil?
Answer: I wouldn't do it on my garden bed:

The heat from the fire will kill soil life, including worms and beneficial microbes.
If your fire gets hot enough, I think it might burn off soil organic matter.

I'm not a fan of bonfires in general:

Most of the "good stuff" (carbon, nitrogen, etc. that would be helpful in the soil as plant nutrients) in the material that you are burning will be released into the air. It would be better (in most cases; see below) to capture this matter in compost.
Along the same lines, bonfires unnecessarily pollute the air. Pile up the material that you would burn and bury it. It will rot over time.

You can make an exception for diseased plant material -- you don't want to spread disease around by composting it. When I want to get rid of diseased material I will put it on top of a hot fire in my wood boiler; understandably not everyone has a wood boiler available.
If you decide on a bonfire, I'd suggest doing it somewhere not on the garden bed. The ash left over from burning wood will have high pH and will contain some potash and calcium. You could spread the ash on your garden bed if you want to raise the pH of your soil.
Never burn pressure-treated wood or manufactured wood (e.g. OSB, plywood).
Comment: @abe: Hire a wood chipper?
Comment: I compost what I can, but this is a pile that is about 10x5x5 of large branches. I'd need a tractor to bury it and a decade to let it rot. Sounds like its a bad idea to burn on the garden bed though so I guess I will haul it to the land fill.
Comment: Yeah that might work


How do I merge two Facebook accounts?

Question: I have the problem of having two Facebook accounts by some accident that I wasn't aware of when it happened. Now, since I'm a musician, I don't want to lose the friends from the "smaller" Facebook account. What can I do in this situation? I only have one password!
Answer: The official answer is no, but MakeUseOf has published a guide that outlines the most expedient way of combining two accounts, which relies upon downloading an archive of your Facebook data and re-importing some of the information into your new, "merged" account.
Data such as friends and photos are more easily re-imported than your timeline and news feed history, which there is unfortunately no way of transplanting.
Answer: Simply invite all your friends to bigger Facebook profile with a sweet message & close the smaller account.
At this time, two account merger isn't possible.

How do I merge two Facebook accounts?


Best way to create a login/logout form in Scala using Lift

Question: As more and more people are interested in Scala (like myself), rather than a question, I'd like to discuss one implementation of a login/logout snippet for a webapp based on Lift.
I just started to learn Scala and Lift so it's probably not the best way to implement such a feature but I'd like to share it for other beginners and discuss it with more experienced developers.
Please note that I'm also not an expert in web development. Any help for improvements would be greatly appreciated (especially performance and security related ones)  ;-)
1) First of all, the snippet needs to be easily plugable, like with 1 line of code in your default template. I've done it using the embedded Lift feature (notice the underscore so it can't be rendered as a page itself but only invoked from a rendered page, in short, some kind of "private" snippet):
<lift:embed what="_logInForm" />

2) Then, in _logInForm.html, I use the below markup and a conditional display to handle everything:

    <lift:LogInForm.loggedOut>
        <form class="lift:LogInForm.logIn?form=post">
            Username: <input type="text" id="textName" name="name" />

            Password: <input type="password" id="textPassword" name="password" />

            <input type="submit" value="Log in" />
        </form>
    </lift:LogInForm.loggedOut>

    <lift:LogInForm.loggedIn>
        <form class="lift:LogInForm.logOut?form=post">
        Connected as .

        <input type="submit" id="btnLogOut" value="Log out" />
        </form>
    </lift:LogInForm.loggedIn>

3) ... and now the Scala/Lift logic behind this markup:
object LogInForm {
  private object name extends SessionVar("")
  private object password extends RequestVar("")
  private object referer extends RequestVar(S.referer openOr "/")
  var isLoggedIn = false

  def loggedIn(html: NodeSeq) =
    if (isLoggedIn) html else NodeSeq.Empty

  def loggedOut(html: NodeSeq) =
    if (!isLoggedIn) html else NodeSeq.Empty

  def logIn = {
    def processLogIn() {
      Validator.isValidName(name) match {
        case true => {
          Validator.isValidLogin(name, password) match {
            case true => { isLoggedIn = true } // Success: logged in
            case _ => S.error("password", "Invalid username/password!")
          }
        }
        case _ => S.error("name", "Invalid username format!")
      }
    }

    val r = referer.is
    "name=name" #> SHtml.textElem(name) &
      "name=password" #> (
        SHtml.textElem(password) ++
          SHtml.hidden(() => referer.set(r))) &
      "type=submit" #> SHtml.onSubmitUnit(processLogIn)
  }

  def logOut = {
    def processLogOut() { isLoggedIn = false }
    val r = referer.is
    "type=submit" #> SHtml.onSubmitUnit(processLogOut)
  }

  def getName = "*" #> name.is
}

Comments:

The selection between the two forms is made by the logic, rendering either the provided markup or NodeSeq.Empty, based on the fact the user is either logged in or logged out.
I used Lift:Msg to have error messages next to the appropriate fields (name/password). The message is sent using S.error in the logic behind and the appropriate id.
I actually perform the checks in a Validator helper using regexps and formats checks, etc. This return a boolean each time to pattern matching is trivial.
I use the referer so the user can log in / log out while staying on the same page.
The username is kept as a session variable and shown when logged in.

4) You can control access to other pages doing the following in Boot.scala:
    def sitemap() = SiteMap(
      Menu("Home") / "index",
      Menu("Protected page") / "protectedPageName" >> If(() => LogInForm.isLoggedIn, ""),
      // etc.

Questions:

No SSL protection (that could be an improvement, haven't had a look at this in Scala/Lift yet). Any experience from someone else could be useful?
Use of session variable. Maybe there is a better way to keep state in Scala/Lift?
Is there already something made especially for logging in/out in Lift that I could have missed?
It's not very long, but could maybe be more compact? (I'd like not to sacrifice too much readability though. Other developers need to quickly understand it)
Any other suggestion?

Cheers,
Marc.
Comment: You don't mention it but did you have a look at the ProtoUser/MegaProtoUser code which is in Lift?
Answer:
This shows how to force use of SSL, you will typically use that for the login form page menu: Lift filter to force ssl
A session variable is typically best way to keep session information
ProtoUser (you can use Lifty (http://lifty.github.com/) to setup a project with login as an example)
Answer: Lift provides a scaffolding framework for these usecases. You want to have a look at the source code of net.liftweb.proto.ProtoUser. Especially login() and loginXhtml.
The basic examples of Lift do it the following way:

Create an own mapped user class that uses all the nasty lift code
package yourcompany.model

import net.liftweb.mapper._
import net.liftweb.util._
import net.liftweb.common._

class User extends MegaProtoUser[User] {
  // your code, mostly overrides

}

object User extends User with MetaMegaProtoUser[User] {
  override def dbTableName = "users"
  // other database related code
}

In your Boot after you defined your sitemap, do the following:
// do not forget to import your user
def sitemap() = Sitemap(Menu("Home") / "index" >> User.AddUserMenusAfter)

// now comes the magic
LiftRules.setSiteMap(User.sitemapMutator(sitemap()))

This will include many links on your page, all gathered under /user_mgt e.g. sign_up, login, lost_password. For me this is a great base to work from. You can override almost all the things that happen in ProtoUser, or just copy the nice bits and implement everything yourself.
Also if someone has additional docs on that, it will be very helpful. At the moment I try to figure out the most part using the sources.


Multiple active keys on an account?

Question: Is it possible to have multiple active keys in an account? Say I wanted to have one at home and another where I want to share with a person I trust.
Answer: Yes, this is possible (example). Any permission (owner/active/or otherwise) can have many keys associated with them (not sure the max limit).
You will want to include the new key with a weight of 1 (same as your original key), and leave your active permission's threshold at 1.
You can do this here, but be very,very,very careful:
https://toolkit.genereos.io/account/advanced
Comment: Which wallets lets you do this? And how can one do this in cleos?
Comment: If you'd like a GUI you can use Scatter and the link I posted above. If you'd like to use cleos, you'll need to execute `cleos push action` and call the `updateAuth` method on the `eosio` smart contract. If you are not too confident with cleos, I'd recommend using scatter and the link above, it can be very easy to mistype the cleos command and make your account unrecoverable.

Multiple active keys on an account?


Au-haue as regional to Hamburg?

Question: Back in the day when I was in Hamburg (ca. early 1980s), my girlfriend would say something like au-haue which meant "oh, wow" or "oh my." Was I imagining that? I've never heard or seen it since. Otherwise, Hamburgers seem to speak very understandable Hochdeutsch.
Comment: I thought of the Werner comic book "Ouhauerha!", but that was only published in 1992. Werner himself has been around since 1978. But it could very well be that "Ouhauerha" (or something similar) was in use in northern Germany for quite some time before making it into the written language.
Comment: Could it have been [auweia](https://en.wiktionary.org/wiki/auweia#:~:text=(file)-,Interjection,!%2C%20oops!%2C%20shoot!)
Comment: No, distinctly auhaue. As in au hauen.
Comment: Werner Flaschbier? That might have been it. She was a WF fan.
Answer: I know it in a slightly different spelling Au haua ha or also as an enhancement in the form au haua haua ha and I think it stands colloquially for what a bummer - oh my goodness.
Regionally, I place the slang in northern Germany with the coast of the North Sea and the Baltic Sea (sailors?). Unfortunately, I haven't found a source.
For fun see and hear also the video clip
Comment: The spelling I know is "Ohaueha", like here: https://www.verlagsgruppe.de/produktdetails/product/delfs-renate-ohaueha-wasn-aggewars.html

Au-haue as regional to Hamburg?


Did prophet isa a.s get the injil at 33 year or when he returns

Question: I'm confused did jesus a.s get the injil when was 33 year old before his he get sent to heaven or when he returns? And if he get it when returns then why allah swt say he sent the injil even tho not yet?
Answer: He was already sent the Injil:
"And We sent, following in their footsteps, Isa, the son of Maryam, confirming that which came before him in the Torah; and We gave him the Injil, in which was guidance and light and confirming that which preceded it of the Torah as guidance and instruction for the righteous."
-Surah Maidah verse 46
We don't know the age he was given it though, the age 33 for Prophet Isa was from the Bible.
Comment: Tysm Allah swt is the most merciful and most forgiving may Allah swt guide to Islam and forgive all you sins make you go jannat al firadus highest rank of heaven and you family and friends as well may Allah swt guide them both and you aswell Ameen❤❤❤❤❤❤❤❤
Comment: Ameen and you're welcome


Proxy sub.domain.com/link1 -> 10.1.1.1:8080/someotherlink1

Question: Trying to do a simple proxy from
sub.domain.com/link1 to another server 10.1.1.1:8080/someotherlink1.
This is what my server context looks like: (I modified the default nginx.conf)
server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  sub.domain.com;
    root         /;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location /link1 {
        proxy_pass http://10.1.1.1:8080/link2
    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

`
but visiting a webpage is just loading the nginx 502 bad gateway page.
Error in the log is:
2017/03/15 22:04:27 [crit] 8647#0: *11 connect() to 10.1.1.1:8080 failed (13: Permission denied) while connecting to upstream, client: 112.xxx.xxx.xxx, server: sub.domain.com, request: "GET /link1/ HTTP/1.1", upstream: "http://10.1.1.1.1:8080/link2/", host: "sub.domain.com"
What's a bit strange looking is the GET /link1/ - as this this should not be the link in the final upstream URL - it should not be trying to get this link.
What am I doing wrong?
Answer: You do not pass the URI on the proxy_pass directive, you need to first rewrite or redirect then pass it to the proxy, for example:
location /link1 {
  return 301 $scheme://$http_host/link2$args;
}

location /link2 {
  proxy_pass http://10.1.1.1:8080;
}


Finding words in a Praat text grid

Question: I'm new to Praat scripting, and I was wondering if there was a way to "find" a word in a text grid tier and then find a sound in a different tier. I want praat to measure the last vowel in selected words in a large corpus (for which I have text grids). I've googled this but can't seem to find anything. If this isn't possible, would it be possible to find this in perl and then use Praat to find formants?
Thanks!
Comment: Can you clarify the question a bit? E.g. do you know how to write a basic Praat script; is the problem identifying "last vowel of a word" given a text grid, what do you want to measure. You can use "system" or "system_nocheck" to call up any kind of external routine.
Comment: Sure - I know some about Praat scripting, but I think I know more about perl (though still a beginner!) I have a sound and a text grid with multiple tiers (one for words, one for phones, and some other stuff). I want to do some kind of "search" where I can input a word that praat will find in the word tier. Then, I want it to find the last vowel in the phone tier and measure the midpoint of the vowel.
Answer: As I understand your question, there are four different tasks:

Look for a word in a TextGrid tier
Find its last vowel
Look for the interval labelled with that vowel in the segment tier
Measure something on that interval

The first and the third seem to me to be on-topic for this question.
1. Find a label in a tier
This is pretty straightforward. The most naive way to do this would be
n = Get number of intervals: word_tier
for i to n
  label$ = Get label of interval: word_tier, i
  if label$ == target$
    index = i
    i += n ; break from the loop
  endif
endfor
appendInfoLine: "My label is on interval ", index

Alternatively, you could use the commands provided in the "tgutils" plugin distributed through CPrAN (full disclaimer: I wrote it). With it, you can include the procedures in find_labels.proc (or just copy the contents of that file into your script) and write
selected("TextGrid")
@findLabel: word_tier, target$
word_index = findLabel.return
appendInfoLine: "My word is on interval ", word_index

3. Finding the vowel interval
You'd then have to do the same but looking only among the intervals that fall within the boundaries of that word for the one that is labelled like the vowel you want.
For this, you can once again use the procedures from the "tgutils" plugin to look backwards for the first interval labelled with that vowel:
# Find the interval number in the segment tier at the end
# of the matching word in the word tier
word_end = Get end point: word_tier, word_index
last_segment = Get low interval at time: segment_tier, word_end

@findLabelBehind: segment_tier, last_vowel$, last_segment
segment_index = findLabelBehind.return
appendInfoLine: "My segment is on interval ", segment_index

The other tasks
Finding the last vowel, and running your analyses, are not within the scope of this question, based on your title. Feel free to create new questions to cover those, or to rephrase the scope of this one!
Comment: This is an excellent answer that is not getting the attention it deserves.

Finding words in a Praat text grid


PreferenceManager getDefaultSharedPreferences deprecated in Android Q

Question: PreferenceManager getDefaultSharedPreferences is deprecated in Android 10. How do I replace it?
Answer: You can use the Android 10 support library version of PreferenceManager, i.e., androidx.preference.PreferenceManager and not android.preference.PreferenceManager.
Remember to add the following to your build.gradle:
implementation 'androidx.preference:preference:1.2.0'

Comment: @AbhinavSaxena Yes of course. That's implicit when using a support library. An earlier edit to this answer added the kotlin-only ktx depency; I rolled back that edit because it was kotlin-only.
Comment: @EdwardFalk I don't know but to me it smells like `getDefaultSharedPreferences()` is collateral damage. Yes, many preferemces-related areas were fragmented so it makes sense to move them to a support library. `getDefaultSharedPreferences()` implementation itself is still the same in both Android platform and AndroidX libraries, so that function did not really need deprecation.
Comment: This seems to have to be `implementation` not `dependency`?
Comment: Not that that works either: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find implementation "androidx.preference:preference:1.1.0.
Comment: I'm curious; why did they deprecate that interface, and was some other way of obtaining shared preferences preferred, or was switching to androidx the intent?
Comment: Where in the build.grandle I add this line?
What happens with older mobile phones if I change "android." to "androidx."?
Comment: What about Xamarin.Android. I've tried AndroidX.Preferences; but it doesn't exist.
Answer: Package preference provides the androidx PreferenceManager:
Java: implementation "androidx.preference:preference:1.1.1"
Kotlin: implementation "androidx.preference:preference-ktx:1.1.1"

i.e.
change android.preference.PreferenceManager to androidx.preference.PreferenceManager

Also see PreferenceFragmentCompat, which is the current PreferenceFragment class to use.
Comment: Added a direct link to `PreferenceFragmentCompat`, which didn't exist back then... it's usually then next one deprecation problem one might face, when trying to update preferences. The other linked answer was only valid for a limited amount of time.
Comment: Can we use in APIs before API 29?
Comment: @H.Karatsanov yes, you can.
Answer: If you're just saving and retrieving key-value pairs you can replace:
 prefs = PreferenceManager.getDefaultSharedPreferences(this);

with:
 prefs = getSharedPreferences(
            "my.app.packagename_preferences", Context.MODE_PRIVATE);

Be sure to use the right file name for the new implementation or your users will lose access to everything saved with getDefaultSharedPreferences(!). The following will get the file name getDefaultSharedPreferences uses:
getPackageName() + "_preferences"

Comment: Nice way to avoid unnecessarily using androidx.preference.PreferenceManager just to access getDefaultSharedPreferences.
Comment: This is a good answer, as context.getPackageName() also works in modules and retrieves the application-id.
Comment: Also note ; for java and not for Kotlin. Kotlin it would look like something like getSharedPreferences(applicationContext.packageName, Context.MODE_PRIVATE)
Comment: also If your are calling it from outside an activity, use "context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE)"
Answer: Use Jetpack DataStore, It is a data storage solution that allows you to store key-value pairs or typed objects with protocol buffers. DataStore uses Kotlin coroutines and Flow to store data asynchronously, consistently,
and transactionally.

If you're currently using SharedPreferences to store data, consider
migrating to DataStore instead.

Setup
dependencies {
        implementation "androidx.datastore:datastore:1.0.0"
}

It also has support for RxJava2 & RxJava3.
Comment: Sometimes we have one choice and it's only shareprefrences, for example when you use third party libraries that receive shareprefrences as parameter called on some method. open street map configuration load method is a case.
Answer: Quote from PreferenceManager documentation:

This class was deprecated in API level 29.
  Use the AndroidX Preference Library for consistent behavior across all devices. For more information on using the AndroidX Preference Library see Settings.
Comment: What wasn't consistent about the original one?
Comment: @androiddeveloper it is obvious, missing letter x in the package name
Answer: Kotlin library
implementation 'androidx.preference:preference-ktx:1.1.1'

Kotlin use
Configuration.getInstance().load(this, androidx.preference.PreferenceManager.getDefaultSharedPreferences(this))

Answer: Yes, it is deprecated.

Use the AndroidX Preference Library for consistent behavior across all devices. For more information on using the AndroidX Preference Library see Settings.

Follow this -
PreferenceManager
Answer: implementation "androidx.preference:preference-ktx:1.1.1"

class file PrivateSharedPreferences;
class PrivateSharedPreferences(context: Context) {
private val file = "com.example.com_shared"
private val key = "private_key"
private var sharedPreferences = context.getSharedPreferences(file, Context.MODE_PRIVATE)
private val editor = sharedPreferences.edit()

fun save(ok: Boolean) {
    editor.putBoolean(key, ok)
    editor.apply()
}

fun read() : Boolean {
    return sharedPreferences.getBoolean(key, false)
}

}
read from fragment or adapter;
PrivateSharedPreferences(context).read()

save
PrivateSharedPreferences(context).save(true)

Answer: You can import this library at app level gradle
implementation "androidx.preference:preference-ktx:1.1.1"

Then remove imported file from class where you create "PreferenceManager"
Press Alt+Enter and import androidx hope you get latest version of preference manager.
Answer: You have to import androidx library like
import androidx.preference.PreferenceManager

For kotlin DSL:
implementation("androidx.preference:preference:1.2.1")

For KSP:
implementation("androidx.preference:preference-ktx:1.2.1")

For more info, you can visit official document of Preference.


Richtext editor for PHP - MySQL web application

Question: I have a PHP web application inside where i need to have a rich text editor(with basic formating options) for my users to enter data in to the portal.
Can any one tell me how to do this ? Will there be any change in the database saving part since i am saving data in a mysql DB
Thanks in advance
Answer: FCKeditor is pretty good and is painlessly easy to use. Some simple javascript calls at page load and it'll magically replace textareas with RTEs. plus it runs well on browsers going   all the way back to IE5.5. There should be no impact on your database assuming you are already prepared to cope with HTML coming in from your textareas...
Answer: Or maybe RTE(rich text editor) from yahoo user interface library?
Yahoo editor.
Which I think might have some benefits:

Hosting (fast, optimized) from yahoo
Answer: Spaw editor don't update for some reason, so I switched to the Cute Editor for PHP.
Answer: You should give a go to FCKEditor.
You can also take a look at these.
Answer: I recommend you FCKEditor, it's easy to integrate with PHP...
Answer: There are a number of different options, the most prevalent being TinyMCE andFCKEditor.  I recommend shopping around a little bit for one you like, but they should all submit valid html in forms, etc.  The biggest difference may be in the way you validate input to protect against XSS attacks (you need to allow 'safe html' in form submissions; this looks promising).
Answer: i like tinymce
Answer: Nicedit is an easy-to-use and lightweight (~25KB) WYSIWYG editor for Javascript.
You can customize the style and the buttons you want to appear in the toolbar.
You can also extend it, saving data with AJAX, generate valid XHTML, create multiple editors, upload images, BBCode, and more...
I use it with jQuery and I'm very satisfied with the results
And it's open source :) with a MIT License
Answer: To use any of the RTF style editors you have to set the fields in which you are going to store text to be of data type LongText.
Both TinyMCE and FCKEditor are good and both will store text formatting information as HTML Tags.
In both cases inserting graphics and/or Flash will require you to first upload the content to using their interface and then insert it.
We have observer that TinyMCE seems to be faster to load compared to FCKEditor on our systems.
Answer: I have reviewed many of these systems and find, like many of the posters above, that FCKEditor and TinyMCE are the best.  I go with FCK though because it has bult-in file/image upload support - you have to pay for module to achieve this on TinyMCE.
Comment: FCKEditor has a commercial licence or an open source personal and educational use licence, depending on your requirements.
http://www.fckeditor.net/license
Answer: I've never tried but MarkitUp! appears great. It was built on the jQuery library.
Answer: We have been using the SPAW editor for a few years now, which you handle and code via PHP instead of JavaScript (so its a server-side coding perspective instead of client-side).
We have found it to be extremely extensible and customizable.
If you want to have a look, here is the link:
http://www.spaweditor.com/


What is the earliest I can file a self-assessment tax return in the UK after the tax year ends

Question: I have overpaid tax in the UK this tax year, and for cash flow reasons, it would be best to get this back as soon as I can by filing a tax return as soon as possible after the year ends. How quickly does the HMRC accept self-assessment tax returns after the end of the tax year?
Comment: Re the telegraph issue, I'm not sure if HMRC actually collect an underpayment for year N in the year N+1 taxcode, rather than year N+2. What may have actually happened in that case was that they adjusted the tax code for year N+1 based on the assumption that things would happen the same as in year N, i.e. to get PAYE for year N+1 more accurate.
Comment: I don't know the answer (but it's a good question) - however, be aware that submitting very early can lead to complications: https://www.telegraph.co.uk/finance/personalfinance/tax/11950784/And-now-the-penalty-for-filing-your-tax-return-too-EARLY.html
Comment: Also note that if you haven't done one before you need to register for the system, which requires some info to be sent through the post and therefore can take several days. Make sure you do this in advance of when you need it. Also, you will need some information from your employer (P60, P11D) and bank account interest statements etc. which won't necessarily be available straight away at the end of the tax year, so it's not necessarily just about HMRC's ability to accept the return. My employer doesn't issue P11Ds until July.
Answer: Checking my records, I have successfully submitted a return on 10th April for the just-finished tax year, and I received the refund (several thousand pounds) on 19th April.
As outlined in this question, you don't need a P60 before you submit if you can infer the figures on it from your final payslip. Likewise you should be able to calculate savings interest yourself from bank statements. If you expect a P11D then you have more of a problem as those are typically not issued for a few months.
HMRC will typically immediately adjust your tax code for future tax years based on the information in a tax return. For example if you claim a certain amount of gift aid, personal pension relief, savings interest and employment expenses, they will assume the next tax year will have the same figures and will issue a tax code designed to get PAYE exactly right the next year.
This may or may not work to your advantage, for example if you make a large one-off pension contribution in year N, they will assume it will happen in future years too and will end up underpaying tax via PAYE for year N+1 and year N+2 until you submit the tax return for year N+1, so you'll end up owing them money - not a problem if you plan for it as it just makes your cashflow better, but you have to be aware of that. In extreme cases if you have a lot of underpaid tax in year N+1/N+2 might even lead to them demanding a payment on account for the following tax year.


find the application that consuming large memory

Question: How to find which application is consuming large memory?
Is there any other way than using top?
Comment: What is wrong with `top`?
Answer: you can pipe the output of ps and sort the column of memory depending on the requirement.
<code>ps aux | sort -r -k4
</code>
Answer: It would be useful if you could specify your OS  (e.g. Ubuntu 12.04) and system(e.g. desktop/server) to help identify potential tools. For instance I can run 'gnome-system-monitor' which gives me a GUI display where I can sort by any of user, cpu, memory and other fields.


Can life exist on planets like Mercury?

Question: Can life exist on planets as barren as Mercury? How would it survive? It seems like it couldn't. Mercury is very hot, would any life break down becuase of the heat? What other challenges face life on Mercury?
Comment: It of course depends on how "hard science" you want to go. Hal Clement has an excellent short story, "*Proof*" (featured in Isaac Asimov's antology "*Where do We Go from Here*") about neutronium-based living beings (and the weird theory advanced by one of them about the existence of other forms of matter outside what we call stars).
Comment: Heat isn't the only factor, consider lack of atmosphere, thus complete expose to UV radiation, not even talking about gamma rays, from which Earth's magnetic field is what defends us.
Answer: Anything is possible

Life as we know it on Earth could not exist on Mercury without serious terraforming. Mercury has very large temperature swings, the side facing the sun can reach temperatures of around 900 C, while the dark side can drop to temperatures similar to that of deep space. Because of this, liquid water cannot exist on Mercury, and water is a hard requirement of life on Earth.
Mercury also faces frequent asteroid impacts. Because Mercury lacks an atmosphere, these impacts would be unimpeded and highly dangerous. All life would likely be destroyed by them. I would like to note that Mercury does not face bad impacts from solar wind, because it has a strong magnetic field, slightly stronger than Earth's.

The question does ask how life could exist, and my favorite phrase on this site (see top of post) definitely applies. Life as we know it could not exist on Mercury, at least not without impressive terraforming (see next section). But life on Mercury could exist if it didn't rely on water, and could stand rapid and violent heat swings. Or if life could survive in the magma of a planet, then it could live on Mercury. In an Earth based context, these don't make sense, but using soft-science it would be possible.

Another possibility would be to terraform Mercury. The first step in terraforming any atmosphereless planet is to give it an atmosphere. On Mercury an atmosphere would be difficult to maintain because it has such small mass, about have the size of Mars or 0.55 Earths. Gravity enhancers may be necessary to maintain an atmosphere, this has not been tested so we can't know fully. A magnetic field is not a problem, Mercury already has one.
After adding an atmosphere, the next step would be to stabilize the temperature. This would require moving energy from the warm side of the planet to the cold side. Once an atmosphere is in place, it is not necessary to move as much energy as some energy will be kept. Once the temperature is around the planet, most of the energy should be reflected. Then water needs to be introduced along with terrestrial life.
It is possible that underground habitats would be easier to manage, but they would still require significant ability to manage heat. An atmosphere, at least in the habitable space, would also be needed.

References
http://www.universetoday.com/22097/life-on-mercury/
https://en.wikipedia.org/wiki/Mercury_(planet)
https://en.wikipedia.org/wiki/Terraforming#Other_bodies_in_the_Solar_System
Comment: "Life as we know it on Earth could not exist on Mercury" and vis versa assuming there was a life form on Mercury it probably wouldn't be able to survive on earth.
Comment: When you say frequent asteroid impacts, do you mean frequent as in the past hit by tons and leave a dotted surface without erosion, or do you mean more recently due to the location near the sun that it will be struck by more meteorites?  I know mercury lacking erosion will show scars just like the moon, unaware that this is still more likely in recent years (recent years on a planetary scale, say 10k - 100k?)
Comment: @Twelfth Not sure quite what you mean, but Mercury has been heavily bombard in the past. To be exact, The Late Heavy Bombardment really hurt it. The problem is because it has no atmosphere.
Comment: For that matter the LHB really hurt Earth. It might well have destroyed most or all of the crust.
Comment: Just for the record, Mercury's magnetic field is approximately 1.1% of Earth's.  It is most definitely not stronger than Earth's.
Comment: 900 degrees Celsius!? I think you're confusing the Celsius and Fahrenheit scales here.
Comment: @YobdDigital Good point!
Answer: It would not be possible for Earth-like life to exist there. Perhaps some kind of metallic-based organism, or something similar to a biological nanobot (an advanced type of virus, maybe?) with extreme self-repair capabilities, extreme resistance to heat and radiation, might be able to survive, especially in areas like the sides of ancient craters, where the sun never fully reaches but which aren't in complete darkness either, and which are less likely to be affected as much by new bombardment.
Answer: Mercury is not as hot all over as it looks. There is water ice on its surface that may well be permanent. Granted, that's not necessarily permanent on the timescale required for life to develop.
However, like the Moon, the reason that there's water ice in shaded areas is because there's no significant atmosphere to actively transfer heat. And no atmosphere means no pressure, which means no liquid water (it sublimes from solid to vapour). We don't really have the first clue what something might look like that exists in the absence of both liquids and gases, but that we'd choose to call "life" once we saw it.
So things aren't looking good for native life on Mercury, but it's not quite so simple as "too hot".
If you're talking non-native life, then building some kind of station in a shady spot on Mercury isn't absurd. Underground would probably make more sense, though. But that's just a special case of, "with enough technology you can build a climate-controlled habitat almost anywhere".
Answer:
It is known that there are an infinite number of worlds, simply
  because there is an infinite amount of space for them to be in.
  However, not every one of them is inhabited. Therefore, there must be
  a finite number of inhabited worlds. Any finite number divided by
  infinity is as near to nothing as makes no odds, so the average
  population of all the planets in the Universe can be said to be zero.
  From this it follows that the population of the whole Universe is also
  zero, and that any people you may meet from time to time are merely
  the products of a deranged imagination

Life is a strange and varied thing... And I guess "Life as we know it..." is a somewhat relative term. New species are still being discovered on a fairly regular basis.
I would guess that if we one day discovered life on a planet like Mercury it most likely take the form of an extremophile, most likely some sort of hyperthermophile.
The hypothesis of panspermia would seem to suggest that finding these tiny survivors on inhospitable planets would be entirely possible.

Panspermia is a hypothesis proposing that microscopic life forms that
  can survive the effects of space, such as extremophiles, become
  trapped in debris that is ejected into space after collisions between
  planets and small Solar System bodies that harbor life. Some organisms
  may travel dormant for an extended amount of time before colliding
  randomly with other planets or intermingling with protoplanetary
  disks. If met with ideal conditions on a new planet's surfaces, the
  organisms become active and the process of evolution begins.
Answer: I disagree on the impossibility of life.  There are areas on Mercury that experience a milder climate (other than the lack of an atmosphere) than the Earth itself.  I have even seen a proposal to colonize them.
The closer you get to the poles the cooler it gets, there's a ring around each pole that averages what we consider comfortable and once you go deep enough underground it stays this way all the time.
While it's not likely that live managed to evolve in such an environment we can't rule it out.
Answer: Imagine Mercury with more water.  This would create an atmosphere of water vapor.  If there was a lot of water the planet would get a thick water atmosphere and have a runaway greenhouse and turn into a steamball (see here: https://planetplanet.net/2016/04/06/no-livable-planets-without-life/).  With a modest amount, water would likely simply be transported to cold traps and freeze out, like in craters or at the poles or on the night side of the planet.  Since the planet is in 3:2 spin-orbit resonance, its day is about 59 days (its orbit is 88 days).
I can imagine a really interesting setup.  There are 3 source of water on a wetter (but not too wet) Mercury: 1) randomly-located ice deposits in large craters; 2) permanent cold traps at the poles; and 3) a cold trap on the night side that migrates across the planet as the planet rotates.  I'm not sure whether this migrating cold trap would persist but it's an interesting idea.  It would be sort of like an Eyeball planet (see https://planetplanet.net/2014/10/07/real-life-sci-fi-world-2-the-hot-eyeball-planet/) but one that is constantly changing as the planet slowly spins.
Life on such a planet?  Well, where there is water on Earth there is life.  So, I think it's totally plausible to imagine life in two places: at ice deposits (permanent or migrating/temporary) and in the subsurface, also in water-rich areas.

Can life exist on planets like Mercury?


The meeting IS TO take place at 10 pm

Question: The meeting is to take place at 10 pm
Should "Is to" be mean here as "have to" or "going to"?
Another example:
Those of you, who sign up are to be commended.
This kind of sentences confusing me a bit) What rules in action here?
Comment: http://www.grammaring.com/be-to-infinitive
Comment: The capitalisation of IS TO at least hints at the illocutionary act Amadan mentions, though I suspect it is merely meant to highlight the string. But see what Jasper says about that.
Answer: It can be used in two meanings:

More commonly as a statement of expectation, pretty much equivalent to "The meeting is supposed/expected/scheduled to take place at 10 pm".
Less commonly as an illocutionary act: "I hereby declare that the meeting shall take place at 10 pm". Compare with a bit more salient "The defendant is to pay $5000 in damages to the plaintiff (bam)".
Comment: Apparently, according to Searle's classification, these **both** fall in the 'illocutionary act' speech act classification. The first is subclass assertive, the second subclass directive. Previously, I'd only come across the 'illocutionary act = speech act that [instantaneously and unavoidably] changes the reality in accord with the proposition of the declaration' [Wikipedia] usage; in Searle's [1975] classification, this is the declaration subclass.
Answer: Essentially (and semantically), is to here functions like will (synonymous with going to):
The meeting will take place at 10p.m.
However, your organization of what goes with what is a little off. To doesn't go with is but rather belongs with take (to take). To is the infinitive marker (to be, to hold, to laugh, etc.).
Comment: [Related](https://english.stackexchange.com/q/613772/2085).

The meeting IS TO take place at 10 pm


Perfect multicollinearity with a cubic term in the model?

Question: I'm trying to figure out why adding a cubic term in the model doesn't guarantee a perfect multicollinearity. If $X$ is known, then $X^3$ is known in both magnitude and sign and vice versa. It may not be the case between $X$ and $X^2$ in terms of sign.
Comment: Multicollinearity usually refers to a **linear** relation between two variables.
Comment: A standard tool in mathematics is based on such considerations: if a nontrivial linear relation $c_0+c_1X+c_2X^2+c_3X^3=0$ holds, that means every component of $X$ is a root of the polynomial $c_0+c_1x+c_2x^2+c_3x^3,$ whence (by the Fundamental Theorem of Algebra) there are at most three distinct possible values for the components of $X.$ Since that's not generally true--many datasets have many more distinct values of their variables than that--it cannot be generally true that $1,X,X^2,X^3$ are collinear. This idea appears in my analysis at https://stats.stackexchange.com/a/408855/919, *e.g.*
Answer: Multicollinearity refers to the situation in which the regressor matrix $Z$ does not have full column rank $k$.
This is the case if it is possible to linearly combine the columns $z_1,\ldots,z_k$ into the zero vector with a vector $a=(a_1,\ldots,a_k)'$ other than the trivial zero vector $0$, i.e.,
$$
a_1z_1+\ldots+a_kz_k=0
$$
for $a\neq0$. If, say, $z_1\equiv X=(-1,0,1,2)'$, then $z_2\equiv X^3=(-1,0,1,8)'$. You will not find values $a_1,a_2$ other than zeros that produce
$$
a_1\begin{pmatrix}-1\\0\\1\\2\end{pmatrix}+a_2\begin{pmatrix}-1\\0\\1\\8\end{pmatrix}=0.
$$
If $z_2$ were some multiple or fraction of $z_1$, it would be possible, so that we would have multicollinearity.
As an aside, if your regressor $X$ is a dummy variable, we do have multicollinearity with powers of $X$, as powers of $0$ and $1$ are of course also $0$ and $1$.
Try, e.g.,
<code>X <- -1:2
lm(rnorm(4)~X+I(X^3)-1)

X <- sample(c(0,1),10, replace = T)
lm(rnorm(10)~X+I(X^3)-1)
</code>
Answer: You often will get multicollinnearity issue with cubes but not the perfect kind. In your case a perfect multicollinnearity can be defined as: $\alpha x+x^3=c$.
This is not true by definition. However, when $x<<1$ you get $x-x^3\approx 0$ because $x^3\approx x$. Therefore, sometimes you may get perfect multicollinearity warning or design matrix condition number too big warning due to rounding, but this will not happen with every data set.


How high were the tides back when the Moon was much closer to Earth?

Question: In this article it is stated that the Moon was originally much closer to Earth at a distance of 22,500 km rather than the 384,400 km it is today. What was the height of the tides back then in meters? Surely they would've been orders of magnitude higher?
Comment: The [tidal force](https://en.wikipedia.org/wiki/Tidal_force#Formulation) and the [height](https://hepweb.ucsd.edu/ph110b/110b_notes/node13.html) of the tides are proportional to the inverse cube of the Earth-Moon distance.
Answer: To expand on Keith's comment, the equation for the tidal force is based upon the difference between the acceleration due to the orbiting object, and the gravity of the body itself, i.e. the difference between how hard the Moon pulls on you compared to how hard the Earth pulls.  This results in an overall equation of:
$$|a_{tidal}| = 2\Delta r G \frac{M}{R^3} $$
where $\Delta r$ is the radius of the Earth (6371 km), G is the gravitational constant (6.674 x 10$^{-11} m^3kg^{-1}s^{-2}$, M is the mass of the Moon (7.342 x 10$^{22}$kg), and R is the distance between the two (here either 22,500km or 384,400km). To check our equation we can calculate the current tidal acceleration: using 384,400km, we arrive at a value of 1.099 μm/s$^2$, which is close to the accepted value of 1.10 μm/s$^2$ (2).  Calculating the tidal force using the distance of 22,500km, we arrive at a value of 0.0055 m/s$^2$, or about 5,000 times the current tidal force.  That could make for some massive tides, however, were there oceans?
Current research suggests that the Moon formed as the result of a major impact, around 4.5 billion years ago (3), while the first oceans formed around 4.4 billion years ago (4).  This leaves a gap of around 100 million years between that 22,500km distance and the formation of the oceans, but it is close enough that the tidal force is likely not that different.  However, translating the height of the tides is difficult.  As the average tide is about 0.6m (5), a tide 5,000 times higher would be almost 3km high, which seems impossible.  Additionally, the height of the tide appears to be more strongly affected by geography than by the tidal force, as the current range of tides is from 0-15m in height.  The earliest evidence we have of tides is about 2.5 billion years ago (6), but unfortunately, the geologic record only records the pattern of the tides, not the height.  We can tell that the Earth was spinning faster then, with a day 4.5 billion years ago being about 4-5 hours long, but it may have been too cold to melt the oceans.
So, to sum up:  The tidal force with the Moon at that distance would be 5,000 times greater than it is today, but there may not have been oceans, and the tide height is affected more by the shape of the ocean than the tidal force itself.  However, something like the water planet in Interstellar, with massive, 3,000km-high tides sweeping over the Earth every couple of hours is possible, although a boring ice planet is possible too.
Comment: Good math -- I might suggest adding a *slope* estimate.  We tend to see dramatic tidal effects at landfall (or the Bay of Fundy), but if we assume a large expanse of ocean, even a 10-km difference between high and low tide, spread over 1/4 the Earth's circumference, is not a very steep slope.
Answer: IMO the difference in orbital distance was a minor factor.  With all other parameters held constant, tidal force, (as being a function of the derivative of gravitational force) is proportional to the relative rate of rotation of earth WRT the gravitational fields being exerted on it by the Sun and the Moon. Consider for a moon-less Earth, that if Earth was tidally locked with the Sun (1 year = 1 day), there would be zero tidal force on earth.
Earth's rotational energy is being dissipated as heat from tidal deformation and is the reason Earth's rotation has been slowing down since the time Earth formed. Earth was spinning faster one billion years ago, a day lasted ~19 hours. Per my assertion, the magnitude of ocean tidal extent (discounting differences in continental plate arrangement, etc) would have been much greater even if the Moon had never existed.
Using a simplified model with Earth's rotational axis parallel to its orbital axis and one that doesn't include the Moon, my assertion for what causes tidal force is that a particle on Earth's surface at the equator is moving slower than Earth's solar orbital speed at astronomical noon and faster than Earth's solar orbital speed at astronomical midnight. Therefore, solar gravitational attraction exerted on that particle is greater than orbital centripetal force at noon and less than orbital centripetal force at midnight.  This of course would deform Earth, causing it to bulge in two directions at once with the noon side toward the Sun and the midnight side away from the Sun.  Particles along the axis of Earth's rotation (eg. at the poles) and those laying along Earth's orbital path at any instant would match earth's orbital velocity and therefore not experience any tidal force.
I looked at the "numbers" a long time ago and found the force differences to be substantial, (far more than that from the difference in orbital distance via Newton's gravity equation).  I'll leave it to someone else to verify it.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Reporting Services - Header Columns not showing?

Question: I'm using Reporting Services 2008 and Report Builder 2.0. I've used a tablix to display my data in a simple way - essentially each row in the database receives a row in the tablix - nothing fancy. I have a header row with a name for each column. I also have a super-header which groups together a few of the columns into logical groups (e.g. basics, address related, etc.). Now when I generate the report everything looks beautiful - but if I page to the next page it doesn't show the headers. I've tried setting the Repeat Header Rows on Each Page but it doesn't seem to help?
Answer:
In the Tablix properties check the boxes for: Repeat header rows on each page and Keep header visible while scrolling.
Make sure that the column headers check boxes are NOT checked.
In the Group pane on the left (Row Groups), the first line is static. Set the following    for this first static only
set its: "ReapetOnNewPage" property to TRUE
set its: "FixedData" property to TRUE
set its: "KeepWithGroup" property to AFTER

It will work surely!
Source : Answer by ambk on this MSDN
Answer: I solved selected advanced next to row groups and column groups then it would show me the additional header rows. I could then select one of these header rows and change the property RepeatOnNewPage to True.
Answer: In your RDLC file, make sure that you have a Header node specified.  It is possible that you are referring to your "Table" headers, which is not the same as the Report RDLC Header.  The Report Header is the one that will repeat using the RepeatHeader property.


What is the main difference between Web 8.5 and Tridion Sites 9.1?

Question: Am looking for the main difference between both. Can anyone help me in this?
Comment: Here's a good source: https://docs.sdl.com/783502/676235/sdl-tridion-sites-9-1/what%E2%80%99s-new-in-------------sdl-tridion-sites
Comment: Also, 9.5 has been recently released, and has a lot more business-focused improvements you may want to look into.
Answer: As you can see @Nuno shared the official release notes of sdl documentation for good source.
In High level listed out main functional and technical features of sites 9.0 and 9.1
Functional features

Pre-defined Regions support
Usability improvements for Component Presentations
Blended marketing and product information from SDL Tridion Docs
Image editing

Technical Features

Shared delivery platform (DXD)
Shared taxonomies with SDL Tridion Docs
GraphQL Content API
Rolling Upgrade Support
Docker container Support for DXD
SAML 2.0 support
Technology agnostic integration framework
Add-On Management
Fredhopper replaced to Elastic search for XO

In SDL Tridion Sites 9.5 released with following features:

Experience Space - new UI
Headless Content Publishing
Search - SDL Tridion Sites now ships with out-of-the-box support for Elasticsearch-based search for published content
Semantic Content Models
Elasticsearch Engine
OpenID Connect
Access Management UI

Refer to the SDL Documentation for release notes
Download What's new in SDL Tridion Sites 9.5 data sheet to find out more
I hope it helps


Restoring a note

Question: Is it possible to restore a deleted note in Ubuntu One? On the web page "Recent activities" it says "TODO deleted"
Answer: The complete procedure:

Download Script
Find all deleted notes:
python ./ubuntuone-couchdb-undelete.py --dry-run notes

Restore note (Example: "31d3caac-6b5c-47ce-8edb-4cb74a8b34a2")
python ./ubuntuone-couchdb-undelete.py notes 31d3caac-6b5c-47ce-8edb-4cb74a8b34a2

Answer: It is possible.  I read about in the ubuntu-bugs mail archive   .
Good luck!
Comment: Thanks a lot - I have now recovered my never ending TODO list :)
Answer: The possible solution that Renat mentions looks promising.  The mail-archive broke the URL of the script described, but you can also see these instructions in the original bug entry in launchpad for more details.
Here's an excerpt:

[...] please contact ubuntuone-...@canonical.com
  so that we can help you recover your note in
  case the instructions below are not
  helpful
Please download the script from
  http://people.canonical.com/~roman.yepishev/us/ubuntuone-couchdb-undelete.py and run it in the terminal
  as described below:
Find all deleted notes:
$ python ./ubuntuone-couchdb-undelete.py --dry-run notes

Answer: Got this error message
ERROR: Access token cannot be found. I tried
Ubuntu SSO and gnomekeyring and found nothing

Please authorize your machine via Tomboy or Ubuntu One.

Answer: The script mentioned in other answers doesn't work anymore as @Jaseem points out.
All your deleted notes should be backed up in ~/.local/share/tomboy/ and ~/.local/share/tomboy/Backup/.
find ~/.local/share/tomboy/ -name '*.note'

The problem is that notes are only backed up here if you've edited them on this box.
However if you can remember the last machine you edited them on then you can copy them from there.
(Ubuntu 12.04 just crashed on me and took all open tomboy notes with it (wtf), but this works for me in 12.04 with Tomboy 1.10.1)
Comment: Additionally I'm now unable to sync the notes =(

Restoring a note


How can I keep exports from stealing?

Question: I'm selling gold to China through an export trade route. I'm also running two Electronics Factories, which require gold and bauxite. How do I keep the export trade route from stealing candy from a bab gold from my factories? I keep seeing the factories run low (and occasionally out) of gold.
Answer: Turn off the Trade Export, there is no other way. Just like your previous question you're trying to micromanage too much. Profits of Electronics > Gold.
Edit:
If you're at the point of selling electronic goods, your island should be full blown. Meaning, this 1 commodity should not matter in the big picture. You said, you don't have enough gold to export and keep your factory(s) stocked with gold.
If you have a Contract setup, that is what is "stealing" your gold.
What kind of answer are you looking for? Tropico is not setup to micromanage, exactly how many gold units you export and how many you use in your production. If you have a trade setup and it's going to use that is a priority to export before caring about production.
Can you tell me how much you are making on Gold export vs electronics exports? I doubt it, BUT if you could, finished goods always make more money.
Profits of Electronics > Gold. Raw goods will never make as much money as finished goods. This is fact. So my answer is your best course of action, unless you find another mine somewhere on the Island that has gold.
Comment: It's not quite that simple; a factory only makes a few hundred units a month, while a dock can import/export about 1000 of any given resource in a month (3000 units/shipment, one shipment per 3 months). And the economics change again if you have great trade routes.
Comment: I just checked my docks; part of my problem is that all of my docks have gold that's apparently marked for export. Seriously, there's gobs of gold (and bauxite) sitting in the docks marked for export, and my factories are frequently running out. I am seriously confused by my teamsters' priorities.
Comment: @paulmarshall I don't know what kind of answer you want, but that's all I got.
Comment: @Paul That same dock is selling your finished electronic goods as well, so I don't really see your point. You need to choose whether you want to export all your gold, or use it to produce electronics. If you go with the later you want to produce roughly as much gold as your factories need. Basically either build more factories or don't build as many mines.

How can I keep exports from stealing?


Asymptotics for the first zero of the Bessel functions

Question: Let $J_\nu$ be the standard Bessel function of the first kind and let $x_\nu$ be its smallest zero. Is there a simple reference or result for the asymptotic expansion of $x_\nu$ when $\nu$ goes to $+\infty$?
Comment: Have you looked at [DLMF 20.21(vii)](https://dlmf.nist.gov/10.21)?
Answer: Watson? (1922, pp. 486, 516, 521) has for the smallest positive zero:
$$
\sqrt{\nu(\nu+2)}<x_\nu<\sqrt{2(\nu+1)(\nu+3)},
$$
$$
x_\nu= \nu+1.855757\nu^{1/3}+O(\nu^{-1/3}).
$$
Answer: (I'd post this as a comment on Francois Ziegler's answer but don't have the rep...)
Elbert (https://www.sciencedirect.com/science/article/pii/S037704270000635X#BIB34) cites Tricomi[1] as improving Watson's result to
$$x_v = v + 1.855757 v^{1/3} + 1.03315 v^{-1/3} + O(v^{-1}) $$
and Olver as improving it further to:
$$x_v = v + 1.855757081 v^{1/3} + 1.0331502 v^{-1/3} - 0.00397406 v^{-1} - 0.0907627 v^{-5/3} + 0.0433385 v^{-7/3} + O(v^{-3})$$
(I haven't read Olver's paper too carefully but presumably one can 'turn the crank' on Olver's (8.7) to get further terms as needed)
[1] Tricomi, Francesco Giacomo. Sulle funzioni di Bessel di ordine e argomento pressoché uguali. Tipogr. Bona, 1948.
[2] https://www.cambridge.org/core/journals/mathematical-proceedings-of-the-cambridge-philosophical-society/article/further-method-for-the-evaluation-of-zeros-of-bessel-functions-and-some-new-asymptotic-expansions-for-zeros-of-functions-of-large-order/3A90541296335E9F85872E91C84098B1


What is the best way to build a closed loop continuous rotation servo for 3D printer?

Question: So I was thinking of using a closed-loop motor in my 3D printer for better accuracy and high-speed printing without losing steps. I have analyzed options available including just tweaking stepper current and firmware changes to prevent step losses but I want to find the best way to do it with encoders. The problem is I need a pretty high resolution for a 3d printer and usually, high-resolution servo motors use potentiometers that are limited and not suitable for a 3d printer. I am thinking of building my own closed-loop continuous rotation servo using stepper/DC motors and encoders but I can't find any high-resolution encoder at a reasonable price. So is there any way to somehow use low-resolution encoders (like 36 pulse every full turn) or is there any encoder type that I can use for better accuracy at a reasonable price other than optical ones? Also is there any other solution for closed-loop systems at a reasonable price?
Note that I am aware that I may need to modify firmware or write my own code for motors and program them from scratch.
Note: You might consider this question Closed-loop stepper motors a possible duplicate but I have read that and my main problem is not being able to find any cheap high-resolution encoder for this purpose.

Also for some reason, I can't use products like BTT S42B closed-loop stepper drives, my only option is to build them myself.
TL;DR:
Is there any type of encoder with high resolution and cheap price for use in 3D printers? (I don't mean brand, I mean technology)
Comment: I am just asking for clarification: on one hand you say "I need a pretty high resolution for a 3d printer", and on the other you consider 36 "steps" per turn - while standard stepper motors make 200 steps (of 1.8 degree)?
Comment: @octopus8 The problem is exactly this. The cheap encoder pulses every 10 degrees that is so low. I had an idea in my head like a 1:100 gear reduction and attaching encoder to gearbox input part so the resolution will be 0.1 degrees. I am asking for solutions to this problem, including other encoder types and possibly any similar solution
Comment: Gears will have backlash, unless you can measure it you won't be gaining anything. And ironically to measure gear backlash will require an encoder ha. A high resolution encoder is your only option tbh.
Comment: What about stepper motors with attached planetary gearbox, like 3:1? Do they also have a backlash? Or maybe it is not really important, because achieved increase of resolution is still better?
Comment: If you're after accuracy, you're probably after quality as well. Since three to four axes need to work together in a printer, the delay of correcting a step will probably do more harm than good for print quality.
I still believe that proper drivers (e.g TMC5160) with proper steppers are a much easier way to prevent lost steps. I've had my CoreXY Direct Drive X-Axis up to 1200 mm/s at 20k mm/s^2 without lost steps.
Answer: You can use a magnetic position encoder.
AS5048B High Resolution Position Sensor
14-bit rotary position sensor with digital angle (interface) and PWM output
14 bit means 16k steps/rotation. With a stepper which does 200 steps/rotation and 16x microstepping, you will need only 11 bit, so you have plenty of extra accuracy you can use to filter noise.
You may use AS5600 Positioning Sensor instead, which is 12 bits, since you don't need to track each microsteps in a closed loop, 4x is enough.
AS5600 in PWM mode does up to 920 Hz, AS5048 1 kHz. I'm not sure in I2C mode but surely more. Of course you have to take into account delay between measuring the position and transmission of the position.
Comment: Very interesting stuff. Would it just need to glue a flat magnet to the motor's shaft? --> found it. There are even links of recommended magnet suppliers.
Comment: @octopus8 I bought both boards on Aliexpress and they come with a magnet already. I guess you just need to be careful with iron parts nearby, because if they are VERY close they may distort the field and cause nonlinearity issues.
Comment: Thanks for your answer. So I can do up to 1/64 microsteeping if it has 16k PPR. Which means 2.5 microns resolution without any error. Will this make any change in print quality compared to normal printers without an encoder?
Comment: Also, I don't have much information on encoders. So is it better to use absolute or incremental for this purpose?
Comment: No I would not step up to 64X, it's mechanically pointless because nothing in the 3D printer is accurate enough for that. 16X is plenty. Also, I guess you have not much experience with experimental measurement, but if you measure 1 mm with a ruler which has 1 mm ticks, your uncertainty will be 100%. You want the measurement tool to be much more accurate than whatever you measure. Also, those encoders have uncertainties of at least 2 bits, so 16X is already the max you can use to get meaningful data. For the rest you have to look it up, I never used them personally (yet).
Answer: The gearbox approach is solid, but it will be 100x slower, and you said you wanted speed.
Comment: It will be much slower, indeed. And probably less reliable. Trying to build reasonable speed of the whole reduction setup 100:1 it would mean rotating stepper motor by two orders of magnitude. So it will have much less torque, will be probably loosing steps, and may be even impossible to turn this fast. (Otherwise with 1:100 increase, but I won't consider the impact ;) ).  Though, all this is just a remark, not a complete answer how to build a solution :(


Emoticon on keyboard support and Android version

Question: I am wondering since what version Android emoticon have been added?
Answer: The answer depends on a variety of things, most importantly whether the vendor or manufacturer uses the Google keyboard or one of their own. Some apps, including Facebook and most manufacturer/vendor Messaging apps, have their own built-in emoticon support.
The default keyboard for Lollipop (5.0) on the AT&T Samsung Galaxy S5 has built-in emoticon support. If memory serves, Kitkat (4.4.2) did not.
Answer: According to caniemoji.com

Android 4.3 Jelly Bean was the first release to include a built-in keyboard (iWnn IME), and Android 4.4 KitKat is the first to include a color emoji keyboard.
Versions of Android prior to 4.3 require the use of a third-party keyboard app to insert emoji, or can copy/paste emoji from the list of all emoji.


Wordpress login security

Question: I have put up a logging script on my wp-login page. I noticed that a particular ip address- 18.104.22.168 has been consistently visiting my login page for some days now. The vitis are always in quick succession and 3 times exacly. That is the no. Of failed attempts my plugin allows, before suspending an ip. Should I be concerned and is there any precaution that I can take? For example blocking that particular IP will help or should I block some range of IPs? I did a whatismyip.com lookup, but they had no information. Does changing the name of my wp-login.php to something else helps?
Answer: No, the requests will still happen, even if it results in a 404. If you keep logging, you'll also notice attempts to log in to Drupal, Joomla, and other major CMS, including server exploits for IIS Apache and Nginx
This is because they're automated opportunistic requests, they're not actually looking at your site, they're only looking for successful logins. Most sites get these, sometimes in large spikes, sometimes as consistent background noise.
If you're worried about your security though, I'd suggest that you:

Add a brute force login mechanism, such as the one included in Jetpack, or the popular limit logins plugin
Force a minimum password strength, there are several plugins that can do this for you, though I cant recommend one
Use 2 factor authentication

Other than that, there isn't anything you can do to eliminate the possibility short of a major breakthrough in computer security research. Moving your login page will either break things, or it'll only work for those bots that are particularly stupid.
Anyone can visit the login page of a site via rewrite rules by going to /login if pretty permalinks are turned on, they can use XMLRPC, and they can visit the admin area at wp-admin and be redirected to the login page. If you move the admin area, aside from breaking things, the user can still visit /admin and be redirected anyway. Moving things sounds like the answer, but it really isn't, it'll just give you a sense of false security, which is far more dangerous.
Comment: As an added layer of security for the paranoid you can password protect `wp-admin/` directory (being sure to exclude the `admin-ajax.php` used by some front-facing plug-ins.). While this won't protect `wp-login.php` (though you could do that too). This adds a layer which is completely independent of WordPress.
Comment: `Use 2 factor authentication` is there native 2FA for wordpress?
Comment: there's an official plugin for it as well as multiple 3rd party solutions, as well as using SSO
Answer: A Google search for the IP showed, this IP is known as a spammer IP. A quick check on MXtoolbox shows, it is blacklisted by blocklist.de, CBL and Spamhouse ZEN. I would suggest to ban the IP.
Some interesting suggestions, how to prevent wp-login.php from a brute force attack can be found on MNX Solutions.

Wordpress login security


Newtonian derivation of perturbation in density

Question: In Barbara Ryden's Introduction to Cosmology, chapter 12.3, she derives an equation describing the evolution of mass perturbations with time, for small perturbations $|\delta|\ll 1$. Before she starts the derivation, a disclaimer is added stating that

By performing Newtonian analysis of this problem, we are implicitly assuming that the radius $R$ is small compared to the Hubble distance and large compared to the Jeans length.

I have added the derivation below, and was wondering where these implicit assumptions are taken into account.
Suppose a universe with pressure-less matter, with mean mass density $\overline{\rho}(t)$. As the universe expands, the density decreases as $\overline{\rho}(t)\propto a^{-3}(t)$, where $a$ is the scale factor of the universe. Consider a spherical region of radius $R$, to which a small amount of matter is added (or removed) so the density within the sphere is now $\rho(t) = \overline{\rho}(t)(1+\delta(t))$, where $|\delta| \ll1$. The total gravitational acceleration at the surface will be
$$
\ddot{R} = -\frac{GM}{R^2} = -\frac{4\pi}{3}G\overline{\rho}R - \frac{4\pi}{3}G\overline{\rho}\delta R
$$
By mass conservation, we know that
$$
\frac{4\pi \overline{\rho}(t)}{3}R^3(t)(1+\delta(t)) \equiv \textrm{const}
$$
From this, we get that
$$R(t)\propto a(t)(1+\delta)^{-\frac{1}{3}}\approx a(t) - \frac{1}{3}\delta a(t)$$
Taking double time derivative, we get
$$
\ddot{R} \approx \ddot{a}(t) - \frac{1}{3}\ddot{\delta}a-\frac{1}{3}\delta\ddot{a} - \frac{2}{3}\dot{\delta}\dot{a}
$$
Dividing by $R$, we get
$$
\frac{\ddot{R}}{R} \approx \frac{\ddot{a}(t) - \frac{1}{3}\ddot{\delta}a-\frac{1}{3}\delta\ddot{a} - \frac{2}{3}\dot{\delta}\dot{a}}{a(1-\frac{1}{3}\delta)} \approx \frac{\ddot{a}}{a}\left(1+\frac{1}{3}\delta\right) - \frac{1}{3}\ddot{\delta}\left(1+\frac{\delta}{3}\right) - \frac{1}{3}\delta\frac{\ddot{a}}{a}\left(1+\frac{1}{3}\delta\right) - \frac{2}{3}\dot{\delta}\dot{a}\frac{1}{a}\left(1+\frac{1}{3}\delta\right)
$$
Taking only linear terms in $\delta$ (we neglect $\delta^2,\ddot{\delta}\delta$ as they are of second order in $\delta$), we get
$$
\frac{\ddot{R}}{R} \approx \frac{\ddot{a}}{a} - \frac{1}{3}\ddot{\delta}-\frac{2}{3}\frac{\dot{a}}{a}\dot{\delta}
$$
Comparing with the gravitation equation, we get that the linear term, in charge of the small perturbation, yields
$$
\ddot{\delta} + 2H\dot\delta = 4\pi G\overline{\rho}\delta
$$
where $H$ is the Hubble parameter.
At which point are the above assumptions are implicitly applied?
Answer: When you write out the gravitational acceleration as
$$
\ddot{R} = -\frac{GM}{R^2},
$$
you are approximating gravitation as Newtonian. Your source is telling you that this approximation implicitly demands that $R$ is much smaller than the Hubble length, and much greater than the Jeans length. I would wager the latter is so that we can treat the matter content as approximately homogeneous, while the former is so that the expansion speed is small.


What are the pros and cons of using SteamCMD over Steam on a server?

Question: I'm looking at running a server on a Windows machine for a game available on Steam. I can either install Steam on the server and use that, or use SteamCMD to run the server instead. Are there any pros/cons between using either?
Comment: This question is better suited at [superuser](http://superuser.com/questions/ask).
Answer: They're essentially the same, but the command line version is that: a more compact command line version that won't require any gui and therefore no window system to run on the server. Since you're running a Windows machine, I wouldn't expect any significant differences, but the command line version should use less ressource in case those are a concern.
Edit: In case you'd like to manage your server through a terminal (like SSH), the command line version would be the one that's easier to use (since it won't require any gui interaction). If you're using some kind of remote desktop connection this doesn't really matter either.
Answer: The biggest difference is that it is easier to update a gameserver using SteamCMD as you can just enter a single command to do it using the +app_update [id] parameter combined with +login. SteamCMD also accepts anonymous login to access certain servers. This gets rid of the need to have your account details on a machine you don't necessarily need to have them on. It also means you can update those servers without logging out of your Steam on your actual computer.


'Helvetica Neue' webfont

Question: I am trying to figure out where do all sites that use the 'Helvetica Neue' font get it from. There are certainly too many sites using it for it not to be free. But frankly, there are only two fontsites which have it in their catalog, and it is for sale (and not as a webfont).
Moreover, can you give some examples of webfonts which are similar to this 'Helvetica Neue' and are (mostly) free?
Thank you!
Comment: does not belong here
Comment: this is not a programming related question. if you look for web fonts, it's better to look on sites like http://webfonts.myfonts.com/search-webfonts
Comment: Examples? It should generally be trivial to figure out from a site's code what web font service it's using.
Comment: For example, Dribbble, Foursquare and many others. You can view the webfont in Firebug.
Answer: Based on the examples you posted in response to my comment above, you're confused.
Dribbble and Foursquare aren't using web font/font-face embedding at all. They're simply specifying Helvetica Neue in their font-family stacks. If a visitor happens to have that font installed on their system, then they'll see it. They quite likely don't, in which case their system will try the next font down, and so on until either something matches or it just ends up using their default for sans-/serif/monospace.
Comment: It's specified because the person who wrote the stylesheet wanted it there. Macs, however, do ship with Helvetica Neue, and since the stack is used in order, they'll get it. Many designers have an irrational hatred of Arial and will do anything they can to avoid its use, where possible. Without asking, it's all speculation. But Dribbble in particular likely has a higher-than-usual Mac user ratio, and so specifiying Helvetica higher in the stack is a fairly safe bet for them.
Comment: I just figured out that the font I was able to view was just plain Arial. It is pretty silly for me not to see this before. Anyway, thanks for your help. Just for my knowledge, why is this font specified in every font stack? Is it so popular? Who has it since it is not free?
Comment: Thank you for your help! Now everything is clear for me.
Answer: This question is similar: https://stackoverflow.com/questions/3335336/font-replacement-services-for-helvetica-neue
I did find a site using Proxima from Typekit for people who didn't have it: http://stevecochrane.com/v3/2007/12/13/helvetica-neue-variants-for-use-on-the-web/
Comment: Thanks! Although I don't quite like how it renders at small sizes...
Answer: If you want a Google web font, the closest match to Helvetica Neue (closer than Arial) is Arimo. For a Helvetica Neue font stack that puts the most Helvetica-like fonts first, includes Arimo, and suppresses the substitution of Arial for Helvetica on Windows systems, see the answer at https://graphicdesign.stackexchange.com/a/9054.
Answer: This site seems to use Helvetica Neue. We got it as part of our logo that was designed (as that uses the font).
I dont like the font in websites. When text is small, especially bold, the 'c' and 'o' is really not clear at all. In fact I stopped visiting Digg as they have this set as their main font and I really couldn't read it.
Comment: OK, so I believe it would be better if I stick to the classic Arial...

'Helvetica Neue' webfont


Sun Moon earth Angle

Question: I want to do a theoretical prediction before trying out an experiment. I just noticed that the arc separating the illuminated side of moon and the shadowed side is an ellipse arc. So Is it possible to write down the angle between Sun and moon (as seen from earth) in terms of the semi major and minor axes of that ellipse.
Answer: Yes.  Assuming that the moon is distant enough to neglect parallax effects, the semi major axis is just the radius of the moon, $r$, and the semi minor axis is  $|r\cos\theta|$ where $\theta$ is the Sun-Moon-Earth angle.
So when the sun is behind the Earth, the angle is 0 and the ellipse is a circle (full moon) so the semiminor axis = $r$.  When the sun is at right angles to the Earth, the ellipse is a line, semiminor axis=0(half-moon) and when the sun is (nearly) behind the moon, the angle is 180, and again the semi-minor axis =$r$.
Comment: Great answer, just one nitpick. @Wanderer is looking for the angle as a function of the axes, so a full answer would be that $\theta(b) = \text{arccos}(b/r)$ where $b$ is the semi-minor axis.
Comment: @zephyr May I know how you got that?
Comment: Zepher just rearranged $b=r\cos(\theta)$ to make theta the subject.

Sun Moon earth Angle


Approach to Load data from Master to Child objects from Legacy database

Question: We have an oracle database with 100,000 records which has a master table called Application and it has a child called Application Individual and each Application individual has one level children like Income, Expense, Assets. So we have a 3 level master detail from Application to Application Individual and Individual  Asset, expense etc. We have atleast 75 objects to be loaded worth 100,000 records. I was thinking of using a tool to load this data like Jitterbit or Talend. What is the best approach to do this data load? In salesforce, we have the same object structure and fields and we have some mapping? What would be the recommended approach to load the data one time?
Thanks
Buyan
Comment: Talend is an excellent tool.For 1 level relationship i have used this and mapping is too simple .Haven't tried using for n level relationship .If its just 1,00,000 in total even jitter bit is good option.First all the master record can be loaded and child records can be loaded next using external id to establish relationship.
Answer: First, make sure you have an external ID field on each object that can be a parent to another object. This field will be used to contain the Oracle ID of each record. Then I would load data from the top levels down. First, start with Application. When you upload Application Individual, use the Upsert call to insert the data and then use the external ID fields as the foreign key. Jitterbit can support mapping to external Ids for the parent records.
Comment: Thanks Daniel and Mohit for your reply. Have you guys used Jitterbit to do this in your organization and is there any limitation i should be aware of on this tool?
Comment: I've used the full version of Jitterbit for this. The benefit there is that you can chain operations so if you needed to sync data multiplpe times, you could have On Succcess actions to call the next set of data. I believe the free version of Jitterbit should have no problem syncing the data one table at a time, you just couldn't set it up to automatically do all of them.
Comment: This was going to be my answer as well. External Id's are critical for this type of data migration


Raspbian/OctoPi File Recover

Question: I dropped my Pi on the SD Card slot. It broke and now I want to recover my files off of my SD Card, but I only see a boot partition with no relevant files inside. I was using OctoPi (3D Printing Server software running on Raspbian), and I want my Gcode files. How can I recover the files?
Comment: Your very First then you need to do is image your sd card. Once you do that do not tamper with the sd card, work solely with the image file you generate.  use ddrescue: sudo ddrescue /dev/sdCard recovery.iso
then run testdisk against the ISO file. (or whatever data recovery software you choose. This is standard data recovery proceedure.  Do not write anything else the to sd card.
Answer: The files would be in an ext4 partition. There are third party solutions which can read these on Windows or OS X.
They can be read on any Linux system, including a live CD.
Comment: Do you know which directory the files will be kept in? If not, what is the general directory for user's files? For example, in Windows C:\Users\{USER}.
Comment: @pisquaredtau what OS are you doing data recovery on? Windows cannot by default recognize linux partitions, and even the software to enable windows-linux partition reading, is frequently buggy.
Answer: I'd probably just pick up another Pi, honestly. Assuming your SD card is intact, that will be the easiest/simplest way to get back up and running again.

Raspbian/OctoPi File Recover


How to add Lat/Lon (decimal degree) values in Attribute table field in ArcGIS?

Question: I have a point shapefile (WGS 1984, GCS) with some random data points. I want to add the latitude and longitude in attribute field.
Answer: @Maria there's a few methods for doing this and remeber that as you say the data is already in a Geographic Coordinate System (WGS 1984, GCS) called WGS84.
Use a tool which is called the "Add XY Coordinates" tool you can find this in the Data Management toolbox. The tool adds two fields called "Point X" and "Point Y" and populates them with the coordinate values (bear in mind the values will be in latitude and longitude as this is a GCS).

Or use the Calculate Geometry tool. This is a more manual process of

Add a new fields to the attribute table, one for Latitude and one for Longitude.
Right click the field header select Calculate Geometry and pick either the Data Frame CRS or Data CRS to append the coorindates.

Use the Add Geometry Attributes tool which allows you to append several attributs based on spatial and geometric characteristics.

Adds new attribute fields to the input features representing the
  spatial or geometric characteristics and location of each feature,
  such as length or area and x-, y-, z-, and m-coordinates.
Comment: omg I've been what you might call an ArcGIS power user for years and I always did the "Calculate Geometry" thing. I had no idea this tool existed. Thanks!
Comment: @Wes you should also check out the Add Geometry Attributes tool above the Add XY Coordinates :-) http://pro.arcgis.com/en/pro-app/tool-reference/data-management/add-geometry-attributes.htm
Answer: Thanks for posts on how to get long lat values.  I had a variation of this problem and discovered a few interesting things in ARCMAP 10.1.  I have point data that is in utm zone 10 NAD83 and I just wanted to dump the points out in Lat Long in degrees minutes and decimal seconds.  I tried the first suggestion to use the add x y coordinates after converting my coordinate system to WGS 1984 and transforming it but still got UTM coordinates in my newly added x and y coordinate fields.  Tried a few different WGS re-projections and the best I got was a x y coordinates system that appeared to be offsets from the prime meridian and the equator in meters...?  In the end I gave up on that approach and tried the recalculate geometry suggestion which worked fine for producing decimal degrees and I didn't have to change my base coordinate system from UTM zone 10...I'm figuring it just did the re projection on the fly.  The only problem I had left is that I wanted my coordinates in degrees minutes and decimal seconds and there is no option for that in Recalculate Geometry UNLESS the new lONG AND LAT fields you add are text field types not numeric like float or double, then Recalculate Geometry gives you a bunch new format options for displaying Degrees minutes and seconds.  It makes sense when you think about it,  as the full geographic notation is not a true numeric value (but decimal degrees is).  Anyway I got my desired output and checked the values by entering them as placemarks in Google earth by lat long and my locations seem identical to those in my arcmap data sets.
Another tip if you are working on a locked down esri enterprise geodatabase and cannot freely add and define new attributes,  is to just to export the layer out to a shape file and then you can easily add your new fields as necessary and then recalculate your lat long values.  In my case I needed to dump them out to a spreadsheet so I exported them from my attribute table in the shape file out to a csv...
Comment: Please, post this as a question and give more details, such values of your coordinates. Community will help you.


Manifolds such that every homeomorphism of a submanifold to itself extends to the full manifold

Question: Let manifold $S$ (connected, without boundary) have next property: for every submanifold $D \subset S$ (connected, compact, without boundary), every homeomorphism $f:D \to D$  extends to a homeomorphism $g: S \to S$.
What do we know about these manifolds? Can they have dimension 3, for example? For instance, we can assume $S = \mathbb{R}, \mathbb{R}^2, S,S^2$ (line, plane, circle, 2-sphere) and we cannot assume $S = \mathbb{R}^3$.
Answer: I seem to have misunderstood the question.  I left my original answer (which answers a different question) below, and added an answer to the actual question at the top.
Answer to the actual question: In dimensions 3 and higher, the answer is no for topological embeddings (as asked in the question).  Consider the Alexander horned sphere (see Rolfsen's book for a nice exposition) which for $n\geq 3$ is an embedding of $S^{n-1}$ in $S^n$ that is not locally flat at some points, and locally flat at others. A locally flat submanifold $X^k$ of $Y^n$ is one such that for every point $p\in X$ there is a neighborhood $U \subset Y$ with $(U, U \cap X) \approx (R^n,R^k)$. Let us call such a neighborhood a local product neighborhood. Alexander's original construction was in $S^3$ but the same idea works in any dimension.
Since every $n$-manifold $M$ contains a copy of $R^n$, you can find an Alexander horned sphere in every $M$. For any two points $p,q$ on the sphere $S^{n-1}$, there is a homeomorphism $f:S^{n-1} \to S^{n-1}$ taking p to q. Embed $S^{n-1}$ in $M$ as a horned sphere, and choose $p$ to be a point where the embedding is locally flat and $q$ to be a point where the embedding is not locally flat.  Then there is no homeomorphism of $M$ to itself extending $f$, because such an extension would take a product neighborhood of $p$ to a (non-existent) product neighborhood of $q$.
If you want your ambient manifold and submanifold to be smooth, then this argument doesn't work, as smooth submanifolds are automatically locally flat. In that case, you could use a non-reversible, non-amphicheiral knotted sphere of codimension $2$ as in the argument I suggested below.  In that case the homeomorphism of the submanifold would be a reflection.
Original answer: I'm going to rename your manifold $S$ to $M$ to distinguish it from a sphere. Let's assume that your manifold $M$ has finitely generated fundamental group and dimension $n \geq 3$.  This will hold if, for instance, $M$ is closed. By the Grushko Decomposition Theorem, $\pi_1(M)$ decomposes as a free product of groups $A_1*A_2* \cdots A_r*F_s$ where $F$ is free, and none of the $A_i$ is cyclic or decomposes as a free product. This decomposition is unique up to permuting the factors.
Choose two knots $K$ and $K'$ in the 3-sphere such that the fundamental groups of their complements are different, and neither is isomorphic to any of the factors in the above decomposition of $\pi_1(M)$.  Then there are knots $J, J'$ in $S^n$ with such that $\pi_1(S^n-J) = \pi_1(S^3-K)$ and likewise for $J', K'$. Now insert these knots $J, J'$ into a ball in your manifold $M$.  Then no homeomorphism $J \to J'$ will extend to a self-homeomorphism of $M$, because the fundamental groups of the two complements are different using the argument in the next paragraph.
The fundamental group argument: $\pi_1(M -J) = \pi_1(M) * \pi_1(S^n-J)$, and likewise for $J'$. By the asphericity of knot complements in the 3-sphere, the knot groups are indecomposable with respect to free product. By the hypotheses and Grushko's theorem, any isomorphism $\pi_1(M -J) \to \pi_1(M -J')$ would induce an isomorphism $\pi_1(S^n -J) \to \pi_1(S^n -J')$, which we assume can't exist.
Comment: Thanks for your answer! I'm a first-year student, thats why I dont understand more of your arguments. But as I understand, you build homeomorphism between different knots $J$ and $J'$ which are not equals and homeomorphism between $J$ and $J'$ does not extends to homeomorphism $M \to M$. But in start post I require, that every homeomorphism $D \to D$ be could extends (i.e., in your designations, I want that $D=J=J'$). Or I misunderstood you?
Comment: Oh, I think I misunderstood your question.  I will amend my answer; I'm not sure I've followed the right protocol here.