Posts

Showing posts from July, 2010

Android Facebook sdk 4.0 and Parse : get friends list after facebook login -

i using facebook sdk 4.0 , parse facebook login. after login, access user friends. here code: private static final list<string> permissions = arrays.aslist("email", "public_profile", "user_friends", "read_friendlists"); parsefacebookutils.loginwithreadpermissionsinbackground(mactivity,permissions, new logincallback() { @override public void done(parseuser user, parseexception err) { if (err != null || user == null) { log.e(tag, "facebookconnect", err); mactivity.onfacebookloginerror(failurereason.other); } else { } } }); ..... //this call made in thread... graphresponse meresponse = merequest.executeandwait(); if(meresponse.geterror() == null) { jsonobject jsonobject = meresponse.getjsonobject(); failurereason = updateparseuserdata(jsonobject); if (failurereason != null) { ret...

Eclipse c, chip family STM32F107RCT6 -

i confused select chip new eclipse project under chip family dropbox. there options low density low density value line medium density medium density value line high density high density value line 1 have select. low-density value line devices (ld_vl) stm32f100xx microcontrollers flash memory density ranges between 16 , 32 kbytes. medium-density value line devices (md_vl) stm32f100xx microcontrollers flash memory density ranges between 64 , 128 kbytes. high-density value line devices (hd_vl) stm32f100xx microcontrollers flash memory density ranges between 256 , 512 kbytes. low-density devices (ld) stm32f101xx, stm32f102xx , stm32f103xx microcontrollers flash memory density ranges between 16 , 32 kbytes. medium-density devices (md) stm32f101xx, stm32f102xx , stm32f103xx microcontrollers flash memory density ranges between 64 , 128 kbytes. high-density devices (hd) stm32f101xx , stm32f103xx microcontrollers flash memory density ranges between 256 , 512 kbytes...

stanford nlp - How to use standard pipeline (tokenize,ssplit,pos,lemma) with the new parsers? -

i have been using older version of stanford nlp, switch newest, coolest algorithms. looked @ demo of nn dependecy parser , don't know how integrate corenlp pipeline. i using jython code: props = properties() props.put("annotators","tokenize,ssplit,pos,lemma,parse") props.put("isonesentence",true) pipeline = stanfordcorenlp(props) but i'd use newer algorithms. possible current pipeline? if not, easy way rewrite this, produces same results without annotation pipeline? thanks in advance! pavel the annotator you're looking "depparse", not "parse". so, code like: props = properties() props.put("annotators","tokenize,ssplit,pos,lemma,depparse") props.put("isonesentence",true) pipeline = stanfordcorenlp(props) note no longer have constituency trees ( tree ) after this, dependency tree ( semanticgraph ).

Actors do not replicate when using sessions | Unreal engine 4.7.5 -

i have followed multiplayer shootout showcase ( https://docs.unrealengine.com/latest/int/resources/showcases/blueprintmultiplayer/index.html ) , tried replicate sessions part own project. can create (lan) session, see other sessions , join one. problem that, reason, correct map opens, actors not replicate. if open map, 2 players, replicate without issues. there else should enable replications when using sessions? thank you! after further testing program, gave me following error:lognet:warning: travel failure: [loadmapfailure]: failed load package '/game/maps/uedpie_2_arena2'. found out because testing game sessions inside editor. after tried testing in standalone game mode, working fine.

xml - jaxb - marshalled root element with full java package -

im working on project jaxb maven plugin. (maven 3.2.2, maven-jaxb2-plugin:0.8.1, java8) i use <bindingincludes> <bindinginclude>...</bindinginclude> </bindingincludes> for specifing package of generated classes and <generatedirectory>${project.build.directory}/generated-sources/xjc-dir </generatedirectory> for specifing output directory. im trying understand cause marshaller work in 2 different ways: actual: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <com.test.app.foo> ... </com.test.app.foo> expected: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <foo> ... </foo> full java package visible root element. thanks in advance edit: generated code package com.test.app; @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { (...) }) @xmlrootelement(name = "foo")...

regression - How to get the sum of least squares/error from polyfit in one dimension Python -

i want linear regression scatter plot using polyfit, , want residual see how linear regression is. unsure how isn't possible residual output value polyfit since 1 dimensional. code: p = np.polyfit(lengths, breadths, 1) m = p[0] b = p[1] yfit = np.polyval(p,lengths) newlengths = [] y in lengths: newlengths.append(y*m+b) ax.plot(lengths, newlengths, '-', color="#2c3e50") i saw stackoverflow answer used polyval - unsure of gives me. exact values lengths? should find error finding delta of each element polyval , 'breadth'? you can use keyword full=true when calling polyfit (see http://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html ) least-square error of fit: coefs, residual, _, _, _ = np.polyfit(lengths, breadths, 1, full=true) you can same answer doing: coefs = np.polyfit(lengths, breadths, 1) yfit = np.polyval(coefs,lengths) residual = np.sum((breadths-yfit)**2) or residual = np.std(breadths-yfit)**2 * len(b...

mysql - Processing a couple million records per table, the query seems t be working and optimized but takes a lengthy time for execution -

is there way change or optimize query spedd execution time? select max(u.phone_mobile) mobile_number ccr_prod.ccr_unique_member u inner join ccr_prod.ccr_member m on u.ccif = m.ccif , u.first_open_date = m.first_open_date m.source_id not in ('fpt', 'vlink') , u.phone_mobile not in ('', '0') , datediff(curdate(), u.first_open_date) > 120 group u.ccif the thing can suggest (move condition m table subquery , call needed field there): select max(u.phone_mobile) mobile_number ccr_prod.ccr_unique_member u inner join ( select ccif, first_open_date ccr_prod.ccr_member source_id not in ('fpt', 'vlink') ) m on u.ccif = m.ccif , u.first_open_date = m.first_open_date u.phone_mobile not in ('', '0') , datediff(curdate(), u.first_open_date) > 120 group u.ccif and if necessary optimize more, can try not find max limit 1 if f...

Django can't find user with 'python manage.py changepassword' -

i've got code (using python 3.4, django 1.7, , postgresql) pushed heroku. worked fine until added login. on local machine, used shell add user, create password, , save user/password. pattern worked locally, foreman. the setup seems have worked: heroku run python3 manage.py shell = user.objects.get(id=1) the server returns <user: {'username':'me'}>. asking a.password returns hashed password changes when a.set_password('blah') , a.save() . that's , normal, except username/password (unhashed) won't log me in. when run: heroku run python3 manage.py changepassword me heroku responds with: commanderror: user 'me' not exist how can user saved , retrievable in shell, implying it's in database, not found otherwise using "manage.py changepassword"? most importantly, how can log website on heroku? ****edit**** ran python manage.py createsuperuser in heroku shell create user log in. once did, saw none ...

CouchDB View - Filter by List Field Attribute (doc.objects.[0].attribute) -

i need create view lists values attribute of doc field. sample doc: { "_id": "003e5a9742e04ce7a6791aa845405c17", "title", "testdoc", "samples": [ { "confidence": "high", "handle": "joetest" } ] } example using doc, want view return values "handle" i found example heading - contents of object specific attributes e.g. doc.objects.[0].attribute. when fill in attribute name, e.g. "handle" , replace doc.objects doc.samples, no results: toggle line numbers // map function(doc) { (var idx in doc.objects) { emit(doc.objects[idx], attribute) } } that create array of key-value-pairs key alway value of handle . replace null value want e.g. doc.title . if want doc attached every row use query parameter ?include_docs=true while requesting view. // map function (doc) { var samples = doc.samples for(var = 0...

c++ - Why does this code end up in an infinite loop, reading from std::cin -

hi try create input function function through vector. however, don't know why input become infinite loop? do { cout << "please enter next number: "; cin >> num; number.push_back(num); cout << "do want end? enter 0 continue."; dec = null; cin >> dec; } while(dec == 0); "i don't know why input become infinite loop." the reason can imagine is, incorrect input sets cin fail state. in case (e.g. invalid number entered, or enter pressed) cin set fail state , value in dec won't change evermore. once cin in fail state subsequent input operations fail respectively, , subject input won't changed. to proof against such behavior, have clear() std::istream 's state, , read safe point, before proceeding (see also: how test whether stringstream operator>> has parsed bad type , skip it ): do { cout << "please enter next number: "; ...

jquery - How can I find and delete a script that is bottleneckng my website's load time? -

i ran 'pingdom' scan on website , noticed little script slowing down site. <script type="text/javascript"> if(!document.referrer || document.referrer == '') { document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.min.js"></scr'+'ipt>'); } else { document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.js"></scr'+'ipt>'); } it's adding 6 seconds sites loading time. how can rid of it? i tried searching in of common wordpress files, wasn't able find script anywhere. see pingdom test more information. i'd had trouble script too. think i've fixed me @ least. i'm programming wordpress site , saw script blocking page load. well, couldn't find script , suspected maybe script called script or else. step step discovered code included in web footer. tes...

Append index of items in one list to another in Python 2.7 -

master =[23,5, 6, 34,11] list_check = [23, 6, 11] ideal output be: location = [0, 2, 4 ] values in list_check in master. neglect duplication. getting desired output particular lists have given easy list comprehension, can see other answers here, but, said wanted neglect duplication. know of no way list comprehension. example, using 1 of list comprehensions suggested here duplicate element in master >>> master =[23,5, 6, 34, 11, 23] >>> list_check = [23, 6, 11] >>> [master.index(item) item in master if item in list_check] [0, 2, 4, 0] using suggestion: >>> location = [x x, y in enumerate(master) if y in list_check] [0, 2, 4, 5] if understand question correctly, want result same no matter how many times element appears in master . example, master =[23,5, 6, 34, 11, 23, 23, 11, 6] list_check = [23, 6, 11] output location = [0, 2, 4] i way: master =[23, 5, 6, 34, 11, 23, 23, 11, 6] list_check = [23, 6, 11] locatio...

Regex activate multi line in php -

this question has answer here: php preg_replace regex matches multiple lines 2 answers please tell me how activate multi line functionality..and explain me how work. (?m) or /m ? $subject = "the brown fox jump bla on lazy dog ..bla bla bla"; $matching = preg_match_all($regex1, $subject, $m); $regex1 = '(?m)/^bla$\b/i'; print_r($m); what use , where? ...(?m) or /m ? what use , where? ...(?m) or /m you can use either of them cannot use \b (word boundary) after anchor $ . use: $regex1 = '/^bla$/im'; $subject = "the brown fox jump bla on lazy dog ..bla bla bla"; preg_match_all($regex1, $subject, $m); print_r($m); and need declare regex before can use it. however none of lines have text bla hence regex fail match anything. looking @ examples may need: $regex1 = '/\bbla$/im'; which match line ...

Trying to create login page using PHP and SQL -

i've been working on website login, , far, have database , register page set up, i'm trying work on login page. i've been trying retrieve data database's table. successfull @ doing on register page make sure there aren't multiple usernames of same name, copied of code , pasted onto page. problem: returns blank. please help... ._. ` khs sitespace <div id="header"> <a href="index.php"><img src="./images/khslogo2.png" style="margin-left:4;float:left;" width="100" hieght="100"></a> <b>khs<span id="name">sitespace</span></a> <!--img src="./images/menu.png" style="float:right;margin-right:6;" height="100" width="90"--> </div> <div id="content"> <p id="subtitle">login</p...

c# - Focus textbox and position cursor on page load -

so want set cursor position end of textbox after page loaded. have code jquery: <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script src="https://rawgit.com/ichord/caret.js/master/src/jquery.caret.js"></script> <script type="text/javascript"> $(document).ready(function () { var textbox = $('#messagesbox'); textbox.focus(); textbox.caret('pos', textbox.val().length); }); </script> <asp:textbox id="messagesbox" runat="server" textmode="multiline" style="resize:none" readonly="true" width="300" height="200"></asp:textbox> what missing? need set in code-behing well? try : $(document).ready(function(){ var el = $("#messagesbox"); var elemlen = el.value.length; el.selectionstart = elemlen; el.selection...

java - retrieval of duplicate keys in hashmap -

since duplicate key overrides previous key , corresponding value in hashmap. if call get() method , provide previous key argument, returns overriden value. how possible since key overriden new key should throw exception. //this class used key class mapkey { public boolean equlas( object o) { return true; } } //this test class class maptest { public static void main(string a[]) { map m=new hashmap<mapkey, string>(); mapkey mk1=new mapkey(); m.put(mk1,"one"); mapkey mk2=new mapkey(); m.put(mk2,"two"); mapkey mk3=new mapkey(); m.put(mk3,"three"); system.out.println(m.get(mk1)); system.out.println(m.get(mk2)); } } output: 3 three since keys equal should overriden last key object mk3. how possible retrieve value first or second key object? thnks in advance this because have not overrided hashcode method. in equals method have declared objects equal. due default hashcode...

python - mayavi 3d object in matplotlib Axes3D -

i find myself frustrated lack of rendering features in matplotlib's mplot3d. in of these cases, find can want in mayavi, still matplotlib 3d axes preferable, if aesthetics, latex-ified labels , visual consistency other figures. my question here obvious hack: possible draw 3d object (a surface or 3d scatter plot or whatever) in mayavi without axes, export image, place in matplotlib axes3d of correct size, orientation, coordinate projection, etc.? can think of outline of needed accomplish this, or perhaps offer skeleton solution? i fiddled around time ago , found had no trouble in exporting transparent background mayavi figure , placing in empty matplotlib axes3d (with ticks, labels, , on), didn't far in getting camera configurations of mayavi , matplotlib match. setting 3 common parameters of azimuth, elevation, , distance equal in both environments didn't trick; presumably what's needed consideration of perspective (or other) transformations going on render whol...

ios - objective-c how to us NSURLSession with AFNetworking -

i have code here logins me url, issue when try remove creds not working, found solution online: http://www.ciiycode.com/0yhhmexwguqq/using-nsurlcredentialpersistenceforsession-while-request-and-then-clearing-the-credentials-on-logout-still-persist-the-cerdentials if you're using nsurlsession, invalidate session , create new one, e.g.: [self.session invalidateandcancel]; self.session = [nsurlsession sessionwithconfiguration:[nsurlsessionconfiguration defaultsessionconfiguration] delegate:self delegatequeue:nil]; clear session-scoped credentials. so question is, can use nsurlsession afnetworking: nsurl *url = [nsurl urlwithstring:kip]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; nsurlcredential *credential = [nsurlcredential credentialwithuser:user ...

order - Notification for user in user account opencart -

thanks helps or points me in right direction. i want show pending notification user in account page after login. notification show when order status pending. after changing other status admin remove notification. this notification show like: your order id: order status: , [ button custom url] if multiple order show multiple order id. open cart version 1.5.6.3 custom theme. $this->load->model('account/order'); $results = $this->model_account_order->getorders(); foreach ($results $result) { $product_total = $this->model_account_order->gettotalorderproductsbyorderid($result['order_id']); $voucher_total = $this->model_account_order->gettotalordervouchersbyorderid($result['order_id']); if( $result['status'] =! 5){ // 5 order status means completed $this->data['orders'][] = array( 'order_id' => $result['order_id'], ...

hex - The default is 50% if you pass a 24-bit color: 0x0000ff (50% opacity, blue) -

rendering polygon google static maps api url the default 50% if pass 24-bit color: 0x0000ff (50% opacity, blue) and make 100% shows: 0% opacity: path=color:0x0000ff00 straight link. question simple : how make 24bit color 100% transparent? if had #898989? or #e20fe8? or other random color? as said in answer, , in documentation links to. when 32-bit hex value specified, last 2 characters specify 8-bit alpha transparency value. value varies between 00 (completely transparent) , ff (completely opaque). note transparencies supported in paths, though not supported markers. ( https://developers.google.com/maps/documentation/staticmaps/#pathstyles ) the last byte (two hex digits) indicates transparency in 1/255ths. when not given, defaults 50%. so set color 100% opacity, add ff @ end.

Matlab source control with Git 'Method not implemented.' errors -

yesterday set source control in matlab using git following guide here @ mathworks blog. seemed work , able connect remote repo. i can commit changes local repo today when try push or fetch remote repo, source control > push or source control > fetch error dialog saying method not implemented. i tried running command !git fetch matlab command line , got fatal: unable access ' https://github.com/user/repo.git/ ': protocol https not supported or disabled in libcurl from reading, i've discovered because curl packaged matlab not support https, system curl created alias system curl in matlab folder, , !git fetch command works. but trying push / fetch through ui still not... i @ moment unable setup source control in other folders when trying validate path git repository invalid path: https://github.com/azureuse/photon-pistol.git method not implemented. but did work yesterday... any ideas i'm doing wrong? appears me flakey i...

Selenium Webdriver / Ruby : assert times out -

i have line hitting drop down menu , asserting list option present. if list item not present output text " list item not present" instead, ends waiting ever , timing out entirely. assert{ displayed?(:xpath, "//li[text() = 'clinical review feedback type']") } thanks help. i think maybe i've got it: begin @driver.find_element(:xpath, "//*[text() = 'clinical review feedback type']").click rescue => e p e.message puts "filter not found in list" end if want print "list item not present", should apply exception handling in code. in way if element not present catch block print message in console

internet explorer 10 - selenium-webdriver issues triggering hover via move_to_element on ie10 -

i'm using remote webdriver test different configurations on saucelabs. 1 of pages has ajax function loads extended form section. load triggered either blur of particular form element, or if hovers on .form-actions div. i'm trying re-create behaviour through webdriver. the following behaves expected on ie9 , chrome (the second part of form loads), stops working on ie10: nxt_btn = self.sel.find_element_by_css_selector( next_btn_selector) actionchains(self.sel).move_to_element(nxt_btn).perform() self.wait_until_visible('input[name="next_to_load"]') the form expands correctly if bring ie10 browser , move mouse in manual testing, seems it's remove webdriver isn't triggering either 'blur' of input or 'hover' on form-actions div. is there way can change either webdriver test code or site make work ie10? when ran tests on ie (ie11, in case), hovering worked fine (locally) code hover = actionchains(s...

python - django postgres could not connect to server -

hi im working on django project virtualenv using following django==1.7.6 argparse==1.2.1 psycopg2==2.6 wsgiref==0.1.2 but when try python manage.py runserver gives me error performing system checks... system check identified no issues (0 silenced). unhandled exception in thread started <function wrapper @ 0x7f0574e8c0c8> traceback (most recent call last): file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper fn(*args, **kwargs) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run self.check_migrations() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations executor = migrationexecutor(connections[default_db_alias]) file "/home/marashen/....

c++ - Cgroup usage to limit resources -

my goal: provide user way limit resources cpu, memory given process (c++). so suggested me utilize cgroups looks ideal utility. after doing research have concern: when utilize memory.limit_in_bytes limit memory usage given process, there way handle out of memory exception in process? see control groups provide parameter called "memory.oom_control" when enabled, kills process requesting more memory allowed. when disabled pauses process. i want way let process know requesting more memory expected , should throw out of memory exception. process gracefully exits. does cgroups provide such kind of behaviour? also cgroup available in flavour of linux? interested in rhel 5+, centos 6+ , ubuntu 12+ machines. any appreciated. thanks i want way let process know requesting more memory expected , should throw out of memory exception. process gracefully exits. does cgroups provide such kind of behaviour? all processes in recent releases run inside ...

Adding an Antlr4 parse tree to another Antlr4 parse tree -

i need implement generics antlr4. in order this, need able take class and, used, dynamically generate code macro, tokenize code, generate tree, , add new tree original parse tree. i saw these 2 classes http://www.antlr.org/api/javatool/org/antlr/v4/runtime/rulecontext.html http://www.antlr.org/api/javatool/org/antlr/v4/runtime/parserrulecontext.html however, i'm not sure do, nor sure how use constructor. parserrulecontext(parserrulecontext parent, int invokingstatenumber) rulecontext(rulecontext parent, int invokingstate) specifically, these classes represent new tree, , should pass invokingstate/invokingstatenumber? apparently easy this when walking first tree, correctly displays information both files. public class program { private static parserrulecontext gettree(string file) throws exception { inputstream input = new fileinputstream(file); reader reader = new inputstreamreade...

node.js - Using 'async' and neglecting to invoke 'callback' -

i'm relatively new node.js, wondering how make asynchronous code more reliable. focusing on code uses 'async' (no promises yet, due legacy reasons). one of reliability concerns failing invoke callbacks. e.g. async.series([ function(callback){ if(..) console.log("invalid input, try again"); // bug: no callback! else callback(null, 'ok'); }, function(callback){ ... } ], function(err,result){ handleerrororresult(err,result);} // might not reached ); this code may never complete (never reach 'handleerrororresult') , won't know went wrong. since pit easy fall into, wonder whether there ready-made library solutions it? ideas welcome, 1 direction might timeouts: invoke error handler if whole thing isn't completed within, say, 5 minutes. thanks much make own wrapper implements timeout. var myasync = { series: function (callbacks, ti...

javascript - Cordova and Facebook login - Using Passport on Server Side? -

i'm building app cordova , i'd use node/express backend. my question concerns authentication. passport , i'd continue use passport, i'm bit confused how register users using facebook's javascript sdk. i success object javascript sdk: { status: "connected", authresponse: { session_key: true, accesstoken: "<long string>", expiresin: 5183979, sig: "...", secret: "...", userid: "634565435" } } i'm thinking of posting access token api endpoint, , having server retrieve user information using graph api. is appropriate way approach this? there more dignified/foolproof ways of implementing facebook login cordova , node/express?

Eugene Myers' Diff Algorithm: Finding the Longest Common Subsequence of "A" and "B" -

i've been reviewing eugene myers' diff algorithm paper . algorithm implemented in popular diff program. on page 12 of paper, presents pseudo-code algorithm find longest common sub-sequence of a , b : lcs(a, n, b, m) if n > 0 , m > 0 find middle snake , length of optimal path , b. suppose (x, y) (u, v). if d > 1 lcs(a[1..x], x, b[1..y], y) output a[x+1..u] lcs(a[u+1..n], n-u, b[v+1..m], m-v) else if m > n output a[1..n]. else output b[1..m]. suppose = "a" , b = "b". in case, n = 1 , m = 1. middle snake (x, y) = (0, 1) , (u, v) = (0, 1) because there no diagonals. in case d = 1 because algorithm has taken 1 step. the algorithm says thing in scenario output b[1..m] , equal "b", because n > 0, m > 0, d = 1, , m = n. seems wrong, because there no common sub-sequence between "a" , "b". paper's com...

jquery - Add a div in another div by id? -

i have created div: <div id="mainbox"></div> <div id="div1" style="display:none;">lorem ipsum...</div> now want add div 'div1' in div 'mainbox': $("#mainbox).append("#div1"). but doesn't work want, instead prints text #div1 try this: $("#mainbox").append($("#div1")) with this, selecting #div1, way did it, appending string. please note div hidden, try also: $("#div1").show();

java - Could not initialize proxy - no Session spring boot and javafx -

i'm using spring boot , javafx. yesterday found https://github.com/thomasdarimont/spring-labs/tree/master/spring-boot-javafx , add spring jpa pom.xml , configuration application.properties. pom <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-jdbc</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-sta...

mysql - Posts, comments and advanced sql filtering -

i have database table of posts. have db table comments, column comment_id (ai) , column post_id it's attached to. i want make query list of posts once , sorted last posted comment. the problem can't figure out sql query it. whatever try comments listed too. i'm skilled or experienced mysql, tried using different "joins". there way it? select distinct p.* posts p, comments c p.post_id = c.post_id order c.time desc i assumed relational schema. might need adapt query. alternative: create view last_comment_time field. create view posts (select *, (select time comments post_id = p.post_id order time desc limit 1) last_comment_time posts p);

java - I am having formatting issues -

Image
i want program format nicely but, formats like: i have 2 classes, 1 of them getter 1 (item), , majority of code in 1 (testitem) this tostring method in getter file public string tostring() { return " " + itemid + "\t" + itemname + "\t" + instore + "\t" + "$" + df.format(price);//string.format("$%,1.2f", price) +"\n" ; } and in testmovie, thses important methods: public static void main (string [] args) { item[] hardware = new item[6]; hardware[0]=new item(1011,"air filters",200,10.5); hardware[1]=new item(1034,"door knobs",60,21.5); hardware[2]=new item(1101,"hammers",90,9.99); hardware[3]=new item(1600,"levels",80,19.99); hardware[4]=new item(1500,"ceiling fans",100,59); hardware[5]=new item(1201,"wrench sets",55,80); system.out.println("original arr...

c++ - how to make MPI_Send have processors send in order instead of randomly? -

i trying run program below uses parallel programming. if use 4 processors, want them contain sums 1+2=3, 3+4=7, 11, , 15. want sumvector contain 3, 7, 11, , 15, in order. however, since mpi_send has processors sending in random order, don't sumvector contain, say, 7, 15, 3, 11. how can modify code below ensure this? #include<iostream> #include<mpi.h> using namespace std; int main(int argc, char *argv[]){ int mynode, totalnodes; int sum,startval,endval,accum; mpi_status status; int master=3; mpi_init(&argc,&argv); mpi_comm_size(mpi_comm_world, &totalnodes); // totalnodes mpi_comm_rank(mpi_comm_world, &mynode); // mynode sum = 0; // 0 sum accumulation vector <int> sumvector; startval = 8*mynode/totalnodes+1; endval = 8*(mynode+1)/totalnodes; for(int i=startval;i<=endval;i=i+1) sum=sum+i; sumvector.push_back(sum); if(mynode!=master) { mpi_send(&sum,1,...

java - Annotating swagger models (@ApiModelProperty) and apis/resources in different binaries/packages -

is annotating data models in different library/package , apis in different package supported? has 1 tried this? there shouldn't problem long loaded within scope of single classloader. scanning done on that's reachable.

Get information from an HTML tag and pass it to PHP -

so here thing. need to call php page link ( <a href='name.php'> ) access database , print information specific links. think code more clear question: <?php session_start(); //start session capture usrname processlogin.php $usrname=$_session['usrname']; $query = "select est_name students usrname=".$usrname."; $result = $db->query($query); while( $row = mysqli_fetch_array(($result))) { echo "<a href="showprofile.php">".$row['est_name']."</a>"; //i need click here , show information in database //for specific student } ?> my question is: there way name specific link can use information want specific student? change link tag provide id in query parameters. echo "<a href=\"showprofile.php?id={$row['id']}\">{$row[...

java - Print all the values of the List except the last one. -

i have code: list<integer> list1 = new arraylist<integer>(); list1.add(100); list1.add(200); list1.add(300); list1.add(400); list1.add(500); list1.add(600); integer lastelement = list1.get(list1.size()-1); system.out.println("values of list:" + list1-lastelement); !!! the values of list should be: 100, 200, 300, 400, 500. , list1-lastelement gives me error! there other way it? what trying subtract value 600 (the last value of arraylist) length of arraylist. makes no sense. instead try following (if trying print last element): for (int = 0; < list1.size() - 1; i++) { system.out.println(list1.get(i)); } what print last element. hence list1.size() - 1

Regex to retrieve token from page source -

what regex retrieve value of "token" attribute following json fragment? 259,"possible_flags":["recommending","looking-for"],"id":297,"organisations":[],"showwarning":false,"token":"bf311e7a1a4e49846c0fb836934e7685610829d0","intention":"neighbourhood-nearby"... i want match bf311e7a1a4e49846c0fb836934e7685610829d0 . this code give full text including "token":"___" ("token":"[a-z0-9]*") this give token: "token":("[a-z0-9]*")

postgresql - Rename nextval('...') in Postgres -

i had table called pivot_device_user , had sequence on id not null default nextval('pivot_device_user_id_seq'::regclass) . then decided rename table pivot_box_user , nextval(...) still nextval('pivot_device_user_id_seq'::regclass) . i'd change nextval('pivot_box_user_id_seq'::regclass) . how do this? first must understand serial is: safely , cleanly rename tables use serial primary key columns in postgres? auto increment sql function the column default not stored text literal. see human-readable text representation: nextval('pivot_device_user_id_seq'::regclass) 'pivot_device_user_id_seq'::regclass resolved oid internally ( regclass precise) - oid of underlying sequence - , that's what's stored (early binding). if rename sequence, oid remains unchanged. need rename sequence : alter sequence pivot_device_user_id_seq rename pivot_box_user_id_seq; check success with: select pg_get_serial_sequence(...

java - POJO with list of POJO to JSON display size and index -

so i've got 2 pojos: public class requestdisplayinfo { private int nombrepersonne; private string courrielorganisateur; private requeststatus statutdemande; private string salleassigne; getters/setters..... and public class requestsdisplayinfo { private list<requestdisplayinfo> acceptees = new arraylist<requestdisplayinfo>(); private list<requestdisplayinfo> autres = new arraylist<requestdisplayinfo>(); getters/setters..... when return second class, : { - acceptees: [1] 0: { organizeremail: "org" participants: 45 requeststatus: "accepted" roomname: "plt-2828" } - autres: [2] -0: { organizeremail: "org" participants: 2 requeststatus: "waiting" } -1: { organizeremail: ...

php - Fatal error: Uncaught exception 'ReflectionException' -

i got similar error ( uncaught exception 'reflectionexception' ) when running php codes. had no luck fix yet. uncaught exception 'reflectionexception' message 'class path.base not exist' in /home/localblu/staging/vendor/laravel/framework/src/illuminate/container/container.php:504 stack trace: #0 /home/localblu/staging/vendor/laravel/framework/src/illuminate/container/container.php(504): reflectionclass->__construct('path.base') #1 /home/localblu/staging/vendor/laravel/framework/src/illuminate/container/container.php(428): illuminate\container\container->build('path.base', array) #2 /home/localblu/staging/vendor/laravel/framework/src/illuminate/foundation/application.php(462): illuminate\container\container->make('path.base', array) #3 /home/localblu/staging/vendor/laravel/framework/src/illuminate/container/container.php(806): illuminate\foundation\application->make('path.base') #4 /home/localblu/staging/b...

c# - Visual Studio Store Apps -

so i've begun learning c# man's video series. right have visual studio 2013 (community edition), , in video he's using subcategory called "store apps." problem in current version of visual studio i'm using, doesn't acquire subcategory. anyway on how may obtain it? thank help. regards, saroekin. you'll need have windows phone 8.1 sdk installed suggested, , make sure have visual studio update 2 installed. comment video description: note: before started, make sure have visual studio 2013 update 2 installed, include windows phone 8.1 tooling, talked in previous lesson. if have installed, we're ready move forward.

html - Centering multiple <p> tags within in a div -

i have several different sections in i'm trying center set of tabs. 1 set of tabs i've tried put in unordered list , other set i've tried several <p> tags within <div> nothing seems working. know others have had problem haven't been able find apologize if repetitive question. i've tried <position: absolute> , <display: inline> , , others. can't seem it. in advance! also, they're not supposed functioning tabs @ moment because don't want have worry jquery right now, supposed them! html <!doctype html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/default.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/script.js"></script> <title>starship chronicles</title> </head> <body...

ios - uitextfield is not convertible to uint8 -

im trying button output numbers onto textfield keep getting error this code, amountoutput 1 error @ibaction func output(sender: anyobject) { yieldoutput.text = string (format:"%.2f", yield[1] ) amountoutput.text = double (typeamount * (yieldoutput / 100)) + unit } yieldoutput in code isn't number, it's text field. means use value in it, need transform number or use variable holds value. in case, yield[1] variable use set value yieldoutput . do: amountoutput.text = double (typeamount * (yield[1] / 100)) + unit

ruby - Using ActiveAdmin in Rails to create user specific admin pages -

to explain in sentence, asking if possible use activeadmin gem create admin pages specific admin users, i.e. each admin user gets see models , associating models specific him. if so, how implement this? to further explain situation, have model called sponsor(who admin users), , put different offers(another model belongs sponsor) users redeem. trying create admin page each sponsor gets own admin credentials, , admin page shows information relates sponsor, i.e. information regarding offers sponsor put up, , relating models , details. possible implement using activeadmin gem or other gems matter? i rather not implement scratch if there gems out there use. suggestions? i haven't tried myself should achievable in activeadmin either changing default scope on per controller basis or using authorizationadapter .

jQuery ScrollTo plugin - horizontal scrolling -

i hope appropriate question post here. it's more theory question rather specific coding problem. i'm using scrollto plugin ariel flesler create horizontal scrolling webpage. good, i've managed download working demo tutorial site ... except don't understand theory behind horizontal scrolling. in particular, of tutorials i've come across (as answers here on stackoverflow) suggest creating html wrapper element seems act 'viewport' , scrolling content within wrapper (nested tags example) using scrollto plugin. why can't position tags off-screen (say, 3000px right) , use scrollto horizontally scroll these tags? i tried , works can't achieve smooth scroll easing (see code below). would appreciate if give me insight this. <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>scrollto test</title> <style> #box { width:100...

asp.net - Azure Website doesn't recognize my Database's Table after changing the Schema -

i have microsoft azure website running , working azure sql database sole purpose of storing , retrieving user accounts. needed mobile client there fore according numerous tutorials online such this , had change 'schema' of database's table 'dbo' mobile service's name 'usermobileservice'. this done using sql query: create schema usermobileservice; alter schema usermobileservicetransfer dbo.usertable; this did trick , able connect database using mobile applications can't access database using azure website! gives me error: server error in '/' application. invalid object name 'usertable'. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.data.sqlclient.sqlexception: invalid object name 'usertable'. i believe asp.net web application cannot find database table anymore since changed sche...

Send data from android app to PHP server -

here android code executes debugged , says data sent. public void postregistrationdata(final string result) { // create new httpclient , post header thread thread = new thread(new runnable(){ @override public void run() { try { try { url url; httpurlconnection urlconn; url = new url ("http://192.168.*.**/server/mypage.php"); urlconn = (httpurlconnection)url.openconnection(); urlconn.setdoinput (true); urlconn.setdooutput (true); urlconn.setusecaches (false); urlconn.setrequestproperty("content-type","application/json"); urlconn.setrequestproperty("accept", "application/json"); urlconn.setrequestmethod("post...