programming
Danger Hiptop – Build Fail, Cannot find ${env.DANGER_HOME}
Working on my first app for the Danger Hiptop SDK. It’s pretty fun, Java with custom classes stacked on top.
I was editing the project in Eclipse, but when it came time to compile via the Ant build.xml, got this type of error:
1 2 | BUILD FAILED /Applications/hiptop-sdk/examples/chessclock/build.xml:14: Cannot find ${env.DANGER_HOME}/tools/build_common.xml imported from /Applications/hiptop-sdk/examples/ourspace/build.xml |
Reason? The environment variables I set weren’t being seen in Eclipse for some reason. Not to worry. Simply:
- Right click on build.xml
- Select “Run As…”->”External Tools Configuration”
- Select the “Environment” tab
- Press “New”, and fill out “DANGER_HOME” and “/locationOfYourDangerSDK” (mine is “/Applications/hiptop-sdk”)
- Hit “Run”!
Before I was compiling it straight from terminal. But sometimes it’s nice to strike a fire instead of wait for lightning.
FTD
Popularity: 20% [?]
Passion Project – Pai Gow Poker – iPhone
As a New Year’s Resolution, I’ve dedicated Monday Night as PASSION PROJECT NIGHT! (krakowww)
To keep myself accountable, I’ll post every Monday night the progress I’ve done, some tips I’ve learned, screenshots… Who knows what could happen in the lab!
Pai Gow Poker
Description:
A single-player Pai Gow Poker game on the iPhone platform, using Objective-C, and a modified version of the GeekGameBoard code base.
Tonight I’ve done the following:
- Reviewed the Project Description
- Reviewed the Project Assets provided by Amy Anstine, our Core Designer for Dom & Tom
- Cleaned up the semantics site-wide (cleaning up semantics a.k.a. naming conventions, linkages, project structure helps me refresh myself on a project)
- Added content to the ABOUT page, added navigation elements, added copyright
- Added content to the OPTIONS page, added navigation element, added copyright
- Setup User Defaults on the OPTIONS page
- Downloaded the GeekGameBoard codebase and reviewed
Next week, I hope to get my brain dirty and begin implementing game logic: deck, dealer and player’s hands, interaction with setting a bet, selecting cards, etc.
But not bad for a first night.
FTD
Popularity: 24% [?]
Website Updates: Mobile Version, Twitter Tools, Popularity Contest
Attention: Updates made to the site using Alex King’s wordpress plugins (great code = great coder) including:
- Mobile Version using Carrington Mobile 1.0.2 by Crowd Favorite
- Twitter Tools (to push posts up the social networking food chain
- Popularity Contest (ranking my posts by crowd favorite – in the spirit of google’s ranking
FTD
Popularity: 71% [?]
Flash – ComboBox – Green Halo (won’t disable if you load into another swf bug)
If you have a combox in a swf, and load that swf into a wrapper swf, it’s POSSIBLE the green halo will stick around long after you scroll and make a selection.
Simply add this to your actionscript:
yourComboBox.drawFocus = “”;
yourComboBox.dropdown.drawFocus=”";
That should disable it. There. That’s a headache I hope I can spare you. I can’t tell you how long I worked with “_focusrect” and “focusRectEnabled” before find that solution.
FTD
Popularity: 17% [?]
Coldfusion http://localhost:8500/flex2gateway/ error – FIX
Coldfusion error http://localhost:8500/flex2gateway/ bugs the hell out of me every now and then.
Generally, it means you have an issue with your services-config.xml file in your “WEB-INF/Flex” root (and any subsequent include files, as in remoting-config.xml, messaging-config.xml, etc.
After googling the hell out of it, the final solution was to look at the cfserver.log (which lives in Coldfusion8/logs) and hand fix the xml until it’s bug free.
Check for:
- broken xml structure (i.e. end tags missing)
- using the same endpoint for two different services, which CF8 isn’t a happy camper about (i.e. <endpoint uri=”https://{server.name}:{server.port}{context.root}/flex2gateway/” class=”flex.messaging.endpoints.SecureAMFEndpoint”/> should be <endpoint uri=”https://{server.name}:{server.port}{context.root}/flex2gateway/cfsecure” class=”flex.messaging.endpoints.SecureAMFEndpoint”/>
- missing channels for a service
FTD
Popularity: 1% [?]
JQuery Pagination Plugin Update – Multiple Results
Made some adjustments to the jquery pagination plugin.
Originally, it display use one result per page, but doesn’t display multiple results per page. It DOES adjust the pagination navigation which is nice. So I modified it.
First, I need a global vars object to be able to track the items per page and number of entries on the page. Ideally, these would be incorporated within the plugin itself:
1
2
3
4
5
6 $(document).ready(function(){
$.globalVars = {}
$.globalVars.num_entries = 0;
$.globalVars.items_per_page = 1;
...
Second, when the document is ready, I want to be able to load any content, not just html, as in the demo (though, it is html since we’re using their files):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 $.ajax({
url: 'snippet.html',
type: 'GET',
dataType: 'html',
timeout: 1000,
error: function(){
alert('Error loading data');
},
success: function(html){
$('#hiddenresult').html(html);
$.globalVars.num_entries = $('#hiddenresult div.result').length;
// Create pagination element
//alert(num_entries);
$("#Pagination").pagination($.globalVars.num_entries, {
num_edge_entries: 2,
num_display_entries: 1,
callback: pageselectCallback,
items_per_page:$.globalVars.items_per_page
});
}
});
});
Last, I want to show multiple results, by replacing the eq: tag with splice:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 function pageselectCallback(page_index, jq){
var start_splice = $.globalVars.items_per_page * page_index;
var end_splice = start_splice+$.globalVars.items_per_page;
if(page_index != 0 ) {
start_splice += ($.globalVars.num_entries % $.globalVars.items_per_page);
}
if(end_splice > $.globalVars.num_entries) {
end_splice = $.globalVars.num_entries - 1;
}
var new_content = $('#hiddenresult div.result').slice(start_splice,end_splice).clone();
$('#Searchresult').empty().append(new_content);
return false;
}
You can see the demo here
Happy Coding!
FTD
Popularity: 70% [?]
amfphp: setup: part 1
This is a setup of amfphp. I’m not here to sell it, just to show you how to do it. It’s something I wish I had found more easily on the web, so I thought I’d share my setup of it.
Background:
In flash / flex web development, you manipulate value objects. It helps if the client and the server agree on the same value objects. If you send an Asset Value Object from the client to the server, you want the server to agree on all its properties and send it to the database for creating, reading, updating, or deleting. (For purposes of this setup / example, I use Flex as the client, and php as the server-side code).
A value object is, simply put, a representation of an item in a database. If your database has a table called “friends” and each “friend” item in the database has “first_name”, “last_name”, “address” field, then a representation of a friend would be your Friend Value Object or FriendVO. If you setup a class in php and a class in Flex called “FriendVO”, with the properties of “first_name”, “last_name”, “address”, then suddenly everyone is agreeing about the same Value Object.
Why is this important? Well, if I didn’t have VO representation, and added a new field to my “FriendVO” class in the database called “emails”, I would have to find every instance of Creating, Reading, Updating, and Deleting in my entire codebase, for both the Flex and PHP side and modify them to include this new “email” field. BUT, if they’re represented by a class object, I just need to update the two class value objects (one in Flex, the other in PHP), and now both sides can retain the same code. Also, it makes your code more organized and easier to understand for large-scale projects.
Because they both agree on the same object!
But Flex and PHP don’t automatically agree on these objects…because the message sent between them is in AMF – action messenger format, a light-weight way to transmit data in machine language. AMF is great because it makes transferring data lighting fast…but it does so by removing all the wonderful semantic language you’d need to understand exactly what the object is. It trades semantic language for speed. So to get both a client (flex) and server (php / coldfusion / asp, etc.) to agree on these objects, you have to convert the message sent between them from AMF into their agreed upon classes.
Introduce AMFPHP, which takes care of this conversion or Data Serialization, for you in php. I prefer using amfphp, for a variety of reasons, but basically:
- it’s quick to setup
- it’s light-weight
- it makes your code easy to understand by retaining class objects
- it’s easy (once you get over the small learning curve)
Step 1: Downloading AMFPHP
Download the latest version of AMFPHP
Unzip it and you’ll see the amfphp folder. You should see a folder similar to this.
Step 2: Uploading AMFPHP & Testing for PHP
Upload amfphp to your root directory (or wherever you want to host the amfphp services). Test if you have PHP by opening your browser and going to this location on your webserver:
http://yourwebserver.com/amfphp/phpinfo.php
You should see a page similar to this. Most webhosts have PHP 4/5 (you’ll want 5) and this tutorial doesn’t cover installing PHP but there’s plenty of great places on the web to find out how!
Step 3: Testing AMFPHP Gateway
Next, navigate to your amfphp gateway to confirm that amfphp is connected properly. The location is:
“http://yourwebserver.com/amfphp/gateway.php”
You should see a page similar to this.
Step 4: Testing AMFPHP Browser & Services
Next, navigate to your amfphp browser to see a list of services built out, by either clicking the “load the service browser” link or navigating your browser to:
“http://yourwebserver.com/amfphp/browser/”
The amfphp browser is actually a Flex app that takes your settings and connects to amfphp! You’ll be prompted by a Configuration Screen which I recommend you accept at default. Here’s an explanation of the settings:
- Gateway Location – The location of your gateway that Flex needs to connect to in order to pass Value Objects back and forth. It’s default is your actual gateway, so if you move your gateway, you’ll want to update this value to the new location.
- Encoding – AMF0 or AMF3 – basically defines how the value objects are being encoded from Flex to be received and translated or “serialized” by amfphp. I recommend using AMF3 since there’s a pretty good performance boost in speed with that kind of encoding / decoding
- Set Tab After Call – When you test a service, you’ll get a series of tabs displaying the results. This value just sets which Tab is viewed first.
All your web services are placed in the “amfphp->services” folder. The default service that comes with amfphp is “DiscoveryService” which has the methods “describeService”, “getServices”, “listTemplates”. You can call any of these services in the Flex browser of the page and it will return results.
The List component on the left lists all your services. The panel on the right gives a detail view of each service and a button to call each service as well as a text field for any inputs the service requires. This can be incredibly helpful if you want to test out a service you’ve just written!
Step 5: Testing AMFPHP Discovery Service
Navigate to the amfphp DiscoveryService and try the getServices method! Notice it displays the Method Name, Method Description, and Return Values. Press the “Call” button and you should see results in the tab list at the bottom (as off this posting, the “describeService” has been deprecated I believe). Pretty neat but boring. We need to make our own service!
Here’s an example.
That’ll be covered in post 2. Thanks for reading, and I hope this helps.
FTD
Popularity: 20% [?]
popular posts
projectus
what others say
- dominic on JQuery Pagination Plugin Update – Multiple Results
- Ken Phan on JQuery Pagination Plugin Update – Multiple Results
- dominic on JQuery Pagination Plugin Update – Multiple Results
- d8niel on JQuery Pagination Plugin Update – Multiple Results
- dominic on JQuery Pagination Plugin Update – Multiple Results