C++博客-天下 http://598club.com/aaxron/??????????????? zh-cnFri, 21 Feb 2020 10:12:16 GMTFri, 21 Feb 2020 10:12:16 GMT60C++博客-天下 http://598club.com/aaxron/archive/2020/01/01/217053.html??????????Wed, 01 Jan 2020 05:47:00 GMThttp://598club.com/aaxron/archive/2020/01/01/217053.htmlhttp://598club.com/aaxron/comments/217053.htmlhttp://598club.com/aaxron/archive/2020/01/01/217053.html#Feedback0http://598club.com/aaxron/comments/commentRss/217053.htmlhttp://598club.com/aaxron/services/trackbacks/217053.htmlpackage application.chapter2;

import javafx.beans.binding.NumberBinding;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.value.ObservableValue;

public class BindingTest3 {

    public static void main(String[] args) {
        IntegerProperty x = new SimpleIntegerProperty(100);
        IntegerProperty y = new SimpleIntegerProperty(200);
        // Create a binding: sum = x + y
        NumberBinding sum = x.add(y);
        System.out.println("After creating sum");
        System.out.println("sum.isValid(): " + sum.isValid());
        // Let us get the value of sum, so it computes its value and
        
// becomes valid
        int value = sum.intValue();
        System.out.println("\nAfter requesting value");
        System.out.println("sum.isValid(): " + sum.isValid());
        System.out.println("sum = " + value);
        // Change the value of x
        x.set(250);
        System.out.println("\nAfter changing x");
        System.out.println("sum.isValid(): " + sum.isValid());
        // Get the value of sum again
        value = sum.intValue();
        System.out.println("\nAfter requesting value");
        System.out.println("sum.isValid(): " + sum.isValid());
        System.out.println("sum = " + value);
    }
}

????? 2020-01-01 13:47 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2020/01/01/217052.html??????????Wed, 01 Jan 2020 05:19:00 GMThttp://598club.com/aaxron/archive/2020/01/01/217052.htmlhttp://598club.com/aaxron/comments/217052.htmlhttp://598club.com/aaxron/archive/2020/01/01/217052.html#Feedback0http://598club.com/aaxron/comments/commentRss/217052.htmlhttp://598club.com/aaxron/services/trackbacks/217052.htmlpackage application.chapter2;

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.value.ObservableValue;

public class PropertyTest2 {

    public static void main(String[] args) {
        IntegerProperty counter = new SimpleIntegerProperty(100);
        // Add an invalidation listener to the counter property
        counter.addListener(PropertyTest2::changed);
        System.out.println("Before changing the counter value-1");
        counter.set(101);
        System.out.println("After changing the counter value-1");
        /*
         * At this point counter property is invalid and further changes to its value
         * will not generate invalidation events.
         
*/
        System.out.println("\nBefore changing the counter value-2");
        counter.set(102);
        System.out.println("After changing the counter value-2");
        // Make the counter property valid by calling its get() method
        int value = counter.get();
        System.out.println("Counter value = " + value);
        /*
         * At this point counter property is valid and further changes to its value will
         * generate invalidation events.
         
*/
        // Try to set the same value
        System.out.println("\nBefore changing the counter value-3");
        counter.set(102);
        System.out.println("After changing the counter value-3");
        // Try to set a different value
        System.out.println("\nBefore changing the counter value-4");
        counter.set(103);
        System.out.println("After changing the counter value-4");
    }

    public static void changed(ObservableValue<? extends Number> prop,Number oldValue,Number newValue) {
        System.out.print("Counter changed: ");
        System.out.println("Old = " + oldValue + ", new = " + newValue);
    }
}

????? 2020-01-01 13:19 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2019/12/06/217014.html??????????Fri, 06 Dec 2019 02:53:00 GMThttp://598club.com/aaxron/archive/2019/12/06/217014.htmlhttp://598club.com/aaxron/comments/217014.htmlhttp://598club.com/aaxron/archive/2019/12/06/217014.html#Feedback0http://598club.com/aaxron/comments/commentRss/217014.htmlhttp://598club.com/aaxron/services/trackbacks/217014.htmlPass a string to/from Java to/from CTag(s): JNI
To Java from C (as seen from the previous How-to) :
#include "JavaHowTo.h" 

JNIEXPORT jstring JNICALL Java_JavaHowTo_sayHello
  (JNIEnv *env, jobject obj) {
    return  env->NewStringUTF("Hello world");
}
From Java to C : Suppose we have a Java Class
public class MyClass {
  public String sayHello(){
     return  "Hello world From Java";
  }
}
then from C, we want to call the Java sayHello() method which returns a String :
JNIEXPORT void JNICALL Java_JavaHowTo_sayHello(JNIEnv *env, jobject obj) 
{
    const char *str;
  
    jclass myclass_class =(jclass) env->NewGlobalRef 
         (env->FindClass ("MyClass"));
        
    // we need the MyClass constructor    
    jmethodID constructorID = env->GetMethodID
         (myclass_class, "", "()V");
         
    // and the sayHello() method
    jmethodID methodID = env->GetMethodID
         (myclass_class, "sayHello", "()Ljava/lang/String;");

    // instanciate a MyClass object
    jobject myclass_object =  env->NewObject
         (myclass_class, constructorID);
    
    // call the sayHello() method
    jstring s = (jstring)  env->CallObjectMethod
         (myclass_object, methodID);
    
    // convert the Java String to use it in C
    str = env->GetStringUTFChars(s, 0);
    printf("%s" , str);
    env->ReleaseStringUTFChars(s, str);  
}

The Java JNI wrapper would be
class JavaHowTo {
  public native void sayHello();
  static {
    System.loadLibrary("javahowto"); 
  }
}
And finally, to use it
public class JNIJavaHowTo {
  public static void main(String[] args) {
    JavaHowTo jht = new JavaHowTo();
    jht.sayHello();
    }
}









????? 2019-12-06 10:53 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2019/12/06/217013.html?????

 

Use native code through JNI (HelloWorld)

Use native code through JNITag(s): JNI

江苏快三开奖结果With MSVC6, create a new Win32 DLL project (simple) and call it javahowto.

In the same directory create a java source called JavaHowTo.java 
class JavaHowTo {
  public native String sayHello();
  static {
    System.loadLibrary("javahowto"); 
  }
}
Compile the Java program and use javah utility to generate the JavaHowTo.h header file.
javah -jni JavaHowTo
In MSVC6, add the JavaHowTo.h in your project header files
In the Tools - Options menu, set the include directories to include the Java JNI headers files. They are located in [jdk dir]\include and [jdk dir]\include\win32 directories
In the javahowto.cpp source, add
#include "JavaHowTo.h" 

JNIEXPORT jstring JNICALL Java_JavaHowTo_sayHello
  (JNIEnv *env, jobject obj) {
    return  env->NewStringUTF("Hello world");
}
Select the Release configuration and build the project.
Copy the javahowto.dll in the same directory as the java program.
Create this new java program
public class JNIJavaHowTo {
  public static void main(String[] args) {
    JavaHowTo jht = new JavaHowTo();
    System.out.println(jht.sayHello());
    }
}
Compile and execute.







????? 2019-12-06 10:50 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2019/08/15/216694.html??????????Thu, 15 Aug 2019 08:32:00 GMThttp://598club.com/aaxron/archive/2019/08/15/216694.htmlhttp://598club.com/aaxron/comments/216694.htmlhttp://598club.com/aaxron/archive/2019/08/15/216694.html#Feedback0http://598club.com/aaxron/comments/commentRss/216694.htmlhttp://598club.com/aaxron/services/trackbacks/216694.html
Oracle?????

??????-???:
select * FROM A_WECHAT WHERE 1=1

??????????????:
SELECT nvl(count(*),0as totalNum 
FROM (
    select * FROM A_WECHAT WHERE 1=1
where 1=1


?????:

 SELECT 
    * 
FROM 
    ( 
        SELECT 
            TIN.*, ROWNUM AS rowno 
        FROM 
            ( 
          select * FROM A_WECHAT WHERE 1=1 order by OPENID desc
            ) TIN 
        WHERE 
            ROWNUM <= 50     ) TOUT 
WHERE 
    TOUT.rowno >= 1 


????? 2019-08-15 16:32 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2019/06/26/216462.html??????????Wed, 26 Jun 2019 10:03:00 GMThttp://598club.com/aaxron/archive/2019/06/26/216462.htmlhttp://598club.com/aaxron/comments/216462.htmlhttp://598club.com/aaxron/archive/2019/06/26/216462.html#Feedback0http://598club.com/aaxron/comments/commentRss/216462.htmlhttp://598club.com/aaxron/services/trackbacks/216462.html Conditional compilation symbols
?????????????????1???????|????/define:DEBUG???,
    ????????VS2008???IDE?????????, Project Property--->Build--->Conditional compilation symbols(?|????????a???????????????????)
    ?3?????????????o?:DEBUG ??? TRACE
???????3????????3???o???-?????????????????????|????set DEBUG=1??????
?o?????????-???????3???????|???????o?????1?????????????? #define DEBUG????????????o???????????1??????? #undef DEBUG??????
     ???????file???????????1?????,#define debug?????????????????
    #if (Debug && Trace)
        #define DebugAndTrace 
    #endif
ps:Conditional????o?using System.Diagnostics;
????1????????????????????????|?
??????o???-?????a??1?3?????????????3???????????,?|???????????????????|????????????????1?????a?????a????????????????????????????,???????????????????????????????????????a[Conditional("string")] ?????????o?????????????????????
ps:[Conditional("string")]?????-???|??2????????  
?|??????3?????????????a??1?3????????????1?????
????a?????????,?????a?????????????????o?'????a????1?????????a???????1?????????[Conditional("string")]????????-???|??2????1???o?????????o?
C#-#define???????????
C#????????????????????????????????????o???????????????????????????????????????????????????????a??1??????????????????????????????#define???#undef???#if,#elif,#else???#endif?-??-???????????????C#??-?????#define???????????????????????????
C#??-???????????????????o????????????????????????o?????????-???????o??????????Visual Studio??-??????????????????????????????o??o???2???
??????#define??????????????????1?
1?????????????????????a?????????????????????????????3??o?????????????????'?????????????????????????????????????????????????????
2???????|?????????a?????????silverlight???wpf???winform?-??????????1??????????Debug???Release?-????????????????????????????????
3??????????????????????????|??????????????o?????-??????
?o????#define???3?
?-?3????#define ????
?3?????????????????Debug???????1?????????????????????|?Dragon
1 #define Debug
?'??????
1???Debug????????????????????????????a????????????-??????2????????-???????????-??????#if Debug????????otrue?????|?????ofalse???
2???#define?????????2?????1?????1???????????????#if?????Conditional??1????????????????
3???#define?????????1?????????using????????o?'????????
4???Debug???DEBUG???????????????C#??o?????????
 


????? 2019-06-26 18:03 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2019/02/12/216238.html?????

 

spring 4.0.x(Spring Framework 4.0.5)?????

 

spring 3.2.x???Spring Framework 3.2.9???????????

 

 

江苏快三开奖结果spring 3.2.x???Spring Framework 3.2.4???????????


 

??|spring security????????????



????? 2019-02-12 11:44 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2018/04/11/215585.html??????????Wed, 11 Apr 2018 08:40:00 GMThttp://598club.com/aaxron/archive/2018/04/11/215585.htmlhttp://598club.com/aaxron/comments/215585.htmlhttp://598club.com/aaxron/archive/2018/04/11/215585.html#Feedback0http://598club.com/aaxron/comments/commentRss/215585.htmlhttp://598club.com/aaxron/services/trackbacks/215585.htmlpublic class AnnotationMethodHandlerAdapter extends WebContentGenerator
        
implements HandlerAdapter, Ordered, BeanFactoryAware {
    
//

    
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        
return invokeHandlerMethod(request, response, handler);
    }

    
protected ModelAndView invokeHandlerMethod(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        ServletHandlerMethodResolver methodResolver 
= getMethodResolver(handler);
        Method handlerMethod 
= methodResolver.resolveHandlerMethod(request);
        ServletHandlerMethodInvoker methodInvoker 
= new ServletHandlerMethodInvoker(methodResolver);
        ServletWebRequest webRequest 
= new ServletWebRequest(request, response);
        ExtendedModelMap implicitModel 
= new BindingAwareModelMap();

        Object result 
= methodInvoker.invokeHandlerMethod(handlerMethod, handler, webRequest, implicitModel);
        ModelAndView mav 
=
                methodInvoker.getModelAndView(handlerMethod, handler.getClass(), result, implicitModel, webRequest);
        methodInvoker.updateModelAttributes(handler, (mav 
!= null ? mav.getModel() : null), implicitModel, webRequest);
        
return mav;
    }

    
public ModelAndView getModelAndView(Method handlerMethod, Class<?> handlerType, Object returnValue,
            ExtendedModelMap implicitModel, ServletWebRequest webRequest) 
throws Exception {}
}


??????
public final class Method extends Executable {
    
public Object invoke(Object obj, Object args)
    
throws IllegalAccessException, IllegalArgumentException,InvocationTargetException
    {
        
if (!override) {
            
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
                Class
<?> caller = Reflection.getCallerClass();
                checkAccess(caller, clazz, obj, modifiers);
            }
        }
        MethodAccessor ma 
= methodAccessor;             // read volatile
        if (ma == null) {
            ma 
= acquireMethodAccessor();
        }
        
return ma.invoke(obj, args);
    }
}
public class ModelMap extends LinkedHashMap<String, Object> {}

public abstract class AbstractView extends WebApplicationObjectSupport implements View, BeanNameAware {
    
/**
     * Prepares the view given the specified model, merging it with static
     * attributes and a RequestContext attribute, if necessary.
     * Delegates to renderMergedOutputModel for the actual rendering.
     * 
@see #renderMergedOutputModel
     
*/
    @Override
    
public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
        
if (logger.isTraceEnabled()) {
            logger.trace(
"Rendering view with name '" + this.beanName + "' with model " + model +
                
" and static attributes " + this.staticAttributes);
        }

        Map
<String, Object> mergedModel = createMergedOutputModel(model, request, response);
        prepareResponse(request, response);
        renderMergedOutputModel(mergedModel, getRequestToExpose(request), response);
    }
}
?????????


????? 2018-04-11 16:40 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2018/04/11/215584.html??????????Wed, 11 Apr 2018 08:39:00 GMThttp://598club.com/aaxron/archive/2018/04/11/215584.htmlhttp://598club.com/aaxron/comments/215584.htmlhttp://598club.com/aaxron/archive/2018/04/11/215584.html#Feedback0http://598club.com/aaxron/comments/commentRss/215584.htmlhttp://598club.com/aaxron/services/trackbacks/215584.htmlpublic class DispatcherServlet extends FrameworkServlet {
    
private List<HandlerMapping> handlerMappings;

    
protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception {
        doDispatch(request, response);
    }
    
    
protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception {
        HttpServletRequest processedRequest 
= request;
        HandlerExecutionChain mappedHandler 
= null;
        
boolean multipartRequestParsed = false;
        
try {
            ModelAndView mv 
= null;
            Exception dispatchException 
= null;
            
try {
                processedRequest 
= checkMultipart(request);
                multipartRequestParsed 
= (processedRequest != request);

                
// Determine handler for the current request.  //????????????
                mappedHandler = getHandler(processedRequest); //HandlerExecutionChain
                if (mappedHandler == null || mappedHandler.getHandler() == null) {
                    noHandlerFound(processedRequest, response);
                    
return;
                }

                
// Determine handler adapter for the current request. //???????????
                HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());

                
if (!mappedHandler.applyPreHandle(processedRequest, response)) {
                    
return;
                }

                
// Actually invoke the handler. 
                mv = ha.handle(processedRequest, response, mappedHandler.getHandler());

                applyDefaultViewName(processedRequest, mv); 
                mappedHandler.applyPostHandle(processedRequest, response, mv);
            }

            
//??2???????
            processDispatchResult(processedRequest, response, mappedHandler, mv, dispatchException); 
        }
        
catch (Exception ex) {
            triggerAfterCompletion(processedRequest, response, mappedHandler, ex);
        }
        
finally {
        }
    }
    
private void processDispatchResult(HttpServletRequest request, HttpServletResponse response,
        HandlerExecutionChain mappedHandler, ModelAndView mv, Exception exception) 
throws Exception {
        
// Did the handler return a view to render?
        if (mv != null && !mv.wasCleared()) {
            render(mv, request, response);
        }
        
else {
            
if (logger.isDebugEnabled()) {
                logger.debug(
"Null ModelAndView returned to DispatcherServlet with name '" + getServletName() +
                        
"': assuming HandlerAdapter completed request handling");
            }
        }
        
if (mappedHandler != null) {
            mappedHandler.triggerAfterCompletion(request, response, 
null);
        }
    }
    
    
protected void render(ModelAndView mv, HttpServletRequest request, HttpServletResponse response) throws Exception {
        
// Determine locale for request and apply it to the response.
        Locale locale = this.localeResolver.resolveLocale(request);
        response.setLocale(locale);

        View view;
        
if (mv.isReference()) {
            
// We need to resolve the view name.
            view = resolveViewName(mv.getViewName(), mv.getModelInternal(), locale, request);
            
if (view == null) {
                
throw new ServletException("Could not resolve view with name '" + mv.getViewName() +
                        
"' in servlet with name '" + getServletName() + "'");
            }
        }
        
else {
            
// No need to lookup: the ModelAndView object contains the actual View object.
            view = mv.getView();
            
if (view == null) {
                
throw new ServletException("ModelAndView [" + mv + "] neither contains a view name nor a " +
                        
"View object in servlet with name '" + getServletName() + "'");
            }
        }

        
// Delegate to the View object for rendering.
        if (logger.isDebugEnabled()) {
            logger.debug(
"Rendering view [" + view + "] in DispatcherServlet with name '" + getServletName() + "'");
        }
        
try {
            view.render(mv.getModelInternal(), request, response);
        }
        
catch (Exception ex) {
            logger.debug(
"Error rendering view [" + view + "] in DispatcherServlet with name '" +    getServletName() + "'", ex);
            
throw ex;
        }
}


????? 2018-04-11 16:39 ???????o
]]>
C++博客-天下 http://598club.com/aaxron/archive/2017/05/17/214944.html?????

??????MoveWindow()???????????o???1????a?????????????????o????????1?o??????a???????????????1???1??????|?????????1?o??-??a????????????1?????????a????????|???????

BOOL MoveWindow( HWND hWnd,
int x, int y, int nWidth, int nHeight,BOOL bRepaint = TRUE);
?????hWnd??o?a?????????????
?????x,y??o?a????????|???????1???
?????nwidth???nHeight ??o?a???????o|???????o|???
???????????abRepaint??o?????|?????3??????????otrue????3????????????3?????WM_PAINT???a???????o??????????UpdateWindow()?????????????ofalse???????????????????????????????????????????

MoveWindow???????a?????????WM_WINDOWPOSCHANGING???WM_WINDOWPOSCHANGED???WM_MOVE???WM_SIZE???WM_NCCALCSIZE?????????

????????????SetWindowPos(),????a?????????????????????a???????????????????a????????????'???????1???

BOOL SetWindowPos(HWND hWnd,
const CWnd* pWndInsertAfter, int x, int y,int cx, int cy, UINT nFlags);
????????a?????????a?????????????
????o???a?????????a???????Z order??????????????a?a??????????????a????????o????o?o?????????????????????????????????????????:HWND_BOTTOM,HWND_NOTOPMOST,HWND_TOP,HWND_TOPMOST.
HWND_BOTTOM??????a????????o?Z?o?????o??????|?????????hWnd??????o??????a?????a???????????a???????????o??????????1??????????????????a????????o?????  ?????? 
HWND_NOTOPMOST??????a????????o??????????????a?????1?????????3?????????????a?????1???????????|?????a?????2?????????????a???????????????????????????  ?????? 
HWND_TOP:???a????????o?Z?o??????????  ?????? 
HWND_TOPMOST:???a????????o??????????????a?????1?????????3????a??????a??????'??a?????1????????????o????????? 
??????????????a?????????a?????????????????o??????
???????????a?????nFlags????a????????o??1???????????????????a??????????????????????????????????|????|???????
SWP_ASNCWINDOWPOS????|?????????????????????a????????3?????????????????a????????o????????o???????????2?-?????o????????????o????????????????????????????-??????  ??????
SWP_DEFERERASE????2?-??o???WM_SYNCPAINT?????????  ??????
SWP_DRAWFRAME??????a????????'????????a?1??????????1????a????????????-??????  ??????
SWP_FRAMECHANGED???????a?????????WM_NCCALCSIZE???????????3????a?????o????2??????1????1?????????????????????|??????a??????????a???????????a???????1????o??a?????o??????????????WM_NCCALCSIZE??? 
SWP_HIDEWINDOW;?????a??????? 
SWP_NOACTIVATE??????????'??a????????|??????a??????????????????a??????????'?????1??????????????????????o?a???????????????o??????????????1????????hWndlnsertAfter??????????? 
SWP_NOCOPYBITS??????????????o??????????????1????|??????a???????????????????????o??????????????1??????-??1???????a?????o?????'??????????????????'???????????o??? 
SWP_NOMOVE?????'????????????????????????X???Y???????????  ??????
SWP_NOOWNERZORDER????????1???z?o???-????????????a???????????????? 
SWP_NOREDRAW:??????????1???????????1????|??????????o?????a?????????????????????????????????????????????o????????o????????????o???????????????????????????????????????????o??a???????????2??o???????a?????????????????????|??????????o?????a??????????o??????o??????????????????a???????????1???????a????????????????????????a??????|???????????????? 
SWP_NOREPOSITION??????SWP_NOOWNERZORDER???????????????  ???   SWP_NOSENDCHANGING????2?-??a??????????WM_WINDOWPOSCHANGING????????? 
SWP_NOSIZE?????'??????????o????????????cx???Cy??????????? 
SWP_NOZORDER?????'?????????Z?o??????????hWndlnsertAfter??????????? 
SWP_SHOWWINDOW???????o?a???????
?3????o??1???
?????SetWindowPos()?|??????????o?SWP_SHOWWINDOWS?????SWP_HIDEWINDOW??????1??a??????????????????????1??????????????????????????????o?SWP_SHOWWINDOW,?????????'??????????????????

???????????????
??????????????????????1????a??????????

MoveWindow()?????????????????????a???????????1????a????????????SetWindowPos()?????????????'??????????????????Zorder???????o??1????????????

MoveWindow()?????WM_WINDOWPOSCHANGING???WM_WINDOWPOSCHANGED???WM_MOVE???WM_SIZE???WM_NCCALCSIZE?-??????????a???????SetWindowPos()??a?????WM_WINDOWPOSCHANGED?????????a??????????????'?|??????|????????'?????????????????????MoveWindow()?????????


????? 2017-05-17 18:56 ???????o
]]>