Posts

Showing posts from September, 2012

jquery - bootstrap scrollspy first li only is highlighted -

i trying use scrollspy spy on set of dyanamically generated instructions, it's not working. first li item highlighted regardless of page position. body tag follows <body data-spy="scroll" data-target=".stickysteps"> and how scrollspy activated <% if manual.present? && manual.steps.present? %> <div class="stickysteps"> <ul class="nav nav-pills"> <% n = 0 %> <% @manual.steps.order(:priority).each |step| %> <li><a href="#step<%= n+1 %>"><h4>step <%= n + 1 %></h4></a></li> <% n += 1 %> <% end %> </ul> </div> <h1 style="margin-left: 20px;">your instructions:</h1> </br> <% steps = manual.steps.order(:priority) %> <%= render(steps.order(:priority), steps: steps) %> <% end %> <script type="text/javascript"> $('.stickysteps

jsf - ui:repeat with a list sending right object to a p:dialog -

i have giant ui:repeat. within ui:repeat, of repeated objects have url popup image associated them. when clicks display under particular object, need url popup in p:dialog. <ui:repeat var="thing" value="#{bean.thinglist}"> <p:commandlink value="details" onclick="miniimage.show();" update=":#{p:component('chart')}" action="#{bean.setcurrentimg(thing.imageurl)}" rendered="#{thing.includeimage}"> </p:commandlink> </ui:repeat> and @ bottom of page: <p:dialog id="chart" widgetvar="miniimage" > <h:graphicimage value="#{bean.currentimg}"/> </p:dialog> and in backing bean tried using simple setter , getter currentimg. i bit confused on , accomplish without having submit entire form well. appreciated. if you're using primefaces 3.3 or newer , add partialsubmit="true" command component. ca

java - best way or similar lambda expression or linq on android (eclipse) -

for example if have arraylist<product> productlist = new arraylist<product> (); how products product.code equals 1 , 2? is there library can use? in c# use productlist.where(product=> product.code.contains(arraywithproductcode)).tolist(); or other way using var newlist=(from p in productlist join in arraywithproduct on a.product equals select p); how can in java android? no lambda expressions in android (or java) yet. you might want see these options (haven't tested them in android though): quaere: http://quaere.codehaus.org jaqu: http://www.h2database.com/html/jaqu.html linq4j: https://github.com/julianhyde/linq4j slick: http://slick.typesafe.com/ also, see this dzone link , this one . stackoverflow post mentions this . update : lambda expression available in java se 8 more information visit: lambda expressions

javafx 2 - Set border size -

Image
i want make border of borderpane more round , bold. i tested code: bpi.setstyle("-fx-background-color: linear-gradient(to bottom, #f2f2f2, #d4d4d4);" + " -fx-border: 12px solid; -fx-border-color: white; -fx-background-radius: 15.0;" + " -fx-border-radius: 15.0"); i result: how can fix this? why current approach doesn't work don't use -fx-border (it doesn't exist in javafx css). though there other fx-border-* attributes such -fx-border-color , -fx-border-width , -fx-border-radius , wouldn't recommend them either. suggested approach instead, use combination of layered attributes: -fx-background-color -fx-background-insets -fx-background-radius you can find documentation on these css attribute features in javafx css reference guide . although using -fx-background-* attributes border seems strange: it way of borders in default javafx modena.css stylesheet handled

css - Where @font-face saves font files on your computer? -

i using @font-face refer new fonts , works fine. my question is: font files downloaded computer website being visited or stored temporarily? not stored in control panel -> fonts. so browser cache or computer can have font used in other software word etc? thanks help. the short answer no. when they're used in webpage browser stores them temporarily. have install font separately other uses mentioned.

Yii and Wordpress Admin Integration -

i have integrated yii , wordpress works totally fine url management using article http://www.yiiframework.com/wiki/322/integrating-wordpress-and-yii-still-another-approach-using-yii-as-the-router-controller/ now want save yii models wordpress, want access yii models functions.php unable load model directly. i tried if (is_admin()) { global $yii,$config; if (is_null($yii)) { $yii = abspath . '../../framework/yii.php'; $config=abspath. '../protected/config/main.php'; } require_once($yii); yii::createwebapplication($config)->run(); } but saying wp-theme directory not there... want save model yii itself, how ?

jquery - Get a previous date based on a future date using Javascript -

ideally take input field attach datepicker have pick future date in time example. [today 08/09/2013 @ time of writing , 07/31/2013 in return.] i want no matter date picked, input field using javascript, default value wednesday prior week in-which initial selected date value. function getwednesday(date) { var d = (date.getday() == 0 ? 6 : date.getday() - 3); date.settime(date.gettime() - (d * 24 * 60 * 60 * 1000)); return date; } this return wednesday of current week. understanding of javascript functions getday return 0-6 representing sun-sat. settime function takes string of milliseconds since january 1, 1970 , convert actual date in time , gettime exact opposite. i'm not sure im taking right approch have solid solution problem. in advance help ok, here's clever way can think of: function prevwed(indate){ var adder=(3-indate.getday()); var d=new date(indate.getfullyear(), indate.getmonth(), indate.getdate() + adder - 7); return d } even

python - Skipping to Next item in Dictionary -

when iterating through dictionary, want skip item if has particular key. tried mydict.next() , got error message 'dict' object has no attribute 'next' for key, value in mydict.iteritems(): if key == 'skipthis': mydict.next() # others complicated process i using python 2.7 if matters. use continue : for key, value in mydict.iteritems(): if key == 'skipthis': continue also see: are break , continue bad programming practices?

Why is the animation duration of jquery's animate function inconsistent? -

please have @ these simple jquery animations: animate.mouseenter(function () { animate.stop().animate({ opacity: 0 }, duration); }); animate.mouseleave(function () { animate.stop().animate({ opacity: 100 }, duration * 10); }); my questions: why animation time of these 2 animations more or less equal, although duration multiplied 10 mouseleave animation? is there particular reason behavior? is factor 10 or other floating point value close 10? here working fiddle: http://jsfiddle.net/tcmjd/3/ i added example of fadein and fadeout functions, equal duration parameters yield equal animation times should be. because opacity of 1 opaque. you're animating way 100, hits 1 pretty quickly. http://jsfiddle.net/e8n4q/ var animate = $(".animate"), fade = $(".fade"), duration = 500; animate.mouseenter(function () { animate.stop().animate({ opacity: 0 }, duration); }); animate.mouseleave(function () { animate.stop().animat

audio - Output sound using JavaScript -

this question has answer here: playing audio javascript? 10 answers i want make online metronome using javascript. people around me started needing them there isn't decent 1 doesn't use flash. thought why not. before starting want make sure it's possible javascript. need know if it's possible output sound, if rest should simple enough. so possible? if yes, how? p.s.: checked html5 audio tag , don't think it's gonna work. it's not 1 long file metronome sounds. it's loop runs sound every time should. the audio tag right tool this: https://developer.mozilla.org/en-us/docs/web/html/element/audio create audio tag - like: <audio id="m" loop> <source src="metronome.mp3"> </audio> and either make loop using appropriate options on tag (loop), or can script in js: <script>

Python: Update Sensor Data to Variable -

i have temperature , pressure gauge want use track temperature on time with. since may end multiple sensors on time, want able reference bmp085 sensor tp . in other words, call tp.temp or tp.pressure obtain current temperature, etc. problem tp.temp or .pressure not updating each time call it. suggestions? #!/usr/bin/env python #temperature logger bmp085 temperature , pressure sensor on raspberry pi adafruit_bmp085 import bmp085 time import sleep import pickle, sys, os class tps(): def __init__(self): #temperature/pressure sensor setup self.bmp = bmp085(0x77) self.temp = self.bmp.readtemperature()*1.8+32 self.pressure = self.bmp.readpressure()*0.0002953 class data(): def __init__(self): self.tp = tps() self.savedata() def savedata(self): # if os.path.exists("data.dat")==true: # if os.path.isfile("data.dat")==true: # filehandle = open ( 'data.dat' ) #

ios - NSNotificationCentre Crash -

in application listen keyboard notifications: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillshow) name:uikeyboardwillshownotification object:nil]; i have removed bug caused crash in app, i have modal view ui (which gets destroyed , recreated each time it's presented. i getting crash second time went use before added line of code: [[nsnotificationcenter defaultcenter] removeobserver:self]; any 1 know why not removing observer dealloced object caused crash? this because when notification, if havent removed class observer, still tries calling method. however, since object has been deallocated , destroyed, exc_bad_access.

php - Multiple WP_Query With Custom Post Type & Pagination -

basically have 2 post types set up, "dog" , "cat". have page template 2 wp_query loops displaying 2 latest posts each post type in each loop. below how i'm registering post types: <?php function cat_post_type() { register_post_type( 'cat', array('labels' => array( 'name' => __('cats', 'bonestheme'), 'singular_name' => __('cat', 'bonestheme'), 'all_items' => __('all cats', 'bonestheme'), 'add_new' => __('add new', 'bonestheme'), 'add_new_item' => __('add new cat', 'bonestheme'), 'edit' => __( 'edit', 'bonestheme' ), 'edit_item' => __('edit cats', 'bonestheme'), 'new_item' => __('new cat', 'bonestheme'), 'view_item' => __('vie

php - Magento custom module adds HTML block to header -

i'm creating custom module magento , cleanest way found add html code header create own block in module , add php code render block in template header.phtml. i'm wondering there way less intruding having codes in module folder? thanks :) <reference name="header"> <block type="your_module/yourblockclass" name="yourblockname" template="your_module/yourtemplate.phtml"/> </reference> add code above default-layout-handle in custom layout.xml file. fetch block via $this->getchildhtml('yourblockname') from within header.phtml file. good luck!

iphone - How to update data on the main thread after running code in the background? -

i have dispatch_queue code i'm using make 3 different data requests. i'm updating tableview on main thread. else can put in main thread? i'm using [self requestextendeddata]; download data web service parsed , set uilabels etc... my question is: if have [self requestextendeddata]; running in background thread how update uilabels content data in main thread? should put else in main thread area? uiview, uilabels , uibutton objects etc... thanks help dispatch_queue_t jsonparsingqueue = dispatch_queue_create("jsonparsingqueue", null); // execute task on queue asynchronously dispatch_async(jsonparsingqueue, ^{ [self requestuserdata]; // request user comments data [self requestextendeddata]; // request extended listing info data [self requestphotodata]; // request photo data // once done, if need can call // code on main thread (delegates, notifications, ui updates...) dispatch_async(dispatch_get_main_queue(), ^{ [self.t

How do I specify exact positioning and font attributes an an iOS (iPhone / iPad) design document? -

my biggest issue designer working ios developers helping them translate psds iphone/ipad in pixel perfect manner. my developer told me large company build app provided him design specification sheet ultra specific, outlined exact positioning of every element, font size, line height, etc. prepare design document specify: exact positioning of elements exact spacing between each element font sizes line heights of fonts colors what types of measurements should use each of above? suggest resources on web this? thank time. if haven't looked @ apple human interface guidelines place start. required screen resolution information in there. can give developer required spatial info in pixels. an iphone 5 have coordinate of (0,0) top left corner of screen , bottom right (320, 568). for positioning elements, (x-coordinate, y-coordinate, width, height) in pixels. spacing between elements: number of pixels font sizes in points. line height in pixels or em colors

PHP variable with HTML formatting -

here variable getting mysql database: <h1>this h1</h1> <p>not bold</p> <p>&nbsp;</p> <p><strong>bold</strong></p> i using tinymce format code. here how echo it <?php // while loop getting $row mysql $concontent = $row['content']; then, when go page, displays output this... http://i.snag.gy/bbmqx.jpg i want variable make echo formatted. have html formatting. can check html source of output? html still around? looks strip_tags() or htmlpurifier removes html. otherwise either see formatting applied or tags in output. if have html code in database don't have in php, can directly print it.

Contact Form PHP not being sent to email -

hello have contact form php theme purchased. i've been trying make customized form no luck. tried changing variables around work 1 made myself not being sent email want information go to. this have in html <form id="" action="application/application.php" method="post" class="validateform" name="send-contact"> <div id="sendmessage"> message has been sent. thank you! </div> youtube channel name <br> <input type="text" name="youtubename" placeholder="* enter youtube name"> <div class="validation"></div> first name <br> <input type="text" name="firstname" placeholder="* enter first name"> <div class="validation"></div> last name <br> <input type="te

c# - WPF desktop application with multiple views -

i have wpf application running on windows 8. one-window application has 3 different views in whole client area of main window: live video webcam, screen, , resource usage status. can see not related or interact each other, want show them in 1 window rather poping new window. views switched clicking button in each view or typing keyboard shortcut. i'm implementing each view using usercontrol, , adding/removing usercontrols in grid of mainwindow on user events. i'm not sure if using usercontrol right direction because usercontrol brings image of small widgets buttons rather whole window content me. am doing correctly? looked @ page control, i'm not sure if idea. in advance! i'm implementing each view using usercontrol, , adding/removing usercontrols in grid of mainwindow on user events. i'm not sure if using usercontrol right direction because usercontrol brings image of small widgets buttons rather whole window content me. there nothing wrong u

ruby on rails - model validation errors not rendered with render :action => "index" -

i working on simple youtube list app user can add videos list. validating presence of video_id field. class track < activerecord::base attr_accessible :title, :thumbnail_url, :video_id validates :video_id, :presence => true end i have following create function defined in controller: def create #fetches video info, stores in @trackinfo if is_url(params[:track][:query]) @trackinfo = gettrackinfo(params[:track][:query]) else @trackinfo = youtubequery(params[:track][:query]) end #use @trackinfo create track object @track = track.new(@trackinfo) @tracks = track.all @video_ids = track.pluck(:video_id) if @track.save else render :action=>"index" end end in index.erb.html have following block: <%= render partial: "error_message" %> the corresponding _error_message.erb.html contains error messages validation: <% if @track.errors.any? %> <% @track.errors.full_messages.each |msg| %>

c# - ajaxToolkit:AjaxFileUpload capture file description -

i'm trying filedescription asp:textbox save db when user clicks upload it's coming blank. doing wrong? this in upload.aspx file <ajaxtoolkit:ajaxfileupload id="ajaxfileupload1" throbberid="mythrobber" onuploadcomplete="ajaxfileupload1_uploadcomplete" contextkeys="" allowedfiletypes="jpg,jpeg,doc,xls" maximumnumberoffiles="1" runat="server"/> </div> file description<asp:textbox id="filedescription" width="200" runat="server" ></asp:textbox> , in upload.cs file protected void ajaxfileupload1_uploadcomplete(object sender, ajaxcontroltoolkit.ajaxfileuploadeventargs e) { string sfiledescription = filedescription.text; string filepath = "~/" + e.filename; ajaxfileupload1.saveas(filepath); } let's add individua

java - Android Holoeverywhere Proguard hell -

i getting following error while testing app in release mode, proguard obfuscation: 08-09 21:44:06.140: e/androidruntime(4465): fatal exception: main 08-09 21:44:06.140: e/androidruntime(4465): java.lang.exceptionininitializererror 08-09 21:44:06.140: e/androidruntime(4465): @ java.lang.class.newinstanceimpl(native method) 08-09 21:44:06.140: e/androidruntime(4465): @ java.lang.class.newinstance(class.java:1409) 08-09 21:44:06.140: e/androidruntime(4465): @ android.app.instrumentation.newapplication(instrumentation.java:957) 08-09 21:44:06.140: e/androidruntime(4465): @ android.app.instrumentation.newapplication(instrumentation.java:942) 08-09 21:44:06.140: e/androidruntime(4465): @ android.app.loadedapk.makeapplication(loadedapk.java:461) 08-09 21:44:06.140: e/androidruntime(4465): @ android.app.activitythread.handlebindapplication(activitythread.java:3264) 08-09 21:44:06.140: e/androidruntime(4465): @ android.app.activitythread.access$2200(activitythr

winforms - How can I open and keep open the command prompt from a windows form application in c++? -

this question has answer here: how can keep open command prompt in windows form application in c++? 2 answers i wrote windows form application in c++ , visual studio 2010 , win7 need open command prompt , type special command run other program. i use function : system("cmd.exe /c dir c:\"); but showed second , disappeared! use solve: cin.get(); but not work! also tried function : char program[] = "c:\windows\system32\cmd.exe"; winexec((lpcstr)program, sw_showminimized); but not work. can me please ? thank much! use system("cmd.exe /c dir c:\\");

appender - How to finalize log file just after time is over when using logback SizeAndTimeBasedFNATP? -

my object size(10m) , time(daily) based compressed(zip) archiving, write config this: <appender name="behavior" class="ch.qos.logback.core.rolling.rollingfileappender"> <encoding>utf-8</encoding> <rollingpolicy class="ch.qos.logback.core.rolling.timebasedrollingpolicy"> <filenamepattern>${log_home}/%d{yyyy-mm-dd}.%i.log.zip</filenamepattern> <timebasedfilenamingandtriggeringpolicy class="ch.qos.logback.core.rolling.sizeandtimebasedfnatp"> <maxfilesize>10mb</maxfilesize> </timebasedfilenamingandtriggeringpolicy> </rollingpolicy> <layout class="ch.qos.logback.classic.patternlayout"> <pattern>%d{yyyy-mm-dd hh:mm:ss.sss} %logger{50} - %msg%n </pattern> </layout> </appender> but meet problem. example, today aug 10th, logback writing log file "2013-08-10.0.log&quo

How can I properly add CSS and JavaScript to an HTML document? -

this might very stupid question. i'm trying add empty css file, empty javascript file , jquery library basic of html files, follows: <html> <head> <title>testing</title> <link rel="stylesheet" type="text/css" href="theme.css"> <script language="javascript" type="text/javascript" src="jquery-2.0.3.js" /> <script src="application.js" /> </head> <body> <h1 class=test>this test! hello, world!</h1> </body> </html> however, doesn't work. h1 doesn't display in browser when link or of script s present, displays otherwise. what doing wrong here? why doesn't work, , how can make work? thank much, eden. your <script> tags cannot self closing. try changing them <script src="..." type="text/javascript"></script>

nosql - Handling quorum writies fail on Cassandra -

according datastax documentation atomicity in cassandra: quorum write succeeded on 1 node not rolled (check atomicity chapter there: http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/dml/dml_about_transactions_c.html ). when performing quorum write on cluster rf=3 , 1 node fails, write error status , 1 successful write on node. produces 2 cases: write propagated other nodes when became online; write can lost if node accepted write broken before propagation. what best ways deal such kind of fails in let hypothetical funds transfer logging? when quorum write fails "timedout" exception, don't know if write succeeded or not. should retry write, , treat if failed. if have multiple writes need grouped together, should place them in "batch", batch succeeds or fails together. in either case, want doing quorum reads if care consistent results coming back. if had rf=3, , quorum write got on 1 node, first time quorum

mysql - Get posts of a thread and 0 or 1 if the user asking liked the post -

one more time turn asking mysql, not best skill. in fact, seems not complex. simplified scenario, have 2 tables, 1 posts, likes posts: table post_forum structure id thread post likes user_id created table likes_to_post structure id post_id user_id created this query obtain posts $start $next thread $thread_id: $query = "select post_forum.id, post_forum.user_id, post_forum.post, post_forum.likes, post_forum.created post_forum post_forum.thread ='{$thread_id}' order post_forum.id desc limit $start,$next"; what want por every post, 0 or 1 value field saying if user $user_id has liked every post, being $user_id id of user asks post, in 1 query if possible. lot in advance, appreciated. $query = "select a.id, a.user_id, a.post, a.likes,

javascript - Pass Data string using ajax to controller method -

i creating filter list. have several multi-select lists user can choose several options. problem using ajax return values , call controller method return json data displayed on website. problem doesn't work. controller method: [httppost] public actionresult filterdata(string a, string b, string c, string d){ //do strings e.g. filter data. return json(result, jsonrequestbehavior.allowget); } ajax method getting filtered data: $(document).ready(function() { $("#submitbtn").click(function() { var ab = $('#selectedid1').val(); var bc = $('#selectedid2').val(); var cd = $('#selectedid3').val(); var de = $('#selectedid4').val(); $.ajax({ contenttype: "application/json; charset=utf-8", url:"/controller/filterdata", type: "post", data: json.stringify({a: ab, b: bc, c: cd, d:de }), success: function(result){ } error: function(){} }); return

mysql - how to fetch data from two tables -

i have 2 tables table a imei_no | user_name | date_of_allocation | date_of_deallocation 123 | | 1-4-2013 | 10-4-2013 456 | | 10-4-2013 | 25-4-2013 789 | | 25-4-2013 | 30-4-2013 123 | b | 25-4-2013 | 27-4-2013 table b imei | lat | long | gpsdate 123 | 23 | 43 | 2-4-2013 123 | 23 | 43 | 2-4-2013 456 | 23 | 43 | 3-4-2013 123 | 23 | 43 | 3-4-2013 789 | 23 | 43 | 24-4-2013 123 | 23 | 43 | 24-4-2013 456 | 23 | 43 | 28-4-2013 123 | 23 | 43 | 28-4-2013 i want imei of particular user date 5-4-2013 25-4-2013 doin this: select imei user_name='a' , date_of_allocation>='5-4-2013' , date_of_deallocation<='25-4-2013'; and want data of user table b. how can that. select imei of user date date,then data of imei user table b yo

java - create slide show with button bar -

i want make main activity changing ground swipping image , and on left side want put button bar contain 4 buttons move 4 different activities write folloning code : public class mainactivity extends activity { button[] buttons = new button[4]; sharedpreferences fsc; private static final int swipe_min_distance = 120; private static final int swipe_threshold_velocity = 200; private viewflipper mviewflipper; private context mcontext; private final gesturedetector detector = new swipegesturedetector(); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_main); setrequestedorientation(activityinfo.screen_orientation_portrait); addlisteneronbutton(); setcontentview(r.layout.activity_main); mcontext = this; mviewflipper = (viewf

javascript - How to draw a percentage of an outline of a circle -

i'm looking draw line around multiple circles, percentage of way round. need entering specific percentage's dynamically draw these circles, current method of starting , ending angle causing problems: var data = [ {id:'firefox', angle:90-90}, {id:'chrome', angle:144}, {id:'ie', angle:72}, {id:'opera', angle:28.8}, {id:'safari', angle:7.2} ]; data.foreach(function(e){ var canvas = document.getelementbyid(e.id); var context = canvas.getcontext('2d'); context.beginpath(); context.arc(64, 64, 60, 1.5*math.pi, e.angle, true); context.linewidth = 8; context.linecap = "round"; context.strokestyle = '#c5731e'; context.stroke(); }); var data = [ {id:'firefox', percent:100}, {id:'chrome', percent:50}, {id:'ie', percent:25}, {id:'opera', percent:33.33}, {id:'safari', percent:66.66} ]; data.foreach(fu

android - Send emails without user interaction -

what best way send emails without using intents? i using android gmailsender, , worked great until recentily. still works android 4.0 , bellow, gives ssl error on version 4.2. the error: got javax.net.ssl.sslhandshakeexception: com.android.org.bouncycastle.jce.exception.extcertpathvalidatorexception: not validate certificate: current time: sat jan 01 03:20:30 eet 2000, validation time: thu jun 21 03:00:00 eest 2012 while executing fetchsessionlessappinfo, retrying on safe network stack i fount issue. turns out took out battery out of phone , certificate somehow linked current time. 'at jan 01 03:20:30 eet 2000' not current time .. should of tipped me off. thanks anyways answers.

php - How to count who has most hits in MySQL -

i have table column called bid , list how many records there exists each bid value. kind of making top ten list. example: bid value 1 has 5 entries/rows. bid value 2 has 3 entries/rows. bid value 3 has 8 entries/rows. etc how make query counts , sums each of bid's , sort in descending order? thankful kind of help! this should work in mysql select u.firstname, t.bid, count(*) counts your_table t join users u on u.bid = t.bid t.confirmed <> '0000-00-00 00:00:00' group t.bid order counts desc generally can do select u.firstname, t.bid, t.counts ( select bid, count(*) counts your_table confirmed <> '0000-00-00 00:00:00' group bid ) t join users u on u.bid = t.bid order t.counts desc

python - Unwrap "a" tag from image, without losing content -

i wanted remove 'a' tag (link) images found. hence performance made list of images in html , wrapping tag , remove link. i using beautifulsoup , not sure doing wrong, instead of removing tag removing inside content. this did from bs4 import beautifulsoup html = '''<div> <a href="http://somelink"><img src="http://imgsrc.jpg" /></a> <a href="http://somelink2"><img src="http://imgsrc2.jpg /></a>" ''' soup = beautifulsoup(html) img in soup.find_all('img'): print 'this begining /////////////// ' #print img.find_parent('a').unwrap() print img.parent.unwrap() this gives me following output > >> print img.parent() <a href="http://somelink"><img src="http://imgsrc.jpg" /></a> <a href="http://somelink2"><img src="http://imgsrc2.jpg /></a> > >>

jquery - Refresh new element -

Image
to make sure items dynamically created intercepted events using method .on : $('body').on('click', '.element',... but if wanted intercept new elements of plugin, how can do? for example using plugin tooltip bootstrap: jsfiddle if create new element, ensure intercepted tooltip plugin have call again: $('a').tooltip(); this system not have continually repeat code every new element create .. so there way refresh elements? you can use selector delegation option. see docs: http://twitter.github.io/bootstrap/javascript.html#tooltips $('body').tooltip({ placement:'bottom', selector: '[data-toggle=tooltip]' }); demo:

alfresco - What is the purpose of <role> within association definition in a content model? -

i noticed within person model (didn't pick on first time): <associations> <association name="cm:avatar"> <source> <role>cm:avatarof</role> <!-- purpose of this?? --> <mandatory>false</mandatory> <many>false</many> </source> <target> <class>cm:content</class> <role>cm:hasavatar</role> <mandatory>false</mandatory> <many>false</many> </target> </association> </associations> i duplicating association own model , know it's significance of element within associations. the info informational only, value can retrieved via javascript api. information can found here: https://issues.alfresco.com/jira/browse/mnt-7403

Aligning markers for individual points in matplotlib and removing "double" legend for markers in matplotlib in Python -

Image
i trying figure out alignment of markers in "ax.plot" . apart plotting 2 bar graphs, need plot 2 points, 1 per bar graph. here's looking -: centering/alignment of markers ('o' , ' ' here, in center of each bar, rather @ edge of bar graph. "o" should come @ center of 1st bar graph , " " should come @ center of 2nd bar graph, individual heights differ though, on scale "performance" -the "o" , " " "performance" objects (right hand side scale, in figure) - centering, means, overlay of markers("o" , " " against respective stacked graph. removing duplicate marker symbols, 'o' , '*' in legend on upper right corner . and, understanding why happens par2.plot , not ax.bar object. have done without using ax.twinx(), generates 2 scales (one "#candidates" , other "performance" - , if double entry of legend related using 2 scales ? (i hope not)

java - When I compile I get an error as "ask" cannot be resolved or is not a field" -

package mypackage; import java.util.random; interface sharedconstants { int no=0; int yes=1; int maybe=2; int later=3; int soon=4; int never=5; } class b implements sharedconstants { random rand=new random(); int ask() { int prob=(int) (100 * rand.nextdouble()); if (prob<30) return no; else if(prob<60) return yes; else if(prob<75) return later; else if(prob<90) return soon; else return never; } } class c implements sharedconstants { static void answer(int result) { switch(result) { case no: system.out.println("no"); break; case yes: system.out.println("yes"); break; case later: system.out.println("later"); break; case soon:

html - left v/s margin-left and CSS: position -

i playing around make html/css carousel. html: <body> <div id="container"> <div id="wrapper"> <div id="d1" class="box"><p>div#1</p></div> <div id="d2" class="box"><p>div#2</p></div> <div id="d3" class="box"><p>div#3</p></div> <div id="d4" class="box"><p>div#4</p></div> </div> </div> </body> css: .box { height: 100px; width: 100px; margin: 15px; border: 2px solid black; color: black; float: left; } #container { width: 150px; height: 144px; overflow: hidden; border: 2px solid black; } #wrapper { height: 140px; width: 555px; border: 2px solid green; position: relative; left: 0px; } #d1 { background-color: blue; }

Load new Data into Jquery DataTables -

Image
i load data table follows: $(document).ready(function () { var variable= 'sometext' $.ajax({ type: "post", url: "getjson.ashx", cache: false, data: { param: variable}, datatype: "json", success: function (data) { var html = ''; (var key = 0, size = data.length; key < size; key++) { html += '<tr><td>' + data[key].sessionid + '</td><td>' + data[key].val1+ '</td><td>' + data[key].val2+ '</td><td>' + data[key].val3+ '</td><td>' + data[key].val4+ '</td><td>' + data[key].val5+ '</td><td>' + data[key].status + '</td></tr>' } $('#table).append(