Posts

Showing posts from April, 2010

java - a method that recieves String input and divides it into 1,2 and 3 different sections -

java - a method that recieves String input and divides it into 1,2 and 3 different sections - i need more basic method! split words 1,2,3 consecutive compartments, output "water" should in terms of array string! e.g input of water should produce output {"w","a","t","e","r","wa","at","te","er","wat","ate","ter"} public void split(string word) { int x=(word.length())/2; int z=word.length(); string[] partition= new string[5]; (int i=0; i<x; i++){ string new1=character.tostring(word.charat(i)); string new2 = character.tostring(word.charat(i))+character.tostring(word.charat(i+1)); string new3 = character.tostring(word.charat(i))+character.tostring(word.charat(i+1))+character.tostring(word.charat(i+2)); string new4 = removeduplicate(character.tostring(word.charat(z-2))+ character.tostring(word.charat(z-1)));

java web service cannot capture post parameter from jquery post -

java web service cannot capture post parameter from jquery post - client: var info = "username=david"; $.post("/s/test", data, function(result) { alert(result); }); server: @post @path("/test") @produces(mediatype.text_plain) public string test(@formparam("username") string username) { homecoming "your username " + username; } the username null $formparam. however, if post form: <form method="post" action="/s/test"> <input type="text" name="username" value="david" /> <button type="submit">submit</button> </form> the value can captured correct. really don't know why. new findings: happen jquery 2.1, 1.6 ok. newer findings: utilize gf 3.1.2.2 solve issue well, however, gf 4 has issue. java jquery ajax web-services

android - onActivityResult not being called after FragmentActivity -

android - onActivityResult not being called after FragmentActivity - i have activity calls activity b (fragmentactivity) using startactivityforresult() . before activity b finishes calling finish() , utilize setresult() . in spite of of this, onactivityresult() not called. i'm not sure i'm doing wrong i'm not doing unconventional, or if android bug. seeing of suggestions on here, i've checked see don't have android:launchmode="singleinstance" nor android:nohistory="true" set anywhere in manifest file. calling activity b a: intent intent = new intent(getactivity(), activityb.class); startactivityforresult(intent, my_result); finishing activity b: intent intent = new intent(); setresult(activity.result_ok, intent); finish(); overriding onactivityresult() in activity a: @override public void onactivityresult(int requestcode, int resultcode, intent data){ toast.maketext(getapplication

format - Sublime Text 2 Package for ejs formatting -

format - Sublime Text 2 Package for ejs formatting - i looking bundle functionality auto format ejs files. have installed htmlprettify. possible add together ejs html format format html code? sufficient purpose. add .jsbeautifyrc file allowed_file_extensions "ejs" : { "html": { "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "ejs"], "brace_style": "collapse", // "expand", "end-expand", "expand-strict" "indent_char": " ", "indent_handlebars": false, // e.g. {{#foo}}, {{/foo}} "indent_inner_html": false, "indent_scripts": "keep", // "separate", "normal" "indent_size": 4, "max_preserve_newlines": 10, "preserve_newlines": true, "unformatted": ["a", "sub", "

c# - npoi vertical alignment center -

c# - npoi vertical alignment center - i've tried dozen ways , nil works. seek apply vertical alignment center. nothing seems working. i'd appreciate help. here code: var workbook = new hssfworkbook(); var sheet = workbook.createsheet("zmiana " + i.tostring()); var headerrow = sheet.createrow(0); headerrow.createcell(0).setcellvalue("data"); headerrow.createcell(1).setcellvalue("maszyna"); headerrow.createcell(2).setcellvalue("zmiana"); headerrow.createcell(3).setcellvalue("brygadzista"); int rownumber = 1; list<machinestatusreport> listforoneshift = list.where(c => c.zmiana == i).tolist(); foreach (machinestatusreport elements in listforoneshift) { var row = sheet.createrow(rownumber++); row.createcell(0).setcellvalue(date.toshortdate

haskell - Need a basecase for returning position in a list -

haskell - Need a basecase for returning position in a list - data sudoku = sudoku [[maybe int]] blank :: sudoku -> pos blank (sudoku rs) = [(y,x) | (r,y) <- rs `zip` [0..8], (c,x) <- r `zip` [0..8], c == nothing] !! 0 blank returns first position nothing . if not nothing , homecoming reasonable, not error! how that? output: main> blank illustration (0,2) main> blank sud *** exception: prelude.(!!): index big (sud contains no nothing) example = sudoku [ [just 3, 6, nothing, nothing, 7, 0, 2, nothing, nothing] , [nothing, 5, nothing, nothing, nothing, nothing, 1, 8, nothing] , [nothing, nothing, 9, 2, nothing, 4, 7, nothing, nothing] , [nothing, nothing, nothing, nothing, 1, 3, nothing, 2, 8 ] , [just 4, nothing, nothing, 5, nothing, 2, nothing, nothing, 9 ] , [just 2, 7, nothing, 4, 6, nothing, nothing, nothing, nothing] , [nothing, nothing, 5, 3, nothing, 8, 9, nothing, nothi

android - How to post pameters with authentication in http post with specific key values pair? -

android - How to post pameters with authentication in http post with specific key values pair? - try { string auth = android.util.base64.encodetostring((“username” + ":" + “password”).getbytes("utf-8"), android.util.base64.no_wrap); httpparams httpparameters = new basichttpparams(); httppost request = new httppost(“url” + ” ? action = xxx”); request.addheader("authorization", "basic " + auth); httpparameters.setparameter("password", "xxxx"); httpparameters.setparameter("email", "xxxxxxx"); httpconnectionparams.setsotimeout(httpparameters, socket_timeout_ms); httpclient client = new defaulthttpclient(httpparameters); httpresponse response = client.execute(request); string userauth = entityutils.tostring(response.getentity()); log.i("", "data. in login.." + userauth); } grab (exception e) { log.i("", "error.." + e); } here, set per ou

javascript - Horizontal accordion plugin: working with each container individially -

javascript - Horizontal accordion plugin: working with each container individially - i trying create jquery plugin, here finish code. question is: need alter in plugin work each container individual? ;(function ( $, window, document, undefined ) { // create defaults 1 time var pluginname = 'accordion', defaults = { propertyname: "value" }; // actual plugin constructor function plugin( element, options ) { this.element = element; this.options = $.extend( {}, defaults, options) ; this._defaults = defaults; this._name = pluginname; this.init(); } plugin.prototype.init = function () { activeitem = $("li").first(); $(activeitem).addclass('active'); $(".tab").click(function(){ $(activeitem).animate({width: "41px"}, 500); $(activeitem).removeclass('active'); $(thi

c# - Can I use the ? : syntax to decide what my method returns -

c# - Can I use the ? : syntax to decide what my method returns - i have action method in webapi executes sql: var sql = @"update usertestquestion set answergridresponses = @answergridresponses, answered = 1 usertestquestionid = @usertestquestionid , userid = @userid;"; var parameters = new sqlparameter[] { new sqlparameter("@createdby", createdby), new sqlparameter("@answergridresponses", answergridresponses), new sqlparameter("@testquestionid", testquestionid) }; var rc = await db.database.executesqlcommandasync(sql, parameters); if (rc > 0) { homecoming ok(rc); } else { homecoming badrequest(); } it's understanding executesqlcommandasync homecoming number indicate how many rows changed. added check rc > 0 . is there way without need of {} . thinking of using ? : operators, think these work setting value , not returns using. y

javascript - add border to the outer area of slice in pie -

javascript - add border to the outer area of slice in pie - http://jsfiddle.net/wm7pwl2w/8/ how can add together border outer area of piece in pie? please check jsfiddle. have implemented polar area chart here. need each border of different color can specify. illustration refer image var canvas = document.getelementbyid("canvas"); var ctx = canvas.getcontext('2d'); console.log(ctx); var center = { x: 200, y: 150 }; var mycolor = ["#ccc", "#ccc", "#ccc", "#ccc", "#c01c3f"]; var mydata = [20, 40, 50, 70, 100]; var myradius = [150, 120, 80, 100, 70]; var mydistance = [5, 5, 2, 2, 2]; var mytext = ['first', 'second', 'third', 'fourth', 'fifth']; function gettotal(data) { var mytotal = 0; (var j = 0; j < data.length; j++) { mytotal += (typeof data[j] == 'number') ? data[j] : 0; } homecoming mytotal; } function plotdata() { var lastend = 0; var mytotal =

ios8 - MPMoviePlayer won't play using Swift -

ios8 - MPMoviePlayer won't play using Swift - i have mpmovieplayer won't play. don't know what's wrong code. i'm positive fileurl there. responses in advance! movieplayer = mpmovieplayercontroller(contenturl: fileurl) movieplayer.preparetoplay() self.view.addsubview(movieplayer.view) movieplayer.setfullscreen(true, animated: true) movieplayer.play() i hope fileurl right seek this, declare movieplayer outside func viewdidload() var movieplayer = mpmovieplayercontroller() to test set code in func viewdidload() movieplayer = mpmovieplayercontroller(contenturl:fileurl) movieplayer.view.frame = uiscreen.mainscreen().bounds self.view.addsubview(movieplayer.view) movieplayer.setfullscreen(true, animated: true) movieplayer.preparetoplay() movieplayer.play() movieplayer.controlstyle = mpmoviecontrolstyle.embedded swift ios8 mpmovieplayercontroller mpmovieplayer

sql - ODI Interface execution error -

sql - ODI Interface execution error - i have created simple odi interface read flat file , insert oracle table. however, when execute interface, fails in 1 of steps giving error message : ora-00936: missing expression the code generated step :- /* detection_strategy = not_exists */ insert /*+ append */ odi_stage.i$_csv_test ( firstname, lastname, ind_update ) select firstname, lastname, ind_update ( select c1_firstname firstname, c2_lastname lastname, 'i' ind_update odi_stage.c$_0csv_test (1=1) ) s not exists ( select 1 odi_stage.csv_test t , ((t.firstname = s.firstname) or (t.firstname null , s.firstname null)) , ((t.lastname = s.lastname) or (t.lastname null , s.lastname null)) ) can 1 please suggest wrong query? don't see syntactical issue it. what syntactically wrong query generated lkm used inserts operator , after the lastly clause. if re-create code sql develope

java - Calling javascript validation function before submiting and calling servlet -

java - Calling javascript validation function before submiting and calling servlet - i trying validate form , after calling servlet , fails because form doesn't validete. i' ve pasted code below. give me tips , help issue? class="snippet-code-js lang-js prettyprint-override"> function validateform() { if(document.frm.username.value=="") { alert("user name can not left blank"); document.frm.username.focus(); homecoming false; } else if(document.frm.pwd.value=="") { alert("password can not left blank"); document.frm.password.focus(); homecoming false; } } class="snippet-code-html lang-html prettyprint-override"> <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en"

css dropdown menu shifts website -

css dropdown menu shifts website - i have dropdown menu on website, , acting buggy, dropdown works, shifts whole website when hovered over. code pen http://codepen.io/anon/pen/uafdj #nav { } #nav { background: none repeat scroll 0 0 #585858; border-radius: 3px; height: 50px; margin-bottom: 10px; padding: 0; } #searchbar input[type=text] { background: none repeat scroll 0 0 #fff; border: 1px solid black; height: 25px; padding: 1px 1px 1px 5px; width: 230px; } #searchbar input[type="submit"] { background: none repeat scroll 0 0 #1abc9c; border: 1px solid #12ab8d; color: white; cursor: pointer; font-size: 14px; padding: 4px 15px; } #searchbar { margin-right:10px; } #nav ul { list-style: none outside none; margin: 0; padding: 0 0 0 10px; } #nav ul li { line-height:50px; float:left; } #nav ul li { line-height:50px; font-family:arial, helvetica, sans-serif; font-size:12px; font-weight:400;

menu - Wordpress wp_nav_menu not showing nav -

menu - Wordpress wp_nav_menu not showing nav - trying add together footer menu footer in wordpress, menu saved within database , i'm copying same code header working perfectly. can't see error: code is: <?php if ( has_nav_menu( 'footer_nav' ) ) { wp_nav_menu( array('container' => '<ul>', 'menu' => 'footer menu', 'items_wrap' => '<li>%1$s</li>' )); } ?> any help great you have give theme_location footer_nav , wp_nav_menu( array( 'theme_location'=>'footer_nav', 'container' => '<ul>', 'menu' => 'footer menu', 'items_wrap' => '<li>%1$s</li>' )); wordpress menu navigation footer

java - Inspecting ZooKeeper's state as it is running -

java - Inspecting ZooKeeper's state as it is running - so far way know how inspect state of zookeeper instance running code in client: for(string w: zk.getchildren("/workers", false)) { system.out.println("worker:" + w); } is there way can outside of programme @ will? able see finish listing or image of zookeeper state. 4 letter word command dump not list persistent nodes , when using jconsole, can see zookeeoer servers, not nodes. in o'reilly zookeeper book , online cannot find way inspect zookeeper's state, allow me know if know how. you can utilize zkcli tool ( zkcli.sh or zkcli.bat ) query zookeeper command line. covered in o'reilly book - see index. you can utilize zooinspector tool in zookeeper contrib directory. java apache telnet zookeeper jconsole

php - Can I blindly replace all mysql_ functions with mysqli_? -

php - Can I blindly replace all mysql_ functions with mysqli_? - i have used mysql_query() throughout project; i've learned mysql_ deprecated of php 5.5, has been removed in php 7. so, know if can replace mysql_ functions mysqli_ in project blindly? example, replacing mysql_query() mysqli_query() . there adverse effect? the short reply no, functions not equivalent. the news there converter tool help if you've got lot of calls/projects change. allow scripts work right away. https://github.com/philip/mysqlconvertertool it's forked version of oracle version, it's kosher. that said, it's not hard update code, , might want migrate object orientated methodology anyway ... 1) connection for intents , purposes, need new connection function saves connection php variable, example; $mysqli = new mysqli($host,$username,$password,$database); notice i've saved connection $mysqli . can save $db or whatever like, should utilize throughou

python 2.7 fastest dict acces for missing keys -

python 2.7 fastest dict acces for missing keys - if d dict, python docs provide method: dict.get = get(...) d.get(k[,d]) -> d[k] if k in d, else d. d defaults none. another famous pattern is: try: d[k]: except: d but in benchmarks (done timeit), have found next approach best: if k in d: d[k] else: d the try/except pattern fastest if no exceptions raised, if no exceptions raised, don't need pattern. need refactor code, written lot of .get()'s, because need squeeze performance on limited system. right or wrong? why try/except pattern recommended when looks it's slowest? looks d[k] if k in d else d pattern twice faster .get, @ to the lowest degree usages. .get $ python -m timeit -s 'd={}; k=xrange(0,100000)' 'd.get(k)' 10000000 loops, best of 3: 0.0934 usec per loop if/else $ python -m timeit -s 'd={}; k=xrange(0,100000)' 'd[k] if k in d else none' 10000000 loops, best of 3: 0

android - User Notifications - How to recover a lost notification_id from GCM? -

android - User Notifications - How to recover a lost notification_id from GCM? - i generate notification_key s described here. suppose due error fail store it, seek re-register. time receive 400 error message "notification_key exists" . looks odd, compared registration of device gcm, can register many times want , same registration id status 200. can't register again, , can't unregister, because don't have notification_id . is there way generated notification_key gcm? or way register 1 time again different notification_key_name ? based on docs, there no way gcm notification_key of existing notification_key_name . if think it, makes sense trying create new notification_key existing notification_key_name give error, since if wasn't case, might accidentally overwriting registration ids of existing notification_key if happen supply existing notification_key_name mistake. you comparing registering device gcm multiple times, each time gettin

caching - rails 4 page index cache creates a index.html instead of model.html -

caching - rails 4 page index cache creates a index.html instead of model.html - i have model named product , intend implement page caching on index action. in gemfile have included gem 'actionpack-page_caching' gem 'actionpack-action_caching' in controller have caches_page :index in routes.rb have resources :products, :path => "toys" issue: in public directory html file beingness created named index.html compared expected 'products.html' or 'toys.html' this problem hurts me when expire_page products_path on successful product create/update, application looks products.html or 'toys.html' delete, cannot find , cache not flushed. does know why rails 4 name cached page index.html ? try add together in update create action: expire_page action: 'index' ruby-on-rails caching ruby-on-rails-4

sockets - SYN-ACK packet how to decide its source IP -

sockets - SYN-ACK packet how to decide its source IP - in process of tcp connection, client first sends syn packet. when server receives packet, respond syn-ack packet. here's question: when server constructs syn-ack packet, how decide packet's source ip? server iterate own interfaces or exchange syn packet's source , destination ips. the scheme exchange source , destination ips. sockets tcp

html - How to make full 100% height of floated element? -

html - How to make full 100% height of floated element? - i have next html markup: class="snippet-code-css lang-css prettyprint-override"> .container { border: 1px solid green; } .right { border: 1px solid #000; float: right; width: 40px; } .left { border: 1px solid red; overflow: hidden; } class="snippet-code-html lang-html prettyprint-override"> <div class="container"> <div class="right">right</div> <div class="left-container"> <div class="left"> left fluid <br/> multiple rows </div> </div> </div> as can see right block looks ugly. how create right element fluid height 100%? add rule height:100% right div, , remove float:right . changed position:absolute , didn't need container's height. class="snippet-code-css lang-css prettyprint-overrid

angularjs - How to push an object into a json array through $http? -

angularjs - How to push an object into a json array through $http? - i'm new angularjs. need add together employee file named "employees.json" employee has 3 features, name, city , state can entered through text boxes. current code below , due reason not working. can help me? $scope.addemplyee=function(){ / create new employee here user inputs // employee object has 3 properties: name, city, state var name=$scope.name; var city=$scope.city; var state=$scope.state; $http.get('employees.json').success(function (data){ $scope.employees = data}); $scope.employee={"name":name,"city":city,"state":state}; $http.post('/employees.json', {"employee": $scope.employee}) .success(function(response, status, headers, config){ $scope.employees.push($scope.employee); }); }; html code follows

winrt xaml - How to keep rotating image or canvas -

winrt xaml - How to keep rotating image or canvas - this code fire 1 time rotate canvas. why not rotate when user press rotate button sec time? --update button <appbarbutton x:name="camrotate90" margin="0,2,2,0" width="90" height="90" fontsize="16" label="rotate-right" icon="rotate" click="camrotate90_click"> </appbarbutton> <canvas x:name="canvas" margin="231,28,321,111" width="700" height="525" grid.row="0" grid.rowspan="3" grid.column="0"> <image canvas.top="0" canvas.left="0" margin="0" x:name="preview" width="700" height="525" stretch="uniformtofill" > </image> </canvas> private void camrotate90_click(object sender, routedeventargs e) { compositetransform ct = new compositetransf

java - How to find numbers that are dividable with 2, 3 or 5 in max 1 second -

java - How to find numbers that are dividable with 2, 3 or 5 in max 1 second - i need help guys specific question. how many numbers interval <= b [1, 10^18] dividable 2, 3 or 5? result must run in max 1 sec! a standard programme utilize loop seen bellow. a = 1; b = 1000000000 results = 0; (int = a; <= b; i++){ if (i % 2 == 0 || % 3 == 0, % 5 == 0){ results++; } } system.out.println(results); but if come in high numbers, programme need lot of time give me results. example 1: a = 11, b = 30, result = 14 example 2: a = 123456789012345678, b = 876543210987654321 , result = 552263376115226339 i came that public static void main(string[] args) { long = 123456789012345678l, b = 876543210987654321l; long start = system.currenttimemillis(); long score = getcount(b) - getcount(a - 1); system.out.println("time: " + ((system.currenttimemillis() - start))); system.out.println("divisible 2 or 3 or 5:

php - mod_rewrite and pagination with form get method -

php - mod_rewrite and pagination with form get method - im using mod_rewrite , pagination, , form method. having issues. .htaccess code is: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^articles-author/([a-za-z0-9_-]+)&page=([0-9]+)/?$ articles.php?slug=$1&page=$2 [l,nc] which looks like: http://www.example.com/articles-author/nelson&page=2 works fine without issue pagination going 1st page or other page. but when seek nelson?page=2 shows first page instead of showing 2nd or other page. can u please help me in issue. in same page have custom page number field using form user can go desired page no entering in field, form given below. <form action='' method='get' > <input type='text' border='0' name='page' value='$page'> / $lastpage <input type='submit' class='small color' value=' go '> </form> when

java - Strange String out of Bounds exception -

java - Strange String out of Bounds exception - i working on method test if phrase palindrome. method takes string , checks if first , lastly letters of string same. if so, takes away letters , checks string 1 time again until there 1 (or zero) letter left using recursive function. string start = s.substring(0, 1); string end = s.substring(s.length() - 1, s.length()); takes first , lastly letter of each string; however, if utilize 2 letter string string index out of bounds error. thought changing index 0,0 help later realized doesn't grab first letter. there no issue string 1 or more 2 characters long. i'll set rest of method below if y'all need it, programme doesn't run far 2 letter string. public static boolean palindrometester(string s){ s = justletters(s); //calls method removes spaces, punctuation string start = s.substring(0, 1); string end = s.substring(s.length() - 2, s.length()-1); if(s.equals("") || s.

java - Can't put circular imageview in adapter -

java - Can't put circular imageview in adapter - i have listview custom adapter in there imageview. imageview circular , to utilize class: public class circularimageview extends imageview { public circularimageview(context context) { super(context); // todo auto-generated constructor stub } public circularimageview(context context, attributeset attrs) { super(context, attrs); } public circularimageview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } @override protected void ondraw(canvas canvas) { drawable drawable = getdrawable(); if (drawable == null) { return; } if (getwidth() == 0 || getheight() == 0) { return; } bitmap b = ((bitmapdrawable)drawable).getbitmap() ; bitmap bitmap = b.copy(bitmap.config.argb_8888, true); int w = getwidth(), h = getheight(); bitmap roundbitmap = getcroppedbitmap(bitmap, w); canvas.drawbitmap(roundbitmap, 0,0, null);

c - malloc debugging...solution needed -

c - malloc debugging...solution needed - typedef struct nodes* nods; struct nodes { int field,grammi,stili,flag1,flag_gv,height; nods d,r,l,u; }; . . . int j; struct nodes kefelement[30]; kefelement=(nods)malloc(30*(sizeof(struct nodes))); ((j=0); (j<30); j++) { kefelement[j].r=null; kefelement[j].d=null; kefelement[j].grammi=j+1; kefelement[j].stili=j+1; kefelement[j].field=0; kefelement[j].u=null; kefelement[j].l=null; kefelement[j].flag1=0; kefelement[j].flag_gv=0; kefelement[j].height=0; } the problem malloc....someone pls help me!!!! struct nodes kefelement[30]; kefelement = (nods)malloc(30*(sizeof(struct nodes))); kefelement array. compiler allocate part of memory can a

multithreading - How to initialize gui objects in a thread safe manner in java swing? -

multithreading - How to initialize gui objects in a thread safe manner in java swing? - i'm reading thinking in java , author stresses main method shouldn't phone call swing methods. illustration of practice presents next piece of code (available on webpage): //: gui/submitswingprogram.java import javax.swing.*; import java.util.concurrent.*; public class submitswingprogram extends jframe { jlabel label; public submitswingprogram() { super("hello swing"); label = new jlabel("a label"); add(label); setdefaultcloseoperation(jframe.exit_on_close); setsize(300, 100); setvisible(true); } static submitswingprogram ssp; public static void main(string[] args) throws exception { swingutilities.invokelater(new runnable() { public void run() { ssp = new submitswingprogram(); } }); timeunit.seconds.sleep(1); swingutilities.invokelater(new runnable() { public void run() { ssp.label.settext(

Breaking out of nested loops in C++ -

Breaking out of nested loops in C++ - this question has reply here: can utilize break exit multiple nested loops? 14 answers say have next code , when break want break out of inner , outer loop instead of inner loop , go straight blablabla. how can in c++? for (int = 0; < m; i++) { (int j = 0; j < n; j++) { if (some condition) { // , break... break; // breaks out of inner loop } } } blablabla ... "go straight [...]" sound perfect job goto . , ! for (int = 0; < m; i++) { (int j = 0; j < n; j++) { if (some condition) { // , break... goto afterloop; // breaks out of both loops } } } afterloop: // more stuff c++ for-loop

javascript - Set null as return value in selectize.js -

javascript - Set null as return value in selectize.js - can tell how set null homecoming value in selectize.js if selector empty. when went through library, got know returns empty sting if value empty. how edit this? in advance javascript jquery jquery-plugins selectize.js

ioS communicating with GPS tracker -

ioS communicating with GPS tracker - i writing app communicating gps tracker in there sim card. figure it's easy send text/sms programmatically app tracker can't figure out : how have tracker sending sms straight app, app can deal data. could kindly direct me tutorials or resources? thanks. ios gps sms

overloading - C++ no match for operator* -

overloading - C++ no match for operator* - i want overload operator: static vector operator*(float s, vector right){ vector result(right.getx()*s, right.gety()*s, right.getz()*s); homecoming result; } when want utilize it: vector a(0,1,5) vector v(4*a); i got: error: no match 'operator*' (operand types 'int' , 'vector') what wrong? you need declare (within class declaration) operator* non-static non-member , friend like: friend vector operator*(float s, vector right); and define (outside class declaration): vector operator*(float s, vector right){ homecoming vector(right.getx()*s, right.gety()*s, right.getz()*s); } operator * used binary operator here. if create member, first argument implicitly taken current object (on * applies, example, if utilize x * y, operator * applies on x member). however, non-member both arguments can non-vector type , can converted vector if needed. work if create non-member

graphics - monogame screen resolution is incorrect -

graphics - monogame screen resolution is incorrect - monogame, or xna really, reporting wrong screen resolution on surface pro 3. using graphicsadapter.defaultadapter.currentdisplaymode.width , height returns dimensions of 800 x 600, incorrect. so, cannot set game size correctly. i've been using code without problem on acer v5 , can set game resolution size expect. because graphicsadapter reports right screen size. whether using is, or docking tablet external monitor, returns same resolution. error causing this? this used bug in monogame, , fixed. if not building latest source code, possible still have bug in monogame dll. see: https://github.com/danzel/monogame/commit/0c36642129d89a12b30bcfc7d13256739d5483af graphics resolution monogame

python - how to recompile django project -

python - how to recompile django project - i trying run programme given on http://www.thepythontree.in/source-code-8-django-app-to-extract-excel-sheet-data-into-db/ . have made few changes username & password. on compiling gives error "no module named defaults". referred stackoverflow post importerror @ /admin: no module named defaults asks recompile. how recompile this. or there problem code. please help. you don't need manually compile python scripts, compiled @ runtime python interpreter. the error seeing saying can't find module called "defaults". in python, module either python file or directory containing python files. somewhere, have python script line "import defaults", or "from defaults import *". need create sure "defaults" can imported script. make sure have file called "defaults.py" i had @ code linked on page you've linked from, couldn't see imports "defaults&quo

c# - Call JavaScript function with Razor syntax -

c# - Call JavaScript function with Razor syntax - i working on asp.net mvc application. database, have created 3 dictionaries , stored them within view model. after populating said dictionaries logic in controller, i'm accessing these dictionaries in view via @model after manipulating these dictionaries, need send info js function apply logic js library called dhtmlxscheduler i have read razor syntax using @: , using method send 2 string arrays. when trying access these arrays in js function, appear hold system.string[] here code: var weekarray; var engarray; @foreach(var week in model.weeklyschedule) { var key = week.key; var values = week.value.toarray(); var eng = model.engineerschedule.where(k => k.key == key).select(v => v.value).toarray(); string test = "hello"; @: gathertimes('@values', '@eng'); } function gathertimes(values, engs) { for(var = 0; < values.length; i++) { alert(valu

android - NullPointerException while retrieving edittext values in onPause in fragment -

android - NullPointerException while retrieving edittext values in onPause in fragment - i have 3 tab fragments in viewpager. sending info 1st , 2nd fragment 3rd fragment. have implemented selection of images using custom gallery in 1st fragment(in on clicking imageview custom gallery activity displayed , selected images displayed in 1st fragment) have other form info retrieving in onpause() method , passing values 3rd fragment via interface(1st fragment->activity->3rd fragment gets data) now when dont click on imageview(i.e dont go custom gallery activity) other form info passed 3rd fragment no issues. but when click on imageview , visit custom gallery activity selecting images , coming 1st fragment..obviously onpause been called before going gallery activity.. handling exceptions using try-catch but problem after other form datas have filled in 1st fragment not been passed 3rd fragment if fill them after select images first. i null values in 3rd fragment when

angularjs - Pluggable Javascript (SPA) application development -

angularjs - Pluggable Javascript (SPA) application development - i evaluating technology stack next pluggable javascript(spa) project. after researching couple of months, end 2 frameworks. scaleapp angularjs i scaleapp architecture , thought behind framework angularjs features , popularity. there way can integrate best parts of both frameworks create pluggable javascrit application? javascript angularjs modular single-page-application

android - programmatically read incoming/outgoing emails for Google Account (Gmail App installed/not installed) -

android - programmatically read incoming/outgoing emails for Google Account (Gmail App installed/not installed) - i trying read incoming/outgoing emails google primary account. unable this. followed next source code (it gmail app installed) contentresolver cr = getcontentresolver(); cursor unread = cr.query(uri.parse("content://gmail-ls/conversations/xxxxxx@gmail.com"), null, "label:^u", null, null); unread.movetofirst(); int subjectidx = unread.getcolumnindex("subject"); { string subject = unread.getstring(subjectidx); } while (unread.movetonext()); taken question stackoverflow (forgot link, bad) isn't working. there way can read incoming/outgoing email primary google account android gmail android-contentprovider

file upload - Bug - Multifile Uploader Wordpress 4.0. Inifinite copies uploaded -

file upload - Bug - Multifile Uploader Wordpress 4.0. Inifinite copies uploaded - i'm trying upload media file in wordpress when select file multiple uploader , process starts, progress bar stops @ 100%. when open library there more 200 copies of file , none of them can used in website. if utilize single uploader, works fine. how can prepare it? how delete copies in library? have more 7000 elements! yeess!! found it's wpml media plugin caused media uploader upload hundreds of times. plugin not compatible wordpress 4.0. delete , wordpress work charm! wordpress file-upload

asp.net - Can't Access HTML Attribute in User Control Page Load -

asp.net - Can't Access HTML Attribute in User Control Page Load - i have asp.net user command has div runat="server". when seek access div's class attribute initial page load null exception error. object reference not set instance of object. protected sub page_load(byval sender object, byval e system.eventargs) handles me.load container1.attributes.add("class", "test") end sub if container1 in kid command perhaps property needed on kid command looks specific attr, it's neater doing findcontrol , less prone errors html asp.net pageload

c# - Add an Office365 user to the Role Group "View-Only Organization Management" -

c# - Add an Office365 user to the Role Group "View-Only Organization Management" - i trying add together office365 user role-group, "view-only organization management" client side using c# , powershell. have installed azure ad on local machine. after which, able run next cmdlets both powershell console app: connect-msolservice new-msoluser add-msolrolemember now, add together user, role-group, "view-only organization management", tried utilize cmdlet, add-rolegroupmember in format, add-rolegroupmember "view-only organization management" -member pk pk display name of user. when execute cmdlet powershell or console app, getting next error: so how can accomplish this? in advance. i figured out none of "exchange 2013" cmdlet not nowadays on our machine default., need import powershell session before using cmdlet , remove when we're done using it. below finish set of commands needed perform task: open

C Pointer/reference to array of structures from within function -

C Pointer/reference to array of structures from within function - i got problem making custom function on top of fastled library arduino. the array of leds, structures called crgb needs altered within function drawgradient set colors of leds. there must wrong pointers, references, parameters of functions can't seem figure out how right. how utilize pointers/references piece of code? lines of interest crgb leds[num_leds]; void loop() { drawgradient(&leds, 4, 0, crgb::white, crgb::lime); } void drawgradient(struct crgb leds[], unsigned int from, unsigned int to, struct crgb fromcolor, struct crgb tocolor) { leds[j] = pickfromgradient(fromcolor, fromcolor, position); } full code #include "fastled.h" #define num_leds 18 #define data_pin 7 crgb leds[num_leds]; void setup() { fastled.addleds<ws2812b, data_pin, grb>(leds, num_leds); } void loop() { leds[4] = crgb::red; fastled.show(); delay(1000); drawgradient(&leds

android - how to attach a TextView on a google map Marker -

android - how to attach a TextView on a google map Marker - i might have asked similar question didn't reply because wasn't precise wanted do. i'm using android-maps-utils (https://github.com/googlemaps/android-maps-utils) chris broadfoot display short info messages in bubbleicons on google map in android app. the thing want attach textview relative position of marker on map display other infos going dynamic (as opposed bitmap pics generated great library); sort of countdown in case. would have thought of how programmatically. thanks in advance, have nice day ! the library have class handle markers icons, called bubbleiconfactory. default alter text within marker can alter whatever want setting content view this: bubbleiconfactory mbubblefactory = new bubbleiconfactory(this); mbubblefactory.setcontentview(mimageview); mimageview.setimagebitmap(.....); bitmap iconbitmap = mbubblefactory.makeicon(); mmap.addmarker(new markeroptions().icon(bitmapdes

jsf - Conditionally including a Facelet file via -

jsf - Conditionally including a Facelet file via <ui:include> - i have 2 facelets files (index.xhtml , report.xhtml). utilize richfaces <ui:include src="report.xhtml"/> load study index. works fine. when seek show study on conditions, fail! not work this: <ui:include src="report.xhtml" rendered="#{indexservice.contentname == 'report'}"/> . the rendered attribute of ui:include not seem work. how can load report.xhtml index.xhtml on conditions? error in code? edit: half of works now. changing facelet file works conditions. functionality of loaded facelet not work properly. why that? problem in code? based on suggestions have this: <h:form> <h:panelgrid> <a4j:commandlink value="home" render="contentpanel" action="#{indexservice.setcontentname('home')}"/> <a4j:commandlink value="report" render="contentpanel" acti