Posts

Showing posts from August, 2014

calculator - how to add a decimal to a float value Objective C -

i trying create calculator , can't find proper code add decimal current code... suggestions? how number buttons work: - (ibaction)number9:(id)sender { number = number * 10; number = number + 9; _textbox.text = [nsstring stringwithformat:@"%i", number];} and example of how methods work. - (ibaction)multbutton:(id)sender { if (hiddensum == 0) { hiddensum = number; } else { switch (method) { case 1: hiddensum = hiddensum + number; break; case 2: hiddensum = hiddensum - number; break; case 3: hiddensum = hiddensum * number; break; case 4: hiddensum = hiddensum / number; break; default: break; }} method = 3; number = 0; } if need cast integer float value can use plus operator on them help, not sure if asked cast. your code shows number integer , pretty sure result of calculations should floa

HHVM extension, How to return class -

i declare method variant: variant hhvm_method(myclass1, get) { object ob; ob.o_set(s_propertyname1, value1, s_myclass2 ); ob.o_set(s_propertyname1, value2, s_myclass2 ); return variant(ob); } php code: $c = new myclass1(); var_dump($c->get()); // return stdclass how create , return myclass2: var_dump($c->get()); // must return myclass2 when creating object , need pass in pointer class object. variant hhvm_method(myclass1, get) { object ob{unit::loadclass(s_myclass2.get()}; ob.o_set(s_propertyname1, value1, s_myclass2 ); ob.o_set(s_propertyname1, value2, s_myclass2 ); return ob; } you can see being used in datetime::createfromformat

Auto-resize background-image to fit smaller windows and mobile devices - HTML/CSS -

although there many answers question, cannot find 1 fits needs. when use site on mobile, or make browser window on laptop small, lose full image i'm using background-image. html: <div class="compete"> <div class="container"> <h2>compete</h2> <p>winners win</p> </div> </div> css: .compete{ background-image:url('handlebars.jpg'); height:450px; background-repeat: no-repeat; background-size: cover; border-bottom:1px solid #ff6a00; } .compete .container { position:relative; top:40px; } any ideas on how keep using backgrond-image , yet have auto-resize can see full image on mobile/small window? try setting background-size:100% 100% css .compete{ background-image:url('http://dummyimage.com/600x400/000/fff'); height:450px; background-repeat: no-repeat; background-size: 100% 100%; border-bottom:1px solid #ff6a00; } .compete .container { posit

scala - Insert or get in Slick 3 -

i trying insert if not exists, , row if does. come this: def saveorget(u: user) = (for { userget <- get(u.name).map(r => (r.id, r.active)).result.headoption id <- save(u) if userget.isempty } yield { userget match { case some((id, active)) => (user(some(id), u.name, active), false) case none => (user(some(id), u.name, u.active), true) } }).transactionally private def get(name: string) = users.filter(_.name === name).take(1) private def save(u: user) = users returning users.map(_.id) += u edit after making modifications, get: java.util.nosuchelementexception: action.withfilter failed regards try using case _ , because seems it's possible have empty rather none userget match { case some((id, active)) => (user(some(id), u.name, active), false) case _ => (user(some(id), u.name, u.active), true) }

search - Convex hull with constant size or triangular form -

i know quickhull algorithm runs in theta(n), if convex hull triangular or has constant size. what's means? i'm not sure shape (if looks triangle), because algorithm uses 4 extreme points. thanks if number of vertices of convex hull, let h , constant (doesn't depend on n ), quickhull takes time proportional n (more precisely c1.n < t < c2.n 2 constants c1 , c2 ). when h=3 , hull triangle. regardless way algorithm works, has return triangle. careful implementations should work h=2 (a line segment) or h=1 (a single point).

java - Header parse error after upgrade to Jetty 9.3 -

i'm having issue when change jetty distro 9.2 9.3. under 9.2 app works flawlessly when running same war file , connecting same client following error messages when running under 9.3: 015-08-30 14:55:32.174:warn:oejh.httpparser:qtp1100439041-12: illegal character 0x20 in state=header_in_name buffer heapbytebuffer@26dab36[p=62,l=654,c=8192,r=592]={post /api/v1/time...0.1:8080\r\nkey <<<info header: ...erica/toronto"}>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00} 2015-08-30 14:55:32.175:warn:oejh.httpparser:qtp1100439041-12: bad http parsed: 400 illegal character 0x20 httpchanneloverhttp@6765bf81{r=0,c=false,a=idle,uri=-} from understand, there illegal character in header, why 1 version throw error , other not? also using apache httpclient 4.4.1 send data. the upgrade jetty 9.2 9.3 meant entered in new world of http/1.1 updated specs , rfcs, , new http/2

r - Increasing all font sizes in ggvis -

Image
i'm looking ggvis equivalent of ggplot2 function call: theme(text=element_text(size=20)) let's take simple graph made ggvis: mtcars %>% add_rownames() %>% ggvis(~mpg, ~disp, fill = ~vs) %>% layer_text(text := ~rowname) there font sizes axis titles, tick labels, text layer, legend title, , legend tick labels . in svg, of these font sizes set in element: here, example, 1 of labels in legend: <text x="3" y="36" text-anchor="start" dy=".9em" style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-family: sans-serif; fill: #000000; opacity: 1;">0.0</text> notice font-size: 10px; . prevents me modifying font size via css in page svg embedded. is there global way of stripping fontsizes elements, can use css? or there way increase fontsizes via ggvis?

maven - Fail to copy with Jenkins (MDEP-187) -

Image
i'm using jenkins build jenkins code in github repository i'm having problem: [info] [info] ------------------------------------------------------------------------ [info] building jenkins war 1.626 [info] ------------------------------------------------------------------------ [info] [info] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jenkins-war --- [info] deleting c:\program files (x86)\jenkins\workspace\jenkins_scc12_test\war\target [info] [info] --- maven-enforcer-plugin:1.0.1:enforce (enforce-maven) @ jenkins-war --- [info] [info] --- maven-enforcer-plugin:1.0.1:display-info (display-info) @ jenkins-war --- [info] maven version: 3.3.3 [info] jdk version: 1.7.0_79 normalized as: 1.7.0-79 [info] os info: arch: amd64 family: windows name: windows 8.1 version: 6.3 [info] [info] --- maven-enforcer-plugin:1.0.1:enforce (default) @ jenkins-war --- [info] adding ignore:

c# - wpf forms not displaying images -

i using vs 2013 , designing wpf form. problem when design button image displays when run project isn't displaying images on button. code <button x:name="btncommunication" margin="428,138,448,338" click="btncommunication_click" width="auto" foreground="#ff007eff"> <button.style> <style targettype="{x:type button}"> <setter property="background" value="purple"/> <setter property="template"> <setter.value> <controltemplate targettype="{x:type button}"> <border background="{templatebinding background}"> <contentpresenter horizontalalignment="center" verticalalignment="center"/&g

Getting Javascript variable value in PHP Variable using Ajax -

i want store latitude , longitude values in php variables, unable so. here code. can me out here why these values not getting stored in php variables: code: <!doctype html> <html> <body onload="getlocation()"> <p id="demo"></p> <script> var x = document.getelementbyid("demo"); function getlocation() { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(showposition); } else { x.innerhtml = "geolocation not supported browser."; } } function showposition(position) { x.innerhtml = "latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude; var lat = position.coords.latitude; var longt = position.coords.longitude; $.ajax({ type: 'post', data: { latitude : lat, longitude : longt }, }); } </script> <?php $var = isset($_post['

java - Grouping objects based on overlapping time interval -

i have class, class a{ ... private interval interval; ... } //maintaining epoch time class interval{ private long left; private long right; public interval(long left, long right){ this.left = left; this.right = right; } //getters , setters } i have list of objects list<a> , want group objects have overlapping(transitive overlapping, i.e. a = b, b = c = c ) intervals. lets suppose have 4 objects, a1 - interval - 09:00 10:00 a2 - interval - 13:00 14:00 a3 - interval - 10:10 12:00 a4 - interval - 09:30 10:30 the result of program should give me 2 lists, list1 - a1,a3,a4 list2 - a2 any suggestions on solving issue and/or pseudo-code? sorry verbosity, believe question merits :-) . solution n*log(n) in number of intervals. location complexity occurs within sorting of intervals. note solution takes care include cases 1 interval contained inside another. result groups have sub-intervals reverse ordered, can fix if r

javascript - Why getScript does not work from an external script? -

i trying google recaptcha script loaded with $.getscript("https://www.google.com/recaptcha/api.js?onload=onloadcallback&render=explicit"); if put <script> tags , inline webpage, loades captcha correctly, while if include getscript, inside external .js file still hosted on same domain javascript recaptcha not loaded. problem script or getscript ? the script you're calling rendered when 'onload' event fires. (function() { if (!window['___grecaptcha_cfg']) { window['___grecaptcha_cfg'] = {}; }; if (!window['___grecaptcha_cfg']['render']) { // if render time isn't set, set (window) onload // window['___grecaptcha_cfg']['render'] = 'onload'; }; window['__google_recaptcha_client'] = true; var po = document.createelement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://www.gstatic.com/re

c++ - Isn't std::endl redundant? -

flush happens in following cases: std::cerr std::cin program termination in many implementations, standard output line-buffered, meaning "\n" flushes anyway so seems in regular programs, std::endl unnecessary, it's used everywhere. so seems in regular programs, std::endl unnecessary, it's used everywhere. no it's not redundant , since implementation of flushing along '\n' isn't mandated standard. that's implementation specific behavior, while behavior of std::endl defined.

mysql - SQL - Selecting data that is the same in multiple rows for a particular key -

i have dataset below: key user step --------------------- 123 geoff 1 123 geoff 2 123 john 3 456 jane 1 456 jane 2 456 jane 3 456 jane 4 what need select key user same in steps (there can between 1 5 steps in dataset). in example above need query return key 456. appreciated! instead of comparing min(user) , max(user) , can well: select tablename.key tablename group tablename.key having count(distinct d.user) = 1; count(distinct d.user) should more descriptive use case.

php - Remote Upload Amazon S3 -

i have made script upload remote files link amazon s3 not work. have no idea what's wrong. below code done , i'm using amazon sdk in latest version: config.php <?php return [ 's3' => [ 'key' => 'mykey', 'secret' => 'mykey', 'bucket' => 'mybucket', 'region' => 'us-west-2', 'version' => 'latest' ] ] ?> start.php <?php use aws\s3\s3client; require 'aws/aws-autoloader.php'; $config = require('config.php'); //s3 $s3 = s3client::factory([ 'key' => $config['s3']['key'], 'secret' => $config['s3']['secret'], 'region' => $config['s3']['region'], 'version' => $config['s3']['version'] ]); ?> upload.php <?php use aws\s3\exception\s3exception; require 'start.php

Unequivalent loop structure in MATLab -

i have 2 versions of code - wrote second (more explicit) loop when first didn't wanted. where did go wrong? suspect slicing problem (as in, i'm not correctly slicing data out) the first version, doesn't want, commented out above loop: rbool = false(h.numdirs, h.numtimes, h.numr); d = 1:h.numdirs u_first = h.data(d,1,:); u_first = u_first{1}; t = 2:h.numtimes u = h.data(d,t,:); u = u{1}; du = abs(u-u_first); %rbool(d,t,:) = (du > (smallval*u_first) | rbool(d,t-1)); r=1:h.numr rbool(d,t,r) = (du(r) > (smallval*u_first(r))| rbool(d,t-1,r)); end end end you missing third index of second rbool in commented line: rbool(d,t,:) = (du > (smallval*u_first) | rbool(d,t-1,:)); although i'd parenthesize this: rbool(d,t,:) = (du > (smallval*u_first)) | rbool(d,t-1,:); the version had implicitly assumed r==1 , think. and can simplify code setting u = h.data{d,t,1

c++ - Why not call nullptr NULL? -

in c++11 nullptr keyword added more type safe null pointer constant, since previous common definition of null 0 has problems. why did standards committee choose not call new null pointer constant null , or declare null should #define d nullptr ? stephan t. lavavej (member of c++ standard committee) explained once in talk (55:35): while implementation allowed #define null nullptr , break quite uses like int = null; and apparently there plenty of those. not force change.

android - loading radiogroups from sqlite database -

i can't seem radiogroups populate based on below code. once cursor runs against database below output: cursor data = db.getreadabledatabase().query(db.mytable, mycolumns, db.userid + "= ?", new string[]{string.valueof(user1)}, null, null, null); data.movetoposition(position); checkx = data.getint(data.getcolumnindex(db.value)); log.d("checkedid", "checkedid: " + checkx); 1 1 1 1 1 based on need first radiobutton checked each time. here current switch statement, nothing gets checked. if(checkx > 0) { switch (checkx) { case 1: group.check(r.id.a1); break; case 2: group.check(r.id.a2); break; case 3: group.check(r.id.a3); break; case 4: group.check(r.id.a4); break; } } programmatically, can use setchecked method

go - Wikipedia url stopped after 10 redirects error GoLang -

upon executing http request, receive following error: 2015/08/30 16:42:09 https://en.wikipedia.org/wiki/list_of_s%26p_500_companies: stopped after 10 redirects in following code: package main import ( "net/http" "log" ) func main() { response, err := http.get("https://en.wikipedia.org/wiki/list_of_s%26p_500_companies") if err != nil { log.fatal(err) } } i know according documentation, // issues specified url. if response 1 of // following redirect codes, follows redirect, // maximum of 10 redirects: // // 301 (moved permanently) // 302 (found) // 303 (see other) // 307 (temporary redirect) // // error returned if there many redirects or if there // http protocol error. non-2xx response doesn't cause // error. i hoping knows solution in case. seems rather odd simple url results in more ten redirects. makes me think there may more going on behind scenes. thank you. as others have point

ruby - [promethues, rails]How to enable promethues on rails server -

i have live rails application. and trying install prometheus monitoring service , ruby client i running on server thses tutorial. it working good! but after hours these merics url died. how working on live server? if adding exist project. below, promethus not found error i, [2015-08-31t10:54:40.274066 #3542] info -- : refreshing gem list /path/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- prometheus/client/rack/collector (loaderror) /path/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require' /path/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency' /path/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require' config.ru:8:in `block in <main>' /path/shared/bundle/ruby/2.2.0/gems/rac

c++ - Find the smallest number in an array and the position it is -

i have code, , want find smallest number , in position in array 3x3,how do that? #include <stdio.h> int main() { int a[3][3]; int i,j; int min; min=0; for(i=0;i<3;i++) { printf("\n"); for(j=0;j<3;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(a[i][j]>=min) min=a[i][j]; } printf("\n"); printf("%d\n",min); } } try this #include < stdio.h > #include < limits.h > int main() { int a[3][3]; int i, j; (i = 0; < 3; i++) { printf("\n"); (j = 0; j < 3; j++) { scanf("%d", &a[i][j]); } } int min = int_max, y = -1, x = -1; (i = 0; < 3; i++) { (j = 0; j < 3; j++) { if (a[i][j] < min) { min = a[i][j]; y = i; x = j; }

php - Converting array to JSON string when array already contains JSON strings -

i have array contains json string. array ( [0] => array ( [name] => original [nutrients] => {"calories":{"value":2500,"operator":2},"protein":{"value":500,"operator":1},"carbs":{"value":200,"operator":0},"fat":{"value":50,"operator":0},"sugar":{"value":1,"operator":2}} ) [1] => array ( [name] => rest [nutrients] => {"calories":{"value":5000,"operator":2},"sugar":{"value":10,"operator":2}} ) ) i want turn whole array json string echo json_encode($array); but throws \ in front of quotes [{"name":"original","nutrients":"{\"calories\":{\"value\":2500,\"operator\":2},\"protein\":{\"val

Linking WPF object to C# styling -

i'm using treelist control devexpress. i'm trying color in cells based on value. got code structure here . however, c# function not seem linked wpf object. how can link handles treelist.nodecellstyle event? sample code private void treelist1_nodecellstyle(object sender, getcustomnodecellstyleeventargs e) { // modify appearance settings used paint "budget" column's cells // values greater 500,000. if (e.column.fieldname != "budget") return; if (convert.toint32(e.node.getvalue(e.column.absoluteindex)) > 500000) { e.appearance.backcolor = color.fromargb(80, 255, 0, 255); e.appearance.forecolor = color.white; e.appearance.font = new font(e.appearance.font, fontstyle.bold); } } sample wpf <dxt:treelistcontrol name="treelist"> <dxt:treelistcontrol.columns> <dxt:treelistcolumn fieldname="clientid" header="heirarchy"/> <dxt:treelistcolumn fiel

Dynamic models using ng-if - AngularJS form -

here code: as can see, displayed if q.answer == 'fail' - value of select box further in page. if "fail" has been selected, user can select defect type saved question.failure.type . my question is, if user selects "fail" , selects defect type - , changes "fail" else. question.failure.type still retained, though ng-if false now. how can make question.failure.type no longer in model if ng-if false? <div class="panel panel-danger" ng-if="q.answer == 'fail'"> <div class="panel-heading"> <h3 class="panel-title">comments</h3> </div> <div class="panel-body"> <form novalidate name="failureform"> <div class="row"> <div class="col-xs-12"> <select name='defect' class='form-control' ng-model='question.failur

osx - How can I find the xnu version that corresponds to a particular OS X release? -

i'm attempting find list of supported syscalls in old version of os x. for each version of xnu kernel, there syscalls.master file gives me want (for example, here 1 xnu 2782.20.48). can see current xnu version uname -a . don't know how find version of xnu included in historical releases of os x. is there list somewhere mapping os x version number (e.g. 10.9.0) or build number xnu version number? not perfect, can work out apple open source release listings at: http://www.opensource.apple.com/ for each release linked (eg http://www.opensource.apple.com/release/os-x-10105/ osx 10.10.5), have link towards bottom of page xnu version release (eg, xnu-2782.40.9). @pajp has gone effort of converting these tarballs useable git repo at: https://github.com/aosm/xnu with appropriate tagging osx release , xnu version, use put listing.

python to mysql unknown column in try exception -

i want select or insert mysql using python 3.2 , mysql.connector.. import mysql.connector filename = "t1.15231.0337.mod35.hdf" try: cnx = mysql.connector.connect(user='root', password='', database='etl') cursor = cnx.cursor() cursor.execute('select * hdf_file nama_file = %s',filename) rows = cursor.fetchall () if rows == []: insert_hdf = cursor.execute('insert hdf_file values(%s,null,now(),null,null,now())',filename) cursor.execute(insert_hdf) cnx.commit() cursor.close() cnx.close() except mysql.connector.error err: print("something went wrong: {}".format(err)) but said that: unknown column 'filename' in clause have tried put this: cursor.execute('select * hdf_file nama_file = filename') but got same error... when using cursor.execute() parameterised queries query arguments passed sequence (e.g. list, tuple) or dictionary if using named parameters. code passes str

Adding upper case letter only constraint in SQL Server -

create table employeestatistics ( employeeidno int, name varchar(30), salary integer, benefits integer, position varchar(25), allowance integer, dateofbirth integer, telephone integer, primary key (employeeidno) ); i want position accept upper case letters. constraint add? alter table employeestatistics #add constraint you can use check constraint compare value upper case value using binary collation or case sensitive collation. alter table dbo.employeestatistics add constraint ck_employeestatistics_position check (upper(position) = position collate latin1_general_bin2)

Python - injecting data into for loop -

i have following list: users = [ "user1", "user2", "user3" ] and have loop, loops through another list : for item in ids: myfunction(item, user) # ??? i'm not sure how make loop. want to is, each item loop goes through, should execute myfunction(item, user) , user variable should user users list, , each item, user should not same (when gets end of users list, may come user1, , repeat loop). it should execute this: myfunction(item, "user1") myfunction(item, "user2") myfunction(item, "user3") how can achieve this? thank you for counter, item in enumerate(ids): user = users[counter % len(users)] myfunction(item, user)

Ruby on rails error rake db:migrate -

whenever run rake db:migrate rails_env=development returns syntax error rake aborted! syntaxerror: /users/isaiahxd/.rvm/gems/ruby- 2.2.1@rails3tutorial/rails_projects/first_app/db/migrate/20150825050353_create_u sers.rb:21: syntax error, unexpected keyword_end, expecting end-of-input /users/isaiahxd/.rvm/gems/ruby-2.2.1/gems/activesupport- 4.2.3/lib/active_support/dependencies.rb:274:in `require' /users/isaiahxd/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require' /users/isaiahxd/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency' /users/isaiahxd/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require' /users/isaiahxd/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:773:in `load_migration' /users/isaiahxd/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:76

java - Selection of Open GL2 ES image fragment -

i have library render opengl image on glsurfaceview. library include method takes rectangle argument. how can instrument select fragment (portion) of opengl image ? code render image using library: public void ondrawframe(gl10 gl) { if (mloaded != true && mwidth != 0 && mheight != 0) { mcontextcreated = true; cloudjni.init(); cloudjni.open(mfile); cloudjni.createrenderer(mwidth, mheight); mloaded = true; } if (mcontextcreated == true) { if (!cloudjni.renderframe()) { gles20.glclearcolor(0.0f, 1.0f, 0.0f, 0.0f); gles20.glclear(gles20.gl_color_buffer_bit); } } }

css - Only eleven coloumns fit in boostrap rows -

i have had problem in several occasions , cannot find reason. i have container, row , few boxes (divs) in it. have 2 boxes in row, 1 side menu , 1 content. problem use column width of 10 content, pushed next row (9 fine) , 2 boxes won't stand side side (there of course contents in boxes). happens both normal , fluid containers. <div class="container-fluid"> <div class="row"> <div id="module-menu" class="col-lg-2"></div> <div id="content" class="col-lg-10"></div> </div> </div> i checked of above divs (with firebug) see whether css file overrides (padding, margin etc.) on them, causing problem. apparently no property has been overridden on above divs. could guess what's wrong , how can find problem? instead assigning id's , classes columns make div inside of them. have clean grid system works. <div class="contain

ajax - ERR_CONNECTION_REFUSED in Chrome while loading jQuery DataTable server side -

related this post , i'm getting error ( f12 > network ) while trying load jquery datatable in chrome. failed load resource: net::err_connection_refused the table doesn't load data. although doesn't work in other browsers either. disabled extensions (adblock included) still nothing. maybe related internet options in windows?

java - How to solve IllegalArgumentException? -

i have application uses classloader , reflection load , invoke methods. @ runtime receive exception : java.lang.illegalargumentexception : object not instance of declaring class . here code: file operatorfile = new file(operatorspath); url operatorfilepath = operatorfile.tourl(); url[] operatorfilepaths = new url[]{operatorfilepath}; classloader operatorsloader = new urlclassloader(operatorfilepaths); class operatorinterface = operatorsloader.loadclass("operator"); filenamefilter filterdotclass = new filenamefilter() { public boolean accept(file dir, string name) { return name.endswith(".class"); } }; file[] operatorfiles = new file(operatorspath).listfiles(filterdotclass); class[] operatorclass = new class[operatorfiles.length-1]; int index = 0; method methodsinoperator; object instance; string operatorsign; map<string , object> operatormap = new hashmap<string , object>(); (file oprfile : operatorfiles)

android - PendingIntent null when trying to call it from a class -

im bulding alarm clock, , got pendingintent should snooze alarm. same code worked great when in activity. change things, , in different class. nullpointerexecption. (the contractor gets context activity. snooze function: public void settingnewintentforsnooze() { pendingintent alarmpendingintent=null; calendar calendar = calendar.getinstance(); // new alarm after snooze. calendar.set(calendar.minute, calendar.get(calendar.minute) + snoozetime); intent snoozeintent = new intent(context, alarm_reciver.class); snoozeintent.putextra("click_status", true); //add try solve problem... snoozeintent.setaction("snooze"); alarmpendingintent = pendingintent.getbroadcast(context, 0, snoozeintent, alarmpendingintent.flag_one_shot); //tells phone set alarm alarm_manager.set(alarmmanager.rtc_wakeup, calendar.gettimeinmillis(), alarmpendingintent); } alarmpage activity(the code creats variable) : snooze= new snooze(this,alarm_ma

win universal app - How to implement DiAL Protocol in WinJS? -

Image
i have tried this var dialdevicepicker = new windows.media.dialprotocol.dialdevicepicker(); var rect = { width:200, height:200, x:0, y:0 } dialdevicepicker.show(rect); finally got popup searching devices, message in saying disconnect first. have searched universal samples in github . but, found csharp example , not in javascript. can 1 me in implementing dial protocol casting videos app chromecast? i have added image reference

javascript - get undefined in angular -

i starting study on angular. created first plunker today , used angularjs 1.4 tempalate. getting error person not defined what wrong code var app = angular.module('plunker', []); app.controller('mainctrl', function($scope) { var person = { firstname: "kiran", lastname: "nandedkar" }; $scope.name = 'world'; $scope.person = person; }); here plunker update not sure why question downvoted. trying in chrome browser , not working. tried on mozilla , working. its working fine. code absolutely correct. <p>hello {{person.firstname}}!</p> test code on html page

Android - Save data from WebView -

currently using webview in application load webpage. have loaded following webpage url in webview : http://domain_name/app/ if user not logged in url redirected url login url. here login url: http://domain_name/app/index.php?r=site/login after user enter username , password redirected following url: http://domain_name/app/index.php?r=site/homepage when user logged in homepage shown user. my problem when application removed recent list login data lost , application redirected login screen. i have 1 way solve issue. first give login page url after successful user login change url homepage url instead of login page url. is there other way solve issue or way save login data application storage? before load page use: cookiemanager.getinstance().setacceptcookie(true); if won't work read cookiesyncmanager synchronize browser cookie store in ram , permanent storage. for lollipop , above should enough: cookiemanager.getinstance().setacceptthirdpar

jsf - How to reference CSS / JS / image resource in Facelets template? -

i've done tutorial facelets templating . now i've tried create page isn't in same directory template. i've got problems page style, because of styles referenced relative path so: <link rel="stylesheet" href="style_resource_path.css" /> i can use absolute referencing starting / : <link rel="stylesheet" href="/project_root_path/style_resource_path.css" /> but bring me troubles when i'll moving application different context. so i'm wondering best way reference css (and js , image) resources in facelets? introduction the proper jsf 2.x way using <h:outputstylesheet> , <h:outputscript> , <h:graphicimage> name referring path relative webapp's /resources folder. way don't need worry context path in jsf 1.x. see how include css relative context path in jsf 1.x? folder structure drop css/js/image files in /resources folder of public webcontent below (just cre

c++ - What is an undefined reference/unresolved external symbol error and how do I fix it? -

what undefined reference/unresolved external symbol errors? common causes , how fix/prevent them? feel free edit/add own. compiling c++ program takes place in several steps, specified 2.2 (credits keith thompson reference) : the precedence among syntax rules of translation specified following phases [see footnote] . physical source file characters mapped, in implementation-defined manner, basic source character set (introducing new-line characters end-of-line indicators) if necessary. [snip] each instance of backslash character (\) followed new-line character deleted, splicing physical source lines form logical source lines. [snip] the source file decomposed preprocessing tokens (2.5) , sequences of white-space characters (including comments). [snip] preprocessing directives executed, macro invocations expanded, , _pragma unary operator expressions executed. [snip] each source character set member in character literal or string literal, e

vbscript - how to rename image file name while uploading on web folder -

i m using asp classic. want rename image file while upload image on web folder created me. please me out of issue. if there file in targeted folder same name (like lokesh.jpg) uploading, new file should b automatically renamed(like lokesh(1).jpg) instead of overwriting my code below: upload.asp <% class fileuploader public files private mcolformelem private sub class_initialize() set files = server.createobject("scripting.dictionary") set mcolformelem = server.createobject("scripting.dictionary") end sub private sub class_terminate() if isobject(files) files.removeall() set files = nothing end if if isobject(mcolformelem) mcolformelem.removeall() set mcolformelem = nothing end if end sub public property form(sindex) form = "" if mcolformelem.exists(lcase(sindex)) form = mcolformelem.item(lcase(sindex)) end property public default sub upload() dim bidata, sinputname dim nposbegin, nposend, npos, vdatabounds, ndataboundpos dim nposfile, n

java - Is there any option to give multiple properties of any element in Selenium Webdriver? -

i have selenium webdriver script written in java language need run in multiple sites. script written 1 site other sites follow the same architecture , element properties in sites same. script work fine in sites. problem that, element properties might different in site. there option in selenium webdriver can pass multiple properties element. something like string elemprop = "prop1|prop2|prop3" // properties separated pipe driver.findelement(by.id(elemprop)).click(); so when execute, selenium webdriver should first check prop1 prop2 , prop3. i have seen feature in rational functional tester. wanted know if selenium webdriver gives feature ? thanks. if mean check multiple properties , 1 of these properties suitable current specific website's element, may try this(in java): string xpath = "//*[@id='id1' or @id='id2' or @id='id3']"; driver.findelement(by.xpath(xpath));

How to join rows and cols in google spread sheets -

here 4 cells this. b 1 b 2 c d i want join them , , ¥n. c1 => a,b¥nc,d how can functions google spread sheets have , without javascript? https://support.google.com/docs/table/25273?hl=en see if works: =arrayformula(substitute(join("¥n", query(trim(transpose(a1:b2)),,rows(a1:a2)))," ", ", ")) the query() creates output of 2 cells values of each row joined, separated space. (note use of optional headers argument, set number of rows. then these 2 cells joined "¥n". finally spaces substituted comma.

javascript - How to make string concatenation work with Nashorn's JSObject -

intention i'm using java 8u60 ( not 8u51, important!) , working nashorn javascript engine. created own jsobject extending abstractjsobject . it's supposed wrap org.json.jsonobject , make work actual javascript object in script engine. given javaapi java object put scriptcontext , resulting object should usable this: var jsonobject = javaapi.dosomethingthatreturnsajsonobject(); var foo = jsonobject.foo jsonobject.foo = "bar"; delete jsonobject.foo; var message = "json: " + jsonobject; code public class jsonobjectjavascriptadapter extends abstractjsobject { private final jsonobject jsonobject; public jsonobjectjavascriptadapter(final jsonobject jsonobject) { this.jsonobject = jsonobject; } @override public void removemember(string name) { jsonobject.remove(name); } @override public void setmember(string name, object value) { jsonobject.put(name, value); } @override public