Read characteristic from RN4020 with CoreBluetooth

ios
Question: I've been working on a device using an rn4020 bluetooth module. We need to change the output and read the input from the device. I've written a code using CoreBluetooth and working on iOS to do that. I was able (after some struggling) to set the device in command mode and change the output. Now what I want is reading the input (basically high and low level). To set the output I'm using the following code:-(void)OutputOn{ NSData *data = [@"|O,08,08" dataUsingEncoding:NSUTF8StringEncoding]; NSMutableData *mData = [NSMutableData dataWithData:data]; unsigned char f8[1] = "r"; [mData appendBytes:f8 length:1]; [self.discoveredPeripheral writeValue:mData forCharacteristic:self.MLDPDataCharacteristic type:CBCharacteristicWriteWithResponse]; } -(void)OutputOff{ NSData *data = [@"|O,08,00" dataUsingEncoding:NSUTF8StringEncoding]; NSMutableData *mData = [NSMutableData dataWithData:data]; unsigned char f8[1] = "r"; [mData appendBytes:f8 length:1]; [self.discoveredPeripheral writeValue:mData forCharacteristic:self.MLDPDataCharacteristic type:CBCharacteristicWriteWithResponse]; } Like I said this is working.…
Read More

Image Reader as Camera 2 preview

Uncategorized
Question: I got a little problem with having multiple preview output surfaces. I got 2 surfaces, GLSurfaceView and an ImageReader. What I tried so far; remove the ImageReader as preview target [works great] remove the GLSurfaceView leaving the imageReader alone [doesnt work] putting the 2 together as preview target. [doesnt work] last 2 things have the same issue, the imageReader receive image, but only 7 frames, after that an error is thrown in the setRepeating CaptureCallback which has a failure reason REASON_ERROR. I am sure they both share the same size 1024 x 768 Answer: Im still not sure why but after acquiring the image by calling acquireNextImage(), the error was gone. By the way, you need to close the acquire image. Read more
Read More

CAnnot upload image after upgrade to 1.1.9.3 Magento

Uncategorized
Question: Maybe you have seen this question before, but I still cannot find a solution after I have upgraded Magento to 1.1.9.3. Can some one explain the solution 3 in this link? https://community.magento.com/t5/Security-Patches/SUPEE-8788-Solutions-to-Different-Problems/td-p/52572 and in main template that following is not overwritten by another theme. Where is main template? Answer: Read more
Read More

get invoice in my site using invoice id from xero api?

Uncategorized
Question: I am using xero for generate invoice, now I want get invoice using xero invoice id in php, my code is ........... $nik = $xero->load('Accounting\Invoice') ->where('InvoiceID', $outwardRecord->xero_invoice_id) or ->where('InvoiceID', XeroPHPModelsAccountingInvoice::InvoiceID) ->execute(); but it's given error Fatal error: Undefined class constant 'InvoiceID' in /var/w please guide me how to get invoice using invoiceId, how understand my problem. thanks! Answer: thanks to all, finally I got answer, $xero_api_config = getCustomConfigItem('xero_api_config'); $xero = new XeroPHPApplicationPrivateApplication($xero_api_config); $response=$xero->loadByGUID('Accounting\Invoice',$xero_invoice_id); print_r($response); it's working! Read more
Read More

How to measure JAVA MetaSpace?

Uncategorized
Question: I am optimizing JVM parameter for a production environment, this includes setting up maximum MetaSpace for the application.I have following issues on fixing this:Do I actually want to set the limit as the environment have more than one application? Is there an inbuilt tool (JDK) measure the current utilization of metaspace? (as i need to connect to remote host any command line tool ) Answer: Yes, you can see the utilization of metaspace memory at runtime, by running the command jstat -gc (PID), where the returned result MU is the usage. Read more
Read More

why did not show first value of $img by array_search()

Uncategorized
Question: why did not show first value of $img by array_search() There is $img where are 4 values. I do not know why always do not show first value of $img ($img[0]); If I changed first value then same problem. Please tell me where is the problem? function auto_call(){ $img=array("png","jpeg","gif","jpg"); $arrt=array("txt","jpg","png","gif","jpeg"); for($j=0;$j Read more
Read More

Converting JSON to HTML and using the html and convert it to PDF

Uncategorized
Question: I have to convert JSON data into HTML and then convert that HTML to PDF. I know how to convert json to html and i know how to convert HTML to PDF. I want to know How can i integrate both of those into one. How do i send the var html into the fs.readfile ? JSON to HTML : var json2html = require('node-json2html'); var data = [{'male':'Bob','female':'Jane'},{'male':'Rick','female':'Ann'}]; var transform = {"":"div","html":"${male} likes ${female}"}; var html = json2html.transform(data,transform); HTML to PDF:'use strict'; var http = require('http'); var fs = require('fs'); var pdf = require('html-pdf'); http.createServer(function (req, res) { fs.readFile('./PDF.html', 'utf8', function (err, html) { if (err) { //error handling } pdf.create(html).toStream(function (err, stream) { if (err) { //error handling } res.writeHead(200, { 'Content-Type': 'application/force-download', 'Content-disposition': 'attachment; filename=file.pdf' }); stream.pipe(res);…
Read More

Inserting HTML Into OneNote

c#
Question: I'm trying to transfer information from a Word Document to a OneNote document. I got the html which made up the contents of a word document, but I want to take that html that was generated and store that into a OneNote file. I have tried things like the OneNote API and the Microsoft Graph API, but is there a way to do this without using those API tools? Here is the code I have for generating the HTML from a word document. byte[] byteArray = File.ReadAllBytes("GreetingFile2.docx"); using (MemoryStream memoryStream = new MemoryStream()) { memoryStream.Write(byteArray, 0, byteArray.Length); using (WordprocessingDocument doc = WordprocessingDocument.Open(memoryStream, true)) { HtmlConverterSettings settings = new HtmlConverterSettings() { PageTitle = "My Page Title" }; XElement html = HtmlConverter.ConvertToHtml(doc, settings); File.WriteAllText("‪Something.html", html.ToStringNewLineOnAttributes()); } } Thanks! Answer: Read more
Read More

Time Doesn’t update in TextView on every Button click… What’s the issue?

Uncategorized
Question: Time just update for first click... If I click next time It doesn't work. Help me... Question end. Stack overflow want me to type more details. But this question doesn't need more explanation I don't know what to add I can't type more for this long it still want me to type something to make the code Java Code :package com.test.blog.timepicktest; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.Calendar; public class MainActivity extends AppCompatActivity { Calendar c = Calendar.getInstance(); TextView tv; Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.tv); btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tv.setText(c.get(Calendar.HOUR) + ":" + c.get(Calendar.MINUTE) + ":" + c.get(Calendar.SECOND)); } }); } } XML File : Answer:…
Read More