Posts

Featured post

c# - Property will not serialize as XML attribute -

i attempting serialize class xml , have properties serialized attributes of class, rather nested node. using webapi automatically handle serialization of xml. this class: [datacontract (namespace="", name="attributetest")] [serializable] public class attributetestclass { [xmlattribute("property")] [datamember] public int property1 { get; set; } } here output receiving (note property1 not attribute in spite of being decorated [xmlattribute] ): <attributetest xmlns:i="http://www.w3.org/2001/xmlschema-instance"> <property1>123</property1> </attributetest> this output want receive: <attributetest property1="123" xmlns:i="http://www.w3.org/2001/xmlschema-instance"> </attributetest> what missing? i'm not familiar webapi output receive looks it's serialized using datacontractserializer , not xmlserializer need. check if adding following application_...

How to draw a function curve in android? -

i have function, y = 50sin(x/50) + 100. want draw curve function, without additional info graph plotters, need wave on screen. x should correspond x parameter of screen , y y parameter of screen. here code of current view. public class sinusoid extends view { paint paint = new paint(); public sinusoid(context context) { super(context); paint.setcolor(color.red); } @override public void ondraw(canvas canvas) { //todo draw line using myfunction } private double myfunction(double x){ return 50 * math.sin(x / 50) + 100; } } now question is, should fill in todo? please help, documentation or example useful. thanks in advance. the idea have this: @override public void ondraw(canvas canvas) { (int x=0; x<canvas.getwidth();x++) { canvas.drawpoint(x,(float) myfunction(x),mpaint); } } but you'll need adjust value of function given canvas height.

java - hadoop writables NotSerializableException with Apache Spark API -

spark java application throws notserializableexception on hadoop writables. public final class myapp { public static void main(string[] args) throws exception { if (args.length < 1) { system.err.println("usage: myapp <file>"); system.exit(1); } sparkconf sparkconf = new sparkconf().setappname("myapp").setmaster("local"); javasparkcontext ctx = new javasparkcontext(sparkconf); configuration conf = new configuration(); javapairrdd<longwritable,text> lines = ctx.newapihadoopfile(args[0], textinputformat.class, longwritable.class, text.class, conf); system.out.println( lines.collect().tostring()); ctx.stop(); } . java.io.notserializableexception: org.apache.hadoop.io.longwritable serialization stack: - object not serializable (class: org.apache.hadoop.io.longwritable, value: 15227295) - field (class: scala.tuple2, name: _1, type: class java.lang.object) - object (class ...

asp.net - Not able to get nJupiter.DataAccess.Ldap work with our Internal LDAP (Lotus Domino) -

i've tried possible, setup njupiter.dataaccess.ldap membership provider on our intranet based web application built using asp.net 3.5. challenges facing: not able authenticate user using default login webpart (says login attempt not successful. please try again) i tried code , receive comexception : "there no such object on server." var ldapmembershipuser = system.web.security.membership.getuser("username") ldapmembershipuser; if (ldapmembershipuser != null) { var givenname = ldapmembershipuser.attributes["givenname"]; } i have placed web.config , njupiter.dataaccess.ldap.config here: web.config : http://pastebin.com/9xddnhuh njupiter.dataaccess.ldap.config : http://pastebin.com/wssehi98 i have tried possible permutations , combinations different values in xml , not able take forward. please guide. not able connec ldap , authenticate user or search users. just looking @ config unlikely enough since don't know dom...

html - Diagonally divs filling complete space of parent div -

i'm trying create div relative height , width, in 3 boxes, being diagonally aligned , fill complete space of relative parent div. it's kinda tough me explain, here's picture on how mean it: http://i.imgur.com/s2ustvu.png besides little space between red lines space should covered diagonal boxes. is possible somehow? i'm grateful every advice or tip can shoot me! following code got far. problem i'm stuck how make diagonal divs fill out complete space around them. <div class="parent"> <div class="box-1">box1</div> <div class="box-2">box2</div> <div class="box-3">box3</div> </div> css: .box-1 { -ms-transform: rotate(-10deg); -webkit-transform: rotate(-10deg); transform: rotate(-10deg); width: 100%; margin: 0px 0px 10px 0px; height: 33.33%; } .box-2 { -ms-transform: rotate(-10deg); -webkit-transform: rotate(-10deg); transform: rotate(-10deg);...

PHP: Using the ternary operator for something else than assignments – valid use case? -

unfortunately haven't found official resource on this. is allowed use ternary operator this, shorten , if/else statement: (isset($somevar) ? $this->setmyvar('something') : $this->setmyvar('something else')); in php documentation, ternary operator explained example: $action = (empty($_post['action'])) ? 'standard' : $_post['action']; this makes me believe use case might work, not valid because setter function not return anything. yes, can. php doc : [...] ternary operator expression, , [...] doesn't evaluate variable, result of expression. that quoted, although ternary used assigning values, can use suggested because function call expression appropriate function evaluated (and therefore executed). if setter function return value, not assigned , therefore lost. however, since said setter doesn't return anything, whole ternary operator evaluate nothing , return nothing. that's fine. if more...

apache - htaccess 404 Stopped Working -

i had custom 404 error redirect page working fine through htaccess. however, after adding new code htaccess, stopped working. what's causing conflict , how can fix it? edit: i've tried putting errordocument line @ top of page , still doesn't work. htaccess code: rewriteengine on #removes www rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule . http://%1%{request_uri} [r=301,l] #redirects extensionless php urls rewritecond %{the_request} ^[a-z]{3,9}\ /([^&\ ]+).php rewriterule .* /%1? [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ $1.php [l] #redirect nonexistent files 404 page (not working) errordocument 404 /404.html the problem not putting errordocument in top or in bottom of htaccess. you have infinite loop because of rule (the 1 rewriting php extension). need check if exists before rewriting it, otherwise you'll loop conflict between rule , errordocument . you can replace curr...