Posts

Showing posts from April, 2010

c# - Update UI element from thread -

i try create in windows phone timer update every 10-15 ms (for ui element). , want have opportunity append time. create timespan , dispatchertimer interval = 15 ms. every 15 ms call event subtract 15 ms timespan , when timespan <= 0 call method. when set timespan 4 seconds (for example) in life passed more 4 sec 4,6 sec. tryed use async/await did't work. tryed use system.threading don't know how update element create in other thread. so every 15 ms call event subtract 15 ms timespan , when timespan <= 0 call method. your logic flawed. can't possibly update timespan way because: as stephen cleary mentioned in answer, have no guarantee timer fire @ 15 ms even if did, doesn't take account time needed update timespan (say takes 1ms compute new timespan, timer drift of 1ms every 15ms) to have accurate time, need store timestamp @ started (retrieve using datetime.utcnow . every time timer tick, take new timestamp , substract 1 saved. way, know how

mysql - Check table_A before updating table_B -

i'm trying make query checks if field 'field_a' in 'table_a' '0' , if is, update 'field_b' in 'table_b' '10'. i have no idea if possible. have little experience mysql , i'm trying things out. if is, i'd know how done. update table_b set field_b = 10 exists (select 1 table_a field_a = 0)

android - How can i segment an image using opencv4android -

i developing application on android platform. app needs capture image using camera, , analyse captured image see red , blue color ends , next step make contour arround twi shape cirle , triangle.(already done ) have move next step : segmentation can me how segment images. ideas? assuming c contour: rect roi = imgproc.boundingrect(c); mat newmat = mrgba.submat(roi); bitmap bmp1 = bitmap.createbitmap(newmat.width(), newmat.height(), bitmap.config.argb_8888); utils.mattobitmap(newmat, bmp1); bmp1 should hold image want. this give rectangular image shows bounding area of original object, if circle have detected, circle plus other parts of image contained in bounding box. if just want detected object , have rest of content transparent harder problem.

css - Internet Explorer and Chrome: table-hover not displayed properly -

for better visual experience use css style on <tr> when hovering on it. to see complete design: http://jsfiddle.net/rdje3/1/ i used: .table_test tr:hover { outline: none; border-color: #29ec24; box-shadow: 0 0 10px #29ec24; } this works fine in firefox. but in internet explorer hover gets displayed not complete (just between <td> ) , in google chrome nothing displayed. why? first of seems it's official bug chrome. stated here way setting 'display: block' on <tr> element, requires fix positioning afterwards. also, box-shadow requires use -webkit- prefix chrome. can see 'working' , malformed example here . you'll have set width of table cells yourself.

How to import Swift code to Objective-C -

i have written library on swift sclalertview-swift , wasn't able import current project on (objective-c) is there ways import it? #import "sclalertview.swift" - 'sclalertview.swift' file not found you need import targetname-swift.h . note it's target name - other answers make mistake of using class name. this single file autogenerated header defines objective-c interfaces swift classes in project either annotated @objc or inherit nsobject . if target name contain spaces, replace them underscores (e.g. "my project" becomes "my_project-swift.h")

Changing the default dark Android theme to white in Xamarin.Forms? -

xamarin.forms generate greyish android application. i'd have light / white theme in android (like in ios target). does simple way switch exist? you can put theme parameter applicationattribute of main activity like this [assembly: application(icon = "@drawable/icon", theme = "@android:style/theme.holo.light")] or can put string androidmanifest.xml <application android:theme="@android:style/theme.holo.light" />

node.js - Are Express Sessions inherently unique to the visitor -

i'm troubleshooting issue server instance need root cause analysis , right believe driver express sessions. i've implemented sessions primary intra-page data storage mechanism, seems sessions not unique visitor relationship. by mean have session prefills form on "shipping information" page. however, if visit page other browsers or other machines detail first session created on server start prefilled if session data bleeding these other browser relationships. so, i'm trying understand if intention sessions unique visitor default. if not, can made unique? i'm worried because admin authentication done via sessions. yes unique visitor, sounds if code setting global state, , not sessions. may want post config using, plus setting session vars.

c++ - Cannot open file in resources directory -

Image
i've tested every natural iteration can imagine right still can not open file qfile object. i've tested placing file in ./resources directory , in directory source file. i've cleaned project in between each test , restarted qt creator well. i've deleted *.pro.user project configuration file , tested new versions of that. #include <qfile> #include <qdebug> ... //qfile input_file("./resources/testfile.txt"); //qfile input_file("qrc:/10_graph.txt"); //qfile input_file("testfile.txt"); qfile input_file(":/testfile.txt"); if (!input_file.exists()) { qdebug() << "file not exist"; exit(11); } qt creator >> about qt creator 3.1.1 (opensource) based on qt 5.2.1 (clang 5.0 (apple), 64 bit) you should add resource file project , add testfile.txt resources. after can access file resources : qfile input_file(":/testfile.txt"); if add prefix resources can accessed :

javascript - How to locate the correct link directory files in my php -

my problem links not correct says "failed load resources" in console. both code not related. , user.php asking connection inside dbc folder database.php , myscript.js wants find user.php located inside view folder. image of current folder file tree: http://s38.photobucket.com/user/eloginko/media/folder_zps2d422ae2.png.html user.php <?php include_once('view/../dbc/database.php'); $db = new connection(); $db = $db->dbconnect(); $email = $_post['email']; $pass = $_post['password']; if(!empty($email) && !empty($pass)){ $st = $db->prepare("select * user email=? , password=?"); $st->bindparam(1, $email); $st->bindparam(2, $pass); $st->execute(); if($st->rowcount() == 1){ echo "1"; exit; } else { echo "incorrect email or password"; } }else{ echo "please enter email , passw

properties - How can I add Dependency Property to a DataGridRow WPF -

i'm working custom datagrid , want add property datagridrow. don't know how can that. think crate custom datagridrow can't use in custom datagrid. error message: a style intended type 'datagridrowex' cannot applied type 'datagridrow this's xaml code custom datagridrow: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:mydatagridrow"> <style x:key="{x:type local:datagridrowex}" targettype="{x:type local:datagridrowex}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type local:datagridrowex}"> <border x:name="dgr_border" borderbrush="{templatebinding borderbrush}"

asp.net mvc - MVC server-side validation on decimal values -

i've got problem validating model server-side in mvc. model has number of fields , every single 1 of them validates fine. problem have 2 decimal fields: [required] [datatype(datatype.currency] [displayformat(convertemptystringtonull = true)] public decimal { get; set; } [datatype(datatype.currency)] [displayformat(convertemptystringtonull = true)] public nullable<decimal> b { get; set; } if value null or string or b nullreferenceexception stacktrace can't analyze. try catch exception in controller, exception appears before gets there. if number value in , leave null or put number in b (just both valid), else goes expected - if there validation problems displayed, if not record saved in db. i've tried looking everywhere, maybe overlooked something... besides i've gotten bit rusty , validation never strong side. help!

Android List Item with Image View not clickable -

i have list item imageview 's, textview 's. issue list item whole not clickable, it's when click on of imageview it's clickable. have set android:descendantfocusability="blocksdescendants" root , below each child android:focusable="false" android:focusableintouchmode="false" still imageviews clickable. below list item xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://splashurl.com/m22ydvb android:id="@+id/itemdisplaylist_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:descendantfocusability="blocksdescendants" android:minheight="@dimen/loclist_item_minumum_height" android:orientation="horizontal" android:weightsum="1" > <imageview android:id="@+id/listitem_pic" android:layout_width="0dp&q

html - Set colour in CSS for link -

i trying set colour on link green unable work out. assistance appreciated! the code: <div id="column-2" class="col2"> <div class="off"> <h2 class="schoolproject" rel="column-2"> school project </h2> <div class="image"> &#160; </div> <center> <a id="test" href="projectone.aspx">project one</a> <br /> i trying the link "project one" green. can please advise should add in underlying css file? .page-wrapper div.services-us-wrapper div.col2 div.test { color:green; } thank you p your selector says div.test but: there no divs member of test class the anchor has id test you need write selector matches anchor. replacing d

How to make icon appear next to window custom shell entry? -

Image
here did add custom shell entry: windows registry editor version 5.00 ; shows "open consolez here" when right clicking directory [hkey_classes_root\directory\shell\consolez] @="open consolez here" [hkey_classes_root\directory\shell\consolez\command] @="c:\\program files\\consolez\\console.exe" ; shows "open consolez here" when right clicking file [hkey_classes_root\*\shell\consolez] @="open consolez here" [hkey_classes_root\*\shell\consolez\command] @="c:\\program files\\consolez\\console.exe" ; shows "open consolez here" when right clicking desktop or background [hkey_classes_root\directory\background\shell\consolez] @="open consolez here" [hkey_classes_root\directory\background\shell\consolez\command] @="c:\\program files\\consolez\\console.exe" how should modify make icon appear next custom shell entry? i have tried suggestions listed here , here no luck. i tried answe

java - Obtaining Sound Pressure Level of wav file -

i trying obtain , represent spl of a wav file recorded internal mic of device. problem values getting seem not logic @ all, i´m getting values on 100 db clapping hands can see here: image http://s2.subirimagenes.com/imagen/previo/thump_8946906screenshot2014060821.png this doing: first of all, wav file saved in 16-bit pcm, operate bytes have unique double value normalized between [-1,1] ( don´t operate first 44 bytes wav header). then, following equation spl=10*log(audiosample/iref) obtain each of desired sound levels (being iref=10^-12). at end calculate max , min values set margins of plot. do guys know im doing wrong? think values should around half of ones obtained here piece of code: protected void mithread() { thread t=new thread() { public void run(){ //operaciones ope=new operaciones(); double [] st =new double [arr.length]; int j=0; try{ (int = 44; < s; i+=2) {

How can I achieve bash EXIT trap when exec-ing another binary? -

i'd use bash exit trap and use exec avoid spawning new process. possible? that is, #!/bin/bash touch $0.$$ trap "rm -v $0.$$" exit /bin/echo hello removes temporary file $0.$$ using bash's exit trap while #!/bin/bash touch $0.$$ trap "rm -v $0.$$" exit exec /bin/echo hello never "fires" trap (no message rm , file $0.$$ exists after completion). it, of course, makes sense trap can't fire bash no longer in control after exec . there way make work and use exec ? admittedly out of curiosity moreso practical matters. generally, no. not possible reason mention. that's boring answer though. let's @ our options workarounds: if care more exec semantics , less starting multiple processes, can arbitrary executables do: { while kill -0 $$; sleep 5; done; rm "$0.$$"; } & exec ./file which exec file , have process polling , doing cleanup when it's done. if want avoid forks , we're ex

Facebook Graph API - GraphMethodException error code 100 -

this how have been using graph api public info of user: http://graph.facebook.com/{user_id} it working users except uid 1283218355 http://graph.facebook.com/1283218355 so when try link, gives error code 100. { "error": { "message": "unsupported request.", "type": "graphmethodexception", "code": 100 } } what problem?

ios - Strange black area on IPhone -

Image
i have strange problem. website using template , on iphone showing strange black vertical bar on right side. i installed safari , activated user agent. when set agent ipad, seeing problem, client told me on iphone. strangely when dev tools, seems outside html. causing this? have tried set html , body 100% width , overflow-x hidden, did not help. i have included screenshot: i have never seen before. be? verymuch! addition: here live example: example offline, sry somewhere, @ point, have element padding, border or margin blowing things out. couldn't track down, easy way kill off these days in style sheet (which commonly used part of standard reset): *, *:before, *:after {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;} that seems fix issue, although on next project, recommend not setting fixed widths, rather use width: 100% etc, users on screens narrower 300px still have issues.

Openstack Dashboard default password -

i installed openstack http://devstack.org/ ubuntu 14.04 server can't login dashboard browser. tried admin admin or admin secrete what should ? best regards if install openstack using devstack, there file in /devstack directory name local.conf contains service password defined during installation.

Android using Gradle Build flavors in the code like an if case -

i'm trying work build flavors. in build.gradle i've defined 2 flavors, normal flavor , admin flavor. basicly admin flavor has button on main activity. i understand can define different packages/classes different flavours. there way make sort of if case add/remove piece of code depending on flavor? basicly need 2 versions of activity. don't want 2 entire different versions of activity , maintain them. so in activity do => gradle check if flavour 'admin' => if yes add code of button is possible? or need 2 different physical activities , maintain both of them when add functionality afterwards. buildconfig.flavor gives combined product flavor. if have 1 flavor dimension: productflavors { normal { } admin { } } then can check it: if (buildconfig.flavor.equals("admin")) { ... } but if have multiple flavor dimensions: flavordimensions "access", "color" productflavors { normal

c# - Using Parallel.ForEach and Tasks.Factory.StartNew for database insertion/updation -

i working in .net 4.0 , code supposed this: i have webapi exposed user . in have collection of objects . concurrentbag containing objects . have iterate on each object in collection , insert/update data in database . count of objects can high (200-300) . adding , if there can multiple concurrent users using api . now , insertion / updation slow each record conn made database makes process slow . unfortunately cant change logic . to improve performance using parallel.foreach instead of routine foreach each iteration diffrent. also, creating seperate task each insertion in db here code var tasks = new list<task>(allrecordings.count);//creating task list parallel.foreach(allrecordings, recording => { var recordingitem = recording; //lines of code // if ( conditions){ var task = task.factory.startnew( () => saverecordingdetail

bigdata - Apache Spark vs. Apache Storm -

what differences between apache spark , apache storm ? suitable use cases each one? apache spark in-memory distributed data analysis platform-- targeted @ speeding batch analysis jobs, iterative machine learning jobs, interactive query , graph processing. one of spark's primary distinctions use of rdds or resilient distributed datasets. rdds great pipelining parallel operators computation , are, definition, immutable, allows spark unique form of fault tolerance based on lineage information. if interested in, example, executing hadoop mapreduce job faster, spark great option (although memory requirements must considered). apache storm focused on stream processing or call complex event processing. storm implements fault tolerant method performing computation or pipelining multiple computations on event flows system. 1 might use storm transform unstructured data flows system desired format. storm , spark focused on different use cases. more "apples-to-apples&q

c++ - Sort a vector of objects -

i'm working simple c++ program, class: (i'm beginner programmer) class car{ private: string newbrand; int newmileage; int newyear; double newprice; (i didn't post public classes) bool sortbyname(car &carvector) { return carvector.getbrand() < carvector.getbrand(); } main: int main(){ vector<car> carvector; readfile(carvector); listcar(carvector); return 0; } list car functions, when call function "sort", order vector of objects name: void listcar(vector<car>&carvector){ int i, op; system("cls"); sort(carvector.begin(), carvector.end(), sortbyname); cout << "menu::car list name" << endl; cout << ":brand: \t:mileage: \t:year: \t\t:price:" << endl; for(i=0; i<carvector.size();i++) { cout << carvector[i].getbrand() << " \t\t"; cout << carvector[i].getmileag

How to replace two Java Constructors with one generic Constructor -

i have following 2 java methods(simplified). replace these 2 methods 1 method. reason wanting 1 method used local testing, , 1 method using during run on hadoop cluster. spent while debugging code before realising had adjusted 1 method , not other, , know how avoid silly mistake in future. public myobject(arraylist<string> values){ for(string val: values){ system.out.println(val.tostring()); } } public myobject(iterable<text> values){ for(text val: values){ system.out.println(val.tostring()); } } text apache hadoop class. here link source code. http://grepcode.com/file/repository.cloudera.com/content/repositories/releases/com.cloudera.hadoop/hadoop-core/0.20.2-737/org/apache/hadoop/io/text.java since not using specific string or text (whatever is) in constructors, take iterable<? extends object> parameter: public myobject(iterable<? extends object> values){ for(object val: values){ system.out.pri

date - mismatch between working days and business days in matlab -

i calculating number of working days between 2 dates date_1=733943; date_2=734152; wrk_dy_dif=wrkdydif(date_1,date_2) wrk_dy_dif = 150 i tried build days vector based previous dates , expect 150x1 vector got 145x1 vector bus_days=busdays(date_1,date_2); size(bus_days) ans = 145 1 does know why , how can fix ? thx in advance kind help according docs, busdays assume usa public holidays unless tell not to. wrkdydif not. there nothing fix, pick 1 relevant , don't use both.

c# - Reading in lines of text from a rich text box -

i making small application myself concatenates statements based on text entered couple rich text boxes on form. one text box may have 10-20 lines of text, , each line own separate entry, need able read text line-by-line. however, when researching wpfs, have seen 1 statement on net in regards reading text , reading content of box start finish. somehow loop through or separate line-by-line. according msdn, extract text wpf rich text box string, need use: string stringfromrichtextbox(richtextbox rtb) { textrange textrange = new textrange( // textpointer start of content in richtextbox. rtb.document.contentstart, // textpointer end of content in richtextbox. rtb.document.contentend ); // text property on textrange object returns string // representing plain text content of textrange. return textrange.text; } however, if @ rich text box, see text inside list of values, instance, 1 box may below: 000423523 324 93489290099 823

fractals - “Expecting a constant value” error when constructing a NetLogo list -

i working create pictorial representation of levy c-curve in netlogo using ifs construction scheme . have found 2 functions describe how iteratively map locations of 2 turtles , should result in desired curve after thousands of iterations. here code far: ;;;;;; useful complex operations ; take re(z) of complex number + bi inputed list of coordinates [a b] to-report re [z] report first z end ; take im(z) to-report im [z] report last z end ; multiply 2 complex numbers to-report complex_mul [z1 z2] report list (re z1 * re z2 - im z1 * im z2) (re z1 * im z2 + im z1 * re z2) end ; add complex numbers to-report complex_add [z1 z2] report list (re z1 + re z2) (im z1 + im z2) end ; dilate complex numbers scalar fraction to-report complex/real [z1 real] report list (re z1 / real) (im z1 / real) end ; initialize setup ca setup-turtles reset-ticks end ; create 2 turtles located @ initial set of points {0,

c++ - nvolgv32.dll - glDrawElements trouble -

at moment im coding graphic app using opengl , im drawing obj files using gldrawelements. i've nvidia geforce gt 740m the trouble : first-chance exception @ 0x68fcf460 (nvoglv32.dll) in demo.exe: 0xc0000005: access violation reading location 0x00000000. , dont know how can fix this. these buffers initialization // <-- vbos ibo vao creation --> // glgenbuffers(3, obj_vbo); glgenbuffers(1, &obj_ibo); glgenvertexarrays(1, &obj_vao); // <-- ibo --> // glbindbuffer(gl_element_array_buffer, obj_ibo); glbufferdata(gl_element_array_buffer, obj_triangles.size() * sizeof(glushort), obj_triangles.data(), gl_static_draw); glbindbuffer(gl_element_array_buffer, null); // <-- vao --> // glbindvertexarray(obj_vao); glenablevertexattribarray(vertex_layout); glbindbuffer(gl_array_buffer, obj_vbo[vertex_layout]); glbufferdata(gl_array_buffer, obj_vertices.size() * sizeof(glfloat), obj_vertices.d

sql - MYSQL : Deleting a row after UPDATE in scheduled event -

hi have event selects result larger table query is: update character_data tu, character_data ts set tu.killsz = ts.killsz tu.playeruid = ts.playeruid , tu.numberid < ts.numberid; numberid | playeruid | alive | killsz 1 555555 0 55 2 555555 1 55 the event simply 1. update character_data tu, character_data ts set tu.killsz = ts.killsz tu.playeruid = ts.playeruid , tu.numberid < ts.numberid; 2. delete character_data alive = 0 group playeruid having count(playeruid) > 1; this line seems not working correctly: delete character_data alive = 0 group playeruid having count(playeruid) > 1; the wierd thing delete rows alive = 1 not 0 . if this: delete character_data alive = 1 group playeruid having count(playeruid) > 1; it delete rows alive = 0 every , delete right row. why doing reverse , how can reliable result? this works: delete characte

java - @JsonRootName not work as I want -

Image
this facilitydto @jsonrootname("facility") @xmlaccessortype(xmlaccesstype.none) @xmltype(name = "facility", proporder = { "id", "name", "totalquantity" }) public class facilitydto implements serializable { private static final long serialversionuid = 1l; @xmlelement(required = true) private string id; @xmlelement(required = true) private string name; @xmlelement(required = true) private double totalquantity; public facilitydto() { } public facilitydto(facility facility) { this.name = facility.getname(); this.totalquantity = facility.gettotalquantity(); this.id = facility.getid(); }// getters setter this message body writer bytearrayoutputstream out = new bytearrayoutputstream(); objectmapper mapper = new objectmapper(); mapper.registermodule(new jdk7module()); mapper.configure(serializationfeature.wrap_root_value, true); mapper.writevalue(out, object); int bytescount = out.size(); byte[] bytes = out.tobytearray

oracle11g - Link between Oracle APEX and Oracle Applications -

is there link between oracle applications users , oracle apex? why need link between them want provide set of application users access reports in oracle apex have created. instead of creating users separately , assigning workspace, there way use application users login apex environment ? regards, bharat you don't need use sso ebs versions 11i , above. oracle support document 1306563.1 gives complete solution on how integrate 2 r12.1. if using 11i, see this whitepaper rod west. your ebs users not need created in apex , merely authenticated , authorised. once have set integration, apex environment referenced in fnd profile option , sswa jsp menu functions point jsp file, takes parameters application, page etc. you can customise jsp suit integration needs.

c# - Is it possible to place Edit and Delete buttons in jQuery DataTables? -

Image
i beginner using jquery datatable, , trying place edit , delete buttons in jquery datatable dynamic databinding in bootstrap in below image: but error message: controller action public class phonenumber { public string number { get; set; } public string description { get; set; } public string action { get; set; } } public actionresult loadphonenumbers() { var phonenumbers = new list<phonenumber>(new[] { new phonenumber { number = "555 123 4567", description = "george",action="" }, new phonenumber { number = "555 765 4321", description = "kevin" ,action="" }, new phonenumber { number = "555 555 4781", description = "sam",action="" } }); return json(new { aadata = phonenumbers.select(x => new[] { x.number, x.description }) }, jsonreque

Shortcut for search functionality in SQL Server -

Image
i want create shortcut below sql code declare @proc_name varchar(255) set @proc_name ='norway' select * sys.tables name '%' + @proc_name + '%' right using below shortcut same then type {like '%test%'} , press ctrl+8. but want make more simplified format(like can type {test} , press ctrl+8) can use quickly. i trying same in different way creating proc > execute > , drop on shortcut key press. more info please visit below link: single line go(batch) statement giving error in sql server? thanks, vishal i have following stored proc added master db on sql server use [master] go set ansi_nulls on go set quoted_identifier on go create procedure [dbo].[sp_findallreferences] @targettext nvarchar(128) begin set nocount on; declare @origdb nvarchar(128) select @origdb = db_name() declare @sql nvarchar(1000) set @sql = 'use [' + @origdb +'];' set @sql += 'select object_name(m.objec

javascript - Using indexOf( ) to check if particular object exists in JS Array -

this structure of array: [{"stockcode":"pallet cards","quantity":"2"}, {"stockcode":"pallet cards","quantity":"3"}, {"stockcode":"cbl202659/a","quantity":"1"}, {"stockcode":"cbl201764","quantity":"3"}] when order button clicked check if stockcode exists in array . each time -1 returned. this code check stockcode : $(".orderbtn").click(function(event){ //check ensure quantity > 0 if(quantity == 0){ console.log("quantity must greater 0") }else{//it continue //show order box $(".order-alert").show(); event.preventdefault(); //get reference product clicked var stockcode = $(this).closest('li').find('.stock_code').html(); //get reference quantity selected

symfony - Circular reference detected for service "security.context" -

Image
i tried inject templating service , get. <service id="myproject_notification.service.mail" class="%myproject_notification.service.mail.class%"> <argument type="service" id="mailer" /> <argument type="service" id="templating" /> </service> if comment, or remove, templating service dependency, working well. saw old issues that, seems i'm 1 @ moment experiencing this. doing wrong? composer.json "symfony/symfony": "~2.4", "twig/extensions": "~1.0", "symfony/assetic-bundle": "~2.3", "symfony/swiftmailer-bundle": "~2.3", "symfony/monolog-bundle": "~2.4", "sensio/distribution-bundle": "~2.3", "sensio/framework-extra-bundle": "~3.0", "sensio/generator-bundle": "~2.3", "incenteev/composer-parameter-handler": "~2.0&

javascript - How to add node to parent node (currently selected node) in gojs? -

i have written function attachlink() { var url = "https://www.google.co.in"; var diagram = mycontextmenu.diagram; var node = new go.node(go.panel.auto); var shape = new go.shape(); shape.figure = "roundedrectangle"; shape.fill = "lightblue"; node.add(shape); var textblock = new go.textblock(); textblock.text = "hello!"; textblock.margin = 5; textblock.cursor = "pointer"; textblock.click = function (e, obj) { window.open(url) }; node.add(textblock); //diagram.add(node); //var diagram = mycontextmenu.diagram; var = diagram.selection.iterator; while (it.next()) { var part = it.value; if (part instanceof go.node) { part.addnodedata(node); } } diagram.committransaction("color nodes"); } i having trouble in part of code while (it.next()) { var part = it.value; if (part instanceof go.node) { part.addnodedata(node); } } i think line of code not appending node selected node part.add

Implementing Crawler4j with Selenium in Java doesn`t work -

i'm trying use crawler4j simultaneous selenium website testing. after webpage crawled, selenium should start simultaneous test parameters got crawler. url should open or id's of search fields example. if use crawler4j alone works fine , can extract information need. if start test selenium predefined parameters url , id's works should. when put same code selenium crawler code exception. guess it`s maybe threat problem? nice if give me hint or me: exception in thread "crawler 1" java.lang.noclassdeffounderror: com/google/common/base/function @ mypackage.com.selenium.init(selenium.java:21) @ mypackage.com.mycrawler.visit(mycrawler.java:57) @ edu.uci.ics.crawler4j.crawler.webcrawler.processpage(webcrawler.java:351) @ edu.uci.ics.crawler4j.crawler.webcrawler.run(webcrawler.java:220) @ java.lang.thread.run(thread.java:722) caused by: java.lang.classnotfoundexception: com.google.common.base.function @ java.net.urlclassloader$1.run(urlclassl

JSONP with document.write -

i'am loading script jspnp-like var s = document.createelement("script"); s.src = "http://scripturl"; s.type = "text/javascript"; document.getelementbyid("ad").appendchild(s); when script contains alert works. real script needs "document.write". document.write never output. ideas why? script console not show errors. this question is similar questions found http://www.webmasterworld.com/javascript/4401935.htm and document.write in jsonp callback it seems calling document.write() calling document.open(), erases have written. time document.write() executed, page has finished loading. take @ solutions provided in links above , try modifying them specific needs. try using iframe , write that.

Selecting rows in one dataframe based on data in another dataframe in Python Pandas -

i have 2 dataframes created pandas. first 1 has co-occurrences of items happening in years: date item1 item2 0 1975 b 1 1976 b c 2 1977 b 3 1977 b 4 1978 c d 5 1979 e f 6 1980 f the second 1 has birthdates of items: birthdate item 1975 1975 b 1976 c 1978 d 1979 f 1979 e now, want set age variable, example: age = 2 and populate third dataframe (alternative transform first one) version of first 1 keeping rows of co-occurrences happened when item1 below defined 'age'. you merge dataframes - similar join in sql import pandas data = [ [1975,'a','b'], [1976,'b','c'], [1977,'b','a'], [1977,'a','b'], [1978,'c','d'], [1979,'e','f'], [1980,'a','f'], ] birthdate = [ [1975,'a'], [1975,'b'], [1976,'