Search Results

Search found 397 results on 16 pages for 'marcus pink'.

Page 12/16 | < Previous Page | 8 9 10 11 12 13 14 15 16  | Next Page >

  • vimdiff: Jump to next difference inside line?

    - by sleske
    vimdiff is very handy for comparing files. However, I often use it on files with long lines and relatively few differences inside the lines. vimdiff will correctly highlight differences inside a line (whole line pink, differing characters red). In these cases, it would be nice to be able to jump to the next difference inside the line. You can jump to the "next difference" (]c), but this will jump to the next line with a difference. Is there a way to go to the next different character inside the current line?

    Read the article

  • SQLBeat Podcast – Episode 5 – Kevin Kline Talks With Me About SQL, Professional Development and Book Writin’

    - by SQLBeat
    I thought I would be a ball of intimated nerves when Kevin gladly agreed to speak with me on the podcast this past weekend.  After all, he is Kevin Kline of SQL in a Nutshell fame! As it turned out,  we had a comfortable and enlightening conversation on Apple MacBooks (is that what they are called?), our beginnings in the indistry, the Deep South, health care intiatives and 286′s. I almost pulled the plug when Kevin started down the Oracle path though, and for a moment he looked at me as if I was serious. As always on this podcast, it is all in good fun. The picture is of Kevin and I ( my shirt is mauve not pink by the way) at the after party for SQL Saturday 151 in Orlando, FL where he also did a Pre-Con to a sold out crowd of enthusiastic DBAs. I know they were enthusiastic even though I was not there because one of the attendees was a friend of mine who went on and on and on about the content, kind of like I am doing here.  So I will just stop that and let you proceed to listen. As always, I hope you enjoy and any feedback on this or future episodes is always welcome. Download the MP3

    Read the article

  • How to set acpi=off for installation?

    - by Johan Helgø
    I'm trying to install Ubuntu 12.04 LTS 64bit from a USB created in Windows using the recommended software from pendrivelinux. The USB is tested on two laptops and works fine. The install does not work on my desktop PC, it either hangs with lots of text on the screen, or it just gives me a screen with garbled colors. Right now it hangs on "[3.925311] Initializing USB Mass Storage driver...", but it hangs on different spots every time I try. I know that acpi=off will fix this. On older versions, there used to be a pink screen with the icon of a keyboard, at that screen I could press ESC, and I would then get a long list of languages, I could choose English, and then I would get options for setting acpi=off, then install without any problems. This new install menu does not have those options. The (now black and white) "Installer boot menu"'s advanced options is blank. There simply are no advanced options. If I go to help, then press F6, I get to a help screen describing the different boot parameters. I see examples of writing "Install acpi=off" However, writing "install acpi=off" it gives an error saying "could not find kernel image: install". How can I install Ubuntu 12.04 with acpi=off? (Oh, btw, nothing happens if I press F6 in the "Installer boot menu")

    Read the article

  • Bizarre image loading problem from apache2

    - by NateDSaint
    Users have complained a few times about seeing a bizarre set of pink or green stripes on our webpage. At first I thought there were a rash of video card outages, but then someone sent me a screenshot from their browser (IE8). I later saw the same thing, but with slightly different colors on Chrome. Users have experienced this on their iPads and iPhones (iOS Safari). Because I've optimized the site to cache images, the bad image stays around until you clear your cache, so once you do, it resolves itself. My assumption is that the transmission of the image is being cut off mid-stream and then staying that way, but I can't for the life of me figure out why. Here's what I've checked: Header length is being sent, and transmission looks okay (wget sample below): wget http://www.superiorlivestock.com/templates/sla2/images/wallbg2.jpg --2012-04-05 08:46:00-- http://www.superiorlivestock.com/templates/sla2/images/wallbg2.jpg Resolving www.superiorlivestock.com (www.superiorlivestock.com)... [ip redacted] Connecting to www.superiorlivestock.com (www.superiorlivestock.com)|[ip redacted]|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 45926 (45K) [image/jpeg] Saving to: `wallbg2.jpg' Images are not being served gzipped (apache conf below): SetOutputFilter DEFLATE SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary The site is www.superiorlivestock.com, and here's a sample of the bad page load: Is there something obvious I'm missing? Am I saving my images in the wrong format somehow?

    Read the article

  • What could cause a pixel shader to paint outside the lines of the vertex shader output?

    - by Rei Miyasaka
    From what I understand, the pixels that a pixel shader operates on are specified implicitly by the SV_POSITION output (in DirectX) of the vertex shader. What then could cause a pixel shader to render in the middle of nowhere? I used the new Visual Studio 2012 graphics debugger to visualize my vertex and pixel shader output. This is the output from a DrawIndexed() call that draws a cube: The pink part is the rendered output of the pixel shader, which takes the cube on its left as its input. The vertex shader code: cbuffer Buf { float4x4 final; }; struct In { float4 pos:POSITION; float3 norm:NORMAL; float2 texuv:TEXCOORD; }; struct Out { float4 col:COLOR; float2 tex:TEXCOORD; float4 pos:SV_POSITION; }; Out main(In input) { Out output; output.pos = mul(input.pos, final); output.col = float4(1.0f, 0.5f, 0.5f, 1.0f); output.tex = input.texuv; return output; } And the pixel shader: struct In { float4 col:COLOR; float2 tex:TEXCOORD; float4 pos:SV_POSITION; }; float4 main(In input) : SV_TARGET { return input.col; } The raster stage is the only thing between the vertex shader and the pixel shader, so my suspicion is that it's some raster stage settings. But the raster stage shouldn't change the shape of the vertex shader output so drastically, should it?

    Read the article

  • Upgrade from 11.04 to 12.04 failed - unable to login

    - by Tobias M.
    Yesterday i updgraded from 10.04 to 12.04 via the update-manager. At the end it said "Failed to upgrade due to too many errors". Before that i got a lot of error messages that said packages could ne configured - they were all related to mono. Then it force me to restart. When booting now, I see the pink screen (without logo). After that it turns black and the cursor appears. Then its falshing around between beeing bright and dark and showing the cursor and not showing it. But no way i see the login-screen. At the moment i am not able to boot frm usb since my usb device is too large to be formated to FAT-32 (8GB). This all is happening on this machine: AMD E-350 Processor (2x1,65Ghz) 4GB DDR3 RAM 320GB SATA II Hard drive AMD® Radeon™ HD 6320 Thanks in advance to everyone who trys helping me ;) I have to continue working with data from this machine so i´d be pleased to get my data accessible. Greets ;)

    Read the article

  • Mobile and Social for Retail

    - by David Dorf
    I've got two speaking gigs in the next few weeks, so I thought I'd preview both here. First I'll be at eTail West on February 24th to talk about mobile. I'll be previewing a new study of how shoppers are using mobile phones. Here's a sneak peek at one of the slides: It should be no surprise that as more consumers adopt smartphones, more are finding ways to use them to help with shopping. Sometimes that's to find a store, download a coupon, or do price comparisons. I'll also be discussing the NRF Mobile Blueprint, and will walk through an example of mobile impacting the in-store experience. Retailers need to look upon mobile as the method of bringing the digital assets of e-commerce into the aisles to enhance shopping. On March 9th I'll be at NRF Innovate co-presenting with Jon Kubo of Wet Seal on social strategies. Jon is a retail innovation rock-star and I always learn something new from every conversation with him. Below is a another slide preview: I cheated a little on the top 10 most popular retailer pages by not including Victoria's Secret Pink. VC is already represented, so I didn't include them a second time. The most interesting statistic I found was that the average user spends 55 minutes on Facebook a day. Wow! I also decided to use the old "Like" and "Fan" icons just because I like them better (pun intended). Wet Seal has been collecting interesting statistics on liked products, so I hope Jon will share lots (I'm on a roll). Hope to see you at both events.

    Read the article

  • How to provide value?

    - by Francisco Garcia
    Before I became a consultant all I cared about was becoming a highly skilled programmer. Now I believe that what my clients need is not a great hacker, coder, architect... or whatever. I am more and more convinced every day that there is something of greater value. Everywhere I go I discover practices where I used to roll my eyes in despair. I saw the software industry with pink glasses and laughed or cried at them depending on my mood. I was so convinced everything could be done better. Now I believe that what my clients desperately need is finding a balance between good engineering practices and desperate project execution. Although a great design can make a project cheap to maintain thought many years, usually it is more important to produce quick fast and cheap, just to see if the project can succeed. Before that, it does not really matters that much if the design is cheap to maintain, after that, it might be too late to improve things. They need people who get involved, who do some clandestine improvements into the project without their manager approval/consent/knowledge... because they are never given time for some tasks we all know are important. Not all good things can be done, some of them must come out of freewill, and some of them must be discussed in order to educate colleagues, managers, clients and ourselves. Now my big question is. What exactly are the skills and practices aside from great coding that can provide real value to the economical success of software projects? (and not the software architecture alone)

    Read the article

  • A* Start path finding in HTML5 Canvas

    - by gyhgowvi
    I'm trying implement A* Start path finding in my games(which are written with JavaScript, HTML5 Canvas). Library for A* Start found this - http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html and now I'm using this library for path finding. And with this library, I'm trying write a simple test, but stuck with one problem. I'm now done when in HTML5 canvas screen click with mouse show path until my mouse.x and mouse.y. Here is a screenshot - http://oi46.tinypic.com/14qxrl.jpg (Pink square: Player, Orange squares: path until my mouse.x/mouse.y) Code how I'm drawing the orange squares until my mouse.x/mouse.y is: 'http://pastebin.com/bfq74ybc (Sorry I do not understand how upload code in my post) My problem is I do not understand how to move my player until path goal. I've tried: 'http://pastebin.com/nVW3mhUM But with this code my player is not beung drawn.(When I run the code, player.x and player.y are equals to 0 and when I click with the mouse I get the path player blink and disappear) Maybe anyone know how to solve this problem? And I'm very very very sorry for my bad English language. :)

    Read the article

  • MonoGame not all letters being drawn with DrawString

    - by Lex Webb
    I'm currently making a dynamic user interface for my game and are setting up having text on my buttons. I'm having an odd issue where, when i use a specific piece of code to determine the text position, it will not render all of the text passed to DrawString. Even weirder, is if i insert another DrawString after this, drawing more text at a different place, different parts of the text will be drawn. The code for drawing my button with the text attached is: public override void Draw(SpriteBatch sb, GameTime gt) { sb.Draw(currentImage, GetRelativeRectangle(), Color.White); sb.DrawString(font, text, new Vector2(this.GetRelativeDrawOffset().X + this.Width / 2 - font.MeasureString(text).X / 2, this.GetRelativeDrawOffset().Y + this.Height / 2 - font.MeasureString(text).Y / 2), textColor); } The methods in the creation of the Vector2 simply get the draw position of the button. I'm then doing some calculation to center the text. This produces this when the text is set to 'Test': And when i enter this piece of code below the first DrawString: sb.DrawString(font, "test", new Vector2(500, 50), Color.Pink); I should mention that that grey square is being drawn in the same spritebatch, before the button and the text. Any ideas as to what could be causing this? I have a feeling it may be due to draw order, but i have no idea how to control that.

    Read the article

  • Black screen with thinkpad edge e525, AMD radeon HD before and after installation, plymouth?

    - by carolien
    I have a new thinkpad edge e525 (which should work) and wanted to try ubuntu (first linux experience). With the ubuntu desktop-cd I had a blackscreen before installation, I could fix that with nomodeset. After the installation, when rebooting I got the black screen again. First I see some ubuntu colour with a green busted stripe. I have the same problem with the live boot, also tried mint live, the stripe gets pink. I installed xubuntu 64bit from an alternate cd and I didnt have problems until de reboot after the installation. Same problem, just a black screen with the green stripe than blackscreen. I tried several things: adding nomodeset to the bootmenu, but than I get: No connection to plymouth and it is stuck at checking the battery status. I tried to replace quiet splash with text. Didnt work either. actually one time I saw a blue booting image before that. I managed to get a root command though via the recovery boot. I didnt dare to just remove the plymouth package. Can I just delete plymouth or do I have to deinstall it as described in several ways. (Problem is, right now the notebook doesnt have a internet connection. And I dont know how to manage it with a usb stick?) Or do I have to install the AMD catalyst driver manually? (Again, how can I do that with an usb stick) I also tried this: Ubuntu hits a black screen after boot. Is there any solution without internet? And if I need internet which is the right one? Please explain step by step what I have to write and so on! Thank you! also tried: set gfxpayload=text and: just remove splash and adding vesafb.nonsense=1 to the grub editor, because I couldnt find it anywhere

    Read the article

  • ugg slippers makes you feel balmy and comfy

    - by skhtyu skhtyu
    You accept to apperceive admitting that while cheap ugg boots is accepted for winter wear, it can in achievement be beat in every season. These uggs for kids usually are an Aussie acceptation complete from merino affidavit and are aswell asperous calm with fashionable. There are hip calm with adequate jackets, vests, sweatshirts, added more. For a contemporary ensemble that makes you feel balmy and comfy, try cutting your boots with some leggings or a sweater dress with a capote or bandage befuddled on. If you don't own a Bout of pink uggs even, now may be the adequate time to buy yourself one. They arise in checkered by azure to orange, to amber as able-bodied as the always-reliable black. as able-bodied as in the break you admiration to go for any decidedly added indigenous arise accession them up nation achievement architecture arise as noticed about the catwalks of purple uggs and Badgley Mischka. With this, you could already see which website is alms the ugg outlet online that you accept been absent at a amount that you can afford. The advanced throated ones are simple to blooper in and out which makes them admired a allotment of all women. uggs for sale were aboriginal fabricated in Australia. Aswell there are clear abode characterization rolls in which characterization fonts, sizes and chantry colours can be customized.

    Read the article

  • you will see the ugg boots outlet of type, color, size

    - by skhtyu skhtyu
    These humans taken the apple through hurricane. Lots added humans accompany in their friends' traces to use these affidavit footwear, they are fabricated from top-grade Foreign merino uggs for cheap. Amazing abundance and aswell amore tend to be assured aloft accustomed materials.bailey button uggs which are at aboriginal acclimated by Australian accept set off a abnormality all over the apple these days. plenty of celebrities are usually spotted putting them on purple uggs this aswell allures abounding individuals to get. For those who alarm for to access due to the fact, go to internet vendors & they can accepting superior twos awash with affordable prices adapted now there.When researching arrangement pink uggs through web food or arrangement sites, ensure to see their own go aback and aswell acquittance procedures afore you achieve your choice. So as you will see the advantage of type, color, admeasurement as able-bodied as absolute acclimated seems to be amaranthine and now application the accession of the uggs cheap and a clog up adaptation you're a lot added ashore for choice. So no amount what, the absolute "in" affair for your chiffonier this advancing year is in achievement affected ugg classic short for ladies, and you're artlessly abiding to acquisition a brace that's aural your budget.

    Read the article

  • HDA NVidia (GT520) - Sound Issue

    - by Oliver Lucas
    I have an GT520 graphics card and I am trying to get the sound working with my XBMC setup and I'm having trouble. Things I have completed: aplay -l List of PLAYBACK Hardware Devices card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 then lspci 01:00.1 Audio device: nVidia Corporation HDMI Audio stub (rev a1) and alsamixer which is set to unmuted Everything looks well, so ran: aplay -D hw:0,3 /home/ollie/Music/alex.mp3 Playing raw data '/home/ollie/Music/alex.mp3' : Unsigned 8 bit, Rate 8000 Hz, Mono aplay: set_params:1059: Sample format non available Available formats: - S16_LE - S32_LE with no luck.. then speaker-test Playback device is default Stream parameters are 48000Hz, S16_LE, 1 channels Using 16 octaves of pink noise Playback open error: -2,No such file or directory also tried running through ftp://download.nvidia.com/XFree86/gpu-hdmi-audio-document/gpu-hdmi-audio.html#upgrading_alsa_driver and http://wiki.xbmc.org/index.php?title=HOW-TO:Setup_audio_over_HDMI_on_nVidia_GeForce/nForce_controller plus 20 other websites with selective "fixes" etc.. but no luck _< I am a complete beginner with Ubuntu so this is a really steep learning curve for me, not sure I'm learning much though as its all just headaches atm! Thanks for any help Ollie

    Read the article

  • Unable to log in due to freeze, occasional error message

    - by Xianlin Xiong
    I'm new to Ubuntu. And I have some problems now. I downloaded Ubuntu 11.10 and burned it onto a CD. Then I load it in my conputer, it's easy. But when I finished those and restarted the computer, the problem comes: After I choose to log in the Ubuntu system,the screen stays in pink, and it can't jump into (about 30 min), and then I have no choices but to press Ctrl+Alt+Del to reboot. Another time I choose Ubuntu to log in, it shows on the screen that "BusyBox v1.18.4 ...... built-in shell ...... initramfs". However the Live CD works very well. What’s more, there is a Windows 7 partition on the hard drive. (Windows 7 is also okay.) But I leave more than 20GB on the hard drive to Ubuntu. When I installed Ubuntu, I only made two partitions (swap and /). I don’t know where the problems happened and how to deal with them. And I hope someone can help me out with the troubles.

    Read the article

  • What's wrong with this jQuery? It isn't working as intended

    - by Doug Smith
    Using cookies, I want it to remember the colour layout of the page. (So, if they set the gallery one color and the body background another color, it will save that on refresh. But it doesn't seem to be working. jQuery: $(document).ready(function() { if (verifier == 1) { $('body').css('background', $.cookie('test_cookie')); } if (verifier == 2) { $('#gallery').css('background', $.cookie('test_cookie')); } if (verifier == 3) { $('body').css('background', $.cookie('test_cookie')); $('#gallery').css('background', $.cookie('test_cookie')); } $('#set_cookie').click(function() { var color = $('#set_cookie').val(); $.cookie('test_cookie', color); }); $('#set_page').click(function() { $('body').css('background', $.cookie('test_cookie')); var verifier = 1; }); $('#set_gallery').click(function() { $('#gallery').css('background', $.cookie('test_cookie')); var verifier = 2; }); $('#set_both').click(function() { $('body').css('background', $.cookie('test_cookie')); $('#gallery').css('background', $.cookie('test_cookie')); var verifier = 3; }); }); HTML: <p>Please select a background color for either the page's background, the gallery's background, or both.</p> <select id="set_cookie"> <option value="#1d375a" selected="selected">Default</option> <option value="black">Black</option> <option value="blue">Blue</option> <option value="brown">Brown</option> <option value="darkblue">Dark Blue</option> <option value="darkgreen">Dark Green</option> <option value="darkred">Dark Red</option> <option value="fuchsia">Fuchsia</option> <option value="green">Green</option> <option value="grey">Grey</option> <option value="#d3d3d3">Light Grey</option> <option value="#32cd32">Lime Green</option> <option value="#f8b040">Macaroni</option> <option value="#ff7300">Orange</option> <option value="pink">Pink</option> <option value="purple">Purple</option> <option value="red">Red</option> <option value="#0fcce0">Turquoise</option> <option value="white">White</option> <option value="yellow">Yellow</option> </select> <input type="button" id="set_page" value="Page's Background" /><input type="button" id="set_gallery" value="Gallery's Background" /><input type="button" id="set_both" value="Both" /> </div> </div> </body> </html> Thanks so much for the help, I appreciate it. jsFiddle: http://jsfiddle.net/hL6Ye/

    Read the article

  • Creative, busy Devoxx week

    - by JavaCecilia
    I got back from my first visit to the developer conference Devoxx in Antwerp. I can't describe the vibes of the conference, it was a developer amusement park, hackergartens, fact sessions, comic relief provided by Java Posse, James Bond and endless hallway discussions.All and all - I had a lot of fun, my main mission was to talk about Oracle's main focus for OpenJDK which besides development and bug fixing is making sure the infrastructure is working out for the full community. My focus was not to hang out at night club the Noxx, but that was came included in the package :)The London Java community leaders Ben Evans and Martijn Verburg are leading discussions in the community to lay out the necessary requirements for the infrastructure for build and test in the open. They called a first meeting at JavaOne gathering 25 people, including people from RedHat, IBM and Oracle. The second meeting at Devoxx included 14 participants and had representatives from Oracle and IBM. I hope we really can find a way to collaborate on this, making sure we deliver an efficient infrastructure for all engineers to contribute to OpenJDK with.My home in all of this was the BOF rooms and the sessions there meeting the JUG leaders, talking about OpenJDK infrastructure and celebrating the Duchess Duke Award together with the others. The restaurants in the area was slower than I've ever seen, so I missed out on Trisha Gee's brilliant replay of the workshop "The Problem with Women in IT - an Agile Approach" where she masterly leads the audience (a packed room, 50-50 gender distribution) to solve the problem of including more diversity in the developer community. A tough and sometimes sensitive topic where she manages to keep the discussion objective with a focus of improving the matter from a business perspective. Mattias Karlsson is organizing the Java developer conference Jfokus in Stockholm and was there talking to Andres Almires planning a Hackergarten with a possible inclusion of an OpenJDK bugathon. That would be really cool, especially as the Oracle Stockholm Java development office is just across the water from the Jfokus venue, some of the local JVM engineers will likely attend and assist, even though the bug smashing theme will likely be more starter level build warnings in Swing or langtools than fixing JVM bugs.I was really happy that I managed to catch a seat for the Java Posse live podcast "the Third Presidential Debate" a lot of nerd humor, a lot of beer, a lot of fun :) The new member Chet had a perfect dead pan delivery and now I just have to listen more to the podcasts! Can't get the most perfect joke out of my head, talking about beer "As my father always said: Better a bottle in front of me than a frontal lobotomy" - hilarious :)I attended the sessions delivered by my Stockholm office colleagues Marcus Lagergren (on dynamic languages on the jvm, JavaScript in particular) and Joel Borggrén-Franck (Annotations) and was happy to see the packed room and all the questions raised at the end.There's loads of stuff to write about the event, but just have to pace myself for now. It was a fantastic event, captain Stephan Janssen with crew should be really proud to provide this forum to the developer community!

    Read the article

  • Welcome To The Nashorn Blog

    - by Homma
    ??? ??? jlaskey ??? Nashorn Blog ????????????? https://blogs.oracle.com/nashorn/entry/welcome_to_the_nashorn_blog ???????? ?? ??????????????Nashorn ????????????????????????????????????????????????????????????????????????????? Nashorn ?????????????????????????????????????????????????????? ????? JavaOne ??????????Nashorn ???????????????????????????????? Georges Saab ????????????????????????????????????????????????????????????????? JavaOne ????????????????????????????????? ?Nashorn: JVM ??? JavaScript ????????????? ?????????(????????)??????????????????????????????????????????????????JVM ???????????????????????????????????????????????????????????????? ?Nashorn: JVM ?? JavaScript? ??? Nashorn ???????????????????????????????????????????????????Nashorn ???????????????????????????250 ??????????????????????????Twitter ? Sam Pullara ??? Mustache.js ???????(Rhino ? 20 ?????)???????????NetBeans ? John Ceccarelli ??? Nashorn ? Netbeans ??????????????????????????????? Q & A ???????????????? ?Nashorn JavaScript Team ???? Michel ? Attila ? Marcus ??? Q & A ??????????????(??????????????????????????)?????????? Node.jar ??????????Nashorn + Node.jar ???????????????????????????????? Node.jar ? Akhil ??????????????????? ?Nashorn ? Node ? Java Persistence? Doug Clarke ? Akhil ?????????????????(????????? ???????)?????? Q & A ??????????? 80 ??????? ?????? Node.jar ????????Doug ? Nashorn + JPA ??????? ?????????????Nashorn ????????????????? ????????????????? : Nashorn ? Java ???????? Attila ??????? Dynalink ? Nashorn ??????????????????????????????????????????????????????JVM ???????????????????????????????????? ????JavaOne ?? Java ??????????? JVM ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????? Nashorn ???? how to ?????????????????????????????????????????????? ??????????!

    Read the article

  • root issues in softwarecenter, synaptic and update manager

    - by user188977
    i have a notebook samsung ativ 2 and ubuntu 12.04 precise, cinnamon desktop. after logging in today my update manager, synaptic and ubuntu softwarecenter stopped working. synaptic i can only launch from terminal the others from panel.when choosing to update, nothing happens. same thing when trying to install programms from syn. or softw.center.when launching softwarec. from terminal i get: marcus@ddddddddd:~$ software-center 2013-11-10 22:30:46,206 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None' 2013-11-10 22:30:46,217 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True (software-center:4772): Gtk-WARNING **: Theme parsing error: softwarecenter.css:34:20: Not using units is deprecated. Assuming 'px'. (software-center:4772): Gtk-WARNING **: Theme parsing error: softwarecenter.css:34:22: Not using units is deprecated. Assuming 'px'. (software-center:4772): Gtk-WARNING **: Theme parsing error: softwarecenter.css:56:20: Not using units is deprecated. Assuming 'px'. (software-center:4772): Gtk-WARNING **: Theme parsing error: softwarecenter.css:56:22: Not using units is deprecated. Assuming 'px'. (software-center:4772): Gtk-WARNING **: Theme parsing error: softwarecenter.css:60:20: Not using units is deprecated. Assuming 'px'. (software-center:4772): Gtk-WARNING **: Theme parsing error: softwarecenter.css:60:22: Not using units is deprecated. Assuming 'px'. 2013-11-10 22:30:46,977 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file 2013-11-10 22:30:47,320 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None. 2013-11-10 22:30:48,057 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open() 2013-11-10 22:31:00,646 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/share/software-center/softwarecenter/utils.py', 201, 'get_title_from_html')' 2013-11-10 22:31:00,645 - root - WARNING - failed to parse: '<div style="background-color: #161513; width:1680px; height:200px;">  <div style="background: url('/site_media/exhibits/2013/09/AAMFP_Leaderboard_700x200_1.jpg') top left no-repeat; width:700px; height:200px;"></div> </div>' ('ascii' codec can't encode character u'\xa0' in position 70: ordinal not in range(128)) 2013-11-10 22:31:02,268 - softwarecenter.db.update - INFO - skipping region restricted app: 'Comentarios Web' (not whitelisted) 2013-11-10 22:31:02,769 - softwarecenter.db.update - INFO - skipping region restricted app: 'reEarCandy' (not whitelisted) 2013-11-10 22:31:04,821 - softwarecenter.db.update - INFO - skipping region restricted app: 'Flaggame' (not whitelisted) 2013-11-10 22:31:05,622 - softwarecenter.db.update - INFO - skipping region restricted app: 'Bulleti d'esquerra de Calonge i Sant Antoni ' (not whitelisted) 2013-11-10 22:31:08,352 - softwarecenter.ui.gtk3.app - INFO - software-center-agent finished with status 0 2013-11-10 22:31:08,353 - softwarecenter.db.database - INFO - reopen() database 2013-11-10 22:31:08,353 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True 2013-11-10 22:33:32,319 - softwarecenter.backend - WARNING - _on_trans_error: org.freedesktop.PolicyKit.Error.Failed: ('system-bus-name', {'name': ':1.72'}): org.debian.apt.install-or-remove-packages 2013-11-10 22:36:01,818 - softwarecenter.backend - WARNING - daemon dies, ignoring: <AptTransaction object at 0x48e4b40 (aptdaemon+client+AptTransaction at 0x645aaa0)> exit-failed 2013-11-10 22:36:01,820 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open()

    Read the article

  • Issue with my wordpress functions.php script

    - by iMayne
    Hello peeps. Im having an issues when activating my theme in wordpress. I got this error message: "Parse error: syntax error, unexpected $end in C:\xampp\htdocs\xampp\wordpress\wp-content\themes\xit\functions.php on line 223". Whats wrong, I totally dont understand. The script of the php is: <?php if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h2>', 'after_title' => '</h2>', )); function content($num) { $theContent = get_the_content(); $output = preg_replace('/<img[^>]+./','', $theContent); $limit = $num+1; $content = explode(' ', $output, $limit); array_pop($content); $content = implode(" ",$content)."..."; echo $content; } function post_is_in_descendant_category( $cats, $_post = null ) { foreach ( (array) $cats as $cat ) { // get_term_children() accepts integer ID only $descendants = get_term_children( (int) $cat, 'category'); if ( $descendants && in_category( $descendants, $_post ) ) return true; } return false; } //custom comments function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <div class="comment-meta commentmetadata"> <?php echo get_avatar($comment,$size='32',$default='http://www.gravatar.com/avatar/61a58ec1c1fba116f8424035089b7c71?s=32&d=&r=G' ); ?> <?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?> <br /><?php printf(__('<strong>%s</strong> says:'), get_comment_author_link()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?></div> </div> <?php if ($comment->comment_approved == '0') : ?> <em><?php _e('Your comment is awaiting moderation.') ?></em> <br /> <?php endif; ?> <div class="text"><?php comment_text() ?></div> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div> </div> <?php } add_action('admin_menu', 'xit_theme_page'); function xit_theme_page () { if ( count($_POST) > 0 && isset($_POST['xit_settings']) ) { $options = array ( 'style','logo_img','logo_alt','logo_txt', 'logo_tagline', 'tagline_width', 'contact_email','ads', 'advertise_page', 'twitter_link', 'facebook_link', 'flickr', 'about_tit', 'about_txt', 'analytics'); foreach ( $options as $opt ) { delete_option ( 'xit_'.$opt, $_POST[$opt] ); add_option ( 'xit_'.$opt, $_POST[$opt] ); } } add_theme_page(__('Xit Options'), __('Xit Options'), 'edit_themes', basename(__FILE__), 'xit_settings'); } function xit_settings () {?> <div class="wrap"> <h2>XIT Options Panel</h2> <form method="post" action=""> <table class="form-table"> <!-- General settings --> <tr> <th colspan="2"><strong>General Settings</strong></th> </tr> <tr valign="top"> <th scope="row"><label for="style">Theme Color Scheme</label></th> <td> <select name="style" id="style"> <option value="pink.css" <?php if(get_option('xit_style') == 'pink.css'){?>selected="selected"<?php }?>>pink.css</option> <option value="blue.css" <?php if(get_option('xit_style') == 'blue.css'){?>selected="selected"<?php }?>>blue.css</option> <option value="orange.css" <?php if(get_option('xit_style') == 'orange.css'){?>selected="selected"<?php }?>>orange.css</option> </select> </td> </tr> <tr valign="top"> <th scope="row"><label for="logo_img">Logo image (full path to image)</label></th> <td> <input name="logo_img" type="text" id="logo_img" value="<?php echo get_option('xit_logo_img'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="logo_alt">Logo image ALT text</label></th> <td> <input name="logo_alt" type="text" id="logo_alt" value="<?php echo get_option('xit_logo_alt'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="logo_txt">Text logo</label></th> <td> <input name="logo_txt" type="text" id="logo_txt" value="<?php echo get_option('xit_logo_txt'); ?>" class="regular-text" /> <br /><em>Leave this empty if you entered an image as logo</em> </td> </tr> <tr valign="top"> <th scope="row"><label for="logo_tagline">Logo Tag Line</label></th> <td> <input name="logo_tagline" type="text" id="logo_tagline" value="<?php echo get_option('xit_logo_tagline'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="tagline_width">Tag Line Box Width (px)</label><br /><em style="font-size:11px">Default width: 300px</em></th> <td> <input name="tagline_width" type="text" id="tagline_width" value="<?php echo get_option('xit_tagline_width'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="contact_email">Email Address for Contact Form</label></th> <td> <input name="contact_email" type="text" id="contact_email" value="<?php echo get_option('xit_contact_email'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="twitter_link">Twitter link</label></th> <td> <input name="twitter_link" type="text" id="twitter_link" value="<?php echo get_option('xit_twitter_link'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="facebook_link">Facebook link</label></th> <td> <input name="facebook_link" type="text" id="facebook_link" value="<?php echo get_option('xit_facebook_link'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="flickr">Flickr Photostream</label></th> <td> <select name="flickr" id="flickr"> <option value="yes" <?php if(get_option('xit_flickr') == 'yes'){?>selected="selected"<?php }?>>Yes</option> <option value="no" <?php if(get_option('xit_flickr') == 'no'){?>selected="selected"<?php }?>>No</option> </select> <br /><em>Make sure you have FlickrRSS plugin activated if you choose to enable Flickr Photostream</em> </td> </tr> <!-- Sidebar ABout Box--> <tr> <th colspan="2"><strong>Sidebar About Box</strong></th> </tr> <tr valign="top"> <th scope="row"><label for="about_tit">Title</label></th> <td> <input name="about_tit" type="text" id="about_tit" value="<?php echo get_option('xit_about_tit'); ?>" class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="about_txt">Text</label></th> <td> <textarea cols="60" rows="5" name="about_txt" type="text" id="about_txt" class="regular-text" /><?php echo get_option('xit_about_txt'); ?></textarea> </td> </tr> <!-- Ads Box Settings --> <tr> <th colspan="2"><strong>Ads Box Settings</strong></th> </tr> <tr> <th><label for="ads">Ads Section Enabled:</label></th> <td> <select name="ads" id="ads"> <option value="yes" <?php if(get_option('xit_ads') == 'yes'){?>selected="selected"<?php }?>>Yes</option> <option value="no" <?php if(get_option('xit_ads') == 'no'){?>selected="selected"<?php }?>>No</option> </select> <br /><em>Make sure you have AdMinister plugin activated and have the position "Sidebar" created within the plugin.</em> </td> </tr> <tr valign="top"> <th scope="row"><label for="advertise_page">Advertise Page</label></th> <td> <?php wp_dropdown_pages("name=advertise_page&show_option_none=".__('- Select -')."&selected=" .get_option('xit_advertise_page')); ?> </td> </tr> <!-- Google Analytics --> <tr> <th><label for="ads">Google Analytics code:</label></th> <td> <textarea name="analytics" id="analytics" rows="7" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('xit_analytics')); ?></textarea> </td> </tr> </table> <p class="submit"> <input type="submit" name="Submit" class="button-primary" value="Save Changes" /> <input type="hidden" name="xit_settings" value="save" style="display:none;" /> </p> </form> </div> <? }?> <?php function get_first_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //Defines a default image $first_img = "/images/default.jpg"; } return $first_img; } ?> The last line is line 223.

    Read the article

  • Routing table on Linux not respected

    - by MRHaarmann
    I have a very specific problem, building a Linux VPN endpoint (with external VPN Gateway), which should route certain networks over the tunnel, others via default gateway. The Linux VPN should do a NAT on the outgoing connections for the VPN peers. Setup is as following: Internet gateway LAN 192.168.25.1/24 VPN Gateway LAN 10.45.99.2/24 (VPN tunnel 10.45.99.1 to net 87.115.17.40/29, separate connection to Internet) Linux VPN Router eth0 192.168.25.71/24 eth0:503 10.45.99.1/24 Default 192.168.25.1 route to 87.115.17.40/29 via 10.45.99.2 (send_redirects disabled, ip_forward enabled) Linux clients (multiple): eth0 192.168.25.x/24 Default 192.168.25.1 route to 87.115.17.40/29 via 192.168.25.71 Ping to the machines via tunnel from the VPN Router is working. Now I want to establish a routing from my clients over the VPN gateway and the client packet gets routed to 192.168.25.1 ! traceroute output shows the packets get routed to 192.168.25.71, but then to 192.168.25.1. So the route is not respected in forward ! IPTables and Routing: ip route show 87.115.17.40/29 via 10.45.99.2 dev eth0 10.45.99.0/24 dev eth0 proto kernel scope link src 10.45.99.1 192.168.25.0/24 dev eth0 proto kernel scope link src 192.168.25.71 default via 192.168.25.1 dev eth0 iptables -A INPUT -i eth0:503 -j REJECT iptables -t nat -A POSTROUTING -o eth0:503 -j MASQUERADE iptables -A FORWARD -i eth0:503 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -s 192.168.25.0/24 -o eth0:503 -j ACCEPT So what is wrong with my setup ? The route is chosen correctly from localhost, but all the clients get forwarded to the Internet GW. thanks for helping, Marcus

    Read the article

  • How to get index using LINQ?

    - by codymanix
    Given a datasource like that: var c = new Car[] { new Car{ Color="Blue", Price=28000}, new Car{ Color="Red", Price=54000}, new Car{ Color="Pink", Price=9999}, // .. }; How can I find the index of the first car satisfying a certain condition with LINQ? EDIT: I could think of something like this but it looks horrible: int firstItem = someItems.Select((item, index) => new { ItemName = item.Color, Position = index }).Where(i => i.ItemName == "purple") .First() .Position; Will it be the best to solve this with a plain old loop?

    Read the article

  • Creating colour schemes based on an existing scheme

    - by Neil Barnwell
    I have a colour scheme based around yellow, for warning messages on a website. It amounts to a slightly orange bordered box, with a pale yellow fill. The exact colours are: #FED626 (border) #FFF7C0 (fill) I want to know if it's possible to convert this scheme mathematically or algorithmically somehow, to come up with a blue version where the border is the "same amount" of blue as this one is yellow. Is this possible, or do I just "pin the tail on the donkey" on a colour pallet to get roughly the right one? I ask, because I'd quite like to be able to calculate this on the fly, to perhaps implement something in .less. To give you an idea, I tried swopping the red and blue values on those two, and came up with this: #26D6FE (border) #C0F7FF (fill) That wasn't too hard, but think about if I wanted a pink colour scheme... :)

    Read the article

  • Only apply the property till the text, not whole the line

    - by Santosh
    Here is my the dummy test. Here is the HTML stuff: <h1> Header </h1> Here is the CSS stuff: body { background: pink; } h1 { background-color: #454545; } The webpage is rendered something like this:                      As you can se in this image, I applied the property to the <h1>, but the whole line has its effect. What I want is, the gray background till the word "Header", not more than that (Background color is just an example. This is not only the case.).

    Read the article

  • How to save image drawn on a JPanel?

    - by swift
    I have a panel with transparent background which i use to draw an image. now problem here is when i draw anything on panel and save the image as a JPEG file its saving the image with black background but i want it to be saved as same, as i draw on the panel. what should be done for this? plz guide me j Client.java public class Client extends Thread { static DatagramSocket datasocket; static DatagramSocket socket; Point point; Whiteboard board; Virtualboard virtualboard; JLayeredPane layerpane; BufferedImage image; public Client(DatagramSocket datasocket) { Client.datasocket=datasocket; } //This function is responsible to connect to the server public static void connect() { try { socket=new DatagramSocket (9000); //client connection socket port= 9000 datasocket=new DatagramSocket (9005); //client data socket port= 9002 ByteArrayOutputStream baos=new ByteArrayOutputStream(); DataOutputStream dos=new DataOutputStream(baos); //this is to tell server that this is a connection request dos.writeChar('c'); dos.close(); byte[]data=baos.toByteArray(); //Server IP address InetAddress ip=InetAddress.getByName("10.123.97.154"); //create the UDP packet DatagramPacket packet=new DatagramPacket(data, data.length,ip , 8000); socket.send(packet); Client client=new Client(datasocket); client.createFrame(); client.run(); } catch(Exception e) { e.printStackTrace(); } } //This function is to create the JFrame public void createFrame() { JFrame frame=new JFrame("Whiteboard"); frame.setVisible(true); frame.setBackground(Color.black); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(680,501); frame.addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent e) {} public void windowClosing(WindowEvent e) { close(); } }); layerpane=frame.getLayeredPane(); board= new Whiteboard(datasocket); image = new BufferedImage(590,463, BufferedImage.TYPE_INT_ARGB); board.setBounds(74,2,590,463); board.setImage(image); virtualboard=new Virtualboard(); virtualboard.setImage(image); virtualboard.setBounds(74,2,590,463); layerpane.add(virtualboard,new Integer(2));//Panel where remote user draws layerpane.add(board,new Integer(3)); layerpane.add(board.colourButtons(),new Integer(1)); layerpane.add(board.shapeButtons(),new Integer(0)); //frame.add(paper.addButtons(),BorderLayout.WEST); } /* * This function is overridden from the thread class * This function listens for incoming packets from the server * which contains the points drawn by the other client */ public void run () { while (true) { try { byte[] buffer = new byte[512]; DatagramPacket packet = new DatagramPacket(buffer, buffer.length); datasocket.receive(packet); InputStream in=new ByteArrayInputStream(packet.getData(), packet.getOffset(),packet.getLength()); DataInputStream din=new DataInputStream(in); int x=din.readInt(); int y=din.readInt(); String varname=din.readLine(); String var[]=varname.split("-",4); point=new Point(x,y); virtualboard.addPoint(point, var[0], var[1],var[2],var[3]); } catch (IOException ex) { ex.printStackTrace(); } } } //This function is to broadcast the newly drawn point to the server public void broadcast (Point p,String varname,String shape,String event, String color) { try { ByteArrayOutputStream baos=new ByteArrayOutputStream(); DataOutputStream dos=new DataOutputStream(baos); dos.writeInt(p.x); dos.writeInt(p.y); dos.writeBytes(varname); dos.writeBytes("-"); dos.writeBytes(shape); dos.writeBytes("-"); dos.writeBytes(event); dos.writeBytes("-"); dos.writeBytes(color); dos.close(); byte[]data=baos.toByteArray(); InetAddress ip=InetAddress.getByName("10.123.97.154"); DatagramPacket packet=new DatagramPacket(data, data.length,ip , 8002); datasocket.send(packet); } catch (Exception e) { e.printStackTrace(); } } //This function is to close the client's connection with the server public void close() { try { ByteArrayOutputStream baos=new ByteArrayOutputStream(); DataOutputStream dos=new DataOutputStream(baos); //This is to tell server that this is request to remove the client dos.writeChar('r'); dos.close(); byte[]data=baos.toByteArray(); //Server IP address InetAddress ip=InetAddress.getByName("10.123.97.154"); DatagramPacket packet=new DatagramPacket(data, data.length,ip , 8000); socket.send(packet); System.out.println("closed"); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws Exception { connect(); } } Whiteboard.java class Whiteboard extends JPanel implements MouseListener,MouseMotionListener,ActionListener,KeyListener { BufferedImage image; Boolean tooltip=false; int post; String shape; String selectedcolor="black"; Color color=Color.black; //Color color=Color.white; Point start; Point end; Point mp; Point tip; int keycode; String fillshape; Point fillstart=new Point(); Point fillend=new Point(); int noofside; Button r=new Button("rect"); Button rectangle=new Button("rect"); Button line=new Button("line"); Button roundrect=new Button("roundrect"); Button polygon=new Button("poly"); Button text=new Button("text"); JButton save=new JButton("Save"); Button elipse=new Button("elipse"); ImageIcon fillicon=new ImageIcon("images/fill.jpg"); JButton fill=new JButton(fillicon); ImageIcon erasericon=new ImageIcon("images/eraser.gif"); JButton erase=new JButton(erasericon); JButton[] colourbutton=new JButton[28]; String selected; Point label; String key=""; int ex,ey;//eraser DatagramSocket dataSocket; JButton button = new JButton("test"); Client client; Boolean first; int w,h; public Whiteboard(DatagramSocket dataSocket) { try { UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } setLayout(null); setOpaque(false); setBackground(new Color(237,237,237)); this.dataSocket=dataSocket; client=new Client(dataSocket); addKeyListener(this); addMouseListener(this); addMouseMotionListener(this); setBorder(BorderFactory.createLineBorder(Color.black)); } public void paintComponent(Graphics g) { try { super.paintComponent(g); g.drawImage(image, 0, 0, this); Graphics2D g2 = (Graphics2D)g; if(color!=null) g2.setPaint(color); if(start!=null && end!=null) { if(selected==("elipse")) g2.drawOval(start.x, start.y,(end.x-start.x),(end.y-start.y)); else if(selected==("rect")) g2.drawRect(start.x, start.y, (end.x-start.x),(end.y-start.y)); else if(selected==("rrect")) g2.drawRoundRect(start.x, start.y, (end.x-start.x),(end.y-start.y),11,11); else if(selected==("line")) g2.drawLine(start.x,start.y,end.x,end.y); else if(selected==("poly")) { g2.drawLine(start.x,start.y,end.x,end.y); client.broadcast(start, "start", "poly", "drag", selectedcolor); client.broadcast(end, "end", "poly", "drag", selectedcolor); } } if(tooltip==true) { System.out.println(selected); if(selected=="text") { g2.drawString("|", tip.x, tip.y-5); g2.drawString("Click to add text", tip.x+10, tip.y+23); g2.drawString("__", label.x+post, label.y); } if(selected=="erase") { g2.setPaint(new Color(237,237,237)); g2.fillRect(tip.x-10,tip.y-10,10,10); g2.setPaint(color); g2.drawRect(tip.x-10,tip.y-10,10,10); } } } catch(Exception e) {} } //Function to draw the shape on image public void draw() { Graphics2D g2 = (Graphics2D) image.createGraphics(); Font font=new Font("Times New Roman",Font.PLAIN,14); g2.setFont(font); g2.setPaint(color); if(start!=null && end!=null) { if(selected=="line") g2.drawLine(start.x, start.y, end.x, end.y); else if(selected=="elipse") g2.drawOval(start.x, start.y, (end.x-start.x),(end.y-start.y)); else if(selected=="rect") g2.drawRect(start.x, start.y, (end.x-start.x),(end.y-start.y)); else if(selected==("rrect")) g2.drawRoundRect(start.x, start.y, (end.x-start.x),(end.y-start.y),11,11); else if(selected==("poly")) { g2.drawLine(start.x,start.y,end.x,end.y); client.broadcast(start, "start", "poly", "release", selectedcolor); client.broadcast(end, "end", "poly", "release", selectedcolor); } fillstart=start; fillend=end; fillshape=selected; } if(selected!="poly") { start=null; end=null; } if(label!=null) { if(selected==("text")) { g2.drawString(key,label.x,label.y); client.broadcast(label, key, "text", "release", selectedcolor); } } repaint(); g2.dispose(); } //Function which provides the erase functionality public void erase() { Graphics2D pic=(Graphics2D) image.createGraphics(); Color erasecolor=new Color(237,237,237); pic.setPaint(erasecolor); if(start!=null) pic.fillRect(start.x-10, start.y-10, 10, 10); } //To set the size of the image public void setImage(BufferedImage image) { this.image = image; } //Function to add buttons into the panel, calling this function returns a panel public JPanel shapeButtons() { JPanel shape=new JPanel(); shape.setBackground(new Color(181, 197, 210)); shape.setLayout(new GridLayout(5,2,2,4)); shape.setBounds(0, 2, 74, 166); rectangle.addActionListener(this); rectangle.setToolTipText("Rectangle"); line.addActionListener( this); line.setToolTipText("Line"); erase.addActionListener(this); erase.setToolTipText("Eraser"); roundrect.addActionListener(this); roundrect.setToolTipText("Round edge Rectangle"); polygon.addActionListener(this); polygon.setToolTipText("Polygon"); text.addActionListener(this); text.setToolTipText("Text"); fill.addActionListener(this); fill.setToolTipText("Fill with colour"); elipse.addActionListener(this); elipse.setToolTipText("Elipse"); save.addActionListener(this); shape.add(elipse); shape.add(rectangle); shape.add(roundrect); shape.add(polygon); shape.add(line); shape.add(text); shape.add(fill); shape.add(erase); shape.add(save); return shape; } public JPanel colourButtons() { JPanel colourbox=new JPanel(); colourbox.setBackground(new Color(181, 197, 210)); colourbox.setLayout(new GridLayout(8,2,8,8)); colourbox.setBounds(0,323,70,140); //colourbox.add(empty); for(int i=0;i<16;i++) { colourbutton[i]=new JButton(); colourbox.add(colourbutton[i]); if(i==0) colourbutton[0].setBackground(Color.black); else if(i==1) colourbutton[1].setBackground(Color.white); else if(i==2) colourbutton[2].setBackground(Color.red); else if(i==3) colourbutton[3].setBackground(Color.orange); else if(i==4) colourbutton[4].setBackground(Color.blue); else if(i==5) colourbutton[5].setBackground(Color.green); else if(i==6) colourbutton[6].setBackground(Color.pink); else if(i==7) colourbutton[7].setBackground(Color.magenta); else if(i==8) colourbutton[8].setBackground(Color.cyan); else if(i==9) colourbutton[9].setBackground(Color.black); else if(i==10) colourbutton[10].setBackground(Color.yellow); else if(i==11) colourbutton[11].setBackground(new Color(131,168,43)); else if(i==12) colourbutton[12].setBackground(new Color(132,0,210)); else if(i==13) colourbutton[13].setBackground(new Color(193,17,92)); else if(i==14) colourbutton[14].setBackground(new Color(129,82,50)); else if(i==15) colourbutton[15].setBackground(new Color(64,128,128)); colourbutton[i].addActionListener(this); } return colourbox; } public void fill() { if(selected=="fill") { Graphics2D g2 = (Graphics2D) image.getGraphics(); g2.setPaint(color); System.out.println("Fill"); if(fillshape=="elipse") g2.fillOval(fillstart.x, fillstart.y, (fillend.x-fillstart.x),(fillend.y-fillstart.y)); else if(fillshape=="rect") g2.fillRect(fillstart.x, fillstart.y, (fillend.x-fillstart.x),(fillend.y-fillstart.y)); else if(fillshape==("rrect")) g2.fillRoundRect(fillstart.x, fillstart.y, (fillend.x-fillstart.x),(fillend.y-fillstart.y),11,11); // else if(fillshape==("poly")) // g2.drawPolygon(x,y,2); } repaint(); } //To save the image drawn public void save() { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos); JFileChooser fc = new JFileChooser(); fc.showSaveDialog(this); encoder.encode(image); byte[] jpgData = bos.toByteArray(); FileOutputStream fos = new FileOutputStream(fc.getSelectedFile()+".jpeg"); fos.write(jpgData); fos.close(); //add replce confirmation here } catch (IOException e) { System.out.println(e); } } public void mouseClicked(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent arg0) { } public void mousePressed(MouseEvent e) { if(selected=="line"||selected=="text") { start=e.getPoint(); client.broadcast(start,"start", selected,"press", selectedcolor); } else if(selected=="elipse"||selected=="rect"||selected=="rrect") mp = e.getPoint(); else if(selected=="poly") { if(first==true) { start=e.getPoint(); //client.broadcast(start,"start", selected,"press", selectedcolor); } else if(first==false) { end=e.getPoint(); repaint(); //client.broadcast(end,"end", selected,"press", selectedcolor); } } else if(selected=="erase") { start=e.getPoint(); erase(); } } public void mouseReleased(MouseEvent e) { if(selected=="text") { System.out.println("Reset"); key=""; post=0; label=new Point(); label=e.getPoint(); grabFocus(); } if(start!=null && end!=null) { if(selected=="line") { end=e.getPoint(); client.broadcast(end,"end", selected,"release", selectedcolor); draw(); } else if(selected=="elipse"||selected=="rect"||selected=="rrect") { end.x = Math.max(mp.x,e.getX()); end.y = Math.max(mp.y,e.getY()); client.broadcast(end,"end", selected,"release", selectedcolor); draw(); } else if(selected=="poly") { draw(); first=false; start=end; end=null; } } } public void mouseDragged(MouseEvent e) { if(end==null) end = new Point(); if(start==null) start = new Point(); if(selected=="line") { end=e.getPoint(); client.broadcast(end,"end", selected,"drag", selectedcolor); } else if(selected=="erase") { start=e.getPoint(); erase(); client.broadcast(start,"start", selected,"drag", selectedcolor); } else if(selected=="elipse"||selected=="rect"||selected=="rrect") { start.x = Math.min(mp.x,e.getX()); start.y = Math.min(mp.y,e.getY()); end.x = Math.max(mp.x,e.getX()); end.y = Math.max(mp.y,e.getY()); client.broadcast(start,"start", selected,"drag", selectedcolor); client.broadcast(end,"end", selected,"drag", selectedcolor); } else if(selected=="poly") end=e.getPoint(); System.out.println(tooltip); if(tooltip==true) { if(selected=="erase") { Graphics2D g2=(Graphics2D) getGraphics(); tip=e.getPoint(); g2.drawRect(tip.x-10,tip.y-10,10,10); } } repaint(); } public void mouseMoved(MouseEvent e) { if(selected=="text" ||selected=="erase") { tip=new Point(); tip=e.getPoint(); tooltip=true; repaint(); } } public void actionPerformed(ActionEvent e) { if(e.getSource()==elipse) selected="elipse"; else if(e.getSource()==line) selected="line"; else if(e.getSource()==rectangle) selected="rect"; else if(e.getSource()==erase) { selected="erase"; tooltip=true; System.out.println(selected); erase(); } else if(e.getSource()==roundrect) selected="rrect"; else if(e.getSource()==polygon) { selected="poly"; first=true; start=null; } else if(e.getSource()==text) { selected="text"; tooltip=true; } else if(e.getSource()==fill) { selected="fill"; fill(); } else if(e.getSource()==save) save(); if(e.getSource()==colourbutton[0]) { color=Color.black; selectedcolor="black"; } else if(e.getSource()==colourbutton[1]) { color=Color.white; selectedcolor="white"; } else if(e.getSource()==colourbutton[2]) { color=Color.red; selectedcolor="red"; } else if(e.getSource()==colourbutton[3]) { color=Color.orange; selectedcolor="orange"; } else if(e.getSource()==colourbutton[4]) { selectedcolor="blue"; color=Color.blue; } else if(e.getSource()==colourbutton[5]) { selectedcolor="green"; color=Color.green; } else if(e.getSource()==colourbutton[6]) { selectedcolor="pink"; color=Color.pink; } else if(e.getSource()==colourbutton[7]) { selectedcolor="magenta"; color=Color.magenta; } else if(e.getSource()==colourbutton[8]) { selectedcolor="cyan"; color=Color.cyan; } } @Override public void keyPressed(KeyEvent e) { //System.out.println(e.getKeyChar()+" : "+e.getKeyCode()); if(label!=null) { if(e.getKeyCode()==10) //Check for Enter key { label.y=label.y+14; key=""; post=0; repaint(); } else if(e.getKeyCode()==8) //Backspace { try{ Graphics2D g2 = (Graphics2D) image.getGraphics(); g2.setPaint(new Color(237,237,237)); g2.fillRect(label.x+post-7, label.y-13, 14, 17); if(post>0) post=post-6; keycode=0; key=key.substring(0, key.length()-1); System.out.println(key.substring(0, key.length())); repaint(); Point broadcastlabel=new Point(); broadcastlabel.x=label.x+post-7; broadcastlabel.y=label.y-13; client.broadcast(broadcastlabel, key, "text", "backspace", selectedcolor); } catch(Exception ex) {} } //Block invalid keys else if(!(e.getKeyCode()>=16 && e.getKeyCode()<=20 || e.getKeyCode()>=112 && e.getKeyCode()<=123 || e.getKeyCode()>=33 && e.getKeyCode()<=40 || e.getKeyCode()>=144 && e.getKeyCode()<=145 || e.getKeyCode()>=524 && e.getKeyCode()<=525 ||e.getKeyCode()==27||e.getKeyCode()==155 ||e.getKeyCode()==127)) { key=key+e.getKeyChar(); post=post+6; draw(); } } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } } class Button extends JButton { String name; int i; public Button(String name) { this.name=name; try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } } public Button(int i) { this.i=i; } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //g2.setStroke(new BasicStroke(1.2f)); if (name == "line") g.drawLine(5,5,30,30); if (name == "elipse") g.drawOval(5,7,25,20); if (name== "rect") g.drawRect(5,5,25,23); if (name== "roundrect") g.drawRoundRect(5,5,25,23,10,10); int a[]=new int[]{20,9,20,23,20}; int b[]=new int[]{9,23,25,20,9}; if (name== "poly") g.drawPolyline(a, b, 5); if (name== "text") g.drawString("Text",8, 24); } }

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16  | Next Page >