Posts

javascript - Dynamic id assign to collapsible div -

i have set of records stored in sql database pull , display these on page using php , html. i'm trying create collapsible div hide of information record. when trying divs close records , not single record, question how assign unique id each individual div (say named each record name pulled database. here have far: $chnumber = $record['ch_number'];?> <div id="prof_prod" <!--style="display: none;"-->> <div class="groupbox showgraph"> <div class="header"> <div class="title-container"> <div class="title">part number: <i id="partnumber"></i><?php echo $record['ch_number'] ?></div> <div class="title">serial number: <i id="serialnumber"></i><?php echo $record['serial_number'] ?></div> <div class="t...

delphi - DCEF3 TChromium : iterate the DOM and click buttons / fill inputs -

because internet explorer dead, i'm in (long) process replace twebbrowser tchromium in applications. with twebbrowser had complete , documented interface access dom through ihtmlelement interface. since dcef3 documentation inexistent, i'm searching examples of how (if possible) iterate , manipulate dom in tchromium : select / element's html source click on button fill input focus control is there native interface it, or way using javascript directly ? any appreciated. thanks in advance ! realized through js code (fill input): if assigned(chromium.browser) , assigned(chromium.browser.mainframe) begin jscode:= 'document.forms[0].quick_email.value="email";'; chromium.browser.mainframe.executejavascript(jscode, 'about:blank', 0); jscode:= 'document.forms[0].quick_pass.value="pass";'; chromium.browser.mainframe.executejavascript(jscode, 'about:blank', 0); jscode:= 'document.forms[0].submit(...

How to structure an efficient points logging system in PHP/MySQL -

i have points system on blog type website, users can earn points contributing in different ways (commenting/ voting on posts/ voting on comments etc). how go logging points earned user in mysql database efficiently. currently i'm thinking of having following fields in it's own table: post_id, giving_user_id, receiving_user_id, type, date_added now, if site grows , have 1 million ... 500 million... 1 billion rows, approach , structure able hold without taking forever run, providing data types set correctly? i'll inserting table, want able show previous 20 (example) points award/deducted in future, similar stackoverflow user stats pages. is there more efficient structure better me? updated info yes stackoverflow in functionality, 1 user gets 1 vote per postid. @paul gregory after rethink removing receiving_user_id may better idea related post. assuming can use post_id identify specific comment, , using type sensibly (as number other ids), approach...

asp.net mvc 3 - How to use DotNetZip Library -

i unziped file donwloaded. how , library access in asp.net mvc 3 app able unzip file contains multiple files? my controller code: public actionresult upload(scormuploadviewmodel model) { if (modelstate.isvalid) { if (model.scormpackagefile != null) { string zipcurfile = model.scormpackagefile.filename; string fullpath = path.getdirectoryname(zipcurfile); string directoryname = path.getfilenamewithoutextension(zipcurfile); directory.createdirectory(path.combine(fullpath, directoryname)); using (filestream zipfile = new filestream(zipcurfile, filemode.open)) { using (gzipstream zipstream = new gzipstream(zipfile, compressionmode.decompress)) { streamreader reader = new streamreader(zipstream); //next unzip file? how library need? } } thanks

Lossless grayscale JPEG "color" inversion? -

imagemagick can invert colors of jpeg so: mogrify -negate image.jpg however, that's not lossless. intuition says color inversion should doable in lossless fashion, @ least grayscale images, know hardly jpeg. hence questions: is lossless jpeg grayscale inversion possible in theory? if so, libjpeg or other software out there able it? jpeg encodes images series of entropy coded deltas across mcus (minimum coded units - 8x8 blocks of dct values) , entropy coded quantized dct coefficients within each mcu. inverting pixel values (even if grayscale) involve decoding entropy coded bits, modifying values , re-encoding them since can't "invert" entropy coded dct values. there isn't 1 one matching of entropy coded lengths each value because bits encoded based on statistical probability , magnitude/sign of quantized values. other problem coded dct values exist in frequency domain. i'm not mathematician, can't sure if there simple way invert spat...

How to embed a plot directly into a Window (python; QT;) -

i wanna embed matplotlib plot directly window, qmainwindow. should part of program more complex gui. ;) the way found add figure widget qtabwidget. see sample code below. lost link webpage inspired me. is there way embed figure directly windows other elements (buttons, textfield, textarea, ...)? import sys pyqt4.qtgui import qapplication, qmainwindow, qdockwidget, qvboxlayout,qtabwidget, qwidget matplotlib import pyplot matplotlib.backends.backend_qt4agg import figurecanvasqtagg = qapplication(sys.argv) w = qmainwindow() t = qtabwidget(w) tab1 = qwidget() t.addtab(tab1, '1st plot') t.resize(1280, 300) x = [1, 2, 3] fig1 = pyplot.figure(); plot = fig1.add_subplot(111); plot.plot(x) plot.grid(); layout = qvboxlayout(); layout.addwidget(figurecanvasqtagg(fig1)); tab1.setlayout(layout); w.showmaximized() sys.exit(a.exec_()) thank much. figurecanvasqtagg qwidget of other controls mentioned. main difference being doesn't allow pass parent in constructo...

scope - How to access private variable of Python module from class -

in python 3, prefixing class variable makes private mangling name within class. how access module variable within class? for example, following 2 ways not work: __a = 3 class b: def __init__(self): self.a = __a b = b() results in: traceback (most recent call last): file "<stdin>", line 1, in <module> file "<stdin>", line 3, in __init__ nameerror: name '_b__a' not defined using global not either: __a = 3 class b: def __init__(self): global __a self.a = __a b = b() results in: traceback (most recent call last): file "<stdin>", line 1, in <module> file "<stdin>", line 4, in __init__ nameerror: name '_b__a' not defined running locals() shows variable __a exists unmangled: >>> locals() {'__package__': none, '__name__': '__main__', '__loader__': <class '_frozen_importlib.builtinimporter...