How do you get XML data from other websites who do not provide their API publicly to use in your own ios applications?

Question: How do you get XML data from other websites to use in your own ios applications? The website who do not have any public API available for use.
I am new to xcode and objective c please explain in little detail.
Answer: You would have to write your own service that scrapes the site for information, converts it to XML, and then provides your API.  This may be against the site's terms and conditions; you would have to confirm with the content owners.
This is not ideal because you would have to constantly update your scraper if the site changed their layout; or the site could simply block your scraper from their servers.
The best solution is to talk to the content owners and work out a way to license their data. They may have an API that is not public.


How do you know if a operator commutes with the hamiltonian?

Question: In the question there is a central potential within a Hamiltonian, and I have to find the appropriate quantum numbers. They say that $j, m, s$, $\ell$ are the appropriate quantum numbers to describe this situation. Why are $m_\ell$ and $m_s$ not included here? And do $J^2$, $m_j$, $S^2$ and $L^2$ always commute with the Hamiltonian or just in this case because of the central potential?
Answer: A good guess to start would be to identify classical quantities that are conserved. This is because, for most cases,
\begin{align}
[\hat H,\hat {\cal O}]=i\hbar\{H,{\cal O}\}_{PB}
\end{align}
where the operation on the right hand side is the classical Poisson bracket.
The Poisson bracket is $0$ when the quantity is conserved, so
in a central field, (in addition to energy) the total angular momentum and the components will be conserved separately.  Here the total angular momentum is $\vec J$ rather than $\vec L$ or $\vec S$.  You're also allowed to pick one component of $\vec J$ to make a complete set of commuting observables and use their eigenvalues as quantum numbers, since the components do not Poisson-commute one with the other.
In practice, this often works better backwards: if a quantity is NOT conserved classically, it's unlikely to be conserved quantum mechanically and lead to as useful quantum number.
In the specific case for instance of a 3d harmonic oscillator with axially-symmetric potential
\begin{align}
V(x,y,z)= \frac{1}{2}k_\perp (x^2+y^2) +\frac{1}{2}k_zz^2 \,\qquad k_\perp\ne k_z
\end{align}
then the total angular momentum is not conserved but the $L_z$ projection is, so $m$ as an eigenvalue of $L_z$ would be a good quantum number but not $L$, the magnitude of $\vec L$.
Answer: Let me answer the first question which is presently the title, and maybe experienced users will direct you to existing resources on Stackexchange to help you sharpen the other questions.
In general, the brute force way to know if two operators commute is to identify a suitable basis for the Hilbert space: a set of states that satisfy completeness. Then write down an arbitrary state $|\psi\rangle$ in the Hilbert space as a superposition of these basis states with arbitrary complex amplitudes. If you know the eigenstates of the Hamiltonian, that is usually the best basis. Then find the action of H on the arbitrary state $|\psi\rangle$, call the result $H|\psi\rangle$. Find the action of your operator O on the state $H|\psi\rangle$, call the result $OH|\psi\rangle$. If this is the same as what you get when you calculate $HO|\psi\rangle$ then the operator O commutes with the Hamiltonian.
Comment: It's usually done the other way around, i.e. you identify a set of commuting hermitian operators and are then *guaranteed* a complete basis as common eigenstates of those.  Doing this "by brute force" does work in principle but in practice may require *quite a bit* of force.
Comment: I agree. But, the OP is essentially asking *how* you would identify a set of commuting hermitian operators (one of which is the Hamiltonian)
Comment: Yes I was just pointing out that your approach, while valid in theory, may not be terribly practical.  By Schur's lemma, you would find not $J^2$ but the multiples of the identify in each subspace without any ways of identifying the physical contents of the operator.   You really need a lot of insight to proceed as your suggest.


Are there planetary systems where the planes of orbits vary greatly?

Question: Inspired by this question, are there any known planetary systems with largely varying planes of orbit? For example a system where two planets have perpendicular planes?
Comment: I'm not exactly qualified to judge answers, so I'll eventually just pick whichever has the most votes?
Answer: Many planets have been found where their orbital axes do not align with the rotation axis of their star. This is achieved using measurements of the Rossiter-McLaughlin effect in transiting systems or by observing planets transit over spotted features on a star's surface.
As the stellar rotation axis is highly likely to coincide with its protoplanetary disk axis, the planets must (now) be orbiting out of this plane and some are retrograde. About 1/3 of hot Jupiter's are misaligned in this fashion.
It seems likely that many of the misaligned hot Jupiters could have planetary siblings orbiting further out that are more nearly in the rotation plane of the star. On the other hand, whatever event caused the misalignment could have wrecked the planetary system.
There is at present I think only one solid example where the measurements suggest non-coplanarity and that is in the planetary system surrounding Upsilon And A.
Using radial velocities and astrometry from the fine guidance sensors on HST,
MacArthur et al. (2010) were able to establish that the c and d planets (i.e. the 2nd and 3rd planets in the system) were inclined at angles of $30\pm1$ degrees with respect to each other. This is much larger than the differences seen in our solar system (maybe 7 degrees).
Answer: I'm not sure we know. I think that the methods used to detect planets orbiting other stars don't allow a determination of the plane of the orbit. One method involves noticing eclipses of the star by the planet, but planets orbiting in different planes, which both eclipse the star, would look the same as planets orbiting in the same plane. The other main method is looking at the Doppler shift of the star as it "wobbles" in response to the planet's gravity. Since that only allows a determination of one component of the velocity, I think it also doesn't allow a determination of the plane.
One way to tell would be to watch a system over time and measure perturbations of one planet's orbit due to another planet. Those perturbations would be different depending on whether the planets were in the same plane. But I think it'd be easier to get a "null" result (the planes are close to the same) than a positive result from this method: if they're in different planes, I think the perturbations would be too weak to observe, and it'd be hard to draw a firm conclusion from your failure to see them.
Comment: ""One method involves noticing eclipses of the star by the planet, but planets orbiting in different planes, which both eclipse the star, would look the same as planets orbiting in the same plane."" The  probability that an orbits geometry is such that is visible from earth is rather low, but there are so many stars, some fit. But now, when a second , say perpendicular orbit has to be visible by eclipse at the same star, probability goes to zero. The simple fact, that multiple exoplanets are  seen quite often, underlines the theory that planets are formed from a common disk
Comment: That's a good point. Systems with multiple eclipsing planets are far more likely if orbits are roughly planar than if they're not. So the multiple-planet systems that have been found by this method are quite likely to be planar. I think it's still correct to say that, given the methods we use to detect planets, the answer to the original question (are there non-planar planetary systems?) is that we have no way of knowing.
Comment: Right, no real knowing, but "educated guesses" :=)
Comment: Yes, we can tell when planets have strangely aligned orbits - the Rossiter McLaughlin effect.
Answer: If the planets are all formed from a simple accretion disk, they should end up very close to the plane of the accretion disk. A planet with a different orientation must have had a different formation history, or to have suffered a severe deflection of its motion. IIRC one observed disk around a yound star was thought to be orbitting in opposite directions, i.e. the close in part going one direction, and an outer disk going in the opposite direction. But if you read Ted's answer about detection, the chances are very high that we would only see the planets from a single plane, and be unaware of any out of plane objects. The chances are that to get two accretion disks with different orientations (possibly at different times), you would have to incorportate different gas clouds with different relative velocities during planetary formation.


Linear transformations map lines to lines

Question: I need help with this question:
Let $T$ be a linear map from $\mathbb{R}^n \to \mathbb{R}^m$, and let $L$ be a line in $\mathbb{R}^n$. Show that $T(L)$ is also a line (is it not enough to just consider lines in the plane).
Answer: A line is a subset of the form $L=\{av+w:a\in \mathbb R\}$ for two fixed vectors $v$ and $w$. By linearity, $T(L)=\{aT(v)+T(w):a\in \mathbb R\}$ is again a space of the same form. Of course it can coincide with just the point $T(w)$ if $T(v)=0$.
Answer: The assertion is false. If $T$ is the map defined by $T(v)=0$, then the image of every line is a point.
A line is the set of points of the form $x+\alpha v$, for two (fixed) vectors $x,v\in\mathbb{R}$ and $\alpha$ taking all values in $\mathbb{R}$. So the image of $L$ is the set
$$
\{T(x)+\alpha T(v):\alpha\in\mathbb{R}\}
$$
which is a line if and only if $T(v)\ne0$.
Answer: A line is of the form $f(t) = \vec{x}_0 + t \vec{d}$ for $t \in \mathbb{R}$.
Thus, $T(f(t)) = T(\vec{x}_0 + t \vec{d}) = T(\vec{x}_0) + t T(\vec{d})$ by linearity, which also has the form of a line.


install minimal desktop on CentOS 6.3

Question: I just want to install a minimal GNOME desktop without all the Thunderbird/Firefox and any other packages that may come with full CentOS Live Cd. Is there something like yum groupinstall base-desktop? Ideally, I just want Xorg/GNOME and then add any other packages manually. No gdm also, I just want to run startx.
Answer: There's the basic-desktop group which is described as

A minimal desktop that can also be used as a thin client.

It includes the following packages:

at-spi
control-center
control-center-extra
dbus
eog
gdm
gdm-plugin-fingerprint
gdm-user-switch-applet
gnome-applets
gnome-media
gnome-packagekit
gnome-panel
gnome-power-manager
gnome-screensaver
gnome-session
gnome-terminal
gnome-vfs2-smb
gok
gvfs-archive
gvfs-fuse
gvfs-smb
metacity
nautilus
NetworkManager
NetworkManager-gnome
notification-daemon
openssh-askpass
orca
polkit-gnome
pulseaudio-module-gconf
pulseaudio-module-x11
rhn-setup-gnome
vino
xdg-user-dirs-gtk
yelp

It includes gdm which is arguably part of a basic desktop but does not include Firefox, Thunderbird, etc. If you still want less, you'll want to pick the packages out of the above list you want and do a yum install on the specific ones you for your desired desktop.
Answer: Centos will install Gnome as default Gui.
# yum groupinstall basic-desktop desktop-platform x11 fonts

or
# yum groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"

To install KDE
# yum groupinstall "KDE desktop"

from http://namhuy.net/475/how-to-install-gui-to-centos-minimal.html
Answer: The stuff you are talking about won't amount to much on disk, maybe 1/2 GB or so at most.  If your space is so that tight this is a concern, then you will need to find a minimal install sans X and build up from there.  If you want to end up with anything involving GNOME at all though, this probably won't make much difference, and it is a hassle.
That said, I notice this remark here under "CentOS 6 Releases":

There is also a minimal install CD that will get you a very small base
  install that you can add to.

With regard to booting to console and using startx, this is just a matter of setting the default runlevel.  CentOS still uses a SysV style init system.  Look in /etc/inittab for this line:
 id:5:initdefault:

There are probably some comments that go with it.  Change the 5 to a 3 and you will no longer boot straight into X.
Installing gnome without gdm will be impossible, but that does not mean you have to use it.  startx will obey the directives in ~/.Xclients if it exists (it does not by default).  Try creating this file and saving it in your $HOME as .Xclients:
#!/bin/sh
gnome-session

Comment: Yes, CentOS still uses sysvinit-style setup. As things look right now, RHEL 7 will use systemd, but that is just a guess on my side.
Comment: @vonbrand : cheers, I edited the "maybe" parts out ;)

install minimal desktop on CentOS 6.3


SoftAP on Windows IoT won't work

Question: I have Raspberry Pi 3 with Windows IoT installed. It's connected to wired network. I want to use its SoftAP functionality as described here: https://docs.microsoft.com/en-us/windows/iot-core/manage-your-device/DevicePortal#iot-onboarding to use it as Wi-Fi access point for my phone. I am not connected to any Wi-Fi network on the Pi and there are no profiles created. I get the "Internet Connection Sharing started" message on Windows Device Portal and I can see configuration change on connected display. Still, I can see no new Wi-Fi network on my phone and my Pi can still see other Wi-Fi networks (I don't know if it should or not).
Answer: The WiFi works after I use IoT Dashboard and select "Open network share" option from right-click menu. Its SSID is different from the SSID I've chosen in Device Portal ("AJ_[original SSID]_[some random string of numbers]") but it works otherwise.
Comment: Thanks for posting the answer after you found it!  I know it's easy to find the answer and move on, but you've made it possible for someone with a similar question to find your answer.
Comment: @ChristopherHostage - I thought so as I didn't find my answer in Google, it was just clicking blindly with no hope...

SoftAP on Windows IoT won't work


kernel_task filling up disk

Question: Something weird just happened.
I got a warning that my disk was running out of space. I knew that it had like 15GB free before and wondered where all the free space went.
I checked Activity Monitor which showed me that kernel_task wrote around 16GB of memory to disk. I kept observing and noticed that it went up at a rate of around 1GB per minute.
This went on until there were 0 Bytes left on my disk. This made my macbook basically unusable. I couldn't even open Web pages and when i tried to shut it down, it froze.
I did a forced reboot and the lost memory is back now. kernel_task is not writing to disk like crazy as before either. Anyway, I'd like to know what happened there. Any clues about what could've caused this?
Comment: It might have actually been some other application that was using up a ton of RAM, causing kernel_task to expand the page file and fill up your disk. I've seen that happen in the past.
Answer: This happened to me once. I used Daisy Disk to figure out where the disk usage was coming from.
In my case, there was a problem with the coresymbolicationd cache, which was growing indefinitely, and continuing through reboots and reinstalls of the latest Combo Update.
After deleting /System/Library/Caches/com.apple.coresymbolicationd, everything returned to normal.
Next time this happens, I recommend taking a look with that utility.
Answer: Restart the computer.
Hold Command+Option+P+R on startup and verify Macintosh HD
Do a PRAM reset,

To reset your NVRAM, you use exactly the same procedure you once used to reset PRAM: Shut down your Mac, press the power button, and as soon as you hear the startup chime, hold down Command-Option-P-R. Keep holding down those keys until you hear a second startup chime. Then let go and allow your Mac to continue starting normally. Then check the Startup Disk, Display, and Date & Time panes of System Preferences to make sure they're set the way you want them.
If you hold down Command-Option-P-R at startup and you see nothing but a gray screen that doesn't change for several minutes—no Apple logo, no progress bar, no second startup chime—don't panic. (This happened to me just last week.) The most likely cause is that your Mac isn't registering the key presses due to wonkiness with a USB device. Disconnect all USB devices (except your keyboard, if it's a wired keyboard), hold the power button down until the Mac shuts off completely, and then press it again and immediately hold down Command-Option-P-R. If that doesn't work and you're using an external Bluetooth keyboard, try plugging in a USB keyboard instead. If you're able to reset the NVRAM successfully with the wired keyboard, you can disconnect it and go back to your normal Bluetooth keyboard.

Reset the SMC, if all else fails

Before you can reset your SMC, you must shut down your Mac. After that, the procedure varies depending on the type of Mac you have.
Desktop Macs: Disconnect the power cord (either from the Mac or from the AC outlet). Wait 15 seconds and plug it back in. Then wait another 5 seconds and turn the Mac back on.
Portable Macs with non-removable batteries: Make sure the Mac is plugged in to AC power. On the built-in keyboard, press and hold the Shift, Option, and Control keys on the left side and press the power button. Release all the keys at once, and then turn the Mac on normally.
Portable Macs with removable batteries: Disconnect the AC power cord and remove the battery. Press the power button, hold it for 5 seconds, and then let go. Put the battery back in, reconnect the power cord, and turn the Mac on normally.

This could be caused by a number of things, but usually it's just a glitch in macOS.

kernel_task filling up disk


Need the calendar web part to display recurring items as individual items

Question: I have a calendar OOTB webpart in use, and for the most part it works fine, but in the All items view, it would be helpful to see recurring items that occur every week to show up like the one of kind events.  Right now, they just appear one time in the list as in the image attached.
Answer: Can you use the 'Current Events' view instead? that splits recurring events into individual items.
Answer: As @Robin said you can use 'Current Events' view to get recurrence events splitted  but you will not find Start Time and End Time columns there to set the filter conditions for the Current Events View.
If you are looking for web parts where you can set upcoming events and all and you wanted to display filtered event instances from the recurrence event then you have to create visual web part and using dll from the following code you can expand recurrence events.
https://github.com/ronnieholm/SPCalendarRecurrenceExpander


Square Crayon Sticks

Question:
Ten sets of crayons forming  all the digits from 0 to 9 can be moved, flipped, rotate and intersect without changing their digital forms. What is the maximum number of 1x1 stick squares that can be formed by combining all the crayon digits?
Comment: can we move the individual crayons, or do we have to preserve the digit shapes?
Comment: Their digital forms must be preserved . can move individually to reposition but all digits 0-9 shall be visible according to colors
Answer: Here is one way of making the rectangular grid arrangement that Bass suggested:

Only the digit 2 in the middle is flipped over.
By the way, this kind of packing puzzle shape is called a Polystick.
Comment: The other way making non-mirrored and non-rotated solution of the above is the one with diagonal symmetry of 7,0,2,9 only.
Answer: If we can rearrange all the 49 crayons independently, then we can make this shape:

Since we know that any square shaped bunch of unit squares is automatically the optimal way to maximally overlap the unit square sides, and continuing from a square to a rectangle by adding a single row also gives maximal crayon overlap, we know that this pattern is an optimal solution, and the maximum number of unit squares it's possible to make by rearranging individual crayons is

 twenty.

If we have to preserve the digit shapes, the answer will be something a bit different, and I'll have to get back to you later :-)
(EDIT: I'm afraid that this is probably the case, since everything seems to make a bit more sense if the "their" in "without changing their forms" refers to the sets instead of the crayons. Oh well.)

Square Crayon Sticks


Can we meaningfully compare the poverty levels in the USSR to those in the USA at the same time and to those in the USA today?

Question: I was told (by people who had lived there) that the USSR had homeless people but I would guess that the levels of homelessness were much lower and in general there were far fewer desperate people due to free health care and perhaps free food and shelter for those who needed it. Is that correct?
Comment: Interesting question. As it stands, "Can we meaningfully compare..." is not something that can be answered authoritatively. A question more suitable here would perhaps be "What was the real homeless rate in the USSR?" but that's not your subject of interest. I'm not sure how to re-word this in your comparative context. However, in reply to the actual question, as housing was state-provided in the USSR, homelessness would have been out of choice and not necessity—at least this is how I've understood the Soviet housing policy. I'm not sure "people who had lived there" reasoned their arguments?
Comment: Probably not. I understand the US didn't have a big homeless problem before the 1980's, when there were big cuts in social services, a lot of "asylums" were shut down due to changes in the perception of proper psychiatric and disability care, and zoning started to be used to prevent construction of affordable housing. Except of course before in times of recession/depression it *did* have a big problem (eg: the 1930s). The issues in the USSR I understand mostly had to do with bureaucracy. So the problem is mostly a function of what's currently going on in society, not anything permanent.
Comment: Your first problem is in defining exactly what you mean by poverty.  From some points of view, everyone in the USSR (other than upper-level bureaucrats) could be considered poor.  Likewise, a large share of people living under the US poverty level might be considered well off by 3rd and 4th world standards.
Comment: Welcome to History:Stack Exchange. Thank you for your question; please consider revising it to be more in line with our community expectations. Like many other stacks, we expect questions to [provide evidence of prior research](https://interpersonal.meta.stackexchange.com/a/3227/1599). That helps us to understand the question, and avoids our repeating work you've already done.  Our [help], and [other stacks](https://interpersonal.meta.stackexchange.com/questions/3224/how-do-i-write-a-good-question) provide additional resources to assist with revisions.
Comment: There's a lot of relevant info online that might help you refine this question. A few leads to start: [1](https://www.reddit.com/r/AskHistorians/comments/4ljfhy/were_there_homeless_people_in_the_ussr/), [2](https://www.csmonitor.com/1988/0519/ehome.html) and [3](https://nintil.com/the-soviet-union-food/)
Comment: Having seen the two replies here, I think people are comparing apples to pears. The better comparison would be looking at the change in these numbers within these societies, say from 1900 to 1925 to 1960 to 1985, to see how these issues developed. After all, in general we value progress over time from a previous state.
Comment: @T.E.D.: In 1987 or 88 I saw Grand Central for the first time as an adult and there were many homeless which someone there said was due to changing the definition of mentally handicapped from an IQ of 70 to one of 60. What an eye-opener: imagine looking for work with an IQ of 65; horrifying to think that these people were there not because of any path they had chosen but just the unfortunate circumstances of their birth.
Answer: It is very difficult or impossible to compare. By some standards almost all
Soviet citizens were poor. By other standards they were OK.
There is no adequate conversion rate of the Soviet rouble. Prices in roubles were not true market prices: most of them were arbitrarily established by the state. Many things were cheap but not easily available. Let me compare the things which make major expenses in the US:

Housing. There was very cheap housing available from the state for rent. The problem was that it was not really available to all: there was a shortage. One had to enroll to a waiting list, and stay in this list for years. How many years, depended on the city, your place of work etc. Many people lived for decades in dormitories or with their parents.

University education was free (I mean no tuition, but you had to pay for your living, books etc.) Enrollment was (theoretically) merit based. Those who had good grades obtained a stipend, and free or extremely cheap dormitory accommodation. So if you are a A-B student, you get a stipend and a dormitory, and in principle you can survive without spending any extra money, on a minimum survival level. Elementary education was free and mandatory.

Medicine. Medicine was free. (One can discuss its quality, availability, etc. but it was free). However, as it happens with most things which are free but in shortage, you may have to pay (illegal) bribes to obtain the service.

Employment. Officially, there was no unemployment. University graduates
were assigned jobs. One had to work 3 years on the assigned job, and then you could change it if you wish. Finding a job as a laborer was never a problem. Moreover, if you live in a city and have no job, you could be deported by a court decision as a "parasite". An occupation as housewife was legitimate but rare: usually one salary was not enough to support a family.

Retirement. If you worked certain number of years, you automatically qualified for state retirement. Also in the case of disability. This can be compared to Social security in the US. If you rent an apartment from the state, you could survive on your retirement money, which would be spent only on food.

Vacation. Some payed vacation (from 2 weeks to 2 months per year, depending on your job) was guaranteed
Cheap or free vacation packages were distributed by employers, as a "reward for good work". You could also travel on your own.

So a very large portion of expenses of a typical family was food and clothes.
Cars were considered a luxury, they were expensive AND they were in shortage.
(One also had to be on a waiting list, as for an apartment, for many years).
But, on the other hand, it was relatively comfortable to live without a car:
public transportation was well developed and very cheap.
So how can one compare?
I can give some numbers from my own experience (early 1970s). Working as a laborer (with no qualification) I could make 100-120r per month.
A laborer of high skill could make 200 and more. Apartment rented from the state was 10-20r, but a private apartment rental 100-200. As a student, I obtained 35-45r as a stipend, this was barely enough for good food, but my fellow students saved on food. I did not qualify (and did not want to) live in a
dormitory because my parents were considered "highly paid", and this was considered in dormitory distribution (as I said EVERYTHING was in shortage). "Highly paid" meant at that time 400-500 roubles/month.
My parents rented an apartment from the state, the rent was 10-15 roubles, perhaps 30 with utilities. They had no car, and no real need in it.
A ride in a bus/trolley/tram/subway was 3-5 kopeks (1 k=1/100 of a rouble).
Bread was 20 kopeks/kilogram.
Most people in the cities rented apartments but one could also buy a house, for a price like 10,000-20,000 or more (about 100 monthly salaries of a worker).
A soft cover book was less than 1 rouble, hard cover 1-2 roubles.
Relatively cheap poor quality cloth was available, but genuine US made jeans could be 100-200 roubles (sold illegally) and some of my fellow students starved to save for this luxury item:-)
When I came to the US in the late 80s my "rule of thumb" conversion rate
for daily necessities was 1 rouble = $10.
There was such thing as the "minimal wage" which slowly increased from about 30 roubles/month in 1960 to about 100 r in the 1980s.
Officially, there was no inflation: the price of bread did not change at all in the period 1960-1980. And I remember only one year when bread was in some shortage (in the middle 60s). As I said, the prices were established by the state, and changes were posted in newspapers and broadcast on the radio. They maintained that price increases were only for "luxury items".
Comment: Nice answer! I think the prices of books might have been lower (or the ones I've seen are from later), as it's generally been around 0.80r per one. Amazing what high printing volumes can do, no?.. Specifically mentioning the 'luxury goods' part is also very useful!
Comment: @Mark Johnson: thanks for corrections.
Comment: One thing you may want to add is a flat 13% income tax.
Comment: @user58697: thanks. I wanted to mention this, and I did remember that the tax was small and flat, but did not remember the number. Besides, this only applies to the people employed by the state (majority) not to he small number of self-employed people.
Answer: Question:
Can we compare meaningfully the poverty levels in the former USSR to those in the USA at the same time and to those in the USA today?

Short Answer:

The Soviet Union did not permit outside or objective reporting of embarrassing facts throughout its history.  It mostly denied the existence of poverty in their system entirely, claiming poverty was a Western evil of capitalism.   Towards the end of the Soviet Union days it pursued a policy of openness and reform;  this resulted in the first glimpses of the Soviet's internal numbers of systemic poverty.   They showed in 1989 the Soviet Union had systemic 20% of it's population below the poverty line.  The article quotes Leonid E. Kunelsky, chief of the economics department at the State Committee on Labor and Social Issues, who's Soviet Poverty numbers double that of the official estimate.  The poverty level in the United States at the same time was 14%.

Detailed Answer:

During Michael Gorbachev's glasnost(openness) and perestroika (reform) campaigns the west got it's first hard numbers on poverty levels in the soviet union.   Up to that point the Soviets always represented poverty as a western capitalistic problem and denied it's existence within their borders.
In 1989 the communist newspaper Pravda published an article on internal Soviet numbers picked up by the New York Times.

New York Times Jan. 29, 1989
Soviet Openness Brings Poverty Out of the Shadows
But the Soviet authorities, who once denied that poverty existed in their country and pronounced it an evil of capitalism, now say that tens of millions of Soviet citizens - at least 20 percent of the population - live in poverty, compared with about 14 percent in the United States. 'Our National Tragedy'
.

Their condition has drawn a remarkable amount of attention in the Soviet press in the last year, with frequent letters from poor people bemoaning their misfortune and articles by economists and sociologists blaming the Government for neglecting the problem.
.

''Poverty is a reality, our national tragedy,'' the newspaper Komsomolskaya Pravda recently wrote.
.

Officially, the poverty level in the Soviet Union for an urban family of four is 205.6 rubles a month ($339.24 at the officially established exchange rate of $1.65 to the ruble). This is about 51 rubles or $85 a person(/month).
.

But the Soviet authorities and academics readily admit that the figure, calculated in the 1960's, is outdated. Most agree that around 75 rubles, or $124, a month a person are necessary for what the Government calls ''minimum material security.'' No Plan for Poverty
.
Between four and five million Soviet families fall below the formal poverty level, according to Soviet officials, and a full 20 percent of the population lives on less than 75 rubles a month.
.
''More than 43 million people are living in families with incomes of less than 75 rubles a month per person,'' Leonid E. Kunelsky, chief of the economics department at the State Committee on Labor and Social Issues, said. ''We have to do something to help these people.''
.
There is no state plan, however, for dealing with poverty, according to interviews with several Soviet officials.
Comment: I don't think it's meaningful at all, for two main reasons. First, there was no market per se in the USSR, hence the prices did not reflect the utility or demand of the product. As a consequence, _any_ monetary comparisons are meaningless. An income of (say) 200 roubles doesn't mean much if you can't use it to buy what you want, despite low prices. On the other hand, it _was_ possible to live almost without income yet without starving. Second, ~1989 was a particularly dire time: people were lining up for hours just to buy milk. Whatever measure we use, these times are not very representative.
Comment: @Zeus the Soviet Union did have currency and did have stores in which to buy products. That was the primary way soviets recieved goods and services through purchases just like the west.  It's just that those markets were not free in the Soviet Union they were centrally controlled.   Also the poverty line in tho Soviet Union , was from the 1960s and was set by the Soviets themselves. The comparison is thus one of poverty not simple income or straight up needs .
Answer: I will argue that 'poverty' in modern societies is more of a social construct rather than an objective reality. Roughly speaking, people at the 'bottom' of society will feel poor, even if they have more disposable income than an average person in another country.
There is an objective 'extreme poverty' end of it, on the level of 'who of my children will eat today', but this practically didn't exist in the USSR since at least late 50s. (I'll be talking about these times, 1960s+).
In this social sense we probably can make some comparison, but it will necessarily lack the air of 'objectivity' that comparing 'dollars' (or burgers) may give. In addition, the essential absence of social sciences in the USSR (and hence the lack of fair opinion surveys) will require us to make conjecture from secondary information and experience.
Since there was no market per se in the USSR, the prices did not reflect the utility or demand of the product. As a consequence, the level of personal income didn't matter as much as it does in a market economy. Hence any monetary comparisons are meaningless. An income of (say) 200 roubles doesn't mean much if you can't use it to buy what you want, despite low prices. On the other hand, with (almost) free accomodation, medicine and education, and cheap and available most basic necessities such as bread and milk, one could get by with only casual income of ~2 roubles/day and even less (or even by recycling abandonned glass bottles).
Now, were these people who lived in shared apartments and collected bottles on the streets poor? By most objective measures, probably yes. But did they think of themselves as poor? I'd say no, en masse.
First, such behaviour was very common and was not stigmatised. Living in an apartment block of public housing may be a sign of poverty in the US, but a norm or even rather a privilege in the USSR, so nobody felt disadvantaged by it.
Second, the Soviet society was generally not structured by wealth. Contrary to popular myth, it was a very hierarchical society, but in non-economic (or rather, non-financial) terms. It was structured by access to privileges. A shop assistant or a butcher were not (officially) highly-paid occupations, but they had direct access to sought-after goods, and so were considered relatively privileged. A factory director or a general might get double or triple of an average worker, but their main advantage was access to special shops where they could actually spend these money.
In other words, people were not divided into 'rich' and 'poor' (at least, they did not feel that way), but rather into 'privileged' and 'unprivileged'. Most people made their way in life not so much through career in a proper sense, but through making as many connections with 'privileged' people as possible.
Thus, if we think of 'powerty' in this sense, we'll likely find that a lot more people in the US were considered (and considered themselves) as poor (below 'poverty line', whatever it means), than in the USSR.
Comment: This account is very realistic and reflects that what polish friends told me in the 1980's about their travels to the Soviet Union. Their impression was that the quality/standard of living was lower than in Poland. Their impression was also that the peaple there were unaware of this, some even boasting how they pitied the peaple in the eastern block for their low standard of living.
Comment: @MarkJohnson One of my favourite historical facts is that Nicolae Ceaucescu had the TV show *Dallas* aired in Romania, believing it would showcase the evils of capitalist society, but instead it caused the Romanian public to realise just how low their standard of living was in comparison to the rest of the world, and helped fuel the revolution that toppled Ceaucescu's government in 1989.
Comment: I *really* like this answer. The differences between the two, indicating why this is not meaningful, are brought out in a very good way!
Answer: You could always find statistics where USSR looked better
There are three kinds of lies: lies, damned lies, and statistics. If you want to find the "proof" that life in USSR was better than in US (at least for the poor), there are metrics that could help you.
Unemployment in USSR was very low, officially 1-2%, far lower then US unemployment which never got below 2% and most of the time was above 4%. In practice, this meant that almost everybody capable for work was assigned some position, i.e. some job. Was that position economically really profitable and  necessary is debatable. Soviet enterprises were chronically overstaffed and inefficient. As a result, wages were comparatively low . From late 1950's they would provide for basic necessities like food and some clothing, but not much else . We pretend to work, and they pretend to pay. Comparatively, workers in US would have less job security, but they would enjoy higher wages, could earn more if they specialized (in USSR this was not always the case) and they could start their own enterprises.
Also, officially homelessness in USSR didn't exist, unlike US . Everyone had to have place of residence, not having it was considered a crime. Unofficially, homeless did exist in USSR, although on a much lower scale then in US. What is more important is that average housing in USSR was much worse then in US, with multiple families sharing one flat. Also, practically all housing in cities was state owned, it was difficult to move and almost impossible to own your own residence. Again, vastly different from Western system where you would have a chance to work for and earn your own house.
Finally, in theory Soviet health care was universal and available to all. In practice, average Soviet hospital lacked much of equipment available in the West. There were of course special hospitals with better equipment and better medical staff but they were available only to Party nomenklatura and occasionally to those able to bribe their way in and be treated by "professors" . Of course, we could argue that health care system in US favors the rich, but overall, opportunity to earn for better treatment was much bigger in US, hence longer life expectancy.
Overall as a conclusion, USSR as a socialist country tended to suppress extreme poverty, but average Soviet citizen lived much worse then average US citizen.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/110118/discussion-on-answer-by-rs-29-can-we-compare-meaningfully-the-poverty-levels-in).


where to point compile flags?

Question: i am trying to compile autogen on RHEL, and i'm running into some trouble.
fair warning, i don't know a whole lot about what i am doing here.
when i run ./configure from the command line, i eventually get the error messages:
configure: guile-config used for CFLAGS: -pthread -I/usr/local/include/guile/2.0 -I/usr/local/include
configure: guile-config used for LIBS: -L/usr/local/lib -lguile-2.0 -lgc
checking whether libguile can be linked with... no
configure: error: Cannot find libguile.  libguile is required.

but i have already compiled and installed libguile.  i have the .so/.a files for libguile in /usr/local/lib/, and /usr/local/include/guile/2.0/libguile has all of the header files and whatnot.  there is also a guile-2.0.pc in /usr/local/lib/pkgconfig.
i can try to run the configure script again, and use the --with-libguile, --with-libguile-cflags, and --with-libguile-libs options, but i don't know what to put where.
any ideas?
Answer: The configure script might not know about stuff in /usr/local/lib. Try doing:
export LD_LIBRARY_PATH=/usr/local/lib

And then running configure. The LD_LIBRARY_PATH variable is used to indicate to programs to look there for libraries.

where to point compile flags?


Watt-meter showing half wattage

Question: Output power from the generator is showing half of the actual wattage. I checked the terminals and found out that two current wires are going from the main breaker to the switchboard, c1, and c3. Using clamp meter, c3 is showing 0.80 amps while c1 is showing 0. I changed the terminal of c1 but no change in the amps. I also found leaked oil at this c1 terminal. I cleaned the oil and use conductor cleaner to clean the terminal but no change.
It is a European style generator with output voltage 440V. One digital meter is showing 40kWatt but the analog meter is showing half power. The output voltage is correct 440V but the current is not right. The ammeter transfer switch shows zero current at line 1. line 2 and line 3 are OK.
I also checked connectivity with a multimeter and it beeps which means the circuit is connected. I have been trying on this problem for many days but could not troubleshoot the real problem. Can anyone help me where the issue could be? I will really appreciate your help.
Comment: Hello, and welcome to Stack Exchange. Measuring actual power is harder than just separately measuring voltage and current; you have to measure the product of the two.
Comment: Hard to guess, more info about the generator and/or photos of what you,re looking at would be helpful.  Also is this a Euro style 230V system or North American 120/240?
Comment: _"One digital meter is showing 40kWatt but the analog meter is showing half power. "_ -- are the meters both measuring at the same point in the circuit? If so, why don't you think it's simply that one of the meters is not working properly? Your question is vague and lacking important details, which is probably why it's languished without garnering any really useful answers. If you're still monitoring this account, you should consider updating the question with the necessary information.
Answer: When your generator is running it will only provide the wattage that the load requires. If running at half the listed output of the generator add additional loads. If the problem is your generator voltage is drooping at 1/2 the load you may have problems with the exciter controll or poor or worn contacts could be the problem.
Answer: As told Voltage is 'fixed' by the generator but power depends on current drawn (Power = Current x Voltage x cos(Phi)) So watt-meter (resp. amp-meter) will measure just the power (resp. current) used by your load at that very time.

Watt-meter showing half wattage


My cat sniffs any new furniture, person, bags, etc. for several hours

Question: Whenever any new person comes to home, my cat would keep sniffing the person and more so his/her clothes for several hours. Similarly if any new furniture or bag is brought my cat would keep sniffing for several hours. Why is it that my cat keeps sniffing anything new?
Answer: Smell is a much more significant sense for cats then it is for humans, they have in far more smell receptors in their noses than we do and there is the vomeronasal in the upper mouth as well. So their olfactory view of the world is much more detailed and complete then ours is, and they use it for communicating, for recognition, for hunting, for defense, for bonding the list goes on!
So if something changes in their environment or something new is added getting a comprehensive overview of it's scent is one of the first things they do and it's totally normal. As for the length of time they sniff for well depending on how complex or interesting the scent is that process can take a while. I'm not sure how accurately you've tracked it to get your "several hours" figure but I've seen mine give something interesting a good sniff on-and-off for in excess of an hour certainly.
Comment: Good answer but it is really several hours. Once a bought a new chair. She sniffed it whole day and sat on it the whole evening.
Comment: @Sonevol she may just be more thorough then my two, and from the sounds of it she really liked that chair!
Answer: Several hours of sniffing is more than just the time a cat needs to analyze the smell of a new furniture. But it is possible that the cat reacts to the smell of it. Every cat has smells they really like and they hate. And this can vary from cat to cat. Some cats really like the smell of solvents or glue (and some hate that). So it is possible that your cat loves the smell of new furnitures.


Attributing as B&W in IPTC using Bridge

Question: As an amateur I organise my photos in Bridge which does everything I require apart from one thing, I cannot find a means of attributing the color mode. It is visible but not editable under the file properties and if the original setting was correct it displays B&W otherwise it is a default of RGB. I have been scanning a lot of older pictures and would like to differentiate between colour & B&W. I could be dilligent and ensure it is set correctly at the time of scanning but it is a bit late for that. Thanks
Answer: When Bridge is showing an image that is B&W, that means that there is only one channel in the images. Only 256 shades of gray.  When you have a grayscale image that shows up as RBG, that means that even though the colors are all grayscale, the image was saved as a three channel RGB, 256 shades of red, 256 shades of blue, and 256 shades of green. But the values of the red, green, and blue are all equal.
Changing a grayscale RGB image into B&W is not something that can simply be changed by editing the metadata. That is why this shows up under "File Properties" in Bridge. It's a property of the file itself. The image has to be resaved as a one channel grayscale jpeg.
Comment: If re-saved as grayscale or dot gain the *color mode* will remain RGB; the *color profile* will then be grayscale/dot gain (if embedded).
Comment: Depends on what you do and what programs you use.  For example, to do so in Irfanview, you would have to convert to grayscale (Cntl+G).  Then when you save as jpeg, it will be a 1 channel grayscale jpg and should show up as B&W in Bridge.  I can't answer anything about dot gain.
Comment: It seems like it should show up as B&W in bridge, but it doesn't, it shows with the color mode of RGB, and a color profile of Dot Gain (single channel grayscale). B&W/grayscale is not a color space, and I think that is the issue... I have tried it several ways with several programs and it never shows with color mode of B&W but I do not have Irfanview.
Comment: It sounds like the programs you are using are still saving it as an RGB image.  Here's an example in GIMP.  Use the Image Menu->Mode->Grayscale and export as jpeg.  The result shows up as B&W for me in Bridge.

Attributing as B&W in IPTC using Bridge


file compression without using built in functions

Question: python programmers,
I'm am new to python ,I read that we have built in functions to achieve file compression in python . I just wanted to know if a file compression can be done without using these built in functions (maybe a longer code perhaps) .I wanted to understand the working of these built in functions(how they are coded) basically .
forgive the fallacies(if any) of a beginner,
thanks in advance
Comment: Read about [data compression](http://en.wikipedia.org/wiki/Data_compression), as internally, the python source code will implement gzip, zip, zlib, and bz2 algorithms. In the real world, though, use the standard modules - they are worked on constantly, improved with new versions, heavily used and tested.
Answer: Well there are lots of different ways to compress data, but it can be quite a task to undertake. One area you might want to research is Huffman Coding which can help with compression, especially for plain text. The reason I point it out is that it is more approachable than other compression techniques, and can be a good starting point.
Sure it is possible to do on your own, but it will be much longer than using pre-built functions and probably not as effective.
If you want to look up the implementation you can find open source libraries and look over the code that actually implements various compression algorithms.
Researching and learning about the code is a great idea, but unless there is a very good reason not to you should stick to using the pre-built modules.
Answer: If you would like to learn more about how file compression works, the code is available right in the python source code in the file gzip.py. You should also check out the zlib source code, on which the gzip module is based.
You can get zlib source code from zlib.net.


Arduino won't run well on 9v battery

Question: I have an Arduino UNO r3 and powering it up with 9v battery. But arduino run strangely (led 13 won't turn up correctly), how could this be?
Comment: Have you tried with a different, fresh 9 Volt battery?
Comment: Where did you connect the 9v battery - to the cigar style socket or to any particular board pins?
Comment: What is the battery voltage when it is connected to the Arduino?
Comment: @AnindoGhosh yes i have, and it's just the same, if I plug USB cable or 5v battery for power source, it runs correctly
Comment: @DannyStaple I connect positif lead to Vin and negatif lead to Gnd
Answer: Small rectangular 9V batteries are absolutely lousy power sources.  They have a very small current load capability.  They are specifically designed for low-current long-term draw.
For example, here is a link to an Energizer Datasheet:
http://data.energizer.com/PDFs/522.pdf
Notice on the first page that more than 25mA of load significantly reduces the usable life of the battery.
On the second page, graph on the right, you can see that 100mA will drop the life to a couple of hours.
Why is this critical?  Because an Arduino board by itself, when powered through Vin, draws on the order of 30-40mA.  This is before you connect anything else to it.  So the battery is barely usable to power just the board.
Get a better power source.
Answer: Assuming your battery is not dead or broken, and your arduino isn't broken either, the problem is most likely that your circuit is drawing too much current for a 9V battery. The current that a 9V battery can supply varies by manufacturer and chemistry, but it's safe to say in all cases the current available from a 9V battery is "not much". This is a consequence of putting so much voltage in such a small package.
To know if this is the problem, measure your battery voltage with it unconnected. It should be more than 9V for a fresh battery. Then, connect it to your circuit and measure the voltage while it's connected. If it's significantly less than 9V, you are drawing too much current. The battery voltage sags as a result, and may no longer be sufficient for your circuit to operate correctly.
If this is the case, either you have a fault in your circuit and its drawing more current than it should, or your circuit by design requires too much current, and you will have to change the circuit or get your 9V from a source capable of supplying more current, like a bigger battery, or a bench supply.
Answer: Have you tried running the Arduino by itself, with no external circuitry attached, from the 9V battery? If this doesn't work, then there's something physically wrong with your Arduino. Since you say it runs OK from the USB 5V supply, the on-board regulator may be damaged.
When you attach external circuitry to an Arduino, you are potentially putting additional demands on its on-board regulator, and this regulator is very much a weak link in the overall design. It is very easy to drive the regulator into thermal shutdown, because it is very tiny (SOT-223) and has essentially no heatsink — just a little bit of copper in the PCB itself.
A fresh alkaline 9V battery can supply up to 1A for short periods of time. However, if you draw 100 mA through the regulator, you're forcing it to dissipate 400 mW, and it can't do that for very long at all.
Ed Nisley did an extensive writeup of this in the December 2012 issue of Circuit Cellar, in which he calculated that the regulator was good for no more than about 500 mW, which would be 125 mA from a 9V battery. The Arduino board needs something like 30-40 mA all by itself, so if you're drawing more than 80 mA with your additional circuitry, you're in trouble.

Arduino won't run well on 9v battery


Error Setting up Minecraft-init Script

Question: I run a Ubunut 14.04 64Bit Server and try to get a vanilla Minecraft server to run as a Service. I found a good script here:
http://minecraft.gamepedia.com/Tutorials/Server_startup_script
I set it up as descriped there as well and edited the needed paramters. When i now try to run the server "service minecraft start" I get the following:
Starting minecraft_server.1.8.3.jar...
/etc/init.d/minecraft: 34: [: fabian: unexpected operator
As i can programm myself i can tell that the problem is the line "if [ "$ME" = "$USERNAME" ] ; then" but i'm not sure how to fix this. In the script there is a variable "USERNAME" and I'm unsure as to what to put there. I created a dedicated user "minecraft" for this purpuse but this doesn't work, neither does my main user "fabian".
It then asks me for the password for the user, I enter it correctly, it outputs:
"minecraft_server.1.8.3.jar is now running."
but when I try to connect (be it from LAN or WAN) it says "Can't connect to server" portforwarding must be corret as i can connect to the server when i run a start script manually.
Any ideas? Thanks for your help!
Answer: It sounds like you're running the script with sh instead of bash. Make sure the first line of the file is:
#!/bin/bash

with no space before the #.

Error Setting up Minecraft-init Script


Bernoulli Random Variable

Question: Let $X$ be a Bernoulli random variable with probability of success $p$. Answer the following questions.

(i) Derive the formulas for the mean, the variance, and the standard deviation of X.
(ii) Find the third and fourth moments of $X$.
Answer: $X$ has probability density function given by
$$
p_X(0)=P(X=0)=(1-p),\quad p_X(1)=P(X=1)=p.
$$
By knowing these probabilities, we can find the moments of any order by using the law of the unconscious statistician, i.e.
$$
E[g(X)]=\sum_{x=0}^1g(x)p_X(x)
$$
for any function $g$. Try this with $g(x)=x$, $g(x)=x^2$, $g(x)=x^3$ and $g(x)=x^4$, and recall that $\mathrm{Var}(X)=E[X^2]-E[X]^2$.
Answer: $E(e^{Xt})=E(1+Xt+X^2\frac{t^2}{2!}+\cdots)=1+E(X)t+E(X^2)\frac{t^3}{3!}+\cdots$
Now, $p_X(0)=1-p$ and $p_X(1)=p$
hence, $E(e^{Xt})=e^{0.t}p_X(0)+e^{1.t}p_X(1)=1-p +e^tp=(1-p)+p(1+t+t^2/2!+t^3/3!+\cdots)= 1+pt+p(t^2/2!)+p(t^3/3!)+\cdots$
Now, $r_{th}$ moment of $X$= coefficient of $t^r/r!$ in expansion of $E(e^{Xt})$ which is coming out to be  $p$ $\forall r\in \Bbb N$
Therefore, $E(X^r)=p$ $\forall r\in \Bbb N$.
therefore, Mean=$E(X)=p$
variance= $E(X^2)-(E(X))^2=p-p^2$
Standard deviation =$\sqrt{variance}$

Bernoulli Random Variable


Salesforce owner and different sharing options for integration scenarios

Question: If we have an account from SAP system, this account don't have an owner, then we insert this account into salesforce
the owner will be the default owner(current operation user). In the next day, maybe the SAP system push a owner ID(Sales Rep) to
this account, then we use apex code or trigger or workflow to update the standard owner field of this account. Then the SAP the assign this account to a telesales and push this relationship to
salesforce, then how can I share this sales rep's account to telesales?
My way is creating a sharing rule using apex code to share this account to the telesales. What's the another way to do this?
Answer: Sharing rules typically don't require APEX code. SR is a point&click feature for admins. To use APEX for sharing is also possible and called programmatically sharing. Just mind that these are two different approaches.
This options could work as alternatives or might even be combined

Sharing Rules
Programmatic Sharing with APEX
Manual Sharing
Account Teams


advanced search without javascript

Question: I'm building an advanced search with a-tags to filter for first letter abcdefghijklmnopqrstuvwxyz0-9 and also an input field, options fields for other criteria, radio buttons and a submit button. When I click on a letter-filter, it sends it as $_GET variable. But when I then use the input fields it forgets it of course. How can I grab this variable with the submit button before sending it along with all the other variables from the form? Do I have to use JS and AJAX for that? Do you recommend that?
EDIT
so let me rephrase that.
I have different variables to send to the server, coming from input fields, radio buttons, option fields but I also want a link for each letter of the alphabet (so it would then list all entries that start with that letter).
When I click the submit button it sends all the variables from the input fields but not from the a-tags (cause they are not recognized as form-fields I guess). When I click on the a-tags (a letter) it sends just that very variable to the server which is fine as well. My question is, how can I get the submit button to send everything?
    <input type='search' id='search-query' name='q' class='uk-input uk-form-width-medium' placeholder='Suche'>

    <?php
    foreach ($alphabet as $abc){
        if ($abc == $letter) {
            $class = 'current';
        }
        else $class = '';
        echo 'url.'?letter='.$abc.'">'.$abc.' ';
    }
    ?>

    <select class="uk-select uk-width-medium" name="what">
        <option>Titel</option>
        <option>Autor</option>
        <option>Erscheinungsdatum</option>
    </select>
        <input class="uk-radio" type="radio" name="how" value="aufsteigend" checked> aufsteigend
        <input class="uk-radio" type="radio" name="how" value="absteigend"> absteigend
    <button class="uk-button uk-button-primary" type="submit">Suche starten</button>
</form>```
Answer: I didn't really get the question and the whole situation from the explanation, but sounds like following:
You want to render the hints based on the value of the input field search-query when user clicks on the specific button: letter-filter. If this is right, then you will have to anyways send a get request to the back end so that it would give back the page with all hints.
FE:

    <form action="app.com/myurl" method="GET" >
      <input id="letter" value="a" name="letter" />
      <input id="letter2" value="b" name="other_param" />
      <input id="letter3" value="c" name="another_param" />

      <button type="submit">letter filter</button>
    </form>

You can even track the request in borwser's network tab, if the params are not appended as query params like app.com/myurl?letter=a&other_param=b&another_param=c, if you dont see the query params but see the url itself, then I can suggest you forgot to set the method of the form.
But I am still not sure, can you rephrase your question, as it doesn't clearly explain the case, sorry your english is a little confusing.
EDIT AFTER Rephrase:
I understood your aim now and you are right, submit button sends only form fields and  tag is not a form field.
If you want to append all form fields to  tag click then you have few options.

Append all parameters on server side manually on render:

You have

foreach ($alphabet as $abc){
  if ($abc == $letter) {
      $class = 'current';
  }

  else $class = '';
  echo 'url.'?letter='.$abc.'">'.$abc.' ';
}

And you need to additionally add form fields as well, I assume on first time click when none of the tags are rendered (no  tag on the screen) then you just send the form data, in tha moment you catch form data from $_GET and append to anchor

foreach ($alphabet as $abc){
  if ($abc == $letter) {
      $class = 'current';
  }

  else $class = '';
  echo 'url.'?letter='.$abc.'otherParamName='.$_GET['otherParam']].'">'.$abc.' ';
}

You can use js, to collect form data, I guess you use jQuery, and append to the href on click of the anchor

jQuery('a.someClassIdentifier').click(fuction(e) {
  // Please read documentation of jquery how to handle click events, I dont remember it out of my head right now.
});

But as an ultimate answer I would say rethink your approach. If you have already a form, and it sends GET request to the endpoint and it returns the same page where tags are visible then you can use form fields instead of anchor tags, that would already handle the data sending for you. But if you have different endpoints for tags receiving then best will be to send ajax request to receive only json data and render them without refreshing the page.
Hope it helps.
Comment: It basically works when I use "" fields for the letter filters or "". Then it sends all the variables within the form. But I want to use "" tags if possible.
Answer: I assume you want to have dynamic Google-like search where you type in "a" and it gives you a drop-down list of options like "airplane, applle, artery" etc.
If that is the case, then yes, you do need JS + AJAX.
Instead of clicking on a letter filter, you can have AJAX dynamically display you the options available right in the input field.
Given the vague description of your question and the absence of images of your UI that is all that can be said.

advanced search without javascript


Where should I post a Windows PowerShell question?

Question: Should it ask it in StackOverflow, Superuser or any other site?
The question is related to how to find some files in the filesystem.
Comment: How to find files would probably work best on Super User. There's likely already a duplicate target for what you need.
Comment: On 10-Nov-2020, StackOverflow 86,411 questions vs. SuperUser 4,041 questions
Answer: Windows PowerShell is a programming language, which is exactly what Stack Overflow is for. If you have a good question and show your research effort, your best bet will probably be SO.
Super User would work as well, as your question is about computers. I would recommend using Stack Overflow, though, because it's specifically for programming languages and there are about 64,000 questions tagged powershell, so it's definitely a well-covered topic.
Comment: Either community will work.  A good question, will require research and your own code in either community, for an appropriate answer to be submitted.  Question seeking somebody to simply write the code for you will result in the question being closed.


What is wrong with this plant?

Question:
It has been like that for quite a while it looks like something upset her. What is wrong with it?
Comment: What sort of light is available to the plant? Has the light changed recently, e.g plant moved, different bulb, room painted resulting in less reflected light etc? How large is the pot - maybe it's time to repot? Have there been changes to air quality or room temperature. How old is the plant etc. Please tell us about the plant's environment and history.
Comment: same light, nothing has changed. You can see that with the same light the plant was OK previously.
Answer: This plant is called Dracaena marginata or the dragon tree. It can be distinguished by it's yellow roots.  Here are some pictures of these plants when grown in high light.
The appearance of your plant is consistent with a plant grown in low light. When this happens leaves fall towards the stem.
You should also check the undersides of the leaves for spider mites. They look like little grains of salt. They will cause leaf drop, usually from the bottom up.
You can perk the plant up by providing more light, either artificial or natural.
Comment: @user2059078 - what is your watering regime? How long has the plant been in the same pot? Have you had your heating up high during the last few weeks/months?
Comment: Thanks kevisnsky! The plant does not seem to have parasites, I believe it is the light I will try to move it to a brighter spot. Can it be the water ?
Comment: Can't say much about watering; my wife waters this from time to time, not regularly but the water is provided when the soil is dry. Yes heating went up in the building due to very low temperatures in Canada. The plant has been in the same pot for around 2 years I have another one which is in the same shape, just in another room... just a little less unhappy than this one

What is wrong with this plant?


singular access log entry without leading slash

Question: When tracking down a PHP notification of WordPress in canonical.php where parse_url() created an array without 'path' entry, we found this related line (with a corresponding 301 redirect) in access log:
188.165.XXX.XXX - - [29/Jun/2016:07:58:34 +0200] "GET ?subject=Company-Name - Contact via website HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:220.127.116.11) Gecko/20101026 Firefox/3.6.12" 1603141 430 520
188.165.XXX.XXX - - [29/Jun/2016:07:58:36 +0200] "GET /?subject=Company-Name HTTP/1.1" 200 4908 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:184.108.40.206) Gecko/20101026 Firefox/3.6.12" 404908 433 5445
Seems to be some bot which takes an existing mailto: link from the site and tries to access it via http:.. and finally ends up on main homepage.
Note the missing leading slash in first GET request.
Any idea how this can/does happen?
Tried to reproduce such entries with php file_get_contents() or curl and similar, but to no avail, always had the leading slash in access log.
Website is at some shared hosting, phpinfo says: "Linux vhost01 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64" with "CGI/FastCGI" and "Apache 2.0 Handler" at SAPI modules. Can't see exactly which Apache 2 version :-(
Edit: All other log entries have a leading slash.
Answer: I'd say this would reproduce the problem:
<code>echo -e "GET ?subject=Company-Name HTTP/1.1\r\nHost: www.example.com\r\n\r\n" | nc <your IP> 80
</code>
As to why it's happening, well, your guess (that someone's scraping mailto links) is quite plausible.  A lot of stupid people write software.


Somehow lost my MENU from my home page- help!

Question: I am a total newbie to Wordpress (and an "old school" person!)
Somehow though, I managed to begin to set up a basic website using  Astra - and all was going well.  Then I messed around, added some plug-ins, got rid of the sidebars,increased the size of the header photo, etc. and before I knew it, my menu was completely gone.  Prior to this, I had had a "three bar" type graphic which when clicked,  brought up the list of pages I had created.  I went back and unactivated the plug-ins I had added, tried re-adding the sidebars, decreased the header photo and text size, etc. - but still have no menu. I was up till 5:50 this morning trying to figure it out, and no joy.
Can anyone help?
Comment: You should ask the theme's support; they can probably help you with that.
Answer: Go into Theme, Customize, and there should be a "Menu" choice. Select an existing menu (if still there) or create a new one.
When you change themes, you often have to re-specify the menu again, even if it already exists.
The 'three-bar graphic' (AKA "hamburger") is shown at certain (usually smaller) screen sizes. That is a function of how the theme does the CSS for smaller screens. Most will have CSS code that will turn a horizontal text menu into a Hamburger icon that you have to tap to see the menu choices.
It could be that you changes some CSS (in Theme, Customization, Additional CSS) for the CSS class used by the menu that caused it not to display the Hamburger icon. Or you could have deleted/de-specified the menu in the Customization, Menu area.
YOu didn't specify whether you had changed the theme code. Not a good idea, BTW. If you want to re-code parts of the theme, then Child Themes are the way to go. You'll find lots of info in the Codex/Developer area (https://developer.wordpress.org ), along with lots of googles/bings/ducks on Child Themes.


how can I put 2 files with the same number of lines side by side with Perl

Question: how can I put 2 files A and B with the same number of lines side by side with Perl with
command line ? I cannot work with two filehandles on the command line.
Comment: Could you elaborate a bit on what your trying to do. It sounds like this might be homework.
Comment: Read the first file into e.g. a list of lines, then read the second file into e.g. a list of lines and then print each "matching" element from each list one after the other e.g. `list1-1 list2-1` (side-by-side)?
Answer: Here is a way to go:
I used those 2 files:
<code>$ cat file1
file1 line1
file1 line2
file1 line3

$ cat file2
file2 line1
file2 line2
file2 line3
</code>
Running one-liner:
<code>$ perl -E '($f1,$f2)=@ARGV;open $F1,$f1;chomp(@l1=<$F1>);open $F2,$f2;chomp(@l2=<$F2>);for($i=0;$i<@l1;$i++){say $l1[$i],"\t",$l2[$i]}' file1 file2
file1 line1     file2 line1
file1 line2     file2 line2
file1 line3     file2 line3
</code>
<code>($f1,$f2)=@ARGV;                # retrieve the 2 filenames
open $F1,$f1;                   # open first file
chomp(@l1=<$F1>);               # read it in an array
open $F2,$f2;                   # open second file
chomp(@l2=<$F2>);               # read it in an array
for($i=0;$i<@l1;$i++){          # loop thru all record (as said in question the 2 file have same number of records
    say $l1[$i],"\t",$l2[$i]        # print line by line the 2 file content separated by a tabulation
}
</code>


Torsion freeness and birational maps

Question: Let $f:X\rightarrow Y$ be a birational morphism between smooth varieties and $F$ a torsion free sheaf. Is $f_{\ast} F$ torsion free? If not, are there conditions on either $F$, $f$, $X$ or $Y$ that could ensure the torsion freeness of $F$? For example if $f$ is surj. and $F$ is the canonical bundle on $X$ a theorem of Kollar ensure the torsion freeness of $f_*(\omega_X)$.
Comment: If $F$ is torsion free on $X$, then $F\to F\otimes K(X)$ is injective
where $K(X)$ is the constant sheaf associated to the function field.
The injectivity persists for $f_*F$ since $f_*$ is left exact.
So yes, and you don't need anything as deep as Kollar's theorem.
Answer: Actually much more is true. In fact there is the following result, whose proof can be found in
[Grothendieck - Dieudonné: EGA 1 (Elements de Géométrie Algebrique), Proposition 8.4.5 page 351].

Proposition. Let $X$, $Y$ be two integral schemes and $f \colon X \to Y$ be a dominant morphism. Then for any torsion-free $\mathcal{O}_X$-module $\mathcal{F}$, the push-forward $f_* \mathcal{F}$ is a torsion-free $\mathcal{O}_Y$-module.

Kollar's result is much deeper since he proves the torsion-freeness of the higher direct images $R^if_* \omega_X$.
Comment: Thank you very much!!!
I believed it was true but I could not find the right reference!!!
best wishes!
Comment: Maybe we don't have the same edition (?), but in mine (french version) the result is Proposition 7.4.5 page 163 (still in EGA I).
Answer: As already mentioned by Donu and Francesco, you don't need such big guns as Kollár's theorem. Also, the Proposition Francesco cites might seem more serious than it is by virtue of being in EGA...
The point is this: For an open set $V\subseteq Y$, the module $f_*\mathscr F(V)$ is the same as the module $\mathscr F(f^{-1}V)$. Being torsion on an integral scheme is equivalent to having a non-empty support that is strictly smaller than the ambient scheme. If $f$ is surjective this already gives you what you want, and if it is only dominant you need to think a little more to see that the statement is true.
Comment: Thank you very much for your time!
this was really helpfull.

Torsion freeness and birational maps


EM clustering, initial cluster position

Question: Does there exist an implementation (EM-clustering) that allows you to specify the initial cluster positions beforehand? The datasets relevant for me are two dimensional and since just assign random cluster positions at start yield less accuracy than a clever initial setup I want to analyze 2d plots and specify my own initialization.
Comment: Yes, e.g., in ELKI you can provide initial cluster centers from Java. I'm fairly certain this will also be possible in sklearn and R. Just spend a few minutes with Google and looking at the codes. And consider contributing missing functionality to open source projects.
Answer: Maybe the most popular approach is to initialize GMM is through k-means, and use the result as the centers for the Gaussians. There are other approaches, but in practice that is the most common approach I have seen and used.
Comment: Actually the most popular, c.f. Mclust in R, seems to be to use hierarchical clustering.

EM clustering, initial cluster position


Can a game world be made using a 3D editor?

Question: I'm just wondering it it's possible to create and render a game world in a 3D modelling program, such as Blender, with landscapes and trees and such, and then import it into a game engine? Is that how open world games make their worlds, or do they use another method?
Comment: (In general, I recommend against asking "Is X possible" or "Can I do X" questions here. Just try it. If it works, you never needed to ask in the first place. If it doesn't work, you can explain specifically where you ran into trouble, and ask for a solution to that specific problem. That generally produces much more useful, actionable answers than "yes, it's possible")
Comment: It can be done this way. Have you run into any particular difficulty when you tried it, that we can help you overcome?
Comment: It _can_ be done this way, but pretty much all game engines come with their own built-in world editing tools, so I wouldn't bet on it being a popular way to do level development.
Answer: This is in fact how it used to be done in the past and still works in some Engines like Godot that lack a build in Terrain-Tool. It's totally possible to make a terrain in Blender and import it to your engine as a gigantic static mesh. But you don't want to include stuff like Trees in your terrain mesh. Those are better made a separate object. Especially for repeating objects like trees you want to use instanced drawing to not run into performance issues.
That being said, this approach has major drawbacks. You would need to re-import your terrain every time you make changes to it in your external software. When tweaking it you won't see any of the other game objects you placed into your engine editor. For larger maps you would also have to split it into parts, make sure they fit together seamlessly, create LODs etc. Depending of the complexity of your terrain this can get a huge problem. Especially for large open world games this is a 100% not the way to go.
Long story short: Yes it's technically possible, but not recommended unless your project is so small that it won't cause any issues. If your Engine has it's own Terrain-Tool i would heavily recommend you to just use it.
Answer: It can work for smaller and less detailed landscapes. But with larger and high-detail landscapes, you will run into performance problems. You will need LOD, occlusion culling and perhaps even dynamic loading and unloading of parts of the landscape. With most engines, none of that can work if the whole landscape is just one block of geometry.
Which is why many 3d engines have specialized systems for terrain rendering. These usually come with their own editors. The workflow is usually to sculpt the terrain in the engines terrain editor, design individual props like buildings or plants in a 3d modeling program and then place these props on the terrain using the editor.


Someone claims to have hacked my WiFi. What do I do now?

Question: My son plays Minecraft on the internet. Someone said they hacked into his WiFi.  Our WiFi is locked and must have a passcode to access. Is it possible this happened and, if so what should we do?
Comment: While its certainly good to be vigilant in double checking your security, if this was said in the game I would say the more likely scenario is that this is just a bit of sledging.
Comment: Vaguely sounds like a common case of router-hack because of wide-spread security incompetence of router manufactures. Really not enough details to know what you are talking about though.
Comment: Is your wifi password secure? Hacking the router does not require the password.
Answer: It is possible in theory, but this does not make it having actually happened.
It is equally possible that whoever said that did it just to mess with your son's head, and yours.
We'd need to know what the exact make and model (if possible even firmware revision) your router is. The WiFi router is essentially a small PC and it is sometimes (depending on the make and model) accessible from the Internet. Since its Internet address is, in that case, the same Internet address of whoever uses it, i.e. your son's when he plays Minecraft (or an address that can be calculated from your son's, in the unlikely event that your ISP assigned you an address group instead of a single one), anyone capable of getting your son's IP address would automatically know the router's.
The first line of defense is that the router either does not offer, or it does but the option was disabled by the owner, a way of being remotely controlled. Some ISPs will supply a WiFi AP/router and leave it remotely accessible, with a password known only to them (in theory). In practice these passwords leak. Sometimes are even sold or spammed by disgruntled ISP employees.
There have been cases of router manufacturers that supplied their routers with two passwords, one settable by the owner, one known (in theory) only to them, enabling them to fix problems remotely. Again, if these "backdoor passwords" leak, the router ceases to be secure.
Then there have been cases of sloppy manufacturers doing improper password checks. Imagine I ask you a password to tell you where the goodies are, and the "security" is that in theory no one can know where they are unless they give the correct password. But it turns out that the goodies are always in the same place on all the routers. At that point you don't actually need the password at all.
There are also other sloppinesses (thanks to @Anders for pointing one out). The router might allow requests in such a way that it would obey to a request your browser has been tricked into making on someone else's behalf. To do this, one would need to send you a link, and you would need to click on it, pointing to some strange URL such as (this is a faked example) http: // YOUR_INTERNAL_ROUTER_ADDRESS / commands/allow-access?to=EVERYONE. This kind of vulnerability is also fixable by the router vendor.
Knowing the manufacturer, the model and the firmware revision, it will be possible to verify whether yours is one of the known unsecure models, and/or whether it offers remote administration capabilities.
Do It Yourself
Meanwhile, you can check the user manual yourself. If, for example, you discover that:

your router has remote administration capabilities ("remote login", "ssh login", "WAN access", "remote telnet", and references to ports 22, 23, 8000, 8080 and similar being "available" or "activable" or "needing to be closed for security" are all strong hints that it has),
the default password for that interface (which is not the same as the WiFi) is still the default (e.g. "admin"), or it is not but you don't remember having changed it and don't even know what it is

...then yes, chances are that your WiFi has been hacked (or might be any time), and you should deactivate the remote admin interface and/or change its password. You may need to reset the router to the factory settings to be able to do so, and possibly even ask for your ISP's tech help.
In theory, your router might be unreliable even so, for it might have been been in control of parties unknown and it might have been modified in such ways that even a factory reset can't undo. It's not too likely, to be sure, but it can happen.
Also, even if you find no remote admin interface active, the router might still be vulnerable in the "non-official" ways mentioned above. You can run a first basic check yourself by entering your make and model into Google and add "vulnerability" or "backdoor" as search keywords. If you find something like "YOUR_ROUTER has SO_AND_SO vulnerability", again you might have reason to worry.
Update
One thing I forgot to mention is that before doing anything else, you should check your AP's vendor site and verify whether there are vendor fixes for your model. Some routers/APs have a "Check for Updates" function that does this automatically, but you may prefer not to trust (or at least, double-check) a possibly compromised router as to whether it needs updating or not. A router reporting, say, firmware version 21 and "No need to update" while the vendor site reports "Update 22 to version 21. Fixes multiple vulnerabilities" is a very strong hint that your router is either misconfigured, or has been hacked (this doesn't only work for AP/routers. This actually happened to me on a Synology DS212 NAS).
Comment: One way to hack a router that does not have remote access is to use a CSRF exploit against the web interface. Sadly those kind of vulnerabilities are not uncommon.
Answer: If this "someone" claiming to have hacked the "wifi" lives beyond the range of the router's broadcasts, then it is impossible for him/her to have hacked the wifi. However, expanding on what @Iserni stated, if you router has remote access through WAN enabled, and, it is a vulnerable model, one can remotely access the built-in router shell and make changes to the configuration, change passwords, boot clients from the router, and even shutdown the router, etc.
It would be a good idea to disconnect the router from the modem, then login using your router's default gateway in your browser (most commonly the default gateway is 192.168.1.1) and make sure to disable ssh or remote management. Then be sure to change the router's login password to something more than 16 characters. The longer the password, the more difficult to hack.
Answer: It's psychological warfare, their true goal is to get you scared/angry enough to cut your son's funding, taking him out of the game.
That being said, if you're running an off-the-shelf router you're quite vulnerable. Check this list of free and open-source router firmware and then either flash your router or buy a router that you can flash and flash it. On top of being more secure by the simple virtue of being vettable(much harder to hide deliberate backdoors and vulnerabilities in plain view), there are lots of added features that you can play with to optimize your setup. Ask your son for help, it's a great opportunity for a practical father-son project.
PS. This is just the tip of the vulnerability iceberg; your son's computer is by far the easier target. The fix is more or less the same, and running free and open-source software is the place to start. Here's a quick intro intro to the subject by the founder of the movement.


How to get the URL of a file located in the theme folder?

Question: Is there a way to get the URL of an image located in the theme folder? Or just get the URL of the theme folder?
Answer: You can use drupal_get_path() to get the path to your theme folder:
$path = drupal_get_path('theme', 'name_of_theme');

From there you can specify a particular file like this:
$image_path = $path . '/images/image.jpg';

You could also use path_to_theme(), but be wary as the return from this can change depending on the context it's called in:

It can point to the active theme or the module handling a themed implementation. For example, when invoked within the scope of a theming call it will depend on where the theming function is handled. If implemented from a module, it will point to the module. If implemented from the active theme, it will point to the active theme. When called outside the scope of a theming call, it will always point to the active theme.
Comment: As an addition, it also possible to use function `file_create_url()`, so in the end to get absolute URL it's possible to call:
`$image_url = file_create_url($image_path);`
Comment: Thanks for your help. And finally to make it URL, all I need is to add "$base_url" to the beginning of the path.
Comment: A neato trick is also to get "path to current theme" which I use this function for:

  function get_theme_path(){
    $themename = variable_get('theme_default', 'my_theme');
    $themepath = drupal_get_path('theme', $themename);
    return $themepath;
  }
Comment: if you arrive here looking for D9/D10 advice, `drupal_get_path()` has been deprecated and you;ll now want to use something like `\Drupal::service('extension.list.theme')->getPath('seven')` https://www.drupal.org/node/2940438
Answer: $imgurl = file_create_url(path_to_theme().'/images/blah.png');

description: this line of code uses path_to_theme(), to get the path to the theme, and then file_create_url(), to create an url for the file, to get the URL of an image located in the theme folder, as requested by the op.
I got a downvote for not describing it, so there you are :-)
its also the same as the accepted answer, just with comments applied to make it more complete. please note that it refers to the theme folder of the current theme, so its mainly usefull inside a theme template.
Comment: If you have a multilingual page this is the method to go. drupal_get_path does not handle language prefixes in paths. so you might end up with a file path of /en/sites/all/themes/mytheme/image.png. file_create_url handles it properly.
Comment: If this line of code provides an answer to the question, it would be nice to include description for it.
Answer: In Drupal 8
global $base_url;
$theme = \Drupal::theme()->getActiveTheme();
$image_url = $base_url.'/'. $theme->getPath() .'/images/image.jpg';


Way to logout a user from the command line in OS X 10.9

Question: I want to logout my Mac OS X from the command line. My OS X version is 10.9.
I tried command pkill -KILL -u uid, but this command didn't work out.
Is there a command that can be used to log out a user from the system using command line only, not AppleScript?
Comment: Sending the `KILL` signal should be a last resort — it gives the process no opportunity to shut down cleanly, store its state, flush and close files and connections, reset hardware, or any other tidy-up, which can cause trouble in some cases.  (I usually find it best to send at least one of TERM, HUP, QUIT, ABRT, INT first, to give the process a chance to stop gracefully, and then send KILL only if all else has failed — which is rare in practice.)
Comment: what exactly didn't work out?
Comment: on running the command pkill -KILL -u uid the system shows me a grey screen and on waiting for long the system shows the force quit window with no application running
Answer: sudo launchctl bootout gui/$(id -u <username>)
or
sudo launchctl bootout user/$(id -u <username>)
Replace username with the target user's user name or replace the whole subshell with the user's uid.  This tells launchctl to teardown the users login session (gui specifically refers to the user's temporary login session, user specifies the users background processes).
You can log yourself out without the sudo to test this.
Note that this will ONLY work on macOS 10.11.x or newer (see launchctl help for more)
Comment: I JUST reread your question and I'm sorry that this won't help you, but it will come up in google search results.
Comment: Do you know opposite command to bootout? I need login user programmatically.
Comment: This is great. My Mac gets stuck after a while when I tell it to log out, and it never logs out. The second command was very persuasive.
Answer: To log out purely from terminal (or a remote ssh session), just kill the loginwindow process:
sudo pkill loginwindow

You could get fancy and specify the user if multiple users have a loginwindow process, but this is an easy one shot, no prompt way to end a user's graphical session.
Comment: Maybe things changed since 2014, but nowadays this would log out the current user as well (there is one `loginwindow` process for each logged in user).
Answer: This has worked for me in the past:
Log out (with confirmation)
osascript -e 'tell app "System Events" to log out'

Log out directly (no confirmation)
osascript -e 'tell app "System Events" to  «event aevtrlgo»'

or
osascript -e 'tell application "loginwindow" to  «event aevtrlgo»'

This way any running application will get noticed and can terminate in a safe fashion.
Comment: Note that « ≠ <<
Answer: A nice utility to add to your Terminal is the "logout" command, to be used like:
logout UserName

Here the how to:

Edit your .bash_profile
nano ~/.bash_profile
Add this line:
logout() {sudo launchctl bootout user/$(id -u "$1")}
Save the file pressing ctrl+x
Restart the terminal

You are ready to go ;)
Comment: I had to break the body out onto a new line and put the closing curly brace afterwards as well.
Comment: @bmauter not for me, in the suggested form works perfectly.
Comment: Created .bash_profile and added: `logout() {sudo launchctl bootout user/$(id -u "$1")}`

I get the following error when I try to execute.

`-bash: logout: FIRSTNAME: numeric argument required`

I'm puzzled. The command works fine when used directly in the terminal, but for some reason this as a bash profile or bash script keeps spitting this error out. I wonder if it has to do with the fact that the username I am trying to test with has a space in it betwen First and Last Name? Seems like the Last name is being interpreted as an argument, yet the entry in .bash_profile has double quotes.
Answer: It's just
launchctl reboot logout

(needs to be run under the logout-target user, so prefix with sudo -u …a_user…).
man launchctl:

… With the logout argument given, launchd will tear down the caller's GUI login
session in a manner similar to a logout initiated from the Apple menu. The key
difference is that a logout initiated through this subcommand will be much
faster since it will not give apps a chance to display modal dialogs to block
logout indefinitely; therefore there is data corruption risk to using this
option. Only use it when you know you have no unsaved data in your running
apps. …
Answer: If you have multiple users ....
Find the Process ID with:
ps aux|grep login

Then kill that process and you logged that session out. But there are a lot of procceses left.
Check with pstree so you know which process to terminate.
Answer: To get some root privileges and the # prompt, To kill all processes of another user:
sudo killall -vu USERNAME -HUP

And if it´s not all gone. Nuke em! Obligatory warning - killing things as root has no undo and no "are you sure you want to interrupt this process without saving your files, including system critical databases that might render the machine unbootable on rare occasion." type warnings.
sudo killall -vu USERNAME -9

Answer: An extreme way to kick the user session out is to force a restart:
sudo shutdown -r now

This works out well if you are trying to update the system.
Comment: And you can kill the spiders in your home by burning it down, too.  Shutting down will have the *inherent* effect of kicking off users but if your goal is just to log someone out forcing a restart is on the extreme side.
Answer: This does the trick for me
sudo -su user
and for root
sudo -su root
Answer: if you're logged with ssh to a remote computer you can logout by simply typing 'exit':
[host:~user]$ exit


Oracle Populate backup table from primary table

Question: The program that I am currently assigned to has a requirement that I copy the contents of a table to a backup table, prior to the real processing.
During code review, a coworker pointed out that
INSERT INTO BACKUP_TABLE
SELECT *
FROM PRIMARY_TABLE

is unduly risky, as it is possible for the tables to have different columns, and different column orders.
I am also under the constraint to not create/delete/rename tables. ~Sigh~
The columns in the table are expected to change, so simply hard-coding the column names is not really the solution I am looking for.
I am looking for ideas on a reasonable non-risky way to get this job done.
Answer: Does the backup table stay around? Does it keep the data permanently, or is it just a copy of the current values?
Too bad about not being able to create/delete/rename/copy. Otherwise, if it's short term, just used in case something goes wrong, then you could drop it at the start of processing and do something like
create table backup_table as select * from primary_table;

Your best option may be to make the select explicit, as
insert into backup_table (<list of columns>) select <list of columns> from primary_table;

You could generate that by building a SQL string from the data dictionary, then doing execute immediate. But you'll still be at risk if the backup_table doesn't contain all the important columns from the primary_table.
Might just want to make it explicit, and raise a major error if backup_table doesn't exist, or any of the columns in primary_table aren't in backup_table.
Comment: It is permanent, and I am not permitted to create it.  It would be much too easy that way.

The data dictionary idea sounds viable.  See what columns they have in common and work with that.
Comment: I went with the data dictionary option.
Answer: How often do you change the structure of your tables?  Your method should work just fine provided the structure doesn't change.  Personally I think your DBAs should give you a mechanism for dropping the backup table and recreating it, such as a stored procedure.  We had something similar at my last job for truncating certain tables, since truncating is frequently much faster than DELETE FROM TABLE;.
Comment: That idea sounds viable.  I will check with my DBAs.
Answer: If I had this situation, I would retrieve the column definitions for the two tables right at the beginning of the problem. Then, if they were identical, I would proceed with the simple:
INSERT INTO BACKUP_TABLE
SELECT *
FROM PRIMARY_TABLE

If they were different, I would only proceed if there were no critical columns missing from the backup table. In this case I would use this form for the backup copy:
INSERT INTO BACKUP_TABLE (<list of columns>)
SELECT <list of columns>
FROM PRIMARY_TABLE

But I'd also worry about what would happen if I simply stopped the program with an error, so I might even have a backup plan where I would use the second form for the columns that are in both tables, and also dump a text file with the PK and any columns that are missing from the backup. Also log an error even though it appears that the program completed normally. That way, you could recover the data if the worst happened.
Really, this is a symptom of bad processes somewhere which should be addressed, but defensive programming can help to make it someone else's problem, not yours. If they don't notice the log error message which tells them about the text dump with the missing columns, then its not your fault.
But, if you don't code defensively, and the worst happens, it will be partly your fault.
Answer: Is there a reason that you can't just list out the columns in the tables?  So
INSERT INTO backup_table( col1, col2, col3, ... colN )
  SELECT col1, col2, col3, ..., colN
    FROM primary_table

Of course, this requires that you revisit the code when you change the definition of one of the tables to determine if you need to make code changes, but that's generally a small price to pay for insulating yourself from differences in column order, differences in column names, and irrelevent differences in table definitions.
Comment: Well, laziness factor aside the tables are expected to change, and there is a desire to avoid changing the program.
Thanks for pointing that out.
Answer: You could try something like:
CREATE TABLE secondary_table AS SELECT * FROM primary_table;

Not sure if that automatically copies data. If not:
CREATE TABLE secondary_table AS SELECT * FROM primary_table LIMIT 1;
INSERT INTO secondary_table SELECT * FROM primary_table;

Edit:
Sorry, didn't read your post completely: especially the constraints part. I'm afraid I don't know how. My guess would be using a procedure that first describes both tables and compares them, before creating a lengthy insert / select query.
Still, if you're using a backup-table, I think it's pretty important it matches the original one exactly.
Comment: I am also under the constraint to not create/delete/rename tables