GVKun编程网logo

Alexa 智能家居技能 - 需要帮助才能发出 http 请求(智能家居api)

11

在本文中,我们将为您详细介绍Alexa智能家居技能-需要帮助才能发出http请求的相关知识,并且为您解答关于智能家居api的疑问,此外,我们还会提供一些关于html–需要帮助才能在命令按钮中显示图标图

在本文中,我们将为您详细介绍Alexa 智能家居技能 - 需要帮助才能发出 http 请求的相关知识,并且为您解答关于智能家居api的疑问,此外,我们还会提供一些关于html – 需要帮助才能在命令按钮中显示图标图像、Java 中的物联网和智能家居技术、PHP类:需要帮助才能继承两个类、typescript – 我的角度2应用程序需要很长时间才能加载第一次用户,我需要帮助才能加快速度的有用信息。

本文目录一览:

Alexa 智能家居技能 - 需要帮助才能发出 http 请求(智能家居api)

Alexa 智能家居技能 - 需要帮助才能发出 http 请求(智能家居api)

如果请求通过了,我的意思是您的代码正在被调用,并且灯正在打开/关闭,问题出在响应上。

我的猜测是您缺少相关性 ID。

您需要添加如下内容:

responseHeader.correlationToken = request.directive.header.correlationToken;

您还应该实现 EndpointHealth:https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-endpointhealth.html

html – 需要帮助才能在命令按钮中显示图标图像

html – 需要帮助才能在命令按钮中显示图标图像

只是一个基本需求,但无法让它工作.
我想有一个primefaces按钮来显示我的图像,没有任何文字.

但我得到的是一个只包含^字符的按钮,不显示图像,只有16×16的大小.

所以,这是primefaces按钮:

<p:commandButton image="ui-icon-csv" title="CSV Document" ajax="false">
    <p:dataExporter type="csv" target="gridRPBDetails" 
        fileName="#{tInputBean.exportFilename}" />
</p:commandButton>

这是css文件:

.ui-icon-csv {
    background-image: url(images/csv_small.png);
}

这是按钮生成的html:

<button type="submit" onclick=";" 
    name="gridRPBDetails:j_idt82" id="gridRPBDetails:j_idt82"role="button" aria-disabled="false">
        <span></span><span>CSV Document</span>
</button>

为了证明图像可访问,我尝试这个URL,它确实显示了图片:

http://albert:8080/mywebapp/faces/javax.faces.resource/images/csv_small.png

我使用tomcat 7,这些是我的依赖:

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>2.2.1</version>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.0.4-b09</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.0.4-b09</version>
    <scope>compile</scope>
</dependency>

出了什么问题?

谢谢 !

解决方法

在使用firebug进行一些调查后,我发现罪魁祸首来自我定义的CSS内容.

所以这些是我为使这项工作所做的改变.

JSF按钮:

<p:commandButton image="ui-icon-xls" title="Excel Document" ajax="false">
    <p:dataExporter type="xls" target="gridRPBDetails" 
        fileName="#{tInputBean.exportFilename}" />
</p:commandButton>

CSS:

.ui-state-default .ui-icon-xls {
    background-image: url(images/excel_small.png);
}

这是生成的html:

<button type="submit" title="Excel Document" onclick=";" 
  name="gridRPBDetails:j_idt81" id="gridRPBDetails:j_idt81"role="button" aria-disabled="false">
    <span></span>
    <span>ui-button</span>
</button>

谢谢 !

Java 中的物联网和智能家居技术

Java 中的物联网和智能家居技术

java是一种广泛使用的编程语言,被广泛应用于各种应用程序的开发,包括物联网和智能家居等领域。在本文中,我们将介绍java在物联网和智能家居技术方面的应用。

物联网是指通过互联网使各种物理设备(如传感器、执行器等)相互连接并进行数据交换的系统。Java具有强大的网络编程能力,可以很好地支持物联网应用程序的开发。Java可以通过各种协议(如HTTP、TCP、UDP等)与物理设备进行通信,并支持各种数据格式的处理。

Java提供了一些基于HTTP协议的框架,如Spring Framework和Spring Boot,实现了RESTful web服务。这些框架可以被用来开发物联网应用程序,提供统一的API接口以及对数据格式的解析和传输。此外,Java还提供了一些基于数据流和消息传递的框架,如Apache Kafka和RabbitMQ,这些框架可以用于处理大量的传感器数据和消息。

智能家居是一种应用物联网技术的领域,在智能家居中,各种设备(如照明、加热、循环风扇等)被连接到互联网,可以通过智能手机等移动设备来控制。Java可以很好地支持智能家居应用程序的开发。例如,我们可以开发一个基于Spring Boot框架的Web应用程序,该程序可以提供一个统一的界面,以控制智能家居设备。这个应用可以通过RESTful API与智能家居设备进行通信,并使用Java Swing多媒体库实现音频和视频播放。

最后, Java还提供了一个非常好用的编程工具,Eclipse,它不仅可以帮助开发者进行代码编写和调试,还可以通过插件支持各种物联网协议(如MQTT协议等)的开发。

立即学习“Java免费学习笔记(深入)”;

总之,Java在物联网和智能家居领域具有良好的应用前景,可以帮助开发人员开发高效且灵活的应用程序。

以上就是Java 中的物联网和智能家居技术的详细内容,更多请关注php中文网其它相关文章!

PHP类:需要帮助才能继承两个类

PHP类:需要帮助才能继承两个类

我需要帮助设计我需要从多个类扩展的PHP类.

我有一个普通的类,Pagination.PHP,可以进行各种分页和排序.所有其他类将使用它进行分页.

为了让我的生活更轻松,我创建了一个从MysqL表生成类的类生成器.所有属性,getter,setter和常用方法都是自动创建的,这样可以节省时间和金钱.

例如,Staff_Base.PHP中的类Staff_Base是从sql表t_staff自动生成的.

由于类Personzzase是从sql表自动生成的,因此任何“自定义”方法/属性都位于另一个扩展Staff_Base.PHP的类中. (因此,无论何时添加新字段,我都可以简单地重新生成Staff_Base类并在Staff_Base.PHP中覆盖).

所以我有一个扩展Staff_Base.PHP的类Staff.PHP.

问题是,Staff.PHP还需要扩展另一个类Pagination.PHP.
(目前的解决方法是将Pagination.PHP中的方法放入每个类中.每当我对分页/排序方法进行更改时,这真的很麻烦.)

我该怎么做呢?
实现这一目标的最佳设计模式是什么?

我知道重组我的课程的常见建议,但我真的很难想到其他解决方法/解决方案.另外,我可能还需要扩展除Pagination.PHP之外的其他类.

谢谢!

解决方法:

我建议更改您的Staff_Base.PHP生成器,以使该类默认扩展分页.这样员工扩展了Staff_Base,Staff_Base扩展了分页.我认为这可能是获得所需结果的最干净(也是最面向对象)的方式.

typescript – 我的角度2应用程序需要很长时间才能加载第一次用户,我需要帮助才能加快速度

typescript – 我的角度2应用程序需要很长时间才能加载第一次用户,我需要帮助才能加快速度

下面我已经粘贴在我的app.ts文件中。

我使用angular2,带有firebase和typescript。

原因很慢,因为我有很多路线,我注入了大量的文件?

此外,我的应用程序工作正常,只是第一次访问主页的用户有这个问题。

我不知道是否可以在底部改进引导,或者我做错了什么。

这是我的app.ts文件:

import {Component,bind,provide,Injectable} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser'
import {NgIf} from 'angular2/common';
import {Router,Location,ROUTER_BINDINGS,RouterOutlet,RouteConfig,RouterLink,ROUTER_PROVIDERS,APP_BASE_HREF,CanActivate,OnActivate,ComponentInstruction} from 'angular2/router';
import {HTTP_PROVIDERS,Http,Headers} from 'angular2/http';
import {ANGULAR2_GOOGLE_MAPS_PROVIDERS} from 'angular2-google-maps/core';
import {enableProdMode} from 'angular2/core';
enableProdMode();

import {LoggedInRouterOutlet} from './interceptor';

import {AuthService} from './services/authService/authService';
import {SocialService} from './services/socialService/socialService';
import {UserService} from './services/userService/userService';
import {OrganisationService} from './services/organisationService/organisationService';
import {NotificationService} from './services/notificationService/notificationService';
import {EmailService} from './services/emailService/emailService';

import {UserProfile} from './models/profile/profile';
import {Organisation} from './models/organisation/organisation';

import {HeaderNavigation} from './components/header/header';
import {HeaderNavigationLoggedIn} from './components/header/headerNavigationLoggedIn';
import {HeaderNavigationLoggedInCompany} from './components/header/headerNavigationLoggedInCompany';
import {Footer} from './components/footer/footer';
import {SideMenuCompany} from './components/header/sideMenuCompany';
import {SideMenuUser} from './components/header/sideMenuUser';
import {Splash} from './components/splash/splash';

import {CreateJob} from './components/createJob/createJob';
import {SearchJobs} from './components/searchJobs/searchJobs';
import {Login} from './components/login/login';
import {Applications} from './components/applications/applications';
import {Register} from './components/register/register';
import {ForgotPassword} from './components/forgotpassword/forgotpassword';
import {ChangePassword} from './components/changepassword/changepassword';
import {ChangeEmail} from './components/changeemail/changeemail';
import {SocialRegister} from './components/socialregister/socialregister';
import {Admin} from './components/admin/admin';
import {Contact} from './components/contact/contact';
import {SearchUsers} from './components/searchusers/searchusers';

import {Jobs} from './components/job/jobs';
import {CompanyProfile} from './components/company/company';
import {Home} from './components/home/home';
import {Dashboard} from './components/dashboard/dashboard';
import {Profile} from './components/profile/profile';
import {UserApplications} from './components/userApplications/userApplications';

@Component({
    selector: 'app',providers: [UserService,UserProfile,OrganisationService,Organisation],template: `

        <Splash *ngIf="isLoggedIn"></Splash>    

        <HeaderNavigation *ngIf="!isLoggedIn"></HeaderNavigation>       

        <HeaderNavigationLoggedIn *ngIf="isLoggedIn && isUserLogin"></HeaderNavigationLoggedIn>
        <HeaderNavigationLoggedInCompany *ngIf="isLoggedIn && isCompanyLogin"></HeaderNavigationLoggedInCompany>

        <SideMenuCompany *ngIf="isLoggedIn && isCompanyLogin"></SideMenuCompany>
        <SideMenuUser *ngIf="isLoggedIn && isUserLogin"></SideMenuUser>

        <div>
            <router-outlet></router-outlet> 
        </div>     
    `,directives: [RouterOutlet,Splash,HeaderNavigation,HeaderNavigationLoggedIn,NgIf,HeaderNavigationLoggedInCompany,SideMenuCompany,SideMenuUser,Footer,LoggedInRouterOutlet]
})

@RouteConfig([
    { path: '/',component: Home,as: 'Home',data:{title: 'Welcome Home'}},{ path: '/home',useAsDefault: true},{ path: '/login',component: Login,as: 'Login' },{ path: '/register/:id',component: Register,as: 'Register' },{ path: '/forgotpassword',component: ForgotPassword,as: 'ForgotPassword' },{ path: '/dashboard',component: Dashboard,as: 'Dashboard' },{ path: '/search',component: SearchJobs,as: 'Search' },{ path: '/profile',component: Profile,as: 'Profile' },{ path: '/settings',component: CompanyProfile,as: 'Settings' },{ path: '/jobs',component: Jobs,as: 'Jobs' },{ path: '/password',component: ChangePassword,as: 'Password' },{ path: '/email',component: ChangeEmail,as: 'Email' },{ path: '/applications',component: Applications,as: 'Applications' },{ path: '/socialRegister/:id',component: SocialRegister,as: 'SocialRegister' },{ path: '/socialRegister',{ path: '/applys',component: UserApplications,as: 'Applys' },{ path: '/contact',component: Contact,as: 'Contact' },{ path: '/searchTeachers',component: SearchUsers,as: 'SearchUsers' },{ path: '/createJob',component: CreateJob,as: 'CreateJob' },{ path: '/adminmarkchris2016',component: Admin,as: 'AdminMarkChris2016' },{ path:'/**',redirectTo: ['Home']}
])

@Injectable()

export class AppComponent {
    router: Router;
    location: Location;
    authService: AuthService;
    userService: UserService
    isLoggedIn: boolean = false;
    isCompanyLogin: boolean = false;
    isUserLogin: boolean = false;
    userProfile: UserProfile;   

    constructor(_router: Router,_location: Location,_authService: AuthService,_userService: UserService,_userProfile: UserProfile){ 
        this.router = _router;
        this.location = _location;
        this.authService = _authService;
        this.userService = _userService;
        this.userProfile = _userProfile;

        this.isUserLoggedIn(this.location.path());

        //On refresh
        this.router.subscribe((currentRoute) => {
            this.isUserLoggedIn(currentRoute);
        })  
    }

    isUserLoggedIn(currentRoute): void{ 
        this.authService.checkIfLoggedIn().then((response) => { 
            this.isLoggedIn = response

            if(this.isLoggedIn){
                this.isUserOrganisationorTeacher();                 
            }   

            if(currentRoute.substring(0,14) == "socialRegister" || currentRoute == "socialRegister" || currentRoute == "home" || currentRoute == "contact" || currentRoute == "" || currentRoute == "forgotpassword" || currentRoute == "login" || currentRoute.substring(0,8) == "register"){
                this.isCompanyLogin = false;
                this.isUserLogin = false;
                this.isLoggedIn = false;
            }           
        });  
    }

    isUserOrganisationorTeacher(): void{
        this.userService.checkIfProfileExists().then((response) => {
            this.isCompanyLogin = false;
            this.isUserLogin = false;       

            if(response){
                this.isUserLogin = true;
                this.isCompanyLogin = false;
            }else{
                this.isCompanyLogin = true; 
                this.isUserLogin = false;                   
            }
        }); 
    }       
}

bootstrap(AppComponent,[ROUTER_PROVIDERS,provide(APP_BASE_HREF,{useValue: '/'}),HTTP_PROVIDERS,AuthService,SocialService,UserService,EmailService,NotificationService,ANGULAR2_GOOGLE_MAPS_PROVIDERS]);
要有一些准备好生产(加快速度)的东西,你需要打包它。

我的意思是将所有文件转换成JavaScript,并以与Angular2相同的方式连接。这样您就可以将多个模块包含在单个JS文件中。这样您就可以减少HTTP调用次数,将应用程序代码加载到浏览器中。

事实上,对于以下配置的SystemJS,您将每个模块有一个调用(它适用于开发,但在生产中并不真正有效):

<script>
  System.config({
    packages: {        
      app: {
        format: 'register',defaultExtension: 'js'
      }
    }
  });
  System.import('app/boot')
        .then(null,console.error.bind(console));
</script>

这个答案可以提供关于模块解析如何工作的提示:

> How does Angular2 resolve imports?

您可以使用Gulp及其插件进行此包装:

> https://www.npmjs.com/package/gulp-tsc
> https://github.com/contra/gulp-concat

看到以下答案:

> Using Gulp to Concatenate and Uglify files
> https://github.com/JavascriptMick/angular2-gulp-typescript/blob/master/gulpfile.js

我们今天的关于Alexa 智能家居技能 - 需要帮助才能发出 http 请求智能家居api的分享已经告一段落,感谢您的关注,如果您想了解更多关于html – 需要帮助才能在命令按钮中显示图标图像、Java 中的物联网和智能家居技术、PHP类:需要帮助才能继承两个类、typescript – 我的角度2应用程序需要很长时间才能加载第一次用户,我需要帮助才能加快速度的相关信息,请在本站查询。

本文标签: