How to let swagger control group display

In Swagger, you normally divide the API into groups and each group will have a Docket.

But many times, you do not want someone or some environment to see all groups . you want to control each group showing or not. This looks like a difficult task after some search. But in fact swagger already has this feature in Docket.

@Bean
public Docket myDocket() {
return new Docket(DocumentationType.SWAGGER_2).groupName("MYAPI").apiInfo(metaAll()).select().paths(pathsAll())
.build().useDefaultResponseMessages(false).forCodeGeneration(true).enable(flag_enable_all);
}

So enable(flag) is part to control enable method for the group. You can use your configuration or role logic to control this flag value to control the group here.

 

Advertisements

How to let your spring boot pick up external property file

You may already see that ./config/application.properties can override the default spring boot application.properties settings. But when you deploy your app to tomcat and with many other web app together, then you need to have unique properties files foe each app and also make external property file be picked up by web app.

So let us do something like this:

  1. Change in your java main code to let your app use a unique properties file instead of application.properties.
@SpringBootApplication
public class MyApplication {

    public static void main(String[] args) {
        System.setProperty("spring.config.name", "myapp");
        SpringApplication.run(MyApplication.class, args);
    }
}

For war version of tomcat:

public class ServletInitializer extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(MyApplication.class).properties("spring.config.name: myapp");
    }

}

Then name your properties file like: myapp.properties, instead of the default name.

2. Now let us also enable the external property file to override the default myapp.properties.

in Spring boot, it is just ./config/myapp.properties

For tomcat version, we need to add env variable to do this. Set a spring_config_location environment variable pointing to the folder that contains your myapp.properties file. In the case of Tomcat you can do this by adding the following line to your <TOMCAT_HOME>/bin/setenv.sh file (create the file if missing):

export spring_config_location=<TOMCAT_HOME>/conf/

Place the myapp.properties properties file in that folder <TOMCAT_HOME>/conf/.

So every app will looking into the conf folder to look for their unique properties file to load.

 

Refer to:

https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

 

 

Java native memory tools and usage related

 

https://dzone.com/articles/java-memory-and-cpu-monitoring-tools-and-technique

 

https://www.ibm.com/developerworks/library/j-nativememory-aix/

https://stackoverflow.com/questions/12797560/command-line-tool-to-find-java-heap-size-and-memory-used-linux

https://dzone.com/articles/java-memory-and-cpu-monitoring-tools-and-technique

 

 

https://stackoverflow.com/questions/2756798/java-native-memory-usage

 

 




java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'

Issue: An irrecoverable stack overflow has occurred.

Issue:

An irrecoverable stack overflow has occurred. Please check if any of your loaded .so files has enabled executable stack (see man page execstack(8))

Reason:

This issue happens when I call a c++ So lib from java by JNA. This mostly caused by input a big chunk of data into the function interface of the C++ function. There is a limit of the Thread Stack Size defined for java’s thread. Normally is 512K-1024K.

 

And by change the Xss size you could change the stack size. but you should be careful on this when you have many threads need to open.

 

 

Refer http://xmlandmore.blogspot.com/2014/09/jdk-8-thread-stack-size-tuning.html

 

Free text/code online share tools

You can immediately open a browser and share the code/text link with other people. And you do not even need to register account for using .

These are some very useful site for remote sharing something in a prompt or do a very simple phone interview for startup.

  1. https://codeshare.io/
  2. https://www.codepile.net
  3. https://witeboard.com
  4. https://www.skype.com/en/interviews/
  5. Google doc

 

  1. Not free – http://collabedit.com/
  2. Not free – https://coderpad.io

Spoken dialogue system open resources

OpenDial – java

https://github.com/plison/opendial

https://pdfs.semanticscholar.org/7981/324bcad5812ccf789d2091414e19138047dc.pdf

DeepPavlov – Python

https://github.com/deepmipt/DeepPavlov

Jindigo – Java

http://www.speech.kth.se/jindigo/

jVoiceXML – JAVA

https://github.com/JVoiceXML/JVoiceXML

CMU RavenClaw – C++/Perl

https://www.cs.cmu.edu/~dbohus/ravenclaw-olympus/index-dan.html

PED – prolog

http://planeffdia.sourceforge.net/main/

OwlSpeak – Java

https://sourceforge.net/projects/owlspeak/

IrisTK – java

http://www.iristk.net/index.html

InproTK – java python

https://bitbucket.org/inpro/inprotk

Rivr – Java – voiceXML

https://github.com/nuecho/rivr/#overview

 

summary ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

https://github.com/EllaVator/EllaVator/wiki/Open-source-dialog-frameworks

Cloud Commercial like the FB wit.ai, Microsoft LUIS, Nuance and google api.ai

Speech Recognition and Speech Synthesis open resources

CMU-Sphinx  C/C++/JAVA

Kaldi

HTK

Julius

RWTH

simon

iATROS-speech

SHoUT

Zanzibar

OpenIVR

MSDN-SAPI:http://msdn.microsoft.com/zh-cn/library/ms723627.aspx

CMU-Sphinx: http://en.wikipedia.org/wiki/CMU_Sphinx

HTK Toolkit:http://htk.eng.cam.ac.uk/

Julius:http://en.wikipedia.org/wiki/Julius_(software)

RWTH ASR:http://en.wikipedia.org/wiki/RWTH_ASR

http://en.wikipedia.org/wiki/List_of_speech_recognition_software

 

http://ibillxia.github.io/blog/2012/11/24/several-plantforms-on-audio-and-speech-signal-processing/

http://zh.wikipedia.org/wiki/语音识别
http://baike.baidu.com/view/549184.htm