Posts

Showing posts from February, 2011

tinyMCE with Javascript -

i attempting insert text data @ cursor position containing other text data. i'm using following tinymce code: tinymce.activeeditor.selection.setcontent("text string"); instead of being inserted, overwrites existing data text string passed in appearing in buffer. in examining documentation, found code supposed replace, not insert text @ cursor location. whoever coded mistaken in its' use. my question: there different piece of code allow insertion, not replacement of text data data buffer? you want insertcontent api: https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#insertcontent for example: tinymce.activeeditor.insertcontent("<p>this new</p>");

java - How does it possible that each jar works on linux and windows? -

i know java give powerful advantagte: java code compiled bytecode , bytecode executed jvm, hence java portability. however, there exists functions such implementation depends on operating system. https://speakerdeck.com/raboof/jvm-hacking (4-th slide) can see there system-depended c code. how work ? mean same jar using bind method can executed on windows , linux. after all, bind method on linux , windows can different (number of paramers, name , more). can explain me? it's jvm , runtime library magic. pure java programs consist of bytecode, , jvm interprets or compiles bytecode, local cpu / os can execute it. then there methods declared "native", , specific java runtime library windows x86 has implementation, x64 version has implementation, linux xyz has yet implementation , on. signature (number , type of parameters) of these native methods same on implementations, buildung common abstraction on windows/linux/macos functionalities wrap. i

c++ - adding <iostream> breaks the code in g++-7 -

there sample // example 2: compile? // // in library header: namespace n { class c {}; } int operator+(int i, n::c) { return i+1; } // mainline exercise it: #include <numeric> int main() { n::c a[10]; std::accumulate(a, a+10, 0); } from "exceptional c++: 47 engineering puzzles, programming problems, , solutions" -- item 34. name lookup , interface principle—part 4 g++ 5.4 compiles successfully. adding #include <iostream> breaks code // example 2: compile? // // in library header: namespace n { class c {}; } int operator+(int i, n::c) { return i+1; } // mainline exercise it: #include <numeric> #include <iostream> int main() { n::c a[10]; std::accumulate(a, a+10, 0); } clang-4.0 able compile it. g++ 5.4 , g++7.2.0 show following error in file included /usr/include/c++/7/numeric:62:0, src/widget.cpp:7: /usr/include/c++/7/bits/stl_numeric.h: in instantiation of ‘_tp std::accumulate(_inputiterator, _inputiter

python - "Import Error: cannot import name 'unicode_literals' " -

sorry if dumb question i'm trying import , open csv using pandas in python. whenever hit run syntax error "cannot import name 'unicode_literals'". have no idea why happening , haven't been able find source online details error means. this code: import pandas pd open(r"filepath\file.csv") rawdata: pd.read_csv(rawdata) here error: c:\anaconda3\python.exe "filepath" traceback (most recent call last): file "filepath/main.py", line 1, in <module> import pandas pd file "c:\anaconda3\lib\site-packages\pandas\__init__.py", line 7, in <module> . import hashtable, tslib, lib file "pandas\src\numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:22997) file "c:\anaconda3\lib\site-packages\numpy\__init__.py", line 107, in <module> __future__ import division, absolute_import, print_function file "c:\anaconda3\lib\__future__.py", lin

python - Concatenating iterable of defaultdicts into DataFrame -

simplified example of have now: from collections import defaultdict d1 = defaultdict(list) d2 = defaultdict(list) d1['a'] = [1, 2, 3] d1['b'] = [true, true, true] d2['a'] = [4, 5 , 6] d2['b'] = [false, false, false] desired result: b 0 1 true 1 2 true 2 3 true 3 4 false 4 5 false 5 6 false this line below work, i'm looking alternative doesn't have instantiate separate dataframe every defaultdict. pd.concat([pd.dataframe(d) d in (d1, d2)]).reset_index(drop=true) could start with: pd.dataframe([d1, d2]) and convert long format. you merge dicts , then instantiate dataframe. d3 = {k : d1[k] + d2[k] k in d1} d3 {'a': [1, 2, 3, 4, 5, 6], 'b': [true, true, true, false, false, false]} df = pd.dataframe(d3) df b 0 1 true 1 2 true 2 3 true 3 4 false 4 5 false 5 6 false automating merge multiple objects: d3 = defaultdict(list) d in dict_list: k in d:

pointers - Which way is less memory intensive? -

i wrote methods operate on same struct, respectively slice of struct. @ beginning called each method on struct in different lines ( go playground ): test.modify() test.modify2() ... the second shot calling methods on output of previous method ( go playground ): test2.modify().modify2()... now i'm asking myself, 1 less memory intensive? or there other side effects not recognize? 1 go way it? solution 1 works on addresses, there no values passed around. solution 2 returns references , more nice use - in opinion.

entity framework - Package Manger Console (Update-Database cmd) is always getting connectionString from appsettings.development.json -

aspnetcore_environment set "production" via project properties , via pmc & powershell $env:aspnetcore_environment="production" which confirmed pmc&powershell get-childitem env: pmc picking connectionstring appsettings.development.json guess startup.cs, key line being .addjsonfile($"appsettings.{env.environmentname}.json" adds/overwrites settings based on environment public class startup { public startup(ihostingenvironment env) { var builder = new configurationbuilder() .setbasepath(env.contentrootpath) .addjsonfile("appsettings.json", optional: false, reloadonchange: true) /*this line*/.addjsonfile($"appsettings.{env.environmentname}.json", optional: true); //other stuff } public void configureservices(iservicecollection services) { services.adddbcontext<acontext>(options => options.usesqlserver(configuration.getconnectionstring("con

process - UWP detect if Desktop Bridge app is running -

i have uwp contains desktop bridge component. uwp contains interactive code, including handling session management (login , logout). desktop app runs in background - displays no ui of time - must running when app's user signed in (the uwp , desktop components share auth). if desktop app not running when uwp starts, app signed in, uwp needs start desktop app. similarly, whenever uwp signs in user, needs start desktop component (if isn't running). signing out user doesn't strictly require exiting desktop app, though wouldn't hurt. critically, desktop component must not (automatically) exit when uwp exits, there's no guarantee on launch of uwp whether desktop app launched previous instance (and still running) or not. the problem is, can't find way uwp detect whether desktop bridge component running, or kill already-running instance. methods in fulltrustprocesslauncher not return process object or other way monitor desktop app. how can uwp detect if deskt

symfony - ERRO- You must configure the check path to be handled by the firewall using form_login in your security firewall configuration -

hello have problem in symfony project fosuserbundle when login give error you must configure check path handled firewall using form_login in security firewall configuration. i try different codes , error i use: symfony 3 fosuserbundle 2.0 config.yml fos_user: db_driver: orm # other valid values 'mongodb' , 'couchdb' firewall_name: main user_class: appbundle\entity\user from_email: address: "testeapp@testapp.com" sender_name: "test app" routing app: resource: '@appbundle/controller/' type: annotation admin_area: resource: "@sonataadminbundle/resources/config/routing/sonata_admin.xml" prefix: /admin fos_user: resource: "@fosuserbundle/resources/config/routing/all.xml" security # started security, check out documentation: # https://symfony.com/doc/current/security.html security: # https://symfony.com/doc/current/se

sorting - Is possible to re-sort or edit my firebase list in ionic 2? -

i'm not sure if there example question or not want re-sort or edit firebase list using possible methods. for example: have firebase list: public classeslist: firebaselistobservable<any[]>; ... this.classeslist = this.afd.list('/classes/',{ query:{ orderbychild:'uemail', equalto: 'user1@gmail.com' } }) and sample example of contains of classeslist classeslist -- class1 ----- day: 'sun,tus,thu' ----- time: '10:00' -- class2 ----- day: 'sun,thu' ----- time: '8:00' -- class3 ----- day: 'sun,thu' ----- time: '9:00' my problem: how can make "if statements" between classes re-sort list or push values in other temp array use in html (& should add 'async' temp array or not ?) ! where uemail child in classeslist example? output of this.afd.list object. of children matching query. can use function converts object array , , sort array way want.

apache spark - GC overhead limit exceeded on PySpark -

i'm working on huge logs pyspark , i'm facing memory issues on cluster. it gaves me following error : http error 500 problem accessing /jobs/. reason: server error caused by: java.lang.outofmemoryerror: gc overhead limit exceeded here's current configuration : spark.driver.cores 3 spark.driver.memory 6g spark.executor.cores 3 spark.executor.instances 20 spark.executor.memory 6g spark.yarn.executor.memoryoverhead 2g first, don't cache/persist in spark job. i've read memoryoverhead, that's why i've increased it. seems it's not enough. i've read issue garbage collector. , that's main question here, what's best practice when have deal many different databases. i have lot of join , i'm doing sparksql, , i'm creating lot of tempviews . bad practice ? better make huge sql requests , 10 joins inside 1 sql request ? reduce code readability solve problem ? thanks, well, think i'v

Javascript detect resize of div using event listener not triggering function -

i have resizable div event listener , function attached it. here code: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> #el { border: 2px solid #333; padding: 20px; width: 300px; resize: both; overflow: auto; } </style> </head> <body> <div id="el"> let user resize div element. </div> <script> function myfunction(){ console.log('el resized'); } div_elm = document.getelementbyid('el'); div_elm.addeventlistener("resize", myfunction); </script> </body> </html> the problem function not firing when div resized. how can fix this?

types - Why does it appear in R that lapply is decaying integer64 to numeric and how can I avoid it? -

this question has answer here: how void type conversion in r's apply (bit64 example) 1 answer i'm not sure understand happening in following simple code snippet: require(bit64) foo <- as.integer64(c(20,30,40)) foo #shows integer64 lapply(foo, class) #says numeric! why happening in call lapply? there way avoid it? internally in lapply function doing integer64 arithmetic , found breaking it.. something in guts of lapply doing it. instead, try applying on indices , calling function: > lapply(1:length(foo),function(x){class(foo[x])}) [[1]] [1] "integer64" [[2]] [1] "integer64" [[3]] [1] "integer64"

python - Django filters with pagination not keeping state -

this question exact duplicate of: django filters not applying when going next page 1 answer in django project using django filters , pagination. when click next link go next page, lose state. have tried ideas here nothing has done trick yet. ideas on why happens? html <div class="col-xs-4 clearfix text-center"> {% if relations.has_next %} <div class="pull-right"> <a href="?page={{ relations.next_page_number }}{% if createdby %}&createdby={{ createdby }}{% endif %}{% if project %}&project={{ project }}{% endif %}{% if createdbefore %}&createdbefore={{ createdbefore }}{% endif %}}">next &raquo;</a> </div> {% endif %} </div> view def relations(request): annotations.filters import relationsetfilter qs

sql - How to put part of a SELECT statement into a Postgres function -

i have part of select statement pretty lengthy set of conditional statements. want put function can call more efficiently on table need use on. so instead of: select itemnumber, itemname, base, case when labor < 100 , overhead < .20 when ..... when ..... when ..... ..... end add_cost, gpm items1; i can do: select itemnumber, itemname, base, calc_add_cost(), gpm items1; is possible add part of select function can injected calling function? i sorting through documentation , google, , seems might possible if creating function in plpgsql language opposed sql . however, reading isn't clear. you cannot wrap any part of select statement function. expression case can wrapped: create or replace function pg_temp.calc_add_cost(_labor integer, _overhead numeric) returns numeric $func$ select case when _labor < 100 , _overhead < .20 numeric &

php - Zscaler API Example Code -

i have been trying connect zscalershift api: https://api.zscalershift.net/ able use web based swagger style api calls, struggling things working in postman or php. figure others have issue , thought worthwhile post online. ok, here example code of how authenticate api, add site using function in php or update location using function. $zscaleruser = 'username'; $zscalerpass = 'password'; $customerid = 'customerid'; $sitename = 'sitename'; $zslocid ='locationid'; $zsipaddr = 'ipaddress'; $zscalerauthcurl = zscalersignin($zscaleruser,$zscalerpass); zscaleraddlocation($zscalerauthcurl,$customerid,$sitename,$zsipaddr); zscalerupdatelocation($zscalerauthcurl,$customerid,$sitename,$zslocid,$zsipaddr); function zscalersignin($zscaleruser,$zscalerpass) { $curl = curl_init(); curl_setopt_array($curl, array( curlopt_url => "https://api.zscalershift.net/shift/api/v1/signin", curlopt_returntr

functional programming - Use map function to transform two seqs into one. Scala -

in clojure have map function can provide function , 2 collections (map + [1 2 ] [4 5 ]) ;;=> (5 7 ) is there similar in scala? i tried comprehension got 4 combinations. if there way comprehension, better because have filtering in future/ you can use .zip first combine 2 collections one, map: seq1.zip(seq2).map { case (x, y) => x + y } i don't think it's possible for-comprehension. can filtering call .filter or .filternot well.

intrinsics - Does Clang have something like #pragma GCC target? -

i have code written uses avx intrinsics when available on current cpu. in gcc , clang, unlike visual c++, in order use intrinsics, must enable them on command line. the problem gcc , clang when enable these options, you're giving compiler free reign use instructions everywhere in source file. bad when have header files containing inline functions or template functions, because compiler generate these functions avx instructions. when linking, duplicate functions discarded. however, because source files compiled -mavx , not, various compilations of inline/template functions different. if you're unlucky, linker randomly choose version has avx instructions, causing program crash when run on system without avx. gcc solves #pragma gcc target . can turn off special instructions header files, , code generated not use avx: #pragma gcc push_options #pragma gcc target("no-avx") #include "myheader.h" #pragma gcc pop_options does clang have this? s

bash - How to measure time of execution of each "sub-process" of a shell script -

i'm running program multiple times via script, need time of execution of each time run it. i'm trying use "time" function same way when use via terminal, doesn't work. here's code "time" function inside script: #!/bin/sh time ./tree < in_1.in > out_1.out time ./tree < in_2.in > out_2.out time ./tree < in_3.in > out_3.out time ./tree < in_4.in > out_4.out time ./tree < in_5.in > out_5.out time ./tree < in_6.in > out_6.out time ./tree < in_7.in > out_7.out time ./tree < in_8.in > out_8.out time ./tree < in_9.in > out_9.out time ./tree < in_10.in > out_10.out note 1: without "time" before each line, script runs perfectly. if possible, i'd put every recorded time new file, tried using "echo", haven't had luck it. note 2: there way make script run every file inside directory, without putting every , each 1 inside script? there no time command in bou

python - seaborn subplot graph distortion issue -

Image
i have tried create subplot multiple regplot using seaborn(python visualization package). i pretty comfortable using subplot, find unordinary issue last regplot gets distorted. as shows in image below, last regplot(weight_per_vol) graph gets distorted. scale of x(weight_per_vol) regular float num in range of 1 ~ 10. scale of y(normal_loss) continuous integer in range of 65 ~ 250. i not see why scale of axis , graph being distorted last regplot graph. x not seem problem because have tried switching position other variables. whichever variable use, last graph gets distorted.

Creating Dockerfile, Docker image,of Asp.net project in Windows 10 and how to push that image on Docker hub and get url to run the project -

i have install docker toolbox in windows 10 pro 64 bit. on quickstart terminal wrote commands docker version . don't know how create docker file , docker image of made asp.net project. have created account in docker hub , want push image on docker hub , url run project @ time remotely.

BigQuery with Airflow - missing projectId -

Image
trying out example below: https://cloud.google.com/blog/big-data/2017/07/how-to-aggregate-data-for-bigquery-using-apache-airflow while running 1 of commands: airflow test bigquery_github_trends_v1 bq_check_githubarchive_day 2017-06-02 getting error : typeerror: missing required parameter "projectid" error stack: [2017-09-11 16:32:26,630] {models.py:1126} info - dependencies met <taskinstance: bigquery_github_trends_v1.bq_check_githubarchive_day 2017-06-02 00:00:00 [none]> [2017-09-11 16:32:26,631] {models.py:1126} info - dependencies met <taskinstance: bigquery_github_trends_v1.bq_check_githubarchive_day 2017-06-02 00:00:00 [none]> [2017-09-11 16:32:26,632] {models.py:1318} info - ----------------------------------------------------------------------- --------- starting attempt 1 of 6 ----------------------------------------------------------------------- --------- [2017-09-11 16:32:26,632] {models.py:1342} info - executing <task(bigquerycheck

javascript - Could CDN be faster way to load resources? -

Image
i setting admin panel blog today, , decided use cdn bootstrap link rather keeping files local on server since initial testing. figured add files server later in order speed up, that's when had thought. this particular server bluehost shared server , inexplicably slow. faster if used cdn? , noticeable? i know stackoverflow likes questions specific, let's use bootstrap's cdn in particular scenario since popular framework. could faster if used cdn? yes. cdns option not because fast servers, because when use popular cdn, sources need (e.g. boostrap, jquery) may have been downloaded user @ site and, such, hit browser's cache - , load fast possibly could. and noticeable? this depends on how slow current server in relation cdn. google devtools have useful tool this. have whole section dedicated that: get started analyzing network performance in chrome devtools . includes guided tools assist in emulating connections , devices, analyzing requests

c++ - Why can`t I put a zero in front of an integer in an "if" statement -

why little cheat code not work when put 0 in front of it. when take out , put little cheat code works fine, when put in , put cheat code in skip right over. #include <iostream> #include <random> int main() { bool correct = false; std::cout << "put number 1 100" << std::endl; int guess = 0; std::cin >> guess; std::random_device rd; std::mt19937 mt(rd()); std::uniform_int_distribution<int> rnd(0, 101); int answer = rnd(mt); //random number while (correct == false) { if (guess == answer) { std::cout<<"you got it!!!"<<std::endl; correct = true; } else if (guess == 01010101)#<--------------------problem #it works when 1010101 { std::cout<< answer<< std::endl; std::cout << "put number 1 100" << std::endl; std::cin >> guess;

javascript - How to get input value from each td after attribute readonly applied? -

i built script clone every child rows parent typing on checkbox checked here . it working until now. want each child input value saved ajax. last child echoed. js function cloneallz(clsname) { var $input1 = $('.prdedt').find('td.' + clsname + ' input[type="text"]').filter(':visible:first'); //master input //console.log($input1.attr('id'));//test master input $input1.on('input', function() { var $this = $(this); window.settimeout(function() { if ($('input.' + clsname).is(':checked')) { var $child = $('.prdedt').find('td.' + clsname + ' input[type="text"]'); $child.val($this.val()).attr('readonly', true).each(function() { //how loop each input in column??? console.log($this.attr('id')); }); $input1.attr('readonly', false); } else { $('.prdedt').find('td.' +

utf 8 - Convert a sequence of bytes to a jpeg file in Java -

Image
i interfacing medical instrument pc using java . data transfer working fine. problem along content (string), data contains 4 jpeg images . entire stream encoded in utf-8. problem able extract data jpeg unable save file in right format. i have looked around , data looks fine (in starts ffd8 , ends ffd9) i'm storing byte data in array _tmp. have tried following 1) writing bytes file fileoutputstream _fos = new fileoutputstream(_filename); _fos.write(_image_string.getbytes()); _fos.flush() _fos.close(); i following error when try open file i have tried use bufferedimage follows bufferedimage _bi = imageio.read(new bytearrayinputstream(_tmp)); file _image = new file(_filename); imageio.write(_bi,"jpg",_image); for following exception raised. java.lang.illegalargumentexception: image == null! @ javax.imageio.imagetypespecifier.createfromrenderedimage(unknown source) @ javax.imageio.imageio.getwriter(unknown source) the spec of data format pasted be

Unable to send email from CodeIgniter -

i using codeigniter v3.1.4.in website have 'contact us' page email sending function not working @ all.the strangest thing exact code working in 1 of project while not in project. $this->email->send() the above line executes not send emails.neither show error messages.however, if 'from' address & 'to' address same like(info@mywebsite.org) send mail itself.when 'from' address (user@gmail.com) , 'to' address (info@mywebsite.org), not work. the code using send email is: $this->form_validation->set_rules('sender_name', 'name', 'required'); $this->form_validation->set_rules('sender_email', 'enter email', 'required|valid_email'); $this->form_validation->set_rules('mail_subject', 'subject', 'required'); $this->form_validation->set_rules('mail_message', 'your message', 'required'); if (isset($_post) && !em

php - How to update 3 tables columns while only one column is visible to the page -

this table column display message depends on user preferred language choice in db. eg if preferred language eng eng message show ps: in database, there's 3 column storing 3 types of message of different languages <?php $possiblelang = ["繁體","简体","eng"]; $testareafield = ["traditionalmessage","simplifiedmessage","engmessage"]; $treatmentname = ["vaccinename1","vaccinename2","vaccinename3"]; $treatmentnamesuffix = ["\n下一個注射期為:","\n下一个注射期为:","\nnext injection period be:"]; $index = array_search($row['language'],$possiblelang); ?> <td> <textarea rows="3" cols="18" class="url" name="<?php echo $testareafield[$index]; ?>[]" data-value="<?php echo $row[$treatmentname[$index]] . $treatmentnamesuffix[$index]; ?>"><?php echo $row[$testareafield[$index]]; ?>

java - How to use the value returned from a method -

import java.util.scanner; public class movies { static scanner scan = new scanner(system.in); static string movies[] = {"1. it\tp200", "2. battleship island\tp300", "3. annabelle creation\tp180", "4. woke this\t100"}; static string name; static int seats=0; static int number=0; public static void getname(){ system.out.print("please enter name: "); name = scan.nextline(); system.out.println("\nwelcome movieworld, " +name); getmovietitle(); } public static int getmovietitle(){ system.out.println("\nnow showing"); (string movie : movies) { system.out.println(movie); } char choice; system.out.print("would ticket? (y/n)"); choice= scan.next().charat(0); switch(choice){ case 'y': case 'y': system.out.print("please select movie: "); number = scan.nextint

asp.net core - UserManager.RemoveFromRoleAsync() not removing from role -

okay, weird. if user.isinrole("admin") returns true, user indeed in "admin" role. however, when try remove them role, identityresult usermanager.removefromroleasync() claims user not in role. i attempt remove role so: if (user.isinrole("admin")) { var user = await _usermanager.findbynameasync(user.identity.name); var result = await _usermanager.removefromroleasync(user, "admin"); } i have own custom userstore implements iuserrole interface (against marten-based postgresql db ). .removefromroleasync method looks this: public async task removefromroleasync(tuser user, string normalizedrolename, cancellationtoken cancellationtoken) { cancellationtoken.throwifcancellationrequested(); if (user == null) { throw new argumentnullexception(nameof(user)); } var role = await roles.firstordefaultasync(r => r.normalizedname == normalizedrolename, cancellationtoken); if (role != null) {

javascript - how to focus on a div element in webview use code in android development -

i had question while try focus on div element in webview in android development. had set editable div element. however, no matter use webview.requestfocus() or document.getelementbyid('container').focus() or both, never works. want know how focus div element in webview . when div loading event generated js. can set tab index attribute , give try http://jsfiddle.net/qakgv/ <div id="generate"> $("#generate").attr('tabindex',-1).focus(function () { //do stuff });

networking - Algorithms in DHCP -

what algorithms dictate how dhcp assigns ip addresses? there references, algorithms, c/assembly/c++/etc. source code demonstrates how dhcp assigns ip addresses flawlessly? thanks. this different different dhcp servers, , should documented particular dhcp server using. example, web search finds @ https://technet.microsoft.com/en-us/library/hh831538(v=ws.11).aspx if client request matches conditions of policy specific ip address range associated, server assign first free ip address range determined rule. if policy associated multiple address ranges, server assign ip addresses first attempting assign ip lowest address range. if no ip addresses available use lower address range, server free ip address higher address ranges. if no ip addresses free of address ranges associated policy, server process next matched policy defined processing order.

Copy text from one text box to other (Microsoft Access VBA) -

i working ms access form , vba edit address information. need able select part of address capture selected part , assign variable. for example: text box on form has in it: "200 main st bldg 27". select 'st bldg 27' using mouse , click button copy selected text. the sub function have written private sub mouseupevent(button integer, shift integer, x single, y single) if len(form_frm_messages.sms_text.seltext) > 0 dim clipboard msforms.dataobject dim strcontents string docmd.openform "frm_sales_entry", acnormal set clipboard = new msforms.dataobject clipboard.settext form_frm_messages.sms_text.seltext clipboard.putinclipboard clipboard.getfromclipboard strcontents = clipboard.gettext else 'do nothing end if end sub but when calling method mouseupevent 1, 1, 0, 0 throwing error saying 'you can't reference property or method control unless control

java - How to read Git notes using JGit given a commit-sha -

i trying read git notes information custom ref refs/notes/abcd of particular commit in repository using jgit here tried: repository repository = repositorymanager.openrepository(reponame); git git = new git(repository); objectid oid = repository.resolve("5740b142a7b5f66768a2d904b267dccaef1a095f"); note note = git.notesshow().setnotesref("refs/notes/abcd").setobjectid(oid).call(); objectloader loader = repository.open(note.getdata()); byte[] data = loader.getbytes(); system.out.println(new string(data, "utf-8")); i following compilation error: error: incompatible types: org.eclipse.jgit.lib.objectid cannot converted org.eclipse.jgit.revwalk.revobject how pass revobject variable git setobjectid() given commit-sha string? with revwalk , object id can parsed , resulting revcommit can passed shownotecommand . for example: revcommit commit; try( revwalk revwalk = new revwalk( repository ) ) { commit = revwalk.parsecommit( oid

Javascript is it possible to move all my script files inside my html to another file -

i have simple dojo layout screen. wonder how can move javascript/dojo scripts file without affecting program? here created button in body , reference in script. want still reference in js in different file. below simple html code: <!doctype html> <html > <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="x-ua-compatible" content="ie=emulateie7" /> <link rel="stylesheet" href="js/dojo/dijit/themes/claro/claro.css"> <style type="text/css"> @import "js/dojo/dojox/grid/resources/clarogrid.css"; /*grid needs explicit height default*/ #form_div { width:600px; border:2px solid black; padding: 10px 10px 10px 10px; } #grid_div { width: 600px; height: 20em; } #addbutton_div { margin-left: 498px; } #savebutton_div { margin-left: 392px; } </style> <script>dojoconfig = {async: true

javascript - Vue2 render showing symbols at the begining -

i working on project uses laravel 5.4 & vue2 (laravel socialite) render messages pusher. trying fix several "bugs" , here 1 not able fix yet: i have function on vue element: showchatbox : function(conversation) { indexes = $.map(this.chatboxes, function(thread, key) { if(thread.id == conversation.id) { return key; } }); if(indexes[0] >= 0) { console.log('prevented second opening of chat box'); } else{ this.$http.post(base_url + 'data/' + conversation.id).then( function(response) { if(response.status) { var chatbox = json.parse(response.body).data; chatbox.newmessage = ""; chatbox.user = conversation.user; chatbox.minimised = false; this.chatboxes.push(chatbox); vm = this; settimeout(function(){ vm.autoscroll('.c

javascript - Angularjs: Facing issue with ng-change and ng-iterate -

problem description: whenever try select elective dropdown1, same subject code & subject credit gets populated 2nd elective well. whenever try select last value of dropdown, subjecty code & subject credit remains unchanged (i.e., previous value displayed). i have browsed stack overflow on posts related scenario. but, couldn't find solution scenario specific. that's reason, why i'm posting question. i'm complete newbie angularjs. appreciated. in advance! calculateresult.html: <tr ng-repeat="x in subjects"> <td ng-if="x.subjectcode.indexof('elective') == -1">{{ x.subjectcode }}</td> <td ng-if="x.subjectname.indexof('elective') == -1">{{ x.subjectname }}</td> <td ng-if="x.subjectcode.indexof('elective') != -1">{{ elective.electivesubjectcode }}</td> <td ng-if="x.subjectname.indexof('elective') != -1" ng-model=&q

javascript - Why does WebDriver not move to the next page when "clicking" an element? -

i doing: driver = new webdriver.builder() .forbrowser('safari') .build(); var referrer = 'http://localhost:3000/tours/hood-river'; // console.log(referrer); driver.get(referrer); driver.findelement(by.id('requestgrouprate')).click(); //requestgrouprate link, clicking should move new page driver.wait(function(){ return driver.findelement(by.id('mything')).then(function(element){ console.log("hereere"); assert(element.value === referrer); done(); }); },10000); i find findelement(by.id('mything')) , fails, though page should on has 'mything'. if change line driver.findelement(by.id('requestgrouprate')).. then element found! leads me believe, click() not cause driver navigate link. edit: link trying click on: <a id="requestgrouprate" href="/tour

See full report of User Engagement by Screen in Firebase -

Image
first time user of firebase here. i'm confused on how see full report of user engagement screens. in firebase dashboard, can see this: theres no link view full report of screens. in google analytics, can see in trivial way.

regex - Java: splitting a comma-separated string but ignoring commas in quotes -

i have string vaguely this: foo,bar,c;qual="baz,blurb",d;junk="quux,syzygy" that want split commas -- need ignore commas in quotes. how can this? seems regexp approach fails; suppose can manually scan , enter different mode when see quote, nice use preexisting libraries. ( edit : guess meant libraries part of jdk or part of commonly-used libraries apache commons.) the above string should split into: foo bar c;qual="baz,blurb" d;junk="quux,syzygy" note: not csv file, it's single string contained in file larger overall structure try: public class main { public static void main(string[] args) { string line = "foo,bar,c;qual=\"baz,blurb\",d;junk=\"quux,syzygy\""; string[] tokens = line.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1); for(string t : tokens) { system.out.println("> "+t); } } }

python - How to copy the logging information of a program to an existing file? -

my book states copy logging information file ( assume it's name cover.txt ) add following code in program: logging.basicconfig(filename='cover.txt',level=logging.debug,format=' %(asctime)s - %(levelname)s - %(message)s') when run program, new file named cover created in documents folder! , logging information copied file , not file have made. does happen? if not, how can copy logging info original file cover.txt ? when run program, new file named cover created in documents folder! , logging information copied file , not file have made. the program working correctly. don't create logging file first, application create automatically. this because logging module in python comprehensive, can log files, network locations, console, email addresses, other servers , when comes logging files - can automatically rotate log files. for example, can configure logging module create new log file every day, or after log file reaches size, create

rename the specific file with current time stamp using perl script for windows -

i using below script rename renaming file end sta.i need rename file starts krat or trat. #!/usr/local/bin/perl use strict; use warnings; use file::copy; $directory = 'c:\users\desktop'; chdir($directory) or die "can't chdir $directory $!"; opendir(dir, $directory) || die "couldn't opendir: $!\n"; @files = grep { $_ ne '.' && $_ ne '..' } readdir dir; foreach(@files) { print $_,"\n"; $newname = $_; $newname =~ s/sta$/t00/g; print "renaming: $_ -> $newname \n"; rename($_, $newname); } some minor changes script. use strict; use warnings; use file::copy; $directory = 'c:\users\rajkunal_aps\desktop'; chdir($directory) or die "can't chdir $directory $!"; opendir(dir, $directory) || die "couldn't opendir: $!\n"; @files = grep { $_ ne '.' && $_ ne '..' } readdir dir; foreach(@files) {