SharedProperty.canUserEdit is always FALSE

im successfully creating a session like this:
_authenticator = new AdobeHSAuthenticator();
_authenticator.addEventListener(AuthenticationEvent.AUTHENTICATION_FAILURE, _onAuthenticationError);
_authenticator.addEventListener(AuthenticationEvent.AUTHENTICATION_SUCCESS, _onAuthenticationSuccess);
_connectSession = new ConnectSession();
_connectSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, _onConnectSessionSync);
_connectSession.roomManager.addEventListener(RoomManagerEvent.ROOM_STATE_CHANGE, _onConnectSessionRoomStateChange);
_connectSession.authenticator = _authenticator;
then once its sync'ed i'm doing this:
someProp = new SharedProperty();
someProp.sharedID = "sharedTranscriptID";
someProp.connectSession = _connectSession;
someProp.subscribe();
someProp.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, _onSomePropSync);
someProp.addEventListener(CollectionNodeEvent.MY_ROLE_CHANGE, _onSomePropCanEdit);
if (localUser.role == UserRoles.OWNER) someProp.allowUserToEdit(localUser.userID);
localUser is just the chat OWNER's UserDescription. it doesn't matter how many events i listen to or where or when i call:
_transcriptID.allowUserToEdit(localUser.userID);
the result is always the same: SharedProperty.canUserEdit is always FALSE.
i'm going to use a SharedCollection because i know i can just do 'addItemAt' and it'll just work, until/unless someone can suggest quite why SharedProperty.canUserEdit is always FALSE.

Hi,
Thanks for letting us know. This was indeed a bug on our side which I have fixed now, and it will be up updated in the next drop. If you are linking the source, these are the changes you need to do.
The functions that needs to be updated in SharedProperty are
         * Determines whether the specified user can edit the property.
         * @param p_userID The user to query regarding whether they can edit.
         public function canUserEdit(p_userID:String):Boolean
            return (_collectionNode.canUserPublish(p_userID,_nodeNameText));
         * Allows the current user with an owner role to grant the specified user
         * the ability to edit the property.
         * @param p_userID The userID of the user being granted editing privileges.
        public function allowUserToEdit(p_userID:String):void
            // If I can't configure, cancel.
            if(!_collectionNode.canUserConfigure(userManager.myUserID,_nodeNameText)){
                return;
            _collectionNode.setUserRole(p_userID, UserRoles.PUBLISHER, _nodeNameText);
Thanks again. We depend on your feedbacks for improving our framework.
Regards
Hironmay Basu

Similar Messages

  • IsCallerInRole(String Role) is always FALSE

    I have an ejb deployed on SunOne App Server 8.1 via an EAR file with a Web and EJB modules included. I call a session EJB bean from a client Servlet and able to envoke methods on the EJB. I can authenticate fine and can get the principal in the EJBContainer using getCallerPrincipal(). Now my problem is this, isCallerInRole(String Role) is always FALSE. My application descriptor files are follows. Any help on what I'm doing wrong is greatly appreciated.
    Sun-ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd">
    <sun-ejb-jar>
    <security-role-mapping>
    <role-name>consultant_role</role-name>
    <group-name>cn=Consultant,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>generic_role</role-name>
    <group-name>cn=Generic,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>designer_role</role-name>
    <group-name>cn=Designer,o=GROUPS</group-name>
    </security-role-mapping>
    <enterprise-beans/>
    </sun-ejb-jar>
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    <display-name>testapp-EJBModule</display-name>
    <enterprise-beans>
    <session>
    <display-name>UserManagementSB</display-name>
    <ejb-name>UserManagementBean</ejb-name>
    <local-home>aus.UserManagementLocalHome</local-home>
    <local>aus.UserManagementLocal</local>
    <ejb-class>aus.UserManagementBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <security-role-ref>
    <role-name>consultant_role</role-name>
    </security-role-ref>
    <security-role-ref>
    <role-name>generic_role</role-name>
    </security-role-ref>
    <security-role-ref>
    <role-name>designer_role</role-name>
    </security-role-ref>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <security-role>
    <role-name>consultant_role</role-name>
    </security-role>
    <security-role>
    <role-name>generic_role</role-name>
    </security-role>
    <security-role>
    <role-name>designer_role</role-name>
    </security-role>
    <container-transaction>
    <method>
    <ejb-name>UserManagementBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    application.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <application version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
    <display-name>testapp</display-name>
    <module>
    <web>
    <web-uri>testapp-WebModule.war</web-uri>
    <context-root>/testapp-WebModule</context-root>
    </web>
    </module>
    <module>
    <ejb>testapp-EJBModule.jar</ejb>
    </module>
    <security-role>
    <role-name>sysadmin_role</role-name>
    </security-role>
    <security-role>
    <role-name>consultant_role</role-name>
    </security-role>
    <security-role>
    <role-name>generic_role</role-name>
    </security-role>
    <security-role>
    <role-name>designer_role</role-name>
    </security-role>
    <security-role>
    <role-name>library_admin_role</role-name>
    </security-role>
    </application>
    sun-application.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-application PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.0 J2EE Application 1.4//EN" "http://www.sun.com/software/appserver/dtds/sun-application_1_4-0.dtd">
    <sun-application>
    <web>
    <web-uri>testapp-WebModule.war</web-uri>
    <context-root>/testapp-WebModule</context-root>
    </web>
    <security-role-mapping>
    <role-name>sysadmin_role</role-name>
    <group-name>cn=System_Admin,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>consultant_role</role-name>
    <group-name>cn=Consultant,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>generic_role</role-name>
    <group-name>cn=Generic,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>designer_role</role-name>
    <group-name>cn=Designer,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>library_admin_role</role-name>
    <group-name>cn=Library_Admin,o=GROUPS</group-name>
    </security-role-mapping>
    <realm>ldap</realm>
    </sun-application>
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    <servlet>
    <servlet-name>IsSecureServlet</servlet-name>
    <servlet-class>IsSecureServlet</servlet-class>
    </servlet>
    <servlet>
    <display-name>formauth</display-name>
    <servlet-name>formauth</servlet-name>
    <jsp-file>/index.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
    <servlet-name>IsSecureServlet</servlet-name>
    <url-pattern>/IsSecureServlet</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <error-page>
    <error-code>403</error-code>
    <location>/accessDenied.jsp</location>
    </error-page>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Protected Area</web-resource-name>
    <url-pattern>/admin/*</url-pattern>
    <http-method>PUT</http-method>
    <http-method>DELETE</http-method>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>sysadmin_role</role-name>
    <role-name>library_admin_role</role-name>
    </auth-constraint>
    </security-constraint>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Protected Area</web-resource-name>
    <url-pattern>/users/*</url-pattern>
    <http-method>PUT</http-method>
    <http-method>DELETE</http-method>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>consultant_role</role-name>
    <role-name>generic_role</role-name>
    <role-name>designer_role</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>ldap</realm-name>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/error.jsp</form-error-page>
    </form-login-config>
    </login-config>
    <security-role>
    <role-name>sysadmin_role</role-name>
    </security-role>
    <security-role>
    <role-name>consultant_role</role-name>
    </security-role>
    <security-role>
    <role-name>generic_role</role-name>
    </security-role>
    <security-role>
    <role-name>designer_role</role-name>
    </security-role>
    <security-role>
    <role-name>library_admin_role</role-name>
    </security-role>
    <ejb-local-ref>
    <ejb-ref-name>ejb/UserManagementBean</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>aus.UserManagementLocalHome</local-home>
    <local>aus.UserManagementLocal</local>
    <ejb-link>testapp-EJBModule.jar#UserManagementBean</ejb-link>
    </ejb-local-ref>
    </web-app>
    sun-web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-1.dtd">
    <sun-web-app error-url="">
    <context-root>/testapp-WebModule</context-root>
    <security-role-mapping>
    <role-name>sysadmin_role</role-name>
    <group-name>cn=System_Admin,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>consultant_role</role-name>
    <group-name>cn=Consultant,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>generic_role</role-name>
    <group-name>cn=Generic,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>designer_role</role-name>
    <group-name>cn=Designer,o=GROUPS</group-name>
    </security-role-mapping>
    <security-role-mapping>
    <role-name>library_admin_role</role-name>
    <group-name>cn=Library_Admin,o=GROUPS</group-name>
    </security-role-mapping>
    <class-loader delegate="true"/>
    <jsp-config>
    <property value="true" name="classdebuginfo">
    <description>Enable debug info compilation in the generated servlet class</description>
    </property>
    <property value="true" name="mappedfile">
    <description>Maintain a one-to-one correspondence between static content and the generated servlet class' java code</description>
    </property>
    </jsp-config>
    </sun-web-app>

    Hi,
    Thanks for letting us know. This was indeed a bug on our side which I have fixed now, and it will be up updated in the next drop. If you are linking the source, these are the changes you need to do.
    The functions that needs to be updated in SharedProperty are
             * Determines whether the specified user can edit the property.
             * @param p_userID The user to query regarding whether they can edit.
             public function canUserEdit(p_userID:String):Boolean
                return (_collectionNode.canUserPublish(p_userID,_nodeNameText));
             * Allows the current user with an owner role to grant the specified user
             * the ability to edit the property.
             * @param p_userID The userID of the user being granted editing privileges.
            public function allowUserToEdit(p_userID:String):void
                // If I can't configure, cancel.
                if(!_collectionNode.canUserConfigure(userManager.myUserID,_nodeNameText)){
                    return;
                _collectionNode.setUserRole(p_userID, UserRoles.PUBLISHER, _nodeNameText);
    Thanks again. We depend on your feedbacks for improving our framework.
    Regards
    Hironmay Basu

  • File exists always false

    I'm making a mobile app for iOS and I have files in both the applicationDirectory (inside the app) and the cacheDirectory.
    No matter what I do a check on file.exists always returns false even though it is there - it's a video and it can play so it's there alright.
    What is going on?
    I have a string representing the path eg. "/assets/video.mp4"
    var f:File = File.applicationDirectory.resolvePath(filePath);
    trace(f.exists) //false

    When I trace the nativePath of the file I am trying to find it shows "C:\Users\User\AppData\Roaming\Arakaron.debug\Local Store". This is the exact path I am following in Explorer. Now, instead of applicationStorageDirectory I can do documentsDirectory and it reads that the file is in fact there. With the applicationStorageDirectory it only registers that the file exists after I copy from the embedded db file. 

  • ItemPressed Event ActionSuccess is always false when in Add Mode

    Hi experts,
    i have a question regarding the ActionSuccess property in the ItemPressed Event.
    When working with a UserForm and an Ok Button (ID = 1) then the ActionSuccess never gets true when pressing the Button when the UserForm is in Add-Mode.
    Is this normal behaviour or a bug?
    Thank you for your help
    Matthias

    Hi Edy,
    yes, the form was in add mode.
    I'm in the ItemPressed Event, BeforeAction=true.
    There the addon does it's work and after that I set the FormMode to OK.
    This closes the form!
    Why I'm in BeforeAction=true? Because i have to know if the form is in add mode or in update mode, because I do different things regarding to the form mode.
    @Eric:
    That's halfway true. B1 sets the FormMode to OK when the form was in update mode, but not, when the form was in the add mode.
    Thank you
    Matthias

  • New AFCS Build Posted!

    As usual, let us know if you have any comments, questions or bugs. We'll be answering more of the backlog of questions now that we can come up for air =). Log into https://afcs.acrobat.com to get the latest.
    Version 0.93
    We're still primarily focused on e-commerce, but wanted to release another drop with some of the stuff we've been working on.
    What's new in this Release?
       * A new AIR app package for the SDK! Features:
             * Video Tutorials (updated as we add more)
             * Running sample apps
             * Auto-Update when the SDK changes
             * Consolidation of the Developer Tools (Room Console and Local Connection Server), only 1 app to run now.
             * Improved Navigation of the SDK
             * The introduction of our new Logo
       * A new, Flex-free version of the SWC, Source code, and ASDocs. Run in Flash CS4, or as an ActionScript Project. Total compiled size : 55KB. You won't get any UI, but full connectivity including classes for Data, Audio, Video, and File sharing are supported.
       * A new shared model type : SharedObject. Acts as a simple unordered key-value hash. Helpful in migrating FMS projects, but with permissions and storage features.
       * More work in the Developer Guide, including a Tutorial chapter.
       * A new package com.adobe.coreUI.controls.whiteboardClasses.shapeDescriptors consisting of the following descriptor classes
             * WBArrowShapeDescriptor    -  Descriptor class for a Arrow shape
             * WBEllipseShapeDescriptor    - Descriptor class for Ellipse shape
             * WBHighlightAreaShapeDescriptor    - Descriptor class for HighlightArea Shapes
             * WBLineShapeDescriptor    - Descriptor class for a Line shape
             * WBMarkerShapeDescriptor    - Descriptor class for a Highlighter/Marker pen shape
             * WBRectangleShapeDescriptor    - Descriptor class for Rectangle Shape
             * WBRoundedRectangleShapeDescriptor    - Descriptor class for Rounded Rectangle Shapes
             * WBTextShapeDescriptor    - Descriptor class for a Text-Area Shape
       * New APIs in the WhiteBoardModel allowing devs programatic access to the WBShapes
       * New Example for manipulating the WhiteBoardModel programmatically.
       * Moved SimpleChatModel to the shared models directory, as it can be used independently of the SimpleChat pod.
       * Fixes to UserManager to ensure CustomUserFields don't get overwritten
       * Fixed SharedProperty.canUserEdit  (was always reporting false)
       * Added SharedProperty.updateInterval. Defaults to 0, meaning updates are sent immediately. Can be used to batch updates.
       * Fixed a bug where the roster would throw an exception on lost connection
       * Fixed a bug where SimpleChatPod would throw an exception when built in Flex 4.
       * File Share pod UI bug fixes (3)
       * Tons of other small bug fixes.
    What's next?
        * Working on HTTP/Remoting APIs.
        * More long-term work on e-commerce enablement
        * More responses to your requests!

    So now we have better Struts modules support. If I look through the forum, I still see people are having trouble with modules. The BEA demos don't show applications with multiple modules.
    What's the current status of this?

  • PartialPageUtils.isPartialRequest(fctx) always return false

    Hi All ,
    I am using Jdeveloper 11g and i can't solve the problem with getting always false from
    PartialPageUtils.isPartialRequest(fctx);
    If i use partialSubmit="true" PartialPageUtils.isPartialRequest(fctx) return false.
    If i don't use partialSubmit PartialPageUtils.isPartialRequest(fctx) return false.
    Could you please give me a solution.
    Thanks in advance,
    JavaDeveLoper

    Hi Mr. Frank Nimphius
    I have a creation form with 7 input text fields. 3 of them are required fields.
    These 3 fields have valueChangeListener , validator and autoSubmit="true".
    The problem is that when i enter info in field 1 and tab to the next field after passing the validator for field1 i get error message, because i've entered nothing in the other required fields.
    Also i've ovveride public void validateModelUpdates(LifecycleContext lifecycleContext) {...}
    public void validateModelUpdates(LifecycleContext lifecycleContext) {
    FacesContext fctx = FacesContext.getCurrentInstance();
    boolean isPPR = PartialPageUtils.isPartialRequest(fctx);
    if (isPPR) {
    System.out.println("No Refresh");
    } else {
    super.validateModelUpdates(lifecycleContext);
    This method always return false.

  • Boolean.getBoolean(String str) always return false

    I'm on macOSX (Tiger), using JSDK 1.5.
    The function Boolean.getBoolean() return always false.
    I try Boolean.getBoolean("true");
    Boolean.getBoolean(Boolean.toString(Boolean.TRUE));
    always false.
    Is it a bug only on macOS, or does I do something wrong?
    so i just made mybooleanVar.equals("true"); done the right result, but it's just strange that the Boolean.getBoolean(...) function did not return the right value... And I can't send this bug to sun, because they don't assure support for macOSX platform... :s

    Yeah, some of the the least intuitive methods in the
    API are this one and its equivalents from the other
    basic type wrapper classes. Confusingly named methods
    in the wrong classes (they should have placed those
    methods in System, if anywhere at all).My vote goes to not anywhere at all.
    Boolean.getBoolean("property");is equivalent to
    Boolean.parseBoolean(System.getProperty("property"));Not worth a method for the saved keystrokes vs the problem in readability. Especially a misnamed method.

  • Campus Manager User Tracking Report - dot1xEnabled = False

    The Campus Manager User Tracking Report has the dot1xEnabled field that is always false.
    It was my understanding that the switch will send SNMP Trap Notifications to Cisco Works regarding the status of 802.1x authentication per port.
    We have configured per port:
    snmp trap mac-notification added
    snmp trap mac-notification removed
    and globally
    snmp-server host x.x.x.x  abababa udp-port 1431 MAC-Notification
    With no success, so we opened a TAC case, 614376387 and we were told by TAC and the Development Engineers that this "feature" does not work in LMS 3.2 and Campus Manager 5.2.1 and that this feature will be available in the next new release.
    I thought I had read on this forum that some folks have this 'feature' working, where this field shows the current status of 802.1x per access port.
    Has anyone been able to get this 'feature' to work?  And if so, what versions are you running and what were the 'tricks' to get it working?
    Much appreciated.

    The MAC address notification traps only alert Campus to the fact that a MAC address has been learned or removed from a given port.  That starts the dynamic UT process.  With no other information, you will potentially see a new record appear in UT shortly after receiving the trap.  However, that record will not have IP or username data associated with it.
    To get the IP data, Campus will poll the CISCO-DHCP-SNOOPING-MIB to pull IP data.  To get username data, Campus will poll the IEEE8021-PAE-MIB of the switch to get dot1x information.  So, your switch must be configured for dot1x, and it must support this MIB (in particular, the objects dot1xAuthSessionTime, dot1xAuthSessionUserName, and dot1xPaePortCapabilities).
    Without dot1x, hope is not lost.  If the end host is running Windows and the UTLite tool, then when the user logs in, UTLite should start from their logon script, and send a UDP update to Campus with the username and IP of the host.

  • How does a BOOLE var. works in a true/false step?

    Hi experts, i am breaking my brain with a simple question, i guess if somebody can give me some light about this...
    I have a BOOLE variable defined in the worflow named RECH_PARC_ES_TOTAL.
    Before going to the true false step i execute this abap:
    DATA: RECH_PARC_ES_TOTAL TYPE BOOLE.                             
    RECH_PARC_ES_TOTAL = 'X'.                                        
    swc_set_element container 'RECH_PARC_ES_TOTAL' RECH_PARC_ES_TOTAL.
    The condition in the true/False step is : &RECH_PARC_ES_TOTAL& u2260
    And it is always false.
    How is tis possible?
    Tank you very much,
    Artur.
    Edited by: Artur Rodriguez Coma on Jan 11, 2010 5:12 PM

    Hi,
    Are there bindings between wf, task and method RECH_PARC_ES_TOTAL variable?
    Also, try with condition &RECH_PARC_ES_TOTAL& EX.
    Synchronize runtime buffer with tcode SWU_OBUF.
    Regards,

  • Using unmanaged ctAPI Library always get wrong results

    Hi, My code is as below:
    public void Init()
    IntPtr hCTAPI = CTAPI.ctOpen(null, "u1", "1", 2);
    TestMe(hCTAPI);
    [DllImport(@"C:\Program Files (x86)\Schneider Electric\Vijeo Citect 7.10\Bin\ctapi.dll", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
    public static extern IntPtr ctOpen(string sComputerName, string sUsername, string sPassword, UInt32 nMode);
    [DllImport(@"C:\Program Files (x86)\Schneider Electric\Vijeo Citect 7.10\Bin\ctapi.dll", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
    public static extern bool ctTagRead(IntPtr hCTAPI, [MarshalAs(UnmanagedType.LPStr)] string tag, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder value,
    int length);
    public static void TestMe(IntPtr ip)
    var tag = "tag1";
    var tagPtr =
    Marshal.StringToHGlobalAnsi(tag);
    System.Text.StringBuilder vsl = new StringBuilder(20);
    bool b = ctTagRead(ip, tag, vsl, 20);//, tagValueItemsPtr);
    signature of ctTagRead is as below:
    extern    BOOL    CTAPICALL    ctTagRead(HANDLE,LPCSTR,LPSTR,DWORD);
    bool b is always false. I dont know what to do!
    EDIT:
    I used GetLastError Function and I found out there is a "No connection could be made because the target machine actively refused it" error. but I am trying to connect to citect on my own computer which has an installed and working citect on it.

    Hi, My code is as below:
    public void Init()
    IntPtr hCTAPI = CTAPI.ctOpen(null, "u1", "1", 2);
    TestMe(hCTAPI);
    [DllImport(@"C:\Program Files (x86)\Schneider Electric\Vijeo Citect 7.10\Bin\ctapi.dll", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
    public static extern IntPtr ctOpen(string sComputerName, string sUsername, string sPassword, UInt32 nMode);
    [DllImport(@"C:\Program Files (x86)\Schneider Electric\Vijeo Citect 7.10\Bin\ctapi.dll", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
    public static extern bool ctTagRead(IntPtr hCTAPI, [MarshalAs(UnmanagedType.LPStr)] string tag, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder value,
    int length);
    public static void TestMe(IntPtr ip)
    var tag = "tag1";
    var tagPtr =
    Marshal.StringToHGlobalAnsi(tag);
    System.Text.StringBuilder vsl = new StringBuilder(20);
    bool b = ctTagRead(ip, tag, vsl, 20);//, tagValueItemsPtr);
    signature of ctTagRead is as below:
    extern    BOOL    CTAPICALL    ctTagRead(HANDLE,LPCSTR,LPSTR,DWORD);
    bool b is always false. I dont know what to do!
    EDIT:
    I used GetLastError Function and I found out there is a "No connection could be made because the target machine actively refused it" error. but I am trying to connect to citect on my own computer which has an installed and working citect on it.
    what happens if you use "localhost" as the machine name rather than the loopback IP address?
    Cap'n

  • Why string compare is false?

    Hello,
    I've been confused for a while, could you mind helping?
    This small code compare two strings, not know why but always false.
    ==
    String date_zero = "0000-00-00";
    out.println("cs is "+date_claim_set); // print "cs is 0000-00-00" on screen
    out.println("result is "+date_claim_set.equals(date_zero)); // print "result is false" on screen
    if ( ! date_claim_set.equals(date_zero) ) {
    out.println("strings not equal"); // printed
    ==
    why the two strings are not equal?
    Hope you can help, thanks in advance.
    Rgds, Dove

    masijade. wrote:
    Well, most of his questions lately, have been about MySQL, and "0000-00-00" is the way that MySQL (per default) represents invalid dates, and "YYYY-MM-DD" is the toString() pattern for a java.sql.Date instance. ;-)Sorry for keeping your guys waiting, but I've spent sometimes for reading more material as I can. Now the problem fixed.
    The solution is liked this.
    1) MySQL document said '0000-00-00' is a valid value for date in DB, but a wrong value for JDBC.
    Detail:
    http://dev.mysql.com/doc/refman/5.0/en/connector-j-installing-upgrading.html#connector-j-installing-upgrading-3-0-to-3-1
    2) It is recognized as a problem, so it has been fixed. Instead of using old JDBC Connector/J, new version with re-configuration of zeroDateTimeBehavior can solve.
    I configure it to convertToNull, so in Java I see all value 0000-00-00 from DB as null, works fine.
    Many thanks the ideas from all of you.
    Rgds, Dove

  • When "ab".equals("ab") returns false

    One thing that really ticks me off in java is the narrow-mindedness of equals. Given the specifications laid out in Object.equals(), it becomes extremely tricky to ever have equals return true for comparison of Objects of different types.
    "So what?" You say. Well, back to the original title of this topic, it is possible for ab to not equal ab in the following cases.
    String ab = "ab";
    StringBuffer buffer = new StringBuffer(ab);
    char[] buf2 = new char[] {'a','b'}
    ab.equals(buffer) == always false
    buffer.equals(ab) == always false
    ab.equals(buf2) == always false
    buf2.equals(ab) == always false
    I could see how you probably couldn't and shouldn't make a String equal to a character array, but what about a StringBuffer??? I mean, come on! No one's going to try to compare a stringbuffer to a string or vice versa and get frustrated when it doesn't work?
    "Well," perhaps you are saying to yourself, "perhaps those that don't understand the way java is implemented could fall into that trap". While you are considering this thought, download the jdk1.5 source code and have a look at java.text.ChoiceFormat, especially applyPattern and how it uses equals

    One thing that really ticks me off in java is the
    narrow-mindedness of equals. Given the specifications
    laid out in Object.equals(), it becomes extremely
    tricky to ever have equals return true for comparison
    of Objects of different types.
    the equals method in the object class does the same thing as == does, meaning only when you are comparing the same object, it returns true. it is meant to be overridden in subclasses for real situations.
    "So what?" You say. Well, back to the original title
    of this topic, it is possible for ab to not equal ab
    in the following cases.
    the title is misleading, "ab" will always equals to "ab". the following is a different matter:
    String ab = "ab";
    StringBuffer buffer = new StringBuffer(ab);
    char[] buf2 = new char[] {'a','b'}
    ab.equals(buffer) == always falsethe equals implementation will return true only two objects are of string type. stringbuffer is not, so it will always return false.
    buffer.equals(ab) == always falsestringbuffer does no have its own implementation of the equals method, it uses the one in the object class, which will return true if you are comparing the same object, only if == is true, equals will be true. here it is apparently not the xase, so it will reuturn false always.
    ab.equals(buf2) == always false
    buf2.equals(ab) == always false
    see above.
    I could see how you probably couldn't and shouldn't
    make a String equal to a character array, but what
    about a StringBuffer??? I mean, come on! No one's
    going to try to compare a stringbuffer to a string or
    vice versa and get frustrated when it doesn't work?
    see above.
    considering this thought, download the jdk1.5 source
    code and have a look at java.text.ChoiceFormat,
    especially applyPattern and how it uses equalsi dont see any difference in 1.5, as comapred to 1.4. you were probabally not so careful, as i saw in the src a line labled as "tempBuffer", but it was actually a string.

  • A trouble with "LIKE" in a select statement

    Hi!
    I'm having trouble with "LIKE" in a select statement...
    With Access I can make the following and everything works well:
    SELECT name, birthday
    FROM client
    WHERE birthday LIKE '*/02/*';
    but if try to do it in my application (it uses Access), it doesn't work - I just can't understand that!!!
    In my application the "month" is always the currently month taken from the "System". Look what I'm doing...
    String query1 = "SELECT name, birthday " +
              "FROM client " +
              "WHERE birthday " +
              "LIKE '*/" +
              pMonth +
              "/*' " +
              "ORDER BY birthday ASC ";
    ResultSet rs = statement1.executeQuery(consulta1);
    boolean moreRecords = rs.next();
    The variable "moreRecords" is always "false", the query returns nothing although the table "client" has records that attend the query.
    Please, anyone can help me?! It's a little bit urgent.
    Thanks,
    Katia.

    Hi Katia,
    I'll bet the problem lies with the characters you're using to escape the LIKE clause. You're using the ones that Access likes to see, but that's not necessarily what's built into the JDBC-ODBC driver class.
    You can find out what the correct escape wildcard characters are from the java.sql.DatabaseMetaData.getSearchStringEscape() method. It'll tell you what to use in the LIKE clause.
    I'm not 100% sure about your code. It doesn't use query1 anywhere. I'd do this:
    String query = "SELECT name, birthday FROM client WHERE birthday LIKE ? ORDER BY birthday ASC";
    PreparedStatement statement = connection.createStatement(query);
    String escape = connection.getMetaData().getSearchStringEscape();
    String test = escape + '/' + pMonth + '/' + escape;
    statement.setString(1, test);
    ResultSet rs = statement.executeQuery();
    while (rs.hasNext())
    // load your data into a data structure to pass back.
    rs.close();
    statement.close();Let me know if that works. - MOD

  • What is the difference between exists and in

    hi all
    if i have these queries
    1- select ename from emp where ename in ( select ename from emp where empno=10)
    and
    2- select ename from emp where exists ( select ename from emp where empno=10)
    what is the difference between exists and in is that only when i use in i have to bring the field name or what.... i mean in a complex SQL queries is it will give the same answer
    Thanks

    You get two entirely different result sets that may be the same. Haah! What do I mean by that.
    SQL> select table_name from user_tables;
    TABLE_NAME
    BAR
    FOO
    2 rows selected.
    SQL> select table_name from user_tables where table_name in (select table_name from user_tables where table_name = 'FOO');
    TABLE_NAME
    FOO
    1 row selected.
    SQL> select table_name from user_tables where exists(select table_name from user_tables where table_name = 'FOO');
    TABLE_NAME
    BAR
    FOO
    2 rows selected.So, why is this? the WHERE EXISTS means 'if the next is true', much like where 1=1 being always true and 1=2 being always false. In this case, where exists could be TRUE or FALSE, depending on the subquery.
    WHERE EXISTS can be useful for something like testing if we have data, without actually having to return columns.
    So, if you want to see if an employee exists you might say
    SELECT 1 FROM DUAL WHERE EXISTS( select * from emp where empid = 10);
    If there is a row in emp for empid=10, then you get back 1 from dual;
    This is what I call an 'optimistic' lookup because the WHERE EXISTS ends as soon as there is a hit. It does not care how many - only that at least one exists. It is optimistic because it will continue processing the table lookup until either it hits or reaches the end of the table - for a non-indexed query.

  • NULL IS NOT NULL filter issue

    Can someone explain why 'Y' = 'N' is not working with PARALLEL Plan? i.e. With the filter like 'Y' = 'N' specified and if PQ is used , it does not return instantly. In fact it reads the entire table.
    Here is the test case.. Goal is to execute only one of the SQL joined by union all. I have included 'Y' = 'N' in both SQLs for the test purpose.
    DB Version is 10.2.0.4
    Create table test_tbl_01 nologging as select do.* from dba_objects do , dba_objects d1 where rownum < 22000001;
    Create table test_tbl_02 nologging as select do.* from dba_objects do , dba_objects d1 where rownum < 22000001;
    execute DBMS_STATS.GATHER_TABLE_STATS('SCOTT', 'TEST_TBL_01');
    execute DBMS_STATS.GATHER_TABLE_STATS('SCOTT', 'TEST_TBL_02');
    *Serial path with 2 table join*
    SQL> select
      2    /* parallel(t1,2 ) parallel(t2,2) */
      3    t1.*
      4    from test_tbl_01 t1 ,test_tbl_02 t2
      5    where t1.object_name = t2.object_name
      6    and  'Y' = 'N'
      7    and  t1.object_type = 'TABLE'
      8    union all
      9    select
    10    /* parallel(t1,2 ) parallel(t2,2) */
    11    t1.*
    12    from test_tbl_01 t1 ,test_tbl_02 t2
    13    where t1.object_name = t2.object_name
    14    and  'Y' = 'N'
    15  /
    no rows selected
    Elapsed: 00:00:00.01
    Execution Plan
    Plan hash value: 3500703583
    | Id  | Operation            | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |             |     2 |   168 |       |     0   (0)|          |
    |   1 |  UNION-ALL           |             |       |       |       |            |          |
    |*  2 |   FILTER             |             |       |       |       |            |          |
    |*  3 |    HASH JOIN         |             |   660G|    50T|   449M|  6242K (99)| 24:16:38 |
    |*  4 |     TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M|       | 41261   (2)| 00:09:38 |
    |   5 |     TABLE ACCESS FULL| TEST_TBL_02 |    22M|   212M|       | 40933   (2)| 00:09:34 |
    |*  6 |   FILTER             |             |       |       |       |            |          |
    |*  7 |    HASH JOIN         |             |  2640G|   201T|   467M|    24M(100)| 95:54:53 |
    |   8 |     TABLE ACCESS FULL| TEST_TBL_02 |    22M|   212M|       | 40933   (2)| 00:09:34 |
    |   9 |     TABLE ACCESS FULL| TEST_TBL_01 |    21M|  1546M|       | 41373   (3)| 00:09:40 |
    Predicate Information (identified by operation id):
       2 - filter(NULL IS NOT NULL)
       3 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
       4 - filter("T1"."OBJECT_TYPE"='TABLE')
       6 - filter(NULL IS NOT NULL)
       7 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
    Statistics
              1  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processed
    *Parallel path with 2 table join*
    SQL> select
      2    /*+ parallel(t1,2 ) parallel(t2,2) */
      3    t1.*
      4    from test_tbl_01 t1 ,test_tbl_02 t2
      5    where t1.object_name = t2.object_name
      6    and  'Y' = 'N'
      7    and  t1.object_type = 'TABLE'
      8    union all
      9    select
    10    /*+ parallel(t1,2 ) parallel(t2,2) */
    11    t1.*
    12    from test_tbl_01 t1 ,test_tbl_02 t2
    13    where t1.object_name = t2.object_name
    14    and  'Y' = 'N'
    15  /
    no rows selected
    Elapsed: 00:01:09.34
    Execution Plan
    Plan hash value: 1557722279
    | Id  | Operation                   | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT            |             |     2 |   168 |       |     0   (0)|          |     |         |            |
    |   1 |  PX COORDINATOR             |             |       |       |       |            |          |     |         |            |
    |   2 |   PX SEND QC (RANDOM)       | :TQ10004    |       |       |       |            |          |  Q1,04 | P->S | QC (RAND)  |
    |   3 |    BUFFER SORT              |             |     2 |   168 |       |            |          |  Q1,04 | PCWP |            |
    |   4 |     UNION-ALL               |             |       |       |       |            |          |  Q1,04 | PCWP |            |
    |*  5 |      FILTER                 |             |       |       |       |            |          |  Q1,04 | PCWC |            |
    |*  6 |       HASH JOIN             |             |   660G|    50T|   224M|  3465K (99)| 13:28:42 |  Q1,04 | PCWP |            |
    |   7 |        PX JOIN FILTER CREATE| :BF0000     |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,04 | PCWP |            |
    |   8 |         PX RECEIVE          |             |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,04 | PCWP |            |
    |   9 |          PX SEND HASH       | :TQ10000    |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,00 | P->P | HASH       |
    |  10 |           PX BLOCK ITERATOR |             |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,00 | PCWC |            |
    |* 11 |            TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,00 | PCWP |            |
    |  12 |        PX RECEIVE           |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,04 | PCWP |            |
    |  13 |         PX SEND HASH        | :TQ10001    |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | P->P | HASH       |
    |  14 |          PX JOIN FILTER USE | :BF0000     |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | PCWP |            |
    |  15 |           PX BLOCK ITERATOR |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | PCWC |            |
    |  16 |            TABLE ACCESS FULL| TEST_TBL_02 |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | PCWP |            |
    |* 17 |      FILTER                 |             |       |       |       |            |          |  Q1,04 | PCWC |            |
    |* 18 |       HASH JOIN             |             |  2640G|   201T|   233M|    13M(100)| 53:15:52 |  Q1,04 | PCWP |            |
    |  19 |        PX RECEIVE           |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,04 | PCWP |            |
    |  20 |         PX SEND HASH        | :TQ10002    |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,02 | P->P | HASH       |
    |  21 |          PX BLOCK ITERATOR  |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,02 | PCWC |            |
    |  22 |           TABLE ACCESS FULL | TEST_TBL_02 |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,02 | PCWP |            |
    |  23 |        PX RECEIVE           |             |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,04 | PCWP |            |
    |  24 |         PX SEND HASH        | :TQ10003    |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,03 | P->P | HASH       |
    |  25 |          PX BLOCK ITERATOR  |             |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,03 | PCWC |            |
    |  26 |           TABLE ACCESS FULL | TEST_TBL_01 |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,03 | PCWP |            |
    Predicate Information (identified by operation id):
       5 - filter(NULL IS NOT NULL)
       6 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
      11 - filter("T1"."OBJECT_TYPE"='TABLE')
      17 - filter(NULL IS NOT NULL)
      18 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
    Statistics
           1617  recursive calls
              3  db block gets
         488929  consistent gets
         493407  physical reads
            636  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              6  sorts (memory)
              0  sorts (disk)
              0  rows processedHowever single table with UNION ALL and PQ works..
    *NO Joins (i.e. Single Table with PQ )  , Issue does not show-up.*
    _*SERIAL PLAN with one Table*_
    SQL> select
      2    /* parallel(t1,2 )   */
      3    t1.*
      4    from test_tbl_01 t1
      5    where 'Y' = 'N'
      6    and  t1.object_type = 'TABLE'
      7    union all
      8    select
      9    /* parallel(t1,2 )   */
    10    t1.*
    11    from test_tbl_01 t1
    12    where 'Y' = 'N'
    13  /
    no rows selected
    Elapsed: 00:00:00.01
    Execution Plan
    Plan hash value: 2870519681
    | Id  | Operation           | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |             |     2 |   148 |     0   (0)|          |
    |   1 |  UNION-ALL          |             |       |       |            |          |
    |*  2 |   FILTER            |             |       |       |            |          |
    |*  3 |    TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M| 41261   (2)| 00:09:38 |
    |*  4 |   FILTER            |             |       |       |            |          |
    |   5 |    TABLE ACCESS FULL| TEST_TBL_01 |    21M|  1546M| 41373   (3)| 00:09:40 |
    Predicate Information (identified by operation id):
       2 - filter(NULL IS NOT NULL)
       3 - filter("T1"."OBJECT_TYPE"='TABLE')
       4 - filter(NULL IS NOT NULL)
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processed
    _*PARALLEL PLAN with one Table*_
    SQL> select
      2    /*+ parallel(t1,2 )      */
      3    t1.*
      4    from test_tbl_01 t1
      5    where 'Y' = 'N'
      6    and  t1.object_type = 'TABLE'
      7    union all
      8    select
      9    /*+ parallel(t1,2 )      */
    10    t1.*
    11    from test_tbl_01 t1
    12    where 'Y' = 'N'
    13  /
    no rows selected
    Elapsed: 00:00:00.09
    Execution Plan
    Plan hash value: 3114025180
    | Id  | Operation              | Name        | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT       |             |     2 |   148 |     0   (0)|          |        |      |            |
    |   1 |  PX COORDINATOR        |             |       |       |            |          |        |      |            |
    |   2 |   PX SEND QC (RANDOM)  | :TQ10000    |       |       |            |          |  Q1,00 | P->S | QC (RAND)  |
    |   3 |    UNION-ALL           |             |       |       |            |          |  Q1,00 | PCWP |            |
    |*  4 |     FILTER             |             |       |       |            |          |  Q1,00 | PCWC |            |
    |   5 |      PX BLOCK ITERATOR |             |  5477K|   386M| 22861   (2)| 00:05:21 |  Q1,00 | PCWC |            |
    |*  6 |       TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M| 22861   (2)| 00:05:21 |  Q1,00 | PCWP |            |
    |*  7 |     FILTER             |             |       |       |            |          |  Q1,00 | PCWC |            |
    |   8 |      PX BLOCK ITERATOR |             |    21M|  1546M| 22924   (2)| 00:05:21 |  Q1,00 | PCWC |            |
    |   9 |       TABLE ACCESS FULL| TEST_TBL_01 |    21M|  1546M| 22924   (2)| 00:05:21 |  Q1,00 | PCWP |            |
    Predicate Information (identified by operation id):
       4 - filter(NULL IS NOT NULL)
       6 - filter("T1"."OBJECT_TYPE"='TABLE')
       7 - filter(NULL IS NOT NULL)
    Statistics
             28  recursive calls
              3  db block gets
              7  consistent gets
              0  physical reads
            628  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              2  sorts (memory)
              0  sorts (disk)
              0  rows processed

    The same behvious appears in 11.1.0.6, and you don't need such a large data set to prove the point. The paralllel distribution may change to a broadcast with a smaller data set, but I demonstrated the effect when my two tables simply selected 30,000 rows each from all_objects.
    I think you should pass this to Oracle Corp. as a bug - using the smaller data set.
    The problem seems to be the way that Oracle combines multiple lines of a plan into groups of operations (as in PCWC, PCWC, PCWP). It looks like this particularly example has managed to fold the FILTER into a group in such a way that Oracle has lost track of the fact that it is a 'pre-emptng - i.e. always false' filter rather than an ordinary data filter; consequently the filter doesn't apply until after the hash join starts running.
    In my example (which did a broadcast distribution) I could see that Oracle read the entire first table, then started to read the second table, but stopped after one row of the second table, because my plan allowed the join and filter to be applied immediately after the first row from the second table. And I think Oracle decided that the filter was alway going to be false at that moment - so stopped running the second tablescan. You've used a hash/hash distribriution, which has resulted in both scans completing because the slaves in each layer don't talk to each other.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan

Maybe you are looking for