Posts

Showing posts from April, 2015

mongodb - group by using mongoid in rails -

i using mongoid rails4, need group result supplying charts (statistics screen) using below code. @comments_stats = {} comments_data = comment.where(:created_at.lte => date.today-10.days).group_by {|d| d.created_at.to_date } comments_data.map{ |a| @comments_stats[a[0].strftime("%d-%m-%y")] = a[1].size} it give { "1-1-2014" => 2, "3-1-2014" => 1, "4-1-2014" => 2, "6-1-2014" => 4 } but want below { "1-1-2014" => 2, "2-1-2014" => 0, "3-1-2014" => 1, "4-1-2014" => 2, "5-1-2014" => 0, "6-1-2014" => 4 } any 1 suggest how simplify above query also. thanks prasad. you can try this: @comments_stats = {} last_date = date.today - 10.days comments_data = comment.where(:created_at.lte => last_date).group_by {|d| d.created_at.strftime("%d-%m-%y")} first_date = date.parse(comments_data.keys.min) (fi...

error in bookmark observer, while buidling firefox addon -

okay have created observer bookmark service, function triggered observer,when bookmark item removed onitemremoved: function(id, folder, index) arguments in function (id,folder,index) when try access bookmark url , title using getitemtitle(id) , getbookmarkuri(id).spec; nsi illegal value error. id of bookmark integer (1935 etc) can't see why bookmark url not returned? clue? when bookmark item removed id no longer useful. onitemremoved method takes more arguments 3 mentioned though, takes aid, aparentid, aindex, aitemtype, auri, ... can use auri argument url interested in. the better option use sdk/places/events module though, so: const { events } = require('sdk/places/events'); events.on('bookmark-item-removed', ({ data }) => { let url = data.url; // ... })

java - how future get() method works with timeout -

i bit confused how future.get(timeout) works per definition through exception after specified timeout time, not happening in test cases. import java.util.linkedhashset; import java.util.set; import java.util.concurrent.callable; import java.util.concurrent.executorservice; import java.util.concurrent.executors; import java.util.concurrent.future; import java.util.concurrent.timeunit; public class callableexample { public static class wordlengthcallable implements callable<string> { private string word; private long waiting; public wordlengthcallable(string word, long waiting) { this.word = word; this.waiting = waiting; } public string call() throws interruptedexception { thread.sleep(waiting); return word; } } public static void main(string args[]) throws exception { args = new string[] { "i", "am", "in", "love" }; long[] waitarr = new long[] { 3000, 3440, 2500, 300...

hadoop - Hortonworks Data node install: Exception in secureMain -

am trying install hortonworks hadoop single node cluster. able start namenode , secondary namenode, datanode failed following error. how solve issue? 2014-04-04 18:22:49,975 fatal datanode.datanode (datanode.java:securemain(1841)) - exception in securemain java.lang.runtimeexception: although unix domain socket path configured /var/lib/hadoop-hdfs/dn_socket, cannot start localdataxceiverserver because libhadoop cannot loaded." see native libraries guide . make sure libhadoop.so available in $hadoop_home\bin. logs message: info util.nativecodeloader - loaded native-hadoop library if instead find info util.nativecodeloader - unable load native-hadoop library platform... using builtin-java classes applicable then means libhadoop.so not available, , you'll have investigate why. alternatively can turn off hdfs shortcircuit if wish, or enable legacy short-circuit instead using dfs.client.use.legacy.blockreader.local , remove libhadoop dependency. reckon...

php - Laravel and polymorphic -

i try first polymorphic relationships , managed record think pivot entry. i have basic "brands" nike or philips, "valeur" quality or compliance , classic "users" base. i have " valuables" supposed contain input value of "brands" user, therefore structure of database : id valeur_id (integer) user_id (integer) valuable_id (integer) valuable_type (string) with little knowledge, can save entry correct value of brand not id of user. value model public function brand ( $user ) { return $this->morphedbymany(' brand', ' valuable '); } brand model public function valeur() { return $this->morphtomany( 'valeur ', ' valuable '); } i record entry this: brand::where( 'slug', $search)->first(); $id = auth::user()->id; $valeur = valeur::find(3); $brand->valeur()->save( $valeur ); i want "just" associated valeur -> brand user id , please me? thank...

What the <T> means in BeanFactory.java in spring? -

this question has answer here: why java method appear have 2 return types? 3 answers i'm reading spring source code, beanfactory.java have method: <t> t getbean(class<t> requiredtype) throws beansexception; the second t return type, what's first mean? it means method has type parameter. when call object of type class<t> returns object of type t. the first t indication t type parameter.

osx - How to find a SKDownload's transaction on the Mac? -

on ios, skdownload has @property(nonatomic, readonly) skpaymenttransaction *transaction which conveniently allows finish transaction whenever hosted content has been downloaded. on mac though, skdownload doesn't have that, find myself having browse skpaymentqueue , transaction having download. any of doing so? the problem won't reach "finishtransaction" code, don't know how finish transaction otherwise! on ios it's easy, since finish transaction associated download. to sum up, great know how finish transactions downloads on mac. happen implicitly?

python - Exchanging NDB Entities between two GAE web apps using URL Fetch -

i planning exchange ndb entities between 2 gae web apps using url fetch. one web app can initiate http post request entity model name, starting entity index number , number of entities fetched. each entity have index number incremented sequentially new entities. to send entity: delimiter added separate different entities separate properties of entity. http response have variable (say "content") containing entity data. receiving side web app: receiver web app parse received data , store entities , property values creating new entities , "put"ting them both web apps running gae python , have same models. my questions: there disadvantage above method? there better way achieve in automated way in code? i intend implement kind of infrequent data backup design implementation you can use ndb to_dict() method entity , use json exchange te data. if lot of data can use cursor. to exchange entity keys, can add safe key dict.

scala - How can an object access the member of super class -

i write following codes: class testclass(val mem:int) object testobj extends testclass(3){ var sum = 5 def apply(a : int, b :int, ext : testclass) = sum + + b + super.mem + ext.mem } println(testobj(2,4,new testclass(2)) when deleted super.mem method apply, these codes can compiled successfully, want know how can access super member in object? you don't need add super. in front of mem ; use mem , testobj inherits superclass testclass . class testclass(val mem: int) object testobj extends testclass(3) { var sum = 5 def apply(a: int, b: int, ext: testclass) = sum + + b + mem + ext.mem } println(testobj(2, 4, new testclass(2))

javascript - How to change content of multiple divs on click -

i attempting figure out how change content of 2 different, non-contiguous divs, when link clicked. have draft html , javascript, , suspect missing css might key make work. here html: <ul id="tabs"> <li><a href="#">link 1</a> </li> <li><a href="#">link 2</a> </li> </ul> <div id="tabs-container"> <div id="content1">content link 1. should display when link 1 clicked.</div> <div id="content2">content link 2. should display when link 2 clicked.</div> </div> <p>unrelated text here. text in area static , should display @ times.</p> <div id="tabs-container-2"> <div id="content1-2">additional content link 1. should display when link 1 clicked.</div> <div id="content2-2">additional content link 2. should display when link 2 clicked.</div> </div> here ...

php - Error in AJAX Reader -

i doing rss- ajax reader. don't made mistake. unable read .xml file. kindly me. i have given folder permissions 777 in linux. don't think folder permission. think have error in php file. here code index.html <html> <head> <script> function showrss(str) { if (str.length==0) { document.getelementbyid("rssoutput").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("rssoutput").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","getrss.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <form> <select onchange="showrss(this.value)"...

c++ - Code::blocks not detecting Ogre header file? -

i'm still pretty new c++ , have flowed these steps set ogre 3d. seemed working, when went build code, got error: fatal error: ogrecamera.h: no such file or directory . after going through , reviewing, find nothing. ogre_home has correct path , project build options search directories compiler includes: $(ogre_home)\include $(ogre_home)\include\ogre $(ogre_home)\include\ois $(ogre_home)\boost i cant seem figure out why getting problem , results found told me fix these 2 things. appreciated. in codeblocks want goto build options, there click on project name. after click on search directories, click add add 4 of include paths.

sql - Query to calculate term frequency * inverse document frequency -

i have 2 tables in oracle database: df (term, doccount) tf (abstractid, term, freq) one document frequency(df) having terms , documentcount , table term frequency called tf havind documentid, terms, frequency. want calculate tf*idf tf = number of times term appears in article (frequency column table tf) , idf = log (132225)-log(doccount)+1 i want store result in table (tfidf) having documentid, terms , calculated tf*idf any ideas? you need join tf , df tables , insert destination tfidf table. try this: insert tfidf (documentid, terms, tf_idf) select abstractid, df.term, (log(10, 132225)-log(10, doccount)+1)*(tf.freq) tf, df tf.term = df.term;

ms access - Change date format vb.net -

Image
i need change date format following format yyyymmdd edi files below not working leaving orderdatedb in same format dim orderdatedb datetime = orderheaderdt.rows(0).item("orderdate") orderdatedb = format(orderdatedb, "yyyymmdd") this column in db how can convert prooper format in vb.net use string way... tostring("yyyymmdd") you wanted function, here is... public class form1 private sub form1_load(sender object, e eventargs) handles mybase.load 'example usage... dim orderdatedb string = convertdatetime(orderheaderdt.rows(0).item("orderdate")) messagebox.show(orderdatedb) end sub public shared function convertdatetime(byval dtdatetime datetime) string return dtdatetime.tostring("yyyymmdd") end function end class

css - How do I make contents in the middle box centered vertically? -

how make contents in middle box centered vertically? http://jsfiddle.net/9pysu/ : html: <body> <div id="header">header content</div> <div id="bodybox">body content</div> <div id="footer">footer content</div> </body> css: body { } body > div { border-radius:10px; border:2px solid #aaa; padding:10px; text-align:center; } #header { position:absolute; height:50px; top:10px; right:10px; left:10px; } #bodybox { position:absolute; right:10px; top:94px; bottom:94px; left:10px; border-color:#35c12e; background-color:#f0f4f0; } #footer { position:absolute; height:50px; bottom:10px; right:10px; left:10px; border-color:#b24842; } you need add vertical-align . add div wrapper , give display value of table within current div . put div within , give display value of table-cell . demo http://jsf...

winforms - Find out default tab size in C# RichTextBox -

the default size in pixels tab in richtextbox apparently 48 pixels, regardless of font or font size. set default .net without me touching selectiontabs array. i've checked in rtf - there's no \tx control code or heck elusive '48' number stored? i don't want use hardcoded 'magic number' in case other systems use other 48 pixels tab. my own purpose me convert tabs spaces (at least fixed width fonts). finding answer might closer controlling tab size single value without setting 'infinite' array of tab stops implied this answer .

OpenQA.Selenium.NoSuchElementException inside Lambda Expression C# -

Image
i debugging project , have been getting nosuchelementexceptions "unable find element id == txtuserid" while debugging. problem code using lambda expressions return object difficult catch nosuchelementexceptions because makes object out of scope rest of method. try { var wait = new webdriverwait(driver, timespan.fromseconds(10)); var itxtuserid = wait.until(d => d.findelement(by.id("txtuserid"))); //clear textbox 'userid' fill user id itxtuserid.clear(); itxtuserid.sendkeys("userid"); } catch (exception exception) { // have code here handle exceptions } i have read http://watirmelon.com/2014/01/23/checking-an-element-is-present-in-c-webdriver/ suggests writing global variables helper methods prevent these types of errors occuring in first place. however, have heard many developers frown upon use of global variables , can cause problems. feel still necessary able handle exceptions program can on track during runtime. th...

php - PDO Multiple queries: commit and rollback transaction -

i need fire 2 queries. i'm doing this: // begin transaction $this->db->begintransaction(); // fire queries if($query_one->execute()){ if($query_two->execute()){ // commit when both queries executed $this->db->commit(); }else{ $this->db->rollback(); } }else{ $this->db->rollback(); } is correct approach? i'm not using try..catch in code make code inappropriate or vulnerable situation? yes, approach correct. using try...catch may lead cleaner , more readable code in cases overall approach fine. if code fragment function handles db queries , not else, i'd switch approach around: // begin transaction $this->db->begintransaction(); // fire queries if(!$query_one->execute()){ $this->db->rollback(); // other clean-up goes here return; } if(!$query_two->execute()){ $this->db->rollback(); // other clean-up goes here return; } $this->db-...

java - Custom HttpMessageConverter in Spring MVC -

when implementing restful api wrap data in object looks this. {error: null, code: 200, data: {...actual data...}} this results in repetitive code use everywhere wrap data: @transactional @requestmapping(value = "/", method = requestmethod.get) public @responsebody result<list<bookshortdto>> books() { list<book> books = booksdao.readbooks(); return result.ok(books); // gets repeated everywhere } so question how modify (maybe use of custom httpmessageconverter maybe other ways?) return booksdao.readbooks() , wrapped automatically. like @ralph suggested can use handlermethodreturnvaluehandler wrap handlers return value. the easiest way achieve extending requestresponsebodymethodprocessor , alter it's behavior bit. best create custom annotation mark handler methods with. make sure handlermethodreturnvaluehandler called instead of others included requestmappinghandleradapter default. @target({elementtype.method}) @retenti...

php - if and foreach in a templating engine -

i'm working on templating engine (i don't want use existing one) , works fine. code have now: class template { private $vars = array(); public $page; function __construct() { } public function render($render = false) { $page = $this->page . '.php'; $content = file_get_contents($page); foreach ($this->vars $key => $value) { $tag = '{' . $key . '}'; $content = str_replace($tag, $value, $content); } if ($render) echo $content; else return $content; } public function assign($key, $value, $overwrite = false) { if ($overwrite) { $this->vars[$key] = $value; } else if (isset($this->vars[$key])) { echo 'this var exists!'; } else { $this->vars[$key] = $value; } } public function append($key...

linux - redirectioning printf to pipe C -

the code above not give warnings or errors, parent not print string passed pipe. idea? pid_t pid; int fd[2]; int num_bytes_read; char buffer[80]; pipe (fd); pid=fork(); if (pid == 0) {/*son*/ fclose(stdout); close(fd[0]); dup(fd[1]); printf ("write in pipe\n"); fflush(stdout); } else { /*parent*/ close (fd[1]); num_bytes_read = read (fd[0], buffer, sizeof (buffer)); printf ("the received string is: %s\n", buffer); } return (0); in child writing file* have closed (i.e. stdout). dup have assigned fd == 0 descriptor of pipe, structure stdout points remains "closed". either write pipe using write (as suggested @chrk) or close(stdout_fileno) instead of fclose(stdout) , or maybe can reassign stdout new value obtained fdopen .

sql - Automatic connection of a new table in a existing Mysql database -

i have schema on db there tables. have create table schema , have connect others present on schema.i make example: tables present: school(idschool,numstud,idcountry); shop(idshop,idcountry); new table: country(idcountry,....); i want know if there automatic mode connect them (it means not set foreign key manually). i want know if there automatic mode connect them (it means not set foreign key manually). no. how dbms know country.idcountry , school.idcountry given same name intention connected, instead of accidentally? you'll have use alter table ... add foreign key (...) references ... 1 explicitly create foreign key in existing table. 1 or alter table ... add constraint ... foreign key (...) references ... .

html - ▾ and ✓ characters not showing up in IE8 -

Image
im using ▾ , ✓ characters inputted user chant use full html value (something &#10003; ). these working fine in chrome, ff , ie9. in ie8 replaced square character (see image below). when want unicode characters on ie8, use <span class="unicode">unicode characters here</span> and .unicode { font-family: 'dejavu serif'; } @font-face { font-family: 'dejavu serif'; src: url('fonts/dejavuserif.eot'); src:local('dejavu serif'), local('dejavu serif book'), url('fonts/dejavuserif.eot?#iefix') format('embedded-opentype'), url('fonts/dejavuserif.woff') format('woff'), url('fonts/dejavuserif.ttf') format('truetype'), url('fonts/dejavuserif.svg#font') format('svg'); } where dejavu fonts public domain fonts provide wider range of characters. can download .ttf fonts here , , convert them o...

sql - JPA forming query which fails at program running -

i doing following query in jpa: @namedquery(name = playerskill.delete_all_bot_data, query = "delete playerskill s s.player.id " + "in (select p.id player p p.team.id " + "in (select t.id manager m join m.teaminfo t m.localuserid null))") and receiving following exception when calling appropriate dao function, calling jpa named query using executeupdate: 7818 [thread-12] warn o.h.e.jdbc.spi.sqlexceptionhelper - sql error: 0, sqlstate: 42601 7818 [thread-12] error o.h.e.jdbc.spi.sqlexceptionhelper - error: syntax error @ or near "cross" position: 30 7828 [thread-12] error c.m.s.threads.serverinitializer - null javax.persistence.persistenceexception: org.hibernate.exception.sqlgrammarexception: not execute statement @ org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1387) ~[abstractentitymanagerimpl.class:4.2.8.final] @ org.hibernat...

c# - how to create cron job in asp.net(v4.0) to run method every 30mins -

i need guidance on creating , running cron job in asp.net(c#.net) run every 30 minutes.i have created class in have written code getting tweets, facebook feeds. i have created page in have 1 button download tweets , save in database. if want tweets have click on sync button every time. i want create cron job database automatically synchronized new tweets,facebook feeds. thanks you can follow 1 of following approaches create console app logic fetch tweets , feeds, , use task scheduler run every 30 mins. you build windows service, polls feeds within timer , updates db. you checkout this scheduler rough equivalent cron jobs. haven't tried it. check out so

python - Attach file from Google Drive -

i have been trying create templated google drive document jinja2 , email document attached pdf document. so far have managed of stuck on attachment part. error "invalidattachmenttypeerror: invalid attachment type" . and there way improve on bit more efficient. class upload(webapp2.requesthandler): @decorator.oauth_required def get(self): if decorator.has_credentials(): try: body = {'title': 'my new text document', 'description': 'hello world'} template = jinja_environment.get_template('document.html') template_values = {'name': 'simon'} fh = stringio.stringio(template.render(template_values)) media_body = mediaiobaseupload(fh, mimetype='text/html', resumable=false) http = httplib2.http(memcache) http = decorator.http()...

ruby on rails - Savon: user not authorized -

i using savon gem accessing abc financial web services. getting error message user not authorize. using code accessing response @wsdl="https://webservice.abcfinancial.com/wsdl/prospect.wsdl" @basic_auth=["user","pass"] @headers={"authorization" => "basic"} @client = savon.client |globals| globals.wsdl @wsdl globals.basic_auth @basic_auth globals.headers @headers end @message = { :clubnumber=> 'club 0233', :firstname=> 'abc', :lastname=> 'def', :gender=> "male" } response = @client.call(:insert_prospect, message: @message) and getting error message user not authorize . searched didn't find solution. please me. they using jax-ws. according article http://examples.javacodegeeks.com/enterprise-java/jws/application-authentication-with-jax-ws/ (and google) should use login-password in http headers. don't have account on http://abcfinancial.com ca...

php - File upload viewer component in Yii -

is there component in yii can upload , let user view uploaded file after upload: i want single extension handle following files: jpg, png, gift, mp3, wav, docx, doc, pdf , wmv i have tried using xupload not generate previews of files pdf, doc , video files after upload. any suggestions? have wasted hours in searching. i think it's going difficult finding single thing ask. you'll have split upload , view functionality. after upload finishes, determine file type , ajax-return kind of preview-url load. you'll end different viewers you'll have support (one pdf, 1 audio, etc). it's highly unlikely there single previewer out there can handle formats mentioned.

How to show Trello in an iFrame -

i putting dashboard show project progress. it's dead simple page - divided quarters, iframe in each quarter. we use trello our kanban board , want embed in dashboard - unfortunately following message: this content cannot displayed in frame to protect security of information enter website, publisher of content not allow displayed in frame. looking around, prevent clickjacker attacks, wonder if there way round it. my plan b write c# app open 4 browsers , resized them fit quarters of screen, lot more work!

css - Bootstrap 3 Placing Icon inside input field -

i working in bootstrap 3 , trying calendar icon inside right hand side of input box. my html looks this: <div class="col-md-12"> <div class='right-inner-addon col-md-2 date datepicker' data-date-format="yyyy-mm-dd"> <input name='name' value="" type="text" class="form-control date-picker" data-date-format="yyyy-mm-dd"/> <i class="fa fa-calendar"></i> </div> </div> i have tried position: absolute this: .right-inner-addon { position: absolute; right: 5px; top: 10px; pointer-events: none; font-size: 1.5em; } .right-inner-addon { position: relative; } but when great in 1 spot, not positioned correctly in instance. i have tried see if use text-indent see if work throughout, had same effect. .right-inner-addon i, .form-group .right-inner-addon { display: inline-block; ...

javascript - Open Email Desktop Client on clicking a link -

i used mailto:email@example.com to open email send mail. worked in google chrome. not working in other computers. alternate method open mail link?? you should work. can try going chrome://settings/handlers , set value mailto: none instead of gmail

jquery - Adding/Removing Active Class Onclick -

i'm trying add "active" class h3 jquery once heading has been clicked , have removed when h3 clicked. i've tried many examples here on stackoverflow cannot class add. here example of code: <div id="qa-faq0" class="qa-faq cf"> <h3 class="qa-faq-title"><a class="qa-faq-anchor" href="#">frequently asked question #1</a></h3> <div class="qa-faq-answer" style="display: none;"><p>frequently asked question #1 content goes here</p> </div> </div> thanks in advance! try http://jsfiddle.net/aamir/6aruq/1/ $(function(){ var $h3s = $('h3').click(function(){ $h3s.removeclass('active'); $(this).addclass('active'); }); }); or http://jsfiddle.net/aamir/6aruq/2/ $(function(){ $('h3').click(function(){ $('h3.active').removeclass('active'); $(t...

C++ std::map memory management -

i have following c++ code map<long, teleminfov01> lasttelemetry; void updatetelemetry( const teleminfov01 &info ) { lasttelemetry[info.mid] = info; } where teleminfov01 struct the updatetelemetry method called outside of code, passing value, cache , use later. how map manage memory? copying struct in same way, have delete manually after removing global lasttelemetry map? i not control scope of 'info' variable coming method. want cache it's value use in different call. the main reason asking have memory leaks , track down. thanks, stevo the updatetelemetry method called outside of code, passing value, cache , use later. how map manage memory? map keep own copy of class instances, if teleminfov01 implemented dont have worry memory leaks. if allocate memory inside must follow rule of three prevent memory leaks, still better put pointers inside smart pointers (the called rule of zero ). is copying struct in same way, have de...

android studio - The following dependencies were not resolvable. See your build.gradle file for details -

i creating app school , first activity screen says welcome , stuff. there's button says continue , when click on it, supposed take them log in screen , there can log in. right clicked on folder main on android studio , selected new -> activity ->login activity put in info name , package name , when clicked finish error appeared. following dependencies not resolvable. see build.gradle file details. - com.google.android.gms:play-services:4.0.30. install google repository sdk manager.

python 2.7 - wxDialog inside wxWindows -

when wx.dialog created can take position on computer screen , take dimension if style allows. trying build dialogs , confine them within application window. i not sure if question clear, guess online imagine example of need do. in current link, "spectra analysis" exact example of need. http://cdn.altrn.tv/s/b80a7d76-3293-45f2-84dc-07ae136df1c6_1_full.gif the ui in image using multiple document interface, , in wxpython on windows can same ui using wx.mdiparentframe , wx.mdichildframe . sure need because users not mdi , microsoft abandonded in applications long ago.

PHP AJAX response in XML string -

i have web page making ajax call echoes xml string in below format: <ecg>abnormal</ecg><sp>10.99</sp><bp>120/90</bp><oxy>139</oxy><tmp>23</tmp> ajax call $.ajax({ type:'post', url: 'check_status.php', datatype: 'xml', success: function(xml) { var ecg = $(xml).find("ecg").text(); var sp = $(xml).find("sp").text(); var bp = $(xml).find("bp").text(); var oxy = $(xml).find("oxy").text(); var tmp = $(xml).find("tmp").text(); alert(tmp); }, error: function(){ alert('error'); update(); } }); the xml response created php backend script constructing xml string: $resp = "<ecg...

jquery - Tooltipser popup not working for the first mouse over -

i using tooltipser popup in page. and content of tooltipser updating ajax. they working well, if there no image in content. but if there image in ajax content, position of tooltipser first time not correct. second time onwards, comes on correct position (ie on top position) can 1 know reason? following code <script> $(document).ready(function() { $('#test_link').tooltipster({ interactive:true, content: 'loading...', functionbefore: function(origin, continuetooltip) { // we'll make function asynchronous , allow tooltip go ahead , show loading notification while fetching our data continuetooltip(); // next, want check if our data has been cached //if (origin.data('ajax') !== 'cached') { $.ajax({ type: 'post', url: 'example.php', success: function(data) { // update our tooltip content o...

How to search within a particular folder in alfresco -

i have folders in share shared folder. there way specify share search particular file in particular folder of shared folders? we've developed solutions can search within folder through advanced search form: http://addons.alfresco.com/addons/alfresco-share-folder-search it's free download can around how it's done. in short: in 4.2.e can send param rootnode /slingshot/search repo webscript. if check client side javascript in share components/search/search.js there method _buildsearchparams following params send: site={site}&term={term}&tag={tag}&maxresults={maxresults}&sort={sort}&query={query}&repo={repo}&rootnode={rootnode}&pagesize={pagesize}&startindex={startindex} so fill in rootnode qnamepath or noderef , present results of folder.

java - Solve random native crash on LibGDX game -

some of users of android game in i'm working experimenting critical crash hang mobiles. bug happens when game ends (when player die , outside viewport). pretty serious bug, refactored code , problem gone users, not all. the report receive in google play similar this: build fingerprint: 'google/hammerhead/hammerhead:4.4.2/kot49h/937116:user/release-keys' revision: '11' pid: 30442, tid: 30464, name: thread-458 >>> com.mygdxgame.android <<< signal 11 (sigsegv), code 1 (segv_maperr), fault addr 78c0b008 r0 78c0b008 r1 42bd8500 r2 00000188 r3 00000008 r4 753669c0 r5 42bd84f8 r6 b0800005 r7 78c0b008 r8 7547db10 r9 7537fd8c sl 75366a48 fp 7547db24 ip 00000000 sp 7547dae8 lr 75347c54 pc 4009e01a cpsr 60010030 d0 4458c000445b4000 d1 7e37e43c3c000000 d2 0000000000000000 d3 0000000000000000 d4 408b780000000000 d5 bf800000c0000000 d6 0000000000000000 d7 3f80000000000000 d8 408b180000000000 d9 408b1c0000000363 d10 0000000000000000 d11 3f80000000000000 d...

java - Android Adding buttons -

im trying android app gui control arduino using apwidgets library . now have 4 buttons side side .. want add more buttons under each of them.( mean want add button under of red button , on . idont know language . can me ? //setup gui******************************** buttonwidth=((width/n)-(n*gap)); buttonheight=(height/2); widgetcontainer = new apwidgetcontainer(this); //create new container widgets redbutton =new apbutton((buttonwidth*(n-4)+(gap*1)), gap, buttonwidth, buttonheight, "red"); //create red button greenbutton = new apbutton((buttonwidth*(n-3)+(gap*2)), gap, buttonwidth, buttonheight, "green"); //create green button bluebutton = new apbutton((buttonwidth*(n-2)+(gap*3)), gap, buttonwidth, buttonheight, "blue"); //create blue button offbutton = new apbutton((buttonwidth*(n-1)+(gap*4)), gap, buttonwidth, buttonheight, "off"); //create off button widgetcontainer.addwidget(redbutton); //place red button in container widg...

Can't assign values from query to array variable in Access -

i have query output cols date, type, value. need gather different dates variable can later create csv file each unique date. tried creating record set, , assigning values of date variable such: sub getdates() dim rst recordset dim db database dim arrdates variant set db = currentdb set rst = db.openrecordset("select date output group date; ") arrdates = rst.getrows() but when do: for each item in arrdates debug.print (item) next i 1 date printed (11/01/2012). if run query in access, see 15 months. i had specify number of rows: arrdates = rst.getrows(rst.recordcount) a better solution, recommended remou: do until rst.eof debug.print rst!date rst.movenext loop edit: reading wrong msdn help.

javascript - Change display via click -

function sg() { x = document.getelementbyid("cai"); g = x.style.display; if (g == "none") { g == "block" } else { g == "none" }; } window.onload = zmena; function zmena() { document.getelementbyid("matek").onclick = sg; } why isnt script working firstly, can't assign value variable : 'g == "block"' . logical operation, not assignment. secondly, can wrap if else stuff in 1 string using short form, shown below : function sg() { x = document.getelementbyid("cai"); x.style.display = x.style.display == 'block' ? 'none' : 'block' }

clojure - How do I update a record in a vector, matching certain criteria? -

i'm trying update records in vector, match criteria. (defrecord item [id name description]) (def items (ref [ (->item "1" "cookies" "good tasting!") (->item "2" "blueberries" "healthy!") ]) ) how can e.g. "set name of item "foo" id equal 1"? i maybe need like (dosync (commute items ???? )) can't figure ???? i found e.g. function update-in in docs but 1. can't find examples records, 2. not sure if can use update different field 1 i'm using query. in examples fields seem same. the complete use case: have webservice update operation, map id of item , optional fields have updated. i'm new clojure. implemented remove function, id, works: (commute items #(remove (fn [x](= (:id x) id)) %)) also find id, might step in direction update: (nth (filtered (filter #(= (:id %) id) @items)) 0) but don't know how update record in vector... yo...

objective c - Parse loading Image into UIImageView iOS -

here code data passing on scene image: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [super tableview:tableview didselectrowatindexpath:indexpath]; rowno = indexpath.row; pfuser *currentuser = [pfuser currentuser]; pfquery *query = [pfquery querywithclassname:@"photo"]; [query wherekey:@"username" equalto:currentuser.username]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { _photo = [objects objectatindex:rowno]; }]; [self performseguewithidentifier:@"showimagecloseup" sender:self]; } -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender{ imagecloseupviewcontroller *destination = [segue destinationviewcontroller]; destination.photoobject = _photo; } and here code loads image: - (void)viewdidload { [super viewdidload]; pffile *p = [_photoobject objectforkey:@"photo"]; [p getdatainbackg...

android - Missing contentDescription attribute on image how to remove this warning? -

accessibility missing contentdescription attribute on image <imageview android:id="@+id/imageview1" android:layout_width="34dp" android:layout_height="61dp" android:layout_marginleft="11dp" android:layout_marginright="0dp" android:layout_margintop="11dp" android:background="#ff3333" android:src="@drawable/arrows" /> you can use layout editor's tools or set android:contentdescription null . here's example: // don't need framelayout, // tell layout editor "ignore" in layout's parent <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:ignore="contentdescription" > <imageview android:id="@+...

php - ZendFramework2 posting form -

here method should send forms data database, can't figure out why doesn't work.there no errors showing data not inserted in table. glad if can me out! //method add data database public function addaction() { //add user info $form = new userform(); $form->get('submit')->setvalue('add new info'); $request = $this->getrequest(); if($request->ispost()){ $user = new user(); $form->setdata($request->getpost()); if($form->isvalid()){ $user->exchangearray($form->getdata());//method gets validated data $this->getusertable()->saveuser($user); return $this->redirect()->toroute('application',array( 'controller'=>'user', 'action'=>'index' )); } } //pass view $values = array('form'=>$form); $view = new viewmodel($values)...

npm - Gulp issues with cario install command not found when trying to installing canvas -

i'm new working in command line. have project i'm setting gulp, , have gulp installed , compiling sass files successfully. however, cannot install canvas via: $ npm install canvas i need install canvas because of dependencies css-sprite has run. getting following error. have installed cairo, quartz, , homebrew installed. i've researched other tickets , tried run export pkg_config_path=/opt/x11/lib/pkgconfig , install again. i've had no luck, , have no idea else in attempts troubleshoot. here error... npm http https://registry.npmjs.org/canvas npm http 304 https://registry.npmjs.org/canvas npm http https://registry.npmjs.org/nan npm http 304 https://registry.npmjs.org/nan canvas@1.1.3 install /usr/local/lib/node_modules/canvas node-gyp rebuild ./util/has_cairo_freetype.sh: line 4: pkg-config: command not found gyp: call './util/has_cairo_freetype.sh' returned exit status 0. gyp err! configure error gyp err! stack error: `gyp` failed exit code: 1 g...

javascript - .bind() not working in firefox -

i have following simple javascript code wrote scroll terms , conditions textarea , after scroll reaches @ end of terms , conditions textarea should enabled accept checkbox , working in chrome not in ff , ie please . javascript code: $('#blogger_agreement').bind('scroll', function() { alert('hiii'); if($(this).scrolltop() + $(this).innerheight() >= $(this)[0].scrollheight) { $('#termsofservice').removeattr('disabled'); } }); html : <div class="control-group"> <label class="control-label"><br/> </label> <div class="controls"> <textarea name="blogger_agreement" id="blogger_agreement" class="deadline_date" rows="15" cols="15" style="resize: none;background-color:white; overflow-y: scroll; height: 350px;" disabled > <?php $file_handle = fopen(folder_path_http."...

serialization - Generate Avro Schema from certain Java Object -

apache avro provides compact, fast, binary data format, rich data structure serialization. however, requires user define schema (in json) object need serialized. in case, can not possible (e.g: class of java object has members types external java classes in external libraries). hence, wonder there tool can information object's .class file , generate avro schema object (like gson use object's .class information convert object json string). take @ the java reflection api . getting schema looks like: schema schema = reflectdata.get().getschema(t); see example doug on question working example . credits of answer belong sean busby.

html - PHP file upload returns empty file type -

i have simple upload image works on 1 page returns empty file name in page if (isset($_post['upload_img'])) { $file_name = $http_post_files['img']['name']; $random_digit=rand(0000000,9999999999); $new_file_name=$random_digit.$file_name.'.jpg'; $path= "images/".$new_file_name; echo"$file_name"; } and html form <form role="form" action="" method="post" enctype="multipart/form-data"> <div class="form-group"> <label for="exampleinputfile">upload image</label> <input type="file" id="exampleinputfile" name="img"> </div> <p><a href="">terms , conditions</a></p> <button type="submit" class="btn btn-default btn-block" name="upload_img">upload </button> </form> any idea whats wrong? thank in adva...

c# - SyntaxError exception in Ciloci.Flee.ExpressionContext -

while using flee got exception message "syntaxerror: unexpected character: line: 1, column: 1" when trying use character in expression string. expressioncontext ec = new expressioncontext(); ec.variables.add("i", 1); ec.variables.add("b", 4); ec.variables.add("p", new point(0, 0, 0)); string exp = "i > b"; idynamicexpression de = ec.compiledynamic(exp); bool o = (bool)de.evaluate(); //syntaxerror: unexpected character: line: 1, column: 1 same thing happens "point.x > 0" well. i has problem, can replace formula , variables "i" , works. .replace("i", "i")

c# - Turning bit type into a dropdownlistfor -

i have bit type in sql database want turn dropdownlist . i pass model page has active field. field either true or false. i'm adding ability modify column in database. is possible create dropdownlistfor give them option of "active" "disable" , return correct value database? @html.dropdownlistfor(m => m.active, ??) @model.active i have never tried how this: @html.dropdownlistfor(m=> m.active, new list<selectlistitem>() { new selectlistitem { text = "active", value = "true", selected = model.active }, new selectlistitem { text = "inactive", value = "false", selected = model.active } })

How do I permanently change a shortcut's target path with perl script? -

i trying figure out perl's win32::shortcut module, , how change shortcut paths said module. personal project , plan manage shortcuts script #!/usr/local/bin/perl use win32::shortcut; use strict; $link; $link = new win32::shortcut(); $link->load("c:\\users\\jimbo\\desktop\\vlc media player.lnk"); $link->{'path'} = "http://www.google.com//"; $link->save(); $link->close(); the script runs without issue, when click on shortcut loaded opens vlc media player instead of google.com. it may appear succeed didn't include error checking. try this: $link->load("c:\\users\\jimbo\\desktop\\vlc media player.lnk") or die "$! ($^e)";

Python - reading lines of text, exploring html, and writing to a document within a single for loop -

i going try ask question in general way, realized it's little complicated me try , describe generally. here specifically: i'm not programmer. i'm master's candidate in experimental psychology , side project statistics class created model predicting game purchases on steam. started learning how program in order collect data project. my program far follows: #the first line opens list of random steam ids created, #the second assigns them variable list = open('d:\python\steamuserids.txt').read().splitlines() steamid = str(list) #for purposes of figuring things out, i'm using first 10 entries in list #the next 4 lines url requests , assigning output variable "response" steamid in list[0:10:1]: request = urllib2.request('http://api.steampowered.com/iplayerservice/getownedgames/v0001/?key=mysteamapikey&steamid=%s' %steamid, headers={"user-agent": "mozilla/5.0 (windows nt 6.2; win64; x64) applewebkit/537.36 (kht...