text:
Q: Making UIProgressView Rounded corners I have created a UIProgressView with following properties
progressView.progressTintColor = UIColor.appChallengeColorWithAlpha(1.0)
progressView.trackTintColor = UIColor.clearColor()
progressView.clipsToBounds = true
progressView.layer.cornerRadius = 5

I am using a UIView for border. It appears like his progress = 1, which is exactly the way I want.

But if progress value is less then 1. Corners are not rounded as it should be.

Am I missing something ? How can I make it rounded corner ?

A: Just do this in init
    layer.cornerRadius = *desired_corner_radius*
    clipsToBounds = true

A: It's very late to answer but actually I had the same problem.
Here my simplest solution (no code needed !) :

*

*Add a container to embed your progress view

*Round corner for your container (10 = height of container / 2)

*The result :)

A: After searching and trying I decided to create my own custom progress view. Here is the code for anyone who may find them selevs in same problem.
import Foundation
import UIKit

class CustomHorizontalProgressView: UIView {
var progress: CGFloat = 0.0 {

    didSet {
        setProgress()
    }
}

override init(frame: CGRect) {
    super.init(frame: frame)

    setup()
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)

    setup()
}

func setup() {
    self.backgroundColor = UIColor.clearColor()
}

override func drawRect(rect: CGRect) {
    super.drawRect(rect)

    setProgress()
}

func setProgress() {
    var progress = self.progress
    progress = progress > 1.0 ? progress / 100 : progress

    self.layer.cornerRadius = CGRectGetHeight(self.frame) / 2.0
    self.layer.borderColor = UIColor.grayColor().CGColor
    self.layer.borderWidth = 1.0

    let margin: CGFloat = 6.0
    var width = (CGRectGetWidth(self.frame) - margin)  * progress
    let height = CGRectGetHeight(self.frame) - margin

    if (width < height) {
        width = height
    }

    let pathRef = UIBezierPath(roundedRect: CGRect(x: margin / 2.0, y: margin / 2.0, width: width, height: height), cornerRadius: height / 2.0)

    UIColor.redColor().setFill()
    pathRef.fill()

    UIColor.clearColor().setStroke()
    pathRef.stroke()

    pathRef.closePath()

    self.setNeedsDisplay()
}
}

Just put above code in a swift file and drag drop a UIView in IB and give it class CustomHorizontalProgressView. and That is it.

A: Another answer to throw in the mix, super hacky but very quick to use.
You can just grab the sublayer and set its radius. No need to write your own UIProgressView or mess with clip paths.
progressView.layer.cornerRadius = 5
progressView.layer.sublayers[1].cornerRadius = 5
progressView.subviews[1]. clipsToBounds = true
progressView.layer.masksToBounds = true

So you round the corner of your overall UIProgressView (no need for ClipsToBounds)
Then the fill bar is the 2nd sublayer, so you can grab that and round its Corners, but you also need to set the subview for that layer to clipsToBounds.
Then set the overall layer to mask to its bounds and it all looks good.
Obviously, this is massively reliant on the setup of UIProgressView not changing and the 2nd subview/layer being the fill view.
But. If you're happy with that assumption, super easy code wise to use.

A: Basically progress view's (Default Style) subviews consist of 2 image view.
One for the "progress", and one for the "track".
You can loop the subviews of progress view, and set the each of image view's corner radius.
for let view: UIView in self.progressView.subviews {
    if view is UIImageView {
        view.clipsToBounds = true
        view.layer.cornerRadius = 15
    }
}

A: UIProgressView has two part, progress part and track part. If you use Reveal, you can see it only has two subviews. The progress view hierarchy is very simple. so...
Objective-C
- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.progressView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        obj.layer.masksToBounds = YES;
        obj.layer.cornerRadius = kProgressViewHeight / 2.0;
    }];
}

Swift (3, 4 and 5+)
override func layoutSubviews() {
    super.layoutSubviews()
    subviews.forEach { subview in
        subview.layer.masksToBounds = true
        subview.layer.cornerRadius = kProgressViewHeight / 2.0
    }
}

I admit subclass or extend progressView is the recommended way. In case of you don't want to do that for such a simple effect, this may do the trick.
Keep the situation that Apple will change the view hierarchy, and something may go wrong in mind.

A: Yes ,one thing is missed...corner radius is set to progressview and it is reflecting as expected..
But if you want your track image to be rounded you have to customise your progressview.
You have to use image with rounded corner.
[progressView setTrackImage:[UIImage imageNamed:@"roundedTrack.png"]];
//roundedTrack.png must be of rounded corner

This above code will help you to change image of trackView for your progressview.
You may face the inappropriate stretching of image. You have to make your image resizable.
May be the link below will be useful if issue arise
https://www.natashatherobot.com/ios-stretchable-button-uiedgeinsetsmake/

A: class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let v = ProgessView(frame: CGRect(x: 20, y: 200, width: 100, height: 10))
        view.addSubview(v)

        //v.progressLayer.strokeEnd = 0.8

    }
}

class ProgessView: UIView {

    lazy var progressLayer: CAShapeLayer = {
        let line = CAShapeLayer()
        let path = UIBezierPath()
        path.move(to: CGPoint(x: 5, y: 5))
        path.addLine(to: CGPoint(x: self.bounds.width - 5, y: 5))
        line.path = path.cgPath
        line.lineWidth = 6
        line.strokeColor = UIColor(colorLiteralRed: 127/255, green: 75/255, blue: 247/255, alpha: 1).cgColor
        line.strokeStart = 0
        line.strokeEnd = 0.5
        line.lineCap = kCALineCapRound
        line.frame = self.bounds
        return line
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor.white
        layer.cornerRadius = 5
        layer.borderWidth = 1
        layer.borderColor = UIColor(colorLiteralRed: 197/255, green: 197/255, blue: 197/255, alpha: 1).cgColor
        layer.addSublayer(progressLayer)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}

Test my codes. You can design the height and the width as your want. You can use strokeEnd to change the progress of the progressView. You can add an animation to it. But actually, it is already animatable, you can change the value of the strokeEnd to see its primary effect. If you want to design your own animation. Try CATransaction like below.
func updateProgress(_ progress: CGFloat) {
        CATransaction.begin()
        CATransaction.setAnimationDuration(3)
        progressLayer.strokeEnd = progress
        CATransaction.commit()
    }

A: I had this exact same problem, which is what led me to your question after googling like crazy. The problem is two-fold. First, how to make the inside of the progress bar round at the end (which 季亨达's answer shows how to do), and secondly, how to make the round end of the CAShapeLayer you added match up with the square end of the original progress bar underneath (the answer to this other StackOverflow question helped with that How to get the exact point of objects in swift?) If you replace this line of code in 季亨达's answer:
path.addLine(to: CGPoint(x: self.bounds.width - 5, y: 5))
with this:
path.addLine(to: CGPoint(x: (Int(self.progress * Float(self.bounds.width))), y: 5))
you will hopefully get the result you're looking for.

A: With swift 4.0 I'm doing in this way:
let progressViewHeight: CGFloat = 4.0

// Set progress view height
let transformScale = CGAffineTransform(scaleX: 1.0, y: progressViewHeight)
self.progressView.transform = transformScale

// Set progress round corners
self.progressView.layer.cornerRadius = progressViewHeight
self.progressView.clipsToBounds = true

A: //Updated for swift 4
import Foundation
import UIKit

class CustomHorizontalProgressView: UIView {
var progress: CGFloat = 0.0 {

    didSet {
        setProgress()
    }
}

override init(frame: CGRect) {
    super.init(frame: frame)

    setup()
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)

    setup()
}

func setup() {
    self.backgroundColor = UIColor.clear
}

override func draw(_ rect: CGRect) {
    super.draw(rect)

    setProgress()
}

func setProgress() {
    var progress = self.progress
    progress = progress > 1.0 ? progress / 100 : progress

    self.layer.cornerRadius = self.frame.height / 2.0
    self.layer.borderColor = UIColor.gray.cgColor
    self.layer.borderWidth = 1.0

    let margin: CGFloat = 6.0
    var width = (self.frame.width - margin)  * progress
    let height = self.frame.height - margin

    if (width < height) {
        width = height
    }

    let pathRef = UIBezierPath(roundedRect: CGRect(x: margin / 2.0, y: margin / 2.0, width: width, height: height), cornerRadius: height / 2.0)

    UIColor.red.setFill()
    pathRef.fill()

    UIColor.clear.setStroke()
    pathRef.stroke()

    pathRef.close()

    self.setNeedsDisplay()
 }
}

A: Swift 4.2 version from Umair Afzal's solution
class CustomHorizontalProgressView: UIView {

var strokeColor: UIColor?

var progress: CGFloat = 0.0 {
    didSet {
        setNeedsDisplay()
    }
}

override init(frame: CGRect) {
    super.init(frame: frame)
    setup()
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    setup()
}

func setup() {
    self.backgroundColor = UIColor.clear
}

override func draw(_ rect: CGRect) {
    super.draw(rect)
    setProgress()
}

func setProgress() {

    var progress = self.progress
    progress = progress > 1.0 ? progress / 100 : progress

    self.layer.cornerRadius = frame.size.height / 2.0
    self.layer.borderColor = UIColor.gray.cgColor
    self.layer.borderWidth = 1.0

    let margin: CGFloat = 6.0
    var width = (frame.size.width - margin)  * progress
    let height = frame.size.height - margin

    if (width < height) {
        width = height
    }

    let pathRef = UIBezierPath(roundedRect: CGRect(x: margin / 2.0, y: margin / 2.0, width: width, height: height), cornerRadius: height / 2.0)

    strokeColor?.setFill()

    pathRef.fill()
    UIColor.clear.setStroke()
    pathRef.stroke()
    pathRef.close()
}
}

And to use it
var progressView: CustomHorizontalProgressView = {
    let view = CustomHorizontalProgressView()
    view.strokeColor = UIColor.orange
    view.progress = 0.5
    return view
}()

A: Set line cap :
.lineCap = kCALineCapRound;


text:
Q: Does C have an equivalent to var? I want to set up a variable with any value whatsoever for a program. The best thing I can do is using var, but the var keyword doesn't exist in C.
I tried this code:
#include <stdio.h>

int main() {
    var a = 2;
    puts(a);
}

Then got these errors:
var.c:4:5: error: use of undeclared identifier 'var'
    var a = 2;
    ^
var.c:5:10: error: use of undeclared identifier 'a'
    puts(a);
         ^

If not var, then what's an equivalent for it in C?

A: Scripting languages which are written in C manage to implement this for their variables. However, it is quite complicated.
C needs to know the size of things, so that it can place them into memory correctly. A variable must always be of a known type and size.
In order to have a variable of unknown type, you need to create a struct something like this (off the top of my head, untested but see https://github.com/zlynx/type-union-test):
struct var {
    enum {
        INT,
        OBJ,
        DOUBLE,
    };
    union {
        long i;
        void* p;
        double d;
    };
};

And then functions to operate on everything. Implementing OBJ gets fun because you need more structs defining if it is an array or another var, etc.
Anyway. If you're looking to make programming in C easier then don't try this. Decide up front what your variable is.

A: If you can use pointers, you can use void *:
#include <stdio.h>

int main() {
 char *s = "abc";
 void *a = s;
 puts(a);

 return 0;
}

A: C is statically typed.  That means all variable have a specific type, and all function arguments and return values have a specific type.  Moreover it means that when assigning a variable, passing a parameter or returning a value, the value must either match the specified type or be compatible/convertible to that type within the rules of the language.
This may seem inconvenient, but C is a systems-level language capable interaction directly with memory and I/O efficiently and in a systems level language strong typing is essential.  There is a remarkable amount of code related to supporting weakly types languages; in C it is simply a memory location of the appropriate and fixed size.
In your example you have an integer value 2 in a variable, but you want to print a string using puts() that requires a char* argument referring to a NUL terminated string. The idiomatic C way of solving this problem is yo use a function that will generate a string representation of the integer value.  Because C will not "magically" perform that conversion for you, it has a library that handles the most common conversion and presentation requirements.  In this case:
#include <stdio.h>

int main()
{
    int a = 2;
    printf( "%d\n", a ) ;
}

In this case the printf() uses the %d format specifier to present the integer 2 as a string "2" followed by a newline.  The string "2" being a character with code 0x32 or 50 decimal (assuming ASCII encoding).
If you still think you need a variant, (because clearly in the example it is not at all necessary), then ask a new question with a more concrete example of the problem you are trying to solve - you will no doubt get an answer showing how to solve the problem in C - not all solutions are as easy as this.

A: As others mentioned already, at the end of the day you need to know the type of the variables in order to do something with them.
Besides void * pointers, you may also treat everything as c-strings (nul-terminated buffers of chars), then use any of the C99 strto* family of functions (float*, signed*, unsigned*) to convert them to their intended type on-demand.
For example, the following declares a as a c-string and outputs its float, long int and unsigned long representations:
char *a = "-2.3";
printf( "float: %f\n", strtof(a, NULL) );
printf( "long: %ld\n", strtol(a, NULL, 10) );
printf( "unsigned long: %lu\n", strtoul(a, NULL, 10) );

Output:
float: -2.300000
long: -2
unsigned long: 4294967294

You can do more fancy stuff with those functions (and even more with void * pointers) but neither of them answers exactly your question, because what you asked is not directly supported by C.
Both suggestions fight against the nature of the language. If you are to use C, just learn and use the supporting types (or define your own, which is also well supported).

redpajama_set_name: RedPajamaStackExchange


text:
Q: UICollectionView drag and drop remove translucent cell I'm using iOS 11 drag and drop API for reordering and want to remove translucent cell which appears on start dragging. Is it possible? For dragging I use only required method of UICollectionViewDragDelegate:
- (nonnull NSArray<UIDragItem *> *)collectionView:(nonnull UICollectionView *)collectionView
                     itemsForBeginningDragSession:(nonnull id<UIDragSession>)session
                                      atIndexPath:(nonnull NSIndexPath *)indexPath {
    NSItemProvider *itemProvider = [NSItemProvider new];
    UIDragItem *dragItem = [[UIDragItem alloc] initWithItemProvider:itemProvider];

    return @[dragItem];
}

A: You can customize your cell during the drag/drop lifecycle by overriding dragStateDidChange(_ dragState: UICollectionViewCell.DragState)
class MyCell: UICollectionViewCell {

    //...
    override func dragStateDidChange(_ dragState: UICollectionViewCell.DragState) {

        switch dragState {
        case .none:
            self.layer.opacity = 1
        case .lifting:
            return
        case .dragging:
            self.layer.opacity = 0

        }
    }
}

A: On your cell class override this method:
override func dragStateDidChange(_ dragState: UICollectionViewCell.DragState) {

    switch dragState {
    case .none:

        self.layer.opacity = 1

    case .lifting:

        return

    case .dragging:

        self.layer.opacity = 0
    }
}


text:
Q: Route 53 Configuration - Which is better ALIAS A or ALIAS CNAME RRS Question:
When configuring Route 53 with AWS services such as CloudFront or ELB, which is better to use: an ALIAS A record or an ALIAS CNAME record?
Background:
An interesting thread developed on this question regarding the benefits of ALIAS records.
Thread Link
My intention is to create this question so that informed answers and knowledge can be collected in one place.

A: There is no "better," there's only one correct answer: the Alias RR type must be the same as the target RR.  For CloudFront, S3, ELB, etc., an Alias of type CNAME is not sensible, since the target is not a CNAME, it's an A.
But if the question is a choice between A alias=yes and CNAME alias=no, then A alias=yes is still the better solution.
The assertion at the other question is that Alias records are equivalent to CNAMEs but intended for the zone apex only is incorrect on both counts.
Alias A records cause ultimate behavior similar to CNAME behavior but they are preferred because they cut the DNS resolution time approximately in half by requiring only one resolver action, instead of two, and because they reduce your per-query cost to 0 when the alias target is an AWS service.

A: Both will work, But you are going to want to use ALIAS. ALIAS is better due to the cost.

Queries to Alias records that are mapped to Elastic Load Balancers, Amazon CloudFront distributions, AWS Elastic Beanstalk environments,
  and Amazon S3 website buckets are free.

CNAME lookups have a cost associated with them.($0.400 per million queries).
ALIAS also have automation behind them, Any changes to ELB done by AWS will propagate them to your DNS.


text:
Q: Remove excess info from dataframe I have a big data frame that contains 6 columns. When I want to print the info out of one cell, I use the following code:
df = pd.read_excel(Path_files_data)
info_rol = df.loc[df.Rank == Ranknumber]
print(info_rol['Art_Nr'])

Here Rank is the column that gives the rank of every item and Ranknumber is the Rank of the item i try to look up. How what i get back looks like this:
0    10399
Name: Art_Nr, dtype: object

Here 0 is the rank and 10399 is Art_Nr. How do I get it to work that it only printsout the Art_Nr. and leaves al the crap like dtype: object.
PS. I tried strip but that didnt work for me.

A: I think you need select first value of Series by iat or iloc for scalar:
print(info_rol['Art_Nr'].iat[0])

print(info_rol['Art_Nr'].iloc[0])

If string or numeric output:
print(info_rol['Art_Nr'].values[0])

But after filtering is possible you get multiple values, then second, third.. values are lost.
So converting to list is more general solution:
print(info_rol['Art_Nr'].tolist())


text:
Q: Rest Get method return incorect element name I have a problem with My get method in my restfull web service metgod. I create a controller for My User entity, and I have a variable isActive(boolean):
isActive is a name and in all My code I don't have a simple active word, but when I use postman they return me:
  {
        "userId": 5,
        "emailLogin": "t5.email@be-tse.com",
        "firstName": "Name_5",
        "lastName": "Lastname_5",
        "userDepartment": "SALESFORCE",
        "roles": [],
        "active": false
    }

Last element should be isActive - why it was change? I use lombok it can be a reason?
My entity:
@Getter
@Setter
@Builder
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "USER")
public class User {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "USER_ID")
    private Integer userId;

    @Column(nullable = false, unique = true)
    private String emailLogin;

    private String firstName;

    private String lastName;

    @Column(nullable = false)
    @JsonIgnore
    private String password;

    private boolean isActive;

    @ManyToOne(optional = false)
    @JoinColumn(name = "DEPARTMENT_ID")
    @JsonIgnore
    private UserDepartment userDepartment;

    @ManyToMany
    @JsonIgnore
    @JoinTable(name = "USER_ROLES",
            joinColumns = @JoinColumn(name = "USER_ID"),
            inverseJoinColumns = @JoinColumn(name = "ROLE_ID"))
    private Set<UserRole> roles;

    public User(String emailLogin, String firstName, String lastName, String password, boolean isActive, UserDepartment userDepartment, Set<UserRole> roles) {
        this.emailLogin = emailLogin;
        this.firstName = firstName;
        this.lastName = lastName;
        this.password = password;
        this.isActive = isActive;
        this.userDepartment = userDepartment;
        this.roles = roles;
    }

}

A: You have to set an exact field name
@JsonProperty("isActive")
public boolean isActive() {
    return isActive;
}


text:
Q: How to pass struct with array attribute from Java to SQL stored procedure? I have some types in Oracle.
create or replace
TYPE r_telefone_cand AS OBJECT (
    candidato NUMBER(10,0),
    telefone VARCHAR2(15)
);

create or replace TYPE t_telefone_cand AS TABLE OF r_telefone_cand;

create or replace
TYPE r_candidato AS OBJECT (
    codigo NUMBER(10,0),
    rg VARCHAR2(15),
    cpf NUMBER(15,0),
    nome VARCHAR2(50),
    telefone t_telefone_cand,
);

And I have a procedure insert_candidato that parameter candidato is IN r_candidato
create or replace
PROCEDURE insert_candidato(
    candidato IN r_candidato
) AS ...

But I don't know how to pass the parameter candidato with the collection telefone.
Please, help me.

A: Give a try using JPublisher of Oracle.. !
http://download.oracle.com/docs/cd/B10500_01/java.920/a96658/intro.htm
It helps in interacting with user defined DB objects through Java.

A: You can use SQLData to map a java class to an oracle User Defined type. Check out the docs at http://download.oracle.com/javase/1.4.2/docs/api/java/sql/SQLData.html
In your case you'd need two types to match the db types.


text:
Q: Why does maven download jar from spring repo? I have a mirror in settings.xml and pom.xml like this
settings.xml
  <?xml version="1.0" encoding="UTF-8"?>

  <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <localRepository>${user.home}/.m2/repository</localRepository>

    <pluginGroups>
    </pluginGroups>

    <proxies>
    </proxies>
    <servers>
      <server>
        <id>nexus-release</id>
        <username>username</username>
        <password>password</password>
      </server>

      <server>
        <id>nexus-snapshot</id>
        <username>username</username>
        <password>password</password>
      </server>
    </servers>

    <mirrors>
       <mirror>
        <id>nexus-any</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus any</name>
        <url>http://anyHost:2227/repository/maven-public</url>
      </mirror>
    </mirrors>
    <profiles>
    </profiles>
  </settings>

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.my.projecy</groupId>
<artifactId>my-project</artifactId>
<packaging>pom</packaging>
<version>1.3.0</version>

<modules>
    <module>my-project-pool</module>
    <module>my-project-business</module>
    <module>my-project-web-deploy</module>
    <module>my-project-task-deploy</module>
    <module>my-project-stats</module>
    <module>my-project-bizlog</module>
</modules>

<name>my-project</name>
<description>Educational Administration Offline System</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.RELEASE</version>
    <relativePath/>
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <mybatis.version>1.3.2</mybatis.version>
    <httpClient.version>4.5.5</httpClient.version>
    <maven.plugins.jar.version>3.1.0</maven.plugins.jar.version>
    <maven.plugins.assembly.version>3.1.0</maven.plugins.assembly.version>
    <offline.api.version>1.3.1-SNAPSHOT</offline.api.version>
    <online.api.version>1.3.0-SNAPSHOT</online.api.version>
    <starter.httpclient.version>1.0.0-SNAPSHOT</starter.httpclient.version>
    <lombok.version>1.16.2</lombok.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.my.projecy.starter</groupId>
        <artifactId>httpclient-starter</artifactId>
        <version>${starter.httpclient.version}</version>
    </dependency>

    <dependency>
        <groupId>com.my.projecy</groupId>
        <artifactId>bluesky-common</artifactId>
        <version>1.1-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>com.my.projecy</groupId>
        <artifactId>ea-api-online</artifactId>
        <version>${online.api.version}</version>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>${mybatis.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpClient.version}</version>
        </dependency>

        <dependency>
            <groupId>com.my.projecy</groupId>
            <artifactId>my-project-pool</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.my.projecy</groupId>
            <artifactId>my-project-business</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.my.projecy</groupId>
            <artifactId>my-project-web-deploy</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.my.projecy</groupId>
            <artifactId>my-project-task-deploy</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.my.projecy</groupId>
            <artifactId>ea-api-offline</artifactId>
            <version>${offline.api.version}</version>
        </dependency>

        <dependency>
            <groupId>com.my.projecy</groupId>
            <artifactId>my-project-stats</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.my.projecy</groupId>
            <artifactId>my-project-bizlog</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${maven.plugins.assembly.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

But when I try to compile my project, I get this error:
Could not find artifact com.my.package:httpclient-starter:jar:1.0.0-SNAPSHOT
in spring-snapshot (https://repo.spring.io/snapshot)

*

*I tried to delete all folders under local repo or mvn clean compile -U

*I tried grep "repo.spring.io" with settings.xml and pom.xml and got nothing

*Only use single repo works for me.

Like this:
<mirror>
  <id>my-id</id>
  <mirrorOf>*</mirrorOf>
  <name>any name</name>
  <url>http://anyHost:2227/repository/maven-public</url>
</mirror>

How can I know why maven downloads this dependency from spring repo?

A: A correct settings.xml setup for using a repository manager should look like this:
<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public/</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
  <servers>
    <!-- Possible authentications for access to nexus -->
    <server>
      <id>snapshots</id>
      <username>xxx</username>
      <password>xxx</password>
    </server>
    <server>
      <id>releases</id>
      <username>xxx</username>
      <password>xxx</password>
    </server>
  </servers>
</settings>

this will correctly redirect all request which are defined in your own or other pom's (like spring-boot repos) to your internal repository manager.

A: Let's start with the part of Maven downloading from Spring's snapshot repository. From what you showed us in the question it is at least unclear (if not existent) that you defined any snapshot repository in your project. Because this is a Spring Boot project, it will set you one through the parent project (..repo.spring.io..).
This is why your project reaches out to this particular server.
You try to download a jar you probably put to nexus by yourself, right? The version is <sth>-SNAPSHOT that make Maven try to fetch from some snapshot server.
Your mirror is must a mirrorOf the central repository where I just assume your jar does not live but "in" the mirror.
My idea would be to set your mirror as a repository in your project's pom.xml like this
<repositories>
  <repository>
    <id>myInternalRepository</id>
    <url>http://localhost:8081/nexus/content/groups/???</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
</repository>

A: I didnt see "httpclient-starter:jar:1.0.0-SNAPSHOT" this jar in repo.spring.io.
1)
Try to open repo.spring.io on the browser. Then check the respective jar exising in that or not and also check your proxy settings in your settings.xml configuration.
https://repo.spring.io/snapshot
Maven Proxy settings

2)
com.my.package:httpclient-starter:jar:1.0.0-SNAPSHOT if exists then delete it manually from .m2 repository
3) mvn clean install.
4) Check your RepositoryId and Repository name as shown in pic.

A: you can install the jar httpclient-starter:jar:1.0.0-SNAPSHOT into you local maven repository with command maven install


text:
Q: Calculate direction in PostGIS & Django (GeoDjango) Is it possible to calculate direction to detect if users are moving in "similar" direction having a few of their last coordinates (Points) using PostGIS + Django (https://docs.djangoproject.com/en/4.1/ref/contrib/gis/)?
I couldn't find information about this feature.

A: What you're calling "direction" I thing correspond to the angle relative to the north, aka azimuth. There is a function in Django apparently: https://docs.djangoproject.com/en/4.1/ref/contrib/gis/functions/#azimuth
Then you just need to compare the 2 angles to see if they are close. Don't forget it's modulo 2*pi (it is a bit tricky, for example see there).


text:
Q: Phoenix: how to avoid including Bootstrap/HTML5 boilerplate in generated CSS production file When I deployed my Phoenix app in production for the first time I saw that my CSS were broken due to the app.cssgenerated file include not wanted CSS such as Bootstrap and HTML5 boilerplate.
I imagine they are included by brunch when compiling in production mode.
How to avoid it?
PS: when using SSH to send local files to a remote server see my comment to Dmitry answer.

A: You can just delete everything in web/static/css/app.css file. And then recompile your project


text:
Q: Using 3 graphics cards (1 Single and 2 in Crossfire) With my current setup, I have to AMD 5770's in crossfire on an ASRock 890FX Deluxe 4 motherboard (running Windows 7). I was originally wanting to purchase a new AMD 280X to replace the 2 5770's, but I have gotten into CryptoCoin mining and want to keep all three cards.
I want to use the 280X for gaming and as my display, but I also want to use all three cards for mining purposes. Is it possible to have all three cards working in my system at the same time?
(I've looked online and found I can't run all 3 together for gaming, but I haven't been able to find if I can use all 3 in the configuration I want.)

A: You will not be able to run your 5770s in CrossFire while using another AMD branded card that shares the same driver. This is the same with SLI, as these technologies are scoped to the driver level.
The good news is that you certainly can use the 280x as your main display-driving graphics card and use the 5770s for mining without using CrossFire.


text:
Q: MarkLogic - Search based on the path of JSON object (without using path range index) MarkLogic : 9.0-6.2
We have a JSON document as below, in customer entity.
"CustomerInfo": {
  "IdInfo": {
     "CustomerId":"12345"
  },
  "PartyRltp": {
      "CustomerId":"45678"
  }
}

My need is to search the document based on CustomerId at the specific path CustomerInfo.IdInfo.CustomerId
So if I search for "12345", the above document should be returned. But if I search with "45678", the above document should NOT be returned.
I created path range index and used cts.pathRangeQuery('/CustomerInfo/IdInfo/CustomerId','=', '12345'). However, realized that path range indexes are very expensive, so looking for a way to achieve without path range index.
Thanks in advance!

A: I think you are looking for cts.jsonPropertyScopeQuery:
cts.jsonPropertyScopeQuery(
  'IdInfo',
  cts.jsonPropertyValueQuery(
    'CustomerId',
    '12345'
  )
)

HTH!


text:
Q: Exporting eclipse plugin fails under Mountain Lion I'm developing a plugin for Eclipse Juno under Mountain Lion.
I can test my plugin without problem by doing run as > Eclipse application.
However when I try to export the plugin by doing the following action it fails.

*

*Open plugin.xml

*Go to the tab Overview

*Select Export Wizard
It returns the following error:
/Users/luca/Documents/University/PhD/FODA/.metadata/.plugins/org.eclipse.pde.core/temp/org.eclipse.pde.container.feature/compile.org.eclipse.pde.container.feature.xml:4: The following error occurred while executing this line:
/Users/luca/Documents/University/PhD/FODA/it.unibg.robotics.featuremodels.model/build.xml:31: /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/Classes does not exist.
The following error occurred while executing this line:
/Users/luca/Documents/University/PhD/FODA/it.unibg.robotics.featuremodels.model/build.xml:31: /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/Classes does not exist.

What's the problem?

A: Just ran into this problem myself today. As far as I understood, it comes from the fact that recently Apple stopped maintaining their version of Java in favor of an official version for the MacOS X from Oracle. The Oracle version, however, doesn't have the same directory structure as before, and the build script generated by Eclipse assumes the old structure.
You can see many bug reports related to this. E.g.,

*

*https://bugs.eclipse.org/bugs/show_bug.cgi?id=371215

*https://bugs.eclipse.org/bugs/show_bug.cgi?id=378596

*https://bugs.eclipse.org/bugs/show_bug.cgi?id=385077
I heard that switching to using Java 6 would solve the issue, as MacOS X still has the Apple Java 6 installation with the old directory structure. I didn't want to go back to Java 6, so I didn't try this.
Instead, I tried creating the directory that is reported missing (i.e., /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/Classes), with nothing in it. Oddly, it seems to have worked.
Let me know if it works out for you as well... Future updates of Eclipse might also fix this (I updated mine today, but the problem was still there).

A: This is fixed in Eclipse 3.8.2 and 4.3.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=392434


text:
Q: What application uses a red cone icon with a notch in it? I saw the following icons in a screen shot of a mac. I know the F-icon is Autodesk Fusion, but what is the icon next to it, the red cone with a notch?

A: That appears to be the icon for Autodesk AutoCAD (see the red icon in the screenshot).
Here is another view.

A: Open it and look at the name on the menu bar in the top left?


text:
Q: Получение логов устройства и приложения Добрый день! Помогите мне решить проблему. Не подскажите, как получить все логи (не только приложения, но и железки) программно?
Я использовал:
Process process = Runtime.getRuntime().exec("logcat -d -v threadtime");
byte[] data = process.getInputStream()).getBytes()

Но данный метод позволяет получить только логи приложения, а хотелось бы получить все логи.
Если в bash вызвать эту же команду(logcat -d -v threadtime) то получаю все логи, в том числе и устройства.
Заранее спасибо за ответ!

A: нужно добавить в манифест строку:
<uses-permission android:name="android.permission.READ_LOGS" />


text:
Q: _b00t_ question: how to DRAG & DROP (*move) a file in visual studio code, without wiping the git history? (i.e. git mv on drag and drop) Presently working _b00t_
b00t uses config files inside a git repository for change control.
The question is how to DRAG & DROP (*move) a file in visual studio code, without wiping the git history? (i.e. git mv on drag and drop).  Is there a plugin or other mechanism for dragging and dropping does "git mv", I can't seem to find one.
Seems like a silly & useful feature that should be on by default but I haven't been able to figure it out. Do I need to build my own extension?  Thanks!


text:
Q: Why does this rewrite fail in the context of dependent types I'm trying to get a hang on dependent types, but I continuously run into a problem like the following. In this example I'm defining an abstraction for arrays, such that every access is guarded to be in the array using dependent typing.
I'm using Coq 8.5, but I don't think that is essential in this example. I'm also using the SfLib and LibTactics from the Software Foundations tutorial. For the latter I found one that does work with Coq 8.5.
Add LoadPath "/home/bryan/Projects/Coq/sf8.5".
Require Import SfLib.      (* In the download from https://www.cis.upenn.edu/~bcpierce/sf/current/index.html *)
Require Import LibTactics. (* https://github.com/DDCSF/iron/blob/master/done/Iron/Tactics/LibTactics.v *)

Require Import Omega.

Module Array.

Next follows the inductive and abstract definition of an array.
  Inductive array {E: Type} (sz: nat) : Type :=
  | construct_array : forall f : nat -> option E, (forall i, i >= sz <-> f i = None) -> array sz
  .

Next a couple of lemmas that no doubt are somehow available in the standard library, but I couldn't find them except for the second, but that was only in the Classical logic part.
  Lemma transpose: forall f g : Prop, (f -> g) -> (~ g -> ~ f).
  Proof.
    auto.
  Qed.

  Lemma not_ex_all_not :
   forall U (P:U -> Prop), ~ (exists n, P n) -> forall n:U, ~ P n.
  Proof. (* Intuitionistic *)
    unfold not. intros U P notex n abs.
    apply notex.
    exists n; trivial.
  Qed.

The following lemma characterizes the definition of an array. The proof feels like a coup the force, so if you have any suggestions for simplification then by all means.
  Lemma inside_array: forall E (f: nat -> option E) sz
  ,   (forall i, i >= sz <-> f i = None)
  <-> (forall i, i < sz <-> exists e, f i = Some e)
  .
  Proof.
    introv. split; split.
    introv Hi. remember (f i) as fi. destruct fi.
      exists e. reflexivity.
      symmetry in Heqfi. rewrite <- H in Heqfi. exfalso. omega.
    introv Hex. inversion Hex as [e He]; clear Hex.
    specialize (H i). rewrite He in H. inversion H; clear H.
    apply transpose in H0. SearchAbout ge. apply not_ge in H0. assumption.
    intro Hcontra. inversion Hcontra.
    intro Hi. specialize (H i). inversion H.
    apply transpose in H1. assert (forall e, ~ f i = Some e). apply not_ex_all_not. assumption.
    destruct (f i). specialize (H2 e). exfalso. auto. reflexivity.
    omega.
    intros Hi. specialize (H i). inversion H. apply transpose in H0. omega. rewrite Hi.
    intro Hcontra. inversion Hcontra as [e Hcontra']. inversion Hcontra'.
  Qed.

Look up an element in an array, provided the index is in range
  Definition lu_array {E: Type} {sz: nat} (a: @array E sz) (i: nat) (C: i < sz) : E.
  Proof.
    intros.
    inversion a.
    remember (f i) as elem.
    destruct (elem).
      apply e. symmetry in Heqelem. rewrite <- H in Heqelem.
      exfalso. omega.
  Defined.

Resize the array by placing new elements at the front
 Definition inc_l_array {E: Type} {sz: nat} (a: @array E sz) (inc: nat) (d: E) : @array E (inc + sz).
 Proof.
    destruct a as [f Hi].
    apply construct_array
      with (fun j => if lt_dec j inc then Some d else if lt_dec j (inc + sz) then f (j - inc) else None).
    introv. split; destruct (lt_dec i inc); simpl.
    Case "i < inc ->". introv Hi'. exfalso. omega.
    Case "i >= inc ->". introv Hi'. destruct (lt_dec i (inc + sz)).
      SCase "i < (inc + sz)". exfalso. omega.
      SCase "i >= (inc + sz)". reflexivity.
    Case "i < inc <-". introv Hcontra. inversion Hcontra.
    Case "i >= inc <-". destruct (lt_dec i (inc + sz)).
      SCase "i < (inc + sz)". rewrite <- Hi. omega.
      SCase "i >= (inc + sz)". introv Htriv. omega.
  Defined.

And next the problematic lemma that specifies what the resize should do. Most of the proof falls through, but I get stuck at the marked rewrite.
  Lemma inc_l_array_spec
  :   forall E sz (a: @array E sz) (inc: nat) (d: E) (a': @array E (inc + sz))
  ,   inc_l_array a inc d = a'
      ->  forall i (Ci' : i < inc + sz)
      ,   (   i < inc -> lu_array a' i Ci' = d)
      /\  (   inc <= i < inc + sz
          ->  exists (Ci: i-inc < sz), lu_array a' i Ci' = lu_array a (i-inc) Ci
          )
  .
  Proof.
    introv Heq. introv. subst a'. destruct a as [f Hf]. split; introv Hin.
    Case "i < inc". simpl.
      unfold inc_l_array, lu_array.
      destruct (lt_dec i inc).
      SCase "i < inc". reflexivity.
      SCase "i >= inc". contradiction.
    Case "inc <= i < inc+sz".
      assert (Ci: i-inc < sz) by omega. exists Ci.
      unfold inc_l_array, lu_array.
      destruct (lt_dec i inc).
      SCase "i < inc". exfalso. omega.
      SCase "i >= inc". destruct (lt_dec i (inc+sz)).
        SSCase "i < inc + sz".
          assert (Hf': forall i, i < sz <-> exists e, f i = Some e).
          apply inside_array. assumption.
          specialize (Hf' (i-inc)). inversion Hf'. remember Ci as Ci''. clear HeqCi''. apply H in Ci.
          inversion Ci as [e He].
          rewrite He. (* <---- This rewrite fails *)

        SSCase "i >= inc + sz".
          exfalso. omega.
  Qed.

End Array.

I've tried working my way around it in some other ways, but it always hits this problem. The error message looks like:
Error: Abstracting over the term "f (i - inc)" leads to a term
fun o : option E => (... very long term ...) which is ill-typed.
Reason is: Illegal application:
The term "@RelationClasses.symmetry" of type
 "forall (A : Type) (R : Relation_Definitions.relation A),
  RelationClasses.Symmetric R -> forall x y : A, R x y -> R y x"
cannot be applied to the terms
 "Prop" : "Type"
 "iff" : "Prop -> Prop -> Prop"
 "RelationClasses.iff_Symmetric" : "RelationClasses.Symmetric iff"
 "i - inc >= sz" : "Prop"
 "o = None" : "Prop"
 "Hf (i - inc)" : "i - inc >= sz <-> f (i - inc) = None"
The 6th term has type "i - inc >= sz <-> f (i - inc) = None"
which should be coercible to "i - inc >= sz <-> o = None".

The o = None looks to me like the culprit, because it seems to cover a case that I'm actually not handling at the moment. But honestly, I don't understand what is going on. The mentioning of f (i - inc) in the 6th term is also worrying me, as I intended to rewrite it away.
The above approach will rely on proof irrelevance to connect the type dependent guards. I do not understand however how to invoke this axiom in the above situation.
My concrete questions are: why does the rewrite fail? And how can I remedy this?

A: I had a closer look at what you are doing and indeed here are a few comments:

*

*You are relying on transparent proofs, this is in general a bit of a
pandora box, as some of your proof terms will be "opaque", and in
general will make things a bit difficult.

*You could try thus to separate a bit more proofs and "data".

*You could also try to have more "computational" definitions. That
is, why not to have an array as an actual list?

See below for my 5 mins take on your code, I hope it helps.
From mathcomp
Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice fintype.

Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.

Section Array.

Variable E : Type.
Implicit Types N   : nat.

Definition i_fun := nat -> option E.
Implicit Types arr : i_fun.
Identity Coercion i_fun_c : i_fun >-> Funclass.

(* A maybe better approach would be to work with reflect predicates *)
(* Definition up_axiom arr N := forall i, *)
(*     reflect (arr i = None) (N <= i). *)

Definition up_axiom arr N := forall i,
    (arr i = None) <-> (N <= i).

Definition down_axiom arr N := forall i,
    (exists e, arr i = Some e) <-> (i < N).

Definition array N := { arr | up_axiom arr N }.

Coercion arr_fun N (arr : array N) := tag arr.

(* Sadly we can't fully reflect this *)
Lemma inside_array arr N : up_axiom arr N <-> down_axiom arr N.
Proof.
split=> ax i; split.
+ by case=> [e he]; rewrite ltnNge; apply/negP/ax; rewrite he.
+ move=> hi; case Ha: (arr i) => [w|]; first by exists w.
  by move/ax: Ha; rewrite leqNgt hi.
+ have := ax i; case: (arr i) => // -[h1 h2 _].
  by rewrite leqNgt; apply/negP=> /h2 [].
+ have := ax i; case: (arr i) => // e [h1 h2].
  have H: i < N; first by apply: h1; exists e.
  by rewrite leqNgt H.
Qed.

(* This being transparent was not very useful... *)
Definition optdef T d (e : option T) : T :=
  match e with
  | Some x => x
  | None => d
  end.

Definition get_array N d arr (i : nat) : E :=
  optdef d (arr i).

Definition inc_array N arr (inc : nat) (d: E) : i_fun :=
  fun i =>
  if i < N       then arr i else
  if i < N + inc then Some d else
  None.

Lemma inc_arrayP N (arr : array N) inc d :
  up_axiom (inc_array N arr (N+inc) d) (N+inc).
Proof.
case: arr => a_f a_ax i; have [h1 h2] := a_ax i.
rewrite /inc_array /arr_fun; case: ifP => hi /=.
+ split; [move/h1; rewrite leqNgt hi //|].
  move=> hil; rewrite (leq_trans (leq_addr inc _)) // in h2.
  exact: h2.


text:
Q: python find the maximum of time strings I have a python list of strings which define some time interval. Something like:
intervals = ["1 days", "7 days", "30 days"]

I need to find the index of the maximum in this interval list. is there any library in python that would allow me to do this?

A: Try the parse_timespan function from humanfriendly to convert each of them, then find the maximum in the usual way?
>>> from humanfriendly import parse_timespan
>>> intervals = ["1 days", "7 days", "30 days"]
>>> parsed_intervals = [parse_timespan(interval) for interval in intervals]
>>> max(parsed_intervals)
2592000.0

If you want the original format (rather than the amount of time for further processing), you can also use:
>>> from humanfriendly import parse_timespan
>>> intervals = ["1 days", "7 days", "30 days"]
>>> max(intervals, key=parse_timespan)
'30 days'

A: I did it using pandas eventually. Posting it here in case it is helpful to someone.
import pandas as pd
intervals = ["1 days", "7 days", "30 days"]
deltas = [pd.Timedelta(i) for i in intervals]

idx = deltas.index(max(deltas))

A: This can be achieved by using core python (as seen below).
intervals = ["1 days", "7 days", "30 days"]
numbers_only = [] # creating a list to get the numbers only
for interval in intervals: # iteration through the intervals
    numbers_only.append(int(interval.split(" ")[0])) # splitting each interval on a blank space and appending just the number

max_in_nums = max(numbers_only) # using python's default library max function to get the max number in a list of numbers
print(numbers_only.index(max_in_nums)) # get the index of the number

A: This code should work:
result = 0
interval = ''
for i in range(len(intervals)):
    val = int(intervals[i].split(' ')[0])
    if val > result:
        result = val
        interval = i
print(interval)

A: intervals = ["1 days", "7 days", "30 days"]
findmax =[]
for i in range(len(intervals)):
    n = intervals[i].replace(' days', '')
    findmax.append(float(n))
print(max(findmax))

A: You can use datetime.timedelta for a build-in library solution:
from datetime import timedelta
intervals = ["1 days", "7 days", "30 days"]
r = max(intervals, key=lambda x:timedelta(**{(v:=x.split())[1]:int(v[0])}))

Output:
'30 days'


text:
Q: Create MySQL schema with gradle and flyway plugin We are using gradle in our project to build a multi-repository project. Since it is automatically built and tested on a Jenkins build server, we need to set up and tear down the database.
My understanding of Continuous Integration best practices is that we should have a single push of a button to also set up and tear down the testing database. Even if this does not exist yet. So I want a gradle task that simply creates a database in MySQL if it does not exist yet.
Browsing the this fine site I thought I had found the answer when I was pointed to using the flyway plugin for Gradle. Apparently flyway does support automatic schema creation since version 2.1 (http://java.dzone.com/announcements/flyway-21-released-automatic), so it should be possible using the plugin, should it not?
However, if I run gradle flywayInit or gradle flywayClean, using a url like url = 'jdbc:mysql://127.0.0.1:3306/test' every time I get the message unknown database: test. So I tried the following:
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.flywaydb:flyway-gradle-plugin:3.0'
    }
}

// Use Flyway plugin to create database
apply plugin: 'flyway'
flyway {
    user = 'root'
    password = 'root'
    url = 'jdbc:mysql://127.0.0.1:3306'
    schemas = ['test']
}

I would have expected another connection error. Instead the build was succesful, but no database schema was created. How can I create a schema using gradle and Flyway? If we can do it without Flyway that is fine, too.
UPDATE:
It turns out this works just fine. I was looking at an outdated version of my list of database schemas. Apparently Sequel Pro is too stupid to update the list of schemas when you refresh. Or I am too stupid to find the right button in Sequel pro.
UPDATE 2:
To make sure this always happens on every build, I added the following line to build.gradle:
// Add dependencies to tasks
build.dependsOn flywayInit

A: I followed Get started with Gradle and Flyway and everything ran ok.
I am using gradle 2.2 and the build.gradle file is:
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'mysql:mysql-connector-java:5.1.34'
        classpath 'org.flywaydb:flyway-gradle-plugin:3.1'
    }
}

apply plugin: 'flyway'
apply plugin: 'java'

flyway {
    url = 'jdbc:mysql://localhost:3306'
    user = 'root'
    password = 'root'
    schemas = ['demo1']
}

After that, run gradle flywayMigrate -i. If the database does not exist, will be created by flyway.
You can see a list of Flyway tasks here: link

A: There is a subtle, but important difference between what you have there and what Flyway can do: since version 2.1 Flyway can create schemas, but not databases.
The name in the MySQL url is a database you must create yourself using the MySQL command create database. Within that database, Flyway can create the schemas you specify with flyway.schemas.


text:
Q: Babel/RequireJS + typeof "RangeError: Maximum call stack size exceeded" I have a very basic JS error and I'm quite ashamed to not be able to solve it...
I'm developping with ES6 and Babel and I'm making some experiments.
Please note I'm using these arguments with Babel:
--presets es2015 --plugins transform-es2015-modules-amd
I have a simple module:
"use strict";

export default class Inspector {
    static inspect() {
        console.log(this.prototype.myMethod);
        console.log(typeof this.prototype.myMethod);
    }
}

I use this module like that:
"use strict";

import Inspector from "inspector";

class Child extends Inspector {
    myMethod() {
        console.log(`Hello from ${this.name}`);
    }
}

Child.inspect();

The goal here is really dumb: simply check how the prototype is populated with ES6 inheritance.
The first console.log from inspect() method displays, as expected:

function myMethod() {
          console.log("Hello from " + this.name);
      }

Inheritances has worked as expected, hourray!
But the funny part is the second console.log (console.log(typeof this.prototype.myMethod);) which triggers an error:

require.js:19 RangeError: Maximum call stack size exceeded(…)

I was expecting something more like "function", but hey, I suppose I'm quite naive...
This error seems to be related to requirejs modules, but I have no clues why I can log the function but not its type.
Please also note that I can call this method in the inspect method:
static inspect() {
        this.prototype.myMethod();
}

This displays "Hello from undefined" (I was expected "Hello from Child" but since it's not a static method, it's normal. Anyway, the call is correctly performed!).
So, my question here: why can I log and call a method but I can't run typeof on it?
Thanks in advance!
EDIT: you can see below the transpiled files:
inspector.js
define(["exports"], function (exports) {
    "use strict";

    Object.defineProperty(exports, "__esModule", {
        value: true
    });

    function _typeof(obj) {
        return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
    }

    function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) {
            throw new TypeError("Cannot call a class as a function");
        }
    }

    var _createClass = (function () {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || false;
                descriptor.configurable = true;
                if ("value" in descriptor) descriptor.writable = true;
                Object.defineProperty(target, descriptor.key, descriptor);
            }
        }

        return function (Constructor, protoProps, staticProps) {
            if (protoProps) defineProperties(Constructor.prototype, protoProps);
            if (staticProps) defineProperties(Constructor, staticProps);
            return Constructor;
        };
    })();

    var Inspector = (function () {
        function Inspector() {
            _classCallCheck(this, Inspector);
        }

        _createClass(Inspector, null, [{
            key: "inspect",
            value: function inspect() {
                this.prototype.myMethod();
                console.log(this.prototype.myMethod);
                console.log(_typeof(this.prototype.myMethod));
            }
        }]);

        return Inspector;
    })();

    exports.default = Inspector;
});

child.js
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }

define(["inspector"], function (_inspector) {
    "use strict";

    var _inspector2 = _interopRequireDefault(_inspector);

    function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : {
            default: obj
        };
    }

    function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) {
            throw new TypeError("Cannot call a class as a function");
        }
    }

    var _createClass = (function () {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || false;
                descriptor.configurable = true;
                if ("value" in descriptor) descriptor.writable = true;
                Object.defineProperty(target, descriptor.key, descriptor);
            }
        }

        return function (Constructor, protoProps, staticProps) {
            if (protoProps) defineProperties(Constructor.prototype, protoProps);
            if (staticProps) defineProperties(Constructor, staticProps);
            return Constructor;
        };
    })();

    function _possibleConstructorReturn(self, call) {
        if (!self) {
            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        }

        return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
    }

    function _inherits(subClass, superClass) {
        if (typeof superClass !== "function" && superClass !== null) {
            throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
        }

        subClass.prototype = Object.create(superClass && superClass.prototype, {
            constructor: {
                value: subClass,
                enumerable: false,
                writable: true,
                configurable: true
            }
        });
        if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
    }

    var Child = (function (_Inspector) {
        _inherits(Child, _Inspector);

        function Child() {
            _classCallCheck(this, Child);

            return _possibleConstructorReturn(this, Object.getPrototypeOf(Child).apply(this, arguments));
        }

        _createClass(Child, [{
            key: "myMethod",
            value: function myMethod() {
                console.log("Hello from " + this.name);
            }
        }]);

        return Child;
    })(_inspector2.default);

    Child.inspect();
});

Exception stracktrace is not very helpful unfortunately :

ea.check  @   require.js:19
(anonymous function)  @   require.js:23
(anonymous function)  @   require.js:8
(anonymous function)  @   require.js:24
x @   require.js:7
ea.emit   @   require.js:24
ea.check  @   require.js:20 ea.enable @   require.js:24
ea.init   @   require.js:17 J @   require.js:14
h.completeLoad    @   require.js:29
h.onScriptLoad @  require.js:30

EDIT2: By looking at the transpiled files, it seems that my typeof is replaced with method _typeOf from Babel. And this function is looping infinitely...
Is it a bug with Babel? Did I miss any arguments for the compilation?

A: Looks like a babel bug, it might be exactly this one: https://phabricator.babeljs.io/T6777

A: For anyone looking, the bug in Babel still seems to exist: https://github.com/babel/babel/issues/9127
I just ran across it when a user reported an error with my code.  Once we turned off the Bable transpiler option he was using, the "maximum call stack size exceeded" error went away.


text:
Q: Django, how to get current request method? request is not working in my views.py I'm new to Django. I'm trying to get my current request method to see if it is "POST" method.
But I got error message says: Unresolved reference 'request'
I tried to import request, but I don't know which one is correct.
import choices
Thanks for your help!
Kind regards,
Xi

A: Have a look at the following:
    import requests
    response = requests.post(url, data=body, headers=headers)


text:
Q: How wide and long can you make a web page. Is there a limit? I am interested in making a table in HTML and it will be big.
Is there anything that limits just how far to the right or how far down I can go on any particular page ?

A: The only limitation is the hardware of the device that will display it. I don't mean the screen size. I mean the CPU and RAM of the device, that's your limit. The bigger your page is, the more CPU and RAM it will need.

A: Theoretically, there is no limit on width and height for a web page. But in the view of a designer. I think making your page too big is not a good idea. It'll make your web page has bad "look and feel". Instead of that, you should try using paging to make the "look and feel" way better

A: Short answer: No.
For optimizing to different monitors / devices read about Responsive & Adaptive design (or use javascript for ie6).

A: No there is not a limit on length or width.

A: No, there is no limit in either dimension.

A: No there is no limit for height or width. But I think it depends on whether you define height/width of a component in px or %. Also, it depends on the size of your content.


text:
Q: get current datetime in minutes and convert datetime (d.m.Y H:m) to minutes Javascript Please i need some help in javascript or jQuery :
how to get current date and time to minutes?
i have a datetime in that format : 'd/m/Y H:m' (example 25/12/2016 22:35) in input . how to get it and convert it to minutes ? and make difference between it and current datetime
Thank you in advance for help. I tried all but nothing works

A: To get the current date and time to minutes, you could divide the milliseconds:
var theMinutes = new Date().getTime() / (1000 * 60);

To get the input and convert it to minutes, you could use a Date object, and divide the milliseconds:
    var someDateTime = document.getElementById("someDateTime").value;
var someParts = someDateTime.split(" ");
var theDate = someParts[0];
var theTime = someParts[1];
var dateParts = theDate.split("/");
var timeParts = theTime.split(":");
var theDay = dateParts[0];
var theMonth = dateParts[1];
var theYear = dateParts[2];
var theHours = timeParts[0];
var theMinutes = timeParts[1];
var someDateTimeObject = new Date(theYear, theMonth, theDay, theHours, theMinutes, 0 );
var someDateTimeObjectMillis = someDateTimeObject.getTime();
var someDateTimeObjectMinutes = someDateTimeObjectMillis / (1000 * 60);

A: Hello thank you for all yours answers
Firsly i get the current time using php ( in Milliseconds)  then convert pickup date to milliseconds and get differences between them in hours :
promo (in minutes) i get  767 hours normally i should get : 47 hours and some minutes
 var startdate=document.getElementById('pickupdate').value; //03-11-2015 15:49

var someParts = startdate.split(" ");
var theDate = someParts[0];
var theTime = someParts[1];
var dateParts = theDate.split("-");
var timeParts = theTime.split(":");
var theDay = dateParts[0];
var theMonth = dateParts[1];
var theYear = dateParts[2];
var theHours = timeParts[0];
var theMinutes = timeParts[1];
var someDateTimeObject = new Date(theYear, theMonth, theDay, theHours, theMinutes, 0 );
var someDateTimeObjectMillis = someDateTimeObject.getTime();
//var someDateTimeObjectMinutes = someDateTimeObjectMillis / (1000 * 60);

alert(someDateTimeObjectMillis);
var maintenant = <?php echo(round(microtime(true) * 1000)); ?>;
alert(maintenant);
var diff = someDateTimeObjectMillis - maintenant;
alert(diff);

var promo = diff/(60 * 1000);
alert(promo); // 46079

thank you for your support


text:
Q: DE whose solutions are orthogonal to some vector field I need to find a differential equation whose solution yields a family of curves in the plane that move orthogonally to the vector field $\langle x-y,y^2\rangle$.
Any vector's slope that is orthogonal to the vector field $\langle x-y,y^2\rangle$ is given by $\dfrac{-y^2}{x-y}$, right? So I'm looking for a curve $y$ such that $\dfrac{dy}{dx}=\dfrac{-y^2}{x-y}$. But the solution says that it must be $\dfrac{dy}{dx}=\dfrac{x-y}{-y^2}$. What am I thinking wrong?

A: If the vector has slope $S$, then it is in direction $(1,S)$.
It is orthogonal to $(x-y,y^2)$, so $(1,S).(x-y,y^2)=0=x-y+Sy^2$


text:
Q: How do I escape the ERB tag in ERB I have a simple fixture.yml file:
label:
    body: "<%= variable %>"

The issue is that the ERB code is parsed as part of loading the fixture, whereas I actually want the body to be literally "<%= variable %>" (un-interpolated).
How do I escape the ERB tag?

A: Add a second % to the opening tag:
label:
    body: "<%%= variable %>"

The <%% sequence is valid ERB, rendered as a literal <%.


text:
Q: Could not determine java version from '9.0.1'. windows While running react-native project I am  getting this error

Could not determine java version from '9.0.1'..

JAVA_HOME path is

C:\Program Files\Java\jdk 9.0.1.

and my NVM version
1.1.6
. I'm following these steps


text:
Q: Mongoose / MongoDB. Cannot save array of strings UPD:
Found this finally. The code below is perfectly valid. There was just a destructive update to Layouts.blocks in another module...

Something very odd is happening here.
Here's a relevant part of the Layouts schema
blocks: [{
   full: {type: Boolean},
  fields: [{type: String}]
}]

And .pre save middleware code of another model
Map.pre('save', function(next){
  var that = this;
  var Layouts = connection.model('layouts');
  var openFields = ['one', 'two'];
  Layouts.find({_company: that._company, object: that._id, default: true}, function(err, layouts){
    if (err) return next(err);
    var layout = layouts[0];

    console.log(layout.blocks);

    layout.blocks.set(0, {full: false, fields: openFields});
    layout.markModified('blocks');

    console.log(layout.blocks);

    layout.save(function(err){
      console.log('saved: ', err);
      next(err);
    });
  });
});

console.log values are
[{ full: true, _id: 54147307f07097462fb93912, fields: [] }]
[{ full: false,
  _id: 54147307f07097462fb93918,
  fields: [ 'one', 'two' ] }]
saved:  null

Then i inspect saved layout and get:
blocks: [ { full: false, _id: 54147307f07097462fb93918, fields: [] } ],

So, _id and full are saved, but fields are not!
Something similar happens if i do direct update with
Layouts.update({_company: that._company, object: that._id, default: true},
    {$set: {'blocks.0.fields': openFields}},
    function(err){
      next(err);
  });

Any suggestions?

A: I attempted to implement the same schema as you specified and tried to update my layout object in three different ways, all of them worked. Here is my implementation and tests. Can't see where you are wrong from the code that you have submitted.
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/layout-test');

var LayoutSchema = new mongoose.Schema({
    blocks: [{
        full: {type: Boolean},
        fields: [{
            type: String
        }],
    }],
});
var Layout = mongoose.model('Layout', LayoutSchema);
var LAYOUT_DATA = {
    blocks: [
        {full: true},
    ],
};

// Updating the object, setting the first item of blocks
var test1 = function() {
    new Layout(LAYOUT_DATA).save(function(err, layout) {
        Layout.update({
            _id: layout._id
        }, {
            $set: {
                'blocks.0.full': false,
                'blocks.0.fields': ['one', 'two'],
            },
        }, function(err, nbrOfUpdates) {
            Layout.findById(layout._id, function(err, layout) {
                if (layout.blocks[0].fields.length === 0) {
                    throw Error();
                }
            });
        });
    });
};

// Replacing the old blocks with a new array
var test2 = function() {
    new Layout(LAYOUT_DATA).save(function(err, layout) {
        layout.blocks = [{
            full: false,
            fields: ['one', 'two'],
        }];
        layout.save(function(err, layout) {
            if (layout.blocks[0].fields.length === 0) {
                throw Error();
            }
        });
    });
};

// Pushing a new object to the blocks array and splicing away the old one
var test3 = function() {
    new Layout(layout).save(function(err, layout) {
        layout.blocks.push({
            full: false,
            fields: ['one', 'two'],
        });
        layout.blocks.splice(0, 1);
        layout.save(function(err, layout) {
            if (layout.blocks[0].fields.length === 0) {
                throw Error();
            }
        });
    });
};


text:
Q: How do I make ws.append work inside a function The ws.append function doesn't wrinte anything in the excel when is  under the def add(). But if I put it outside the def add() it works. I tried everything but it's not working and I don't know why.
Here is the code:

    import sys
    import tkinter as tk
    from tkinter import *
    import datetime
    from openpyxl import Workbook
    from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font

    # file creation
    wb = Workbook()

    # Window
    root = tk.Tk()
    root.title('Aranjamente liste')

    # Grid
    canvas = tk.Canvas(root, width = 600, height= 300)
    canvas.grid(columnspan = 3, rowspan = 20)

    # Instrucions
    instruction = tk.Label(root, text = "Scrieti CNP + NUME si PRENUME / CLUB ", font = "Raleway")
    instruction.grid(columnspan = 3, column = 0, row = 0)

    # CheckBox

    ## Variabile
    var1 = IntVar()
    var2 = IntVar()
    var3 = IntVar()
    var4 = IntVar()
    var5 = IntVar()
    var6 = IntVar()
    var7 = IntVar()
    var8 = IntVar()
    var9 = IntVar()
    var10 = IntVar()
    var11 = IntVar()
    var12 = IntVar()
    var13 = IntVar()

    # Definesc CheckBox
    kihon_c = Checkbutton( root, text = "Kihon Dousa", variable = var1, onvalue = 1, offvalue = 0, command = lambda:comanda())
    kodachi_c = Checkbutton( root, text = "Kodachi", variable = var2, onvalue = 1, offvalue = 0, command = lambda:comanda() )
    tatekodachi_c = Checkbutton( root, text = "Tate Kodachi", variable = var3, onvalue = 1, offvalue = 0, command = lambda:comanda())
    nito_c = Checkbutton( root, text = "Nito", variable = var4, onvalue = 1, offvalue = 0, command = lambda:comanda())
    chokenFree_c = Checkbutton( root, text = "Choken Free", variable = var5, onvalue = 1, offvalue = 0, command = lambda:comanda())
    chokenMorote_c = Checkbutton( root, text = "Choken Morote", variable = var6, onvalue = 1, offvalue = 0, command = lambda:comanda())
    tanto_c = Checkbutton( root, text = "Tanto", variable = var7, onvalue = 1, offvalue = 0, command = lambda:comanda())
    tateChoken_c = Checkbutton( root, text = "Tate Choken", variable = var8, onvalue = 1, offvalue = 0, command = lambda:comanda())
    yari_c = Checkbutton( root, text = "Yari", variable = var9, onvalue = 1, offvalue = 0, command = lambda:comanda())
    bo_c = Checkbutton( root, text = "Bo", variable = var10, onvalue = 1, offvalue = 0, command = lambda:comanda())
    echipeLupta_c = Checkbutton( root, text = "Echipe Lupta", variable = var11, onvalue = 1, offvalue = 0, command = lambda:comanda())
    echipeKhion_c = Checkbutton( root, text = "Echipe Kihon Dousa", variable = var12, onvalue = 1, offvalue = 0, command = lambda:comanda())
    aviz_medical_c = Checkbutton(root, text="Aviz Medical", variable = var13, onvalue = 1, offvalue = 0, command = lambda:comanda())

    # Le aranjez
    kihon_c.grid( columnspan = 1, column = 0, row = 3, sticky=W)
    kodachi_c.grid( columnspan = 1, column = 0, row = 4, sticky=W)
    tatekodachi_c.grid(columnspan = 1, column = 1, row = 3, sticky=W)
    chokenMorote_c.grid(columnspan = 1, column = 1, row = 4, sticky=W)
    chokenFree_c.grid(columnspan = 1, column = 2, row = 3, sticky=W)
    nito_c.grid(columnspan = 1, column = 2, row = 4, sticky=W)
    tanto_c.grid( columnspan = 1, column = 0, row = 5, sticky=W)
    tateChoken_c.grid(columnspan = 1, column = 0, row = 6, sticky=W)
    yari_c.grid( columnspan = 1, column = 1, row = 5, sticky=W)
    bo_c.grid( columnspan = 1, column = 1, row = 6, sticky=W)
    echipeLupta_c.grid( columnspan = 1, column = 2, row = 5, sticky=W)
    echipeKhion_c.grid( columnspan = 1, column = 2, row = 6, sticky=W)
    aviz_medical_c.grid(columnspan = 1, column = 1, row = 7)

    def comanda():
        print(var1.get())
        print(var2.get())

    # ADD Button
    add_button = tk.Button(root,command = lambda:add(), text = "Adauga", font = "Raleway")
    add_button.grid(columnspan=3,  column= 0, row = 15 )

    # Quit Button
    quit_button = tk.Button(root, command = lambda: sys.exit(), text = "Iesire", font = "Raleway")
    quit_button.grid(columnspan = 3, column = 0, row = 20)

    #### AICI BAGI TOATE FUNCTIILE ####
    def add():
        ws1 = wb.active
        ws1.title = "Baieti"
        ws2 = wb.create_sheet("Fete")

        nume = text.get(1.14, "2.0-1c")
        cnp = text.get(1.0, 1.13)
        club = text.get(2.0,'end-1c')
        c_cnp = cnp

        # Check if the checkboxes are checked

        proba1 = "x"
        proba2 = "x"
        proba3 = "x"
        proba4 = "x"
        proba5 = "x"
        proba6 = "x"
        proba7 = "x"
        proba8 = "x"
        proba9 = "x"
        proba10 = "x"
        proba11 = "x"
        proba12 = "x"
        aviz = "Nu are aviz medical"

        if var1.get() == 1:
            proba1 = "Kihon Dousa"
            print(proba1)
        if var2.get() == 1:
            proba2 = "Kodachi"
            print(proba2)
        if var3.get() == 1:
            proba3 = "Tate Kodachi"
            print(proba3)
        if var4.get() == 1:
            proba4 = "Nito"
            print(proba4)
        if var5.get() == 1:
            proba5 = "Choken Free"
            print(proba5)
        if var6.get() == 1:
            proba6 = "Choken Morote"
            print(proba6)
        if var7.get() == 1:
            proba7 = "Tanto"
            print(proba7)
        if var8.get() == 1:
            proba8 = "Tate Choken"
            print(proba8)
        if var9.get() == 1:
            proba9 = "Yari"
            print(proba9)
        if var10.get() == 1:
            proba10 = "Bo"
            print(proba10)
        if var11.get() == 1:
            proba11 = "Echipe Lupta"
            print(proba11)
        if var12.get() == 1:
            proba12 = "Echipe Kihon Dousa"
            print(proba12)
        if var13.get() == 1:
            aviz = "Are aviz medical"
            print(aviz)

        varsta = int(c_cnp)/10000000000%100
        x = 1999 + varsta
        ani = 2022 - x

        an_nastere = int(c_cnp)/10000000000%100 + 2000
        luna_nastere = int(c_cnp)/100000000%100
        zi_nastere = int(c_cnp)/1000000%100

        # Data de nastere comparata cu data de azi
        data_azi = datetime.date.today()
        current_year = datetime.date.today().year
        data_sportiv = datetime.date(current_year, int(luna_nastere), int(zi_nastere))

        # Compara data de azi cu data de nastere a sportivului
        if data_sportiv > data_azi:
            ani = ani - 1

        if cnp.startswith('5') is True:
            ws1.append([cnp])

        #elif cnp.startswith('6') == True:
           # ff.write(cnp + "\t" + nume + "\t" + str(int(ani)) + " ani" + "\t" + str(int(zi_nastere)) + "." + str(int(luna_nastere)) + "." + str(int(an_nastere)) + "\t" + str(proba1) + "\t" + str(proba2) + "\t" + str(proba3) + "\t" + str(proba4) + "\t" + str(proba5) + "\t" + str(proba6)
               # + "\t" + str(proba7) + "\t" + str(proba8) + "\t" + str(proba9) + "\t" + str(proba10) + "\t" + str(proba11) + "\t" + str(proba12) + "\n")

        # Se sterge dupa adaugare
        text.delete(1.0, END)
        kihon_c.deselect()
        kodachi_c.deselect()
        nito_c.deselect()
        chokenFree_c.deselect()
        chokenMorote_c.deselect()
        tanto_c.deselect()
        tatekodachi_c.deselect()
        tateChoken_c.deselect()
        bo_c.deselect()
        yari_c.deselect()
        echipeKhion_c.deselect()
        echipeLupta_c.deselect()

    # Text Box
    text = Text(root, width = 40, height = 3, )
    text.insert(INSERT, "")
    text.grid(columnspan=3, column=0, row=1)

    # Stilizare, arata mai bine
    canvas = tk.Canvas(root, width = 600, height= 250)
    canvas.grid(columnspan = 3)

    ## Mainloop of the window
    wb.save("test.xlsx")
    root.mainloop()

A: I discovered that the wb.save("test.xlsx") line had to be put in the def add(ws1) because otherwise the excel file didn't save anything.

A: Without seeing the rest of your code and not knowing what "it's not working" means (error? doing something else?) we can't be positive, but it looks like it may be because ws1 isn't part of the add() functions namespace.
Try adding ws1 as a parameter for add() and then including it when you actually call add(). Something like this:
#some things, other functions maybe, code blah blah

def add(ws):
    cnp = text.get(1.0,1.13)
    if cnp.startswith('5') is True: # you should also use "is True" instead of "== True", fyi
        ws.append([cnp])

#more code, blah blah
add(ws1)
#blah blah blah


text:
Q: Does a simple bug detector detect electric field or magnetic field?
Hi.
This is a very cheap and simple bug detector that is supposed to make sound
when it detect RF signals between 100Mhz-2600Mhz.
I found out that it doesn't do what it supposed to do,since its
sensitivity is very poor.It detects signals of some mobile phones(while some mobile phones it doesn't detect),wi-fi transmitters,garage doors remote control signals etc.at a distance of maximum 5 cm in the best case.Thats all.
Regard to my description,What may be the method of that cheap bug detector:detection of magnetic fields,electric fields or maybe both?
EDIT:
This is the pcb circuit of the detector.

A: It detects radio waves – it has an antenna. And: It's completely useless by design.
One thing to realize is that if someone clever was to construct a bug in the year 2016, it's not going to be an FM transmitter generating 100mW of output power constantly; that would both waste power and make it easy to find.
It's much more likely to be a "silent" recorder (you can record years of cell-phone-quality audio on a microSD card...) that can be triggered remotely to transmit its data only when the sniffing party considers it safe to transmit. There's a famous example of a small sculpture that contained a membrane that could vibrate with air pressure – turning it into a audio-modulated RF retroflector when illuminated with radio waves from across the street. Of course, that illumination did not happen while the friendly intelligence service was scanning the room for active transmitters.
So, having one of these is essentially snake oil. This isn't the movie, where you can rush into a room, scan it with a magical electronic device, and declare it "clean".
Another thing to consider is that even when the bug was actively transmitting, it would almost certainly use spread-spectrum technologies. Spread Spectrum is a World War II invention (aka "old news"); it's used to distribute power in a wider part of the spectrum, either to make it possible to make communication more resilient to interference, or to hide the transmission, even below the level of noise that is inevitable in every receiver at room temperature.
Yet another thing to consider is that you need much less power to transmit little information over short distance (like a bug probably does) compared to transmitting much information over large distance (like a TV tower does). In fact, if you are within 10 km of a 660 MHz TV station (secondary, or so-called "low-power") with 15 kW power, you'd get about -28 dBm ("dB Milliwatt", usual unit when dealing with radio communication devices) at where you are. If your bug chose a frequency right between two TV channels, and only needed to transmit 30 m instead of the 10 km, and the bug receiver was as sensitive as 25-year-old cellphones (-120 dBm sensitivity), the signal transmitted by the active bug would need to be 20 dB, or 100 times, weaker than the power of the TV station that you receive at the same place.
 In other words, you can't "see" that bug between the TV stations without knowing that there should be nothing between the TV channels. And even if you knew, TV is just one of hundreds of things that communicate. I have absolutely no idea how you'd go and find an even mediocre clever unknown bug without military/intelligence agency-class automated signal classifiers...
No matter how you put it, if you need to be paranoid about bugs, you need to live in a copper-shielded hole in the ground, or make mechanically sure the room your sitting is free of bugs and holes through which acoustics could be extracted.
In no case whatsoever is this device capable of doing anything useful.

A: It detects electric fields, and specifically RF (Radio Frequency) fields. You can't expect very good performance (sensitivity or selectivity) from such a cheap, over-simplified gadget. You get what you pay for.  But OTOH, low sensitivity allows you to physically identify the location of the bug based on field strength.
There are different kinds of bugs. One technique we have seen used by security agencies is a wide-band receiver with a speaker. If an AUDIO BUG is detected, the sound transmitted will be picked up by the detector and amplified out the speaker. Then the sound will "feedback" through the bug's microphone.
There are much more sophisticated hand-held gadgets for detecting RF emissions. For example look at the "RF Explorer" from SeedStudio. It uses modern technology to pack much better performance into a small hand-size unit for a remarkably good price.  https://www.seeedstudio.com/category/Rf-explorer-c-79.html


text:
Q: Averaging values between files, but keeping non-matching values I have two files:
File 1:
key.1   10    6
key.2    5    6
key.3.   5    8
key.4.   5    10
key.5    4    12

File 2:
key.1   10    6
key.2    6    6
key.4    5    10
key.5    2    8

I have a rather complicated issue. I want to average between the two files for each loc. ID. But if an ID is unique to either of the files, I simply want to keep that value in the output file. So the output file would look like this:
key.1   10    6
key.2   5.5   6
key.3.   5    8
key.4.   5    10
key.5    3    10

This is an example. In reality I have 100s of columns that I would like to average.

A: The following solution uses Pandas, and assumes that your data is stored in plain text files 'file1.txt' and 'file2.txt'. Let me know if this assumption is incorrect - it is likely a minimal edit to alter for different file types. If I have misunderstood your meaning of the word 'file' and your data is already in DataFrames, you can ignore the first step.
First read in the data to DataFrames:
import pandas as pd
df1 = pd.read_table('file1.txt', sep=r'\s+', header=None)
df2 = pd.read_table('file2.txt', sep=r'\s+', header=None)

Giving us:
In [9]: df1
Out[9]:
       0   1   2
0  key.1  10   6
1  key.2   5   6
2  key.3   5   8
3  key.4   5  10
4  key.5   4  12

In [10]: df2
Out[10]:
       0   1   2
0  key.1  10   6
1  key.2   6   6
2  key.4   5  10
3  key.5   2   8

Then join these datasets on column 0:
combined = pd.merge(df1, df2, 'outer', on=0)

Giving:
       0  1_x  2_x   1_y   2_y
0  key.1   10    6  10.0   6.0
1  key.2    5    6   6.0   6.0
2  key.3    5    8   NaN   NaN
3  key.4    5   10   5.0  10.0
4  key.5    4   12   2.0   8.0

Which is a bit of a mess, but we can select only the columns we want after doing the calculations:
combined[1] = combined[['1_x', '1_y']].mean(axis=1)
combined[2] = combined[['2_x', '2_y']].mean(axis=1)

Selecting only useful columns:
results = combined[[0, 1, 2]]

Which gives us:
       0     1     2
0  key.1  10.0   6.0
1  key.2   5.5   6.0
2  key.3   5.0   8.0
3  key.4   5.0  10.0
4  key.5   3.0  10.0

Which is what you were looking for I believe.
You didn't state which file format you wanted the output to be, but the following will give you a tab-separated text file. Let me know if something different is preferred and I can edit.
results.to_csv('output.txt', sep='\t', header=None, index=False)

I should add that it would be better to give your columns relevant labels rather than using numbers as I have in this example - I just used the default integer values here since I don't know anything about your dataset.

A: You can use itertools.groupby:
import itertools
import re
file_1 = [[re.sub('\.$', '', a), *list(map(int, filter(None, b)))] for a, *b in [re.split('\s+', i.strip('\n')) for i in open('filename.txt')]]
file_2 = [[re.sub('\.$', '', a), *list(map(int, filter(None, b)))] for a, *b in [re.split('\s+', i.strip('\n')) for i in open('filename1.txt')]]
special_keys ={a for a, *_ in [re.split('\s+', i.strip('\n')) for i in open('filename.txt')]+[re.split('\s+', i.strip('\n')) for i in open('filename2.txt')] if a.endswith('.')}
new_results = [[a, [c for _, *c in b]] for a, b in itertools.groupby(sorted(file_1+file_2, key=lambda x:x[0])[1:], key=lambda x:x[0])]
last_results = [(" "*4).join(["{}"]*3).format(a+'.' if a+'.' in special_keys else a, *[sum(i)/float(len(i)) for i in zip(*b)]) for a, b in new_results]

Output:
['key.1    10.0    6.0', 'key.2    5.5    6.0', 'key.3.    5.0    8.0', 'key.4.    5.0    10.0', 'key.5    3.0    10.0']

A: This is one solution via pandas. The idea is to define indices for each dataframe and use ^ [equivalent to symmetric_difference in set terminology] to find your unique indices.
Treat each case separately via 2 pd.concat calls, perform a groupby.mean, and append your isolated indices at the end.
# read files into dataframes
df1 = pd.read_csv('file1.csv')
df2 = pd.read_csv('file2.csv')

# set first column as index
df1 = df1.set_index(0)
df2 = df2.set_index(0)

# calculate symmetric difference of indices
x = df1.index ^ df2.index
# Index(['key.3'], dtype='object', name=0)

# aggregate common and unique indices
df_common = pd.concat((df1[~df1.index.isin(x)], df2[~df2.index.isin(x)]))
df_unique = pd.concat((df1[df1.index.isin(x)], df2[df2.index.isin(x)]))

# calculate mean on common indices; append unique indices
mean = df_common.groupby(df_common.index)\
                .mean()\
                .append(df_unique)\
                .sort_index()\
                .reset_index()

# output to csv
mean.to_csv('out.csv', index=False)

Result
       0     1     2
0  key.1  10.0   6.0
1  key.2   5.5   6.0
2  key.3   5.0   8.0
3  key.4   5.0  10.0
4  key.5   3.0  10.0

A: One possible solution is to read the two files into dictionaries (key being the key variable, and the value being a list with the two elements after). You can then get the keys of each dictionary, see which keys are duplicated (and if so, average the results), and which keys are unique (and if so, just output the key). This might not be the most efficient, but if you only have hundreds of columns that should be the simplest way to do it.
Look up set intersection and set difference, as they will help you find the common items and unique items.