Search Results

Search found 804 results on 33 pages for 'dana gray'.

Page 6/33 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Python — How can I find the square matrix of a lower triangular numpy matrix? (with a symmetrical upper triangle)

    - by Dana Gray
    I generated a lower triangular matrix, and I want to complete the matrix using the values in the lower triangular matrix to form a square matrix, symmetrical around the diagonal zeros. lower_triangle = numpy.array([ [0,0,0,0], [1,0,0,0], [2,3,0,0], [4,5,6,0]]) I want to generate the following complete matrix, maintaining the zero diagonal: complete_matrix = numpy.array([ [0, 1, 2, 4], [1, 0, 3, 5], [2, 3, 0, 6], [4, 5, 6, 0]]) Thanks.

    Read the article

  • memory usage in C# (.NET) app is very high, until I call System.GC.Collect()

    - by Chris Gray
    I've written an app that spins a few threads each of which read several MB of memory. Each thread then connects to the Internet and uploads the data. this occurs thousands of times and each upload takes some time I'm seeing a situation where (verified with windbg/sos and !dumpheap) that the Byte[] are not getting collected automatically, causing 100/150MB of memory to be reported in task manager if I call System.GC.Collect() i'm seeing a huge drop in memory, a drop of over 100MB I dont like calling System.GC.Collect() and my PC has tons of free memory. however if anyone looks at TaskManager they're going to be concerned, thinking my app is leaking horribly. tips?

    Read the article

  • Please help with iPhone Memory & Images, memory usage crashing app

    - by Andrew Gray
    I have an issue with memory usage relating to images and I've searched the docs and watched the videos from cs193p and the iphone dev site on memory mgmt and performance. I've searched online and posted on forums, but I still can't figure it out. The app uses core data and simply lets the user associate text with a picture and stores the list of items in a table view that lets you add and delete items. Clicking on a row shows the image and related text. that's it. Everything runs fine on the simulator and on the device as well. I ran the analyzer and it looked good, so i then starting looking at performance. I ran leaks and everything looked good. My issue is when running Object Allocations as every time i select a row and the view with the image is shown, the live bytes jumps up a few MB and never goes down and my app eventually crashes due to memory usage. Sorting the live bytes column, i see 2 2.72MB mallocs (5.45Mb total), 14 CFDatas (3.58MB total), 1 2.74MB malloc and everything else is real small. the problem is all the related info in instruments is really technical and all the problem solving examples i've seen are just missing a release and nothing complicated. Instruments shows Core Data as the responsible library for all but one (libsqlite3.dylib the other) with [NSSQLCore _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:] as the caller for all but one (fetchResultSetReallocCurrentRow the other) and im just not sure how to track down what the problem is. i've looked at the stack traces and opened the last instance of my code and found 2 culprits (below). I havent been able to get any responses at all on this, so if anyone has any tips or pointers, I'd really appreciate it!!!! //this is from view controller that shows the title and image - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.title = item.title; self.itemTitleTextField.text = item.title; if ([item.notes length] == 0) { self.itemNotesTextView.hidden = YES; } else { self.itemNotesTextView.text = item.notes; } //this is the line instruments points to UIImage *image = item.photo.image; itemPhoto.image = image; } - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the managed object for the given index path NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; [context deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]]; // Save the context. NSError *error = nil; if (![context save:&error]) //this is the line instruments points to { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); exit(-1); } } }

    Read the article

  • ServicedComponent not being disposed in finaliser

    - by David Gray Wright
    Questions needing answers : Does the finalizer of the client side ServicedComponent call ServicedComponent.DisposeObject or Dispose? How should destruction (release of memory) occur in the com server in realtion to its usage in the client? Basically - we are reaching a 2 gig limit on process size (memory) of the COM server as memory is not being released - is the solution to call explicitly call Dispose or use the using statement in the client?

    Read the article

  • using Visual Studio 2008 to test an x64 .NET binary

    - by Chris Gray
    I have an x64 managed C++ class that needs to be tested using Visual Studio 2008. This class links to a x64 unmanaged lib I'm not able to run my my tests because vstesthost.exe (the exe Visual Studio hosts my test) is x86 and not x64. Ideas? the error generated is rror: System.BadImageFormatException: Could not load file or assembly ... or one of its dependencies. An attempt was made to load

    Read the article

  • Why is the compiler caching my "random" and NULLED variables?

    - by alex gray
    I am confounded by the fact that even using different programs (on the same machine) to run /compile, and after nilling the vaues (before and after) the function.. that NO MATTER WHAT.. I'll keep getting the SAME "random" numbers… each and every time I run it. I swear this is NOT how it's supposed to work.. I'm going to illustrate as simply as is possible… #import <Foundation/Foundation.h> int main(int argc, char *argv[]) { int rPrimitive = 0; rPrimitive = 1 + rand() % 50; NSNumber *rObject = nil; rObject = [NSNumber numberWithInt:rand() % 10]; NSLog(@"%i %@", rPrimitive, rObject); rPrimitive = 0; rObject = nil; NSLog(@"%i %@", rPrimitive, rObject); return 0; } Run it in TextMate: i686-apple-darwin11-llvm-gcc-4.2 8 9 0 (null) Run it in CodeRunner: i686-apple-darwin11-llvm-gcc-4.2 8 9 0 (null) Run it a million times, if you'd like. You can gues what it will always be. Why does this happen? Why oh why is this "how it is"?

    Read the article

  • MySQL specifying exact order with WHERE `id` IN (...)

    - by Gray Fox
    Is there an easy way to order MySQL results respectively by WHERE id IN (...) clause? Example: SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) to return Article with id = 4 Article with id = 2 Article with id = 5 Article with id = 9 Article with id = 3 and also SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) LIMIT 2,2 to return Article with id = 5 Article with id = 9

    Read the article

  • How to pass a value between Silverlight pages for WP7?

    - by Sebastian Gray
    I've got a MainPage.xaml page a Detail.xaml page. I've passed variables to the Detail.xaml from MainPage.xaml by using a static variable and referencing it in Detail.xaml (the detail page is acting like a dialog). However once I've updated the content of another object, I want to call a method in MainPage.xaml to refresh the content of that page using the updated object from the Detail.xaml page. I assume I am not using the correct paradigm for this and should probably be using MVVM or something but I'm not familiar with the implementation and was hoping there was a simple way to do this?

    Read the article

  • Create a variable which is named depending on an ID number?

    - by gray
    Is there any way to create a variable, and add an ID to the end of the actual variable name? I have a variable called 'gauge', used to create a new Gauge object: var gauge = new Gauge(target).setOptions(opts); I want to add an ID to the variable, so something like: var gauge+id = new Gauge(target).setOptions(opts); It's because I'm creating a number of these objects, and have a specific ID already for each one, which I want to attach to the gauge object if possible? All my code for this function is below, if it gives you a better idea of what i need to do: function go(id, votes) { var val = $('#votes_'+id).text(); var target = document.getElementById('foo_'+id); // your canvas element var gauge = new Gauge(target).setOptions(opts); // create sexy gauge! gauge.maxValue = 100; // set max gauge value gauge.animationSpeed = 20; // set animation speed (32 is default value) var a=votes+0.5; gauge.set(val); // set actual value } My main problem arises on the last line. It says gauge.set(val), and it only sets the last object, ignoring all the other ones...

    Read the article

  • Juniper’s Network Connect ncsvc on Linux: “host checker failed, error 10”

    - by hfs
    I’m trying to log in to a Juniper VPN with Network Connect from a headless Linux client. I followed the instructions and used the script from http://mad-scientist.us/juniper.html. When running the script with --nogui switch the command that gets finally executed is $HOME/.juniper_networks/network_connect/ncsvc -h HOST -u USER -r REALM -f $HOME/.vpn.default.crt. I get asked for the password, a line “Connecting to…” is printed but then the programm silently stops. When adding -L 5 (most verbose logging) to the command line, these are the last messages printed to the log: dsclient.info state: kStateCacheCleaner (dsclient.cpp:280) dsclient.info --> POST /dana-na/cc/ccupdate.cgi (authenticate.cpp:162) http_connection.para Entering state_start_connection (http_connection.cpp:282) http_connection.para Entering state_continue_connection (http_connection.cpp:299) http_connection.para Entering state_ssl_connect (http_connection.cpp:468) dsssl.para SSL connect ssl=0x833e568/sd=4 connection using cipher RC4-MD5 (DSSSLSock.cpp:656) http_connection.para Returning DSHTTP_COMPLETE from state_ssl_connect (http_connection.cpp:476) DSHttp.debug state_reading_response_body - copying 0 buffered bytes (http_requester.cpp:800) DSHttp.debug state_reading_response_body - recv'd 0 bytes data (http_requester.cpp:833) dsclient.info <-- 200 (authenticate.cpp:194) dsclient.error state host checker failed, error 10 (dsclient.cpp:282) ncapp.error Failed to authenticate with IVE. Error 10 (ncsvc.cpp:197) dsncuiapi.para DsNcUiApi::~DsNcUiApi (dsncuiapi.cpp:72) What does host checker failed mean? How can I find out what it tried to check and what failed? The HostChecker Configuration Guide mentions that a $HOME/.juniper_networks/tncc.jar gets installed on Linux, but my installation contains no such file. From that I concluded that HostChecker is disabled for my VPN on Linux? Are the POST to /dana-na/cc/ccupdate.cgi and “host checker failed” connected or independent? By running the connection over a SSL proxy I found out that the POST data is status=NOTOK (Funny side note: the client of the oh-so-secure VPN does not validate the server’s SSL certificate, so is wide open to MITM attacks…). So it seems that it’s the client that closes the connection and not the server.

    Read the article

  • Creating a Colormap Legend in Matplotlib

    - by Vince
    Hi fellow Stackers! I am using imshow() in matplotlib like so: import numpy as np import matplotlib.pyplot as plt mat = '''SOME MATRIX''' plt.imshow(mat, origin="lower", cmap='gray', interpolation='nearest') plt.show() How do I add a legend showing the numeric value for the different shades of gray. Sadly, my googling has not uncovered an answer :( Thank you in advance for the help. Vince

    Read the article

  • JQUERY Effect highlight, control the Start & End colors

    - by nobosh
    I have the following: $(".notifycell_email_dailydigest").effect('highlight'); The element I want to highlight is over a gray background. Problem is the highlight goes from Yellow to white, and has this ugly slow pause at the end on the white which makes the animation look horrible. How can I modify the highlighy to start with the yellow but end on the gray so it matches the background? Thanks

    Read the article

  • Blurry text in WPF even with ClearTypeHinting enabled?

    - by rFactor
    I have a grid with this template and styles in WPF/XAML: <Setter Property="TextOptions.TextFormattingMode" Value="Display" /> <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGridCell}"> <Border Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> <ContentPresenter x:Name="CellContent" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RenderOptions.ClearTypeHint="Enabled" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter TargetName="CellContent" Property="TextOptions.TextFormattingMode" Value="Display" /> <Setter TargetName="CellContent" Property="RenderOptions.ClearTypeHint" Value="Enabled" /> <Setter TargetName="CellContent" Property="Effect"> <Setter.Value> <DropShadowEffect ShadowDepth="2" BlurRadius="2" Color="Black" RenderingBias="Quality" /> </Setter.Value> </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> The DropShadowEffect I have when you select a grid row, seems to make the text rendering blurry (gray anti-aliasing): When I remove the drop shadow effect, it looks clear because it now uses ClearType and not gray sub-pixel anti-aliasing: I have tried applying RenderOptions.ClearTypeHint="Enabled" to the ContentPresenter as seen above, but it does not help. How do I force WPF to render the text that gets displayed with drop shadow effect to retain Cleartype anti-aliasing, instead of that ugly blurry gray sub-pixel anti-aliasing? Some believe it's blurry because of the drop shadow -- this is not true. It's blurry only because ClearType is not used. This is how it looks like in Firefox when shadow AND ClearType: ClearType enabled text is colorful -- but that blurry text is not, because it does not use ClearType -- it uses gray sub-pixel anti-aliasing and that's not how ClearType works: http://en.wikipedia.org/wiki/ClearType The question is: how do I enable ClearType for this text?

    Read the article

  • Header Div Position Edit according to Content Div

    - by Melih Mucuk
    I want to design my web site. I have two main div, one of them "header", other "content". I want to set width property:80% and I set center for both of them. But I don't do that. Other question about header div. I uploaded an image and I want to design like this. How can I do all of them? My CSS: #main { margin:0px auto; margin-left:50px; margin-right:50px; margin-top:25px; margin-bottom:25px; height:auto; text-align:center;} #content { width:80%; height:auto; margin:0px auto; } #header { width:80%; height:100px; top:20px; } #header_left { float:left ; height: 100px; text-align: center; } #header_right { margin:0px auto; height:30px; text-align:center; margin-top:35px; } #header_social { float:right; height:30px; text-align:center; margin-top:35px;} My client code: <div id="main"> <div id="content"> <div id="header"> <div id="header_left"> <asp:Image ID="Image1" runat="server" /> </div> <div id="header_right"> <asp:LinkButton ID="LinkButton5" runat="server" ForeColor="Gray"></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton4" runat="server" ForeColor="Gray" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton3" runat="server" ForeColor="#FF3300" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="Gray" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Gray" ></asp:LinkButton> </div> <div id="header_social"> <asp:ImageButton ID="ImageButton1" runat="server"/> <asp:ImageButton ID="ImageButton2" runat="server"/> </div> </div> ******CONTENT FIELD***** </div> </div>

    Read the article

  • Creating a grid overlay over image.

    - by neteus
    Hi everybody, I made a script (using mootools library) that is supposed to overlay an image with a table grid and when each grid cell is clicked/dragged over its background color changes 'highlighting' the cell. Current code creates a table and positions it over the element (el, image in this case). Table was used since I am planning to add rectangle select tool later on, and it seemed easiest way to do it. <html> <head> <title></title> <script type="text/javascript" src="mootools.js"></script> <script type="text/javascript"> var SetGrid = function(el, sz, nr, nc){ //get number of rows/columns according to the 'grid' size numcols = el.getSize().x/sz; numrows = el.getSize().y/sz; //create table element for injecting cols/rows var gridTable = new Element('table', { 'id' : 'gridTable', 'styles' : { 'width' : el.getSize().x, 'height' : el.getSize().y, 'top' : el.getCoordinates().top, 'left' : el.getCoordinates().left } }); //inject rows/cols into gridTable for (row = 1; row<=numrows; row++){ thisRow = new Element('tr', { 'id' : row, 'class' : 'gridRow' }); for(col = 1; col<=numcols; col++){ thisCol = new Element('td', { 'id' : col, 'class' : 'gridCol0' }); //each cell gets down/up over event... down starts dragging|up stops|over draws area if down was fired thisCol.addEvents({ 'mousedown' : function(){ dragFlag = true; startRow = this.getParent().get('id'); startCol = this.get('id'); }, 'mouseup' : function(){ dragFlag = false; }, 'mouseover' : function(){ if (dragFlag==true){ this.set('class', 'gridCol'+$$('#lvlSelect .on').get('value')); } }, 'click' : function(){ //this.set('class', 'gridCol'+$$('#lvlSelect .on').get('id').substr(3, 1) ); str = $$('#lvlSelect .on').get('id'); alert(str.substr(2, 3)); } }); thisCol.inject(thisRow, 'bottom'); }; thisRow.inject(gridTable, 'bottom'); }; gridTable.inject(el.getParent()); } //sens level selector func var SetSensitivitySelector = function(el, sz, nr, nc){ $$('#lvlSelect ul li').each(function(el){ el.addEvents({ 'click' : function(){ $$('#lvlSelect ul li').set('class', ''); this.set('class', 'on'); }, 'mouseover' : function(){ el.setStyle('cursor','pointer'); }, 'mouseout' : function(){ el.setStyle('cursor',''); } }); }); } //execute window.addEvent('load', function(){ SetGrid($('imagetomap'), 32); SetSensitivitySelector(); }); </script> <style> #imagetomapdiv { float:left; display: block; } #gridTable { border:1px solid red; border-collapse:collapse; position:absolute; z-index:5; } #gridTable td { opacity:0.2; filter:alpha(opacity=20); } #gridTable .gridCol0 { border:1px solid gray; background-color: none; } #gridTable .gridCol1 { border:1px solid gray; background-color: green; } #gridTable .gridCol2 { border:1px solid gray; background-color: blue; } #gridTable .gridCol3 { border:1px solid gray; background-color: yellow; } #gridTable .gridCol4 { border:1px solid gray; background-color: orange; } #gridTable .gridCol5 { border:1px solid gray; background-color: red; } #lvlSelect ul {float: left; display:block; position:relative; margin-left: 20px; padding: 10px; } #lvlSelect ul li { width:40px; text-align:center; display:block; border:1px solid black; position:relative; padding: 10px; list-style:none; opacity:0.2; filter:alpha(opacity=20); } #lvlSelect ul li.on { opacity:1; filter:alpha(opacity=100); } #lvlSelect ul #li0 { background-color: none; } #lvlSelect ul #li1 { background-color: green; } #lvlSelect ul #li2 { background-color: blue; } #lvlSelect ul #li3 { background-color: yellow; } #lvlSelect ul #li4 { background-color: orange; } #lvlSelect ul #li5 { background-color: red; } </style> </head> <body> <div id="imagetomapdiv"> <img id="imagetomap" src="1.png"> </div> <div id="lvlSelect"> <ul> <li value="0" id="li0">0</li> <li value="1" id="li1">1</li> <li value="2" id="li2">2</li> <li value="3" id="li3">3</li> <li value="4" id="li4">4</li> <li value="5" id="li5" class="on">5</li> </ul> </div> </body> </html> A 'working' example: http://72.14.186.218/~alex/motion.php There are two problems: while it works just fine in FF, IE and Chrome do not create the table if the page is refreshed. If you go back to directory root and click on the link to the file the grid table is displayed, if you hit 'refresh' button -- the script runs but the table is not injected. Secondly, although the table HTML is injected in IE, it does not display it. I tried adding nbsp's to make sure its not ignored -- to no avail. Any suggestions on improving code or help with the issues is appreciated. Thanks!

    Read the article

  • need prefuse graph edges like arrows

    - by merve
    Hello, I did my homework and searched both google for a sample and a topic that is answered before on stackoverflow. But nothing has been found. My problem is ordinary edges who does not have a view like arrows. Here is what i do to hope there is forward arrows from target to destination: LabelRenderer nameLabel = new LabelRenderer("name"); nameLabel.setRoundedCorner(8, 8); DefaultRendererFactory rendererFactory = new DefaultRendererFactory(nameLabel); EdgeRenderer edgeRenderer; edgeRenderer = new EdgeRenderer(prefuse.Constants.EDGE_TYPE_LINE, prefuse.Constants.EDGE_ARROW_FORWARD); rendererFactory.setDefaultEdgeRenderer(edgeRenderer); vis.setRendererFactory(rendererFactory); Here is what i see about colour of edges, hoping these must not be transparent: int[] palette = new int[]{ColorLib.rgb(255, 180, 180), ColorLib.rgb(190, 190, 255)}; DataColorAction fill = new DataColorAction("socialnet.nodes", "gender", Constants.NOMINAL, VisualItem.FILLCOLOR, palette); ColorAction text = new ColorAction("socialnet.nodes", VisualItem.TEXTCOLOR, ColorLib.gray(0)); ColorAction edges = new ColorAction("socialnet.edges", VisualItem.STROKECOLOR, ColorLib.gray(200)); ColorAction arrow = new ColorAction("socialnet.edges", VisualItem.FILLCOLOR, ColorLib.gray(200)); ActionList colour = new ActionList(); colour.add(fill); colour.add(text); colour.add(edges); colour.add(arrow); vis.putAction("colour", colour); Thus, i wonder where am i wrong? Why my edges do not seem like arrows? Thanks for any idea. For more detail, i want to paste all of the code: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package prefusedeneme; import javax.swing.JFrame; import prefuse.data.*; import prefuse.data.io.*; import prefuse.Display; import prefuse.Visualization; import prefuse.render.*; import prefuse.util.*; import prefuse.action.assignment.*; import prefuse.Constants; import prefuse.visual.*; import prefuse.action.*; import prefuse.activity.*; import prefuse.action.layout.graph.*; import prefuse.controls.*; import prefuse.data.expression.Predicate; import prefuse.data.expression.parser.ExpressionParser; public class SocialNetworkVis { public static void main(String argv[]) { // 1. Load the data Graph graph = null; /* graph will contain the core data */ try { graph = new GraphMLReader().readGraph("socialnet.xml"); /* load the data from an XML file */ } catch (DataIOException e) { e.printStackTrace(); System.err.println("Error loading graph. Exiting..."); System.exit(1); } // 2. prepare the visualization Visualization vis = new Visualization(); /* vis is the main object that will run the visualization */ vis.add("socialnet", graph); /* add our data to the visualization */ // 3. setup the renderers and the render factory // labels for name LabelRenderer nameLabel = new LabelRenderer("name"); nameLabel.setRoundedCorner(8, 8); /* nameLabel decribes how to draw the data elements labeled as "name" */ // create the render factory DefaultRendererFactory rendererFactory = new DefaultRendererFactory(nameLabel); EdgeRenderer edgeRenderer; edgeRenderer = new EdgeRenderer(prefuse.Constants.EDGE_TYPE_LINE, prefuse.Constants.EDGE_ARROW_FORWARD); rendererFactory.setDefaultEdgeRenderer(edgeRenderer); vis.setRendererFactory(rendererFactory); // 4. process the actions // colour palette for nominal data type int[] palette = new int[]{ColorLib.rgb(255, 180, 180), ColorLib.rgb(190, 190, 255)}; /* ColorLib.rgb converts the colour values to integers */ // map data to colours in the palette DataColorAction fill = new DataColorAction("socialnet.nodes", "gender", Constants.NOMINAL, VisualItem.FILLCOLOR, palette); /* fill describes what colour to draw the graph based on a portion of the data */ // node text ColorAction text = new ColorAction("socialnet.nodes", VisualItem.TEXTCOLOR, ColorLib.gray(0)); /* text describes what colour to draw the text */ // edge ColorAction edges = new ColorAction("socialnet.edges", VisualItem.STROKECOLOR, ColorLib.gray(200)); ColorAction arrow = new ColorAction("socialnet.edges", VisualItem.FILLCOLOR, ColorLib.gray(200)); /* edge describes what colour to draw the edges */ // combine the colour assignments into an action list ActionList colour = new ActionList(); colour.add(fill); colour.add(text); colour.add(edges); colour.add(arrow); vis.putAction("colour", colour); /* add the colour actions to the visualization */ // create a separate action list for the layout ActionList layout = new ActionList(Activity.INFINITY); layout.add(new ForceDirectedLayout("socialnet")); /* use a force-directed graph layout with default parameters */ layout.add(new RepaintAction()); /* repaint after each movement of the graph nodes */ vis.putAction("layout", layout); /* add the laout actions to the visualization */ // 5. add interactive controls for visualization Display display = new Display(vis); display.setSize(700, 700); display.pan(350, 350); // pan to the middle display.addControlListener(new DragControl()); /* allow items to be dragged around */ display.addControlListener(new PanControl()); /* allow the display to be panned (moved left/right, up/down) (left-drag)*/ display.addControlListener(new ZoomControl()); /* allow the display to be zoomed (right-drag) */ // 6. launch the visualizer in a JFrame JFrame frame = new JFrame("prefuse tutorial: socialnet"); /* frame is the main window */ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(display); /* add the display (which holds the visualization) to the window */ frame.pack(); frame.setVisible(true); /* start the visualization working */ vis.run("colour"); vis.run("layout"); } }

    Read the article

  • Grid overlayed on image using javascript, need help getting grid coordinates.

    - by Alos
    Hi I am fairly new to javascript and could use some help, I am trying to overlay a grid on top of an image and then be able to have the user click on the grid and get the grid coordinate from the box that the user clicked. I have been working with the code from the following stackoverflow question: Creating a grid overlay over image. link text Here is the code that I have so far: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> </script> <script type="text/javascript"> var SetGrid = function(el, sz, nr, nc){ //get number of rows/columns according to the 'grid' size //numcols = el.getSize().x/sz; //numrows = el.getSize().y/sz; numcols = 48; numrows = 32; //create table element for injecting cols/rows var gridTable = new Element('table', { 'id' : 'gridTable', 'styles' : { 'width' : el.getSize().x, 'height' : el.getSize().y, 'top' : el.getCoordinates().top, 'left' : el.getCoordinates().left } }); //inject rows/cols into gridTable for (row = 1; row<=numrows; row++){ thisRow = new Element('tr', { 'id' : row, 'class' : 'gridRow' }); for(col = 1; col<=numcols; col++){ thisCol = new Element('td', { 'id' : col, 'class' : 'gridCol0' }); //each cell gets down/up over event... down starts dragging|up stops|over draws area if down was fired thisCol.addEvents({ 'mousedown' : function(){ dragFlag = true; startRow = this.getParent().get('id'); startCol = this.get('id'); }, 'mouseup' : function(){ dragFlag = false; }, 'mouseover' : function(){ if (dragFlag==true){ this.set('class', 'gridCol'+$$('#lvlSelect .on').get('value')); } }, 'click' : function(){ //this.set('class', 'gridCol'+$$('#lvlSelect .on').get('id').substr(3, 1) ); str = $$('#lvlSelect .on').get('id'); alert(str.substr(2, 3)); } }); thisCol.inject(thisRow, 'bottom'); }; thisRow.inject(gridTable, 'bottom'); }; gridTable.inject(el.getParent()); } //sens level selector func var SetSensitivitySelector = function(el, sz, nr, nc){ $$('#lvlSelect ul li').each(function(el){ el.addEvents({ 'click' : function(){ $$('#lvlSelect ul li').set('class', ''); this.set('class', 'on'); }, 'mouseover' : function(){ el.setStyle('cursor','pointer'); }, 'mouseout' : function(){ el.setStyle('cursor',''); } }); }); } //execute window.addEvent('load', function(){ SetGrid($('imagetomap'), 32); SetSensitivitySelector(); }); var gridSize = { x: 48, y: 32 }; var img = document.getElementById('imagetomap'); img.onclick = function(e) { if (!e) e = window.event; alert(Math.floor(e.offsetX/ gridSize.x) + ', ' + Math.floor(e.offsetY / gridSize.y)); } </script> <style> #imagetomapdiv { float:left; display: block; } #gridTable { border:1px solid red; border-collapse:collapse; position:absolute; z-index:5; } #gridTable td { opacity:0.2; filter:alpha(opacity=20); } #gridTable .gridCol0 { border:1px solid gray; background-color: none; } #gridTable .gridCol1 { border:1px solid gray; background-color: green; } #gridTable .gridCol2 { border:1px solid gray; background-color: blue; } #gridTable .gridCol3 { border:1px solid gray; background-color: yellow; } #gridTable .gridCol4 { border:1px solid gray; background-color: orange; } #gridTable .gridCol5 { border:1px solid gray; background-color: red; } #lvlSelect ul {float: left; display:block; position:relative; margin-left: 20px; padding: 10px; } #lvlSelect ul li { width:40px; text-align:center; display:block; border:1px solid black; position:relative; padding: 10px; list-style:none; opacity:0.2; filter:alpha(opacity=20); } #lvlSelect ul li.on { opacity:1; filter:alpha(opacity=100); } #lvlSelect ul #li0 { background-color: none; } #lvlSelect ul #li1 { background-color: green; } #lvlSelect ul #li2 { background-color: blue; } #lvlSelect ul #li3 { background-color: yellow; } #lvlSelect ul #li4 { background-color: orange; } #lvlSelect ul #li5 { background-color: red; } </style> </div> <div id="lvlSelect"> <ul> <li value="0" id="li0">0</li> <li value="1" id="li1">1</li> <li value="2" id="li2">2</li> <li value="3" id="li3">3</li> <li value="4" id="li4">4</li> <li value="5" id="li5" class="on">5</li> </ul> </div> In this example the grid box changes color when the image is grid box is clicked, but I would like to be able to have the coordinates of the box. Any help would be great. Thank you

    Read the article

  • block z-positioning without z-index

    - by Peter
    Please, have a look at: http://twitter.github.com/bootstrap/base-css.html There are many examples like this one: if you look closer to the block borders, you can see that the gray block is under the white one. Using the browser's developer tools you can see that both boxes have an inherited z-index: auto; I can't reproduce this effect on my website (without using z-index). So, my question is: Why is the gray block under the white one?

    Read the article

  • How do I set the text color of a Cocoa tooltip?

    - by Adam Preble
    I am using BGHUDAppKit for an outline view within a HUD-style (black) NSPanel. As such the text in my outline view cells is light gray or white. Unfortunately this means that when I hover to bring up a tooltip for a cell's value, it shows up as light gray text on yellow, which is illegible. How can I set the text color for the tooltip, or is there a way that I can modify the control itself (without changing its appearance) to work better with the tooltip mechanism?

    Read the article

  • Set Round Border of an android TextView already having a background color

    - by vaibhav
    I want a TextView to have a rounded border. This can be done by using a drawable, specifying a shape in the drawable, and then using the drawable as the background of the TextView. android:background="@layout/border" Also shown here However, my TextView already has a background color (which is gray) and thus I'm unable to use the above method to set a rounded border. Is there any other method to do this which allows the background color of the TextView to remain gray and also surrounds it with a rounded border?

    Read the article

  • ASP.NET GridView second header row to span main header row

    - by Dana Robinson
    I have an ASP.NET GridView which has columns that look like this: | Foo | Bar | Total1 | Total2 | Total3 | Is it possible to create a header on two rows that looks like this? | | Totals | | Foo | Bar | 1 | 2 | 3 | The data in each row will remain unchanged as this is just to pretty up the header and decrease the horizontal space that the grid takes up. The entire GridView is sortable in case that matters. I don't intend for the added "Totals" spanning column to have any sort functionality. Edit: Based on one of the articles given below, I created a class which inherits from GridView and adds the second header row in. namespace CustomControls { public class TwoHeadedGridView : GridView { protected Table InnerTable { get { if (this.HasControls()) { return (Table)this.Controls[0]; } return null; } } protected override void OnDataBound(EventArgs e) { base.OnDataBound(e); this.CreateSecondHeader(); } private void CreateSecondHeader() { GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal); TableCell left = new TableHeaderCell(); left.ColumnSpan = 3; row.Cells.Add(left); TableCell totals = new TableHeaderCell(); totals.ColumnSpan = this.Columns.Count - 3; totals.Text = "Totals"; row.Cells.Add(totals); this.InnerTable.Rows.AddAt(0, row); } } } In case you are new to ASP.NET like I am, I should also point out that you need to: 1) Register your class by adding a line like this to your web form: <%@ Register TagPrefix="foo" NameSpace="CustomControls" Assembly="__code"%> 2) Change asp:GridView in your previous markup to foo:TwoHeadedGridView. Don't forget the closing tag. Another edit: You can also do this without creating a custom class. Simply add an event handler for the DataBound event of your grid like this: protected void gvOrganisms_DataBound(object sender, EventArgs e) { GridView grid = sender as GridView; if (grid != null) { GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal); TableCell left = new TableHeaderCell(); left.ColumnSpan = 3; row.Cells.Add(left); TableCell totals = new TableHeaderCell(); totals.ColumnSpan = grid.Columns.Count - 3; totals.Text = "Totals"; row.Cells.Add(totals); Table t = grid.Controls[0] as Table; if (t != null) { t.Rows.AddAt(0, row); } } } The advantage of the custom control is that you can see the extra header row on the design view of your web form. The event handler method is a bit simpler, though.

    Read the article

  • Where Can I find a good tutorial for IJG libjpeg

    - by Dana the Sane
    I need to do some work with this library and I'm finding the documentation at http://apodeline.free.fr/DOC/libjpeg/libjpeg.html to be deficient (incomplete function signatures, etc). Does anyone know of some other sides or have some example code illustrating common tasks? [Edit] I also found this question with an example, but any others would be helpful.

    Read the article

  • Upgrading VSTO project to .net 4 - What references do I actually need?

    - by Dana
    I'm developing an application for Office. It originally targeted .net 3.5, but I decided to upgrade to .net 4 because of some WPF issues that I've run into. When I switched all the projects in my solution and rebuilt, I got an error saying to include System.Xaml. I did that and rebuilt, and VS2010 told me to include another reference, so I did. This happened a couple more times, and finally it asked me to include Microsoft.Office.Tools.Common.v9.0, and when I did I got this error: Microsoft.Office.Tools.CustomTaskPaneCollection exists in both Microsoft.Office.Tools.Common.v9.0.dll and Microsoft.Office.Tools.Common.dll I have both Microsoft.Office.Tools.Common.v9.0 and Microsoft.Office.Tools.Common referenced in my project, but the problem is that if I remove either, I get an error. Am I doing something wrong? Is it odd that I would need both references? I find it strange that CustomTaskPaneCollection would be defined in two different binaries. If I remove Microsoft.Office.Tools.Common, the error that I get is "Cannot find the interop type that matches the embedded interop type 'Microsoft.Office.Tools.IAddInExtension'. Are you missing an assembly reference?"

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >