Posts

Showing posts from April, 2011

javascript - jQuery booklet - How to set width to page width -

Image
i trying set jquery booklet plugin's width 100%, get: code: <script type="text/javascript"> $('#booksslider').booklet({ manual: false, overlays: false, keyboard: false, auto: true, shadows: true, height: '100%', width: '100%', pagenumbers: false }); </script>

c - Acquire string from user and then delete it from screen -

this simple program acquires characters users (till newline character) , prints them: #include <stdio.h> int main() { char local_message[200]; scanf("%[^\n]%*c", local_message); printf("your message %s\n", local_message); return 0; } but when run it, characters typed stay printed screen: hello world! message hello world! the characters typed "hello world!\n". when press "enter" create newline \n character, message disappears screen (while being stored char array), can print (and format) following printf . the os linux. is possible? how? you may able terminal escape codes. #include <stdio.h> int main ( ) { char local_message[200]; scanf("%199[^\n]%*c", local_message); printf ( "\033[0a");//move cursor 1 line printf ( "\033[2k");//clear line printf("\nyour message %s\n", local_message); return 0; } edit: give little more ...

mobile - Xamarin forms: The equivalent of .Finish() -

i have xamarin forms application on 3 platforms. app has login screen , other pages available 1 user has logged in. question is: in xamarin forms; there way have equivalent of finish method xamrin android provides remove login page navigation stack? if user keeps pressing button login screen undesirable. have tried using navigation.popasync () seem not work navigation.popasync , navigation.removepage should work. but if page mainpage can't remove it. change page using code: app.current.mainpage = new navigationpage(new mycontentpage());

java - JPA - Changing the Name of the mappedBy column -

okay have application maps semesters courses -: public class course { private string courseid; private string coursename; private collection<semester> semesters = new arraylist<>(); @onetomany (targetentity = semester.class, mappedby = "course") public collection<semester> getsemesters() { return semesters; } public void setsemesters(collection<semester> semesters) { this.semesters = semesters; } @id @column (name = "course_id") public string getcourseid() { return courseid; } public void setcourseid(string courseid) { this.courseid = courseid; } @column (name = "course_name", nullable = false, unique = true) public string getcoursename() { return coursename; } public void setcoursename(string coursename) { this.coursename = coursename; } } as can see users class mapped semesters entity using 1...

How to put default value in EditText in Android Studio -

i trying put value in edittext can not. the code edit: <edittext android:textcolor="@color/white" android:id="@id/input_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="20.0dip" android:hint="@string/input_username_hint" android:ems="10" android:singleline="true" android:maxlength="140" android:layout_below="@id/input_room_name" android:layout_centerhorizontal="true" /> when put android:text="user" genarated apk not opening. do this: edittext.settext("your default text"); but if want show gray text disappears when user starts type, you're looking android:hint . on xml: android:hint="your default text" on java: edittext.sethint("your default text");

mongodb c++ driver- error: “mongo::client” has not been declared -

i got error when trying test example after installing mongodb , boost , mongodb-cxx driver (the example use c++ driver mongodb) the version of driver trying build (branch or tag). legacy git clone https://github.com/mongodb/mongo-cxx-driver.git git checkout legacy host os, version, , architecture. raspbian wheezy : linux version 3.18.14-v7+ (root@vagrant-ubuntu-trusty-32) (gcc version 4.8.3 20140106 (prerelease) (crosstool-ng linaro-1.13.1-4.8-2014.01 - linaro gcc 2013.11) ) c++ compiler , version. g++/gcc (debian 4.6.3-14+rpi1) 4.6.3 boost version. examples: boost 1.58.0 how boost built or installed. http://www.boost.org/doc/libs/1_55_0/doc/html/bbv2/installation.html ./bootstrap.sh ./b2 install --prefix=prefix the complete scons invocation. scons i haven't done configure ... i trying run file g++ -i/opt/mongo/include/ -i/opt/mongo/include/mongo -i/home/pi/boost_1_58_0/prefix/include -l/home/pi/boost_1_58_0/prefix/lib -l/opt/mongo/lib...

python 2.7 - Selenium - chromeDriver u'unknown error : chrome field to start -

i'm pretty new in selenium , getting error chromewebdriver. i'm using: chrome 36, chromewebdriver 2.10, windows 7 here's code: from selenium import webdriver webd = webdriver.chrome(); but response unknown error : chrome field start how can fix this? you may need download chrome executable driver http://chromedriver.storage.googleapis.com/index.html , set executable path accordingly. sample python code : import os selenium import webdriver selenium.webdriver.common.keys import keys chromedriver = "./chromedriver" os.environ["webdriver.chrome.driver"] = chromedriver driver = webdriver.chrome(chromedriver) #driver = webdriver.firefox() driver.get("http://www.python.org") print driver.title assert "python" in driver.title for more information , end end script follow reference

html - angularjs fields blocked -

i have issue angular application, it's in pc; on one, it's working. i have fields blocked (not disabled); when try edit item, it's frozen. here code: <div class="form-group left-text " > <div class="col-md-3 col-sm-12" >question :</div> <div class="col-md-7 col-sm-12"> <input type="text" class="form-control" ng-model='item.question' value="<%item.question%>" ng-disabled='currentdict.id != 0'><br/> </div> </div> $scope.onload = $http({ method: 'get', url: '/item' }).success(function(data, status, headers, config) { $scope.item = data; what freeze field , other fields too? in same form have these 2 lists 1 in bottom working , other frozen ! half of form in top frozen : <div class="form-group left-text " > <div class="col-md-3 col-sm-12" >...

android - ViewPager in a row of a RecyclerView - IllegalArgumentException: No view found for id for fragment -

i tried create recyclerview multiple view type, including viewpager inside row. for recyclerview , integrate 2 libraries : the first one, superslim library , used recyclerview , integrates sticky header . the second one, viewpagerindicator , used viewpager , integrate indicators it. well, context in place ! so, when try display recyclerview , application crash following error. java.lang.illegalargumentexception: no view found id 0x7f0c0062 (com.tspckr.vpinsidercrow:id/rowviewpager) fragment pagefragment{41fc0f78 #0 id=0x7f0c0062 android:switcher:2131492962:0} but if add handler delay displaying data (like if perform network request), recyclerview displaying not data in viewpager except viewpagerindicator show indicators waited. most interesting thing, if try scroll viewpager @ end , rotate device, viewpager show (normally) content. i think bugs because viewpager instantiate and, when try attach data, doesn't update or there no more reference on ... ...

apache - Pass OS values to extJS app -

how can access external system values within extjs application? 1 of main reasons need instead of doing authentication extjs application, using apache provide protected directories on server, want able pass of information user application, once authenticated , app opened. far easier use ldap authentication in manner... pass values through: apache → backend app → generated html → frontend app (ext js) your backend application, whatever technology built on, see authentication information apache in environment variables. actual variable names depend on setup. googlable as: apache auth user environment variable <your_backend_technology> then, information obtained apache need inserted in html javascript/json bit this: <script type="text/javascript"> var auth_info = { "username": "john smith" // other information }; </script> note needs inserted before ext js code. finally, in ext js app, acce...

python - How to capture the current namespace inside nested functions? -

suppose 1 had following: def outer(foo, bar, baz): frobozz = foo + bar + baz def inner(x, y, z): return dict(globals().items() + locals().items()) return inner(7, 8, 9) the value returned inner dictionary obtained merging dictionaries returned globals() , locals() , shown. in general 1 , returned value not contain entries foo , bar , baz , , frobozz , though these variables visible within inner , , therefore, arguably belong in inner 's namespace. one way facilitate capturing of inner 's namespace following kluge: def outer(foo, bar, baz): frobozz = foo + bar + baz def inner(x, y, z, _kluge=locals().items()): return dict(globals().items() + _kluge + locals().items()) return inner(7, 8, 9) is there better way capture inner 's namespace sort of kluge? 1 unless, is, variables having names happen present in current global namespace. this isn't dynamic, , it's not best way, could access variable...

python - FBX SDK - Get the FbxNode from an ENodeId of a Character -

is possible associated fbxnode enum enodeid ? example if want fbxnode character::elefthand i tried use character::getcharacterlink(enodeid, fbxcharacterlink) extracting fbxnode fbxcharacterlink calling fbxcharacterlink::mnode however function returns enodeids false, no fbxcharacterlink created. character = myscene.getcharacter(0) lefthand = character.elefthand lefthand_node = fbxcharacterlink() character.getcharacterlink(lefthand, lefthand_node) # false lefthand_node = lefthand_node.mnode when scripting inside motionbuilder using python , pyfbxsdk , easy, no matter how skeleton objects named, can fbxobject of it m = character.getmodel(self.bodynodeobject[o]) and bodynodeobject generated with def bodynodes(self): in dir(fbbodynodeid): if i[0] == 'k': try: self.bodynodeobject[bodynodesid[i]] = getattr(fbbodynodeid, i) except: pass bodynodesid dictionary bodynodesid = ordereddict({ ...

javascript - kik.getUser() callback function is not being called? -

i've been trying make kik app can make cross platform game without learning 2 languages , keeping social considering game built directly kik , messaging. plan have app ask user's kik identity , either create account them on backend or log them in anonymous key or something. however, havent gotten far since when run code below, when gets callback message in kik.getusers(), opens accept dialog, , when click button dialog never shows up, fact maybe alerts dont work on mobile devices (i can't work anywhere in code) im not sure. also, hit 'ok' on dialog once , dialog never show again. i'm sure has kik remembering decision, reset can test app again. please help! in advance. code: javascript if(kik.enabled) { alert("asdf"); if(kik.haspermission()) { alert("asdf"); kik.getuser(function getuser(user) { if(!user) { alert("please allow wagery have soul."); ...

android - Using Lollipop's Transition API on a DialogFragment -

i've been reading multiple sources on how implement lollipop's transition animation seamlessly move between activities , fragments. that said, can't seem make work dialogfragment . here's i've tried far: i've activity1 hosts list of items in listview . in oncreate() method, i've made request enable transitions: @override protected void oncreate(final bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().setsharedelementexittransition(transitioninflater.from(this) .inflatetransition(r.transition.change_bounds_shared_element)); ... i've built (and assigned) custom adapter in way listen click events , notified item being clicked view . used information compose transition (setting transitionname , whatnot) such this: ... @override public void oncardclicked(final view view, final card card) { view.settransitionname("rootlayout"); final carddetailsfragment fragment = carddetailsf...

python - Numpy: Fix array with rows of different lengths by filling the empty elements with zeros -

the functionality looking looks this: data = np.array([[1, 2, 3, 4], [2, 3, 1], [5, 5, 5, 5], [1, 1]]) result = fix(data) print result [[ 1. 2. 3. 4.] [ 2. 3. 1. 0.] [ 5. 5. 5. 5.] [ 1. 1. 0. 0.]] these data arrays i'm working large appreciate efficient solution. edit: data read in disk python list of lists. this 1 approach - def numpy_fillna(data): # lengths of each row of data lens = np.array([len(i) in data]) # mask of valid places in each row mask = np.arange(lens.max()) < lens[:,none] # setup output array , put elements data masked positions out = np.zeros(mask.shape, dtype=data.dtype) out[mask] = np.concatenate(data) return out sample input, output - in [222]: # input object dtype array ...: data = np.array([[1, 2, 3, 4], ...: [2, 3, 1], ...: [5, 5, 5, 5, 8 ,9 ,5], ...: [1, 1]])...

uiview - Custom popup view in Swift (Interface Builder) -

is there way can show custom popup in middle of screen (over current content) buttons , textfield , else may need, entirely in interface builder? if isn't possible, don't mind doing programatically. i guessing create custom view content not sure how show view when button clicked , bring on current view controller. thanks! i create view , viewcontroller it- set alpha of view 0 invisible - nice picture background custom popuop on ( background popup) on put buttons , text label. voilà - costum pop-up ready present segue (choose type on current view controller).

asp.net - VB.net website conversion to C# -

i'm trying convert old website vb c#, have been using teleriks online code converter i'm stuck on 1 particular area: navbar.ascx contains asp hyperlinks form navigation bar the first line of looks this: <%@ control language="vb" autoeventwireup="false" codefile="navbar.ascx.vb" inherits="nav_bar" %> navbar.ascx.vb looks like: partial class nav_bar inherits system.web.ui.usercontrol end class after putting through online converter , trying fix problem myself i'm left with: navbar.ascx <%@ control language="vb" autoeventwireup="false" codebehind="navbar.ascx.cs" inherits="nav_bar" %> navbar.ascx.cs using microsoft.visualbasic; using system; using system.collections; using system.collections.generic; using system.data; using system.diagnostics; partial class nav_bar : system.web.ui.usercontrol { } when try build project error - not load type 'nav_bar...

set values for multiple nouislider in meteor -

how set multiple instances of nouislider in meteor? i have initialed multiple sliders on page codes in this . set value of sliders synchronized collection, able initialized value collection in "start" option. i've been trying calling function on 'slide' event. in function find no way select sliders, or use .val(). var updatesliders=function(){ var slider=$(".sliderrr"); console.log(slider); slider.each(function(){ console.log($(this).val()); }) }; i base answer on wrote on github <div class="slider-container"> <div class="sliderrr"></div> </div> and var slider=$(".sliderrr"); slider.each(function(){ console.log("value:",$(this).val()); }) the problem calling 'each' on sliderrr instead of slider-container. template.body.rendered = function () { //init slider this.$('.sliderrr').nouislider({ start: 5, c...

android - Loading contacts from phonebook causing the app to stop -

i trying fetch contacts phonebook , show them in listview. problem contacts have been fetched & showed in listview after few seconds app goint crashed, fetching contact list & fitting items in listview sucessfull app crashed after time. here mainactivity.java- public class mainactivity extends listactivity { // arraylist<string> values = new arraylist<string>(); string[] values; context mcontext; string name; int j=0,c=0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); cursor phones = getcontentresolver().query(contactscontract.commondatakinds.phone.content_uri, null,null,null, null); while (phones.movetonext()) { name=phones.getstring(phones.getcolumnindex(contactscontract.commondatakinds.phone.display_name)); c=c+1; } phones.close(); values = new string[c]; fun(); myarrayadapter adapter = new myarrayadapter(th...

iot - Bluemix Node-Red -

i newbie bluemix , node red (even stackoverflow). have tried create app in bluemix using node red , iot foundation starter, neither creates app. error message is: bxnui2028e: cloud foundry issued unexpected exception following message: "read timed out" see troubleshooting topics in ibm bluemix documentation check service status, review troubleshooting information, or information getting help. i searched stackoverflow , problem mentioned, reported fixed few days ago. appreciated. not sure if case similar one https://developer.ibm.com/answers/questions/164719/bxnui2028e-cloud-foundry-issued-an-unprocessed-exc.html if not suggest open ticket bluemix support(see support tab inside bluemix console) attaching log indicated here: https://www.ng.bluemix.net/docs/troubleshoot/getting_customer_support.html#collect_diag i hope helps.

RSS Aggregator With Auto-Search -

does know if there rss aggregator around whereby can: select number of rss feeds (just normal functionality - can select la times, ny times, whatever feeds like) and input number of search terms (boolean operators) and have output items match search terms? basically, select major news feeds , enter search terms - , i'd see results subjects i'm interested in. results wouldn't sorted/shown feed, subject (i.e., search term). does such app exist? online newsreader inoreader (in "pro" version) have "filter" , "rule" feature can create such filters boolean operators or regex. can operate on single feed, folder or feeds. have "active search" feature. can create special folder items responding search appear in folder. self-hosted open source newsreader tiny tiny rss , have filter feature (regex only). if fits goals, 2 platforms may allocate tag each responding item. tag, can generate "outgoing feed". ...

php - Is there any way to check the id of a $_POST variable? -

i need distinguish 2 variables being passed form. important these 2 variables have same name. because of have given them different ids (but classes, doesn't matter in application). need know if there way @ $_post variable, , have php tell me id before lumped in array of values same name. you can have 2 different form fields same name if create array name, such as: <input type="text" name="category[]" value="red" /> <input type="text" name="category[]" value="blue" /> then when you've posted form values can examine $_post value var_dump(), such as: <?php var_dump($_post); ?> and can retrieve values array.

Scala Stream function evaluation -

i got following code: trait stream[+a] { def uncons: option[(a, stream[a])] def foldright[b](z: => b)(f: (a, => b) => b): b = { uncons.map(t => { f(t._1, t._2.foldright(z)(f)) }).getorelse(z) } def exists(p: => boolean) = foldright(false)((x, acc) => acc || p(x)) def forall(p: => boolean) = foldright(true)((x, acc) => p(x) && acc) } object stream { def cons[a](h: => a, t: => stream[a]): stream[a] = new stream[a] { lazy val uncons = some((h, t)) } } then create stream in lazy manner , invoke exists method check stream elements evaluated: println(stream.cons({println("5"); 1}, stream.cons({println("6"); 2}, stream.cons({println("7"); 3}, stream.cons({println("8"); 4}, stream.empty)))).exists(_ == 1)) and see is: 5 6 7 8 true so elements evaluated in spite of first 1 enough. seem understand why exists acts way does. then run following code: ...

c# - Which part of mvc design pattern represents the business logic? -

i little confused definition of business logic in programming because used develop without paying attention of these terminologies want developer. while reading in wiki definition of business logic have read following definition: in computer software, business logic or domain logic part of program encodes real-world business rules determine how data can created, displayed, stored, , changed. and in website have read following definition example: business logic portion of enterprise system determines how data is: transformed and/or calculated. example, business logic determines how tax total calculated invoice line items. routed people or software systems, aka workflow. so wondering part of mvc represents business logic, controller or model or part in mvc? i know controller responsible sending commands model responsible applying rules of business? for example let's take above example of tax: suppose got invoice data form in view, data directed cont...

javascript - Changing the line-height inside a div after ajax call -

i'm trying set line-height of words in div after ajax call. after added code below ajax function, function stopped working. wrong code below? thanks. objdiv.style.line-height = '20px'; the correct property lineheight not line-height objdiv.style.lineheight = '20px';

javascript - How to return a constructor argument value from a getter function in ES6 Classes -

example: class person { constructor(name) { } name() { return /* “name” argument constructor */; } } i name getter returns name value passed in constructor. save argument instance property: class person { constructor(name) { this.name_ = name; } name() { return this.name_; } } demo

Lock down Cloud Endpoints API to only work with specific Android App -

i'm trying lock down cloud endpoints api android app can use it, however, not want use oauth2+google accounts that. reason not want require users have google account login app. example, snapchat uses google app engine, not require have google email use app - create own user name , password. i have read several posts offering suggestions: how restrict google app engine endpoints api access android applications? authenticate "app" google cloud endpoints not "user" how protect api built using google cloud endpoints? but wasn't able find satisfactory answer. read, considering having "token" parameter cloud endpoints api method own 64 character long random string. server-side, compare passed in token string stored on server in server code. if match, bingo! have access run method. if don't, error. a potential problem above approach try decompile apk, token stored in pain text inside android code, , make calls api. i reading parse.co...

ruby - Best way to implement a large 2D Lookup Table in Rails -

i developing rails app , 1 of actions compares 2 of same kind of objects , returns decimal value between 0 , 1. there 800 objects need compared, there 800*800 possible decimal values can returned. each action call requires 300 or comparisons, made via api. because of number of api calls needed, have decided best approach make lookup table 800*800 api comparison values stored locally, avoid having rely on api, has call limits , significant overhead per call. basically have decided lookup table best suits task (although open suggestions on too). my question this: best way implement 2 dimensional lookup table ~800 "rows" , ~800 "columns" in rails? example, if wanted compare objects 754 , 348, best create models rows , columns , access decimal comparison like: object1.754.object2.348 # => 0.8738 or should store of values in csv or this? if better approach, how should approach setting up? relatively new rails world apologies if obvious answer dangling in...

Objective-C++ cannot initialize parameter of type id<...> with lvalue of type MyType *__strong even though it conforms to protocol -

i'm trying use avkit in osx objective-c++ application, , have videosource class conforms avcaptureaudiodataoutputsamplebufferdelegate , compiler won't accept parameter of type id<avcapturevideodataoutputsamplebufferdelegate> . error: capture.mm:30:48: cannot initialize parameter of type 'id<avcapturevideodataoutputsamplebufferdelegate>' lvalue of type 'videosource *__strong' this code: capture.h #ifndef threesai_capture_h #define threesai_capture_h #ifdef __objc__ #import <foundation/foundation.h> #import <avfoundation/avfoundation.h> @interface videosource : nsobject <avcaptureaudiodataoutputsamplebufferdelegate> @property avcapturesession *s; - (id) init; @end #endif void hello(); #endif capture.mm #import "capture.h" @implementation videosource - (id) init { if (self = [super init]) { self.s = [[avcapturesession alloc] init]; avcapturedevice *camera = [avcapturedevice device...

coldfusion - Making sure custom tag does not have subtags -

i building custom tag wrap around glyphicons. <b:icon binding="i" /> part of glyphicon spec includes: only use on empty elements icon classes should used on elements contain no text content , have no child elements. i want make sure no 1 like <b:icon binding="i"> <cfset myvariable++> </b:icon> is there way make sure custom tag not have inner tags? well have 2 options can see. first, throw exception if thistag.executionmode other "start" . or 1 likewise throw exception if thistag.hasendtag true . restrict tag usage to: <b:icon binding="i"> and not : <b:icon binding="i" /> because /> shorthand end-tag. less ideal, , perhaps won't accept approach. secondly can check if there's generatedcontent big haphazard because it's entirely possible have between starting , closing tags, careful not generate content: <b:icon binding=...

java - RecyclerView Not Displaying Data Received -

Image
i getting data firebase (online data storage) somehow in adapter class, dataset []. when pass in 20 random things using same class, works perfectly. here code. fragment class: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); myfirebaseref = new firebase("http..."); initlistitems(); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_products, container, false); // inflate layout fragment mrecyclerview = (recyclerview) rootview.findviewbyid(r.id.list); mrecyclerview.setlayoutmanager(new linearlayoutmanager(getactivity().getapplicationcontext())); madapter = new myadapter(mdataset); mrecyclerview.setadapter(madapter); return rootview; } // data firebase , set list private void initlistitems() { // attach listener read data @ our posts refe...

Kendo Scheduler event is not getting updated after resize -

i have kendo scheduler transport function. below url http://runner.telerik.io/fullscreen/igoba here in scheduler when try resize event or move event event widget getting resized/moved fraction of second , comes previous stage. data getting updated in backend(it not there in above example) if refresh page showing updated event widget. kendo ui demo ( http://demos.telerik.com/kendo-ui/scheduler/index ) removed create , delete event transport , made update javascript function. small change event widget failing updated size... please me if know appreciated.

javascript - Changing number of array elements during a simulation -

i trying change number of bouncing balls in simulation. passing required number using socket.io, i'm struggling change number of balls. here javascript: var width = 100, height = 200, numballs, balls; $(document).ready(function() { var socket = io(); socket.on('message', function (data) { console.log(data.count); numballs = data.count }); $('#mycanvas').click(bounce); // create array of balls balls = new array(numballs); for(i = 0 ; < numballs ; i++){ balls[i] = new ball(); } }); function ball(){ // random radius this.radius = math.floor(math.random()*(10-5+1))+5; // random x , y this.x = math.floor(math.random()*(width-this.radius+1))+this.radius; this.y = math.floor(math.random()*(width-this.radius+1))+this.radius; // random direction, +1 or -1 this.dx = math.floor(math.random()*2) * 2 - 1; this.dy = math.floor(math.random()*2) * 2 - 1; //random colour, r, g or b ...

vb.net - How To Replace or Write the Sentence Backwards -

i have block of code or function in vb.net can write sentence backwards. for example : love visual basic result : basic visual love this have far: dim name string dim namereversed string name = richtextbox1.text namereversed = "" dim integer = len(name) 1 step -1 namereversed = namereversed & replace(name, i, 1) next richtextbox2.text = namereversed the code works not give me value of want. makes whole words reversed. dim name string = "i love visual basic" dim reversedname string = "" dim tempname string = "" integer = 0 name.length - 1 if not name.substring(i, 1).trim.equals("") tempname += name.substring(i, 1) else reversedname = tempname + " " + reversedname tempname = "" end if next start index 0 , deduct 1 length because length count starts 1 index count starts zero. if put to name.length ret...

Android FTP server authenticates once -

i trying implement ftp server in application using apache ftp server library . the server , running , working fine, once. note: using hardcoded user now. username: test , password: test so in order: app launched, server started, lets ftp clients login. app killed user. app started user , server started. replies 530 authentication failed user logging in username: test , password: test after responds 530 authentication failed my code below making server: public void makepropertiesfile(){ file file = new file(environment.getexternalstoragedirectory().getabsolutepath()+"/download/user.properties"); if(file.exists() == false){ try { file.createnewfile(); logmessage("user.properties file did not exist, made one"); properties = file; this.addusers(); } catch (ioexception e) { e.printstacktrace(); } } else { logmessage("file exists, no ne...

xamarin.android - Close PageRender after starting activity in Xamarin.Forms -

in forms2native 's android example, mythirdpagerenderer starts new activity mythirdactivity . however, when going mythirdactivity , blank page , need push go button 1 more time main page. how kill blank page automatically? looks ran exact same issue , posted bug report. within bug report mentioned issue particular sample , not issue xamarin forms itself. check out here, hope helps: https://bugzilla.xamarin.com/show_bug.cgi?id=23983

jquery - JavaScript pictureChange() and rotation -

i've been searching hours on internet solve problem , still can't find solution. i'm new in js, i'm quite excited still have problems when writing code. i'd is, onclick , change picture while rotating it. had first part of effect ( works once, image stop rotating), i'd rotate again of 180 deg , change first image. idea menu 3 bars, google ones, becomes "x" when clicked, , vice versa. first part of script, var img = document.queryselector('.navicon'); img.addeventlistener('click', onclick, false); function onclick() { var deg = 180 ; var css = '-webkit-transform: rotate(' + deg + 'deg);'; this.setattribute( 'style', css ); } function picturechange() { document.getelementbyid("navicon").src="images/buttons/xbutton.png"; } this css .navicon:hover { opacity:0.7; } .navicon { margin-top: 25px; margin-left:-75px; position:relative; display:block; left:50%; width: 45px; height:4...

linux - Linking two arguments - Shell Script -

i'm writing shell script, , here example input file. 1 n 0.000000 0.000000 0.000000 0 2 5 6 7 2 c 0.000000 0.000000 1.480000 0 1 3 8 9 3 c 1.430212 0.000000 2.000555 0 2 4 13 4 o 2.255128 -0.786666 1.463647 0 3 5 h -0.693210 0.693210 -0.347159 0 1 6 h -0.252566 -0.947254 -0.347159 0 1 7 h 0.947254 0.252566 -0.347159 0 1 8 h -0.501852 0.899485 1.804762 0 2 9 c -0.697228 -1.265943 2.006027 0 2 10 11 12 10 h -0.698163 -1.267642 3.117025 0 9 11 h -0.159269 -2.172191 1.654408 0 9 12 h -1.750698 -1.295700 1.654408 0 9 13 o 1.717017 0.786666 2.942096 0 3 what want link first column second one, 1 mean n , 2 mean c , etc. replace values in last columns. is possible? thank you! $ awk 'fnr==...

ruby - access updated node attributes in cookbook recipe -

i new chef environment. , working on simple cookbook. to simplify, have following attributes in: attributes/default.rb: default[:user1] = "" default[:user2] = "" default[:filename] = "" recipes/default.rb: @ run time, filename cookbook , have extract users file. file = "#{node[:filename]}" ruby_block 'extract userdata' block json = file.read(file) obj = json.parse(json) userdata = obj['users'] if userdata.empty? raise "errors: userdata not available" else node.override[:user1] = userdata['user1'] node.override[:user2] = userdata['user2'] end end puts "user1: #{node[:user1]}" puts "user2: #{node[:user2]}" action :run end logs (puts) above block @ runtime fetch me usernames correctly. now, trying use above 2 updated attributes below in further down cookbook recipe. user1 = #{node[:user1]} user2 = #{node[:user2]} ...

javascript - Strange behavior concerning the sample Ionic ToDo app in the docs -

i'm new ionic framework , trying follow through ionic todo app demonstration . before starting want mention manually installed latest ionic release github page , included following in index.html : ionic.bundle.js , angular.min.js , angular-animate.min.js , angular-resource.min.js , angular-sanitize.min.js , angular-ui-router.min.js . in chapter 5, author details controller code create new task. tried adding functionality .createtask() method defined as $scope.createtask = function(task) { $scope.tasks.push({ title: task.title }); $scope.taskmodal.hide(); task.title = ""; }; by changing to $scope.createtask = function(task) { if (task.title == "") { window.alert("empty task!"); $scope.taskmodal.hide(); } else { $scope.tasks.push({title: task.title}) $scope.taskmodal.hide(); task.title = "" ; }; }; now, if run new code accompanying view outlined in tutorial, see controller calls empty task ale...

python - Pydoop error: RuntimeError: java home not found, try setting JAVA_HOME on remote server using CDH5.4 -

objective: read remote file stored in hdfs using pydoop, laptop. i'm using pycharm professional edition. i'm using cloudera cdh5.4 pycharm configuration on laptop: in project interpreter (under settings), have directed python compiler on remote server ssh://remote-server-ip-address:port-number/home/ashish/anaconda/bin/python2.7 now there file stored in hdfs location /home/ashish/pencil/somefilename.txt then install pydoop on remote server using pip install pydoop , installed. write code read file hdfs location import pydoop.hdfs hdfs hdfs.open('/home/ashish/pencil/somefilename.txt') file: line in file: print(line,'\n') on execution error traceback (most recent call last): file "/home/ashish/pycharm_proj/remote_server_connect/hdfsconxn.py", line 7, in <module> import pydoop.hdfs hdfs file /home/ashish/anaconda/lib/python2.7/sitepackages/pydoop/hdfs/__init__.py", line 82, in <module> . import common, path file ...

loops - php foreach multidimensional associative array -

i have multidimensional associative array follows sr_array=> array (size=18) 0 => string 'shop' (length=4) 1 => string 'papu kushwaha' (length=13) 2 => string 'jitendra shukla' (length=15) 3 => string 'satish' (length=6) 4 => string 'pradeep' (length=7) 5 => string 'papu khan' (length=9) 6 => string 'bharat' (length=6) 7 => string 'manoj pandey' (length=12) 8 => string 'select' (length=6) 'shop' => array (size=9) 'count_auto' => int 60 'count_indus' => int 4 'count_mc' => int 100 'count_inverter' => int 10 'count_in_bat' => int 40 'total_credit' => int 191850 'sale_value' => int 1351755 'total_disc' => float 22377.38 'perc_disc' => float 1.66 and on.... now want print them in table fo...

java - Implementing a MessageBodyReader for an enum -

i trying implement new messagebodyreader/writer combination, having trouble reader part. given following declaration public class jsr367enumprovider<t extends enum> implements messagebodyreader<t>, messagebodywriter<t> works there's warning saying enum raw. fix tried put in enum<?> however yield error in readfrom method @override public t readfrom(final class<t> type, final type generictype, final annotation[] annotations, final mediatype mediatype, final multivaluedmap<string, string> httpheaders, final inputstream inputstream) throws ioexception, webapplicationexception { // todo support other encodings using http header try (scanner s = new scanner(inputstream).usedelimiter("\\a")) { return (t) enum.valueof(type, s.next()); } } which warns of unchecked cast. there way aro...

lua - How do I make my add command find the value of the first variable and the second then add them together? -

vars = {} values = {} function open(file) lex(file) end function lex(file) local data = io.open(file, "r") char in data:lines() --print if char:sub(1, 6) == "print:" print(char:sub(7)) end --integer if char:sub(1, 2) == "v:" vars [#vars + 1] = char:sub(3, 5) if char:sub(6, 6) == "=" values [#values + 1] = char:sub(7) end --print("name:"..vars [#vars]..", ".."value:"..values [#values]) end --add if char:sub(1, 4) == "add:" if char:sub(5, 7) == vars[#vars] if char:sub(8, 8) == "," if char:sub(9, 11) == vars[#vars] print(values[#values] + values[#values]) --print(vars[#vars]) end end end end ...

ios - Unwind Segue from Modal/Popover resulting in Unbalanced calls to begin/end appearance transitions -

Image
i have following setup: nav controller -> vc1 -push--> vc2 -popover or modal segue--> vc3. vc3 unwinding vc1. when segue vc2 vc3 popover , modal, unwind ends in warning: unbalanced calls begin/end appearance transitions uiviewcontroller" if segue vc vc push, warning gone. idea how rid of warning or why showing? it's bug. ignore (or, if want citizen, file bug report apple).

python - shift by partition using groupby -

i have dataframe 1 column shift, on partition rather whole dataframe. for example, go dataframe: state, year, gdp ny,2011,100 ny,2012,110 ny,2013,120 ca,2011,70 ca,2012,80 ca,2013,90 to dataframe: state, year, gdp, gdp y-1 ny,2011,100,nan ny,2012,110,100 ny,2013,120,110 ca,2011,70,nan ca,2012,80,70 ca,2013,90,80 so far i've used code this: grouped = df.groupby("state") state, state_df in grouped: state_df["gdp y-1"]=state_df["gdp"].shift(1) i believe gives me want each state, don't know how combine (basically appending each dataframe below 1 another). how can that? you can store intermediate dataframes in list , use pd.concat join them together: grouped = df.groupby("state") l = [] state, state_df in grouped: state_df["gdp y-1"]=state_df["gdp"].shift(1) l.append(state_df) pd.concat(l) out[149]: state year gdp gdp y-1 3 ca 2011 70 nan 4 ca 2012 80 7...

numpy - Python + Pandas + Spark - How to import a dataframe into Pandas dataframe and convert it into a dictionary? -

how can import dataframe pandas dataframe , convert dictionary? i have dataframe created spark, sc = sparkcontext(appname="pythonsql") sqlcontext = sqlcontext(sc) path = os.path.join(os.environ['spark_home'], "examples/src/main/resources/people.json") # create dataframe df = sqlcontext.read.json(path) # register dataframe table. df.registertemptable("people") # sql statements can run using sql methods provided sqlcontext teenagers = sqlcontext.sql("select name people") sc.stop() when try import pandas, teenagers = pd.dataframe(teenagers, columns=['name']) i error, [client 127.0.0.1:50885] pandaserror: dataframe constructor not called! after all, want convert dataframe dictionary, dict = teenagers.set_index('name').to_dict() print dict any ideas? a spark dataframe can converted pandas dataframe topandas method.

All OpenGL ES 2 apps crash in Visual Studio Emulator for Android -

the hyper-v based emulator runs else fine, when run opengl es 2.0 based apps (which run fine on samsung galaxy s3 device) see 'unfortunately, appname has stopped' i see following debug output in android studio 08-17 04:03:04.038 1024-1037/? e/androidruntime﹕ fatal exception: glthread 75 process: mrmagoo.com.openglestest, pid: 1024 java.lang.illegalargumentexception: no config chosen @ android.opengl.glsurfaceview$baseconfigchooser.chooseconfig(glsurfaceview.java:874) @ android.opengl.glsurfaceview$eglhelper.start(glsurfaceview.java:1024) @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1401) @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240) the emulator supposed support opengl es 2.0 http://blogs.msdn.com/b/visualstudioalm/archive/2015/02/23/the-visual-studio-emulator-for-android-in-vs2015-ctp6.aspx any ideas? use seteglconfigchooser(8, 8, 8, 8, 16, 0); before calling setrend...

Turn int to char C -

i trying turn int 72, 101, 108 '72', '101', '108' . the original program read string "hello\n" example, ascii values of each character, put int char array. i tried: int = 72; char b = (char)a; but convert int ascii character. i tried: int = 72; char b = + '0'; but not work @ all. this have: char buff[128]; strcpy(buff, "hello\n"); char tmp[128]; bzero(tmp, 128); // initialize array int n = 0; while(buff[n] != '\n') { int ascii = (int)buff[n]; en[n] = (char)ascii; // right here n++; } strcat(tmp, "\n"); fprintf(stdout,"%s", tmp); since when did these '72', '101', '108' become chars? char values stored in 1 byte. you can use sprintf or snprintf . convert integers char arrays. int c = 4; char tin [some_length]; sprintf(tin , "%d", c); or snprintf(tin , some_length, "%d", c);

java - Migrating from service-mix file poller to apache camel file poller -

i new apache camel. want migrate service mix file poller camel file poller. trying it, have nothing test have code , give testing. can me , check whether going in right way? service-mix file poller code: <sm:activationspec componentname="abcfilepoller" destinationservice="b:destinationa" service="b:abcfilepoller"> <sm:component> <bean class="org.apache.servicemix.components.file.filepoller"> <property name="file" value="file://d:/input" /> <property name="period" value="20000"/> <property name="archive" value="file://d:/archive" /> <property name="filter" ref="abcfilefilter" /> <property name="marshaler"> <bean class="org.apache.servicemix.components.util.bi...

Unit testing "authorize" Spring Security JSP taglib -

is there way unit test use of authorize tag provided spring security? mockmvc integration not go far enough that, can seem check forwarded/redirected url not content of url. the work doing involves writing custom spel expressions , great check work on real sec:authorize usages! right confined testing basic call these expressions working outside scope of jsp pages (specifically using access attribute in intercept-url element) unfortunately, jsps don't work in unit testing since need compiled servlet container. recommend using works without container (i.e. thymeleaf ) since can render response in these instances. if use technology can render outside of container, can leverage htmlunit mockmvc integration found in spring framework 4.2+. if on older version of spring framework , cannot upgrade, can use spring test htmlunit . note spring test htmlunit maintained part of spring framework 4.2+ , not distinct project. if must use jsps, painful. however, there pr...