Fast or silent efficient trashcan

Question: After recently centralizing item storage and sorting at my base, I found myself with some chests approaching overflowing. Especially some mixed farms (like the generic mob farm) produce more of some items than I know what to do with - like arrows. And as I don't want my sorting system to jam up (or discard whatever passes unsorted... e.g. in case another farm's collection system picks up my trident I'd accidentally dropped on a hopper) I need to periodically empty the overflowing chests, and e.g. discard a double chest of arrows.
So I built a trashcan. I'd move the arrows to a double chest in the floor, and it would transfer them through a hopper to a dropper into lava. And as I'd work around the item storage area I'd suffer clicking of the dropper for another 12 minutes as it kills 1728 arrows, one by one.
I managed to about halve the time by applying a faster clock and feeding the dropper through two hoppers from the same double chest at once, but it's still six minutes of incessant clicking (at double rate).
Can you suggest a trashcan system that can either kill a double chest of items relatively silently (may be slower) or do it so fast I won't be driven mad by the clicking? (and no, just dropping them on the ground to despawn isn't the right solution because I need to drop every stack of items separately, while transferring the full inventory to a chest just requires me to doubleclick a stack of arrows while holding another stack of arrows.)
Moderate compactness is a plus. Like, I don't mind dedicating an 8x8x8 chamber to the trash system, but I'd prefer the solution not to be a chain of hoppers so long it carries the items outside my hearing range. (also, while I began seriously considering throwing full shulker boxes into lava, I'm not quite that rich yet...)
Minecraft 1.13.2 Java Edition, PC.
Comment: Options > Music & Sounds > Blocks 0%.
Comment: @L_Church: I don't want *all* the block sounds off, just this specific one...
Comment: the clicking is going to be a definite thing unless you involve chests
Comment: @L_Church: I'm quite willing to sacrifice 4 logs (required for a double chest) per one cleanup, but I'd prefer the solution to be rather automatic. Not "craft 2 chest, place them, fill, do some other magic, items gone" - that's why the idea with shulker boxes, they can be deployed and broken automatically. BTW, TNT is definitely an option.
Comment: Could you have the arrows go into a separate chest, then just take all the arrows and throw them at a cacti or lava?
Comment: @SpiceWeasel: I have them in a separate chest. I have them in four hopper-connected separate chests, with the chests and the hoppers overflowing already. We're not talking about discarding a single stack of arrows. We're talking about discarding a double chest of arrows every two days or so. 27 stacks, throwing one after another into the lava or at a cactus, 27 times, repeat every 2 days or so. If you know a way to *drop* all items of given type from own inventory at once, that would be great, but I think it's only possible to move them to a chest. (without chest it just moves them to hotbar).
Comment: Step 1: Fill your inventory with arrows. Step 2: Have a nice lava bath. ;)
Comment: @YoutRied: That's actually a pretty reasonable idea.
Comment: You could open your inventory and take the stacks one by one and drop them in the cacti. Unfortunately that's the only way I know how as I never actually needed to make this kind of trashcan before. What if you broke the double chests, then the arrows would fall down into a pit of lava or something? Although that would also destroy the chests.
Comment: @SpiceWeasel: If I manage to break the chests in a way that won't make me pick up the arrows... Though it's still awfully 'manual'. Pick a new pair of chests from a chest of chests, place them over lava, pick arrows from source chest, drop into the new chest, use axe to break first half, then the other... kinda works, though nowhere as nice as 'pick from source chest, dump into trashcan chest, forget (if the noises allow.)
Comment: What if you put the arrows into a minecart chest, then when it was full sent it off on a big rail, then the trashing was far away where you couldn't hear the sound? Or maybe you could have a line of hoppers so far down you couldn't hear the noise? If those ideas don't work I don't think I have a solution.
Comment: @SpiceWeasel: That would work, even a pipeline of hoppers would, the problem is my base is built into a mountain where room is getting increasingly scarce. Drawing extra pipelines or rails a long distance gets increasingly difficult. I have some room reserved for expansion of the storage system, including space for the trash disposal, but if I go 20 blocks in any direction from the system I'm bound to hit a farm or some other infrastructure, or surface of the mountain. And obviously I'm not expecting everyone to know a good solution; if it was easy I'd have already done it.
Answer: This question really stumped me. I spent a number of hours messing around with different redstone contraptions, trying to make something that matched what you wanted. I was able to get somewhat close but I wasn't left satisfied by it. Here is that contraption regardless:
Solution 1: The Pit

It starts with two hoppers transferring the contents of the trash chest into a chest in a minecart (Note: You should be able to make a two cart version with just a few adjustments). That minecart sits on a powered rail that is connected to "the junction". More on that later. The rail itself points towards a pit, 14 blocks deep. At the bottom sits one piece of obsidian, as seen here:

Now back to "the junction". "The junction" is what I named the three paths of redstone all connected to one lever. The right path leads to a redstone alternator in order to trigger the powered rail. The center path consists of 6 redstone repeaters all set to max time that terminates at a sticky piston. The left path is an alternator that leads to a simple redstone line in order to trigger the centerpiece of it all, a block of TNT.
In practice, you load up the center area with a block of TNT, as seen in the overview image, then place a minecart chest on the rail before pulling the lever. The cart will fall to the obsidian block, the TNT will be lit, and, after a small delay, the TNT will fall 16 blocks and blow up the cart, spilling its contents everywhere in order to despawn.
Note: As I write this now, I also realize you could put a obsidian block for the TNT to land on and you don't have to worry about timing at all which should let you compact it quite a bit more.
This was the closest I could get but I'm not really happy with it. It costs a minecart and chest (or two) every time along with a block of TNT. And while it's possible to save chests in order to reuse, I couldn't find a way to save the cart. So I went to find another solution.
My next solution is just as much as a bit of a hackjob. I ran out of ideas for some redstone contraption or clever chest usage and so I turned to different methods.
Solution 2: Overkill
I made a resource pack that removes the sound from the game.
This might not be ideal as the click is used for dispensers, buttons, menu buttons, levers, etc, but it undeniably makes it so you never have to sit through 6 minutes of clicking plus you don't even have to make some big machine with it.
You can find it here: QuietDroppers
I do hope someone finds a better solution though.
Comment: Hmm. Minecart with chest, detector rail over TNT dispenser both aimed at a pit of obsidian... 4 wood, 10 iron and 2 TNT per cleanup... that's affordable.
Comment: Hmm... Minecart with chest breaking on cactus, a sorter-locked hopper that takes  the two with some luck, a lava dispenser to kill most the rest fast (or not. just let them despawn)... Now how to make a hopper take in only a minecart and chest and nothing else...
Comment: @SF. That was one of the issues I ran into when making the original design. It's easy enough to save chests, as they stack, but carts are a different story. Another design I was trying out involved having the cart ride a rail far away and deposit its goods in a hopper under the last rail on the other side. Then you could call it back after an allotted time period. It takes a lot of time though with its one major plus side being that it didn't take any resources per cleanup.
Comment: Doublechest of minecarts with chest can last a long time. :) "Getting the items far away" was my first plan, but while I can afford quite a bit of space locally, I really don't want this "sprawling" - long pipelines or railway tracks or such.
Answer:
This is what I came up with.

The double chest feeds the dropper through double hopper feed (one hopper visible, the other connects to another that feeds the dropper from a side).
The hysteresis circuit waits until the dropper is full, then starts the clock (moving the observer towards the other one). This starts the emptying process. Once the dropper is empty, emptying stops until it's full again, so if the hoppers don't keep up, the process stops.
The other observer can be moved up then down (by a lever) - this is a quirk that about doubles the observer clock speed. This halves the time of noise.

Further improvement:
Instead of one dropper, this uses two. Only one is measured, but they should receive about the same amount of items, and the clock won't stop until one of them is full, so no risk of one of them gradually filling up. This time the hoppers definitely won't be keeping up, but the droppers are emptied at full speed and the total time of noise is halved again.

Fast or silent efficient trashcan


projecting 3d onto 2d plane is not showing up correctly

Question: I am trying to learn about 3d graphics from first principles, so i have decided to implement a simple thing, create a circle in 3d space & rotate it along some axis. I understand the basics theory.

position circle somewhere in 3d space.
calculate its projection on some plane.

Once i can get this i can use rotation matrix to calculate the new position of vertices. but i am a bit stuck at 2nd step.
this is my code:
import pygame
import math

(width, height) = (600, 500)
screen = pygame.display.set_mode((width, height))
pygame.display.flip()

running = True

K = 8   # view plane distance
cz = 10 # z location of circle initially.

# Pyagme 0.0 is at top left , but i want to center it at window?? is this even coorect to do or is should just continue using top left.

def translate_coords_to_center(x , y):
    return (width/2 - x, height/2 - y)

# plots a pixel
def pixel(x,y,color=(100,20,30)):
    s = pygame.Surface((1,1))
    s.fill(color)
    r,r.x,r.y = s.get_rect(),x,y
    screen.blit(s,r)

# Draw the circle
def circle(cx, cy, cz, radius):
    N = 100
    PI = 3.14
    angle = 360 / N

    for i in range(N):
        x2 = cx + radius * math.cos(PI* angle * i / 180)
        y2 = cy + radius * math.sin(PI* angle * i / 180)

        # Do a 2d projection
        x2 = K* x2 / cz
        y2 = K* y2 / cz

        pixel(x2, y2)

while running:
    x, y = translate_coords_to_center(0,0)
    circle(x, y, cz, 50)
    cz += 1
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

When i change the z position of circle, i get something like the below image, I am expecting the circle to not change its position but only its size, ( i know this cant be true as i am dividing by z ), am i missing some translation step? :

EDIT:  Adding the translation after projection is also not working:
import pygame
import math

(width, height) = (600, 500)
screen = pygame.display.set_mode((width, height))
pygame.display.flip()

running = True

K = 8
cz = 10

def translate_coords_to_center(x , y):
    return (width/2 - x, height/2 - y)

def pixel(x,y,color=(100,20,30)):
    s = pygame.Surface((1,1))
    s.fill(color)
    r,r.x,r.y = s.get_rect(),x,y
    screen.blit(s,r)

def circle(cx, cy, cz, radius):
    N = 100
    PI = 3.14
    angle = 360 / N

    for i in range(N):
        x2 = cx + radius * math.cos(PI* angle * i / 180)
        y2 = cy + radius * math.sin(PI* angle * i / 180)

        # Do a 2d projection
        x2 = K* x2 / cz
        y2 = K* y2 / cz
        sx, sy = translate_coords_to_center(x2, y2)

        pixel(sx, sy)

while running:

    circle(0,0, cz, 50) # this works correctly, but circles are centered at top left corner of screen,
    cz += 1
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

Answer: Your translate_coords_to_center(0,0) function should be done after you have done the projection from 3d to 2d.
e.g.
for i in range(N):
        x2 = cx + radius * math.cos(PI* angle * i / 180)
        y2 = cy + radius * math.sin(PI* angle * i / 180)

        # Do a 2d projection
        x2 = K* x2 / cz
        y2 = K* y2 / cz

        sx, sy = translate_coords_to_center(x2, y2)

        pixel(sy, sy)

while running:
    circle(0, 0, cz, 50)
    cz += 1
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

The effect you are seeing is caused by 2 things.

Because a constant x/y offset is incorrectly added in 3d world space the array of circles will appear to the right and below of the camera's position.
Because the 0,0 origin of view/camera space is not the centre of the display, instead it's at the top-left (Adding the window centre coords AFTER projection fixes that)
Comment: after adding the translation after projection , i get a straight line from center to the top left corner of screen
Comment: Can you post your modified code so I can check it for you ?
Comment: Did you remove the translation before projection ? (so circle has 0,0 passed for its X,Y coord)


How to add a string to Key of an array and get values

Question: Consider an array
var myarray =
{
first_data:{"round1":"h","round2":"i",...,"round20":"z"}
second_data:{"round1":"a","round2":"b",...,"round26":"z"}
}

In order to get the value of round1 in first_data
we use
myarray(firstdata).round1

So I need to loop through the rounds that are present in which i specify just round and concatenate the iteration value
for(var i=1;i<21;i++){
      console.log(myarray[firstdata].round+i)
}

which must return the values of the rounds in the array
Comment: Please add your original data to post and also the expected out clealy
Comment: Use `canddata[key]["round" + i]`. But, you are better off creating an array for `rounds` rather than 20 properties with `round` prefix
Comment: If you want the property using an expression then use [Bracket Notaion](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors#Bracket_notation). Like `canddata[key]["round" + i]`.
Comment: Its not a good idea to have properties names containing some kind of sequence like `round1,2,3...`. You should use arrays instead. `first_data:{rounds:['h','i',...'z']}`.
Comment: At first should understand what mean `myarray[firstdata].round+i`: by starting this code javascript will start to find round property in the `myarray[firstdata]`  object, so if you have that property the javascript will add `i` to that value. it is easy you should just read about array object in javascript. that enough
Answer: You can try following to get keys from the object dynamically

var myarray =
{
first_data:{"round1":"h","round2":"i","round20":"z"},
second_data:{"round1":"a","round2":"b","round26":"z"}
}

var first = myarray.first_data
var totalKeys = Object.keys(myarray.first_data).length;
var keys = Object.keys(myarray.first_data);

for(let i=0; i < totalKeys; i++){
  console.log("keys is", keys[i])
console.log("Value is", first[keys[i]])
}


vagrant error:Vagrantfile already exists in this directory

Question: When I input $ vagrant box list,
Terminal outputs: centos64 (virtualbox)
Now I input $ vagrant init centos64,
Terminal outputs an error message:
"Vagrantfile" already exists in this directory. Remove it before running "vagrant init".

How do I remove it?
Answer: You can remove the Vagrantfile by typing rm Vagrantfile
at the command line, but it is not clear what you are trying to achieve.
The vagrant init command will initialise a new virtual box by creating a default Vagrantfile. Since you already have one, it looks like you may already have run the vagrant init command.
If you are trying to start the VM then you need to use the command vagrant up centos64
Answer: From website : https://www.vagrantup.com/docs/cli/init.html
To overwrite any existing Vagrantfile use :
vagrant init {BOX_NAME} --force
If specified, this command will overwite any existing Vagrantfile.
and then
vagrant up
Answer: You just deleted the VMinstance.
so just put

vagrant up

and the instance comes up and run.
Answer: If you are having any difficulty initializing a file on vagrant, simply overwrite the file.
e.g the name of the file is ubuntu/focal64
To remove:
rm vagrantfile ubuntu/focal64

To overwrite:
vagrant init ubuntu/focal64 --force

If removing is giving issues, simply overwrite it.


How can I level my bedroom floor?

Question: I have a second floor bedroom that is 10' wide by 16' long. The floor is 3/8  to 3/4 then back to 3/8 lower, then 1/4  to the bedroom door. How can I even the floor?   I can not raise the  new floor very much as it will end up too high at the door going into the hallway.  Can I cut the joists at the high point to level the floor? Can I do this to all of the joists?
I have been trying so many different things over the past 3 weeks and I'm very discouraged.
Somebody did tell me that I could use roofing singles to even the floor.  How would I go about doing this?
Comment: When you say it's 3/8 to 3/4 then 3/8 - do you mean that the underlying joists are uneven, or the subfloor is unlevel but the joists are fine, or that the floor surface height varies but the subfloor is level?  As for roofing shingles, some people are idiots.  Nuff said.
Comment: @TheEvilGreebo I think the shingles were cedar shims. He was talking about shimming it up.  Sounds really tough to me.
Comment: Ok that makes more sense but still a bad idea if you're doing anything other than shimming the joists resting on support posts.  Shimming a sub-floor leads to uneven pressure distribution along the joists.  You generally can't shim a final floor finish.
Comment: I'm no carpenter, but if the joists are uneven without any flooring, the difference does not sound that bad. All I know is to NOT cut the joists. I suppose it really matters on what type of flooring is going in.
Comment: How about some pictures of the problem? you've provided too little information.  It could be simple or it could be a lot more work than we think.
Answer: First, you need to find out WHY the floor is uneven.  Are the joists sagging?  Then you might have some structural issues.
From your description, it sounds like you have no boards over the joists right now.  Is this correct?
I would not cut the joists, as this will cause structural weakening.  You might be able to use a block-plane to shave down a particularly high point, but I wouldn't plane too much.
As for the shingles, I believe your friend was talking  about wooden, usually cedar, shingles.  These are tapered, and could be used to shim up a low spot, but I don't think it's very practical for a big job.
If the joists are the problem, there are three scenarios.
Joists are twisted, but longitudinally level.
This is the simplest.  If you joists are 2x8, then buy a couple of 2x8's and cut them down to the appropriate spacing.  Then bang them in between every pair of joists to straighten them up.

Each Joist is level, but they have different heights
You could find the low ones and cut (rip) a thin piece off a 2x4 to attach to the tops of the low ones.  It could be a bit tricky to get the thickness right.
Joists are bowed
I think the easiest option would be to sister the joists with new joists, only slight higher, so that the tops of the new joists are level and even over the entire floor.
However, you're probably not going to be able to tie the ends of the new joists into the structure.  This means that they're going to have to be extremely well connected to the old joists.  I'd recommend glue, and bolts with washers right through the mid-height line of both joists.  (The center being the zero-force axis of a beam.)  Drill the holes ever so slightly wider than the bolts, so that you can torque them nice and tight.
Comment: If the joists are individually level but uneven from joist to joist, instead of a shim you should cut a strip of wood to the desired thickness and fix that to the top of the low joists, to avoid low points.
Comment: @TheEvilGreebo  Good point.  I was thinking in the other direction.  As well, they could simply be a bit twisted, and stabilizing blocks might help.
Comment: Agreed, in that scenario shims are fine.
Comment: yeah but im 3 inches low at the door level can i sister the joists with glue and bolts and cut the original joist 3 inches to bring down the high end to level at the door going out to the hallwill i have support on the low end with a wall from underneath but the other end will not be just bolted to the joists can i do this
Comment: I think you need professional advice here.   It sound's like you might need to jack up the house.
Comment: I think you're out of your depth.  That's ok to admit.  Sometimes it's better just to get a professional in.  What you're wanting done sounds like a lot more than just what's described here.
Answer: I am presently renovating a house that has a 4" differance from one side to the other due to old settling not ongoing subsidance so your problem is my problem,how to level the floors ,ceilings etc.
FIRST:- You must find out WHY the floor level has changed,what has caused it?
        Get expert advice,not some guess work, before you do anything.
Second:- do not start cutting the joists you will weaken them and could end up with them failing..= worse problem.
Assuming you have the floor up and are looking at the joists I would find the highest joist and draw a level line around the wall at this point.
starting from near the middle of the room add sister joists, as the other post details, and work out to the edges.
Don't forget that your ground floor ceiling is probabley attached to the lower side of the existing joists, so if you try and move the original joist positions you will end up destroying the ceiling below... not cheap...

How can I level my bedroom floor?


How to handle the javascript decoding error?

Question: When the code is implemented, some characters cannot be decoded. I am getting a bunch of question marks like ??. How can I fix this?
HtmlInput inputBox2 = (HtmlInput)currentPage.getHtmlElementById("classNo");
inputBox2.setValueAttribute("2016同學15");
ScriptResult result = currentPage.executeJavaScript("javascript:Search(2)");

I found this in the compiler:    ScriptResult[result=net.sourceforge.htmlunit.corejs.javascript.Undefined@24d7aac3 page=HtmlPage(http://www.xx.org/classNo=2016??15)@1330510442]
Answer: You might try to use URL-encoding for some ASCII and all non ASCII characters.
e.g. space by %20
Here is a web site explaning the
HTML URL Encoding Reference.
You can also interactive encode strings there.
Your "2016同學15" would be encoded as:
"2016%E5%90%8C%E5%AD%B815"


How to change the geometry of the two selected models?

Question: I know getSelection() is get the db id of seletion model.
but after this i don't know how to control this viewer.
There are two windows selected by the viewer.
I want to change the geometry of the two windows.
Forge Viewer is open Revit file by my bucket.
<code>viewer.getSelection()
=>(3) [3043, 3055]//how to?
</code>
Answer: Unfortunately, the viewer isn't designed to support geometry modification. You can modify your design elements in these ways:

changing their position, orientation, or scale (blog)
hiding them, and potentially inserting your own custom three.js geometry instead (tutorial)
changing their materials, incl. using custom shaders (blog)

But if you actually need to tweak the individual vertices of the mesh geometry, that would be very difficult to do.
Comment: Is there a way for the viewer to change the family of Rabbit in real time?
Comment: I'm afraid not. Once your design (whether it's Revit, IFC, DWG, Inventor, etc.) is converted by Forge for viewing in Forge Viewer, it's just a specialized viewing file format, kinda like when you convert Word or Excel documents into PDF. So there's no concept of "Revit families" anymore.
Comment: If you'd like to change Revit families of individual objects in your Revit design, you'd have to use the [Design Automation for Revit](https://forge.autodesk.com/en/docs/design-automation/v3/reference/http/), and that wouldn't be in realtime.
Comment: It helped me a lot. Thank you.


Create an custom button control in WP8

Question: ...

Ok, thanks Scott Nimrod, I find a way: create a new project , add a new user control, build to dll and add reference to my app project
Here's my code, if anyone could need :)
In my app's xaml page (the click event worked but the 2 Image "sourceNormal" and "sourcePressed" not visible)
<local:ButtonImage Width="40" Height="40"
                         Click="ButtonImage_Click"
                         SourceNormal="/download_home.png"
                         SourcePressed="/download_nowplaying.png"/>

UserControl XAML
<UserControl x:Class="MyCustomControl.ButtonImage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="480" d:DesignWidth="480"

DataContext="{Binding RelativeSource={RelativeSource Self}}"
xmlns:ntd="clr-namespace:MyCustomControl">

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Button x:Name="Button_Image" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Button.Template>
            <ControlTemplate TargetType="Button">
                <Grid Background="Transparent">
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ImageNormal">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                            <DiscreteObjectKeyFrame.Value>
                                                <Visibility>Visible</Visibility>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ImagePressed">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                            <DiscreteObjectKeyFrame.Value>
                                                <Visibility>Collapsed</Visibility>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="MouseOver"/>
                            <VisualState x:Name="Pressed">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ImageNormal">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                            <DiscreteObjectKeyFrame.Value>
                                                <Visibility>Collapsed</Visibility>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ImagePressed">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                            <DiscreteObjectKeyFrame.Value>
                                                <Visibility>Visible</Visibility>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Image x:Name="ImageNormal" VerticalAlignment="Center" HorizontalAlignment="Center" Source="{Binding SourceNormal}" Stretch="Uniform"/>
                    <Image x:Name="ImagePressed" VerticalAlignment="Center" HorizontalAlignment="Center" Source="{Binding SourcePressed}" Stretch="Uniform"/>
                </Grid>
            </ControlTemplate>
        </Button.Template>
    </Button>

</Grid>

UserControl code behind:
namespace MyCustomControl
{
public partial class ButtonImage : UserControl
{
    public ButtonImage()
    {
        InitializeComponent();
        Button_Image.Click += ButtonImage_Click;
    }

    public ImageSource SourceNormal
    {
        get { return (ImageSource)GetValue(SourceNormalProperty);}
        set { SetValue(SourceNormalProperty, value); }
    }
    public ImageSource SourcePressed
    {
        get { return (ImageSource)GetValue(SourcePressedProperty); }
        set { SetValue(SourcePressedProperty, value); }
    }

    public event EventHandler Click;
    void ButtonImage_Click(object sender, RoutedEventArgs e)
    {
        var eventHandler = this.Click;
        if (eventHandler != null)
        {
            eventHandler(this, e);
        }
    }

    /////////////////////// SourceNormal /////////////////////////////////////////////////////

    //----------------------------------------------------------------------------------------
    public static readonly DependencyProperty SourceNormalProperty = DependencyProperty.RegisterAttached(
        "SourceNormal",
        typeof(ImageSource),
        typeof(ButtonImage),
        new PropertyMetadata(null)
    );

    public static ImageSource GetSourceNormal(UIElement element)
    {
        if (element == null)
        {
            new ArgumentNullException("element");
        }
        return (ImageSource)element.GetValue(SourceNormalProperty);
    }

    public static void SetSourceNormal(UIElement element, ImageSource value)
    {
        if (element == null)
        {
            new ArgumentNullException("element");
        }

        element.SetValue(SourceNormalProperty, value);
    }
    //----------------------------------------------------------------------------------------

    /////////////////////// SourcePressed ////////////////////////////////////////////////////

    //----------------------------------------------------------------------------------------
    public static readonly DependencyProperty SourcePressedProperty = DependencyProperty.RegisterAttached(
        "SourcePressed",
        typeof(ImageSource),
        typeof(ButtonImage),
        new PropertyMetadata(null)
    );

    public static ImageSource GetSourcePressed(UIElement element)
    {
        if (element == null)
        {
            new ArgumentNullException("element");
        }
        return (ImageSource)element.GetValue(SourcePressedProperty);
    }

    public static void SetSourcePressed(UIElement element, ImageSource value)
    {
        if (element == null)
        {
            new ArgumentNullException("element");
        }

        element.SetValue(SourcePressedProperty, value);
    }
}

}
Comment: I dont think this is any really good option for this. I am assuming the image is small so it could be converted to a base64 string.  You could convert the base64 string to a bitmapimage and make it the default value for the DependencyProperty
Comment: oh, that's not i mean :) I mean i want to know if I could make a new "button" which I could use in my other apps, some kind of controls in packages like WP toolkit or coding4fun toolkit
Answer: The answer is Yes.
Telerik does this with their RadControls.
Just create a separate project and add the major references that WPF relies on for UI.
This is also a pattern when implementing Prism modules.
In your other projects, just add a reference to the dll that your style is defined in.

Create an custom button control in WP8


invalid app id when logging into facebook from custom app

Question: I used facebook sdk and created app in facebook couple of months back. Also, I was able to access and authenticate to the app.
But not sure what happened all of a sudden I am getting invalid App ID : app_id.
the only difference from last time to now is ... i created new emulator now.
so what are the check list to debug this issue.
I could see many threads asking the invalid app id but none of them ended with answer.
Answer: Check whether  your app is still listed in your facebook developer account. Check the ID of the app in the facebook page with that you are having now.
Comment: yes i could see the app and app id is same.
Also, I am able to get the data in graph api.
Comment: Did you find the solution i am facing the same issue


Can I purchase any Xbox Live Gold membership card for a family member if I don't know which region they're in?

Question: As per the title, my cousin has an unknown region gamertag/account on his Xbox (or at least, I'm not sure about it 100%).
I want to get him a 12 month Gold subscription so he can join me in online gameplay for Christmas (reason why I'm not sure).
How would I go about verifying the correct region for the prepaid card purchase? Or do you get ones that are valid worldwide?
Answer: Supposedly prepaid Gold cards are region-free, although Microsoft controls this and their stance is:

Some prepaid codes can be redeemed only in the country or region in which they were purchased.

... which is extraordinarily vague, likely on purpose.
You might want to contact Xbox Live customer support before spending any money - it's generally very hard to get your money back from these prepaid cards.  Also, counterfeits and completely fake codes are extremely common from less reputable sellers, so beware any crazy deals or promises from vendors.


Input verifier between textfields and radio buttons

Question: I set input verifier to my two text fields and i want that my radio buttons should be Inactive until two text fields being verified.
(User should can not select any from radio button, until text fields verify.)
How inactive JRadioButtons until JTextFields be verify?
My code:
public class AddUserDialog2 extends JDialog implements ActionListener {
JButton cancelBtn, okBtn;
JTextField fNameTf, lNameTf;
JRadioButton maleRb, femaleRb;
ButtonGroup group;
JLabel fNameLbl, lNameLbl, genderLbl, fNameTemp, lNameTemp, tempBtn, temp3;

public AddUserDialog2() {
    add(createForm(), BorderLayout.CENTER);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    pack();
    setVisible(true);
}

public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            new AddUserDialog2();
        }
    });
}

public JPanel createForm() {
    JPanel panel = new JPanel();
    okBtn = new JButton("Ok");
    cancelBtn = new JButton("Cancel");
    tempBtn = new JLabel();
    fNameLbl = new JLabel("First Name");
    fNameTemp = new JLabel();
    lNameLbl = new JLabel("Last Name");
    lNameTemp = new JLabel();
    genderLbl = new JLabel("Gender");
    fNameTf = new JTextField(10);
    fNameTf.setName("fntf");
    fNameTf.setInputVerifier(new MyVerifier());
    lNameTf = new JTextField(10);
    lNameTf.setName("lntf");
    lNameTf.setInputVerifier(new MyVerifier());
    maleRb = new JRadioButton("Male");
    maleRb.setInputVerifier(new MyVerifier());
    femaleRb = new JRadioButton("Female");
    femaleRb.setInputVerifier(new MyVerifier());
    temp3 = new JLabel();
    group = new ButtonGroup();
    group.add(maleRb);
    group.add(femaleRb);
    maleRb.addActionListener(this);
    femaleRb.addActionListener(this);
    panel.add(fNameLbl);
    panel.add(fNameTf);
    panel.add(fNameTemp);
    panel.add(lNameLbl);
    panel.add(lNameTf);
    panel.add(lNameTemp);
    panel.add(genderLbl);
    JPanel radioPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    radioPanel.add(maleRb);
    radioPanel.add(femaleRb);
    panel.add(radioPanel);
    panel.add(temp3);
    panel.add(okBtn);
    okBtn.addActionListener(this);
    panel.add(cancelBtn);
    cancelBtn.addActionListener(this);
    panel.add(tempBtn);

    panel.setLayout(new SpringLayout());
    SpringUtilities.makeCompactGrid(panel, 4, 3, 50, 10, 80, 60);
    return panel;
}

@Override
public void actionPerformed(ActionEvent e) {
    // Be inactive until two text field verified.
}

public class MyVerifier extends InputVerifier {

    @Override
    public boolean verify(JComponent input) {
        String name = input.getName();
        if (name.equals("fntf")) {
            String text = ((JTextField) input).getText().trim();
            if (text.matches(".*\\d.*")) return false;       // Have Digit
        } else if (name.equals("lntf")) {
            String text = ((JTextField) input).getText();
            if (text.matches(".*\\d.*")) return false;
        }
        return true;
    }
}
}

Update
I try @omainegra solution and this exception occur:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Project.AddUserDialog2$MyVerifier.verify(AddUserDialog2.java:107)
at javax.swing.InputVerifier.shouldYieldFocus(InputVerifier.java:132)
at javax.swing.JComponent$1.acceptRequestFocus(JComponent.java:3589)
at java.awt.Component.isRequestFocusAccepted(Component.java:7728)
at java.awt.Component.requestFocusHelper(Component.java:7610)
at java.awt.Component.requestFocusHelper(Component.java:7603)
at java.awt.Component.requestFocus(Component.java:7411)
at javax.swing.JComponent.requestFocus(JComponent.java:1476)
at javax.swing.text.DefaultCaret.adjustFocus(DefaultCaret.java:530)
at javax.swing.text.DefaultCaret.adjustCaretAndFocus(DefaultCaret.java:503)
at javax.swing.text.DefaultCaret.mousePressed(DefaultCaret.java:492)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
at java.awt.Component.processMouseEvent(Component.java:6502)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4489)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:696)
at java.awt.EventQueue$4.run(EventQueue.java:694)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Comment: @AndrewThompson My question is that how can i do it?!
Comment: @AndrewThompson What is your mean about `edit the question into ..the question` ?
Comment: @AndrewThompson I know that how edit a post, You say that edit question title or body?
Comment: I had not noticed the edit 8 minutes ago that added a question.  That is enough.  (As to 'title/body' for question. If I see a question in a title and am editing the question, I'll turn it into a statement and repeat the question in the first line of the post body.  That is just personal preference coming through though, not an SE/SO 'rule or guideline'.)
Answer: From your code i guess public class MyVerifier is an inner class of AddUserDialog2. If so then you should be able to disable JRadioButton inside the boolean verify(JComponent input) function, at the beginning and at the end. This is the easiest solution i can think of:
public boolean verify(JComponent input) {

        maleRb.setEnabled(false);
        femaleRb.setEnabled(false);

        String name = input.getName();
        if (name.equals("fntf")) {
            String text = ((JTextField) input).getText().trim();
            if (text.matches(".*\\d.*")) return false;       // Have Digit
        } else if (name.equals("lntf")) {
            String text = ((JTextField) input).getText();
            if (text.matches(".*\\d.*")) return false;
        }

        maleRb.setEnabled(true);
        femaleRb.setEnabled(true);
        return true;
    }

But doing so, I am afraid you won't intercept the disable effect.
In your code:
fNameTf.setName("fntf");
    fNameTf.setInputVerifier(new MyVerifier());
    lNameTf = new JTextField(10);
    lNameTf.setName("lntf");
    lNameTf.setInputVerifier(new MyVerifier());
    maleRb = new JRadioButton("Male");
    maleRb.setInputVerifier(new MyVerifier());
    maleRb.setName("male");
    femaleRb = new JRadioButton("Female");
    femaleRb.setName("Female");
    femaleRb.setInputVerifier(new MyVerifier());

you don't need to create 4 objects for common input verification. Just create one and pass it to these four input object. Again, when you are passing "male" to JRadioButton it is setting it's text feild but not name. so you need to use maleRb.setName("male") and femaleRb.setName("female") and the error will disappear.
Comment: It works, But when want to select in one of radio buttons in inactive mode, the `java.lang.NullPointerException` occur.
Comment: @Sajjad Post the Stacktrace so we can see where occur the error and what is the cause
Comment: @Sajjad, I have updated the answer. Check with the current change and avoid adding input verifier to JRadioButton. It won't be necessary, I think. And if still the exception pursue, plz post the stacktrace as *@omainegra* suggested.
Comment: @omainegra I post it.
Comment: @Sage i commented them, But still that exception occur.
Comment: yes updated. check the code part i have attached at the end of my answer. It is working now as expected without any error.
Comment: ah, I have just noticed. :)
Answer: I Think the better approach is to use data binding. Check JGoodies Binding at http://www.jgoodies.com/freeware/libraries/binding/ but you can try this.
Modify your class MyVerifier adding a constructor that accept and array of JComponent. This components will be enabled if validation is true, disabled otherwise.
public class MyVerifier extends InputVerifier {
    JComponent [] components;

    public MyVerifier(){
    }

    public MyVerifier(JComponent [] components){
        this.components = components;
    }

    private void enableComponents(){
        //enable dependent components
        if (components != null){
            for (JComponent r: components){
                r.setEnabled(true);
            }
        }
    }

    private void disableComponents(){
        //disable dependent components
        if (components != null){
            for (JComponent r: components){
                r.setEnabled(false);
            }
        }
    }

    @Override
    public boolean verify(JComponent input) {
        String name = input.getName();

        if (name == null) {
            return false;
        }
        else if (name.equals("fntf")) {
            String text = ((JTextField) input).getText().trim();
            if (text.matches(".*\\d.*")){

                //disable dependent components
                disableComponents();

                return false; // Have Digit
            }
        } else if (name.equals("lntf")) {
            String text = ((JTextField) input).getText();
            if (text.matches(".*\\d.*")){
                //disable dependent components
                disableComponents();

                return false;
            }
        }

        enableComponents();

        return true;
    }
}

Then construct your validator passing the list components you want to enable or disabled depending on the result of the validation.
fNameTf.setInputVerifier(new MyVerifier(new JComponent[]{maleRb, femaleRb}));

This will work not only for JRadioButton but for any JComponent
Comment: `java.lang.NullPointerException` occur when enter a number on first text field.
Comment: Now that exception occur on `r.setEnabled(true);` line.


What is a butcher block?

Question: I had so far gathered that for a block to be called a "butcher block," the grain must be perpendicular to the surface.
I guessed that this orientation of the grain is meant for beauty. A table made with the grain in this direction would be weak in both direction.

Can you correct the terminology and/or my understanding?
Comment: Facing the end grain like that allows knife edges to pass between the wood fibers, rather than scoring them. For actual butchering it prevents chopping the fibers with a cleaver, in cutting boards it's prized for reducing drag. Most meat is prepped on easier to clean synthetic surfaces now, so you'll mainly find it used for vegetables. For decorative uses like counter and bar tops the other orientation is arguably better, because the edge grain is less absorbent and thus harder to stain.
Comment: ...yet it turns out that wood is much less hospitable to bacteria than "easier to clean" plastic, actually. https://www.nytimes.com/1993/02/10/health/wooden-cutting-boards-found-safer-than-plastic.html
Answer: "I had so far gathered that for a block to be called a "butcher block," the grain must be perpendicular to the surface".
It refers to both end grain and edge grain.
The ones for butchering or chopping typically are end grain and are more forgiving or self-healing, they will not show blade marks as readily or be as damaged by the knife/cleaver blade.
Butcher Block Wikipedia

"Butcher blocks have been used in butcher shops for centuries, and
  still are in many European countries. Increasingly, though, butcher
  block is being used in domestic kitchens as an alternative to stone
  and laminate countertops. This has created a new industry in the
  kitchen design arena and many furniture manufacturers and hardwood
  flooring companies are getting into the production of butcher blocks
  and butcher block countertops, in part because the countertops can be
  constructed from left-over wood that would otherwise be discarded."
Comment: tagging to had that my understanding is that a butcher block is generally just a table sized, more durable (longer lasting) and stable (won't move or slide) version of a cutting board. Or alternately, a cutting board is just a portable and store-able version of a butcher block.
Answer: Beauty has nothing to do with it.
It's all about function.
That example is very thin for a real Butcher Block (so it's not, IMHO), which often approximate a cube, and are intended to take some serious use in the process of meatcutting. They may be 12-18 inches thick. They are massive.

That thin slab could be made somewhat functional by putting it on a plywood substrate.
Comment: Yes, real butcher blocks for use by real butchers get serious wear. But our hard maple butcher block inset into our kitchen worktop is over twenty years old, is used to prepare at least one meal every day, and shows no wear at all.
Comment: @emrys57 but a butcher would prepare enough meat per day for 100's of meals, each day for 20 years ... a use factor much higher than yours.
Comment: @SolarMike  Totally true, but that is really the difference between "professional grade" and "home use", which is also going to be true of the respective knives. You also come across Butcher Block "style" worktops, which have relatively short lengths of timber, laid longitudinally.

What is a butcher block?


Help me identify my rough in plumbing pipes

Question: I'm wondering if anyone can help me id some rough plumbing. This is a basement bathroom rough in a 2009 New Hampshire house. I believe it was supposed to be roughed in for a toilet, single vanity and a shower. Judging by the distances from the wall and pipe sizes I'm guessing #1 is for a toilet (because it's 3 inch pipe and if the wall behind it was framed the center of the pipe would be 12 1/2 inches away), #4 is for a vanity and #5 is for a shower. #2 seems to be cover for a sewage pump. I have not found any roughed venting pipes in the ceiling so far.
What is the 3 inch pipe #3?
The sewage pump cover says Zoeller 17-0276. Does it only fit Zoeller pumps or are these universal fit?
Thank you in advance for looking at my question.
**Edit 1
I did some homework and snaked the pipes except for #5 which i didnt want to cut as the cap is glued on and it's so short. It seems they're all connected (now drawn in red on the schematic) and going to the sewage pump pit. I can see #1 is a toilet rough in after taking the silver wrap off.
Comment: The ejector pit is usually not in the bathroom so I would expect a wall, which means #2 and #3 would not be in the bathroom. #3 may be for a floor drain or laundry room sink or washing machine.
Comment: Thanks for commenting, this is a completely unfinished basement right now and I suspect you're right, the ejector pit was meant to be walled off.
Answer: If the basement bathroom requires a sewage pump, one of those pipes (quite possibly #3) will be the output of the sewage pump going up to the level of the house drain (which is presumably above the floor level, if a sewage pump pit was roughed in.) Pull the cover off the pit and poke a snake into the pipes...
Or if there's only one pipe into the pit, and the pump output would go out via the cover, it may be a vent pipe and cleanout access.
Lack of vent pipes above the concrete is fairly normal. The rough in is "put pipes before pouring concrete" rather than "prepare all for a bathroom that hasn't been put in for the next 11 years, and may never be" - pipes above the concrete are easier to add than those below.
Sump basins are pretty generic - make sure the pump you want to buy fits in the one you have, but that's pretty much physical size of pump and hole, not brand-specific. The part number is for exactly what it is - a sump cover. There will be a sump basin under it, with the plumbing run to it if it's in fact for a sewage pump. An alternate possibility (not knowing where your sewage or septic pipe leaves your house) is that the sump cover is covering "the other kind of sump" (drainage) and the bathroom plumbing goes directly to your septic or sewer pipe below floor level. Once again suggesting open it, take a look, poke a snake in the pipes and see where it comes out, or listen for it, anyway.
Comment: Thanks for answering. There is a 3 inch drain pipe on the wall to the left of the pump (looking at the picture), I now marked it on the diagram with a dotted line. The main soil stack is 25-30ft away so I'm pretty sure I need to tie the sewage into this pipe on the wall as you suggested. In any case, I will pop the cover off and report my findings. Thanks again.
Comment: I did the snaking and all the pipes, including the 3 inch #3 connect together (now red on the diagram) and then go to the pump pit (only one pipe enters). You mentioned this  means the output would go through the cover. Still not sure what #3 is for then.

And now I have a follow up question, would the output of the sump pit need to go up 8.5 feet to the 3 inch drain pipe above the pit or would I run a new pipe lower on the wall to the soil stack 48ft away (tracing the walls - I added photos of these options). Thanks.
Comment: Well, that's just ***odd*** given that your pipe 48 feet away *goes into the floor* not out the side of the wall - so why in [expletive] didn't they just put in 50 feet of 4" pipe under the concrete instead of an [expletive] ejector pit?
Comment: Pipe-wise you could do either, unless the present DFUs on the 3" pipe suggest that the new bathroom group should not join until the increase to 4" pipe before it goes into the slab.
Answer: You don't give a close up for #1 so I'm not sure what it is.  If I were to guess #3 is the toilet, and #5 is the tub/shower with #4 being the vent for the shower drain (it could also be used as a "wet vent" and be the sink drain.)  They expect you to build out a wall off the basement wall to allow for insulation, which is why those pipes are so far away from the wall.
#1 may be a below slab vent for a future radon system.
The pit and #1 are expected to be outside the boundaries of the bathroom, another wall would be build behind the toilet separating it from the ejector pit and #1.  As you enter the door (on the bottom between #3 and the future wall) the bathtub would be on you right, the toilet on your left and the sink on the left near the far wall).  The ejector pit will need a macerating pump and lines run to vent and the main sewer.
Ultimately the best best is pay a plumber for an hour of time with a camera snake and a tracer.  It will let you figure out exactly what the original plan was.r
Comment: Thanks for commenting! I added a close up for #1. The only reason I thought #1 is the toilet it's because it's a 3 inch pipe and 12.5 inches from the wall if 2x4 framing and 1/2 inch drywall were to be added (16 1/2 - 4). There is a radon pipe on the other side of the basement, already in use with a radon pump on it, maybe 25 feet away. Is it possible to have multiple radon pipes?
Comment: I think you are right, #1 is probably the toilet, since under that foil tape looks to be a toilet flange.


Find all elements of $N_{S_5}(\langle(1 2 3)\rangle)$

Question: Where $N_G(H)$ is the normalizer of $H$ in $G$ for subgroups $H$ of $G$.
I'd like to have some hints about this question.
I know that $\langle (4 5)\rangle $ is contained in the set.
How can I find other elements using basic group theory? I have seen solutions that use the alternating group but I don't understand them.
Answer: Hint: For $g\in S_5$ we have $g^{-1}(1,2,3)g=(1^g,2^g,3^g)$ (where I am using the convention of permutations acting on the right). If $g\in N_G(\langle (1,2,3)\rangle)$ then what can you say about the cyclic decomposition of $g$?
Alternative hint: you noticed $(4,5)\in N_G(\langle(1,2,3)\rangle)$. Which other transpositions are in $N_G(\langle(1,2,3)\rangle)$?
Answer: $H=<(1,2,3)>$ is a Sylow 3-subgroup of $S_5$, therefore it is conjugate to all of the other Sylow 3-subgroups in $S_5$. There are $\binom{5}{3}\cdot\frac{1}{2}=10$ such groups. The action of conjugation on $H$ by conjugation has a kernel, namely $N_G(H)$, and $|N_G(H)|\cdot 10=5!=120$. We can conclude that there are $12$ elements in $N_G(H)$.
See if the elements are $e, (1,2), (1,3), (2,3), (1,2,3), (1,3,2), (4,5), (1,2,3)(4,5), (1,3,2)(4,5), (1,2)(4,5), (1,3)(4,5), (2,3)(4,5)$.


Highcharts - Area Chart - Stacking with series containing negative and positive values

Question: We are upgrading from Highcharts 2.3.2 to current version, and we have some problems with stacked area charts. The problem is that stacking:'normal' behavior is not as expected when we have series that contain both positive and negative values.
JsFiddles:
Highcharts 2 - Desired Behavior, see chart 2
Highcharts Current - Unwanted Behavior, see chart 2
We have managed to fix this issue in charts that contain series with either only positive or only negative values, by using the stack attribute on each series (see chart 1 in second JsFiddle).
Can anyone point us to a direction on resolving this issue?
Comment: Problem illustration is available here: http://i.stack.imgur.com/s2RmJ.png
Comment: I think that it is more complicated problem of how to deal with stacked series with negative values. You can find more information about this issue in Highcharts 3.0.5v changelog: http://www.highcharts.com/documentation/changelog#3-0-5-bug-fixes
Comment: @GrzegorzBlachliński We have already tracked the fix in 3.0.5 changelog, i think you are refering to **[issue 1910](https://github.com/highslide-software/highcharts.com/issues/1910).** The problem is that this fix actually introduces bugs to our charts.. I was kind of hoping to find a way to bring back the previous functionality without having to change the way that chart series are built (ps: we own a Highcharts commercial license)
Comment: I have posted your issue on a Highcharts github: https://github.com/highcharts/highcharts/issues/5671
Comment: Thanks for posting that. I hope it can be resolved
Answer: I was able to workaround it with the help of explanation given in this stackoverflow answer, though in my workaround at June, 19 14:40 and June, 19 16:20, there is a single negative point of Con with positives before and after it. This can cause issue when you have multiple series of such kind i.e. which one to stack above the other will be a question.


Remove SeparatorInset on iOS 8 UITableView for Xcode 6 iPhone Simulator

Question: I found a weird white space on UITableView for iPhone 6 Simulator (iOS 8) on Xcode 6 GM. I have tried to set the SeparatorInset from both storyboard and also the code, but the white space is till there.
The following code works on iOS 7 but not on iOS 8 (iPhone 6 simulator).
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [tableView setSeparatorInset:UIEdgeInsetsZero];
    }
}

I attached screenshot below:

I am using AutoLayout by the way. I hope someone can show me a way to remove the weird white space on the TableView.
Comment: I got a working reference from this blog
http://datacalculation.blogspot.in/2014/10/2-steps-to-use-uitableviewcell.html
Comment: See my answer in [iOS 8 UITableView separator inset 0 not working](http://stackoverflow.com/a/33297967/616764)
Comment: This answer may help others with the same issues: http://stackoverflow.com/a/38206546/1137246
Answer: Thanks Student for pointing me to the right direction with the comment "Try this self.myTableView.layoutMargins = UIEdgeInsetsZero;" This line of code will only work on iOS 8 because layoutMargins is only available from iOS 8. If I run the same code on iOS 7, it will crash.

@property(nonatomic) UIEdgeInsets layoutMargins
Description   The default spacing to use when laying out content in the view.
Availability  iOS (8.0 and later)
Declared In   UIView.h
Reference UIView Class Reference

Below is the right answer to solve this weird white space by setting the tableview layoutMargins and cell layoutMargins as UIEdgeInsetsZero if it exists (for iOS 8). And it will not crash on iOS 7 as well.
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

    if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [tableView setSeparatorInset:UIEdgeInsetsZero];
    }

    if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [tableView setLayoutMargins:UIEdgeInsetsZero];
    }

   if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
   }
}

See the screen shot below:-
Comment: Thanks for making this compatible with iOS7 as well. Works great on iOS8
Comment: I found, to get this to work for iOS 8, I had to reload the table view in ViewDidAppear.
Comment: Works. I'd be really interested if there's a solution using appearance and rip this code out of the table implementation
Comment: I got a working reference from this blog
http://datacalculation.blogspot.in/2014/10/2-steps-to-use-uitableviewcell.html
Answer: Try to create a UITableViewCell class category and add this getter
- (UIEdgeInsets)layoutMargins {
    return UIEdgeInsetsZero;
}

in iOS7 this will not be called cos there's no this property in SDK,and will not cause any crash;
in iOS8 this will be called every time you use the cell
It works for me
Comment: This one really needs more upvotes. Works perfectly in my case.
Comment: This was the only solution that worked for when I implemented custom cells.
Comment: This worked great for me.  This is all you need to add if you have custom cells.
Comment: Simple, elegant and global solution! There is no need to add tha layoutMargin settings to each UITableView through entire project - just add a category and all will be ok. Thanks!
Answer: My solution with just three lines of code:
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)row{
    //
    // ... your code ...
    //
    if ([cell respondsToSelector:@selector(preservesSuperviewLayoutMargins)]){
        cell.layoutMargins = UIEdgeInsetsZero;
        cell.preservesSuperviewLayoutMargins = false;
    }
    return cell;
}

Answer: IOS8 introduce a new concept named Configuring Content Margins , a new property named layoutMargins is also introduced , for the details of the property , please refer to the Apple Doc . The type of layoutMargins is UIEdgeInsets , by default the value is {8,8,8,8} . To remove the seperator line of TableView in IOS8 , in addition to set tableView.seperatorInset = UIEdgeInsetsZero , you must also do as  :
First define the macro
#define isIOS8SystemVersion (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1)

In the UITableViewDelegate method add :
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
         static NSString *reuseId = @"cellReuseID" ;
         UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
         if(!cell){
             cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseId];
         if(isIOS8SystemVersion){
             cell.layoutMargins = UIEdgeInsetsZero;
             cell.preservesSuperviewLayoutMargins =NO ;
         }

    }

Doing these will remove the seperator line . You can also do as follow :
    UITableView *tableView = [[UITableView alloc] init];
    if(isIOS8SystemVersion){
         tableView.layoutMargins = UIEdgeInsetsZero ;
    }

and in the UITableViewDelegate method add :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
     static NSString *reuseId = @"cellReuseID" ;
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
     if(!cell){
         cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseId];
     if(isIOS8SystemVersion){
         cell.layoutMargins = UIEdgeInsetsZero;
     }
}

Comment: for me, cell.preservesSuperviewLayoutMargins = NO; is the key.
Answer: In my case in Xcode 6.2, in addition to Will Q's answer, I have to go to Main.storyboard > select the UITableViewCell > Attributes Inspector. Change Separator dropdown list from Default Insets to Custom Insets. Change the left inset from 15 to 0.
Answer: Workaround for iOS 7 & iOS 8
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.separatorInset = UIEdgeInsetsMake(0.0f, cell.frame.size.width, 0.0f, 0.0f);
}

Comment: This should be the correct answer. Short and sweet! :) Works 100%
Comment: None of the other answers worked for me, agree with @emotality
Comment: Agree that this is the correct answer. Also works flawlessly in iOS 9.    Other answers mix the separation line between cells with the separation lines at the end of sections
Answer: In iOS8 you have to set the Inset both on Row and on Table level.
Row level in the cellForRowAtIndexPath:
if ([cell respondsToSelector:@selector(preservesSuperviewLayoutMargins)]){
    cell.layoutMargins = UIEdgeInsetsZero;
    cell.preservesSuperviewLayoutMargins = false;
}

Table level in the viewDidLoad:
[tableReference setSeparatorInset:UIEdgeInsetsZero];

After that it is a good idea to CLEAN your project. On some occasions I noted that these changes were not directly introduced in the executable App in the simulator.
Answer: for iOS 8
try by setting  cell.layoutMargins = UIEdgeInsetsZero; in cellForRowAtIndexPath method
Comment: Try this self.myTableView.layoutMargins = UIEdgeInsetsZero;
Comment: I have tried that and like I mentioned above, this method only works on iOS 7.
Answer: If you want to remove the white line, but keep separator inset as it is, just set the cell.backgroundColor to the tableView backgroundColor. Just setting the cell.contentView.backgroundColor does not make the problem disappear.
Answer: I've tried many ways, none of them work but this one works for me.
Answer: Add startup images for iPhone 6 and Plus. Before the images are added the phone is running in scaling mode, i.e. older Apps get scaled to fit the new screen sizes. This may be causing the lines.
The new images are Retina HD 5.5 (iPhone6Plus) 1242x2208 and Retina HD 4.7 (iPhone6) 750x1334.
Comment: Actually, I am re-developing the app using XCode 6 Beta by implementing the Autolayout since a few weeks ago. So, it is practically a brand new app. Anyway, I have found the answer above. Thanks.
Answer: See iOS 8 UITableView separator inset 0 not working
Basically, you need to set both the cell.layoutMargin as well as the tableView's layoutMargin. YMMV, but I had to set the table view up in layoutSubviews before it would work!
Answer: To make your UITableView separator insets to zero for both iOS7 and iOS8, instead of making a change in the code, make a change in the xib for the UITableView by changing the View->Mode->Aspect Fill.
Comment: Could you please elaborate more your answer adding a little more description about the solution you provide?
Comment: The Content Mode flag on a UITableView is used to determine how a view lays out its content when its bounds change.  The AspectFill will fill the tableViewCell out to it which will fill out the entire view instead of the added margins that were put in for IOS8.  More information on the ContentModes can be found in the Apple docs  http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/c/tdef/UIViewContentMode
Answer: I have static UITableView and wanted to shift the margin of a cell separator to the left edge.
Thanks to the above answers, this was my solution
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
    // needed to shift the margin a specific cell to the left edge
    if indexPath.section == 3 && indexPath.row == 0 {
        cell.layoutMargins = UIEdgeInsetsZero
        cell.preservesSuperviewLayoutMargins = false
        cell.separatorInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0)
    }
}

Comment: works only wit cell.separatorInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0), thanks
Answer: Just add the following:
tableView.separatorStyle = .none


Repair grub boot settings to work with bcache on a Terra PC by Wortmann AG

Question: I wanted to try bcache, since I have a large HDD and a smaller SSD.  I followed these instructions pretty closely:
https://kloppenborg.net/blog/installing-ubuntu-20-04-with-bcache/
Hardware is a Terra PC, from Wortmann AG.
Model number: 1009512
I am able to boot from the BIOS boot menu (with the F2 key on this system), but rebooting from the OS drops to a grub shell, without the ability to see the boot partition, or even see the NVME SSD at all.  I tried running Boot-Repair, but without seeing any difference.
http://paste.ubuntu.com/p/8M9bmNq8s9/
How to I repair my system, so that can reboot from software ( from the OS's "Power Off / Log Off options in the top right of Gnome, or by issuing sudo shutdown -r on the command line ) ?
Answer: It seems that disabling "Fast boot" in the advanced BIOS settings fixes this problem.


How to synchronize method with HazelCast between two nodes?

Question: There is Spring Boot project. Project works on two nodes. I have method for send message mail with scheduler. The message is sent 2 times, since two nodes are working. How can I use HazelCast to configure the method so that it works once, only by one, more optimal node? There is very little documentation and articles on the net. I have already added HazelCast to the project, and the nodes see each other.
HazelCast.yaml:
hazelcast:
  network:
    join:
      multicast:
        enabled: true

Gradle:
    implementation group: 'com.hazelcast', name: 'hazelcast-all', version: '4.2'

ForExampleMyMethodForSendMail:
@Scheduled(cron = "0 0 9 * * ?")
public void senMail(MailDTO mailDTO) {
   mailService.sendMail(mailDTO);
}

Answer: Use Hazelcast distributed lock feature with your own code to ensure you send mail only once.
https://docs.hazelcast.com/imdg/4.2/cp-subsystem/fencedlock.html
Comment: Give me example, please!
Answer: I have created a distributed map that is visible with two nodes at the same time (this feature is provided by HazelCast). After that, I began to put the key value in this map according to the type of the name of the action and the time of the action. So the second node looked into the map, and if the action was already performed, it no longer performed it. So I solved the problem with duplicate messages.
I create distributed map:
@Configuration
public class HazelCastConfiguration {

    @Bean
    public Config hazelCastConfig() {
        return new Config();
    }

    @Bean
    public HazelcastInstance hazelcastInstance(Config hazelCastConfig) {
        return Hazelcast.newHazelcastInstance(hazelCastConfig);
    }

    @Bean
    public Map<String, LocalDateTime> timeMap(@Qualifier("hazelcastInstance") HazelcastInstance hazelcastInstance) {
        return hazelcastInstance.getMap("hazelcastTimeMap");
    }
}

And then I use AutoWired for work with map:
private Map<String, LocalDateTime> timeMap;

@AutoWired
public void setTimeMap(Map<String, LocalDateTime> timeMap) {
        this.timeMap = timeMap;
    }


Positioning divs (left-right) with CSS

Question: I'm designing people cards and I need to positionate the image on the left side and the text on the right side but I'm having issues doing it.

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}
.col-lg-3 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}
.media {
    margin: 20px 0;
    padding: 10px;
    vertical-align: middle;
    display: inline-block;
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

    Marc Demo

     HIPOACUSICOS

    firstname.lastname@example.com

I'm trying to use position, width and another properties on "left_div" and "right_div" but I'm not able to format it.
Any suggestion?
Edit: Using display: flex and align-items: center this is the result of it:

Maybe the problem are the inherited styles of other parent divs?
Thanks for reading!
Comment: add display:flex; on .media div check how flex works on this link https://www.w3schools.com/css/css3_flexbox.asp
Comment: Edited, and not working thought about the parent styles. Thanks for reply. @EdinPuzic
Comment: Try to add max-width:100% on the image.
Comment: Please share the relevant part of your general layout CSS. People that answer cannot guess what are your "parent styles"
Answer: Use display: flex on .media, then use display: block on span elements
You could also avoid to use a presentational tag (
) and use a border-bottom.
Note that if the horizontal space is not enough due to a narrow container you need to wrap the content as in my second example.

.media {
    display: flex;
    flex-flow: row wrap;
    align-items: center; /* optional */
    margin: 20px 0;
    padding: 10px;
    width: 100%;
    background: #e8e8e8; }

.media > div {
    padding: 10px; }

.media img {
    vertical-align: middle;
    max-width: 100%;
    width: 200px; }

#left_div {
    text-align: center;
    flex: 1 0 25%; }

#right_div {
    flex: 3 0 60%; }

.media span {
   display: block;
   padding: 5px 0;
   word-break: break-all;
   word-break: break-word;
   border-bottom: 1px #ccc solid; }

          Marc Demo
           HIPOACUSICOS
          email@example.com

            Marc Demo
             HIPOACUSICOS
            firstname.lastname@example.com

Comment: Edited, and not working thought about the parent styles. Thanks for reply. @Fabrizio Calderan
Comment: @adriano009 I gave you a responsive example,  see my edit
Answer: Easiest way to do this is to use flexbox.
Make the parent, .media, a flex container, and align-items: center replacing vertical-align: middle
EDIT
I've edited my answer to show 2 "profile cards" side by side. In doing so, I've changed left_div and right_div into classes instead of id, and gave left_div a 40% width.

.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

.col-lg-3 {
  position: relative;
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  display: flex;
}

.media {
  margin: 20px 0;
  padding: 10px;
  display: flex;
  align-items: center;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  background-color: #ddd;
  margin-right: 15px;
}

.left_div {
  width: 40%;
  margin-right: 15px;
}

.right_div {
  width: 60%;
}

img {
  width: 100%;
  height: auto;
}

        Marc Demo

         HIPOACUSICOS

        firstname.lastname@example.com

        Some one

         Barbar

        email@example.com

Comment: Edited, and not working thought about the parent styles. Thanks for reply. @djolf
Comment: I've edited my answer to show how to show 2 divs, and added grey background.
Answer: You can use display: flex to .media like this:
.media {
    display: flex;
    align-items: center;
    margin: 20px 0;
    padding: 10px;
    vertical-align: middle;
    display: inline-block;
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

Also as I can see data getting out of container. You can use overflow-x: auto; or changing col-lg-3 to some larger classes
Answer: Add flex to media class as below
.media {
    display: flex;
}

Comment: Edited, and not working thought about the parent styles. Thanks for reply. @PDSSandeep
Comment: Please add some text to explain your code. This site doesn't like code-only answers, and they are put on review to see if they should be deleted. In the future someone may delete it if you don't explain the answer a bit.
Answer: You could use flexbox for doing this stuff. Also, I would recommend using classes instead if id's because of css specificity

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}
.col-lg-3 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}
.media {
    margin: 20px 0;
    padding: 10px;
    display: flex;
}
.media > div{
  display: flex;
  justify-content: center;
  flex-direction: column;
}

.media .right_div{
  padding: 10px;
}

    Marc Demo

     HIPOACUSICOS

    email@example.com

Comment: Edited, and not working thought about the parent styles. Thanks for reply.  @Christophe Vanassche
Answer: You could try a few things here - difficult to get the exact styles right without the design, but you could simply add "display: flex;" to the .media rules.

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}
.col-lg-3 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}
.media {
    margin: 20px 0;
    padding: 10px;
    vertical-align: middle;
    display: inline-block;
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    display: flex;
    flex-flow: row nowrap;
}

/* You can customise the flex items here to adjust the spacing/styles etc. */
.media .left_div {
  flex: 1;
}

.media .right_div {
  flex: 1;
}

    Marc Demo

     HIPOACUSICOS

    email@example.com

I've also changed your HTML to use classes instead of IDs for left_div and right_div, as really an ID should not be used more than once on a page.
Comment: Edited, and not working thought about the parent styles. Thanks for reply. @Zach Townsend

Positioning divs (left-right) with CSS


Dynamically generated DataGrid the second click on CheckBox is not working in WPF

Question: Problem 1: I was facing well known problem with double click in dynamically generated DataGrid. I have first column with checkboxes. Two clicks were required to make the selection/deselection.
To resolve this issue I added following code.
Note: We have added Behavior class to handle everything related to DataGrid.
Solution 1:
xaml:
<DataGrid Name="MyDg" AutoGeneratedColumns="False" MouseLeftButtonUp="_MyGridRowLeftButtonUp" />

xaml.cs:

private void _MyGridRowLeftButtonUp(object sender, MouseButtonEventArgs e)
{
   if(MyDg.CurrentColumn.DisplayIndex == 0) //Making sure user clicked on first col, ignoring other cell clicks
   {
      ((MyViewModel)MyDg.SelectedItem).IsSelected = !((MyViewModel)MyDg.SelectedItem).IsSelected;
   }
}

So this solution is working and with single click I am able to select/deselect checkBoxes and underneath property is also getting set properly.
Note: Still it is not 100% perfect solution, since I am handling click on first column's cell not exactly from checkBox. If there is better solution for this then please suggest, probably I will not need following workarounds then.
Problem 2:
Since MouseLeftButtonUp event is directly on Grid, click anywhere on the grid is also processed. The real problem was if there is focus(selected) on particular cell(checkbox) and then user click anywhere else, that click is also treated as checkbox click.
Solution 2:
So I had to narrow down the clicking area/event. Hence added it only for Row, so only rowclick will be processed.
xaml:
<DataGrid Name="MyDg" AutoGeneratedColumns="False">
<DataGrid.ItemContainerStyle>

</DataGrid.ItemContainerStyle>
</DataGrid>

So this was also working fine, until I discovered the following issue.
Problem 3:
I noticed that if I click same checkbox again, then on the second click the event it not firing however on the UI you see the effect, meaning you will see checkbox selected/deselected.
Looks like when there is fresh click (focus changes) on any checkbox first time then event is firing. If you click on another checkbox which was clicked earlier, this time also it is not firing.

If I click on column header (sorting) then I guess some kind of refresh happens and then click works (again only for first time).

I have tried with PreviewMouseLeftButtonUp, which also gives same behavior. So is there any lost focus kind of event can be invoked after each click so that next click event fires for sure, or is there any other holistic solution to complete problem.
Appreciates help.
Answer: You forgot to include an example of an actual CheckBox in your question but if you use a DataGridTemplateColumn (instead of a DataGridCheckBoxColumn) and bind the IsChecked property using UpdateSourceTrigger=PropertyChanged the source property should get set immediately:
<DataGridTemplateColumn>
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <CheckBox IsChecked="{Binding IsChecked, UpdateSourceTrigger=PropertyChanged}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>


Is it possible to use class name which declare in namespace without namespace::

Question: Is it possible to use class name which declare in namespace without namespace?
I tried like this:
//MyClass.h
namespace MyNamespace {
  class MyClass;
}

class MyNamespace::MyClass {
  public:
    /* ... */
}

//MyOtherClass.cpp
#include "MyClass.h"
using namespace MyNamespace;

void MyOtherClass::MyFunction() {
  MyClass *myClass = new MyClass;
}

But it doesn't work.
Complier says "MyClass is ambiguous."
I guess this code would work :
//MyOtherClass.cpp
#include "MyClass.h"
using namespace MyNamespace;

void MyOtherClass::MyFunction() {
  MyNamespace::MyClass *myClass = new MyClass;
}

But it is uncomfortable for me.
I wanna use 'MyClass' without "MyNamespace::".
Is it possible?
Thanks for your help.
I got answer : It is not possible.
C++ classes have own default namespace. If I declare MyNamespace, then there is two namespaces associated with MyClass. If I use MyClass without choosing what namespace I want to use, Compiler feel ambiguous what namespace I really wanted to use. So it would tell me "MyClassis ambiguous."
Comment: Does the compiler tell you where the two (or more) definitions of `MyClass` are that it thinks are ambiguous?  What is `MyOtherClass`, and how is it defined?
Comment: Making a "working" [mcve] of your code I [can't replicate your problem](https://godbolt.org/z/6Xpbsm).
Comment: @1201ProgramAlarm (Sorry for poor English) I made out your word "_definitions of MyClass_" to code like `MyClass *myClass = new MyClass;` . If I am right, the answer is yes. Compiler told me `MyClass` is ambiguous with every code that use `MyClass`.
Comment: @1201ProgramAlarm About your second question, I think how `MyOtherClass` is defined is not the key of this problem.
Answer: if the below code is all in the same .h file (you did not really clarify)
//MyClass.h
namespace MyNamespace {
  class MyClass;
}

class MyNamespace::MyClass {
  public:
    /* ... */
}

Then what you are doing a forward declaration of MyNamespace::MyClass in the first part.
You should have something like this in MyClass.h
    namespace MyNamespace {
      class MyClass
      {
       public:
        // constructor, methods,...
      }; // end of class declaration
    } // end of namespace

and the associated definition in MyClass.cpp
Comment: Thanks for help, but your suggestion doesn't fit on this problem. Well, I got answer on this problem a few minutes ago. C++ classes have own default namespace. If I declare `MyNamespace`, then there is two namespaces associated with `MyClass`. If I use `MyClass` without choosing what namespace I want to use, Compiler feel ambiguous what namespace I really wanted to use. So it would tell me "`MyClass`is ambiguous." Sorry for my poor English, and Thanks for your help.


Which heroes get model upgrades at level 10?

Question: In HOTS, there are a lot of variant skins for all the heroes, but most of them are static throughout the battle.  However Dehaka regrows his arm at level 10, and Varian gains a shield, second sword, or just improves his 2-hander, to indicate which heroic talent he took.
Are there any other heroes that get model changes at level 10, either in general or just with specific skins?  Or are these two unique in that respect?
Answer: Brightwing: Gets colorful shadow effects if Blink Heal ultimate ability is chosen:

Cho'Gall: Gets a hammer if Hammer of Twilight ultimate ability is chosen as Cho:

Dehaka: As OP points out, regenerates an arm if any of ultimate abilities is chosen:

Gazlowe: Gets disks if Robo-Goblin ultimate ability is chosen:

Varian: As OP points out, wields different weaponry based on the ultimate ability chosen:

Some more info in this reddit post.
Comment: @Nae I don't know what do you mean by "look way better" except that it's centered on the desktop (and [the last one is broken](https://i.stack.imgur.com/Iwomr.png)), and it's also broken on SE app.
Comment: This is a good start.  I do not know how but could you put more images side by side, like with Varian, to make the layout shorter?  One option is replacing both images with a single, side-by-side image.
Comment: Came from your post on MSE. Actually, the problem is you're trying to center an image with NBSP (or so it seems) which usually makes things more complicated. If you remove all the NBSPs, all of the images will be side-by-side naturally.
Comment: @nae this is not centered at all on mobile and it looks pretty bad. (using mobile phone on full desktop site) - I know you are going for some sort of aesthetic choice here but it isn't working well, is it really needed?


How do I get IntelliJ to resolve Gradle dependencies for custom source sets?

Question: When IntelliJ opens a build.gradle file it will generate an IntelliJ project with the Gradle dependencies resolved and added to the project scope. This works great for the "compile" source set and the "test" source set, however I can not get this to work for custom source sets.
I want to have IntelliJ resolve the dependencies for my componentTest source set. How do I tell IntelliJ to resolve these dependencies and add them to scope?
dependencies {
    // main source set, "compile" scope in IntelliJ
    compile(group: 'com.google.guava', name: 'guava', version: '18.0')

    // test source set, "test" scope in IntelliJ
    testCompile(group: 'junit', name: 'junit', version: '4.11')

    // my custom source set, not added to any scope in IntelliJ
    componentTestCompile(group: 'org.springframework', name: 'spring', version: '3.0.7')
}

Details: IntelliJ 13.1.2, Gradle 1.11
Answer: This is described in Gradle user guide - http://www.gradle.org/docs/current/userguide/idea_plugin.html and http://www.gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html
You will need to add something like:
idea {
  module {
    scopes.TEST.plus += [ configurations.componentTestCompile ]
  }
}

to your build.gradle file.
Comment: as of gradle 3.1, I have [ configurations.testCompile ]. Thanks for the answer, though!
Comment: Thanks for adding documentation links!


extends non-API type

Question: I get this warning
<code>[ClassName] extends non-API type [SuperclassName]
</code>
The package superclass sits is visible, and the warning goes on. What does this mean, and how do we prevent this?
Comment: Perhaps add an example? What class are you extending?
Comment: Are you extending a class that is not native to java, and that you have no source for?
Answer: This seems to be a bug that is still not fixed in 2019-06. I use a usage problem filter to get rid of the warning.
Edit: If your interfaces are @ProviderType, adding @noimplement to both interfaces javadoc solves the issue.

extends non-API type


For $\triangle ABC$, prove $( \sin A + \sin B )( \sin B +\sin C )( \sin C + \sin A) > \sin A \sin B \sin C$

Question:
In $\triangle$ ABC, prove that
  $$( \sin A + \sin B )( \sin B + \sin C )( \sin C + \sin A) > \sin A \sin B \sin C$$

I have tried the formula A.M.- G.M. relation with $\sin A$, $\sin B$, and $\sin C$, but it isn't really helping. So, what is the correct proof?
Answer: Why?
As $\sin A,\sin B,\sin C>0,$
$$\dfrac{\sin A+\sin B}2\ge\sqrt{\sin A\sin B}$$
$$\implies(\sin A+\sin B)(\sin B+\sin C)(\sin C+\sin A)\ge8\sin A\sin B\sin C$$ which is definitely  $>\sin A\sin B\sin C$
Answer: As long as this triangle is Euclidean, each of the sin values is positive (or maybe 0 but that case is easy). When you multiply these factors out, you will get $\sin A \sin B \sin C+$..(other positive stuff) which is definitely greater than $\sin A \sin B \sin C$
Answer: Let the sides of the triangle be $a,b,c.$ Let $R$ be the circumradius of the triangle  We have $$0< 2 R=(\sin A)/a=(\sin B)/b=(\sin C)/c.$$ So the inequality is equivalent to $$(a+b)(b+c)(c+a)>a b c.$$
In a triangle we have $a+b>c>0$ and $b+c>a>0$ and $c+a>b>0 .$ So $(a+b)(b+c)(c+a)>c a b.$
Alternate proof: In a triangle the sines of the angles are all positive. If you expand your original LHS you have 8 positive terms and two of those terms are each equal to the RHS!


Schema error on JDBC Sink using ByteArrayConverter for key and value

Question: I'm trying to setup a simple JDBC PostgreSQL sink to copy data from one Kafka topic to my PostgreSQL instance.
I would like to simply copy bytes from one Kafka topic to one Postgres table. There should be no data conversion involved.
I'm using these converters:
key.converter=org.apache.kafka.connect.converters.ByteArrayConverter
value.converter=org.apache.kafka.connect.converters.ByteArrayConverter

The error message is very strange to me:
Sink connector 'MY_CONNECTOR' is configured with 'delete.enabled=false' and 'pk.mode=none' and therefore requires records with a non-null Struct value and non-null Struct schema, but found record at (topic='MY_TOPIC',partition=0,offset=664253924,timestamp=1602894844052) with a byte[] value and bytes value schema.
What could be the issue? Why is it asking for schema if there are only bytes involved?
Thanks.
Answer: The sink doesn't know how to unpack the byte array into your table columns.
Therefore you would need a Struct with named fields, and within you could assign bytearray values, assuming the column types are BLOB
Unclear if you need both the key and the value in the database, but easiest way to create a struct post-ByteArrayConverter would be to hoist it
"transforms": "HoistField",
"transforms.HoistField.type": "org.apache.kafka.connect.transforms.HoistField$Value",
"transforms.HoistField.field": "_c0"

Change _c0 to your actual database column name


JavaScript pdf generation library with Unicode support

Question: I want to generate a pdf file using JavaScript at client side . Firstly I tried using jsPdf API . But it does not work with Unicode character like Chinese.
Is there any  option to enhance jspdf to support Unicode  or any other library which supports Unicode .
Pdfmake API says it supports Unicode but when I tried it also does not work out, I checked in there demo example placing Unicode character .
I tried using pdfkit in Node.js but pdf is not getting created properly
var PDFDocument = require("pdfkit");
var fs = require('fs');

var doc = new PDFDocument;

doc.pipe(fs.createWriteStream('output.pdf'));

doc.fontSize(15);
doc.text('Generate PDF! 漢字漢字漢字漢字');

doc.end();

In pdf it created as Generate PDF! o"[Wo"[Wo"[Wo"[W
Also , Can I add multiple font in pdfMake
 var fontDescriptors = {
    Roboto: {
      normal: 'examples/fonts/Roboto-Regular.ttf',
      bold: 'examples/fonts/Roboto-Medium.ttf',
      italics: 'examples/fonts/Roboto-Italic.ttf',
      bolditalics: 'examples/fonts/Roboto-Italic.ttf'
    }
  };

  var printer = new pdfMakePrinter(fontDescriptors);

Comment: `Is there any option to enhance jspdf to support Unicode or any other library which supports Unicode` of course there's a way - https://github.com/MrRio/jsPDF#contributing . Its opensourced so you can contribute to it with that change
Comment: have you tried to check for issues regarding this on either of projects and create one if there is none?
Comment: I have not tried to create any new library , but trying to find if any library already exist to solve my problem .@llamerr
Answer: I'll describe a solution using Node.js and PDFKit since you mentioned it but it also applies to pdfmake which internally uses PDFKit.
Most of the time, the default font used in these libraries do not accept Chinese characters. You have to add and use fonts that are compatible for the languages you need to support. If we take pdfmake for example, they use Roboto as their default font and it indeed does not accept Chinese characters.
Using your code example, we can add support for Chinese using the Microsoft YaHei font (msyh.ttf) for instance with only 1 additional line of code:
var PDFDocument = require("pdfkit");
var fs = require('fs');

var doc = new PDFDocument;

doc.pipe(fs.createWriteStream('output.pdf'));

doc.font('fonts/msyh.ttf');
doc.fontSize(15);
doc.text('Generate PDF! 漢字漢字漢字漢字');

doc.end();

The output would look like this:
Comment: Is it necessary to font for every different Unicode type  , I just tried with Hindi Language , It requires another font . Is there any way to support all fonts or support multiple font in one ? @HiDeo
Comment: The built-ins fonts support only the WinANSI encoding so you indeed need to add fonts. The trick is you can add multiples fonts or even subsets of fonts. Since most fonts only covers a subset of the over 100 000 scripts and symbol sets of UTF-8, you need to identify exactly what you need and find 1 or multiple fonts covering your needs.
Comment: I want to support for Chinese /  German / French / English / Arabic /Latin from where I can download /get fonts ?@HiDeo
Comment: Well, I took a random font supporting Chinese in a Google search for fonts supporting Chinese in the example ^^ You'll have to check if you can find a font supporting all your needs, if not, that should be another question since it's out of the scope of the original question. You should also check [Google Noto Fonts](https://www.google.com/get/noto/) which is a font family aiming to support all languages, you can pick exactly what you need in this font.
Comment: I accept your solution , you deserve to be ! Just looking for some better solution
Comment: Can I add multiple font in pdfMake , I am trying to add noto-fonts and noto-ckj fonts together ?
Comment: Yes, if you check the documentation for pdfmake on [how to use custom fonts](https://github.com/bpampuch/pdfmake/wiki/Custom-Fonts---client-side), when you create your new `vfs_fonts.js` it'll contain all files / fonts from `examples/fonts` so you can add them here as specified.
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/117688/discussion-between-sumeet-and-hideo).
Comment: I migrated to natosans within the following font collection https://www.google.com/get/noto/
Comment: Hey guys, Did you find any solution to add noto-font and noto-ckj together ?


Putting a wildcard/regex expression in node/label restriction in Jenkins

Question: In job configuration, there is a checkbox "Restrict where this project can be run". If you select it, there is an input field about Label Expression.
Is there a way to insert of regex there, and not the exact name?
If yes, could you provide an example of this?
The whole concept behind this, is that I want to assign restrict jobs to slaves that are created automatically, with similar names
Answer: I don't believe that field can handle regular expressions, but you don't have to specify the name of the slave; you can specify a label associated with the slave.
When you create the slave, assign a label (or labels) to it.  Assign the same label to all of the slaves that are suitable for that job.  In the job, restrict it to run only on that label.  A slave that has label can run that job.
Comment: Thanks for your answer Jason. However, I am creating nodes in AWS, in an automatic way. So the names/labels are like bla-bla_uniqueID.
That's why I needed a regex, in order to throw away the uniqueID
Comment: @gandalf_the_cool - a slave can have **multiple** labels.  So you can have one be the unique ID.  And another one that is the label the jobs will target.