Thursday, May 17, 2012
IntelliJ syntax highlighting tip for Javascript
Thursday, January 14, 2010
Upgrading to FlexUnit 4 for larger projects using FlexUnit .9
Then you pass this suite into the test runner like so:
// Metadata tells FlexUnit4 that this is a Suite and
// specifies a runner to use with it
[Suite]
[RunWith("org.flexunit.runners.Suite")]
public class FlexUnit4TestSuite
{
//simply make public variables inside the suite
//with the test cases or suites that you want
//run.
public var baseMediatorTest:BaseMediatorTest;
// ...
}
public function onCreationComplete(evt:Event):void
{
core = new FlexUnitCore();
core.addListener(new UIListener(uiListener));
core.addListener(new CIListener(1028, "localhost"));
core.run( FlexUnit4TestSuite )
}
Much more maintainable.
Friday, May 29, 2009
Google finally revived collaborative note taking
This is a very, very powerful, useful tool. Thanks Google!
Wednesday, April 29, 2009
Soda.. or Airline?
Tuesday, January 20, 2009
Tuesday, August 26, 2008
PureMVC Gotcha
Thursday, August 21, 2008
Crazy Flex DateField Insanity
The problem occurred when we had two DateField interface components pointing to the same data model field. The two DateFields would be hooked up to a single data model field, and we saw the following behavior:
- If we bound the DateField.selectedDate to the model.birthday (as an example), with one DateField Instance, all would work. Underneath, it set off the bindings twice when you changed the selectedDate, but that was OK. With multiple DateField Instances, it would crash as it tried to create the second DateField. (This happened when we preinitialized the DateField and without preinitializing the DateField) Underneath, it would set off the bindings between the three items infinitely.
- If we bound the DateField.data to the model.birthday, it would never infinitely loop, but model.birthday wouldn't get updated when DateField was changed. I think that the code for DateField.data is screwy, but according to the documentation, it seems like this is the property you should bind to.
- If I tried binding the DateField.data to the model.birthday and the model.birthday to the DateField.selectedDate, it would also loop infinitely.
My theory is that Date comparisons are broken or behave oddly, and if you just compare Date.time, it works as expected. I'm assuming this is why the binding went forever, but I can't be sure.
Hope this helps someone else.. some also possibly helpful links:
http://devel.teratechnologies.net/steve_examples/Flex_BindingProblem/DateTest.html
http://bugs.adobe.com/jira/browse/SDK-15618
Wednesday, July 23, 2008
Ant Property Trickery
My solution? Import the build.properties file which does not set my target property (FLEX_HOME), then in my tasks, set the target property depending on which one I need (FLEX_REGULAR_HOME or FLEX_COVERAGE_HOME).
Thursday, June 12, 2008
PureMVC Documentation
Anyways. I just wanted to point out that PureMVC has some of the best documentation I've ever seen. I printed out the pdf of the Framework overview, double sided to conserve paper, and it has exactly one page of written text and one page of diagrams per section, so you get the text about the view, and on the facing page, all the UML.
The little things make me happy.
Wednesday, April 16, 2008
Regular Expressions
Monday, April 07, 2008
Internet Explorer 7, Clears and Floats?
firstinstead of
second
first second
Anyone run into this before? I'm not css problem savvy enough to know what to Google for. I ended up just putting br's with a "clear: both" class on them in between rows, but it's not as clean as it was before.
Friday, March 14, 2008
PyCon 2008: Collaborative Notes?
Thursday, March 06, 2008
Grails Date Trick
class Person{and you're struggling to figure out a way to get stuff into it without explicitly creating a date and converting strings or integers into it, Grails provides a handy (yet not documented?) set of properties for you. In our example, I could set birthday_year, birthday_month, birthday_day, birthday_hour, etc.. I found this by digging in the scaffolded views and figuring out how they render the
String Name
Date Birthday
}
Sunday, March 02, 2008
Font choices, anyone?
Just another css developer's link. I'm on a roll here.
Saturday, March 01, 2008
Color Scheme Generator by WellStyled
Lorem Ipsum Dolor Sit Amet
Friday, February 29, 2008
Gotcha: Grails Auto Recompile Doesn't Do GSP
Wednesday, February 27, 2008
Gotcha: Grails Capitalization
Thursday, February 14, 2008
Acegi on Grails Tutorial
So, neither the information on the Plugin Page for the Acegi Security Plugin, nor the info in the acegi tutorial actually work completely. Here's a real tutorial for doing this. (Step 6 is where the existing documentation fails)
Step 1. Install Grails
Step 2. Download the Acegi Security Plugin. (I downloaded version 0.2 it as a zip file, to %GRAILS_HOME%/plugins/)
Step 3. Create a new Grails Project, and cd into the new project folder:
grails create-app SecurityTutorial
cd SecurityTutorial
Step 4. Add the Acegi Security Plugin. Note that you can install plugins by name using some lookup service, but the Acegi plugin won't be found.
grails install-plugin %GRAILS_HOME%/plugins/grails-acegi-0.2.zip
Step 5. Installing the Acegi Plugin will add some new scripts to your project:
- create-auth-domains [PersonDomainName] [AuthorityDomainName: this creates the domain model needed by the plugin, Person, Authority, and RequestMap classes, login and logout controllers, as well as the login view. You can give optional names as arguments to replace Person and Authority.
- generate-manager: creates the scaffolding controllers to add new Person, Authority, and RequestMap object in your database
- generate-registration: create a register and captcha controller, as well as matching views, and an emailer service.
Run each of these commands.
grails create-auth-domains
grails generate-mapper
grails generate-registration
Step 6. Setup BootStrap.groovy to contain some sample data, as follows:
// ProjectFolder/grails-app/conf/Bootstrap.groovyclass BootStrap {
def init = { servletContext ->
// get a AcegiSecurity AuthenticateService
def authenticateService = new AuthenticateService()
// use it to create an encoded password
def md5pass = authenticateService.passwordEncoder("pass")
// Create two sample users
// NB: you must specify all the Person attributes, otherwise
// Grails will fail quietly to add these to the database
def user_root = new Person(username:"root",
userRealName:"Root User",
passwd:md5pass,
enabled:true,
email:"root@example.com",
email_show:true,
description:"Desc").save()
def user_admin = new Person(username:"admin",
userRealName:"Admin User",
passwd:md5pass,
enabled:true,
email:"admin@example.com",
email_show:false,
description:"Desc").save()
// Add some sample Roles, add the users to those roles
def role_superuser = new Authority(description:"Superuser",
authority:"ROLE_SUPERUSER")
role_superuser.addToPeople(user_root)
role_superuser.save()
// See AcegiConfig.groovy, at the bottom, there's a defaultrole
// setting, you must make one to allow registration to work.
def role_user = new Authority(description:"User Role",
authority:"ROLE_USER")
role_user.addToPeople(user_admin)
role_user.addToPeople(user_root)
role_user.save()
// Create some Request Maps
new Requestmap(url:"/captcha/**",
configAttribute:"ROLE_SUPERUSER").save()
new Requestmap(url:"/register/**",
configAttribute:"ROLE_USER").save()
}
def destroy = {
}
}
We also have to edit the RegisterController.groovy to fix a bug.
// ProjectFolder/grails-app/controllers/RegisterController.groovy // Line # 159-161
person.save(flush:true)
def parMap =['j_username':person.username,'j_password':params.passwd]
// change this line:
// redirect(controller:'login',action:'../j_acegi_security_check',params:parMap)
// to this:
redirect(controller:'login',action:"auth")
Step 7. Run the application
grails run-app
Step 8. Play around. Notice that you when you try to go to the register controller, it asks for a login, then, since you're already logged in, the register controller just shows you your info with a redirect(action "show"). Go delete the RequestMap for the register url, make sure you logout, then try again. See how the captcha is broken? Go remove the captcha RequestMap, and try again.
