How do I get a stuck screw filter off of my lens?

Question: There is a UV-filter screwed on my Canon 16-35mm. For some reason, I'm not able to get it off the lens.
Does anyone has a simple but safe trick?
Comment: Hello, newcomers to Stack Exchange! If you have a suggestion for this problem that is novel and helpful, please share. If one of the existing answers covers the same thing already, please vote that one up instead. Thanks!
Comment: You can try this guys: http://vimeo.com/24834472 ;) but you need to go to Montenegro - Friend of mine dropped lens with UV filter on it... filter went to hell - lens survived :)
Comment: Use graphite from a pencil to lube the filter if you want to reuse it and fear getting it stuck again.
Comment: Use a hacksaw and hammer. No seriously, look here. http://fstoppers.com/canons-terrifying-recommended-way-remove-stuck-filter
Comment: Buy one of these in the appropriate size https://rover.ebay.com/rover/0/0/0?mpre=https%3A%2F%2Fwww.ebay.co.uk%2Fulk%2Fitm%2F19084910325
Answer: I carry a jar lid gripper around in my kit which has always done the trick for me when I need a little extra, well, grip.
The other 'trick' that I have learned over the years is that most people's default reaction to a stuck filter is to get a really good grip on the filter and just try to torque it off. The problem with this approach is that the filter glass is rarely a snug fit inside the metal filter rim. Because of this, gripping the filter firmly often results in the metal filter rim flexing ever-so slightly... Which binds it to the lens even more tightly. With such tiny threads a flexed filter might as well have lock-tite in there!
So it seems paradoxical, but often I've found that by loosening my grip and very gently turning the filter mostly using pressure on the top of the filter, rather than on the sides (which can cause it to flex) I can get it to turn.
Comment: How does the lid gripper work for CPL?
Comment: @ysap: Not as well, obviously. :-)
Answer: If you're out and about and this happens then carry a couple of elastic bands!  These allow you to get a proper grip on the slim sides of the filter so you can remove it.  Often they are stuck not because they are jammed on but because you cannot get enough of a grip to apply enough pressure to start turning them.
A very simply, cheap, and more importantly small, solution that works quite well :)
Comment: I use an elastic band too. Also make sure you apply pressure evenly around the rim of the filter and not just on two sides else the filter distorts and jams. If future remember that you don't need a filter to screw on tight. I always leave them just a little loose on the thread.
Comment: Hours after posting this answer I found the following jar opener free on a magazine ... http://www.trudeaucorp.com/us/products/kitchen-tools-gadgets/p--0999025.html ... small enough to easily carry and should provide even pressure around the filter.
Comment: I had a polarizing filter stuck - this solution worked for me!
Answer: You can buy lens filter wrenches -- if you don't think they'd be something you'd use all the time (and thus, buy), you might find that your local camera shop has one you could use.
Comment: This is what I did.  Rubber bands didn't work for me, and I really needed a specific, narrow grip on the filter that didn't catch the normal rotating portion of the CPL.
Answer: When separating a stuck filters that are correctly screwed together the key is to be gentle and persistent. The filters got stuck because of the repetitive motion of turning the polarizer, they will get unstuck the same way.
What happens is that when you use force you bend the ring so the filters jam together more.
To get more grip, take a pair of thick rubber bands and put one arround each filter, that will help grip the very thin part of the polarizer that has the knurling. Gently twist the filters, grabbing at different parts of the ring to even out the distortion. A little push in and out (not rotation) can help wear down / dislodge any grit.
Illustration of undesired action:
Comment: Many times my polarizer gets stuck on my lenses for PRECISELY the reason you give. The filter isn't stuck in reality, it's just hard to remove because the force of gripping the filter causes it to tighten. I've found that using the lightest of light touches allows the filter to be removed with ease. As soon as the gorilla grip comes out, the filter acts like its welded to the lens.
Answer: You can get filter wrenches for exactly this sort of situation - just as you can for stuck tops on jam jars.
They can come in incredibly useful if you have a stubborn stuck filter.  They are usually quite cheap and come in a range of sizes to suit the filter thread size you need...
Here is what they look like at The Digital Picture review.
Comment: Not quite sure what this answer adds over the one posted earlier by @D.Lambert
Answer: One solution that I've used is to put a grippy cloth or other surface on a flat counter, set the lens face down on that surface and while applying firm downwards pressure, turn the lens - thus turning the filter without distorting it.
Answer: Try putting the lens in the freezer for a few minutes (or more). The filter probably expanded due to heat and should contract more than the lens as it cools down. Then wait that your lens is above freezing temperature before using it.
Comment: Wait not until it is above freezing temp, but until it is at room temp and any condensation has evaporated.
Comment: cool idea, but no sigar :(
Comment: Well, I live in a country where temperatures change a lot, so that worked on the few rare times where I needed to. I also shoot at below freezing with the lens and camera working well (most of mine are weatherproof and freezeproof), so the temperature thing was just a precaution.
Answer: One thing that has always worked for me in the field is to screw another filter on top of the stuck one.  Screw it in pretty hard.  This provides an extension of the outer surface of the stuck filter, enabling a much better grip with the fingers (or with a tool, which I have never had to use).  Perhaps it also evens out small eccentricities in the stuck filter, helping it turn better within the lens's threads.  The two filters together are also a much stronger assembly than a single filter, so there is less risk of cracking or deforming it.  Once this pair of filters comes off the lens, it can be a little troublesome to separate the two filters again, but they tend not to be stuck as hard as the original filter was.  A little patience always gets them apart.  If not, you can work with it in the shop if you like without risking your lens; and your lens is back in service in the meantime.
Answer: I use disposable latex gloves. You can buy large packs of them from motorist stores in the 'stuff for mechanics' section. They're also helpful in many other situations.
Comment: This worked perfectly for me, thanks! Just be sure that your gloves are dry before holding your lens :)
Answer: Take a cable (Like a long USB cable) and loop it around the filter as close to the lens as you can get. Use the cable loop as a grip to get the filter started off.
Comment: Then throw away the cable.
Answer: Put your lens in the freezer for 6 minutes and then use a rubberband to get a grip around the full circumference of the lens and unscrew it. I've tried this method before and it worked.
Comment: I'd be a bit concerned about putting my lenses in the freezer with regards to condensation. If I were to resort to this type of method, I'd bag the lens in the freezer before removing it, and let it warm up gradually, as mentioned [here](http://www.brighthub.com/multimedia/photography/articles/12476.aspx).
Comment: @Edd By the time it has warmed back to room temperature, the advantage of having the outer layer colder than the inner layer (why you only leave it in there for a few minutes) is no longer applicable.
Answer: If the rubber band or filter wrench doesn't work, the next step is a precision band saw.

If Adam Savage (the guy in the video) and his band saw is not available, you could also use a needle file or hacksaw to create a couple of notches in the front of the filter ring.
Once you've cut a couple of notches in the filter ring, you can use a steel rule to twist it off.

If the filter ring is too distorted to twist it off with the metal rule, you're going to need to remove as much of the filter glass as you can and then peel it off with a pair of (locking) needle-nose pliers. It may be easier if you cut all the way through the filter ring. Yes, that will nick the lens' filter threads. But if they are already warped they're going to need to be replaced anyhow.
When using a file, hacksaw, needle-nose pliers, etc. on the filter ring, it's not a bad idea to place a soft cloth over the front element of the lens to minimize the risk of scratching it.
If the lens hit something hard enough to warp the filter ring, the front element of the lens and filter threads are the least of your worries. The internal lens alignment needs to be checked.
For more about the overall subject of To filter or not to filter (for lens  'protection'), that is the question, please see this answer to is uv filter a must? here at Photography at Stack Exchange. There are lots of links to a plethora of questions/answers here and resources elsewhere on the subject. While there are times and places (sand/dust storms, at the beach, industrial settings with hot metal particles flying off grinders, etc.) where filters are useful for protecting the front of the lens, in catastrophic incidents such as yours they tend to be liabilities more often than not. A lens hood is normally better impact protection without any of the optical penalties of a flat glass filter.
Answer: I successfully removed a CPL filter from my lens with mid-size strap wrench:

(scale: the strap loop is left as set for a 72mm filter)
Answer: safe for the lens or safe for the filter? Only time I've had a filter that wouldn't come loose with some force I took to breaking the glass on it and destroying the filter in place, then taking a wrench (now that I had enough grip) to force the empty thread off the lens.
Have to take some care of course but it's not that hard (in this case the front element was recessed deeply, making it a lot less dangerous to the lens).
Answer: If you are willing to sacrifice the filter, you can cut a notch across the middle of the filter.  (A thin piece of cardboard protects the filter if you want to try to keep it.)
If you use a hacksaw, the resulting notch will be about 1/16" wide and between 1/16 and 1/8 inch deep.  1/16 is enough.
Now out to the garage.  You need to pieces of wood, 1x2 is fine.  You also need a hacksaw blade.  Old one is fine. You will need a couple of #4 or smaller screws. Several 1.5" #8 screws.

Cut one piece so that it is about 3 inches longer than the hack saw blade.
Lay the hacksaw blade on this chunk so that the back edge (no teeth) over hangs the edge of the board by a bit less than the depth of the cuts in your filter rim.
Screw the blade to the board.
Cut the other board so that it's shorter than the blade, and doesn't hit the screws.
Screw the board to cover the blade from the other side, leaving the same amount of blade showing.
Now you have a tool that fits the slots.  Put the body cap on the lens, and have a  helper hold the lens firmly on a table.
Fit the protuding edge into the notches and twist off.

If you are alone, and have a vice, you can put the tool in the vice and twist the lens.
A comment points out that using a steel machinists rule would make more sense than my used saw blade tool. But:  I didn't have one.  I didn't think about it. And the blade was the right width for the notch.
Comment: Yeah, but it's an hour's drive to town; I don't know where to buy a machinists rule, and I didn't think of it.  But I've edited the answer to point out the alternative.  Good idea.
Comment: Why not just use a steel rule?
Comment: I don't have a machinists steel ruler I have one that is about 1/32" thick. It bends readily, and is painfully to us as a tool.
Comment: I would think going and buying one would be less trouble, take less time, and possibly have a lower overall cost than making your hacksaw blade contraption. It would also be stronger.
Comment: I've since looked up machinists scales.  Seems they are about 1/32" thick.  I would worry about bending the edge, and getting cut trying to put torque on a thin piece of metal.  Now a rule like that in a set square might be effective.
Answer: One of the things to try is to lubricate the joint between the lens and the filter.  You do NOT want to get liquids into the lens, so for doing all of these, keep the filter below the lens body.
I would go further and put most of the lens in a plastic bag, and masking tape the edge to the barrel behind the filter.
Things to try:

Lens cleaning solution.  This, I think is basically distalled water and photo-flo, a wetting agent.
Soapy water.  I think the best solution would be glass cleaner -- windex or equivalent.
Ether.  You can get canned ether at auto stores for starting reluctant engines.
WD-40.  This basically fish oil and ether.  The ether acts as a carrier so that it can penetrate.
Penetrating oil.  This is usually a mix of what amounts to light machine oil in a carrier of hexane

Ether and hexane potentially are solvents for whatever lubricants are in the lens.  As solvents they can move the lube to different places.  Ether is explosively flamable.  Do not do this in a confined space, or near a source of ignition.
Answer: If you want to use the heat technique, but don't want to risk condensation on your lens, try this:
Park the lens in a sunny window.  You want it warm.  Doesn't need to be hot.
Take a cup of hot water and dissolve as much salt as you can.
Freeze the salt water in a bowl.
Once frozen solid, remove from freezer, knock the ice out of the bowl and put on the counter flat side up.
Press the filter against the ice for 10 seconds.
Attempt to remove filter.
Repeat with 20 seconds.
etc.
If it hasn't worked by the time you get to a minute, back to the drawing board.

Aluminum conducts heat quite well, but the threads don't conduct heat as well.  You are trying to cool the filter faster than you are cooling the threads on the rim.
Having a warm lens increases the temperature differential and so increases the size difference.
Cautions:  Salt water is corrosive.  Do NOT get this in your lens.
If this makes you nervous, you can partially fill a bag with alcohol.  It won't freeze, but it will get to whatever the minimum temp of the freezer is.


Mini CMS library/framework?

Question: I have a web application which needs to allow admins to create content pages.  I'd rather not re-invent the wheel here.  What I need is something like Joomla, but it doesn't have to be a full fledged CMS.  I need a framework or a library that I can use with my current web application which will present a nice interface for admin to create sections/pages, and then edit and style them just like joomla.  My web application is built on .Net 3.5 and Sql Server 2005.  Any ideas?
Answer: Personally I cannot stand behind this system, as I feel it has some serious performance negatives, but if performance is definitely not a problem, it has a huge amount of features.
http://www.insitecreation.com/
The plus points would be
Relatively cheap
In Active development
Simple templating engine, in pure html (just pickup you html design and drop into templates, then position content tags)
Simple to remove all styling from.
Negatives
Not good for high scale performance (not that this should be considered too bad, as you should know what you are doing for that kind of site anyway)
I only add this as an option due to the fact we have used it for small quick sites in the past.
Answer: Look into Osmek http://osmek.com ,its a centrally hosted system where you access your content through an api. Dont know if there is .net support, but its a revolutionizing concept to content management.

Mini CMS library/framework?


Using a custom lib path

Question: I'm trying to build Android on a remote trough ssh. However, I was presented with the problem:

prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc: /lib32/libc.so.6: version `GLIBC_2.11' not found (required by prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc)

After looking at the libc.so.6 I saw that it was actually 2.9.
I don't however have administrative privileges on the server. So I tried copying my libc-2.11.1.so to a folder in my home dir, say /home/users/myuser/lib/, made a symbolic link so that /home/users/myuser/lib/libc.so.6 would point to the actual so and added the lib folder to my PATH.
However it didn't make any difference.
Doing ldd on the mentioned elf file:
linux-gate.so.1 =>  (0xf77a6000)
libc.so.6 => /lib32/libc.so.6 (0xf762d000)
/lib/ld-linux.so.2 (0xf77a7000)

So it looks like the required library has a fixed path.
Does anyone know how I could make it link to /home/users/myusers/lib/libc.so.6 instead of `/lib32/libc.so.6/
Thanks!
Answer: Found it:
export LD_LIBRARY_PATH=~/lib/

Just in case one might also add:
export LD_PATH=~/lib/
export LIBPATH=~/lib/

Using a custom lib path


Crossing out every second number

Question: Write down all integers from 1 to 1000. Cross out the first number and every second number after that. So you will cross out 1, 3, 5 and so on. Now repeat the process exactly - cross out the first number and every second number from those that remain. Keep repeating the process until just one number remains. What is this last remaining number?
Comment: The wording of this puzzle was, IMO, extremely unclear. Like msh, I had thought you started at 1 and then crossed out the second number, 2, and so on. But it seems the intended answer was to cross out 1, the first number. Perhaps a short example would have explained to not confuse answerers?
Comment: I've added an example.
Answer: I think the number that remains is

 512

Reasoning

 First we cross out odd numbers leaving numbers divisible by 2.
 Then we cross out numbers congruent to 2 modulo 4 leaving only numbers divisible by 4.
 Then we cross out numbers congruent to 4 modulo 8 leaving only numbers divisible by 4.
 We see the pattern that we are always crossing out numbers congruent to 2n - 1 mod 2n leaving numbers divisible by 2n so it will be the highest power of 2 less than 1000 that remains at the end.
Comment: Snap! Only a few seconds in it
Comment: Yep you got it!
Answer: The last number will be

512

Every time the process is repeated, the remaining numbers are the multiples of the next integer in the sequence 2n:
 1, 2, 3, 4, ...
 2, 4, 6, 8, ...
 4, 8, 12, 16, ...

 Since 512 is the largest 2n in the range [1..1000], it will be the remaining number.
Comment: Also correct, but @hexomino was a fraction earlier.
Answer:
Beginning with 1 cross out every second number.

 So I start at 1 and cross out 2, 4, …: all the evens. The odds remain.

Now repeat the process - cross out every second number from those that remain.

 I cross out every second odd: 3, 7, 11,…: but I don't cross out 1, for example.

Keep repeating the process until just one number remains. What is this last remaining number?

 No matter what, your "every second number" will always start after 1, so you'll never cross out 1, and it will be the last number standing.
Comment: Each run you cross out the first number too. So you will cross out 1 on the first run.
Comment: No, @DmitryKamenetsky, each run you cross out "every second number", not the first.
Answer: In the first step (as can already be quite clearly seen from what's in the question), we cross out all the odd numbers, and so

 we are left with the even numbers, that is, with the multiples of 2. Since we are crossing out the 1st, 3rd, 5th etc. of the numbers remaining, we are crossing out all the odd multiples of 2, that is, numbers of the form k x 2 where k is an odd number, so we are left with the even multiples of 2, which are the multiples of 4, and where the first number remaining is 2 x 2

 We then cross out the odd multiples of 4, leaving the even multiples of 4, which are the multiples of 8, and the first number remaining, being the first even multiple of 4, is 2 x 4 = 2 x (2 x 2) = (2 to the power of 3).

 Clearly after each step the smallest remaining number is a power of 2. The largest power of two in the given range is 512 so this will be the last number left.

Crossing out every second number


Use AWS Glue Python with NumPy and Pandas Python Packages

Question: What is the easiest way to use packages such as NumPy and Pandas within the new ETL tool on AWS called Glue? I have a completed script within Python I would like to run in AWS Glue that utilizes NumPy and Pandas.
Comment: can you provide the link for pandas library (jar file) that I can add to glue job as dependent jars.  Thanks
Answer: You can check latest python packages installed using this script as glue job
import logging
import pip
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

if __name__ == '__main__':
    logger.info(pip._internal.main(['list']))

As of 30-Jun-2020 Glue as has these python packages pre-installed. So numpy and pandas is covered.
awscli 1.16.242
boto3 1.9.203
botocore 1.12.232
certifi 2020.4.5.1
chardet 3.0.4
colorama 0.3.9
docutils 0.15.2
idna 2.8
jmespath 0.9.4
numpy 1.16.2
pandas 0.24.2
pip 20.0.2
pyasn1 0.4.8
PyGreSQL 5.0.6
python-dateutil 2.8.1
pytz 2019.3
PyYAML 5.2
requests 2.22.0
rsa 3.4.2
s3transfer 0.2.1
scikit-learn 0.20.3
scipy 1.2.1
setuptools 45.1.0
six 1.14.0
urllib3 1.25.8
virtualenv 16.7.9
wheel 0.34.2

You can install additional packages in glue-python if they are present in the requirements.txt used to build the attaching .whl. The whl file gets collected and installed before your script is kicked-off. I would also suggest you to look into Sagemaker Processing which is more easier for python based jobs. Unlike serveless instance for glue-python shell, you are not limited to 16gb limit there.
Answer: I think the current answer is you cannot. According to AWS Glue Documentation:

Only pure Python libraries can be used. Libraries that rely on C extensions, such as the pandas Python Data Analysis Library, are not yet supported.

But even when I try to include a normal python written library in S3, the Glue job failed because of some HDFS permission problem. If you find a way to solve this, please let me know as well.
Comment: **Obsolete** Glue v 2.0 has a built-in set of libraries, including compiled extensions, including `pandas`
Comment: Those are already part of glue nodes, and also if you want to install your own packages there is a way to do it
Answer: If you don't have pure python libraries and still want to use then you can use below script to use it in your Glue code:
import os
import site
from setuptools.command import easy_install
install_path = os.environ['GLUE_INSTALLATION']
easy_install.main( ["--install-dir", install_path, "<library-name>"] )
reload(site)

import <installed library>

Comment: Are you using Glue pyspark job or python shell job?It works only for python shell job and GLUE_INSTALLATION value will be read from os environment variables.
Comment: Where to define GLUE_INSTALLATION? What should be its value?
Comment: We are trying to install psycopg2 library but it is throwing error :

Download error on https://pypi.org/simple/: [Errno 99] Cannot assign requested address -- Some packages may not be found!

No local packages or working download links found for psycopg2 using python shell job

error: Could not find suitable distribution for Requirement.parse('psycopg2')
Comment: Never mind, it seems VPC issue. Without VPC, we are able to install pyscopg2 library
Comment: @SandeepFatangare were you able to install psycopg2 library in Glue, If yes could you please provide me the needful steps. Thanks.
Comment: No, we switched to pg8000 library
Comment: @SandeepFatangare `GLUE_INSTALLATION` was not set in my environment, either. I was able to find site-packages directory with `site.getsitepackages()[0]`. Using this value instead worked for me.
Comment: Can you please provide a clear good working example? Use the smart_open package (or any other package) as an example.
Comment: KeyError: 'GLUE_INSTALLATION', on ray glue notebook
Answer: There is an update:
...You can now use Python shell jobs...
...Python shell jobs in AWS Glue support scripts that are compatible with Python 2.7 and come pre-loaded with libraries such as the Boto3, NumPy, SciPy, pandas, and others.
https://aws.amazon.com/about-aws/whats-new/2019/01/introducing-python-shell-jobs-in-aws-glue/
Comment: Specifically, their supported libraries are here: https://docs.aws.amazon.com/glue/latest/dg/add-job-python.html#python-shell-supported-library
Answer: AWS GLUE library/Dependency is little convoluted
there are basically three ways to add required packages
Approach 1

via AAWS console UI/JOB definition,  below are few screens to help
Action --> Edit Job

then scroll all the way down and expand
Security configuration, script libraries, and job parameters (optional)
then add all your packages as .zip files to Python Library path
(you need to add your .zip files to S3 then specify the path)
one catch here is you need to make sure your zip file must contain
init.py in the root folder

and also, if your package depends on another package then it will be very difficult to add those packages.
Approach 2
programmatically  installing your packages (Easy one)
here is the path where you can install the required libraries to
/home/spark/.local/lib/python3.7/site-packages/
**

/home/spark/.local/lib/python3.7/site-packages/

**
here is the example of installing the AWS package
I have installed SAGE marker package here
import site
from importlib import reload
from setuptools.command import easy_install
# install_path = site.getsitepackages()[0]
install_path = '/home/spark/.local/lib/python3.7/site-packages/'
easy_install.main( ["--install-dir", install_path, "https://files.pythonhosted.org/packages/60/c7/126ad8e7dfbffaf9a5384ca6123da85db6c7b4b4479440ce88c94d2bb23f/sagemaker-2.3.0.tar.gz"] )
reload(site)

Approach 3. (Suggested and clean)
under Security configuration, script libraries, and job parameters (optional) section  to job parameters
add the required libraries with --additional-python-modules parameter
you can specify as may packages as you need with comma separator

happy to help
Comment: Note that the Approach 2 causes a WARNING: The easy_install command is deprecated and will be removed in a future version.
Answer: when you click run job you have a button  Job parameters (optional) that is collapsed by default , when we click on it  we have the following options which we can use to save the libraries in s3 and this works for me :
Python library path
s3://bucket-name/folder-name/file-name
Dependent jars path
s3://bucket-name/folder-name/file-name
Referenced files path
s3://bucket-name/folder-name/file-name
Comment: I have created a glue job and uploaded the python script, pandas-0.22.0.tar, pandas-0.22.0-cp27-cp27mu-manylinux1_x86_64.whl file. But my job failed with error "import pandas as pd
ImportError: No module named pandas" ?  Please suggest what other files need to be uploaded, to resolve pandas error.  The pandas*.tar file is uploaded to Dependent jars path
Comment: According to AWS Glue Documentation:

"Only pure Python libraries can be used. Libraries that rely on C extensions, such as the pandas Python Data Analysis Library, are not yet supported."
Answer: AWS Glue version 2.0 released on 2020 Aug now has pandas and numpy installed by default.
See https://docs.aws.amazon.com/glue/latest/dg/reduced-start-times-spark-etl-jobs.html#reduced-start-times-new-features for detail.
Answer: Use Glue version 2 instead of version 3
Steps:

Go to glue job and edit script with below code

code:
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
import pandas as pd

args = getResolvedOptions(sys.argv, ['JOB_NAME'])

sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)

excel_path= r"s3://input/employee.xlsx"
df_xl_op = pd.read_excel(excel_path,sheet_name = "Sheet1")
df=df_xl_op.applymap(str)
input_df = spark.createDataFrame(df)
input_df.printSchema()

job.commit()

Save script

Goto Action - Edit Job - Select Glue version2   and set key value under security configuration
key : --additional-python-modules
value : pandas==1.2.4,xlrd==1.2.0,numpy==1.20.1,fsspec==0.7.4

Save and run the job

It will resolve your error and you will be able to read the excel file using pandas
Answer: If you go to edit a job (or when you create a new one) there is an optional section that is collapsed called "Script libraries and job parameters (optional)". In there, you can specify an S3 bucket for Python libraries (as well as other things). I haven't tried it out myself for that part yet, but I think that's what you are looking for.
Comment: If you have a number of modules you want to include, you can archive them into into single ZIP file and attach over "Script libraries and job parameters" parameter. Your modules will be available for a job on the run.
Answer: As of now, You can use Python extension modules and libraries with your AWS Glue ETL scripts as long as they are written in pure Python. C libraries such as pandas are not supported at the present time, nor are extensions written in other languages.
Answer: The picked answer is not longer true since 2019
awswrangler is what you need.
It allows you to use pandas in glue and lambda
https://github.com/awslabs/aws-data-wrangler
Install using AWS Lambda Layer
https://aws-data-wrangler.readthedocs.io/en/latest/install.html#setting-up-lambda-layer
Example: Typical Pandas ETL
import pandas
import awswrangler as wr

df = pandas.read_...  # Read from anywhere

# Typical Pandas, Numpy or Pyarrow transformation HERE!

wr.pandas.to_parquet(  # Storing the data and metadata to Data Lake
    dataframe=df,
    database="database",
    path="s3://...",
    partition_cols=["col_name"],
)

Answer: If you want to integrate python modules into your AWS GLUE ETL job, you can do. You can use whatever Python Module you want.
Because Glue is nothing but serverless with Python run environment. SO all you need is to package the modules that your script requires using pip install -t /path/to/your/directory. And then upload to your s3 bucket.
And while creating AWS Glue job, after pointing s3 scripts, temp location, if you go to advanced job parameters option, you will see python_libraries option there.
enter image description here
You can just point that to python module packages that you uploaded to s3.
Comment: No you can't use libraries which are on top of c/c++ code. You can use pure python libraries only. Pandas core code is in C hence can't use in Glue
Comment: From your comment, I understand that I will be able to run non Pure Python libraries such as pandas and pymongo in Glue if I package, upload and reference the libraries for the import in my job script? From the docs as mentioned in the accepted answer I understood that I will not be able to run such libraries. Has anyone been able to get it working?
Comment: Yes, you can use. You can even write your own python functions or modules that are required for your job and have them reference in your python libraries path.
Answer: In order to install a specific version (for instance, for AWS Glue python job), navigate to the website with python packages, for example to the page of package "pg8000" https://pypi.org/project/pg8000/1.12.5/#files
Then select an appropriate version, copy the link to the file, and paste it into the snippet below:
import os
import site
from setuptools.command import easy_install
install_path = os.environ['GLUE_INSTALLATION']

easy_install.main( ["--install-dir", install_path, "https://files.pythonhosted.org/packages/83/03/10902758730d5cc705c0d1dd47072b6216edc652bc2e63a078b58c0b32e6/pg8000-1.12.5.tar.gz"] )
reload(site)

Comment: GLUE_INSTALLATION do not exist in AWS Glue PySpark


Why some resource files are put under META-INF directory

Question: I am wondering why some resources files are put under the META-INF directory in the JAR? I am always put the resources like test.properties under the root diretcory. Any advantage to put them in the META-INF?
Comment: possible duplicate of [What's the purpose of META-INF?](http://stackoverflow.com/questions/70216/whats-the-purpose-of-meta-inf)
Comment: similar question: http://stackoverflow.com/questions/70216/whats-the-purpose-of-meta-inf
Answer: Lot of Java (EE) APIs have a contract that when you put a specific configuration/metadata file in the META-INF folder of your (or a 3rd party) JAR, then the API will automatically do the API-specific job, such as scanning classes, preloading specific classes and/or executing specific code based on the meta information.
An example provided by the standard Java SE API is the ServiceLoader. Among others, the JDBC 4.0 compatible drivers implement this. This way just dropping the JDBC driver JAR file folder will automatically load the driver class during Java application's startup/initialization without the need for any manual Class.forName("com.example.Driver") line in your code.
Further there is also the Java EE 6 provided JSF 2.0 API which scans during application's startup all JAR files for a faces-config.xml file in the META-INF folder. If present, it then will then take it as a hint to scan the entire JAR file for classes implementing the JSF specific annotations like @ManagedBean so that they get auto-instantiated and auto-configured. This saves time in potentially expensive job of scanning thousands of classes in all JARs in the entire classpath. In older versions of those API's the configuration was usually done by (verbose) XML files.
All with all, the major goal is to save the developer from code and/or configuration boilerplate. The JAR's META-INF folder is used for configuration files/hints. Some API's indeed also put static files/resources in there for own use. The META-INF folder is also part of the classpath, so the loading of those files by the classloader is easy done.
Answer: In servlet 3.0, certain static resources are available through the web context, such as .css, java script, and .png files, so you no longer need to use ServletContext getResource() and getResourceAsStream().  For more information, check out web-fragment.xml (https://blogs.oracle.com/swchan/entry/servlet_3_0_web_fragment) which is one resource that covers this subject.
Personally, I prefer to structure my projects the way Maven likes them, with a src/main/resources directory which is part of the application's classpath.
Answer: It's just a convention that some (most?) third party jars use to look for files that you provide. For your own classes and files, you can choose to put them where you like.


We meet at last vs we are meeting at last

Question: Is it possible to use the phrase: "We are meeting at last" when two people meet for the first time? For example, in a movie one person said: "We meet at last". Why did he use the present simple instead of present continuous? I mean, this was an action, which was happening at the moment of speaking.
Comment: Do you know about our sister site for learners, [ell.se]?
Comment: @tchrist I didn't know about that site, thank you, I will ask my questions there going forward
Comment: Similar cases: *I beg your pardon*, *Here comes the bride*, *I say it's a great idea!*.
Answer: Either usage is possible and correct grammatically.  There is a subtle difference in emphasis between the progressive and the simple present. The simple present, "we meet", speaks of a an event that is completed as the words are spoken.  The progressive, "we are meeting" emphasizes the ongoing nature of the action.  By implication, the action of "meeting" may be appropriately regarded as ongoing until concluded by leave taking.
"We meet at last!" is conventional almost to the point of parody while the variant "we are meeting at last" is certainly correct but sounds vaguely exotic.
Comment: thank you for breaking this down. Could you also explain for me the part of your answer: "The simple present, "we meet", speaks of a an event that is completed as the words are spoken." - why we can use Present simple here as this is completed action? This "past" action is connected with present, so why we don't use the present perfect here?
Answer: "Meeting" is something that happens, and then it stops.  The meeting in your example is the initial contact.  The two people come into contact, which is to say they meet.  After that, they've already met.  Now they're doing something else, probably having a conversation together.
The speaker in your example could say "So, Doctor Jones, we meet at last and now we are having a conversation."  But that wouldn't have the same dramatic flair of a "So, Doctor Jones...  We meet at last."
Comment: 'Meet' is not necessarily used in the punctive sense. [Collins](http://www.thefreedictionary.com/meet) gives the sense: << _meet_ verb (2) to come into or be in conjunction or contact with (something or each other) >> The present continuous is certainly available here, and may sound less cheesy. The following are certainly idiomatic, possibly informing OP's example:  'So here we are, meeting at last.' /  'I can't believe we are meeting at last, but here we are!'
Comment: thank you for your explanation. Could you also please write me, why we use the Present Simple here? If I understand correctly, we treat that "initial contact" as something already in the past. So why we don't use e.g. Present Perfect here: We've met at last?


How can I delete elements of a std::map with an iterator?

Question: I would like to loop through an std::map and delete items based on their contents. How best would this be done?
Comment: Can you give us an example of what your map contains and what criteria you want to use? A typical approach is to iterate through the contents of the map and call map.erase(iterator);
Comment: possible duplicate of [What happens if you call erase() on a map element while iterating from begin to end?](http://stackoverflow.com/questions/263945/what-happens-if-you-call-erase-on-a-map-element-while-iterating-from-begin-to-e)
Comment: @birryree it doesn't even have to be map... it could be a vector or something else that an iterator can be used on. I'm just looking for a generic answer like @templatetypedef's.
Comment: @MartinYork similiar, but I asked how to do the loop, while he just wanted to know if his loop would work.
Answer: If you have a C++11-compliant compiler, here's an easy way to do this:
std::map<K, V>::iterator itr = myMap.begin();
while (itr != myMap.end()) {
    if (ShouldDelete(*itr)) {
       itr = myMap.erase(itr);
    } else {
       ++itr;
    }
}

The idea is to walk the iterator forward from the start of the container to the end, checking at each step whether the current key/value pair should be deleted. If so, we remove the element iterated over using the erase member function, which then returns an iterator to the next element in the map. Otherwise, we advance the iterator forward normally.
If you do not have a C++11-compliant compiler, or you're working with an older codebase, things are a bit trickier. Before C++11, the erase member function would not return an iterator to the next element in the map. This meant that in order to remove an element while iterating, you'd need to use a three-part dance:

Copy the current iterator.
Advance the current iterator to the next element.
Call erase on the copy of the old iterator.

This is shown here:
std::map<K, V>::iterator itr = myMap.begin();
while (itr != myMap.end()) {
    if (ShouldDelete(*itr)) {
       std::map<K, V>::iterator toErase = itr;
       ++itr;
       myMap.erase(toErase);
    } else {
       ++itr;
    }
}

This process was required because if you just called erase on the iterator, you'd invalidate it, meaning that operations like increment and decrement would lead to undefined behavior. The above code gets around this by setting up a copy of the iterator, advancing itr so that it's at the next element, then erasing the temporary copy of the iterator.
Using some Clever Trickiness, it's possible to shrink this code down at the expense of readability. The following pattern is common in older C++ code, but isn't necessary in C++11:
std::map<K, V>::iterator itr = myMap.begin();
while (itr != myMap.end()) {
    if (ShouldDelete(*itr)) {
       myMap.erase(itr++);  // <--- Note the post-increment!
    } else {
       ++itr;
    }
}

The use of the post-increment operator here is a clever way of making a copy of the old iterator (remember that a postfix ++ operator returns a copy of the original iterator value) while also advancing the older iterator.
Comment: For the vector case the logic is different (See Timo's example below); after you erase() something, all iterators at or after the erase point are invalidated.  To know where to pick up, you can therefore capture the value of the erase() function.  With a map, the only invalidated iterators from an erasure are iterators to the element that got deleted.
Comment: so if I had a vector like this: `10, 11, 12, 13`, and the iterator deleted 11 while incrementing, it wouldn't skip over 12?... if that makes sense. because I am wondering if when I delete 11, 12 will move into the 11's spot, and I will miss 12...
Comment: I think you just answered it in a comment on @Timo's answer, but if you could clarify, that would be great.
Comment: This is a great answer. The only thing missing is comparing this with the std::vector behavior and contrasting it, but I suppose that would go a bit into a different topic.
Answer: for(MyMap::iterator it = mymap.begin(); it!=mymap.end(); ) {
  if(mycondition(it))
    it = mymap.erase(it);
  else
    it++;
}

edit: seems that this works in MSVC only

edit2: in c++0x this works for associative containers too
Comment: This will work for sequence containers like std::vector, but not for associative containers like std::map.  The difference is that in sequence containers erase() returns an iterator to the next element, whereas in associative containers it returns void.
Comment: Just confirmed from Table 69 of the ISO spec that it should return void.  I guess the MSVC version is nonstandard... I never knew that!
Comment: It works now in C++11. However, still there are many compilers not ready for C++11. So `mymap.erase(it++)` is more portable.
Comment: @templatetypedef: hmmm, that's funny because the associative containers in MSVC work differently: http://msdn.microsoft.com/en-us/library/z2f3cb7h.aspx I guess it's non-standard then.
Answer:
This is one simple way:
    int value_to_delete( 2 );
    for( std::map<int, int>::iterator i = mm.begin(); i != mm.end(); ) {
        if( i->second != value_to_delete ) {
            mm.erase( i++ ); // advance before iterator become invalid
        }
        else {
            ++i;
        }
    }


Weird open string sound

Question: As I play one of the strings openly, without pressing any fret, this annoying sound occurs. Why is it happening and how can I fix it? http://picosong.com/4aKv/
Answer: It sounds like the G string is rattling in the nut of your guitar.
Have you changed the strings since you purchased the instrument? Sometimes, fitting lower gauge (diameter) strings result in more space to vibrate within the string-groove of the nut, hence the rattle.
Alternatively, if the instrument is cheaply made (no disrespect!), the nut may have split, not have been fitted correctly, or expanded some other way.
I recommend you take it to a trusted luthier, or your place of purchase, and discuss installing a new nut (thankfully, these can be one of the cheapest parts of the guitar to replace, but best to leave to a professional unless you know what you're doing, to avoid damaging the neck or top of the fingerboard).
For a short term fix until you can solve the issue long term;

detune the guitar one half step, capo at fret 1, and play as if the capo was the open position. The capo stops the string vibrating over the nut

or

fit a capo just behind the nut, with light downward pressure, holding the offending rattling string down and reducing rattle for the time being (you may need to re-tune)

Hope this helps!
Comment: @amalgamate I've used blu-tac/adhesive putty before to hold the string in place. Not included in my answer because any professional would laugh...and it looks silly!
Comment: Well yeah, it's the G string. I changed my strings not that long ago, like before 2 weeks, and the problem was before that, thought changing will help. Well the strings sound better of course, but the problem still exists :\. Since I don't have a capo, i'll take it to the luthier. Hopefully the fixing won't take very much time :D. Thanks for help though, at least I'll know it's not my strings to blame.
Comment: **If** it's a **junky** guitar and you want a quick **ugly** fix, I have found that you can use artfully cut and folded plastic (like that of a milk jug) or paper (folded more than once) at the slot in the nut underneath the string to secure a string.
Comment: Yep, but I have a few "beach" guitars. (guitars I willingly take to the beach). :-)

Weird open string sound


MacBook Pro Display Issue

Question: I own a 11 month old MacBook Pro 13" with Apple Care. From the last 2 months, I've noticed a bright line on my screen which is about 0.5 cm in size. Should I be worried? Will Apple be able to repair it?
Comment: No need to worry as you have Apple Care. If you are in India, you can go to any Aurthorized Service Centre such as Imagine and get repaired for free.
Answer: I would say you should not be worried however since you do have Apple Care I'd backup your files using Time Machine and then make arrangements to have it looked at and repaired.  As to whether or not they can fix it or just replace the part(s) in question that will be decide by Apple however since it's under warranty the'll have to fix it or replace it.
From Contact Apple Support ...

A Genius Bar reservation is an easy way to get hardware repairs, but
  we can solve many issues over the phone or by chat. Tell us a little
  about what's going on and we'll suggest the right support option.

MacBook Pro Display Issue


Loan of $70k from a friend

Question: I want to loan $70 k from a friend of mine for a investment.
Comment: Welcome to Money.SE. You've edited the question, and there's now no question to answer. How can we help you?
Comment: (Note: if you edited it to remove bits about the question that pointed to potential illegal activity, your edit doesn't actually accomplish that - the information is still there in the edit history, viewable by anyone.  I'd also note that nothing you posted is per se illegal, particularly if it hasn't been done yet.)
Comment: Though I think you got your answer, your question would make more sense if the word `loan` was used consistently here.  If you're getting money FROM your friend, then you are `borrowing` money, while if you're sending money TO your friend, you are `lending` (or `loaning`) money.  I think you are `borrowing` from the total context, but you're not entirely consistent.
Answer:
to trigger no audit , he want to make cash deposits of 9500$ around in
  to 7 of my friends accounts.

This is 'structuring' and is very illegal.  Deliberately avoiding the $10k limit is itself a crime, even if the underlying transaction is legal.
As for the rest of the question, giving your friend $70k as part of a genuine loan transaction is not a taxable event on either side.  But the interest he pays you is taxable to you; if you loan it at 0%, the interest he would have paid is a gift, which can be its own taxable event.
Answer: A cash transaction doesn't "trigger an audit"
In the US, depositing/withdrawing cash in excess of $10,000 is reported. The report doesn't trigger an audit. The federal government will know that your friend at one point had at least $10,000 that came from somewhere - if this is what you are concerned about then you shouldn't make the loan. It simply assists in an audit that is either completely random or triggered for other reasons.
Making smaller cash transactions to avoid reporting requirements is called structuring, and will land your friend in prison and the cash seized. Oops.
Good luck with your investment!
Comment: @a600, if the cash gets seized, your friend probably won't be able to pay you back.  Is losing $70,000 a problem for you?  (If not, shouldn't you have a lawyer on retainer for questions like this?)

Loan of $70k from a friend


Object Coordinates

Question: I want to draw a rectangle and place the top left corner at coordinates x=3, y=7 using a millimeter scale (or inch scale).  How do I accomplish this?  Thanks in advance for any response.
Answer: Draw the rectangle to somewhere. Select it.
In the info bar click "top left" in the reference point selector
Type the wanted coordinates to X and Y placement coordinate boxes. Here the coordinates are 7 mm and 8 mm:
Comment: Thanks so much!  I have a different version of AI and figured out just the way you explained!

Object Coordinates


How to clean the charging port of iPhone 6?

Question: For weeks, I had the issue of my phone not charging as soon as I plugged in the lightning cable. I suspect it could be because of dirt that has accumulated over the years. How do I safely clean the charging port of my phone?
I do not want to damage any parts. I live in Germany. So would prefer to hear about any extra equipments (if required) that can be purchased easily and at affordable prices in Germany.
Things that I have tried already is to use a tooth pick to remove dust/lint. However, on closer inspection, I see that dust has sort of accumulated on the walls of the inside of the charger. It looks a bit sticky as well. So, I am not sure how to go about it.
Additionally, I would like to know how to protect the charging port from dust accumulation. Suggestions particular to iPhone 6 would be welcome.
Answer: I normally clean charging ports using a straightened paper clip (best results with classic metal ones that do not have a plastic paint cover). I found they scratch the inside of a port much more effectively than toothpicks (resulting in dragging more of the stuff out).
More resistant/stuck lint can be removed if you can bend the last few mm of the clip with pliers a bit. If you have problems with bending a clip, try a sewing pin instead. They're thinner and more easily bendable.
Of course, turn off the phone (remove battery if possible) to make sure you don't short-circuit anything.
Comment: Normally, you cannot remove the battery of an iPhone.
Answer: I like to use compressed air and a tiny brush that came with an electric beard trimmer.  The brush is normally used to  to clean the shave head but it scrubs well in the usb ports too.  I'm sure an old toothbrush would work just as well
Use the little brush to knock loose dirt and grime then use the compressed air to blast it out!
Comment: Great tip! Thanks for sharing. A plastic brush is much safer to use inside a charging port than metal, as far as damaging te interior is concerned
Answer: When my ports were dirty on my iPhone 6 I unfolded a paper clip and attached a little cotton to it from a cosmetic cotton ball. Then I took 100% isopropyl alcohol and dampened my cotton with it which I then used to pull residue from my port. If some of the stickier stuff doesn't come out right away you can leave the damp swab in there for a few minutes and it will start to absorb/degrade the residue making it easier to remove, just make sure you are using 100% isopropyl alcohol or you might damage your phone.
Answer: I take a strip of transparent tape and make a tight loop with the sticky side out.  Then I jam it in the port, twist it around, and pull out the dust.  No worries about scratching the terminals inside.  Repeat as necessary.
Usually on my first attempt, the loop is too wide to fit in the port.  So I end up folding it in half.  That also gives it some stiffness.
This may seem smart, but what would be smarter (and what I am too lazy to do) is to find a way to cover up the Lightning port when you're not charging the phone.
Answer: I used a tooth pick on my charge port, then my phone started charging. I suggest you can try the same.
Comment: The OP already mentioned using a toothpick and that it didn't work for them.
Answer: You can use blue tack to remove a lot of dirt. Just gently press it over the port and remove. Repeat this multiple times.
Don't be tempted to jam the tack in to the port otherwise you'll end up with some stuck in there.
Answer: Had this problem as well recently. I simply took a dental floss stick -   one with a pointed end, and thus then the connection "switched off". Is at the beginning perhaps a bit tricky. You should swap the stick from right to left and then again, in order to get all the dust.
I have always tried again with compressed air cleaner, but has not really worked.
Answer: I use a toothpick.  But I really like the idea of the dental flossing tool.  I just got a new phone, so for $6 I ordered a set of 5 plugs that cover both the charging port and the headphone port.
Answer: I would suggest do NOT use compressed air. BUT, use a vacuum cleaner first, with the power-level on the vacuum cleaner turned down so it's not on full suck. Clear the charging port initially, using the vacuum. Using a bamboo or wooden toothpick, gentle clear the port sweeping right to left. Avoid using a metal point. Plastic or wood is fine.
If you do this process over a white piece of paper, you will see any Lint or debris land on the paper. You should then vacuum the port again and clear again with the toothpick. The cable should now fit the port correctly, and butt to the lower side of your iPhone.
Answer: It is really a bad idea to use a paperclip or anything metal to clean out your charging port. Paper clips, tweezers etc are very likely to damage the golden prongs inside the port and once a single prong gets damaged, you will need to replace the entire charging port.
Best methods would be:

a hairdryer on cool mode to blow out the port
a very small, clean paint brush. You can use it dry or with a tiny bit of isopropyl(dip the brush in the isopropyl then squeeze the bristles so it isn't dripping)
If there is something stuck in your port, use a wooden skewer or something that is made of soft plastic to remove it and just be very gentle!

Personally haven't tried these but my friends who repair phones highly recommended using one of those mini usb vacuums for computer keyboards.
Answer: Mounting putty is the magical solution. If you get a good amount of it in there, it takes out nearly all the dust and lint. And you can see just how well it did when you go to remove the putty.


Photoshop CS5 - How to assign position and dimensions from one object to another?

Question: I am currently updating an old document that I don't recall how I created the first time around. What I would like to do is to take the size and position of an existing object that underwent a free transform when it was placed in the document originally, and perform the same transformation on the new object I am now adding to the document. I am replacing the old one and I want the new one to be identical in size and position to the original. How can I do this in Photoshop CS5?
Answer: I'll suggest...manually =)

Enable move tool
Enable "Show transform controls" (it should show bounding box of objects on layer, layer should be unlocked. If not showing - enable free transform)
Enable snapping and show guides and rulers
Drag new guides until snapped to bounding box of object (and center if needed)
free transform new object using created guides


Physical reason of adding salt when we're cooking rice (osmosis)

Question: Why do we add salt when we're cooking rice? I know one reason is related to the boiling point of water but someone said it is also related to "Osmosis". What is the relation between adding salt and osmosis. How does it help cooking rice?
Comment: I never add salt when I cook rice. It depends on how you like your rice. I have gotten used to doing it the Asian way with a rice cooker, which cooks with a mixture of water and steam. With a little care it comes out perfect every time.
Comment: As worded, this question belongs on [Seasoned Advice](http://cooking.stackexchange.com/). A more appropriate question might be 'What are the physical effects of salt in boiling water with rice?'.
Comment: @CuriousOne Hi. My question isn't about the rice itself (or how can we cook rice better). for cooking something, if you add salt, the boiling point of water will get higher and it cooks better (Taste of rice doesn't matter in this question). someone told me it also affects the osmosis. my question is how osmosis affect on cooking? what is the relation between osmosis and cooking?
Comment: A Chinese or Japanese chef will throw the rice on the floor and make you do it again, if you add salt. Seriously, it's all about how you like it. There is absolutely no reason from a physical point of view to add salt. The boiling point won't go up that much, anyway. If that's what you want, then you need a pressure cooker. Rice in a pressure cooker will turn to mush.
Comment: @CuriousOne My question is actually what are the effects (effectS) of adding salt when you're cooking rice or something else in water? I want to know all of effects (small or big effects).  It is not about how it is better to cook.
Answer: In osmosis, normally, water will move toward the side of membrane with higher concentration of salt, and this can happen with or without heat (though much faster with higher temp. because of the fast motion of molecules).
So my guesses are:
1. This can prevent over-bloating of the rice due to over-absorption of water, and perhaps prevent grain damage.
2. Since osmosis squeezes out water from lower to higher concentration, it might be able to 'squeeze' out the flavor molecules of the rice better, which might come along as water passes out..(but this might only happen if you don't put the salt at start, but wait until the rice bloats a bit, cause after all, what can you squeeze out of a dry grain with no water?)
3. Another effect (due to increased boiling point) is that water evaporates at a slower rate than without salt.
These are just guesses, I'm not sure I'm 100% correct.
Answer: The amount of salt used for cooking is not nearly enough to have a physical effect on the process. The boiling point elevation is less than 1 degree and any osmosis effect will be small (especially when compared to the brine used in pickling). The purpose of adding salt is for flavor.


How to create a stream of jpegs(live) in c++ or c# or java? RTSP?

Question: I am building a server sided html rendering browser that renders html and sends jpegs to the mobile client. I need to figure out how to build a server that grabs jpegs and streams them in a session to a client that i am going to write in j2me
Answer: It isn't completely clear what you mean by "live" but I'm guessing that you are talking about making requests to a server side process that renders URLs passed in and returns an image. One of the easiest ways I know of doing this is with Java and SWT. You can use the SWT browser widget and capture the canvas then convert that to whatever image type you want. The browser widget uses firefox to render pages so they should look pretty good.
Answer: I would write a servlet that serves one jpeg at a time, and a midlet that requests the next jpeg every so often.
Comment: Wouldnt' that be too inefficient? That is why i was going with RTSP, and some jpeg compression perhaps
Comment: Well RTSP would reduce the load on the server but http is the only protocol that is supported by all j2me mobile phones.
Answer: Well, there are better solutions than plain JPEGs.  I've implemented systems like this, and you would do better to use a video codec such as MPEG-2, MPEG-4 ASP, H.264, etc than JPEG, and send updates as p-frames (i.e. deltas from the previous image), and if there's "too big" a change (or missed update, or new client added to an existing stream), send an i-frame.
Even without using a video codec, sending differences will often be preferable.  Use some other mechanism to encode diffs.
In terms of how to get the buffer to send, you can use a number of framebuffers to render to, and set up the framebuffer code to start a timer when a change is made, and while changes are occurring send periodic changes, when enough time has gone by since the last change (not sent yet) send an update (probably shorter time than the first value), and also probably include some sort of strobe that forces an update that can be invoked on certain occurrences (if you can, for example, get a page-load-completion indication from the browser, which you can with a little work in Firefox by changing the chrome, etc).
[added]
For examples of other solutions, look at remote-desktop protocols and programs like VNC, RDP (Windows Remote Desktop), etc - that's effectively what they're doing, again with fancier compression and damage-region tracking.
For framebuffers, you can use standard linux/etc framebuffer code (probably simplest), or even something like XVFB (which gives you access to more info about what and why things are changing than a raw framebuffer).


Can I reset my stay in Japan by visiting another country?

Question: I will be doing an unpaid internship in Japan for a little under 90 days with just the tourist visa, but I also wanted to go with my friends before the internship for a couple weeks to sight see but that will take me over 90 days. Is it possible to do the sight seeing with my friends, then go to Korea for a few days, then come back for my internship to reset the 90 days? If not is there any other options? I was thinking it may be okay if I bring proof that I will leave Japan like a flight home, but will they ask for a returning flight when I enter the country?
I am a United States Citizen.
Comment: Are you sure you don't need a visa https://www.us.emb-japan.go.jp/english/html/travel_and_visa/visa/study-internship.html?
Comment: What citizenship do you have ?
Comment: United States Citizenship, sorry
Comment: @Traveller Unpaid internships under 90 days long do not require a work visa or other special permission: http://www.moj.go.jp/nyuukokukanri/kouhou/nyuukokukanri07_00109.html
Comment: There's a maximum number of days you're allowed to be in the country within a certain window, AFAIR max 180 days per year. I'm not sure about the exact regulations for US citizens, so do check that.
Answer: Yes, that should be fine.  Your first trip to Japan is as a tourist, which is OK, and your second trip is as an unpaid intern staying under 90 days, which is also OK. Source: http://www.moj.go.jp/nyuukokukanri/kouhou/nyuukokukanri07_00109.html
You may be asked for a return ticket when checking in or when entering, but showing a ticket to Korea is fine for this, since they only care that you leave Japan, not that you return to the US.
Also, while doing the same trips in reverse (3 mo internship first, tourism later) is also technically OK, it's going to raise a lot more questions since that would look an awful lot like the "visa runs" of people illegally working in Japan.


slayer exciter(tesla coil) circuit modification to allow better audio input

Question: So I have the circuit working with a kit but the only thing is the audio aux has this offset voltage or some high voltage output I suspect. So when I plug my phone to the tesla coil through the audio jack, there is strong interference. Can anyone offer a solution to the interference? The coil can sing fine, but this interference is really annoying making my phone glitch and I'm worried it might break it. My phone only glitch and the touchscreen becomes odd and non-responsive when the aux is plugged into my phone.

Thanks
Comment: Your phone has multiple antennae for GMS, WiFi, GPS and Bluetooth. Are you not worried that you could damage your phone in such close proximity to an RF source?
Comment: "thing is the audio aux has this offset voltage or some high voltage output I suspect" I sense a strong XY problem. What did you measure to conclude it has offset or "high voltage output"?
Answer: It's a miracle that your phone works near this device. The capacitive touchscreen is based on quite weak electric field between your finger and the sensors behind the glass. When the ground of your phone and the exciter are connected, the field from the exciter antenna probably wins the touchscreen sensing field. You can add a common mode filter and increase the distance. In theory you can also keep your hand and the phone in a transparent metallized plastic bag which is connected to the ground of your phone. Only offline content is available.


How does the Ocean polarize light?

Question: I know that the light gets polarized in the plane of the ocean, but why is that? It seems to me that the molecules are free to be in any position or location, so why is it that the 'vertical' polarization gets ignored?
Comment: A word of advice: Most of your questions so far have been only 1 or 2 sentences long. While conciseness can be good, there is also something to be said for guiding the reader with your reasoning before posing the question. It may seem repetitive, but stating that reasoning in multiple ways is a good thing - it demonstrates where you are coming from and shows what level answer you are looking for. In this particular case, the shortness masks a very deep and good question: if the photon is only hitting a few molecules in random orientations, how does it know what direction to be polarized?
Comment: To add to Chris's excellent comment: more details helps a potential answerer identify exactly where the confusion lies so they can focus on it, and it demonstrates that you have made a good-faith effort to understand the material (rather than off-loading that necessary initial effort onto others).  Furthermore, conciseness is rarely at odds with this.  Just put a concise version at the top, and add increasing detail further down.  This is how I do it: http://physics.stackexchange.com/q/61894/
Comment: In detail it comes from requiring consistency in the electric and magnetic fields of the three rays (incident, reflected, transmitted) at the boundary. If you are not ready and willing to dive into Maxwells equations in a medium then it is very hard to offer a correct answer that doesn't simply assert the fact.
Answer: I'm going to focus on Chris White's rewording of your question
"if the photon is only hitting a few molecules in random orientations, how does it know what direction to be polarized?"
because, unless you can delve into Maxwell's equations, you're not going to get much joy from anything else. So let's just accept that, as on the Wikipedia page, there are the Fresnel equations coming from the solution of Maxwell's equations and that they say that light of different polarisations behaves differently when reflected from a dielectric interface. All of these equations assume that the mediums involved are continuums, with bulk, extrinsic refractive indices. So, given this context, how indeed do continuum ideas square with a photon hitting a few molecules in random orientations?
The answer is that the photon does not just hit a few molecules - it's not like a billiard ball bouncing off things. A photon propagates following Maxwell's equations. When light enters a medium, the propagating wave interacts with ALL of the molecules in its field of influence. In a medium, we don't just have pure photons, we have a quantum superposition of free photons and exited matter states. And ALL of the molecules contribute to that quantum superposition. Indeed, an optical photon's wavelength is about three orders of magnitude longer than the molecular size, so the quantum superposition will involve of the order of $10^9$ to $10^{11}$ molecules even if the light field is focused to its diffraction limited spot. So the photon really does see effectively a continuum.
The particle side of the photon's nature does not show itself until it is "observed" by being permanently absorbed, e.g. in a photodetector or camera film. Until then, even at the one photon at a time level, the propagation is perfectly well described by the classical Maxwell equations.
Answer: From Wikipedia's article on Brewster's angle:

When light encounters a boundary between two media with different refractive indices, some of it is usually reflected as shown in the figure above. The fraction that is reflected is described by the Fresnel equations, and is dependent upon the incoming light's polarization and angle of incidence.
  The Fresnel equations predict that light with the p polarization (electric field polarized in the same plane as the incident ray and the surface normal) will not be reflected if the angle of incidence is
$\theta_\mathrm B = \arctan \left( \frac{n_2}{n_1} \right),$
where $n_1$ is the refractive index of the initial
  medium through which the light propagates (the "incident medium"), and
  $n_2$ is the index of the other medium. This equation is
  known as '''Brewster's law''', and the angle defined by it is
  Brewster's angle.
The physical mechanism for this can be qualitatively understood from
  the manner in which electric dipoles in the media respond to
  $p$-polarized light. One can imagine that light incident on the
  surface is absorbed, and then re-radiated by oscillating electric
  dipoles at the interface between the two media. The refracted light is
  emitted perpendicular to the direction of the dipole moment; no energy can be radiated in the direction of
  the dipole moment. That is, if the oscillating dipoles are aligned
  along the supposed direction of the reflection, no light is reflected
  at all. In this case, all the light would be refracted in the
  direction perpendicular to the direction of the dipoles. Thus, if
  $\theta_1$ is the angle of supposed reflection (which is equal in
  magnitude to the angle of incidence), the angle of refraction
  $\theta_2$ would be equal to (90° - $\theta_1$).
The above geometric condition can be expressed as
$\theta_1 + \theta_2 =90^\circ$
where $\theta_1$ is the angle of
  reflection (or incidence) and $\theta_2$ is the angle of
  refraction.
Using Snell's law,
$n_1 \sin \left( \theta_1 \right) =n_2 \sin \left( \theta_2
> \right),$
one can calculate the incident angle
  $\theta_1 = \theta_\mathrm{B}$ at which no light is
  reflected:
$n_1 \sin \left( \theta_\mathrm B \right) =n_2 \sin \left(
> 90^\circ - \theta_\mathrm B \right)=n_2 \cos \left( \theta_\mathrm B
> \right)$
Solving for $\theta_\mathrm{B}$ gives
$\theta_\mathrm B = \arctan \left( \frac{n_2}{n_1} \right).$
Comment: I hesitate to invest time in this because I don't see evidence you've done any significant legwork.  For instance, P-polarization is defined as when the "electric field [is] polarized in the same plane as the incident ray and the surface normal".  If you don't understand that and you can't come up with a more refined question than "I don't know what that means", you probably need to first learn what polarized light *is* before you ask about why it's produced in certain situations.  Sorry if that's terse.
Comment: For the record, Jess: whenever you quote another website, it's strongly recommended to put at least a little bit of extra text of your own explaining what a reader should get out of the quote, or why it's relevant. That being said, I agree with your comment. @Tony, if you've read what is on Wikipedia and don't understand it, you should first look at other resources to see if they fill in the gaps, and then (when you want to come here) ask about something specific that you don't understand from the article, and come to understand it a piece at a time.
Comment: I had already read Wikipedia, and found it to be no help, that's why I posted here.
I don't understand the language Wikipedia is using, and I also don't understand why the molecules, or I guess dipoles in this case, can't move in a way that emits vertically polarized light.
Nor do I know what P-polarized light is.
Comment: @David: OK, that's fair.  I'll keep that in mind in the future.
Answer: As others have pointed out, the exact formula of the reflected light should be derived with Maxwell's Equation. If you are simply asking for the qualitative reason for the asymmetry of the polarization, it can be attributed to the asymmetry of the boundary geometry relative to the path of the incoming light. The size of the effect is determined by the wavelength of the light relative to the size and separation of the molecules. WetSavannaAnimal aka Ro has addressed why the material is treated as a continuum but has not mentioned the geometric asymmetry of the boundary (interface). There is no phase change in the horizontal line in the reflecting surface perpendicular to the incoming light path, while there is a large phase shift in the intersection line of the  vertical plane with the interface.

How does the Ocean polarize light?


Pointer to member, within class

Question: I am trying create a typedef for a template that needs a pointer to member, from within a class. The best way to describe it is to show the minimal sample code:
<code>template<typename T, int T::*MV>
struct Bar
{
    const int &value(const T &t) const
    {
         return (t.*MV);
    }
};

struct Foo
{
    int baz;

    typedef Bar<Foo, &Foo::baz> GetBaz; // Compiler error
};

typedef Bar<Foo, &Foo::baz> GetFooBaz; // Compiles just fine

int main(int argc, char* argv[])
{
    Foo f = { 42 };
    Foo::GetBaz b; // Fails to compile
    GetFooBaz b2; // Fine

    int val = b.value(f); // Fails to compile because of above
    int val2 = b2.value(f); // Fine
}
</code>
I am not necessarily dead-set on getting access to a member pointer in this way, I would be fine just knowing the offset to the variable and having the Bar::value function perform trickery.
As a last resort, I suppose I could use a traits class since the would move the definition outside of the class, but I would prefer to be able to declare the typedef near the variable being used.
And, to answer the "why would you want to do that" question, this is all for an IoC container that closely represents the way MEF (C# works).
The specific compiler I am using is VC12, but it would be nice if VC11 supported it as well.
Thanks
EDIT:
Here are the error messages
1>------ Build started: Project: MemVarBug, Configuration: Debug Win32 ------
1>  MemVarBug.cpp
1>memvarbug.cpp(20): error C2327: 'Foo::baz' : is not a type name, static, or enumerator
1>memvarbug.cpp(20): error C2065: 'baz' : undeclared identifier
1>memvarbug.cpp(20): error C2975: 'MV' : invalid template argument for 'Bar', expected compile-time constant expression
1>          memvarbug.cpp(7) : see declaration of 'MV'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Comment: @n.m. The question is tagged vc12
Comment: Please post the compiler error messages.
Comment: Compiles just fine with gcc-4.6.1.
Answer: you can do the following trick:
declare baz to be int[1];
array of size one, in this case calling baz will return the pointer and calling *baz will return the value.

Pointer to member, within class


ARMA model selection: in-sample vs. out-sample accuracy measures

Question: I have a time series for 1000 days for many firms. I am interested to know, in general, on what basis I should select an ARMA model (the nature of my problem restricts integration order to 0). Should it be based on a predictive measure (e.g. MAE, RMSE) or AIC/BIC (measures of the closeness of a model to the unknown data generation process)?
Answer: There is no very strong agreement among forecasters or time series modelers on how to choose a model.

If you are more interested in forecasting, I would recommend using a holdout sample: hold back the last, say, 100 data points, fit your models to the first 900 data points, forecast out into your holdout period and examine the quality of this forecast using whatever accuracy measure makes sense in your application. Pick the model that performs best in the holdout sample.
If you are more interested in understanding the historical dynamics (maybe you are only interested in detecting change points or such), you could also use information criteria like AIC or BIC.

That said, often forecasters use information criteria, or time series modelers may use holdout samples, arguing that you can only claim you have understood a time series well if you can forecast it well.

Or you could do the Box-Jenkins procedure and look at correlograms, ACF or PACF. This question may be helpful.

You may profit from reading through previous questions tagged both "ARMA" and "model-selection", or both "ARIMA" and "model-selection".
Comment: Is there any relation between forecasting and historical dynamics. And if so then why can not AIC or RMSE can be used interchangeably for similar model types.
Comment: There should be a relationship: if you got historical dynamics *very* wrong (like overestimating the historical mean by a factor of 10), your forecasts will likely be wrong. However, dynamics change, so the relationship will not be completely straightforward. In-sample RMSE is not useful, because it can tempt you to overfit.


ibus switching between input methods no longer working on 16.04

Question: I just upgraded to 16.04 and use ibus to manage multiple keyboard input methods. When I switch between them using my favorite hotkey combination, the icon changes (indicating that has registered), but the actual keys still correspond to US english (or whatever the default system keyboard layout is). How do I make ibus change keyboard layouts?
Answer: Just ran into this hiccup when upgrading, and input methods always give me hell whenever I upgrade my distribution, so I thought I'd post the answer here.
Go into the preferences interface window (via preferences on the panel menu, or alternatively by right clicking the panel icon), navigate to the advanced tab, and then uncheck "use system keyboard layout". This will stop your default system layout overriding ibus when you toggle between layouts.
Answer: I found that ~/.config/ibus/bus owned by root and user can't access it. There should be IBUS_DEMON_PID maintained by daemon. So change the owner and restart PC to populate the relationship. That helped me
Comment: this did not work for 22.04 with Mate
Answer: In my case, I had to remove the additional layouts and then re-add them. It helped.


Temporarily suspend snapping in QGIS

Question: Is it possible to temporarily suspend snapping with a shortcut Key in Qgis, like its possible holding down space in Arcmap?
Answer: I don't know about older versions, but in QGIS 3.10.1 there is a default hotkey for snapping enabling/disabling - "S"
Answer: Not sure if turning it on/off with a single key is supported. You can create a shortcut to bring up the snapping options from:
Settings > Configure Shortcuts > Snapping Options...
This lets you quickly set the option Snap to on/off instead of going through the toolbar.
I would be interested to see if there is a method using a single key but hope this helps anyway!
Comment: Tnx Joseph, but what i need is to just press the key and snapping is suspended. I think this is a very important feature for anyone who is digitizing a lot. This is on of the reasons i always use Arcmap for digitizing and editing.
Comment: @RolandG, I agree!

Temporarily suspend snapping in QGIS


What is the difference in purpose of different agreements?

Question: Why do we have different types of agreements like EULA (End User License Agreement) and Terms of Service and sometimes other licenses in a legal tab on a website? If we use these terms interchangeably, is there a legal problem?
Comment: Your question is unclear. What exactly does the separate "legal tab" contain?
Answer:
Why do we have different types of agreements like EULA (End User License Agreement) and Terms of Service and sometimes other licenses in a legal tab on a website?

The names for these agreements describe the subject matter that they cover.  They don't have any magical power.  You could call an end-user license agreement something else that also describes its purpose.
By convention, however, everyone more or less uses the same names, and that helps people out because they can more quickly and more easily understand what a given document is for.
You can't use the names interchangeably, however, because that would be misleading.  The EULA has a different purpose from the ToS.  It has different effects.  It governs different activities, makes different promises, and describes different consequences for violation.
Similarly, you can't use the names "birth certificate" and "marriage certificate" interchangeably, nor can you use the terms "rental contract" and "contract of sale" interchangeably.
Comment: Yes they are misleading but is it legal ?
Answer:
What if we use these terms interchangably is there a legal problem?

There is no legal problem. Those labels can be used interchangeably. The key point is that the conditions ought to be clear enough so that a reasonable person can ascertain them just from reading the document(s).
Consolidating all the terms and conditions in one single document is better than signing multiple agreements. That renders the contract self-contained and tends to preempt overlaps or conflicting terms.
Comment: @questioner "*So basically it is legaly ok but misleading then?*" It is lawful, and it is not really misleading. Reading the actual clause suffices to preempt the misconception or confusion an inaccurate label could cause. In fact, the latter is negligible because a label in and of itself does not formulate what the parties agreed. In and of itself, a label is altogether inconsequential.
Answer: Parties to a contract may choose to have separate but related agreements, or to merge all their agreements into a single larger contract. (Licenses and user agreements and such are contracts, in general.) Having separate, more focused documents can help keep things clearer and more organized, if they are well-crafted. Some of the documents might only apply in specific circumstances. But it is entirely the option of the site operator how to organize such documents. Usually all such documents could be merged into a single "legal terms" document, with no change of legal effect.


Why does root-key matter? Why is it important to understand it

Question: Does a basic melody have to be played around a certain root-key in order to follow music theory properly! Is this just basically staying within the same octave possibly or does it follow some other rule?
Comment: In general, the answer is no. But it depends on what you're trying to do. Why do you ask?
Answer: Theory describes.  It does not command.
Much music centres on a home note, a home chord as well perhaps.  It allows a journey away from that note and a return to it.  You seem to be noticing how this works.  Good!
Answer: What you're asking about is tonality, and this is the way most western music has been thought for hundreds of years. In tonal music, the scale degrees, and the chords built on them, have a hierarchy. The root-key, or tonic, is the principle degree, and is "home" harmonically. All the other harmonies and pitches are thought of in how they relate to the tonic, e.g. how strongly they want to lead to the tonic, how similar they are to the tonic. This is a very useful and satisfying theory, since it allows a composer to set up a lot of anticipation, tension, and surprise in where harmonies lead. Basically, it helps create some overall coherence.
But there are also atonal systems, most notably in the 12 tone technique of the early 20th century. This system completely does away with any hierarchy, and notes are related to their neighbors and not a key. And before tonality, music in Europe was modal, which is based on different sets of scales and their roots, but still not a single home key.  If you have a main melody that's not really  "in" what you think the root-key is, it might not be in a key at all.
Comment: What do you mean by "notes are related to their neighbors" in the 12-tone technique? It seems to me that in this type of music (I assume you mean "serial") these pitches aren't really related to their neighbors.
Comment: It maybe more accurate to say they are limited by their neighbors. In these techniques, phrases are generally written in rows or sets, and in strict forms all twelve tones must used before they can be repeated. It's an area far outside my expertise, but Schoenberg described his technique as based on only the relationship between the notes.


How to show my wordpress admin username & password?

Question: When I created my WordPress website, I was given an admin login username and password. However, I have forgotten both. What is the procedure to find my WordPress admin login username and password from the file or database?
Comment: Check `wp_users` table in your database for Username/Email and then you can use forgot password option.
Answer: Login your cPanel after that click database->phpMyAdmin
after that click your database that has install your WordPress, you find "wp_users" data table and then click edit after that select user_pass->md5 and write new password this input field, after this process click "Go" button and login your WordPress admin panel. I think it's work
Answer: You can see your username but can't see your password. However, you can reset your current password.
Simply, Click on phpMyAdmin option and this will open in new tab and here you need to select your WordPress database. (You can verify your database details from wp-config.php file)
You will see the list of all the tables in your WordPress database. Now you have to look for the "{table-prefix}_users' (by default table will be wp_users) table in the list and click on the browse link placed next to it with many other options.
You will now see a number of rows in your WordPress users table. Click on the edit button placed next to the username where you want to change the password.
You will see a form filled up with all the user information fields needed.
Now, the major step of this method is to delete the value in the user_pass field and replace it with a new password. You will find a function column placed right before the null value column. You need to click on it and select MD5 from the drop-down menu and click the GO option.
Now you can visit /wp-admin and enter your username and password :).
Comment: How is this answer different from that of @Himadree ?


How Square tin with side "6a" units after bending have length of a side of the square is "a" units?

Question: Suppose by using square tin sheet with side "6a units", make a topless box of maximum volume by cutting equal squares at the corners and removing them and then bending the tin so as to form the sides of the box.
What I don't understand is that how the length of a side of the square becomes "a units."?
Answer: Let the side of the cut square be $x$. Then, the sides and height of the resultant cuboid will be $6a - 2x, 6a - 2x, x$.
Volume= $(6a - 2x)(6a - 2x) x = 4x (3a - x)^2$.
For maximum value of volume, $\frac{dv}{dx} = 0$.
$\Rightarrow 4(3a-x)^2 + 8x(3a-x)(-1) =0$
$\Rightarrow (3a-x)(3a-3x)=0$
Because $x=3a$ not possible as then two sides will have zero length, $x=a$ units.
Comment: Thank you @Rohan for helping..
Answer: By cutting equal squares of side $x$ at the corners and removing them we can construct a box of dimensions $6a-2x$, $6a-2x$, $x$ with $0\leq x\leq 3a$.
Hence by AGM-inequality its volume is bounded by
$$V(x):=x(6a-2x)^2=2(2x)(3a-x)^2\leq 2\left(\frac{2x+(3a-x)+(3a-x)}{3}\right)^3=16a^3=V(a).$$
Moreover the equality holds iff $2x=3a-x$, that is $x=a$.
Comment: @Zonnie You are welcome! Any further doubt?
Comment: No.. That's so kind of you..


Kernel Debug Kit for Mac OS X 10.8 Mountain Lion

Question: Where can I find a Kernel Debug Kit for Mac OS X 10.8 Mountain Lion ? There is no link to 10.8 Kernel Debug Kit on the Apple site.
Answer: Apple hasn't released it yet.Still waiting.
Edit:Its out (29/08)
Answer: At https://developer.apple.com/downloads/index.action check
[√] Developer Tools

The Apple Developer 2012-11-01 release of the Kernel Debug Kit for OS X 10.8.2 build 12C60 was around six weeks later than the 2012-09-19 release of that build of the OS.
Assume that a waiting period is customary. Whether six weeks is longer than average, I don't know.
Answer: Download Link
Please make sure you have an Apple ID.


Pushing files on one git-branch

Question: I have a website on a server and I want to begin sharing my work and so I am working with git. I am very new to it.
So on the remote server, I made a "git init" and a git commit to move all the work on the .git directory (always on the remote server).
Then I made a git clone (with an ssh connection) on my local server. And then I changed some files and committed it (worked fine) and then pushed it, but here is the error message :
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://email@example.com/homez.501/sameditr/www/.git
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh:...'

Does anybody has an idea ?
Best,
Newben
Answer: If you meant to create central repository on remote server, you should create bare repository:
git init --bare

You can configure current non-bare repository to accept updates (the error message is even telling you how), but much simpler way is to delete current repo on a remote server and create the new, bare one.
Here's a link to detailed explanation of difference between bare and non-bare repos.
Comment: So you mean that I must delete the actual git repo on the server and on local and then create a new git repo ? Best,Newben
Comment: If that repo is new and you don't have any history of commits to lose, then yes, it's the best option.
Comment: Oh, in fact now I get an error message  "This operation must be run in a work tree" becaus I am trying a git add www ./.git. I don't understand anything of this mess ! Best , Newben
Answer: I usually do the following:
on server, inside webapp directory
$ git init
$ git add *
$ git commit -a

to have at lease an Initial Commit
on dev computer, you may do:
$ git init
$ git remote add origin git+ssh://server/var/www/.git/
$ git branch --set-upstream master origin/master
$ git pull

edit files on dev
$ git push

Hope this helps!

Pushing files on one git-branch


How do we improve tag wiki proposals rather than just 'approve', 'reject' or 'skip' them?

Question: In reviewing a proposed tag definition the page says that we can 'approve, reject, or improve edits suggested by users'. However, I cannot see how to 'improve', there only seem to be options for reject, approve or skip. How do we improve tag wiki proposals?
Comment: Yes, I ran across this today, too. It seems normally silly. So, since I believe tags are generally a bad idea in linguistic SEs anyway, I hereby announce a policy of rejecting all tags I am asked to review.
Comment: @jlawler See my answer about that. :)
Answer: There is an option for improving Tag Wiki edits but it's a privilege (like others) so it is gained by reputation.
The reputation threshold for us is 4000, a graduated site will need 20000 if I'm right.
The rationale for this is that you cannot improve what you cannot create being unsupervised. I.e. if you need someone else to approve your creations, you cannot improve there. See Allow 'improve' for Tag Wiki Edit Suggestions.
Tags are needed to classify questions for ease of reference and also for ease of understanding. If tags are used badly, they lose all their usefulness. Rejecting all reviews indiscriminately is not going to help us. I suggest doing this:

If the "mistake" you'd like to improve is minor, approve and then re-submit an edit yourself (to correct the mistake or even improve with more info, etc).
If the mistake is major, i.e. it's plain wrong or poorly formatted, etc, then reject and re-submit a similar edit (perhaps the idea was good in that one). If you decide to simply reject, you can of course. This is just a suggested course of action.
Comment: Thanks, that's good to know. But it is confusing seeing the reference to an option to improve tag wiki edits.
Comment: @GastonÜmlaut I didn't even know there wasn't an improve button, never noticed. :P Where is the reference? During the reviewing?
Comment: That means that in a beta situation like LSE, practically nobody has the status to edit tags as they're being set up, which in turn explains a great deal of why they're such a mess.
Comment: @jlawler No, everybody can edit tag wikis. The only difference is that those above 4K can do it without being approved, the others need to be approved (as for edits). Tags can be created by anyone with 150+ reputation.
Comment: As I said, that explains a great deal.
Comment: @jlawler How does it exactly?
Comment: @Alenanno There's no button, just a bit of text that says (something like) 'you can approve, reject or improve...'. Because of that I searched for a way to improve the proposal. It wasn't good enough to approve, but the changes to fix it were minor so rejecting it and redoing it seemed silly...
Comment: @GastonÜmlaut I can't think of a better way to do it at the moment, sorry. :P
Answer: You've identified an interesting problem that we're looking into.
To do a proper tag wiki /review, you need three abilities:

Reject the edit ("This does not work.")
Approve the edit ("Excellent changes, thanks.")
Improve the edit ("Great start, but needs a few tweaks.")

Unfortunately, not all users doing tag wiki reviews have the reputation to edit them properly (hence the missing option).
We need to bring those reputation abilities into alignment.
Short term, we're looking into either raising the tag wiki /review threshold so users have the reputation to perform them properly, or… to lower the reputation required to do those edits to broaden the base. Potential solutions are currently under review.
Longer term, there are ways of allowing reviews by lower-rep users (e.g. some sort of suggested edit interface), but those will take more thought and development than an immediate solution will allow.
Good catch!
Comment: Thanks, that's good to hear.
Comment: Ah didn't know about this. Thanks Robert.