What is the difference between Java APIs and Java Methods

Question: Are methods and APIs, basically the same in Java? If no, what makes them different?
Comment: @sp00m, He is just curious, let him be.
Answer: API refers to Application Programming Interface, what the rest of the world see and can use.
Method can be part of the public interface or not. But API is really set of methods.
The most common thing related to APIs in java would be Interface which is really set of public method declarations.
Another useful way how to look on API is to take it as contract. Lets take a List interface as an example. It tells you method signatures you can use in a List and in javadoc you see what is the contract (what you can expect and what you need to ensure so the List behaves as expected)
Answer: API consists of, among other artifacts, a set of types, which include methods, the signature and behavior of those methods specified by the API contract. So yes, API and method are two different things, just like a paw and a dog are different things.
Answer: To elaborate on Markos very precise, but somewhat terse answer: Concretely you can think of java interfaces and the associated javadoc as APIs. For instance Collection defines an API that is expanded by eg. Set, whereas HashSetis a concrete implementation of the Collection and Set APIs.
Cheers,
Comment: It helps to further note that `HashSet` has API on its own as well. For example it has constructors which are never a part of the API defined by implemented interfaces.


What is the difference between Stochastic game and Bayesian game ?

Question: I was studying definitions of Stochastic and Bayesian game and it appears that Stochastic game is a generalized form of Bayesian game. Could anybody please explain the fundamental differences between Stochastic game and Bayesian game and imperfect information and incomplete information games ?
Comment: This may also be relevant: **stochastic Bayesian games** combine stochastic games with Bayesian games, see Wikipedia: https://en.wikipedia.org/wiki/Bayesian_game#Stochastic_Bayesian_games
Answer: In a Bayesian game, information is incomplete. To cope, players have beliefs about the state of the game. In a sense, each player strategizes as if the game was as he or she believes. So each player operates in his or her own world. And if every player plays a Nash equilibrium in one's own world, that's a Bayesian Nash equilibrium.
In a stochastic game, the information about the current state of the game may indeed be public. At a given time step, the next state is determined by the current state, the strategy profile played at that time step, and some stochastic process (like a Markov chain, for example).
We can have a stochastic Bayesian game where information is incomplete and there is a stochastic switching device like a Markov chain.
Comment: you mentioned that the next state depends upon some stochastic process as well. Do that mean that its "like Markov chain" or is indeed exactly markov chain. In other words the next stage could be one of 4 states with probability attached to each of the 4 states? In Bayesian game, isnt this also the case? Does Bayesian game dont have transition probability?


How do you pronounce the word "array" in Australian English?

Question: I am learning accents (differences in pronunciation), and I was wondering how to pronounce the word "array" in Australian English, and how it's pronounced in other variants of the language. Is it AH-ray or uh-ray, and which variant does the other belong to?
Comment: Do you have any specific reason you're asking about *array*? Have you heard an Australian pronounce it strangely?
Comment: No, I'm learning programming as well, and my teacher pronounces it differently to me.
Answer: Australian Oxford Dictionary (2nd ed.) has /əˈreɪ/, which is the usual pronunciation of array in both British and American English, so I have no reason to assume it's pronounced any differently in Australian English. (Phonemically, that is. The exact quality of the vowels would of course differ slightly or considerably depending on speaker.)
You can confirm this by listening to videos on YouTube (although these must be taken with a grain of salt because not all of them must be Australian speakers).
(Ideally, I should consult the Macquarie Dictionary, which is the authority on Australian English, but I do not have access to it at the moment.)
Comment: Perfect, thanks! (I have the Macquarie - should have checked)


How do I make my mesh move 1-1 with the bones

Question: Whenever I move the bone on my rig the mesh moves but almost never 1-1. How come that happens. I checked to make sure all location, rotation, and scaling are set to zero. I've tried re-parenting, and I have tried painting the whole hand red which has little to no better results than just painting the wrist red.
Answer: The effect of the armature on the mesh is an accumulation of all bones - to make a section of your mesh follow the action of a single bone you do need to ensure the weights for that single bone are all at 1.0, but also you need to ensure that the weights for that section of mesh are zero for all other bones - otherwise the other bones will also be affecting its deformation, negating some of the effect.


Repeated measures models multiple testing adjustment

Question: Perhaps I am missing something obvious here, but I can't find an answer to this. Let's say we run 10 individual repeated measures models with factor(time) as fixed effect with 5 separate timepoints and 10 different outcome variables. You would get p-values of time 0 vs 1, 0 vs 2, etc. for each outcome variable.
Since you have used 10 models how would you correct for multiple testing?
And how would that affect p-values between the individual time points?
Comment: In general you need to correct for multiple testing, with, for example, Bonferroni.  But please provide more information about how these data were generated and what you are trying to achieve with your analysis
Answer: Strictly speaking you will need to correct for both the multiple comparisons within and between outcomes. However, this may be an overkill at the end. Often what is done it is done in such situations is the following:

For each outcome you first test with an omnibus test whether there is any different between the time points. If this omnibus test is significant, then you perform the post-hoc tests to see which time points different with each, correcting for multiple testing within the outcome.
Then for the different outcomes, you typically pre-select a couple as your primary outcomes and the rest as secondary outcomes. To be fair, this selection needs to be done a-priori and without looking at the results first. Then you only correct for any multiple testing you have in the primary outcomes (i.e., if you have selected more than one). For the secondary, you report the results without correction. You need to be clear and explicit in your text that you have not corrected for multiple testing in the secondary outcomes. And hence, you need also to be more careful on the formulation of statements based on the results from these outcomes.
Comment: Thank you Dimitris. I have a priori selected one outcome as primary and the rest as secondary. If I then do an F-test I would suspect that P-value should also be corrected. For example with Bonferroni do I correct it with a factor 10 (for 10 F-tests)? Or do I have to increase the factor because of the individual time points?


Revolutions (pulse) per minute counter circuit?

Question: Does anyone know how to set up a circuit by using counters, decoders, 7 segment displays and a 555 timer to show the revolutions (pulses) per minute from a photo-transistor?
I'm doing this as part of my own project but I am not sure of what other components I need and how it could be wired.
Answer: Yes, lots of people I suspect.
However, using a microcontroller would be a simpler way.  In a micro you can count pulses in a known period, or measure time between pulses.  Counting pulses within a period is simpler, but can take a while to get a meaningful reading or you have low resolution.  Most of the time you measure time between pulses and then invert to get speed.
Many micros have a capture capability where the value of a free running counter is captured in hardware when a pulse is received.  By subtracting the previous capture value each pulse, you get a high resolution measurement of the period between pulses.  I'd low pass filter that a bit, then invert when needed to update the user interface to show speed.
The 7 segment display encoding is also something the micro is well suited to do.  It can then perform the multiplexing on the multiple digits, or you can get a micro with lots of I/O lines and hook up each segement individually.
Comment: @abdullah: The answer to your reworded question is then "yes, I can".  Part of the point is to get people to phrase questions properly and write what they really mean.  Too often people seem to fall back onto idioms without stopping to think.  I recently had someone tell me to "take my cotton-picking hands off of...".  This person isn't racist, and was really embarassed when I asked why it should matter whether my hands had previously picked cotton or not.  She had just used the expression and never stopped to think about what it really means, which is actually pretty offensive.
Comment: "Does anyone know how to..." mean something different among today's youth.. It's like "can you tell me if you know?". :)
Comment: Yeah, thanks for editing that comment and making my previous comment sound silly, too :)
Answer: The best (simplest and cheapest) is to use a microcontroller, its internal clock and a capture pin.
The hardware way, based on a 555, needs a counter, a register to hold the count and maybe some logic here and there to reset the counter, etc.
And... if you want a minimum of accuracy, a 555 is not the first choice.
On top of that, I suppose your count, being a number, would be mathematically processed, which is much simpler in a microcontroller register than in pcb traces.
Answer: What you're looking for is a frequency counter, a basic bit of lab test equipment. The various ways of making them are all over the internet. Your easiest option will be to buy a cheap multimeter with a frequency counter (Hz) function, it will be easier & more accurate than anything you're going to nail together on breadboard.


How do I measure out these salts using the proper method?

Question: I'm planning on preparing a water solution using the following salts of reagent grade with approximately these concentrations:
\begin{array}{lr}
  \ce{CaCl2}  & \pu{10 mg/L}\\
  \ce{Na2SO4} & \pu{1 mg/L}\\
  \ce{NaHCO3} & \pu{20 mg/L}\\
  \ce{KHCO3}  & \pu{5 mg/L}\\
  \ce{NaF}    & \pu{0.25 mg/L}\\
  \ce{NaNO3}  & \pu{1 mg/L}\\
\end{array}
I suspect some of these salts are hygroscopic. Do any of them need to be oven dried prior to weighing? What is an appropriate procedure for this (i.e. what temperature, for how long, etc.). Are there any other requirements in order to correctly produce a solution of the above composition?
It's for an experiment where I'm needing to replicate a natural water source so I'm needing to be as accurate as possible.
Comment: @airhuff, I'd disagree with your statement. Chemicals like calcium chloride are almost certainly **not** anhydrous unless explicitly stated, and even then once opened they'd absorb any moisture in contact.
Comment: @NotBaran , somehow I read into this statement that the "artificial water" was for an aquarium, though that's clearly not stated...don't know why I assumed that, and I will delete the comment. But, with that in mind I figured worrying about drying, or other special handling, of the chemicals was overkill. Regarding the labeling of the degree of hydration, we are still in disagreement. If I buy a chemical reagent, I expect the bottle to be accurately labeled with it's contents, including whether a salt is anhydrous or not. I guess an exception would be a bucket of CaCl2 ice melt or something.
Comment: Often labs have a sealed nitrogen/argon environment, with gloves on the glass so you can manipulate what's inside. There's usually an airlock to move things in and out. Put a balance inside one (Or ask to use someone who's already set one up), weigh your material in the safe environment, and take it out, or set up your reaction also inside the safe area. You of course need anhydrous material, or it'll kind of defeat the purpose.
Comment: @airhuff The best attempt I have ever seen from a vendor to acknowledge that a hygroscopic salt was not anhydrous was the following: $\ce{CaCl2 --X H2O}$ I don't know if this meets your standard for "clearly labeled" or not.
Comment: @J.Ari , [this](http://www.sigmaaldrich.com/catalog/product/sial/21102?lang=en&region=US&cm_sp=Insite-_-prodRecCold_xviews-_-prodRecCold10-9) is how I expect the bottle to be labled. Sigma-Aldrich has another CaCl2 dihydrate product labled "Calcium Chloride", sans the dihydrate part, but it is clearly shown as a dihydrate in the chemical formula on the label.
Comment: Well when I purchased from Sigma-Aldrich maybe 5 years ago, the chemical formula had the indeterminate hydrate noted. I suppose this at least should make one think about oven drying or determining moisture content and correct the experiment accordingly. I am leaning to NotBaran's point of view regarding the labeling for such details, better to verify by oneself.
Answer: You are dealing with very low concentrations and for those you will need very accurate equipment and a very clean lab. I am not sure that reagent purity is enough. In some parts of the world ordinary tap water might already have higher concentrations.
Unfortunately you have not given enough context for what you are doing, so I will outline some procedures which should guarantee quite good accuracy.
First thing you will need is bidistilled water probably lots of it.
For very accurate (and reproducible) results I would recommend purchasing stock solutions and the doing serial dilutions.
If the above is no option you will have to do some more research by yourself, because it depends on the quality and variation of the chemicals you buy. (And preparing a list of all that for your list of chemicals is beyond the scope of this summary.)
For example calcium chloride comes on merck in at least four variations: $\ce{CaCl2}$, $\ce{CaCl2.xH2O}$, $\ce{CaCl2.2H2O}$, $\ce{CaCl2.6H2O}$, and solutions. Depending on your starting material you will need to look up the decomposition temperatures. For calcium chloride you may find them on Wikipedia.
You first need to dry your container with which you will measure the mass of your reagent. Make sure you use gloves as fats and skin can change the result at these low concentrations. Measure it multiple times until you have a constant value (within the limitations of your scale). You need to dry the container at the same temperature which is appropriate for drying your chemical.
Then you follow the same procedure with the chemical. Obviously you will not hit the concentration exactly, but in science that hardly matters, as long as you know the correct value. Once you started the drying process you should keep the container closed until you are ready to transfer it into the solution.
You shouldn't store your prepared stock solutions for a long time and at below room temperature in appropriate flasks.
The other way would be checking the concentration against a primary standard. For calcium chloride you can probably use silver nitrate, which you have to dry like explained above. (It doesn't have the nasty crystal water, which is a plus as $\pu{50 - 90 ^\circ C}$ should be sufficient.)
For setting up the solutions you will need a good assortment of volumetric flasks, pipettes, micro pipettes, thermometers, and probably a bit more I just can't think of right now.
You might want to check with this open access publisher what is common in the field and adjust appropriately. It very much depends on your goal; approximately can cover a pretty large range of desired accuracy.
Comment: Addendum cross-link: [Is MDPI a reputable academic publisher?](https://academia.stackexchange.com/q/5466/13372)


How can I see HEAD temp pointer reference in Git?

Question: Not the current working HEAD REFERENCE which points in our current branch.
Answer: You can directly see HEAD if you look into the file .git/HEAD. What you find in there is all there is to it, there is nothing more.
HEAD does not, strictly, point to the current branch but is the commit that is currently checked out. It is, by definition, the first entry that git log lists.
If you do a git checkout branchname then, yes, indeed, .git/HEAD will contain the ref of the branch you checked out, probably something like refs/head/branchname. This in turn is literally the file that contains the actual commit hash; you can see it in .git/refs/head/branchname. But if you do git checkout commithash then .git/HEAD will contain said hash, and you will be in a "headless" state (git will give you a longish message explaining what that is). In this case, there is no "current branch".
Comment: Hi thanks,  when we move file to staging area, one temp ref head id will create in local repository which stating current working commit(commiting by some one else).Not the head that showing in our current branch


How to forcefully remove wine with unmet dependencies that are not resolved by sudo apt-get -f install

Question: Firstly, the unmet dependencies are not being met by
sudo apt-get -f install
The following commands were not successful for removing wine
Optional, to remove Wine 1.7.45 and winetricks, open a new Terminal window and bash (get it?) in the following commands:
sudo apt-get remove wine1.7 winetricks

How to Completely removing Wine:
sudo apt-get remove wine
rm -rf $HOME/.wine
rm -f $HOME/.config/menus/applications-merged/wine*
rm -rf $HOME/.local/share/applications/wine
rm -f $HOME/.local/share/desktop-directories/wine*
rm -f $HOME/.local/share/icons/????_*.xpm

The error that I am receiving after trying to fix the dependcies is as follows
imdanerdinator@imdanerdinator-MS-7578:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  lib32z1 wine-compholio-amd64
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  wine-compholio
The following packages will be upgraded:
  wine-compholio
1 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Need to get 0 B/1,222 B of archives.
After this operation, 10.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 263224 files and directories currently installed.)
Preparing to unpack .../wine-compholio_1.7.45~ubuntu14.04.1_amd64.deb ...
Unpacking wine-compholio (1.7.45~ubuntu14.04.1) over (1.7.29~ubuntu14.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/wine-compholio_1.7.45~ubuntu14.04.1_amd64.deb (--unpack):
 trying to overwrite '/opt/wine-compholio/bin/wine64', which is also in package wine-compholio-amd64 1.7.29~ubuntu14.04.1
Errors were encountered while processing:
 /var/cache/apt/archives/wine-compholio_1.7.45~ubuntu14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any help would be appreciated as I can't figure out how to resolve this problem.
Answer: Test this:
Open a terminal,Press Ctrl+Alt+T
Run it:
$ sudo -i
# apt-get remove --purge wine*
# apt-get autoremove
# apt-get clean
# apt-get update
# apt-get -f install

Comment: Resulted in the same issue and response
Comment: Try: sudo rm -rf /opt/wine-compholio/*


How to redirect to PageReference from constructor

Question: I need to prevent user from accessing standard community pages like /login and /sitelogin, because I have custom branded pages. In Salesforce SiteLogin.component there is no option for action (method that executes on page load), so maybe there is another way to do redirect?
Javascript would be bad option because it is not safe.
Comment: You can use an `action` tag for example on the _page_ `SiteLogin`, where the actual component is used on. Or implement the logic in the custom controller of the `SiteLogin` _page_.
Comment: It is not true. Once enabled (communities/site) you should get access either to [`CommunitiesLogin`](https://help.salesforce.com/HTViewHelpDoc?id=communities_custom_login_page.htm&language=en_US) or  [`SiteLogin`](https://help.salesforce.com/apex/HTViewHelpDoc?id=sites_login_and_registration_settings.htm&language=en) that are default login pages created automatically by system. Try to search for it within dev console.
Comment: @SergeyUtko There is no SiteLogin page available. I think Salesforce just allows to customize layout by giving access to component only.
Comment: @SergeyUtko thanks, I solved problem with /sitelogin, but user can still type '/login' in url and go to default login page. I can create url redirect, but it does not work if I pass any url parameters to that page
Answer: There are several ways of handling your issue. One is simply by branding the standard community login page. Another is by modifying the Apex community and/or sites login Controller so that it redirects to your custom login page.


Can someone point to a prophecy about the 3 days between the cross and resurrection?

Question: Can someone point me to a OT prophecy about the Messiah being in the tomb for 3 days? As general or specific as you can think of. I think I have one, and it seems pretty obvious to me, but a lot of Bible commentators don't mention it.
Comment: Verse identification questions are now off-topic: [Where's the line with the "verse-identification" tag?](http://meta.christianity.stackexchange.com/q/4199)
Comment: Please take a look at my answer linked here and scroll down to the section "What does 'the third day' mean?" https://christianity.stackexchange.com/questions/39619/was-jesus-christ-crucified-on-the-14th-of-nisan-april-3-33-or-the-15th-april/78437#78437  See also Hosea 6:2; Esther 4:15 to 5:1 and 1 Samuel 30:12.
Answer: Old Testament prophecies are sometimes 'thematic', by 'type' or 'metaphor' as in the case of these three days. There are various places in the Old Testament that give special meaning to three days.  The gospels however only refer to the prophecy of Jonah. Christ said that Jonah would be the 'sign' that God would give the Jews, as a rebuke for their obstinacy. (Math 12:39-40). As Jonah was buried in a watery death for three days, then spit out and believed upon by Gentiles, so would Christ be buried in the belly of the earth and spit out miraculously to be believed on by the Romans and Greeks.
Beyond this single prophecy, there does seem to be more in the Bible and in rabbinic history that enshrines a three-day significance. The main idea seems to stem from Abraham arriving at Mount Moriah to sacrifice his son, on the third-day (Gen 22:4). This is another resurrection image no doubt. The idea is that Isaac was good for dead all three days until God provided a ram in his place.  From this the third day, there seems to have become some concepts of a third day resurrection, further supported by Hosea 6:2. Notice though that Rabbi's often differed among themselves, just as we do with Revelation, so the three days in Hosea 6:2 was interpreted by some as 3000 years.
Despite the differing historical interpretations by the Rabbis, it cannot be denied that this three-day-theme existed before Christ. Still the bottom line is that in the New Testament Christ's reference to Jonah is enough to fully satisfy the statement that Chris was raised on the third day 'according to the scriptures' (I Cor 15:3-4) The Old Testament three day theme is mostly of supplemental interest.
For a deeper analysis on the three day theme, there is an excellent little article by Michael Brown at JewishRoots.net here.
Comment: Yes Hosea was what I was referring to, I can see the theme of 3 days other places, but for prophecy specifically in the terms I think most people will think of it, Hosea 6:2 seems to be the only OT prophecy that deals with it. And according to that article, early christians felt that Hosea was clear about that too. Thanks for the link, I'll probably be back there often, I've been studying hebrew and Judaism lately. God Bless!
Answer: There is also the foreshadowing in the book of Esther.  When Haman maneuvered the decree to kill the Jews, it was Nissan 14 (the day Jesus was sacrificed,) Esther told the Jews to fast for three days with her before she went to the King.  No food or water, a fast to the death.  On the third day, she went to the king and their deliverance came.
There is another tie in with Esther in that Herod the Great died on Purim in 4 B.C shortly after commanding the murder of the innocents.  Some sources say that it was done at the same time he commanded the murder of his oldest son, which was 5 days before his own death.
Purim was the day chosen by lot by Haman for the annihilation of the Jews and they continue to observe the date and celebrate God's deliverance.
Comment: Welcome to the site. We are glad you decided to participate. I don't see a connection in the second and third paragraphs. Can you expand on that and [edit] this post please? I hope to see you post again soon.
Comment: @carla - See also 1 Samuel 30:1, 1 Samuel 30:12,13.  David is at a very low point in his life, and obtains deliverance from an unexpected source - a nearly dead man, a despised and rejected suffering servant, is resusitated after "three days and three nights" and enables David to gain victory over his enemies, so that nothing is lost that was taken.  In the end, the Devil shall have gained nothing from the children of God, and all of them shall be saved.
Answer: The only prophecy specifically stating that Messiah would be "dead" for three days, came from Jesus himself, shortly before his passion, when he began to reveal to his disciples what was to befall him. There are many, many specific prophecies in the OT about the Messiah, but none that state how long he would be in the grave. If memory serves. Doubtless some or all of the three-day periods were foreshadowings, but that will have been all they were.
Comment: Welcome to the site. As you're a new visitor, I'd like to recommend the following posts, which are meant to help newcomers "learn the ropes": [help page](http://christianity.stackexchange.com/help), [How we are different than other sites?](http://meta.christianity.stackexchange.com/questions/1808/how-we-are-different-than-other-sites) and [What makes a good supported answer?](http://meta.christianity.stackexchange.com/questions/692/what-makes-a-good-supported-answer)
Comment: Mr B, I've just read your links, and quite a few of the links within them. Let's see if I've got this straight. The last sentence of my answer above would be less acceptable, the rest more so, as it specifically references clear-cut statements that either are or are or are not contained in the text of the old testament. The last sentence is more my personal take on certain passages mentioned by other answerers. Please set me straight if I'm still not "getting it".
Answer: My favorite is Exodus 19 when God tells Moses be ready for the third day. FOUR TIMES in one chapter.
  Moses name means "to be drawn out of the water" representing all born again believers. At the end of the chapter it says (paraphrasing) "When the Lord came down, Moses went up" A picture of Christ coming down on the third 1000 year day. 2015 two days past, we are going into the third day. When he comes down we go up.
Comment: Since when is a day a thousand years? A prophetic day is almost always interpreted as a single year.
Comment: This answer would be better if you could provide references for who teaches/believes this. Remember, this site isn't for personal opinion, but for academic Q&A.


How can I convert screen space to GUI Space/View Space?

Question: Is there any way available to convert screen space into view space as like in the following figure:
Comment: So just to clarify, from the last image (right most) to the middle one?
Comment: yes as name given below
Answer: Assuming that you know the values of Camera.pixelWidth and Camera.pixelHeight, you can get from the last picture to the middle one by simply dividing your ScreenSpace coordinates respectively by Camera.pixelWidth and Camera.pixelHeight.
Vector2 screenSpacePosition = new Vector2(100, 100);
Vector2 viewportSpacePosition = new Vector2(screenSpacePosition.X / Camera.pixelWidth, screenSpacePosition.Y / Camera.pixelHeight)

Answer: Can't you just use Camera.ScreenToWorldPoint or Camera.WorldToScreenPoint?
As you can guess from methods names, they are transforming screen position to world position, and vise versa.
The only thing you need to take into account is Z axis, which will be same to Z value of camera position.


Aperture vs Photoshop

Question: I already have a lot of experience in Photoshop because I normally use it to edit my photos, but I've heard that Aperture is far better (or easier to use) than Photoshop. I started using the trial version but it's not that good. It's just like Lightroom. Is there any difference if i buy the full version? Also, does Aperture support plugins?
Comment: Check out also [Photography stack site](http://photo.stackexchange.com/) and its [apple-aperture tagged questions](http://photo.stackexchange.com/questions/tagged/apple-aperture?sort=votes). And like you thought: it makes more sense to compare Aperture to Lightroom than either one to Photoshop.
Answer: I'm currently making the transition from Lightroom over to Aperture. You are right in that Aperture is more like Lightroom than Photoshop. Its primary use is as a digital library for managing your photos, and videos. Much like iPhoto.
Lightroom and Aperture both have good editing functionality and both have the ability to use plugins for expanding the editing functions.
Both applications also allow non-destructive editing. Meaning you can always go back to the original image no matter what changes you do to the image within the application.
Aperture, like Lightroom, is designed with the photographer in mind. Digital assest management, photo editing, and exporting abilities for printing etc...
It's best to use either (or both) of these alongside Photoshop. I use Photoshop when it comes down to the heavy editing, or when I"m trying to do something more creative with the image outside the abilities of the other two applications.
I'm still learning Aperture so I cannot comment too much on its strengths and weaknesses vs Lightroom. Here is a post by Scott Bourne as to why he uses Aperture over Lightoom.
Hope some of what is here helps.
Comment: +1 Think Photoshop is tool to do almost anything to an image. Aperture/Lightroom are more libraries to store your images and perform certain corrections to them, but neither have "layers" and all the tools that make Photoshop the "most complete" (yet annoying in a lot of aspects) tool for digital image editing. You can configure Aperture to call photoshop at any time (it will generate a new version of the image to preserve the previous).
Answer: Using Aperture/Lightroom require a different way of thinking to Photoshop.
Personally I use Lightroom as it is more like the traditional darkroom process. It's also quicker for getting lots of images out the door, which works well with my style of photography (motorsport), the editing functions aren't as deep, but they are pretty much the same as Adobe Camera Raw in Photoshop. Aperture is slightly different, but the same sort of style. Both Lightroom and Aperture have great image management databases which help my workflow a lot.
It is down to personal preference, although at 1/10th of the cost of Photoshop, Aperture is a bit of a bargain, if you can live without the extra editing features.
Answer: The Aperture trial is the full version so if you're not happy with it buying it may not make you any happier.
When you say Aperture isn't that good, just like Lightroom you imply that both Aperture and Lightroom aren't that good (compared with Photoshop) for your needs. You may have answered your own question.
Many photographers shoot RAW and Aperture and Lightroom are built for editing RAW files. You can do this with Photoshop too but the Adobe RAW converter is needed to get a similar workflow to Aperture and Lightroom.
Simply put, if you shoot RAW the deeper EXIF information isn't stripped out of your image by the jpeg compressor and a RAW image editor like Aperture or Lightroom will display that deeper EXIF information and allow you to control it after the image is taken.
For example, if you make a series of RAW images of friends in a room with incandescent light, those images will probably look a bit too warm or red. Lightroom and Aperture (and Photoshop with ACR) will allow you to quickly and easily use a pull down menu, choose "tungsten" and alter the white balance, usually perfectly on one or all of the images. Lightroom and Aperture both allow you to do things like this to batches of images with the same corrections needed. These kinds of batch processing tools speed up the processing of large groups of images.
You don't have to shoot RAW to change things after the fact in an image but the amount of control you'll have over a RAW image will be greater as it will contain more information for the RAW editor to latch on to and offer tools for.
If you routinely do heavy editing on individual images, HDR, cutouts, and use images in larger graphic design projects you'd certainly want to have Photoshop or other image editing software.
If you routinely do lighter editing on photographs, want to edit in batches, want better control of fine art printing, and want more of a photographer's workflow/process on working with images, Aperture and Lightroom are tools to consider.
And, as others have said, it's not all or nothing, you can use Photoshop on top or (or underneath) Aperture and/or Lightroom for occasional heavy editing.
As for which is better, Aperture or Lightroom, that's a personal preference having more to do with UI and tools and feelings about Apple and Adobe.
I use Lightroom even though I've had Aperture for years. I used them side by side for a while and while I prefer to use Apple products than get sucked into the Adobe world, for me, Lightroom is the better product with better image editing tools and a faster user interface on a wider variety of computers. It's noise reduction tools are so good they're worth the price alone. But, it goes much further with lens correction tools built in that correct for pincushion, barrel and lots of other distortions that many lenses (even high end lenses) make. I do a lot of architectural photography and the lens corrections are a spectacular feature for me.
And, while I'd prefer to stay within the Apple fold, Apple has a checkered history supporting and/or updating their "pro" products. People's unhappiness with what Apple has done with Final Cut Pro is an example of this.
I also have iPhoto on my computer and use it to capture my iCloud photo stream and while Apple products are better integrated into the Lion/iOS ecosystem, I still use Lightroom because it works better as an image editor for me.

Aperture vs Photoshop


recover data on external drive

Question: I lost all my data on an external hard driven and need help getting it back.
I first installed ubuntu 12.04 64bit in dual boot along side windows 7 64,then I updated and installed all the programs that I wanted. I then wanted to create a backup,so I went in the terminal(on live boot cd) and I cloned my 250 gig hard drive partition onto my much larger 1tb external hard drive. Well the dd did a good job and created a 250 gig partition on my drive, but now all my data is gone. when I look at the hard drive in windows, it says there are 3 partitions, one smaller partition, one cloned drive partition, and about 700gigs of unallocated space. I looked on the Internet for solutions, and I followed some instructions to use testdisk to locate missing files.
On test disk, I selected Create new log file, then I selected my 1tb hard drive, then I selected intel and went quick search. No results displayed. I then did deep search and let that run from 0% to 100%. I was able to see only the files of the partitioned portion. There was a few non ntfs folders displayed as linux, but I could not see any files in them it only said something about corruption and cannot display or something like that.
Long story short,I scanned my driver two times which took about 6 hours. Is there a way I can still get my information back?
Answer: first of all you should install the photorec tool. tpye in terminal.
         sudo apt-get install photorec
after installing that enter the terminal as follows
         sudo photorec
it will definitely recover all the data from your disk

recover data on external drive


As of now did a radio telescope ever recorded something else than the silence of space?

Question: When a radio telescope listen to the Universe; a constant sound is recorded. Is it the noise "of the mic" : interferences? Scientists says that when they will notice variations on this basic constant same noise I call "the interference coming from the mic" they will conclude on an extra terrestrial source of sound; but in fact if is waves that are "listen" to. So, any news?
Comment: Vote to close because unclear what you are asking. This is probably not astronomy related, and not scientifically posed in any case. You can ask us and look at other questions and answers to understand how to improve the quality of your question and gets a good answer.
Comment: We don't just hear a 'constant sound'.  Just as a star is a point source of electromagnetic waves in the visible frequencies, it is also a point source of electromagnetic  waves of frequencies above and below that of light which a 'radio' telescope can detect.

When we turn those various EM waves into a light spectrum so we can see a picture they can be quite beautiful.  If we don't turn them into colors and simply plot them as we do on a frequency analyzer they look like any other point source of electromagnetic energy - a frequency with a bandwidth, much like a radio or TV station signal.
Comment: Continuing the comment above, the signal will appear as a higher 'noise floor' since the EM energy is not coherent.  Just as you point an antenna towards the TV station to receive a better signal so too do we turn our radio telescopes toward a star to receive a stronger signal from it.

Lastly, google the "Wow! signal" to see what the data looks  like in raw form - spoiler - it's just a bunch of alphanumeric values.
Answer: Space is not quiet at all and is actually very noisy when listening via a radio telescope.  There are many sources of radio emissions in the universe, with pulsars being a very common one.  They can be quite interesting to listen when the signals are converted into sound frequencies we can hear. They range from slow clicks every few seconds to high pitched buzzing.
Here's a link with some examples:
http://www.parkes.atnf.csiro.au/people/sar049/eternal_life/supernova/pulsars.html
When using a wide angle antenna or one that uses a wide band of frequencies the mixture of all these emissions at once would just sound like background static.


Is there a Yoneda lemma for categories other than Set?

Question: The Yoneda lemma says (in my understanding) that instead of studying a category directly, you can study that category's relationships between its relationships into Set. Is the function of Set unique here? Or can other categories like Top do something similar? If so, what are some examples? If not, what is unique about Set? Thank you.
Answer: In the case of enriched categories, there is an enriched version of the Yoneda lemma.
Comment: The short answer is that you're right. The longer answer is that the category of sets still holds special importance since when you enrich, you enrich in a category $\mathcal V$. That $\mathcal V$ is a category whose homs sets are, well, sets. Namely $\mathcal V$ is a Set-based category (a category enriched in Set). So, even if you insist of 'eliminating' Set by considering enriched category theory from the get-go, you still have Set right there at the bottom of the pyramid.
Comment: So the category of sets isn't unique, it just happens to be the category that applies to the sort of categories that are first studied when learning category theory?
Answer: There are two ways to interpret your question. Identifying the role of Set in the Yoneda lemma as the category where your categories are enriched in reveals that if you consider $\mathcal V$-enriched categories, than Set there will change to $\mathcal V$ and you get the enriched Yoneda lemma.
Another way of interpreting the question is whether for ordinary categories (or more generally for categories enriched in a fixed given $\mathcal V$, but let's just keep everything simple by considering just ordinary categories) one can replace Set by another category and still make things work nicely. Now, thinking of the Yoneda lemma as turning an abstract category into a category whose objects are sets and whose morphisms are functions, namely as representing an abstract category as a subcategory of something absed on Set (generalising Cayley's representation of an abstract group as a group of permutations) what we are asking is if there is a category $\mathscr C \ne \mathbf {Set}$ such that any abstract (small) category can be represented as a subcategory of something based on $\mathscr C$. (Yes, this is a bit vague.)
The answer is trivially yes, simply by taking any category that contains $\mathbf {Set}$ as a subcategory (so in particular $\mathbf {Top}$ will work). However, there is more to the Yoneda lemma than just the representation. It is really tightly related to representable functors. So, we are asking not just to represent an abstract category, but to represent it in a very particular way. Adding this condition into the question leads to asking: is the codomain of the Yoneda lemma $\mathscr D\to \mathbf{Set}^{\mathscr D^{\mathrm op}}$ unique in some way? The answer is that it is, namely it the cocompletion of $\mathscr D$. So, in this wider context, the base category being $\mathbf {Set}$ is forced.
Comment: I think what you are trying to express is correct.
Comment: Thanks. If I could ask a question for clarification, is this "very particular way" in which **Set** represents a category referring to a "full and faithful" representation? Like, is the Yoneda lemma basically saying that any small category can be represented in a particularly satisfactory way by relating its objects to sets and its morphisms to functions between sets? I.e., small categories "boil down" to sets and functions in a particularly "clean" way? And hence the role of hom functors in defining a category? Sorry if that sounds pretty ignorant.
Comment: It seems we cannot get rid of $(Set.)$.. I find that unsatisfactory if $(Set.)$ is not proved to be the universal category that makes Yoneda lemma true. Is there such a proof?
Comment: In a sense it is. The definition of category makes essential use of the category of sets, i.e., after defining categories one quickly arrives at the enriched category concept and discovers that one's categories are precisely categories enriched in Set. Then the Yoneda lemma is the Set version of the enriched Yoneda lemma.


How to clear Skyrim SE console

Question: I'm playing Skyrim Special Edition on Steam. Suppose I want to clear all content on the console (without quitting to Desktop and restarting), what is the command to do so? I'm thinking of something like "cls" on Windows command prompt. I've looked around the Internet and haven't found any search results indexed by Google. Is there such a command?
Comment: I have been looking for an answer to this for years, but have not found one. Nor have I seen any mods for the same.
Comment: Can I ask why??
Comment: @kaizerwolf -- why what? If you're asking me, there are times I just want to clear clutter.
Answer: I've been assured that the vanilla console simply has no documented way to clear the console. At this point, I'm considering absence of evidence proof that this is so. That being said, I learned of a mod that does have a "clear" command that does exactly that.
More Informative Console for Skyrim SE. There is a lot you can do with that mod, but for me, all I have to do is type "clear" and I have what I wanted: a clear console without the clutter.
Comment: Can you link to or quote those confirmations? I've always assumed the same, but the only answer I could condense was that 'we don't know'.
Comment: Nothing written. Maybe "confirmed" isn't the right word. More like multiple people also telling me that they have not found any documented way to clear the console in the vanilla console.

How to clear Skyrim SE console


Calculating the difference in heat loss from human body in different environments

Question: I'm interested in personal cooling devices and would like to know if there's a way to make a rough estimate of rate at which you would need to extract heat from the body of an average male walking in weather of say 34 deg C and relative humidity of 90% in order to reduce body temperature to what it would be if walking in the same clothing (say slacks and a T-shirt) at say 24 deg C and RH of 75%. I don't know if there's any kind of model out there or if you have to work it all out from scratch.
Comment: Lots of info about heat transfer from human bodies, effects of relative humidity etc. I will let you do a search, but one important factor is the temperature difference between the body and the environment, and then core temperature if the body gets too cold.
Comment: I am a runner, have run 29 marathons, and will run again next Sunday at LA marathon.  I know how big a difference heat and humidity can make.  We all have our own little trricks,  I take sea salt and potassium. I produce roughly 90 watts when running and burn around 4500 calories during 26.3 miles.
Answer: The implicit goal appears to be to keep the temperature of the object (the human body) constant independent of changes in the external conditions (clothing, air temperature, wind speed, humidity). The simplest model is a lumped approach.
Let's assume the body is always warmer than the surroundings. The heat extracted by the surroundings is
$$\dot{q}_{x,s} = U A \Delta T$$
where $\dot{q}_{x,s}$ is the heat removed by the surroundings (W), $U$ is the effective heat transfer coefficient of the external surroundings (W/m$^2$ K), $A$ is the area of the object (m$^2$), and $\Delta T$ is the temperature difference between the object and surroundings (K). The person produces $\dot{q}_p$ heat depending on the effort. Finally, your cooling device extracts $\dot{q}_D$ heat. The vector sum is zero.
$$0 = - U A\ (T_o - T_s) + \dot{q}_p - \dot{q}_D $$
Your problem reduces to one of determining $\dot{q}_p$ and $U$ for different conditions. You could start with a constant "resting" heat production value $\dot{q}_{p,o}$. Start also with estimated values for the overall convection heat transfer coefficient for a "naked" object sitting in different air conditions (humidity, wind speed). This will give you a ballpark on what you need for $\dot{q}_D$ for a naked person resting in different air conditions. Add clothes by increasing $U$. Add walking to running effort by increasing $\dot{q}_p$.
This ignores radiation. Radiation can be added back as an additional term in the energy balance as desired.


Why does the complexity of the particle filter scales exponentially with the number of dimentions?

Question: In the AI for Robotics course from Udacity, Sebastian Thrun mentions that "the complexity of the particle filter grows exponentially with the number of dimensions". Why is this the case? We have to keep track of $n$ particles each of which has $d$ dimensions so wouldn't the memory complexity be $O(n*d)$?
Answer: You need enough particles so that you can sample across each of those dimensions.
If I have a particle filter with just X position, and my particles are spread in the range [0, 1], I might need, e.g, 3 particles: {0, 0.5, 1.0}.
If I have a particle filter with (X, Y) position and both dimensions have  the same [0, 1] range, then I need one particle for every combination of X and Y: {(0, 0), (0, 0.5), (0, 1), (0.5, 0), (0.5, 0.5), (0.5, 1), (1, 0), (1, 0.5), (1, 1)}.
Answer: It's the number of particles that will grow exponentially. An array of particles, with $n$ particles in each dimension, with $d$ dimensions, will have $n^d$ particles.


Install Ubuntu on UEFI without Windows or Boot Loader

Question: I have a Gateway netbook that has already been fully wiped with nothing on the hard drive. There is no Legacy option in bios and the only thing I can boot from the USB is a Gparted disk utilizing Grub/EFI loader in which I can partition the drive. But nothing else will boot from USB including Boot Repair, ReFINd, multiple Linux Live CDs, or Super Grub disks. Ubuntu installation disks won't show up, there is no boot loader on the hard drive and I don't know how to get anything installed. It seems to be a UEFI motherboard PC without a bios boot option. All the articles I am coming across deal with dual boots on EFI, or Windows 8 machines. Mine was a Windows 8 preinstalled machine that no longer has Windows on it. Any guidance on installing a boot loader and Ubuntu would be much appreciated.
Comment: Part of the problem might be Secure Boot. Look for an option to disable it in your firmware. Details vary greatly from one machine to another, though, so I can't give you precise details. See [here](http://www.rodsbooks.com/efi-bootloaders/secureboot.html#disable) for a few samples.
Answer: There is much variation in hardware, but I was able to boot to an Ubuntu 14.04 live USB in UEFI / Secure Boot mode by doing the following:
1) Download the Ubuntu distro you want. It must be the 64 bit version.
2) Install the distro to USB stick using PendriveLinux.com's Universal USB Installer.
3) Power off the PC, insert the USB stick, and power on.
4) Hold down the appropriate key to enter the BIOS.
5) Change the boot order so that the USB stick is first
Note, unlike regular BIOSes I am used to, you have to do this step EVERY TIME YOU WANT TO BOOT OFF USB.  The boot order changes are not persistent!  In fact, my UEFI BIOS does not even offer me this choice unless a UEFI bootable USB stick is currently inserted  Until I figured this out, I was in the same situation as you, I could not get it to boot off USB at all.
6) Exit the BIOS "saving" your changes and allow the boot to complete.
Comment: There is no additional tool necessary to "install" to content from the ISO on to the USB stick, just mount the file or open it with a tool like 7z to copy or extract the files to the root of the USB stick. Good point though that you need the amd64 version to boot UEFI.
Comment: Thanks a bunch. I ended up solving this issue by doing what I explained below.
Comment: I'm sure you are correct; I was merely recounting what worked for me, so not everything I list may be necessary.
Comment: There is either BIOS or UEFI. No UEFI BIOS.  So I guess you are talking about UEFI, right? Just to avoid some confusion.
Answer: I ended up solving this issue. I found out that even though the netbook was a newer model it was actually 32 bit. Therefore none of the 64 bit disk images would boot because they only contained 64 bit EFI drivers. I ended up...

Downloading a 32 bit version of Linux Mint (which didn't have EFI support).
I took the EFI folder from Gparted boot disk (which also had 32 bit EFI drivers) and copied it to the Linux Mint USB. This explains why only the Gparted disk would boot when others wouldn't.

Booted instantly, installed successfully, and is running like a charm. Loving Linux Mint 17!!!
Comment: Oh my god, what an exotic hardware haha


FQL time timezone offset wrong?

Question: I've been pulling some info from Facebook status feed and I'm just wondering why I need to add 7 hours to the times to match up with my timezone? Normally I'm +10 and with daylight savings I would be +11 so I'm not sure why 7 hours works?
Answer: There are a couple possibilities.  If -7 hours equals PST than you're receiving data in Facebook's (sometimes) default timezone -- from Palo Alto, CA.  If it is something else you may want to see if it matches the location/timezone for the location of the user account.

FQL time timezone offset wrong?


SSL/TLS Question

Question: I am currently working on my SSL/TLS assignment and I got a question to ask. What is the use of a login password since it is not needed for establishing secret communication between your computer and a secure server?
Comment: If a cop pulls you over on an empty road, you and the cop are having a private conversation.  Why does he need to ask you for an ID?
Answer: SSL/TLS provides confidentiality and integrity, but does not provide authentication for the client ( well technically it can using mutual SSL authentication, but this has its limitations as you would need to disperse your client certificate across all your devices). A password is easier to use as the user can remember it more easily.
Answer: The common SSL/TLS implementation found on the Internet is not used to authenticate users into web applications, but to provide different perks.
By encrypting the data channel between the client and the server, SSL/TLS is able to preserve the confidentiality and integrity of the transmitted information, preventing attackers from sniffing the coomunications.
Furthermore, SSL/TLS provide a way to confirm the identity of the web server that the user is trying to reach.
This implementation does not cover the authentication to the web application the user wants to browse. Hence, credentials are needed and SSL/TLS do not replace this need.
As a side note, remember that SSL/TLS could also be used to provide mutual authentication between the server and the client. Even if this solution is rarely employed, it could replace authentication credentials.

SSL/TLS Question


Standard input as a plain-text

Question: how to give standard input --stdin by using < symbol,as a plain text(string) in bash script,
For example i have stored /etc/passwd file by using redirecting > symbol by the same way i want to give plain text as a input
Comment: Apart from using `<`, are you concerned about _plain text_ in any particular way? Your question mentions _plain text_ three times.
Answer: To redirect from stdin, you don't use < you use |. For example (apologies for the useless use of cat)
cat /some/file | my_program

If your "stored /etc/passwd file" resides in a variable, and you are not tied to /bin/sh, you can use the <<< redirection
my_program <<< "$my_variable"

Answer: Exactly as you describe, with the indirection (<) operator:
/path/to/executable < /path/to/inputfile

Standard input as a plain-text


Are black holes naked singularities for an observer within the event horizon?

Question: A naked singularity means that you can see an infinitely dense thing. Black holes don't count because it sucks up all the light, so you won't see or otherwise detect it. But wait, if you are within the event horizon, would the black hole be a naked singularity from your view, since now you can see the infinitely dense center?
Comment: Depends on the black hole. In some cases the singularity will be in your future and you will not see it until then.
Comment: It appears that during the process of spherically symmetric gravitational collapse, the singularity may be locally naked (for many, perhaps almost all, equations of state and initial conditions): Joshi, https://arxiv.org/abs/1405.1146
Answer: The event horizon isn't like a heavy cloud cover that you can "break through" and see clearly again on the other side. The event horizon actually isn't a physical thing at all, just like any other border isn't a real thing. If you're hiking through the Sahara you might pass from one country to another and not know it: there's no line drawn in the sand to mark the border. Likewise with a black hole, you don't notice when you're crossing the horizon because there's no immediate change in your surroundings.
Remember that the horizon is just a 'border' which marks where the escape velocity raises above luminal speed. As you fall into a black hole, light is still falling in on you from the outside universe, but closer to the singularity the escape velocity is even higher than where you are; so looking toward the singularity, you see the horizon retreating from you as you fall in - even after you've already crossed the horizon.
Comment: This doesn't answer the question.
Answer: If you are falling into a Schwarzschild black hole you will never cross an event horizon. As you fall in you observe an apparent horizon that retreats before you as you fall inwards. The distance between you and the apparent horizon reduces as you fall, but it only goes to zero when you reach the singularity.
If you're interested to know more about this have a look at the questions Taking selfies while falling, would you be able to notice a horizon before hitting a singularity? and Would the inside of a black hole be like a giant mirror?.
So you will not observe a naked singularity at any point as you fall inwards.
I've restricted this to a Schwarzschild black hole because the charged and rotating black holes have the complication that there are two horizons and the singularity is timelike not spacelike, and an observer can fall in through the two horizons and back out of the black hole again. I don't know whether an observer could observe the singularity in these geomeries, but it seem possible that they could.
Answer: Basically what Asher said, and I love thought experiments like this, so I can't resist posting an answer too.
You couldn't see a singularity from inside the black hole for basically the same reason you can't see it from outside the black hole.   No light from the singularity reaches you unless you're actually in the singularity, which probably wouldn't be much fun.
If you imagine yourself inside the event horizon of a black hole, everything inside the black hole is moving towards the singularity, nothing is coming from the singularity towards you, so all you can see is stuff that came from the universe falling into the black hole.    Now, red shifts/blue shifts and curved space, anything you see would be hugely warped and much of it, spagetified and extremely difficult to recognize, but that's all you'd be able to see.   No singularity.  You might even be able to see the entire future of the universe, but still, you wouldn't see the singularity.
You might be able to see hawking radiation from inside the black hole (at least, I see no reason why you wouldn't) and that would likely increase in intensity as you approach the singularity, but what you observe wouldn't be the singularity but simply an effect on space by the singularity.   Also, since a singularity is, in theory, smaller than an atom, I'm not sure what you'd expect to see anyway.   :-)
If you want to get really creative about this, it might (I'm not sure), but might be possible to see a singularity in a Kerr black hole without going inside, but that's above my pay grade and I repeat.  I'm not sure.
Rotating black holes and naked singularity


Can't find a rear replacement wheel 29" x 2.125 coaster brake - single speed

Question: Trying to repair my son's motor bike. He wore the brake pads down to the metal and damaged the rim. I'm trying to find a matching 29" x 2.125 - coaster brake - single speed wheel. I'm also wondering if a slightly narrower rim and tire would be compatible or would that cause any problems?? No luck in my search so far... desperate!.. Any help would be greatly appreciated.
Comment: motor bike? with rim brakes?
Comment: Might be a bicycle with an added motor kit. They're getting pretty common. I've seen a bunch of BSO's converted this way.
Comment: Have you been to a bike shop? They should be able to lace up the existing hub with a compatible rim for the size of tire you want to run without too much work.
Comment: A 29" wheel with a coaster brake is a hair unusual.  As to the narrower tire, it should cause no problem.
Comment: You'll also need to find out why the brakes wore out - were they maladjusted or is the handle reach too great so the rider had them half-on all the time?
Comment: Rim brakes worn down but a coaster brake as well?
Answer: If you're in the US then almost any bike shop can easily order you this wheel from J&B Importers, or this one. Those have Weinmann 519 rims, which are kind of more hybrid than cruiser/mountain - around 24mm wide, whereas a proper balloon tire cruiser rim is around 30-32mm. But if you want to go narrower than what's probably on there, it will be fine.
A bunch of dealer-level brands have made 29er cruisers, Torker and Felt in the US market that I can think of offhand, so one way of procuring an inexpensive pre-built 29er coaster cruiser wheel can be from them through their dealers. Usually that kind of thing will mean a call from the dealer to the company to see if they have any as replacement parts, as opposed to being a normal catalog item. Torker is a mostly non-territorial  brand of Accell North America that most shops with an account with them (which, again if you're in the US, is most of them) can get, so if a Torker T29 (the name of their fairly long-running 29er coaster brake cruiser) rear replacement wheel is available, any shop you want to work with can probably get it.
If nothing in that direction pans out, or if you want to spend a little more to get higher quality, then just building such a wheel is something any good shop can do.


Howto safely reboot a hanging raspberry without SD card corruption? (reset button vs. power cycling?)

Question: Occasionally my headless Raspberry Pi becomes unresponsive.
I have configured the watchdog, but it doesn't always kick in.
So I have added a reset button which does a hard reset by connecting the GLOBAL_EN to GND.
Another solution would be to just cut off the power.
Is there a difference between those two solutions with respect to SD corruption?
Answer: It will make no difference.
Cutting power will actually take a short time for capacitors to discharge vs instantaneous
PMIC reset.
I would install a button and activate the shutdown overlay to see if this works.
See https://raspberrypi.stackexchange.com/a/42945/8697
Comment: I think that any operation that forcibly interrupts SD card writes can lead to data corruption. A hard reset of the CPU can do that, as well as a power cut. But what about wear leveling operations of the SD card itself? These will be interrupted hard by power off but possibly soft by a CPU reset.
Comment: That wasn't the question you asked. I was not recommending either.
Answer: Connecting GLOBAL_EN to GND is not a safe shutdown. Removing power from the RPi while it's running is also not a safe shutdown. A safe shutdown is one in which any pending writes to the SD card are completed before stopping the processor.
The simplest solution to your problem may be the "one-button ON-OFF" switch. It's described in this answer. If that doesn't do it for you, follow up here in the comments & I'll come up with something else.
Comment: From my understanding, using the GPIO overlay creates an interrupt which means that the kernel still needs to be responsive to interrupts, which may not always be the case with a hanging system. As my system only hangs occasionally, I cannot tell, if the GPIO overlay will solve my issue. Nonetheless, I will give it a try and accept your answer as a solution.
Comment: @user333869: The overlay signals the processor to issue a `shutdown`, so yes - if your system cannot issue the `shutdown`, then this will not help. That said, it seems far more likely to me that the *"hang"* you see is due to the communications link between your terminal and your RPi. If you can measure the current being drawn by your RPi, you should be able to detect a significant reduction after the `shutdown` is issued. Hope that's clear...


Sony a77 doesn't recognize Rokinon 85mm manual lens

Question: So, I'm having a bit of an odd issue with my Sony a77. When I mount my Rokinon 85mm lens to my Sony a77, it acts as though I haven't attached a lens at all. What's up with that? O.o
Comment: I'll second @godfatherof polka's comment re focus peaking. This is extremely useful and allows easy rapid and precise focusing on specific points. In complex scenes where the desired focus point is surrounded by objects at other distances, focus peaking + manual focus allows easy focusing where even the very best AF may have problems.
Answer: I am not familiar with this exact lens and camera model, but with similar questions related to Sony Alpha cameras and manual focus lenses. I assume your camera gives an error message similar to the following: "Check the lens attachment. If the lens is not supported, you can permit use of the lens in the custom menu."
I suspect the reason for this is that the Rokinon 85mm lens does not have any electronic contacts (as it is a manual focus lens and these contacts are mainly used for auto focus) and the camera thus does not 'see' the lens (because the camera 'sees' the lens by communicating electronically with the lens via these contacts). See also http://community.sony.com/t5/Alpha-SLT-DSLR-Cameras/A77-Lens-Compatibility/td-p/27585 (On a side note, the contacts I mention are the five golden squares in this picture of an A-mount lens, whereas this picture of the Rokinon 85mm shows that it doesn't have any.)
In order to overcome this problem, you can enable the "Release w/o lens" option as follows:

MENU button, then "cog wheel" 1, then Release w/o Lens, then Enable

See Sony a77 manual, p. 175. This way, you're telling the camera it's ok to release the shutter even if it thinks no lens is attached.
By the way, as the Rokinon 85mm is a manual lens, it's very worthwhile to look at the manual focus support of the Sony a77, see the manual, p. 123. In particular focus peaking is an extremely useful feature.


How to extract account network in Polkadot JS Extension

Question: Is there a way to extract the selected network of an account, that is configured through the Polkadot JS Extension, through accounts.subscribe?
Answer: No directly, but you can get that value.
With the script below you get your accounts with its meta information (as you mentioned):
    import { web3AccountsSubscribe } from '@polkadot/extension-dapp';
    await web3AccountsSubscribe(( injectedAccounts ) => {
        injectedAccounts.map(( accounts ) => {
            const accountMeta = accounts.meta;
            console.log(accounts.meta);
        })
     });

The meta information has this format:
    {
    "genesisHash": "0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3",
    "name": "testingB",
    "source": "polkadot-js"
    }

From here we need the genesisHash because is the hash of the network you are looking for.
You can compare it with this file of genesis strings to get the name of your network: https://github.com/polkadot-js/common/blob/master/packages/networks/src/defaults/genesis.ts
In my example is Polkadot.
If is a network registered in this list (Testnets like Westened from your example are not included): https://github.com/paritytech/ss58-registry/blob/main/ss58-registry.json
You can query all the networks using the @poladot/networks library and create a function to find the network information of the genesisHash of your account:
    import { allNetworks } from '@polkadot/networks';
    console.log(allNetworks);


meta query based on month regardless of year

Question: For each user on my site I store a birthday using ACF date field (stored as YYYYMMDD).
Is there a way to construct a meta query to retrive all users that their birthday on that specific month regardless of the year?
Comment: It would be ***significantly*** faster to also store the month as a term in a private taxonomy. This would allow a much simpler query that would be hundreds of times faster than relying purely on post meta. What you've requested may be functional but the query will get slower and slower as the number of posts increases
Comment: I see what you mean, but I am talking about a user query and not posts query, so a taxonomy is not relevant for this
Comment: That is not true, users can have taxonomies too, all object types can have taxonomies
Comment: I was not aware of this. I'll look into it. Thanks
Answer: While the regexp solution will function, it quickly gets slower as the number of users increases. This is because the database cannot perform optimisation and indexing tricks, and forces a full table scan. The more users, and the more meta, the greater the cost of the query. At a minimum it requires caching to avoid a worst case scenario.
This is true of all meta, be it post meta, comment meta, term meta or user meta. Searching for things by the contents of their meta is super expensive.
But it can be avoided.
As well as storing the data in a user meta key/value pair, register a private/non-public custom taxonomy. When the user saves their profile, set a term on that user in this taxonomy using the month as a value.
Then, you can use an ultra fast query to get users with that month.
First, register the private user taxonomy:
function hidden_user_taxonomies() {
    register_taxonomy( 'birthday_months', 'user', [
        'label'        => __( 'Birthday Months', 'textdomain' ),
        'public'       => false
        'hierarchical' => false,
    ] );
}
add_action( 'init', 'hidden_user_taxonomies', 0 );

Notice the object type here is not a post type, but user, and that public is set to false.
Then, we hook into user profile save, and set the term for that user:

add_action( 'personal_options_update', 'save_hidden_birthday_month' );
add_action( 'edit_user_profile_update', 'save_hidden_birthday_month' );

function save_hidden_birthday_month( $user_id ) {
    $birthday = get_field( 'birthday field name' );
    $month = ... get the birthday month out of the string....
    wp_set_object_terms( $user_id, [ strval( $month ) ], 'birthday_months', false );
}

Now we have a hidden user taxonomy that contains terms for each month of the year, and users are assigned to those months when their profile is updated. Also notice the intval call, this is so we store 4 rather than 04.
So how do we fetch the users? Simples:
function users_in_birthday_month( $month ) : array {
    // fetch the month term
    $month = get_term_by( 'name', $month, 'birthday_months' ); // who has birthdays in July?
    if ( !$month ) {
        // nobody has a month in July as there is no term for July yet
        return [];
    }
    // fetch the user IDs for that month
    $user_ids = get_objects_in_term( $month->term_id, 'birthday_months' );
    if ( empty( $user_ids ) ) {
        // there were no users in that month :(
        return [];
    }
    $user_query = new WP_User_Query( [
        'include' => $user_ids,
    ] );
    return $user_query->get_results();
}

So to get all users with a birthday in July?
$july_birthdays = users_in_birthday_month( 7 );
foreach ( $july_birthdays as $user ) {
    // output user display name
}

And if you want to display the full birthday, just fetch the original post meta field.
This means:

You can now use ultra fast taxonomy queries!
Your query will not get exponentially slower as your userbase grows
This data is very cacheable, and will see more performance gains if an object cache is in use
There are only 12 possible queries to cache!
You could extend this to include days of the month, years, etc
It may be necessary to fetch the month value from $_POST rather than get_field as ACF may not have saved the value yet

Remember, don't use meta to search for things, that's what terms and taxonomies were created for.
Posts aren't the only things that can have taxonomies and meta, for more information on user taxonomies, see this helpful article from Justin Tadlock.
Comment: I see the benefis of you approch. It took me a while to implement is as I coukd not get it to save the term when updating the user. I finally realized that the problem was that the 2nd argument of wp_set_object_terms was an array containing one int. once i casted it as string it worked like a charm. eventually what I did was that:
`function save_hidden_birthday_month( $user_id ) {
    $birthday = get_field( 'birthday field name' );
    $month = intval(MY MONTH)
    wp_set_object_terms( $user_id, [ strval( $month ) ], 'birthday_months', false );
}`
Answer: If that field is definitely stored in a string like: 20000101 then you can use the REGEXP compare method to do what you want.
The code below uses the WP_Query meta fields to make a regex which takes any character for the year and day, and matches a particular month.
You'd need to give this a go on your data, but it would look something like this:
$monthNumber = 6; // e.g. June
// ensure always two characters, so June will become "06"
$monthNumberString = str_pad($monthNumber, 2, "0", STR_PAD_LEFT);
// regex to only match month
$matchMonthRegex = '....' . $monthNumberString . '..';

$args = array(
    'meta_key' => 'YOUR_BIRTHDAY_META_FIELD_NAME_HERE',
    'meta_value' => $matchMonthRegex,
    'meta_compare' => 'REGEXP'
);

$result = WP_Query($args);

Let me know if that works?
Comment: The approach is great, I did not think about regex comparison. There was a problem with the syntax though.
Once I changed it to following correct syntax it worked.
`$matchMonthRegex = '....' . $monthNumberString . '..';`
Thanks for the directions
Comment: This is a post query, the OP asked for a user query
Comment: @Dor oops, well caught, yes I totally meant `.` and will update the answer


Planetary Conjunctions

Question: Was there a conjunction between Jupiter and Mercury in 2 BC seen from Persian Gulf? Was there a conjunction between Jupiter and Venus in 4 BC seen from the Persian Gulf? If so, what day, time, and degree of separation? Thank you!
Comment: What counts as a conjunction is really more a matter of oppinion.  The best way to answer your own question would be to use planetarium software like Stellarium to browse through the dates you're curious about.
Answer: On the 26th of August 2BC (in the proleptic Gregorian Calendar). Jupiter was close to Mercury. It might have been visible shortly before sunrise but it was very unfavourable, too close to the sun, about a degree of separation.
On the 24th of May 4BC Jupiter was close to Venus.  Again, it was unfavourable, and too close to the sun, but might have been just about visible in the evening twilight—about 1.5 degrees separation.
There is normally some kind of conjunction each year between the inner planets and Jupiter. These were not particularly notable, close or visible conjunctions.
These ephemeris are from the model used by Stellarium.

Planetary Conjunctions


How to communicate Credit Card details to customers when instantly approved in PCI-DSS compliant way?

Question: Would displaying the full Credit Card details (PAN, Expiry date and CVV/CVC) in Online Banking and / Mobile Banking be considered both PCI-DSS and secure? Or what would be Best practice to display the details for the instantly granted (approved) Credit card so that customer can start using it for eCommerce?
Answer: IANAQSA, and you seem to be getting into the Issuer business.  You really need a QSA.
You are asking about the requirements upon issuers (most PCI-DSS questions are from the POV of merchants, acquirers, and processors; the other side of the equation).
Issuers are also held to the PCI-DSS, but obviously they have different constraints.  For example:

3.3 Mask PAN when displayed (the first six and last four digits are the maximum number of digits to be displayed), such that only
  personnel with a legitimate business need can see more than the first
  six/last four digits of the PAN.

For an issuer, it is a legitimate business need to communicate a cardholder's card number to them.  Most commonly, this is done by shipping a plastic card to the cardholder's mailing address.  So Issuers clearly get a pass on the requirement to Mask per 3.3 when business need requires them to disclose the full card number.
You're asking about virtual / electronic only cards, and there is precedent that Privacy.com displays full card data - PAN, expiration, and CVV - as soon as a user allocates themselves a new card.  So my best answer is - yes, you can display those details per business need.

To address followup from the comments:
QSA is Qualified Security Assessor; the auditors recognized by PCI as authoritative.  Since I Am Not A QSA (IANAQSA) what you get from me are opinions, but not worth anything when audit time comes.
All the MFA/2-factor requirements in PCI revolve around administration, not end users or customers, so that should not be an issue.
Privacy issues legitimate card numbers; I believe they do fall into pre-paid bins, but they aren't really pre-paid cards, as they're backed by ACH and can have sophisticated limits.  But, yes, to a merchant they look like pre-paid cards.
Comment: Thanks a lot for your answers, Gowenfawr! What is the IANAQSA? And QSA in your answer please? Do you think there are some further requirements such as MFA / 2 Factor Authentication before the full details of Credit Card can be displayed? And lastly - Privacy.com is pre-paid card, right? (Not Credit card) so it's like Revolut.com
Comment: @user214314 updated answer to address your comment.


Is there a limit to the number of ajax calls I can make in JSF?

Question: I am developing a portlet with RAD 7 in an IBM Wepsphere portal 5.1 environment. I have various fields which poplate objects in the back end with ajax calls. This is in order to persist the data if the user navigates away from the page without submitting it. The inputs are a combination of popups and dropdowns. When the user wants to store the data permanently they then click a submit button.
I noticed that when you fill out more than a certain amount of fields on the page you need to click the submit button twice. The first submit seems to do just refresh the page, and the action behind the command button is not called. The second one submits the data.
I've done quite a lot of testing with this and realised that there seems to be a limit of 7 ajax calls I can do before the submit button wont work first time. Even if I just change one field 8 times it fails.
Somehow going over 7 calls leaves the page in a different state. Navigating away from the page will fix it. Ie if you fill out all the fields then go to a different page in the menu and then return, you can submit with the first click.
A typical dropdown in the jsp is like below:
<h:panelGroup id="resultGroup">
<h:selectOneMenu syleClass="selectOneMenu" id="menu2" value="#{pc_CallView.result}">
<f:selectItems value="#{pc_CallView.results}" />
</h:selectOneMenu>
<hx:behavior  event="onchange" target="menu2" behaviorAction="get;stop" targetAction="resultGroup">
</hx:behavior></h:panelGroup> <hx:ajaxRefreshRequest target="resultGroup" id="ajaxRefreshRequest6" params="menu2">
<hx:ajaxRefreshRequest> target="resultGroup" id="ajaxRefreshRequest6" params="menu2"></hx:ajaxRefreshRequest>

The methods in the backing bean are like below:
To handle the selected value:
public String getResult(){

    String result = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("menu2");
    if(result!=null && !result.trim().equalsIgnoreCase("")){
    getHelper().getCallDetails().setResult(result);
    }
    return getHelper().getCallDetails().getResult();
}

To populate the choices in the dropdown:
public List getResults(){

List results = getHelper().getCallResults();
List resultSelectItemsList = new ArrayList();
Iterator it = results.iterator();
resultSelectItemsList.add(new SelectItem("","-- select --"));
while(it.hasNext()){
    ClientCallResult result = (ClientCallResult)it.next();
    resultSelectItemsList.add(new SelectItem(result.getId(),result.getResult()));
}

return resultSelectItemsList;

}
The submit button:
<hx:commandExButton
        type="submit" value="Save " styleClass="commandExButton"
        id="saveButton" action="#{pc_Footer.doSaveAction}" rendered="#{pc_Footer.showSave}" />

Nothing unusal I would have thought, but still I get the problem.
Has anyone seen anything like this before?
Regards
Bill
Answer: I had faced same problem.. what solution I found is get;stop is making this issue... just remove the stop from behaviorAction.. then you can make N number of ajax calls...


Curvature forms of holomorphic line bundles

Question: Let $M$ be a compact complex manifold, $L$ a holomorphic line bundle over $M$, and $\nabla$ a connection extending the holomorphic structure map $\overline{\partial}$ of $L$. In general can it happen that the curvature form has a $(2,0)$ component? In the case that it does not, can the $(1,1)$-curvature form be non-degenerate?
Comment: It certainly can contain a $(2,0)$-component. In general, if $\theta$ is the connection matrix in a local frame, then the curvature is $\Theta=d\theta+\theta^2=d\theta$ (since $\theta$ is a $1$-form). Locally, the connection matrix could be any $1$-form, and if it is compatible with $\bar\partial$, it could be any $(1,0)$-form.
Comment: Regarding your second question, it seems like the Chern connection associated to a hermitian metric on $\mathcal{O}_{\mathbb{P}^n}(1)$ would answer that.
Answer: Sure, any closed 2-form $\eta$ with integer cohomology
can serve as the curvature of a connection
on a line bundle. This can be seen if you take a line bundle with
the same Chern class and connection $\nabla$
(which is possible using the $C^\infty$ exponential
sequence) and modifying the connection by taking
$\nabla_1:=\nabla +\alpha$ where $\alpha$ is a 1-form
such that $d\alpha= \eta-\eta_0$, where $\eta_0$ is
the curvature of $\nabla$. If your form $\eta$
was of type (1,1)+(2,0), the resulting connection
$\nabla_1$ induces a holomorphic structure on $L$.
The (1,1)-part of the curvature can be non-degenerate,
degenerate or even zero.


Wysiwyg Comments is not turning off

Question: I'm new at Drupal and I am having trouble with comments in some content types.
I create a new content type and check that it'll hava comments, but I don't want the Wysiwyg editor, so I disable it, but it's still there, how can I disable it for a content type speciffic?
NOTE: I Turn off the Wysiwyg comments in this content Type.
Comment: What version of Drupal?
Comment: Cool.  If someone else dosen't come up with a better solution, you should accept the answer (click the check mark) when the system allows you to.
Answer: For Drupal 6, I normally add the following to a custom module:
function mymodule_form_alter (&$form, &$form_state, $form_id)
{
  if ($form['#id'] == 'comment-form') {
    $form['comment_filter']['format'] = array(); // nuke wysiwyg from comments
  }
}

To be honest, I can't recall why I am using $form['#id'] instead of $form_id for the conditional.
Comment: No upvotes yet on this? +1'ed, nice tip, thanks!

Wysiwyg Comments is not turning off


Content-Security-Policy (CSP) HTTP Header useful for direct link to image?

Question: Is there any reason to show a Content-Security-Policy (CSP) HTTP Header for direct links to images such as https://invalid.tld/direct-link-to-image.jpeg?
Comment: The CSP header generally only makes sense for HTML documents, as it specifies what the document will include.
Answer: If you are sending the correct type in the Content-Type header, the X-Content-Type-Options is set to nosniff and the image is not in SVG format, CSP shouldn't be necessary. CSP is also not necessary if the content is trusted (i.e. not user-generated) and static.
User-generated SVG is dangerous because the user can upload something like
<svg xmlns="http://www.w3.org/2000/svg" onload="alert('XSS!')"></svg>

and send a direct link to another user.

However note that although in some cases there is no reason to enable CSP, there is also no reason not to enable CSP (other than saving a few bytes). If you accidentally disable CSP for dynamic HTML pages, you can open your website to more XSS attacks.


How can I get all sitecore download event tracking list of item which is not clicked yet (like zero visit items)

Question: I am using Sitecore 10.2 having Sitecore Analytics enabled.
Download events tracking analytics is enabled for all media items like(.pdf, .docs, .xls).
How to get all media items which have not been clicked yet or having zero visits count?
Answer: Associating Files With The Download Goal
From the Sitecore launchpad, click Media Library.

Click on the Media Library icon on the Sitecore launchpad.
In the content tree, select the PDF item you'd like to track downloads of.

Select a file in the Sitecore media library content tree.
In the top navigation bar, select Analyze, and then Attributes.

Select Analyze, then Attributes from the Sitecore top navigation.
Click Events, and select Download.

Select Events, then Download after clicking Attributes in the top navigation.
Click OK, then remember to Save and Publish.

Click the OK button.
Reviewing Results
To review the results, from the Sitecore launchpad, click Experience Analytics.
Click Experience Analytics from the Sitecore launchpad.
Answer: If you open the Database, there are some tables that maintain the tracking under Reporting database. So you can run the query like the one below.
SELECT DimensionKeys.DimensionKey,
   SiteNames.SiteName,
   Fact_DownloadEventMetrics.Count,
   Fact_DownloadEventMetrics.Visits,
   Fact_DownloadEventMetrics.Value
FROM
    DimensionKeys INNER JOIN
    Fact_DownloadEventMetrics ON DimensionKeys.DimensionKeyId = Fact_DownloadEventMetrics.DimensionKeyId INNER JOIN
    SiteNames ON Fact_DownloadEventMetrics.SiteNameId = SiteNames.SiteNameId

So You can check the details by adding where conditions into this.
Ref: Downloads table is empty in reporting DB
Also under the reporting database there are some views already created that Enable you to query the Fact_Downloads table. So I found one that can help you to filter by AssetId.
SELECT * FROM [dbo].[Downloads]

You can find them under Views.

You can use this by adding the WHERE condition to filter the records.
If you want to run this using Powershell then you can write the query something like this.
Import-Function -Name Invoke-SqlCommand

$connection = [Sitecore.Configuration.Settings]::GetConnectionString("reporting")

$query = @"
SELECT TOP (10) *
  FROM [dbo].[table]
"@
Invoke-SqlCommand -Connection $connection -Query $query

Ref: https://doc.sitecore.com/xp/en/developers/81/sitecore-experience-platform/the-reporting-database-reference.html
Hope this helps.
Comment: how can we get a list of items from "Reporting database" that visit item is zero
with help of PowerShell script


Visa application questions

Question: If someone has a question regarding certain information on a visa application or certain visa requirements, is this relevant to Travel.SE? For instance, "What documents does a US citizen need for a student visa to Hong Kong?" or "Am I considered of Indian origin if my grandparents used to hold Indian citizenship and have renounced it, but I am of Indian ethnicity?"
Answer: I would definitely say it's on topic. Of course, we (the moderators) / the community (more-so these days) check whether there are duplicates.
The other thing I'd recommend for such questions to watch out for is to check that there aren't multiple logical questions being asked in the same set - that would likely get closed as "too broad".
Answer: I think it's fine to help, but as far as what documents people should submit for a given application, the guidance is much better.  For example if somebody says "I am planning to submit 3 months of bank statements and my tenancy contract". The only thing you can do is compare it to the guidance. What good is that?
The 'official' guidance for the UK and Schengen is wonderful. I worked on the UK guidance during the consultation phase (they sent several rounds of drafts to the legal community last year) and it says exactly what applicants should do.  We should avoid competing with it.
And for stuff like sponsor letters or invitation letters, we should avoid having a role in composing them.  Also avoid if somebody submits an invitation letter and asks us to approve it, or make suggestions to it, then NO.  It is legal advice and outside TSE's remit.
Generally what it amalgamates to is that when an application is in the preparation stage, it's difficult to improve upon what the EU or the UK provide already.  And if a question involves something not in the guidance, then there is a very thin surface before it becomes legal advice.  Be careful.
Refusals are more straightforward.  For refusals, if the OP puts in the formulae (or checkmark), it's ok.  If they do not, then to hell with them, it's "UNCLEAR".
At the moment, Schengen refusals are in a state of convergence with very near duplicates starting to appear.  If it continues, questions on Schengen refusals can be handled mechanically by pointing to one or more canonical answers. I reckon the entire Schengen surface can be addressed with a max of 5 canonical answers. About 3 canonical answers would be ideal.
For appeals, if somebody wants help preparing their appeal bundle, I vote that this is totally out of TSE's remit.  TSE should avoid a high Google rank for appeal questions; mods should delete the question immediately without all the voting rigmarole.
Every other kind of visa question is in scope as long as it is not an Expat thing.

Visa application questions


Is it okay to write an answer from someone else comments?

Question: As has been discussed some time ago, a lot many answers are in the comments. If the users who have commented on the question do not write the answer to that question, can someone else use the ideas in the comments to write an answer and post it as community wiki ? Should we encourage this practice especially for older answers ?
Comment: Note the irony of posting the text above as a comment ;)
Comment: Was this by any chance inspired by my comment/answer to http://biology.stackexchange.com/questions/15904/what-is-this-plant/15912#15912? Personally, I sometimes half-answer in comments when I dont really feel qualified to answer, but might be able to point in a useful direction. Probably not ideal though.
Comment: @fileunderwater :) It wan't inspired from that post alone. I had seen many posts where users(including myself) have answered in the comments.
Comment: @fileunderwater For me this  happens because - I am too lazy to skim through and summarize a source I have provided(in the comments) into an answer or I am not sure whether my answer is "correct"
Answer: Yes it is. It is polite to cite the original comment and you should also expand it a bit so it becomes a proper answer but answers should not be given as comments. See this (and various similar) questions on meta.so for the "official" policy.
Basically, first leave a comment asking the user who left the comment to post an answer instead. If they don't, you can shamelessly steal their comment and post your own answer.
Remember that the objective of all SE sites is to build a repository of useful knowledge. Answers should be answers so when you do this you are helping the site.


What is the most efficient way to list all of the files in a directory (including sub-directories)?

Question: I am writing a servlet which will examine a directory on the server (external to the web container), and recursively search for certain files (by certain files, I mean files that are of a certain extension as well as a certain naming convention). Once these files are found, the servlet responds with a long list of all of the found files (including the full path to the files). My problem is that there are so many files and directories that my servlet goes extremely slow. I was wondering if there was a best practice or existing servlet for this type of problem? Would it be more efficient to simply compile the entire list of files and do the filtering via js/jquery on the client side?
Answer: Disk access is slow and as the number of files and directories increases, you'll rapidly reach a point where your servlet will be useless when using the conventional recursive search through the directory tree.  You'll especially reach this limit quickly if you have a large number of concurrent users performing the same search at the same time.
It's instead, much better to use an external batch job to generate the list of files which can then be read into the servlet through a database call or even by just parsing a file containing all the file names separated by a newline character.  Using "find" on Linux is a simple way to do this: e.g.
<code>find <path_to_directory> -name '*.bin' > list_files.txt
</code>
This would list every file name that ends with .bin in a particular directory and output it into a file named list_files.txt.  Your servlet could then read in that file and create the list of files from there.
Answer: If you really have loads of files, you might think about spawning an external process to do the searching. If you're running on a unix-like server (like linux), you might get speed gains by having the "find" command do the searching for you, and parse its output.
You can google for many examples of how to use "find".
Answer: I see two possible reasons why this process might be going slowly:
1) Disk I/O is taking too long. This'll be a real constraint that you can't do much about. Usually the operating system is pretty good at keeping structures in memory that allow it to find files in your folders much quicker. If it is too slow regardless, you might have to build an index yourself in memory. This all depends on how you're doing it.
In any case, if this is the issue (you can try measuring), then there's no way doing the filtering client side will help, as that shouldn't really take very long, no matter where you do it. Instead you're going to make the client slower by sending it more data to sort through.
2) There's something wrong with your directory traversal. You say it's "recursive". If you mean it's actually recursive, i.e. a method that calls itself whenever it encounters a new directory, then that might well be slowing you down (the overhead really adds up). There's some stuff about tree traversal on wikipedia, but basically just use a queue or stack to keep track of where you are in the traversal, instead of using your method state to do so.
Note that a file system isn't actually a tree, but I'm assuming that it is in this case. It gets a bit hairier otherwise.
I don't agree with the other posters that you can't implement it in-process. It should work pretty well up to a certain point, no need for batch jobs just yet.
Comment: Thanks for your response. I think a batch job is what I'm looking for since this servlet will be used by many users and the listing of files is quite large (it takes a few minutes to list everything if I do a simple ls/find on the server).
Comment: I see. find is probably faster than most things you would implement yourself. Still, if it's that slow and you've got multiple users querying for it all the time, you'll still kill your performance either way so I'd consider using some in-memory structures or flat indexes.
Answer: i think your servlet works slow because of hard drive speed. if list of files a permanent you should load it to memory


How to enable insecure guest logons on Windows Server 2016?

Question: Since Windows Server 2016 Update version 1709, insecure guest logons have been automatically disabled.
How should insecure guest logons be enabled again?
In the linked article, Microsoft suggests to do this:

If you want to enable insecure guest access, you can configure the following Group Policy settings:
Computer configuration\administrative templates\network\Lanman Workstation
  "Enable insecure guest logons"
Note By enabling insecure guest logons, this setting reduces the security of Windows clients.

However, I have done this and nothing seems to have changed, remote access to shared folders without a user logging in doesn't work. This used to work seamlessly before the mentioned update.
The server in question is not currently within a domain. It wasn't either before, when insecure guest logons used to work, or after the update, so this setting has been applied to the Computer configuration as described by Microsoft.
It should be noted that such setting had its status described as Not configured, instead of Disabled, when it was changed to Enabled.
The only related question I found was Windows 10 cannot access network shared locations or drives, but it only mentions Microsoft procedure.
Is there any other setting that should be set for this to work again? Is this not the setting that should be changed?
PS. I understand this is considered insecure.
Answer: I think this will work
Local Group policy editor > Computer Configuration > Administrative templates > Network > Lanman Workstation > Enable insecure guest logons
enable it


alter password reset url

Question: I'm trying to alter the password reset link (user/password) to my own language specific URL, but I can't find how I can do this.
How can I change it?
Answer: Render user_pass form in your custom url.
drupal_render(drupal_get_form('user_pass'));
OR
In template.php

function mymodule_theme(){
// custom user-password.tpl.php
    $items['user_pass'] = array(
        'arguments' => array('form' => NULL),
        'render element' => 'form',
        'template' => 'templates/user-pass',
    );
    return $items;
}

In user-pass.tpl.php:

php global $base_url;

div class="forgotPassword"
Forgot Password

php
    print drupal_render($form['form_build_id']);
    print drupal_render($form['form_id']);
    print drupal_render($form['name']);
    print drupal_render($form['actions']);
?
/div
Answer: Drupal has different way to understand which language should be used to show the current page. By default, Drupal shows the pages in the language set in admin/config/regional/language; other detection methods are disabled. (See the settings on admin/config/regional/language/configure.)

If you want to use a different language, and since you are asking for a page that is normally used from anonymous users, you would need to enable the Browser method that will select the language for the pages basing on the browser settings and the HTTP headers the browser uses when seeing a page.
The Session method uses a session variable (which means the user already visited one of the pages on your site), or a request parameter; it could be the right method if you know the user already visited your site at least one, with cookies enabled for your site.

alter password reset url