我需要按日期/时间字段对PostgreSQL表进行排序,例如last_updated
.
但是,该字段允许为空或空,我想与空记录last_updated
来之前,非空last_updated
.
这可能吗?
order by last_updated asc /* and null last_updated records first ?? */
Run Code Online (Sandbox Code Playgroud) 我有机会向我的老板正式介绍有益于公司的任何事情.我的想法是在我的工作场所采用源代码控制.我一直在使用Mercurial来管理我自己的工作项目,但团队的其他成员没有正式的源代码控制系统.不幸的是,我不善于提出想法.
所以,你们能告诉我为什么开发人员必须使用源代码控制吗?另外,为什么你会选择除 Visual SourceSafe 之外的任何工具?我没有使用VSS的经验,但他可能会问为什么我们不会只使用微软的工具.
我想听听很多聪明的程序员的意见!我首选的选项是SVN或mercurial.两者似乎都对Windows版本有很好的支持,而且两者都不如CVS那么古老.另外,作为一个自称为开源的门徒,我更愿意提出一个开源工具.:)
谢谢!
编辑:为了简化,一般来说,其他开发人员目前的做法是复制文件夹,标记日期,也可以自己录制.你得到了照片.如果我的老板说"如果它有效,为什么要解决它?"
对于桌面应用程序.这只是一个普遍的问题,可能只需要一般的答案.
在Windows中,我可以使用winmerge作为hg的外部差异工具,使用mercurial.ini等.
使用你可以在网上找到的一些选项开关(我认为这是一个日本网站)无论如何,这里举例如下:
hg winmerge -r1 -r2
将在winmerge中列出rev1和rev2之间的文件更改.我可以点击哪个文件来区分
但对于bc3:
hg bcomp -r1 -r2
将使bc3打开一个对话框,表明无法找到临时目录.
我能用bc3和hg做的最多的是
hg bcomp -r1 -r2 myfile.cpp
这将打开myfile.cpp的rev1和rev2之间的差异
因此,似乎hg + bc3无法成功确认所有文件在修订之间发生变化.一次只能传播1个文件.
谁能更好地使用bc3 + hg?
编辑:问题解决了!
从http://www.scootersoftware.com/support.php?zz=kb_vcs.php>scooter支持页面获得解决方案.我必须使用bcompare而不是bcomp 这里是我的mercurial.ini的片段
[extensions] hgext.win32text = ;mhd adds hgext.extdiff = ;mhd adds for bc [extdiff] cmd.bc3 = bcompare opts.bc3 = /ro ;mhd adds for winmerge ;[extdiff] ;cmd.winmerge = WinMergeU ;opts.winmerge = /r /e /x /ub
在c(或c ++)中,有什么区别
char myarr[16]={0x00};
和
char myarr[16]; memset(myarr, '\0', sizeof(myarr));
??
编辑:我问这个是因为在vc ++ 2005中结果是一样的..
编辑更多:和
char myarr[16]={0x00,};?
我需要操纵涉及插入中间的固定数组中的数据.而不是使用memcpy等.我想用矢量.当我想将矢量元素复制回c风格的数组时,我有问题.这是代码:
void tryvector()
{
using namespace std;
const int MAX_SIZE=16;
BYTE myarr[MAX_SIZE]={0xb0,0x45,0x47,0xba,0x11,0x12, 0x4e};
vector<BYTE> myvec (myarr, myarr+MAX_SIZE);
vector<BYTE>::iterator it;
printf("myarr pre :");
for(int i=0;i<MAX_SIZE;++i){
printf("%02x ", myarr[i]) ;
}
printf("\nmyvec pre :")
for(it=myvec.begin(); it<myvec.end();++it){
cout<<hex<<static_cast<int>(*it)<<" ";
}
it = myvec.begin()+ 3;
myvec.insert(it,0x5f);
printf("\nmyvec post:");
for(it=myvec.begin(); it<myvec.end();++it){
cout<<hex<<static_cast<int>(*it)<<" ";
}
copy(myvec.begin(), myvec.end(), myarr); //???
printf("\nmyarr post:");
for(int i=0;i<MAX_SIZE;++i){
printf("%02x ", myarr[i]) ;
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用vs 2005.这是警告:
warning C4996: 'std::_Copy_opt' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\xutility(2270) : see declaration …
Run Code Online (Sandbox Code Playgroud) 我仍然无法弄清楚如何使子类构造函数遵循其父...
示例:
require 'mechanize'
class Scraper
attr_accessor :agent
def initialize
# I dont know if using instance variable is the right thing to do
@agent = Mechanize.new
end
end
class ScraperA < Scraper
end
Run Code Online (Sandbox Code Playgroud)
我想ScraperA
遵循它的父构造函数行为,
即在没有我Mechanize.new
在ScraperA initialize()方法中重新输入的情况下实例化一个Mechanize对象 .这可能吗 ?
只是想遵循DRY原则,但红宝石让我很难???
希望不是,也许这只是我的无知.期待简单的解决方案,Tnx.
编辑:
事实证明我在ScraperA中有空的initialize()方法,它覆盖默认的initialize().所以是的,这个例子正在工作,因为那里没有空的初始化方法.抱歉我的愚蠢.TNX.
我想在具有特定模式的html doc中搜索div id.我想在正则表达式中匹配此模式:
foo_([[:digit:]]{1.8})
Run Code Online (Sandbox Code Playgroud)
使用xpath.上述模式的xpath等价物是多少?
我坚持了//div[@id="foo_
,然后呢?如果有人可以继续为其表达法律意见.
编辑
对不起,我想我必须详细说明.实际上它不是foo_
,它是post_message_
顺便说一下,我使用mechanize/nokogiri(红宝石)
这是片段:
html_doc = Nokogiri::HTML(open(myfile))
message_div = html_doc.xpath('//div[substring(@id,13) = "post_message_" and substring-after(@id, "post_message_") => 0 and substring-after(@id, "post_message_") <= 99999999]')
Run Code Online (Sandbox Code Playgroud)
仍然失败了.错误信息:
无法评估表达式'
//div[substring(@id,13) = "post_message_" and substring-after(@id, "post_message_") => 0 and substring-after(@id, "post_message_") <= 99999999]
'(Nokogiri :: XML :: XPath :: SyntaxError)
有没有人尝试使用Ruby开发Android应用程序?如果是这样,你会推荐哪种工具?比较(两者之间)有什么优缺点?
任何经验,见解等的分享将非常感激.
在C代码中,我坚持将一个struct数组传递给一个函数,这里的代码类似于我的问题:
typedef struct { int x; int y; char *str1; char *str2; }Struct1; void processFromStruct1(Struct1 *content[]); int main() { Struct1 mydata[]= { {1,1,"black","cat"}, {4,5,"red","bird"}, {6,7,"brown","fox"}, }; processFromStruct1(mydata);//how?!?? can't find correct syntax return 0; } void processFromStruct1(Struct1 *content[]) { printf("%s", content[1]->str1);// if I want to print 'red', is this right? ... }
msvc中的编译错误是这样的:
error C2664: 'processFromStruct1' : cannot convert parameter 1 from 'Struct1 [3]' to 'Struct1 *[]' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style …