Posts

Showing posts from June, 2011

Android O Preview 1 can't open Setting, "Setting has stop" -

i use nexus 6p , , system android o preview 1 . i have been used preview system 2 month, , it's normal. today want update system, find can't open system app "setting" . it's show 'setting has stop' . then watch logcat in android studio , has error log below: 07-25 17:16:31.515 21875-21875/? e/androidruntime: fatal exception: main process: com.android.settings, pid: 21875 java.lang.illegalargumentexception: receiver not registered: com.android.settings.dashboard.conditional.cellulardatacondition$receiver@1d9a5b0 @ android.app.loadedapk.forgetreceiverdispatcher(loadedapk.java:1152) @ android.app.contextimpl.unregisterreceiver(contextimpl.java:1422) @ android.content.contextwrapper.unregisterreceiver(co

ios - Activating a constraint which was uninstalled in the storyboard -

i have view contains few constraints. of them have installed checkbox turned off. trying activate , deactivate specific constraints depending on state of application. the problem when installed checkbox turned off can't activate constraints , can't deactivate installed constraints. need mention use strong references constraints in size classes properties. tried approach call setneedsupdateconstraints , updateconstraintsifneeded, setneedslayout , layoutifneeded , after activating/deactivating constraints. i couldn't find documentation regarding behavior why happening? be sure put code in right place override func viewdidlayoutsubviews() { // write code here }

javascript - How to warn a user when leaving a page but not when pressing a button? -

i want users warning when leaving webpage. want users different alert when press on button submitting something. @ moment when leave webpage works correctly when press submit see both warning messages. how show 1 alert? <asp:button style="display: inline-block; margin-left: 120px; margin-top: 10px;" id="sendemail" runat="server" cssclass="btn-flat success" text="send email" onclick="btnupdate_click" visible="true" enabled="true" onsubmit="window.onbeforeunload = false;" onclientclick="if ( !confirm('are sure want send email?')) return false;"/> <script> window.onbeforeunload = function () { return "do want leave page?"; } i use window.onbeforeunload leaving webpage , have onclientclick called when press on button submitting. have no experience javascript not sure doing. you can set variable while clicking on submit.

Powershell dynamic path when create folder -

i want create folder, don't know how use variable define path. as is: new-item -itemtype directory -path "c:\users\tizio.caio\desktop\backup_$((get-date).tostring('yyyymmdd'))" i want replace c:\users\tizio.caio\desktop\ variable in order make future reworks easier. i split directory , filename, , use environment variable userprofile $var = $env:userprofile + "\desktop\" $backup = "backup_$((get-date).tostring('yyyymmdd'))" new-item -itemtype directory -path "$var$backup"

shinyapps - User session is getting interrupted after approx. 45 seconds -

Image
i have shiny application deployed on rshiny pro server(1.5.2) . application heavy computations , generates report without problem if gets completed before approximately 45 seconds . if computation , report generation goes beyond approximately 45 seconds, user's session / connection server getting interrupted. automatically server reconnecting disconnected users immediately. after few seconds of re-connection user session getting reaped , user presented notwork error. from above observations know reconnect flag enabled @ server. i need understand- why user session getting interrupted around approximately 45 seconds every single time. how prevent session interruption? there configuration @ server or application side me achieve uninterrupted session between user , server? well, after searching , trying out different options able find answers questions. the user session getting interrupted around approximately 45 seconds every single time because http_

javascript - text over image not responsive in bootstrap -

i have image, on putting heading on right , left side of image below <div class="container-fluid no-padding"> <div class="row"> <div class="col-md-12"> <div class="col-sm-3 text-center image-overlapping"> <h1>hello suarj</h1> lorem ipsum dolor sit amet, consectetur adipisicing elit. ullam omnis, ipsum eveniet minus amet. </div> <img src="http://oi65.tinypic.com/15oi0w9.jpg" class="ls-bg" alt="slide background" style="width:100%; height:auto;"> <div class="col-sm-3 text-center image-overlapping right"> <h1>hello suarj</h1> lorem ipsum dolor sit amet, consectetur adipisicing elit. ullam omnis, ipsum eveniet minus amet. </div> </div> </div> this works me, not responsive mobile. how go it. here's fiddle same. so added m

angularjs - Setting domain name in IIS Express in an ASP.NET Core application -

we have asp.net core web application uses angular js (1.5) on client, , controllers used returning data. during development, iis express used on developers' machines, , in other environments, iis used. has implications: attribute needs different between devs' , other environments: on devs' looks this: <base href="/"> while on others (running iis) looks (it includes domain name): <base href="/digitalrural/"> angular directives need include domain name in templateurl field in iis while not in local iis express machines. so after deploying app environment, add domain name these locations. trying solve this, i've tried go route of including domain name during development time, both base href attribute , templateurl filed containing domain name. setting either launch url or app url in iis express url: http://localhost:60209/digitalrural/ doesn't work. browser can't find file , page blank. how configure iis expr

html - CSS - Clearfix not working when clearing div -

.frame { width: 1000px; position: relative; } .left { float: left; } .right { float: right; } .pre-left, .pre-right { height: 102px; width: 88px; } .pre-left { background-image: url('https://i.stack.imgur.com/bzjjc.png'); } .pre-right { background-image: url('https://i.stack.imgur.com/f2oly.png'); margin-right: -88px; margin-top: -30px; } .pre-mid { background-image: url('https://i.stack.imgur.com/kd1so.png'); width: auto; display: block; height: 30px; margin-left: 88px; } .after-left, .after-right { height: 53px; width: 79px; } .after-left { background-image: url('https://i.stack.imgur.com/wml1g.png'); margin: 19px 0px -40px -65px; } .after-right { background-image: url('https://i.stack.imgur.com/gddhd.png'); margin: -34px -65px -40px 0; } .after-mid { background-image: url('https://i

javascript - Can I connect string with Json attribute like this -

i have json data this. data = { "purchaseid": 1, "name": "rubbick", "date": "2560-06-29", "price": 12345.00, }, { "purchaseid": 2, "name": "johny", "date": "2560-07-14", "work": "navy", "price": 15000.00 } if need element attribute names json use object.keys(data[0]) and i (4) ["purchaseid", "name", "date", "price"] so when used object.keys(data[0])[1] result name then keep var nameofatt = object.keys(data[0])[1] and need use in var results = []; var keyword = "johny"; for(var i=0; < data.length; i++){ for(var j=0; j < object.keys(data[i]).length; j++){ if( data[i].object.keys(data[i])[j] == keyword){ results.push(data[i]); } } } so data object have johny my question can't use data[i].obje

In angular 2, Pass obects with lot of proprities to forms (pop up) by double clicking datagrid -

there data-table/grid. when double clicked on 1 data row there, need pass relevant data item form. selected item (object) has lots of attributes. what best way done without assigning values of attributes of selected item 1 one? html code : <data-table [items]="items" [itemcount]="itemcount" indexcolumnvisible (reload)="reloaditems($event)" (rowclick)="rowclick($event)" (rowdoubleclick)="opendetailsvatcodemodel(newvatcodemodal)" (rowdoubleclick)="rowdoubleclick($event)" [rowtooltip]="rowtooltip"> rowdoubleclick(rowevent) { this.editvatdetails = rowevent.row.item; //here need pass item form called "newvatcodeform" } you can use [routerlink] pass objects id element , onclick new component in fetch data , fill out form: <button [routerlink]="['/user', user.id]"> <md-icon>create</md

android - Spinner selected Item Issue -

i have made 2 fragment. payment fragment , other add payment fragment. payment fragment contains shop spinner in witch multiple shops user select shop history of payment show if add payment button click add fragment screen show add payment , submit payment after submit payment screen fragment list. problem after fragment list screen selected shopspinner value change show first spinner value not show user selected spinner. paymentfragemt public class paymentfragment extends fragment { view myview; arraylist<hashmap<string, string>> getshop; string shopid; fragment fragment; int totalpayment,shopordertotalpayment; arraylist<hashmap<string, string>> getpaypent; listpaymenthistoryadapter listpaymenthistoryadapter; spinner spinnershop; public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { myview = inflater.inflate(r.layout.payment_listview, container, false); final

ssl - Best Practices for client identification and encryption with logstash TCP/UPD input -

i have system of several clients collect data , send server. on server, put logstash listen on specific port tcp or upd. have 2 requirements: encryption of data , mechanism identify clients. what best practices these 2 requirements? i guess using tls can encrypt data, not identify client me. can use two-way-tls in logstash tcp/udp input? if yes --> how? if no --> alternatives? thanks, h guy

android - how can i use this for every hour? now its working every day 16.30 -

i'm creating notification system need give notification every hour it's giving 1 day protected void onstart() { super.onstart(); calendar calendar = calendar.getinstance(); calendar.set(calendar.hour_of_day, 16); calendar.set(calendar.minute, 30); intent intent = new intent(getapplicationcontext(),notificationreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(getapplicationcontext(),100,intent,pendingintent.flag_update_current); alarmmanager alarmmanager = (alarmmanager) getsystemservice(alarm_service); alarmmanager.setrepeating(alarmmanager.rtc_wakeup,calendar.gettimeinmillis(),alarmmanager.interval_day,pendingintent); } you using alarmmanager.interval_day execute every 24h change alarmmanager.interval_hour

javascript - convert DD/MM/YYYY to YYYYMMDD to compare it with a given string -

i wanted convert date string removing "/" , make yyyymmdd compare first 6 characters of given string. html: <div class="cust-dob"> <span class="input-append date form-control2" id="dp3" data-date="12-02-2012" data-date-format="dd-mm-yyyy" placeholder=""> <input class="span2 valid" size="9" name="custdob" id="custdob" type="text" placeholder="dob" value="" readonly="" aria-invalid="false"> <span class="add-on"><i class="fa fa-calendar" aria-hidden="true"></i></span> </span> </div> <input type="text" class="form-control2 resizeselect" name="nric" id="nric" placeholder="" size="12" value=""> script: $("#nric").bl

java - How to add numbers onto the end of an int variable? -

how 1 update int variable within method input added end of int variable? if wanted update value of combination after inputting 1, 2, 3, , 4, can variable hold value 1234? this works, int = 1; int j = 2; int k = integer.valueof(string.valueof(i) + string.valueof(j)); system.out.println(k); output 12

Drupal 7 - mouse scroll with 'jumps' -

i built webpage in drupal 7 website: http://www.m-hakehilot.co.il/news , meet problem: when user scroll page, scroll isn't silent - page time 'jump'. didn't find reason couse it. this page contains 2 blocks simpleads, 2 blocks simple views, , 1 block vticker view. can me it? in advance

entity framework - Offset/Fetch based paging (Implementation) in EntityFramework (Using LINQ) for SQL Server 2008 -

i using sql server 2008 , entity framework 6.1.3. wish implement pagination of data based on offset/fetch rather take() & skip(). i searched online no luck. posts suggested migrating sql server 2012. not option in case. can suggest how use offset/fetch sql server 2008 , ef 6.1.3 this possible entity framework 6.1.2 , above should ok use in project. standard skip , take methods can't captured in same way others. there 2 additional overload of skip/take methods take lambdas, instead of this: var results = context.mytable .skip(10) .take(5); do this: var results = context.mytable .skip(() => 10) .take(() => 5);

encoding - How to get web content that is in a language other than English by use C# HttpClient -

i learning web programming, writing small program requests web site return page. after getting the web page, want extract information it. i use ie access web page, , found language in chinese simplified (gb2312). corresponding microsoft encoding 936. my program got web site response. extract information web page, convert content xdocument. convertion (xdocument xmlinput = xdocument.parse(xml);) incurred error message: "'', hexadecimal value 0x1f, invalid character. line 1, position 1." debug, save content text file, found content of text file not in chinese. the following code. thank helping. private void button1_click(object sender, eventargs e) { string s = await(new updatecategory()).tostring(); } class updatecategory { public async task<string> submitjrjasync() { httpclient client = null; try { client = new httpclient(); client.baseaddress = new uri("http://stock.jr

openstreetmap - Ladder doesn't allow paths through it - why? -

i'm attempting create direct hiking route via ladder on openrouteservice (which uses openstreetmap), route cannot created. here ladder (thronleiter) on osm: https://www.openstreetmap.org/edit#map=21/47.49255/13.23794 i found other ladders do work here: http://www.openstreetmap.org/edit#map=19/47.36060/9.75714 i found ladders use type ‘steps’ instead of ‘line’, changed that, didn’t seem have effect. (or how long take changes propagate?) other that, don’t see significant differences between 2 - still doesn't work. ideas? the routes on openrouteservice: works: https://openrouteservice.org/directions?n1=47.360603&n2=9.756604&n3=16&a=47.36047,9.756128,47.360702,9.75749&b=2b&c=0&g1=-1&g2=0&k1=en-us&k2=km doesn’t work: https://openrouteservice.org/directions?n1=47.493015&n2=13.23682&n3=16&a=47.492229,13.23793,47.492972,13.238547&b=2b&c=0&g1=-1&g2=0&k1=en-us&k2=km you added ladder 1 hou

My CodeEditor Android app becomes slow because the algorithm check for words to highlight every time a letter is written. How can i fix it? -

after few minutes of writing becomes slow because algorithm keeps controlling whole written text looking words highlight. problem checks text every time letter written. how can change algorithm make app faster , usable? @override public void aftertextchanged(editable s) { string input = s.tostring(); string[] words = input.split(space); int start = 0; for(int i=0;i<words.length ;i++){ string word = words[i]; if(map.containskey(word)){ int index = input.indexof(word, start); string color = map.get(word); s.setspan(new foregroundcolorspan(color.parsecolor(color)), index, index+word.length(), spanned.span_exclusive_exclusive); start = index+word.length(); } } here whole activitymain of app. package com.example.android.editor; import android.

ios - Update location when user allows location tracking -

i'm trying animate user when accepts location tracking. code works when have accepted location tracking , loads view have view reload when press accept on location tracking. override func viewdidload() { super.viewdidload() //prepare user if cllocationmanager.authorizationstatus() != .authorizedalways { // may need change support location based notifications locationmanager.requestalwaysauthorization() print("hello") mapview.setvisiblemaprect(mapview.visiblemaprect, animated: true) }else { locationmanager.startupdatinglocation() } locationmanager.delegate = self locationmanager.desiredaccuracy = kcllocationaccuracybest mapview.delegate = self } animated user location code //get user location func locationmanager(_ manager: cllocationmanager, didupdatelocations locations: [cllocation]) { //show map @ users current location let location = locations[0] let span:mkcoordinate

python - Best design pattern for collection of objects -

i have following architecture: +-----------------+ | collection | | | | | | | | | +-----------------+ | ^ | | create() | | | | v | getitem(b) +------------+ | | item | | | | | | +------+ | | +------------+ a class managing collection of items, creates items. , these items may need other items collection. the actual code in python, , collection passes parameter created item . see it, bad practice. improvement can see pass few functions of collection needed item , instead of whole instance. for example: class collection: getitem(self, id): ... createitem(self, id): item = item(id, self) # <-- pass self ... class item: __init__(self, id, col): ... col.getite

Python. Unpack function -

i'm new @ stackoverflow. i'm @ impasse code line: data = unpack('<bhxxixxxxb', bytes(values[0:14])) i know function put 4 values in array "data", don't understand how these values change when change string "<bhxxixxxxb" thanks

go - How to parse non standard time format from json in golang? -

lets have following json { name: "john", birth_date: "1996-10-07" } and want decode following structure type person struct { name string `json:"name"` birthdate time.time `json:"birth_date"` } like this person := person{} decoder := json.newdecoder(req.body); if err := decoder.decode(&person); err != nil { log.println(err) } which gives me error parsing time ""1996-10-07"" ""2006-01-02t15:04:05z07:00"": cannot parse """ "t" if parse manually this t, err := time.parse("2006-01-02", "1996-10-07") but when time value json string how decoder parse in above format? that's case when need implement custom marshal und unmarshal functions. unmarshaljson(b []byte) error { ... } marshaljson() ([]byte, error) { ... } by following example in golang documentation of json package like: // first create type ali

model view controller - MVC (Spring): Logic Organisation Entity and Service -

i have simple question code organisation. teamrepository (repository class) teamservice (service class) team (entity class) i want set new team leader team object. should function "setleader(user user)" in entity class or better in teamservice class? team.setleader(user); teamservice.save(team); or teamservice.setleader(team, user); inside "setleader" function there if condition (if user team member) declare user new team leader. i guess it's ok in entity class or? confused because have read "business logic" should not in entity classes. best regards kindly keep in mind that: entity class: in designed architecture, should pojo class, containing simple attributes, default constructor, getter() & setters() , other optional methods tostring() & equal() etc. example: @entity public class team{ private string id; private user leader; public team(){} //getters & setters } repository class:

Hide in-app notifications from Android notifications history -

i'm doing in-app notifications on android. i'm using notificationcompat.builder , notificationmanager it. set notifications priority priority_high display them popup. but notification displayed in android notifications history. how prevent ? to cancel notification call notificationmanager notificationmanager = (notificationmanager)getsystemservice(context.notification_service); notificationmanager.cancel(notification_id); i suggest calling code after create pop there no notification left in tray. found code here: how clear notification in android

c++ - Overloading new returns wrong address -

#include <iostream> using namespace std; class station{ int n; float *p; public: station(){}; station(const station &ob){cout<<"copy";} station operator=(station* a){cout<<"nai";} ~station(){cout<<"destructor";} static float counter; friend istream &operator>(istream &stream, station &d); int &getn(){return n;}; float *&getp(){return p;}; void* operator new[](size_t size); void* operator new(size_t size){station *a;a=::new station;return a;}; }; void* station::operator new[](size_t size){ station* a; a=(::new station[size]); int b; b=(size)/(sizeof(station)); for(int i=0;i<b;i++){ cin>a[i]; } cout<<a; return a; } float station::counter; istream &operator>( istream &stream, station &d){ cout<<"dwse arithmo deigmatwn"; int num; stream>>num; d.getp

error handling - Angular 4.3 - HTTP Interceptor - refresh JWT token -

i need react (in interceptor class) on 403 forbidden http status (to obtain/refresh) jwt token , retry request fresh token. in code below, when server return error response goes success callback (not error callback expect) , event typeof object (which useless in reaction on error response). event object looks this: {type:0}. question: -how handle httperrorresponse (403 forbidden) in httpinterceptor when need refresh accesstoken , retry http request? import { httpinterceptor, httprequest, httpresponse, httphandler, httpevent } '@angular/common/http'; import 'rxjs/add/operator/map'; @injectable() class jwtinterceptor implements httpinterceptor { constructor(private tokenservice: tokenservice) {} intercept(req: httprequest<any>, next: httphandler): observable<httpevent<any>> { let myheaders = req.headers; if (this.tokenservice.accesstoken) { myheaders = myheaders.append('authorization',`${this.tokenservice.

python - How to get Kernels from kernel density estimation (preferrably sklearn.neighbors)? -

i'm working on seasonality estimation time series dataset. what dataset of possible frequencies/periods might occur in dataset. thus, noisy (e.g. having periods [100, 98, 101, 102] should "the same"). for estimating sharp periods, try estimate peaks via kernel density estimation (kde, sklearn.neighbors.kerneldensity) follows: import numpy np sklearn.neighbors import kerneldensity scipy import signal import matplotlib.pyplot plt x1 = np.random.randint(1, 4, 20) x2 = np.random.randint(10, 13, 200) x = np.concatenate((x1, x2), axis=0) # peaks schould @ 2 , 11! bw = 1 kde = kerneldensity(kernel='gaussian', bandwidth=bw).fit(x.reshape(-1, 1)) estimator = np.linspace(0, 15, 100) kde_est = np.exp(kde.score_samples(estimator.reshape(-1, 1))) plt.plot(estimator, kde_est) peaks_pos = signal.argrelextrema(kde_est, np.greater)[0] print(estimator[peaks_pos]) # peaks @ around 2 , 11! additionally, i'd know how kernels estimation like. gaussian case, there

android - ANR in a IntentService. -

i anr reported our app users. not able reproduce on our phones. report in google play says following. executing service com.myapp/.background.myintentservice (no location available) following code inside myintentservice. public class myintentservice extends intentservice { public myintentservice() { super(myintentservice.class.getname()); } @override protected void onhandleintent(intent intent) { systemclock.sleep(100); intent intent2 = new intent(this, homeactivity.class); intent2.setflags(intent.flag_activity_new_task| intent.flag_activity_no_animation| intent.flag_activity_no_history); startactivity(intent2); } } above intent service called @ time when open app mine cleanup notification raised app. after 100ms wanted open app back. see no issues end. following anr received users's phone. how can decode info? can point out code path? executing service com.myapp/.background.myintentservice (no location available)

Input format for MaxEnt OpenNLP implementation? -

i'm trying use opennlp implementation of maximum entropy classifier seems documentation quite lacking , despite library apparently designed easy of use cannot find single example and/or specification input file format (i.e., training set). anybody knows find or minimal working example of training? opennlp's format quite flexible. if want use maxent classifier in opennlp there few steps involved. here sample code comments: package example; import java.io.file; import java.io.ioexception; import java.nio.charset.charset; import java.util.arrays; import java.util.hashmap; import java.util.map; import opennlp.tools.ml.maxent.gistrainer; import opennlp.tools.ml.model.event; import opennlp.tools.ml.model.maxentmodel; import opennlp.tools.tokenize.whitespacetokenizer; import opennlp.tools.util.filterobjectstream; import opennlp.tools.util.markablefileinputstreamfactory; import opennlp.tools.util.objectstream; import opennlp.tools.util.plaintextbylinestream; import

android - 64K method count exceed error , for close to 62.5K method reference count -

Image
the method count app apk in apk analyzer shown 62481 . it's close still not on 64k. there's no other .dex file, highlighted one. still "the number of method references in .dex file cannot exceed 64k." error while running app. if make multidex application executes without issues. there missing? in advance. ps. used online tool @ http://inloop.github.io/apk-method-count . shows same count. stacktrace: error:the number of method references in .dex file cannot exceed 64k.learn how resolve issue @ https://developer.android.com/tools/building/multidex.html error:execution failed task ':app:transformclasseswithdexfordevdebug'. com.android.build.api.transform.transformexception: com.android.ide.common.process.processexception: java.util.concurrent.executionexception: com.android.ide.common.process.processexception: error while executing java process main class com.android.dx.command.main arguments {--dex --num-threads=4 --output d:\xyz\abc\app\b