Posts

Showing posts from January, 2015

draggable - kineticjs mouseover/out not working with jquery drag -

when dragging dom object onto canvas enable hover mode drop target, being element of canvas. in example when drag button on wedge mouseover event not fired. works if drag on wedge e.g. http://jsfiddle.net/z3yp8/1 var stage = new kinetic.stage({ container: 'canvas', width: 578, height: 200 }); var layer = new kinetic.layer(); var wedge = new kinetic.wedge({ x: 150, y: 120, radius: 100, angle: 60, fill: 'red', stroke: 'black', strokewidth: 4, rotation: -120 }) .on('mouseover', function(){ console.log('over wedge'); }) .on('mouseout', function(){ console.log('out wedge'); }); layer.add(wedge); stage.add(layer); $('#button').draggable({ cancel:false, helper: function(){ var _clone = $(this).clone().appendto($('#container')); return _clone; } }) stephen so rea...

java - menuitem.getmenuinfo() returns null for dynamically created views -

i have scrollview embedded relativelayout embedded linearlayout . <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:paddingleft="16dp" android:paddingright="16dp" android:id="@+id/relativelayout"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/today" android:layout_alignparentleft="true" android:id="@+id/linearl...

java - How to create a MAP that has an application scope? And Where to declare it? -

i need create map has application scope. , so, if user1 add map object using method1 of class1, user2 find new objects using method2 of class2. i know there annotation : @applicationscoped but, don't know map should declared or used, make have same state @ anytime , anywhere in application deployment time. an example representing class map declared , method of class using it, helpful. declare cdi bean provide map consumption: @named @applicationscoped public class applicationscopedbean { private map<keyclass, valueclass> map; @postconstruct public void init() { //initialize map , data here map = new concurrenthashmap<>(); map.put(..., ...); //... } //provide getter map public map<keyclass, valueclass> getmap() { return this.map; } } now, bean can injected in clients , can show data in view.

SNMP4J Agent and Net-SNMP "client" -

i'm still learning snmp, gentle please. i did agent snmp4j , seems working, have scalar should register how time has passed since agent started. i have agent, see value of scalar net-snmp. the problem is, when start agent set scalar systemuptime 0, try update systemuptime everytime tries check net-snmp value doesnt change. how can agent update systemuptime everytime tries access it? have method moscalar getsystemuptime since updates systemuptime before returning , thought job, not working. what u guys sugest? edit ( agent code, ive taken off of mandatory methods short thing bit ) public class agent extends baseagent { // not needed useful of course static { logfactory.setlogfactory(new log4jlogfactory()); } static long starttime=0; private string address; static oid oid= new oid(".1.3.6.1.4.1.1.1.0"); public static moscalar sysuptime; private static mofactory mofactory = defaultmofactory.getinsta...

r - How to find the nth lowest value without sorting -

i have data set values multiple cities in each state. third (for example) lowest value in each state, , return name of city. i can lowest value in each state with: tapply(df2[,11],df2$state, min ) but how nth lowest (and return city name)? data in column 11, state in column 7 (with header "state"), city name in column 2. try example: #dummy data df <- data.frame( state=paste0("state",sort(rep(1:2,10))), city=rep(paste0("city",rep(1:10,2))), value=runif(n=20)) #get rank per state df$rank <- ave(df$value, df$state, fun = rank) #subset 3rd lowest per state df[df$rank==3,] edit: as pointed out arun, partial sort solution, using data.table package: library(data.table) dt <- data.table(df) dt[dt[, .i[value == sort(value, partial=3l)[3l]], by=state]$v1]

Vector losing contents between files in C++ -

i have methods in lexer.h make use of vector made of tokens. in method void getnexttoken() making use of said vector adding new tokens it. the problem is, when go different file, trying access method makes use of vector, crashing out of bounds error (most it's being deferenced or something) is there way how can fix this? the methods in concern are: token* nexttoken() { if (it!= tokensused.end()) { // assigned found in iterator (of vector) // data found in pointer itrtoken = &*it; //move iterator forward ++; return itrtoken; } } /* used in parser go previous tokens */ token* prevtoken() { itrtoken --; if (it!= tokensused.begin()) { itrtoken = &*this->it; return itrtoken; } } void getnexttoken() { //code adding tokens //example if (ch == '"') ...

dom - How to modify style to a link in JavaScript? -

how can make text in div (the content of variable name) become link? in other words: change style "a" without using jquery. var newtit=document.createelement('div'); newtit.id=name; // name variable newtit.innerhtml= name; document.getelementbyid("w3c").appendchild(newtit); just did div, instead of creating div, create anchor element. add link want href-attribute. var newtit=document.createelement('a'); newtit.href = "http://www.google.com" newtit.innerhtml= "linkylink"; document.getelementbyid("w3c").appendchild(newtit); based on content, first create div append anchor element it var tab = document.createelement("div"); tab.id = "tabx"; document.getelementbyid("w3c").appendchild("tab"); var link = document.createelement("a"); link.href = "#tabx"; link.innertext = "tab xx"; document.getelementbyid("tabx").appendchild(...

java - Why must Lucene Token Filter classes be declared "final"? -

according solr's blog , lucene requires tokenfilter subclasses must declared final. advantage of final classes in context? makes impossible extend functionality of existing tokenfilter. tokenfilter extends tokenstream , , javadoc says: the tokenstream -api in lucene based on decorator pattern. therefore non-abstract subclasses must final or have @ least final implementation of incrementtoken() ! checked when java assertions enabled. for example, standardfilter not marked final (only incrementtoken() is). so if want extend existing tokenfilter it's best via delegation.

Building with Grunt and Requirejs -

i creating grunt task building javascript project requirejs using grunt-contrib-requirejs https://github.com/gruntjs/grunt-contrib-requirejs here config: requirejs: compile: options: #appdir: './' baseurl: "client" mainconfigfile: "client/main.js" name: "main" out: "build/main.js" wrap: start: "" end: "" the main.js file requires 2 other files inside subdirectories. althrough task not throw errors, resulting built file not run browser. files seem concatenated since require calls still exist in built file. expect js files called require substitute require calls, , optimized. how can achieve that? ps: config above written in coffeescript. if want compiled javascript file not contain , require() or define() calls can use amdclean npm package , simple add options object: onmodulebundlecomplete: func...

How to convert a string to an array of chars in ruby? -

let's have string "hello" , want array of chars in return ["h", "e", "l", "l", "o"] . although it's simple question couldn't find direct answer. there several ways array out of string. #chars shortcut thestring.each_char.to_a direct in opinion >> "hello".chars => ["h", "e", "l", "l", "o"] the other ways same result "hello".split(//) less intention-revealing.

c# - JScript runtime error when downloading file from server -

i have button on aspx, when clicked, calls method download jpeg file server. jpeg file chart created infragistic. my current download method this: private void download(string pimagen) { context.response.clearcontent(); context.response.clear(); context.response.contenttype = "application/jpeg"; context.response.addheader("content-disposition", "attachment; filename =" + pimagen); context.response.flush(); context.response.transmitfile(configurationmanager.appsettings["uploadpath"] + pimagen); context.response.end(); } but after method executed, jsruntime error pops up: microsoft jscript runtime error: system error: -1072896748. the error located in file called "ig_shared.js" in method: this._doresponse = function(cb) { var request = cb.request; if(!request || request.readystate != 4) return false; var txt = request.responsetext, sep = ...

javascript - HTML&CSS Change Date Formatting On Whole Web Page -

i working on portlet used multiple users throughout world, therefore change basic date format of on html page default dd/mmm/yy where mmm abbreviation because default confusing depending of country (aka usa or somewhere else) aka 05/05/2014 should show 05/may/14 , 06/08/2015 should show 06/aug/15 since of dates need written way, maybe it's line of code in css or html file? looked around , couldn't find abbreviated dates, therefore i'd rather directly ask professionals. i wrap dates in <time> element , use javascript convert local date format . html: published <time datetime="2011-07-03">07/03</time> js: var elements = document.getelementsbytagname("time"); (var i=0; i<elements.length; i++) { var dat = new date('utc:'+elements[i].getattribute('datetime')); elements[i].innerhtml = dat.tolocaledatestring(); } http://jsfiddle.net/mblase75/7yf5v/

c# - Calling PrincipalContext.ValidateCredentials with incorrect credentials locks account -

i found following code validate nt domain users, if incorrect password entered many times, account locked out. is there api call not lockout users if incorrect passwords entered? of course, assuming no change current lockout policy. using (principalcontext context = new principalcontext(contexttype.domain, domain)) { return context.validatecredentials(username, password); }

c - Float to string -

there has got easier way this. trying cast group of int , floats char combine them single char. not building string str anticipated. written in c. char *str_w1; char *str_w2; char *str_w3; char *str_w4; char *str_w5; char *str_w6; char *str_vbat; char *str_day; char *str_month; char *str_year; char *str_hour; char *str_minute; sprintf(str_day, "%d", time.day); //casting int string sprintf(str_month, "%d", time.month); //casting int string sprintf(str_year, "%d", time.year); //casting int string sprintf(str_hour, "%d", time.hour); //casting int string sprintf(str_minute, "%d", time.minute); //casting int string sprintf(str_w1, "%.2f", value_w1); //casting float string sprintf(str_w2, "%.2f", value_w2); //casting float string sprintf(str_w3, "%.2f", value_w3); //casting float string sprintf(str_w4, "%.2f", value_w4); //casting float string sprintf(str_w5...

An unset C pointer is not null -

i messing around c pointers. when compile , run following code. example 1: #include <stdio.h> int main() { int k; int *ptr; k = 555; if (ptr == null) { printf("ptr null\n"); } else { printf("ptr not null\n"); printf("ptr value %d\n", *ptr); } printf("ptr address %p\n", ptr); } i output: ptr not null ptr value 1 ptr address 0x7fff801ace30 if don't assign value k: example 2: #include <stdio.h> int main() { int k; int *ptr; if (ptr == null) { printf("ptr null\n"); } else { printf("ptr not null\n"); printf("ptr value %d\n", *ptr); } printf("ptr address %p\n", ptr); } then output expect: ptr null ptr address (nil) similarly if define variables outside function: example 3: #include <stdio.h> int k; int *ptr; int main() { k = 555; if (ptr == null) { ...

java - How do I get a bitmap from AsyncTask and set it to my image -

i trying use asynctask convert image url bitmap in order set image. don't understand how bitmap out of asynctask can set images creating in loop. have tried set bitmap image inside asynctask. understanding must done inside asynctask unable reference images want set value for. i have researched url bitmap conversion , asynctask can't figure out how combine them want. has common task. why difficult? how reference images in asynctask? can return bitmap , set image outside of asynctask? is there easier way set url image source? i have included have far. thank , taking time read this. class bitmaptaks extends asynctask<string, void, bitmap> { public bitmap doinbackground(string... urls) { bitmap bm = null; try { url aurl = new url(urls[0]); urlconnection conn = aurl.openconnection(); conn.connect(); inputstream = conn.getinputstream(); bufferedinputstream bis = new bufferedinputstrea...

java - How can I create an android service that dalvik will not kill? -

before begin question, want preface with: know it's bad idea force service run forever... not care. this application not consumer use. not going on app store. use only. alright, have unused htc sensation running 4.0.3 (ics) sitting around, , have volunteered local theatre task. task ring on cue whenever needed in show. don't want sim card in because might accidentally call phone during show when not supposed ring. so created fake phone application receives signal via tcp server have set send signals devices on lan. right have listener running in infinite loop in service. am, however, still experiencing service not responding tcp signals. i appreciated if android guru's give me hints/tips making service reliable possible, good/bad coding techniques aside want possible make service unkillable. phone has 1 job now, , listening incoming messages, no matter what. things have done far: created service (and launched separate thread service) used startforeground(id,...

ruby on rails - ActionView::Template::Error (no implicit conversion of nil into String) -

i've never gotten error before, , not sure how rid of it. actionview::template::error (no implicit conversion of nil string) ... 24: <p>genre:<%= link_to @movie.genre, "movies?genre=" + @movie.genre.to_s %></p> .... app/views/movies/show.html.erb:24:in `+' you need able handle possible nil values. change code : <p>genre:<%= link_to @movie.try(:genre), "movies?genre=" + @movie.try(:genre) %></p> since entire link depends on having genre, : <p>genre:<%= link_to @movie.try(:genre), "movies?genre=" + @movie.try(:genre) if @movie.genre %></p>

apache - Port 80 open on server but cannot connect to it -

i have issue have been trying resolve cannot figure out going on. have various web servers , have apache installed on them. on same network 1 giving me issue. i have servers (.44, .45 , .46) i can ssh .44 , ping .45 , .46 no issues. when try test , see if port 80 open, .45 gives me message. someadminuser@somelocation:/var/www$ telnet 10.0.0.45 80 trying 10.0.0.45... telnet: unable connect remote host: connection refused here same test on .46 someadminuser@somelocation:/var/www$ telnet 10.0.0.46 80 trying 10.0.0.46... connected 10.0.0.46. escape character '^]'. so ssh .45 see port. someadminuser@somelocation:~$ netstat -tulpn | grep :80 (no info read "-p": geteuid()=1000 should root.) tcp 0 0 0.0.0.0:80 0.0.0.0:* listen someadminuser@somelocation:~$ sudo iptables -l chain input (policy accept) target prot opt source destination accept tcp -- anywhere a...

javascript - json_encode on a PHP array returns a string -

i've searched through site , can't see question quite mine hope isn't copy. so i've got php script supposed return json array ajax, , want use array generate url. however, though i'm pretty sure i've got array on php end, when json_encode i'm getting simple string out on other end. php code: $n = 10; $all_titles = array(); while($row = mysqli_fetch_array($result)) { $title = trim($row['job title']); if(array_key_exists($title, $all_titles)) { ++$all_titles[$title]; } else { $all_titles[$title] = 1; } } arsort($all_titles); $top_titles = array_slice($all_titles, 0, $n); $title_list = array(); foreach (array_values($top_titles) $key => $val) { array_push($title_list, array_keys($top_titles)[$key]); } echo json_encode($title_list); these array operations seem working far, based on other tests i've done, i'm pretty sure $tit...

python - Reshape list of lists based on position of the element -

this question has answer here: transpose matrix in python [closed] 3 answers i have list of lists looks this; [[4, 0, 1], [0, 0, 1], [0, 1, 2], [1, 1, 0], [2, 0, 0]] which efficient way 3 lists above list based on position of element? result: [4,0,0,1,2] [0,0,1,1,0] [1,1,2,0,0] you can use zip , list comprehension : >>> lst = [[4, 0, 1], [0, 0, 1], [0, 1, 2], [1, 1, 0], [2, 0, 0]] >>> [list(x) x in zip(*lst)] [[4, 0, 0, 1, 2], [0, 0, 1, 1, 0], [1, 1, 2, 0, 0]] >>> placing * before lst unpacks list arguments zip function. in case: zip(*lst) is equivalent writing: zip([4, 0, 1], [0, 0, 1], [0, 1, 2], [1, 1, 0], [2, 0, 0]) zip zips these lists returning iterator of tuples n-th tuple contains n-th item each of lists. in case, returns: 1 >>> list(zip(*lst)) [(4, 0, 0, 1, 2), (0, 0, 1, 1, 0), (1, 1, ...

android - Attaching code to user turning on screen -

i'm trying work piece of code works when user turns on screen, event or piece of code called , ran. needs work when screen goes sleep , should have cancel feature stop occuring @ users command. suggest ideas on how code in android if want when activity become foreground or background can override onwindowfocuschanged , public void onwindowfocuschanged(boolean hasfocus){ if(hasfocus){ //activity become foreground } else{ //activity become background } } if want based on screen state, regardless of applications activity visible or not need use broadcastreceiver still need service or activity running on background check out question android: broadcast receiver screen on , screen off

html - Inline input fields behave differently in browsers -

i have quantity selector on webpage. used trick make them inline without gaps. <div id="quantitybar"> <span class="inputwrapper"> <button id="piece_plus">+</button> <input type="text" value="1" id="pieces" /> <button id="piece_minus">-</button> </span> <input type="submit" value="add cart" /> </div> here's fiddle: http://jsfiddle.net/86sz7/ it looks nice in chrome, in firefox bottom border of text imput field missing piece. if set overflow: hidden span looks ok, submit button shifted down. want make same in chrome , firefox. plus: nice have submit button align other inputs too, because it's little off.

c# - WPF - How can I create menu and submenus using binding -

Image
i trying create dynamic menu using binding. viewmodel have list of objects contains header , command. however, not working. think problem in data template. see code below: <menu background="{x:null}" grid.row="0" grid.column="1" panel.zindex="2" width="865" height="85" horizontalalignment="left" itemssource="{binding path=menuitems}"> <menu.itemtemplate> <hierarchicaldatatemplate datatype="menuitemviewmodel" itemssource="{binding path=menuitems}"> <menuitem header="{binding header}" style="{dynamicresource menuitemstyle1}" itemssource="{binding path=menuitems}" padding="10,12,10,0" height="44.1" margin="30,0,0,0" fontweight="bold"> <menuitem.itemspanel> <itemspaneltemplate> ...

xml - Replace string using XSL 1.0 -

i'm having problems replacing string within string using xsl 1.0. i've read various threads on site , others can't put finger on why method not work. purposes of question i've dumbed down data little you'll jist, hopefully. so, i've got xml: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="replaceastring.xsl"?> <body> <astring>texttoreplace</astring> </body> and xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://w3.org/1999/xsl/transform"> <xsl:template match="/"> <h1> <xsl:value-of select="$myvar"/> </h1> </xsl:template> <xsl:variable name="myvar"> <xsl:call-template name="string-replace-all"> <xsl:with-param name="text" select="body/astring/" /> <xsl:with-param name=...

javascript - Ember 'needs' property doesn't work unless you visit the needed controllers route first -

i've come across either issue ember's 'needs' controller property or don't understand proper way achieve goal. the goal able have access 1 or more controller's content controller. so example have route accounts need have access contents of bank accounts , credit accounts may display accounts :) the problem content alway empty controllers unless visit bank , credit account routes first! here's jsbin illustrating problem: http://jsbin.com/yubul/1/edit?html,js,output a controller has it's model automatically populated when visit route needing it. controllers can exist without models. needs should happen upstream, not sibling resources/routes. if resource depends on another, should part of nesting structure, or fetched @ same time. this.resource('accounts', function(){ this.resource('bank-accounts'); ..... }); generally in use case don't want nested route, want multiple resources return multiple resour...

android - Setting an imageview of UI from another class with Asynctask? -

how can set image in ui class running asynctask image (bitmap) url? think can use asynctask.get() in ui when thread finishes think not best way, here code of activity , class dowload image: public class recipe extends activity { private imageview image; private static final string baseurl = "http://x/images/"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.recipe_activity); intent = getintent(); getrecipe getr = new getrecipe(i.getstringextra("id")); getr.getid(); textview title = (textview) findviewbyid(r.id.tvrecipetitle); title.settext(getr.getname()); textview description = (textview) findviewbyid(r.id.tvrecipedescription); description.settext(getr.getdescription()); string imageurl = getr.getimage(); log.d("recipe", "setting image"); image = (imag...

puphpet - Reload config apache with puppet in vagrant -

i set vagrant machine https://puphpet.com/# . everything ok until wanted change documentroot apache vhost:docroot in config.yaml this change not reloaded although run : vagrant --provision reload just run $ vagrant provision , no need reload.

css - Automatic email with HTML formatting -

i've been trying figure out if possible me set automatic reply sends out html formatted email. need send out fancy looking "we'll shortly" images , links. have html code me (with headers , inline css), have no way format body of email response html. any ideas on how can done? i'm using outlook web app. thanks you can use library swiftmailer http://swiftmailer.org/

php - phpMailer Failing Authentication -

i've set automated email delivers message user. nslookup this nslookup details domain: sballiance.co.uk name server ns2.mainnameserver.com. sballiance.co.uk mail handled 0 sballiance-co-uk.mail.protection.outlook.com. sballiance.co.uk descriptive text "v=spf1 include:spf.protection.outlook.com -all" sballiance.co.uk has address 176.32.230.12 sballiance.co.uk descriptive text "ms=ms71078976" sballiance.co.uk has soa record ns.mainnameserver.com. hostmaster.mainnameserver.com. 2014032747 86400 604800 2419200 10800 sballiance.co.uk name server ns.mainnameserver.com. phpmailer setup here important details phpmailer setup: public $host = 'sballiance-co-uk.mail.protection.outlook.com'; public $port = 465; //i've kept default(?) public $smtpsecure = ''; public $smtpauth = true; //default false public $username = 'no-reply@sballiance.co.uk'; public $password = '%password%'; //this ...

objective c - How to Detect If User is Traveling on a Particular Road in iOS? -

are there frameworks/apis see if user traveling on particular road (whose coordinates known) in background? my usecase this. when user traveling in particular road, want send him custom notifications. the closest thing can think of clregion. clregion circular geofence create, , ask system monitor you. system wake app , send messages when user enters region. i don't know of way create region polyline however. for short roads set series of regions. however, believe there pretty small limit on total number of active regions (the limit 20 beacon regions, , might same "regular" clregions. don't remember off top of head.)

javascript - Which segment of a polyline was clicked? -

i have set sample polyline 5 segments , , i'm allowing new markers created when user clicks on polyline. i'd know if there's foolproof way determine whether new marker between markers 0 , 1, or 1 , 2 ... or between 4 , 5. i've considered checking if new marker inside bounding box, , point-in-line formulas, neither 100% precise. as google maps uses mercator projection projecting gps coordinates, can't use 'line equation' gps coordinates, because projection not linear gps points.but instead can use world coordinates linear. here have used parametric form of line equation check whether point on segment: function ispointonsegment( map, gpspoint1, gpspoint2, gpspoint ){ var p1 = map.getprojection().fromlatlngtopoint( gpspoint1 ); var p2 = map.getprojection().fromlatlngtopoint( gpspoint2 ); var p = map.getprojection().fromlatlngtopoint( gpspoint ); var t_x; var t_y; //parametric form of line equation is: //-...

python - GNU Parallel to replace piping xargs -n 1 -

i have python script operates on list of state abbreviations single argument, , text file contains state abbreviation strings. the normal call is... $ mypy.py "ak" ...to run script on alaska. i'm using following run script on each state abbreviation taken statelist.txt file: $ cat statelist.txt | xargs -n 1 ./mypy.py i parallelize execution, , gnu parallels looks right option. saw from here should syntax replacing xargs -n1 : $ find . -name '*.html' | parallel gzip --best so, attempts were $ cat statelist.txt | parallel python mypy.py and $ cat statelist.txt | parallel python mypy.py {} but both of these returning: /bin/bash: mypy.py: command not found traceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'ak' not defined it seems passing in unquoted perhaps? when add quotes '{}' passes in literal "{}". cat statelist.txt | parallel --gnu p...

java - how to put "case" into loop -

here fragment code of program simulate solar system. depending on user write in "amountfield", "number" of planets change, , combobox "listofplanet". , here problem. found out how "resize" combobox have no idea how make case "x" depend on "number". u see had manually write 12 cases. amountfield = new jtextfield(6); actionlistener amountlistener = new actionlistener() { public void actionperformed(actionevent e) { string amountdata = amountfield.gettext(); number = integer.parseint(amountdata); listofplanet.removeallitems(); for(int = 0; i<number; i++) { listofplanet.additem("planeta" + i); } b = new ball(leftmainpanel); } }; amountfield.addactionlistener(amountlistener); rightuppanel.add(amountfield); ...

javascript - Node.js - How can I use my local variable with EJS view -

i try used local variable on ejs. it's varaiable check if user connected. -> last post on link: how know if user logged in passport.js? so, app.js app.use(function (req, res, next) { res.locals.login = req.isauthenticated(); next(); }); view ejs <% if (login) { %> <div id="submenuuser"> <div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> </span>menu<span class="caret"></span> </button> <ul class="dropdown-menu pull-right" role="menu"> <li><a href="#" role="menuitem">menu item 1</a></li> <li><a href="#" role="menuitem">menu item 2</a></li> <li><a href="#" role="menuitem...

css - Position absolute is not within the relative parent -

for whatever reason, simplest of styling fails work @ point. ff31.0.1 works fine, chrome works fine, ie11 works fine, ff29.0.1 refuses acknowledge simple style. see example: http://twitchplayspokemon.org/ next larger images, there should smaller sprites next them. people reporting cases this: http://i.imgur.com/1q2qmpf.png the <td> contains both images styled position: relative; whilst second image position: absolute; bottom: 0; right: 0; . why not work? you should not use css position property table cells. i'd suggest either not using tables or not depending on relative positioning. another option fill table cell relatively positioned <div/> tag can work absolutely positioned child elements.

python - Separate odd and even numbers into different output files -

i'm trying separate odd , numbers 1 input file , output 2 different files (one odd numbers , other numbers). i have never done that. how go this? have run twice have different output files? this how it: import numpy np = np.loadtxt("test.txt") odd = [] = [] ele in a: if ele % 2 == 0: even.append(ele) else: odd.append(ele) first read file using a = np.loadtxt("test.txt") , sort contents 2 arrays even , odd , finaly save files using np.savetxt("odd.txt", odd) , np.savetxt("even.txt", even) edit: suggested jonrsharpe more efficiently follows: import numpy np = np.loadtxt("test.txt") np.savetxt("odd.txt", a[a%2==1]) np.savetxt("even.txt", a[a%2==0])

Case insensitive standard string comparison in C++ -

this question has answer here: case-insensitive string comparison in c++ 29 answers case insensitive string comparison c++ [duplicate] 6 answers void main() { std::string str1 = "abracadabra"; std::string str2 = "abracadabra"; if (!str1.compare(str2)) { cout << "compares" } } how can make work? bascially make above case insensitive. related question googled , here http://msdn.microsoft.com/en-us/library/zkcaxw5y.aspx there case insensitive method string::compare(str1, str2, bool). question how related way doing. you can create predicate function , use in std::equals perform comparison: bool icompare_pred(unsigned char a, unsigned char b) { return std::tolower(a) == std::tolower(b); } bool ico...

OpenCV in python on mac installation with homebrew -

i'm trying opencv python on mac running mavericks. after googling/stack overflow seraching tried: brew install homebrew/science/opencv based on terminal output looks worked. to verify wrote python script contains: import cv2 print("hello") i no module named cv2 . when try looking @ installed modules typing help('modules') don't see cv or cv2. leaves me 2 conclusions: either didn't install opencv or import cv2 isn't importing cv2 , python looking in wrong location cv2. suggestions appreciated. according guide , if add following .bash_profile should fix issue: export pythonpath=/usr/local/lib/python2.7/site-packages:$pythonpath

C# Extension Method Ambiguity: Is the class being extended not part of the signature? -

i having ambiguity problems extension methods. have several similar classes, , each has extension method called "toentity." if more 1 of these extension methods brought scope, compiler doesn't know use, though seems able discern checking extended class trying use it. apparently not case, perhaps i've done wrong? example: // these classes both have toentity() extension methods return myentity myextendedclass1 model1 = new myextendedclass1(); myextendedclass2 model2 = new myextendedclass2(); myentity myentity1 = model1.toentity(); // ambiguous... why? for last few months i've taken shortcut around calling 1 of methods "toentity2()" super lame, i'm adding more classes need have toentity() extension. i'm refactoring , hoping find better way. guess explicit questions are: why these methods ambiguous instead of being differentiated class extend? options work-around? update: extension methods defined this: public static class myexte...

r - Get maximum and minimum values for input$variable Shiny RStudio -

my name nate , trying build little data analysis tool using shiny rstudio. right using own data, values numeric...let's pretend using mtcars dataset comes r. i to: 1. allow user select numeric variable dataframe via drop down menu have computer calculate minimum , maximum values said variable allow user input number between 1 , 50 slider input divide difference between maximum , minimum of first variable value obtained slider input the first error got was: 1. non-numeric argument binary operator so tried coerce variable using as.numeric(), led second error: nas introduced coercion putting print(max(input$var) line in server.r file gives me variable name instead of number. any appreciated. have posted part of ui.r , server.r files below. thank in advance. ui.r: library(shiny) load('mtcars') shinyui(pagewithsidebar( headerpanel("mtcars interactive analysis tool"), sidebarpanel( selectinput(inputid = "histvar", label= ...

c++ - double free or corruption when implement binary tree -

update: add more code asked.pasted end of question. stops. current code fine delete leaf, come root, can not delete. ==== update: revise code, change removerootmatch to tmp = root; root = tmp->right; tmp->right = null; delete tmp; and no error not delete node. ===== the program simple following step: find min value of binary tree; record min value in vector; delete node min value in tree; repeat 1-3 till tree empty. i have removenode()function, call removeroot function(check code below),if 1 needed removed root. have trouble function. doing debug , found wrong removerootmatch function. give error when run. error got error got *** glibc detected *** ./bintree: double free or corruption (fasttop): 0x0000000000727060 *** , 1 can me? the tree defined following, language c++ typedef struct mynode* lpnode; typedef struct mynode node; struct mynode { double key; lpnode left; //left subtree lpnode right; //right subtree }; main part of program f...

jquery - HTML5 History API just full load from index page -

im trying implement in java mvc (using vraptor) history api, if click in link /index, load content in #content div (its ok) but when type /content1 , press enter in url bar, display content1, without menu this pages test, in real env use .js file: index.jsp(access /index) <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <div id="container"> <div id="menu"></div> <div id="content"></div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></scr...

javascript - Is there a way of showing/indicating an updated tab from an extension/background page? -

i'm looking behaviour similar pinned gmail tabs, tab head blinks when there's new email , tab not in focus. chrome.windows.update(..) has 'drawattention' option. chrome.tabs.update(..) has 'active' , 'highlight' options. i couldn't locate method of indicating updated tab in active window without switching it/or highlighting (which seems have similar behaviour active). i'm afraid highlighting far tabs api goes. you use content script show annoying animated favicon until tab gets visible possible workaround.

javascript - What is really happening when I call a function? -

this might simple question i've been thinking lately. i've tried researching answer have yet find satisfactory one. basically, what's happening behind scene when call function? say:- function sayhello(){ console.log('hello'); } sayhello(); //what's happening here? i know doing sayhello.call(); or sayhello.apply(); same thing doing sayhello(); there more information on what's happening underneath or behind mysterious native code? here of things interpreter make js function call: a new scope object created. arguments object created , put scope object arguments passed function in it. any local variables in new function put scope object. a reference next line of code pushed onto execution stack (so interpreter knows go when function returns). the pointer set appropriate. execution transferred code of function. this managed internals of js interpreter (one of many jobs) native code. if want call function b() anytime functio...

html - Issues with PHP contact form (won't send inquiries to my email) :( -

i'm having difficult time trying find error in php form. edited in every possible way , form submits on website, never in receipt of sent form email. kind on code below mail.php form? tia amanda <? require("class.phpmailer.php"); //form validation vars $formok = true; $errors = array(); //sumbission data $ipaddress = $_server['remote_addr']; $date = date('d/m/y'); $time = date('h:i:s'); //form data $name = $_post['name']; $email = $_post['email']; $subject = $_post['subject']; $message = $_post['message']; $mail = new phpmailer(); $mail->issmtp(); // send via smtp $mail->host = "smtp.gmail.com"; // smtp server $mail->smtpauth = true; // turn on smtp authentication $mail->smtpsecure = 'tls'; $mail->username = "dont.reply.m@gmail.com"; // sm...