Last active
January 2, 2016 05:19
-
-
Save janherich/8255881 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(->> data | |
(filter (comp #(re-find #"^([0-9.]+)\s%$" %) #(get % 5))) | |
(sort-by (comp #(read-string (second (re-find #"^([0-9.]+)\s%$" %))) #(get % 5)) >) | |
(into [])) |
Thanks a bunch mate....
Hi Jan......I guess yiu should bill me at the end of the month....buging you alot ....now I have this nested user data which looks like this
{"" {:username "", :password "$2a$10$ZdhEftfkQ61/k0GvXDaLGOtSRw5q6D3ZjfPdXx8GymrBxf3Bhr1fi", :roles #{:administrator}}, "" {:username "", :password "$2a$10$Au1gLG/5K/EJ0CPpBtMYLu7URjzkpyqv2wIC72oJows9I4xOcwlGa", :roles #{:user}},.......} ......have u worked with datatables...want to display username and role using a datatable like so....var oTable;
$(document).ready(function() {
$('#userslist').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
$.getJSON("/home/user_list", function(json) {
oTable = $('#example').dataTable( {
"aaData": json,
"aoColumns": [
{ "sTitle": "Role", "sClass": "center", "mdata":"roles" }
{ "sTitle": "User Name", "sClass": "center", "mdata":"username" }
],
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
/* Append the grade to the default row class name */
var id = aData[0];
return nRow;
},
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "../datatables/swf/copy_csv_xls_pdf.swf"
}
} );
});
} );
but no luck yet...any Ideas please?
Cheers!
: username and : password are actuall strings....sorry forgot to include them
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Jeff, i don't quite understand, do you mean that my function transform-data does not work with your new vector of maps data-structure ? Then you just need to tweak function transform-data to work with :keyword based retrieval functions instead of indices based, so in the function, instead of #(get % 5), you write just the keyword you use for deviation (this works because keywords are functions of maps you apply to them).
So if you for example have you deviation values mapped under :deviation key, the function definition will be:
Or even better, pass the keyword to use as function parameter, so it becomes:
Then just call it:
BTW, it's good decision to move from vectors to maps in this case, much better structure to hold this type of data.