How can we implement singleten design pattern in iphone code
What should my Objective-C singleton look like?
Is there an easy way of getting the charset and collation of the DB tables in WordPress without resorting to SQL queries? I usually disconnect my cellphone from the charger some time after it's fully charged because I'm afraid the battery could lose capacity over time if I don't. However, I believe modern electronics should be able to handle this kind of scenario and automatically stop charging the battery once it's full. Does this apply to modern Android phones? Or do I need to continue disconnecting it all the time? I am creating a query that finds the shortest path from dangerous crossing nodes to hospitals (many-to-many). I have the proper output from pgr_dijkstra, with output as follows  seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost  -----+----------+-----------+---------+------+------+------+----------    1 |        1 |         2 |       3 |    2 |    4 |    1 |        0    2 |        2 |         2 |       3 |    5 |    8 |    1 |        1    3 |        3 |         2 |       3 |    6 |    9 |    1 |        2    4 |        4 |         2 |       3 |    9 |   16 |    1 |        3    5 |        5 |         2 |       3 |    4 |    3 |    1 |        4    6 |        6 |         2 |       3 |    3 |   -1 |    0 |        5    7 |        1 |         2 |       5 |    2 |    4 |    1 |        0    8 |        2 |         2 |       5 |    5 |   -1 |    0 |        1   I am trying to use st_makeline to create seperate lines for each individual node path, however thus far the function has been creating one big line SELECT  st_transform(st_makeline(t1.the_geom),4326)         FROM pgr_dijkstra(                 'SELECT osm_id as id, source, target, cost FROM spatial.melbourne_edges',                 array(select hospital_id from hospitals_in_vicinity),                  array(select crossing_id from dangerous_crossing_nodes), false) as route                 inner join spatial.melbourne_nodes t1 on route.node = t1.id --);  How am i able to make a column of all the different paths? When to use a GAM vs GLM I realize this may be a potentially broad question, but I was wondering whether there are assumptions that indicate the use of a GAM (Generalized additive model) over a GLM (Generalized linear model)? Someone recently told me that GAMs should only be used when I assume the data structure to be &quot;additive&quot;, i.e. I expect additions of x to predict y. Another person pointed out that a GAM does a different type of regression analysis than a GLM, and that a GLM is preferred when linearity can be assumed. In the past I have been using a GAM for ecological data, e.g.:  continuous time-series when the data did not have a linear shape I had multiple x to predict my y that I thought to have some nonlinear interaction that I could visualize using &quot;surface plots&quot; together with a statistical test  I obviously don't have a great understanding of what a GAM does different than a GLM. I believe it's a valid statistical test, (and I see an increase in the use GAMs, at least in ecological journals), but I need to know better when its use is indicated over other regression analyses. Conformally Map Region between tangent circles to Disk Can't see a glass object through another glass object in Eevee I was just testing Eevee and found that you cannot view a glass object through another glass. Is there any workaround? It works fine only If I rotate the glass window or put my camera to the back side of the scene Let us say you are in an inertial reference frame with a circular planar disk. If you take your meter measuring rods (or perhaps tape measure) you can find the diameter and circumference of the disk. If you divide the circumference by the diameter, you will get exactly $\pi$. Now you start rotating the disk. A book I have claims that now the ratio will be different (lets call it $\pi_\circ$ to avoid ambiguity.) This has caused to reevaluate my understanding of special relativity (this is a set up to general relativity, but the problem itself only requires the special theory.) My problem is that, sure, the measuring rods (or tape) would contract on the circumference, but wouldn't the circumference contract a similar amount, therefore giving a measurement of $\pi$ in every reference frame according to your own measuring rods. Of course, this reasoning goes on to make me question how I understood all of special relativity up this point. What is the difference between "gender" and "sex"? What is the difference between gender and sex?  says that gender is The mental analog of sex but that's too high English for me.  Basically, I'm developing a web-application that stores people's profile along with a field for gender/sex. Which name would be more appropriate?  __  [UPDATE]  After getting these good answers, I can figure out that,   Sex - Biological characteristics  Gender - Social characteristics   And, well, for my web-application, I went with the term sex, as it sounds more scientific and less political. P.S. Values for sex are clearly defined and can be easily validated (only two values * + an optional blank value).  * plus some anomalies. This code is part of a larger code that generates an Arithmetic Quiz, although the code I have show below just saves the score that the user got on the test and their name. When saving the code it checks if the user has taken the quiz before. If the user has taken the quiz before it saves it as 'Older Score' or 'Oldest Score', however if the user has not taken the quiz before it generates a new row for them. Additionally it works out the average score and highest score for all users it has the data for. For my task I'm supposed to make the code as short as possible.  name = ""+first_name+" "+last_name rows_data = [] class_file_names = ['Class 1.csv', 'Class 2.csv', 'Class 3.csv'] scan = open(class_file_names[int(math_class)-1], 'r+') rows = csv.reader(scan) for row in rows:     rows_data.append(row) scan.close() class_file_names=['Class 1.csv', 'Class 2.csv', 'Class 3.csv'] csvfile=open(class_file_names[int(math_class)-1], 'w', newline="") fieldnames = ['Student Name', 'Oldest Score', 'Older Score', 'Latest Score', 'Average', 'Highest'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() nameFound=False for x in rows_data[1:]:     if x[0] == name:         x[3]=x[2]         x[2]=x[1]         x[1]=str(score)         x[4]=(int(x[1])+int(x[2])+int(x[3]))/3         x[5]=max(x[1],x[2],x[3])         nameFound=True     writer.writerow({'Student Name': x[0], 'Oldest Score': x[3], 'Older Score': x[2], 'Latest Score': x[1], 'Average': x[4], 'Highest' : x[5]})  if nameFound==False:     writer.writerow({'Student Name': name, 'Latest Score': score, 'Older Score': '0', 'Oldest Score': '0', 'Average': score, 'Highest': score}) csvfile.close() input("Test complete! Press anything to close.") What is the proof that given a set of $n$ elements there are $2^n$ possible subsets (including the empty-set and the original set). Irreducible polynomials and affine variety Let $k$ be any field, and let $f,g\in k[x,y]$ be two irreducible polynomials such that $g$ is not divisible by $f$. Prove that $V(f,g)\subseteq A_k^2$ is finite. C# Mono - Low Level Keyboard Hook I'm using code that I found on the .  The only problem is it uses external DLL calls that don't work in mono.  I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using .net, and Linux using mono?  Edit:  Clarifying what I'm trying to do: I'm making a .  The program sits in the system tray and when the user presses the hot-key, it will pop up all the gadgets.  So the program doesn't have focus, so typically it won't catch any keystrokes, so I'm using the low-level keyboard hook and I hook the two keys that the user defines as the hot-keys.  But I'm using a Windows DLL call for that, which doesn't work in Linux using mono.  So I'm wondering if there's a way to do the same thing, but will run in Linux using mono? What test can I use to compare slopes from two or more regression models? Get the row and column name of the minimum element of a matrix UK Visitor Visa: Required Time or Interval Between Visits? I am a US citizen and have recently visted the UK  with simply a passport which allowed me to vist for 6months I have heard rumors that I am obligated to stay in the US for a Equal amount of time that I have visited the UK before I am able to return, but I am struggling tour no any proof of this obligation .. Am I missing somthing or is it simply not true I'm trying to create a multi-page table with all cells having the same height (as well as certain fixed widths) so that certain manual cut-and-paste operations are a lot easier.  One issue is that one column in particular is text-heavy and should line-break within the cell.  As I don't want it justified, I looked into alternatives such as .  This is doing exactly what I want for horizontal alignment.  For vertical alignment, I've looked at  and the \vphantom method detailed in the above link doesn't seem to be working.  Here's what I'm currently working with:  \documentclass[11pt]{article} \usepackage{array}  \newcolumntype{P}[1]{&gt;{\raggedright\hspace{0pt}\arraybackslash}p{#1}} \def\Z{\vphantom{\parbox[c]{1.7in}{\Huge Something Long}}}  \begin{document} \begin{tabular}{| c || P{0.5in} || P{0.5in} || P{5in} |}\hline  1.  \Z &amp;&amp;&amp; Long long long long long long long long long             long long long long long long long text  \\\hline 2.  \Z &amp;&amp;&amp; More long long long long long long long long             long long long long long long long text  \\\hline \end{tabular}   When I compile, the cells do not have a uniform height, and none of them are as large as 1.7 inches vertically.  So this suggests that somehow the \vphantom method is failing.  Does anybody know of a relatively straightforward solution to this problem? So I currently have this issue where my Epson WF-3620DWF can't find the blue and yellow cartridges. (They are official epson ones) and I have a full black cartridge in there. How do I force my printer to ONLY print in black and ignore the cartridge(s) not recognised error? How to draw a picture by using tikz as backgroud of a character? I am writing some Chinese character and hope to draw simple pictures by tikz and use it as background of this chinese characters. In a short I'd like to get some results as this picture (ignore the lower right noise):    How could I do? Thanks in advance. As an example for least workable code:  \documentclass{article} \usepackage[CJKnumber]{xeCJK} \setmainfont{KaiTi}  \begin{document} \Huge 明月出天山 \end{document} Generalized RBF Kernels There is the notion of Generalized RBF Kernels, for example in "Towards Optimal Bag-of-Features for Object Categorization and Semantic Video Retrieval" from Jiang (1) or in formula (2.72) in  (2).  They define: Gen. RBF Kernel: $e^{-pd(x,y)}$, where (1) says d can be any distance function and (2) requires it to be a metric.  I now have been wondering for a long time: Is a function defined by $e^{-pd(x,y)}$ where d is a metric always a Mercer's Kernel? I think in (2) it sounds like it, but if it were true, not many people know of it, since they are still looking to prove that $e^{-EMD(x,y)}$ is a kernel, where EMD = Earth Mover's Distance, which is a metric.  If its not a Mercer's Kernel - do you know of any counter example? How to get rid of notch at pgfplots axes intersection?