Skip to content

Commit

Permalink
Failure handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thallium205 committed Jan 6, 2013
1 parent 74d6978 commit d094ac8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 27 deletions.
27 changes: 17 additions & 10 deletions client/public/javascripts/gexfjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ var GexfJS = {
"search" : "Search nodes",
"nodeAttr" : "Attributes",
"nodes" : "Nodes",
"inLinks" : "Inbound Links from :",
"outLinks" : "Outbound Links to :",
"inLinks" : "Incoming Transactions From :",
"outLinks" : "Outgoing Tranasctions To :",
"undirLinks" : "Undirected links with :",
"lensOn" : "Activate lens mode",
"lensOff" : "Deactivate lens mode",
Expand Down Expand Up @@ -460,11 +460,21 @@ function loadGraph(ownerOrAddr) {
} else {
url = "owner/addr/" + ownerOrAddr + "/gexf";
}


$('#loadModal').modal('show');
$.ajax({
url: (url),
dataType: "xml",
error: function() {
$('#loadModal').modal('hide');
alert('The visual representation of this owner is too large so the request has been cancelled. Time division subsections of the network are in the works to analyze large nodes and their interactions to other owners. Stay tuned!');
},
success: function(data) {
if (data === null) {
$('#loadModal').modal('hide');
alert('The visual representation of this owner is too large so the request has been cancelled. Time division subsections of the network are in the works to analyze large nodes and their interactions to other owners. Stay tuned!');
return;
}
var _s = new Date();
var _g = $(data).find("graph"),
_nodes = _g.children().filter("nodes").children();
Expand Down Expand Up @@ -588,15 +598,12 @@ function loadGraph(ownerOrAddr) {
});
});

GexfJS.imageMini = GexfJS.ctxMini.getImageData(0, 0, GexfJS.overviewWidth, GexfJS.overviewHeight);

//changeNiveau(0);
GexfJS.imageMini = GexfJS.ctxMini.getImageData(0, 0, GexfJS.overviewWidth, GexfJS.overviewHeight);

if (isOwner) {
displayNode(ownerOrAddr, true);
}


displayNode(-1); // Refresh the layout
}
$('#loadModal').modal('hide');
}
});
}
Expand Down
22 changes: 11 additions & 11 deletions client/views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,13 @@ html.
<div class="container">
<a class="brand" href="#">Block Viewer</a>
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Help</a></li>
</ul>
<div class="pull-left">
<p class="navbar-text">Donate!<p>
</div>

<form class="navbar-search pull-left form-inline" id="graphsearchform">
<input type="text" placeholder="Owner Id - Search the Graph" class="search-query" id="graphsearch"/>
</form>

<p class="navbar-text">Donate! 14gZTuHA4xa4gJQBubn5fj3b4D4QHEDdwY<p>
</div>
<form class="navbar-search pull-right form-inline" id="networksearchform">
<input type="text" style="width:500px" class="search-query" placeholder="Bitcoin Address - Search the Network" id="networksearch">
<input type="text" style="width:500px" class="search-query" placeholder="Bitcoin Address or Owner Id - Search the Network" id="networksearch">
</form>
</div>
</div>
Expand Down Expand Up @@ -70,4 +63,11 @@ html.

<ul id="autocomplete">
</ul>


<div id="loadModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Loading" aria-hidden="true">
<div class="modal-body">
<p> Loading... </p>
</div>
</div>
</body>
Binary file modified server/bin/bitcoinvisualizer/GraphExporter.class
Binary file not shown.
12 changes: 6 additions & 6 deletions server/src/bitcoinvisualizer/GraphExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ public static void ExportTimeAnalysisGraphsToMySql(final GraphDatabaseAPI graphD
}
}

public static String GetOwnerByAddress(final GraphDatabaseAPI graphDb, final String address, final ExportType exportType)
public static synchronized String GetOwnerByAddress(final GraphDatabaseAPI graphDb, final String address, final ExportType exportType)
{
owned_addresses = graphDb.index().forNodes(OWNED_ADDRESS_HASH);
final long ownerId = owned_addresses.query(OWNED_ADDRESS_HASH_KEY, address).getSingle().getSingleRelationship(OwnerRelTypes.owns, Direction.INCOMING).getStartNode().getId();
return Export(null, graphDb, ownerId, null, null, exportType, 1);
}

public static String GetOwnerById(final GraphDatabaseAPI graphDb, final Long ownerId, final ExportType exportType)
public static synchronized String GetOwnerById(final GraphDatabaseAPI graphDb, final Long ownerId, final ExportType exportType)
{
return Export(null, graphDb, ownerId, null, null, exportType, 1);
}
Expand Down Expand Up @@ -238,10 +238,10 @@ private static String Export(final Connection sqlDb, final GraphDatabaseAPI grap
AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
LOG.info("Graph Imported. Nodes: " + graph.getNodeCount() + " Edges: " + graph.getEdgeCount());

if (!isDateCompare && graph.getNodeCount() > 100000)
if (!isDateCompare && graph.getNodeCount() > 10000)
{
LOG.warning("The graph is being skipped because it contains over 100,000 nodes.");
return null;
LOG.warning("The graph is being skipped because it contains over 10,000 nodes.");
return "";
}

LOG.info("Setting graph labels and features...");
Expand Down Expand Up @@ -611,7 +611,7 @@ else if (label instanceof Long)
catch (SQLException e)
{
LOG.log(Level.SEVERE, "Unable to access MySQL database.", e);
return null;
return "";
}
}

Expand Down

0 comments on commit d094ac8

Please sign in to comment.