Can I enclose my oil furnace with drywall?

Question: I want to enclose my oil furnace with drywall and use the other space as a gym. Can I close off the furnace and add an electric fan from gym to the furnace room?
Comment: Please take the [tour] to learn how this site works. "Thanks" comments are discouraged.
Answer: There are two issues with enclosing any combustion appliance:

Heat - Typically there will be specifications of the distance required between the appliance and any walls or other stuff.

Oxygen - Unless the appliance has separate input ductwork, there will typically be minimum requirements in terms of the size of the room and/or the amount of open space required to provide sufficient air (but really oxygen) for combustion. Incomplete combustion can be deadly.

I would not rely on a fan to provide air for combustion. If the fan dies but the furnace keeps going you could be in for a rude awakening. Or lack thereof.
Comment: Note that the distance-to-flammables spec can range from multiple feet with older furnaces to contact with some of the most efficient modern designs. Read your furnace's manual for official specifications.
Answer: As long you provide enough air to the furnace you should be fine.
Fan might be risky if it stops operating thus a permanent air flow is preferred.
Since you need access to the furnace you can use louvre doors type as permanent air supply (preferably in metal). They come in steel (you do not need) or aluminum which is much lighter. Installing a smoke alarm with carbon-monoxide sensor is always good idea just in case. There shall be enough space around the furnace to do service from all sides.


Can you find an item more than once with Move-Find Item?

Question: In Final Fantasy Tactics for the original PlayStation, you can use the "Move-Find Item" ability to find hidden items. If you find the common item on a particular tile, can you play through that map again and have a chance of finding the rare item on that tile? Or can you only find an item once on a tile?
Answer: You can farm items that have a rare chance as long as you have unlimited map access (i.e. Dorter Trade City fight only happens once, so you can only get items from there once).
Here's a guide complete with the drop rates. Maps labelled with OTB mean that it is a one-time battle.
Comment: Are you sure about this? The linked guide doesn't specify one way or another. I also tested this in the Deep Dungeon, and I can only find an item once, and any addition tries will result in traps.
Answer: After playing through a few Deep Dungeon maps multiple times, it appears you can only acquire an item once from a tile with "Move-Find Item". Attempting to find an item a second time in a subsequent playthrough will trigger a trap. This is supported by A Knightblade's Guide to Finding Items,

In some cases, an item may be 'buried' beneath another item. This is often the case in the Deep Dungeon, or with the best items. If you get the 'poor' quality item, you've lost the chance to get the superior one.


Plotting an empty bin in a Seaborn histogram

Question: I'm going through this YouTube series on simulation by The Coding Train. I'm trying to graph some filtered random numbers, but seaborn is leaving an odd gap in the very middle of the histogram.

My data is filtered by collecting random numbers bigger than the output of some function, like $y = x^2$. I also tested graphing the output from random integers from 0 to 100 and did not get the same gap in the histogram, so I thought the issue might be my data. However, I also made a graph using pygame and there is no gap, I also inspected my data; numbers from 1 to 100 are all represented.
Code:
# Choose a function.
# Make randints a, b.
# If b > function(a), return b.
# Repeat and collect b.
# Graph b as histogram.

import collections
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

sample_size = 10**4
dice_max = 100
def function(x): return (x)**2

def main():
    # Debug: Make random data.
    # values = np.random.randint(0, dice_max, sample_size) # Test different data. Problem goes away.

    # Debug: Inspect values then press enter.
    # for i,(k,v) in enumerate(sorted(collections.Counter(values).most_common())): print(i,k,v); input()

    values = [montecarlo(function) for _ in range(sample_size)]
    pg_histograph(collections.Counter(values))
    sns.set()
    plt.show(sns.distplot(values, bins=dice_max, kde=False, norm_hist=False))

def montecarlo(function):
    """Make randints a, b. If b > function(a), return b."""
    y, b = 1, 0
    while not b > y:
        a, b = (np.random.randint(dice_max) for _ in range(2))
        y = function(a)
    return b

def pg_histograph(bins):
    """Make histograph using pygame."""
    import pygame as pg
    window_width = 800
    window_height = 800
    bar_color = pg.Color('black')
    bg_color = pg.Color('white')
    pg.init()
    window = pg.display.set_mode((window_width, window_height))
    window.fill(bg_color)

    bar_width = int(window_width / len(bins))
    max_count = bins.most_common(1)[0][1]
    for bin_, count in bins.items():
        bar_height = round(count / max_count * window_height) # Fit y values to window.
        x = bin_ * bar_width # Fit x values to bar size.
        y = window_height - bar_height # Bars extend downward from x,y, so they need to be shifted up by bar_height.
        pg.draw.rect(window, bar_color, (x, y, bar_width, bar_height))
    pg.display.update()

main()

Comment: Maybe the same problem as: https://github.com/mwaskom/seaborn/issues/327 ; try setting the bins explicitly?
Answer: Plotting empty bins can happen in Seaborn when plotting histograms with discrete data.
Plotting empty bins can be prevented by adding discrete=True.
sns.histplot(values, bins=dice_max, discrete=True)


implementing a Chrome extension on/off toggle button

Question: i am trying to implement an on/off toggle for my extension, which is a content script that hooks into the "beforeload" event and selectively cancels requests based on some logic (eg. you want to prevent a certain domain's URLs from loading, a specific URL from loading, etc.).
I am setting an "enabled" variable in my background page and using chrome.extension.sendRequest() in my content script & chrome.extension.onRequest.addListener() in my background extension page to retrieve the extension's enabled/disabled state
background script:
Settings = {};
Settings.enabled = 1;

chrome.extension.onRequest.addListener(
    function(request, sender, sendResponse) {

        if (request.getState == "enabled") {
            sendResponse({result: Settings.enabled});
        } else {
            sendResponse({});
        }
    }
);

I have a pop-up page that handles setting the enabled/disabled variable. When the "enable" button is clicked, chrome.extension.getBackgroundPage().Settings.enabled = 1; fires, and when the "disable" button is clicked,
chrome.extension.getBackgroundPage().Settings.enabled = 0; fires (this functionality works fine)
My content script before I started checking for the "enable/disable" variable  (should_block_request is pseudocode):
(function() {
    document.addEventListener("beforeload", function(event) {
        if (should_block_request) {
            event.preventDefault();
        }
    }, true);
}());

And here it is afterwards, using message passing with chrome.extension.sendRequest() to query the "enabled" setting in the background page, and doing the request blocking logic inside its callback
(function() {
    document.addEventListener("beforeload", function(event) {
        chrome.extension.sendRequest({getState: "enabled"}, function(response) {
            var enabled = response.result;
            if (!enabled) {
                return;
            } else {
                if (should_block_request) {
                    event.preventDefault();
                }
            };
        });
    }, true);
}());

The "before" content script works as expected, blocking requests when the criteria are met, but when i try the "afterwards" version of my content script, the criteria are still met, but the requests are not blocked even though event.preventDefault() is called.
Is chrome.extension.sendRequest() the right way to check for the Settings.enabled variable inside a "beforeload" event handler callback? Does event.preventDefault() need to be called a level higher than I currently have it?
Answer: I'm not sure if this is helpful, but in chrome v16 and later extensions may disable/enable javascript.
Here's one such extension: http://code.google.com/p/chromium/issues/detail?id=71067


Meaning and etymology of "kemosabe"

Question: I've heard it recently in a movie called " Lone Ranger". Tonto called the lone ranger kemosabe. What does it mean and what is the origin?
Comment: There is just to much complication. Couldn't find a reliable source. Every site is saying something different.
Comment: Some interesting suggestions available on line.
Answer: This article in Slate states:

The phrase has stumped scholars and Lone Ranger fans alike for
  years, and there appears to be no conclusive evidence as to its true
  definition or its roots.

However, another site (written by a specialist in Siouan languages) asserts:

The word Kemosabe is from an Algonquian language similar to Ojibwe (a
  complex of related dialects extending from the northern Plains across
  the Great Lakes into Eastern Canada).
  ...
The word in question has been explained as 'scout' or 'spy' or even
  'masked man'.  In the Odawa or Ottawa dialect of Ojibwe the word has
  the form giimoozaabi.  (Doubled vowels are longer.)  Giimoozaabi is an
  independent mode third person singular verb meaning 'he looks in
  secret'.  In Ojibwe a verb form like this like this can be used as a
  noun, too, so the gloss 'he who looks in secret, a secret looker' is
  also appropriate.

The site provides fairly lengthy discussion that's worth a read.
Comment: Interesting stuff. I always just thought both names were taken from Spanish. "Tonto" meaning "Stupid" and "Quien No Sabe" meaning "He Who Doesn't Know".
Comment: @TJY The correct translation of 'he who doesn't know' in Spanish is 'El que no sabe'.  But this doesn't mean it wasn't a naive Spanglish translation.

Meaning and etymology of "kemosabe"


Can we show that #3CNF is in FPTAS

Question: If we have a deterministic algorithm $A$ such that $\#3CNF \in APX$, how can we show that there is a fully polynomial deterministic approximation scheme for $\#3CNF$? How can we show that $\#3CNF \in FPTAS$?
Answer: Given a CNF $\varphi$, you can create a CNF $\varphi^{(2)}$ such that $N(\varphi^{(2)}) = N(\varphi)^2$, where $N(\varphi)$ is the number of assignments satisfying $\varphi$. If you apply a #SAT approximation algorithm to $\varphi^{(2)}$, then you get an approximation of $N(\varphi)$ which is better than what you would get if you applied the algorithm directly on $\varphi$. To get an even better approximation, create a CNF $\varphi^{(k)}$ such that $N(\varphi^{(k)}) = N(\varphi)^k$.
In your case you have the additional complicated that everything is a 3CNF, but I suggest starting without this restriction.

Can we show that #3CNF is in FPTAS


How soon can I begin restoring the Thieves' Guild?

Question: In Skyrim, during the thieves guild questline, do side jobs count towards the end restoration if you haven't yet finished the Thieves Guild questline? I understand that you can't restore the Thieves Guild until you finish the quest line, but will they count before then for the four cities that I have to do jobs in? I've restored the guild before but never actively done side jobs before the questline was finished.
Comment: In regards to possible dupe close votes: our [main question](http://gaming.stackexchange.com/q/38891/108003) regarding this mechanic doesn't address this particular detail.
Comment: Don't see an answer on The Elder Scrolls Wiki pages for [Under New Management](http://elderscrolls.wikia.com/wiki/Under_New_Management) or [City Influence Quests](http://elderscrolls.wikia.com/wiki/Thieves_Guild_(Skyrim)#City_influence_quests). Probably need to hear from someone who has tested this in-game.
Answer: TLDR:  As soon as you can start doing "Small Jobs" for the Guild.

FWIW, I'll usually bring the holds back under control 1st so that I can:

Bribe guards
Spawn the remarkably lucrative Thief Caches which supply you with:

Leveled Ammo
Leveled Enchanted Daggers
Lockpicks (you'll have so many that locksmithing perks become a waste.)
Gems (Hello Smithing Experience!)

Have more fence options.
The Windhelm Influence quest gives access to Linwe's Armor that has different enchantments than the guild's armor but does combine with guild armor for light armor's set perk bonuses.  Quite nice for the young rogue.  I'm a big fan of the +15% bow damage on the hood.
The extra shops in The Ragged Flagon don't hurt either.

... Waiting on the later parts of the main guild quest line until L46 so that I can get the best of the leveled rewards from it.  Yes, I can be a bit of a munchkin.  If you're interested, I'll get to the point in Speaking With Silence where Mercer asks you to join him in the frozen tundra and then leave him to chill out while I work on getting to L46.  This allows me to start Hard Answers at a point where all the best versions of Nightingale gear is locked in.
Also you'll notice that the Cistern will have its decor upgraded and the tables/shelves will have more food/junk on them.  With each city brought back under Guild control, one of the Cistern's entrances will gain a couple tapestries on either side of it.  Eight total tapestries plus earning a fence in each Kajit caravan, and you're done with the side jobs to restore the guild.  After that it's just the main quest line.
Comment: I think the asker understands this. They're asking if doing small jobs before finishing the main quest line will count toward the five they need, or if they should wait until they've finished the quest line.
Comment: @DCShannon, how 'bout that?
Comment: You're saying that, in the past, you've done the side jobs before finishing the main guild quest line, and those side jobs allowed you to do the influence quests as soon as you finished the main quest?
Comment: @DCShannon, No, sooner.  Delvin & Vex won't even give out another side quest once you've done enough side jobs for a city, but haven't yet done the influence quest.  I've generally completed all 4 influence quests before I'm done w/ 1/3 of the main Guild quest line.
Comment: Well then that's the answer. +1. FWIW, I think I've done that too, but I don't remember for sure.


Import python packages problem

Question: I have a problem. I'm trying to install a script written in python. It requires 3.4+ version, and I have python2.7 python3.4 python3.5 installed on my ubuntu 15.10 by default. During setup it throws an error which I found is concerning missing packages in python.
The error is
File "/usr/lib/python3.4/distutils/dist.py", line 1209, in set_requires distutils.versionpredicate.VersionPredicate(v)
File "/usr/lib/python3.4/distutils/versionpredicate.py", line 114, in __init__ raise ValueError("expected parenthesized list: %r" % paren)
ValueError: expected parenthesized list: '-branch'

I looked into source, found list of required packages and made a small script which gives me missing ones
import pip
installed_packages = pip.get_installed_distributions()
flat_installed_packages = [package.project_name for package in installed_packages]
packages = [
    "aiohttp",
    "httplib2",
    "socksipy-branch",
    "requests",
    "dns",
    "url"
]
for needle in packages:
    if needle in flat_installed_packages:
        print('Found ', needle)
    else:
        print('Not found ', needle)`

Output is
Found  aiohttp
Found  httplib2
Not found  socksipy-branch
Found  requests
Not found  dns
Found  url

I tried to install these with synaptic manager, with manual apt-get, with pip, pip3, pip3.4 but with no luck. As I can see from random messages during package installation it installs them into python 2.7, no matter what I do. How do I get them into 3.4 version? Please help me.
Answer: Python2 and Python3 are independent of each other and have to be considered separately.
To install socksipy for Python 3,
sudo apt-get install python3-socksipy

Comment: Thanks for reply. This doesn't help, after run this command my check script says Not found  socksipy-branch

Import python packages problem


Integrating google code SVN repository with MantisBT

Question: I am trying to figure out how to integrate my google code repository with my mantis bug tracking system.  I know google allows you to use post-commit web hooks, but I can't figure out what the exact URL should be.  There is a lot of information about how to integrate the two, but they all require calling the mantis script from the shell, but I don't have shell access to my web server. Is there any way to get this integration set up?
Answer: in case you're still working on it, I modified the "shell script" to run with the GC post-commit hook. You can find it there : http://www.mantisbt.org/bugs/view.php?id=12569
Answer: You want this blog post. You'll need curl on the server to send commands to mantis, which might be a problem, depending on the scripting language you use to write the hook.
The integration works very well, though I couldn't tie the subversion user who commits to the mantis user who closes the bug. In the end, I just used a 'svn' user who did all the mantis manipulation and added the svn author property to the log message. I also added a list of folders changed (not files, sometimes the changeset list was too big for my purposes) to the log message - that proved to be very useful later on.


GUI tools for Apache

Question: Are there any GUI tools for configuring and monitoring Apache?
Answer: I used this for a while, it doesnt have to many feature but it does it job for managing modules and virtualhosts.

Rapache is a simple tool for
  remotely managing and configuring an
  apache2 instance without having to
  hassle around through configuration
  files.
Comment: Rapache doesn't work on 10.04 and it doesn't look like it will be revived anytime soon.
Answer: You could user Webmin that is a webapp for managing servers. This would also have the advantage of easy remote access.

Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like <code>/etc/passwd</code>, and lets you manage a system from the console or remotely.
Comment: Webmin is not recommended for use on Ubuntu (it was [removed from the Debian and Ubuntu repositories](https://answers.edge.launchpad.net/ubuntu/+question/2873) because the way it works can cause problems when updating).
Comment: The Webmin/Ubuntu incompatibility [looks like](https://www.virtualmin.com/node/21110#comment-95551) an issue of the [past](https://help.ubuntu.com/community/WebMin).
Answer: There is httpd support in Gadmin.
Packages are in the repos and more information can be found on the website
Answer: Here is another tool I found. Does not have all the bells and whistles but it is currently being updated. Highly Integrated Localhost WebServer Indicator
https://launchpad.net/localhost-indicator
Answer: you can use /plesk/whm/directadmin/cpanel they are the most popular gui management tools for web hosting.

GUI tools for Apache


Illustrator copy point

Question: I am following instructions from a class, but the instructions seem to be very outdated. The instructions call to select the top point, and alt-drag that point to create branching "fingers". When I select the top point and alt-drag, the entire shape is copied. What am I doing wrong and how do I do this now?
My problem:
Instructions:
Answer: Draw them with the line tool. Have View > Snap to Point and Smart Guides ON to get the right starting point. With the pen you easily delete nodes.

The 4 red lines needed 4 drags to be drawn with the line tool. But the presented method also works with a couple of tricks as already said by others.
Answer: It does work in recent versions of Illustrator, but you have to hold down Alt / Option after you begin clicking and dragging the anchor. Basically all it does is duplicate the end line segment.
For some reason my version of CC doesn't like to refresh the screen while I'm doing this. So, I have to zoom out and back in to see the result. Don't know why, just a glitch I suppose.
Comment: That was it! Thanks!

Illustrator copy point


are there any open wifi access point softwares without authentication?

Question: I am planning to make a open wifi access point, so that clients can connect to my access point and it should not support suthentification.Please help me in telling some software's besides hostapd.
Comment: What's wrong with `hostapd`?
Answer: Alex Chamberlain's answer is fine, however I suspect you are looking for more details, so I would suggest you look at this series of How To links.
Specifically Part 1 and Part 3, since you are setting up an access point rather than a bridge (which is the scope of part2).
Setting up the Pi as a Wireless Access Point Part 1
Part 3
They are well written, and easy to follow.


What is a good world time app for Mac OS?

Question: Is there something like http://www.worldtimebuddy.com/ or http://everytimezone.com/, but that could replace the default Mac OS time and sit in your menu bar?
Comment: I know that you want a menu bar app, but have you considered using Dashboard? It has a built-in World Clock widget.
Answer: I recommend iStat Menus. It integrates very nicely with the mac menu bar and the Date & Time widget is very customisable and can be made to look identical to the stock Apple menubar app. You have the option to add as many time zones as you like and they are all accessible by clicking the time in the menubar (see screenshot).
iStat Menus 2 used to be free if you can find that version kicking around (needs a kernel extension tweak to work with 10.8 ML); otherwise, version 3 is a (reasonably cheap) paid app.
It also comes with a wealth of other activity monitors that can be placed on the menu bar which integrate equally nicely: both visually and functionally.
Comment: this is indeed a fantastic app ! Cheers for sharing
Answer: I like Hour Lite. It's FREE, simple and has cute UI :)
Answer: Have been using Clocks http://www.studiodalton.com/clocks/ lately, is quite simple and it works. It is $2.99, though...
I should add there is room for improvement though.


What sets the bdeleted field to 1 in the dbo.UserProfile_Full table? Is it the UPA sync timer job

Question: I have deleted a user from AD, i want their user profile and mysite removed. I understand that is the role of the My Site Clean Up timer job. Although it seems the bdeleted field is never changed to 1. When i manually change bdeleted=1 and manually run the My Site Clean Up timer job it works and the user profile and mysite is removed.
Answer: After deleting the user from AD, have you started a full sync in User profile service application?
If not, you need to run a full sync via user profile service application->start profile synchronization, then check again.
Reference: SharePoint: The complete guide to user profile cleanup – Part 3 – 2013


Star Trek: TNG episode where Mr. Data struggles to master a piece of music

Question: I'm looking for the Star Trek: TNG episode (or rather the scene) where Mr. Data practices playing a musical instrument, possibly the violin. He complains about being unable to get the performance perfectly correct, while the errors are of course unnoticeable for a human.
Comment: I suspect your memory of the scene you're thinking of must be distorted in some way. Being unable to play something perfectly just doesn't sound like a problem Data would have, unless he were malfunctioning. If anything, he'd have the opposite problem, playing something with such mathematical precision that it'd be devoid of any emotional expression.
Comment: I remember a criticism that he played a piece perfectly, but had no heart in doing it. He then studies the issue of "playing with heart" where at some point Riker or LaForge catch him listening to 5 performances simultaneously. The onlooker suggests that if he wishes to imitate human heart he should begin listening like a human.
Comment: It could be I've got a distorted memory of the beginning of In Theory: https://memory-alpha.fandom.com/wiki/In_Theory_(episode)
Answer: I found the scene I recalled. It is not Data who fails to perform. It is Jenna D'Sora, in the Episode "In Theory" and Data analysing her playing.
http://www.chakoteya.net/NextGen/199.htm

DATA: Is anything wrong?
JENNA: My tempo was way off. I felt like I
was rushing through the whole piece.
DATA: I do not believe that is
so. Your rhythmic control has improved markedly. I heard no
fluctuations during the performance.
JENNA: Well, maybe, but I ruined
the coda. I got confused with the phrasing again. I kept breathing at
the wrong times.
DATA: The contrapuntal nature of the composition is
most demanding. We will give more attention to the rhythmic patterns
at our next rehearsal. However, I am quite certain the audience was
oblivious to such nuances. They seemed to enjoy the performance
thoroughly.
JENNA: Thank you, Data. You're very generous.
Comment: Don't forget to accept your answer tomorrow.
Answer: It doesn't quite match your comment about him saying there are imperfections, but might you be thinking of "Inheritance"?

[Data's quarters]
(Data plays violin for her. Juliana applauds)
DATA: Thank you. I will be playing this piece at a recital tomorrow evening.
JULIANA: That was beautiful.
DATA: I have been told that my playing is technically flawless, but no one has described it as beautiful.
JULIANA: It was, really.
DATA: Are you certain you are not saying this because you are my mother? I have noticed that parents tend to exaggerate when it comes to their children's accomplishments.
JULIANA: I suppose there's a certain amount of vanity involved, considering that giving you a creative aspect was my idea. Your father didn't really see the point. He thought that since you didn't have emotions, there would be no real need for you to express yourself. Somehow I had the feeling the opposite would be true.
Comment: I'm going to accept this answer, as it is the most useful for someone trying to find any challenges Data could have with music.
Answer: Actually then you are probably remembering Data commenting on the Android Juliana. From TNG "Inheritance"
http://www.chakoteya.net/NextGen/262.htm

RIKER: Only you could have noticed something like that.
DATA: Then there was the concert in Ten Forward.
RIKER: What about it?
DATA: We had practised the piece, and I noticed that she played it the same way during the performance. Every pitch, every intonation, was exactly the same. Only an artificial life form could have done that.

Possibly
Star Trek:TNG "The Ensigns of Command"
Transcript from
http://www.chakoteya.net/NextGen/149.htm

DATA: Captain. Doctor. I am honoured by your presence, but may I suggest you attend the second concert.
CRUSHER: Why, Data?
DATA: Ensign Ortiz will perform the violin part. My rendition will be less enjoyable.
PICARD: Oh?
DATA: Although I am technically proficient, according to my fellow performers, I lack soul.

See also https://memory-alpha.fandom.com/wiki/Violin
Comment: Thank you for this. However, my recollection is specifically about a practice session, where Data explains some specific technical shortcomings of his performance.
Comment: @Simppa Although you did mention Data's practice, you later referred to it as a performance.
Comment: @SovereignInquiry Hmm. Sorry for being unclear. It has been a while. I remember Data was practising with someone in anticipation of a concert or such. However, by performance I mean as in "performance level". Quality of work.


Directory listing for parent directory only in nginx

Question: I'm trying to switch over to nginx from Apache, but one thing that I would like is the ability to allow directory listing for a parent directory (the root, in my case) only. For example, I would like to allow directory listing in the root directory, but I wouldn't like to have listings for any subdirectories (i.e. /somedir).
Answer: Yes. Note that autoindex defaults to off, so you simply allow it in whichever folder you need listings.
server {
    listen   80;
    server_name  example.com
    root   /path/to/root;
    location / {
            index index.php index.html index.htm;
    }
    location /somedir {
           autoindex on;
    }
}

Update
If you want to enable directory listings for directories but not its subdirectories, the location would be more like this, using the = operator (exact match).
    location = /somedir {
           autoindex on;
    }

You might need to cater for a trailing slash. I'd have to try that out to check.
Comment: I'm still not getting the desired behavior. What I was trying to achieve is to have directory listings in a directory, but to not have them in the directories that are in the one that has the listings.
Comment: Please edit your question to more clearly describe your aim. Your comment above doesn't make any sense to me at all. Include an example if it helps. Don't try to explain in comments, edit your question.
Comment: I figured that comment wouldn't make sense, it's difficult to describe.
Comment: Do you mean "I want to allow directory listings for a directory, but not its subdirectories"?
Comment: Yes, and I think that the new answer better reflects that.
Answer: The trick is to set 'autoindex on;' for / using regular expressions, and to use regular expressions for every other block (regex takes priority over simple matches).
sudo nano /etc/nginx/sites-available/example.com

server {
        listen 80;
        listen [::]:80;

        root /var/www/example.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name example.com www.example.com;

        location ~ ^/$ {
                autoindex on;
                #try_files $uri $uri/ =404;
                autoindex_exact_size off;
                autoindex_format html;
                autoindex_localtime on;
        }

        # blocks every other sub directory
        location ~ ^/.+$ {
                autoindex off;
                try_files $uri $uri/ =404;
        }

        # overrides block for subdir3 and it's subdirs.
        location ^~ /subdir3/ {
                autoindex on;
                try_files $uri $uri/ =404;
        }
}

This shows a directory listing for the top level only.  Everything below that requires an index.html or other index file from the list.  An exception is made for /subdir3 which will show a directory listing too, and so will subdirectories of /subdir3.
-Note: The other autoindex_xxx options are, well, optional.  They are highly recommended though.
## After changing directives, be sure to restart your server. (command may vary per your linux distro/OS)
sudo service nginx restart


QGIS Change file browser/chooser default location

Question: Is there a way to change QGIS file browser default location? Currently it points to bin folder of QGIS installation C:\Program Files (x86)\QGIS Brighton\bin.
Comment: Yes, that's the case afaik.
Comment: QGIS should remember the last location used. Does it always show the path to bin even after you have used a different one?
Comment: It depends on file chooser, there are couple in QGIS. In for example distance matrix tool the chooser always points to bin
Comment: That's a plugin. It's behavior is defined by the plugin code and not the core QGIS applicaiton.
Comment: So are you saying that there is no way to set default path like some kind of environment variable?
Answer: Any file selection dialog should remember the last location which was accessed. As far as I know, this works well for all dialogs in the QGIS core but it might not be the case for all plugins.
If you encounter a tool, with a file selection dialog which always defaults to a certain path, e.g. to bin, it would make sense to open a bug report on the (plugin) bug tracker to ask the developer to fix the behavior.


Problem with implementing ERC-20 interface in Solidity contract

Question: I'm trying to implement contract which interacts with ERC-20 via interface. Code of interface was taken from openzeppelin github.
The problem is that it fails any transaction which triggers contract func.
What have I done wrong? :(
Example: Following func checks if sender has enough tokens of ERC-20 and sender allowed to spend tokens earlier. If conditions are success it transfers tokens from sender to custom contract address.
    function deposit(uint256 amount) public {
        require(tokenContract.balanceOf(msg.sender) >= amount, "Sender has not enough balance");
        require(tokenContract.allowance(msg.sender, address(this)) >= amount, "Contract is not allowed to transfer tokens");
        require(tokenContract.transferFrom(msg.sender, address(this), amount) == true, "Could not send tokens from the buyer");
    }

Extra info:

sender has enough tokens to spend
sender has approved custom contract before transaction

Failed transaction url: https://rinkeby.etherscan.io/tx/0x8df7513a0da10645ce3e300399e73bb58d28dcb8bddb92bddf40945751ae69fc
Sample contract code url: https://rinkeby.etherscan.io/address/0x479a28cff2194a67ccb95ddb960d09fcbb127462#code
ERC-20 (USDT) contract code url: https://rinkeby.etherscan.io/address/0x75cb130d6bbd3d915b34573dc3dd3fb45184f12f#code
Answer: That contract doesn't follow the final ERC20 specification.
The declaration for transferFrom doesn't return anything:
function transferFrom(address _from, address _to, uint _value) public;

The calling contract defines transferFrom returning a bool instead:
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

OpenZeppelin provides the SafeERC20 library that is a wrapper that allows interacting with this type of contracts.


Bidirectional data bus divided into nibbles not returning correct data - 8051

Question: Since I have 10 I/O lines connected between two microcontrollers (AT89C4051 + AT89S52), I am trying to get away with elegant data transfer. Instead of spending months redoing an entire circuit board, I'm trying to divide the 8-bit port into two nibbles so I can achieve bi-directional data transfer as well as being able to skip the step of tristating and waiting.
Except somewhere in my code, something is wrong. I managed to transmit the data from the master to the slave and the data is recognized, but when the slave returns its data back to the master, the value returned is incorrect. In this example, the master is supposed to send the value 5 to the slave, and then the slave is supposed to respond back with the value 9, but instead the slave returns the value of 15 (0Fh). I know this because I used the hexadecimal routine (included in the code snippet) that converts the returned value to hex.
I feel there is something obviously wrong in my code but my brain is fried. What can I do to make this code work?
;Port is organized as: rrrrssss where:
;r= 4-bit data received from master
;s= 4-bit data sent to master

;Master begins with this function
test59:
  mov A,#05h ;set output to 5
  lcall uCdat ;process
  lcall printhex ;print result to screen in hex
  ;Expecting A=09h, but always getting A=0Fh. why?
ret

;mini micro issues a 4-bit command to big micro
;then waits for a reply
;Low nibble of accumulator = data to send
uCdat:
  orl A,#0F0h ;Make high nibble tristate
  mov D,A     ;Send XXXXdata to port
  clr ACT     ;Tell remote were ready
  jb ACK,$    ;Wait till remote is done
  mov A,D     ;Get data
  anl A,#0F0h ;High nibble is output
  swap A      ;Make it low nibble
  setb ACT    ;Tell remote were ready
  jnb ACK,$   ;Wait till remote is done
ret

;Function takes input as accumulator and prints out "xnn " where n=hex character
;Example. if A=#0ABh, then xAB is printed.
printhex:
  setb NIBNO
  mov R7,A
  mov A,#'x'
  lcall cout ;each call to cout prints a digit on serial line
  mov A,R7/swap A
  nextnib:
    anl a,#15
    add a,#246
    jnc phexb
    add a,#7
    phexb:
    add a,#58
    lcall cout
    mov A,R7
  jbc NIBNO,nextnib
  mov A,#' '
  lcall cout
ret

;Slave starts with this function
get5send9:
  ;Stall until we receive a 5.
  test1:
    lcall miniuCdatin
    jc test1 ;if C=0, then remote lowered ACT line and we have data.
  cjne A,#05h,test1 ;Input must be 5 to proceed
  ;Send out 9
  mov A,#09h
  test2:
    lcall miniuCdatout
  jnc test2 ;Stall until data is sent out
  ;All this is processed, but apparently 0Fh is returned to master instead of 09h
ret

;Slave calls to get data from master
miniuCdatin:
  mov C,ACT ;Check action
  jc noUdat
    mov A,D    ;receive XXXXdata from port
    anl A,#0Fh ;get request into low nibble
  noUdat:
  mov ACK,C ;Acknowledgement = Request state
ret

;Big slave then processes data then calls this to give result.
miniuCdatout:
  mov C,ACT
  jnc noUdat2
    swap A     ;make output high nibble
    orl A,#0Fh ;Tristate lower nibble
    mov D,A    ;send dataXXXX to port
  noUdat2:
  mov ACK,C
ret

Answer: In miniuCdatout you are setting D only after ACT is set high. So your master reads the default value that is 0FH.


Where can I get the Active Template Library?

Question: I've never worked with COM before, and I've been tasked with writing an application that uses some third party COM objects.  If anyone could point me to some good tutorials on how to use them it would be much appreciated.  More immediately, it appears that I don't have the Active Template Library installed.  I've searched online but can't figure out how to get it.
Comment: In November 2014, Microsoft released a free »Community Edition« of Visual Studio 2013 Update 4, which included both ATL and MFC. As of January 2016, they're still part of Visual Studio 2015 Community Edition.
Answer: It's part of Microsoft Visual Studio (but not the Express Edition.)
Answer: As Dan pointed out, these are distributed with Visual Studio.
If you don't have Visual Studio, you can get the ATL libraries from one of the Microsoft Visual C++ Redistributable packages:

2005 SP1 (32-bit)
2005 SP1 (64-bit)
2005 (Itanium)
2008 SP1 (32-bit)
2008 SP1 (64-bit)
2008 SP1 (Itanium)

Note: The ones marked 2005 are version 8 (atl80.dll), the ones marked 2008 are version 9 (atl90.dll).
Comment: That's not going to get you the headers so that you can actually write ATL code, right?
Comment: I've never done work with ATL.  I just assumed it was done via DLL calls.
Comment: I dont see atl components when I click add item in my atl project.
There is no Visual C++/ATL category
Comment: Those links are broken. Now they just take me to a page to download Windows, Office, etc.
Answer: I think you have to own a copy of Visual Studio 2005 or 2008 (not Express) to get ATL. If you have one of those installed, but you don't have ATL then go to "Control Panel:Add/Remove Programs" and do a "Modify" install (with the program CD or DVD in the drive) and make sure the box for ATL is checked.
Answer: As for tutorials:
I haven't found a really good one online. There are a few OK pages on using ATL/COM:

The Active Template Library Makes
Building Compact COM Objects a
Joy by Don Box (veteran guru of
COM). This article starts: "I love
COM. COM is good. Like a fine pilsner
or ale, COM never disappoints. In
fact, the more I look at COM, the
more I like it. Unfortunately, I work
in C++, and C++ does not share my
appreciation for the finer things in
life." Despite the Grand Master's
proselytizing, and the fact that it's
12 years old now, it's a pretty good
article...
Mike Dunn's excellent tutorial on
COM on CodeProject.
DevGuy's C++ COM Tips -- kind of a hodgepodge of links and suggestions.
The COM Programmer's Cookbook -- this ancient (1995) article isn't bad, despite its age and the fact that it describes implementing COM objects in C rather than C++ (explicit vtables!)

I'm a little rusty myself w/ COM and ATL, but if I remember right, the classes you're going to want to learn that you'll use the most (especially if you are using someone else's COM objects rather than implementing your own) are CComBSTR, CComPtr, and CComVariant. Also the #import statement in Visual C++ makes using external COM objects much easier, it generates a smart pointer class for you from an external DLL or EXE.
If you're going to be implementing COM objects, I would strongly recommend getting a copy of ATL Internals (there's a newer edition out now covering ATL v8). Yes it does go into some gory detail in sections, but even as an intro book it's fairly well written.
If you've never used COM before, the "classic" books Essential COM and Effective COM are very good and you can probably get them inexpensively from your favorite sources of used books. You're also going to want to be very familiar with the RAII idiom, if you aren't already.
The newsgroup microsoft.public.vc.atl is very good for asking particular questions. (they tend to be more gruff there than on StackOverflow, though)
Beware: There are lots of little gotchas with COM, although ATL does help it become a lot easier & without a lot of bloat. The "simulated dynamic binding" techniques aka CRTP are useful in the C++ world, not just in the context of ATL/COM but especially if you are developing a library of reusable classes that you want to subclass or mixin in situations where only one instance is present at a time (e.g. a class CSpiffyFramework that provides mixin functionality that you want to reuse a lot, and you have a derived class that you want to include that functionality, and it's not part of a virtual object model so you don't really need a vtable).
Good luck!
Answer: I installed this: http://www.microsoft.com/en-us/download/details.aspx?id=3138 and got the C++ compiler and all stuff on my buildserver, but no ATLMFC libraries.
The redist packages linked above is just that, redistributables, not the headers and includefiles needed..
After lots of searching, I ended up installing vs2008 on the server, crap.
Answer: here is how to use atl with vs express:
you need WDK 7.1.0:
https://www.microsoft.com/en-us/download/details.aspx?id=11800

Download Visual Studio Express Edition
Get VS Express C++ free from Microsoft
Download the freely available Windows Driver Kit (7.1 or later) from Microsoft
Get WDK 7.1.0 free from Microsoft
You can mount the ISO file with Virtual Clone Drive or extract it with 7-zip.
Install the WDK and select the "Build Environments" option
This will install the ATL and MFC header and lib files. ATL is a requirement for FireBreath on windows. Make sure to install this in the default location so that FireBreath can find it
For VS Express 2010
If you are using an older version of FireBreath, this post by scjohn may be useful for you. Note that FireBreath 1.4 beta 1 and later these steps are no longer needed!

http://www.firebreath.org/display/documentation/Building+with+Visual+Studio+Express
[vs2010 express include path]
C:\WinDDK\7600.16385.1\inc\atl71
[vs2010 express lib path]
C:\WinDDK\7600.16385.1\lib\ATL\i386
Comment: This is outdated and wrong overall. ATL is included in free "Community" editions of a few last releases of Visual Studio. No need to install WDK, and then WDK's ATL is a reduced version.
Comment: @RomanR. i hope you are right, but look at this link: https://stackoverflow.com/questions/3898287/c-include-atlbase-h-is-not-found  and community version is not free for commercial purpose at certain condition. express version only last hope or mingw, clang etc.
Comment: The linked question has an answer with screenshot with boxes to check to get ATL. Note that WDK's ATL you linked is `_ATL_VER=0x0800` which corresponds to [Visual Studio 2005](http://mariusbancila.ro/blog/2015/08/12/version-history-of-vc-mfc-and-atl/). Not only it does not make sense for development with current toolsets, the code does not have to even compile and does not have to run safely (2005 ATL has DEP related issues in particular).


Drupal 7: When using the Features module and the database (e.g content type) is different than the matching Features component

Question: Drupal 7: When using the Features module and the database (e.g content type) is different than the matching Features component (e.g the same content type) what is used when viewing this component within the Drupal webapp?
Answer: If the Feature is overridden, then what you have stored in the database is what Drupal will be using until you revert either the whole feature, or the item in question (such as your View for example).
As an example, if you have an exported View and you make some changes, it will be read from the database. If you either update or revert your Feature, then it will go back to being read from code.


How to control links2 with Python

Question: How can I execute links2 to open a web page and locate and click a text link with Python?
Is pexpect able to do it? Any examples are appreciated.
Answer: Not sure why you want to do this. If you want to grab the web link and process the page content, urllib2 together with an HTML parser (BeautifulSoup for example) may be just fine.
If you do want to simulate moust clicks, you may want to use AutoPy.
Answer: Why do you want to use links2? I don't see how you could benefit from that. It is probably better to approach your problem in a different way, like with mechanize or maybe even twill.
Please provide a description of your overall problem instead of that specific question
Comment: Links2 is more like a real browser which supports Javascript.
Answer: if you want javascript support use selenium rc with whatever language you are comfortable with

How to control links2 with Python


Is kelp tape real?

Question: In season 2 episode 7 of Archer, Rona Thorne suggests using a kelp tape cleansing technique. I was able to find some reference to kelp as a cleanser on the Google, but nothing mentioning 'tape' explicitly. Is this a real thing?
Answer: Here is a podcast of an interview with Maxon Crumb which references the documentary during which Maxon claims to swallow purification cloth which cleanses the intestines. Shatkarma: Yoga Cleansing Techniques include swallowing a 3" by 20' piece of water-soaked muslin, allowing it to stay in the stomach for 5 minutes, and then pulling it out very slowly (so, no, it is not pulled out the other end, and no, it is not made of kelp). This technique is combined with a second enema-like technique (see link) which cleanses the rest of the digestive tract.
A kelp tape is improbable on many counts. First, kelp would digest, particularly if left for three days. Second, the chance that the tape would continue on its own through the intestines without jamming up, well, this just gets too gross. Finally, even if it were possible, you would be keeping the pyloric valve between stomach and intestine open for 3 days. Issues of bacteria growing and bile seeping into the stomach come to mind - neither very purifying!
Answer: I have located a couple references to it, but am not sure it isn't a joke. Many references are very recent, and lead back to Archer, but one leads to a free-form Q&A forum where the specific topic is 'detox'. Kelp Tape is part of the answer. The answer is disgusting, and again, I am not sure it is for real. Further down the thread we come right back to Archer. My most fun answer was the one that went 'Ew. Ew. Ew.'
Comment: Update - continued searching leads to more circuits back to _Archer_. I'm demoting this to 'improbable', but funny, depending on your sense of humor.
Comment: You got farther than I did. I can't decide if I want it to be a real thing or not...it wouldn't surprise me if it is.
Answer: No. Kelp tape is not real.
The problem with the concept described in Archer is that kelp is actually food that people eat and digest all the time. It would not pass through your body as described, it would be digested normally. While kelp is healthy and nutritious, there is also some quackery out there that talks about kelp "removing toxins" from your body, which likely served as partial inspiration for Rhona Thorne's kelp tape. Note that your liver and kidneys remove non-lethal toxins from your body very effectively. Saying that a food or tonic or mystic crystals remove toxins from your body is like saying such things "put oxygen into your blood." They do not. You have organs for that.
Now, there is actually (apparently) an ancient yoga practice of clenaing out your digestive system by swallowing a 22 foot long cloth tape, doing some strange abdominal muscle movements, and then almost immediately pulling it all back out your mouth. There's even a video on line showing a man doing this. As with the "detoxifying" quackery surrounding kelp, this likely served as inspiration for Rhona Thorne's fictional kelp tape.
As a final note, your digestive system would not be strong enough to pull kelp tape through your body, even if the tape stayed intact and was not digested. You would have to continuously swallow it down your throat (with a LOT of water) for three whole days, fighting the gag reflex the entire time. The danger of trying to do this would offset any possible health benefits.

Is kelp tape real?


Convert a string to a gameobject name

Question: I want to use a string to reference a gameobject that I already have in my code, but the console says that you can't convert a string to unityengine.object. I have a string that says aaaa and a gameobject that has the name aaaa.
using System.Collections.Generic;
using UnityEngine;

public class WorldRenderer : MonoBehaviour
{

    public Transform Tile;

    string seed = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaabaaaaaaaa";

    public int worldHeight;
    public int worldWidth;

    private int seedSub = 0;

    public GameObject aaaa;
    public GameObject aaab;
    public GameObject aaac;

    void Start()
    {

        transform.position = new Vector3(worldWidth / 2 * -0.64f + 0.32f, worldHeight / 2 * 0.64f + 0.32f);

        for (int height = 0; height < worldHeight; height++)
        {

            transform.position = new Vector3(worldWidth / 2 * -0.64f - 0.32f, transform.position.y);
            transform.position = transform.position - new Vector3(0, 0.64f);

            for (int width = 0; width < worldWidth; width++)
            {

                seedSub = seedSub + 1;

                transform.position = transform.position + new Vector3(0.64f, 0);
                //Here's the problem VVV
                GameObject tilepos = Instantiate(seed.Substring(seedSub * 4 - 3, 4)) as GameObject;
                //Here's the problem ^^^
                tilepos.transform.position = new Vector2(transform.position.x, transform.position.y);

            }

        }

    }

}```

Answer: I looks like you want to match not the game object name, but the name of your variable. You can do that with a dictionary, something like this:
void Start() {
    var patternMatch = Dictionary<string, GameObject>(3);

    // Add each of your game objects into a collection, with their string as a key.
    patternMatch.Add("aaaa", aaaa);
    patternMatch.Add("aaab", aaab);
    patternMatch.Add("aaac", aaac);

    //...then later, inside your for loop...

        // Form the key you want to search for.
        string key = seed.Substring(seedSub * 4 - 3, 4);

        // Look for a matching entry in your dictionary, and error if missing.
        if(!patternMatch.TryGetValue(key, out GameObject prefab)) {
            Debug.LogErrorFormat("Could not find matching prefab for pattern \"{0}\"", key);
            continue;
        }

        // Now we can use the object we looked up.
        GameObject tile = Instantiate(prefab,
                                      new Vector3(transform.position.x, transform.position.y),
                                      Quaternion.Identity);

   // ...end of your loop
}

Convert a string to a gameobject name


Setting up a local database on a Mac using Visual Studio Code

Question: I'm trying to set up a local database on my Mac using VS Code for development purposes. I have installed MariaDB via homebrew, and I can access it through the terminal and play around with it.
But how do I get the connection-string to put in to VS Code, so when I'm using Entity Framework Core, it will automatically create the tables in the MariaDB database?
Answer: Check the DB provider in :
https://learn.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli
It mention the MariaDB connector as the same as MySQL, using Pomelo.EntityFrameworkCore.MySql, available in Nuget
you can start a project and then add :
<code>dotnet add package Pomelo.EntityFrameworkCore.MySql
</code>
Like described in this pretty straight forward tutorial :
https://www.jerriepelser.com/blog/using-mariadb-with-aspnet-core/
Have fun


Is there any way to date this photo?

Question: I have this older looking Velox photograph with the numbers "430" typed on the back. The Velox logo in this photo has an Oval shape around the text with the text being in a fancy sort of font. I have tried looking into this before but to no avail. I did find someone else on here with the same sort of photo with numbers on the back also being in purple and on velox paper, theres was from around 1937 - 1949
Comment: We need an image to even begin to discuss your question.
Comment: Velox was a photo material maker acquired by Kodak early in the 20th century. Kodak made contact print paper under that name for many years.
Comment: I've never heard of Velox. Any chance of a little more context?
Answer: It is difficult to date a photo based solely on imprints appearing on the back (non-emulsion) side. The imprints can come from many sources, including the paper manufacturer, processing lab, photographer, retail store, etc. Velox paper was manufactured by different companies, and had different codes at different times relating to contrast and paper finish and weight.
Packets of Kodak Velox printing paper showing the Kodak letter/number system for labeling contrast grade and paper finish.

Courtesy of Early Photography (UK)
Velox was originally a Gelatine silver chloride, gaslight development, photographic printing-out paper. It was invented by Leo Baekeland, and manufactured by Nepera Chemical Co., Yonkers, NY, beginning in 1897. In 1899 the company was sold to Eastman Kodak. Velox became a Kodak brand of glossy and matte photo printing papers in various contrast grades. It was marketed as "Velox" until 1947 when they began marketing it as "Kodak Velox".

Prior to 1947 Velox had its own numbering system, after that date Kodak standard designations were used. From c. 1929 the word 'Velox' was surrounded by an oval on the backs of glossy prints, this was to distinguish them when washing and prior to glazing.

Glossy papers had to be glazed on a high-temperature mirror-polished chrome drum in order to achieve the correct finish.

Courtesy Photo Memorabilia UK
As far as code numbering which appeared on the paper's box or packet, they may or may not have been imprinted on the reverse side. Generally a darkroom technician would not need to know what an individual sheet's contrast grade or paper weight was, since they would have taken it out of a marked box or envelope.

By way of example of coding names, before & after 1947: Bromesko CFL 2 D = Cream Fine Lustre, Normal, Double weight. Pre-1947: 47 Z = Cream Lustre, Medium, Double weight.
Bromide WSM 1 S = White Smooth Matt, Soft, Single weight. Pre-1947: BBS 1 = Crayon Black, Soft, Single weight (BBS 1 = Bromide Black Smooth, 1 = soft grade). White Smooth Matt was a completely smooth dead matt paper and Crayon Black was the nearest pre-1947 equivalent surface.

Given these examples of Velox paper's different coding systems, further exploration into the provenance of the photo is not possible without more information or an image of the imprint itself.
Comment: If, as the answer states, Velox was only produced using the trade name Velox until 1947, how did Velox receive different markings after 1947, as the answer also states?
Comment: @MichaelC Velox became a trademark of Kodak, who marketed the paper as Kodak Velox. The logo stamped on the reverse was to differentiate glossy paper, which needed to be drum dried. There was no other way to distinguish glossy from matte before glazing, especially while the paper was wet.
Comment: Then they continued using the trade name Velox after 1947, adding Kodak to it, while continuing to make the product.

Is there any way to date this photo?


How to capture cURL output to a file?

Question: I have a text document that contains a bunch of URLs in this format:
URL = "sitehere.com"

What I'm looking to do is to run curl -K myfile.txt, and get the output of the response cURL returns, into a file.
How can I do this?
Comment: `curl http://{one,two}.example.com -o "file_#1.txt"` https://curl.haxx.se/docs/manpage.html
Answer: curl -K myconfig.txt -o output.txt

Writes the first output received in the file you specify (overwrites if an old one exists).
curl -K myconfig.txt >> output.txt

Appends all output you receive to the specified file.
Note: The -K is optional.
If you are posting to a URL like https://example.org/?foo=1&baz=4
then you need to put double quotes around the URL:
curl -X POST -H "Content-Type: application/octet-stream" --data-binary "@/home/path/file.xyz" "https://xample.org:8080/v1/?filename=file.xyz&food=1&z=bee" >out.txt 2>err.txt

Comment: I use the redirect for my command lines: `curl url > destfile.x`
Comment: @kris you probably have an ampersand in the url.  put the url in double quotes and then try
Comment: When I do either of these the output still displays in the terminal, not in the file
Comment: Sorry maybe I need to clarify - the doc with all my URL's in the format about is called myfile.txt so I do curl -K myfile.txt and it runs though each one but I don't get the output into any file.
Comment: It works without the -K. With it, I get "No URL specified."
Comment: thank you. i was thinking about using wget and then find the solution to ignore the ssl like curl. turned out that we need to only using -o like wget instead of -k like curl :)
Comment: This only captures the last line, not the whole `curl` output.
Answer: For a single file you can use -O instead of -o filename to use the last segment of the URL path as the filename. Example:
curl http://example.com/folder/big-file.iso -O

will save the results to a new file named big-file.iso in the current folder. In this way it works similar to wget but allows you to specify other curl options that are not available when using wget.
Comment: for multiple files use `--remote-name-all` https://unix.stackexchange.com/a/265819/171025
Comment: Another addition for qwr's comment: the argument need to be put before the URLs like `curl --remote-name-all https://example.tld/resource{1,2,3}`. See: https://curl.se/docs/manpage.html#--remote-name-all
Comment: To follow redirect, add `-L` option.
Comment: `-O` - that's a "letter Oooh" as in "Output" (not a zero)
Comment: Exactly what I was looking for, this nice and useful`-O` option. Thanks!
Answer: There are several options to make curl output to a file
# saves it to myfile.txt
curl http://www.example.com/data.txt -o myfile.txt

# The #1 will get substituted with the url, so the filename contains the url
curl http://www.example.com/data.txt -o "file_#1.txt"

# saves to data.txt, the filename extracted from the URL
curl http://www.example.com/data.txt -O

# saves to filename determined by the Content-Disposition header sent by the server.
curl http://www.example.com/data.txt -O -J

Answer: Either curl or wget can be used in this case. All 3 of these commands do the same thing, downloading the file at http://path/to/file.txt and saving it locally into "my_file.txt".
Note that in all commands below, I also recommend using the -L or --location option with curl in order to follow HTML 302 redirects to the new location of the file, if it has moved. wget requires no additional options to do this, as it does this automatically.
# save the file locally as my_file.txt

wget http://path/to/file.txt -O my_file.txt  # my favorite--it has a progress bar
curl -L http://path/to/file.txt -o my_file.txt
curl -L http://path/to/file.txt > my_file.txt

Alternatively, to save the file as the same name locally as it is remotely, use either wget by itself, or curl with -O or --remote-name:
# save the file locally as file.txt

wget http://path/to/file.txt
curl -LO http://path/to/file.txt
curl -L --remote-name http://path/to/file.txt

Notice that the -O in all of the commands above is the capital letter "O".
The nice thing about the wget command is it shows a nice progress bar.
You can prove the files downloaded by each of the sets of 3 techniques above are exactly identical by comparing their sha512 hashes. Running sha512sum my_file.txt after running each of the commands above, and comparing the results, reveals all 3 files to have the exact same sha hashes (sha sums), meaning the files are exactly identical, byte-for-byte.
References

I learned about the -L option with curl here: Is there a way to follow redirects with command line cURL?

See also: wget command to download a file and save as a different filename
Answer: For those of you want to copy the cURL output in the clipboard instead of outputting to a file, you can use pbcopy by using the pipe | after the cURL command.
Example: curl https://www.google.com/robots.txt | pbcopy. This will copy all the content from the given URL to your clipboard.
Linux version: curl https://www.google.com/robots.txt | xclip
Windows version: curl https://www.google.com/robots.txt | clip
Comment: pbcopy is only available on MacOS.  However `xclip` can be used in it's place for [Linux see this question](https://stackoverflow.com/questions/5130968/how-can-i-copy-the-output-of-a-command-directly-into-my-clipboard).  However I would in most cases prefer `curl http://example.com -o example_com.html & cat example_com.html | pbcopy`  So you wouldn't  need to curl again if you accidently clear your clipboard.
Comment: Also this should be used with caution if you're unsure of the size of the payload.  For example you probably wouldn't want to paste this into a text editor, but opening it in vim no problem.
`curl http://www.textfiles.com/etext/FICTION/fielding-history-243.txt | pbcopy` maybe don't try this!
Answer: You need to add quotation marks between "URL" -o "file_output" otherwise, curl doesn't recognize the URL or the text file name.
Format
curl "url" -o filename

Example
curl "https://en.wikipedia.org/wiki/Quotation_mark" -o output_file.txt

Example_2
curl "https://en.wikipedia.org/wiki/Quotation_mark" > output_file.txt

Just make sure to add quotation marks.
Comment: Thank you.  I was looking around for a while before I found your comment.  Now I don't have to watch 59Mb of text scroll up the screen to nowhere any more :-)
Answer: Use --trace-ascii output.txt to output the curl details to the file output.txt.
Comment: Thanks, the man page mentions that this also outputs the "descriptive information" that `-vv` displays (SSL info, HTTP verb, headers, ...), which I wanted to store. None of the other answers write that to a file.
Answer: If you want to store your output into your desktop, follow the below command using post command in git bash.It worked for me.
curl https://localhost:8080
    --request POST
    --header "Content-Type: application/json"
    -o "C:\Desktop\test.json"

Answer: A tad bit late, but I think the OP was looking for something like:
curl -K myfile.txt --trace-ascii output.txt

Answer: My favorite is lwp-download, which can be found here: https://metacpan.org/dist/libwww-perl/view/bin/lwp-download
You can use it like this:
lwp-download http://www.perl.com/CPAN/src/latest.tar.gz

This will store the file as "latest.tar.gz" in your current directory, so no further option is needed.
Answer: Writes the first output received in the file you specify (overwrites if an old one exists).
curl -K myconfig.txt >> output.txt

Comment: The `>>` appends, it does not overwrite. If you would like to overwrite, use a single `>`

How to capture cURL output to a file?


Supplying suggested destination directories to dired

Question: When I rename files to move them I have a handful of popular destinations that I would like to see in the (pseudo)history so that I can just cursor up to choose one. What I'm thinking is something like what dired-guess-shell-alist-user does except instead of suggest commands, suggest destination directory. I know some commands allow you to supply a history but I did not find one for dired. Does such a thing already exist?
Answer:
Customize dired-dwim-target to non-nil.
Advise dired-dwim-target to make it use your favorite directory, instead of what it wants to use.

Be aware that this will affect also similar commands that act on the marked files with respect to some directory.  IOW, it will affect not only C (copying) but things like renaming and linking.


Unterschied zwischen schätzen, anerkennen und würdigen

Question: Könnte bitte jemand den Unterschied zwischen schätzen, anerkennen und würdigen erklären?
Comment: Schau doch bei Wiktionary nach: [schätzen](https://de.wiktionary.org/wiki/schätzen), [anerkennen](https://de.wiktionary.org/wiki/anerkennen), [würdigen](https://de.wiktionary.org/wiki/würdigen). Oder auch bei DWDS: [schätzen](https://www.dwds.de/wb/schätzen), [anerkennen](https://www.dwds.de/wb/anerkennen), [würdigen](https://www.dwds.de/wb/würdigen)
Answer: The best answer you can get is probably from a dictionary, because those words may have slightly to completely different meanings, depending on the context.
I'll give it a shot, though.
Schätzen:
Can either mean to evaluate something (e.g. a distance), to assume something, or to appreciate someone (usually in a positive context).
Anerkennen: Can be used to also express appreciation for something. It does not always have to be used in such a positive context, though. Also, it sounds more formal. Also, it can mean to simply acknowledge something (e.g. an independent nation by other nations)
Würdigen: Is used to express appreciation for something/someone, too. It has a very positive connotation in most of the cases and also sounds more formal than "schätzen" does.
However, if you could give a bit more context on what you are specifically looking for, you'd probably receive more fitting answers.
Comment: Danke das war sehr hilfreich die drei verben haben die Bedeutung( to appreciate) das war ein bisschen verwirrend .


How is it possible to get into PhD in a different institute than Masters when publications take so long?

Question: Usually to be accepted by a PhD program by a reputed university the admission committee looks for candidates who have made research contributions to the desired field (specially through publications). A Masters student however only starts his/her research work in the last semester and even if something substantial is done during that time, getting it published would take a fair amount of time. How is it possible then for a masters student who's applying for PhD showcase their publications in the application?
Comment: I'm not sure if this is entirely accurate, but I won't list it as answer because I'm not certain. While have publications certainly helps your odds, it isn't a requirement for a Ph.D applicant. Many fields offer Ph.D programs directly out of your undergraduate degree which certainly doesn't always lead to publications. Programs are looking for students that have the capability for research. That is, they might see a student whose CV includes many side projects with professors and projects that extend beyond the scope of a course to indicate that they are prepared for higher research.
Comment: You make a list, write (submitted) after each publication, + link to arxiv, if it is in math.
Comment: Some masters degrees are not taught so the student will spend one or two years just on research.
Comment: Yeah.. The question was about taught masters.. Not for the research oriented ones..
Comment: @PerAlexandersson Are submitted publications also given as much importance as ones accepted. Specially for conferences where the acceptance rate is really low.
Comment: @ryan you should write that as answer. I would add that the best evidence for research potential if you have no publications is a strong reference letter from your supervisor/ professor/ mentor or similar.
Comment: You are forgetting that not everybody jumps from a Master to a PhD, so it's not always an issue what you describe.
Answer: There are two ways to look at this question, both of which are answered in the comments. The first of which is just you asking, "I have submitted for publication, but they haven't been accepted yet." As Per Alexandersson said, make a list, write submitted, and if it's in mathematics, you can even link to Arxiv.
But addressing the implication of the question that it is required to have publications to matriculate, I'm not sure that's entirely accurate. Many Ph.D. Programs accept students directly out of their undergraduate degree, and so to expect them to have published research would be generally unfair. It makes more sense for Ph.D. programs to be looking for students who have the capability for research. This capability can be shown through projects that go beyond the scope of the classroom, research with professors that didn't necessarily result in publication, or as astronat mentioned in the comments, by strong references letters from supervisors, professors, etc.
Answer: You're making two false presumptions here. The first of these is:

You can't start doing research until your thesis during your master's degree.

Most applicants for PhD positions start getting involved with research projects in some capacity well before their final semester. Many will start doing research toward the end of their bachelor's programs, which will give them time to get a paper or two into the pipeline before then.
The second problematic assumption is:

Usually to be accepted by a PhD program by a reputed university the admission committee looks for candidates who have made research contributions to the desired field (specially through publications).

Admissions committees look for students who have the potential to make research contributions to the field in which they apply. Somebody can start in one field and move to another one for their PhD program, if they can convince the admissions committee that the move works.
Answer: Submitted manuscripts do not carry the same weight as accepted publications (you can submit almost anything that you want). However, submitted manuscripts backed by strong letters of reference from people the admissions committee trust (preferably your advisor) are very important.
If a reputable member from their field declares that you have done work that is paper-worthy, the committee will generally trust their judgement even if the paper has not been published yet.


Grub won't boot from GPT RAID (gave up waiting for root device)

Question: I'm having problems with booting a Debian 8 system on which I migrated the root partition from a single hard drive to a RAID1 (mdraid).
On every boot, I get the following grub error:
Gave up waiting for root device. Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
   - Check root= (did the system wait for the right device?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/disk/by-uuid/2ab18cb4-a23d-4e5c-b37d-cbd3077b878c does not exist.
Dropping to a shell!
modprobe: module ehci-orion not found in modules.dep

(initramfs)

/dev/md0 is not started, so it can't find the root partition:
(initramfs) ls /dev/md*
ls: /dev/md*: No such file or directory
(initramfs)

I can, however, start the raid manually just fine:
(initramfs) mdadm --assemble --scan
mdadm: /dev/md0 has been started with 2 drives.
(initramfs) ls /dev/md*
/dev/md0

The system will only boot if I manually create the directory /dev/disk/by-uuid and link md0:
(initramfs) mkdir /dev/disk/by-uuid
(initramfs) ln -s /dev/md0 /dev/disk/by-uuid/2ab18cb4-a23d-4e5c-b37d-cbd3077b878c

I hope someone can help me figure out why grub doesn't start the md device by itself. I searched the internet and tried about everything I could find but no luck. I'm really lost right now.
I want to boot via BIOS-legacy, not UEFI.
The only two connected hard drives (SSD!) are formatted with a GPT partition table and the following partitions (exactly the same):
1      1049kB  2097kB  1049kB                     bios_grub
2      2150MB  12,9GB  10,7GB  ext4               raid

(grub-pc needs the first partition to boot from GPT drives)
The Raid1 (v0.90 metadata) is formatted directly as ext4.
Through a live system chroot, I installed grub-pc to /dev/sda and /dev/sdb, changed my fstab, ran update-grub andupdate-initramfs -u -k all.
blkid:
/dev/sda2: UUID="b59d3baf-346b-568d-03a2-8b26060640c5" TYPE="linux_raid_member" PARTUUID="0609ba5b-9065-41f8-80ed-6832e3236ec9"
/dev/sdb2: UUID="b59d3baf-346b-568d-03a2-8b26060640c5" TYPE="linux_raid_member" PARTUUID="24ee1040-02dd-4867-b4da-5be11d59bdcd"
/dev/md0: UUID="2ab18cb4-a23d-4e5c-b37d-cbd3077b878c" TYPE="ext4"
/dev/sda1: PARTUUID="df5161cf-b5b3-422c-9ed2-90a7750ac265"
/dev/sdb1: PARTUUID="7d20b55b-ba50-4187-b05e-ae1f18b21de3"

mdadm.conf contains (only!) the content from mdadm --detail --scan:
ARRAY /dev/md0 metadata=0.90 UUID=b59d3baf:346b568d:03a28b26:060640c5

Here is an excerpt from my /boot/grub/grub.cfg:
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod part_gpt
insmod diskfilter
insmod mdraid09
insmod ext2
set root='mduuid/b59d3baf346b568d03a28b26060640c5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='mduuid/b59d3baf346b568d03a28b26060640c5'  2ab18cb4-a23d-4e5c-b37d-cbd3077b878c
else
  search --no-floppy --fs-uuid --set=root 2ab18cb4-a23d-4e5c-b37d-cbd3077b878c
fi
echo        'Linux 3.16.0-4-amd64 wird geladen …'
linux       /boot/vmlinuz-3.16.0-4-amd64 root=UUID=2ab18cb4-a23d-4e5c-b37d-cbd3077b878c ro  rootdelay=20
echo        'Initiale Ramdisk wird geladen …'
initrd      /boot/initrd.img-3.16.0-4-amd64

Answer: It's not actually grub which does this, but the initramfs. On Debian, the default initramfs implementation is the one inside the initramfs-tools package. What your initramfs does exactly to be able to mount the root filesystem can depend on many factors, including things like which packages are installed (packages can add hook scripts to extend the initramfs functionality) at the time when update-initramfs was last called, and how they were configured.
Since the problem appears to be that your mdraid devices aren't being rebuilt, I suspect that your mdadm package hasn't been configured right. Try to fix that first:
sudo dpkg-reconfigure mdadm

After that, the initramfs should be updated automatically.
If that doesn't fix it, and as part of your migration to software RAID you created a new filesystem, then it may be that your fstab has the UUID of the old filesystem, which now no longer matches the new filesystem. Check this:
grep $(blkid /dev/md0) /etc/fstab

If that produces no output, then edit /etc/fstab to replace the UUID specified there for the root device with the output of blkid /dev/md0, and run update-initramfs again.


Does a slippery liquid leak through pipe fittings?

Question: We use a 6% potassium hydroxide (KOH) solution for electrolysis.  This solution is known to be "slippery".  Does this mean that it will leak/seep through NPT pipe threads more than plain water?
Comment: @JonCuster, it's *not* slippery becuase it *removes* oils, but because it saponifies the fats and oils, changing *skin* to *soap*. That is not at all good for tissues. Sorry if this comment sounds caustic.
Comment: @DrMoishePippik - sigh, yes, you are correct. But because it is messing with those oils it is also ripping them out of the near surface layers...
Answer: Potassium hydroxide ($\ce{KOH}$) makes skin feel slippery because it saponifies oils in your skin, changing them to soap. It is called caustic potash because of the damage it does to tissue.
However, though $\ce{KOH}$ is caustic to skin, it does not affect most metallic pipe or, at 6%, PTFE ("Teflon") tape dope, nor is it much more likely to leak out (it may lower surface tension somewhat, so leakage would be faster if there is a hole). It could cause leaks if there are any glass, aluminum, brass or other materials which it attacks. See this corrosion chart from Dixon.
BTW, PTFE does dissolve in potassium, and other alkali metals, in liquid ammonia, $\ce{NH3}$. See O. Lanzi, S. Godfrey answers.


Homework Questions Criteria

Question: So, I am high school student, and many times, I get stuck on questions, and my teachers often don't clear every doubts. So, I ask on Chemistry.stackexchange, but often get downvoted as whole. Interestingly,
Like this naive question and others, they unusually have lots of upvotes.
I follow all policies for homework questions, like showing your attempt/understanding, writing with no mistakes as possible, and being clear about my questions. But still I get downvoted, which is frustrating.
So I need more tips on improving my questions quality. Every help is massively appreciated
Comment: I guess the linked example question has accumulated so many upvotes simply because it is so old (it is present for almost ten years) and because it is one of the first Google hits when you search for something like "more than 8 valence electrons".
Answer: A number of your questions could be adequately explained by reading a (good, high-quality) textbook, or by watching some proper online videos. Examples (some of which will only be visible to 10,000-rep users):

Why does $\Delta G < 0$ mean spontaneity? — the reasoning is explained in any good physical chemistry textbook.
Are bonds in benzene continually being broken and re-formed? — this common misconception is dealt with in any organic chemistry book worth its salt, along with numerous places on the Internet, including this question and answer on SE.
Why does Avogadro's number work? — many resources explain the concept of a mole and how the different quantities relate to each other. If you have read / watched these and still don't understand it, what makes you think that somebody's explanation here will be any different?

Unfortunately, many posts on here give me the impression that the textbooks available to you are not the best in terms of their content quality. I suggest looking in Resources for learning Chemistry.
Finally, please don't use MathJax (dollar signs, i.e. $...$) to italicise words. This applies equally to this meta question as well as your questions on main site. When you enclose something in dollar signs, you are effectively saying that it is a mathematical equation. If you want to italicise something, just use asterisks *...*.
Comment: Yes, I can understand that, but that's why I specifically also mentioned Internet resources. There are so many YouTube series, or other websites dedicated to learning. And you have Internet access (as evidenced by you posting here), so you definitely can access these. Basically: **be resourceful**. Knowing how to look for information will get you further in life than just knowing things straight up, even if the latter *seems* more impressive.
Comment: Thanks for your suggestion! Unfortunately I live in India, and don't have access to good quality, books. Whatever books available, often is focuses on clearing examinations with tricks, shortcuts, rather than good, conceptual/deep Theory. So, i resort to asking on stackexchange websites.
Comment: Thank you, I will definitely look for resources online!
Comment: @orthocresol Isn't "proper online videos" an oxymoron?
Comment: @Loong I'd say things like MIT OCW are good, although way too advanced for this particular case... There is definitely a lot of lousy stuff on YouTube :-/

Homework Questions Criteria


Python3.3 can't find libpython3.3m.so in linux (pip-3.3)

Question: I'm using ubuntu 12.10 with default python3.2. However I downloaded python 3.3 as its much more polished. Of course, since then I have a nightmare with installing modules for 3.3, as python3 packages from synaptic install to 3.2 dir. So, I installed pip using python 3.3. Now I have pip-3.3 command, great. But, when I tried "sudo pip-3.3 install PySide" I quickly got an error: "error: Failed to locate the Python library /usr/lib/libpython3.3m.so". What's more, when I run "sudo pip install PySide" (command for 2.7), it builded and installed and runs flawlessy. Pyvenv and virtualenv both fail too. But I wan't to do it non-env way,just install pyside to global 3.3 lib dir.
So how can I install that PySide to python 3.3? I just can't get it to work... It looks like I will have to stick with default ubuntu python 3 version (this one runs great, everything works both from pip and synaptic), but I like to use newest python as it gets better and better with every release.
Btw, if that matters I also got following warning before that error:
"package init file 'PySide/init.py' not found (or not a regular file)" and
"package init file 'pysideuic/init.py' not found (or not a regular file)"
Edit: I installed full python3.3 from synaptic, including pythoh3.3-dev, debug, lib etc. Everything.
And that dynamic python 3.3 lib exist in /usr/lib/x86_64-linux-gnu/libpython3.3m.so, maybe just python3.3 package for ubuntu is poor and installs it in wrong direction/doesn't do any symlinks tricks?
Answer: Please try this answer installing from source (PySide). Download pyside sources and install from source, follow the instructions on the link.


How do I fix my touchpad on my Acer 720 Chromebook

Question: I'm extremely new to Ubuntu so most of the time I don't know what's going on.
I just download Ubuntu and in the start-up screen my mouse-pad doesn't work, nor does my touch screen.
How should I proceed?
Comment: http://askubuntu.com/questions/299567/touchpad-not-working-on-acer-laptop and http://askubuntu.com/questions/540375/acer-c720-and-not-responding-touchpad look a lot like your problem....
Comment: I checked out that page, and it didn't seem to fix the problem, so after looking into it some more over the last couple of days, I compiled the easiest fix that worked for me and posted it below. I hope people find it useful.
Comment: possible duplicate of [Acer C720P Touchpad and Touchscreen are not working](http://askubuntu.com/questions/575457/acer-c720p-touchpad-and-touchscreen-are-not-working)
Answer: We're just going to skip the semantics and assume you're using the 32 bit version of Ubuntu 14.04, as that's the version most new users download. If you're not using the 32 bit version of Ubuntu 14.04, this may cause a rip in the space-time continuum. Proceed with caution.
You'll have to use a Linux kernel that has compatibility with your touchpad. There are some custom kernels out there that do the trick, but they tend to be less stable than the mainline, official kernels. Starting in version 3.17, the official Linux kernel added basic support for Chromebooks (including the touchpad and wake-from-sleep). However, Ubuntu 14.10 is the only current version of Ubuntu that's built on top of kernel 3.17. Furthermore, the support in kernel 3.17 is only very basic, which means that your touchpad will likely work, but only sporadically. Never fear, though. There are fixes for these issues too.
Start out by hooking up a wireless mouse (and keyboard, if necessary) so you can install Ubuntu on your Chromebook. After that, go ahead and install Ubuntu like you normally would.
Next, install all the updates available. The updater should pop up after a few minutes of using Ubuntu (after the installation). Enter your password and reboot if it asks you to.
After that, install version 3.17 of the Linux kernel. To do this, open up a terminal window. If you don't know where to find the terminal, just click on the Ubuntu logo in the top left of your screen and type "Terminal" in the search box. Once you have a terminal window open, copy and paste these exact commands in the terminal window, one by one. Enter your password if it asks you to.
cd /tmp/

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.17-utopic/linux-headers-3.17.0-031700-generic_3.17.0-031700.201410060605_i386.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.17-utopic/linux-headers-3.17.0-031700_3.17.0-031700.201410060605_all.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.17-utopic/linux-image-3.17.0-031700-generic_3.17.0-031700.201410060605_i386.deb

sudo dpkg -i linux-headers-3.17.0-*.deb linux-image-3.17.0-*.deb

Then you'll need to restart your Chromebook. Once you reboot, you should be able to use your touchpad, and put your Chromebook in sleep mode (close the lid) without completely shutting it down. Your touchpad may not be as sensitive as you want it to be, and you also may not like the way the touchpad right-clicks (by tapping the bottom-right-side of the touchpad). If that's the case, like I said previously, there is a fix.
To apply said fix, first you need to get back into your terminal (if you aren't still there) and copy and paste the following command exactly as it's stated. Enter your password when prompted.
sudo gedit /usr/share/X11/xorg.conf.d/50-synaptics.conf

This will open a text editor, which we will use to edit the script that defines how your system interacts with your touchpad. To change the sensitivity, and remove the annoying right-click area at the bottom of your touchpad, delete everything in the file and copy-and-paste the text below into the file exactly as it's shown. After doing so, make a backup of the file somewhere else on your computer, so that if your computer deletes the file, you will be able to easily recover it.
# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# DO NOT EDIT THIS FILE, your distribution will likely overwrite
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
#   Option "OptionName" "value"
#
Section "InputClass"
    Identifier "touchpad catchall"
    Driver "synaptics"
    MatchIsTouchpad "on"
    Option "FingerHigh" "5"
    Option "FingerLow" "5"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
  MatchDevicePath "/dev/input/event*"
EndSection

Section "InputClass"
    Identifier "touchpad ignore duplicates"
    MatchIsTouchpad "on"
    MatchOS "Linux"
    MatchDevicePath "/dev/input/mouse*"
    Option "Ignore" "on"
EndSection

# This option enables the bottom right corner to be a right button on
# non-synaptics clickpads.
# This option is only interpreted by clickpads.
Section "InputClass"
    Identifier "Default clickpad buttons"
    MatchDriver "synaptics"
    Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
#       To disable the bottom edge area so the buttons only work as buttons,
#       not for movement, set the AreaBottomEdge
#       Option "AreaBottomEdge" "82%"
EndSection

# This option disables software buttons on Apple touchpads.
# This option is only interpreted by clickpads.
Section "InputClass"
    Identifier "Disable clickpad buttons on Apple touchpads"
    MatchProduct "Apple|bcm5974"
    MatchDriver "synaptics"
    Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
EndSection

# This option disables software buttons on C720 Chromebook touchpads.
# This option is only interpreted by clickpads.
Section "InputClass"
    Identifier "Disable clickpad buttons on Apple touchpads"
    MatchProduct "Cypress|cyapa"
    MatchDriver "synaptics"
    Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
EndSection

Now just reboot, and you should be all set! Your touchpad should now work just like it did in Chrome OS!
As for your touch screen, I have not had any experience in that area (my Chromebook is just a plain, old C720 running Ubuntu 14.04) so someone else will have to help you with that, unfortunately. Best of luck.


efficient Lucene index for boosting queries based on citations and years

Question: I'm building an index of research articles, each of which has fields like the title, authors, abstract text, year of publication, IDs of articles in the bibliography, etc. I need to efficiently combine some queries that are based on the citation links between articles.
EDIT: In a typical example, I might be looking for articles with:
+(title:preterm abstract:preterm)

But I want to boost articles that have been cited many times. So for each article A, I can collect all the articles that cite an article with a query like +bibliography:A, and then index the number of such articles in a new citationCount field that I add to A. Then I can add a citation count boost to queries using a FunctionQuery, an IntFieldSource and a BoostedQuery, to get something like:
+(title:preterm abstract:preterm)
+boost(int(citationCount), const(0.1))

I also want to boost an article based on the terms used in the articles that cite it. So, as above, I can collect all the articles that cite A with a query like bibliography:A, and then index all of their title and abstract terms as new citingTitles and citingAbstracts fields that are added to A. I can then boost queries based on citing terms by creating a query like:
+(title:preterm abstract:preterm)
+boost((citingTitles:preterm citingAbstracts:preterm), const(0.5))

This all works fine until I need a year restriction. For example, I might need to only boost the query based on citations that occurred before 1990. Basically I need something like:
+(title:preterm abstract:preterm)
+boost(int(citationCountBefore1990), const(0.1))
+boost((citingTitlesBefore1990:preterm citingAbstractsBefore1990:preterm), const(0.5))

But following this approach literally and creating each of the XXXBeforeXXX fields (e.g. using queries like +bibliography:A +year:[* TO XXX]) would require massive duplication - for example, all the terms in the abstracts citing an article would be repeated in citingAbstractsBeforeXXX, citingAbstractsBeforeXXX+1, citingAbstractsBeforeXXX+2, etc.
How can I avoid this duplication, but still keep my queries fast?
EDIT: Maybe there's some way to do this with a query time join? The problem feels a little join-like, but I don't immediately see how it would work.
Answer: I am not sure what does "compare user term(s) query <..> against the abstracts of all articles that cited article A before 2003" mean, but for the dates (first example), I'd do the following (pseudo code):
Example documents:
id:article_1
creation_date:1990
bibliography:<none>

id:article_2
creation_date:1991
bibliography:article_1

id:article_3
creation_date:2000
bibliography:article_1,article_2

Then to query for articles which are quoting article 1 before 1996, you query like this:
bibliography:article_1 AND creation_date:[* TO 1996]

This would return id:article_2 and should not be expensive.
Comment: Sorry for not presenting my problem more clearly. I've rewritten the question using your query style above to show what I'm trying to do. Basically, there's one more level of indirection - I need to use the result of a query like `bibliography:article_1 AND creation_date:[* TO 1996]` as a boosting factor in another query.


Why is there no upper-bound on power-efficiency of Hydro-turbines?

Question: We have Betz's law, an upper bound on power efficiency, for wind-turbines. But there is no theoretical upper limit on hydro-turbines, Why this is so?
Is it mainly due to the incompressibility of water?
Answer: Betz' limit arises from the fact that if the turbine tries to take too much energy out of the flow, the wind will divert and go around the turbine instead of through it. With a hydrothermal system the water is typically behind a dam, so the water has nowhere else to go. The turbines effectively convert gravitational potential energy into work, which can be done (in principle) without any thermodynamic losses.
Comment: @kaka yes, indeed it would. I'm pretty sure there are some tidal power schemes that work like that, and Betz' law does apply in those cases. (I've been meaning to update my answer to say that, but I'm a bit busy at the moment.)
Comment: If we replace the wind-turbine in air with water-turbine inside the sea, and let the water be the driving force (just like air do with wind-turbine) then would the Betz' law hold same in water as in air ?
Answer: The Betz system is an open system, with equal air pressure in front of and behind the turbine. The extracted energy comes from taking momentum (or strictly, kinetic energy) from the air and using it to spin the turbine. The Betz limit comes from the fact that slowing the air too much leads to build-up of the air, and flow will go around the turbine instead.
This will work for water in an open system like the ocean in the same way, but most water systems are closed - the turbine is in a pipe, and efficiency can get up to 85%. Here, in addition to momentum of the water, you can also generate a pressure difference from the pipe before the turbine to the pipe after, and this lets you capture more of the energy.
Answer: Arguably, the Betz limit is not an instance or offshoot of the Carnot limit. Indeed, when we ask the question "Given a uniform airflow with speed $v$ just above a rigid firm static infinitely-massive surface, how much electrical energy could we in principle extract from a given volume of air $V$ with contained mass $m=\rho V$?" the answer is "100%" and does not involve the Betz limit. This should not be surprising since macroscopic kinetic energy is organized energy (similar tto the potential energy of the water in the hydro-electric dam) and organized energy can be converted in principle to another form of organized energy with 100% efficiency, exactly like in the case of the hydro-electric dam.
Let me sketch a thought experiment where we approach the 100% energy extraction from wind that was promised before, which at the same time will clarify why the Betz limit may be interesting and significant after all. Imagine having a kind of lightweight (infinitely thin) airtight foil that can unfold itself at your command and enclose a given volume of open space until a balloon-like closed conformation has been reached (complete without any leaky seams). If you were to let this foil deploy itself in the aforementioned uniform air flow in a comoving sense, it is clear that this deployment doesn't require any work from the foil. So after this foil has transformed into a balloon enclosing the volume $V$, we arrange for an additional lightweight anchor on this contraption. Next we arrange a hook connected to a chain connected to a gear connected to a generator on the static ground surface. When the balloon drifts by at relative speed $v$, the anchor attaches to the hook and the generator brakes the balloon until it and the air inside have come to a halt (in actuality it may perhaps brake to a small speed $v_f<<v$ since the wind keeps on pushing the arrested balloon. But this $v_f$ as well as the time-span of the arrest-process can be made smaller by arranging for a heavier gear + generator setup). This arrest-motion is in principle 100% efficient so the initial kinetic energy $\rho V v^2/2$ of the balloon will have been converted into electricity inside the generator.
After the balloon has been arrested, the foil can refold or deflate (an action which doesn't require any work), we transport the folded foil upwind (no work required) and repeat the whole process.
I think I don't need to explain why this whole thought experiment has no practical implications and why a $<100\%$ limit may appear for more practical devices.
I remember a paper by a Portuguese author first pointing out this matter, I'll link it as soon as I remember where I found it.


12v solar panel li-ion charger

Question: I'm planning to use two 6v 0.6W solar panel in series to supply a cheap tp4056 module with builtin cell protection in order to charge a single li-ion battery. In order to regulate the voltage to 5v for the module input I would use a buck converter. Since the module input range is 4.5-5.5v what will happen when in the night the panel voltage drop near 0v? Can the module be damaged? Should I use a cutoff voltage circuit?
Answer: It will be as if you connect an LED to a 1 volt power supply,it doesnt damage anything but due to the resistance of the circuit and low output of the solar panel it just doesnt do anything and it can happen whenever the brightness is reduced to that critical point not just nights.i hope it helps.
Comment: As i said the module has a resistance and as the supplied voltage to it is reduced,less currrent will go through the circuit cauisng it to charve with much less effeciency but it wont damage any parts.the only thing which may cause damage is overloading the module not underloading it.
Comment: The question isn't this. I want know what will happen to the charging module whenever the voltage is much lower than working voltage , for example 1-2v

12v solar panel li-ion charger


Jars needed for exporting ireport to pdf in netbeans

Question: I have a little issue, I've designed a report using iReport 4.1.1 plugin for Netbeans IDE 7.0.
I want to export to pdf, so I imported the following:
    import net.sf.jasperreports.engine.;
    import net.sf.jasperreports.engine.export.;
    import java.util.*;
But I get the error:
    package net.sf.jasperreports.engine does not exist
    package net.sf.jasperreports.engine.export does not exist
I guess the problem is simply because I do not know the jar file to add, where to locate them nor the directory to put them.
I will appreciate anyone who can give me a detailed correct answer. Thank you.
Answer: In general, when you search for jar dependencies, as well as to read the documentation on the productor of the library (in this case Jasperforge), you can serach for dependencies defined in Maven repositories; you can do this even if you don't use Maven for your builds.
Maven POMs are quite understandable XML files and sites that host Maven repositories often have front ends to allow an easy reading of a POM.
If you go for example to Maven repository for JasperReports 3.5.3, you can see all dependencies and make yourself an idea to what jars you have to search for and download for your issue.