How do I get the full HTML table data returned with the SORT array?

Question: I have the following code that calls OBJECT adds +10 then sorts the result,
at the moment it is returning:
b b b 20
c c c 13
a a a 11
d d d 10
This is a correct sort and the values are correct. However I need the full table to be included in those results as per code snippet.

    b
    b
    b
    20

    c
    c
    c
    13

    a
    a
    a
    11

    d
    d
    d
    10

How do I get the full HTML table data returned with the SORT array? Perhaps there is a better way of doing it?

    a
    a
    a
    <object>001</object>

    b
    b
    b
    <object>10</object>

    c
    c
    c
    <object>03</object>

    d
    d
    d
    <object>0</object>

Answer: I was able to solve this entire problem with the following simple code
$(window).on('load', function() {
$(document).ready(function() {

tinysort("div",{order:"desc"});

} );
})

The Tinysort model automatically assumes 10 is greater than 2
HATS off to tinysort:)


How to find magma in Dwarf Fortress

Question: What's a good way to find magma in Dwarf Fortress v0.31.08 (or thereabouts)? (Preferably without cheating.) I know if I dig straight down I'll eventually find some, but I usually wind up breaking into an underground cave with unfriendly creatures and I'd like to avoid that. Also, I'd like it to be a little closer to the surface so I don't have to build some kind of insanely large pump stack to move the magma up to a useful level.
Should magma like this be available on most maps or is it highly dependent on embark location? Should I look 20 levels down and dig a grid? 40 levels?
Comment: Several reasons: forges and smelters built over magma don't require fuel (except in a couple cases where it's part of the recipe), magma can be used to produce obsidian, and because magma is especially good at hastening your enemies to a fiery, fiery death.
Comment: In Soviet Dwarf Fortress, the magma finds you!
Comment: Curious, why is magma desirable?
Comment: Because dwarves like to get drunk and then play with a lever linked to a magma floodgate.
Comment: See also: [Fun](http://df.magmawiki.com/index.php/Fun)
Comment: @chandsie fun: 404 not found.
Answer: Look for a volcano on the embark map - in ASCII mode it's represented by red caret character.
Answer: Magma is always available deep, but it can also be found near the surface on some maps.  Unfortunately you cannot use the site finder to find magma features in the current version.
Comment: time localized answer.
Comment: *Magma is always available deep*  can i get the figure about which z-level?

How to find magma in Dwarf Fortress


Insert fields after success payment

Question: Hope you all have a good day..
At first i have a form that user should fill before redirect to PayTabs page for payment
But i don't need the form to be inserted in database before success payment
public function index(Request $request): RedirectResponse
 {
     $response = $this->request(
         url: 'https://secure-global.paytabs.com/payment/request',
         payload: $this->transactionPayload(
             amount: 0
         )
     );

    Transaction::create([
        'paytabs_transaction_reference' => $response->json()['tran_ref'] ?? null
    ]);

    Cart::where('opened', '=', 0)->where('user_id', Auth::id())->update(['paytabs_transaction_reference' => $response->json()['tran_ref'] ?? null]);

    $cart_id = Cart::latest()->first()->id;

    $payment = new Payment;

    $payment->cart_id     = $cart_id;
    $payment->country_id  = $request->input('country_id');
    $payment->delivery_id = $request->input('delivery_id');
    $payment->address     = $request->input('address');
    $payment->street      = $request->input('street');
    $payment->home        = $request->input('home');
    $payment->email       = $request->input('email');

    $payment->save();

    return redirect()->away($response['redirect_url']);

}

public function return(Request $request): string
{
    $category = Category::all();
    $products = Product::all();

    $validSignature = $this->validateSignature($request->all());

    if ($validSignature) {
        if ($request->respStatus == 'A') {
            $transaction = Transaction::where('paytabs_transaction_reference', $request->tranRef)->first();
            $transaction->paid = true;
            $transaction->save();

            DB::table('carts')->where('user_id', Auth::id())->where('opened', 0 )->update(['opened' => 1]);

            return view('index', compact('category', 'products'))->with('success', 'Payment has been done successfully. Thank you!') . $request->respMessage;
        }
             return view('index', compact('category', 'products')) . $request->respMessage;

    } else {
        return 'Invalid  Transaction Signature';
    }
}

Here the form will be inserted even if he back from the next page
<form role="form" action="{{ route('index') }}" method="post">
        @csrf
    .......
    </form>

That's my form should be to INDEX function to redirect to payment page
Answer: You Need To Make A Validation To Your Form
Comment: Can you explain more please ?

Insert fields after success payment


How do I properly renovate the concrete floor of my balcony?

Question: I live in an apartment that can be characterized as an old soviet-era, 5-story, multi-apartment, concrete block-based building. That means, everything was built by "stroybat" a soviet-time army battalion, whose main purpose was to construct everything that was needed by commanders. This apartment building was for officers, but still, it was made without knowledge about concrete and metal usage, everywhere you can see bad usage of materials.
There is a balcony I want to renovate. It looks terrible!

I removed that strange concrete substance, as it was shattered by wear and tear. There was an asphalt board between this layer and building panel, that allowed me to remove that layer with ease.

My goals:

Remove old concrete layer from balcony floor (done)
Lay a new thin layer of concrete
Remove old paint from metal handrails, cut off oblique parts, that are hanging outside the "handrail design"
Paint with a new paint
Lay a new thin layer of gyps (or some other material), and put small rocky garden floor on it
Set up wooden cover for handrails and add some wooden flower boxes outside.

The questions are about that new layer, I want to lay:

How to set up concrete "box" (to make concrete stay in place, and stop it falling off the balcony sides), there is hardly place to connect any temporary wooden box for that, ideas?
Which concrete should I use?
How thick a metal armature will be enough for this job?
Do I need any layers between building panel and my new layer?
Do I need to clean/set up those metal parts, cover with something, to stop rust and not let the flexibility of metal handrail shatter my new layer.
How thick should that layer be, how many sacks of that stuff will I need (will give balcony area m2 later)

I will give you some real photos (later) to let you understand more precisely.
I have questions about working on that metal handrail construction, it needs much work, but I am mostly experienced with wood and indoor constructions, but that would be wrong to ask about two things in one question, will add a link later.
PS: Sorry for my english, I don't know specific construction terminology in english.

Balcony size: 319-x710 mm
Building concrete panel thikness: 90mm
From panel to balcony door sill: 140mm
Highest place, where metal feet is out of concrete panel (in picture 7): 25mm
Wire diameter of bought armature (in picture 8): ~0,9mm
Comment: @Mike Perry I would not replace handrill with wooden ones, at first - yes, local building code is strict, I will only clean and paint that metal, and will put onto hand touched (top) part of handrill with round shaped wood, that I will use to set up flower boxes too. I will measure everything and update question. Thanks for interest! :)
Comment: how thick is the (remaining) existing balcony concrete slab? What is the dimension from the sill, down to the top of the (remaining) existing balcony concrete slab? Could you easily remove the existing metal handrail & replace it with a new wooden one (if your local Building Code would allow that)?
Comment: See updates - pictures and measurements. And second, I have no money for new metal handrill, althou' it looks terrible! I will remove that roofing shale (?) that is inside metal construction (picture 1), and wield nice metal bars inside (if local authority will allow such modifications).
Comment: before I compose my answers to your questions, could you please explain what you mean by *"Lay a new thin layer of **gyps** (or some other material)"?* Also, would you be opposed to the new "concrete" screed layer being your finished balcony surface?
Comment: Current situation (in photos), you can see building concrete panel. At first, I would like to cover those metal parts, there are some armature and other stuff hanging out, and those metal handrill feet plates, at highest point, they are 25mm up from ground. When that is covered, I want to pave the balcony with small garden rocks, I have already bought them, they are flat, glued to some farbic sieve in squares. That is why I will need another layer that will hold those rocks in place.
Answer: Below is what I would do, based on my understanding of what it is you're after achieving, please let me know if I get something wrong eg Have misunderstood anything or have missed any of your questions (I believe I've covered all of them below).

From above comments: When that is covered, I want to pave the balcony with small garden rocks, I have already bought them, they are flat, glued to some farbic sieve in squares.

I'm going to assume a total thickness of 25mm (1inch) for the above material, and you know how to attach this material to the new concrete top slab. Please correct me if I'm wrong on those assumption.
I would say you want to end up with a minimum of a 50mm (2inches) step down from top of sill to finished balcony level.
Totally clear the balcony, work area (size: 710mm x 319mm)

Do I need to clean/set up those metal parts, cover with something, to stop rust and not let the flexibility of metal handrail shatter my new layer.

Prepare and clean the existing metal hand-railing:

Use a wire-brush, steel-wool, wet & dry sandpaper to remove as much flaky/loose material as possible.
Wash down everything with a mixture of warm water and washing (dish) liquid. Rinse off thoroughly with clean water. Allow to dry, then wipe down with something like White Spirit (paint thinner).
Paint (primer) everything with a rust inhibiting primer.
Then paint/spray everything with one-coat of a good quality exterior enamel.

Prepare and clean the 90mm thick balcony concrete slab:

Refer to this question here on SE for some details/information on how to go about tackling this.

How to set up concrete "box" (to make concrete stay in place, and stop it falling off the balcony sides), there is hardly place to connect any temporary wooden box for that, ideas?

Seeing as the balcony isn't that big (size: 710mm x 319mm) you could use something like, "Bar Clamps" or "Pole Clamps" (2 would be enough), to pin (clamp) some shuttering material to the outside faces of the existing balcony concrete slab (against the 2 shorter sides). This would probably be easier and safer to do from the balcony below (if your below neighbour would allow you that access).
Make sure the side shuttering has a "slight" fall on the top face (over a distance of 319mm, 10mm would be enough), so that the new concrete will slope away from the door (sill), thus allowing any water to drain away from the building.
You could then attach shuttering material along the front face via connecting it to the side shuttering pieces.

Do I need any layers between building panel and my new layer?

Paint the top face of the existing balcony concrete slab and up the face of the sill with 2 coats of bitumen paint. This will provide some protection to the existing concrete from moisture penetrating down from above.

Which concrete should I use?
  How thick should that layer be, how many sacks of that stuff will I need (will give balcony area m2 later)

If going with 50mm of less, use something like: QUIKRETE® Sand/Topping Mix
If going with 50mm of more, use something like: QUIKRETE® Crack-Resistant Concrete Mix
For your situation I think it would be best to go with the "50mm or less" option.

How thick a metal armature will be enough for this job?
  Wire diameter of bought armature (in picture 8): ~0,9mm

That will be fine, just place a single layer in the middle of the new concrete top slab you pour.
After you finish installing your "garden rock fabric" and have allowed everything to dry properly, I would:

Have a "general" clean-up of the whole balcony area.
Paint/spray a second-coat of the good quality exterior enamel onto the existing metal handrailing.

Good luck, and please let me know if you have any questions related to what I've written above.
Comment: Thanks for answer! Practically, I have no knowlage in any paving, but that can be answered later. At first, I will need to clean those metal parts, maybe with angle grinder and some dremel. Can you sugges tany "Hammerite" rust inhibitor? Should I use it for all handrill parts? Good idea about clamps, that will be easy. Any good bitumen paint materials? Should I use asphalt board, as it was used before (in sill picture)? I will make more calculations about cement material, I have two sacks with cement already (will give model/type later).
Comment: @Deele, *"At first, I will need to clean those metal parts, maybe with angle grinder and some dremel."*, go careful if you use those tools, you don't want to **"eat into"** the metal hand-railing...
Comment: @Deele, *"Should I use asphalt board, as it was used before (in sill picture)?"*, personally I would go with **"2 coats of bitumen paint"** instead.
Comment: @Deele, *"Can you sugges tany "Hammerite" rust inhibitor?"* & *"Any good bitumen paint materials?"*, I would pay a visit to your local hardware or paint "specialist" shop, either of them should be able to recommend & sell you "good" quality products.
Comment: @Deele, *"Should I use it for all handrill parts?"* after you have thoroughly prepared & cleaned the metal hand-railing I would, "Paint (primer) **everything** with a rust inhibiting primer." ie Paint **all** the metal parts of the hand-railing.


How to display multiple (100+) content blocks on a single page

Question: i have a page which comprises of multiple blocks. The blocks are like containers that have to accommodate several contents.
The contents you can imagine as say some text/sentences. These are present in the database.
Above the blocks/Containers there is a search box where I search for these contents from the database and add them to the selected blocks.
This is the UI:

The UI is fine until here. But it is really cumbersome to search an add contents like this when you have 100 of blocks/containers and more then 1000 contents.
I just wanted to request if any one can come up with a better suggestion.
EDIT :
This application is basically to design a survey app. The yellow boxes are the categories and the contents are the questions.
On this page the user is basically going to assign questions to different categories.
The Categories and other aspects are designed on another screen.
And the questions are already present in the database.
EDIT 2: This is the actual design of the page( What i failed to mention earlier). The categories(groups) i mentioned earlier are actually a part of layout which is designed on this website.
Please see the image attached...

I have modified the design as per @Alexey Kolchenko suggestion and separated the two operations of searching the question and then allotting them to the respective layouts.
But still my original question and difficulty remains. i.e. the questions will exceed more then 1000 and the layouts, groups could be nearly 100 ... so it would be really tedious for the user to allot the questions.
Note: A question could be allotted to more than one groups as well.
Comment: What are the blocks and what are the contents?  That matters to the answer.
Comment: And what is the user task? Google searches tons of content and people (mostly) are happy with it.
Comment: Please see the Edit @dan1111
Comment: Please see the Edit @Alexey Kolchenko
Comment: So even after search phase you still have 1000+ questions for a survey creation?
Comment: yes. The survey can hv 1000's of questions which are distributed over the layouts @Alexey Kolchenko
Comment: I'm still a bit confused. Does a category function as a tag? And then you need to layout questions per category?
Comment: no its not a tag.. the groups have to be decided by the user when he is designing the app. they are simply the containers on the UI. Once the app is designed the user will simply search the question and assign them to the group(container) which he wants to assign to.
Answer: It seems you try to solve two equally important tasks in one interface:

Searching for the appropriate questions, and
Assigning them to the categories.

Both tasks are important, so the interface could bring not only heavy cognitive load to a user, but slips and errors as well. It's a bad practice to eat banana and play guitar at the same time!
What I propose is to consider search task as primary for this screen and assigning to the categories as secondary one. So the working area is for search results. The result of search task is set of picked questions. If user could easy assign the category while picking – he could do it. Otherwise he could just pick the question in empty category.

You should assume also there could be good questions but categories are bed designed and could just be added or modified later. So don't restrict user in the picking nice questions at this step (it is do intended for this task)!
The amount of picked questions is displayed on the right panel.
After search task is finished, user moves to composition step, where he could assign and re-assign the question while preparing survey.
Comment: Thanks for your suggestion @Alexey Kolchenko. Please see the EDIT2


Estimate integral

Question: can you please answer the below problem:
Let $n$ be an arbitrary positive integer. If the substitution $u=1+x^{1/n}$ is made in the integral

$$\int\sqrt{1+x^{1/n}}\space dx.$$

What is the new integral?
I reach:
$u=1+x^{1/n}$, from that $x=(u-1)^n$, Then $dx=n(u-1)^{n-1}du$. Thus, $\int u^{1/2} n(u-1)^{n-1} du$
However, I couldn't go further due to the final expression is still can't be integral. So can you please help me.
Thank you,
Comment: Depending on the source, maybe the question is just asking you to carry out the substitution, so that the "answer" is the transformed integral you already have in the post. "What is the new integral" is a bit different from "what is the *value* of the new integral", at least to me.
Comment: Re-write the math expressions in a TeX format
Answer: I have a suggestion
$x^{\frac{1}{n}}=\sinh^2(u)$
so $\sqrt{1+x^{\frac{1}{n}}}=\sqrt{1+\sinh^2(u)}=\sqrt{cosh^2(u)}= \cosh(u)$
and $dx=(2n \sinh^{2n-1}(u) * (\cosh (u ))\ du$
Comment: because it will be easier to solve .after that you can return to u or x
Comment: where did you came with (sinh u)^2, there is no such sin or cos in the mentioned problem
Answer: Expand $(u-1)^{n-1}$ using binomial theorem and integrate.
Comment: how can i do that

Estimate integral


iOs - unrecognized selector sent to instance on TextAction

Question: i've some problem with this error :
ProjectName.ViewController textAction:]: unrecognized selector sent to instance 0x7fa60bc3840

The error appears when i try to create an alerte. Here is the code :
@IBAction func trySearch(sender: UIButton) {
    self.api.getUser(self.textField.text!) { isResponse in
        if (isResponse.count == 0) {
//Still crash HERE.
            let alert = UIAlertController(title: "Error", message: "This username doesn't exist", preferredStyle: UIAlertControllerStyle.Alert)
                alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
            self.presentViewController(alert, animated: true, completion: nil)
        }
        else {
            print("existing username")
        }
    }

If i comment all the alert code and replace it by a simple print it s works... I really don't understand why... Thank's !
getUser function:
func getUser(user: String, completion: ((isReponse: AnyObject) -> Void)) {

    let request = NSMutableURLRequest(URL: NSURL(string: "https://********")!)
    request.HTTPMethod = "GET"
    request.setValue("Bearer \(self.loadToken())", forHTTPHeaderField: "Authorization")

    Alamofire.request(request)
        .responseJSON { response in
            switch response.result {
            case .Success(let JSON):
                completion(isReponse: JSON)
            case .Failure(let error):
                print("Request failed with error: \(error)")
            }
        }
}

UPDATE : Same error when i click on "Done" of my TextField. + i add the getUser function.
Comment: Just a side note: By convention you should write function names in lower case `func search(sender ...`
Comment: She is in lower case in my code, just here i don't know why. Edited :)
Comment: Hey @Makaille, your code for alert in else block is perfect and it works without any issue.I couldn't understood your code part

    `response in  if response.boolValue == true {
                /* ... */
            }
            else { }`
Comment: Hello, @AvinashJadhav getUser will return me true or false if user exist or not. If my user exist i ll do some things like prepare data for an other view etc, if not i just want to create the alert. is it more clear ?
Comment: `response in if response.boolValue == true {  }` is making a single line code statement and is looking incorrect. Because  `response in if { }` looks in correct. I thinks it should be like syntax `object in objectArray`which is loop execution. So make sure about same line is correct syntactically.
Comment: Make sure response is not nil
Comment: @AvinashJadhav reponse can't be nil
Comment: in getUser(), NSURL String is not double quoted...
Comment: @AvinashJadhav edit error :) don't worry about this.
Answer: You may be in the wrong thread, since you are presenting the alert within a block, try:
dispatch_async(dispatch_get_main_queue(), { _ in
    let alert = UIAlertController(title: "Error", message: "This username doesn't exist", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
    self.presentViewController(alert, animated: true, completion: nil)
})

Comment: Why to put in asynchronous block?
Comment: @AvinashJadhav To execute it in the main thread instead of a background thread
Comment: There is no reason to force it to be synchronous, the important part is that it runs on the main queue
Comment: Hey @simpleBob, his code for alert works without any issue. I tried it on machine. I think issue may belongs to his `getUser` method call, if condition and response handling.
Comment: @AvinashJadhav if the issue really is because of the thread, you may not be able to reproduce it just by copy/pasting his code, since your code may be running on the correct thread
Answer: handler
A block to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter.
YOU don't  assign action here.
Make like this:
UIAlertAction* ok = [UIAlertAction
                 actionWithTitle:@"OK"
                 style:UIAlertActionStyleDefault
                 handler:^(UIAlertAction * action)
                 {
                     //Do some thing here
                     [view dismissViewControllerAnimated:YES completion:nil];

                 }];
// add action to your alertController

[alert addAction:ok];

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAlertAction_Class/#//apple_ref/occ/clm/UIAlertAction/actionWithTitle:style:handler:
Comment: The handler is the response of a webservice request.


Standard counterexample in Hodge decomposition

Question: I am studying Hodge theory on complex manifolds; Höring's notes (https://math.univ-cotedazur.fr/~hoering/hodge/hodge.pdf p. 87) suggest, as an exercise (4.38) and I guess as a counterexample to Hodge decomposition when our manifold is not compact, that $ \mathbb{C}$ with standard Kähler structure doesn't admit a decomposition of its first cohomology group, in symbols $H^1(\mathbb{C},\mathbb{C}) \neq H^{1,0}(\mathbb{C}) \oplus H^{0,1}(\mathbb{C})$.
But shouldn't all these groups be equal to zero?
Comment: What makes you think that $H^{1,0}(\mathbb C)=0$?
Comment: Every (smooth) $(0,1)$-form on $\Bbb C$ is $\bar\partial$-closed. Is every such form equal to $\bar\partial g$ for some smooth $g$?
Answer: Recall that, in general, $H^{p,0}(X)=H^0(X,\Omega^p_X)$. Now $\Omega_\mathbb C^1$, the co-tangent bundle, is the trivial bundle of rank $1$ on $\mathbb C$, the holomorphic sections of which are just the holomorphic functions, of which there are plenty.


What is the point of trade steering?

Question: I read a lot about trading in the ingame hints, but still cannot figure this out.
When I send a merchant to a trade node, I have the option to collect money from the node or to steer the trade "uphill" to another trade node.
What advantages do I get by trade steering? If I send someone to this trade node, is it not equally good to collect the money there right away?
Does it always make sense to steer trade between two nodes I have merchants in?
Answer: Trade steering is used for two primary purposes. To move trade from areas where you have low power to areas where you are dominant, and to move trade from a node to the node where your capital is to avoid taking a trade power penalty. Trade being pushed downstream occurs wihtout a merchant in nodes other than your capital, but you cannot change which direction trade flows downstream unless you have a merchant there.
Here is an example of a game where trade steering is useful:

In this game I have roughly 50 percent power in both the Tunis and the Sevilla nodes, but my capital is in Sevilla. Because of this, the best course is to move trade downstream from Tunis, which sends 2.5 gold out of 5 to the Sevilla trade node. In Sevilla, I can capture 50 percent of that trade and get a total of 1.25 gold from the tunis node, times my actual income modifiers. On the other hand, if I tried to collect trade in tunis, i would take a 55 percent penalty to trade power, leaving me with only around 25 percent power. That would let me collect only .66 gold times Actual income. Trade steering is twice as good here. If I had no merchant at all, my power would push trade downstream, but aragon would make that travel to genoa instead of Seville. I would lose out on ALL income.
This is what the trade map looks like with no merchant:

I get absolutely nothing from the Tunis trade node, because I have no merchant there. This is caused by Aragon steering trade toward Genoa.
While it is possible to steer trade upstream, it is virtually useless to use a merchant to do so because the trade power penalty is severe. Steer trade downstream, not upstream.
Instead, you should relocate your capital to a the node that is furthest downstream which you dominate, and then direct trade there.
Should you always steer trade to your capital? NO!
Usually you will want to direct trade downstream, but not always. You don't direct trade through nodes where other players/AI have a lot more trade power than you, especially your enemies.
One good example of a situation where directing trade would be a bad idea occurred in my most recent game as Netherlands. I had a large number of colonies in the Chesapeake bay node. However, if I directed trade downstream, it would have been collected by England or Norway, in The North Sea and London nodes between Chesapeake Bay and Antwerpen. Instead, it was better to just collect trade.
Many people will tell you that you should extract trade only at your capital. This is FALSE. Here is an example of how much you can pull out of a non-capital trade node, without investing any ideas in trade. This is more than even in my capital.

The key to note is that I control 93.5 percent trade power, even with the large penalty to trade from collecting without a capital present:

This is because the trade penalty for collecting from a non-capital node is a trade power penalty, which means if you still have a higher percent power in a non-capital node than in your capital after the penalty, you should definitely collect there
Comment: Just got into the game and your explanation really helped me understand trade!
Comment: @blindy Thanks, but I will need to update this answer for any relevant changes. I haven't had a chance to pick up WoN yet so this is just for prior to that patch
Answer: Mal's answer is correct. However the more important factor is that collecting trade is only efficient in the trade zone with your capital. If you try to collect anywhere else, your trade power in that node is reduced by between 50 and 85%.
Comment: The trade power penalty is not always 80 percent. It can range from as low as 50 to as high as 85 in my experience. I am not sure what causes the changes, but I think its based on number of nodes away from the capital.
Comment: Thank you, I fixed my answer. Not that anybody would need to read past yours.
Answer: Sending trade downstream is beneficial as more trade value is added to the trade node downstream than is send from further upstream. Therefore steering the trade as far as possible and then collecting from it is, in theory, more profitable.
Comment: In the trade map mode, hover over a trade node's outgoing symbol. You will see a line " increase outgoing value by x%" for every country that steers trade in that direction.
Comment: To clarify: The trade increases on the way when it is steered?
Answer: I think it depends on geography, I don't think that sending trade up or down itself affects your income, because up is good and down is bad or opposite. due to my small and incomplete experience of this game, u want to place your merchant in way that they transfer power (money) from one point to place where u can collect it. In my example where I play Venice, I start from Crimea, transfer it to Constantinople, then to Ragusa and from there to Venice, notice when u open trade map view u can select sending destination. At default my merchant would transfer trade from Crimea to Kiev, which then would go to Poland and I would not benefit from it.
I also think in theory longer your trade combination is more u should get in the end of the line, of course that would require number of merchants.
I am sorry if i am wrong and  did not get it right, just shearing my findings.
Respect.

What is the point of trade steering?


gparted error: libparted error --- reached the end of the file during the reading of /dev/sdX

Question: --- introduction ---
Hi,I am an Italian native speacker and so is my ubuntu, sorry for my bad English (I've spent a lot of money trying to improve it but :D, as you can see, it has been a bad investiment! :D )
The error description could be a little different from the one I've listed on the object (untranslated is "Errore libparted -- raggiunta la fine del file durante la lettura di /dev/sdX").
I am, also, a new linux user but, loving it, I decided to convert to ubuntu my home server (nas, plex, share, download, and so).
--- problem ---
I've got 3 HDs (WD RED 3.0TB). They was partitioned GPT and formatted as ext4. Then, I decided that, JBOD (linear) would be much better for my needs so I used MDADM to convert them. I made some mistakes and I've lost all the datas. I tryed to recover them but, after 2 days, i decided to use the backups to resume all. I haven't found any problem.
Now, The new Jbod 9TB partition works fine (again GPT - EXT4). I copied all my 6TB datas on it and i can read them back but, if i use GPARTED i got that error message.
It is shown three times, once for each disk so, i am quite sure it is not referred to a bad sectors or so. It is a logical problem but, due my lack of knowledge, i havn't been able to solve it, yet. Surfing on the internet i've found nothing. theoretically i could simply ignore that mistake but, as you can immagine, i would be worried to lose my partition just when i need it the most.
Thanks in advance :)
--- configuration ---
The nas config is the following:
CPU i3-2100t -MB zotac Z68itx RAM 8GB
Disks:
Velociraptor 300GB with UBUNTU SERVER 16.04 XFCE (all Linux partitions are here)
3 WD RED in linear (JBOD) shared with samba (md127__sdd - sde - sdf)
2 (WD and Seagate) 1.5 TB in Raid 1 previously set up with MDADM (md0__sdb - sdc) and works fine.
Answer: If you create a software RAID with mdadm using the "full" (/dev/sdX) device :
<code>$ sudo mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
$ cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sde[4] sdd[2] sdc[1] sdb[0]
      31431168 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_]
      [===================>.]  recovery = 96.0% (10064540/10477056) finish=0.0min speed=205145K/sec
</code>
All devices in the RAID will not have a partition table. This will lead to the gparted error, because the libparted doesn't detected the software RAID header. The "reached end of file" means, that there was no partition table found on the specified device.
It is also possible to create a software RAID on devices with a partition table (/dev/sdX1) and identical partitions sizes:
<code>$ mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
</code>
Then the gparted error message goes away. In any case, your data is save ;-)
Update
Search for used partions on all hard disk with:
<code>lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda      8:0    0   200G  0 disk
└─sda1   8:1    0   200G  0 part
sdb      8:16   0    10G  0 disk
└─md0    9:0    0    30G  0 raid5
sdc      8:32   0    10G  0 disk
└─md0    9:0    0    30G  0 raid5
sdd      8:48   0    10G  0 disk
└─md0    9:0    0    30G  0 raid5
sde      8:64   0    10G  0 disk
└─md0    9:0    0    30G  0 raid5
</code>
All your drives should be present here.
Comment: Thank you so much for the quick reply but it doesn't work.

i wrote:
"$ sudo mdadm --create /dev/md127 --level=linear /dev/sdd /dev/sde /dev/sdf"
but it replies:"mdadm: no raid-device specified".

I've also tryed to write /dev/sdd1 and so, but nothing no changed.
Comment: @Falconfab Sorry, forgot the --raid-devices=4 option...
Comment: Sorry for my delayed response. Now it says that 'cannot open /dev/sdd: device or resource busy'
Comment: use the `mount` command and check if /dev/sddX is used some were else. Be careful not to override a used device!
Comment: Ty,
no, nothing uses it. The mistake occurs even if i write the string while the sdd is unmounted. I guess that is mdadm itself that uses the resources
Comment: @Falconfab see update. It is still very strange. If the device is not mounted, it sould not be busy. Also look at the output of `dmesg` if there are some message from the /dev/sdd.


android calculate difference between constant date and now

Question: What is the best way to calculate the difference between 01.01.2013 and now so the result looks like 25 days 16 hours 18 minutes 43 seconds?
Comment: try using unix time: it is counted in seconds since 1.1.1970. so you can simply create 2 date objects and the difference of their unix-time will tell you how many seconds are between two dates. the rest is simple math.
Comment: please refer my answer for this problem [solution][1]

  [1]: http://stackoverflow.com/questions/6897027/getting-difference-between-two-dates-android/16830015#16830015
Answer: String dateStop = "01.01.2013";
long now = System.currentTimeMillis():

SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");

Date d1 = null;
Date d2 = null;
try {
     d1 = new Date (now);
     d2 = format.parse(dateStop);
} catch (ParseException e) {
     e.printStackTrace();
}

long difference = d2.getTime() - d1.getTime();
long differenceBack = difference;
differenceBack = difference / 1000;
int secs = differenceBack % 60;
differenceBack /= 60;
int mins = differenceBack % 60;
differenceBack /= 60;
int hours = differenceBack % 24;

difference is in milliseconds. Then you can simply di some math to calculate days/hours/mins/seconds
Comment: thanks that works. Now I calculate the days like long days = difference/ 24 / 3600 / 1000; But I'm that stupid that I get some negative values while trying to calculate the remaining hours o_0 Can u help please? Sorry for asking dumb questions, just woken up and can't manage anything ><
Answer: Since you have not provided any code, I am not going to just do it for you however that said time can be an interesting topic for a foray of reasons (time zones for a start).
I would suggest this great library http://joda-time.sourceforge.net/

Joda-Time provides a quality replacement for the Java date and time
  classes. The design allows for multiple calendar systems, while still
  providing a simple API. The 'default' calendar is the ISO8601 standard
  which is used by XML. The Gregorian, Julian, Buddhist, Coptic,
  Ethiopic and Islamic systems are also included, and we welcome further
  additions. Supporting classes include time zone, duration, format and
  parsing.

Look at using Periods and something along the lines
DateTime start = new DateTime(2004, 12, 25, 0, 0, 0, 0);
DateTime end = new DateTime(2006, 1, 1, 0, 0, 0, 0);

// period of 1 year and 7 days
Period period = new Period(start, end);

I used something similar to create a countdown clock, however you fail in your question to state what format (days, seconds, minutes) you want the value returned in. Period however is quite flexible on this front. For example:
// able to calculate whole days between two dates easily
Days days = Days.daysBetween(start, end);

// able to calculate whole months between two dates easily
Months months = Months.monthsBetween(start, end);


International(Uncut) version of Wolfenstein The New Order in Switzerland?

Question: As far as I know there is no law here that would forbid the use of the symbols which are forbidden in Germany and Austria. Steam says clearly that the available version is cut and just in German language.
So why can't I activate the game in Switzerland* even if there shouldn't be a reason for that? Or am I missing something that allows me to buy the game?
*maybe in other European countries too, in France e.g.?
Comment: I'd suggest you buy import a boxed version from the UK, but I don't know if these require steam or are stand-alone.
Answer: After protests of players in Switzerland and Austria, who were unhappy with the unnecessary region lock, Bethesda has now deactivated the lock in both countries. You can now activate the international version of the game on Steam with all the swastikas.
This has been confirmed in an email from the Bethesda Customer service on the Steam forum. English translation:

I understand that there is no such law in Austria and that a censored game highly limits the fun. But the problem of geo-locks should have already been solved. So you can simply go to a retailer, who sells uncensored versions, buy it there, and enjoy the uncensored fun."

This also applies to Switzerland.
Source (German):
4players.de News
Answer: Bethesda Germany is the distributor for Switzerland.  This means that, unfortunately, Switzerland is stuck with any censorship that is required by Germany.  Technically, this would apply the other way too - if Switzerland required the game to be censored, and Bethesda complied in order to allow distribution, the game would be censored in both Germany and Austria as well.
This is also the reason that the game you get in Switzerland (which is censored) is also dubbed in German (and from what I hear, has no way to change the language to another language).

Edit:  Apparently due to protests by players in Switzerland and Austria over the matter, Bethesda has decided to allow distribution/registration of the uncensored version of the game in these two countries.  See @DominicDeCoco's answer above for source links.  That said, I'm not sure if this means you can buy the uncensored game on Steam's digital store or if you have to buy the game from a different retailer - this will depend on if and when Steam updates their entries.
Answer: It is worse than not being able to activate the game. Actually you cannot launch the game even if you activated it while using another country's IP.
So right now the only version to play a proper version of Wolfenstein is to use a VPN* to login to steam using an US IP.
Or, even better, ask for a full refund to show Bethesda that this kind of Geo-lock is unacceptable.

* Using a VPN from another country is against the Steam ToS. I've never heard about people being banned for it - after all, you are not using it to get cheaper prices from antoher country - but you have been warned.
Comment: Thank you for the effort, but I don't think this provides a answer to my question. With a little research I found out, that it is nearly impossible to play the international version in Germany(as sad as it is, I know). But I don't see a reason why this Geolock affects Switzerland, couldn't read something about it.


Why won't iron golems spawn?

Question: My survival iron golem farm /

I set everything up (4 vertical blocks, 21x21 spawning platform, 4 villager cages, 16 villagers, and the killing platform down below, cleared out any doors/golems nearby), but no golems are spawning. Can someone tell me what I did wrong with my build?
Answer: I think that your doors are not considered as houses for some reasons. Have a look at Tutorials/Village mechanics for what you can change.
Answer: That arrangement of blocks is correct. and assuming you have 10+ villagers near the farm. the only thing is you should have built this in spawn chunks.
How to locate spawn chunks:
to locate spawn chunks start by dropping dirt,nether-rack or any other useless item near to point where you had spawned at start of the game and go to nether and wait 5 mins. comeback to over-world once you have waited for 5 mins. If those items have been despawned then you have found the spawn chunks.
Answer: Sunlight must be shining on the doors in order for it to be classified as a villager. Replace the blocks on top of the doors with glass or another transparent block.
Comment: that wouldnt make any sense, because a house is considered a door with anything NON opaque / transparent ontop of it. Meaning you have to provide a solid non transparent block in order for the doors to count.
Answer: You can make a golem, with one iron block on the ground, then three on the top like you'd make a wither. Then, in the middle, place a pumpkin. I hope you understood that,
Comment: Although you can make golems this way this is not what the OP wants. The question is about a golem farm to kill them for loot.
Comment: Oh, ok. I'm trying
Answer: Iron Golems can't be spawned artificially  despite having the correct amount of villagers. They only spawn at villages if a village naturally has at least 16 villagers.
Comment: I had a villager breeder down maybe 100 blocks away, and it was able to spawn iron golems just fine. The village where they came from was maybe 2000 blocks away (Nether transportation)
Comment: @MikeJ Yes but it isn't enough to just have 'villagers': Your golem farm must be **in** a 'village'. from the Wiki: *"Golems will spawn in a 16×16×6 area, centered between the 21 or more valid doors in a village if it has at least 10 villagers"*. Your farm is probably not considered a valid village.
Comment: @Robotnik agreed
Comment: *if a village naturally has at least 16 villagers*. thats wrong

Why won't iron golems spawn?


pick up spawn hindering artifacts on temple run?

Question: Does increasing the pickup spawn passive ability make it harder for artifacts to appear?
This seems quite likely to me.
Answer: The pickup spawn increase makes more items you jump for appear, and my understanding is that a fixed fraction of those are chests with artifacts.  So thus you would see more artifacts on average with the pickup spawn increased, not fewer.


Leaning against a window

Question: My bed is right up against a window. I prefer to lean against something and sit in bed while working. Is it safe for me to lean against a closed glass window? Is there any way I could fashion something that would put less stress on the window?
Comment: I think [headboards](https://en.wikipedia.org/wiki/Headboard_(furniture)) are the standard solution.
Comment: Can you just swap the head and foot of the bed and lean against whatever's at the other end?
Answer: Glass isn't very flexible and you stand a pretty good chance of breaking the glass, which could injure you directly, or allow you to fall out the window.
You didn't say how far the window is off the ground outside, but presumably you don't want to fall out the window unexpectedly amidst shards of glass that could end up sticking out of you at comically tragic angles.
You also didn't mention whether the window in question is made of plate glass (brittle, shatters easily, ends up in big pointy shards) or some kind of safety glass (specially treated, often has some kind of polycarbonate material sandwiched in the glass or coating one or both sides). Safety glass is somewhat less brittle, and tends to break into smaller, rounder pieces that won't impale you. Automobile windows are made out of safety glass.
So that's my way of saying no, I probably wouldn't make a habit of leaning on the window.
If you can't pick up an actual headboard for you bed as @Tester101 suggested, maybe you can just lie with your head at the other end of the bed and lean against whatever's on that end (a wall?). Or maybe you could screw a few wood slats across the lower half of the window and lean against those.
Answer: I'm assuming you want to preserve the view through the window?  I.e. no block it off with plywood.
I would suggest combining layers of plexiglass.  In my experience, when the various types of plexiglass break, they don't produce as sharp stab-you-through-the-ribs shards as glass.
There are two properties that you want to look for when selecting the type of plexiglass (there are many different types): Its UV resistance and its flexibility.
UV resistance is needed because the ultraviolet rays from the sun typically degrades plastic (plexiglass).  This degrading can be yellowing or making it more brittle, etc.
Flexibility is somewhat contrary to what you're probably thinking.  The harder something is the less able it is to stand up to impact loads such as you leaning back (which may not sound like a big impact, but it is an impact) and moving around.  When something can't flex, it will shatter.
I recommend a sufficiently thick (maybe double layered) piece of flexible plexiglass so that it won't bend excessively when you lean against it, but also has the ability to flex when needed.
Comment: Seems like a lot of work just to be able to sit up in bed...  ;-)

Leaning against a window


How do I set the user status (online/offline) in a Yii-2 application

Question: For this I wrote a function in the Gii generated User model which sets the 'status' field of the corresponding user table as follows
public function setStatus()
    {
     if (!\Yii::$app->user->isGuest) {
     $this->status = 1;
     }
     else {
         $this->status = 0;
     }
    }

Now in my Controller :
public function actionLogout()
    {
        $usr = new \frontend\models\User;
        $usr->setStatus();

        Yii::$app->user->logout();

        return $this->goHome();

    }

But Yii throws an error:

Cannot redeclare frontend\models\User::tableName();

I tried to echo all the autoloaded classes but the class is not autoloaded. How do I go about this?
Comment: Have you create  a new User class using Gii?
Comment: Please show your frontend\model\User, you should have a function like this: `public static function tableName()
    {
        return 'users';
    }`
Comment: Obviously it has, because gii generates it automatically.
Comment: @scaisEdge Yes, I mentioned it in my question.
Answer: As for your error, check this related question.
Most likely you defined it twice in this class, and you don't use IDE because majority of them highlight this kind of errors.
As for status - this doesn't make sense. Using Yii::$app->user->isGuest check is enough for determing if user is logged or guest. But this is not suitable for determing if user is online / offline.
As for this problem, there are similar questions asked before, check for example this question.
And finally, don't use hardcoded statuses, declare them as constants in model instead:
const STATUS_OFFLINE = 1;
const STATUS_ONLINE = 2;

Usage: self::STATUS_OFFLINE (inside of class where it's declared) or User::STATUS_OFFLINE (don't forget to include namespace in use section).
Update: Considering that user is online only because user is logged in seems not be right. But if need only calculating who is online / offline among logged in users, why you need statuses if there are only two possible options? Use is_online boolean column instead.
Comment: I mentioned constants usage because using numbers is a bad practice.


Local Storage manipulation and possible sending

Question: I am writing a webapp that utilizes localstorage. I have it setup now to save to the local storage with the following format:
Key: Four digit number
Value: My data
I need to take all the separate data from the localStorage, and output it to a single file with the following format:
XXXX <- Four digit key
Data
-linebreak-
How would I go about doing this? Also, is it possible to somehow take all this information, and send it via email. Or some way to get it out of localstorage and to clipboard so the user can copy it into their email.
Thanks ahead.
Answer: var output = "";
for(var key in localStorage) {
    output += key+"\n";
    output += localStorage[key]+"\n";
    output += "\n";
}

// output contains combined string

As for the email part you could try using a mailto: like this,

This could be combined into a function like this:
function sendLocalStorageByEmail(recipient) {
    // create localstorage string
    var output = "";
    for(var key in localStorage) {
        output += key+"\n";
        output += localStorage[key]+"\n";
        output += "\n";
    }

    // create temporary anchor to emulate mailto click in new tab
    var anchor = document.createElement("a");
    anchor.href = "mailto:"+recipient+"?subject=Local+Storage+Data&body="+encodeURIComponent(output);
    anchor.style.display = "none";
    anchor.setAttribute("target","_blank");
    anchor.appendChild(document.createTextNode(""));
    document.body.appendChild(anchor);

    if (anchor.click) {
        return anchor.click();
    }

    // some browsers (chromium/linux) have trouble with anchor.click
    var clickEv = document.createEvent("HTMLEvents");
    clickEv.initEvent("click", true, true);
    anchor.dispatchEvent(clickEv)
}

Usage:

   Send Email

Comment: Never mind, it does work.I can't type. To output that combined string into an email how would I do that?
Comment: check updated answer, I have included a function which takes care of the e-mail sending part.
Comment: Holy jesus, you are amazing. Last question. In my variables, it has foreign language characters like å ä ö , for some reason it shows up in the email field as a  �
Comment: check updated answer, I changed the function which encodes the characters from `escape` to `encodeURIComponent`
Answer: It is possible to integrate directly mail adress in the code, before mailto:
anchor.href = "mailto:*firstname.lastname@example.com*"+recipient+"?
subject=Local+Storage+Data&body="+encodeURIComponent(output);


How can I set properties on an EventHub message in a Java Function?

Question: When using C# to write an Azure Function publishing an EventHub message as the output binding one can use the Azure.Messaging.EventHubs.EventData class as the output binding and set properties on the object before handing it over to the output binding:
var eventData = new EventData(serializedTelemetryData);
eventData.Properties["eventType"] = "com.microsoft.azure.monitoring.EtlEvent";

But the Java output binding seems to only allow OutputBinding<T>, where "T is a POJO or any native Java type". Is there an equivalent of the EventData class in Java that could be used for the binding and allow to set properties?
Answer: According to the documentation you can using getProperties
https://learn.microsoft.com/en-us/java/api/com.azure.messaging.eventhubs.eventdata.getproperties?view=azure-java-stable#com-azure-messaging-eventhubs-eventdata-getproperties()
Example of Usage:
EventData eventData = new EventData(message);
eventData.getProperties().put("constant1", yourEntityHere);
eventData.getProperties().put("constant2", "ADD");

Comment: Which is great if you are sending an EventHub message from plain Java code, but I can't see how I have access to that when using a Java output binding for EventHub in an Azure Function?


How to connect Bot Framework dialog with api.ai client

Question: I'm creating a bot using Bot Framework in C#
I have this piece of code :
  var faq = await result;

  if (faq == "Faq with menu")
  {
      await context.PostAsync("Under construction");
  }
  else if (faq == "Faq with dialog")
  {
      context.Call(new FaqDialog(), this.ResumeAfterOptionDialog);
  }

Faq with dialog I have connected with a dialog class.
I want to connect Faq with menu with my client in Api.ai. Do you have any idea how to do it?
Answer: What I would do is to create an enum with the Faq values:
Public enum Faq{
 Undefined,
 Menu,
 Dialog
}

Then create a method that will call Api.ai with the user message and map the intent response to the enum:
  public T MatchAiIntent<T>(string message) where T : struct, IConvertible
    {
        if (!typeof(T).IsEnum)
        {
            throw new ArgumentException("T must be an enum type!");
        }

    T result = default(T);
    try
    {
        var response = apiAi.TextRequest(message);
        var intentName = response?.Result?.Metadata?.IntentName;

        if (intentName == null)
        {
            return result;
        }

        Enum.TryParse<T>(intentName, true, out result);

        return result;
    }
    catch (Exception exception)
    {
        //logit
        throw;
    }
}

Then you can use it in your code:
var response = MatchAiIntent(faq);
if (response == Faq.Menu)
  {
      await context.PostAsync("Under construction");
  }

Answer: [UPDATE]
CONNECTING TO Dialogflow (previously known as API.AI) FROM C#
Follow these steps (working example in C#)

After you create a Dialogflow agent go to the agent's settings --> General --> click on the Service Account link
You will be sent to to google cloud platform where you can create a service account
After you create a service account, there will be an option to create a KEY, create it and download the (JSON) format of it
This key will be used to connect from your C# project to the Dialogflow agent
Install Google.Cloud.Dialogflow.V2 package in your project
Create for example a Dialogflow manager class (check below for an example)
    public class DialogflowManager {
    private string _userID;
    private string _webRootPath;
    private string _contentRootPath;
    private string _projectId;
    private SessionsClient _sessionsClient;
    private SessionName _sessionName;

    public DialogflowManager(string userID, string webRootPath, string contentRootPath, string projectId) {

        _userID = userID;
        _webRootPath = webRootPath;
        _contentRootPath = contentRootPath;
        _projectId = projectId;
        SetEnvironmentVariable();

    }

    private void SetEnvironmentVariable() {
        try {
            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", _contentRootPath + "\\Keys\\{THE_DOWNLOADED_JSON_FILE_HERE}.json");
        } catch (ArgumentNullException) {
            throw;
        } catch (ArgumentException) {
            throw;
        } catch (SecurityException) {
            throw;
        }
    }

    private async Task CreateSession() {
        // Create client
        _sessionsClient = await SessionsClient.CreateAsync();
        // Initialize request argument(s)
        _sessionName = new SessionName(_projectId, _userID);

    }

    public async Task < QueryResult > CheckIntent(string userInput, string LanguageCode = "en") {
        await CreateSession();
        QueryInput queryInput = new QueryInput();
        var queryText = new TextInput();
        queryText.Text = userInput;
        queryText.LanguageCode = LanguageCode;
        queryInput.Text = queryText;

        // Make the request
        DetectIntentResponse response = await _sessionsClient.DetectIntentAsync(_sessionName, queryInput);
        return response.QueryResult;
    }
}

And then this can be called like this for example to get detect Intents
     DialogflowManager dialogflow = new DialogflowManager("{INSERT_USER_ID}",
    _hostingEnvironment.WebRootPath,
    _hostingEnvironment.ContentRootPath,
    "{INSERT_AGENT_ID");

var dialogflowQueryResult = await dialogflow.CheckIntent("{INSERT_USER_INPUT}");


Integrated google form in website won't open on macs but works on PCs. Error message "forms.gle refused to connect."

Question: I made a website and put a google form in it. It works flawlessly on pcs, but not on Macs or iphones for some reason. Depending on the browser it will not appear at all, or show the error message "forms.gle refused to connect." Please let me know what I should do to fix this. Thanks!
Answer: I had the same issue and it was because I used the short link for the embed.  Changing to the full link fixed it for me.
https://support.google.com/docs/thread/77815684/tried-to-fill-out-a-google-docs-forum-but-gives-me-an-error-when-i-click-on-link?hl=en&msgid=78141638


How can I stop water from coming out of the shower head even when the diverter valve is shut on the tub faucet spout?

Question: We just had the tub faucet with diverter valve spout replaced.  It is the two valve wall mounted type faucet.  Now when you open either or both faucet valves water comes out of the shower no matter whether the diverter is up or down on the spout. I pulled off the spout with diverter and put another brand new one on and the same thing happens.  What can cause this and how can I fix it?
Comment: Can you post a picture of the setup? It sounds like the diverter is somehow being connected incorrectly, which would easily cause the issue.
Comment: There are two types of shower/tub diverter--one is in the spout and the other is in the valve body inside the wall. Which do you have?
Comment: If we expect the OP to post pictures, they need enough rep to do it in the first place. As such +1
Comment: If you remove the spout from the water line and turn it on does the shower still drip?
Comment: If you take off the whole spout does water still come out of the shower?
Answer: Could be that your diverter is not closing all the way. Without a picture.....I assume the shower attaches to the tub spout. If so, the diverter is not closing all the way or the diverter may have something blocking it from closing all the way.
Comment: I have seen excessive solder cause this on sweated fittings for the type with the diverter in the spout, I am thinking that PFTE tape could also cause the problem. I would thread a nipple into the faucet if it is the screw on type or remove the spout if copper slide on type and see if water flows out the unrestricted pipe. If water still goes to the shower head there is a blockage of some type causing the water to go up.
Comment: `..see if water flows out the unrestricted pipe.` This ^


softether VPN access list not working

Question: I installed softether as VPN server on UBUNTU 12.4. nOW I add anonymous user for special range of ips.
as you see blow i created a user named 'all' :

and i created an access list to deny access from range of IPs:

Now access list not working and users can connect from all IPs.
Answer: It seems like you are creating a traffic ACL on the virtual hub at:

Manage Virtual Hub -> Manage Access Lists

This kind of rule does not restrict connections to the virtual hub.
If you want to restrict connections to the virtual hub from a particular subnet, then you need to set a rule at:

Manage Virtual Hub -> Virtual Hub Properties -> IP Address Control
List

The default rule permits access. To get the desired result, create two new rules like this:

Permit, Multiple IP Addresses, Address = 22.214.171.124, Net Mask =
255.252.0.0, Priority = 100
Deny, Multiple IP Addresses, Address = 0.0.0.0, Net Mask = 0.0.0.0, Priority = 200

softether VPN access list not working


Building an Engineer for Multiplayer

Question: What would make a good build for engineers in multiplayer. Here's what I'm using so far, let me know what you think.
To tell the truth, it feels like I don't do enough damage right now. I'm finding it hard to kill fast enough so I can stay alive. I am level 18 right now.
I got, Incinerate and Overload maxed out, both set toward AOE'ing. Recently got the Drone to the 3rd skill level, which helped me a lot as a decoy. Got Alliance training to the 5th level toward powers, and fitness to the 2nd.
I'm using the Locust I SMG. Do engineers relie on weapon a lot? Should I be aiming for an Assault Rifle or a Shotgun, and increase my cooldowns?
Thanks
Comment: @Bravo840 unlocking weapons in multiplayer will require a lot of luck/time since it only goes up by 1 rank everytime you get one in a pack, so typically you shouldn't count on having high ranks in any gun unless you play a LOT
Comment: Engineer, goin' up!
Comment: An upgraded M-8 Avenger seems to have fairly little impact on my cooldowns Maybe 8-9% slower. I think it is the lightest Assault Rifle. It is also effective at medium and long ranges but you aren't precluded from emptying it into an adjacent enemy either. I have yet to play the multiplayer though which is why this isn't part of an answer.
Answer: Paralytic's answer is pretty accurate.  As an engineer, you should not be relying on weapons but on using your tech abilities for maximum damage.  Personally my favorite is the Salarian Engineer, but the following tactics will also work great for the human engineer:

Your bread and butter damage skill will be incinerate.   You should be focusing on single target damage rather than AOE with this skill since it is especially effective against armored targets, and the tough enemies all have high armor.  Also, having high damage will let you one shot the usual minions.  A brute should die within 3-4 incinerates if you shoot him with your pistol in between recharges.
Energy Drain is an excellent survival tool, allowing you to keep your shields up when under heavy pressure.  Against mostly geth maps, this will be your primary damage dealer, you can easily mop up entire maps spamming this and causing a tech explosion with a incinerate to follow up.  I went with max damage, but if you want survivability the extra armor/shields can also come in handy.
You have the perfect tech burst combination in edrain and incinerate.  Even against fleshy enemies, edrain can stun them for several seconds, and it can set up a tech burst if you follow it up with incinerate for a lot of damage.  You don't even have to kill a target for this tech explosion to work, you just have to edrain to shock them then follow it up with a incinerate.
I found that 1 point into decoy is plenty.  With extremely fast cooldown, you can keep this up and spam powers none stop with no problem.  Decoy is an excellent skill that can draw a lot of enemy fire.  Even better, its a portable barrier.  If you are facing an geth prime with no cover nearby, putting a decoy between you and the geth prime will mean all his shots won't touch you at all.  Decoy is also great for those situations where you have to camp out in a zone for a long time.  You can easily hold an entire corridor with decoy and some tech explosions, especially against the geth.
As a skill spammer, you shouldn't be carrying around a lot of weapons.  A light machine gun and/or pistol should be all you want.  Try to keep your power recharge to as close as 200% as possible.  I go with a good pistol with the scope and damage mod for the guardians (they are the only class that can withstand your powers due to their annoying shield).  Try to head shot them with your pistol.

For human engineers, overload replaces edrain and the drone replaces the decoy, note that the drone does not draw fire, so its not as good for defense, but it can turn guardians around, which is handy.
Finally, for Quarian Engineers, don't underestimate the cryo blast + incinerate explosion combo, it is great crowd control.
My score with a salarian engineer is always the highest in the games due to him being able to handle every tough enemy with ease.
Comment: @Paralytic still not too late to go back and edit your answer :)  good formatting helps a lot for readability.
Comment: I really like the Quarian, but Cryo-blast seemed a bit weak compared to Overload. How does it do compared to the 50% upgrade against Armored for Incenate?
Comment: @Allov yea, having cryo blast means you won't have a good way of dealing with shields, which is a bummer.  For armored targets, I'd still prefer incinerate over cryo blast, but doing a cryo explosion can be quite fun.
Comment: @yx good job c: i need to stop rushing my answers and learn from you i think
Comment: @Paralytic yeah, that's why I upvoted both answer since yours was good too. Just that yx's was a bit more insightful and readable! No hard feelings, keep it up!
Comment: @Allov just to give you an idea of how godly energy drain is, my level 6 got more points than the otehr 3 combined on a geth mission just from edrain and incinerate spam
Answer: Max Incinerate and Overload. Do not use that useless combat drone, instead max everything else.
Incinerate Spec for +radius and damage over time and +50% armor damage.
Anything with Armor or Health is not happy...
Overload Spec for hit 1 enemy in 8 meters, then cooldown then Shield damage.
Because the "tazer effect" on organics makes them hit the floor, it makes them harder to shoot especially when they are behind cover. Without it they remain standing, so its easy to drill 1/4 mag from a Phaeston in their chest and move on, and having a faster cool-down is obviously good.
Training Weapon damage then Power damage +15% then weapon Damage again.
Fitness Health + shields, then Shield Recharge rate +15% then Health + Shields again.
Nothing this build can't handle, slap on a Phaeston X and go wild...
Answer: So, I roll with a human engineer most of the time, and very rarely finish as anything but the highest score, especially in silver and gold matches.  I upgraded incinerate, overload, and combat drone to the max, while putting 5 into N7 operative (or whatever it's called), and 3 into fitness.  Admittedly, this makes this build "softer" than others, but the damage output you get from abilities is absurd.  Some general things about the engineer: as many people have mentioned above, the name of the game is your abilities, and how fast you can use them.  Basically, if you don't have the Carnifex pistol yet, get it.  Now.  No excuses.  It's a headshot machine, doesn't really affect recharge time (you get %160+ recharge speed), and is generally one of the best all-around weapons in the game.  You can roll with the phalanx or the Paladin if need be, but I prefer the Carnifex as a good medium.
Now, I'm gonna assume whoever is reading this played ME1 and ME2, where the Overload ability kind of blew.  Like a lot.  However, if you take the chain lighting-type upgrades plus the upgrade that incapacitates organic enemies for a short while, the engineer becomes one of the best crowd-control classes in the game.  It stuns everyone (the first enemy hit actually falls to the ground or is staggered and takes a knee if they had shields) it hits, including those enemies the overload "jumps" too, and allows you to set up easy headshots, while none of them return fire, so important on higher difficulties, where apparently your shields are based off a butter-like substrate.
Combat drone is great for distractions (why hello, banshee, play with my friend for a while), and should be upgraded to cause massive close-quarters damage (so go for the explosion upon death and the close-range stun move), plus the rocket.  I mean, it's a friggin rocket,it does 400-some damage, has a large radius, etc.  It'll die quickly on higher difficulties, regardless of how much health/shields it has, so make it do what damage it can while it's there.  And I know people hate on the drone, but I can't stress how many times it's saved my ass on silver/gold matches.  Deals a solid chunk of damage while distracting people, thereby setting up further punishment.  And then you can keep.  On.  Spawning it...cause it's recharge time is faster than overload/incinerate.
Incinerate is great against big, boss-type enemies with armor.  Don't take the upgrade to increase radius over damage (remember, overload should be your crowd-control move), and make sure to increase damage against armor by 50% instead of the increased damage to chilled/frozen targets, which relies upon another team mate having cryo blast or someone having cyro ammo.  It's just not worth it.  Also, take the level 5 upgrade for increased damage over time, this'll make you absolutely truck those big obnoxious enemies, and is pretty much what I only use it for, due to a longer recharge time as opposed to overload.
I cannot stress how gnarly this build is, only an asari adept is as good as the engineer in my book (biotic explosions...so unfair).  Furthermore, the salarian engineer is pretty boss as well.  Energy drain = infinite shields, my friends.  However, that being said, the combat drone serves basically the same purpose as the decoy ability...except that is deals out more damage, you can spawn it at any enemy's location on the map (provided that you're locked on to them), and you don't have to deal with return fire...so clutch.
Comment: Yeah, I got myself a second Carnifex not so long ago. But, that kinda answer my question where you ARE weapon dependant, for any class. The only class I can't beat in terms of points is an Infiltrator or two biotics setting up explosions. Still, pretty nice.
Answer: I use the Engineer with a Geth SMG with a scope and a higher damage barrel.
Overload (maxed out) and the insane fire rate from the SMG makes an awesome combination, the SMG weight is VERY light so recharge is massively quick for the overload.
I use the maxed out drone to cover my back or stick it in the middle of my kill zone.
Answer: I use the human engineer. I drop my maxed drone near strategic areas to cover me. I use incinerate and overload pretty heavily. I have a geth weapon and a sniper rifle because I like to snipe through guardian mail slots and see through smoke. For banshees or brutes, I sic the drone on them as soon as possible so I can retreat and shoot from cover. Low level drones are good fodder and distractors. Maxed out drones are excellent forward guards.
I'm a RPG player not a MP gal, but sometimes I achieve 1st and 2nd place as an engineer. I've pushed my engineer once to the war front and am working up to a second level. Note: I'm only playing MP for max war assets. Otherwise, I'd avoid it.
Answer: On any Tech burst char, always pick single target power boosts over AoE. And on Incinrate Cryo combo chars like the quarian, use an SMG. The only char I'd recommend it on. They can Handel anything without shields well, and there is your shields answer. There racial 6th is even a SMG boost.

Building an Engineer for Multiplayer


What are the advantages of various bathtub materials?

Question: We're going to be putting in a new tub, and I'm not sure what to get. Cast iron? Enameled steel? Acrylic?
My concern with the cast iron (other than lugging it up the stairs) is the rust problem.
How well does acrylic hold up?
Answer: Cast iron tubs are very heavy and expensive.  Rust is not a problem with cast iron tubs as long as the enamel top layer is intact (if you get a chip in it, you can get enamel repair kits).  My wife did not like the old cast iron tub in our bathroom because it was cold when standing in it during a shower and made bath water get cold fast.  Evidently she was not taking baths in the "cast iron method" which is to put super-hot water into the bathtub and allow the heat to transfer into the tub, this will cool the water down but keep it at a reasonable temperature longer (in theory at least, YMMV).
Enameled steel it basically a cheaper version of the cast iron, it is a lighter because the metal is much thinner. I doubt the "hot bath trick" described above for cast iron tubs will work in a steel tub.  Like cast iron tubs, you should not have to worry about a steel tub rusting or cracking.
Acrylic (plastic) tubs come in a different quality levels.  Some are really cheap, thin plastic that have the potential to crack over time (particularly if they are poorly supported/improperly installed).  However some acrylic tubs use thicker stronger plastic (often with fiber glass embedded for tensile strength) that are very sturdy.
I recently had to make this decision; we replaced our cast iron tub with plastic Kohler model.  I knew I did not want to lug a cast iron tub up to the 2nd story.  I thought about a steel tub but they are still 120-150 pounds.  I was worried about getting a cheap plastic one that would break so I settled on a $700 plastic Kohler tub that is pretty thick.
Answer: Fiberglass
Pros:

Cheap
Light
Easy to install
Many shapes and colors

Cons:

Least durable
Easily scratched
Prone to fading.

Acrylic
Pros:

Cheap
High gloss finish that lasts
Good insulator, keeps water warm
Easy to clean
Durable
Scratches can be repaired
Many shapes and colors

Cons:

Susceptible to scrathes

Porcelain on Steel
Pros:

Resistant to acid, corrosion, and abrasions
Easy to clean
Resists fading

Cons:

Can be damaged by impact
Surface may chip and rust
Can be noisy
Heavy

Cast Iron
Pros:

Long lasting
Resists damage

Cons:

Heavy
Expensive
Limited shapes
Susceptable to rust

Further Reading

Bathtub Materials Comparison
Buying Guide: Bathtub
Bathtubs Buying Guide
Answer: Cast iron is the most desirable for a bath tub.  It's withstood the test of time for centuries.  Enameled steel has a cheap drumming sound to it.  Americast (an American Standard acrylic product) is far better than those cheap fiberglass tubs, but also chips.  Fiberglass flexes and, unless you've bought the entire wall kit (which is cheezy), will continue to give you fits where the tub perimeter meets the tile.  There's always trade offs.
If it's your forever house, I'd do the cast iron.  Of the lot, it has the most durable finish and, unless you're prone to drop hammers in it, will probably outlast you.  Usually a cast iron tub fails - not because of the material - but due to improper installation, using harsh cleaning products on the surfaces, or damage from impact.  All other materials will meet the same fate.


Different images when Zoom In and Zoom Out

Question: I wanted a zoom functionality where in when i doublclick on an image it should go inside the image
For Eg:
I have an image of a bike.. If i double click on the tyre, it should show the tyre.. And if I double click on the tube of the tyre, it should show the tube..
I'm basically using this to display the parts and its price in my website. Something like a Catalogue.
Is this possible only in Flash??
Or is there any framework that i can use to do this??
Can we do this using css3??
Comment: yes in flash it is possible if you have core knowledge of action script. Beside that the dblclick and zoom effect also possible in html with jquery, again condition is you should have a good knowledge of HTML and jquery.
Answer: you can do that with jquery
See 28 jQuery Zoom Plugins Creating Stunning Image Effects
http://www.tripwiremagazine.com/2011/10/jquery-zoom.html
http://www.tripwiremagazine.com/2011/10/jquery-image-zoom.html
You can pick the one you like
Comment: i was asking for this functionality.. check this link.. http://static.flabber.net/files/scale-of-the-universe-2.swf


How to make PCL Library and Python-pcl run on Ubuntu 18.04.2?

Question: I am trying to install PCL Library following mainly these instructions also comparabel to this topic, but I used 1.9.1 and want to connect by the python-pcl bindings.. Small test is working completely.

I was not able to finde the location of the "Test pcl_viewer"-section. Where to find this?
I am not sure of the "Cloud Viewer"-section. Do I need to install that? Where to put the Make and CPP file?
How to fix the error from a test in python3  :

ImportError: libpcl_keypoints.so.1.7: cannot open shared object file: No such file or directory

Any help is appreciated.
Answer: Try this version I back-ported from disco (using libpcl 1.8.1 from the Ubuntu repo):
sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl

After you've done that then you should be able to run:
python3 -c 'import pcl'

and it will return with no error (as opposed to ModuleNotFoundError: No module named 'pcl').
Comment: I don't think python3-pcl is available in conda, so you would probably need to build it from source.
Comment: This works great in a regular environment, but fails in Conda. Any suggestions?
Comment: Thanks for the response! I researched it more and you aren't able to access packages installed with apt from a conda environment. I ended up using Open3D, which had more than enough functionality and was easy to install with pip and conda.
Comment: Well, you could always try adding /usr/lib/python3/dist-packages/ to the python path in conda - but there's no guarantee that it would be binary-compatible with the conda python.  I generally prefer to use the OS-python over other python environments, but I love conda for Windows builds :)


Is a word with symbols on the right side a hash key?

Question: In
before_action :find_item, only: [:show, :edit, :update, :destroy]

link_to "Delete", item_path(@item), method: :delete, data: { confirm: "Are you sure?"}

I'm not sure what the words with a symbol on the right side:
only: ...

method: ..., data: ...

represents. I understand that these are parameters of the methods, but if these were hash keys, I don't know why there aren't any curly braces.
Answer: When you use a hash as the last argument for a method, Ruby allows you to omit curly braces which makes argument lists look a lot nicer. Those calls translates to
before_action(:find_item, {only: [:show, :edit, :update, :destroy]})

<%= link_to("Delete", item_path(@item), {method: :delete, data: { confirm: "Are you sure?"}}) %>

Comment: Indeed. You could use the standard hash notation (`:only => [...]`)  to make it even clearer.
Answer: the words with : before the word are just symbols
those that have it after are the symbol with a value
method: :delete

in this example the method has the value of an (empty) symbol :delete
it would be equivalent to writing it as { :method => :delete }


Add a space every two characters in R

Question: I have phone numbers in the form of:
0123456789

and I'd like to make them look like
01 23 45 67 89

So far, adding a zero is no big deal with the paste0 function, but I'd like something a bit simpler than a long chain of nested paste0 and substr. Something might be possible with a regex reading every two digits, but I don't see how to make it happen.
Comment: How come you want to get `01` if you have `1` at the start? Do you mean you need to check if the string contains an even number of digits, and if not, prepend the value with `0` and then insert spaces?
Comment: @WiktorStribiżew I think the OP incorrectly entered the test string.  I've updated with what I think was the intention.
Comment: @TimBiegeleisen Ok, but what is the expected behavior for `123456789`?
Comment: All my numbers have nine digits. After adding the first zero with `paste0('0', x)`, I'd like to insert a space between every two digits.
Answer: You can replace the regex expression (.{2}) with \\1.  Note that there is also a trailing whitespace problem, since we don't want to add an extraneous extra space at the end of the string for inputs with an even quantity of digits.  To handle this, we can just remove trailing whitespace from our replaced string.
x <- '0123456789'
y <- sub("\\s+$", "", gsub('(.{2})', '\\1 ', x))
y
[1] "01 23 45 67 89"

Demo
Comment: What whitespace are you talking about :) ?
Comment: @WiktorStribiżew If we replace every two characters by those characters with a post-appended space, then we hose ourselves for the final 2 characters (unless we want a dangling space at the end).  I wish R had a nicer string trim function like Java, Python, and other languages.  Alas, I used an ugly second call to `sub()` to handle this.
Comment: R has a `trimws` function. But there is no whitespace in the input, thus, there won't be any whitespace at the end after replacing with `gsub('(.{2})', '\\1 ', x)`
Answer: Without regex:
x <- "0123456789"
formatC(as.numeric(x), big.mark = " ", big.interval = 2,
        format = "d", flag = "0", width = nchar(x))
#[1] "01 23 45 67 89"

Comment: Interesting solution! What does the `flag` parameter stand for? I find the R Documentation quite unclear (https://www.rdocumentation.org/packages/base/versions/3.4.0/topics/formatC)
Comment: It's a format modifier and `"0"` indicates padding (to the given width) with leading zeros.
Answer: This is a bit package-heavy solution than Tim's but you can do something like this with dplyr and stringr
library(dplyr)
library(stringr)
original_string %>%
  paste0(0, .) %>% # add 0 to the head
  str_replace_all("(.{2})", "\\1 ") %>% # insert spaces after every to digits
  str_trim() # remove the space in the end if it's there

Add a space every two characters in R


undo action and submit form

Question: I have a form where there is also the possibility to manage N files PDF. These files could be uploaded and, obviously, deleted.
For upload, I have a ajax uploading (when you choose a file, the file is automatically uploaded. During the process you could do other things or uploads other files).

download bmml source – Wireframes created with Balsamiq Mockups
On the icon hover, there is the "X" button in order to delete the file.
In order to prevent accidentally deletions, I thought to do a "undo" flow.

download bmml source
The file will be deleted on form submit.
At this point I have some doubt:

It's a good choice to do an automatic upload (no need to submit form) but for deletion no? (you need to submit the form)
if yes, What's the best terminology for indicate the user that he have to submit the form in order to complete deletion? I have no too much space. I thought "file will be deleted on submit". But "submit" is not a clear word, and more explicative phrases are too large.
Comment: Question: from user POV if they won't submit the form then they won't confirm upload, right?
Comment: Who knows what the users wants? :) I think it's rare, in this context, that the user want to leave the page without save. But if it happens, it's unpredictable to know if he wants leave the files or delete them. Uploading a file is a "complex" operation (click the button, navigate to folders, choose the file), maybe it's reasonable to think that if he completes all the steps for doing it, then he really wants to confirm the upload.
Comment: Hmmmm I'm not sure, unless you want to keep a _pending upload_. Think if, for example, in Facebook you cancel images upload. Users (well...I) expect everything is canceled if they don't confirm an operation. In this case it doesn't matter when you effectively delete already uploaded files.
Comment: a pending upload could be a choice (as I said http://ux.stackexchange.com/questions/84788/undo-action-and-submit-form#comment135229_84795)
Answer: Automatic uploading and deletion are consistent, no explicit submitting in both the actions.
A possible solution for final delete could be as pictured:

Focus user's attention on the deleted item (transition/color)
Display the Undo control for some time (5 s)
Delete the item and fade out the Undo control if no actions were took
Comment: At this point I'm wondering if it's more simple to do the reverse thing: force the submit form in order to "finalize" the file uploaded. (maybe placing the file in a tmp folder and move it on submit).
Answer: If upload is possible without Submit, then deletion should be too. You can mark the files for deletion on the server, e.g. by setting up a deletion callback that will run after 1 minute unless it will be undone... Or move the file to to-be-deleted folder on deletion and move it back on undo + make sure to garbage collect files older than 1 day or whatever is right for your use case.
Answer: Instead of undoing the deletion, you may "flip" the file icon with a "click to confirm deletion" icon (or message).
Comment: Welcome to UX.stackexchange. If you can please elaborate on your answer.

undo action and submit form


Define global variable with Typescript Angularjs in components

Question: My application uses components and boostrapper. I want to create a datepicker which will set a global date variable. I have tried to create a service, use the rootscope and basically all the solutions I could find on stackoverflow but it doesn't seem to work.
What would be the correct approach to create a global variable shared across all components?
Answer: It's generally not a great idea to use a global variable to store state like this, as it's hard to track what is mutating it.
Assuming Angular 1.x, to share information like this, you can simply create a service which stores whatever data you are tracking. I'll add the disclaimer here that state management in web apps is still a tricky problem. You could go for a Redux styled approach, but I'll keep it basic for now.
<code>angular
  .module('app', [])
  .controller('testController', function(testService) {
    console.log(testService.getDate());
  });

angular.module('app')
  .service('testService', function() {
    var date = new Date();

    function getDate() {
      return date;
    }

    function setDate(newDate) {
      date = newDate;
    }
});
</code>
This way, you have an interface to read/mutate the date. You can inject it into as many controllers/components as you like.
Hope that helps (I'm aware the answer isn't in Typescript, but I assume since the problem has a basic solution, it doesn't matter too much - if you want a Typescript answer, let me know and I'll change it for you :) ).


Total count is not added into existing List

Question: I am using spring boot with Rest API in java. I have try to get All Event List between startDate and endDate and order By startDate but from each date only 6 record get not more. if each date of record is > 6 then i want to add count into that particular date of record.
Suppose in this month date wise -n no. of event is there. But i want only six record every date not more record is require if more record is available then i want to add total count of that Date of record. In this eventsListTwoDates object i have got List of All Events.
I have got each date of 6 record from eventsListTwoDates list but count is not added if that each date of record is > 6.
1.JPA custom Query
  @Query("SELECT new com.techavidus.networkingPhoniex.model.Events(e.id, e.eventImg , e.multipleDays , e.startDate, e.endDate, e.startTime, e.endTime, e.eventStatus, e.paid, e.fee, e.passportTickets, e.location, e.city, e.myFavourite, e.remainingTickets, e.eventName, e.passport, e.typesOfEvents, e.eventPassportOptions, e.promoCode, e.subTitle, e.expectedAttendance)" +
            " from Events e WHERE e.startDate BETWEEN :startDate AND :endDate AND e.endDate BETWEEN :startDate AND :endDate ORDER BY e.startDate")
    List<Events> findAllListOfEventsWithoutEventTypeIdWithOnlyTwoDateTest(String startDate, String endDate);

Code

public GenericResponse getListEvent()
{
   List<Events> eventsListTwoDates = eventsDao.findAllListOfEventsWithoutEventTypeIdWithOnlyTwoDateTest(firstMondayCurrentMonth, lastDateCurrentMonth);
   Events events = new Events();
   List<Events> eventsList = new ArrayList<>();
   for (int i=0; i<eventsListTwoDates.size(); i++){
       int count = 1;
       for (int j=i+1; j<eventsListTwoDates.size(); j++) {
          if (eventsListTwoDates.get(i).getStartDate().equals(eventsListTwoDates.get(j).getStartDate())){
              count++;
          }
       }
       if (count<=6) {
          events.setCount(count);
          eventsList.add(i,events);
          eventsList.add(eventsListTwoDates.get(i));
          System.out.println(count + " : " +eventsListTwoDates.get(i).getStartDate());
       }
   }
     return APIResponseBuilder.build(true, eventsList, commonMessages.findAllTrue);
}

Answer: It seems like you're never actually returning count at all so that might be why you don't have it available. Also, with date assessment, it's usual for me to forget to take into account the time portion, so some date functions aren't assessed properly and we get bugs like this one.
I would debug your code slowly just to be sure of what your function does. Also, don't you want to be looping through each date range, instead of the whole list twice? You can use the Calendar/LocalDateTime classes to get a count quite easily.
Comment: Here i have a using Date without time
Comment: is there a reason you're looping through the same list of events twice? I still can't see where you're adding `count` to the result. Don't you need to add `events.setCount(count);` to the list, if it is > 6?
Comment: yes because i have compare that list with same startDate field which is match then tahat count is increase for that Date
Comment: if it is >6 then i want to require to add count. it is inform to further API call\


react-native-iap getProducts return empty array

Question: I'am using react-native-iap for in-app purchase. But the getProducts method return empty array. Below is what I did for it.

insert billing permission in AndroidManifest.xml like

<uses-permission android:name="com.android.vending.BILLING" />

upload this android app AAB to alpha version and didn't release it.
create product with id productid1 and productid2. productid1 is active apk and productid2 is inactive.
make following code

import * as RNIap from 'react-native-iap';

const itemSkus = Platform.select({
  ios: ['productid1', 'productid2'],
  android: ['productid1', 'productid2'],
});

...
componentDidMount() {
  RNIap.initConnection().then(conn => {
    // conn is true
    RNIap.getProducts(itemSkus)
      .then(res => {
        // res is []
      })
      .catch(err => {
        // no err
      });
  });
}
...

As like comment of getProducts always returns null by hyochan on 4 May 2018, should I wait for the products to update? or is there any problem on my code? or anything?
My environment is

react-native: "0.60.5"
react-native-iap: "^4.3.3"
Comment: for me once it took 1 hour and for another it took 1 day
Comment: when have you added the products?
Comment: @GauravRoy I added the products 2~3 hours ago.
Comment: wait till tommorow, and if still not there. then check again , coz its christmas time, and it may take time
Comment: @GauravRoy So, there is any way to check the product is registered? or just wait for it?
Comment: @GauravRoy I still receive the empty array(3 days passed). Do I have to release the app in Alpha test?
Comment: so there must be an error, https://medium.com/@abhayg772/implementing-in-app-purchase-in-react-native-application-3798ca2de5bb this article once
Answer: For those facing this issue with iOS, make sure you finalise the agreements and tax, then make sure to copy and paste this pod 'RNIap', :path => '../node_modules/react-native-iap' into the pod file, then cd ios && pod install && cd ..(run terminal commands from the application directory).
I had this issue and it turns out I'd skipped these very important steps.


Does the Larder Door work with the Two Weapon Style talent?

Question: The Larder Door is a pretty rad shield; it has solid stats, and more importantly, grants Bash, which allows it to be used as a weapon:

(Note that there is a second weapon displayed on the side there - Eder currently has a Flail and the Larder Door equipped.)
What's not clear to me however, is how this interacts with the Two Weapon Style talent. (Or, for that matter the Weapon And Shield Talent).
Does it?
Answer: There are two parts of the question, let me start with the easier one - Weapon and Shield Talent. After experimenting it seems that this talent works as advertised with Larder Door as a shield - bonus deflection is added and it does apply to reflex as well.
Now for Two Weapon Style. That one is harder, largely because the game does not provide an interface option to tell how fast an attack is. However I can bypass that through cunning use of cheat tables in CheatEngine.
Two Weapon Style talent modifies property called DualWieldAttackSpeedMultiplier. Every character has it at 1, when the talent is taken it is increased to 1.2. Since that's not very noticeable I volounteered to increase it to 20 just to see what happens. Character wielding normal two weapons was attacking like crazy - and character with a weapon and Larder Shield didn't change it's attack speed (still using normal AttackSpeedMultiplier property).
Therefore Two Weapon Style talent does NOT work with that shield.
As a bonus - Quality enchantments do not increase the damage Larder Door does.


C# question - how do I convert a PageURI & Href to an absolute URL/URI?

Question: How do I convert a PageURI & Href to an absolute URL/URI in C#?
i.e. I am scanning a web page at a given PageURI and in the HTML have link/node with a HREF, and want to translate this HREF into a valid absolute URI.
Background - note the trouble I was having here
Comment: So you're looking for the standard way of getting an absolute URL in C# without using System.Uri?
Comment: oh...I see my mixup...shouldn't have really had to ask about this :(
Answer: new URI(uri, string) does it


What is purpose of the slot at the base of my drill's handle?

Question: The photo below shows a drill I own; there is a slot at the base of the handle.  Is this simply to hang things from, or does it serve another purpose?
Drill is a DeWalt model DWD210G.
Comment: Assuming this is a DWD210G, the manual makes no mention of the slot. It may be an alignment tab turned into a design feature.
Comment: It may be there as a security feature so the tool can be used as a demo unit. I can't think of anything else besides that though.
Comment: Yes, I suspect that's provision for a strap or lanyard.
Comment: @TXTurner - It is, indeed, a DWD210G; I also found no mention of it in the manual, which is why I came here.  :-)
Comment: I'm curious why you were asking... If you can get something through there, I'm sure you could use it for a lanyard/hang strap of some sort. If you were wondering where to attach the chuck key, that goes with the black rubber strap which then goes around the power cord, preferably near the plug to remind you to _unplug_ the drill _before_ removing the bit from the chuck so that you don't accidentally drill into your hand by hitting the trigger.
Answer: The slot is for a securing strap or this Dewalt brand Drill key-Chuck keeper:

Adding some pics to show how it attaches to the drill and the chuck key:
Comment: You secure the chuck key keeper to the power cord, preferably near the plug to remind you to unplug the drill before releasing the bit. If you attached the keeper to the base of the handle, the chuck key would never get anywhere near close enough to the chuck to be useful.
Comment: If it's for the chuck, how does the chuck reach the hole?
Comment: I agree with FreeMan, its not the best place to mount the key,  plus you'd have to detach it to use it each time.  However, the OP's original question was simply what is the slot for, which this answers concisely with pics from the vendor of the product itself.  ;)
Comment: Its prob not in the documentation cause it was a stupid design, that was abandoned.  I don't think they even come with the key-keeper rubber piece  anymore...  its a pretty thin slot to get any kind of lanyard through too...
Comment: LOL just noticed the chuck key holder and rubber strap was in the OPs original picture....
Answer: I think Tyler Durden is correct. Have a look at the D25013K model; there are 4 similar holes on either side, with a separate lanyard attachment point. For what reason other than air circulation would you add such holes? Seeing that they also let contaminants in, there must be a good reason beyond good looks for placing them there (maybe the trigger switch units heat up?).
Comment: The hole does not expose the insides; if it was for ventilation, the interior would be exposed to vent hot air
Comment: @JoshDM: Look at the schematics in the link, as well as the schematics for the drill in the OP's post. Both are through holes to the inside of the handle. There is also a second hole further back missing from the OP's picture.
Answer: It's probably to put a carry strap through
Answer: It is for ventilation and cooling.
Comment: I'd say the slots near the back of the motor body are for ventilation, but the slot at the base of the grip is probably not.
Comment: Citation needed?