Posts

Showing posts from February, 2010

firebase - Android app crash with Android 4.4.4 -

i'm working on android app works on marshmallow , lollipop crashes on kitkat. this project build.gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' } } allprojects { repositories { jcenter() } } task clean(type: delete) { delete rootproject.builddir } this app build.gradle: apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion '23.0.3' defaultconfig { applicationid "com.moover.moovenda.moover" minsdkversion 16 targetsdkversion 23 versioncode 1 versionname "1.0" multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules

java - Complete android cardView with db helper and recycleView -

Image
i pretty new whole android development looking create simple android app making use of sql database, cardviews , recycleview. app have far works trying add button detailedactivity allow me remove entry database. the desired workflow be: get data select cardview click new button (will delete) go cardview, remove entry on button has been pressed , populate cardview. recycleradapter.java package com.example.prabhu.databasedemo; import android.content.context; import android.content.intent; import android.os.bundle; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.textview; import android.widget.toast; import java.util.arraylist; import java.util.list; public class recycleradapter extends recyclerview.adapter<recycleradapter.viewholder> { static list<databasemodel> dblist; static context context; recycleradapter(context context

angular - ReactiveFormsModule vs. FormsModule in Angular2 -

there exists reactiveformmodule , formmodule . import {formsmodule, reactiveformsmodule} "@angular/forms"; when should use reactiveformmodule , provides module comparing formmodule . formsmodule - angular 1 tackles forms via famous ng-model directive. angular 2 provides identical mechanism named ngmodel, allow build called template-driven forms. unlike case of angularjs, ngmodel , other form-related directives not available default. reactiveformsmodule model driven forms. each form has state can updated many different interactions , application developer manage state , prevent getting corrupted. can hard large forms , can introduce category of potential bugs. where can write validations not in html. in case can attach many validations , wrap form. i got here. there better explanation :

opengl - Rendering meshes with multiple indices -

i have vertex data. positions, normals, texture coordinates. loaded .obj file or other format. each piece of vertex data has own index. can render mesh data using opengl/direct3d? in general sense, no. opengl , direct3d allow 1 index per vertex; index fetches each stream of vertex data. therefore, every unique combination of components must have own separate index. so if have cube, each face has own normal, need replicate position , normal data lot. need 24 positions , 24 normals, though cube have 8 unique positions , 6 unique normals. your best bet accept data larger. great many model formats use multiple indices; need fixup vertex data before can render it. many mesh loading tools, such open asset importer, perform fixup you. gl 3.x , d3d10 for d3d10/opengl 3.x-class hardware, possible avoid performing fixup , use multiple indexed attributes directly. however, advised decrease rendering performance. the following discussion use opengl terminology, direct3d v10

android - Return ArrayList from void AsyncTask -

i googled alot, no chance this. now, have inner asynctask class want use return values in upper class. , work, cause have put log.e() , shows value, here code : public class consume extends asynctask<void, void, void> { private list<latlng> latlngs = new arraylist<>(); private list<contactmodel> contacts = new arraylist<>(); inputstream inputstream = null; string result = ""; @override protected void doinbackground(void... params) { string url = "http://x.x.x.x/mywcf/service1.svc/json/getcontact"; arraylist<namevaluepair> param = new arraylist<namevaluepair>(); try { httpclient httpclient = new defaulthttpclient(); httppost post = new httppost(url); post.setentity(new urlencodedformentity(param)); httpresponse httpresponse = httpclient.execute(post);

c# check for a poker straight -

i trying write poker hand evaluation method in c#. have managed every poker hand using linq except straight. don't play straight made of 5 cards increments of 1 each card. ace can high or low. i have created object called card has suit, rank , value (j = 11, q =12 etc..). method passed list of object containing 7 cards (hole cards , board.) another thing bear in mind straight can made if player has 5 or 10. see below methods other poker hands , please let me know if have idea straight method. pseudo code fine also. public bool checkpair(list<card> cards) { //see if 2 cards card same rank. return cards.groupby(card => card.rank).count(group => group.count() == 2) == 1; } public bool checktwopair(list<card> cards) { //see if there 2 lots of 2 cards card same rank. return cards.groupby(card => card.rank).count(group => group.count() >= 2) == 2; } public bool checktrips(list<card> cards) { //see if 3 cards card same

java - Android Device Monitor fails with "unexpected error while parsing input: Invalid uiautomator hierarchy file -

Image
i looked through others questions similar issue error log , stack trace different. in case running on osx 10.11.6. android device monitor, version: 25.2.2. when start android device monitor (monitor) @ command line, error dialog displayed: in stack dump, it's looking file /var/folders/5g/8_lp975j6h3d67sc32sqkq3c0000gp/t/uiautomatorviewer_6077102350746730072/dump_7454833342327499247.uix i looked in directory , it's right, file doesn't exist. the gui display, unusable. how can fix this? here full stack dump. $ monitor java.io.filenotfoundexception: /var/folders/5g/8_lp975j6h3d67sc32sqkq3c0000gp/t/uiautomatorviewer_6077102350746730072/dump_7454833342327499247.uix (no such file or directory) @ java.io.fileinputstream.open0(native method) @ java.io.fileinputstream.open(fileinputstream.java:195) @ java.io.fileinputstream.(fileinputstream.java:138) @ java.io.fileinputstream.(fileinputstream.java:93) @ sun.net.www.protoc

python 2.7 - Getting Inner Nested Tag Data with BeautifulSoup -

Image
i want information in inner tag, keep returning empty. code: import requests bs4 import beautifulsoup url = "http://www.krak.dk/cafe/s%c3%b8g.cs?consumer=suggest?search_word=cafe" r = requests.get(url) soup = beautifulsoup(r.content, 'html.parser') gendata = soup.find_all("ol", {"class": "hit-list"}) print gendata infox in gendata: print inforx.text what missing? the html broken, need different parser, can use lxml if have it: soup = beautifulsoup(r.content, 'lxml') or use html5lib : soup = beautifulsoup(r.content, 'html5lib') lxml has dependencies libxml, html5lib can installed pip. in [9]: url = "http://www.krak.dk/cafe/s%c3%b8g.cs?consumer=suggest?search_word=cafe" in [10]: r = requests.get(url) in [11]: soup = beautifulsoup(r.content, 'html.parser') in [12]: len(soup.find_all("ol", {"class": "hit-list"}))out[12]: 0 in [13]: soup =

c# - DXmessage box Shows error while runing inside the thread? -

dxmessagebox shows error while running inside thread shows following error "the calling thread must sta, because many ui components require this." dxmessagebox.show("no data selected parameters", messagetitle); if windows message box work fine me try invoke code dispatcher application.current.dispatcher.begininvoke( dispatcherpriority.send, new action(delegate() { //your code }));

javascript - Google Maps hide controls on small screens -

i want hide google maps controls on small screens. default google maps hides them @ 320px width think, need them hide on bigger width, around 400px. here 1 working example , using different code not working, syntax errors. here code: var map = new google.maps.map(document.getelementbyid('map-canvas'), { center: { lat: 52.00, lng: 10.00 }, zoom: 4, zoomcontroloptions: { position: google.maps.controlposition.left_top }, maptypecontrol: true, maptypecontroloptions: { position: google.maps.controlposition.top_right } }); this code captures width , disables controls, , works google maps codes, not my... $(window).width() var width = window.innerwidth; if(width < 400){ mapoptions.maptypecontrol = false; maptypecontrol: false disabledefaultui: true delete mapoptions.maptypecontroloptions; } please show me h

mapreduce - couchDB- complex query on a view -

i using cloudantdb , want query view looks this function (doc) { if(doc.name !== undefined){ emit([doc.name, doc.age], doc); } what should correct way result if have list of names(i using option 'keys=[]' it) , range of age(for startkey , endkey should used) example: want persons having name "john" or "mark" or "joseph" or "santosh" , lie between age limit 20 30. if go list of names, query should keys=["john", ....] , if go age query should use startkey , endkey i want both :) thanks unfortunately, can't so. using keys parameter query documents specified key. example, can't send keys=["john","mark"]&startkey=[null,20]&endkey=[{},30]. query , only return document having name john , mark null age. in question specified couchdb if using cloudant, index query might interesting you. you have : { "selector": { "$and": [ {

php - Handle AJAX requests in separated directory/files -

i want move methods controller, executed ajax request, separate folder. example create file userbundle/ajax/ajax.php , put in file, ajax request methods. is right approach, separate ajax requests, normal http requests? can't find examples how it. possible in symfony? must extend symfony\bundle\frameworkbundle\controller\controller in ajax.php file? okay, exist 2 folders in bundle ajax , controller , contains controllers first ajax request , second normal http request? do know architectural pattern, problem? i don't think there problem that, make sure define routing path correctly: an example annotation routing: # app/config/routing.yml app_bundle: resource: "@appbundle/controller" type: annotation prefix: / app_bundle_ajax: resource: "@appbundle/ajax" type: annotation prefix: / i must extend symfony\bundle\frameworkbundle\controller\controller in ajax.php file? it's not mandatory, symf

Route Parameter Value Always 0 in ASP.NET Core 1.x -

i found strange behaviour while developing asp.net core 1.x web api app. here's code snippet [route("{id}")] [httpget] public iactionresult get(string id) { ... } if send request api endpoint /api/values/1234 works ok. now, change parameter type string int like: [route("{id}")] [httpget] public iactionresult get(int id) { ... } if send same request /api/values/1234 , id value 0 , not supposed be. i tried {id:int} well, doesn't work either. tried [httpget("{id}")] , [httpget("{id:int}")] instead of using [route("{id}")] . none of them working expected. i'm sure worked fine on asp.net core rc1 , rc2. however, doesn't work on asp.net core 1.x expected. missing? update : found actual implementation required long value, not int value. after changed parameter type long , worked expected.

java - Re-attach deserialized hibernate proxies -

i have retrieved database proxy object empp(domain class:employee) hibernate using hql. i'd serialize it(step1) file , deserialize it(step2). step1 , step2 in 2 different threads. problem in order: i serialize empp in step1. in step1 in not serialize attached session of empp in ((proxyobject)empp).gethandler().session , session transient . in different thread, deserialize empp emppdeserialized , have empp empp.gethandler().getsession() equal null . step2 different session. now, whenever call getter emppdeserialized , throws could not initialize proxy - no session . in step2, i'd emppdeserialized attached current session getter calls successful. now, 1 stupid way can think of is: ((org.hibernate.proxy.pojo.javassist.javassistlazyinitializer)((javassist.util.proxy.proxyobject)emppdeserialized).gethandler()) .setsession((org.hibernate.engine.spi.sessionimplementor)sessionfactory.getcurrentsession()); question is, i'd know best practice availa

Polymer. Update view after model changed -

this common question in polymer updating view when model updated (answer use this.set or this.push polymer methods). but when have 2 elements: first element: properties:{ items: { type: array } }, somefunction: { this.push('items', {'name': 'something'}); } second element has property bound 'items' first element ready: function(){ this.items = firstelement.items; } i second element 'items' updated when 'items' updated on firstelement. can't manually notify secondelement, because of app restrictions. so see (in devtools) model of second element correct ('items' contains objects), view isn't updated. how update it? you need set notity on property of first element receive changes outside of element itself properties:{ items: { type: array, notify: true } }, then, in secondelement can <firstelement items="{{items}}" />

javascript - Calculate total time user has done activities on page like mousemove in jquery -

please me. have find total time user has done activities on page mousemove, keypress etc. want useful time page has been used. have made of code calculates total time page has been opened , time user has focused in page. an other approach calculate useful time can calculating total idle time on page, nothing (i mean mousemove, keypress) has been done. useful time = total page opening time - total idle time please here code. var start, end, openingtime, pagefocustime = 0; $(document).ready(function(){ start = performance.now(); $(window).on('blur', function() { end = performance.now(); pagefocustime += end - start }) $(window).on('focus', function() { start = performance.now(); }) $(window).on('beforeunload',function(){ end = performance.now(); pagefocustime += end - start console.log("exa

javascript - how to make a form to show 3 questions at a time -

i have developed survey form has 13 questions. questions coming in 1 page want show 3 question @ time other 3 question on next page. i have no idea how this.please me in issue. thanks this code show 3 item @ time, , show next 3 items when clicked on next button. var currentpage = 0; var pages = 5; var itemsperpage = 3; var $submitbutton = $("button[type=submit]"); $("li h3").each(function(i, e){ $(e).text((i + 1) + ") " + $(e).text()); }); $("#next").click(function() { $("li") //.css("background", "#fff") .hide(); for(i = 1; <= itemsperpage; i++) { $("li:nth-child(" + ((currentpage * itemsperpage) + i) + ")") //.css("background" , "red") .show(); } if(currentpage == pages - 1) { $submitbutton.show(); } else { $submitbutton.hide(); } if(currentpage < pages - 1) { currentpage += 1;

java - Run Time Polymorphism -

class { public void display(){ system.out.println("from class a"); } } class b extends { public void display() { system.out.println("from class b"); } } public class test { public static void main(strings[] args){ a = new a(); b = new b() a.display(); b.display(); } } output : from class class b now, getting output expected. want know why using a b = new b() , when same thing can achieve using b b = new b() . advantage of using former techniques, , when beneficial me? lets take example here. know birds can fly, there exceptions. know behavior, lets model this. generally, birds can fly, so: class bird { void fly() { system.out.println("i can fly"); } } class eagle extends bird { void fly() { system.out.println("i can fly high"); } } we know ducks can't fly, don't birds. @ runtime whether specific bird can

c# - How to achieve even horizontal spacing in ListView and WrapPanel template? -

heres example: <window x:class="listviewitemspacing.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:c="clr-namespace:listviewitemspacing.controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:listviewitemspacing" mc:ignorable="d" title="mainwindow" height="350" width="525"> <grid> <listview flowdirection="lefttoright" background="#222"> <listview.itemspanel> <itemspaneltemplate> <wrappanel width="{binding (frameworkelement.actualwidth), relativesource={relativesource ancestortype=scrollconten

Android Scrolling Activity Toolbar Subtitle not showing -

i setting toolbar subtitle : toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); getextra(); getsupportactionbar().setsubtitle("subtitle"); it working other activity not working scrolling activity

php - Silverstripe fulltextsearch on custom field -

i'm using silverstripe fulltextsearch . interrogation how search in custom field , show results. there code write in index.md : file: mysite/code/myindex.php: <?php class myindex extends solrindex { function init() { $this->addclass('mypage'); $this->addfulltextfield('description'); } } in page.php class page_controller extends contentcontroller { private static $allowed_actions = array('search'); public function search($request) { $query = new searchquery(); $query->search($request->getvar('q')); return $this->renderwith('array( 'searchresult' => singleton('myindex')->search($query) )); } } when i'm trying search words description field, no results found... suggestions? in experience fulltextsearch has been frustrating , problematic. willing corrected, feel devs moving away in place of using searchfil

android - Drag view from RecyclerView Adapter to view inside container Fragment -

i have recyclerview inside fragment , want drag row recycler adapter , drop view in container fragment - "the recycler , view inside same fragment, tried lot of codes stack , youtube, used code achieve drag , drop works in views out side adapter only. private class choicetouchlistener implements view.ontouchlistener { rownewsrecylcerholder holder; public choicetouchlistener(rownewsrecylcerholder holder) { this.holder = holder; } @override public boolean ontouch(view v, motionevent event) { final int x = (int) event.getrawx(); final int y = (int) event.getrawy(); switch (event.getaction() & motionevent.action_mask) { case motionevent.action_down: linearlayout.layoutparams lparams = (linearlayout.layoutparams) v.getlayoutparams(); _xdelta = x - lparams.leftmargin; _ydelta = y - lparams.rightmargin; break; case motionevent.

c# - Deep copy helper leads to index out of bounds -

i have dictionary object value dictionary<string, object> . using deep copy creating clone of dictionary. adding clone variable, each key adding key + "string" , column in data table contains same number , values of columns key in dictionary. adding updated dictionary[key] list , adding list data table. this process working fine lead index outside bounds of array. and destination array not long enough copy items in collection. check array index , length. can me , let me know reason of getting error. dictionary<string, object> obj= deepcopyhelper.clone(taskresult.taskstatistics.taskspecificdata.statisticsdata()); var taskspecificrefdata = new dictionary<string, object>(obj); foreach (string key in taskspecificrefdata.keys) { if (!dtreturn.columns.contains(key + "ref")) { dtreturn.columns.add(key + "ref"); datarowobjects.add(taskspecificrefdata[key]); } } dtreturn.rows.add(datarowobj

laravel version 5.0.27 how to rebuild or regenerate composer.json -

i have laravel version 5.0.27 project, it's live website. working without "composer.json" , "artisan" there method retrieve or regenerate valid composer.json laravel project? valid composer.json, mean should contain elements or packages existing in laravel website should allow me generate composer.lock file. , how retrieve "artisan"? so can install components using composer. try command: composer init

javascript - Rotate SVG text around a circle then around itself using d3 -

i have visual labels placed being rotated around centre of circle. means labels on left hand side of circle upside down. possible rotate labels on left hand side around themselves, after rotation has taken place? the visualisation based on zoomable sunburst d3js.org page http://bl.ocks.org/vgrocha/1580af34e56ee6224d33 the revelent code is: function computetextrotation(d) { var angle=(d.x +d.dx/2)*180/math.pi - 90; return angle; } var texts = svg.selectall("text") .data(partitioned_data) .enter().append("text") .filter(filter_min_arc_size_text) .attr("transform", function(d) {return "rotate(" + computetextrotation(d) + ")"}) .attr("x", function(d) { return radius / 3 * d.depth; }) .attr("dx", "6") // margin .attr("dy", ".35em") // vertical-align .text(function(d,i) {return d.name}) i tried code below since know possible if know x , y coordinates of text won't

javascript - What should I write in baseURL while deploying my app at heroku? -

i have problem @ angular.js side in 'services.js' or 'factory.js'. i not able understand should write in replace of 'here' in baseurl when deplooying app @ heroku: angular.module('confusionapp') .constant("baseurl", "__here__") when leave empty, able register, not login. i using when running app locally: angular.module('confusionapp') .constant("baseurl", "http://localhost:3000/") i able connect database mlab. everything goes well, except, when tried login in app,i got error undefined in replace of $state.go(). here link app, kindly check yourself: http://idiscover.herokuapp.com/ this code worked: angular.module('confusionapp') .constant("baseurl", "")

php - Laravel 5.3 Different Workspaces -

i'm using laravel 5.3. have company registration , company invites employees. objective each company , employees work on unique "workspace". an example company zeus has it's employees hercules , megara. when either hercules or megara login, go workspace "olympus" view different information pulled several api's. i'm kind of confused on how proceed accomplish this. can give me guidance? to add example, company odin has employee thor. when thor logins, go workspace "valhalla". of on same application. edit: i've done registration part , inviting users. question is, how structure app presents different workspaces depending on logged in employee? edit2: give more real life example, it's slack has teams(but in case there 1 "team" each company) or podio.

java - Need to select one row in table by Spring Data JPA in Spring mvc -

my table studetdetails (contain id,student_name,des) need value of studentname using springdatajpa. my entity is: @entity @table(name="student_details") public class studentdetails { @id @generatedvalue(strategy = generationtype.auto) @column(name = "id", nullable = false) private long id; @column(name = "student_name") private string studentname; } my repository is: public interface studentdetailsrepository extends jparepository<studentdetails, long>{ public list<studentdetails> findallbystudentname(); --------------------- } findallbystudentname() 1 correct way??? service class is:::: @autowired studentdetailsrepository studetailsrepository; list<addinsurancedto> getstudentdetils(){ vendordetails = studetailsrepository.findallbystudentname(); } i getting error: error creating bean name 'studentdetailsrepository': invocation of init method failed; nes

function - MATLAB Equation as User Input to work with -

i'm trying write simple script request equation input , calculate function more once without requesting user input. my current script defined f function handle , executed function 2 times, i'm asking new equation, not desirable. f = @(x) input('f(x) = '); = f(2); % requests user input b = f(3); % requests user input again and should more (not working). func = input('f(x) = '); f = @(x) func; = f(2); b = f(3); and here without user input idea try achieve. f = @(x) x^2; = f(2); b = f(3); i think found solution symbolic math toolbox, not have addon, cannot use/test it. is there solution? there's no need symbolic mathematics toolbox here. can still use input . bear in mind default method of input directly take input , assign variable input assumed syntactically correct according matlab rules. that's not want. you'll want take input string using 's' option second parameter use str2func convert string anon

javascript - Highchart 5: Pie Drilldown labels and back button not visible -

i try highcharts pie drilldown chart working. seems in version 5 of highcharts, button not visible data labels entering level 2: the code exact code highcharts demo page (version 4). here js fiddle $(function () { // create chart $('#container').highcharts({ chart: { type: 'pie' }, title: { text: 'browser market shares. january, 2015 may, 2015' }, subtitle: { text: 'click slices view versions. source: netmarketshare.com.' }, plotoptions: { series: { datalabels: { enabled: true, format: '{point.name}: {point.y:.1f}%' } } }, tooltip: { headerformat: '<span style="font-size:11px">{series.name}</span><br>', pointformat: '<span style="

java - What is the purpose of @TestConfiguration on a top-level class? -

spring boot 1.4 has brought many improvements testing. i unclear of purpose of @testconfiguration . doesn't seem work expected. i thought if use @testconfiguration on top-level class under /src/test/java gets picked @springboottest test ( see here ). seems not case. if instead use @configuration gets correctly picked up. did misunderstand? manual wrong? there bug in spring boot code? whenever have used <context:component-scan base-package="some.package" /> or @componentscan . scans . prevent spring boot provides @testcomponent should not picked scanning.

Can't import this excel file into R -

Image
i'm having trouble importing file r. file obtained website: https://report.nih.gov/award/index.cfm , clicked "import table" , downloaded .xls file year 1992. this image might describe how retrieved data here's i've tried typing console, along results: input: > library('readxl') > data1992 <- read_excel("1992.xls") output: not excel file error in eval(substitute(expr), envir, enclos) : failed open /home/chrx/documents/nih funding awards, 1992 - 2016/1992.xls input: > data1992 <- read.csv ("1992.xls", sep ="\t") output: error in read.table(file = file, header = header, sep = sep, quote = quote, : more columns column names i'm not sure whether or not relevant, i'm using galliumos (linux). because i'm using linux, excel isn't installed on computer. libreoffice is. why bother getting data in , out of .csv if it's right there on web page scrape? # note q