Posts

java - Regexp to match full Exception name -

i need regexp whole exception name incl. dots stacktrace , it's whitespace before it. time: sun apr 10 20:36:57 cest 2011 message: java.lang.nullpointerexception @ com.hello.world.hi.initdb(bla.java:273) something : string test = "time: sun apr 10 20:36:57 cest 2011\nmessage: java.lang.nullpointerexception\n @ com.hello.world.hi.initdb(bla.java:273)"; pattern check = pattern.compile(".*message:(\\s[\\w\\.]*)"); matcher checker = check.matcher(test); while(checker.find()) { system.out.println(checker.group(1)); } output java.lang.nullpointerexception update ok, if want match "exception" word - there way: string test = "time: sun apr 10 20:36:57 cest 2011\nmessage: java.lang.nullpointerexception\n @ com.hello.world.hi.initdb(bla.java:273)"; pattern check = pattern.compile("(\\s[\\w\\.]*exception)"); matcher checker = check.matcher(test); while(checker.find()) { system.out.println(checker.group...

SQL Server date vs smalldatetime -

i have bunch of tables consolidate data on different levels: quarterly, hourly, daily , monthly. apart there's base table contains "raw" data well, 1 contains columns. consolidated tables have same columns. the base, quarterly , hourly tables make use of column of type smalldatetime timestamp data. column available in hourly , daily tables, of course won't need time aspect here. for sake of simplicity want use smalldatetime data type here also, maybe it's better performance use date data type column? is there big difference between types when comes down performance? it's idea use smallest data type need. shouldn't use varchar(max) or varchar(10) store 2 character state abbreviation. in same sense, if need date (e.g. 4/11/2001) use date type , not datetime type. while might not huge gain in performance (datetime 5 bytes larger date.)it can start adding if have multiple fields and/or multiple rows.

.net - C# Console.ReadKey read numbers greater than 9 -

im working consolekeyinfo in c# have problems console.readkey when try write numbers greater 9 in console, example consolekeyinfo number; console.write("write number: "); number = console.readkey(); if want write 10 or 11... console reads "1" i dont wanna use console.readline because don want press "enter" each number. is there way use console.readkey wait maybe 1 second before continue? thanks the best can use console.readline() . there's no way program know have finished number. update if have fixed length number (i.e. 13-digit isbn), can use readkey, this: string isbn = ""; while (isbn.length < 13) { isbn += console.readkey().keychar; }

iphone - Testing NSWidowController using OCMock -

i've been trying come a way unit test applicationdidfinishlaunching delegate using ocmock. nswindowcontroller instantiated here , i'd test it. here's test code: id mockwindowcontroller = [ocmockobject nicemockforclass:[urltimerwindowcontroller class]]; [[mockwindowcontroller expect] showwindow:self]; nsuinteger preretaincount = [mockwindowcontroller retaincount]; [appdelegate applicationdidfinishlaunching:nil]; [mockwindowcontroller verify]; when run test, error: "ocmockobject[urltimerwindowcontroller]: expected method not invoked: showwindow:-[urltimerappdelegatetests testapplicationdidfinishlaunching]" the log gives more detail: "test case '-[urltimerappdelegatetests testapplicationdidfinishlaunching]' started. 2011-04-11 08:36:57.558 otest-x86_64[3868:903] -[urltimerwindowcontroller loadwindow]: failed load window nib file 'timerwindow'. unknown.m:0: error: -[urltimerappdelegatetests testapplicationdidfinishlaunching] : ocm...

iphone - Identify the current Navigation Bar -

i'm trying identify navigation bar in current view can add subview it. i have seen code able identify navigation bar has been dynamically created , tagged: uinavigationbar *thenavigationbar = (uinavigationbar *)[inparent.view viewwithtag:knavigationbartag]; but in case navigation bar not being created dynamically, it's not tagged. there way identify otherwise? self.navigationcontroller.navigationbar only valid when called method in uiviewcontroller, of course. otherwise, try retrieve reference view controller , take there.

javascript - Write mongodb mapReduce result to a file -

i have collection in mongodb data in collection has following structure : {userid = 1 (the id of user), key1 = value1 , key2 = value2, .... } i want write mongodb mapreduce functions put userid in map function , in reduce function need write ( key,value ) pairs in csv (?) file such : key1,key2, key3,... value1,value2,value3,.. value1,value2,value3,.. value1,value2,value3,.. how can mongodb thanks there no "file output" option. the mongodb documentation has details on exporting data . in particular, mongoexport allows export json or csv should legible other software. if want modify data output, you'll have use client library , cursor through data while writing file.

asp.net - Multiple '@' symbol in email address not working with .net 2005 -

in our application send email user of applications. when our user email address paulo.macedo@company.com.br@company, fails exception of system.net.mime.mailbnfhelper.readmailaddress so can email address have multiple '@' symbol , can .net mailmessege object handle it? it possible have few @ signs, have put other 1 in quotes.