Search Results

Search found 736 results on 30 pages for 'myles gray'.

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

  • How to gray out HTML form inputs?

    - by typoknig
    What is the best way to gray out text inputs on an HTML form? I need the inputs to be grayed out when a user checks a check box. Do I have to use JavaScript for this (not very familiar with JScript) or can I use PHP (which I am more familiar with)? EDIT: After some reading I have got a little bit of code, but it is giving me problems. For some reason I cannot get my script to work based on the state of the form input (enabled or disabled) or the state of my checkbox (checked or unchecked), but my script works fine when I base it on the values of the form inputs. I have written my code exactly like several examples online (mainly this one) but to no avail. None of the stuff that is commented out will work. What am I doing wrong here? <label>Mailing address same as residental address</label> <input name="checkbox" onclick="disable_enable() "type="checkbox" style="width:15px"/><br/><br/> <script type="text/javascript"> function disable_enable(){ if (document.form.mail_street_address.value==1) document.form.mail_street_address.value=0; //document.form.mail_street_address.disabled=true; //document.form.mail_city.disabled=true; //document.form.mail_state.disabled=true; //document.form.mail_zip.disabled=true; else document.form.mail_street_address.value=1; //document.form.mail_street.disabled=false; //document.form.mail_city.disabled=false; //document.form.mail_state.disabled=false; //document.form.mail_zip.disabled=false; } </script>

    Read the article

  • Menu bars are a basic light gray after installing graphics card driver. [closed]

    - by Jonathan
    Possible Duplicate: Desktop forgets theme? Hi, I've just installed Ubuntu 10.10 64-bit. It came up saying I could install 2 proprietary drivers, one for my WiFi adapter (which works perfectly) and one for my graphics card - a Sapphire AIT Radeon HD 5770 1024MB GDDR5 PCI-Express Graphics Card. The driver is called ATI/AMD proprietary FGLRX graphics driver. Before installing this driver I was unable to have Extra Visual Effects in Appearances. However after installing (and restarting) the menu bars are now in a basic light gray mode, rather than the sleek Ubuntu black. - Although Extra Visual Effects does now work. I've tried rebooting, and I've had a look around in ATI "Catalyst Control Center" but nothing has worked so far. Does anybody know what this windows mode is, how to change it back to normal and why it's doing it in the first place? Below is a screenshot of my computer: (This is also the first time I've installed Ubuntu on my computer, and am keen for it to work.)

    Read the article

  • Programmatically swap colors from a loaded bitmap to Red, Green, Blue or Gray, pixel by pixel.

    - by eyeClaxton
    Download source code here: http://www.eyeClaxton.com/download/delphi/ColorSwap.zip I would like to take a original bitmap (light blue) and change the colors (Pixel by Pixel) to the red, green, blue and gray equivalence relation. To get an idea of what I mean, I have include the source code and a screen shot. Any help would be greatly appreciated. If more information is needed, please feel free to ask. If you could take a look at the code below, I have three functions that I'm looking for help on. The functions "RGBToRed, RGBToGreen and RGBToRed" I can't seem to come up with the right formulas. unit MainUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TMainFrm = class(TForm) Panel1: TPanel; Label1: TLabel; Panel2: TPanel; Label2: TLabel; Button1: TButton; BeforeImage1: TImage; AfterImage1: TImage; RadioGroup1: TRadioGroup; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var MainFrm: TMainFrm; implementation {$R *.DFM} function RGBToGray(RGBColor: TColor): TColor; var Gray: Byte; begin Gray := Round( (0.90 * GetRValue(RGBColor)) + (0.88 * GetGValue(RGBColor)) + (0.33 * GetBValue(RGBColor))); Result := RGB(Gray, Gray, Gray); end; function RGBToRed(RGBColor: TColor): TColor; var Red: Byte; begin // Not sure of the algorithm for this color Result := RGB(Red, Red, Red); end; function RGBToGreen(RGBColor: TColor): TColor; var Green: Byte; begin // Not sure of the algorithm for this color Result := RGB(Green, Green, Green); end; function RGBToBlue(RGBColor: TColor): TColor; var Blue: Byte; begin // Not sure of the algorithm for this color Result := RGB(Blue, Blue, Blue); end; procedure TMainFrm.FormCreate(Sender: TObject); begin BeforeImage1.Picture.LoadFromFile('Images\RightCenter.bmp'); end; procedure TMainFrm.Button1Click(Sender: TObject); var Bitmap: TBitmap; I, X: Integer; Color: Integer; begin Bitmap := TBitmap.Create; try Bitmap.LoadFromFile('Images\RightCenter.bmp'); for X := 0 to Bitmap.Height do begin for I := 0 to Bitmap.Width do begin Color := ColorToRGB(Bitmap.Canvas.Pixels[I, X]); case Color of $00000000: ; // Skip any Color Here! else case RadioGroup1.ItemIndex of 0: Bitmap.Canvas.Pixels[I, X] := RGBToBlue(Color); 1: Bitmap.Canvas.Pixels[I, X] := RGBToRed(Color); 2: Bitmap.Canvas.Pixels[I, X] := RGBToGreen(Color); 3: Bitmap.Canvas.Pixels[I, X] := RGBToGray(Color); end; end; end; end; AfterImage1.Picture.Graphic := Bitmap; finally Bitmap.Free; end; end; end. Okay, I apologize for not making it clearer. I'm trying to take a bitmap (blue in color) and swap the blue pixels with another color. Like the shots below.

    Read the article

  • How to set background image for Android button but keep the gray button?

    - by Jason Whiler
    I need to set a background image for an android button (text button), but I want to keep the gray button. When i use the setBackgroundResource() it has the image in place of the gray button. How can I keep the gray button? I tried using setCompoundDrawablesWithIntrinsicBounds, but the image only takes up part of the button, even when I have no text. Notes: I will not have text while I display the image, but the button needs to be a TextButton because there will be text without images at times, and images with text at others.

    Read the article

  • What is the effect of this order_by clause?

    - by bread
    I don't understand what this order_by clause is doing and whether I need it or not: select c.customerid, c.firstname, c.lastname, i.order_date, i.item, i.price from items_ordered i, customers c where i.customerid = c.customerid group by c.customerid, i.item, i.order_date order by i.order_date desc; This produces this data: 10330 Shawn Dalton 30-Jun-1999 Pogo stick 28.00 10101 John Gray 30-Jun-1999 Raft 58.00 10410 Mary Ann Howell 30-Jan-2000 Unicycle 192.50 10101 John Gray 30-Dec-1999 Hoola Hoop 14.75 10449 Isabela Moore 29-Feb-2000 Flashlight 4.50 10410 Mary Ann Howell 28-Oct-1999 Sleeping Bag 89.22 10339 Anthony Sanchez 27-Jul-1999 Umbrella 4.50 10449 Isabela Moore 22-Dec-1999 Canoe 280.00 10298 Leroy Brown 19-Sep-1999 Lantern 29.00 10449 Isabela Moore 19-Mar-2000 Canoe paddle 40.00 10413 Donald Davids 19-Jan-2000 Lawnchair 32.00 10330 Shawn Dalton 19-Apr-2000 Shovel 16.75 10439 Conrad Giles 18-Sep-1999 Tent 88.00 10298 Leroy Brown 18-Mar-2000 Pocket Knife 22.38 10299 Elroy Keller 18-Jan-2000 Inflatable Mattress 38.00 10438 Kevin Smith 18-Jan-2000 Tent 79.99 10101 John Gray 18-Aug-1999 Rain Coat 18.30 10449 Isabela Moore 15-Dec-1999 Bicycle 380.50 10439 Conrad Giles 14-Aug-1999 Ski Poles 25.50 10449 Isabela Moore 13-Aug-1999 Unicycle 180.79 10101 John Gray 08-Mar-2000 Sleeping Bag 88.70 10299 Elroy Keller 06-Jul-1999 Parachute 1250.00 10438 Kevin Smith 02-Nov-1999 Pillow 8.50 10101 John Gray 02-Jan-2000 Lantern 16.00 10315 Lisa Jones 02-Feb-2000 Compass 8.00 10449 Isabela Moore 01-Sep-1999 Snow Shoes 45.00 10438 Kevin Smith 01-Nov-1999 Umbrella 6.75 10298 Leroy Brown 01-Jul-1999 Skateboard 33.00 10101 John Gray 01-Jul-1999 Life Vest 125.00 10330 Shawn Dalton 01-Jan-2000 Flashlight 28.00 10298 Leroy Brown 01-Dec-1999 Helmet 22.00 10298 Leroy Brown 01-Apr-2000 Ear Muffs 12.50 While if I remove the order_by clause completely, as in this query: select c.customerid, c.firstname, c.lastname, i.order_date, i.item, i.price from items_ordered i, customers c where i.customerid = c.customerid group by c.customerid, i.item, i.order_date; I get these results: 10101 John Gray 30-Dec-1999 Hoola Hoop 14.75 10101 John Gray 02-Jan-2000 Lantern 16.00 10101 John Gray 01-Jul-1999 Life Vest 125.00 10101 John Gray 30-Jun-1999 Raft 58.00 10101 John Gray 18-Aug-1999 Rain Coat 18.30 10101 John Gray 08-Mar-2000 Sleeping Bag 88.70 10298 Leroy Brown 01-Apr-2000 Ear Muffs 12.50 10298 Leroy Brown 01-Dec-1999 Helmet 22.00 10298 Leroy Brown 19-Sep-1999 Lantern 29.00 10298 Leroy Brown 18-Mar-2000 Pocket Knife 22.38 10298 Leroy Brown 01-Jul-1999 Skateboard 33.00 10299 Elroy Keller 18-Jan-2000 Inflatable Mattress 38.00 10299 Elroy Keller 06-Jul-1999 Parachute 1250.00 10315 Lisa Jones 02-Feb-2000 Compass 8.00 10330 Shawn Dalton 01-Jan-2000 Flashlight 28.00 10330 Shawn Dalton 30-Jun-1999 Pogo stick 28.00 10330 Shawn Dalton 19-Apr-2000 Shovel 16.75 10339 Anthony Sanchez 27-Jul-1999 Umbrella 4.50 10410 Mary Ann Howell 28-Oct-1999 Sleeping Bag 89.22 10410 Mary Ann Howell 30-Jan-2000 Unicycle 192.50 10413 Donald Davids 19-Jan-2000 Lawnchair 32.00 10438 Kevin Smith 02-Nov-1999 Pillow 8.50 10438 Kevin Smith 18-Jan-2000 Tent 79.99 10438 Kevin Smith 01-Nov-1999 Umbrella 6.75 10439 Conrad Giles 14-Aug-1999 Ski Poles 25.50 10439 Conrad Giles 18-Sep-1999 Tent 88.00 10449 Isabela Moore 15-Dec-1999 Bicycle 380.50 10449 Isabela Moore 22-Dec-1999 Canoe 280.00 10449 Isabela Moore 19-Mar-2000 Canoe paddle 40.00 10449 Isabela Moore 29-Feb-2000 Flashlight 4.50 10449 Isabela Moore 01-Sep-1999 Snow Shoes 45.00 10449 Isabela Moore 13-Aug-1999 Unicycle 180.79 I'm not sure what the order_by is doing here and if it's having the intended effects.

    Read the article

  • The MsC gray zone: How to deal with the "too unexperienced on engineering/too under-qualified for research" situation?

    - by Hunter2
    Last year I've got a MsC degree on CS. On the beginning of the MsC course, I was keen on moving on with research and go for a PhD. However, as the months passed, I started to feel the urge to write software that people would, well, actually use. The programming bug had bitten me, again. So, I decided that before deciding on getting a PhD degree, I would spend some time on the "real world", working as a software developer. Sadly, most companies here in Brazil are "services" companies that seem to be stuck on the 80s when it comes to software development. I have to fend off pushy managers, less-than-competent coworkers and outrageous software requirements (why does everyone seem to need a 50k Oracle license and a behemoth Websphere AS for their CRUD applications?) on a daily basis, and even though I still love software development, the situation is starting to touch a nerve. And, mind you, I'm already lucky for getting a job at a place that isn't a plain software sweatshop. Sure, there are better places around here or I could always try my luck abroad, but then I hit the proverbial brick wall: Sorry, you're too unexperienced as a developer and too under-qualified as a researcher I've already heard this, and variations of that, multiple times. Research position recruiters look for die-hard, publication-ridden, rockstar PhDs, while development position recruiters look for die-hard, experience-ridden, rockstar programmers. To most, my MsC degree seems like a minor bump on my CV (and an outright waste of time for some). Applying for abroad positions is even harder, since the employer would have to deal of the hassle of a VISA process, which I understand that, sometimes, is too much. Now I'm feeling I've reached a dead-end. I'm certain that development (and not research) is my thing, so should I just dismiss my MsC (or play it as a "trump card") and play the "big fish on a small pond" role while I gather some experience and contribute on some open-source projects as a plus? Is there a better way to handle this?

    Read the article

  • Using EigenObjectRecognizer

    - by Meko
    Hi. I am trying make Facial recognition using Emgu Cv. And using EigenObjectRecognizer could I do it? Also is some one can explain that usage of it? because if there is a no same foto it also returns value. Here is example from Internet Image<Gray, Byte>[] trainingImages = new Image<Gray,Byte>[5]; trainingImages[0] = new Image<Gray, byte>("brad.jpg"); trainingImages[1] = new Image<Gray, byte>("david.jpg"); trainingImages[2] = new Image<Gray, byte>("foof.jpg"); trainingImages[3] = new Image<Gray, byte>("irfan.jpg"); trainingImages[4] = new Image<Gray, byte>("joel.jpg"); String[] labels = new String[] { "Brad", "David", "Foof", "Irfan" , "Joel"} MCvTermCriteria termCrit = new MCvTermCriteria(16, 0.001); EigenObjectRecognizer recognizer = new EigenObjectRecognizer( trainingImages, labels, 5000, ref termCrit); Image<Gray,Byte> testImage = new Image<Gray,Byte>("brad_test.jpg"); String label = recognizer.Recognize(testImage); Console.Write(label); It returns brad .But if I change photo in testimage it also retunrs some name or even Brad.Is it good for face recognition to use this method?Or is there any better method?

    Read the article

  • Qt 4.6 QLineEdit Style. How do I style the gray highlight border so it's rounded?

    - by krunk
    I'm styling a QLineEdit to have rounded borders for use as a search box. The rounding of the borders themselves were easy, but I can't figure out for the life of me how to round the highlighted portion of the widget when it has focus. I've tried QLineEdit::focus, but this only modifies the interior border. The images below show how the illusion of a rounded qlineedit is lost when it gains focus. QListView, QLineEdit { color: rgb(127, 0, 63); selection-color: white; border: 2px groove gray; border-radius: 10px; padding: 2px 4px; } Images with and without focus:

    Read the article

  • How can I replace red in an image with a certain shade of gray?

    - by Malcolm Frexner
    In this image I have to change red to grey: I know I can just set the saturation to zero, but then the result is a grey that is to dark. I could just change the brightness, but that would also change the left lower part of the picture: Is there an adjustment that only works on the red parts of the image? I can't use a selection, because the setting has to be applied to lots of images. EDIT I tried to use "replace adjustment tool", but that did not work well for the shdows and bright parts of the image, even with the largest fuzzines. I used blue as the replacement colour, to have a better impression of what it does.

    Read the article

  • get eigenvalue pca with java

    - by Muhamad Burhanudin
    I try use PCA to reduce dimention, and i use jama for help me using matrix. but, i got problem when get eigenvalue with jama. for example i hava 2 image dimention 100x100, then i create single matrix 2 image x (100x100). there is 20.000 pixel. and how to get reduction with eigenvalue? this is sample my code : public static void main(String[] args) { BufferedImage bi; int[] rgb; int R, G, B; // int[] jum; double[][] gray = new double[500][500] ; String[] baris = new String[1000]; try { //bi = ImageIO.read(new File("D:\\c.jpg")); int[][] pixelData = new int[bi.getHeight() * bi.getWidth()][3]; int counter = 0; for (int i = 0; i < bi.getHeight(); i++) { for (int j = 0; j < bi.getWidth(); j++) { gray[i][j] = getPixelData(bi, i, j); // R = getR(bi, i, j); //G = getG(bi, i, j); //B = getB(bi, i, j); //jum = R + G + B; // gray[counter] = Double.toString(R + G + B / 3); // System.out.println("Gray " +gray); //for (int k = 0; k < rgb.length; k++) { // pixelData[counter][k] = rgb[k]; // } counter++; } } } catch (IOException e) { e.printStackTrace(); } Matrix matrix = new Matrix(gray); PCA pca = new PCA(matrix); pca.getEigenvalue(6); String n = pca.toString(); System.err.println("nilai n "+n); //double dete = pcadete(matrix,3600); } private static int getPixelData(BufferedImage bi, int x, int y) { int argb = bi.getRGB(y, x); int r, g, b; int gray; int rgb[] = new int[]{ (argb >> 16) & 0xff, //red (argb >> 8) & 0xff, //green (argb) & 0xff //blue }; r = rgb[0]; g = rgb[1]; b = rgb[2]; gray = (r + g + b) / 3; System.out.println("gray: " + gray); return gray; } when i show eigenvalue in this code : PCA pca = new PCA(matrix); pca.getEigenvalue(6); String n = pca.toString(); System.err.println("nilai n "+n); Result is : nilai n PCA@c3e9e9 Can, u tell me what way to get eigenvalue and reduction dimension.

    Read the article

  • OpenCV Python HoughCircles error

    - by Dan
    Hi, I'm working on a program that detects circular shapes in images. I decided a Hough Transform would be the best, and I found one in the OpenCV library. The problem is that when I try to use it I get an error that I have no idea how to fix. Is OpenCV for Python not fully implemented? Is there a fix to the library I need for the program to work? Here's the code: import cv #cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) while True: img = cv.QueryFrame(capture) gray = cv.CreateImage(cv.GetSize(img), 8, 1) edges = cv.CreateImage(cv.GetSize(img), 8, 1) cv.CvtColor(img, gray, cv.CV_BGR2GRAY) cv.Canny(gray, edges, 50, 200, 3) cv.Smooth(gray, gray, cv.CV_GAUSSIAN, 9, 9) storage = cv.CreateMat(1, 2, cv.CV_32FC3) #This is the line that throws the error cv.HoughCircles(edges, storage, cv.CV_HOUGH_GRADIENT, 2, gray.height/4, 200, 100) #cv.ShowImage("camera", img) if cv.WaitKey(10) == 27: break And here is the error I'm getting: OpenCV Error: Null pinter () in unknown function, file ..\..\..\..\ocv\openc\src\cxcore\cxdatastructs.cpp, line 408 Traceback (most recent call last): File "ellipse-detect-webcam.py", line 20, in cv.HoughCircles(edges, storage, cv.CV_HOUGH_GRADIENT, 2, gray.height/4, 200, 100) cv.error Thanks in advance for the help.

    Read the article

  • Cisco Anyconnect Issue on HTC HD2

    - by Myles
    Hello, We've just got a HTC HD2 handset through (UK - T-mobile); and we've installed the Cisco Anyconnect client. It connects ok but then after a few seconds disconnects, then reconnects. It then keeps cycling through in this way, and at no point can we even attempt to sync Exchange! Our ASA 5510 reports; Group User IP <149.254.217.2 SVC Message: 17/ERROR: Reconnecting to recover from error.. And from the phone log; 10:56:03Debug Function: CSocketTransport::getTransportMTU File: ..\IPC\SocketTransport.cpp Line: 1058 Invoked Function: CNetInterface::GetTcpIpMTU Return Code: -32571377 (0xFE0F000F) Description: NETINTERFACE_ERROR_INTERFACE_NOT_AVAILABLE Does anyone have any advice on why it's constantly disconnecting? The phone log does suggest a lack of service; but the phone can browse the net, make calls, etc and appears to have good signal throughout. We did try the Anyconnect software on a Windows 7 PC which worked fine, no drop outs. Any help would be greatly appreciated! Thank you, Myles

    Read the article

  • Why can't I build Deluge?

    - by hugemeow
    Deluge is a BitTorrent Client. I am trying to build it from source, since I don't have privilege to install it as root. I am using python setup.py build. But, it failed following message, why? copying deluge/ui/web/themes/images/gray/slider/slider-v-thumb.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/gray/slider copying deluge/ui/web/themes/images/gray/slider/slider-thumb.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/gray/slider copying deluge/ui/web/themes/images/gray/panel/top-bottom.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/gray/panel copying deluge/ui/web/themes/images/gray/tabs/tab-strip-bg.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/gray/tabs copying deluge/ui/web/themes/images/yourtheme/window/right-corners.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/window copying deluge/ui/web/themes/images/yourtheme/window/left-corners.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/window copying deluge/ui/web/themes/images/yourtheme/window/left-right.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/window copying deluge/ui/web/themes/images/yourtheme/window/top-bottom.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/window creating build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/slider copying deluge/ui/web/themes/images/yourtheme/slider/slider-v-thumb.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/slider copying deluge/ui/web/themes/images/yourtheme/slider/slider-thumb.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/slider copying deluge/ui/web/themes/images/yourtheme/slider/slider-bg.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/slider copying deluge/ui/web/themes/images/yourtheme/slider/slider-v-bg.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/slider copying deluge/ui/web/themes/images/yourtheme/panel/top-bottom.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/panel copying deluge/ui/web/themes/images/yourtheme/grid/hmenu-lock.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/grid copying deluge/ui/web/themes/images/yourtheme/grid/hmenu-unlock.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/grid copying deluge/ui/web/themes/images/yourtheme/tabs/tab-strip-bg.png -> build/lib.linux-x86_64-2.4/deluge/ui/web/themes/images/yourtheme/tabs running build_ext building 'libtorrent' extension gcc -pthread -shared -L/usr/lib64 -L/opt/local/lib -lboost_filesystem -lboost_date_time -lboost_iostreams -lboost_python -lboost_thread -lpthread -lssl -lz -o build/lib.linux-x86_64-2.4/deluge/libtorrent.so /usr/bin/ld: cannot find -lboost_filesystem collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 [mirror@innov deluge-1.3.5]$ echo $? 1 Edit 1: gcc version and os information $(which gcc) --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. cat /etc/issue CentOS release 5.7 (Final) Kernel \r on an \m Edit 2: boost is referenced by setup.py in deluge 114 if OS == "linux": 115 if os.path.exists(os.path.join(sysconfig.get_config_vars()['LIBDIR'], \ 116 'libboost_filesystem-mt.so')): 117 boost_filesystem = "boost_filesystem-mt" 118 elif os.path.exists(os.path.join(sysconfig.get_config_vars()['LIBDIR'], \ 119 'libboost_filesystem.so')): 120 boost_filesystem = "boost_filesystem" 121 if os.path.exists(os.path.join(sysconfig.get_config_vars()['LIBDIR'], \ 122 'libboost_date_time-mt.so')): 123 boost_date_time = "boost_date_time-mt" 124 elif os.path.exists(os.path.join(sysconfig.get_config_vars()['LIBDIR'], \ 125 'libboost_date_time.so')): 126 boost_date_time = "boost_date_time" 127 if os.path.exists(os.path.join(sysconfig.get_config_vars()['LIBDIR'], \ 128 'libboost_thread-mt.so')): 129 boost_thread = "boost_thread-mt" 130 elif os.path.exists(os.path.join(sysconfig.get_config_vars()['LIBDIR'], \ 131 'libboost_thread.so')): 132 boost_thread = "boost_thread" 133 134 if 'boost_filesystem' not in vars(): 135 boost_filesystem = "boost_filesystem-mt" 136 if 'boost_date_time' not in vars(): 137 boost_date_time = "boost_date_time-mt" 138 if 'boost_thread' not in vars(): 139 boost_thread = "boost_thread-mt" 140 141 elif OS == "freebsd": 142 boost_filesystem = "boost_filesystem" 143 boost_date_time = "boost_date_time" 144 boost_thread = "boost_thread" 145 else: 146 boost_filesystem = "boost_filesystem-mt" 147 boost_date_time = "boost_date_time-mt" 148 boost_thread = "boost_thread-mt" 149 150 librariestype = [boost_filesystem, boost_date_time, 151 boost_thread, 'z', 'pthread', 'ssl', 'crypto']

    Read the article

  • Flood fill algorithm for Game of Go

    - by Jackson Borghi
    I'm having a hell of a time trying to figure out how to make captured stones disappear. I've read everywhere that I should use the flood fill algorithm, but I haven't had any luck with that so far. Any help would be amazing! Here is my code: package Go; import static java.lang.Math.*; import static stdlib.StdDraw.*; import java.awt.Color; public class Go2 { public static Color opposite(Color player) { if (player == WHITE) { return BLACK; } return WHITE; } public static void drawGame(Color[][] board) { Color[][][] unit = new Color[400][19][19]; for (int h = 0; h < 400; h++) { for (int x = 0; x < 19; x++) { for (int y = 0; y < 19; y++) { unit[h][x][y] = YELLOW; } } } setXscale(0, 19); setYscale(0, 19); clear(YELLOW); setPenColor(BLACK); line(0, 0, 0, 19); line(19, 19, 19, 0); line(0, 19, 19, 19); line(0, 0, 19, 0); for (double i = 0; i < 19; i++) { line(0.0, i, 19, i); line(i, 0.0, i, 19); } for (int x = 0; x < 19; x++) { for (int y = 0; y < 19; y++) { if (board[x][y] != YELLOW) { setPenColor(board[x][y]); filledCircle(x, y, 0.47); setPenColor(GRAY); circle(x, y, 0.47); } } } int h = 0; } public static void main(String[] args) { int px; int py; Color[][] temp = new Color[19][19]; Color[][] board = new Color[19][19]; Color player = WHITE; for (int i = 0; i < 19; i++) { for (int h = 0; h < 19; h++) { board[i][h] = YELLOW; temp[i][h] = YELLOW; } } while (true) { drawGame(board); while (!mousePressed()) { } px = (int) round(mouseX()); py = (int) round(mouseY()); board[px][py] = player; while (mousePressed()) { } floodFill(px, py, player, board, temp); System.out.print("XXXXX = "+ temp[px][py]); if (checkTemp(temp, board, px, py)) { for (int x = 0; x < 19; x++) { for (int y = 0; y < 19; y++) { if (temp[x][y] == GRAY) { board[x][y] = YELLOW; } } } } player = opposite(player); } } private static boolean checkTemp(Color[][] temp, Color[][] board, int x, int y) { if (x < 19 && x > -1 && y < 19 && y > -1) { if (temp[x + 1][y] == YELLOW || temp[x - 1][y] == YELLOW || temp[x][y - 1] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } if (x == 18) { if (temp[x - 1][y] == YELLOW || temp[x][y - 1] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } if (y == 18) { if (temp[x + 1][y] == YELLOW || temp[x - 1][y] == YELLOW || temp[x][y - 1] == YELLOW) { return false; } } if (y == 0) { if (temp[x + 1][y] == YELLOW || temp[x - 1][y] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } if (x == 0) { if (temp[x + 1][y] == YELLOW || temp[x][y - 1] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } else { if (x < 19) { if (temp[x + 1][y] == GRAY) { checkTemp(temp, board, x + 1, y); } } if (x >= 0) { if (temp[x - 1][y] == GRAY) { checkTemp(temp, board, x - 1, y); } } if (y < 19) { if (temp[x][y + 1] == GRAY) { checkTemp(temp, board, x, y + 1); } } if (y >= 0) { if (temp[x][y - 1] == GRAY) { checkTemp(temp, board, x, y - 1); } } } return true; } private static void floodFill(int x, int y, Color player, Color[][] board, Color[][] temp) { if (board[x][y] != player) { return; } else { temp[x][y] = GRAY; System.out.println("x = " + x + " y = " + y); if (x < 19) { floodFill(x + 1, y, player, board, temp); } if (x >= 0) { floodFill(x - 1, y, player, board, temp); } if (y < 19) { floodFill(x, y + 1, player, board, temp); } if (y >= 0) { floodFill(x, y - 1, player, board, temp); } } } }

    Read the article

  • FloodFill Algorithm for Game of Go

    - by Jackson Borghi
    I'm having a hell of a time trying to figure out how to make captured stones disappear. I've read everywhere that I should use the FloodFill algorithm, but I havent had any luck with that so far. Any help would be amazing! Here is my code: package Go; import static java.lang.Math.; import static stdlib.StdDraw.; import java.awt.Color; public class Go2 { public static Color opposite(Color player) { if (player == WHITE) { return BLACK; } return WHITE; } public static void drawGame(Color[][] board) { Color[][][] unit = new Color[400][19][19]; for (int h = 0; h < 400; h++) { for (int x = 0; x < 19; x++) { for (int y = 0; y < 19; y++) { unit[h][x][y] = YELLOW; } } } setXscale(0, 19); setYscale(0, 19); clear(YELLOW); setPenColor(BLACK); line(0, 0, 0, 19); line(19, 19, 19, 0); line(0, 19, 19, 19); line(0, 0, 19, 0); for (double i = 0; i < 19; i++) { line(0.0, i, 19, i); line(i, 0.0, i, 19); } for (int x = 0; x < 19; x++) { for (int y = 0; y < 19; y++) { if (board[x][y] != YELLOW) { setPenColor(board[x][y]); filledCircle(x, y, 0.47); setPenColor(GRAY); circle(x, y, 0.47); } } } int h = 0; } public static void main(String[] args) { int px; int py; Color[][] temp = new Color[19][19]; Color[][] board = new Color[19][19]; Color player = WHITE; for (int i = 0; i < 19; i++) { for (int h = 0; h < 19; h++) { board[i][h] = YELLOW; temp[i][h] = YELLOW; } } while (true) { drawGame(board); while (!mousePressed()) { } px = (int) round(mouseX()); py = (int) round(mouseY()); board[px][py] = player; while (mousePressed()) { } floodFill(px, py, player, board, temp); System.out.print("XXXXX = "+ temp[px][py]); if (checkTemp(temp, board, px, py)) { for (int x = 0; x < 19; x++) { for (int y = 0; y < 19; y++) { if (temp[x][y] == GRAY) { board[x][y] = YELLOW; } } } } player = opposite(player); } } private static boolean checkTemp(Color[][] temp, Color[][] board, int x, int y) { if (x < 19 && x > -1 && y < 19 && y > -1) { if (temp[x + 1][y] == YELLOW || temp[x - 1][y] == YELLOW || temp[x][y - 1] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } if (x == 18) { if (temp[x - 1][y] == YELLOW || temp[x][y - 1] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } if (y == 18) { if (temp[x + 1][y] == YELLOW || temp[x - 1][y] == YELLOW || temp[x][y - 1] == YELLOW) { return false; } } if (y == 0) { if (temp[x + 1][y] == YELLOW || temp[x - 1][y] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } if (x == 0) { if (temp[x + 1][y] == YELLOW || temp[x][y - 1] == YELLOW || temp[x][y + 1] == YELLOW) { return false; } } else { if (x < 19) { if (temp[x + 1][y] == GRAY) { checkTemp(temp, board, x + 1, y); } } if (x >= 0) { if (temp[x - 1][y] == GRAY) { checkTemp(temp, board, x - 1, y); } } if (y < 19) { if (temp[x][y + 1] == GRAY) { checkTemp(temp, board, x, y + 1); } } if (y >= 0) { if (temp[x][y - 1] == GRAY) { checkTemp(temp, board, x, y - 1); } } } return true; } private static void floodFill(int x, int y, Color player, Color[][] board, Color[][] temp) { if (board[x][y] != player) { return; } else { temp[x][y] = GRAY; System.out.println("x = " + x + " y = " + y); if (x < 19) { floodFill(x + 1, y, player, board, temp); } if (x >= 0) { floodFill(x - 1, y, player, board, temp); } if (y < 19) { floodFill(x, y + 1, player, board, temp); } if (y >= 0) { floodFill(x, y - 1, player, board, temp); } } } }

    Read the article

  • word wrap in tcpdf

    - by ChuckO
    I'm using tcpdf to creat a pdf version of the html table below. How do I word wrap the text in the cells? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> table.frm { width: 960px; Height:400px; margin-left: auto; margin-right: auto; border-width: 0px 0px 0px 0px; border-spacing: 0px; border-style: solid solid solid solid; border-color: gray gray gray gray; border-collapse: collapse; background-color: white; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 11px; } table.frm th { Width: 120px; border-width: 1px 1px 1px 1px; padding: 1px 1px 1px 1px; border-style: solid solid solid solid; border-collapse: collapse; border-color: gray gray gray gray; background-color: white; } table.frm td { width: 120px; height: 80px; vertical-align: top; border-width: 1px 1px 1px 1px; padding: 2px 2px 2px 2px; border-style: solid solid solid solid; border-collapse: collapse; border-color: gray gray gray gray; background-color: white; } </style> <title>Weekly Menu</title> </head> <body> <table class="frm"> <tr> <th align="center" colspan="8"><b>WEEKLY MENU</b></th> </tr> <tr> <th align="center" colspan="8"><b>Your Name Here</b></th> </tr> <tr> <th></th> <th>Monday</th> <th>Tuesday</th> <th>Wednesday</th> <th>Thursday</th> <th>Friday</th> <th>Saturday</th> <th>Sunday</th> </tr> <tr> <td><b>Breakfast</b></td> <td>Scrambled Eggs Black Coffee</td> <td>Vegetable Omelet Black Coffee</td> <td>2 slices Toast Black Coffee</td> <td>Cereal w/milk Black Coffee</td> <td>Orange Juice Black Coffee</td> <td>Cereal w/milk Black Coffee</td> <td>Pancakes w/syrup Black Coffee</td> </tr> <tr> <td><b>Lunch</b></td> <td>Tuna Salad Sandwich Diet Coke</td> <td>Greek Salad Black Coffee</td> <td></td> <td>Amer Cheese Sandwich Orange Juice</td> <td></td> <td></td> <td></td> </tr> <tr> <td><b>Dinner</b></td> <td>Burger Fried Onions Diet Coke</td> <td>Steak Fries Diet Sprite</td> <td></td> <td>Chicken Cutlet Baked Potato Peas</td> <td></td> <td></td> <td></td> </tr> <tr> <td><b>Snack</b></td> <td>Apple</td> <td>Orange</td> <td>Sm bag of chips</td> <td>Celery Sticks</td> <td></td> <td></td> <td></td> </tr> </table> </body> </html> This is the tcpdf code: $pdf = new TCPDF('Landscape', 'mm', '', true, 'UTF-8', false); $pdf->SetTitle('Weekly Menu'); $pdf->SetMargins(15, 7.5, 12.5); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->AddPage(); $pdf->setFormDefaultProp(array('lineWidth'=>0, 'borderStyle'=>'dot', 'fillColor'=>array(235, 235, 255), 'strokeColor'=>array(255,255,250))); $pdf->SetFont('times', 'BU', 12); $pdf->cell(250, 8, 'Weekly Menu', 0, 1, 'C'); $pdf->cell(250, 8, $yourname, 0, 1, 'C'); $pdf->SetFont('times', '', 10); $cw=35; $ch=25; $pdf->SetXY(15,50); $pdf->cell(25,5,'',1,0,'L'); $pdf->cell($cw,5,$day1,1,0,'C'); $pdf->cell($cw,5,$day2,1,0,'C'); $pdf->cell($cw,5,$day3,1,0,'C'); $pdf->cell($cw,5,$day4,1,0,'C'); $pdf->cell($cw,5,$day5,1,0,'C'); $pdf->cell($cw,5,$day6,1,0,'C'); $pdf->cell($cw,5,$day7,1,1,'C'); $pdf->cell(25,$ch,'Breakfast',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->breakfast,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Lunch',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->lunch,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Dinner',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->dinner,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Snack',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->snack,1,1,'L',0,0,false,'','T'); EOD;

    Read the article

  • Setting Background of a Jbutton

    - by mithun1538
    Hello there, I have 5 JButtons: b1, b2, b3, b4, b5. By default, their color is gray. When I click on any button, the background of that button changes to white. When I click another button, I want that previous clicked button to change its background to gray, and this newly clicked button to change its background to white. Here is the code that I wrote: int liveButton = 0; //holds the value of the button that is last clicked. //0 indicates no button clicked (in the beginning) private void ChangeInUsersList(int clickedButton) { switch(liveButton) { case 1 : b1.setBackground(Color.GRAY); break; case 2 : b2.setBackground(Color.GRAY); break; case 3 : b3.setBackground(Color.GRAY); break; case 4 : b4.setBackground(Color.GRAY); break; case 5 : b5.setBackground(Color.GRAY); break; default: System.out.println("No button to change"); } liveButton = clickedButton;// store the clicked button to change its //background later } private void b1ActionPerformed(java.awt.event.ActionEvent evt) { ChangeInUsersList(1); b1.setBackground(new java.awt.Color(255,255,255)); } private void b2ActionPerformed(java.awt.event.ActionEvent evt) { ChangeInUsersList(2); b2.setBackground(new java.awt.Color(255,255,255)); } private void b3ActionPerformed(java.awt.event.ActionEvent evt) { ChangeInUsersList(3); b3.setBackground(new java.awt.Color(255,255,255)); } private void b4ActionPerformed(java.awt.event.ActionEvent evt) { ChangeInUsersList(4); b4.setBackground(new java.awt.Color(255,255,255)); } private void b5ButtonActionPerformed(java.awt.event.ActionEvent evt) { ChangeInUsersList(5); b5.setBackground(new java.awt.Color(255,255,255)); } However, its not working as expected. When i click on a button, its background does change to white. However, if i click on some other button after that, the former button's background doesnt change to grey. I tried replacing Color.GREY with new java.awt.Color(236,233,216) - the rgb for grey but it still doesnt work.

    Read the article

  • Canon MX870 printer only shows "Processing" on the status LCD

    - by Nick
    I had my Canon MX870 installed perfectly fine in 11.10, but since upgrading to 12.04, it no longer works. The printer is recognized in print settings and when I attempt to print a test page, the printer LCD displays a "Processing" message, but then it disappears and nothing happens. Here are my logs (note that printing did not succeed despite the access logs showing success): # /var/log/cups/access_log localhost - - [22/May/2012:12:29:35 -0400] "POST /printers/Canon-MX870 HTTP/1.1" 200 412 Print-Job successful-ok - # /var/log/cups/error_log W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-Gray..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-RGB..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateDevice: org.freedesktop.ColorManager.AlreadyExists:device id 'cups-Canon-MX870' already exists W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-Gray..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-RGB..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateDevice: org.freedesktop.ColorManager.AlreadyExists:device id 'cups-Canon-MX870' already exists W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-Gray..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-RGB..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateDevice: org.freedesktop.ColorManager.AlreadyExists:device id 'cups-Canon-MX870' already exists W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-Gray..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateProfile: org.freedesktop.ColorManager.AlreadyExists:profile id 'Canon-MX870-RGB..' already exists W [22/May/2012:12:25:51 -0400] failed to CreateDevice: org.freedesktop.ColorManager.AlreadyExists:device id 'cups-Canon-MX870' already exists

    Read the article

  • SQL Query to update parent record with child record values

    - by Wells
    I need to create a Trigger that fires when a child record (Codes) is added, updated or deleted. The Trigger stuffs a string of comma separated Code values from all child records (Codes) into a single field in the parent record (Projects) of the added, updated or deleted child record. I am stuck on writing a correct query to retrieve the Code values from just those child records that are the children of a single parent record. -- Create the test tables CREATE TABLE projects ( ProjectId varchar(16) PRIMARY KEY, ProjectName varchar(100), Codestring nvarchar(100) ) GO CREATE TABLE prcodes ( CodeId varchar(16) PRIMARY KEY, Code varchar (4), ProjectId varchar(16) ) GO -- Add sample data to tables: Two projects records, one with 3 child records, the other with 2. INSERT INTO projects (ProjectId, ProjectName) SELECT '101','Smith' UNION ALL SELECT '102','Jones' GO INSERT INTO prcodes (CodeId, Code, ProjectId) SELECT 'A1','Blue', '101' UNION ALL SELECT 'A2','Pink', '101' UNION ALL SELECT 'A3','Gray', '101' UNION ALL SELECT 'A4','Blue', '102' UNION ALL SELECT 'A5','Gray', '102' GO I am stuck on how to create a correct Update query. Can you help fix this query? -- Partially working, but stuffs all values, not just values from chile (prcodes) records of parent (projects) UPDATE proj SET proj.Codestring = (SELECT STUFF((SELECT ',' + prc.Code FROM projects proj INNER JOIN prcodes prc ON proj.ProjectId = prc.ProjectId ORDER BY 1 ASC FOR XML PATH('')),1, 1, '')) The result I get for the Codestring field in Projects is: ProjectId ProjectName Codestring 101 Smith Blue,Blue,Gray,Gray,Pink ... But the result I need for the Codestring field in Projects is: ProjectId ProjectName Codestring 101 Smith Blue,Pink,Gray ... Here is my start on the Trigger. The Update query, above, will be added to this Trigger. Can you help me complete the Trigger creation query? CREATE TRIGGER Update_Codestring ON prcodes AFTER INSERT, UPDATE, DELETE AS WITH CTE AS ( select ProjectId from inserted union select ProjectId from deleted )

    Read the article

  • Windows store apps: ScrollViewer with dinamic content

    - by Alexandru Circus
    I have a scrollViewer with an ItemsControl (which holds rows with data) as content. The data from these rows is grabbed from the server so I want to display a ProgressRing with a text until the data arrives. Basically I want the content of the ScrollViewer to be a grid with progress ring and a text and after the data arrives the content to be changed with my ItemsControl. The problem is that the ScrollViewer does not accept more than 1 element as content. Please tell me how can I solve this problem. (I'm a C# beginner) <FlipView x:Name="OptionPagesFlipView" Grid.Row="1" TabNavigation="Cycle" SelectionChanged="OptionPagesFlipView_SelectionChanged" ItemsSource="{Binding OptionsPageItems}"> <FlipView.ItemTemplate> <DataTemplate x:Name="OptionMonthPageTemplate"> <ScrollViewer x:Name="OptionsScrollViewer" HorizontalScrollMode="Disabled" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto"> <ItemsControl x:Name="OptionItemsControl" ItemsSource="{Binding OptionItems, Mode=OneWay}" Visibility="Collapsed"> <ItemsControl.ItemTemplate> <DataTemplate x:Name="OptionsChainItemTemplate"> <Grid x:Name="OptionItemGrid" Background="#FF9DBDF7" HorizontalAlignment="Stretch"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <!-- CALL BID --> <TextBlock Text="Bid" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallBidTextBlock" Text="{Binding CallBid}" Foreground="Blue" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" Margin="5,0,5,5" FontSize="18"/> <!-- CALL ASK --> <TextBlock Text="Ask" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallAskTextBlock" Text="{Binding CallAsk}" Foreground="Blue" HorizontalAlignment="Left" Grid.Row="3" Grid.Column="0" Margin="5,0,5,0" FontSize="18"/> <!-- CALL LAST --> <TextBlock Text="Last" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallLastTextBlock" Text="{Binding CallLast}" Foreground="Blue" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Margin="5,0,5,5" FontSize="18"/> <!-- CALL NET CHANGE --> <TextBlock Text="Net Ch" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallNetChTextBlock" Text="{Binding CallNetChange}" Foreground="{Binding CallNetChangeForeground}" HorizontalAlignment="Left" Grid.Row="3" Grid.Column="1" Margin="5,0,5,5" FontSize="18"/> <!-- STRIKE --> <TextBlock Text="Strike" Foreground="Gray" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="2" FontSize="18" Margin="5,0,5,0"/> <Border Background="{Binding StrikeBackground}" HorizontalAlignment="Center" Grid.Row="2" Grid.Column="2" Margin="5,0,5,5"> <TextBlock x:Name="StrikeTextBlock" Text="{Binding Strike}" Foreground="Blue" FontSize="18"/> </Border> <!-- PUT LAST --> <TextBlock Text="Last" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="3" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="PutLastTextBlock" Text="{Binding PutLast}" Foreground="Blue" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="3" Margin="5,0,5,5" FontSize="18"/> <!-- PUT NET CHANGE --> <TextBlock Text="Net Ch" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="3" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="PutNetChangeTextBlock" Text="{Binding PutNetChange}" Foreground="{Binding PutNetChangeForeground}" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="3" Margin="5,0,5,5" FontSize="18"/> <!-- PUT BID --> <TextBlock Text="Bid" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="4" FontSize="18" Margin="5,0,15,0"/> <TextBlock x:Name="PutBidTextBlock" Text="{Binding PutBid}" Foreground="Blue" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="4" Margin="5,0,15,5" FontSize="18"/> <!-- PUT ASK --> <TextBlock Text="Ask" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="4" FontSize="18" Margin="5,0,15,0"/> <TextBlock x:Name="PutAskTextBlock" Text="{Binding PutAsk}" Foreground="Blue" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="4" Margin="5,0,15,5" FontSize="18"/> <!-- BOTTOM LINE SEPARATOR--> <Rectangle Fill="Black" Height="1" Grid.ColumnSpan="5" VerticalAlignment="Bottom" Grid.Row="3"/> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <!--<Grid> <Grid.RowDefinitions> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <ProgressRing x:Name="CustomProgressRing" Height="40" Width="40" IsActive="true" Grid.Column="0" Margin="20" Foreground="White"/> <TextBlock x:Name="CustomTextBlock" Height="auto" Width="auto" FontSize="25" Grid.Column="1" Margin="20"/> <Border BorderBrush="#FFFFFF" BorderThickness="1" Grid.ColumnSpan="2"/> </Grid>--> </ScrollViewer> </DataTemplate> </FlipView.ItemTemplate>

    Read the article

  • Compare images after canny edge detection in OpenCV (C++)

    - by typoknig
    Hi all, I am working on an OpenCV project and I need to compare some images after canny has been applied to both of them. Before the canny was applied I had the gray scale images populating a histogram and then I compared the histograms, but when canny is added to the images the histogram does not populate. I have read that a canny image can populate a histogram, but have not found a way to make it happen. I do not necessairly need to keep using the histograms, I just want to know the best way to compare two canny images. SSCCE below for you to chew on. I have poached and patched about 75% of this code from books and various sites on the internet, so props to those guys... // SLC (Histogram).cpp : Defines the entry point for the console application. #include "stdafx.h" #include <cxcore.h> #include <cv.h> #include <cvaux.h> #include <highgui.h> #include <stdio.h> #include <sstream> #include <iostream> using namespace std; IplImage* image1= 0; IplImage* imgHistogram1 = 0; IplImage* gray1= 0; CvHistogram* hist1; int main(){ CvCapture* capture = cvCaptureFromCAM(0); if(!cvQueryFrame(capture)){ cout<<"Video capture failed, please check the camera."<<endl; } else{ cout<<"Video camera capture successful!"<<endl; }; CvSize sz = cvGetSize(cvQueryFrame(capture)); IplImage* image = cvCreateImage(sz, 8, 3); IplImage* imgHistogram = 0; IplImage* gray = 0; CvHistogram* hist; cvNamedWindow("Image Source",1); cvNamedWindow("gray", 1); cvNamedWindow("Histogram",1); cvNamedWindow("BG", 1); cvNamedWindow("FG", 1); cvNamedWindow("Canny",1); cvNamedWindow("Canny1", 1); image1 = cvLoadImage("image bin/use this image.jpg");// an image has to load here or the program will not run //size of the histogram -1D histogram int bins1 = 256; int hsize1[] = {bins1}; //max and min value of the histogram float max_value1 = 0, min_value1 = 0; //value and normalized value float value1; int normalized1; //ranges - grayscale 0 to 256 float xranges1[] = { 0, 256 }; float* ranges1[] = { xranges1 }; //create an 8 bit single channel image to hold a //grayscale version of the original picture gray1 = cvCreateImage( cvGetSize(image1), 8, 1 ); cvCvtColor( image1, gray1, CV_BGR2GRAY ); IplImage* canny1 = cvCreateImage(cvGetSize(gray1), 8, 1 ); cvCanny( gray1, canny1, 55, 175, 3 ); //Create 3 windows to show the results cvNamedWindow("original1",1); cvNamedWindow("gray1",1); cvNamedWindow("histogram1",1); //planes to obtain the histogram, in this case just one IplImage* planes1[] = { canny1 }; //get the histogram and some info about it hist1 = cvCreateHist( 1, hsize1, CV_HIST_ARRAY, ranges1,1); cvCalcHist( planes1, hist1, 0, NULL); cvGetMinMaxHistValue( hist1, &min_value1, &max_value1); printf("min: %f, max: %f\n", min_value1, max_value1); //create an 8 bits single channel image to hold the histogram //paint it white imgHistogram1 = cvCreateImage(cvSize(bins1, 50),8,1); cvRectangle(imgHistogram1, cvPoint(0,0), cvPoint(256,50), CV_RGB(255,255,255),-1); //draw the histogram :P for(int i=0; i < bins1; i++){ value1 = cvQueryHistValue_1D( hist1, i); normalized1 = cvRound(value1*50/max_value1); cvLine(imgHistogram1,cvPoint(i,50), cvPoint(i,50-normalized1), CV_RGB(0,0,0)); } //show the image results cvShowImage( "original1", image1 ); cvShowImage( "gray1", gray1 ); cvShowImage( "histogram1", imgHistogram1 ); cvShowImage( "Canny1", canny1); CvBGStatModel* bg_model = cvCreateFGDStatModel( image ); for(;;){ image = cvQueryFrame(capture); cvUpdateBGStatModel( image, bg_model ); //Size of the histogram -1D histogram int bins = 256; int hsize[] = {bins}; //Max and min value of the histogram float max_value = 0, min_value = 0; //Value and normalized value float value; int normalized; //Ranges - grayscale 0 to 256 float xranges[] = {0, 256}; float* ranges[] = {xranges}; //Create an 8 bit single channel image to hold a grayscale version of the original picture gray = cvCreateImage(cvGetSize(image), 8, 1); cvCvtColor(image, gray, CV_BGR2GRAY); IplImage* canny = cvCreateImage(cvGetSize(gray), 8, 1 ); cvCanny( gray, canny, 55, 175, 3 );//55, 175, 3 with direct light //Planes to obtain the histogram, in this case just one IplImage* planes[] = {canny}; //Get the histogram and some info about it hist = cvCreateHist(1, hsize, CV_HIST_ARRAY, ranges,1); cvCalcHist(planes, hist, 0, NULL); cvGetMinMaxHistValue(hist, &min_value, &max_value); //printf("Minimum Histogram Value: %f, Maximum Histogram Value: %f\n", min_value, max_value); //Create an 8 bits single channel image to hold the histogram and paint it white imgHistogram = cvCreateImage(cvSize(bins, 50),8,3); cvRectangle(imgHistogram, cvPoint(0,0), cvPoint(256,50), CV_RGB(255,255,255),-1); //Draw the histogram for(int i=0; i < bins; i++){ value = cvQueryHistValue_1D(hist, i); normalized = cvRound(value*50/max_value); cvLine(imgHistogram,cvPoint(i,50), cvPoint(i,50-normalized), CV_RGB(0,0,0)); } double correlation = cvCompareHist (hist1, hist, CV_COMP_CORREL); double chisquare = cvCompareHist (hist1, hist, CV_COMP_CHISQR); double intersection = cvCompareHist (hist1, hist, CV_COMP_INTERSECT); double bhattacharyya = cvCompareHist (hist1, hist, CV_COMP_BHATTACHARYYA); double difference = (1 - correlation) + chisquare + (1 - intersection) + bhattacharyya; printf("correlation: %f\n", correlation); printf("chi-square: %f\n", chisquare); printf("intersection: %f\n", intersection); printf("bhattacharyya: %f\n", bhattacharyya); printf("difference: %f\n", difference); cvShowImage("Image Source", image); cvShowImage("gray", gray); cvShowImage("Histogram", imgHistogram); cvShowImage( "Canny", canny); cvShowImage("BG", bg_model->background); cvShowImage("FG", bg_model->foreground); //Page 19 paragraph 3 of "Learning OpenCV" tells us why we DO NOT use "cvReleaseImage(&image)" in this section cvReleaseImage(&imgHistogram); cvReleaseImage(&gray); cvReleaseHist(&hist); cvReleaseImage(&canny); char c = cvWaitKey(10); //if ASCII key 27 (esc) is pressed then loop breaks if(c==27) break; } cvReleaseBGStatModel( &bg_model ); cvReleaseImage(&image); cvReleaseCapture(&capture); cvDestroyAllWindows(); }

    Read the article

  • WCF ChannelFactory caching

    - by Myles J
    I've just read this great article on WCF ChannelFactory caching by Wenlong Dong. My question is simply how can you actually prove that the ChannelFactory is in fact being cached between calls? I've followed the rules regarding the ClientBase’s constructors. We are using the following overloaded constructor on our object that inherits from ClientBase: ClientBase(string endpointConfigurationName, EndpointAddress remoteAddress); In the article mentioned above it is stated that: For these constructors, all arguments (including default ones) are in the following list: · InstanceContext callbackInstance · string endpointConfigurationName · EndpointAddress remoteAddress As long as these three arguments are the same when ClientBase is constructed, we can safely assume that the same ChannelFactory can be used. Fortunately, String and EndpointAddress types are immutable, i.e., we can make simple comparison to determine whether two arguments are the same. For InstanceContext, we can use Object reference comparison. The type EndpointTrait is thus used as the key of the MRU cache. To test the ChannelFactory cache theory we are checking the Hashcode in the ClientBase constructor e.g. var testHash = RuntimeHelpers.GetHashCode(base.ChannelFactory); The hash value is different between calls which makes us think that the ChannelFactory isn't actually cached. Any thoughts? Regards Myles

    Read the article

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