我知道这可能是一个简单的问题,但我是Java新手,我的经验主要是使用PHP或C#.
我正在研究eclipse RCP项目并使用Google Window Builder.
我需要做的就是从名为的DateTime控件获取日期:dateTimeDOB
如果日期或月份值是单个数字,它必须具有前面的"0",它必须以此格式(dd/mm/yyyy)返回日期.
我认为DateTime控件类型是
org.eclipse.swt.widgets.DateTime
Run Code Online (Sandbox Code Playgroud)
例如:
String strDate = dateTimeDOB.getDate("dd/mm/yyyy");
Run Code Online (Sandbox Code Playgroud)
提前致谢
我使用.load()和.show()来动态加载一些HTML.
//load the html
$('#mydiv').load('some_url');
// Display
$('#mydiv').show();
Run Code Online (Sandbox Code Playgroud)
但是在这里我需要调用一个只存在于动态内容中的Javascript函数,如何判断.load()是否完整?
我的 HTML 页面上有一个 SVG 图像,其周围显示出非常细的边框(底部可见一条水平线)。
我曾尝试删除边框。
我已将 SVG 引用为图像标签中的外部文件
<img class="svgfix" src="img/home_footer_header.svg" alt="" width="100%" />
Run Code Online (Sandbox Code Playgroud)
<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="237.239" viewBox="0 0 1920 237.239">
<g id="HomeFooter_Seperater" transform="translate(0 -1767.761)">
<rect id="Rectangle_610"
data-name="Rectangle 610"
width="1920"
height="122"
transform="translate(0 1883)"
style="fill:rgb(58,58,58)"
fill="#3a3a3a" />
<path id="Seperator_Black" d="M-2652,3221.992l1920-86.4v141.95l-1920,85.376Z" transform="translate(2652 -1367.826)"/>
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
img.svgfix {
border: 0;
background-clip: padding-box;
color: transparent;
}
Run Code Online (Sandbox Code Playgroud)
我必须阅读一个XML文档并将值插入到List<T>我的对象中.
+Result
-username
-dob
-answer1
-answer2
-uuid
Run Code Online (Sandbox Code Playgroud)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<export exportDate="2012-11-07T12:03:52.823+11:00">
<survey type="USER" completion="2012-11-07T11:46:52.754+11:00" reference="2012-11-07T11:30:34.680+11:00" year="2012" uuid="226f2aa3-46e6-46ab-8995-7d52eb21d5f4">
<user xsi:type="USER" created="2012-11-07T11:09:30.409+11:00" dob="08/06/1988" surname="Billy" name="Bob" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<subject created="2012-11-07T11:09:30.409+11:00" dob="08/06/1988" surname="Billy" name="Bob"/>
<version released="1970-01-01T10:00:02.012+10:00" version="1"/>
<result group="2" rawscore="2.4" metric="1"/>
<result group="2" rawscore="2.0" metric="2"/>
<answer score="1" question="6"/>
<answer score="2" question="7"/>
</survey>
</export>
Run Code Online (Sandbox Code Playgroud)
我之前使用的是XmlDocument,但是现在我正在使用Linq,我确信这可以在几行内完成.我不喜欢下面代码的外观,如果反正有一些提示请帮忙.
谢谢
List<Result> results = new List<Result>();
XmlDocument doc = new XmlDocument();
doc.Load(filename);
XmlNodeList objects = doc.GetElementsByTagName("survey");
foreach (XmlNode o in …Run Code Online (Sandbox Code Playgroud) 在C#中获取文件扩展名非常简单,
FileInfo file = new FileInfo("c:\\myfile.txt");
MessageBox.Show(file.Extension); // Displays '.txt'
Run Code Online (Sandbox Code Playgroud)
但是我的应用程序中有多个句点的文件.
FileInfo file = new FileInfo("c:\\scene_a.scene.xml");
MessageBox.Show(file.Extension); // Displays '.xml'
Run Code Online (Sandbox Code Playgroud)
我希望能够提取.scene.xml名称的一部分.
更新
扩展名还应包括初始扩展名.
我怎样才能得到这个FileInfo?
我相对较新的PHP,但已意识到它是一个强大的工具.所以请原谅我的无知.
我想创建一组具有默认功能的对象.
因此,不是在类中调用函数,而是可以输出类/对象变量,它可以执行默认函数即toString()方法.
问题: 有没有办法在类中定义默认函数?
例
class String {
public function __construct() { }
//This I want to be the default function
public function toString() { }
}
Run Code Online (Sandbox Code Playgroud)
用法
$str = new String(...);
print($str); //executes toString()
Run Code Online (Sandbox Code Playgroud) 我试图获取所有带有名称的复选框,如果图像[].
我通常会
imgs = $('input:checkbox[name=images]:checked').map(function() { return this.value; }).get();
Run Code Online (Sandbox Code Playgroud)
以下代码是我尝试过但无法正常工作的代码.
imgs = $('input:checkbox[name=images[]]:checked').map(function() { return this.value; }).get();
Run Code Online (Sandbox Code Playgroud) 有没有办法确定C#/ .NET中的文本格式
这样的事情会非常有用.
public TextFormat TextTools.GetTextFormat(string text);
switch(TextTools.GetTextFormat(mystring))
{
case TextFormat.RichText: break;
case TextFormat.PlainText: break;
}
Run Code Online (Sandbox Code Playgroud)
我在msdn上四处寻找,但找不到这样的工具
我为我的应用创建了一个通用的数据库处理程序类.
我SqlCeConnection正在使用本地数据库,因此这里正在使用类.
我想要做的是测试Connection字符串是否有效,因此在执行之前更新连接状态给用户 connection.Open();
我们说吧
SqlCeConnection conn = new SqlCeConnection(connectionString);
//so far we have only created the connection, but not tried to open it
//Would be nice to update the UI to say that conn is OK
conn.testConnection();
conn.Open();
Run Code Online (Sandbox Code Playgroud)
我的想法写,试图方法的open再close连接,我是不是就在想这还是有更好的办法.
可能重复:
检测分辨率c#WinForms的更改
我写了一个应用程序C#,我的窗口停靠在屏幕的边缘.
我需要知道在哪里可以找到,event如果resolution has changed我可以调用Dock方法,那么我可以重新绘制我的窗口.
在表单对象上,我只能看到该SystemColorsChanged事件.