Posts

Showing posts from February, 2010

android - Update listview inside ListFragment from Cursor Adapter -

in android have custom adapter, in custom adapter create view text , button delete text. of works fine , can delete record database have been unable refresh list. the list looks little this: ------------------------------------ text text text text | delete button| ------------------------------------ text text text text | delete button| ------------------------------------ my first instinct use this: qclistfragment frag = (qclistfragment) getsupportfragmentmanager().findfragmentbyid(r.id.listfragment); at point call method inside list fragment re-query list... cant because adapter not extend fragment. i'm finding hard let fragment know data has been changed. anyhow, last thought rebuild activity thought that not best thing , there had better way... i'm sure simple i'm missing last question was! (i can post more code if helpful) update: here entire adapter class public class calccursoradapter extends simplecursoradapter implements filterable{ private co...

How to implement pagination in Android listview -

i working android app, in need show listview items. there more elements show in listview. i decided implement pagination . tried searching in google not find related information. can me please.. implementing pagination simple. take @ this... public class mainactivity extends activity { private listview listview; private textview title; private arraylist<string> data; arrayadapter<string> sd; public int total_list_items = 1030; public int num_items_page = 100; private int noofbtns; private button[] btns; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); listview = (listview)findviewbyid(r.id.list); title = (textview)findviewbyid(r.id.title); btnfooter(); data = new arraylist<string>(); /* * arraylist data contains list items */ for(int i=0;i...

ruby on rails 3 - Using New-Relic Data to create a status page -

i want use new relic data such throughput, uptime, load time etc, own status page, publicly available. want save these values redis or similar , plot them in page is there way extract values new relic @ given time through api? i can't find api documentation on how extract kind of data app? the place start https://newrelic.com/docs/instrumentation/getting-started-with-the-new-relic-rest-api , there more details @ http://newrelic.github.io/newrelic_api/ accessing data new relic's api pretty easy, there few common stumbling blocks: time windows must expressed in xml time , gmt (timezone=z) you must specify field when querying metric threshold_values might return different numbers see in ui because ui shows numbers 5 minute window , api shows 3 minute window keep in mind metrics available according new relic's retention policy subscription level https://newrelic.com/docs/subscriptions/data-retention if results other new relic users might find usef...

heroku - rails 4 specify gems for development, testing and production -

i deployed app on heroku testing , amazon production. on testing , development(local), used postgresql , on amazon ec2 used mysql. want pg gem loaded on testing , development , mysql2 gem loaded on production. what best practice work around problem? thanks the best practice use same dbms development, testing, , production. doubt that's wanted hear... in event, bundler doesn't support scenario. is, can't tell not install gems in given environment - if won't used. can tell not load gems declaring them in group block (as @mind.blank proposed), still installed. can, however, use simple ruby constructs, namely if-else or case blocks, run code (and load/install gems) given specific condition. the problem gemfile.lock file out of sync across deployments - not bundler (or capistrano) expects. there flags can use tell deployment ignore gemfile.lock file , bundle install based on it's reading of gemfile if want to...

php - How to get results of findBySQL -

sorry english. here code: public function showlastthreenews(){ return news::model()->findbysql('select * news limit 3;'); } next, example, want results of query: public function actionindex() { $lastnews = $this->showlastthreenews(); foreach ($lastnews $news){ chromephp::log($lastnews->news_title); } $this->render('index', array( 'lastnews'=>$lastnews )); } problem logger show me 1 record 3 times without changing next record. what mistake? you using wrong variable in loop change to, foreach ($lastnews $news){ chromephp::log($news->news_title); }

ssl - Makecert still what to use to self sign? -

i don't have makecert anywhere on system despite having 3 vstudio editions , several sdk's. can please tell me can find copy or how else should generate certificate test ssl in azure? i use selfcert tool! handy , works perfectly. self-signed certificates generated tool.

spring mvc - How to do page transitions in a popup using jquery? -

we have web application uses jquery. have add new module open in popup. pages in module open in same popup window using ajax. we have pages add/edit/list/search pages. want these pages loaded in same popup. is possible page transition in popup. using spring mvc. edit 1 its click on link in menu, open popup. popup have few more buttons take new screens in same popup. have used ajax update small portion of screen. used use divs , spans this. how replace entire popup page new page many html components. as far have used ajax, when remote calls, server side methods return data object json in response can used in client side update area of page. can return entire page in response server side? please help. ajax can work in 2 way: return json object used update content in page return html used replace content in page if use ajax replace entire page, links inside page need use ajax same. an easier approach might use iframe overlay, can have content act normal...

events - Backbone listenTo not working -

i have following working code, , planning replace object.on calls object.listento calls: setfield: function(field) { if (this.field) this.field.off(null, null, this); if (field) { this.field = field; this.field.on('validate', this.rendererrors, this); } return this; }, and new version setfield: function(field) { if (this.field) this.stoplistening(this.field); if (field) { this.field = field; this.listento(this.field, 'validate', this.rendererrors); } return this; }, but how it's not working. method this.rendererrors no being called second version. the strange thing updated al rest of app accordingly without trouble. i'm sure there must pretty silly i'm missing. btw, code used field raise event [...] this.trigger('validate', this.errors); this.error = !this.isvalid(); return this.errors; }, i haven't used new listento , stoplistening yet, can see in new version, you're calli...

javascript - google maps load error "google" undefined -

ok, have problem on when loading maps, part shows "google" undefined . var polyline = [ new google.map.latlng(3.032617, 101.376), new google.map.latlng(3.03255, 101.3759), new google.map.latlng(3.032467, 101.3758), new google.map.latlng(3.031867, 101.3753), new google.map.latlng(3.0318, 101.3753) ]; var polylineopts = { path: polyline, map: map, strokecolor: 'blue', strokeopacity: 1.6, strokeweight: 3, geodesic: true }; var poly = new google.maps.polyline(polylineopts); i expect error "google" undefined. javascript case sensitive. should be: var polyline = [ new google.maps.latlng(3.032617, 101.376), new google.maps.latlng(3.03255, 101.3759), new google.maps.latlng(3.032467, 101.3758), new google.maps.latlng(3.031867, 101.3753), new google.maps.latlng(3.0318, 101.3753) ]; var polylineopts = { path: polyline, map: map, strokecolor: 'blue', strokeopacity: 1.6, strokewe...

Android ListView not redraw properly -

i have listfragment custom row. problem when scroll items, underlying items don't disappear. remains visible , didnt't find solution problem. loader loads items database through arrayadapter @override public view getview(int position, view row, viewgroup parent) { viewholder holder = null; if(row == null) { row = minflater.inflate(r.layout.list_item_expense, null, false); holder = new viewholder(); holder.layout = (checkablelinearlayout)row.findviewbyid(r.id.mylinearlayout); holder.id = ((textview)row.findviewbyid(r.id.id)); holder.category = ((textview)row.findviewbyid(r.id.category)); holder.date = ((textview)row.findviewbyid(r.id.date)); holder.note = ((textview)row.findviewbyid(r.id.note)); row.settag(holder); // watch checked state , remember holder.layout.setcheckchangelistener(expenselistadapter.this); } ...

java - Google chart export in to PDF -

i need export google chart pdf file. in forum says that, there no way directly export charts pdf, can convert them png images , import image files pdf. converted svg format (google chart format) png format. my question : can export png image (streaming) directly pdf out saving in physical path? if yes how implement. my language java , java script client side. i searched many questions in doesn't solution match issue are using itext library? have exampes how add image on page . , use .jpg, nevertheless, think can change .png. p.s. i'm looking issue to. changing chart image , set in pdf - first way, understand, there 1 - using html convert pdf. so, i'm trying create html charts, converted in pdf format.

java - How to retrieve the values from the service which is returning List<Object> using jax-ws -

i have service returns list, object varies depends on different scenario. can suggest me jax-ws support behaviour or have alternative option. since jax-ws use jaxb serializate objects, jaxb need know name of type marshall or unmarshall. in standalone environment can deal kind of things. however, when dealing list of objects, becomes more complicated. moreover, each data type must defined in wsdl. service client must able convert response xml data type desired. if wish return different lists of different type, simplest use wrapper response. e.g. public class responsewrapper { private list<audio> audios; private list<video> videos; // setters , getters } @webservice public class mediastore { @inject audioservice audioservice; @inject videoservice videoservice; @webmethod public responsewrapper getcollections(string artistid) { responsewrapper response = new responsewrapper(); response.setaudios(audi...

php - Laravel 3 - POST Content-Length Exception -

running laravel 3. i trying upload files laravel framework. if file larger php setting upload_max_filesize throws exception below. i have tried in controller , routes no success (the if statement runs - sets session - exception still thrown showing error page) if ($_server['content_length'] > 8380000) { //do stuff here because big // set session , exit() } how can prevent exception being thrown without upping php memory limits? error: unhandled exception message: post content-length of 9306598 bytes exceeds limit of 8388608 bytes location: unknown on line 0 as side note, question has been asked atleast twice in laravel forum no answer given except 'increase php memory limits'. edit : problem seems laravel loading _post inputs before can check them in route or controllers. seems bug me. this looks php's max post size , defaults 8m on many systems (around 8388608 bytes). there nothing can in laravel around handled/manage...

azureservicebus - Deleting dead topics in Azure Service Bus -

i've tried homework on issue no searches can make have gotten me closer answer. closest hit detect , delete orphaned queues, topics, or subscriptions on azure service bus . my scenario: i have multiple services running (standard win service). @ startup these processes starts subscribe given topic in azure service bus. let's call topic "messages". when service shut down unsubcribes in nice way. but stuff happens , service crashes, causing unsubscription fail , subscription left hanging. my questions: 1) i'm seeing, each dead topic subscription counts when message sent topic. if no 1 ever going pick up. fact or fiction? 2) there anyway remove subscriptions haven't been checked while, example last 24h? preferrably power shell script? i've raised issue directly microsoft haven't received answer yet. surely, can't first experience this. i'll update if third party info. thanks johan on 1) question, yes messages sent t...

android - unfortunately app has stopped in emulator -

this mainactivity program.when run code emulator shows unforunately app has stopprd.please post solution this.thanks in advance.....i got error many application.so answer me overcome remaining issues........ package com.example.tab; import android.app.activity; import android.content.res.resources; import android.net.http.androidhttpclient; import android.os.bundle; import android.widget.tabhost; import android.widget.tabhost.tabspec; public class mainactivity extends activity { private tabspec tspec; private tabhost tabhost; /** called when activity first created. */ @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.activity_main); tabhost=(tabhost)findviewbyid(r.id.my_tabhost); tabhost.setup(); resources res=getresources(); tspec=tabhost.newtabspec("tab1"); tspec.setcontent(r.id.clock); tspec.setindicator("clock"); ta...

c# - Filtering For duplicate entries in ICollectionView -

i have class class abc() { public string name{get;set;} public string category{get;set;} } list formed class having value :- name = "a", category = "alphabet" name = "1", category = "numeric" name = "2", category = "numeric" name = "b", category = "alphabet" name = "a", category = "alphabet" i've applied filter(using icollectionview) on above list based on category "alphabets" , resulting list is:- name = "a", category = "alphabet" name = "b", category = "alphabet" name = "a", category = "alphabet" which working fine not able filter out duplicate entry list. using wpf mvvm. please help. in filter callback return true if current object has needed category , first 1 name. something this: ... observablecollection<abc> items { get;set} listcollectionview i...

Android Spinner - Move option left to right -

Image
hello, above current spinner looks like. i change few small things , need help: move app icon left right, "support me" on left, , icon on far right. move circle items right left. i'll have circle, , text. example (circle, "rate me"). i set focus default on "rate me" option, when start spinner selected. want inner circle in green, aka highlighted. below source code: string[] items = new string[] { "rate me", "cancel", "exit" }; arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_dropdown_item, items); new alertdialog.builder(this).settitle("support me") .seticon(r.drawable.ic_launcher) .setadapter(adapter, new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { if (which == 0) { ...

ruby - Calculate Median in An Array - Can someone tell me what is going on in this line of code? -

this solution calculating median value in array. first 3 lines, duh ;), third line magic happening. can explain how 'sorted' variable using , why it's next brackets, , why other variable 'len' enclosed in parentheses , brackets? it's sorted of sudden being used array? thanks! def median(array) sorted = array.sort len = sorted.length return ((sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0).to_f end puts median([3,2,3,8,91]) puts median([2,8,3,11,-5]) puts median([4,3,8,11]) consider this: [1,2,2,3,4] , [1,2,3,4]. both arrays sorted, have odd , numbers of elements respectively. so, piece of code taking account these 2 cases. sorted indeed array. sort [2,3,1,4] , [1,2,3,4]. calculate middle index (len - 1) / 2 , len / 2 / odd number of elements, , find average of them.

java - Choosing Hazelcast features -

i have task (i describe bit later) , far understand, hazelcast best choice it. has many features , usages, can't understand choose. actually task is: have java server app , java server app b. have several java servers, of them holding app instance, of them holding b instance, holding both. i need store 1 map between servers. both , b can put in map, , b can read map key. so think need distributed map, cant understand other features need? backup configuration? need distributed query b lookup key? need "hazelcast client"? hazelcast great tool. agree can daunting see need, it's simpler think :) you first need run 1 or more hazelcast nodes grid running (recommend 2 or more give redundancy). it's if server a/b have embedded hazelcast nodes, or if run hazelcast grid externally server a/b , use hazelcastclient talk it. you're best placed evaluate decision. it's easier start embedding hazelcast grid node server a/b. if find doesn't wo...

Ruby on Rails application installer -

i want develop rails application installer in joomla in can configure database name, username, password, port, host etc. best idea it. tried through rake tasks. don't know idea or not? please me. possible configure rails application during runtime. if yes, how configure? ideas, tutorials, links. in advance. what capistrano ? it's great tool deploy rails applications i'll suggest links it) http://teachmetocode.com/screencasts/basic-deployment-with-capistrano/ http://railscasts.com/episodes/133-capistrano-tasks http://guides.beanstalkapp.com/deployments/deploy-with-capistrano.html

Loop through and list a 2 column db table from Tinytds via ruby with column1 values as headings and column2 values as a list -

i've been trying learn basics of loops , i'm getting there i'm struggling brain around following requirement where, example, i've got data database table via tinytds, such key/values hashed array seems(? - beginner here, hope terminology correct!):- the data such values 1 'column' of db table repeated many times, whilst values of 2nd 'column' unique. therefore, rather creating table in html output has 2 columns column1 showing same line of text on , on (before next unique string lists on , over), i'd present information unique string values column1 headings , values of column2 listed beneath. in mind, think i'm trying achieve loop through column1 each unique string, output value, whilst running inner loop list values column2 column1 'string', moving on next unique value of column1,output value, loop through column2 again list values column1 'string2' etc. hope makes sense i'm struggling know how explain in correct ...

java - Intent.FLAG_ACTIVITY_CLEAR_TOP in SherlockActivity not serving the purpose -

the scenario : i have 4 activities : a, b, c , homeactivity . a launcher activity. using actionbarsherlock , a,b , c have menu option in bar. the flow : a-> b-> c --**on submit in c**--> homeactivity now when press back button on home activity, goes activity b after clicking submit in c , using intent intent = new intent(this, homeactivity.class); intent.setflags(intent.flag_activity_clear_top ); //shouldn't clear a,b , c ?? //intent.addflags(intent.flag_activity_clear_top ); startactivity(intent); finish(); but remain on homeactivity data submitted , started. also if menu button pressed on a,b,c , homeactivity started , in case, have default behaviour of back button(i.e go activity in menu pressed) any insights on how flag_activity_clear_top not serving purpose! (p.s. : homeactivity not launcher activity) i think finish home acitivity while go home activity -> activity a. when using clear top flag ...

iphone - UITabController flip -

i have tabbarcontroller in appdelegate : iboutlet tabbarviewcontroller *tab; this main controller in app. and in 1 of viewcontroller inside tabs want add uibutton when user press tabcontroller change uiviewcontroller flip animation. i tried achive method: radiomainvc *radiomainvc = [[radiomainvc alloc] initwithnibname:@"radiomainvc" bundle:nil]; uinavigationcontroller *radionav = [[uinavigationcontroller alloc] initwithrootviewcontroller:radiomainvc]; [uiview beginanimations:@"animation" context:nil]; [self.tabbarcontroller presentmodalviewcontroller:radionav animated:no]; [uiview setanimationtransition:uiviewanimationtransitionflipfromleft forview:self.tabbarcontroller.view cache:no]; [uiview commitanimations]; and flip won't work,any idea how fix it? unfortunately haven't tested code might trick: [uiview transitionfromview: self.tabbarcontroller.view toview: radionav.view duration: 0.5 options: uiviewanimationtransitionflipfrom...

java - is not abstract and does not override abstract method error -

i totally stuck in 1 of classes showing error: resettablehttpservletresponse not abstract , not override abstract method getheadernames() in httpservletresponse here entire class: import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.filereader; import java.io.ioexception; import java.io.outputstream; import java.io.printwriter; import java.util.arraylist; import java.util.hashset; import java.util.list; import java.util.locale; import java.util.set; import javax.servlet.servletoutputstream; import javax.servlet.http.cookie; import javax.servlet.http.httpservletresponse; import org.apache.commons.io.ioutils; import org.apache.commons.lang.exception.nestableruntimeexception; @suppresswarnings("deprecation") public class resettablehttpservletresponse implements httpservletresponse, resettable { private interface responseoperation { void apply(); } private httpservletresponse wrapped; private ...

CSS Polymorphism used in CSS3 -

i reading book of css3 in that, came across 1 word "css polymorphism" . have heard first time "css polymorphism" . searching on google not find much. my questions: what css polymorphism? how use in css explain examples? i don't think accepted term, appears used couple of times in context of properties. different css properties accept different values. polymorphism defined ( by dictionary.com ) as: the occurrence of in different forms, in particular. in case of css, individual properties can affect target in multitude of ways: background:#fff; /* background white */ background:url(img.png); /* background image */ background:#fff url(img.png); /* background white image */ background:url(img.png) no-repeat; /* background non-repeating image */ /* etc... */ this polymorphism. pro html5 , css design patterns describes css polymorphism (in relation properties) "combinatorial explosion of possibilities" .

matlab - changing certain elements in a 2D array -

i'm working on algorithm in matlab requires elements of matrix updated regularly , looking how best this. here description of i'm trying achieve: i have mxn array a , 1xn vector b . basically, vector b logical index describes column of a need select i.e. c = a(:,b) . unfortunately, logical vector b varies depending on processes. means number of columns in c not fixed. some other processing use c inputs , produce array d has same size c i.e. size(d) == size(c) now, need "reshape" d has same size a . tricky part columns in a weren't chosen in #2 above needs replaced nan s. of course can crude way of using loops. i'm looking matlab-way i.e. linear or logical indexing, vectorization, etc got stuck @ moment. some examples make things clearer: lets a = [1 2 3; 4 5 6; 7 8 9] b = [1 0 1] c = a(:,b) = [1 3; 4 6; 7 9] after processing, i'll d = [2 5; 6 7; 3 3] . now, need "reshape" d same size a padding nan i.e. d = [2 n...

javascript - Jquery countdown timer that doesn't reset on page refresh -

i need one. using vassilis dourdounis jquery plugin, , have created countdown timer hides link on complete. restarts whenever page refreshed, , shouldn't, should finish count , disappear. can anypne help, please? this jquery: /*! * jquery countdown plugin v1.0 * http://www.littlewebthings.com/projects/countdown/ * * copyright 2010, vassilis dourdounis * * permission hereby granted, free of charge, person obtaining copy * of software , associated documentation files (the "software"), deal * in software without restriction, including without limitation rights * use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of software, , permit persons whom software * furnished so, subject following conditions: * * above copyright notice , permission notice shall included in * copies or substantial portions of software. * * software provided "as is", without warranty of kind, express or * implied, including not limited...

c# - Common Language Runtime Detected an Invalid Program with ClickOnce -

i have invalidprogram exception message common language runtime detected invalid program this happen in application didn't change in last 3 month. change have change our build server (reinstall it). server running windows 8 , has windows sdk 7.1 on it. package application clickonce. this exception happen in specific method call, after methods of same class assembly called, think rules out assembly loading issues. i can't find lead start debug issue. think related version of tools use on build server such msbuild, csc, mage.exe , such. i found people error might happen when have long method names, not seem apply here because don't have long methods names , don't generate code myself. the application use .net 4.0 update 1 sure problem compile tools (the version think) or clickonce packaging tools because when compile , run application on machine work, when install packaged application on machine show exception above. add argument compiler: ...

c# - How does one allow a user to only be able to edit only his items in XAF -

i have companyuser , product class each user can create x amount of products. want each user able view each others products, able edit own product. i have create role named productpeople type permission on product class assign companyusers (the role has permissions, read write navigate etc). set criteria userx can edit/delete own product? as far understand question, using typepermissions. able express want, have employ objectpermissions. object of type securitysystemobjectpermissionsobject, can specify criteria can express restriction regarding 'own product'.

c++ - why can a base pointer point to derived object only under public inheritance? -

i think because base class data members , methods wont accessible , i'd more clarity on this. also, reason why polymorphism (using virtual functions) possible under public inheritance? actually, pointer base can point derived class if base private. thing such conversion impossible outside class. however, it's still possible perfrom such conversion in context base accessible. example: #include <iostream> using namespace std; struct base { void foo() const { cout << "base::foo()\n"; } }; struct derived : private base { const base* get() const { return this; // fine } }; int main() { derived d; const base *b = &d; // illegal const base *b = d.get(); //this fine b->foo(); } live example live example virtual call

sql - How to get top 'n' percentage values -

col1 col2 b 5 b 10 b 20 b 30 b 200 b 300 select top 50 percentage col2 mytable giving col2 5 10 20 whereas actual 50% different col1 col2 total(of col2) div(col2/total) cumulativeaddition % b 5 565 0.01 0.01 1% b 10 565 0.02 0.03 3% b 20 565 0.04 0.06 6% b 30 565 0.05 0.12 12% b 200 565 0.35 0.47 47% b 300 565 0.53 1.00 100% as can see 5 1% 10 3% 20 6% 30 12% 200 47% am using right sql function? as mentioned, top syntax not want. you require cumulative sum. alas, supported directed in sql server 2012, not in sql server 2008. for readability, prefer using correlated subquery cumulative sum. rest of query arithmetic: select col1, col2, t...

php - Yii: How to refer to model's field when columns name duplication performing relational query? -

i try execute relational query in yii: $r = machinedata::model()->with('machinegames')->findbypk($machine_id); but returns error: cdbcommand failed execute sql statement: sqlstate[42702]: ambiguous column: 7 error: column reference "machine_id" ambiguous line 1: ..."."game_id") ("t"."machine_id"=3) order machine_id... it seems problem in order by clause reference machine_id unclear. may refer both of tables because both have machine_id column. can suggest me solution, please? regards! p.s. using following cdbcriteria gives same error: $criteria=new cdbcriteria(); $criteria->alias = "u"; $criteria->compare('u.machine_id',$machine_id); $criteria->with = array('machinegames'); $r = machinedata::model()->findall($criteria); this relation in model machinedata : abstract class basemachinedata extends gxactiverecord { public function relations() { return array(...

c - how to write the character value from structure into the serial interface and convert into integer value? -

struct memorytag1; typedef struct memorytag1{ char a[8]= {'+','0','2','6','.','5','ea','\r'}; // setpoint temperature value char b[8]= {'-','0','2','4','.','5','eb','\r'}; char c[6]= {'+','0','2','0','ec','\r'}; }memory1; // message structure want transfer on serial interface (rs232) , later convert integer value. please guide me in this. your syntax bit off - try this: // declare memory1 struct type hold data typedef struct memorytag1 { char a[9]; // setpoint temperature value char b[9]; char c[7]; } memory1; // allocate , initialise memory1 struct memory1 m = { {'+','0','2','6','.','5','e','a','\r'}, {'-','0','2','4','.','5','e...

asp.net - SignalR IHubContext in WebRole Task -

i testing signalr application run in azure web role. have background processing thread, created in onstart of webrole. when try use ihubcontext send group message, fails no errors - message never received in hub client. same code created inside global.asax function correctly. imports system imports system.collections.generic imports system.linq imports microsoft.windowsazure imports microsoft.windowsazure.diagnostics imports microsoft.windowsazure.serviceruntime imports microsoft.aspnet.signalr imports system.threading.tasks public class webrole inherits roleentrypoint public overrides function onstart() boolean task.factory.startnew(sub() asynctasktest()) return mybase.onstart() end function private sub asynctasktest() threading.thread.sleep(10000) dim context ihubcontext = globalhost.connectionmanager.gethubcontext(of testub)() context.clients.group("testgroup").message("this d...

java - Lanczsos-Eigenvector in Mahout -

i attempting machine learning in mahout, java. have downloaded data want mysql. point stuck when variable of type "sparserowmatrix" has computations , rearrangements done. not understand how call of 2 methods can see fit: 1) org.apache.mahout.math.decomposer.lanczos.lanczossolver 2) org.apache.mahout.math.hadoop.decomposer.distributedlanczossolver any advice helpful @ point! distributedlanczossolver implements tool interface, can run regular hadoop job, example: hadoop jar $mahout_home/mahout-examples-0.5-job.jar org.apache.mahout.math.hadoop.decomposer.distributedlanczossolver --input /path/to/input --output /path/to/output --numcols 42 --numrows 42 --cleansvd "true" --rank 5 you call directly java using: toolrunner.run(new distributedlanczossolver().job(), args); alternatively if don't need in distributed fashion, lanczossolver.solve method looking for, have pass matrix, eigen vectors , eigen values. complicated stuff behind hood ...

Send file to remote php from local python in $_FILES -

preface: started learning python 1 month ago, please don't yell @ me :) have full developed site written in php, functions need pages insert "stuff" in database. developing command line program insert same thing , send them php scripts in $_post array, have no idea on how send file come in $_files array. here have far: i send $_post values using urllib modules , works fine import urllib.request import urllib.parse data=urllib.parse.urlencode({"hello":"yo!", "some":"alphabetaparkinglot"}) data=data.encode('utf_8') request=urllib.request.request("http://www.site.it/read_from_py.php") f=urllib.request.urlopen(request, data) out=f.read().decode('utf-8') if out[0]=="1": print("connection acquired!") else: print("no connection!") print("exit!") #then exit! ...i read filename local computer prompting choose file dialogbox... from tkinter import...

python - Adding another line to chord chart arc title from different source in d3 -

i'm relatively new d3 , still trying wrap head around how data sets link together. simplicity sake, using this beautiful chord chart mike bostock base design. i've created 35x35 matrix of fake data, variable defined "corr": in python corr = pandas.dataframe(randn(35,35)) placed in script var corr = [[...], [...], [...], . . ., [...]]; in script, title chunk is: chord.append("title").text(function(d) { return " " + cities[d.target.index].name + " → " + cities[d.source.index].name + ": " + formatpercent(d.source.value) + "\n " + cities[d.source.index].name + " → " + cities[d.target.index].name + ": " + formatpercent(d.target.value); }); i think problem trying call different data set, regardless, of approaches end in chord chart or titles not appearing. any , advice ap...

python 2.7 - Are """ syntactic sugar for raw strings? -

from tutorial: print """ usage: thingy [options] -h display usage message -h hostname hostname connect """ produces following output: usage: thingy [options] -h display usage message -h hostname hostname connect hello = r"this rather long string containing\n\ several lines of text in c." print hello would print: this rather long string containing\n\ several lines of text in c. which suggests me """ notation syntactic sugar raw strings. new python, searching documentation not option me. are """ text """ , r" text " completely identical semantically? no print """a\nb""" print "----" print r"a\nb" >>> b ---- a\nb unless use r or r prefix escape sequences interpreted. straight out of documentation: ...

android - Why would you want to configure intent filters from code? -

i'm going through wi-fi direct tutorials android , had quick question how they're using intentfilter in section "set broadcast receiver , peer-to-peer manager". there, manually configure instance of intentfilter activity , instantiate in oncreate() . then, in onresume() , intentfilter passed in registerreceiver() . what's specific reason why intentfilter configured here , reason why these intents couldn't set in androidmanifest.xml ?

facebook - "uniqueIdentifier" is banned by Apple to use -

i want upload iphone app problem facebook ios sdk using "uniqueidentifier" because of issue not able upload app on app store.any possible solution ? apple has banned uniqueidentifier why issue coming please suggest me possible solution. you can use otool command identify precisely libraries @ fault, grep still providing pool of suspicious files. shown in blog post here , following command output non-blank lines libraries cause issue: for match in $(grep -lr uniqueidentifier *); printf "file:%s\n\n" $match; otool -v -s __text __objc_methname $match | grep uniqueidentifier; printf "\n\n"; done;

javascript - CORS synchronous requests not working in firefox -

the official documentation of jquery ( async ajax section ) says that: cross-domain requests , datatype: "jsonp" requests not support synchronous operation. however works in recent browsers firefox version >= 20. here type of calls i'm making: $.ajax({ type : "get", async: false, datatype : "text", url : link, xhrfields: { withcredentials: true }, success: function(response){ console.log("success "); }, error: function(error){ console.error(error); } }); does have clue why happening ? update: ive tested both jquery , vanilla xhr error same [exception... "a parameter or operation not supported underlying object" code: "15" nsresult: "0x8053000f (invalidaccesserror)" use beforesend instead of xhrfield . $.ajax({ type : "get", async: false, datatype : ...

Creating Android app using OpenMAX library in GB, but showing not found? -

i'm trying develop android app, in gingerbread using openmax-al. basically openmax-al library not supporatable in gingerbread.so im using openmax-al libray ics (by building source).i able compile sample application using library without error after installing in ginger bread showing error below..and tried push library inside application lib folder still same error. what should use openmax-al library in gingerbread. can u 1 suggest me idea ,im struggling last 1 week? in advance. used in android.mk file compile: local_ldlibs := $(lib)/libopenmaxal.so 05-21 16:31:37.270: e/androidruntime(28217): java.lang.exceptionininitializererror 05-21 16:31:37.270: e/androidruntime(28217): @ java.lang.class.newinstanceimpl(native method) 05-21 16:31:37.270: e/androidruntime(28217): @ java.lang.class.newinstance(class.java:1409) 05-21 16:31:37.270: e/androidruntime(28217): @ android.app.instrumentation.newactivity(instrumentation.java:1021) 05-21 16:31:37.270: e/androidruntime(...

android - MediaPlayer debug messges? -

i'm making use of following code play *.mp3 file in app, mediaplayer mmediaplayer = new mediaplayer(); int resid=getresources().getidentifier(cts, "raw", getpackagename()); mmediaplayer = mediaplayer.create(this, resid); mmediaplayer.setaudiostreamtype(audiomanager.stream_music); mmediaplayer.setlooping(false); mmediaplayer.start(); the code works fine.. there lots of debug messages getting printed repeatedly in logcat. i'm planning publish app soon.. i'm wondering if above code right or wrong. any pointers? update: here messages getting printed, 05-21 16:32:41.235: v/mediaplayer-jni(6000): release 05-21 16:32:41.235: v/mediaplayer(6000): setlistener 05-21 16:32:41.235: v/mediaplayer(6000): disconnect 05-21 16:32:41.250: v/mediaplayer(6000): destructor 05-21 16:32:41.250: v/mediaplayer(6000): disconnect 05-21 16:32:41.250: w/cursorwrapperinner(6000): cursor finalized without prior close() 05-21 16:32:41.790: v/mediaplayer(6000): message received msg=...

java - Error signing a soap request. Integrity lost -

i have generated class xjc , wsimport tools. have object attributes , elements need. have signaturetype object must contain sign of data send. my root object looks this: @xmlrootelement(name = "mensajepesadofirmadotipo") @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "mensajepesadofirmadotipo", proporder = { "signature" }) public class mensajepesadofirmadotipo extends mensajepesadotipo { @xmlelement(name = "signature", namespace = "http://www.w3.org/2000/09/xmldsig#", required = true) protected signaturetype signature; ... the process i'm doing is: fill information of mensajepesadofirmadotipo except signaturetype. next, unmarshall xml , use java xml signature api. marshall again , call ws. i have integrity problem of sign because signed xml not same when marshall before call ws. xml signed (signed ok): <ns1:mensajepesadofirmadotipo xmlns:ns1="urn:correos.es:ape.sne.datos.1.0" xmlns:...

garbage collection - Using D for a realtime application? -

i considering using d ongoing graphics engine. 1 thing turns me down gc. i still young programmer , have lot of misconceptions gc's , hope can clarify concerns. i aiming low latency , timing in general crucial. know gc's pretty unpredictable, example application render frame every 16.6ms , when gc's kicks in go number 30ms because not deterministic right? i read can turn down gc in d, can't use majority of d's standard library , gc not off. true? do think makes sense use d in timing crucial application? short answer : requires lot of customization , can difficult if not experienced d developer. list of issues : memory management not big problem. in real-time applications never ever want allocate memory in main loop. having pre-allocated memory pools main data pretty de-facto standard way such applications. in sense, d not different - still call c malloc directly heap pools , memory won't managed gc, won't know it. however, languag...