text:
Q: How to use BeanUtils.copyProperties? I am trying to copy properties from one bean to another. Here are the signature of two beans:
SearchContent:
public class SearchContent implements Serializable {

    private static final long serialVersionUID = -4500094586165758427L;

    private Integer id;
    private String docName;
    private String docType;
    private String docTitle;
    private String docAuthor;
    private String securityGroup;
    private String docAccount;
    private Integer revLabel;

    private String profile;
    private LabelValueBean<String> workflowStage;

    private Date createDate;
    private Date inDate;

    private String originalName;
    private String format;
    private String extension;
    private Long fileSize;

    private String author;

    private LabelValueBean<String> entity;
    private LabelValueBean<String> brand;
    private LabelValueBean<String> product;
    private LabelValueBean<String> collection;
    private LabelValueBean<String> subCollection;

    private String description;
    private LabelValueBean<String> program;
    private String vintage;
    private String model;
    private String restrictedZone;
    private LabelValueBean<String> event;
    private LabelValueBean<String> language;
    private String geographicLocation;
    private String watermark;
    private Integer pageNumber;
    private String summary;
    private String agentName;
    private String commissionedByName;
    private String commissionedByDepartment;
    private LabelValueBean<Integer> bestOf;
    private String mediaLocation;

    private LabelValueBean<Integer> fullRights;
    private LabelValueBean<String> mediaUsage;
    private Date rightsEndDate;
    private String geographicRights;
    private LabelValueBean<Integer> evinConformity;
    private String contactReference;
    private LabelValueBean<String> publicationScope;
    private String rightsComment;

    /**
     * Constructor SearchContent
     * @author TapasB
     * @since 15-Oct-2013 - 5:45:55 pm
     * @version DAM 1.0
     */
    public SearchContent() {

    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDocName() {
        return docName;
    }

    public void setDocName(String docName) {
        this.docName = docName;
    }

    public String getDocType() {
        return docType;
    }

    public void setDocType(String docType) {
        this.docType = docType;
    }

    public String getDocTitle() {
        return docTitle;
    }

    public void setDocTitle(String docTitle) {
        this.docTitle = docTitle;
    }

    public String getDocAuthor() {
        return docAuthor;
    }

    public void setDocAuthor(String docAuthor) {
        this.docAuthor = docAuthor;
    }

    public String getSecurityGroup() {
        return securityGroup;
    }

    public void setSecurityGroup(String securityGroup) {
        this.securityGroup = securityGroup;
    }

    public String getDocAccount() {
        return docAccount;
    }

    public void setDocAccount(String docAccount) {
        this.docAccount = docAccount;
    }

    public Integer getRevLabel() {
        return revLabel;
    }

    public void setRevLabel(Integer revLabel) {
        this.revLabel = revLabel;
    }

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    public LabelValueBean<String> getWorkflowStage() {
        return workflowStage;
    }

    public void setWorkflowStage(LabelValueBean<String> workflowStage) {
        this.workflowStage = workflowStage;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getInDate() {
        return inDate;
    }

    public void setInDate(Date inDate) {
        this.inDate = inDate;
    }

    public String getOriginalName() {
        return originalName;
    }

    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public LabelValueBean<String> getEntity() {
        return entity;
    }

    public void setEntity(LabelValueBean<String> entity) {
        this.entity = entity;
    }

    public LabelValueBean<String> getBrand() {
        return brand;
    }

    public void setBrand(LabelValueBean<String> brand) {
        this.brand = brand;
    }

    public LabelValueBean<String> getProduct() {
        return product;
    }

    public void setProduct(LabelValueBean<String> product) {
        this.product = product;
    }

    public LabelValueBean<String> getCollection() {
        return collection;
    }

    public void setCollection(LabelValueBean<String> collection) {
        this.collection = collection;
    }

    public LabelValueBean<String> getSubCollection() {
        return subCollection;
    }

    public void setSubCollection(LabelValueBean<String> subCollection) {
        this.subCollection = subCollection;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public LabelValueBean<String> getProgram() {
        return program;
    }

    public void setProgram(LabelValueBean<String> program) {
        this.program = program;
    }

    public String getVintage() {
        return vintage;
    }

    public void setVintage(String vintage) {
        this.vintage = vintage;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getRestrictedZone() {
        return restrictedZone;
    }

    public void setRestrictedZone(String restrictedZone) {
        this.restrictedZone = restrictedZone;
    }

    public LabelValueBean<String> getEvent() {
        return event;
    }

    public void setEvent(LabelValueBean<String> event) {
        this.event = event;
    }

    public LabelValueBean<String> getLanguage() {
        return language;
    }

    public void setLanguage(LabelValueBean<String> language) {
        this.language = language;
    }

    public String getGeographicLocation() {
        return geographicLocation;
    }

    public void setGeographicLocation(String geographicLocation) {
        this.geographicLocation = geographicLocation;
    }

    public String getWatermark() {
        return watermark;
    }

    public void setWatermark(String watermark) {
        this.watermark = watermark;
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getAgentName() {
        return agentName;
    }

    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }

    public String getCommissionedByName() {
        return commissionedByName;
    }

    public void setCommissionedByName(String commissionedByName) {
        this.commissionedByName = commissionedByName;
    }

    public String getCommissionedByDepartment() {
        return commissionedByDepartment;
    }

    public void setCommissionedByDepartment(String commissionedByDepartment) {
        this.commissionedByDepartment = commissionedByDepartment;
    }

    public LabelValueBean<Integer> getBestOf() {
        return bestOf;
    }

    public void setBestOf(LabelValueBean<Integer> bestOf) {
        this.bestOf = bestOf;
    }

    public String getMediaLocation() {
        return mediaLocation;
    }

    public void setMediaLocation(String mediaLocation) {
        this.mediaLocation = mediaLocation;
    }

    public LabelValueBean<Integer> getFullRights() {
        return fullRights;
    }

    public void setFullRights(LabelValueBean<Integer> fullRights) {
        this.fullRights = fullRights;
    }

    public LabelValueBean<String> getMediaUsage() {
        return mediaUsage;
    }

    public void setMediaUsage(LabelValueBean<String> mediaUsage) {
        this.mediaUsage = mediaUsage;
    }

    public Date getRightsEndDate() {
        return rightsEndDate;
    }

    public void setRightsEndDate(Date rightsEndDate) {
        this.rightsEndDate = rightsEndDate;
    }

    public String getGeographicRights() {
        return geographicRights;
    }

    public void setGeographicRights(String geographicRights) {
        this.geographicRights = geographicRights;
    }

    public LabelValueBean<Integer> getEvinConformity() {
        return evinConformity;
    }

    public void setEvinConformity(LabelValueBean<Integer> evinConformity) {
        this.evinConformity = evinConformity;
    }

    public String getContactReference() {
        return contactReference;
    }

    public void setContactReference(String contactReference) {
        this.contactReference = contactReference;
    }

    public LabelValueBean<String> getPublicationScope() {
        return publicationScope;
    }

    public void setPublicationScope(LabelValueBean<String> publicationScope) {
        this.publicationScope = publicationScope;
    }

    public String getRightsComment() {
        return rightsComment;
    }

    public void setRightsComment(String rightsComment) {
        this.rightsComment = rightsComment;
    }
}

And Content:
public class Content implements Serializable {

    private static final long serialVersionUID = 2999449587418137835L;

    private Boolean selected;
    private Boolean renditionInfoFetched;

    private String searchPageImageRendition;
    private String detailPageImageRendition;

    private String videoRendition;

    private Integer id;
    private String docName;
    private String docType;
    private String docTitle;
    private String docAuthor;
    private String securityGroup;
    private String docAccount;
    private Integer revLabel;
    private String profile;

    private Date createDate;
    private Date inDate;

    private String originalName;
    private String format;
    private String extension;
    private Long fileSize;

    private String author;

    private LabelValueBean<String> entity;
    private LabelValueBean<String> brand;
    private LabelValueBean<String> product;
    private LabelValueBean<String> collection;
    private LabelValueBean<String> subCollection;

    private String description;
    private LabelValueBean<String> program;
    private String vintage;
    private String model;
    private String restrictedZone;
    private LabelValueBean<String> event;
    private LabelValueBean<String> language;
    private String geographicLocation;
    private String watermark;
    private Integer pageNumber;
    private String summary;
    private String agentName;
    private String commissionedByName;
    private String commissionedByDepartment;
    private LabelValueBean<Integer> bestOf;
    private String mediaLocation;

    private LabelValueBean<Integer> fullRights;
    private LabelValueBean<String> mediaUsage;
    private Date rightsEndDate;
    private String geographicRights;
    private LabelValueBean<Integer> evinConformity;
    private String contactReference;
    private LabelValueBean<String> publicationScope;
    private String rightsComment;

    public Boolean getSelected() {
        return selected;
    }

    public void setSelected(Boolean selected) {
        this.selected = selected;
    }

    public Boolean getRenditionInfoFetched() {
        return renditionInfoFetched;
    }

    public void setRenditionInfoFetched(Boolean renditionInfoFetched) {
        this.renditionInfoFetched = renditionInfoFetched;
    }

    public String getSearchPageImageRendition() {
        return searchPageImageRendition;
    }

    public void setSearchPageImageRendition(String searchPageImageRendition) {
        this.searchPageImageRendition = searchPageImageRendition;
    }

    public String getDetailPageImageRendition() {
        return detailPageImageRendition;
    }

    public void setDetailPageImageRendition(String detailPageImageRendition) {
        this.detailPageImageRendition = detailPageImageRendition;
    }

    public String getVideoRendition() {
        return videoRendition;
    }

    public void setVideoRendition(String videoRendition) {
        this.videoRendition = videoRendition;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDocName() {
        return docName;
    }

    public void setDocName(String docName) {
        this.docName = docName;
    }

    public String getDocType() {
        return docType;
    }

    public void setDocType(String docType) {
        this.docType = docType;
    }

    public String getDocTitle() {
        return docTitle;
    }

    public void setDocTitle(String docTitle) {
        this.docTitle = docTitle;
    }

    public String getDocAuthor() {
        return docAuthor;
    }

    public void setDocAuthor(String docAuthor) {
        this.docAuthor = docAuthor;
    }

    public String getSecurityGroup() {
        return securityGroup;
    }

    public void setSecurityGroup(String securityGroup) {
        this.securityGroup = securityGroup;
    }

    public String getDocAccount() {
        return docAccount;
    }

    public void setDocAccount(String docAccount) {
        this.docAccount = docAccount;
    }

    public Integer getRevLabel() {
        return revLabel;
    }

    public void setRevLabel(Integer revLabel) {
        this.revLabel = revLabel;
    }

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getInDate() {
        return inDate;
    }

    public void setInDate(Date inDate) {
        this.inDate = inDate;
    }

    public String getOriginalName() {
        return originalName;
    }

    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public LabelValueBean<String> getEntity() {
        return entity;
    }

    public void setEntity(LabelValueBean<String> entity) {
        this.entity = entity;
    }

    public LabelValueBean<String> getBrand() {
        return brand;
    }

    public void setBrand(LabelValueBean<String> brand) {
        this.brand = brand;
    }

    public LabelValueBean<String> getProduct() {
        return product;
    }

    public void setProduct(LabelValueBean<String> product) {
        this.product = product;
    }

    public LabelValueBean<String> getCollection() {
        return collection;
    }

    public void setCollection(LabelValueBean<String> collection) {
        this.collection = collection;
    }

    public LabelValueBean<String> getSubCollection() {
        return subCollection;
    }

    public void setSubCollection(LabelValueBean<String> subCollection) {
        this.subCollection = subCollection;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public LabelValueBean<String> getProgram() {
        return program;
    }

    public void setProgram(LabelValueBean<String> program) {
        this.program = program;
    }

    public String getVintage() {
        return vintage;
    }

    public void setVintage(String vintage) {
        this.vintage = vintage;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getRestrictedZone() {
        return restrictedZone;
    }

    public void setRestrictedZone(String restrictedZone) {
        this.restrictedZone = restrictedZone;
    }

    public LabelValueBean<String> getEvent() {
        return event;
    }

    public void setEvent(LabelValueBean<String> event) {
        this.event = event;
    }

    public LabelValueBean<String> getLanguage() {
        return language;
    }

    public void setLanguage(LabelValueBean<String> language) {
        this.language = language;
    }

    public String getGeographicLocation() {
        return geographicLocation;
    }

    public void setGeographicLocation(String geographicLocation) {
        this.geographicLocation = geographicLocation;
    }

    public String getWatermark() {
        return watermark;
    }

    public void setWatermark(String watermark) {
        this.watermark = watermark;
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getAgentName() {
        return agentName;
    }

    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }

    public String getCommissionedByName() {
        return commissionedByName;
    }

    public void setCommissionedByName(String commissionedByName) {
        this.commissionedByName = commissionedByName;
    }

    public String getCommissionedByDepartment() {
        return commissionedByDepartment;
    }

    public void setCommissionedByDepartment(String commissionedByDepartment) {
        this.commissionedByDepartment = commissionedByDepartment;
    }

    public LabelValueBean<Integer> getBestOf() {
        return bestOf;
    }

    public void setBestOf(LabelValueBean<Integer> bestOf) {
        this.bestOf = bestOf;
    }

    public String getMediaLocation() {
        return mediaLocation;
    }

    public void setMediaLocation(String mediaLocation) {
        this.mediaLocation = mediaLocation;
    }

    public LabelValueBean<Integer> getFullRights() {
        return fullRights;
    }

    public void setFullRights(LabelValueBean<Integer> fullRights) {
        this.fullRights = fullRights;
    }

    public LabelValueBean<String> getMediaUsage() {
        return mediaUsage;
    }

    public void setMediaUsage(LabelValueBean<String> mediaUsage) {
        this.mediaUsage = mediaUsage;
    }

    public Date getRightsEndDate() {
        return rightsEndDate;
    }

    public void setRightsEndDate(Date rightsEndDate) {
        this.rightsEndDate = rightsEndDate;
    }

    public String getGeographicRights() {
        return geographicRights;
    }

    public void setGeographicRights(String geographicRights) {
        this.geographicRights = geographicRights;
    }

    public LabelValueBean<Integer> getEvinConformity() {
        return evinConformity;
    }

    public void setEvinConformity(LabelValueBean<Integer> evinConformity) {
        this.evinConformity = evinConformity;
    }

    public String getContactReference() {
        return contactReference;
    }

    public void setContactReference(String contactReference) {
        this.contactReference = contactReference;
    }

    public LabelValueBean<String> getPublicationScope() {
        return publicationScope;
    }

    public void setPublicationScope(LabelValueBean<String> publicationScope) {
        this.publicationScope = publicationScope;
    }

    public String getRightsComment() {
        return rightsComment;
    }

    public void setRightsComment(String rightsComment) {
        this.rightsComment = rightsComment;
    }
}

I am trying to copy properties from SearchContent to Content as:
Content content = new Content();
Converter converter = new DateConverter(null);
BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance();
beanUtilsBean.getConvertUtils().register(converter, Date.class);
BeanUtils.copyProperties(searchContent, content);

System.out.println(searchContent);
System.out.println(content);

The Sysout is printing:
com.mhis.dam.service.search.bean.SearchContent[id=52906,docName=MHIS043570,docType=Images,docTitle=preview_1_8,docAuthor=sysadmin,securityGroup=Internal,docAccount=WF/017/DAM/000,revLabel=1,profile=DAMMedia,workflowStage=com.mhis.dam.generic.bean.LabelValueBean[label=Published,value=published],createDate=Fri Oct 18 15:30:35 IST 2013,inDate=Fri Oct 18 15:30:35 IST 2013,originalName=Vintage 2004 Gift Box & Bottle Black - hires.jpg,format=image/jpeg,extension=jpg,fileSize=2106898,author=Arjan,entity=com.mhis.dam.generic.bean.LabelValueBean[label=Dom Perignon,value=WF/017/DAM],brand=com.mhis.dam.generic.bean.LabelValueBean[label=Dom Perignon,value=WF/017/DAM/001],product=com.mhis.dam.generic.bean.LabelValueBean[label=Blanc,value=17_1_blanc],collection=com.mhis.dam.generic.bean.LabelValueBean[label=Pack shot,value=pack_shot_dp],subCollection=com.mhis.dam.generic.bean.LabelValueBean[label=Bottle shot,value=ps_bottle_dp],description=preview_1,program=com.mhis.dam.generic.bean.LabelValueBean[label=<null>,value=],vintage=,model=,restrictedZone=,event=com.mhis.dam.generic.bean.LabelValueBean[label=<null>,value=],language=com.mhis.dam.generic.bean.LabelValueBean[label=<null>,value=],geographicLocation=,watermark=,pageNumber=0,summary=,agentName=,commissionedByName=Nicolas,commissionedByDepartment=,bestOf=com.mhis.dam.generic.bean.LabelValueBean[label=<null>,value=0],mediaLocation=,fullRights=com.mhis.dam.generic.bean.LabelValueBean[label=<null>,value=1],mediaUsage=com.mhis.dam.generic.bean.LabelValueBean[label=<null>,value=],rightsEndDate=<null>,geographicRights=,evinConformity=com.mhis.dam.generic.bean.LabelValueBean[label=<null>,value=2],contactReference=,publicationScope=com.mhis.dam.generic.bean.LabelValueBean[label=Full public usage,value=fullPublic],rightsComment=]
com.mhis.dam.web.model.Content[selected=<null>,renditionInfoFetched=<null>,searchPageImageRendition=<null>,detailPageImageRendition=<null>,videoRendition=<null>,id=<null>,docName=<null>,docType=<null>,docTitle=<null>,docAuthor=<null>,securityGroup=<null>,docAccount=<null>,revLabel=<null>,profile=<null>,createDate=<null>,inDate=<null>,originalName=<null>,format=<null>,extension=<null>,fileSize=<null>,author=<null>,entity=<null>,brand=<null>,product=<null>,collection=<null>,subCollection=<null>,description=<null>,program=<null>,vintage=<null>,model=<null>,restrictedZone=<null>,event=<null>,language=<null>,geographicLocation=<null>,watermark=<null>,pageNumber=<null>,summary=<null>,agentName=<null>,commissionedByName=<null>,commissionedByDepartment=<null>,bestOf=<null>,mediaLocation=<null>,fullRights=<null>,mediaUsage=<null>,rightsEndDate=<null>,geographicRights=<null>,evinConformity=<null>,contactReference=<null>,publicationScope=<null>,rightsComment=<null>]

It is obvious to have null values for selected and renditionInfoFetched fields of the class Content, since they are not present in SearchContent but you can see all the other properties of Content is null. I am unable to find what I am doing wrong!
Any pointer would be very helpful.

A: There are two BeanUtils.copyProperties(parameter1, parameter2) in Java.
One is

org.apache.commons.beanutils.BeanUtils.copyProperties(Object dest,
  Object orig)

Another is

org.springframework.beans.BeanUtils.copyProperties(Object source,
  Object target)

Pay attention to the opposite position of parameters.

A: If you want to copy from searchContent to content, then code should be as follows
BeanUtils.copyProperties(content, searchContent);

You need to reverse the parameters as above in your code.
From API,
public static void copyProperties(Object dest, Object orig)
                           throws IllegalAccessException,
                                  InvocationTargetException)

Parameters:

dest - Destination bean whose properties are modified
orig - Origin bean whose properties are retrieved

A: As you can see in the below source code, BeanUtils.copyProperties internally uses reflection and there's additional internal cache lookup steps as well which is going to add cost wrt performance
 private static void copyProperties(Object source, Object target, @Nullable Class<?> editable,
                @Nullable String... ignoreProperties) throws BeansException {

            Assert.notNull(source, "Source must not be null");
            Assert.notNull(target, "Target must not be null");

            Class<?> actualEditable = target.getClass();
            if (editable != null) {
                if (!editable.isInstance(target)) {
                    throw new IllegalArgumentException("Target class [" + target.getClass().getName() +
                            "] not assignable to Editable class [" + editable.getName() + "]");
                }
                actualEditable = editable;
            }
            **PropertyDescriptor[] targetPds = getPropertyDescriptors(actualEditable);**
            List<String> ignoreList = (ignoreProperties != null ? Arrays.asList(ignoreProperties) : null);

            for (PropertyDescriptor targetPd : targetPds) {
                Method writeMethod = targetPd.getWriteMethod();
                if (writeMethod != null && (ignoreList == null || !ignoreList.contains(targetPd.getName()))) {
                    PropertyDescriptor sourcePd = getPropertyDescriptor(source.getClass(), targetPd.getName());
                    if (sourcePd != null) {
                        Method readMethod = sourcePd.getReadMethod();
                        if (readMethod != null &&
                                ClassUtils.isAssignable(writeMethod.getParameterTypes()[0], readMethod.getReturnType())) {
                            try {
                                if (!Modifier.isPublic(readMethod.getDeclaringClass().getModifiers())) {
                                    readMethod.setAccessible(true);
                                }
                                Object value = readMethod.invoke(source);
                                if (!Modifier.isPublic(writeMethod.getDeclaringClass().getModifiers())) {
                                    writeMethod.setAccessible(true);
                                }
                                writeMethod.invoke(target, value);
                            }
                            catch (Throwable ex) {
                                throw new FatalBeanException(
                                        "Could not copy property '" + targetPd.getName() + "' from source to target", ex);
                            }
                        }
                    }
                }
            }
        }

So it's better to use plain setters given the cost reflection


text:
Q: Можно ли вытянуть sql файл, редактировать его и импортировать в базу одним скриптом? Есть следующая ситуация: каждый день на фтп выгружается база сайта "А" в формате .sql. После чего вручную из нее выбираются две нужные таблицы, отфильтровуются старые значения (которые уже есть в базе "Б") и вручную импортируются в базу "Б". Можно ли автоматизировать этот процесс? Если да, то в какую сторону смотреть и с помощью чего это вообще можно сделать? Есть подозрения что все можно сделать с помощью PHP, но хотелось бы услышать реально ли это.

A: PHP тут не нужен , если базы идентичны то нужен простой BASH на 3 строчки

*

*Создайте базу TMP на том же сервере с тем же пользователем что и
основная база

*Загружаете в нее дамп сайта
mysql -uuser -ppass TMP < /tmp/databasename.sql

*Выбираем из базы TMP из нужной таблицы те записи которых нет в основной базе и тут же вставляем
INSERT INTO DB1.table1
SELECT * FROM TMP.table1 B WHERE B.id NOT IN (SELECT id FROM DB1.table1);

*По аналогии делаем с другими таблицами

*Добавляем задание в крон на ежедневное обновление данных и забываем.

A: Да, на php такое возможно.
Вы же сами очень хорошо описали логику, так и следуйте ей же :)
Вам нужно идти по пути:
Начать с работы с файлами на php
Потом понять по каким критериям выдёргивать нужные таблицы (полагаю, регуляркой)
И экспортировать стандартными средствами работы с бд (например, PDO)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Como fechar um modal somente pelos botôes? O título já é alto explicativo. Mas eu gostaria de saber como é que eu fecho um modal somente pelo botão de close e pelo "x" da janela, não permitindo que o usuário clique no fundo preto ao redor da janela de pop up para fechar.

HTML:

<button type="button" id="mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Modal title

        ...

        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>

http://jsfiddle.net/1aeur58f/1/

A: Use a opção backdrop com data-backdrop="static". Conforme consta da documentação oficial, essa opção faz com que a janela modal não feche com o click, só com os botões.

<button type="button" id="mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" data-backdrop="static">
  Launch demo modal
</button>

Exemplo: http://jsfiddle.net/1aeur58f/99/


text:
Q: Background and foreground in OpencV i'm working on a project using OpenCV243, I need to get the foreground  during a stream, my Problem is that I use the  cv::absdiff to get it doesn't really help, here is my code and the result .
#include <iostream>
#include<opencv2\opencv.hpp>
#include<opencv2\calib3d\calib3d.hpp>
#include<opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>

int main (){
    cv::VideoCapture cap(0);
    cv::Mat frame,frame1,frame2;
    cap >> frame;
    frame.copyTo(frame1);
    cv::imwrite("background.jpeg",frame1);
    int key = 0;
    while(key!=27){
        cap >> frame;
        cv::absdiff(frame, frame1, frame2);  // frame2 = frame  -frame1
        cv::imshow("foreground", frame2);
        if(key=='c'){
            //frame.copyTo(frame2);
            cv::imwrite("foreground.jpeg", frame2);
            key = 0;
        }

        cv::imshow("frame",frame);
        key = cv::waitKey(10);
    }
    cap.release();
    return 0;
}

as you can see  the subtraction work but what I want to get is only the  values of that changed  for example if have a Pixel in the background  with   [130,130,130] and the same pixel has [200,200,200]  in the frame  I  want to get exactly the last values and not [70,70,70]
I've already seen this tutorial : http://mateuszstankiewicz.eu/?p=189
but I can't understand the code and I have problems setting cv::BackgroundSubtractorMOG2 with my openCV version
thanks in advance for you help

A: BackgroundSubtractorMOG2 should work with #include "opencv2/video/background_segm.hpp"
The samples with OpenCV have two nice c++ examples (in the samples\cpp directory).

*

*bgfg_segm.cpp shows how to use the BackgroundSubtractorMOG2

*bgfg_gmg.cpp uses BackgroundSubtractorGMG

To get the last values (and asuming you meant to get the foreground pixel values) you could copy the frame using the foreground mask. This is also done in the first example, in the following snippet:
bg_model(img, fgmask, update_bg_model ? -1 : 0);
fgimg = Scalar::all(0);
img.copyTo(fgimg, fgmask);


text:
Q: Inserting generated UUID into table - can't adapt type UUID I'm populating a table like so:
...
time_id = uuid.uuid4()
location_id = uuid.uuid4()
id = row['id']

sql = '''
        INSERT INTO "my-schema"."example"(
            ...
            time_id,
            location_id
            id
        ) VALUES (..., %s, %s, %s)
'''
data = (..., time_id, location_id, id)
try:
    my_cursor.execute(sql, data)
    my_conn.commit()
except (psycopg2.Error) as e:
    print(e)

With the following table definition:
CREATE TABLE "my-schema".example
(
  ...
  time_id character varying(50),
  location_id character varying(50),
  CONSTRAINT "PK_example" PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE "my-schema".example
  OWNER TO postgres;

However this gives me the following error: can't adapt type 'UUID'. What would the reason for this be? I need the time_id and location_id to be unique as they act as a foreign key between a dimension and fact table.

A: uuid is a particular type which looks like a string, but isn't. You're trying to put it into a character field. You need to convert it to a string first: str(time_id), str(location_id).


text:
Q: Fetch only years and calculated number of sales in Laravel I have a contracts table with customer and device ID,
what I want to achieve is:

*

*First: fetch only all years from (from column)

*Second: calculate the total of device sold in that year show it on JavaScript Graph !

here is what I came so far:
myControler
public function getDashboardPage()
{
 $contracts = Contract::where('contract_type_id', '=', 2)
                ->whereNotNull('device_id')
                ->whereNotNull('customer_id')
                ->get();
  return view('dashboard.index')
            ->with('contracts ', $contracts );

myView
function morisChart(){

    var sales = {!! $contracts !!};
    var years= [];

    for (var j = 0; j < sales.length; j++) {
        years.push({
            year: sales[j].from.substr(0, 4)
        });
    }

    new Morris.Line({
      element: 'myfirstchart',
      data: years,
      xkey: 'year',
      ykeys: ['value'],
      labels: ['Devices Sold']
    });
}

where the contract_type_id 2 = sold.
I am having problem on fetching data on Graph this what I get

Thanks :)


text:
Q: gprof collect no time data in program with lua 5.2 state I'm trying measure overhead, we get by using lua script in C++ program. I decided to use gprof for that. I wrote simple program like:

*

*Create lua state

*Load lua libs

*Do file with lua script

The problem is that gmon.out cointains no time data. It looks like that:
Flat profile:

Each sample counts as 0.01 seconds.
no time accumulated

%   cumulative   self              self     total
time   seconds   seconds    calls  Ts/call  Ts/call  name

%         the percentage of the total running time of the
time       program used by this function.

... //rest of file

I wonder if wrap this code in C functions or object functions (aka methods) makes any difference. I've also check this topic but none of solutions works for me. Any idea?


text:
Q: What is the reason of
31.170.160.102 this is my ip I get from my free host.
/public_html/check.php in the file manager root there is public_html folder I added it check.php.
This is check.php:
<?php
$hostname_localhost ="mysql12.000webhost.com";
$database_localhost ="a6901827_justed";
$username_localhost ="a6901827_moudiz";
$password_localhost ="*****";
$localhost = mysql_connect($hostname_localhost,$username_localhost,$password_localhost)
or
trigger_error(mysql_error(),E_USER_ERROR);

mysql_select_db($database_localhost, $localhost);

$username = $_POST['username'];
$password = $_POST['password'];
$query_search = "select * from tbl_user where username = '".$username."' AND password = '".$password. "'";
$query_exec = mysql_query($query_search) or die(mysql_error());
$rows = mysql_num_rows($query_exec);
//echo $rows;
if($rows == 0) {
    echo "No Such User Found";
}
else  {
    echo "User Found";
}
?>

This is my code:
void login(){
    try{

        httpclient=new DefaultHttpClient();
        httppost= new HttpPost("http://31.170.160.102/public_html/check.php"); // make sure the url is correct.
        //add your data
        nameValuePairs = new ArrayList<NameValuePair>(2);
        // Always use the same variable name for posting i.e the android side variable name and php side variable name should be similar,
        nameValuePairs.add(new BasicNameValuePair("username",et.getText().toString().trim()));  // $Edittext_value = $_POST['Edittext_value'];
        nameValuePairs.add(new BasicNameValuePair("password",pass.getText().toString().trim()));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        //Execute HTTP Post Request
        response=httpclient.execute(httppost);
        int responseStatusCode = response.getStatusLine().getStatusCode();
        System.out.println("Response : " + responseStatusCode);

        Log.d("Http response: ", "> " + response);
        // edited by James from coderzheaven.. from here....
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        final String response = httpclient.execute(httppost, responseHandler);
        System.out.println("Response : " + response);
        runOnUiThread(new Runnable() {
            public void run() {
                tv.setText("Response from PHP : " + response);
                dialog.dismiss();
            }
        });

        if(response.equalsIgnoreCase("User Found")){
            runOnUiThread(new Runnable() {
                public void run() {
                    Toast.makeText(MainActivity.this,"Login Success", Toast.LENGTH_SHORT).show();
                }
            });

        //    startActivity(new Intent(MainActivity.this, UserPage.class));
        }else{
            showAlert();
        }

    }catch(Exception e){
        dialog.dismiss();
        System.out.println("Exception : " + e.getMessage());
    }
}

A: The reason is these two lines
Log.d("Http response: ", "> " + response);
System.out.println("Response : " + response);

Also, clearly not an error as designated by the I in the logcat. That means INFO.
I/System.out(19770):

An error would be E/<message>. I assume all these lines are also followed by D/<some_other_stuff>, which would be DEBUG from the Log.d line - and again, not an error.


text:
Q: Irreducible over $C[x,y]$ I want to show that $$f=x^4+2y^2x^2+yx+5y$$ is irreducible over $\mathbb C[x,y]$.
My answer is,
$f$ is in $\mathbb C[x,y]=\mathbb C[y][x]$, and let $R=\mathbb C[y]$, then $f$ is irreducible over $\mathbb C[y]$ (because if we let $c=y$, then $2y^2$, $y$, $5y$ is divisible by $c$, but $1$ is not divisible by $c$, and $5y$ is not divisible by $c^2$).
I don't know how to do next, but in my guess, $\mathbb C$ is $\text{UFD},$ so $\mathbb C[y]=R$ is also $\text{UFD}.$ And $f$ in $R[x]$ is primitive(Since $f$ is monic), and so on $\dots$
Is there any proposition about relation between this primitive, and irreducible?
Thank you!


text:
Q: how to pass a Dictionary value from view to template in django application I am just trying to learn a django project. I already did the creation of project and inside project myapp using django command.
In the directory /myproject/myapp$ I have views.py file. Another directory /myproject/myapp/templates$ I have hello.html file. I want send a Dictionary value from views.py file to hello.html file using render function. But I am getting some error called
**Internal Server Error: /hello/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner
    response = get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/joy/pythonWork/myproject/myapp/views.py", line 8, in hello
    name     : 'xyz',
NameError: global name 'name' is not defined**

I donot have any idea, how to solve this problem.Someone please help me.
My files are listed bellow:
/views.py
from django.shortcuts import render
from django.http import HttpResponse

# Create your views here.

def hello(request):
   personalDetails = {
       name     : 'xyz',
       phoneno  : '722924374'
   }
   return render(request, "hello.html", {personalDetails})

/hello.html

Hello
{{personalDetails}}

A: You're passing a dictionary. Dictionary keys should be strings.
def hello(request):
   personal_details = {
       'name': 'xyz',
       'phoneno': '7022924374',
   }
   return render(request, 'hello.html', {'personal_details': personal_details})

A: You should use render like this.
return render(request, "hello.html", {"personalDetails": personalDetails})

A: Try this change
from django.shortcuts import render
from django.http import HttpResponse

# Create your views here.

def hello(request):
   personalDetails = {
       name     : 'xyz',
       phoneno  : '722924374'
   }
   return render(request, "hello.html", **personalDetails)

and in your html

Hello
{{name}}

A: def hello(request):
   personalDetails = {
       name     : 'xyz',
       phoneno  : '7022924374'
   }
   return render(request, "hello.html", {"personalDetails":personalDetails})

And in template:

{% for item in personalDetails %}

Hello
{{item.name}}
{% endfor %}


text:
Q: Can I create more session objects in Flask? Basically what I want to do is to save some user-specific data, which I do not intend the user to be able to read.
This data should be stored for a week or so, but I can't use the session object, because I don't want to set session.permanent = True (I already use it to manage logins).
So basically I need a signed cookie, like session. Can I create an other instance of the session object somehow, or is there an easy way of making cookies signed?

A: Cookies contents are up to you, it's more or less a key value store in your users' browsers with an expiration date.
Regarding the content, for your use case you can use any kind of symmetric encryption like Fernet for instance (available in the cryptography package, cf https://cryptography.io/en/latest/).
As far as I know, itsdangerous (from Flask author, cf http://pythonhosted.org/itsdangerous/) enables you to sign the content of a cookie, but it doesn't "encrypt" it (the user will still be able to see the content, but not modify it). itsdangerous is a Flask dependency btw.


text:
Q: Codeigniter load view from outside application folder? I'm trying to load a view from outside the application folder in Codeigniter (3.1.0) like this:
public function index ( $page = '' ) {
    /**
     * Get active theme from DB
     */
    $active_theme = $this->m->getActiveTheme();

    /**
     * Change default view path
     */
    $this->_ci_view_paths = array(
        FCPATH . 'themes/' . $active_theme . '/' => TRUE
    );

    /**
     * Load index if page is not found
     */
    if ( ! file_exists( FCPATH . 'themes/' . $active_theme . '/' . $page . '.php')) {
        $this->load->view( 'index', $data );
    } else {
        $this->load->view( $page, $data );
    }
}

But I'm getting this error:
Unable to load the requested file: index.php
Or whatever page I try to load.
Anyone know what I'm missing here?

A: Ended up creating a custom loader:
class MY_Loader extends CI_Loader {
    public function __construct() {
        $this->_ci_view_paths = array(FCPATH . 'themes/' => TRUE);
    }
}

I can then do:
$this->load->view( $active_theme . '/index', $data );

A: On index.php in the latest version
/*
 *---------------------------------------------------------------
 * VIEW DIRECTORY NAME
 *---------------------------------------------------------------
 *
 * If you want to move the view directory out of the application
 * directory, set the path to it here. The directory can be renamed
 * and relocated anywhere on your server. If blank, it will default
 * to the standard location inside your application directory.
 * If you do move this, use an absolute (full) server path.
 *
 * NO TRAILING SLASH!
 */
    $view_folder = '';

A: This is just an FYI.
If you want the best of both worlds you can set your views to be in multiple places and CI will search them all... So adding to what Blaasvaer came up with you can set your new location and keep the existing one as well, if that is what you wanted to do...
class MY_Loader extends CI_Loader {
    public function __construct() {
    // append the new views path to the existing views path
       $this->_ci_view_paths = array( FCPATH . 'themes/' => true ) + $this->_ci_view_paths ;
    }
}


text: Q: Загрузка изображения согласно размеру монитора Есть ли библиотеки которые например по $(window).width или по screen.width позволяют узнать реальный размер монитора, что бы подгрузить изображение (например бэкграунд) именно нужного размера?


text:
Q: scala: select column where not contains elements into dataframe I have this ligne of code that should create a dataframe from list of columns that not contain a string. I tried this but it doesn't work:
val exemple = hiveObj.sql("show tables in database").select("tableName")!==="ABC".collect()

A: Try using the filter method:
import org.apache.spark.sql.functions._
import spark.implicits._
val exemple = hiveObj.sql("your query here").filter($"columnToFilter" =!= "ABC").show

NOTE: the inequality operator =!=is only available for Spark 2.0.0+. If you're using an older version, you must use !==. You can see the documentation here.
If you need to filter several columns you can do so:
.filter($"columnToFilter" =!= "ABC" and $"columnToFilter2" =!= "ABC")

A: another alternative answer to my question:
val exemple1 = hiveObj.sql("show tables in database").filter(!$"tableName".contains("ABC")).show()


text:
Q: Problem with doxygen and templates in .tpp file I have started using Doxygen (precompiled 1.8.14) to generate simple code documentation for my C++ project on Windows 10.
In a header file I define three templated functions and my definitions are placed in a .tpp file included at the end of the header file. Looking at the generated output, it seems doxygen does not read this file. Thus I concluded doxygen does not support this.

However according to the manual (http://www.doxygen.nl/manual/starting.html) it says that "Any other extension is parsed as if it is a C/C++ file." Is this sort of feature indeed not implemented?
IPC.hpp (sample)
class IPC {
public:
    template <class T, int N>
    bool setData(std::vector<T> data, Offsets offset);

    template <class T, int N>
    std::array<T, N> getData(Offsets offset);

    template <class T, int N>
    bool getData(std::array<T, N> &data, Offsets offset);

    bool getTrigger(Offsets selector, long timeout_ms = 0);
    void setTrigger(Offsets selector, Status on);
};

#include "IPC.tpp"

IPC.tpp (sample)
#pragma once
/*! Writes to the shared memory object.

    \param data gives the data that will be written.
    \param offset gives the byte offset from the start of the file.

    \return bool: true on completion

    \sa getData()
*/
template <class T, int N>
bool IPC::setData(std::vector<T> data, Offsets offset) {
    //Calculate the memory block size from the type and number
    unsigned int block_size = sizeof(T) * N;

    //Safety check
    if (block_size + offset > _size) {
        std::cerr << "Error at IPC::setData(): Block size is bigger than memory block size" << std::endl;
        return false;
    }

    if (data.size() < N) {
        std::cerr << "Error at IPC::setData(): Data array is smaller than N" << std::endl;
        return false;
    }

    //Create mapped_region
    mapped_region region(_shm, read_write, offset, block_size);

    for (int i = 0; i < N; i++) {
        std::memcpy((char* ) region.get_address() + sizeof(T) * i, &(data.at(i)), sizeof(T));
    }

    return true;
}

A: For future reference: add tpp=C++ to EXTENSION_MAPPING (under expert/project in doxywizard) and *.tpp to FILE_PATTERNS (under expert/input in doxywizard).


text:
Q: -50 error when converting PCM buffer with AVAudioConverter I'm trying to convert a AVAudioPCMBuffer with a 44100 sample rate to one with a 48000 sample rate, but I always get an exception (-50 error) when converting. Here's the code:
guard let deviceFormat = AVAudioFormat(standardFormatWithSampleRate: 48000.0, channels: 1) else {
    preconditionFailure()
}

// This file is saved as mono 44100
guard let lowToneURL = Bundle.main.url(forResource: "Tone220", withExtension: "wav") else {
    preconditionFailure()
}
guard let audioFile = try? AVAudioFile(forReading: lowToneURL) else {
    preconditionFailure()
}

let tempBuffer = AVAudioPCMBuffer(pcmFormat: audioFile.processingFormat,
                                       frameCapacity: AVAudioFrameCount(audioFile.length))!
tempBuffer.frameLength = tempBuffer.frameCapacity
    do { try audioFile.read(into: tempBuffer) } catch {
        assertionFailure("*** Caught: \(error)")
    }

guard let converter = AVAudioConverter(from: audioFile.processingFormat, to: deviceFormat) else {
    preconditionFailure()
}
guard let convertedBuffer = AVAudioPCMBuffer(pcmFormat: deviceFormat,
                                                     frameCapacity: AVAudioFrameCount(audioFile.length)) else {
    preconditionFailure()
}
convertedBuffer.frameLength = tempBuffer.frameCapacity
do { try converter.convert(to: convertedBuffer, from: tempBuffer) } catch {
     assertionFailure("*** Caught: \(error)")
}

Any ideas?

A: An Apple engineer answered this on their dev forums. I missed that the convert(to:from:) variant of AVAudioConverter can't convert sample rate so you have to use the withInputFrom variant. The docs on that aren't too clear but I came up with:
private func pcmBufferForFile(filename: String, sampleRate: Float) -> AVAudioPCMBuffer {

    guard let newFormat = AVAudioFormat(standardFormatWithSampleRate: Double(sampleRate), channels: 1) else {
        preconditionFailure()
    }
    guard let url = Bundle.main.url(forResource: filename, withExtension: "wav") else {
        preconditionFailure()
    }
    guard let audioFile = try? AVAudioFile(forReading: url) else {
        preconditionFailure()
    }
    guard let tempBuffer = AVAudioPCMBuffer(pcmFormat: audioFile.processingFormat,
                                            frameCapacity: AVAudioFrameCount(audioFile.length)) else {
        preconditionFailure()
    }

    let conversionRatio = sampleRate / Float(tempBuffer.format.sampleRate)
    let newLength = Float(audioFile.length) * conversionRatio
    guard let newBuffer = AVAudioPCMBuffer(pcmFormat: newFormat,
                                           frameCapacity: AVAudioFrameCount(newLength)) else {
        preconditionFailure()
    }

    do { try audioFile.read(into: tempBuffer) } catch {
        preconditionFailure()
    }
    guard let converter = AVAudioConverter(from: audioFile.processingFormat, to: newFormat) else {
        preconditionFailure()
    }
    var error: NSError?
    converter.convert(to: newBuffer, error: &error, withInputFrom: { (packetCount, statusPtr) -> AVAudioBuffer? in
        statusPtr.pointee = .haveData
        return tempBuffer
    })
    if error != nil {
        print("*** Conversion error: \(error!)")
    }
    return newBuffer
}


text:
Q: Google Map Geofence - Draw Rectangle I am trying to create Rectangle Geo-fence using Google Map API Reference. Using this API I am getting :

*

*North-East Latitude & Longitude

*South-West Latitude & Longitude

But for my Project I want all the 4 Vertex Lat. & Long. Co-ordinates. Please help me to achieve this. Any help would be appreciated.

A: If you have NE, SW
 North-East Latitude & Longitude = north_lat, east_lng
 South-West Latitude & Longitude = south_lat, west_lng

you have the rect coord ..
in pseudo code
rectangle coord  = (north_lat, west_lng)
                   (north_lat, east_lng)
                   (south_lat, east_lng)
                  ( south_lat, west_lng)
 or using eg: the coords

 var bounds = {
   north: 44.599,
   south: 44.490,
   east: -78.443,
   west: -78.649
};

you can use rectangle
rectangle = new google.maps.Rectangle({
  bounds: bounds
});


text:
Q: HTML Table Filter with Columns I have set up a basic table from an example in SO here where I added column titles.
Can anyone make a suggestion how to fix the table filter so it does not hid the column titles? Here is the jsfiddle code I have been testing.
Javascript
var $rows = $('#table tr');
$('#search').keyup(function() {

var val = '^(?=.*\\b' + $.trim($(this).val()).split(/\s+/).join('\\b)(?=.*\\b') + ').*$',
    reg = RegExp(val, 'i'),
    text;

$rows.show().filter(function() {
    text = $(this).text().replace(/\s+/g, ' ');
    return !reg.test(text);
}).hide();
});

Example search: If you type apple in the search - it hides title 1 and title 2. However, I prefer to keep the title 1 and title 2 after the search has been entered.

A: My recommendation:  add a class into your header, and exclude that from your filter results:
http://jsfiddle.net/7BUmG/1161/
    <input type="text" id="search" placeholder="Type to search">

          Title 1
          Title 2

          Apple
          Green

          Grapes
          Green

          Orange
          Orange

And using RegEx
var $rows = $('#table tr[class!="header"]');
$('#search').keyup(function()
{

   var val = '^(?=.*\\b'
                 + $.trim($(this).val()).split(/\s+/).join('\\b)(?=.*\\b')
                 + ').*$',
                 reg = RegExp(val, 'i'),
                 text;

   $rows.show().filter(function()
   {
      text = $(this).text().replace(/\s+/g, ' ');
      return !reg.test(text);
    }).hide();
});

A: Use var $rows = $('#table tbody tr');


text:
Q: Looking for an \ignorespacesandpars Is there an analogue of \ignorespaces which will also ignore the following \pars?

A: Here two macros which either ignore all spaces and implicit paragraphs (empty separation line) or also explicit \par macros. Both are based on the fact that \@ifnextchar, which is used to look ahead, also consumes optional spaces before reading the next token. This safes the usage of \ignorespaces. In the first case that token is irrelevant and \@ifnextchar is just use to get the functionality of \ignorespaces but allow us to put code behind it once the spaces are gone.
I came up with this solution while thinking about how to optimize Leo's answer for my applications.
\documentclass{article}

\makeatletter
\def\ignorespacesandimplicitepars{%
  \begingroup
  \catcode13=10
  \@ifnextchar\relax
    {\endgroup}%
    {\endgroup}%
}

\def\ignorespacesandallpars{%
  \begingroup
  \catcode13=10
  \@ifnextchar\par
    {\endgroup\expandafter\ignorespacesandallpars\@gobble}%
    {\endgroup}%
}

\makeatletter

% Test cases
\let\ignorespacesandpars\ignorespacesandimplicitepars
%\let\ignorespacesandpars\ignorespacesandallpars

\begin{document}

\def\test#1{#1\ignorespacesandpars}

\test{testa}    \test{testb}

\test{testc}
\test{testd}

\test{teste}

\par
\test{testf}

\end{document}

A: \documentclass{minimal}

\makeatletter
\begingroup
\catcode13=12%
\gdef\gobble@ignorespacesandpars#1{\ignorespacesandpars}%
\gdef\ignorespacesandpars{%
  \catcode13=12%
  \@ifnextchar^^M{\gobble@ignorespacesandpars}{\catcode13=5}}%
\endgroup
\makeatletter

\begin{document}

\def\test#1{-#1-\ignorespacesandpars}

foo\test{and} bar

foo\test{and}

bar

foo bar
\end{document}

Result:
foo-and-bar
foo-and-bar
foo bar

A: \def\ignorepar{\penalty 10001 \penalty 10003
   \def\par{\ifnum\lastpenalty=10003 \unpenalty \ifnum \lastpenalty=10001 \unpenalty
            \else \endgraf \fi \else \endgraf \fi \let\par\endgraf}\ignorespaces}

Note: You may take any penalties more than 10000. The 10001 and the 10003 is choosen because I believe that the probability that the 10001 and 10003 are usually found in a row is very low.
More simple case:
\def\ignorepar{\penalty 12674 \def\par{\ifnum\lastpenalty=12674 \unpenalty \else \endgraf \fi \let\par\endgraf}\ignorespaces}

Edit: no fail if there're more than one blank lines.
\def\ignorepar{\penalty 12674
   \def\par{\ifnum\lastpenalty=12674 \else \endgraf \let\par\endgraf \fi}\ignorespaces}


text:
Q: How to disable screensaver, sleep, lock, hibernate on windows 7 or using vb.net 2010 I don't have any idea if it is possible and how can I code it.
I have created an application that needs to run on a non-administrator account on windows 7. It won't run if the PC goes sleep/ locked/ hibernate/ on-screensaver. So, I want to disable them programmatically using vb.net 2010. Can any one help me?
By the way, I already tried to edit the power settings of the PC so it will never sleep/ hibernate, etc. But unfortunately, it keeps on sleeping after few hours. Any idea?

A: Try this:
Private Const SPI_SETSCREENSAVERACTIVE As Integer = 17

Private Declare Function SystemParametersInfo Lib "user32" _
    Alias "SystemParametersInfoA" (ByVal uAction As Integer, _
    ByVal uParam As Integer, ByRef lpvParam As Integer, _
    ByVal uWinIni As Integer) As Integer

Public Function SetScreenSaverActive(ByVal Active As Boolean) As Boolean

    Dim Result As Integer = SystemParametersInfo(SPI_SETSCREENSAVERACTIVE, CInt(Active), 0, 0)
    Return (Result > 0)

End Function

A: SetThreadExecutionState (VB) can be used to inform the system that it is in use. For CD-burners and things like that you might want to use ShutdownBlockReasonCreate.


text:
Q: Microsoft Edge contenteditable bug with selection in nodes with height or overflow It seems that Edge will not allow a selection on multiple divs when they are in contenteditable and the divs have either their height or overflow set (other styles may also cause this).
In this fiddle you will see that Chrome and Firefox allow the selection but Edge does not.

start selection somewhere on this line

and end on this line somewhere

where
.content1 {
  height:   40px;
  overflow: hidden;
}

How can this be avoided/fixed?


text:
Q: Oracle JDBC ojdbc6 Jar as a Maven Dependency I cannot seem to get Maven to bundle the ojdbc6.jar file into my project's war file.  I have it working within the POM file when specifying a dependency directly for Hibernate tools.  But it won't get bundled with the project's war file, and therefore my project won't run on Tomcat.
I have tried every solution I can find out there on the net, including those specified for this question here:
Find Oracle JDBC driver in Maven repository
Most recently, I did the following:

*

*Download the jar file to my machine

*Run the following command to install the jar into my local repository:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true

(I've tried all kinds of variants of that command, too.)

*Finally, I put the dependency into my pom file:
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0.3</version>
</dependency>

*I run a clean build, but it fails:
mvn -U clean package

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jazztwo 0.0.1
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/com/oracle/ojdbc6/11.2.0.3/ojdbc6-11.2.0.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.700s
[INFO] Finished at: Tue Mar 27 15:06:14 PDT 2012
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project jazztwo: Could not resolve dependencies for project edu.berkeley:jazztwo:war:0.0.1: Could not find artifact com.oracle:ojdbc6:jar:11.2.0.3 in central (http://repo1.maven.org/maven2) -> [Help 1]

Why doesn't this work?  I'm ready to throw expensive computer parts across the room.  This has wasted so much time. (Thank you, Oracle.  How much did we pay you again?)
Is it because I'm on a Mac, perhaps?

A: mvn install:install-file
-Dfile=C:\Users\xxxx\Downloads\lib\ojdbc6.jar
-DgroupId=com.oracle
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

to resolve the ORACLE JAR issue with the Spring Application,
Oracle JDBC ojdbc6 Jar as a Maven Dependency
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0</version>
    </dependency>`

A: First you need to download the particular jar from Oracle site (ojdbc.jar version 11.2.0.3)
if you download it to C:\filefolder
go to that directory in cmd prompt and provide the below command.It will install the dependency.Then you can build your project.
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dpackaging=jar -Dversion=11.2.0.4.0 -Dfile=ojdbc6.jar -DgeneratePom=true

A: For anyone reading this post in the future, you don't need to cd to the directory where the jar is present. Here is what you need to do -
Go to your project folder from where you can run maven commands (When you do an ls -ltr in this folder, you should see pom.xml)
Do this -
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=<Path where the jar is, example downloads>/ojdbc6.jar -DgeneratePom=true

Once this is done, you can add the dependency in your pom.xml, something like this -
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0.3</version>
    </dependency>

A: The correct answer was supplied by Raghuram in the comments section to my original question.
For whatever reason, pointing "mvn install" to a full path of the physical ojdbc6.jar file didn't work for me.  (Or I consistently repeatedly flubbed it up when running the command, but  no errors were issued.)
cd-ing into the directory where I keep ojdb6.jar and running the command from there worked the first time.
If Raghuram would like to answer this question, I'll accept his answer instead.  Thanks everyone!

A: After executing
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true

check your .m2 repository folder (/com/oracle/ojdbc6/11.2.0.3) to see if ojdbc6.jar exists. If not check your maven repository settings under $M2_HOME/conf/settings.xml

A: Below config worked for me. Refer this link for more details.
<dependency>
 <groupId>com.oracle.jdbc</groupId>
 <artifactId>ojdbc7</artifactId>
 <version>12.1.0.2</version>
</dependency>

A: Since Oracle is the licensed product, there are issue in adding maven dependency directly. To add any version of the ojdbc.jar, below 2 steps could do.

*

*Run the below command to install ojdbc.jar into local maven repository.

/opt/apache-maven/bin/mvn install:install-file
    -Dfile=<path-to-file>/ojdbc7.jar
    -DgroupId=com.oracle
    -DartifactId=ojdbc7
    -Dversion=12.1.0.1.0
    -Dpackaging=jar

This will add the dependency into local repository.

*Now, add the dependency in the pom file

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc7</artifactId>
    <version>12.1.0.1.0</version>
</dependency>

A: I have tried using the dependency without version tag and its worked fine for me.
<dependency>
    <groupId>com.oracle.ojdbc</groupId>
    <artifactId>ojdbc8</artifactId>
</dependency>

A: It is better to add new Maven repository (preferably using your own artifactory) to your project instead of installing it to your local repository.
Maven syntax:
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0.3</version>
</dependency>
...
<repositories>
    <repository>
      <id>codelds</id>
      <url>https://code.lds.org/nexus/content/groups/main-repo</url>
    </repository>
  </repositories>

Grails example:
mavenRepo "https://code.lds.org/nexus/content/groups/main-repo"
build 'com.oracle:ojdbc6:11.2.0.3'

A: I followed below command it worked:
mvn install:install-file -Dfile=E:\JAVA\Spring\ojdbc14-10.2.0.4.0.jar\ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar

After installation check that jar is installed correctly on your M2_repo.

A: Add Following dependency in pom.xml
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>oracle</artifactId>
    <version>10.2.0.2.0</version>
</dependency>

A: Go to the C drive->user->PcName->find .m2 and Paste the downloaded ojdbc jar file there, Server will automatically pick this.

A: Public: https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc6/11.2.0.4
<dependency>
    <groupId>com.oracle.database.jdbc</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0.4</version>
</dependency>

A: For Ubuntu Issue
In ubuntu .m2\ folder is difficult to find and difficult put jar into repository ,So when we put command of Step 1 in Command Prompt, then it create ojdbc7 jar into local repository.
Step 1: Go to any location like /home/user/Documents  open terminal and put this command
Command

mvn install:install-file -Dfile=path_of_downloaded_jar/ojdbc7.jar
-DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2.0 -Dpackaging=jar -X

Step 2: Put this dependency in pom.xml
Dependency
  <dependency>
   <groupId>com.oracle.jdbc</groupId>
   <artifactId>ojdbc7</artifactId>
   <version>12.1.0.2.0</version>
  </dependency>

Step 3: Update maven.
Please note:
You can change versions of ojdbc like ojdbc6/7/8 according your requirement.

A: Oracle JDBC drivers and other companion Jars are available on Central Maven. We suggest to use the official supported Oracle JDBC versions from 11.2.0.4, 12.2.0.2, 18.3.0.0, 19.3.0.0, 19.6.0.0, and 19.7.0.0. These are available on Central Maven Repository. Refer to Maven Central Guide for more details.
It is recommended to use the latest version. Check out FAQ for JDK compatibility.


text:
Q: Click a button on an MS Access form from C# using Access Interop I can connect to the access database and run functions etc from c#, I can even get a hold of the button I need to click, but I can't make it think it's been clicked.
 nonManagedDb.DoCmd.OpenForm("frmMaintenance", Access.AcFormView.acNormal, MissingVal, Access.AcFormOpenDataMode.acFormReadOnly, Access.AcWindowMode.acWindowNormal, MissingVal);
            var RunRep = (CommandButton)nonManagedDb.Forms["frmMaintenance"].Controls["btnDailySheetsReport"];

That's as afar as I've gotten with this, I've tried reflection to grab it's event and invoke it but it's classed as a COM object only so that's out.

A: In Access we can call a procedure in another form using the following syntax:
Call Forms.TransactionTotals.UpdateEmployeeHours

or
Call Forms.OtherTransactionsEntry_VendorInvoices.SetInvoiceID(Me.cboVendorInvoiceID)

Now I doubt you can use similar syntax in .Net but maybe that's enough to figure things out via Interop, etc.
Otherwise if you can run a function then create a one line function in Access whose only job is to call the procedure on a form.
Also a click procedure will be called something like
cmdDeleteTransaction_Click


text:
Q: Blazor - navigation and state issue Scenario:
I'm currently creating a basic server side Blazor crud application, Blazor being something I have just started experimenting with.
I've encountered an issue with a back button when navigating back from an edit page to an index page. The issue is as follows:

*

*I edit a record and make some changes to a field without saving

*I click the back button which navigates back to the index page

*The record that I made changes to within the list of records shows the changes I made in the edit form, however I did not hit save.

*I refresh the page and the record returns back to it's original state.

I have tried using a button with an on click and an the following:
 Back

Question:
Any ideas where I'm going wrong?
Index:
@page "/branches"
@inject BranchRepository repository

<GenericList List="branches">
  <WholeListTemplate>

                Name
                Code

            @foreach (var item in branches)
            {

                    @item.sName
                    @item.sBranchNumber
                    Edit

            }

  </WholeListTemplate>
</GenericList>

@code {
  List<Core.Entities.Branch> branches;

  protected async override Task OnInitializedAsync()
  {
    branches = null;
    branches = await repository.GetAllBranches();
  }
}

Edit:
@page "/branch/edit/{id:int}"

@inject NavigationManager navigationManager
@inject BranchRepository repository

Edit Branch

@if(branch != null)
{
  <BranchEditForm Branch="branch" OnValidSubmit="Update" />
}

@code {
  [Parameter] public int Id { get; set; }

  private Branch branch;

  protected override void OnInitialized()
  {
    branch = repository.GetById(Id);
  }

  private void Update()
  {
    repository.Update(branch);
    navigationManager.NavigateTo("branches");
  }
}

BranchEditForm:
<EditForm Model="Branch" OnValidSubmit="OnValidSubmit">
   <DataAnnotationsValidator />

            Name

         <InputText class="form-control" @bind-Value="@Branch.sName" />
         <ValidationMessage For="@(() => Branch.sName)" />

            Branch Number

         <InputText class="form-control" @bind-Value="@Branch.sBranchNumber" />
         <ValidationMessage For="@(() => Branch.sBranchNumber)" />

     Back
    <button type="submit" class="btn btn-sm btn-success"> Save</button>
</EditForm>

@code {
   [Parameter] public Branch Branch { get; set; }
   [Parameter] public EventCallback OnValidSubmit { get; set; }
}

A: Cause
DbContext cached the changes made to the entity
Solution
Through helpful comments, I looked into DbContext caching in EF Core and found a useful post https://codethug.com/2016/02/19/Entity-Framework-Cache-Busting/.
Through this I found out a way to reload an entity or a collection of entities generically:
One Entity
    public async Task ReloadEntity<TEntity>(TEntity entity)
    {
        if (entity != null) await context.Entry(entity).ReloadAsync();

        return;
    }

Multiple Entities
Note - According to the post linked above, this is ideal for a handful of entities. Performance problems may occur if large lists are passed in
    public async Task ReloadEntities<TEntity>(List<TEntity> entities)
    {
        if (entities.Count() > 0)
        {
            foreach (var entity in entities) if (entity != null) await context.Entry(entity).ReloadAsync();
        }

        return;
    }


text:
Q: could not find module 'Alamofire' for target 'x86_64-apple-ios-simulator' I install alamofire via Carthage and get this error:
could not find module 'Alamofire' for target 'x86_64-apple-ios-simulator'; found: armv7-apple-ios, arm64-apple-ios,
at: /Users/datdinh/Desktop/a/requestTest/Carthage/Build/iOS/Alamofire.framework/Modules/Alamofire.swiftmodule

A: I recently had the exact same problem, with Xcode 14.1 and a Scheme/Configuration called "Debug".
After a day and tweaking, I found out its only related to Xcodes Configuration & Scheme name, as soon as I changed it from Debug to Test or anything else, the problem disappeared, correctly building necessary architure for the Simulator.
Note: I did have another Configuration/Scheme with debug-like settings which worked flawless, so I knew that in general my Xcode Build Settings were alright.
Besides that, Xcode 14 is quite buggy, for me not displaying compile errors for currently open files. Since I am on Ventura I cannot use Xcode 13.4.1. A Nightmare!

A: I have Xcode 14.2 and multiple Schemes in the app like MyApp2-debug and MyApp2-release
I resolved the same problem by changing the Scheme of Debug to MyApp-debug and Release to MyApp-release or anything else.
Other Schemes were working fine.


text:
Q: Autoboxing Unboxing Operator (!=) and (==) difference public class T1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        Integer i1 = 1000;
        Integer i2 = 1000;
        if(i1 != i2) System.out.println("different objects");
        if(i1.equals(i2)) System.out.println("meaningfully equal");

    }

}

O/P for this is:

different objects
  meaningfully equal

Where as
public class T2 {

    public static void main(String[] args) {

        Integer i3 = 10;
        Integer i4 = 10;
        if(i3!=i4)System.out.println("Crap dude!!");
        if(i3 == i4) System.out.println("same object");

        if(i3.equals(i4)) System.out.println("meaningfully equal");
    }

}

Produces Following O/P:

same object
  meaningfully equal

I didn't understand why in class T2 if(i3!=i4) didn't get triggered I'm refering SCJP 1.6 but not able to understand.
Please help me.

A: There is Integer pool for the numbers from -128 to 127 in java. JLS says

If the value p being boxed is true, false, a byte, or a char in the
  range \u0000 to \u007f, or an int or short number between -128 and 127
  (inclusive), then let r1 and r2 be the results of any two boxing
  conversions of p. It is always the case that r1 == r2.
Ideally, boxing a given primitive value p, would always yield an
  identical reference. In practice, this may not be feasible using
  existing implementation techniques. The rules above are a pragmatic
  compromise. The final clause above requires that certain common values
  always be boxed into indistinguishable objects. The implementation may
  cache these, lazily or eagerly. For other values, this formulation
  disallows any assumptions about the identity of the boxed values on
  the programmer's part. This would allow (but not require) sharing of
  some or all of these references.
This ensures that in most common cases, the behavior will be the
  desired one, without imposing an undue performance penalty, especially
  on small devices. Less memory-limited implementations might, for
  example, cache all char and short values, as well as int and long
  values in the range of -32K to +32K.

A: Small integers get interned, meaning that there's only one instance of Integer for the given value.
This doesn't happen for large integers, hence the difference in behaviour between your two tests.

A: Integer are cached between range -128 to 127. so Integer in between the range(containing boundary values) will return the same reference..
like
Integer i3 = 127;
Integer i4 = 127;
Integer i5 = 128;

 if(i3!=i4)System.out.println("Crap dude!!");   // same reference
 if(i3 == i4) System.out.println("same object");
 if(i3 != i5) System.out.println("different object");

output..
same object
different object

As '==' compares reference and 'equals' compares content.  for more detail You may go to
Immutable Objects / Wrapper Class Caching

A: anyway you can get double false with:
Integer n1 = -1000;
Integer n2 = -1000;

Integer p1 = 1000;
Integer p2 = 1000;

System.out.println(n1 == n2);
System.out.println(p1 != p2);

there is an option to set max size of this Integer pool
  /**
   * Cache to support the object identity semantics of autoboxing for values between
   * -128 and 127 (inclusive) as required by JLS.
   *
   * The cache is initialized on first usage.  The size of the cache
   * may be controlled by the -XX:AutoBoxCacheMax=<size> option.
   * During VM initialization, java.lang.Integer.IntegerCache.high property
   * may be set and saved in the private system properties in the
   * sun.misc.VM class.
   */

A: This is because 10 is in between the range [-128, 127]. For this range == works fine since the JVM caches the values and the comparison will be made on the same object.
Every time an Integer (object) is created with value in that range, the same object will be returned instead of creating the new object.
See the JLS for further information.


text:
Q: Why when I upload an Api permission via Powershell to AzureAd I get only the Id? I'm trying to upload some api permission to my app registration in Azure, but I don't get why for some the process work and for others no.
$svcGraph = Get-AzureADServicePrincipal -All $true | ? { $_.DisplayName -eq "Microsoft Graph" }

$Graph = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess"
$Graph.ResourceAppId = $svcGraph.AppId

$delPermission1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "df021288-bdef-4463-88db-98f22de89214","Scope"

$delPermission2 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "e1fe6dd8-ba31-4d61-89e7-88639da4683d","Scope"

$Graph.ResourceAccess = $delPermission1, $delPermission2

Set-AzureADApplication -ObjectId $MyAppObjectId -RequiredResourceAccess $Graph

User.read (delPermission2) work, but User.Read.All (delPermission1) don't, and I don't understand why.
I tried multiple permission, but just User.read worked, here are the id and value:
741f803b-c850-494e-b5df-cde7c675a1ca     User.ReadWrite.All
83cded22-8297-4ff6-a7fa-e97e9545a259     Presence.ReadWrite.All
810c84a8-4a9e-49e6-bf7d-12d183f40d01     Mail.Read

A: As far as I know, the ID's you are using for User.Read.All, User.ReadWrite.All, Presence.ReadWrite.All and  Mail.Read permissions are incorrect.
To find the correct ID's of those delegated permissions, make use of below cmdlet:
 $svcGraph.Oauth2Permissions | FT ID, Value, UserConsentDisplayName

From that, note down the correct ID's of all those permissions:
User.Read.All    -   a154be20-db9c-4678-8ab7-66f6cc099a59
User.ReadWrite.All  -  204e0828-b5ca-4ad8-b9f3-f32a958e7cc4
Presence.Read.All - 9c7a330d-35b3-4aa1-963d-cb2b9f927841
Presence.ReadWrite   -  8d3c54a7-cf58-4773-bf81-c0cd6ad522bb
Mail.Read - 570282fd-fa5c-430d-a7fd-fc8dc98a9dca
The ID that you are using for User.Read is correct. That's why it worked.
User.Read - e1fe6dd8-ba31-4d61-89e7-88639da4683d
Make sure you have the role of Administrator and use the correct ID's by modifying the values.
For more reference, please find below reference if it is helpful.
How to assign Permissions to Azure AD App by using PowerShell? – Beyond the Horizon… (rajanieshkaushikk.com)


text:
Q: Maven doesn't build project with surefire plugin in pom I have a maven project with Selenium WebDriver tests using TestNG. I would like to run tests in groups, thats why is important to have surefire plugin in pom file, thats what i added to pom file:

If i run my project after adding those words using maven(using testNG is still working), i get an error in console and WebDriver doesn't even open.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test
(default-test) on project PORefactor: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.15:test failed: There was an error in
the forked process.

and also :
[ERROR] Cannot find class in classpath: com.volnoboy.POImplementation

I tried to refresh and clean project. I moved project to a different computer and error is the same. Internet connection is good. What should i do?

A: This is my pom
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.15</version>
            <configuration>
                <!-- <groups>1</groups> -->
                <suiteXmlFiles>
                    <suiteXmlFile>testSuites\testng1.xml</suiteXmlFile>
                    <suiteXmlFile>testSuites\testng1.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.15</version>
        </plugin>

Try with that plugin.
And of course you need the testng and selenium dependecies in your pom.
Hope it helps.


text:
Q: package org.apache.hadoop.record does not exist I'm a new learner of Hadoop and I was packaging the codes from Tom White's Hadoop Guide Book (4th Edition) with maven and I encountered issue for chapter 22's codes. It notice me that "package org.apache.hadoop.record" is not exist.
I googled this package and found that it has already been deprecated by Avro. Avro and other dependent packages are installed by maven. You can see from the result below that other compile task are successful.
[INFO] 53 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Hadoop: The Definitive Guide, Project .............. SUCCESS [ 0.406 s]
[INFO] Common Code ........................................ SUCCESS [ 2.231 s]
[INFO] Chapter 2: MapReduce ............................... SUCCESS [ 0.194 s]
[INFO] Chapter 3: The Hadoop Distributed Filesystem ....... SUCCESS [ 0.398 s]
[INFO] Chapter 5: Hadoop I/O .............................. SUCCESS [ 0.376 s]
[INFO] Chapter 6: Developing a MapReduce Application ...... SUCCESS [ 0.336 s]
[INFO] Chapter 8: MapReduce Types and Formats ............. SUCCESS [ 0.651 s]
[INFO] Chapter 9: MapReduce Features ...................... SUCCESS [ 0.344 s]
[INFO] Chapter 12: Avro ................................... SUCCESS [ 5.353 s]
[INFO] Chapter 13: Parquet ................................ SUCCESS [ 1.922 s]
[INFO] Chapter 15: Sqoop .................................. SUCCESS [ 0.148 s]
[INFO] Chapter 16: Pig .................................... SUCCESS [ 0.173 s]
[INFO] Chapter 17: Hive ................................... SUCCESS [ 0.426 s]
[INFO] Chapter 18: Crunch ................................. SUCCESS [ 1.371 s]
[INFO] Chapter 19: Spark .................................. SUCCESS [ 13.280 s]
[INFO] Chapter 20: HBase .................................. SUCCESS [ 0.390 s]
[INFO] Chapter 21: ZooKeeper .............................. SUCCESS [ 0.090 s]
[INFO] Chapter 22: Case Studies ........................... FAILURE [ 0.196 s]
[INFO] Hadoop Examples JAR ................................ SKIPPED
[INFO] Snippet testing .................................... SKIPPED
[INFO] Hadoop: The Definitive Guide, Example Code ......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28.732 s
[INFO] Finished at: 2017-07-12T10:56:53+08:00
[INFO] Final Memory: 90M/360M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ch22-case-studies: Compilation failure: Compilation failure:
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[4,57] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[5,53] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[6,47] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[35,46] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[38,65] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[100,55] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[110,71] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[120,57] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[218,66] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[9,57] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[10,73] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[11,69] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[12,73] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[13,74] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[14,69] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[53,53] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[56,36] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[57,55] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[60,38] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[146,58] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[146,136] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[147,38] package org.apache.hadoop.record.meta does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[226,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[227,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[231,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[232,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[236,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[237,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[241,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[242,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[246,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[247,43] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[260,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[261,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[265,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[266,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[270,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[271,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[275,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[276,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[280,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[281,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[285,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[286,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[290,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[291,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[295,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[296,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[300,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[301,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[305,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[306,44] package org.apache.hadoop.record does not exist
[ERROR] /usr/local/hadoop/myclass/hadoop-book/ch22-case-studies/src/main/java/fm/last/hadoop/io/records/TrackStats.java:[321,29] package org.apache.hadoop.record does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :ch22-case-studies

Also attach my environment variables here.
#JAVA
export JAVA_HOME=/usr/java/jdk1.8.0_131
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
#HADOOP
export HADOOP_HOME=/usr/local/hadoop
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
export HADOOP_CLASSPATH=/usr/local/hadoop/share/hadoop/common/hadoop-common-3.0.0-alpha3.jar:/usr/local/hadoop/myclass
#HIVE
export HIVE_INSTALL=/usr/local/hive
export PATH=$PATH:$HIVE_INSTALL/bin

Could anyone help me with this issue? Thanks


text:
Q: App Won't Run On Emulator After Updating? Error:Execution failed for task ':app:processDebugManifest' I have an app I have been reskinning, and after updating some portion of Android Studio (Don't know exactly what it was, I just clicked update because this happens often), the app won't run on the emulator! The emulator opens, and is working fine with other apps, just not this one. Even a version of the app that I know works, because I tested it and took screenshots of it a few days ago. I don't know why it isn't opening on the emulator... This is what it tells me.
"Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed with multiple errors, see logs"

What does this mean? I've tried to find the solution on other questions, but they are outdated and no longer relevant to the versions of build tools, etc. that my app is using. All help is very much appreciated! Thank You.