Posts

Showing posts from August, 2012

android - Passing data from onPostExecute() to adapter -

can't pass data onpostexecute() adapter autocomletetextview . logcat shows me: an exception occurred during performfiltering()! java.lang.nullpointerexception: collection == null. public class uzactivity extends activity { private static final string debug_tag = "httpexample"; list<string> responselist; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_uz); final string url = "http://booking.uz.gov.ua/purchase/station/%d0%9a%d0%b8%d0%b5/"; new fetchstationtask().execute(url); autocompletetextview textview = (autocompletetextview) findviewbyid(r.id.autocompletetextview1); arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_dropdown_item_1line, responselist); textview.setadapter(adapter); } private class fetchstationtask extends asynctask<string, void, s

c++ - Given the following, what type is "function"? -

given following, type "function"? #include <functional> #include <vector> template<class t> class foo { public: template<typename p, typename q, typename r, typename... args> void attach(p (q::*f)(args...), r p) { auto function = [p, f](args... args) { (*p.*f)(args...); }; listeners.push_back(function); } private: std::vector<std::function<t>> listeners; }; class bar { public: int handler(int x, int y, int z) { return 0; } }; int main(void) { auto foo = foo<int(int, int, int)>(); auto bar = bar(); foo.attach(&bar::handler, &bar); } for context i'm attempting make lambda calls method on instance, storing lambda collection. push_back fails compile, following error: xrefwrap(283): error c2440: 'return' : cannot convert 'void' 'int' i using std::bind make std::function store.

ios - How can I enable the XCTest indicator on XCode 6.3? -

Image
as of xcode 6.2 diamond appeared @ left side of code in test classes: but, of xcode 6.3 appear no longer available/visible. this diamond used offer useful inline information every xctest , want back. this bug in previous xcode 6.3 , fixed release of xcode 6.3.1, regarding apple features in new release.

apache - Environment variables - htaccess and php -

i need little environment variables. after setup variable in .htaccess file this: setenv statusv "online" how can change variable value permanently (global scope) using php. if change variable value this: apache_setenv("statusv", "offline"); or putenv('statusv=offline'); variable changed , exists in session changed it. what want forbid clients access files via direct url if environment variable set specific value. i appreciate every , thank in advance.

Why has Swift 1.2 broken inheritance of UIDynamicAnimator's init(collectionViewLayout:)? -

in swift 1.1 , before, legal: let layout = uicollectionviewlayout() class mydynamicanimator : uidynamicanimator {} let anim2 = mydynamicanimator(collectionviewlayout:layout) in swift 1.2, refuses compile. why? i can work around problem overriding init(collectionviewlayout:) nothing call super: class mydynamicanimator : uidynamicanimator { override init(collectionviewlayout:uicollectionviewlayout) { super.init(collectionviewlayout:collectionviewlayout) } } but seems kind of nutty. if can override it, why can't inherit it? note: i'm guessing reason problem might uidynamicanimator's init(collectionviewlayout:) designated initializer declared in extension, illegal according swift. isn't illegal according cocoa, surely still needs inherited! breakage feels bug me... should no business of mine, programmer, caught technicalities of initializer happens declared in structure of api header. [edit: i've filed bug report on apple, have rece

angularjs - How to set a Nested view inside a multiple views -

i've 2 named views , unnamed view follow: //department.html <div class="col-md-2"> <div ui-view="sidebar"></div> </div> <div class="col-md-10"> <div ui-view="content"></div> <div ui-view></div> </div> and routes: .state('support', { url: '/support', views: { '': { templateurl: 'app/components/department/department.html' }, 'sidebar@support': { templateurl: 'app/shared/sidebar/sidebar.html', controller: 'sidebarcontroller' }, 'content@support':{ templateurl: 'app/components/department/support/partial-support.html', controller: 'supportcontroller' }, } }) .st

sql - modeling database with 2 simillar table -

i have database has product_sell , product_buy tables, these 2 tables different in few fields , each 1 has owns comment table product_sell >---< product_sell_cmt product_buy >---< product_buy_cmt now , want ask modelling approach better ? design 4 tables showed above design product_sell , product_buy separately common comment table merge 2 product tables in 1 table unused columns in rows or using 1 1 relations since, use product_sell , product_buy , comments lonely in cases , useful indexing , performance have 4 separated tables ?

ruby - logstash elasticsearch output -

i'm having issues while i've tried change naming convention elasticsearch index in logstash conf file. need use part of file name passed through logstash pipeline, part set date of data contained file. so, instead of using standard naming convention, is, long can read: logstash-%{+yyyy.mm.dd}, need this: -. i trying actual name of file passed through pipeline, not know how it. decided use year , month of current line being processed in filter section. grok pattern use: grok { match => [ "message", "%{ip:client} %{notspace:sep} %{notspace:ident} %{notspace:inbracket}%{monthday:day}/%{month:month}/%{year:year}:%{hour:hour}:%{minute:minute}:%{second:second} %{iso8601_timezone:tz}%{notspace:outbracket} \"%{word:method} %{notspace:uri} %{notspace:http_version}\" %{number:code} %{number:size} %{notspace:action_hierarchy} %{notspace:content_type}" ] remove_field => ["sep"] remove_field => ["inbracket"]

sql - MySQL Query get total number of guests per company -

select first_name, last_name, c.name company_name, sc.`date` screening_date guests g inner join user_guest_group ugs on ugs.guest_id = g.id inner join companies c on c.id = g.company_id inner join screening_date_guest sdg on sdg.guest_id = g.id inner join screening_dates sc on sc.id = sdg.screening_date_id sdg.attending = 1 , screening_date_id = 1 group first_name, last_name results: peter, m, bell media (ctv), 2015-05-18 00:00:00 adam, d, highway entertainment, 2015-05-18 00:00:00 todd, f., multichoice, 2015-05-18 00:00:00 john, d, talpa, 2015-05-18 00:00:00 maria, f, uk tv, 2015-05-18 00:00:00 john, l, wbdtd, 2015-05-18 00:00:00 albert, p, wbdtd, 2015-05-18 00:00:00 my query returns resulset. now, want see column total guests per company. in case, have 2 guests wbtdt should total_guest = 2 can me ? thanks one way count per company in correlated subquery, maybe want? select first_name, last_n

excel - Add data into table without auto increment -

so trying dynamically insert data excel table other closed workbooks. i got working fine, except 1 small annoying thing. i have formula follows: ='h:\dev...[some book name.xlsm]main'!c1 the formula above works fine. need insert exact same formula table in sheet several rows. it should in 1 column: ='h:\dev...[some book name.xlsm]main'!c1 ='h:\dev...[some book name.xlsm]main'!c1 ='h:\dev...[some book name.xlsm]main'!c1 what excel does, automatically changes cell references incremental, this: ='h:\dev...[some book name.xlsm]main'! c1 ='h:\dev...[some book name.xlsm]main'! c2 ='h:\dev...[some book name.xlsm]main'! c3 i insert the formulas string array, , paste table using code: set lstobj = sheets(1).listobjects(1) set rnglstobj = lstobj.range rnglstobj.offset(1, 0).resize(rnglstobj.rows.count - 1,rnglstobj.columns.count) .formula = revlist end in code above, revlist 2 dimenti

javascript - RegExp check on AT character -

i'm trying check if word in string, i've come far now. code below works perectly when word test or without special character behind it. want make check 1 character before string, character @ whenever string @test must match. //this returns false not var str = "mr. @test has blue house"; var match = "@test"; var b = new regexp('\\b' + match + '(?:es|s)?\\b'); var n = b.test(str); console.log('test 1 ' + n); //this returns true var str = "mr. test! has blue house"; var match = "test"; var b = new regexp('\\b' + match + '(?:es|s)?\\b'); var n = b.test(str); console.log('test 2 ' + n); \b used word boundaries, @ not word character. want should this: \b@test(?:es|s)?\b which means there no word ending before @ . ( demo )

c - Can't find the bug in the program to print the longest input line -

#include <stdio.h> #include <stdlib.h> #define maxline 1000 int mygetline( char line[], int maxline); /*will return length */ void copy (char to[], char from[]); int main(){ int len; // length of line int max; // maximum length seen far char line[maxline]; char longest[maxline]; max = 0; while((len = mygetline(line, maxline)) >0){ if (len>max){ max = len; copy(longest, line); } if (max>0){ printf("%s", longest); } } return 0; } /*getline: reads line s, , returns length of line */ int mygetline(char s[], int limit){ int c, i; for(i=0; i<limit-1 && (c=getchar())!= eof && c!= '\n'; ++i){ s[i] = c; } if (c=='\n'){ s[i] = c; ++i; } s[i] = '\0'; return i; } /*copy: copy 'from' 'to'; assume big enough */ void copy (char to[], char from[])

javascript - jQuery addClass loop starting from last-child up -

every thing works far every 500 milliseconds adds class next blockwrap element in line. but want start last "blockwrap" element, add class , work way up. how can achieve this? here html: <div class="blockwrap"> <div class="blockimg"> <img src="img/download.jpg"> </div> </div> <div class="blockwrap"> <div class="blockimg"> <img src="img/download.jpg"> </div> </div> <div class="blockwrap"> <div class="blockimg"> <img src="img/download.jpg"> </div> </div> here jquery loop: $(document).ready(function(){ $(function () { var block = $('.blockwrap'); (function _loop(wrap) { block.eq(wrap).addclass('slidein'); settimeout(function () { _loop((wrap + 1) % block.length); }, 500); }(0)); }

AngularJS - Dependency injection on controllers module -

having real issues wrapping head around issue i'm having angular. i'm trying set multi-page app routing. app.js looks little this: var app = angular.module('app', ['angularlocalstorage', 'ngroute', 'ngresource', 'authcontrollers', 'authservices', 'eventcontrollers', 'eventservices']); app.config(['$routeprovider', '$httpprovider', function($routeprovider, $httpprovider) { $routeprovider. when('/', { templateurl: 'partials/events.html', controller: 'eventlistcontroller' }). otherwise({ redirectto: '/' }); ... i'm attempting make module - app depend on eventcontrollers, i'm getting following error: error: [$injector:modulerr] http://errors.angularjs.org/1.3.15/$injector/modulerr?p0=app&p1=%5b%24injector%3amodulerr%5d%20http%3a%2f%2ferrors.angularjs.org%2f1.3

r - Convert hex to decimal in python pandas dataframe -

this question has answer here: python pandas: apply function arguments series 4 answers i trying move r python pandas. not expert , welcome help. have searched! have dataframe, sh_tags in r column thumbs_id in hex. convert decimal this: sh_tags$thumb_id <- as.integer(paste("0x",sh_tags$thumbs, sep="")) i can convert single cell in pandas this: int(thumb_id .iloc[1,0],16) but want column. for series : x = pd.series(["ff","cd","1a"]) b16 = lambda x: int(x,16) x.apply(b16) seems work

asp.net - Header not being set for OPTIONS Ajax request -

i have ascx page gettoken.ashx . public void processrequest (httpcontext context) { context.response.contenttype = "text/plain"; context.response.appendheader("access-control-allow-origin", "*"); context.response.write(token.createtoken()); } when ajax page, returns following headers: request method:get status code:200 ok access-control-allow-origin:* cache-control:private content-length:36 content-type:text/plain; charset=utf-8 date:tue, 14 apr 2015 17:20:53 gmt server:microsoft-iis/8.5 x-aspnet-version:4.0.30319 x-powered-by:asp.net when page makes ajax request placed in sandboxed iframe, shows error: xmlhttprequest cannot load https://127.0.0.1:112/handlers/gettoken.ashx. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. and returns headers: request method:options status code:200 ok allow:options, trace, get, head, post content-length:0 date:t

c++ - How do I fix xcode lexical or preprocessor issue, array file not found in xcode 6.3? -

i solved problem in xcode 6.2 following advice in previous, similar postings. has re-appeared in xcode 6.3 , not corrected. i have mixed, objective-c , c++ project files contain c++ code named *.mm , project settings @ default. if load in small set of c++ files , call c++ functor view controller of canned single-page ios application in new project created isolate problem, compiles successfully. then, when try add folder containing written (and compiled) mixed code, following error appears. lexical or preprocessor issue, 'array' file not found i tried combinations 'c language dialect' , 'c++ language dialect' c11 | gnu11 , c++c11 | gnu++11 | c++c14 in build settings , error remained. removing reference group of addition files gets compilation succeed again , if build setting point gnu11 or c11. how addition or removal of files (that compiled under xcode 6.2) have compiler finding or not finding standard template header file? by adding files

.net - c# BackgroundWorker and Treeview in winform -

env : c#, vstudio 2013, 4.5 framework, winforms goal : insert, inside treeview, content of folder (sub folder + files) user can select needed. display progressbar show progress of loading files , folders in treeview. what i've done far : in goal ... error : " this backgroundworker busy , cannot run multiple tasks concurrently ". error when go use other apps while application running. my code : void backgroundworkertreeview_dowork(object sender, doworkeventargs e) { var progress = (((float)(int)e.argument / (float)totalfilesintn) * 100); var value = (int)math.round((float)progress); backgroundworkertreeview.reportprogress(value, e.argument.tostring()); } void backgroundworkertreeview_progresschanged(object sender, progresschangedeventargs e) { ststripbarmain.value = e.progresspercentage; toolstripstatuslab

image - Color approximation -

let's suppose have regular rgb image. want approximate color of each individual pixel of our source image color out of small set of colors. for example, tones of red should converted specific red out of set of colors, same goes green, blue, etc. is there elegant way/algorithm achieve this?

Swift : Useless default value for Optional? -

i'm creating function : func foo(bar: uint? = 0) { let dosomething = someotherfunc(bar!) } if i'm passing foo() nil value, i'm expecting default value of 0 used instead while unwrapping it, rather i'm getting usual error unexpectedly found nil while unwrapping optional value where wrong here ? the default value = 0 used if don't provide argument optional parameter: func foo(bar: uint? = 0) { println(bar) } foo(bar: nil) // nil foo(bar: 1) // optional(1) foo() // optional(0), default value used if intention replace passed nil value 0 can use nil-coalescing operator ?? : func foo(bar: uint?) { println(bar ?? 0) } foo(nil) // 0 foo(1) // 1

r - Can multiple users access an open source Shiny Server concurrently? -

i have program built in r , runs on desktop version of shiny. working on moving project shiny server. possible multiple users use program @ same time on open source version of shiny server or there issue concurrent users? thanks i not shiny developer yes. limitation 1 r process used. if user1 runs process takes time user2's processes wait user1 finish.

google app engine - How to check if variable exist then print as string in python -

using gae's datastore wish print out statement concatenated variables turned string. codesnippet loop through entities of article kind: que = article.query() testt = que.fetch(1000) t in testt: self.response.write(t.title) self.response.write("<b>artikel:</b> "+t.title + " <b>forfatter:</b> "+t.author + " <b>udgivet:</b> " + t.time + " <b>likes:</b> " + str(t.likes) + " <b>shares:</b> " + str(t.shares) + " <b>comments:</b> " + str(t.comments)) however of these variables may not exist. , i'm guessing error because i'm trying convert null-values? traceback (most recent call last): file "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__ rv = self.handle_exception(request, response, e) file "/base/data/home/runtimes/py

box api - How do I get the comments added to a comment in the in the Box REST API? -

Image
how comments added comment in in box rest api? for example, how return comments (marked in red) comment (marked in black)? they should included in list comments on file. difference reply comments have is_reply_comment field set true. note ordering of returned comments important. since replies can 1 level deep, reply comment associated first non-reply comment above it. here's sample response including comment , reply first comment: get https://api.box.com/2.0/files/28785720644/comments { "total_count": 2, "offset": 0, "limit": 100, "entries": [ { "type": "comment", "id": "63003535", "is_reply_comment": false, "message": "first message", "created_by": { "type": "user", "id": "221860571", "name": "name", "

javascript - Pop Up in Behind (Not z-index) and how to function close popup in link -

Image
i create popup javascript, show school. when click link show popup, popup position in behind, add z-index in css inline not work :'( this screenshot this script.. <html> <?php include "connection.php";?> <script> function profile(kode,logo,address,ket,name,status,phone) { var data =''+kode+''; var h =''; h +='<div style="background-color:#ffffff; z-index:9999999;" id="profilenya" >'; h +='<div style="background-color:#ffffff; z-index:9999999;">'; h +='<br/><h2 style="background-color:#359ace; width: auto;"><center>'+name+'</center></h2><br/>'; h +='<table><tr><td rowspan="2">&nbsp; <img style="border:1px solid #369ace; padding: 5px 30px;" width="160px" height="160px" src="images/sekolah/logo

c# - WWW class does not work in unity -

first of all, i'm new unity , i'm developing in new unity 5.0.0. i´ve been looking @ www class in unity documentation , followed through , haven't gotten work yet. have looked in other questions , googled lot , couldn't work. code got in apimanager: using unityengine; using system.collections; public class apimanager : monobehaviour { public string url = "url"; public string temp; public void start(){ www w = new www (url); startcoroutine (waitforrequest (w)); } ienumerator waitforrequest(www w){ yield return w; temp = w.text.tostring (); } public string gettemp(){ return temp; } } and in main file want call string gettemp method , show data in label doesn't work. nothing shows , i'm struggling figure out. (i'm trying show data in label text (string).) public class main : monobehaviour { apimanager myapimanager = new apimanager(); void ongui() { gui.label(screenposition(0, 500, 300,300), myapiman

ios - Sprite not staying on screen (left and right) -

i making game sprite moves around screen, have created collision edges using self.physicsbody = skphysicsbody(edgeloopfromrect: self.frame) seems work top , bottom of screen left , right sides sprite moves off screen. i'm not sure why is, appreciate advice beginner. included code scrolling background have set up. have other enemy sprites spawning off screen , moving view, maybe effects boundary? class gamescene: skscene, skphysicscontactdelegate{ struct physicscategory { static let none : uint32 = 0 static let : uint32 = uint32.max static let edge : uint32 = 0b1 static let spaceman: uint32 = 0b10 static let ship: uint32 = 0b11 } override func didmovetoview(view: skview) { /* setup scene here */ self.physicsbody = skphysicsbody(edgeloopfromrect: self.frame) self.physicsbody?.categorybitmask = physicscategory.edge physicsworld.contactdelegate = self // repeating background var bgtexture = sktexture(imagenamed: "spa

php - Merge 2 arrays into 1 multidimensional array by index -

been racking brain few hours trying merge these 2 arrays 1 multidimensional array. here data, output want , i've tried. array 1: array (size=67) 0 => string '1/10/2015' (length=9) 1 => string '1/12/2015' (length=9) 2 => string '1/17/2015' (length=9) 3 => string '1/19/2015' (length=9) 4 => string '1/21/2015' (length=9) array 2: array (size=67) 0 => int 3 1 => int 3 2 => int 3 3 => int 1 4 => int 4 desired multidimensional array: array (size=67) 0 => array (size=1) 0 => int 3 1 => string '1/10/2015' 1 => array (size=1) 0 => int 3 1 => string '1/12/2015' 2 => array (size=1) 0 => int 3 1 => string '1/17/2015' 3 => array (size=1) 0 => int 1 1 => string '1/19/2015' 4 => array (size=1) 0 => int 4 1 => string '1/21/2015' here tried: $dailytotal = array_merge($arr1,$arr2); $dailytotal

python 3.4 - Watchdog on windows with python3.4 -

i trying learn use watchdog utility on windows. i have gone through basic examples available on google. trying write script monitor given directory , send mail if sub-directory created has file named version. import time watchdog.observers import observer watchdog.events import dircreatedevent import re import smtplib class myhandler(dircreatedevent): def process(self,event): filetocheck = "version" open(event.src_path+"\\"+filetocheck) version: chngstring = version.read() changenumber = re.findall(r"\d(\d{5})\d",chngstring) if not changenumber: return server = smtplib.smtp('smtp.gmail.com',587) server.login("xyz@gmail.com","abc@123") message = "new build has been create chnage number %d" %int(changenumber[0]) server.sendmail("xyz@gmail.com","abc@gmail.com",message) def on_

Eclipse: import project via gradle --> failed to find target android-16 -

i'm trying import gradle project eclipse via gradle-plugin. import --> gradle project --> browsing project. when hit 'build model' error-message: "failed find target android-16". android api16 installed, reinstalling did not help. try verifying sdk locations (since said installed), perhaps android studio cant find them. please see link instructions: android studio - failed find target android-18

javascript - Using React with Bootstrap Toggle -

i want use bootstrap toggle inside react component. regular checkbox shown instead of styled element. how fixed? <!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"> <!-- bootstrap core css --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> <script src="https://fb.me/react-0.13.1.js"></script> <script src="https://fb.me/jsxtransformer-0.13.1.js"></script> <script type="text/jsx"> var wordcheckbox = react.createclass({ render: function() { return ( <div classname="checkbox"> <label>

Appropriate way to toggle in Javascript/jQuery without using global variables? -

usually when code toggle function example toggling between 2 background colors, use global variable flag. example - var flag = true; function change() { if(flag) { document.getelementbyid("box").style.backgroundcolor = "blue"; flag = false; } else { document.getelementbyid("box").style.backgroundcolor = "red"; flag = true; } } #box { width:100px; height:100px; background-color:red; } <h3>click box toggle</h1> <div id="box" onclick="change()"></div> but when code multiple functions toggle various properties, number of global variables increases , stated these articles- article #1 article #2 article #3 global variables must avoided . question is, other way write simple function toggle? you can using addeventlistener bind click event in combination self-executing anonymous function. (function(){

eloquent - Laravel QueryBuilder - hook before a query is executed -

i alter queries before execution, example event::listen('which event?', function($query) { $query->where('foo', 'bar'); }); so example::where('name', 'baz')->get() produce sql code: select * example name = 'baz' , foo = 'bar' . is possible? this best handled global scope on model. sometimes may wish define scope applies queries performed on model. in essence, how eloquent's own "soft delete" feature works. global scopes defined using combination of php traits , implementation of illuminate\database\eloquent\scopeinterface.

sql server - TSQL xQuery how to I get the root/document node -

i have xml field contains data similar how .net constructs controls within forms. suppose have windows form, can add multiple controls form , show under .controls property. of controls can have controls such panels, group boxes etc. similar shown in xml below. <form> <name>myform</name> <tabctrl> <name>tab1</name> <controls> <textboxctrl> <name>mytextbox</name> <location>3,10</location> <tag>34</tag> </textboxctrl> <label> <name>mylabel</name> <location>23,3</location> <tag>19</tag>> </label> <panel> <name>mypanel</name> <controls> <textboxctrl> <name>mytextbox2</name> <location>36,210</locat

VBA Excel Return values from an array with loop -

i have small loop in vba function, gives me each month - i.e. parameter - respective contract list , works every month except december. contractlist vertical array (3,5,7,9,12). code: k = 1 until month(parameter) < contractlist(k, 1) k = k + 1 loop nextcontract = monthname(contractlist(k, 1)) here problem: when month december, month(december) never smaller contractlist(k, 1) because 12 smallest value in array. in case, jump first value of array, i.e. "3". in other words, in last line nextcontract should monthname(contractlist(1, 1)). can give me hint how that? thanks, appreciated! there's sneaky way cheat uses mod mod reduce value 0 when equals value looked (and multiples), can use month when december parameter zero, instead of 12... do until (month(parameter) mod 12) < contractlist(k, 1) this leave every other month alone, return 0 december.

javascript - jQuery "$ is not a function" error -

i swear have included jquery in page header, right there! nonetheless following code, i've included near bottom of page (and inline now) gives me error saying "typeerror: $ not function." <script> function displayresult(longa, lata, longb, latb, units) { $("#distance").html(calcdist(longa, lata, longb, latb, units)); if (units=="m") { $("#unitlabel").html("miles"); $("units").prop("selectedindex",0); } else { $("#unitlabel").html("kilometers"); $("#units").prop("selectedindex",1); } $("#longa").val(longa); $("#lata").val(lata); $("#longb").val(longb); $("#latb").val(latb); } $("#calculatebutton").click(function() { //this line it

Simple Division on "Form" with Javascript -

i'm trying thought simple, apparently i'm having trouble doing it. i have 2 input fields on page ('sales', 'fees'). third input field should value of 'fees' divided 'sales'. one caveat: don't want standard form have "submit" it. want automatically update value (least amount of effort on users part). <script type="text/javascript"> var sale = document.getelementbyid('sales').value; var fee = document.getelementbyid('fees').value; document.getelementbyid('rate').value = sale / fee; </script> and <p>total purchases: <input type="text" name="sales" id="sales" /></p> <p>total fees: <input type="text" name="fees" id="fees" /></p> <p>your net rate is: <input type="text" name="rate" id="rate" /></p> i'm assuming there way

Make an existing website responsive -

as assignment school had make website couldn't touch html except adding classes , id's. now website done when people on bigger or smaller resolutions open te site different because it's not responsive. can use grid tough didn't explain how works. is there way make existing site responsive? only adding classes , id's isn't enough... you'll have include @ least 1 css file pull off. hint: use media-queries if want yourself. if you're looking using existing css framework handles responsive websites pretty well, i'd suggest looking @ uikit ( http://getuikit.com/ )

android - Share image with ShareActionProvider from Picasso -

i spand few hours find solution... so decided share informatiom, maybe 1 itwill helpful :) the first way , shown below, takes bitmap view , loads file. // access imageview imageview ivimage = (imageview) findviewbyid(r.id.ivresult); // fire async request load image picasso.with(context).load(imageurl).into(ivimage); and later assuming after image has completed loading, how can trigger share: // can triggered view event such button press public void onshareitem(view v) { // access bitmap image view imageview ivimage = (imageview) findviewbyid(r.id.ivresult); // access uri bitmap uri bmpuri = getlocalbitmapuri(ivimage); if (bmpuri != null) { // construct shareintent link image intent shareintent = new intent(); shareintent.setaction(intent.action_send); shareintent.putextra(intent.extra_stream, bmpuri); shareintent.settype("image/*"); // launch sharing dialog image startactivity(intent.cr

javascript - What is the node.js and its purpose? -

this question has answer here: what node.js? [closed] 10 answers okay noob question. what node.js? what purpose , used? they server-side technology used perform parallel operations. google v8 parser , language javascript thought javascript not work on server-side. how node.js this? sorry tried answer couldn't find explanation of node.js. don't quite node.js these posts either: what node.js? what node.js based on, under hood? node.js platform javascript language centered around asynchronous network programming. contains set of libraries develop server-side applications javascript under hood, node.js running on v8, javascript engine developed google. hope helps.

android - sharedPreference or onSaveInstanceState on an EditText/TextView result -

i have little test project below. want save edittext numbers entered , textview result (thing1, thing2, result) . what's best? onsaveinstancestate, sharedpreference, or different sqlite? i've frustratingly tried first 2 (for embarrassingly long), couldn't figure out. please adding code below? public class mainactivity extends actionbaractivity { edittext thing1; edittext thing2; textview result; double n1=0; double n2=0; double total=0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final button dividebutton = (button) findviewbyid(r.id.dividebutton); dividebutton.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { thing1 = (edittext) findviewbyid(r.id.thing1); if (textutils.isempty(thing1.gettext().tostring())) { n1 = 0;} else { n1= double.parsedoub

ruby on rails - MySQL polymorphic join condition with OR not using index -

i have tables departments , employees , , emails in mysql 5.6.17 (for rails app). each department has many employees, , both departments , employees have many emails. want sort departments number of emails entire department , individual employees within department. attempt: select departments.*, count(distinct employees.id) employees_count, count(distinct emails.id) emails_count departments left outer join employees on employees.department_id = departments.id , employees.is_employed = true left outer join emails on (emails.emailable_id = departments.id , emails.emailable_type = 'department') or (emails.emailable_id = employees.id , emails.emailable_type = 'employee') group departments.id order emails_count desc limit 20; unfortunately, query takes on 3 minutes complete. since query used in web interface, that's not workable timeframe. explain gives: +----+-------------+-------------+-------+-------

tomcat - "Update Resources" in IntelliJ deletes updated files from target directory -

short version when change resources in app, attempt hot-deploy them, files deleted instead of updated target/ directory , don't understand why. long version i have java 8 + tomcat 8 + spring boot + thymeleaf project i'm running out of intellij. when change files, such css files src/main/resources/static/css directory, , run update resources or update classes , resources , file deleted target/classes/static/css instead of updated. nothing printed in tomcat logs file, nothing printed in intellij logs (in ~/library/logs/intellijidea13/idea.log ) deleting file... disappears. tomcat 8 set external application server (not built-in spring boot embedded server) following config. thing i've customized in intellij run configuration setup have specified catalina_base same value "tomcat base", so: tomcat home: /usr/local/tomcat8 tomcat base: /path/to/my/catalina/base java env vars: catalina_base=/path/to/my/catalina/base ... if don't, catalina_base

How to read TermainsServices IADsTSUserEx Property from LDAP in C#? -

i have read following properties ad, terminalservicesprofilepath terminalserviceshomedirectory terminalserviceshomedrive i've tried directoryentry , directorysearcher. not include properties. i found example in vbscript , vc read them. failed make working in c#. missing tricky thing? edit: have run on "windows server" make works? can read win xp? i don't remember exactly, it's this: //user directoryentry iadstsuserex adsiuser = (iadstsuserex)user.nativeobject; then can terminalservices properties want via adsiuser. from experience you're better off developing on windows server access ad due libraries use. you'll make above work, :)

assembly - The codes below for printing calendar is working for texted mode. How can i make this calendar working in video mode? -

.model small .data instexit db "press key exit $" ;instant exit navb db "press b end or n next month: $" ;navigation instruction of january month nav db "press b previous month or n next month: $" ;navigation instruction of months between january , december nave db "press b previous month or n end: $" ;navigation instruction of december month ; setting of value 0 greeting db "welcome 2015 calendar$" ;greetings message displayed in beginning ------- jan db " january$ " ;whole january month string db "sun mon tue wed thu fri sat$" ;prints day string , string used througout months