Test a form with FormControl input

Question: So I have a component like this:
@Component({
    selector: 'bg-formfield-markdown',
    host: {
        class: 'forminput',
        '[class.forminput-is-error]': 'isErrorState',
        '[class.forminput-locked]': 'isLockedState',
    },
    template: `<md-editor (ngModelChange)="change()" [(ngModel)]="markdown_content" [upload]="doUpload"></md-editor>`,
    styleUrls: ['./formfield-markdown.css'],
    encapsulation: ViewEncapsulation.ShadowDom
})
export class FormFieldMarkdown implements OnChanges, AfterViewInit {

in there, I pass a FormControl as @Input, like this:
@Input() control: FormControl;

I can then use this in other components like this:
<bg-formfield-markdown
    class="l-formsection-x-inputoffset"
    [control]="issueForm.rawControlMap.narrative"
    label="How did the recipient earn this badge?">
</bg-formfield-markdown>

In my Unit Test I configure the testing module like this:
TestBed.configureTestingModule({
  declarations: [
      FormFieldMarkdown,
      BgMarkdownComponent,
      MarkdownHintsDialog
  ],
  imports: [
      RouterTestingModule,
      CommonModule,
      ...COMMON_IMPORTS,
  ],
  providers: [
      ...COMMON_MOCKS_PROVIDERS_WITH_SUBS,
  ],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
}).compileComponents();
fixture = TestBed.createComponent(FormFieldMarkdown);
fixture.componentInstance.control = new FormControl('', Validators.required);
fixture.detectChanges();
component = fixture.debugElement.componentInstance;

This, however, fails with the following error message:
Error: NG01203: No value accessor for form control unspecified name attribute. Find more at https://angular.io/errors/NG01203

error properties: Object({ code: -1203 })
    at _throwMissingValueAccessorError (http://localhost:9876/_karma_webpack_/vendor.js:180376:9)
    at setUpControl (http://localhost:9876/_karma_webpack_/vendor.js:180158:29)
    at NgModel._setUpStandalone (http://localhost:9876/_karma_webpack_/vendor.js:181307:5)
    at NgModel._setUpControl (http://localhost:9876/_karma_webpack_/vendor.js:181295:33)
    at NgModel.ngOnChanges (http://localhost:9876/_karma_webpack_/vendor.js:181254:12)
    at NgModel.rememberChangeHistoryAndInvokeOnChangesHook (http://localhost:9876/_karma_webpack_/vendor.js:142324:10)
    at callHookInternal (http://localhost:9876/_karma_webpack_/vendor.js:143324:10)
    at callHook (http://localhost:9876/_karma_webpack_/vendor.js:143351:5)
    at callHooks (http://localhost:9876/_karma_webpack_/vendor.js:143308:9)
    at executeInitAndCheckHooks (http://localhost:9876/_karma_webpack_/vendor.js:143262:5)

I (and also others) find this error message extremely unhelpful and can't really figure out what's going wrong. I tried adding a provider as described here to the TestBed configuration, as well as the component itself. However, I don't really know what the forwardRef should refer to; FormControl, FormFieldMarkdown, or another component altogether? The things I tried all didn't work, anyways.
I also tried importing some other components and stuff, that didn't help either.
Also, this unit test should have worked some while ago, before we upgraded Angular. The whole project is open source, so feel free to check out the code for more context. I don't feel able to create a minimal example or anything of that kind, because I'm not familiar with Angular at all (and I feel like this is probably an easy fix for someone who is familiar with it).
Comment: Are you using bg-formfield-markdown inside a reactive form?
Comment: @TalhaAkca I'm not entirely sure, [but it seems so](https://github.com/mint-o-badges/badgr-ui/blob/ui_get_tests_to_run/src/app/issuer/components/badgeclass-issue/badgeclass-issue.component.html#L110).
Answer: Well, in the end it didn't have anything to do with the FormControl at all - I just misunderstood the error message in that regard. The problem was that my component used this markdown editor. The necessary module was properly imported in my general module, but not in my test. I thus fixed it by importing the LMarkdownEditorModule in my TestBed configuration and adding the necessary scripts, assets and imports. See this commit for details; I don't think it's too relevant, since it has nothing to do with what I originally asked for in this question.
Maybe the learning for someone randomly stumbling upon this could be that you shouldn't try to get any information from this error message, but rather just try to produce a minimal example producing the error in order to debug it.

Test a form with FormControl input


Can I write on iPad using touch typing technique?

Question: Is there any way on iPad that I can write text on iPad using Touch Typing technique, as this is the way I use keyboard?
Comment: You don't need to, the iPad's 9.7" screen is small enough, so you can see both the content and the keyboard at the same time without being distracted. I personally touch type on keyboard, but feel comfortable not touch typing on iPad. Good luck!
Answer: The onscreen iPad keyboard offers no way to (re)orient your fingers to the home keys, which makes touch typing nearly impossible in my experience. However, with practice many iPad owners become skilled at using the onscreen keyboard well.
If you absolutely need to touch type longer documents, you can use a bluetooth keyboard with the iPad.
I rarely carry the external keyboard when I'm out and about, but if I plan to settle in to write I toss it in my bag and when traveling I keep one in my hotel room for evening writing marathons.
Comment: I touch type and while I've gotten faster with the iPad keypad, it's too small for me, even if the key layout and shift keys acted like their physical keyboard counterparts. I think your answer is spot on: get faster with whatever works on these on screen keypads and use a "real" keyboard for heavy lifting. Some folks are faster with their thumbs than they are with the iPad keyboard as it is and as many know, the iPad keyboard can be split for "thumbing." I don't do this but I've seen many heavy textures doing it.


Difficulty getting two Animation Node Trees to Execute concurrently

Question: Setup:
I have two rigged characters in my scene. I am using two Animation Node trees, one for each, to control the thickness of their solidify modifier outlines based on their distance to the Active Camera.
Problem:
Only one of the trees ever executes.
I have confirmed either tree works by themselves in other scenes.
Question:
I would like to know what I am doing wrong and why when both Node Trees are present only one of them executes ? I cannot tell where the conflict lies and I get no errors or warnings.
The Viewer node values actually update as I move the Camera around all the way down the tree. It just never updates on the actual character's Modifier.
Comment: i just tried it out. Animation nodes can execute two trees without problems (proof: [1]: https://i.stack.imgur.com/WEE0N.gif) . So i am sure the problem is somewhere else. I hate to "theoretical" solve problems, because you cannot be sure it is the right solution so i recommend providing your blend file. But...by just looking at your trees i could be possible that one tree overwrites just the result of the other tree (because both write to the same custom property)...but without trying it out...this is just a guess.
Comment: I read in another post that Animation Node Trees can override each other, but it was a case where both trees were affecting the same object. in My example both trees process two different sets of geometry so I'm not sure how that works. I'm using Linked rigs in my scene so I'll have to setup a simplified file to submit. Will update when I have it.
Answer: Ok I got it working but it needs to be set it up this way:
You need to append and duplicate the node tree completely blank and then fill everything out for each character. I used to have one version of the node tree already filled out for each character and I thought I'd append each characters tree with them but that does not work.
I've updated my default scene to have the blank node tree (all executions OFF). I just copy/paste the nodes from the blank tree into new trees as needed and then fill them out in the scene.
Also remember to delete the extra scene that gets appended with the blank tree !


The Purpose of Change Machines

Question: I need some clearing up, do Change Machines exchange bills for coins or coins for bills. For example if I put a dollar in a Change Machine will I get four quarters back or visa versa?
Comment: There are some machines that change bills to coins, and other machines that change coins to bills.
Comment: If you put a quarter in a machine, what is the vi*c*e versa then? You get back another dollar? Usually, these machines come with instructions...
Comment: Are you asking about the meaning of the english phrase "Change machine"?  In that case this may be an [english.se] question.  Otherwise I don't think this question makes any sense.
Comment: You'll need to provide more information. Is there a particular machine that you are asking about?
Comment: I am talking about the machines at the bank, amusement park, laundry etc. What are their purposes? In Google Images there are examples of change machines, do they change bills for coins or coins for bills or can they do both?
Answer: I think you're talking about two types of machines, at least in the United States. The term change  machine usually refers to

a machine that accepts large denominations of currency and returns an equal amount of currency in smaller bills or coins. Typically these machines are used to provide coins in exchange for paper currency, in which case they are also often known as bill changers.

Exactly what bills or coins these machines return depends on the machine. Read the instructions on the machine to get the details (they're usually right on the machine). For example my apartment building has a machine that converts small bills like ones and fives to quarters, since the laundry machines only took quarters.

The other type of machine are coin-cashing machines, like the Coinstar machines you might see at a grocery store. Many banks used to have these machines as well although in my area they're few and far between now.
These machines perform the opposite function of the traditional change machine and convert smaller denominations (mostly coins) into bill form. For example if you dump all your accumulated pennies into the machine, it will probably give you bills and larger coins like quarters, dimes, nickels in exchange, after subtracting a small fee.
I've heard that now, some of these machines may give you a gift card of some kind instead of bills, although they'll still subtract a fee from your original amount, usually. Once again just read the instructions and they should tell you. When my bank had one of these machines, they didn't charge a fee as long as you were a customer at the bank. I'm sure that varies from place to place and bank to bank though.
Wikipedia's article has this to say (see the article for references):

In some sections of the U.S., regional banks have begun offering free coin-counting services in the amount of a gift card. Refunds are often given in cash rather than in the form of a gift card. In some cases, it is not even necessary for the customer to have an account at the bank; the free service is offered as a way to attract new business from individuals who are not current account holders. TD Bank's "Penny Arcade" coin counters were free and available to both customers and non-customers in many branches, but as of November 2010, the bank charges a 6% fee for non-customers to use the machine.
Comment: Where I live, the Coinstar machines waive the fee if you take payment in "gift cards".  The gift cards are plastic debit cards, good for paying a particular merchant (such as Amazon or Home Depot).
Comment: @Jasper I added something to my answer about gift cards right before you posted your comment, but thanks for the tip about the fees (or lack of fees). I've never used one of these machines anywhere besides my bank.
Comment: Coinstar machines everywhere are [no fee](https://www.coinstar.com/giftcards) for gift cards. For me, an Amazon gift card is as good as cash up to some reasonable value, so it works pretty well for cashing in the occasional dump of coins.

The Purpose of Change Machines


Realization of person in conjugation

Question: The conjugation of a verb often marks person and number.
Is there a language where one can actually separate these two traits or are they purely analytical?
(e.g. one could image a language where a verb would be of the form Stem + person marker + number marker)
Comment: Turkish inflects person and number separately (though they are conjoined); 1sg -im, 1pl -imiz; 2sg -in, 2pl -iniz; 3sg -ø (zero), 3pl  -ler. The subject verb inflections are also the personal possession suffixes, they can be used on nouns, too; and -ler is simply the noun plural.
Comment: Not sure if this is what you are looking for: In Q'eqchi' you say "xwil" past-3Abs-1SgErg-SEE = I saw him, and xwileb' past-3Abs-1SgErg-See-plural = I saw them. However, this is only the case with the third person absolutive.
Comment: Indeed, but I was wondering if this takes place for all persons.
Answer: What you're describing is the very essence of the difference between inflectional and agglutinating language. Thus there are many languages that separate person from number, gender, tense, etc. The person/number syncretism distinction alone is captured in WALS: http://wals.info/feature/29A#2/16.6/148.5. In Europe, Turkish, Finnish, Hungarian and Basque all have this feature. But it is found in languages all over the world.
It's one of the foundational dichotomies in linguistic typology although things have moved on a great deal in that field since then, extending far beyond a relatively trivial point of morphology.
However, note, that not all agglutinating languages necessarily have separate morphemes for person and number. Swahili is a broadly agglutinating language but has person/number syncretism. Just another example that there are no pure morphological types among languages.
Comment: This is what I was 'hoping' for.
Answer: I think Swahili comes really close to what you are looking for. Also depends on whether you are referring to the morpheme for the subject or the object in the conjugated verb.
Comment: Welcome to Linguistics! This post would benefit from adding further details. Being a one-line post, it may attract downvotes and criticism. Please [edit] it to add further relevant information — preferably with references to credible sources.

Realization of person in conjugation


Broke Headphone Jack ||| Merged With Speakers

Question: I broke my headphone 3.5mm cable into my laptop, and after using glue and a cue tip, I was able to pull out the broken piece of headphone jack out. After that, I was no longer getting sound, so I did a system restore (Windows) to factory. Then, something strange started happening. I now am getting sound out of my speakers and my headphones, it shows that they are only 1 device. I have tried everything to fix it, but there seems to be no solution. It doesn't even seem to recognize my headphones, even though sound is coming out. Thanks!
Comment: How did you break the port? Sounds like there is a problem with the grounding of the port - you may have to re-solder it. What model do you have?
Comment: @ezra_vdj I hit the cable when the headphone jack was plugged in, and broke it off. I have the Lenovo y510p. How would I resolder it?
Comment: http://superuser.com/questions/1056641/sound-playing-through-speakers-when-headphones-are-plugged-in?rq=1 a similar question was asked here.  see Zoredache comment, as that is likely.
Answer: There's two option you can go for:

The first would be to try and re-solder the jack by re-applying heat and letting the solder melt and form a new connection again. This option is more sketchy as you are using your own tools, and you are risking ruining your audio board altogether for a solution that might not even work.
LUCKY for you, the Lenovo y510p's audio board is a separate component - meaning that you can replace the thing altogether. I did some research and found in this manual on page 86 that the component number for the board is 90002737. I found ONE(!) person on eBay selling it that you can buy new from here. I would highly recommend spending the extra $$ and going with this solution as I'm sure this will fix your problem - and there's a plethora of tear-down guides on the internet to give you access to the board.

Hope this helps! Tell us how you end up doing.


Does ensembling cause overfitting?

Question: I am using an ensemble of rf,knn,xgboost and logistic regression to predict final probabilities. I am taking weighted average of all the prob predicted by individual models. I would like to know wouldn't this cause overfitting and I wont be able to generalize this for some other test set? As I am taking average of prob for one single test set and assigning weights for which the AUC on that particular test set is the most. Wont this cause the model prob to learn only one single test set? What else should I do to ensemble if it does indeed causes overfitting.
Answer: You should not be setting weights for which the AUC is the maximum for the particular test set. The test data should not be used for training the model at all.
This will give you the difference between the different types of datasets
You can use cross validation to prevent over-fitting, the basics of which can be found here

Does ensembling cause overfitting?


How can I exclude the display of specific pictures and videos in the Finder?

Question: I have some pictures and videos on my Mac (OS X Lion, OS X Snow Leopard) I'd rather have NOT show in Finder>Images. For example, if I'm in a meeting with clients and want to show some document, I have to fire up Finder and open said document, and when I click towards that, those pictures/movies show up and embarrass me. Think hmmm, strategic company workflows ahemf.
Is it possible to tell Finder to NEVER show these?
Answer: I am unsure if you are asking how to exclude folders from showing up in your finder spotlight search, or if what you are after is to hide specific folders from being shown in a finder window.
If you are after excluding folders from a spotlight search, you can do this in the privacy tab from system preferences / spotlight :

If you are after having the ability to show or hide files and folders from being viewed while you are in a finder window, then you can create an automator service to do just that :
hints.macworld.com/article.php?story=20100719001040829
NOTE : the tip above only toggles all files that have the hidden flag set, so if you need to quickly mark a folder or a file as "hidden", then you need to set this bit attribute for that file or folder.
An easy way to do this is via a free utility software download that does just this here (used to be shareware, but now free ) : gotoes.org/ShowHiddenFilesMacOSX/
NOTE 2 :
If you are happy using the terminal command line, you can just type the following on the terminal :
chflags hidden (drag your file or folder onto the terminal window here)

or
chflags nohidden (drag your file or folder here)

Hope this helps.
Comment: Tip: you can use the go menu to access the hidden files; that way you don't have to show & hide them every time.
Answer: If you have secure documents that you do not want to pop up in Finder » Images on a machine that might sometimes be facing others (in my case, diagrams for exam questions on the same machine I use connected to a projector in class), you could create an encrypted disk image using Disk Utility, and be sure not to store the password in the Keychain. When the disk image is mounted, you can search for and edit the secure files, but when the disk image is not mounted, the files will be safe from popping up in any searches, finder windows, etc.
Answer: Another convenient way to exclude a folder (and its contents) from Spotlight results is to add ".noindex" (without the quotes) to the end of the folder name.
Answer: Re: don't show certain thumbnail previews in finder
Putting a .noindex behind the folder's name, like notforyoutoseefolder.noindex did the trick for me in OS X Lion.
Once I had put that suffix the thumbnails of the movies (for instance) that you'd not want to be shown in Finder were in fact not shown anymore.
If only I had tried that before trying Daniel L's (smoothly working) method :)
Answer: A simple way is to put those "unmentionables" in a separate folder and hide the folder.  You can move that "special folder" anywhere that you will remember, or you can searchmacupdate.com for a 3rd party app that will allow you to make it invisible/visible at will
Answer: If you were messing with your roomies computer and you shouldnt have, change the date to 3 days back and re-open the pictures you watched. This will "reset" the dates they were "watched" ;)


How to achieve this liney camcorder effect on Premiere Pro or After Effects?

Question: I've been looking for a way to achieve
this effect but it doesn't seem to work accurately well.
Answer: This is an artefact from de-interlacing.
You can simulate it using things like the Bad TV or Holomatrix plugins.
You can get some way towards it using the free Venetian Blinds plugin in After Effects (or by interlacing and de-interlacing some footage).


Distinguishing between delegation, composition and aggregation (Java OO Design)

Question: I am facing a continuing problem distinguishing delegation, composition and aggregation from each other, and identifying the cases where it's the best to use one over the other.
I have consulted a Java OO Analysis and Design book, but my confusion still remains. The main explanation is this:
Delegation: When my object uses another object's functionality as is without changing it.
Composition: My object consists of other objects which in turn cannot exist after my object is destroyed-garbage collected.
Aggregation: My object consists of other objects which can live even after my object is destroyed.
Is it possible to have a few simple examples demonstrating each case, and the reasoning behind them? How else can these examples be demonstrated other than my object simply having a reference to another object(s)?
Answer: Delegation
public class A {
  private B b = new B();

  public void methodA() {
    b.methodB();
  }
}

When clients of A call methodA, class A delegates the call to B's methodB.
Rationale. Class A exposes behaviours that belong elsewhere. This can happen in single-inheritance languages where class A inherits from one class, but its clients need behaviours that are implemented in a different class. Further study.
Hybrid Delegation
public class A {
  private B b = new B();

  public void methodA() {
    b.methodB( this );
  }
}

The difference between delegation that involves simple forwarding and delegation that acts as a substitute for inheritance is that the callee must accept a parameter of the caller, exemplified as:
    b.methodB( this );

Rationale. Allows class B instances to use functionality available from class A, just as class B would if it inherited from class A--but without inheritance. Further study.
Composition
public class A {
  private B b = new B();

  public A() {
  }
}

Once no more references to a particular instance of class A exist, its instance of class B is destroyed.
Rationale. Allows classes to define behaviours and attributes in a modular fashion. Further study.
Aggregation
public class A {
  private B b;

  public A( B b ) {
    this.b = b;
  }
}

public class C {
  private B b = new B();

  public C() {
    A a = new A( this.b );
  }
}

Once there are no more references to a particular instance of class A, its instance of class B will not be destroyed. In this example, both A and C must be garbage collected before B will be destroyed.
Rationale. Allows instances to reuse objects. Further study.
Demonstration Without References
The names given to these simple patterns are defined by their referential relationships.
Answer: Your object would reference another object(s) in all three cases. The difference lies in behavior and / or lifecycle of referenced objects. Some examples:

Composition: House contains one or more rooms. Room's lifetime is controlled by House as Room will not exist without House.
Aggregation: Toy house built from blocks. You can disassemble it but blocks will remain.
Delegation: Your boss asked you to get him a coffee, you've had an intern do it for you instead. Delegation is not a type of association (like composition / aggregation are). The latter two have been discussed on Stack Overflow many times

In the comment you ask how the implementation would differ in each case, observing that in all cases we invoke methods on the releated objects. It's true that in each case we would have code such as
myRoom.doWork();

myBlock.doWork();

myMinion.doWork();

but the differences lie in the life-cycle and cardinality of the related objects.
For the Component, the Rooms come into existence when the House is created. So we might create them in the constructor of the House.
In the case of Association (I'll use Tyre and Car) Cars might add Tyres in their constructor, but later you may want to remove and change tyres. So you also have methods such as
 removeTyre(FrontLeft)
 addNewTyre(aTyre, BackRight)

And it's quite likely that the aTyre object came from a Factory - we didn't new it in any of the Car's methods.
In the case of Delegation, you might not even have a member variable to hold the delegate
 resourcingPool().getIntern().getCoffee(SkinnyLatte, workstation 7);

the relationship between the objects lasts only as long as the intern is fetching the coffee. Then it returns to the resource pool.
Comment: More or less. In case of delegation the reference may be obtained from elsewhere (you may even be delegating to static methods); in case of composition nested objects are created by or with help of parent object (since it controls their lifetimes); and in case of aggregation nested object instances are injected (usually during construction / initialization).
Comment: Thanks for pointing out the previous discussions. So, in terms of how the code looks like, all 3 cases should looks pretty much the same? referencing other object(s)?
Answer: Your book explains quite good so let me elaborate and provide you some examples.
delegation: When my object uses another object's functionality as is without changing it.
Sometime a class may logically need to be big. But big class is not a good coding pratice. Also sometime, some functionalities of a class may be implementable in more than one way and you may want to change that some time.

class FeatureHolder {
 void feature() {
  // Big implementation of the feature that you dont want to put in the class Big
 }
}

class Big {
 private FeatureHolder FH = new FeatureHolder();

 void feature() {
  // Delegate to FeatureHolder.
  FH.feature();
 }

 //.. Other features
}

From the above example, Big.feature() call feature of FH as is without changing it. This way, the class Big does not need to contain the implementation of the feature (separation of labour). Also, feature() can implement differently by other class like "NewFeatureHolder" and Big may choose to use the new feature holder instead.
composition: My object consists of other objects which in turn cannot exist after my object is destryed-garbage collected.
aggregation: My object consists of other objects which can live even after my object is destroyed.
Technially, Composition is "part of" and Aggregation is "refer to" relationship. Your arms are part of you. If you no longer live, your arm will die too. Your cloth is not part of you but you have them; as you can guest, your cloth does not go with you.
In programming, some objects are part of another object and they have no logical meaning without it. For example, a button is composed into a window frame. If a frame is closed, the button has no reason to be around anymore (Composition). A button may have reference to a database (like to refreash data); when the button is eliminated, the database may still be around (Aggregation).
Sorry for my English, Hope this helps
Answer: 1) Delegation: Man-driver-car example. A Man bought a car. But that man does not know to drive the car. So he will appoint a driver who knows driving a car. So the Man class wants to perform a transportation using car. But it does not have the interacting- functionality/compatibility with car. So he uses a class which has compatibility with car that is driver which is compatible with man class. Assuming that driver can understand what man says
2) Composition: Car simulation is a routine example. To make a car move, wheel rotates. Car class using wheel class rotate functinality as part of its move function, where as wheel is part of car.
3) Aggregation: Car and its colour. Car class object ferrari will have a colour class object red. But colour class object red can be there as individual class, when user search happens with a specification of red colour.
Answer: In a very simple sentence I can say:
Delegation is: delegate behaviour to other class when you do not want to change it. by change I mean during run time. for example you delegate driver to car class that driver wont change while driving.
Composition is: when you want to use behaviour of family of classes (one or more classes, that implements an interface) that you might change during run time. but you should consider these classes can not exist with out main classes, such as rooms of a hotel. If you remove hotel all rooms of hotel will not exist.
Aggregation is: same as composition but classes can exist without main class.


Conflict of playing a note when both melody and chord require it

Question: How do I finger a chord such as G (GBD) when the melody also requires playing one of these notes, such as  B or D?  Do I do an inversion to avoid the conflict?  I'm brand new at this and using EZ Play books.  Thank you.
Comment: I guess it's guitar, but may be piano, with different ramifications.
Comment: I'm not convinced that this is a duplicate of the linked question. Looking at the mentioned book, they are basically lead sheets. The linked question is a different problem.
Answer: Well, naturally it depends on the instrument in question (hint hint).  But usually one would not jump to out-of-line inversions but rather play the melody note at melody strength and timing and let it serve the chord role as a side job.  When the chord note and melody note don't share the exact same timing, one might slightly interrupt the resulting double note enough to give it a separate attack and/or release for its "other" role.
Answer: This happens all the time, because the melody notes are often chord tones.
On piano, if you are playing the melody (no singer, for example), we often want to play the chords underneath the melody. That helps us hear the melody, because it's the highest part.
This is where inversions come in. If the melody has a B, then we want to choose a voicing of G which has B as the top note. Beginning students often just play chords in their root position, which resulted in a disjointed sound. If you choose your inversions to fit the melody, you'll get a much smoother sound.
If you're not playing the melody (because someone else is), you have a little more flexibility. In fact, you may want to avoid the melody notes, so that you don't make the sound too muddy. With experience, you'll figure out the appropriate style of accompaniment for each song you play.
So, for now, try and choose an inversion where the melody note is the top note of the chord. As you get more experience, branch out experiment.
Comment: Thank you very much. I'm a beginner on the piano and your response not only helps me but provides an understanding that I didn't have.


Create master/detail grids using XtraGrid Entity framework

Question: I'm a beginner regarding C#, Entity and working with grids, so although I assume what I'm asking is somewhat general, I am a little lost.
I have two tables in my SQL database: PeriodicReports and PeriodicReportGroups. Each reports group can have 1 or more periodic reports, so what I envisioned was a grid with rows that would have a + sign at the left and could be expanded, showing the related periodic reports for each group. I know this can be done because I've seen very similar examples in DevExpress support site, but although I've put time trying to understand them and apply them to my case, I still haven't figured how to do it.
This is what my code looks like. After using the Entity Framework with my tables, this class got created automatically:
public partial class ReportEntities : DbContext
{
    public ReportEntities()
        : base("name=ReportEntities")
    {
    }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        throw new UnintentionalCodeFirstException();
    }

    public DbSet<PeriodicReportGroup> PeriodicReportGroups { get; set; }
    public DbSet<PeriodicReport> PeriodicReports { get; set; }
}

I created this interface and class myself in order to only show certain columns in my grid:
    public interface IPeriodicReportGroup
{
    string Name { get; }
    string Description { get; }
    bool Active { get; set; }
}

public partial class PeriodicReportGroup : IPeriodicReportGroup
{
}

And in the other hand, I have my XtraForm with an XtraGrid:
public partial class Form1 : XtraForm
{
    public Form1()
    {
        InitializeComponent();
        InitSkinGallery();
        InitGrid();
    }

    BindingList<IPeriodicReportGroup> gridDataList = new BindingList<IPeriodicReportGroup>();

    void InitGrid()
    {
        var database = new ReportEntities();

        var reportGroups = database.PeriodicReportGroups.ToList( );

        foreach (var group in reportGroups )
            gridDataList.Add( group );

        gridControl.DataSource = gridDataList;
    }
...

So far, I'm successfully putting the periodic report groups that I have in my DB in the grid, which is good. But I still have no clue on how exactly set up the details grid that will expand for each group, although I feel it should be something pretty standard. Can anybody offer some guidance? I'm not asking for somebody else to do my work, just something that can point me out in the right direction, because right now I'm pretty lost.
I'd also love to be able to add new groups and new details on the run by inputting data into an empty row, is this possible?
Thanks in advance!
Comment: Why don't you contact the DX guys regarding this?
Answer: XtraGrid support three ways to do it:
Check this link for more information.
Basically master-detail is thing that confuses, but careful reading will help you.


Blockchain on Container Platforms

Question: I want to deploy private blockchain with 4 nodes. I am trying to use Kubernetes to create P2P network.I am asked to explore this.I have one question regarding real usage or benefit of Blockchain on Kubernetes. Blockchain is decentralized and distributed system and Kubernetes is built for zero downtime for production deployment and high availability of application.Multiple Pods for application can be build on one single cluster/worker node  which is nothing but one single vm or physical server. These multiple pods can be multiple instances of geth deployment.
Will this not defeat the purpose of decentralization provide by Blockchain ?
Answer: It's fine to use Kubernetes for running private or even public nodes (as long as you expose the RPC ports). Kubernetes manages infrastructure and resource allocation for you; it doesn't make a difference wether you use Kubernetes or not from the perspective of other nodes because they're simple communicating over TCP. You can use Kubernetes to roud robin load balance a cluster of Ethereum nodes that act as a single logical Ethereum node (like Infura).

Blockchain on Container Platforms


What's the difference between ln -s and mount --rbind?

Question: What's the difference between:
ln -s /mnt/extra/home /

and
mkdir /home
mount --rbind /mnt/extra/home /home

Comment: `ln` makes links; in particular, `ln -s` makes symbolic links. `mount` mounts a filesystem onto a directory. They have nothing in common.
Comment: But `mount --rbind /mnt/extra/home` is already a mounted directory
Comment: Put that as an answer and I'll mark this question as solved :)
Answer: mount --rbind makes a recursive bind-mount; that is, the filesystem hierarchy mounted on /mnt/extra/home will also be accessible through /home.
In practice major difference between the ln -s solution and the mount --rbind solution is that with ln -s /home is a symlink while with mount --rbind it's a directory; this affects tools like find, df, test/[ etc.
Also, the ln -s will fail if /home exists, while mount --rbind will fail if it does not exist, or it is not an empty directory.
Mark's comment below is also important: ln -s needs a writable file system on which to create the symlink.
Comment: The big difference is that `ln -s` modifies the filesystem, while `mount --rbind` doesn't.  This means you can mount the home directory on a read-only root (eg. a boot CD), but you can't make a symbolic link on it.
Comment: `--bind` and `--rbind` don't see to care if my target directories are empty, they just mount "on top" of whatever files are there, leaving them inaccessable
Answer: In this case both a bind mount and a symbolic link will work similarly for most purposes, but they do have important differences.
A symbolic link is a bit more lightweight.  You can have hundreds or thousands of symbolic links without it being much of a management problem.  They sit in the filesystem rather than requiring special system-level setup.
Symbolic links can be backed up and copied correctly by tools like cp and rsync.  That is, the tools can recognise and copy the symbolic link, ensuring that on restoration somewhere else the link is restored and points to the correct destination.  It will all work "correctly" by default.  By contrast, when backing up or copying a bind mount the mount will be treated transparently, causing the files themselves to be copied, which can lead to duplication if you also get the same files in their other location, and requiring extra work if you want to replicate the bind mount at the destination.
Symbolic links can be modified or deleted by any user who has access to the link, so it's easy to make it superuser-only, or open it up to a particular user.  Bind mounts can only be set up or modified by the superuser.
If this sounds like a glowing endorsement of symbolic links, it is.  They are a more straightforward way of linking between files and directories.  You would use bind mounts only for situations where a symbolic link would not work, which may be fewer situations than you'd think.  Most tools, including backup and sync tools, have a sensible default behavior for symbolic links and their treatment of symbolic links may be configurable.  Bind mounts are transparent to such tools so you lose that flexibility and may lose the sensible behavior (for example as mentioned above, duplication of directories in your backups).
Answer: One more difference is that symbolic link is symbolic, i.e. it just references a path — a string of characters, and it's dereferenced each time you open a subdirectory/file in the target path. In contrast, mount --rbind behaves more like a hard link, for which the path isn't re-evaluated on each dereference.
This makes a difference in some scenarios like chroot. E.g. vsftpd chroots into the home directory of the FTP user account you log in. Thus if you put a symlink into that directory, vsftpd won't be able to dereference it, and thus the target won't be accessible via FTP. If you instead do mount --rbind, then vsftpd will just access that subtree as if it were really there, similarly as when you'd hard-linked a file there.


Sphinx search with xml pipe

Question: I have one json array of Objects.I am creating sphinx compatible xml document from this JSON Array.For each object i create one document and specify id value for it.For example if json array contains 20 objects then i have to create 20 documents starting from 1 to 20.Now my json  array update with time and new Objects come in place so i need to assign them id starting from 21 and so on.So is there any way to maintain this id values from Sphinx side internally?
Answer: Just store the latest used id somewhere. A text file or something.
Or just get the highest id from the sphinx index. So the script building the xml file, could just first run a sphinxql query
<code>select id from gi_stemmed order by id desc limit 1;
</code>

Sphinx search with xml pipe


What is the maximum distance that music is transmitted through the air?

Question: I would like to hear your advice on which method to use to transmit music or speech in a frequency band that is sensitive to the human ear up to 3km. Everyone knows that the higher the frequency, the sharper the directivity, but instead, the attenuation in the air is severe. The Ganasys company, which made LRAD, dismissed the fact that it used ultrasonic waves as an erroneous view and said that it actually uses the sensitive 2200~3300Hz audible band.
Meanwhile, ZaellixA piqued my curiosity by suggesting that ultrasonic waves can be used to modulate audible sounds to transmit sound with ultrasonic characteristics farther away. Is there really no other way than to modulate with ultrasound?
Comment: Related: https://physics.stackexchange.com/q/690463/2451
Answer: As you already mention in your question, with increasing frequency two main traits are observed. One is the increase in directivity and the other is the increased attenuation/dissipation from/at the medium (air in your case).
Now, regarding the LRAD device and Ganasys company, I can't really say what the exact reason they decided to deviate from their initial plan is but I assume that relates to the second factor mentioned above. One has to keep in mind that increased directivity only means that the geometrical attenuation is reduced compared to the case, for example, of uniform radiation (or any other case in between). This in no way implies that the radiated power is higher though. Ultrasonic signals tend to be (way) more directive than the majority of the signals in the audible frequency range but that doesn't mean that the radiated power is higher. On top of that, one has to consider the increased attenuation imposed by the medium.
I am no expert on ultrasounds but with my limited knowledge I believe that the emitted energy is lower for ultrasounds and I know for sure that they are attenuated way faster (greater attenuation per distance measure) than, say the mid or low frequencies of the audible spectrum. I believe that those two factors in combination led the aforementioned company to abandon their initial design and move lower in frequency. In the range you mention, one could possibly achieve a good compromise between relatively low dissipation in the medium and directivity. If we also consider using array technology to focus the beam (which is quite easy to achieve for a limited frequency band. You can also see this answer for a quick overview), effectively achieving smaller geometrical attenuation then this frequency range is a quite good candidate for such as system.
Again, to my limited knowledge, ultrasounds are used to transmit focused sound in rather short ranges, especially for partitioning a space into zones or similar applications (excluding medical applications here as they don't seem to be a topic of interest in this question). As far as I know, the two main ways to focus sound towards specific steradian angles are beam-pattern control which is the topic of array processing techniques (among other technologies falling under this field) and the use of horns as used in loudspeaker technology.


Story about an alien baby that has to get to its spaceship before it dies

Question: A baby is born, self aware, in a cave on an alien planet. He knows he has to get to the spaceship that brought his people to the planet or else he will die due to the quick passage of time on the alien planet.
Comment: This has been marked as a duplicate of a prior question with the same answer. Please understand that this does not mean we think your question is bad, merely that we like to link things together in the database to improve the search of future querent.
Answer: "Frost and Fire" is a short story by Ray Bradbury and the fourteenth in his collection R is for Rocket. It was first published in Planet Stories (Fall, 1946) as "The Creatures That Time Forgot".
From Wikipedia:-

Placed there by a past rocket ship that crashed, the people of the storied land are within sight of another rocket ship on a distant mountain plateau. The plot follows Sim, the protagonist of this story, and his apparently short life on a planet where people are cursed by radiation to live only eight days.
The people of this planet are also gifted with racial memory (they remember their ancestors' memories). However, they do not attempt to reach the sole remaining rocket ship due to the futility of attempting to reach it in one hour, which is the longest length of time between day and night (both deadly).
Sim is then moved by the memory of his ancestors to find and meet with scientists who make halting progress towards the goal of lengthening the world's decreased life span. Sim, motivated by his dwindling days, makes it his goal to extend his life and reach the distant rocket, despite the protests of his sister and other cave-dwellers
Comment: Thank you for identifying the story & author. It has driven me nuts on and off for the last 20 years or so since I read it, looking forward to reading it again.


What are "consolidator" fares in airline travel?

Question: Can someone explain what "consolidator" airfares are in the airline travel world, and how they differ from "normal" airline fares?
Comment: A couple of years ago, I gathered a list of consolidators across the USA, so I could find the best fares. I had used them in the past. Out of my entire list only one still had an active phone. I was told that airlines no longer sell seats to consolidators except for high capacity tour requirements.
Since that time, I have not seen any activity in this area. I have no knowledge of other countries.
Comment: (PS - I know what they are, but I'm sure someone can give a better explanation)
Answer: Consolidators buy seats in bulk from various airlines and then re-sell the seats, usually through travel agents, at a discount. Because they buy seats in very large quantities, they get much lower fares and even adding on their margins provides an airfare that is often lower than the airline's best internet fare.
But these come with conditions, one of the biggest of which is NO frequent flyer points for the traveler.  They also have other potential headaches such as no pre-reserving of seats, extra baggage charges, severe restrictions on change (ie absolute use it or loose it policies), etc.
Comment: The fares were traditionally known as "bulk fares", but that sounded too much like cattle car seats.  "Consolidator" sounds better.  But they get the low rates because they contract for XX hundred seats a year.
Comment: Is this actually true? I thought consolidators buying seats in bulk is a myth...
Comment: It's not a myth.
Comment: Consolidators get lower fares because they are buying multiple seats and because they are assuming the risk of unsold seats.


Add web part to SitePages using PowerShell

Question: I want to add a web part to my page created in SitePages, using PowerShell script.
Comment: What type of webpart? Is the webpart already deployed and available on the site?
Comment: Yes, the web part is already deployed and i just need to add that web part in my page using powershell script
Answer: Here is a snippet which you can use, the web part XML file should be placed in a local folder.
<code># Add PowerShell Snapin
 $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
 if ($snapin -eq $null)
 {
     Add-PSSnapin "Microsoft.SharePoint.Powershell"
 }

 # Get the Site URL
 $SiteUrl = "https://MySiteCollectionURL/"

 # Get the Web URL
 $WebUrl = "https://MyWebSiteURL"

 # Get the Page on which WE are going to Add the WebPart
 $PageName = "Test.aspx"

 # The location of the WEbPart Definition File
 $localWebpartPath = "C:\WebParts\MyWebPart.webpart"

 # Error Message which is required as a Reference Parameter while Importing the WEbPart
 $errorMsg = "Test Error Message"

 # Initializing the SPSite Object
 $Site = Get-SPSite($SiteUrl)

 # Get an instance for Publishing Site based on SPSite
 $PubSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($Site)

 # Get the SPWEb Object
 $Web = Get-SPWeb $WebUrl

 # Get the Publishing Web Based on the SPWeb Object
 $PubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($Web)

 # The below commented line is to get all the Pages
 #$PubWeb.GetPublishingPages($PageName);

 # Get only our Page
 $PublishingPage = $PubWeb.GetPublishingPage("https://MyWebURL/Pages/Test.aspx");

 # Make the Web as AllowUnSafeUpdates as true
 $Web.AllowUnsafeUpdates = $true

 # Checkout the Publishing Page
 $PublishingPage.CheckOut();

 # Get the LimitedWEbPartManager
 $limitedWebPartManager = $PublishingPage.ListItem.File.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared);

 # Initialize the XmlReaderSettings Object which is required for the XmlReader Object
 $xmlReaderSettings = New-Object System.Xml.XmlReaderSettings

 # Create the XmlReader Object by using the WebPart Definition file and the ReaderSettings Object
 $xmlReader = [System.Xml.XmlReader]::Create($localWebpartPath,$xmlReaderSettings);

 #Add Web Part to catalogs folder and Get the WebPart Definition Object based on the webpart definition xml file
 $oWebPartDefinition = $limitedWebPartManager.ImportWebPart($xmlReader,[ref]$errorMsg);

 # Add the WebPart to the WebPartManager by specifing the Zone and the Index.
 $limitedWebPartManager.AddWebPart($oWebPartDefinition,"RightZone",1);

 # Checkin the Publishing Page
 $PublishingPage.CheckIn("Checkin");

 # Publish the Page
 $PublishingPage.ListItem.File.Publish("Publish");

 # Revert the AllowUnsafeUpdates to False once we are done.
 $Web.AllowUnsafeUpdates = $false

 # I was trying to Approve the Page.  But, if the Approve is enabled on the Pages Library level,
 # then only we can do that.  Otherwise we cannot.  But the Syntax is correct as below.

 # $PageListItem.File.Approve("Page approved automatically by PowerShell script")

- See more at: http://www.sharepointpals.com/post/How-to-Add-WebPart-to-the-Publishing-Page-using-PowerShell-in-SharePoint-2013#sthash.xcdNmxZv.dpuf
</code>
Comment: I have tried this code but its giving me an error near GetPublishingPage like "The SPListItem provided is not compatible with a Publishing Page.".
Answer: Above code works, create limitedwebpartmanager object using below line.
<code>$limitedWebPartManager = $Web.GetLimitedWebPartManager($PublishingPage.url, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
</code>


Android app syncing schedule

Question: I have setup an application to perform syncing with the Android syncing framework.  Most of the internals have been taken from the sync adapter demo.  I have a very simple question though, when does this app sync?  I know that the google services will sync when they receive a network "tickle" is this also the case with services that you have setup to sync?
Answer: As Amorgos mentioned those tickles you mentioned are C2DM push messages. If it is important to sync changes instantly after they are made in the cloud you should think about implementing them. You can go here for more information.
For requesting a sync operation, the class you have to look at is the ContentResolver. If you want to sync call requestSync(Account account, String authority, Bundle extras) (use it for a sync now button or similar). To sync changes in your ContentProvider you can call
<code>getContentResolver().notifyChange(CONTENT_URI, null, true);
</code>
after creating/changing the entry (for changes that shouldn't be synced replace the true with false and no sync will be triggered). If android:supportsUploading in your SyncAdapter's xml file is set to true, this will automatically trigger a sync. In this case the Bundle in your SyncAdapter contains a Boolean value with the key ContentResolver.SYNC_EXTRAS_UPLOAD which is true. You can use it to just sync local changes to the cloud and not querying anything.
If you want just to sync each hour use addPeriodicSync(Account account, String authority, Bundle extras, long pollFrequency).
You can also use the ContentResolver to read/set if it should sync or not (the value which is shown in the device settings at accounts & sync). The methods are getIsSyncable(...) and setIsSyncable(...).
I hope this can help you.
Edit:
This also describes the processes really good: Why does ContentResolver.requestSync not trigger a sync?
Answer: It all depends on the requirements of your application. If you're syncing data which is not critical that the user knows about straight away, then the OS initiating sync might be enough. (A list of contacts is a perfect example of this)
If your app relies on being notified in a more real-time way then you should consider using C2DM push notifications to initiate the sync process. You can raise C2DM messages when the server modifies data and it sends them to your device. The app will then run your sync process based on the contents this message. (C2DM is the network tickle you refer to for Gmail for example)
It is up to you to architect your application to decide when to efficiently initiate that sync using whatever way you decide. All apps have different requirements for sync.

Android app syncing schedule


Where has the energy gone?

Question: Setup: Two small bodies,  let's say pingpong balls, are situated in deep space in an area free of any substantial fields of any kind. One pingpong ball is negativly charged,  the other is positively charged. (equal but opposite charges)
With a spatial separation between the balls,  there exists a force  which attracts them together and this force is an energy of sorts.
When this force acts and reduces the separation to zero,  IE touching,  the net charge of the body composed of the pingpong balls becomes zero,  or more precisely , a neutral charge, on a single composite body.
What happened to the energy of the attractive force present under separation?
Comment: *"and this force is an energy of sorts."* No. The relationship between force and energy is well defined and it is not any kind of equality ... these quantities are different kinds of things. There is an energy in the system because there is force in the system, but they are not the same thing and you will only confuse yourself if you don't keep that distinction clear.
Answer: First, force is not the same as energy. Force is force and energy is energy. If, for example, you hold the charged balls in your hands, the net force on them is zero but they still have the electrostatic energy.
Therefore, it is correct to say that the system of the two charges has energy. If they start at rest at a distance $r$ with equal and opposite charges $\pm Q$, then their potential energy is
$$U = - \frac{Q^2}{r}$$
which is negative, and gets more negative the closer the charges are. Since the total energy (kinetic plus potential) must be a constant, as the potential energy decreases the kinetic energy must increase. This makes total sense: the electric force is attractive, so as the balls get closer they accelerate and go faster and faster.
The answer to "where did the energy go?" depends on what precise moment you're talking about. An instant before the balls collide, they have a lot of kinetic energy to compensate for the fact that their potential energy is very negative (in fact it diverges as $r\to 0$).
After the collision, the balls are stuck together with the same energy they had when they started, which if you remember is negative. The potential energy, however, is much lower than this (if two point charges were exactly in the same point, it would be negative infinity). The positive kinetic energy is still there but now it's in the form of internal movement of molecules, i.e., heat. The balls are hotter as a result of having been smacked together.
Comment: If held separated in my hands there would still be a force between them, would there not? My hands would restrain the force,  but it's still there!
Comment: Also,  how can forces not have energy?
Comment: Additionally,  the net charge of the composite body becomes zero,  a neutral charge. So I still don't understand.
Comment: 1. Yes there would still be a force, but since you're holding the balls in your hands the **net** force on each of them is zero. 2. A force can be related to a potential energy like here, but forces themselves do not have energy. Energy is a property of a system. 3. I'm not sure what it is you don't understand. The net charge is zero but the final object, like everything else, is made up of lots of very small positive and negative charges.
Comment: Javier. If I let go the force suddenly appears?
Comment: I don't see how holding the balls eliminates the force between them,  if it did I wouldn't have to hold them apart..... Can you explain? The force can't disappear when securing them apart then suddenly reappear if I let go. Doesn't make sense. Help!
Comment: @RaSullivan The force is always there, but when you hold the balls in your hand you exert an opposite force.
Comment: Javier.. So the net force remains but now involves my hands as well. That makes sense!oo
Comment: The electric field created by the separation of the balls clearly contains energy,  so again,  where does that energy go when the charges combine to form  a neutral charge?

Where has the energy gone?


target encoding with multiple columns

Question: I'm attempting to do target encoding with multiple columns on a dataframe and I'm getting an error message I don't understand.
Here is a fragment of the code.
X['District Code Encoded'] = encoder.fit_transform(X['District Code'], y)
X['Property id Encoded'] = encoder.fit_transform(X['Property id'],y)
X['Property name Encoded'] = encoder.fit_transform(X['Property name'],y)

It always runs the first line and then throws an error message on the second line giving a key error along with the key that occurs in the second pair of square brackets on the first line. So for example, in this case, "Key Error: 'District Code'".
I can show more code or more details of the error message if need be.
Is it possible to work out from that what might be going wrong here?
Added later: Here is a fragment of code added later to try to find the bug.
encoded_df['District Code Encoded'] = encoder.fit_transform(X['District Code'], y)
for col in X.columns:
    print(col)
print(X)

dataset=[['tom',10,7],['patrick',15,8],['john',25,11]]

Y = pd.DataFrame(dataset, columns = ['a','b','c'])
encoded_df2 = encoder.fit_transform(Y['b'],Y['c'])
encoded_df2 = encoder.fit_transform(Y['a'],Y['c'])
print('That is done')

It produces same error message again, ending with KeyError: 'District Code', so it seems as though something's happening where when you run this function twice you get a Key Error from the first time you ran it. Would it be a case of needing to see the original dataframe X in order to understand why that error is generated?
Comment: I don't think you should use the encoding multiple times on the separate columns, instead try using passing in all columns at once, see also [this stackoverflow answer](https://stackoverflow.com/a/55232231/9435355).
Comment: Can you show some sample of your data which has these 3 features?
Answer: The error means you don't have a column name 'District Code' in data frame X.
Lookout for Capital letters and spaces.

target encoding with multiple columns


Do I need an invite for tournaments?

Question: Do I need to get invited to a tournament? I'm asking because I would like to play a tournament with my mates, but isn't it only the 'pros' WHO can play in tournaments?
Answer: For most tournaments you won't need an Invitation. I've personally played 3 tournaments where i just had to register my team and then we could start Playing.
But i'm Not sure if that counts for every tournament. If you want to play LCS you will have to be a pro player in a pro Team. If you just want to play an online tournament you can write an application and hope that you or your team will be accepted.
Only because it's a small online tournament that doesn't mean there's nothing to win.  In fact you can even win a triumphant ryze skin in an online tournament as long as riot is supporting the tournament (and they do that quite often).
Of course you won't win the big 100'000$ in a simple online tournament but I've seen some where you can actually win 1000$ or even more.
But you also have to keep in mind that even in these small tournaments there are Diamond 1 Players which are Hard to play against if you're Not At least Plat 3 +.
But hey just try it. On www.lolking.com you can find tournaments every week with prizes like gaming gear,  riot points or even Cash.

Do I need an invite for tournaments?


Any way to set lockscreen notifications on AT&T LG G3 Lollipop?

Question: AT&T appears to have completely disabled the lockscreen notification settings in their LG G3 Lollipop update. Anyone know of any way to change which notifications are shown, which are sensitive, etc.?
Answer: If you go to Settings -> Sound, and scroll down to the Notifications category.
The Lock Screen selection allows to choose Hide sensitive only, show all, or hide all. The Apps selection is a list of apps, which will let you select app behavior. However, the sensitive option is only available if you select "Show all notifications" option above.
Additionally it appears some applications have an invisible sensitivity setting that allows them to display information when "Hide sensitive only" is selected. I have several apps on my phone that display info/controls when the screen is locked, and I have it set to "Hide sensitive only" I found some discussion of the above information on this site, but nothing to explain the fact that some apps seem to default to nonsensitive, most don't.


Braking car and the force of friction - front-wheel-drive

Question: There are a few things in car Physics that keep confusing me and I hope you can help me improve my understanding.
The first thing I would like to discuss is braking.
I understand that when a car is accelerating, the wheels are pushing backwards on the asphalt which results in a towing force speeding the car up (N3 pair). However, when the brakes are applied and the braking force does not exceed a certain value, the wheels are still rotating - and so still pushing back on the asphalt - the same story. Yet all of the diagrams I found on the Internet depict the force vector with its head against the movement of the car, which makes perfect sense intuitively, but I would really like to know what this change in direction is caused by.

My hunch is that it must have something to do with the braking pads being engaged, they generate a lot of friction on the rotor, changing the car's kinetic energy into heat. But, when I attempt to draw a free-body diagram, there is nowhere the inner force could be drawn.

Thanks for investing your time in advance!
Answer: When a car is braking, the wheels are pushing on the asphalt in opposite direction then when accelerating. So it is not the same story.
Acceleration: the force is generated by the engine which is applying torque on the shaft, which is turning the wheels. The friction at the contact point between the wheels and the road gives rise to the forward force.
Braking: during braking, the engine is usually not actively applying torque to the shaft, so the forward force is gone. On the other hand, the brake pads are applying force on the rotor, slowing it down. This has the opposite effect on the wheel rotation: they are not forced to turn faster, but slower. This (+ friction) gives rise to decelerating force at the contact point with the road.
Answer: Your hunch is somewhat correct, for details see below link.
And about the free body diagram, I don't think the internal forces need to be drawn. The fact is that, the stopping of rotation of wheels doesn't stop the car itself.
(Also the cars kinetic energy is not related to the rotation of the wheels, rather it depends on the moving car itself.)
When the car moves at constant velocity the wheels don't experience any friction from the ground because the wheels rotate at a speed which is equal to the speed of the car.
You might have seen this expression: $$v=ωr$$
This is a condition for pure rotation, where there is no friction acting on the wheels.
However when $$ωr<v$$ the wheels experience friction in the direction opposite to that of the motion, which is the reason for the car slowing down.
How Car Brake Works
Comment: You said they don't experience any friction, what about rolling friction? Does it not blur the image?
Comment: Rolling friction is experienced only when the car is accelerating. Here I have taken the car's velocity to be constant.
Comment: And even when break is applied the wheel stops rotating within a short time. After which there is no point in taking rolling friction. After the wheel stop rotating, you might as well replace the wheels with cubical blocks.
Answer: The no slip condition is $v=r \omega$, where $v$ is the linear speed of the centre of the tyre/wheel/car, $r$ is the radius of the wheel and $\omega$ the angular speed of the wheel, will result in the frictional force between the tyre and the road at the point of contact being zero on a horizontal road.
When the engine tries to make the wheel rotate faster there is the potential of relative movement between the tyre and the road at the point of contact  so a static frictional force acts on the tyre which increases the linear speed (and angular speed) of the tyre/wheel/car.
This is the static frictional force acting in the forward direction.
When the brakes try and slow the rotation of the wheel down again a static frictional force acts on the tyre which reduces the linear speed (and angular speed) of the tyre/wheel/car.
That static frictional force acts in the opposite direction to the motion of the car.
So the static frictional force between the tyre and the car always tries to make sure there is no relative movement between the tyre and the road at the point of contact.
If there is slipping between the tyre and the road (either during acceleration or braking) then kinetic friction takes over to try and reduce the relative motion between the tyre and the road at the point of contact.
So in simple terms your have an number of forces acting on the car including the weight of the car, the normal reaction of the road on the car, the frictional forces between the tyres of the car and the road abd the frictional forces between the air and the car.
To get the full picture you also need to consider the torques which are acting on the car which will make the front of the car lift a little when accelerating and drop a little when it is braking.
Too great an acceleration will produce torques which can cause problems.
Answer: Imagine the road floating. Braking would push the road forward, and accelerating would push the road backwards.


Ramayana for Children

Question: I am planning to read a book for my child and wanted to read Ramayana. Can you please recommend a good, preferably pictorial book for reading to children.
I have seen a few by Arshia Sattar , Bulbul Sharma, L.Lal. I am a bit confused as to which one to go for and appreciate your help.
Thanks
Comment: Sri Ramakrishna Math makes one of the best - https://www.abebooks.com/9788171201020/Pictorial-Ramayana-Children-Swami-Raghaveshananda-8171201024/plp . They have Mahabharata also
Comment: How old is your child?
Comment: three and half years old now.
Answer: While reading out stories from scriptures is definitely the best of samskaras we can give to the child, we need to show discretion in selecting what stories we should tell the child from 2 yrs to say 7-8 yrs. It should be all positive (stories which are mostly white less black and definitely no shades of grey). So stories like disrobing of draupadi, gambling match, detailed kidnapping of sita, detailed war stories and stories which don't have a happy ending are a big no no.
After say age of 12 (if trained properly from childhood) there reasoning is sufficiently developed to understand some nuances and can slowly be exposed to stories of cheating, gambling, shrewdness like that we see in Mahabharat or pancatantra.
Till such a time we should be very selective in what we are giving the child, since their conscious mind is not fully developed and whatever you say is going to have a long lasting impression on the child and a toddler does not necessarily understand or decipher right from wrong, though he may memorize "what to do and what not" when the mother/father tells it. So yes, choose stories which would help the child develop as a positive being and positive habits and also enjoys creative imagination.
So coming to my recommendation based on the above information
and your child's age would be to read him stories about good habits, child heroes, stories that are near their immediate nature, of faith and protection, jungles, imagination and magic, for eg:

Vaikuntha enterprises produces good short picture books: https://srivaikuntaenterprises.in/product/ramayan/
Read Dhruva and Prahlad stories from here, they are really good.
Stories of Krishna's childhood pastimes (Maple books are good for these)
Sri Ramakrishna Math makes good pictorial books, but you might skip the Mahabharata for your child for now. But Ramayana is good, but don't delve more into Sita's kidnapping.
Tell creation stories of how Brahma was created and how he created our world in graphic details (ofcourse leave aside the lusty and bad things that were created for a later age :) )

Amara-citra katha i found good for mostly kids 6+ yrs and even teenagers. Who can self-read and it might contain things not suitable for 5 or less. But the pictures and detailing are really good.
Bul Bul Sharma Ramayana is for older children who can ask a lot of why and even understand the answers :) , so for 8+ years in my opinion. Not so much of pictures though.
Arshia sattar again better for older kids.
But the pictures are good in most of the books, so if you are game, read it first and then retell by just referring to the pictures in the book. And this might just be good practice in story-telling for you as well :)
Hope this helps.
Comment: While your argument is tangential to the question, you make a few good points. It also begs the question should young minds be exposed to the objectification of women and their relegation to secondary status as depicted in some of our mythology when the thrust of modern education and popular media tends to run counter to this.
Comment: @iruvar I see objectification of women more in today's pop culture instead of in scriptures. And the secondary status as you see in scriptures is also the interpretation of the scriptures through the eyes of pop-culture and mainstream media and not necessarily in scriptures. Or else why would we have female god names taken before male counterparts and why would we glories of mothers extolled in puranas. And we have so many female devotees and even sages. May be you can give some examples or ask a question citing some of the specifics and we can discuss on that
Comment: perhaps. I'm more referring to anachronisms such as Agni Pariksha etc. Additionally you're probably perfectly aware that men are capable of the cognitive dissonance it takes to worship female gods, venerate motherhood while at the same time oppress and subjugate their womenfolk. The patriarchy is alive and kicking
Answer: You can buy books  of  Amara Chitra Katha.
The online source of the Ramayana is given below:
https://archive.org/details/RamayanaAmarChitraKatha

Ramayana for Children


Free rotating SVG point symbols

Question: I have to rotate a great number of point SVG symbols (valves, caps, Te, etc.) in order to fit them with the gas distribution network. SVG rotating could be achieved by creating a field with angle attributes for each point, but this process is very long due to the great number of points.
Is there a tip or a plugin that permit the free rotation of symbols?
Comment: what do you mean by 'free rotation'?
Comment: Instead of using numeric angle value for each SVG point, I could rotate it interactly (like rotating a block in Autocad)
Answer: I dont think there is a possibility to manually rotate symbols but you can rotate label.
So a workaround could be to label your point with your SVG, you need to set the label text as space, then add your SVG as a background (dont forget to set the rotation to ''Sync with label'') then in the placement tab use data defined rotation with your rotation field. Then you could use the rotation tool in the label toolbar (in edit mode) to automatically update your rotation field.
After you could just use the label as a symbology or use your updated rotation field in a classical data defined symbology
Comment: Thank you for your email. Could you please illustrate these steps by screen capture for a better understanding?
Comment: Now, it works perfectly. Very clever tips. Many thanks.

Free rotating SVG point symbols


how to get Category description after product listing

Question: How can i get category description after product list in product listing page?
Comment: `this did not work for magento 1.9 when you put the code at the bottom of the page at base/default/template/category/vieuw.html and your theme/theme/category/vieuw.html than it stil shows up on your page so does anybody have the good clear solution??` behalf of BG media
Answer: The category description is already displayed in the category view page.
You just need to move elements around.
The template you need to modify is this:
app/design/frontend/{package}/{theme}/template/catalog/category/view.phtml.
take this code:
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>

        <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>

<?php endif; ?>

and move it at the bottom of the file. That's it.
Answer: hi you can description of category at any position of product by using registry variable
if(Mage::registry('current_category')){
<?php
$_helper=Mage::helper('catalog/output');
$_category = Mage::registry('current_category');
if($_description=(Mage::registry('current_category')->getDescription()): ?>

<?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>

<?php endif; ?>

}

Answer: What do you expect exactly...Please be clear in your question.
Go to admin system->configuration->developer and change currentcofigurationscopre option and then in Debug tag Template Path Hints,Add Block Names to Hints' toyes` and save it.
Then see the block and template location of your layout and do what ever you want in the file.(by this way you can find the file location)
Comment: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://magento.stackexchange.com/help/whats-reputation) you will be able to [comment on any post](http://magento.stackexchange.com/help/privileges/comment).
Comment: I am just putting the comment to find location of the template file then he can change or add he needs.
Answer: You can use this code in your app/design/frontend/YOURTHEME/default/template/catalog/product/list.phtml at the bottom
echo Mage::getModel('catalog/layer')->getCurrentCategory()->getDescription();


Can't inject location using Tizen Emulator (wearable)

Question: I got the Tizen platform emulator to run (showing the hands, loading my app, etc.), but when I try to use the control panel to inject the location, I get an error saying "This page can't load Google Maps directly" (looks like an error coming from Google Maps directly", first image below). After that, I can click on the map, or use manual entry to add location, but when I click Inject Marker/ Inject Location, the UI changes to allow me to cancel, but never progresses past this point (Second image below). I can still press cancel, but retrying doesn't change the outcome). Does anyone know how to get around this issue?
Answer: I also faced the same issue on my emulator. Even though the error message from Google Maps is shown, I was able to successfully inject the latitude and longitude and check its values in web application. I just ignored the error message from Google Maps, clicked 'Ok' and then set the marker the same way you did.
The second screenshot you shared seem to be valid from my experience. You injected the marker to the device and the location was changed (you can cancel it anytime, but until then you can check location and it will match the values you injected).
I did it using web application and JavaScript code as:
navigator.geolocation.getCurrentPosition((s) => {console.log("Position: (" + s.coords.latitude + ", " + s.coords.longitude + ")")})
Which returned to me:
Position: (37.259598, 127.052801)
After you cancel the location in Control Panel, the location will be cleared and above code will not return any result.


Does the universe have an edge?

Question: I've heard the universe is just an empty cavity. Does the universe have any edge or stop or is it just an infinite empty cavity?
Comment: Of course it has! Where else would it end?
Comment: Related [What is the name of that which exists beyond the Universe?](http://astronomy.stackexchange.com/questions/2137)
Comment: Related question on Phys.SE: http://physics.stackexchange.com/q/128271/2451
Comment: Also see https://physics.stackexchange.com/q/136860/123208 & https://physics.stackexchange.com/q/105817/123208
Answer: As far as theories I've heard of, we can't see the edge of the universe (if truly exists) because the farther you look out into space through a telescope, the farther back in time you are actually looking. For example, if you are looking at a star 20 light-years away... you're actually currently observing what was happening on that star 20 years ago... the theory is that there is only so far you can look out into the universe because there is only so much history post Big Bang.
Image above: What is the furthest we can see? In 2003, NASA's WMAP satellite took images of the most distant part of the universe observable from Earth. The image shows the furthest we can see using any form of light. The patterns show clumps of matter that eventually formed into galaxies of stars. Credit: NASA/WMAP Science Team
Comment: Don't understand why the down vote. [link]http://www.nasa.gov/audience/foreducators/5-8/features/F_How_Big_is_Our_Universe.html
Comment: Ya I think a down vote fairy flew by, Good answer by the way, upvoted
Comment: That means that as time succeeds our field of view permanently extends doesn't it?
Answer: Galaxies extend as far as we can detect... with no sign of diminishing.There is no evidence that the universe has an edge. The part of the universe we can observe from Earth is filled more or less uniformly with galaxies extending in every direction as far as we can see - more than 10 billion light-years, or about 6 billion trillion miles. We know that the galaxies must extend much further than we can see, but we do not know whether the universe is infinite or not. When astronomers sometimes refer (carelessly!) to galaxies "near the edge of the universe," they are referring only to the edge of the OBSERVABLE universe - i.e., the part we can see
Answer: If we know the universe is expanding, we are saying the universal boundary is expanding. Before the big bang(s), there was "nothing". Which seems an impossibility, because something happened. So we have the big bang(s) and the boundary begins to move outward, at least at the speed of light (knowing there is debate about variable speeds of light,  I am keeping this open). That means that according to our understanding thus far, there is an edge to the universe.
I try to keep in mind that as a creature with everyday experience in three dimensions, it is next to impossible to really understand all the multidimensional possibilities which may make up "the edge". Just like I cannot imagine a time from my viewpoint where there was a "nothing". I believe that the answer lies in a better understanding of multi-dimensions than we have now.
We are so very, very early in our use of a scientific method of exploration, and it seems that every year we are bowled over by the implications of a new discovery - especially in quantum physics.
Comment: I believe the question is about a possible edge of the "whole" Universe, not the _observable_ Universe which is what you're referring to (and which increases its distance to us not only at $c$, but at $4.3c$).
Comment: Great comment. I guess I'm extrapolating that as we see the observable universe expand, the entire universe is also expanding. Presumptuous perhaps, but isn't anything we can measure "observable" (directly or indirectly)? In either case, a bang from "nothing" (which I have a hard time with) would seem to create a boundary between that nothing and something...observable or not. And if we are questioning the speed of light, and if it may be variable, how can we convincingly state that the universe expands at  4.3c?
Comment: I don't think assuming that the rest of the Universe is expanding is presumptuous. Anyway, a bang from nothing doesn't necessarily create a boundary. The Universe is either finite of infinite, but certainly neither implies that is has an edge. If it's finite, then it "curves back on itself", like the surface of a balloon. In "mainstream physics" we don't question the speed of light, and by Hubble's law galaxies the edge of the observable Universe (which is not a physical edge) recede at $v = H_0 d \simeq 3.3c$.
Comment: Because light from increasingly far away will reach us, the distance to the edge increases by another factor of $c$, so the obs. Uni. increases its radius at $v\simeq 4.3c$.
Comment: But, if you're floating in the inside of a balloon, and travel to the balloon itself, that is an edge to whatever is beyond it. I totally get the "edge" idea. But I don't think we can answer it any more than we can answer "what was there before the big bang?", and if the speed of light is indeed variable (or slowing down), that has major implications in our understanding of all kinds of things...age of universe, how relativity would work, where the edge of the universe is, and how long that light would indeed take to reach us.
Comment: The balloon analogy is a 2D analogy of a 3D space. You can't be "inside" the ballon, since then you leave the 2D space. But just as you can travel the surface of the balloon and never reach an edge, you can travel 3D space and never reach an edge. If space is homogeneous and isotropic (the "mainstream" assumption) we _can_ answer the question: Space is either _infinite_, in which case there's no edge and you can travel forever and meet new galaxies, or it is _finite_, in which case there is _also_ no edge, but you can (in principle) travel and get back to the beginning (like on the balloon).
Comment: As for the variable speed of light hypothesis, that's not mainstream physics and, to my knowledge, has no experimental verification whatsoever. As for "how long that light would take to reach us", that's quite easily calculated from the Friedman equation. I will leave it as an exercise :)
Comment: Thanks Pela, very informative!  I caught on that OP was referring to the observable universe, to which there obviously is an "edge" of sorts. Wasn't getting that the balloon was a 2D analogy, sorry. Makes much more sense now. Maybe the question is better thought of as a membrane on the universe. What could lie beyond it. I wish I could come back in 1,000 years to see what we've discovered, if we haven't completely annihilated the earth.
Comment: Oh, and the question of how long light would take to reach us wasn't something I mentioned. Obviously we can calculate that if we accept the older assumption of a constant speed of light. I personally have major doubt about that, and like Magueijo and Afshordi's theory because the uniformity of temperature and matter in the universe are puzzling under our current assumptions. Hawking's expansionist theory is hard to accept without knowing the mechanism which triggered that expansion. It really feels like the theory was massaged to fit the observation of uniformity. Digressed, sorry.
Answer: Dark energy is driving the accelerated expansion of our universe.
Is it accelerating into itself?
Or is it accelerating into nothing, An outer void?
If we could see the furthest away accelerating object that would be the edge of the Universe.  Thus there is an edge to the Universe.
Remember, just because we can't look and see today doesn't mean it doesn't exist.
Comment: Your last two statements appear contradictory. Your first states that the observable universe is the entire universe, while your last statement seems to indicate the exact opposite.

Does the universe have an edge?


SDK CS:GO (Hammer editor): Maximum rounds and round time

Question: I am making a map in CS:GO with SDK. Is there a way to make it so that the map starts with a specific number of rounds and round time (also without warmup if possible)? It is a 1v1 map.
Answer: I am afraid that you can't do that. You would always be able to put in whatever time you want over console-commands. That is because things like roundtime are determined by the Server, not the map.
However, you can put standard round time and such in the config file, yet it only is used if the map is run as a Custom Gamemode, otherwise the game will use the standard config file.
There is an own Page on the official ValveSoftware site dedicated to doing this and which commands you can use.
The commands you probably want are mp_maxrounds, mp_warmuptime, mp_timelimit and mp_roundtime.
Note: mp_timelimit will end the match even if mid-round in case it runs out.
Answer: You could use point_servercommand to set mp_maxrounds and other config settings in Hammer, but I wouldn't do it this way.
A better way is a map specific config:
path/to/server/maps/cfg/your_map_name.cfg

You can put all settings you need in this file and it'll override the given settings from the default server.cfg for this map. When another map is loaded with no specific config the server.cfg will be used again.
I'm not really sure what config settings you want to use, but mp_maxrounds and such are no problem.


Cannot connect to SAMBA shares drive after update to Catalina

Question: I have a raspberry pi 4b running raspbian buster lite, connected to this I have a 1TB HDD, on Mojave I was able to connect to the network folder and access the files on it, however with the new Catalina update I get this when I try to access it (I can still see it) "The operation can't be completed because the original item for "RASPBERRY FOLDER" can't be found."
Is there any way to fix this or connect to the folder/files a different way?
Comment: Hi and welcome! could you clarify a bit on *when I try to access it* ? How do you do so? Command line, GUI?
Answer: Turn off packet signing for SMB 2 and SMB 3 connections as described in
https://support.apple.com/en-gb/HT205926:

Edit <code>/etc/nsmb.conf</code> (create it if necessary)
Add
<code>[default]
signing_required=no
</code>
Save file
Reconnect SMB shares (or reboot your Mac)
Comment: For me it was: Hold the Option key and right-click the Finder icon in the Dock, then select Relaunch.
Answer: This insight gave me the ANSWER to fix my concerns...
trying the different connection prefixes one gave me the answer - cifs:\
IT works for the MOMENT
not sure why it versus Western Digital default answer of smb:\ or afp:\ or other concoctions of prefixes would change permissions to files...IT WORKS (more inquisitive research may be involved - why fix a broken command) !
Comment: This makes no sense - 1). using the URL `cifs://` is for mounting a *remote* file system.  2) `cifs://` and `smb://` are the exact same thing - in other words, using `cifs://` doesn't call a different command.  See `man mount_smbfs` for details on both points.
Answer: I had the same problem and solved it in a strange way,
As we are all aware Mac user has actually 2 names: one is the username (the profile name if i may) and the Display name.
Prior to Catalina , when authenticating with an SMB share from a Windows computer , I was using the display name (although it is a full name with a space) and everything was cool.
In Catalina , I found out I can only use the username, windows cannot authenticate with the display name.
of course , before I got to this point I have checked/enabled SMBv2, created the NetBios file in the MAC and all the other hints I could find, which obviously did not do the trick for me.
hope this helps
Comment: So what did actually work (what did you have to change to make it work again)?


Determine segregating SQL column in known sets

Question: I have a known target set of records in a large Oracle DB table that I want to pull. Rather than querying them by ID though, I want to find a a column within the table that holds a value(s) that is only assigned to the known set and not assigned to any records that are not in the set, thereby giving me a value to key off of.
Example:
Target IDs: 1, 2, 3

ID  Color  Dir    Size
1   red    up     S
2   red    up     M
3   red    down   L
-----------------------
4   red    left   S
5   blue   left   S
6   red    left   M
7   red    right  M
8   blue   right  M

In this scenario, the solution I'm looking for is the "Dir" column, as values up and down are exclusive to records in the desirable set and cover the entire set.
The table I'm working with has 80,000+ records and 100+ columns, so I'm looking for a way to perform this investigation in an automated manner, whether it be by SQL script or with tools like SSIS/SSAS 2008, Excel, PowerShell, etc. What SQL functions and/or utilities can help in this process?
Comment: A one-node decision tree?
Answer: I know this is a long shot, but I have a solution for you that should work in SQL Server. Of course, the caveat being that you would need to get your data from Oracle into SQL Server first.
There are a couple methods listed here:
https://dba.stackexchange.com/questions/23782/what-is-the-easiest-way-to-move-data-from-oracle-to-sql-server
If you manage to do that, you can give this a try:
IF OBJECT_ID('TestTable1', 'U') IS NOT NULL DROP TABLE TestTable1;

CREATE TABLE TestTable1 (
    ID INT IDENTITY(1, 1) PRIMARY KEY,
    Color VARCHAR(10),
    Dir VARCHAR(10),
    Size VARCHAR(10)
);

INSERT INTO TestTable1 (Color, Dir, Size)
VALUES  ('red', 'up', 'S'),
        ('red', 'up', 'M'),
        ('red', 'down', 'L'),
        ('red', 'left', 'S'),
        ('blue', 'left', 'S'),
        ('red', 'left', 'M'),
        ('red', 'right', 'M'),
        ('blue', 'right', 'M');

DECLARE @tableName sysname = 'TestTable1';
DECLARE @targetIDs VARCHAR(MAX) = '1, 2';

-- Get all of the columns associated with the specified table:
DECLARE @targetObjectID INT = OBJECT_ID(@tableName, 'U');
DECLARE @ColumnNames TABLE (
    ID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY,
    ColumnName sysname NOT NULL,
    HasOverlap BIT NULL
);

INSERT INTO @ColumnNames (ColumnName)
    SELECT c.name
    FROM sys.columns c
    WHERE c.object_id = @targetObjectID
        AND c.name <> 'ID';

-- Define a template to use for searching column values for overlap:
DECLARE @columnTestSQL NVARCHAR(MAX) = '
    WITH TargetValues AS (
        -- This produces a list of values for the target IDs:
        SELECT DISTINCT <ColumnName> [Val]
        FROM <TableName>
        WHERE ID IN (<TargetIDList>)
    )
    SELECT @hasOverlap_OUT = 1
    FROM <TableName> t
    WHERE
        -- Here we check for overlap with other IDs:
        t.ID NOT IN (<TargetIDList>)
        AND EXISTS (
            SELECT 1
            FROM TargetValues tv
            WHERE tv.Val = t.<ColumnName>
        );
';
SET @columnTestSQL = REPLACE(@columnTestSQL, '<TableName>', @tableName);
SET @columnTestSQL = REPLACE(@columnTestSQL, '<TargetIDList>', @targetIDs);

-- Set up for loop:
DECLARE @curID INT = 1;
DECLARE @maxID INT = (SELECT MAX(ID) FROM @ColumnNames);
DECLARE @curColumnName sysname;
DECLARE @curHasOverlap BIT;
DECLARE @curSQL NVARCHAR(MAX);

-- Go through each column:
WHILE @curID <= @maxID BEGIN

    -- Initialize this iteration:
    SELECT
        @curColumnName = cn.ColumnName,
        @curHasOverlap = 0
    FROM @ColumnNames cn
    WHERE cn.ID = @curID;

    -- Use the template to generate a dynamic SQL statement specific to the current column:
    SET @curSQL = REPLACE(@columnTestSQL, '<ColumnName>', @curColumnName);

    -- Execute the dynamic SQL to check for overlap:
    EXEC sp_executesql
        @stmt = @curSQL,
        @params = N'@hasOverlap_OUT BIT OUTPUT',
        @hasOverlap_OUT = @curHasOverlap OUTPUT;

    -- Record the results:
    UPDATE @ColumnNames
    SET HasOverlap = @curHasOverlap
    WHERE ID = @curID;

    SET @curID += 1;
END

-- Output a list of fields with no overlap:
SELECT ColumnName
FROM @ColumnNames
WHERE HasOverlap = 0;

I have to admit I was a little thrown off by the tags on this question at first. I thought I would go ahead and post this anyway in case it helps.


Display only two subcategories under subcategories on frontpage

Question: I have many subcategories under sub categories. But i want only first two subcategories to be displayed on home page. Please guide how can i do without deleting the subcategories.
I have used web and people extension to customize the display on categories and subcategories
Comment: you want to show the cardio and boxing only?
Comment: in one subcategory i want to display only two subcategories,, like under cardio only treadmill and cross Trainer to be displayed
Comment: second level or third level?
Comment: in third level it should display
Answer: Go to catalog->Manage Categories make following changes which you don't want to display in navigation

Include in Navigation Menu = No.
Comment: Thank u,, i got what i was needed.
Answer: No, you not need to delete any subcategory instead you just need to do some R&D in admin system configuration. Where i'm sure the extension you have been using webAndPeople must have created a tab. You just need to modify its setting to define how many levels of categories it should display. That's it.
Clear all cache if enabled before testing in frontend.


custom home launcher

Question: I am looking to make a custom home launcher.
BEWARE: I have 0% knowledge of how this is done.
So I own an lg esteem and a Sonyericsson xperia arc.
I love the 4.3" screen of my esteem but I love the launcher of my xperia arc. Can I just swap the png's and animations from my arc to my esteem and recompile them or is there more to it than this?
oh and the launcher for the arc is 890kb and my esteems launcher size is 7mb. Why such a large difference in size.
Answer: You should check for the answer in the sample example which comes along the adt. They might help you in getting the right launcher.

custom home launcher


Does Go language use Copy-on-write for strings

Question: Does Go language use Copy-on-write for strings as in Java? I.e. if I pass a string by value to a method and never change it will this allocate memory and copy the string (which will be time inefficient) or it will just reference a single copy.
Comment: "copy-on-write ... as in Java" makes no sense. Objects are not values in Java; only references are. And passing a reference NEVER makes a copy of the object it points to under any circumstances. Passing or assigning a reference always will refer to the same object as the original reference. An object is never copied (not "on-write"), unless you explicitly copy it through some method, and get a reference to a new object back.
Answer: It's not Copy-on-Write, as strings are immutable. But sharing a string will not make a copy of the underlying memory region either. In Go, a string is represented as a (length, data) pair. If you pass a string around, Go will copy the length and the pointer but not the data pointed to.
For further information, see this recent thread on golang-nuts.
Comment: If it is not a copy on write, then what will happen in this scenario? e.g. s := "hello"; t := s; s += " world"; t += " there". one of these have to create a copy, probably t in this case.
Answer: Go type string is practically equivalent to java.lang.String. The two implementations (in the Go runtime, in the JVM) are similar as well, although they are not identical. In terms of passing arguments to functions and methods, performance of Go strings is similar to Java strings.