小编yat*_*atg的帖子

在我的html中使用rootScope变量

所以我们可以像我这样在角度html中使用范围变量:

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
  </head>
  <body>
    <div>
      <label>Name:</label>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">
      <hr>
      <h1>Hello {{yourName}}!</h1>
    </div>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

例如:

<h1>Hello {{yourName}}!</h1>
Run Code Online (Sandbox Code Playgroud)

yourName从我希望做的范围使用:

<h1>Hello {{yourName}} you are in in {{$rootScope.zoneName}}!</h1>
Run Code Online (Sandbox Code Playgroud)

有可能$rootScope像这样带变量吗?

angularjs

72
推荐指数
4
解决办法
9万
查看次数

X11 - Xrandr 给我假显示器

我试图找到所有显示器及其坐标(宽度w、高度h、x origin/top-left-mostx和 y origin/top-left-most y)并使用此代码,它在某些系统上运行良好。但在其他系统上,我得到错误和重复的条目。如果我测试监视器是否是镜像,我是否能够避免这些重复/错误监视器条目?如何测试它是否是镜像?

所以这是我的代码:

// start - get all monitor resolutions
var screen = XRRGetScreenResources(getXOpenDisplay(), getDefaultRootWindow(getXOpenDisplay()));

var noutputs = screen.noutput;

for (var i=noutputs-1; i>=0; i--) {
    var info = XRRGetOutputInfo(getXOpenDisplay(), screen, screen.outputs[i]);
    if (info.connection == RR_Connected) {
        var ncrtcs = info.ncrtc;
        for (var j=ncrtcs-1; j>=0; j--) {
            var crtc_info = XRRGetCrtcInfo(getXOpenDisplay(), screen, infoCrtcs[j]);
            console.info('screen #' + i + ' mon#' + j + ' details:', crtc_info.x, crtc_info.y, crtc_info.width, crtc_info.height);

            collMonInfos.push({
                x: …
Run Code Online (Sandbox Code Playgroud)

c x11 xrandr xlib

5
推荐指数
1
解决办法
893
查看次数

.Desktop,命令行参数传递给 exec(类似于 shell 脚本)

我通常会编写这样的 shell 脚本:

#!/bin/sh
nohup /path/to/myapp -test "$@" &
Run Code Online (Sandbox Code Playgroud)

然后,我可以从终端启动此 shell 脚本,并将我提供的任何命令行参数传递到 shell 脚本,然后将其传递到执行行 myapp。我使用的是 Ubuntu,问题出在 shell 脚本上,启动的图标不是 shell 文件的图标。它使用 myapp 的默认图标。这就是我转向 .desktop 的原因,它使启动的应用程序使用 .desktop 文件的图标。

我已经编写了一个 .desktop 文件:

[Desktop Entry]
Name=My Ro
Type=Application
Comment=Web Application
Exec=/path/to/myapp -test @
Icon=/opt/giteye/icon.xpm
Name[en_US]=My Ro
Run Code Online (Sandbox Code Playgroud)

我在执行行上放置了一个 @ 符号,但它没有按预期工作。它没有获取我提供给 .desktop 的命令行参数,也没有将其放入执行行中。您能帮我将 .desktop 收到的命令行参数传递给 Exec line/

linux bash shell ubuntu shortcut-file

3
推荐指数
1
解决办法
5949
查看次数

标签 统计

angularjs ×1

bash ×1

c ×1

linux ×1

shell ×1

shortcut-file ×1

ubuntu ×1

x11 ×1

xlib ×1

xrandr ×1