How to integrate barcode scanner directly on my app? - qr-code

Does anyone here knows how to to integrate barcode scanning directly into an application without having the separate ZXing application installed?

The complete source code to Barcode Scanner is here: http://code.google.com/p/zxing
As a developer of the library, I can tell you that two things happen in 95% of cases where someone tries to integrate our source code into their app:
They find it's quite a bit of work to adapt the code and integrate and maintain the scanning in their own app, and they use the Intent API
They copy and paste our code and try to make "their own" app this way
I can tell you we do not want developers to copy and paste our source code. And unless you're an experienced Android dev, you will have trouble re-inventing a scanning app on your own
Bottom line: save yourself the trouble and integrate via Intent: http://code.google.com/p/zxing/wiki/ScanningViaIntent

try to use the Google Chart tool api its very simple, i have a function that i wrote a while back:
function get_QR_code($content = null,$size = null,$ImgTag = true){
if ($size == null){
$size = '150x150';
}
if ($ImgTag){
echo '<img src="http://chart.apis.google.com/chart?cht=qr&chs='.$size.'&choe=UTF-8&chld=H&chl='.$content .'">';
}else{
return 'http://chart.apis.google.com/chart?cht=qr&chs='.$size.'&choe=UTF-8&chld=H&chl='.$content;
}
}
<?php get_QR_code('Hello form Google API'); ?>

Related

How do I add an Apps Script Library to AppMaker?

I created this script to determine if the Session.getScriptTimeZone() would draw the time zone from the library file rather than AppMaker. Here's the script:
function getFormattedDateString(dt,format){
var format=format||"E MMM dd, yyyy HH:mm";
var dt=dt||new Date();
return Utilities.formatDate(new Date(dt), Session.getScriptTimeZone(), format);
}
I tested it in another script with the following code:
function test(){
Logger.log(AMSLib.getFormattedDateString(new Date()));
}
I went into AppMaker and this dialog:
I've tried the Script ID from here:
I've also tried several deployment ID's from the publish from Manifest dialog and I keep getting the same answer:
I've also tried the Project Key which is used with other apps scripts to load libraries.
I don't know what to try next.
First things first, you need to publish your Apps Script app, after that it'll be assigned Script ID(by the way it can also be found in the published app URL). Once you have Script ID, you can specify it in App Maker and select library version you want to use:
To access library's functions you need to use name specified in the object setting:
// Server side library call
var result = MyLibraryName.doSomeCoolStuff();
App Maker should be smart enough and pickup all library's public functions for autocomplete.
Learn more:
https://developers.google.com/apps-script/guides/libraries
https://developers.google.com/appmaker/scripting/libraries
That's really odd to not have a script key there. You might make a copy of your script, something might be corrupted. You can also get the key from the URL ex: https://script.google.com/a/ignitesynergy.com/d/1oHnk_xl76KagGS4g7O2pC1MM4R3iZR8-7FlmzKXxRDtO1o5nDU2/edit
Remember to File-> Manage Versions and create a version. You also need to set the sharing to public.

How can we get the list of bluetooth enabled devices in Xamarin forms application?

I have followed the following URL : https://github.com/aritchie/bluetoothle
But I didn't get that much clarity, is there anyway to get he solution a bit easily ? I just need the list of devices and RSSI....
I'm using plugin from https://github.com/xabre/xamarin-bluetooth-le. To scan the list of devices:
adapter.DeviceDiscovered += (s,a) => deviceList.Add(a.Device);
await adapter.StartScanningForDevicesAsync();
There is also a sample app in the plugin source code for reference.

How to use Flux pattern in client side(browser)?

I am working on a website with React.js and asp.net mvc 4, I am planning to use Flux as my front-end architecture, but I met some problems and was very confused about the use of Flux:
In the beginning,I thought Flux would be a perfect front-end architecture in my website,but after I read a lot of articles about Flux, I find that they are nearly all with NodeJs,even the demos from facebook team,that means they all do the rendering stuffs of React.js/Flux code in server side,right? but How can I use Flux in the client side ,I mean in the user's browser?
I am very confused,am I wrong if I treat react.js/flux as a client side solution?If I am not wrong, but why they all use them with NodeJs and ES6(like facebook Dispatcher.js), That's ok in server side,but what about client side ? most of user broswers don't support ES6. I tried using Babel to convert Dispatcher.js from ES6 to ES5,but the es5 version had some errors and didn't work.
And I also found some implements of Flux that claim to support client side,like fluxxor,but I don't have a chance to try it before I write this post,because I am too confused.
I hope someone can help me to figure out these problems.
ps. Sorry for my english,if you don't understand my words,pls let me know , I will explain it.
I think you want :
$ bower install flux
Then you could do something like this (if using require.js):
require(
['bower_components/flux/dist/Flux'],
function(
Flux )
{
var dispatcher = new Flux.Dispatcher();
dispatcher.register(function(payload) {
if (payload.actionType='test') {
console.log('i got a ', payload);
}
});
dispatcher.dispatch({
actionType: 'test',
otherData: { foo: 'bar' }
});
});
(This answer uses : https://bower.io/, https://libraries.io/bower/flux, http://requirejs.org/)
React is a client side library. You can serve a React App with virtual any backend language. The reason a lot of examples are with node is because it is easy and fast to set up.
You should try this tutorial:
https://facebook.github.io/react/docs/getting-started.html
It is pretty straight forward and doesn't require node.
Also maybe you should try starting to serve the React app statically at the beginning to better understand React itself.
ES6 works in Browsers thanks to Babel. If you believe you have any trouble with Babel, you might want to first play around with it's REPL to get a feeling for it: https://babeljs.io/repl/
The idea is that the code can run on the client and server (universal js, used to be called isomorphic javascript (though it goes a little further then that with serverside rendering etc..),
There are many flux implementations reflux is the most promising at this point , im using martyjs (but they stopped the development, it will be taken over by alt) but even for the flux architecture, u just get the dispatcher / event emitter and some ideas :D,
Shorty said u can install the npm packages (flux, react , babel) etc, but u need something like http://browserify.org/(with reactify) or Webpack, to run them in the browser. U don't need to run them on a node js "after its bundled", webpack/browserify will bundle the code so it can used within the browser independently
https://github.com/christianalfoni/flux-react-boilerplate/ <-- ther are some boilerplate, that provide some nice guide on how to bundle the code.

import a google static map directly in fpdf

I wanted to place a google static map in a pdffile generated by using the fpdf extension.
and used code to make a tempfile first. Using this code. However I run into an error ('can't open image file').
// define the mapurl
$fullURL = 'http://maps.googleapis.com/maps/api/staticmap?center=Amsterdam&z=14&size=100x100&sensor=false';
// create a tempfile
$tempF = tmpfile();
fwrite($tempF, file_get_contents($fullURL));
//Rewind to the start of file
rewind($tempF);
// place the image in the pdf.
if (!empty($tempF)) {
$this->Image($tempF,$start_x, $this->GetY(),0,100);
}
fclose($tempF); // remove the tempfile
Note: OP's own answer extracted from the question.
Then I found out it can be done much easier... I don't need to use a tempfile. If I put the url in the image variable and give a format the thing works in two lines.. I don't use the height and width parameters in fpdf because they stretch the image into a unreadable form.
$fullURL = "http://maps.googleapis.com/maps/api/staticmap?center=". \
$row-Google_coor."&zoom=10&size=2200x200\
&markers=color:blue%7Clabel:D%7C".$row->Google_coor;
$this->Image($fullURL,$start_x, $this->GetY(),0,0,"PNG");
Saddly when using this function sometimes the program returns an error. The image could not be found. But when I put the url string in the browser the image shows up fine. Hopefully this is also a minor fallback.
Lets see if I find a solution on the google apis site https://developers.google.com/maps/documentation/staticmaps/?csw=1
For what it is worth I had this problem as well, I found that my server had an outgoing connections manager, this would automatically block the request, I had to add the ip, once this was done it worked fine.
I had a problem similiar to the OP's. I was getting an error when using FPDF and trying to get the static map image from Google Maps and into my PDF. I was getting "FPDF error: Missing or incorrect image file". What I did is to register in the Google Developer Console and get an API Key, just like they say in the documentation
Hope this helps.
You can download the image and use it with fpdf
$url ="https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&key=".$googleApiKey;
$img = __DIR__.'/img/map.png';
file_put_contents($img, file_get_contents($url));
$pdf->Image($img,null,null,170);
Hope that this will be helpful

Convert local (JQuery) link to CDN link at deploy time

I am currently developing an ASP.NET web application and do most of my development on the road, i.e. offline. I plan to use Google/Microsoft/an-other CDN for JQuery and a couple of other script resources.
My question is, is there a straightforward way to develop with a link to a local file within the solution, but to point to the CDN upon deployment/release build?
Thank you in advance!
You could write a helper function:
public static string JQuerySource()
{
var config = WebConfigurationManager.OpenWebConfiguration("~");
var compilation = config.GetSection("system.web/compilation") as CompilationSection;
if (compilation == null || compilation.Debug)
{
// Running in Debug mode
return "/scripts/jquery.js";
}
// Running in Release mode
return "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";
}
That you would use like this:
<script type="text/javascript" src="<%=JQuerySource() %>"></script>
You could just change the link before you deploy...?
Update:
A simple Replace All will suffice if you have a link everywhere.
I know these might be really dumb and simple solutions, but it seems to me that your problem is too simple to require an abstraction or extra code writing.
However, if you must, this is one way of doing it:
Create an XML file that holds values:
MyAppSettings.xml
<?xml version="1.0" encoding="utf-8" ?>
<MyAppSettings>
<JqueryLink
value="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
store1="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
store2="../jquery.min.js"
>
</JqueryLink>
</MyAppSettings>
And get the value from the XML file:
public static string GetJqueryUrl()
{
XElement file = XElement.Load(HttpContext.Current.Server.MapPath("~/App_Data/MyAppSettings.xml"));
string jquerylink = file.Element("JqueryLink").Attribute("value");
return jquerylink;
}
You could make a helper function for the previous code and use it all over your code.
Whenever you want to switch between deploy and offline links, just change the "value" parameter in the xml file.
You can keep the attributes "store1" and "store2" in there just so I wouldn't have to remember what they are when I do switch them.

Resources