Posts

Showing posts from July, 2013

java - Report design not valid. Field not found Jasper Reports -

im trying create basic jasper report jrbeancollectiondatasource . in there im having list of objects inside javabean. public class course { private int id; private list<student> students; } student object looks like public class student { private string name; private int id; } i want print student information inside report. how jrxml looks like <subdataset name="dataset1" uuid="09015d96-ad5a-4fed-aa9e-19d25e02e205"> <field name="students" class="java.util.list"> <fielddescription><![cdata[students]]></fielddescription> </field> </subdataset> <field name="id" class="java.lang.integer"/> <field name="students" class="java.util.list"/> <field name="name" class="java.lang.string"/> <componentelement> <reportelement x="200" y="0" width="400...

ASP.NET MVC not show ckeditor -

there 1 layout page , 1 page using layout page. in create page there 1 textarea id= editor1 . in js , css load successful. ckeditor not show, blank textarea the output: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>sb admin 2 - bootstrap admin theme</title> <!-- bootstrap core css --> <link href="/css/bootstrap.css" rel="stylesheet"> <link href="/css/font-awesome.css" rel="stylesheet"> <link href="/css/sb-admin-2.css" rel="stylesheet"> <link href="/css/jquery-ui.css" rel="stylesheet" /> <script s...

javascript - How to make nodejs to talk with golang -

i creating web app in node.js , golang. need connect nodejs golang code talks mongodb , returns data node program. there way connect so? tried use gonode api.this code using gonode api. my node.js file contains below code: var go = require('gonode').go; var options = { path : 'gofile.go', initatonce : true, } var go = new go(options,function(err){ if(err) throw err; go.execute({commandtext: 'hello world gonode!'}, function(result, response) { if(result.ok) { console.log('go responded: ' + response.responsetext); } }); go.close(); }); ` and code in gofile.go file: package main import( gonode "github.com/jgranstrom/gonodepkg" json "github.com/jgranstrom/go-simplejson" ) func main(){ gonode.start(process) } func process(cmd *json.json) (response *json.json) { response, m := json.makemap() if(cmd.get("commandtext").muststring() == "hello") { ...

android - Reload the Fragment is not Working -

i have following situation: navigationdrawer creates fragment handle user information. fragment on oncreateview() calls web service , return view. when web services finishes callsback fragment detach , attach itself. when fragment attached second time on oncreateview() should create view user information. in fact happening view not change. what missing? thank in advance, fragment code: private boolean misrefresh = false; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // gets application context mcontext = getactivity().getapplicationcontext(); // set environment use database mglobal = (global) getactivity().getapplicationcontext(); mdaofactory = mglobal.getdaofactory(); mfragment = this; mfragmentview = inflater.inflate(r.layout.fragment_user_info, container, false); buildview(); if (misrefresh) { return mfragmentview; }else { ...

c++ - Does C++11 guarantee memory ordering between a release fence and a consume operation? -

consider following code: struct payload { std::atomic< int > value; }; std::atomic< payload* > pointer( nullptr ); void thread_a() { payload* p = new payload(); p->value.store( 10, std::memory_order_relaxed ); std::atomic_thread_fence( std::memory_order_release ); pointer.store( p, std::memory_order_relaxed ); } void thread_b() { payload* p = pointer.load( std::memory_order_consume ); if ( p ) { printf( "%d\n", p->value.load( std::memory_order_relaxed ) ); } } does c++ make guarantees interaction of fence in thread consume operation in thread b? i know in example case can replace fence + atomic store store-release , have work. question particular case using fence. reading standard text can find clauses interaction of release fence acquire fence, , of release fence acquire operation, nothing interaction of release fence , consume operation. replacing consume acquire make code standards-compliant, t...

javascript - Create proxy according URL path -

i need create proxy according url coming browser, since new topic im not sure how test it...:( need way test , see working use following code blog http://blog.nodejitsu.com/node-http-proxy-1dot0/ var httpproxy = require('http-proxy') var proxy = httpproxy.createproxy(); var options = { 'foo.com': 'http://website.com:8001', 'bar.com': 'http://website2.com:8002' } require('http').createserver(function(req, res) { proxy.web(req, res, { target: options[req.headers.host] }); }).listen(8000); what need when put in browser localhost:8000 route(proxy) new server diffrent path described in options. if want user typing foo.com go http://website.com:8001 need setup virtual host foo.com example nginx. nginx host virtual host foo.com , bar.com, "proxy pass" node.js app. when user go foo.com nginx server pass request node app proxy request relative url setup in options. if need can give ngi...

c++ - Could not convert from <brace-enclosed initializer list> to int(*) array -

i new c++, , error keep getting. #include <iostream> #include <string> using namespace std; void print (int test[2][2]= {{1,2},{3,4}}) { cout << test[0][0] << endl; cout << test[1][0] << endl; } int main() { print(); return 0; } the error is: not convert '{{1, 2}, {3, 4}}' '' 'int (*)[2]'| i beginner in c++ , still learning. function parameters declared arrays adjusted implicitly pointers first elements. so function declaration looks like void print ( int ( *test )[2] = { { 1, 2 }, { 3, 4 } } ); and pointer may not initialized such way because scalar object. in fact these function declarations void print( int test[10][2] ); void print( int test[2][2] ); void print( int test[][2] ); void print( int ( *test )[2] ); are equivalent , declare same 1 function. however define parameter reference array. in case expected result. example #include <iostream> void print ( const ...

joomla3.0 - How to add a Images in article page in Joomla? -

i trying add images joomla article page. not display. path showed, following {gallery}hotel/al-bandary-tower{/gallery} please me find out reason. thanks in advance. 1) go extensions -> plugin manager , make sure simple image gallery use turned on. click on open settings. 2) should have name of root images directory - directory above "hotel" in case - under images root . 3) in end of settings check gd library supported server . otherwise, ask hoster turn on account. 4) in details panel set radiobutton "enabled". save settings. (source) if use k2, note can use simple image gallery tags in k2's introtext or fulltext blocks .

objective c - IMAGES Sometimes 0 KB And Black IOS -

Image
i save images on nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *path = [documentsdirectory stringbyappendingpathcomponent:[self.data valueforkey:@"message"]]; but images loaded using haneke nslog(@"%@",path); [self.contentimage hnk_setimagefromfile:path placeholder:nil success:^(uiimage *image) { } failure:^(nserror *error) { } , images becomes black sometimes...i guess path not correct path..what did u say? edit:oh found image lenght bigger 0 68900 etc.but images black...!!!so there no wrong path

android - JavaCV convertToIplImage return NULL -

in javacv used in android,while converting frame iplimage applying color effect on video,we nullpointerexception.npe encountered of frames in video. ... while (true) { log.d("java_cv", "counting . . . " + count); frame original_frame = ffg.grab(); if (original_frame == null) { log.d("java_cv", "original_frame null at" + count); break; } else { log.d("java_cv", "original_frame not_null at" + count); if (converter == null) { log.d("java_cv", "converter null @ position" +count); continue; } opencv_core.iplimage frame1 = null; if (original_frame != null) { frame1 = converter.converttoiplimage(original_frame); } else { continue...

How to open a jstree branch in javascript -

here html code : <div id="jstree-beandesccategorie" class="jstreediv" style="display: none;"> <div class="containerjstree jstree jstree-2 jstree-default jstree-checkbox-selection" role="tree" aria-multiselectable="true" tabindex="0" aria-activedescendant="3" aria-busy="false"> <ul class="jstree-container-ul jstree-children jstree-wholerow-ul jstree-no-dots" role="group"> <li id="2" class="jstree-node jstree-closed" role="treeitem" aria-selected="false" aria-level="1" aria-labelledby="2_anchor" aria-expanded="false"> <div class="jstree-wholerow" unselectable="on" role="presentation"></div> <i class="jstree-icon jstree-ocl" role="presentation"></i> <a id="2_anchor" class="jstree-...

c++ - GetOpenFileName() Is Interfering With SFML -

i create openfilename: openfilename ofn; char szfile[260]; hwnd hwnd = null; // initialize openfilename zeromemory(&ofn, sizeof(ofn)); ofn.lstructsize = sizeof(ofn); ofn.hwndowner = hwnd; ofn.lpstrfile = (lpwstr)szfile; ofn.lpstrfile[0] = '\0'; ofn.nmaxfile = sizeof(szfile); ofn.lpstrfilter = l"png files\0*.png*\0"; ofn.nfilterindex = 1; ofn.lpstrfiletitle = null; ofn.nmaxfiletitle = 0; ofn.lpstrinitialdir = null; ofn.flags = ofn_pathmustexist | ofn_filemustexist; std::string input; if (getopenfilename(&ofn)) { input = cw2a(ofn.lpstrfile); std::cout << input << std::endl; } else errorhandle("open dialog problem"); but when try import via smfl says "error: unable open file.": sf::texture _cursor; if (!_cursor.loadfromfile("resources/metal_norm.png")) errorhandle("-cursor texture couldn't load"); not sure why error occurring if has possible answers...

objective c - How to translate this objc block to Swift closure? -

objective-c: [bmobuser signorlogininbackgroundwithmobilephonenumber:mobilephonenumber andsmscode:smscode block:^(bmobuser *user, nserror *error) { ......... }]; and wrote in swift: bmobuser.signorlogininbackgroundwithmobilephonenumber(phonenumber, andsmscode: smscode, block: {(_user: bmobuser, error: nserror) -> () in ........ }) but compiler warning saying "cannot invoke ... argument list of type ..." so correct syntax of closure in swift? thanks

javascript - Call a controller scope function from directive in Angular -

i have scope function inside controller, need trigger directive , directive dropdown, whenever changing value need trigger function directive controller. html <dropdown-single-select filter-params=false eventlstn="selecttab('summary')" api-params="serviceapiparams" select-options="filterdata.classfilter" selected-value="filterdata.selectedclassoptions" ></dropdown-single-select> directive .directive('dropdownsingleselect',['$document', function($document){ return { scope: { onselect: '&', selectoptions: '=', isofilterparams:'=filterparams', isoeventlistener:'=eventlistener', selectedvalue:'=', defaultoption:'=', disable:'&', apiparams:'=' }, restrict: 'e', templateurl: 'commonactions/w...

ios - Creating an SKShapeNode from CGPoint array that starts and ends on the edges of the screen rect -

okay, working on first ios game using spritekit , swift, , having hard time finding way accomplish 1 task. trying figure out how take cgpoint array contains user-made path going 1 edge of screen another. want figure out best way fill in space, perhaps skshapenode maybe theres better way. 1 important condition determine side of path filled, , should determined based on whether ball in game in area; want make area there no ball gets filled in. thinking of making skshapenode check if current position of ball inside node, realized i'm not sure how figure out how set node put against edges of screen. thing can think of adding screen corners messed if added of them, want know best way be. started writing function got stuck , have no idea now: func fillinpolgyon(contactpoint: cgpoint) { var framecontactpoint = contactpoint if contactpoint.x < 3 && contactpoint.x > -3 { framecontactpoint.x = 0 } else if contactpoint.y < 3 && contactpo...

python 2.7 - Mock import of ctypes fails with unsupported operand on Read The Docs -

i have small windows module relies on ctypes core module. on project rtd site page module comes empty. looking @ latest successful build log https://readthedocs.org/builds/apt/2900858/ there failure during make html stage. file "/var/build/user_builds/apt/checkouts/latest/knownpaths.py", line 5, in <module> ctypes import windll, wintypes file "/usr/lib/python2.7/ctypes/wintypes.py", line 23, in <module> class variant_bool(_simplecdata): valueerror: _type_ 'v' not supported following faq entry https://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules tried fake import ctypes using mock , doing cause build fail completely. can tell, i'm no means expert in area, it's because mock missing math functions: file "/var/build/user_builds/apt/checkouts/latest/knownpaths.py", line 13, in guid ("data4", wintypes.byte * 8) typeerror: unsupport...

c++ - Qt- change QStringList element -

i have groupprofpic qstringlist. i'v added same photo of element for (int k=0 ; k<4 ; ++k) groupprofpic.append(":/images/person.png"); if each person has profile picture ,default profile picture( ":/images/person.png" ) replace his/her profile picture. (int i=0 ; i<nicknameslist.size() ; ++i) { query1.prepare("select profpic muc_members nickname=? limit 4"); query1.addbindvalue(nicknameslist[i]); query1.exec(); if(query1.next()) { groupprofpic[i] = query1.value(0).tostring(); } but it's not working. how fix it? try check return value of qsqlquery::exec(): if (query1.exec()) { //do work //and see have qdebug() << "image path:" << query1.value(0).tostring(); } else { //you have error }

c++ - Iterator = pointer? Or what is it? -

is iterator in c++ pointer? reason ask seems nobody understands iterator is. it's "thing" or "value" say. iterator points element, position. when dereferencing it, it's looking @ iterator points to. correct analogy? please, help the short answer is: pointer kind of iterator. pointer can therefore used iterator. pointer has properties other iterator. history historically, have c pointer, , adapted c++ when c++ invented. pointer represents location in memory, therefore can used location in array. later, in 1990s, idea called "iterator concept" introduced c++. "iterator concept" related library called stl (which later absorbed standard library) , paradigm called "generic programming". iterator concept inspired c pointer represent location in containers vector , deque , others, how c pointer represent location in array. the iterator concept engineered compatible c pointer , hence can nowadays c pointer m...

meteor deployed but some package uncaught -

Image
i have meteor application, package : meteor-platform insecure iron:router aslagle:reactive-table accounts-base accounts-password natestrauser:font-awesome mizzao:bootboxjs aldeed:autoform aldeed:simple-schema aldeed:collection2 matb33:collection-hooks twbs:bootstrap when still in development, run well. when deploy bundled, have error : why happend? , how solve it?

ios8 - Accessing item of a navigationController childview in swift -

newbie ios app coding here appreciated. i have app when rotated landscape opens side menu automatically , need disable menu button in child view of navigationcontroller. here's code. navigation controller import foundation class gdnavigationcontroller:uinavigationcontroller{ override func viewwillappear(animated: bool) { super.viewwillappear(animated) //send notification when device rotated. nsnotificationcenter.defaultcenter().addobserver(self, selector: "rotated", name: uideviceorientationdidchangenotification, object: nil) } func rotated(){ /* put code here access menu button */ if(uideviceorientationislandscape(uidevice.currentdevice().orientation)) { //disable menu button here self.revealviewcontroller().setfrontviewposition(frontviewposition.right, animated: false) } if(uideviceorientationisportrait(uidevice.currentdevice().orientation)) ...

node.js - CPU Higher than expected in Node running in docker -

i have vagrant machine running @ 33% cpu on mac (10.9.5) when nothing supposed happening. vm machine run kinematic. looking inside 1 of containers see 2 node (v0.12.2) processes running @ 3-4% cpu each. root@49ab3ab54901:/usr/src# top -bc top - 03:11:59 8:31, 0 users, load average: 0.13, 0.18, 0.22 tasks: 7 total, 1 running, 6 sleeping, 0 stopped, 0 zombie %cpu(s): 0.2 us, 0.7 sy, 0.0 ni, 99.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st kib mem: 2051824 total, 1942836 used, 108988 free, 74572 buffers kib swap: 1466848 total, 18924 used, 1447924 free. 326644 cached mem pid user pr ni virt res shr s %cpu %mem time+ command 1 root 20 0 4332 672 656 s 0.0 0.0 0:00.10 /bin/sh -c node -e "require('./seed/seeder.js').seed().then(function (resp) { console.log('successfully seeded!'); pro+ 15 root 20 0 737320 81008 13452 s 0.0 3.9 0:32.57 node /usr/local/bin/nodemon app/api...

ruby - Different return values of `String#split` method using regex -

why second split in following return punctuation? why using parentheses in regular expression change output? str = "this test string. let's split it." str.split(/\. /) # =>["this test string", "let's split it."] str.split(/(\. )/) # =>["this test string", ". ", "let's split it."] because second code uses regex contains group. string#split : if pattern regexp , str divided pattern matches. whenever pattern matches zero-length string, str split individual characters. if pattern contains groups, respective matches returned in array well.

c# - How do i turn this into a for loop? -

hey im wondering how turn loop, don't have copy 26 times each letter of alphabet: count[1] = str.split('a').length - 1; console.writeline("a comes x " + count[1]); count blank integer array takes 26 values, represent amount of times letter of alphabet in string str, stored in string array called letters instead of splitting , creating new array, use count() function. can loop through each character, or loop existing array. for (char c = 'a'; c <= 'z'; c++) { console.writeline(c + " comes x " + str.count(x => char.toupper(x) == c)); }

lightbox2 - Wordpress stripping HTML code from some captions in jQuery Lightbox -

the issue occurring on site: http://jessicasilvermangallery.com/exhibitions/dashiell-manley/ i including captions , tags images. when clicked open in light box , honor html , other strip html. it strange , cannot figure out why occurs images not others. it seems may have portrait vs. landscape orientation. can offer insight why happening , how fix it?

c - What does __devexit mean in a function declaration? -

a driver looked @ has static void __devexit rtsx_remove(struct pci_dev *pci) what __devexit mean in context of function definition? other functions i've seen have, @ most, static , return type. long-ish story short: this macro expands set of gcc attributes . way of providing compiler special information various stuff in code, like, in case, function. different compilers have different syntaxis purpose, isn't standartized. example, gcc uses attributes, other compilers use different constructs. long-ish story long-ish: so, i'm no linux kernel expert, judging source code, macro used hotplug . believe signifies function should specific device exiting. for example, function provided seems set of hotplug functions working realtek pci-express card reader driver. what macro do? well, let's take closer @ macro's definition: #define __devexit __section(.devexit.text) __exitused __cold the first part __section(.devexit.text) : # defi...

php grab all GET variables in URL, and send them as POST variables back to same URL -

i'd clear url. when people hit website, come this: www.site.com/webpage/?var1=1&var2=2&var3=3 is possible grab of variables, send them post, reload page, , grab newly sent post variables clean url? so user visiting page, in end www.site.com/webpage/ save get parameters session variable , redirect url without parameters. when called without parameters, parameters session. session_start(); if (empty($_get) && isset($_session['_get'])) { // page after redirect, copy session variable $_get $_get = $_session['_get']; } elseif (!empty($_get)) { // when called parameters, copy $_get session variable $_session['_get'] = $_get // , redirect page no parameters header("location: /webpage/"); exit(); } unset($_session['_get']); // it's used once // use $_get in rest of script normal

bash - Why is Unix/Terminal faster than R? -

i'm new unix, however, have realized simple unix commands can simple things large data set very quickly. question why these unix commands fast relative r? let's begin assuming data big, not larger amount of ram on computer. computationally, understand unix commands faster r counterparts. however, can't imagine explain entire time difference. after basic r functions, unix commands, written in low-level languages c/c++. i therefore suspect speed gains have i/o. while have basic understanding of how computers work, understand manipulate data first read disk (assuming data local). slow. however, regardless of whether use r functions or unix commands manipulate data both obtain data disk. therefore suspect how data read disk, if makes sense, driving time difference. intuition correct? thanks! update: sorry being vague. done on purpose, hoping discuss idea in general, rather focus on specific example. regardless, i'll generate example of counting...

VoIP RTP Streaming from/to server (in Java) to/from android -

my target have push-to-talk chat app in gsm/umts/lte networks; wanted use multicast addresses , peer-to-peer without overload server; unfortunatly, after deep investigation, discovered multicast not allowed in gsm/umts/lte networks, therefore have use server in order bounce voip packets. i' don't solution because have overload server, didn't find better solution. if have alternative solution apprieciated... therefore have send voip android client server (pc), , viceversa. server in java, has receive voip packets , send voip packets other n clients; server bouncer of voip packets. i developped code, doesn't work; don't have error, had bad voip service: loose lot of pieces , hear noised... error? suppose should in server code; server packet , resend them, without know voip on rtp. please find below the code use send voip packets server. works because don't have problems when use individual call sending voip packets directly android android; code recei...

html - Responsive image inside vertical centered responsive container -

i'm trying create responsive vertically centered lightbox, supporting different image sizes , controls relativ positioned image without use of javascript. i got working in safari, unfortunately image doesn't scale heightwise in firefox , chrome overflows parent. here's jsfiddle here code: .overlay { position:fixed; top:0; left:0; right:0; bottom:0; background-color: rgba(0,0,0,.75); text-align:center; font-size:0; } .overlay:before { content: ""; display: inline-block; vertical-align: middle; height: 100%; } .container { display:inline-block; vertical-align:middle; position:relative; box-shadow:0 0 5px rgba(0,0,0,.5); font-size:1rem; max-width:80%; max-height:80%; } .container img { vertical-align: bottom; max-width:100%; max-height:100%; } .container .caption { position:absolute; bottom:0; width:100%; ba...

javascript - Access ng-repeat's item scope -

i've got table rows use respective scope variables conditional rendering: <tr ng-repeat="row in data"> <input type="text" data-ng-show="editmode" data-ng-model="row.smth"/> so input shown when row scope variable editmode set true, works fine. now i'd add row dynamically: $scope.data.push(my_new_row) that works great too. i'd set new row's scope variable editmode something, , i'm out of ideas. i know there's undocumented way use $$childhead etc that's not elegant. you can track items using $index. can use index decide show/hide item. can implementing function show/hide logic , pass in index. example: <div ng-repeat="row in data track $index"> <input type="text" data-ng-show="geteditmode($index)" ng-model="row.smth[$index]"> </div> have @ this .

sql - Alternatives to WITH .. AS .. clause in PostgreSQL -

i have several big queries of following type (simplified clarity). create function myfunction() returns void $$ begin ... t ( total total, total * 100 / total total_percent, total / people.count total_per_person, part1 part1, part1 * 100 / total part1_percent, part1 / people.count part1_per_person, part2 part2, part2 * 100 / total part2_percent, part2 / people.count part2_per_person, ... ( select total.amount total part1.amount part1 part2.amount part2 ... people.amount people (select ...from mytable..) total left join (select ...from mytable..) part1 on ... left join (select ...from mytable..) part2 on ... ... left join (select ...from mytable..) people on ... ) r ) insert another_table -- << need replace "return query" select .., total t union select .., total_percent t union select .., total_per_person t ...