Thursday, 3 October 2013

Angularjs ng-repeat-start /end and filter weird behaviour

Angularjs ng-repeat-start /end and filter weird behaviour

I am trying to create Master Details in table here is the plnkr Code
but as i start putting filter for the ng-repeat the dom rendering behaves
weird
click the + button to expand row and the search the textbox
am i doing some thing wrong

Wednesday, 2 October 2013

Having difficulty pairing with a bluetooth OBDII device on Ubuntu

Having difficulty pairing with a bluetooth OBDII device on Ubuntu

I'm attempting to pair with a automotive OBDII bluetooth device from a
Beaglebone Black running Ubuntu Linux, and not having a ton of luck.
I was able, initially to set up hci0 using bluez-simple-agent, although it
never asked me for a PIN. The PIN for this device is supposed to be
"1234". Now, when I run bluez-simple-agent, I get this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo bluez-simple-agent hci0
00:0D:18:A0:4E:35
Creating device failed: org.bluez.Error.AlreadyExists: Already Exists
Which would be fine if it was working, but when I try to bind using
rfcomm, I repeatedly get either "Can't connect RFCOMM socket: Invalid
exchange" (first time after restarting the device) and then "Can't connect
RFCOMM socket: Connection refused" every time thereafter.
This is my /etc/bluetooth/rfcomm.conf file:
rfcomm0 {
# Automatically bind the device at startup
bind no;
# Bluetooth address of the device
device 00:0D:18:A0:4E:35;
# RFCOMM channel for the connection
channel 16;
# Description of the connection
comment "OBDII";
}
And running "rfcomm bind 0" does successfully create a device at
/dev/rfcomm0:
rfcomm0: 00:0D:18:A0:4E:35 channel 16 clean
However, trying to read from /dev/rfcomm0, gives me this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Invalid exchange
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Connection refused
ubuntu@ubuntu-armhf:/etc/bluetooth$
And thereafter, rfcomm returns this:
ubuntu@ubuntu-armhf:/etc/bluetooth$ rfcomm
rfcomm0: 00:0D:18:A0:4E:35 channel 16 closed
I think I am using the correct channel (16) based on the result of
"sdptool records"
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo sdptool records 00:0D:18:A0:4E:35
...
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 16
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100
Any help would be greatly appreciated, because I'm pretty well out of
ideas at this point.
Refs: rfcomm Manually Using Bluetooth RFCOMM How to Set Up Bluetooth
Serial connection over Bluetooth

jQuery Post non working

jQuery Post non working

I'm trying to send via javascript some variables to a php file which will
store them in a db. However nothing happens and I don't find my mistake. I
am sure that the variables are initizialised in javascript and they are
not in php (cause the php code write an empty log). Can you help me?
Thanks a lot
Javascript code:
<script src="http://localhost:8080/libs/jquery-1.10.2.min.js"></script>
<script>
function returned(data) {
alert(data);
}
function postSecret()
{
....
alert(v_text + "\n" + v_age + "\n" + v_is_male);
jQuery.post( "http://localhost:8080/libs/post.php", { text:
v_text, age: v_age, is_male: v_is_male }, returned(data),
"json");
}
</script>
Post.php:
<?php
printf("dkls");
$file = 'log.txt';
$content .= "session: ".$_POST['text']." || ".$_POST['is_male']."
|| ".$_POST['age']."\n";
file_put_contents($file, $content, FILE_APPEND | LOCK_EX);
... database...
?>

How can I make blend edges with shaders

How can I make blend edges with shaders

let me introduce my answer.
This is triagnle rendered with webgl. Well it is a little enlarged ...
And this is triangle, which I want to have:
So Im looking for some shader, that will be able to blend edges of
primitive triangle. I have an idea how to realize one, but Im probably not
good enough to write it yet.
My idea is something like: Based on position of 3 vertices calculate for
each fragment, how much does primitive cover pixel, and then set up
transparency of this pixel based on calculated information...
I can get 2D coordinates from vertex shader and use them in fragment
shader. Now I probably want to use gl_FragCoord.xy or gl_PointCoord.xy and
calculate % pixel cover, but I not able to compare these values (it seems
that units are different, I compute miles with milimetres and also 'point
zero' is somewhere else for these vectors), so I can't calculate final
transparency value.
Can anyone help me please? Just turn me correct way.

mysqli_prepared_statement escapes single and double quotes?

mysqli_prepared_statement escapes single and double quotes?

I am using mysqli_prepared statements to insert into data base as follows:
//insert the poll
$stmnt_insert_poll = mysqli_prepare($con,'INSERT INTO `tblpolls`
(`poll_user_id`, `poll_type_id`, `poll_title`, `poll_details`,
`poll_img`) VALUES (?, ?, ?, ?, ?);');
mysqli_stmt_bind_param($stmnt_insert_poll,'ddsss',$_SESSION['userid'],$_POST['cbotypes'],$_POST['txttitle'],$_POST['txtdetails'],$new_image_name);
if(!mysqli_stmt_execute($stmnt_insert_poll))
{
$query_success = false;
}
$new_poll_id = mysqli_stmt_insert_id($stmnt_insert_poll);
mysqli_stmt_close($stmnt_insert_poll);
I disabled Magic quotes from WHM Cpanel but it still adds backslash to the
single and double quotes. The odd thing is that I still see
"magic_quotes_gpc-On-On" in phpinfo()
I DO NOT WANT TO escape the double quotes only but it shows the
backslashes when trying to select it and view it again.

Tuesday, 1 October 2013

Jquery play framework avoid dual submission

Jquery play framework avoid dual submission

I have a Jquery which submits during on complete and because of that the
submission happens twice. Is there a way to avoid the same?
Following is the code snippet.



My routes for Claim loading looks like this. # Claim Loading for
Historical Claims GET /claimLoading controllers.ClaimLoading.form POST
/claimLoading controllers.ClaimLoading.submit



In my controller the submit happens as shown.
/**
* Handle form submission.
*/
def submit = Action { implicit request =>
claimLoadingForm.bindFromRequest.fold(
// Form has errors, redisplay it
errors => {
Logger.info("Some error occurred before calling the service")
BadRequest(html.claimloading.form(errors))
},
claimLoading => {
// Invoke the LoadCSVorXML2Mongo service from here
claimsLoadingService.loadCSVOrXMLClaimToDatabase(claimLoading.claimLoadingPath)
val resultSummary = claimsLoadingService.retrieveSummaryInfo
// We got a valid ClaimLoading value, display the summary
Ok(html.claimloading.summary(claimLoading,
Json.prettyPrint(resultSummary)))
}
)
}



Jquery call from the button click is >>>>
/views/claimloading/form.scala.html
<input type="button" class="btn primary" id="claimsLoadButton"
value="Invoke Claim Loading">



Jquery in the form.scala under claimloading is >>>>
<script type="text/javascript" xmlns="http://www.w3.org/1999/html">
$(document).ready( function () {
$("#claimsLoadButton").click(function () {
createLoadingModal();
showLoader(true);
$.ajax({
url: "/claimLoading",
type: "POST",
data: $("#claimLoadingForm").serialize(), // serializes the
form's elements.
dataType:"json",
success: function (data) {
showLoader(false);
},
error: function (jqXHR, textStatus, errorThrown) {
},
complete: function (data) {
submitClaimsLoading();
}
});
});
});
function submitClaimsLoading()
{
$("#claimLoadingForm").submit();
showLoader(false);
}
</script>

Module removed in the root folder's web.config is being used in a subfolder

Module removed in the root folder's web.config is being used in a subfolder

My application has this structure
MyApplication -Themes
In my application's webconfig I remove the UrlAuthorization module and add
my own:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
<add name="MyModule" type="MyType, MyNamespace"
preCondition="managedHandler" />
</modules>
My Theme folder has this webconfig (this is the complete webconfig):
<?xml version="1.0"?>
<configuration>
<system.web>
<pages styleSheetTheme="" validateRequest="false" />
</system.web>
</configuration>
I have this deployed in 3 environments. 2 of them works correctly but in
one of them I have the UrlAuthorization module working when I make a
request do a file inside the Theme folder.
I know that the UrlAuthorization is active because I do not get the
resource I requested, but an URL /ReturnURl/... path
The < remove> tag is working because removing it causes the whole request
to be redirect to the /ReturnUrl
Is there any reason that may cause this behavior to happen only in this
machine? I deployed all of them and I do not remember making and different
task on any of them
thanks!