Search Results

Search found 1034 results on 42 pages for 'chen jun'.

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

  • Should I release NSString before assigning a new value to it?

    - by Elliot Chen
    Hi, Please give me some suggestions about how to change a NSString variable. At my class, I set a member var: NSString *m_movieName; ... @property(nonatomic, retain) NSString *m_movieName; At viewDidLoad method, I assign a default name to this var: -(void)viewDidLoad{ NSString *s1 = [[NSString alloc] initWithFormat:@"Forrest Gump"]; self.m_movieName = s1; ... [s1 release]; [super viewDidLoad] } At some function, I want to give a new name to this var, so I did like: -(void)SomeFunc{ NSString *s2 = [[NSString alloc] initWithFormat:@"Brave Heart"]; //[self.movieName release]; // ??????? Should perform here? self.m_moiveName = s2; [s2 release]; } I know, NSString* var is just a pointer to an allocated memory block, and 'assign' operation will increment this memory block's using count. For my situation, should I release m_movieName before assigning a value to it? If I do not release it (via [self.movieName release]), when and where will the previous block be released? Thanks for your help very much!

    Read the article

  • bash: function + source + declare = boom

    - by Chen Levy
    Here is a problem: In my bash scripts I want to source several file with some checks, so I have: if [ -r foo ] ; then source foo else logger -t $0 -p crit "unable to source foo" exit 1 fi if [ -r bar ] ; then source bar else logger -t $0 -p crit "unable to source bar" exit 1 fi # ... etc ... Naively I tried to create a function that do: function save_source() { if [ -r $1 ] ; then source $1 else logger -t $0 -p crit "unable to source $1" exit 1 fi } safe_source foo safe_source bar # ... etc ... But there is a snag there. If one of the files foo, bar, etc. have a global such as -- declare GLOBAL_VAR=42 -- it will effectively become: function save_source() { # ... declare GLOBAL_VAR=42 # ... } thus a global variable becomes local. The question: An alias in bash seems too weak for this, so must I unroll the above function, and repeat myself, or is there a more elegant approach? ... and yes, I agree that Python, Perl, Ruby would make my file easier, but when working with legacy system, one doesn't always have the privilege of choosing the best tool.

    Read the article

  • Flex: Can I assign propertiy of multi-layer object to Chart's xField or yField?

    - by Sean Chen
    Hi, I have a question about how to assign property of a multi-layer object to Chart's xField or yField. For example: var obj:Object = new Object(); var store:Object = new Object(); store.store1 = 300; store.store2 = 200; store.store3 = 250; obj.date = "2010/04/26"; obj.count = 2; obj.store = store; Because I have to draw multiple LineSeries, the yField on different series must be assigned to obj.store.store1~store3. How can I set yField in different layer of object?

    Read the article

  • validating data in .net

    - by Chen Kinnrot
    i'm looking for recommended validation frameworks, or patterns for an n-tier client application, i wanna write the validation once and ind it to wpf gui, and also for server side and client side related bussiness logic

    Read the article

  • Google Translate API for iPhone - UTF8 problem in Chinese Translation

    - by Sky Chen
    I've tested a workable translation API url by: http://translate.google.com/translate_a/t?client=t&text=%E5%BB%A3%E5%A0%B4&langpair=zh|zh-CN And it returns the correct result as the following which is in JSON format: {"sentences":[{"trans":"??","orig":"??","translit":"Guangchang"}],"src":"zh-CN"} However, when I try to use this function in XCode, I experienced this problem ... Here is my code: NSData *data; NSString *urlPath = [NSString stringWithFormat:@"/translate_a/t?client=t&text=%@&langpair=zh|zh-CN",qText]; NSURL *url = [[NSURL alloc] initWithScheme:@"http" host:@"translate.google.com" path:urlPath]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:url]; [request setHTTPMethod:@"GET"]; NSURLResponse *response; NSError *error; data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; //Problem's here. It returns nil. NSLog(result); Initially I guessed it's encoding problem so I tried other encoding as well (NSISOLatin1StringEncoding) , but I got wrong answer: {"sentences":[{"trans":"ã ","orig":"ã ","translit":"Tu¨¯ "}],"src":"zh-CN"} Does anyone know how to solve this problem? Thank you very much!

    Read the article

  • Which LINQ query is more effective?

    - by Danny Chen
    I have a huge IEnumerable(suppose the name is myItems), which way is more effective? Solution 1: Filter it first then ForEach. Array.ForEach(myItems.Where(FILTER-IT-HERE).ToArray(),MY-ACTION); Solution 2: Do RETURN in MY-ACTION if the item is not up to the mustard. Array.ForEach(myItems.ToArray(),MY-ACTION-WITH-FILTER); Is one of them always better than another? Or any other good suggestions? Thanks in advance.

    Read the article

  • Problem with building with csc task in Ant

    - by Wing C. Chen
    I have an ant build target using csc: <target name="compile"> <echo>Starting compiling ServiceLauncher</echo> <csc optimize="true" debug="true" warnLevel="1" unsafe="false" targetType="exe" failonerror="true" incremental="false" mainClass = "ServiceLauncher.Launcher" srcdir="ServiceLauncher/Launcher/" outputfile="ServiceLauncher.exe" > <reference file="libs/log4net.dll"/> <define name="RELEASE"/> </csc> </target> When I run it, the following exception comes up: csc failed: java.io.IOException: Cannot run program "csc": CreateProcess error=2, The system cannot find the file specified However, it runs without the exception but never correctly builds the .exe file, when I manually add in an empty ServiceLauncher.exe. How can I correctly build this .Net project "ServiceLauncher"?

    Read the article

  • Sunspot_Rails Rake Aborted When Running Reindex

    - by Walter Chen
    I'm getting the following output after running rake sunspot:reindex. I'm a novice at Rails. I want to add sunspot_rails to my project to add search functionality (with the hope of deploying the project with Heroku). I'm using Rails 3. I followed the instructions here: https://github.com/outoftime/sunspot/blob/master/sunspot_rails/README.rdoc. My various other attempts to diagnose the problem included: installing sunspot in addition to sunspot_rails. I ended up with sunspot_rails v. 1.2.0 and 1.2.1 so I uninstalled 1.2.1 because I have sunspot_rails 1.2.0. installed the nokogiri gem which I understand is a dependency for sunspot_rails. installed libxml2 separately following the instructions here to install nokogiri: http://www.engineyard.com/blog/2010/getting-started-with-nokogiri/ ** Invoke sunspot:reindex (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute sunspot:reindex rake aborted! undefined local variable or method counter' for [removed pound]<Class:0x10359aef8> /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:inmethod_missing' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/searchable.rb:235:in solr_index' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/relation/batches.rb:71:infind_in_batches' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:440:in __send__' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:440:infind_in_batches' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/searchable.rb:234:in solr_index' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/searchable.rb:184:insolr_reindex' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/tasks.rb:57 /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/tasks.rb:56:in each' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/tasks.rb:56 /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 This is what I have in class I'd like to search: searchable do text :fname text :mname text :lname, :default_boost => 2 end Any help would be greatly appreciated!

    Read the article

  • How can we stop a running java process through windows cmd?

    - by Wing C. Chen
    I am a newbie in cmd, so please allow me to ask a stupid question: How can we stop a running java process through windows cmd? For example, if we start jetty(a mini web server) with the following cmd: start javaw -jar start.jar How do we find the process and stop it later? Obviously the following cmd does not work: stop javaw -jar start.jar

    Read the article

  • Faster jquery selector for finding a number of TD elements

    - by Bernard Chen
    I have a table where each row has 13 TD elements. I want to show and hide the first 10 of them when I toggle a link. These 10 TD elements all have an IDs with the prefix "foo" and a two digit number for its position (e.g., "foo01"). What's the fastest way to select them across the entire table? $("td:nth-child(-n+10)") or $("td[id^=foo]") or is it worth concatenating all of the ids? $("#foo01, #foo02, #foo03, #foo04, #foo05, #foo06, #foo07, #foo08, #foo09, #foo10") Is there another approach I should be considering as well?

    Read the article

  • How can user change the jre parameter values after the exe is generated in Launch4j?

    - by Wing C. Chen
    Is it possible to change the jre parameter values after the exe file is generated through Launch4j? The ideal scenario is like this: The default parameter values are applied when the program is started. However, when the user wants to change some jre parameter values, he goes to a .ini file, MyProgram.ini for example, changes the values there, and the new values will be applied next time the program is started. I think eclipse uses the same way for its memory and some other parameter settings.

    Read the article

  • Volatile fields in C#

    - by Danny Chen
    From the specification 10.5.3 Volatile fields: The type of a volatile field must be one of the following: A reference-type. The type byte, sbyte, short, ushort, int, uint, char, float, bool, System.IntPtr, or System.UIntPtr. An enum-type having an enum base type of byte, sbyte, short, ushort, int, or uint. First I want to confirm my understanding is correct: I guess the above types can be volatile because they are stored as a 4-bytes unit in memory(for reference types because of its address), which guarantees the read/write operation is atomic. A double/long/etc type can't be volatile because they are not atomic reading/writing since they are more than 4 bytes in memory. Is my understanding correct? And the second, if the first guess is correct, why a user defined struct with only one int field in it(or something similar, 4 bytes is ok) can't be volatile? Theoretically it's atomic right? Or it's not allowed simply because that all user defined structs(which is possibly more than 4 bytes) are not allowed to volatile by design?

    Read the article

  • what's syntax for uncheck the checkbox for in specific row?

    - by Annie Chen
    I'm new to JQuery, i want to uncheck certain row in the repeater grid. I got this work, this will uncheck all checkbox for me. $('span.chkIncRows input').attr('checked', false); This works for me, if I want to uncheck row #2 checkbox from the repeater, without passing row number. $('span.chkIncRows input')[2].checked =false; I don't know the syntax to uncheck the checkbox, if i want to pass in the row number into checkbox. For example: I really want to do something like this, but it doesn't work. $('span.chkIncRows input')[rowNumber].checked =false; Thanks advance for your help. Annie

    Read the article

  • UIDatePicker date method is picking wrong date: iPhone Dev

    - by prd
    Hi, I am getting very strange behaviour on UIDatePicker. I have a view with date picker declared in .h file as IBOutlet UIDatePicker *datePicker; with property nonatomic and retain. datePicker is properly linked in IB file. In the code I am setting the minimum, maximum, initial date and action to call for UICOntrolEventValueChanged using following code If (!currentDate) { initialDate = [NSDate date]; } else { initialDate = currentdate; } [datePicker setMinimumDate:[NSDate date]]; [datePicker setMaximumDate:[[NSDate date] addTimeInterval:5 * 365.25 * 24 * 60 * 60]]; // to get upto 5 years [datePicker setDate:initialDate animated:YES]; [datePicker addTarget:self action:@selector(getDatePickerValue:) forControlEvents:UIControlEventValueChanged]; In getDatePickerValue, I get the new date using datePicker.date. When the view is closed (using a done button), I get the current value of the date using datePicker.date. Now if the view is called with no 'currentDate', the picker returns 'todays date'. This is what happens the 'first' time my pickerView is called. Each subsequent call to the view, with no 'current date' gives me a different and later date from today. So, first time I get today's date say 9 Jun 2010 second time datePicker.date returns 10 Jun 2010 third time 11 Jun 2010 and so on. Though its not always incremental, but mostly it is. I have put NSLogs, and verified the initial date is set correctly. The problem is only on the device (on OS 3.0), the issue is not replicated on simulator. I can't find what I have done wrong. I hope somebody else has come across similar problem and can help me resolve this.

    Read the article

  • Spring MVC 3 - How come @ResponseBody method renders a JSTLView?

    - by Ken Chen
    I have mapped one of my method in one Controller to return JSON object by @ResponseBody. @RequestMapping("/{module}/get/{docId}") public @ResponseBody Map<String, ? extends Object> get(@PathVariable String module, @PathVariable String docId) { Criteria criteria = new Criteria("_id", docId); return genericDAO.getUniqueEntity(module, true, criteria); } However, it redirects me to the JSTLView instead. Say, if the {module} is product and {docId} is 2, then in the console I found: DispatcherServlet with name 'xxx' processing POST request for [/xxx/product/get/2] Rendering view [org.springframework.web.servlet.view.JstlView: name 'product/get/2'; URL [/WEB-INF/views/jsp/product/get/2.jsp]] in DispatcherServlet with name 'xxx' How can that be happened? In the same Controller, I have another method similar to this but it's running fine: @RequestMapping("/{module}/list") public @ResponseBody Map<String, ? extends Object> list(@PathVariable String module, @RequestParam MultiValueMap<String, String> params, @RequestParam(value = "page", required = false) Integer pageNumber, @RequestParam(value = "rows", required = false) Integer recordPerPage) { ... return genericDAO.list(module, criterias, orders, pageNumber, recordPerPage); } Above do returns correctly providing me a list of objects I required. Anyone to help me solve the mystery?

    Read the article

  • slide downeffect the View problem android

    - by yee-chen
    How can i have slide downeffect? The effect will be similar with search function on google map of android. When we click the search option from option menu, the softkeyboard will slide up and the search bar will slide down automatically. Anyone provide any hint or any tutorial about this, or proper keyword i can search

    Read the article

  • A view model mvvm design issue

    - by Chen Kinnrot
    the best way to explain is with example so: this is the model public class Person { public int age; public string name; } this is the view model public class PersonVM { } my question is: should the vm expose the person to the datga template or encapsulate the model properties with his own properties?

    Read the article

  • How does tomcat set its executable file as a windows service?

    - by Wing C. Chen
    Firstly, I am not at all familiar with windows batch file programing. Recently I am curious about how tomcat sets itself as a windows service using a batch file. I downloaded the service.bat file from tomcat 6. However, I still don't understand some part of it. I guess this is the line that the batch actually register the exe file to the OS, is it right? Is there any syntax explanation? "%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop And is this used to remove the service? "%EXECUTABLE%" //DS//%SERVICE_NAME% And this is the setting of the parameters? "%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm Thanks.

    Read the article

  • android inputMethodservice API confusion

    - by yee-chen
    I dont understand quite well about onStartInputView(), onCreateInputView(), onStartInput() and onInitializeInterface(), after i read throught inputMethodservice API. Anyone can explain it when we use function, how we use those function. Are they like life cycle in Activity? if yes, whats the sequence of them. how can they behave?

    Read the article

  • Default value for public attributes

    - by Danny Chen
    I have a public attribute in some class. I want a default value -1 for this attribute without an private variable like _MyAttr(because too many attributes, i won't add them one by one). public int MyAttr { get; set; } [DefaultValueAttribute] is not working for this issue i think. Any ideas? Thanks.

    Read the article

  • git rebase without changing commit timestamps

    - by Olivier
    Would it make sense to perform git rebase while preserving the commit timestamps? I believe a consequence would be that the new branch will not necessarily have commit dates chronologically. Is that theoretically possible at all? (e.g. using plumbing commands; just curious here) If it is theoretically possible, then is it possible in practice with rebase, not to change the timestamps? For example, assume I have the following tree: master <jun 2010> | : : : oldbranch <feb 1984> : / oldcommit <jan 1984> Now, if I rebase oldbranch on master, the date of the commit changes from feb 1984 to jun 2010. Is it possible to change that behaviour so that the commit timestamp is not changed? In the end I would thus obtain: oldbranch <feb 1984> / master <jun 2010> | : Would that make sense at all? Is it even allowed in git to have a history where an old commit has a more recent commit as a parent? Edit A crucial question of Von C helped me understand what is going on: when your rebase, the committer's timestamp changes, but not the author's timestamp, which suddenly all makes sense. So my question was actually not precise enough. The answer is that rebase actually doesn't change the author's timestamps (you don't need to do anything for that), which suits me perfectly.

    Read the article

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