text:
Q: I can't input data in the fields I am working on this assignment for school.  I have been looking my code over and over.  The problem is that when I try and run this program I can't input data into the fields.  When I try to select the fields to enter the data it won't let me.  Someone please help me!
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.DecimalFormat;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class OfficeAreaCalculator extends JFrame{

private JFrame mainFrame;
private JButton calculateButton;
private JButton exitButton;
private JTextField lengthField;
private JTextField widthField;
private JTextField areaField;
private JLabel lengthLabel;
private JLabel widthLabel;
private JLabel areaLabel;

public OfficeAreaCalculator()
{
    mainFrame = new JFrame("Office Area Calculator");

    exitButton = new JButton("Exit");
    lengthLabel = new JLabel("Enter the length of the office:");
    widthLabel = new JLabel("Enter the width of the office:");
    areaLabel = new JLabel("Office area:");
    lengthField = new JTextField(5);
    widthField = new JTextField(5);
    areaField = new JTextField(5);
    areaField.setEditable(false);
    calculateButton = new JButton("Calculate");

    Container c = mainFrame.getContentPane();
    c.setLayout(new FlowLayout());

    c.add(lengthLabel);
    c.add(lengthField);
    c.add(widthLabel);
    c.add(widthField);
    c.add(areaLabel);
    c.add(areaField);
    c.add(calculateButton);
    c.add(exitButton);

    calculateButton.setMnemonic('C');
    exitButton.setMnemonic('X');

    mainFrame.setSize(260, 150);

    mainFrame.addWindowListener(new WindowAdapter(){
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    CalculateButtonHandler chandler = new CalculateButtonHandler();
    calculateButton.addActionListener(chandler);

    ExitButtonHandler ehandler = new ExitButtonHandler();
    exitButton.addActionListener(ehandler);

    FocusHandler fhandler = new FocusHandler();
    lengthField.addFocusListener(fhandler);
    widthField.addFocusListener(fhandler);
    areaField.addFocusListener(fhandler);

    mainFrame.setVisible(true);
}

class CalculateButtonHandler implements ActionListener
{
    public void actionPerformed(ActionEvent e)
    {
        DecimalFormat num = new DecimalFormat(",###.##");
        double width, length, area;
        String instring;

        instring = lengthField.getText();
        if (instring.equals(""));
        {
            instring = ("0");
            lengthField.setText("0");
        }
        length = Double.parseDouble(instring);

        instring = widthField.getText();
        if (instring.equals(""))
        {
            instring = "0";
            widthField.setText("0");
        }
        width = Double.parseDouble(instring);

        area = length * width;
        areaField.setText(num.format(area));

    }

}

class ExitButtonHandler implements ActionListener
{
    public void actionPerformed(ActionEvent e) {
        System.exit(0);
    }
}

class FocusHandler implements FocusListener
{
    public void focusGained(FocusEvent e)
    {
        if (e.getSource() == lengthField || e.getSource() == widthField)
        {
            areaField.setText("");
        }
        else if (e.getSource() == areaField);
        {
            calculateButton.requestFocus();
        }
    }

    public void focusLost(FocusEvent e)
    {
        if (e.getSource() == widthField)
        {
            calculateButton.requestFocus();
        }
    }
}

public static void main(String arg[])
{
    new OfficeAreaCalculator();
}
}

A: problem:
 calculateButton.requestFocus();

When you are currently focusing your textfield it will then transfer the focus to the button on a never ending cycle thus you cant type anything there, that the focus is always at the button and will never in your textfield
solution:
remove it or dont add the FocusListener to the textfields.

A: General advice. Don't write your whole program all at once before you start testing.
1) Just create the GUI with all your components. That is remove all the listener code and see if it works.
2) Add back in the listeners one at a time and see if each listener works.
3) When the code stops working then you know where the problem is and you will know where to spend your time doing your debugging and you will be able to give us more information to help solve the problem.
As it turns out the problem is a typo:
    else if (e.getSource() == areaField);

You should not have the ";" at the end of the statement, this is causing the calculateButton.requestFocus(); statement to be executed every time to try to place focus on either of the text fields.
As a general rule you should NOT be using a FocusListener to try to control focus of components. Focus will move naturally when you use the Tab key. Your "areaField" should not really be a text field. It should probably be a JLabel which will never gain focus anyway so focus will go directly to the button from the width text field.

A: Get rid of both instances of calculateButton.requestFocus(); from your FocusHandler. It doesn't seem to do anything functionally useful, and it takes the focus away from the text fields every time you try using them.


text:
Q: Merge Two PDF by PyPDF2 but got error Unexpected destination '/__WKANCHOR_2' from PyPDF2 import PdfFileMerger, PdfFileReader
filepath_list = ['/tmp/abc.pdf','/tmp/xyz.pdf']
merger = PdfFileMerger()
for file_name in filepath_list:
 with open(file_name, 'rb') as f:
    merger.append(f)

merger.write("result.pdf")

While merger 2 pdf by python code I got Error Unexpected destination '/__WKANCHOR_2' and I working with following code, please provide me solution

A: This is a temporary fix, when you pass in the file in the append method, pass in import_bookmarks=False. This works for me
from PyPDF2 import PdfFileMerger, PdfFileReader
filepath_list = ['/tmp/abc.pdf', '/tmp/xyz.pdf']
merger = PdfFileMerger()
for file_name in filepath_list:
 with open(file_name, 'rb') as f:
    merger.append(f, import_bookmarks=False )

merger.write("result.pdf")

A: If the method @Tonechas mentions doesn't work for you, try the method @hannal mentions on GitHub. I implemented it into a separate file that I import like so:
from __pypdf2_fix import NewPdfFileReader as PdfFileReader, NewPdfFileMerger as  PdfFileMerger

The file:
from PyPDF2 import PdfFileReader, PdfFileMerger
from PyPDF2.pdf import ArrayObject, NameObject
from PyPDF2.utils import isString
from PyPDF2.merger import _MergedPage
from io import BytesIO
from io import FileIO as file
StreamIO = BytesIO

class NewPdfFileReader(PdfFileReader):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

def _newBuildOutline(self, node):
    dest, title, outline = None, None, None

    if "/A" in node and "/Title" in node:
        # Action, section 8.5 (only type GoTo supported)
        title  = node["/Title"]
        action = node["/A"]
        if action["/S"] == "/GoTo":
            dest = action["/D"]
    elif "/Dest" in node and "/Title" in node:
        # Destination, section 8.2.1
        title = node["/Title"]
        dest  = node["/Dest"]

    # if destination found, then create outline
    if dest:
        if isinstance(dest, ArrayObject):
            outline = self._buildDestination(title, dest)
        elif isString(dest) and dest in self._namedDests:
            outline = self._namedDests[dest]
            outline[NameObject("/Title")] = title
        elif isinstance(dest, NameObject):
            pass
        else:
            raise utils.PdfReadError("Unexpected destination %r" % dest)
    return outline

NewPdfFileReader._buildOutline = _newBuildOutline

class NewPdfFileMerger(PdfFileMerger):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

def newMerge(self, position, fileobj, bookmark=None, pages=None, import_bookmarks=True):
        """
        Merges the pages from the given file into the output file at the
        specified page number.

        :param int position: The *page number* to insert this file. File will
            be inserted after the given number.

        :param fileobj: A File Object or an object that supports the standard read
            and seek methods similar to a File Object. Could also be a
            string representing a path to a PDF file.

        :param str bookmark: Optionally, you may specify a bookmark to be applied at
            the beginning of the included file by supplying the text of the bookmark.

        :param pages: can be a :ref:`Page Range <page-range>` or a ``(start, stop[, step])`` tuple
            to merge only the specified range of pages from the source
            document into the output document.

        :param bool import_bookmarks: You may prevent the source document's bookmarks
            from being imported by specifying this as ``False``.
        """

        # This parameter is passed to self.inputs.append and means
        # that the stream used was created in this method.
        my_file = False

        # If the fileobj parameter is a string, assume it is a path
        # and create a file object at that location. If it is a file,
        # copy the file's contents into a BytesIO (or StreamIO) stream object; if
        # it is a PdfFileReader, copy that reader's stream into a
        # BytesIO (or StreamIO) stream.
        # If fileobj is none of the above types, it is not modified
        decryption_key = None
        if isString(fileobj):
            fileobj = file(fileobj, 'rb')
            my_file = True
        elif isinstance(fileobj, file):
            fileobj.seek(0)
            filecontent = fileobj.read()
            fileobj = StreamIO(filecontent)
            my_file = True
        elif isinstance(fileobj, PdfFileReader):
            orig_tell = fileobj.stream.tell()
            fileobj.stream.seek(0)
            filecontent = StreamIO(fileobj.stream.read())
            fileobj.stream.seek(orig_tell) # reset the stream to its original location
            fileobj = filecontent
            if hasattr(fileobj, '_decryption_key'):
                decryption_key = fileobj._decryption_key
            my_file = True

        # Create a new PdfFileReader instance using the stream
        # (either file or BytesIO or StringIO) created above
        pdfr = NewPdfFileReader(fileobj, strict=self.strict)
        if decryption_key is not None:
            pdfr._decryption_key = decryption_key

        # Find the range of pages to merge.
        if pages == None:
            pages = (0, pdfr.getNumPages())
        elif isinstance(pages, PageRange):
            pages = pages.indices(pdfr.getNumPages())
        elif not isinstance(pages, tuple):
            raise TypeError('"pages" must be a tuple of (start, stop[, step])')

        srcpages = []
        if bookmark:
            bookmark = Bookmark(TextStringObject(bookmark), NumberObject(self.id_count), NameObject('/Fit'))

        outline = []
        if import_bookmarks:
            outline = pdfr.getOutlines()
            outline = self._trim_outline(pdfr, outline, pages)

        if bookmark:
            self.bookmarks += [bookmark, outline]
        else:
            self.bookmarks += outline

        dests = pdfr.namedDestinations
        dests = self._trim_dests(pdfr, dests, pages)
        self.named_dests += dests

        # Gather all the pages that are going to be merged
        for i in range(*pages):
            pg = pdfr.getPage(i)

            id = self.id_count
            self.id_count += 1

            mp = _MergedPage(pg, pdfr, id)

            srcpages.append(mp)

        self._associate_dests_to_pages(srcpages)
        self._associate_bookmarks_to_pages(srcpages)

        # Slice to insert the pages at the specified position
        self.pages[position:position] = srcpages

        # Keep track of our input files so we can close them later
        self.inputs.append((fileobj, pdfr, my_file))

NewPdfFileMerger.merge = newMerge

A: Deval
You can simply concatenate files by using the append method.You can use PyPdf2s PdfMerger class for merging pdf with simple File Concatenation.
Check the simple example without any patch :
from PyPDF2 import PdfFileMerger

pdf_files = ['pdf1.pdf', 'pdf2.pdf']

merger = PdfFileMerger()

for pdf_file in pdf_files:
    merger.append(pdf_file)

merger.write("merge_pdf.pdf")
merger.close()

On the provided link you can find the many more option surround the pdf which can help you to achieve more preciously.
Thanks

redpajama_set_name: RedPajamaStackExchange


text:
Q: "Carry on" vs. "go ahead" I am confused about whether it is okay to say,

"Ok, carry on/go ahead with your job then."

Any help on this simple issue is highly appreciated.

A: As both John Lawler and Hellion note, either option are acceptable. There are some subtle differences between the two. From Hellion:

The only difference I can think of between the two is that carry on should only be used to indicate that a task should be resumed or continued, while go ahead can be used not only for those, but for a task's commencement as well.


text:
Q: Update User Detail api returns DataIntegrityViolationException I'm creating an update API that updates the profile of the super admin, I mapped the member table to a DTO, on the member table password is set to not null and I did not include the password field on the dto because there's a provision for that be, when I tested the API on postman it returned on the console
DataIntegrityViolationException
SQL Error: 1048, SQLState: 23000
Column 'password' cannot be null

Here is my code
Dto
@Getter
@Setter
public class UpdateProfileDto {

    @NotNull(message = "{member.firstName.notNull}")
    @JsonProperty("first_name")
    private String firstName;

    @NotNull(message = "{member.lastName.notNull}")
    @JsonProperty("last_name")
    private String lastName;

    @JsonProperty("nationality")
    private Long nationality;

    @JsonProperty("country_of_residence")
    private Long countryOfResidence;

    @JsonProperty("date_of_birth")
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
    @JsonFormat(pattern = "dd-MM-yyyy")
    @Past(message = "{customer.dateOfBirth.past}")
    private Date dateOfBirth;

    @JsonProperty("current_job_title")
    private String currentJobTitle;

    @NotNull(message = "{member.emailAddress.notNull}")
    @JsonProperty("email_address")
    private String emailAddress;

    @JsonProperty("username")
    private String username;

    @NotNull(message = "{member.phoneNumber.notNull}")
    @PhoneNumber
    @JsonProperty("phone_number")
    private String phoneNumber;

    @Size(max = 300, message = "{member.city.size}")
    @JsonProperty("city")
    private String city;

    @Size(max = 300, message = "{member.state.size}")
    @JsonProperty("state")
    private String state;
}

ServiceImpl
@Override
    @Transactional
    public Member updateProfile(UpdateProfileDto body) {
        Member superAdmin = repository.getOne(id);
        if (superAdmin == null) {
            throw new MemberNotFoundException(id);
        }

        Optional<Role> existingRole = roleJpaRepository.findByCode(RoleType.SUPER_ADMINISTRATOR.getValue());
        if (existingRole.isEmpty()) {
            throw new RoleNotFoundException(RoleType.SUPER_ADMINISTRATOR.getValue());
        }

        Member existing;

        existing = mapper.map(body, Member.class);
        existing.setPassword(superAdmin.getPassword());
        existing.getRoles().add(existingRole.get());
        existing.setNationality(countryRepository.getOne(body.getNationality()));
        existing.setCountryOfResidence(countryRepository.getOne(body.getCountryOfResidence()));
        return adminJpaRepository.save(existing);
    }

Controller
@RestController
@RequestMapping(
        value = "super-admin",
        produces = { MediaType.APPLICATION_JSON_VALUE }
)
public class SuperAdminController {
    private final SuperAdminService service;
    public SuperAdminController(SuperAdminService service) {
        this.service = service;
    }

    @PutMapping("/update")
    public Member updateProfile(@Valid @RequestBody UpdateProfileDto body){
        Member superAdmin =  service.updateProfile(body);
        return superAdmin;
    }
}

The password bug has been fixed(changes reflected in serviceImpl), but when I run the code it returned Duplicate entry 'ijava@gmail.com-111803918380' for key 'member.email_address_phone_number_uq' email, and the phone number is set as a unique constraint in the member table, how can I bypass this?

A: You have few options, depending on your exact use case.

*

*Extract existing password, using unique property in UpdateProfileDto, email looks like it can do the job.

Pseudocode:
Member existing = repository.findByEmail;
Member superAdmin = mapper.map(body, Member.class);
superAdmin.setPassword(existing.getPassword());

*Set a dummy value for password, to be updated later on.

superAdmin.setPassword("dummy-password");

*Make the column nullable in database.


text:
Q: Draw part of a circle For an iPhone application I want to draw a circle, that is only for an x percentage filled.
Something like this:

I have no problems calculating the radius, the degrees or the radians, that is no problem. Also drawing the circle is already done. But how do I get the iPhone SDK to draw the part that is filled.
I can draw a rectangle that size, but not part of a circle.
I just want to draw that on a a normal context.
Hope someone can give me any pointers here.

A: Try this:
CGContextMoveToPoint(the center point)
CGContextAddLineToPoint(the starting point of the fill path on the circumference)
CGContextAddArcToPoint(the ending point of the fill path on the circumference)
CGContextAddLineToPoint(the center point)
CGContextFillPath

A: I implemented a pie progress view that looks similar to what you are doing. It's open source. Hopefully the source code will help.
SSPieProgressView.h source
SSPieProgressView.m source

A: A lot of people have showed you how this can be done in Core Graphics but it can also be done with Core Animation which gives the big addition of easily being able to animate the percentage of the pie shape.
The following code will create both the ring and the partly filled layers (even though you said that you already can draw the ring) since its nice to have both the ring and the pie shape to be drawn using the same method.
If you animate the strokeStart or strokeEnd properties of the pieShape layer you will have the percentage animate. As with all Core Animation code you will need to add QuartzCore.framework to your project and include <QuartzCore/QuartzCore.h> in your code.
// Create a white ring that fills the entire frame and is 2 points wide.
// Its frame is inset 1 point to fit for the 2 point stroke width
CGFloat radius = MIN(self.frame.size.width,self.frame.size.height)/2;
CGFloat inset  = 1;
CAShapeLayer *ring = [CAShapeLayer layer];
ring.path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(self.bounds, inset, inset)
                                       cornerRadius:radius-inset].CGPath;

ring.fillColor   = [UIColor clearColor].CGColor;
ring.strokeColor = [UIColor whiteColor].CGColor;
ring.lineWidth   = 2;

// Create a white pie-chart-like shape inside the white ring (above).
// The outside of the shape should be inside the ring, therefore the
// frame needs to be inset radius/2 (for its outside to be on
// the outside of the ring) + 2 (to be 2 points in).
CAShapeLayer *pieShape = [CAShapeLayer layer];
inset = radius/2 + 2; // The inset is updated here
pieShape.path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(self.bounds, inset, inset)
                                        cornerRadius:radius-inset].CGPath;
pieShape.fillColor   = [UIColor clearColor].CGColor;
pieShape.strokeColor = [UIColor whiteColor].CGColor;
pieShape.lineWidth   = (radius-inset)*2;

// Add sublayers
// NOTE: the following code is used in a UIView subclass (thus self is a view)
// If you instead chose to use this code in a view controller you should instead
// use self.view.layer to access the view of your view controller.
[self.layer addSublayer:ring];
[self.layer addSublayer:pieShape];

A: Use CGContext's arc functions:
CGContextAddArc(context,
                centerX,
                centerY,
                radius,
                startAngleRadians,
                endAngleRadians,
                clockwise ? 1 : 0);

See the documentation for CGContextAddArc().

A: CircleViewController.h
#import <UIKit/UIKit.h>

@interface CircleViewController : UIViewController

@end

CircleViewController.m
#import "CircleViewController.h"
#import "GraphView.h"

@interface CircleViewController ()

@end

@implementation CircleViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    GraphView *graphView = [[GraphView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
    graphView.backgroundColor = [UIColor whiteColor];
    graphView.layer.borderColor = [UIColor redColor].CGColor;
    graphView.layer.borderWidth = 1.0f;

    [self.view addSubview:graphView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

GraphView.h
#import <UIKit/UIKit.h>

@interface GraphView : UIView

@end

GraphView.m
#import "GraphView.h"

@implementation GraphView

- (void)drawRect:(CGRect)rect {

    CGPoint circleCenter = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);

    [self drawCircleWithCircleCenter:(CGPoint) circleCenter radius:80 firstColor:[UIColor blueColor].CGColor secondeColor:[UIColor redColor].CGColor lineWidth:2 startDegree:0 currentDegree:90];
    //[self drawCircleWithCircleCenter2:(CGPoint) circleCenter radius:80 firstColor:[UIColor blueColor].CGColor secondeColor:[UIColor redColor].CGColor lineWidth:2 startDegree:0 currentDegree:90];
}

- (void)drawCircleWithCircleCenter:(CGPoint) circleCenter
                            radius:(CGFloat)radius
                            firstColor:(CGColorRef)firstColor
                            secondeColor:(CGColorRef)secondeColor
                            lineWidth:(CGFloat)lineWidth
                            startDegree:(float)startDegree
                            currentDegree:(float)endDegree {

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(context, lineWidth);

    CGContextMoveToPoint(context, circleCenter.x, circleCenter.y);

    CGContextAddArc(context, circleCenter.x , circleCenter.y, radius, [self radians:startDegree], [self radians:endDegree], 0);
    CGContextSetFillColorWithColor(context, firstColor);
    CGContextFillPath(context);

    CGContextMoveToPoint(context, circleCenter.x, circleCenter.y);

    CGContextAddArc(context, circleCenter.x, circleCenter.y, radius, [self radians:endDegree], [self radians:startDegree], 0);
    CGContextSetFillColorWithColor(context, secondeColor);
    CGContextFillPath(context);
}

- (void)drawCircleWithCircleCenter2:(CGPoint) circleCenter
                            radius:(CGFloat)radius
                        firstColor:(CGColorRef)firstColor
                      secondeColor:(CGColorRef)secondeColor
                         lineWidth:(CGFloat)lineWidth
                       startDegree:(float)startDegree
                     currentDegree:(float)endDegree {

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(context, lineWidth);

    CGContextMoveToPoint(context, circleCenter.x, circleCenter.y);

    CGContextAddArc(context, circleCenter.x , circleCenter.y, radius, [self radians:startDegree], [self radians:endDegree], 0);
    CGContextSetFillColorWithColor(context, firstColor);
    CGContextFillPath(context);

    CGContextMoveToPoint(context, circleCenter.x, circleCenter.y);

    CGContextAddArc(context, circleCenter.x, circleCenter.y, radius, [self radians:endDegree], [self radians:startDegree], 0);
    CGContextSetStrokeColorWithColor(context, secondeColor);
    CGContextStrokePath(context);
}

-(float) radians:(double) degrees {
    return degrees * M_PI / 180;
}

@end

note: you can use one of the 2 methods:
"drawCircleWithCircleCenter" or "drawCircleWithCircleCenter2"
this code if you want to split cell on 2 parts only
if you want to split cell on more than 2 parts you can check this : "Drawing a circle ,filled different parts with different color"  and check the answer start with this Phrase "we have 6 class"

A: Well, since nobody used NSBezierPath so far, I figured I could provide the solution I recently used for the same problem:
-(void)drawRect:(NSRect)dirtyRect
{
    double start = -10.0; //degrees
    double end = 190.0; //degrees
    NSPoint center = NSMakePoint(350, 200);
    double radius = 50;

    NSBezierPath *sector = [NSBezierPath bezierPath];
    [sector moveToPoint:center];
    [sector appendBezierPathWithArcWithCenter:center radius:radius startAngle:start endAngle:end];
    [sector lineToPoint:center];
    [sector fill];
}

A: Below is a full method I am using that does this with Core Graphics, adapting and expanding on mharper's comment above.
This code is for OSX Cocoa, but could easily be changed to iOS, by modifying how you get the context.
- (void)drawPieShapedCircleWithRadius:(CGFloat)radius
                      strokeColor:(CGColorRef)strokeColor
                        fillColor:(CGColorRef)fillColor
                        lineWidth:(CGFloat)lineWidth
                   currentDegrees:(float)currentDegrees
                     startDegrees:(float)startDegrees {
    // get the context
    CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];

    // Set the color of the circle stroke and fill
    CGContextSetStrokeColorWithColor(context, strokeColor);
    CGContextSetFillColorWithColor(context, fillColor);

    // Set the line width of the circle
    CGContextSetLineWidth(context, 1);

    // Calculate the middle of the circle
    CGPoint circleCenter = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);

    // Move the bezier to the center of the circle
    CGContextMoveToPoint(context, circleCenter.x, circleCenter.y);  // move to the center point

    // Draw the arc from the start point (hardcoded as the bottom of the circle) to the center
    CGContextAddLineToPoint(context, circleCenter.x, circleCenter.y + radius);

    // Draw the arc around the circle from the start degrees point to the current degrees point
    CGContextAddArc(context, circleCenter.x , circleCenter.y, radius, [self radians:startDegrees], [self radians:startDegrees + currentDegrees], 0);

    // Draw the line back into the center of the circle
    CGContextAddLineToPoint(context, circleCenter.x, circleCenter.y);

    // Fill the circle
    CGContextFillPath(context);

    // Draw the line around the circle
    CGContextStrokePath(context);
}

A: Try this code in a UIView, Example "MyChartClass"...
- (void)drawRect:(CGRect)rect {
    int c=(int)[itemArray count];

    CGFloat angleArray[c];
    CGFloat offset;
    int sum=0;

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetAllowsAntialiasing(context, false);
    CGContextSetShouldAntialias(context, false);

    for(int i=0;i<[itemArray count];i++) {
        sum+=[[itemArray objectAtIndex:i] intValue];
    }

    for(int i=0;i<[itemArray count];i++) {
        angleArray[i]=(float)(([[itemArray objectAtIndex:i] intValue])/(float)sum)*(2*3.14);
        CGContextMoveToPoint(context, radius, radius);
        if(i==0)
            CGContextAddArc(context, radius, radius, radius, 0,angleArray[i], 0);
        else
            CGContextAddArc(context, radius, radius, radius,offset,offset+angleArray[i], 0);
        offset+=angleArray[i];

        CGContextSetFillColorWithColor(context, ((UIColor *)[myColorArray objectAtIndex:i]).CGColor);
        CGContextClosePath(context);
        CGContextFillPath(context);

    }
}

Implementation in your UIViewController
MyChartClass *myChartClass=[[MyChartClass alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
myChartClass.backgroundColor = [UIColor clearColor];
myChartClass.itemArray=[[NSArray alloc]initWithObjects:@"75",@"25", nil];
myChartClass.myColorArray=[[NSArray alloc]initWithObjects:[UIColor blackColor],[UIColor whiteColor], nil];
myChartClass.radius=100;
[self.view addSubview:myChartClass];

Regards.


text:
Q: please how to change color in php code in wordpress i have this code to hide price in woocommerce until user login i want to change the message color that will appear "login to see price" the code is:
add_filter( 'woocommerce_get_price_html', 'bbloomer_hide_price_addcart_not_logged_in', 9999, 2 );

function bbloomer_hide_price_addcart_not_logged_in( $price, $product ) {

if ( ! is_user_logged_in() ) {

   $price = '
' . __( 'login to see price', 'bbloomer' ) . '
';

  remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );

  remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}

return $price;

}

A: Just add style="color:yourcolor" to link section, example
add_filter( 'woocommerce_get_price_html', 'bbloomer_hide_price_addcart_not_logged_in', 9999, 2 );
function bbloomer_hide_price_addcart_not_logged_in( $price, $product ) {

    if ( ! is_user_logged_in() ) {

        $price = '
' . __( 'login to see price', 'bbloomer' ) . '
';

        remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );

        remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    }
    return $price;
}


text:
Q: How to reassign a reference in C++ Currently, my code is something like this:
vector<vector<string>> result;

for (Example e : someExampleIterable) {
    result = e.evaluate(result);
}

// Do some operations with the result later

vector<vector<string>> Example::evaluate(vector<vector<string>> intermediate) {
    vector<vector<string>> result;
    vector<vector<string>> newTable = someExternalAPI.get(someAttributeOfThisObject);

    for (vector<string> row : intermediate) {
        // Some complex operation that combines and manipulates data from newTable & intermediate
        result.push_back(final_data);
    }

    return result;
}

As you can see what I'm trying to achieve is like a "pipeline" sort of loop where I constantly update my result.
Since my function that manipulates the existing table involves creating a new table and returning it due to the complex operations done with the newTable and intermediateTable (plus this is how I coded it to have this pipeline), is there a way where I can use references so that I do not have to keep on shallow copying my vector<vector> which I understand is expensive in C++, especially since my intermediate can be quite large.
Would changing the function definition to the below work even with the reassigning? Or what is the best practice for this kind of pipelining kind of loop.
vector<vector<string>> Example::evaluate(vector<vector<string>>& intermediate)

If possible, I would want to do a:
void Example::evaluate(vector<vector<string>>& intermediate)

where I can manipulate my intermediate table directly but as mentioned, the operations are quite complex and it would be easier to do on a new empty table and return it.
Thanks!


text:
Q: Parsing date as string from csv to pandas I have been trying to use panda to parse date as string from my csv.
What I am trying to achieve here is to extract a row (from the csv) which contains two type of data, string and integer.
From here, I want to use docx-mailmerge to produce Microsoft Word reports.
For context, I was referring to the solutions here when figuring out:
datetime dtypes in pandas read_csv
Thank you.
Here is error I am getting:

ValueError: invalid literal for int() with base 10: 'Num'

Here is my code:
import pandas as pd

headers = ['AA', 'Num']
dtypes = {'AA': 'str', 'Num': 'int'}
pdate = ['AA']

df = pd.read_csv('test1.csv',
header=None,
names = headers,
dtype = dtypes,
parse_dates = pdate,
date_parser=None)

top = df.head()
print(top)

Here is my csv file:
AA,Num
1/1/2020,5
2/1/2020,10
3/1/2020,15
4/1/2020,20
5/1/2020,25
6/1/2020,30
7/1/2020,35
8/1/2020,40
9/1/2020,45
10/1/2020,50
11/1/2020,55

A: I think problem is parameter header=None, it is used if no headers in csv. So remove it. Also parameter names = headers should be omit, if need parse all columns:
#here is set new columns names, so original headers are shift to first row of data
df = pd.read_csv('test1.csv',
header=None,
names = headers,
#dtype = dtypes,
#parse_dates = pdate,
date_parser=None)

top = df.head()
print(top)
         AA  Num
0        AA  Num
1  1/1/2020    5
2  2/1/2020   10
3  3/1/2020   15
4  4/1/2020   20

Correct parsing:
df = pd.read_csv('test1.csv',
#header=None,
#names = headers,
dtype = dtypes,
parse_dates = pdate,
date_parser=None)

top = df.head()
print(top)
          AA  Num
0 2020-01-01    5
1 2020-02-01   10
2 2020-03-01   15
3 2020-04-01   20
4 2020-05-01   25

If need filter only some columns instead names = headers use usecols=headers parameter.

A: Here is the working code:
headers = ['AA', 'Num']
dtypes = {'AA': 'str', 'Num': 'int'}
pdate = ['AA']

df = pd.read_csv('test1.csv',
dtype = dtypes,
parse_dates = pdate,
date_parser=None)

top = df.head()
print(top)


text:
Q: SQL Server Reporting Services not passing the correct parameter from SQL Stored Procedure I have a SQL stored procedure that calls the most recent date from a certain cycle. This date includes a bunch of data points that are populated into the report. When I execute the SELECT statement alone, it pulls the correct date I want. In SSRS, it pulls the second to last date... I have the TOP 1 in there to select the most recent along with the DESC. I was wondering if I have an issue with my parameters within SSRS. The report is set up as 2 sub-reports. The first sub-report is just an overview page and the second is the actual report that contains all the data with the Start and End date. @Phase1Start and @Phase1End are my parameters being pass to the sub-report that contains all the data points. Also, the reason I do not have single quotes around the 1 is because CycleComplete is a bit. Any solutions?
I have already tried:
-Changing the date types from datetime's to text's
-Including single quotes around the 1
Here is my Stored Procedure:
DECLARE @Phase1Start as datetime
DECLARE @Phase1End as datetime

  SELECT
        @Phase1Start = (SELECT TOP 1 [CycleStartedOn] FROM [dbo].[IPEC_P_CIP_TKB_PREFLT] WHERE [CycleComplete] = 1 ORDER BY [CycleStartedOn] DESC)
        ,@Phase1End = (SELECT TOP 1 [CycleEndedOn] FROM [dbo].[IPEC_P_CIP_TKB_PREFLT] WHERE [CycleComplete] = 1 ORDER BY [CycleStartedOn] DESC)

  DECLARE @tblReports TABLE
(
    Phase1Start datetime
    ,Phase1End datetime
    )

    INSERT INTO @tblReports
(
    Phase1Start
    ,Phase1End
    )

Values
(
    @Phase1Start
    ,@Phase1End
    )

SELECT * FROM @tblReports

END

The stored procedure compiles correctly and gives me the start and end times I want. The issue is within SSRS not pulling the correct date from the stored procedure even though I have @Phase1Start and Phase1End as my parameters being passed to the sub-report that contains all the data.

A: Is it possible that our first sub query and the second sub query return different records?  Perhaps this might help:
SELECT Top(1) @Phase1Start = [CycleStartedOn], @Phase1End = [CycleEndedOn] FROM [dbo].[IPEC_P_CIP_TKB_PREFLT] WHERE [CycleComplete] = 1 ORDER BY [CycleStartedOn] DESC

A: You could use the group by
SELECT  @Phase1Start = MAX([CycleStartedOn] ) ,
        @Phase1End = MAX([CycleEndedOn])
FROM        [dbo].[IPEC_P_CIP_TKB_PREFLT]
WHERE    [CycleComplete] = 1


text:
Q: What are good coding editors that can run without a GPU? I have a VM with Ubuntu, which I use mainly for testing code written with my usual tools in Windows. I connect to the VM with ssh and use X11 forwarding.
I'm used to VS Code and Sublime Text, but as the VM setup does not provide it a GPU I quickly found that this makes both render pretty slowly, with big lags even for scrolling through code. I've considered X11 forwarding being the problem, but other programs like nautilus don't show the lags.
So what are my options for an editor that runs well with just the CPU for rendering itself?


text:
Q: How to typeset ``...(e.g. Equation 6)` using cleveref? I use the cleveref package to produce equation references like Figure 3 and Equation (12). The parentheses for equation references are fine most of the time, but it seems silly when the reference is already enclosed by parentheses.
When I use ...(e.g. \Cref{eqn:ExampleEqn}), it typesets it as ...(e.g. Equation (6)). What I want is it to look like ...(e.g. Equation 6).
I know \citep{} has the ability to typeset citations differently: \citep[e.g.][]{Author2019} produces (at least, using the Elsevier author-year citation style) (e.g. Author, 2019). I'm hoping for something like this with cleveref.
Does cleveref have a "clever" way to reference things inside parentheses so that it doesn't add the extra set of parentheses? If so, how? If not, what is a good way to do that for this one time (similar SX questions have answers that generally are for the entire document)?

A: Make the parentheses to be inserted by macros which you can redefine at will.
\documentclass{article}
\usepackage{amsmath}
\usepackage{cleveref}

\crefformat{equation}{Equation~\textup{\OPEN#2#1#3\CLOSE}}
\newcommand{\OPEN}{(}
\newcommand{\CLOSE}{)}
\newcommand{\tcref}[1]{%
  \begingroup
  \renewcommand{\OPEN}{}%
  \renewcommand{\CLOSE}{}%
  \cref{#1}%
  \endgroup
}

\begin{document}

\begin{equation}
a=b \label{test}
\end{equation}

\cref{test}

\tcref{test}

\end{document}


text:
Q: jvm crashes as soon as I press escape
Possible Duplicate:
what is wrong with this call to the java method?

The following C snippet calls a java function whenever the escape key is pressed. The first block of C snippet executes on a different thread and second block executes on a different thread.When i press the escape key,the message escape key pressed is displayed and then the jvm crashes.Why doesn't the java function get called ?
C Code :
    if(called) {// starts on a different thread
    switch(param) {
        case VK_CONTROL:
            printf("Control pressed !\n");
            //(*Env)->CallVoidMethodA(Env,Obj,mid,"11");
            break;
        case VK_SHIFT:
            printf("Shift pressed !\n");
            //(*Env)->CallVoidMethodA(Env,Obj,mid,"10");
            break;
        case VK_ESCAPE:
            printf("Escape pressed !\n");
            JavaVM *jvm;
            JNIEnv *env;
            jmethodID mid;
            env = (*jvm)->AttachCurrentThread(jvm,&env,NULL);
            jclass cls = (*env)->GetObjectClass(env,Obj);
            mid = (*env)->GetMethodID(env,cls,"callBack","(Ljava/lang/String;)V");
            (*env)->CallVoidMethodA(env,Obj,mid,(*env)->NewStringUTF(env,"1B")); // Calling the java function
            break;
        default:
            printf("The default case\n");
            break;
    }}

    void Java_keylogger_TestKeys_initializeJNIVars
     (JNIEnv *env, jobject obj) { // starts on a different thread

      Obj = (*env)->NewGlobalRef(env,obj);
      if(Obj == NULL) {
        printf("Obj is Null\n");
      }
      called = TRUE;
   }

Java Snippet :
    public void callBack(String key) {
      String x = KeyEvent.getKeyText(Integer.parseInt(key, 16));
      System.out.println(x);
    }

I have uploaded the complete code with the output here.

A: You need to initialize your jvm variable. You can do this using JNI_CreateJavaVM()method. See here for more information: http://docs.oracle.com/javase/1.4.2/docs/guide/jni/spec/invocation.html


text:
Q: gitk command not found git version: 2.29.1 Recently i updated my git using homebrew, even though it took a long time, it got updated.
Post which gitk results in command not found
Tried debugging by following this stack overflow Question still no use
Have attached a screen shot which show the steps followed from the link mentioned above

Update 1: post googling someone suggested to install gitk using homebrew and it didn't work either

A: Even thought brew install gitk didn't work, tried brew install git-gui post which gitk worked as usual.


text:
Q: PHP read .txt file and create an array i need read a .txt file and create an array for get values.
I mainly want to do it in php, but I accept other suggestions
[Slot000] can be as many as people are inside the server (001, 002, 003... 010,011...)
The .txt file updates every 5 seconds.
Thanks for help me!
Example of code:
[Server]
ServerPLR=DedicatedServer
LobbyName=xFactorracing.com V8 OR
ModName=V8Factor Unleashed 2012 v1.1
Aids=0,0,1,1,0,0,0,0,1,1,3

[Session]
Scene=Queensland International Raceway
TrackAIW=Queensland.AIW
TrackLength=3134.0745
StartTime=2013-08-09 05:26:27
LengthLaps=-1
LengthTime=90
DarkCloud=0.00
Raining=0.00
AmbientTemp=24.8
TrackTemp=24.3
OnPathWetness=0.00
OffPathWetness=0.00
SessionTime=1.005314
Session=Practice1
GamePhase=Preparing
YellowFlag=None
SectorYellowFlags=(0,0,0)
FCY_log=()

[Slot000]
Driver=daniel
Vehicle=Unknown
VehicleClass=Unknown
IsAI=1
Position=1
Laps=0
InSector=1
BestLap=-1.000
LastLap=-1.000
BestSectors=(-1.000, -1.000, -1.000)
LastLapSectors=(-1.000, -1.000, -1.000)
Sectors=(-1.000, -1.000, -1.000)
Pitstops=0
InPits=1
TimeGapToLider=0.000
LapGapToLider=0
TimeGapToPrev=0.000
LapGapToPrev=0
LapDistanceTravelled=-1.069
FinishStatus=None

[END]

A: Your text file follows the php.ini format/structure, so you can conveniently use the parse_ini_ functions (see manual), instead of writing a custom parser. The line FCY_log=() throws an error though, () (empty brackets) isn't acceptable syntax, so we're doing a bit of preprocessing before parsing the string. It's still simple enough:
$raw = file_get_contents('file.txt');
$raw = str_replace('=()', '=', $raw); // fixing the offending value
$data = parse_ini_string($raw, true, INI_SCANNER_TYPED);
var_dump($data);

If there were no syntax anomalies, you could simply use parse_ini_file('file.txt') instead. In any case, this produces an associative array, as follows:
array(4) {
    ["Server"] · array(4) {
        ["ServerPLR"] · string(15) "DedicatedServer"
        ["LobbyName"] · string(23) "xFactorracing.com V8 OR"
        ["ModName"] · string(28) "V8Factor Unleashed 2012 v1.1"
        ["Aids"] · string(21) "0,0,1,1,0,0,0,0,1,1,3"
    }
    ["Session"] · array(18) {
        ["Scene"] · string(32) "Queensland International Raceway"
        ["TrackAIW"] · string(14) "Queensland.AIW"
        ["TrackLength"] · float(3134.0745)
        ["StartTime"] · string(19) "2013-08-09 05:26:27"
        ["LengthLaps"] · int(-1)
        ["LengthTime"] · int(90)
    ...

Since there can be several slots, presumably having keys with identical names, we are using the process_sections option, parse_ini_string($raw, **true**), which yields a multidimensional array grouped by section headings. We're also using the INI_SCANNER_TYPED flag; without it, all values would be of "string" type. (Which may or may not matter in your use case.)


text:
Q: Classes and Data Abstraction Write a C++ class code to calculate the area of a rectangle as illustrated in the following  figure.
Your code must be in a Project contains 3 separate files.

*

*Implementation file (.cpp)

*Header file (.h)

*Main file (.cpp)

Here is the image for the question:

Code:
main.cpp:
   #include "area.h"
   #include <iostream>
   using namespace std;
   int main(int argc, char *argv[])
   {

       Rectangle obj;
       obj.setLength(8);
       obj.setWidth(3);
       cout<<"Area of Rectangle : "<<obj.getArea();
       cout<<endl;

       return 0;
   }

area.h:
   #include <iostream>
   using namespace std;
   #ifndef area_h
   #define area_h

  class Rectangle
  {
       public:
       double length, width,Area;
       Rectangle();
       double setLength(int a );
       double setWidth(int b);
       double getArea();
  };
  #endif

area.cpp:
#include "area.h"

Rectangle::Rectangle()

double Rectangle::setLength(int a)
{length = a}
double Rectangle::setWidth(int b)
{width = b}

 double Rectangle::getArea(){return Area= a * b;}

When i run the code, it shows this error:

A: I don't know how your IDE works, but you need to either link in the object file for area.cpp when you're compiling main.cpp, or you need to compile both at the same time, eg. g++ -Wall -Wextra main.cpp area.cpp.
After you fix the linking issues, you need to change getArea to:
double Rectangle::getArea(){
    Area = length * width;
    return Area;
}

as a and b are both undefined.
Next, you have a bunch of syntax errors that should be corrected, such as missing semicolons.
Finally, both setLength and setWidth should be void, not double as they don't return anything.
Rewritten area.cpp:
#include "area.h"

void Rectangle::setLength(int a){
    length = a;
}
void Rectangle::setWidth(int b){
    width = b;
}

double Rectangle::getArea(){
    Area = length * width;
    return Area;
}

Other helpful links, though not directly related:
"std::endl" vs "\n"
Why is "using namespace std;" considered bad practice?


text:
Q: How to update from basic authentication to modern authentication using node-ews in node js application to send email ?So what are the things I need? I'm using node js application to send email by using node-ews ,as part of that I want update authentication from basic to modern OAuth2 .So what are the things I need to do.

A: The first thing you need to do is get an Access token so I'd suggest you use Microsoft Auth libraries https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-node-migration
Depending on the type of application you have eg is it a daemon app or a Interactive app will determine what type of Azure credentials flow you should use.
Once you have the token you just need to change the node-ews code to use it eg

// exchange server connection info
const ewsConfig = {
  username: 'myuser@domain.com',
  token: 'oauth_token...',
  host: 'https://outlook.office365.com',
  auth: 'bearer'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

One thing to be careful of is that library doesn't support any callbacks to check for token expiration. So if you have a process that runs for more the one hour you will need to deal with checking for the token expiration and getting a new token. I'd suggest you fork the library and modify the https://github.com/nmarus/node-ews/blob/master/lib/auth/bearer.js to include this if needed.


text:
Q: Load String into RichTextBox I fail at finding a way to Load a String that is NOT coming from a File into a new Instance of an RichTextBox. Specifically, the Text is coming from an Excel-Sheet, that contains RTF-formatted Text.
There is the LoadFile-Method for loading Files into a RichTextBox, that is overloaded for use with Streams:
LoadFile(Stream, RichTextBoxStreamType)

My Progress so far:
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$rtb = New-Object System.Windows.Forms.RichTextBox
$rtb.LoadFile($Worksheet.Cells.Item(1,9).Text, [System.Windows.Forms.RichTextBoxStreamType]::RichText)

Is this the right way to do it? Am I heading in the wrong direction?
Any Help is greatly appreciated!

A: The RichTextBox class has a property Rtf. When constructing a new instance of the RichTextBox, you could set the Rtf property by using the -property parameter of New-Object:
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$rtb = New-Object System.Windows.Forms.RichTextBox -property @{
    rtf = $Worksheet.Cells.Item(1,9).Text
}


text:
Q: Error to validate connection before publish to azure I imported the publish profile generated by Azure's App Service to Visual Studio. However, when I try to validate the connection, Visual Studio displays the error message . I'm trying to make a Web Deploy.

The error occurs after I click this button


text:
Q: Adding mean and standard deviation to each other I make a certain measurement and I would like to arrive at a single descriptive number that would give me an idea of both the average value of the measurement, as well as the deviation from the mean. In fact, the deviation (general extent - how far do the values go?) interests me more than the mean, but I am aware that interpreting the standard deviation value without the mean will lead me astray. I am considering adding mean and standard deviation together (mean + stdiv = new measure) - how horridly wrong will that be from the statistical point of view?
As requested, here are the details: my goal is to measure the extent of saturation in the hidden layer outputs of a neural network. Hidden layer consists of hidden units, where every unit receives weighted real-valued inputs and produces a real-valued output within a certain range (typically [0,1]). An individual output is produced for every pattern in a dataset.
In other words, I have a data set (outputs of the hidden units for all patterns in the data set, recorded n times, where n is the number of algorithm iterations), and I would like to see how the average activation value (hidden unit output) changes from iteration to iteration, as well as how much it fluctuates.


text:
Q: Discord.py: Compare command author to reaction author For context, I have a bot command which creates an embed and adds specific reactions to it. It also keeps track of those reactions for a while (until the timeout countdown reaches 0) and responds to them according to an if statement tree. It works as expected, but the reactions to a given embed are applied to all other embeds created by this command, no matter who executes it. To handle this, I decided to add the command user's ID to the new_page variable name. That would make it so it always generates a new embed for a different user.
The problem is I cannot seem to get the reaction author's ID, so comparing it to the command author's ID is impossible.
def make_page(ctx, die, result=' '):
    page = discord.Embed (
        title = die,
        description = f"""```css\n{result}```"""
    )
    return page

@client.command()
async def roller(ctx):

    author = ctx.author.id # here I'm trying to get the  command author's ID
    dice = ['d4', 'd6', 'd8', 'd10', 'd12', 'd20', 'd100']
    page = make_page(ctx, dice[0])

    message = await ctx.send(embed = page)
    await message.add_reaction('⏮')
    await message.add_reaction('◀')
    await message.add_reaction('')
    await message.add_reaction('▶')
    await message.add_reaction('⏭')

    def check(reaction, user):
        return user == ctx.author

    i = 0
    reaction = None

    while True:

        if str(reaction) == '⏮':
            if reaction.users() == author:  # here I'm trying to get the reaction user's ID
                                            # and compare it to the command author's ID
                i = 0
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)

        elif str(reaction) == '◀':
            if i > 0:
                i -= 1
                new_page = make_page(ctx, dice[i])  # I would modify this section, adding the
                                                    # command author's ID to the variable
                await message.edit(embed = new_page)
        elif str(reaction) == '▶':
            if i < 6:
                i += 1
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)
        elif str(reaction) == '⏭':
            i = 6
            new_page = make_page(ctx, dice[i])
            await message.edit(embed = new_page)

        elif str(reaction) == '':
            result, explanation = rolldice.roll_dice(dice[i])
            new_page = make_page(ctx, dice[i], result)
            await message.edit(embed = new_page)

        try:

            reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
            await message.remove_reaction(reaction, user)
        except:
            break

    await message.clear_reactions()

A: It looks like you get the user data in the line :
reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
So would you just use user.id instead of reaction.users() ?
Here is what I would try:
def make_page(ctx, die, result=' '):
    page = discord.Embed (
        title = die,
        description = f"""```css\n{result}```"""
    )
    return page

@client.command()
async def roller(ctx):

    author = ctx.author.id # here I'm trying to get the  command author's ID
    dice = ['d4', 'd6', 'd8', 'd10', 'd12', 'd20', 'd100']
    page = make_page(ctx, dice[0])

    message = await ctx.send(embed = page)
    await message.add_reaction('⏮')
    await message.add_reaction('◀')
    await message.add_reaction('')
    await message.add_reaction('▶')
    await message.add_reaction('⏭')

    def check(reaction, user):
        return user == ctx.author

    i = 0
    reaction = None
    user = None #to stop error as user is only defined later
    while True:

        if str(reaction) == '⏮':
            if user.id == author:  # would this work?
                i = 0
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)

        elif str(reaction) == '◀':
            if i > 0:
                i -= 1
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)
        elif str(reaction) == '▶':
            if i < 6:
                i += 1
                new_page = make_page(ctx, dice[i])
                await message.edit(embed = new_page)
        elif str(reaction) == '⏭':
            i = 6
            new_page = make_page(ctx, dice[i])
            await message.edit(embed = new_page)

        elif str(reaction) == '':
            result, explanation = rolldice.roll_dice(dice[i])
            new_page = make_page(ctx, dice[i], result)
            await message.edit(embed = new_page)

        try:

            reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
            await message.remove_reaction(reaction, user)
        except:
            break

    await message.clear_reactions()

Is this what you want ? :)


text:
Q: How do I create vector images for WPF I want to use vector images in my WPF-application (for buttons and menus). How do I do that? Which tools should I use? Can someone show my a complete example?

A: ##Tools to create XAML vector images##
Probably the best application to create XAML vector images is Microsoft Expression Design. It's a free tool that could be downloaded from http://expressiondesign4.com/
When you have installed Expression Design, launch it and select Edit -> Options -> Clipboards (XAML). Change Clipboard format to XAML WPF Resource Dictionary. Also change Group By to Document (otherwise each layer will be an image).
Edit your image in Expression Design. When you are done, select everything and open the Edit menu and then Copy XAML.  Paste this in appropriate XAML-file. You see in the example below how it should look like. One thing to note is that you need to change DrawingImage tag to DrawingBrush.
When you are drawing the image set the document size to the size you want in your WPF-application (like 32x32 pixels). It not necessary but make the work easier. Before copy the image to XAML you probably want to make a transparent rectangle that has the same size as the document (otherwise the margins could be wrong). Or you could add this manually in the drawing group children:
<GeometryDrawing Brush="#00FFFFFF" Geometry="M 0,0L 32,0L 32,32L 0,32L 0,0 Z " />

###If you are using Inkscape###
Inkscape has support to generate XAML-files. However - this is probably not the format you want! WPF has two different ways to handle graphics in XAML – shapes and geometries. You can find more details about this here: http://www.intertech.com/Blog/WPF-Shapes-vs-WPF-Geometries/.
But in short shapes has support for inputs, while geometries is just pure drawing and therefor more lightweight.
Inkscape generate files in shape-format, which is good for some cases but not for images that should be used in buttons and similar. So what you want is to get your images into Expression Design. You could do that by saving your image as a PDF-file, change the file extension to AI and then in Expression Design use File, Import Adobe Illustrator File. Using EPS is another option.
Most things could be imported to Expression Design. But it might be some issues with borders for instance. When you have got what you want to Expression Design it's probably better to do all the work in there. If needed you could export your images to SVG which could be used in Inkscape, that normally works without any problems.
#Example#
When you have created XAML-code for the image it's then quite straight forward. Below is an example where a vector image is used on a menu and two button.
If you want to draw a very thin line (1 pixel), you may want to add RenderOptions.EdgeMode="Aliased" and SnapsToDevicePixels="True" to the attributes to the control that is drawing the image.
Another thing to have in mind is what to do when a button is disabled. In the example below the image looks the same no matter if the button is enabled or not (this is true for ordinary bitmaps too). Changing the opacity to 50% is one approach that looks quite OK. Converting it grey scale is harder but there is solutions for this too.

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
    x:Class="VectorGraphicsDemo.MainWindow"
    Title="MainWindow"
    Height="350"
    Width="616">

<Window.Resources>
    <!-- Note: When Expression Designed generated the code it was generated
         as DrawingBrush. Remember to change this to DrawingImage. -->
    <DrawingImage x:Key="TestImage">
        <DrawingImage.Drawing>
            <DrawingGroup>
                <GeometryDrawing Brush="#00FFFFFF"
                                 Geometry="M 0,0L 32,0L 32,32L 0,32L 0,0 Z " />
                <GeometryDrawing Brush="#FFFF0000"
                                 Geometry="F1 M 6.25,3.97918L 23.125,3.97918L 23.125,16.1458L 6.25,16.1458L 6.25,3.97918 Z ">
                    <GeometryDrawing.Pen>
                        <Pen LineJoin="Round"
                             Brush="#FF000000" />
                    </GeometryDrawing.Pen>
                </GeometryDrawing>
                <GeometryDrawing Brush="#FF00C800"
                                 Geometry="F1 M 21.8542,11.0625C 26.399,11.0625 30.0833,14.7468 30.0833,19.2917C 30.0833,23.8365 26.399,27.5208 21.8542,27.5208C 17.3093,27.5208 13.625,23.8365 13.625,19.2917C 13.625,14.7468 17.3093,11.0625 21.8542,11.0625 Z ">
                    <GeometryDrawing.Pen>
                        <Pen LineJoin="Round"
                             Brush="#FF000000" />
                    </GeometryDrawing.Pen>
                </GeometryDrawing>
                <GeometryDrawing Brush="#FFFFFF00"
                                 Geometry="F1 M 16.8731,14.9035L 11.9668,16.2498L 8.58953,12.5761L 8.25831,17.6042L 3.62852,19.7405L 8.33013,21.5017L 8.84603,26.4958L 12.083,22.5562L 17.0316,23.5064L 14.3306,19.3103L 16.8731,14.9035 Z ">
                    <GeometryDrawing.Pen>
                        <Pen LineJoin="Round"
                             Brush="#FF000000" />
                    </GeometryDrawing.Pen>
                </GeometryDrawing>
            </DrawingGroup>
        </DrawingImage.Drawing>
    </DrawingImage>

    <DrawingImage x:Key="TestThinLineImage">
        <DrawingImage.Drawing>
            <DrawingGroup>
                <GeometryDrawing Brush="#00FFFFFF"
                                 Geometry="M 0,0L 32,0L 32,32L 0,32L 0,0 Z " />
                <GeometryDrawing Geometry="F1 M 2,2L 30,2L 30,30L 2,30L 2,2 Z ">
                    <GeometryDrawing.Pen>
                        <Pen LineJoin="Round"
                             Brush="#FF000000" />
                    </GeometryDrawing.Pen>
                </GeometryDrawing>
                <GeometryDrawing Geometry="F1 M 7,8L 25,8L 25,24L 7,24L 7,8 Z ">
                    <GeometryDrawing.Pen>
                        <Pen LineJoin="Round"
                             Brush="#FFFF0000" />
                    </GeometryDrawing.Pen>
                </GeometryDrawing>
            </DrawingGroup>
        </DrawingImage.Drawing>
    </DrawingImage>
</Window.Resources>
<Grid>

    <!-- Menu with image -->
    <Menu HorizontalAlignment="Stretch"
          VerticalAlignment="Top">
        <MenuItem Header="Hello">
            <MenuItem Header="World">
                <MenuItem.Icon>
                    <Image Source="{StaticResource TestImage}" />
                </MenuItem.Icon>
            </MenuItem>
        </MenuItem>
    </Menu>

    <!-- Small standard image -->
    <Button HorizontalAlignment="Left"
            Margin="12,66,0,0"
            VerticalAlignment="Top"
            Width="142"
            Height="43">
        <StackPanel Orientation="Horizontal">
            <Image x:Name="imageSmall"
                   Source="{StaticResource TestImage}"
                   Height="32"
                   Width="32" />
            <Label VerticalAlignment="Center"
                   Content="Small image" />
        </StackPanel>
    </Button>

    <!-- Large standard image -->
    <Button HorizontalAlignment="Left"
            Margin="12,149,0,0"
            VerticalAlignment="Top"
            Width="142"
            Height="75">
        <StackPanel Orientation="Horizontal">
            <Image x:Name="imageLarge"
                   Source="{StaticResource TestImage}"
                   Height="64"
                   Width="64">
            </Image>
            <Label VerticalAlignment="Center"
                   Content="Large image" />
        </StackPanel>
    </Button>

    <!-- Small image with thin line with antialising enabled - looks bad! -->
    <Button HorizontalAlignment="Left"
            Margin="180,67,0,0"
            VerticalAlignment="Top"
            Width="177"
            Height="43">
        <StackPanel Orientation="Horizontal">
            <Image x:Name="imageSmall1"
                   Source="{StaticResource TestThinLineImage}"
                   Height="32"
                   Width="32" />
            <Label VerticalAlignment="Center"
                   Content="Small thin anti alias" />
        </StackPanel>
    </Button>

    <!-- Large image with thin line with antialising enabled - looks bad! -->
    <Button HorizontalAlignment="Left"
            Margin="180,149,0,0"
            VerticalAlignment="Top"
            Width="177"
            Height="75">
        <StackPanel Orientation="Horizontal">
            <Image Source="{StaticResource TestThinLineImage}"
                   Height="64"
                   Width="64">
            </Image>
            <Label VerticalAlignment="Center"
                   Content="Large thin anti alias" />
        </StackPanel>
    </Button>

    <!-- Small image with thin line with antialising disabled - looks OK! -->
    <Button HorizontalAlignment="Left"
            Margin="391,67,0,0"
            VerticalAlignment="Top"
            Width="177"
            Height="43">
        <StackPanel Orientation="Horizontal">
            <Image SnapsToDevicePixels="True"
                   RenderOptions.EdgeMode="Aliased"
                   Source="{StaticResource TestThinLineImage}"
                   Height="32"
                   Width="32" />
            <Label VerticalAlignment="Center"
                   Content="Small thin alias" />
        </StackPanel>
    </Button>

    <!-- Large image with thin line with antialising disabled - looks OK! -->
    <Button HorizontalAlignment="Left"
            SnapsToDevicePixels="True"
            RenderOptions.EdgeMode="Aliased"
            Margin="391,149,0,0"
            VerticalAlignment="Top"
            Width="177"
            Height="75">
        <StackPanel Orientation="Horizontal">
            <Image Source="{StaticResource TestThinLineImage}"
                   Height="64"
                   Width="64" />
            <Label VerticalAlignment="Center"
                   Content="Large thin alias" />
        </StackPanel>
    </Button>
</Grid>

A: If you've got VS2013, you should have Blend. If not, you can add it from Add/Remove Programs, by modifying your Studio installation and checking the box.
Once you've got Blend, you can build vector images using the slightly too basic tools it provides; but more useful is its ability to import Adobe Illustrator files. This is still the benchmark vector graphics application to work in. This is great if you have a designer to build the assets, or have the skills to do that yourself.
If you need something between the basics of Blend and the all-singing Illustrator, Expression Design is a decent enough option (as already mentioned by @pek).


text:
Q: 3d transform IE10 I have started a 3D rotating image carousel which works fine in Chrome & Firefox but not IE.
I know that IE10+ doesn't yet support the preserve-3d tag but there is meant to be a workaround of putting the transforms on the children, but I can't get it to work.
Any ideas and help will be most welcome.
http://codepen.io/gnm67/pen/izyjs
    #Carousel {
  display: block;
  margin:100px auto 20px auto;

  -webkit-perspective: 1000px;
  -moz-perspective: 1000px;
  -ms-perspective: 1000px;
  perspective: 1000px;

  -webkit-perspective-origin: 50% 100px;
  -moz-perspective-origin: 50% 100px;
  -ms-perspective-origin: 50% 100px;
  perspective-origin: 50% 100px;
}

#Spinner {
  position: relative;
  margin: 0 auto;
  height: 350px;
  width: 500px;

  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -ms-transform-style: preserve-3d;
  transform-style: preserve-3d;

  -webkit-transform-origin: 50% 400px 0px;
  -moz-transform-origin: 50% 400px 0px;
  -ms-transform-origin: 50% 400px 0px;
  transform-origin: 50% 400px 0px;

  -webkit-transition:all 1.0s ease-in-out;
  -moz-transition:all 1.0s ease-in-out;
  -ms-transition:all 1.0s ease-in-out;
  transition:all 1.0s ease-in-out;

  -ms-perspective: 1000px;
 }

#Carousel .face {
  position: absolute;
  height: 350px;
  width: 500px;
  padding: 0px;
}
#Carousel img {
  width:500px;
    -moz-box-shadow:1px 1px 5px #000;
    -webkit-box-shadow:1px 1px 5px #000;
    box-shadow:1px 1px 5px #000;
}

#Spinner .f0 {
  -webkit-transform: rotateY(0deg) translateZ(344px);
  -moz-transform: rotateY(0deg) translateZ(344px);
  -ms-transform: perspective(1000px) rotateY(0deg) translateZ(344px);
  transform: rotateY(0deg) translateZ(344px);
}
#Spinner .f1 {
  -webkit-transform: rotateY(72deg) translateZ(344px);
  -moz-transform: rotateY(72deg) translateZ(344px);
  -ms-transform: perspective(1000px) rotateY(72deg) translateZ(344px);
  transform: rotateY(72deg) translateZ(344px);
}
#Spinner .f2 {
  -webkit-transform: rotateY(144deg) translateZ(344px);
  -moz-transform: rotateY(144deg) translateZ(344px);
  -ms-transform: perspective(1000px) rotateY(144deg) translateZ(344px);
  transform: rotateY(144deg) translateZ(344px);
}
#Spinner .f3 {
  -webkit-transform: rotateY(216deg) translateZ(344px);
  -moz-transform: rotateY(216deg) translateZ(344px);
  -ms-transform: perspective(1000px) rotateY(216deg) translateZ(344px);
  transform: rotateY(216deg) translateZ(344px);
}
#Spinner .f4 {
  -webkit-transform: rotateY(288deg) translateZ(344px);
  -moz-transform: rotateY(288deg) translateZ(344px);
  -ms-transform: perspective(1000px) rotateY(288deg) translateZ(344px);
  transform: rotateY(288deg) translateZ(344px);
}

A: Note that the -ms- prefix is deprecated, it was supposed to be used only in the release preview, as of the final IE10 the unprefixed properties are supported, which will overwrite the prefixed ones!
That being said, you'll have to change the position of the individual faces instead of rotating the container.
I found the easiest is to shift the faces transform origin into the center, that way you only have to rotate the faces to get the animation running.
Here's a bare to the bones example based on your code: http://jsfiddle.net/k1m045uu/
<!DOCTYPE html>

            Previous Next

See also How to recreate perspective-origin effect by transforming child elements? for some more info regarding perspective origin and a further example.


text:
Q: Parse JSON Dictionary with Python3 I have a JSON representation that looks like the following:
{
    "results": [
       {
         "vulnerabilities": [
         ],
       }
     ]
}

I tried to output just the vulnerabilities portion, but the following doesnt work:
for key, value in json_object.items():
    print(key, ' : ', value)

This prints out the whole results but not just the vulnerabilities

A: Assuming multiple dicts in results, each with a vulnerabilities key, you can do:
json_object = {
    "results": [
       {
         "vulnerabilities": [
         ],
       }
     ]
}

for result in json_object['results']:
    for vuln in result['vulnerabilities']:
        print(vuln)


text:
Q: Patternlab twig includes with params I am using the node version of patternlab with twig as template engine. I am using twig because my codebase is written in twig - so using mustache it not an option.
I simple try to include an pattern:
<button type="button" class="btn {{ buttonClass }}">{{ cta }}</button>

in an other pattern with:
{% include "base-button" with {'buttonClass': 'btn-primary btn-xs'} %}

This does not work. The pattern is included but the variable buttonClass is not set.
Any Ideas?

A: This seems to be an issue with the twig integration in this repo https://github.com/pattern-lab/patternengine-node-twig.
There are other issues with twig core features described here: https://github.com/pattern-lab/patternlab-node/issues/554
I finally decided to switch to the php/twig edition and the same twig-patterns are working as expected. If anybody have to use the node edition, i recommend to use mustache.

A: I believe there are plans to pass the Twig rendering in Pattern Lab Node to PHP, however, this isn't ready yet, but using The Twig engine for Patternlab/Node you can pass a variable via an include. It doesn't work exactly the same as normal twig but it does work.

{% set buttonClass = 'btn-primary btn-xs' %}
{% include "components-button" with buttonClass %}

You can also pass multiple variables:

{% include "components-button" with buttonClass anotherVariable %}


text:
Q: percentage between now date and end date I have 2 dates both already converted into seconds used in a countdown.
the difference between them is the var distance.
How could I get the difference as a percentage.
 var now = new Date();
 var distance = end - now;

both are used in a countdown.
all I wanted is the proper formula to get the  percentage of var distance so I can add it to a progress bar.

A: Below is percentage difference for start time according to UTC timestamp (1 January 1970):
var now = new Date();
var end = new Date(new Date - 100000000); // or new Date(new Date + 100000000);
var difference = Math.abs(now - end) / ( Math.max(now, end) / 100 );

But note in case if  you have other base time your now and end values should be updated according to that time, so before applying formula in code snippet above you have to update now and end values:
now = Math.abs(now - timeSinceYouCalculatingDiff);
end = Math.abs(end - timeSinceYouCalculatingDiff);
// Note timeSinceYouCalculatingDiff should be less than now and end dates

A: The way you can look at it is startDistance * x, where x is the percentage in decimal form, is equal to currentDistance
startDist * x = currentDist
-> x = currentDist/startDist

So, you could do:
(currentDistance/startDistance) * 100

A: you need 3 variables start, now, end
var totaldays = end - now;
var runningDays = now - start;
var percentage = parseInt((runningDays / todalDays)*100);

demo https://jsfiddle.net/vebhq76a/


text:
Q: Command line utility to read vCalendar files I use alpine to read mails, and occasionally get emails from people with vCalendar files in attachment. Is there a command line utility that reads and displays vCalendar files?

A: I just googled and found vcal, a perl script for displaying vcal files. According to the man page it should do exactly what you need.
There is also gcalcli a command line interface for google calendar which allows you to manage your google calendar. This may allow you to add events you received directly to your existing calendar.


text:
Q: Finding the relation between two series My book asks me to find the relationship  between: $$\sum_{n=1}^{\infty}\frac1{(n+a)^3(n+a+1)^3\ldots(n+a+p-1)^3}\text{ and}\sum_{n=1}^{\infty}\frac1{(n+a-1)^3(n+a)^3\ldots(n+a+p)^3}$$
Once I find this relationship (which is probably a relation that expresses one sum in term of the other one, plus some constant) I should be able, by giving special values to $a$ and $p$, to deduce the following transformation: $$\sum_{n=1}^{\infty}\frac1{n^3(n+1)^3}=\frac{83}{630}-\frac{2^3\cdot3^4}{35}\sum_{n=1}^{\infty}\frac1{n^3(n+1)^3(n+2)^3(n+3)^3}$$
I am stuck even at the first point, how do I start?  What's the general approach to solve this kind of problems? (The problem is taken from Knopp's book, in case you want a reference, page 272)


text:
Q: Desktop icons missing after "logging on" to 13.04 So I signed in to my Ubuntu 13.04 (dual booted) computer today and I noticed something strange, the unity lancher had appeared as soon as I signed in, but sign in box has stayed where it is and not disappeared, along with the Ubuntu logo and white dots all over the screen. In addition to this my desktop icons have disappeared.
Any advice as how I could go about getting rid of the login screen and retrieve my icons?
Cheers.

A: create a file with that content:
#!/bin/bash
dconf reset -f /org/compiz/
unity --reset-icons

Save it under any name.
Then go to settings of that file (2nd tab) and make it executable, then double click and run it in a terminal.
Keep that file on desktop if it occurs again...
EDIT
to get rid of the login screen you just have to go the the system settings, go to user, and change to automatic login


text:
Q: Is there an any way to make report result uft has screen capture in every steps? So, I have problem when I try to use the generate document (doc format) from UFT. Because there is not available screen capture for every steps.

Below im attached the generate document from uft and my screen capture setting.


text:
Q: Why is my link for my div linking to my other content? I'm creating a div that gives info about a course. By this information, is the price of the course and a button that says "Take Class" that links to the purchase page. However, the link is leaking into the other info.

/* font */

@import url(https://fonts.googleapis.com/css?family=Open+Sans);

/* end of font */

/* clear settings */

body {
  padding: 0;
  margin: 0;
  background: white;
}

a {
  text-decoration: none;
}

/* end of clear settings */

/* nav */

#nav {
  width: 1600px;
  height: 50px;
  background: #009ACD;
}
/* end of nav */

/* info nav */

#primary_nav_wrap {
  width: 1600px;
  height: 50px;
  background: #1F1F1F;
}
#primary_nav_wrap ul {
  list-style: none;
  position: relative;
  float: left;
  margin: 0;
  padding: 0;
  left: 3%;
  top: 5px;
}
#primary_nav_wrap ul a {
  display: block;
  text-decoration: none;
  font-size: 15px;
  padding: 10px 15px 10px 15px;
  font-family: 'Open Sans', sans-serif;
  color: white;
}
#primary_nav_wrap ul a:hover {
  background: white;
}
#primary_nav_wrap ul li {
  position: relative;
  float: left;
  margin: 0;
  padding: 0;
}
#primary_nav_wrap ul li:hover a {
  color: black;
  background: white;
}
#primary_nav_wrap ul li a:hover {
  background: white;
}
#primary_nav_wrap ul ul li a:hover {
  background: #F4F4F4;
}
#primary_nav_wrap ul ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  padding: 0;
  margin-top: 0.2px;
  border: 1px solid #ccc;
  border-top: none;
  z-index: 50;
}
#primary_nav_wrap ul ul li {
  float: none;
  width: 200px;
  position: relative;
  left: 0px;
}
#primary_nav_wrap ul ul a {
  line-height: 120%;
  padding: 7.5px 9px;
}
#primary_nav_wrap ul ul ul {
  top: 0;
  left: 100%
}
#primary_nav_wrap ul li:hover > ul {
  display: block
}
/* end of info nav */

/* courses.php */

/* course intro */

#course_body {
  background: #F4F4F4;
}

#course_intro {
  border: 1px solid #DDDDDD;
  background: white;
  width: 568px;
  font-family: 'Open Sans', sans-serif;
  font-size: 25px;
  padding: 20px 20px 10px 20px;
  position: relative;
  top: 40px;
  left: 50px;
}

#intro_title {
  width: 562px;
  position: relative;
  top: 2px;
}

#intro_video {
  width: 375px;
  height: 210px;
  position: relative;
  top: -7px;
}

/* end of course intro */

/* course facts */

/* Price Information */

#price_tag {
  font-size: 32px;
  font-weight: bold;
  color: #373737;
  position: relative;
  top: -15px;
}

#price_div {
  background: #17AA1C;
  color: white;
  text-align: center;
  padding: 11px 12px 11px 12px;
  font-size: 18px;
  width: 116px;
  font-weight: normal;
  position: relative;
  top: 12px;
  border-radius: 3px;
}

#price_div:hover {
  background: #159D1A;
}

#price_div {
  text-decoration: none;
}

/* End of Price Information */

#course_facts {
  border: 1px solid #DDDDDD;
  background: white;
  width: 568px;
  font-family: 'Open Sans', sans-serif;
  font-size: 25px;
  padding: 20px 20px 10px 20px;
  position: relative;
  top: -311px;
  left: 675px;
  font-size: 20px;
  height: 115px;
}

  .Rating {
  position: relative;
  width: 125px;
  height: 25px;
  top: -111px;
  left: 180px;
}
.Rating svg {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  top: 0;
}
.Rating meter {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #B6C2CC;
}
.Rating meter::-moz-meter-bar {
  background: #FF7867;
}
.Rating meter::-webkit-meter-optimum-value, .Rating meter::-webkit-meter-suboptimum-value, .Rating meter::-webkit-meter-even-less-good-value {
  background: #FF7867;
}

#facts_ratings {
  position: relative;
  top: -110px;
  text-transform: uppercase;
  font-size: 14px;
  word-spacing: 0;
  font-weight: 600;
  letter-spacing: 2px;
  left: 175px;
}

#course_length {
  position: relative;
  top: -100px;
  left: 185px;
  text-transform: uppercase;
  font-size: 14px;
  word-spacing: 0;
  font-weight: 600;
  letter-spacing: 2px;
}

#course_time {
  letter-spacing: 0;
  font-weight: bold;
  font-size: 18px;
  color: #2E3D49;
}

/* end of course facts */

/* skill level */

#course_skillText {
  position: relative;
  top: -190px;
  left: 310px;
  text-transform: uppercase;
  font-size: 14px;
  word-spacing: 0;
  font-weight: 600;
  letter-spacing: 2px;
}

.fillSquare, .emptySquare {
  display: inline-block;
  position: relative;
  left: 80px;
}

.fillSquare {
  width: 12px;
  height: 12px;
  background: #666;
}

.emptySquare {
  width: 12px;
  height: 12px;
  background: #B8B8B8;
}

#skill_level {
  position: relative;
  left: 85px;
  top: -2px;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: normal;
  color: #2E3D49;
}

/* end of skill level */

/* language */

#course_language {
  position: relative;
  top: -154px;
  left: 235px;
  text-transform: uppercase;
  font-size: 14px;
  word-spacing: 0;
  font-weight: 600;
  letter-spacing: 2px;
}

#language_type {
  letter-spacing: 0;
  font-weight: bold;
  font-size: 18px;
  color: #2E3D49;
  position: relative;
  left: 153px;
}

/* end of language */

/* Wish List button */

#course_wish {
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 15px;
  position: absolute;
  width: 87px;
  padding: 5px;
  position: relative;
  top: -65px;
  cursor: pointer;
  box-shadow: rgba(0,0,0,0.0980392) 0 2px 3px 0;
  border-radius: 3px;
}

#empty_heart {
  color: #FF827F;
}

#course_wish_text {
  position: relative;
  left: 5px;
}

/* End of Wish List button */

/* Teacher div */

#teacher_div {
  width: 326px;
  border: 1px solid #ddd;
  background: white;
  position: relative;
  left: 1002px;
  padding: 15px;
  top: -280px;
  text-align:center;
}

#teacher_picture {
  width: 85px;
  height: 85px;
  border-radius: 50%;
}

#teacher_name {
  font-family: 'Open Sans', sans-serif;
  font-size: 18px;
  text-align: center;
}

#teacher_div a {
  text-decoration: none;
  color: #00698C;
}

#teacher_div a:hover {
  text-decoration: underline;
}

#teacher_tagLine {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  color: #999;
  text-align: center;
  width: 325px;
}

#course_line {
  width: 325px;
  height: 1px;
  background: #DDD;
}

#teacher_info {
  width: 325px;
  font-family: 'Open Sans', sans-serif;
  font-size: 15px;
  text-align:left;
}

/* End of Teacher div */

/* Course Learn */

#course_learn {
  background: white;
  border: 1px solid #DDD;
  width: 280px;
  position: relative;
  top: -660px;
  left: 674px;
  font-family: 'Open Sans', sans-serif;
  padding: 15px;
  max-height: 240px;
  font-size: 18px;
  overflow: hidden;
  background-image: rgba(244,244,244,0);
}

#course_learn li {
  font-size: 15px;
  color: #353535;
  padding: 5px;
  text-align: left;
}

/* End of Course Learn */

/* end of courses.php */
<?php

require "connect.php";

?>

<!DOCTYPE html>

    <title> Hacked Genius </title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
    <link rel='stylesheet' href='main.css'>

Development

Web Development

Mobile Apps

Programming Languages

Game Development

Databases

Software Testing

Software Engineering

Development Tools

E-Commerce

Business

Finance

Entrepreneurship

Communications

Management

Sales

Strategy

Operations

Project Management

Business Law

Data and Anylytics

Home Business

Human Resources

Industry

Media

Real Estate

Other

IT & Software

IT Certification

Network & Security

Hardware

Operating Systems

Other

Office Productivity

Microsoft

Apple

Google

SAP

Intuit

Salesforce

Oracle

Other

Personal Development

Personal Transformation

Productivity

Leadership

Personal Finance

Career Development

Parenting & Relationships

Happiness

Religion & Spirituality

Personal Brand Building

Creativity

Influence

Self Esteem

Stress Management

Memory and Study Skills

Motivation

Other

Design

Web Design

Graphic Design

Design Tools

User Experience

Game Design

Design Thinking

3D & Animation

Fashion

Architectural Design

Interior Design

Other

Marketing

Digital Marketing

Search Engine Optimization

Social Media Marketing

Branding

Marketing Fundamentals

Analystics & Automation

Public Relations

Advertising

Video & Mobile Marketing

Content Marketing

Non-Digital Marketing

Growth Hacking

Affiliate Marketing

Product Marketing

Other

Lifestyle

Life Hacks

Arts & Crafts

Food & Beverage

Beauty & Makeup

Travel

Gaming

Home Improvement

Pet Care & Training

Photography

Digital Photography

Photography Fundamentals

Portraits

Landscape

Black & White

Photography Tools

Mobile Photography

Travel Photography

Commercial Photography

Wedding Photography

Video Design

Other

Health & Fitness

Fitness

General Health

Sports

Nutrition

Yoga

Mental Health

Dieting

Self Defense

Safety & First Aid

Dance

Meditation

Other

Language

English

Spanish

German

French

Japanese

Portuguese

Chinese

Russian

Latin

Arabic

Hebrew

Italian

Other

Music

Instruments

Production

Music Fundamentals

Vocal

Music Techniques

Music Software

Other

Academics

Social Science

Math & Science

Humanities

          Lifestyle Business: eBay Drop Shipping Guide Work from Home

        <video src='one.mp4' poster='https://udemy-images.udemy.com/course/480x270/498972_df27_2.jpg' id='intro_video'controls></video>

         $30

 Take Class

          400 Ratings

          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 100">
            <defs>
              <path id="a" d="M0 0h500v100H0V0zm50 79L20.6 94.5l5.6-32.8L2.4 38.5l33-4.7L50 4l14.7 29.8 33 4.7-24 23.2 5.7 32.8L50 79zm100 0l-29.4 15.5 5.6-32.8-23.8-23.2 33-4.7L150 4l14.7 29.8 33 4.7-24 23.2 5.7 32.8L150 79zm100 0l-29.4 15.5 5.6-32.8-23.8-23.2 33-4.7L250 4l14.7 29.8 33 4.7-24 23.2 5.7 32.8L250 79zm100 0l-29.4 15.5 5.6-32.8-23.8-23.2 33-4.7L350 4l14.7 29.8 33 4.7-24 23.2 5.7 32.8L350 79zm100 0l-29.4 15.5 5.6-32.8-23.8-23.2 33-4.7L450 4l14.7 29.8 33 4.7-24 23.2 5.7 32.8L450 79z"/>
            </defs>
            <use fill="white" fill-rule="evenodd" xlink:href="#a"/>
          </svg>

          <meter min="0" max="5" value="4.28"></meter>

          Length
  6 Weeks

          Skill Level

          Intermediate

           Language
  English

   Wish List

 Matthew Malan

 Game Maker, Game Designer, Game Maker User and Teacher

 Hello! My name is Andy and I am a professional voice actor. Top-Rated & Featured Seller on Fiverr. Over 5K+ people served worldwide! Proud to be the voice for the Fiverr App! Providing voice services for Commercials, Narrations, E-Learning, Explainer Videos, Apps and more! See my reviews...

                     What you'll learn

 Build a polished and fun platform game using GameMaker Studio.

 Import image, sound, and background assets into GameMaker Studio.

 Program using GameMaker Studio's built in scripting language GML (GameMaker Language).

 Create game objects and control them using Events and Actions.

 Design game levels using Rooms.

To replicate this error, look for a line across from the button that is still a link beyond the button. Try going in the middle of Skill Level and Language...
How do I fix this problem?

A:
 Take Class

Maybe you want to change this to

Take Class

A: Your div element is block level so it will automatically take the full width of the parent element (at least). You set its width but that is the width of the content. The node itself still occupies the full width.
To do what you want, set #price_div to display:inline-block; or do float:left; so it will collapse to the width you want.
By setting inline-block, you are making the div behave like a text box, able to contain its text contents but still behave like a block level element so you can set its width and height.

A: Just add this to your css
#price_tag a { display: inline-block; }
span#price_tag:after {
    display: block;
    content: "";
}

Your a is inline element, you need to set it to inline-block or block element to be able to set it's width. Then using after you will shift rest of the content lower


text:
Q: terminal command to scan for nearby mac addresses Is there a terminal command line [on OS X] for scanning nearby mac addresses? Not the airport that lists the SSIDs of nearby routers, but something to list the devices [like phones].
I want to use it to run a cron and run a script every time a specific device comes into range.
Thanks!

A: There is a product I use on my iPhone, and there is apparently also an OSX version. It's called "fing" and it scans your network and tells you the MAC addresses of attached devices - it can also send Wake-on-LAN packets - which is what I use it for.
See Fing here.
Note: I wouldn't normally recommend 3rd party paid apps (see my other answer in which I suggested "arp"), and I have no connection with these guys and derive nothing from mentioning them - I just feel their product may help you out.

A: Have a try with the following:
arp -a

Sample output:
router.asus.com (192.168.0.1) at 8:60:6e:ba:17:c8 on en0 ifscope [ethernet]
vmubuntu (192.168.0.9) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.225) at 0:a0:96:c7:8a:c1 on en0 ifscope [ethernet]
? (192.168.0.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]

A: Speaking only about Wi-Fi protocol (802.11n) there is no way for a STA to find the others STAs. A STA can only scan for APs.
But there is a new Wi-Fi protocol called Wi-Fi Direct in which you can search for PEERs. In this case, the other devices needs to have Wi-Fi Direct enabled ...
If you want to use only the "default" Wi-Fi, you can sniff all channels and check for probe request frames. But it's not straightforward.
Note: I assume that we are only in "infrastructure mode" cause the "ad-hoc mode" is not very used


text:
Q: How to test custom django-admin commands I created custom django-admin commands
But, I don't know how to test it in standard django tests

A: To add to what has already been posted here. If your django-admin command passes a file as parameter, you could do something like this:
from django.test import TestCase
from django.core.management import call_command
from io import StringIO
import os

class CommandTestCase(TestCase):
    def test_command_import(self):
        out = StringIO()
        call_command(
            'my_command', os.path.join('path/to/file', 'my_file.txt'),
            stdout=out
        )
        self.assertIn(
        'Expected Value',
            out.getvalue()
        )

This works when your django-command is used in a manner like this:
$ python manage.py my_command my_file.txt

A: You should make your actual command script the minimum possible, so that it just calls a function elsewhere. The function can then be tested via unit tests or doctests as normal.

A: you can see in github.com example
see here
def test_command_style(self):
    out = StringIO()
    management.call_command('dance', style='Jive', stdout=out)
    self.assertEquals(out.getvalue(),
        "I don't feel like dancing Jive.")

A: If you're using some coverage tool it would be good to call it from the code with:
from django.core.management import call_command
from django.test import TestCase

class CommandsTestCase(TestCase):
    def test_mycommand(self):
        " Test my custom command."

        args = []
        opts = {}
        call_command('mycommand', *args, **opts)

        # Some Asserts.

From the official documentation

Management commands can be tested with the call_command() function. The output can be redirected into a StringIO instance

A: I agree with Daniel that the actual command script should do the minimum possible but you can also test it directly in a Django unit test using os.popen4.
From within your unit test you can have a command like
fin, fout = os.popen4('python manage.py yourcommand')
result = fout.read()

You can then analyze the contents of result to test whether your Django command was successful.

A: A simple alternative to parsing stdout is to make your management command exit with an error code if it doesn't run successfully, for example using sys.exit(1).
You can catch this in a test with:
    with self.assertRaises(SystemExit):
        call_command('mycommand')


text:
Q: ASP.Net Website - publishing doesn't move all files When publishing my ASP.Net Website (not a Web Application), the publisher does not include the Web.ConnectionStrings.config file that is next to the web.config.  This is required since my web config looks like this:
<connectionStrings configSource="Web.ConnectionStrings.config"/>

How can I get a File System Publish to include files that Visual Studio seems to be ignoring.  Please note that this is a website created using [File] > [New Website] in Visual Studio, not a [File] > [New Project] ASP.Net site so Content=Include will not work.
Steps to reproduce:

*

*In Visual Studio: File > New > Website..

*Create the Web.ConnectionStrings.config xml document (see ConnectionStrings.config code below).

*In the web config link up the Web.ConnectionStrings.config file to the Web.Config file (see Web.config code below)

*Publish the website to a folder on your file system, the Web.ConnectionStrings.config doesn't move with the rest of the files.

Web.config:
<configuration>
  <connectionStrings configSource="Web.ConnectionStrings.config"/>
  ..

Web.ConnectionStrings.config:
<?xml version="1.0" encoding="utf-8" ?>
<connectionStrings>
  <add name="connString" connectionString="yourConnectionstringhere"/>
</connectionStrings>

A: The way you publish the website is OK.
But the name of the file into which the connectionstrings get stored must not start with the prefix web., just call it connectionstrings.config instead.
In web.config you put:
<configuration>
  <connectionStrings configSource="connectionStrings.config"/>

In the renamed file connectionstrings.config you place:
<?xml version="1.0" encoding="utf-8" ?>
<connectionStrings>
  <add name="connString" connectionString="yourConnectionstringhere"/>
</connectionStrings>

A: I think this article will help
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-extra-files
Basically you edit the picture .pubxml file to tell it to include additional files during deployment


text:
Q: inverse laplace transformation of $\arctan(\frac{4}{s})$ inverse laplace transformation of $\arctan(\frac{4}{s})$ using

I was trying use 12 but i couldn't arrive to a solution

A: Here's a solution that avoids convergence problems of the series representation.  Note that
$$F(s) = \arctan{\left ( \frac{4}{s} \right )} \implies F'(s) = -\frac{4}{s^2+16} $$
Then, by 12 and 5,
$$t f(t) = \sin{4 t}$$

A: Since:
$$\arctan\frac{4}{s}=\sum_{k=0}^{+\infty}\frac{(-1)^k}{2k+1}\left(\frac{4}{s}\right)^{2k+1} $$
and $\mathcal{L}^{-1}\left(\frac{1}{s^{2k+1}}\right)=\frac{t^{2k}}{(2k)!}$ by $(2)$, we have:
$$ \mathcal{L}^{-1}\left(\arctan\frac{4}{s}\right) = \sum_{k=0}^{+\infty}\frac{(-1)^k 4^{4k+1}}{(2k+1)!}\,t^{2k}=\color{red}{\frac{\sin(4t)}{t}}.$$

A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,{\rm Li}_{#1}}
 \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
\begin{align}&\color{#66f}{\large%
\int_{\gamma - \infty\ic}^{\gamma - \infty\ic}
\arctan\pars{4 \over s}\expo{st}\,{\dd s \over 2\pi\ic}}
=\int_{\gamma - \infty\ic}^{\gamma - \infty\ic}\expo{st}\int_{0}^{1}{4s\,\dd x \over 16x^{2} + s^{2}}\,{\dd s \over 2\pi\ic}
\\[5mm]&=4\int_{0}^{1}\int_{\gamma - \infty\ic}^{\gamma - \infty\ic}
\expo{st}{s\over s^{2} + 16x^{2}}\,{\dd s \over 2\pi\ic}\,\dd x
=4\int_{0}^{1}\bracks{\expo{-4\ic xt}\,{-4\ic xt \over -8\ic xt}
+\expo{4\ic xt}\,{4\ic xt \over 8\ic xt}}\,\dd x
\\[5mm]&=4\int_{0}^{1}\cos\pars{4xt}\,\dd x
=\color{#66f}{\large{\sin\pars{4t} \over t}}
\end{align}


text:
Q: LWJGL Display opens on the bottom of my screen I am creating a game with LWJGL with java 7 64bits and I have a problem,
when I put in my code :
Display.setResizable(true);

The Display pop on the bottom of my screen like this :

If you can help me to fix this display answer this post :)
This is the code of my main class :
https://www.dropbox.com/s/fi3fjszc4ozcipi/code.txt?dl=0

A: try adding
Display.setLocation(x,y);


text:
Q: AlertView to Pause Code This seems to be a white elephant for the iPhone. I've tried all sorts, even loops and I can't make it work.
I have a view that loads a table. However I've moved into object archiving and for development purposes I want to have an initial AlertView that asks if a user wants to use a saved database or download a fresh copy
(void)showDBAlert {

    UIActionSheet *alertDialogOpen;
    alertDialogOpen = [[UIActionSheet alloc] initWithTitle:@"DownloadDB?"
                    delegate:self
                    cancelButtonTitle:@"Use Saved"
                    destructiveButtonTitle:@"Download DB"
                                         otherButtonTitles:nil];
    [alertDialogOpen showInView:self.view];
}

I'm using an ActionSheet in this instance. And I have implemented the protocol:
@interface ClubTableViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource, UIActionSheetDelegate>

Based on this I run this to check what button was pressed:
(void)actionSheet:(UIActionSheet *) actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    NSString *buttonTitle=[actionSheet buttonTitleAtIndex:buttonIndex];

    if ( [buttonTitle isEqualToString:@"Download DB"] ) {

        [self loadDataFromDB];

    }

    if ([buttonTitle isEqualToString:@"Use Saved"] ) {

        self.rows = [NSKeyedUnarchiver unarchiveObjectWithFile:[self archivePath]];

        if (self.rows == nil) {
            [self loadDataFromDB];
        }

    }
}

The problem is my code to build the table executes before the user has made there choice. This causes all sorts of havok. As a result, how can I pause the code until a user has made there choice?

A: If you are using UITableView, you will not be able to "pause" the code, however this wouldn't be the method of choice anyways. A possible solution would be to load an empty table (return 0 in (UITableView *)tableView:numberOfRowsInSection) until the user has selected something, then reload the tableView's data with [tableView reloadData];

A: In your tableView:numberOfRowsInSection: just return zero until the user has made a decision.

A: Add [self.tableView reloadData]; at the end of the actionSheet delegate method. This will trigger all UITableViewDataSource methods again.