What is the difference between IEqualityComparer and IEquatable?

Question: I want to understand the scenarios where IEqualityComparer<T> and IEquatable<T> should be used.
The MSDN documentation for both looks very similar.
Comment: @RamilShavaleev the link is broken
Comment: [MSDN sez:](https://msdn.microsoft.com/en-us/library/ms132151(v=vs.110).aspx)"This interface allows the implementation of customized equality comparison **for collections.**" which of course is inferred in the selected answer. MSDN also recommends inheriting `EqualityComparer` instead of implementing the interface "because `EqualityComparer` tests equality using `IEquatable`
Comment: ... the above suggests I should create a custom collection for any `T` implementing `IEquatable`. Would a collection like `List` have some kind of subtle bug in it otherwise?
Comment: good explanation http://www.anotherchris.net/csharp/icomparable-icomparer-equals-iequatablet-iequalitycomparer/
Answer: IEqualityComparer<T> is an interface for an object that performs the comparison on two objects of the type T.
IEquatable<T> is for an object of type T so that it can compare itself to another of the same type.
Comment: Same difference is between IComparable / IComparer
Comment: (Edited) `IEqualityComparer` is an interface for an object **(which is usually a lightweight class different from `T`)** that provides comparison functions that operates on `T`
Comment: Which one does Enumerable.Except use?
Answer: When deciding whether to use IEquatable<T> or IEqualityComparer<T>,
one could ask:

Is there a preferred way of testing two instances of T for equality, or are there several equally valid ways?

If there is only one way of testing two instances of T for equality, or if one of several methods is preferred, then IEquatable<T> would be the right choice: This interface is supposed to be implemented only by T itself, so that one instance of T has internal knowledge of how to compare itself to another instance of T.
On the other hand, if there are several equally reasonable methods of comparing two Ts for equality, IEqualityComparer<T> would seem more appropriate: This interface is not meant to be implemented by T itself, but by other "external" classes. Therefore, when testing two instances of T for equality, because T has no internal understanding of equality, you will have to make an explicit choice of a IEqualityComparer<T> instance which performs the test according to your specific requirements.

Example:
Let's consider these two types (which are supposed to have value semantics):
interface IIntPoint : IEquatable<IIntPoint>
{
    int X { get; }
    int Y { get; }
}

interface IDoublePoint  // does not inherit IEquatable<IDoublePoint>; see below.
{
    double X { get; }
    double Y { get; }
}

Why would only one of these types inherit IEquatable<>, but not the other?
In theory, there is only one sensible way of comparing two instances of either type: They are equal if the X and Y properties in both instances are equal. According to this thinking, both types should implement IEquatable<>, because it doesn't seem likely that there are other meaningful ways of doing an equality test.
The issue here is that comparing floating-point numbers for equality might not work as expected, due to minute rounding errors. There are different methods of comparing floating-point numbers for near-equality, each with specific advantages and trade-offs, and you might want to be able to choose yourself which method is appropriate.
sealed class DoublePointNearEqualityComparerByTolerance : IEqualityComparer<IDoublePoint>
{
    public DoublePointNearEqualityComparerByTolerance(double tolerance) { … }
    …
    public bool Equals(IDoublePoint a, IDoublePoint b)
    {
        return Math.Abs(a.X - b.X) <= tolerance  &&  Math.Abs(a.Y - b.Y) <= tolerance;
    }
    …
}

Note that the page I linked to (above) explicitly states that this test for near-equality has some weaknesses. Since this is a IEqualityComparer<T> implementation, you can simply swap it out if it's not good enough for your purposes.
Comment: The suggested comparison method for testing double-point equality is broken, since any legitimate `IEqualityComparer` implementation *must* implement an equivalence relation, which implies that in *all* cases where two objects compare equal to a third, they *must* compare equal to each other.  Any class which implements `IEquatable` or `IEqualityComparer` in a fashion contrary to the above is broken.
Comment: A better example would be comparisons between strings.  It makes sense to have a string comparison method which regards strings as equal only if they contain the same sequence of bytes, but there are other useful comparison methods *which also constitute equivalence relations*, such as case-insensitive comparisons.  Note that a `IEqualityComparer` which considers "hello" equal to both "Hello" and "hElLo" must consider "Hello" and "hElLo" equal to each other, but for most comparison methods that wouldn't be a problem.
Comment: @supercat, thanks for the valuable feedback. It's likely that I won't get around to revising my answer in the next few days, so if you want, please feel free to edit as you see fit.
Comment: This is exactly what I needed and what I'm doing. However there is a need to override GetHashCode, in which it will return false once the values are different. How do you handle your GetHashCode?
Comment: @teapeng: Not sure what specific use case you're talking about. Generally speaking, `GetHashCode` should allow you to quickly determine whether two values differ. The rules are roughly as follows: **(1)** `GetHashCode` must always produce the same hash code for the same value. **(2)** `GetHashCode` should be fast (faster than `Equals`). **(3)** `GetHashCode` doesn't have to be precise (not as precise as `Equals`). This means it may produce the same hash code for different values. The more precise you can make it, the better, but it's probably more important to keep it fast.
Answer: You have already got the basic definition of what they are. In short, if you implement IEquatable<T> on class T, the Equals method on an object of type T tells you if the object itself (the one being tested for equality) is equal to another instance of the same type T. Whereas, IEqualityComparer<T> is for testing the equality of any two instances of T, typically outside the scope of the instances of T.
As to what they are for can be confusing at first. From the definition it should be clear that hence IEquatable<T> (defined in the class T itself) should be the de facto standard to represent uniqueness of its objects/instances. HashSet<T>, Dictionary<T, U> (considering GetHashCode is overridden as well), Contains on List<T> etc make use of this. Implementing IEqualityComparer<T> on T doesn't help the above mentioned general cases. Subsequently, there is little value for implementing IEquatable<T> on any other class other than T. This:
class MyClass : IEquatable<T>

rarely makes sense.
On the other hand
class T : IEquatable<T>
{
    //override ==, !=, GetHashCode and non generic Equals as well

    public bool Equals(T other)
    {
        //....
    }
}

is how it should be done.
IEqualityComparer<T> can be useful when you require a custom validation of equality, but not as a general rule. For instance, in a class of Person at some point you might require to test equality of two people based on their age. In that case you can do:
class Person
{
    public int Age;
}

class AgeEqualityTester : IEqualityComparer<Person>
{
    public bool Equals(Person x, Person y)
    {
        return x.Age == y.Age;
    }

    public int GetHashCode(Person obj)
    {
        return obj.Age.GetHashCode;
    }
}

To test them, try
var people = new Person[] { new Person { age = 23 } };
Person p = new Person() { age = 23 };

print people.Contains(p); //false;
print people.Contains(p, new AgeEqualityTester()); //true

Similarly IEqualityComparer<T> on T doesn't make sense.
class Person : IEqualityComparer<Person>

True this works, but doesn't look good to eyes and defeats logic.
Usually what you need is IEquatable<T>. Also ideally you can have only one IEquatable<T> while multiple IEqualityComparer<T> is possible based on different criteria.
The IEqualityComparer<T> and IEquatable<T> are exactly analogous to Comparer<T> and IComparable<T> which are used for comparison purposes rather than equating; a good thread here where I wrote the same answer :)
Comment: `public int GetHashCode(Person obj)` should return `obj.GetHashCode()`
Comment: @HristoYankov should return `obj.Age.GetHashCode`. will edit.
Comment: Please explain why the comparer must make such an assumption about what the Hash of the object it compares? Your comparer does not know how Person computes its Hash, why would you override that?
Comment: @HristoYankov *Your comparer does not know how Person computes its Hash* - Sure, that is why we have not directly called `person.GetHashCode` anywhere.... *why would you override that?* - We override because the whole point of `IEqualityComparer` is to have a different comparison implementation according to our rules - the rules we really know well.
Comment: In my example, I need to base my comparison off `Age` property, so I call `Age.GetHashCode`. Age is of type `int`, but whatever the type is the hash code contract in .NET is that `different objects can have equal hash but equal objects cant ever have different hashes`. This is a contract we can blindly believe. Sure our custom comparers should adhere to this rule as well. If ever calling `someObject.GetHashCode` breaks things, then it is the problem with implementors of type of `someObject`, it's not our problem.
Comment: This answer is AWESOME, dude. I could not found an understandable explanation ANYWHERE. Thanks!
Answer: IEqualityComparer is for use when the equality of two objects is externally implemented, e.g. if you wanted to define a comparer for two types that you did not have the source for, or for cases where equality between two things only makes sense in some limited context.
IEquatable is for the object itself (the one being compared for equality) to implement.
Comment: You are the only one who actually raised the "Plugging in Equality" (external usage) issue. plus 1.
Answer: One compares two Ts. The other can compare itself to other Ts. Usually, you'll only need to use one at a time, not both.


Why does the Darkness need to eat souls to grow stronger?

Question: In season 11 we have seen that every time the Darkness eats a soul it grows a little bit stronger. At the end of season 10 Death tells Dean that the Darkness is older than God and more powerful, as he says that God and his archangels could not destroy the Darkness but only lock it away. So why does the Darkness need to eat souls to grow stronger? If it is older than God then there would not have been any souls around for it to eat at that time and yet it was still more powerful than God, so why does it need to eat them now?
Comment: Why does a guy with 50 billion dollar still want to earn more money, even though he can't possibly spend it all before he dies?
Comment: Maybe they taste good.
Comment: Because souls are delicious.
Answer: The Darkness was Reborn. She had no physical form yet on this new planet God created after her imprisonment. She possessed a baby perhaps to give her time to learn more about this world before getting her revenge. After being trapped for that long it'd be foolish to attack God blindly. The souls seem to help her grow. Think of her vessel as a bottle and her power as a stream of water flowing into the bottle. The bottle grows as her vessel matures. She can harness more of her potential power. She's also probably pretty rusty having been sealed for so long.
Answer: Not necessarily stronger
I don't know that it is accurate to say that she is stronger than God.  She is different.  She is the Darkness.  She eats (absorbs) energy.  So you can't incinerate her or produce energy to destroy her.  That will just make her stronger.  Of course, she said that she was stronger than God, but she wasn't necessarily truthful.  Further, even if she thinks of herself as stronger than God, she isn't necessarily correct.  Perhaps God thinks the same, in reverse.
Perhaps you might say that she is a stronger absorber than God.  In theory, someone could absorb energy from her faster than she could absorb energy from someone else.  But God either couldn't (or wouldn't) do that.
During her long imprisonment, she had no one from whom to absorb energy.  So she grew weaker and weaker.  When released, she could not produce much energy, but she could still absorb energy.  It's unclear if God could have overwhelmed her then.  Perhaps she didn't know.  Perhaps she lacked the energy to produce godly intelligence.  As she grew, she absorbed energy faster and faster.  Could she always have maintained that rate?  We don't know.
Maybe God didn't want to
She's God's sister.  Maybe it wasn't that God couldn't kill her (whatever he may have said) but that he didn't want to.
We can't really say one way or the other, because the Supernatural God is not always truthful.  Perhaps if he had tried to destroy her, she would have just grown faster.  Perhaps he loved her too much to destroy her and was willing to allow the rest of his creation to be destroyed instead.  Perhaps it would have been a bad idea.
It's possible that attempting to destroy the Darkness would have damaged her in ways that were not helpful.  Perhaps destroying her memories and her connection to God, so she would have lost what little restraint that she had.  So we could have been left with the ravening hunger and no sentience behind it.
In a similar vein, the Supernatural Wikia says:

Mandatory Existence - Amara's existence is necessary and provides balance to reality. As God put it, "Light needs Dark", and "Dark needs Light". If she were to be killed, reality itself would end. However, it was said that if both God and the Darkness were to die, a new balance would be established.

Again, killing the Darkness isn't necessarily impossible, but it still might be a bad idea.


What does the compression setting do to a PNG?

Question: I was most surprised to find that the compression setting in the render settings, made a huge difference in the file size of a png. Is there any image quality degradation with the compression on?

What does blender do to the png if the compression is at 100%, as apposed to 0%?
Comment: @Ward I know that, but what *is* going on then?
Comment: @TobiasKienzler The size of the file has a general tendency to dominate load time because of the speed of disc access.  Also, decompression times are not *that* much worse for heavily optimized files.  The compression/decompression process for PNGs is intentionally asymmetric.  The highly compressed files aren't necessarily harder to decompress because the algorithm is the same, they are simply a more ideal file that took more time to find in the first place during compression.
Comment: I know that PNG is lossless, so you don't have to worry about compression artifacts. ;D If you compressing JPEG yo, it will have almost like a color bleed and some freakish squariness.
Comment: Heck if I know. I can see how this can be blender related, but it really isn't a blender question. Maybe another network had an answer.
Comment: You can also run exported images through a tool like [ImageOptim](http://imageoptim.com "ImageOptim") to likely get even more optimization. I use this for assets I'll be putting online or in the applications I work on (I'm a software dev) because a smaller file size means they'll load more quickly into the application.
Comment: Is that entirely true or does increased compression mean decompression might also take longer? (Though that might still be faster than disc access time, I don't know...)
Comment: @CortAmmon I see, so basically write-once-read-many. (Why am I getting a notification of your reply only now?)
Answer: No, the compression slider does not affect the image quality.
PNG uses a lossless compression algorithm called DEFLATE (among some other things), which is the same as is used to produce .zip files.
Long story short, the only difference between PNG files with 0% and 100% compression is the CPU time it takes to perform the compression (and of course the resulting file size).
Some tests:
Saving a 1920x1080 render of the default cube:
0% compression:
0.66 seconds, 8116 kilobytes (8 megabytes)
Zipping an uncompressed png produced a 48 kilobyte file.
100% compression:
0.86 seconds, 36 kilobytes
That's a compression ratio of 225 (!) and a time difference of .2 seconds.
Saving a pure high-frequency noise image (also 1920x1080):
0% compression:
.9 seconds, 8116 kilobytes (8 megabytes)
Zipping an uncompressed png produced a 5496 kilobyte file.
100% compression:
2.01 seconds, 5108 kilobytes (5 megabytes)
That's a compression ratio of 1.58 and a time difference of 1.11 seconds.
All tests were conducted with blender and compression times measured from the "saving" time printed to stdout and averaged over five samples.
As you can see, more uniform images (like the grey flatness of an empty blender scene) are much more compressible than highly variable images (such as pure RGB noise). The time it takes to perform the compression isn't very significant even in a worst-case scenario, however that 1 extra second could add up when rendering an animation.
Comment: so does that mean it would take a little longer to render out to a png with compression? (probably talking a *very* small difference.)
Comment: Awesome answer, I learned a few things :)
Comment: Also while a second does not sound like much it can be a killer in a rendering where you get the data out form a very fast render like a opengl dump. Now your results are allmost entirely dependent on how fast you can dump the data to disk.
Comment: @David Doing some tests now; we'll see exactly how insignificant ;)
Comment: @gandalf3 Does Blender use threads for writing the image when rendering an animation?  I.e., assuming you're using the cpu for rendering if you have 8 cores one of them could be writing the file while the others are rendering, and as soon as it's done saving the image then that core would start rendering.
Comment: @lumpynose If [this](https://developer.blender.org/rB6f92604e539b2114763150fb1ace60d28e59a889) does what I think it does, yes. I'm not sure if "file writing" includes compression though.


What are the examples of multi-threading in a web server?

Question: So I've been reading about multi-threading these past few days. Can you give me a real life example where the multi-threading might be used in a REST API web server?
Answer: A web server serves hypertext transfer protocol requests. While there is no requirement whatsoever on arrival times and service times, the idea is a successful service sometimes gets requests even more frequently than $\frac 1 {\text service-time}$: for requests to neither be discarded nor queue up, there must be some concurrency in processing.
There are different approaches to unwanted and/or illegal disclosure of confidential data. Typically, threads sharing any given processor "core" concurrently enjoy identical access rights, while separate computers/processors/cores are restricted individually:
If serious about confidentiality, better restrict multi-threading to reducing the service time of single requests.
This is where the REST of the protocol (& API (client side, mainly)) comes into the picture:
Keeping all information feasible with the client and transferring it per request (REpresentational State Transfer) means identifying requests for the same confidentiality domain was extra effort.
Answer: There is a thesis turned into free (and open) book that covers pretty much every aspect of concurrent Web servers and applications (including REST): Concurrent Programming for Scalable Web Architectures (thanks to Benjamin Erb).
But the main idea is simple and old: as long as separate requests are independent from one another (and HTTP pretty much mandates that) we can process them completely separately and concurrently, i.e. each one in its own (logical) thread. Sure enough in the real world there are lots of nuances that make straightforward implementation not very practical and you need to "upgrade" this basic idea with various mechanisms (thread pool, connection pool, asynchronous IO, and so on).


Rerun failed Feature Upgrade

Question: Is it possible to rerun a feature upgrade? I have this situation where the feature upgrade fails to create a SitePage. The feature version is updated, is there some way to rerun the upgrade without updating the Feature XML and doing a new deploy?
Answer: look this http://spfeatureupgrade.codeplex.com/
Comment: I couldn't find any functionality to run a upgrade again, if the version ha been increased.

Rerun failed Feature Upgrade


Hyperoctahedral group and odd permutations?

Question: I apologize in advance for possibly using faulty terminology as I am a group theory novice. I am interested in looking at Hyperoctahedral groups when viewed as permutations. According to Wikipedia, when $n=2$, one can obtain any of the permutations of the square (https://en.wikipedia.org/wiki/Hyperoctahedral_group), because one of it's group elements is an odd permutation (i.e the cycle on 4 elements). However, there is no odd permutation in the group when $n=3$. Does this hold for larger values of $n$ as well?
Comment: The thing about permutations being odd or even is that this requires us to have identified them as permutations in the first place. And any group can be embedded in the group of even permutations of a suitable set, which makes this distinction only meaningful when we are discussing a specific way to realize everything as permutations. In this case, are you considering the group as a subgroup of the symmetric group on $2n$ elements?
Comment: As mentioned in a comment on the answer, you may want to be more specific about what you are looking for. I do know a decent amount about these groups, as they are Coxeter groups of type $B$, but I am not at all sure what would constitute an answer to your question.
Comment: This is a bit of an advanced topic for a group theory novice, no?
Comment: It's for a research problem in a different area (coming from CS), that may have some connections here depending on the answer.
Comment: might I ask what the somputer science problem is, if it's roughly simple to explain to an undergrad mathematics major?
Comment: @TobiasKildetoft I believe so... (If I was to label the vertices of the hypercube and perform one of the rotoreflections, I am interested in looking at the permutation induced by the resulting labelling of the rotoreflection).
Answer: I'm not sure what exactly you are stating when you say that there is no odd permutation in the case $ n = 3 $, mostly because a group is not just a collection of permutations, it can have a lot of different structure.
Anywho, the wikipedia page also says the hyper octahedral group with $ n = 3 $ is isomorphic to $ S_4 \times S_2 $, and thus contains the element $ ( (1, 2, 3, 4) , e ) $, which you might consider in some sense to be an odd permutation.
It might be easier to visualize as just rotating a hypercube in one dimension, since they are defined as the group of symmetries of those objects. They all are composed of squares, so just rotate one of the squares four times, and there will be an element of order four (that rotation).
Comment: Sylow's theorem says that there is a subgroup of order $p^n$, not an element of that order. There is a group of order $4$ with no element of order $4$.
Comment: The question is, i think, the following one. Fix $n\ge 4$. Let $X=HC(n)=\{-1,+1\}^n$ be the cartesian product of $n$ copies of the (multiplicatively written) group with two elements. The group of signed permutations $W$, acts on this hypercube $HC(n)$, $(w,x)\to wx$, and thus each $w$ induces a permutation, we write then $\rho:W\to S(X)$ for this group morphism $w\to \rho(w)$, from $W$ to the symmetric = permutation group of the symbols in $X$. From $S(X)$ we have a sign morphism to $\pm 1$. Question: Is $W\to S(X)\to \pm 1$ surjective - for a specific $n$? For which $n$?
Comment: Thank you for your answer! What I am trying to say is: when you look at the "Illustrations of rotoreflections" for the cube ($n =3$) - https://en.wikipedia.org/wiki/Octahedral_symmetry - they all induce permutations with an even number of inversions. However this is not the case for $n=2$. But based on what you have said, it sounds like the answer should be a `no`.
Comment: Here they have an exhaustive list for $n=3$: https://en.wikiversity.org/wiki/Full_octahedral_group
Comment: @DerekHolt Yeah... I never really learned that, but I threw it out there. I thought to fact check, but didn't - anyways, I edited the answer. Nevertheless, there is an element of order four in each of these groups (actually, I believe there are a lot).
Comment: @dan_fulea After, thinking about it more, I believe that this is indeed what I want.
Comment: @Nizbel99, I see a few varying interpretations of what you are asking lingering here. I would post up to try and answer the important question here (perhaps another answer), but I don't think anyone here is exactly sure what you want. At any rate, if we are still talking about a group element as "even" if it has an even order and "odd" otherwise, the rotoreflections in these groups all have even orders.


Is there any limit in storing values in NSUserDefaults?

Question: I have used NSUserDefaults to store some values in my app. Is there any limit for storing values in NSUserDefaults?
Comment: I'm not sure but you can see this [link](https://forums.developer.apple.com/message/50696#50696).
Comment: NSUserDefaults is intended for relatively small amounts of data, queried very frequently, and modified occasionally. Using it in other ways may be slow or use more memory than solutions more suited to those uses. Currently there is no limit for local user defaults except on tvOS. I found this information by "cmd click" on UserDefaults which takes you to their source file. I read the documentation looking for this information, but couldn't find it there.
Answer: As long as there's enough space on the iPhone/iPad, you can store NSUserDefault values. All those values is stored into a .plist file, and this file is very small, most of the time under 1 kb (unless you store a lot of data).
Comment: Might be true but  see this [link](https://forums.developer.apple.com/message/50696#50696). What is correct?
Comment: Is there any impact on device performance after add big files/Data ?
Comment: Try opening up one of these plist files using Xcode, and you will see the performance hit with the nice rainbow spinner. That's Xcode, but probably a similar hit occurs on the device.
Answer: There are limits on what types you may store: they must all be Property List objects, namely NSString, NSNumber, NSData, NSArray, and NSDictionary. Furthermore, you may only store NSArray and NSDictionary if the values are also property list objects; also, all the keys of the NSDictionary must be strings.
Note that an object like UIColor is not on the above list. So if you want to store a color in the defaults database, you'll need to convert it into a string or data object first, then convert it back when you read the defaults.
As far as size limits, there are none that are documented, but note that all data will be stored as a property list file. The entire file is read in and written out as a whole, so if you use NSUserDefaults to store a large amount of data that only changes in parts, you will be wasting a lot of time doing unnecessary I/O.
Comment: The point about this being a single file is quite critical.  Very good information, thanks.
Answer: From iOS SDK codes, and related Apple official document..
extension UserDefaults {

    /*!
     NSUserDefaultsSizeLimitExceededNotification is posted on the main queue when more data is stored in user defaults than is allowed. Currently there is no limit for local user defaults except on tvOS, where a warning notification will be posted at 512kB, and the process terminated at 1MB. For ubiquitous defaults, the limit depends on the logged in iCloud user.
     */
    @available(iOS 9.3, *)
    public class let sizeLimitExceededNotification: NSNotification.Name

    // ....
 }

Summary

Currently there is no limit for local user defaults
On tvOS, where a warning notification will be posted at 512kB, and the process terminated at 1MB.
For ubiquitous defaults, the limit depends on the logged in iCloud user.
Answer: Everyone has answered the direct question of "is there a limit?" However, I found this thread really looking to understand "how much is too much to store in UserDefaults?"
If you're looking for that answer, here's a useful thread. The responses I found helpful were to go to your project file and look at the plist file size:

5 objects is almost nothing. You'll be fine!

On my machine, I have about 28 megs of data in my user defaults. That's not causing any problems at all.

From general programming experience with arrays I would guess performance starts to rapidly decay when you get into 1000's, depending on element size. Therefore in a program I wouldn't have an issue storing a couple of hundred elements. This said I would probably start using a sqlite3 database or coredata, sooner rather than later if I were you.

Important to remember:
The above alleviated my concerns that my growing number of defaults (about 20-25 now) would cause problems. I use CoreData already, so I was considering which to use since my number of allowed user preferences/customizations is growing long. So, I'm going to stay with user defaults.
However, as other answers have pointed out, the file will be read and written as a whole. So reading 20 key/string dictionaries and 5 key/boolean dictionaries just to retrieve one string... not exactly ideal. Nonetheless, if it doesn't hurt performance and it saves you a ton of code, why not?
Answer: As many already mentioned: I'm not aware of any SIZE limitation (except physical memory) to store data in a .plist (e.g. UserDefaults). So it's not a question of HOW MUCH.
The real question should be HOW OFTEN you write new / changed values... And this is related to the battery drain this writes will cause.
IOS has no chance to avoid a physical write to "disk" if a single value changed, just to keep data integrity. Regarding UserDefaults this cause the whole file rewritten to disk.
This powers up the "disk" and keep it powered up for a longer time and prevent IOS to go to low power state.

From "Energy Efficiency Guide for iOS Apps":
Minimize data writes. Write to files only when their content has changed, and aggregate changes into a single write whenever possible. Avoid writing out an entire file if only a few bytes have changed. If you frequently change small portions of large files, consider using a database to store the data instead.

READS are no problem, as all values are cached in memory.
EDIT: (July 2019): I just found this very good blog post by Jeffry Fulton.
https://jeffreyfulton.ca/blog/2018/02/userdefaults-limitations-and-alternatives
He describes in detail the different aspects of the user defaults and also writes about some performance tests.
Happy Coding!!!
Answer: As of iPadOS 13.1 beta 3, I'm now seeing the following message when trying to store a larger object (an image).

2019-09-14 11:01:29.634368+0100 MyApp[1686:147223] [User Defaults]
  CFPrefsPlistSource<0x283c7d980> (Domain: com.example.MyApp, User:
  kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents
  Need Refresh: No): Attempting to store >= 4194304 bytes of data in
  CFPreferences/NSUserDefaults on this platform is invalid. This is a
  bug in MyApp or a library it uses

However retrieving the key appears to still work.
Comment: I am having this issue too! Have you found the cause/solution?
Comment: @SAHM Not sure re the cause. As I was simply saving a single image as a user preference, I ended up writing the data to the documents folder instead of using user defaults.
Comment: Out of curiosity, @Doug, were you using "synchronize" after saving?
Comment: I have some thoughts about this if you want to chat.
Comment: @SAHM Nope I wasn't calling `synchronize`. As stated in the docs, "this method is unnecessary and shouldn't be used."
Comment: I thought calling synchronize might actually have caused the problem at the time I wrote this. Since then, I think I read somewhere, though it might have been an old thread or old documentation, that individual values stored shouldn't be more than 4kB.
Answer: There is No Limit for storing values in NSUserDefaults..
Comment: I'm getting this error: Attempting to store >= 4194304 bytes of data in CFPreferences/NSUserDefaults on this platform is invalid. This is a bug in App or a library it uses
Answer: The only Storage Limitation in NSUserDefaults is the Device Storage Capacity.
As much as there are available Storage Space in an iOS Device, you can practically store data in NSUserDefaults. The key-value pair is stored on a xml structured file (.plist) which is stored in an App Bundle.

The user defaults system and key-value store are both designed for
  storing simple data types—strings, numbers, dates, Boolean values,
  URLs, data objects, and so forth—in a property list. The use of a
  property list also means you can organize your preference data using
  array and dictionary types. It is also possible to store other objects
  in a property list by encoding them into an NSData object first.

About the User Defaults System
Answer: As far as my knowledge there is no limit for storing in NSUserdefaults.
Comment: I'm getting this error: Attempting to store >= 4194304 bytes of data in CFPreferences/NSUserDefaults on this platform is invalid. This is a bug in MyApp or a library it uses
Answer: It whatever the maximum allowed file size is on the drive. You can use this piece of code to check it out!
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *myKey = @"key";
int sizeOfFile = 1024; // Fill in proper file size here
NSData myObject;
NSString *someFilePath = @"PathToYourFileHere";

for(int i = 1; i < 9999999999999999; i++)
{
  myObject = [NSData dataWithContentsOfFile:someFilePath];
  [defaults setObject:myObject forKey:[NSString stringWithFormat:@"%@%i", myKey, i]];
  NSLog(@"Iteration: %i, TotalWritten: %i", i, i * sizeOfFile);
}

Comment: FYI `int` values don't go that high, so you'll end up with an overflow (assuming you make it past ~2.15B iterations) in your loop. Before that though, you'll end up overflowing `sizeOfFile`.


How to improve visualization skills (Graphing)

Question: Okay, so my problem is, that I have difficulty visualizing graphs of functions.
For example, if we have to calculate the area bounded by multiple curves, I face difficulty in visualizing that how the graph would look like. And in Integral Calculus, it is very important to plot the graph in some problems, so how can I improve my visualization skills? What can I implement in my daily math problem solving to improve these skills?
Edit:I am not talking about normal functions, simple ones like Signum function, absolute value function etc. I am talking about more complex ones like
\begin{equation*}
y=e^{|x-1|+|x+2|}.
\end{equation*}
Comment: I am not talking about normal functions, simple ones like Signum function, absolute value function etc. I am talking about more complex ones like $y=e^{|x-1|+|x+2|}$
Comment: Draw graphs of a lot of functions.
Comment: Yes. Plot it. And plot tens and tens of other functions. Your intuition will increase 100 fold.
Comment: Okay, lets say I plotted them, but how will I get the intuition? Suppose I am familiar with the graph of $|x-1|+|x+1|$ now how will I get the intuition about the graph of $e^{|x-1|+|x+1|}$?
Comment: You will get intuition with practice. For example, when you do several excercises, you will know that, in your particular example, you should separate your cases into $x > 1$, $-2 < x< 1$ and $x<-2$.
Answer: To better grasp the behavior of complex functions, in the first place you must master the behavior of the classical ones, like the powers ($x^d$, for all $d\in\mathbb R$), the polynomials, the exponential, the trigonometric functions and their inverses. You must know by heart their range and their domain, their behavior at $\pm\infty$, their asymptotes and their remarkable points like extrema and inflections, their periodicity.
You must also have some understanding of what occurs when you combine functions, by addition, subtraction, multiplication or division. What about the asymptotic behavior, what about remarkable points (are they preserved, do they move...)
You should also be able to relate the slope (first derivative) to the graph itself, and in particular identify monotonous sections. Also by the second derivative, increasing/decreasing growth.
You should also be able to select "interesting points" and compute function values there. All of this takes a lot of practice and experience.
Let us look at your given example, $e^{|x-1|+|x+2|}$.
We first notice that this is an exponential function applied to the argument $|x-1|+|x+2|$. The exponential function has a pretty simple behavior: it is monotonic, growing from $0$ at $-\infty$, to $\infty$ at $\infty$. The growth is extremely fast. There are no extrema, no inflections, an horizontal asymptote. A simple point is $(0,1)$.
Let us now focus on the argument. It is the sum of two absolute values. The absolute value function is piecewise linear, with slope $-1$, then $1$ at the point $(0,0)$. Its graph is two half-lines meeting at the origin. In the case at hand, we have a sum of two such functions, horizontally translated by $1$ and $-2$ units respectively. When you add these, you will obtain a piecewise linear function, with slopes $-2$, $0$ and $2$. The section with slope $0$ is the constant $3$, and this is the minimum value.
Now if you "pass" this function to the exponential, the graph will get deformed non-linearly with large values becoming larger and larger. You will get a section of the decreasing exponential $e^{-2x}$ from $-\infty$ to $-2$, then the constant $e^3$, then the increasing exponential $e^{2x}$, from $1$ to $\infty$.
On the plot below, the $y$ axis has been compressed to make the exponential behavior visible. (In blue, the argument of the exponential.)
Comment: Thank you so much! But I think exponential function has a vertical asymptote also?
Comment: No, it doesn't.
Answer: A friend of mine sent me a link to graph paper site: http://www.printablepaper.net/category/graph
gives you a choice of squares per inch and whether there are bolder lines each inch. Draw stuff. Do not imagine drawing things. Actually do so. If you want to solve $3 |x| = e^x,$ print out some graph paper, draw $y = 3|x|$ and $y=e^x$ on the same page and see what happens.
There is a tradition in, let us call it, neuroscience, possibly a small minority opinion, that we have intelligence precisely because we have hands; one aspect of this is http://en.wikipedia.org/wiki/Homo_faber  I see lots of students on this site who have no ability to visualize in either two or three dimensions because they have never drawn any pictures or built any models of polyhedra. Part of this is that software such as mathcad took over early in many engineering and architectural fields; the people involved are the poorer for it. This has some references: http://www.waldorfresearchinstitute.org/pdf/Hand-Movements-Create-Intelligence.pdf


Can I change the radio frequency according to my encryption algorithm?

Question: I know that information can be changed by changing the frequency of electromagnetic vibrations.My question is, can I change the frequency according to my encryption algorithm? That way I can get a frequency that doesn't match anywhere. This would increase the reliability of my algorithm.
cable radiates. Can I algorithmically change the electromagnetic radiation emitted by a cable of the same material?
Comment: "This would increase the reliability of my algorithm." - we've been reading this asking about a method to secure radio transmissions.  Are you asking about something else?
Answer: More physical layer security than encryption. Spread spectrum wideband radio using frequency hopping does this.
https://en.m.wikipedia.org/wiki/Frequency-hopping_spread_spectrum
What is required is a hard-to-predict sequence of frequencies. This can be generated using an encryption mechanism. The Spread spectrum communications handbook book is the classic reference. There is also code division spread spectrum but you want frequency hopping.
Answer: The answer to this is actually "yes", but it's generally not done due to encryption, it's done for the practicalities of RF.    When you change frequencies, you often change the channel saturation for information.  There's at least one commercial application that uses AES-128 after an ecc25519 exchange when for a 60GHz channel when you have power enough to run the oscillator (80Mbs channel) and then uses the same key for SIMON128/128 for a coherent clock case (100kBs channel), which is powered passively when the power is off for the larger system.
Although not what you'd call encryption, but obfuscation, synchronized chaotic oscillators are used for analog feeds, and sometimes other "eyes only" items because the brain can remove the signal from the noise. Those circuits will use a different LC tank based on the the frequency of the carrier because you need to use the carrier as a "sync" signal for the best outcome.  If you are part of the IEEE, look for a paper from MWSCAS from between 2008 and 2010 by the US Army.  That's the best implementation that I've seen from a tutorial perspective.


How to fix a large hole in drywall

Question: My girlfriend knocked a chair over when she tripped and it made a large hole approximately 6 inches by 6 inches in a triangle shape. How do I fix this as fast and as cheap as possible ?
Comment: Does this answer your question? [What is the best method to patch a large hole (2-3 inches) in drywall?](https://diy.stackexchange.com/questions/128/what-is-the-best-method-to-patch-a-large-hole-2-3-inches-in-drywall)
Comment: Possible duplicate: [What is the best method to patch a large hole (2-3 inches) in drywall?](http://diy.stackexchange.com/q/128/33), or [How do I fix a hole in drywall?](http://diy.stackexchange.com/q/11594/33)
Answer: There are hole patch kits that can be purchased at most hardware stores. If that's not an option (maybe the hole is too big?) you can take a small square of drywall that's bigger than the hole and hold it up over the hole, mark around the piece with a pencil and then cut the hole out to the outside of the line. Then take two slats of 1x3 and use screws to attach them through the wall on either side of the hole creating a backing for the patch. Once that's done apply the patch to the backers and proceed to mud and tape the seams. Here's a diagram:

If you need help with the mudding/taping process there are other q/a's on this site that cover it better than I can so I won't go into it.
Answer: Traditional solution:
Get some thin wood strapping. Cut two pieces a bit longer than the hole. Slide them through the hole, and drive wallboard screws through the surviving plaster to hold them in place. Cut a wallboard patch to fit into the opening, and drive wallboard screws through it into the wood supports you've just installed. Spackle the joint between the patch and the plaster; spackle over the screw heads. Smooth the surfaces you've spackled. If necessary, lightly sand the area and/or apply more spackle and/or alternate the two until the screws, and the joint between the old and new wallboard, are completely level. Prime and paint.
Less traditional solution: There are self-adhesive screening patches available. Get one larger than the hole, stick it in place, apply spackle over and through it to create a new plaster surface. Smooth (giving particular attention to hiding the edges of the patching screen) until it looks sufficiently level (ie, not an obvious patch, even with raking light at a low angle). Prime and paint.
I'm sure there are other answers; these are the two I've used. Both are cheap and fairly easy. The traditional solution is probably more durable, but I can't prove that.
Comment: Well sure you could prove which solution is more durable, but it would probably involve another hole in your wall. :)
Answer: Remove all of the damaged sheet rock with a razor knife, or small saw. Once you have a hole with solid edges, measure the thickness of the sheetrock on your wall. Buy, beg, or borrow a small piece of sheetrock in that same thickness. You can buy small pieces at your local home center, but if any new homes are being built near you, you can get a piece just for asking. Cut the replacement to the same size as your hole. The more precisely your patch matches the hole, the better. Make the edges smooth with no small pieces of facing paper on the edges. Sand the facing paper off one inch in on both your patch and the existing wall. Get a big balloon. Stick it in the hole and blow it up. This will give you something solid to work against. Place the patch in the hole, use sheetrock tape and mud to patch the seam. There are lots of youtube videos, and the folks in the paint dept of your local home center can also be valuable help. Two or three coats of mud, sand after each, then paint to match. Take a piece of the broken sheetrock you removed to your home center, and they can match the paint on your existing wall.

How to fix a large hole in drywall


Setup Print Server Using CUPS?

Question: I have recently acquired an old Dell Dimenion 2400 which I hope to use as a print server. My goal is to hook it up to an old HP Inkjet printer and be able to print anywhere in the house via IP. What would be the best method for accomplishing this goal?
Answer: You will find guidance on how to setup a CUPS server, which you can find on the Ubuntu server guide. Hope that helps.

Setup Print Server Using CUPS?


Does Dropbox or any other similar solution ignore files based on regexp?

Question: I want to setup ignoring policies using syntax similar to .gitignore. Does any of "Dropbox-like" services allow this?
Comment: Looks like this company may offer something like that for google drive: https://www.syncdocs.com/ -- https://www.syncdocs.com/2013/06/ignoring-certain-file-types-when-syncing-to-google-drive/
Answer: Ubuntu One allows you to do this with a global configuration file.
On Linux, a section of the configuration file ~/.config/ubuntuone/syncdaemon.conf allows you to specify Python regular expressions to be ignored.  A similar configuration file exists on other platforms.
Answer: Not your preferred solution, but Dropbox and Google Drive allow you to set specific directories not to synchronize to a particular system.
Dropbox support: How do I select which folders to sync to my computer?

Selective sync is a feature of the Dropbox desktop application that allows you to select only the folders you want to be synced to your computer. Selective Sync gives you the control to ensure you have only the files you need on any computer. It's especially handy if you want to save space on netbooks and other computers with small hard drives.

Google support: Choose what syncs to your computer

Everything in My Drive will sync to your Google Drive folder, unless you choose to sync individual folders:

Organize your files into folders that you plan to sync.
Click the Google Drive desktop icon google drive desktop icon on your computer.
Select "Preferences..." (Mac) or "Settings" (PC).
Check the box next to "Only sync some folders to this computer."
Select which folders you'd like to sync to your Google Drive folder.
Click Apply changes.

And, just today, SkyDrive now has selective sync, which looks like it works exactly the same as the others.
Comment: Ignoring policies have an automatic perspective that manual directory syncing definition do not provide, as for DropBox, GoogleDrive and SkyDrive. Though your answer is valuable, you don't answer the original question I guess as far as I can tell.


Running react native app in Android Virtual Device on Windows

Question: I'm near frustration. I'm trying to get my react native app to run for hours. all tutorials I find, are skipping the part of Android Virtual devices not starting properly.
I have my react package via node and expo.
HOME and JAVA variables are set. VT-X is enabled. Android Studio is up to date. Whenever I start the Android Virtual Device (set up as Pixel 2) the Android device keeps presenting the Animated Google Logo, but doesn't start.
When I try to start the Android Device via Expo localhost I get an error about  USB debugging, which I don't want.

Couldn't start project on Android: Error running adb: No Android
  device found. Please connect a device and follow the instructions here
  to enable USB debugging:
  https://developer.android.com/studio/run/device.html#developer-device-options.
  If you are using Genymotion go to Settings -> ADB, select "Use custom
  Android SDK tools", and point it at your Android SDK directory.
Answer: Error occurred because the current computer and emulator are not connected.
Did you set up the Genymotion as described in the error?
If you hadn't, go to Settings -> ADB, select "Use custom Android SDK tools" ->
and point it at your Android SDK directory.
Download the SDK from here: http://developer.android.com/sdk/ to C:\android-sdk\
C:\android-sdk\

Run emulator, click  developer options, enable USB debugging and enable Wi-Fi to Cellular.
Run the Genymotion Shell and type devices list to find the IP address of the device.
Open the terminal and enter adb connect deviceIp:5555. Make sure the connection to adb device is correct. Enter adb usb and adb tcpip 5555.
Android adb documentation


Trouble redirecting all pages in a folder to a page at root level

Question: I've searched, tried various examples, and none, other than creating an explicit list of redirect statements seems to work.
The biggest issue I have is that, although I have access to deploy web pages to the site, I do not have access to any web hosting control panel - site access was inherited, and until now it's been fine, but I think that it is either running an old version of apache, or rewrite rules are not allowed.
Anywa, over the years, the site has changed several times, and after registering the site with Google Webtools, I found the list of pages that gave crawl errors, so created an HTACCESS file to deal with these.
Over the years, there have been folders deployed and named in camel case and all lower case, and so all I wanted to do was to redirect all files in a folder to the new folder in the .htaccess file level, i.e.
My .HTACCESS currently has 120 lines, and an example batch are as follows:
redirect 301 /challenge/stanley_steamer.htm /lsr_history.html
redirect 301 /challenge/stanley_steamer.html /lsr_history.html
redirect 301 /Challenge/index.htm /lsr_history.html
redirect 301 /Challenge/Record.htm /lsr_history.html
redirect 301 /Challenge/Stanley_Steamer.htm /lsr_history.html
redirect 301 /Challenge/Sponsors/Avery_Weigh-Tronix.htm /sponsors.html
redirect 301 /contact/index.html /contact.html
redirect 301 /design/details.html /design.html
redirect 301 /design/index.html /design.html
redirect 301 /Design/Engine-drive_train.htm /design.html
redirect 301 /Design/Rear.htm /design.html
redirect 301 /Design/Home_Page.htm /design.html
redirect 301 /Design/index.htm /design.html
As you can see, I have some cases where the folder name is camel, others lower, and other cases where there is a htm and an html file of the same name that is listed in the crawl error log.
All I want to do is, in the example above, redirect all pages from /Challenge/ and /challenge/ to lsr_history.html, but all files in /Challenge/Sponsors/ to sponsors.html.
I also have a huge list of individual team pages that I list one by one and each one redirects to the new team page.
I've tried examples like:
RedirectMatch 301 ^/[Cc]hallenge/ /challenge.html, but this returns a 'Error 404 Not found'.
Any ideas or examples of how I can cut down my htaccess file to simplify this will be gratefully received.
Regards
Martin
Answer: I wouldn't bother searching for cases inside the match string for this kind of thing if I could avoid it - have you tried just specifying the RedirectMatch in lowercase, and appending [NC] to the end of every line? (that will tell mod_rewrite to ignore case and match regardless, which may save you some time)
if you have collections of similarly-formatted rewrites, why not group them together with one particular set of rules for each? That way you could cover, for example, all incoming URLs with one subdirectory with one rule, and all incoming URLs with a single subdirectory one with another rule. If nothing else, it could help simplify viewing the .htaccess file :)
(Take everything I suggest with a massive dose of salt, I'm still getting to grips with the black magick of mod_rewrite myself)


What is the difference between monolithic and non-monolithic dc-dc converters?

Question: What is the difference between monolithic and non-monolithic dc-dc converters?
For example this is monolithic dc step down controller: LTC3609
Comment: Bruk, your question will become semi-useless if that link dies. Please add the relevant details into your post so that there's enough information there to answer your question. It will also save the rest of us having to "click".
Answer: Monolithic in the sense of the part you have refers to the fact that the power switch(es) is(are) integrated into the controller IC as a single part. There are cases when you have to purchase the switches as external components.
In my opinion, a truly monolithic converter would be one that also integrates the inductor and possibly even the capacitors. I mean, look at all the stuff you have to add for the converter to work!
Comment: [This is what I call a monolithic switcher](http://www.ti.com/product/TPS82130)...
Answer: Monolithic means that everything is on the same rock.
Comment: Agree. Where, in this context, "rock" refers to semiconductor die
Answer: To be a little more specific, monolithic in this sense usually means that the power switches (FETs usually) are on the same silicon die as the control circuitry.
There are also converters that have several die in the same package, e.g. a controller and 2 FETs for a sync buck.  This might be transparent to the user as from the outside it seems like a single IC, but it is not referred to as a monolithic part.


Interface Builder for iPhone tutorial

Question: Anyone know of some tutorial material for how to use Interface Builder for iPhone development? I can find sample projects and stuff and that's extremely helpful, but they do not reveal how things where setup in Interface Builder.
Comment: Thanks for your answers. All (at the time of this writing) are very helpful. For some reason the system doesn't allow me to check them all as valid answers. And my rep isn't high enough yet for me to vote up any answers. But anyway, I'm watching the casts and have bought that book. Great stuff!
Answer: The Pragmatic Programmers have some screencasts on building an iphone application.  I haven't watched those, but I have watched some of their other videos and they were pretty good.
They've also got a free getting started with Xcode and Interface Builder episode, which may be what your looking for.
Answer: You can actually get a lot out of these screen-casts which are free as of now:
http://www.cocoacast.com/?q=blog/1
Note that they are very 'connected' to the Aaron Hillegass book on Mac programming (which is also a great resource). Some of them show him using IB (but of course not all). The book is more focused on Mac then iPhone, but if you're just trying to get going it's a great point of departure. I'm working on my first iPhone project and had never programmed with Objective C, XCode IDE and Interface Builder. I read the first 200 pages and used Apple's docs after that. Now it's been several months and I found the above screen-cast and wished I had that getting started! Good luck
Answer: The Pragmatic Programmers book iPhone SDK Development includes some Interface Builder walkthroughs.

Interface Builder for iPhone tutorial


Help me diagnose this crash

Question: a lot of users of my app are sending in this crash but I'm unable to repeat it.. So I'm looking for tips on how I can troubleshoot it, here's the relevant section of the crash log:
Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
objc[1535]: FREED(id): message retain sent to freed object=0x640ad0

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                     0x9116f4b4 _objc_error + 116
1   libobjc.A.dylib                     0x9116f4ea __objc_error + 52
2   libobjc.A.dylib                     0x9116d7dc _freedHandler + 58
3   ...my_company.my_app      0x00045635 -[MyObject mySelector] + 1494
4   com.apple.Foundation                0x90be18d4 __NSFireTimer + 141
5   com.apple.CoreFoundation            0x93a38adb __CFRunLoopRun + 8059
6   com.apple.CoreFoundation            0x93a36464 CFRunLoopRunSpecific + 452
7   com.apple.CoreFoundation            0x93a36291 CFRunLoopRunInMode + 97
8   com.apple.HIToolbox                 0x92982e04 RunCurrentEventLoopInMode + 392
9   com.apple.HIToolbox                 0x92982bb9 ReceiveNextEventCommon + 354
10  com.apple.HIToolbox                 0x92982a3e BlockUntilNextEventMatchingListInMode     + 81
11  com.apple.AppKit                    0x9576e78d _DPSNextEvent + 847
12  com.apple.AppKit                    0x9576dfce -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
13  com.apple.AppKit                    0x95730247 -[NSApplication run] + 821
14  com.apple.AppKit                    0x957282d9 NSApplicationMain + 574
15  ...my_company.my_app      0x00002042 start + 54

So, from this line:
3   ...my_company.my_app      0x00045635 -[MyObject mySelector] + 1494

I can deduce that in mySelector a message is being sent to an object that's already being released, but I've looked through the code and I just can't see it and there are too many other dependencies to post the code here.
So my questions are:

What do the numbers at the end of each line indicate, in the above example it's 1494.
On the preceding line there's a reference to __NSFireTimer - does this indicate that mySelector is being called by a NSTimer in my code?
I've tried running my app with Zombies enabled, aside from sprinkling my code with checks that each object != nil in mySelector, what else can I do if I can't repeat the crash?

Any help on this would be greatly appreciated!
Comment: Send your code if you can so that I could resolve the crash.
Answer: Use instruments to watch allocation. I found it helpful.
Answer: I believe the numbers at the end of each line indicate the offset in terms of code bytes within the function at that point in the backtrace. A debugger would use this information to map the code offset to an actual line of source code (it needs debug information in the application to do this). In your case, the information is not particularly useful.
The reference to NSFireTimer means that your main thread's run loop has had a timer scheduled and it has fired calling [myObject mySelector]. I think from the stack trace we can assume that the timer has invoked "myObject" directly since there are no other intervening stack frames.
My guess would be that the object has been freed but it was the target of a scheduled timer in your main thread, which you have forgotten to remove.
How the object became freed in the first place depends on how your application is compiled. Does it use Garbage Collection, or does it rely on retain/release memory management?
If you are not using garbage collection, then you have probably missed a "retain" somewhere. Perhaps your object has been autoreleased and the runloop has cleaned it up when you didn't expect it to?
If you can identify the timer involved, you might want to consider disabling the timer in the dealloc or finalize method of your class. You could also add some logging there to show you when the object is freed.

Help me diagnose this crash


How and why have some words changed to a complete opposite?

Question: One example that comes to mind is terrific which originally denoted something quite terrorising while now it has positive connotations... How and why did these changes occur?
Comment: This "reversal of meaning" is common in slang  - *terrific* is an old textbook example; *bad* and *wicked* are a bit more up-to-date. As RegDwight indicates, there are many other reversals not related to slang, but in the case of slang I think we can safely assume it's usually intended to confuse outsiders who don't speak the lingo, and to reinforce group cohesiveness among those who *do*.
Comment: Nice question, I didn't know that...
Comment: Related to various degrees: [What words have opposite meanings in different regions?](http://english.stackexchange.com/questions/1999/), [English words that are their own antonyms](http://english.stackexchange.com/questions/1820/), [How often do words change meaning then revert back to their original meaning?](http://english.stackexchange.com/questions/18195/), and a few questions about specific words such as *ravel*, *inflammable*, *impregnate*, *equivocal*, and whatnot.
Comment: @FumbleFingers:  Agreed, as in Cockney argot.  For example,  "Eh, don't pick on the little bugger, he's only a dustbin!"  (That is, don't hassle him, he's just a kid--which rhymes with dustbin LID.)  Or, "Hey, gimme that watch.  I wanna take a butcher's!"  (That is, give me the watch; I want to take a look--which rhymes with butcher's HOOK.)  Weird!
Answer: See Etymonline:

1660s, "frightening," [...]. Weakened sense of "very great, severe" (e.g. terrific headache) appeared 1809; colloquial sense of "excellent" began 1888.

So the transition was gradual in this case, unlike with many slang words that are used to mean the opposite thing on purpose.
Comment: Take, for example, *sick*. Even *bad* is the new *good*.
Comment: @Pete in that case the TNY has simply forgotten the numerical value of the term, the destructive portion how remains. I wouldnt call that a reversal. If decimate means death to 1 in 10 the opposite would be something positive to 1 in 10 of some group.
Comment: Whereas "sick" and "bad" are of the non-gradual opposite class; these words have their extra force precisely because their literal meaning is the opposite, and as the slang-meaning becomes more widespread, I expect they shall fall out of favor.
Comment: "Decimate" is perhaps one similar, though not the complete opposite. The New Yorker the other week published an article that held that someone "decimated ninety percent of" something. :-)
Comment: @PeteWilson, obviously, if someone decimated 90 per cent of something, it means he killed nine per cent of it off. Simple maths. ;)
Answer: The OED says this slang is now especially used for skateboarding and surfing, and the first quotation is from a 1983 UNC-CH Campus Slang by the University of North Carolina, Chapel Hill:

Sick, unbelievably good: The Fleetwood Mac concert was sick.

The Concise New Partridge Dictionary of Slang and Unconventional English (2007) says:

bad adj 1 good; tough. US, 1897.
sick adj ... 6 excellent; wonderful. On the principle that BAD means 'good' US.

Partridge notes bad is much older, and the OED gives the source as George Ade's story of a black shoeshine boy, Pink Marsh : a story of the streets and town (1897):

She sutny fix up a pohk chop 'at's bad to eat.

It says its originally US slang and means something good or excellent, especially stylish or attractive. The later quotations trace its use through black and jazz slang (1928, 1955, 1959, 1971 and 1989) until more 'mainstream' use is noted in a US newspaper in 1995 and a UK book in 2006.
The OED has another similar meaning of bad which is originally African-American and used of a person who is so dangerous they inspire admiration, or impressively tough, or especially formidably skilled. The earliest quotation is from 1843 but only meaning dangerous or hostile without admiration. Their next earliest is in 1938 in a musical context, as are some of the others, and I can see some overlap of these meanings.

A Dictionary of Slang and Unconventional English (2002) gives a possibly unrelated term using sick, but it's somewhat similar:

In knock (one) sick, to astound, 'flabbergast': coll.: - 1923 (Manchon).
Answer: Usually because some spin-doctor (a profession far older than the term) saw an opportunity. Terry Pratchett, Lords and Ladies (wherein elves are inhumanly cruel):

Elves are wonderful.  They provoke wonder.
Elves are marvellous. They cause marvels.
Elves are fantastic. They create fantasies.
Elves are glamorous.  They project glamour.
Elves are enchanting.  They weave enchantments.
Elves are terrific. They beget terror.
The thing about words is that meanings can twist like a snake, and if you want to find a snake look for them behind words that have changed their meaning.
No one ever said elves are nice.
Comment: Great quotation, but an inaccurate answer.  As @RegDwight's answer documents for this case, changes in meaning like this almost arise from the distributed creativity of a speech-community, not from some individual spin-doctor.
Comment: I find this amusing because "nice" is another adjective whose meaning has changed dramatically...
Comment: I'd disagree with the downvoters, often it does take just a single literally work to introduce a new term to the language or to change the meaning to something different.


Move players inventories to another server

Question: I have 2 minecraft servers with 2 different hosts. I want to transfer players data (including their inventory) from server1 to server2. Is it possible? I will also be moving the world to server2, but will chests keep their items?
Comment: Copying the `playerdata` directory within your world save should get you the player's data, including their inventories. However, keep in mind that this will also include their location, which might be bad for their in-game health if the worlds are different across the servers. If you also want achievements and other stats, you can also copy the `stats` directory.
Answer: When you move the world data and the player data to the new server everything will be just as it was.
I have moved server at least a dozen times. If you move everything at one time you should be fine. If you move the data separate you may run into issues.
The player data files should be under the same directory as your world data. Just copy everything together.


HP ProCurve switch 2848 J4904A

Question:
How to configure a local password security for the switch, can it be accessible with a default password?
Can the web browser interface password be deleted?
Comment: Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
Comment: This was sorted thank you, the switch was set to factory default settings.
Answer: You can create two levels of access, Manager and Operator.
You can do this first via the web interface.
Also you can disable web access by no web-management in CLI or by setting Web Agent Enabled parameter to No via we-management.
Please take a look at this file:
http://ftp.hp.com/pub/networking/software/59906023-1004-Management-Guide.pdf
Comment: Thank you Moghaddas.

I have tried to get to web console but i am prompted for user name and password as much as i do not know them, how can i get in the console without having to set factory default settings?
Comment: If you have a password already set on this switch, and you have physical access to the switch,
press and hold the Clear button (on the front of the switch) for a minimum of one second to clear all password protection.
ftp://ftp.hp.com/pub/networking/software/Security-Oct2005-59906024-Chap02-Passwords.pdf
Comment: Before i do that is it going to clear password protection only or is it going to clear everything on the switch, Such as the IP and the Mac?

And for the Password i haven't set any as the switch was configured long time ago.

HP ProCurve switch 2848 J4904A


Why did the Doctor think that Daleks cannot say Mercy?

Question: In The Witch's Familiar (Season 9, Episode 2 of the new Doctor Who), the Doctor literally said that "mercy" should not be in the vocabulary of the Daleks. Yet in the past at least one Dalek has said "mercy". The one I'm thinking about is The Big Bang (Season 5, Episode 13) where River Song got one to say "mercy".
Comment: The Ninth Doctor also heard a dalek cry for mercy in series 1 "Dalek", when he was torturing it.
Comment: While Daleks did say "Mercy" before, never before was it in the context of "I show mercy" which was the final straw if I remember correctly
Comment: Unless I miss remember, the Doctor wasn't present at that time.
Comment: Related: http://scifi.stackexchange.com/questions/73834/why-did-a-dalek-beg-river-song-for-mercy?rq=1
Answer: As tilley31 points out in the comments, The Doctor has indeed heard a Dalek say "mercy" before. This is the first time he has heard it from a Dalek which is accused, by a highly unreliable source under emotionally charged circumstances, of killing his friend. A Dalek who, in general, is behaving in an un-Dalek like fashion. Something wasn't right, and that stood out for him just then.
Why then and not before? Before, it wasn't so relevant. Before, he didn't have the emotional distance to be as analytical: he was encountering his first Dalek since the war and what he believed to be his own act of double genocide. Before, he didn't have ready access to Davros's childhood, and a choice to make in that regard.
Answer: If we can dismiss the notion that this was simply a continuity error, and I think we can, since Steven Moffat wrote both "The Big Bang" and "The Witch's Familiar," then I think the answer has to be that the Daleks in fact never were able to say "mercy" before the conclusion of the latter episode.
If you recall, throughout this two-parter, both the Doctor and Davros remember the Time Lord as having abandoned child-Davros on Skaro ("I'm not helping you. I'm helping a little boy I abandoned on a battlefield. I think I owe him a sunrise"). It wasn't until the end of the second episode that the Doctor traveled back in time and rescued child-Davros in the hope of seeding the future killing machines with the concept of mercy, so he could clue his future self into the fact that Clara was inside the Dalek machine.
Therefore, the previous events related in "Dalek" and "The Big Bang" must have happened slightly differently before the Doctor changed the timeline, and thus the Doctor remembered them differently. What this insinuates about how the Doctor's encounter with Clara in that tunnel originally went doesn't bare thinking about.
In other words, timey-wimey wibbly-wobbly.
Answer: Let's think as a time traveler and answer this from an infinite time perspective. Davros made the Daleks after having seen that mankind was becoming and thought to make them indestructible since they are supposed to be the next evolutionary step. The Doctor is knowledgeable with all creatures and creations and was at the start and rebirth of the Daleks and was inside a sick Dalek and shared memories with one, rescued Clara from them numerous amounts of time, and had his identity erased from there data banks. It would only stand to reason the Doctor is also Multi specied. He was ONCE a Dalek and hated it and sought to have the memory erased and then reraised the Daleks to admit that they are a series in mankind's life and evolution even as an enemy,making him and his ability to save and Create Clara. In the new series he goes back in time to Davros and reprograms a word that is a code word for his Co created Daleks for an safe word for him and Clara, Mercy! The Doctor knows Davros is going to feed Them the Daleks his life story and this was the Doctor substituting for the word he removed from the Daleks which they knew cause he feed them his mind to the sick Dalek...HATE!
Comment: when exactly did the doctor become a dalek once and had memory erased
Comment: what do u mean the doctor was once a dalek and then had mem ory erased


Is OSCP qualification considered Junior or Mid?

Question: I have 7 years computer programming experience and i'm currently doing the pwk (oscp) and I just wanted to know whether it is considered as junior or mid level regarding penetration testing?
Comment: how do you define junior and mid?
Comment: Im not sure I can answer that correctly but its a very good question.

I guess what I mean is with the oscp qualification and my years of experience in dev would recruiters/hiring managers view me as junior or mid?

I only ask because I would have placed my self as a junior but I read a post in a forum which suggested that the oscp puts you at a mid level so I wanted t get other peoples opinions.
Comment: then this is a situation where you need to do informational interviews with companies in your area - you've asked here, on an international community, where standards can vary wildly - instead of asking here, ask those who might hire you
Comment: Thats what I was aiming for. I have asked a few local recruiters but im also considering relocation (atm location undecided), I just wanted to get a wider view of opinions.
Comment: then you've asked a purely opinion-based question - any certification (including the mighty OSCP) doesn't say much - you could be junior, mid, or senior, it depends on too many factors - are you applying at Rapid7 to be part of their professional services to pen text Fortune 50 customers, then you're a junior. Are you applying for a SME who wants their own internal pen test team and they have one other guy, then you're mid.
Answer: It is hard to answer this question since the answer is subjective, but I'll try.
OSCP is definitely a well-recognized and respected certification for penetration testing. Mainly because of the way the test is designed, it is meant to gauge creativity and skills required to be a successful penetration tester since it is not for everyone. For example, a good security management professional with a CISSP would not necessarily be a good penetration tester, since penetration testing is more about being creative and having a knack for breaking into things.
When it comes to penetration testing, I would rate OSCP as one of the best certifications you can get and it should score you a mid-level position in penetration testing but ultimately it's hard to say since job offers depend on a lot of things than just a certification.
Some references to gauge the quality of OSCP:

https://ch1kpee.com/2016/10/04/my-oscp-experience/
https://kaizensecurity.wordpress.com/2016/05/07/oscp-blog-post/

You can find more with Google. Goodluck!
Answer: Since nobody gave a direct answer to the question subject line I will. The OSCP is specifically targeted towards people trying to get into pen-testing. It therefore is an entry-level pen-testing certification. Although, it is a bit more extensive than something like the eJPT, which is even more entry-level. However, the eJPT is not a course I recommend bothering with. You Might as well take the extra difficulty and do the OSCP.
The course itself teaches you everything you need to know to become a pen-tester, as long as you have some basic networking knowledge and IT knowledge in general, then you can do this course maybe not with ease but it isn't supposed to be easy.


Why is wx.SingleChoiceDialog not subclassing properly

Question: I'm trying to subclass the wxpython SingleChoiceDialog class.  I have a TableChoiceDialog class that inherits from SingleChoiceDialog adding generic functionality, and I have 2 sub classes for that add more refined functionality.  Basically I'm O.O.P'ing
In my TableChoiceDialog class I have a line which calls the superclass's __init__, i.e.
class TableChoiceDialog(wx.SingleChoiceDialog):
    def __init__(self, parent, message, caption, list, ...other args...):
        wx.SingleChoiceDialog.__init__(self, parent, message, caption, list)

The problem I'm having is that according to the SingleChoiceDialog.__init__ docstring (and the wxPython API), SingleChoiceDialog does not have the self argument as part of it's __init__ method.
    __init__(Window parent, String message, String caption,
        List choices=EmptyList, long style=CHOICEDLG_STYLE,
        Point pos=DefaultPosition) -> SingleChoiceDialog

As I have it above, the program prints the error:
swig/python detected a memory leak of type 'wxSingleChoiceDialog *', no destructor found.

If I take out the self parameter the system complains that it was expecting a SingleChoiceDialog object as a first argument, which seems to point to it actually wanting a reference to self.
When I take out the parent argument, leaving self (and the other 3 which I'm pretty sure are fine) the system complains that it only recieved 3 arguments, when it needed 4.  I'm pretty certain I'm passing 4.
So.  What blatantly obvious mistake have I made?  Have I totally misunderstood how python handles objects (and hence pretty much misunderstood python)?  Have I misunderstood OOP as a whole?
Please help.  Thanks in advance
Answer:
The call to __init__ seems alright (the first argument to __init__ is always self).
You might have a wrong build of wx. The swig's warning message indicates that there is no desctructor was generated for wxSingleChoiceDialog, see this memory leak discussion.

The message may be unrelated to the __init__ call.
Answer: Some of the dialogs in wxPython are not subclassable because they are not real classes, but instead wrappers around the platform API method for displaying the dialog. I know this is the case for wx.MessageDialog, it might also be the case for wx.SingleChoiceDialog.


Is there any free tool for converting html page to image?

Question: I'd like to take a snapshot of html and save it as image for visualization. Does anyone know any tools that I can use ?
Answer: If you looking just for a tool, there are some plugins for chrome and for firefox that can the for you.
check this:
https://chrome.google.com/webstore/detail/ckibcdccnfeookdmbahgiakhnjcddpki
Answer: Depending on your exact needs the simplest may be to simply take a screenshot while you are looking at the webpage.
Other than that, searching for "html pdf" gets tons of options.


Optimal depth of guitar nut slots

Question: I have bought a second hand acoustic guitar. The nut with the slots for strings is showing in the following picture. The slots are very deep. It looks weird. Should I file the nut to make it lower?
Is there a standard slot depth for acoustic guitars? How about for classical guitars?
I have search in this forum and found no information. I am a beginner, any help will be highly appreciated. Thank you.
Comment: You may well find that more hurt fingers will be the result of heavier gauge strings, as they will need to be tighter.
Comment: How does the guitar play? Any problems with fret buzz? Do you like the action?
Comment: Thanks for asking. This guitar has very nice and big sound. So far no fret buzz, except little buzz on low E 3rd fret, when played really hard. Probably because the 3rd fret metal strip is low. Don't know how to repair it. I'll just leave it.
I adjusted the truss rod yesterday, maybe it hasn't got to its equilibrium yet.
I am not used to such narrow fretboard (44mm on 1st fret!), comparing with my classical guitar 52mm on 1st fret. The 1st fret width 37mm is too wide for me. Is it normal? The action is low. Like it. The strings are too light, 1st and 2nd are too thin, hurting my fingers.
Answer: Weird? What's weird about it? The height of the top of the nut really has no bearing on anything except aesthetics. And that doesn't look too bad. Perhaps a previous player has deepened the slots to make it easier to fret at that end of the fingerboard.
As long as the strings don't rattle or buzz on the lower few frets, it'll be fine. If you really want to file some off the top, do so, but the majority of us would rather spend that time playing the guitar.
Comment: As an instrument maker who has built and reworked many many nuts, I want to underscore the physics of this.  Unless the nut is so high that you run into it with your fingers, it doesn't matter how high it is: the only critical parameter is the height of the action, and as long as your strings don't buzz, you're good.
Comment: Thank your Tim! Fortunately, no buzz on the lower few frets. Yes, it's mainly aesthetics. I have a classical guitar for a long time and the slots depth is quite shallow, probably I am used to that depth. But I doubt a little bit that it may have some negative effects on the sound quality. Thanks a lot for your insight.
Comment: @ScottWallace, well said. Thanks a lot for your opinion.
Answer: Having a low action at the nut is important on a (steel string, non-classical) acoustic guitar, because the string tension is higher than on a classical guitar, making barre chords etc harder. Of course you don't want the action so low that it causes string buzzes, but you say

Fortunately, no buzz on the lower few frets.

Taking that into consideration, my reaction on seeing your guitar is: I'm jealous that you got a guitar that someone took the time to set up properly! Many acoustic guitars are sold with a ridiculously high action at the nut and really needing a proper set-up, including a nut filing.
I'd also think that filing down the top is likely to make the nut look worse. If you really don't like the look, you might consider getting a new nut and filing down the base of the nut to achieve more-or-less the right action, then filing the slots just where necessary to get each string exactly right (or getting a good guitar tech to do it for you). But honestly, things like nut and saddle height are all about getting the instrument to play right.
Comment: thanks. If there is no negative effect on sound quality, I'll leave the nut that way. After I bought it, the action was too high for me. I filed the saddle to lower the action. I am the 3rd owner of this beautiful guitar. You are right. In order to set it up properly one needs good tools. Beside that, perhaps intelligence. It is relatively easy with classical guitars for they don't have truss rod. I hope I can fully set it up well. Thanks again for insight and cheers.

Optimal depth of guitar nut slots


Gesture implying someone is insane

Question: How do you call the gesture where you point at your head and make a circle or a few with your extended finger - when you want to imply someone, or some idea is "nutters" - something so ridiculous it's insane?
Comment: Caveat: Gestures are by no means universally understood. This gesture *may* mean "you are crazy", but it *may* also mean "you are clever". A lot depends on cultural context.
Comment: I'm afraid, there's no single word. You'll have to form a sentence for that.
Comment: @MaulikV: "Phrase request", I believe there is some "canonical" way of describing it.
Comment: @Stephie: Probably so, but - at least in my culture - knocking your head with your finger there means "clever". A twirl, or twisting your finger ("tightening a loose screw") means insane.
Comment: @SF.: which proves my point: Knock on your forehead or temple in Germany and you may be sued for insult. Do this towards a police officer and find yourself in court. Expect to pay 750€.
Answer: According to Wikipedia, this gesture is called:

Cuckoo sign, touched or screw loose. In North America, making a circling motion of the index finger at the ear or side of the head signifies that the person "has a screw loose," i.e. is speaking nonsense or is crazy.

I will repeat my warning that gestures are rooted in their cultural context and may mean completely different things in other cultures.

Gesture implying someone is insane


How to eliminate brain fog quickly?

Question: After 6 hours on a computer, I feel mentally exhausted. What can one do to re-energize the brain? Besides sleeping to speed up recovery, how could one eliminate brain fog quickly? I eat healthful foods and exercise. I also don't drink, smoke, or do drugs. Furthermore, I'm not depressed or down emotionally in any way.
Comment: Get up and get moving. Exercise.
Answer: It's normal to feel exhausted after 6 hours straight on a computer.
Stop taking fluoride and hallogens in water, that will help any latent/semi permanent brain fog, also take breaks, every hours, of 10-25 minutes.
Other poisonous substances can cause "brain fog".
Also look for Iodine food source to detoxify fluoride and hallogens (raw cranberry smoothie is good source,think it's 2 onzes for 100%, potatoes are good too, beans also) . Theres also Choline for cognitive functions, and alot of other minerals act on that aswell.
"
Look for fluoride and sodium laureth sulfate free toothpaste, or make your own, it seems sesame oil kills bacteria responsible for decay,although I have not seen enough proof of it.
I recommend eating sunflower seed(3/4 or 1 cup) or pumpkin seeds , or peanuts http://nutritiondata.self.com/facts/nut-and-seed-products/3076/2 , to get most of the nutrients everyone need, it helps the mental functions.  (Source USDA)
Get F.Lux(reduces blue light) and reduce kelvins to 3500 you can also get Pangobright for even lower light,although in advanced setting F.Lux lets you do it also. If you don't want you can always wear glare+blue light reducing glasses.
Use zoom to read on computer press Ctrl and scroll up with the mouse wheel (or install an app that does it manually).
Comment: You make some remarkable claims here and there's not a single reference to support any of them.

How to eliminate brain fog quickly?


High Powered Radio Transmitters

Question: What kind of radio transmitter would be used on an data collection unit to transmit telemetry over long distances? For example a weather station in a remote location, or in a buoy just off the coast collecting information on currents.
Comment: The title is somewhat mistaken as such transmitters are not typically very high power - constraints of the installations almost guarantee that.  However, allocation to quiet bands, good receivers, and good receive antennas/placement makes it possible.
Comment: Is there any chance I might be able to persuade you to share some context here? Are you just curious, or are you going to make something? Do you have some specific information?
Comment: There are several lakes ~10-100km away from my house, I am hoping to setup something to send the temperature of the lakes to my house. I was hoping for an idea of what kind of transmitters are available.
Answer: There is a network of LEO (low earth orbit) satellites that is available for this sort of application. A VHF transmitter of a few watts power can easily communicate with them.
Answer: Back in the 'good old days' before satellites you could achieve long distance communication either by using 'longwave' transmission (less than 300kHz) or bouncing the higher frequency band transmissions from ionised layers (skipping). VHF and higher are generally line of site systems (unless you manage to bounce them off something). Thankfully, as Dave points out, all this telemetry is now done by relatively low power transmitters aimed at the sky. Fixed location remote data collecting stations are usually powered by solar panels. The low earth satellites are capable of storing the transmitted information and re-transmitting at a different location.
Comment: People still achieve long distance communication with low power. http://en.wikipedia.org/wiki/QRP_operation
Comment: @PhilFrost   Yes, I remember building very low power transmitters when I was about 12 (a very long time ago) - managed to get all the way to America from UK with about 1mW on 160m band - great fun. Problem is you are very reliant on the atmospheric conditions and quiet windows in the ether.
Comment: My boss is currently getting 10,000km+ range from a 5w transmitter, albeit with quite a long bit of wire as the antenna...
Answer: As Dave Tweed mentioned using an LEO satellite is the usual modern way of communicating small amounts of data over long distances. However I noticed in a comment it sounds like a hobby project so you probably don't want to pay for satellite subscriptions and data traffic:

There are several lakes ~10-100km away from my house, I am hoping to
  setup something to send the temperature of the lakes to my house.

For the lower end of that range (maybe up to 20km) with a very good antenna system you'd probably find VHF data transceivers with a few watts of power may be suitable. Several commercial units are available that are license-free depending on your location, for example:
RadioMetrix QPT1 VHF Narrow Band FM 2 Watt multi channel
For longer distances you start to run into problems because the license-free channels don't allow enough power. If you live in a remote area you might find getting a narrow channel allocation isn't terribly expensive, but once again it would be an ongoing cost and some transceivers like the above aren't all that cheap.
About the only low budget solution that comes to mind is to get a ham radio license, maybe take a look at What is Ham Radio? at the ARRL website. You would need to put considerable effort into obtaining a license but once you passed you'd be able to legally transmit at higher powers and lower frequencies. It would also give you enough background so that you could probably put together something using a form of RTTY / Radioteletype to send the data.

High Powered Radio Transmitters


Is there any way to add the related products simultaneously?

Question: i have added a products in the magento store. and now i want to add the related products in each of the products. problem is that, i am adding the products one by one for each product and it is taking a lot of time as i have hundreds of products in the store.
Is there any way to add the related products directly on each and every products. any help will be grateful.
Answer: You can find here an extension that let's you bulk upload (or manually insert) product relations (upsell, crossell, related, and with some simple code changes you can add custom relations if you have any).
This explains how to use it..
You can create a csv file with product skus or ids to be related and their position in the relation:
34,55:2,17:4
99:1,80:10

What is after : means the position of the product in the relation.
You can perform 3 different actions:

Relate all on one line to first product in line.
Relate all products on one line
Relate all products among themselves
Answer: This is a useful link for programatically set related , upsell and crosssell products Link
Comment: Posting a link is not a good practice. Tomorrow the remote page is gone and your answer is not valid anymore. Please copy at least the main idea of the solution you linked into your answer. Even though the article is very small.


Any book reader app that can open a web-page?

Question: Reading an eBook in MoonReader is really joyful. Long HTML article are simllar to books. Is there any book reader apps that can open a web page directly?
Comment: @BlueBerry-vignesh4303 I mean it should open it like an ebook. Have you see the style of showing ebook on such software? You do not need to scroll, they will show it in tiny pages and keep reading progress.
Comment: u meant within a web browser or the app itself should contain a integrated browser?
Comment: I don't know of any eBook reader having that option. But what comes close to it is "Pocket" (formerly known as "Reat it Later"). Their app "reorganizes page content" in a way that makes it easier reading it on small devices. Not exactly what you're after, but IMHO still worth a look.
Answer: https://getpocket.com is good indeed and it can read the pages via a decent voice generator, although the interface for it is clunky.
IMO Pocket is too often not able to process an article right. I can compare to Firefox read mode, which handles almost any text correctly, is pleasure to use but lacks the ability to store the location that you have reached so far.
Other way is to convert the page to .epub or .pdf and read it as usually.


TIGER shapefiles - using and interpreting

Question: I know of the US GIS TIGER file format from years ago, but have never used it.
I'm very shortly going to need to very quickly implement simple geocoding and vector graphics of roads and other features.

Where do I go for information - are there tutorials, example queries, etc?

Are there other ways to include geocoding and basic mapping in a mobile (no internet) device?
-Adam
Answer: As far as I'm aware of, there aren't many applications that make use of the TIGER/Line format directly.  Most apps use TIGER files that have been translated into ESRI's shapefile format.
Edited to add:

Is there information on ESRI's format available?

There's an ESRI whitepaper describing the file format.
If you're planning to use shapefiles in an application, there are various libraries out there.
Answer: The OpenStreetMap project imported TIGER data, you might find useful code snippets there. See the TIGER page on the OpenStreetMap wiki for more information and links


unable to compile the c#.net project ..getting error "resources was specified more than once "

Question: The item "obj\Debug.resources" was specified more than once in the "Resources" parameter + c#.net
Comment: How are you trying to compile? Please give us all the relevant information.
Comment: What does the full compiler output say, also can you include your project file?
Answer: Did you by any chance copy/paste a Form?
the error tells you there is more then 1 class in the project with the same name.
For the others: the problem is reproducable using the following steps:

create a new smart device project.
copy/paste Form1. (so Visual Studio creates the files "Copy of Form1.*)
Build.

sure you don't have any duplicates?
Comment: yes . I copied a form from old project to my new project , but i renamed the all three files(*.cs,*.Designer.cs,*.resx) with new file name.
Answer: If you don't have anything relevant in your resx files just delete them. VS will regenerate them and your project will compile. Do this only for the forms that you copy-pasted.
Answer: VS 2005?
See this:  http://social.msdn.microsoft.com/forums/en-US/vbide/thread/4048e49f-3a6f-46ce-9efd-d046f7041e2e/
In your project file, if you open it in notepad, it will likely have the item listed twice.  You can edit the project file or delete the resource file.   If that doesn't help, also check the properties for your files, and make sure that they are correct, and have "Build Action" set to "Embedded Resource", "Copy to Output Directory" set to "Do not copy" for your resx files.
Answer: Try to clean up the project and then rebuild it again.


Android Bluetooth Received Serial Data Garbled

Question: I've gone through the following thread for my doubt. But, it's still unclear.
Why does the serial BT data I received get chopped out?
Chris, that's a nice workaround you suggested. In the solutions you've provided, the one with appending '\n' is suitable for me as I'm purely transmitting float values from my PC (MATLAB) - after converting to string - to my Android phone. I'm using the following code to group data by searching for '\n' but still the received data is sometimes garbled up. Please tell me what I've to change.
aReader = new InputStreamReader( mmInStream );
mBufferedReader = new BufferedReader( aReader );
aString = mBufferedReader.readLine();
mHandler.obtainMessage(BluetoothActivity.MESSAGE_READ, aString).sendToTarget();

This is what I have in the handler to display the data:
String readMessage = (String) msg.obj;
        try{
            float readM = Float.parseFloat(readMessage);
            text.append("\n" + readM);
        }catch (NumberFormatException e) {
            text.append("\n Number Format Exception!!");
            e.printStackTrace();
        }

What is wrong with this kind of reception? It will be nice if you could answer a bit quickly as this is the concluding part of my project and the deadline is nearing. Thanks!
Answer: I myself solved this. I changed my delimiter from '\n' to 'N' (since no characters are part of my data which are float values) and I've achieved satisfactory transmission rate with more than 99% data integrity (out of 2000 samples that I sent at a rate of 600 samples per second from MATLAB, only 10 got garbled) at the receiver (my App). But, thanks for the idea @Chris Stratton!


How to move master to branch without merge

Question: Is there a reset command that will move the master to another branch without merging? I have some unstable experimental code on branch MIN-791 which has already been merged to the master. I'd rather not deal with it if I don't have to for now. I'd like the MIN-780-493 branch to become the master branch since it has a couple of nice repairs but none of the crap. 'git reset sha#' didn't seem to do the trick. Is there another reset command that will? Or something else? I don't want to lose the changes on MIN-791 since it is still being used to fix a difficult bug, but don't want it in my releases.
Comment: Please clarify *`git reset sha#` didn't seem to do the trick*. Did you get an error? What SHA did you use?
Answer: if you are checked out to master then this
git reset --hard SHA

That will also modify the staging area and working directory.
If you just want to randomly assign values to refs then you would use
git update-ref refs/heads/master SHA

Comment: WRONG update-ref OPTIONS!  Make sure to use git update-ref refs/heads/master SHA.  See http://stackoverflow.com/questions/13073062/git-warning-refname-master-is-ambiguous -- Leaving off the refs/heads/ will eventually cause you to have ambiguous masters and a scary looking log
Answer: Andrew C's answer is right. In addition you can just use the branch name instead of the SHA.
Ex:
git reset --hard origin/MIN-780-493