Search Results

Search found 4489 results on 180 pages for 'black cobra'.

Page 94/180 | < Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >

  • Change Win7 desktop background via Win2k3 Group Policy

    - by microchasm
    I'm experiencing some strange behavior: I have set the following policies: User Configuration\Administrative templates\Desktop\Active Desktop Enable active desktop [enabled] Active Desktop Wallpaper [set to local path -- quadruple checked; path is correct] Allow only bitmap wallpaper [disabled] gpupdate /force, log out, log back in, and the background is just black. If I go into themes, and select Windows 7, the appointed background then shows (it also flashes when logging out). gpresult I've tried: http://social.technet.microsoft.com/Forums/en/winserverGP/thread/a1ebfe81-421e-4630-8c1f-8068222ee533 http://support.microsoft.com/default.aspx?scid=kb;EN-US;977944 http://social.technet.microsoft.com/Forums/en/w7itproui/thread/5b9e513a-d504-451d-a121-b4f94893d96d and a few other things, but nothing seems to be working :/ Thanks for any help/tips/advice.

    Read the article

  • Multi-monitor aterm transparency

    - by Bryan Ward
    I have 3 monitors which I set the background with using xpmroot my-5760x1200bg.png I then setup aterm to use transparency by adding the following to my ~/.Xdefaults file. aterm*transparent:true aterm*shading:60 aterm*background:Black aterm*foreground:White aterm*scrollBar:true aterm*scrollBar_right:true aterm*transpscrollbar:true aterm*saveLines:32767 aterm*font:*-*-fixed-medium-r-normal--*-140-*-*-*-*-iso8859-1 aterm*boldFont:*-*-fixed-bold-r-normal--*-*-140-*-*-*-*-iso8859-1 I am getting transparency on my aterm windows, but the image that is coming through with the transparency isn't correct. On the left monitor things are fine, but the middle and right monitors both seem to use the leftmost 1920x1200 of the background image as what is behind the terminal window. It would be as if every screen had the same background as the monitor on the left. Is this something that can be configured to be correct, or is this a bug? I'm running Gentoo Linux with Xmonad.

    Read the article

  • Proper 16:9 video size for non-HD 4:3 video (for youtube/vimeo)

    - by Xeoncross
    Since High Definition video came out on all the online sites it has changed the default aspect ratio of the player from 4:3 to 16:9. This means that for people posting SD video you have to resize some of your videos to get them to fit right. For example, NTSC DVD quality (aka 480i/p) is 720x480 pixels (width x height). However, low-end High Definition (720i/p) is 1280x720. Anyway, now that the video players are built for HD you will find that uploading standard quality videos will result in videos that are "letter boxed" which means they have extra black bars on the top and bottom (or sides). Correct me if I'm wrong, but in order to get a 720x480 video to fit a box that is designed for HD the best practice would be to crop some of it off so that it fits as 720x404 since: 16/9 = 1.78 (1.7777777777778) 720/405 = 1.78 405x1.78 = 720.9 The same would stand for 640x480 (old TV quality) video that would need to be 640x360 correct? I'm asking because I'm not sure about all this and whether this is the proper way to fix these letter-boxing/display problems.

    Read the article

  • Coloring The Z Shell[closed]

    - by Richard
    Because I have to stare at my command prompt all the time on my computer, it should look at least half-decent, so I am trying to get it colored. The expected outcome is as seen on this site. I have the colors I want set in my .Xdefaults file, but they of course do not color my prompt. My .zshrc is Phil's Prompt. My .Xdefaults is: *background: #121212 !black xterm*color0: #353535 xterm*color8: #666666 !red xterm*color1: #AE4747 xterm*color9: #EE6363 !green xterm*color2: #556B2F xterm*color10: #9ACD32 !brown/yellow xterm*color3: #DAA520 xterm*color11: #FFC125 !blue xterm*color4: #6F99B4 xterm*color12: #7C96B0 !magenta xterm*color5: #8B7B8B xterm*color13: #D8BFD8 !cyan xterm*color6: #A7A15E xterm*color14: #F0E68C !white xterm*color7: #DDDDDD xterm*color15: #FFFFFF *foreground: #DDDDDD Help will be appreciated.

    Read the article

  • Reinstalled Windows XP Home, shows as XP Pro, 'invalid' errors

    - by jan
    We reinstalled Windows XP Home after hard drive crash. The system now shows as XP Pro and we're constantly getting 'invalid software' popups, images show in solid black. We called Microsoft, they said the serial number is valid etc. We're assuming that the pop ups are because that it is now XP Pro instead of Home. Or could it be something else? Or how can we determine what the issue is in order to correct it? Thanks for any advice on this. jb

    Read the article

  • Windows 7 64bit making users login twice after waking up from sleep

    - by pizzim13
    I have a few Windows 7 clients exhibiting this strange behavior when my users try to login to a domain. For the issue to occur then pc must have been asleep for about an hour or more, then a user will press Alt+Crtl+Del and enter their credentials. Once they try to login the screen will go black for a couple of seconds and then go back to initial screen prompting the user to press Alt+Crtl+Del again. After entering their credentials a second time, the user can login normally and continue to do so until the pc has been asleep for over an hour. Any ideas?

    Read the article

  • XBMC DVB-T and Played Video filling screen

    - by Tubs
    I have a small PC running as an XBMC attached to a Samsung le37m87bd. The PC isn't powerful enough to output a full HD 1080 image at 1920x1080 which is the TVs native resolution (about every 1/2 a second things go extra fast, I assume skipping frames), so I want to reduce this. Annoyingly, the TV does not support any other widescreen resolutions. (720 etc) If I use a a 4:3 image, the TV stretches it to be the 16:9, however, all 16:9 content is stretched sideways as XBMC is sending out a 4:3 image with a 16:9 image inside. Is there anyway I can force XBMC to compensate for this, ie stretch vertically so that black bars are removed, but not stretched horizontally?

    Read the article

  • Is there a way to bridge two outgoing TCP connections in order to bypass firewalls and NAT?

    - by TK Kocheran
    We're all familiar with the problem of port-forwarding and NAT: if you want to expose something to accepting an incoming connection, you need to configure port-forwarding on the router or conjure up some other black magickery to "punch holes" in the firewall using UDP or something. I'm fairly new to the whole "hole-punching" concept so could someone explain how it works? Essentially, I'd like to understand how hole-punching would work and the theory behind it, as well as if two TCP connections could be bridged via a third party. Since there's no issue with outgoing TCP connections since it's handled with NAT, could a third party bridge the connections so that the two parties are still connected but without the bandwidth cost of traffic going through the third party?

    Read the article

  • I/O ports vs case holes

    - by David Oneill
    I'm in the midst of building a new desktop (first time building my own). I bought MSI NF750-G55 AM3 NVIDIA nForce 750a SLI HDMI ATX motherboard, and HEC 6C28BS Black / Silver Steel ATX Mid Tower case. When they both arrived, I realized that the I/O panel on the case doesn't have the same holes that the motherboard needs. So my two questions are: 1) What should I have done? Both claim to be ATX. Do I just need to look more carefully at the pictures? 2) What should I do now? Can I just remove the whole panel (leaving empty spaces between and around the different ports? Specifically, will it cause problems to do this? (I'm looking for advice about question 1, but will accept based on question 2)

    Read the article

  • ADFS 2.0 and WebEx

    - by DavisTasar
    We have a brand new deployment going on, where our University has purchased WebEx MeetingPlace. We have the Cisco CallManager component working, but the integration with Single Sign On with ADFS 2.0 has been nothing short of torture. The biggest problem I'm working with is that we use Split-Brain DNS, and our internal domain name versus external domain name is different. Trying to determine what credentials are getting passed back and forth, certificate errors for using the self-signed certificate, etc. Does anyone have any experience with this, or something similar? Do you have any tips, or watch-out-for-this, etc.? I've not worked with a Federated Authentication system before, and this scenario is very black-box-esque. Sorry, I'm also partially ranting as I'm frustrated.

    Read the article

  • squidGuard hangs during setup

    - by richard
    I have a squid proxy on my Debian-Gnu-Linux-laptop configured to block some web sites. I can set a browser to use this proxy, but I can also configure it to not use it. As I an using it to block some sites. I do not wish and application to be able to bypass the proxy. Is it possible to to configure a fire wall to black outgoing traffic except if sent by the proxy application or user? I would like a simple configurator if possible.

    Read the article

  • TSQL Shred XML - Is this right or is there a better way (newbie @ shredding XML)

    - by drachenstern
    Ok, I'm a C# ASP.NET dev following orders: The orders are to take a given dataset, shred the XML and return columns. I've argued that it's easier to do the shredding on the ASP.NET side where we already have access to things like deserializers, etc, and the entire complex of known types, but no, the boss says "shred it on the server, return a dataset, bind the dataset to the columns of the gridview" so for now, I'm doing what I was told. This is all to head off the folks who will come along and say "bad requirements". Task at hand: Here's my code that works and does what I want it to: DECLARE @table1 AS TABLE ( ProductID VARCHAR(10) , Name VARCHAR(20) , Color VARCHAR(20) , UserEntered VARCHAR(20) , XmlField XML ) INSERT INTO @table1 SELECT '12345','ball','red','john','<sizes><size name="medium"><price>10</price></size><size name="large"><price>20</price></size></sizes>' INSERT INTO @table1 SELECT '12346','ball','blue','adam','<sizes><size name="medium"><price>12</price></size><size name="large"><price>25</price></size></sizes>' INSERT INTO @table1 SELECT '12347','ring','red','john','<sizes><size name="medium"><price>5</price></size><size name="large"><price>8</price></size></sizes>' INSERT INTO @table1 SELECT '12348','ring','blue','adam','<sizes><size name="medium"><price>8</price></size><size name="large"><price>10</price></size></sizes>' INSERT INTO @table1 SELECT '23456','auto','black','ann','<auto><type>car</type><wheels>4</wheels><doors>4</doors><cylinders>3</cylinders></auto>' INSERT INTO @table1 SELECT '23457','auto','black','ann','<auto><type>truck</type><wheels>4</wheels><doors>2</doors><cylinders>8</cylinders></auto><auto><type>car</type><wheels>4</wheels><doors>4</doors><cylinders>6</cylinders></auto>' DECLARE @x XML SELECT @x = ( SELECT ProductID , Name , Color , UserEntered , XmlField.query(' for $vehicle in //auto return <auto type = "{$vehicle/type}" wheels = "{$vehicle/wheels}" doors = "{$vehicle/doors}" cylinders = "{$vehicle/cylinders}" />') FROM @table1 table1 WHERE Name = 'auto' FOR XML AUTO ) SELECT @x SELECT ProductID = T.Item.value('../@ProductID', 'varchar(10)') , Name = T.Item.value('../@Name', 'varchar(20)') , Color = T.Item.value('../@Color', 'varchar(20)') , UserEntered = T.Item.value('../@UserEntered', 'varchar(20)') , VType = T.Item.value('@type' , 'varchar(10)') , Wheels = T.Item.value('@wheels', 'varchar(2)') , Doors = T.Item.value('@doors', 'varchar(2)') , Cylinders = T.Item.value('@cylinders', 'varchar(2)') FROM @x.nodes('//table1/auto') AS T(Item) SELECT @x = ( SELECT ProductID , Name , Color , UserEntered , XmlField.query(' for $object in //sizes/size return <size name = "{$object/@name}" price = "{$object/price}" />') FROM @table1 table1 WHERE Name IN ('ring', 'ball') FOR XML AUTO ) SELECT @x SELECT ProductID = T.Item.value('../@ProductID', 'varchar(10)') , Name = T.Item.value('../@Name', 'varchar(20)') , Color = T.Item.value('../@Color', 'varchar(20)') , UserEntered = T.Item.value('../@UserEntered', 'varchar(20)') , SubName = T.Item.value('@name' , 'varchar(10)') , Price = T.Item.value('@price', 'varchar(2)') FROM @x.nodes('//table1/size') AS T(Item) So for now, I'm trying to figure out if there's a better way to write the code than what I'm doing now... (I have a part 2 I'm about to go key in)

    Read the article

  • Cross Browser Issue

    - by dazedandconfused
    My background is in WinForms programming and I'm trying to branch out a bit. I'm finding cross-browser issues a frustrating barrier in general, but have a specific one that I just can't seem to work through. I want to display an image and place a semi-transparent bar across the top and bottom. This isn't my ultimate goal, of course, but it demonstrates the problem I'm having ina a relatively short code fragment so let's go with it. The sample code below displays as intended in Chrome, Safari, and Firefox. In IE8, the bar at the bottom doesn't appear at all. I've researched it for hours but just can't seem to come up with the solution. I'm sure this is some dumb rookie mistake, but gotta start somewhere. Code snippet... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript" language="javascript"> </script> <style type="text/css"> .workarea { position: relative; border: 1px solid black; background-color: #ccc; overflow: hidden; cursor: move; -moz-user-focus: normal; -moz-user-select: none; unselectable: on; } .semitransparent { filter: alpha(opacity=70); -moz-opacity: 0.7; -khtml-opacity: 0.7; opacity: 0.7; background-color: Gray; } </style> </head> <body style="width: 800px; height: 600px;"> <div id="workArea" class="workarea" style="width: 800px; height: 350px; left: 100px; top: 50px; background-color: White; border: 1px solid black;"> <img alt="" src="images/TestImage.jpg" style="left: 0px; top: 0px; border: none; z-index: 1;" /> <div id="topBar" class="semitransparent" style="position: absolute;width: 800px; height: 75px; left: 0px; top: 0px; min-height: 75px; border: none; z-index: 2;" /> <div id="bottomBar" class="semitransparent" style="position: absolute; width: 800px; height: 75px; left: 0px; top: 275px; min-height: 75px; border: none; z-index: 2;" /> </div> </body> </html>

    Read the article

  • being able to solve google code jam problem sets

    - by JPro
    This is not a homework question, but rather my intention to know if this is what it takes to learn programming. I keep loggin into TopCoder not to actually participate but to get the basic understand of how the problems are solved. But to my knowledge I don't understand what the problem is and how to translate the problem into an algorithm that can solve it. Just now I happen to look at ACM ICPC 2010 World Finals which is being held in china. The teams were given problem sets and one of them is this: Given at most 100 points on a plan with distinct x-coordinates, find the shortest cycle that passes through each point exactly once, goes from the leftmost point always to the right until it reaches the rightmost point, then goes always to the left until it gets back to the leftmost point. Additionally, two points are given such that the the path from left to right contains the first point, and the path from right to left contains the second point. This seems to be a very simple DP: after processing the last k points, and with the first path ending in point a and the second path ending in point b, what is the smallest total length to achieve that? This is O(n^2) states, transitions in O(n). We deal with the two special points by forcing the first path to contain the first one, and the second path contain the second one. Now I have no idea what I am supposed to solve after reading the problem set. and there's an other one from google code jam: Problem In a big, square room there are two point light sources: one is red and the other is green. There are also n circular pillars. Light travels in straight lines and is absorbed by walls and pillars. The pillars therefore cast shadows: they do not let light through. There are places in the room where no light reaches (black), where only one of the two light sources reaches (red or green), and places where both lights reach (yellow). Compute the total area of each of the four colors in the room. Do not include the area of the pillars. Input * One line containing the number of test cases, T. Each test case contains, in order: * One line containing the coordinates x, y of the red light source. * One line containing the coordinates x, y of the green light source. * One line containing the number of pillars n. * n lines describing the pillars. Each contains 3 numbers x, y, r. The pillar is a disk with the center (x, y) and radius r. The room is the square described by 0 = x, y = 100. Pillars, room walls and light sources are all disjoint, they do not overlap or touch. Output For each test case, output: Case #X: black area red area green area yellow area Is it required that people who program should be should be able to solve these type of problems? I would apprecite if anyone can help me interpret the google code jam problem set as I wish to participate in this years Code Jam to see if I can do anthing or not. Thanks.

    Read the article

  • Nvidia Ion HDMI output problems with Acer Revo

    - by Techfeeler
    I bought an Acer Revo. First I connected it to my Sony TV via HDMI output. For a few days it worked very well. Then one day when switching on the computer, it boots and the TV screen turns black and the TV displays the error message "no input signal". I connected the Revo to a Samsung LED TV, and it did the same. What do you guys think the problem is? How do I tackle this issue? Any help is deeply appreciated.

    Read the article

  • MacBook (late 2008) EFI Firmware Update 1.8 Problem

    - by user20832
    Last night I applied EFI Firmware update 1.8 to my Macbook (late 2008). After installing EFI Firmware Update and rebooted my computer and installed SuperDrive Firmware Update 3.0. After that my Macbook rebooted and a black screen is showing with "No bootable device. Please insert bootable device and press any key to continue". I put in one of the bootable installation disck (MAC OS) and it's still stuck on the same screen. I have also tried restarting my macbook manually but no luck. Have anyone experienced that?

    Read the article

  • Background changes by itself and procedure repeats many times until I release the mouse button

    - by Robert
    Dear community, I am a student, and I'm working on a little slots game (if the same random number comes up 3 timed, you win). I use Borland Pascal 7. I use graph to make this a bit more visual, but when I start the game my background turns from black to grey, and the other problem is that if I click the game start button, the game runs many times until I release the mouse button. How can I solve this? Here is my full program: program slots; uses mymouse,graph,crt; var gdriver,gmode,coin:integer; m:mouserec; a,b,c,coins:string; procedure gomb(x1,y1,x2,y2:integer;szoveg:string); var j,n:integer; begin setcolor(blue); rectangle(x1,y1,x2,y2); setfillstyle(1,blue); floodfill(x1+2,y1+2,blue); setcolor(0); outtextxy((x1+x2)div 2 -textwidth(szoveg) div 2 ,(y1+y2) div 2-textheight(szoveg) div 2,szoveg); end; procedure randomal(var a,b,c:string); begin randomize; STR(random(2)+1,a); STR(random(2)+1,b); STR(random(2)+1,c); end; procedure menu; begin; settextstyle(0,0,1); outtextxy(20,10,'Meno menu'); gomb(20,20,90,50,'Teglalap'); gomb(20,60,90,90,'Inditas'); gomb(20,100,90,130,'Harmadik'); gomb(20,140,90,170,'Negyedik'); end; procedure teglalap(x1,x2,y1,y2,tinta:integer); begin setcolor(tinta); rectangle(x1,x2,y1,y2); end; procedure jatek(var a,b,c:string;var coin:integer;coins:string); begin; clrscr; menu; randomal(a,b,c); if ((a=b) AND (b=c)) then coin:=coin+1 else coin:=coin-1; settextstyle(0,0,3); setbkcolor(black); outtextxy(200,20,a); outtextxy(240,20,b); outtextxy(280,20,c); STR(coin,coins); outtextxy(400,400,coins); end; procedure eger; begin; mouseinit; mouseon; menu; repeat getmouse(m); if (m.left) and (m.x20) ANd (m.x<90) and (m.y20) and (m.y<50) then teglalap(90,90,300,300,blue); if (m.left) and (m.x20) AND (m.x<90) and (m.y60) and (m.y<90) then jatek(a,b,c,coin,coins); until ((m.left) and (m.x20) ANd (m.x<140) and (m.y140) and (m.y<170)); end; begin coin:=50; gdriver:=detect; initgraph(gdriver, gmode, ''); eger; end. Thank you very much, Robert

    Read the article

  • Windows Vista stuck on crcdisk.sys

    - by hristo
    Hello everyone, I'm here with some Vista-trouble. After a cigarette-break I returned to my desk to find my PC with a black screen, and after failing to wake it up did a forced restart. I haven't been installing any hardware or software for quite a while. Ever since, Vista gets stuck on the animated 'Microsoft Corporation' progress bar with the animation still running and no hard disk activity. With an F8 and safe-mode + prompt I saw that the boot gets stuck at crcdisk.sys. I'm running Vista64 SP1. What could the problem be? Any advice?

    Read the article

  • Stop taskeng.exe window from popping up

    - by BlaM
    I have several processes scheduled in my Windows 7 environment, mainly for backups, that are supposed to run in the background. However instead of just doing it's work quietly in the background, the task scheduler pops up a black (console like) "taskeng.exe" window. The window goes in front of all other windows. Luckily it doesn't steal my keyboard focus, but it blocks the view on everything. Is there a way to avoid this window - or at least have it appear in the background without stealing my VISUAL focus?

    Read the article

  • Suspended Laptop Cannot Wake Up - Ubuntu

    - by Zack
    I've got an ASUS G73JH, and whenever I suspend it or hibernate it, it will not wake up. The screen stays backlight but is black. I can't: Awaken it with the keyboard Awaken it with the mouse Soft power-off by pressing the power button I have to hold down the power button and shut it down that way, and this seems a little unreasonable. Is there a place I could look for more detail as to what's causing this? Is there a known quick-fix to this issue?

    Read the article

  • Are these components compatible and are there any significant bottlenecks?

    - by Tom Gullen
    I'm trying to buy a new pc, for software dev and a bit of gaming. I already have a 500gb HDD , and a PCI sound card I want to use as well. Is all this stuff compatible, and will it all work together and are there any significant bottlenecks? Case, Mobo and PSU "Primo Motion" AMD 880G DDR3 Ready Barebones (Socket AM3) http://www.overclockers.co.uk/showproduct.php?prodid=FS-268-OK&groupid=43&catid=1817&subcat= SSD 64GB Crucial RealSSD C300 64GB 2.5" SATA 6Gb/s Solid State Hard Drive http://www.overclockers.co.uk/showproduct.php?prodid=HD-007-CR&groupid=1657&catid=1660&subcat=1668 CPU AMD Phenom II X6 Six Core 1090T Black Edition 3.20GHz (Socket AM3) http://www.overclockers.co.uk/showproduct.php?prodid=CP-266-AM&groupid=701&catid=6&subcat=1944 RAM 8GB Corsair Vengeance 8GB (2x4GB) DDR3 PC3-15000C9 1866MHz Dual Channel Kit http://www.overclockers.co.uk/showproduct.php?prodid=MY-292-CS&groupid=701&catid=8&subcat=1387 Graphics XFX ATI Radeon HD 5770 1024MB GDDR5 PCI-Express Graphics Card http://www.overclockers.co.uk/showproduct.php?prodid=GX-149-XF

    Read the article

  • How to select part of a text that exists already in an above cell

    - by pragadheesh
    Hi, In MS Excel, consider i have the word 'Microsoft' in a cell. And in the cell below I want to type the word 'Microhard'. When I start typing Microhard, the word Microsoft appears shaded in black. Now how can I select the part 'Micro' alone from Microsoft and type 'hard' alone. Hope my question is clear. Same question I thought the question should belong to SuperUser so posting it here. Ignore if duplicate.

    Read the article

  • Google Chrome can't play some flash videos

    - by Stoney
    Some flash videos won't play in Chrome, while they play perfectly in other browsers. The player will load, but instead of showing a preview of the video and a play button on the middle of the video, the screen is black: Here's an example of a video that does not work and here is a video on the same site that does work. The video that works is a Youtube video embedded on the site with JW Player, while the nonworking one is probably hosted by the website itself. In both cases it is using Flash. The site is popular and others don't seem to be experiencing this problem. I am running Win7 64bit and I have no ad blockers installed. I have found two common solutions to this problem, neither of which work: Solution #1: Remove all flash application data. Solution #2: Enable and disable Chrome's built in flash and System's flash. Any suggestions?

    Read the article

  • SLI Artifact issues

    - by sloughk
    When I enable SLI I keep getting artifacts in random games and in Windows Aero sometimes . It doesn't seem to be about over-heating as it happens randomly, and sometimes whole computers just crashes (not blue-screen, just black gone...) My setup: Geforce 8800 GTS 320MB ( http://www.bfgtech.com/bfgr88512gtoce.aspx ) x 2 GIGABYTE EX58-UD4 Windows 7 RC PSU 800W I've got the latest NVIDIA drivers and F5 BIOS update (*SLI update*). When I disable SLI and use the cards separately they are working just fine even in games. Any idea why this might happen?

    Read the article

  • how to run this qt script? (newbie question)

    - by GB_J
    I have a qt script(barchart.qs) that creates a graph for me. I don't know how i can incorporate(ie show the graph) in my qt mainwindow. Can some one please help me look at the code and what its outputs are? I tried engine.evaluate, but i do not know what is the QScriptValue i'm getting in return. Thanks sooo much. This is the script: BarChart.prototype = new QWidget; BarChart.prototype.suffix = ""; function BarChart(parent) { QWidget.call(this, parent); } // find the maximum value and widest (pixel-wise) label and suffix BarChart.prototype.showEvent = function(event) { var fm = new QFontMetrics(this); this.margin = 20; this.titleHeight = fm.height(); this.barHeight = 1.5 * fm.height(); this.barSpacing = 0.6 * fm.height(); this.maxValue = this.suffixWidth = this.labelWidth = 0; var count = 0; for (d in this.data) { this.labelWidth = Math.max(this.labelWidth, fm.width(d)); this.maxValue = Math.max(this.maxValue, this.data[d]); this.suffixWidth = Math.max(this.suffixWidth, fm.width(String(this.data[d]) + " " + this.suffix)); count++; } this.startHue = 15; this.hueDelta = 360 / count; this.size = new QSize(640, this.titleHeight + 2 * this.margin + (this.barHeight + this.barSpacing) * count); } BarChart.prototype.paintEvent = function(event) { var p = new QPainter; p.begin(this); // background and title p.fillRect(this.rect, new QBrush(new QColor(255, 255, 255))); p.drawText(0, 0, this.width, this.margin + this.titleHeight, Qt.AlignCenter, this.windowTitle, 0); var ofs = this.labelWidth + this.margin; var ww = this.width - this.suffixWidth - ofs - 2 * this.margin; var hue = this.startHue; var y = 0; p.translate(this.margin, this.titleHeight + 1.5 * this.margin); for (d in this.data) { // label on the left side p.setPen(new QColor(Qt.black)); p.drawText(0, y, this.labelWidth, this.barHeight, Qt.AlignVCenter + Qt.AlignRight, d, 0); // the colored bar var gradient = new QLinearGradient(new QPoint(ofs, y), new QPoint(ofs, y + this.barHeight)); gradient.setColorAt(0, QColor.fromHsv(hue, 255, 240)); gradient.setColorAt(1, QColor.fromHsv(hue, 255, 92)); p.setBrush(new QBrush(gradient)); p.setPen(new QColor(96, 96, 96)); var bw = this.data[d] * ww / this.maxValue; p.drawRect(ofs, y, bw, this.barHeight); // extra text at the end of the bar var text = new String(this.data[d] + " " + this.suffix); p.setPen(new QColor(Qt.black)); p.drawText(ofs + bw + this.margin/2, y, this.suffixWidth, this.barHeight, Qt.AlignVCenter + Qt.AlignLeft, text, 0); // for the next bar y += (this.barHeight + this.barSpacing); hue += this.hueDelta; if (hue >= 360) hue -= 360; } p.end(); } BarChart.prototype.wheelEvent = function(event) { this.startHue += event.delta() / 8 / 5; if (this.startHue = 360) this.startHue -= 360; if (this.startHue < 0) this.startHue += 360; this.update(); event.ignore(); } BarChart.prototype.mousePressEvent = function(event) { var fname = QFileDialog.getSaveFileName(this, "Save", ".", "*.png", 0, 0); if (fname.length > 0) { var img = new QImage(this.size, QImage.Format_ARGB32_Premultiplied); this.render(img); img.save(new QFile(fname)); } } var chart = new BarChart; chart.windowTitle = "Monthly"; chart.suffix = "reports"; chart.data = { "September" : 45, "October" : 60, "November" : 56, "December" : 0 }; chart.show(); QCoreApplication.exec();

    Read the article

< Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >