小编Com*_*eek的帖子

PowerShell 3的文件扩展名

我们所有人都可能知道.bat批处理文件.

但是PowerShell 3脚本的文件扩展名是什么?

我发现了.ps1一些其他的结局,但它们仅适用于版本1.

windows shell powershell windows-8

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

哪个MySQL数据类型用于IP地址?

可能重复:
如何在mySQL中存储IP

我想获取IP地址$_SERVER['REMOTE_ADDR']和其他一些$_SERVER变量,哪种数据类型是正确的?

VARCHAR(n)吗?

php mysql types ip-address

91
推荐指数
3
解决办法
10万
查看次数

qsort:转换比较器函数本身还是比较器函数体中的参数?

有几种明显的使用方法qsort:在比较器中强制转换:

int cmp(const void *v1, const void *v2) 
{
    const double *d1 = v1, *d2 = v2;
    ?
}

qsort(p, n, sizeof(double), cmp);
Run Code Online (Sandbox Code Playgroud)

或投射比较器:

int cmp(const double *d1, const double *d2) 
{
    ?
}

qsort(p, n, sizeof(double), (int (*)(const void *, const void *))cmp);
Run Code Online (Sandbox Code Playgroud)

我倾向于使用前者,更多的是出于审美原因。是否有任何技术上的原因偏爱其中一个?

c qsort

35
推荐指数
3
解决办法
1062
查看次数

如何在Eclipse中使用JavaFX 2 SDK?

我已经安装了JavaFX 2.0 SDK,现在我想用Eclipse做一个JavaFX应用程序.但是我如何javafx.*在Eclipse中使用这些类?

官方的JavaFX Eclipse插件似乎是为JavaFX 1.2和过时.

当我尝试安装e(fx)clipse插件时,我收到此错误:

Cannot complete the install because one or more required items could not be found.
  Software being installed: efxclipse 0.0.8.201111131640 (at.bestsolution.efxclipse.feature.feature.group 0.0.8.201111131640)
  Missing requirement: Eclipse DI integration for JavaFX 0.0.8.201111131640 (at.bestsolution.efxclipse.runtime.di 0.0.8.201111131640) requires 'bundle org.eclipse.e4.core.contexts 0.9.0' but it could not be found
  Cannot satisfy dependency:
    From: efxclipse 0.0.8.201111131640 (at.bestsolution.efxclipse.feature.feature.group 0.0.8.201111131640)
    To: at.bestsolution.efxclipse.runtime.feature.feature.group [0.0.8.201111131640]
  Cannot satisfy dependency:
    From: FX Runtime 0.0.8.201111131640 (at.bestsolution.efxclipse.runtime.feature.feature.group 0.0.8.201111131640)
    To: at.bestsolution.efxclipse.runtime.di [0.0.8.201111131640]
Run Code Online (Sandbox Code Playgroud)

eclipse javafx-2

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

CSS保证金如何运作?

在下面的代码,不应该之间的裕度.box1.box220像素作为.box1具有10px的底部边缘和.box2具有10px的上边距.

<div class="box">
    <div class="box1"></div>
    <div class="box2"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.box1{
    margin-bottom: 10px;
}

.box2{
    margin-top: 10px;
}
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/3C7bW/

html css

28
推荐指数
3
解决办法
2041
查看次数

IndexIgnore*或Options -Indexes

我一直习惯Options -Indexes通过.htaccess禁用目录列表.但是,我见过人们使用IndexIgnore *.有什么不同?哪个比另一个好?

apache .htaccess

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

Timestamp.valueOf()根据JVM版本返回不同的值

Timestamp sTs = Timestamp.valueOf("1900-12-31 23:59:59.999"); // Make Timestamp
System.out.println("sTs====>" + sTs.getTime());

sTs====> -2177485200001  // in jdk 1.4


Timestamp sTs = Timestamp.valueOf("1900-12-31 23:59:59.999"); // Make Timestamp
System.out.println("sTs====>" + sTs.getTime());

sTs====> -2177483400001  // in jdk 1.5
Run Code Online (Sandbox Code Playgroud)

为什么两个值不同?

java datetime

20
推荐指数
2
解决办法
841
查看次数

删除appendChild添加的不需要的(空)xmlns属性

我有这个代码:

function setupProject($projectFile) {
  [xml]$root = Get-Content $projectFile;

  $project = $root.Project;

  $beforeBuild = $root.CreateElement("Target", "");
  $beforeBuild.SetAttribute("name", "BeforeBuild");
  $beforeBuild.RemoveAttribute("xmlns");
  $project.AppendChild($beforeBuild);

  $root.Save($projectFile);
}
Run Code Online (Sandbox Code Playgroud)

应该<Target name="BeforeBuild" />为XML文档添加一个新内容.

但它也添加了一个xmlns=""我不想要的空属性.(它实际上是Visual Studio,它不喜欢这个属性!)

<Target name="BeforeBuild" xmlns="" />
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这段代码:

$beforeBuild.RemoveAttribute("xmlns");
$project.AppendChild($beforeBuild);
$beforeBuild.RemoveAttribute("xmlns");
Run Code Online (Sandbox Code Playgroud)

xml powershell dom appendchild

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

解析JSON时"传递了无效数组"

我有这个文件,我想用PowerShell阅读:

var myMap =
[
  {
    "name": "JSON Example",
    "attr": "Another attribute"
  }
]
Run Code Online (Sandbox Code Playgroud)

我的PowerShell v3代码:

$str = Get-Content $file | Select -Skip 1;
$str | ConvertFrom-Json;
Run Code Online (Sandbox Code Playgroud)

但我总是得到这个错误:

ConvertFrom-Json : Invalid array passed in, ']' expected. (1): [
At S:\ome\Path\script.ps1:60 char:8
+ $str | ConvertFrom-Json;
+        ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
Run Code Online (Sandbox Code Playgroud)

如果我手动将JSON代码复制并粘贴到代码中,一切正常:

'[
  {
    "name": "JSON Example",
    "attr": "Another attribute"
  }
]' | ConvertFrom-Json;
Run Code Online (Sandbox Code Playgroud)

powershell json powershell-3.0

16
推荐指数
2
解决办法
5945
查看次数

对实体"子集"的引用必须以";"结尾 分隔符

我试图在Blogger博客的模板中包含webfonts:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
  <head>
    <link href='http://fonts.googleapis.com/css?family=Share:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Istok+Web:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
    <meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
    <b:if cond='data:blog.isMobile'>
      <meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
    <b:else/>
Run Code Online (Sandbox Code Playgroud)

当我尝试保存模板时,我得到:

Error parsing XML, line 5, column 76: The reference to entity "subset" must end with the ';' delimiter.
Run Code Online (Sandbox Code Playgroud)

我试图添加;但不成功.链接是从Google Web Font生成和获取的.

我该如何解决这个问题?谢谢.

html xml google-webfonts

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