Posts

Showing posts from April, 2014

gcc - Got Junk Error Message from assembler while Compiling Trilinos Source Code -

i compiling trilinos source code , got error complains junk parts. kernel version 3.13.0 , g++ version 4.8.2. running on x86_64 machine. error message looks this: scalar_field.s:24649: error: junk `@104.5037' after expression the command run is cd /home/shuang/trilinos-12.0.1-source/my_build/packages/fortrilinos/example/adt_3d_burgers_6th_pade && /usr/bin/gfortran -ffree-line-length-none -g -i/home/shuang/trilinos-12.0.1-source/my_build -i/home/shuang/trilinos-12.0.1-source/packages/fortrilinos/src/epetra -i/home/shuang/trilinos-12.0.1-source/packages/fortrilinos/src/teuchos -i/home/shuang/trilinos-12.0.1-source/packages/fortrilinos/src/amesos -i/home/shuang/trilinos-12.0.1-source/packages/fortrilinos/src/aztecoo -i/home/shuang/trilinos-12.0.1-source/packages/fortrilinos/src/galeri -i/home/shuang/trilinos-12.0.1-source/packages/fortrilinos/src/ifpack -i/home/shuang/trilinos-12.0.1-source/packages/fortrilinos/src/pliris -i/home/shuang/trilinos-12.0.1-source -i/ho...

ms access - Get all the multiple transactions on the last date of each account in sql -

any appreciated. have table fields "salesmanid", "transdate", "brand", "quantity" , "total". want all transactions of particular salesman last date. sample: |transaction date | salesmanid | brand | quantity | total | 6/3/2015 101 le123 2 1000 6/3/2015 101 go123 1 500 i have code give me all transactions of salesman including previous dates. select max(transdate) [transaction date], brand, quantity, total dailysalesreport salesmanid = ? group brand, quantity, total sample: |transaction date | salesmanid | brand | quantity | total | 6/3/2015 101 le123 2 1000 6/3/2015 101 go123 1 500 6/2/2015 101 mn12 5 2000 i need transactions of 1 salesman on last date. thanks. you need specify max transaction date in clause. select transdate [transaction date], br...

python - how to print out fibonacci in this format? -

function name: p​rintfibonacci()​ job write function takes in 2 parameters , prints out fibonacci sequence (in same line, separated commas!) using parameters. fibonacci sequence produced adding 2 preceding numbers produce next integer. 2 parameters user inputs first 2 numbers add start sequence. function should stop when last number printed more 300. remember, numbers must printed in same line commas separating them. it's okay if output wraps around new line. key print single string. don't need print parameters part of output. can assume user input @ least 1 non­zero parameter. it should this: >>> printfibonacci(1,9) 10,19,29,48,77,125,202,327 >>> printfibonacci(2,3) 5,8,13,21,34,55,89,144,233,377 python>>> printfibonacci(1,1) 2,3,5,8,13,21,34,55,89,144,233,377 so far have this def printfibonacci(a,b): count = 0 max_count = 10 while count < max_count: count = count + 1 old_a = old_b = b = o...

php - how to fetch database value in ajax each 5 seconds -

i created function sum database records using mvc. need fetch values each 5 seconds. values updated time couldn't fetch latest value (the updated value), value when page loaded. finish: need use external file sum. function totalcosern(){ $getvalores = $this->db->select("select cosern planilha"); $acc = array_shift($getvalores); foreach ($getvalores $val) { foreach ($val $key => $val) { $acc[$key] += $val; } } return $acc; print_r($acc)//print sum } put ajax call in function , use setinterval execute function every 5 seconds , append response in content div. (function polling() { $.post('total.php', function(data) { $('#content').append(data); settimeout(polling, 1000); }); })();

javascript - KendoUI Grid Handle click events for Column Headers -

im wanting hook mouse down (both left , right click) event on click of grid column headers in kendoui grid object. wondering if has ideas on how go this? you use mousedown event: $(document).on("mousedown", " .k-header", function(e){ var fieldname = $(this).data("field"); switch (e.which) { case 1: alert('left mouse button pressed. field = ' + fieldname); break; case 2: alert('middle mouse button pressed. field = ' + fieldname); break; case 3: alert('right mouse button pressed. field = ' + fieldname); break; } }); the kendo ui grid assigns class of k-header header cells , field name stored in data-attribute (data-field=""). demo

JHipster Installation Error: Cannot launch the app -

everything unto mvn spring-boot:run fine. build showing success i'm getting these exceptions. how can them fixed? ideas? myapplication whitedev$ mvn spring-boot:run [info] scanning projects... [info] [info] ------------------------------------------------------------------------ [info] building shoppingcart 0.0.1-snapshot [info] ------------------------------------------------------------------------ [info] [info] >>> spring-boot-maven-plugin:1.2.3.release:run (default-cli) @ shoppingcart >>> u[info] [info] --- maven-enforcer-plugin:1.3.1:enforce (enforce-versions) @ shoppingcart --- [info] [info] --- yeoman-maven-plugin:0.4:build (run-grunt) @ shoppingcart --- [info] node version : uv0.10.29 [info] npm version : 2.0.0-alpha-5 [info] -------------------------------------- [info] npm install [info] -------------------------------------- npm warn package.json karma-chrome-la...

DerbyJS get model as array -

i want able collection array can in template use {{each}} on it. it collection of users, objects, {{each}} doesn't work objects specifically, can call model.filter() null function, , create list out of items in input object. can handy way render subscribed items in collection, since arrays can used input {{each}} template tags. var filter = model.filter( model.scope('pants'), null); filter.ref('_page.pantsarray'); here link more details on how use filters in derby documentation: http://derbyjs.com/docs/derby-0.6/models/filters-and-sorts

java - Using Spring, return view on success, plain text String on fail -

i have spring controller , returns string interpreted jsp view. if method fails, return plain text string fail message (as if using @responsebody annotation). is possible? need presence of @responsebody dynamic.

c++ - SDL UpdateWindowSurface() returns -1 if called from a class (in separate file) -

today started c++/sdl2 snake clone, , i've been looking ways make code neater, -particularly classes. tried put sdl code used window/display in class. when run code, the window closes instantly . error tests set in display.cpp, tells me through console sdl_updatewindowsurface() (in display.update()) returning -1. why happen when rearrange code this? with code load image in main() , display through class' function applysurface(). idea have classes/objects game's grid/board, snake, etc., -each calling applysurface() own images. feel free tell me if bad idea altogether. main.cpp: #include <sdl.h> #include "display.h" sdl_event event; sdl_surface* image = nullptr; int main(int argc, char* args[]) { display display; display.loadimage("image.bmp"); if (sdl_init(sdl_init_everything) == -1) return false; bool quit = false; while (!quit) { while (sdl_pollevent(&event)) { if (even...

c++builder - getting menu event in activeX object from inserted menu item -

i inserting menu items activex control container using ::insertmenu(...). insertion works , menu item shows not receive events (even though have event handler onclick()). of course because event going container , not control. there way in c++builder capture event? container ignores since not know how handle menu event itself, pass onto container, if so, how can grab it?

javascript - Object.create works new() doesn't -

having this: sillyobject = { init: function init(sillysettings) { name = sillysettings.name } }; sillyobject.showalert = function(x) { return alert(x); }; when run code: var sillyvar = new sillyobject() sillyvar.init(mysettings); silly.showalert("silly!"); i error instead if run same thing using object.create runs.. var sillyvar = object.create(sillyobject); sillyvar.init(mysettings); silly.showalert("silly!"); any (silly) appreciated. new , object.create 2 fundamentally different things. new going expect followed function, , if not (as saw) give error. because new expects call constructor function , use basis new execution context. during context, function has this bound scope of execution context. once function done executing returns this value has had data attached it. in example, this: function sillyobject() {} sillyobject.prototype.init = function(sillysettings) { //perhaps wanted attach name sillyobject...

php - Why will some pages having the same footer include links redirect different? -

basically i've got pages header , footer include, linking other pages on main level folder "2015website". inside 2015website folder folder titled "pick_style". in folder page has same exact includes pages on main folder level, except redirects differently. add "2015website" each link in url. now if change header , footer include links , delete 2015website folder in link's source, fix page, breaks on main level pages. i'm using php if has it. don't know why it's doing that. need help!

php - How to create a join table record -

so i'm trying add record join table, doesn't seem work, no errors given either. so here's data array (which saves correctly without problem) array(3) { ["id"]=> string(2) "32" ["title"]=> string(5) "hello" ["participant"]=> array(1) { [0]=> array(1) { ["id"]=> int(1) } } } my belongs many: $this->belongstomany('participants', [ 'foreignkey' => 'item_id', 'targetforeignkey' => 'participant_id', 'classname' => 'users', 'jointable' => 'participants_items' ]); belongs many in users: $this->belongstomany('myitems', [ 'foreignkey' => 'participant_id', 'targetforeignkey' => 'item_id', 'classname' => 'items', ...

ios - Show GameCenter login later if user dismisses login screen at start of game? -

we present gamecenter login screen upon game's launch. @ end of game, show gamecenter button lets users view achievements , game's leaderboards. if dismissed original screen , aren't logged in, how can present login screen again? here's code we're using, it's not working. override func viewdidload() { super.viewdidload() // configure view let skview = view as! skview skview.multipletouchenabled = false //skview.showsnodecount = true //skview.showsfps = true // show intro scene let introscene = introscene(size: skview.bounds.size, controller: self) introscene.scalemode = .aspectfill skview.presentscene(introscene) // authenticate gamecenter player authenticategamecenterplayer() } private func authenticategamecenterplayer() { var localplayer = gklocalplayer.localplayer() localplayer.authenticatehandler = {(viewcontroller : uiviewcontroller!, error : nserror!) -> void in if ((viewcontro...

spring mvc - Use of sec:authorize to load javascript -

i'm making development using spring mvc , thymeleaf. i'm trying use sec:authorize load javascript. in other words, want script load when user authenticated. here code i'm trying work: <script src="/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script> <script src="/js/submit.js" th:src="@{/js/submit.js}"></script> <script src="/js/url.js" th:src="@{/js/url.js}"></script> <!-- admin --> <script sec:authorize="isauthenticated()" src="/js/jquery.simplemodal-1.4.4.js" th:src="@{/js/jquery.simplemodal-1.4.4.js}"></script> <script sec:authorize="isauthenticated()" src="/js/admin.js" th:src="@{/js/admin.js}"></script> these last 2 resources i'm trying use sec:authorize load seem handle every time load ...

html - How to "link_to" full path in rails 4? -

this code have <a <%= link_to "open box", gig_path(@gig), class: "mcnbutton", target: "_blank", style: "font-weight: bold;letter-spacing: 0px;line-height: 100%;text-align: center;text-decoration: none;color: #ffffff;"%></a> from above <%= link_to "open box", gig_path(@gig) note gig_path(@gig) gives me url http://gigs/3 ,and works well,it found gig need id:3 problem doesn't provide full url this http://example.com/gigs/3 p.s. reference can @gig.title , @gig.description , works no problem. to full url, use gig_url(@gig) instead of gig_path(@gig) .

Python Pyparsing Optional field -

i using pyparsing module create own interpreter. current code import pyparsing pp # parse packet srcip,dstip,srcmac,dstmac identifier = pp.word(pp.alphas,pp.alphanums+'_') ipfield = pp.word(pp.nums,max=3) ipaddr = pp.combine(ipfield+"."+ipfield+"."+ipfield+"."+ipfield) hexint = pp.word(pp.hexnums,exact=2) macaddr = pp.combine(hexint+(":"+hexint)*5) ip = pp.combine(identifier+"="+ipaddr) mac = pp.combine(identifier+"="+macaddr) pkt = ip & ip & mac & mac arg = "createpacket<" + pp.optional(pkt) + ">" arg.parsestring("createpacket<srcip=192.168.1.3dstip=192.168.1.4srcmac=00:ff:ff:ff:ff:00>") while run last line of code parse example string error follows: file "<stdin>", line 1, in <module> file "/usr/lib/python2.7/dist-packages/pyparsing.py", line 1041, in parsestring raise exc pyparsing.parseexception: expected ">...

javascript - Checkbox From Json is not showing alert when clicked -

i passing check box input json html , , when checkbox clicked showing alert , not working. code $aroundcheck='<div id="content">';foreach ($checklocation $checklocation) { $aroundcheck.='<input type="checkbox" name="check[]"/>'.$checklocation->id_object; } $aroundcheck.='</div>'; $result = array('status' => 'ok', 'content' => $aroundcheck); echo json_encode($result); the javascript $('input=[name="check[]"]').click(function(){ alert("something");}); anybody know? me im stuck 2 days

excel formula - How do I increase from one number to another? -

this basic excel problem. have number i'm starting with, 1000, in cell b2. number i'd increase 135,000, located in b40. how go using formula increase 1000 135,000 in way fill cells in between 2 numbers values increase proportionately? i'm making rollout plan number of units need increase proportionately, number of units needs increase (i.e. not double between cells). in b3, put =b2+(b$40-b$2)/38 with 38 being 40-2. then, drag formula down b39. see: https://docs.google.com/spreadsheets/d/1sitslcfsbsp1po6og6gr3aququxub2iyqrde9sq2n2m/edit?usp=sharing

How can I use XSLT to permutate a node hierarchy? -

first of all: i'm total beginner xslt . in project synthesizing tree transformations in more abstract manner. proof of concept trying extend domain simple xslt . but let's @ 1 example, have several leaves in xml document, in here: <input> <a> <b> <c>foo </c> <c>bar </c> </b> </a> <x> <y> <z>foobar </z> </y> </x> </input> for want do, it's easier @ paths. a/b/c/foo , a/b/c/bar , /x/y/z/foobar what want change hierarchy based on index in path. example want first have in order: third level, first level, second level. paths mentioned above: c/a/b/foo , /c/a/b/bar , /z/x/y/foobar . my approach looked this: <xsl:template name="leaf"> <xsl:copy> <!-- copy attributes--> <xsl:copy-of select=...

node.js - DocuSign Connect with NodeJS w/ Express -

i'm having trouble extracting data response connect. can see endpoint getting 2 posts, don't see data because console.log(req) reports , can't find information. i'm using ngrok expose endpoints , have connect configured send documents xml update on envelope signing. to state question, how pull document out of request? thanks in advance. edit: used util output entire req , still can't find object xml , document bytes in. it's not body. { _readablestate: { highwatermark: 16384, buffer: [], length: 0, pipes: null, pipescount: 0, flowing: false, ended: false, endemitted: false, reading: false, calledread: false, sync: true, needreadable: false, emittedreadable: false, readablelistening: false, objectmode: false, defaultencoding: 'utf8', ranout: false, awaitdrain: 0, readingmore: false, decoder: null, encoding: null }, readable: true, doma...

Serializing into JSON using MemoryStream,while adding newlines C# -

i have serialize c# class data json. purpose use memorystream , datacontractjsonserializer. memorystream stream1 = new memorystream(); datacontractjsonserializer ser = new datacontractjsonserializer(typeof(person)); ser.writeobject(stream1, p); using (filestream file = new filestream("write.json", filemode.create, fileaccess.readwrite)) { stream1.position = 0; stream1.read(stream1.toarray(), 0, (int)stream1.length); file.write(stream1.toarray(), 0, stream1.toarray().length); stream1.close(); file.close(); } running application produces output: {"age":42,"arr":[{},{},{}],"name":"john","value":null,"w":{}} however, task have produce json file each entry entered in new line. example: "somedata":[ { "somedata" : "value", "somedata" : 0, "somedata": [ { "somedata" : "value", ...

bash - how can I replace a line containing variables? -

i have bash script , want use replacing lines string , add date end of line: #! /bin/bash today=`date '+%y_%m_%d__%h_%m_%s'`; sed -i '3s/.*/config_localversion=/' ~/desktop/file1 file2 ... also, can range of files start string "file"? to use variable expansion in bash, variables must non-quoted or double-quoted. single quotes prevent expansion. on other hand, you'd want avoid expansion of * in 3s/.*/ in case have directory 3s containing files starting . . fortunately, can chain strings together, can do #!/bin/bash today=$(date '+%y_%m_%d__%h_%m_%s'); sed -i '3s/.*/config_localversion='"$today"'/' ~/desktop/file{1,2,foo} and can range of file start string "file" ? the glob ~/desktop/file{1,2,foo} expand ~/desktop/file1 ~/desktop/file2 ~/desktop/filefoo . if instead want match files on desktop name starting 'file', use ~/desktop/file* instead.

sql server - Query to find zip codes with ending '0000' -

i need find zip codes in database end '0000'. using below query, able return zip codes 9 digits in length. how add return zipcodes have 9 digits in length , have 0000? i'm sure it's simple i'm still new querying. :) example: 922340000 select addresszipcode dbo.cr_member_allmemberdetails len(addresszipcode) = 9 select addresszipcode dbo.cr_member_allmemberdetails len(addresszipcode) = 9 , addresszipcode '%0000'

Windows Python v. Linux Python: "from module import *" is not importing on Windows -

having think unusual problem. have python script script1.py defining class baseclass(dict) , , script defining class childclass(baseclass) . childclass import first script from script1 import * , when trying run childclass nameerror: name 'baseclass' not defined . # script1.py ... class baseclass(dict): def __init__(self, params): pass ... # childclass.py script1 import * class childclass(baseclass): ... the exact same scripts run fine on home machine (ubuntu 15.04), work machine (windows 7 pro) i'm getting aforementioned nameerror. i've checked in python environment, , indeed finding script1.py file, not importing of functions inside. >>> script1 import * >>> baseclass traceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'baseclass' not defined' i'm imagining problem difference between windows python , linux python, i've never had kind of pr...

multithreading - Posix thread Program Multiplication - Inquire about Code blog How to check that it issues different threads -

found in below link blog showing example on matrix multiplication using posix thread, , mentioned each threads holding row , column information, below link , copied program reference https://macboypro.wordpress.com/2009/05/20/matrix-multiplication-in-c-using-pthreads-on-linux/ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #define m 3 #define k 2 #define n 3 #define num_threads 10 int [m][k] = { {1,4}, {2,5}, {3,6} }; int b [k][n] = { {8,7,6}, {5,4,3} }; int c [m][n]; struct v { int i; /* row */ int j; /* column */ }; void *runner(void *param); /* thread */ int main(int argc, char *argv[]) { int i,j, count = 0; for(i = 0; < m; i++) { for(j = 0; j < n; j++) { //assign row , column each thread struct v *data = (struct v *) malloc(sizeof(struct v)); data->i = i; data->j = j; /* create thread passing data parameter */ pthread_t tid; //thread id pthread_attr_t attr; //set of ...

batch file - How do I get a randomly generated ip back from ping -

what want generate random ip, ping it, , then, if ip comes valid ip, want send ip new notepad. have far... :start @set /a a=(%random% * 99 / 32768 + 1) @set /a b=(%random% * 999 / 32768 + 1) @set /a c=(%random% * 999 / 32768 + 1) @set /a d=(%random% * 9 / 32768 + 1) @set e=%a%.%b%.%c%.%d% ping %e% goto start i make take ip pinged, , if comes valid, put in notepad. thanks! want able repeat. please leave comment if know how can correctly! @echo off setlocal enableextensions enabledelayedexpansion /l %%a in (0) ( set /a "a=!random! %% 255", ^ "b=!random! %% 255", ^ "c=!random! %% 255", ^ "d=!random! %% 255" ping -w 1000 -n 1 "!a!.!b!.!c!.!d!" | find "ttl=" > nul && ( >>"online.txt" echo !a!.!b!.!c!.!d! ) )

javascript - Multiple parameters in AngularJS $resource GET -

'use strict'; angular.module('rmaservices', ['ngresource']) .factory('rmaservice', ['$resource', function ($resource) { return $resource( '/rmaservermav/webresources/com.pako.entity.rma/:id', {}, { delete: { method: 'delete', params: {id: '@rmaid'}}, update: { method: 'put', params: {id: '@rmaid'}}, //rmaservermav/webresources/com.pako.entity.rma/0/3 findrange:{method: 'get', params:{id:'@rmaid'/'@rmaid'}} }); }]); rmaservermav/webresources/com.pako.entity.rma/0/3 this correct way use findrange rest service. 1 returns rmaid 1 4, how can use controller , correct syntax in service? in controller use that: $scope.rmas = rmaservice.findrange({id:'0'/'3'}); but no...

html - jQuery easing plugIn, negative scrollTop, when reach top or bottom -

i made simple 1 page website, , have trouble easing plugin in, when moving page 1 page two, there not enough space @ top "anticipate" (animation term), nor @ bottom moving page two. please see demo code, thanks. please see demo here http://jsfiddle.net/56vmztjn/ stackexchange's demo, acting funny... jquery.extend( jquery.easing, { def: 'easeinback', swing: function (x, t, b, c, d) { //alert(jquery.easing.default); return jquery.easing[jquery.easing.def](x, t, b, c, d); }, easeinback: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; } }); // utility function onepage(el) { var windowwidth = $(window).width(), windowheight = $(window).height(), next = el.next('.onepage'), prev = el.prev('.onepage'); el.width(windowwidth); el.css({"min-height":windowheight}); el.find('.next').on('click', function() { goto(el, n...

java - Apache Poi: adding an image to paragraph does not work -

i using apache 3.17. the code below (main method + addimage + addtitle methods). package office; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import org.apache.poi.openxml4j.exceptions.invalidformatexception; import org.apache.poi.util.units; import org.apache.poi.xwpf.usermodel.xwpfdocument; import org.apache.poi.xwpf.usermodel.xwpfparagraph; import org.apache.poi.xwpf.usermodel.xwpfrun; public class wordgenerator { xwpfdocument doc = new xwpfdocument(); public wordgenerator(){ this.doc = new xwpfdocument(); } public xwpfdocument getdoc(){ return this.doc; } public static void main(string[] args) throws ioexception, invalidformatexception{ wordgenerator wg=new wordgenerator(); wg.addtitle("ola"); wg.addimage("path/to/image.jpg"); fileoutputstream out = new fileoutputstream("simple.docx"); ...

Does Google Drive AppFolder (AppData) require it's own explicit scope? -

i have code able read , write drive appfolder (aka appdata) stopped working. it seems problem due consolidation of scopes asking for. before requested explicit scopes: www.googleapis.com/auth/drive.appdata www.googleapis.com/auth/drive.file but consolidated them top level scope: www.googleapis.com/auth/drive we can read , find file in appfolder, cannot write it. had add drive.appdata scope back. is intended behavior? confused. note: yes see name has been changed appdata appfolder google, switched using appfolder name instead. yes, appdata requires own scope.

Non Blocking File Read in PHP -

i implementing script read data file in php. contains around 30 thousand lines. problem facing takes lot of time server read file , echo results , send page. there way server can send response after given time, 2 seconds. the result should contain part of file has been processed , in next reply should send part in processed in next 2 seconds. there couple of approaches this: 1) implement loop in @barmar's answer save current position between requests/responses. the problem @barmar's approach reads first chunk of file , returns it. it's not clear rest of file. 1 way improve processing via series of requests. example: client makes request http://example.com/process?file_position=0 server starts processing @ position 0 responds data first part of file , new file position client makes request http://example.com/process?file_position=1000 server reads new position wherever gets in 2 seconds , replies again ... 2) use queue processing system file read...