Posts

c# - How to convert to System.Int32 when doing a select from a DataTable -

i've got datatable i've loaded csv file using kbcsv library . can tell columns numbers in csv file , there aren't null rows. want select on data table query i've created using string.format. here's query: string qry = string.format("gridx = {0} , gridy = {1} , convert([{2}], 'system.int32') {3} {4}", xc, yc, _testdatacolumn, _comparison, _threshold); where xc double, yc double, _testdatacolumn string, _comparison string , _threshold double. table.select() method converts string to: gridx = 0 , gridy = 4 , convert([st devssi(dbm)], 'system.int32') = 5 i put convert in there because before getting a cannot perform '=' operation on system.string , system.int32 error message. i've looked @ this help. don't understand how last column (st devssi) became string. doing conversion correctly? there way take care of such errors? if run code sample csv file should same error when searches coordinates (0, 4) looks...

jquery - deleting last character from span text? -

i have span element text. keep on appending based on events. works fine using $("#id").append(txt); . not able delete it. tried using $("#id").slice(0, -1) $("#id").val().slice(0, -1); values displayed on page remain same. should using substr or something? tried google couldn't come this? possible using jquery? you can use this : $(selector).text(function(i,v){ return v.slice(0,-4); });

ios - how to parsing data in JSON to tableview -

i have json http://vmg.hdvietpro.com/ztv/home , how parsing data json in link table view. try code cant data json application.thanks help movies.h @interface movies : nsobject @property (strong,nonatomic) nsstring *moviesid; @property (strong,nonatomic) nsstring *text1; @property (strong,nonatomic) nsstring *thumbnail; #pragma mark - #pragma mark class methods -(id)initwithmoviesname:(nsstring *)ctext1 andthumbnail:(nsstring*) cthum andmoviesid:(nsstring*) cid; @end movies.m @implementation movies @synthesize text1,moviesid,thumbnail; -(id)initwithmoviesname:(nsstring *)ctext1 andthumbnail:(nsstring*) cthum andmoviesid:(nsstring *) cid{ self=[super init]; if (self) { text1=ctext1; thumbnail=cthum; moviesid=cid; } return self; } @end tableviewcontroller #define getdataurl @"http://vmg.hdvietpro.com/ztv/home" -(void) retrievedata{ nsurl *url=[nsurl urlwithstring:getdataurl]; nsdata *data=[nsdata datawi...

sql - Difference between NULL and Blank Value in Mysql -

i have check value of particular column named result blank or not. when check if result null , query failed, when checked result='' , worked. what difference between two. please explain. "update rls_tp_2012_03 a, rls_tp_2012_03 b set a.comment=b.comment b.tcode='t1199' , a.groupname='xyz' , a.hlabno=b.hlabno , a.result =''; "; "update rls_tp_2012_03 a, rls_tp_2012_03 b set a.comment=b.comment b.tcode='t1199' , a.groupname='xyz' , a.hlabno=b.hlabno , a.result null; " null absence of value. empty string value, empty. null special database. null has no bounds, can used string , integer , date , etc. fields in database. null isn't allocated memory, string null value pointer pointing in memory. however, empty allocated memory location, although value stored in memory "" .

haskell - Use relative paths for extra-lib-dirs on cabal -

i have c library "myboo" has makefile. want make wrapper of library. don't want install /usr/local since "myboo" not major module. additionally recommended build "myboo" not dynamic library static library. i make custom setup.py build "myboo"; main :: io () main = defaultmainwithhooks simpleuserhooks { prebuild = \a b -> makelib b >> prebuild simpleuserhooks b } makelib :: args -> buildflags -> io () makelib _ flags = let verbosity = fromflag $ buildverbosity flags cflags <- lookupenv "cflags" >>= return . maybe "" id setenv "cflags" $ "-fpic" ++ (' ' : cflags) rawsystemexit verbosity "env" ["make", "--directory=myboo", "libmyboo.a"] and arrange myboo.cabal link haskell codes c library; library exposed-modules: myboo build-depends: base >=4.7 && <4.8 hs-source-...

xsd pattern not working with more than two regex separated by OR ( | ) -

i facing problem following xsd pattern ... <xsd:pattern value="\d+(,\d+)*(,[*])|\d+(,\d+)*|\d+(,[*])(,\d+)+" /> in above pattern want allow user enter following patterns only: 1,2,3 1,*,3 1,2,* but when try enter 1,2,* gives me following exception ... unknown exception occurred while updating = input string: "*" i not see wrong expression can improved , doing might prevent error. fault might in way results of regular expression used, not regular expression itself. the regular expression given in question \d+(,\d+)*(,[*])|\d+(,\d+)*|\d+(,[*])(,\d+)+ . testing in notepad++ v6.5.5 shows matches 3 example lines, expression not anchored start , end of line. adding 1 ^ , 1 $ not sufficient because of precedence of | . using expressions matches lines: ^(\d+(,\d+)*(,[*])|\d+(,\d+)*|\d+(,[*])(,\d+)+)$ could use ^\d+(,\d+)*(,[*])$|^\d+(,\d+)*$|^\d+(,[*])(,\d+)+$ seems harder read , understand. within regular expression the [*] ...

java - JUnit using mockito -

i have a service class named service.class , 2 classes named a.class , b.class service class has method calls methods based on object of classes & b. how can create mockito object of & b can pass mockito object in service class method.which needed junit testing. eg. service.class class service { a; response response; public service(){ } public service(a a, b b){ this.a= a; this.b = b; } public respose test(inputstream i,inputstream i1){ inputstream instreama = a.method1(i,i1); response response= response.method2(instreama); return response; } , in response.class public response method2(inputstream i1)){ return response.ok().build(); } edit: junit class have created both classes mockeda = mock(a.class); response mockedresponse = mock(response.class); ...