graphviz dot HTML attributes not working? - visualization

I'm drawing a graph on macbook with graphviz dot, here's my graph simple.dot:
digraph {
node [shape=record, fontname="Courier New, Courier", fontsize=12]
graph [fontname="Courier New, Courier", fontsize=12]
edge [fontname="Courier New, Courier", fontsize=12]
node626 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell625">global.1</TD></TR>
<TR><TD PORT="cell627">symbol: name: integer_literal, type: ()=>void, kind: Func</TD></TR>
<TR><TD PORT="cell633">symbol: name: string_literal, type: ()=>void, kind: Func</TD></TR>
<TR><TD PORT="cell639">symbol: name: floating_point_literal, type: ()=>void, kind: Func</TD></TR>
<TR><TD PORT="cell645">symbol: name: character_literal, type: ()=>void, kind: Func</TD></TR>
<TR><TD PORT="cell651">typeSymbol: name: byte, kind: Plain</TD></TR>
<TR><TD PORT="cell652">typeSymbol: name: ubyte, kind: Plain</TD></TR>
<TR><TD PORT="cell653">typeSymbol: name: short, kind: Plain</TD></TR>
<TR><TD PORT="cell654">typeSymbol: name: ushort, kind: Plain</TD></TR>
<TR><TD PORT="cell655">typeSymbol: name: int, kind: Plain</TD></TR>
<TR><TD PORT="cell656">typeSymbol: name: uint, kind: Plain</TD></TR>
<TR><TD PORT="cell657">typeSymbol: name: long, kind: Plain</TD></TR>
<TR><TD PORT="cell658">typeSymbol: name: ulong, kind: Plain</TD></TR>
<TR><TD PORT="cell659">typeSymbol: name: float, kind: Plain</TD></TR>
<TR><TD PORT="cell660">typeSymbol: name: double, kind: Plain</TD></TR>
<TR><TD PORT="cell661">typeSymbol: name: char, kind: Plain</TD></TR>
<TR><TD PORT="cell662">typeSymbol: name: boolean, kind: Plain</TD></TR>
<TR><TD PORT="cell663">typeSymbol: name: void, kind: Plain</TD></TR></TABLE>>]
node629 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell628">integer_literal</TD></TR>
<TR><TD PORT="cell630">symbol: name: local.2, type: void, kind: Local</TD></TR></TABLE>>]
node632 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell631">local.2</TD></TR></TABLE>>]
node635 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell634">string_literal</TD></TR>
<TR><TD PORT="cell636">symbol: name: local.3, type: void, kind: Local</TD></TR></TABLE>>]
node638 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell637">local.3</TD></TR></TABLE>>]
node641 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell640">floating_point_literal</TD></TR>
<TR><TD PORT="cell642">symbol: name: local.4, type: void, kind: Local</TD></TR></TABLE>>]
node644 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell643">local.4</TD></TR></TABLE>>]
node647 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell646">character_literal</TD></TR>
<TR><TD PORT="cell648">symbol: name: local.5, type: void, kind: Local</TD></TR></TABLE>>]
node650 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell649">local.5</TD></TR></TABLE>>]
node629:cell630 -> node632:cell631
node626:cell627 -> node629:cell628
node635:cell636 -> node638:cell637
node626:cell633 -> node635:cell634
node641:cell642 -> node644:cell643
node626:cell639 -> node641:cell640
node647:cell648 -> node650:cell649
node626:cell645 -> node647:cell646
}
Compiled with dot -Tpng simple.dot -o simple.png, it gives me:
But the PORT seems not working, because the edges should point from <TD> to another <TD>. And <TABLE BORDER> also not working because my table border is bold.
Please help.

The core problem in your file is this line:
node [shape=record, fontname="Courier New, Courier", fontsize=12]
What you want is node [shape=none ...]
node [shape=none, fontname="Courier New, Courier", fontsize=12]
This fixes the table border and the port problems. If you add a compass point to some of the edges, things get even better.
node626:cell627 -> node629:cell628:n

Related

Unable to show new properties in User schema

I'm working within a MEAN app, and I'm modifying the User module. I modified the User Schema to contain 2 new properties: casetype and Steps. casetype is just a string, and Steps is an array. I created a view to show these along with a controller. Neither are shown on the page when I run the server. If I try to show any of the preexisting properties of the logged in user, they work fine, it just seems to be the new stuff I added that doesn't work. What's more puzzling is that they save just fine to the database, and when using Mongo shell I can find the user by querying based on casetype.
view:
<div class="row">
<h1 ng-bind="vm.user.casetype"></h1>
</div>
<div class="row">
<div class="col-md-6">
<div class="tableWrapper">
<table id = "table_id" class="table table-hover">
<thead>
<tr>
<th>Step</th>
<th>Todo</th>
<th>Completed?</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="step in vm.user.steps.type | filter: query" >
<td>{{step.num}}</td>
<td>{{step.text}}</td>
<td class = "y_n">{{step.completed}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
UserSchema additions:
//case type
casetype: {
type: String,
default: 'Default Case Type'
},
//steps for case tracking
steps: {
type: [{
num: {
type: Number,
//default: 0
},
text: {
type: String,
trim: true,
//default: 'Todo for step'
},
completed: {
type: Boolean,
//default: false
}
}],
default: [{
num: 0,
text: 'todo for step',
completed: false
}]
},
Steps is an object. you need to render steps.type which is an array:
<tbody>
<tr ng-repeat="t in vm.user.steps.type | filter: query" >
<td>{{t.num}}</td>
<td>{{t.text}}</td>
<td class = "y_n">{{t.completed}}</td>
</tr>
</tbody>

how to echo a dom object such as html content

this is div content i want to get from a web page.
<div class="result clearfix table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Giải thưởng</th>
<th>Trùng khớp</th>
<th>Số lượng giải</th>
<th style="text-align: left; width: 22%;">Giá trị giải (đồng)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jackpot</td>
<td>Trùng 6 số</td>
<td>0</td>
<td style="text-align: left"><span>27.868.784.500</span></td>
</tr>
<tr>
<td>Giải nhất</td>
<td>Trùng 5 số</td>
<td>18</td>
<td style="text-align: left"><span>10.000.000</span></td>
</tr>
<tr>
<td>Giải nhì</td>
<td>Trùng 4 số</td>
<td>613</td>
<td style="text-align: left"><span>300.000</span></td>
</tr>
<tr>
<td>Giải ba</td>
<td>Trùng 3 số</td>
<td>11047</td>
<td style="text-align: left"><span>30.000</span></td>
</tr>
</tbody>
</table>
<p class="role-result">
<span>Thời hạn lĩnh thưởng của vé trúng thưởng: là 60 (sáu mươi) ngày, kể từ ngày xác định kết quả trúng thưởng hoặc kể từ ngày hết hạn lưu hành của vé xổ số tự chọn số điện toán (nếu có). Quá thời hạn trên, các vé trúng thưởng không còn giá trị lĩnh thưởng.</span>
</p>
<div>
<a class="view-more" href="winning-numbers">Các lần quay trước</a>
</div>
</div>
this is my code to get div content and echo to my site:
$kqxsmega = file_get_contents ("http://vietlott.vn/vi/trung-thuong/ket-qua-trung-thuong/mega-6-45/");
$dom = new DomDocument();
$dom->loadHTML($kqxsmega);
$finder = new DomXPath($dom);
$classname="result clearfix table-responsive";
$divContent = $finder->query("//*[contains(#class, '$classname')]");
My code is running good, and i want to convert $divContent become string and i can echo it.
now to echo $divContent will show nothing
echo $divContent ;
Please help me.
Thank you.

How to send email in Jenkins with groovy template?

I am using Jenkins server for CI and I am trying to send a post-build email using email-ext plugin and groovy template: appsgt.groovy, code below. My default content is empty and my pre send script field is as follows ${SCRIPT, script="managed:appsgt"}.
But I get an error # line 1 column for column 1: unexpected token <
If I change script to template I still get an error for another line, meanwhile email template testing creates nicely formated data.
<STYLE>
BODY, TABLE, TD, TH, P {
font-family:Verdana,Helvetica,sans serif;
font-size:11px;
color:black;
}
</STYLE>
<BODY>
<%
float versionadjust = 103.0f
float newversion = (build.number + 103) / 1000
def realVersion = newversion.round(3)
%>
<TABLE>
<TR><TD align="right"><IMG SRC="${rooturl}static/e59dfe28/images/32x32/<%= build.result.toString() == 'SUCCESS' ? "blue.gif" : build.result.toString() == 'FAILURE' ? 'red.gif' : 'yellow.gif' %>" />
</TD><TD valign="center"><B style="font-size: 200%;">BUILD ${build.result}</B></TD></TR>
<TR><TD>Build URL</TD><TD>${rooturl}${build.url}</TD></TR>
<TR><TD>Project:</TD><TD>${project.name}</TD></TR>
<TR><TD>Project version:</TD><TD>${realVersion}</TD></TR>
<TR><TD>Date of build:</TD><TD>${it.timestampString}</TD></TR>
<TR><TD>Build duration:</TD><TD>${build.durationString}</TD></TR>
</TABLE>
<BR/>
<!-- CHANGE SET -->
<%
def changeSet = build.changeSet
if(changeSet != null) {
def hadChanges = false %>
<TABLE width="100%">
<TR><TD class="bg1" colspan="2"><B>CHANGES</B></TD></TR>
<% changeSet.each() { cs ->
hadChanges = true %>
<TR>
<TD colspan="2" class="bg2"> Revision <B><%= cs.metaClass.hasProperty('commitId') ? cs.commitId : cs.metaClass.hasProperty('revision') ? cs.revision :
cs.metaClass.hasProperty('changeNumber') ? cs.changeNumber : "" %></B> by
<B><%= cs.author %>: </B>
<B>(${cs.msgAnnotated})</B>
</TD>
</TR>
<% cs.affectedFiles.each() { p -> %>
<TR>
<TD width="10%"> ${p.editType.name}</TD>
<TD>${p.path}</TD>
</TR>
<% }
}
if(!hadChanges) { %>
<TR><TD colspan="2">No Changes</TD></TR>
<% } %>
</TABLE>
<BR/>
<% } %>
<!-- CONSOLE OUTPUT -->
<% if(build.result==hudson.model.Result.FAILURE) { %>
<TABLE width="100%" cellpadding="0" cellspacing="0">
<TR><TD class="bg1"><B>CONSOLE OUTPUT</B></TD></TR>
<% build.getLog(100).each() { line -> %>
<TR><TD class="console">${org.apache.commons.lang.StringEscapeUtils.escapeHtml(line)}</TD></TR>
<% } %>
</TABLE>
<BR/>
<% } %>
</BODY>
${SCRIPT, script="managed:appsgt"}
^ That should be:
${SCRIPT, template="managed.template"}
...unless I'm misunderstanding your question.
source: https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-Scriptcontent

Coffeescript - React callback: sending child header click back to parent

Just starting to learn Coffeescript, and I'm working with React.js. I'm trying to determine which was clicked, and I've been advised not to use data-attributes on each header. I have some ideas how to handle this under the handleHeaderClick function, but I'm not exactly sure how they should be implemented. I'm also thinking about splitting up the ContactsTable component into a ContactsTableHeader component and a ContactsTableRow component, but I should still have the same issue in ContactsTableHeader - determining which header was clicked.
#Application.cjsx
handleHeaderClick: ->
# childComponent.props
# childComponent.refs
# React.findDOMNode(childComponent.refs.firstName)
# React.findDOMNode(childComponent.refs.lastName)
# React.findDOMNode(childComponent.refs.age)
render: ->
<div>
<ContactsTable contactList={#state.contacts} onClick={#handleHeaderClick} />
</div>
#ContactsTable.cjsx
render: ->
if #props.contactList
contactsList = #props.contactList.map (contact) ->
<tr><td>{"#{contact.firstName}"}</td><td>{"#{contact.lastName}"}</td><td>{contact.age}</td></tr>
<table style={tableStyle}>
<thead style={headerStyle} onClick=#props.onClick>
<tr>
<th>FirstName</th>
<th>Last Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
{contactsList}
</tbody>
</table>
You can do something like this.
#Application.cjsx
handleHeaderClick: (header) ->
#setState({clickedHeader: header})
#do something else
render: ->
<div>
<ContactsTable contactList={#state.contacts} onClick={#handleHeaderClick} />
</div>
#ContactsTable.cjsx
render: ->
if #props.contactList
contactsList = #props.contactList.map (contact) ->
<tr><td>{"#{contact.firstName}"}</td><td>{"#{contact.lastName}"}</td><td>{contact.age}</td></tr>
<table style={tableStyle}>
<thead style={headerStyle}>
<tr>
<th onClick={#props.onClick('FirstName')}>FirstName</th>
<th onClick={#props.onClick('LastName')}>Last Name</th>
<th onClick={#props.onClick('Age')}>Age</th>
</tr>
</thead>
<tbody>
{contactsList}
</tbody>
</table>
Here the clickedHeader is preserved inside the component which is present in Application.cjsx. You can also preserve it inside ContactsTableHeader which should look something like similar.

how to create admin notification mail for newsletter subscription in magento

I am trying to create a module for magento 1.7 which will send a notification mail to admin whenever a new user subscribes to newsletter. I have succeeded so far in getting the mail sent. however, my code is not taking the getEmail and getId values to be displayed in the mail sent to admin. if anyone can throw some light on where i am going wrong, it would be great. here is the code:
app/code/local/Notify/Biju/etc/config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<Notify_Biju>
<version>0.1.0</version>
</Notify_Biju>
</modules>
<global>
<models>
<Notify_Biju>
<class>Notify_Biju_Model</class>
</Notify_Biju>
</models>
<template>
<email>
<newsletter_alert_template translate="label" module="n">
<label>Newsletter Alert to Admin</label>
<file>newsletter_subscription_notify.html</file>
<type>html</type>
</newsletter_alert_template>
</email>
</template>
</global>
<frontend>
<events>
<newsletter_subscriber_save_after>
<observers>
<Notify_Biju_Model_Observer>
<type>singleton</type>
<class>Notify_Biju_Model_Observer</class>
<method>newsletteralert</method>
</Notify_Biju_Model_Observer>
</observers>
</newsletter_subscriber_save_after>
</events>
</frontend>
</config>
app/code/local/Notify/Biju/Model/Observer.php
<?php
class Notify_Biju_Model_Observer {
const XML_PATH_EMAIL_TEMPLATE = 'newsletter_alert_template';
public function newsletteralert($observer){
$eventname=$observer->getEvent()->getName();
$subscriber=$observer->getEvent()->getSubscriber();
$email=$subscriber->getEmail();
$id=$subscriber->getId();
$emailtemplate=Mage::getModel('core/email_template')->loadDefault(self::XML_PATH_EMAIL_TEMPLATE);
$sender=array();
$sender['name']="admin";
$sender['email']="biju#talkingpebbles.com";
try{
$emailtemplate->sendTransactional(
self::XML_PATH_EMAIL_TEMPLATE,
$sender,
'biju#talkingpebbles.com, allen#compkraft.com', // email id of website/store admin
'admin',
array('subscirber'=>$subscriber)
);
}
catch(Mage_Core_Exception $e){
// echo $e->getMessage();
Mage::log($e->getMessage(),null,'newsletter.log');
}
}
}
app/etc/modules/Notify_Biju.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Notify_Biju>
<active>true</active>
<codePool>local</codePool>
</Notify_Biju>
</modules>
</config>
app/locale/en_US/template/email/newsletter_subscription_notify.html
<!--#subject Newsletter Subscription Alert #-->
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td valign="top" style="padding:20px 0 20px 0">
<!-- (header starts here) -->
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
<tr>
<td valign="top">
<h3 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"></h3>
</td>
</tr>
<tr>
<td valign="top"><h3 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear Admin </h3>
<p> Congratulations! A new subscriber has registered for Newsletter. Please login to the admin back-end to manage subscriptions.</p>
<p>Subscriber Email: {{var subscriber.getEmail()}}</p>
<p>Subscriber ID: {{var subscriber.getId()}}</p>
<br>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
You have a typo:
Search for array('subscirber'=>$subscriber).
You have "subscriber" misspelled as "subscirber"
To get the subscriber email value & id in observer,
$subscriber=$observer->getEvent()->getSubscriber() ;
$email=$subscriber->getSubscriberEmail();
$id=$subscriber->getSubscriberId();
$emailtemplate->sendTransactional(
XML_PATH_EMAIL_TEMPLATE,
Mage::getStoreConfig(XML_PATH_CONFIRM_EMAIL_IDENTITY),
'sample#xyz.in', // email id of website/store admin
'admin',
array(
'subscriber_email' => $email,
'subscriber_id' => $id
)
Then in mail - add the variables like this instead of your lines
<p>Subscriber Email: {{var subscriber_email}}</p>
<p>Subscriber ID: {{var subscriber_id}}</p>