Posts

Showing posts from September, 2013

javascript - How to bind an array to select by Angularjs? -

i trying bind object array select drop down, cannot figure out how make work, can suggest how make work? html: <div ng-app ng-controller="displayctrl"> <select ng-model="eventname" ng-options="name.event name in eventnames"> <option value="">select event</option> </select> <p>currently selected: {{eventname.description}} </p></div> angularjs: function displayctrl($scope) { $scope.eventnames = [{ event: "function a", description: "gaming" }, { event: "function b", description: "basketball" }, { event: "function c", description: "football" }, { event: "function d", description: "dancing" }]; $scope.eventname = $scope.eventnames[1].event;} http://jsfiddle.net/ztabs/ with object-arrays, angular store real object in model variable. preselection should same, thus: $...

C: structures, easy, full short program code shown -

here program. commented aims etc. issues two: a) typical error of "data definition has no type or storage class when create prototypes of functions. b) after entering input scanf question , pressing enter, still have type letter , again press enter continue through program, otherwise not progress: thanks #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> /* object: * program allows upon user input recreate structures * different names. except when entering 'n', * ask "do want create new book (structure)? * storing books, title, author, price, , pages */ // 1. create blue print of structure (forget typedef...) struct book { char title[100]; int pages; int price; char author[50]; } ; // 2. declare variables char wants; char name [30]; // 3. function prototypes question(); create_structure_name(); // ++++++++++++++++++++++++++++++++++++++++++++++++++...

c++ - How can I replace percent sign (%) with two %'s? -

i want try replace percentage sign in char array 2 %% signs. because % sign causes problems, if write output char array. therefore percentage sign must replaced 2 %% signs without using string. // array causes dump because of '%' char input[] = "this text % charakter"; //therefore percent sign(%) must replaced 2 %%. you can use std::string handle necessary memory re-allocations you, plus boost algorithm make easier: #include <string> #include <iostream> #include <boost/algorithm/string.hpp> int main() { std::string input("this text % charakter , % charakter"); boost::replace_all(input, "%", "%%"); std::cout << input << std::endl; } output: this text %% charakter , %% charakter if can't use boost , can write own version of replace_all using std::string::find , std::string::replace : template <typename c> void replace_all(std::basic_string<c>& in, ...

java - JSP Reading response body after HTTP GET request to URL -

in msisdn lookup api documentation says by default, results of request lookups available in body of response in line-by-line, key=value format. example, typical response might receive after sending request follows: --start:447777777777 status="ok" mcc="234" mnc="02" operatorname="o2" isoalpha3code="gbr" end:447777777777-- i sent request relevant parameters such want information of msisdn "447766551112" url parameter example http://api.txtnation.com/networks/lookup?username=user123&password=pwd123& msisdn=447766551112 my code string addparam=java.net.urlencoder.encode("username", "utf-8") + "=" + java.net.urlencoder.encode(username, "utf-8") + "&" + java.net.urlencoder.encode("password", "utf-8") + ...

wpf - Compile each XAML page as DLL -

i understand "this" query may sound generic pointers guide highly appreciated. we building wpf application based on mvvm design pattern (with devxpress controls) , want achieve following. there 1 .exe file run applications. all xaml files need dll [why? - reasons specified below]. call dll dynamically , load in wpf application. [why?? - reasons] our application client/server intranet application. planning use clickonce deployment deploy application. in case there changes application, though don't have change entire application , recompile , deploy client machines updated. instead can change screen or xaml file needed , update on server , clickonce automatically handles updates on clients. also, helps in maintaining our application , less troublesome developers , ui designers. i welcome better approach also.

trendline option (excel) in matlab -

in excel remember being able select specific trendline termed 'power' according documentation: 'a power trendline curved line best used data sets compare measurements increase @ specific rate — example, acceleration of race car @ one-second intervals. cannot create power trendline if data contains 0 or negative values'. how can implement in matlab? for example: a = [15.5156,0.1995; 7.6003,0.2999; 9.4829,0.2592; 12.2185,0.2239; 23.4094,0.1811]; figure;scatter(a(:,1),a(:,2)) here working solution: a = [15.5156,0.1995; 7.6003,0.2999; 9.4829,0.2592; 12.2185,0.2239; 23.4094,0.1811]; x = a(:, 1); y = a(:, 2); n = 2; % order of fitted polynomial trendline p = polyfit(x, y, n); m = 1000; % number of trendline points (the larger smoother) xx = linspace(min(x), max(x), m); yy = polyval(p, xx); figure; hold on; scatter(a(:,1), a(:,2)); plot(xx, yy, 'r-'); you can put trendline calculator code separate function.

Generalizing an iterative function over a collection of Objects in Java -

i have generalize repeating , repeating code single method possible ? //attrrischio sagtblobjattrischioang sagtblobjattrischioang = elemtout.getattrischio(); if(sagtblobjattrischioang.length()>0) { (int j = 0; j <sagtblobjattrischioang.length(); j++) { sagobjattrischioang item = sagtblobjattrischioang.getelement(j); system.out.println(tostringentities.tostring(item)); } } // beni sagtblobjbeniang sagtblobjbeniang = elemtout.getbeni(); if(sagtblobjbeniang.length()>0) { (int j = 0; j <sagtblobjbeniang.length(); j++) { sagobjbeniang item = sagtblobjbeniang.getelement(j); system.out.println(tostringentities.tostring(item)); } } and on , on again both sagtblobjattrischioang , sagtblobjbeniang implement common interface (e.g sagtabobj , implement method length , getelement retur...

c# - Update the selected dropdownlist value base on value from another linq query -

i use following code lov dropdownlist , setting selected value well: viewdata["dropdown_color"] = correspondingdropdownvalue .select(j => new selectlistitem { text = j.listofvalue, value = j.listofvalue, selected = j.listofvalue == x.defaultvalue }) .tolist(); now have dropdownlist in viewdata , want update selected value of viewdata["dropdown_color"] base on following query var userpref = m in db.usercolorpref m.userid.equals(usersessionid) select m; the value updated can access userpref.color . may know how achieve objective? use this list<selectlistitem> selectlist...

jquery - How get value from iframe? -

i have page test.php when click on button on page upload iframe in popup fancybox. iframe have select. i when change value in select original page value select iframe. i make: $(function() { $("#select").on('change',function() { $('.tk').val($(this).val()); // original page have <input type="text" class="tk"> parent.$.fancybox.close(); }); }); but value of select not transmitted input in page... how make this? p.s.: $(window.top).find(".tk").val($(this).val()); not work...

google apps script - HTML Service - Dropdown option list from GSheet -

into google apps script , html service code.gs function doget() { return htmlservice.createtemplatefromfile('htmlui').evaluate() .setsandboxmode(htmlservice.sandboxmode.native); } here html htmlui.html <script type="text/javascript"></script> <script> <? var sheet = spreadsheetapp.openbyid("0avt7ejriwlxudgzfv2xjugjzlxktq2rhqu1urugtaxc").getsheetbyname("mrf tab"); var lastrow = sheet.getlastrow(); var myrange = sheet.getrange("c3:c"+lastrow); var data = myrange.getvalues(); ?> </script> <select> <? (var = 0; < sourcedata.length; ++i) { ?> <option><?!= sourcedata[i] ?></option> <? } ?> </select> i had code in 1 of project (and lot more code) captures information form sheet , add options (dropdown) in select, when trying same code in new project isnt working, ideas missing. at present result displayed dropdown box <?!=sourcedat...

html - Remove the left space from <ul> navigation -

the navigation appears margin left. tried many things couldn't remove left margin. how can remove space? here online demo . #navcontainer { padding: 0 5 20px 10px; } ul#navlist { font-family: sans-serif; margin-left: 0;} ul#navlist li { padding: 10px 5px 10px 5px; background-color: #ef634a; } ul#navlist > li { height:38px; line-height:38px; } ul#navlist li:hover { color: #ffff00; background-color: #3e748a; } ul#navlist { font-weight: bold; text-decoration: none; display: inline-block; line-height:1.1; vertical-align: middle; } ul#navlist, ul#navlist ul, ul#navlist li { padding: 0 8px; margin: 0 8px; list-style-type: none; box-shadow: 8px 8px 12px #aaa; } ul#navlist li { float: left; } ul#navlist li { color: #ffffff; //padding:10px; /*border: 1px #ffffff outset; height: 40px;*/ } ul#navlist li:active { color: #cccccc; background-color: #3e748a; border: 1px #ffffff inset; box-shadow: none; } ul#subnavlist { dis...

android - NullPointer Exception in getWidth(), getHeight() -

i working on project . need width & height of linearlayout activity using programming code. linear layout has fixed width , height . when use following ..i getting nullpointer exception linearlayout viewgroup = (linearlayout) context.findviewbyid(r.id.popup); log.e("getwidth",""+viewgroup.getwidth()); log.e("getheight",""+viewgroup.getheight()); i need width , height of layout activity. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/popup" android:layout_width="150dp" android:layout_height="252dp" android:background="#303030" android:orientation="vertical" > </linearlayout> here java code file public class mainactivity extends activity { //the "x" , "y" position of "show button" on screen. point p; button btn_show; @override public void oncreate(bundle savedinstancestate) { super...

vba - Convert TZ data in Excel -

i'm using excel display time stamps log file. time stamps in raw output of file displayed millisecond precision, need maintain. time stamps in utc, need convert local timezone. when use dateadd function convert tz offset, sets millisecond value '000'. getlocaltimefromgmt = dateadd("h", offset, datetoconvert) is there way use dateadd without losing precision, or there function better suited task? please check below link more details. http://www.cpearson.com/excel/timezoneanddaylighttime.aspx function getlocaltimefromgmt(optional gmttime date) date ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' getlocaltime...

regex - Grepping for the form action= part of html pages -

i trying grep parts of html form, action part i.e. <form action = …. tried: grep -e -e 'form\s*action\s*=.*[.]html' ./* did not work (despite fact there such strings. tried basic: grep -e -e 'form\s*action\s*=' ./* did not work either! doing wrong? this wont action. part before action. example if have <form id="myform" action="myfile.php"> the regexp form id="myform" action= so try in stead: grep -e -o -i -e '<form\s+[^>]*action\s*=[^>]*>' ./* [^>]* means except > , 0 or more times. -o means matching part -i means case insensitive

p4 CLI: How to find new files not yet "added" to perforce control -

i have looked @ different ways of doing using diff. first option tried is: p4 diff -sa opened files different revision in depot, or missing. initially figured file write permission bit set did not exist in depot. however, have since learned p4 doesn't use mode bits track opened/unopened states first thought. next figured option work: p4 diff -sl every unopened file, along status of 'same', 'diff' or 'missin' compared revision in depot. this okay, except "unopened" not inclusive of "untracked" files. although, when ran this, produced quite different contradicts documentation; output pretty tracked, output wasn't tracked, flagged them 'same'. maybe means hasn't been added , doesn't exist in depot, client same depot...? in svn biased opinion, rather pointless option. then there 'opened' option. that. lists files in depot have been opened on client; not files modified on client no...

enums - Ada enumerations with duplicate values -

i'm trying have device register enumeration. reading register has 2 values -> 0 means done, 1 means pending. likewise, writing register has 2 values -> 0 has no action , 1 reset. so, wrote following code type soft_reset (done, pending, no_action, reset); soft_reset use (done => 0, pending => 1, no_action => 0, reset => 1); but throws error gcc-4.6 -c -g -gnatg -ggdb -i- -gnata /home/sid/tmp/device.adb device.ads:93:20: enumeration value "no_action" not ordered gnatmake: "/home/sid/tmp/device.adb" compilation error is possible enumeration have duplicate values? i don't think so. think more elegant create 2 enumerated types indicating 1 corresponds possible readable values of register , other 1 corresponds writable values. something like: type register_status (done, pending) -- values can read type soft_reset (no_action, reset) -- values can written gneuromante's p...

select - Mysql alter query plan type -

hi have query select (select csn apps b a.key1=b.key1 , a.key2 = b.key2 , b.seq=max(b.seq) limit 0,1) csn, a.key1 apps group key1, key2 now when use explain type range , extras 'using index group-by'. plan takes 10 seconds complete on 350 000 row table. starts take 4 seconds, , execution plan type: index , extra: using where so question why happening once plan first , once second, , can alter plan somehow? okey figured out. innodb statistics off. called analyze table update statistics , got lower number.

(C++)Appending .zip to .exe using Chilkat 9.4.0 - unable to compile/link -

i'm trying "join" .exe file , .zip file method educational purposes. borrowed code here: http://www.chilkatforum.com/questions/2354/how-to-write-a-self-extractor-for-the-windows-os . code: #include <windows.h> #include <ckbytedata.h> #include <ckfileaccess.h> int main(int argc, char* argv[]) { const char *exefile = "c:/program.exe"; ckfileaccess foo; int exesize = foo.filesize(exefile); int nzeros = 4 - (exesize % 4); if (nzeros < 4) { ckbytedata zeros; zeros.appendcharn(0,nzeros); // append zeros .exe zeros.appendfile(exefilee); } // append .zip .exe ckbytedata zipdata; zipdata.loadfile("c:/mine.zip"); zipdata.appendfile(exefile); return 0; } these header files: ckbytedata.h: // ckbytedata.h: interface ckbytedata class. // /////////////...

c++ - Using Lcov in a cluster -

i working in c/c++ application solves logical formulas. in order make coverage analysis using gcov ( http://gcc.gnu.org/onlinedocs/gcc/gcov.html ) executing in cluster/grid , partially happy due fact can gather information interested in on other hand presentation layer difficult without big efforts in parsing data obtained. so decided use lcov ( http://ltp.sourceforge.net/coverage/lcov.php ) allow generate html output based on results, if can execute lcov locally in user workstation use in cluster did not find yet suitable way execute lcov in cluster, gather results of executions in nodes , generate html output combining results. any suggestions regard problem welcomed! thanks in advance! best!

gitlab - Notify all participants about merge request -

is there way notify gitlab project participants new merge request, can review changes , vote? @ moment responsible person notified , imho not team-oriented. if isn't supported, feature request add "feedback.gitlab.com" page . but consider " notify requester , not whole team on comment in merge request ": the whole team notified via email when comments on merge request. please add functionality notify 1 created merge request notified this done since 5.3, means comment on change request should notify group , , not owner.

c# - Delay on first call on DataReader.Read() -

i have odp connection oracle database. var reader = command.executereader(); whild (reader.read()) { //... } in situations first call reader.read() take more usual time (3 10 sectonds). next calls ok. not next calls ok of time closing application , re-running ok too! what parameters affect reader.read() take time more usual? update1: clarify situation consider situations: the application runs. lots of queries execute during application. user decides run report specific query tables execurereader called in proer time. now it's time read via reader. takes unusual time. user runs application again. it doesn't happen again. i guess caching mechanism on database. if database caching executereader() should have variant execution times.

java - TYPE_PHONE overlay view doesn't allow child GridView to capture onItemClick event -

my applications draws overlay has gridview it's child. clicks being captured overlay veiw's ontouch event , nothing passed gridview 's onitemclick event. code creates is: layoutinflater inflater = (layoutinflater) getsystemservice(layout_inflater_service); taskbarview = inflater.inflate(r.layout.view_overlay, null); taskbarviewparams = new windowmanager.layoutparams(taskbarinactivewidth, taskbarheight, layoutparams.type_phone, windowmanager.layoutparams.flag_not_touch_modal | windowmanager.layoutparams.flag_watch_outside_touch, pixelformat.translucent); taskbarviewparams.gravity = gravity.left | gravity.top; windowmanager = (windowmanager) getsystemservice(window_service); windowmanager.addview(taskbarview, taskbarviewparams); note: problem comes picture on api levels 16 , up . gridview captures it's onitemclick , overlay captures it's ontouch should below api level 16. am missing flag or something? ...

indexing - MySQL Table indexation -

i have table 11 fields. making select query data specific reason. select `id` `a` b not null, c not null, d not null order e desc i have made index on (b,c,d) , (e) mysql explain shows possible_keys group index, key null, , in section there - using where; using filesort full explain: id|select_type|table|type|possible_keys key|key_len|ref|rows|extra 1|simple|m|all|get_movies|null|null|null|6694|using where; using filesort

c# - Linq select common subset of nested lists -

i'll begin data structure. class device { public list<string> interfaces { get; set; } } list<device> alldevices; i use linq query select interfaces (strings) present in each device in alldevices list. thanks in adavance. update: aron managed resolve issue. here's solution: list<string> commoninterfaces = alldevices.select(device => device.interfaces) .cast<ienumerable<string>>() .aggregate(enumerable.intersect) .tolist(); var allinterfaces = device in alldevices interface in device.interfaces select interface; var allinterfaces = alldevices.selectmany(device => device.interfaces); and if richard dalton correct var allcommoninterfaces = alldevices .select(device => device.interfaces.asenumerable()) .aggregate(enumerable.intersect); for fun...here more 'optimal' solution. public static ienumerable<t> commonsubset...

Failed to deploy application to heroku -

i newbie heroku. trying deploy django application heroku following steps. installed vartualenv installed django gunicron via pip installed heroku toolbelt created empty git git add . git commit -m "first commit" ssh-keygen heroku create heroku keys:add git push heroku master and error (venv)han@heel:~/desktop/projects/ossko$ heroku keys:add found existing public key: /home/han/.ssh/id_rsa.pub uploading ssh public key /home/han/.ssh/id_rsa.pub... done (venv)han@heel:~/desktop/projects/ossko$ git push heroku master ssh: connect host heroku.com port 22: connection timed out fatal: not read remote repository. please make sure have correct access rights , repository exists. i have follow every steps heroku site. please me fix error i have ubuntu 13.4 64bit os update: here result of git remote -v : $git remote -v heroku git@heroku.com:infinite-mesa-xxx.git (fetch) heroku git@heroku.com:infinite-mesa-xxx.git (push) try running git...

Rename an XML node using PHP -

i'm trying figure out how rename node in xml using php? i have come far: $dom = new domdocument( '1.0' ); $dom->preservewhitespace = false; $dom->formatoutput = true; // load xml file $dom->loadxml( '<?xml version="1.0" encoding="iso-8859-1"?> <library> <data> <invite> <username>jmansa</username> <userid>1</userid> </invite> <update>1</update> </data> </library>', libxml_noblanks ); $xpath = new domxpath($dom); //find 'data' nodes. $node = $xpath->query("//data"); // if found if( $node->length ) { foreach ($node $n) { // rename here? // } } echo "<xmp>". $dom->savexml() ."</xmp>"; now, want rename <data> <invites> . can done , if yes, how? a node's name ("data" or "invites" respectively) cannot renamed...

qtp - How can I get the logical name of a test object (that exists in the associated shared OR)? -

let´s pass browser("mybrowser").page("mypage").webcheckbox("mybox") function: myfunction (browser("mybrowser").page("mypage").webcheckbox("mybox")) later, function wants log logical name of received test object (which in case, of course, "mybox"). how that? the "name" test object property returns name built if re-add test object. there no (documented) test object property logical name. runtime object properties can´t possibly contain name since not name aut gui. so think test object not know name. repository "knows" under name test object stored there. so have inspect repository itself, not test object. the objectrepositoryutil api allows me (via getchildren , or other methods) find test object in repository´s test object collection, , use getlogicalname method name. fine. but way work obtain reference repository loading it. impression api designed manipulate (or analyze...

reflection - Scala macros: convert Context#TypeTag to JavaUniverse#TypeTag -

i want use macros generate code instantiates objects this: import scala.reflect.runtime.universe._ case class example[t: typetag] { val tpe = implicitly[typetag[t]].tpe } this, obviously, translates following: import scala.reflect.runtime.universe._ case class example[t](implicit ev: typetag[t]) { val tpe = ev.tpe } then if class instantiated in regular code scala compiler provides typetag instance automatically. however, want generate code instantiates several instances of class different t s, concrete t s depend on user input, like sealed trait test case class subtest1 extends test case class subtest2 extends test val examples = generate[test] // want ^^^^^^^^^^^^^^ expand this: val examples = seq(example[subtest1], example[subtest2]) i know how subclasses of sealed trait, can access c.weaktypetag[subtest1] , c.weaktypetag[subtest2] in macro code. not know how turn them typetag s expected example.apply method. thought of using in() method seems allow tran...

asp.net mvc - Kendo grid export to pdf -

i'm relatively new mvc , kendo library. in project need way export data kendo grid( http://demos.kendoui.com/web/grid/index.html ) pdf. i found pretty example on how in entity framework used pass data grid. here example: http://www.kendoui.com/code-library/mvc/grid/export-grid-to-pdf.aspx . in project used nhibernate mapp data , later pass model in view. unfortunately don't understand code in example , cant figure out how change code . example: controller: using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; using kendo.mvc.ui; using kendomvcwrappers.models; using kendo.mvc.extensions; using system.collections; using system.io; using system.text; using itextsharp.text; using itextsharp.text.pdf; namespace kendomvcwrappers.controllers { public class homecontroller : controller { private nwentities db = new nwentities(); public actionresult index() { viewbag.messa...

specific SPARQL query with jena -

i use apache-jena 2.10.2 command-line tools , try insert data in graph: tdbupdate --loc /users/graph "insert data { <http://de.dbpedia.org/resource/mais> <http://ch.ingredientmatching.graph/eaternitysynonym> 15 }" unfortunately doesn't add anything. if change in predicate, e.g. delete or change character, works. following works: tdbupdate --loc /users/graph "insert data { <http://de.dbpedia.org/resource/mais> <http://ch.ingredientmatching.graph/eaternitysynonyn> 15 }" where changed last character: eaternitysynonym in eaternitysynonyn. see if worked, do: tdbquery --loc /users/graph "select * { <http://de.dbpedia.org/resource/mais> ?p ?o }" and if it's in output. please tell me i'm doing wrong. i tried reproduce problem describe, cannot. following console transcript shows creation of empty data file, creation of tdb store it, execution of update said didn't work, , execution of...

ruby on rails - Two variables in string -

i tried add 2 variables string: if code.alter_fehler == 'k' && code.alter_o.to_f <= 124 @arr << "bitte kodierung überprüfen: kode gilt überwiegend nur für patienten in der altersgruppe zwischen #{jahrtag(code.alter_u,'')} und {jahrtag('',code.alter_o)}." end how can see call in string 2 times def jahrtag in application controller: def jahrtag(zahlu,zahlo) if (zahlu && zahlo) == '0' return 'o tagen' end if zahlu == '1' return '1 jahr' end if zahlu == '8' return '8' end if zahlu == '12' return '12' end if zahlu == '15' return '15 jahren' end if zahlu == '18' return '18 jahre' end if zahlu == '30' return '30 jahren' end end but somehow, instead of getting correct variable 'for example: 1 jahr', variables printed out blank in view! know made wrong? thanks und {...

Run local Perl script on remote server through expect -

i have perl script on local machine, , want run on remote server. following command works fine: ssh user@ipaddress "perl - --arg1 arg1 --arg2 arg2" < /path/to/local/script.pl the thing prompt shows ask me password, , don't want that. i looked around net, , found 3 solutions: using public/private key authentication -> not ok in case using sshpass -> not in company's 'official' repo cannot install it using expect i followed page create expect script (i'm new expect): how use bash/expect check if ssh login works , took script correct answer, , replaced 3 first lines #!/usr/bin/expect -f have expect script. then ran ./ssh.exp user password ipaddress "perl - --arg1 arg1 --arg2 arg2" < /path/to/local/script.pl and have timeout error. if ran ./ssh.exp user password ipaddress "perl" i tried putting quotes like ./ssh.exp user password ipaddress '"perl - --arg1 arg1 --arg2 arg2" < /path/to...

android - Updating ListView Adapter from AsyncTask -

what have asynctask, started listview reached bottom item on screen, , in asynctask adds new items listview. here code: @override protected void onpostexecute(final list records) { super.onpostexecute(records); ((activityhome)context).runonuithread(new runnable() { public void run() { (itemdailyrecord p : records) { adapter.add(p); } adapter.notifydatasetchanged(); } }); } @override protected list doinbackground(void... voids) { dbadapterdailyrecord db = new dbadapterdailyrecord(context); list list = db.getrecordsfromto(offset, count); return list; } here method listview adapter: @override public view getview(int position, view convertview, viewgroup parent) { if(position == getcount() - 1 && hasmoreitems){ historyloadertask t = new historyloadertask(position + 1, pagesize...

ios - Cancel current UIScrollView touch -

i have uiscrollview few subviews , on. scrollview's delegate , have implemented - (void)scrollviewdidscroll:(uiscrollview *)scrollview . underneath scroll there view. i want show view if scrollview's contentoffset goes under 50px on x axis, "reset" scrollview's contentoffset , cancel current scrollview gesture user wont manipulate content when new view appears. i have implemented method so: - (void)scrollviewdidscroll:(uiscrollview *)scrollview { if (scrollview.contentoffset.x < -50) { scrollview.contentoffset = cgpointzero; [self showbackview]; //here want cancel current touch on scrollview since keeps scrolling if drag finger } } i have tried set userinteractionenabled property no takes effect after touch has ended. , have tried bunch of other properties none seems work. how can fix this? try disabling pangesturerecognizer scroll view (and reenabling it). cancel current session of recogniser: ...

java - Nullpointerexception when trying to send data from activity to class -

i need guys. i'm making quiz i'm stuck. first of got activity can choose between categories: package com.laurenswuytsjordipapen.cultural.pursuit; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.os.bundle; import android.preference.preferencemanager; import android.view.view; import android.widget.button; import com.laurenswuytsjordipapen.cultural.pursuit.library.userfunctions; public class dashboardactivity extends activity { userfunctions userfunctions; button btnlogout; button btneuropa; button btnamerika; button btnafrika; button btnazie; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); /** * dashboard screen application * */ // check login status in database userfunctions = new userfunctions(); if(userfunctions.isuserloggedin(getapplicationcontext())){ ...