Posts

Showing posts from April, 2013

android - EditText cursor resides after the hint -

Image
i have simple sign in activity in app email , password fields. there strange problem hint , cursor position in email edittext : as can seen in image, default, cursor isn't @ first position. shown after hint (as if hint input text) as far layout goes, password edittext same email one, doesn't have problem: anyone has clue why happens? , how can solve it? here's activity's layout: <scrollview android:id="@+id/login_form" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout style="@style/loginformcontainer" android:orientation="vertical" > <edittext android:id="@+id/email" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="left" android:hint="@string/prompt_email&

sql - Display salary, Avg(salary), Name for those who earns more than company Avg(salary) -

how display name, salary , avg(salary) employees salary greater company avg(salary). i have tried following query: select last_name, salary employees salary >(select avg(salary) employees); this gives names of employees getting higher salary company avg(salary). want display avg(salary) in select list aswell. join employee table query produces average: select last_name, salary, avg_salary employees join (select avg(salary) avg_salary employees) x on salary > avg_salary this query work on databases.

php - mysql - querying 2 tables in one query and creating the difference of the two results. -

i'm running 2 queries in php, take result of each create difference: $sec = 3600; $sql = "select sum(revenue) c revenue_log entry_date between (date_sub(now(), interval $secs second)) , (now())"; $res = $this->db->query($sql)->result_array(); $rev = $res[0]['c']; $sql = "select sum(cost) c cost_log entry_date between (date_sub(now(), interval $secs second)) , (now())"; $res = $this->db->query($sql)->result_array(); $cost = $res[0]['c']; $profit = $rev - $cost; is possible combine 1 query easily? how? you need run each query individually join them derived tables: select r,c, r-c difference ( select sum(revenue) r revenue_log entry_date between (date_sub(now(), interval $secs second)) , (now()) ) revenue join ( select sum(cost) c cost_log entry_date between (date_sub(now(), interval $secs second)) , (now()) ) cost;

winforms - is there any way to define a char or a text is unicode or not in c#? -

i want make auxiliary software myself. first software need know input text english or it's unicode text japanese or arabic or ... etc except english. need know there way define char or text unicode or not in c#? any tips appreciated. ------------------------- update question ... ------------------------- don't want use dictionary recognizing text's means. need define datatype between varchar , nvarchar sql server datatype . example if input in english characters a,b,c,...,z input varchar else nvarchar. ***my solution use switch case , search entire input text find character not in english ascii code if find letter, input type nvarchar is right solution? as matthew said, cannot built-in functions or method. however, if input text isn't big can iterate chars of word , find out if contains atleast single unicode character or not. private bool isunicode(string text) { char[] _chararray = text.tochararray(); bool _unicodeflag = false;

version control - recover GIT repository after HDD crash -

linux magrathea 3.6.11+ #474 preempt thu jun 13 17:14:42 bst 2013 armv6l gnu/linux on raspberry. works git server.repositories have no branches. i´m beginner git love it! i able recover data using fsck , found git objects in lost-found . after reading threads here did following: create new empty git repository: git init copy objects new repository .git/objects run git fsck --full no bad errors. but if try git log get fatal: bad default revision 'head' what next step? how reconnect last state? if try clone repository using: git clone git@magrathea:/gitroot/chorus . repository empty. i'm sorry i'm simple user of git. not known internal organization of git. please kind , provide me tips. you message when head refers doesn't exist. when git init , head attached master branch -- haven't committed revisions yet. thus: "bad default revision" here means " no " default revision. so @ .git/logs/refs/heads/

Unable to open Image in C++ SDL -

so im trying render image. code worked fine before refactored seperate classes cannot see problem. file path image worked before refactoring have not moved image should still in same place. the error getting "unable create texture surface. error: couldn't open images/text.bmp" im line of code below messing up. if (!(gtexture->loadfromfile("images/text.bmp"))) { return false; } here loadfromfile function code bool texture2d::loadfromfile(string path) { free(); sdl_texture* ptexture = null; sdl_surface* psurface = img_load(path.c_str()); if (psurface != null) { //sdl_setcolorkey(psurface, sdl_true, sdl_maprgb(psurface->format, 0, 0xff, 0xff)); ptexture = sdl_createtexturefromsurface(mrenderer, psurface); if (ptexture == null) { cout << "unable create texture surface. error: " << sdl_geterror() << endl; } mw

android - Does cordova webview run html5 faster than native webview? -

helo everybody, i'm new in android. did make search there topic told not much. have html5 game , made android use native webview hardware accelerate. run quite on bluestacks slow on lg optimus g 4.1. run little better on lg g2 4.2 laggy. heard cordova webview wrapper better features. tried day wrap , test face lot of errors. please tell me if cordova webview run html5 better speed? spend more time it. if doesnot, can suggest better way? thanks much, just different. cordova launches webview linked version , never changes until receive update. on other hand google navigator version depends on if have installed or not last version for example nexus4 in v30 , chrome app in v35 , faster v30.

bash - Why does my trap does not work? -

i have written below script: #!/bin/bash sleep 15 function_signalr() { date date | awk '{printf "%-15s\n", $2}' } trap "function_signalr" 10 when start process "process &" runs, pid given. kill -10 pid, trap not work. process killed, trap did not sprung. no date message given. grateful advice. your trap doesn't work because shell doesn't know yet. you need define trap function, set trap , write code. #!/bin/bash function_signalr() { date date | awk '{printf "%-15s\n", $2}' } trap "function_signalr" 10 # code follows sleep 15 moreover note sleep blocking implies if kill -10 pid trap wouldn't execute until sleep done.

Windows Batch: acessing variables from inside FOR loop -

im trying rather elementary thing in dos batch: @echo off set _sets=^ ro:111:rondonia,^ ac:112:acre,^ am:113:amazonas,^ rr:114:roraima set _family_name=myfamily %%i in (%_sets%) ( echo %%i ----- %_family_name% ) output: ro:111:rondonia ----- ac:112:acre ----- am:113:amazonas ----- rr:114:roraima ----- after ----- supposed appear "myfamily", instead nothing appears. how access variables set outside loop within it? have no idea why _family_name variable not visible inside loop. i'm new batch scripts. i'm used c++ , java programming, thinking not apply batch realm. i need split string triplets "aa:nnn:aaaaaa" 3 individual variables. tried come nested loop, couldn't tackle problem. the example made simple clarity. actual batch more complex that. have access 10-12 variables within loop. please consider aspect before answering. in advance. if _family_name being set within (outer) loop, you'll need enable delayed expa

algorithm - KeyError in Python Program but not in interpreter? -

Image
here program trying implement prims algorithm minimum spanning tree. problem when execute program whole shows keyerror : 7 : but when execute error causing portion in interpreter shows no error ? my code : edges = { 'a':{'d':1,'b':3}, 'b':{'a':3,'c':4}, 'c':{'b':4,'d':5,'a':2,'e':7}, 'd':{'a':1,'c':5,'e':6}, 'e':{'d':6,'c':7} } # here null represented -1 , infinity represented 1000 vertices = { 'a':[1000,-1], 'b':[1000,-1], 'c':[1000,-1], 'd':[1000,-1], 'e':[1000,-1] } def extractmin(): low = 'a' key in vertices.keys(): if vertices[low][0]>vertices[key][0]: low=key del vertices[low] return low vertices

php mysql database connection error -

i have following php code gets user login details html form: $con=mysqli_connect("host","user","pass","db"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $query = "select username users user='$_post[username]' limit1"; $result = mysql_query($query); echo result; but when run it, seem getting these errors: warning: mysql_query() [function.mysql-query]: can't connect local mysql server through socket '/directory omitted' (2) in /directory omitted on line 10 warning: mysql_query() [function.mysql-query]: link server not established in /directory omitted on line 10 can please out? much! you have mixed mysqli mysql there's lot of typos code should be: $con = mysqli_connect("host","user","pass","db"); // check connection if (mysqli_connect_errno()) {

c# - How clear two RichTextBox using CheckedListBox and button -

Image
can me, how can clear content inside richtextbox using 1 button where: checkedlistbox - select of rtb cleared? i have problem checkedlistbox - works 1 select position, not checked/marked. private void button1_click(object sender, eventargs e) { (int = 0; < checkedlistbox1.items.count; i++) { if (checkedlistbox1.getitemchecked(i)) { string str = (string)checkedlistbox1.items[i]; if(str == "rtb1") { richtextbox1.clear(); richtextbox1.focus(); } if(str == "rtb2") { richtextbox2.clear(); richtextbox2.focus(); } } }

javascript - google map api v3 - how to limit number of polygon lines and force closure at the 5 click? -

i have code <script> function initialize() { var mapoptions = { center: new google.maps.latlng(-34.397, 150.644), zoom: 8 }; var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); var drawingmanager = new google.maps.drawing.drawingmanager({ drawingmode: google.maps.drawing.overlaytype.marker, drawingcontrol: true, drawingcontroloptions: { position: google.maps.controlposition.top_center, drawingmodes: [ google.maps.drawing.overlaytype.polygon ] }, polygonoptions: { draggable: true, editable: true, strokecolor: "#000", strokeweight: "2" } }); drawingmanager.setmap(map); } google.maps.event.adddomlistener(window, 'load&

Compare Date with Current Date using SQL in MS Access 2013 -

i have table in ms access 2013. has column name expirydate having date values. need write query following condition expirydate greater current date. can tell me how can this? i'm supposing can use sql query : select * table_name expirydate > date()

javascript - d3 how to display text on mouseover in fixed div - not tooltip -

i using d3.js render heatmap of census block population on top of leaflet map. display information census block in fixed div right of map when mouse hovers on block. no matter do, information appears below map instead of right of map. new d3, , trying modify code relating number of tooltip examples have found. all of code below (sorry); however, relevant potions, think, css div.info , .on("mouseover" . . .) parts in reset() function. suggestions appreciated. <html> <head> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" /> </head> <style> svg { position: relative; } div.tooltip { /*position: absolute; (to make tooltip follow mouse in map, uncomment line)*/ text-align: center; width: 150px; height: 25px; padding: 2px; font-size: 10px; background: #ffffe0; border: 1px; border-radius: 8px;

html - Why won't my form display? -

i'm using bootstrap 3 bootswatch theme. here html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>title</title> <!-- bootstrap --> <link href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/flatly/bootstrap.min.css" rel="stylesheet"> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respond.js doesn't work if view page via file:// --> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head&

ios - Creating a swipe-able app intro screen -

i'm trying replicate effect done in this gif . i'm thinking done uipangesturerecognizer, i'm not sure. thanks! this can accomplished quite uipangesturerecognizer. use translationinview find out how user's finger moved by, , move view according finger movement. in example, self refers view controller, view1 view on top want drag. uipangesturerecognizer* pan = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(handlepan:)]; [self.view addgesturerecognizer:pan]; and handle it: -(void)handlepan:(uipangesturerecognizer*)sender { cgfloat xmovement = [sender translationinview:sender.view].x; // movement view1.frame = cgrectoffset(view1.frame, xmovement, 0); // reset translation [sender settranslation:cgpointzero inview:sender.view]; }

r - Colour of geom_hline is not correct in legend [ggplot2] -

Image
i've looked around on can't seem find solution. i've used geom_point , geom_hline in ggplot2 , have gotten satisfactory legends both. however, have 1 black line , 1 blue line in figure in legend both black - how can correct in legend right colors? mcgc <- ggplot(sam, aes(x = person,y = mm, colour = x)) + geom_point(size = 0.75) + scale_colour_gradient2(high="red", mid="green", limits=c(0,1), guide = "colourbar") + geom_hline(aes(yintercept = mad, linetype = "mad"), colour = "blue", size=0.75, show_guide = true) + geom_hline(aes(yintercept = mmad, linetype = "mmad"), colour = "black", size=0.75, show_guide = true) + facet_wrap(~ plan, scales = "free", ncol = 4) + scale_linetype_manual(name = "plan of health care", values = c("mad" = 1, "mmad" = 1),g

c# - Function with 2 different generic objects -

i´m trying following: i have class virtual method this: public virtual event<t> execute<t>(t message) and that´s want: event t can different of t message. example: need function this: public override event<bitmap> execute(string message) but of course, following error "no suitable method found override". is there way this? use 2 types of generic objects using override? note: can change virtual method, other classes have inherit one. thank you! you don't need override it, override used change method inherited class. if understood correctly want overload method, omit override , type virtual instead. public virtual event<bitmap> execute(string message) when call function compiler choose appropriate method in dependence of number/types of values have passed method.

html - CSS transition fade out using opacity is not working -

i trying have div on hover image fades out (so can see gray background behind) , text fades in. have been trying using css transitions, opacity not seem change (i.e. can still see background image). html: <div id='options'> <div class='option'> <div class='back-option'> </div> <div class='front-option'> add post </div> </div> </div> css: #options { font-family: 'segoe ui', 'arial', sans-serif; } .option { position: relative; width: 6.25em; height: 6.25em; border-radius: 5px; cursor: pointer; background-color: #363636; } .back-option { position: absolute; width: 6.25em; height: 6.25em; border-radius: 5px; background-image: url(http://png-5.findicons.com/files/icons/2672/pixel_ui/16/add.png); background-size: contain; -webkit-box-shadow: inset 0px 0px 0px 2px rgba(0,0,0,0.75); -moz-box-shadow: inset 0px 0px 0px 2px rgba(0,0,

metaprogramming - From python, can we track module-level assignments before (other) user code executes? -

i'm working on tool benefit ability track references given object within python. specifically, i'd make test doubles system replace module-level attributes of given type. example, assume following code in module c: from import b if module, b reference object named a.b, separate reference. if test double system later replaces a.b, c.b still refer original object. i have tool track assignments of a.b aliases, module-level aliasing go long way toward goal. metaphorically, i'd override module.__setattribute__ : def __setattribute__(self, name, value): if isinstance(value, interesting_types): # remember use of interesting object , call super normal processing. assume can code loaded before modules might tracked can loaded. this sort of thing may work you. first, code: a.py b = 42 # other module definitions fakery.py class fakery(object): def __init__(self, mod): self.module = __import__(mod) import sys

java - Broadcast Receiver not receivng Broadcasts -

i seem having trouble getting onreceive class receive broadcasts send out. im not sure if code thats problem or problem android manifest. public class alarmreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { log.i("broadcast_received", intent.getdatastring()); powermanager pm = (powermanager) context.getsystemservice(context.power_service); powermanager.wakelock wakelock = pm.newwakelock(powermanager.acquire_causes_wakeup, ""); wakelock.acquire(); wakelock.release(); context.startactivity(intent); } } public void setdayofweekalarm(dayofweek day){ long alarminmili = 0; intent intent = new intent(context,alarmscreenactivity.class); alarminmili = system.currenttimemillis() + 1000*10; log.i("register alarm", string.valueof(alarminmili)); alarmmanager alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_

net Node.js Error: read ECONNRESET (on Windows) -

i attempting use net lib in node.js simple message passing. in example on nodejs.org provide following code basic echo server: var net = require('net'); var server = net.createserver(function(c) { //'connection' listener console.log('server connected'); c.on('end', function() { console.log('server disconnected'); }); c.write('hello\r\n'); c.pipe(c); }); server.listen(8124, function() { //'listening' listener console.log('server bound'); }); and client said server: var net = require('net'); var client = net.connect({port: 8124}, function() { //'connect' listener console.log('client connected'); client.write('world!\r\n'); }); client.on('data', function(data) { console.log(data.tostring()); client.end(); }); client.on('end', function() { console.log('client disconnected'); }); the example above works, however, if remove client

Change the color of an oval at click in Java AWT -

i have draw ovals in java, , @ click change color. beginning tried change color after 20 ms, doesn't work. my code is: public class mycomponentnew extends frame { public graphics2d g2d; public mycomponentnew(string title) { super(title); setsize(400, 550); } @override public void paint(graphics g) { this.g2d = (graphics2d) g; this.g2d.setcolor(color.red); this.g2d.filloval(10, 55, 50, 100); } public void changecolor () { this.g2d.setcolor(color.blue); this.g2d.filloval(10, 55, 50, 100); } } and in class main method have: mycomponentnew m; m = new mycomponentnew("fereastra cu baloane"); m.setvisible(true); m.addwindowlistener(new windowadapter() { @override public void windowclosing(windowevent we) { system.exit(0); } }); try { thread.sleep(20); } catch(interruptedexception e) {} m.changecolor(); the color of oval remains red.

python - For Loop questions -

i'm used seeing for loops in format: for number in l: sum = sum + number i browsing forums , came across piece of code: count_chars = ".arpz" string = "phillip s. doing job." counts = tuple(string.count(d) for(d) in count_chars) print counts i'm not sure if for loop, decided rewrite in way understood: tuple( for(d) in count_chars: string.count(d)) needless say, failed lol. can explain going on, , explain folly of logic? thanks!! it's not quite for loop such, generator expression . return iterator each element amount of time every character in count_chars occurs in d . adds of these elements tuple . it (roughly) equivalent to: counts = [] d in count_chars: counts.append(string.count(d)) counts = tuple(counts)

java - Fuse esb doesn't take settings.xml -

i want install hawtio using repository in local net typing in console osgi:install mvn:io.hawt/hawtio-web/1.2.3. repository not behind proxy. receive error: settings.xml file: <?xml version="1.0" encoding="utf-8"?> <settings xmlns="http://maven.apache.org/settings/1.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/settings/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <mirrors> <mirror> <id>company-nexus</id> <name>some name nexus repo</name> <mirrorof>*,!np-snapshots,!public-snapshots</mirrorof> <url>http:/mysite/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> <profile> <id>companyrepo</id> <properties> <nexus.repo>mysite</nexus.repo>

xml - Unfortunately, <application name> has stopped. (Android) -

i learning android, trying develop game, have 2 classes "starter" , "board". starter class contains menu( http://postimg.org/image/dnyvoey2l/ ). exit , buttons working properly, when press "two player" option instead of showing board shows error (unfortunately, (application name) has stopped). sharing code snippet , please suggest solution. twop.setonclicklistener(new onclicklistener() { public void onclick(view v) { intent tow= new intent(starter.this, selector.class); startactivity(tow); } }); you can't show view using startactivity() method intent tow= new intent(starter.this, board.class); startactivity(tow); board should extended activity not view class. create boardactivity.java , extend activity . you should add board view either xml or programmatically using setcontentview(); in oncreate() method. edit don't forget add new activity in manif

android - geo location using GPS -

i using below code getting geo-location using gps when net not available.but location not updated.it give same longitude , latitude different location ...it not update value of longitude , latitude..i want accurate value of longitude , latitude each place. gpstracker .java public class gpstracker extends service implements locationlistener { private final context mcontext; // flag gps status boolean isgpsenabled = false; // flag network status boolean isnetworkenabled = false; // flag gps status boolean cangetlocation = false; location location; // location double latitude; // latitude double longitude; // longitude // minimum distance change updates in meters private static final long min_distance_change_for_updates = 1; // 1 meters // minimum time between updates in milliseconds private static final long min_time_bw_updates = 1000; // 1 second // declaring location manager protected locationmanager locationmanager; public gpstracker(context context) { this.mconte

html - DIV not taking 100% viewport height -

as can see on this jsfiddle try div ground picture taking 100% of viewport head (the goal achieve something this ) unfortunately i've tried various things without success (i.e. change height of element-1 100%, method described here , etc.). issue? many thanks html <header> <div class="element element-1"></div> <div class="article-titles"> <h1 class="title">head text</h1> <h2 class="subtitle">sub-head text</h2> </div> </header> css: .element { float: left; width: 100%; background-size: 100% auto; background-attachment: fixed; } .element-1 { position: relative; z-index: 8; height: 600px; <-- i've tried change 100% without success border-top: 10px solid rgb(0, 0, 0); background-image: url('http://placehold.it/650x450'); background-position: center center; background-color: rgb(222, 222, 222); } cha

html - .fadeTo('fast', 0) not working properly? - jQuery -

so i'm trying like, hover on text , appears right beside it: $('.lang1').mouseenter(function() { $('.lang1 span').fadeto('fast', 1); }); $('.lang1').mouseleave(function() { $('.lang1 span').fadeto('fast', 0); }); but once remove mouse on it still appears, faint it's visible. works intended doesn't lose it's opacity completely, have keep hovering , moving mouse away lose it's opacity completely. anyone have suggestions? css: span { opacity: 0; } html: <li class="lang1">html <span>pretty at</span></li> i'd use fadein('fast') , fadeout('fast') fading effect , use callback hide element. this: $('.lang1').mouseleave(function() { $('.lang1 span').fadeout('fast', function() { $(this).hide(); }); }); i think simpler alternative change css display:none; , let jquery handle opac

java - Craftbukkit Player Count Message Plugin Coding Error -

i making craftbukkit plugin has message in player count list, hivemc or omega realm. coding in ecplise , using protocollib v3.2.0 , craftbukkit 1.7.2 r0.3. new java , don't understand much. far... here code , error public void onenable() { saveconfig(); if(!new file(getdatafolder(),"reset.file").exists()){ try { getconfig().set("message", arrays.aslist("first line","second line")); new file(getdatafolder(),"reset.file").createnewfile(); } catch (ioexception e) { e.printstacktrace(); } } } error: method aslist(t[]) in type arrays not applicable arguments (string, string) http://tinypic.com/r/n6yond/8 try using this: arrays.aslist(new string[]{"first line", "second line"}));

javascript - how to add fancybox to website using visual studio 2012 -

i'm having issue creating fancybox in website while using visual studio 2012. how add them best make work. i've added own project, try this: tools > nuget package manager > package manager console in console type: install-package fancybox if you're using mvc can add bundle config: bundles.add(new scriptbundle("~/bundles/fancybox").include( "~/scripts/jquery.fancybox.pack.js", "~/scripts/jquery.fancybox-buttons.js", "~/scripts/jquery.fancybox-media.js", "~/scripts/jquery.fancybox-thumbs.js", "~/scripts/jquery.mousewheel-*")); and add these css bundle: "~/content/jquery.fancybox.css", "~/content/jquery.fancybox-thumbs.css", "~/content/jquery.fancybox-buttons.css" fancybox can instantiate per documentati

ios - RestKit Core Data 'managedObjectStore is nil' -

i don't know if root cause of issue or not, when making request using appropriateobjectrequestoperationwithobject:nil method:rkrequestmethodget path:path parameters:nil it work, , when trying map response gives me warning: w restkit:rkobjectmanager.m:635 asked create `rkmanagedobjectrequestoperation` object, managedobjectstore nil. followed by: coredata: error: failed call designated initializer on nsmanagedobject class 'container' i assume because not matching request against managed object mapping, can't figure out why. creating persistent store using code: // initialize managed object store nsmanagedobjectmodel *managedobjectmodel = [nsmanagedobjectmodel mergedmodelfrombundles:nil]; rkmanagedobjectstore *managedobjectstore = [[rkmanagedobjectstore alloc] initwithmanagedobjectmodel:managedobjectmodel]; nserror *error = nil; [managedobjectstore createpersistentstorecoordinator]; bool success = rkensuredirectoryexistsatpath(rkapplicationdatadirectory(

Common Lisp Library for Pretty Printing? e.g. pretty print a nested hash table -

i new common lisp. there cl library pretty print collections, in case, nested hash tables? if consider writing here starting point using print-object . not implementation independend, works @ least in lispworks , sbcl. (defmethod print-object ((object hash-table) stream) (format stream "#hash{~{~{(~a : ~a)~}~^ ~}}" (loop key being hash-keys of object using (hash-value value) collect (list key value))))

Is it possible for a Chrome Extension to work with several tabs all at once? -

is possible chrome extension control/manipulate several tabs @ once? example, if have 2 or 3 chrome tabs open, , have similar layout, text boxes located in same place; - extension able fill/click on text boxes @ once, (in two/three tabs open); if particular tab(s) in question/being edited not brought front @ time? many in advance! you can change content of textbox if tab not active, if have content script injected in it. it can tricky *, can invoke click event on element of time. however, need consider permissions inject script tab first. activetab permission not generate warnings user, he'll have manually click extension button on each tab before work. probable (but not necessary) it's not want. if want extension automatically apply set of websites, can request permissions of them , inject content scripts @ leisure, following whatever logic extension uses, , communicate required synchronizations via messaging api. * linked question keydown event, problem

ruby on rails - Using Restforce gem with SalesForce API and Oauth 2.0 -

i'm trying use restforce ( https://github.com/ejholmes/restforce ) set integration rails app salesforce's api using oauth 2.0. restforce describes initialization process follows: initialization which authentication method use depends on use case. if you're building application many users different orgs authenticated through oauth , need interact data in org on behalf, should use oauth token authentication method. if you're using gem interact single org (maybe you're building salesforce integration internally?) should use username/password authentication method. oauth token authentication client = restforce.new :oauth_token => 'oauth token', :instance_url => 'instance url' although above work, you'll want take advantage of (re)authentication middleware specifying refresh token, client id , client secret: client = restforce.new :oauth_token => 'oauth token', :refresh_token

Can I select a DOM element based on an HTML comment it contains? -

using either css3 or xpath expressions, i'd know if there way select element contains html comment. for example: <table>…</table> <table> <!--this 1 --> …</table> how can select 2nd table without using other attributes? (it may not 2nd table) with xpath can done using comment() node test: //table[.//comment()[contains(., 'this one')]] this selects table elements containing comment (at depth) contains text 'this one' . i'm pretty sure impossible css.

mod rewrite - .htaccess rules to ignore the main directory .htaccess file if specific subfolder is requested in URI -

i have 3 subfolders /software1/ , /software2/ , /software3/ 3 different applications in main root directory domain.com . .htaccess rules these subfolders interfering .htaccess file in main directory. so, wonder if there rule add .htaccess file in main directory ignore rest of file , directly jump /software1/ , /software2/ , /software3/ subfolders (i.e. .htaccess files) if uri http://domain.com/software1/... , http://domain.com/software2/... , http://domain.com/software3/... ? it have been nice see current .htaccess rules can see it's doing or not doing. if want not 3 directories, can try in main .htaccess , have not if 1 of 3 directories. rewriteengine on rewriterule ^(software1|software2|software3)$ - [l,nc]

hadoop - Pig HBaseStorage - How to Generate Dynamic Column Names and a Dynamic Number of Column Qualifiers from a DataBag? -

a has 1:m relationship b. a = load ... ( a_id:char ,... ); b = load ... ( a_id:chararray ,b_id:chararray ,... ); joined = join a_id, b a_id; grouped = group joined a::a_id; this create databag following schema: {group: chararray, joined: {(a:a_id, ..., b::a_id, b::b_id, ...)}} for example: (1, {(1, ..., 1, 1, ...)}) (2, {(2, ..., 2, 2, ...), (2, ..., 2,3, ...), (2, ...,2,4, ...)}) (3, {(3, ..., 3, 5, ...)}) for these 3 rows, how corresponding hbase results like: rowkey = 1, a:a_id=1, ... b:b1|a_id=1, b:b1|b_id:=1 rowkey = 2, a:a_id=2, ... b:b2|a_id=2, b:b2|b_id=2, ..., b:b3|a_id=2, b:b3|b_id=3, ..., b:b4|a_id=2, b:b4|b_id=4, ... rowkey = 3, a:a_id=3, ..., b:b5|a_id=3, b:b5|b_id = 5 how can import databag hbase using above logic? in order need generate dynamic column qualifier names, number of dependent on number of subtuples in databag.

matlab - Setting x-axis limits using plotyy; data disappears -

i'm using plotyy plot 2 datasets same x values on 2 different y scales. works perfectly, until try change limits of x-axis. (matlab plots lot of space on both sides.) whenever add in 'set(ax(1) xlim', lines associated axis disappear , plot appears blank. my code: [ax,h1,h2]=plotyy(datenum(datevector),data1,datenum(datevector),data2); dateformat = 10; datetick(ax(1),'x',dateformat); datetick(ax(2),'x',dateformat); set(ax(1),'xlim',[1950 2013]); set(ax(2),'xlim',[1950 2013]); xlabel('year') ylabel('data1'); ylabel('data2'); thanks! try instead. set(ax(1),'xlim',[datenum(1950,1,1) datenum(2013,1,1)]); set(ax(2),'xlim',[datenum(1950,1,1) datenum(2013,1,1)]); since x-axis date (years), limits have specified in datenum format too. also, need give axis handle label functions too. ylabel(ax(1),'data1'); ylabel(ax(2),'data2');

c# - difference between await Task(ReadFromIO) and await Task.WhenAll(task1,task2); -

i read in book differences of below. private async task getdataasync() { var task1 = readdatafromioasync(); var task2 = readdatafromioasync(); // here can more processing // doesn't need data previous calls. // need data have wait await task.whenall(task1, task2); // have data show. lblresult.content = task1.result; lblresult2.content = task2.result; } private async task getdataasync() { var task1 = readdatafromioasync(); var task2 = readdatafromioasync(); lblresult.content = await task1; lblresult2.content = await task2; } i understood whats happening in first method's await statement. second one, though understood logic couldn't understand pitfall of second implementation compared first. in book, mentioned compiler rewrites method twice. understood because of 2 await calls, there time delay more first 1 separately call await each task here. can explain me in better way? i don't know point book trying make agree initial guess @ it's interoperation

javascript - style binding issue when the () are not included -

can please clarify following situation knockout.js style bindings? if use functions width(), height() bindings successful, when use properties without () bindings not successful. attr binding don`t have use (). successful attr , style bindigs: <div class="container" id="container" data-bind="foreach: nodes"> <div class="node" data-bind="attr:{id:id}, style: {width: width() + 'px', height: height() + 'px', left: positionleft() + 'px', top: positiontop() + 'px'}"> <span data-bind="text:name"></span> <div class="ep"></div> </div> attr bindings applied style bindings not successful <div class="container" id="container" data-bind="foreach: nodes"> <div class="node" data-bind="attr:{id:id}, style: {width: width + 'px', height: height + 'px', lef

Typescript generates javascript code for simple class inheritance -

i have question how typescript generates javascript code simple class inheritance. below typescript code followed generated javascript code. typescript code: class animal { constructor(public name: string) { } move(meters: number) { alert(this.name + " moved " + meters + "m."); } } class cat extends animal { constructor(name: string) { super(name); } move() { alert("run..."); super.move(5); } } generated javascript code: var __extends = this.__extends || function (d, b) { (var p in b) if (b.hasownproperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var animal = (function () { function animal(name) { this.name = name; } animal.prototype.move = function (meters) { alert(this.name + " moved " + meters + "m."); }; return animal; })(); var cat = (function (_supe

Using Haskell ranges: Why would mapping a floating point function across a range cause it to return an extra element? -

i know floats can lead odd behavior in ranges due imprecise nature. expect possibility of imprecise values. instance: [0.1,0.3..1] might give [0.1,0.3,0.5,0.7,0.8999999999999999] instead of [0.1,0.3,0.5,0.7,0.9] in addition precision loss, however, element: ghci> [0.1,0.3..1] [0.1,0.3,0.5,0.7,0.8999999999999999,1.0999999999999999] this weird, explained here . work around this, suppose: ghci> [0.1,0.3..0.99] [0.1,0.3,0.5,0.7,0.8999999999999999] but that's kind of gross. maybe there's cleaner way. simple example, of course, use range [0.1,0.3..0.9] , fine. but in more complex example, may not know (or care figure out, if i'm lazy) exact upper bound should use. so, i'll make range of integers , divide 10, right? nope: ghci> map (/10) [1,3..10] [0.1,0.3,0.5,0.7,0.9,1.1] any floating point function seems cause behavior: ghci> map (*1.0) [1,3..10] [1.0,3.0,5.0,7.0,9.0,11.0] whereas non-floating function doesn't: ghci> map (*1)

php - Both move_uploaded_file and copy functions won't move my files to new destination , any idea why? -

i'm trying move pictures new folder called new_images, move_uploaded_file isn't working. tried copy($entry, $dir2); isn't working either. it's on live site. suggestions? $dir = $_server['document_root'].'/images/classifieds/'.$row['user_id'].'/ads/'.$row['listbingo_ad_id'].''; if ($handle = opendir($dir)) { //echo "directory handle: $handle\n"; //echo "entries:\n"; /* correct way loop on directory. */ while (false !== ($entry = readdir($handle))) { if($entry !="." && $entry !=".."){ $dir2 = $_server['document_root'].'/images/new_images/'.$entry; move_uploaded_file($entry, $dir2); echo "insert tbl_classified_image (clsd_id,mem_id,cls_img_file,img_status) values(".$row['listbingo_ad_id'].",6,'".$entry."','y');\n"; } } }

java - How do i get the other text from not displaying- decision structures? -

i have been trying find solution i'm not getting it. when input age 13 , time 2230 both "midnight madness not available children under 14 years old!" , price output. in console: please enter age: [13] please enter show time: [2230] midnight madness not available children under 14 years old!the ticket price $8.00> import java.util.scanner; import java.text.decimalformat; public class movietickets { public static void main(string[] args) { scanner input = new scanner(system.in); decimalformat df = new decimalformat("$#.00"); int age; int time; double price = 8.00; double ch = 4.00; system.out.print("please enter age:"); age = input.nextint(); system.out.print("please enter show time: "); time = input.nextint(); system.out.print(" "); if (age > 13) if (time < 1800) price = 5.00

excel - VBA Error Compile: Expected: Expression -

Image
i working on homework , can't figure out why code won't work. assignment request name respond in red text in b10. here code: any great- thanks! consider: sub qwerty() sheets("mynewsheet").activate range("b10") .font.colorindex = 3 strname = application.inputbox(prompt:="please enter name.", type:=2) .value = strname end end sub

python - Django ListView customising queryset -

hopefully should simple 1 me with. i have page dropdown menu containing 3 items: <form method="get"> <select name="browse"> <option>cats</option> <option>dogs</option> <option>worms</option> </select> <input type="submit" value="submit" /> </form> <!-- output table --> <table id="mytable"> <thead> <tr> <th>name</th> <th>colour</th> </tr> </thead> <tbody> {% object in object_list %} <tr> <td>{{ object.name }}</td> <td>{{ object.colour }}</td> </tr> {% endfor %} </tbody> </table> <!-- pagination controls --> <div class="pagination"> <span class="pag

python - ZIP - Zipping Files Doesn't Actually ZIP The Files -

i have short method takes file path , list of filenames path parameters , supposed zip files 1 archive file. problem instead of zipping files, creates empty directory in archive each file trying zip. here's method: def zip(self, file_path, filename_list): f = zipfile.zipfile(file_path + '_converted_zip_archive.zip', 'w') filename in filename_list: f.write(file_path, filename) f.close() if call zip('uploads/', ['test_1.txt', 'test_2.txt', 'test_3.txt']) i end archive file has following directories: /test_1.txt/ /test_2.txt/ /test_3.txt/ what doing wrong i'm creating bunch of empty directories in zip file instead of zipping these text files? you writing directory archive 3 times (with 3 different names). more explicit, writing following archive: uploads/ test_1.txt uploads/ test_2.txt uploads/ test_3.txt do rather mean this? def zip(self, file_path, filename_list)