I want to override operator+ for my classes Fridge and TV (to make it add power consumption), so I made them extend Rtv class which should override that operator, however I don't know how to get proper POWER_CONSUMPTION field value if both Fridge and TV have different overriden value. To be more precise i want to achieve this to be possible:   Fridge fridge = new Fridge();   Tv tv = new Tv();   int totalPowerConsumptionOfFridgeAndTv = fridge + tv;  My idea for Rtv class was:   class Rtv {     private const int pOWER_CONSUMPTION= 0;      public static int POWER_CONSUMPTION=> pOWER_CONSUMPTION;      public static int operator+ (Rtv a, Rtv b)     {          return a.GetType().POWER_CONSUMPTION + b.POWER_CONSUMPTION;     } }  But simply doesn't work.

So this seems pretty basic but I can't get it to work.  I have an Object, and I am using reflection to get to it's public properties.  One of these properties is static and I'm having no luck getting to it.  Public Function GetProp(ByRef obj As Object, ByVal propName as String) as PropertyInfo     Return obj.GetType.GetProperty(propName)  End Function   The above code works fine for Public Instance properties, which up until now is all that I have needed.  Supposedly I can use BindingFlags to request other types of properties (private, static), but I can't seem to find the right combination.  Public Function GetProp(ByRef obj As Object, ByVal propName as String) as PropertyInfo     Return obj.GetType.GetProperty(propName, Reflection.BindingFlags.Static Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.Public)  End Function   But still, requesting any Static members return nothing.  .NET reflector can see the static properties just fine, so clearly I am missing something here.


I'm trying to find out how memory is arranged in dual channel mode, i.e. which memory addresses are on which DIMM. What I have currently found out is that there are two modes "ganged" and "unganged" and that there is little difference between them performance-wise. With ganged mode I understood that each 128-bit word is split in a two 64 bit words, and those are combined when read / written using two channels at the same time. That would mean that for every 128 bits one would probably contain the lower 64 bits (/8 bytes) and the other the higher 64 bits. So byte addresses 0-7 are on one DIMM, and the next 8-15 are on the other. Is this correct? What's entirely unclear to me is how memory is arranged in "unganged" mode. Is the memory still spread over the two modules using "sectors" of a specific size? Or is another scheme used? Do these arrangements differ per processor or is this kind of operation standardized somewhere?

I recently upgraded a machine from an AMD X2 CPU to an AMD Phenom X4 and notice options for toggling ganged vs unganged for the DDR2 memory on that machine.   Can someone explain what the difference is between the two?  Which setting is most suitable for a general purpose file/app/db server?


I have a C program which produces the error message:     p3-static-store-class.c:5:1 warning: return type defaults to 'int' [-        Wimplicit-int] main()   with warning highlighted and a arrow highlighting the m in main(). The code is:    #include <stdio.h> /* function declaration */ void func(void); static int count = 5; /* global variable */ main() {     while(count--)     {         func();     }     return 0; }  /* function definition */ void func(void) {     static int i = 5; /* local static variable */     i++;     printf("i is %d and count is %d\n", i, count); }   My attempt at specifying the return type produced a list of error messages, and C syntax is nothing like what I'm used to - so what is the remedy for this?

What is the correct (most efficient) way to define the main() function in C and C++ — int main() or void main() — and why? And how about the arguments? If int main() then return 1 or return 0?  There are numerous duplicates of this question, including:       — For C++, with a very good answer indeed.     Related:


I'm looking for a couple of function that works in a similar fashion of srand(unsigned int) and rand(void) but, with a variable range instead of a fixed one.  I don't like the script  srand(time(NULL)); random_number = rand() % (h_limit - l_limit) + l_limit;   for two reasons. The first one is that a number can be repeated. The second one is that, for large limits, the probability density function is not a costant.  I think that a good solution could be redefine RAND_MAX that is the upper limit of classical functions. Is this a good way to solve my problem or there might be problems? Have you a better way to proceed?

I need to generate random numbers within a specified interval, [max;min].  Also, the random numbers should be uniformly distributed over the interval, not located to a particular point.  Currenly I am generating as:  for(int i=0; i<6; i++) {     DWORD random = rand()%(max-min+1) + min; }   From my tests, random numbers are generated around one point only.  Example min = 3604607; max = 7654607;   Random numbers generated:  3631594 3609293 3630000 3628441 3636376 3621404   From answers below: OK, RAND_MAX is 32767. I am on C++ Windows platform. Is there any other method to generate random numbers with a uniform distribution?


I want to set up a main class that pass a string to another class from the prompt dialog on Eclipse.  So I set up a Program argument on "Run Configurations" as a ${string_prompt} variable. When I run my program the input dialog appear and I input a value.  I then retrieve the input on my main class from the index 0 of the String[] args argument:  if ( args.length > 0 ) {b = new BrowserHandler(args[0]);}   and pass it to my BrowserHandler class constructor, that retrieve it and set the String as the input value.  I successively try to call a method named SetBrowser() from the main class. It has to check the validity of the aforementioned String:      public static void main(String[] args) throws Exception {          BrowserHandler b;          if ( args.length > 0 ) {b = new BrowserHandler(args[0]);}         else b = new BrowserHandler();          b.setBrowser();         if ( !b.valid ) System.out.println("Browser not valid");          else {             //do something         }      }  }   The BrowserHandler class:  public class BrowserHandler {  public String browser; Boolean valid = true;  public BrowserHandler(String browser){     this.browser = browser.toLowerCase(); }  public void setBrowser() {         if ( this.browser == "firefox" ) {              System.out.println("...setting firefox");             this.driver = new FirefoxDriver();          }         else valid = false;  }   The problem is that the String browser of the browserhandler class get the variable, but when it comes to check the value of the string it always fails the condition, setting valid to false.  I cannot figure it why is that, despite having tried to debug it. Any suggestion that could lead me to the reason of it?

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


After I have let store bought frozen roll dough rise can I refrigerate to cook later! Thanks

I do not have enough time to bake my bread.  Can I refrigerate it or let it sit on the counter and bake it later in the day?


I am not sure why I cannot copy from the TeXShop console anymore, but here is my problem. This does not seem to be related to my bib file or how I cite things. How can I fix this?  I am calling LuaLaTeX here on after calling biber 2.0.    The example code would look like the following. From the error message, it does not look like any other specifics (of the content, for instance) is related to the error.  % !BIB TS-program = biber % !BIB program = biber \documentclass[11pt,english]{article} \usepackage[utf8]{inputenc} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{english} \usepackage[style=apa,backend=biber]{biblatex} \addbibresource{myfile.bib} \begin{document} \textcite{label} \printbibliography \end{document}

As in  I'm trying to use apa6e and biblatex-apa together and having problems.  Before I arrived at these problems, over the course of many hours of much reading, I first managed to get BibTeX working as expected in a simple input file (by modifying sample2e.tex). Then I managed to get apa6e working as expected based on the author's example in apa6e.pdf (which uses apacite). But when I try to get apa6e working with biblatex-apa, I end up with problems.  Here's my input file:  \documentclass{apa6e}  \usepackage[american]{babel} \usepackage{csquotes}  % biblatex \usepackage[style=apa]{biblatex} \bibliography{biblatex-apa-test-references}  \title{An Example Document} \shorttitle{Psychology: the end} \author{Silly Name}  \authornote{\dots} \abstract{\dots}  \begin{document}  \maketitle  This is an example input\cite{7.01:2} file.  Comparing it with the output it generates can show you\cite{7.01:3a} how to produce a simple document of your own.  \printbibliography  \end{document}   Attempting to typeset this in TeXShop by running LaTeX, then BiBTeX (which based on console messages, does seem to correctly call biblatex rather than BiBTeX), then LaTeX again, I get the following error message which I am having great difficulty (no doubt due to my lack of experience with TeX and co.) decoding.  (./test6.aux) (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/ot1ptm.fd) *geometry* driver: auto-detecting *geometry* detected driver: pdftex (./test6.bbl) Underfull \hbox (badness 10000) in paragraph at lines 18--18  []\OT1/ptm/m/n/12 An Ex-am-ple Doc-u-ment   Underfull \hbox (badness 10000) in paragraph at lines 18--18  []\OT1/ptm/m/n/12 Silly Name   Underfull \hbox (badness 10000) in paragraph at lines 18--18  []\OT1/ptm/m/n/12 Author Note  [1{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] Underfull \hbox (badness 10000) in paragraph at lines 18--18  []\OT1/ptm/m/n/12 Abstract  [2] Underfull \hbox (badness 10000) in paragraph at lines 18--18  []\OT1/ptm/m/n/12 An Ex-am-ple Doc-u-ment   Underfull \hbox (badness 10000) in paragraph at lines 25--25  []\OT1/ptm/b/n/12 References  ./test6.tex:25: Undefined control sequence. <argument> \mkbibdateapalongextra  (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/ot1pcr.fd) (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/ot1ztmcm.fd) (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/omlztmcm.fd) (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/omsztmcm.fd) (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/omxztmcm.fd) Overfull \hbox (8.03372pt too wide) in paragraph at lines 25--25 [][]  \OT1/ptm/m/n/12 Gilbert, D. G., Mc-Cler-non, J. F., Ra-bi-novich, N. E.,  Sugai, C., Plath, L. C., As-gaard, G., ... Botros,  ./test6.tex:25: Undefined control sequence. <argument> \mkbibdateapalongextra                                    {year}{month}{day}\iffieldundef {endyear}{... l.25   I tried many different sources in several different *.bib files before eventually trying the .bib database shown above and included with biblatex-apa. All trials gave a similar error.  Can someone help? I'm impressed that the poster above was able to do anything with apa6e and biblatex-apa, and if I only had her problem of having the reference page title show up in bold, I'd be really happy.  If you need to know, my tools are from a fresh installation of MacTeX that I immediately updated using the TeX Live Utility. I've checked my versions for apa6e (v0.3) and biblatex-apa (v4.2), and I think these are current.


I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e.  MyClass *m = (MyClass *)ptr;   all over the place, but there seem to be two other types of casts, and I don't know the difference. What's the difference between the following lines of code?  MyClass *m = (MyClass *)ptr; MyClass *m = static_cast<MyClass *>(ptr); MyClass *m = dynamic_cast<MyClass *>(ptr);

What are the proper uses of:   static_cast dynamic_cast const_cast reinterpret_cast C-style cast (type)value Function-style cast type(value)   How does one decide which to use in which specific cases?


I have noticed that the first start of any LibreOffice program takes much longer than later starts, so I suppose that parts of LibreOffice stay loaded when I exit the program. Is there a possibility to preload these parts at boot time?  I thought that I once saw an option specially for LibreOffice, but I can't find it in the current version. See also  where a LibreOffice specific answer is given that is no more available.

I guess I cannot do that with every program, but I expect that Chrome and LibreOffice can be "preloded" when the system starts. How to do that?  I have checked in Chrome settings Google Cloud Print and ~"after close stay in background as a service". It does not apply since when I close Chrome, there is none chrome-like process running in gnome-system-monitor. Chrome has been installed from Google website, not Software Center.  EDIT: Chromium installed via Software Center also do not start with a system or stay in the background when closed nor as a process or a service.


Trying to create a recyclerview for displaying data from the db. Keep getting this null pointer error on the same line. According to other sources, its because I do not instantiate the arraylists, so I fixed that I guess. I'm trying to make a simple book library, just as an example to use it later on my college project. The null pointer exception occurs on line 36, where the book author's position is passed to get() package com.example.sql_recyclerview; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.recyclerview.widget.RecyclerView; import org.w3c.dom.Text; import java.util.ArrayList;     public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.MyViewHolder>     {         private Context context;         private ArrayList book_id, book_title, book_author, book_pages;         CustomAdapter(Context context, ArrayList book_id, ArrayList book_title, ArrayList book_author, ArrayList book_pages)         {             this.context = context;             this.book_id = book_id;             this.book_title = book_title;             this.book_pages = book_pages;         }         @NonNull         @Override         public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)         {             LayoutInflater inflater = LayoutInflater.from(context);             View view = inflater.inflate(R.layout.my_row, parent, false);             return new MyViewHolder(view);         }         @Override         public void onBindViewHolder(@NonNull MyViewHolder holder, int position)         {             holder.book_id_txt.setText(String.valueOf(book_id.get(position)));             holder.book_title_txt.setText(String.valueOf(book_title.get(position)));             holder.book_author_txt.setText(String.valueOf(book_author.get(position)));             holder.book_pages_txt.setText(String.valueOf(book_pages.get(position)));         }         @Override         public int getItemCount()         {             return book_id.size();         }         public class MyViewHolder extends RecyclerView.ViewHolder         {             TextView book_id_txt, book_title_txt, book_author_txt, book_pages_txt;             public MyViewHolder(@NonNull View itemView)             {                 super(itemView);                 book_id_txt = itemView.findViewById(R.id.book_id_txt);                 book_title_txt = itemView.findViewById(R.id.book_title_txt);                 book_author_txt = itemView.findViewById(R.id.book_author_txt);                 book_pages_txt = itemView.findViewById(R.id.book_pages_txt);             }         }     }

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


Situation: I need to design a view in a mobile application (iOS + android) to scan qr-codes. The view needs a toggle to switch the flashlight "on" and "off". Problem: I first designed the switch that represented the current state of the flashlight (V1). This means that when the flashlight is "off" the icon shows a crossed out light bulb and when the flashlight is "on" the icon shows a glowing light bulb.  Like toggles work in settings for example:  When I tested my design in a prototype (Adobe XD) is feels very strange to turn on the flashlight by clicking on an icon that shows a crossed out light bulb. For this reason I have created another variant that shows exactly the opposite:  When I want to turn "on" the light, I click on the icon with the light "on " When I want to turn "off" the light, I click on the icon with the light "off".  It's like a play and pause button on a music player  When I want to play the song, I click on the play icon When I want to pause the song, I click on the pause icon     I had a discussion with a colleague about whether it makes sense to display what the user wants to achieve, or the current state. Displaying the current state makes less sense to me in this context, because the user knows that the flashlight is off when sitting in the dark. And as I said it feels weird to click on this crossed out icon. Now I am successfully confused how to solve this problem. I think it's not good to break the switch behavior everyone is used to know, even if it feels weird to me. What do you guys think?

I have a quick question about buttons that toggle between two states. (Think Play/Pause, or Shuffle/Regular Play.) As the title says, should the toggle show it's current state or the state to which it will transition?  I think people are used to the Play/Pause convention. But the Shuffle/Regular play might be more confusing if you show the transition state instead of current. For example, the built-in music player on the Xbox 360 does it this way: when it's in shuffle mode, it shows the icon for direct play and vice versa and it always confuses me (am I in shuffle mode or straight play).  I see it this way: Play/Pause is more like action as in begin playing or pause playing. Yes behind the scenes it is a state transition but to the user, there is an action. Whereas Shuffle/Straight Play is an option and it's best to show the current state (and possibly have only one icon and change button to show that the option is enabled/disabled). Thoughts?


If X is normally distributed with mean mu and variance sigma^2, then what can I know about the distribution of X^2 ?

Let $(X_1, X_2, \ldots, X_i, \ldots, X_k)$ be $k$ independent, normally distributed random variables with means $\mu_i$ and variances $1$. Then the random variable $$ \sum_{i=1}^k X_i^2$$ is distributed according to the noncentral chi-squared distribution with  parameters: $k$   and $ \lambda=\sum_{i=1}^k \mu_i^2$.  If $(X_1', X_2', \ldots, X_i', \ldots, X_k')$ are also independent normal distributed with variances $1$, and means $\mu'_i$'s s.t. $\sum_{i=1}^k \mu_i'^2 = \lambda$, why are $$ \sum_{i=1}^k X_i'^2$$ and $$ \sum_{i=1}^k X_i^2$$ identically distributed? Thanks.


Context: I am teaching an online course via WA. The teaching and learning activity is going to take place in a WA group. In that course, I need to tell my students that they will get the materials on the group one after another. So, I will not send them all at once. I will just send one material right before we are engaged in it. Can I say: Well, class, I will send the material you are going to learn and it should be on your phone screen while you are having it

In a situation where say a group (or at least a plurality) of men is being addressed — for example on a sign passed by many married men — which is correct?  "Remind your wife."  or  "Remind your wives."


How can I add some of my folder (as in image, svn) to the Folder section? And, how can I remove the folder I never use (Pcitures / Videos / Music) from this section?

I've recently upgraded from Windows 8 to 8.1 and noticed the restructured This PC folder, formerly Computer.   What I want to achieve is to include custom folder under "This PC".    What I've found after googling is that what is displayed under "This PC" is stored in registries under   HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace  However those folders (such as Desktop, Documents, etc) are referenced via CLSID and the folder I want to include in the list does not have CLSID.


I understand the relationship between ISO, aperture and shutter speed. What I'd like to know is what actually happens in the sensor when you raise or lower the ISO number? In other words, what is taking place electronically?

If I change the ISO settings on my camera, obviously the gain of the system is increased, amplifying the signal from the sensor. What's not clear to me is where the amplification takes place. I see several possibilities:   In the sensor, by increasing voltage or some other mechanism Via an analog amplifier outside of the sensor Digitally, after the signal has been digitized, but before storing data in the RAW file As a parameter applied solely in creating an image from RAW   If #4 is true, then you could take a 4-stop overexposed RAW picture at ISO 1600, and then in post processing produce a JPEG at ISO 100 that would be the same as if the original photo had been shot at ISO 100.  If #1 or #2 is true, then a RAW file shot at ISO 1600 would actually contain more information about shadows, and an ISO 100 RAW would contain more information about highlights.


I am trying to mimic the thick stylish font used in cover page of the book :    MWE is :  \documentclass[dvipsnames, svgnames]{minimal} \usepackage{pst-text, pagecolor, xcolor} \DeclareFixedFont{\RM}{T1}{phv}{b}{n}{3.8cm}  \begin{document}  \pagecolor{Black} \color{White}  \rput(2.7in,.0in){\pscharpath[fillstyle=solid,fillcolor=magenta!50]{\RM Problems}} \rput(3in,-1.2in){\pscharpath[fillstyle=solid,fillcolor=magenta!50]{\RM in General}} \rput(2.15in,-2.5in){\pscharpath[fillstyle=solid,fillcolor=magenta!50]{\RM Physics}}  \end{document}   This produces :   But this is pretty far from the original.   Any ideas ??  Thanks

Is it possible to identify the font used in a specific document/picture?  Answers to this question should identify:   Possible methods to do this (perhaps one answer per method) and adequately describe how to use it (as opposed to merely stating it); Ways of finding the identified fonts, if possible (free or not); and Any prerequisites associated with the method used, if required (for example, "In order to use method X, your document has to be in format Y").   This question is meant as an FAQ, based on an . Its aim is to facilitate the community with the general procedures involved in font identification. Similar cases are solved on a per-usage basis on 's  tag.


Imagine I have a classifier with some parameter $a$. I want to perform parameter optimisation and model selection. Imagine that my grid for the values of $a$ has three values 1,5 and 10 and I want perform 10-fold cross-validation as follows:   For each iteration, the dataset is partitioned into a 9:1 ratio of training and testdata, whereby at each iteration the two consists from other sampled datapoints of the full dataset (which is the description of 10-fold cross-validation) Now, each of these iterations is done three times: one time for each parameter value.   Hence I end up with 30 iterations (10-fold cv basically, but for each parameter once) and pick the parameter which on average performed best. I am aware that this chosen model has not YET been tested on new data. However during all the iterations, since test and training set have been disjunct and independent, it's performance has been evaluated on this unseen test set. So why is this approach incorrect (as in comparison with nested cv with an inner and outer loop)?

Scikit Learn's  mentions the use of nested cross-validation:     >>> clf = GridSearchCV(estimator=svc, param_grid=dict(gamma=gammas),   ...                    n_jobs=-1)   >>> cross_validation.cross_val_score(clf, X_digits, y_digits)       Two cross-validation loops are performed in parallel: one by the GridSearchCV estimator to set gamma and the other one by cross_val_score to measure the prediction performance of the estimator. The resulting scores are unbiased estimates of the prediction score on new data.   From what I understand, clf.fit will use cross-validation natively to determine the best gamma. In that case, why would we need to use nested cv as given above? The note mentions that nested cv produces "unbiased estimates" of the prediction score. Isn't that also the case with clf.fit?  Also, I was unable to get the clf best estimates from the cross_validation.cross_val_score(clf, X_digits, y_digits) procedure. Could you please advise how that can be done?


For the past few weeks I have been noticing the code in my index.htmls on my host, changing by it self. The other day Chrome and Firefox have started to list the sites hosted on my server as attack sites.  I am pretty sure my computer is clean and I'm not uploading the virus via ftp.  It's a script in my server somewhere, but I have no idea how to get rid of it, any help would be very much appreciated.

This is a  about Server Security - Responding to Breach Events (Hacking)   See Also:                  Canonical Version I suspect that one or more of my servers is compromised by a hacker, virus, or other mechanism:   What are my first steps? When I arrive on site should I disconnect the server, preserve "evidence", are there other initial considerations? How do I go about getting services back online? How do I prevent the same thing from happening immediately again? Are there best practices or methodologies for learning from this incident? If I wanted to put a Incident Response Plan together, where would I start? Should this be part of my Disaster Recovery or Business Continuity Planning?   Original Version       2011.01.02 - I'm on my way into work at 9.30 p.m. on a Sunday because our server has been compromised somehow and was resulting in a    attack on our provider. The servers access to the Internet   has been shut down which means over 5-600 of our clients sites are now   down. Now this could be an FTP hack, or some weakness in code   somewhere. I'm not sure till I get there.      How can I track this down quickly? We're in for a whole lot of   litigation if I don't get the server back up ASAP. Any help is   appreciated. We are running Open SUSE 11.0.            2011.01.03 - Thanks to everyone for your help. Luckily I WASN'T the only person responsible for this server, just the nearest. We managed   to resolve this problem, although it may not apply to many others in a   different situation. I'll detail what we did.      We unplugged the server from the net. It was performing (attempting to   perform) a Denial Of Service attack on another server in Indonesia,   and the guilty party was also based there.      We firstly tried to identify where on the server this was coming from,   considering we have over 500 sites on the server, we expected to be   moonlighting for some time. However, with SSH access still, we ran a   command to find all files edited or created in the time the attacks   started. Luckily, the offending file was created over the winter   holidays which meant that not many other files were created on the   server at that time.      We were then able to identify the offending file which was inside the   uploaded images folder within a  website.      After a short cigarette break we concluded that, due to the files   location, it must have been uploaded via a file upload facility that   was inadequetly secured. After some googling, we found that there was   a security vulnerability that allowed files to be uploaded, within the   ZenCart admin panel, for a picture for a record company. (The section   that it never really even used), posting this form just uploaded any   file, it did not check the extension of the file, and didn't even   check to see if the user was logged in.      This meant that any files could be uploaded, including a PHP file for   the attack. We secured the vulnerability with ZenCart on the infected   site, and removed the offending files.      The job was done, and I was home for 2 a.m.            The Moral   - Always apply security patches for ZenCart, or any other CMS system for that matter. As when security updates are released, the whole   world is made aware of the vulnerability.   - Always do backups, and backup your backups.   - Employ or arrange for someone that will be there in times like these. To prevent anyone from relying on a panicy post on Server   Fault.


I need to convert a String which is a epoch (Unix time) format to a Date class an after a String formatted (dd/MM/yyyy).  Thank you for your help !

I have a string containing the , and I need to convert it to a Java Date object.  String date = "1081157732"; DateFormat df = new SimpleDateFormat(""); // This line try {   Date expiry = df.parse(date);  } catch (ParseException ex) {   ex.getStackTrace(); }   The marked line is where I'm having trouble. I can't work out what the argument to SimpleDateFormat() should be, or even if I should be using SimpleDateFormat().


This is a hypothetical question that came up in discussion.  Consider a situation where I am in country A. I take a flight to country B, and am refused admission at the border. However I am not allowed back to country A -- maybe I only had a single entry visa, or I used up my visa-free allowance; either way I can't be just put on the next flight back from the same airline.   In this case, how would the removal work? Would they send me back to my home country? Would they force the airline to take me somewhere directly that I am allowed to enter? (And if the airline I came on doesn't fly anywhere from B to where I can go, will the airline need to pay for a ticket on a other airline to somewhere I can enter?)    For a concrete example: a US citizen flies from Spain to the UK after using up his/her 90-out-of-180 days in the Schengen zone. The immigration officers in London refuse entrance for whatever reason. What happens to our poor Yankee friend?

Before departure the airline staff may check your passport stats to ensure you wont be rejected to enter the arrival country.  However, in some case Immigration office of arrival country will reject your entry even you have vaild visa. And normally you will be sent to the country where you come from by the airway you travel to there.  The question is, you are not the resident of the departure country, and the Immigration office also reject your entry, what will the airline do?  PS: I am talking those who have vaild passport and national identity, but not talking about the case of  who was stateless, nor those in Yarl's Wood Or Toulouse-Cornebarrieu.


How many positive integers $n$ are there such that $\dfrac {n(n+1)(n+2)}6$ is a perfect square ? I know $n=1 , 2$ works ; are there any more ? Are there only finitely many such $n$ ?

Examining the Tartaglia's triangle, I have observed that all the squares were the trivial cases, that is, $\binom{n^2}1$ or $\binom{n^2}{n^2-1}$.  More formally:  Conjecture: If $\binom nm=k^2$ then $n=k^2$.  Is it known to be true?  I have tried to use the formula  $$\nu_p\left(m!\right)=\sum_{k=1}^\infty\left\lfloor \frac m{p^\alpha}\right\rfloor$$  to prove that the exponents of the factorization of the binomial coefficients are odd, but I realized that this cannot be proved, because the binomial coefficients needn't be square-free: $\binom 63=20$, for example.  Any ideas?


I have a sh file: #!/bin/bash echo $PATH date pwd which nano  First three lines work with both #!/bin/bash and #!/bin/zsh but I got a ./script.sh: line 5: which: command not found with bash, but zsh run the file just fine. Why? If I enter a bash shell from zsh by typing bash and then type type which I got: which is aliased to `_which'  But if I am in zsh and type bash -c "type which", I got: bash: line 0: type: which: not found

When looking for the path to an executable or checking what would happen if you enter a command name in a Unix shell, there's a plethora of different utilities (which, type, command, whence, where, whereis, whatis, hash, etc).  We often hear that which should be avoided. Why? What should we use instead?


I'm new to c#, in java we used to have interlinking for enums like below:   public enum Module {     None(SubModule.None),     Authentication(SubModule.Login),     User(SubModule.User,SubModule.ForgotPassword,SubModule.ResetPassword)       private SubModule subModule;      public Module(SubModule... submodule)     {      }   }   I want to interlink my Modules with submodules, I tried the same in C# its giving compilation error. Is there anyway to do the same in C#.

I've been programming in Java for a while and just got thrown onto a project that's written entirely in C#.  I'm trying to come up to speed in C#, and noticed enums used in several places in my new project, but at first glance, C#'s enums seem to be more simplistic than the Java 1.5+ implementation.  Can anyone enumerate the differences between C# and Java enums, and how to overcome the differences?  (I don't want to start a language flame war, I just want to know how to do some things in C# that I used to do in Java).  For example, could someone post a C# counterpart to Sun's famous Planet enum example?  public enum Planet {   MERCURY (3.303e+23, 2.4397e6),   VENUS   (4.869e+24, 6.0518e6),   EARTH   (5.976e+24, 6.37814e6),   MARS    (6.421e+23, 3.3972e6),   JUPITER (1.9e+27,   7.1492e7),   SATURN  (5.688e+26, 6.0268e7),   URANUS  (8.686e+25, 2.5559e7),   NEPTUNE (1.024e+26, 2.4746e7),   PLUTO   (1.27e+22,  1.137e6);    private final double mass;   // in kilograms   private final double radius; // in meters   Planet(double mass, double radius) {       this.mass = mass;       this.radius = radius;   }   public double mass()   { return mass; }   public double radius() { return radius; }    // universal gravitational constant  (m3 kg-1 s-2)   public static final double G = 6.67300E-11;    public double surfaceGravity() {       return G * mass / (radius * radius);   }   public double surfaceWeight(double otherMass) {       return otherMass * surfaceGravity();   } }  // Example usage (slight modification of Sun's example): public static void main(String[] args) {     Planet pEarth = Planet.EARTH;     double earthRadius = pEarth.radius(); // Just threw it in to show usage      // Argument passed in is earth Weight.  Calculate weight on each planet:     double earthWeight = Double.parseDouble(args[0]);     double mass = earthWeight/pEarth.surfaceGravity();     for (Planet p : Planet.values())        System.out.printf("Your weight on %s is %f%n",                          p, p.surfaceWeight(mass)); }  // Example output: $ java Planet 175 Your weight on MERCURY is 66.107583 Your weight on VENUS is 158.374842 [etc ...]


Is there any feature in development for Stack Overflow to RUN/TEST code online? I see many questions are linked to some other online tools to run and test the submitted code/corrected code.  Like the below Online Tools:     Regular-Expressions -       PHP code                                -- Greate to use                    -- Good to Share         CSS/HTML/Javascript/Jquery -       MySql/SQL -       htaccess Test -       JSON Validator -       Here you Go!!       Many in one -    It will be very useful to explain what has be done. It will be nice if Stack Overflow has these features.  What do you say?

Interactive / Real time code compilation for stackoverflow.com. That will improve the answer correctness of the stackoverflow.com.  When adding a new code block, let the user try to compile the code and see the result. It will be useful to demonstrate class designs, algorithms, and logics.


I wonder whether there is anyone who is able to show the clock in a beamer presentation. I have not come across any working example. Following the tdclock documentation, I compiled the MWE below. It shows only blank boxes where the date and time are supposed to appear, see pdf attached. I would appreciate any advice.  \documentclass[xcolor=dvipsnames]{beamer} \usepackage{beamerthemeshadow}  \usepackage[font=Helv,timeinterval=60]{tdclock} \setbeamertemplate{headline}{\initclock\large{\tdyear-\tdmonth-\tdday \quad\tdhours:\tdminutes}}  \usepackage{xcolor}  \title[]{Main Title} \author[]{Zilore Mumba} \institute[]{Unza}  \usepackage[font=Helv,timeinterval=60]{tdclock} \setbeamertemplate{headline}{\initclock\large{\tdyear-\tdmonth-\tdday\quad\tdhours:\tdminutes}}  \usepackage{xkeyval} \usepackage{hyperref}  \begin{document}  \initclock  \title{Beamer Presentation} \author{Zilore Mumba}  \begin{frame} \titlepage \end{frame}  \begin{frame}\frametitle{first slide} content \end{frame}  \end{document}

I have been suffering from finding a PDF presentation viewer for beamer output on Windows that can play embedded videos (by media9 package) and show the elapsed presentation time. I have tried the following: Adobe Reader with tdclock package:  Pros: plays videos and loads tdclock properly Cons: sluggish and crashes frequently  Foxit Reader with tdclock package:  Pros: smooth viewer and plays videos  Cons: can't load tdclock clock/stopwatch despite enabling javascript   Impressive:  Pros: fast and has internal clock  Cons: can't play embedded videos   Dual-Screen PDF Viewer:  Pros: very fast, has internal clock and dual screen support  Cons: can't play embedded videos   Is there any other solution that can properly play embedded videos and show elapsed presentation time flawlessly and smoothly on Windows?  P.S. when I mean tdclock javascript is not loaded, those empty red boxes show up instead of the clock/stopwatch,  and when embedded video can't be loaded, a white page shows up.


Let $f: G \rightarrow G$ be an isomorphism, with $|G| < \infty$, $f$ has no non-trivial fixed points and $f \circ f = id_G$. Show $f(x)=x^{-1}$ and $G$ is abelian. (Hint. Prove that every element of G has the form $xf(x)^{-1}$.   This is exercise 1.50 ii from Rotman - Introduction to the theory of groups. I have tried to do this exercise, but I couldn't get it.  What I have done already If $G$ is abelian, then $f(xf(x)) = f(x)x=xf(x)$. This showns $xf(x) = e$ because $f$ has no non-trivial fixed points and thus $f(x) = x^{-1}$. Exercise 15.50 i states $G$ is abelian iff $f(x) = x^{-1}$ is a homomorphism. I didn't succeed in proving $f(x) = x^{-1}$ so I thought I tried showing $G$ is abelian.  In conclusion, I showed:  $$G \text{ abelian} \Leftrightarrow f(x)=x^{-1}$$  However, I cannot prove either statement.  About the hint I thought about $g=xf(x)^{-1}$. Suppose we already know $f(x)=x^{-1}$, this means that every $g\in G$ can be written as $x^2$. Thus every element has a root, which seems kinda weird. I worked out $\mathbb{Z}_7$ and there you have two "cycles": (1, 2, 4) and (3,5,6). I thought you can do some kind of argument where you take $x, x^2, x^4, x^8, ...$ where you know that this is bound to have some repetition ($G$ is finite). But I don't really know the point of doing this, gets me nowhere.  The only way of proving the hint (I think) is just showing that the set $\{x f(x)^{-1} | x \in G\}$ has the same cardinality as $G$ (we can do that since $G$ is finite). Thus I need to show $xf(x)^{-1}=yf(y)^{-1} \Rightarrow x = y$. Could not do it. I think I need to use that $f$ has no non-trivial fixed points, but that just comes down to what I stated above.  Hint from you guys, no answers! I don't want the answer, I want to do it myself. I studied math long time ago and group theory was my favorite subject. I picked up the book to just work through all the exercises (beginning I know already, but there is some new stuff at the end). I try to do all exercises from all the stuff I already know to get into the subject. I don't want the answer itself. If you can just give a hint in the right direction, that would be awesome :)

Let $G$ be a finite group and $f:G\to G$ an isomorphism. If $f$ has no fixed points (i.e., $f(x)=x$ implies $x=e$) and if $f\circ f$ is the identity, then $G$ is abelian. (Hint: Prove that every element in $G$ has the form $x^{-1}\cdot f(x)$.)   With the hint, I can see that for all $t\in G$, $f(t)=t^{-1}$, and since $f$ is an isomorphism, $G$ is abelian. But I can't see how to prove the hint or why it's evident.  Source : Rotman J.J. Introduction to the theory of groups, exercise 1.50


I would like to know a clean and generic way to achieve this using only CSS + HTML. Minimal markup / hackery would be desirable.  The goal is to provide a working example in which:   there is a parent container box that can be any size there is an inner div element nested that should be the biggest circle possible that fits in the outer box, centered both vertically and horizontally.   This is what I've got so far, it is an ugly approach:     $(function(){   console.log("this code is  here only to allow resizing the parent box");   $(".box").resizable().height(150).width(100); }); .box{   margin-left:auto;   margin-right:auto;   display: flex;   justify-content: center;     align-items: center;     position:relative;   border:2px dashed red;   min-width:90px;   min-height:90px;   margin-top:50px; }  .dummy{   max-height:100%;   max-width:100%;   object-fit:contain;   border-radius:500px;   border:2px dashed blue;   box-sizing:content-box;   pointer-events:none;   background-color:yellow; }  .circle{   display:contents;   position:relative; }  .circle span{   position:absolute;   color:white;   font-size:30px;   color:black; }   <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css">
No JS involved, but a lot of ugly hackery

¿any better way to do it?

             :-)

I have a div 200 x 200 px. I want to place a 50 x 50 px image right in the middle of the div.   How can it be done?  I am able to get it centered horizontally by using text-align: center for the div. But vertical alignment is the issue..


I am using Ubuntu 14.04. My internet connection is pretty slow (512 kbps). Sometimes I see that I have no software running which should download anything from the internet, but the system monitor still shows that some download is going on. So I think some hidden software are causing this. Is there a way I can monitor every software that is using internet?

I think I'm being the victim of a bug here. Sometimes while I'm working (I still don't know why), my network traffic goes up to 200 KB/s and stays that way, even tough I'm not doing anything internet-related.   This sometimes happens to me with the CPU usage. When it does, I just run a top command to find out which process is responsible and then kill it. Problem is: I have no way of knowing which process is responsible for my high network usage. Both the resource monitor and the top command only tell me my total network usage, neither of them tells me process specific network info.  I've found questions here about monitoring total bandwidth usage, but, as I mentioned, that's not what I need. Is there another command I can use to find out which process is getting out of hand?  The command iftop gives results that disagree entirely with the information reported by System Monitor. While the latter claims there's high network traffic, the former claims there's barely 1 KB/s.  I've already tried killing all the obvious ones (Firefox, update-manager, Pidgin, etc) with no luck. So far, restarting the machine is the only way I found of getting rid of the issue.


I try compute execution time for encrypt and decrypt data has 1024 bit = 128 byte  in RSA-crt algorithm. I need this results. But I believe this result wrong. because big diffrent between execution time for encrypt and execution time for decrypt. My code is following     private void keygen() {     p = BigInteger.probablePrime(n/2, random);     q = BigInteger.probablePrime(n/2, random);      N=p.multiply(q);      phi_n=(p.subtract(one)).multiply(q.subtract(one));     e=new BigInteger("65537");     while(e.gcd(phi_n).intValue()!=1)     e=BigInteger.probablePrime(32, random);      d=e.modInverse(phi_n);     dp=d.mod(p.subtract(one));     dq=d.mod(q.subtract(one)); }  private void encrypt() {     M=new BigInteger(1024,random);     C= M.modPow(e,N); }  private void decrypt() {     Mp=C.modPow(dp, p);     Mq=C.modPow(dq, q);      RM=(((Mp.multiply(q)         .multiply(q.modInverse(p)))         .add(Mq.multiply(p)         .multiply(p.modInverse(q))))         .mod(N)); }   The timing function is   for (;;) {     long begin = System.currentTimeMillis();      for (int i = 0; i < num; i ++) {             //function to measure, eg.         crtrsa.decrypt();     }     long end = System.currentTimeMillis();     long time = end - begin;     if (time >= 2000) {         System.out.println("average Decryption takes: %.2f ms",(double)time / num);         break;     }     num *= 2; }   On my laptop when run program it give me the follow  average Key generation takes: 58.60 ms average Encryption takes: 0.09 ms average Decryption takes: 1.89 ms I note big difference between 0.09 ms and 1.89 ms I want tell me where my  wrong or any link about this issue.

I am designing an implementation of RSA . I recorded computation times in Java by using System.currentTimeMillis(). It returned an encryption time of 0.05 ms and decryption time of 0.55 ms, or a ratio of 1:11.   This seems like a large difference. Is it supposed to be this way?  //here my key has 256 bits  for (;;) {             long begin = System.currentTimeMillis();              for (int i = 0; i < num; i++) {              decrypt();             }              long end = System.currentTimeMillis();              long time = end - begin;              if (time >= 10000) {                 System.out.printf("Average Encryption takes: %.2f ms\n",                         (double) time / num);                 break;             }              num *= 2;         }  p = BigInteger.probablePrime(128, random); q = BigInteger.probablePrime(128, random); N=(p.subtract(one)).multiply(q.subtract(one)); e=BigInteger.probablePrime(32, random); d=e.modInverse(N); private void encrypt() {  C= M.modPow(e,N);  }  private void decrypt() {     RM = C.modPow(d, N);     }


I am planning to apply to some North American Masters and PhD econ programs this upcoming fall. While I meet all the minimum requirements to be eligible for admission into all the programs, I am pretty nervous about my first and second-year grades: they are horrific. Now, I know that a lot of people say that freshman performance doesn't really count, but my situation is a bit different from the rest.   When I was first enrolled in an undergraduate program at the university, I studied business. Like many other freshmen out of high school, I didn't care about grades. All I wanted to do was pass my courses and get the degree. In my first year, I did pass all my courses, but my average was below the honors program requirement and the academic office issued me a probation warning. Probation warning caused me to panic a little bit, but it still was not enough to make me a better student. In my second year, I failed a couple of core business courses and I was put on probation as a result. Over the course of two years, I did not meet the class average in any of my classes. The University allowed me to come back into the program after I would have taken the year off, but I decided to withdraw from the institution and reapply into a different program at another university.  Fortunately, I was offered admission into one of the English programs at the university in the town where my parents reside. Since I earned some credits from the previous institution, I was registered as a second-year student. This time I performed much better. My average improved drastically, it increased from mid/high 50% to 79%. I scored above class average in every single course with the exception of one. This was also the year, I was taking a calculus course which pushed me to switch from Honors English program to Double Major in Economics and English after an excellent performance. In the previous academic year (2017-2018), I obtained an 87% average (for that year alone) in English and Economics courses. Right now, I am taking math courses in the summer and some advanced ones in the upcoming graduate year.   Based on my recent performance at my current undergraduate university, I think I have decent chances to be accepted into at least one of the graduate problems. But as I mentioned earlier, my performance at my first university is terrible. How much of a problem do you think my two years in business would cause me if at all?   Thanks

When applying to a PhD program in the US, how does the admissions process work? If an applicant is weak in a particular area, is it possible to offset that by being strong in a different area?  Note that this question originated from this . Please feel free to edit the question to improve it.


It's been a long time, so details are fuzzy, but here goes:  Humans are exploring some asteroid belt and they come across some space insects (& other weird biological creatures) instinctively mining ores and such. The humans start using artificial pheromones to control the bugs and make them give the ore to human mining ships. The upset to the hive's patterns ... wakes up a dormant intelligent mind ... which then threatens the humans with assimilation. One line that stuck with me is the hive brain telling the frightened miner: "That creature you see over there eating your vomit; a million years ago they called themselves the Lions, and were the terror of the Galaxy."

This is a short story that appeared in a collection. Two genetically-modified humans (corporate anthropologists, basically) travel to a planetoid inhabited by an insect race that is mining the planet in order to study the race. While there, they are practically ignored, as the individual members of the race lack consciousness. The humans determine a type of pheromone is used to control the worker caste, and co-opt several members to create a living area. They make plans to put the mining towards human ends, but before that can happen they are discovered. The presence of the artificial pheromones wakes up a hive-mind, super-intelligent bug, who then bargains with the surviving member of the team (the man) after killing and taking over the female member of the team.  The collection was read at some point between 2000-2005.


I'm using it to decrypt a password (said password is in a URI is in another class).  If I hardcode the key, it works.  I'm trying a dynamic approach, and this is where I struggle due to my lack of experience.  I'm not able to get the two classes to work together. public class Decrypt {        public void myMethod(Context context) {         try {             context.getContentResolver().openInputStream(targURI);         } catch (FileNotFoundException e1) {                 Toast.makeText(context.getApplicationContext(), "Could not read the content. Please check the URI is correct", Toast.LENGTH_LONG).show();                 return;             }             BufferedReader reader1 = new BufferedReader(new InputStreamReader(content));             StringBuffer buffer = new StringBuffer();             try {                  while ((line = reader1.readLine()) != null) {                     md5key = md5key + line;                 }                 index = md5key.indexOf("\"MD5_PIN\"");                 md5key = md5key.substring(index + 10, index + 42);                 Log.i("Test:  ", md5key);             } catch (IOException e1) {                 e1.printStackTrace();             }         }  //Decrypts password     public String encryppass(String pass) {         return this.decrypt(pass);     }      private String decrypt(String paramString) {         byte[] arrayOfByte = Base64.decode(paramString.getBytes(), 0);         try {             this.cipher = Cipher.getInstance("AES");             this.cipher.init(2, this.keySpec);             String str = new String(this.cipher.doFinal(arrayOfByte), "UTF-8");             return str;         }         catch (Exception exception) {             exception.printStackTrace();             return null;         }     } }  MainActivity:      @Override     public void onClick(View view) {          switch (view.getId()) {              case R.id.exploit1:                 String[] arrayOfString = {"name", "pwd"};                 Cursor cursor = getContentResolver().query(                         Uri.parse(PWDMANAGER_URI), arrayOfString, null, null, null);                  Decrypt pp = new Decrypt();                 try {                     if (cursor.moveToFirst()) {                         do {                             String name = cursor.getString(0);                             String encrypted = cursor.getString(1);                             String decrypted1 = pp.encryppass(encrypted);                             Log.i("Title:     ", name);                             Log.i("Password:  ", decrypted1);                         } while (cursor.moveToNext());                     }                 } catch (NullPointerException exception) {                     exception.printStackTrace();                 }       Any suggestions on how to get these classes working together?

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I really screwed up and did  sudo chmod -R 777 /etc   After searching for hours for an answer I eventually booted into recovery mode and did:  mount -o rw,remount /  # because the file-system was mounted as read-only chmod 0440 /etc/sudoers chmod 0440 /etc/sudoers.d/README chmod 0700 /var/lib/sudo   I am now able to login, but not as my user, but "I have no name!". I also get an error if I try to do anything:  bash: /etc/profile: Permission denied   Ubuntu is installed on a seperate SSD and I have 5 hard drives in RAID 5. I am afraid to not being able to remount the RAID array if i reinstall Ubuntu. And to connect a CD drive I have to disconnect one of the hard drives and I am really afraid of losing data. Is there something I can do?

I accidently ran  sudo chmod 755 -R /   instead of  sudo chmod 755 -R ./   I stopped it after few seconds, but now there is some problems such as  sudo: must be setuid root   How can I revert permissions back?


In a 200 page document I have 20-30 portions, 2-5 sentences long usually, scattered throughout that discuss something about statistics.  My thought is to add a marginpar for each statistics portion.  My question is whether I can label each marginpar uniquely so that I am able to ref-er to it (and thus to the few sentences on statistics). [While tagging this question, marginnote appeared, and that might be an alternative to be labelled.)  EDIT: The reference to another question that shows how to number marginpar items, like footnotes are numbered sequentially, is very helpful, but doesn't explain how then to refer to a numbered marginpar later in the document.  If this is possible, it seems it will require a counter .  But being a beginner, I don't know whether the basic idea is a dead end let alone how to code it.  I am using R, RStudio, and the knitr package on Windows.

how can i make the marginpar note have a number like footnote command does? just like this picture show,


I’m planning to DM a game of DnD5e soon using the Dragon of Icespire peak and the Essentials Kit. This is for all of us as first time players.  One of the players is interested in rolling an elven Cleric, but doesn’t necessarily like the religious aspect. Is this a feasible thing for a cleric to just be interested in healing and support, rather than their gospel and the good word? Or are we better off having her choose a God/domain that simply aligns with her interests, like Nature or Life, and simply ignore or backseat the religion.

I have an experienced player wanting to create a tempest cleric who doesn't worship a god. His back story will be something along the lines of 'walking through a storm one day he is hit by lightning, which provides him with power'.  I'm happy to entertain the thought, but what aspects might go awry?


Solve this differential equation for $X$: $$p²-py+x=0$$ This is how I tried it: $$Y=p+(\frac{x}{p})$$ Then differentiaing wrt $x$, $$p=\frac{1}{p}+1-\frac{x}{p²}\frac{dp}{dx}$$ Then $$\frac{dp}{dx} = \frac{(p²-1)p}{p²-x}$$ I can't proceed further. Please help. Thanks in advance :).

I've recently been learning about differential equations, and my teacher has been giving some particularly difficult examples out for those of us who finish early. He gave us the following differential equation: $$x=y\frac{dy}{dx}-\left(\frac{dy}{dx}\right)^{2}$$ With the hint "Differentiate with respect to $y$, then let $\frac{dy}{dx}=p$". I've solved it after the lesson and would like someone to check whether or not I've done so correctly.    Following the hint, $$\frac{dx}{dy}=\frac{1}{p}=p+y\frac{dp}{dy}-2p\frac{dp}{dy}$$ Which rearranges to $$p-\frac{1}{p}+y\frac{dp}{dy}=2p\frac{dp}{dy}$$ Multiplying through by $\frac{dy}{dp}$, $$\left(p-\frac{1}{p}\right)\frac{dy}{dp}+y=2p$$ Rearranging into the form $\frac{dy}{dp}+f(p)y=g(p)$, and writing $p-\frac{1}{p}=\frac{p^{2}-1}{p}$ $$\frac{dy}{dp}+\frac{p}{p^{2}-1}y=\frac{2p^{2}}{p^{2}-1}$$ Our integrating factor is $$e^{\int\frac{p}{p^{2}-1}dp}=e^{\frac{1}{2}\ln(p^{2}-1)}=\sqrt{p^{2}-1}$$ So we have $$\sqrt{p^{2}-1}\frac{dy}{dp}+\frac{p}{\sqrt{p^{2}-1}}y=\frac{2p^{2}}{\sqrt{p^{2}-1}}$$ The left hand side is, by design, $\frac{d}{dp}(y\sqrt{p^{2}-1})$, and the right hand side can be integrated as follows: $$\int \frac{2p^{2}}{\sqrt{p^{2}-1}}dp=\int\frac{2(p^{2}-1)+2}{\sqrt{p^{2}-1}}dp=\int 2\sqrt{p^{2}-1}dp+\int \frac{2}{\sqrt{p^{2}-1}} dp$$ These can both be solved using the substitution $p=\cosh(u)$, and gives $$y\sqrt{p^{2}-1}=p\sqrt{p^{2}+1}-\cosh^{-1}(p)+\alpha$$ Where $\alpha$ is an arbitrary constant. Dividing, we finally have $$y=p+\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}$$  Here I was stuck for a long time, until I realised that we also have the equation we began with: $x=py-p^{2}$, which we can solve as a quadratic in $p$ to also get $$p=\frac{y\pm \sqrt{y^{2}-4x}}{2} \implies p^{2}=\frac{y^{2}+y^{2}-4x \pm 2y\sqrt{y^{2}-4x}}{4}$$  Thus, $$y=\frac{y\pm \sqrt{y^{2}-4x}}{2}+\frac{\cosh^{-1}\left(\frac{y\pm \sqrt{y^{2}-4x}}{2}\right)+\alpha}{\sqrt{\frac{y^{2}-2x \pm y\sqrt{y^{2}-4x}}{2}-1}}$$  This is as good as I can do - we have a relation between $y$ and $x$ - am I done? Is this the correct answer? Is there an easier way?     Thank you for your time.    Following the suggestion by @Valentin $$\frac{dy}{dp}=1+\frac{\frac{1}{\sqrt{p^{2}-1}}\sqrt{p^{2}-1}-p\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}}{p^{2}-1}=1+p\frac{1-\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}}{p^{2}-1}$$ Hence, $$dx=\frac{dy}{p}=dp\left(\frac{1}{p}+\frac{1-\frac{\cosh^{-1}(p)+\alpha}{\sqrt{p^{2}-1}}}{p^{2}-1}\right)$$


Today I came across a very popular question with 153,899 views. One of the answers suggested something which I knew was not possible (I was in doubt, but a quick test proved I was right):   The answer is plain wrong:   It adds a second parameter to a function that only takes one (this is legal in JavaScript, but the parameter is ignored) It suggests the second parameter can be used to specify the format. (again, it does nothing) It only works because the sample string in the answer is already in the supported format - which ignores the OP's real problem. Any other string and any custom format will fail.   Normally, I'd add my comment and walk away, but here we have a very popular question, a very bad answer, and the poster is gone (has not been seen since May - which to me suggests he is dead). If that is not bad enough, the answer has 27 upvotes, for a made-up feature. I can't even edit the answer to correct it - it really has nothing...  What should be done here? Can the answer be deleted?

These 2 questions have clearly wrong answers with upvotes. And they're still getting votes.  The log file one especially could be tried out, it would fail, but someone still voted it up. A downvote and comment has no effect.  Like we have "vote to close", what about a "vote to delete" for answers. I'd suggest a fairly high rep limit. Or badge ownership realting to the question tags (eg SQL Server)   (SF)   (SO)  Could be similar to this meta question:


When I run the command:  sudo apt-get update   I got this following warning:   There is no public key available for the following key IDs: 1397BC53640DB551   This is the only warning I got and I do not get any Error.  How I can fix it and what the key 1397BC53640DB551 is all about?

I added some extra repositories with the Software Sources program. But when I reload the package database, I get an error like the following:     W: GPG error:  trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8BAF9A6F   I know I can fix it using apt-key in a terminal, according to the official Ubuntu documentation. But I would have liked to do it graphically. Is there a way to do this without using a terminal?


According to this  a severe flaw in wpa2 protocol has been published making many systems using WiFi vulnerable to an attack. Should I be worried and has a patch been issued for Ubuntu?

Today a couple of buffer overflows in NTP were announced , . It looks like updating my system to fix these issues is in order.   How can I find out if they have been fixed in the Ubuntu repositories, such that if I were to run:   sudo apt-get update sudo apt-get upgrade   then the fix would get installed and the vulnerability closed?   Edit: The selected answer specifically addresses the question of how to identify if a given CVE has been fixed or not, "Does Ubuntu generally post timely security updates?"  is certainly related but not identical


I have a manuscript that I want to submit to a journal that requires that the numbers referencing endnotes be in-line numbers in parentheses, rather than superscripts:    Is there a simple way to redefine \endnote (or \footnote) to do this?

See my picture.    Also I want to add a space between the number and note. Besides writing \endnote{ hello}, are there any formal way?  This is my source code.   \documentclass{article} \usepackage{endnotes} \renewcommand{\notesname}{References} \renewcommand{\theendnote}{[\arabic{endnote}]}  \begin{document} \section{Introduction} As traffic in Macao is a problem\endnote{ hello}, we want to do the project to find out the relationship of traffic among different sites\endnote{world}.  \theendnotes other references...  \end{document}


I know that this question has been asked before, but I am presenting my proof for verification. I do not want anyone to give me a proof or suggest a better one; I only want to know if the following proof is legitimate.  Let $A$ and $B$ be empty sets. Let $U$ be the universe in which $A$ and $B$ abide. Clearly, $U = \overline{A}$ and $U = \overline{B}$. However, this implies that  $\overline{U} = \bar{\bar{A}} = A$  and $\overline{U} = \bar{\bar{B}} = B$. Since $\overline{U} = \overline{U}$, we conclude that $A=B$, that is, the empty set is unique.

I haven't been able to figure out if the following reasoning is correct, so I'd like to have the opinion of other people on that.  The goal is to prove that the empty set is unique.  In order to do that, let $E$ be a set, $A$ be an empty set and  $B$ be an empty set. I want to prove that $A = B$.  First, I can try proving that $A \subset B$.  I know that $\forall x \in E, x \notin A$. Now I can consider this proposition : $x \in A \Rightarrow x \in B$  Since $x \notin A$, I can safely say that that the proposition above is true.  Hence, I can conclude that $A \subset B$  Am I right in my conclusion?


I am using Ubuntu 12.04 and my friend also has Ubuntu 12.04, he does not have internet so I want to send my apps to his computer (apps that I have downloaded from software center). So how can I send apps downloaded from software center to his Ubuntu computer.

I have a friend who has got a computer that is not connected to the Internet. Is there any way to install software offline easily?


I am running a server on a linux box and want to run some things for my other home computers in a virtual machine.  I would like to encrypt the VM and shut it down when nobody is home, but keep the rest of the server running. I want to prevent a physical intruder from running or examining the VM's contents without a password, like real hard drive encryption or TrueCrypt.  Also, I heard it is best to keep important data in a shared folder on the host machine, so that it can be backed up separately from the VM. I need to make sure its impossible for anything but the VM to access this data without a password.  Is there a way to encrypt the VM and the shared folder without a significant loss of performance or the ability to make backups?

I wonder what is the best practice for storing the virtual machine encrypted. I tried putting the image it a TrueCrypt volume, but it doesn't work nicely:   With the volume unmounted the VirtualBox complaints about missing VM disk, which is a bit annoying after a while. There's no way to quickly unmount the volume without shutting down the VM first (except for a dirty unmount, which is no good idea).   Maybe there's a better way or maybe a VM integrating encryption?


I have an unanswered question in math stack exchange. Probably, because I have posted it at night - but, since it is an international virtual platform, I thought I could find users who answer at any time.  I am wondering about how to give visibility to the question. I know there is the "bounty" option but when it will be available - in 2 days - I will not need it anymore.  What can I do? I have also tried to post again the question but the the website recognizes it as duplicate. Maybe, making some changes, I can overpass that restriction, but I am wondering if there is another way of.

I asked a question almost as soon as I got my account. I got a few decent answers, but none of them helped solve my problem. The question has long since become buried by newer questions, and there's still no accepted answer. Unfortunately, because there are quite a few answers with votes, to a casual observer it probably looks like the question was answered and I just neglected to mark an answer as accepted, and the system does not consider it "unanswered".  Or, I asked a question that was a bit more difficult to answer. After waiting for some time, I received no answers, little or no comments, and only a few views. The question does show up in the "unanswered" list, but no one has answered my question.  In either case, what's the protocol for me to try to get this question answered?  I see several options:   Post the question a second time, possibly linking to the original, to get attention for the original question. This is encouraged on sites like Reddit.  However, it's probably not appropriate here, since we're encouraged to check for duplicates and not submit a question that's already been asked by someone else, so this probably falls under that heading. Wait for some kind of wiki-like talk page to be implemented, then post a plea on the talk page for input and hope that activity on the talk page bumps up the question. Edit the question, but do nothing further on the Stack Exchange site. If I edit my post to say that I haven't accepted any of the current answers but am looking for more, then the question might get answered eventually by people browsing through old questions to find something they can answer. Post the question on other sites, but link to my original question on Stack Exchange. People will either answer here, or they'll answer on the other site and I can post the accepted answer here myself.  This might be considered spamming, so it might be better to do this without the link.      For more information, see the "" page in the .


Answer with a link only is bad, but if it's copy-pasted from that link, should it be deleted? I think its value isn't lost and it should be kept. The question  focuses on plagiarism, which is the lack of attribution to the original author. This question is just about copy-pasted answers, which are properly attributed. The benefits of which are saving time for the writers, but still creating a back up in case the link is dead.  Case in point:  and  Relevant:

How should I act if I discover a user plagiarizing fellow users' posts? What if I find someone plagiarizing external resources without attribution?  See also:


Is a batsman out if his helmet, bat or any of his equipment slip away from him and hit the stumps?It always confuses me

Consider the following situation,     A batsman's bat breaks while hitting the ball after which a piece of the   bat flies in the air, hits the stumps and the bails fall down.   Is this a dismissal by hit wicket?


I have COD Ghosts for xbox one and my brother has it for xbox 360.  I can see him in my friends list from the menu but I can't seem to join his game or invite him to mine.  Is this possible?

Is it possible to play against and with Xbox 360 players through my Xbox One?


I have read that mutual information only works with two random variables, and that for 3 or more RVs there seems to be a variety of different measures (synergy, partial information decomposition, and others) each with some disadvantages.   My question: how does this relate to the "multivariate-ness" of RVs. Suppose there are two multivariate RVS $$   \mathbf{X} = (X_1,X_2) $$ and  $$   \mathbf{Y} = (Y_1,Y_2) $$ From the point of calculat the mutual information between $\mathbf{X}$, $\mathbf{Y}$, is it impossible because there are actually four random numbers $X_1,X_2,Y_1,Y_2$ (and so synergy or some other measure has to be used) or is it MI between these two multivarite RVs properly defined?  The problem for me is that in describing mutual information, authors say "random variable" without clarifying whether the RV can be (or must not be) multivariate.  Edit: as seen below, several strong people say this question is a duplicate of another question that I also asked. I believe it must be true, but still do not see much relation between the two questions yet!  Specifically, I think this one is about whether MI can apply to multivariate RVs or not.  The other one is a statement about "entropy involves distrubitions, whereas MI involves RVs".  That later statement is mysterious to me, because MI also involves distrubitions (joint and marginal). And it doesn't answer whether the distrubitions can be between multivariate RVs or not.    The other question is also not answered yet. Hopefully a kind person can answer one question, or the other, and then I will see how they are the same.  (Note, in math I am already aware that for example some particular theorems are instances of the triangle inequality. So a beginner could ask about the particular theorem and not understand that it is related to a question about the triangle inequality, but a good answer could help them see why.)

In a lecture I read this statement, no explanation was given     "Unlike entropy, mutual information is a measure on random variables, not on distributions"   Can anyone explain what this means?  From the definition, both entropy and mutual information are defined in terms of the probabilities of random variables, so I have no understanding of it.  The statement is in this lecture,    p.10 in Exercise 3.2.10


I have the following question:      Assume that $α$ is a regular curve in $R^2$ and all the normal lines of   the curve pass though the origin. Prove that $α$ is contained in a   circle around the origin. (Recall the normal line at $α(t)$ is the line   through $α(t)$ pointing in the direction of the normal vector $N(t)$.)   My attempt:  I know that if $α(t)$ is contained in a circle, then the curvature is constant. So I have to prove that the curvature at $α(t)$ is constant. I also know that the equations of the normal lines through the origin that passes through arbitrary points on the curve $α(t)$ denoted as $(t, α(t))$ have the equations:  $$α(t) = \frac{t}{α'(t)}$$  I'm confused on how to proceed from here.

Let $\alpha$ be a regular curve in $\mathbb{R}^2$ and let all of its tangent lines pass through the origin. Also, let $\beta$ be a regular curve in $\mathbb{R}^2$ and let all of its normal lines pass through the origin.   How can I show that $\alpha$ is contained in a straight line through the origin and that $\beta$ is contained in a circle around the origin?  I know that the tangent line $\alpha(t)$ is the line that points in the direction of the tangent vector $T(t)$ and that the normal line of $\beta(t)$ is the line that points in the direction of $N(t)$, but how can I put this all together to complete the proof?


I tried to label a specific inline math formula in the paragraph. For a simple example,  \section{This is the third section} $a^{2}+b^{2}=c^{2}$\label{formula:1} Formula \ref{formula:1} is useful!   However, I found that \ref{formula:1} corresponds to the number of the section.  So the output by the above codes is 'Formula 3 is useful!' But What I want to label is $a^{2}+b^{2}=c^{2}$, and what I want to get is 'Formula 1 is useful!'. How can I realize it?

Is it possible to refer to a word in a sentence?   Example: Hi, I love\label{Word: Love} learning so I ask a lot of questions.   I would like to refer to the word "love" in the above sentence. For instance:   "I `ref{Word: Love}` you" would then read "I love you" but with "love" being clickable etc.   Is this possible?   (I know there are some related question here, but they are too complicated and different from the present one. I believe I have a simple and to the point question. )


I have taken  information from this  for my project report. I want to add the website link in the "bibliography" section. But I don't know how is to cite this.  Any help is appreciated. Thanks.

I'm looking to cite a number of web pages using bibtex and I was wondering if there was a specific template of the form @<template name here> for doing that. If you could use the following website as an example that would be great


Without any forces in space to stop it, assuming an object does not collide with anything or enters any kind of gravitational pull, how fast could the object spin. I mean the earth spins quite fast, but relatively not. As technically, an infinite force was to make it spin in the same direction faster and faster everyday, could it not be spinning much much much faster....like infinitely fast?

I am wondering if there is a limit to rotational speed of an object just like there is one for translation speed ? what are the implications of general relativity for rotating objects ?


I am trying to copy an excel file and rename it. For example I have a file HI.xlsx and I want to copy it and rename it as BYE.xlsx. My code to do this is below and when I run it, the file BYE.xlsx is created, but it is corrupted.   Here is what I am using:  fIn = open(r"HI.xlsx") fOut = open(r"BYE.xlsx", "w")

How do I copy a file in Python?  I couldn't find anything under .


Prove that:  a) If A is a local ring then A has characteristic zero or a power prime.  Proof.  Suppose M is the unique maximal ideal of A then $A/M$ is Field in particular integral domain then $Char( A/M ) = 0$ or $p$ with some $p$ prime.  If $Char( A/M ) = 0$ then $\forall n \in \mathbb N,  $ , $\forall a+M \in A/M $ we have that $ n(a + M )= na + M \ne M$ then $ na \notin M$ $\forall n \in \mathbb N  $, so $ n 1 \notin M $, this implies $n 1 \ne m $ $ \forall m \in M  $ $ \forall n \in \mathbb N  $ then $ n 1 \ne 0 $ $ \forall n \in \mathbb N  $ finally $Char ( A )= 0$  Suppose that  $Char( A/M ) = p $ and $Char( A ) = n$ then$ n 1 \ne m$ $ \forall m \in M  $ , so $ M + n 1 = M $ and since $Char( A/M ) = p $ this implies that $ p | n$ then $n = pq$ , so we have $ n= p^l m$ where  $ (p,m)=1$  but with this there are $ x,y\in \mathbb Z$ such that $ 1= px 1 + my 1$, so $ px 1 $ is unity or $my 1$ is unity.  Since $p 1 \in M  $ then $px 1 \in M  $ this implies $px 1 \notin A^*  $ then  $ my 1 \in A^*  $ ,so for $ a \in A$ such that $my 1 a = 1$ then $m 1$ is unity with this we have that $o(m1) = o(1)$  and since  $p^l(m1)=0$ this implies that  $$p^lm | p^l$$ then $$ m=1 $$.  Finally we get that $Char( A ) = p^l $ for some integer l and p prime.  Is this correct?  b) Let A a ring commutative with identity and with characteristic n. If $n= ab$ with $ (a,b)=1$ then A is isomorphic to the direct product of two rings,one of them is characteristic a and the other one is characteristic b.  I cannot prove this can someone help me please.

What possible characteristics may a local commutative unital ring have?  We define the characteristic of a commutative unital ring $R$ in the following way: there is a unique ring homomorphism $\phi: \mathbb{Z} \to R$ defined as $\phi(n)=n \cdot 1$. Since $\mathbb{Z}$ is a PID, $\mathrm{ker}(\phi)$ is a principal ideal. If $\text{ker}(\phi)=c\mathbb{Z}$, then we'll say that the characteristic of $R$ is $c$.   We can prove that the characteristic of a domain is either $0$ or a prime $p$. But how do we classify the characteristic of a local ring $R$ with max ideal $\mathfrak{m}$?


Why do these 2 circuits produce differen output signals (something has to do with charging/discharging capacitor)? Please explain in detail and how does the envelope detector work based on this

Why do these circuits have different output signals, please explain in detail. And how does the envelope detector work?


We always learned in the high school that electrons always orbit the nucleus (I read about, and it seems that this theory is obsolete: electrons doesn't orbit the nucleus), but I am asking my self now:  How does the electron not stops?  Where does the energy to orbit comes from?

We all learn in grade school that electrons are negatively-charged particles that inhabit the space around the nucleus of an atom, that protons are positively-charged and are embedded within the nucleus along with neutrons, which have no charge. I have read a little about electron orbitals and some of the quantum mechanics behind why electrons only occupy certain energy levels. However...  How does the electromagnetic force work in maintaining the positions of the electrons? Since positive and negative charges attract each other, why is it that the electrons don't collide with the protons in the nucleus? Are there ever instances where electrons and protons do collide, and, if so, what occurs?


Some suppliers recommend to use the original micro-usb cables for usage with there device. One example is syncing via Samsung Kies. I also exerienced that some devices seem to be realy sensitive to the cable used.   Where are the diffences comeing from (e.g. shielding, capacity, resistance)? Are different 'quality classes' for micro-usb cables defined? When I want to by a new cable, how can I be sure that it will work with all devices?  I'm more concerned about the Quality of data transfer, than on the chargeing time.

I have a set of USB cables (data and charge) and I noticed that, for a given charger, the charge time differs by cable.   What would be a good way to measure the charging fitness of a USB cable? Possibly with equipment which is not NASA-grade?  I know that I could measure the charge current for a set of charger and cable but I would prefer to assess the cable alone.   Would this measure be dependent on the charger characteristics? In other words,  are some cables more or less efficient depending on the charger (not taking into account the current the charger can sustain)?


Let $A \in \mathbb{R}^{n \times n}$ be nonsymmetric positive definite, if $A$ can be decomposed as $A = A_1 \oplus A_2$, where $A_1 \in \mathbb{R}^{p \times p}$ and $A_2 \in \mathbb{R}^{q \times q}$, $p+q=n$,  it is known that \begin{align} W(A) = Co(W(A_1) \cup W(A_2)) \end{align} where $W(A) = \left\{\frac{(Av,v)}{(v,v)}, 0 \ne v \in \mathbb{C}^n \right\}$ is the numerical range anc $Co()$ is the convex hull.  Is there a similar property for when $A = R_1^T A_1 R_1 + R_2^T A_2 R_2$ but $p + q > n$?  $R_1:\mathbb{R}^n \rightarrow \mathbb{R}^p$ and $R_2:\mathbb{R}^n \rightarrow \mathbb{R}^q$ are orthogonal projections such that their ranges have a non null intersection and the union of their ranges is $\mathbb{R}^n$, i.e. $R_1 R_2 \ne \varnothing$, $R_2 R_1 \ne \varnothing$ and $R_1^TR_1 + R_2^T R_2$ has full rank.  I know of $W(A) \subseteq W(R_1^T A_1 R_1) + W(R_2^T A_2 R_2)$ where the sum is element-wise. But I know that if $A_1$ has no kernel in $\mathbb{R}^p$ and $A_2$ has no kernel in $\mathbb{R}^q$, then $A$ has no kernel in $\mathbb{R}^n$, and this doesn't show up in the formula since $R_1^T A_1 R_1$ and $R_2^T A_2 R_2$ obviously have a kernel in $\mathbb{R}^n$.

Let $A \in \mathbb{R}^{p \times p}$ and $B \in \mathbb{R}^{q \times q}$ be nonsymmetric positive definite matrices in the sense that $v^T A v > 0, \forall v \in \mathbb{R}^p$ and $v^T B v > 0, \forall v \in \mathbb{R}^q$.  I know that $A \oplus B$, i.e. a matrix with a block structure \begin{align} \pmatrix{A & 0 \\          0 & B} \end{align} is positive definite and I also know that if $p=q$, then $A+B$ is positive definite as well.  Can I say that as well if the blocks overlap partially? When?   For instance a matrix as follows: \begin{align} \pmatrix{a_{11} & a_{12} & a_{13} & a_{14} & 0& 0\\          a_{21} & a_{22} & a_{23} & a_{24}& 0& 0\\          a_{31} & a_{32} & a_{33} + b_{11} & a_{34} + b_{12} &b_{13}&b_{14}\\          a_{41} & a_{42} & a_{43} + b_{21} & a_{44} + b_{22} &b_{23}&b_{24}\\          0 & 0 & b_{31} & b_{32} &b_{33}&b_{34} \\          0 & 0 & b_{41} & b_{42} &b_{43}&b_{44}} \end{align}


I am reading I.N.Herstein-Topics in Algebra  Question:     For $G$ a finite group. Let $|G|=n$, then $O(a)|n \enspace \forall  a\in G$.   Note: I have already proved that if $G$ is a finite group, then $\exists N\in \mathbb{N}$ such that $a^N=e \enspace \forall a \in G$ and $N\leq n$.  Proof: Suppose $\exists a\in G$ and a minimal $m\in \mathbb{N}$ such that $a^m=e$ and $m\nmid n$.  Given $G$ is finite. Therefore, we have $$a^n=e\\\text{By using division algorthim,}\enspace  n=km+r\enspace\text {for some k}\in \mathbb{N} \\ \implies a^{n-km}.\{a^m\}^k=e \\ \implies a^{n-km}.e=e \\ \implies a^{n-km}=e$$ This Contradicts minimality of $m$.  Therefore, $O(a)|n \enspace \forall a\in G$. This also proves that $N|n$.  Is My proof Correct? Any Improvements and suggestions are appreciated.

Motivated by , can one prove that the order of an element in a finite group divides the order of the group without using Lagrange's theorem? (Or, equivalently, that the order of the group is an exponent for every element in the group?)  The simplest proof I can think of uses the coset proof of Lagrange's theorem in disguise and goes like this: take $a \in G$ and consider the map $f\colon G \to G$ given by $f(x)=ax$. Consider now the orbits of $f$, that is, the sets $\mathcal{O}(x)=\{ x, f(x), f(f(x)), \dots \}$. Now all orbits have the same number of elements and $|\mathcal{O}(e)| = o(a)$. Hence $o(a)$ divides $|G|$.  This proof has perhaps some pedagogical value in introductory courses because it can be generalized in a natural way to non-cyclic subgroups by introducing cosets, leading to the canonical proof of Lagrange's theorem.   Has anyone seen a different approach to this result that avoids using Lagrange's theorem? Or is Lagrange's theorem really the most basic result in finite group theory?


New to bpy and I'd like to write some code that sets the shading of an object to smooth by just clicking a button. I did some research and I have written the following lines for now: import bpy  def draw(self, context):     layout = self.layout     row = layout.row()     row.operator(" bpy.ops.object.shade_flat()")     row = layout.row()     row.operator(" mesh.object.shade_smooth()")  I assume that I would have to add some other lines in order to register the class and all that right? Anyway, the problem is that the code does not work. Is this the way it is supposed to work at all? Q: What's the correct way to call this function when pressing a custom button?

So I wish to create and object and set it's shading to 'smooth' using python. It seems simple enough but after trying every method I could find on the internet none of them worked for me. Here's a short example script where the object needs to have smooth shading:  import bpy from mathutils import Vector  verts = [(0,0,0),(0,5,0),(0.25,5,0),(0.25,0,0),(0,0,5),(0,5,5),(0.25,5,5),(0.25,0,5)] faces = [(0,1,2,3), (4,5,6,7), (0,4,5,1), (1,5,6,2), (2,6,7,3), (3,7,4,0)]  grat1mesh = bpy.data.meshes.new("grat1") grat1obj = bpy.data.objects.new("grat1", grat1mesh) grat1obj.location = (5, -5, 0) bpy.context.scene.objects.link(grat1obj) grat1mesh.from_pydata(verts,[],faces) grat1mesh.update(calc_edges=True)  grat2obj = grat1obj.copy() grat2obj.data = grat1mesh.copy() bpy.context.scene.objects.link(grat2obj) grat2obj.location += Vector((-0.125, 1.25, 1.25)) grat2obj.scale = (2, 0.5, 0.5)  bm = grat1obj.modifiers.new("Chop", 'BOOLEAN') bm.object = grat2obj bm.operation = 'DIFFERENCE' bpy.context.scene.objects.active = grat1obj bpy.ops.object.modifier_apply(modifier=bm.name) bpy.context.scene.objects.unlink(grat2obj)   I found this online and tried to place it at the end of the script:  smoothings = [] smoothings.append(face.use_smooth) me_ob.faces.foreach_set("use_smooth", smoothings)   However this just returned an error on the second line, perhaps as it was from an older website. Obviously using a simple bpy.ops.object.shade_smooth() didn't work and I'm kind of stumped as of what to do here!


We have a script that is used to sync some directories to a USB disk drive. It is set to run once a day but often takes longer than that.   To ensure that multiple copies of the script don't run at the same time, we check the list of processes and if our script is present, we immediately exit.  #!/bin/bash  #check if we are already running running=$(ps aux | /usr/bin/grep -i "usb_sync" | /usr/bin/grep -v grep | /usr/bin/grep -c bash) echo "usb_sync $running" >/opt/local/backup/usb_sync_log #If we are, the quit if [ $running -gt 1 ] ; then   exit 0 fi   The problem is that this check works fine when running it via sudo and manual invocation through the CLI. However when it is run through cron, it will start regardless. I have tried a couple of different variations but they all seem to run.  This is on FreeNAS 11.2.

I have scheduled a cron job to run every minute but sometimes the script takes more than a minute to finish and I don't want the jobs to start "stacking up" over each other. I guess this is a concurrency problem - i.e. the script execution needs to be mutually exclusive.  To solve the problem I made the script look for the existence of a particular file ("lockfile.txt") and exit if it exists or touch it if it doesn't. But this is a pretty lousy semaphore! Is there a best practice that I should know about? Should I have written a daemon instead?


The goal of this section is to analyse the features introduced in Section 3 for boilerplate detection.   In books and papers, we see "Figure 1", "Chapter 2", "Section 1", "Table 2". Why are they capitalized?   From my searching, this is recommended by academia, but what is the grammar for it - why no article? Can such things be regarded as proper names? For example we don't say Page 10. I don't think it's a duplicate as I asked for the reason for it.

Should I write "headers" like chapter, section, etc. with capital letters?  I think I have seen both; therefore I am not sure.  As an example, if I write something and want to refer to a specific chapter/section (they are numbered):     "As we have seen in chapter/section [x]..."


How do I split a 7GB (movie) file into smaller files of (say) 1GB, and then (in another Ubuntu computer) integrate them to get the original file (using just bash commands)?

I have a large file (8GB for Example). How can I split it into multiple parts, let's say 3 equal parts, and after that how do I integrate them later?


I used G Suite for sending emails and the problem was that my mails were in in spam because they were sent from the Google servers, some of these IP's are on the popular blacklist now. Google knows about this problem and they said: "We're trying to arrange with blacklist support, so you should wait and maybe in future all will be OK". Of course this variant I don't like.  I have a correct DKIM / DMARC / SPF records in my domains. Spam score (I used  for testing) was always near 8/10. Because the sender IP was in ~4 blacklists.  So I decided to use the Zoho Mail hosting. I set up one of my domains and go to Zoho. But the problem is the same: my emails are going to spam (on Gmail and others mailboxes). All checks are good, spam score on Mail Tester is 10/10, sometimes sender IP was just on 1 blacklist (Mail Tester said that IP isn't on any blacklist).  Also, I opened the original message and ALL checks are 'pass'.  What can be the problem? Any suggestions?

This is a  about how to handle email sent from your server being misclassified as spam.  For additional information you may find these similar questions helpful:                    Sometimes I want to send newsletters to my customers. The problem is, that some of the emails get caught as spam messages. Mostly by Outlook at the client (even in my own Outlook 2007).  Now I want to know what should be done to create "good" emails. I know about reverse lookup etc., but (for example), what about a unsubscribe link with an unique ID?  Does that increase a spam rating?


I'm having some trouble finding ideals in general. The problem I'm stuck on is:  Find all prime and maximal ideals of $\mathbb{Z}_2 \times \mathbb{Z}_4$.   I know that a finite integral domain is a field, which means the prime and maximal ideals are the same. That means I just have to find one or the other, right? But I don't really know how to go about finding ideals for $\mathbb{Z}_n \times \mathbb{Z}_m$. Any help would be great. Thank you!

Let $S=\prod_{i=1}^{n}{R_i}$ where each $R_i$ is a commutative ring with identity. The prime ideals of $S$ are of the form $\prod_{i=1}^{n}{P_i}$ where for some $j$, $P_j$ is a prime ideal of $R_j$ and for $i\neq j$, $P_i=R_i$.


I have an LI which I'm adding classes to dynamically.   I need to check if the LI has a certain class that was inserted dynamically and insert another class into it.   How is is this possible?  More explanation: After DOM loads the LI looks like this:

   After dynamically inserting a class the LI looks like this:

   Now I need to check if the LI contains the class "correct"

I'm working with jQuery and looking to see if there is an easy way to determine if the element has a specific CSS class associated with it.  I have the id of the element, and the CSS class that I'm looking for.  I just need to be able to, in an if statement, do a comparison based on the existence of that class on the element.


Really confusd here. PHP is working until it gets to an IF statement any suggestions / help greatly appreciated.  $sql2=("SELECT * FROM temporders WHERE cusid='$myid'"); $result2=mysqli_query($connP,$sql2); $count2=mysqli_num_rows($result2); $total=0; $itemNum=0; if ($count2>0) {     while($row2 = mysqli_fetch_array($result2, mysqli_ASSOC)) {     $total=($total+($row2['price']*$row2['qty']));     $itemNum=$itemNum+$row2['qty'];     } } if ($total<1) { $total=0; } else { $total=number_format($total, 2, '.', ''); } ?>
   All of the bove works perfect until it gets to here which is the next stage it produces this when i view the page source code. All php is showing from this stage onwards
 <? if ($total==0) { ?> <form action="../customer-page.html" method="get" name="cart" id="cart"> <?     } else { ?>     <form> <? } ?>       <input type="hidden" name="page" id="page" value="southern-spas-saunas.html" />       <input type="hidden" name="delitem" value="0" />       <input type="hidden" name="myid" value="202003220001" />

   <input name="image2" type="image" value="Process" src="../1basket.gif" />	   Total &pound; 0	   Items 0

     </form>

Here's the information :     There are four different pairs of   opening and closing tags which can be   used in PHP. Two of those, <?php ?>   and <script language="php"> </script>,   are always available. The other two   are short tags and ASP style tags, and   can be turned on and off from the   php.ini configuration file. As such,   while some people find short tags and   ASP style tags convenient, they are   less portable, and generally not   recommended.   In my experience most servers do have short tags enabled. Typing  <?=   is far more convenient than typing  <?php echo    The programmers convenience is an important factor, so why are they not recommended?


I carved a sign and my wife says that the message does not sound grammatically correct. Can you help?

What is the correct verb tense for the phrase "all you need is", when what follows is a plural?   All you need is paintbrushes and paint. All you need are paintbrushes and paint.   Or is neither incorrect?  Both forms sound funny to me.  Google shows an order of magnitude more hits for  than , but the latter still has ~500K hits, so it seems that both forms are in common use.  (You can also examples of both usages in Google's "News" search.)    Consider a related example:   All is good. All are good.   Both forms are correct, but have slightly different meanings/contexts.  The first is correct if "all" refers to "everything" (singular); the second is correct if "all" refers to an implied concrete set of things, as in "all (the widgets) are good".  This line of reasoning seems to imply the latter form is correct, since "paintbrushes" are concrete things.  (And yet that seems to be the less popular form in common usage, judging by Google hits).


When stored out in the open they can last up to 2 hours at room temperature, but how long can they last in an air-tight container at room temperature?

If I left food out of the refrigerator for some period of time, is it still safe? If I left it out too long, can I salvage it by cooking it more?


During night, when all the lights are off and it is very dark in the room, I noticed that my bedroom lights turn on barely when a light is turned on in another room. The light is very barely visible and I would not notice them if it was during the day, only when it is very dark. I am using Philips Hue in my bedroom.

I have two LED lamps in my corridor, and when I switch them off, they keep emitting light (not very strong, but it's annoying at night).  What can it be? How can I fix it?


I am trying to run a small script which check for two variables to see if they are empty or not. I am getting the correct output but if also shows me error for missing right parenthesis. I tried using double parenthesis as well as round bracket but didn't work.  var="" non="hi"   if ([ -z "$var"] && [ -z "$non"]) then     echo "both empty"  else     echo "has data" fi   OUTPUT:  line 6: [: missing `]' has data

I am using the below script to move two days back when script runs at starting two days of the year and also check first and second days of every month and move two days back. if [$month="01"] && [$day="01"]; then         date="$last_month/$yes_day/$last_year"         fulldate="$last_month/$yes_day/$last_year" else         if [$month="01"] && [$day="02"]; then                 date="$last_month/$yes_day/$last_year"                 fulldate="$last_month/$yes_day/$last_year"         else                 if [ $day = "01" ]; then                         date="$last_month/$yes_day/$year"                         fulldate="$year$last_month$yes_day"                 else                         if [ $day = "02" ]; then                                 date="$last_month/$yes_day/$year"                                 fulldate="$year$last_month$yes_day"                         else                                 date="$month/$yes_day/$year"                                 fulldate="$year$month$yes_day"                         fi                 fi         fi fi  But my bad am getting the below error message Etime_script.sh: line 19: [06=01]: command not found Etime_script.sh: line 24: [06=01]: command not found