How should response content type for documents be specified in order to work consistently across browsers?

Question: I'm developing a simple servlet that should serve documents via http. I use URLs in the form of /getDocument?fileId=1234. The servlet simply 1) sets response.contentType and 2) writes to response.outputStream.
The problem is about setting the content type correctly in order to have the browsers understand the response (i.e., display the document using the correct application). Specifically:
a) For PDF files, if I set content type to "application/pdf", Internet Explorer understands (displays the document immediately) but Firefox does not (displays blank page without attempting to open any pdf viewer plugin). If I set it to "application/x-octetstream", Firefox understands it (displays it properly), but Internet Explorer says "unknown file type" when it asks me to save or open it.
b) Firefox understands "application/msword" and "application/vnd.ms-excel", but Internet Explorer does, strangely, not, it simple says "unknown file type".
Is it possible to get this to work consistently in all browsers, and if so, what is the correct way of setting content type for various document types? Is there anything else that should be set in the response in order for this do work correctly? Or, as I suspect, are the browsers getting confused when the URL does not end with the corresponding filename extension? (i.e., getFile?fileId=1234 instead of e.g. getFile/test.pdf)
Answer: Inside a servlet, the response content type ought to be set as follows:
response.setContentType(getServletContext().getMimeType(filenameWithExtension));

The ServletContext#getMimeType() lookups all <mime-mapping> entries in web.xml for the content types associated with certain file extensions. You can find all default mappings in the appserver's own web.xml (which in case of e.g. Tomcat is located in /conf/web.xml). It might lack the "new" MSOffice OpenXML file extensions like xlsx, docx and so on. You can add them to your webapp's web.xml like follows:
<mime-mapping>
    <extension>xlsx</extension>
    <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
</mime-mapping>

As to how browsers handle the content type and the associated application, the major problem here is MSIE. It ignores the Content-Type header and the filename parameter of the Content-Disposition header. It instead smartass-ingly guesses the content type based on the file extension in the URL and uses the last pathinfo of the URL as filename. As you've used a request parameter like /getDocument?fileId=1234 instead of a fullworthy filename+extension, the filename will become getDocument and MSIE can't reliability "guess" the mime type of it. You should really include the filename+extension in the URL like /getDocument/filename.ext. You can grab that part in the Servlet by request.getPathInfo(). For more servlet hints also see this article.
As to the problem of your Firefox not handling PDF files correctly, this must be a misconfiguration in your Firefox. Try verifying if everything looks right in Tools > Options > Applications. It is namely supposed to respect the aforementioned headers in a correct manner. You should only ensure that any Content-Length header is correctly(!!) specified, else the file cannot be opened.
Comment: As far as I can tell, IE *does* process the mime type. See, for instance, the test case at http://greenbytes.de/tech/tc2231/#attwithasciifilename.
Answer: I'd recommend checking on a second machine, and also make sure that you have properly installed Acrobat Reader (in Mozilla, "about:plugins" gets you to the plugin registry).


Remove pie chart lines in illustrator

Question: I have created a pie chart and colored it and all is looking good, however I am stuck with lines between each section and ideally I would like a solid color with no outline.  Been searching around and can't seem to find it anywhere.  Here is an example of what I am trying to achieve: http://vector.tutsplus.com/tutorials/designing/how-to-create-outstanding-modern-infographics/ Scroll down to step 15.  Thanks for any help, also I'm using illustrator CS5
Comment: Welcome to GD!  Can you post your result so far so we can see the difference between what you've achieved and what you're attempting to achieve?
Answer: Just set the stroke colour to "nothing", represented in colour swatches by a red diagonal line.
Unless I've missed something?

Remove pie chart lines in illustrator


How can I make a gnome panel only appear if I have a second monitor hooked up?

Question: I have a laptop with Ubuntu installed on it and I'm constantly switching from just my laptop to also having a monitor.  When I'm using the laptop screen and monitor, I have a panel on each monitor that shows the windows open for that monitor.  If I switch to just using the laptop screen, then both panels end up on the same screen.  How can I configure one of the panels to only show up if I have two monitors?  Or can I at least "suspend" one of the panels somehow so I don't have to set it up the way I like it every time I switch?
Answer: Try setting the screen option for this panel via gconf-editor.
Run gconf-editor and navigate to the panel options at /apps/panel/toplevels/panel_1/ (your panel name may vary slightly). You should see an option screen as shown below. Try configuring this to your liking.
I'm not sure this will work, as I have a feeling that when you switch to using just the laptop screen, this value is automatically changed to the available screen. It's worth a shot.
If you use Xinerama, there's also an option to configure the monitor the panel appears on.
If none of these work, I'd suggest you enable auto-hide, and set a very low auto_hide_size so the panel is barely visible when you switch to one screen.
I haven't researched this yet, but if there is a command-line way to modify these values, I'd just use a script to tweak these values so the panel is hidden when I want it.
Answer: Here's what I did (on Ubuntu 10.04):
To fully hide the panel, you can set monitor to -1 using gconftool-2. The only caveat is sometimes you have to kill/restart gnome-panel after changing the monitor setting. This should do the job (killall without rerunning gnome-panel doesn't always bring it back):
gnome-panel --replace

There is a blog post here with a simple script that you can hook onto nvidia-settings or gnome-display-properties:

http://blog.zoomeren.nl/2010/03/05/a-gnome-panel-for-each-connected-monitor/

Since I use Nvidia, I did nvidia-settings -tq TwinView to check if TwinView is on, but you might not be able to tell the difference between two and three monitors.
Answer: GConf includes a command line tool, gconftool-2. You can use the gconftool–2 command to perform the following tasks:

Set the values of keys.
Display the values of keys.
Install schemas from schema definition files when you install an application.

For example, use the following command to display the values of all keys in the /desktop/gnome directory and subdirectories.
gconftool-2 --recursive-list /desktop/gnome


Gathering mac addresses with Python

Question: is there a good way to gather the mac addresses of machines on a local network using Python.  If it helps I'm trying to execute this python script from the DHCP server for the network. I'm new to Python but would it be a bad idea to look at the DHCP leases file for this info? I'd like to use this inside a Django app eventually. Thanks.
Answer: Really a unix question (one will assume)
You can either look at the arp addresses registered "/sbin/arp -a" or a DHCP lease table.  If you go the arp route you will on find addresses that your system has recently received/sent packets to, the DHCP lease table will give you the ability to see everything.  Though if it's static configured it won't show up.
Answer: The easiest thing to do would be to run a tool that can achieve this and parse its output (e.g. nmap). Depending on your needs, you could run it periodically and keep a file with the mac addresses.
Looking at the leases file could work, assuming that all your machines are in there. If you want to actively look for machines, do a nmap scan.

Gathering mac addresses with Python


Why won't Skype install?

Question: I have 64-bit 12.10 Ubuntu. I can't get Skype to install from the software center because it can't find the repositories. I can't install it from the website either. I tried checking the 64-bit Debian package in case it would work and it installed but it won't open. What should I do?
Comment: if you already installed your skype from deb file, run this command so that it will install dependecies `sudo apt-get install -f`
Answer: I've had some problems with the Software Center as well.
Try to install lib32stdc++6 :
sudo apt-get install lib32stdc++6

Then cd to the directory where you downloaded the Skype.deb file. If you downloaded it to your Downloads folder, you would type:
cd ~/Downloads

Then install the .deb package.
sudo dpkg -i skype*.deb

This fixed it for me.
Comment: Thanks, but I think I installed the wrong Skype package because it still isn't working. Where did you get yours?
Comment: I downloaded the 64 bit .deb file from skype.com. What error are you getting? After you install it with dpkg -i, try doing "sudo apt-get install f"

Why won't Skype install?


Calculation of the Schur multiplier of $\mathbb Z^2$

Question: Consider a projective representation of $\mathbb Z^2$ with $U(1)$ coefficients. I would like to find the covering group corresponding to this representation. For this, one needs to find the appropriate central extension by $\mathbb Z^2$ of the Schur multiplier $H^2(\mathbb Z^2, C^\times)$. I have some confusion in calculating this object. If I use the definition of the Schur multiplier given in terms of the homology group $H_2(\mathbb Z^2,\mathbb Z)$, I obtain the group $\mathbb Z$. This is in contradiction to the result $H^2(\mathbb Z^2, C^\times) = U(1)$ that I have seen quoted elsewhere, and which I expect to obtain on certain physical grounds (there is a separate physical interpretation of this problem). I would like to know which result is correct.
Comment: People use "Schur multiplier" to refer to both $H_2(G, \mathbb{Z})$ and $H^2(G, \mathbb{C}^{\times})$ for $G$ a *finite* group because they are (noncanonically) isomorphic in that case, which they aren't in general. Also, the universal central extension is an extension of $G$ by $H_2(G, \mathbb{Z})$ and it only exists in general if $G$ is perfect, which $\mathbb{Z}^2$ isn't.
Comment: @QiaochuYuan Thanks. I didn't know the finiteness condition. I am trying to interpret 'central extension' as the group of symmetries on a two-dimensional lattice in the presence of a magnetic field (for a fixed field, the translation operators determine a projective representation of $\mathbb Z^2$). So different extensions would correspond to different magnetic fields, and I would not expect there to be a universal central extension for this problem.
Answer: I think that we have
$$H_2(\mathbf{Z} \times \mathbf{Z}, \, \mathbf{Z}) \simeq \mathbf{Z}, \quad H^2(\mathbf{Z} \times \mathbf{Z}, \, \mathbf{C}^{\times})\simeq \mathbf{C}^{\times}.$$
In general, by the Universal Coefficient Theorem there is an isomorphism $$H^2(G, \, \mathbf{C}^{\times})=H_2(G, \, \mathbf{Z})^*$$
Now, it can happen that an infinite group is not isomorphic to its dual. For instance, in your case we have $$\mathbf{C}^{\times}=H^2(\mathbf{Z} \times \mathbf{Z}, \, \mathbf{C}^{\times})=H_2(\mathbf{Z} \times \mathbf{Z}, \, \mathbf{Z})^*=\mathrm{Hom}_{\mathbf{Z}}(\mathbf{Z}, \, \mathbf{C}^{\times}).$$
The isomorphism $\mathrm{Hom}_{\mathbf{Z}}(\mathbf{Z}, \, \mathbf{C}^{\times}) \simeq \mathbf{C}^{\times}$ is explicitly given by associating to every element $h \in \mathrm{Hom}_{\mathbf{Z}}(\mathbf{Z}, \, \mathbf{C}^{\times})$ its value in $1$, namely $h \mapsto h(1)$.


How can we best inform potential students of the nature of CS?

Question: Recent questions deal with the problem of too many applicants to CS programs, both in High School and University. Yes, this is a problem when only a smaller number can be accommodated for reasons of resource availability. One of the easier issues to deal with is whether the student's past performance indicates potential success, though even this is hard. If the student hasn't studied Computer Science in the past, what courses are predictors? But this question is focused elsewhere.
Some students, in periods of high demand, choose a field simply because of its popularity at the time. While they may have the aptitude and background for it, their interest may be shallow or even misinformed. It would be good to help such students make better choices about their futures by informing them early of the nature of the field and how their future would likely play out if they stay in the field. The goal is to reduce the number of drop-outs: students who start a program, but leave it before completion. This potentially wastes both the student's time and resources as well as wasting institutional resources. It also risks denying other students an entrance slot that they might have had.
In particular, such students may not know all of the things that CS professionals do on a daily basis. What are the interesting things? What are the boring things? What are the risks? What are the rewards? What frustrations? What will they ultimately need to do to become successful, in either the commercial or academic worlds.
What resources can be brought to bear to assure that, possibly naive, students get a good look at the profession so as to better decide whether they want to enter?
Google provides a lot of information for "What is Computer Science?" This includes the summaries given by a lot of colleges. However, most of it stresses only the positive things and so gives a somewhat incomplete picture.
In the early 1960's as a teenager, I visited a local computer center. They had what was likely an IBM 650 with drum memory. I got to see what folks did back then and recall that I wasn't very impressed. I studied math. But CS wasn't an option then. But something more was needed in my case to generate interest.

For the record, I'm interested in drawing an accurate picture of work in the field, not horror stories or overly optimistic projections.
Comment: How are you planning on contacting these students in the first place? In my anecdotal experience, most of the students who have no idea what computer science is have never taken a computer science course before entering college as a computer science major.
Comment: I don't expect that they have necessarily taken any courses. Making the information available is part of the problem. It would be possible to devise (part of) a course, perhaps, but I don't expect that.
Answer: If the main issue is that the not-so-great side of programming (to pick one area as an example) is not disclosed, then tell people point-blank, in an admission conversation or while describing programming to groups:

Programming is one of the most frustrating and difficult things that
  humans have ever devised to do.

I say that to all my students right out, usually the first day. I also tell them about the big egg-shaped rock I used to wave threateningly at the (glass CRT) screen when I got particularly frustrated. And I tell them about the time I had to go back to the bookstore to buy a different book about the intricacies of writing DOS interrupt routines for networking with IPX over Novell: the first book had a missing line in a code example.
It certainly is true that one can succeed with poor background and preparation. I hated math classes, and they probably would have helped me become better faster at programming (my first chosen career that I attended college to get to). There is no substitute for being really interested in something, interested enough to defy your parents and change your major in college, interested enough to press on through many difficulties, come what may. "Being carried along is not enough."
Loving it even when you don't really know what it is will work, I do not know what else will. As it says about qualifications in the book At the Feet of the Master:

Love, if it is strong enough in a man, will force him to acquire all
  of the other qualifications, and all the rest without it would never be
  sufficient.

We are supposed to do what we love. Freud said that the keys to a meaningful life are Work and Love. Really, they are one.
Answer: Every career has "gotchas".  There is something about every job that is undesirable.  That's why it is called a "job".  But students can make sure they are matched as well as possible - minimize the "gotchas", so to speak.
I entered CS because I loved to write code.  I stumbled into the field as a junior in college and immediately changed my educational course.  I am thankful for that "accidental" encounter, but it wasn't an accident, I don't believe, that I loved computing as soon as I was exposed to it.  My "desire" had been predicted.  I remember taking a career assessment of some sort as a sophomore in high school.  I remember the career assessment saying I was a good match for "computer science".  I remember thinking "what the heck is that?" (this was prior to the PC revolution), and I remember immediately dismissing the results of my assessment.  But the assessment was correct.
I say all that to say this:  students should be encouraged to use career and interest assessments in high school, maybe even repeatedly (once a year).  A quick Google search reveals many free assessments, and my state's college foundation provides 7 of them for free in one place.
Up until recently, the students at my high school had been required to do several of these assessments as sophomores.  Unfortunately, with a change in management, that practice ceased.  But I still have my students do them as part of my class.  We all should, I think.
Using assessments such as this at least helps students better understand themselves, and may prevent them from making a very bad career choice.  Of course, sometimes the assessments will be downright wrong (I recently had a student, one of my very best programmers, who loves to write code, is good at it, and knows she wants to go into CS, have an assessment tell her she should be an artist; however, I don't believe it was entirely off track because her code is very creative and is an artistic outlet for her).  But sometimes career and self-assessments will help a student think outside the box about what they want to "be".  And that is a good thing.
Another thing my school does is bring in professionals to share about their jobs.  They speak briefly about their backgrounds, what they do, what they like about their jobs, and what they dislike about their jobs.  They usually speak during lunch in a classroom. The kids eat their lunches while they speak.  It is very informal and always well attended.  The feedback from the students is always very positive.  Our local CDC (career development coordinator) organizes these "Lunch and Learn" sessions, as we call them.  We have 5-6 a year.
These are tangible things you can "do" to help students get ideas about careers.  Some students may still fall headlong into something that is not a good match for them, because of tunnel vision, or peer pressure, or parental wishes.  But some of them will identify or reinforce what they love to do, and they will be willing to make the trade-off:  you pay me to do what I love X% of the time, and I will put up with the 100-X% of the time I have to do stuff I don't necessarily like.
Answer: The fix is in accepting that failure, sometimes repeated failure, is not merely an option, but is absolutely necessary and an integral part of success.

The goal is to reduce the number of drop-outs: students who start a program, but leave it before completion.

Is it? Who says so? Is that yet another law of Nature we forgot to be told about? There are academic environments where drop-outs are how students learn about stuff not working out, they are pretty much a given... I dropped out of an automation and robotics M.Sc. degree at age 18, only to take Ph.D.-level robotics classes a decade-and-a-half later, on another continent, and enjoying them immensely. No regrets. It's good that I attempted it and dropped out of that life-sapping uninspired quagmire!
The corollary: sometimes you do want to enter something just to appreciate it's not for you - not necessarily in the absolute, but at least at a given moment in time, or in a given mode of presentation (this includes institutional culture). And trust me: institutional culture matters a whole darn lot. There are teaching institutions that do a superb job at the lectern, yet the culture may be wholly unbearable to a particular student. Whenever I think about studying just about anything in place X, I want to throw up: no "resources" would have helped beforehand! I had to try it and leave.
But unfortunately I know where your question comes from: it's the deeply American obsession with an educational system that financially ruins a good chunk of the students who enter. The solution to avoid the ruin is not ever, not even once, to avoid drop outs. Instead, it is to appreciate the fact that this fantasy of a student getting a loan, entering a major, finishing it, getting a job, and then paying it off in a reasonable amount of time is completely unrealistic for most people. It is doing everyone the most disservice to attempt to wrap the educational system around this fantasy, and thus to attempt to avoid drop outs in order not to ruin the students' finances, or avoid dropping in some "rankings" or eligibility for student loans.
The failure is an integral part of success. Until the American academia wraps their thick collective head around this fact, there's no salvation, only misery. Life continuously bears this out, yet people pretend the problem is elsewere. It's nuts.
In other words, the question as stated is totally begging the question in the most horrific way possible: the assumptions made ruin lives. I'm not joking.
Answer: This is not a complete answer, and it misses the "drawing an accurate picture of work in the field" goal, but I think it shows an approach worth mentioning.
I'm not sure you can show the picture accurately without a hands-on experience with coding.

The goal is to reduce the number of drop-outs: students who start a program, but leave it before completion.

That may not be the best metric. Even if it's actually possible to tell apart populations of people with basic programming abilities and those lacking them, it's not enough of the solution. Some people may be quite capable, but still dislike the process. So there will be people trying to study CS that will eventually want to leave.
Maybe it's better to just make these people leave quickly
The way that my university was approching this was to put fast paced programming course with focus on algorithms in the first semester. The course, apart from teaching obvious skills, had an explicit purpose of failing or discouraging all the people without the skill or interest necessary to finish the studies¹. And then in the second semester, it was followed by writing a sizable GUI application as an individual project.
While I don't have any numbers, I believe it worked kind of well. It seems that whoever survived the first year and was willing to stay, was well capable to finish the undergrad course and find work in IT.
However, there are some caveats
The main issue with the presented approach is that it's strongly negatively biased. It discourages all the people that should be discouraged, but perhaps discourages also some happened to be just a little bit to slow. And while a university sucking up in all the best country talents may afford being picky, I'm sure it doesn't work everywhere, at least not at this scale. It also must be more tricky in a private school. My university was public, and people generally paid no tuition.

¹ Actually, the course, called "introduction to programming", had 2 variants: imperative (mainly for beginners) and functional (for people with some experience). The first one was the sieve, for the second one it was mostly a non-issue.
Comment: As you say, it is strongly negatively biased. While it may be a good solution for the institution, helping them manage resources, it is not as good for the individual. My personal bias would be in the other direction: making it an effective way to guide students, rather than to exclude them.
Answer: Teach students coding in high school.
In Australia, the national curriculum makes teaching students coding mandatory up until year 10, after which it becomes an elective. As a result, you'd be able to expect most school-leaver students entering university to have at least some experience with the negative aspects of IT, and those who would be disinclined to work in OT would be less likely to apply for an undergraduate IT degree.


Book to start studying ethics and Socrates especially

Question: As far as I know Socrates is one of the first philosophers who started thinking about ethics and morals. So what book would you recommend me to read as a beginner in this topic.
I recently read Early Greek Philosophy from Penguin publishing, maybe some similar book about Socrates and his views on ethics.
Comment: But also concerning Socrates: Terence Irwin, [Plato's Ethics](https://books.google.it/books?id=jOjkQ-maz0UC&printsec=frontcover), Oxford UP (1995).
Comment: You can see Gerasimos Santas, [Socrates](https://books.google.it/books?id=_G8VPQAACAAJ), Routledge (1979): Part III is dedicated to Socratic Ethics.
Comment: I should think you might sample some of the Chinese thought on the subject. If for no other reason than "parallax."   https://en.wikipedia.org/wiki/List_of_Chinese_philosophers
Answer: The Republic is pretty entertaining as a read, but as a source it doesn't summarize anything, obviously. Too, reading translations without context and understanding of the original intent, etc. can lead you to 'incorrect' beliefs about the meanings of words, terms, phrases or sentences as a result. But it's entertaining and pretty foundational.
Comment: It's written by Plato, though, and therefore, not the best (but of course a) source to learn what Socrates thought.
Comment: I'd upvote your comments if I could @Lukas :)
Comment: Appreciate the feedback - good luck in your journey. I went through a 'great books' program in undergrad that followed the course of western philosophy, as well as including Eastern samplings. Following the course of time can help choose "what's next" if you are looking to move on from a particular area :) I kinda stopped at the French Existentialists, personally
Comment: Fair enough :) we could get into the "who is Socrates?" here.. but I'm not sure it would add value in terms of the intent of trying to learn about 'Socratic Ethics' as it really would be difficult to distinguish between Socrates' beliefs and the beliefs that others attempt to ascribe to him
Comment: I think I agree with you. Only it seemed to me that the OP is really interested in the historical figure, since he references a book about early greek philosophy as opposed to platos dialogues
Comment: Hey thanks! I'll read the book and mark this as an answer.
Answer: This is just to update and review the answers after three years. You might try:
C.C.W. Taylor, Socrates: A Very Short Introduction.
ISBN 10: 0198835981 / ISBN 13: 9780198835981
Published by Oxford University Press, United Kingdom, 2019.
Peter Adamson, Classical Philosophy: A history of philosophy without any gaps, Volume 1. ISBN 10: 019876703X / ISBN 13: 9780198767039
Published by Oxford University Press, 2016.
Adamson gives a sound account of Socrates' thought, so far as it is known, and leads on to Plato and Aristotle.
An older book, not mentioned so far but well worth reading, is:
J. Ferguson, Socrates: A Source Book.
ISBN 10: 0333117034 / ISBN 13: 9780333117033
Published by Macmillan, 1970.


Why are the higher harmonics less prominent in a spectrum of modal (as opposed to breathy) phonation?

Question: I'm trying to learn more about breathiness. I understand that the cepstral peak is less prominent in the cepstrum of breathy phonation than plain ol' modal phonation -- but I'm not sure why this may be.
Answer: It goes back to the properties of the glottal wave. With modal phonation, there is a sharp discontinuity to what is fundamentally a sine wave coming from the glottal airflow function, when the vocal folds slam shut and are blown open. That gives the modal phonatory source a move triangular shape. With breathy voice, there may not be much (or any) of a closure period, so the source wave is closer to a sine wave. A sine wave has just one component, whereas a triangular wave has many components, the most prominent being the fundamental but higher harmonics are also quite prominent. So it really goes back to the spectrum (or cepstrum) of different glottal airflow functions.
Comment: Just to be clear " with modal phonation ... a sine wave comes from glottal airflow function" but with breathy voice, the source wave "is closer to a sine wave".  Is this accurate? Is it not so that the former is more of a triangular wave?
Comment: Clarified, I hope.


Adobe Reader 9 and Adobe Acrobat Reader DC (Wine)

Question: I installed Adobe Reader in Ubuntu 21.04 because it is required for sign-in documents authenticated, e,e E adhar, etc.  Recently I upgraded Ubuntu from 21.04 to 21.10, and I observed that Adobe Reader 9 and Adobe Acrobat Reader DC were working on Ubuntu 21.04, but they are not working anymore after upgrading to 21.10. I tried reinstalling Adobe Acrobat Reader DC, but it shows that it is not compatible with 64-bit and it is compatible with 32-bit.
Comment: Why do you need to install Adobe Reader? Do you need Adobe Reader for filling out forms?
Comment: it required for sign in documents authenticated, e,e E adhar etc
Answer: Adobe Acrobat Reader DC can be installed in all currently supported versions of Ubuntu by installing the acrordrdc snap package.

Install the acrordrdc snap package.
sudo snap install acrordrdc

Launch acrordrdc.
acrordrdc

Configuring messages will be shown in the terminal while Wine is configuring for Adobe Reader. Wait for Wine to finish configuring for Adobe Reader. After Wine is finished configuring you will see a red Adobe Reader icon in the Dock and this window will open.

Select a language for installer download from the dropdown menu and click the Install button in the Adobe Acrobat Reader DC window. A small progress bar window will open to show the progress of downloading Adobe Acrobat Reader DC.

Launch Adobe Acrobat Reader DC. A red Adobe Reader icon will appear in the Dock when Adobe Acrobat Reader DC is open.
acrordrdc

You may need to disable Protected Mode to open Adobe Acrobat Reader DC.

Press the accept button to accept the Adobe Acrobat Reader DC License Agreement and continue.

You can auto-fill forms if you sign in to Adobe Acrobat Reader DC as shown in the upper right corner of the below screenshot.

My current version of Adobe Acrobat Reader DC is 21.007.20091.59174, the latest version. You may have to reinstall the acrordrdc snap package if you upgrade your Ubuntu release to ensure that it is compatible with your upgraded operating system.
Comment: Acrobat Reader DC (acrordrdc snap) may launch and you can do stuff. But if you want to save a snapshot under another filename, the Save As dialogue comes up completely blank -- no file tree view, no Save As button, nothing! Ubuntu 22.04.3 LTS, 64 bit, current snap as of three days ago.
Comment: @Ibraheem Since it works in your case, maybe you should ask a separate question about the problem importing a digital signature. I don't need Acrobat on Ubuntu 22.04 because I use LibreOffice Writer, LibreOffice Draw, GIMP and PDF Chain for making PDF documents, and they do a great job.
Comment: I try this this is installed but not work as my PC is 64bit It says it is cofiatable in ubuntu 210.10in  32bit and 64 bit is not supported, I am not an expert in this line
Comment: sorry it would be Ubuntu 21.10
Comment: 64-bit is compatible on my system. As  shown in the last screenshot I installed Acrobat Reader DC version 21 on Ubuntu 20.04 64-bit.
Comment: It works in my case but I have a problem importing a digital signature!!!


When to mount your horse?

Question: I'm guessing the best idea would be to hold off on mounting it until it turns into a Warhorse from fighting, correct?
Answer: This can be very situational. However, there are several pros and cons that can help you decide.
Pros:

Carrying capacity is set to maximum when riding. If you need to haul a lot of loot, this may be helpful.
Your magic resistance applies to your pet while riding. This can useful when you expect magical traps, like poly and teleport traps in the lower levels of Gnomish mines. If you do teleport, your ridden pet will come with.
A flying pet allows you to fly while riding.

Cons:

If you are not a Knight, mounting the pet makes it less tame. This could be risky if it's been alone on another level for a while. It may lose its tameness.
You cannot BUC test items with a pet while riding it.
Most effects don't transfer from you to your steed. Your boots of water walking won't work while mounted, and levitation becomes...complicated.
The pet will not attack first or pick up items while ridden. This can be good or bad, depending on the situation (stealing from shop, in desperate need of a corpse to eat, etc.)
While riding, you move at the pet's speed. This can be awesome (warhorse) or not so much (dragon).
Comment: Once again you give me the exact answer I seek. Thanks for going so in-depth.

When to mount your horse?


How much current can a computer power supply deliver when used as differential power supply?

Question: I have a computer PSU which has +12 and -12 volt rails. Although on the side of the supply it says that the -12V line can only deliver 0.5 A, I have tried connecting the +12 and -12 lines across a 5 ohm resistance in order to get 24 volts across it, and when I measured the current it said 4.6 A. Why does this work? How safe would it be to use this method to get 1.5 A at 24 volts for longer time intervals?
Comment: @KyranF  If it were an answer, I would -1 it for being adverse advice.  Possibly, the negative supply has some capacity to work in overload.  That would explain the 4.6A, which was observed by Calin.  But how long can such overload last?  What failure mode to expect if it's overloaded too long?  Only the designers of the PSU would know.  I would not deem it safe to use a 0.5A supply at 1.5A for any extended period of time.
Comment: Use a 2 amp boost module on the 12v rail to get the 24v you need.
Comment: The -12V can only SOURCE 0.5A, it can probably sink far more, as you've seen.
Comment: Well, that's my question. Is it MADE to be able to sink more than 0.5 amps? Can I reliably use it to sink 1.5 amps? Then why can't I find anyone on the internet who did a 24 V supply from a PSU? I can only find people who made 12 V supply's.
Comment: @NickAlexeev I wouldn't deem to safe to use a split supply for 24V shenanigans at all. Sounds like black magic to me. Especially if the end circuitry interfaces with anything else grounded
Comment: @Calin are you telling me you cannot find a 24V supply? the most common industrial power supply DC voltage out there? Check this out http://uk.rs-online.com/web/p/desktop-power-supply/0188781/
Answer: It depends greatly on the exact power supply model, but in general I would not use it unless you example the schematics of your PSU.
Example 1: http://www.smpspowersupply.com/ATX_power_supply_schematic.pdf
In this schematics, +12V and -12V actually come from the same winding on the transformer.
The only difference is -12V has PR1507 diode rated 1.5A, while +12V has U20C20 high speed, dual diode rated 20 amperes.
So if your PSU looks like this, you can get +24V as long as you make sure the diodes do not overheat (it is quite possible that -12V diode has no proper heatsink, and thus it cannot handle full 1.5A for extended periods of time)
Example 2: http://www.smpspowersupply.com/atx-power-supply.html
In this schematics, -12V comes from a separate transformer using 7912 regulator. If you try to draw too much current, either L4 will not be able to provide it, so the voltage will sag, or 7912 will overheat. D5 will then start conduting and your -12V line will measure around +0.7 volts. If your PSU looks like this, you should not try to get +24V from it.


When can potted Strawberry Seedlings be safely transplanted outside considering Squirrel attacks?

Question: Southern California resident here. I have strawberry seedlings and would like to transplant them outside. How old should they be to avoid being eaten by squirrels? I've had days-old seedlings get their crowns crunched off by these little devils.
Answer: Not in California, but we transplant them when root system is strong, the plant/stem is just under 10cm tall by that time in a 10cm pot. Roots spread inside the pot really well, covering full length, but not spiraling around the pot yet. And cover the bed with a net.
Comment: im on the sustainability side of things so no netting for me. so 10cm is a good enough maturity that squirrels won't eat em, or if they do, theyd still survive?
Comment: I'm not sure what you mean by "sustainability side of things". Even if squirrels can't eat the crowns they will walk all over plants looking for one they can eat and break leaves in the process. You need to limit access to anything larger than a bee.
Answer: A reliable & practical thing to do is place curved pieces of medium mesh hardware screen which extend lengthwise over several of your seedlings for each section of screen, pressing the edges of the screen 6-8cm into the soil along both sides of your seedlings! Maybe could start by putting a few seedlings and a couple sections of screen to see if your Garden Guests are also tremendous little diggers! If they aren't great diggers, good, but if they are, then may have to press the hardware screen a little deeper into the soil! Be very careful of the edges of the hardware screen when handling it, but the edges are also a deterrent to little Guest diggers! And be sure to close off row ending sections, by on the end bending  enough screen down to also press into the soil to keep them from coming in each end!
Such hardware screen 'canopies' are fairly durable, stack ok, & are reuseable, and if a bit wider and taller, can also offer protection to larger strawberry plants from other types of guests. And can be easily weighted down if necessary!
There are other methods, but covering strawberry seedlings in this way is effective & reliable, and fairly straightforward! If your Guests, or other visitors, decide in future to try enjoy dining on your larger strawberry plants, it can also be effective. And it allows good airflow and sunlight for your Strawberries!


2013 Kia Sportage - Difficult to select first gear

Question: Our 2013 Kia Sportage 1.7 CRDi has recently developed a problem with gear selection. This is specifically affecting the selection of first gear, whether from neutral or any other gear, and it is also difficult to get out of reverse. It will go in with a bit of force but it feels a bit 'notchy' and I'm worried about damaging the gearbox. I have tested it with the car stopped, and gear selection is smooth for all gears, so this is only a problem with the engine running. I've also checked the clutch fluid reservoir and this is well topped up to just below the max line. Any ideas before I take it to the garage?
Comment: Welcome to the site! Do you hear grinding during gear changes? Have you checked the gearbox oil level and condition?
Comment: There's no grinding, but the feel of the shifter is definitely not smooth. I haven't checked the gearbox oil level, no. Is that relatively easy to do?
Answer: Because you can select all other gears smoothly when the engine is running means that the clutch is operating correctly, and the other gears' synchronizers are also OK.
The problem is therefore either within the gearbox (e.g., worn 1st gear synchronizer), or somewhere in the gear-selection mechanism. The gear-selection linkage, of course, has parts both within the gearbox and outside as well, where the linkage connects to the gear shift lever in the cabin.
You may be able to see parts of the linkage. We had an early 80s VW Golf and the linkage passed through the engine compartment. Nylon bushings would wear and could be seen after lifting the hood. I don't know how the linkage on the Kia is arranged, and don't know if you can visually see anything. If you can't see anything, and are not able or interested to begin disassembling to do so, you'll have to take it to a mechanic.


What is the Joint Probability Density Function (PDF) of Two Dependent Continuous Random Variables?

Question: Let 'X' and 'Y' be two dependent continuous random variables whose marginal PDFs ($f_X(x)$ and $f_Y(y)$) are known. Then, how can we find their joint PDF i.e., $f_{XY}(x,y)$ . Is there any method to calculate this ?
Comment: No. You cannot do this  without further information.
Answer: No, there is not.
If the two random variables were independent then their joint PDF would be $f_{XY}(x,y)=f_X(x)f_Y(y)$.
In in the case of dependent random variables we cannot infer anything, not even that the joint distribution is continous.
For instance, let $X$ be a random variable following Uniform Continous Distribution on $[0,1]$ and let's define $Y=1-X$. Then, it can be proven that $X$ and $Y$ are not jointly continous.


Convert an Illustrator CC file to a layered PDF

Question: Is there a way to Convert an Illustrator CC file (.ai) to a layered PDF?
Comment: Are you asking this question because you don't have Illustrator? Try changing the file extension from `.ai` to `.pdf`.
Answer: Illustrator files actually already contain PDF data. If you rename an illustrator file from .ai to .pdf, it opens as a PDF in PDF viewers, and the top level of layers of an Illustrator file opened as a PDF will ordinarily be treated as PDF layers.
So actually, Illustrator files are already layered PDFs! You don't even need Illustrator to make a basic conversion.
Note that PDF viewers only understand top level layers, not sub-layers; see below for more info. Also be aware that non-Adobe PDF previewers like web browsers and Mac Preview love to ignore your preferences and show hidden layers... never send a client a PDF for review that contains a hidden layer!

You can also export as a layered PDF without the Illustrator-specific stuff.
When you File > Save As > PDF from Illustrator, any layers you've created will become PDF layers visibile and toggleable in PDF viewers, but only if the option Create Acrobat Layers From Top Level Layers is ticked and the compatibility is set to 6+.
More info from Adobe:

Create Acrobat Layers From Top-level Layers. Saves Illustrator's top-level layers as Acrobat layers within the PDF file. This allows Adobe Acrobat 6, 7, and 8 users to generate multiple versions of the document from a single file.
note: This option is only available when Compatibility is set to Acrobat 6 (1.5), Acrobat 7 (1.6), and Acrobat 8 (1.7).

You don't need "Preserve Illustrator Editing Capabilities" ticked to do this.

Note that PDFs can only have one level of layers unless you do some hacky trickery. So if your Illustrator file's Layers window looks like this:

... Layer 4 will get merged into Layer 2 in the PDF. If you want it to be a seperate layer in the PDF, make it a regular layer not a sub-layer.
Comment: Do most PDF viewers actually respect those layers? I've always used Acrobat so I don't know, it's just that Adobe specifically calls them "Acrobat Layers".
Comment: Depends on whether they support layers! I believe in general, browsers don't, Preview type programs don't (and love to show hidden layers... grrr...) but sophisticated PDF readers and printers do; but there's heaps of annoying variation and that's more of a software support http://superuser.com thing... in general if someone *needs* a layered PDF, presumably they have a specific purpose in mind and know what PDF processing software they're targetting and will be doing their own testing anyway
Comment: Makes sense. Just seems strange that Adobe would specifically call them "Acrobat Layers" and only mention Acrobat in the help docs, rather than a more generic "PDF Layers"


How to train a LSTM model for a next basket recommendation problem?

Question: I try to use a LSTM model for a problem of next basket recommendation. I would like to apply the same approach as this article in Python using Keras : A Dynamic Recurrent Model for Next Basket Recommendation
So basically (tl;dr), I want to predict the items that the users will purchase in their next order based on their previous orders. Also, for each user I only need to predict items that have already been purchased by the user.
In my case, I have users whom are buying items at different timestamps.
this is what my X_train looks like :
<code>    user ID       timestamp     sequence of items
    user1            1          array(1, 20)
    user1            2            ...

    user2            1            ...
    user2            2            ...
    user2            3            ...

    user3            1            ...
    user3            2            ...
</code>
The sequence of items represent an array of shape (1,20). These vectors are the mean representation of each items (generated with word2vec) purchased during each sequence.
Then I design my label y_train that corresponds to the next items bought by each user at a given timestamp :
<code>    user ID       label
    user1         np.array(1, 6000)
    user2         ...
    user3         ...
</code>
The labels are 1*6000 vectors [1 0 1 0 0 0 .. 1 ] : 1 indicates that the user purchased the item i, otherwise 0.
So I would like to use a LSTM model to train the past sequences of each user to predict the next purchases.
Below, I define a LSTM model. I don't return the sequence because I have one label by user.
<code>  model_rnn = Sequential()
  model_rnn.add(LSTM(20, return_sequences=False, input_shape=(None, 20)))
  model_rnn.add(Dropout(0.2))
  model_rnn.add(Dense(nb_classes))
  model_rnn.add(Activation("sigmoid"))

  model_rnn.compile(loss='binary_crossentropy', optimizer="Adagrad")
  n_index = X.index.values
  n_sample = int(len(X.index.values)*0.7)
  user_index = np.random.choice(n_index, n_sample, replace=False)
  n_epochs = 10
  for _ in range(n_epochs):
       for index in user_index:
          X_train = X.ix[index, "sequence_items"]
          X_train.reshape(1, X_train.shape[0], X_train.shape[1])
          y_train = y[index, :].toarray()
          model_rnn.fit(X_train, y_train, batch_size=1, epochs=1, shuffle=1)
</code>
As you can see, I train my LSTM with batch_size = 1 because the timestamp is different between the users.
I fit the model on 70% of the users and I test the model on the rest.
My results are very poor, the top-n items recommended by the model for each user are very similar. For example, for a specific user, the model recommend items that never appear in its old sequences while normaly, it must predict items that have already been purchased.
Obviously, my approach is wrong. Maybe the design and training data aren't adapted for my goal.
Have you any idea or advice to fit the data, to reach my goal ? My goal being to predict items that the user have already purchased in the past
Note : When I fit a LSTM model with only one user, I get good results (I predict the next order based on the last user orders). But this approach forces me to train N LSTM model (with N the number of users) and this approach doesn't take into consideration the patterns of purchases of each users.
Thank you,
Answer: Two suggestions to improve the model.

Use average of word2vec to represent the item sequence may lose too much information. It would be worth trying to add an encoding layer to first get the encoded vector of each history item, then concatenate them and put into a dense layer and use that as the representation of history item sequence (you can choose a dimension say 200, 20 is too small).
Enlarge the size of the LSTM. It would be better to first make sure the LSTM can overfit on the input data. From what you have described, the model may even not have learnt well even on the training set.
Answer:  I am quite new to Neural Networks and I am also dealing with some similar problems on the same topic however because I am working based on same author's papers on Next Basket Recommendation i would suggest you to read their previous papers that you can find in this link and this link. The DREAM model is the third approach they have applied on the same datasets for the same purpose and they got the best results, however you might get some more information where the idea came from first in the referenced papers.
 The first suggestion from blacksoil should be the right one to help you but i am also struggling on the implementation of this encoding layer.


Car loses power after a short while and regains it immediately after I shut off the ignition and turn it back on

Question: A few weeks ago my car lost power and the check engine light came on. I  scanned the car and found that the spark plugs and ignition coils needed changing. After replacing the plugs and coils the check engine light went away. However, the car doesn't run at its best. After driving for about 10 mins the car becomes very sluggish and idles very very low. Interestingly, whenever I turn off the engine and run it immediately, then car runs well for about 10mins and becomes sluggish again, until I shutdown and restart the car
Comment: Always suspect the last thing you touched.  Double check that the wiring didn't get crossed. Can you swap back in one of the older coils (maybe one of the new ones is bad)
Comment: What Make/Model? If it's a v6 or v8, you might not notice a cylinder not firing, other than the loss in power. I'd recommend checking that all the wires are tightly connected.
Answer: guys. I have discovered what was causing the issue. It turns out the throttle position sensor (TPS) was bad. The car's losing power was a safety mechanism to prevent damage to the engine. Thanks for your contributions.


Subgroups of $\mathbb{Z}_p^n$

Question: Is there a nice characterization or construction to list the subgroups of $\mathbb{Z}_p^n$, that is, $\mathbb{Z}_p \times \cdots \times \mathbb{Z}_p$ where $\mathbb{Z}_p$ is the cyclic group of prime order $p$?
Answer: Treat it as a vector space over $\Bbb Z/p\Bbb Z$. In this way you can see that it's a simple matter of counting numbers of choices of linearly independent vectors. All subspaces are sub-groups and vice versa since they will clearly be $\Bbb Z/p\Bbb Z$-modules given by descending the usual $\Bbb Z$ action.
But then the solution is clear, you need to count bases for $k$ dimensional subspaces for each $0\le k\le n$ and add up the numbers.
For $\{0\}$, clearly the empty set is your basis. Now any non-zero vector makes a one-dimensional subspace, so there are $p^n-1$, and of course we need to mod out by the scalar multiples, giving ${p^n-1\over p-1}$ one-dimensional subspaces. And continuing in this fashion, we know each time we need to count elements in the so-called Grassman manifold where here $q=p^n$ since they have the same structure as vector spaces.

$$|G(n,k)(\Bbb Z/p\Bbb Z)|=\prod_{i=1}^{k} {(q^{n-i+1}-1)\over (q^i-1)}$$

So the total number of subgroups will be

$$1+\sum_{k=1}^n \prod_{i=1}^{k} {(q^{n-i+1}-1)\over (q^i-1)}.$$

If you're wondering how we come up with these numbers, note that that the product without the denominator counts the number of linearly independent sets of vectors of size $k$ and the denominator gets rid of scalar multiple issues and permutations, so that each subspace is related to the set of all its possible bases.
Answer: All the proper subgroups are isomorphic to a k - fold direct product of $Z_p$where k < n. Obviously the cyclic decomposition of any proper subgroup only contains factors with order a power of p. Since every nonidentity element of any proper subgroup has order p, each factor must have order p. Thus the subgroups are nicely classified by their sizes. As for determining the size of a subgroup generated by a given set of m elements: the group is an $F_p$ vector space, so you can construct the n x m matrix with the elements as columns and perform row reduction to find the rank r. The size of the subgroup generated by these elements is $p^r$.
The number of one dimensional subspaces is $(p^n - 1)/(p - 1)$: there are $p^n - 1$ nonidentity elements and each generates a set of $p - 1$ nonidentity elements. I'm not sure how to count the higher dimensional subspaces but it seems like it might get more combinatorially complex with the increase in dimension, since the intersection of the distinct subspaces may have a wider range of dimensions.
Comment: Yes, if you're only interested in the isomorphism type. But if you want to count, say, how many $k$-dimensional subspaces of $(\Bbb Z/(p))^n$ there are, that's another issue.

Subgroups of $\mathbb{Z}_p^n$


Change in forces acting on a car

Question: As a biochemist now teaching physics (middle school), I have what might be two silly questions.
I get that for a stationary car to move forward, the forward force (acceleration) needs to be greater than the drag force but QUESTION 1 does the drag force decrease when a car accelerates?
I would think it increases as you should experience an increase in air resistance and friction. I also suppose that as long as the acceleration force is greater than the drag force, then the car will move forward.
Then QUESTION 2 for that car to slow down, would you see both an increase in the drag force / friction as well as a decrease in acceleration? I suppose if you just take your foot off the accelerator, you will lose just the forward momentum but if you brake, you will add friction to the mix and increase the drag force.
This might sound a little simple but I am teaching 11-14 year olds so need to keep it simple :-)
Thanks.
Comment: Wow, this is a rather arrogant attitude. When you teach Science as a general subject, you have to teach physics, chemistry, biology and geology. Can you teach all of these? At least I know my limitations and choose to learn more to be a better teacher.
Comment: SIgh... what school district allowed someone lacking any eductation in physics to teach the subject?
Comment: No, it's not arrogant.  It's a flat-out demand from someone who has children and wants properly qualified people teaching them.  And, yes, I can teach all of those.  I took all those courses in high school (and most of them in college as well).  If you don't know physics and knew you'd be teaching it, what were you doing all summer when you could have been reading Halliday and Resnick?
Comment: Typically [air drag](https://en.wikipedia.org/wiki/Drag_(physics)) increases as the square of the velocity, not linearly.
Answer: Answer 1: The Air drag increases as the car accelerates, the Air drag is usually a complicated expression which can be approximated to be
$$F_d=bv$$
where $b$ is a parameter that depends on the the structure or the area of the car,
and $v$ is the velocity,
The friction or rolling friction in particular doesn't depend on speed, It'll remain constant
Answer 2: if on enough acceleration the drag force equals the the car's force you would attain a constant speed, when you take your foot off the accelerator you would be slowed down by the friction and by the drag force, when you apply the brakes as you said the friction force due to braking will also add to this.
Comment: I wonder, wouldn't the effective normal reaction on the car decrease due to aerodynamic lift.Wouldn't there be a less rolling friction, the more velocity it has? Yea there is a drag force due to air. But we should consider the net effective drag on the car, if we want to analyse what actually happends to it ,shouldn't we.
Comment: Yes you are right, but that depends on the design of the car.
Answer: Answer 1:The drag force in the car during the forward acceleration is mainly inertia and                friction. The air resistance is taken into consideration only at high speeds. The air resistance will increase due to fluid dynamics but the frictional force will remain constant. Rolling friction is proportional to Weight of the car not the speed and acceleration.
The simple answer is that the drag force will generate whenever an object is accelerated. Justification is Newton's first law of motion.
Answer 2: You have asked whether there is increase in drag force and decrease in acceleration. Your question regarding the acceleration is incorrect.
THERE IS INCREASE IN DECELERATION AND ZERO ACCELERATION. Let us make that point clear.
If you take the foot off the accelerator the nature does the work you. If you hit the brakes you add to the natural drag produced due to friction and air resistance to make it fancy.
In both of the cases you loose forward momentum and zero acceleration.
You wanted to keep it simple so not mathematical explanation.
Comment: Let me know if you found it useful. I am a rookie review helps.
Comment: Review:  inertia is not a force.  "Drag force," if you mean "air resistance," occurs when an object is moving, not just when accelerated.  I fear your answer is lacking in accuracy.
Comment: According to the D'Alambert's Law Inertia is considered as a force exerted by body to the cause.
Comment: Hi Vinay, yes I agree, that as you take the foot off the accelerator it becomes zero. Sorry, my head was not thinking straight. And thank you for your feedback. One common misconception with 11-13 year olds seems to be that for a car to move forward, it must have increase in force(s) that moves it forward and decrease in force(s) that slow it down. They get the concept of friction pretty easily but don't seem to "see" that it also involved and in fact increases with motion.
Comment: I am glad Sasha, that you understood. Don't worry with experience every one gets the concept. I answered it easily because I am a mechanical engineering student.

Change in forces acting on a car


How can I set up SFTP with chrooted groups?

Question: How can I set up a working sftp server for multiple groups with a chrooted directory?
Comment: Please don't post answers in the question body. If you want to post a guide, ask a question and post your guide as an answer.
Answer: Reposted from the OP's original question by:

I decided to share what finally worked for me. I am a novice 2 months into Ubuntu so please don't shot me yet :) This is nothing new but I had a hard time finding a complete article that explains how can a novice like me could achieve it.
Sudo vi /etc/ssh/sshd_config

and add
Subsystem sftp internal-sftp
Match group Group-A
    ChrootDirectory /Group-A
    ForceCommand internal-sftp
    AllowTcpForwarding no

Match group Broup-B
    ChrootDirectory /Group-B
    ForceCommand internal-sftp
    AllowTcpForwarding no

save and exit and start creating the users and group directories:
sudo useradd Group-A-Users
sudo useradd Group-B-Users
sudo passwd Username
sudo usermod -G Group-A Group-A-Users= All users that belong to this group
sudo usermod -G Group-B Group-B-Users= All users that belong to this group
sudo mkdir /Group-A
sudo mkdir /Group-B
sudo mkdir /Group-A/Upload
sudo mkdir /Group-B/Upload

Now lets set permission to the directories. The main folder must be own by root and no one should have write access to it by any other user or group or it will result in ssh crashing after restart.
sudo chown root /Group-A
sudo chown root /Group-B
sudo chmod go-w /Group-A
sudo chmod go-w /Group-B
sudo chgrp GroupName /Group-A/Upload
sudo chgrp GroupName /Broup-B/Upload
sudo chmod ug+rwX /Group-A/Upload
sudo chmod ug+rwX /Group-B/Upload

This is a guide for dummy's users like me who are new to Ubuntu and want to setup a secure sftp server for work or friends.
Answer: This one way would work, However simply create only one group and add as many users in the particular group so that when the user logs in to the SFTP server he will be chroot to that particular directory.
Then take the ownership of folder ( eg, Folder name is A, B, C and so on ) folder A from root to user x and restrict the access for others and and folder B take the ownership from root to user y and in that way we do not junk up the config file..
Either way is right and it all how you do based on the environment we work and the requirement.


Where can I find option expiry data on DTCC directly?

Question: I know that many news networks like Reuters or some forums report daily (sometimes weekly) about upcoming FX options expiry for NY cut, citing DTCC. However, I navigated around on the DTCC website but couldn't find any information how to check it directly on their website.
Highly appreciate if anybody could provide insight.
Answer: US Exchange listed options information is generally provided by The Options Clearing Corporation rather than DTCC.  DTCC generally clears stock and not options.


iPhone UIScrollView - how to get an image title

Question: I'm ATTEMPTING to learn UIScrollview using Apple's Docs and their sample code http://developer.apple.com/iphone/library/samplecode/Scrolling/index.html but something SO simple is escaping me.
How do you tell what image is currently on the screen, so that if I selected one of the images in the horizontal scrolling view, how would I get the filename of the image, or even a pointer in the array, to then do something further with the image?
I thought with Page Control enable I might be able to find a page # and map it to the image. I thought about counting deceleration to count pages, but a flick no full enough will increment it and give a false number.
The last thing I could think of is to get contentOffSet and divide by image size which will give a 1, 2, 3 and I could point to the array (too tired to try tonight... thought I might ask before I waste a lot more time ;-) ).
Any other ideas? I thought there would be a method somewhere that they use in the photo album app.
PS: Here's the code:
<code>- (void)layoutScrollImages
{
    UIImageView *view = nil;
    NSArray *subviews = [scrollView1 subviews];

    // reposition all image subviews in a horizontal serial fashion
    CGFloat curXLoc = 0;
    for (view in subviews)
    {
        if ([view isKindOfClass:[UIImageView class]] && view.tag > 0)
        {
            CGRect frame = view.frame;
            frame.origin = CGPointMake(curXLoc, 0);
            view.frame = frame;

            curXLoc += (kScrollObjWidth);
        }
    }

    // set the content size so it can be scrollable
    [scrollView1 setContentSize:CGSizeMake((kNumImages * kScrollObjWidth), [scrollView1 bounds].size.height)];
}

- (void)viewDidLoad
{
    self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];

    // 1. setup the scrollview for multiple images and add it to the view controller
    //
    // note: the following can be done in Interface Builder, but we show this in code for clarity
    [scrollView1 setBackgroundColor:[UIColor blackColor]];
    [scrollView1 setCanCancelContentTouches:NO];
    scrollView1.indicatorStyle = UIScrollViewIndicatorStyleWhite;
    scrollView1.clipsToBounds = YES;        // default is NO, we want to restrict drawing within our scrollview
    scrollView1.scrollEnabled = YES;

    // pagingEnabled property default is NO, if set the scroller will stop or snap at each photo
    // if you want free-flowing scroll, don't set this property.
    scrollView1.pagingEnabled = YES;

    // load all the images from our bundle and add them to the scroll view
    //NSUInteger i;
    for (i = 1; i <= kNumImages; i++)
    {
        NSString *imageName = [NSString stringWithFormat:@"Card %d.png", i];
        UIImage *image = [UIImage imageNamed:imageName];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

        // setup each frame to a default height and width, it will be properly placed when we call "updateScrollList"
        CGRect rect = imageView.frame;
        rect.size.height = kScrollObjHeight;
        rect.size.width = kScrollObjWidth;
        imageView.frame = rect;
        imageView.tag = i;  // tag our images for later use when we place them in serial fashion
        [scrollView1 addSubview:imageView];
        [imageView release];
    }

    [self layoutScrollImages];  // now place the photos in serial layout within the scrollview
</code>
Answer: This was easy after a good sleep!
<code>CGPoint p = scrollView1.contentOffset;
NSLog(@"x = %f, y = %f", p.x, p.y);
</code>
Now just divide by 320 (if horizontal and full screen image) and add 1 (because it starts at 0).
Hope this helps someone else!
Paul


Client Side JavaScript [aka Greasemonkey] Key Event Handler

Question: Description
The code captures keypress events that do not occur in a text field and dispatches on the properties of a $command object in the application execution context. I have provided a sketch of the execution context in order to assist your review of the code of interest.
Execution Context Sketch
This is a sketch the dependencies of the code for review. The larger context is a user side script running in Firefox using Greasemonkey. The Greasemonkey script is part of a suite of user side tools. This code is not intended for review.
(function () {

  // There is additional application context for making this global
  window.$snatch = function ($class) {
    return document.getElementsByClassName($class)[0];
  };

  // There is additional application context for making this global
  window.$commands = {};

  /* Define links */
  // There is additional application context supporting defining links
  // independently of the code utilizing them.
  var yes = $snatch('yes');
  var maybe = $snatch('rmaybe');
  var no = $snatch('no');

  /* Create Commands */
  // There is additional application context that makes multiple
  // keypresses a more practical approach than it might appear
  $commands.ccc = () => { close(); };
  $commands.yyy = () => { location = yes };
  $commands.mmm = () => { location = maybe };
  $commands.nnn = () => { location = no };
})();

JavaScript for Review
This code for handling key events originated with a  copy-paste of this example on MDN. The modifications have been primarily to implement dispatch.
/* Key Event Handler */
(function () {
  const commandLength = 3;
  var nOffset = 0;
  var keyQueue = "";

  // Add a new property listing all the properties
  $commands.keys = Object.keys($commands);

  document.onkeypress = function (oPEvt) {
    var oEvent = oPEvt || window.event, nChr = oEvent.charCode, sNodeType = oEvent.target.nodeName.toUpperCase();
    if (nChr === 0 || oEvent.target.contentEditable.toUpperCase() === "TRUE" || sNodeType === "TEXTAREA" || sNodeType === "INPUT" && oEvent.target.type.toUpperCase() === "TEXT") { return true; }
    if (keyQueue.length < commandLength) {
      keyQueue += String.fromCharCode(nChr);
    }
    else if (keyQueue.length == commandLength) {
      if ($commands.keys.includes(keyQueue)) {
        $commands[keyQueue]();
        keyQueue = "";
      }
      else {
        keyQueue = keyQueue.slice(-2);
      }
    }
    else { alert("too many characters!"); }
    return true;
  }
})();

Answer: Future-proofing
The unreachable else that's not entirely unreachable
In your final else-statement you have an alert that screams at the user "too many characters!". First of all, don't use alert(..), especially for something the user has no control over. Use console.error(..) instead, or just ignore it.
If each handler is executed sequentially after the last one is executed, the else statement can not be reached. There is however no guarantee that this is the case as far as I know. Consider writing at least a bit defensively and notice that the situation where more than commandLength character actually means that your character was added before the other handler cut the characters.
The keys command that is actually not a command
You are abusing the $commands variable to store the keys of that array. If in the future you decide that you want to have commands of length 4... you have a problem. Instead use let keys = Object.keys($commands);.
Clearing the keyQueue
You are clearing the queue after you are executing $commands[keyQueue]();. Depending on how long executing that function takes, that can take a long time. Do it as soon as you can.
Magic number
The -2 in keyQueue.slice(-2); is a magic number. What you actually meant to say is likely keyQueue.slice(-commandLength + 1);. Future-proof your code by eliminating that number and replace it by the actual calculation. You can probably even move this code to the top to group together with the other code to determine the key combination.
Issues with style
ES6 and var
You are using const in your code. If you decide to use const, also use let for non-const variables, as they behave much better than variables declared with var.
Comma-seperated declaration of variables
I am not a fan of comma-seperated declaration of variables. If the declaration is split over multiple lines, it is error-prone and easily allows you to drop variables in the global scope. If it is on one line, like you did, it becomes unreadable and falls off the right side of the screen. Just declare each variable on a single line.
Braces
Your usage of braces is inconsistent. I recommend always having a newline after an opening brace.
Mixing of logical or and logical and
Know which operator is evaluated first, the logical or operator or the logical and operator? Yes? Congratulations, because many developers don't. To avoid ambiguity and possible errors in your code, add parenthesis when you have both a logical or and a logical and in a boolean expression.
Unused variable
nOffset does not seem to be used. Lets just delete it.

I would rewrite your code like this:
/* Key Event Handler */
(function () {
  const commandLength = 3;

  //Last pressed keys
  let keyQueue = "";

  let keys = Object.keys($commands);

  document.onkeypress = function (oPEvt) {
    let oEvent = oPEvt || window.event;
    let nChr = oEvent.charCode;
    let sNodeType = oEvent.target.nodeName.toUpperCase();

    if (nChr === 0 ||
        oEvent.target.contentEditable.toUpperCase() === "TRUE" ||
        sNodeType === "TEXTAREA" ||
        (sNodeType === "INPUT" && oEvent.target.type.toUpperCase() === "TEXT")
       ) {
      return true;
    }

    keyQueue = keyQueue.slice(-commandLength + 1) + String.fromCharCode(nChr);
    if (keys.includes(keyQueue)) {
      keyQueue = "";
      $commands[keyQueue]();
    }

    return true;
  }
}());


Can I Switch Shells On Ubuntu Touch?

Question: As far as I know; Ubuntu Touch uses bits and parts of Android's open implementation to handle the parts necessary to work on the Nexus 4 and other devices. I'm completely shooting in the dark; but how probable would it be for that operating system to run/use a separate desktop environment for the device.
Answer: You can stop the running unity desktop with:
<code>adb shell
su - phablet
stop unity8
</code>
Now you can start up whatever you want, as long as it runs with Mir. Everything supporting Qt5 shouldn't be a problem at this point and other toolkits will be supported in the future.

Can I Switch Shells On Ubuntu Touch?


Has the GNU coreutils stat tool changed?

Question: Has the GNU coreutils (8.6) version of stat changed? After a recent update, some scripts I wrote that call stat are not working as expected; in particular, I had been making use of stat -c %Y "${filename}". This is supposed to return the time of last modification in the form of seconds since "Epoch". However, I could have sworn this used to take the form of a whole integer. However, I'm now getting output from this of the form 1287630625.956667227 rather than 1287630625. Since Bash can't handle floating point arithmetic, this is a litttle annoying. Is this a deliberate change? Or a bug? Or has my memory gone fuzzy? I tried searching for information on this, but couldn't find anything.
Comment: I wanted to come back and note that they've reverted to the old behavior for version 8.7 of coreutils, though if you want the decimal places, you can use, e.g., `stat -c $.5Y filename` to get 5 decimal places. Otherwise you get none.
Answer: stat: print timestamps to full resolution was committed to coreutils-8.6.

$ git clone git://git.savannah.gnu.org/coreutils.git
$ cd coreutils
$ git log -1 --grep=time -- src/stat.c
commit 9069af45e691d1252c727da66aa4f3f3c7f1ea29
Author: Eric Blake
Date:   Thu Sep 30 16:42:13 2010 -0600

    stat: print timestamps to full resolution

    * src/stat.c (epoch_time): New function.
    (print_stat): Use it for %[WXYZ].
    * NEWS: Document this.
    * tests/touch/60-seconds: Adjust test to match.
    * tests/misc/stat-birthtime: Likewise.
$ git describe --contains 9069af4
v8.6~29
Comment: Thanks. One would have thought that for backwards compatibility they would have introduced an alternative notation and not replaced %[WXYZ].
Answer: This was unnecessarily disruptive and was reverted for coreutils ≥ 8.7.
Since then you need to specify %.Y etc to get the fractional part included


Are there any benefit to join a party when fighting World Bosses

Question: When I'm doing my daily World Boss tour, I see a lots of people always looking for a party to join. Beside the social aspect, is there any benefit to it that I'm not aware of ?
Answer: There are a number valid reasons to join a party, none of which make it absolutely necessary to do so. Being in a party never directly influences your loot (but see 2.)
1. Protection against disconnects
When in a party, chances are you will be able to rejoin the same map instance as them after a disconnect.
2. Easier tagging/event contribution
To get the full participation credit (the gold medal) for an event, or loot from a specific mob, you have to deal a specific amount of damage. This number is shared in a group, and makes it easier to get tag the mobs before they are killed.
This can be easily observed with the pre-boss champs at the Great Jungle Wurm or Moodnir Ulgoth, where it can be hard to get gold participation without a party.
3. Boon/Buff Priority
Effects that affect a certain number of allies prioritize party members over non-party members, making it easier to buff up in a controlled manner.

However, IMO, the most common reason to join a party is "Monkey See, Monkey Do." If a new player sees someone do it, they usually assume that it's really important for something, without knowing why it makes sense. It's how I started doing it.
Comment: I think the Tequatl example is bad.  Unless Teq has changed recently, it's usually the case that people in the zerg don't party up, so that all of the boons distribute more evenly.  But Boon/Buff priority would certainly be a good reason to party up in more challenging areas like SW and soon to be HoT maps, that way your boons don't land on some random passerby derpin' around.  There's definitely a lot of 'monkey see, monkey do' in world boss trains though(where it only really matters for Ulgoth, Caledon's wurm, etc)
Comment: "This number is shared in a group, and makes it easier to get[sic] tag the mobs before they are killed." Do you have any official sources for that? I've never had problems getting gold participation solo there, but you could be right. +1 for your third point in any case, though I agree with @Ryan that Tea Kettle is probably a bad example.
Comment: @AmosM.Carpenter That reason is the only reason I ever saw quoted in-game when I was new. These days, the disconnect protection is more of an issue, but tagging enemies was always the primary reason before. When dealing with a large zerg, if the damage you do is insignificant, you won't get loot. The exact threshold isn't clear, but can be observed now if you run with a large WvW zerg and only get a single non-crit hit on a Tower Lord while not in a party. It was also more obvious when the Queensdale train was active and slower, lower geared players would barely hit a Champion and get no loot.
Comment: I removed the Teq example, but I actually can't think of any others where it actually makes sense. As for the tagging, @AmosM.Carpenter the three Avatar of Blight champs (husks) just before the (single) Wurm can be hard to fully tag if you are alone and only melee.
Comment: @MrLemon: Which is why you won't find me going all-out melee at such events. ;-) If you're looking for a better example, though, how about the three-headed wurm? Doesn't seem to be done much anymore, but organised, balanced groups are usually required for a successful triple-decap-plus-kill. Or... Orr.
Answer: Many GW2 players believe that being in a party gives you a better chance to get loot, especially at large events with many mobs. However, I don't think this has ever been officially confirmed by the devs, so the best you're going to find is "anecdotal evidence", for instance:

https://forum-en.guildwars2.com/forum/game/gw2/Loot-Solo-vs-Group
https://forum-en.guildwars2.com/forum/game/gw2/Being-in-a-party-means-better-loot-XP
http://www.guildwars2guru.com/topic/78935-magic-find-and-party-loot-tables/
http://www.guildwars2guru.com/topic/74151-is-there-any-benefit-to-creating-a-party/

From my own experience, I don't think the loot quality is any better or worse either way, but I suspect there may be a grain of truth to it in so far as tagging things (which determines whether you get loot, though not how good that loot is) while grouped is easier than when soloing, because (possibly) buffs that you give your teammates may count towards tagging an enemy you don't directly damage yourself. Note I'm being careful not to jump to conclusions, because this is of course also merely anecdotal.
Either way, those people looking to party up at events are most likely those who believe. If you think it's superstition or a placebo effect, don't bother grouping; it's up to you whether you want to believe. ("The loot is out there!")


Trying to use UpdateCursor on Branch versioned layer - RuntimeError: cannot open workspace

Question: I have a branch versioned service layer on ArcGIS Portal. I want editors to use ArcGIS Pro to open a map in a ArcGIS Pro project and use their respective versions of this layer to create new features based off of a reference table that has all of the attributes for the features after they've been drawn in.
I would like the editor to copy and paste the UID from the reference table to their version of feature layer and move onto drawing the next feature. A script will run during non-business hours to run a post from the editor version to the default version leaving the newly created features' attributes blank except for the UIDs.
I would then like the script to populate these attributes using an update cursor.
I have successfully signed into portal using arcgis.GIS and generated the necessary access token used in my url query, I have also done the following:
<code># list of UIDs with null attribute values in feature layer named "UIDS"
# make a dict named "updates" using each item in UIDS as a key and the pair being the attribute values to be carried over to the feature layer

# import modules
import arcpy
from arcgis.gis import GIS

# set up layer for editing
workspace = r"https://url.org/arcgis/rest/services/Map_Docs/FeatureServer?token=" + token
smd = r"https://url.org/arcgis/rest/services/Map_Docs/FeatureServer/0?token=" + token
lyr = "lyr"

# I have done all the necessary steps to connect to portal at this point

arcpy.management.MakeFeatureLayer(smd,lyr)
arcpy.management.ChangeVersion(lyr, 'BRANCH', "sde.DEFAULT")
</code>
This is where things go sideways:
<code>with arcpy.da.Editor(workspace) as edit:
    with arcpy.da.UpdateCursor(lyr, ["UID","Date", "Street"]) as rows:
        for row in rows:
            for k, v in updates.items(): # k =m UID, v = row[1:2]
                if k == row[0]:
                    row[1] = v[0]
                    row[2] = v[1]
                rows.updateRow(row)
</code>
This is the error I get:
<code>---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
In  [25]:
Line 1:     with arcpy.da.Editor(workspace) as edit:

RuntimeError: cannot open workspace
</code>
What do I need to do to open the workspace? I've already generated a token and have successfully tested the query string by pasting it into a private browse for access to both the feature service (FeatureServer/0?token=" + token) and the feature server (FeatureServer?token=" + token)
Answer: I am fairly confident that Branch Versioning doesn't support direct editing.  I think you are going to need to switch to Traditional versioning to use your update cursor.  Or look to the GIS module to run your edits through the REST service.


Installing provisioning profile on iOS 8.0.2

Question: I'm trying to install my prov. profile via email,itunes. When I try to tap the prov. profile in email it  just directs me to settings. I believe that there should be a pop up that ask to install the prov. profile but I see none. Did I forget any important parts that cause this trouble or maybe its a bug from new iOS 8 update?
Answer: "It's not a bug, it's a feature".  Apple has purposely made it so that they can no longer be installed manually by a user and must be installed by dev tools such as Xcode or device management systems such as MDM.  Additionally, they are no longer shown in Profiles & Device Management and are not removable by the everyday user either.
With iOS 8, Apple has moved to the model that any flow that requires the everyday user to install, remove, or even think about provisioning profiles is flawed and that iOS should handle this automatically on the user's behalf.  If the provisioning profile is expired, iOS should get rid of it automatically.  As apps are deleted, iOS should properly deal with the provisioning aspects automatically.  This philosophy is mentioned in WWDC 2014's talk on Managing Apple Devices around ~42 minutes in.
Comment: I just tried installing an app over the air with Crashlytics and it just worked. Is there something going on with the TestFlight App profile which causes it not to install on iOS 8.0.2?
Comment: Crashlytics is doing it the way Apple is prescribing.  Any one who relies on the user having to install the provisioning profile manually in the Settings apps is affected (such as old TestFlight where they'd give you a provisioning profile directly and have you install it).
Comment: "I am the Apple, you are just hiring the hardware from me. You don't have controll over it, we do because you'r just dumb."
Answer: I guess it's a bug. I'm having the same issue with Testflight.
As a workaround install the profile using Xcode's 'Devices' view.
Comment: The problem is that when you go to the devices window -> right click phone -> view provisioning profile -> click + -> browse for the provisioning profile & choose it -> click install .. nothing happens. I'm not able to install the provisioning profile neither through iTunes (option removed) nor Xcode (a bug or I'm not sure why!)..
Comment: Check the Device Log to see if any useful error message was logged.
Comment: No specific log messages pertaining to the issue. It seems like if you are adding a device to an Xcode managed provisioning profile, Xcode is supposed to handle the addition automatically once you add the UDID in the developer account. However, this was not happening. This post provides a workaround which solved this problem: https://matheusandcode.wordpress.com/2015/10/08/xcode-7-adding-a-new-device-to-an-xcode-managed-provisioning-profile/


Is it secure to keep lib files in a public directory if htaccess is redirecting everything to index.php?

Question: Is it secure to keep lib files in a public directory if htaccess is redirecting everything to index.php?
Will htaccess ever fail to redirect?
Are there any loop holes that would allow you to get to the rest of the directory tree?
Answer: .htaccess can fail if for whatever reason  the webserver decides to stop parsing them. Maybe AllowOverride is turned on via an Apache <Directory> directive, and your website gets moved somewhere else and the <Directory> isn't updated. So now suddenly the .htaccess is off and all files are available.
If you don't want something served up by mistake, then don't place it within your site's document root. PHP couldn't care less about the webserver's document root and can access files anywhere on the system that the web server has read permissions. So keep "important" files elsewhere, which minimizes the chances of them being served up by accident.
Answer: If htaccess is protecting the files, there is no such loophole, backdoor, or anything that could allow access. Try accessing the files yourself from the web if you are not sure if they are protected. Redirecting people from a forbidden file is one way to do it, but I personally just 403 them right there, mainly because they are not suppose to be there.
Typically lib files don't do anything on their own (usually they are just functions or classes) so they don't pose an immediate threat if they are designed properly. A way to gaurd against this  on the PHP side is to define some constant, i.e. define('IN_APPLICATION', true);, then at the top of all your lib files, do this check: if !defined('IN_APPLICATION) exit;.
Answer: If the lib files only contain functions or classes and have a file extension (e.g. mylibrary.php) that will be parsed as a php file then in theory there is no security implication from keeping them in the public directory since if a client requests the file the webserver will parse it and output nothing back to the client.
Example library file:
<?php
 function myfunc() {
   //do stuff
 }
?>

Executing that file will not do anything at all.


Populate values in double select box in struts2

Question: I am populating the values in double select box dynamically from database at the time of loading.
I am successful in getting the values for the first select box but I am not getting the respective values for second select box.
Please if any body can help me to get the values in the second select I am really in need.
I am using the MAP collection.
<s:doubleselect label="Control"
name="controlNameValue" list="control.keySet()"
doubleName="controlAreaValue" doubleList="control.get(top)" />

Comment: We need the code of the action too.
Answer: use moveSelectedOptions(... ..) on addToLeftOnClick and addToRightOnClick buttons.


Remove VIM search highlight

Question: After a search I've done, all the matches for the respective query remain highlighted and it's annoying. This happens even after I close the respective file (normal behavior?). How to I remove this?
Answer: You want the command :nohlsearch, but you don't want to type that every time. Put this in your ~/.vimrc:
nnoremap <silent> <leader>n :nohlsearch<CR>

After that, you just enter your leader (which by default is \) and then n to clear the matches. You don't need to use n; if you prefer, pick something else.
You can also remap your leader to something more comfortable, if you like. I use a comma:
let mapleader = ","

(That goes before the mapping to clear searches.)
Comment: I just do :noh which is enough for vim to know what I mean. :)
Comment: @scottl Fair enough (and good reminder that all commands have shortcuts), but I still like to map frequently used commands.
Answer: i just /qiw772723euz to "search" for something thats not in the file. hacky workaround, i know, i am interested in a real solution as well :)
Comment: thats awful but a nice quick and dirty 'solution' though :)
Answer: Similar to @Telemachus answer above, a comment on this answer over at SO by @David Winslow suggested mapping a toggle of hlsearch. You would map the following:
nmap <silent> <leader>n :set hlsearch!<CR>

Hitting n would then toggle highlight search off and on every time you hit it.
Answer: In my config, I clear highlighted search terms by just hitting enter in command mode. This is how that's configured.
set hlsearch    " highlight all matched terms
" Pressing return clears highlighted search
:nnoremap <CR> :nohlsearch<CR>/<BS>

As a side note, I like to make sure that my search matches are highlighted super clearly, no matter the color scheme, so I give them black text on a yellow background.
" When highlighting search terms, make sure text is contrasting color
:highlight Search ctermbg=yellow ctermfg=black
" Do the same for gvim
:highlight Search guibg=yellow guifg=black

Answer: I have a slightly different solution. To me it feels as the natural thing to do would be to press <esc> to make it go away. However, that doesn't work. Mapping <esc> to :noh has nasty side-effects, so that's not an option either. <Leader>n and similar mappings feels unintuitive for me for such a trivial task. However, pressing <esc> twice is something I can live with:
nnoremap <silent> <esc><esc> :nohlsearch<CR>

Remove VIM search highlight


How to decrypt the encrypted password in md5()?

Question:
Possible Duplicate:
Is it possible to decrypt md5 hashes?

I have encrypt the password using the MySQL function md5(),
I need to decrypt the password,
Any one can help.
Thanks.
Comment: Try all possible combinations :))
Answer: MD5() generates a hash, not an encrypted string. Thus you can't decrypt it in principle. But studies shown that MD5 is hackable, but it seems too complicated to study.
From "MD5 considered harmful today" @ http://www.win.tue.nl/hashclash/rogue-ca/:

The cryptographic operation that uses a private key to sign data does
  not deal directly with the data itself, but with a purportedly unique
  representation of this data, that has a predetermined fixed length, is
  short and therefore convenient to work with. This can be compared to a
  fingerprint as a purportedly unique, short and convenient
  representation of a human being. The process of creating such short
  representations of data is called "hashing". Unfortunately, because of
  the fixed length of the hash, there must exist pairs of different
  inputs that yield the same hash value. Good hash functions, however,
  have the property that finding such pairs is extremely difficult, even
  though they are guaranteed to exist. This is precisely where MD5 has a
  crucial weakness.
Answer: MD5 is not encryption, it is a one-way hash. This means that there is no way of going back to the original password given the hashvalue (other than brute-force or a rainbow table attack).
There is a longer, very good explanation, in this similar question and answer.
Answer: In theory, MD5 cannot be decrypted.
In practice, there are many MD5 "decrypters", but they use brute force, or large database of already decrypted code etc... The answerer above probably used one of these. The number of possible combinations is a 1 followed by 48 zeros... enough for a life time.
Source: http://md5pass.com
Answer: MD5 isn't an encryption algorithm.  It's a one-way hash algorithm, so without an attack, you're not supposed to be able to get the password from the MD5 hash.
The idea is that you generate a hash from the password, and then when provided with the password you can confirm that it hashes to the same value.  You're not supposed to be able to go the other way.
Answer: The best reasonably simple way is to search the hash in Google. E.g.:

http://www.google.es/search?q=73868cb1848a216984dca1b6b0ee37bc
Comment: And this will aid the OP in retrieving his password... how?
Comment: Because, as you would have found out if you had clicked on the link, MD5 hashes for most common passwords are already indexed in Google. E.g., `73868cb1848a216984dca1b6b0ee37bc` is the hash for `stackoverflow`.


My 33 months old calls me by her name

Question: My toddler calls me her name. Has anyone else child ever done this. I keep telling her that is her name.
Comment: I have seen a kid call is mother "aunt" because that was the name his cousin used. Or "darling" because that was the name the father used. I have also been called "papa" by a child I did not even know. Just ask her "who am i"? or something.
Answer: A toddler tends to repeat what her or his parents tell the opposite. So, I think that whenever she calls you her name, you just persistently say the correct thing, that is, your name. You should do it over and over, and eventually it will pay off.
In my case, my dear son kept calling the pillow is the "people" although he was aware that it was wrong, but he just called it such name since he found it easy to remember or for some similar reasons. My spouse and his grandparents asked him to call it by the correct name, but he just ignored. However, whenever my son said "people" for pillow, I raised my eyebrows and asked him "Do you want pillow?", or "You want people? They are outside the street". Finally, he says pillow instead of people.

My 33 months old calls me by her name


How to Rate Job Interview Process

Question: Today I went for job interview (I'm fresh graduate Engineer). After having some question answer, one of interviewer ask me to rate the interview process out of 10. So, my question is how to rate interview program. Is there any basic for rating such a interview recruitment process.
Comment: Rather than down voting the question, I will fell more happy if someone have leaved the comment to clarify the reason for down-voting.
Answer: Here's the way I would approach it.
I'd say: five is average. This interview was above average in these three ways.
And then make some specific statements about what just happened between you, for example:

You kept me informed about what was happening throughout the process
We had a good give and take
You explained these interesting details about your company (and then list them)
You gave me an opportunity to talk about my passion for X (repeat whatever that is)

And then say: I'm a tough grader. I'd have to give you an eight or nine.
Comment: woow great. Thanks for listing such a interesting answer.
Answer: This is actually an interview question.  They're trying to see if you can evaluate something on subjective criteria.  Imagine that you had to 'reverse engineer' 'user experience' (UX) in order to improve it.
A good place to start is by figuring out whether your 'intake' (in which you are invited to the interview, show up at the work location, and navigate the building where you're being interviewed) contains anything confusing or ambiguous.
Then evaluate the interviewer on 'knowledge of topic' - did they ask relevant questions, did they understand your answers, did they communicate their employment objectives clearly, could they illustrate to your satisfaction how they felt you might fit in?
Then evaluate 'protocol'.  Having properly covered the relevant material, did they introduce extraneous matters that were, at least on the surface, irrelevant? Did they hit you with a curveball 'out of the blue' to test your reaction to the unexpected? Were they asking questions that seemed focused on age, gender, marital status, or other things that shouldn't have come up?
Then evaluate 'wrap up'. Did they indicate when they would get back to you, how they would do so, who you would see next if they wanted another round, or when and where you would show up for your first day?
If all of these scored high you could rate it toward the 10 end of the spectrum, if it appeared weak then you could rate it lower.  While they may initially simply want a number, be prepared to explain how you came to it.
Comment: Pointing out problems and being vague about it is definitely a negative. If you didn't give full marks and can't say why, I can see why that might count against you.
Comment: @AmyBlankenship I hear you! In my last job search, I said, "Yes" to the first offer... but, while no company or culture is perfect, I'd like to think a "good fit" will pass an hour-long interview. (If the interviewers are aware of their downsides enough not to mention them, that's at least something.) The interviewee risks as much by saying, "Yes" as the hiring manager.
Comment: The question could also be a trap to see how likely you are to point out problems (in some--possibly most--workplaces, pointing out problems is not seen as a good thing)
Comment: @Pattinson nobody here can give you the number you should have said. Meredith is telling you how to work out a number (and explain it) yourself. The explanation is the important part of the answer you would have given in the interview
Comment: @AmyBlankenship (Concerning the trap) That's actually a really great way to find out you don't want to work there! (The real trap is to accept the offer, IMO.) For a software engineer, at least, where problem solving is the name of the game, I'd be disappointed if my co-workers and especially boss discouraged feedback.
Comment: @jpaugh Real workplaces are often disappointing in at least one way. The reality is we all need to work *somewhere* under the current economic structure, and usually that means you can't hold out for perfect.
Answer: I don't know if anyone has established rates like the star system for hotels with specific requirments to meet each level. Minimum would be for them to show some courtesy and hold the interview in an appropriate and comfortable place. I heard of one place that conducted the interview in a moldy basement.
The rest could depend what you think an interview should accomplish. That gets pretty subjective. There are some companies where I knew so little about them, I put a premium on getting information about the company, people and duties for the position. In others I wanted them to learn enough about me, so they could make a hiring decision. It's not an all or nothing thing but emphasising one side or the other.
Different stages of the hiring process can be a big factor on how the interview is conducted. Most initial interviews won't rate very high unless you consider this circumstance. This is driven by who is conducting the interview. An initial HR screening type interview won't be the same as that by the direct supervisor or especially another employee at the same level (They tend to come up with the 'gotcha' trivial technical questions.).
I usually come out of most interviews oblivious to how it went, so they just get a 5 or maybe a 6/7 if I'm in a good mood.

How to Rate Job Interview Process