using bluetoothserial plugin in phonegap build - phonegap-plugins

I'm trying to use a plugin for phonegap build:
https://github.com/don/BluetoothSerial/tree/master
the src code is just an index.html:
<!DOCTYPE html>
<html>
<head>
<title>Simple Serial</title>
</head>
<body>
<div class="app">
<div id="ui">
<button id="connectButton">Connect</button>
</div>
<div id="message">Hello.</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script>
alert("test");
bluetoothSerial.isEnabled(
function() {
alert("Bluetooth is enabled");
},
function() {
alert("Bluetooth is *not* enabled");
}
);
</script>
</body>
</html>
here is my config.xml, just the sample one with the plugin for bluetoothserial:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
versionCode = "10"
version = "1.0.0" >
<!-- versionCode is optional and Android only -->
<name>PhoneGap Example</name>
<description>
An example for phonegap build docs.
</description>
<author href="https://build.phonegap.com" email="support#phonegap.com">
Hardeep Shoker
</author>
<gap:plugin name="com.megster.cordova.bluetoothserial" />
</widget>
The ipa that I get built does not work as intended, I do not get an alert at all.
What am I doing wrong?

Related

combination of Twitter Bootstrap Typeahead and Bootstrap Tags Input not working

I use Twitter Typeahead and Bootstrap Tags Input on our admin-website. Both work perfect when used seperatly. When I try to combine the 2, only the Bootstrap Tags Input code works, Twitter Typeahead does nothing - not even with simple data-objects. I don't see where it goes wrong. This is my test-code.
The objects are delivered from a php-mysql page which delivers data like this:
[{"tags_id":"1","tags_expression":"CLB"},{"tags_id":"2","tags_expression":"SO"},{"tags_id":"3","tags_expression":"Basisonderwijs"}]
Someone an idea?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Naamloos document</title>
<!-- Custom CSS -->
<link href="/style/css/style.css" rel="stylesheet">
<!-- Bootstrap Core CSS -->
<link href="/plugin/bootstrap/css/bootstrap.css" rel="stylesheet">
<!-- Tags input -->
<link href="/plugin/bootstrap-tagsinput/css/bootstrap-tagsinput.css" rel="stylesheet" />
<!-- Typehead CSS -->
<link href="/plugin/typeahead.js-master/dist/typehead-min.css" rel="stylesheet">
</head>
<body>
<form method="post" class="form-horizontal form-material" name="FAQ_Modal_edit_record_insert_form" id="FAQ_Modal_edit_record_insert_form">
<div class="col-md-12">
<h4 class="text-info adjustpadding">Tags</h4>
<div>
<input type="text" class="form-control" value="" id="FAQ_public_tags" name="FAQ_public_tags" autocomplete=off />
</div>
</div>
</form>
</body>
<!-- ============================================================== -->
<!-- Jquery / Bootstrap -->
<!-- ============================================================== -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- ============================================================== -->
<!-- Bootstrap Tagsinput -->
<!-- ============================================================== -->
<script src="/plugin/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script>
<!-- ============================================================== -->
<!-- Typehead Plugin JavaScript -->
<!-- ============================================================== -->
<script src="/plugin/typeahead.js-master/dist/typeahead.bundle.js"></script>
<script>
var data = (function()
{
var json = null;
$.ajax(
{
'async': false,
'global': false,
'url': '/include/FAQ/LIBRARY_Tags.php',
'dataType': "text",
'success': function(data)
{
json = data;
}
});
return json;
})();
$('#FAQ_public_tags').tagsinput({
typeaheadjs:{
name: 'tags',
limit: 5,
displayKey: 'tags_expression',
valueKey: 'tags_id',
source: function(query, process)
{
tags = [];
map = {};
$.each($.parseJSON(data), function(i, tag)
{
map[tag.tags_expression] = tag;
tags.push(tag.tags_expression);
});
process(tags);
},
updater: function(item)
{
var tag = map[item]['tags_expression'];
var tag_id = map[item]['tags_id'];
$("#FAQ_public_tags_id").val(tag_id);
return tag;
}
},
freeInput: true
});
</script>
</html>

gulp-rev-replace isn't changing the revisioned file names in my master.blade.php

I've been trying to create a build system using gulp in a Laravel project and the only problem left right now is renaming the right file names inside my master.blade.php file. As it is now, it's only following the filenames provided in the gulp-useref parameters, but the files revisioned by gulp-rev are not replaced by gulp-rev-replace.
Here is my gulp task:
gulp.task('build', ['clean', 'scss', 'js', 'master'], function() {
var assets,
jsFilter = $.filter('**/*.js'),
cssFilter = $.filter('**/*.css');
return gulp.src('app/views/layouts/master.blade.php')
.pipe(assets = $.useref.assets({searchPath: '/'}))
.pipe(jsFilter)
.pipe($.uglify())
.pipe(jsFilter.restore())
.pipe(cssFilter)
.pipe($.csso())
.pipe(cssFilter.restore())
.pipe($.rev())
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.pipe($.rename(function(path) {
if(path.extname === '.php') {
path.dirname = 'app/views/layouts';
} else {
path.dirname = 'public/assets';
}
}))
.pipe(gulp.dest('./'))
.pipe($.size({title: 'build files', showFiles: true}))
.on('end', function() {
setTimeout(function() {
// force watchify to close all watchers
process.exit();
});
});
});
The default master.blade.php would look like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{$title}}</title>
<!-- build:css assets/index.css -->
<!-- bower:css -->
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.css" />
<!-- endbower -->
<link rel="stylesheet" href="/.tmp/index.css">
<!-- endbuild -->
</head>
<body>
<section id="container">
<header>
#include('layouts.navbar')
</header>
<aside>
#include('layouts.sidebar')
</aside>
<section>
#yield('content')
</section>
<footer>
#include('layouts.footer')
</footer>
</section>
<!-- build:js assets/index.js -->
<!-- bower:js -->
<script src="/bower_components/jquery/dist/jquery.js"></script>
<script src="/bower_components/lodash/dist/lodash.compat.js"></script>
<!-- endbower -->
<script src="/.tmp/index.js"></script>
<!-- endbuild -->
</body>
</html>
and the result will always look like this despite the gulp-rev-replace pipe.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{$title}}</title>
<link rel="stylesheet" href="assets/index.css">
</head>
<body>
<section id="container">
<header>
#include('layouts.navbar')
</header>
<aside>
#include('layouts.sidebar')
</aside>
<section>
#yield('content')
</section>
<footer>
#include('layouts.footer')
</footer>
</section>
<script src="assets/index.js"></script>
</body>
</html>
I figured out the problem, The gulp-rev-replace documentation mentions that they only replace files with extensions ['.js', '.css', '.html', '.hbs'] by default. By passing ['.php'] in the replaceInExtensions option.

route not working in angularjs

I am using angular along with node.
I am using routes to redirect page.
Onto my html page i have defined 2 links as:
<!DOCTYPE html>
<html >
<head>
<title>My Angular App!</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<script src="../public/javascript/angular-route.min.js"></script>
<link data-require="bootstrap-css#*" data-semver="3.2.0" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<script src="/webstorm1/app.js"></script>
<script src="../controllers/registration.js"></script>
</head>
<body>
<div ng-app="test">
<a ng-href="#/login">Login</a>
<a ng-href="#/register">Register</a>
</div>
<div ng-view></div>
</body>
</html>
and onto the app.js file i have defined the route as:
var test = angular.module('test', ['ngRoute'])
.config(function($routeProvider, $locationProvider) {
console.log('test');
$routeProvider.when('/register',
{
templateUrl: '/webstorm1/partials/register.html',
controller: 'registration'
});
$routeProvider.when('/login',
{
templateUrl: '../partials/login.html',
controller: 'login'
});
});
when i run the html file and click on register link, it prints the 'test', but doesnot show the page on browser.
Your <div ng-view></div> is outside of <div ng-app="test"> scope.
<div ng-app="test"> <!-- ng-app starts -->
<a ng-href="#/login">Login</a>
<a ng-href="#/register">Register</a>
</div> <!-- ng-app ends -->
<div ng-view></div> <!-- outside from ng-app -->
Simply put that ng-app="test" to some parent element like body or html to make all elements inside their scope.

jquery autocomplete in ASP not working

I have googled for this and I am not an expert on it either. I tried the following code thinking I am doing it right to implement a simple autocomplete textbox. But does not work. Here is the code. If anyone would help out what could be wrong with it, that will be a big help. My textbox simply does not return any autocomplete suggestions when I try it.
Thanks.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="jquery.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<%--<link href="jquery-ui-1.8.13.custom.css" rel="stylesheet" type="text/css" />--%>
<title></title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
rel="stylesheet" type="text/css"/>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<script type="text/javascript">
$(function () {
$("#TextBox1").autocomplete
({
source: ["Joe", "John", "Jack", "Ben", "Bell", "Steve", "Scott"] // simple list of strings
});
});
</script>
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
There is no reference for jquery ui library in ur code
TRY TO ADD THIS :
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js" type="text/javascript"></script>

Issue with jquery mobile dialog popup when dialog link is dynamically generated

I am using JQuery Mobile and setting up the dialog box link dynamically. Upon user clicking the link, the dialog opens in a separate page, NOT in a dialog box popup. I have the working code below. Can somebody please tell me what I am doing wrong?
Thanks in advance,
Vish
Here is a link to this sample on jsfiddle
http://jsfiddle.net/vishr/ekLWd/
When user clicks on Add Item, I dynamically change the text to Remove Item and when user clicks Remove Item, I put up a dialog box, which in this case opens in a separate page, not a dialog pop-up
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"> </script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"></script>
<script type="text/javascript">
(function(){
$(document).ready(function() {
$("#del-item").live('click', function(){
$.mobile.changePage($('#del-dialog'), 'pop');
});
$("#add-item").live('click', function(){
$('#add-item .ui-btn-text').text('Remove Item');
$('.item').attr('id', 'del-item');
$('.item').attr('href', '#del-dialog');
$('.item').attr('data-rel', 'dialog');
});
$("#close-dialog").click(function(){
$('.ui-dialog').dialog('close');
});
});
})();
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Page Title</h1>
</div><!-- /header -->
<div data-role="content">
<div id="dialog-container" data-inline="true">
Add Item
</div>
</div><!-- /content -->
<div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
<div data-role="dialog" role="dialog" id="del-dialog">
<div data-role="content">
<div style="text-align:center;"><strong>Remove Item?</strong></div>
<form id="myForm">
<div data-role="fieldcontain">
<fieldset class="ui-grid-a">
<div class="ui-block-a">Cancel</div>
<div class="ui-block-b">OK</div>
</fieldset>
</div>
</form>
</div>
</div>
</body>
</html>
If you want the dialog box to open in the same page then you should use SimpleDialog plugin available for jquery mobile.
Below is your code which i have customized using SimpleDialog plugin so that the dialog box appears in the same page
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.js"></script>
<script type="text/javascript" src="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.js"></script>
<script type="text/javascript">
(function(){
$(document).ready(function() {
$("#del-item").live('click', function(){
//$.mobile.changePage($('#del-dialog'), 'pop');
$(this).simpledialog({
'prompt' : 'What do you say?',
'cleanOnClose': true,
'buttons' : {
'OK': {
click: function () {
$('#simplestringout').text($('#simplestring').attr('data-string'));
}
},
'Cancel': {
click: function () { console.log(this); },
icon: "delete",
theme: "c"
}
}
})
});
$("#add-item").live('click', function(){
$('#add-item .ui-btn-text').text('Remove Item');
$('.item').attr('id', 'del-item');
$('.item').attr('href', '#del-dialog');
$('.item').attr('data-rel', 'dialog');
});
$("#close-dialog").click(function(){
$('.ui-dialog').dialog('close');
});
});
})();
</script>
<title>Page Title</title>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Page Title</h1>
</div><!-- /header -->
<div data-role="content">
<div id="dialog-container" data-inline="true">
Add Item
</div>
</div><!-- /content -->
<div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>

Resources