In my Database i've got nodes and edges.
Position must have generated at gexf generation, the node must not overlap and
generate this kind of Graph: http://www.nwoods.com/components/images/force-directed-layout.png
I use Sigma.js for presentating the graph.
How can i calculate the node postition with an force directed alogrithm, with a root item?
Or there a layout that can generate from node and edges a layout that not overlap and output like this png above?
EDIT:
PHP code for generating node position:
function _generate_gexf_node($test=false){
$count = 0;
foreach ($node_array as $node) {
$node_size = '22.714287';
$node_poz = ' x="'.rand(10, 300).'" y="'.rand(10, 300).'" z="'.rand(10, 300).'" ';
$node_color = ' b="45" g="72" r="216" ';
$data['node'][] = '<node id="'.$node['node_id'].'" label="'.$node['label'].'">
<attvalues>
<attvalue for="authority" value="0.01880342"/>
<attvalue for="hub" value="0.01880342"/>
</attvalues>
<viz:size value="'.$node_size.'"/>
<viz:color '.$node_color.'/>
<viz:position '.$node_poz.'/>
</node>
';
$count++;
}
return $data;
}
How can i gnerete the position in "runtime", to like this http://www.nwoods.com/components/images/force-directed-layout.png?
Where can i find implementation of YiFan Hu Force directed algorithm?
Or a special Bubble layout implementation?
at the moment i work also on a Web Graph Visualization but with javascript.
Here exists a good project called gexf-js (https://github.com/raphv/gexf-js)
but this is only for drawing the graph.
For the layout stuff i used the gephi library (this is implemented in java)
you can download it here https://gephi.org/toolkit/. And i found also a good example
for the YifanHu layout Algorithm.
If it it could a manual task than you can import your gexf file in the gephi program
runt the layouter you want and export it as gexf. Most of all function in the gephi program
are also available in the toolkit library.
Hopefully this helps
nice day
Related
I want to add DocuSign signature tag dynamically in some specific section of my base64 custom pdf template which created from our web application where user can just click on tag to upload his/her signature not drag and drop his/her signature on specified section.
This is my code sample:
<?php
$pdfurl = 'assets/pdf/test-doc-docusign.pdf';
$docname = basename($pdfurl);
$pdfcontent = file_get_contents($pdfurl);
$base64content = base64_encode($pdfcontent);
$envelopjson = array();
$envelopjson['documents'] = array();
$envelopjson['documents'][0]['documentBase64'] = $base64content;
$envelopjson['documents'][0]['documentId'] = 57577;
$envelopjson['documents'][0]['fileExtension'] = "pdf";
$envelopjson['documents'][0]['name'] = $docname;
$envelopjson['emailSubject'] = "Please Sign";
$envelopjson['recipients'] = array();
$envelopjson['recipients']['signers'] = array();
$envelopjson['recipients']['signers'][0]['name'] = "user full name";
$envelopjson['recipients']['signers'][0]['email'] = "user email";
$envelopjson['recipients']['signers'][0]['recipientId'] = "458585";
$envelopjson['templateRoles'][0]['tabs']['signHereTabs'] = array();
$envelopjson['templateRoles'][0]['tabs']['signHereTabs'][0]['signHere']['xPosition'] = 500;
$envelopjson['templateRoles'][0]['tabs']['signHereTabs'][0]['signHere']['yPosition'] = 500;
$envelopjson['templateRoles'][0]['tabs']['signHereTabs'][0]['signHere']['documentId'] = $trnx_id;
$envelopjson['templateRoles'][0]['tabs']['signHereTabs'][0]['signHere']['pageNumber'] = 1;
$envelopjson['status'] = "sent";
$requestjson = json_encode($envelopjson);
$envelopeinfo = MakeAPICall("POST","v2.1/accounts/".$docusign_account_id."/envelopes",$requestjson,$access_token);
How to solve the issue?
Is your question how to have your application dynamically add DocuSign signing fields (tags) at various places in your documents?
There are several techniques available, especially when you have control over the software that is producing the documents.
For the following techniques, let's say that we ultimately want four tags: a sign here and date signed tag for signers 1 and 2.
Auto Place fields
You can include text in your document that is later used to place fields that use the auto place feature. See the anchorString property.
There are several tricks that may be of help for your use case:
In your source document, you can color the anchor text white (so it won't be visible). This way you can use anchor text such as "signer-1-sign-here" and a tab will be created for every instance of that string. (You do need to program a SignHere tab that looks for your anchorString "signer-1-sign-here".)
You can include anchor text more than once (even in different documents in the same envelope) and the tab will be created at each location.
If you don't include the anchor text, this is not an error. So you can have anchor text such as "signer-1-optional-initials" and if it is in the document an initials tab will be placed, otherwise nothing will happen. (This assumes that you program an initials tab that looks for that anchor string.)
Smart sections
An alternative is to use the smart sections feature and create your document as an HTML document with the tabs included in the HTML.
The templateRoles objects are used to assign recipients to roles of the templates. If the tabs are not coming from the template, you cannot use this object to add tabs.
Instead, you have to make another API call to add the tabs. See code example showing how to update tabs in a template which include PHP code as well.
Alternatively, and the best practice, is to use composite templates, that give you the most flexibility in adding templates, documents, and tabs all in one API call.
When I am performing Open Graph requests, some of the responses that I am expecting to be text are having some kind of markup included. For example, when I am requesting the Name and Description of an album, in the description I get something like \u0040[12412421421:124:The Link]. (The \u0040 is actually the # sign.)
In this case it seems that what it is saying is that the 'The Link' should be a hyperlink to a facebook page with ID 12412421421. I presume there is similar kind of markup for hashtags and external URLs.
I am trying to find some official documentation or description for this, but I can't seem to find any documentation of this (I might be looking with the wrong keywords).
Is there any online documentation that describes this? And better still is there an PHP library or function already available somewhere that converts this text into its HTML equivalent?
I am using this Facebook PHP SDK, but it doesn't seem to offer any such function. (Not sure if there is anything in the new version 4.0 one but I can't use it anyway for now because it requres PHP 5.4+ and my host currently is still on 5.3.).
It's true that the PHP SDK doesn't provide anything to deal with these links and the documentation doesn't document that either. However the API gives all the information you need in the description field itself, so here is what you could do:
$description = "Live concert with #[66961492640:274:Moonbootica] "
. "in #[106078429431815:274:London, United Kingdom]! #music #house";
function get_html_description($description) {
return
// 1. Handle tags (pages, people, etc.)
preg_replace_callback("/#\[([0-9]*):([0-9]*):(.*?)\]/", function($match) {
return ''.$match[3].'';
},
// 2. Handle hashtags
preg_replace_callback("/#(\w+)/", function($match) {
return ''.$match[0].'';
},
// 3. Handle breaklines
str_replace("\n", "<br />", $description)));
}
// Display HTML
echo get_html_description($description);
While 2. and 3. handle hashtags and breaklines, the part 1. of the code basically splits up the tag #[ID:TYPE:NAME] into 3 groups of information (id, type, name) before generating HTML links from the page IDs and names:
Live concert with Moonbootica in London, United Kingdom! #music #house
Live concert with Moonbootica in London, United Kingdom!
#music #house
FYI and even if it's not much useful, here are the meanings of the types:
an app (128),
a page (274),
a user (2048).
the # describes a tag to someone,facebook id doesnt make difference between a fanpage or a single person so you gotta deal with php only.and the # should be the only char that describes a person/page tagged
The markup is used to reference a fanpage.
Example:
"description": "Event organised by #[303925999750490:274:World Next Top Model MALTA]\nPhotography by #[445645795469650:274:Pixbymax Photography]"
The 303925999750490 is the fanpage ID. The World Next Top Model MALTA is the name of fanpage. (Don't know what the 274 means)
When you render this on your page, you can render like this:
Event organised by World Next Top Model MALTA
Photography by Pixbymax Photography
i am new to typo3, so sorry, if this is too obvious.
I do not expect a complete solution, just the topics i would need to read about in order to solve the task would be perfectly enough. :)
Here the task:
I have a typo 3 installation with job advertisements in it. Now the company wants to publish that data in to a social website, which needs to have the job advertisement data put on a server in an xml feed, which looks like this: http://www.kununu.com/docs#jobfeed. Don't worry about what it says in there, it's just stuff like Job Title, Description etc.
Like i said, i am completely new to this and just have a vague idea.
My thoughts so far were something like this:
I probably need to write a plugin, which pulls the data out of typo3 by the push of a button
That Plugin need to establish a database connection to pull the data (probably it's mysql, but i am not entirely sure yet)
The data need to be formatted, which is either done by some string operations or by some kind of xml handler i assume.
Sidenote: I read something about TypoScript, but i'd like to avoid that, since it's a one time project and probably not worth the time to learn it. For me at least.
Thank you loads for your help in advance.
Cheers
you can handle that (basicly with typoscript). The other part has to come from PHP (F.e. extbase plugin) ... First part creates the XML output. Second part uses my Demo plugin to include data (Pages+special fields) from DB.
Within TS we are able to create a new typeNum. With that you can call your XML. ( ?type=1234 ) Within the BE you can select each page for output.
If you need help just contact me. I would send you the plugin.
sitemap = PAGE
sitemap {
typeNum = 1234
config {
# Set charset to utf-8
metaCharset = utf-8
# Deactivate TYPO3 Header Code
disableAllHeaderCode = 1
# Content-type settings
additionalHeaders = Content-type:text/xml;charset=utf-8
# Do not cache the page
no_cache = 1
# No xhtml cleaning trough TYPO3
xhtml_cleaning = 0
}
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = Sitemap
extensionName = Srcxmlprovider
controller = Sitemap
vendorName = Sourcecrew
action = exportXml
switchableControllerActions {
Sitemap {
1 = exportXml
}
}
}
}
Ich habe die EXT noch schnell ins TER gepushed. Ein Tutorial liegt innerhalb.
http://typo3.org/extensions/repository/view/srcxmlprovider
i am trying to extract the parent company information (in infobox pane) for a page such as "KFC".
If you access the
http://en.wikipedia.org/wiki/KFC
url... the info box contains the property (Parent = Yum! Brands)
.. howver, when i access through the PHP API.. the parent info is not included.
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=KFC&rvsection=0
How do i ensure that Wikipedia API returns the "Parent = " information as well (for a brand term like "KFC"). Essentially, I want to extract info that Yum Brands is the parent of KFC through the wikipedia API.
Thanks!
Take a look at the wikipedia wiki official ways of getting informations.
My suggestion would be to use the screen scraping throught PHP Simple HTML DOM Parser which will always be the best, even if it's deprecated. The only downside is that if Wikipedia changes how it looks like you will have to update your code.
A guide to PHP Simple HTML DOM Parser.
Edit:
At least i'm doing something instead of linking to non working resources and downvoting right answers ...
Here's the code I made to get the Parent company information from the Infobox pane with the PHP Simple HTML DOM Parser.
<?php
//The folder where you uploaded simple_html_dom.php
require_once('/homepages/../htdocs/simple_html_dom.php');
//Wikipedia page to parse
$html = file_get_html('http://en.wikipedia.org/wiki/KFC');
foreach ( $html->find ( 'tr th a[title=Holding company]' ) as $element ) {
$element = $element->parent;
$element = $element->parent;
$tabella = $element->find ( 'td', 0 );
//Now $parent contains "Yum! Brands"
$parent = $tabella->plaintext;
echo $parent;
}
?>
If this answer suit your needs please choose it as best answer and upvote it because it took me a lot of effort, about 1 hour =/
Thanks ;)
I have been trying to load fivestar module and show the rating widget of the selected node in an external php file. I have gotten the rating widget displayed on the page but it only displays degraded version of the widget (non-JavaScript, dropdown widget and "Rate" button) I looked into the source code of the page but the javascript for fivestar module was not loaded. I have tried to load javascript using following functions but had no luck:
fivestar_add_js();
$path = drupal_get_path('module','fivestar');
drupal_add_js($path.'/js/fivestar.js', 'inline', 'footer');
The following is the code in the php file:
//require the bootstrap include
require_once 'includes/bootstrap.inc';
//Load Drupal
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
fivestar_add_css();
// I have used one of the following two functions one at a time to test.
fivestar_add_js();
$path = drupal_get_path('module','fivestar');
drupal_add_js($path.'/js/fivestar.js', 'inline', 'footer');
$book = $_GET["book"];
$chap = $_GET["chap"];
$prob = $_GET["prob"];
$string = $book.'/'.$chap.'/'.$prob;
$query = "SELECT ctcr.nid FROM content_type_comments_ratings AS ctcr WHERE ctcr.field_problem_value = '".$string."'";
$result=db_query($query);
$row = db_fetch_array($result);
if(isset($row['nid']))
{
$nid = $row['nid'];
node_load(FALSE, NULL, TRUE);
$fivestar = node_load($nid, NULL, TRUE);
if (function_exists('fivestar_widget_form')) print fivestar_widget_form($fivestar);
}
If you could give me a hint or direct me to some reading on the web, I would appreciate it. Thank you very much in advance.
By doing all this on an 'external' page/file, you circumvent the Drupal theming system - drupal_add_js() (and fivestar_add_js(), as it is just using that in the end) do not output the script tags themselves, but simply ensure that they will be included in the $scripts variable in page.tpl.php, which is then responsible to print that variables content. As you do not go through the page template, you get no script tags.
You could do a print drupal_get_js(); in your external file to output the scripts added via drupal_add_js() as a quick fix, but note that this will output all the default drupal js files as well, which might be more than you need (but might as well contain other scripts needed by fivestar, e.g. jquery). Alternatively, you'll have to create the needed script tags yourself.
As for hints on what to read, it is difficult to point you to something particular, but you might want to read up on the theming system in general.