Search Results

Search found 394 results on 16 pages for 'leo chan'.

Page 11/16 | < Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • How can I set the minDate/maxDate for jQueryUI Datepicker using a string?

    - by leo
    jQueryUI Datepicker documentation states that the minDate option can be set using "a string in the current dateFormat". So I've tried the following to initialize datepickers: $("input.date").datepicker({ minDate: "01/01/2010", maxDate: "12/31/2010" }); However, this results in my datepicker having a selectable date range that goes from 11/06/2015 to 12/17/2015. I've checked the current dateformat and its mm/dd/yy, which is supposed to mean 2 digits for the month, 2 for the day, and 4 for the year, separated by slashes. I've also tried including dateFormat: "mm/dd/yy" in the inizialization statement. I've also checked the values for minDate and maxDate afterwards and they ARE being set to the values I want: 01/01/2010 and 12/31/2010. I want to be able to set min/maxDate with strings because I'm being passed these values as strings from somewhere else. Maybe someone knows why this happens and how to solve this, or a workaround to achieve this, perphaps changing the format of the date strings or something? Thanks EDIT: Using: jQuery v1.3.2 and jQuery UI v1.7.2

    Read the article

  • Custom Date Format with jax-rs in apache cxf?

    - by Oscar Chan
    Hi, I have been googling to figure out how I can customize the Date format when I use jax-rs on apache CXF. I looked at the codes, and it seems that it only support primitives, enum and a special hack that assume the type associated with @ForumParam has a constructor with a single string parameter. This force me to use String instead of Date if I want to use ForumParam. it is kind of ugly. Is there a better way to do it? @POST @Path("/xxx") public String addPackage(@FormParam("startDate") Date startDate) { ... } Thanks

    Read the article

  • Rails: Generated tokens missing occasionally

    - by Vincent Chan
    We generate an unique token for each user and store it on database. Everything is working fine in the local environment. However, after we upload the codes to the production server on Engine Yard, things become weird. We tried to register an account right after the deploy. It is working fine and we can see the token in the db. But after that, when we register new accounts, we cannot see any tokens. We only have NULL in the db. Not sure what caused this problem because we can't re-produce this in the local machine. Thanks for your help.

    Read the article

  • Axis Rotation Question using sio2 game engine

    - by Leo
    By using left hand rule, I rotate one object left and right using x axis, and rotate up/down using y axis. After first object is rotated to the right, the up/down rotation should be using z axis. However, when I try to rotate using z axis, after the first rotation, it has the same effect when I rotate using y axis. Anyone has any ideas? Thanks

    Read the article

  • Is AutoMapper able to auto resolve types base on existing maps

    - by Chi Chan
    I have the following code: [SetUp] public void SetMeUp() { Mapper.CreateMap<SourceObject, DestinationObject>(); } [Test] public void Testing() { var source = new SourceObject {Id = 123}; var destination1 = Mapper.Map<SourceObject, DestinationObject>(source); var destination2 = Mapper.Map<ObjectBase, ObjectBase>(source); //Works Assert.That(destination1.Id == source.Id); //Fails, gives the same object back Assert.That(destination2 is DestinationObject); } public class ObjectBase { public int Id { get; set; } } public class SourceObject : ObjectBase { } public class DestinationObject : ObjectBase { } So basically, I want AutoMapper to automatically resolve the destination type to "DestinationObject" based on the existing Maps set up in AutoMapper. Is there a way to achieve this?

    Read the article

  • Emacs under Windows and PNG files

    - by Leo Alekseyev
    Would anyone have any pointers on getting PNG images to display in Emacs 23 under Win32?.. I have installed the gnuwin32 set of utilities, including libpng and zlib; C:\Program Files\GnuWin32\bin is in path. JPG files started working but not PNGs. I'd appreciate any hints on getting this to work.

    Read the article

  • How to avoid/prevent the system to draw/redraw/refresh/paint a WPF window

    - by Leo
    I have an Application WPF with Visual C# (using visual studio 2010) and I want to draw OpenGL scenes on the WPF window itself. As for the OpenGL drawinf itself, I'm able to draw it w/o problems, meaning, I can create GL render context from the WPF main window itself (no additional OpenGL control, no win32 window inside WPF window), use GL commands and use swapbuffer (all this is done inside a dll - using C - I created myself). However, I have an annoying flickering when, for example, I resize the window. I overrided the OnRender method to re-draw with opengl, but after this, the window is redraw with the background color. It's likely that the system is automatically redrawing it. With WindowForms I'm able to prevent the system to redraw automatically (defining some ControlStyles to true or false, like UserPaint = true, AllPaintingInWmPaint = true, Opaque = true, ResizeRedraw = true, DoubleBuffer = false), but, aside setting Opacity to 1, I don't know how to do all that with WPF. I was hoping that overriding OnRender with no operations inside it would avoid redrawin, but somehow the system still draw the background. Do anyone know how to prevent system to redraw the window? Thx for your time

    Read the article

  • Auto height for label or textview within table view cell

    - by Leo
    Hi Folks, I have a problem in an iPhone application. Application has a table view controller with custom table view cells. Each cell has a Label (please correct me if I need to use text view etc). I am getting text dynamically from a web service call and I don't know how long text gonna be. Now problem is that I want to adjust the table view cell height based on text I receive. How can I grow Label or TextView height withinin table view cell so it can contain all the text and in effect grow table view cell height. Does anyone know how to handle this kind of design problem? Thanks

    Read the article

  • acts_as_solr returns all rows in the database when using the model as search query

    - by chris Chan
    In our application we're using acts_as_solr for search. Everything seems to be running smoothly except for the fact that using the model name as the search query returns every single row in the table. For example, let's say we have a users table. We specify acts_as_solr in our model to search the fields first name, last name and handle acts_as_solr :fields = [:handle, :lname, :fname]. When you use "user" as the search term it returns every single user in the system, or every row in the database as a result. Has anyone else run into this?

    Read the article

  • NSMutableArray with only a particular type of objects

    - by Leo
    Hello, is it possible to specify that a NSMutableArray can only contain a certain type of objects. For example, if I want to store only this kind of objects : @interface MyObject : NSObject { UInt8 value; } In order to be able to use the instance variable like this : - (void)myMethod:(NSMutableArray *)myArray{ for (id myObject in myArray){ [self otherMethod:myObject.value]; } } because I'm getting this error : request for member 'value' in something not a structure or union Thank you for your help

    Read the article

  • Formatting when copying SQL data and pasting in Excel

    - by Mary-Chan
    I want to copy a sql result set and paste it in Excel. But the data I paste in to the spreadsheet doesn't want to recognize Excel formatting. So if I change a column to currency, it doesn't do anything. But...if I double click on a cell, THEN it applies the currency format. But only to that cell. How can I make it automatically recognize the Excel format? I must be something I'm missing. Hopefully somebody can help. :-)

    Read the article

  • Jpa subclass mapping

    - by Roy Chan
    I am making a POS like system. I wonder how to map subclass using JPA (this is for my DAO). Product class has product details and OrderProduct class has information about the Product and details about the order. @Entity @Table(name="products") public class Product implements Serializable{ @Id @Column(name="id") @GeneratedValue(strategy = GenerationType.AUTO public int getId(){ return id;} /** Other get/set methods */ } @Entity @Table(name="order_products") public class OrderProduct extends Product{ @Id @Column(name="id") @GeneratedValue(strategy = GenerationType.AUTO) public int getId(){ return id;} /** Other get/set methods */ } I got complain about duplicate @Id. But OrderProduct class really need another id than the product one. How should I map this? DB is something like this Table products id int name varchar(32) Table order_product id int quantity int productid int fk referencing product table Would @IdClass or @AttributeOverride help?

    Read the article

  • Axis Rotation Question

    - by Leo
    By using left hand rule, I rotate one object left and right using y axis, and rotate up/down using x axis. After first object is rotated to the right, the up/down rotation should be using z axis. However, when I try to rotate using z axis, after the first rotation, it has the same effect when I rotate using y axis. Anyone has any ideas? Thanks

    Read the article

  • Animation is slow on iPhone

    - by Anthony Chan
    I'm developing an app that would display images and change them according to the user's action. I've created a subclass of UIView to contain an image, an index number and an array of image names. The code is like this: @interface CustomPic : UIView { UIImageView *pic; NSInteger index; NSMutableArray *picNames; //<-- an array of NSString } And in the implementation part, it has a method to change the image using a dissolve effect. - (void)nextPic { index++; if (index >= [picNames count]) { index = 0; } UIImageView *temp = pic; pic.image = [UIImage imageNamed:[picNames objectAtIndex:index]]; temp.alpha = 0; [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; [UIView setAnimationDuration:0.25]; pic.alpha = 0; temp.alpha = 1; [UIView commitAnimations]; } In the viewController, there are several CustomPic which would change the images depends on users' choice. The images would change as expected with the fade in/out effect, but the animation performance is really bad. I've tested it on an iPhone 3G, the Instruments shows that the animation is only 2-3FPS! I tried many methods to simplify and modify the codes but with no hope. Is there something wrong in my code or in my concept? Thanks for any help. P.S. all the images are 320*480 PNGs with a max size of 15KB.

    Read the article

  • how to link a java class to a image button in eclipse?

    - by Isabella Chan
    I am trying to create a application that includes a Imagebutton and by clicking on the imagebutton, the application will start to run another java class that is within the package itself. I try using this method, however the program stopped working immediately? how should i code the codes instead? can anyone help me? Thanks :D package com.fyp.gulliver; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class GulliverActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //---Map button--- Button btnMap = (Button) findViewById(R.id.map); btnMap.setOnClickListener(new View.OnClickListener() { Class ourClass; public void onClick(View v) { // TODO Auto-generated method stub try { ourClass = Class.forName ("com.fyp.gulliver.Maps"); Intent ourIntent = new Intent(GulliverActivity.this, ourClass); startActivity(ourIntent); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } }

    Read the article

  • How to change granted role temporarily to achieve "view the site as" someone else

    - by Roy Chan
    Hi Gurus, We are using 2.x spring security right now. I am asked to build an admin tool so that the ROLE_ADMIN can change to any user in the site and view the site as that person (each person on the site may see different stuff depending on the role which is dynamically granted base on the database) and of course the admin should be able to switch back to admin without logging in. Is there a build in function, if not how should I do this? Thanks in advance!

    Read the article

  • CoreData : App crashes when deleting last instance created

    - by Leo
    Hello, I have a 2 tabs application. In the first one, I'm creating objects of the "Sample" and "SampleList" entities. Each sampleList contains an ID and a set of samples. Each sample contains a date and temperature property. In the second tab, I'm displaying my data in a tableView. I implemented the - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath method in order to delete SampleLists. In my xcdatamodel the delete rule for my relationship between SampleList and Sample is Cascade. My problem is that when I try to delete SampleList I just created, the app crashes and I receive a EXC_BAD_ACCESS signal. If I restart it, then I'm able to delete "old" sampleList without any problems. Earlier, I had the following problem : I couldn't display the the sampleLists I created since I launched the app, because it crashed too. I received also the EXC_BAD_ACCESS signal. Actually, it seemed that the date of the last sample created of the set was nil. If I am not releasing the NSDate I'm using to set the sample's date, I don't have this problem anymore... If anyone could help me to find out what could cause my troubles it would be great !! Here is the method I'm using to create new instances : SampleList *newSampleList = (SampleList *)[NSEntityDescription insertNewObjectForEntityForName:@"SampleList" inManagedObjectContext:managedObjectContext]; [newSampleList setPatchID:patchID]; NSMutableSet *newSampleSet = [[NSMutableSet alloc] init]; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; for (int i = 0; i < [byteArray count]; i=i+4, sampleCount++) { NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setYear:year]; [comps setMonth:month]; [comps setDay:day]; [comps setHour:hours]; [comps setMinute:minutes]; NSDate *sampleDate = [gregorian dateFromComponents:comps]; Sample *newSample = (Sample *)[NSEntityDescription insertNewObjectForEntityForName:@"Sample" inManagedObjectContext:managedObjectContext]; [newSample setSampleDate:sampleDate]; [newSample setSampleTemperature:[NSNumber numberWithInt:temperature]]; [newSampleSet addObject:newSample]; [comps release]; //[sampleDate release]; } [newSampleList setSampleSet:newSampleSet]; // [newSampleSet release]; NSError *error; if (![managedObjectContext save:&error]) { NSLog(@"Could not Save the context !!"); } [gregorian release];

    Read the article

  • How to inject param in Struts 2 Tag OGNL way

    - by Roy Chan
    Hi Guru, I want to use a property as a param of an object's method. <s:property value="orderProductId" /> returns correct value (e.g. 1) <s:iterator value="%{order.getProductById(1).activations}"> gives me correct value too. But <s:iterator value="%{order.getProductById(#orderProductId).activations}"> doesn't. Not sure why #orderProductId doesn't interpret correctly.

    Read the article

  • creating matrix with probabilities

    - by John Chan
    Hi all, I want to generate a matrix of NxN to test some code that I have where each row contains floats as the elements and has to add up to 1 (i.e. a row with a set of probabilities). Where it gets tricky is that I want to make sure that randomly some of the elements should be 0 (in fact most of the elements should be 0 except for some random ones to be the probabilities). I need the probabilities to be 1/m where m is the number of elements that are not 0 within a single row. I tried to think of ways to output this, but essentially I would need this stored in a C++ array. So even if I output to a file I would still have the issue of not having it in array as I need it. At the end of it all I need that array because I want to generate a Market Matrix file. I found an implementation in C++ to take an array and convert it to the market matrix file, so this is what I am basing my findings on. My input for the rest of the code takes in this market matrix file so I need that to be the primary form of output. The language does not matter, I just want to generate the file at the end (I found a way mmwrite and mmread in python as well) Please help, I am stuck and not really sure how to implement this.

    Read the article

  • Low cost way to host a large table yet keep the performance scalable?

    - by Leo Liang
    I have a growing table storing time series data, 500M entries now, and 200K new records every day. The total size is around 15GB for now. My clients are querying the table via a PHP script mostly, and the size of the result set is around 10K records (not very large). select * from T where timestamp > X and timestamp < Y and additionFilters And I want this operation cheap. Currently my table is hosting in Postgres 7, on a single 16G memory Box, and I would love to see some good suggestion for me to host this in low cost and also allow me to scale up for performance if needed. The table serves: 1. Query: 90% 2. Insert: 9.9% 2. Update: 0.1% <-- very rare.

    Read the article

  • Backbone events not firing (this.el undefined) & general feedback on use of the framework

    - by Leo
    I am very new to backbone.js and I am struggling a little. I figured out a way to get data from the server (in json) onto the screen successfully but am I doing it the right/best way? I know there is something wrong because the only view which contains a valid this.el is the parent view. I suspect that because of this, the events of the view are not firing ()... What is the best way forward? Here is the code: var surveyUrl = "/api/Survey?format=json&callback=?"; $(function () { AnswerOption = Backbone.Model.extend({}); AnswerOptionList = Backbone.Collection.extend({ initialize: function (models, options) { this.bind("add", options.view.render); } }); AnswerOptionView = Backbone.View.extend({ initialize: function () { this.answerOptionList = new AnswerOptionList(null, { view: this }); _.bindAll(this, 'render'); }, events: { "click .answerOptionControl": "updateCheckedState" //does not fire because there is no this.el }, render: function (model) { // Compile the template using underscore var template = _.template($("#questionAnswerOptionTemplate").html(), model.answerOption); $('#answerOptions' + model.answerOption.questionId + '>fieldset').append(template); return this; }, updateCheckedState: function (data) { //never hit... } }); Question = Backbone.Model.extend({}); QuestionList = Backbone.Collection.extend({ initialize: function (models, options) { this.bind("add", options.view.render); } }); QuestionView = Backbone.View.extend({ initialize: function () { this.questionlist = new QuestionList(null, { view: this }); _.bindAll(this, 'render'); }, render: function (model) { // Compile the template using underscore var template = _.template($("#questionTemplate").html(), model.question); $("#questions").append(template); //append answers using AnswerOptionView var view = new AnswerOptionView(); for (var i = 0; i < model.question.answerOptions.length; i++) { var qModel = new AnswerOption(); qModel.answerOption = model.question.answerOptions[i]; qModel.questionChoiceType = ChoiceType(); view.answerOptionList.add(qModel); } $('#questions').trigger('create'); return this; } }); Survey = Backbone.Model.extend({ url: function () { return this.get("id") ? surveyUrl + '/' + this.get("id") : surveyUrl; } }); SurveyList = Backbone.Collection.extend({ model: Survey, url: surveyUrl }); aSurvey = new Survey({ Id: 1 }); SurveyView = Backbone.View.extend({ model: aSurvey, initialize: function () { _.bindAll(this, 'render'); this.model.bind('refresh', this.render); this.model.bind('change', this.render); this.model.view = this; }, // Re-render the contents render: function () { var view = new QuestionView(); //{el:this.el}); for (var i = 0; i < this.model.attributes[0].questions.length; i++) { var qModel = new Question(); qModel.question = this.model.attributes[0].questions[i]; view.questionlist.add(qModel); } } }); window.App = new SurveyView(aSurvey); aSurvey.fetch(); }); -html <body> <div id="questions"></div> <!-- Templates --> <script type="text/template" id="questionAnswerOptionTemplate"> <input name="answerOptionGroup<%= questionId %>" id="answerOptionInput<%= id %>" type="checkbox" class="answerOptionControl"/> <label for="answerOptionInput<%= id %>"><%= text %></label> </script> <script type="text/template" id="questionTemplate"> <div id="question<%=id %>" class="questionWithCurve"> <h1><%= headerText %></h1> <h2><%= subText %></h2> <div data-role="fieldcontain" id="answerOptions<%= id %>" > <fieldset data-role="controlgroup" data-type="vertical"> <legend> </legend> </fieldset> </div> </div> </script> </body> And the JSON from the server: ? ({ "name": "Survey", "questions": [{ "surveyId": 1, "headerText": "Question 1", "subText": "subtext", "type": "Choice", "positionOrder": 1, "answerOptions": [{ "questionId": 1, "text": "Question 1 - Option 1", "positionOrder": 1, "id": 1, "createdOn": "\/Date(1333666034297+0100)\/" }, { "questionId": 1, "text": "Question 1 - Option 2", "positionOrder": 2, "id": 2, "createdOn": "\/Date(1333666034340+0100)\/" }, { "questionId": 1, "text": "Question 1 - Option 3", "positionOrder": 3, "id": 3, "createdOn": "\/Date(1333666034350+0100)\/" }], "questionValidators": [{ "questionId": 1, "value": "3", "type": "MaxAnswers", "id": 1, "createdOn": "\/Date(1333666034267+0100)\/" }, { "questionId": 1, "value": "1", "type": "MinAnswers", "id": 2, "createdOn": "\/Date(1333666034283+0100)\/" }], "id": 1, "createdOn": "\/Date(1333666034257+0100)\/" }, { "surveyId": 1, "headerText": "Question 2", "subText": "subtext", "type": "Choice", "positionOrder": 2, "answerOptions": [{ "questionId": 2, "text": "Question 2 - Option 1", "positionOrder": 1, "id": 4, "createdOn": "\/Date(1333666034427+0100)\/" }, { "questionId": 2, "text": "Question 2 - Option 2", "positionOrder": 2, "id": 5, "createdOn": "\/Date(1333666034440+0100)\/" }, { "questionId": 2, "text": "Question 2 - Option 3", "positionOrder": 3, "id": 6, "createdOn": "\/Date(1333666034447+0100)\/" }], "questionValidators": [{ "questionId": 2, "value": "3", "type": "MaxAnswers", "id": 3, "createdOn": "\/Date(1333666034407+0100)\/" }, { "questionId": 2, "value": "1", "type": "MinAnswers", "id": 4, "createdOn": "\/Date(1333666034417+0100)\/" }], "id": 2, "createdOn": "\/Date(1333666034377+0100)\/" }, { "surveyId": 1, "headerText": "Question 3", "subText": "subtext", "type": "Choice", "positionOrder": 3, "answerOptions": [{ "questionId": 3, "text": "Question 3 - Option 1", "positionOrder": 1, "id": 7, "createdOn": "\/Date(1333666034477+0100)\/" }, { "questionId": 3, "text": "Question 3 - Option 2", "positionOrder": 2, "id": 8, "createdOn": "\/Date(1333666034483+0100)\/" }, { "questionId": 3, "text": "Question 3 - Option 3", "positionOrder": 3, "id": 9, "createdOn": "\/Date(1333666034487+0100)\/" }], "questionValidators": [{ "questionId": 3, "value": "3", "type": "MaxAnswers", "id": 5, "createdOn": "\/Date(1333666034463+0100)\/" }, { "questionId": 3, "value": "1", "type": "MinAnswers", "id": 6, "createdOn": "\/Date(1333666034470+0100)\/" }], "id": 3, "createdOn": "\/Date(1333666034457+0100)\/" }, { "surveyId": 1, "headerText": "Question 4", "subText": "subtext", "type": "Choice", "positionOrder": 4, "answerOptions": [{ "questionId": 4, "text": "Question 4 - Option 1", "positionOrder": 1, "id": 10, "createdOn": "\/Date(1333666034500+0100)\/" }, { "questionId": 4, "text": "Question 4 - Option 2", "positionOrder": 2, "id": 11, "createdOn": "\/Date(1333666034507+0100)\/" }, { "questionId": 4, "text": "Question 4 - Option 3", "positionOrder": 3, "id": 12, "createdOn": "\/Date(1333666034507+0100)\/" }], "questionValidators": [{ "questionId": 4, "value": "3", "type": "MaxAnswers", "id": 7, "createdOn": "\/Date(1333666034493+0100)\/" }, { "questionId": 4, "value": "1", "type": "MinAnswers", "id": 8, "createdOn": "\/Date(1333666034497+0100)\/" }], "id": 4, "createdOn": "\/Date(1333666034490+0100)\/" }], "id": 1, "createdOn": "\/Date(1333666034243+0100)\/" })

    Read the article

  • NSArray containObjects method

    - by Anthony Chan
    Hi, I have a simple question regarding xcode coding but don't know why things are not performing as I think. I have an array of objects (custom objects). I just want to check if this one is within the array. I used the following code: NSArray *collection = [[NSArray alloc] initWithObjects:A, B, C, nil]; //custom "Item" objects Item *tempItem = [[Fruit alloc] initWithLength:1 width:2 height:3]; //3 instance variables in "Item" objects if([collection containsObject:tempItem]) { NSLog(@"collection contains this item"); } I suppose the above checking will give me a positive result but it's not. Further, I checked whether the objects created are the same. NSLog(@"L:%i W:%i H:%i", itemToCheck.length, itemToCheck.width, itemToCheck.height); for (int i = 0, i < [collection count], i++) { Item *itemInArray = [collection objectAtIndex:i]; NSLog(@"collection contains L:%i W:%i H:%i", itemInArray.length, itemInArray.width, itemInArrayheight); } In the console, this is what I got: L:1 W:2 H:3 collection contains L:0 W:0 H:0 collection contains L:1 W:2 H:3 collection contains L:6 W:8 H:2 Obviously the tempItem is inside the collection array but nothing shows up when I use containsObject: to check it. Could anyone give me some direction which part I am wrong? Thanks a lot!

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >