EzDevInfo.com

refresher

Pull to refresh in Swift

Need a C++ refresher [closed]

For the past decade, I've needed C++ on and off. And every time I need it, I realize I've forgotten a lot of it, and then re-learn it again (I've repeated this process quite a bit). Well now I am in need of it again, however, all my Googling reveals just beginner resources, and I sort of want to skip that stuff. I need a refresher on all the things like usage for:

const
register
inline

and the nuances surrounding pass-by-reference, value, etc.

Anyone have a good source?

I would prefer an online source over a book.


Source: (StackOverflow)

Page refresh after done loading, add up variable

$test = $_GET['nr'];
    $class = new class;
    echo $class->function($test);

I want $test to increase after it have fully loaded the page.

The problem is, I don't know how. Looping $test normally will show me a lot of errors. like function cannot be declared again I've have the same functions names with different functionality. And it's pretty long code.

Anyone have any idea how I can do this? Thanks.

EDIT:

When the page is fully loaded, I want it to add + 1 to $test and then refresh it with the new variable.

I can do this manually by:

$next = $test + 1;
    echo "<a rel='nofollow' href='/index.php?nr=". $next . "'>Next page</a>";

Source: (StackOverflow)

Advertisements

Is this a correct class implementation and initialization? [closed]

I've found my coding practices to be slipping lately - and noticed myself falling into some bad habits - usually due to lack of motivation on my part (probably caused but the inane nature of the tasks set for me) - So to give myself a kick up the behind I decided to write myself which should be a very simple, basic class. Here it is:

public class Customer
{       
    public string CUSTOMERNAME;
    public List<Site> sites = new List<Site>();

    public Customer()
    {

    }

    public void AddSite(Site location)
    {
        sites.Add(location);
    }

}

public class Site
{
        public string SITENAME;
        public Address SITEADDRESSDETAILS;
        public string SITEPHONENUMBER;

        public Site(string sitename, Address siteaddress, string tel)
        {
            SITENAME = sitename;
            SITEADDRESSDETAILS = siteaddress;
            SITEPHONENUMBER = tel;
        }

}

public class Address 
{
    public List<string> address = new List<string>();

    public Address() {

    }

    public void AddAddressDetail(string line)
    {
        address.Add(line);
    }

}

Now everything seems to work but I just can't help feeling that things could be done better. I've tested it with the following code:

static void Main(string[] args)
{
    Customer customer = new Customer();
    customer.CUSTOMERNAME = "Max Hammer Ltd";

    Address addy = new Address();
    addy.AddAddressDetail("1 Edgerail Close");
    addy.AddAddressDetail("Greenbushes");
    addy.AddAddressDetail("Bluehill");
    addy.AddAddressDetail("Surrey");
    addy.AddAddressDetail("RH0 6LD");

    Site surreyOffice = new Site("Surrey Office", addy, "01737 000000");

    addy = new Address();
    addy.AddAddressDetail("6 Electric Avenue");
    addy.AddAddressDetail("Brixton");
    addy.AddAddressDetail("London");
    addy.AddAddressDetail("SW4 1BX");

    Site brixtonOffice = new Site("Brixton Office", addy, "020 7101 3333");

    customer.AddSite(surreyOffice);
    customer.AddSite(brixtonOffice);

    Console.WriteLine(customer.CUSTOMERNAME);
    int numberOfSutes = customer.sites.Count;
    for (int i = 0; i < numberOfSutes; i++)
    {
        Console.WriteLine(customer.sites[i].SITENAME);
        foreach (string line in customer.sites[i].SITEADDRESSDETAILS.address)
        {
            Console.WriteLine(line);
        }
        Console.WriteLine(customer.sites[i].SITEPHONENUMBER);
    }
    Console.ReadKey();

}

I'm not happy with my Main class and I'm not sure why - even though it does what I want. Any tips, pointers?


Source: (StackOverflow)

Vaadin refresher extension doesn't work

I am trying to make a simple usage of refresher plug-in as below but it doesn't seem to work. I am tried to run this example in Chrome and in firefox. I am exporting the project as WAR and deploying it in tomcat webapps folder.

package com.example.vaadinapp;

import javax.servlet.annotation.WebServlet;

import com.github.wolfie.refresher.Refresher;
import com.github.wolfie.refresher.Refresher.RefreshListener;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
@Theme("vaadinapp")
public class VaadinappUI extends UI {

    Refresher refresher;
    Label timeLabel;
    Page page;

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = VaadinappUI.class)
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        refresher = new Refresher();
        page = this.getPage();
        timeLabel = new Label(String.valueOf(page.getWebBrowser().getCurrentDate()));

        refresher.setRefreshInterval(1000);
        refresher.addListener(new RefreshListener() {
            @Override
            public void refresh(Refresher source) {
                timeLabel.setCaption(String.valueOf(page.getWebBrowser()
                        .getCurrentDate()));
            }
        });
        addExtension(refresher);

        layout.addComponent(timeLabel);

    }

}

What am I doing wrong here? I also tried the same example with SimpleDateFormat instead of using WebBrowser getCurrentDate() but still the same issue


Source: (StackOverflow)