浏览器不支持HTML5!
  • public static String translate(String text,String source,String traget){
      LanguageTranslation service = new LanguageTranslation();
      // service.setUsernameAndPassword(“5d933d5e-50b5-4b05-a358-f6b781****”, “VbLm******");
      service.setUsernameAndPassword(Constants.TTT_USERNAME, Constants.TTT_PASSWORD);
      TranslationResult translationResult = service.translate(text, source, traget);
      List <Translation> translationList= translationResult.getTranslations();
      Translation translation=translationList.get(0);
      return translation.getTranslation();
    }
                            
    跳过
  • import cloudant
    import time
    import random
    
    ISOTIMEFORMAT='%Y-%m-%d %X'
    # connect to your account
    USERNAME = 'iolab'
    account = cloudant.Account(USERNAME)
    
    # create a database object
    db = account.database('iot')
    doc = db.document('')
    
    while 1:
    # create the document
        # temperature = ext_sensor.temperature()
        # humidity = ext_sensor.humidity()
        datetime = time.strftime( ISOTIMEFORMAT, time.localtime())
        # For test
        temperature = random.randint(18, 25)
        humidity = random.randint(45, 60)
        resp = doc.post(params={
         'temp':temperature,
         'humi':humidity,
          'time': datetime
          })
        # Such exceptions can be handled by notification for review by administrators
        if (temperature>30 | temperature<0 ):
               #sendemail()
               print temperature
        time.sleep(300)
    
    #print response.json()
    # {'ok': True}
                            
    跳过
  • String queryStr = req.getQueryString();
    String url = baseURL + "/v1/synthesize";
    if (queryStr != null) {
             url += "?" + queryStr;
    }
    URI uri = new URI(url).normalize();
    Request newReq = Request.Get(uri);
    newReq.addHeader("Accept", "audio/ogg; codecs=opus");
    Executor executor = Executor.newInstance().auth(username, password);
    Response response = executor.execute(newReq);
    ServletOutputStream servletOutputStream = resp.getOutputStream();
    response.returnResponse().getEntity().writeTo(servletOutputStream);
    servletOutputStream.flush();
    servletOutputStream.close();
                            
    跳过
浏览器不支持HTML5!
浏览器不支持HTML5!
Your browser does not support the canvas element.
Your browser does not support the canvas element.