Posts

Showing posts from June, 2015

bootstrap page header h1 exit outside of layout -

i need small resize actual h1 of page, i've tried css not working, actual html page this: http://www.bootply.com/upae5fllat problem h1 of page , search div go outside of layout, example in image: https://snag.gy/8kcmva.jpg , how can resize h1 , search div not go outside of layout? on line 120 need remove row class. this because row class has negative margin, , need when followed col-* element.

node.js - Start a node server using shell script from Jenkins job -

i trying automate build , test process project. pre-requisite have broker (node server) running tests executed needs build first. i following below steps jenkins job: i calling shell script(stopbroker.sh) check on specific port if broker running. if yes, killing in script taking latest changes git , building it i calling script(startbroker.sh) start broker again on specific port. the problem here if manually go , execute startbroker script terminal jenkins user, node server gets started in background , keeps on running forever. when run jenins job, broker started , killed automatically jenkins job finishes. my broker script listed below reference: #! /bin/sh echo "starting broker" cd "<broker-directory>" broker=`node . >> /tmp/broker.log&` echo "broker started processid $broker" echo "exiting script" please suggest how keep broker running after jenkins job finishes. if remove & startbroker script, bro

java - ERROR: Can not execute Findbugs -ArrayIndexOutOfBoundsException -

when ran sonar scan getting arrayindexoutofboundsexception in find-bugs because of problem sonar scan failing . can please resolving issue ? logs: error: error during sonarqube scanner execution error: can not execute findbugs error: caused by: java.lang.arrayindexoutofboundsexception: 27528 error: caused by: 27528 java.lang.arrayindexoutofboundsexception: 27528 @ org.objectweb.asm.classreader.<init>(unknown source) @ org.objectweb.asm.classreader.<init>(unknown source) @ edu.umd.cs.findbugs.asm.fbclassreader.<init>(fbclassreader.java:35) @ edu.umd.cs.findbugs.classfile.engine.asm.classreaderanalysisengine.analyze(classreaderanalysisengine.java:47) @ edu.umd.cs.findbugs.classfile.engine.asm.classreaderanalysisengine.analyze(classreaderanalysisengine.java:34) @ edu.umd.cs.findbugs.classfile.impl.analysiscache.getclassanalysis(analysiscache.java:268) @ edu.umd.cs.findbugs.classfile.engine.classinfoanalysisengine.analyze(classinfoan

node.js - What is the "=>" syntax in nodejs? -

this question has answer here: what's meaning of “=>” (an arrow formed equals & greater than) in javascript? 8 answers i'm wondering difference between anonymous function: callback = function (a) {return a} and using "=>" notation? callback = (a) => {return a} is more syntactic sugar? () => called arrow function of javascript, introduced in ecma script 6. it's useful more intuitive handling of current object context. reference link new features of ecma script 6.

java - Oracle JDBC: underflow in double -

when trying insert doubles double precision column of oracle table, exception when double out of range (in case: small), when using preparedstatement (if use normal statement , rounds double 0). table: create table test ( value double precision ); java code: double d = 1e-234; // using statement works, number gets rounded , 0 inserted try (statement stmt = conn.createstatement()) { stmt.executeupdate("insert test values (" + d + ")"); } // using preparedstatement fails, throws illegalargumentexception: underflow try (preparedstatement stmt = conn.preparestatement("insert test values (?)")) { stmt.setdouble(1, d); stmt.executeupdate(); } do have check , round doubles before using them in insert/update statements? can somehow have values automatically rounded? thanks insights/hints. double precision = float(126) noted in comment. use binary_double data type have same precision java double . reference:

Laravel PHP JSON Decoding -

i have code looks this """ http/1.0 200 ok\r\n cache-control: no-cache\r\n content-type: application/json\r\n date: tue, 08 nov 2002 05:46:42 gmt\r\n \r\n {\n "request": {\n "body": ""\n },\n "response": {\n "status": 1,\n "users": [\n {\n "user_id": 1,\n "username": "john.doe",\n "account_status": "1",\n "online_status": 1,\n } ]\n }\n } """ that value came database, problem i've got that, can't decode using json_decode... there class or function can decode convert array()? as mentioned in comment, have there whole http response. holds json data in body, need parse that. here's 1 way go it: preg_match("/\{(.*)\}/s", $rawre

java - Quartz job to send email using Javamail, but Javamail is synchronous -

the title sums issue @ moment. if have multiple instances of job running at/around same time, javamail throws exception it's meant used synchronously. there way can make run asynchronously? or there alternative javamail asynchronous? i think there several ways deal such kind of tasks: wrap service periodically send batch of emails; send each email in on thread, i.e. imply separate smtp connection; @async public void sendemail(string smtpserver, string to,string from,string subject, string body) { send(smtpserver, to, from, subject, body); }

c# - Xamarin Forms UI Thread not working -

i trying create countdown timer inside thread updated in ui of application. have problem using reference `system.threading.thread. using system.globalization; using system.threading; new system.threading.thread(new system.threading.threadstart(() => { invokeonmainthread(() => { this.timer1 = this.timer1.adddays(16); this.timer1 = this.timer1.addmonths(10); this.timer1 = this.timer1.addyears(2015); this.timer2 = datetime.now; this.result = this.timer1.subtract(this.timer2); nbjour = this.result.days.tostring(); nbheure = this.result.hours.tostring(); nbmin = this.result.minutes.tostring(); }); })).start(); thread , threadstart() underlined red, no error message. use device.begininvokeonmainthread instead of invokeonmainthread or use task . device.begininvokeonmainthread( () => { .

loops - how to write in bash a function that detect partial names of multiple files in multiple folders? -

i have multiple files e.g. singleta.dat singletb.dat singletc.dat in multiple folders. each file presents common part < singlet > , extension .dat, , variable < b c ...>. go through folders contain these files, , independently variable b c ... convert file name sing.dat example. in bash exist function allows detect these partial variables? thanks in advance! tommy you can use find. example: find mydir -name "singlet?.dat" -execdir mv {} sing.dat \;

angular - Trying to make a Angular2 service that updates Firebase and returns an Observable -

i want make method on service works angularfire2 , returns observable. want update counter (updating counter may not scalable example, not matter here). attempt service: import { injectable } '@angular/core'; import { angularfire } 'angularfire2'; import { observable } 'rxjs/observable'; import 'rxjs/add/operator/map'; @injectable() export class myservice { constructor(private af: angularfire) { } updatecounter(): observable<any> { let counterobserver = this.af.database.object('/variousdata/counter'); counterobserver.take(1).subscribe(res => { let counter = res.$value; return this.af.database.object('/variousdata').update({counter: counter+1}); }); return counterobserver; } } and using this: let resultobservable = this.myservice.updatecounter(); resultobservable.subscribe( (obj) => { console.log('result:', json.stringify(obj)); } } but getting first result (get

mysql - Sorting numbers string with letter -

i have strings such 70x100 cm 70x140 cm 70x70 cm 72x120 cm 70x130x70 cm 70x75x70 cm 72x72 cm when want sort in order: 70x70 cm 70x75x70 cm 70x100 cm 70x130x70 cm 70x140 cm 72x72 cm 72x120 cm this code: order cast(cast(eaov.value decimal(3,0)) unsigned integer), eaov.value any ideas? a minor mod answer strawberry. changing 'cm' series of x0 ensure there 3 dimensions sort order select * eaov order cast(substring_index(replace(eaov.value, ' cm', 'x0x0x0'), 'x', 1) unsigned integer), cast(substring_index(substring_index(replace(eaov.value, ' cm', 'x0x0x0'), 'x', 2), 'x', -1) unsigned integer), cast(substring_index(substring_index(replace(eaov.value, ' cm', 'x0x0x0'), 'x', 2), 'x', -1) unsigned integer) performance not strong point.

How to implement Single Sign On on Android -

i implement single sign on on android. i have set of mobile apps need speak server identify user. when 1 of applications recognised belonging user, other apps should able detect that, without asking user further identification. so user log in 1 application , other applications follow automatically. please how achieve that? you use central app sign-on, , call service other apps. sign-on management app should have service marked application-specific permission (see https://developer.android.com/guide/topics/manifest/permission-element.html ), , should set android:protectionlevel attribute signature ; example in android manifest: <permission android:name="com.example.sso_access" android:protectionlevel="signature" /> and in android manifest: <service android:enabled="true" android:exported="true" android:name=".singlesignonservice" android:permission="com.example.sso_access" &g

java - Android MediaPlayer Error Feedback -

i using mediaplayer in code play video. this code : mp.setdatasource(source); mp.setoncompletionlistener(this); mp.setonerrorlistener(this); mp.prepareasync(); in cases video not playing(and if call mp.getduration(); fail) , instead of getting onerror feedback getting oncompletion feedback, , can't know if problem occurs. and times onerror function called. any idea how can check if mediaplayer fail in oncompletion function? according docs, onerrorlistener returns: true if method handled error, false if didn't. returning false, or not having onerrorlistener @ all, cause oncompletionlistener called. so oncompletion being called when onerror returns false. your implementation of onerrorlistener should return true avoid oncompletion called.

jquery - fragment - fade in and then fade out -

i want custom fragment animation, fade-right / fade-left in , fade-out after short delay. given fragments have class .visible , .current-fragment . thought delete class .visible after short delay , wanted result. it doesn't. code-snippet doesn't remove class. reading through .js see adds .visible class every element. // show fragments toarray( dom.wrapper.queryselectorall( slides_selector + ' .fragment' ) ).foreach( function( fragment ) { fragment.classlist.add( 'visible' ); } ); here code-snippet o far: if ($(".slash__input").hasclass("fade-left") || element.hasclass("fade-right") ) { $("slash__input").removeclass("visible"); settimeout(function () { console.log("working"); $('slash__input').removeclass("visible"); }, 5000);} thanks answer. maybe i'm down wrong path , should css? found in reveal.js documentation :

jquery - How to show single data in popup window by clcking id using codeigniter with database -

i want show single record clicking button id using codeigniter mysql. when clicking button ajax not working. views: <div class="demo1"> <input type="hidden" id="porder" name="porder" value="<?php echo $result->po_id ?>"> <input id="btnsubmit1" type="button" name="btnsubmit" value="release"/> </div> ajax code: $('.demo1').click(function(){ var po_ids = $('#porder').val(); alert(po_ids); $.ajax({ type: "get", url: "view_single_temp", cache: false, data: 'po_id='+po_ids, datatype: "html", success: function(htmldata) { } }); this controller code: public function view_single_temp() { echo $po_id = $this->uri->segment(3); $details = $this->inventory_m->getpo_single($po_id); print_r($details); if( $

traveling salesman - Does the optimum solution of a TSP remain the optimum even after skipping a few cities? -

Image
let's know global optimum solution 100-city standard travelling salesman problem. now, lets salesman wants skip on 5 of cities. tsp have re-solved? sequence of cities obtained deleting cities previous optimum solution global optimum new 95-city tsp? updated: replaced counterexample euclidean instance. great question. no, if remove cities, original sequence of cities not remain optimal. here counterexample: the node coordinates are: 0 0 4 0 4 2 2.6 3 10 3 4 4 4 6 0 6 here optimal tour: now suppose don't need visit node 5. if "close up" original tour, resulting tour has cost of 21.94: but optimal tour has cost of 21.44: (if want remove 5 cities instead of 1, put 5 cities close way on right.)

c# - Want to replicate a control with two picker -

i'm making xamarin.forms app older xamarin app, , need implement feature available in older version, looked past 3 hours , can't seem find solution. how code control : http://imgur.com/a/9mhny ? i figured custom picker can't find example online.

windows - How to request an asp.net server hosted in an other pc -

i'm trying request manually asp.net distant server on port 5000 in same network. doesn't work properly, have "connection_timed_out" error. i tried open port 5000, windows firewall's advanced parameters doesn't work too. edit : below can find mvc routing, i'm not sure problem caused. app.usemvc(routes => { routes.maproute( name: "default", template: "{controller}/{action}/{id?}"); });

Monitoring Tomcat via JMX -

we have challenge monitor tomcats via jmx (and via monitis via jmx connection). tomcat exposes multiple mbean attributes via jmx, cannot find documentation or overview attributes , meaning. can guess meanings, don´t think that´s best way it. so, there listings or descriptions exposed attributes? we´re looking classic things memory consumption, request throughput etc. have looked here https://wiki.apache.org/tomcat/faq/monitoring ? there information there basic metrics might want monitor

ios - -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]' -

@implementation basicprofileview - (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. [self.scrollview addsubview:_basicprofileview]; [_scrollview setcontentsize:self.basicprofileview.frame.size]; gender=@"0"; seekinggender=@"0"; _basicprofileview.backgroundcolor=[uicolor clearcolor]; } - (ibaction)btncontinue:(id)sender { [self callsignupprofileservice]; } -(void)callsignupprofileservice { nsstring * post = [[nsstring alloc]initwithformat:@"userid=%@&cell_phone=%@&work_phone=%@&gender=%@&seekgender=%@&address=%@&country=%@&state=%@&city=%@&mothertongue=%@&zipcode=%@",userid,_txtcellphone.text,_txtworkphone.text,gender,seekinggender,_txtadress.text,_wsconstcountryid,_wsconststateid,_wsconstcityid,_wsconstlanguageid,_txtzipcode.text]; nsurl *url = [nsurl urlwithstring:[nsstring stringwithformat:@"url"]]; rbconnect = [[rb

elasticsearch - data duplication in elastic -

i uploading data elk server through jdbc input plugin in logstash. once uploading data elastic server, when second time uploading ,data duplication happens. want avoid that. second thing if using document id in output section of logstash , if rows updated key using document id same , ll update field? . my requirement want avoid data duplication , want update fields updated having same primary key value. any appreciated! thanks

VBA Excel To Match 2 columns on A with 2 columns on B and return value -

i need vba excel script compare columns & b in worksheet 1 against & b in worksheet 2 if match found return column c worksheet one. ive can in excel using formula speed im after doing via vba quicker , id prefer final output of table contain values instead of formulas. ive done lot of digging cant find piticular requirement. any on gratefully appreciated. this th excel formula im using {=iferror(index(sqldata!d:d,match(1,(sqldata!a:a=a2)*(sqldata!b:b=b2),0)),"0")} sub stridhan() dim c range, d range, lr long dim ws1 worksheet, ws2 worksheet dim rng1 range, rng2 range application .screenupdating = false .calculation = xlcalculationmanual end 'rename sheet1 , sheet2 set ws1 = thisworkbook.sheets("sheet1") set ws2 = thisworkbook.sheets("sheet2") set rng1 = ws1.range("a2", ws1.range("a" & ws1.cells(rows.count, 1).end(xlup).row)) set rng2 = ws2.range("a2", ws2.range("a" & ws2

c# - Prevent WebBrowser Control from automatically adding <A> Tag when contentEditable is set -

i use webbrowser control , have text inside like: some text https://www.example.com text. this code way added text , enabled web browser edit contents: public partial class form1 : form { private htmlbody _body; public form1() { initializecomponent(); webbrowser1.navigate("about:blank"); } private void webbrowser1_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { _body = ((htmlbody)((htmldocument)webbrowser1.document.domdocument).body); _body.contenteditable = true.tostring(); _body.innerhtml = "some text https://www.example.com text"; } } if run , changed part of link (for type else instead of 'example.com' , lost focus) automatically adds tag <a> around link. can see in innerhtml property. it's wrong me. is there way avoid behavior? lot! you can turn off auto-dettecting url in document. so, in documentcompleted evnet a

java - How to Show in TimePickerDialog extra 1 Hours -

how add 1 hour in time picker dialog. eg.:- if current hour 4.00 pm want show 5.00 pm in time picker. final calendar c = calendar.getinstance(); c.add(calendar.hour,1); mhour = c.get(calendar.hour_of_day); mminute = c.get(calendar.minute); // launch time picker dialog timepickerdialog = new timepickerdialog(checkout.this, new timepickerdialog.ontimesetlistener() { @override public void ontimeset(timepicker view, int hourofday, int minute) { tvtimeselect.settext("delivery time : "+hourofday + ":" + minute); timepickerdialog.dismiss(); } }, mhour, mminute, false); timepickerdialog.show(); please tell me solution ...

working with jar and so files in Xamarin forms -

i'm working brother label printer "ql-710w" printing purpose. i'm using xamarin forms targeting android printing web view content. i'm facing problem in communicating printer. have provided android demo application code working fine me in android studio. i'm trying use provided .jar files , .so files in xamarin android. i'm stuck in adding , consuming .jar , dependent .so files. can 1 suggest, how add .jar files , .so files in binding project. this error i'm getting java.lang.unsatisfiedlinkerror: couldn't load createdata loader dalvik.system.pathclassloader[dexpathlist[[zip file "/data/app/printpoc.printpoc-1.apk"],nativelibrarydirectories=[/data/app-lib/printpoc.printpoc-1, /vendor/lib, /system/lib]]]: findlibrary returned null

AWK replacing tabs in last column with conditions -

i'm trying work dataset contains tabs delimiters, last column has custom field users able enter custom text, including tabs. i'm trying delete tabs using awk "/\t/{c++;if(c==7){sub(\"\t\",\"\");c=0}}1" users10000.csv >users10000awk.csv but seems there no delimiter between 6th , 7th column 7th empty. what i'm trying replace tabs found after 7th if last field not empty through awk /\t/{c++;if((c==7) && ($12!=\"\")){sub(\"\t\",\"\");c=0;}}1 usersorig.csv >usersorigawk.csv but results in error ){sub(\"\t\" unexpected @ time. i'm new awk , hoping work, formatting pain used to. chance help? sample input: 100008949 esttrellitta 264 44 6853 0 28 dec 2009 18:01:42 gmt el paso,tx. 100009841 chelseabex 152 50 394 0 28 dec 2009 18:05:43 gmt 100012792 erinpattisonn 984 666 5003 0 28 dec 2009 18:19:39 gmt under bed. 100013967 tubeautifulrosa

javascript - Uncaught TypeError: $this.text is not a function -

the second statement in code: var $this = $(this).children('div.submenu1').children('a.subtile')[0], title = $this.text(), name = $this.attr('node').val; produces error: uncaught typeerror: $this.text not function when hover on $this.text() in chrome debugger can see value want have in title . how can fix error? this happening because you're assigning variable $this native dom reference, not jquery reference. latter has access jquery api. you're doing 'reaching inside' array-like jquery stack , extracting native reference, via [0] . lose , it'll work: var $this = $(this).children('div.submenu1').children('a.subtile'), title = $this.text(), //<-- has access jquery api

ios - How do i refresh the particular Section? -

i have uitableview on viewcontroller has n number of sections first section displays wishlist products (only based on show wishlist option enabled in settingscontroller ) every time when add product wishlist on detailviewcontroller i'm triggering nsnotificatiion viewcontroller fetch wishlist records. my numberofrowsinsection: returns 1 because, uitableview + uicollectionview combination produce horizontal + vertial scrolling. so, i'm reloading section below way, if (iswishlistsectionreloadrequires) { nsarray *deleteindexpaths = [nsarray arraywithobjects: [nsindexpath indexpathforrow:0 insection:0], nil]; nsarray *insertindexpaths = [nsarray arraywithobjects: [nsindexpath indexpathforrow:0 insection:0], nil]; [tableview beginupdates]; [tableview insertrowsatindexpaths:insertindexpaths withrowanimation:uitable

how to use GROUP_CONCAT in laravel -

$assignment = assignment::find(crypt::decrypt($id)); $assignment_details = $assignment->raw_plan()->groupby('flag')->get(); i want following result of query in laravel select group_concat(name) 'names' `raw_plans` `assignment_id` = 1 group by`flag` please suggest me how use group_concat in laravel you can use relations query builder fetch results as: $assignment_details = $assignment->raw_plan() ->select(db::raw('group_concat(name) names')) ->where('assignment_id', 1) ->groupby('flag') ->get(); update use table_name.* in select fields. $assignment_details = $assignment->raw_plan() ->select('raw_plans.*', db::raw('group_concat(name) names')) ->where('assignment_id', 1)

jquery - Wrap text following a particular element with <p> -

Image
i've got html this: <div class="text"> <img src="http://placehold.it/50x50"/><a href="http://www.example.com" class="ht">the link</a> element doesn't right, text displays next link </div> <div class="text"> <img src="http://placehold.it/50x50"/><a href="http://www.example.com" class="ht">the link</a> <p>this proper kind of element, want them wrapped in paragraphs or @ least looking they've been wrapped in paragraphs</p> </div> and wondering if possible make text first example <div> display below link, wrapping <p></p> around text, jquery. it's not possible change html because it's user-generated comments kind of project, , can't force user put <p></p> around text. of them do, of them don't need find solution make them display same. i've done rese

How should I structure and denormalize private invites in firebase? -

so use case invite has following properties creatorid invitedlist (collection of userids) private/public how should structure in firebase? how should denormalize invited userids? typical query "get invites i've either created or been invited to." i'd imagine want create root node of privateinvites , set index on creatorid? if want list of invites i've been invited to, what's efficient way of setting in firebase? need set denormalized node , duplicate data adding invite each invitedid individually?

i want to read FTP file using apache camel -

i want read ftp file using apache camel requirement pick files around 4-5 files , process them question how can pick files specific date example want pick file created today leave yesterday file. how can write code pick files ftp using apache camel filtration on dates you can implement custom filter , ask camel process files satisfy filter eg: public class datefilter<t> implements genericfilefilter<t> { public boolean accept(genericfile<t> file) { calendar c = calendar.getinstance(); c.set(calendar.hour_of_day, 0); c.set(calendar.minute, 0); c.set(calendar.second, 0); c.set(calendar.millisecond, 0); long todayinmillis = c.gettimeinmillis(); return file.getlastmodified() >= todayinmillis; } } define filefilter bean <bean id="datefilter" class="com.something.datefilter"/> use above filter in route from("ftp://someuser@someftpserver.com?password=se

java - IntelliJ code style for specific variable names -

i using android studio , in code style settings have order code generation: static fields instance fields constructors instance methods static methods inner classes static inner classes this fine, except classes implement parcelable interface creator constant moved top of class this: public class task implements parcelable { public static final parcelable.creator<task> creator = new parcelable.creator<task>() { public task createfromparcel(final parcel source) { return new task(source); } public task[] newarray(final int size) { return new task[size]; } }; public static final task[] empty_task_array = new task[0]; private static final string tag = task.class.getsimplename(); private final datetime mstartdate; private final datetime menddate; private final int mid; i want creator constant appear @ bottom of class, don't want affect positioning of other constants. there way apply code style in intellij

vhdl - Highlighting an output in integrated vivado simulator based on its value -

Image
when output kind of variable vivado simulator shwon green (or orange when undefined, or red when there mistake). let's want watch variable better , want see if bigger value or holds value. therefore nice highlight value color when reaches specified value. e.g want highlight "ff" in pink times occurs.

Java object i use in scala are getting created several times -

i work play framework 2.5 , use several java classes trough scala in templates. create object 1 times @import myclass; @foo = @{new myclass(bar)} with code, contructor of myclass not called (i have put debug output in constructor check call of it) now use function of java class like @foo.getmesomebar() somewhere in template. now, constructor called. problem: every time use function of class in same template, constructor called. the same problem occurs, if pass scala variable template like @othertemplate(foo) every time foo used in othertemplate constructor called. is desired behavior? if yes, why? if no, how can avoid it? edit: if create myclass object in controller , pass there templates constructor called 1 times. in cases if have create myclass in template or have change lot of classes. according documentation , should not use @foo = @{ ... } define reusable value. preferred way do @defining(new myclass(bar)) { foo => @foo.getmesomebar()

javascript - Pass session ID variable out if inline JS function to allow it to be used elsewhere -

this question has answer here: how return response asynchronous call? 21 answers i creating single page web app using web sockets transport use session id verify user authenticated, have managed session id value server response cannot pass out of inline js function initiated message received web sockets. how do this? sample of code socket.onmessage = function(e) { if (debugmode) { console.log('notification : message received server "' + e.data + '."'); if (e.data.startswith("rid")) { message = e.data.split(','); } if (message[0].startswith('rid:')) { if (debugmode) { console.log('notification : rid message "' + message[0].split(':')[1] + '".'); } (var ismr = 0; ismr < activerequests.length; ismr++) { if (

javascript - Angular 2 Observable and Promise callback unit testing -

i have method in angular 2 service, gets details of specific user account - 1 that's logged in - , returns observable. (i using angularfire2 authentication, it's worth) as can see, getdata method using getauth method returns authentication state (as observable), in turn used gettoken method (which returns promise) token used populate authorization headers , http request. (i understand code might require refactoring, , appreciate feedback on that) getdata(): observable<idata> { let authheaders = new headers(); return observable.create((o: observer<idata>) => { this.getauth().subscribe((authstate: istate) => { this.gettoken(authstate).then(token => { /* ... * things token, call http service etc. */ ... authheaders.set('authorization', token); this.http.get('myendpoint/', { headers: this.authheaders

java - Android CalendarView with events -

Image
i'm looking calendarview can used show multiple events , google calendar. i haven't found solution using android.widget.calendarview . what best way implement feature? should customize android.widget.calendarview or should use existing library (which one)? you can use existing library can refer here http://www.viralandroid.com/2015/11/android-calendarview-example.html for more customize can use library https://github.com/prolificinteractive/material-calendarview

node.js - Invalid CSRF Token via Postman -

i using csrf protection in mean-stack application csurf node.js module. as long send post requests angular frontend web service, works fine. if try make post request via postman, i'll face: "forbiddenerror: invalid csrf token" according first answer how send spring csrf token postman rest client? token out of cookie login request , set every post request. requests working fine. i configured follows: app.use(csrf({cookie: {path: '/', httponly: true}})); app.use(function(req, res, next) { let token = req.csrftoken(); res.cookie('xsrf-token', token); res.locals.csrftoken = token; next(); }); best regards, tobias

networking - Cannot connect to MSSQL Server after recent windows 10 updates -

Image
i not able connect remote sql server machine, don't know went wrong yesterday able connect remote server. i can connect through management studio machine remote sql server cannot connect through sql profiler. please see below screenshot more info. if faced issue after os upgrade, should environment change. check sql server instance written correct , instance (administration - services). check firewall rules - easiest way temporary turn off.

jquery - Javascript function to format currency -

i using below function generate formatted comma separated currency value in javascript not working scenarios: 1234 => 1,234 (correct) 1.03 => 1.3 (wrong) how can fix issue in below function: function formatthousands(n, dp) { var s = '' + (math.floor(n)), d = n % 1, = s.length, r = ''; while ((i -= 3) > 0) { r = ',' + s.substr(i, 3) + r; } return s.substr(0, + 3) + r + (d ? '.' + math.round(d * math.pow(10, dp || 2)) : ''); } thanks in advance to fix code need make sure rest has @ least digits "dp" parameter, if not add leading zeros. function formatthousands(n, dp) { var s = '' + (math.floor(n)), d = n % 1, = s.length, r = ''; while ((i -= 3) > 0) { r = ',' + s.substr(i, 3) + r; } var rest = math.round(d * math.pow(10, dp || 2)); var rest_len = rest.tostring().length; if(rest_len < dp) { rest = '0'.re

rxjs - Angular 2 update global state as a side effect of updating a certain state -

Image
i want achieve setting global state while requesting data api , storing in state well, in location global state. i'm calling effect ( models.effects.ts ): @effect() models$: observable<action> = this.actions$ .oftype(get_models) .switchmap(() => this.modelsapi.getmodels()) .map(models => ({type: set_models, payload: models})) .catch((err: any) => observable.of({type: get_failure, payload: {error: err}})) now want this: @effect() models$: observable<action> = this.actions$ .oftype(get_models) .do(() => this.store.dispatch({type: 'set_loading_state', payload: true})) .switchmap(() => this.modelsapi.getmodels()) .map(models => ({type: set_models, payload: models})) .do(() => this.store.dispatch({type: 'set_loading_state', payload: false})) .catch((err: any) => observable.of({type: get_failure, payload: {error: err}})) as can see we're dispatching call globalreducer ( global.reducer.ts ): exp

sonarqube msbuild runner NullPointerException -

i'm trying run sonarqube.scanner.msbuild locally command prompt , receive same error above no matter project build. sonar server remotly , reachable via web interface. i'm building .net(c#) projects, .net4.0 adn 4.5, have .net 4.5 4.6.2 installed locally. sonar server version 6.1, because i'm testing i'm using basic configuration, internal db used. error received during end phase (sonarqube.scanner.msbuild.exe end) any idea? ----------- 14:04:57.429 info: execution failure 14:04:57.429 info: ------------------------------------------------------------- ----------- 14:04:57.429 info: total time: 5.475s 14:04:57.460 info: final memory: 41m/106m 14:04:57.460 info: ------------------------------------------------------------- ----------- 14:04:57.460 error: error during sonarqube scanner execution java.lang.nullpointerexception @ org.sonar.plugins.csharp.sarif.sarifparser10.handleissue(sarifparser1 0.java:69) @ org.sonar.plugins.csharp.sarif.s

php - updating a field in the database through a function and calling it -

i'm trying function updates field 'status' in database unpaid paid on click of hyperlink/button. here i'm doing not working. please me debug code. function pay($idno, $secid) { $query = "update payments set status='paid' idnumber = '$idno' , sec_id = '$secid'"; $result = mysqli_query($mysqli,$query); } $sec_id = '2'; $idno= '3'; echo "<td><a href='' onclick='pay($idno, $secid);' >pay now</a></td>"; } this attempted nothing happening. sql connection correct i've checked already. without more information on error appears mysql connection undefined. need pass parameter or reference global: function pay($idno, $secid) { global $mysqli; $query = "update payments set status='paid' idnumber = '$idno' , sec_id = '$secid'"; $result = mysqli_query($mysqli,$query); } $sec_id = '2';

powershell - Password with word and 4 generated characters -

i've following script , want generate password pattern temppw + 3 numbers , 1 special character. have change in script? # # description: wlacza konta, resetuje hasla ustawia zmiane hasla przy pierwszym logowaniu. # import-module activedirectory add-type -assemblyname system.web # pobiera liste kont z pliku userlist.txt # jeden user na wiersz, bo sie wysypie. $users = get-content -path 'g:\shares\xx xxx\resetpassword\userlist.txt' # foreach ($user in $users) { $unsecuredpwd = [system.web.security.membership]::generatepassword(10, 3) # szyfruje haslo, potem podstawia je w miejsce zmiennej unsecurepwd. $password = convertto-securestring -asplaintext $unsecuredpwd -force # ustawia haslo dla konta. get-aduser $user | set-adaccountpassword -newpassword $password -reset # wymusza zmiane hasla przy logowaniu. get-aduser $user | set-aduser -changepasswordatlogon $true # wlacza konto. enable-adaccount -identity $user write-host “uzytkownik: $user” write-host “haslo: $unsecu

javascript - angular2 work in background thread with custom serializable objects -

how achieve this: have potentially long computation (eg. huge json parse http resp.) , want in non-blocking way. i tried adopt multithread.js lib background work using web worker. lib requires json serializable objects pass execution function not aware of closures, dom or other globals. eg. mt.process(longrunningjob, donecallback)(jsonserializableargforbgjob) . lib rather old (3 years ago last commit). there better alternatives more suitable angular2? need target widest range of browsers including older ones (except ie/edge) service worker or lib using not option. for serialization found cerialize lib serialize custom objects decorating props. work adds quite lot of code , seems error prone. other concern use inheritance , polymorphism , not sure if lib ready such uc. 1 expect mechanism known java: serializable interface , overriden serialize/deserialize methods. there way accomplish in typescript/angular2? take @ vkthread plugin or on angular version ng-vkthread

Typescript, enums and string -

i have hard time converting string coming env variable enum. here's enum: enum environment { test = 1, development, production } export default environment; and here's i've been trying: export default class globalparameters { public static env: environment = environment[<string>process.env.node_env]; } console.log(process.env.node_env) // gives "development" let str = string(process.env.node_env); // gives "development" console.log(environment[str]) //gives undefined object.seal(globalparameters); your code seems work fine: enum environment { test = 1, development, production } console.log(environment[2]) // "development" let str = string(environment[2]); console.log(str); // "development" console.log(environment[str]) // 2 ( code in playground )

oop - Is Module pattern in javascript worth using? -

afaik understand module pattern in javascript, used create namespace variables , functions become private namespace save them inadvertent manipulation. e.g. consider following code: var istouchdevice = 'ontouchstart' in document.documentelement; //some code... if(istouchdevice == 1) { alert("you using touchscreen device"); } in above code if mistake had skipped 1 equal sign in if condition if(istouchdevice = 1) pollute whole code , further conditions check value of istouchdevice give false result. afai module pattern supposed solve these kind of issues. e.g. can make istouchdevice readable read-only thing. think modular code be: var useragent = function() { var touchdevice = 'ontouchstart' in document.documentelement; function istouchdevice() { return touchdevice; } return { iftouchdevice: istouchdevice }; }(); now if want check whether device touch screen do: if(useragent.iftouchdevice

vc6 - Where can I buy/download Visual C++ 6.0 Professional version? -

we have visual c++ 6.0 professional version installed on vm long time back. creating new vm , need vc++ 6.0 pro installed on it. have no plans of migrating newer versions of visual studio. where can buy/download visual c++ 6.0 professional version? if retiring old vm, perhaps can use magical jelly bean retrieve existing license key , transfer new vm.

java - Maven javadoc plugin build fails. How to add add portlet-api dependency -

i have vaadin project , tried configure javadoc plugin in project. added following plugin build->plugins section of pom. <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-javadoc-plugin</artifactid> <version>2.10.4</version> <executions> <execution> <goals> <goal>jar</goal> </goals> <configuration> <additionalparam>-xdoclint:none</additionalparam> </configuration> </execution> </executions> </plugin> .... </plugins> </build> when run mvn install , build fails following error. [error] failed execute goal org.apache.maven.plugins:maven-javadoc-plug

Excel VBA: nested dictionary issue -

i not able create nested dictionary, assign variable, overwrite 1 of inner values, , assign variable without original variable's value getting changed, not want. example, see following code: option explicit sub button1_click() dim d_outer scripting.dictionary set d_outer = new scripting.dictionary dim d_inner scripting.dictionary set d_inner = new scripting.dictionary call d_inner.add("key", "foo") call d_outer.add("first attempt", d_inner) ' cannot use "add", since key exists, must use item() d_inner.item("key") = "bar" call d_outer.add("second attempt", d_inner) ' print values. dim v_outer variant dim v_inner variant each v_outer in d_outer.keys() each v_inner in d_outer(v_outer).keys() debug.print "(" & v_outer & ", " & v_inner & "): '" & d_outer(v_outer)(v_inner) & "'" next v_i

hadoop - Spark Streaming with large messages java.lang.OutOfMemoryError: Java heap space -

Image
i using spark streaming 1.6.1 kafka0.9.0.1 (createstreams api) hdp 2.4.2, use case sends large messages kafka topics ranges 5mb 30 mb in such cases spark streaming fails complete job , crashes below exception.i doing dataframe operation , saving on hdfs in csv format, below code snippet reading kafka topic: val lines = kafkautils.createstream[string, string, stringdecoder, stringdecoder](ssc, kafkaparams, topicmap, storagelevel.memory_and_disk_ser_2/*memory_only_ser_2*/).map(_._2) writing on hdfs: val hdfsdf: dataframe = getdf(sqlcontext, eventdf, schema,topicname) hdfsdf.show hdfsdf.write .format("com.databricks.spark.csv") .option("header", "false") .save(hdfspath + "/" + "out_" + system.currenttimemillis().tostring()) 16/11/11 12:12:35 warn receivertracker: error reported receiver stream 0: error handling message; exiting - java.lang.outofmemoryerror: java heap space @ java.

Manage categorical variables with NA in R -

i using national survey run regression. df based on deographic , economic variables , sometime there missing values r address "na". i have categorical variables sometime find problems: example have variables q takes value 1 if individual employee, 2 if he/she worker not employee , 3 if person doesn't work. i know employees can work in private or public sector; problem don't know if employee worker of private or public sector (i have na). i want construct categorical variable taking care if employee in private or public sector: df$q2 <- ifelse(d.d$q=="3",1, ifelse(d.d$q=="2",2, ifelse(d.d$q=="1" & d.d$priv=="1",3, ifelse(d.d$q=="1" & d.d$pubbl=="1",4, 0)))) df$q2 <- as.factor(d.d$q2) levels(d.d$q2) "0","1","2","3","4" the level 0 suppos referred employee worker don't know working sector (private or public). my desidered output

c# - Get MassTransit message retries amount -

i'm using masstransit+rabbitmq. 1 of consumers implements retry policy , i'm wondering if there way message's retries amout once message in error queue? also know how mt counting retries because didn't namage find related information in message's headers using rabbitmq server. thanks. you can, in consumer, use following method retry retry attempt number. consumecontext.getretryattempt() it should return > 0 if retry.

javascript - WebGL indices array size -

Image
for 1 of webgl projects need generate lots of objects indices. examples, cones. when javascript generates not many works fine, adding cones scene rendering becomes glitchy. i pretty sure problem in defining index buffer: *var ibuffer = gl.createbuffer(); gl.bindbuffer(gl.element_array_buffer, ibuffer); gl.bufferdata(gl.element_array_buffer, new uint8array(glindices), gl.static_draw);* to more specific unit8array or transition shader. can me that? if use uint8 indices limiting maximum of 256 unique vertices per drawcall, if batch draw it's exceeding max value of uint8 , integer truncation means end effectvely random vertex connectivity across models. increase uint16 indices let have 65536 unique vertices per draw.

c# - How to deserialize "2015-02-02" to DateTimeOffset as UTC? -

is possible tell json.net deserialize '2012-07-19' datetimeoffset value 0 offset? code example reproduce: public class singledatetimefield { public datetimeoffset startdatetime { get; set; } } [test] public void convert() { // given var content = @"{""startdatetime"":""2012-07-19""}"; var jsonserializersettings = new jsonserializersettings() { dateformathandling = dateformathandling.isodateformat, dateparsehandling = dateparsehandling.datetimeoffset, datetimezonehandling = datetimezonehandling.utc }; // when var obj = jsonconvert.deserializeobject<singledatetimefield>(content, jsonserializersettings); // var expected = new datetimeoffset(2012, 07, 19, 0, 0, 0, timespan.zero); assert.that(obj.startdatetime, is.equalto(expected)); } this fails with expected: 2012-07-19 00:00:00.000+00:00 was: 2012-07-19 00:00:00.000+03:00 note ti

facebook - Messenger Extensions Javascript SDK Error 2071011 -

i'm trying create messenger web view ( https://developers.facebook.com/docs/messenger-platform/messenger-extension ) using messenger extensions javascript sdk. the page opened web view has following js code <script> (function(d, s, id){ var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) {return;} js = d.createelement(s); js.id = id; js.src = "//connect.facebook.com/en_us/messenger.extensions.js"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'messenger')); window.extasyncinit = function () { // messenger extensions js sdk done loading messengerextensions.getuserid(function success(uids) { var psid = uids.psid; alert(psid); }, function error(err) { alert("messenger extension error: " + err); }); }; </script> and result alert following message "messenger extension error: 2071011". method "getuserid&qu

uicollectionview - targetContentOffset(forProposedContentOffset:) in my CustomFlowLayout not called -

i writing custom uicollectionviewflowlayout overrides targetcontentoffset(forproposedcontentoffset:) in order provide right contentoffset when user pinch zoom since problem (wrong contentoffset) dynamically setting layout on uicollectionview causes inexplicable contentoffset change class timelinecollectionviewflowlayout: uicollectionviewflowlayout { // mark: - init override init() { super.init() self.minimumlinespacing = 0 } required init?(coder adecoder: nscoder) { super.init(coder: adecoder) } override func prepare() { if let collectionview = self.collectionview { collectionview.ispagingenabled = false self.sectioninset = uiedgeinsets(top: 0, left: 0, bottom: 0, right: 0) self.scrolldirection = .horizontal } } override func targetcontentoffset(forproposedcontentoffset proposedcontentoffset: cgpoint) ->