Search Results

Search found 271 results on 11 pages for 'jian zhang()'.

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

  • 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 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 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

  • 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

  • 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

  • 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

  • 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

  • Windows 7 Windows XP mode cannot run - it says "Require Hardware Assisted Virtualization"

    - by Jian Lin
    After installing the 2 files for Windows 7 Windows XP mode, the Start Menu now has Windows Virtual PC Windows XP Mode but clicking on the first merely brings out a folder, and clicking on the second brings out a dialog box that says: "Require Hardware Assisted Virtualization" Does that mean the machine cannot support Windows 7 Windows XP mode? I am running Win 7 Ultimate 64 bit edition. This is the dialog box: Update: the computer is an HP TouchSmart, with American Megatrends BIOS v02.61. I looked into the BIOS set up but it is quite simple and dosen't have something for "hardware assisted virtualization". The CPU is Intel Core 2 Duo T5750.

    Read the article

  • Can any web-based email program let user paste an image (not link) as part of the email instead of a

    - by Jian Lin
    I think back in the old days, some email programs let users Paste an image right inside the email content. (maybe WinMail or Outlook?) So for example, we can write some text, embed an image, and then write some more text, and embed another image. The recipient will get the email content in the above text-image-text-image order (instead of having all images attached at the end of email) Can any web-based email program do that? Note that the image is not just a link, but a complete file. For example, Gmail lets us paste an image, but it is actually just a link to some web location. Can the actual file content be embedded instead?

    Read the article

  • On Windows 7, dir or tree can't show unicode characters, even starting cmd with cmd /U

    - by Jian Lin
    On Windows 7, dir or tree can't show unicode characters, even starting cmd with cmd /U So I would press Window Key + R to run something, and type in cmd /U so that the content might handle Unicode. And then using dir or tree /F, the content in Unicode won't show as Unicode. (in Window Explorer (file manager), the Unicode will show) Is there a way to handle it? To get Unicode characters to test your filenames, you can go to http://news.google.com/news?edchanged=1&ned=tw and you will be able to get many Unicode characters there (UTF-8)

    Read the article

  • How does a hard drive compare to Flash memory working as a hard drive in terms of speed?

    - by Jian Lin
    Some experiment I did with hard drive read/write speed was 10MB/s write and 40MB/s read, and with a USB Flash drive, it can be 5MB/s write and 10MB/s read. Also, if I put a virtual hard drive .vhd file in a hard drive or in a USB Flash drive and try a Virtual Machine using it, the one using the hard drive is quite fast, while the one using the USB Flash drive is close to not usable. So I wonder some early netbooks use 4GB or 8GB flash memory as the hard drive, and even the Apple Mac Air has an option of using flash memory instead of a hard drive. But in those situation, will the speed be slower than using a hard drive, like in the case of a USB Flash drive?

    Read the article

  • How can a Virtual PC with Win XP install the East Asian Language? (or does any browser come with Chi

    - by Jian Lin
    How can a Virtual PC with Win XP on it install the East Asian Language? (or does any browser come with Chinese fonts?) After setting up a virtual PC with Win XP, if Chinese font is needed, then the usual way is to go to the Control Panel, select "Regional and Language" and go to the second tab and check the box "Install Files for East Asian Languages". After clicking OK, it asks for the file cplexe.exe on the XP SP3 CD 3... and is said to be about 230MB... In such case, how can the language pack or fonts be installed? (Update: I found that it is true for Window 7's Virtual PC with XP on it, as well as the XP SP3 with IE 8 that can be downloaded in the link below.) (I downloaded the virtual hard drive file .vhd from http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&displaylang=en so there is no "CD 3"... there) Or does any browser come with all the unicode fonts without needing the OS to support it?

    Read the article

  • How practical is using a Wireless-N router together with a B and G router?

    - by Jian Lin
    I hope to use a Wireless N router to boost up the speed of wireless Internet, but there are some device that probably only supports B or G, such as iPhone, iPad, Wii, so if it is to replace the existing Wireless-B/G router, then some device won't work. Is it practical to buy a Wireless-N router, and then just plug the existing wireless router to it, or if I am using AT&T's u-verse, which has a central Wireless-B/G router, then plug in a new Wireless-N router into it?

    Read the article

  • What is the best / latest software to convert DVD recorder disc to YouTube?

    - by Jian Lin
    I recorded some Wii gameplay to a DVD-R using a DVD recorder, and tried using Handbrake to convert it to YouTube compatible format. Basically, it needs resizing to 16:9, and selecting 00:03 to 3:10 of the chapter (out of the 7 minutes). It seems Handbrake can't do it for 480p... and if using AutoGK and then VirtualDub to resize and do video time selection, it feels so old school (autogk not updated since 2005)... Windows Movie Maker seems like 15fps video quality... Is there a way to do it nicely? Details if using Handbrake: I can't find a way to convert a DVD recorded video which is 720 x 480 (Wii Gameplay in 16 : 9 ratio) into 852 x 480... It seems that the only possible resize is to shrink but not to expand? It is fine to make it 720 x 406... except YouTube won't be able to show it as 480p... If it can be made 852 x 480, then YouTube can at least show it as 480p (besides 360p and 240p)... is there any way to do it? thanks.

    Read the article

  • Why does Chrome choke more often than IE 8 and Firefox?

    - by Jian Lin
    On my system, Chrome chokes quite more often than IE 8 or Firefox -- it searched for the website for 20 seconds and then said website not found. I wonder if it could be due to DNS issue or different browsers use different method to connecting to the internet (as Fiddler works for some browser and not for some)? any method to fix it? (the ISP here is AT&T u-verse, if it matters). thanks.

    Read the article

  • How to save QuickTime movie trailer files?

    - by Jian Lin
    Is it true that a few months ago, QuickTime allows users to save the movie trailers without using the Pro version? Right now, it seems like we need to pay $29.99 to save the movie trailer clip onto the hard drive... Several months ago, I also tried using Ubuntu and there was a plugin to view the movie trailer and was able to save it too... Are there other ways to save it to the hard drive?

    Read the article

  • How to "Un-Eject" a USB Flash drive -- Eject is easy (safely remove hardware), but what about Un-Eje

    - by Jian Lin
    There are times after I eject a USB Flash drive, I want to copy some more files over to the USB Flash drive. In this case, do I always need to unplug the drive and plug it back in? Is there a way to "reconnect" or "un-eject" the drive? To eject, that are two ways: 1) Right Click the drive (say H:) and choose Eject 2) Click "Safely remove hardware" from the icon tool But there seems to be no way to un-eject or reconnect a drive.

    Read the article

  • How to make Windows 7 machine allocate a lot of hard disk cache?

    - by Jian Lin
    I am recording some game play capture (recording playing of PS3 or Wii) using a PC with Windows 7 and Hauppauge 1212 HD Recorder, and I have 4GB of RAM... is there a way to increase the size of Windows 7's hard disk cache size so that writing to the hard drive can be super fast? Since there is at least 1.5GB of RAM not being used, something like allocating 1GB just as hard disk cache, is it possible?

    Read the article

  • can Dell netbooks with HDTV tuner drive HDMI output to 1920 x 1080 HDTV, and does any other brand of

    - by Jian Lin
    It has been a while that Dell netbook offered an internal HDTV tuner, and it always seem like Dell is the only one that has an internal HDTV tuner? And actually, does anyone have experience with it, since the processor is very basic, can it handle smooth HDTV on screen full size, and especially for the Dell mini 1010, it can output to HDMI, so can it drive an HDTV that is 1920 x 1080? thanks.

    Read the article

  • How to enable Chess 3D on Ubuntu 9.10?

    - by Jian Lin
    The 3D cannot be easily enabled. A thread that people refer to is http://ubuntuforums.org/showthread.php?t=416660 but I tried several suggestions on that thread and it doesn't work yet. The message is: No Python OpenGL support No Python GTKGLExt support

    Read the article

  • Display aspect ratio problem on netbooks?

    - by Jian Lin
    Last night in a computer store with the midnight sale of Windows 7, I see many netbooks, all are 1024 x 600 resolution. Then when the CPU meter and the Clock gadget were added, the CPU meter looked spherical, but the clock (the second clock -- the silver one) looked somewhat oval. Later on I went to all the desktops and both the CPU meter and the clock were spherical. So do the netbook have this "aspect ratio" problem? It is not a big deal but it'd be nice to know if I get a netbook and know that it is common on the netbook. (and aware that the picture and photos will be slightly distorted). Update: All the netbooks were at 1024 x 600, which was their "native" resolution. Every single one of them showed an oval shaped clock. None of the desktop had that issue.

    Read the article

  • How to let MSN or Yahoo Messenger set you to be Invisible or Offline when you are idle for an hour?

    - by Jian Lin
    The short question is: How do we let MSN or Yahoo Messenger set us to be Invisible or Offline when we are idle for half an hour or an hour? The reason is: if I am on 24 hours a day, some people see me as weird. Some people see my value as low, because I am always there. There are ways to set me to "Away" or "Busy" after 10 minutes, but there seems to be no way to set myself to invisible or offline after 1 hour. As I am a software developer, I am very used to turning the computer on 24 hours a day. (for example, for checking email for urgent fixes, and fix issue and push to web server). We don't turn off computer usually even when we sleep, because we may sometimes can't sleep yet and come check on the computer, or wake up in the morning and immediately need to check if everything is ok. But, my MSN and Yahoo Messenger is always on for 24 hours a day, and I found that some girls start to ask me why I am always there 24 hours a day (even though they see me as away or busy, their feeling is that I am always there). What's more, I found that since I am always there, my value actually drop in their eyes, because hard to get = high value, and always there = low value. Some people feel me as having nothing much to do, always in front of computer, or what is he doing in front of computer so much? Now since it is my job, and I need to read emails once in a while, I am in fact in front of the computer more than some other people. I am in front of the computer maybe 10 hours a day, far from 24 hours a day. Is there an easy and automatic solution to this?

    Read the article

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