我正在使用以下代码收到文件的最后修改日期:
xmlUrl = new URL("http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html");
URLConnection urlconn = xmlUrl.openConnection();
urlDate = new Date(urlconn.getLastModified());
Run Code Online (Sandbox Code Playgroud)
结果我得到以下格式的日期:
Tue Dec 18 05:11:33 Asia/Karachi 2007
Run Code Online (Sandbox Code Playgroud)
我想将其更改为简单的dd MMM yyyy格式
我用了:
SimpleDateFormat format = new SimpleDateFormat("dd MMM yyyy");
try {
tempDate = format.parse(urlDate.toString());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但它没有帮助我解决这个问题,我仍然以上述长格式获取日期.
到处都说Java标识符可以以包括$和的所有字符(但不是数字)开头_
但我注意到,类似的方法isJavaIdentifierStart返回true,也为其他字符像§,£,€等
然而,正确的字符串启动标识符是正确的吗?
好的,所以这可能是一个学术问题.有人能告诉我C++的投射操作符是否/如何转换为Objective-C ...或者如何/为什么它们没有必要?
我已经离开了几年的C++循环,似乎每次我转身他们添加一些新的关键字.我最近介绍了C++的各种转换操作符reinterpret_cast,static_cast,dynamic_cast和const_cast.当这些情况出现时你需要使用所有这些类型的演员表时,我有点模糊.
我已经使用Objective-C一两年了,对它感觉相当舒服.(直到那时候大部分都是C人).我试图理解为什么C++似乎具有所有这些复杂性.换句话说,什么是Objective-C缺少它似乎没有(或需要?)这么多的铸造类型?
我有一个BaseEntity类,它是我的应用程序中所有JPA实体的超类.
@MappedSuperclass
public abstract class BaseEntity implements Serializable {
private static final long serialVersionUID = -3307436748176180347L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", nullable=false, updatable=false)
protected long id;
@Version
@Column(name="VERSION", nullable=false, updatable=false, unique=false)
protected long version;
}
Run Code Online (Sandbox Code Playgroud)
每个JPA实体都延伸BaseEntity并继承id和version属性BaseEntity.
这里实施equals()和hashCode()方法的最佳方法是BaseEntity什么?BaseEntity将继承equals()和hashCode()行为形式的每个子类BaseEntity.
我想做这样的事情:
public boolean equals(Object other){
if (other instanceof this.getClass()){ //this.getClass() gives class object but instanceof operator expect …Run Code Online (Sandbox Code Playgroud) 我有一个程序,它使用app.config存储一些首选项.问题是,如果程序安装在C:\ program files\<项目名称>中,则由于程序文件\ <项目名称>中的所有文件仅供管理员使用,因此无法更改首选项.
我的代码:
public static bool EditKeyPair(string key, string value)
{
bool success = true;
// Open App.Config of executable
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
KeyValueConfigurationCollection settings = config.AppSettings.Settings;
// update SaveBeforeExit
settings[key].Value = value;
if (!config.AppSettings.SectionInformation.IsLocked)
{
//save the file
config.Save(ConfigurationSaveMode.Modified);
Debug.WriteLine("** Settings updated.");
}
else
{
Debug.WriteLine("** Could not update, section is locked.");
success = false;
}
//reload the section you modified
ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name);
return success;
}
Run Code Online (Sandbox Code Playgroud)
问题是:有没有办法提升这个行动的特权?或者如何解决问题呢?
谢谢!
我有一个SQL Server 2008版本数据库(版本号655).如果我尝试创建将其附加到SQL Server 2005或SQL Server 2000,我收到一个错误:
此数据库的版本为655.此服务器与版本612或之前的版本兼容
当然,我可以将数据库附加到SQL Server 2008而不会出现错误.我知道我可以为结构生成SQL命令,但许多表中也有很多数据.
如果我可以更改内部数据库版本(兼容级别现在设置为SQL Server 2000),则任何服务器版本中的附加进程都将起作用,因为此进程会自动更新版本.
有什么建议?
编辑:我刚刚意识到,如果版本号的更新是自动的,那么将无法进行版本更改.所以,我重新提出了这个问题:
你知道任何生成"包"的工具,其数据和结构与2000年到2008年的SQL Server版本兼容吗?也许是工具或脚本.
再次感谢.
提前致谢.
是否有可能获得在android的警报应用程序中保存的警报列表?我正在制作一个应用程序,只需要显示警报应用程序中设置的警报.
感谢名单
如何CString在vc ++中通过分隔符拆分对象?
例如,我有一个string值
"一+二+三+四"
变成一个CString可变的.
我有一个菜单栏,有几个子菜单项.主页包含位于菜单栏下方的flash动画.当子菜单项位于Flash文件上时,Flash文件将显示在菜单栏上.我尝试使用z-index,但它不起作用.
这个问题只发生在IE中.
有小费吗?
谢谢
java ×3
alarms ×1
android ×1
app-config ×1
c ×1
c# ×1
c++ ×1
casting ×1
css ×1
date ×1
equals ×1
flash ×1
hashcode ×1
html ×1
jpa ×1
linker ×1
mfc ×1
objective-c ×1
parsing ×1
privileges ×1
sql-server ×1
tostring ×1
visual-c++ ×1