Search Results

Search found 12674 results on 507 pages for 'programming competitions'.

Page 167/507 | < Previous Page | 163 164 165 166 167 168 169 170 171 172 173 174  | Next Page >

  • Is key 'chord' functionality provided by Win32/.net?

    - by John
    Several MS apps support the concept of chords, like "CTRL+X,Y" which means "holding down CTRL, press X, then Y". Is this a bespoke thing they (and other companies) implement, or is it built into any APIs? It would be nice to be able to set up event handlers or accelerators based on chords rather than write code to do it.

    Read the article

  • Visual Studio 2010 Language Support

    - by inspectorG4dget
    Hello SO, I want to be able to develop code using Visual Studio 2010. I just got VS2010 and I'm not able to get the languages I want on it. The main reason that I'm asking this is that I'm trying to migrate to ONE IDE that does it all for me. Thus far eclipse has been doing a good job, but I've been informed that VS2010 is better and I'm trying to get into the groove of that standard So my question is two-fold. I am not able to find a complete list of languages supported by VS2010. What are these languages? How can I get VS2010 support for: a. Python/IronPython b. C/C++/C#/XNA c. Java My Googling has given me no promising/definitive results. I'd really appreciate any help.

    Read the article

  • C# property definition

    - by Sunny
    For C# properties, I can do this: public class Employee{ public string Name { get; private set; } public Employee(string name){ Name = name; } } which means that the Name property can be set within the class Employee & can be read publicly. But, if I want to restrict the set to only within the constructors of the Employee class, I need to do: public class Employee{ public readonly string Name = String.Empty; public Employee(string name){ Name = name; } } But, for this case, I had to change the property to a field. Is there any reason this is not possible/allowed in C#: public class Employee{ public string Name { get; private readonly set; } public Employee(string name){ Name = name; } } IMO this will allow us to have properties which can be set only in the constructor & does not require us to change properties to fields... Thanks!

    Read the article

  • unix message queue

    - by Betamoo
    Is there an ipc option to get the last message in message queue but not removing it? I want this to allow many clients reading same messages from the same server.. Thanks

    Read the article

  • Statements and state

    - by FredOverflow
    Is there any deeper meaning in the fact that the word "statement" starts with the word "state", or is that just a curious coincidence? Note that english is not my native language, so the answer might be obvious to you, but not me ;)

    Read the article

  • Searching for patterns to create a TCP Connection Pool for high performance messaging

    - by JoeGeeky
    I'm creating a new Client / Server application in C# and expect to have a fairly high rate of connections. That made me think of database connection pools which help mitigate the expense of creating and disposing connections between the client and database. I would like to create a similar capability for my application and haven't been able to find any good examples of how to apply this pattern. Do I really need to spin up an instance of a TcpClient every time I want to send a message to the server and receive a receipt message? Each connection is expected to transport between 1-5KB with each receiving a 1KB response message. I realize this question is somewhat vague, but I am starting from scratch so I am open to suggestions. Even if that means my suppositions are all wrong.

    Read the article

  • XCode and developer tools

    - by Infinity
    Hello guys! I want to use the FileMerge utility on my mac, but it isn't installed. I searched in the google and there is written that it will be installed with the developer tools. So the big question is where can I find the developer tools, because I downloaded the iPhone SDK 3.2 beta 5, and installed it, but I can't found the download location of developer tools. Maybe can you help me?

    Read the article

  • Data retrieval error in Jquery

    - by Ben
    I'm trying to retrieve data from a php file named return that contains <?php echo 'here is a string'; ?>. I'm doing this through an html file containing ` div { color:blue; } span { color:red; } var x; $.get("return.php", function(data){ x = data; }) function showAlert() {alert(x);} $(document).ready(function(){ alert(x); }); ` When the button is clicked it retrieves and displays the code fine, but on the page loading, it displays "undefined" instead of the data in return.php. Any solutions?

    Read the article

  • How to number the ls output in unix?

    - by Snehal
    I am trying to write a file with format - "id file_absolute_path" which basically lists down all the files recursively in a folder and give an identifier to each file listed like 1,2,3,4. I can get the absolute path of the files recursively using the following command: ls -d -1 $PWD/**/*/* However, I am unable to give an identifier from the output of the ls command. I am sure this can be done using awk, but can't seem to solve it.

    Read the article

  • Apply a Quartz filter while saving PDF under Mac OS X 10.6.3

    - by olpa
    Using Mac OS X API, I'm trying to save a PDF file with a Quartz filter applied, just like it is possible from the "Save As" dialog in the Preview application. So far I've written the following code (using Python and pyObjC, but it isn't important for me): -- filter-pdf.py: begin from Foundation import * from Quartz import * import objc page_rect = CGRectMake (0, 0, 612, 792) fdict = NSDictionary.dictionaryWithContentsOfFile_("/System/Library/Filters/Blue \ Tone.qfilter") in_pdf = CGPDFDocumentCreateWithProvider(CGDataProviderCreateWithFilename ("test .pdf")) url = CFURLCreateWithFileSystemPath(None, "test_out.pdf", kCFURLPOSIXPathStyle, False) c = CGPDFContextCreateWithURL(url, page_rect, fdict) np = CGPDFDocumentGetNumberOfPages(in_pdf) for ip in range (1, np+1): page = CGPDFDocumentGetPage(in_pdf, ip) r = CGPDFPageGetBoxRect(page, kCGPDFMediaBox) CGContextBeginPage(c, r) CGContextDrawPDFPage(c, page) CGContextEndPage(c) -- filter-pdf.py: end Unfortunalte, the filter "Blue Tone" isn't applied, the output PDF looks exactly as the input PDF. Question: what I missed? How to apply a filter? Well, the documentation doesn't promise that such way of creating and using "fdict" should cause that the filter is applied. But I just rewritten (as far as I can) sample code /Developer/Examples/Quartz/Python/filter-pdf.py, which was distributed with older versions of Mac (meanwhile, this code doesn't work too): ----- filter-pdf-old.py: begin from CoreGraphics import * import sys, os, math, getopt, string def usage (): print ''' usage: python filter-pdf.py FILTER INPUT-PDF OUTPUT-PDF Apply a ColorSync Filter to a PDF document. ''' def main (): page_rect = CGRectMake (0, 0, 612, 792) try: opts,args = getopt.getopt (sys.argv[1:], '', []) except getopt.GetoptError: usage () sys.exit (1) if len (args) != 3: usage () sys.exit (1) filter = CGContextFilterCreateDictionary (args[0]) if not filter: print 'Unable to create context filter' sys.exit (1) pdf = CGPDFDocumentCreateWithProvider (CGDataProviderCreateWithFilename (args[1])) if not pdf: print 'Unable to open input file' sys.exit (1) c = CGPDFContextCreateWithFilename (args[2], page_rect, filter) if not c: print 'Unable to create output context' sys.exit (1) for p in range (1, pdf.getNumberOfPages () + 1): #r = pdf.getMediaBox (p) r = pdf.getPage(p).getBoxRect(p) c.beginPage (r) c.drawPDFDocument (r, pdf, p) c.endPage () c.finish () if __name__ == '__main__': main () ----- filter-pdf-old.py: end

    Read the article

  • How to find minimum weight with maximum cost in 0-1 Knapsack algorithm?

    - by Nitin9791
    I am trying to solve a spoj problem Party Schedule the problem statement is- You just received another bill which you cannot pay because you lack the money. Unfortunately, this is not the first time to happen, and now you decide to investigate the cause of your constant monetary shortness. The reason is quite obvious: the lion's share of your money routinely disappears at the entrance of party localities. You make up your mind to solve the problem where it arises, namely at the parties themselves. You introduce a limit for your party budget and try to have the most possible fun with regard to this limit. You inquire beforehand about the entrance fee to each party and estimate how much fun you might have there. The list is readily compiled, but how do you actually pick the parties that give you the most fun and do not exceed your budget? Write a program which finds this optimal set of parties that offer the most fun. Keep in mind that your budget need not necessarily be reached exactly. Achieve the highest possible fun level, and do not spend more money than is absolutely necessary. Input The first line of the input specifies your party budget and the number n of parties. The following n lines contain two numbers each. The first number indicates the entrance fee of each party. Parties cost between 5 and 25 francs. The second number indicates the amount of fun of each party, given as an integer number ranging from 0 to 10. The budget will not exceed 500 and there will be at most 100 parties. All numbers are separated by a single space. There are many test cases. Input ends with 0 0. Output For each test case your program must output the sum of the entrance fees and the sum of all fun values of an optimal solution. Both numbers must be separated by a single space. Example Sample input: 50 10 12 3 15 8 16 9 16 6 10 2 21 9 18 4 12 4 17 8 18 9 50 10 13 8 19 10 16 8 12 9 10 2 12 8 13 5 15 5 11 7 16 2 0 0 Sample output: 49 26 48 32 now I know that it is an advance version of 0/1 knapsack problem where along with maximum cost we also have to find minimum weight that is less than a a given weight and have maximum cost. so I have used dp to solve this problem but still get a wrong awnser on submission while it is perfectly fine with given test cases. My code is typedef vector<int> vi; #define pb push_back #define FOR(i,n) for(int i=0;i<n;i++) int main() { //freopen("input.txt","r",stdin); while(1) { int W,n; cin>>W>>n; if(W==0 && n==0) break; int K[n+1][W+1]; vi val,wt; FOR(i,n) { int x,y; cin>>x>>y; wt.pb(x); val.pb(y); } FOR(i,n+1) { FOR(w,W+1) { if(i==0 || w==0) { K[i][w]=0; } else if (wt[i-1] <= w) { if(val[i-1] + K[i-1][w-wt[i-1]]>=K[i-1][w]) { K[i][w]=val[i-1] + K[i-1][w-wt[i-1]]; } else { K[i][w]=K[i-1][w]; } } else { K[i][w] = K[i-1][w]; } } } int a1=K[n][W],a2; for(int j=0;j<W;j++) { if(K[n][j]==a1) { a2=j; break; } } cout<<a2<<" "<<a1<<"\n"; } return 0; } Could anyone suggest what am I missing??

    Read the article

  • How to simulate a dial-up connection for testing purposes?

    - by mawg
    I have to code a server app where clients open a TCP/IP socket, send some data and close the connection. The data packets are small < 100 bytes, however there is talk of having them batch their transactions and send multiple packets. How can I best simulate a dial-up ut connection (using Delphy & Indy components, just FYI)? Is it as simple as open connection wait a while (what is the definition of "a while"?) close connection

    Read the article

  • Too many open connections... Did I mess up something?

    - by Legend
    I am developing a plugin (for a Bittorrent client named Azureus programmed in Java) that lets me add peers into the current list from which it is downloading. Everything was working fine until yesterday when I started getting these weird errors: DEBUG::Thu Apr 15 10:45:40 CET 2010::org.gudy.azureus2.core3.peer.impl.control.PEPeerControlImpl::addPeer::795: Injected peer 90.35.126.126:33064 was not added - Too many connections DEBUG::Thu Apr 15 10:48:40 CET 2010::org.gudy.azureus2.core3.peer.impl.control.PEPeerControlImpl::addPeer::795: Injected peer 80.25.126.126:33064 was not added - Too many connections DEBUG::Thu Apr 15 10:52:40 CET 2010::org.gudy.azureus2.core3.peer.impl.control.PEPeerControlImpl::addPeer::795: Injected peer 90.35.126.126:33064 was not added - Too many connections I am thinking I messed up something with the TCP sockets. Does anyone know why this could be happening?

    Read the article

  • Using static variable in function vs passing variable from caller

    - by Patrick
    I have a function which spawns various types of threads, one of the thread types needs to be spawned every x seconds. I currently have it like this: bool isTime( Time t ) { return t >= now(); } void spawner() { while( 1 ) { Time t = now(); if( isTime( t ) )//is time is called in more than one place in the real function { launchthread() t = now() + offset; } } } but I'm thinking of changing it to: bool isTime() { static Time t = now(); if( t >= now() ) { t = now() + offset; return true; } return false; } void spawner() { if( isTime() ) launchthread(); } I think the second way is neater but I generally avoid statics in much the same way I avoid global data; anyone have any thoughts on the different styles?

    Read the article

  • What language/compiler for native running of application in any windows platform?

    - by Xinxua
    Hi, I want to develop an application that runs on any windows platform (XP, Vista, 7) but does not require a dependency like .NET Framework or JVM. I have given the other requirements below: Runs in any windows platform Must have GUI libraries to create windows/primitive controls I also want the output file size of the application to be minimal (So cannot include .net frameword etc in the exe file) Any suggestions for this requirement?

    Read the article

  • What's a way for a client to automatically resolve the ip address of a server?

    - by zooropa
    The project I am working on is a client/server architecture. In a LAN environment, I want the client's to be able to automatically determine the server's address. I want to avoid having to manually configure each client with the ip address of the server. What is the best way to do this? Some alternatives I have thought about doing are: The server could listen for broadcast packets from the clients. The message from the client would be a request for the IP address of the server. The server would respond with its address. The machine running my project's server could also have a bind server running. The LAN's router could be configured to use it as one of its DNS servers. I think I saw that there is a bind library. Does that mean I can build the bind service into my server so that bind doesn't have to be installed on the server? Any other ideas? What have you done in the past? What are the pros/cons of these approaches and others that might be suggested? Thanks for your help!

    Read the article

  • Summer Camp TextMate theme

    - by Frankie Laguna
    A while back on the User Submitted Themes wiki page on the TextMate site there was a link to the theme "Summer Camp", the entry is still there but the link no longer works. I'm wondering if anyone has this theme and is willing to share? Thanks in advance.

    Read the article

< Previous Page | 163 164 165 166 167 168 169 170 171 172 173 174  | Next Page >