Posts

Showing posts from April, 2013

javascript - Can't get active navigation to work on site -

no matter do, can't seem active navigation work on site. here's url: http://helloarchie.blue as far can tell, urls correct (bar categories) i'm getting confused navigation css. here's html: <nav class="cbp-hsmenu-wrapper" id="cbp-hsmenu-wrapper"> <div class="cbp-hsinner"> <ul class="cbp-hsmenu"> <li><a href="http://helloarchie.blue"><span class="navi">01</span> home</a></li> <li><a class="arrow" href="#"><span class="navi">02</span> categories</a> <ul class="cbp-hssubmenu"> <li><a href="http://helloarchie.blue/category/personal/"><span>personal</span></a></li> <li><a href="http://helloarchie.blue/category/informative/"><span>informative</span></a></li> <li><a href=...

css - Fixed elements in a fixed navbar -

Image
i'm trying make navbar has fixed position , has elements inside of fixed: .navbar { position: fixed; top: 0; bottom: 0; right: 0; } .content-area { overflow: scroll; } .top-area { height: 100px; position: fixed; top: 0; } i have 2 areas should fixed top , bottom , content area in middle that's overflow scrolls under bottom area. when add position: fixed; .top-area or .bottom-area disappear top. why can't fix element onto navbar? the html looks this: <div class="navbar"> <div class="top-area"> </div> <div class="content-area"> <p> content here </p> </div> <div class="bottom-area"> </div> </div> fixed elements taken out of normal flow of html page. try set z-index value these classes. give higher e.g. z-index: 100 want on top. if show html, fix more precisely :).

Cordova and Android SDK Manager -

Image
i use cordova 4.0 , have android sdk folder in home , run android command enter sdk manager: i have installed android sdk versions 14 (v 4.0) 22 (v5.1.1) , folder 45gb. i'd know whether it's necessary have files installed in order make cordova app working android versions 4.0 5.1.1? what's purpose of installing files sdk manager? related cordova when doing cordova build ? thanks

launch - Batch file does not follow through with launching program once given permission by the user account control -

i have following batch file: for /f "delims=" %%x in (path.txt) set path=%%x set address=62.75.218.30:14567 start bf1942.exe with path.txt file containing path executable. once run batch file prompted if want allow bf1942.exe make changes computer (user account control). once select 'yes' nothing happens. when launch bf1942.exe double clicking on icon same prompt game launches after give permission. edit: did investigation. when moved path.txt , batch file bf1942 folder , ran batch file worked. problem has file located. change working directory ( do not change system environment variable path ) follows: for /f "delims=" %%x in (path.txt) set "mypath=%%~x" set "address=62.75.218.30:14567" pushd "%mypath%" start "" bf1942.exe or set "address=62.75.218.30:14567" /f "delims=" %%x in (path.txt) ( pushd "%%~x" start "" bf1942.exe ) resources (requir...

arrays - Calling an object in a search method in rails -

i searching through array of hashes , need find specific objects within hash. issue getting need search model. searching this... @insur_transactions = user.transactions.find_all { |t| (t.fetch('name').downcase! =~ /user.bill.name/) } the problem wont search hashes object found in bill.name. how pull object bill model , search specific item? using mongoid db. got answer. since using regex can pull object using /#{ object }/ code looks this @insur_transactions = user.transactions.find_all { |t| (t.fetch('name').downcase! =~ /#{user.bill.name}/) } that got it!

c - Which format should I use: scanf \string,string,int,int/? -

i have data in following format \a,b,c,d/ a,b strings of letters , numbers; c, d integers. i tried using format \%s,%s,%d,%d/ format scan it, causes a,b,c,d/ scanf'ed first string instead of a. question: is there type in format in order achieve desired result? you can use following format string use commas delimiters : "\\%[^,],%[^,],%d,%d/" the idea tell scanf read isn't comma each string, read delimiting comma , continue. here (bad , unsafe!) example: char a[100], b[100]; int c=0, d=0; scanf("\\%[^','],%[^','],%d,%d/", a, b, &c, &d); printf("%s, %s, %d, %d\n", a, b, c, d); in real code, you'll want write safer. can example use fgets read full line of input reuse same format string sscanf parse it.

java - Unit testing a fluent interface with Mockito -

i want mock dao interface used in builder pattern shown below. when run test below passes indicating mock object never called. doing wrong? public class dbcontent { ... public static class builder { dao dao = new dao(); ... public builder callinsert() { ... long latest = dao.insert(); ... } } ... } @runwith(mockitojunitrunner.class) public class dbcontenttest { @mock dao dao; @test public void test() { when(dao.insert()).thenreturn(1111l); dbcontent db = dbcontent.db() .callinsert() .callinsert() .callinsert() .build(); verifyzerointeractions(dao); } } use powermockito instead. there can define whenever have call constructor of dao, return mocked object instead of returning actual dao object. please refer this learn how use powermockito.

r - ggplot2 is incorrectly sorting the X axis of my graph -

Image
i trying create plot of user login behavior 2 month period. used qplot function ggplot2 package, , following code qplot(date_time, login_count, data=client_login_clean) i plotted login_count on time shown below. unfortunately, y-axis, num_records sorted such first 5 tick marks on y-axis 1, 10, 106, 11, , 12, rather 1, 2, 3, 4, 5. let me know how fix this? that's because, reason, login_count variable character vector. ggplot internally coerces character vectors factors, labels ordered alphabetically, , sorts axis according order. i think know why happened: "num_records" value in login_count column, whole thing has been coerced character vector. delete element , use as.numeric , ordering should correct. opportunity read on data loading/generating process , make sure haven't made other mistakes. tiniest bugs can uncover massive problems never have noticed otherwise. as side note, why should careful character -class variables , ggplot plotti...

c# - Take element's parent name, a few levels above -

i have many tabitems in mainwindow.xaml.cs same structures. 1 of them. <tabitem name="tabfeatured" header="featured" datacontext="{binding templatesfeatured}"> <scrollviewer> <itemscontrol name="itemscontrolfeatured" itemssource="{binding}" > <itemscontrol.itemspanel> <itemspaneltemplate> <wrappanel/> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate> <button name="featured" tag="{binding id}" click="button_download_click"> </button> ...

java - Optimising topological sort -

so i'm working on isometric tilebased game , i'm using topological sort sort order of tiles rendered. well, topological sort determines depth of each tile , arraylist of tiles rendered sorted comparator comparing these depths. the issue i'm having poor performance on topological sort. i'm not sure if there i'm missing might cause performance issues. thankful input used optimise topological sort. i'm storing variables in fields, i'm not sure if improves performance. i'm using public fields comparisons needed. relevant code snippets: private void topological(array<isosprite> sprites) { (int = 0; < sprites.size; ++i) { = sprites.get(i); behindindex = 0; for(isosprite sprite: sprites){ if(sprite != a){ if (sprite.maxx > a.minx && sprite.maxy > a.miny && sprite.minz < a.maxz) { if (a.behind.size <= behindindex) { ...

arm - QQmlPropertyCache: QQuickItem has FastProperty class info, but has not installed property accessors -

built raspberry pi 2 linux distro including qt5.4 + qtwebkit + qml plugin using yocto on fido branch see tutorial testing following qml script root@raspberrypi2:~# more webkit.qml import qtwebkit 3.0 webview { url: "http://www.nokia.com" preferredwidth: 490 preferredheight: 400 scale: 0.5 smooth: false } when running script getting following error: root@raspberrypi2:~# /usr/bin/qt5/qmlscene --platform eglfs webkit.qml unable query physical screen size, defaulting 100 dpi. override, set qt_qpa_eglfs_physical_width , qt_qpa_eglfs_physical_height (in millimeters). qqmlpropertycache: qquickitem has fastproperty class info, has not installed property accessors aborted any pointers? i had same problem. solution add line import qtquick 2.0 to qml file.

debian - Disabling bone101 on BeagleBone Black -

i have beaglebone black running debian. using "htop" see number of processes consuming decent amount of memory "/usr/bin/ruby1.9.1 /usr/local/bin/jekyll buld --destination bone101 --watch" don't need bone101 service application , disable it. " systemctl disable bone101.service " return " no such file or directory " error. can kill process manually in htop not run on startup. suggestions? you can disable with: systemctl disable jekyll-autorun.service stop bone script using: systemctl disable bonescript-autorun.service

java - How to add a value to a specific row in a 2d array -

i trying number user input row number of 2d array existed , number value needs added elements of row. have no idea how it. please me , give me idea start. so example if have 2d array , content is: 2 3 4 5 1 2 6 2 5 6 4 2 6 2 1 i know how numbers user input , locate row don't know how add second number elements of row. for example: if user inputs 0 row number. we got 2 3 4 5 1 located. then user inputs 2 value of addition. i need 2+2 3+2 4+2 5+2 1+2 , save row 0 2d array. how can it? if you're stuck on 2d array syntax, it's this: myarray[0][0] = myarray[0][0] + 2; myarray[0][1] = myarray[0][1] + 2; myarray[0][2] = myarray[0][2] + 2; myarray[0][3] = myarray[0][3] + 2; myarray[0][4] = myarray[0][4] + 2; or more concisely: for (int i=0, length=myarray[0].length; i<length; i++) { myarray[0][i] += 2; }

matlab - find area of 3D polygon -

given matrix nx3 represents n points in 3d space. points lie on plane. plane given normal , point lying on it. there matlab function or matlabby way find area directly matrix? what trying write function first computes centroid,c, of n-gon. form triangles : (1,2,c),(2,3,c),...,(n,1,c). compute area , sum up. had organise polygon points in cyclic order unordered figured hard. there easy way so? is there easier way in matlab call function on matrix? here perhaps easier method. first suppose plane not parallel z -axis. project polygon down xy -plane removing 3rd coordinate. compute area a ' in xy -plane the usual techniques . if plane makes angle θ xy -plane, 3d area a = a ' / cos θ. if plane parallel z -axis, same computation w.r.t. y -axis instead, projecting xz -plane.

email - grails asynchronous mail service error -

our system sending email inside job using asynchronousmailservice log.debug 'sending email ' + emailto asynchronousmailservice.sendmail { multipart true emailto.split("[,;]") bcc "test@bcc.com" "test@from.com" subject "test subject" html(view:'/email/testtemplate', model: [test: test]) attachbytes testid +".pdf" , 'application/pdf', invoicebytes } log.debug("invoice email sent.") with following grails config: grails { mail { host = "smtp.gmail.com" port = 465 username = "test@test.com" password = "password" props = ["mail.smtp.auth":"true", "mail.smtp.socketfactory.port":"465", "mail.smtp.socketfactory.class":"javax.net.ssl.sslsocketfactory", "mail.smtp.socketfactory.fallback"...

java - jsonschema2pojo generating enum without any key value pairs -

i using jsonschema2pojo generate pojo json schema.however, not seem working when using named enums.instead of key value pairs in pojo, adds __empty__ . there problem way have specified enums or issue jsonschema2pojo? json schema { "type": "object", "$schema": "http://json-schema.org/draft-04/schema", "description": "status identifier", "properties": { "status": { "type": "string", "enum": [ {"active" : 0}, {"inactive" : 1} ], "description": "defines whether schedule active" } } } generated java pojo import java.util.hashmap; import java.util.map; import javax.annotation.generated; import com.fasterxml.jackson.annotation.jsonanygetter; import com.fasterxml.jackson.annotation.jsonanysetter; import com.fasterxml.jackson.annotation.jsoncreator; import com.fast...

ios - getting user location and creating map not in sync -

the below code getting user current location , creating mapbox map. problem mapbox map being created before users location obtain. how may slow or sync process? thank in advance, import uikit import corelocation import mapboxgl class aviewcontroller: uiviewcontroller, cllocationmanagerdelegate { var manager:cllocationmanager! var userlocation:cllocation = cllocation(latitude: 25.776243, longitude: -80.136509) override func viewdidload() { super.viewdidload() println("inside viewdidload") self.getuserlocation() }//eom override func viewdidappear(animated: bool) { println("inside viewdidappear") self.createmapboxmap() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } /*** mapbox functions ************************************************************************/ /*create preliminary map */ func createmapboxmap(){ // set access token ...

SQL Count function count all rows if a condition is met -

i have customer table, item table , transaction table following columns: customer - id, name item - id, description transaction - id, custid (foreign key customer(id)), itemid (foreign key item(id)) using query, can me create query answer following question: if particular customer has participated in transaction involves given itemid (ie. customer has bought particular item), return count of total number of transactions customer involved in. trick (and part cannot work out myself) how include transactions in count not involve itemid used in query. you can solve problem in 2 steps: write query returns relevant customers' ids. if write query subquery or cte (common table expression, i.e. with clause), don't need put results in temporary table. join resulting table (1) transaction table (to filter out transactions you're not interested in), group customer id (so can use aggregate functions in select clause), , select count(distinct transactionid) ...

How to send an HTML file with css? -

i have html file linked css stylesheet , saved usb. send compressed folder , sent via facebook friend, when opened it, design in first page not loaded , following pages cannot displayed whereas here in pc, it's working. seems cannot locate files , think has links , directories... how going send friend able open , see in same way? appreciated. if it's in compressed folder, friend need extract folder each file able use eachother. or, if friend isn't tech-savvy, inline css (i.e. not link externally) , javascript 1 .html file: <html> <head> <style> /* styles here */ </style> </head> <body> <h1>html here</h1> <script> //some js code... </script> </body> </html>

django - Is there any way around saving models that reference each other twice? -

my issue when saving new models need reference each other, not using related_name lookup, such this: class many: owner = models.foreignkey('one') class one: current = models.onetoonefield('many') by default, these have null=false and, please correct me if i'm wrong, using these impossible until change 1 of relationships: current = models.onetoonefield('many', null=true) the reason because can't assign model relationship unless saved. otherwise resulting in valueerror: 'cannot assign "<...>": "..." instance isn't saved in database.' . but when create pair of these objects need save twice: many = many() 1 = one() one.save() many.owner = 1 many.save() one.current = many one.save() is right way it, or there way around saving twice? there no way around it, need save 1 of objects twice anyway. this because, @ database level, need save object id. there no way tell sql database ...

c# - How to stop BackgroundWorker whose `DoWork` handler only contains one (long-running) statement? -

i have problem backgroundworker dowork handler contains 1 statement. means cannot check cancellationpending flag: private void backgroundworker_dowork(object sender, doworkeventargs e) { calltimeconsumerfunction(); } how can stop backgroundworker ? there work-around? looking @ .net 4's task parallel library (tpl), came after backgroundworker , rather well-designed, can give idea how should approach this. cancellation in tpl built on idea of cooperative cancellation . means tasks not forcibly stopped outside; instead participate in cancellation process periodically checking whether cancellation has been requested and, if so, gracefully aborting "from inside". i recommend follow tpl's example , implement cooperative cancellation. this comment states, inject cancellation logic calltimeconsumerfunction . example: void calltimeconsumerfunction(func<bool> shouldcancel) { // ^^^^^^^^^^^^^^^^^^^^^^^ ...

android - Fragment's onCreate and onCreateView are not called -

i'm building application receive action.send intent , display files in clip data listview . listview inside sharefragment hosted mainactiviy . below how implement it. public class sharefragment extends mfragment { private static final string tag = "sharefragment"; private list<file> files; private fileadapter fileadapter; @override public void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); log.e(tag, "oncreate called"); } @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { files = new arraylist<>(); fileadapter = new fileadapter(getactivity(), 0, files); view rootview = inflater.inflate(r.layout.share_fragment, container, false); listview lv = (listview) rootview.findviewbyid(r.id.listview); lv.setadapter(fileadapter); log.e(tag, "o...

javascript - Check Box Validation -

Image
in 'leave type' dropdown there 3 fields casual leave, maternity leave. 1,2,3,4,5... these date fields , have converted these fields days. i want ensure if 'leave type' selected index 0 couldn't check check box. function(leavetypeselectedindex,chk) { if(leavetypeselectedindex==0) { chk..checked = false; } } i have tried i'm not going destination. how do that. , in advance i think way try uncheck checkbox problem. see https://stackoverflow.com/a/17420580/524913 . basically, need do: $(chk).attr('checked', false);

c - Tracing out the motion of a double pendulum in gnuplot (and gif conversion)? -

i have written c program trace out motion of double pendulum, having difficulties in getting gnuplot (controlled c program) trace out paths of masses ( example ). far have created program such produces number of png images @ each interval (using runge kutta method), want output gif instead line traces out path of masses in real time. in code below assuming problem occurs piping out gnuplot within loop (to save wasting time sifting through it) /* header files */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <assert.h> // definitions #define gravity 9.8 #define increment 0.0175 // declerations of functions double th1_xder(double t1d); double th1_yder(double t2d); double th2_xder(double t1d, double th1, double t2d, double th2, double l1, double l2, double m1, double m2); double th2_yder(double t1d, double th1, double t2d, double th2, double l1, double l2, double m1, double m2); int main (int argc, char * argv[...

python - dict.fromkeys return dictionary in reverse order from a list -

this question has answer here: how can sort dictionary key? 19 answers i adding items of list dictionary keys equal none. template_vars = headers[1:] kwargs = dict.fromkeys(template_vars) when print values of both variables in terminal, follows. {'type': 'nauman ahmad', 'name': 'cyborg'} ['name', 'type'] the order of dict reversed? how can in same order of list template_vars because order matters me here? dictionaries unordered. use ordereddict if order important: from collections import ordereddict kwargs=ordereddict((k, none) k in template_vars)

Getting iOS Action Extension template to work -

Image
i trying out action extensions on ios. created new project , loaded action extension template. looking @ template code, seems if select image load actionviewcontroller's imageview. ran action extension , got loaded in share dialogue expected, when selected image did not show in imageview of actionviewcontroller. familiar action extensions let me know missing. reza if working on swift project ,in **actionviewcontroller u need retrieve image url u need add code this if let strongimageview = weakimageview { if let imageurl = image as? nsurl{ strongimageview.image = uiimage(data: nsdata(contentsofurl: imageurl)!) }else{ strongimageview.image = image as? uiimage } } for clarification added full code below (actionviewcontroller) ,please go through code , override func viewdidload() { super.viewdidload() // item[s] we're handling extension c...

osx - How do I find the physical position of a CGKeyCode? -

i'm trying create onscreen keyboard matches physical keyboard. know can send keyboard events particular cgkeycode ; key code corresponds physical key rather input character, , that can use this answer find out key is; how find out physical position of key? possible read out row it's in , index in in row?

html - Background transition with sprite image in css3? -

any 1 please give me correct approach using css3 ? 1) have on bg image contains multiple states of each sprite. i using keyframe animation update each of position of backgroud, not come well how it? if not wrong 1 show correct way please? my code : <div class="bg"></div> div.bg { background : url(https://dl.dropboxusercontent.com/u/10268257/all.png) 0 center; height:443px; width:795px; } @-webkit-keyframes animatebg { 0%{ background-position :0px center} 5.882352941176471%{ background-position :795px center} 11.764705882352942%{ background-position :1590px center} 17.647058823529413%{ background-position :2385px center} 23.529411764705884%{ background-position :3180px center} 29.411764705882355%{ background-position :3975px center} 35.294117647058826%{ background-position :4770px center} 41.1764705882353%{ background-position :5565px center} 47.05882352941177%{ background-position :6360px center} ...

android - Social Authentication in Ionic App using ngCordova-oauth -

i using ngcordova-oauth sign facebook , google. app working fine use inappbrowser open webview , login. not detect if user has login in device. how can achieved in ionic/cordova app if user has login in fb or google take token there rather open webview everytime , signing up? how follows 1 - let user login first time via ngcordova-oauth 2 - authentication token , save it, im using $localstorage 3 - when user opens app next time, send authentication token server , validate (before step 1) 4 - if authentication token valid, skip login , move on 5 - if user logs out , clear authentication token , invalidate step 3, , force log again

java - Dynamic Filter Building in Elasticsearch -

i building api. have id,name,price in elasticsearch. client provides me input json filters applied. input 1: below user filtering records id=1 (integer) { "filters": { "id":1 } } input 2: user querying records city=tokyo { "filters": { "city":"tokyo" } } java code handling inputs , querying elastic search filters = ipjson.path("filters"); iterator<entry<string, jsonnode>> ite = filters.fields(); while (ite.hasnext()) { entry<string, jsonnode> ele = ite.next(); string key = ele.getkey(); if (ele.getvalue().isint()) { andfilter.add(filterbuilders.termfilter(key, ele.getvalue().asint())) } else if (ele.getvalue().istextual()) { andfilter.add(filterbuilders.termfilter(key, ele.getvalue().textvalue())); } } for each key received in filte...

php - Symfony2 FOSUserBundle Invalid maping file on random requests -

while deploying symfony2 application shared webhosting platform, noticed on random requests, webapplication returns status code 500. when looking in logs, application complains invalid mapping file: request.critical: exception thrown when handling exception (doctrine\common\persistence\mapping\mappingexception: invalid mapping file 'fos.userbundle.model.user.orm.xml' class 'fos\userbundle\model\user'. i can't seem fix problem, doesn't happen on each request. can give me direction into?

javascript - is it possible to tweak the d3 bubble chart to obtain the bubbles at scattered positions instead of a circle pack? -

i need implement d3 bubble chart,but bubbles scattered out in division ( spread across division @ specific coordinates ) instead of circle pack layout.is possible set positions of bubbles in such way using d3.js? sure, don't use layout , set each circles cx , cy yourself: svg.selectall('circle') .data(data) .enter() .append('circle') .attr('r', function(d){ return d.r; }) .attr('cx', function(d){ return d.x; }) .attr('cy', function(d){ return d.y; }); example here . edits you can arrange bubbles anyway want, positioning them in x/y 2d space. if wanted complex, using d3's scales map user space pixel space. here's sine wave example: var svg = d3.select('body') .append('svg') .attr('width', 500) .attr('height', 500); var xscale = d3.scale.linear() .domain([0, 10]) .range([0, 500]); var yscale = d3.scale.linear() .domain([-1, 1]) ...

database - query from multiple tables? -

hi started self-studying oracle sql, , stuck in following problem. glad if can guided on how approach solution these type of problem. we have database. database consists of following tables: table route_info contains descriptions of routes on monorails used travel. route_info(route_no integer, source string, destination string, length integer, departs time, arrives time, cost integer); +----------+----------+-------------+--------+----------+----------+------+ | route_no | source | destination | length | departs | arrives | cost | +----------+----------+-------------+--------+----------+----------+------+ | 1462 | banglore | delhi | 1516 | 13:00:00 | 15:00:00 | 4500 | | 4456 | gwalior | delhi | 543 | 05:05:06 | 04:55:24 | 546 | | 4524 | banglore | delhi | 1516 | 04:44:00 | 13:00:45 | 1200 | | 7490 | banglore | gwalior | 1343 | 01:16:17 | 17:07:08 | 1400 | | 7890 | agra | gwalior | 343 | 01:15:41 | 07:07:08 |...

how to deploy workflow in alfresco community -

this question has answer here: what straight-forward method deploy new workflow definition in alfresco community 4.0.e? 1 answer i'm using alfresco 4.2c community installed bin installer. i've ready workflow in machine doing maven sdk. found folder structure not same 4.2 community. example, got file named "service-context.xml" workflow bean deployer while 4.2 community doesn't have file. i search google 4.2c community has extension folder: tomcat/shared/classes/alfresco/extension should create folder structure under folder? or place 4 files: bean deployer, model, workflow.bpmn , share-config-custom.xml inside? also, there has extension folder called "web-extension": tomcat/shared/classes/alfresco/web-extension may know use place share-config-custom.xml (share forms)? a snippet of service-context.xml: <bean ...

html - CSS - element to not to split and move down -

i making website have problem elements. default position - http://gyazo.com/43fb8851f0b98f0461c05e13fe90382f (seems ok me). when website's width smaller, happens - http://gyazo.com/27d02e101bcb051faa9c1ab594a8d54a - elements split , in 2 lines , of them close line above them. cannot solve problem. please me? :) first in blue container try use overflow:hidden; in class. try give margin-top:10px; inputs. but in opinion must use media querys set better style elements. to use media querys add <meta name="viewport" content="width=device-width"> in head. than in css add media querys desired: this @media screen , (max-width: 600px) { input { width:100%; }} this media query change attributes input when viewport width under 600px. try

android - Listview with custom adapter overwriting data from my post -

i new java , android. using custom adapter fill list_view , got overwritten, , don't know should do. searching on web found "linkedhashset", don't know how use it. adapter class public class osfuncionariolistadapter extends arrayadapter<osfuncionario> { private list<osfuncionario> itemlist; private context context; public osfuncionariolistadapter(list<osfuncionario> itemlist, context ctx) { super(ctx,android.r.layout.simple_list_item_1, itemlist); this.itemlist = itemlist; this.context = ctx; } public int getcount() { if (itemlist != null) return itemlist.size(); return 0; } public osfuncionario getitem(int position) { if (itemlist != null) return itemlist.get(position); return null; } public long getitemid(int position) { if (iteml...

c# - send SignalR client message from background thread -

i'm trying track progress of hangfire background jobs guided article http://docs.hangfire.io/en/latest/background-processing/tracking-progress.html unfortunately example given in article not working. downloaded , run sample web application ( https://github.com/hangfireio/hangfire.highlighter ) locally. it's ok when client subscribes after job complete. in case message sent directly hub , has been received client. otherwise message call invoked hangfire job , nothing happens. no exceptions, no result. causing behavior? in case: hangfire jobs not work asynchronously... code sample: hangfire job (see highlight method) using system; using system.collections.generic; using system.net.http; using system.threading.tasks; using hangfire.highlighter.hubs; using hangfire.highlighter.models; using microsoft.aspnet.signalr; namespace hangfire.highlighter.jobs { public class snippethighlighter : idisposable { private readonly ihubcontext _hubcontext; pri...

Javascript event register can not be remembered under Android Browser -

i meet strange question javascript event register. test file "test.html" is: <html> <body> <input type="button" id="button" value='button' /> <script> alert('here'); document.getelementbyid('button').onclick = function () {alert('here1');} </script> </body> </html> i open web browser blank page, such "about:blank", go "test.html", hit web browser "go back" button "blank" page, hit "go foward" "test.html" again. ie , firefox: after "go back" , "go forward", alter('here') not show, button can work fine. (i think ok.) chrome (pc): after "go back" , "go forward", alter('here') show, , button can work fine. android browser: after "go back" , "go forward", alter('here') not show, , button can not work. (i use default int...

php - Count results rows -

i have results that: all results , results ranking list query: $results = $mysqli->query(" select tv.*, (@rn := @rn + 1) ranking (select liige_v.liige_id, liige_v.eesnimi, liige_v.perekonnanimi, punktid, sum(punktid) punktidkokku tulemus inner join liige_v on tulemus.liige_id = liige_v.liige_id group tulemus.liige_id ) tv cross join (select @rn := 0) vars order punktidkokku desc; "); table: print '<table class="mytable4">'; echo "<tr><th>koht </th><th>liikme nimi </th><th> count results</th><th>punktid</th></tr>"; while($row = $results->fetch_array()) { print '<tr>'; print '<td>' .$row["ranking"].'</td>'; print '<td>'.$row["eesnimi"].' '.$row["perekonnanimi"].'</td>'; print '...

How to use the net module from Node.js with browserify? -

i want use net module node.js on client side (in browser): var net = require('net'); so looked how node.js modules client, , browserify seems answer. tried jquery , worked charm. reason net module not want work. if write require('jquery') works fine, if write require('net') not work, meaning bundled .js file empty. i tried search else, thing found net-browserify on github . this, @ least bundle.js file filled, javascript error using (it has connect function). this code works on server side fine: var net = require('net-browserify'); //or var net = require('net'); var client = new net.socket(); client.connect({port:25003}, function() { console.log('connected'); client.write('hello, server! love, client.'); }); client.on('data', function(data) { console.log('received: ' + data); client.destroy(); // kill client after server's response }); client.on('close', function() ...

Access variable in require'd ruby code -

this question has answer here: how share variables across .rb files? 3 answers what's scope of variable in piece of code has been require 'd? e.g. have piece of code in file called users.rb : users = ... and line not in class or in method. require file. e.g. in app.rb require './users.rb' what's scope of variable ( users ) , how access it? variables start lower case letter local variables . local variables called local variables because local scope defined in , cannot accessed different scope. what's scope of variable in piece of code has been require 'd? in particular case, scope script body of users.rb . how access it? you can't. that's whole purpose of local variables.

php - Ajax favorite/unfavorite button -

i'm trying implement ajax on favourite/unfavourite button. idea behind when click star changes yellow , when click again, changes grey , on. adds , deletes data db. before had this <?php include("classes/event.class.php"); $m = new event(); $arrayallevents = $m->getnonfavo(); $arrayfavorites = $m->getfavo(); $db = new db(); while ($row = mysqli_fetch_assoc($arrayfavorites)) { $unfavoriteid = $row['f_id']; $uid = $_session['u_id']; } if(isset($_post['favorite_row'])) { $uid = $_session['u_id']; $fid = $_post['id_to_be_favo']; if(!mysqli_query($db->conn, "insert favorites (u_id, n_id, f_boolean) values ('". $db->conn->real_escape_string($uid) ."' , '". $db->conn->real_escape_string($fid) ."' , '". $db->conn->real_escape_string("1") ."')")) { echo mysqli_error($db->co...

sml - Wildcards in Standard ML -

i came across following function in ml working programmer : fun null [] = true | null (_::_) = false 1) can't both wildcards empty lists? if not, how ml prevent this? 2) function shortened be: fun null [] = true | false why / why not? thanks help, bclayman yes, can, matched list won't empty, result of null function holds, i.e., [] :: [] , equivalent [[]] , not empty list. no, that's syntactically invalid. however, can shortened this: fun null [] = true | null _ = false