Posts

Showing posts from February, 2013

c - copy_to_user() and copy_from_user() for basic data type -

i'm writing linux kernel driver , every function sends data userspace or reads data userspace, using copy_to_user() , copy_from_user(). question is: need use these calls if copying basic data type such u32 or int? if function receives pointer user-space data, have use copy_from_user() copy pointed-to data user space kernel space (and vice versa). note pointer value passed value (like c parameters), don't have copy_from_user() obtain pointer value before can copy_from_user() data points to. numeric arguments work same way pointer arguments; in c terms, they're both scalars. don't have use copy_from_user() copy value of parameter; that's been copied. have use copy data that's pointed passed pointer. so if have parameter of type int , can use directly. if parameter points int , int object in user space, , need use copy_to_user copy value of object kernel space.

java - search an array in sqlite table -

i have 1 table this: database.execsql("create table if not exists food_table (food_id integer primary key autoincrement not null , food_name char, food_raw char)"); and have string array this: public static arraylist<string> rawsnames = new arraylist<string>(); now want search in table , if of raw of food in rawsnames return food_name . i : string raws = adapternotes.rawsnames.tostring().replace("]", "").replace("[", ""); cursor cursor = g.database.rawquery("select * food_table food_raw '%" + raws + "%' ", null); while (cursor.movetonext()) { string name = cursor.getstring(cursor.getcolumnindex("food_name")); but when food's raw changed doesn't work. please me. it appears food_table contains fields: food_id : unique id assigned food item food_name : name of food item food_raw : ingredients separated , now, since poss

drag and drop - Slide effect of element with finger on Android -

i trying find out best approach sliding effect of element on screen on android device. i read drag , drop of elements, not sure correct approach or should go canvas. or should use events ontouch, , enter logic move elements. i looking solution make "sliding" smooth. the thing want make moving of elements in matrix, simple slide. (for example, if slide on 50% of width of element, want element slide automatically new position). thanks! i found out should correct way of solving this. i decided go swipe gestures , implement ongesturelistener , there found lot of interesting methods. that class can found here: http://developer.android.com/reference/android/view/gesturedetector.html

java - loading image from fragment in an activity FileNotFoundException error -

i want load image json file after clicking on item of list loaded file activity. show image , it's description. it loads activity , shows image not it's description. there nthing in logcat. east.java @suppresslint("newapi") public class east extends fragment { listview list; textview id; textview name; button btngetdata; east adaptor; arraylist<hashmap<string, string>> oslist = new arraylist<hashmap<string, string>>(); //url json array private static string url = "http://ra.com/s/east.php"; //json node names private static final string tag_array = "coffee"; private static final string tag_id = "id"; private static final string tag_name = "name"; private static final string tag_adress = "adress"; private static final string tag_image = "image"; jsonarray coffee = null; @override public view oncreatev

jsf 2 - Error when trying to use custom realm for Shiro -

using balusc tutorial implementing shiro jsf app http://balusc.blogspot.fi/2013/01/apache-shiro-is-it-ready-for-java-ee-6.html currently trying add own custom realm on top of example, missing something. i have shiro.ini follows (mainly copied given tutorial , not necessary): [main] user = com.example.filter.ajaxsessionfilter mockrealm = com.example.realm.mockrealm authc.loginurl = /login.xhtml user.loginurl = /login.xhtml [users] admin = password [urls] /login.xhtml = user /* = user securitymanager.realms = $mockrealm my mockrealm in short: import org.apache.shiro.realm.authorizingrealm; public class mockrealm extends authorizingrealm { /* implement stuff */ } i running on glassfish v4.1. worked far correctly until tried add custom realm. results in following error: exception while loading app : java.lang.illegalstateexception: containerbase.addchild: start: org.apache.catalina.lifecycleexception: java.lang.illegalargumentexception: there no filter name '$mockr

angularjs - How to integrate whole bootstrap template with angular js -

i have bootstrap template , converting angular js. but problem face navigation tools not working , bootstrap template drop functionality work scroll bar, sidebar navigation , similar functionality require js include. conflict ? require redevelop whole template angular js or missing include bootstrap before converting. i read documentation @ https://angular-ui.github.io/bootstrap . not helpful convert whole template. i want guidance how can convert bootstrap template angularjs. i have not posted code. because messy. , wanted guidance how possible. thanks in advance.

c++ - Windows and Linux : Including cpp files -

i have file a.cpp , b.cpp. latter contains utility functions in use a.cpp. in linux can following in a.cpp :- #include "b.cpp" and use function in b.cpp. in windows, visual studio complained not find "b.cpp". changed line follows :- #include "./b.cpp" however, when build project belongs lnk error messages :- b.obj : error lnk2005 : "unsigned char __cdecl blah() defined in a.obj" why happen? visual studio compiles every cpp file (they included in build default). tries compile b.cpp , a.cpp (with b.cpp ), when compile use a.cpp got confused, blah use? obj file? a.obj or b.obj ? the solution simple, don't include .cpp , make .h declarations of functions, , include it.

sql server - Conversion failed when converting the varchar value ',1,2,3' to data type int -

this error results when attempting use comma delimited parameter in in condition i'm passing varchar parameter stored procedure looks this ,1,2,3 and want find out if contains 1 (it doesn't contain 1) what's easiest way in tsql ? declare @nums varchar(max)=',1,2,3' if 1 in (@nums) -- conversion error begin select * testtable end you need use see if string contains character 1. note match 12 or string character '1' in it. declare @nums varchar(max)=',1,2,3' if @nums '%1%' begin select * testtable end if need match full number: create function [dbo].[split_string] ( @itemlist nvarchar(4000), @delimiter char(1) ) returns @idtable table (item varchar(50)) begin declare @tempitemlist nvarchar(4000) set @tempitemlist = @itemlist declare @i int declare @item nvarchar(4000) set @tempitemlist = replace (@tempitemlist, ' ', '') set @i = char

firebase - How to parse a json with talend? -

Image
i need parse file extract comes firebase: { "historics" : { "users" : { "anonymous:-jlvsu77kk6lgv-undzt" : { "age" : "25", "browser" : "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:36.0) gecko/20100101 firefox/36.0", "pseudo" : "foo", "startsession" : 1427554673910, "stopsession" : 1427554695420 }, "anonymous:-jtjdu598k6lgv-undgb" : { "age" : "25", "browser" : "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:36.0) gecko/20100101 firefox/36.0", "pseudo" : "bar", "startsession" : 1427554673910, "stopsession" : 1427554695420 } }, "messsages" : { "-jersu826k6lgv-undgr" : { "value" : &

javascript - VBScript set value at onload -

i have hta vbscript has element set variable, sn2: <script language="vbscript">document.getelementbyid("computername").value = sn2</script> set print out html textbox: <html><input class="inputs" type=text id="computername" name=computername /></html> and works well! however, wanted set value display in textbox on onload to this, set vbscript function <body onload="myfunction()"> . , works well, except there function need set body onload so wondering if there way set document.getelementbyid("computername").value = sn2 onload in different way. i know way in javascript, can set document.getelementbyid("computername").onload , doesn't seem working in vbscript. can done in vbscript, , if so, how? can't use javascript case. i'm referring this method (although don't need of iframe stuff have in example). reason js way doesn't translate in vbscript.

asp.net mvc - MVC Checkbox not checked when value is true -

i have grid of records contain check box. check box indicates whether transaction has been acknowledged or not. testing purposes, added display text next check box , text indicates boolean true. however, check box not checked. @for (int = 0; < model.transactionlist.count; i++) { <tr> <td class="hidden"> @html.hiddenfor(m => m.transactionlist[i].providertransactionid)</td> <td class="text-center"> @html.displaytextfor(m => m.transactionlist[i].acknowledged) @html.checkboxfor(m => m.transactionlist[i].acknowledged) @html.hiddenfor(m=>m.transactionlist[i].acknowledged) </td> <td> @html.displayfor(m => m.transactionlist[i].fromuictxt) @html.hiddenfor(m => m.transactionlist[i].fromuictxt) </td>

android - How to get values from the selected item in a list view? -

this code far. working shows first value have in listview , not selecting item user. please halp me this. important. unitlistview.setchoicemode(abslistview.choice_mode_single); unitlistview.setonitemclicklistener(new adapterview.onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { // selected item textview t1 = (textview) findviewbyid(r.id.lbllunitname); string name=t1.gettext().tostring(); // string a= (string) unitlistview.getitematposition(position); // touchpressed=position; toast.maketext(getapplicationcontext(), "selected item :" +name, toast.length_short).show(); } }); update code follows , try ; unitlistview.setchoicemode(abslistview.choice_mode_single); unitlistview.setonitemclicklistener(ne

reporting services - Capture the print statement "Messages" in SSRS report in SQL Server -

i have sql server sp (it runs on sql server 2000, 2005, 2008, 2012) returns html code using print statement "messages" not "results" the html code used build html web page , cannot use select statement due length of characters returned. i need capture print statement "messages" in ssrs report build web page. if not possible, there way capture in sql server , insert "messages" in temp table? you can try this: (at end of proc) create table #msgs (line1 varchar(2000)) insert #msgs select 'this long msg'+col1 table25 select line1 #msgs

scala parameterized type on foldLeft -

given following signature parameterized method def double[a <: byte](in:list[a]): list[a] = { //double values of list using foldleft //for ex. like: in.foldleft(list[a]())((r,c) => (2*c) :: r).reverse //but doesn't work! so.. } i trying following before tackling parameterized typed foldleft def plaindouble[int](in:list[int]): list[int] = { in.foldleft(list[int]())((r:list[int], c:int) => { var k = 2*c println("r ["+r+"], c ["+c+"]") //want prepend list r // k :: r r }) } however, results in following error: $scala fold_ex.scala error: overloaded method value * alternatives: (x: double)double <and> (x: float)float <and> (x: long)long <and> (x: scala.int)scala.int <and> (x: char)scala.int <and> (x: short)scala.int <and> (x: byte)scala.int cannot applied (int(in method plaindouble)) val k = 2*c ^ 1 error found if changed signature of def following: def plai

mysql - How would I right a select statement to query this database? -

how right select statement if wanted find out how many people first name "jim" have passed test? also if wanted instructor forename , surname, client forename , surname , date every test after 9:00 on 10/03/2015? here relational schema database. client ( clientno , forename, surname, gender, address, telno, prolicenceno) instructor ( instructorid , forename, surname, gender, address, telno, licenceno, carno ) car ( carno , regno, model) lesson ( clientno , ondate , attime , instructorid ) test ( clientno , ondate , attime , instructorid , centreid , status, reason) centre ( centreid , name, address) primary keys in bold , foreign keys in italic. no foreign keys allowed null. thanks! :) try joining between client , test table like: select c.forename, count(c.forname) client c inner join test t on c.clientno = t.clientno c.forename = 'jim' , t.status = 'pass' group c.forname

ios - Framework Errors in Parse App ParseFacebookUtils -

i updated parse framework newest version in app, , getting ton of errors in app, framework related: undefined symbols architecture x86_64: "_objc_class_$_fbsdkaccesstoken", referenced from: objc-class-ref in parsefacebookutilsv4(pffacebookutils.o) objc-class-ref in parsefacebookutilsv4(pffacebookauthenticationprovider.o) "_objc_class_$_fbsdkapplicationdelegate", referenced from: objc-class-ref in parsefacebookutilsv4(pffacebookutils.o) "_objc_class_$_fbsdkloginmanager", referenced from: objc-class-ref in parsefacebookutilsv4(pffacebookauthenticationprovider.o) "_objc_class_$_fbsdksettings", referenced from: objc-class-ref in parsefacebookutilsv4(pffacebookauthenticationprovider.o) "std::string::find_first_of(char const*, unsigned long, unsigned long) const", referenced from: macstringutilspfc_::integervalueatindex(std::string&, unsigned int) in parsecrashreporting(string_utilities.

Qt - draw pixmap (.png file) with QPainter from resources -

i have problems drawing image on qwidget qpainter resources. i'm sure i'm missing dont know what. if use absolute path, works fine. so question is: should if want draw .png file resources qpainter? (what missing?) here simple test code: widget.h: #ifndef widget_h #define widget_h #include <qwidget> #include <qpaintevent> #include <qpixmap> #include <qpainter> class widget : public qwidget { q_object public: widget(qwidget *parent = 0); protected: void paintevent(qpaintevent* e); }; #endif // widget_h widget.cpp: #include "widget.h" widget::widget(qwidget *parent): qwidget(parent) { } void widget::paintevent(qpaintevent *e) { qpainter painter(this); qpixmap pixmap1("c:/qt/projects/pixmaptest/image.png"); qpixmap pixmap2(":/img/image.png"); qpixmap pixmap3("qrc:/img/image.png"); painter.drawpixmap(10,10,50,50, pixmap1); // works painter.

javascript - Angular, bootstrap-ui with requirejs issues -

i trying use bootstrap-ui on angualr project requirejs. i think have set correctly seems having issues - here setup - require.config({ paths: { 'angular': '//thirdparty/angular/1.3.4/angular.min', 'underscore': '//thirdparty/underscore/1.6.0/underscore.min', 'bootstrap-ui' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap.min', 'bootstrap-ui-tpls' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min', }, shim: { 'angular': { exports: 'angular' }, 'underscore': { exports: '_' }, 'bootstrap-ui-tpls' : { deps: ['angular'], exports: 'bootstrap-ui-tpls' }, 'bootstrap-ui': { deps: ['angular','bootstrap-ui-tpls'] } } }); i assuming need add tpls - may part of issue? then define

javascript - History.js first load -

i'm using history.js jquery. my page search engine. the form submitted via $.ajax() , result loaded in div#results pagination. click on next page's link handled $.ajax too. each result link page. when first load form, want div#results empty. when click on result's link button, want div#results same results. $('.link_page').on('click', function(e){ e.preventdefault(); var page = $(this).data('page'); $.ajax({ url: '/search', method: 'post', data: { create_date : $('#create_date').val(), page : page } }).done(function( html ) { $( "#results" ).html( html ); history.pushstate({results: html}, "search", "/search"); }); }); history.adapter.bind(window, 'statechange', function (evt) { var state = history.getstate(); $( "#results" ).html( state.data.results ); }); history.adapter.ondoml

javascript - Ciphering data value so that it cannot be seen when viewing html source code -

i'm developing online test. questions , answer choices , points associated answer choices taken mysql database php. , front-end of test done jquery. when output answer choices looks in html source: <li data-points="1">answer choice text</li> so quite easy user see points associated answers looking source of page. i somehow hide/mask/encrypt data-points value, must done php right after getting value mysql. after same html in page source: <li data-points="2f77668a9dfbf8d5848b9eeb4a7">answer choice text</li> then encrypted value must read in front-end jquery , decrypt actual points can calculated. i don't know how this, there simple solution? solution not need super secure don't want user can see right answer 1 click of "inspect element" or viewing source of page. if can point me right direction!

r - Load files from a list of file names in a data frame -

i have created program calculation excel worksheet. data worksheet comes machine. have set machine export given folder. want r program input data folder (data) , run code, export different folder (results). don't want code run on data done. have done: library(gdata) library (xlconnect) #################### data in ######################## setwd("c:/r/data/") datain <- list.files(pattern="*.xlsx", full.names=t, recursive=false) ##################### results in ################### setwd("c:/r/result/") results <- list.files(pattern="*.xlsx", full.names=t, recursive=false) ################## set wd data ################################# setwd("c:/r/c/") torun <- datain[!(datain %in% results)] ############################################################################ dataframtorun <- data.frame(torun) dataframtorun torun 1 ./343sdasd.xlsx 2 ./4ewwq.xlsx 3 ./tricarb.xlsx i want load 3 fil

sql - How do I combine 2 combined tables and then add a column that compares them? -

Image
i trying create report compares 2 sets of data. 1 training table listing have trained. other project table listing has participated in project. i want group trained , participants department know departments aren't participating after training. i wrote following 2 statements show me counted number of trainees , particpants department: shows participants counted department: select emp.dept_manual, count(pt.sso) partic projectteam pt, employees emp emp.sso = pt.sso group emp.dept_manual order emp.dept_manual desc shows trainees counted department: select emp.dept_manual, count(train.sso) trained trainingroster train, employees emp emp.sso = train.sso group emp.dept_manual order emp.dept_manual desc some info these 2 tables. both projectteam & trainingroster linked employees table via sso. employees table has field dept_manual. not every sso in trainingroster in projectteam (going forward be) not every sso in projectteam has associated dept_manual in employees

MySQL: detecting a text "NULL" or 0 field and changing it to proper NULL -

i have following bit of code update table_one set field_one = case when field_one = 'null' or field_one = 0 null else field_one end so want see if field has string "null" or 0 (0) value. if should set null within database. the issue i'm having it's setting null in fields while other fields okay. is there wrong code? update table_one set field_one = null field_one = 'null' or field_one = '0'

Not understanding Ocaml type signatures -

i have been working on trying understand this, , working harder on going hurt relationship ocaml, figured ask help. i have simple function this site let line_stream_of_channel channel = stream.from (fun _ -> try (input_line channel) end_of_file -> none);; okay cool, signature below it: val line_stream_of_channel : in_channel -> string stream.t = <fun> in_channel argument , stream.t return value. now why in ocaml can't do: stream string and instead have string stream.t looking @ the type signature of stream didn't me anywhere either. i've noticed same syntax weirdness stuff lists have unnatural string list rather natural list string but weird ".t" portion of stream type above. can kinda explain going on here , why things done way? i've googled tutorials on explicit type signatures, types, etc in ocaml , in general lead here specific questions don't me. thank you! in ocaml's parameterize

excel - DMAX Function Referencing Different Worksheet -

i have following function in 1 worksheet: =dmax(servicecompleted!a$1:e$430, 5, a2) it reference "servicecompleted" worksheet #value error. a2 references text field. return column (5) number. don't know if makes difference. i've been racking brain on this; sure answer there... appreciated.

Facebook share throwing connection error when sharing -

every article on following website fails when attempting share page via share link in our social media widget. for example: the following page, http://news.gc.ca/web/article-en.do?mthd=index&crtr.page=1&nid=957389 when shared via following link: returns error: connection error in share preview window. response headers request are: cache-control: private, no-cache, no-store, must-revalidate content-encoding: gzip content-type: text/html date: wed, 01 apr 2015 14:22:20 gmt expires: sat, 01 jan 2000 00:00:00 gmt pragma: no-cache strict-transport-security: max-age=15552000; preload vary: accept-encoding x-content-type-options: nosniff x-fb-debug: iyvcjsrjjqvdvxyiubd1kvq6tezbilibrrcaczw9hi/ms+b2qsquq52kyu5820utflmuxtis3lbrol2bmlcvbw== x-frame-options: deny x-xss-protection: 0 x-firefox-spdy: 3.1 200 ok running above url through opengraph object debugger returns: error parsing input url, no data cached, or no data scraped. and scraper sees following url: docum

Using polymorphic type in type family in haskell -

i'm learning type family, it's confusing. when define polymorphic type outside of class definition, works well. {-# language rank2types #-} type t = num => but when polymorphic type defined inside of class definition, {-# language typefamilies #-} {-# language rank2types #-} data d = d class a type t :: * instance d type t d = num => then complier shows error : illegal polymorphic or qualified type: forall a. num => in type instance declaration 't' in instance declaration 'a d' is there way make function in class return type polymorphic, 3(num => a)?

sql - What is best way to merge 2 select statement? -

i have sql server query statement this: with ( select ( sum(case when (t1.price) > 0 (t1.price) else 0 end) ) pr1 ,( abs(sum(case when (t1.price) < 0 (t1.price) else 0 end)) ) pr2 dbo.price_table t1 ) ,b ( select (when(pr1 - pr2) < 0 abs(pr1 - pr2) else 0 end) res ) select res b in query, use 2 select statement achieve "res" column, want achieve "res" column in 1 select statement. what best way merge 2 select statement 1 select statement query? your calculation seems way complicated. taking sum of positive values. sum of negative values, using abs() make value positive, , subtracting result. guess what? same taking sum() of values in first place. so, think statemen

Knockout binding is bloating html (table cells), how to create bindings with javascript or bind from parent element? -

i've created reusable grid component via knockout , i'm finding html becoming bloating data-bind="..." strings particularly <td> elements. i have grid 8 columns , mere 20 rows yield 160 cells. issue cells this: <td data-bind="text: typeof rowtext == 'function' ? rowtext($parent) : $parent[rowtext], event: { dblclick: function() { $root.rowdoubleclicked($parent); } }, css: $data.columnclass">yale university</td> i may add future bindings. it'd nice if there way perhaps apply binding <tbody> automatically apply binding it's child <td> elements. or perhaps there way apply bindings via javascript instead of using "data-bind" attribute? normally 1 looking @ code (developer), looks unimportant in grand scheme of things. format markup make easier follow: <td data-bind=" text: typeof rowtext == 'function' ? rowtext($parent) : $parent[rowtext], event: { dblclick

java - getOutputStream() has already been called ,but i just use getOutputStream one time in my SpringMVC code -

the process controller(jump) -> jsp(grid) ->controller(verification code) code controller(jump): /** * jump login in jsp * @return */ @requestmapping("/tologin") public string tologin( ) { log.debug("to sign in!---------------------------------------<userinfocontroller>"); return "sign-in"; } jsp(there no tag "<% ... %>"): <div class="form-group"> <label for="code">验证码</label> <input id="code" type="text" name="code" class="span3 form-control "> <a> <img alt="刷新验证码" src="${pagecontext.request.contextpath }/code"> </a> </div> controller(verification code): outputstream os = resp.getoutputstream(); imageio.wr

ftp - cPanel PHP API with Kohana -

i need change passwords of ftp users cpanel.php cpanel using pureftpd creating ftp users, want implement change password ftp user's. the problem pureftpd creating virtual users in system , cpanel.php api manipulates users in server's /etc/passwd file.. possible cpanel api change password of ftp user's created pureftpd? you can use cpanel api2 change password ftp accounts script: here code sample: https://github.com/vthink/cpanel_api

laravel - NotFoundHttpException in RouteCollection.php -

i use laravel 5! in routes.php file have following request check admin requests in url: if (request::is('admin/*')) { require __dir__.'/admin_routes.php'; } in case in corresponding admin_routes.php file should return correct controller have: route::group(['prefix' => 'admin', 'middleware' => 'auth'], function() { #admin dashboard route::get('dashboard', 'admin\dashboardcontroller@index'); }); i cleared route cache (php artisan route:clear) , error message: notfoundhttpexception in routecollection.php line 145 . ideas wrong? thank you put routes in 1 file, since documentation others aswell. should kept simple can be. then use route groups . why need include other files?

javascript - How to determine if variables from sockets match -

i have node.js server , im using socket.io communicate between 2 html pages.the 2 html pages send data across socket, each page has entity associated e.g host entity: 'host' , responder vice versa.they both have name associated them same keep them 'paired' session e.g name: 'test' . when server accepts these connections have trouble finding out if there set. have is: socket.on('hostresponderstatus', function(msg) { if(msg.status == 'connecting') { if(msg.entity == 'host') { namehost = msg.name; //grab name associated host socket.emit('staringgl', {status: 'starting', name: namehost}); //send socket stating gl starting } if(msg.entity == 'responder') { nameresponder = msg.name; //grab name associated responder socket.emit('staringgl', {status: 'starting

Java IRC, processing login command correctly -

for school have create java irc client without using libraries (pircbot example). have created bot called "skynet". bot handles commands send it. but login function need command processed senders username , not bots (skynet) bufferedwriter writer = new bufferedwriter( new outputstreamwriter(socket.getoutputstream())) else if (line.contains("!login")) //!login <username> <password> { string[] parts = line.split(" "); string user = parts[4]; string pass = parts[5]; string inpuser = user; string inppass = pass; bufferedreader br = new bufferedreader(new filereader("c:/users/leroy/documents/users.txt")); { string userpass; //user#pass while ((userpass = br.readline()) != null) { string pass = userpass.split("#")[1]; string user = userpass.split("#")[0]; if (inpus

ios - iPhone objects not sizing correctly on different devices -

Image
so i'm building application has different objects on viewcontroller. when run in on iphone 5/5s runs nicely, whereas on 6 , 6 plus looks messed up. used know how make work on devices, can't figure out anymore. can me please? here photos more explanation: 6 plus: 5s: please help, i'm new , i'd detailed explanation. select both objects add following constraints: and after that: that should keep textfield , button in center on devices.

stm32 - Break function execution from interrupt -

i write firmware stm32. there function a() executes in main loop. need break execution of function if happens uart interrupt! possible? thanks) of course can that. canonical method create volatile flag variable accessible within scope of both irq , a() method. initialise false . when irq method wants tell a() method sets flag true. in a() method poll flag , if it's true act upon it. the fact you're asking makes me think perhaps you're making blocking call somewhere in a() , want somehow forcibly unblocked interrupt code. that's not possible. if code you'll need redesign non-blocking.

Git does not delete folders after merge -

suppose have repository branches , b, stemming same origin. switch branch , delete directories. directories contain files. commit , switch branch b, directories not deleted yet. so, merge b don't see folders being removed in branch b. rather have weird situations half-deleted folders , self-restoring folders. so, how correctly commit , merge deletions main development branch?

javascript - AngularJS controller does not work, why? (simple controller example) -

i saw video of introduction angularjs , use following example the html: <!doctype html> <html ng-app> <head lang="en"> <meta charset="utf-8"> <title></title> </head> <body ng-controller="maincontrl"> <h2>{{message}}</h2> <script src="bower_components/angular/angular.min.js"></script> <script src="js/test.js"></script> </body> </html> the js: var maincontrl = function($scope){ $scope.message = "hello friend"; }; in example i've seen structure works, when test not work. console gives me error: error: [ng:areq] http://errors.angularjs.org/1.3.15/ng/areq?p0=maincontrl&p1=not%20a%20function%2c%20got%20undefined can used in way controller? or bad practice example in plunker: code example i think, it's bad practice you better use: var myapp = angular.module('myapp', []

php - why does count function return one row? -

i have query using pdo "select category.id id, category.static_name static_name, category.name name, count(training.id) trainings_count category join training on training.cat_id = category.id" when columns empty, count function returns 1 row , whole function return true. solution problem ? if don't group answers category, count returned , give 1 answer. way aggregate functions (count, sum, min, max, etc.) supposed function. so question is, want count of. add clause group <blah> <blah> item wanting count items of.

Laravel 4.2 generate sub query like this -

i want in eloquent way. select * `documents` (`id` in (select `related_id` `common_data` `meta_key` = 'meta_key_name' , `meta_value` = '1') or `created_by` = '1') thanks answer. try it $data = document::where(function($query){ $query->whereraw(" id in (select `related_id` `common_data` `meta_key` = 'meta_key_name' , `meta_value` ='1')") ->orwhere('created_by',1); })->get();

java - How to alter dependencies for a generated artifact? -

gradle 2.3; shadow plugin 1.2.1. in build.gradle, use shadow plugin in order repackage dependency, such: shadowjar { relocate("com.google.common", "r.com.google.common"); } i add shadow jar list of artifacts publish: artifacts { archives jar; archives sourcesjar; archives javadocjar; archives shadowjar; } however list of dependencies of shadow jar still contains dependencies of "normal" jar, though has every dependency builtin. is intended behavior? how can make shadow jar exclude or dependency? here @ work had same problem , put in build.gradle of 1 of our projects: def installer = install.repositories.maveninstaller def deployer = uploadarchives.repositories.mavendeployer [installer, deployer]*.pom*.whenconfigured { pom -> pom.dependencies.retainall { it.groupid == 'our.group.id' && it.artifactid == 'some-api' } } this removes dependencies pom.xml except depend

python - Plot duplication in Pandas Plot() -

there issue plot() function in pandas import numpy np import pandas pd import matplotlib.pyplot plt df = pd.dataframe(np.random.randn(8, 4), columns=['a', 'b', 'a', 'b']) ax = df.plot() ax.legend(ncol=1, bbox_to_anchor=(1., 1, 0., 0), loc=2 , prop={'size':6}) this make plot many lines. note half on top of each other. seems have axis because when not use them issue goes away. import numpy np import pandas pd import matplotlib.pyplot plt df = pd.dataframe(np.random.randn(8, 4), columns=['a', 'b', 'a', 'b']) df.plot() update while not idea use case issue can fixed using multiindex columns = pd.multiindex.from_arrays([np.hstack([ ['left']*2, ['right']*2]), ['a', 'b']*2], names=['high', 'low']) df = pd.dataframe(np.random.randn(8, 4), columns=columns) ax = df.plot() ax.legend(ncol=1, bbox_to_anchor=(1., 1, 0., 0), loc=2 , prop={'size':16})

java - Use placeholders to search in postgresql -

i want search in table title containing substring (in case substring title passed getbookfortitle method). problem doesn't return anything. public void getbookfortitle(string title) { preparedstatement stm = null; resultset rs = null; try { stm = connection.preparestatement("select * books name '%?%'; "); rs = stm.executequery(); while (rs.next()) { system.out.print(rs.getint(1)); system.out.print(": "); system.out.print(rs.getstring(1)); system.out.println(rs.getboolean(3)); } } catch (sqlexception ex) { ex.printstacktrace(); } } you never bind value placeholder. placeholder should not contain % sign , single quotes. it must like: stm = connection.preparestatement("select * books name ? "); stm.setstring(

android - Fragment OnStop() Called when the Fragment is no longer started? -

i confused documentation fragments http://developer.android.com/reference/android/app/fragment.html#onstop() called when fragment no longer started. as know if user navigates backward or fragment replaced/removed onstop() called. can explain me how onstop() called when fragment no longer started?

postgresql - Comparing orientations with Postgres/PostGIS -

i'm working on app need take orientation of user's phone (e.g. using web orientation api or otherwise), , compare stored orientation. need determine if these orientations close enough each other in terms of degrees. edit: end goal of tell when user facing in exact same direction stored in database (i.e. tilt isn't important) so conceptually we're finding distance between 2 points on circle, these points determined 2 angles, alpha , beta, rather latitude , longitude, they're both out of 360 degrees (like this question suppose). web api returns 3 different angles alpha, beta , gamma, explained here , care alpha , beta think. firstly, how store 3d orientation in postgres? model data point latitude , longitude, annoying have convert angle out of 360 angle out of 180 or 90). there better format store orientation in postgres? secondly, how compare orientations? i've found function, st_distance_spheroid , compares distance between points on sphere in ter

Caught exception:Internal Server Error Soap connection php -

i'm building function in php check if user , password match external database, can extract emailadres. have created soap wsdl me can check this. i can check if user exists, every time try send soapcall request email, error message caught exception:internal server error. i looked around error, , there somehow wrong array send parameter during request. array consist of login / password of user i'm checking. the weird thing is, if send array 1 parameter, don't recieve error, recieve empty string in return cause username , password don't match. i used same structure check if user exists, , not giving error. here code make connection: checkemail('hmichiels','xxxxxxx'); function checkemail($ploginstr,$ppasswordstr){ try{ $client = new soapclient('https://milliarium.gabo-mi.com/forms/generic/security/externalemailservice.asmx?wsdl', array('trace'=>1)); $params = array('ploginstr'=>$ploginstr, 'ppa

c++ - Query number of resources in a Qt Resource Collection (.qrc) -

i compiling multiple qt linguist message files (.qm) qt resource collection file (.qrc). translatons.qrc file compiled application via rcc , can access resources via ":/translations/<locale_name>.qm" . is there way query number of resources specific prefix? in case, when add 2 .qm files .qrc file programmatically obtain result 2 . class qresource not seem fulfill such request, since seems work resources directly. using qt v5.4. you may work resource system in same manner, file system, example: qdir( ":/translations" ).entrylist()

html - Selecting an element based on the presence of surrounding sibling elements -

Image
i have following html structure. <div class="fieldset"> <p>normal input<i class="icon-question tooltip-top" title="text goes here"></i></p> <div> <span><i class="icon-cart"></i></span> <input name=""> <span><i class="icon-cart"></i></span> <i class="icon-question tooltip-top" title="text goes here"></i> </div> </div> i trying change settings of border-radius according <input> positioned. for example, if <input> has <span> before it, border-radius 0 top , bottom left. i did using: .fieldset > div > span + input { border-radius: 0 4px 4px 0; } but, when there <span> after <input> input border radius should 0 right top , bottom side. can't use + selector one. how can achieve desired resul

How to load the data in index page using spring mvc? -

i tried couple of tutorial in spring-mvc load data in index page without using ajax call means before loading index page want data server , load data index page.but did not proper answer. finally after couple of try got answer.here code. web.xml <display-name>springtest</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring-servlet.xml</param-value> </contex

I am developing a Outlook plugin for Outlook 2007, 2010 and 2013 -

i developing outlook plugin. outlook 2007,2010 , 2013 it's working fine in 2010 , 13 not showing tab in 2007. installing properly, checked in addins in active mode not showing tab or button of addin. please tell me proper way that. first of all, make sure don't ui errors in outlook. see how to: show add-in user interface errors more information. the explorer windows in outlook 2007 don't use ribbon ui, inspectors. so, need use command bars customizing explorer windows. anyway, markup did use custom ui? namespace used in markup?

c++ - Retrieving sigcontext during backtrace -

in writing code print backtraces in c++, came across this answer , includes copying definition of type: /* structure mirrors 1 found in /usr/include/asm/ucontext.h */ typedef struct _sig_ucontext { unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; struct sigcontext uc_mcontext; sigset_t uc_sigmask; } sig_ucontext_t; i can't include <asm/ucontext.h> since there defined ucontext collides named type <sys/ucontext.h> (which included necessary <signal.h> ): /* userlevel context. */ typedef struct ucontext { unsigned long int uc_flags; struct ucontext *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; __sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; } ucontext_t; all need here struct sigcontext uc_mcontext member asm version. there better way retrieve value copying out struct? seems incredibly hackish , error-prone me. one potential workaround make asm/uconte

objective c - How to filter a Parse query by an tableview index? -

i have uitableviewcontroller in application. in table performing parse query: -(ibaction)joinevent:(id)sender { pfquery *query = [pfquery querywithclassname:@"event"]; [query selectkeys:@[@"vacants"]]; [query wherekey:@"username" equalto:pfuser.currentuser.username]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!error) { // find succeeded. nslog(@"successfully retrieved %lu scores.", (unsigned long)objects.count); // found objects (nsobject *object in objects){ nsstring *a = [object valueforkey:@"vacants"]; nslog(@"vacants %@", a); } } else { // log details of failure nslog(@"error: %@ %@", error, [error userinfo]); } [self.tableview reloaddata]; }]; } this query gets me vacants in parse cloud. what want able vacants indexpath.row of table. so far have tried use

entity framework - Why is cascade delete not on by default for this relationship? -

i have 1 many relationship between labellineitem , despatchpart. can't understand why cascade delete off relationship. there no relationship defined in context using fluent api. there no labellineitems navigation collection in despatchpart, there no reference labellineitem. public class labellineitem { public int id { get; set; } public int despatchpartid { get; set; } public int labelconfigid { get; set; } public string content { get; set; } // navigation public virtual labelconfig labelconfig { get; set; } public virtual despatchpart despatchpart { get; set; } } public class despatchpart { public int id { get; set; } public int despatchid { get; set; } // navigation public virtual despatch despatch { get; set; } //... } it's understanding one-to-many relationships default cascade delete on. demonstrated in code sample above. whereas zero-or-one-to-many relationships default cascade delete off case if either:

Can you change language of javascript error event messages? -

in our webapp log messages server via window.onerror however, if client (the web browser) using non english language message in whatever language user has web browser set to. is there way change somehow? currently unhelpful messages in multiple languages, hard search similar errors when in 12 different languages, tricky developers need translate english time figure out went wrong. [edit] adding example here window.onerror = function (message, url, linenumber, columnnumber) { // log error here server } in example, message in english of time, turns in example danish or swedish depending on client (webbrowser). short answer: you cannot change it . message descriptive message because of error code. web app should take consideration state (code) of error, not message. these messages part of browser settings, not have rights change (some of them read-only, all write-protected). mean can render user's browser useless changing program settings javascript (f

ios - How can I dynamically set UIView constraints? -

i have custome uitableviewcell. contains labels , uiimageviews top bottom. added constraints labels , uiimageviews. can use systemlayoutsizefittingsize: uilayoutfittingcompressedsize caculate cell height fit content. image in uiimageview loaded online using sdwebimage. @ first can set constraints uiimageview. when image loaded, should change uiimageview's constraint meet size. error occurs. it's ok: * assertion failure in -[nslayoutconstraint _setsymbolicconstant:constant:], /sourcecache/foundation_sim/foundation-1142.14/layout.subproj/nslayoutconstraint.m:585 2015-04-01 19:57:44.537 hipda[3760:63583] * terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'constant not finite! that's illegal. constant:nan' *** first throw call stack: ( 0 corefoundation 0x00000001113cfa75 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x0000000111068bb7 objc_exceptio

testing - How do I calculate the number of concurrent users to use in a load test? -

we’ve come across question @ load impact, thought i’d add stack overflow community make easier find. how calculate number of concurrent users (vus) need simulate during load test, in order stress system same kind of traffic see in course of month, week or day? running load test requires specify how many concurrent users should simulated during testing. in other words, how many simulated users active, loading things or interacting site/app @ same time. unfortunately, when looking @ google analytics example, see how many visits website has per day or per month. site can have million visits per month, still ever experience max 100 concurrent visitors. to convert "visits per x" metric google analytics, or other analytics system, "concurrent users" metric can use load testing, can use following method. first, find out 2 things: you need total number of visits short time period when site/app @ peak traffic levels. can found via e.g. google analytics

javascript - Ajax return not show on page source Codeigniter -

i have problem ajax return values. returned data not showing on page's source code. this controller code in codeigniter: public function get_rooms(){ $rooms_selected = $this->input->get('q', true); $this->load->model('roomreservation_model'); $room_numbers = $this->roomreservation_model->numberofroom($rooms_selected); echo '<select class="form-control" name="room_number" id="room_number">'; foreach ($room_numbers $value) { echo '<option value="'.$value->room_number.'">'.$value->room_number.'</option>'; } echo '</select>'; } html code <div class="col-lg-12"> <h2 class="sub-header">room detail</h2> <div class="col-lg-6 col-xs-12 form-label"> <label for="room type">room type</label> <select cla