From my experiences the reduce function is operatable only on the emitted results.
If the record is not emitted(grouped) then the reduce function make NOTHING
with this record.
in case of max/min calculation this state can not be catch.
Not emitted records are already have it is max/min value as the one is only one
value in interested field but not a result of the reduce function.
the mentioned state is clearly observed when you try to modify the existing field
that come from emit.
for example:
db.test.drop();
db.test.insert({username:"0000001453"});
db.test.insert({username:"0000000018"});
//db.test.insert({username:"0000000018"});//try with and w/o this.
m=function(){
emit({username:this.username}, {firstname:"firstname",lastname:"lastname"});
}
r=function(key,values){
var x=values[0];
x.firstname="smth";//no effect when not emitted
x.lastname ="smth";//no effect when not emitted
return x;
}
db.test.mapReduce(m,r,{out:"results"});
db.results.find();
Wednesday, June 29, 2011
Monday, May 9, 2011
x509 SubjectAlternativeNameExtension GeneralNames
SubjectAltName ::= GeneralNames
GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
GeneralName ::= CHOICE {
otherName [0] OtherName,
rfc822Name [1] IA5String,
dNSName [2] IA5String,
x400Address [3] ORAddress,
directoryName [4] Name,
ediPartyName [5] EDIPartyName,
uniformResourceIdentifier [6] IA5String,
iPAddress [7] OCTET STRING,
registeredID [8] OBJECT IDENTIFIER}
CertificateExtensions ext = new CertificateExtensions();
DNSName dNSName = new DNSName("shahbazov.com");
GeneralName generalName= new GeneralName(dNSName);
GeneralNames generalNames = new GeneralNames();
generalNames.add(generalName);
ext.set(SubjectAlternativeNameExtension.NAME,
new SubjectAlternativeNameExtension(generalNames));
X509CertInfo info = new X509CertInfo();
...
...
info.set(X509CertInfo.EXTENSIONS, ext);
X509CertImpl cert = new X509CertImpl(info);
GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
GeneralName ::= CHOICE {
otherName [0] OtherName,
rfc822Name [1] IA5String,
dNSName [2] IA5String,
x400Address [3] ORAddress,
directoryName [4] Name,
ediPartyName [5] EDIPartyName,
uniformResourceIdentifier [6] IA5String,
iPAddress [7] OCTET STRING,
registeredID [8] OBJECT IDENTIFIER}
CertificateExtensions ext = new CertificateExtensions();
DNSName dNSName = new DNSName("shahbazov.com");
GeneralName generalName= new GeneralName(dNSName);
GeneralNames generalNames = new GeneralNames();
generalNames.add(generalName);
ext.set(SubjectAlternativeNameExtension.NAME,
new SubjectAlternativeNameExtension(generalNames));
X509CertInfo info = new X509CertInfo();
...
...
info.set(X509CertInfo.EXTENSIONS, ext);
X509CertImpl cert = new X509CertImpl(info);
Friday, February 5, 2010
simple jsf converter
package org.tspakb.egitim.web.converter;
import java.util.HashMap;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.tspakb.egitim.entity.EducationType;
/**
*
* @author telman
*/
public class EducationTypeConverter implements Converter {
Map mapEducationTypes = new HashMap();
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (mapEducationTypes == null || value == null) {
return null;
}
return mapEducationTypes.get(Long.valueOf(value));
}
public String getAsString(FacesContext context, UIComponent component, Object value) {
Long result = null;
if (value instanceof EducationType &&(result = ((EducationType) value).getId()) != null) {
mapEducationTypes.put(result, (EducationType) value);
return result.toString();
}
return null;
}
}
import java.util.HashMap;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.tspakb.egitim.entity.EducationType;
/**
*
* @author telman
*/
public class EducationTypeConverter implements Converter {
Map
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (mapEducationTypes == null || value == null) {
return null;
}
return mapEducationTypes.get(Long.valueOf(value));
}
public String getAsString(FacesContext context, UIComponent component, Object value) {
Long result = null;
if (value instanceof EducationType &&(result = ((EducationType) value).getId()) != null) {
mapEducationTypes.put(result, (EducationType) value);
return result.toString();
}
return null;
}
}
Subscribe to:
Comments (Atom)