Press On Hold Off Power Switch

Question: Hi everyone I am hoping someone here can help me.
I am trying to make an arduino turn my project on and off.Using a relay.
I am looking for it to act like a computer power button.
A short press to turn on and them stay on and a long press (say 5 sec) to turn off and then stay off till button is pressed again.
I would like it so that the project can not be accidentally turned off
Can anyone please help.
Thanks
Comment: What have you tried so far, and what part is giving you difficulty? If you need a hint to get started, you code will need to store the relay state (on/off), measure the time of  each button-press, and compare the time to the length of a short-press or long-press, depending on the current state.
Comment: Hi JRobert after spending the best part of 2 days looking around the web. Reading posts looking at you tube videos. I cant find an example to do this. The Arduino IDE as a button on, off, example in it. But I need a long press to turn off. To prevent accidental power off. Basically I want a pin to go high on a short press. and only go low if it sees a long press of say 5 secs. So if the button is pressed accidentally it will do nothing unless the press is long.
Answer: To clarify the problem, do you want to control ON OFF using Arduino? It is very simple. Please read this simple tutorial, and modify it according to your needs.
Comment: This is not what @David Boswell is trying to do. A short button press turns on the relay, and the user must press and hold the button down for 5 seconds to turn the relay off. The button in the link of the tutorial turns the relay on, then automatically turns the relay off after 5 seconds has elapsed.
Comment: @VE7JRO yes of course with small modification. jees.
Comment: You hit the nail on the head..VE7JRO. that is what i need to do. Press and hold to turn off
Answer: Here is a test sketch that I wrote for a different question. The other question's requirement was for a short press (minimum 100ms) to turn on an LED, and a long press (1 second) would turn it off. With a slight modification of this sketch, it may work for you. You will need to install the Bounce2 library.

// Press and hold button for 100 ms to turn LED ON.
// Press and hold button for 1000 ms to turn LED OFF.
#include <Bounce2.h>

byte buttonState = 0;
const byte ledPin = 3;
const byte buttonPin = 2;
const unsigned long debouncerInterval = 50;
unsigned long buttonPressedTime = 0;
unsigned long currentMillis = 0;

Bounce debouncer = Bounce();

void setup(){
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  debouncer.attach(buttonPin, INPUT_PULLUP);
  debouncer.interval(debouncerInterval);
}

void loop(){

  // Get the current time.
  currentMillis = millis();

  // Check if button was pressed or released.
  if(debouncer.update()){

    // Pressed.
    if(debouncer.read() == 0){
      if(buttonState == 0){
        buttonState = 1;
        buttonPressedTime = currentMillis;
      }
    }

    // Released.
    else{
      buttonState = 0;
    }
  }

  // Turn the LED ON or OFF.
  if(buttonState == 1){
    if(currentMillis - buttonPressedTime >= 1000){
      digitalWrite(ledPin, LOW);
      buttonState = 0;
    }
    else if(currentMillis - buttonPressedTime >= 100){
      digitalWrite(ledPin, HIGH);
    }
  }
}

Comment: Thank you so much for your help it works great. I just changed the buttonPreeedTime from 1000 to 5000 and it dose everything I wanted... Thank you so much

Press On Hold Off Power Switch


Short story - Moon's farside

Question: I am pretty sure this story dates from the 1940's or 1950's. The first lunar expedition orbits the moon and discovers it is only a façade made of wood and canvas.
Comment: I haven't read it yet but I can't believe there are two SF stories with the same punchline. Thanks for your help.
Comment: Once you've confirmed, please be sure to formally accept the answer by clicking the checkmark near its top left. You are the only one that can do so, and accepted answers are important for the moderators' efforts to manage duplicate questions. Welcome to the site!
Answer: Thanks to the unique image, this is likely to be the short story "Ideas Die Hard" by Isaac Asimov, originally published in the October 1957 issue of Galaxy. The store may be read online in its entirety thanks to archive.org.
It has also previously been asked about and answered here, in the question:
Help identify the title of a story about the back side of moon being missing
The unaccepted answer (by user John Rennie) to that question contains the relevant quote from the passage you recall:

But Oldbury still looked at the Moon. It was terribly close and now
the surface was moving quickly. They were starting the swing in
earnest and Oldbury's scream was high-pitched. "Look! Lookathat!" His
pointing finger was stiff with terror.
...
"You saw it. You saw the hidden side of the Moon as we went past and
you saw there wasn't any! Good Lord, just sticks, just big beams
holding up six million square miles of canvas. I swear it, canvas!"
Comment: John Rennie's answer was unofficially accepted by the OP in a comment which was posted as an answer and deleted by a moderator: "thank you so much for pointing out the title of the story and the author. I just read it and contrary to Isaac Asimov's introduction I think it's still a pretty good story. [. . .]"

Short story - Moon's farside


HDD with windows OS not connecting to linux via usb to sata adapter

Question: I have an internal hdd from a windows computer. The computer suddenly started giving the message "No bootable device" during startup. So I would like to recover some of the data from the drive. To do this I figured I would connect it to my linux computer using a usb to sata adapter. but the hard drive is not being recognized. dmesg is not even reporting anything when I connect the usb. There is no physical damage to the drive as far as I can tell. It turns on properly, and I can feel the vibration of the drives spinning. I also know that the adapter is not faulty, I tested it with another drive. So is there anything else I can try, or is this drive a lost cause?
Comment: what happened with the other drive? how old is the disk? the host of the failed disk, is it a  notebook? Have you tried another USB port? often USB ports  are not all created equal in the same machine. How about dmesg in the original machine?
Comment: @RuiFRibeiro The original machine is (1) windows (2) not able to boot (i.e. "No bootable device" is found by the machine) so I can't use dmesg on it. I suppose I could use a linux bootable flash drive on the original machine. Though I don't see it making much of a difference. I am confident that the usb cable is not a problem. The cable is a raw interface, it doesn't have any driver associated with it, so I don't have any reason to to believe it would work for one drive and not the other. Thanks for the tip.
Comment: If the disk isn't recognized by either controller then it's toast, though you should at least see *something* in `dmesg` when you plug in the usb adapter.
Comment: not if the internal disk controller is dead as I posted, psusi. The internal disk electronics seems kaput.
Answer: I would be inclined to say the USB adapter seems to be needing an external source of energy (e.g. USB power alone is not enough to keep using the disk)
However, the fact that you are hinting the adapter works with another disk and both devices do not seem to see the disk points more to a dead disk internal controller.
I have had colleagues in the past that changed controllers from disks of exactly the same model with success. If the data is important, it can be worthwhile trying to buy second hand an old or mechanically damaged disk of exactly the same make and part number.
Comment: You are right in thinking that the usb power alone was not enough, however the usb cord has a third port to connect to a second power source, which is how I had it set up; so I know that is not an issue. I think you may have it right about the disk controller though. But not something I have the expertise to do. Thanks for your answer.
Comment: He's already tried two different disk controllers ( the native one, and the USB one ), so that rules that out.
Comment: The disk controller that is INSIDE the disk enclosure (from western digital, Seagate or whatever). If you open a disk, you will see a tiny board there. "...that changed controllers from disks of exactly the same model...". There is indeed a controller on the PC side that talks to a controller inside the disk. This weekend I got a storage medium from my wife that has exactly the opposite problem...it is recognised and the driver is loaded because the controller is fine, however the medium is damaged.
Comment: So it was actually because the OP gave the very useful information that two different adapters are not able to see the information of the disk that I ruled out it is the internal controller of the disk. Edited slightly the post for it to become more evident.


Getting iso from mirrors

Question: How do I download the ISO file for a Linux distro from a mirror site? When I open mirrors, it shows a directory with multiple files. What exactly are they?
Comment: I don't understand what you are actually asking, but downloading an Ubuntu ISO from a local mirror is not hard; you go to [Official CD Mirrors for Ubuntu](https://launchpad.net/ubuntu/+cdmirrors), pick your mirror, open it, choose your release, and download the desired ISO image.  For example, `http://ubuntu.mirrors.telekom.ro/ubuntureleases/18.04/ubuntu-18.04-desktop-amd64.iso`.
Answer: Mirror sites don't just hold one file, but many.  They're a convenience to users, so they can get Ubuntu without delays caused by slow data lines, or delays caused by a mob of users all downloading from the same site at the same time.
The public directory you are pointed in an authorized mirror, such as http://mirror.vutbr.cz/ubuntu/releases/ may have many different distros for Ubuntu, with multiple release numbers, as well as multiple flavors which use different desktop environments, as well as a distro with none at all, the server distro. Distros almost end in .ISO, because they are an 'image' of an entire DVD or CD in one file. Start by picking the version you want, e.g., http://mirror.it.ubc.ca/ubuntu-releases/16.04.4/ and then you will see multiple files, including ISOs.
That directory also has checksums, text files containing a hexadecimal string (like 0123456789ABCDEF), made by other open source programs. When you run a checksum app and point it at the distro you just downloaded, the checksum app gives you a hexadecimal string you compare with the contents of the checksum for the distro.
If they match, then your ISO file arrived intact; if they don't, you need to redownload the ISO because it was corrupted in transit, and installing from it will just waste your time.
Comment: But I am unable to get the iso from mirrors. Like I want to download damn small linux's iso, there are so many files. How to find iso in them?
Comment: Damn Small Linux is not an Ubuntu release so is not supported here. http://www.damnsmalllinux.org/download.html lists the DSL mirrors; for other non-Ubuntu distros, search for them at http://distrowatch.org/ or with Ye Olde Google.
Comment: And, if you find an answer here solves your issue, please click on the checkmark at upper left to show it worked for you.
Answer: In, short, when see that huge list of files, all you have to do is click the one that includes ".iso" at the end.

Getting iso from mirrors


Appropriate oil viscosity for the inside of a freewheel body

Question: Without taking one apart, I have seen people spraying WD40 into a freewheel body to clear it out, and then dripping Phil's tenacious oil into it for lubrication. The thickest stuff I have available at the moment is wet-weather chain lube. Will this work or destroy the freewheel? How important is viscosity here?
Comment: Proper maintenance can only be done by taking the freewheel/freehub apart which may sometimes be arduous. For specifications about lubricants you should always refer to the manufacturer. You'll find many related videos on the Net. The WD40 etc procedure will probably do more damage than good as chainlube will stiffen and the freewheel may stop working properly.
Answer: The only freehub-specific lube I have found is from Dumonde Tech. They offer a freehub lube in both oil and grease form; depending on your preference. Those are what I use when servicing my rear wheels. Cleaning with WD-40 isn't bad practice as it's just a water displacement solution (Thus the "WD") and only imparts a very, very light lube to whatever surface it covers. I use it for cleaning bike and motorcycle parts all the time and to add some protective covering to parts with exposed raw metal.


How can I copy all meta tags, other than the thumbnail, from a source jpg to a destination jpg?

Question: I just started to use the EXIFTool but can't figure out how to copy all meta info from one file to another without destroying the destination file's thumbnail image. Is there any way to do so ?
Comment: [Here](http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html#tag_operations) it's described how to exclude a tag from extraction. Please try that, edit your question if this doesn't work or submit as an answer if it works. Maybe a possible workaround: backup the destination file, copy all metadata (including the thumbnail) from the source and after that copy the thumbnail from the backup to the destination.
Comment: Could you post two pictures of yours to work with (a source and a target)?
Answer: Save the thumbnail first:

exiftool -b -ThumbnailImage destination_image.jpg > destination_thumbnail.jpg

Then mess with all the metadata (copy from source, write into destination), and meanwhile destroy the destination thumbnail, no problem. E.g.

exiftool -tagsFromFile source_image.jpg -XMP:All= -ThumbnailImage= -m destination_image.jpg

Note that you can do any other metadata manipulation as well.
When you are done, copy back the saved thumbnail:

exiftool '-ThumbnailImage<=destination_thumbnail.jpg' destination_image.jpg
Comment: I tried with **exiftool -tagsFromFile src.jpg -XMP:All= '-ThumbnailImage<=dst.jpg'-m dst.jpg** and it did not worked :/ src.jpg, dst.jpg, exiftool was in the same directory
Comment: The three commands in my edited answer should be fine. (I am using a custom-compiled exiftool, and that one supported the functionality, but I removed that line now.)


Intuitive meaning of Newton (units)

Question: Is there any intuitive reasoning behind why the units of a "Newton" is $kg \frac{m}{s^{2}}$ and how it represents force? I always wanted to understand why objects of different mass fall at the same rate on earth and I found an explanation that uses Newtons Second Law of Motion and it made sense, but I'm confused as to why the units of force have this weird formula. Did Newton just use those units to make his second law work out mathematically via cancelling? Or is there some way to interpret $kg \frac{m}{s^{2}}$ as meaning force? Any insight would be appreciated.
Answer: This is precisely the type of question I've started asking my introductory students. There's indeed an underlying intuition with units. Consider a free particle. It moves through space with constant momentum. If a force acts on that particle, its momentum will change. Remember that momentum is a vector and a change in a vector can involve a change in magnitude, a change in direction, or both (any arbitrary change in a vector can be decomposed into a change in magnitude parallel or antiparallel to the vector and a change in direction perpendicular to the vector). If you look at the units of force $\mathrm{kg}\cdot\mathrm{m}/\mathrm{s}^2$ and think of it as $\frac{\mathrm{kg}\cdot\mathrm{m}/\mathrm{s}}{\mathrm{s}}$ you can see it's the quotient of momentum to time (more correctly, duration because it's a time interval rather than a clock reading). So, think of a force of $X\;\mathrm{N}$ acting on a particle as being the how much momentum the particle gains or loses for every duration of one second that elapses. That's easiest to understand and visualize if the force is collinear with the particle's momentum. It's a bit more difficult to understand when only the direction of the particle's momentum changes, as in uniform circular motion.
So, a force of $12\;\mathrm{N}$ acting on a particle means that the particle's momentum changes by $12\;\mathrm{kg}\cdot\mathrm{m}/\mathrm{s}$ for every $1\;\mathrm{s}$ duration that elapses.
Comment: This relationship is most easily seen through the relation $F = dp/dt$.
Comment: Yes, plus it's valid relativistically since $\vec{F}=m\vec{a}$ is a low speed approximation to $\vec{F}=\frac{\mathrm{d}\vec{p}}{\mathrm{d}t}$.
Answer: The units of a new physical quantity will be defined when you define the quantity itself. So if you define force by $F = ma$, then it will have units of mass (e.g. $\mathrm{kg}$) times acceleration (velocity per unit time, e.g. meters per second squared). If instead you define force as the time-derivative of momentum, then it is the units of momentum (mass times velocity) divided by the units of time.
If you wanted to start with force as primitive, you could do that, calling the unit $\mathrm{N}$. Then perhaps mass would be the thing defined in $F = ma$, and the unit of mass would be that of force per unit acceleration, e.g. $\mathrm{N}/(\mathrm{m}/\mathrm{s}^2)$, which we could abbreviate as $\mathrm{kg}$, and this would serve as a definition of the kilogram.
It all depends on where you take your starting place to be. As a side note, the development of mechanics was muddled at first because people used the word "force" and similar words for a whole variety of related concepts without appreciating the differences. Today we have separated these cleanly into forces, momenta, accelerations, inertia, kinetic energy, potential energy, etc.
Comment: So if I understand you correctly your saying that there is no intuitive meaning behind the units in this case, rather the units are generated as a result of creating a new physical quantity (in this case force). Is this correct?
Comment: I guess I'm saying don't look at all four parts (kg, m, two copies of seconds) together. Instead decompose it into a product or quotient of things you already understand.
Answer: In as few words as possible,
$F=ma$, so $F=({\rm kilogram})\left (\frac{\rm meter}{{\rm second}^2}\right)$, so $N=\frac {\rm kilogram\cdot meter}{{\rm second}^2}$

Intuitive meaning of Newton (units)


tracking and progress in a Kanban

Question: How can we measure the progress of a task in Kanban?
Also will there be an estimate for a task or is it simply saying that focus on the task and finish it rather than sticking to the deadline ?
Comment: You may want to consider revising the second sentence of your question to attract more answers. Perhaps revise your question to:
How can we measure the progress of a task in Kanban? Should we include estimates against each task, and if so, how should we go about estimating them (time, story points, etc.)?
Comment: Alternatively you could insert a second sentence "Should we track progress of a task in Kanban?"  Very interesting question with a lot of implications.  Well done.
Answer: In my opinion, I would always include an estimate against any Kanban task, as this helps you limit the number of tasks that are undertaken at any one time (Work in Progress Limit). You can also calculate your team's velocity, which can be immensely helpful in future planning scenarios.
Regarding task tracking, there are a number of different ways that you could do this. The most common way would be for your team to add time/percentage against the task until it has been completed.
If you wanted a more top-level overview of tasks, you could consider adding additional columns to your Kanban board. An example of this in the Web Development industry could be:
Blocked | Backlog | In Development | Testing | Pull Request | Complete
This provides you with a more visual way of tracking tasks, which is key to a successful Kanban approach.
Answer: If we're talking about Kanban in its strictest sense - the measure is the lead and cycle time of tasks as they get through the flow. Look up CFD, or Cumulative Flow Diagram, for more info on this. There is no need for estimates - you just pick up the next task in the queue - so it really doesn't matter whether the task is Large, Medium or Small - you work on the next most important task - and if that takes many many days (equivalent to a "Large"), then that will impact the cycle time.

tracking and progress in a Kanban


Can a "Blender Game Engine" powered game run on Linux?

Question: Can a "Blender Game Engine" powered game be built for Linux?
Answer: Yes. Blender Game Engine powered games can run on all major platforms, and support for Android deployment, although limited and regarded as experimental by the community at large, is gaining ground. Deployment to Linux based systems is fully supported, and is a primary focus of the Blender Game Engine.
Keep in mind that a game created with the Blender Game Engine must be built for the system in question by someone with rightful access to the source files. This means that a developer must build their game for Linux in order for the game to run in a Linux environment. The same holds true for the other available platforms. A game built for Windows will only run in a Windows environment.
One exception is Android, where (correct me if I am wrong) support only exists through a native application which requires the source file in <code>.blend</code> format. Again, this functionality is regarded as experimental and as such should not be considered a viable deployment solution at this time. The Blender Foundation provides limited insight on this subject, however relevant information can be found in the Official Documentation here and here.
From the Official Documentation for the Blender Game Engine:

The Game Engine can simulate content within Blender,   however it also
  includes the ability to export a binary   run-time to Windows, Linux
  and MacOS. There is also basic   support for mobile platforms with the
  Android Blender   Player GSOC 2012 project.
Comment: You could add infos from https://code.google.com/p/gamekit/ to make this awesome
Comment: @stacker I looked at it, but didnt want to mention it here since im not 100% sure what the framework looks like on the inside (does it run on dalvik or is it native? Does it use blender to create assets like jMonkey engine, or does it run actually the blenderplayer) since this post is actually meant to provide insight on blender as it pertains to linux, i was worried that such detail on android would be straying too far from the topic at hand. especially since android deployment has such limited documentation. however your link is all this post needs to direct user that way, so thank you =)


Explanation of ClassCastException in Java

Question: I read some articles written on "ClassCastException", but I couldn't get a good idea on what it means. What is a ClassCastException?
Answer: Straight from the API Specifications for the ClassCastException:

Thrown to indicate that the code has
  attempted to cast an object to a
  subclass of which it is not an
  instance.

So, for example, when one tries to cast an Integer to a String, String is not an subclass of Integer, so a ClassCastException will be thrown.
Object i = Integer.valueOf(42);
String s = (String)i;            // ClassCastException thrown here.

Comment: With any kind of sorting, all items must be comparable to each other (mutually comparable). If they are not, a `ClassCastException` will be thrown. So, if items does not implement `Comparable` then `Collections.sort()` will throw this exception
Answer: It's really pretty simple: if you are trying to typecast an object of class A into an object of class B, and they aren't compatible, you get a class cast exception.
Let's think of a collection of classes.
class A {...}
class B extends A {...}
class C extends A {...}

You can cast any of these things to Object, because all Java classes inherit from Object.
You can cast either B or C to A, because they're both "kinds of" A
You can cast a reference to an A object to B only if the real object is a B.
You can't cast a B to a C even though they're both A's.
Answer: It is an Exception which occurs if you attempt to downcast a class, but in fact the class is not of that type.
Consider this heirarchy:

Object -> Animal -> Dog

You might have a method called:
 public void manipulate(Object o) {
     Dog d = (Dog) o;
 }

If called with this code:
 Animal a = new Animal();
 manipulate(a);

It will compile just fine, but at runtime you will get a ClassCastException because o was in fact an Animal, not a Dog.
In later versions of Java you do get a compiler warning unless you do:
 Dog d;
 if(o instanceof Dog) {
     d = (Dog) o;
 } else {
     //what you need to do if not
 }

Comment: Not necessarily downcast - if Cat was a sublass of Animal and you attempted to cast to Dog, you'd get the same exception
Answer: Consider an example,
class Animal {
    public void eat(String str) {
        System.out.println("Eating for grass");
    }
}

class Goat extends Animal {
    public void eat(String str) {
        System.out.println("blank");
    }
}

class Another extends Goat{
  public void eat(String str) {
        System.out.println("another");
  }
}

public class InheritanceSample {
    public static void main(String[] args) {
        Animal a = new Animal();
        Another t5 = (Another) new Goat();
    }
}

At Another t5 = (Another) new Goat(): you will get a ClassCastException because you cannot create an instance of the Another class using Goat.
Note: The conversion is valid only in cases where a class extends a parent class and the child class is casted to its parent class.
How to deal with the ClassCastException:

Be careful when trying to cast an object of a class into another class. Ensure that the new type belongs to one of its parent classes.
You can prevent the ClassCastException by using Generics, because Generics provide compile time checks and can be used to develop type-safe applications.

Source of the Note and the Rest
Answer: Do you understand the concept of casting? Casting is the process of type conversion, which is in Java very common because its a statically typed language. Some examples:
Cast the String "1" to an int, via Integer.parseInt("1") -> no problem
Cast the String "abc" to an int -> raises a ClassCastException
Or think of a class diagram with Animal.class, Dog.class and Cat.class
Animal a = new Dog();
Dog d = (Dog) a; // No problem, the type animal can be casted to a dog, because it's a dog.
Cat c = (Dog) a; // Will cause a compiler error for type mismatch; you can't cast a dog to a cat.

Comment: Being a little nitpicky, but the String "1" cannot be "cast" to an int, but it can be converted to an int via the Integer.parseInt(String) method.
Comment: Cast a String "1" to int -> no problem? thats wrong
Comment: Even `Cat c = (Dog) a` will not raise a `ClassCastException`, but a compiler error (_type mismatch_)
Answer: A class cast exception is thrown by Java when you try to cast an Object of one data type to another.
Java allows us to cast variables of one type to another as long as the casting happens between compatible data types.
For example you can cast a String as an Object and similarly an Object that contains String values can be cast to a String.
Example
Let us assume we have an HashMap that holds a number of ArrayList objects.
If we write code like this:
String obj = (String) hmp.get(key);

it would throw a class cast exception, because the value returned by the get method of the hash map would be an Array list, but we are trying to cast it to a String. This would cause the exception.
Answer: You are trying to treat an object as an instance of a class that it is not.  It's roughly analogous to trying to press the damper pedal on a guitar (pianos have damper pedals, guitars don't).
Answer: You can better understand ClassCastException and casting once you realize that the JVM cannot guess the unknown. If B is an instance of A it has more class members and methods on the heap than A. The JVM cannot guess how to cast A to B since the mapping target is larger, and the JVM will not know how to fill the additional members.
But if A was an instance of B, it would be possible, because A is a reference to a complete instance of B, so the mapping will be one-to-one.
Answer: A very good example that I can give you for classcastException in Java is while using "Collection"
List list = new ArrayList();
list.add("Java");
list.add(new Integer(5));

for(Object obj:list) {
    String str = (String)obj;
}

This above code will give you ClassCastException on runtime. Because you are trying to cast Integer to String, that will throw the exception.
Answer: Exception is not a subclass of RuntimeException ->  ClassCastException
    final Object  exception = new Exception();
    final Exception data = (RuntimeException)exception ;
    System.out.println(data);

Answer: A Java ClassCastException is an Exception that can occur when you try to improperly convert a class from one type to another.
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ClassCastExceptionExample {

  public ClassCastExceptionExample() {

    List list = new ArrayList();
    list.add("one");
    list.add("two");
    Iterator it = list.iterator();
    while (it.hasNext()) {
        // intentionally throw a ClassCastException by trying to cast a String to an
        // Integer (technically this is casting an Object to an Integer, where the Object
        // is really a reference to a String:
        Integer i = (Integer)it.next();
    }
  }
 public static void main(String[] args) {
  new ClassCastExceptionExample();
 }
}

If you try to run this Java program you'll see that it will throw the following ClassCastException:
Exception in thread "main" java.lang.ClassCastException: java.lang.String
at ClassCastExceptionExample  (ClassCastExceptionExample.java:15)
at ClassCastExceptionExample.main  (ClassCastExceptionExample.java:19)

The reason an exception is thrown here is that when I'm creating my list object, the object I store in the list is the String "one," but then later when I try to get this object out I intentionally make a mistake by trying to cast it to an Integer. Because a String cannot be directly cast to an Integer — an Integer is not a type of String — a ClassCastException is thrown.
Answer: If you want to sort objects but if class didn't implement Comparable or Comparator, then you will get ClassCastException
For example
class Animal{
   int age;
   String type;

   public Animal(int age, String type){
      this.age = age;
      this.type = type;
   }
}
public class MainCls{
   public static void main(String[] args){
       Animal[] arr = {new Animal(2, "Her"), new Animal(3,"Car")};
       Arrays.sort(arr);
   }
}

Above main method will throw below runtime class cast exception

Exception in thread "main" java.lang.ClassCastException: com.default.Animal cannot be cast to java.lang.Comparable


How and when did 'impossible' become a noun (as in 'To achieve the impossible')?

Question: How and when did impossible become a noun (as in 'To achieve the impossible')?  Was it before or after impossible was an adjective?
Why? Or were they formed from Latin simultaneously?
Comment: Adjectives and verbs are nouned all the time. You are familiar with "the best" in constructions like "the best is yet to come" and "I only want the best for my children," right? There is no difference between those and your example other than the adjective that is being nouned.
Comment: After "unbelievable" but before "amazing".
Answer: Impossible itself never become a noun.  This is actually a common construct where "the + adj" is used as a noun.
EDIT: As RaceYouAnytime pointed out, impossible was used as a noun in the past.  But to the example sentence provided, "impossible" is not a separate noun, but "the impossible" is a construct where an adjective can be used as a noun, properly called a nominalized adjective.

He did the unforgivable.
She achieved the impossible.

But it can also be used to describe people.  Examples include:

The deceased is survived by his wife.
The blind use assistive technologies.
He's only trying to help the rich.  He doesn't care about the poor.

As explained in the answer to this question, these instances either involve omitting the real noun (ellipsis), or referring to people by their attributes (metonymy).
Let's look at these sentences again:

She achieved the impossible (task of...).
The deceased (person) is survived by his wife.
He's only trying to help the rich. (metonymy)
The poor hope to live a better life.  (metonymy)

If you're interested, here's futher reading you can do about using adjectives as nouns.
In addition, here is the Collins English Dictionary entry on impossible.  It includes "the impossible" under its first definition of impossible as an adjective.
Answer: The oldest example of "impossible" as a noun in the Oxford English Dictionary is from 1374

That wyst he wel an inpossible were.
  --Chaucer, Troilus & Criseyde

and the oldest "impossible" as adjective is 1340.  But of course either or both may have existed before that, but not survived in written form.
Answer: The question asked is "when did 'impossible' become a noun," but perhaps it should be when did impossible stop being a noun?
As has been mentioned, impossible can be a true noun if we defer to the authority of the OED.  Definition B.1. describes it as the equivalent of the noun inflection, "impossibility," most often used in plural.
For example:

The nature of an impossible becomes known from the seventh [theorem].

1789   T. Taylor tr. Proclus Philos. & Math. Comm. II. 6

Heaven sometimes converts our impossibles and inevitables into the very best blessings we have.

1866   D. M. Mulock Christian's Mistake 130

But this sense of "impossible" seems to have fallen out of favor.  In its place, OED offers B.2., used with definite article, which, as has been discussed in KumaAra's answer, resembles a nominalized adjective.
This pattern seems similar to the use of "infinite," which also had a more prevalent noun form that is somewhat archaic.  This citation from OED places the noun and adjectival forms in tandem:

Since every part of an Infinite is infinite, there may be supposed something more infinite than an Infinite.

1712   tr. H. More Scholia Antidote Atheism 151 in H. More Coll. Philos. Writings (ed. 4)

In both cases, the noun use likely grew out of the nominalized adjective, as the adjectival uses are attested first, and the semantic natures of the words lend themselves to nominalization.
Comment: Thank you for this comment.  I updated my own answer to reflect some of the information you provided and address my inaccuracies.


What does "two-way justice" mean?

Question: What does "two-way justice" mean? Can I use it to describe a relationship between two people (without considering the role of gender) in which there is a complete equality in behaviors and reactions?
Comment: I think this question with its current title is Not Constructive, since [two-way justice](https://www.google.co.uk/search?q=%E2%80%9Ctwo-way+justice%E2%80%9D&btnG=Search+Books&tbm=bks&tbo=1) isn't an established term with a defined meaning. That link finds only 10 written instances in Google Books, within which it's clearly used with several different senses - a judicial system treating different social groups differently, or any arrangement whereby two parties mutually deliver "justice" to the other, for example.
Comment: If your question was titled something like *Is there a common term for "complete equality in the quality of behaviors and reactions"*, I wouldn't have a problem. But as it stands, you appear to be asking for the "meaning" of a term which is effectively non-existent, and therefore doesn't *have* an established meaning.
Comment: If you'd linked to a specific instance of someone using the term "two-way justice", and asked what it meant, I'd have probably said it was Too Localised, on the grounds that it's only used 10 times (with conflicting senses) in Google Books. But as I said, if you'd asked for a term to describe what you apparently have in mind, I'd have upvoted StoneyB's [mutual respect](https://www.google.co.uk/search?q=%22mutual+respect%22&btnG=Search+Books&tbm=bks&tbo=1) as the obvious choice, given that there are over 1,000,000 written instances of that in my link.
Comment: Don't try to read too much into the meaning of "too localized" or "not constructive". Those are simply [multiple choice options](http://meta.english.stackexchange.com/questions/3093/valid-question-closed-as-too-localised-requesting-reasons-for-being-out-of-sc/3095#3095). When someone tells you your question seems too localized, or general reference, instead of arguing with them, invest that energy into improving your question. And don't be insulted – even highly ranked users get questions closed from time to time. No one is lambasting _you_, they are simply addressing this particular question.
Comment: Thanks for expressing your idea however I disagree with you. I will make a topic in meta to find what constructive question mean to help you make clear some ambiguous terms like this which you use here a lot and it may confuse many non English speakers.
Comment: when you can find it in the internet so this term exists ,although for wider usages or different usages not personal relationships.
Comment: There is a history behind it which has been deleted before. Thanks for your advices but before I argued to know the reason which at first time no body tried to answer me and instead I faced to being frozen,suspended and insulted! Surely everything is not available but in this time people tried to be more tolerate,calm and reasonable in answering so I tried to invest my energy to improve my questions not arguing with them because they corrected their wrong behaviors so now I have corrected myself too!.. A real two-way fairness! :)
Answer: Just and justice, at least in US use, tend to be restricted to talk about law, or systems like the legal system. They are not ordinarily be used with respect to personal relationships; there, fair and fairness are more likely.
Better terms for what you are trying to express might be mutual fairness or mutual respect.
Comment: @user37324  You *can* use it any way you want. Your hearer(s) or reader(s) will understand you to be making an analogy to law and social institutions; if that's what you want, you're fine. But it's your hearers who decide what you mean, not you.
Comment: @user37324 Language is a dangerous toy to play with.
Comment: @user37324  Any time you employ indirection or irony you are inviting misunderstanding--literally inviting it for rhetorical effect. Questions on this site should be directed toward literal meanings, or unambiguous ironies; questions about utterances of the sort you describe are inherently Not Constructive.
Comment: Look at this for example: http://knowledge.sagepub.com/view/criminal-and-social-justice/n2.xml. Justice as a two-way street.
Comment: @user37324 Note that the book is referring to *criminal* and *social* justice. Criminal justice is, as StoneyB suggested, a legal matter. Social justice is also related to legal issues, though in a somewhat different way; where criminal justice refers to a broken law, social justice generally refers to a broken social system that is harming many people. In both cases, the word "justice" is used to refer to larger issues, either dealing with the law or dealing with widespread problems affecting many people. Justice is rarely used to discuss personal relationships.
Comment: Can I use of it as a kind of friendly sarcasm to show the importance of the quality of my relationship with another one?
Comment: You got it! It can be a problem. I used to indirect and poetic/ironic usage of words,idioms and phrases in my own motherhood tongue which sounds very nice and interesting for most of people from different social levels and I have to fix it or change this habit when I try to speak or write in English to not make confusion,offense or ambiguity.
Comment: I confess it was my main goal to join this site! :)
Comment: Surely I do not mean about my questions but about phrases and terms which I use of them in my own motherhood language and cannot find the equivalent in English to convey my reason and at the same moment enjoy of playing with words and phrases.
Comment: Yes! Surely! A two-edged sword for all users! Thanks! :))

What does "two-way justice" mean?


Mapping of plaintext and ciphertext in DES

Question: The plain text and the cipher text have a one to one mapping. Given a pair of those, can there be multiple keys used to generate the same pair? Or can a particular plain text - cipher text mapping be achieved through only a particular key?
Answer: As is often the case, the answer is it depends.
In ECB mode, a single plaintext and key combination results in exactly one ciphertext output, and a single ciphertext and key combination results in exactly one plaintext output. This is a requirement for the encryption and decryption process: it must be reversible, otherwise it is rather pointless (then you'd be looking at some form of hash function).
If different keys could generate the same ciphertext from the same plaintext, then what would cause one ciphertext and not some other to be generated? There is no random number generator involved in DES (although you'd hope there is one in key generation).
If different plaintexts could generate the same ciphertext given the same key, then how would decryption determine which plaintext is identical to the originally encrypted plaintext?
It follows from this line of reasoning that in ECB mode, the same pair of plaintext and ciphertext must map to exactly one key.
Of course, nobody in their right mind uses ECB mode as anything more than a building block for something more robust. However, as pointed out by Mark, your question doesn't make a lot of sense in modes other than ECB.
Modes other than ECB, such as CBC (Cipher Block Chaining), CTR (Counter), CFB (Cipher Feedback) and so on feed something more than the plaintext/ciphertext and key into the encryption/decryption function. These are normally initialized with some form of what is known as an Initialization Vector (abbreviated IV) or nonce (for "number used only once"). The IV simply randomizes the process.
In these cases, when working with a single block of plaintext data, you can expect for any combination of plaintext and key any ciphertext value to be possible, with the IV essentially functioning as a selector. The next block is processed similarly but with something about the previous block taking the place of the IV. The IV is normally not considered a secret; its purpose is not to protect the plaintext, but rather to force an attacker to use an attack mode that cannot be reduced to effectively a table lookup as can be done with ECB (a very large table, but still a table lookup). Using a feedback mode of some sort also ensures that patterns in the plaintext do not appear as patterns in the ciphertext.
Comment: That's not the question that was asked.  The question was essentially "given a plaintext/cyphertext pair, is there more than one key that could have produced the pair?", which is really only a meaningful question in ECB mode.
Comment: @Mark Fair enough point. How about now?
Comment: @MichaelKjörling By saying : "**If different keys could generate the same ciphertext from the same plaintext, then what would cause one ciphertext and not some other to be generated?**", you mean that it's not possible to have multiple keys for a given plaintext/cyphertext pair ?
Comment: @MehranTorki I suppose it would be possible to design a cipher that has such a property, but it seems to me like it would just be another portion of the key, and DES certainly has no provisions for anything like that.
Comment: @MichaelKjörling In terms of probability, i think that's possible in DES! read this text file if you have time: https://class.coursera.org/crypto-preview/lecture/subtitles?q=14_en&format=txt


What has coherence to do with this phenomena?

Question:
It reads,"Hardening due to coherent precipitate".Firstly,what has hardening to do with coherence of the precipitate?Why would dislocations shear the precipitate?
Answer: a coherent precipitate is one in which the precipitate exists as a separated phase embedded in the matrix of the material being hardened- as opposed to being dispersed as a solute within the atomic lattice.
For a dislocation to travel past a coherent precipitate particle which is in the movement plane of the dislocation it must propagate the same displacements through the precipitate particle as it did within the matrix lattice. If it cannot shear the particle as illustrated in the picture above, then the dislocation is pinned, its movement is halted, plastic deformation is inhibited and the material exhibits increased hardness.


What is the definition of particle-hole symmetry in condensed matter physics?

Question: People often talk about particle-hole symmetry in solid state physics. What are the exact definition and physics picture of particle-hole symmetry? How to define the density of particles and holes?
Comment: I asked this question myself and couldn't find a clear cut definition, but there are some articles and papers that circumscribe it. I think it is possible to get a sense of particle-hole symmetry out of them. These two describe the transformation: prb.aps.org/pdf/PRB/v84/i20/e205121 and http://www.sciencedirect.com/science/article/pii/S0375960197001631 . Describes symmetry in atomic limit (no jumping to or from impurity): raas.de/files/Raas_Carsten_PhD_Thesis.pdf

Edit: re-entered the comment because there was a broken link and could'nt edit the comment anymore.
Answer: We find particle hole symmetry (PHS) for example in superconductors, where you can consider the Bogoliubov-de Gennes (BdG) Hamiltonian as a mean-field approximation. This is the only experimental example I know. There maybe other systems with particle hole symmetry but I don't know about them. Here, I will use superconductors as an example for the explanation.
If you have a superconductor with $N$ electrons (some electrons form Cooper pairs and some electrons are unpaired), the BdG Hamiltonian is of size $2N\times2N$ and the state of the system is written as a vector that consists of $N$ annihilation, and $N$ creation operators for electrons, above one being the annihilation operators first. You can view the bottom creation operators for the electrons, as annihilation operators for holes. You then have a complete vector of annihilation operators of length $2N$. Holes behave(in the sense of creation and annihilation) exact opposite of electrons and therefore you expect that the energy levels are complete symmetric with respect to the Fermi level. While you have $N$ electrons in the system, there are $2N$ energy levels which form pairs.
More technical now:
For superconductors, the particle hole symmetry operator has the form $P = \tau_x K$, where $\tau_x$ is a Pauli matrix and $K$ means complex conjugation. The Hamiltonian then satisfies the following equation: $$P^\dagger H P = - H \quad\Rightarrow\quad \tau_x H^* \tau_x =  -H$$
and $P^2$ is the identity matrix. Other Hamiltonians can also have particle hole symmetry and the PHS operator may be then different, but it always squares to $1$ or $-1$.
Comment: There is a sign error $\tau_x H^* \tau_x = - H$. Unfortunately it is one character so I cannot edit it.


individual wsp for each webpart

Question: I am using Visual Studio 2010 and all my project related Visual Webparts are inside that solution and I am doing all this on UAT environment. Now I want to know how can I can build separate WSP file of each webpart and deploy on Production.
Answer: Wouldn't it be more appropriate just creating a feature per webpart instead?
But just create a new project per webpart you have.
Comment: Regarding second suggestion you mean instead of 1 project for all webparts i shud create one project for one webpart only? and I didnt get your first suggestion..can you please elaborate?
Comment: Yes that is exactly what I mean. You can only have 1 WSP per project, not multiple. Thus you'd have to create 1 project for each webpart.

Regarding my first suggestion; In your project you can create multiple features. By doing this, instead of creating 1 project for each webpart you just create 1 feature for each webpart. This way you keep them all under 1 project and still have the choice of activating them one by one according to your needs.

individual wsp for each webpart


Does Windows Explorer allow the creation of duplicate folder names in the same location when one of the folders is hidden/marked as a system folder?

Question: Certain files/folders within Windows have attributes assigned to them by default that hides them from Windows/File Explorer unless the relevant settings are changed to display these types of files/folders from within the Folder Options dialog. What isn't immediately obvious, however, is how Explorer would handle a situation whereby a user creates a folder with a duplicate name in a location that already contains a hidden folder - does it simply display an error message, or allow a folder to be created with the same name?
Answer: Duplicate files and folders are not permitted. You also cannot have a file and folder with the same name. Whether the files or folders have the hidden attribute set makes no difference.
Files and folders with the hidden attribute are not hidden from Windows explorer. It is fully aware of them and in fact makes use of them. Explorer examines the hidden "desktop.ini" file in some folders for instructions on how to display it's name and icon. Other software too is aware of hidden files and folders and can make full use of them. In fact software wouldn't even be aware they were hidden unless it checked for the attribute, which most software does not. By default Explorer will not display hidden files and folders to the user but aside from that it has little interest in the attribute. It isn't in any way restricted by it.
The prohibition against duplicate files and folders is enforced by the file system, not Explorer. When the user attempts to create a file or folder that already exists I doubt that Explorer is initially even aware of this. It submits the request to the file system which then determines that it already exists and returns an error to Explorer which then informs the user. Whether or not a file or folder has the hidden attribute is not a factor.
Duplicate files or folders would cause some serious problems for software and the file system itself. How would software distinguish between them? For that reason the file system enforces the prohibition itself. Explorer, like any software, must abide by the file system's rules.
Comment: Nice answer... what is confusing to people (sometimes) is that on UNIXy operating systems.. the file DOES have a different name (starting with a dot)..
Answer: I have just done a quick test.

Created a new folder, gave it a name, then set it to be hidden.
Created another folder. Tried to change its name to the same as the one created on the previous step. The window on the image below appeared:

Conclusion: Even if a directory is hidden, you are not allowed to create another folder with the same name. The reason is that Windows filenames are case sensitive, which means that abC is the same as AbC, ABC and abc regardless of how you write it. On Linux, you could create a new folder which is called ABC, then create other folders named Abc, abc and abC. They will all be valid. But hidden means only hidden, not gone.
Comment: On Linux, it IS a different filename.  On windows, only an NTFS flag is preventing windows from allowing a duplicate name (only differing by case) like Linux does.  It used to be a registry setting only but the file system was extended to support this because of WSL.


Is the story of Suwaybit and Nuayman authentic?

Question:
Once Abu Bakr and some companions went on a trading expedition to
  Busra. Various people on the trip were given fixed duties. Suwaybit
  ibn Harmalah was made responsible for food and provisions. An-Nuayman
  was among the group and on the way he became hungry and asked Suwaybit
  for some food. Suwaybit refused and an-Nuayman said to him: "Do you
  know what I would yet do with you?" and went on to warn and threaten
  him but still Suwaybit refused. An-Nuayman then went to a group of
  Arabs in the market and said to them: "Would you like to have a strong
  and sturdy slave whom I can sell to you." They said "of Course and
  An-Nuayman went on: "He has a swift tongue and is very articulate. He
  will resist you and say: 'I am free.' But don't listen to him" The men
  paid the price of the slave – ten pieces of gold and An-Nuayman
  accepted it and appeared to complete the transaction with
  business-like efficiency. The buyers accompanied him to fetch theft
  purchase.
Pointing to Suwaybit, he said: "This is the slave whom I sold to you."
  The men took hold of Suwaybit and he shouted for dear life and
  freedom. "I am free". I am Suwaybit ibn Harmalah…" But they paid no
  attention to him and dragged him off by the neck in shackles as they
  would have done with any slave.
All the while, an-Nuayman did not laugh or batter an eyelid. He
  remained completely calm and serious while Suwaybit continued to
  protest bitterly. Suwaybit's fellow travelers, realizing what was
  happening, rushed to fetch Abu Bakr, the leader of the caravan, who
  came running as fast as he could. He explained to the purchasers what
  had happened and so they released Suwaybit and had their money
  returned. Abu Bakr then laughed heartily and so did Suwaybit and
  an-Nuayman. Back in Madinah, when the episode was recounted to the
  Prophet and his companions, they all laughed even more.

The above can be found online on;

An-Nuayman ibn Amr: The Companion Who Made the Prophet Laugh
by Yusuf Abdul-Alim | Dec 21, 2018 | Islamic History, The Faith; Link: https://intellectinislam.com/category/the-faith/islamic-history/
Al-Nuayman ibn Amr - Wikipedia
Comment: It is narrated in [Sunan Ibn Majah](https://sunnah.com/ibnmajah/33/64), [Musnad Ahmad](https://al-maktaba.org/book/25794/22389#p1) etc.
Answer: The link above to Sunan ibn Majah is broken, here is the fixed: https://sunnah.com/ibnmajah:3719
In Sunan ibn Majah it is Da'if. In Musnad Ahmad, it says it is Da'if because of Zan'ah bin Salih. I would err on the side of caution.


galaxy tab video conference

Question: I'm confused... the Galaxy Tab commercials make a special point of showing people doing video conferencing on the device, and yet, I have been entirely unable to evoke said functionality from the one I have in my hands here (it's with Verizon)... So... what gives?!
Comment: As matt read expressed it would be helpful if you explained what you've tried.
Comment: You're putting too much faith in truth in advertising. Supposedly its possible, and big red implies that its easy.
Comment: I *tried Skype and then looked around for anything else that would suggest video conferencing... I mean... how much searching am I expected to do, given the amount of time Verizon has dedicated to promoting this feature in their advertising, one would imagine I wouldn't have to do a whole lot!
Answer: How are you "evoking" this functionality? Video conferences do no appear from the ether. Try a video conferencing app, perhaps -- like Qik, Fring, or Yahoo! Messenger.
Answer: There have been reported problems with qik on the galaxy tab, particularly no option to start a chat. Try to download something from vcast apps or try oovoo. Sorry for not giving any links but I'm on my droid and my latest CM update is acting crazy closing my browser w/o warning.
Comment: Don't see anything on vcast apps that would do this.  Do you know of something in particular?  oovoo yields no results in market.
Comment: I don't know anything in particular I just read somewhere that there were some different apps.  For oovoo search google.

galaxy tab video conference


Equation for shape of water drop on hydrophobic surface

Question: What would be the general equation of the 3D shape water forms when it "beads up" on a hydrophobic surface such as wax paper?
Answer: Initially, before the water droplet meets any other material surface, it's (ideal) initial spherical shape sphere contains and maintains an isotropic pressure distribution. Surface tension, due to cohesive forces, tends keeps the water molecules bound in the spherical shape.
In your question, you then introduce a hydrophobic surface, in this case wax paper, which will obviously minimise the conversion of cohesion to adhesion, but also obviously will distort the ideal spherical shape towards one with an elliptical cross section.
Luckily for me, the  Young Laplace Equation, as taken from  Wikipedia, is described as the  equation involved in determining the resulting shape:

The Young–Laplace equation relates the pressure difference to the shape of the surface or wall and it is fundamentally important in the study of static capillary surfaces. It is a statement of normal stress balance for static fluids meeting at an interface, where the interface is treated as a surface (zero thickness):

$${\displaystyle {\begin{aligned}\Delta p&=-\gamma {\bar {\nabla }}\cdot {\hat {n}}\\&=2\gamma H\\&=\gamma \left({\frac {1}{R_{1}}}+{\frac {1}{R_{2}}}\right)\end{aligned}}}$$

where ${\displaystyle \Delta p}$ is the pressure difference across the fluid interface,
$γ$ is the surface tension (or wall tension),
${\displaystyle {\hat {n}}}$ is the unit normal pointing out of the surface,
${\displaystyle H}$ is the mean curvature,
${\displaystyle R_{1}}$ and ${\displaystyle R_{2}}$ are the principal radii of curvature.
Note that the ${\displaystyle {\bar {\nabla }}}$ is the divergence on surface, which is defined by $${\displaystyle {\bar {\nabla }}=\nabla -{\hat {n}}({\hat {n}}\cdot \nabla )}$$
Note that only normal stress is considered, this is because it can be shown that a static interface is possible only in the absence of tangential stress.


Is there a name for the extra measure that they like to put into country songs?

Question: The song that made me think of this is Amarillo by Morning, made popular by George Straight, but it's quite common in a lot of country and pop music.  In the verse at the end of the second 4 measure phrase there is one extra measure where the song sort of collects itself before moving on to the chorus.  I have a friend that I jam with that puts these kind of one measure pauses into like every song we play, so I was wondering if there was a name for this kind of thing so I can know what to call it when he does it.
Comment: Really nice question. Welcome to Music.SE!
Comment: _so I can know what to call it when he does it_ - In your case, I'd call it messing up the arrangement...
Answer: This is an issue of what we call hypermeter; specify, we can call it a hypermetrical extension. By hypermeter, I mean a metrical structure not at the level of the beat, but at the level of the entire measure.
Try conducting along with "Amarillo"; it's in 4/4 time. After you're used to that, try conducting in 4/4 where every beat is the start of a new measure. It's going to feel really slow, but that's correct: you're actually conducting a quarter of the speed you just did. Starting at 0:20, for instance, you'll conduct one beat every time the bass guitar changes pitch.
Just as 4/4 is a really common meter, a four-measure hypermeter is also very common. They opening hypermetrical phrase is something like this:
1    Amarillo by morn-
2    -ing.
3    Up from San Anton'.
4

With this pattern set up, we expect the four-measure hypermeter to continue. But what happens in the second phrase is there's a fifth measure inserted before the start of the next phrase:
1    Everything that I've
2    got               is
3    just what I've got on.
4
5!                  When that

1    sun is high...

This fifth measure that you're discussing is the hypermetrical extension. (A less fancy term would just be "phrase extension.")

For the opposite of this process, check out "Every Little Thing She Does is Magic" by The Police. Conduct the four-measure hypermeter at the start; your conducting will match the bass guitar pitches. It may even be helpful to count out the slow "1 2 3 4" as you're conducting. You should notice something a little strange around 0:45! Here they actually shorten the hypermeter, opting instead for a three-measure hypermetrical phrase.

Edit: This "Amarillo by Morning" is a bit more interesting than that: when he returns to the "Amarillo by Morning" text at 0:46, he inserts a section with only three measures in the hypermeter. This means that, zoomed in, there are two "errors" in the hypermeter: one bit is one measure too long, one is one measure too short. But from a global perspective, it results in a normative 16 measures of hypermeter; clever!
Comment: Good gracious!  There's a name for everything, it seems.   I should warn you that if you mention a 'hypermetrical extension' to most practical musicians he won't have the slightest idea what you're talking about.  Stick to 'that extra bar before the chorus'.
Comment: @CarlWitthoft Here, hyper- = "a level above", not "longer than expected". :)
Comment: I don't disagree :-)
Comment: Wouldn't shortening a 4-bar to 3 be  "hyp**o**meter" ?  :-)
Comment: I've always understood hypermeter to have a bit of an illusory element inherent in its presentation that you then have to weed through, not the other way around. Conducted at tempo, couldn't this also be a 4-beat turnaround rather than extension? Also an extension suggests the prolongation of a musical idea rather than of repose? Third, wouldn't the material in the 5th line be the start of another 4-bar phrase? I haven't listened to the song but this is my reaction to the question and your answer here.
Comment: @jjmusicnotes It could be a 4-beat turnaround, but (in my understanding of that term) we're just saying the same thing in a different way. Extension does suggest prolongation, but I think the issue of prolongation *of what*; here's it's the prolongation of the hypermeter. And yes, the material in the 5th line is the anacrusis to another 4-bar phrase, but "When that" is definitely outside the boundaries of those new 4 bars.


Reading progress on a Kindle Paperwhite

Question: I like to know how much time I've got left in any book I'm reading on my Kindle. I set it up each time a start reading but it seems to default to location or no reading progress at all. I know it's easy to put it back to show what I want but it's frustrating! Why won't it just stay on the setting I want?
Any suggestions would be great.
Thanks.
Answer: Once you open any book in your kindle notebook. you need to go Aa > More > Reading Progress and Apply Time left in the chapter and click on Save current settings.

Reading progress on a Kindle Paperwhite


How to add a div wrapper around a zone?

Question: I'm using the Omega theme and have a zone that I need a div around for a certain content type. Trying to figure out the best way to do it. Was thinking a preprocess, but no clue which. Fairly new to Drupal so bare with me.
Comment: What version of Omega?  3 or 4?  I assume 3 because you mention zones.
Comment: using version 3
Answer: Adding something like this to the template.php of your subtheme should get you in the right direction.
<code>function MYTHEME_alpha_preprocess_region(&$vars) {
  $menu_object = menu_get_object();
  if (isset($menu_object->type) && $vars['region'] == 'content') {
    $vars['theme_hook_suggestions'][] = 'region__content__'.$menu_object->type;
    $vars['attributes_array']['class'][] = 'region-content-'.$menu_object->type;
  }
}
</code>
Then you just need to create .tpl files for them in the same way you would for other content type based tpl files (example: region--menu--page.tpl.php)

How to add a div wrapper around a zone?


Directly send sms from app by clicking button in app

Question: I am working on application. I want to send sms to number directly by clicking button in my app. currently my app is sending sms to number but it first shows the messages view and then there is a send button as i've done:
   presentModalViewController:controller
i want the message to be sent without showing the Modal view
Comment: possible duplicate of [How to send SMS from an iPhone app without opening the SMS interface?](http://stackoverflow.com/questions/4334454/how-to-send-sms-from-an-iphone-app-without-opening-the-sms-interface)
Answer: You can't this is not allowed.
This way you could send hunders or thousands of messages without the user noticing, thus apple does not allow you to do that.
Answer: That's not possible. You have to show the user de message view where he can send the sms. If it would be possible to add a 'send sms' function directly to a button, that would be a huge security flaw!
Answer: No. There is no official way on iOS to send a message without presenting the dialog and the user clicking send. Maybe on a jailbroken device you could, but definitely not on the app store.


How to change a specific word

Question: In the product listings of our site, the dropdown text for customers has a typo - it reads, "Select options below for price and avilability."  So the word "avilability" needs to be edited to "availability."  Not sure how to do that.
Comment: can you share the screenshot, it may be coming from one of phtml file depending on your theme and template you are using.
Answer: the most simple way is to search in the whole code where the specific word was wrongly typed.
The alternate solution is to use Magento's translate system, but I dont recommend that because it is likely you need to know the module context which is harder to find then the source of the typo.

How to change a specific word


Graphing on the complex plane

Question: I've seen many graphs of functions in the complex plane. For example the $\Psi_0(x)$. They look very nice and I wonder how may I graph them by hand. If and only if it is possible. Other ones I want to graph are $$\operatorname{Li}_s(z)$$. How do you know what colors to use in the graph?
Answer: Given a function $f:\mathbb{C}\rightarrow\mathbb{C}$, you can color the complex plane by associating to each point a color based on the angle $f(z)/|f(z)|$ makes with the real axis. You can also change the brightness depending on the value of $|f(z)|$.
Answer: Before domain coloring came along, the customary way of presenting a function's complex plane behavior was through an "altitude chart", like the one here for the Faddeeva function, or this one for the Hankel function.
The book by Jahnke and Emde has more of these figures. Since you mentioned wanting to do them by hand, and coloring by hand might not prove feasible, you can start by sketching these contours.

Graphing on the complex plane


Not finding fix for TM "backup delayed" issue on Sonoma

Question: I never had this Time Machine problem before, only after upgrading to Sonoma. I do not use iCloud, Dropbox, OneDrive, Google Drive or any other Cloud services. I rebuilt Mac Mail accounts, tried turning off WiFi, using safe mode, and every troubleshooting trick I can think of. I wish I knew which process or daemon or PID was causing this so I could kill it in Activity Monitor. Apple online support is useless. Nothing on my MacBook is set to sync! "Some of the files on your Mac cannot be backed up until Cloud Files syncing has completed." Is there a .plist file I can delete? I'm on an M1 MacBook Pro.
Comment: already tried that, didn't work.
Answer: I would disconnect from all networks and restart your Mac and connect only the backup destination (if it's reachable via network, you will need to ensure that network has no way to get to the internet in general and Apple iCloud servers in specific).
Then run a backup to make sure everything is clear. Once that backup is complete you can reconnect to the internet and let iCloud sync resume and block backups until the sync down is done.
Here is a very good writeup of the issue - for most people it will be a large sync and some people will need Apple support if they can't triage this or wait it out.

https://eclecticlight.co/2023/10/16/sonomas-changes-to-icloud-may-stop-time-machine-backups-completing/

It seems in fixing a "bug" some people have been depending on the buggy behavior to juggle which iCloud items are "optimized" and which need to be downloaded and present on the local storage. It's also possible Apple changes things server side or issues a patch to avoid sync deadlocks for days and prevent backups.


Can I delete .msp files?

Question: I have a load of .msp files that i would like to delete, will this harm my system at all?
Answer: .msp files can be a couple of things but these are probably Microsoft update files.  In general you should never delete anything inside the Windows directory unless you know what you're doing.
It's good that you asked first, because if you have to ask, or you don't know what the files are for, you delete them at your own risk.
Comment: Can I fix that for you? "You should never delete anything inside the Windows directory, period."
Comment: @Randolph - Hey, I had to purge a corrupted print spooler cache the other day. ;)  But yeah, let me update the answer to be a little clearer.
Comment: You can often try moving the file to another directory or renaming it before actually deleting to see if it's something important. Creating a backup just-in-case is another good defensive tactic when changing things you're unsure about doing (like deleting files).
Comment: @Randolph - And just let me go on the record as stating that I do agree with you as advice for standard users.  Unfortunately, I'm just too pedantic to state it across the board. :)
Comment: I've voted you up.
Answer: A quick Google yielded the following File Extensions Resource page for .msp. However, a little more digging suggests you shouldn't delete .msp files.
My maxim for this sort of thing is: If you're unsure, don't do it. If you're brave (and understand the potential consequences), rename it and reboot!

Can I delete .msp files?


When do you send in your research proposal when applying for PhD?

Question: do you send it with your first email to your prospective supervisor or after a few exchanges?
Answer: I'm assuming that you are in a place in which the advisor/supervisor actually hires you. I'm also assuming that you want to work on your own research program rather than that of the supervisor, which is often ongoing.
I'd suggest that you say something about your research interests, but, perhaps, not make a formal proposal. You can do that in the first mail. You can even say a few things about why this is your interest and what you have already done in that direction.
But some advisors might want you to take up something in their program, rather than work on your own. For others it might be the opposite. Unless you know which situation applies, I'd try to keep your options open.
If you introduce your ideas without expressing too much commitment to them then you might get either a request for more information (hence the full proposal) or a suggestion about what s/he would rather you do for the degree. And take the phrase too much literally. If it sounds like a demand, then it may wind up as an obstacle.
Of course, you may already know something about the professor and have an idea about whether it is better to push or not.

Just for completeness, in some places and fields, proposing research normally is done after acceptance and even choosing an advisor is also done later.
Comment: Thank you. Maybe I don't understand how this works (especially in UK/EU). I believe that your application success is strongly tied to the quality of your research idea/proposal. A good proposal would improve your chance (and research group) of getting funding. Do let me know if any of this is incorrect so that I can have the correct perspective.
Comment: My experience is US, not UK. Making a proposal isn't likely to hurt you unless you imply that you aren't open to other ideas. You want to show aptitude and ability primarily. But if you can know beforehand how committed a prof is to her/his own program you can adapt your approach.


Xcode validation error: Unexpected value for key: CFBundleIconFile is not a string

Question: I'm trying to validate an iOS application for first time.
I had a lot of obstacles until come this step, but I couldn't resolve by myself, so I decide write a question for this awesome comunity.
I got this error in the validation process of the app:
Image: http://oi43.tinypic.com/292qvk5.jpg
My .plist file name is: appxxx-Info.plist
The first question is: the error is reference a file named Info.plist, but I haven't this file!, again, my file is named appxxx-Info.plist
So, I checked the appxxx-Info.plist file to made sure that I had included all neccessary icons for the app. I did have them all.
Image http://oi40.tinypic.com/2a66lqx.jpg
I went to the Summary tab project's target in Xcode and I loaded the proper image for each "device" (iphone/ipod/ipad) and everything is fine! (I never seen a yellow warning triangle)
Anyone know what is the problem?
Answer: In response to question #1: Xcode renames your info plist to "Info.plist" when it builds your app bundle. The organizer is validating the built app bundle, not your raw source.
In response to #2: CFBundleIconFile should be a string, not an array.
Answer: To help with your error I suggest you go through the following links :-
CFBundleIconFile and CFBundleIconFiles in info.plist
CFBundleIconFiles Key is not Showing Up in XCode
Core Foundation Keys
Also to specify icons for your app please go through
How do I specify both icons for a universal iPhone/iPad app? and Xcode 4.2 - App Loader: Unable to verify icon dimensions, no icon found


Facebook Most Mutual Friends

Question: I am trying to find the friends with most mutual friends with me.
<code>public function topThreeMutualFriends() {
    $count;
    $query='select uid1 from friend where uid1 in (select uid2 from friend where uid1=me()) and uid2 in (Select uid2 from friend where uid1=me()) and uid1!=uid2';
    $result = $this->api(array('query' => $query , 'method' => 'fql.query'));
    if(!$result)
        throw new exception("No Mutual Friends");
    else{
        foreach ($result as $uid)
            $count[$uid['uid1']]++;
        arsort($count, SORT_NUMERIC);
        $i=0;
        foreach($count as $key=>$uid){
            $topthree[$i++]=$key;
            if($i==3)break;
        }
    return array($topthree,$count);}
    }
</code>
In the above code an exception is raised stating:"This API call could not be completed due to resource limits"
I tried giving all the permissions, and the query works fine in the fql tester.
What could be the possible reason??
Answer: That's pretty complex code. Why not just let FQL find your top three friends with the most mutual friends?
<code>$query = 'SELECT uid, name, mutual_friend_count
          FROM user WHERE uid IN
            (SELECT uid1 FROM friend WHERE uid2 = me())
          ORDER BY mutual_friend_count DESC LIMIT 3';
</code>
Answer: The possible reason is the error message you pasted, your query is too expensive in terms of the resources needed from Facebook's side.
Break it up into smaller queries and do that instead. For example, fetch the list of friends in one call, split the list into smaller chunks, and check the mutual friends count for the batches in separate calls.
Comment: Yup this is exactly right. We had the same issue. The subselect with >100 people causes a load that facebook often just bails on. You need to cut the requests into pieces and either batch them, fql mutli query them or just iteratively loop through.

Facebook Most Mutual Friends


Made more than $600. Company does not issue 1099-MISC's. Enter income as general income?

Question: I made well over the $600 threshold to receive a 1099-MISC from the company. I contacted the company and they stated that "We do not send tax forms to any publishers". I'm using Turbo Tax Business to file my taxes and I know how much I received from this company. Would I just enter the income as General Income? Why would this company choose not to issue tax forms? The income I received from this company is rather high, would the IRS think its unusual that I don't have a 1099-MISC?
Comment: Just for your reference: https://turbotax.intuit.com/tax-tools/tax-tips/Small-Business-Taxes/Penalties-for-Not-Filing-a-1099-Misc-IRS-Form/INF19313.html
Comment: What kind of relationship do you have with this company?  What kind of business are you/they in?
Comment: @Joe I'm an independent software developer and they are an affiliate program that pays me commission for sales. Like Amazons affiliate program but for software and other digital goods. I guess I would be classified as a contractor?
Answer: I'm not sure how this gets entered in TurboTax, but this income from the company should be included in the Schedule C (or C-EZ) Line 1 Gross Receipts total, along with all of your 1099-MISC income from your business and any other income that your business took in. You don't need a 1099 from them, and the IRS doesn't care (at least from your perspective) if you got a 1099 or not; in fact, they probably expect you to have some non-1099 income.
We don't know why the company chose not to issue 1099 forms, but luckily it isn't your concern. You can fill out your tax return properly without it.
Note: This answer assumes that you didn't have any tax withheld from your checks from this company. If you did have tax withheld, you'll need to insist on a 1099 to show that.


Real game flash developer animation?

Question: I have a game and in this game , i programed player can pick up an item for use , example "gun", "blade". But this is a trouble, I am thinking about this trouble because if i have many item in game , i must create many animation for character for using item. I want ask people have experience in game flash development about experience create animation optimize for game :)
Thank
Comment: Could you please be a bit more specific about your exact problem so we can give better answers? I don't get the question at all. Do you have a specific animation-problem, or do you just want general advice about animation?
Answer: There isn't much programming involved with this but here it goes:
You can create a single set of animations for your character which will play while he/she is holding the item. Then create separate sets of animations for the items that will correspond to your character animations.
For example you will have an animation of your character walking as if he/she was holding an object. To create an animation for the character walking while holding a gun, you should use the walking character animation, add the gun, animate the gun, then delete the character animation from the overall animation object.
This way then you add the gun animation to your character animation on the scene and call play on both, both will animate correctly.
Answer: One approach would be to create your character animations with a stand-in MovieClip to represent an item in the character's hands. Then whenever you play this animation you can replace that stand-in MovieClip with the item the character actually has equipped.
Well, I suppose you wouldn't be replacing the stand-in so much as make it invisible and then attach the new item to it, but the point is don't put the exact item into the animation ahead of time and just stick it in there on the fly.

Real game flash developer animation?


Can you live in a Caravan for a long term? permanently?

Question: To stay mobile, and also avoid the expensive cost of rent, can you live in a Caravan for a long term? or even permanently?
Comment: Welcome to Sustainable Living! Could you please add in which country you are living? Rules vary.
Comment: What restrictions are you thinking?  Health (physical or mental), legal, practical? [Are you aware of people that do](https://travellermovement.org.uk/gypsy-roma-and-traveller-history-and-culture)?
Comment: in Canada, thank you! I am not aware of legal restrictions yet, and hygiene is also a concern.
Answer: Some people live in caravans (or trailer homes as they are known in the US), sometimes for long periods of time, as a matter of necessity due to their economic situation. Most people find such a living arrangements unsatisfactory. In addition to social stigma associated with this style of living, most people dislike to lack of permanency.
Other issues involve the requirement for personal hygiene facilities: bathing, ablutions, laundry facilities for clothing & bedding. As well as limited space for a kitchen pantry and refrigerator.
Edit - Additional material.
Depending on the location, some caravan parks allow people to stay for lengthy periods of time, others only allow people to stay for a limited amount of time before having to move elsewhere. Some of the reasons for limited tenure is to clear the park for the local tourist or holiday season. Which can be a lucrative time for caravan park owners and also because some customers are regular temporary customers during such periods.

Additional Edit
This recent news item (12 June 2022) illustrates what some people are prepared to due, with years of planning, to be able to live a nomadic lifestyle in a specially commissioned off grid caravan.
Answer: It is not for everyone, and even if it agrees with you, it may not be for you for a very long time. That said, I'd plan for a fixed period, after which you could choose to extend, or abort.
I lived on a bicycle for over a year! My only possessions were what could be carried on the bicycle. I slept under highway overpasses quite often. I would occasionally hire a room for a month or a few, to get me through the winter, or so I could make some money in order to continue.
I have a step-daughter who loves the vagabond life-style. As I recall, her primary motivation was the high cost of rent. She has a 26' motor home, and pulls a trailer that hauls a motorcycle. She's a phlebotomist (blood drawer), who does contract work. When a contract is nearing its end, she can renew if she likes where she is, or look for another contract somewhere else. I don't know how she makes her parking arrangements, but I know she almost never stays in organized campgrounds. Most places where she works have employee shower facilities. She generally avoids putting anything in the blackwater tank, unless "on the road" instead of parked somewhere.
Providing for your income may be difficult if you don't have a "portable" career, though. Even with a conventionally portable gig, like remote work, maintaining a reliable Internet connection may be difficult.
So it certainly is possible, with some compromises and sacrifices.
In Canada, you'll have to either flee to the West Coast for the winter, or put some serious thought into how to make it through the winter. Most motor homes are not designed for over-winter occupancy, with requirements to drain your fluids and bring your deep-cycle battery indoors, for example. And if you do choose to heat it over the winter, keep in mind that they typically are not insulated well, and you may be spending a lot of fuel, just to have it go through the walls and ceiling!
Legally, everything is going to depend on the jurisdiction. On Salt Spring Island, there are places where the authorities simply turn a blind eye to, and there are caravans parked there most of the summer, and well into the colder months. Take time to talk to other such campers, who will share with you where there are good places to stay, and where to avoid.
I'm not sure what this has to do with "sustainable living," though! I think people living in campers may well use more resources than someone staying on even a small plot of land where they can supply at least some of their own food.
I had great fun while being a vagabond, but it eventually got old. "Normal" things like having a family, or having a typical "career advancement" can be a challenge. But if that is not a problem for you, go for it!


SharePoint Foundation 2010 Solution Deployment

Question: I was wondering if it is possible to develop a solution using
SharePoint Foundation 2010 with Visual Studio and to directly deploy
the solution to a Share Point Server 2010 Site?
Answer: To deploy a SharePoint solution to the local SharePoint server

In Solution Explorer, choose the project that you want to deploy.
On the menu bar, choose Build, Deploy Solution.
The .wsp file is created and installed on the local SharePoint server. Also, the features are activated.

MSDN article
Answer: Due to SharePoint Foundation is a subset of the SharePoint Server. Yes, it's possible to deploy a Sharepoint Solution that developed on SharePoint Foundation to SharePoint Server with the same version.
Check also How to Install and deploy a SharePoint (WSP) Solution Package using SharePoint Shell


Difference between "which are you" and "which you are"

Question: What is the difference between these two sentences?

Which bike are you using?
Which bike you are using?
Answer: The first one is a question but should include a question mark:
Which bike are you using?
The second one is incorrect as written but could form part of a correct sentence:
I want to know which bike you are using.
Answer: Use this: verb 'be' in different tenses
In order to form questions, you simply need to interchange the first two words of the constructions given in the chart(refer to the link) and then complete the question as you wish. This works well for all the constructions that have been mentioned.
For ex: 'I was...' ==> 'Was I...?' (statement==>question)
The correct answer is a direct result of the explanation given above. You need to use 'Which bike are you using?'. If you interchange the two, you will find that the result is a part of a statement(Tell me the name of the bike that you are using.)
I cannot tell you the difference between the two options that you've provided because the second one is wrong. I can only state which one is correct and how the interchange works.
Pay close attention to the punctuation marks as well.
Hope that helped!
Answer: This is a question (or specifically interrogative sentence).
Question:

Are you a boy?

Sentence:

You are a boy.

So if you just switched the verb/subject, the sentence will be question/sentence.

Now let us look at a longer sentence.
Question:

Which bike are you using?
Which bike you are using?

Sentence:

You are using a bike.

Thus, the first sentence is correct and the second sentence is grammatically wrong.
Conclusively, you are is a sentence while are you is a question.
Same goes for other types:

Is this helpful?
This is helpful.


why NSTimer works just once in swift

Question: I have a http request, and if I receive the response correctly, then I want to start a timer that fires a function each second. That function is also a http request.
this is my code to fire the timer
    if let data = data {
        do{
            let resultJSON = try NSJSONSerialization.JSONObjectWithData(data, options: [])
            requestClient.id = resultJSON["id"] as! Double
            self.timerResponse = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "checkIfThereAreResponeses", userInfo: nil, repeats: true)
            self.timerResponse!.fire()
        }catch{
        }
    }

as you see, I'm calling a function called checkIfThereAreResponses
In that function, i have a print statement, and that print statement is being printed just once, though my timer supposed to work each 1 second
what missing i have?
And this is the function
 func checkIfThereAreResponeses(){
    if (requestClient!.id != nil) {
        let url = NSURL(string: "http://localhost:blablabla")
        let request = NSMutableURLRequest(URL: url)
        request.HTTPMethod = "POST"

        let session = NSURLSession.sharedSession()

        task = session.dataTaskWithRequest(request, completionHandler: {(data, response, error) in
            if let error = error {
                print("error = \(error)")
            }

            if let data = data {
                do {
                    let resultJSONArray = try NSJSONSerialization.JSONObjectWithData(data, options: []) as! NSArray
        bla bla bla

                }catch {
                    print("no responses yet = \(error)")
                }
            }
        })
        task!.resume()
    }else {
        print("not yet ")
    }
}

the print that i receive JUST ONCE is the no response yet
Comment: I cannot reproduce the issue, is the `print` the first statement inside `checkIfThereAreResponeses`?
Comment: @luk2302 yet it is inside it.
Comment: but is it the *first*? Might be helpful to see the actual `checkIfThereAreResponeses`!
Comment: @luk2302 Okay I gave you the code
Comment: @luk2302 i put now a print at the begining of the function, it still work  just once, but when i put the timer in the main thread it works
Comment: Okay, that is a new issue to me.
Answer: If you have this code in completion handler, it is recommended NSTimer is running in the main thread so this could be the reason. You might need something like:
dispatch_async(dispatch_get_main_queue(), {
    // Your timer logic here
})

Apple docs say:

Timers work in conjunction with run loops. To use a timer effectively,
  you should be aware of how run loops operate—see NSRunLoop.

(NSTimer)

The NSRunLoop class is generally not considered to be thread-safe and
  its methods should only be called within the context of the current
  thread. You should never try to call the methods of an NSRunLoop
  object running in a different thread, as doing so might cause
  unexpected results.

(NSRunLoop)
Comment: are you impling to change my code to `                    dispatch_async(dispatch_get_main_queue(), {
                        self.timerResponse = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "checkIfThereAreResponeses", userInfo: nil, repeats: true)
                        self.timerResponse!.fire()
                        }
                    )` ?
Comment: @sarah yes, something like that is the implication of the answer.
Comment: can i have a link to increase my knowledge in this problem plase ?
Comment: It is not really recommended to run an NSTimer in the main thread, it is just convenient. An NSTimer can run on a runloop on any thread, you just need to be aware of the lifetime of that thread. The main thread is convenient as it will never die unless your application dies. It is important to realize that when the timer fires, the selector is called on the thread which has the runloop that runs the timer.
Answer: An NSTimer works by being scheduled on a runloop. If you call this method in the completionHandler of the session, it will be scheduled to the runloop of the thread that that completionHandler is currently running on. As this thread is not owned by you, but by the system, it will be disposed of by the system. This might be immediately after the completionHandler is done executing, or it might be much later. With the thread, the runloop is gone too, thus, your timer might fire never, a couple of times or just once; there is no telling really as it depends on when the system will remove the thread.
Therefore, you should create the timer on a thread you own, or, easier, dispatch the creation of the timer to the main thread (dispatch_get_main_queue() is your friend). Another option is to create an NSTimer with one of the +timerWithTimeInterval... methods and then add it to the main runloop using [NSRunloop mainRunloop] addTimer: yourTimer forMode NSRunLoopCommonModes]. Remember that the timer will call your selector on the same thread as the the runloop it runs on.
As a side note, polling a server might not be the best way to go on a mobile device. If you control the server, it might be better to send a push notification to the device when there is new data for it. This will save battery on the device, and reduce the load on your server. However, if you do not control the server, it would be more complicated to achieve this, and then polling might be a good compromise.

why NSTimer works just once in swift


Should there be a guide to answer identification request?

Question: we have a guidelines for Identification Requests. So I thought it's better if we have same guidelines for answering those question, since there are many user who only answer it with so little information in it, so we can't tell if it's true or not unless OP clarify the answer.
Comment: I definitely agree we need some guidelines for this. The amount of 1 line name of anime is so high right now.
Comment: Yes, there absolutely should be. However, it's complicated by the fact that there are 2 very different types of ID requests: those with images/video and those with only memories. The guidelines for what constitutes a good answer for each type are very different, so we'd probably need 2 guides.
Answer: Proposal for guidelines
As stated in Logan M's comment there are 2 type's of identification there for here my proposal.
1) image of video identification.

Name of character/series
A short description of the character/series and why it is this character/series
In case of a character image and potentially link to wiki or any anime site (e.g. MAL)
In case of series link to wiki or any anime site (e.g. MAL)

2) Memory based identification

Name of the series
Why do you think so based on the description, what are the matching points.
Short description of the series
Link to wiki or any anime site (e.g. MAL)

With this there should be enough information for the OP to judge properly without having to go search around himself. And the answer itself should be off decent quality as well.
Comment: I think it should be link to any anime site, not just wiki since MAL and others are often use for searching anime/manga as well
Comment: @ShinobuOshino I think any site offering information is fine indeed. I just did wiki for ease of use, if you know a beter way to state it please feel free to edit it.
Comment: Yeah MAL or anidb is rather a better option as they usually include a cover image along with pictures, and lot more information.


remote desktop connection programatically simulate windows c++

Question: My question is: How you can create same basic functionality with the remote computer, like using the same mouse, so when i take move on my computer that will appear at same moment on remote computer, like on the team viewer. Can anyone explain what is the philosophy behind all remote desktop shared programs, how i can see what I'm done on the remote computer...
Codes & link's will be appriciate too... :)
Answer: You could take a look at the code of mRemote, a remote connection manager for a number of protocols (RDP, VNC, ssh and more). Maybe that will answer some of your questions?
Cheers,
Sebastiaan


gsettings error: using the memory backed

Question: My laptop has very high resolution and I often want to change the scale factor. Until recently the following command worked just fine
gsettings set com.ubuntu.user-interface scale-factor "{'eDP1': 16 }"

But now I am getting the error
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.

I tried all the proposed solutions including the accepted answer in this post but none worked. If I open the dconf-editor GUI I can change the scale factor just fine but this is less convenient.  I'm lost as to how to fix this but I would love to be able to change the scale factor via a command instead of a GUI.
Answer: Try running the following command line first:
export GIO_EXTRA_MODULES=/usr/lib/x86_64-linux-gnu/gio/modules/


Using CSS rotation and displaying information one after another from left to right

Question: Okay this is quite a weird question, but im creating a timeline showcasing films and there release dates and i have a lot of films that i want to display as text vertically. I want each film to appear next to each other, going from left to right.
here is what i have at the moment -
http://ignitethatdesign.com/CheckFilm/index1.php
It is a mix mash as the first film im displaying is displaying at the top.
Im calling in the data from a database and an image appears if there are days between each film release
Any help would be greatly appreciated im lost in a sea of css
Answer: This is something that could be pretty easily done in Flash, but given that the trends are moving away from flash, it makes sense to do it in html 5. An html 5 way to do this, which might be kind of fun is to do it in html 5 canvas.
Given none of those are of interest, taking what you currently have, it seems like it would be a good idea to start a sort of timer in javascript, that timer will call a function that iterates through the li's and moves them down...
For example
<code>var t=setTimeout("moveListItems()", 500); // just adjust the time in milliseconds to make
                                          // it faster or slower.

function moveListItems() {
    // place move list items code here
    //probably a call to update the css "top"
    $('#horiz_container li').each(function() {
       alert(index + ': ' + $(this).text());
       var newtop = $(this).position().top + 250;
       $(this).css('top', newtop + 'px');
       //check if the top is too low then reset to top to the top of the container
    });

}
</code>
Beware: Not tested
You may need to tweak it a bit, make the li's absolute so they don't screw up the layout as they move, but that's how i'd go about it. If I did anymore then I'd be committing a crime against the spirit of hacking. Have fun!