Moving a process to and from swap

Question: I've got several server-type processes on my linux server that use up 50MB of RAM. They are not constantly being used, and I'd like to be able to run more instances than my RAM capacity allows. I want to be able to remove a process from RAM and move it to the disk's swap. Does the linux kernel provide anything to fine tune swappiness per-process?
Comment: Can someone reopen this question? I'd like to add complete answer to it. Dealing with low memory and swap management kinda perfectly fits into system administration.
Comment: Is this a virtual machine of some sort or a dedicated server? There's a few things that might work in the latter like [zram](http://en.wikipedia.org/wiki/ZRam).
Comment: Dedicated. Will look into zram
Comment: I dunno, this seems a bit tacky, especially given the small RAM footprint involved. Tune swappiness for now. Since it's sounds like a hosted server, you may not have the flexibility of some other solutions...
Answer: The Linux kernel provides via proc filesystem a property which defines how aggressively memory pages (anonymous only !) are swapped out to disk.
The vm.swappiness property is applied globally per system but not per process. Set this value low if you want to avoid swapping as much as possible. If your system process sleeps for a long time you may benefit with an aggressive swapping behavior by increasing this value.
You can change it temporarily from CLI (it will not survive system reboot)
echo 90 > /proc/sys/vm/swappiness

Or persistently with adding this line to /etc/sysctl.conf
vm.swappiness=90

And applying it with
sysctl -p

Or it should be possible to make it more granular with cgroups and memory subsystem if your system is running on recent Linux kernel (since 2.6.24 ?!?). Lets assume you have available a cgroup hieararchy with memory subsystem attached (/cgroups/mem) and a cgroup (/cgroups/mem/your_cgroup) with tasks/processes defined (/cgroups/mem/your_cgroup/tasks). Then, you can change swappiness behaviour for this group of tasks as follows:
cd /cgroups/mem/your_cgroup
echo 90 > memory.swappiness

For more details about memory subsystem, you can read e.g. RedHat Resource Guide.
Answer: You are not smarter than the kernel's VM subsystem. Just let the processes be, and if they're really going unused, they'll get swapped out without you needing to do anything.
Comment: "Don't do a thing" is not an answer to "How do I do a thing" unless there's some thoroughly explained "why nots" or alternatives.

See [_Answer the Question_ in "Answering"](http://stackoverflow.com/help/how-to-answer)
Comment: He's also wrong, because it works perfectly with cgroups.

Moving a process to and from swap


Switch back to New Experience UI

Question: I have selected the option to return to the Classic UI for document libraries via the option that was available when viewing a document library.  Now I want to switch back to the New Experience UI, how do I do that?
Comment: I figured out the answer, see http://sharepoint.stackexchange.com/a/191244/59089
Answer: I also wondered further about the session cookie making the classic user experience and it was cookie named "splnu" with value 0. By removing it and pressing refresh button it switched back to setting by admin that was the new user experience.
For convenience it is good to use a kind of cookie manager extension in your browser - I used the cookie inspector for the google chrome (and available as tab) in the chrome developer tools and it was really a piece of cake :)
Comment: Excellent! This cookie tip fixed my issue, I could not go back to the Modern UI experience because of the site layout (Oslo). since the link to return to modern UI is under the quick launch, it was not possible to undo the classic view mode.
Answer: I found the answer to my question here http://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_manage/how-to-switch-between-classic-and-new-library/b25035ec-21d0-4740-b7c7-1cf9ba3311bb.
The gist of this answer is that you must clear the browser cookie that indicates to use the new experience UI.  The article states to clear all cookies, but I found I only needed to clear the cookies related to my SharePoint site.  I was not able to figure out which cookie specifically needs to be cleared.
Answer: The name of the cookie is "spInu" with a value of 0. Deleting that one will restore the modern UI without having to clear all cookies.
Answer: You can set the cookie directly without needing to clear them. Paste this into your URL bar while you're on the page:
<code>javascript:document.cookie = "splnu = 1; path=/"
</code>
Then reload the page.
Comment: Thanks a ton, @john-fouhy! I have Developer tools locked by policy and this saved me several hours!)
Answer:
In your document library, choose Settings icon and then Library settings.

Click Advanced settings and then scroll down to List experience.
Choose New experience.

For more details check Switch the default experience for lists or document libraries from new or classic
Comment: New experience for lists is in the process of rolling out to first release tenants
Comment: New experience has been released for library only. Am I right?
Comment: Dear @AtishDipongkor  it's also for list , should you check the attached link where he mentions list or library but really I saw it for library only :) https://support.office.com/en-us/article/Switch-the-default-experience-for-lists-or-document-libraries-from-new-or-classic-66dac24b-4177-4775-bf50-3d267318caa9
Comment: I have checked the link. In my SharePoint Online site I did not see all new experiences. I can see SharePoint Home and Library experience only.
Comment: You are right my bro I also checked it and checked this article https://blogs.office.com/2016/06/07/modern-document-libraries-in-sharepoint/  any way the questioner need it for library :) thanks for your precious time and valuable info ,
Comment: @M.Qassas that is how a library admin changes the default UI view for the list, but in my case a user has selected the option that SharePoint offers to users to view using the new experience UI.
Answer: it is in the library settings under ADVANCED SETTINGS.
Look up for Library - library settings
£rd from top in the first column

Switch back to New Experience UI


Is there a way to retrieve Journey History for contact using REST API?

Question: I'm looking for a way to retrieve journey contact history - basically the same information that is on Journey Builder - History tab (Contact key, Journey Name, Activity name, Status, Timestamp) via SFMC API. I browsed the REST API documentation but couldn't find anything regarding getting that data. Has anyone ever done something like this and can push me in the right direction?
Answer: You can retrieve Journey History by POSTing to this endpoint /interaction/v1/interactions/traceevents/search
It is the same endpoint used in the History tab in Journey Builder.
Example of the request payload without any filter (apart from time)
<code>{"from":0,"size":100,"filter":{"fquery":{"query":{"query_string":{"query":"(transactionTime:[2017-08-29T13:20:45.101Z TO *])"}}}}}
</code>
Example of the request paypload with a filter on a journey
<code>{"from":0,"size":100,"filter":{"fquery":{"query":{"query_string":{"query":"(definitionId:74d00b19-f28f-4533-abb2-xxxxxxxxxxxx) AND (transactionTime:[2017-08-29T13:20:45.101Z TO *])"}}}}}
</code>
I suggest you use google developer tools (in Network tab) or any other monitoring tool to monitor the network traffic within the History tab of Journey Builder and learn more about this endpoint especially how to perform complex queries.
Please note that this is not officially available for use as it is not documented in the official documentation
[EDIT - 11/10/2017]
You can now also use Journey Builder Data Views to retrieve Journey activity.
[EDIT - 31/12/2021]
You can use POST /interaction/v1/interactions/journeyhistory/search or
POST /interaction/v1/interactions/journeyhistory/filter or POST /interaction/v1/interactions/journeyhistory/download endpoints.
For more information you can find all available endpoints by looking into the discovery endpoint GET /interaction/v1/rest
Comment: I don't think the JB data views gets to the same granularity as the history tab. For instance, I don't see a date/time field for when a contact hit a particular activity.
Comment: @zeljazouli is it possible to get the values from the interaction? For example: _source:
activityId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
activityName: "Update Contact Activity"
activityType: "SALESCLOUDACTIVITY"
contactKey: "003E000001xxxxxxxx"
definitionId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
definitionName: "Marketing Cloud Retirees"
eventId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
eventName: "Marketing Cloud Retirees"
id: "60261146"
message: ""
mid: 1234567
status: "Complete"
transactionTime: 1543234694677
Comment: @zeljazouli
Is this currently available ?
I'm getting response as Service not available.
Comment: @author243 please check my updated response!
Answer: Unfortunately, this isn't possible at this time. The only workaround would be to add Update Contact Activities preceding each Activity, which update Data Extension fields so you can to determine what step the Contact is at within a running Journey. For example, create a Data Extension with the following fields:

Contact Key (string)
Email Activity 1 (boolean)
Email Activity 2 (boolean)
Decision Split (boolean)
etc...
Comment: Note this is would update the DE only. Any subscriber that re-enters the journey and follows a different path you would lose visibility on paths previously followed in that DE.


What problems can arise with placing stepping stones/pavers directly on to soil?

Question: There's varying opinion on how to install stepping stones onto soil with some recommending sharp sand as a base, others recommending 'bedding' them to the soil using cement. What problems, if any, are there with laying the stepping stones directly onto a good compacted soil underneath?
Comment: Are they in a lawn?
Answer: I have found that the deciding factor is the size of the stones.  Small stones can shift off level or be pushed up with the spring thaw in colder climates. Big stones don't move around so much.
The other reason to use sand is to provide a less attractive place for tough plants to grow. It was a surprise to me to see horsetails (equisetum) apparently grow under and across two feet slabs of limestone and pop up on the other side.  Common milkweed is equally capable of traversing long distances. Anything you can do such as a bedding layer of sand to make it drier and less attractive for weeds is a win.
Answer: It depends on the soil. I have done in two different location , but both soils were very sandy. Looked good in place one after 7 years. In the second location much longer ; pathways disappeared under spreading grass and weeds after 15 years. I should have cleared the path with a weed-eater a couple times a year.  The flagstone pieces typically had a major axis of 24 " and were 2" thick ; very little freeze -thaw , maybe once per year. In a covered location ( garden shed/green house) , bricks laid on the sandy soil are still fine after 20 years. So a couple data points for one soil type.


What games have good treatments of sub-Saharan Africa, or fantasy analogues?

Question: I'm aware of Atlas Games' Nyambe, and I read the Kindred of the Ebony Kingdom sourcebook that White Wolf released for Vampire some years back. Which other books treat the area well, or at least as a good setting for adventures?
Answer: There's a new supplement from Paizo for the Mwangi Expanse, the Africa of Golarion, called "Heart of the Jungle" in support of their new Mwangi-based Pathfinder adventure path, Serpent's Skull.  I'm using it and Nyambe to do some African adventuring of my own.
Answer: Well, there's the Dark Continent: Adventure & Exploration in Darkest Africa rpg; however, I'm not sure that it's still in print. Chaosium used to sell copies of this game through their online store, but I'm not sure they still have any -- this may have become a collectible item. The tone of the game may not suit your purposes: it's firmly a pulp-era "big white hunter" colonial exploration/exploitation type of setting, with the focus on exploring the "dark continent". It is sub-Saharan in focus, though, and might have setting material you could use.
Notice, also, that RPGGeek has a geek-list that covers this question (although it doesn't ask for good treatments, just asks for games that have an African theme.
Answer: Aesheba: Greek Africa, is a good 80s supplement by Frank Mentzer and Bob Blake, dealing with a generic African-type continent that can be placed in any RPG world.  There are many Egyptian and Greek type civilizations on this "lost" continent, new monsters, spells, etc and as a setting it can give plenty of good ideas.
This might not be exactly what you are looking for because this is an Africa where Greek explorers have made their mark on the continent by colonizing several northern stretches; however african style "lost" cities and civilizations dot the inner continent (which is more of a fantasy style Africa since there is no Nile river here so races can easily spread throughout the continent). The material does focus more on the "explorers" point of view than any native peoples, but you might be able to salvage a few good ideas from the book and I notice it doesn't seem to ever sell for very much on the secondary market (making it cheap to pick up).
I run an "African Style" campaign and some of the best inspiration I have come across are in real-life histories of the region.  Here are a few books I read and recommend for some insight into real-life African history, which can be used to set up your own jungle/african like setting:
The Scramble for Africa (Deals with the conquest and exploitation of the continent in the late 19th century through early 20th century);
Travels in the Interior of Africa by Mungo Park (the first white explorer to penetrate the interior and map the Niger river, very interesting);
Africa: A Biography of the Continent (perhaps a bit too real life and topical for some, still very informative)
Comment: I hear you, Badmike. But your description says that the civilizations detailed therein are "Egyptian and Greek type," and that's not what I'm after. I'm looking for something more like the Mali, or the city of Timbouktu, or Great Zimbabwe. How does Aesheba measure up there?
Comment: The OP specifies Sub-Saharan Africa.
Answer: Nyambe for D&D3.X is pan-african, but ignoring the Copts and Greeks (Egyptians both...)
South of the Sun for Ars Magica is a setting book for Africa of legend; it's not realistic at all, and focuses on an odd mix of pagan egypt and Prester John's Christian Kingdom in the South.
Both are, as far as I know, out of print.
Answer: Spears of the Dawn is a promising candidate. I've read the Beta Version that was released to Kickstarter backers (it's been fully funded and then some), and it appears to meet all my qualifications.
Answer: It's rather specific as well as set in the 1920s, but the CoC sourcebook Secrets of Kenya probably has some good hooks for adventures (I don't own a copy, so can't comment directly). You can see a preview of the content (first 14pp) here
Answer: There's a supplement for Ars Magica called South of the Sun that deals with Prester John and "...a medieval vision of Mythic Africa".
I always enjoyed Ars Magica - I have the three latest editions on my shelf. But I never picked up this particular book.
Edit - Whoops! Didn't see Aramis' post about this book above until after I had finished it!
Answer: Punaiset hiekat - Somalia roolipeleissä treats Somalia in a system-neutral manner, in Finnish. It discusses several different genres of play. More information (in Finnish) over here. In particular, there are example scenarios and discussion of Somalia as an adventure setting, as well as discussion of the culture. The author has researched the setting deeply and gives a good view of the cultural setting, which is quite interesting.
Answer: I think that Conan RPG is also providing a good low fantasy African themed RPG. As you can see the world map is quite looking like Africa:

Some supplements of this game should be more suited to what you are looking for, like this one:tales_of_the_black_kingdoms
Comment: Hi, Guillaume, and welcome to the site. It certainly looks like Africa, but I'm guessing that Howard's world is drawn mainly from his Conan fiction of the time, which doesn't really provide a good view of the continent or its myths. Do you know if Mongoose has done anything specific to counter that?
Comment: Hello Jadasc. To tell the truth I've never played a game on this universe. I've just overlooked to the main book and some supplements on some game shop shelves. I'm not either a good source for Howard's work :) My brain just ring a bell when I was reading the title of the post (for the fantasy analog part !)
Comment: The Hyperboria of Conan, despite superficial similarities of map and of ethnic names, really isn't african in flavor.


no display in ubuntu after it goes to sleep or monitor lid closed

Question: I have Ubuntu 20.04 installed on my HP Pavilion G series laptop. I have a problem that whenever I close lid of my laptop or laptop goes to sleep, there is no display after lid is reopened or keys are pressed to wake up the laptop.

I tried reinstalling the OS but the problem is still there as it is.

i also tried following steps from this guide 18.04 Screen remains blank after wake up from suspend . It didnt worked too
$ sudo gedit /etc/default/grub
Then adding nouveau.modeset=0 to the line that says GRUB_CMDLINE_LINUX.
GRUB_CMDLINE_LINUX="nouveau.modeset=0"$ sudo update-grub
reboot

When I execute systemctl suspend the LED goes to sleep but no display appears when I press any key.

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Seymour [Radeon HD 6400M/7400M Series]

can anyone help ???
Answer: Check the settings of variable HandleLidSwitch in /etc/systemd/logind.conf, your options are:

lock
ignore
poweroff
hibernate

Once you set it to your desired behaviour you need to restart the service:
systemctl restart systemd-logind.service


Who is the culprit of all this Prapancha when I was, is and shall continue to be ONE?

Question: Who was responsible or what was responsible for making me forget who I am? How did this Universe start when there were no two? How did I separate myself from myself and create this Prapancha?
Comment: This reality is Brahman which means "one that expands". So, at one point there was nothing in the beginning but single Self, hence the universe/Brahman expanded from inside to outside.
                                                                                "In the beginning this was Self alone, in the shape of a person (puruṣa). He looking around saw nothing but his Self (Atman). He first said, "This is I", therefore he became I by name."
—Brihadaranyaka Upanishad 1.4.1
Comment: Therefore crux of Yoga and Vedanta is to understand inside, the real seer. All the outside(senses and matter) is created to point inside. You did not forget it, you are ignoring it because of addiction to temporary sensual pleasures.  https://en.wikipedia.org/wiki/Tree_of_Jiva_and_Atman

Renounce every temporary thing through Neti-Neti(not this, not this) and you will find yourself. Bhagavad Gita 9.4 This entire cosmic manifestation is pervaded by Me in My unmanifest form. All living beings dwell in Me, but I do not dwell in them.
Comment: Did it start/ Is there zero reality to Prapancha?
Comment: Bacteria, in maya Lokas, 99% of beings are bacteria, evil spirits who imposterise people in your memory.
Answer: From own experience, Black magic, Bacteria, in maya Lokas, 99% of beings are bacteria, microbes, evil spirits who can spaceshift, appear anywhere, they can even mess your memories, create false memories, as well as dreams get registered as such, do anything they want, imposterise people in your memory, although their faces might look little or very different, when you become racially pure, void of any impure bacteria, microbe etc inside body, dna, you realise that you're soul, brahman, and not that egoistic greedy selfish leecher bacteria, which after eating food you feed to it, thinking you're feeding your stomach, while in reality those bacteria eat it, even biology states that indirectly, biology is about bacteria, projected as good, villain vs Jewish Allopathy itself presented as hero, just like all Jewish institutions trying to pretend to solve problems, present themselves as good, while they themselves have created deliberately problems in first place secretly, give delusion of hunger, tiredness, per their whims, sends back waste, thoughts are bacteria making, activate brain areas fire randomly, very similar to Parallel UNIVERSE, Here are some signs of parallel universes, someone you know won't wear clothes they always used to wear before(those clothes might not even exist in parallel universe), some place you always used to visit earlier (imprint from that universe) closed down abruptly after your last visit. Unless you're turiya, you might be constantly shifting between parallel universes, sleeping, then waking up is gateway to travel to other universes, As well as negative things like butterfly effect, happen, for example when I was black magicED that year bloody Obama became president of US, Maya loka is equal to dream or virtual reality, and after I started to break out this maya, in 2016,trump righteously became president, as well as before observation, a thing can coexist in all possible states, there's uncertainty to know for sure what's real, what's not, but only when observed it becomes fixed on one, , based on our chakra, Karma, but one where you don't have control on events, anything or anyone. Our consciousness and its contents make our reality, If you close your eyes while doing any yoga, sadhana, nadi shuddi, etc, attain turiya, then you come back to brahmaloka(similar to travelling beyond black hole event horizon, ending up in another universe, that's how you get dreams as well), the only real universe, if you don't close your eyes, dimension won't shift, even if you attain turiya. Chakras are black hole/wormhole like entrances to other dimensions(Lokas). As well as different people live in different realities, Lokas. There's no thing as objective experience or truth, because everything is relative to the observer, Seer, experiencing.
Comment: I think it is better to give para breaks occasionally for increasing the readability.   Further,  this site requires quoting of references.  Please check. @Aoi.T_015
Comment: reference? Bacteria theory is something new to me.
Comment: What did I just read


Why do on-line parsers seem to stop at regexps?

Question: I've been wondering for long why there doesn't seem to be any parsers for, say, BNF, that behave like regexps in various libraries.
Sure, there's things like ANTLR, Yacc and many others that generate code which, in turn, can parse a CFG, but there doesn't seem to be a library that can do that without the intermediate step.
I'm interested in writing a Packrat parser, to boot all those nested-parenthesis-quirks associated with regexps (and, perhaps even more so, for the sport of it), but somehow I have this feeling that I'm just walking into another halting problem -like class of swamps.
Is there a technical/theoretical limitation for these parsers, or am I just missing something?
Answer: I think it's more of a cultural thing. The use of context-free grammars is mostly confined to compilers, which typically have code associated with each production rule. In some languages, it's easier to output code than to simulate callbacks. In others, you'll see parser libraries: parser combinators in Haskell, for example. On the other hand, regular expressions see wide use in tools like grep, where it's inconvenient to run the C compiler every time the user gives a new regular expression.
Answer: Boost.Spirit looks like what you are after.
If you are looking to make your own, I've used BNFC for my latest compiler project and it provides the grammar used in its own implementation. This might be a good starting point...
Comment: As I said in my answer, Boost.Spirit works but is mainly meant for static grammars. Thanks for mentioning BNFC though, I might use that for my compiler now. It looks really great!
Answer: There isn't and technical/theoretical limitation lurking in the shadows. I can't say why they aren't more popular, but I know of at least one library that provides this sort of "on-line" parsing that you seek.
SimpleParse is a python library that lets you simply paste your hairy EBNF grammar into your program and use it to parse things right away, no itermediate steps.  I've used it for several projects where I wanted a custom input language but really didn't want to commit to any formal build process.
Here's a tiny example off the top of my head:
decl = r"""
    root := expr
    expr := term, ("|", term)*
    term := factor+
    factor := ("(" expr ")") / [a-z]
"""
parser = Parser(decl)
success, trees, next = parser.parse("(a(b|def)|c)def")

The parser combinator libraries for Haskell and Scala also let your express your the grammar for your parser in the same chunk of code that uses it.  However you can't, say, let the user type in a grammar at runtime (which might only be of interest to people making software to help people understand grammars anyway).
Answer: Pyparsing (http://pyparsing.wikispaces.com) has built-in support for packrat parsing and it is pure Python, so you can see the actual implementation.
Comment: Pyparsing is no longer hosted on wikispaces.com. Go to https://github.com/pyparsing/pyparsing
Answer: Because full-blown context-free grammars are confusing enough as they are without some cryptically dense and incomprehensible syntax to make them even more confusing?
It's hard to know what you're asking. Are you trying to create something like a regular expression, but for context-free grammars? Like, using $var =~ /expr = expr + expr/ (in Perl) and having that match "1 + 1" or "1 + 1 + 1" or "1 + 1 + 1 + 1 + 1 + ..."? I think one of the limitations of this is going to be syntax: Having more than about three rules is going to make your "grammar-expression" even more unreadable than any modern-day regular expression.
Comment: It seems like you are arguing the (yet unspecified) implementation, than the ability of parsing a CFG in itself? Sure, regular expressions are cryptic to the untrained eye. Perhaps, a context free language could be even more cryptic. But that wasn't the point. The point was, why are there only code generators, and not stuff I can just put into a function/object and get matched blocks of text out of them, like I do with today's regular expressions.?
Comment: Usually, when people use a parser, they're looking to do a whole lot more than just look at some text and see if it matches their grammar or not. Not that there's anything wrong with that, but most parsers do quite a bit more.
Comment: Plus, the implementation is a technical limitation you are going to have to deal with at some point, and you did ask about technical/theoretical limitations.
Answer: Side effect are the only thing I see thing that will get you. Most of the parser generators include embedded code for processing and you would need an eval to make that work.
One way around that would be to name actions and then make an "action" function that takes the name of the action to do and the args to do it with.
Answer: You could theoretically do it with Boost Spirit in C++, but it is mainly made for static grammars. I think the reason this is not common is that CFGs are not as commonly used as regexs. I've never had to use a grammar except for compiler construction, but I have used regexs many times. CFGs are generally much more complex than regexs, so it makes sense to generate code statically with a tool like YACC or ANTLR.
Comment: I would agree that the use of regular expressions are more common than what seems to be today's demand for CFG:s. But, since I've encountered a numerous questions on getting a correctly nested set pf parentheses on Stack Overflow alone, I'm sure that there is _some_ use of CFG:s. Maybe they aren't being asked for, because people know only of regexps?
Comment: IIRC Boost::Spirit is a pure compile time implementation. I can't see any reason for it to allow run time definition of grammars.
Comment: Boost Spirit can be used at runtime - just shift tokens onto the end of the grammar:

grammar = grammar >> ch_p('a');
Answer: tcllib has something like that, if you can put up with Parse Expression Grammars and also TCL.  If Perl is your thing CPAN has Parse::Earley.  Here's a pure Perl variation which looks promising.  PLY seems to be a plausible solution for Python


Calculating CCA "scores" by hand in R

Question: I'm trying to compute "by hand" the output of some popular Canonical Correlation Analysis functions in R, in order to be sure I understand the underlying math.
I can produce the "canonical coefficients" that can be used to transform the original variables to the "scores" that make up the canonical variates.
But I am struggling to actually compute the same scores that the popular R functions produce:
cancor() (base R)
cc() (lib cca)
cca() (lib yacca)
The ?help documentation is a little light for the functions above, in terms of not being specific about how scores are calculated.  ?cca has the most detailed explanation, but it does not elaborate about how "standardized coefficients" are calculated as an intermediate step to computing the scores.
The raw canonical coefficients output for these functions are accessed via "..\$xcoef" and "..\$ycoef" (to get the canonical coeffs for the "x" and "y" variables, respectively).
The "xcoef" and "ycoef" output for the 3 functions is not identical for a given dataset, but the difference is just a constant in each column (so the output is the same besides a scaling difference).
I can produce raw coeff output by hand that is consistent with these R functions, by pulling out the eigenvectors of the appropriate Covariance Matrix.
My understanding is that taking the eigenvectors of the two matrices below is correct, and that this is one of several formulas out there that should work:
$$
C_x =  C_{xx}^{-1}C_{xy}C_{yy}^{-1}C_{yx}
$$
$$
C_y =  C_{yy}^{-1}C_{yx}C_{xx}^{-1}C_{xy}
$$
Where
$C_x$ is the canonical covariance matrix for the X variables, from which we pull the eigenvalues and eigenvectors for CCA.
$C_y$ is the canonical covariance matrix of the Y variables, from which we pull the eigenvalues and eigenvectors for CCA.
$C_{xx}$ is the covariance matrix of the X variables
$C_{yy}$ is the covariance matrix of the Y variables
$C_{xy}$ is the covariance matrix of the X and Y variables
$C_{yx}$ is the covariance matrix of the Y and X variables
Below I take the familiar Iris dataset to create a simple example to do by hand and compare to what the 3 R functions produce:
library(CCA)
library(yacca)

data(iris)
head(iris)

irisNum = iris[, 1:4] ## strip out species data
X = iris[, 1:2] ## Sepal variables
Y = iris[, 3:4] ## Petal variables

totalCov = cov(irisNum)
Cxx = totalCov[1:2, 1:2]
Cyy = totalCov[3:4, 3:4]
Cxy = totalCov[1:2, 3:4]
Cyx = totalCov[3:4, 1:2]
CxxInv = solve(Cxx)
CyyInv = solve(Cyy)

Cx = CxxInv %*% Cxy %*% CyyInv %*% Cyx
Cy = CyyInv %*% Cyx %*% CxxInv %*% Cxy

vX = eigen(Cx)$vectors  ## my raw coefficient matrix for X variables
vY = eigen(Cy)$vectors  ## my raw coefficient matrix for Y variables

c1 = cancor(X, Y)  ## base R function
c2 = cc(X, Y)      ## lib CCA
c3 = cca(X, Y)     ## lib yacca

## R functions all produce canonical coeffs that only differ by a scalar multiple:

c1$xcoef / c2$xcoef
##                    [,1]       [,2]
## Sepal.Length 0.08192319 0.08192319
## Sepal.Width  0.08192319 0.08192319

c2$xcoef / c3$xcoef
##              [,1] [,2]
## Sepal.Length   -1    1
## Sepal.Width    -1    1

## and my raw coefficient matrix also only differs from them by a scalar multiple:
c2$xcoef/vX
##                   [,1]     [,2]
## Sepal.Length -1.368843 2.223195
## Sepal.Width  -1.368843 2.223195

c2$ycoef/vY
##                   [,1]    [,2]
## Petal.Length -1.096528 5.17813
## Petal.Width  -1.096528 5.17813

So getting raw coefficients is fine.  But now I don't know how to use them to reproduce the scores that come out of the cc() and cca() functions (note the cancor() function does not produce scores):
## X variable scores using cc()
head(c2$scores[[1]])
##           [,1]       [,2]
## [1,] 1.1730856  0.5191447
## [2,] 0.9593861 -0.6699407
## [3,] 1.3441807 -0.3566336
## [4,] 1.3655796 -0.6292350
## [5,] 1.3654828  0.6757983
## [6,] 1.1943878  1.5515766

## X variable scores using cca()
head(c3$canvarx) ## differs from cc() output only in sign
##            CV 1       CV 2
## [1,] -1.1730856  0.5191447
## [2,] -0.9593861 -0.6699407
## [3,] -1.3441807 -0.3566336
## [4,] -1.3655796 -0.6292350
## [5,] -1.3654828  0.6757983
## [6,] -1.1943878  1.5515766

I believe from looking at the R ?cca documentation that to get the scores that are coming out of that function's output I have to multiply my original matrix of variables by a matrix of canonical coefficients, but instead of using the raw coefficients I calculated above, I need to standardize them first...I am unsure how to do this properly.  Also, I'm unsure if I need to standardize my original matrix of variables first before transforming them with the matrix of standardized coefficients.
Answer: You can always explore the code of the functions by just using yacca::cca or base::cancor, cca::cc.
To calculate the scores you need to apply the loadings to the original points (if they weren't scaled) by using a matrix multiplication. It hey were scales, use then you need to subtract from the original values the mean, this will be your centered values.

Calculating CCA "scores" by hand in R


Logistic Regression Odd Ratio

Question: I am doing logistic regression in R on a binary dependent variable with only one independent variable. I found the odd ratio as 0.99 for an outcomes. This can be shown in following. Odds ratio is defined as, $ratio.odds(H) = \frac{P(X=H)}{1-P(X=H)}$. As given earlier $ratio.odds(H) = 0.99$ which implies that $P(X=H) = 0.497$ which is close to 50% probability. This implies that the probability for having a H cases or non H cases 50% under the given condition of independent variable. This does not seem realistic from the dataset as only ~20% are found as H cases. Please give clarifications and proper explanations of this kind of cases in logistic regression. What should I do further to solve this question?
Comment: I'm not sure your interpretation of the odds ratio is correct. You show an *odds*, an odds ratio is the ratio of two odds.
Comment: Is there any chance you could post your output from R?
Comment: Thanks Kontorous,                                                                                I am hereby adding model summary and OR calculation.
Comment: glm(formula = H ~ X, family = binomial(), data = data)
Deviance Residuals:
    Min       1Q   Median       3Q      Max
-1.8563   0.6310   0.6790   0.7039   0.7608
Coefficients:
                            Estimate      Std. Error      z value     Pr(>|z|)
(Intercept)    1.6416666    0.2290133     7.168      7.59e-13 ***
   X                   -0.0014039   0.0009466    -1.483      0.138
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)
    Null deviance: 1101.1  on 1070  degrees of freedom
Comment: Null deviance: 1101.1  on 1070  degrees of freedom
Residual deviance: 1098.9  on 1069  degrees of freedom
  (667 observations deleted due to missingness)
AIC: 1102.9
Number of Fisher Scoring iterations:4
Answer: It seems like your interpretation of odds ratio (OR) is not correct $\frac{P(H = 1 | X)}{1 - P(H = 1 | X)} = \frac{P(H = 1 | X)}{P(H = 0 | X)}$ is an odd [$odds(X)$] not an odd ratio.
The odds ratio would be $\frac{odds(X)}{odds(X')}$ where $X'$ is a new set of values for your predictors. It is impractical to have several predictors change values at the same time so the odds ratio is most often defined for $X'$ differing from $X$ by only one of its elements (if you see $X$ as a vector of values/predictors).
Consider the following logistic model :
$log (\frac{P(H = 1 | X)}{P(H = 0 | X)}) = \beta_0 + \beta_1x_1 +\beta_2x_2$
Then the OR of that model in regards to the variable $x_1$ would be $OR(x_1) = \frac{\frac{P(H = 1 | x_1 + 1, x_2)}{1 - P(H = 1 | x_1 + 1, x_2)}}{\frac{P(H = 1 | x_1, x_2)}{1 - P(H = 1 | x_1, x_2)}}$
You can see that $x_1$ takes two different values but every other variables stay the same. And because $x_1$ only increased by one you have the special case (actually the most common case when people are computing OR) where your OR is directly linked to your estimated parameters.
$OR(x_1) = \frac{e^{\beta_0 + \beta_1(x_1 + 1) +\beta_2x_2}}{e^{\beta_0 + \beta_1x_1 +\beta_2x_2}}$ which simplifies into $OR(x_1) = e^{\beta1}$.
That is true with all parameters of your model.
So what $OR(x) = 0.99$ actually means is that for each 1 unit increase of $x$, everything else being kept the same, your odds is multiplied by $0.99$ ($e^{\beta1}$). So $0.99* odds(x) = odds(x + 1)$ which implies that $odds(x) > odds(x + 1)$ thus meaning that high values of $x$ are more prone to be met for $H = 0$.
Hopes it helps,
Comment: Nicolas, Thanks a lot! As i can understand from your answer that higher value of concerned covariate i.e the only independent variable that i am considering are more effective to reduce the probability of p(H=1). That is probability of occurrence of H adversely effected at higher values of x??
Comment: That's right, an odds ratio is always computed in regards to a specific independent variable of the model (here you only have one). It is not as straightforward as the probability of H = 1 but rather as the increase of that probability (here it looks like it is a slight decrease, as X is growing P[H = 1] slowly decreases as odds(X -1) < odds(X). This is confirmed by your other comment where it is shown that the beta coefficient for X is negative, giving an hint that your sigmoid curve is decreasing over X.
Comment: Thanks Nicolas! But, what should i say regarding the "This does not seem realistic from the dataset as only ~20% are found as H cases" in the question? How to explain this?
Comment: This is not related to your OR, the way you derived P(H = 1| X) from your OR is not correct so the result you got is not as well ! And even though you compute for some individuals P(H = 1| X) > 0.2 that is totally normal as you are conditionning H on X ! That is you are computing "Given the profile X how sure am I that the response should be H = 1. It is unrelated to your fraction of obsrevations with H = 1 ?". It is a whole other issue and is more broadly related to how logistic regression works so it should have its own thread I think
Answer: Odds Ratios can be tricky to interpret sometimes, and I could try and explain it to you but I think this link would do the explanation better justice that I would: How do I interpret odds ratios in logistic regression?
As for the probability (which I am assuming you obtained through your log odds ratio), I think you need to delve into your data to see why you're seeing such a peak, it is most likely related to that. And also, you could calculate the change in log odds and change in odds for your independent variable to help you understand the changes per unit increase (also explained in the link above).
Hope that helps!

Logistic Regression Odd Ratio


Can I connect 2 sets of speakers to a Mackie Mix 5?

Question: I have a Mackie Mix 5 mixer. I was going to connect the Main Outs to powered EV PA speakers. Can I connect the Tape Out to powered monitor speakers?
Comment: Yes. Not much more to say really.
Answer: From the Manual:

Main Out: These 1/4" TRS balanced/unbalanced outputs feed the main mix
  out into the world. You may feed the amplifiers or powered speakers
  this way.
Tape out: Unbalanced RCA connections tap the main mix output to make
  simultaneous recording and PA work more convenient. Connect these to
  your laptop or standalone recorder's inputs.

Since the tape out is unbalanced i would keep the cables as short as possible.
The Mix 8 has a CR out, or control room out that would also work for this purpose..


Create a column in one attribute table based on a column in another attribute

Question: In QGIS, I have a river shapefile that does not include the basin that is in. I have a separate shapefile that does. Is there a way to get that river shapefile to have a new column of basin data in the attribute table based on the separate shapefile's basin? The data in the separate shapefile may not have the same length as the shapefile in the river shapefile and the only way to link the two shapefiles is based on geographic location.
Answer: A spatial join is the action you are looking to perform.
In QGIS this can be performed by using 'Join attributes by location' under Processing > Vector General
Answer: If your river shapefile doesn't "end" at the basin-border, you may try intersect. This divides a shapefile by another and attaches all/chosen attributes of the second shapefile to the first, divided one.


Difference between ketone rings in wavelength using an IR device

Question: It is said that the smaller the ring size, the greater the wavelength of the carbonyl group, but why does cyclobutanone have a higher wavelength than cyclopropanone?
Answer:
Why does cyclobutanone have a higher wavelength than cyclopropanone?

Seemingly, you were informed wrong. According to MSU website, following wave numbers listed for different cyclic ketones:

The increase in frequency ranges from $30$ to $\pu{45 cm-1}$ for a 5-membered ring, to $50$ to $\pu{60 cm-1}$ for a 4-membered ring, and nearly $\pu{130 cm-1}$ for a 3-membered ring. According to this, the increase in stretching frequency of exo-carbonyl group is because small rings have more $\mathrm{p}$-character in their ring bonds, which means the bonds outside the ring (exo-bonds) have more $\mathrm{s}$-character and are stronger.

Edit: There is a relation between stretching frequency and corresponding wavelengths:
$$
\begin{array}{|c|c|}
\hline
\text{Stretching frequency, }\pu{cm-1} & \text{corresponding wavelength, }\pu{nm} \\
\hline
1716 & 5820 \\
1748 & 5720 \\
1783 & 5600 \\
1850 & 5400 \\
\hline
\end{array}
$$
Also, you can find this convertor here.
Comment: The questioner seems unsure about wavenumber[frequency] and wavelength


Use group by and limit at the same time in Salesforce report

Question: Good day everyone, I have question about salesforce Report. Suppose I have a product object with field product_name and quantity. Now I want to create a report that will get the total quantity of every product .After that since I have thousands of product, I only want to show top 5 product_name which has the highest quantity.I've tried to used the group by and limit functionality in report, but using it at the same time is not possible. How will i do it please help . Thank you.
Comment: Not sure why you want to use group by clause. Do you have multiple products with same name ? do the quantity of all such products(Same name) needs to be added ?
Comment: You probably want to use the `HAVING` clause
Comment: The above scenario is just an example. As you know, when we create a salesforce report we have to to choose a format like tabular or summary report. Now what i want is to put a limit in my summary report. I think the question is quite clear.
Comment: Now able to get it. Not sure who marked it in negative as this is valid scenario and I think also came across similar issue in past.  Giving my detail analysis below
Answer: Limiting Rows of Summary Report is still not supported in Salesforce.
See this similar Idea on Success Community (Merged with other idea)
You'll have to use Custom logic to achieve this.
For Ex : say Report is grouping Opportunities by Account and you're trying to show  in Report, Top 5 Accounts with maximum number of opportunities
In that scenario, you've use custom logic like trigger(or preferably batch job, if volume is large)
Your custom logic will run each day and find Account with maximum no of opportunities and populate a new 'Custom field' with its ranking.
Then you can include this Custom-field in report filter( e.g. Ranking__c  in  1,2,3,4,5)
Unfortunately, This is the only way I can think of on this.


GNOME Boxes: How can I route through the host's VPN connection from a Windows guest?

Question: I have a Windows 8.1 virtual machine (a www.modern.ie one) running in GNOME Boxes. My host connects to my work network via OpenVPN, and I'd like to access some of the resources from the Windows VM. What do I need to configure to make this work?
Answer: I do use Gnome Boxes as well, running a Win 7 VM. I never had any issues about VPN connections from the VM when the host is connected.
If you have some static routes on OpenVPN, maybe will be necessary to set them up also in the VM.


IE tab for ubuntu

Question: Is there any way to use Firefox IE tab in ubuntu platform. Any other way to test the page how it will shown by IE
Answer: From what I remember, IE tab addon delegates the rendering to IE engine, so I doubt it shall ever be available for ubuntu.
There is, however, an IE for Linux that can be run in wine here.
Other solution is to use a windows virtual machine.
Side note: Microsoft recently released a handfull of VPC images with different versions of windows and ie that can be used licen-free until the end of the year: here. I don't know if VPC images can be run in ubuntu...
Answer: IEtab is not actually am emulator. All it does is opens an instance of IE within Firefox, so it won't work on Mac or Linux unless you have some crazy install of IE for either.
I'd go with Alexey's suggestion. Either install a VM of Windows or RDC to a Windows box.
Good luck.
Comment: The problem with using an actual IE rendering engine is you lose all the awesome dev tools in Firefox/Chrome. I don't really need to know what a page looks like in IE. I already know it'll look horrible. What I need to know is **why** it looks horrible so I can fix it. Unfortunately, IE's dev tools have always and will always suck.
Answer: You could use some online services such as

http://litmusapp.com/
http://www.browserpool.de/kc/wob/portal.jsp?lang=en
http://browsershots.org/

Unfortuantely these are commercial services and carry subscription fees
Or you could setup a virtual machine with windows on it and try it in a native browser. Microsoft do provide XP images with different IE installations but I believe these are only for Virtual PC (which is windows only)

IE tab for ubuntu


How to export multi page pdf into multi page JPEG in preview?

Question: I have a pdf document with 5 pages. I would like to export it in JPEG format (or any image format). But if I hit File->export->export as JPEG, it only saves the first page of the pdf document as a JPEG image. Is it possible to export all of the pages to JPEG format?
Answer: Use macOS Automator to perform a multi-page PDF export into multiple JPG images:

I faced the same challenge. Obviously, macOS Preview will only export one page from the PDF at a time to a JPG image.
I tested the above solution and it worked fine.


How would proving or disproving the Twin Prime Conjecture affect proving or disproving the Riemann Hypothesis if at all?

Question: How would proving or disproving the Twin Prime Conjecture affect proving or disproving the Riemann Hypothesis? What are the connections between both conjectures if any?
Answer: Edit 2: For a more tenuous connection between these two theorems, one person whose name might crop up someday for both (please note I am just speculating here!) is that of Fields Medalist Atle Selberg. His Selberg sieve underlies some of Zhang and his contemporaries' work on the weakened version of the Twin Prime Conjecture (see Edit 1 below); meanwhile, the Selberg trace formula may (this is the speculation part) someday be used in a proof of the Riemann Hypothesis. For these latter connections, you could either look up `The Selberg trace formula and the Riemann zeta function' in google scholar or note that Paul Cohen strongly believed this might be a way to get at RH. Cohen's beliefs are alluded to in the AMS piece on his passing, e.g., by Peter Sarnak, though one must note that Cohen spent much of his post-CH life stagnating on this problem. Anyhow, as for connections between these two works of Selberg: None is apparent to me other than their originator; but perhaps this is fodder for another MSE question.

Edit 1: Note that the most recent progress on a weakened version of the Twin Prime Conjecture made use of the Riemann Hypothesis for varieties over finite fields (see Yitang Zhang's pre-print, available here, p. 6). That is, it made use of the Weil Conjectures; in particular, using methods from Deligne's proof rather than Dwork's (low-level: see here; high-level: see here). For more on YTZ's recent work, see the evolving question/answers on MO here.

A couple quotations from Dan Goldston in this paper:
"While the Riemann Hypothesis is decisive in determining the distribution of primes, it seems to be of little help with regard to twin primes."
"The conjecture that the distribution of twin primes satisfies a Riemann Hypothesis type error term is well supported empirically, but I think this might be a problem that survives the current millennium."
However, the first part of your question is more general, in that you ask about how proving one of these conjectures/hypotheses would affect the other. That is a more nebulous question, because it's hard to predict what sort of machinery will ultimately be developed to resolve these questions.
If this answer sounds like a bit of a downer to you, perhaps there is a silver lining: given two large conjectures that don't really have much bearing on one another, it would/will be interesting to see how the resolution of both could be applied elsewhere. If they were intimately connected, solving one might knock the other one off; with their relation tenuous at best, it ought to take some wonderful mathematics to dispose of both. It remains to be seen what can be done with the machinery resulting from each - I just hope it is seen in our lifetimes!
Comment: Do you know when this paper was published?
Comment: The most recent paper cited there is from 2007, so I suspect thereabout...
Comment: A down vote today? Why tho
Answer: Not too much, I don't belive that Twin PRime suggest much for Riemann (unless its some statistical stuff or basic guarantees).
The Twin Prime Conjecture is really part of a series of other conjectures which looks follows.

Twin Prime: Are there infinite primes with difference 2?
De Polignac: Are there infinite primes with an even difference?
Are there infinite consecutive primes with an even difference? aka CAN EVERY even integer be expressed as the difference between 2 consecutive primes (this is a small step towards solving the GoldBach Conjecture which itself has some statistical effect on Riemann)?
From there the next step is to then determine if every possible arithmetic progression is included in the list of primes (Excluding those that violate certain basic rules ex: 2 2 2, which I belive has been proven)
Then is every valid consecutive arithmetic progression possible (ex: does 2 6 6 6 6 occur an infinite number of times for consecutive prime differences? Nope b/c 2 mod 5 + 6 mod 5 *3 = 0 mod 5 ---> this isn't possible but other subsequences such as 2 4 may be possible instead!)
Comment: Nevertheless there always is the chance that the tools needed to solve Twin Prime could aid greatly in Riemann too!


Good convergence criterion for stochastic optimization?

Question: This is a question that has bothered me quite long, as I have faced it many different optimization and equation solving problems.
The basic idea is that one wishes to minimize $F(x)$ and has one method that produces a sequence $\{x_n\}$ that will converge to a neighborhood of a local minimum. Unfortunately such method is not monotonic, and $\{F(x_n)\}$ converges but is not strictly decreasing. The question is which would be a good quantitative criterion to test convergence based solely on the values of $F(x_n)$.
Examples of this situations are Montecarlo methods, but also some numerical methods for variational approximation of the energy of quantum states, where the "$x_n$" live in a reduced variational subspace. Thus, in the first case the non-monotonicity comes from the stochastic algorithm itself, while in the second case it arises from projecting the gradient into the manyfold in which the variational state lives. In many of these cases the sequences that are produced look as $$F_n = F_{min} + \exp(-n/\xi) + \epsilon_n,$$ where $\xi$ is some unknown convergence time and $\epsilon_n$ is some noise whose magnitude also cannot be known in advance.
Sometimes I have used a simple criterion of stopping the algorithm when $F(x_{n+1}) >= F(x_{n})$, but this has the disadvantadge that quite often the real minimum $F_{min}$ is not reached (due to the fluctuations mentioned before).
Note: I have also tried studying the mobile average of $x_n$, but this is quite often not useful for many situations in which many $x_n$ are valid, such as when there are rotational symmetries or more complex situations, which is why I prefer to focus on studying the value of the optimized function itself.
Note 2: Sometimes one does not seek maxima or minima, but simply convergence of some quantity, which behaves very similarly but now one does not know whether it increases or decreases $$F_n = F_{min} \pm \exp(-n/\xi) + \epsilon_n.$$
Answer: I have no answer based on literature. However, I do have a suggestion that can be useful for inspiration:
Consider the sequence $\{F_n\}$ independently of its context. Use the observed sequence elements to do an on-line estimate for the distribution of $\xi$ and the distribution of each of the $\varepsilon_n$. (Using an i.i.d. model for the $\varepsilon_n$ is an option.) Then use the occurrence of 'some' extreme observation according to the current estimate as a stopping criterion.


Two names on check

Question: so i don't understand the check I got. On the "pay to the order of" section, it writes my school's name. But on the "for" section it writes my name. So can I deposit this check to my bank account. Or do I have to give it my school and than what happens to my money?
Comment: Who gave you the check? What is it for?
Comment: @mkennedy Sounds like an answer to me.
Comment: If the check is intended to cover an expense you owe the school, they will probably credit you with a payment after they cash the check and it clears.
Comment: Most likely, the school can sign the check over to you. That way, they don't have to go through the trouble of cashing the check and then issuing you another check.
Comment: If this is in the US, the FOR line is comment only. You cannot cash or deposit that check.
Comment: Is this check intended to be a payment for tuition or similar? Who did it come from?
Answer: Only the person on the "Pay to the Order" line can deposit the check. The to line doesn't Change anything. It sounds like the check was written with the intention that the school deposits the check, not you.
You will need to get them to sign it over to you, or deposit it and give you the funds.

Two names on check


How can an HT antenna be half wave?

Question: There's a model of HT antenna for the GMRS band by Nagoya (NA-771G) that's specified as a half wave.  How can that be?  An end fed half wave antenna needs a 49:1 impedance transformer to match with the transmitter?  Is it more like a 5/8 or 3/4 wave in reality?
Answer: Judging by looks, it's a half-wave element with an autotransformer at the base. Nagoya says the antenna is 15.3 inches in length. Taking measurements from a photo, the bottom 2 inches is in that fat molded section that clearly contains some kind of coil (the autotransformer), and the remainder is a whip that's around 13" long, which is perfect to be a half-wave at ~460 MHz.
This kind of design is seen reasonably often in handheld and mobile antennas.
Comment: I have a half wave telescoping 2m antenna.  Big fat coil at the bottom.  And a great way to break your SMA off if you're not careful.
Answer: It is worth noting that a vertical end-fed antenna is often used in conjunction with a ground plane that interacts strongly with the antenna to reduce its effective impedance to a value that the transmitter can drive directly, without any loading coil.
So, for example, the four drooping radials surrounding the vertical 1/4 wave "whip" of a 2-meter base station antenna let it match up well with a 52-ohm transmission line.

How can an HT antenna be half wave?


Berkeley DB: How to GET a specific KEY from QUEUE

Question: I am writing some fixed length records to a QUEUE in Berkeley DB, and get back the record number agter each PUT. So for example if I put 4 messages on the queue I am getting back 1, 2, 3, 4.
NOw I would like to retrieve a message from the queue based on it's KEY....
So if I try:
<code>db_recno_t keyval;
DBT key, data;

memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));

keyval = 2;
key.data =  &keyval;
key.ulen = sizeof(keyval);
ret = q->get(q, NULL, &key, &data, DB_CONSUME);
printf("Key peek = %i\n", keyval);
printf("Data peek = %s\n", data.data);
</code>
I keep getting back the first record in the queue, not the one I specify with the key (in this case "2")
I know the keys are 1,2,3,4 on the queue so I am wondering what stupid thing I am doing here?
Thanks for the help, much aprreciated ;-)
Lynton
Answer: Try some other database format than DB_QUEUE if you need random access.


Where am I wrong in this prove of concavity?

Question: I have following function $$f(x_0,x_1)=-x_1Ei(-a-\frac{bx_1}{x_0})\exp(a+\frac{bx_1}{x_0})$$. Where $a,b$ are greater than zero, $x_0,x_1$ can have positive values and $Ei(x)$ is the exponential integral. Now its perspective function is $$f_1(x_0)=-Ei(-a-\frac{b}{x_0})\exp(a+\frac{b}{x_0})$$ If I do following transformation $\frac{1}{t}=a+\frac{b}{x_0}$ then I have $$f_2(t)=-Ei(-\frac{1}{t})\exp(\frac{1}{t})$$ Now $f_2(t)$ is concave with respect to $t$. Based on this I assume that $f_1(x_0)$ is concave with respect to $x_0$. Since $f_1(x_0)$ is the perspective function of $f(x_0,x_1)$ therefore I conclude that $f(x_0,x_1)$ is jointly concave with respect to $(x_0,x_1)$. But when I fix $x_0$ and try to prove the concavity of $f(x_0,x_1)$ with respect to $x_1$ through double derivative test. Then I am unable to prove this. Is the function $f(x_0,x_1)$ not jointly concave because if it were then it should be concave with respect to $x_1$ also. Any help in this regard will be much appreciated. Thanks in advance.
Answer: \begin{align}f_1(x_0)&=-Ei(-a-\frac{b}{x_0})\exp(a+\frac{b}{x_0})\\
&=-Ei\left(\color{red}- \frac1t\right) \exp\left(\frac1t\right)\end{align}
Comment: I haven't verified, but do you have a proof that if $g(t)$ is concave in $t$, then by a transformation of $\frac1t=a+\frac{b}{x_0}$, the function is concave in $x_0$?
Comment: Suppose $f_2(t)=-t$, it is a concave function, but $h(x) = f_2 \left( \frac{x}{x+1} \right) = -\frac{x}{x+1}$ is not a concave function in $x$.
Comment: I am extremely sorry. It was my typing mistake (I have corrected it, Do you agree that the transformation used in my post is right). It is actually, as you mentioned, a negative sign. So $-Ei(-\frac{1}{t})\exp(\frac{1}{t})$ is a concave function. Since $f_1(x_0)=f_2(t)$ so $f_1(x_0)$ is also concave and therefore $f(x_0,x_1)$ should be concave with respect to $x_1$ also. But I am unable to prove it through double derivative test.
Comment: I am curious about my transformation $\frac{1}{t}=a+\frac{b}{x_0}$. Do you think it is right transformation?
Comment: No I do not have a proof. That's why I asked this question. But I describe my understanding below. With $\frac{1}{t}=a+\frac{b}{x_0}$ we have $t=\frac{x_0}{ax_0+b}$ therefore for the range of $x_0$ (from $0\to \infty$) the range of $t$ is $0 \to \frac{1}{a}$ and each individual value of $x_0$ produces a unique value of $t$. Since the function $f_2(t)$ is concave overall values of $t$ (which I can prove) therefore I think it is also concave over $0<t<\frac{1}{a}$ (Please correct me if I am wrong in this). Thanks in advance.
Comment: Thank you very much for clarifying with an example


cannot access memory at address 0X1 after setting up gdb and eclipse to debug shared library from Android Application

Question: I have two Android Projects: one is a library and the other a regular application using this library. My aim is to debug the shared library from the android application. I followed this guide:
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
And I commented out the the last line
##$GDBCLIENT -x `native_path $GDBSETUP`

But the following line
##cp -f $GDBSETUP_INIT $GDBSETUP

complains with the message:
it cannot stat ./libs/armeabi-v7a/gdb.setup
so I commented it out since I think Eclipse will uploaded it for me. Besides that I made sure that:

In both Android.mk I put LOCAL_CFLAGS := -Wall –g
I am getting the .so in the libs library of the application
I made debuggable true in the application
The gdb2.setup path modified in order to refer both to the .so using solib-search-path ./libs/armeabi-v7a/ and the source is get referenced using directory

After stepping in the System.LoadLibrary instruction I executed the ndk-build-eclipse
and no errors were produced and when I started debugging natively I got:

Cannot access memory at address 0x1

and on Cygwin I got:

Remote debugging from host 0.0.0.0

Here's the output of running the ndk-gdb-eclipse command:
$ ./ndk-gdb-eclipse --adb=/cygdrive/c/Utilities/adt-bundle-windows/adt-bundle-windows/sdk/platform-tools/adb --project=/cygdrive/c/Projects/IDSmart/IDSmartApp/IDSmart  --force --port=5039 --verbose
Android NDK installation path: /cygdrive/c/Utilities/android-ndk-r8c-windows/android-ndk-r8c/.
Using specific adb command: /cygdrive/c/Utilities/adt-bundle-windows/adt-bundle-windows/sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using specified project path: /cygdrive/c/Projects/IDSmart/IDSmartApp/IDSmart
Found package name: uk.co.idscan.idsmart
ABIs targetted by application: armeabi-v7a
Device API Level: 15
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi-v7a
Using gdb setup init: ./libs/armeabi-v7a/gdb.setup
Using toolchain prefix: /cygdrive/c/Utilities/android-ndk-r8c-windows/android-ndk-r8c/./toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi-v7a
Found debuggable flag: true
Found device gdbserver: /data/data/uk.co.idscan.idsmart/lib/gdbserver
Found data directory: '/data/data/uk.co.idscan.idsmart'
Found running PID: 7922
7922
Killing existing debugging session
## COMMAND: adb_cmd shell kill -9 7864
/system/bin/sh: kill: 7864: Operation not permitted
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd shell run-as uk.co.idscan.idsmart lib/gdbserver +debug-socket --attach 7922
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/uk.co.idscan.idsmart/debug-socket
Attached; pid = 7922
Listening on Unix socket debug-socket
## COMMAND: adb_cmd pull /system/bin/app_process obj/local/armeabi-v7a/app_process
1373 KB/s (9848 bytes in 0.007s)
Pulled app_process from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker obj/local/armeabi-v7a/linker
2147 KB/s (39592 bytes in 0.018s)
Pulled linker from device/emulator.
## COMMAND: adb_cmd pull /system/lib/libc.so obj/local/armeabi-v7a/libc.so
2576 KB/s (282316 bytes in 0.107s)
Pulled libc.so from device/emulator.

Answer: Cannot access memory at address 0x1

Post your gdb2.setup file, the same one that you are using in eclipse.
Typically, these cannot access memory are due to solib-search-path being incorrect. Try entering absolute path to your project lib folder in your gdb2.setup file. For example, I have it set as:
set solib-search-path D:/android/android-ndk-r8d/samples/hello-jni/obj/local/armeabi

Let me know if it help.
Comment: Had the issue but found that the my gdb.setup has: set solib-search-path ./obj/local/arm64-v8a which contains the .so that I need the symbols from. Does it have to use abs path here?


Automated Development of Presentation with Interactivity

Question: I am trying to identify the right tool, language, software package, or other for the automated development of presentations, where the presentation is user interactive.
The presentation will consist of images with titles and some descriptive text. Most of the time there will be 35–70 images. I would like to show each image on a separate page, slide, tab, etc. (I guess proper terminology depends on the solution.)
The images will change, but the titles will remain the same, and there will be a little bit of change to the description of each image.
After putting the presentation together, I would like the user to be able to circle and "write" on the electronic image in kind of the wax pencil sense (I previously worked in a photo lab and we worked with wax pencils on negatives all the time and would like to have kind of a similar flexibility).  Moreover, I would like users to be able to add comments as well, kind of in the way Adobe PDF Professional allows, e.g. inserting bubble comments, etc.
Most importantly, I would like to be able to do this in an automated way. Right now we are using PowerPoint, but the amount of time it is taking to put an image on a slide in PowerPoint, resize it, and then set up the text is killing us. Plus, as the images change it takes tons of time to go back and update them. Thus, we would like something that is a bit faster to update images and get the feedback from our few users. Does not necessarily have to be a web hosted solution, but could be run through a browser.
Sorry this is so long and thanks for any ideas and feedback, especially if there is an existing software package solution, language that can be used, or other approach to get this done.
Answer: These days, two of the most popular are Adobe Captivate and Articulate Presenter. For service, instead of product, you can check out services like http://voicethread.com.
Answer: I don't know of any product that completely answers your requirements.
But, for similar results I use two different tools for developing the presentations and another one for drawing while presenting.
If I just want to make a presentation made of pictures and texts, and I want to automate its creation, I use irfanview http://www.irfanview.com/ with its wonderful feature for automated slideshows. I put all the images together, annotate them (I use either their filenames, or if not enought, with EXIF and comment fields) and create a slideshow, that can be compiler into an .exe file.
If I want a more elaborated presentation. With full annotation capabilities, I use Wink http://www.debugmode.com/wink/
For drawing over the screen during the presentation, I use a very old bitmap drawing program, called PC-Draw, that allows, with a hotkey, to capture the screen as a bitmap and begin drawing over it, and with another hotkey, to return to the original screen without altering the running programs at all. I have not found it anywhere in the web. However, I found similar programs just a quick google away.
All three tools are free and easy (and even fun) to use.


Does white balance change from lens to lens?

Question: Does white balance change from lens to lens? Though I think it does not, the reason I ask is auto white balance with a wide-angle lens seems to be different from auto white balance with a macro lens. Could it be just the difference in stops of light?
Comment: Related: [Why does image quality vary across lenses, and what to look for when comparing?](https://photo.stackexchange.com/q/88337/15871) and [How can a lens produce better (or worse) colors than another one?](https://photo.stackexchange.com/q/105320/15871)
Answer: Modern lenses are fabricated using an array of single element lenses. Some elements are air-spaced, some are glued together. Such a design is necessary because a single element lens suffers from a minimum of seven optical defects we call aberrations. In theory, it would take seven individual lens elements to counter these aberrations. Such an aberration free has never been achieved. Lens makers try there best, some high quality camera lens contain more than a dozen individual lens elements.
These lens elements are different as to their shape plus they are not flawlessly as to transparency. Some color is naturally inherent in the glass. Additionally, each element has two polished surfaces that reflect light. Thus as the image forming light rays traverse each element will reflect away about 2 to 3% of the wanted light. A high percentage of this stray reflected light will intermingle with the image forming light rays. This degrades the image by lowering contrast and contributing to ghost images and flare light.
The counter measure for unwanted reflections is lens coating. Each lens element is coated with a transparent covering of a specific mineral. It's a combination of thickness and material that does this trick. The coat reduces the amount of light reflected. A single coat is specific for one color of light. A modern lens will have multiple coats, one of each color that needs to be controlled.
Bottom line, the fact that a lens consist of multiple lens elements, each with a mineral coat, adds unwanted color to the image. This tint will be compounded by the scene lighting. Often the results of a picture taking session are less than faithful because we humans see with an eye / brain combination. This human trait is imitated by the white balance routine driven by computer logic built-in the camera. When we mount a lens, its color qualities will comingle with the scene color qualities. White balance to the rescue.
Comment: @anil-joseph What Alan neglected to add was "Yes." If I may be so bold as to add that the white balance doesn't change from lens to lens but white balance is a compensation for what does change. Alan enumerates the many things, explaining their relationship to the wavelengths absorbed to the final result. White balance is the "fix" for the "hue shift" caused by the effects Allan describes.
Answer: I don't actually know the answer to this but would assume that each lens has differing light transmission properties such that differing tints may come through. But, aside from that, wanted to frame challenge this question a bit:

The reason I ask is my auto white balance in wide angle lens seems to be different from auto white balance when I am using a macro lens or is it just the difference in stops o light

Your wide angle lens is pulling information from a very wide scene while your macro lens a very limited scene. Your camera's AutoWB is attempting to find the exact color temperature of the light so as to set the right WB but it is doing that based on the information it sees through the lens.
If you change that scope, why would you think the AutoWB would remain the same? AutoWB can even change with the same lens from shot to shot as the camera decides the WB per shot, not per shooting session, location, or anything more complex.
So, yes, using a different lens may force your camera to interpret the WB differently, thus changing it. So too can using the same lens and shooting different subjects in the same scene.
If AutoWB were any good, we wouldn't need grey cards/color checkers/expo discs/etc. ;-)
Answer: see Do lenses affect color fidelity?
I put two example photos there that show how drastic the change can be - mind that these are vintage lenses though.
Comment: What is downvoters issue? Want duplication of the referenced answer?


How should be interactions with non-mehram be like in a coed institution?

Question: How should young muslim brothers ad sisters interact in a coed high school?
What are the things we must be aware of to protect ourselves from any evils in such an atmosphere?
Comment: Try to avoid interaction as much as possible with the opposite gender unless it's something necessary and serious. Any conversation should be empty of anything that makes the conversation "fun" I would say. Because when there is "fun" in the matter, satan starts his evil whispers.
Answer: My advice would be to follow your instincts - if it feels wrong, then it feels as such for a reason. I do not think (as has been suggested) that your conversation need be devoid of "fun", though others should know where you stand, and all inappropriate matters/conversation ought to be ended swiftly.
I agree that the rules in the previous post are sensible, yet they focus on preventing the occurrance of difficult situations, such as being alone with members of the opposite gender. However, in life I feel these rules are unlikely to suffice - rather, practice complete control over your thoughts and actions so that these situations do not lead you toward evil. Put simply, strength of will and character will see you through many difficult situtations.
I find the best approach is to be reserved, keep conversation focused on the task at hand, and refrain from engaging in anything other than polite conversation. Then, analyze your behaviour throughout the situation retrospectively, and determine what you would say/ not say next time. I hope my advice helps to suppliment the other answers.
Answer: There are certain rules you have to follow:

Recite Daily morning and evening supplications to get help against devil
Try your best never to be alone with any guy
Wear proper hijab (including niqab)
Dont be Frank or open with any guy (in case there is need to talk)
Stay to the point (if you have to talk about study material)
If in any case you sense that a guy is interested in you, then try your best to avoid him as much as possible.

Hope it helps


How to solve "cannot open file 'LIBCD.lib' " in visual studio 2008?

Question: trying to compile some code i downloaded, i get link error LNK1104: cannot open file 'LIBCD.lib'. i cant find this file anywhere on my computer. what is it, and can i download it from somewhere? is there another way to get the code to work?
Answer: In my case, I only wrote "LIBCD.lib" in Configuration Properties -> Linker -> Input -> Ignore Specific Library
Answer: The first hit on Google for libcd says:

This file is the static library for the debug single threaded version
  of the C runtime. Visual Studio 2005 no longer supports this version
  of the C runtime: instead you need to use the multi-threaded version
  (libcmtd.lib) or the dynamically linked (DLL) version (msvcrtd.lib).
To fix this problem you will need to change the makefile that comes
  with GLUI to get it to use a different version of the library.

and some other things that might help you.
Comment: Not always you have the chance to recompile your lib. If it is a 3rd party lib then you're hosed.
Comment: as OP said "trying to compile some code i downloaded" the downvote might not be entirely justified...
Answer: You can fix this from the project settings. You need to add the /NODEFAULTLIB to the linker settings:
core.2f.nodefaultlib.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/core.2f.nodefaultlib.asp
This option will make the linker ignore all the /DEFAULTLIB directives - this will remove the dependency on libcd.lib. Unfortunately it will remove all the other dependencies as well so you will need to explicitly add the libraries you do need (like glut32.lib etc.) as inputs to the linker.


What is this plant with purple bellflowers on a spike?

Question: Could someone identify this flowering plant?
Answer: It is a Delphinium; it has flowered whilst still very short. These usually reach a height of somewhere between 4-7 feet, depending on variety. You don't say how long the plant has been in situ nor where you are in the world, but the foliage is still growing upwards, and may yet reach a more normal height and produce more flowers. These plants are herbaceous perennials, meaning they die down in winter and reappear in spring the following year. They are usually  planted at  the back of a flower bed or border because of their height, and prefer rich, fertile, relatively moist (but not waterlogged) soil that does not completely dry out frequently; they are prone to slug and snail damage early in spring as they start into growth. Image here https://www.premierseedsdirect.com/product/delphinium-pacific-giant-blue-bird/
Comment: Thanks for answering. I would say it was planted only a few months ago, at the _front_ of a public flower bed. I look forward to seeing how tall they can grow.


Is it possible to secure a web service with Forms Authentication?

Question: We are looking to secure a bunch of ASP.Net 2.0 .asmx web services. The which will host the web services is already forms authenticated.
Is it possible to secure the web services using forms authentication?
What are the pros and cons and other possible ways to achieve this. We certainly don't want to pass a username/pwd or token in each web method call.
Answer: The thing with form authentication is that its designed for people, where as a web service is designed to be consumed by a client application. While it is possible to do the authentication like this, it's the wrong way of thinking.
The level of security needed obviously depends upon the sensitivity of data that you're working with, but I'm going to assume its at least somewhat sensitive (but less than bank transactions). You could perhaps use SSL and passing a username and password as jle suggested, while I was typing this, or you could require an api key much like flickr does.
Another more secure option is to only pass the username and password once (and with the security of ssl) and have that give out a token that is valid for a period of time. This has the benefit of protecting the password information, and avoiding the constant overhead of ssl.
As mentioned though, it highly depends on HOW sensitive the information is that you're trying to secure.
Answer: WSE is obsolete. Do not use it unless you have no choice at all.
Almost all the functions of WSE are implemented better by WCF. The remaining capabilities, those not implemented by WCF, are obsolete themselves (DIME, for instance).
Answer: It is possible, but you will need to redirect users to a login page.  Another option for passing username/pw is to use the web service over ssl.  If you encrypt the connection, basic authentication can be used no problem.
Answer: You should be able to use WSE to secure your service using forms authentication - though personally I've never had to do it.
Here are some resources using WSE:

http://aleemkhan.wordpress.com/2007/09/18/using-wse-30-for-web-service-authentication/
http://msdn.microsoft.com/en-us/library/aa480575.aspx

To not use WSE you'd need to implement something like this as some of the other presponders have alluded to, though I'm not sure how reliable it would be:

http://www.dotnetbips.com/articles/dbd724e9-78f0-4a05-adfb-190d151103b2.aspx


How to create table view with progress bar?

Question: I want to create a tabular view with progress bar. The drupal-6 view consists of goals of activities I need to do. I have created a content type called Goal that is composed of activities/task. I want to list the goals in a tabular view and show a progress bar in one of the column that indicates how many task/activities under the goals have been completed. How can I do it?
Answer: You either need

A custom views field
A themed/templated existing field.

A good option in D7 for progress bars is jQuery UI progressbar ( API docs here ), as it's shipped with core.
You can add the required JS with
<code>drupal_add_library('system', 'ui.progressbar');
</code>


Is acceleration relative in relativity?

Question: Suppose a box A is moving relative to a Box B, then by time dilation equation if I take 1 sec passed for an observer in A then for an observer in B will be little longer. Now if I suppose that the box B is moving while A is stationary under the same condition, then by the time dilation equation time passed in B must be shorter than A. How is this issue resolved? In the twin paradox problem my book says that it's due to acceleration, but in my opinion acceleration is relative (please correct me if I'm wrong), but here it is not the case.
Answer: Acceleration is not "relative" even in classical mechanics, accelerating frames have fictitious forces in them (like overload, centrifugal, etc.), while inertial ones do not. It is not relative in special relativity either.
So if A is accelerating and B is inertial then A and B are not "equal", and if they are both inertial then there is no way to bring them back together as in the twin paradox. Which by the way is not a paradox, there is nothing contradictory about the stationary twin ending up older than the accelerating one. "Neither Einstein nor Langevin considered such results to be problematic: Einstein only called it "peculiar" while Langevin presented it as a consequence of absolute acceleration". See more in Resolution of the [twin] paradox in special relativity.
Comment: @Muzamil Then they never come together and the times you are comparing are times measured in two different frames, so they are physically incomparable. Comparing A's time to B's time for something is like comparing apples to oranges, there is no absolute time in relativity, it is not meaningful to ask which of the times is more "real". What creates at least an appearance of paradox in the case of twins is that they finally meet again, so their separately measured times are physically reflected as their respective ages. But synchronizing one frame with another like that requires acceleration.
Comment: No, I mean what, if there is no acceleration in both boxes?
Answer: Are you familiar with the concept of the relativity of simultaneity? Because simultaneity is relative, when they move apart they will disagree about which pairs of readings on each of their clocks are simultaneous. For example, suppose they move apart inertially at 0.6c, with each clock set to read a time of 0 seconds at the moment they were right next to one another at the same position coordinate. Then in the inertial frame where Box A is at rest, the event of Box A's clock reading 20 seconds is simultaneous with the event of Box B's clock reading 16 seconds, so in this frame Box B's clock has ticked less time. But in the inertial frame where Box B is at rest, the event of Box A's clock reading 20 seconds is simultaneous with the event of Box B's clock reading 25 seconds, so in this frame Box A's clock has ticked less time.
And as Conifeld said, acceleration is not relative--you can determine whether you're accelerating using an accelerometer that measures G-forces, for example. In the twin paradox, one of the twins accelerates so that they can compare clocks at the same location in space--this means there is no longer any problem with disagreements about simultaneity, but the acceleration breaks the symmetry, and the one who accelerated will have aged less than the one who moved inertially. There's a good discussion of a number of different ways to think about the twin paradox on this page.

Is acceleration relative in relativity?


What should I do if I'm receiving Tiktok verification code even I don't use and have deleted the application in my android device?

Question: What should I do if I'm receiving SMS on phone giving in verification code of TikTok app despite I have deleted and no longer use the application in my Android device?
I got an international call instantly after SMS popped in my notifications.Is this a cyber attack or phishing?
Answer: When you delete the app, then the account with your password still remains (in case you later decide to reinstall the app).
It appears someone was trying to log into your Tik Tok account, couldn't, and then used the "forgot password" function. This doesn't necessarily mean malicious intent. It is possible that someone somewhere in the world registered an account with a very similar account ID, mistyped it, and now erroneously tries to log into yours believing it to be theirs.
If the messages are not too distracting, you can just ignore them as spam. If they do annoy you, then you should delete not just the app but the account (which according to this guide requires to reinstall TikTok temporarily). 30 days later your account will be permanently deleted, together with any PII, including your phone number (hopefully - it's a Chinese company and they aren't bound to the same data protection legislations as US or European companies)
Comment: @raffaem I am not a lawyer. When you want to know more about privacy laws in the US, you might get better answers on https://law.stackexchange.com.
Comment: When you talk about data protection laws in US. Are there laws other than the California's CCPA?
Answer: The App poses risks of exposing you and your personal information online due to poor implementation of security and vulnerabilities in the App. Get rid of the App. There are too many articles explaining the exploits and risks of using TikTok dating back to 2019.
One example is the advertisement sub-domain had vulnerabilities of XSS.
Two USER data exposed just in HTTP REST calls which showed PII data such as email, phone numbers and secondary email accounts.
Three this data is not collected by the company of TikTok claimed by the CEO of the American operated company, but that does not mean other executives or members of the company are not sending the data off to who knows where.
Four the App TikTok will subsequently show more vulnerabilities as more people discover them as it is currently being brought more into the main light.
Comment: You're not wrong, but you're not answering the scope of the question either.


How can I print true b&w with Epson Discproducer PP-100? (no CYM color ink used)

Question: I would like to print a true b&w image on discs using the Epson Discproducer PP-100 but when I select Black in the Discproducer print settings it still uses a bit of color ink (CYM). I was told by Epson it was because the image I made in Photoshop (CS3) grayscale still has color info in it but I was able to save a K only image and still prints a bit of color with he PP-100 (visible in light areas of the image especially). Has anyone had this problem & found a solution? I would be extremely grateful for a solution (if there is one) thanks.
Comment: Did you try the gray scale option
Comment: there is no grayscale option and the Black option prints all CYMK inks unfortunately.
Answer: Printer drivers sometimes add other paints to make rich black. I usually test them by sending bitmap file or print plates from Acrobat.
IF
the printer driver still split the file into CMYK I use empty ink cartridges and force printing in black only.
Comment: Thanks but Bitmap not possible since it needs to be a standard full tone b&W photo.
Comment: Bitmap is just to see how the printer drivers act. You can't have "color information" in bitmap so it would need to be added by epson drivers. If the bitmap will print properly then you know that work is to do in photoshop or use different program to get rid of that color info
Answer: It is not possible, unfortunately. As stated in the PP-100N User's Guide section notes, Maintenance: Changing the ink cartridge, on page 125:

Even when Black is selected in the printer driver, all the ink colors
  are used in an operation designed to maintain the printing and print
  head quality.
Answer: Epson and many other office printers need RGB input. This makes sense because ordinary office software have no idea about CMYK.
If you have Adobe InDesign, try to print something with selecting the output to your printer to be CMYK. That option is not available at all, if your printer wants the data as RGB.
Adobe Acrobat (not Adobe Reader)has plenty of options in the tab "print production" It does not discuss about CMYK separations if the target printer is RGB input only.
RGB input printer has its own way to output the color R=G=B=0. Unfortunately the printer driver usually has no selectable options to define "let R+G=B=0 to be printed as 100% K.
About the brute force solution: Empty CMY cartridges can leave air into your system that can later be fatal for non-black printing. Additionally it does not make 100% K. But you can try to make a custom bottle collection that has CMYK bottles with their appropriate identification chips, but only black ink in all bottles. Surely it takes some time to clean the pipes for color printing.


Why reputation will decrease?

Question: Why will the reputation decrease when the supported user was removed?
Comment: check this: http://meta.stackexchange.com/q/126470/224252
Comment: @Marius, ok sir, thank you
Answer: The answer is pretty much explained here in the help from MSE.

This message means that a user who voted for one of your posts had
  their account deleted (either by request or due to violating the
  network's terms of service). As a result, all of their votes were
  removed, and the reputation you gained or lost from them was undone.
  The resultant reputation change could be any amount; it could even be
  a reputation gain if enough of the removed votes were downvotes. All
  the reputation changes from a single user's deletion are rolled into a
  single event in the reputation page labelled "User was removed".
This removal occurs whenever a user is deleted, unless that user had a
  very high reputation score. Because high-reputation users have usually
  cast a great many votes, removing all of them could be that much more
  disruptive to other users. In such cases, the staff use a special
  deletion that preserves the votes, resulting in no reputation change
  for those who had been voted on by that user.

Why reputation will decrease?


Run symfony action from console

Question: I have two action in my symfony 2 controller. CrawlerBundle:Index:index, CrawlerBundle:Index:update. I need run index action from console. How can I? I think it starts with
php app\console ...
Help me please.
Answer: Move the stuff you do in those actions to a service and call it from both your controller and the custom command you'll create.
Answer: Use PhaxBundle.
By only declaring a controller as a service, you are able to call your actions with :
$ php app/console phax:action controller action -p param1:value1 -p param2:value2

There is an example with a cron to delete old comments:
$ php app/console phax:action comment deleteOldComments -p date:2013-06-05
Old comments have been deleted: 18
$

Run symfony action from console


How many people would you need in a room to ensure with 100% probaility that three have the same birthday?

Question: I am vaguely aware of the Pigeonhole principle and I understand that you would need 367 people to ensure that two people have the same birthday. I think that it may be required to have 734 people in a room to ensure 100% probability, since you can have 366 birthdays repeated and not have three people. Is this a correct assumption, and if so, how would you solve it without just guessing/checking?
Comment: I think the use of "probability" in your question is misleading.  There are situations in which "occurs with 100% probability" is weaker than "must occur", but this is not one of them.  This is indeed a direct application of the Pigeonhole Principle.  It sounds like you should become more than vaguely aware of the Pigeonhole Principle: certainly it is simple enough for anyone to understand, and once you get it you'll regard questions like this as being 100% (!) straightforward.
Comment: You mean 733. $ $
Comment: Any space large enough to contain that many people would probably not be considered to be a "room"; the word "hall" would seem more appropriate.
Answer: Your reasoning looks pretty much right (you're off by one) and looks to me like a direct approach more than guessing and checking. Maybe if we just crystalize your argument a little, you'll understand it more deeply:

There are $366$ possible birthdays; if we have $366\times 2=732$ people, then it is possible for each day, exactly two people call it their birthday. This is the maximum number of people where we can have at most $2$ per birthday. If we have one more person, then at least three people must share a birthday. Thus, in a room of $733$ people, at least three share a birthday.
Comment: Oh okay! Your explanation cleared up my confusion. I was thinking it may have been +2 for some reason, instead of just +1.


Outer product for r vectors in terms of the geometric product

Question: I found a definition in (An introduction to geometric algebra and calculus by Alan Bromborsky) which say
let $a_1,a_2,...,a_r$ be vectors in $\mathbb{R}^n$ and let $\varepsilon_{1...r}^{i_1...i_r}$ be mixed permutation symbol
then$$a_1\wedge ...\wedge a_r =\frac{1}{r!}\sum_{i_1,...,i_r}\varepsilon_{1...r}^{i_1...i_r}a_{i_1}...a_{i_r}$$
And let $e_1,e_2,...,e_r$ be an orthogonal basis for the set of linearly independent vectors $a_1,a_2,...,a_r$ so that we can write
$$a_i=\sum_{j}\alpha_{ij}e_j$$ then  geometric product define as
$$a_1a_2...a_r=(\sum_{j_1}\alpha_{1j_1}e_{j_1})(\sum_{j_2}\alpha_{2j_2}e_{j_2})...(\sum_{j_r}\alpha_{rj_r}e_{j_r})$$
$$=\sum_{j_1,j_2,...,j_r}\alpha_{1j_1}\alpha_{2j_2}...\alpha_{rj_r}e_{j_1}e_{j_2}...e_{j_r}$$
our aim is to put second definition in the first one.
my problem in this defintion how we can be sure that our outer product has a grade r or in other word the repeated factors of orthogonal basis will vanish
Answer: Orthogonal basis elements anticommute, so when you take an antisymmetrized sum over them duplicates vanish. Antisymmetrization is equivalent to alternation: if $f(x_1,\dotsc,x_k )$ is any multilinear function then
$$
  f\text{ is antisymmetric} \iff f(x_1,\dotsc,x_k) = 0\text{ whenever }x_i = x_j\text{ for some }i\ne j.
$$
Work this out in the case that $k = 2$: for ${\implies}$ consider that $f(x,x) = -f(x,x)$; for ${\impliedby}$ consider that $f(x_1 + x_2, x_1 + x_2) = 0$. This idea extends easily to arbitrary $k$.
The point being that an antysymmetrized sum is also an alternating sum where identical multiplicands cause the sum to vanish.
More concretely, in
$$
  X = (a_1e_1 + a_2e_2)(b_1e_1 + b_2e_2) - (b_1e_1 + b_2e_2)(a_1e_1 + a_2e_2)
$$
the diagonal terms vanish because e.g.
$$
  a_1b_1e_1e_1 - b_1a_1e_1e_1 = 0.
$$
The cross terms combine by anticommuting basis elements:
$$
  a_1b_2e_1e_2 - b_2a_1e_2e_1 = a_1b_2e_1e_2 + b_2a_1e_1e_2 = (a_1b_2 + b_2a_1)e_1e_2.
$$
All together you will find
$$
  X = (a_1b_2 - a_2b_1 - [b_1a_2 - b_2a_1])e_1e_2 = 2(a_1b_2 - a_2b_1)e_1e_2.
$$
The same ideas apply to an antisymmetrized product of any number of vectors.


Apache2 seems to be redirecting all SSL to port 443

Question: I'm trying to setup a Nextcloud server to listen on a non-standard port over SSL on Apache2.
OS: Debian 9.9.0
uname -a: Linux cactuar 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64 GNU/Linux
apache -v: Apache/2.4.25 (Debian)
php --version: PHP 7.3.11-1+0~20191026.48+debian9~1.gbpf71ca0 (cli) (built: Oct 26 2019 14:18:28) ( NTS )
my sites-available currently activated:
NameVirtualHost 0.0.0.0:7580

<VirtualHost *:7580>
 DocumentRoot /var/www/nextcloud
 ServerName cloud.example.com
 <Directory "/var/www/nextcloud">
  allow from all
  Options None
  Require all granted
 </Directory>
 SSLEngine on
 SSLProtocol +TLSv1.1 +TLSv1.2
 SSLCertificateFile /var/cloud_ssl/certificate.crt
 SSLCertificateKeyFile /var/cloud_ssl/private.key
 SSLVerifyClient none
 LogLevel info
 SSLCACertificateFile /var/cloud_ssl/ca_bundle.crt
</VirtualHost>

When I try to access my site on https://cloud.example.com:7580 I get:
 Internal Server Error

 The server encountered an internal error and was unable to complete your request.
 Please contact the server administrator if this error reappears multiple
 times, please include the technical details below in your report.
 More details can be found in the server log.

The apache2 error log is set for debug level and contains the following on my request:
[Tue Dec 24 11:39:12.283854 2019] [ssl:info] [pid 23619] [client 10.10.0.1:3616] AH01964: Connection to child 0 established (server cloud.example.com:443)
[Tue Dec 24 11:39:12.284437 2019] [ssl:info] [pid 23620] [client 10.10.0.1:17338] AH01964: Connection to child 1 established (server cloud.example.com:443)
[Tue Dec 24 11:39:13.177501 2019] [watchdog:debug] [pid 23880] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Tue Dec 24 11:39:32.611925 2019] [reqtimeout:info] [pid 23620] [client 10.10.0.1:17338] AH01382: Request header read timeout

My apache2 is behind pfSense with 7580 NAT'd to this specific machine.
My ports.conf:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen *:7580

<IfModule ssl_module>
     Listen 7580
</IfModule>

<IfModule mod_gnutls.c>
     Listen 7580
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

The access.log file is empty.
The other_vhosts_access.log looks like:
cloud.example.com:443 10.10.0.1 - - [24/Dec/2019:11:39:12 -0600] "GET /index.php HTTP/1.1" 500 3780 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
cloud.example.com:443 10.10.0.1 - - [24/Dec/2019:11:39:32 -0600] "-" 408 3274 "-" "-"

So it looks like even though I'm appending :7580 to the URL it's still trying to access the server on 443.
Is there anything you see in my config or anything you think I can try? I'm extremely confused.
Thanks.
Comment: I'm voting to close this question as off-topic because the problem was caused by a non-reproducible typo error.
Comment: True. However a tiny part of this that I can make more obvious is why Nextcloud or Apache wasn't logging an invalid MySQL connection.
Answer: Moral of this story: Check your MySQL connection. Apparently I made a typo in the MySQL password and it was not connecting.