|
FaceBook Sync for Android |
||||||||
FaceBook Sync for Android is a handy application that scans your facebook friends list, and matches any of their profiles with your contacts list. It will then download their profile picture and attach it to their contact. It is an automatic match using the contact name, as most other data from facebook cannot be queried against, so the names need to be match able.
This is the developer's site:
And this is the market barcode:

It relies on you having a well put together contacts list, and it will download duplicates if you have them in your contacts. A top app though!
|
Removing duplicate list items |
||||||||
I was looking to remove duplicate items from a list, a valueList() from a query in fact, and ended out hitting upon the idea to use a struct. ColdFusion structures cannot have duplicate keys, so if I create my list as a struct, it will effectively over right any duplicate values.
Just to clean it up on the other end I extract all the keys back out the structure, giving me a cleaned list.
2
3Original: <cfoutput>variables.tmpList = #variables.tmpList#</cfoutput>
4
5<cfset variables.setter = StructNew()>
6<cfloop index="elem" list="#variables.tmpList#">
7 <cfset variables.setter[elem] = "">
8
9<cfoutput>
10variables.setter[#elem#]<br/>
11</cfoutput>
12
13</cfloop>
14<!--- Convert the set back to a list --->
15<cfset variables.tmpList = StructKeyList(variables.setter)>
16
17Filtered:<cfoutput>variables.tmpList = #variables.tmpList#</cfoutput>
|
Opening a new window from a flex / AIR application |
||||||||
I was sure I had done this before, somewhere but I couldn't find the code anywhere. So I've knocked together a really quick and simple example.
I want to be able to open a new site in a pop up from an AIR application. To do this I need to use the 'urlRequest' function to create a url request. Then insert that into a 'navigateToURL' method, specifying that you want a new window '_new'.
Here is the complete example.
2<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
3
4<mx:Script>
5 <![CDATA[
6
7 public function goToUrl(link:String):void
8 {
9 var urlRequest:URLRequest = new URLRequest('http://' + link);
10 navigateToURL(urlRequest, "_new");
11 }
12
13 ]]>
14</mx:Script>
15
16 <mx:Canvas x="10" y="10" width="321" height="146" backgroundColor="#FFFFFF">
17 <mx:Form x="10" y="52">
18 <mx:FormItem label="URL">
19 <mx:TextInput id="urlTxt"/>
20 </mx:FormItem>
21 </mx:Form>
22 <mx:Button x="10" y="114" label="Go to" click="goToUrl(urlTxt.text)"/>
23 <mx:Label x="10" y="10" text="New Window test" />
24 </mx:Canvas>
25
26</mx:Application>
Works like this.
|
Rounding up to the nearest timed value - Ex every 15 minutes |
||||||||
A watercooler moment threw up an interesting dilemma yesterday. I was talking to a colleague about a scheduled application that would run through a timed loop over the course of a day. It would chop off the top N records from a record set and perform an operation on them. Rather than having to manually run the task every 15 minutes, it would be much better to have it run automatically, at 00,15,30 and 45min markers.
So how to do this?
Initial thoughts wandered through various looping-over type conversations, and creating structures of the timed triggers etc.
First stab coding function looks a little something like this:
2function RoundUp(input){
3var roundval = 15;
4var result = 0;
5
6if(ArrayLen(arguments) GTE 2)
7roundval = arguments[2];
8if(roundval EQ 0)
9roundval = 1;
10
11if((input MOD roundval) NEQ 0)
12{
13result = input + (roundval - (input MOD roundval));
14}
15else
16{
17result = input;
18}
19return result;
20}
21</cfscript>
22
23<cfset variables.time = RoundUp(#timeformat(NOW(),"mm")#)>
24<cfoutput>variables.time = #variables.time#</cfoutput>
Which successfully returns a rounded up value to the nearest 15 minutes.
It is a bit long winded though and after some more thought and consultation with more team members another solution was reached.
Which does exactly the same thing! Maybe not as extensible, you can't exactly build it into a dynamic function, but considerably smaller.








