Validating date (both format and value)

Question: I read this and got really interested: Validating date format using regular expression
so I started writing my own version of the date validation function, I think I am close, but not quite, and I would like some suggestion as well as tips. I have spend a lot of time trying to tweak the function.
import re
import datetime

# Return True if the date is in the correct format
def checkDateFormat(myString):
    isDate = re.match('[0-1][0-9]\/[0-3][0-9]\/[1-2][0-9]{3}', myString)
    return isDate

# Return True if the date is real date, by real date it means,
# The date can not be 00/00/(greater than today)
# The date has to be real (13/32) is not acceptable
def checkValidDate(myString):
    # Get today's date
    today = datetime.date.today()
    myMaxYear = int(today.strftime('%Y'))

    if (myString[:2] == '00' or myString[3:5] == '00'):
        return False

    # Check if the month is between 1-12
    if (int(myString[:2]) >= 1 or int(myString[:2]) <=12):
        # Check if the day is between 1-31
        if (int(myString[3:5]) >= 1 or int(myString[3:2]) <= 31):
            # Check if the year is between 1900 to current year
            if (int(myString[-4:]) <= myMaxYear):
                return True
    else:
        return False

testString = input('Enter your date of birth in 00/00/0000 format: ')

# Making sure the values are correct
print('Month:', testString[:2])
print('Date:', testString[3:5])
print('Year:', testString[-4:])

if (checkDateFormat(testString)):
    print('Passed the format test')
    if (checkValidDate(testString)):
        print('Passed the value test too.')
    else:
        print('But you failed the value test.')
else:
    print("Failed. Try again")

Question 1: Is there other way (better) to do int(myString[3:5]) when I want to compare if it is valid? I feel my method is very repetitive, and this function must require 00/00/0000, otherwise it will break. So the function isn't all that useful in that sense. Especially the way I handle my 00/01/1989, it is just simply comparing if they are indeed 00.
Question 2: There are many if statement, I wonder are there better way to write this test?
I would like to learn more about programming in python, any suggestion or advice will be greatly appreciated. Thank you very much.
Answer: Like many things in python there's already underlying capabilities to check dates. Assuming you aren't just doing this as an academic exercise the most straightforward way to validate a date is to try and create it.
import datetime

minyear = 1900
maxyear = datetime.date.today().year

mydate = '12/12/2000'
dateparts = mydate.split('/')
try:
    if len(dateparts) != 3:
       raise ValueError("Invalid date format")
    if int(dateparts[2]) > maxyear or int(dateparts[2]) < minyear:
       raise ValueError("Year out of range")
    dateobj = datetime.date(int(dateparts[2]),int(dateparts[1]),int(dateparts[0]))
except:
    // handle errors

if datetime.date is given an invalid date it will complain, eg:
datetime.date(2000,45,23)

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    datetime.date(2000,45,23)
ValueError: month must be in 1..12

Comment: I am trying to write this as a programming exercise. I think your implementation is cleaner, I like the spiting in `list` (dateparts), it makes the counting less messy. I will look up the `try:` `except`, seems like it is what I should use instead of `if` statements. Thank you.

And does the `datetime.date()` do everything I write and then more?
Comment: Yes, It's generally considered cleaner in python to handle exceptions rather than try to anticipate them. You should also look at the meaning of `except ValueError:` which allows you to target certain classes of errors. datetime.date() creates a date object, if you pass it invalid values for year, month or day it will raise an exception.
Comment: I guess I didn't pick the best practice problem, but thank you for teaching me to use the `try:` and `except: ValueError`. Thank you.
Answer: I understand there's some value in academic exercises. I wouldn't discourage them.
I also think a big part of learning Python is discovering which problems have already been solved.  There are several reasons I think this way.  First, I think it's a waste of time to re-invent the wheel.  Also I get a chance to study code and different approaches to solving problems.  Finally, I think a long-standing solution is less likely to be naive about quirks in the subject matter.
With that in mind, I recommend the dateutil library.
Comment: I see, thanks for the suggestion on the dateutil module! I am just trying to practice my python code :)
Answer: from dateutil.parser import *
parse("1993-09-01")
datetime.datetime(1993, 9, 1, 0, 0)

If the format is not proper, then it will raise a ValueError, you can use try.. catch to catch them so that the application does not close unexpectedly.
Answer: Based on some answers above I wrote this short piece of code which validates date to in the format: DD/MM/YYYY.
date = "29/02/2016"

min_year = 1900
max_year = min_year + 200

days_31 = ['01', '03', '05', '07', '08', '10', '12']
days_30 = ['04', '06', '10', '11']
days_28 = ['02']

month_dict = {'01':'January',
      '02':'February',
      '03':'March',
      '04':'April',
      '05':'May',
      '06':"June",
      '07':'July',
      '08':'August',
      '09':'September',
      '10':'October',
      '11':'November',
      '12':'December'}

def validate(day, month, leap_year_or_not):
    if leap_year_or_not:
        max_day = 29
    else:
        max_day=28
    if month in days_28:
        if day > max_day:
            print "Invalid day: %s for month %s" %(day, month_dict[month])
            return False
        else:
            return True
    elif month in days_30:
        if day > 30:
            print "Invalid day: %s for month %s" %(day, month_dict[month])
            return False
        else:
            return True
    elif month in days_31:
        if day <= 31:
            return True
        else:
            print "Invalid day: %s for month %s" %(day, month_dict[month])
            return False
    else:
        print "Invalid month:%s, Invalid day:%s" %(month, day)
        return False

if len(date)!= 10:
    print "Invalid Format. Please enter date in DD/MM/YYYY"
else:
    day, month, year = date.split("/")
    if len(day) != 2:
        print "Length of day in not 2. Please enter day as 01 for first!"
    elif len(month) != 2:
        print "Length of month in not 2. Please enter month as 01 for January!"
    elif len(year) != 4:
        print "Length of year in not 4. Please enter year as 2001!"
    else:
        day=int(day)
        month=int(month)
        year=int(year)
        if day < 1 or day > 31:
            print "Day %s is not in range [1-31]" %str(day)
        else:
            if month < 1 or month > 12:
                print "Month %s is not in range [1-12]" %str(month)
            else:
                if year < min_year or year > max_year:
                    print "Year is not in range [%s-%s]" (str(min_year), str(max_year))
            else:
                if year%4 == 0:
                    leap_year = True
                else:
                    leap_year = False
                valid_day_month = validate(day, str(month).zfill(2), leap_year)

Answer: import time
import datetime
self.date = raw_input('Enter the date to travel in (yyyy-mm-dd) format: ')
try:
    valid_date = time.strptime(self.date, '%Y-%m-%d')
    today_date=str(datetime.date.today())
    if self.date<today_date:
        print "date got over"
    else:
        print " "
except ValueError:
print('Invalid date!')

Validating date (both format and value)


US Tax withholding on business expenditure paid for using Amazon gift cards

Question: If I have to pay a US individual $1,000 fee for professional services, and i don't pay him in cash but instead give him an Amazon gift card for the same amount, will it be deductible under business expenditure? What amount of tax will be required to be withheld, if any?
Thanks in advance!
Comment: whenever there is a question about paying somebody a significant sum of money via gift card, the first thought is "are you sure this isn't a scam?"
Comment: Do you have documentation that you can use to prove that the expense is business related? Are you asking about your taxes or the other persons taxes?
Comment: Yes, i will have an invoice for the professional services billed to me. I am asking about my liability to withhold tax AND eligibility to claim such expenses as business expenses when filing taxes.
Answer: The tax impact of your payment is not affected by the method of payment. You can pay with cash, gift cards, credit cards, bitcoins, shark teeth, or your own services - it doesn't matter. What matters for tax purposes is the value. If you don't pay in cash, then you need to make sure you record the payment in USD value, no matter how you actually delivered that value to your counterpart.
If you're required to do withholding, then obviously it cannot be in anything but USD. So whatever it is that your method of payment is - you'll need to subtract the withheld amount from its value.
Comment: Thankyou. Is there any publication i can refer to for the limit above which withholding is required, its applicability on me and the rate at which tax is required to be withheld?
Comment: @NikhilAnand you should probably discuss this with your accountant, but start here: https://www.irs.gov/individuals/international-taxpayers/tax-withholding-types
Comment: In the specific case of credit cards, withholding is unlikely to be necessary.  Normally, witholding is an alternative to reporting taxes via 1099.  With credit card payments, the credit card company reports the transaction themselves.  Note that this doesn't contradict littleadv's answer (the tax impact is the same).
Answer:
If I have to pay a US individual $1,000 fee for professional services,
and i don't pay him in cash but instead give him an Amazon gift card
for the same amount, will it be deductible under business expenditure?
What amount of tax will be required to be withheld, if any? Thanks in
advance!

If the person providing the services is not an employee, then you don't have to do any withholding. The other company is responsible for the taxes.
For example you pay a painter to paint the lobby of your business. They aren't an employee. You document the cost. The painting company then pays the painter. You have no idea if they are a W-2 employee or a 1099 contractor.
Because you want to be able to deduct the expense, you will need their tax ID number, so that you can properly report the expense on your tax forms.
If they are wanting cash or gift cards it is likely that they aren't expecting you to report their income.


How to teach a class with huge differences between students' backgrounds?

Question: As there are different students with different educational and economical backgrounds in the classroom, I would like to know how a professor can deal with those differences. For example, undermotivated students or those whose knowledge is very weak on the mathematical courses - what is the best teaching style for such cases?
Comment: Maybe a better fit for the mathematics educators stack?
Comment: @astronat I think this OK here because it can be easily generalized to several examples of weaknesses (in fact, in the OP, there is "For example").
Comment: @astronat Actually, it sounds like this *isn't* teaching math, but teaching some subject that uses math where some students aren't very strong on the math prereqs.
Answer: Every teacher, course, group and situation is different but these are things that worked for me (Europe, teaching unmotivated and diverse group of undergrads):

Keep external teaching material (books, software) to a minimum
Give regular feedback on progress (I usually start every class with a short, very basic quiz about the lass classes (self-corrected by students and with correct answers immediately discussed with class). I tell students that below a certain % of correct answers they need to learn/practice material from previous classes/courses because their background knowledge is a bit lacking.
Provide extra exercises to teach/reinforce the basics (with detailed solutions) for optional individual work.
Encourage or enforce group work where students teach each other. (I taught a class where the final assignment was a group work with the worst student's score defining each group member's final score. It was a huge success but it required a lot of work and constant monitoring of group dynamics.)
Praise any good answer and/or students attempting to answer. Encourage students making mistakes (it gives feedback to both of you and allows to correct misunderstandings before the exam).
Make sure the exercises are relevant both for the subject matter and the students (e.g., if the majority of your students are biologists, give them examples with trees and not light bulbs)
Comment: I agree with most of the points. But #4 is a disaster. You are shifting responsibility of teaching and the associated risks (if they fail) to the good students. In some groups the strong members will be tempted to do the job of the rest of the group to get good marks - maybe your monitoring prevents that, but in general, this is bad and outright unfair advice. Why should strong students pay with their marks if they happen to be co-grouped with a weak or lazy student, unless they work multiple times as hard (either doing everything themselves, or spending much of their time tutoring)?
Comment: Ok, if you can choose your group members, that's better. But if people put more work into group tasks than in individual tasks, either you are very good at motivating group work, or you were lucky. I have never seen anything other than split into the doers and the fellow-travelers or capable students being dragged down. The only working group work I have seen is the one one does not want: collusion.
Comment: @CaptainEmacs My group assignments allowed the group to "fire" a group member.  The recommendation of the others had to be unanimous.  The fired member then had to complete and be graded on the assignment individually.  No group member ever got fired in any of my classes.
Comment: @Buffy The question mentioned economical differences, so I thought some students may have difficulty buying expensive textbooks/course materials. Sorry if I was unclear. Also, creating own teaching materials means it can be tailored better to the group's needs.
Comment: Having been a student once and multiple times in above situations, I detested obligatory assessed group work with a vengeance. I have less-than-ideal cases even for the "best" cases where I worked with an equally strong student. In certain topics groupwork is unavoidable as per design (as software engineering or larger programming tasks); I have done that successfully as teacher, but the situation described by OP is precisely the one where I would avoid groupwork. I am impressed that you made it work. As student I would have considered being assessed by the worst score as inexcusable.
Comment: @BobBrown That's precisely why I dislike group assignments unless they are essential for the learning outcome (e.g. software engineering). As I say, your idea of voting somebody out might work as an incentive, but it really can devolve into bullying. It doesn't have to, but it definitely can do so. Maybe you can suppress that somehow as teacher, but then you need to explain how you do that.
Comment: @CaptainEmacs I disagree but I should have mentioned that the task has to be such that each member has to contribute. Students also select their group members in this setting. It might also be a cultural difference but we never had the issues of "lazy" student but yes, weak students had to be helped more (I think this was a valuable lesson to the groups). Moreover, as I mentioned before, constant supervision is necessary (think regular meetings with groups beyond scheduled classes, individual supervision of "weak" students, etc.) - lots of effort from the teacher but worth it, IMO.
Comment: @BobBrown Ok, that's an incentive, albeit not a very nice one. Again, it shifts the responsibility from the teacher to the students and invites a "bullying" atmosphere, not unlike the ranking systems in some companies (whereby in the latter, of course, the ranking is obligatory and not optional as in your case).
Comment: @CaptainEmacs  I disagree.  the professor has very little way to observe the dynamics of a group assignment unless the assignment is so highly structured that the professor can see, and grade, the individual product of each student.  At that point, it's no longer a group assignment.  The approach I used at least usually assures that every student in the group carries some of the weight.
Comment: Also, funny but grades where generally (much) higher than when we had individual assessment. I think it is because humans are inherently social and put more effort into group tasks than individual ones (they don't want to let down their team).
Comment: Keeping up students' motivation is part of it but I think clear requirements and the fact that the teacher puts in as much work as they do are more important. In sum, co-operative tasks are awesome but the effort going into such course is enormous. I understand not everyone can or wants to use this method. But it is one that works well for the situation described in the original question.
Comment: I guess I don't understand your first point. Can you say more about why you think this is true?
Comment: @Aolon Plus, it has the advantage that students coming from different areas do not have to struggle with finding the suitable literature in addition to understanding the material.
Answer: What works for me:
Create a set of exercises that cover a wide range of skills, from elementary/introductory ones to challenging ones (some of which may require literature or even own research). The students not only get an entry point into what you wish to teach, but they also can see where it leads, and the strong/experienced ones are not bored.
What's important for students is to learn the methods of thinking, and I usually spend quite some time introducing very thoroughly the method of thinking of the field. Interestingly, even stronger students seem to appreciate that, because they usually are fast in picking up material, but often not very experienced in seeing all the underlying structure. Repetition under different perspectives helps the students to pick up the methods and beginning to see how it works rather than learning by rote.
Focus on fewer, important concepts, treated deeply, rather than a litany of shallow introduction to many different ideas. The students need to learn "how to learn" and "how to approach" a topic, rather than having seen too many different things. The latter, they can do for themselves once they have the tools.
Answer: This isn't a complete solution, but only something to think about, depending on how free you are in course design. I think it complements the answer of Captain Emacs to some extent.
I once taught a database (CS) course to a group of very able students at a top university. Almost all were very good, but not all had the same background preparation. There were several projects in the course and (IIRC) they were group/pair based. The course leaned heavily to DB principles and the underlying theory and implementation, not just use of SQL.
One assignment was about search. I made two versions of the same assignment, one easy and one quite difficult. Students could choose to do either one and the grading would be the same, no matter which they chose, based on quality of implementation.
The easy one was to implement a binary search tree and the hard one was to build a b-tree. These are about an order of magnitude different in difficulty (rough estimate). When introducing the assignment I said that if a student had never implemented a binary search tree then I would recommend they choose that one, but if they had done so, that doing it again would bore them silly, and I'd recommend the hard one.
I had a (to me) surprising number of students choose the harder assignment and I judged the experiment successful.
Of course this implies that you are willing to give the same grade for things of different difficulty, but every student learned something of value if they were successful in their implementation and also honest (to themselves) in choosing which to do. This won't work when students are too much grade driven, or otherwise too panicked about grades, but you might consider whether it would work in your environment.
Think about learning more than about grading.
Answer: This is a separate idea from my other answer here, and I warn that I haven't tried it in this form, but would consider doing so in the circumstance you describe. But note that I also had great freedom in course design and was always able to justify "odd" pedagogical choices to my department head and dean.
One of my tricks in teaching was to use cumulative grading where students get grades by accumulating points from projects and exams. For me, exams were a relatively small part of the total, but every student knew exactly what grade they earn by adding up the points. So, some students already had nearly enough points accumulated that the final exam was essential irrelevant, so I would excuse them from it, letting them focus on other courses. This idea grows out of that practice.
Suppose you make a deal with your students that they can either take the final exam or, starting after mid term, take on a substantial project requiring some deep learning. Emphasize that the project will be difficult and that the grade for it will substitute for the final exam grade, which they need not take.
In mathematics, a "project" might be the analysis of some paper or the application of course ideas to some specific problem.
I have no evidence, but suspect that the high achievers will be drawn toward the project if you can make it interesting enough. This might also be an opportunity to introduce group or pair work if you don't do that otherwise. You will need some communication channel for these students separate from the entire class since, for the right project, there might be a lot of questions. But the "really good" students probably value a challenge. I hope I'm not too naive about this, but it was my own experience both as a student and later as a professor.
I caution that this might not work above a certain scale. I seldom had to teach as many as 40 students in a class and usually a bit under 30.
If the better students spend a lot of effort on this, then you can focus more on the students who need more help and guidance.


lightning:datatable not rendering correctly

Question: I'm having troubles with rendering my datatable correctly.
There are actions added but it seems the datatable is not high enough to view it correctly. Is it something I'm doing wrong? Or is it a bug?

This is the code for the datatable

Search results

<lightning:datatable data="{! v.persondata }"
                    columns="{! v.personcolumns }"
                    keyField="id"
                    onrowselection="{! c.getSelectedPerson }"
                    hideCheckboxColumn="true"
 />

Here is the code for initializing the columns
//init datatable
component.set('v.personcolumns', [
            {label: 'Last Name', fieldName: 'LastName', type: 'text'},
            {label: 'First Name', fieldName: 'FirstName', type: 'text'},
            {label: 'Mailing Zip/ Postal Code', fieldName: 'PersonMailingPostalCode', type: 'text'},
            {label: 'Mailing City', fieldName: 'PersonMailingCity', type: 'text'},
            {label: 'Billing Street', fieldName: 'PersonMailingStreet', type: 'text'},
            {label: 'Email', fieldName: 'PersonEmail', type: 'text'},
            {label: 'Primary Phone', fieldName: 'PersonHomePhone', type: 'text'},
            {label: 'Secondary Phone', fieldName: 'PersonOtherPhone', type: 'text'},
            {type: 'action', typeAttributes: { rowActions: actions}}
        ]);

And the code for adding data (the response is a list of Accounts)
component.set('v.persondata',response.getReturnValue());

Answer: A work around until the component handles this better itself is to use CSS of this nature in your component:
.THIS .slds-scrollable_y {min-height: 150px}

that sets the minimum height of the vertical scrolling region that lightning:datatable outputs:

    <table role="grid" class="slds-table ...

Some background info...
Maybe more of a clarification than an answer, but I tried a lightning:datatable where I could vary the number of rows. With quite a few rows, there is room for the menu to pop up below the selected row button and not be clipped, and when towards the bottom of the table the menu pops up above the selected row button elegantly handling the clipping problem there:

But yes for the small number of rows case, I see the same as you. Users can scroll to see the menu but that's not great. An automatic minimum height of one row plus the height of the menu would be nice to have to address that.
Answer: Setting slds-scrollably_y to a minimum height is one solution, but might look a bit odd with just a few rows.
A better solution would be to use overflow: visible;, like so:
.THIS .slds-scrollable_x { overflow: visible; }
.THIS .slds-scrollable_y { overflow: visible; }

This will allow the action menus to go over other elements, regardless of the height of the table.
Comment: Yep this works better!
Answer: There is a better and documented way now!
As per documentation:

Resizing Tables and Columns
The width and height of the datatable is determined by the container element. A scroller is appended to the table body if there are more
rows to display. For example, you can restrict the height to 300px by
applying CSS styling to the container element.

You can even configure it using an attribute like this:
<aura:attribute name="heightInPixels" type="Integer" access="global" default="150" />

NOTE: VSCode might show a syntax error for the above code, you can just ignore it.
Answer: There is a better way now to use "popover__body"
sample working code :-
const column = [ {col 1 blabla}, { col 2 blabla} , type: "action",
    typeAttributes: { rowActions: actions, menuAlignment: "slds-popover__body"}]

this will bring up the menu item menu pop over and do not hide inside even when one row is present in lightning data table
Comment: This is definitely the way to go now!


What is the iHDR process?

Question: I've seen references to the iHDR process. I would like to read a quick summary, but I'm not quite interested enough to watch a webinar. What is the basic idea of iHDR?
Comment: Never heard of this. Sounds like an Apple product :) If it is, then they won't tell you what it does but ask more than its worth!
Answer: Basically, iHDR is a method of blending the bracketed raw images using a variety of masked luminosity layers.
As I understand it, it's a series of steps for blending images, after refining and masking layers in each image, so as to produce results that represent what you saw in the original scene. This is all done manually, without using HDR software, in order that the photographer can just blend the areas of the images that he thinks needs it, rather than get the all over rather flat effect that some software can produce in some hands.
Comment: is it different from "normal" HDR?
Comment: Would you mind adding a little more detail?
Comment: Any links or book recommendations to further info would be great.

What is the iHDR process?


character constant:\000 \xhh

Question: Can anyone please explain the usage of the character constant \000 and \xhh ie octal numbers and hexadecimal numbers in a character constant?
Answer: In C, strings are terminated by a character with the value zero (0). This could be written like this:
char zero = 0;

but this doesn't work inside strings. There is a special syntax used in string literals, where the backslash works as an escape sequence introduction, and is followed by various things.
One such sequence is "backslash zero", that simply means a character with the value zero. Thus, you can write things like this:
char hard[] = "this\0has embedded\0zero\0characters";

Another sequence uses a backslash followed by the letter 'x' and one or two hexadecimal digits, to represent the character with the indicated code. Using this syntax, you could write the zero byte as '\x0' for instance.
EDIT: Re-reading the question, there's also support for such constants in base eight, i.e. octal. They use a backslash followed by the digit zero, just as octal literal integer constants. '\00' is thus a synonym for '\0'.
This is sometimes useful when you need to construct a string containing non-printing characters, or special control characters.
There's also a set of one-character "named" special characters, such as '\n' for newline, '\t' for TAB, and so on.
Comment: What if you want to write "this\0has\00 chars" ?  Would \00 be interpreted as one byte '\0' or as '\0', '0'?  What's the limit of the length of an octal escape sequence?
Comment: @strager, don't know that one but you could use <"this\0has\0" "0 chars"> since C will just run them together.
Comment: but c will read only this from <"this\0has\00 chars">,as it will get the null value \0 which is the test condition for the end of any string.
what  do you mean by " you could write zero byte as '\x0' "?
thanks for reply!
Answer: Those would be used to write otherwise nonprintable characters in the editor. For standard chars, that would be the various control characters, for wchar it could be characters not represented in the editor font.
For instance, this compiles in Visual Studio 2005:
    const wchar_t bom = L'\xfffe';     /* Unicode byte-order marker */
    const wchar_t hamza = L'\x0621';   /* Arabic Letter Hamza */
    const char start_of_text = '\002'; /* Start-of-text */
    const char end_of_text = '\003';   /* End-of-text */

Edit: Using octal character literals has an interesting caveat. Octal numbers can apparantly not be more than three digits long, which artificially restricts the characters we can enter.
For instance:
        /* Letter schwa; capital unicode code point 0x018f (octal 0617)
         *               small unicode code point   0x0259 (octal 1131)
         */
    const wchar_t Schwa2 = L'\x18f';    /* capital letter Schwa, correct */
    const wchar_t Schwa1 = L'\617';     /* capital letter Schwa, correct */
    const wchar_t schwa1 = L'\x259';    /* small letter schwa, correct */
    const wchar_t schwa2 = L'\1131';    /* letter K (octal 113), incorrect */

Answer: Octal is base 8 (using digits 0-7) so each digit is 3 bits:
\0354 = 11 101 100
Hexadecimal is base 16 (using digits 0-9,A-F) and each digit is 4 bits:
\x23 = 0010 0011
Inside C strings (char arrays/pointers), they are generally used to encode bytes that can't be easily represented.
So, if you want a string which uses ASCII codes like STX and ETX, you can do:
char *msg = "\x02Here's my message\x03";

character constant:\000 \xhh


Calculate the rise in temperature from directed radiation

Question: For example I have a 1 watt laser and direct it to a sheet of metal (copper), if I were to direct it for say a time interval of 1 minute what would be the change in temperature? I can predict that it would depend on the size of the sheet as a larger sheet can dissipate more energy, the time exposed and the power of the laser, however I would appreciate someone walking me through.
Comment: I will clarify that, because I have specified specific numbers on the question one should not assume it is for a homework assignment, the reason I provided numbers was because I thought it would make it easier for someone responding to formulate an answer.
Answer: The answer depends on many factors, but here are the basic bits of physics that play:

The power and wavelength of the laser
The reflectivity of the surface (function of wavelength of the laser)
The size of the focal spot
The thickness of the sheet
The thermal conductivity of the sheet

The reflectivity of the copper is a particularly important one. If you have a well polished sheet of copper, the emissivity might be as low as 0.03 (reference) or, if it became oxidized from heating, as high as 0.78. That obviously has a HUGE impact on the tempeature dependent solution (but interestingly, if the final heat loss mechanism is only radiative, then it would not affect the steady state solution - only how long it would take to get there).
Let's first compute the steady state solution - it is a little bit easier than the transient, and it gives us some of the principles. I will assume a sheet of thickness $t$, focal spot of diameter $d$ with power $P$, emissivity of the surface $\epsilon$. That means that power absorbed is $\epsilon P$. The way this heat leaves the focal spot area is through conduction into the metal, and then through heat loss at the surface (radiation, convection). Radiative heat loss goes as $\epsilon \sigma_B T^4$ per unit area, while convection depends on mass flow of air (which in turn depends on orientation...). All quite complicated - easy to be off by factors of 2x and greater with "reasonable" assumptions.
But let's assume 1 minute with 1 W laser (as in your question), and emissivity of 0.03 (polished copper). Then the total heat absorbed by the copper is 1.8 J. The specific heat capacity of copper is roughly 0.4 J/g/C. If the sheet of copper is 1 mm thick, and circular with an area of 100 cm^2, then the total mass is approximately $\rho V = 8960\cdot 10^{-3-2} kg = 90 g$. This means that the heat capacity of the copper sheet is about 36 J/C, and that on average it will be heated by 0.05°C. That is assuming that thermal conductivity is sufficient to get the heating evenly across the entire sheet, which is probably false; but it does suggest that radiative and convective heat losses are likely quite small on this time scale.
So let's look at the thermal conductivity. Because the sheet is much thinner than it is wide, I am going to treat as a 2D sheet - as though all the heat is applied over a circle of diameter $d$. The lateral thermal conductivity of the sheet can be estimated from
$$k_{2D} = k_{3D}*t = 400 * 10^{-3} = 0.4 W/K$$
A given heat flux $\Phi$ at a radius $r$ will cause a thermal gradient
$$\frac{dT}{dr} = \frac{\Phi}{2\pi r k_{2D}}$$
so with the numbers given above, we would expect
$$\frac{dT}{dr} = \frac{0.03}{2\pi r \cdot 0.4} = \frac{0.012}{r}$$
Obviously, you need some boundary conditions. If we assumed for a moment that the edge was kept at room temperature, the thermal profile (integrating from the edge inwards) would be of the form
$$T(r) = T_0 - 0.012\cdot \log\frac{r}{r_{outer}}$$
This means that for steady state, with the edge clamped at room temperature we would expect the temperature rise in the middle to be only about 0.03°C. That suggests that thermal conductivity of the copper is really quite effective for this kind of heat load. If you make the sheet much thinner, and the focal spot smaller, the answer will obviously change.
As you start playing around with these assumptions, the simplifications that worked above might break down - and you quickly end up with a tricky diffusion equation. But sometimes, before you get all carried away with those, it's a good idea to estimate the magnitudes. In this case, the magnitude of the temperature rise is quite small (with the values I chose).
Comment: He just wanted the temperature rise, not a full blown temperature profile... way to go above and beyond I guess!
Comment: @pentane - he wanted to "be walked through" the calculation. You can't get the local temperature without knowing something about the profile. But thanks.
Answer: Well it all depends on what assumptions you are able and willing to make.
For a start you can work out how much of the laser light is reflected. The reflected power will be something like (for normal incidence)
$$\frac{P_{r}}{P_i} = \frac{(\eta_m - \eta_{vac})^{2}}{(\eta_{vac} + \eta_m)^2},$$
where $\eta_{vac}=377$ Ohms and $\eta_m$ is the impedance of the metal at the frequency you are interested in.
Next you can assume that what isn't reflected is transmitted into the metal. If the metal is thick enough, say several skin depths, then you can assume that all the transmitted power is absorbed.
If you can then assume that the metal is isolated and does not radiate or conduct away any heat, then you can use the specific heat capacity for the metal to work out by how much the temperature rises.
As you specify heating this for a minute I doubt that the assumption that the metal doesn't lose any heat by radiation will be a good one, though if you keep it in a vacuum you might get away with assuming no conduction/convection goes on. So you need to work out what the emissivity of the metal is as a function of temperature and factor that into a differential equation for how the temperature depends on time. It may even be that you find that after a minute the metal has reached some kind of equilibrium where it radiates away as much as is being absorbed. That will depend on the thickness, mass and emitting area I suppose.
Answer: There are so many variables here i think its nearly impossible to give an answer like how thick is the lazer, how far away is the lazer how reflective is the surface of the metal ......... the more variables there are the harder something is to predict if you wanted an answer it would be much more practical to get one by doing the experinment, probably not what you wanted to hear, sorry i couldn't be more helpful.
Comment: Hmm, spoken like a true engineer. I think one can do a bit better than that before firing up the laser. I'm not clear why it should depend on how far the laser is away, unless it's so far that the beam doesn't entirely strike the metal surface.
Comment: the further away the lazer is the the more energy is lost on the journey as heat ect and i'm fairly sure kinetic energy would have to be included somewhere in that as well, small as the effect would be
Comment: Your post was very ztimulating! :-)


Leaf Area Index (LAI) processing software

Question: I took a bunch of hemispherical vegetation images with a fisheye lense in the field. Now I am looking for a software that can (semi-)automatically translate these images in LAI values. So far I struggled with CanEye but didn't get results.
Anybody knows a good freeware solution?
Comment: My reading of your Question does not lead me to think that it is specifically about GIS.  W\If you disagree, would you be able to edit your Question to explain how that is the case, please?
Comment: Oh well, yes, you are right. It is an indicator of vegetation growth and structure which is used in remote sensing. I consult this forum so intuitively that I somehow thought it might be the right place. No help so far, so maybe I was wrong. But maybe I am lucky and somebody else working in remote sensing finds his way here...
Answer: I was just looking for the same and found CAN-EYE by INRA. Not only are they really the scientific leaders on this research, but they have made it available for free to everyone.
CAN-EYE is an imaging software (Windows) used to extract the following canopy structure characteristics from true-color images (either acquired with a fish-eye or with a classic objective)
LAI : Leaf Area Index
ALA : Average Leaf inclination Angle
FAPAR : Fraction of Absorbed Photosynthetically Active Radiation
FCOVER : Vegetation cover fraction
Bidirectional gap fraction
https://www6.paca.inra.fr/can-eye/
CAN-EYE is a free software developed since 2003 at EMMAH (Environnement Mediterranéen et Modélisation des Agro-Hydrosystèmes) by INRA (french National Institute of Agronomical research).


Will blender 2.8 official realise be able to run on computer with graphics driver that is lower then OpenGL 3.3

Question: I have seen videos on the upcoming blender vision 2.8 and I would also like to expand with blender like everyone. I hope the developers won't let my laptop limits to keep me from developing my skills.
Thank you
Comment: nope, but if you are okay with blender 2.79 you shouldn't worry about it
Answer: It will not. As stated on the official page, minimum requirements demand at least a minimum supported OpenGl Version of 3.3.
A consensus was reached that this was required to allow supporting all new and upcoming features features of EEVEE viewport. This includes realistic graphics and high visual fidelity, higher viewport performance, better use of resources and take advantage of modern hardware and new graphics cards features, without many compromises for newer hardware.
Unfortunately this means dropping support for older cards and more dated hardware.

For AMD cards, versions prior to HD 2000 series (circa 2007) are no
longer supported
For NVidia cards this means cards older then the GeForce 8 series (G##8000 circa 2010) are no longer supported
For Intel integrated graphics cards you must have at least sixth generation IGP, generally on a i# 2#### processor or newer

Unfortunately if you have hardware older than the above mentioned cards, or that somehow doesn't support OpenGL 3.3 you won't be able to run version of Blender newer than 2.8#. You can try to upgrade your drivers to the newest supported version (unlikely, but some times support was later added to older cards).
You can always run versions from 2.79 and prior.
Comment: Hi, nVidia GTX 780 will be fine?
Comment: If it supports CUDA, yes.
Answer: If you have an older system doesn't support OpenGL 3.3 now it's unlikely 'upgrading your drivers' would fix it. Staying on to stick Blender 2.79 isn't a good answer because you'll be denied bug fixes and UI improvements.
You either need to buy a new system or switch to Maya or Max both of which have good legacy support for older OpenGL and free educational licenses for students.
Comment: You'd suggest using Maya or Max over blender 2.79? I'm not worried about using a legacy version (I still use CS4). If it works, no reason to abandon software just because a new incompatible version came out.
Answer: The Mesa Alternative:
I had the same issue.  Tried installing newer drivers (which is always the best option) but the manufacturer's download link was corrupted.  I'll keep checking back, but what do I blend till then!??
Therefore, I needed an alternative.  Enter our old open-source OpenGL alternative Mesa 3D.
To make it happen, either build it yourself or if you're lazy like me, download pre-built binaries.  (The mingw version from that page worked great on my Win7 x64 Intel i3000 graphics card.)
Simply unzip file into your Blender install directory, and viola! :)


Charge MacBook with USB (Adapters?)

Question: I want to buy an external charger, it has USB. Are there any adapters (including transformators, I think that might be needed, right?) so I can charge my MacBook with the external charger?
Answer: That is not possible.
The USB can not carry the Voltage (14 V) and Current (> 1 Amp) required to charge MBP.
If it is for the car, you can try this product http://www.amazon.com/Spal-Magsafe-Adapter-Charger-Notebook/dp/B009G1B22O
Answer: There're external batteries like this: http://www.amazon.com/HyperJuice-External-Battery-MacBook-Smartphones/dp/B009I5AZTY
Comment: Well those are extremely expensive. And I wanted to know whether there are adapters.

Charge MacBook with USB (Adapters?)


Using dotConnect with MVC5 Razor

Question: I have an existing SQLServer based MVC 5 Razor project. Our deployment site does not allow SQLServer, must be Oracle. I have the devArt dotConnect Oracle provider, but I cannot figure out how to migrate to it. Is there a COMPLETE  list of required references to add and web.config modifications ? Also, I am using Identity Framework, I have noticed a number of dll's and sql files scattered about the devart installation folder, do any of these need to be included as well ?
Answer: I followed this tutorial from company; it was very clear and easy to follow.
Using Entity Framework Implementation of ASP.NET Identity for Oracle http://www.devart.com/dotconnect/oracle/docs/Identity-Tutorial-Entity.html
I needed to make sure the dll's were set to copy local, once they were the server deployment worked without any installs or modifications to the server.

Using dotConnect with MVC5 Razor


What does this Italian soldier's 1930's uniform tell us about his job and rank?

Question: The below photo of a soldier was taken in Sicily in the mid to late 1930's. I have been told he may have served in Libya for the Italians.

What type of soldier was he and what rank did he have? What job would he have done?
Comment: Interesting, the collar badge is similar to [current infantry badges](https://wikivisually.com/wiki/File:Italian_Army_Collar_Patches.png) of the Italian Army - two thick stripes with a thin strips in the middle and a star. So it seems to be a unit designation rather than a rank
Comment: Two thick bars has, in Western European armies, been the insignia of a (army) Captain for a couple of hundred years. Don't confuse this with the (more senior) rank of Naval Captain, which is equivalent to an Army Colonel.
Answer: The collar badge specifically appears to be that of the Italian 17th Infantry "Acqui" Motorized Brigade.
An infantry unit named Acqui operated from 1831 to 1871, again from 1881 to 1926, from 1939 until its massacre by the Germans in 1943, and from 1948 until the present. Most recently, since a reorganization as of October 1, 1976,  it has been a motorized brigade.
Through the transformation of warfare and armies the Italians have retained the custom of "naming" the units which are, structurally, the largest homogenous size. This has varied over "Acqui"'s assorted revivals between regiment, battalion, division, to the current brigade structure that matches current NATO unit philosophy.
At a glance, the uniform "feels" more 1940's style to me than either "First World War" style or "post World War Two" style, but I am no expert.
Acknowledgement: @HorusKol for pointing out that the collar patch was a unit designation rather than of rank.
Answer: As mentioned, the collar tabs ("mostrine") denote the soldier's divisional affiliation, however the soldier may also have been affiliated with the 28th "Aosta", 20th "Friuli", 57th "Lombardia", or 54th "Napoli" divisions, as they all had very similar insignia. Without full color, it is impossible to know for certain.
We do know, however, that he was an infantryman. Specialized troops (medical, mountain, artillery, MVSN, etc.) had their own special collar tabs.
The tunic the man is wearing is a prewar model, given the black upper collar. This photo may be interwar or it could be very early war, as the M37 tunic (the last model with a black color until its replacement by the M40) could be found early on in the conflict.
Though the gentleman's specific rank cannot be determined (rank chevrons are just below the edge of the picture), he is at most an NCO, but likely enlisted.

What does this Italian soldier's 1930’s uniform tell us about his job and rank?


How to link user taxonomy-term to a list with all users with that term applied?

Question: So in my testcase you see, that there are some taxonomy terms applied to this user. However when one does click on a taxonomy term there appeares an empty view. Why are not all users with that taxonomy term listed?
Answer: First of all, I assume that the views module is installed and both the views and views_ui modules are enabled.
In the views admin page (/admin/structure/views), there is a view Taxonomy term. If you click edit to see the view settings, you will see that the view is only configured to show Content (i.e. nodes of a content type).
Off hand, I am not sure how to configure the Taxonomy term view to also show Users.  Anyway, I would not take this approach.
My suggestion is to:
Step 1) In the manage display screen for the User fields (/admin/config/people/accounts/display), set the display of your term field to Hidden.
Step 2) Add a new view page display that lists users associated with a term.  You need to use a Contextual filter on the term id (TID).
Step 3) Add a new view block display to lists terms associated with a User.  You need to use a Contextual filter on the user id (UID), so that only the terms related to the user are displayed. For the term field, Rewrite the output so that it is formatted as a link to the aforementioned view page (Step 2) and passing the TID as an argument.
Step 4) Display the view block on the user page such that it appears in a region below the user fields.
This is somewhat involved, but should work.
You may also want to take a look at the module https://www.drupal.org/project/taxonomy_display. This module may open up some other options.


How would I bulk change posting date?

Question: How would I bulk change posting date? I want to change about 20 post publish dates at a time in one click
Answer: Post date/time can't be changed via the Quick-Edit bulk editor. You might edit the SQL directly, if you're comfortable running a query in PHPMyAdmin. Or, you could search for a Plugin?
Answer: I just had a similar issue. I used this:
UPDATE `wp_posts`
SET post_date = "2008-02-13 23:50:30"
WHERE post_status = "publish"
AND post_date >=DATE_SUB(CURDATE(),Interval 5 day)

It is updating the wp_posts table and changing anything published in the last 5 days to the date of 2008-02-13.
Comment: You you mind making your answer WP compatible? `$wpdb->query`, `$wpdb->posts`, etc.?

How would I bulk change posting date?


Orthogonality of residuals in linear regression

Question: In multiple linear regression, I came across the statement that both $e$(residual) and predicted $y$ are projections of actual y and $e$ is orthogonal to predicted $y$.
I was trying to visualize the same for a simple linear regression. Doesn't this mean that the residual term should be perpendicular to the fitted line?
Comment: 'e is orthogonal to the predicted line' should read as "the error variable (vector) is uncorrelated with the prediction variable (vector)". This is apparent in visualizing regression in subject space: https://stats.stackexchange.com/a/192637/3277.
Answer: "$e$  is orthogonal to predicted $y$" is the orthogonal in the $n$ dimensional space, where $n$ is number of the observation. It is hard to visualize because of the high dimension. But it follows the general definition of orthogonal. $e'\hat y = 0$.   http://mathworld.wolfram.com/Orthogonal.html
Comment: ' It is hard to visualize because of the high dimension' - the op was about simple linear regression, not n dimensional. A simple plot would illustrate the case perfectly. In any case regressions create a linear combination to create a single y hat per sample, which again is simple to I illustrate in a 2d scatter plot
Comment: OK. Give a try to demonstrate the orthogonal in the 2d for simple regression. I am waiting for your graph.
Answer: Assumptions
The assumption underlying linear regression is that there is a true
underlying $x$ and $y$ relationship that allows you to predict $\hat{y}$, knowing $x$. In the absence of unmodelled variation we have the following relation:
$$\hat{y} = m x+c$$
However error can exist in the actual observations so the equation is rewritten in various forms depending on
how you describe the errors. If we are talking about residuals then we
specifically mean the variation that remains after the model described
variance is taken into account. So $\epsilon$ means that:
$$y_{obs} = mx + c + \epsilon$$
this means that the orthogonality is expected to exist between predicted
$\hat{y}$ and $\epsilon$. The nice thing about simulation is we can create ground
truth then perturb it in a controlled way then probe what happens
This formulation does not seek to untangle the variance arising due to
errors (or to be more precise, unmodelled variation) in $x$ or in $y$.
It is also important to distinguish what we observe from what the true underlying data generating process is:
$$ x_{obs} = x_{true} +\epsilon_x$$
$$ y_{obs} = y_{true} +\epsilon_y$$
Where $\epsilon_x \perp\!\!\!\perp \epsilon_y$ (if unaccounted variance is not independent between $x_{obs}$ and $y_{obs}$ then $y_{obs}$ will be a transformation of $x_{obs}$ rather than $x_{true}$)
Note:
since $mx+c=\hat{y}$ the difference between these two formulas gives
$$\epsilon = y_{obs}-\hat{y}$$
Methods
The following Matlab code was used to create simulated data which started with a ground truth to which was added variation not explained by the true model. This simulated observed data had variations ('errors') in both $x$ and $y$, which are propagated through the model building and prediction.
I.e. we model the situation where $x_{obs}= x_{true}+\epsilon_x$ and $y_{obs}= y_{true}+\epsilon_y$
with $y$ a linear transformation of $x$ and $\epsilon_x \perp\!\!\!\perp \epsilon_y$ allowing us to disentangle the contributions of $\epsilon_x$ and $\epsilon_y$ in a way that can't be done with real data:
<code>    % create the 'ground truth' - no sampling, technical nor measurement errors
modelTrue = [1.5, 0.5];
xTrue = 1:100;
yTrue = polyval(modelTrue , xTrue);

      % create variation not explained by the underlying linear relationship
xUnex = 0.1*(rand(1,100)-0.5);% 10% range of error, uniformly distributed
yUnex = 3*randn(1,100);% random noise with standard deviation of 3
      % Note that many other perturbations could be considered - varing the
      % distribution of noise, using a different transformation model etc.

      % create observed data
xobs = xTrue + xUnex ; %create the data that will actually be observed
yobs = yTrue + yUnex; %create y data that will actually be observed

modelobs =  polyfit(xobs,yobs,1);
ypred = polyval(modelobs,xobs);
EP = yobs -  ypred;
EPvsTrue = yTrue -  ypred;
</code>
Results
Here we see scatter plots of the different data sets (ground truth, observed and modelled). Note there is a noticeable change in slope (which will vary depending on randomisation) in the predicted data compared with the ground truth.

Next we look at the correlation between the $\epsilon$ and various parameters.
<code>      Xobs         XTrue       Yobs         Ypred        YTrue
    ___________    _______    ________    ___________    _______

    -6.3787e-15    0.31728    0.065877    -6.3897e-15    0.31728
</code>
There is no correlation between $\epsilon$ and observed $x_{obs}$ nor predicted $\hat{y}$. There is a weak correlation between $\epsilon$ and the $y_{obs}$, which is because $y_{obs}$ is a summation of $\hat{y}+\epsilon$, so the strength of the correlation will depend on the relative magnitudes of $\hat{y}$ and $\epsilon$. There is a stronger correlation between $\epsilon$ and the true values, due to the deviation of the slope in figure 1 from the ideal.
However, you are not interested in such a proof, this is merely a preamble to answering your question about visualisation.
Visualisation of what is orthogonal

Doesn't this mean that the residual term should be perpendicular to
the fitted line?

The 'fitted line' in linear regression typically can be one of two things depending on how you plot it ($x$ vs $y$ with a best fit, or $y_{obs}$ vs $\hat{y}$), but for neither is the orthogonality between the best fit line and the scatter. Linear regression does not attempt to unpackage $\epsilon_x$ and $\epsilon_y$ contributions to unmodeled variation, which would be needed to determine what angle the outcome error is to the true result. In predicted vs observed we have $y_{obs}$ which we saw above contains an explicit contribution from $\epsilon$, so cannot be orthogonal.
Instead we need to look specifically at the $\hat{y}$ and compare it with $y_{obs}$, as shown in the figure below. In addition to the classic $\hat{y}$ vs $y_{obs}$ plot I have included plots of $\hat{y}$ vs $\epsilon$ and  $\epsilon$ vs $y_{obs}$ along with their best fits in each direction:

You can see that for the $y_{obs}$ there is a slope evident in the trend between $y_{obs}$ vs $\epsilon$ (centre of x axis, blue line with slope of 1). Given our discussion above we would expect to see an interaction between these two. In contrast we see that there is no trend linking $\hat{y}$ and $\epsilon$, the two axis are parallel to the axes of the main plot and perpendicular to each other. this is the visual representation of the orthogonality of $\hat{y}$ and $\epsilon$.
Note on extension to higher dimensions
This same principle applies to higher dimension regression models as they all reduce the data to a $\hat{y}$ value. This means the prediction can be composed of multiple orthogonal components, but all $\epsilon$ is concerned with is what is left after your model is applied - so it doesn't matter how complicated your model was.
Comment: This answer would be better if you put on some hats to make clear difference between parameters and parameter estimates!
Comment: @kjetilbhalvorsen - Thanks for bringing this to my attention it was rather confusing and hard  to follow before. I have revised it and hopefully it has made it a bit easier to follow.


Contribution page just shows the shortcode on the Thank you page

Question: this is on civicrm 5.39.0 on wordpress 5.8.
I have a wordpress page https://bbsadev.douglasscloud.co.uk/payment-process-bacs/ with Contribution shortcode [civicrm component="contribution" id="2" mode="test" hijack="1"] inside (the Contribution uses 'Pay later option'). When I submit it and it goes to the thank you page - https://bbsadev.douglasscloud.co.uk/payment-process-bacs/?civiwp=CiviCRM&q=civicrm%2Fcontribute%2Ftransact&_qf_ThankYou_display=1&qfKey=CRMContributeControllerContribution63et55wzn1oogc0ws0wgsosswk8sgo44kgs0kow0co404004w0_6128 - it just shows the shortcode (see the screenshots). This happened since I've updated civicrm from 5.29.0 -> 5.39.0 on wordpress.
Comment: the new thing seems to be CRMContributeControllerContribution in the &qfKey= in the 'thank you' url.
Comment: Hmm, that `qfKey` doesn't look right to me. Anything in your logs?
Answer: This is a regression, that came with 5.39.0 and breaks the civicrm interaction pages in some situations.
See: https://lab.civicrm.org/dev/wordpress/-/issues/107
The good news: The problem is solved with CiviCRM 5.40.1
Good luck!
Detlev


3-level hierarchical model and ferquentist approach

Question: Could I use maximum likelihood method or any other frequenist method to estimate parameters for 3-level hierarchical model?
Is there any references help me in this case?
Thank you
Comment: What's the problem? You mean in theory? Or in practice? Did you try anything?
Comment: I mean in practice. Yes I tried to use the maximum likelihood to estimate the parameters in the first level, then I use these estimates as data and I use it  to estimate parameters in second level ( I use rma function from metafor package in r), then I consider estimates  from second level as data and I use it to estimate parameters in third level also by using rma function.
Answer: You can fit a mixed model with three levels, or more, with lme4. There's not a lot mentioned in their vignette. You need the : operator. Here is a link to a tutorial: http://rpsychologist.com/r-guide-longitudinal-lme-lmer.
Comment: Thank you, I am going to look at this tutorial and I hope that will help me.


Is an employer legally required to allow an employee to work remotely if a precedent has been set?

Question: I work in Washington D.C. for the government and travel 3 hours to and from work daily. Once I give birth, I don't want to go in everyday, maybe 1 or 2 times a week and work remotely the other days. Another lady with the same position I have is being allowed to work remotely after she gave birth. We both work for the same employer but have different bosses but I have been there much longer than she has. I currently work remotely when the weather prohibits travel. Are there any labor laws that reference this issue?
Answer: If you are working in the executive branch, the Office of Personnel Management says that there is no right to telecommute: "Telework is not a universal employee benefit or an employee right.  Federal law requires agencies to establish telework programs but does not give individual employees a legal right to telework". A manager can deny a request, but

Denials should be based on the requirements of the Telework
  Enhancement Act, individual agency telework policies, applicable
  collective bargaining agreements, and the business and operational
  needs of the organization...Decisions to deny a request to telework should be based on sound business management principles and not for personal reasons.

This webpage lists all of the requirements under that law. Basically, the boss can't arbitrarily deny your request, but it can be denied if it doesn't meet the requirements: you can ask your Telework Managing Officer.
Those rules apply to the executive branch, so if you work for another branch, the rules could be different. Emlpoyees of the House of Representatives should look here (basically summed up in the statement "Telecommuting is entirely at the discretion of the employing office"), and they speak in permissive terms that favor employer discretion (the office may consider...). So it matters exactly who you're working for, and what you do.
There are no general labor laws that say "if you give one employee a benefit, you have to give it to all". It would be illegal to make the decision on the basis of race, religion etc. but otherwise employment is at-will.


Deploy Java EE Project in Weblogic

Question: I have WebLogic installed in my computer. I already added it as a server in my Eclipse IDE. How do I configure my Web application to run or for it to be deployed on the WebLogic server. I found a sample project and found a weblogic.xml in it. Where do I start? Do I need to add something, etc.
Answer: If your web application is already a "Dynamic Web Application", then you should be able to deploy it just by right clicking on it, then Run As > Run on Server and choose the WebLogic Server runtime.
If this doesn't work, maybe you need to add the right facet to your project. Right click on your project and go to Properties > Project Facets and check that Dynamic Web Module is checked.
If this still doesn't work, maybe recreate a "Dynamic Web Application" from scratch and move (or copy) your sources to this newly created project.
Many tutorials are actually available at the WTP Community Resources page. See for example Using the Eclipse Web Tools Platform with Apache Tomcat. It is not specific to WebLogic but if you already have it setup in Eclipse, it should be easy to adapt the specific parts.
PS: It's hard to say anything about your sample project and the weblogic.xml as you didn't provide any detail about them. Maybe try to follow the advices above and, if you still have problems, update your question with more information.
Answer: There are a number of resources on using Eclipse with WebLogic, including Oracl'es Enterprise Pack for Eclipse.  It's hard to tell without more information, but you need a WebLogic Domain configured with at least an Admin Server to deploy the web application to.  When doing local development, it's acceptable to deploy applications to the Admin Server, but beyond this you typically want an Admin Server and a managed server where the application will get deployed to.
Here's some info on Eclipse and WebLogic - http://www.oracle.com/technetwork/developer-tools/eclipse/learnmore/index.html
Comment: Direct unambiguous link: http://www.oracle.com/technetwork/articles/javaee/marx-oepe-spring-095718.html
Answer: Question is missing much details. You can find some detailed help here
http://download-llnw.oracle.com/docs/cd/E13222_01/wls/docs90/deployment/index.html

Deploy Java EE Project in Weblogic


The em dash, and correct usage in the sentence that follows

Question: As I walked through the channel — I knew it was over.
Is this a correct usage of the em dash?
Comment: That -- is two hyphens. This — is an em dash. There is a [punctuation guide](https://en.oxforddictionaries.com/grammar/punctuation) published by The Oxford Dictionaries, part of which is their [Em dash guide](https://en.oxforddictionaries.com/grammar/dash-and-em-dash).
Comment: No.  IMO, that sentence requires an ordinary comma.
Comment: Usually an em dash signifies an abrupt or drastic change in the direction of a sentence. I don't think this sentence qualifies.The independent clause,"I knew it was over," seems to flow naturally from the dependent clause. "As I walked through the channel." For example, "As I walked through the channel--hell, it's all a lie. There was no channel."
Comment: No dash and no comma.
Answer: No. You can use a dash to connect two clauses that aren't complete sentences, but in this case where the second clause flows naturally from the first one, you would be better served using a comma. Dashes are usually used to indicate a change in tone or direction (often to a facetious or informal one).

After three weeks on set, the cast was fed up with his direction — or, rather, lack of direction.

If you're using a dash instead of a comma because you feel that a comma wouldn't give the second clause enough weight, you'll probably need to change your wording. Something like this could work:

As I walked through the channel, I realized I had to give up. It was over.


A question about cardinal numbers in ZF set theory.

Question: It is well known that cardinal numbers and the relations between them can be defined in ZF set theory (using the notion of "rank"), without the need of additional axioms. Can the following statement be proved from just the axioms of $\sf ZF$? " Let $k,\ell$ be cardinal numbers and let $k<\ell$. If $A$ is any set whose cardinal number is $k$, then there always exists a set $B$ whose cardinal number is $\ell$ and which contains $A$ as a subset".
Comment: This is borderline [axiom-of-choice]. If someone else thinks that this should be tagged as such, please make that edit. I'm still not sure.
Answer: Yes.
By the assumption that $k<\ell$ we essentially say that if $A$ is such that $|A|=k$ and $B'$ such that $|B'|=\ell$, then there is an injective function from $A$ into $B'$ (and there is no bijection between them, in this case). We can also assume that $A$ and $B'$ are disjoint, otherwise we replace $B'$ by $B'\times\{A\}$.
Fix any $f\colon A\to B'$ such injection, then the range of $f$, $A'=\{f(a)\mid a\in A\}$ is a subset of $B'$ and $f\colon A\to A'$ is a bijection. Define now $B=(B'\setminus A')\cup A$. It is easy to see why $|B|=\ell$ as well, and of course $A\subseteq B$.
Comment: @Nate: That depends. Are you assuming the axiom of choice? If not, then the answer is consistently no.
Comment: When $\ell$ is infinite, $B = B' \cup A$ would work just as well, yes?
Comment: Oh right, I need AC for that!
Comment: @ Asaf Karaglia: Very nice. I could see how to prove that the answer was "YES" in the case that k and l were Alephs, but not in the more general case.
Comment: Although this proof works for most cases, there seems to be a problem if $B'\setminus A'$ and $A$ aren't disjoint.  the work-around is, of course, to replace the original $B'$ with one that is disjoint from $A$.
Comment: @Andreas: Thanks. Small detail, but important.


Is it possible to use standard RAM with CPUs for registered ones?

Question: According to this Wikipedia article for example the AMD Opteron 2389 is designed for registered DDR2 RAM (see the list at the beginning of the list of CPUs).
My question is now: Can I also use classic RAM or does it have to be registered RAM?
Answer: Physically, registered and un-buffered (not fully-buffered) DIMMs have the same physical connections and operate in the same manner, although you may experience hardware issues (memory errors).  The idea of registered RAM is to provide a memory signal "buffer" (which usually takes 1 clock cycle extra) to drive the output from the memory (instead of directly using the output).  This allows for systems to, potentially, increase the maximum memory frequency & capacity, but at the expense of a higher memory latency (as all reads/writes are buffered through an additional set of registers).
This "buffer" is a physical piece of hardware, so it really depends on if your particular motherboard or CPU requires it for proper operation.  The CPU itself does have an integrated memory controller, although I see no explicit requirement for registered memory except if you already have some (you may experience timing issues if you try to combine unbuffered and registered RAM modules).  The thing is, it depends on your particular hardware (especially how many DIMMs you have).
If indeed the hardware runs with unregistered memory, although you experience memory errors, you should be able to increase your RAM latency, or decrease the memory frequency, to prevent these memory errors from occurring.
Answer: May be AMD Opteron 2389 will give better performance with registered DDR2, but whether you can use standard ram or not is more dependent upon the desktop board you will use with it. The board specification will tell you as to which Ram you can use.
In many cases you have the option of using both.
Comment: Registered RAM modules typically have lower performance than their unbuffered counterparts, since the memory data has to go through another bank of registers before reaching the CPU (increasing latency).


is there a modifier that can smooth geometry but keep boundary vertices position unchanged

Question: Is there an modifier that can smooth out vertices while preventing its boundary vertices from moving?
What I am searching for is basically smooth modifier but with "Pin Boundaries" functionality of smooth corrective modifier.
If there is no such modifier is it possible to somehow create this functionality in geometry node?
I hope this makes sense. Thanks in advance.
Comment: https://www.youtube.com/watch?v=zp9_KqGJNrk Maybe this is what you're looking for?
Comment: thanks for helping, but what I am looking for is a modifier, not operator/ python script/ sculpt mode tools.
Answer: You can use a Corrective Smooth modifier with "pin boundaries" and "only smooth" enabled.  There's nothing that's really "corrective" about the modifier at that point.
Alternatively, you can create a vertex group to specify which vertices you'd like to smooth, and then designate that modifier in the vertex group field of a Smooth modifier.  So you could, for example, assign all vertices except boundary vertices to that vertex group.  (Or, assign boundary vertices, and then click the "invert" button to the right of the modifier's VG field.)
You can quickly select boundary verts via "select non-manifold" operation in edit mode, so marking verts with VGs is a perfectly reasonable way to handle this.


Mounting Hard Drive

Question: I am new to Ubuntu...I am using a computer with a locked hard drive.  The computer was running WIN 8 and was inherited from a friend who passed on so we do not know his password.   When I am in Ubuntu and click on the drive, I get an error message that the NTFS partition is in an unstable state and I should shutdown Windows fully with no hibernation or fast restarting but there is no way for me to get into the system since I do not know the password. If I want to see the hard drive, can I mount it in read only or if it is password protected will it not let me do this?  Also, if I mount it in read only, will that affect the drive in a bad way?
Comment: You can also change your friend's password, if you want ....
Answer: You can mount the drive read only.
No side effects as far as I know, because disk content won't change.
To mount read only: sudo mount -o ro /dev/sdbX /media/somedir
sdbX is the drive partition.
For more information check this question.

Mounting Hard Drive


DNS Rebinding attack - does this attack require victim to use an attacker's DNS server for resolution? How will that happen?

Question: Usually a preferred DNS server will be set in router's configuration and it will be either the organization's server or some trusted public server. So how would attacker get the victim to use his DNS server to resolve its domain name?
Answer: The victim does not need to use the attackers name server, although this can make things easier. The main idea is, that the original DNS record is under the attackers control and thus also the TTL (time to live) of this record:

Victim tries to access web site. To get the address it asks the companies DNS server. Because the record is not cached yet the DNS server recursively resolves the name and returns the record (from the attackers DNS server) to the victim.
If the victim needs to look up the IP address again (which can often be triggered by connection failures on the first IP) it will again ask the companies DNS server. If the record is cached the TTL gets checked. If the record is still valid it will be returned to the victim (with the old address). If it is not valid the companies DNS server will again recursively resolve the name and at the end get the new record from the attackers DNS server.

Another option would be for the attacker to return an answer which contains already both IP addresses (the good and the bad one). The victim will first use the good address. Once this stops working (which can be triggered by the attacker) the victim will retry with the alternative (bad) IP address.
Comment: Since DNS pinning [would cause security flaws](http://security.stackexchange.com/questions/14038/does-dns-pinning-protect-against-all-dns-rebinding-attack/14039#comment140753_14039), How can we prevent DNS Rebinding attacks?
Comment: @Pacerier:  I don't think that DNS pinning itself is a security flaw (even after reading the link you provided). But DNS pinning can often be easily circumvented by simply not responding to the original IP in which case most browsers to another DNS lookup. Anyway: DNS pinning is a problem which needs to be fixed on the server side by checking the HTTP-Host header provided by the client and only accepting requests where the host header points to a name served by the server.


How do I adjust my brakes if my truck wants to pull to the right everytime I drive it?

Question: My truck is a 1984 toyota 4x4 and it has been wheeled to the extreme and rolled and been through hell and back but everytime I go to press on the brakes the truck wants to pull to the right. My dad says I have to adjust the brakes but I dont know how to do that.
Answer: Firstly you need to make sure the brakes are all in good condition. Are they discs or drums? If they are drums, are they manually adjustable or automatic?
Pulling to the right usually means the ones on the left aren't working properly, but if you do anything to them you need to do the same to both sides - otherwise you'll just find it pulls left instead!
Unfortunately, being a 4x4, you can't put it on a brake tester, but you can get a reasonable idea - jack the truck up and support it on axle stands. Turn each wheel and see how they feel - both sides should spin freely. Then get an assistant to press the brake pedal and try again - you shouldn't be able to spin them by hand.
Check the flexi hoses, and if in doubt, replace them. If it's discs, check the condition of the calipers, check that the sliders slide freely, and check or replace discs and pads. If it's drums, check or replace the cylinders and shoes, and clean up and check the adjuster mechanisms and springs.
Brakes are the most important thing on your vehicle, so if in doubt, consult a professional.
Comment: It is in some cases a myth that 4x4 vehicles cannot be tested on brake dynamometer. Where I live (Finland), Toyota has said that all 4x4 models officially sold here can be tested with a brake dynamometer provided speed is below 5.5 km/h.
Comment: thanks that'll work. I did it last night and it was perfect. @Nick C
Comment: @juhist don't make that assumption for all 4x4 - some, in fact many, don't have a slipping 3rd differential and will leap off the brake dyno - think old landrovers with selectable 4x4.


Is is possible to travel when applying for a new visa?

Question: I am Bangladeshi currently in France applying for a Spanish visa. The visa office will hold the passport for few days. Is it possible to travel during this time?
Comment: You're asking if you can travel internationally without your passport? Unless you hold more than 1 travel document (like 2 passports from different nationalities) I don't see how this could be possible.
Comment: Yes or the other way why they generally holds the passport while issuing a visa? No I have only one passport. I think I have got the answer..
Comment: Why are you applying for a Spanish visa if you are in France?  They are both in the Schengen area.  What visa do you have for France?
Comment: I have Schengen visa but they are saying for an internship in Spain I will need another visa
Comment: Some countries will issue you another passport. You might be able to get another Bengladeshi passport, but even that will take a while and by the time you manage to get one you'd probably have your original passport back.
Comment: Thanks for the comments. But they didn't hold my passport, they returned my passport and said I need to bring it back when they will give the visa.
Answer: Travelling internationally without any travel document is between very difficult and impossible depending on the details. If you need to leave the Schengen area and re-enter, you definitely need a passport. You would in all likelihood be refused boarding by the airline or blocked from leaving the Schengen area by the border guards.
If you are travelling within the Schengen area and have a residence card, it might still be possible in practice even if it's not explicitly allowed. If you have nothing at all, you would probably still be able to physically cross the border but could get in serious trouble if you are found in another country with no document establishing your status.
Even travelling in France is not without risk. Technically, you are supposed to be able to prove you are in France legally (i.e. show your visa) at any time if the police asks. If you don't have your passport on you, they could detain you for some time to check your status.
Obviously, the requirement to surrender your passport for a visa application puts you in an awkward situation but there is no easy way around that.
Comment: Thanks for the answer. But they didn't hold my passport, they returned my passport and said I need to bring it when they will issue the visa.
Comment: @eagleye That's good news. You might want to post that as answer and accept it instead of mine!
Comment: The didn't hold the passport that's another case. If they would hold the passport then your answer is valid, right?


Does /var/spool/mail/user ever get cleared?

Question: I have a crontab task running every 5 minutes. It writes an output (result of the .sh file run by the crontab) to the /var/spool/mail/user. Should I be worried that this spooler will build up and slow down the system over time? Do these entries ever get cleared out? Are they only temporary? If possible, can I disable it.
Comment: This is a question about what it takes to program safely on Unix.  It is on topic for SO.
Comment: I hope the output written by the crontab task is formatted as a valid e-mail message.  If it isn't, you're messing up the user's e-mail inbox.
Answer: The messages stay there until the user whose mail it is reads and deletes the mail.  That might be years later (I kid you not!).

No, the directory is not cleared out by anything.
Yes, you need to be worried about the problem of filling up your disk with unread email.
Comment: A possible solution might be to forward your mail to some email address that you really are reading. Another would be to redirect in your `crontab` the *stdout* & *stderr* outputs. If they are redirected or empty, `crond` won't send any email.
Comment: To send the email to another email address in your crontab edit it and add a line similar to this: email@example.com
Answer: The contents of the /var/spool/mail/user directory remain until the user deletes the mail. You may wish to install a script that runs via cron to remove files older than a certain date, and tweak this as you monitor your system.
Comment: Don't do this without notifying your users well in advance.  I would consider an automated script that deletes my e-mail to be hostile.
Answer: I added this line to crontab to my user root:
<code>* */2 * * * /bin/su - root -c cat/dev/null > /var/spool/mail/root
</code>
So every 2 hours, it is cleaned for that specific user (root).
Comment: That schedule doesn't do what you think it does, and there's no need to `su` to `root` if you're already running as `root`.


If a lease is scanned with the landlords signature on it, is it valid?

Question: I intend to move into a rental home and the landlord filled out the lease and signed it, then scanned it and emailed it to me. Is the lease valid? Does it become valid as soon as I print it and sign it?
Answer: Does this demonstrate the landlord wishes to be legally bound?
Yes
Therefore it is valid.
Comment: Under what types of circumstances does a lease or contract have to be in hard, origial copy to be valid?  Why do some such documents require a notary's signature also?
Comment: @dalem thanks for clearing that up. I was confused because what is it about fax machines that make them special in the law if scanners can be used for legally binding documents?
Comment: @user3270 I think its just extra evidence. Indeed, I have heard that a verbal agreement can count, if you can prove it. (Signed contracts with notary's are easier to prove though).
Comment: @PyRulez Certain kinds of contract require witnesses and/or notarization; a number of kinds of contract have to be in writing.
Answer: When you're walking into civil court, any paper signed by some third party must have some kind of attestation.  i.e. it should be notarized or witnessed by some recognized authority.  A faxcimile of that is typically acceptable...i.e. the original document is good to have, but if everyone agrees that the copy is of a valid attested document, then it's all good.
The practices of the courts are in transition with this, as we move into a paperless society.


Why is $\frac{ab}{c}=\frac{a}{c}b$

Question: Simple question. Why is the following true?
$$\frac{ab}{c}=\frac{a}{c}b$$
Comment: $b=\frac{b}{1}$
Comment: What are $a,b,c$? Please clarify your question with an [edit].
Answer: Using the basic properties of fractions: $$\frac{ab}{c} = \frac{a\cdot b}{c\cdot1} = \frac{a}c\cdot\frac{b}1=\frac{a}{c}\cdot b$$
Answer: Dividing by $1$ does not change a number, so $b=\frac b1$
When multiplying two fractions, simply multiply the numerators and multiply the denominators.
So
$$\frac acb=\frac ac\frac b1=\frac{a\times b}{c\times1}=\frac{ab}c$$
Answer: If you rearrange the equality to this:
${\frac{ab}{c}} = {\frac{a}{c}} * {\frac{b}{1}}$
You can see why this equality works. You multiply the a and b getting you ab, and multiply c and 1 to get c. Thus, the equation works.
Answer: It's just a property of fractions
$$\frac{ab}{c}=\frac{a\cdot b}{c}=\frac{a}{c}\cdot b=\frac ac b$$
Answer: I am adding another only because it would be nice to see a proof using basic axioms.  Let us assume $a, b, c$ belong to a field.  In a field multiplication is associative and commutative and each non-zero element $y$ has a multiplicative inverse $y^{-1}$'  Division, $x/y$, is then defined to be $x y^{-1} $.
In this case, then, assuming $c \neq 0$, \begin{align}
 \frac{ab}{c} &\equiv (ab)c^{-1} & \text{definition of division}\\
&= a(bc^{-1}) & \text{multiplication is associative} \\
&= a(c^{-1}b) & \text{multiplication is commutative} \\
&= (ac^{-1}) b & \text{multiplication is associative, again} \\
&=\frac{a}{c} b & \text{definition of division}
\end{align}

Why is $\frac{ab}{c}=\frac{a}{c}b$


Need help in codon optimization

Question: I want to chemically synthesize a GFP gene for expressing in rice.I am using the IDT Codon Optimization program and found that not all the codons are 100% optimized. Some of them are the 2nd or 3rd in frequency of usage. Also, the stop codon in the gene optimized is the least used in rice. I don't think all the codons can be the ones that are the most used in rice as there is need of translational pauses to get optimal protein expression. But how do I decide which codons are to be used in what positions to get maximum efficiency. Do I just use the automatic codon optimized gene given by IDT or further optimize it manually?
So should the stop codon used be the one which is the most frequently used in rice for proper mRNA termination?
Please help me as I am new to this and want tips and suggestions for getting optimized codons in this gene.
Answer: Generally the codon optimization is the most frequent tRNA found in your species of interest. However, your codon must not result in something that disrupts standard molecular biology practices. For instance, if your codon places a restriction site in a unique cloning vector, then the algorithm will just look for the next best codon which does not cause unwanted addition or elimination of a cloning site. Places like IDT will also weigh the cost of the codon vs. the ease of manufacturing in their algorithm (see here.)
What you describe as translational pausing that is 'needed' by the organism to optimize proper gene expression is a consequence and not a necessity of infrequent codons (to my full understanding). See here. That means you don't want to add this translational pausing in optimized gene expression. It is a simply an evolutionary byproduct.
Edit -
To answer your question more bluntly, I can tell you with some experience to trust the codon optimization algorithms from biotech companies like IDT. I find they work very well. Rice is a common enough organism :)
Answer: The optimization done by service providers like IDT should be fine because they weigh in multiple factors like avoiding mRNA secondary structures and specified restriction endonucleases. Even I was considering manual editing but then some research on the internet revealed that codon usage is not the only factor involved :)
Comment: This is not an answer to the question.
Comment: @WYSIWYG Why not? It seems to be poorly supported, but it does seem to answer the question.

Need help in codon optimization


Need help meshing 2 JQuery Form Plugin's functionalities together

Question: Let me preface this by saying, I am not a programmer.  So bear with me...my inquiries might sound a little "duh" for the programming masters out there.  Anyway, I am trying to mesh the functionality of two JQuery scripts together.  One script hides parts of the form (in divs) until the user selects from a dropdown the category they want. When the user selects something, the div associated with the selection shows itself. The other script allows the user to add / remove (or in other words clone) the same piece of the form again.  Meanwhile, I would like the the initial dropdown cloned too, allowing the user to pick another or the same category again, and add / remove the piece of the form associated with the category they select.
Its kind of like a store with 3 product categories.  A customer comes in and wants to get a quote for a wide variety of product possibilities from 1 or all 3 product categories all in one inquiry.
So for example, a user selects from the initial dropdown "category_1." The form snippet associated with category 1 shows up and the user fills it in.  The user "adds in" another product, cloning the same form snippet that gets filled out again. Below all of this, the initial dropdown is also cloned and they can pick from lets say "category_2."  The form snippet associated with category 2 shows up, and the user can fill it in and "add in" another category 2 product form snippet, just like they did with category 1.
I hope this made sense.  Anyway, the scripts work fine by themselves.  Its when I use them together, is where I am having problems.
Here is the first script I am using.

Here is the second script.  I got it from here: http://vipullimbachiya.com/?p=209.  It uses a separate .js file.  The script below activates it.

This is my basic markup.
<form>

       <select id="thechoices">
           <option value="category_1">Category 1</option>
           <option value="category_2">Category 2</option>
           <option value="category_3">Category 3</option>
       </select>

Box 1 stuff...

Box 2 stuff...

Box 3 stuff...

</form>

The problem is that the first script works.  It hides and unhides the form snippets according to what is selected in the initial drop down.  What does not work is the ability to clone the form snippet and the initial dropdown so that the user can do another inquiry for another product.  I know I am missing something big here, but I am not knowledgeable enough to know where to look or how to go about solving it.  I greatly appreciate any insight that can be given to me on this problem.
Answer: It if helps, the form I am actually using this stuff on is here:
www.pentco.com/form.php.
Thanks.


Connecting at Newark from International to Domestic on United Air for arrival

Question: I am arriving from an international flight on United Air. The connection time is 1H 30 M at Newark. I've never done it this way, so I'd like to know if the connection time is enough.  I will arrive in Newark at 11:45 am (Monday)from Europe. My next flight to Chicago departs at 1:15 pm. I have two checked bags. I have global entry. Another option for me is to get the next flight to Chicago at 3:07, which means the connection time is 3H 22M and seems a little long. But if 1H30M is insufficient for connection at EWR, I can change it to the later one. Your input will be greatly appreciated!
Comment: I think just over 3 hours is not long for an international to domestic connection, I would suggest a longer one myself.
Comment: Is that on a single ticket?
Comment: That's likely to be cutting it a bit fine. It depends how bothered you are about your luggage arriving with you. If it's on a single ticket, you have a bit more protection in terms of missing the first flight, and you'll get there eventually, but as for the transit time, things like weather and whether it overlaps with vacation times will also have an effect.
Comment: @StuartF "luggage arriving with you" isn't at play here - unless you're suggesting they might want to skip collecting their luggage which is a really bad idea (at a minimum, it'll result in customs going through your bags - standard procedure for international bags that have been deliberately abandoned by a passenger)
Comment: Nicolas, Stuart, Doc, and Willeke - thank you so much for all your comments. Very helpful.
Answer: If you literally have 90 minutes from arrival to departure then I think that's tight - you need to be at the departure gate perhaps 20 minutes before departure. If this is on a single ticket then your airline think it feasible, possibly because they anticipate early arrival. See : my question here
With Global Entry you can get to the baggage hall quickly, however you must wait for your bags and then take them through customs to the drop-off, this
doesn't take as long as normal checkin but still adds time, and is vulnerable to delays.
One big potential time consumer then is that you need to clear security again back into your Domestic Terminal. At Newark I've experienced some quite lengthy queue for that. Further, you may also need to get the monorail between terminals.
Personally, even though I'm guessing it's possible to make such connections I try hard to avoid them.
Comment: Thank you so much!! This is very helpful!
Comment: While in the specific case of OP which has Global Entry Hilmar's answer is probably more accurate, this one is good for other users for which it's possible but could be tight. It's worth pointing out that it's possible for flight on the same ticket but definitely not on separate tickets, and that on the same ticket, if delays make the connection impossible the airline has to rebook the passenger on the next available flight.
Answer: I assume this is all booked on ONE single ticket, otherwise this answer is useless

The connection time is 1H 30 M at Newark.

With global entry (GE), that should not be a problem unless there is major delay or they lose one of your bags. Clearing immigration with GE takes only a minute or so. You will have to wait for your bags but that should not take more than half an hour.  You can recheck the bags right after customs and head to your departure gate and terminal (which may require taking the air train). At your terminal you need to clear security again but GE should also give your TSA PreCheck and this is usually quite quick as well.

But if 1H30M is insufficient for connection at EWR, I can change it to the later one.

No need. If you miss the connection (due to no fault of your own) United will automatically book you on the next flight. You can keep your short connection and just use the long one if needed. The only risk here is that the next connection might be 100% sold out, but that's quite rare.
Comment: Thank you so much!!  This is booked on one single ticket on United :)  My main airport is O'Hare and it takes only a minute to go through immigration too! I have a priority service with bags and typically I don't need to wait too long for bags, and hope it will work that way at Newark. I am just not familiar with Newark, and this is very helpful. Thanks!!


Do I need an amplifier to play Epiphone ES 339 Pro?

Question: Can a semi hollow guitar produce sufficient sound without an amp for personal practice? I am planning to invest in a good guitar for my wife and I am confused about this guitar. Epiphone ES 339 Pro seems to be a good guitar with a lot of potential, and she loves it. Please suggest.
Answer: It would be possible to practice without an amp on a semi-hollow body guitar; I used to practice on an unamplified (solid body) Stratocaster when I needed to be quiet.
That said, this is not the right way to practice. Practice with an electric guitar should be done with an amp, since this is the sound produced by the instrument. Extraneous noises, such as string squeak and unmuted strings, are more noticeable with an amp, and the player needs practice to control these.
If volume is an issue, I would suggest headphones.
Answer: I have a Gibson ES-137 and it produces a surprisingly loud sound when played without an amp - I have certainly practised playing on it without using my amp (particularly when my 4 month old son is sleeping in an adjacent room!). Not as loud as a proper acoustic guitar but definitely louder than a solid body electric guitar.
My advice would be to find a guitar shop that has an Epiphone ES-339 and actually let your wife play it to see whether she is happy with the un-amplified volume for practising purposes.
You could also look at getting something like this - a guitar headphone amp, that plugs into the guitar and then allows you to plug your headphones straight into it. Portable and it won't disturb people if that is your concern.
Answer: I had a Gibson 355. You could hear it, but it wasn't a particularly pleasant sound unplugged and you had to pluck harder, which is not necessarily good for right hand technique.
Answer: Yes, it makes quite enough sound for practice.  Choose this instrument over a solid electric or full acoustic for how it behaves WITH an amp though.


Issue with Ajax on Jquery Dialog

Question: I have a Jquery.Dialog which i use to send messages in my application. When the user clicks "new", the dialog pops up and allows the user to select who they'd like to message (as of right now, its working with IDs rather than usernames).
When i open the dialog for the first time, everything works fine. Im able to select the recipient by either typing the ID or looking through it on a "search form" that opens on a second dialog. All of this works fine while opening for the first time before a page refresh. The ID field has an Ajax function on the "onchange" event that validates that the user ID exists on my database AND enables the "send" button (disabled by default to prevent users from sending messages with a "recipient ID" of null.
The problem is that, if i close the message dialog and reopen it (without refreshing the page) the Ajax functionality (mentioned above) doesnt work anymore. For it to get to work again i have to refresh the page.
"Inspect Element" is not showing any javascript errors, so i really dont know what could be causing this. Im clearing the dialog before opening with the following line:
$(document.getElementById("msgdialog").innerHTML= " ");

But nothing. Below i will post some code to give you an idea of what im doing:
Dialog
$(document.getElementById("msgdialog").innerHTML= " ");
$("<%= escape_javascript(render "newmessages") %>").appendTo("#msgdialog");
$( "#msgdialog" ).dialog(
   {
 hide: 'fold',
 show: 'blind',
 modal: true,
 resizable: false,
 padding: 0,
 margin: 0,
 height: 'auto',
 width: 'auto',
 title: 'Message',
     stack: true
    }
  );

Inside the dialog there's a form_for with fields as (ID, Name, Subject and Message) and a "send" button which is disabled by default and gets enabled by the ajax request.
Here's the ajax request that happens on the "onChange" event of the form's ID field:

Issue with Ajax on Jquery Dialog