Posts

Showing posts from February, 2015

html - media query non responsive -

ok have not used media query time believe have done correctly. not using sass or less plain old css. .btn-test { border-radius: 2px; border: 1px solid #2e70a4; color: #fff; font-size: 12px; background: #2c83c9; position: relative; transition: .2s ease; display: inline-block; text-decoration: none; margin: 18px 9px 0 0; padding: 5px 9px 0 9px; height: 37px; line-height: 16px; text-align: center; } @media screen , (min-device-width: 850px) , (max-device-width: 1050px) { .btn-test { line-height: 34px; font-size: 8px; } .arrow-call-to-action { font-size: 8px; } .call-to-action-list p { font-size: 8px; } } so set screen 900 media query should active, see no change, have done correctly ? thanks. update html added <li> <div class="t4 arrow-call-to-action"> somthing </div> ...

c# - Process PointerWheelChanged event with GestureRecognizer -

i have uwp app, want handle manipulationdelta or manipulationupdated , manipulationcompleted on pointerwheelchanged event(to handle horizontal scroll mouse or touchpad). on pointerwheelchanged event, have managed with gesture.processmousewheelevent(e.getcurrentpoint(this), false,false); where e pointerroutedeventargs . code snippet: gesturerecognizer gesture = new gesturerecognizer(); gesture.manipulationcompleted += onmanipulationcompleted; gesture.manipulationupdated += onmanipulationupdated; void onmanipulationupdated(object sender, manipulationupdatedeventargs e) { //ideally should called whenever there change in manipulation } void onmanipulationcompleted(object sender, manipulationcompletedeventargs e) { //code scroll //ideally has called on completion of manipulation event(correct me if wrong) } private void onpointerwheelchanged(object sender, pointerroutedeventargs e) { gesture.processmousewheelevent(e.getintermediatepoints((this) sender...

c++ - Is boost compressed matrix thread safety? -

i'm using openmp on boost compressed matrix container. wonder if thread safe use in way? int noofuser=2649429;//2649429 int noofitem=17770;//17770; boost::numeric::ublas::compressed_matrix<int> ratingmatrix(noofitem,noofuser,110000000); #pragma omp parallel schedule(dynamic) for(int i=0;i<noofitem;i++) { for(int j=0;j<noofuser;j++) { ratingmatrix(i,j)= #some rating } } my test result shows thread safe if inserting using coordinate

android - Push Notification with proxy -

i'm stuck strange android behavior , i'd appreciate if can suggest me how proceed. i’v developed app gcm first, upgraded fcm, send messages , notifications server. goes using app mobile connectivity or wifi on open network, devices stop receive notifications when connected wifi behind proxy. the proxy of course configured on device , can surf on internet, read email, connect machine gcm server installed; don’t receive notification… , not app apps, hangouts, whatsapp , gmail… probably google play service cannot connect google server… can force it? i can manage network settings, i've removed firewall, ports open. if connect normal gateway works, if connect devices transparent proxy, notifications stop arrive. i’v read on forums users use “drony” or root smartphones, unfortunately these devices in production environment , under warranty, cannot install third-party app or root devices. in app don’t manage directly proxy configuration, os configuration, normal an...

rest - Retrofit manage No objects model list JSON -

i'm using retrofit lib objects json api rest service implemented, simple query , echo in php. this json use create objects in android app: [ { "event_id":"1", "event_name":"lungo il tevere", "event_image_url":"https:\/\/www.dayroma.it\/wp-content\/uploads\/2016\/06\/event_fb-9400.jpg", "event_content":"lungo il tevere roma 2016, bancarelle sulle banchine del tevere", "event_owner":"1", "event_start_time":"22:00:00", "event_end_time":"03:00:00", "event_all_day":"0", "event_start_date":"2016-07-05", "event_end_date":"2016-07-06", "location_name":"lungotevere", "location_owner":"1", "location_address":"piazza navona 2", "locati...

javascript - Bootstrap Touch Carousel with Webpack -

i in process of moving legacy webapp on run on sort of frontend dependancy manager. in instance im using webpack , npm. i have been able migrate 90% of app over, stuck on issue bootstrap-touch-carousel . it seems though have installed via npm, still not able call via normal require(./bootstrap-touch-carousel). are dependencies need required differently? or on wrong track? you cannot import require('bootstrap-touch-carousel') because in module package.json there isn't main file you must explicitly import distributed .js file doing this: require('bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel')

javascript - Upload image in chrome extension and extension popup closes -

i need upload image chrome extension, when file browser clicked extension popup closes. how can handle both file browser , popup remain open. it's tricky question answer. the basic idea whenever popup window loses focus, supposed close, entails destruction of popup's javascript context (and logic breaks result). not can influence . modal dialogs such file input ought exception, doesn't work consistently across platforms chrome runs on. evidence: question , bug . whenever want survive popup closing, put in background page. lead this workaround places file input in background page , triggers selection popup. but there's (unconfirmed) evidence not work anymore. question above has another, supposedly working answer injecting input tag current page, that's subject failing on "unscriptable" pages such chrome web store or internal chrome:// pages. the safest way open separate tab or popup window handle process. awkward ux though.

BigQuery Error Response -

i have day based table stores activity info users particular day (table size june 11th 72 mb). have constructed fetch aggregated results grouped day last 30 days. past 1 week getting , response 'error preparing subsidiary query: null'. happens both chrome ui , when make call programmatically. if make same call customer in development account, has less data in activity info, query gets executed. since size of individual tables huge or load on bigquery high. are using table_query() function? if so, may check post how use table_query() function in bigquery? debugging it. if not help, share more details?

unix - file in UTF-8 using ICONV showing ANSI encoding in notepad ++ -

i facing problem encoding while changing .csv file “iso-8859-7 -t utf-8 using iconv command. shows me completed when converted file export , checks in notepad ++ shows me ansi encoding characters different when changed encoding utf-8 manually using notepad ++ shows me correct character strings. for example coming ÃŽ’ÃŽ™ÃŽ“ÃŽ›ÃŽ‘ ΟΛΥΜΠΟÎ¥ ÃŽ‘ÃŽ•ÃŽ’ÃŽ• converted using iconv command using iso-8859-7 -t utf-8 . but above not correct, when changing encoding utf-8 in notepad ++ coming ΒΙΓΛΑ ΟΛΥΜΠΟΥ ΑΕΒΕ correct. can suggest me how can rid out problem. notepad merely guessing encoding should open file in. file doesn't declare anywhere encoding it's in. notepad gets wrong. need tell hand encoding file actually in. if file looks okay when interpreted utf-8, it's utf-8. nothing else here.

android - File not found exception when reading external storage -

earlier code working totally fine, , works fine pre android 6 devices, in nexus 5, 6.0.1, unable access data external storage. it shows file not found exception java.io.filenotfoundexception: /storage/emulated/0/download/********/*****: open failed: enoent (no such file or directory) for writing data storage, asking runtime storage permission , part seems fine. since code working fine in pre-marshmallow devices, looks you've not added runtime permissions in app. starting android m , need request permissions @ runtime, mentioned in docs : beginning in android 6.0 (api level 23), users grant permissions apps while app running, not when install app. read more requesting permissions @ runtime in android here

java - Recursive through List-Elements, which can have List too -

i'm looking suitable recursive way achieve following: element can have list l1 contains further elements such a, e.g. b,c , d. these elements (b,c , d) can have list l2, l3, l4 too. need go through these lists too. background want objects lists of elements contains "lb" @ end of name (retrieved getname()). objects of lists have same type. how achieve this? don't know how many elements , lists there be, think recursive solution proper one? basically have tree structure there, means need form of tree traversal. let's assume have tree-like structure: class node<t>{ t value; list<node<t>> children = new arraylist<>(); } now, if want apply callback c each of these nodes, this: public <t> void visit(node<t> rootnode, consumer c){ c.consume(rootnode.value); rootnode.children.foreach(n -> visit(n, c)); } this called depth-first traversal.

bash - Download Artifacts from Jenkins with cURL and GitHub Authentication -

i'm attempting download build artifacts jenkins via curl in bash script. however, use github authentication, , using api key belonging administrator user, 403 errors , cannot download. my curl command follows: curl -u me:myapitoken -k 'https://jenkins.example.com/job/my-project/lastsuccessfulbuild/artifact/output/artifact_name'` the header output indicates jenkins considers me logged in administrator, yet, 403 error , unable download artifact. < http/1.1 403 forbidden < date: tue, 28 jun 2016 10:03:55 gmt < server: jetty(winstone-2.9) < x-content-type-options: nosniff < x-you-are-authenticated-as: <me> < x-you-are-in-group: authenticated < x-required-permission: hudson.model.hudson.read < x-permission-implied-by: hudson.security.permission.genericread < x-permission-implied-by: hudson.model.hudson.administer < cache-control: no-cache,no-store,must-revalidate < x-hudson-theme: default < content-type: text/html;charset...

javascript - How to add button in Jquery DataTable -

my data table script looks var getsourcinglist = function (url){ $('#ajaxloader').show(); $.ajax({ type : 'get', url : url, beforesend : function() { console.log('sending request fetch'); }, success : function(data) { $('#ajaxloader').hide(); printthesourcinglistview(data); }, error: function(data){ $('#ajaxloader').hide(); console.log(data); } }); } var printthesourcinglistview = function(data){ var trhtml = "" ; var table = $('#datatable1').datatable({ "bprocessing": true, aadata: data, buttons: [ 'copy', 'excel', 'pdf' ], "aocolumns": [ { "mdata": "rrno" }...

wpf - Animating control size changes dynamically -

Image
i working on kind of menu has "flyout" mode - means remains in compact mode (only ~60px width) until mouse-over. thematic quite tricky since can't animate width of control directly , setting cause fixed size (which not want). my goal have control can have dynamic size based on it's children , max. available space in it's parent. my theory: once size changes, measuring called measures maximum available space (far more used). next step arranging . arrangeoverride() called parameter arrangebounds equivalent desired size. now cache value , if it's different actualsize property, start animation actualsize arrangebounds.width . method return size object return base.arrangeoverride(new size(widthwrapper, arrangebounds.height)); so far have (and it's partially working - widthwrapper dependencyproperty): protected override size arrangeoverride(size arrangebounds) { if (math.abs(widthwrapper) < 0.01) widthwrapper = arrangebounds.widt...

c++ - map::find with a type that's comparable but not convertible to key_type -

std::map::find accepts const key_type& argument. way requires argument convertible key_type . seems oversight me because argument doesn't have convertible key_type , has comparable it. i can make arbitrary type comparable defining 2 operator< overloads: struct a; bool operator<(const key_type&, const a&); bool operator<(const a&, const key_type&); map::find should template. it's not. i'm done whining can ask actual question: there way work around , search among map keys comparable not convertible value? my understanding use std::find_if , linear search instead of binary search ( o(n) instead of o(log(n)) ). naturally, don't want implement binary search hand. since c++14, map::find in fact template , works desire (at least when given compare::is_transparent condition described below satisfied). from cppreference : std::map::find c++ containers library std::map iterator find(const key&...

javascript - Angular.js : on form submit action is not calling -

i trying submit form on ng-submit event form submit not working. $http,$state,dtoresource injections dtoresource factory modify json data. my code below index.html <!doctype html> <html ng-app="autoquote"> <head lang="en"> <meta charset="utf-8"> <title>angular js dto mgnt</title> <!-- style sheets --> <link href="css/bootstrap.css" rel="stylesheet"/> <link href="css/app.css" rel="stylesheet"/> <!-- library scripts --> <script src="js/jquery.js"></script> <script src="js/angular.js"></script> <script src="js/angular-ui-router.js"></script> <!-- application script --> <script src="app/app.js"></script> <!-- services --> <script src="common/services/common.services.js"></sc...

java - Maven - How to get the parent pom file dependency in sbt project -

not able resolve dependencies of maven project in sbt.here issue, for example : myproject => module1(pom.xml) ,module2(pom.xml) , parentpom.xml after deployment artifactory, have module1.jar,module2.jar , parentpom.pom in artifactory,when trying add dependency of module1 in sbt project getting following error: sbt.resolveexception: unresolved dependency: org.test#module1;5.22.0-snapshot: local-snapshots: no ivy file nor artifact found org.test#myproject;5.22.0-snapshot. can please me this!! if module1.jar , module2.jar mavne generated jar go inside jar , fild pom.xml file, may inside metainf inside jar, search pom.xml, , name of pom.xml file inside jar, give same name in project pom.xml, if not work can write me, can put project pom.xml , module1.jar s pom.xml` edited: from url had given in comment https://github.com/activiti/activiti/blob/master/pom.xml after pom.xml file should try add in project pom.xml this add dependency ...

arrays - How to filter the object using lodash or javascript -

i getting object server, var data = { test1: { documents: [] }, test2: { documents: [{ vid: 'sdfas23', typeid: '81', isdeleted: false }], answer: true }, test3: { documents: [{ vid: 'h1mjinyi', typeid: '82', isdeleted: false }], answer: true } } i want filter typeid object, result expecting [81,82] can on this. in case have 1 or 0 objects in documents in example can use reduce() object.keys() var data = {"test1":{"documents":[]},"test2":{"documents":[{"vid":"sdfas23","typeid":"81","isdeleted":false}],"answer":true},"test3":{"documents":[{"vid":"h1mjinyi","typeid":"82","isdeleted":false}],"answer":true}} var result = object.keys(data).reduce(function(a, e) { if (data[e]...

Class file for com.google.android.gms.internal.zzaja not found -

i using fragment designing of firebase simple login registration. i error in oncreateview() method on initializing auth = firebaseauth.getinstance(); error:- error:(58, 28) error: cannot access zzaja class file com.google.android.gms.internal.zzaja not found please source:- http://www.androidhive.info/2016/06/android-getting-started-firebase-simple-login-registration-auth/ i solved exact problem today , stumbled onto unanswered question chance during process. first, ensure you've setup firebase android documented here: https://firebase.google.com/docs/android/setup . then, make sure compiling latest version of firebase apis (9.2.0) , google play services apis (9.2.0) using. gradle dependencies this: dependencies { ... compile 'com.google.android.gms:play-services-location:9.2.0' compile 'com.google.firebase:firebase-core:9.2.0' compile 'com.google.firebase:firebase-auth:9.2.0' compile 'com.google.firebase:fireb...

c# - SystemCore_EnumerableDebugView dll -

not sure assembly need add,as showing systemcore_enumerabledebugview missing. have added assembly system.core dll still showing error need add refrence. list<clsdownloadattachments> objlst = new list<clsdownloadattachments>(); objlst = (list<clsdownloadattachments>)session["datsetrsult"]; var result = objlst.where(p => p.mmid.tostring().contains(mmidpk)).select(p =>p.filenames.tostring()); var rst = (new system.linq.systemcore_enumerabledebugview<string>(result)).items[0]; please advice, thanks

angularjs - How can I make a variable in custom directives which can be access in controller file or in any other javascript file of the same app? -

i want declare variable in custom directives can access in same app. my requirement declare variable in custom directive , value access me. i want declare variable in below directive .directive('nglistselect', ['$filter', function($filter) { return { restrict: 'e', replace: true, scope: { selectedlistitems: "=selectedlist", availablelistitems: "=availablelist", key: "@key", buttonstyle: "@buttonstyle", panelstyle: "@panelstyle", height: "@height", width: "@width", availablelabel: "@availablelabel", selectedlabel: "@selectedlabel" }, templateurl: 'nglistselect.html', compile: function(telem, tattrs) { return { pre: function(scope, ielem, iattrs) { scope.availabletext = ang...

c# - Open a Form Dialog after x seconds -

i'm looking impliment method executes potentially lengthy or short task. have 'loading' dialog , needs shown after 3 seconds while allowing main execution go ahead. far i've thought using timer: var timer = system.diagnostics.stopwatch.startnew(); var elapsedms = timer.elapsedmilliseconds; if(elapsedms == 3000) { loader.show(); } but obvious problem if statement passed. have suggestion how approached?

Views not interactive inside ViewPager android -

i have fragment a, then did 2 things : i attached fragment inside viewpager. i attached fragment alone on activity. observations : a. when attached inside viewpager: fab button have inside fragment interactive , when press button data change in layout supposed change. b. when attached inside activity directly: fab button not iterative , data did not change in layout p.s. -> same fragment.java file attaching in both cases. so can reason behind 2 anomalous behavior ? in advance :)

python - How to set System Property "webdriver.gecko.driver" using Robot Framework? -

i'm using robot framework selenium2library automated frontend tests. ran tests in firefox browser. since version 47 of firefox built in firefoxdriver of selenium2library doesn't work anymore. searched through internet bit , found, have switch marionette aka. gecko driver. while trying following error message: suite setup failed: webdriverexception: message: path driver executable must set webdriver.gecko.driver system property; more information, see https://github.com/jgraham/wires . latest version can downloaded https://github.com/jgraham/wires again tried find in internet way set path geckodriver executable, found way java. neither python nor robot framework. have idea how set system property either in python or in robot framework ? if not want use marionette, follow mukesh's answer , change versions. if want use marionette, simplest approach add wires (or geckodriver in future) system path suggested by mozilla developers . the python bin...

django - Pisa arabic rendering issue using xhtml2pdf and reportlab -

Image
arabic goes wrong displayed on output pdf following code: template = get_template(template_src) context = context(context_dict) html = template.render(context) result = stringio.stringio() pdf = pisa.pisadocument(stringio.stringio( html.encode(pdf_encoding)), result, encoding=pdf_encoding) # pdf_encoding = 'utf-8' and in template set charset , fonts: <meta http-equiv="content-type" content="text/html; charset=utf-8"> @font-face { font-family: amiriregular; src: url(/usr/share/fonts/opentype/fonts-hosny-amiri/amiri-regular.ttf); } body { font-family: amiriregular; } the output: the arabic text in snapshot supposed be: ياسر حسن

Mysql Error 1064 ("You have an error in your SQL syntax") triggered by SQL comments -

i have series of scripts creating schema, comment following before each instruction: -------------------------------------------------------- -- table table_name -------------------------------------------------------- when execute script mysql on command line, bunch of errors following: error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near '------------------------------------------------------ ------------------------' @ line 1 (actually, 1 error each comment, in spite of message referring line 1). to solve problem removed comments , script ran without problems, surprised see such behaviour , unable find relevant question here on stackoverflow. have explanation? did ever observe such odd behaviour? i running mysql 5.6.30, default 5.6 on ubuntu @ time. from mysql manual : from “-- ” sequence end of line. in mysql, “-- ” (double-dash) comment style requires second dash followed by at...

jquery - Call javascript functions when Partial view is rendered -

i rendering partial view create popup when create button clicked. this means dynamically div appended main view on button click. after div generated , elements inside loaded, after want call javascript functions. all answers able find using .load() event, scenario different. not loading partial view div using ("#div").load(url, function(){}); div generated dynamically please suggest javascript executed synchronously. if building "the view" using jquery , inserting dom, execute "post render" code after markup inserted dom. $('#mycontainer').append(somemarkup); execsomepostrenderfunction(); if using ajax load partial view/html content server use load() function , put post render code in callback. $('#mycontainer').load('route/to/partial', execsomepostrenderfunction); or can use anonymous function: $('#mycontainer').load('route/to/partial', function(){ //...do here }); your que...

Python JSON indexing -

i response method in zabbix here: https://www.zabbix.com/documentation/3.0/manual/api/reference/host/get the json output looks if print whole response: { "property1": "value1", "property2": "value2", "property3": "value3" } the problem is, cannot index correctly. tried response["property1"] gave me error: 'zabbixapiobject' object has no attribute ' getitem ' also did try convert json that: json.load(response) the error gave me: 'nonetype' object not callable what can problem? there way split response? need 1 attribute that. edit : request_command = { "jsonrpc": "2.0", "method": "hostgroup.get", "params": { "output": "extend", "search": { "name": "testgroup" ...

html - Input text and submit in one line -

Image
how make effect (cross-browsed) without using float: left ? i need center form float attribute wrong me. can help? i've made code can see below. my code: footer input[type=text] { border-top: 1px solid #efefef; border-left: 1px solid #efefef; border-bottom: 1px solid #efefef; border-right: 0; width: 230px; padding: 0 10px; font-size: 16px; line-height: 18px; height: 35px; display: inline-block; float: left; margin: 0 auto; } footer input[type=submit] { border: 1px solid #df242b; background: #df242b url('../../../gfx/submit.jpg') no-repeat center center; color: #fff; width: 38px; height: 37px; font-size: 18px; line-height: 18px; cursor: pointer; display: inline-block; float: left; margin: 0 auto; } because want cross-browser , without using float:left , can use inline-block vertical-align:top and center, need apply margin:0 auto footer width instead i made few tweaks code. *, *::before, *...

How do I make a HTML table to be bigger than the default page size -

i have table made html , php(php content) , because of length of of sentences in 1 of sub-sections need width go outside screen(so scrolling goes in width well. the printed text in 1 of columns full stacktrace android app , because of short length of column, text gets 'squeezed' inside there. how can expand table in width go off screen scrollbar @ bottom appears? i'm going add column need have space enough. addtionally, because of height of text in 1 of 6 columns other content gets set middle of column. how make text start @ top independantly of other columns? important code: <body> <table border="1" style="border:2px solid black;"> <thead> <tr> <td>time</td> <td>android_version</td> <td>device_id</td> <td>app_version</td> <td>stack...

c++ - Run QFileDialog::getOpenFileName without separate event loop? -

i'm using qfiledialog::getopenfilename right now. however, suggested in this article , crashes when main application closes while dialog open. can see example of how reproduce crash here: int main(int argc, char **argv) { qapplication application{argc, argv}; qmainwindow *main_window = new qmainwindow(); main_window->show(); qpushbutton *button = new qpushbutton("press me"); main_window->setcentralwidget(button); qobject::connect(button, &qpushbutton::clicked, [main_window]() { qtimer::singleshot(2000, [main_window]() { delete main_window; }); qfiledialog::getopenfilename(main_window, "close me fast or crash!"); }); application.exec(); return 0; } i can use qfiledialog normal constructor instead, described here . however, don't seem native windows file open dialog. is there way non crashing program , use native windows file open dialog through qt? if close main_window instead of deleting it, won...

javascript - Unable to get property 'FromDate' of undefined or null reference -

i have asp page jscript calendar in keep getting message below ****unable property 'fromdate' of undefined or null reference**** the code i've run is: <input class=datebutton style="position: relative" onclick="showcalendar(this.form.fromdate.value, this, this.form.fromdate)" type=button value=" >>> " name=cmdshowcalendar> </td></tr> the error message says this.form undefined or null . means input doesn't belong form. either: put in <form> use form attribute identify form belongs to use other dom method find element trying reference

relayjs - how to uncached schema.json on react native -

i'm using relay react-native, when update graphql schema.json changes not detected react-native app i'm getting validation error unknown type mymutationpayload , missing fields in localhost:8000/graphql docs i've checked schema.json , fields there we should clear react-native cache this: react-native start --reset-cache

animation - Animating children element in Polymer -

is possible animate children elements without wrapping them in custom-element has polymer.neonanimatablebehavior ? seems overkill have wrap each animatable element custom element. you can use neon-animatable simple container element implementing polymer.neonanimatablebehavior. convenience element use <neon-animated-pages> . <neon-animated-pages selected="0" entry-animation="slide-from-right-animation" exit-animation="slide-left-animation"> <neon-animatable>1</neon-animatable> <neon-animatable>2</neon-animatable> </neon-animated-pages>

java ee - Weblogic 12c encryption algorithme for credentials -

in weblogic can define users , groups , can assign roles them, question (probably file) , how weblogic persist these important data. seems should encrypted, algorithm , other encryption settings? see https://blog.netspi.com/decrypting-weblogic-passwords/ or directly project: https://github.com/netspi/weblogicpassworddecryptor the relevant snippet, in case urls rot away, is: public static string decryptaes(string serializedsystemini, string ciphertext) throws nosuchalgorithmexception, invalidkeyspecexception, nosuchpaddingexception, invalidalgorithmparameterexception, invalidkeyexception, badpaddingexception, illegalblocksizeexception, ioexception { byte[] encryptedpassword1 = new base64decoder().decodebuffer(ciphertext); byte[] salt = null; byte[] encryptionkey = null; string key = "0xccb97558940b82637c8bec3c770f86fa3a391a56"; //weblogic default key char password[] = new char[key.length()]; key.getchars(0, password.length, pas...

vb.net - Serial Port strange data display and crash -

Image
i trying create vb.net program data scales using serial port. i don't know scales model, display model: ind231. problem stupid data: but if turn on putty this: as see in putty there 1 line refresh every sec, true weight first 2 00 (in middle), in situation line not refreshing, make huge line , after 5-10 s, program crash. my program code is: imports axserial public class form1 dim q queue(of string) = new queue(of string) private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load each s in system.io.ports.serialport.getportnames() lstports.items.add(s) next s end sub private sub btnstart_click(byval sender system.object, byval e system.eventargs) handles btnstart.click try if lstports.selectedindex = -1 msgbox("please select port") exit sub else serialport1.baudrate = ...

openerp - QWebException: "'NoneType' object has no attribute 'with_context'" while evaluating "doc.with_context({'lang':doc.partner_id.lang})" -

i new odoo, created module inheriting sales_order create custom report. getting above error when printing report. need please? here code snippets: test/my_module.py: class sale_order(models.model): _name = 'sale.order' _description = 'inheritance' _inherit = 'sale.order' test/views/report_template_view.xml: <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <template id="test_report"> <t t-call="report.html_container"> <t t-call="report.internal_layout"> <t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})"/> <div class="page"> <div class="oe_structure"/> <div> <strong><left>user</left></strong> ...

javascript - close id with a quote - concatenation jquery -

i have problem concatenation table id variable. problem seems to close id quote: " this variable var mytable = $('<table id=\"paymenttable' + cnt + '\"' + '></table>') the problem closing id after variable cnt . in output stream of concatenating looks this: <table id="paymenttable3> where 3 cnt -variable. greatful help! make it var mytable = $('<table id=\"paymenttable' + cnt + '\"></table>') you closing single quote ' without closing double quote " first.

css - fixed html divs going over the edge -

i'm trying learn basic html&css , making simple webpage navbar, when fix header goes on right side of page. <div id="header"> <table id="navbar"> <tr> <td>home</td> <td>about</td> </tr> </table> </div> #header { background-color: yellow; position: fixed; height: 35px; width: 100%; border-radius: 10px; border: 2px solid red} how can fix this? thanks. you need define spacing left , right. here made fiddle: https://jsfiddle.net/yq6zoyhk/ #header { background-color: yellow; box-sizing: border-box; position: fixed; top: 0; left: 0; height: 35px; width: 100%; border-radius: 10px; border: 2px solid red}

performance - Why chrome cached requests are taking time? -

Image
even though chrome caching static files (js, images, etc.,) in network tab, these files taking sometime shown in below picture. where many of cached files loading in 0ms. can please tell me though files loading cache, why loading in >0ms? at first glance, quite strange see chrome spending time downloading resources though coming cache. it's not time spent downloading web server you're seeing. rather, believe time spent downloading local database cache. the retrieval of data has amount of cost involved. resources stored in database in chrome, , retrieve data requires lookup, not instant. looking data in table, there processing involved push correct data memory, since data not stored how going used. compressed, , decompressing data can slow process. you can see in network tab that, although appears take 0 ms retrieve resources, when @ timings tab, see rounded down. example, see both 0.08 ms stalled , 0.02 ms download in request below, despite showing 0 ms i...

In Java, Can the Date type just hold MM-dd-yyyy or just hh:mm:ss? -

i converting epoch format time normal format, when convert date get, mm-dd-yyyy hh:mm:ss. if want single out date or time have use simpledateformat. returns string. wondering if there way make string date type. the type java.util.date timestamp, not more wrapper number of milliseconds since 01-01-1970, 00:00:00 utc. (the class name date unfortunately badly chosen). it not suited holding date or time value. if using java 8, use new date , time api (package java.time ); use example localdate if need store year/month/day, or localtime if need store time-of-day (hours, minutes, seconds, milliseconds). if using java 7 or older, consider using equivalent classes in joda time library.

python - django annotate a function that returns the maximum of a field among all objects that has a feature -

suppose have model: class student(models.model): class_name = models.charfield() mark = models.integerfield() and want students have highest mark in class. can student has highest mark in classes mentioned in this post . want students have highest mark in class , this: student.objects.annotate( highest_mark_in_class=max( students.objects.filter(class_name=f('class_name')) .filter(mark=highest_mark_in_class) ) ) i can for loop, large database for loops rather slow. don't know if it's possible write such query in 1 line? you have use 2 queries that: import operator functools import reduce django.db.models import max, q best_marks = student.objects.values('class_name').annotate(mark=max('mark')) q_object = reduce(operator.or_, (q(**x) x in best_marks)) queryset = student.objects.filter(q_object) first query gets list of best mark each class. second query gets students mark , class matches 1 it...

ios - Do aspect ratio constraints reduce performance? -

Image
tl;dr: usually, horizontal constraint equations , vertical constraint equations independent of each other an aspect ratio constraint links both dimensions , merging 2 smaller sets of linear equations 1 big set. understanding 2 smaller sets should easier solve combined big set , thus, i expected aspect ratio constraints reduce performance . however, simple test 100 constrained views in each dimension showed no difference in performance. why? the question in detail: constraints linear equations in auto layout, each layout constraint linear equation: view2.attribute = multiplier * view1.attribute + constant a non-ambiguous , non-conflicting layout given, when set of constraints has 1 solution. inside method layoutsubviews() system resolves constraints i.e. computes frames subviews these constraints. task solve system of linear equations done applying gauss algorithm . x , y: 2 independent sets of equations now long there no aspect ratio constraints involved the h...

php - change random number when echo -

i have problem rand function in php . set random number on $_session , in other place echo this. every time echo $_session , value on changed. code in page1: session_start(); $_session['y'] = rand(1,100); echo $_session['y']; and in other page2 write this: session_start(); echo $_session['y']; how can solve it? note page2 appended ajax page1 when clicking on button. it sounds including page 1 on page 2. option 1 do not include page 1 on page 2. option 2 check see if random number exists before setting it. session_start(); if (! isset($_session['y'])) { $_session['y'] = rand(1,100); } echo $_session['y'];