Does Kinzie ever use her safe word ingame in Saints Row?

Question: So Kinzie Kensington mentions in the introduction dialogue for the mission in which you free Zimos that her safe word is "Teacup". I checked the wiki, and the only mention is in her banter with Tanya between missions, after the latter told her she would be a major draw at a brothel.
Is this the only time she uses her safe word, or does she use it at other times as well? I sort-of remember her using it in my playthroughs, and I didn't really bother with homies.
Comment: She doesn't use it in Gat Out of Hell.
Comment: My personal experience indicates no. I haven't played SR4.
Answer: I extracted and listened to all of Kinzie's dialog, and while she has a lot of it (752 clips), there aren't too many uses of her safe word. Which would mean it is likely a good safe word as it isn't something she says in ever day conversation. Below are references to her safe word.
Kinzie

In conversation with Tanya about the brothel
As a reaction, likely to surprise or injury or something

Someday we should probably name this ship.  I've been giving it a lot of thought and I think we need a name that confuses our enemies by seeming innocuous to the uninformed.  That's why I'd vote for Tea Cup.

Others

"Hello Teacup" is the name of the mission where you find Kinzie
Comment: Thanks for the effort. If noone else gives an answer, I'll accept this one by tomorrow.
Answer: In Gat out of Hell, Kinzie does actually use her safe word a couple of times, but it's a random response spawn in each action, triggered by different events...
Easy Kill
"Should've said 'teacup'."
Burn or Explosion Damage
"Teacup!  Teacup!"
Kinzie has to be one of my favourite homies, and touches like that are a lot of fun in GOOH. I'd also point out that you get a very different reaction from the twins (Kiki & Viola) if you approach them with Kinzie, as Kinzie and Viola (as it happens) have bonded between SRTT and SRIV.


Azure Webjobs History

Question: I'm trying to build a webpage where I need to show the webjob's history filtered by the date.
Based on the information provided by the Webjobs API, I made a call to https:// {sitename}.scm.azurewebsites.net/api/triggeredwebjobs/{job name}/history which returned only the top 50 results.
Is there an another way to retrieve history data based on a specific date.
Answer: It only returns 50 results because that is all it saves by default. If you want to change this, you can set the WEBJOBS_HISTORY_SIZE App Setting to a high value in the Azure Portal.

Azure Webjobs History


php myadmin sql 1064 error on the trigger

Question: I have tried to upload the following sql command to the php myadmin. But, I have took some interesting error. I have tried to solve it but even if I think carefully, I could not find the why the error arises.
Error :
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your  MySQL server version for the right syntax to use near 'ON car_model
FOR INSERT
AS
    declare @car_name VARCHAR(255)' at line 2

SQL :
CREATE TRIGGER TRG_Update
ON car_model
FOR INSERT
AS
        DECLARE @car_name VARCHAR(255);
        DECLARE @manufacturer_year VARCHAR(255);
        DECLARE @car_type  VARCHAR(255);

        SELECT @car_name = i.car_name FROM inserted i;
        SELECT @manufacturer_year = i.manufacturer_year FROM inserted i;
        SELECT @car_type  = i.car_type FROM inserted i;

        INSERT INTO features
                (car_name, manufacturer_year, car_type)
        VALUES (@car_name, @manufacturer_year, @car_type);
GO

Answer: You are using SQL Server Trigger syntax. Here's for MySQL:
DELIMITER $$
CREATE TRIGGER TRG_Update
AFTER INSERT ON car_model
FOR EACH ROW
BEGIN
        INSERT INTO features (car_name, manufacturer_year, car_type)
        VALUES (NEW.car_name, NEW.manufacturer_year, NEW.car_type);
END $$
DELIMITER ;

MySQL CREATE TRIGGER Syntax
Comment: can you fully write whole code with correction ? I have does what you write but still same error.
Comment: that's the whole code, you don't need to declare any variables. what is the full error message generated?
Comment: it says you have no permission to do this job. What is it, how can I solve it in php myadmin ?
Comment: so the syntax is now correct. the problem that arises now is because maybe the username that you have used to login the server hasn't enough privilege to create a trigger.
Answer: trigger should be like that
   TRIGGER TRG_Update BEFORE/AFTER INSERT/UPDATE/DELETE

you can see How to Create Triggers in MySQL


Explain items in result of SHOW GRANT in Hive

Question: I request all grants in Hive using the command SHOW GRANT;
It returns a table like that:

default   src         role1   ROLE    Create  false   1387343876000   navis
default   srcpart         role1   ROLE    Update  false   1387343908000   navis

Which seems to be database, table, principal name, principal role, privilege, ???, timestamp, grantor.
Now what is this boolean value in the list?
Thanks for your help!
Answer: I found it out digging into the source code. The field shows a boolean value that says if the principal may give priviliges or roles to users and groups. It is called GRANT OPTION.


A full width table within an other table HTML

Question: I have a large amount of data to display in a table. And when I click on the icon ( represented as a beautifull "O" here ) in the last column I wish to display a "SubTable" within information about the line above ...
But my subtable doesn't take the full width of the table but only 100% of the tab-cell above ...
How can I achieve a 100% width subTable?

#tabResults {
  border-collapse: collapse;
}
.tab-row {
  color: #002c65;
  border: 1px solid #002c65;
  display: table-row;
  text-align: center;
}
.tab-row > .tab-cell {
  padding: 10px;
  vertical-align: middle;
}

N° IDID

Date

How much

lol

Pay

Damned

ICON

471137

TL0000020

03/10/2016

160587 €

DATA

DATAAAAS

jj

O

710137

Tii00020

03/10/2016

Something

smth

smth

smth

O

            Hello
            Hello
            Hello
            Hello
            Hello
            Hello
            Hello
            Hello

            16-02870
            91229.58
            91229.58
            91229.58
            91229.58
            91229.58
            91229.58
            91229.58

            1zefze
            91zef
            9zea58
            91qsc58
            9qscq8
            scqs8
            ss8
            aaaaa

47r137

TLerh020

03/10/2016

1e587 €

DrA

DrATArAAS

jj

O

Answer: I would just use the HTML table elements and by adjusting the col-span and the width of the  you can adjust the width of the innertable.

.innertable{
  width: 100%;
  text-align: center;
}

      N° IDID
      Date
      How much
      lol
      Pay
      Damned
      ICON

            header
            header

            body
            body

 <! -- Example -->

Comment: @Seba99, Mitta is using the `colspan="7"` to make the table cell of the **parent table** the complete width of the table row. **Inside** that parents table cell that you could make a new table with whatever collums, it would always be the complete width of the **parent table**.
Comment: The problem is : depending on which line is clicked I have different amount of columns in subTable. So I would have to always change the colspan value and doesn't seems to be the most effective way to do it ... I've also tried to use `display:table-cell` and `display:tab-row` in the subTable but same result as in my question... There no way to add as many new row as I want and always be in 100% width of the parent table ?
Comment: Haha yup I understood this 5min later ... But we can't edit a com' after a while T_T


Seeing a flicker mid-transition?

Question: I just tried my making a custom transition between view controllers. It basically spins the next one into view, and it works. Except that the source view controller flickers briefly back into visibility right as the animation completes, just as the destination view controller achieves its final position.
I'm also getting a warning about Unbalanced calls to begin/end appearance transitions which I'm still working on fixing-- I don't know if they're related.
Does anyone see anything here that jumps out as not quite right that would cause a flicker?
I then just assigned a button to do a custom segue via storyboard editor.
-(void)perform
{
    UIViewController *source = self.sourceViewController;
    UIViewController *destination = self.destinationViewController;

    [source.view addSubview:destination.view];
    destination.view.transform = CGAffineTransformMakeRotation(M_PI / 2);

    [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
        destination.view.transform = CGAffineTransformMakeRotation(0);
    }completion:^(BOOL finished){
        [destination.view removeFromSuperview];
        [source presentViewController:destination animated:NO completion:NULL];
    }];
}

Comment: the removeFromSuperview is your issue maybe. Take it out and see what happens.
Comment: Wow....good f'ing job, you got it. That simple. Makes sense, too, I should have tried removing that. I wonder why the tutorial I was following suggested that...it was in a language I didn't speak so I can't be sure. :) Thanks
Answer: Take out the removeFromSuperview.
Comment: 20 hours til it can be awarded

Seeing a flicker mid-transition?


How to embed multiple images in email HTML using Python

Question: I have a list of 15 .jpg images saved in one folder. I want all of them to be embedded in the body of an email. My first approach was to vertically stack them to one long image and embed the single image - but then the big picture seems to shrink in the generated email and it gets smaller, the more pictures I stack together.
I struggle to find a reproducible example where multiple images are embedded below each other in a mail such that each picture keeps the original size.
Comment: maybe you generated smaller image? Or simply `email readed` displays it this way but image is correct - and then problem is not email but `email readed`
Comment: Hi @furas. Not sure what you mean by "email readed". The 15 images could also change to 100. So it's rather the way to embed them properly which would solve the problem for me, I guess.
Comment: I mean `email reader` like Thunderbird, Outlook, Gmail in web browser, etc. And you have images embed in HTML then maybe you may have to set width, height in HTML tag.  But first I would download email with images and check if images are really in correct size. I don't know what code you used to generate email so I can't confirm you create it correctly - simply I don't trust the code which I can't see and test.
Answer: I found a good post here: http://dogdogfish.com/python-2/emailing-multiple-inline-images-in-python/ and 95% is taken from their example. Thanks to the bloggers!
I updated the imports to Python 3.x and adjusted the code such that all images in a specific folder will get embedded
from os import listdir
from os.path import isfile, join
import cgi
import uuid
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.header import Header
import os
import smtplib
from email.mime.base import MIMEBase
from email import encoders
import numpy as np

gmail_user = "email@example.com"
gmail_pwd = "pw"
final_path_current = "path/to/folder/with/images"
receive_mail = "firstname.lastname@example.com"

def attach_image(img_dict):
    with open(img_dict['path'], 'rb') as file:
        msg_image = MIMEImage(file.read(), name=os.path.basename(img_dict['path']))
    msg_image.add_header('Content-ID', '<{}>'.format(img_dict['cid']))
    return msg_image

def attach_file(filename):
    part = MIMEBase('application', 'octect-stream')
    part.set_payload(open(filename, 'rb').read())
    encoders.encode_base64(part)
    part.add_header('Content-Disposition', 'attachment; filename=%s' % os.path.basename(filename))
    return part

def generate_email(gmail_user, to_list, img_dict):
    msg = MIMEMultipart('related')
    msg['Subject'] = Header(u'Subject', 'utf-8')
    msg['From'] = gmail_user
    msg['To'] = ','.join(to_list)
    msg_alternative = MIMEMultipart('alternative')
    msg_text = MIMEText(u'Image not working', 'plain', 'utf-8')
    msg_alternative.attach(msg_text)
    msg.attach(msg_alternative)
    msg_html = u'
Below are the images
'
    for img in img_dict:
        msg_html += u'
'+img["title"][:-4]+'

''

'.format(
            alt=cgi.escape(img['title'], quote=True), **img)
    msg_html = MIMEText(msg_html, 'html', 'utf-8')
    msg_alternative.attach(msg_html)
    for img in img_dict:
        msg.attach(attach_image(img))

    return msg

def send_email(msg, gmail_user, gmail_pwd, to_list):
    mailServer = smtplib.SMTP('smtp.gmail.com', 587)
    mailServer.ehlo()
    mailServer.starttls()
    mailServer.ehlo()
    mailServer.login(gmail_user, gmail_pwd)
    mailServer.sendmail(gmail_user, to_list, msg.as_string())
    mailServer.quit()

img_dict = []
all_files = [f for f in listdir(final_path_current) if isfile(join(final_path_current, f))]

for file in all_files:
        img_dict_single = dict(title=file, path=final_path_current+"/"+file, cid=str(uuid.uuid4()))
        img_dict.append(img_dict_single)

email_msg = generate_email(gmail_user, [receive_mail], img_dict=img_dict)
send_email(email_msg, gmail_user, gmail_pwd, [receive_mail])


How to use the getter method which is stored in mongodb for some other POJO class?

Question: I am having one class which is having getter and setter methods i am storing that getter method in mongodb with some other collection. After getting the method name from DB how to access that method. Whether it is possible to do like this or not?
public class MappingAlgorithmScoreGenerationRules {

    @Field(value = FieldNames.CATEGORY)
    private String category;

    @Field(value = FieldNames.ATTRIBUTE_NAME)
    private MappingScoreGenerationLogic attributeName;

    @Field(value = FieldNames.PRIORITY)
    private Integer priority;

    @Field(value = FieldNames.ATTRIBUTE_SCORE)
    private Integer attributeScore;

    @Field(value = FieldNames.FINAL_THRESHOLD)
    private Integer finalThreshold;

    @Field(value = FieldNames.RESULT_COUNT)
    private Integer resultCount;

    @Field(value = FieldNames.NORMALIZED_VALUE)
    private Integer normalizedValue;

    @Field(value = FieldNames.GETTER_METHOD)
    private String getterMethod;
}

This is the class where i am storing the method name.
public class MatchEntry {

    private double matchedWeight;

    public double getMatchedWeight() {
        return matchedWeight;
    }

    public void setMatchedWeight(double matchedWeight) {
        this.matchedWeight = matchedWeight;
    }
}

getMatchedWeight is the method name i am going to store in the DB MappingAlgorithmScoreGenerationRules.
After getting the method name how to access the method name?
I want to access like
For example: MatchEntry.(the value get from db)
Answer: Use reflection API - https://docs.oracle.com/javase/tutorial/reflect/member/methodInvocation.html
Method methodToInvoke
  = MatchEntry.class.getMethod("methodName", methodParams,..);
methodToInvoke.invoke(matchEntryInstance, params,..);

Answer: In Java you can achieve method access by name using reflection (https://docs.oracle.com/javase/tutorial/reflect/member/methodInvocation.html).
This is a tutorial you may be able to use to lean more about this language feature: https://www.geeksforgeeks.org/reflection-in-java/
In your example, let's say you have loaded an instance of MappingAlgorithmScoreGenerationRules from the database, whose getterMethod attribute returns "getMatchedWeight".
Let's also assume that you have an instance of MatchEntry.
You would then access as follows:
MappingAlgorithmScoreGenerationRules rules = ....; //load from DB
MatchEntry entry = ...; //wherever it comes from

String getterMethodName = rules.getGetterMethod();

Method getter = MatchEntry.class.getMethod(getterMethodName);
Object value = getter.invoke(entry);

This code snippet omits Exceptions, in particular NoSuchMethodException and InvocationTargetException.

Please note that if you choose this approach, and depending heavily on the rest of your domain model, you will also need to be very careful with assumptions about the return type of the actual value (unless you can somehow guarantee that they are all the same, in which case you could cast the value).
Code that uses reflection is also inherently brittle and prone to failure as soon as you refactor. Imagine you have a populated database with these rules, and during a code review a couple of methods are renamed. Inoccuous change? Or will your entire setup break on the next deploy?
A (type-)safer approach might be to ensure all entries and related objects derive from an interface that standardises the return type on a getValue(String attributeName) method, so instead of messing with reflection you might do:
MappingAlgorithmScoreGenerationRules rules = ....; //load from DB
MatchEntry entry = ...; //wherever it comes from

String attributeName = rules.getAttribute(); //instead of 'getterMethod'

Object value = entry.getValue(attributeName);

where MatchEntry.getValue might be defined as:
public Object getValue(String attribute) {
    switch(attribute) {
        case "matchedWeight": return getMatchedWeight();
        default: return null; //or you could throw an exception
    }
}

This would easily survive any kind of method name refactoring and reorganisation, but adds the overhead of adding a case to the switch for every new attribute.
This problem could be partially solved with a runtime annotation that essentially binds an attribute name to a getter method, e.g.:
public class MatchEntry implements Matchable {

    private double matchedWeight;

    @MyCustomAnnotation("matchedWeight")
    public double getMatchedWeight() {
        return matchedWeight;
    }

    public void setMatchedWeight(double matchedWeight) {
        this.matchedWeight = matchedWeight;
    }
}

public interface Matchable {
    default Object getValue(String attributeName) {
        //read methods annotated with 'MyCustomAnnotation's in current class and call the one with matching value
    }
}

Your getValue(String attributeName) would be tasked with reading these annotations and dynamically figuring out which getter to call. Still requires the annotation to be added everywhere it's needed, but at least it's with the getter and not hidden in some switch that's potentially duplicated across multiple class definitions.
Instead you just need a single default definition in the parent interface, as hinted above.


Missing jetty-servlet 12.0.0 dependency

Question: I cannot find the jetty-servlet artifact for the recently released Jetty 12.0.0

https://github.com/eclipse/jetty.project/releases/tag/jetty-12.0.0

A search for it shows that it is not present on Maven Central, where can I find it?  Does it still exist?
Comment: *Any ideas if and when these dependencies will be available in Maven Central in future?* I would ask that question the maintainers of jetty. They should be able to answer this
Comment: Ok, I found that, starting from 12.x, jetty dependencies will be released under different names (see https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html > "Migrating from Jetty 11.0.x to Jetty 12.0.x"). Example for EE10 (corresponding to Servlet 6.0, see to https://jakarta.ee/specifications/servlet/): https://mvnrepository.com/artifact/org.eclipse.jetty.ee10/jetty-ee10-servlet.
Comment: The artifacts are there now, under different coordinates due to the introduction of the Environment concept in Jetty 12 (see answer below about why, and how to find the right coordinates)
Comment: @JoakimErdfelt: Thank you for the clarification. One more question - can you possibly estimate if and when jersey-container-jetty-servlet will support jetty 12? As far as I see the current release 3.1.3 of that library just supports jetty 11
Comment: Have to ask the Jersey folks that.
Comment: See https://github.com/eclipse-ee4j/jersey/issues/5401
Answer: The artifacts that are EE specific are now isolated in their own EE specific layer.
The design of Jetty 12 is that it is a Core, with no EE specifics (no Servlet, nothing) and then a bunch of Environments that provide the EE specific details.
With this new design...

The long history (since 1995) of versioning in Jetty is more consistent with normal versioning expectations.

since 1995, Jetty versioning was <servlet_support>.<major>.<minor>
starting with Jetty 12 it is now <major>.<minor>.<patch>

There will be fewer (if any) major version updates in Jetty.
A new Jakarta EE or Jakarta Servlet version will just cause a new Environment to pop up.
It is possible to run multiple Environments at the same time now.
Continued support for legacy javax.servlet webapps.

Eg:

Environment
Jakarta EE
Servlet
Namespace

ee8
Jakarta EE 8
Jakarta Servlet 4
javax.servlet.*

ee9
Jakarta EE 9
Jakarta Servlet 5
jakarta.servlet.*

ee10
Jakarta EE 10
Jakarta Servlet 6
jakarta.servlet.*

See the documentation about migrating from Jetty 11 to Jetty 12, and specifically the table of the maven coordination changes.
https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-migration-11-to-12

Missing jetty-servlet 12.0.0 dependency


What's this hole near my foundation and can I fill it in?

Question: Recently uncovered this large (~1x1x12 foot) hole next to the foundation of my 1960s house in Minnesota. There's framing that goes all the way down but nothing else seems to be in there.  What is this? Can I fill it in with dirt or concrete?
Thanks for the responses on this mystery.  I couldn't comment on my own post due to being new so here are some responses.
There's nothing at the bottom of the hole other than dirt.  The basement is mostly finished.  There is a storage room on the side of the hole with the red wire.  We get water in there each spring but the finished portion of the basement has drain tile. Regarding it potentially being for radon, when we moved in we did install a radon mitigation system so if this was for radon it's now obsolete. The previous own of the house has passed away and I have no method to contacting his children.
Comment: People usually do not build something like that for no reason.  The reason might not be needed anymore, but I would like to know the reason before filling it in.  Is there anything inside the basement?
Comment: Shine a light down there, or tie a bright light to a rope and lower it. This picture just shows the top of a hole, not anything about what's down the hole, which you'd need to know before choosing to fill it. I guess at that size you could fill it with something easily removable, like big hunks of styrofoam...
Comment: Another idea, it could be for a sump pump that is lowered when needed
Comment: The architect or builder may still be alive.  Any chance of asking them?   Could it be a stormwater sump?  If there is any moisture in the basement is it mainly near this location?
Comment: You have managed to create two users.  Please ask a moderator to merge them, or decide and use one only.
Comment: Ice storage? Or at any rate something that needs to be kept frozen or nearly so during winter?
Comment: @kreemoweet 12 feet down, it should be pretty near 50°F/10°C year round, actually. But it's an inconvenient form factor for a root cellar, and a bit on the small side for a storm cellar.
Comment: It can't be for any water related purpose...it's wood!  It may be have been used to hold and anchor a very tall mast...for a flag pole...a birdhouse....a ham radio antennae.   The mast could be removed for servicing.    Before filling, you might be able to pull the whole tube out so the wood doesn't rot and cause weird problems in the future.
Comment: It might be a possible DIY radon migration system.  Removing the radon from beneath the basement.  This is only a guess, maybe a bad one.
Comment: I see the danger that kids could fall down there. You could add a metal grating and afix it with screws. Then you have the benefit of the assumed radon fountain and protection.
Comment: Have you considered asking your neighbors? This is an odd structure, indeed, and if _any_ of them were friendly with the former owner, they may have noticed and asked about it.
Comment: @SteveWellens antenna tower is a great theory.  1960s could be a TV reception one.  12 ft is about right for a 30 or so foot tower. It should be embedded in concrete, but maybe was also attached to the house?  OP can you add a photo of the wall all the way up to the roof above this?  Is there anything that looks like remnants of attachment points? Are there remnants of old antenna wire in the attic or basement?  Possibly a flat plastic cable with wires running along the sides and a thin flat part separating them.
Comment: Also if the antenna tower theory is right, there's a small chance you'll be able to see it in old aerial or street view photos. Google maps and Google street view both have history, and your local library, newspaper and historian may have photos.
Answer: My great grandomthers house had something very close to that and I bet it's the same or similar.  First I took your image and increased exposure:

The framing appears to be complete on the external facing and spaced evenly on the foundation side just like my grandmothers.  Hers was made of cedar which it appears like yours may be as well.
For her house, she had a small pot belly stove downstairs serving the dual purpose of heating and cooking in case of a power outage.  The vent pipe was ported into that channel, up, and out.  Cedar was chosen by my great grandfather for its heat/fire resistance and because it's a natural insect repellant.
Personally, I wouldn't fill it in unless it is causing you problems currently.  Foundations are complex creatures.  If you fill it with cement, you could inadvertently cause erosion issues around the area and potentially weaken your foundation in the long term.  On top of this, if any type of mast is ever erected that needs to be braced to the house, using an existing hole is always better than digging a new one.
Comment: @user174430 examine the basement walls adjacent to this shaft, and use a camera and light to examine the walls of the shaft, for remnants (maybe closed up) of any former holes.  Maybe for venting a burner, or maybe a smaller one for (see my suggestion above) antenna cable.
Comment: When was your great grandmother's house built?  OP's is "1960s" and while I love this answer, it seems unlikely a 1960s house would be built with a cedar-lined flue for wood-fired basement cooking and heating.  I can see that kind of thing being advertised as a feature a hundred years earlier.  Also, OP's is 12 feet deep.  Surely far below the bottom of the foundation. Why would a flue well be that deep?
Comment: Construction started in 1950 the year after my grandmother was born, I think it took him 2 years to build.  To be fair, I'm from the rural foothills of NC, US...  Many homes around here still have pot belly stoves or at a minimum some sort of auxiliary fireplace.  I could see the same being true in Canada for the winter. As for depth, maybe OP has a split-level home with a lower basement, otherwise I can't explain the depth.  The one at my great grandmother's house went 6 inches below the basement floor...  Though I never really thought about why until this very moment.
Comment: @jay613 Good idea.  While you're down there, it's also worth looking at the very bottom of each side for cylindrical stress marks.  If someone had a Ham radio antenna with a backup DC ballast (Not sure if that's the right phrasing) or linear amp coil at the base it would be easy to identify.

What’s this hole near my foundation and can I fill it in?


Build Ci/CD on github error: postcss-calc:: Lexical error on line 1: Unrecognized text

Question: I have failed to deploy my source code to the web using GitHub's CI/CD. My product still runs well on a MacBook or Windows machine with the same versions of Node, npm, and yarn, but it encounters an error on GitHub. Here are the workflow details of my file.
name: Build develop
'on':
  push:
    branches:
      - develop
  workflow_dispatch: null
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18.12.0
      - name: cp env
        run: cp ./.env.develop ./.env
      - name: Build product
        run: |
          yarn cache clean
          yarn install
          yarn build
      - name: list folder
        run: ls -l
      - name: install ssh keys
        run: |
          install -m 600 -D /dev/null ~/.ssh/id_rsa
          echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
          ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
      - name: scp folder to server
        run: "scp -r ./build/* root@${{ secrets.SSH_HOST }}:/var/www/test/develop/test-fe"

and error:
Warning
(1:5113) autoprefixer: end value has mixed support, consider using flex-end instead

Warning
(1:60257) autoprefixer: end value has mixed support, consider using flex-end instead

static/css/main.0bc37bf3.css from Css Minimizer plugin
postcss-calc:: Lexical error on line 1: Unrecognized text.

  Erroneous area:
1: auto + var(--pc-choice-space-0) + var(--pc-choice-space-0)
^..^ webpack://./node_modules/@shopify/polaris/build/esm/styles.css:1684:2591

static/css/main.0bc37bf3.css from Css Minimizer plugin
postcss-calc:: Lexical error on line 1: Unrecognized text.

  Erroneous area:
1: auto + var(--pc-choice-space-0) + var(--pc-choice-space-0)
^..^ webpack://./node_modules/@shopify/polaris/build/esm/styles.css:1684:2765

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

I have tested it on both MacBook and Windows, and it was successful. I hope to be able to run it on GitHub CI/CD.
Answer: I am experiencing this same error in our actions when bumping polaris to 11.12. Looks like this was introduced in 11.5 - downgrading to 11.4 sorted it for me.
Comment: Opened an issue in github https://github.com/Shopify/polaris/issues/10223


Efficient plotting library for web applications

Question: I am looking for a plotting library that can be used in web applications (point and line plots are must - antyhing else is a bonus).
It might be either server-side (Python) or client-side. The more interactive graphs are the better.
I have found some solutions of course, but none of them are good enough for volume of datasets we use. My last try was flot but it crashed browser for 28k datapoints.
Can you point some plotting solutions which mets my requirements?
Answer: For those are interested, finally I've choosen matplotlib. (It is server-side, python-based solution)


How can I simultaneously play Spotify audio through my headphone-out while VLC plays audio through HDMI?

Question: How can I setup Ubuntu such that it can play VLC audio through HDMI connected to a TV, but at the same time, it can also play music from Spotify via the headphones?
I'm running 14.04
Comment: You will only be able to do this if you have a dedicated sound card (so one for the HDMI output and another for the headphones). It then depends on your setup, but it can be rather 'complex' but once working very cool to show off.
Answer: You can install and use Pulseaudio Volume Control. Go to the Ubuntu Software Centre and search for pavucontrol:

Or use the following command in your cli:
sudo apt-get install pavucontrol

Now start pavucontrol from the Ubuntu Dash (not the sound icon):

And select the desired output device under playback:
Happy listening!
Comment: Here's what I'm seeing [PulseAudio](http://i.imgur.com/1fzuUjk.png) I don't have that selection option beside the speaker button where you can choose the output device for the specific application...
Comment: When I go to the "Output Devices" tab, I only see the HDMI device [Output Devices screenshot](http://i.imgur.com/6y5ygq6.png) but when I go to System Settings ---> Sound, I see both the HDMI out and the built-in Speaker out [Sound Settings](http://i.imgur.com/bR2uhSG.png)
Comment: That is very strange, unfortunately I don't know enough about PulseAudio to tell you why your other output devices are missing.


Autocomplete doesn't work

Question: I have an issue with the auto complete in js. Here the following code works well for me:
$(function(){
    $( "#txtAuto" ).autocomplete({
        source: ["Choice1","Choice2"],
        minLength:2
    });
});

But when I change this to the code below for testing it doesn't gives me choices:
$(function(){
    $( "#txtAuto" ).autocomplete({
        source: function( request, response ){
            $.ajax({
                url: "test.ewd",
                success: function(data){
                    var res=data.match('\\[[^\\]]*]');
                    return ["Choice1", "Choice2"];
                }
            });
        },
        minLength:2
    });
});

Any one tell me where I did mistake?
Answer: The core of the problem is that the ajax-function is asynchronous. It is not executed at the same time as the rest of your code, but rather when the response for your ajax-request (which probably takes 10-100 ms to complete) is available.
So, you can't return the values from the success-function. Instead, you must pass them in to the response function. like this:
success: function(data) {
  var res=data.match('\\[[^\\]]*]');
  response(["Choice1", "Choice2"]);
}

Comment: No problem. There's a button next to my answer that you can use to "accept" the answer. It will show others that this was the working solution.

Autocomplete doesn't work


Write excel sheet in Selenium using row.getlastcellnum() method in for loop causes java.lang.IllegalArgumentException

Question: Below is my selenium code to write data in first empty column in excel sheet:
public void setAllData(int sheetNumber)
    {
        sheet1 = wb.getSheetAt(sheetNumber);
        for(int i = 0; i<rowCount+1; i++)
        {
            row = sheet1.getRow(i);
            **int k = row.getLastCellNum();**
            **for(int j = row.getLastCellNum(); j<row.getLastCellNum()+1; j++)**
            **//for(int j = row.getLastCellNum(); j<k+1; j++)**
            {
                sheet1.getRow(i).createCell(j).setCellValue("Pass");
            }
        }
        try {
            FileOutputStream fos = new FileOutputStream(file);
            wb.write(fos);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

When I used for-loop using j<row.getLastCellNum()+1 following error is coming: "java.lang.IllegalArgumentException: Invalid column index (16384).  Allowable column range for EXCEL2007 is (0..16383) or ('A'..'XFD')"
Where as if I store the row.getLastCellNum() value in a variable (k) and then used that variable in for-loop, its working fine.
Answer: getLastCellNum()
will return total rows PLUS ONE.
See API


Do While Loop with NSDecimalNumber

Question: I am converting a Yield to Maturity Calculation from using float numbers to NSDecimalNumbers.  The loop works but hangs up quite often. I have provided the code below:
<code>///////////////////////  YTM TEST ////////////////////////////////

 NSDecimalNumber *years = [NSDecimalNumber decimalNumberWithString:@"10"];
 NSLog(@"Years are: %@", years);

NSDecimalNumber *temp9 = [NSDecimalNumber decimalNumberWithString:@"2"];
    NSLog(@"Coupons per Year: %@", temp9);

NSDecimalNumber *temp2 = [NSDecimalNumber decimalNumberWithString:@"100"];
    NSLog(@"Bond Price: %@", temp2);

NSDecimalNumber *temp3 = [NSDecimalNumber decimalNumberWithString:@"100"];
    NSLog(@"Bond Par: %@", temp3);

NSDecimalNumber *temp1 = [NSDecimalNumber decimalNumberWithString:@"5"];
    NSLog(@"Coupon Interest Rate Input: %@", temp1);

temp1 = [temp1 decimalNumberByDividingBy:[NSDecimalNumber decimalNumberWithString:@"100"]];
    NSLog(@"Coupon Interest Rate: %@", temp1

//temp5 = 0.0; // the initial or lower ytm guess
NSDecimalNumber *temp5 = [NSDecimalNumber decimalNumberWithString:@"0.0"];

NSLog(@"Initial YTM Calc Guess: %@", temp5);

NSDecimalNumber *finalCalc = [NSDecimalNumber decimalNumberWithString:@"0.0"];
NSLog(@"Initial finalCalc Value is: %@", finalCalc);

{
    do
{
    //if (counter < 300000)

    {

       //temp5 = temp5 + .000005;    // .00005;
        NSDecimalNumber *constant = [NSDecimalNumber decimalNumberWithString:@".000005"];
            //NSLog(@"YTM Calc Constant: %@", constant);

        temp5 = [temp5 decimalNumberByAdding:constant];
            //NSLog(@"Add Constant to Initial Guess: %@", temp5);

       /// Calc 1 & 2
        NSDecimalNumber *cashFlow = [[temp3 decimalNumberByMultiplyingBy:temp1]decimalNumberByDividingBy:temp9];
            //NSLog(@"Cashflow per Coupon Period: %@", cashFlow);

        //Calc 3

        NSDecimalNumber *constantOfOne = [NSDecimalNumber decimalNumberWithString:@"1"];
        NSDecimalNumber *onePlusGuess = [temp5 decimalNumberByAdding:constantOfOne];
        //NSLog(@"One Plus Guess: %@", onePlusGuess);

        // Calc 4

        NSDecimalNumber *thePower = [years decimalNumberByMultiplyingBy:temp9];
        //NSLog(@"thePower: %@", thePower);

        // Calc 5

        NSDecimalNumber *onePlusGuessRaised = [onePlusGuess decimalNumberByRaisingToPower:[thePower floatValue]];
        //NSLog(@"One Plus Guess Raised to Power: %@", onePlusGuessRaised);

        // Calc 6

        NSDecimalNumber *divideIntoOne = [constantOfOne decimalNumberByDividingBy:onePlusGuessRaised];
        //NSLog(@"Divide into One: %@", divideIntoOne);

        //Calc 7

        NSDecimalNumber *complexResult = [constantOfOne decimalNumberBySubtracting:divideIntoOne];                            //NSLog(@"Complex Calc Result: %@", complexResult);

       // Calc 8

        NSDecimalNumber *divideByGuess = [complexResult decimalNumberByDividingBy:temp5];
        //NSLog(@"Divide into One: %@", divideByGuess);

        //Calc 8

        NSDecimalNumber *multipleLeftSide = [cashFlow decimalNumberByMultiplyingBy:divideByGuess];
        //NSLog(@"left Side Done: %@", multipleLeftSide);

        //Calc 9

        NSDecimalNumber *divideIntoPar = [temp3 decimalNumberByDividingBy:onePlusGuessRaised];
        //NSLog(@"Divide into Par: %@", divideIntoPar);

        //Calc 10

        finalCalc = [multipleLeftSide decimalNumberByAdding:divideIntoPar];
       // NSLog(@"Final part of Calc = : %@", finalCalc);

     }

}

while (finalCalc > temp2);

    NSLog(@"I'm Done!");

}
}
</code>
Comment: Please explain what 'hangs up quite often' means.  Crash, errors, freezes? Logs? Any indication that it 'hangs' at the same point each time?
Comment: `decimalNumberByRaisingToPower:` appears to expect an NSUInteger and you're giving it a float?  Don't you see a warning there?
Comment: Sorry for the poor explanation. By hangs up I mean that the value shown in a counter "counter= counter + 1;" & " NSLog(@"The Count: %d", counter);" which appears before the statement "while (finalCalc > temp2);" will produce different value each time to the loop is restarted.  The value range from 4 to as high as 489 which indicates the number of passes through the loop.  Although each pass calculates the correct values the loop never reaches a point where finalCalc is less than or equal to temp2.
Comment: Steve - I will try making a change in the "decimalNumberByRaisingToPower" number type input and get back.
Comment: Hi Everyone, I have finally solved the above issue where the process of the "Do While" would stop looping at very places.  In a few cases it would run for 2 minutes or more.
Comment: Hi Everyone, I have finally solved the above issue where the process of the "Do While" would stop looping at very places.  In a few cases it would run for 2 minutes or more. The problem was that my "While" statement "while (finalCalc > temp2);" was not comparing the values of the two NSDecimalNumbers, but comparing pointer addresses.  After a fair amount of research and testing the correct coding for the while statement is "while ([finalCalc compare:temp2] ==  NSOrderedDescending);"  I have tested this multiple times are it works perfectly.  My original code compiles without errors or warnings
Answer: I have finally solved the above issue where the processing of the "Do While" would stop looping at various places. In a few cases it would run for 2 minutes or more. The problem was that my "While" statement "while (finalCalc > temp2);" was not comparing the values of the two NSDecimalNumbers, but comparing pointer addresses. After a fair amount of research and testing the correct coding for the while statement is "while ([finalCalc compare:temp2] == NSOrderedDescending);" I have tested this multiple times are it works perfectly. My original code would compile without errors or warnings.

Do While Loop with NSDecimalNumber


ClassNotFoundException at asm.ObjectWriter.getCommonSuperClass

Question: I'm trying to instrument the Apache Commons Math with the asm library and for some classes a ClassNotFoundException is thrown when I try to write it to a file using a ClassWriter.
One class that throws the error is org/apache/commons/math3/linear/RealVector.class
The stacktrace is:
java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.commons.math3.linear.Array2DRowRealMatrix
at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source)
at org.objectweb.asm.ClassWriter.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at org.objectweb.asm.tree.ClassNode.accept(Unknown Source)

I googled for the Exception and all I could find was related to some cobertura problems, or other unrelated libraries that weren't helpful.
This even happens if I don't perform any instrumentation at all. I also tried to explicitly adding the missing class to the classpath, but this didn't work either.
Any ideas?
Comment: as per stack trace it means you are missing commons-math*jar? Do you have it and asm*.jar in your classpath?
Comment: the asm.jar is part of the jar that I use to run the instrumentation. I haven't added the commons-math as a jar, but the target/classes folder of it, after building it manually
Answer: The problem is that the ASM in your environment is loaded from the bootstrap classloder, and the math3 class for another classloader.
When the ClassWriter calls "getCommonSuperClass" it calls "GetClass().GetClassLoader()", which will give him the bootstrap classloader.
However, it is trying to merge the frames of RealVector (which is already loaded) and Array2DRowRealMatrix, and the latter can't be found using the bootstrap classloader.
One solution is that if you're using calling the ClassWriter yourself - remove the flag that tell the writer to compute the frames.
Another solution is to try and load ASM from the system loader.


How to simply detect browser type with JQuery or JavaScript?

Question: I am using JavaScripts lastIndexOf() which doesnt work in IE so I must write an alternative code.
I simply want an if statement to do something like:
if(IE = true){
  //run alternative to lastIndexOf()
}

But I am really struggling with finding a way to achieve this.
So far I have tried the following:
JQuery's .browser is deprecated.
.support seems to only detect certain facets or features of a
   browser.
Modifying .support with JavaScript, as here, wont work and
   throws errors.
The hasClass() method no longer works:

if ($('html').hasClass('ie7');

Would anyone know a simple way to just detect the browser type?
Comment: I can't find any jQuery documentation for `lastIndexOf`. Did you perhaps mean [`String.lastIndexOf`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) or [`Array.prototype.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf)
Comment: @Phil sorry, I thinks its just a JavaScript thing
Answer: There are cases when you have no choice but to use browser detection, but in this case it is better if you detect the function itself, and shim it in if it is not there.
Comment: I always check MDN for shims / polyfills under the [compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf#Compatibility) sections
Comment: @Phil: very good point.
Comment: Yeah do not browser sniff, feature detect. FWIW IE supports lastIndexOf, here is a copy from my console doing a quick example.
Comment: JavaScript Console is attached and accepting commands.
   var str = "Hello planet earth, you are a great planet.";
 var n = str.lastIndexOf("planet");
   undefined
   n
   36
Answer: Edit: The best way to fix your issue is given by MDN.

How can you detect the version of a browser? has a very nice way of getting the browser type and version as a string.
You might also find Detect IE version (prior to v9) in JavaScript helpful for IE-specific detection.
You can also try:
if (navigator.userAgent.indexOf("MSIE") > 0 )

I have not tested this however.
Comment: -1 Browser detection is a flawed strategy and has been considered a very bad idea for a long time. Please don't suggest it, paticularly when there is a very simple way to detect support for `indexOf` and deal with cases where it's lacking.
Comment: http://stackoverflow.com/a/5918791/80860
Comment: I'm looking for the source, can't find it
Comment: Thanks, found it myself too.
Comment: `You might also find Detect IE version in Javascript helpful.` is exactly what I needed. Added the piece of code I used to your answer above
Comment: I assumed that the asker wanted to detect browser type. I agree however that browser detection is not the best choice for this application. Not sure but http://stackoverflow.com/questions/1744310/how-to-fix-array-indexof-in-javascript-for-ie-browsers might be more helpful in that direction.


Jenkins with Maven and npm process fails with EAGAIN error during npm install

Question: So i got my jenkins pipeline setup for a application that uses spring boot as backend and vuejs as frontend. The maven build process builds the frontend first, copies that to the backend and then builds the backend. But during the build of the frontend the process fails ONLY if i run it through the jenkins pipeline. (for other people the same pipeline apparently works on a different machine)
[INFO] npm ERR! code EAGAIN
[INFO] npm ERR! syscall spawn sh
[INFO] npm ERR! path /var/lib/jenkins/workspace/pipeline/frontend/node_modules/pre-commit
[INFO] npm ERR! errno -11
[INFO] npm ERR! spawn sh EAGAIN
[INFO] npm ERR! command sh -c node install.js
[INFO]
[INFO] npm ERR! A complete log of this run can be found in:
[INFO] npm ERR!     /var/lib/jenkins/.npm/_logs/2022-07-22T09_11_43_478Z-debug-0.log

the relevant part of the log is here: https://pastebin.com/ewp6zRcv
the jenkins pipeline is:
pipeline {
    agent any

    parameters {
        gitParameter branchFilter: 'origin/(.*)', defaultValue: 'staging', name: 'BRANCH', type: 'PT_BRANCH'
    }

    tools {
        maven "Maven"
        nodejs "Node"
    }

    stages {
        stage('Build') {
            steps {
                // Get some code from a GitHub repository
                git branch: "${params.BRANCH}", url: 'https://github.com/TheExkaliburg/MoreFair'

                // Run Maven on a Unix agent.
                sh "mvn -Dmaven.test.failure.ignore=true clean package"
            }

            post {
                success {
                    archiveArtifacts 'target/*.jar'
                }
            }
        }
    }
}

the jenkins is installed on a linux server with ubuntu 20.04 and the project itself can be found on https://github.com/TheExkaliburg/MoreFair and the branch to be built is staging
the strange thing is that EAGAIN failures are normally "Resource temporarily unavailable." failures. running the process as root or as the jenkins user works fine without any errors, i have enough leftover disk space and my ram & cpu are never even close to getting to 100% during the build process
its also strange since the error that comes up is not always the same, f.e.
[INFO] -  Building for production...
[INFO] node[80787]: pthread_create: Resource temporarily unavailable
[INFO] node:events:505
[INFO]       throw er; // Unhandled 'error' event
[INFO]       ^
[INFO]
[INFO] Error: spawn /var/lib/jenkins/workspace/MoreFairStaging/frontend/node/node EAGAIN
[INFO]     at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
[INFO]     at onErrorNT (node:internal/child_process:478:16)
[INFO]     at processTicksAndRejections (node:internal/process/task_queues:83:21)
[INFO] Emitted 'error' event on ChildProcess instance at:
[INFO]     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
[INFO]     at onErrorNT (node:internal/child_process:478:16)
[INFO]     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
[INFO]   errno: -11,
[INFO]   code: 'EAGAIN',
[INFO]   syscall: 'spawn /var/lib/jenkins/workspace/MoreFairStaging/frontend/node/node',
[INFO]   path: '/var/lib/jenkins/workspace/MoreFairStaging/frontend/node/node',
[INFO]   spawnargs: [
[INFO]     '/var/lib/jenkins/workspace/MoreFairStaging/frontend/node_modules/thread-loader/dist/worker.js',
[INFO]     20
[INFO]   ]
[INFO] }

or
[7,371s][warning][os,thread] Failed to start thread - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.

the version for node are 16.16.0 and for npm 8.11; maven is on 3.8.6 with java 17 for maven and java 11 for jenkins (2.346.2)
Comment: have you checked ulimit?
Comment: yes i didn, turns out the tasklimit for the service wasn't accurate, added TasksMax=500 under [Service] to make it work
Answer: So the problem with this specific case was that the service config didn't allow for more tasks to spawn
a simple way to fix this (after one week of recherche and trying a various amount of things) is systemctl edit jenkins and add to the config
[Service]
TaskMax=500

the number can vary but the default of 165 you can find out through systemctl show --property=DefaultTasksMax wasn't enough
Answer: I don't konw if you fixed this error, but usually when I get this kind of EAGAIN errors, it means a probleme of resources.
You should try increase your memory limit allocated to node by using the NODE_OPTIONS var (be sure your resources supports 8Go)
env.NODE_OPTIONS = "--max-old-space-size=8192"

pipeline {
    agent any

    parameters {
        gitParameter branchFilter: 'origin/(.*)', defaultValue: 'staging', name: 'BRANCH', type: 'PT_BRANCH'
    }

    tools {
        maven "Maven"
        nodejs "Node"
    }

    stages {
        stage('Build') {
            steps {
                // Get some code from a GitHub repository
                git branch: "${params.BRANCH}", url: 'https://github.com/TheExkaliburg/MoreFair'

                // Run Maven on a Unix agent.
                sh "mvn -Dmaven.test.failure.ignore=true clean package"
            }

            post {
                success {
                    archiveArtifacts 'target/*.jar'
                }
            }
        }
    }
}


Rename Json object fieldName

Question: i am using MVC c#
i have a object with
public class Person
{
        public int TypeId { get; set; }
        public string Code { get; set; }

}

i have a code that retruns JSON object for this object like this
    return Json(personCodeStore.GetBusinessCodes());

But when I receive this on the client side i want to be able to rename the field name from
TypeId to value
Code  to text

I do not want to use DataContractSerializer like MVC3 JSON Serialization: How to control the property names?
because i am using EF 5.x and every time i update the model and .tt file runs it overwrites my changes and also it uses this modified property on all my views which i don't want.
So is there a way i can rename this when i serialize it or once i get on client side using jquery?
Answer: You could simply use LINQ and return an anonymous object projecting your original result:
var businessCodes = personCodeStore.GetBusinessCodes();
return Json(businessCodes.Select(x => new
{
    value = x.TypeId,
    text = x.Code
}));

Now you're gonna get something along the lines of:
[
    { "value": 1, text = "text 1" },
    { "value": 2, text = "text 2" },
    { "value": 3, text = "text 3" }
    ...
]

Rename Json object fieldName


What bonuses are related to friendship?

Question: If you battle with your pokemon, you increase your friendship with that pokemon. It wouldn't make sense to have a feature like that if it didn't change anything, but if I ever knew what bonus you got when gaining your pokemons' trust, I've forgotten. What bonuses are gained when you gain the trust of your pokemon, by battling and training them?
Comment: There are three things that come to mind. 1: Some Pokémon only evolve after you maximize friendship. 2: The [Return move](http://bulbapedia.bulbagarden.net/wiki/Return_%28move%29), which becomes stronger the more your Pokémon likes you. 3: The [Frustration move](http://bulbapedia.bulbagarden.net/wiki/Frustration_%28move%29), which becomes stronger the more your Pokémon *hates* you. That's all I can think of right now.
Comment: As of gen VI, high friendship pokemon also do other things. Researching now.
Comment: Oh darn. Now I can't choose between Fogolicious and Studoku... Well, I'll have to think about this.
Answer: If you are talking about just friendship then yes @Studoku's answer is correct but if you meant the new mechanic in X and Y called Affection, that is a little different.

Resistant to having stats lowered
Evasiveness increases
Similar effect to Endure where stays at 1 hp
Pokemon levels faster
More critical hits( says something like 'Pokemon Meowth is in sync with Trainer Name')

All of these are permanent when there Affection is full as well, I do believe.
Comment: Ok, @Studoku 's answer is also very very good, but because I can only accept one answer, I have to choose this one because it mentions that affinity is a different concept than friendship, but please make sure to check Studoku's too!
Answer: There are several effects of having a high friendship.

Certain pokemon such as Togepi are evolved by raising their friendship.
The move Return, which can be taught to anything which can learn TMs has power based on the friendship stat of the user. Its power reaches 102 at max friendship, often making it the strongest Normal move a pokemon can learn. Frustation, the opposite of Return, has power based on how low the user's friendship is.
As of Gen VI, an extremely high friendship has other effects in battle. The full effects and chances haven't been fully discovered yet but the effects of extremely loyal pokemon include.

Surviving moves that would otherwise KO
Recovering from Status Effects
Increased Critical chance
Comment: I think only two hearts (instead of max) friendship is necessary for friendship evolution too.

What bonuses are related to friendship?


elasticsearch/logstash and logstash-contrib: Couldn't find any plugin named 'x'

Question: I'm trying to use the 'cloudtrail' codec with logstash 1.4.2, which is in logstash-contrib. I've installed it on an ubuntu distro:
sudo /usr/share/elasticsearch/bin/plugin --install elasticsearch/logstash-contrib

I've verified the file is there:
ls /usr/share/elasticsearch/plugins/logstash-contrib/_site/lib/logstash/codecs/cloudtrail.rb

And I've included it in a basic configuration:
input {
  s3 {
    bucket => "bucketname"
    delete => false
    codec => "cloudtrail"

....

When I try to run it, I get a plugin error:
{:timestamp=>"2015-02-06T20:10:25.179000+0000", :message=>"
+---------------------------------------------------------+
| An unexpected error occurred. This is probably a bug.   |
| You can find help with this problem in a few places:    |
|                                                         |
| * chat: #logstash IRC channel on freenode irc.          |
|     IRC via the web: http://goo.gl/TI4Ro                |
| * email: firstname.lastname@example.com                |
| * bug system: https://logstash.jira.com/                |
|                                                         |
+---------------------------------------------------------+
The error reported is:
  Couldn't find any codec plugin named 'cloudtrail'. Are you sure
 this is correct? Trying to load the cloudtrail codec plugin resulted
 in this error: no such file to load -- logstash/codecs/cloudtrail"}

Now, I see that most of the codecs are at /opt/logstash/lib/logstash/codecs. Do I need to manually copy it (that seems bad)? Is there a gem install I'm missing?
For the fun of it, I copied it to that /opt/logstash directory. It just seems wrong.
Answer: Per the docs, you should be able to install it with the following:
 bin/plugin install logstash-codec-cloudtrail

EX: /opt/logstash/bin/plugin install logstash-codec-cloudtrail works for me with logstash 184.108.40.206.


Do you run slower backwards or sideways?

Question: I know that you move slower when using your basic attack.  I also know that jumping has no speed penalties.  Is this the same when running backwards or sideways?
If true, what is the speed difference between each direction?
Answer: From the Wiki
The Backpedal penalty is applied when walking backward. The Strafing penalty is applied for moving sideways. The Basic Attack penalty is applied while using basic attacks and for a short time afterwards. None of these penalties are shown in the movement speed counter. Some abilities such as Medusa's passive allow one or more of these penalties to be ignored.
According to community experiments:
<code>Backpedal penalty = 40% reduced

Strafing penalty = 20% reduced

Ranged Basic Attack penalty = 50% reduced

Melee Basic Attack penalty = 35% reduced
</code>
Note: Movement speed reduction from the mentioned above sources can be compounded, but cannot exceed 50% reduction (e.g moving backwards while attacking will only reduce the player's movement speed by 50%).
Comment: @Dpeif: There's a lot of exceptions. Isis and Chang'e both have exceptions to backpedaling, for example. Hastened Fatalis allows you to ignore the basic attack movement penalty. I'm sure there are others I'm just not remembering.
Comment: also,  Medusa had no strafing penalty,  and half the back pedal penalty, as her [passive ability](http://smite.gamepedia.com/Medusa).


Extension installer error in OpenCart 126.96.36.199

Question: I tried to upload file in extension installer in opencart 184.108.40.206 but I get error message:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of
  the JSON data
OK
Warning: ftp_login(): Sorry, cleartext sessions are not
  accepted on this server. in
  ///////admin/controller/extension/installer.php
  on line 294{"error":"Could not login as admin"}

Please find the attached below screenshot

Thanks in advance.
Comment: Please add your error to your post (not as a image.)
Comment: @DigitCart i edited my Post can You please give me the solution now?
Comment: Are you sure about your OC version? It seems that you are using 22.214.171.124
Comment: yeah its 220.127.116.11
Answer:
You need to use ftp_ssl_connect() function instead of ftp_connect()
  because server is using Explicit TLS/SSL

Try this:
<code>admin\controller\extension\installer.php
</code>
Find:
<code>$connection = ftp_connect($this->config->get('config_ftp_hostname'), $this->config->get('config_ftp_port'));
</code>
Change to:
<code>$connection = ftp_ssl_connect($this->config->get('config_ftp_hostname'), $this->config->get('config_ftp_port'));
</code>
Sources:
https://stackoverflow.com/a/22969260/4330223
https://forum.opencart.com/viewtopic.php?t=142341#p585561

Extension installer error in OpenCart 2.3.0.2


Where do I put spies in Civilization 4 to protect against rival spies?

Question: I'm playing Beyond The Sword and when I want to build a spy I notice they supposedly: Helps Thwart Rival Spies:

Should I leave a spy stationed at borders? Should I place them cities? Does it matter where they are placed in order to effectively thwart rival spies? I can't seem to find any correlation to where I put them and my success rate of stopping incoming espionage.
The reason I ask is because I'm playing a world-scenario starting in 1000 as the Indian empire and the starting borders are all mountainous, that is, there are very few entrances I have to guard. They are quick to train and I'm getting constantly attacked by spies - not just in my cities but also towns, watch-towers, farms, etc.
Update:
I'm not sure if this has to do with anti-spy buildings (e.g. Intelligence Agency) or because I've stationed a spy in every city, but I'm seeing a huge increase in these messages:
Answer: If you have a spy in your city, it helps increase the cost for enemy spies to do an action in that city, and also helps albeit rarely for you to detect the enemy spy.
I'd put them in my cities if I was worried about espionage but they seem to be more productively used offensively then defensively for the slight improvement they make helping "thwart rival spies".
I have never placed them at borders, I'd imagine this would be a lot of work for the same detection with less done to actually prevent or increase cost of attacks.
Overall you can't stop them from running missions on you, but using spies this way increases their cost making it become very expensive for them to continue to do so.
Comment: @Sarmackie No, even spies can't see enemy spies.  They just increase the % chance that you will detect an enemy spy, which immediately removes it.
Comment: Isn't the spy unit able to see/detect enemy spies?
Answer: As Ward says, spies stationed in a city will help detect and prevent enemy espionage.  They can also do a mission that will temporarily make all espionage missions in that city much more expensive, at the cost of some of your own espionage points.  One of the best things you can do though to prevent people using espionage against you is to gather espionage points against them.  You can probably guess which of you neighbors is spying on you (especially if you catch a spy), and by cranking up your espionage spending against that neighbor, you will make it much more costly for their spies to do missions.  This has a long-term effect, and is countered only by them doing the same thing, increasing their espionage spending against you.
Answer: I'm afraid this is little more than speculation, but I've noticed that the Sabotage Building spy mission is sometimes greyed out, and I suspect it's because the AI has a spy present in that city.
The mechanics for human-vs-human spies seem different so I can't confirm.
An AI city with spy present:

An AI city with spy not present:


How can i monitor and pass variables in azure data factory foreach activity?

Question: I'm following this guide:
https://medium.com/geekculture/create-an-array-of-dates-for-looping-in-azure-data-factory-da148e01bc10
When i have set it up and try to pass the variable into the next forEachStatment i dont understand how it should work.

Inside the last ForEach i have a copy activity to copy a file from a URL that has a dynamic filename based on date, and i try to get the array-element from the array and insert into the RelativeUrl, but it does now work for me:

1. How can i monitor the array 'daystoiterateover' content ?
2. How do i pass it on to my next forEach loop? I tried to access it by @item in a Realative URL, but it is not recognized.
Additional info, the foreach "item" is accessible in dynamic expression when choosing the "Request Method" on the CopyData activity (indicating its created):
Comment: I found out that to use it in RelativeUrl of the sink, i need to define/link the variables as "dataset variables". "Relative URL @dataset().relativeURLs". Still i wonder how i can monitor the content of the output array of the first ForEach function thouth.. ?
Answer:
It seems that you are trying to use the dynamic content <code>@item()</code> in the dataset of the copy activity. And hence it is not recognized within the dataset. The following is the image of same warning message when I tried to replicate this behavior.

However, as long as this pipeline is not used in any other pipeline (at least ones which are not similar to current pipeline), then this warning message would not matter.

So, you can pass the value as it is to the 2nd for each loop and use it in the same way. To monitor, you can use the set variable activity and monitor its value over each iteration.
Comment: By "variable activity", do you mean "Append variable" or "Set variable", and does it display values during "Debug" triggering of  the pipeline?
Comment: Its set variable activity, and yes, it displays values during debug


Importance of a basic sequence in Banach Space Theory

Question: In Classical Banach Spaces I and II by Lindenstrauss and Tzafriri, their first definition in page $1$ is as follows:

A sequence $\{x_n\}_{n=1}^\infty$ in a Banach space $X$ is called a Schauder basis of $X$ if for every $x\in X$ there is a unique sequence of scalars $\{a_n\}_{n=1}^\infty$ so that $x = \sum_{n=1}^\infty a_nx_n.$ A sequence $\{x_n\}_{n=1}^\infty$ which is a Schauder basis of its closed linear span is called a basic sequence.

In Topics in Banach Space Theory $2$nd edition by Albiac and Kalton, they quoted the following in page $6:$

As the reader will quickly realize, basis sequences are of fundamental importance in the theory of Banach spaces and will be exploited throughout this volume.

After reading the two sentences, I have the following question.

Question: Why are basic sequences so important that we need to have a definition for it?
Comment: Schauder basis are like usual basis in finite dimensional spaces. It is very useful to have such a thing, they are generators of the space and give you an explicit form to write any element of it. Since you are also interested in subspaces this reasoning extends to basic sequences. There are likely other reasons why it is useful to find out that a sequence you are looking at has the property of being a basic sequence.
Answer: Basic sequences are a useful tool for identifying the isomorphic structure of Banach spaces.  In particular, a basic sequence that is not a basis generates a closed subspace of the ambient Banach space $X$ so if we have a basic sequence that is isomorphic to (say) $c_0$ or $\ell_1$ then we know $X$ possesses such subspaces.  Much work has been done on complemented subspaces of Banach spaces, so all of this body of knowledge can then be brought to bear.
In fact, finding a Banach space ${\cal T}$ that has no subspace isomorphic to $c_0$ or $\ell_1$ was hard enough that the Tsirelson space wasn't found until $1974$, followed later by the Gowers-Maurey space.  Moreover, there was a proposed Polymath project in $2009$ that asked if every 'explicitly defined' Banach space necessarily contained either $c_0$ or $\ell_1$.
Since a basic sequence is always dense in its closed linear span the subspace of $X$ that it generates must be separable (and note that Enflo's example of a non-separable Banach space with basis was only found in $1973$), and separable Banach spaces are usually easier to work with.  Combining this with the complemented subspace work mentioned above, we again see that we can determine a lot about a Banach space from knowing about its basic sequences.
If a Banach space $X$ possesses a basis we cannot, unfortunately, conclude that $X^*$ has a basis.  Indeed, let $X=\ell_1$; then $X^*=\ell_\infty$ which is non-separable and hence possesses no basis.  However, whenever we have co-ordinate functionals $\{x^*_n\}_{n \in {\mathbb N}}$ for which $x^*_n(x) = x_n \quad \forall n \in {\mathbb N} \ \forall x \in X$ we do know that $\{x^*_n\}_{n \in {\mathbb N}}$ is a basic sequence in $X^*$.  Also, a result of Mazur tells us that ever non-trivial weakly-null sequence possesses a basic subsequence, so it is apparant that basic sequences are easier to find that actual bases.
So: a basic sequence can tell us a lot about a Banach space and is often easier to find than a basis, which makes them important in the theorist's toolkit.


How to produce an EVA report

Question: I'm in carreer mode, I've finally managed to reach the orbit, I see the EVA button, but when I'm outside the only thing I can do is to climb the ladder up and down and eventually get lost in space :)
I read a few pages of the wiki, but I can't find the way to produce an EVA report.
Any help please?
And to send the report back with the antenna?
Answer: You generate the EVA report in a similar way as any other experiment or crew report. When you are performing EVA, right click your astronaut and you should see an option "EVA report". Now you just have to keep the data and get back into the ship. From there you can either transmit it (with 100% efficiency) or keep it until you land back on Kerbin.
Comment: Pretty sure EVA reports only get [50% transmission efficiency](http://wiki.kerbalspaceprogram.com/wiki/Science#EVA_Reports), and it may even be lower than that due to transmission caps.
Comment: Give me a few minutes and I'll check, although I am pretty sure I saw it with 100% efficiency.
Comment: One of the biggest changes in 0.23 was changing the science system so that you can't get away with repeatedly sampling and transmitting. Also the Science Jr. and goo container need a new part in order to be re-prepped after transmitting data.
Comment: As KSP is very much in development, with major updates hitting every couple of months - checking these facts are definitely best done in the game, rather than from a wiki source.
Comment: Thank you, it worked :) Yes, I see 50% efficiency, but I don't even have a comm device...
Comment: Heeere I am. http://i.imgur.com/2R3kmyD.jpg during the EVA and http://i.imgur.com/VL5BykD.jpg once back inside the ship. Only the basic antenna is equipped. The version is 0.23.0.395, in which science received a lot of tweaks.
Comment: @Humungus huh, I wouldn't have thought would been changed.  The wiki is still out of date, and I haven't played in .23 yet.

How to produce an EVA report


Ubuntu 14.10 Network problems

Question: I installed Ubuntu 14.10 a week ago. Everything was ok except some minor audio problems which I detailed in a previous post.
Currently as far as I can see networking is not working at all
- no wireless if I'm on Wi-Fi
- no Internet if I'm on cable
It also doesn't work in safe mode.
I tried most of the things I have seen on forums at network problems (changing failsafe config, changing networking config, etc). Currently I just left the first 2 lines for network config as described in this question: "waiting for network configuration" Problem
Comment: How about: lspci -nn | grep 0280 Thanks.
Comment: Let's see if there are any errors in the log when you load the driver: sudo modprobe iwlwifi && dmesg | grep iwl If the output is lengthy, post it here and give us the link: http://paste.ubuntu.com
Comment: Looks pretty normal so far. How about iwconfig; dmesg | grep wlan. Paste as well, please.
Comment: Chat? http://chat.stackexchange.com/rooms/18620/conversation-with-paxroman
Comment: Can you tell us which network adapter you're using? Run `lspci | grep -i wlan` to see the available adapters.
Comment: @jessenorton Nothing happens if I run that command. However it worked until this afternoon. My laptop is this one: http://www.tlbhd.com/asus-n551jk-review-19227/
Comment: @chili555 This worked. I got 04:00.0 Network controller [0280]: Intel Corporation Wireless 7260 [8086:08b1] (rev 6b)
Comment: @chili555 The output is longer than the text of the comment, but not that lengthy... Still. Here is the link: http://paste.ubuntu.com/8988289/
Comment: @chili555 I am on chat now
Answer: It worked after reinstalling resolvoncf, as described in this link: "ping: unknown host google.com" but IP's works fine
<code>sudo apt-get remove --purge resolvconf && sudo apt-get install --reinstall resolvconf
</code>
Thanks to @chilli555 for walking me through the first stages of the problem.
Comment: I see similar issues, but this didn't solve anything.
Comment: @Andy This is the solution if you are already connected to the network - so if you can check if you are connected to your network first, then if you run this command it should work.

Ubuntu 14.10 Network problems


Which of these drivers would help my computer resume from suspend?

Question: When I resume from suspend, I get a garbled display for a half-minute and then I will either get to the lock screen for the session I had or else booted back to the greeter, with my session and open applications/files lost.
Would switching to Noveau help this? I'm asking because the last time I went fiddling with the dialog shown below I ended up not able to get a desktop at all and having to reinstall.
I've pasted the output of dmesg here|: http://pastebin.ubuntu.com/11626556/
Answer: Nvidia-304 drivers badly support old 7xxx video adapters.
There may be other issues, not only with suspend.
I suggest using Nouveau (last one) or nvidia-173.
Nvidia-173 may perform a little better, but nouveau has a decent support of 7xxx.
Try both. Leave the one, which performs better.
If you have Ubuntu 14.04.2, nvidia-173 will not install.
You will have to lower the version of xserver to original in 14.04.
This can be done by
<code>sudo apt-get install xserver-xorg libgles1-mesa libgles2-mesa libgl1-mesa-glx libgl1-mesa-glx:i386 libglapi-mesa:i386 libegl1-mesa-drivers

Then nvidia-173 should install by

sudo apt-get install nvidia-173
</code>
Comment: Thanks Pilot6. Well before I saw your answer I tried Noveau and my sessions kept locking up completely after login. No keyboard, no mouse. I had to do a hard reboot. So I'm back on nvidia-304 for now for my MSI 7600 GT. But I will try 173 now that you mention it, thank you.
Comment: Trying 173 gave problems: nvidia-173: Depends: x11-common (>= 1:7.0.0) but 1:7.7+1ubuntu8.1 is to be installed
            Depends: xorg-video-abi-15 but it is a virtual package. So looks like I'm stuck with 304.
Comment: You are not stuck. Do you have a 32- or 64-bit system?
Comment: My installation is 64-bit.
Comment: I updated the answer. 173 will be better.
Comment: I was left at a blinking cursor so I went back to 304. But thanks for your answer, I've learned a lot about changing configuration without a gui.


Partially finished basement conduit?

Question: Took down the drop ceiling to paint it black and am installing new recessed lighting and cleaning up/ fixing the terrible wiring job i discovered after removing the ceiling. My question, along some of the painted cinder block walls there will be outlets, can my conduit stop once at the ceiling or should i just run all junction boxes/lights/outlets in conduit ?
Comment: pictures added, and i took the tour thank you!
Comment: Hello, and welcome to Home Improvement. Good question, but could you add a picture of the area? And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know how best to participate here.
Comment: Glad to help. If you like @Jack's answer, you can upvote it and/or choose it as the "correct" answer. Your call.
Answer: The service panel
First, that tiny 16-space panel is already super-full, and way to small for any civilized sort of house. As you refinish that basement, provision space for either

Fitting a subpanel directly beneath it (or anywhere else in the house that is convenient).  I recommend a 30-space/30-60 "circuit" so you finish with 44 spaces (30+16-2).  A main-lug subpanel is fine.
Replacing the main panel with a 40-space, however this is intrusive and/or expensive.

The 30-40 space new panel will certainly have a higher amp bus rating than your current service; that is desirable, it's like fitting VR tires (130mph) on your car instead of R tires (85 mph) even though you don't exceed 85.  If you replace the main panel the new main breaker will surely be 225A, change it to whatever size the electric company tells you to.
I boggle at what is going on with the wood framing around the panel.  It looks like the framing is proud of the panel and giving it side clearance, with cables running along the sides of the panel.  That's fine, but more room should be given so you aren't bunching >4 cables together, and so you can practically use the plentiful side knockouts on the panel.
Conduit vs. wire guard
There are two ways to use conduit:

as a random piece of metal to guard/protect wires run in a cable wiring method, this involves monkey-wrestling balky cable down the pipe.
as the conduit wiring method, wherein you are entitled to use individual wires (and even stranded wire, which is wonderful to work with, though tricky to terminate at a non-screw-to-clamp outlet or switch)

You can transition between the cable wiring method and conduit wiring method at any junction box.  That's important because  given the framing around that service panel, it may be challenging to get conduit all the way to it.
Comment: wow thank you, there is a sub panel in the basement also but i will be replacing the pictured panel as it is at its max and outdated. Thank you again for the awesome answer
Answer: Wire needs to be protected from damage where it is exposed, and when it's up between the joists it's not considered to be exposed, but running along the underside of them it is, as it could be damaged, so you'd need conduit there too. I'm not sure if a drop ceiling would be considered as offering protection.
It looks a lot neater if you drill holes through the joists (in the middle) for runs that go across the them, and then staple the wire along the side of the joist to go in the other direction. If you stop the conduit at the top of the wall, you need a bushing or wire clamps where the wire exits to prevent it running across the sharp edge of the conduit.
Answer: You might as well do the entire job in conduit if you're going from the outlets to the ceiling in conduit. It will give you some flexibility in adding circuits in the future. Have you used conduit before?
Comment: im fine with doing it all conduit, i have limited experience in it but will have help from people with experience. Its such a mess, it will almost be easier to rip out the mess of romex and start over.
Comment: I wouldn't trust anything in there...Good luck and stay safe.

Partially finished basement conduit?


handle 12GB data upload in Play Framework?

Question: I am trying to upload a file of size 12GB ,my RAM size is  4GB so ,i am able to upload only 2GB files i am not getting any idea on how to proceed further. Any help is highly appreciable
Comment: It probably could depend on the operating systems (and processors), both on the client side (your laptop) and on the server side. Some 32 bits filesystems limit size to 2Gbytes. Try using 64 bits operating systems (and JVMs). BTW, are you sure you have the bandwidth and time to upload such a big file. Can't you split it into smaller pieces (e.g. using [csplit](http://www.computerhope.com/unix/ucsplit.htm) or some equivalent).
Comment: but i want to divide it using my program so that once i upload the smaller files i can merge it into single file as it was in the initial stage.any idea?
Comment: Yes it is possible to merge several files (e.g. obtained by splitting) into one. On Posix systems you'll use the [cat](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html) command.
Comment: yes i too know this but what i asked you is i want it to be done automatically ,i mean my application will ask the user to select a file to upload then the application will divide it and then upload it, after upload is done it merge it again into a single file.any idea on this?
Comment: I believe you have a wrong approach and a wrong design. Consumer users should not even expect to upload a 12Gb file without great pain (and a lot of time, that they don't have).
Comment: may be but because i am struck here so could you provide me some information on how to split it using a code in the program
Comment: possible duplicate of [uploading a 15 Gb file and downloading it in playframework for java.is it possible?](http://stackoverflow.com/questions/19086449/uploading-a-15-gb-file-and-downloading-it-in-playframework-for-java-is-it-possib)
Answer: This won't work, send it by FTP or a Javascript/AJAX uploader instead.
HTTP is not a good protocol to choose for this.. the filesize is ridiculously far beyond the known limitations of HTTP servers and gateways. The server has to buffer the upload before it can be handled, and your filesize will exceed most known buffers.
HTTP uploads are often expected to handle 5MB - 50MB and limited in the 5MB - 200MB range. Proxy servers & network infrastructure will likely also impose their own limits.
See also: What is the maximum file size I can transfer using HTTP? And using FTP?
Comment: Don't upload 12Gb data. Sell the service of loading a pack of DVDs (or a hard disk, or an SSD, or a USB key) containing them.
Comment: any idea how to do upload 12Gb data using FTP or javascript?


How to find explicit formula for the following isometry?

Question: I want to transform smoothly (and if possible by rotation) $(2,0,0,0)$ to $(1,1,1,1)$ in Euclidean space isometrically. How to find explicit formula for this transformation?
Thanks.
Answer: There are many such rotations. Let's first make an orthonormal basis so that one of the rotations only touches the first two coordinates. One such basis is
$$
(1,0,0,0)\\
\frac{1}{\sqrt3}(0,1,1,1)\\
\frac{1}{\sqrt2}(0,1,-1,0)\\
\frac{1}{\sqrt6}(0,1,1,-2)
$$
In this basis, your vectors become $(2,0,0,0)$ and $\left(1, \sqrt3,0,0\right)$. That's a rotation through $\pi/3$ radians. So in this basis, the rotation has matrix
$$
\begin{bmatrix}
\cos(\pi/3) & -\sin(\pi/3)&0&0\\
\sin(\pi/3) & \cos(\pi/3)&0&0\\
0&0&1&0\\
0&0&0&1
\end{bmatrix}
$$
(If you want the whole rotation as an actual movement, not just an instantaneous transformation, just insert a $t$ next to all the $\pi$'s and let it vary from $0$ to $1$.) Finally, to get your rotation in the standard basis, we have to transform this matrix to your basis. That means that the final result is
$$
\begin{bmatrix}
1&0&0&\vphantom{\frac1{\sqrt2}}0\\
0&\frac{1}{\sqrt3}&\frac{1}{\sqrt2}&\frac1{\sqrt6}\\
0&\frac{1}{\sqrt3}&\frac{-1}{\sqrt2}&\frac1{\sqrt6}\\
0&\frac{1}{\sqrt3}&0&\frac{-2}{\sqrt6}
\end{bmatrix}
\times
\begin{bmatrix}
\cos(\pi/3) & -\sin(\pi/3)&\vphantom{\frac1{\sqrt2}}0&0\\
\sin(\pi/3) & \cos(\pi/3)&0\vphantom{\frac1{\sqrt2}}&0\\
0&\vphantom{\frac1{\sqrt2}}0&1&0\\
0&0\vphantom{\frac1{\sqrt2}}&0&1
\end{bmatrix}
\times
\begin{bmatrix}
1&\vphantom{\frac1{\sqrt2}}0&0&0\\
0&\frac{1}{\sqrt3}&\frac{1}{\sqrt3}&\frac1{\sqrt3}\\
0&\frac{1}{\sqrt2}&\frac{-1}{\sqrt2}&0\\
0&\frac{1}{\sqrt6}&\frac{1}{\sqrt6}&\frac{-2}{\sqrt6}
\end{bmatrix}
$$
where I've used that the inverse of an othogonal matrix is its transpose.
Note on how I came up with the basis: I wanted the first basis vector to be a unit vector in the direction of $(2,0,0,0)$, because that's easy and means that as long as all other vectors have $0$ as first component they will be orthogonal to that one. I wanted the second unit vector to be one that makes the $(1,1,1,1)$ be in the span of the first two basis vectors. So those two pretty much found themselves.
I just picked the third one because it was a vector obviously orthogonal to the previous two. By then, the last one was fixed: I wanted it to be orthogonal to the third basis vector, so the second and third component had to be equal, and I wanted it to be orthogonal to the second basis vector, so that forced the final component. Finally, I scaled them to be unit length.
Comment: Thank you. Is this works as well for $e_i$ instead of first four vectors?
Comment: If you carry out the matrix multiplication that I wrote down, you get the matrix representing the same rotation but in the standard basis.
Comment: Can be extend this matrix to any dimension?
Comment: Sure. It's slightly more work to find a basis, and of course the less nice your original vectors are the more difficult it gets to find a basis. But there is nothing in this method that is specific to four dimensions, no.
Answer: Let $b=\{e_1,e_2,e_3,e_4\}$ be the standard basis of $\mathbb{R}^4$. Let

$u_1=(1,1,1,1)$;
$u_2=(1,-1,0,0)$;
$u_3=(0,1,-1,0)$;
$u_4=(0,0,1,-1)$.

Apply Gram-Schmidt to $\{u_1,u_2,u_3,u_4\}$, thereby obtaining an orthonormal basis $b'=\{f_1,f_2,f_3,f_4\}$ of $\mathbb{R}^4$. Of course, $f_1=\frac12(1,1,1,1)$. Finally, consider the map $T\colon\mathbb{R}^4\longrightarrow\mathbb{R}^4$ such that $(\forall j\in\{1,2,3,4\}):f(e_j)=f_j$. Then $T$ is an isometry and $T(2,0,0,0)=(1,1,1,1)$.
Comment: Is there a canonical way for considering $u_i$'s?
Comment: @C.F.G Not that I know of. However, note that I chose them so that $u_2$, $u_3$ and $u_4$ are orthogonal to $u_1$, so that applying Gram-Schmidt will be easier.


Must concrete foundation be dry to seal cracks and seams?

Question: I have a 1960s concrete foundation.  There are some small cracks in the floor.  During the last [epic] rainfall, they started to seep water.  I'd like to seal them.  Also, the seam where the concrete floor and concrete walls meet is letting water in.  I'd like to seal this, too.  I do recognize that an external drainage issue is the problem.  I am looking for a now/before the next storm solution.
I know there are many DIY concrete sealer solutions available,  but here is my question.   Do i need to wait until the concrete is dry to seal it?
Comment: It shouldn't be a problem, as long as there is no running water, and the surface is clean. Usually, before applying new patching, the old concrete should be kept in a moist but surface-dry condition. You can also adjust the amount of mixing water for the sealing material if cement-based material is used.
Comment: You're trying to make a bathtub out of your foundation. That won't work. Water will always find a way. Instead, look into a sump drain or other means of _removing_ the water. You need to eliminate the static pressure under the slab.
Answer: Depends on the sealer/repair.
I know hydraulic cement is suppose to work with running water/water coming in, but I imagine dry clean cement/concrete will work the best for most of them.
Hydraulic cement you are suppose to make an inverted V shape, small at the surface and wider deeper in, into the crack.
Repairing from the outside is the best long term(forever) repair.
Answer: If it's coming through the floor, that means you have water under your slab.  Since you say it comes through the joint between slab and walls, it means the water table comes up higher than your floor.  It is very hard to seal water leaks from the inside.  Your best bet here is to prevent the water from getting into the soil near your house in the first place (assuming you don't have a naturally high water table).

Gutters and downspouts; any downspouts should daylight as far from
the house as possible, at least 10'.

French drain around your foundation.

If you have a high water table, it's likely your only hope is to install a sump pit in your floor—basically dig a hole, insert a perforated bucket, and an electric pump.  You might need an interior french drain too, connected to the sump pit.


Python Qt QListWidget Items Drag and Drop

Question: How to move QListWidgetItem another row? Can i use drag and drop method?
Example:
    QListWiget items:
item1
item2
item3
item4

item3 dragged and dropped. After:
item3
item1
item2
item4

I looked at this  resource but i don't understand anything.
Answer: You don't need dropMimeData if all you need is internal drag&drop. That is used for things that are dropped from out of the widget. Item views (and their widget companions) come with internal drag/drop move implemented. You need to use InternalMove for setDragDropMove.
Simple example:
import sys
from PyQt4 import QtGui

app = QtGui.QApplication(sys.argv)

lw = QtGui.QListWidget()
lw.setDragDropMode(lw.InternalMove)
for i in range(10):
    item = QtGui.QListWidgetItem('item %d' % i, lw)
lw.show()

sys.exit(app.exec_())

Comment: Qt really should have a bold section in all their drag/drop stuff that if you want to simply move stuff around within a window, that is not the same as invoking the sometimes complex drag and drop mechanisms (using MIME data types) used to shuffle data between elements. The term 'drag and drop' is much more general than that, and a lot of people get confused by this. I know I did.


Disadvantages to using NTFS as main storage drive?

Question: I'm dual-booting with Windows 10. Right now, my partition setup is like this:

20GB /
10GB /home
70 GB "Linux stuff" (~/Downloads, ~/Documents, etc. all softlink to folders here)
300GB Windows (NTFS)

The problem is, sometimes there's lots of space in "Linux Stuff" with not much space in Windows, and sometimes the opposite is true.
What I'd like to do is to just merge the Linux-stuff and Windows partitions. I'd create a "linux" folder in the Windows partition, and softlink ~/Downloads, ~/Documents, ~/Pictures, and such there.
Are there any "gotchas" to doing this, using NTFS for most of my Linux files? In particular:

Is the NTFS access stable?
Is the NTFS access considerably slower than EXT?
Are there any other hidden disadvantages to doing this? Does it interfere with indexing/searching of my files, open file dialogues, etc?
Comment: Well for one thing, *AFAIK*, not only does Linux **not** support NTFS permissions; it completely ignores them.
Comment: Probably not...
Comment: That's understandable since NTFS has ACLs rather than file permissions. They are somehow similar but not the same thing.
Comment: @AndroidDev Would that still be concern on a single-user system, i.e. a laptop with only one account?
Comment: Have you considered going the other way instead, and carving out a big partition for your data that's `ext2`, shrinking your Windows partition to just be what's required for the OS and programs itself, and installing an `ext2` driver for Windows so it can also access it?
Comment: The permissions/file types thing will bite you. When I tried this, every old Windows file of every kind was marked as executable, so every time you doubleclick to open a file, you get asked if you want to execute it.
Answer: You could link in a windows file system like that and it would work. Linux wouldn't have an issue.  The real issue you would run into is with windows if linux decided to rearrange the partition to accommodate incoming files.  It's rare but linux can break windows like this. I learned the hard way.
Why don't you just get a flash drive and use that?
Comment: Yeah, a 300GB flash drive... I'm looking to store my files, not just transfer some things back and forth.


Creating an array within a Ruby object class

Question: I just want to write a Ruby script (no rails) with a class that contains an array of ids. Here is my original class:
# define a "Person" class to represent the three expected columns
class Person <

  # a Person has a first name, last name, and city
  Struct.new(:first_name, :last_name, :city)

  # a method to print out a csv record for the current Person.
  # note that you can easily re-arrange columns here, if desired.
  # also note that this method compensates for blank fields.
  def print_csv_record
    last_name.length==0 ? printf(",") : printf("\"%s\",", last_name)
    first_name.length==0 ? printf(",") : printf("\"%s\",", first_name)
    city.length==0 ? printf("") : printf("\"%s\"", city)
    printf("\n")
  end
end

Now I would like to add an array called ids to the class, can I include it in the Struct.new statement like Struct.new(:first_name, :last_name, :city, :ids = Array.new) or create an instance array variable or any define separate methods or something else?
I would like to then be able to do things like:
p = Person.new
p.last_name = "Jim"
p.first_name = "Plucket"
p.city = "San Diego"

#now add things to the array in the object
p.ids.push("1")
p.ids.push("55")

and iterate over the array
p.ids.each do |i|
  puts i
end

Comment: You should really be using `print` and `puts`, not `printf`.
Answer: Assuming I understand what you want, it's this simple. Add this to your Person class:
def initialize(*)
  super
  self.ids = []
end

Answer: # define a "Person" class to represent the three expected columns
class Person
 attr_accessor :first_name,:last_name,:city ,:ids
#  Struct.new(:first_name, :last_name, :city ,:ids) #used attr_accessor instead  can be used this too

def initialize
     self.ids = [] # on object creation initialize this to an array
end
  # a method to print out a csv record for the current Person.
  # note that you can easily re-arrange columns here, if desired.
  # also note that this method compensates for blank fields.
  def print_csv_record
    print last_name.empty? ? "," : "\"#{last_name}\","
    print first_name.empty? ? "," : "\"#{first_name}\","
    print city.empty? ? "" : "\"#{city}\","
    p "\n"
  end
end

p = Person.new
p.last_name = ""
p.first_name = "Plucket"
p.city = "San Diego"

#now add things to the array in the object
p.ids.push("1")
p.ids.push("55")

#iterate
p.ids.each do |i|
  puts i
end


How to package PySide2 applications for distribution?

Question: I has used CXFreeze in past to package python applications but in most cases the installer packages build thru CXFreeze failed to install when I distributed it to other users.
Is there a better way to create distributable for Pyside2 applications?
Answer: Try pyinstaller. I also do PySide2 projects and this installer works fine for me at least for windows applications. See https://pythonhosted.org/PyInstaller/.