Issue: Characters / encode /decode & Solution

Hey guys,
Few issues on this, I think we will need an encode/decode filter.
I guess this is related to how if you read a cookie in liquid it converts characters like a comma into its entity (This isn not fixed yet).
Example:
<meta property="og:description" content="{{description | strip_html | truncate:200,'...' }}">
The resulting markup is:
<meta property="og:description" content="Seven advisers within National Australia Bank's (NAB) salaried advice business, NAB Financial Planning (NAB FP), have transitioned to the bank&rsquo;s newly-launched self-employed model.
As first ...">
You can see it has stripped out the html markup but has encoded a ' with it's entity. I can see in some cases this is good but in other cases this is bad. You can also see that <br/> while stripped are treated as new lines instead.
Liquid itself for these reasons have:
escape - escape a string
escape_once - returns an escaped version of html without affecting existing escaped entities
strip_html - strip html from string
strip_newlines - strip all newlines (\n) from string
newline_to_br - replace each newline (\n) with html break
You only have strip_html but not the other filters. I think if you implemented these then we can address these issues.

Hi Liam,
The encoding problem cannot be reproduced. Even in your example, some of the quotes are outputted correctly while a single one not. Can you edit the source of the content and try to re-enter the character from the editor, just to eliminate a possible copy / paste issue from word with a weird character encoding?
On the new line issue, it seems to happen on some scenarios. For example:
{{" <div>Seven advisers within National Australia Bank's (NAB) salaried advice business, NAB Financial Planning (NAB FP), have transitioned to the bank's newly-launched's self-employed <br /> model. at first's</div>" | strip_html }} - does not reproduce the problem
<meta property="og:description" content="{{" <div>Seven advisers within National Australia Bank's (NAB) salaried advice business, NAB Financial Planning (NAB FP), have transitioned to the bank's newly-launched's self-employed <br /> model. at first's</div>" | strip_html }}”> - does reproduce the problem
Cristinel

Similar Messages

  • Japanese Characters Encoding Problem

    Hi All,
    I have been looking at the problems posted in this forum and quite a few describe the issue I am facing currently but none has been able to provide a solution.
    The problem I am facing is as follows:
    Step 1: I am retrieving Japanese data from Oracle DB 9i (Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit) using standard JDBC API calls. [NLS_CHARACTERSET : AL32UTF8,  NLS_NCHAR_CHARACTERSET : AL16UTF16]
    byte[] title = resultSet.getBytes("COLUMN_NAME");
    Step 2: I pass the retrieved bytes to a method that returns SJIS encoded String.
    private String getStringSJIS(byte[] bytesToBeEncoded) {
              StringBuffer sb = new StringBuffer();
              try {
                   if (title != null) {
                        ByteArrayInputStream bais = new ByteArrayInputStream(bytesToBeEncoded);
                        InputStreamReader isr = new InputStreamReader(bais, "SJIS");
                        for (int c = isr.read(); c != (-1); c = isr.read()) {
                             sb.append((char) c);
                   return sb.toString();
              } catch (Exception ex) {;}
    3) I am using an HTML Parser JAR to print the decimal value of the Encoded String.
    String after = getStringSJIS(title);
    System.out.println(Translate.encode(after));
    I get an output of String 1: &#65410;&#31167;&#65402;&#65410;&#26412;&#65410;&#21476;&#65386;&#65410;&#12469;&#65410;&#12452;&#65410;&#12488;
    which contains 14 decimal character codes.
    The same data is being read by another application that uses JDBC again and connects to the same DB and returns the decimal values as: String 2: &#26085;&#26412;&#35486;&#12469;&#12452;&#12488;
    The display of these two Strings differ significantly when viewed in the browser.
    It seems String 1 contains single byte half-width characters and String 2 does not. Is anyone familiar as to why the bytes are getting modified while being retrieved from the Database for the same column value?

    The encoding for the bytes being returned from the database is Cp1252 but this encoding, I understand, depends on the underlying platform I am using.
    If indeed the data from the DB is in UTF-8 or 16, shouldn't it be displayed correctly in the browser? No encoding/decoding should be required on the data then. In the browser it gets displayed as “ú–{ŒêƒTƒCƒg. (The encoding of the JSP page is set to UTF-8.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Base 64 Encode/Decode

    I consider sending clear text problematic when the data ends
    up as XML information. Converting the text Strings to Base 64
    between PHP and Flex 2 (or anything else and Flex 2) eliminates
    issues with character text like <> and &'s. I've done a
    lot of XMLRPC coding and always sent text data values that are Base
    64 format. The built in Flex 2 Base 64 functions make this easier.
    On the PHP side, you can use
    $b64StringVal = base64_encode ( $stringData );
    $stringData = base64_decode ( $b64StringVal );
    to convert.
    If you are using Java at th back end, look at:
    http://iharder.sourceforge.net/current/java/base64/
    Definitions in the CDATA area:
    import mx.utils.Base64Encoder;
    import mx.utils.Base64Decoder;
    import flash.utils.ByteArray;
    public function encodeB64(target:String) : String
    var be:Base64Encoder = new Base64Encoder();
    be.encode(target);
    var encodedData:String = be.flush();
    return encodedData;
    public function decodeB64(target:String) : String
    var bd:Base64Decoder = new Base64Decoder();
    bd.decode(target);
    var decodedData:ByteArray = bd.drain();
    return decodedData.toString();
    [Bindable] public var myData:String = new String();
    private function loginResult(evt:ResultEvent):void {
    var b64MyData:String = evt.result.MyData;
    myData=decodeB64(b64MyData);
    In the mxml area:
    <mx:HTTPService id="loginPage" url="
    http://localhost/xxx.php"
    useProxy="false" method="POST" />
    <mx:Model id="loginModel1">
    <root>
    <loginModel>"loginModel1"</loginModel>
    <username>{encodeB64(username.text)}</username>
    <password>{encodeB64(password.text)}</password>
    </root>
    </mx:Model>

    Hello jlmoller,
    Have you ever had an issue where the encoding / decoding
    process ended up prepending the string with extra characters?
    This is happening to me
    Erik

  • Encode/Decode string from unix shell

    Hi,
    I am not sure I'm addressing my question properly, but simply I have a stream where I send commands to a shell and when these commands come back from the input stream they don't mean anything as shown below:
    inc show int status | inc |1/7|1/17|1/19|1/^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H$atus | inc show int status | inc |1/7|1/17|1/19|1/1 ^H^H^H^H^H^H^H^H^H8|1/6|1/8^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H show int status | inc |1/7|1/17|1/19|1/18|1/6|1/8| ^H^H^H^H^H^H^H^H^H1/16|1/15^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Hstatus | inc |1/7|1/17|1/19|1/18|1/6|1/8|1/16|1/15| ^H^H^H^H^H^H^H^H^H1/13|1/14^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Hnc |1/7|1/17|1/19|1/18|1/6|1/8|1/16|1/15|1/13|1/14| ^H^H^H^H^H^H^H^H^H1/12|1/11^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H17|1/19|1/18|1/6|1/8|1/16|1/15|1/13|1/14|1/12|1/11| ^H^H^H^H^H^H^H^H^H1/9|1/10
    I am using the utf-8 for encoding...do I need to decode it and how?
    Here is part of my code:
    OutputStreamWriter writer = new OutputStreamWriter(sess.getStdin(), "utf-8");
    writer.write("my string");
    writer.flush();
    class StreamGobbler implements Runnable {
            InputStream is;
            OutputStream oi;
            String type;
            ResultBean resultBean;
            StreamGobbler(InputStream is, String type, ResultBean returnValue) {
                this.is = is;
                this.type = type;
                this.resultBean = returnValue;
            @Override
            public void run() {
                try {
                    InputStreamReader isr = new InputStreamReader(is, "UTF-8");
                    BufferedReader br = new BufferedReader(isr);
                    String line = null;
                    while ((line = br.readLine()) != null) {
                        //System.out.println("TYPE[" + type +  "] COMES FROM STD_OUT THREAD: " + line);
                        this.resultBean.addResultLine(line);
                        this.resultBean.addMessage(line);
                } catch (IOException ioe) {
                    System.out.println("IOE Exception in StreamGobbler");
                    ioe.printStackTrace();
        }Thanks in advance, i never dealt with encoding/decoding text.

    kminev wrote:
    I am pretty sure it is an encoding issue, I'm not convinced because ^H is the ASCII backspace character. Maybe not as I originally thought just some padding but it looks like some form of formatting done the old fashioned way using control characters.
    because if I also send this output in an email format and the email renders it a bit differently, then if I copy and paste the text to html page and render it on the screen it look as it is suppose to be.It's definitely not HTML so this does not seem logical.
    >
    Here are the ios commands I am issuing:
    show int status | inc |gi1/2|gi1/3|gi1/5
    then I send an empty string to the shell so if there is more prompt I see all the outputted values.
    Does that help in any way?
    ThanksSorry I can't help.
    Bye

  • New Charset Encoder/Decoder for Microsoft telnet

    Hello,
    I have a problem for writing a server which is accessible by microsoft windows telnet.
    I have managed to find out these relationships:
              switch ((int) c) {
                   case -27: c = '�'; break;
                   case -28: c = '�'; break;
                   case -102: c = '�'; break;
                   case -103: c = '�'; break;
                   case -108: c = '�'; break;
                   case -114: c = '�'; break;
                   case -124: c = '�'; break;
                   case -127: c = '�'; break;
    So how could i write an encoder/decoder which could map these charcters specially and others as norma ISO-8859-1.
    I switched them after encoding/decoding but then i got problem, that
    i got two characters(in telnet window). First was some wierd symbol and second the right character.
    Any help lplease?

    Okay, got working the charset include and everything is okay.
    Now i need to look after charcodes below 0. I though that it would be useful to create new charset for this purpose which adds little extra functionality to IBM850. When running this code it says that IBM850 charset not found when initilizating X-MICRO charset. But it is accessible in main program. Any ideas what is wrong?... Please help me, this damn internationallization has driven me mad.
    package ee.feelfree.charset;
    import java.nio.charset.Charset;
    import java.nio.charset.spi.CharsetProvider;
    import java.util.HashSet;
    import java.util.Iterator;
    public class MicrosoftCharsetProvider extends CharsetProvider {
         private static final String CHARSET_NAME = "X-MICRO";
         private Charset micro = null;
         public MicrosoftCharsetProvider()
         this.micro = new MicrosoftCharset (CHARSET_NAME, new String [0]);
         public Iterator charsets() {
              HashSet set = new HashSet (1);
              set.add (micro);
              return (set.iterator());
         public Charset charsetForName (String charsetName) {
              if (charsetName.equalsIgnoreCase (CHARSET_NAME)) {
                   return (micro);
                   return (null);
    package ee.feelfree.charset;
    import java.nio.CharBuffer;
    import java.nio.charset.*;
    import java.nio.ByteBuffer;
    public class MicrosoftCharset extends Charset {
         private static final String BASE_CHARSET_NAME = "IBM850";
         Charset baseCharset;
         protected MicrosoftCharset(String canonical,String [] aliases) {
              super (canonical, aliases);
              baseCharset = Charset.forName(BASE_CHARSET_NAME);
         public CharsetEncoder newEncoder() {
              return new MicrosoftEncoder(this,baseCharset.newEncoder());
         public CharsetDecoder newDecoder() {
              return new MicrosoftDecoder(this,baseCharset.newDecoder());
         public boolean contains (Charset cs) {
              return false;
         private class MicrosoftEncoder extends CharsetEncoder {
              private CharsetEncoder baseEncoder;
              MicrosoftEncoder(Charset cs,CharsetEncoder baseEncoder) {
                   super(cs, baseEncoder.averageBytesPerChar(),
                             baseEncoder.maxBytesPerChar());
                   this.baseEncoder = baseEncoder;
              protected CoderResult encodeLoop (CharBuffer cb, ByteBuffer bb)
                   CharBuffer tmpcb = CharBuffer.allocate (cb.remaining());
                   while (cb.hasRemaining()) {
                   tmpcb.put (cb.get());
                   tmpcb.rewind();
                   baseEncoder.reset();
                   CoderResult cr = baseEncoder.encode (tmpcb, bb, true);
                   cb.position (cb.position() - tmpcb.remaining());
                   return (cr);
         private class MicrosoftDecoder extends CharsetDecoder
         private CharsetDecoder baseDecoder;
         private boolean microClient = false;
              MicrosoftDecoder (Charset cs, CharsetDecoder baseDecoder)
                   super (cs, baseDecoder.averageCharsPerByte(),
                   baseDecoder.maxCharsPerByte());
                   this.baseDecoder = baseDecoder;
              protected CoderResult decodeLoop (ByteBuffer bb, CharBuffer cb)
                   baseDecoder.reset();
                   CoderResult result = baseDecoder.decode (bb, cb, true);
                   myDecode (cb);
                   return (result);
              public boolean getClient() {
                   return microClient;
              private void myDecode(CharBuffer cb) {
                   microClient = false;
                   for (int pos = cb.position(); pos < cb.limit(); pos++) {
                        int c = (int) cb.get (pos);
                        if (c<0) microClient=true;
    }

  • Weird Encoding Decoding

    I have this small problem with this encoding/decoding class I made. The class takes a string and turns each character into another character. So 'a' would be an 'S' and b might be a '*'. Encoding and coding works fine but when I switch platform it doesn't. Like if I compile the jar on Mac, it won't work the same on Windows XP, and vice versa.
    Could this be because the ASCII are different on each platform? And also, all the ASCII characters are used.

    The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
    http://www.joelonsoftware.com/articles/Unicode.html

  • Conversion issue in encoding in PI

    Hi,
      I am having a problem in conversion issue for encoding. Let's have a detailed look into the scenario first.
    Scenario: SNC->PI (through Proxy)->MQ (through Receiver JMS adapter)->SeeBeyond (It's a middleware system).
                   Here from SNC, data are coming into PI as in UTF-8 encoding, whereas all the systems shown in the above flow are of ISO 8859_1 format. Hence UTF-8 needs to be converted into ISO 8859_1. PI does this conversion in Receiver JMS adapter. CCSID has been set to 00819 which is for ISO 8859_1 encoding. But the beginning of the xml, it remains still UTF-8, like below:-
      <?xml version="1.0" encoding="utf-8" ?>
    Whereas the content of the xml has already been converted into ISO 8859_1 by Receiver JMS adapter. Now let's see the problem now.
    Problem: After the data been passed in SeeBeyond, the mapping fails in SeeBeyond, since SeeBeyond tries to look at the XML tag from the beginning and it found it's in UTF-8 as per he tag above. Then it tries to map it in UTF-8 format whereas the content is in ISO 8859_1, so mapping fails in SeeBeyond. Please note, here allthe systems except SeeBeyond are just bypassing the data, no mapping been introduced in anywhere in the systems except SeeBeyond.
    Workaround: Is there any other chance where we can change the tag header from UTF-8 to ISO 8859_1 in Receiver JMS adapter itself in PI like this:-
    <?xml version="1.0" encoding="iso 8859_1" ?>
    This might resolve our problem I think. Any suggestions would be appreciated.
    Thanks and Regards
    Soumya

    Hi Stefan,
                Thanks for your reply. I have gone through the link you have specified. Ya, that's the other way to resolve that issue in that case. But here we have asked the receiver system (SeeBeyond) to change the encoding part in their mapping. Because changing the coding part in SeeBeyond is less time consuming than adding a new Bean in JMS adapter. Our problem got resolved by changing the mapping in Receiver end. Thanks anyway for your valuable reply.
    Thanks
    Soumya

  • How to encode/decode URLs ...

    Hello,
    I wanted to send an entire URL as parameter to a Stored Procedure.
    How can I encode/decode this URL?
    Thanks
    Madhav

    I don't know of an encoder, but IBM alphaWorks has a decoder:
    http://www.alphaworks.ibm.com/tech/mpeg-4

  • ASN.1 encoder/decoder

    Hi All,
    I have a asn.1 definition file.
    I need to encode/decode the a file with the help of the above definition file. I tried using JavaAsn1Compiler, this compiler fullfill all my requirments except the one GraphicString type is not supported in this compilier.
    Can any body suggest me a asn.1 encoder/decoder.
    Thanks in advance.
    Asif

    Pranitha wrote:
    We already used nokalva for OSS file parsing. From now onwards we dont want to use third party tools, is there any hand written code avialable for parsing an ASN.1 file using java.What part of my last reply did you not understand?
    The java API does not contain anything for ASN.
    Everything outside of the Java API would be consider third party.
    So either explain exactly what it is that you want without using the term "third party" or recognize that what you are asking does not exist.

  • For this issue Is there any solution in Standard solution or any Developmet

    Hello Friends,
    I have one issue that is
    When ever the forecast is release from DP to PPDS (Monthly - days) of a material quantities should be bucketed into Monthly bucketed quantities and split into day level ( e.g: Product1 1st week 1000ton, 3rd week  2000ton , when it releases system aggregates the quantities and depending upon the product profile and setup time it shold give me result as product1 -3000ton in day 1 and product2 --2000ton on day 2 ...so on) .Standard SAP APO release of Monthly forecast quantity to daily bucket is divided into 30 or 31 days and split the quantities equally( e.g: Product1 1st week 1000ton, 3rd week  2000ton , when it releases system aggregates the quantities and divides in 30 days in a month and split the quantities equally).
    For this issue Is there any solution in Standard SAP or any Developmet is required in APO-DP.
    Pl Through me some lights on me .
    Regards,
    sivaram76.

    Hi
    If you are using u201C/SAPAPO/MC90  for releasing the FCST , I think you can define different Planning Buckets Profiles according your requirement for example according your needs for disaggregation of your FCST. A planning buckets profile contains the periodicities or a subset of the periodicities that you defined in the storage buckets profile.
    Once you maintain the planning bucket profile you can put it in tab Daily Buckets Profile while releasing the FCST.
    It will be nice if you please cross check it its meet you requirement.
    Thanks
    Amol

  • Maintain the Issue track in SAP Solution Manager

    hi
    How to maintain issue track in SAP Solution Manager. give me description
    Thanks and Regards,
    YSR

    Hi YSR,
    In Solution Manager you must be having Project Template from which other Implementation or Support Projects can derive. In this Template project you can customize you own node or you can chood any extisting node to put the Issue Track in General Documentaion Tab.
    Thanks,
    Mandar

  • Invalid Session ID - cookie encode/decode

    Hello,
    I'm looking for the correct combination of cookie encode/decode parameters for my own setup.
    Machine am : AM Server 7.0 on WS6.1
    Machine amc : my own webapps using AM client SDK & protected by a Policy agent. 2.2 Everything within a WS6.1 container.
    After being redirected to AM, I obtain my iPlanetDirectoryPro cookie and my webapp can obtain a SSOToken using the SSOToken token = manager.createSSOToken(String) if obtain the String via Cookie accessor's method.
    No luck with SSOToken token = manager.createSSOToken(HttpServletRequest) which always gives a Invalid Session Id message. I know that this is an encoding problem but I tried many combinations & heard that these settings are not always well documented. I have at the moment :
    am server AMConfig.properties :
    com.iplanet.am.cookie.encode=false
    am client sdk AMConfig.properties :
    com.iplanet.am.cookie.encode=false
    policy agent AMAgent.properties :
    com.sun.identity.agents.config.sso.decode = false
    com.iplanet.am.cookie.encode = false
    Has somebody worked that out ?
    Thanks !
    nieuwenj

    Hi, am using this code:
    AMUtil.java
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import javax.security.auth.callback.Callback;
    import javax.security.auth.callback.ChoiceCallback;
    import javax.security.auth.callback.NameCallback;
    import javax.security.auth.callback.PasswordCallback;
    import javax.security.auth.callback.TextInputCallback;
    import javax.security.auth.callback.TextOutputCallback;
    import javax.security.auth.callback.UnsupportedCallbackException;
    import com.sun.identity.authentication.AuthContext;
    import com.sun.identity.authentication.spi.AuthLoginException;
    import com.iplanet.am.util.Debug;
    * @author hjimenez
    public class AMUtil {
        private String loginIndexName;
        private String orgName;
        private String user;
        private String password;
         * Creates a new instance of AMUtil
        public AMUtil(String loginIndexName, String orgName) {
            this.loginIndexName = loginIndexName;
            this.orgName = orgName;
        protected AuthContext getAuthContext()
        throws AuthLoginException, com.iplanet.sso.SSOException, Exception {
            AuthContext lc = new AuthContext(orgName);
            AuthContext.IndexType indexType = AuthContext.IndexType.MODULE_INSTANCE;
            lc.login(indexType, loginIndexName);
            debugMessage(loginIndexName + ": Se obtuvo login context");
            return lc;
        private void addLoginCallbackMessage(Callback[] callbacks)
        throws UnsupportedCallbackException {
            int i = 0;
            try {
                for (i = 0; i < callbacks.length; i++) {
                    if (callbacks[i] instanceof TextOutputCallback) {
                        handleTextOutputCallback((TextOutputCallback)callbacks);
    } else if (callbacks[i] instanceof NameCallback) {
    handleNameCallback((NameCallback)callbacks[i]);
    } else if (callbacks[i] instanceof PasswordCallback) {
    handlePasswordCallback((PasswordCallback)callbacks[i]);
    } else if (callbacks[i] instanceof TextInputCallback) {
    handleTextInputCallback((TextInputCallback)callbacks[i]);
    } else if (callbacks[i] instanceof ChoiceCallback) {
    handleChoiceCallback((ChoiceCallback)callbacks[i]);
    } catch (IOException e) {
    e.printStackTrace();
    throw new UnsupportedCallbackException(callbacks[i],e.getMessage());
    private void handleTextOutputCallback(TextOutputCallback toc) {
    debugMessage("Se ejecut� TextOutputCallback");
    // Mostrar mensaje de acuerdo al tipo especificado
    switch (toc.getMessageType()) {
    case TextOutputCallback.INFORMATION:
    debugMessage(toc.getMessage());
    break;
    case TextOutputCallback.ERROR:
    debugMessage("ERROR: " + toc.getMessage());
    break;
    case TextOutputCallback.WARNING:
    debugMessage("WARNING: " + toc.getMessage());
    break;
    default:
    debugMessage("Tipo de mensaje no soportaado: " +
    toc.getMessageType());
    private void handleNameCallback(NameCallback nc)
    throws IOException {
    // asignar usuario
    nc.setName(this.user);
    private void handleTextInputCallback(TextInputCallback tic)
    throws IOException {
    // poner un prompt para obtener datos
    System.out.print(tic.getPrompt());
    System.out.flush();
    tic.setText((new BufferedReader
    (new InputStreamReader(System.in))).readLine());
    private void handlePasswordCallback(PasswordCallback pc)
    throws IOException {
    // asignar password
    String passwd = this.password;
    pc.setPassword(passwd.toCharArray());
    private void handleChoiceCallback(ChoiceCallback cc)
    throws IOException {
    // ignorar el valor default dado
    System.out.print(cc.getPrompt());
    String[] strChoices = cc.getChoices();
    for (int j = 0; j < strChoices.length; j++) {
    System.out.print("choice[" + j + "] : " + strChoices[j]);
    System.out.flush();
    cc.setSelectedIndex(Integer.parseInt((new BufferedReader
    (new InputStreamReader(System.in))).readLine()));
    public boolean login(AuthContext lc)
    throws UnsupportedCallbackException {
    boolean succeed = false;
    Callback[] callbacks = null;
    // obtener informaci�n del m�dulo solicitada
    while (lc.hasMoreRequirements()) {
    callbacks = lc.getRequirements();
    if (callbacks != null) {
    addLoginCallbackMessage(callbacks);
    lc.submitRequirements(callbacks);
    if (lc.getStatus() == AuthContext.Status.SUCCESS) {
    System.out.println("Login exitoso.");
    succeed = true;
    } else if (lc.getStatus() == AuthContext.Status.FAILED) {
    System.out.println("Login fallo.");
    } else {
    System.out.println("Estatus desconocido: " + lc.getStatus());
    return succeed;
    public void logout(AuthContext lc)
    throws AuthLoginException {
    lc.logout();
    System.out.println("Log Out!!");
    static void debugMessage(String msg) {
    System.out.println(msg);
    public String getUser() {
    return user;
    public void setUser(String user) {
    this.user = user;
    public String getPassword() {
    return password;
    public void setPassword(String password) {
    this.password = password;
    and call it from:
    import com.iplanet.sso.SSOToken;
    import com.sun.identity.authentication.AuthContext;
    import com.sun.identity.authentication.spi.AuthLoginException;
    import javax.security.auth.callback.UnsupportedCallbackException;
    import com.iplanet.sso.SSOException;
    import java.net.InetAddress;
    * @author hjimenez
    public class TestLogin {
        /** Creates a new instance of TestLogin */
        public TestLogin() throws SSOException {
         * @param args the command line arguments
        public static void main(String[] args) {
            try {
                // arg0 = LDAP arg1 = tecnet
                AMUtil login = new AMUtil(args[0], args[1]);
                // arg2=usuario arg3=pass
                login.setUser(args[2]);
                login.setPassword(args[3]);
                AuthContext lc = login.getAuthContext();
                if (login.login(lc)) {
                    SSOToken token = lc.getSSOToken();
                    System.out.println("Token asignado: "+token.getTokenID().toString());
                    String host = token.getHostName();
                    java.security.Principal principal = token.getPrincipal();
                    String authType = token.getAuthType();
                    int level = token.getAuthLevel();
                    InetAddress ipAddress = token.getIPAddress();
                    long maxTime = token.getMaxSessionTime();
                    long idleTime = token.getIdleTime();
                    long maxIdleTime = token.getMaxIdleTime();
                    System.out.println("SSOToken host name: " + host);
                    System.out.println("SSOToken Principal name: " +
                            principal.getName());
                    System.out.println("Authentication type used: " + authType);
                    System.out.println("IPAddress of the host: " +
                            ipAddress.getHostAddress());   
                    login.logout(lc); 
            } catch (AuthLoginException e) {
                e.printStackTrace();
            } catch (UnsupportedCallbackException e) {
                e.printStackTrace();
            } catch (SSOException e) {
                e.printStackTrace();
            }  catch (Exception e) {
                e.printStackTrace();

  • HTML Encode/Decode FLEX

    Is anyone familiar with classes that support html
    encoding/decoding in AS3 or Flex?
    Similar to:
    http://meyerweb.com/eric/tools/dencoder/
    what is being done here?

    Most folks float an Iframe over a spot in the SWF.

  • Using PXI-5431and PXI-1411 to test MPEG-2 encoder/decoder

    I am looking into a way to test an MPEG-2 encoder/decoder.  I have found the PXI-5431, that can generate a NTSC signal which is what I need and the PXI-1411.  So, I guess my question is: would this be a good set up to use the 5431 to generate a signal and the 1411 to acquire the signal and do some comparisons to the two.  Has anyone done this type of testing?  What type of comparisons could be done to the two video signals to verify signal quality(I know very little about video signals)? Or maybe acquire using the PXI-5122?
    Thanks,
    Brian

    Hi BrianPack,
    I have some questions.  Please be much more detailed and specific in your next response.  Try not to use pronouns.  Instead, every time you want to use the word "it" or "card", instead use the proper names, such as the "PXI-5122".
    What card are you referring to in your first sentence?
    When you say (it) "can be configured to decode and encoded MPEG video", do you mean to say you are attempting to encode analog video?
    With all the MPEG encoding and decoding, which cards are you referring to?  Your two cards, or two NI modules?
    When you generate into the encoder, are you wanting to generate from the NI 5431?  If this is true, what video standard are you wanting to use?
    The Frequency Response, Video Resolution, SNR, and composite signal amplitude measurements should be available with the NI 5122 and MicroLEX VideoMaster.  I'm not sure about the NI 1411 because I only support NI's Modular Instruments, but here are the specification sheets for VideoMaster:
    http://www.microlex.dk/products/video/videomaster-component.pdf 
    If you want more information on the NI 1411, it would be best to post a message on the IMAQ/Vision forum.  For now, please respond with more specific information and I'll be happy to assist you!
    Chad Erickson
    Applications Engineer

  • Simple and very fast encoder-decoder

    I will explain my need with an example;
    www.domain.com/photo.jsp?id=23
    here id is 23 and people can try every photo by incresing or decreasing the id number. I want to encode the id's while printing the id to screen as url and will decode everytime when i get the request from user.
    So i need a very fast and simple logic of encode & decode. I have tested base64 at java but everyone knows the algortihm. Is there any other simple algorithm that i can generate on my own?
    What do you advice to me except changing my database and search with hex keys?

    believe me its strictly
    needed on a photo web site... there are too much
    reasons.I can't think of one.1)when ids are sequantial on db users can get the idea which after or before this photo is uploaded
    2)when you see the normal integer numbers on ids you can remember it easily and edit the link by hand and see whats going on...
    3)When u see user_id is=1 u can understand easily that he is an admin or one of the first member of website
    4)when u try the maximum photo id or user id every user can understand how many user or photos are there in website
    there are lots of things like above... They may be not that valueble for everyone but i think this have to be.

Maybe you are looking for

  • Not happy with moving around keys on the timeline

    I just changed from Final Cut to Premiere CS5.0 and I really like it. Working on a Macbook Pro i5 2.3GHZ, Mac OSX 10.7 But I am not happy with moving around on the timeline. I was used to using the up and down arrows to move to next video edit point,

  • Is it possible to do this in Motion?

    Hi..I recently watched a clip on YouTube and I was wondering if it was possible to do something like this in Motion? http://www.youtube.com/watch?v=N4jwfpCut9o The first one is at :25.  You see more of them throughout the video.  I'm think this is Af

  • SBS2003: disable Exchange Services

    We use SBS2003 with Exchange - SMTP for send, POP3 for receive. We want to stop the server from sending & receiving mail while we export user mailboxes/PSTs for the purpose of importing them into Exch 2013.  Is the best thing to do, in order to accom

  • Nokia 6020 strange problem

    my nokia 6020 has been indicating the headphone/handsfree icon. this means a call comes in i cannot hear the caller using the headset. I have tried restoring settings, remove battery, change profile but no change. interesting thing is I HAVE NEVER US

  • Can't change date format in Pages

    Normally you should be able to rightclick and select "Change date & time...", or doubbleclick on a inserted date to change its format. I have 2 Macs with Lion 10.7.2 and Pages where nothing happens everything is up to date. Language is Danish. Tried