Posts

wordpress - Applying second discount in Woocommerce - after bulk discount -

in online store have applied bulk discount (i.e. percentage reduction based on quantity purchased). works great. want apply second discount mechanism customer can select criteria dropdown box , discount applied again. second category schedule i.e. daily, weekly, monthly service - ie how service purchased delivered. reduce unit price i.e. 1 product. i not using subscription method customer invoiced once month - i.e. not based on drop down (daily, weekly) select. any suggestions appreciated.

Triangle number pattern in python -

i'm doing patterns in python can't seem pattern change. print("\npattern c") c in range(1, 7 + 1): cc in reversed(range(1, c)): print(cc, end = '') print('') this outputs: pattern c 1 21 321 4321 54321 654321 but want output: 1 21 321 4321 54321 654321 can please? you have add spaces in way. 1 way subtract current counter fixed value , print many spaces. for c in range(1, 7 + 1): print(' '*(7-c), end='') cc in reversed(range(1, c)): print(cc, end = '') print('') as aaron hall mentions in comments, there other ways produce output. example, single print() (and num representing 7+1 value above, , reversed() replaced different range() object): for c in range(1, num): print(' '*(num-1-c), *range(c-1, 0, -1), sep='')

c++ - Insertion comparison #'s seem too big -

i confused if these comparison numbers supposed large in value vector 100 random two-digit numbers. full program --> safe link: https://ideone.com/oybdbd program output @ bottom page of link. appreciate input. int insertionsort (vector<int> &v) { int j, temp, counter = 0; (int = 1; < v.size(); i++) { j = i; while (++counter && j > 0 && v[j] < v[j-1]){ temp = v[j]; v[j] = v[j-1]; v[j-1] = temp; j--; } } return counter; } the average case performance of insertion sort o(n^2) (see wiki entry ). vector of 100 elements, expected number of comparisons therefore o(10000) . coming out 2656 or, in second run, 4995, comparisons therefore lower might otherwise expect.

wso2is - Using Username and email as login in wso2 -

i followed document http://xacmlinfo.org/2014/10/07/email-username-with-identity-server/ allow users login email id.but is mentioned if enable <enableemailusername>true</enableemailusername> then users cannot login username or attribute other email. our use case ldap secondary user store , in time provisioning.so need allow users login either email or username. there way achieve this. you have follow this guide achieve this. following steps need follow. step 1 configure ldap user store related configurations using user-mgt.xml file found in /repository/conf directory. configure usernamesearchfilter helps search user object in ldap using both mail , uid attributes. <property name="usernamesearchfilter">(&amp;(objectclass=person)(|(mail=?)(uid=?)))</property> disable userdnpattern property, if enabled. <!--property name="userdnpattern">uid={0},ou=users,dc=wso2,dc=org</property--> the mail ...

Android Studio 2.0 Cannot launch AVD in emulator -

i can launch avds targets android 5.1 (google apis) , android 6.0 (google apis), both using cpu=x86. avd create android 4.1 (google apis) using cpu=arm cannot launched. when try launch see dialog: cannot launch avd in emulator. output: emulator: error: avd's configuration missing kernel file!! emulator: error: android_sdk_root undefined since 2 avds work i'm sure android_sdk_root defined. i've verified file -> project structure -> sdk location correct. i have run android sdk manager, uninstalled api 16 items , reinstalled these api 16 items: sdk platform intel x86 atom system images arm eabi v7a system image google apis sources android sdk within android sdk manager other libraries , packages date. , have restarted windows 7 computer. also note forced create api 16 avd cpu=arm rather using cpu=x86 android virtual device manager, when showing available system images, not show x86 image target=android 4.1 google apis). does know problem is? or suggest ...

C-Style i++ for is deprecated in swift issue -

i want increment index @ point loop prints 1,3,5 want to. warning c-style statement deprecated , ... i know means. for var index=0; index<5; index++ { //if condition == true index++ //else without index++ print(index) // print 1, 3, 5 } so changed to: for var index in 0..<5 { //if condition == true index += 1 //else without index++ print(index) // print 1,2,3,4,5 should 1,3,5 side } i wondering why index not mutable? though have set var or solutions issue. the index not mutable because for var x in y { ... } is equivalent to for temp in y { var x = temp ... } where var makes x copy of temp . when modify x , won't modify real index temp (this reason why se-0003 introduced) the c-style for loop can reduced while loop: var index = 0 while index < 5 { if conditiona { index += 1 } print(index) index += 1 }

linux - Making bash profile visible for non login shell -

i have .bash_profile , have several commands in shell. have logged in user1. in terminal, su - user2. when i'm user2, i'm not able call these commands have created in .bash_profile. how make path elements , environment variables visible user2 well? when echo $path when using user2, this: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/go/bin when echo $path using user1, lot more. how make additional path elements visible user1? su <user> (without - ) not read < user > 's shell initialization files. leaving previous users' settings.