Posts

Featured post

Using 'OR' and 'AND' in SQL Server -

is using ( condition or condition b , condition c ) the same as ( condition , condition c) or (condition b , condition c) no. first condition is: (condition a) or (condition b , condition c) and second is: (condition , condition c) or (condition b , condition c) you can see difference between them.

Update existing design of a website, use of CSS -

i'd opinions if plan worthwhile or not. have existing site, , elements have css class defined. thought append each element has class new class: <div class="existingclass"> would turn into: <div class="existingclass newclass"> then, if want override attributes in "existingclass", in "newclass" (because last class attributes taken?). figure way, nothing break, not risk because not removing "existingclass". any problems plan? first know in existingclass . write newclass in such manner won't break layout. knowing in existingclass use tools firebug save time.

node.js - Sanitizing data before saving to Mongoose -

i trying create pre handler sanitizes data before written mongodb see: http://mongoosejs.com/docs/middleware.html i've tried following each property able sanitize it: blogschema.pre('save', function (next) { var obj = this; console.log(obj)//-> https://gist.github.com/daslicht/70e0501acd6c345df8c2 // i've tried following single items : object.keys(obj).foreach(function (key) { console.log('keys: ',obj[key]); }); //and: for(var key in obj) { console.log(obj[key]) } //and: _.each( self , function(value, key, list){ console.log('value:',key); }) next(); }) any of above approaches results following: thats output of: for(var key in obj) { console.log(obj[key]) } https://gist.github.com/daslicht/cb855f53d86062570a96 any know how each single property can sanitize it, please? ~marc [ed

select - MySql variable sequential calculation with group by do not work properly -

a table following , query give desired result. select col1, col2, col3, @a:=@a+(col2+col3) col4 test join (select @a:=0)t col1 | col2 | col3 | col4 ------------------------- | 1 | 1 | 2 b | 2 | 0 | 4 c | 3 | 0 | 7 | 0 | 2 | 9 but when use group not work properly. have solution? select col1, sum(col2)col2, sum(col3)col3, @a:=@a+sum(col2+col3) col4 test join (select @a:= 0)t group col1 col1 | col2 | col3 | col4 ------------------------- | 1 | 3 | 4 b | 2 | 0 | 2 << 6 c | 3 | 0 | 3 << 9 first row fetched correctly. row2 , row3 did not calculate previous row col4 value previous example. can not understand problem! try code, worked me :) select col1, col2,col3, @a:=@a+(col2+col3) col4 (select col1,sum(col2)col2,sum(col3)col3 test group col1) tes join (select @a:= 0)t i made fiddle : http://sqlfiddle.com/#!2/9b3ac/44 hope helps ;)

php - Not having any luck with preg_match -

im trying parse url last 2 / sections. need address (can that) , number(second section {ie:08078612,08248595} unless @ last , no address present {last url list example} {ie: 8274180}) optionally need last 3 digits of second numbers section.{ie 612,595,180} im not having luck heres code far. $url_list[] = $url; if(preg_match("/[0-9]/",substr(strrchr($url, '/'), 1))) { $url_list_mls[]= substr(strrchr($url, '/'), 2); $url_list_mls_last3[] = substr(strrchr($url, '/'), -3); } else { $url_list_mls[]= substr(strrchr($url, '/'), 1); $url_list_mls_last3[] = substr(strrchr($url, '/'), -3); } $url_list_addy[]= substr(strrchr($url, '/'), 1); example urls (part of full url endings examples) /a019/08078612/214-n-crest-avenue /a019/08248595/111-n-elroy-avenue /a019/8274180 im trying make 3 lists, address (last section) number (second section) , last 3 numbers of second section number. the original code

visual studio - TFS will not accept changes I've made to a Java project -

i using tfs's team explorer manage visual studio projects. recently, i've created new java project (not in visual studio) manually added tfs using source control control explorer in visual studio. after added java project tfs, made changes , bug fixes. then, went visual studio , opened source control explorer check in changes, tfs thinks no changes made. it seems needed check out project before making changes. guess erroneously expected tfs track automatically, okay. so, using source control explorer in tfs, checked out project, , tried check in pending changes. when tried check in, got following message: all of changes either unmodified files or locks. changes have been undone server. is there way convince server indeed project has changed? how can check in changes have made? thank help.

java - How to Configure JAXRS and Spring With Annotations -

i working on little spring web service project. here example route: package com.example.api; import javax.ws.rs.get; import javax.ws.rs.path; import javax.ws.rs.produces; import javax.ws.rs.pathparam; import javax.ws.rs.ext.provider; import javax.ws.rs.core.mediatype; @provider public class webserviceroutes { @get @path("/hello") public string health() { return "hello"; } } then in spring configuration class: package com.example.api; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; @configuration public class springcontextconfiguration { @bean( destroymethod = "shutdown" ) public springbus cxf() { return new springbus(); } @bean public webserviceroutes webserviceroutes() { return new webserviceroutes(); } } and in web.xml: <?xml version="1.0" encoding="utf-8"?> <web-app version=&