Posts

Showing posts from May, 2011

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.

c# - Attach Visual Studio debugger to VS IDE Host -

Image
i trying test application using visual studio 2015 shell (isolated). for testing extension package visual studio, found samples older versions . this: [testmethod] [hosttype("vs ide")] public void createvisualization() { testutils testutils = new testutils(); testutils.closecurrentsolution(__vsslnsaveoptions.slnsaveopt_nosave); testutils.createprojectfromtemplate(testcontext.testdir, "myprojecttype", "myprojecttype.zip"); testutils.closecurrentsolution(__vsslnsaveoptions.slnsaveopt_nosave); } my problem can not debug tests, because debugger not attach vs ide host process. once, remove hosttype-annotation, can set breakpoints , debug it, test not run inside correct process. verified attaching not work, writing endless-loop inside test , manually attaching started process (which enable debugging). is there way automatically attach visual studio debugger started process upon starting test, can debug without manual "attach pro...

c++ - Creating an object, local variable vs rvalue reference -

is there advantage using r value reference when create object, otherwise in normal local variable? foo&& cn = foo(); cn.m_flag = 1; bar.m_foo = std::move(cn); //cn not used again foo cn; cn.m_flag = 1; bar.m_foo = std::move(cn); //is ok move non rvalue reference? //cn not used again in first code snippet, seems clear there not copies, i'd guess in second compile optimize copies out? also in first snippet, object stored in memory (in second stored in stack frame of enclosing function)? those code fragments equivalent. this: foo&& rf = foo(); is binding temporary reference, extends lifetime of temporary of reference. foo destroyed when rf goes out of scope. same behavior with: foo f; with exception in latter example f default-initialized in former example rf value-initialized. types, 2 equivalent. others, not. if had instead written foo f{} , difference goes away. one remaining difference pertains copy elision: foo give_a_foo_rv() {...

Jasmine unit test cases -

i new jasmine tests , have not able been able find solution after trying many ways. can suggest test case code in angularjs? modalinstance.result.then(function (modaloutput) { if (modaloutput) { if ('oktoundoedits' === modaloutput[1]) { $scope.chargebackdetail.cbdetails = angular.copy($scope.chargebackdetailbackup.cbdetails); } else if ('oktosaveunmatched' === modaloutput[1]) { $('#nomatchwarning').show(); $scope.ismatcheddoc = false; } } }, function () { }); the following test assumes using angular ui bootstraps $modal. code untested, should close need started. it('should revert chargebackdetail.cbdetails backup, if ok undo edits', inject(function($modal, $q) { // arrange $scope.chargebackdetail = {}; $scope.chargebackdetailbackup = {cbdetails: [11, 13, 17]}; var deferred = $q.defer(); spyon($modal, 'open').and.returnvalue({result: deferre...

Creating a semi-transparent object over background video in CSS / HTML -

this question has answer here: background image overlay css 4 answers i'm having issue don't quite understand, have background video on website, , wanted put floating textbox on it. problem is, background color , borders of textbox seem ignore z-index , hide behind background video, no matter do, while text seem show in front of video. way fix this? has been incredibly frustrating problem me. .fp-newbox { background-color: rgba(170,170,170,0.4); box-shadow: 0 10px 18px -10px rgba(0,0,0,0.3); border: solid 1px rgba(170,170,170,0.6); border-radius: 6px; z-index: 30000; } /* homepage video */ .fp-video { overflow: hidden; z-index: -100; } .fp-video-inside { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } <div class="fp-video"> <video loop muted autoplay poster...

angular - Error in angular2 with routing. More tasks executed then were scheduled, platform-browser.umd.js:937 -

i'm new angular 2 , i'm using latest angular 2 (rc5) , want introduce navigation, works isn't loading default option (hospitalization) have click in option, , app navigate between different options of menu have problem in console: exception: error: more tasks executed scheduled. browserdomadapter.logerror @platform-browser.umd.js:937 platform-browser.umd.js:937 error: more tasks executed scheduled. @ zonedelegate._updatetaskcount (zone.js:398) @ zonedelegate.invoketask (zone.js:369) @ zone.runtask (zone.js:265) @ zonetask.invoke (zone.js:433) @ xmlhttprequest.<anonymous> (zone.js:93) @ zonedelegate.invoketask (zone.js:365) @ object.oninvoketask (core.umd.js:9236) @ zonedelegate.invoketask (zone.js:364) @ zone.runtask (zone.js:265) @ xmlhttprequest.zonetask.invoke (zone.js:433) my main.ts is: // main entry point import { platformbrowserdynamic } '@angular/platform-browser-dynamic'; import { appmodule } './...

Callback functions are not called in Android Facebook Login -

Image
i developing android app. in app, integrating facebook login. have done developing facebook login once before. when develop time, facebook callback functions not called. cannot check error well. have no idea wrong. i installed facebook sdk using gradle compile 'com.facebook.android:facebook-android-sdk:4.1.0' then generated key hash , set in facebook developer settings follows: this manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tonightfootballreport.com.tfr" > <uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.read_external_storage" /> <u...

python - matplotlib very slow in plotting -

i have multiple functions in input array or dict path argument, , function save figure path of particular path. trying keep example minimal possible, here 2 functions: def valuechartpatterns(dict,path): seen_values = counter() data in dict.itervalues(): seen_values += counter(data.values()) seen_values = seen_values.most_common() seen_values_pct = map(itemgetter(1), tuplecounts2percents(seen_values)) seen_values_pct = ['{:.2%}'.format(item)for item in seen_values_pct] plt.figure() numberchart = plt.bar(range(len(seen_values)), map(itemgetter(1), seen_values), width=0.9,align='center') plt.xticks(range(len(seen_values)), map(itemgetter(0), seen_values)) plt.title('values in pattern dataset') plt.xlabel('values in data') plt.ylabel('occurrences') plt.tick_params(axis='both', which='major', labelsize=6) plt.tick_params(axis='both', which='minor'...

Java: Error parse date's string to date object -

this question has answer here: why “exception; must caught or declared thrown” when try compile java code? 6 answers i try convert string date on java. read , try example website "java date , calendar examples" still cannot compile , run it. this code. package javaapplication5; import java.text.simpledateformat; import java.util.calendar; import java.util.date; import java.util.locale; public class javaapplication5 { public static void main(string[] args) { simpledateformat sdf = new simpledateformat("dd-m-yyyy hh:mm:ss"); string dateinstring = "31-08-1982 10:20:56"; date date = sdf.parse(dateinstring); system.out.println(date); } } and got error. exception in thread "main" java.lang.runtimeexception: uncompilable source code - unreported exception java.text.parseexception...

c# - I get "The type initializer for 'Microsoft.Cct.CctProjectNode' threw an exception." when opening ccproj files after installing Azure SDK 2.9 -

i have solution azure cloud project in that's targeting 2.7 version of microsoft azure sdk open/build , deploy without problems. since visual studio nagging me update, went ahead , installed new azure sdk version of 2.9. after update, cannot open cloud project files, , visual studio (2015 community edition, updated latest of time i'm writing this) gives me error message: mytest.ccproj : error : type initializer 'microsoft.cct.cctprojectnode' threw exception. i able open project if manually edit ccproj file , change the <productversion>2.7</productversion> value 2.9. however, can not use that, since other people working on project , still want remain on 2.7 version of azure sdk, deployed production. is there way allow visual studio open older versions of cloud projects? have uninstall azure sdk updates? thank all! there issue sxs compatibility 2.9.5 , previous versions. discovered , looking fix next version, until have uninstall ...

c# - Word Interop- Add new autotext/building block -

i need update bunch of values stored in multiple word documents auto text (or building blocks), there many hand hoping use interop word api. var app = new application(); var doc = app.documents.open(@"c:\path\to\file.dot"); unfortunately cannot see members of document related auto text feature in word (insert > quick parts > building blocks organizer). does api expose way of adding/updating auto text values in 'building blocks organizer'? what need create new document , attach template document, top of head: activedocument.attachedtemplate = @"c:\path\to\file.dot"; after can interate on autotextentries (a vba example, i'm sure can rewrite c# yourself) sub test() activedocument.attachedtemplate = @"c:\path\to\file.dot" each oautotext in activedocument.attachedtemplate.autotextentries msgbox oautotext.value oautotext.value = replace(oautotext.value, strold, strnew) next oautotext end...

python 2.7 - can't get right when dealing with uppercasing string -

#!/usr/bin/python # -*- coding: utf-8 -*- def to_weird_case(string): lines = string.split() new_word = '' new_line = '' word in lines: item in word: if word.index(item) %2 ==0: item = item.upper() new_word += item else: new_word += item new_line = new_word +' ' return new_line print to_weird_case('what mean') i want what mean , instead got whatdoyoumean . add line new_line = new_word +' ' . problem? first, overwrite new_line every iteration. second, new_word getting longer because never "clear" it. third, add space end of entire new_line , not after every new word (because of second ). see comments def to_weird_case(string): lines = string.split() new_line = '' word in lines: new_word = '' # start new word empty string item in word: if word.index(item)...

php - Syntax for MySQL REGEXP CONCAT -

i'm trying make pdo prepared statement using regexp concat function. in phpmyadmin can run following query returns proper results database contents (the 'city' value (denver, in case)) bound parameter, i'm putting in there explicitly development): select `user_id` `id` `usermeta` (`meta_key` = 'custom_field') , (`meta_value` regexp '.*"leagues";.*s:[0-9]+:"a".*') , (`meta_value` regexp '.*"city";.*s:[0-9]+:"denver".*') however, if try use concat function on last line, result empty set. in other words, mysql isn't throwing errors on query itself, correct data isn't being selected: select `user_id` `id` `usermeta` (`meta_key` = 'custom_field') , (`meta_value` regexp '.*"leagues";.*s:[0-9]+:"a".*') , (`meta_value` regexp concat('\'.*"city";.*s:[0-9]+:"', 'denver', '".*\'')) i've tried escaping ...

Saving data from SQL query in excel in C# console app -

i have c# program.cs code created save results sql query xls file, problem have 2 sql query , there 2 result sets need written excel file, able write 1st result through below code not able write second result, can please on this? please see code below, using same code block both queries seem results 1st query. static void main(string[] args) { //sqlconnection cnn; //string connectionstring = null; string connectionstring = "integrated security = sspi;initial catalog=database; data source=<instance name>;"; string sql1 = null; string sql2 = null; string data = null; string data1 = null; int = 0; int j = 0; string filename = @"e:\file\testfile.xls"; if (!file.exists(filename)) { file.create(filename).dispose(); using (textwriter tw = new streamwriter(filename)) { tw.writeline("the first line!"); tw.close(); } } ////...

c# - Publishing error: dotnet.exe failed -

Image
i gifted .net core 1.0 app when original author quit. written in rc1-rc2... have since updated project use latest core 1.0.0 , compiles , runs locally on dev machine (win 7) when publishing, in manner, cannot stand up. i tried pub local directory , copy over, tried publish via 'web deploy', ever get: oops! 500 error. error occurred while starting application. also, every time try publish error when viewing 'settings' tab in publish wizard. seems error every time 'discovering data contexts'. what wrong? upon build gives me info: "no web.config found. creating 'c:\users\bdamore\appdata\local\temp\publishtemp\logmanager.web115\web.config'"... there web.config in project... ??? problem signature: problem event name: appcrash application name: dotnet.exe application version: 1.0.1.4500 application timestamp: 576218d2 fault module name: kernelbase.dll fault module version: 6.1.7601.23455 faul...

Template argument for function type in C++ -

here, wrapper::set should able take function or function object matches int(int) signature, , store std::function . should work function pointers, lambdas, objects operator() , std::bind expressions, etc. #include <functional> struct wrapper { using function_type = int(int); std::function<function_type> func_; template<typename func> void set(func func) { func_ = func; } }; what best form of set works in cases? i.e. 1 of set(func func) { func_ = func; } set(func&& func) { func_ = std::forward<func>(func); } set(func& func) { func_ = func; } set(const func& func) { func_ = func; } the simplest version: void set(std::function<function_type> f) { func_ = std::move(f); } the complex version: template <class f, class = std::enable_if_t<std::is_assignable<std::function<function_type>&, f&&>::value> > void set(f&& f) { func_ = std::forward...

php - Wordpress content type issue -

i have moved site form 1 host other 1 , have issue links on site. of links not work , when click them opening download windows. saw in console log that resource interpreted document transferred mime type application/x-httpd-php what should content type , fix i? in htaccess? or host problem?

python - Is pandas.DataFrame.groupby Guaranteed To Be Stable? -

i've noticed there several uses of pd.dataframe.groupby followed apply implicitly assuming groupby stable - is, if a , b instances of same group, , pre-grouping, a appeared before b , a appear pre b following grouping well. i think there several answers implicitly using this, but, concrete, here one using groupby + cumsum . is there promising behavior? documentation states: group series using mapper (dict or key function, apply given function group, return result series) or series of columns. also, pandas having indices, functionality theoretically achieved without guarantee (albeit in more cumbersome way). although docs don't state internally, uses stable sort when generating groups. see: https://github.com/pydata/pandas/blob/master/pandas/core/groupby.py#l291 https://github.com/pydata/pandas/blob/master/pandas/core/groupby.py#l4356 as mentioned in comments, important if consider transform return series it's index aligned origin...

ruby - Using Authlogic in a non-Rails environment -

what best way use authlogic in non-rails environment? in other words, how validate credentials within ruby script? when run console, self refers "main" object , hence authlogic initialization pointless: 2.3.1 :009 > authlogic::session::base.controller = authlogic::controlleradapters::railsadapter.new(self) it expects initialized controller, because needs request , ip , other stuff. strange see, because usersession model , should not coupled controller. any suggestions on how validate credentials?

internet explorer - jsPDF + jsPDF-AutoTable in IE10 and IE11 -

Image
i using jspdf 1.2.60 , jspdf autotable 2.0.32 plugin generate pdf containing table colspans , rowspans , images (data uris). works without problems in chrome , firefox not able make work in ie10 , ie11. i tried working jspdf 1.0.272 because read should work in ie<=9 hence in ie10 , ie11 didn't, keep getting error: 'jspdf object undefined' similar error using latest version of jspdf i including following scripts: <script type="text/javascript" src="/scripts/jspdf-1.2.60/examples/js/jquery/jquery-ui-1.8.17.custom.min.js"></script> <script type="text/javascript" src="/scripts/jspdf-1.2.60/dist/jspdf.min.js"></script> <script type="text/javascript" src="/scripts/jspdf-1.2.60/plugins/split_text_to_size.js"></script> <script type="text/javascript" src="/scripts/jspdf-1.2.60/plugins/standard_fonts_metrics.js"></script> <scrip...

char array has some garbage after first loop in c -

Image
while( (entry = readdir(dir_pointer)) != null) { char *fullpath = malloc(dir_len + strlen(entry->d_name) + 2); printf("\nfullpath: %s\n", fullpath); strcat(fullpath, dir); // concatenate file directory; printf("\ndir: %s\n",fullpath); strcat(fullpath, "/"); // concatenate "/"; strcat(fullpath, entry->d_name); // concatenate filename; printf("\nfullpath: %s\n", fullpath); // print check; free(fullpath); // close file; } from output, first round of while loop works fine, file full path correct; however, second round, file full path contains garbage, where garbage come from? how solve this, have tried memset() didn't work. because fullpath not initialized. should not use , don't need use strcat() in situation, if want work make f...

java - Issue with deploying maven -

i have following pom.xml: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.eternity</groupid> <artifactid>eternity</artifactid> <version>0.0.1-snapshot</version> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.3.0.release</version> <relativepath/> </parent> <properties> <!-- common build properties --> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <java.version>1.8</java.version> <!-- artifacts ver...

Openshift - multiple auth providers -

does openshift (origin or enterprise) support multiple auth providers ? eg 1. htpasswd (if not found ) 2. ldap this link talks various auth supported can use multiple ... oauthconfig: identityproviders: - name: htpasswd_auth challenge: true login: false mappingmethod: "claim" ... - name: "my_ldap_provider" challenge: true login: true mappingmethod: claim provider: ... yes, can specify multiple auth providers. make sure have different names. you'll want careful cases preferred usernames collide. claim (like have it) pretty safe default. see https://docs.openshift.com/enterprise/3.2/install_config/configuring_authentication.html#mapping-identities-to-users if want read on alternatives.

javascript - Cant quite get my JS regex to work with wildcrd -

iv been trying js regex match as follows: "some string stuff [other string stuff] more string stuff" the '[' , ']' characters optional. text between not optional (and can single alphanumeric or full sentence). far i've come (and many iterations of other ideas in between): /^(some string stuff \[?.*\]? more string stuff)$/gim note 'gim' arguments i'm testing line line, finding matches , ignoring case. every test seems frustratingly work not quite, regex fu not strong seems! iv trawled through other forum posts , likewise work not quite after tinkering. appreciated! edit the "some string stuff " @ start , " more string stuff" @ end mandatory string valid. text between them has variance; ie long not line break. examples of valid text: some string stuff [other string stuff] more string stuff string stuff other string stuff more string stuff string stuff string more string stuff string stuff [string] more stri...

python - How to multiply pandas dataframes and preserve row keys -

Image
i'm struggling multiplying dataframes , preserving row keys. i have 2 files, call them f1 , f2. f1 has multi-part group key (g1,g2,g3), two-part type key (k1,k2) , weights (r1,r2). f2 has series of values each type key. i'd join them on k1 , k2, , multiply r1 , r2 each n. i'm thinking groupby , dataframe multiply should work can't see how it. thing i've got work merge , multiply column column, it's super-slow. f1 g1 g2 g3 k1 k2 r1 r2 1 2 b 3 4 b b 2 3 f2 k1 k2 n r1 r2 1 0 1 2 1 1 3 1 0 b 1 3 4 b 2 4 4 b 3 4 3 c 1 1 1 c 3 4 5 c 2 3 4 result g1 g2 g3 k1 k2 n r1 r2 1 0 2 2 1 2 3 1 0 b 1 9 16 b 2 12 16 b 3 12 12 b b 1 6 12 b b 2 8 12 b b 3 8 9 thanks mrg = f1.merge(f2, on=['k1', 'k2...

c# - Format XML containing List for Deserialization -

i have data need bring xml file postgresql database through c# application working on. the problem face need add kind of list xml now. looks this: <itemone>stuff</itemone> <itemtwo>otherstuff</itemtwo> <listofitems> <listitem> <partone>123</partone> <parttwo>abc</parttwo> </listitem> <listitem> <partone>123</partone> <parttwo>abc</parttwo> </listitem> </listofitems> so found quite threads handle topic of how deserialize lists. of them start saying proposed xml should modified. have freedom wish in regard, i'd first create optimal xml format @ first. well, , afterwards deserialize it. if there format lists automatically processed xmlserializer.deserialize() amazing. that data processed automatically xmlserializer , long class shaped match. example: [xmlroot("yourrootname")] public class foo { ...

Optimize route SKMaps - Swift -

i using skmaps routes several viapoints. skmaps returns routes slower google maps. i've tried of various combinations of skroutemodes (.carfastest, etc.), none of them come close google maps routes. i'm thinking viapoints need optimized. there way optimize route viapoints in skmaps? based on http://forum.skobbler.com/showthread.php/8058-optimize-routes-ios-sdk-swift not slower routes, not optimizing order of via points - functionality not supported right scout developer platform.

postgresql - Automatically casting RHS values for specific JOOQ columns -

i have following code, "ci_col" of type citext ( https://www.postgresql.org/docs/current/static/citext.html ) string str = "testing"; int countbad = context.fetchcount(select(tables.my_table.ci_col) .from(tables.my_table) .where(tables.my_table.ci_col.eq(str))); int countgood = context.fetchcount(select(tables.my_table.ci_col) .from(tables.my_table) .where(tables.my_table.ci_col.eq(cast(str, new defaultdatatype<>(sqldialect.postgres, string.class, "citext"))))); the first query returns 0, , second query correctly returns > 0. it took me long time track down root cause, because when first query printed (or found in debug logging), seemed execute in terminal fine. once got down statement level , started binding values, that's root cause seemed be. seems issue (or on purpose) in postgres driver. post illustrates binding issue citext: https://www.postgresql.org/message-id/cajfs0qb90bo0vww5pzcw0c%3dljocox04qpem4nsd6uy7-t2r5ha%...

javascript - Changing color of lines that begin with * in a multi-line <div> tag -

i have written program works syntax highlighter. problem left language should specify * sign comment, if appear @ beginning of each line . however, if appear after other character, considered multiplication operator , not comment sign. the code written in tag. program has check content of div , change color of each line if begins * . has bugged me appreciated. for example, have following code block: <div> code * comment notcomment = 10 * 10 </div> in example, second line should turn comment whereas third line not comment. if each line of code begins separate <div> tag, solution easy. since each tag can include chunk of code, becomes troublesome. something this: const elements = document.queryselectorall('div'); [...elements].foreach(el => { if (el.textcontent.startswith('*')) { el.classlist.add('comment'); } }); .comment { color: lightgray; } <div>line 1</div> <div>l...

javascript - Draw on Image loaded inside HTML canvas -

i have html canvas in ionic app. <canvas id="canvas" color="{{ color }}" width="800" height="600" style="position:relative;"></canvas> in canvas, loading image. below code controller var canvas = document.getelementbyid('canvas'); var context = canvas.getcontext('2d'); var img = new image(); img.src = $stateparams.imageid; img.onload = function() { context.drawimage(img, 0, 0, canvas.width, canvas.height); } after image loaded, users need ability write on image , circle/highlight areas of image. doesn't html canvas provide feature default? right not able annotate on image. how can achieve this? you need implement yourself. you can hooking mouse click / move events. using 2d context, draw small rectangle @ mouse's current position if moves , left mouse button down. the effect similar windows paint pencil tool. here's s...

hystrix - javanica @HystrixCommand and spring @Cacheable execution order -

in spring application (not spring-boot), i'm using javanica @hystrixcommand annotation , spring cache @cacheable annotation on same bean method, spring execute cache advice before hystrix advice. it's i'm waiting, me cache advice , hystrix advice without configuration have same order in spring : lowest_precedence. i wan't know make order : defined somewhere or undefined order , i'm lucky have order ? must done ensure cache advice executed before hystrix advice (set order on cache:annotation-driven before lowest_precedence ?) this example of code : ... import org.springframework.cache.annotation.cacheconfig; import org.springframework.cache.annotation.cacheable; import com.netflix.hystrix.contrib.javanica.annotation.hystrixcommand; import com.netflix.hystrix.contrib.javanica.annotation.hystrixproperty; ... @service @slf4j @cacheconfig(cachemanager="mycachemanager") public class myressourcesimpl implements myressources { ... @override @h...

jQuery/Javascript - Sort Table Columns Based on Totals Row -

how can sort performed on table columns based on sort of last totals row? for example, following table structure row titled "total sold %" used sort corresponding columns in value high low. thus, columns shift left or right "total sold %" row sorted 12.42%, 12.64%, 14.73% : <table class="table table-bordered text-center"> <thead> <tr> <th class="text-center"> average </th> <th class="text-center"> entry #1 </th> <th class="text-center"> entry #2 </th> <th class="text-center"> entry #3 </th> </tr> </thead> <tbody> <tr> <th scope="row"> new car total leads </th> <td> 251 </td> <td> 227 </td> <td> 526 ...

php - Laravel 5. Eloquent relations through several tables and behaviour in foreach -

i have following models: shop_list: public function shoplistitem() { return $this->hasmany(shopping_list_item::class, 'shopping_list_id'); } shopping_list_item: public function shoppinglist() { return $this->belongsto(product::class); } public function product() { return $this->belongsto(product::class); } product: public function shoplistitem() { return $this->hasmany(shopping_list_item::class); } when execute code: {{$shoppinglists->shoplistitem()->first()}} i following correct result: {"id":1,"shopping_list_id":13,"product_id":69,"quantity":4,"created_at":"2016-09-05 19:23:35","updated_at":"2016-09-05 19:34:53"} but if want loop , id: @foreach($shoppinglists $sh) {{$sh->shoplistitem()->id}} @endforeach then following error: call member function shoplistitem() on boolean question: why in loop object transformed boolean? ...