Posts

Showing posts from March, 2012

javascript - Meteor jQuery error -

today, running app , changing content in of js files, when app started crash. uncaught syntaxerror: unexpected end of input jquery.js:5896 uncaught typeerror: cannot read property '$' of undefined ui.js?9419ac08328918a04e7a49464a988d45f851e1b0:22 uncaught typeerror: cannot read property 'ui' of undefined templating.js?b36d51fd34724d5d501d8557cd9f846874d95aef:22 uncaught typeerror: cannot read property 'template' of undefined accounts-ui-unstyled.js?4567e3da09d5e81789340f9ce7ba9dfd4ca855bc:26 uncaught typeerror: cannot read property '$' of undefined iron-router.js?e9fac8016598ea034d4f30de5f0d356a9a24b6c5:26 uncaught typeerror: cannot read property 'ui' of undefined spacebars.js?8988006be5c29dbe17997e9691a21dce4e537665:24 uncaught typeerror: cannot read property 'routecontroller' of undefined global-imports.js?79bee564663b0a7d926070d647eb2976c3c4ac58:4 uncaught referenceerror: template not defined template.sales-course-landing.js?0a23

Coefficent Matrix in Python - Group elements -

i have obtatained matrix in python using sympy: > matrix([[-theta*l*m2*omega**2*cos(omega*t) + x*k*cos(omega*t) - > x*omega**2*(m1 + m2)*cos(omega*t)], [theta*g*cos(omega*t) - > theta*l*omega**2*cos(omega*t) - x*omega**2*cos(omega*t)]]) i need find expression like: [coefficient matrix]*(unknowns vectors) where (unknowns vector) is: matrix([[x],[theta]]). i tried use solve, simplify , collect sympy without success (i can errors or [] return). take jacobian : in [16]: a.jacobian(matrix([x, theta])) out[16]: ⎡ 2 2 ⎤ ⎢k⋅cos(ω⋅t) - ω ⋅(m₁ + m₂)⋅cos(ω⋅t) -l⋅m₂⋅ω ⋅cos(ω⋅t) ⎥ ⎢ ⎥ ⎢ 2 2 ⎥ ⎣ -ω ⋅cos(ω⋅t) g⋅cos(ω⋅t) - l⋅ω ⋅cos(ω⋅t)⎦ in [17]: a.jacobian(matrix([x, theta]))*matrix([x, theta]) out[17]: ⎡ 2 ⎛ 2

ios - How can I add swipe gestures to 3 different UILabels? -

Image
i'm new xcode - objective-c , in first app need add 3 different labels 2 swipe gestures (up , down swipe). to more clear (for cannot add images) have 3 labels this: [label1].[label2][label3] min value labels '0' max value label1 '2', label2 , label3 '9' each one. when swipe down labels need decrease value , when swipe need decrease value. how can this? in example made before did works 1 single uilabel. thanks lot in advance. regards. you need initialise 3 swipes, each label swipe itself. propose using tags differ labels. here code creates labels programmatically: uilabel *label1 = [[uilabel alloc] initwithframe:cgrectmake(50, 50, 100, 100)]; label1.text = @"label 1"; label1.tag = 10; label1.userinteractionenabled = yes; uiswipegesturerecognizer *swipe1 = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(didswipelabel:)]; [label1 addgesturerecognizer:swipe1]; uilabel *labe

Google maps need to show list of addresses -setimout slow and OVER_QUERY_LIMIT issue -

hi have bout 500 addresses or listed in google maps , each address being grabbed filemaker database grouped under category person(employee name in map) i'm using function geocode , i'm calling every 10th time 10 sec setimout, problem is: 1- page very slow settimeout 10sec when have show 500 addresses( addresses can change second never fixed addresses) there better way? 2- settimout set call every 10 seconds, still sporadically over_query_limit , why happen, 10 seconds along time. here code: <pre><script type="text/javascript"> var mapoptions = { //center:mylatlng, //zoom:15, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("map-canvas"), mapoptions); //var contentstring='<div id="google_info_window">i;m here</div>'; //var infowindow = new google.maps.infowindow(); var infowindow = new google.maps.infowindow( { size: new google.maps.si

xml - Supply a different namespace for a DataMember in a WCF DataContract -

this example of vb class 1 of data data contracts: <system.codedom.compiler.generatedcodeattribute("xsd", "2.0.50727.3038"), _ system.serializableattribute(), _ system.diagnostics.debuggerstepthroughattribute(), _ system.componentmodel.designercategoryattribute("code"), _ system.xml.serialization.xmltypeattribute([namespace]:="http://www.example.com/ns1"), _ system.runtime.serialization.datacontractattribute([namespace]:="http://www.example.com/ns1")> _ partial public class sometype ... private somememberfield string ... <datamember(order:=4)> _ public property somemember() string return me.somememberfield end set(value string) me.somememberfield = value end set end property end class wsdl becomes (namespace http://www.example.com/ns1 expected): <xs:complextype name="sometype"> <xs:sequence> ... &

c++ - Store weak pointer to self -

i work codebase partially implemented in love overly complex solutions simple problems (e.g. template classes 2 parameters ever instantiated 1 pair of types). 1 thing did create objects in smart pointer, , have object store weak pointer itself. class myclass { //... boost::weak_ptr<myclass> m_self; //... }; boost::shared_ptr<myclass> factory::factory::factory::createmyclass() { boost::shared_ptr<myclass> obj(new myclass(...)); boost::weak_ptr<myclass> p(obj); obj->storeselfpointer(p); return obj; } the class proceeds use m_self locking , passing around resulting shared pointer. for life of me, cannot fathom trying accomplish. there pattern or idea explain implementation? looks me pointless , i'd refactor away. edit : should mention none of places use resulting smart pointer obtained locking m_self retain smart pointer. a possible use of "design" use m_self.lock() generate shared pointers this

sbt how to pass command line parameters when more than one executable -

my project has few executables. how may run 1 of them with supplied command line arguments ? after attempting include args sbt run ignored , instead menu of available main's listed: c:\apps\simpleakka>sbt run "com.mycompany.sparkpoc.hbase.hbasepop spark://localhost:7088 localhost:2181 1000 100" [info] loading project definition c:\apps\simpleakka\project [info] set current project simpleakka (in build file:/c:/apps/simpleakka/) multiple main classes detected, select 1 run: [1] com.mycompany.sparkpoc.lcs [2] com.mycompany.sparkpoc.rdd.hbasemr [3] org.apache.spark.examples.hwhbasetest [4] com.mycompany.sparkpoc.rdd.hbasemrold [5] com.mycompany.sparkpoc.hbasetest [6] com.mycompany.sparkpoc.socketserver [7] com.mycompany.sparkpoc.hbase.hbasepop but selecting 1 of 7 options, command line args lost: enter number: invalid number: java.lang.numberformatexception: input string: "" java.lang.runtimeexception: no main class detected. @ sc

glsl - Light per vertex shader -

i´m trying compile glsl shader looks has wrong, because fails. message error _log gaves me: vertex shader(s) not compiled before gllinkprogram()was called.link failed. its light per vertex shader: vec4 ambient() { vec4 ambient = vec4 (0.0); ambient = gl_frontmaterial.ambient * gl_lightsource[0].ambient; ambient += (gl_lightmodel.ambient * gl_frontmaterial.ambient); return ambient; } vec4 diffuse(vec3 normal) { vec3 diffuse = gl_lightsource[0].position * normal; float diff = max(dot(normal,diffuse),0.0); diffuse = gl_lightsource[0].diffuse * gl_frontmaterial.diffuse * diff; return diffuse; } vec4 specular(vec3 normal) { float hv = max(dot(normal, vec3(gl_lightsource[0].halfvector)), 0.0); float spec = pow(hv, gl_frontmaterial.shininess); return gl_lightsource[0].specular * gl_frontmaterial.specular * spec; } void main() { vec3 normal

python - BeautifulSoup: How to get the nearest tag -

i have xml file following data <year>2013</year> <yousavespend>2500</yousavespend> <yourmpgvehicle> <avgmpg>32.261695541</avgmpg> <citypercent>43</citypercent> <highwaypercent>57</highwaypercent> </yourmpgvehicle> <year>2013</year> <yousavespend>3000</yousavespend> <yourmpgvehicle> <avgmpg>33.383275416</avgmpg> <citypercent>49</citypercent> <highwaypercent>51</highwaypercent> </yourmpgvehicle> <year>2012</year> <yousavespend>2500</yousavespend> <yourmpgvehicle> <avgmpg>36.210640188</avgmpg> <citypercent>32</citypercent> <highwaypercent>68</highwaypercent> </yourmpgvehicle> i want use beautifulsoup return list of avgmpg year 2013? how can that? my current effort has been: for item in soupedcaravgmpgpage.findall('year'): listofyears.append(''

python - Importing a module in resources/ into an XBMC plugin -

i'm working on xbmc plugin requires few python modules not available via requires tag in addon.xml (they not in xbmc repository far i'm aware). documentation plugin development seems indicate can adding module(s) resources/lib/ subdirectory of plugin directory. i've done , when testing in xbmc import error trying import module because cannot found. i've read other question found on regarding topic entitled importing python module xbmc use within addon proposed solution there, of adding module directory path before importing, doesn't work me either. same import error. in fact don't think answer correct because os.getcwd() in xbmc not return plugin directory path when called within plugin; concatenating path gives /resources/lib answer suggests won't yield valid path. modified example use getaddoninfo find plugin path addon object via xbmcaddon module , added path concatenated /resources/lib still did not work. putting modules root of plugin direc

php - How to add hidden text on wordpress ( Hidden div ) using javascript -

alright i've been searching way when clicks text , scroll down menu drops down more information ( sort of read more ). i little experience in java or jquery , im not sure problem wether it's in functions.php or script . i've done alot of research , tried alot of things none seem able me out figured id make own post . keep in , took of codes in templates given other member , tried modify code works site, i trying accomplish similar site : http://www.randomsnippets.com/2011/04/10/how-to-hide-show-or-toggle-your-div-with-jquery/ second example there 3 boxes , 1 shows when click on it, mine text instead of boxes) my javascript file looks this(as stated in comment idk thechosenone , guess when select box known chosen 1 ) : jquery(document).ready(function (){ $('.newboxes').each(function(index) { if ($(this).attr("id") == thechosenone) { $(this).show(200); } else { $(this).hide(600);

Magento - How to add country column in Orders grid filter? -

i tried: $collection = mage::getresourcemodel($this->_getcollectionclass()); $collection->oinattribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left'); $this->setcollection($collection); return mage_adminhtml_block_widget_grid::_preparecollection(); but results blank. please me add country column in orders grid. thanks. copy app/code/core/mage/adminhtml/block/sales/order/grid app/code/local/mage/adminhtml/block/sales/order/grid in file add below code append billing address order grid preparecollection function $collection->getselect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id',array('telephone','city','postcode','country_id' ) )->where("sales_flat_order_address.address_type = 'billing'"); full code protected function _preparecol

Azure - relation between resource group and affinity group -

i have read affinity group, , allocates services close in datacenter, same rack. on other hand, new resource groups give me easy access managing services related. i want deploy app website + sql + storage, im going create resource group them, , better performance, want choose affinity group (previously created), cant. using portal management can choose affinity group not affinity group. , using beta portal management can choose resource group not affinity group (affinity group no appears on location list). i tried using powershell mode managing resource groups, cmdlet create website dont have parameter affinity group (only have location). i wondering if in 1 deployment can choose affinity group , resource group. there no docs this. or maybe resource group replacement affinity groups, dont know. edit: still cant it pd: hahah sorry gramatical errors, speak spanish here in peru. here how can create resource group belongs affinity group: from old portal, create a

c# - Console.WriteLine overload not writing all arguments -

and need figure out context issue c# created class overloaded method , want writeline methods. not sure if make sense why here. i want writeline print out new test. // class method overload public test(string make, string model, int year, string colour) { make = make; model = model; year = year; colour = colour; } // called test mytest = new test("chev", "ava", 2002, "blue"); console.writeline(mytest); you have override tostring() in class return correctly formatted string. default implementation of tostring() return name of class. http://msdn.microsoft.com/en-us/library/ms173154(v=vs.80).aspx put in class public override string tostring() { return string.format("{0} {1} {2} {3}",make,model,year,colour); }

Grails: Transients property in Constraints.groovy -

i want replace domain class in grails hibernate class(rate). constrains hibernate class can added creating file rateconstraints.groovy in src/java, , works fine validations of hibernate class. need add transients property hibernate class using rateconstraints.groovy . eg: consider java class class rate { long id string code } rateconstraints.groovy file in ../src/java constraints = { id ( nullable:true ) code( nullable: false ) } how can add transients property in rateconstraints.groovy file transients = ['startdate', 'enddate'] got answer rateconstraints.groovy file in ../src/java transients = ['startdate', 'enddate'] rate.metaclass.getstartdate << {-> startdate } rate.metaclass.setstartdate << {it -> startdate = } rate.metaclass.getenddate << {-> enddate } rate.metaclass.setenddate << {it -> enddate = } constraints = { id

javascript - Parse.com how to get return value of query -

in parse.com value of query in function. how out side of function? var tableobject = parse.object.extend(tableid); var qynewparse = new parse.query(tableobject); qynewparse.doesnotexist("last_sync"); qynewparse.find({ success: function(results) { }, error: function(error){ } }); var = results.length for example if want result.length @ outside of function. how var something value? you can't have function return result of query, because function return before query completed. instead of having function return value, should give function own callback parameter called when query completes, like: function some_cback(callback) { var tableobject = parse.object.extend(tableid); var qynewparse = new parse.query(tableobject); qynewparse.doesnotexist("last_sync"); qynewparse.find({ success: function(results) { callback(results); //call callback }, error: function(error

winapi - Network bytes for process subtree in Windows -

how calculate common number of network bytes process ( pid known) , child processes? set of winapi functions, allows me obtain whole needed information? say, want know, how many bytes downloaded git submodule update --recursive .

Python - string format - integral part of decimals -

i need convert numeric time value lrc time format. here wrote def lrc_time(t): seconds = int(t) millis = t - seconds return '[%02d:%02.2f]' % (seconds / 60, seconds % 60 + millis) the code runs as >>> print lrc_time(20.5) [00:20.50] >>> print lrc_time(65.0) # suppose "[01:05.00]", [01:5.00] the problem is, unlike %02d , %02.2f won't padding 0 before integral part when number less 10. in fact seems same %.2f . so what's correct way that? i got work with: "%05.02f" % (4.5623,) so that's saying prefix zero, number string have width of 5 characters (in case 2 whole number digits, period, , 2 decimal digits), , 2 decimal point precision.

angularjs - Get orderBy value in ng-repeat directive from element attribute? -

so have directive: app.directive('replaceelement', function() { return { restrict: 'e', replace: true, scope:true, link: function(scope, element, attrs) { scope.blockcss = attrs.blockcss; scope.sorter = attrs.sorter; }, template:'<div class="{{blockcss}}" ng-repeat="content in | limitto:10 | orderbypriority | orderby:sorter" ng-include src="blockcss+\'.html\'"></div>' } }); nothing special. this element should run on. <replaceelement blockcss="cssname" sorter="sortby"></replaceelement> i run simple ng-click change variable called sorter in controller. orderby not work sorter attribute. have feeling because sorter variable in controller, , cant call name passed attribute? been working on day , cant find way it. can please? thanks the orderby in ng-repeat works exclusively a

c# - while binding DataGrid WPF

i trying bind observablecollection datagrid . code private void loaddata_loaded(object sender, routedeventargs e) { observablecollection<loaddata> loaddataset = new observablecollection<loaddata>(); var items = new list<loaddata>(); loaddata load = new loaddata("1", "1", "1", "1"); loaddataset.add(load); items.add(load); loaddatagrid.itemssource = items; } in mainwindow public mainwindow() { initializecomponent(); datacontext = this; } in xaml datagrid name="loaddatagrid" horizontalalignment="left" margin="373,83,0,0" verticalalignment="top" height="64" width="661" loaded="loaddata_loaded" / then exception an unhandled exception of type "system.stackoverflowexception" occurred in xxxx.exe why not working ? while can't imagine have done wrong, ca

c# - the caller was not authenticated by the service -- when using host name in site and call locally -

on 1 production server have wcf service in format of: http://[host name]/[oneservice.svc] . when client app calls same server, throws error of: "the caller not authenticated service...... request security token not satisfied because authentication failed". there lot of similar topics on internet. seems not same situation. 1 is: 1, if client app runs on server within same domain, or runs on server within different domain (but these 2 domains trusted each other), works; 2, if client app runs on same server hosts wcf service, throws error above. 3, however, if change service url http://localhost/[oneservice.svc] , (2) works! from observed in 1/2/3, guessing may not code or config issue? (service can configured use either http or https.) any suggestion appreciated! this not perfect solution work me. i have done regedit ( please @ risk). you have create entry domain in backconnectionhostnames key. http://blog.blksthl.com/2013/05/07/a-quick-

ios - Copy views between View Controllers without "connections" in Interface Builder -

is there way copy view controller's element (views, labels, buttons , whatnots) viewcontroller without copying bindings set on item ( ibaction , iboutlets )? this obvious when try copy views between projects, have in both projects connections , if modify in 1 reflected in other!

mysql - SQL Where Clause with multiple values -

i have query select name,number table number='123' what want display multiple records using clause or other way can following data. name number abc 123 pqr 127 pqr 130 i tried using and && , in clause.i.e. where number=123,127,130 or where number=123 , 127 , 130 etc. nothing works. just use in clause where number in (123, 127, 130) you use or (just info, wouldn't use in case) where number = 123 or number = 127 or number = 130 don't forget round braces around "ors" if have other conditions in clause.

android - Fix decimal numbers -

now i;m receiving gps location data android application, , send labview. however, decimal number of gps location value changes due location. i want fix decimal number such 7 for example, 32.33333 need 32.333330 how can declare value? here gps value part private class mylocationlistener implements locationlistener { private string gps2; @override public void onlocationchanged(location loc) { if (loc != null) { /* 화면의 상단에 위치한 textview에 위도, 경도를 출력함*/ gps.settext("la:"+loc.getlatitude()+", lo:"+loc.getlongitude()); gps2 = gps.gettext().tostring(); main.getinstance().sendmessage(gps2); } } @override public void onproviderdisabled(string provider) { // todo auto-generated method stub } @override public void onproviderenabled(string provider) { // todo auto-generated method stub } @override public void onstatu

Paypal Not too sure about IPN, when to use? -

is there need use ipn with 1. expresscheckout (setexpresscheckout => doexpresscheckout) 2. recurring payment (subscription) it depends on how operate business... if ship physical goods, then, of course human check if received payment before send goods customer... but digital goods it's story, want deliver digital content payment in account. that's main usage ipn. if ipn confirmation, fire email download link directly customer's email. other use cases be, automate tasks, accounting, mailing, renewing subscription status, reverting need revert in case payment cancelled notification, etc.

Linux based 10G ethernet driver can't send nor receive anything to/from wire -

i developing 10g ethernet driver (chip intel 82599), referring ixgbe , trimming it, problem can't send nor receive to/from wire. , below have done far: 1, low level initialization seems ok, link status up, , auto-negotiation done , ends 10gb. 2, dma mapping rx/tx ring done via pci_alloc_consistent() successfully, , before pci_set_dma_mask (64bit) called insure whole address range reachable. 3, when ping, tx descriptor consuming, , 1 transmit interrupt received per packet sent (by dma chip) 4, loop lpbk set diagnostics, no receive interrupt invoked @ all. could possible dma has problem accessing host memory (although map done)? , how verify physical address reachable dma chip on nic ? somehow stuck here, , needs advice on low level trouble shooting ... thanks in advance

java - Creating Jar and loading classes in it -

i need create jar , load classes inside jar using classloader. use following code create folder structure inside jar.this works fine when try load class jar throws exception classnotfound. public void createjar() throws ioexception { //fileoutputstream stream = new fileoutputstream("d:\\myfolder\\apache-tomcat-6.0.32\\webapps\\springtest\\web-inf\\lib\\servicejar.jar"); fileoutputstream stream = new fileoutputstream("d:/myfolder/apache-tomcat-6.0.32/webapps/springtest/web-inf/lib/servicejar.jar"); jaroutputstream target = new jaroutputstream(stream, new manifest()); add(new file("d:/myjar"), target); target.close(); stream.close(); } private void add(file source, jaroutputstream target) throws ioexception { byte buffer[] = new byte[10204]; try { if (source.isdirectory()) { string name = source.getpath().replace("\\", "/"); if (!name.isempty()) { if (!name.endswith(&

How to upload file in cakephp -

i want upload image using cakephp , able save file name in database file file not uploading in specified path ihave tried below code problem has not solved this controller function editprofile ($id = null){ if(empty($this->data)){ $this->data=$this->signup->read(null, $id); } else{ $image = $this->data['signup']['upload image']; //allowed image types $imagetypes = array("image/gif", "image/jpeg", "image/png"); //upload folder - make sure create 1 in webroot $uploadfolder = "upload"; //full path upload folder $uploadpath = www_root . $uploadfolder; $imagename = $image['name']; if($image['size'] > 2097152){ $errors[]='file size must less 2 mb'; } //check if image type

jquery - How to clone/ create duplicate, set of fields in Apache wicket -

i have requirement there field set adding , displaying existing comments. design is, on top half, existing comments db displayed row wise, beneath separator line followed row active input fields( date picket field, text area comment , add button). clicking add button should add latest comment entry made in comment list above , clear input fields. have managed doing using jquery's clone method. however, not satisfied approach have not leveraged wickets power such here. new framework , honest still not comfortable rudimentary basics required take full benefit of framework. appreciate if can ideas ( better if can give me live example links, knowledge source etc) achieve task mentioned using wicket. html : <div class=row> <!-- comments grid widget - begin --> <div class=formfield> <fieldset style="padding-bottom: 5px; padding-top: 5px; padding-left: 4px; width: 985px"> <legend>comments</legend>

c++ - change text of CMFCRibbonStatusBar but first character and three dot shown (like "C...") -

in project (vc++,mfc,2010) , want change status bar text. the variable is: cmfcribbonstatusbar m_wndstatusbar; the code is: { cstring strtitlepane1=_t(""); m_wndstatusbar.addelement(new cmfcribbonstatusbarpane(id_statusbar_pane1, strtitlepane1,true), strtitlepane1); m_wndstatusbar.getelement(0)->settext(_t("connecting")); } but see in status bar : c... what problem? after you've created cmfcribbonstatusbarpane , need set expected maximum text size calling cmfcribbonstatusbarpane::setalmostlargetext . for example: cstring strtitlepane1=_t(""); cmfcribbonstatusbarpane* ppane = new cmfcribbonstatusbarpane(id_statusbar_pane1, strtitlepane1,true); ppane.setalmostlargetext(_t("connecting")); m_wndstatusbar.addelement(ppane, strtitlepane1); m_wndstatusbar.getelement(0)->settext(_t("connecting"));

Visual Studio 2013 C++ Adding Files To Project -

alright i'm losing mind on extremely simple problem. what have code directory want add project. of files contained in directory , make namespace. when want include them in cpp file, type this: #include <directory1/source.h> and i'm sure of since works in project. here i've done: so i've created empty project. copied source files project source directory. then went on visual studio, clicked "show files" button in solution explorer. right clicked files want add , clicked "include in project" button. files added project gives me error this error c1083: cannot open include file: 'directory/source.h': no such file or directory i've tried add directories project property pages->vc++ directories->include directories. didn't work. how can add source files contained in folders in visual studio c++? edit: still doesn't work. want add c++ files directory structure.

validation - Loading non valid xml in Calabash / xproc -

i trying create routine validating xhtml documents. use xproc run in calabash. in xhtml document. document may not valid. for testing edit xhtml document. delete , introduce error. error hope detect when validate document. in order validate use , supply schema, , output result of validation in new file. but if input file not valid in first place xproc/calabash stops. error message error message saxon pointing out missing. wanted validation output in output file. how do that? <p:input port="source" primary="true"/> <p:load name="xml-doc" href="'input.xhtml'"/> <p:validate-with-xml-schema name="validate"> <p:input port="source"> <p:pipe port="result" step="xml-doc"/> </p:input> <p:with-option name="assert-valid" select="'false'"/> <p:with-option name="mode" select="

r - Change y-axis side when plotting factors -

i have following plot k.factor<-factor(sample(1:5, 100, replace = t)) s.factor<-factor(sample(c("a", "b", "c"), 100, replace = t)) plot(k.factor, s.factor) i remove left y-axis (a, b, c) , plot information legend. how can suppress yaxis? probability axis displayed left y axis (instead of right y axis now)? how can flip this? please base r answers only if don't mind using ggplot2 this: library(ggplot2) ggplot(data.frame(k.factor, s.factor), aes(x = k.factor, fill = s.factor)) + geom_bar(position="fill")

System.Diagnostics.Process in c# and CreateProcess() in c++ which one is the best choice? -

when want start subprocess in application(c#) , system.diagnostics.process in c# , createprocess() in c++ 1 better choice? give parameters subprocess hide subprocess's window gead subprocess's output such logs etc. in addition want set cpu numbers , limit memory subprocess user. i want kill subprocesses safely(not leak memory , some) wheb user stop parent process system.diagnostics.process good. call managed code method managed code.

c - Inserting a new element at head of a Linked List and printing the elements value -

i'm trying create list in c language inserting new element @ head , after want print value of elements. this code wrote : #include <stdio.h> #include <stdlib.h> #include <malloc.h> struct clients { int stato; //stato del giocatore : 0 libero 1 occupato struct clients *next; //puntatore all'elemento successivo della lista }; typedef struct clients player; /* per comodita' */ // funzione che inserisce elem in testa alla lista void inserisci(player *elemento, player *lista) { elemento->next=lista; lista=elemento; } // funzione che visualizza la lista void visualizza(player *lista) { player *p = lista; //creo puntatore alla lista passatagli while ( p != 0) { printf("valore %d \n",p->stato); p=p->next; } } // main principale int main(void) { player *first = null; /* puntatore al primo elemento della lista */ player *pippo = null; int i; printf("inizio inserimento \n"); (i=1;i<=1

TestNG: @Test at class level executing all methods -

i have tests need run sequentially, added @test(singlethreaded = true) classes. works fine, problem @test @ class level, methods executed testng, if don't have @test annotation, causes time waste when team wants disable test, , he's not aware of particularity comments @test instead of whole method, later test should disabled end making build process fail. is there way avoid this? thanks one way educate team :) you can put new annotation on single test want disable i.e. in below, test 2 won't run. @test(singlet..) public class testss { public void test1(){ system.out.println("test1"); } @test(enabled=false) public void test2(){ system.out.println("test2"); } public void test3(){ system.out.println("test3"); } }

ruby - Array.reject!(&:empty?) removes non-blank object -

i can't figure out why, when using reject!(&:empty?) , non-empty objects removed. example: ["example"].reject!(&:empty?) returns nil . however, ["example", ""].reject!(&:empty?) returns ["example"] , should. why? from documentation : equivalent #delete_if , deleting elements self block evaluates true, but returns nil if no changes made . if want use result of array (and less interested in changing array - use reject instead: ["example"].reject(&:empty?) # => ["example"] ["example", ""].reject(&:empty?) # => ["example"]

javascript - How can I destroy a fragment (or a view)? -

i have created fragment: var dialogfrafment = sap.ui.xmlfragment( "appintra.fragment.dialog", this.getview().getcontroller() // associate controller fragment ); this.getview().adddependent(dialogfrafment); sap.ui.getcore().byid("idmailreport").setvalue(sap.ui.getcore().getmodel("mailuser")); dialogfrafment. dialogfrafment.open(); how can delete after complete? store dialogfrafment in controller. if(!this.dialogfrafment) { this.dialogfrafment = sap.ui.xmlfragment( "appintra.fragment.dialog", this.getview().getcontroller() // associate controller fragment ); this.getview().adddependent(dialogfrafment); sap.ui.getcore().byid("idmailreport").setvalue(sap.ui.getcore().getmodel("mailuser")); } this.dialogfrafment.open(); destroy fragment in onexit function of controller. onexit: function() { if (this.dialogfrafment) { this.dialo

java - Correct way to construct this xml using Xstream -

i'm trying achieve following using xstream: <?xml version="1.0" encoding="utf-8"?> <rows> <row id="eventid"> <cell>false</cell> <cell>mainland</cell> <cell></cell> <cell></cell> <row id = "storeid"> <cell></cell> <cell></cell> <cell></cell> <cell></cell> </row> </row> </rows> here can see row id of "storeid" child row of "eventid" row. can create both seperately doing following: string xml = "", eventxml = "", storexml = ""; stringbuffer buff = new stringbuffer(1000); buff.append("<?xml version='1.0' encoding='iso-8859-1'?>"); xstream xstream = new xstream(new domdriver()); xstream.alias(

c# - How to select a ListBoxItem which is already selected OR to highlight previous selected ListBoxItem after setting SelectedIndex to -1? -

i'm programming simple listbox in windows phone 7. listbox has items , when click of items app navigates new page. from beginning here, good. but want end-user can select item again causes navigate next page again. listbox is, doesn't allow me select selected item again. i tried allowing select item again. private void listbox_selectionchanged(object sender, selectionchangedeventargs e) { if(listbox.selectedindex != -1 ) { navigationservice.navigate(uri); listbox.selectedindex = -1; } } i have alreadhy edited listboxitemtemplate highlight selected item, when use above code, cannot highlight selected item, because changes selectedindex fast. so how can allow user select selected item or how can highlight previous selected item. suggestions or tips? edit: when using normal listbox , can use : listboxitem1.background = new solidcolorbrush(color.blue);` but when edit template of listbox item throw exception, cannot still this.

bioinformatics - Querying NCBI for a sequence from ncbi via Biopython -

how can query ncbi sequences given chromosome's genbank identifier, , start , stop positions using biopython? cp001665 napp tile 6373 6422 . + . cluster=9; cp001665 napp tile 6398 6447 . + . cluster=3; cp001665 napp tile 6423 6472 . + . cluster=3; cp001665 napp tile 6448 6497 . + . cluster=3; cp001665 napp tile 7036 7085 . + . cluster=10; cp001665 napp tile 7061 7110 . + . cluster=3; cp001665 napp tile 7073 7122 . + . cluster=3; from bio import entrez bio import seqio entrez.email = "sample@example.org" handle = entrez.efetch(db="nuccore", id="cp001665", rettype="gb", retmode="text") whole_sequence = seqio.read(handle, "genbank") print whole_sequence[6373:6422] once know id , database

java - How to implement custom job listener/tracker in Spark? -

i have class below, , when run through command line want see progress status. thing like, 10% completed... 30% completed... 100% completed...job done! i using spark 1.0 on yarn , using java api. public class myjavawordcount { public static void main(string[] args) throws exception { if (args.length < 2) { system.err.println("usage: myjavawordcount <master> <file>"); system.exit(1); } system.out.println("args[0]: <master>="+args[0]); system.out.println("args[1]: <file>="+args[1]); javasparkcontext ctx = new javasparkcontext( args[0], "myjavawordcount", system.getenv("spark_home"), system.getenv("spark_examples_jar")); javardd<string> lines = ctx.textfile(args[1], 1); // output input output

jsp - spring mvc: How Can I give the <form:textarea /> tag a default value? -

i learning form processing spring mvc framework. have problem giving <form:textarea /> tag default value. when created .jsp file follow, <form:textarea path="content" id="my-text-box" />${content} jsp parser translate above line to: (let me assume ${content} contains "hello world".) <textarea id="my-text-box" name="content"></textarea>third hello world! also, giving value attribute not work. <form:textarea value="${content}" path="content" id="my-text-box" /> jsp gives me html output: <textarea id="my-text-box" name="content" value="third hello world!"></textarea> you know <textarea> tag not have value attribute. how can pass default value <form:textarea> tag? thank in advance. the spring form tags data binding (e.g. model attributes bind form via path attribute of form). if need specif

android - Converting custom_rules.xml to a gradle version -

i'm working on existing project relies heavily on lot of configuration custom_rules.xml ant build. i've looked around online have yet come across explicitly dealing such task in great detail. i've played around gradle , tried doing suggested approaches nothing has worked yet. if point me in right direction appreciate it. edit: need rebuild using gradle. love rid off doing via command line not mention handling dependencies , etc. <?xml version="1.0" encoding="utf-8"?> set pre compile <!-- ========================================================================================= --> <!-- once update android sdk, please copy target build.xml under android sdk --> <!-- ========================================================================================= --> <!-- updates pre-processed png cache --> <target name="-crunch"

android - Display only Social Leader board using Google Play Game Services -

i working on android game want display leader board user's social circle on google plus. have integrated google play game services api in app , displaying leader board. however, google services displays 2 kinds of leader boards -- social , public , want display social leader board , not public. is there way can that? or there way can fetch data social leaderboard alone , display separately? so have figured out myself, luckily. following code print names of friends present @ social leader board. games.leaderboards.loadplayercenteredscores(googleapiclient, "*****************", 2, 1, 20).setresultcallback( new resultcallback<loadscoresresult>(){ public void onresult(loadscoresresult result) { // todo auto-generated method stub for(int j=0;j<result.getscores().getcount();j++) { log.i("score on create",result.getscores().get(j).getscoreholderdisplayname()); }

ios - iTunes link in Facebook post does not pull in App description -

i'm trying post link itunes page app on facebook. it's showing app icon , app title correctly, below app title there should description , it's blank. surely itunes should automatically populating , therefore facebook should displaying it?

How can I get rid of the format specifier in Rails 4.1 routes? -

suppose have controller called userscontroller , , have resources :users in routes.rb file. rake routes shows such routes users/:id(.:format) , want routes of form users/:id instead (i.e. asking users/7.html return error.) how can that? it's quite simple: resources :users, :format => false

Clojure: creating a map with switched keys and values from another map -

i trying create kind of reverted index input map . input map got is: {"id-1" {"values" ["a" "b" "c"]}, "id-2" {"values" ["a" "b" "c"]}} then want have other map result: {"a" ["id-1" "id-2"], "b" ["id-1" "id-2"], "c" ["id-1" "id-2"]} however, think mind did go crazy, , think painted myself corner without being able of thinking out of box. here got far, , looks stinks: (->> {"id-1" {"values" ["a" "b" "c"]} "id-2" {"values" ["a" "b" "c"]}} (map #(->> (get (second %) "values") (map (fn [x y] (hash-map y x)) (into [] (repeat (count (get (second %) "values")) (first %)))) (apply merge-with concat))) (apply merge-with con