Posts

Showing posts from January, 2012

php - Efficiently sanitize user entered text -

i have html form accepts user entered text of size 1000, , submitted php page stored in mysql database. use pdo prepared statements prevent sql injection. sanitize text entered user, best efforts needed ? i want prevent script injection, xss attacks, etc. security interesting concept , attracts lot of people it. unfortunately it's complex subject , professionals wrong. i've found security holes in google (csrf), facebook (more csrf), several major online retailers (mainly sql injection / xss), thousands of smaller sites both corporate , personal. these recommendations: 1) use parameterised queries parameterised queries force values passed query treated separate data, input values cannot parsed sql code dbms. lot of people recommend escape strings using mysql_real_escape_string() , contrary popular belief not catch-all solution sql injection. take query example: select * users userid = $_get['userid'] if $_get['userid'] set 1 or 1=1 , th

Resize tables with Jquery or Javascript with dragable -

example on jfiddle doesn't work, need help. i have 3 tables on page. each table represents different information. user may want see minimal amount of 1 or 2 tables while maximizing size of table. the tables utilize set scrollable. allows overflow still viewed. when resizing tables headers must still viewable, while not needing show data. i have markup shows basic outline , between tables areas able use drag resize tables. resizing happen vertically, never horizontally. have tried several different approaches left non working code. hoping can this, since stumped. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>resize table</title> <style> .element { border: 1px solid #999999; border-radius: 4px; margin: 5px; padding: 5px; } </style> </head> <body> <div id="rezizeare

java - How to refresh all fields in a form? -

Image
i trying refresh fields in form click checkbox: <h:selectbooleancheckbox id="#{id}" styleclass="checkbox" value="#{value}" required="#{required}" disabled="#{not empty readonly , readonly ? true : disabled}" onclick="showloading();" > <a4j:support event="onchange" rerender="pessoadocumentoidentificacaoform" oncomplete="hideloading();" /> </h:selectbooleancheckbox> the problem pessoadocumentoidentificacaoform, it's jboss seam. fields in form refreshed, except these stated @ tipodocumento value... <components xmlns="http://jboss.com/products/seam/components" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.

asp.net mvc - The cast to value type 'System.Single' failed because the materialized value is null for stored procedure -

my stored procedure returns following data: sensornodeuuid type val0 val1 val2 -------------------------------------------------- 88418344615647248 3 25.77 0 4.23 88418344615634456 3 null null null 88432552356623423 2 null null null 88418344584627440 3 24.77 0 4.29 i have model : public class editsensormodel { public list<editsensormodel> editsensor; public int64 sensornodeuuid { get; set; } public int type { get; set; } public float val0 { get; set; } public float val1 { get; set; } public float val2 { get; set; } } in controller: list<editsensormodel> vendlist = new list<editsensormodel>(); var vnlist = entities.database.sqlquery<editsensormodel>("exec usp_getsensornode @userid", new sqlparameter("@userid", convert.toint32(session["userid"])) ).tolist();

Connect Sql Server Using Public Ip Address -

i using sql server 2012 , trying connect sql using public ip. read many post regarding none work far. what have tried till now. foword port through router allow remote connection in sql configure port in sql configuration manager allow port in firewall also edit: i can connect locally any appreciated thanks

ngroute - How to detect change in only query string parameters with AngularJS Route? -

i wanted work query string parameters along usual route parameters in angularjs application , have been following solution in post: how pass querystring in angular routes? the solution seems work: change route first $location.path , apply query string parameters $location.search . however, came across scenario route not need change query parameters need to. for example: moving from '/books/programming?id=123' to '/books/mathematics?id=234' works fine. however, moving from 'books/programming?id=123' to 'books/programming?id=124' not work. it seems angularjs notified changes on regular route parameters , not changes in query string parameters if query string thing changes in url, application not respond navigation. as verified angularjs 1.6.5, , according plunkr @jb-nizet, problem not occur anymore. question still remains missed earlier did not work. marking resolved not occur anymore.

javascript - TypeError: $(...).fullscreen is not a function -

i trying create full-screen button opening page elements in fullscreen mode. use plugin https://github.com/private-face/jquery.fullscreen/ it's working fine on there examples/index.html when use on theme doesn't working , it's showing typeerror: $(...).fullscreen not function inside console . <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>(successfully loaded) <script src="{$smarty.const.curr_theme}jquery.fullscreen.min.js"></script>(successfully loaded) js <script type="text/javascript"> $(function() { // open in fullscreen $('#fullscreen .requestfullscreen').click(function() { $('#fullscreen').fullscreen(); return false; }); // exit fullscreen $('#fullscreen .exitfullscreen').click(function() { $.fullscreen.exit(); return false; });

sql - How to write a Stored Procedure to Select, Delete and then Insert? -

i loading sample data ui testing , trying check if data exists. if delete , insert new 1 instead. got 9 inserts , not sure if need check each row if exists delete each row insert. this sample data trying load using sp. insert trans_mdata (transaction_id, mdata_attrb, mdata_value, created_time, last_mod_time, isactive) values (212019, 'source', 'comp', getdate(), getdate(), 1); insert trans_mdata (transaction_id, mdata_attrb, mdata_value, created_time, last_mod_time, isactive) values (212019, 'source', 'comp1', getdate(), getdate(), 1); insert trans_mdata (transaction_id, mdata_attrb, mdata_value, created_time, last_mod_time, isactive) values (212019, 'source', 'comp2', getdate(), getdate(), 2); insert trans_mdata (transaction_id, mdata_attrb, mdata_value, created_time, last_mod_time, isactive) values (212019, 'source', 'comp3', getdate(), getdate(), 3); insert trans_mdata (transaction_id, mdata_attrb,

imshow seems to show the wrong image -

i using code load/show/write images (opencv_python-3.3.0-cp36-cp36m-win32): import cv2 img0 = cv2.imread('original.jpg',1) img1=img0 in range(img0.shape[0]): j in range(img0.shape[1]): img1[i,j]=[0,0,255] cv2.imshow('original',img0) cv2.waitkey(0) cv2.destroyallwindows() note line 7 supposed show original image img0, shows modified image img1 instead (i.e. red rectangle). line 3 supposed create temporary copy of img0, not modify img0. wrong here? when using assignment operator (=) between mat variables, not copying data sharing reference. hence change in 1 getting reflected in another. please checkout : http://docs.opencv.org/2.4/modules/core/doc/basic_structures.html#mat-operator you need use clone() or copyto() achieve want. check them out here : http://docs.opencv.org/2.4/modules/core/doc/basic_structures.html#mat-clone

r - Transform function to a character string without losing comments -

i want transform functions character strings. can't directly transform class function class character, i'm using function list character logic. however, list removes comments functions. example: foo <- function() { 1 + 1 } # can't use as.character(foo), thus: as.character(list(foo)) "function () \n{\n 1 + 1\n}" however, if function contains comment gets removed bar <- function() { # sum 1 + 1 } as.character(list(bar)) "function () \n{\n 1 + 1\n}" question: why list removes comments functions , how save them? or better way transform functions character strings? edit: suggestion mrflick use capture.output works interactive r session. however, if use code.r : bar <- function() { # sum 1 + 1 } # collectmetadata() print(paste0(capture.output(print(bar)), collapse="\n")) and try run rscript code.r output still: "function () \n{\n 1 + 1\n}" i have no idea, wh

sass - Sublime Text Double Click highlighting modification -

sublime text not register sass variable ($variable) single item when highlighting, when double click on name, highlights word, not include $-symbol in highlighting. visual studio, on other hand, selects $-symbol along variable name when double clicking on variable select it. i write sass day long, , make life drastically easier if modify small behavior. there way change this? sure possible plugin, don't know if 1 exists or how find it. there setting named word_separators provides list of characters assumed not part of word purposes of things double click selection, navigating words, , on. the default particular setting set following, includes $ character causing woes: // characters considered separate words "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?", you can modify setting not include $ character it's treated part of identifier, should want. in order ensure don't experience other knock-on effec

Sending value from JavaScript to PHP via ajax OnUpDtae -

i trying send value 'idselected' javascript update php variable using onupdate (when user clicks button). javascript gets values magictoolbox.com image tool , when set alert value shown correctly within javascript bit works fine. i can not seem able php variable value change onupdate when use action (button press) has value. <script type="text/javascript"> var mzoptions = {}; mzoptions = { onupdate: function() { jquery('.magiczoom').next().html(jquery(arguments[2]).attr('title')) ; $idselected = jquery(arguments[2]).attr('data-product-id') ; $.ajax({ url: "http://malonef.truska.co.uk/product/18", type: "post", data: { idselected: $idselected } ; }); } } ; </script> and php <a id="moodboxclick" data-id="<?php echo $_post['idselected'] ; ?>"> <button type="button

c++ - std::is_same<A,B>::value == true in line 1, false in line 2 -

i have code returns true in 1 line, false in other. for example, struct z{ static const int value = 10; }; struct : z{ }; struct b : z{ }; int main(){ if(std::is_same<a,b>::value){ static_assert(std::is_same<a,b>::value , "why here?"); } return 0; } can please explain why throws static assert error? this because static_assert static (that is: compile time) assert. not care if statement (evaluated @ run-time) above.

amazon web services - Elastic Beanstalk UDP support -

asking here due seemingly lack of documentation (perhaps intentional). i'm trying develop elastic beanstalk application includes multi-container configuration consisting partly of running container requires udp support -- statsd. understand elastic load balancer does not support udp packets. on other hand, ecs does support udp protocol. and elastic beanstalks multi-container configuration makes use of ecs docker image. i know can't send udp packets through configured elastic load balancer. if connect route 53 url beanstalk application, traffic go through elastic load balancer? when i'm looking is, route 53 url filters tcp traffic elastic load balancer, , udp traffic directly ec2 cluster. note this page lacking udp containers (elastic beanstalk) -- whereas this page includes mention of udp (ecs) , both referencing same type of portmappings list of objects.

Notepad++ how to only keep lines with certain format -

i have large text file, text inside it. every line has different text, or format. i need keep lines format "text1:text2" , discard rest. for example, have 9 lines: 91.216.3.125:8085 141.101.132.98:8085 text messaging, or texting, act of composing , sending asd1:bbc2 qedrt2:b32sv electronic messages, typic short message service (sms). i yugiias:tugida2 nhcgdw:idwune i need 4, 5, 8, 9 lines save, else has deleted. desired output: asd1:bbc2 qedrt2:b32sv yugiias:tugida2 nhcgdw:idwune the following regular expression finds lines match desired lines. assuming example input representative don't need more complex this: ([a-z].*):(.*) you can find lines want , copy them out file. if there smallish number of matching lines amongst 'many' lines in original file time effective compared trying build , run more complex answer. is workable answer? or want write script it? preference language want script in? there large number of

css - TranslateZ not working in Firefox (parallaxing images) -

i have page 5 or 6 parallaxing images aligned vertically. to accomplish effect referenced this codepen. .wrapper { perspective: 2px; } .child::after { transform: translatez(-1px) scale(1.5); } the above code not direct reference, vital attributes used accomplish parallaxing effect the code works in google chrome , safari reason not in firefox. code same codepen; if try opening codepen in firefox can see yourself. does know wrong? appreciated.

Pygame MIDI function for just key down or key up rather than MIDIIN? -

so i'm using function detect events midi keyboard printed out sheet music: for e in events: if if e.type in [pygame.midi.midiin]: this returns 2 events, 1 when key pressed down , 1 when pressed up.this works great individual notes because create function make if statement trigger every other time there event it's difficult chords because events coming in variety of order note 40 keydown, note 41 keydown, note 41 key up, note 40 key up. or note 40 down, note 41 up, note 40 down, note 41 up. etc etc. except doesnt 'key up' or 'key down' triggers if statement. question is there function triggered on key being pressed either down or up? pygame.midi.midi_keydown the read() function returns raw bytes of midi message, without parsing them. the midis2events() function not these bytes either: ((status,data1,data2,data3),timestamp) = midi e = pygame.event.event(midiin, status=status,

pandoc - Beamer on Rstudio with rmarkdown does not even do the example file -

here diagnostic. there no place \begin{document} strange. work on office similar older computer. error 43 detailed error log below output file: testbeamer.knit.md ! latex error: missing \begin{document}. see latex manual or latex companion explanation. type h immediate help. ... l.1 c pandoc.exe: error producing pdf error: pandoc document conversion failed error 43 in addition: warning message: running command '"c:/program files/rstudio/bin/pandoc/pandoc" +rts -k512m -rts testbeamer.utf8.md --to beamer --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output testbeamer.pdf --template "c:\users\hd\appdata\local\temp\rtmp82otgv\file245861912878.tex" --highlight-style tango --latex-engine pdflatex' had status 43 execution halted

css - margin-top: calc(%) is using percent of width rather than desired percent of height -

i using margin-top: calc(100% - $value) intent calculation involve 100% of height calculate top-margin. however, in practice making calculation based on 100% of width. anyone have clues how base calculation on percent height rather width? (so far, i've checked undesired behavior happening in both chrome , ff). https://jsfiddle.net/bfxhebc3/ per css spec , percentage values margin, including margin-top , based off width of containing block. if referring height of window, can use vh instead of percent: margin-top: calc(100vh - $value);

python pygame what does font mean? -

i studying online pygame tutorial. however, not sure how works when trying place text on screen. according official docs pygame.font.sysfont() : return new font object loaded system fonts. font match requested bold , italic flags. if suitable system font not found fall on loading default pygame font. font name can comma separated list of font names for. what font? font = pygame.font.sysfont(none, 25) # message user def message_to_screen(msg,color): screen_text = font.render(msg, true, color) screen.blit(screen_text, [screen_width/2,screen_height/2]) ok, here simplest explanation can give you: modules such pygame simple (or not simple...) codes add new features , functions normal built in python functions. means when import module inherent module of functions , classes. example, normal python not contain function "draw" pygame.draw.rect(arguments) however when import pygame, inherent function pygame code. allowing draw , develop gui better

ios - Variables in header file, memory management -

in ios, if put const variables in header file use them in different source files including header file, what's lifecycle of these variables? when these variables allocated/released? these variables stored? you asked: what's lifecycle of these variables? the lifecycle of globals life of app. when these variables allocated/released? they're not released until app terminated. where these variables stored? if you're talking primitive data types or string literals, they're stored in dedicated __data segment, not in heap, not in stack. you should not put implementation of const globals in header. put them in .m file. put external references them in .h file. so, example, put following in .m file: nsstring * const knotificationname = @"com.domain.app.notification"; and then, in .h file, put: extern nsstring * const knotificationname; that way, implement once, files import header have visibility it.

google maps - Angular 4 Run Code After *NgIf Complete -

i'm developing application need run code after *ngif has finished removing component dom. specifically, need resize google map, once component in question removed dom. possible? thanks! after flip switch false use settimeout , run resize code there. more information, check out answer . this.show = false; settimeout(() => { this.resizesomething(); })

zipkin - How to support multiple samplers for multiple reporters? -

when using tracing.newbuilder() create tracing, found can specify 1 sampler , 1 reporter. i'm trying have: 100% sample reporter a 1% sample reporter b is doable? thanks leon

mysql - How to optimize this database structure? -

for future project i'm planning i'll have 3 tables. the 1st keeps track of recipe information, 2nd keeps track labels references recipe_id recipe table, 3rd table contains list of ingredients. recipe: +---------+-----------------+-------------+ | id [ai] | title | category | +---------+-----------------+-------------+ | 20 | italian pizza | dinner | +---------+-----------------+-------------+ | 21 | greek soup | lunch | +---------+-----------------+-------------+ recipe_ingredients_label: +---------------+------------+-------------+ | label_id [ai] | recipe_id | label | +---------------+------------+-------------+ | 1 | 20 | pizza base | +---------------+------------+-------------+ | 2 | 20 | topping | +---------------+------------+-------------+ recipe_ingredients: +----------+------------+----------------------+ | label_id | amount | ingredients | +----------+

cmake - Significance of the word 'general' in CMakeCache.txt? -

i encountered following statement in 1 of cmakecache.txt. somelibraryname_lib_depends:static=general;gcc_s;general;pthread;general;rt;general;/usr/lib/x86_64-linux-gnu/libunwind.so;general;dl;general;uuid;general; why general required here? if not mentioned here somelibraryname depends on other libraries such libc,libstdc++ , libm . general refer these libraries?

javascript - Proxies don't really replace Object.observe (do they?) -

javascript proxies supposed "more general" replacement object.observe , 1 nice thing object.observe let monitor unintended changes. used convenience method debugging legacy code, example. proxies don't seem function same way; intercept interactions happen through proxy. missing something?

timer - Reading quadrature encoder output using NUCLEO-F072RB -

i using nucleo-f072rb board in conjunction x2c read output of dc motor encoder, in order measure speed. according datasheet, using timers tim2 , tim3 possible perform read. purpose, followed this , this sources write following code: /** - configure a6 encoder input (t1) */ gpio_structinit(&gpio_initstruct); gpio_initstruct.gpio_mode = gpio_mode_af; gpio_initstruct.gpio_pupd = gpio_pupd_up; gpio_initstruct.gpio_pin = gpio_pin_6; gpio_init (gpioa, &gpio_initstruct); gpio_pinafconfig(gpioa, gpio_initstruct.gpio_pin, gpio_af_1); /** - configure a7 encoder input (t2) */ gpio_structinit(&gpio_initstruct); gpio_initstruct.gpio_mode = gpio_mode_af; gpio_initstruct.gpio_pupd = gpio_pupd_up; gpio_initstruct.gpio_pin = gpio_pin_7; gpio_init (gpioa, &gpio_initstruct); gpio_pinafconfig(gpioa, gpio_initstruct.gpio_pin, gpio_af_1); /**********************************************/ /* encoder input setup */ /* tim3 clock enabled */ rcc_apb1periphclockcmd(rcc_apb1periph_tim3

opencv - EMGU CV, C#, Visual Studio 2013, sudden "Unable to load DLL 'opencv_core242' on new Capture" -

i have small project started. working fine. following error on line _capture = new capture. {"unable load dll 'opencv_core242': specified module not found. (exception hresult: 0x8007007e)"} i've read numerous issues similar this, people installing emgu cv , trying project going. have other projects still work, using same code, current 1 , new ones make have issue. for solution add .dll files, nvcuda.dll or tbb*.dll working directory or windows32 directory, because opencv_core242.dl can't find them. doesn't make sense me though because other projects working without wild additions, , project working until stopped, , new projects error. find lot of people error when first setting up, no 1 inexplicable having appear in proven setup. i've re-referenced needed libraries in visual studio (emgu.cv, emgu.cv.ui, emgu.util), , i've gone though visual studio repair process. what should looking @ here? i'm getting more confused. thanks.

linux - Find recursively relative paths without showing the main directory contents -

first of all... i'm newbie in linux! haha i'm trying show files , directories main directory need exclude main directory record. example (all files in /var/www/html ): index.php images images/1.jpg images/2.jpg images/3.jp3 includes includes/db.php includes/security.php the records want exclude i've shown in bold / strong now i'm using command: find /var/www/html/ -mindepth 1 -printf '%p\n' i appreciate help. regards!

java - javafx and css3 rotateY() doesn't work -

javafx doesn't support css3 rotatey(). if visit link http://css3test.com/ code below, transforms properties work 100%. how solve it? import java.io.ioexception; import javafx.application.application; import javafx.scene.scene; import javafx.scene.layout.stackpane; import javafx.scene.web.webengine; import javafx.scene.web.webview; import javafx.stage.stage; public class browser extends application { @override public void start(stage stage) throws exception { stackpane pane = new stackpane(); webview view = new webview(); webengine engine = view.getengine(); engine.load("http://desandro.github.io/3dtransforms/examples/perspective-01.html"); pane.getchildren().add(view); scene scene = new scene(pane, 1280, 720); stage.setscene(scene); stage.show(); } public static void main(string[] args) throws ioexception { application.launch(args); } } with javafx webview: screenshot code above

HighStock xAxis datetime formatting for 2 days stock data -

i have requirement needs show fixed xaxis 2 days stock data. datetime https://www.google.ca/finance?q=nasdaq:amd , datetime show 9:30am, 12:00pm, 2:00pm 2 days, no matter how many data points received. the stock data receive dynamic, , need display data without spanning full width of chart, example, if last data point received @ 10:00am, need show chart locked in time frame, , if more data points received, chart fill in rest of space since xaxis should fixed , full range. the stock data irregular interval. set "ordinal" = false, there big gap between days. if "ordinal" = true, i'm unable fixed xaxis datetime full range. here code https://jsfiddle.net/aam3wxlk/4/ ` highcharts.setoptions({ global: { useutc: false } }); highcharts.stockchart('container', { yaxis: { minortickwidth: 0 }, xaxis: { type: 'datetime', ordinal

python - PyCharm opens automatically -

i installed pycharm. when run *.py file command line, pycharm opens , tries create project - every time! close pycharm, try run file cmd , pycharm opens , interferes. there way prevent this? thanks. try removing .py file's association. right clicking on .py files > properties > general tab > opens > change

ios - Use userdefaults on a struct -

i manually entering data struct. struct not saving data. tried use userdefaults it's not working. want data appear on label bencarson @ times if it's in struct bad . viewcontroller 1 struct bad { static var mm = [string]() } viewcontroller 2 class viewcontroller2: uiviewcontroller { @iboutlet var bencarson: uilabel! override func viewdidload() { super.viewdidload() bencarson.text = viewcontroller.bad.mm.map { " \($0)" }.joined(separator:"\n") } } i think no need struct use userdefaults , work for save let mm = ["adsa", "safds", "twer", "qwer", "dfas"] let defaults = userdefaults.standard defaults.set(mm, forkey: "savedstringarray") defaults.synchronize() for retrieve let defaults = userdefaults.standard let myarray = defaults.stringarray(forkey: "savedstringarray") ?? [string]() bencarson.text = myarray.map { " \($0)"

go - How can I collect Wi-Fi RF metrics in Golang? -

i'm looking way scan local wi-fi environment given client , produce metrics such as: access point(s), bssid, ssid, channel, , rssi using go. golang libs provides list of projects ( https://golanglibs.com/top?page=1&q=wifi ), these seem more focused on specific use cases i'm looking for. looking means list aps and/or ssids , current rf conditions. i avoid system calls ala exec.command() approach implemented here ( https://github.com/yelinaung/wifi-name/blob/master/wifi-name.go ) if possible seems bit of hack, if best option i'm happy try approach. i'm willing begin platform-specific approach (windows or linux) , 'roll own' there, if there more generalized tools/packages obfuscate os preferred.

mongodb - Unable to connect Robomongo to AWS EC2 via SSH -

Image
after expending lot of time here put problem. mongodb server running on ec2 box centos on port 27016. can connect through putty , use start mongo cell command mongo --port 27016 i want use same database robomongo robo 3t 1.1 version. i have set ssh details on ssh tab on robomongo. in connection tab have set host 127.0.0.1 , port 27016(i confused don't know it's valid or not). i getting error after clicking on show error details i getting message note: mongodb server running on local machine on port 27017 thank you

ios - Parse Livequery changes not printing when there's an update -

when started working parse live query knew beginning challenge. seeing there muiple ways create live query. when had set server on, bit of code used listen updates looked this: let livequeryclientmessage = parselivequery.client() qmessages.wherekey("touser", equalto: (pfuser.current()?.objectid!)! string) messagesubscription = livequeryclientmessage.subscribe(qmessage).handle(event.created){ _, message in //prepare local notification alert print("object updated") } this however, no longer seems function properly. looked @ parse live query docs see if there working example , found gets server "create new client: " code: let qmessages = pfquery(classname: "messages") qmessages.wherekey("touser", equalto: (pfuser.current()?.objectid!)! string) let subscription = client.shared.subscribe(qmessages) subscription.handle(event.updated){ query, event in print("object updated")

xml - Add button inside a notebook tab -

Image
how add button inside notebook tab before one2many field? example, want add button in notebook tab before one2many field. hello gautam bothra, solution try below code, <page string="tab_name"> <group> <button type="object" name="python_method_name" string="button_name" /> <field name="one2many_field_name"> <tree> <field name="name" string="name" /> </tree> </field> </group> </page> if query comment please. hope answer helpful.

c++ - RPM package prerequisites -

i have driver rpm package installs basic driver , after package installing it's utility programs. driver rpm checks prerequisites needed install it. , utility have prerequisite driver rpm. is enough check driver rpm , ignore other per-requisites in utility rpm because checked when driver installed. is okay rpm packaging ? yes, can that. if sure dependencies of utility rpm met when driver rpm installed, checking driver alone should sufficient.

ios - What would you prefer in order to deal with Game-Center's invite friends? -

i've been trying implement invites gkturnbasedmatch. i've gone through documentation , web portals. here i'm doing. firstly, i'm registering gklocalplayerlistener follows. if(!gklocalplayer.localplayer().isauthenticated) { authenticateplayer { (auth) in weak var weakself = self weak var weakplayer = gklocalplayer.localplayer() if(auth){ weakplayer?.register(weakself!) self.suthentication = true; //self.removeallmatches() //self.retrievefriends() } else{ print("failed in authentication") self.suthentication = false; } } } else { // authenticated gklocalplayer.localplayer().register(self) localplayer = gklocalplayer.localplayer() //removeallmatches() } now can reach listener's default methods. default w

twig - Grav CMS: how to show/hide parts of the page depending on conditions? -

the grav's documentation describes how whole page or folder hidden unregistered users . describes how whole page seen particular user groups . but pieces of page , let's say, links or private info want show on conditions? ok, registered users found snippet @ login plugin docs : {% if grav.user.authenticated %} content registered users goes here {% endif %} but going wider - how can show/hide pieces of particular page depending on custom logic in php code , i.e. not user related? i'm thinking twig/shortcode plugin, like: {% if some.custom.condition.or.php.function %} hidden content goes here {% endif %} or [hidden_if_something] hidden content goes here [/hidden_if_something] but not sure how should implemented. working examples appreciated. thanks. there recipe in grav documentation here . provides example of how render output of php code result in twig template. in example create plugin, , implement twig extension providing access ph

c++ - Reference to pointer issue? -

this have: void g(int *&x) { int = 3; x = &a; } void h(const int *&x) { int b = 2; x = &b; } int main() { int *p = new int; *p = 5; g(p); cout << p << " " << *p << endl; // print #2 cout << p << " " << *p << endl; // print #3 const int*p1 = p; h(p1); cout << p << " " << *p << endl; // print #4 cout << p << " " << *p << endl; // print #5 } from understand, print#2 , print#3 should have same result isn't when compile it. goes print#4 and print#5 too. can me? updated : output looks when compiled on computer: 00eff9d4 3 //1 00eff9d4 1552276352 //2 00eff9d4 2 //3 00eff9d4 1552276352 //4 shouldn't (1) , (2) same ? (3) , (4) either. i assume mean int a in g() . your function make pointer point a local variable , after termination of function, go out of

android - Refresh Controll stops working if listView goes offscreen -

im trying receive list of itens firebase, including image, wich rendered in list. the problem is, when list gets big fall of screen, refresh controll stops working. working way, list full on screen not working, if pulled, makes effect of "reached on max" render method <view contentcontainerstyle={{ flex: 1 }}> <listview enableemptysections datasource={this.datasource} renderrow={this.renderrow} refreshcontrol={ <refreshcontrol refreshing={this.state.refreshing} onrefresh={this.onrefresh.bind(this)} /> } /> </view> onrefresh() { this.setstate({ refreshing: true }); this.props.eventsfetch(); }

c++ - How to use boost::latch? -

i trying use boost::latch in program block waiting until threads finish or time out. code follows. ctpl thread pool library adopted https://github.com/vit-vit/ctpl . #include <boost/thread/latch.hpp> #include <ctpl/ctpl.h> #include <mutex> #include <iostream> using namespace std; int main(int argc, char **argv) { ctpl::thread_pool outer_tp(100); ctpl::thread_pool inner_tp(5, 5000); auto out_func = [&inner_tp](int outer_id, int outer_invoke_idx) { int num_batch = 20; boost::latch latch_(num_batch); auto func = [&latch_, &outer_invoke_idx](int inner_id, int inner_invoke_idx) { try { std::cout << "outer: " << outer_invoke_idx << ", inner: " << inner_invoke_idx << endl; } catch (exception &ex) { cout << "error: " << ex.what() << endl; } latch_.count_down(); };

c++ - Copying the address of an object into a buffer and retrieving it -

i copy address of object buffer , typecast @ other point. unable it. sample code given below. #include <iostream> #include <cstring> class myclass { public: myclass(const int & i) { id = i; } ~myclass() { } void print() const { std::cout<<" id: "<<id<<std::endl; } private: int id; }; int main() { myclass *myclass = new myclass(10); std::cout<<"myclass: "<<myclass<<std::endl; myclass->print(); // need copy address buffer , retrieve later char tmp[128]; // std::vector tmp(sizeof(myclass); // preferably, may use instead of previous line, , use std::copy instead of memcpy memcpy(tmp, myclass, sizeof(myclass)); // retreiving pointer myclass* myclassptr = (myclass*) tmp; std::cout<<"myclassptr: "<<myclassptr<<std::endl; myclassptr->print(); return 0; } in fact, pointers gives different val

javascript - Get the set of all possible values for a categoric field -

this question has answer here: how distinct values array of objects in javascript? 23 answers from following object items = [{ title = 'title 1', category = 'foo' }, { title = 'title 5', category = 'bar' }, { title = 'title n', category = 'bar' }, ] which i receive dynamically @ runtime can have length where each category field can have 1 of items.length values i want set of different values field category . in example above, result of get_all_possible_categories(items) would be ['foo','bar']. how can implement get_all_possible_categories(items) ? just map values array, using set unique values items = [{ title : 'title 1', category : 'foo' }, { title : 'title 5', category : 'bar

c++ - if constexpr instead of tag dispatch -

i want use if constexpr instead of tag dispatching, not sure how use it. example code below. template<typename t> struct mytag { static const int supported = 0; }; template<> struct mytag<std::uint64_t> { static const int supported = 1; }; template<> struct mytag<std::uint32_t> { static const int supported = 1; }; class mytest { public: template<typename t> void do_something(t value) { // instead of doing bool supported = mytag<t>::supported; // want if constexpr (t == std::uint64_t) supported = true; } }; one way define constexpr predicate checks type of argument, constexpr switch on result of predicate. i think way nice because separates functional logic precondition logic. #include <iostream> #include <cstddef> #include <type_traits> class mytest { public: template<typename t> void do_something(t value) { // define our pr

onReceive of BroadcastReceiver shows alert 2 times in android -

i implementing internet connectivity lost in application using broadcastreceiver.the code working fine alert shown on internet connection or disconnection showing twice.i want show alert or toast once @ time.below code of broadcastreceiver public void onreceive(context context, intent intent) { if (intent.getaction().equals("android.net.conn.connectivity_change")) { connectivitymanager cm = (connectivitymanager) context.getsystemservice(context.connectivity_service); //networkinfo activenetwork = cm.getactivenetworkinfo(); if (cm.getnetworkinfo(connectivitymanager.type_mobile).getstate() == networkinfo.state.connected || cm.getnetworkinfo(connectivitymanager.type_wifi).getstate() == networkinfo.state.connected) { // notify user online toast.maketext(context.getapplicationcontext(), "connected", toast.length_long

javascript - flatpickr - Uncaught ReferenceError: exports is not defined -

i´m trying use locale plugin: flatpickr console says: uncaught referenceerror: exports not defined this code: html <input type='text' class="form-control datetime" name="startdatetime" placeholder="start.."/> js //datetime $('.datetime').flatpickr({ 'locale': 'sv', mode: 'multiple', defaulthour: '22', enabletime: 'true', time_24hr: 'true', }); sv.js "use strict"; object.defineproperty(exports, "__esmodule", { value: true }); var fp = (typeof window !== "undefined" && window.flatpickr !== undefined) ? window.flatpickr : { l10ns: {}, }; exports.swedish = { firstdayofweek: 1, weekabbreviation: "v", weekdays: { shorthand: ["sön", "mÃ¥n", "tis", "ons", "tor", "fre", "lör"], longhand: [ &qu

cakephp - Cake php get comma seprated value from mysql table -

Image
i trying fetch comma separated record in php mysql not getting error getting not record. sql code want execute is: select batches.id, batches.batch_name, batches.facilities_id, batches.archive_status, batches.created sportsapp.batches batches batches.facilities_id in (40, 48, 110, 111) and records like my current php approach is: $batches = $this->batches->find ( 'all', array( 'conditions' => array( 'batches.facilities_ids' => $facilitiesids ) ) ); you can't find directly comma separated value in approach. use find_in_set e.g array('conditions' => array('batche.archive_status' => 1,'find_in_set(\''. $id .'\',batches.facilities_id)'))

ios - TableView Inside a UITableViewCell - must register a nib or class -

Image
i'm putting uitableview inside uitableviewcell . i've extended class of uitableviewcell ,uitableviewdatasource, uitableviewdelegate . made @iboutlet var tableview: uitableview! added following: override init(style: uitableviewcellstyle, reuseidentifier: string?) { super.init(style: style , reuseidentifier: reuseidentifier) setuptable() } required init(coder adecoder: nscoder) { super.init(coder: adecoder)! setuptable() } override func awakefromnib() { super.awakefromnib() setuptable() } where setuptable() implemented as: func setuptable(){ tableview?.delegate = self tableview?.datasource = self //tableview.register(uinib(nibname: "availabletimingstableviewcell", bundle: nil), forcellreuseidentifier: "timingcell") } if keep commented line in setuptable() get: 'unable dequeue cell identifier timingcell - must register nib or class

Spark Submit giving error in Pentaho Spoon -

Image
i new pentaho.i using mapr distribution,when submitting spark job,i getting below error.please me on this.i have done necessary configuration integration of spark , pentaho.please find attached screenshots of pentaho spark submit job. 2017/09/12 12:41:44 - spoon - starting job... 2017/09/12 12:41:44 - spark_submit - start of job execution 2017/09/12 12:41:44 - spark_submit - starting entry [spark submit] 2017/09/12 12:41:44 - spark submit - submitting spark script 2017/09/12 12:41:45 - spark submit - warning: master yarn-cluster deprecated since 2.0. please use master "yarn" specified deploy mode instead. 2017/09/12 12:41:45 - spark submit - slf4j: class path contains multiple slf4j bindings. 2017/09/12 12:41:45 - spark submit - slf4j: found binding in [jar:file:/opt/mapr/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/staticloggerbinder.class] 2017/09/12 12:41:45 - spark submit - slf4j: found binding in [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.ja

Python Gmail Api Create Draft Reply -

i using create draft function googles api documentation: https://developers.google.com/gmail/api/v1/reference/users/drafts/create whenever send message following appear in email message text when go gmail: hello world date: mon, 11 sep 2017 15:31:19 +0200 message-id: <cakpego69tbbignfrk8t37fygpzcfzwvf=p0gkvjbzf6duwwsdw@mail.gmail.com> from: myemailaddress@gmail.com i don't know why i'm getting of text. what trying create draft email reply existing email seem new draft text above (no to/from/subject fields populated). here's function i'm using: import base64 email.mime.audio import mimeaudio email.mime.base import mimebase email.mime.image import mimeimage email.mime.multipart import mimemultipart email.mime.text import mimetext import mimetypes import os def createdraft(service, user_id, message_body): """create , insert draft email. print returned draft's message , id. args: service: authorized gmail api service ins