Posts

php - Adding ACF field to post meta -

i found code controlling posts need edit: $img = ( $mode == 'top' ) ? get_the_post_thumbnail( null, 'large' ) : get_the_post_thumbnail( null, 'medium' ); $the_image = sprintf( '<span class="c_img">%s</span>', $img ); $thumb_link = sprintf( '<a class="%s" href="%s" rel="bookmark" title="%s %s" style="%s">%s</a>', $classes, get_permalink( $post ), __( 'link to', 'pagelines' ), the_title_attribute( array( 'echo' => false ) ), $style, $the_image ); $output = ( 'top' == $mode ) ? sprintf( '<div class="full_img fix">%s</div>', $thumb_link ) : $thumb_link; return apply_filters( 'pagelines_thumb_markup', $output, $mode, $format ); } that outputs this: <span class="c_img"><img src="example image"></span> i need insert custom acf (a...

python - Scrape data from reduced table -

using beautiful soup , isolating web source data inside 'p' tag, managed retrieve data need. now, i'd iterate on remaining data inside variable 'table' (over each row , each cell) scrape data list. can me how achieve this? i've read several other posts not able apply specific issue... thanks. from bs4 import beautifulsoup import urllib2 url = "http://www.gks.ru/bgd/free/b00_25/isswww.exe/stg/d000/000715.htm" page = urllib2.urlopen(url) soup = beautifulsoup(page.read(), 'html.parser') table=soup.findall('p',text=true) print(table) assuming want per-month price data, need find tr elements inside table , skip first 3 (header rows). note that, html.parser did not work me, lxml did (see differences between parsers ): soup = beautifulsoup(page, 'lxml') # requires 'lxml' installed table = soup.find("center").find("table") row in table.find_all("tr")[3:]: cells = [cell.get...

python - Joining strings. Generator or list comprehension? -

consider problem of extracting alphabets huge string. one way is ''.join([c c in hugestring if c.isalpha()]) the mechanism clear: list comprehension generates list of characters. join method knows how many characters needs join accessing length of list. other way is ''.join(c c in hugestring if c.isalpha()) here generator comprehension results in generator. join method not know how many characters going join because generator not possess len attribute. way of joining should slower list comprehension method. but testing in python shows not slower. why so? can explain how join works on generator. to clear: sum(j j in range(100)) doesn't need have knowledge of 100 because can keep track of cumulative sum. can access next element using next method on generator , add cumulative sum. however, since strings immutable, joining strings cumulatively create new string in each iteration. take lot of time. when call str.join(gen) gen generator...

glsl - Issues when simulating directional light in OpenGL -

Image
i'm working on opengl application using qt5 gui framework, however, i'm not expert in opengl , i'm facing couple of issues when trying simulate directional light. i'm using 'almost' same algorithm used in webgl application works fine. the application used render multiple adjacent cells of large gridblock (each of represented 8 independent vertices) meaning vertices of whole gridblock duplicated in vbo. normals calculated per face in geometry shader shown below in code. qopenglwidget paintgl() body. void openglwidget::paintgl() { glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glenable(gl_depth_test); glenable(gl_cull_face); m_camera = camera.tomatrix(); m_world.settoidentity(); m_program->bind(); m_program->setuniformvalue(m_projmatrixloc, m_proj); m_program->setuniformvalue(m_mvmatrixloc, m_camera * m_world); qmatrix3x3 normalmatrix = (m_camera * m_world).normalmatrix(); m_program->...

Invalid Syntax When Creating Python Dictionary -

this part of project class on python scripting in arcgis. i have created dictionary in python script according data structure . here code have written. id = { 'name': { 'first', 'middle', 'last' }, 'age': { '22' }, 'oit': { 'title', 'address': ['strnum','street'], 'email', 'phone': ['area code', 'exchange', 'number'] }, 'home': { 'title', 'address': ['strnum', 'street'], 'email', 'phone': ['area code', 'exchange', 'number'] } } when run code says "failed run script - syntax error - invalid syntax". doens't tell me , can't seem find it. , won't let me debug either throws same error. syntax error? your dictionary riddled synta...

python - Cannot import NavigationToolbar from matplotlib.backends.backend_gtk -

i'm running program received friend i'm not able solve error. initial part of code is: import matplotlib matplotlib.use('gtk') matplotlib.figure import figure matplotlib.axes import subplot matplotlib.backends.backend_gtk import figurecanvasgtk, navigationtoolbar, navigationtoolbar2gtk numpy import zeros import gtk import gtk.glade import scipy import scipy.interpolate import scipy.io when try run code, receive error: file "analeem.py", line 11, in <module> matplotlib.backends.backend_gtk import figurecanvasgtk, navigationtoolbar, navigationtoolbar2gtk importerror: cannot import name navigationtoolbar i'm running code under ubuntu, matplotlib installed. thanks in advance, matteo

save - Compiled Matlab mat file corruption -

i have compiled application cannot save user defined objects. when try load mat file in program crashes access violation error. mat file cannot loaded in matlab either (appears corrupt). however, application runs smoothly before compilation. possible causes this? classdef audio < handle properties ... end methods function self = audio() ... end end end = audio(); b = audio(); c = audio(); audiovector = [a,b,c] save(somefullpath, 'audiovector')