Posts

Showing posts from March, 2015

android - Listener to map touch outside of the markers -

i using google map api markers. overrode infowindow below show custom text. public void setupmap() { final googlemap map = mmapview.getmap(); map.clear(); map.setinfowindowadapter(new googlemap.infowindowadapter() { private view mholder; @override public view getinfowindow(final marker marker) { log.d("map", "map clicked on marker = " + maker); etc.... this works fine , change icon of each marker when clicked making them visually selected. however, want "unselect" markers. problem don't know how add listener gets triggered outside of markers. in other words, listener "getinfowindow" gets trigger when marker touched. want opposite. sort of listener tells me user touched map not markers. can done easily? pointers appreciated. thx! ok, suppose that's easy. have onmarkerclicklistener , onmapclicklistener . so, in case register onmapclicklistener , in onmap...

html - Ellipses across spanning rows -

i'm trying create rows there ellipsis end of left cell start of text of right cell. issue length of left cell varies , length of right cell varies. i've tried aligning 2 divs , ending right div overflow: ellipsis , starting right div ellipsis don't know how figure out how many dots should added prior start of right text. for example: property 1......................................value 1 some property 2.................some value 2 you may use flex , order , pseudo draw dots .ellipsis { display:flex; } .ellipsis span { order:2; } .ellipsis span:first-of-type { order:0; } .ellipsis:before { content:''; display:inline-block;/* optionnal*/ border-bottom:dotted 1px; flex:1; order:1; margin:0 0.2em 0.25em;/* may tune */ } body { padding-top:50px; /* demo snippet in way */ } <p class="ellipsis"><!-- other tag li or div too, css styling --> <span>ellipsis in</span...

ruby on rails - How to have <% f.submit %> redirect to an anchor tag upon submission -

i trying create search filter google maps app using ransack. filtering woking want redirect #footer map located , not top of page. possible? here have <%= f.submit "filter results", :onsubmit => root_path(:anchor => 'footer'), :class => "btn btn-success" %> any thoughts, -john i not sure understand asking exactly, forgive me if answer doesn't help. with html, if want point link specific part of page can following: add name attribute particular spot u want link to, example: now, link particular section of page, add "#section1" end of link so if add name attribute footer, , add proper #name end of link, should able have url point footer on page. hope helps!

authentication - Power BI - Programmatically sign in -

i'm trying write web app embeds power bi reports. data on-premises cannot use new solution available (power bi embedded). inconvenience of using old approach ( https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-a-power-bi-tile-or-report/ ) consumer of web page needs power bi user needs sign in in order web app authentication token (there couple of page redirections need happen before). question is, there way power bi sign in in programmatic way? in way can use 1 power bi account getting content. i experimenting there, thread helped me (see post #8): http://community.powerbi.com/t5/developer/how-to-use-power-bi-rest-api-without-gui-authentication-redirect/m-p/14218# basically: post request to: https://login.microsoftonline.com/common/oauth2/token body, form-url-encoded: grant_type: "password" scope: "openid" resource: " https://analysis.windows.net/powerbi/api " client_id: client id client_secret: ...

mysql - Column type for saving very different number of decimals -

i need store numbers like 21000 1.0002 0.00230235 12323235 0.2349523 this sensordata important keep exact value. there many options. my solution multiply values 1 million, , store them bigint. make sense? that makes sense i'd recommend use decimal datatype: https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html if multiply million , if dataset receive has 1 more decimal you'd expect, you'd end multiplying number 10 million , other numbers 10. instead, using decimal datatype give 30 numbers right of decimal. the declaration syntax decimal column decimal(m,d). ranges of values arguments in mysql 5.7 follows: m maximum number of digits (the precision). has range of 1 65. d number of digits right of decimal point (the scale). has range of 0 30 , must no larger m. and the sql standard requires precision of numeric(m,d) m digits. decimal(m,d), standard requires precision of @ least m digits per...

opengl - Lsystem 3d Trees, more realism -

Image
i try implement procedural 3d trees in opengl using lsystem. can these kind of results: it looks tree, improve result, , more realistic tree. have ideas add thickness feature tree, because it's "sticks", or structure leaves ... use in procedural terrain rendring. thank in advance.

javascript - Hide() with fadeIn()/fadeOut() -

i'm trying fade in , fade out jquery. however, i'm having issues. i hide div when page loads, when hover on fade in, fades in second disappears. have hover out hover in. my jquery: $(document).ready(function(){ $('#hidedsl6').hide(); $('#showdsl6').hover(function(){ $('#hidedsl6').fadein(); }, function(){ $('#hidedsl6').fadeout(); }); $('#showfttn10').hover(function(){ }); $('#showfttn15').hover(function(){ }); $('#showfttn25').hover(function(){ }); $('#showfttn50').hover(function(){ }); }); my html: <h3 class="dsllocation" id="showdsl6">dsl 6</h3> <button class="btn btnblue" id="hidedsl6" type="button">order now!</button> why use jquery when it can done css .products{ display:table; table-layout:fixed; width: 100%; } .option{ display:...

javascript - form not getting submitted on button click -

i trying submit form on button click want user confirm whether sure or not. have mutiple submit button on form , want pop-up in case of delete. when make type of button submit. form gets submitted twice if confirm else gets submitted once (i don't want submitted in case). i have multiple form on page. that's why trying submit form getting parent node , not using getelementbyid. javascript function function deleteevent(btn){ var confirmed=confirm('do want delete event?'); if(confirmed){ var f = btn.parentnode; f.submit(); } else{ return false; } } html code <form action="#" method="post"> <input type="button" name="delete" value="delete" onclick ="deleteevent(this)"> </form> thanks. working solution: <input type="submit" name="delete" value="delete" onclick ="re...

ember.js - Injecting application controller into all other controllers -

i'm hoping use application controller displaying dynamic modal components. convenient if inject application controller other controllers, rather explicitly injecting in each controller file it's needed. initialize = (app) -> app.inject 'controller', 'appcontroller', 'controller:application' app.inject 'component' , 'appcontroller', 'controller:application' injectapplicationcontroller = name: 'inject-application-controller' initialize: initialize `export {initialize}` `export default injectapplicationcontroller` please forgive coffeescript; gives me error, controller cannot injected other controllers. there workaround? i recommend use service hold state, can reopen ember.controller in initializer: ember.controller.reopen({ appcontroller: ember.controller.inject('application') });

android - Loading a JSoup Document into a webview after auto authentication -

i have been working tirelessly learn , implement auto authentication on website use @ university. believe have set auto authentication part of app, not know how display website them passed login stage. know how before auto authentication since have used jsoup auto authenticate left document variable holding webpage. possible load document webview user continue using website if had manually logged in or going @ problem wrong way? unable use .join() method on thread have not handled error, unsure or how should handling interuptexception. here code far: ` import android.graphics.bitmap; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.webkit.cookiemanager; import android.webkit.webview; import android.webkit.webviewclient; import org.apache.commons.codec.binary.base64; import org.jsoup.jsoup; import org.jsoup.nodes.document; import java.io.ioexception; public class mainactivity extends appcompatactivity { private string url; p...

database - MySQL InnoDB constraint does not work -

i stumble upon strange behavior innodb constraint, , cannot find cause of it. have tables data. below listed structures: create table `contents` ( `id` int(10) unsigned not null auto_increment, `title` varchar(255) default null, primary key (`id`), key `title` (`title`) ) engine=innodb default charset=utf8; create table `fields` ( `id` int(10) unsigned not null auto_increment, `name` varchar(45) not null, `type` varchar(45) not null, primary key (`id`), unique key `nameunique` (`name`), key `name` (`name`), key `type` (`type`) ) engine=innodb default charset=utf8; create table `datatable` ( `id` bigint(20) unsigned not null auto_increment, `value` double not null, primary key (`id`), unique key `value_unique` (`value`) ) engine=innodb default charset=utf8; create table `content_data` ( `content_id` int(10) unsigned not null, `field_id` int(10) unsigned not null, `data_id` bigint(20) unsigned not null, primary key (`content_id`,`field_id...

Write to a SharePoint list from an html page that is not located within the SharePoint site -

i have website not located within sharepoint site. want collect user data website , save in sharepoint list. possible? you can perform list operations including add, update, , delete using built-in sharepoint rest api. microsoft provides pretty documentation using rest api. note : api endpoints , features noticeably different sharepoint 2010 , 2013. there many variations use rest api. here snippet of sample rest call might add item existing list using javascript: function addlistitem() { var mylisturl= "mysite.sharepoint.com/_vti_bin/listdata.svc/mylist"; var item= {}; item.title = "adding item using 2010 rest api"; var itementry= json.stringify(item); $.ajax({ type: "post", url: mylisturl, data: itementry, contenttype: "application/json; charset=utf-8", ...

teradata - SQL-- calculated columns using previous row -

i trying write sql create following table: _row id cola colb colc mov_sum mult1 mult2 1 x 100 2 .05 102.5 null null 2 x 101 3 .1 206.6 null null 3 y a*206.6 b*206.6 .2 206.6*(a+b)+.2 b 4 y a*(206.6(a+b)+.2) b*(206.6(a+b)+.2) .4 (etc...) b when id = 'x', cola, colb, , colc known , selected existing table. mov_sum calculated using previous row's mov_sum + cola + col b + colc. when id = 'y', cola, colb , colc must calculated using previous row's sum_abc. multipliers "a" , "b" constant when id = 'y'. i'm using teradata sql , cannot incorporate lag/lead syntax. have succeeded in calculating mov_sum (where id=x) creating intermediary table left join table on (where a._row >= b._row), sum(mov_sum)...

java - how to export a graph to svg/graphml -

i little bit stuck on how export graphs svg or graphml. neither api, examples or threads on forum.jgraph.com did me until now. i need export graphs both svg , graphml. got svg display nodes , edges correct layout, i'm missing information names of nodes , assigned colors. with graphml have no clue yet how correct xml code display functioning graph. is there guideline/workflow somewhere might me export in jgraphx? thanks in advance help, chris in order save graph have call mxcellrendered render graph mxicanvas document (dom document). renderer goes this: mxgraph.drawcell() -> mxgraph.drawstate() -> mxicanvas.drawcell() -> mxicanvas.drawshape() mxicanvas knows cell's geometry , style. i wanted cell id attribute added in svg file well, did following extended mxgraph override drawcell() in order add cell id in style of cell, , extended mxsvgcanvas adding id attribute shapes interested me the function save svg graph goes like: // use exte...

java - Joda-Time remaining seconds? -

this has me stumped, new using joda api. how can print out remaining seconds? datetime time1 = datetime.parse(c.lastbanktime); datetime time2 = new datetime(); seconds interval = seconds.secondsbetween(time1, time2); seconds mininterval = seconds.seconds(10); if(interval.isgreaterthan(mininterval)){ c.sendmessage("been 10 secs"); c.lastbanktime = new datetime().tostring(); } else{ c.sendmessage("please wait n seconds"); //how remaining seconds? } i'm not sure mean 'remaining seconds', looking for? mininterval.minus(interval).getseconds()

symfony - Can i use orm entites with SonataDoctrinePhpcrAdminBundle? -

how start using orm enites sonata-admin-bundle if alredy use sonatadoctrinephpcradminbundle ? possible ? my composer.json "minimum-stability": "dev", "require": { "php": ">=5.3.3", "symfony/symfony": "2.2.*", "twig/extensions": "1.0.*", "symfony/monolog-bundle": "2.2.*", "symfony/assetic-bundle": "2.1.*", "sensio/distribution-bundle": "2.2.*", "symfony-cmf/symfony-cmf": "dev-master", "symfony-cmf/simple-cms-bundle": "1.0.*", "symfony-cmf/create-bundle": "1.0.*", "jackalope/jackalope-jackrabbit": "1.0.*", "jackalope/jackalope-doctrine-dbal":"dev-master", "doctrine/phpcr-bundle": "1.0.*", "doctrine/phpcr-odm": "1.0.*", "doctrine/...

c# 4.0 - I want to split the data in the list when i see the ; in C# -

Image
i need split data in box , add new line when see ";" var retryparaminfo = new exparamscontent { idenitifier = tempidentifier.serialnumber, name = string.format( "retry information console {0}",i), value = mytestrunglobals.fixturecomponents[i].uuts[0].retrylist, //value = thisuut.retrylist.replace("\n", "\n" + environment.newline), }; uuttempinfo.exparams.add(retryparaminfo); to split string when character occours, can use: mystring.split(';'); and make result of inside array.

encoding - UnicodeDecodeError when trying to sendPhoto via python-telegram-bot -

i'm using python-telegram-bot python 2.7. right documentation suggests, method use send photo disk: bot.sendphoto(update.message.chat_id, photo=open(card.image.path, 'rb')) where card.image.path full path jpg file. when executing method unicodedecode error. please see full traceback below. traceback (most recent call last): file "/projects/gcards/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response response = self.process_exception_by_middleware(e, request) file "/projects/gcards/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) file "/projects/gcards/venv/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(*args, **kwargs) file "/projects/gcards/venv/lib/python2.7/site-packages/django/views/generic/base.py...

Google Custom Search (User quota Limits) -

we planning use google custom search api achieve 1 of our requirements. during pt cycle run issue of exceeding 100requests/100seconds/user limit (since api calls happening on server side,most same limit going exceeded in production well). there way go around it(other proxying api calls)? ideally white list ip address limit not apply it. will appreciate suggestion. roman.

How do I automatically run a Maven configuration when I save a Java file in Eclipse? -

i’m using eclipse mars on mac el capitan. have multi-module maven project, each module loaded eclipse maven-eclipse project. question is, if change java file , save it, how automatically launch action in eclipse run maven goal? objective run maven configuration (mvn —file ../pom.xml clean package -dskiptests) every time make java change. note have project -> build automatically checked don’t think has tie in maven. see save hook eclipse plug in : this plug-in listen save action. if save event fired in workspace, plug-in search configuration file in each project. if found execute specified java class or external program. code allowed modify project files too. useful trigger command on save, code generation, resource sync, enhancement, deploy , on. for creating own save action hook see hook save action in eclipse plugin .

vb.net - VB : How to start my program and read a file by click the file in 'File Explorer'? -

i know how write , read file. put code open own file. if want open file, can click "file > open" in program. had not problem it. however want develop program better that. in general program, when click file in file explorer, program start , read file. example click ".avi" video file , default program start , play video. i try in program. save file program ".mmr" binary file. don't have problem save , can open correctly click "file > open" in program. set program @ default open ".mmr" in file explorer. when double click ".mmr" file in file explorer, program starts, nothing happens after that. know didn't put code read file when program starts. this source code. public strfilelocation string 'file location private sub frmmain_load(byval sender system.object, byval e system.eventargs) handles mybase.load end sub private sub subopen() 'there code read '.mmr' file. 'i didn't us...

memory management - GC overhead limit exceeded when querying on OrientDB -

my database has 200.000 documents, linked property has 6 million documents. when query it, queries, error gc overhead limit exceeded appears. my computer has 16gb of ram , give 8 gb orientdb (-dstorage.diskcache.buffersize=8192) , put -xms1024 -xmx2048. , i've tried other options like: -xms128 -xmx4096, , other options. can me how fix it? or isn't orientdb enough work amount of data? my data this: {"@type":"d","@class":"part","p_partkey": 2, "lineorder": [{"@type":"d","@class":"lineorder","customer": [{"@type":"d","@class":"customer","c_city": "indonesia1"}], "lo_supplycost": 54120, "orderdate": [{"@type":"d","@class":"orderdate","d_weeknuminyear": 19}], "supplier": [{"@type":"d","@class":...

python - Hide some lines in odoo treeview -

i trying hide lines in tree view according specific flag, here tree view's xml code : <record model='ir.ui.view' id='my_object_tree'> <field name="name">my_object.tree</field> <field name="model">my_object</field> <field name="arch" type="xml" > <tree string="title" attrs="{'invisible': [('my_flag','=',false)]}"> <field name="name"/> <field name="my_flag"/> </tree> </field> </record> but seems "invisible" doesn't work here, can hide fields in case empty lines appear in tree view. there other solution please? what objects appear in list view determined domain part of action definition: <record model="ir.actions.act_window" id="my_object_action"> <field name="name"...

jenkins - Triggering a Hudson job when all upstream jobs are completed? -

i have 3 jobs a,b,c. job c has upstream dependency on job , job b. both job , b can run in pararllel. want job c should triggered when job , job b completed. there existing plug-in can use? using hudson 3.0.1 from other posts here figured out there existing plug-in in jenkins called build-flow plug-in( https://wiki.jenkins-ci.org/display/jenkins/build+flow+plugin ) provides functionality. there plug-in existing in hudson provides same functionality ? or can reuse plug-in hudson ? try build pipeline plugin ,this may want.

python - django queryset excluding rows that are referenced in a foreign table -

part of app consists of displaying statuses @ top of newsfeed. here have status model class status(models.model): user = models.foreignkey(user) description = models.charfield(max_length = 600, blank = false) created_at = models.datetimefield(auto_now_add = true, editable = false) image = models.imagefield(upload_to = 'images/statuspics/%y/%m/%d', blank = true, null = true) utility = models.foreignkey(utility) numlikes = models.integerfield(default = 0) class meta: ordering = ["-created_at"] # change plural form verbose_name_plural = "statuses" i have responses, way of indicating how post responded to, , status announces it. class response(models.model): post = models.foreignkey(post, null = true, blank = true) status = models.foreignkey(status, null = true, blank = true) status_level = models.integerfield( blank = true, choices = status_choices, default = 1) ...

iphone - tableview cell checkmark disable when scroll -

when scroll tabview cell ,then checkmark hidden.what do? - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [[tableview cellforrowatindexpath:indexpath] setselected:no]; facebookfriend *friend = [self.fbfriendsfiltered objectatindex:indexpath.row]; // build list invite if ( [self.fbfriendsinvited containsobject:friend.fid] ) { [self.fbfriendsinvited removeobject:friend.fid]; nslog(@"fbfriendsinvited:%@",self.fbfriendsinvited); [[tableview cellforrowatindexpath:indexpath] setaccessorytype:uitableviewcellaccessorynone]; } else { //if ( [self.fbfriendsinvited count] >= kselectionlimit ) // return; [self.fbfriendsinvited addobject:friend.fid]; [[tableview cellforrowatindexpath:indexpath] setaccessorytype:uitableviewcellaccessorycheckmark]; nslog(@"fbfriendsinvited:%@",self.fbfriendsinvited); } } you have add condition...

linux kernel - What is the difference between using gpio_tlmm_config and gpio_request + gpio_direction_input/output? -

please explain difference in usage of 1. gpio_tlmm_config , 2. gpio_request + gpio_direction_input / gpio_direction_output . gpio_tlmm_config -"history" gpio_request - "static configurations gpio_direction_input - "using gpios" gpio_direction_output -"using gpios" gpio_tlmm_config first-generation api gpio configuration & multiplexing on msm while gpio_request request carries implicit msm_gpiomux_get . gpio_direction_input & gpio_direction_output issue these calls task context.

c - Cesar Cipher out of bounds in Array -

guys found caesar cipher code in site.... when run showing segmentation fault in online compilers..but in c compiler tat i'm using showing processor fault... can pls point out wrong in code #include <stdio.h> #include <stdlib.h> #include <string.h> #define caesar(x) rot(13, x) #define decaesar(x) rot(13, x) #define decrypt_rot(x, y) rot((26-x), y) void rot(int c, char *str) { int l = strlen(str); const char *alpha[2] = { "abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"}; int i; (i = 0; < l; i++) { if (!isalpha(str[i])) continue; str[i] = alpha[isupper(str[i])][((int)(tolower(str[i])-'a')+c)%26]; } } int main() { char str[] = "this top secret text message!"; printf("original: %s\n", str); caesar(str); printf("encrypted: %s\n", str); decaesar(str); printf("decrypted: %s\n", str); return 0; } ...

html5 - Should I wrap every text-node with a <p> element? -

i create semantically , logically correct html5 document concious created document outline satisfy search engines , other software take advantage of element semantics. the <p> element - know should not take name, paragraph, literally, not sure if should use wrap every text-node in document? generally asked, should wrap every text-node in dom <p> element, smallest text portions, or may write them down in document? if @ definition of paragraph in html5 spec, you'll see several examples of pieces of text not wrapped in <p> tags. no, there no requirement wrap every scrap of text in <p> tags.

multithreading - Android Vibration while locked/sleep -

whether user has screen on or off want notify user vibration. if screen on, works well: vibrator vibrator = (vibrator) getapplicationcontext().getsystemservice(context.vibrator_service); long sleep = 100; long vibrate = 500; long[] vibratepattern = {0, vibrate, sleep, vibrate, sleep}; vibrator.vibrate(vibratepattern, -1); its called thread implemented in service. the thread runs if screen off. checked because im implementing timer. cant problem! not sure if have looked android's notifications, sounds perfect trying achieve. http://developer.android.com/intl/es/reference/android/app/notification.builder.html when building notification, can cause phone vibrate setvibrate() method.

java - How to define a "In between" JGit RevFilter? -

i trying implement revfilter used through revwalk#setrevfilter() . in following have tried: private class inbetweenrevfilter extends revfilter { private anyobjectid end; private anyobjectid begin; public inbetweenrevfilter(anyobjectid begin, anyobjectid end) { this.begin = begin; this.end = end; } @override public revfilter clone() { return this; } @override public boolean include(revwalk walker, revcommit c) throws stopwalkexception, missingobjectexception, incorrectobjecttypeexception, ioexception { revcommit = walker.parsecommit(begin); revcommit = walker.parsecommit(end); return (walker.ismergedinto(from, c) && walker.ismergedinto(c, to)); } } the result of filter should commit pushed after begin , before end . problem when set filter, commit marked start point revwalk.markstart(revcommit c) returned revwalk.next() . in following, show show how tri...

Point-Zoom on Mandelbrot Set in C# - It works, except when the mouse has moved -

i'm able point zoom on mandelbrot set, long mouse doesn't move after zooming has begun. i've tried calculating normalized delta (new coordinate - old coordinate)*(oldzoom), happens image appears jump around new location. i've seen issue before. i'm struggling more here because have somehow convert mouse position delta -2,2 coordinate space of mandelbrot set. here's code. what's important getzoompoint method, , lines of code define x0 , y0. also, use range class scale values 1 range another. was using deltatrans (thats thing talking earlier normalize mouse delta old scale). using opentk.graphics.opengl; using spritesheetmaker; using system; using system.collections.generic; using system.drawing; using system.linq; using system.text; using system.threading.tasks; namespace fractal.fractal { public class mandelbrot : basetexture { private static transform globaltransform = spritesheetmaker.global.transform; private static vect...

javascript - How to set different ID's in Angular for HTML elements added with angular.append -

having code in directive holds leaflet map: angular.element($elem[0]).append(angular.element('<div id="map" style="width: 100%; height: calc(100% - 25px); border: 1px solid #ccc"></div>')); map = new l.map('map', {layers: [osm], center: new l.latlng(center[0], center[1]), zoom: 10}); how set different id's each copy of directive add? way have several copies of map on screen, instead of 1 have @ moment. thank you. you try that: $scope.mapcount=0; angular.element($elem[0]).append(angular.element('<div id="map'+ mapcount++ +'" style="width: 100%; height: calc(100% - 25px); border: 1px solid #ccc"></div>')); i hope helps.

python - use xml.etree.elementtree to write out nicely formatted xml files -

this question has answer here: pretty printing xml in python 18 answers i trying use xml.etree.elementtree write out xml files python. issue keep getting generated in single line. want able reference them if possible able have written out cleanly. this getting <language><en><port>port</port><username>username</username></en><ch><port>ip地址</port><username>用户名称</username></ch></language> this see. <language> <en> <port>port</port> <username>username</username> </en> <ch> <port>ip地址</port> <username>用户名称</username> </ch> </language> thanks help! you can use function toprettyxml xml.dom.minidom ...

javascript - Textbox to accept only one @ -

i'm creating email field in html, can accept 1 @ ? for example email: chong!#$@gmail.com - should invalid because of there others special characters included or ch@ng@gmail.com - should invalid because there 2 @ 's. the accepted special character should 1 @ , how do in javascript/jquery? sorry don't know in regex. or there way validate email format? you can use following regex in input: <input type="email" pattern="[a-za-z0-9.]+\@[a-za-z0-9.]+\.[a-za-z]+" />

android - How to retrieve Images from firebase in listview -

i trying retrieve images in listview using firebase list adapter.i using pojo class saving , retriving images firebase. below pojo class: data.java public class data { string imag; public data(){ } public data(string imag){ this.imag = imag; } public string getimag() { return imag; } public void setimag(string imag) { this.imag = imag; } } code storing images: firebase ref = new firebase("https://imaglist.firebaseio.com"); bitmap bm = bitmapfactory.decodefile(imgdecodablestring); bytearrayoutputstream baos = new bytearrayoutputstream(); bm.compress(bitmap.compressformat.jpeg,100,baos); byte[] bytearray = baos.tobytearray(); encodedimage = base64.encodetostring(bytearray, base64.default); data d = new data(); d.setimag(encodedimage); ref.child("photo").push().setvalue(d, new firebase.completionlistener() { @override public void oncomplete(firebaseerror firebaseerror, firebase firebase) { ...

ember.js - How does Ember Data make the decision about what URL to look at when requesting data? -

i have following route file index.js : export default ember.route.extend({ model() { return this.store.findall('rental'); } }); in tutorial on ember site, states ember data fetch data /rentals url - why not @ /rental (as had defined in route file)? ember data follows restful endpoint design states resources endpoints plural. when ask store findall rental asking find of records model type rental not hit endpoint rental . https://codeplanet.io/principles-good-restful-api-design/ if endpoints non-standard, or pain use ember data, can create custom adapters , serializers. or can use normal ajax calls.

python - Forward fill in pandas dataframe based on specific label in a column -

i need forward feel data within specific label (where label defined in other column: label | col1 | ffil_col | ------------------------- 1 | n | female | 1 | m | | 2 | | | 2 | n | male | 2 | m | | need this: label | col1 | ffil_col | ------------------------- 1 | n | female | 1 | m | female | 2 | | | 2 | n | male | 2 | m | male | the idea have far use groupby label, ffill each group, , concat back. there alternative , more clear solution? you can use transform on groupby, retains same length original dataframe. df['ffil_col'] = df.groupby('label').ffil_col.transform(lambda group: group.ffill()) >>> df label col1 ffil_col 0 1 n female 1 1 m female 2 2 nan 3 2 n male 4 2 m male

Angularjs filter with custom function from controller -

i trying filter table based on age conditions less , greater 25 years. here demo fiddle the filtering function not happening expected. less 25 returns no results , greater 25 returns 44 , 25. kindly let me know how results correct? vm.filterbyagefn = function(subject){ filterreturn = true; if(vm.filterbyage){ switch(vm.filterbyage){ case '<25': if(parseint(subject.age) >= 25){ filterreturn = false} case '>25': if(parseint(subject.age) < 25){ filterreturn = false} } } return filterreturn; } why less , greater backwards? the less , greater in switch doesn't match string case not mention i'm not sure strong case real idea. use , object hold key less , greater than.

inheritance - java: enforce no arg constructor in subclass at run time -

i know there's no way enforce @ compile time , hoping there'd way @ runtime maybe using reflection. you obvious way, reflection: public class superclass { public superclass() { try { // constructor no arguments this.getclass().getconstructor(); } catch(reflectiveoperationexception e) { throw new runtimeexception("subclass doesn't have no-argument constructor, or constructor not accessible", e); } } } (note getconstructor return constructor if public; allow private constructors too, use getdeclaredconstructor ).

postgresql - psql: FATAL: password authentication failed -

Image
when ever trying run psql in command line, asking password: . i'm not sure username , password is. i installed postgresql brew install postgres pg_hba.conf # database superuser. if not trust local users, # use authentication method. # type database user address method # "local" unix domain socket connections local trust # ipv4 local connections: host 127.0.0.1/32 trust # ipv6 local connections: host ::1/128 trust # allow replication connections localhost, user # replication privilege. #local replication austintruong trust #host replication austintruong 127.0.0.1/32 trust #host replication austintruong ::1/128 trust let me know if there confusion in question. edit in other posts, mentions if c...

c# - wpf multiple binding sql and selectedItem -

hi have problem binding. binded data grid result of sql query, dont knew how bind selecteditem. want selecteditem.a . question how bind multiple things? this code how binded selcteditem not working. xaml: <datagrid name="grid" itemssource ="{binding}" selecteditem ="{binding path=selecteditem mode=twoway}" autogeneratecolumns="false" verticalalignment="top"> <datagrid.columns > <datagridtextcolumn header="a" binding="{binding path=a, mode=twoway}" visibility="hidden"/> <datagridtextcolumn header="b" binding="{binding path=b, mode=twoway}" /> <datagridtextcolumn header="d" binding="{binding path=c, mode=twoway}" /> </datagrid.columns> <datagrid.itemcontainerstyle> <style targettype="datagridrow"> <eventsetter event="mousedoubleclick...

asp.net mvc - Why is my role check gone after I added a paging? -

i have parts of view dependent on if user authenticated , role. example: @*@model ienumerable<project.models.class>*@ @model pagedlist.ipagedlist<project.models.class> @using pagedlist.mvc; <link href="~/content/pagedlist.css" rel="stylesheet" type="text/css" /> @if (request.isauthenticated && user.isinrole("canedit")) { <div> @html.actionlink("create new", "create") </div> } but after adding in paging, i've lost ability , can no longer see authenticated links?

javascript - How to debug strange behavior when adding to Moment? -

so precursor information. date calculating from: 2016-04-11t22:12:36.000z i add 12 hours doing: var time = new date(d.datecreated) time = number(time) diff = parseint(d.time) * 3600 diff = time + diff the calculated differences of code is: console.log(time,diff) //result: 1460412756000 1460412799200 then when run following code: var m = moment().diff(diff, 'hours') //returns 194 hours what doing wrong? you're not reading documentation , utilizing it, that's you're doing wrong. sorry crass... you want date/time (from moment docs -- http://momentjs.com/docs/#/manipulating/add/ ) moment().add(12, 'hours');

C++ Using pointers on structure and saving them on files -

soo have issue, im using pointers on structures , saving values on file struct compracli{ char nomeartigo[50]; char codigo[50]; char nomecli[50]; char data[50]; }; int compra(int l){ compracli *ptr, d; file *arquivo; ptr = &d; if((arquivo = fopen("compras.dat", "rb+")) !=null){ //colocar apontadores dentro dos arquivos system("cls"); cout<<"adicinar um pedido de compra!"<<endl; cin.sync(); cout<<"adicione o nome artigo: "; cin >> (*ptr).nomeartigo; fwrite(ptr->nomeartigo, sizeof(ptr->nomeartigo), 1, arquivo); cin.sync(); cout<<"adicione o codigo artigo: "; cin >> (*ptr).codigo; fwrite(ptr->codigo, sizeof(ptr->codigo), 2, arquivo); cin.sync(); cout<<"adicione o ...

Error with analyzing hand function with my poker game C code -

i have code printing out cards , hands when time analyze hand function nothing , i'm not sure go here or i'm missing fresh pair of eyes! #include <stdio.h> #include <stdlib.h> #include <time.h> #define suits 4 // suits of cards #define faces 13 // 2 / ace #define available 0 // card not drawn deck #define taken 1 // card has been drawn deck #define size 5 #define true 1 #define false 0 //declarations of structs void dealacard(char *suits[], char *faces[], int deck[][faces]); void dealahand(char *suits[], char *faces[], int deck[][faces]); //declaration of analyze function void analyzehand(int suitsinhand[], int facesinhand[]); typedef int bool; bool straight, flush, four, three; int pairs; int main(void) { //character array of suits char *suits[4] = {"hearts", "diamonds", "spades", "clubs"}; //character arrau of face cards char *faces[13] = {"two", "three", "four...

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

dijkstra - python - build adjacency list from list of nodes and edges -

i have list of node , edge objects national highway planning network database. lot of data hidden me given me: class node: def __init__(self, longitude, latitude, state, description): self.longitude = longitude self.latitude = latitude self.state = state self.description = description class link: """a bi-directional edge linking 2 nhpn nodes.""" def __init__ (self, begin, end, description): """create link given beginning , end (which must nodes) , possibly description string.""" self.begin = begin self.end = end self.description = description i know there isn't lot of information given trying build adjacency list data. use dictionary. tried: for node in nodes: adj[node] = none edge in edges: adj[node] = (edge.begin, edge.end) #edge.begin , edge.end being node's neighbors followed print statement, see if worked. ne...