Posts

Showing posts from January, 2013

python - Odoo8. Upload product image programmaticaly -

i image url , try upload odoo (product.template, image column). tried many methods none of them helped me. give me right way upload image of product odoo without using csv import. thank you. this worked me : import urllib2 import base64 image = urllib2.urlopen('http://ddd.com/somepics.jpg').read() image_base64 = base64.encodestring(image) product.image_medium = image_base64 //(new api v9) #in old api maybe #prod_obj.write(prod_id, {'image_medium': image_base64})

c++ - References - Why do the following two programs produce different output? -

i read references in c++. aware of basic properties of references still not able figure out why following 2 programs produce different output. #include<iostream> using namespace std; int &fun() { static int x = 10; return x; } int main() { fun() = 30; cout << fun(); return 0; } this program prints 30 output. per understanding, function fun() returns reference memory location occupied x assigned value of 30 , in second call of fun() assignment statement ignored. consider program: #include<iostream> using namespace std; int &fun() { int x = 10; return x; } int main() { fun() = 30; cout << fun(); return 0; } this program produces output 10 . because, after first call, x assigned 30 , , after second call again overwritten 10 because local variable? wrong anywhere? please explain. in first case, fun() returns reference same variable no matter how many times call it. in second case, fun

syntax - Why does adding parentheses in if condition results in compile error? -

the following go code runs ok: package main import "fmt" func main() { if j := 9; j > 0 { fmt.println(j) } } but after adding parentheses in condition: package main import "fmt" func main() { if (j := 9; j > 0) { fmt.println(j) } } there compile error: .\hello.go:7: syntax error: unexpected :=, expecting ) .\hello.go:11: syntax error: unexpected } why compiler complain it? the answer not "because go doesn't need parentheses"; see following example valid go syntax: j := 9 if (j > 0) { fmt.println(j) } go spec: if statements: ifstmt = "if" [ simplestmt ";" ] expression block [ "else" ( ifstmt | block ) ] . the difference between example , yours example contains expression block. expressions can parenthesized want (it not formatted, question). in example specified both simple statement , expression block. if put whole parentheses, compiler

android - Why background drawable retain its state after activity finished? -

i have custom viewgroup, 1 thing, changing background's alpha on layout phase: @override protected void onlayout(boolean changed, int l, int t, int r, int b) { ... getbackground().setalpha(0); ... } print alpha in setbackground : @override public void setbackground(drawable background) { if (background instanceof colordrawable) { bgalpha = color.alpha(((colordrawable) background).getcolor()); d("bg:" + integer.tohexstring(bgalpha)); super.setbackground(background); } else { ... } } now have activity inflate custom view layout xml: <customviewgroup android:layout_width="match_parent" android:layout_height="match_parent" android:background="#88000000" /> when first launch app, setbackground print: bg:88 then finish app , reopen launcher, setbackground print: bg:0 why background drawable retain state after acti

php - Error installing packages using composer? -

Image
i want install googleauth using composer getting error http request failed i have composer.json file in working directory, { "require":{ "google/api-client":"dev-master" } } how solve error ?

mysql - Sorting table created by PHP, can't use query to sort -

i have column want sort. let me explain code first. as can see, there 3 select statements , 3 different tables(table names in code). first query selects data table whereby assign retrieved data id column $device_id . the second query selects data table according value of $device_id (one value only). return multiple board ids(multiple values). if rows returned, table created. in table, third query executed check each board_id in third table( $table_tester_info ). if board_id exists, displayed. example: if there 40 board_id , out of 40 20 returned rows, rows displayed in table. now here's problem. want sort table according column in $table_tester_info (the third table) however , can use order by in second query. wouldn't problem want sort according column in $table_tester_info , not $table_tester_config (the second table). i'm using jquery not want use plugins sort dom elements in html unless there no other way(but i'm sure there many ways, don't know

java - How can I rotate an Area object on its axis while also moving it along the y axis? -

so have area object have created , made 4 star polygon. want rotate object while simultaneously having translate along y axis. code points use create object , center of star xloc , yloc paint function below that: double rots = 0.0; int xpoints[] = { 45, 48, 56, 48, 45, 42, 34, 42 }; int ypoints[] = { 56, 47, 45, 43, 34, 43, 45, 47 }; double xloc = 150, yloc = 250; public void paint(graphics g) { graphics2d g2d = (graphics2d) g; renderinghints rh = new renderinghints( renderinghints.key_antialiasing, renderinghints.value_antialias_on); rh.put(renderinghints.key_rendering, renderinghints.value_render_quality); g2d.setrenderinghints(rh); g2d.translate(xloc, yloc); g2d.rotate(rots); g2d.fill(star); //yloc += .01; rots += .001; repaint(); } the problem i'm having in paint function. getrotateinstance spins along axis of xloc , yloc. when numbers incremented, star's rotation widens out origin encompass whole screen. solution can

gfortran - 2D array concatenation in fortran -

fortran 2003 has square bracket syntax array concatenation, intel fortran compiler supports too. wrote simple code here matrix concatenation: program matrix implicit none real,dimension (3,3) :: mat1,mat2 real,dimension(3,6):: mat3 integer mat1=reshape( (/1,2,3,4,5,6,7,8,9/),(/3,3/)) mat2=reshape( (/1,2,3,4,5,6,7,8,9/),(/3,3/)) mat3=[mat1,mat2] !display i=1,3,1 write(*,10) mat3(i,:) 10 format(f10.4) end end program but error mat3=[mat1,mat2] error: incompatible ranks 2 , 1 in assignment i expect output as 1 2 3 1 2 3 4 5 6 4 5 6 7 8 9 7 8 9 can comment going wrong? rank 2 , 1 here? guess arrays have rank 2. the array concatenation in fortran 2003 doesn't work think. when concatenate, it's not going stack 2 arrays side side. pick elements first array 1 one , put one-dimensional array. same thing second array append 1-d form of first array. the following code works. program matrix implicit none real,dimension (3,3) :: mat1,mat2 real,dimension(18) :

ruby on rails - Law of Demeter in `includes` and `group` queries -

how can apply law of demeter on code? i know how creating separate methods, scope.... i'm not sure how queries this. pages = seo::page.active .path_with(category) .includes(seo_area: :suburb) .group('suburbs.state') scope :path_with, -> category { where('path ?', "/#{category}/%") } you can create class-methods or new scopes encapsulate logic in seo::page class. def self.grouped(category) active .path_with(category) .includes(seo_area: :suburb) .group('suburbs.state') end pages = seo::page.grouped(category)

c# - How to find the the start and end of a yesterday with Noda Time? -

this question has answer here: noda time - start/end of day zone 1 answer i'm trying the first/last milliseconds yesterday (which applies other dates too) noda time, , think i'm close not sure if have done right. if convert yesterday.atmidnight() ticks add number of ticks in day minus 1 give me end time. make sense , correct usage of noda time given requirements? thank you, stephen //come begin , end parameters in milliseconds oracle query //assumption code run midnight 4am //assumption application code run on servers in midwest usa //assumption database servers on west coast usa instant = systemclock.instance.now; duration duration = duration.fromhours(24); localdate yesterday = now.inutc().minus(duration).date; console.writeline(yesterday.atmidnight()); // add day minus 1 tick update the noda docs show period.between might useful too, test

JavaScript regex to find string -

i have string , 2 words dictionary , trying know if in string there words not dictionary words. var string = 'foobarfooba'; var patt = new regexp("[^(foo|bar)]");// words dictionary var res = patt.test(string); console.log(res);//return false it should return true because in string there 'ba', return false. same phil commented in question, have rid of character class: [^(foo|bar)] ^-- here --^ character classes used match (or not match if use ^ ) specific unsorted characters. just use: var patt = new regexp("(?:foo|bar)");// words dictionary if want ensure string matches regex, can use: ^(?:foo|bar)+$ working demo if want capture invalid words, can use regex capturing groups this: ^(?:foo|bar)+|(.+)$ working demo match information match 1 1. [9-11] `ba`

python - AttributeError when accessing groups in ansible jinja template -

i running ansible playbook following inventory structure: [appservers] xy.example.com [db_servers] abc.example.com in task of role, template command executed jinja templace having following code: {% host in groups["appservers"] %} print host: {{ host }} {% endfor %} however, execution of task fails message: fatal: [xy.example.com]: failed! => {"msg": "undefinederror: 'list object' has no attribute 'appservers'", "failed": true, "changed": false} from examples found, should possible, since groups["appservers"] should dict, can used iterated on in template explained here do know wrong code or how can debug error? if change template code {% host in groups %} print host: {{ host }} {% endfor %} the resulting file contains print host: appservers print host: print host: db_servers this question not contain enough information , should edited or deleted cannot reproduced simple am

neural network - What is gradInput and gradOutput in Torch7's 'nn' package? -

hi starter of using torch's 'nn' package. in past 2 weeks, extremely confused meaning of gradinput , gradoutput in torch's 'nn' library. believe 'grad' here means gradient, 2 variables refers to? thanks anyone's help! gradoutput: gradient w.r.t. output of module. passed in either loss function, or module next current module. used compute gradient w.r.t. input (gradinput) , gradient w.r.t. parameters of module (gradweight / gradbias)

How to print value of a hash map according to increasing/decreasing order of key in c++? -

if have map, map <int,int> m; and following key value pair (-2,3) , (-14,8) , (4,8), (6,12) , (3,76) now if want print value in increasing order of keys,then how print ? o/p 8 3 76 8 12 the keys in std::map ordered default (using operator< ). can iterate on map: for (std::map<int, int>::iterator = m.begin(); != m.end(); i++) { cout << i->second << "\n"; }

statistics - Contingency table in Python -

given 2 lists of equal length, how can construct contingency table in pythonic way? know confusion_matrix skit-learn , there 'manual' , effective ways that? you can use pandas library create table shown in wikipedia example, so, import pandas pd right_handed = [43, 44] left_handed = [9,4] df = pd.dataframe({'right': right_handed, 'left': left_handed}, index = ['males', 'females']) this yields dataframe, so, in [3]: print (df) left right males 9 43 females 4 44 you can use sum totals, print (df.left.sum()) print (df.right.sum()) 13 87 in [7]: print (df.ix['males'].sum()) print (df.ix['females'].sum()) 52 48

javascript - How do I initialize list.js after a dynamically-created list is rendered? -

sadly, list.js isn't filtering list @ all. i'm assuming it's because elements not in dom when javascript called. var render = function(list, arr){ arr.foreach(function(coder){ var context = { logo:coder.logo, name:coder.displayname, status:coder.status, status_icon:coder.status_icon, url:coder.url}; var html = template(context); $(list).append(html); }) var options = { valuenames: [ 'name' ] }; var hackerlist = new list('hacker-list', options); } ... render('#all',all); render('#offline', offline); render('#online', online); you can see in last 2 lines, attempting call code after foreach finished appending elements (handlebar templates). not working me either. here surrounding html. <div class='container' id='main-list'> <div id='hacker-list' class=""

vb.net - table.keyfield=table.field2 gives (0x80131904): An expression of non-boolean type specified in a context where a condition is expected -

first post i have been struggling hours today , have not been able find on web. i have vb.net program runs query string read configuration file needs configurable (not problem). queries work fine below code long there no clause '=' isn't boolean. (ex table1.fieldkey=table2.key) i error: system.data.sqlclient.sqlexception (0x80131904): expression of non-boolean type specified in context condition expected, near 'key'. code: public sub doquery() dim cn new sqlconnection(), cmd new sqlcommand(), schematable datatable, myreader sqldatareader, myadapter new sqldataadapter() dim myfield datarow, myproperty datacolumn dim j integer = 0 dim queryoutput new datatable 'open connection sql server cn.connectionstring = connectstring cn.open() 'retrieve records cmd.connection = cn cmd.commandtext = query try myreader = cmd.executereader() catch ex exception writelog("an error occured. check s

.net - How to pull email addresses from outlook? -

i'm trying write outlook extension allow use hover on in-company email address , see seat location, similar how can see lync availability. i'm being told, however, isn't possible pull email addresses outlook, nor have extension activate when user hovers on them. true? , if not, how can done? you can retrieve email information outlook fine. cannot figure out object user hovering mouse cursor on is. can try use accessibility api check control @ given position is, not let directly retrieve string displayed on screen. can course try match value against mailitem.recipients collection, don't know how reliable be.

angularjs - NodeJs + ExpressJs app routing odd behavior -

i learning expressjs. far have setup simple todo app user authentication using passportjs. use mongoose repository. there nothing in web explain odd behavior i'm seeing route setup. scenario: when hit /passport direct passport page (login/signup) when hit /aslkdjf direct passport page if user not logged in, else direct file /public/index.html) when hit / should direct passport page if user not logged in, goes /public/index.html instead , todo app fail req.user.username under /api/todos undefiend strangely, when remove router.get('/*', ... configuration, app still go public/index.html, when hit base path '/', not when hit '/asdfa'. ... function loggedin(req, res, next) { if (req.user) { next(); } else { res.redirect('/passport'); } } var router = express.router(); // passport ---------------------------------------------------------

com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'play' -

i work in sbt project, , using library play-ws application not play framework. so, when run mi job, have error: com.typesafe.config.configexception$missing: no configuration setting found key 'play' com.typesafe.config.configexception$missing: no configuration setting found key 'play' @ com.typesafe.config.impl.simpleconfig.findkey(simpleconfig.java:124) @ com.typesafe.config.impl.simpleconfig.find(simpleconfig.java:145) @ com.typesafe.config.impl.simpleconfig.find(simpleconfig.java:159) @ com.typesafe.config.impl.simpleconfig.find(simpleconfig.java:164) @ com.typesafe.config.impl.simpleconfig.getobject(simpleconfig.java:218) @ com.typesafe.config.impl.simpleconfig.getconfig(simpleconfig.java:224) @ com.typesafe.config.impl.simpleconfig.getconfig(simpleconfig.java:33) @ play.core.invoker$$anon$1.play$core$invoker$$anon$$loadactorconfig(invoker.scala:35) @ play.core.invoker$$anon$1$$anonfun$3.apply(invoker.scala:

Reload page with Javascript when count down reaches 0 -

i m using below function display count down , reload page when counter reaches 0. sat , watched counter hit 0 , nothing happened. isn't location.reload() suppose refresh page? function secondpassed() { var numdays = math.floor(seconds / 86400); var numhours = math.floor((seconds % 86400) / 3600); var numminutes = math.floor(((seconds % 86400) % 3600) / 60); var numseconds = ((seconds % 86400) % 3600) % 60; if (numseconds < 10) { numseconds = "0" + numseconds; } document.getelementbyid('count').innerhtml = "<span class='fa fa-clock-o' aria-hidden='true'></span> " +('' + numdays).slice(-2) + "d " + "" +('' + numhours).slice(-2) + "h " + "" + ('' + numminutes).slice(-2) + "m " + "" +('' + numseconds).slice(-2) + "s "; if (seconds <=

php - How to start REST client from zf2 skeleton application -

in short, want create client uses http basic authentication straight skeleton of zend framework 2. the client has authorize , send post new message. am starting onscratch (not quite - have skeleton f2) can somee explain me need start , how initiate zend_rest_client? edit: looked more closely on stack overflow , found similar question now indexcontroller.php file looks this: <?php namespace application\controller; use zend\mvc\controller\abstractactioncontroller; use zend\view\model\viewmodel; use zend\http\request; use zend\http\client; use zend\stdlib\parameters; class indexcontroller extends abstractactioncontroller { public function indexaction() { $request = new request(); $request->getheaders()->addheaders(array( 'content-type' => 'application/x-www-form-urlencoded; charset=utf-8' )); $someurl="http://apiurl/public_timeline.json"; $request->seturi($someurl);

android - getTriggeringLocation always returns null -

i have problem coming along android fused location api. have intentlistener service need receive locations periodically. create , connect googleapiclient successfully, request receive location updates through pendingintent, every time call geofencingevent.gettriggeringlocation return value null. here's code: private void createlocationrequest() { mlocationrequest = new locationrequest(); mlocationrequest.setinterval(interval); mlocationrequest.setfastestinterval(fastest_interval); mlocationrequest.setpriority(locationrequest.priority_high_accuracy); } private void startlocationlistener(context context) { if (!isgoogleplayservicesavailable(context)) { log.d(tag, "no google play services."); return; } createlocationrequest(); mgoogleapiclient = new googleapiclient.builder(context) .addapi(locationservices.api) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this)

crash - How to autobackup Visual Studio Projects? -

is there add-in or non default setting automaticly backup source files in visual studio? i ask this, because pc crashed bsod whilst stopping debugging of project used ping class. (bug reported 4 years ago ms...) , main file filled nul s (as n++ showed). so looked mydocuments (as suggested elsewhere ) folder find nothing, , yes setting enabled. have use 2 hour old file gdrive gave me. my idea of such backup mechanism every 5 minutes changed files backuped custom directory. backups should remain until backup files old or storage used. i'm using visual studio 2013 community edition on win 7x64. i recommend using sort of hosted source control backing work, like github or visual studio online.

Rythm template engine define custom method in Java code -

i know there possibility define method in templates this: @def mymethod(string parameter){ before @parameter after } and use it: @mymethod("my object") this output: before object after can define mymethod in java code , use in multiple templates ? you don't need define method in java code. instead in rythm template home directory create file named __global.rythm , , define method there, rythm template automatically pick method because __global.rythm @include rythm engine in every template automatically. below real global rythm file project: @import com.abc.model.* @import org.rythmengine.spring.web.csrf @import org.rythmengine.rythmengine @import com.abc.appconfig @import com.abc.model.color.*; @args csrf csrf @def string csrfparam() { return "__csrf=" + ((null == csrf) ? "nocsrf" : csrf.value); } @def rythmengine rythm() { return __engine(); } @def user me() { return user.me(); } @def boolean loggedin() {

javascript - Merge two object arrays for Chart -

Image
i've 2 arrays i'm going merge , load in chart. range = date array generated moment.js, there date of every day in example 1 month or specific date range 1 attribute count: "0" data = fetched data database through backbone now want set atrribute count data count, date same in both arrays. i'm using lodash... _.foreach(range, function(n) { console.log(n.date.substring(0, date.length-6)); // if n.date = date data replace count value data array }); thanks help you can use _.find match items in range ones in data. _.foreach(range, function(r) { var d = _.find(data, {date: r.date}); //find item in "data" date matching r.date if(d) { r.count = d.count; } });

python - Get a list of N items with K selections for each element? -

for example if have selection set k k = ['a','b','c'] and length n n = 4 i want return possible: ['a','a','a','a'] ['a','a','a','b'] ['a','a','a','c'] ['a','a','b','a'] ... ['c','c','c','c'] i can recursion not interesting. there more pythonic way? that can done itertools . >>> k = ['a','b','c'] >>> import itertools >>> n = 4 >>> = itertools.product(k,repeat = n) >>> l = [a in i] >>> l[:3] [('a', 'a', 'a', 'a'), ('a', 'a', 'a', 'b'), ('a', 'a', 'a', 'c')] edit: realized want product , not combinations_with_replacement . updated code.

python - Replacing if-else statement with Exception Handling -

i have function below has if-else statement within it. after reading this post thought may better use try-catch exception handling instead. however, not sure how this. basically, if currency inputted not aud want throw exception print statement below. def update(self, currency): if self.currency == 'aud': url = 'http://www.rba.gov.au/statistics/tables/csv/f17-yields.csv' response = urllib2.urlopen(url) text = response.read() csvfile = stringio.stringio(text) df = pd.read_csv(csvfile) print df else: print('this currency not available in database') you don't want raising , catching exception @ same place. instead, want raise exception error first noticed, , catch wherever makes sense report issue. in code you've shown, want replace print call raise statement, of valueerror . pass text you're printing argument exception: raise valueerror('this currency not

JSF panelGroup not getting rendered after ajax call -

i'm using jsf , have form contains panelgroup , panelgroup contains 2 commandlinks , datatable . datatable contains commandlinks too. commandlinks call method of javabean via ajax. and problem. if click on commandlinks link_edit or link_cancel panelgroup getting rerenderd. if click on commadlink inside datatable link_delete panelgroup not getting rerendered. know i'm doing wrong? here relevant section of file: <h:panelgroup id="panel_destinations"> <h:commandlink id="link_edit" value="edit" styleclass="link" rendered="#{not editroute.ineditdestinationmode}"> <f:ajax listener="#{editroute.editdestinations()}" render="panel_destinations" immediate="true"/> </h:commandlink>

Why would .htaccess rewrite rules that work perfectly fine elsewhere produce redirect loops? -

i'm trying force non-www + https in .htaccess on aws ec2 instance. while there abundance of apparently working solutions right here on stackoverflow, of produce redirect loops me. i redirect loop when try rule: rewriteengine on #rewritecond %{http_host} ^(www\.)(.+) [or] #rewritecond %{https} off #rewritecond %{http_host} ^(www\.)?(.+) #rewriterule ^ https://%2%{request_uri} [r=301,l] (via force non-www , https via htaccess ) same one: rewriteengine on #rewritecond %{http_host} !^domain.com$ [nc] #rewriterule ^(.*)$ https://domain.com/$1 [l,r=301] #rewritecond %{https} off #rewriterule ^(.*)$ https://domain.com/$1 [r,l] both seem work respective op, , indicated of comments, work others too. i have following virtualhosts set in httpd.conf : namevirtualhost *:80 listen 8443 namevirtualhost *:8443 <virtualhost *:80 *:8443> serveradmin webmaster@domain.com documentroot /var/www/domain.com servername domain.com serveralias *.domain.com e

asp.net mvc - On Which Tier should user authentication should exist in n-tier website -

i went through different architecture books such one: microsoft application architecture guide, 2nd edition , building new n-tier website asp.net mvc presentation layer. question is, if use asp.net identity , on tier/layer should implement user authentication? i thought should in cross cutting concerns, because need check if user authorized or authenticated access functions plus may use user name on many tiers, such business, services , presentation layer. and thought better put in presentation layer specially because presentation layer mvc , easy deal asp identity there , allow me user [authorize] , [allowanonymous] easily. i know question answer depend on many other factors trying here achieve best practice, need point of view , discuss it. there quite few similar questions here on stackoverflow, , many answers. here view on matter. you have separate abstraction implementation. the abstraction (an interface) defines questions need able ask authentication serv

Asp.Net Website extension for visual studio 2012 express for windows desktop -

currently,i have visual studio 2012 express windows.i want build asp.net website on not have provision it.what should do? you can install either: visual studio 2012 express web visual studio 2013 express web or, , depends on situation visual studio 2013 community edition which free version of visual studio professional can used based on financial or organisational situation. it's free open source, academic , "small businesses": q: can use visual studio community? a: here’s how individual developers can use visual studio community: individual developer can use visual studio community create own free or paid apps. here’s how visual studio community can used in organizations: an unlimited number of users within organization can use visual studio community following scenarios: in classroom learning environment, academic research, or contributing open source projects. for other usage scenarios: in non-enterprise organiza

javascript - If statements in a function -

is doing this: function number(a, b){ if(a + < 1) return + + b; if(a + > b) return + - b; return + i; } considered bad practice opposed this?: function number(a, b){ if(a + < 1){ return + + b; }else if(a + > b){ return + - b; }else{ return + i; } } i think without curly braces, might run problems either linters or minifiers. other that, it's personal taste. people argue "no braces" approach because of brevity, while people prefer curly braces readability (this option i'm in favor of). as far consistency, it's easier stick using curly braces, because won't have single-line if blocks. as far not using else , that's fine when there's return statement embedded in block. if there's not return inside block, , both if conditions met, it'll end running both sets of code. have unintended side effects. example: if(a) dosomething(); if(b) dosomethingelse(); ca

jQuery: add content to end of div -

i have html: <div class="region-list" id="region_north_america"> <strong>north america</strong> </div> and want add more divs after strong element result: <div class="region-list" id="region_north_america"> <strong>north america</strong> <div> ... </div> <div> ... </div> <div> ... </div> </div> i trying this: var row_str = '<div>content here</div>'; $('#region_north_america div:last').html(row_str); however, there no change html. since there no div within element selected. i know js making code because can print content of row_str console. so, how can end of container element add new items? thx. try: $("#region_north_america").append(row_str); using append() .

xhtml - JSF/Facelets: why is it not a good idea to mix JSF/Facelets with HTML tags? -

i've read several times now: developers aren't advocates of interleaving jsf/facelets tags html tags in xhtml files. html tags won't part of ui component tree, what's disadvantage of that? i find code examples authors kind of mixing: http://www.ibm.com/developerworks/java/library/j-facelets/ http://www.packtpub.com/article/facelets-components-in-jsf-1.2 http://oreilly.com/catalog/9780596529246 "seam in action" interleaves jsf/facelets , html tags. i'm confused use. started out mixing tags, i'm beginning believe not right choice. however, fail see why puristic approach preferrable. i know have table jsf datatable doesn't give me enough flexibility display need to, doing puristically isn't possible. furthermore i'm wondering why none of examples above use f:view etc. instead of hardcoded html, head, body etc. tags. can please clear me? during jsf 1.0/1.1 ages indeed "not idea", because html not automat

java - Adding nested jars into the classpath -

the java documentation includes note adding nested jars classpath. to load classes in jar files within jar file class path, must write custom code load classes. there many tools this, such ones listed here , here . do these tools work extracting classes nested jars , adding extraction path classpath? or take more unzipping archives? is there technical reason limitation manifest.mf classpath can point local file system, not inside own archive? another option if using maven shade mojo . explode of jars, allowing contents packaged code. capable of other magic, moving dependencies custom packages avoid conflicts , merging files found in meta-inf. one of primary problems jars expose artifacts @ same location. can problematic (usually jdk) systems allow extension via serviceloader . these files need intelligently merged / concatenated. another api effected in subtle, possible bug causing ways, classloader.getresources(string) . if using secrutiymanager th

google api - How to implement AppInviteInvitation in android app -

i trying implement invitation doesn´t work. intent intent = new appinviteinvitation .intentbuilder("send invitations xyz app") .setmessage("try out xyz app now") .setdeeplink(uri.parse("http://example.com")) .build(); startactivityforresult(intent, request_invite); error: generic::invalid_argument: com.google.apps.framework.request.badrequestexception: no associated application and/or client id found package name com.name.package. @ com.google.social.boq.platform.appinvite.client.lookuppackaginginfoproducermodule.producecontainerprojectid(lookuppackaginginfoproducermodule.java:63) suppressed: criticalinputfailure: java.lang.boolean com.google.social.boq.platform.appinvite.client.filterinvitationsproducermodule.produceallowpushnotification(com.google.social.platform.appinvite.internal.proto.clientapplication,com.google.social.boq.platform.appinvite.client.applicationconfig.notificationconfigmanager) failed while trying

delphi - connection refused when I try to connect client with server -

Image
i made basic client / server datasnap applications , work in local network through http when tried connect internet connection refused, here steps followed: i set @ server component tdshttpservice connect through port no 8081 in client set use same port in tsqlconnection component, , used pc public ip in hostname when try connect connection refused. any advise ? forgot client firemonkey app running on android. you should go router admin console, find "port forwarding" , route port (8081) computer ip - have router traffic on port should go computer

procedure - How to call a list for update multiple times until a condition is fulfilled in Netlogo -

i new netlogo , still learning , want call list after update done , update until condition reached , if have list let xy [[-2 6][-1 6][0 6][-1 6][-2 6][1 5][2 5][-3 9][-4 9][-5 9][-6 9][-3 9]] let same true i trying remove list first sublist between 2 same elements [-2 6 ][-1 6][0 6][-1 6][-2 6] want remove sublist between other 2 same elements [-3 9][-4 9][-5 9][-6 9][-3 9] until there no more elements repeat in case result should [[1 5] [2 5]] , control list after removing sublists condition: if length xy = length remove-duplicates xy [ set same false ] i have done removal code below , removes first sublist might have lot of sublists , , want know how after 1 removal can again updated list (in these case should somehow take final-list in code) , control again these condition. thinking to-report procedure , while loop , example (maybe wrong this) to-report update-list [list] while [same != false ] [ ; removal stuff set list-xy item position (first modes xy) x

exception - android - No Activity found to handle intent action.VIEW -

i got exception in android app: 06-18 17:57:39.816 6333-6333/com.appsrox.instachat e/inputeventreceiver﹕ exception dispatching input event. 06-18 17:57:39.816 6333-6333/com.appsrox.instachat e/messagequeue-jni﹕ exception in messagequeue callback: handlereceivecallback 06-18 17:57:39.816 6333-6333/com.appsrox.instachat e/messagequeue-jni﹕ android.content.activitynotfoundexception: no activity found handle intent { act=android.intent.action.view dat=href (has extras) } @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1781) @ android.app.instrumentation.execstartactivity(instrumentation.java:1501) @ android.app.activity.startactivityforresult(activity.java:3745) @ android.app.activity.startactivityforresult(activity.java:3706) @ android.app.activity.startactivity(activity.java:4016) @ android.app.activity.startactivity(activity.java:3984) @ android.text.style.urlsp

web component - How to structure a Polymer SPA? -

i'm new polymer 1.0. i whole "everything element" philosophy but, extent? how structure theses elements together? tl;dr: there equivalent main() function polymer , webcomponents in general ? if , should , should ? i @ examples, demos , projects see how should work, because polymer new (especially v1.0), have hard time finding non-trivial examples. long version i how use polymer create elements. i'm hitting roadbloack when want interface them. structure shoud use make components talk between them. coming angular background have relatively precise view of should go where. example: data contained within scopes accessible controllers, directives , html elements , can use services pull data different part of app. in polymer don't boundaries of data. not in component outside of it, lives , if component can access it. simple drawing me lot. there no such thing explained in polymer docs, because it's broader polymer. to give insights on problem ca

asp.net - If x and y then construction -

in web app written in vb.net .net 4.0, using vs 2012, there line: serverport = cint(httpcontext.current.request.servervariables("server_port")) servername = httpcontext.current.request.servervariables("server_name") if serverport = nonsecureport , servername.contains("mywebsite.com") more code if both clauses true end if as turns out, nonsecureport = 8089 , in case serverport 80 think should means the app not execute code in if clause, serverport not equal nonsecureport. but in fact, watch code go right code , not understand why. asp.net app. published dev web server , debugging remotely. why happen?

android - Library resources with Robolectric 3 - JodaTime -

getting resourcenotfoundexception when using library robolectic 3.0-rc3. resource declared in build.gradle compile 'net.danlew:android.joda:2.8.0'. android port of joda-time. android.content.res.resources$notfoundexception: unable find resource id #0x7f0501da @ org.robolectric.shadows.shadowresources.checkresname(shadowresources.java:343) @ org.robolectric.shadows.shadowresources.getresname(shadowresources.java:333) @ org.robolectric.shadows.shadowresources.openrawresource(shadowresources.java:382) @ android.content.res.resources.openrawresource(resources.java) @ net.danlew.android.joda.resourcezoneinfoprovider.openresource(resourcezoneinfoprovider.java:120) @ net.danlew.android.joda.resourcezoneinfoprovider.<init>(resourcezoneinfoprovider.java:39) application class: @override public void oncreate() { super.oncreate(); jodatime.init(this); } my test class: @runwith(robolectricgradletestrunner.class) @config(constants = buildconfig.class,

android - How to use the string from editText as display textview in another activity? -

i want use string typed in edittext textview in new activity. sub6 = (edittext)findviewbyid(r.id.edittext16); txt6 = (textview)findviewbyid(r.id.textview25); subject = (string) sub6.gettext().tostring(); txt6.settext(getresources().getstring(r.id.edittext16)); i have used code. of no use. can please me? you can send string using bundle intent i=new intent(a.this, b.class); bundle b = new bundle(); b.putstring("name", sub6.gettext().tostring()); i.putextras(b); startactivity(i); and in receiving activity: bundle extras = getintent().getextras(); string text = extras.getstring("name");

mysql - How to Find Count After Join in SQLAlchemy -

i join multiple tables with: session.query(r, rr, rrr).join(r).join(rr).all() i tried: session.query(func.count(r, rr, rrr)).join(r).join(rr) however, not appear correct approach determining count tables. i len(session.query(r, rr, rrr).join(r).join(rr).all()) but ideally, won't have counts in memory. if after count(*) , below should work: q = (session .query(func.count().label("cnt")) .select_from(r) .join(rr) .join(rrr) ) r = q.scalar()