Posts

sql server - how to convert rows to columns using sql query -

Image
pls see below query select d.emp_id, e.emp_name, a.proj_code, b.proj_name, a.activity_code, c.activity_name, convert(char(4), a.effort_date, 100) + convert(char(4), a.effort_date, 120) month, a.effort_hours timesheet_activity left join project_master b on a.proj_code = b.proj_code left join activity_master c on a.activity_code = c.activity_code left join timesheet d on a.timesheet_id = d.timesheet_id left join employee_master e on d.emp_id = e.emp_id b.proj_name in ('sales support') , (a.effort_date between (select convert(varchar(10), convert(date, '30-06-2014', 105), 23)) , (select convert(varchar(10), convert(date, '02-07-2014', 105), 23))) the result this. now want show below. emp_id emp_name proj_code activity_code activity_name jun 2014 jul 2014 101257 chris 1001 9001 test 1.5 1 i want make months columns , show efforts hours same. any suggestions highly appreciated with abc ( pas...

php - Wordpress getting updated meta for multiple posts -

i working wp updating meta values.in codes here main function : $get_post_ids = array(); $get_post_ids[] = $_request['ids']; foreach ($get_post_ids $post_id) { $meta_value = get_post_meta( $post_id, 'resturent_featured', true ); if( $meta_value == 'yes' ){ $new_value = update_post_meta( $post_id, 'resturent_featured', 'no' ); }else{ $new_value = update_post_meta( $post_id, 'resturent_featured', 'yes' ); } } its working when select 1 post.but not working when selecting multiple posts. something might wrong here.if $get_post_ids[] array key , value comma separated must $_request['ids'] comma separated.then have use way: $get_post_ids = $_request['ids']; $get_post_ids = explode(',', $get_post_ids);

spring - Fetch specific property in hibernate One-to-many relationship -

i have 2 pojo classes one-to-many relationship in hibernate customeraccountenduserorderdetails.class @entity @table(name="customer_account_enduser_order_details") public class customeraccountenduserorderdetails implements serializable{ private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.auto) @column(name="id") private long id; @manytoone(fetch=fetchtype.eager) @joincolumn(name = "product_id", insertable = false, updatable = false) private customercmsproduct customercmsproduct; } second customercmsproduct.class @entity @table(name="customer_cms_product") @jsonignoreproperties(ignoreunknown = true) public class customercmsproduct { @id @generatedvalue(strategy = generationtype.auto) @column(name="id") private long id; @column(name="name") private string name; @column(name="offer_price") private string offerprice; @column...

angular - Angular2 - FormGroup include and exclude replacements in RC6 -

include , exclude methods in formgroup class deprecated in rc5 , removed in rc6. so, how supposed build conditional validation? used call include/exclude form control name. addcontrol , removecontrol alternative? in rc6 (and future versions) i've solved issue using abstractcontrol enable , disable methods. example: // before (rc5): //this.formgroup.exclude('controlname'); // after (rc6): this.formgroup.get('controlname').disable(); // before (rc5): this.formgroup.include('controlname'); // after (rc6): this.formgroup.get('controlname').enable(); hope helps you.

javascript - How to change background image dynamically depending on the url -

i'm trying change dynamically on page load, background depending on url are. doesn't work me. var camera1 = "url1"; var camera2 = "url2"; var camera3 = "url3"; var currenturl = window.location; jquery(function($) { if(camera1 == currenturl) { $(".breadcrumb-right").css("background", "url(url1.jpg) !important;"); } else if (camera2 == currenturl) { $(".breadcrumb-right").css("background-image", "url(url2.jpg)"); } else if (camera3 == currenturl) { $(".breadcrumb-right").css("background-image", "url(url3.jpg)"); } }); maybe can improve code doing this: const cameras = ['url1', 'url2', 'url3']; const currenturl = window.location.href; const el = $(".breadcrumb-right"); if (cameras.includes(currenturl)) { el.css("background-image", `url(${currenturl})`);...

python - best way to get an integer from string without using regex -

i integers string (the 3rd one). preferable without using regex. i saw lot of stuff. my string: xp = '93% (9774/10500)' so code return list integers string. desired output be: [93, 9774, 10500] some stuff doesn't work: >>> new = [int(s) s in xp.split() if s.isdigit()] >>> print new [] >>> int(filter(str.isdigit, xp)) 93977410500 since problem have split on different chars, can first replace that's not digit space split, one-liner : xp = '93% (9774/10500)' ''.join([ x if x.isdigit() else ' ' x in xp ]).split() # ['93', '9774', '10500']

xml database - Import XML file in Oracle XML DB Repository -

i new xml databases. have following xml file (employees.xml) :- <?xml version="1.0"?> <emps> <emp empno="1" deptno="10" ename="john" salary="21000"/> <emp empno="2" deptno="10" ename="jack" salary="310000"/> <emp empno="3" deptno="20" ename="jill" salary="100001"/> </emps> i want load in oracle xml db repository (under "public" folder) can access later using xqj. oracle locally installed in machine. clues how import xml file ? the various technologies loading xml data tables documented here . basically use lobfile function in sqlloader file whole , insert xml column.