小编JJJ*_*JJJ的帖子

如何使用媒体打印,谷歌地图

我有一个带有Google地图的页面的webbrowser视图.

浏览器视图

然后我添加了一些@Media Print样式

<style type="text/css">
        @media print
        {
        body{font-family:georgia,times,sans-serif;}
        img{max-width:500px;}
        #headerblock{display:none;}
        #navigationblock{display:none;}
        #thewaydiv{display:block;}
        #footerblock{display:none;}
        #contentmap{min-height:100px; position:relative; width:100%;}
        #map{border-bottom:0px; border-left:0px; border-top:0px; border-right:0px; height:250px; margin-top:0px; width:100%;}
        }
    </style>
Run Code Online (Sandbox Code Playgroud)

当我然后使用打印页面或打印视图,然后我得到这个:

打印视图

正如您所看到的那样,Google地图的页面大小正常,但它太大/只是真实图像的一小部分.我该如何解决这个问题,以便在打印视图中获得类似浏览器视图的Google图像?

html css google-maps css3

6
推荐指数
1
解决办法
3098
查看次数

正则表达式以检查重复字符

我必须创建一个正则表达式,允许在文本"*ALL"(不区分大小写)中包含az,AZ和0-9范围内的OR字符,它们必须长度为17个字符.我没有遇到任何问题:

^([\*][Aa][Ll][Ll]|[a-zA-Z0-9]{17})$
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是如何改变它,以便只要输入相同的字符多次(例如17 x)就可以获取它.

regex

6
推荐指数
2
解决办法
2万
查看次数

创建多行div

我想创建一个2x2设置,由4个div元素组成.到目前为止,看我的小提琴inline-block用于我的显示器.我想分别在1和2的正下方有"div 3"和"div 4".没有花车有没有办法做到这一点?

HTML:

<div class = "blocks">
    div 1
</div>

<div class = "blocks">
    div 2
</div>

<div class = "blocks">
    div 3
</div>

<div class = "blocks">
    div 4
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.blocks {
    display: inline-block;
    border: solid 1px red;
    width: 100px;
}
Run Code Online (Sandbox Code Playgroud)

css

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

隐藏所有浏览器中的地址栏

我需要通过我的JavaScript代码隐藏所有浏览器的地址栏.有可能吗?

这是我的代码:

window.open("displayPdf.php?mnth="+mnth+"&year="+year+"&val="+newVal);
    dom.disable_window_open_feature.location
    dom.disable_window_open_feature.resizable
    dom.disable_window_open_feature.status
Run Code Online (Sandbox Code Playgroud)

javascript

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

有没有办法查询并找出安装的Vertica版本?

我在Vertica文档中搜索了关键字VersionVersion Number.但我真的没有提到SQL查询来选择安装的Vertica版本.我以为会有一些系统表有一些版本信息,但找不到任何.

是否无法使用SQL查询安装Vertica版本?或者只能通过登录Vertica主机并检查某个目录来访问版本?

sql version vertica

6
推荐指数
1
解决办法
8344
查看次数

Sublime text 2 搜索并替换为随机数

是否可以用随机数搜索和替换文本字符串,例如

Search: "This is the number 23 and i like it"

replace: "this is the number " . Rand(0,100) . " and i like it"

那可能吗?

regex ide sublimetext sublimetext2

6
推荐指数
1
解决办法
1904
查看次数

找出Looper或HandlerThread中的泄漏问题

我使用了一些处理程序

           new Handler(Looper.getMainLooper()).post(new Runnable() {

            @Override
            public void run() {
                try{
                    Messages.onAcknowledgeReceived();                                       

                }catch(Exception e){
                    e.printStackTrace();
                }

                }
            }); 
Run Code Online (Sandbox Code Playgroud)

它每15秒执行一次,有时它开始抛出一些警告

 The Looper class instance count has over a limit(100). There should be some leakage of Looper or HandlerThread.
 12-16 12:16:11.357: E/Looper(4647): Looper class instance count = 221
 12-16 12:16:11.357: E/Looper(4647): Current Thread Name: IntentService[AppService]
 12-16 12:16:12.316: E/Looper(4647): WARNING: The Looper class instance count has over a   limit(100). There should be some leakage of Looper or HandlerThread.
 12-16 12:16:12.318: E/Looper(4647): Looper class …
Run Code Online (Sandbox Code Playgroud)

android android-handler android-looper

6
推荐指数
0
解决办法
933
查看次数

角度通用闪烁

我在加载网站时出现闪烁。来自服务器的 HTML 被下载,然后在 UI 中呈现视图,并且在转换之间有一个小的闪烁。

我设法通过添加来修复它:

RouterModule.forRoot([ // ROUTES HERE ], { initialNavigation: 'enabled' })
Run Code Online (Sandbox Code Playgroud)

但我想知道为什么会这样?因为组件的懒加载?所以我们在 UI(角度组件)构建 DOM 的过渡之间出现了闪烁?假设我有一个“轻”组件,闪烁会更快?

angular-universal angular

6
推荐指数
1
解决办法
9031
查看次数

为什么intellij在使用评估日志作为断点时打印"void"?

我在intellij中写了这个Java代码:

public class Main {
    public static void main(String[] args) {
        int[] a = {1,1,1,1,1,1};
        for(int i = 0; i < a.length; ++i) {
            a[i]++;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

接下来,我在for循环中设置一个断点,就像这样.

断点

接下来我转到"查看断点"菜单,可以通过ctrl + shift + f8进行访问,并为我的断点输入这些设置.

断点设置

然后我点击调试按钮,我的输出是这样的:

void
1
void
1
void
1
void
1
void
1
void
1
Run Code Online (Sandbox Code Playgroud)

为什么intellij在输出中打印"void"?

java intellij-idea

6
推荐指数
1
解决办法
313
查看次数

如何在专注于开发工具的同时在 Electron 应用程序中切换开发工具?

我想让我的 Electron 应用程序切换开发人员工具以响应 F12。

在渲染器页面中,我添加了:

const currentWebContents = require("electron").remote.getCurrentWebContents();
window.addEventListener("keydown", (e: KeyboardEvent) => {
    if (e.keyCode === 123) { // F12
        currentWebContents.toggleDevTools();
    }
});
Run Code Online (Sandbox Code Playgroud)

当我专注于主页时,这会起作用。但是,开发工具打开后,焦点立即转到开发工具,因此F12不再检测到。

我尝试通过在调用后立即向 devtools webcontents 添加侦听器来解决此问题,toggleDevTools()如下所示:

if (currentWebContents.devToolsWebContents) {
    currentWebContents.devToolsWebContents.on("before-input-event", (event: Electron.Event, input: Electron.Input) => {
        if (input.type === "keyDown" && input.key === "F12") {
            currentWebContents.toggleDevTools();
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

然而,打开后currentWebContents.devToolsWebContents就是这样。null我的第一个问题是如何确保它不是null- 有没有办法等到它完全打开?

我通过将if (currentWebContents.devToolsWebContents)代码放入setTimeout(..., 1000);

然而,这样做后,当我before-input-event专注于开发工具时按下按键时,我的处理程序不会被触发。

有人知道这是为什么吗?

google-chrome-devtools electron

6
推荐指数
1
解决办法
3776
查看次数