Search Results

Search found 317 results on 13 pages for 'spirit zhang'.

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

  • how to adjust the default width of taglist window in vim

    - by Haiyuan Zhang
    The default width of taglist window is too narrow for me and sometimes I can't see the whole function name in the window so I'd like to adujct the width of the window. I know use ctr-w > or ctr-w < I can adjust the window manually , but really want to change the default value of the taglisst window. so how I can actually do it ? thansk in advance.

    Read the article

  • how to store a file handle in perl class

    - by Haiyuan Zhang
    please look at the following code first. #! /usr/bin/perl package foo; sub new { my $pkg = shift; my $self = {}; my $self->{_fd} = undef; bless $self, $pkg; return $self; } sub Setfd { my $self = shift; my $fd = shift; $self_->{_fd} = $fd; } sub write { my $self = shift; print $self->{_fd} "hello word"; } my $foo = new foo; My intention is to store a file handle within a class using hash. the file handle is undefined at first, but can be initilized afterwards by calling Setfd function. then write can be called to actually write string "hello word" to a file indicated by the file handle, supposed that the file handle is the result of a success "write" open. but, perl compiler just complains that there are syntax error in the "print" line. can anyone of you tells me what's wrong here? thanks in advance.

    Read the article

  • [Three20] How to adjust width of TTStyledTextLabel ?

    - by Chi Zhang
    Hi I am implementing an IM app on iOS. I found that three20 library has a TTStyledTextLabel which provides cool features like showing images and url links. However I want to embed the TTStyledTextLabel in a message bubble (just like the sms app shipped with iphone does), where I need the label to adjust its size according to the text length. I found that TTStyledTextLabel can adjust its height according to its width, but I don't know how to make it shrink horizontally when the text is very short and can't fill up a whole line. Any suggestions?

    Read the article

  • why can't i bind ipv6 socket to a linklocal address

    - by Haiyuan Zhang
    #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> void error(char *msg) { perror(msg); exit(0); } int main(int argc, char *argv[]) { int sock, length, fromlen, n; struct sockaddr_in6 server; struct sockaddr_in6 from; int portNr = 5555; char buf[1024]; length = sizeof (struct sockaddr_in6); sock=socket(AF_INET6, SOCK_DGRAM, 0); if (sock < 0) error("Opening socket"); bzero((char *)&server, length); server.sin6_family=AF_INET6; server.sin6_addr=in6addr_any; server.sin6_port=htons(portNr); inet_pton( AF_INET6, "fe80::21f:29ff:feed:2f7e", (void *)&server.sin6_addr.s6_addr); //inet_pton( AF_INET6, "::1", (void *)&server.sin6_addr.s6_addr); if (bind(sock,(struct sockaddr *)&server,length)<0) error("binding"); fromlen = sizeof(struct sockaddr_in6); while (1) { n = recvfrom(sock,buf,1024,0,(struct sockaddr *)&from,&fromlen); if (n < 0) error("recvfrom"); write(1,"Received a datagram: ",21); write(1,buf,n); n = sendto(sock,"Got your message\n",17, 0,(struct sockaddr *)&from,fromlen); if (n < 0) error("sendto"); } } when I compile and run the above code I got : binding: Invalid argument and if change to bind the ::1 and leave other thing unchanged in the source code, the code works! so could you tell me what's wrong with my code ? thanks in advance.

    Read the article

  • how to find files in a given branch

    - by Haiyuan Zhang
    I noticed that when doing code view, people here in my company usually just give the branch in which his work is done, and nothing else. So I guess there must be a easy way to find out all the files that has a version in the given branch which is the same thing to find all the files that has been the changed. Yes, I don't know the expected "easy way" to find files in certain branch, so need your help and thanks in advance.

    Read the article

  • Is it possible to mix a named pipe with select in perl?

    - by Haiyuan Zhang
    I need to write a daemon that supposed to have one TCP socket and one named pipe. Usually if I need to implement a multi IO server with "pure" sockets, the select based multi-IO model is always the one I will choose. so does anyone of you have ever used named pipe in select or you can just tell me it is impossible. thanks in advance.

    Read the article

  • Return lines in input code causing gaps/whitespace between elements in output?

    - by Jenny Zhang
    I am trying to put images next to each other on a webpage. Here is my HTML: <img class="pt" src="Yellow Tulip.jpg" title="Yellow Tulip" alt="Yellow Tulip" /> <img class="pt" src="Pink Tulip.jpg" title="Pink Tulip" alt="Pink Tulip" /> <img class="pt" src="Purple Tulip.jpg" title="Purple Tulip" alt="Purple Tulip" /> However, on my webpage, this shows a gap between each image. I've noticed that once I remove the return line that makes the elements separate and readable and instead just put all the elements on one line, the gaps go away. <img class="pt" src="Yellow Tulip.jpg" title="Yellow Tulip" alt="Yellow Tulip" /><img class="pt" src="Pink Tulip.jpg" title="Pink Tulip" alt="Pink Tulip" /><img class="pt" src="Purple Tulip.jpg" title="Purple Tulip" alt="Purple Tulip" /> Is there anyway I can achieve the output of the latter but still have the code/input look like the former? I really like the readability that the return lines (enter spaces) bring to the code, but I don't want the whitespace it creates on the actual page. If someone could explain why this is and/or how to fix it, I'd be really grateful! :)

    Read the article

  • Manage bad_alloc exception in C++ construtor

    - by Jimmy zhang
    I have Java experience and recently am doing some C++ coding. My question is that if I have class A, in which I have to instantiate class B and class C as two of the member variables of A. If in the constructor of A, should I assume that allocations of class B and C never fail, and handle the bad allocation exception in the destructor of A? If I don't make that assumption, meaning that I add some try catch block to catch bad_alloc of class B and class C, then if the allocation exception occurs, should I do clean up in the constructor of A? What are the recommended practices? If "new" generates a bad allocation, what value does the pointer carry?

    Read the article

  • why does perl allow mutually "use" relationship between modules

    - by Haiyuan Zhang
    let's say there two modules mutualy use each othe as: package a; use b; sub p {} 1; package b; use a; 1; I think symatically it's wrong to wrote code like the above code, cus the two modules will endlessly copy each other's code to themselves...but I can successfully run the following code, which makes me very surprised. so could any of you explain all of this to me? #! /usr/bin/perl use a; a->p();

    Read the article

  • Drupal 6 fails to build menu router and links

    - by Xinglin Zhang
    When I enable a new menu in Drupal (for example, mymodule), Drupal should be able to get the menu items from mymodule_menu (hook_menu), process the items and insert the menu items to menu_router and menu_links page. However, my Drupal fails to do so. Each time I enable a module (written by me or modules contributed by others, or core modules), Drupal does not seem to get the new information. The menu items defined in the newly enabled module are not processed and inserted to Drupal's menu system. That means the newly enabled module has no chance to work-- because it's inaccessible. I did fix this by manually insert the menu item information for the new module into the menu_router and menu_links table and the new menu started working. But this is a nightmare if I have to do this each time I enable a module. Any one has ever had the same problem? How to fix this? Thank you in advance.

    Read the article

  • are there any good timer implementation in perl

    - by Haiyuan Zhang
    I'm looking for good timer implementation in perl. The situation I met is like: I need to keep track of I/O activities of many files and for thoes files keep untouched for enough time a remove action will be taken upon them, so an efficient timer implementation is really vital for the app I'm involved right now. To avoid recreate the wheel, ask you guys for help first.

    Read the article

  • how to install a file handle in perl class

    - by Haiyuan Zhang
    please looku up the following code first. #! /usr/bin/perl package foo; sub new { my $pkg = shift; my $self = {}; my $self->{_fd} = undef; bless $self, $pkg; return $self; } sub Setfd { my $self = shift; my $fd = shift; $self_->{_fd} = $fd; } sub write { my $self = shift; print $self->{_fd} "hello word"; } my $foo = new foo; My intention is to store a file handle within a class using hash. the file handle is undefined at first, but can be initilized afterwards by calling Setfd function. then write can be called to actually write string "hello word" to a file indicated by the file handle, supposed that the file handle is the result of a success "write" open. but, perl compiler just complains that there are syntax error in the "print" line. can anyone of you tells me what's wrong here? thanks in advance.

    Read the article

  • why doesn't perl sort the hash key in numeric order ?

    - by Haiyuan Zhang
    #!/usr/bin/perl use strict; use warnings; my %hash; foreach ( 1 .. 10 ) { $hash{$_} = $_; } foreach ( sort(keys %hash) ) { print $_ . ": " . "$hash{$_}" . "\n" ; } execute the above code, the result is as below : 1: 1 10: 10 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 Yes, I expect "10: 10" to be the last one taht is printed . So I just need someone to explain why perl give me surprise in this case.

    Read the article

  • How can I store and access a filehandle in a Perl class?

    - by Haiyuan Zhang
    please look at the following code first. #! /usr/bin/perl package foo; sub new { my $pkg = shift; my $self = {}; my $self->{_fd} = undef; bless $self, $pkg; return $self; } sub Setfd { my $self = shift; my $fd = shift; $self_->{_fd} = $fd; } sub write { my $self = shift; print $self->{_fd} "hello word"; } my $foo = new foo; My intention is to store a file handle within a class using hash. the file handle is undefined at first, but can be initilized afterwards by calling Setfd function. then write can be called to actually write string "hello word" to a file indicated by the file handle, supposed that the file handle is the result of a success "write" open. but, perl compiler just complains that there are syntax error in the "print" line. can anyone of you tells me what's wrong here? thanks in advance.

    Read the article

  • Why does Perl allow mutual "use" relationships between modules?

    - by Haiyuan Zhang
    Let's say there are two modules that mutually use each other: package a; use b; sub p {} 1; package b; use a; 1; I think that it is systematically wrong to write code like the above, because the two modules will endlessly copy each other's code to themselves, but I can successfully run the following code, which makes me very surprised. Could any of you explain all of this to me? #! /usr/bin/perl use a; a->p();

    Read the article

  • apache mod_rewrite making permanent url problem

    - by Yc Zhang
    In file .htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^\/*get_post\/(.*)$ get_post.php?slug=$0 [L] </IfModule> If I type http://example.com/get_post/abcde, I get an empty array of $_GET variable. How can I achieve the effect like this: http://example.com/get_post?slug=abcde

    Read the article

  • Cannot install ia32-lib package

    - by A British Person
    I have several programs that reuquire 32 bit packages (pointing to the ia32-lib package). However, when I try to install it, this happens. spirit@ubuntu:~$ sudo apt-get install ia32-libs Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: ia32-libs : Depends: ia32-libs-multiarch but it is not installable E: Unable to correct problems, you have held broken packages. No big whoop, packages die all the time. I tried a month later however and I still got this error, trying to install the specific package produces this error. spirit@ubuntu:~$ sudo apt-get install ia32-libs-multiarch Reading package lists... Done Building dependency tree Reading state information... Done Package ia32-libs-multiarch is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'ia32-libs-multiarch' has no installation candidate I am no Linux whizz-kid, but this seems to be that the package doesn't exist. I searched for Skype in the software centre (I was told this installs the 32-bit packages) and it does not appear in the software centre, and the downloadable from their website produces an error about - funnily enough - no 32-bit packages. Anyone who helps me will get a medal from the gods with the weight of a thousand planets. Just don't wear it for god's sake.

    Read the article

  • Pinyin Character entry on a touchscreen keyboard

    - by mmr
    The app I'm developing requires that it be deployed in China, which means that it needs to have Pinyin and Chinese character handling. I'm told that the way that our customers handle character entry is like so: Enter in the pinyin character, like 'zhang' As they enter the characters, a list of possible Chinese (Mandarin?) characters are presented to the user, like: The user will then select '1' to enter the family name that is roughly translated to 'zhang' How can I hook such programs (I believe one is called 'mspy.exe', from Microsoft, which I'm lead to believe comes with Microsoft versions of XP) into a WPF text box? Right now, the user can enter text either by using their keyboard or by using an on-screen keyboard, so I will probably need to capture the event of a keypress from either source and feed it to some OS event or to MSPY.exe or some similar program. Or is there some other way to enter pinyin and have it converted to Mandarin? Is there a program other than MSPY I should look at? EDIT: For those of you who think that this should 'just work', it does not. Chinese character entry will work just fine if entering text into notepad or the start-run menu or whatever, but it will not work in WPF. That's the key to this question: how do I enable WPF entry? There's the Google Pinyin and Sogou pinyin, but the websites are in Mandarin or Chinese or something similar and I don't read the language.

    Read the article

  • What is the best Battleship AI?

    - by John Gietzen
    Battleship! Back in 2003, (when I was 17,) I competed in a Battleship AI coding competition. Even though I lost that tournament, I had a lot of fun and learned a lot from it. Now, I would like to resurrect this competition, in the search of the best battleship AI. Here is the framework: Battleship.zip The winner will be awarded +450 reputation! The competition will be held starting on the 17th of November, 2009. No entries or edits later than zero-hour on the 17th will be accepted. (Central Standard Time) Submit your entries early, so you don't miss your opportunity! To keep this OBJECTIVE, please follow the spirit of the competition. Rules of the game: The game is be played on a 10x10 grid. Each competitor will place each of 5 ships (of lengths 2, 3, 3, 4, 5) on their grid. No ships may overlap, but they may be adjacent. The competitors then take turns firing single shots at their opponent. A variation on the game allows firing multiple shots per volley, one for each surviving ship. The opponent will notify the competitor if the shot sinks, hits, or misses. Game play ends when all of the ships of any one player are sunk. Rules of the competition: The spirit of the competition is to find the best Battleship algorithm. Anything that is deemed against the spirit of the competition will be grounds for disqualification. Interfering with an opponent is against the spirit of the competition. Multithreading may be used under the following restrictions: No more than one thread may be running while it is not your turn. (Though, any number of threads may be in a "Suspended" state). No thread may run at a priority other than "Normal". Given the above two restrictions, you will be guaranteed at least 3 dedicated CPU cores during your turn. A limit of 1 second of CPU time per game is allotted to each competitor on the primary thread. Running out of time results in losing the current game. Any unhandled exception will result in losing the current game. Network access and disk access is allowed, but you may find the time restrictions fairly prohibitive. However, a few set-up and tear-down methods have been added to alleviate the time strain. Code should be posted on stack overflow as an answer, or, if too large, linked. Max total size (un-compressed) of an entry is 1 MB. Officially, .Net 2.0 / 3.5 is the only framework requirement. Your entry must implement the IBattleshipOpponent interface. Scoring: Best 51 games out of 101 games is the winner of a match. All competitors will play matched against each other, round-robin style. The best half of the competitors will then play a double-elimination tournament to determine the winner. (Smallest power of two that is greater than or equal to half, actually.) I will be using the TournamentApi framework for the tournament. The results will be posted here. If you submit more than one entry, only your best-scoring entry is eligible for the double-elim. Good luck! Have fun! EDIT 1: Thanks to Freed, who has found an error in the Ship.IsValid function. It has been fixed. Please download the updated version of the framework. EDIT 2: Since there has been significant interest in persisting stats to disk and such, I have added a few non-timed set-up and tear-down events that should provide the required functionality. This is a semi-breaking change. That is to say: the interface has been modified to add functions, but no body is required for them. Please download the updated version of the framework. EDIT 3: Bug Fix 1: GameWon and GameLost were only getting called in the case of a time out. Bug Fix 2: If an engine was timing out every game, the competition would never end. Please download the updated version of the framework. EDIT 4: Results!

    Read the article

  • Oracle is #1 in the RDBMS Sector for 2011

    - by jgelhaus
    Gartner 2011 Worldwide RDBMS Market Share Reports 48.8% revenue share for Oracle (*) Gartner has published their market share numbers for 2011 based on total software revenues.  According to Gartner, Oracle: is #1 in worldwide RDBMS software revenue share holds more revenue share than its seven closest competitors combined grew at 18.0%, exceeding both the industry average (16.3%) and the growth rates of its closest competitors. (*) Source: Market Share: All Software Markets, Worldwide 2011 by Colleen Graham, Joanne Correia, David Coyle, Fabrizio Biscotti, Matthew Cheung, Ruggero Contu, Yanna Dharmasthira, Tom Eid, Chad Eschinger, Bianca Granetto, Hai Hong Swinehart, Sharon Mertz, Chris Pang, Asheesh Raina, Dan Sommer, Bhavish Sood, Marianne D'Aquila, Laurie Wurster and Jie Zhang. - March 29, 2012

    Read the article

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