Search Results

Search found 331 results on 14 pages for 'allan chen'.

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

  • print customized result in prolog

    - by Allan Jiang
    I am working on a simple prolog program. Here is my problem. Say I already have a fact fruit(apple). I want the program take a input like this ?- input([what,is,apple]). and output apple is a fruit and for input like ?-input([is,apple,a,fruit]) instead of default print true or false, I want the program print some better phrase like yes and no Can someone help me with this? My code part is below: input(Text) :- phrase(sentence(S), Text), perform(S). %... sentence(query(Q)) --> query(Q). query(Query) --> ['is', Thing, 'a', Category], { Query =.. [Category, Thing]}. % here it will print true/false, is there a way in prolog to have it print yes/no, %like in other language: if(q){write("yes")}else{write("no")} perform(query(Q)) :- Q.

    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

  • 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

  • Set "Start With" value for Oracle sequence dynamically

    - by Allan
    I'm trying to create a release script that can be deployed on multiple databases, but where the data can be merged back together at a later date. The obvious way to handle this is to set the sequence numbers for production data sufficiently high in subsequent deployments to prevent collisions. The problem is in coming up with a release script that will accept the environment number and set the "Start With" value of the sequences appropriately. Ideally, I'd like to use something like this: ACCEPT EnvironNum PROMPT 'Enter the Environment Number: ' --[more scripting] CREATE SEQUENCE seq1 START WITH &EnvironNum*100000; --[more scripting] This doesn't work because you can't evaluate a numeric expression in DDL. Another option is to create the sequences using dynamic SQL via PL/SQL. ACCEPT EnvironNum PROMPT 'Enter the Environment Number: ' --[more scripting] EXEC execute immediate 'CREATE SEQUENCE seq1 START WITH ' || &EnvironNum*100000; --[more scripting] However, I'd prefer to avoid this solution as I generally try to avoid issuing DDL in PL/SQL. Finally, the third option I've come up with is simply to accept the Start With value as a substitution variable, instead of the environment number. Does anyone have a better thought on how to go about this?

    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

  • Serializing ActiveRecord objects without storing their attributes?

    - by Allan Grant
    I'm working on a problem where I need to store serialized hierarchies of Ruby objects in the database. Many of the objects that will need to be saved are ActiveRecord objects with a lot of attributes. Instead of saving the entire objects and then refreshing their attributes from the DB when I load them (in case they changed, which is likely), it would be easier to just store the references (class and database id) for these objects. Does anyone know if there's already a way to do this in Rails, or if there's an existing gem for it? Wanted to check if something existed before spending a ton of time hacking on it.

    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

  • 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

  • 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

  • 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

  • What is the proper location for a sqlite3 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

  • What's the vbs code to schedule a task every time Windows starts up?

    - by Wing C. Chen
    I would like to know how to write up the vbs code to schedule a windows task to start a .exe program every time the Windows starts up. I found the following code online: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objNewJob = objWMIService.Get("Win32_ScheduledJob") errJobCreated = objNewJob.Create _ ("Notepad.exe", "********123000.000000-420", _ True , 1 OR 4 OR 16, , , JobID) Wscript.Echo errJobCreated But it only tells me how to schedule the task every on some specific days and hours. I thought of creating a windows service. However the following is the story why I must look for an alternative to it. I created a windows service with RunAsService for my java program wrapped with Janel. The Service worked fine when I first installed and started it. However, after restarting my windows xp, a dialog window poped out saying that my janel generated .exe file has crashed, with my RunAsService service kept on going. The service worked fine when I terminated the service and restarted it again manually. Nevertheless, the same crash happens over and over again every time I restart my Windows.

    Read the article

  • How can I get the type I want?

    - by Danny Chen
    There are a lot of such classes in my project (very old and stable code, I can't do many changes to them, maybe slight changes are OK) public class MyEntity { public long ID { get; set; } public string Name { get; set; } public decimal Salary { get; set; } public static GetMyEntity ( long ID ) { MyEntity e = new MyEntity(); // load data from DB and bind to this instance return e; } } For some reasons, now I need to do this: Type t = Type.GetType("XXX"); // XXX is one of the above classes' name MethodInfo staticM= t.GetMethods(BindingFlags.Public | BindingFlags.Static).FirstOrDefault();// I'm sure I can get the correct one var o = staticM.Invoke(...); //returns a object, but I want the type above! If I pass "MyEntity" at beginning, I hope I can get o as MyEntity! Please NOTE that I know the "name of the class" only. MyEntity e = staticM.Invoke(...) as MyEntity; can't be used here.

    Read the article

  • Using the same code in different (partial) views

    - by Danny Chen
    Maybe this question is quite simple because I'm new to MVC2. I have a simple demo MVC project. (1) A weak-typed view: Index.aspx <% Html.RenderPartial("ArticalList", ViewData["AllArticals"] as List<Artical>); %> (2) A strong-typed partical view: ArticalList.ascx <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<Artical>>" %> <% foreach (Artical a in Model) { %> <%= Html.ActionLink(a.Title, "About", new { id = a.ID })%><br /> <%} %> (3) Here is the HomeController.cs public ActionResult Index() { ViewData["AllArticals"] = Artical.GetArticals(); return View(); } public ActionResult ArticalList() { return PartialView(Artical.GetArticals()); } Sorry I'm using a Web-Form "angle", because if I'm using a Web-Form, when I visit Index.aspx, rendering ArticalList.ascx will call public ActionResult ArticalList(). But here I need to write Artical.GetArticals() twice in two actions. How can I put them in one?

    Read the article

  • Hbase schema design -- to make sorting easy?

    - by chen
    I have 1M words in my dictionary. Whenever a user issue a query on my website, I will see if the query contains the words in my dictionary and increment the counter corresponding to them individually. Here is the example, say if a user type in "Obama is a president" and "Obama" and "president" are in my dictionary, then I should increment the counter by 1 for "Obama" and "president". And from time to time, I want to see the top 100 words (most queried words). If I use Hbase to store the counter, what schema should I use? -- I have not come up an efficient one yet. If I use word in my dictionary as row key, and "counter" as column key, then updating counter(increment) is very efficient. But it's very hard to sort and return the top 100. Anyone can give a good advice? Thanks.

    Read the article

  • How to style a label with a colon

    - by Allan
    I have a details view window in WPF and a label may look like this. <Label Content="{x:Static properties:Resources.Reference}" /> So that is obtains it content from my property Resource. How can transform/format the content so it has a colon after each label item. e.g. instead of the content simply displaying Reference I want it to transform to Reference:

    Read the article

  • How to know that a php project is using Zend framework?

    - by Wing C. Chen
    I am writing a piece of small software to go through the folders and files of all the php projects that are passed in and detect if any of them is actually also a Zend project. Is there any particular file that I can immediately read and tell that the current project is a Zend project? or is there any convenient way to tell?

    Read the article

  • Confused about GNU `sort(1)` of a numerical sub field

    - by Chen Levy
    I wish to sort a space separated table, with the numerical value that found on the 2nd field. I can assume that the 2nd field is always fooN but the length of N is unknown: antiq. foo11 girls colleaguing foo2 Leinsdorf Cousy foo0 Montgomeryville bowlegged foo1 pollack Chevrier foo10 ill-conceived candlebomb foo3 seventieths autochthony foo101 re-enable beneficiate foo100 osteometric I read man sort(1) and played with all sort of options. On my system I found the line: sort -n -k2.5 table to work. My question is why? According to the man page: -k, --key=POS1[,POS2] start a key at POS1, end it at POS 2 (origin 1) ... POS is F[.C][OPTS], where F is the field number and C the characterposition in the field. OPTS is one or more single-letter ordering options, which override global ordering options for that key. If no key is given, use the entire line as the key. So why sort -n -k2.4 table don't work and sort -n -k.5 does?

    Read the article

  • What data type should I use for my texture coordinates in OpenGL ES?

    - by Matthew Chen
    I notice that the default data type for texture coordinates in the OpenGL docs is GLfloat, but much of the sample code I see written by experienced iphone developers uses GLshort or GLbyte. Is this an optimization? GLfloat vertices[] = { // Upper left x1, y2, // Lower left x1, y1, // Lower right x2, y1, // Upper right x2, y2, }; glTexCoordPointer(2, GL_FLOAT, 0, iconSTs); vs. GLbyte vertices[] = { // Upper left x1, y2, // Lower left x1, y1, // Lower right x2, y1, // Upper right x2, y2, }; glTexCoordPointer(2, GL_BYTE, 0, iconSTs);

    Read the article

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