Posts

Showing posts from August, 2012

user interface - How to add a visual prefix to an entry in Xamarin Forms? -

Image
say want add number prefix based on country, phone entry? 1 on image: how can achieve that? i this <stacklayout orientation="horizontal" backgroundcolor="gray"> <label text="+995 |" backgroundcolor="transparent" /> <editor text="699999999" backgroundcolor="transparent"></editor> </stacklayout> a horizontal stacklayout label prefix , editor entry. as can see using same approach app in order display arrow down icon next picker. var datectrl = new noborderpicker() { verticaloptions = layoutoptions.center, fontsize = device.getnamedsize(namedsize.default, typeof(label)) * fontsizes.editformcontrolfactor, heightrequest = 40, backgroundcolor = color.white, horizontaloptions = layoutoptions.fillandexpand, }; var ico...

javascript - How to do ordering a select in Sequelize correctly? -

i can't simple version of http://docs.sequelizejs.com/en/latest/docs/querying/#ordering work. please help. this query: const result = await db.dbo__peach_payments_transactions .findone({ 'order': [db.dbo__peach_payments_transactions, 'created_at', 'desc'], 'include': [{ model: db.dbo__orders, where: { 'users_id': userid} }] }); gives me error: typeerror: converting circular structure json this query: const result = await db.dbo__peach_payments_transactions.findone({ 'order': 'dbo.peach_payments_transactions.created_at desc', 'include': [{ model: db.dbo__orders, where: { 'users_id': userid} }] }); gives me error: "invalid reference from-clause entry table "peach_payments_transactions"" and query looks should work: const result = await db.dbo__peach_payments_transactions.findone({ 'order': '"dbo.peach_payments_transactions"."crea...

Set timeout function with AsyncTask [Android] -

in case, button pressed , process timeout. when button clicked verify accno web services, if verification (progressdialog) on 5 seconds stop , display alertdialog notice user "timeout". but have not idea when in testing 1 milliseconds, in logically pause in alertdialog until pressed, display dialog in milliseconds auto dismiss , intent next activity. here code: @override protected void oncreate(final bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_information3); btn_next.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if (title.gettext().tostring().equals("info")) { infoasynctask infoasynctask = new infoasynctask(); try { infoasynctask.execute().get(1, timeunit.milliseconds); } catch (interruptedexception e) { e.printstacktrace(); ...

c++ - "Writefile" for RS232 communication using MFC hangs forever, but -

i maintaining mfc program can send data computer computer b through rs232. transmits data smoothly, hangs forever. there 2 threads sending same data com port in sequence. first thread sends data successfully, second thread hangs @ code "writefile". when second thread on computer hangs @ "writefile", send meaningless data "1" computer b computer a. hanging @ "writefile" on computer stop hanging, , computer b see data sent second thread on computer a. here rs232 log computer b . the picture shows 2 threads on computer initiate there own test , send messages computer b. each thread complete there own test , send test_done computer b @ same time. computer b see test_done sent first thread on computer a(the second thread hanging @ writefile @ point.) until manually send "1" computer computer b. here code sending message computer computer b. length of cmd 255. bool serialport::autohandlerres(unsigned char* cmd){ while(wait_transf...

rule engine - Where is NRules documentation gone? -

can kindly point out nrules documentation is? links found shown below broken. getting-started . index i hope not depreciating project :( if case alternatives? according this post author, project has been removed. there forks in various states on github, nothing complete. there no other active open source .net rules engines i've found, there many other commercial alternatives ( inrule ). if you're using nrules, checked in copy of api documentation github here . not have copy of wiki. if implementation language not concern -- drools 1 of best open source rules systems available.

wso2 - API Manager: Error when call a BPS subscription task -

im trying follow tutorial: https://docs.wso2.com/display/am1100/adding+an+api+subscription+workflow when try register subscription store, in bps console receive following error: [2016-06-28 11:21:10,729] warn {org.wso2.carbon.bpel.b4p.extension.peopleactivity} - soap fault: <?xml version='1.0' encoding='utf-8'?><soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:action><wsa:relatesto>urn:uuid:fd3c1de4-2689-4743-bfad-a31de7d726af</wsa:relatesto></soapenv:header><soapenv:body><soapenv:fault><faultcode>soapenv:server</faultcode><faultstring>java.lang.nullpointerexception</faultstring><detail/></soapenv:fault></soapenv:body></soapenv:envelope> in bps logs have error can't find in...

assembly - INT 10h/ah=13h doesn't print strings when part of second stage bootloader -

i used memory in first sector, want store new variable string in second sector (second stage) , print it. instance: hello db 'hello world' the new string should in sector (because there no more memory in first sector). did int 13h,ah=2 read second disk sector address 900h:0000. stored variable hello in sector code print. fails print string when use int 10h/ah=13h in code this: mov ax, 7c0h mov es, ax mov bp, hello mov ah,13h ; function 13 - write string mov al,01h ; attrib in bl, move cursor mov bl,0bh ; attribute - magenta mov cx,30 ; length of string mov dh,1 ; row put string mov dl,4 ; column put string int 10h ; call bios service when variable in first sector prints well, when store in second sector doesn't print, when do: mov ax, 900h mov es, ax example code: xchg bx, bx mov ax, 7c0h mov ds, ax sector_2: mov bx, 900h mov es, bx mov bx, 0 mov ah, 2 mov al, 1 mov ch, 0 mov cl, ...

dataframe - Count specific patterns in data frame, doing interpolation in R -

i have dataset in data frame format, this: wpt id fuel express local 1 s36 12 0 1 2 s36 14 1 0 inter s36 na 1 0 inter s36 na 1 0 3 s36 16 1 0 inter s36 na 0 1 4 s36 18 1 0 5 s36 22 1 0 6 w09 45 0 1 inter w09 na 1 0 7 w09 48 0 1 i'd treat subdata dat[c(2,inter,inter,3),] ( any part "inter" combined regular numbered wpt ) unit. (1) count how many such sub-units in data frame, in case has 2 (unit row 2 3, , 3 4) (2) count how many such units express or local value consistent starting ending value of sub-unit . in case, has 1 such unit consistent ( row 2 3, it's express ) , 1 unit different ( row 3 4, start , end express, inter local ) starting or ending value of such units. (3) calculations id. the expected output this: id consistent to...

c# - How to Change .NET Version Target -

Image
i creating service targeting .net 4.5 . i changed .net 3.5 in project properties: i updated of .resx files contain version=2.0.0.0 instead of version=4.0.0.0 (as compiler complaining this), , removed .net 4.5 list of prerequisites. however, when generate new msi , try run seeing message: this setup requires .net framework version 4.5. please install .net framework , run setup again. .net framework can obtained web. now? the machine trying install on has .net 3.5 installed , should run without issue. i not sure else check in project - have ideas of might causing this? there way of "refreshing" settings ensure new framework used installer? change target framework in project properties , recompile. that's all...

javascript - Submitting form with ajax and jQuery -

i have simple form 1 select box , 2 options in it. here related jquery code: $('.mycssclass').on('change', function() { alert("this executed"); $(this).parent().submit(function(e) { alert("this not executed"); $.ajax({ type: "post", url: "script.php", data: $(this).parent().serialize(), success: function(data) { alert(data); } }); e.preventdefault(); }); form parent of select box. first alert executed when change select box option, next 1 never reached. idea why? this should it. don't bother submit event - not triggered select box. $('.mycssclass').on('change', function() { $.ajax({ type: "post", url: "script.php", data: $(this).parent().serial...

sql server - SQL INSERT INTO query copy 3 x times -

i have master table , i'd insert into table straight forward copy. want copy table 3 x times changing value of 1 x field called comp (short company). in master table field comp contains value master . i'd change value 3 x new companies a, b & c . how & in query do this? much appreciated assistance! lets have following table values , 1 more table same schema called anothertable create table mastertable( comp varchar(50), moredata varchar(200) ); and have 3 values: declare @comp1 varchar(50) = 'acomp', @comp2 varchar(50) = 'bcomp', @comp3 varchar(50) = 'ccomp'; insert anothertable select @comp1, moredata mastertable union select @comp2, moredata mastertable union select @comp3, moredata mastertable now there still issues of primary key, clustered index. have identity in these tables or identifier. if tables huge need in 3 inserts insert anothertable select @comp1, moredata mastertable; insert anothertable...

Git instaweb with multiple repositories not working -

i have following estructure populated via grok mirror: /var/opt/git/git-data/repositories /organization1 /teama /repo1 /repo2 /teamb /repo3 /repo4 /organizationn /teamn /repon git instaweb works fine individual repo if want automatically git instaweb shows repos under "repositories" dir doesnt' work: fatal: not git repository (or parent mount point /var/opt/git/git-data) stopping @ filesystem boundary (git_discovery_across_filesystem not set). which true because there no repo in parent directory, if execute git instaweb /var/opt/git/git-data/repositories/organization/teama/ same error , inside directory bare repos resides (a repon.git directory each repo) i have set git_discovery_across_filesystem env var without results. have set /etc/gitweb.conf following entry: our $projectroot = "/var/opt/git/git-data/repositories"; as have read in doc of project, git instaweb can...

installshield - Custom installation installing empty folder. -

i'm new installshield , learning how use on fly, have installshiled 2011 project upon custom installation when deselect component being installed, not installing files, folder files created empty, how can prevent being created?! thanks in advance. i solved going files , folders under application data, looks 1 checked parent node under custom installation, when checked child node didn't create unnecessary folders.

android - How to update Activity UI based on ListView item selection? -

i creating sample application containing activity [having listview , button ] in layout file. listview custom containing [label/name , checkbox]. want write code change text of button adapter class of listview based on list item checkbox check [t/f]. listview.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { // when clicked, show toast textview text applistofallapps selecteditems = (applistofallapps) parent.getitematposition(position); if (view != null) { checkbox checkbox = (checkbox) view.findviewbyid(r.id.checkbox1); selecteditems = (applistofallapps) checkbox.gettag(); //here selected item may text accordingly , using using button variable set text button.settext("whatever...

android - java how to extract json element for many depth levels -

if have json { "aggregations" : { "cityagg": { "'buckets": { "buckets" : [ {},{},{} ] } } } } i can extract last buckets array using simple json jsonobject aggregations = (jsonobject)jsonresponse.get("aggregations"); jsonobject cityagg = (jsonobject)aggregations.get("cityagg"); jsonobject buckets = (jsonobject) cityagg.get("buckets"); jsonarray result = (jsonarray) buckets.get("buckets"); but boring make object each json level, isn't there better/easier way that? something maybe like: jsonresponse.get("aggregation/cityagg/buckets/buckets") you can use gson provided google format json,convert object json , vice versa. gson java library can used convert java objects json representation. can used convert json string equivalent java object. gson can work arbitrary java objects including pre-existing objects not have source-code of. can go ...

html - Aligning divs with flexbox. 2 divs full width and 2 divs inline at half of width -

i'm trying make layout of 2 divs of full width , 2 divs of half width (the last 2 divs should in 1 line). the html following: <div class="container"> <div class="box--full">1</div> <div class="box--full">2</div> <div class="box--half">3</div> <div class="box--half">4</div> </div> the css: * { box-sizing: border-box; } .container { display: flex; width: 200px; flex-flow: row wrap; } [class*="box--"] { display: flex; margin: .25rem; height: 2rem; padding: .25rem; color: white; } .box--full { background: red; flex: 1 1 100%; } .box--half { background: blue; flex: 1 1 50%; } i'm wondering why 2 last divs doesn't have half of available width , why aren't in 1 line. avoid adding wrapper last 2 divs. i found adding flex: 0 1 50% applies desired width last 2 divs still...

python - I'm unable to get date with a variable -

def get_next_monday(year, month, day): date0 = datetime.date(year, month, day) next_monday = date0 + datetime.timedelta(7 - date0.weekday() or 7) return next_monday date2 = datetime.datetime.now().strftime("%y, %m, %d") findnextweek = get_next_monday(date2) if replace (year, month, day) (date2) integer required. otherwise, different error typeerror: get_next_monday() takes 3 arguments (1 given) you have little problems in code. here's fix , explanation: import datetime def get_next_monday(year, month, day): # if want accept str , int, must convert strings date0 = datetime.date(int(year), int(month), int(day)) next_monday = date0 + datetime.timedelta(7 - date0.weekday() or 7) return next_monday # must convert date in list, because `get_next_monday` takes 3 arguments. initial_date = datetime.datetime.now().strftime("%y, %m, %d").split(',') # must un-pack date findnextweek = get_next_monday(*initia...

Error on runing a raw iso on virtualbox -

i have download raw iso cd internet. try one: i'm import iso on vbox storage when boots "fatal: no bootable device". try two: convert iso vmdk vboxmanage , imported vbox storage error still exist. try three: converted vdi, imported vbox storage still same. try poweriso linux converted iso format , still nothing found few solution in here none of them works me. open iso found (3 *.swf) files inside , makes me wonder infected iso .... possibility on ? why not set read iso cd-rom device?

java - Searching for multiple words in spring data repository -

i have pagingandsortingrepository: public interface browserlinkpagination extends pagingandsortingrepository<browserlink, long> { list<browserlink> findbyuserandurilike(user user, string uri, pageable pageable); } now want search multiple words in uri column. like comes pretty close, order dependent on how words occur in string. edit clarification: order dependences not want. want search strings independent of order, like not looking for. i guess pretty common find, having several search terms in string, know implement providing sql execute, curiuous if there way express in terms of spring data? i using postgresql production , h2 development / tests. after reading more topic kind of obvious need kind of fulltext search. start using 1 provided postgresql. found short working example: http://rachbelaid.com/postgres-full-text-search-is-good-enough/ thanks comments.

javascript - Blur background based on page length -

i trying make if scroll down, blurred picture appears (with opacity) , if you're @ bottom of page, blurred picture visible , old 1 disappeared. i'm using same pagecontainer every page , want make script on every page, different page lengths. i have far: css: .img-src { position: fixed; background-position: center; -webkit-background-size: cover; top: 0; bottom: 0; left: 0; right: 0; z-index: -1; } .blurred-img { opacity: 0; } js: var divs = $('.social, .title'), limit = 0; $(window).on('scroll', function() { var st = $(this).scrolltop(); if (st <= limit) { $('.blurred-img').css({ 'opacity' : (1 - st/limit) }); } }); filter: blur works fine , looks better. how this? var img = document.getelementbyid("background-img"); var container = document.body; var maxblur = 20; window.addeventlistener("scroll", function(){ var position = containe...

Simple vs complex user entry functions in Lisp -

at site: http://www.gigamonkeys.com/book/practical-a-simple-database.html there user entry function listed follows: (defun prompt-read (prompt) (format *query-io* "~%~a: " prompt) (force-output *query-io*) (read-line *query-io*)) are there major advantages of above function compared following simpler form: (defun prompt-read2 (prompt) (format t "~%~a: " prompt) (setf answer (read-line))) is recommended use force-output , *query-io* time? setting answer global variable bad. should return answer , let caller wants it. if use special (~global) variables, should put asterisks around name ( *answer* instead of answer ). force-output needed ensure user sees prompt before having answer. if run second version using sbcl in terminal, program freezes wait input without saying anything. *query-io* should used querying things user, because environment might want handle differently other output. example, might write gui wrappe...

.Net MVC Multi tenant URL Single sign on (SSO) -

i have application in .net core , multi tenant implementation follows: tenants identified through url( www.example.com/ tenant1 or www.example.com/ tenant2 ).the tenants use shared database, i.e., data separated using id each tenant in each tables , each query usage tenantid fetch database corresponding each tenant. i need implement sso in application , not able find solution url based multi-tenancy implementation sso . so if user changes tenantname in url, , if valid user tenant, allowed else not. i using cookie middleware authentication/authorization : https://docs.asp.net/en/latest/security/authentication/cookie.html thanks suggestions. you can accomplish via existing owin middlewares. extract url segment in middleware , find is current request authenticated if authenticated, logged in user having permission view data of tenant if (1) & (2) valid, pass request through other middlewares else, return unauthorized. all takes cust...

Simple python script to get a libreoffice base field and play on vlc -

i've banged head hours on one, , don't understand libreoffice macro api enough know how make work: 1) script works in python: #!/usr/bin/env python3 import subprocess def play_vlc(path="/path/to/video.avi"): subprocess.call(['vlc', path]) return none play_vlc("/path/to/video.avi") 2) i've got python scripts working fine in libreoffice base, , script fired on button press. video opens (with error - see below) now, how open path found in given record's field labeled "path" -- ie, being passed python, , how pull relevant bit of info? further, whenever fire this, video plays, get: com.sun.star.uno.runtimeexceptionerror during invoking function play_vlc in module file:///usr/lib/libreoffice/share/scripts/python/vlc.py (<class 'typeerror'>: can't convert 'com.sun.star.lang.eventobject' object str implicitly /usr/lib/python3.5/subprocess.py:1480 in function _execute_child() [restore_sig...

javascript - jQuery hide() not working in enterprise mode emulating IE8. Read description -

i have menu div , appbody div appbody div opens totally different application. outer application html/js/jquery (along java) other application opens inside appbody div has flex/flash/swf. note: works fine until run f12 developer tools emulation document mode: edge , browser profile: enterprise. (enterprise mode emulating ie8, says console). $("a.submenutrigger").click(function(){ $(this).parent().find("ul.submenuholder").show(); $("div#appbody").hide(); $(this).parent().hover(function(){}, function(){ $(this).parent().find("ul.submenuholder").hide(); $("div#appbody").show(); }); }); on clicking menu, submenu div shown , appbody hidden. in enterprise mode, appbody div isn't being hidden , submenu div border minutely visible if hidden behind appbody div. attaching codes, thank bearing essay. also, note other app flex doesn't have doctype on index.jsp page. tried adding html 5 html 4.1 swf weirdly s...

unable to start FOP in Jenkins -

getting following error while building job in jenkins: details mode lastwritetime length name ---- ------------- ------ -------- 6/28/2016 3:40 pm temp jenkins error log building application: "invocationtargetexception" processing main file... unable start fop: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.apache.fop.cli.main.startfopwithdynamicclasspath(main.java:133) @ org.apache.fop.cli.main.main(main.java:207) caused by: java.lang.noclassdeffounderror: org/apache/xmlgraphics/image/loader/imagecontext @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(unknown source) @ java.security...

javascript - Move element before the end of BODY -

is there way place html element before body end tag, without knowing tags before it? in scenario don't know there ul list @ end. note : can't use jquery solve this. e.g. <body> <p id="test">hello</p> <script> document.getelementbyid("test").move_before_body(); //<-- </script> <ul> <li>...</li> <li>some random stuff</li> </ul> <!-- element should moved position --> </body> someelement.appendchild move element end of someelement . document.body.appendchild( document.getelementbyid("test") );

javascript - why dynamically mounted vuejs content is not child component of root vue instance? -

i load html containing customized component, , mount content fixed node in parent component. unfortunately, found there no parent-child relationship between them, events dispatched dynamically inserted component can not received root vue. have created 1 fiddle, or proposal appreciated!. http://jsfiddle.net/matiascx/7ljygv81/1/ <div id="app"> <button v-on="click: addnewelement()">add custom element</button> <br /> <div id="dynamicloaded"></div> </div> js: new vue({ el: '#app', data: { sampleelement: '<div class="dynamic-child"><button v-on="click: test()">test</button></div>' }, methods:{ addnewelement: function(){ var vmtemp = vue.extend({ template: this.sampleelement, methods: { test: function(){ ...

angularjs - How to resolve Error in karma unit testing: Can not load "Chrome"..? -

i getting head around karma unit testing, installed angular app in osx: # install karma: $ npm install karma --save-dev # install plugins project needs: $ npm install karma-jasmine karma-chrome-launcher --save-dev my karma config generated karma init , contains this: plugins: [ 'karma-chrome-launcher', 'karma-jasmine' ], however when run karma start get: can not load "chrome", not registered! perhaps missing plugin? how can fix this? this config file: //jshint strict: false module.exports = function(config) { config.set({ basepath: './app', files: [ 'bower_components/angular/angular.js', 'bower_components/angular-route/angular-route.js', 'bower_components/angular-mocks/angular-mocks.js', 'components/**/*.js', 'view*/**/*.js' ], autowatch: true, frameworks: ['jasmine'], browsers: ['chro...

vb.net, webbrowser, many same classname -

yesterday asked how text in div has no id. people gave me answer: private sub button1_click(sender object, e eventargs) handles button1.click dim divs = webbrowser1.document.body.getelementsbytagname("div") each d htmlelement in divs if d.getattribute("classname") = "js-text-container" richtextbox1.text = d.innertext end if next but i'm facing new problem: realized many articles have same class name "js-text-container , , when click button1 , in richtextbox text of last div class name... how text in first div class named "js-text-container"? just exit loop after found first element... dim divs = webbrowser1.document.body.getelementsbytagname("div") each d htmlelement in divs if d.getattribute("classname") = "js-text-container" richtextbox1.text = d.innertext exit end if next you should learn how use breakpoint , step code...

c# - Violation of PRIMARY KEY constraint 'PK__tblmembe__DD7012648BA5EC8B' When insert in DataBase *** ASP.Net Query -

i create page insert users . but when run the page show me error error pic asp code protected void page_load(object sender, eventargs e) { system.data.sqlclient.sqlconnection con = new system.data.sqlclient.sqlconnection(); con.connectionstring = system.configuration.configurationmanager.connectionstrings["shopdbconnectionstring"].connectionstring; system.data.sqlclient.sqlcommand cmd = new system.data.sqlclient.sqlcommand(); cmd.commandtext = "insert tblmember values ('" + txtemail.text + "','" + txtname.text + "','" + txtfamily.text + "','" + txtpass.text + "','','" + dropdownlist1.selectedvalue + "') "; cmd.commandtype = system.data.commandtype.text; cmd.connection = con; con.open(); cmd.executenonquery(); con.close(); response.redirect("default.aspx"); } my database it seems you're not pass...

mysql - use result string from one table as column names for another query -

i trying trying simplify following query :- select id, m_field_id_46 liverpool,m_field_id_47 london,m_field_id_48 belfast member_data in way can dynamically create column names select id, (select group_concat('m_field_id_',m_field_id,' ',m_field_label) member_fields) dist member_data however not working. please help i got working looking @ answer stackoverflow: - set @liststr = ( select group_concat('md.m_field_id_',m_field_id,' `',m_field_label,'`') member_fields ); set @query := concat('select ', @liststr, ' member_data'); prepare stmt @query; execute stmt;

json - How to remove unicode characters from Dictionary data in python -

after using request library , getting below dict in response.json() {u'xyz': {u'key1': none, u'key2': u'value2'}} i want remove unicode characters , print key value pairs without unicode chars i have tried below method remove , shows malformed string >>> import json, ast >>> c = {u'xyz': {u'key1': none,u'key2': u'value2'}} >>> ast.literal_eval(json.dumps(c)) getting 'valueerror: malformed string' any suggestion on how ? you can use unicodestring.encode("ascii","replace") >>> ustr=u'apple' >>> ustr u'apple' >>> astr=ustr.encode("ascii","replace") >>> astr 'apple'

php - JQWidgets Combobox Typed value not being echoed or submitted to database -

below codes using, when selected values database, submitted database, if type not in database , want submitted, not submitted or echoed php. sombody please me. thank you. <?php //jason file #include connect.php file include('db_connect2.php'); //get county of selected district $query = "select * primary_schools "; $result = mysql_query($query) or die("sql error 1: " . mysql_error()); while ($row = mysql_fetch_array($result, mysql_assoc)) { $customers[] = array( 'emis_no' => $row['emis_no'], 'district' => $row['district'], 'county' => $row['county'], 'subcounty' => $row['subcounty'], 'parish' => $row['parish'], 'school' => $row['school'] ); } echo json_encode($customers); ?...

javascript - relational database data using ngrepeat -

Image
i want show data in parent-child(bu_name) format using angularjs, used ng-repeat it's not working in paren-child manner, please give hint or explanation how solve problem? var businessdata = [{ "bu_id": 2, "tenant_id": 1, "company_id": 1, "bu_name": "qhhjqqw", "created_date": "2016-05-31 10:58:06", "updated_date": "2016-05-31 10:58:06", "parent_id": null }, { "bu_id": 3, "tenant_id": 1, "company_id": 1, "bu_name": "kqjjk", "created_date": "2016-05-31 10:58:12", "updated_date": "2016-05-31 10:58:12", "parent_id": 2 }, { "bu_id": 5, "tenant_id": 1, "company_id": 1, "bu_name": "parent...

C# deserialize Json based on condition -

{ "timeago": "6 minutes ago", "time": "07/11/2016 07:00 am", "alertid": 145928, "details": { }, "priority": 10, "type": 2, "isclosed": 0, "notescount": 0, "patientaccountid": 680, "isread": 0 } i want deserialize json based on int value 'type', in such way, want details different types public class notification { public string timeago { get; set; } public string time { get; set; } public int alertid { get; set; } public object details { get; set; } public int priority { get; set; } public int type { get; set; } public int isclosed { get; set; } public int notescount { get; set; } public int patientaccountid { get; set; } public int isread { get; set; } } if type = 1, object 'details' of type a, if type = 2, 'details' of type b , on. there 25 values...

java - Out of memory error when writing out spark dataframes to parquet format -

i'm trying query data database, transformations on , save new data in parquet format on hdfs. since database query returns large number of rows, i'm getting data in batches , running above process on every incoming batch. update 2: batch processing logic is: import scala.collection.javaconverters._ import org.apache.spark.sparkcontext import org.apache.spark.sql.sqlcontext import org.apache.spark.sql.row import org.apache.spark.sql.types.{structtype, structfield, stringtype} class batch(rows: list[string], sqlcontext: sqlcontext) { // actual schema has around 60 fields val schema = array("name", "age", "address").map(field => structfield(field, stringtype, true) ) val transformedrows = rows.map(rows => { // transformation logic (returns array[array[string]] type) }).map(row => row.fromseq(row.toseq)) val dataframe = sqlc...

magento - Billing with Authorize.net ARB Billing on specific dates instead of an interval -

i have subscription happens on 4 specific dates on during year according custom cycle . want people subscribe billed on same day every 2 months. if set 2 month interval gets charged separately according day subscribe . can fixed payment date set arb recurring billing ? what need charge user using aim api , pro rate first payment first scheduled payment date. arb subscription take over. that's there it.

java - How to use IN clause in Spring data Cassandra -

this question has answer here: how bind in-clause values in cql 3 prepared statement? 1 answer i'm trying query cassandra table using in clause , @query annotation spring data my query in init method- session = cassandrasessionfactory.getsession(); statementmylist = session.prepare("select * my_file_content my_content in (?);"); tried bind query boundstatement- final boundstatement boundstatement = daoconstants.getboundstatement(statementmylist); try { list<row> rowlist = session .execute( boundstatement .bind(mylist)) .all(); // mylist = "'04748558-0eb3','531aaf2bf6b782f95e2e','6fc98ac2'" } rowlist returns empty array. doing wrong here? the problem don't need parenthesis if binding full list, sho...

android - Redraw route on map when user changes driving route -

i'm working on android app draws path on map using polyline options, between source destination. this works fine. what need is, if user starts source, , instead of taking drawn route towards destination, user takes route, path on map should redrawn user's current path. i'm using directions api drawing path. i think, i'm required use google navigation api. how can use within app, without having navigate google maps app? first: check if current/last known location near or falls on path/route created. direction api: check if place falls in route path between 2 places second: if current/ last known location if outside or off path/route created, send request direction current location same destination. or try this turn turn navigation

JavaScript - Copy text with clipboard.js based on class name -

i'm trying copy-to-clipboard function work below html-code using clipboard.js library: <table id="test"> <tr><td class="c2c"><a id="1" class="btn fa fa-clipboard fa-2x" data-clipboard-action="copy" data-clipboard-target="1" data-value="http://some/link/1"></a></td></tr> <tr><td class="c2c"><a id="2" class="btn fa fa-clipboard fa-2x" data-clipboard-action="copy" data-clipboard-target="2" data-value="http://some/link/2"></a></td></tr> <tr><td class="c2c"><a id="3" class="btn fa fa-clipboard fa-2x" data-clipboard-action="copy" data-clipboard-target="3" data-value="http://some/link/3"></a></td></tr> </table> as can see value/id changes each td or a-element. instea...

php - Regex for words connected by hyphen and underscore while keeping punctuation -

Image
i have been reading, searching , trialling different ways write regex such p{l}, [a-z] , \w can't seem results after. problem i have array made of full sentences punctuation, parsing through array using following pre_match, works in keeping words , punctuation. preg_match_all('/(\w+|[.;?!,:])/', $match, $matches) however, have words these: word-another-word more_words_like_these and able retain integrity of these words (connected) current preg_match breaks them down individual words. what tried preg_match_all('/(p{l}-p{l}+|[.;?!,:])/', $match, $matches) and; preg_match_all('/((?i)^[\p{l}0-9_-]+|[.;?!,:])/', $match, $matches) that found here but cannot achieve desired outcome: array ( [0] a, [1] word, [2] like_this, [3] connected, [4] ; ,[5] with-relevant-punctuation) ideally able account special characters of these words have accents just insert hyphen character class. note hyphen needs appear @ beginning or end of...