Search Results

Search found 270 results on 11 pages for 'bernard chen'.

Page 9/11 | < Previous Page | 5 6 7 8 9 10 11  | Next Page >

  • python: html writer?

    - by Bin Chen
    With jquery it's very easy to insert some element inside another element using the selector technology, I am wondering if there is any python library that can do things similar with jquery, the reason is I want server side python program to produce the static pages, which needs to parse the html and insert something into it. Or other alternative, not in python language at all? EDIT: To be clear, I want to use python to write below program: h = html.parse('temp.html') h.find('#idnum').html('<b>my html generated</b>') h.close()

    Read the article

  • Is it possible to Kick off a java process under Windows Service with C#?

    - by Wing C. Chen
    I would like to wrap a java program into a windows service with C# using System.ServiceProcess.ServiceBase. So I came up with the following code: /// <summary> /// The main entry point for the application. /// </summary> static void Main() { System.ServiceProcess.ServiceBase.Run(new JavaLauncher()); } protected override void OnStart(string[] args) { Thread _thread; _thread = new Thread(StartService); _thread.Start(); base.OnStart(args); } protected override void OnStop() { Thread _thread; _thread = new Thread(StopService); _thread.Start(); base.OnStop(); } static public void StartService() { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "javaw"; proc.StartInfo.Arguments = config.generateLaunchCommand(); proc.Start(); } static public void StopService() { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "javaw"; proc.StartInfo.Arguments = "-jar stop.jar"; proc.Start(); } Firstly I had to use Threads in OnStart and OnStop. If not, an exception occurs complaining that the service is terminated because of doing nothing. Secondly, the service can be hooked up to windows smoothly. However, the service terminates a short while after it is started. I looked into the process monitor, only the service process stays alive for that short while, the javaw process never showed up, however. Is there anyone who knows how this can be fixed? It works fine in an ordinary console environment. I think it has something to do with Windows service.

    Read the article

  • Can C/C++ compiler report struct member offset

    - by Chen Jun
    Hello, everyone. I'd like to ask, can compiler(e.g. Visual C++) generate a report(.txt) telling struct member offset for a struct/all structs? If so, it helps debugging quite a lot. For example, when you read disassembler code in the debugger, it can be easier to associate an offset value to a struct member. Also, it is better to have compiler report offset of each local variable on a function stack frame(e.g. the offset relative to ebp on an X86 machine). Thank you in advance.

    Read the article

  • What's the proper way to use sqlite at xCode?

    - by Elliot Chen
    Hi, Experts: Can you please give some suggestions on sqlite using at xcode? Within my application, I use a sqlite DB to store all local data. Two methods can be used to retrieve those data during running time. 1, Load all the data into memory at initialization stage. (More memory used, less DB open/close operation needed) 2, Read corresponding records when necessary, free the occupied memory after using. (Good habit for memory using, but much DB open/close operations needs). I prefer to use method 2, but not sure whether too many DB opening/closing operations could affect app's efficiency. Or do you think I can 'upgrade' method 2 by opening DB when app launches and closing DB when app quits? Thanks for your suggestions very much!

    Read the article

  • What is Caliburn Validation abstraction

    - by Chen Kinnrot
    Recently I saw this document that specify how great is Caliburn(Not really it compares it to the micro framework, and thats enough). I'm working with Caliburn for more than a year and don't know many things about it. So maybe someone can explain the following(Some of it I can understand but have no iea about the relation to caliburn): Validation abstraction module framework ExpressionTree-Based runtime delegate generation ViewModelFactory ShellFramework I'm working with V1.1 so if something is new in 2.0, just say it belong to the new version I'll learn it probably in the future.

    Read the article

  • What should be proper location for sqlit3 database file?

    - by Elliot Chen
    Hi, Everyone: I'm using a sqlite3 database to store app's data. Instead of building a database within program, I introduced an existing db file: 'abc.sqlite' into my project and put it under my 'Resources' folder. So, I think this db file should be inside of 'bundle', so at my init function, I used following statement to read it out: NSString *path = [[NSBundle mainBundle] pathForResource:@"abc" ofType:"sqlite"]; if(sqlite3_open([path UTF8String], &database) != SQLITE_OK) ... It's ok that this db can be opened and data can be retrieved from it. BUT, someone told me that it's better to copy this db file into user folder: such as 'Document'. So, my question is: is it ok to use this db from main bundle directly or copy it to user folder then use that copy. Which is better? Thank you very much!

    Read the article

  • return Queryable<T> or List<T> in a Repository<T>

    - by Danny Chen
    Currently I'm building an windows application using sqlite. In the data base there is a table say User, and in my code there is a Repository<User> and a UserManager. I think it's a very common design. In the repository there is a List method: //Repository<User> class public List<User> List(where, orderby, topN parameters and etc) { //query and return } This brings a problem, if I want to do something complex in UserManager.cs: //UserManager.cs public List<User> ListUsersWithBankAccounts() { var userRep = new UserRepository(); var bankRep = new BankAccountRepository(); var result = //do something complex, say "I want the users live in NY //and have at least two bank accounts in the system } You can see, returning List<User> brings performance issue, becuase the query is executed earlier than expected. Now I need to change it to something like a IQueryable<T>: //Repository<User> class public TableQuery<User> List(where, orderby, topN parameters and etc) { //query and return } TableQuery<T> is part of the sqlite driver, which is almost equals to IQueryable<T> in EF, which provides a query and won't execute it immediately. But now the problem is: in UserManager.cs, it doesn't know what is a TableQuery<T>, I need to add new reference and import namespaces like using SQLite.Query in the business layer project. It really brings bad code feeling. Why should my business layer know the details of the database? why should the business layer know what's SQLite? What's the correct design then?

    Read the article

  • How to dump STDIN to a file, using C++ STL?

    - by Jimm Chen
    HHello all, this is a straight forward question, but not a straight forward answer can be found by just Googling today. Hope someone can show me a concise answer before I dig into those thick C++ books and finally find the solution out. Thank you. I'm writing this program so to make a workaround in this issue: Why do I get 'Bad file descriptor' when trying sys.stdin.read() in subversion pre-revprop-change py script? Note: Content from STDIN may be arbitrary binary data. Please use C++ STL functions, iostream, ifstream etc . If the file creation/writing failed, I'd like to catch the exception to know the case.

    Read the article

  • www disappear when using Name-based virtual host.

    - by Tianzhou Chen
    Below is my config file NameVirtualHost 12.34.56.78:80 ServerAdmin [email protected] ServerName domain1.com ServerAlias www.domain1.com DocumentRoot /srv/www/domain1.com/public_html1/ ErrorLog /srv/www/domain1.com/logs/error.log CustomLog /srv/www/domain1.com/logs/access.log combined ServerAdmin [email protected] ServerName domain2.com ServerAlias www.domain2.com DocumentRoot /srv/www/domain2.com/public_html1/ ErrorLog /srv/www/domain2.com/logs/error.log CustomLog /srv/www/domain2.com/logs/access.log combined The thing is when I put www.domain1.com into browser, it will be automatically changed to domain1.com. However, if I put www.domain2.com, the address remains the same. I don't know why this happens. BTW, I haven't put .htaccess file under their document root. Thanks for your advice! Tianzhou

    Read the article

  • Manage dirty rect efficiently

    - by Tianzhou Chen
    Hi all, I am implementing a view system and I want to keep track of all the dirty rects. It seems my dirty rect management is a bottleneck for the whole system. On one hand, invalidating the bounding box of the dirty region seems to be an easy approach. But in the situation like this: Say I have a client area of 100x100; I have a dirty rect with (0, 0, 1, 1) and another dirty rect with (99, 99, 1, 1). Invalidating the bounding box which turns out to be 100x100 is not efficient at all. So I want to ask if someone can give any hint or give me a link of the related literatures. Thanks in advance!

    Read the article

  • action script dynamic type?

    - by Bin Chen
    I am curious about code in my action script project: public var _p:Object ... in a function: public function WObject(pp:MovieClip) { _p = pp; _p.Play(); } The Play() function is in MovieClip but not Object, can action script allow such syntax?

    Read the article

  • What are the suggested alternatives for Class<T>.isAssignableFrom(Class<?> cls)?

    - by Wing C. Chen
    Currently I am doing the profiling to a piece of code. During the profiling, I discovered that this very method call, Class<T>.isAssignableFrom(Class<?> cls) takes up to quite amount of the entire time. Because this is a method from reflection, it takes a lot of time compared to normal keywords or method calls. I am wondering if there are some good alternatives for this method calls?

    Read the article

  • How I can ask a specify Name Server to have the IP of a domain

    - by Yuan Chen
    For example, I have a domain name example.com hosted at some host free, and now I want to know where is the IP of the host. so I can't configure the registrar control panel to point to that IP. So is there any way to know that IP, without configure the name server to point to it. and I know the Name Server of the hosting. for example ns1.hosting.com can I ask the specify ns1.hosting.com to get the IP of example.com Thanks

    Read the article

  • UIImageView and UIScrollView load lot of pictures

    - by Allan.Chen
    In my app, i use UIImageView and UIScrollView to show lot of pictures(Every time there are about 20 pictures and every pictures about 600px*500px and size is about 600KB ), i use for this code to do this function. Here is code: //Here is pictures Data; self.klpArry = self.pictureData; CGSize size = self.klpScrollView1.frame.size; for (int i=0; i < [klpArr count]; i++) { UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake((size.width * i)+300, 20, 546, 546)]; NSString *filePath = [[NSBundle mainBundle] pathForResource:[klpArr objectAtIndex:i] ofType:@"jpg"]; UIImage *imageData = [[UIImage alloc]initWithData:[NSData dataWithContentsOfFile:filePath]]; [iv setImage:imageData]; iv.backgroundColor = [UIColor grayColor]; [self.klpScrollView1 addSubview:iv]; imageData = nil; iv = nil; iv.image = nil; filePath = nil; [imageData release]; [filePath release]; [iv release]; } // show the picture in scrollview; [self.klpScrollView1 setContentSize:CGSizeMake(size.width * numImage, size.height)]; self.klpScrollView1.pagingEnabled = YES; self.klpScrollView1.showsHorizontalScrollIndicator = NO; self.klpScrollView1.backgroundColor = [UIColor grayColor]; But everytime i init this function, the memory will increase about 5MB, Actually i release UIImageView, UIimage and UIScrollView (vi.image=nil,[vi release]) but i doesn't work, it can't release the memory. BTW, i use my friend code first vi.image=nil then vi=nil; but the pictures not to show on scrollview. any one can help me ?? Thx ~~

    Read the article

  • Makefile automatic link dependency ?

    - by Kuang Chen
    It's easy to let program figure out the dependency at compile time, (with gcc -MM). Nevertheless, link dependency (deciding which libraries should be linked to) seems to be difficult to figure out. This issue become emergent when multiple targets with individual libraries to link to are needed. For instance, three dynamic library targets t1.so, t2.so and t3.so needs to be built. t1.so needs math library (-lm), while t2 and t3 don't. It would be tedious to write separate rules. A single rule requiring the three targets linked with math library saves the trouble. However, it causes inflation of target size since math library is unused for t2.so and t3.so. Any ideas?

    Read the article

  • Selecting the 2nd row in sql

    - by Alex Chen
    I want to select the second row only from the table. From the ClientUserName column. SELECT ClientUserName, DestHost, count(DestHost) counts FROM #ProxyLog_record WHERE ClientUserName = (Select top 1 ClientUserName from #ProxyLog_count_2) GROUP BY ClientUserName, DestHost ORDER BY counts DESC The (Select top 1 ClientUserName from #ProxyLog_count_2) shows top 1 only but I need to get the 2nd data from that table. How can I do this?

    Read the article

  • AS3: why is this happening?

    - by Bin Chen
    Hi, I just encounter a strange problem: var a:ClassA = new ClassA; var b:ClassA = a; The program keeps running sometime, the a = null, b = null. The program is a complex one, I am sure that no part will touch a, and b. My question is, will the runtime(garbage collector) to collect the memory of "a" and then assign a and b to null? I am confused, thanks!

    Read the article

  • How can I ask Hibernate to create an index on a foreign key (JoinColumn)?

    - by Kent Chen
    Hi, This is my model. class User{ @CollectionOfElements @JoinTable(name = "user_type", joinColumns = @JoinColumn(name = "user_id")) @Column(name = "type", nullable = false) private List<String> types = new ArrayList<String>(); } You can imagin there would be a table called "user_type", which has two columns, one is "user_id", the other is "type". And when I use hbm2ddl to generate the ddls, I can have this table, along with the foreign key constraint on "user_id". However, there is no index of this for this column. And I need this index. How can I let hibernate to generate this index for me? Thank you!

    Read the article

  • What are alternatives to Win32 PulseEvent() function?

    - by Bill
    The documentation for the Win32 API PulseEvent() function (kernel32.dll) states that this function is “… unreliable and should not be used by new applications. Instead, use condition variables”. However, condition variables cannot be used across process boundaries like (named) events can. I have a scenario that is cross-process, cross-runtime (native and managed code) in which a single producer occasionally has something interesting to make known to zero or more consumers. Right now, a well-known named event is used (and set to signaled state) by the producer using this PulseEvent function when it needs to make something known. Zero or more consumers wait on that event (WaitForSingleObject()) and perform an action in response. There is no need for two-way communication in my scenario, and the producer does not need to know if the event has any listeners, nor does it need to know if the event was successfully acted upon. On the other hand, I do not want any consumers to ever miss any events. In other words, the system needs to be perfectly reliable – but the producer does not need to know if that is the case or not. The scenario can be thought of as a “clock ticker” – i.e., the producer provides a semi-regular signal for zero or more consumers to count. And all consumers must have the correct count over any given period of time. No polling by consumers is allowed (performance reasons). The ticker is just a few milliseconds (20 or so, but not perfectly regular). Raymen Chen (The Old New Thing) has a blog post pointing out the “fundamentally flawed” nature of the PulseEvent() function, but I do not see an alternative for my scenario from Chen or the posted comments. Can anyone please suggest one? Please keep in mind that the IPC signal must cross process boundries on the machine, not simply threads. And the solution needs to have high performance in that consumers must be able to act within 10ms of each event.

    Read the article

  • TechDays 2011 : Microsoft expose sa vision de « la vie du futur » avec les interfaces naturelles, l'école et le bureau de 2015-2020

    TechDays 2011 : Microsoft expose sa vision de « la vie du futur » Avec les interfaces naturelles, l'école et le bureau de 2015-2020 Le troisième jour des Techdays s'est résolument placé sous le signe des tendances numériques qui seront au coeur de notre quotidien, dans la vision du futur de Microsoft, à l'horizon 2015-2020. « L'informatique de demain sera une informatique intuitive, grâce notamment aux nouvelles interfaces naturelles.» explique Bernard Ourghanlian. « L'ordinateur se met toujours plus à notre service. Il interprète nos comportements, il anticipe, il agit en notre nom.» souligne-t-il. « Avec le développement de capteurs évolués, nos bras, nos mains,...

    Read the article

< Previous Page | 5 6 7 8 9 10 11  | Next Page >