Daily Archives

Articles indexed Monday May 24 2010

Page 17/108 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Determining the color of a pixel in a bitmap using C# in a WPF app

    - by DanM
    The only way I found so far is System.Drawing.Bitmap.GetPixel(), but Microsoft has warnings for System.Drawing that are making me wonder if this is the "old way" to do it. Are there any alternatives? Here's what Microsoft says about the System.Drawing namespace. I also noticed that the System.Drawing assembly was not automatically added to the references when I created a new WPF project. System.Drawing Namespace The System.Drawing namespace provides access to GDI+ basic graphics functionality. More advanced functionality is provided in the System.Drawing.Drawing2D, System.Drawing.Imaging, and System.Drawing.Text namespaces. The Graphics class provides methods for drawing to the display device. Classes such as Rectangle and Point encapsulate GDI+ primitives. The Pen class is used to draw lines and curves, while classes derived from the abstract class Brush are used to fill the interiors of shapes. Caution Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. - http://msdn.microsoft.com/en-us/library/system.drawing.aspx

    Read the article

  • How to show string inside string in different color?

    - by Kishore Kumar
    I have one TextBox and One listbox for searching a collection of data. While searching a text inside a Listbox if that matching string found in anywhere in the list it should show in Green color with Bold. eg. I have string collection like "Dependency Property, Custom Property, Normal Property" if i type in the Search Text box "prop" all the Three with "prop" (only the word Prop) should be in Bold and its color should be in green. any idea how it can be done?. Data inside listbox is represented using DataTemplate.

    Read the article

  • Architecture Guidance for designing Workflow Foundation with WCF

    - by Matrix
    We are planning to use WF 3.5 with WCF 3.5 and Entity Framework 1.0 for the upcoming major project. I'm looking for guidance on the architecture side. This new application will be based on typical 3-tier architecture as depicted below: Presentation Tier: ASP.NET Web Forms 3.5 Business Tier: WF 3.5 + BLL's that expose the business logic through WCF service interfaces (using EF for Data Access) Data Tier: SQL Server 2000 Here are the questions: Though the Workflow Foundation has Workflow Services, where we can map the WCF service contracts to a workflow, is this the right way to design the applications? Is EF 1.0 business entities can be used in n-tier apps without sacrificing the tracking changes in the entities? Is there a sample reference application available to look? Thanks.

    Read the article

  • This code appears to achieve the return of a null reference in C++

    - by Chuck
    Hi folks, My C++ knowledge is somewhat piecemeal. I was reworking some code at work. I changed a function to return a reference to a type. Inside, I look up an object based on an identifier passed in, then return a reference to the object if found. Of course I ran into the issue of what to return if I don't find the object, and in looking around the web, many people claim that returning a "null reference" in C++ is impossible. Based on this advice, I tried the trick of returning a success/fail boolean, and making the object reference an out parameter. However, I ran into the roadblock of needing to initialize the references I would pass as actual parameters, and of course there is no way to do this. I retreated to the usual approach of just returning a pointer. I asked a colleague about it. He uses the following trick quite often, which is accepted by both a recent version of the Sun compiler and by gcc: MyType& someFunc(int id) { // successful case here: // ... // fail case: return *static_cast<MyType*>(0); } // Use: ... MyType& mt = somefunc(myIdNum); if (&mt) // test for "null reference" { // whatever } ... I have been maintaining this code base for a while, but I find that I don't have as much time to look up the small details about the language as I would like. I've been digging through my reference book but the answer to this one eludes me. Now, I had a C++ course a few years ago, and therein we emphasized that in C++ everything is types, so I try to keep that in mind when thinking things through. Deconstructing the expression: "*static_cast(0);", it indeed seems to me that we take a literal zero, cast it to a pointer to MyType (which makes it a null pointer), and then apply the dereferencing operator in the context of assigning to a reference type (the return type), which should give me a reference to the same object pointed to by the pointer. This sure looks like returning a null reference to me. Any advice in explaining why this works (or why it shouldn't) would be greatly appreciated. Thanks, Chuck

    Read the article

  • c struct question

    - by lhw
    Hi, I'm trying to implement a simple priority queue from array of queues. I'm trying to define a struct queue, and than a struct priority queue that has an array of queues as its member variable. However, when I try to compile the code, I get the following error: pcb.h:30: error: array type has incomplete element type The code is below: typedef struct{ pcb *head; pcb *tail; SINT32 size; } pcb_Q; typedef struct { struct pcb_Q queues[5]; SINT32 size; } pcb_pQ; Could someone give me a hand? Thanks a lot.

    Read the article

  • geographical deployment Vs geo load balancing SharePoint 2010

    - by vrajaraman
    we have a company wide SharePoint portals planned for few thousand users. since the users are distributed among different countries and their applications (hosted in sharepoint) We would like to consider geo deployment Vs geo load balancing. Please share your inputs. We are aware of this, Geo SharePoint Cluster facilitates - Farms at Central and other sites , db into regional. 2 db cluster - syncing using logshipping or SAN sync or SQL 2008 features like database mirroing Vs Loading balancing using URL and some 3rd party. all farm,sites,db centralised. benefits expecting. 1 High availability. 2.diaster recovering management. 3.maintenance hope i miss some of the points to be covered

    Read the article

  • Speed of CSS

    - by Ólafur Waage
    This is just a question to help me understand CSS rendering better. Lets say we have a million lines of this. <div class="first"> <div class="second"> <span class="third">Hello World</span> </div> </div> Which would be the fastest way to change the font of Hello World to red? .third { color: red; } div.third { color: red; } div.second div.third { color: red; } div.first div.second div.third { color: red; } Also, what if there was at tag in the middle that had a unique id of "foo". Which one of the CSS methods above would be the fastest. I know why these methods are used etc, im just trying to grasp better the rendering technique of the browsers and i have no idea how to make a test that times it. UPDATE: Nice answer Gumbo. From the looks of it then it would be quicker in a regular site to do the full definition of a tag. Since it finds the parents and narrows the search for every parent found. That could be bad in the sense you'd have a pretty large CSS file though.

    Read the article

  • [C#] Closing a MenuStrip programatically

    - by Nilbert
    I have a MenuStrip that I have added to a form, and in one of the dropdown menus in it, I have a text box. When I hit enter on the textbox, I want a function to run, then the drop down menu to close. I know how to get the enter part done, but I have no idea how to close the MenuStrip dropdown menu. Does anybody know how to do this?

    Read the article

  • duplicate symbol error C++

    - by iSight
    Hi, I have added some const character in my file as under. The error i get is duplicate symbol _xyz(say). What is the problem with it and how could i get out of this. const char* xyz = "xyz"; class Abc { public: Abc() { } };

    Read the article

  • AI opponenet car logic in car race game.

    - by ashok patidar
    hello i want to develop AI car(opponent) in car race game what should be my direction to develop them with less complexity because i don't have any idea. because the player car is moving on the scrolling track plz suggest me should i have to use relative motion or way point concept but that should also be change on the scrolling track (i.e. player car movement)

    Read the article

  • How do I resolve no swt-cocoa-3557 or swt-cocoa in swt.library.path, java.library.path or the jar fi

    - by ?????
    I can't get a swt application to work on Mac OSX Snow Leopard. Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-cocoa-3557 or swt-cocoa in swt.library.path, java.library.path or the jar file at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source) at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source) at org.eclipse.swt.internal.C.<clinit>(Unknown Source) at org.eclipse.swt.internal.cocoa.NSThread.isMainThread(Unknown Source) at org.eclipse.swt.graphics.Device.<init>(Unknown Source) at org.eclipse.swt.widgets.Display.<init>(Unknown Source) at org.eclipse.swt.widgets.Display.<init>(Unknown Source) at com.astrobetty.geotag.Hello.main(Hello.java:12) I have added -Dswt.library.path= and -Djava.library.path statements to the "VM arrguments" hand have also tried setting them as variables in the "environment" section of the Eclipse run configuration page. I've verified that my .jar file is at the path I specify. If I look inside the .jar, it seems to contain these libraries: 102 Feb 12 13:21 META-INF 183 Feb 12 13:21 external.xpt 37104 Nov 17 2009 libswt-awt-cocoa-3557.jnilib 287228 Nov 17 2009 libswt-cocoa-3557.jnilib 548252 Nov 17 2009 libswt-pi-cocoa-3557.jnilib 313420 Nov 17 2009 libswt-xulrunner-cocoa-3557.jnilib 136 May 23 22:19 org 13 Feb 12 13:21 version.txt Any ideas on how to get this to work? Is it possible at all?

    Read the article

  • protecting my web page and folder from external using .htaccess and .htpassword in php

    - by Testadmin
    Hai I want to protect a folder (protect) and the files inside that folder. I have created a .htaccess file and put the following code. AuthName "Myfolder" AuthType Basic AuthUserFile url/protect/.htpasswd Require valid-user Also created a .htpassword file which contain username:password When I run my URL http://localhost/url/protect, I got a pop up asking username and password, I entered username as username and password as password. After that I got an error page "server error 500" "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. If you think this is a server error, please contact the webmaster." Why this happened?. Any thing wrong here? Anything needs to see my pages under the folder. Please give me the answer.

    Read the article

  • How to receive XMLHttpRequest with PHP?

    - by Adrian
    I would like to be able to read XMLHttpRequest that is sent to a PHP page. I am using prototype's Ajax.Request function, and I am sending a simple XML structure. When trying to print the POST array on the PHP page, I don't get any output. Any help appreciated.

    Read the article

  • placing pop up based on the mouse position(x,y)RSS Feed

    - by prince23
    hi, right now i am showing pop at the botton of the screen. i need to change them according to the value(x,y) whhere i have moved the mouse here i need to get the MouseEventArgs e postion that is its x:value and y:value based on that i need to place the pop up in the screen i need to get the mouse x, y postion? is it possiable to get its value? private void DG_LoadingRow(object sender, DataGridRowEventArgs e) { DataGridRow row = e.Row; int index = 0; foreach (DataGridColumn colGrid in DG.Columns) { if(colGrid .Header == "ID" || colGrid .Header == "Name") { FrameworkElement cellContent = colGrid .GetCellContent(e.Row); DataGridCell cell = cellContent.Parent as DataGridCell; cell.MouseEnter -= cell_MouseEnter; cell.MouseEnter += new MouseEventHandler(cell_MouseEnter); cell.MouseLeave -= cell_MouseLeave; cell.MouseLeave += new MouseEventHandler(cell_MouseLeave); } } } void cell_MouseLeave(object sender, MouseEventArgs e) { //Hide your popup } void cell_MouseEnter(object sender, MouseEventArgs e) { **// here i need to get the mouse position that is its x,y value based on that i can place my modal pop up in that postion. my pop is defined in xaml page here i will be assigning only its position where i need to place my modal pop up.** //

    Read the article

  • How does a GUI Framework work?

    - by AlexW.H.B.
    I have been all over the web looking for an answer to this, and my question is this: How does a GUI framework work? for instance how does Qt work, is there any books or wibsites on the topic of writing a GUI framework from scratch? and also does the framework have to call methods from the operating systems GUI framework? -- Thank you to any one who takes the time to try to answer this question, and forgive me if i misspelled anything.

    Read the article

  • Looking for best practise for writing a serial device communication app in C#

    - by cdotlister
    I am pretty new to serial comms, but would like advise on how to best achieve a robust application which speak to and listens to a serial device. I have managed to make use of System.IO.serialport, and successfully connected to, sent data to and recieved from my device. The way things work is this. My application connects to the Com Port and opens the port.... I then connect my device to the com port, and it detects a connectio to the PC, so sends a bit of text. it's really just copyright info, as well as the version of the firmware. I don't do anything with that, except display it in my 'activity' window. The device then waits. I can then query information, but sending a command such as 'QUERY PARAMETER1'. It then replies with something like: 'QUERY PARAMETER1\r\n\r\n76767\r\n\r\n' I then process that. I can then update it by sending 'SET PARAMETER1 12345', and it will reply with 'QUERY PARAMETER1\r\n\r\n12345\r\n\r\n'. All pretty basic. So, what I have done is created a Communication Class. this call is called in it's own thread, and sends data back to the main form... and also allows me to send messages to it. Sending data is easy. Recieving is a bit more tricky. I have employed the use of the datarecieved event, and when ever data comes in, I echo that to my screen. My problem is this: When I send a command, I feel I am being very dodgy in my handling. What I am doing is, lets say I am sending 'QUERY PARAMETER1'. I send the command to the device, I then put 'PARAMETER1' into a global variable, and I do a Thread.Sleep(100). On the data recieved, I then have a bit of logic that checks the incoming data, and sees if the string CONTAINS the value in the gloabl variable. As the reply may be 'QUERY PARAMETER1\r\n\r\n76767\r\n\r\n', it sees that it contains my parameter, parses the string, and returns the value I am looking for, but placing it into another global variable. My sending method was sleeping for 100ms. It then wakes, and checks the returned global variable. If it has data... then I'm happy, and I process the data. Problem is... if the sleep is too short.. it will fail. And I feel it's flakey.. putting stuff into variables.. then waiting... The other option is to use ReadLine instead, but that's very blocking. So I remove the datarecieved method, and instead... just send the data... then call ReadLine(). That may give me better results. There's no time, except when we connect initially, that data comes from the device, without me requesting it. So, maybe readline will be simpler and safer? Is this known as 'Blocking' reads? Also, can I set a timeout? Hopefully someone can guide me.

    Read the article

  • same Linq for two tables

    - by Diana
    I need to do something like this, My two tables have the same signature, but different class so It suppose to work but it is not working. var myTable; if (booleanVariable == true) { myTable = table1; } else { myTable = table2; } var myLinq1 = from p in myTable join r in myOtherTable select p; In this case, I have to initialize myTable I have tried also, var myTable= table2; if (booleanVariable == true) { myTable = table1; } var myLinq1 = from p in myTable join r in myOtherTable select p; then var is type table2, then it can't be changed to table1 type. I need help, I don't want to make a copy paste of all the code. the linq query is huge, and it s nested with 5 or 6 queries. also I have to do this on 12 different methods. Thanks a lot for your help.

    Read the article

  • C question: error: expected ')' before '*' token

    - by lhw
    ===EDIT I apologize for not putting the pcb struct into the code snippet. There is a struct called pcb defined in above the two structs I originally posted. Namely, typedef struct{ UINT32 proc; struct pcb *link; }pcb; Hi, I asked a question regarding structs in C a few minutes ago and got an answer blazing fast. But now I'm facing another problem, namely the error in the title of this question. I'm trying to implement a simple priority queue in C using arrays of queues. However, when I try to declare a function on pcb_pQ structure, I get the above error. I have the structs clearly defined in the heard file. In the header file: typedef struct{ pcb *head; pcb *tail; SINT32 size; } pcb_Q; typedef struct pcb_pQ { pcb_Q queues[5]; SINT32 size; } pcb_pQ; Function prototype in header file: /*priority queue operations*/ VOID pcb_pq_enqueue(pcb_pQ*, pcb*); Function impelmentation in .c file: VOID pcb_pq_enqueue(pcb_pQ* pcb_pQ, pcb* pcb) { pcb_Q* pcb_Q_p; int priority; priority = pcb->proc_priority; pcb_Q_p = &pcb_pQ->queues[priority]; pcb_enqueue(pcb_Q_p, pcb); } When I try to compile the above code, I get an "error: expected ')' before '*' token". This error is pointing to the function signature in the .c file, namely VOID pcb_pq_enqueue(pcb_pQ* pcb_pQ, pcb* pcb) { But I am not sure why I am getting this error, could someone give me a hand? Thanks a lot.

    Read the article

  • Nokogiri parsing Rackspace return using XPath in Rails

    - by Schroedinger
    Hey guys, I'm using Nokogiri to parse a return from the Rackspace API so I'm using their sample code to response = server.get '/customers/'[email protected]_id.to_s+'/domains/', server.xml_format doc = Nokogiri::XML::parse response.body puts "xpath values" doc.xpath("//name").each do |node| puts node.text end As my code to use Nokogiri to return the nodelist of nodes of the element for some reason I seem to have missed something obvious and I just for the life of me cannot get it to parse the list of nodes and return them to me, is there something simple I can do to fix to have it return the list of nodes? Cheers

    Read the article

  • Pass a class as a parameter?

    - by JuBu1324
    I have been lead to believe that it is possible to pass a class as a method parameter, but I'm having trouble implementing the concept. Right now I have something like: - (id)navControllerFromView:(Class *)viewControllerClass title:(NSString *)title imageName:(NSString *)imageName { viewControllerClass *viewController = [[viewControllerClass alloc] init]; UINavigationController *thisNavController = [[UINavigationController alloc] initWithRootViewController: viewController]; thisNavController.tabBarItem = [[UITabBarItem alloc] initWithTitle: title image: [UIImage imageNamed: imageName] tag: 3]; return thisNavController; } and I call it like this: rootNavController = [ self navControllerFromView:RootViewController title:@"Contact" imageName:@"my_info.png" ]; What's wrong with this picture?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >