Posts

Showing posts from February, 2013

xaml - WPF Why does design view fail if I move my window and app into a subfolder of visual studio -

<lineargradientbrush x:key="maroongradientbrush" endpoint="0,1" startpoint="0,0"> <gradientstop color="#ff0c0b0b" offset="1"/> <gradientstop color="#ffbf5656"/> </lineargradientbrush> <window x:class="graphviewerwindow" renderoptions.edgemode="unspecified" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:daedalusgraphviewer="clr-namespace:daedalusgraphviewer" title="window1" height="900" width="900"> <textbox background="{staticresource maroongradientbrush}" /> </window> the program opens window correct gradient brush. however, design view still doesn't load window because can't find maroongradientbrush. edit: found problem. exactly: how move app.xaml , not break designe

ruby - Parse time with strptime using Time.zone -

i trying parse datetime time class in ruby 2.0. can't figure out how parse date , in specified timezone. have used time.zone.parse parse date first call time.zone , set specified timezone. in below example, set zone not effect strptime , have tried doing time.zone.parse(date) can't parse date 1 below. time.zone = "central time (us & canada)" #=> "central time (us & canada)" irb(main):086:0> time.strptime("08/26/2013 03:30 pm","%m/%d/%y %i:%m %p") #=> 2013-08-26 15:30:00 -0400 time.zone isn’t part of ruby, it’s part of activesupport (which included rails). such, strptime not know time.zone @ all. can, however, convert normal ruby time activesupport::timewithzone using in_time_zone , uses time.zone ’s value default: require 'active_support/core_ext/time' time.zone = 'central time (us & canada)' time = time.strptime('08/26/2013 03:30 pm', '%m/%d/%y %i:%m %p') #=&g

oauth 2.0 - OAuth2 with Implicit client and csrf protection -

i have api want secure oauth2. did dummy test password grant_type , works. can request tokens, access secured endpoints it, etc. server acts authorization , resource server. later on read should using implicit grant_type client javascript app. my client configured so: @override public void configure(final clientdetailsserviceconfigurer clients) throws exception {// @formatter:off clients .inmemory().withclient("web") .redirecturis("http://localhost:3000") .secret("secret") .authorizedgranttypes("implicit", "refresh_token").scopes("read", "write") .accesstokenvalidityseconds(3600).refreshtokenvalidityseconds(2592000); } if try accessing endpoint this: http://localhost:8080/oauth/authorize?grant_type=implicit&client_id=web&response_type=token&redirect_uri=http%3a%2f%2flocalhost%3a3000 i this: { "timestamp": 1464136960414, "status": 403, "err

node.js - Error: Not implemented Trying to create a stream with ExcelJS -

using node v 5.4.1 i'm trying create stream so: const program = require('commander'), excel = require('exceljs'), colors = require('colors/safe'), inquirer = require('inquirer'), async = require('async'), stream = require('stream'); program .version('0.0.1') .usage('[options] <file>') .parse(process.argv); if (program.args.length > 0 && program.args[0]) { var workbook = new excel.workbook(); var rs = new stream.readable(); rs.pipe(workbook.xlsx.createinputstream()); < -- error } else { console.log("you did not enter valid file path"); } but error error: not implemented which believe because have not implemented ._read thought maybe workbook.xlsx.createinputstream() this. am using stream package wrong? information great thanks i don't think have this: var rs = new stream.readable(); just try: v

object - Convert a JSON file to an OBJ file -

after scrounging across internet long time coming no closer goal before, decided bring question here. how can convert json file obj file? many of of other websites found either didn't work or converting other way. help, here file trying convert (json). unexperienced please bear me if ask many questions. tia, jake

How do I copy to the clipboard in JavaScript? -

what best way copy text clipboard? (multi-browser) i have tried: function copytoclipboard(text) { if (window.clipboarddata) { // internet explorer window.clipboarddata.setdata("text", text); } else { unsafewindow.netscape.security.privilegemanager.enableprivilege("universalxpconnect"); const clipboardhelper = components.classes["@mozilla.org/widget/clipboardhelper;1"].getservice(components.interfaces.nsiclipboardhelper); clipboardhelper.copystring(text); } } but in internet explorer gives syntax error. in firefox, says unsafewindow not defined . edit nice trick without flash: how trello access user's clipboard? browser support the javascript document.execcommand('copy') support has grown, see links below browser updates: ie10+ (although this document indicates support there ie5.5+). google chrome 43+ (~april 2015) mozilla firefox 41+ (shipping ~september 2015) ope

java - Android. How to access a class from another file to MainActivity -

i created separate java class called setip.java simple print: package com.myname.appname; import android.util.log; public class setip { public void hello(){ log.d("system", "hello world!"); } } in mainactivity try call by: public class mainactivity extends appcompatactivity { setip setip = new setip(); setip.hello(); // oncreate , stuff } but error said cannot resolve symbol 'hello'. please help. thanks you shouldn't call method of object of of classes on fly calling now, told // oncreate , stuff below object's method call. it has inside constructor or methods, here setip setip = new setip(); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setip.hello(); } or @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setip setip = new setip(); setip.hello(); }

database - Run time error 3192 Could not find table -

i doing program in access 2013 , im trying make form insert data table (via vba code), created subform (tblclients_subform) containing every "tblclients" data odd reason throwing me error: "could not find tblclients_subform" here entire block: "currentdb.execute "insert tblclients_subform (clientid, clientname, gender, " & _ "city, [address], [cellphone/telephone])" & _ "values (" & me.txtid & ",'" & me.txtname & "','" & me.cbogender & _ "','" & me.txtcity & "','" & me.txtaddress & "','" & me.txtcellphone & "')" what doing wrong? there way make form insert data in subform table?

android - duplicate entry error after adding google services -

i wanted add firebase 1 of app. integrated firebase according firebase offical documents. when tried "run" app. gives me warning error:execution failed task ':app:transformclasseswithjarmergingfordebug'. com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: com/google/android/gms/internal/zzc.class i removed firebase coding & removed gradle file. error still exist untill remove line apply plugin: 'com.google.gms.google-services' but unfortunately need google services work firebase. here app gradle file apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion '23.0.3' defaultconfig { applicationid "" minsdkversion 19 targetsdkversion 22 versioncode 15 versionname "2.01" multidexenabled true } dexoptions { predexlibraries = false } bui

vb.net - Error Adding Data to Access Database -

i trying add new record access database. new visual basic have been searching answer this. here code far: dim id integer = cint(idbox.text) dim password integer = cint(passwordbox.text) dim first string = firstname.text dim last string = lastname.text dim access integer = cint(accesslevel.text) dim conn new oledbconnection("provider = microsoft.ace.oledb.12.0;data source=c:\users\tristan\documents\visual studio 2015\projects\keno\keno\users.accdb") conn.open() dim ds new dataset dim da oledb.oledbdataadapter da = new oledb.oledbdataadapter("select * users", conn) da.fill(ds, "users") dim cb new oledbcommandbuilder(da) dim dsnewrow datarow dsnewrow = ds.tables("users").newrow() dsnewrow.item("id") = id dsnewrow.item("first_name") = first dsnewrow.item("last_name") = last dsnewrow.item("password") = password dsnewrow.item("ac

java - Google Firebase server persistent connection invalid_token -

i'm trying use firebase server sdk monitor value @ specific path. followed documentation yet after time passes, start seeing log errors like: [warn] persistentconnection: pc_0 - authentication failed: invalid_token (access denied.) i'm using latest release: com.google.firebase:firebase-server-sdk:3.0.0 i followed java guide installation & setup servers yet error still occurs after time , doesn't invoke code can hook attempt re-authenticate. has had similar issue , know of resolution? update 2016-05-31: i enabled debugging , see persistent connection thread indeed refreshing authentication after these warnings. i can narrow down scope of problem based on information , further testing: any long running valueeventlistener attached databasereference before token refresh stops receiving data after initial token expires. example, listener attached right after application startup. attaching new listener database reference , disposing of listener afte

java - Loop Json array with gson -

im trying parse jsonobject , can't seem it, here got. json = (json data) jsonparser parser = new jsonparser(); jsonobject rootobj = parser.parse(json).getasjsonobject(); jsonobject paymentsobject = rootobj.getasjsonobject("payments"); for(jsonobject pa : paymentsobject){ string dateentered = pa.getasjsonobject().get("date_entered").tostring(); } but foreach not applicable type missing. i've tried different ways can't seem it. thanks json { "name":"test 2", "amountcollected":"1997", "payments":[ { "quoteid":"96a064b9-3437-d536-fe12-56a9caf5d881", "date_entered":"2016-05-06 08:33:48", "amount":"1962", }, { "quoteid":"96a064b9-3437-d536-fe12-56a9caf5d881", "date_entered":"2016-05-06 08:33:08", "amount":"15",

python 2.7 - Multiprocessing, how to run processes in parallel without creating zombies? -

i'd run processes in parallel, commented out p.join __main__ section. consequences of not have .join , or better yet, should using different approach parallel multiprocessing? import multiprocessing def worker(num): x = 0 in range(10000): x+=1 print x, num if __name__ == '__main__': in range(4): p = multiprocessing.process(target=worker, args=(i,)) p.start() # p.join() join processes after starting them. if __name__ == '__main__': procs = [] in range(4): p = multiprocessing.process(target=worker, args=(i,)) p.start() procs.append(p) p in procs: p.join() if run multiple similar tasks, can use multiprocessing.pool . if __name__ == '__main__': pool = multiprocessing.pool() pool.map(worker, range(4)) pool.close() pool.join()

freebsd - gdb can't find any source after compile through distcc -

i'm using several freebsd machines, , of them in same version, 10.3-release i386. , installed distcc every machine through ports, /usr/ports/devel/distcc/. i think distcc version distcc-3.1 because of distcc-3.1.tar.bz2 file in /usr/ports/distfiles/. any compile done successfully, in fast way expected. but after try make break point in gdb, cannot catch source files of project. it may result of temp file such 'distccd_xxxxxx.ii' distcc / distccd give , receive between machines. i've tried 'directory' command in gdb, , not sufficient because file tree complicated , big. gdb fine when compiled locally without distcc. is there solutions break situation? have seen entry in distcc faq? https://github.com/marksatt/distcc/blob/master/doc/web/faq.html : unfortunately caused bug in gcc, hope fixed in future release. gcc embeds directory compiler (cc1) run, when ought record directory source came from. can work around using

ruby - Parse a recipe and determine if gluten free -

i have been assigned application user types in ingredients recipe , try , figure out things if recipe vegan, vegetarian, or gluten free. i'm trying figure out how determine how recipe gluten free. say have following ingredients typed in: 2 tbsp olive oil 2 large onion, chopped 4 large garlic cloves, minced 2 large carrots, peeled , sliced 1/3 cup of raw white rice 2 pounds ground beef 3/4 cup of chopped fresh mint leaves how can programmatically determine if recipe gluten free. defining list of gluten-containing foods, , checking if ingredients typed in don't match, efficient way?

ios - Setting debugger breakpoints across all methods in an Xcode project -

how trace methods invoked across different files in particular user flow ? putting breakpoints @ different points , observing backtrace not seem efficient way. instead - 1) put breakpoint across methods in interested project. 2) make breakpoints run debugger command prints out file name , method name. 3) edit breakpoints such program continues execute after breakpoint hit. (this option available when edit particular breakpoint.) don't stop @ breakpoint. 4) disable breakpoints until reach flow need work on. 5) enable breakpoints right before starting flow. approach, don't have manually put breakpoints @ different places understand execution flow. once flow complete, can @ debugger console , figure out execution flow. now, question - how can using lldb commands? appreciate input/suggestions. you can't xcode breakpoint interface, in lldb console can do: (lldb) break set -r . -s appname breakpoint 1: 478 locations. (lldb) br com add enter debugg

android - How can I create chooser Intent to choose from gmail app, yahoo mail app or browser? -

i tried search on google didn't find appropriate answer. i want click textview , show dialog allows user choose optional email. suggestion? in advance a better option use following, open applications provide mail facility , not apps can share data. intent emailintent = new intent(intent.action_view); uri data = uri.parse("mailto:?subject=" + "subject" + "&body=" + "body" + "&to=" + email_id); emailintent.setdata(data); startactivity(emailintent); "subject" subject of mail, "body" content of mail, , "email_id" id of receiver of mail. you can keep subject , body , email_id empty if want user fill in spaces.

swift2 - Invalidate NSTimer when going back navigation not forward -

i have nstimer counts down number of seconds. timer sits in middle view of 3 view process. i need invalidate timer because have found if don't app memory starts blowing out (strong reference). i put invalidate in viewwilldisappear method because there 1 more view user can segue stops timer , when user comes view countdown paused. how can invalidate nstimer if user goes in view hierarchy , not forward. you can in viewwilldisappear : if(![self.navigationcontroller.viewcontrollers containsobject:self]) { [timer invalidate]; }

photo - Is it a breach of policy to select specific PHOTO_REFERENCE and PHOTO_IDs using Google Places API? -

in part, i'm creating restaurant app. i'm looking use place_id select restaurant. if want select specific photos using photo_id or photo_reference, breach of policy? i'm looking use photo string pull specific photos display on app, i'm getting vibe google doesn't want persisting image/photo id's. true? seems want select of photos associated place_id. need specific ones though. can these types of individual callings without violating policy? great! thanks!

PHP Using ($_GET['url']) and then displaying that json data? -

<?php function get_stuff() { ($_get['http://****removedforsecuritypurposes****.repairshopr.com/api/v1/tickets?api_key=****removedforsecuritypurposes****']); echo $_get; } get_stuff(); ?> /* yes, pointless closing tag, i'm cool that. */ for reason when run code output i'm getting "array" , can't figure out why? know array i'm getting url thought print in whatever format in? missing something? thanks in advance! you cannot pass website url $_get . you should use file_get_contents() $content = file_get_contents('http://your_url'); if have valid json can convert array. $data = json_decode($content, true); then print it, echo '<pre>'; print_r($data);

Combining text files like how 'include' in PHP works using python -

i combine text files how include works in php. a piece of code fine existing solution or package job preferred. here trying accomplish in detail. for example, main.html <html> <body> <header> <<<include header.html>>> </header> content <footer> <<<includ footer.html>>> </footer> </body> </html> header.html , footer.html contain partial html. and after running python script, have new file called processed.html generated 3 files combined. thank in advance! import re html = open("main.html").read() match in re.findall('\<<<include.*?\>>>',s): name = match.replace("<<<include ","").replace(">>>","") content = open(name).read() html = html.replace(match,content) open("processed.html","w").write(html)

java - How authentication tag is calculated in AES-GCM-256 -

i have sample code,which encrypt , decrypt string using aes-gcm-256. i unable understand,how authentication tag being generated on encrypter side , how being used on decrypter side. actually here not generating authentication tag either on encrypter side nor validating decrypter side,so being done internally library itself. private static string encrypt(string s, byte[] k) throws exception { securerandom r = securerandom.getinstance("sha1prng"); // generate 128 bit iv encryption byte[] iv = new byte[12]; r.nextbytes(iv); secretkeyspec eks = new secretkeyspec(k, "aes"); cipher c = cipher.getinstance("aes/gcm/nopadding"); // generated authentication tag should 128 bits c.init(cipher.encrypt_mode, eks, new gcmparameterspec(128, iv)); byte[] es = c.dofinal(s.getbytes(standardcharsets.utf_8)); // construct output "iv + ciphertext" byte[] os = new byte[12 + es.

javascript - iOS - plist whitelisting for Jailbroken device -

i developing ionic app ios [phone/ipad] , want avoid user launching app. on jailbroken devices. achieve this, using below plugin. https://github.com/leecrossley/cordova-plugin-jailbreak-detection in ios 9 initial error: the app. not allowed query scheme cydia ... after adding in plist <key>lsapplicationqueriesschemes</key> <array> <string>cydia</string> </array> error: -canopenurl: failed url: "****" - error: "(null)" is there alternative can customise in code ios 9? help appreciated !

android - I have published my app in google play store but is not visible for samsung galaxy note5 and nexus 6 -

i have galaxy note 5 , cannot install application works on other phones , tablets. i think might have fact phone has quad hd screen other seems working fine. don't know else different. i went google developer console , note 5 isn't on list of devices. supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" android:xlargescreens="true" /> <compatible-screens> <!-- small size screens --> <screen android:screendensity="ldpi" android:screensize="small" /> <screen android:screendensity="mdpi" android:screensize="small" /> <screen android:screendensity="hdpi" android:screensize="small" /> <screen android:screendensity="xhdpi" android:screensize="small" />

structure - How occur if we use linked list for stack implementation?

i new stacks. know, if there not enough space in stack , want push element stack, stack in overflow state. occur when use array based implementation of stack because have define capacity of array. if want push element exceeding capacity, overflow occur if use linked list stack implementation how stack overflow occur? in linked list need not define capacity, dynamically allocate memory nodes. please me recognize issue. in advance. i recommend use linked list.as know there no stack overflows in linked list. that's why use data structure instead of array implementations lists, stacks. implementation of linked list lengthy( can use pre-defined libraries) , high cache usage . it's suitable holding data on dynamic sizes because has property of dynamically allocate memory nodes mentioned above. hope helps!

Unable to select dropdown item in dojo combobox when displayed in bootstrap modal dialog for IE -

when displaying dojo combobox in bootstrap modal dialog, unable select dropdown item. in fact drop down options display behind dialog in use high z-index (e.g. 1100) fix it while mentioned solution work chrome, unfortunately did not work ie. subsequent research reveal may due focus issue https://github.com/select2/select2/issues/600 bclarkejr commented on mar 15, 2013 not sure if waiting fix bootstrap, still think dropdowncontainer fix required. modals take away focus page, not bootstrap. know, it's how modals supposed work (e.g. if isn't in modal, can't receive focus). while article provide me insight on situation, not find solution counter, guys have advice? i have created jsfiddle this: http://jsfiddle.net/ab4lfdhu/15/ require([ "dojo/store/memory", "dijit/form/combobox", 'dojo/dom', 'dojo/parser', 'dijit/registry', "dojo/domready!" ], function( memory, combob

android - How to set onclicklistener on cardview? -

i inflating card view through custom recyclerview adapter.now,i want know how can set click listener adpater class on su,mo,tu,we,th,fr,sa position wise. i want array if user clicked su,mo,tu on 0 position of cardview array should follows [1,2,3] and on 1 st position user clicked we,th,fr should array follows [4,5,6] currently adapter have taken references of these textview , added click listener getting same array both postion if selections different. my adapter class follows. public class adapter1 extends recyclerview.adapter { private final int view_item = 1; private final int view_prog = 0; private list<string> mydataset; private static string key1; // minimum amount of items have below current scroll position // before loading more. private int visiblethreshold = 5; private int lastvisibleitem, totalitemcount; private boolean loading; private onloadmorelistener onloadmorelistener; private static string tag = "data_adapter"; private static arraylis

iphone - Do I need to set metadata in app when publish app to app store -

Image
i'am in phase of setting app first app submit app store. saw this: before submit application, idea have application’s metadata @ hand. includes (1) application’s name, (2) version number, (3) primary (and optional secondary) category, (4) concise description, (5) keywords, , (6) support url. my question do need set metadata somewhere in xcode project , where? well meta data data including (1) application’s name, (2) version number, (3) primary (and optional secondary) category, (4) concise description, (5) keywords, , (6) support url etc should know uploading app apple store. have use information while uploading. supplying information app store can done once have collected data. i think should go through tutorial on how submit app apple store. edit : the metadata has nothing xcode project or .plist file whatsoever. dont have it. information have enter in website of apple store when ask .

iphone - What is Apple's policy for iOS regarding inline video players? -

there's confusing situation in browsers iphone (but not ios, such ipad) feature forced video playback deviates w3c standards, severely inhibiting developer's ability create web apps combine video interface support iphone devices. browsers on iphones force same full-screen video player. since i'm sure google not choose deviate w3c standards (along every other browser developer), forcing videos played in full screen if wasnt being forced apple, i'm curious know: apple's policy causes iphone browsers use native full-screen-only video player, when inline video possible on iphone seen in youtube app? what's stopping google introducing it's own w3c compliant html5 video player in iphone chrome browser rather apple's native non w3c compliant video player? i want support mobile (obviously including iphone) web app, requires inline video (where interface overlays video user interact while video plays). apple tell developers "any web browser must us

c# - OnComm event 'Ring' not firing -

Image
i made app calling , texting using lg phone. can connect phone through serial in image make calls , text. however, when receive call, 'ring event' of oncomm object doesn't fire. oncomm object receives event, not 'ring event'. thanks

can i access dumpsys file from android -

i developing tracker application need know application starting hardware (by using pid) e.g camera or gps. information logged dumpsys file in android. want access file in application ,do analysis on , extract required information. can access file through adb when same commands run form java coding permission denied error occurs. have added android.permission.dump in manifest file still error. unfortunately "android.permission.dump" granted system apps. unless sign application system signature , use system shared user id ( android:shareduserid="android.uid.system" ) in manifest, won't able permission. what redirect dumpsys output manually external storage , examine file fileinputstream , bufferedreader ex: dumpsys > /sdcard/my_dump.txt in .java class: fileinputstream fis = new fileinputstream("/sdcard/my_dump.txt"); bufferedreader bfr = new bufferedreader (new inputstreamreader(fis)); stringbuilder builder = new s

c# - write Rhino Mock Test cases for Web api -

hi have created webapi below. trying write rhino mocks below api have tried lot everytime failed webapi client hit web api [httppost] public actionresult testapi(string test) { using (var client = new httpclient()) { client.baseaddress = new uri("http://localhost:42327/"); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); httpresponsemessage response = client.getasync("api/home/test/test").result; if (response.issuccessstatuscode) { var result = response.content.readasstringasync().result; viewbag.valid = result; return view(); } else { var result = response.content.readasstringasync().result; viewbag.valid = result; return v

Kafka server contains messages but consumer cannot receive any(producer used compression.type=snappy) -

i newbie in kafka .when using kafka 0.9.0, can set codec setting compression.type property of kafka producer. suppose use snappy compression in producer, when consuming messages kafka using kafka-consumer, should decode data snappy or built-in feature of kafka consumer? in office doc, not find property relates encoding in kafka consumer (it relates producer). can clear this? as mentioned in wiki page,there no need decompression logic on consumer side : please have @ wiki page below: https://cwiki.apache.org/confluence/display/kafka/compression the data received consumer topic might contain both compressed uncompressed messages. consumer iterator transparently decompresses compressed data , returns uncompressed message .

javascript - Is there an alternative to preprocessorScript for Chrome DevTools extensions? -

i want create custom profiler javascript chrome devtools extension. so, i'd have instrument javascript code of website (parse ast, inject hooks, generate new source). should've been possible using chrome.devtools.inspectedwindow.reload() , parameter preprocessorscript described here: https://developer.chrome.com/extensions/devtools_inspectedwindow . unfortunately, feature has been removed ( https://bugs.chromium.org/p/chromium/issues/detail?id=438626 ) because nobody using it. do know of other way achieve same thing chrome extension? there other way can replace incoming javascript source changed version? question specific chrome extensions (and maybe extensions other browsers), i'm asking last resort before going different route (e.g. dedicated app). on http can use chrome.webrequest api redirect requests js code data urls containing processed javascript code. however, won't work inline script tags. won't work on https, since data urls consider

classification - Original Image FileName in Caffe Network -

i using cifar( https://github.com/bvlc/caffe/tree/master/examples/cifar10 ) model in caffe. able train model , probability of wrongly classified images using pycaffe interface. is possible name of image filename data layer (created lmdb list of image filename , label train.txt , val.txt - https://github.com/bvlc/caffe/blob/master/examples/imagenet/create_imagenet.sh )? if not, how check content (original image's filename written in train.txt) of wrongly classified image (not labels)?

sql - Viewing used data blocks in Oracle -

i have been trying figure out while. want know how many data blocks being used tables. tables have huge number of rows, around 200,000. when run following query: select table_name, blocks all_tables owner='me'; i following output : table1 0 table2 0 table3 0 and on tables. why so? total used data blocks not being read properly, or there needs done correct it? that information updated when gather statistics (using dbms_stats package). it's not dynamic view. another way information via dba_segments view instead of dba_tables . rather expensive/slow though.

xpath - Select element by sibling content -

<p> <strong> <span>content</span> </strong> </p> <table> </table> as shown, table element target want select, while thing can make sure text content in preceding sibling not change. so possible select table according content css or xpath? there variants of xpath find same table element, considering little html snippet. personally, i'll possibly use 1 of following : //p[normalize-space()='content']/following-sibling::table[1] //p[strong/span/span='content']/following-sibling::table[1] //span[text() = 'content']/following::table[1]

Rust constants in different modules? -

i have "main.rs" file declare version constant. pub const version: &'static str = "v2"; mod game; fn main() { do_stuff(); } then want access global constant in different module "game.rs": pub fn do_stuff() { println!("this version: {}", version); } how make constant available everywhere? as version declared in main.rs , crate root, can access using absolute path: ::version . this should work: pub fn do_stuff() { println!("this version: {}", ::version); }

c++ - What is the difference between packaged_task and async -

while working threaded model of c++11, noticed that std::packaged_task<int(int,int)> task([](int a, int b) { return + b; }); auto f = task.get_future(); task(2,3); std::cout << f.get() << '\n'; and auto f = std::async(std::launch::async, [](int a, int b) { return + b; }, 2, 3); std::cout << f.get() << '\n'; seem same thing. understand there major difference if ran std::async std::launch::deferred , there 1 in case? what difference between these 2 approaches, , more importantly, in use cases should use 1 on other? actually example gave shows differences if use rather long function, such as //! sleeps 1 second , returns 1 auto sleep = [](){ std::this_thread::sleep_for(std::chrono::seconds(1)); return 1; }; packaged task a packaged_task won't start on it's own, have invoke it: std::packaged_task<int()> task(sleep); auto f = task.get_future(); task(); // invoke function // have wait

Javascript not compatible with jQuery v1.11 or below -

i want write small script invert black , white colors on area of page. used inverting script found on thread , adjusted invert black , white , on area of page: http://jsfiddle.net/yqe9t/87/ this works fine on jquery 1.12.1 , above ive noticed of pages im working still use jquery 1.9 , reason script not work on there; http://jsfiddle.net/yqe9t/88/ (jquery 1.9 here). i'm unable change jquery version used on pages need make compatible that. can please me figure out how make code work on older versions well? i'd work on new , old dont know enough javascript myself fix it. my complete javascript: $(".invertall").click (function () { var body = $(".unit.size-col-d.width610"); invertelementcolors ( $(body) ); } ); function rgb2hex(rgb){ rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); return (rgb && rgb.length === 4) ? "#" + ("0" + parseint(rgb[1],10).tostring(16)).slice

Path not found when executing my python script from my cmd prompt -

Image
i have python script uses classes file next main.py named 'src'. these classes use images file 'img' next main.py well. i'm writting path follows : "img/myimage.gif" when run python shell works fine can't run using command prompt (path not found). i tried "/img/myimage.gif" , "./img/myimage.gif" and moving 'img' file src, , main.py's parent file doesn't work.. i'm out of ideas.. assistance appreciated, thanks, this need folder structure, program main.py src __init__.py //empty py file classa __init__.py classa.py classb __init__.py classb.py "../../img/myimage.gif" // use in classa.py file more explanation: if main.py in src main.py img myimage.gif use this "../img/myimage.gif" if folder structure (moving img inside src) -src main.py -img

linux - How to get specific string from a file and store it in new file in shell script? -

i have 1 sql file contain data in file line follow: insert a=1 , b=2; insert a=2 , b=10; like many lines there want fetch these lines contain "insert" keyword till semicolon , create new file , save new file. using shell script. $ sed -n '/^\s*insert/p' data > newfilename $ cat newfilename insert a=1 , b=2; insert a=2 , b=10; or using grep : $ grep '^insert' data > newfilename $ cat newfilename insert a=1 , b=2; insert a=2 , b=10; using awk : $ awk '/^insert/' data > newfilename $ cat newfilename insert a=1 , b=2; insert a=2 , b=10;

php - Set name to dropdownlist from database? -

i have problem dropdownlist. when press in dropdown fill table don't show here. want the dropdown has save thing pressed , give himself name. don't know how this. look @ how hold selected list value after clicking go button? . my code: <form id="form" method="post" class="form-inline"> <div class="form-group"> <label for='select'>head:</label> <select class="form-control" onchange="this.form.submit()"> <?php //my $con else. $resultname = $con->query("select * ond"); while ($row = $resultname->fetch_assoc()) { echo '<option value="'.$row["ondid"].'">'.$row['name'].'</

javascript - Calculator Not Working in other browsers -

i have calculator function works in chrome not in other browsers (edge,firefox,explorer,opera). can tell me what's wrong.thanks <div class="content ticket_wrapper"> <div class="table"> <div class="row header"> <div class="cell">ticket</div> <div class="cell"><div class="align"> price</div></div> <div class="cell"><div class="align"> qnty</div></div> <div class="cell">total</div> </div> <div class="row"> <div class="cell">normal</div> <div class="cell"><div class="align"> ksh 650</div></div> <div class="cell"> <div class="ticket"> <select oninput="calculate()" id="titotal

jquery - Issues with sliding rtl and ltr in IE 7 -

i have simple div sliding animation(built scratch no thrid party) works fine in ie10,ff,chrome in ie 7 doesn't work.even in ie 8 works. html <div class="aboutus"> <div class="margin_slide"></div> <div class="about_container">click here go content div next div , div go extreme left.</div> <div class="whatwedo_container">some content div.click here go previous div.</div> </div> css .about_container { margin: 0px auto; position: relative; width: 500px; background:#ddd; height:300px } .whatwedo_container { position: absolute; right: -100%; width: 300px; background:#000; height:300px; color:#fff; top:0; } .aboutus { background: #20407b; height: 400px; margin-top: 0; position: relative; width: 100%; } .margin_slide { margin: auto 0; position: relative; width: 1100px; } jquery $('.about_container&#

mysql - How to get first row from each group from a table in sqlitedatabase? -

i have table messages in sqlite database.this table has 3 columns msg_id,sender_id,msg_body. need 1 latest message each user_id , these messages should ordered in desc order. eg. messages table is msg_id | sender_id | msg_body --------+-----------+---------- 1 | 18 |"something" 2 | 18 |"something" 3 | 19 |"something" 4 | 19 |"something" what want table:- msg_id | sender_id | msg_body -------+-----------+---------- 4 | 19 |"something" 2 | 18 |"something" try this: select t1.* mytable t1 join ( select sender_id, max(msg_id) max_msg_id mytable group sender_id ) t2 on t1.sender_id = t2.sender_id , t1.msg_id = t2.max_msg_id

qt - ASSERT failure in QVariant: "Trying to construct an unknown type", file kernel\qvariant.cpp, line 980 -

qt 5.5.0 i'm switching 1 of gui applications console. i'm having problem qsettings object initiation in console mode. this code in gui, works fine: class mainwindow : public qmainwindow { q_object public: mainwindow(); qsettings *setts; //settigns ... } mainwindow::mainwindow() { qfile setfile("./sa/settings.ini"); if (setfile.exists()) setfile.setpermissions(setfile.permissions() | qfiledevice::readuser | qfiledevice::writeuser); setts = new qsettings("./sa/settings.ini", qsettings::iniformat); setfile.setfilename(setts->value("localization","./sa/en.loc").tostring()); ... } int main(int argc, char *argv[]) { qpointer<qapplication> app; qpointer<mainwindow> main_window; app = new qapplication(argc, argv); main_window = new mainwindow(); ... } and code console class mainwindow : public qobject { q_object public: mainwindow(); ~mainwindow();