Posts

Showing posts from June, 2010

c# - Updating App content on resume -

this going noob question wasn't able google it. in windows phone app there's method in app.xaml.cs private void application_activated(object sender, activatedeventargs e) { } that called when app brought background. how can have main app page (main.xaml.cs) update new data web when method beeing called. want happen when main page open not when other pages open can give me hint here? thanks in advance!

apache pig - Pig: STORE with MongoInsertStorage don't work -

i'm executing simple code in pig script: register /home/myuser/mongodb/mongo-2.10.1.jar register /opt/cloudera/parcels/cdh-4.5.0-1.cdh4.5.0.p0.30/lib/mongo-hadoop-cdh4-1.2.0/mongo-hadoop-core_cdh4.3.0-1.2.0.jar register /opt/cloudera/parcels/cdh-4.5.0-1.cdh4.5.0.p0.30/lib/mongo-hadoop-cdh4-1.2.0/mongo-hadoop-pig_cdh4.3.0-1.2.0.jar set mapred.map.tasks.speculative.execution false; set mapred.reduce.tasks.speculative.execution false; col = load 'mongodb://localhost:27017/mydb.mycollection' using com.mongodb.hadoop.pig.mongoloader ('id:chararray, companyid:chararray, ts:chararray', 'id'); store col 'mongodb://localhost:27017/mydb.mycollection2' using com.mongodb.hadoop.pig.mongoinsertstorage ('', ''); it returns following error: location config: configuration: uri: file:/tmp/temp449583595/tmp-109467318 2014-04-04 14:30:40,913 [main] error org.apache.pig.tools.grunt.grunt - error 2017: internal error creating job configurat...

android - Retrieving offline messages using asmack -

i'm new asmack , openfire, looked lot working answer couldn't find anywhere. how retrieve offline messages on logging account on asmack? i've used following code: configure(providermanager.getinstance()); //configuring providers before creating connection connectionconfiguration connconfig = new connectionconfiguration(host, port); connconfig.setsendpresence(false); connection = new xmppconnection (connconfig); try { connection.connect(); } catch (xmppexception ex) { setconnection(null); } try { connection.login(username, password); try { offlinemessagemanager offlinemanager = new offlinemessagemanager( connection); iterator<org.jivesoftware.smack.packet.message> = offlinemanager .getmessages(); system.out.println(offlinemanager.supportsflexibleretrieval()); s...

c++ - QT QTableView implementing toggle button and checkbox delegates -

i'm trying build qt table subclassing qtableview, qabstracttablemodel , qstyleditemdelegate maintian semblance of mvc archiectecture. i'm using simple example base build on haven't gone near qt table classes before: http://qt-project.org/doc/qt-4.8/modelview.html anyway table text columns needs single toggle button column , single checkbox column. i've noticed data method of model can used implement checkbox i'm going need custom delegate button going use checkbox also. anyway i'm unable find decent examples on internet create tables using qtableview object mixture of text, checkboxes , buttons. can of sirs point me in right direction? you don't need custom delegate having checkbox , toggle button in tableview. can make item checkable , set model like: qstandarditem *item = new qstandarditem( true ); item->setcheckable(true); item->setcheckstate(qt::unchecked); qstandarditemmodel * model = new qstandarditemmodel( 0, 2 ); model...

php - Can't select user from mysql table. -

i asked question before code submitting users. after few days of guessing, got working. but, now. can't select user inside table login. code. <?php if($_post['submit_id'] == 1) { //echo $_post['fname']; $playerf = $_post['fname']; $playerl = $_post['lname']; $name = $_post['firstname']; $link = mysqli_connect("localhost","tester","abc123","biscuit") or die(" did not connect. " . mysqli_error($link)); $query = "select firstname users" or die("did not work." . mysqli_error($link)); if($name != $fname) { echo "does not match."; } else { header ("location: game.php"); } } ?> <table align = "center"> <tr> <td> welcome <b> besco's biscuits </b>. please fill out following <br /> area...

oop - How to pass a function as a parameter to a class in python -

i want pass function class when initialize it. here's toy example came , works: def addition(self): return self.a + self.b def multiplication(self): return self.a * self.b class test: def __init__(self, a, b, fcn): self.a = self.b = b self.fcn = fcn t = test(3, 3, addition) print t.fcn(t) t = test(3, 3, multiplication) print t.fcn(t) is possible call t.fcn() other class method? did try it? the answer yes def do_op(x,y,fn): return fn(x,y) def add(a,b): return a+b print do_op(5,4,add) same class class whatever: def __init__(self,fn): self.fn = fn def do_it(self,*args,**kwargs): return self.fn(*args,**kwargs) #if wanted fn have self first argument #return self.fn(self,*args,**kwargs) #just pass self first argument x = whatever(add) print x.do_it(5,8) further along asking (if im reading right) def add(self): return self.a + self.b class whatever: ...

sql - Big Mysql table optimization -

Image
i have table use cache google translate api answers. table structure now has more 1million rows 35000 distinct values in group field. query type use is: select `orig_string`, `group`, `translated` `google_translate_cache` (`group` = "?" , ((`orig_string` = "?") or (`orig_string` = "?") or (`orig_string` = "?") .... now every query take more 2 seconds. i have tried change query union one, result same. in addition tried partition table - alter table `google_translate_cache` partition key(`orig_string`) partitions 26; but not successful. any suggestion speed it? i may wrong, don't think partitioning of table on "orig_string" want. instead, compound index on (group, orig_string) optimize where clause qualifier. now, group column -- 255 capacity? large required when original string being tested maxes out @ 100? having index of might cause bit of lag, cant definitively lac...

c# - Datatable.select get rows dulicate -

i have datatable this: code class math history b math b math i wanna rows have same code value class not same. expected: a math history i had tried datatable.select , group , dont work! me. simplest way of doing via linq should like: datatable.distinct() .groupby(x => x.code) .where(gr => gr.count() > 1) .selectmany(gr=> gr);

What sorting algorithm does visual c++ use in std::sort -

i've been searching while now, can't find algorithm visual c++ use std::sort function, know gnu standard c++ library uses introsort, there doesn't seem sources saying 1 microsoft's visual c++ use! use source luke :) quicksort (msvc 2013) or times heap sort or insertion sort (based on size of container) template<class _ranit, class _diff> inline void _sort(_ranit _first, _ranit _last, _diff _ideal) { // order [_first, _last), using operator< _diff _count; (; _isort_max < (_count = _last - _first) && 0 < _ideal; ) { // divide , conquer quicksort

Stylus concatenate variable and string -

following code for $i in (1..81) .block:nth-child({$i}) transition transform 500ms ease $i\s will compiled to .block:nth-child(1) { transition: transform 500ms ease 1 s; } ...... but space between number , seconds redundant! how can remove it? one possible approach: for $i in (1..81) .block:nth-child({$i}) transition transform 500ms ease 1s * $i that's quite similar example given in selector interpolation section of stylus documentation.

android - How to get the appwidget layout associated with a appwidget ID -

i want appwidget layout associated appwidget id. in widget provider class appwidget, android docs provide easy way appwidget ids... public void onupdate(context context, appwidgetmanager appwidgetmanager, int[] appwidgetids) { final int n = appwidgetids.length; // perform loop procedure each app widget belongs provider (int i=0; i<n; i++) { int appwidgetid = appwidgetids[i]; ids dont allow me know appwidget provider comes (multiple widget providers , layouts.). edit: using service class update widgets, not widget provider class. in service class, want appwidget layout each id can use remoteviews update layout. have tried few different suggestions, none of them give me value need use remoteviews. eg "r.id.widget_layout" how can value "r.id.widget_layout" appwidget id in correct "int" form use remoteviews? you can appwidget layout id , info provider each appwidget way: @override public void onupdate(context ...

php - URL rewriting using old .htaccess rules -

i having real problems re-writing urls , massively appreciated. i have php file called share.php , .htaccess file containing following rule: rewriterule ^share/([^/\.]+)/?$ share.php?variable=$1&%{query_string} [l] if navigate domain.com/share/123456 , share.php page loaded, there no value in $_get['variable'] . have other rewrite rules in .htaccess file , thought there may problem them, removed of other rules. 1 of rules removed rewriting domain.com/preview domain.com/preview.php rewriterule ^preview/?$ preview.php?&%{query_string} [l] i noticed that, of other rules removed, if navigated domain.com/preview, still rewrite url preview.php. so, removed .htaccess file completely, restarted apache, cleared cache in firefox , tested again. though .htaccess file has been deleted, rules still work. domain.com/preview still redirects domain.com/preview.php , domain.com/share/123456 still redirects domain.com/share.php (with no data in $_get['variable...

python - Get full path of currently open files -

i'm trying code simple application must read open files within directory. more specificly, want list of files open anywhere inside documents folder, don't want processes' ids or process name, want full path of open file. the thing haven't quite found that. couldn't neither in linux shell (using ps , lsof commands) nor using python's psutil library. none of these giving me information need, path of open files in dir. any advice? p.s: i'm tagging python question (besides os related tags) because plus if done using python library. this seems work (on linux): import subprocess import shlex cmd = shlex.split('lsof -f n +d .') try: output = subprocess.check_output(cmd).splitlines() except subprocess.calledprocesserror err: output = err.output.splitlines() output = [line[3:] line in output if line.startswith('n./')] # out[3]: ['file.tmp'] it reads open files current directory, non-recursively. for recursive...

node.js - req.session undefined in route -

i'm building simple site expressjs , passportjs , i'm running problem can't access session variables in routes. there lot of threads topic solutions don't work me. looks error somewhere else. my app configured this: app.configure(function() { app.set('port', process.env.port || 3000); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.logger()); app.use(express.cookieparser()); app.use(express.bodyparser()); app.use(express.methodoverride()); app.use(express.session({ path: '/', secret: 'very secret' })); app.use(passport.initialize()); app.use(passport.session()); app.use(app.router); app.use(express.static(__dirname + '/public')); }); once passport verified twitter account it's redirected site: app.get('/auth/twitter/callback', passport.authenticate('twitter', {...

c++ - Makefile in osX -

the following code nuke plugin makefile. (mirrior.cpp -> mirrior.dylib) i want add "header.h" , "header.cpp" in makefile. where should change it???? # compiler info ('g++-4.0 --version') # i686-apple-darwin10-g++-4.0.1 (gcc) 4.0.1 (apple inc. build 5494) # copyright (c) 2005 free software foundation, inc. # free software; see source copying conditions. there no # warranty; not merchantability or fitness particular purpose. # end compiler info output ndkdir ?= /applications/nuke8.0v2/nuke8.0v2.app/contents/macos mycxx ?= g++-4.0 link ?= g++-4.0 cxxflags ?= -g -c -duse_glew -i$(ndkdir)/include -isysroot /developer/sdks/macosx10.6.sdk -arch x86_64 linkflags ?= -l$(ndkdir) -wl,-syslibroot,/developer/sdks/macosx10.6.sdk -arch x86_64 libs ?= -lddimage -lglew linkflags += -bundle frameworks ?= -framework quartzcore -framework iokit -framework corefoundation -framework carbon -framework applicationservices -framework opengl -framework agl all: mirror...

java - Is possible use JTree in Eclipse plugin development instead of standard JFace tree? -

is possible use jtree in eclipse plugin development instead of standard jface tree? i'm developing in kepler, wan't work custom icons etc. in jtree. you can use jtree , other swing controls using swt_awt bridge . however, far trivial, swing have own event loop, you'll have figure out ui thread different code should run on, translate between different types of events (e.g. when resizing) etc. it's better figure out how achieve purposes in swt/jface/rcp way.

matlab - Create an array of rgb images in mat format? -

i having 60 images of size 250x250x3 . want add stack of images. ie, want create 4-d array, holds images in form of mat file. so, should of size 250 x 250 x 3 x 60 . i have tried following. when displays image full of white small marks only. code . x=zeros(250,250,3,60) i=1:60 x(:,:,:,i)=image1 , on on every every loop. any way create mat. the problem: it seems yout images stored uint8 type. when pre-allocated x defined double (by default). when matlab displays image there difference between uint8 type image , double type image: uint8 matlab expects intensities range between [0..255]. however, when comes double type images matlab expects values range between [0..1]. thus, assigning uint8 image values double type have double type image values in range [0..255] - matlab displays white. solutions: there several ways can solve problem: define x uint8 type x = zeros( [255, 255, 3, 60], 'uint8' ) save memory uint8 takes single byte whereas ...

java - Override Equals for Hashmap<String,String> -

i have hashmap,how override equals method hashmap? thanks. if want can do: hashmap<string, string> map = new hashmap<string, string>(){ @override public boolean equals(object o) { // todo comparison here return super.equals(o); } }; map.equals(new hashmap<string, string>());

xmldocument - Groovy : How to read xml tag names having full colon -

i have xml tag <com:id>33638</com:id> want read value 33638 tag, have parsed xml string , stored string variable cant read value using string id = 'com:id'.text(); this works fine: def t = "<com:id>33638</com:id>" def xml = new xmlparser(false, false).parsetext(t) println xml.text()

php - Laravel get result toSql in QueryBuilder -

i'm using select method of laravel qb , want mysql command of that's created. laravel qb: public function scopeios( $query ){ $result = $query->select( db::raw('count(`platform`) ios' ) ) ->where( 'platform' , '=', 'ios' ) ->pluck('ios'); } tosql() not member of function. i don't know tosql() if want query created might want @ logs of queries executed request. $queries = db::getquerylog(); dd($queries); or last query executed: $queries = db::getquerylog(); $last_query = end($queries); or maybe (warning untested code) public function scopeios( illuminate\database\query\builder $query ){ $result = $query->select( db::raw('count(`platform`) ios' ) ) ->where( 'platform' , '=', 'ios' ) ->pluck('ios'); } check this more information on tosql() . /** * sql representation of query. * * @ret...

encryption - using CipherOutputStream in Java, encrypted file ends up corrupted -

i doing bachelor thesis on topic of cryptography , costs. a part of compare different crypto algorithms , cipher modes in terms of runtime , resource cost. wrote small tool should work in 4 steps: read input file encrypt input file , write new file. read , decrypt written encrypted file. write copy of decrypted file onto file system. compare initial input file , decrypted file see if equal. it works fine small .txt input file. reason doesn’t work other kind of file. if take image input file, first few pixels good, rest ends corrupted. far understand problem should somehow when initialize cipher or when use streams. tried out comment lines encrypting , decrypting , works in making plain copies of input file identical. any suggestions welcome, try test them out asap , report results showed up. apologies “hungarian notations”. p use public , l local. way in our company. so here class: import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundex...

Choose class by current date in angularjs -

i have icon, , need change color if modified date = current date. logic: if inventory.modified = time apply style. in controller : $scope.time = new date(); template: <span class="glyphicon glyphicon-ok-sign" ng-class=""></span> api modified: modified: "2014-04-07t13:04:25.676000", you need change logic little bit. looking @ timestamp format, style applied 1/100000th of second. think chance javascript running @ exact time pretty low. you want 1 of following: apply style if same minute apply style if time matches , remove after specified interval (say, 15 seconds) either way, date filter should usefull: http://docs.angularjs.org/api/ng/filter/date edit: in js: // once, don't need convert again $scope.time = $filter('date')(new date(), 'shortdate'); ... inventory.$modified = $filter('date')(new date(inventory.modified), 'shortdate'); in template: <span ng-...

angularjs - angular $compile link to controller does not load images -

i trying render gallery in bootstrap modal-box. compiling template ng-init contains images. works first page(it loads images , caption). second page(in plnkr click second page) not display picture of bear, display caption. using ng-src instead of src not seem work images not loaded @ first page. plnkr test: http://plnkr.co/edit/hutimgo1gd21ceadh4ki?p=preview solved using preloading images guy http://www.bennadel.com/blog/2597-preloading-images-in-angularjs-with-promises.htm

NightShot® on/off via Sony Camera Remote API and/or LANC code -

now sony camcorders have electronic control on nightshot function (eg fdr-ax100, hdr-cx900) possible (and awesome) if controlled via wifi and/or via lanc. filming nocturnal wildlife can made easier using pir motion/heat-based detectors , daylight sensors. in past nightshot feature had physically switched on/off using servo controller such http://i1.ytimg.com/vi/jluqss4rwte/hqdefault.jpg control of nightshot via wifi/camera remote api and/or lanc suited filming wildlife, , possibly many other applications such security/surveillance. camera housing divers use lanc codes (example mvhs-ax100) , use nightshot function filming deep underwater covert infrared lighting. looking @ lanc codes http://www.boehmel.de/lanc.htm doesnt appear nightshot has been implemented yet. note fdr-ax100 & hdr-cx900 have access lanc controls via multi-terminal , sony 10 pin a/v r jack adapter vmc-avm1. i think purposes lanc command enough, including in upcoming update of sony camera remote api ...

locationmanager - Interpreting the Android Location Manager Results -

i'm writing first android application, , have utilized android location manager obtain gps readings. bit confused accuracy readings i'm getting. example: i used tape measure out 1000 linear feet between 2 points. while standing @ point started location manager update requests until received accuracy of +/- 4 feet. i hit button in app save particular location (private var). while location manager continues poll walked line until reached point b. once here waited accuracy reading of +/- 4 feet. i hit button takes location , performs distance measurement between 2 points i.e.: double distance = startlocation.distanceto(endlocation); the returned distance measurement 1000.20 feet. i realize returned accuracy measurement gps fluctuating, expected distance measurement @ least reflect somewhat. surprised @ it's precision in comparison accuracy readings. so question should trust value distance measurement, or take consideration accuracy measurement returned gp...

java - Could not autowire. No beans of SimpMessagingTemplate type found -

i configuring websockets in spring following guide provided in documentation. i trying send message server client explained in section " sending messages anywhere " following example, can autowire class called simpmessagingtemplate @controller public class greetingcontroller { private simpmessagingtemplate template; @autowired public greetingcontroller(simpmessagingtemplate template) { this.template = template; } @requestmapping(value="/greetings", method=post) public void greet(string greeting) { string text = "[" + gettimestamp() + "]:" + greeting; this.template.convertandsend("/topic/greetings", text); } } however, current project cannot find bean "simpmessagingtemplate". (intellij: 'could not autowire. no beans of simpmessagingtemplate type found'. i have check several examples in internet cannot find how spring create instance of simpmessagingt...

code review - Search Gerrit for commits previously rejected by a reviewer -

question how search commits have ever received codereview-2 in past given reviewer? context basically want retrospective on every commits i've ever rejected can share comments more people. it's easy commits i'm rejecting using search terms reviewer:self label:codereview-2 . but once owner of commit fixes issue new patchset , put +2 on it, won't able search commit anymore. so i'm looking had-label:codereview-2 . at our local installation email gerrit @ each scoring. thus, workaround, can search emails gerrit containing "< login > has posted comments on change." , "code-review-2".

C++ SFML member initializer -

i'm confused @ moment. it's been while since touched c++ , want again, i'm trying use sfml, , i'm using guide along side it. thing gets me code. game::game():mwindow(sf::videomode(640, 480), "sfml application") { } it works perfectly, , think understand. it's initializing mwindow, , when mwindow constructed, creates window. no problem. when put code down. game::game() { mwindow(sf::videomode(640, 480), "sfml application"); } it gives me error type 'sf::renderwindow' not provide call operator which have no idea means, nor understand how 2 blocks of code differ. mwindow should class data member, not function. first block of code initializes it.

web crawler - Using Meteor with Iron-router to improve crawling with Google AJAX specifications -

i have meteor site iron-router . when use google's webmaster tools , "fetch google", comes empty body. reading google's documentation on how make application crawlable, believe need add meta tag , return plain html version of page if parameter ?_escaped_fragment= sent. is there simple way iron-router? have tried diverting browser different template if parameter present, eg: router.map(function () { this.route('home', { path: '/', template: 'home', onbeforeaction: function () { if (this.params['_escaped_fragment']=='') { this.route.options.template = 'another_page'; } }, }); }); however, substitutes template using javascript, google won't see either. there way provide plain html file if specific parameter provided? add spiderable package project: meteor add spiderable this automatically add correct <meta...

java - Using reflection to invoke method on field -

my code looks following: class myobject { myfield f = new myfield(); } class myfield { public void greatmethod(); } is there way invoke greatmethod() using reflection on object of class myobject ? i tried following: field f = myobject.getclass().getdeclaredfield("f"); method mymethod = f.getdeclaringclass().getdeclaredmethod("greatmethod", new class[]{}); mymethod.invoke(f); but instead trying call greatmethod() on myobject directly , not on field f in it. there way achieve without need modify myobject class (so implement method calls appropriate method on f). you close yourself, need declared method , invoke on instance of field containted within object instance, instead of field, below // obtain object instance myobject myobjectinstance = new myobject(); // field definition field fielddefinition = myobjectinstance.getclass().getdeclaredfield("f"); // make accessible fielddefinition.setacces...

php - Hello, I want to get multiple custom field from wordpress with one line -

i want multiple custom field wordpress 1 line example. have field "link","link1","link2","link3","link4" , "link_titull","link_titull1","link_titull2","link_titull3","link_titull4" i have code 1 field , if not filled showing empty. <?php $prop_det_url = get_field('link'); if($prop_det_url!=''){ ?> <a href="<?php echo $prop_det_url; ?>" target="_blank">&gt; <?php the_field('link_titull'); ?></a></p> <?php } ?> you can use loop. see sample code below: <?php for( $i=1; $i<=4; $i++){ $prop_det_url = get_field('link'.$i); if( $prop_det_url != '' ){ ?> <a href="<?php echo $prop_det_url; ?>" target="_blank">&gt; <?php the_field('link_titul'.$i); ?></a> <?php } } ?...

ios - Titanium Alloy put back button in a scrollableView -

i want put button @ top left on scrollableview of ipad. if put button here doesn't appear on screeen. this view1.xml. <alloy> <window id="win1" class="contain"> <scrollableview id="scrollableview" showpagingcontrol="true"> <view id="vista1" backgroundimage="lois1.jpg"></view> <view id="vista2" backgroundimage="lois2.jpg"></view> <view id="vista3" backgroundimage="lois3.jpg"></view> <view id="vista4" backgroundimage="lois4.jpg"></view> <view id="vista5" backgroundimage="lois5.jpg"></view> </scrollableview> </window> </alloy> this alloy.js: //view 1 var win1 = ti.ui.createwindow({ fullscreen: true}); var vista1 = ti.ui.createview({ backgroundimage: ...

Sencha touch getView() in controller is undefined -

i follow this tutorial learn sencha touch 2. in chapter 3 when want active second view, it's undefined: var newpage = this.getnewpagecontainer(); ext.viewport.animateactiveitem(newpage, this.sliderighttransition); // noting happend. console.log(this.getnewchallangecontainer()); // print "undefined" i set on config, refs: refs: { // we're going lookup our views xtype. pagecontainer: "pagecontainer", newpagecontainer: "newpagecontainer" } thanks :)

Making Datagrid Searchable with MySQL database in C# WPF -

so got datagrid working in c# wpf, connects mysql database , shows first name , last name of people in database. i'm trying make search button searches last name entered in text box , display in datagrid. know code wrong don't know how this. help this connects database first name last name , works fine try { command = connc.createcommand(); command.commandtext = "select first_name, last_name studentinfo"; mysqldatareader reader = command.executereader(); string result = string.empty; while (reader.read()) { result += reader["first_name"].tostring() + " " + reader["last_name"].tostring() + " "; } read = result.split(' '); reader.close(); int count = 0; mysqldataadapter = new mysqldataadapter("select first_name, last_name studentinfo", connc); dataset ds = new dataset(); mysqldataadapter.fill(ds); data.setbinding(itemscontrol....

python - How to obtain random access of a gzip compressed file -

according this faq on zlib.net possible to: access data randomly in compressed stream i know module bio.bgzf of biopyton 1.60 , which: supports reading , writing bgzf files (blocked gnu zip format), variant of gzip efficient random access, commonly used part of bam file format , in tabix. uses python’s zlib library internally, , provides simple interface python’s gzip library. but use case don't want use format. want something, emulates code below: import gzip large_integer_new_line_start = 10**9 gzip.open('large_file.gz','rt') f: f.seek(large_integer_new_line_start) but efficiency offered native zlib.net provide random access compressed stream. how leverage random access capability in python? i gave on doing random access on gzipped file using python. instead converted gzipped file block gzipped file block compression/decompression utility on command line: zcat large_file.gz | bgzip > large_file.bgz then used biopython ...

Strange compile error in java -

this question has answer here: is list<dog> subclass of list<animal>? why aren't java's generics implicitly polymorphic? 12 answers i'm trying pass variable of type: hashmap<foo, hashset<bar>> to method, expects: map<foo, set<bar>> i think should work, i'm getting following compile error: java: method setmenu in class com.xx.client.layout.layout cannot applied given types; required: java.util.map<com.xx.shared.model.usertype,java.util.set<com.xx.shared.dto.model.menuitemdto>> found: java.util.hashmap<com.xx.shared.model.usertype,java.util.hashset<com.xx.shared.dto.model.menuitemdto>> reason: actual argument java.util.hashmap<com.xx.shared.model.usertype,java.util.hashset<com.xx.shared.dto.model.menuitemdto>> cannot converted java.util.map<com.xx.shared.mo...

.htaccess - ModRewrite: Excepting images from lower case URL's -

when decided change url's lower case, didn't think links images. discovered url's no longer display because picture.jpg defaults picture.jpg, doesn't match in images folder. so have 2 choices: 1) rename images or 2) add code .htaccess file exempts images lower case rule. on top of that, have rules default underscores dashes - , many of images use underscores. these rules i'm working right now: rewriterule (.*?[a-z]+.*) /${tolower:$1} [r] rewriterule ^([^_]*)_([^_]*_.*) $1-$2 [n] rewriterule ^([^_]*)_([^_]*)$ /$1-$2 [l,r=301] i'm going wind modifying them somehow, want replace spaces dashes. plus, several people have told me these rewriterules improved. but know of rewriterule allow images (and folders reside in) display @ url's matching regular values? in other words, if have image @ mysite/images/world/spain.png, should display @ url, not mysite/images/world/spain.png. or best bite bullet , rename images? thanks.

mysql - SQL trigger not executing...doing something wrong? -

i have this: this on chars_insert, before. begin if exists (select * chars accid = new.accid) begin insert `char_vars` set `charid = new.charid, `varname` = `notfirstchar`, `value` = 1; end insert `char_equip` set `charid` = new.charid; insert `char_exp` set `charid` = new.charid; insert `char_jobs` set `charid` = new.charid; insert `char_pet` set `charid` = new.charid; insert `char_points` set `charid` = new.charid; insert `char_profile` set `charid` = new.charid; insert `char_storage` set `charid` = new.charid; insert `char_inventory` set `charid` = new.charid; end i had added if exists part...which broke trigger. trying find if 1 accountid has character , if do, add variable created character saying not first one. says error on if exists line, see no error...help please? try changing code in following way mysql: begin if exists (select * chars accid = new.accid) inser...

ios - Custom UITableViewCell Class Issue -

i've read quite few tutorials online how create custom cell subclass, i'm still little confused. when try follow instructions found in question, end errors tableview not valid property object of viewcontroller. i've created new subclass of uitableviewcell , called custombookclass . i've hooked properties custombookclass.h file. #import <uikit/uikit.h> @interface custombookcell : uitableviewcell @property (weak, nonatomic) iboutlet uiimageview *bookimage; @property (weak, nonatomic) iboutlet uilabel *booktitle; @property (weak, nonatomic) iboutlet uilabel *dateadded; @end i go viewcontroller.m file edit viewdidload method. - (void)viewdidload { [super viewdidload]; [self.tableview.delegate = self]; [self.tableview.datasource=self]; [self.tableview registerclass:[custombookcell class]forcellreuseidentifier:@"custom cell"]; } i error on tableview, saying property doesn't exist, though in viewcontroller.h file, i'm includi...

linux - Creating a binary package of a compiled library -

i'm running gentoo , have manually compiled , installed flann library. need create binary package extension of .tar.tbz2 has required files. tried installing separate folder , compressing wasn't recognized actual package. (using make install destdir=folder) my attempt @ file contained usr subdirectory. additional info: i'm packaging library part of cross-compiling. add --prefix=pathtoinstall ./configure,then execute make , make install , generate tar pathtoinstall ./configure --prefix=pathtoinstall make make install tar -cjvf flann.tar.bz2 pathtoinstall

How to upload multiple files at same time in CakePHP 2 -

i have function upload images in cakephp 2. works fine, upload 1 file @ same time. how upload multiple images @ same time. sorry english! controller public function add() { $this->set('title_for_layout', 'file'); $this->loadmodel('file'); if(!empty($this->data)){ $data = $this->data; $file = $data['file']['filename']; if($file['name'] != null){ $data = $this->data; $file = $data['file']['filename']; move_uploaded_file($file['tmp_name'], www_root . 'uploads/' . $file['name']); $data['file']['title'] = $this->data['file']['title']; $data['file']['description'] = $this->data['file']['description']; $data['file']['filename'] = $file['name']; $this-...

sql - Postgres - CREATE TABLE FROM SELECT -

i have 2 tables, 1 contains large list of ids , info regarding ids. i have second table graph has 2 columns, each column contains aforementioned id numbers, multiple times. want trim size of info table selecting ids appear in graph , creating new smaller info table. there simple way of doing this? create table select? thanks! a it's easy as: create table new_table select t1.col1, t2.col2 some_table t1 join t2 on t1.id = t2.some_id; you can use select statement that. column names of new table defined column aliases used in th query. more details in manual: http://www.postgresql.org/docs/current/static/sql-createtableas.html

What are some features of Git that Github doesn't support? -

i love using github , have been interested in learning more how git works behind scenes. there cool features of git haven't been exposed through github.com? in principle, github host git repository. in repository add to/mangle history totally orthogonal features github offers. differences/restrictions in hosting side of things, real question is: what's difference hosting repositories on own server? when using git on own server, allows provide own code inspect , possibly reject pushes, using hooks mechanism. means can write hook script makes sure people can push changes subdirectories of repository, example. whole lot of other things can done this, of course – you're limited imagination. , maybe reality. ;) github doesn't want run arbitrary code provide repositories, of course, can't quite fancy custom things if repository hosted there. allow send notifications other servers via http, though, while can't make own rules restricting pushes, @ leas...

Starting NUnit runner (2.6.3) from Visual Studio -

i followed instructions here use "start external program" start nunit on test project's dll. nunit starts, error "this assembly not built known testing framework" i can run same assembly same nunit.exe command line fine... nunit.exe version 2.6.3 nunit.exe.config follows: <configuration> <!-- gui runs under .net 2.0 or higher. uselegacyv2runtimeactivationpolicy setting applies under .net 4.0 , permits use of mixed mode assemblies, otherwise not load correctly. --> <startup uselegacyv2runtimeactivationpolicy="true"> <!-- comment out next line force use of .net 4.0 --> </startup> <runtime> <!-- ensure test exceptions don't crash nunit --> <legacyunhandledexceptionpolicy enabled="1"/> <!-- run partial trust v2 assemblies in full trust under .net 4.0 --> <loadfromremotesources enabled="true"...

node.js - How to resolve multiple queries together using Sequelizejs -

i have basic nodejs script: var express = require('express'), sequelize = require('sequelize'), promise = require('bluebird'), app = express(), optimus = new sequelize('optimus', 'root', 'test', {host: '127.0.0.1', dialect: 'mysql'}), query = 'select id borrowers limit 0,10', query2 = 'select count(*) borrowers'; app.get('/', function(req,res) { var chain = new sequelize.utils.querychainer(); console.log('begin'); chain.add(optimus, 'query', [query,null,null,[]]) .add(optimus, 'query', [query2,null,null,[]]) .run() .success(function() { console.log('done'); }).error(function(err) { console.log('oh no'); }); console.log('end'); res.send('hi ma!'); }); var server = app.listen(3000, function() { console.log('listening on port %d', server.address().port); } ); neither...

c# - How do I post a complex object to an MVC 4 controller via Ajax? -

i have object called drawdie following properties: id plantid : int qtyonhand : int sizeus : double sizemetric : double casesize : string style : string i have object called dieorder following properties: id : int drawdie : drawdie drawdieid : int plantid : int purchaseorder : string qty : int i post object mvc controller via ajax request. prefer not use 3rd party library. trying post this: var dieorder = new object(); var drawdie = new object(); dieorder.qty = $("#qty").val(); dieorder.drawdieid = $("#drawdieid").val(); drawdie.casesize = $("#drawdie_casesize").val(); drawdie.qty = $("#qty").val(); drawdie.id = dieid; drawdie.qtyonhand = 0; drawdie.sizeus = $("#drawdie_sizeus"); drawdie.sizemetric = $("#drawdie_sizemetric"); drawdie.plantid = $("#plantid").val(); drawdie.istransfer = "n...

ios7 - Problems With Using Dispatch Queue in Objective C -

i trying use dispatch queue can wait 1 portion of code finish before continuing onto second portion. below code, code within dispatch_sync execute , complete before code in dispatch_barrier_async. have looked around trying figure out why doesn't work no avail. appreciated. __block dispatch_queue_t queue; queue = dispatch_queue_create("com.example.myqueueformaps", dispatch_queue_concurrent); dispatch_sync(queue, ^{ for(xyztodoitem* item in todoitems){ mklocalsearchrequest *request = [[mklocalsearchrequest alloc] init]; request.naturallanguagequery = item.itemname; // somehow deal radius mkcoordinatespan span = mkcoordinatespanmake(0.1, 0.1); request.region = mkcoordinateregionmake(currentloc.coordinate, span); mklocalsearch *search = [[mklocalsearch alloc]initwithrequest:request]; [search startwithcompletionhandler:^(mklocalsearchresponse *response, nserror *error){ int = 0; doubl...

Need help decoding JSON output with PHP -

here sample json output working with: http://maps.google.com/maps/api/geocode/json?components=postal_code:90210&sensor=false here attempt pull latitude value location: $postallong = $jsonoutput>results[0]->formatted_address[0]->location[1]->lng; i have tried several variations not working. how can have apply 34.1030032 value variable? i guess have mismatched it. try - $json->results[0]->geometry->location->lat;

Unset git configuration -

i using filemerge on mac viewing diffs , have set with: git config --global diff.external ~/bin/git-diff-cmd.sh now no longer want use filemerge, how go default had before this? use --unset from man page: --unset remove line matching key config file.

xml - Preserving html tags in xslt -

i want preserve html tags using xslt. example have xml structure: <adaptation> <body> <p> <t>consultez l'offre de formation en ligne (en cliquant sur le niveau souhaité dans le schéma ci-dessous)</t> </p> </body> </adaptation> . i want preserve tags <body>, <p> ... tried use copy-of, doesn't work: `<xsl:template name="insertinfo"> <xsl:param name="id"/> <xsl:param name="objet"/> <xsl:param name="valeurinfo"/> <xsl:text>insert information(idobjet, objetnom, valeurinfo) values (" </xsl:text> <xsl:value-of select="$id"/> <xsl:text>", "</xsl:text> <xsl:value-of select="$objet"/> <xsl:text>", "</xsl:text> <xsl:copy-of select="$valeurinfo"/> <xsl:text>...

routing - Do not post a form in a Rails root route -

i have controller 1 method: index_controller.rb def index # code end the form: index.html.erb <%= form_tag :class => "form-inline signup" %> <div class="form-group"> <%= text_field_tag :url, nil, :class => "form-control", :placeholder => "url tópico" %> </div> <%= submit_tag "enviar", method: :post, :class => 'btn btn-theme' %> <% end %> and simple root route: root 'index#index' post '/', to: 'index#index' the problem when load root page, form posted automatically, when preferable post on button call. what missing here? you should move code post out action can handle that. post '/', :to => "index#submit" then can define submit action within indexcontroller handle form, , index action won't run form code anymore.

Using a Grails service inside a script -

i'm trying use grails service inside following grails script includetargets << grailsscript("_grailsinit") target(loadgames: "the description of script goes here!") { def listfile = new file('list.txt') listfile.eachline { def result = ctx.getbean("bggservice").search(it) println + " " + result.length() } } setdefaulttarget(loadgames) i've seen dozen different webpages each offering different combination of ctx appctx , , applicationcontext (as many others) suggestions, none of them work. typically complain context variable trying use not exist. why can't grails use services inside script in same way used in controllers? what right way use grails service inside grails script? getting hold of applicationcontext , grailsapplication possible though bootstrap command. include _grailsbootstrap script, call configureapp () or depend on in order make applicationcontext availa...

Present a sql query in service engine Apache OFBiz -

i present sql query in service engine ofbiz follows: select * a.a in (select b.a b b.b = '2'); please me. always use entity-engine if possible (try view-entity, entitylistiterator ...) if can't avoid sqlprocessor way go. has been answered @ does apache ofbiz delegator api support fetching list of records database limit or offset

Git: Push local file to a different file name in a remote repository -

Image
i'm working on specialized standalone server imageboards, , have local git repository folder development/testing folder. possible push local file repository different name? example, index.html.remote (on local repo) index.html (remote repo), since gochan uses template files generate html pages. create index.html landing page first time installation, push that, , replace template-generated version , never push again, seems bit messy. but having index.html when user first downloads better index.html.remote , wouldn't it? you can achieve that. version a: index.html.template a script generates right index.html (not versioned, private) a .gitattributes file in declare content filter driver called here " smudge " (a script runs on git checkout ) (picture chapter "git attributes" of git book ) echo 'index.html.template tpl' >> .gitattributes git config --global filter.tpl.smudge yourscript that way, don't ha...

c# - How do I open an already openeded presentation with PresentationDocument.Open() for PowerPoint Add in? -

i have powerpoint add in create, modify , save presentations. specific options opened presentation should stored in presentation file (.pptx) using open xml, when try ioexception: **system.io.ioexception : process cannot access file 'test.pptx' because being used process.** this snippet code: ** using (presentationdocument pptpackage = presentationdocument.open(filename, true)) { // add options pptx file. } ** thank you. if need read opened presentation using open xml can way: using (stream stream = new filestream(_filename, filemode.open, fileaccess.read, fileshare.readwrite)) using (presentationdocument pptpackage = presentationdocument.open(stream, false)) { // read pptx file. } but can't change presentation way.

java - Pass authentication info between web service and business layer (Spring, tomcat) -

i have spring web service , business layer deployed separately on 2 tomcat servers. (as explained in question spring ws separately deploy web service , bussiness layer ). business layer servlet container , web service communicate spring httpinvoker . i use tomcat container based authentication springs preauthenticatedauthenticationprovider , j2eepreauthenticatedprocessingfilter . here not provide client application authentication token. (i mean not manually doing session handling. managed tomcat) now want make sure requests business layers authenticated client. 1 thing found pass authentication object web service's security context securitycontextholder.getcontext().getauthentication() request parameter business layer. there not have way verify authentication object. idea on way achieve security in business layer? the httpinvoker way of remoting uses http client, default wil use plain httpurlconnection jdk. way of connecting used determined imlementation of...