Is it possible to autoformat source code using Clang? - clang

Is it possible to autoformat translation unit (source code) using Clang C API? I'm able to parse translation unit, but i can't find any according method for my goal.

They have made a nice tool for formatting source code already - Have a look at:
$YOUR_LLVM_DIR/clang/tools/clang-format/ClangFormat.cpp

For Xcode users:
Download and install Package Manager here: http://alcatraz.io
Install ClangFormat by clicking on the icon to the left of it.
In the Edit>Clang Format menu, select Enable Format on Save
Now your files will be automatically formatted as you save.

Related

Simulate printing for ePOS-print iOS sdk

I am using epos sdks for printing in my app. I don't have printer to check the exact output of the printed bill. So is there any way to simulate the output without printer by using epos iOS SDK?
Please download the sdks from the following location https://download.epson-biz.com/modules/pos/index.php?page=single_soft&cid=4768&scat=50&pcat=7
1. Unzip the downloaded file(if it not done automatically) and go to the javascript folder.
2. Unzip "ePOS-Print_Sample_SDK_V5.0.1E" and check for the folder "editor".
3. Open the folder and right click on the 'index.html' file and open it using any browser.
4. Use the edit to enter the input and check the output in preview tab.
You can use EPSON's ePOS XML Editor. I've published the source code for it in a public repo and added a Github Page so it's easier to find and use.
You can find it here: https://franciscohanna.me/epson-epos-xml-editor/.
In the editor, you can drag and drop elements and use the Preview tab to have an approximate preview of the print.

How can I find opencv functions source code?

I am new to opencv and I am using opencv for windows. How can I see the source code for a specific function of an opencv library ? I just one want to get an idea of how that specific machine vision algorithm is implemented.
You can get the OpenCV source code from https://github.com/opencv. An easy way to find the header for a function is to open an explorer window in OPENCV_HOME\build\include (where is the location where you chose to install OpenCV) and use the search box to find the header file that contains your function - this will help you know what module it is in. Then you can search in OPENCV_HOME\modules\MODULE_NAME\src to find the source of the the function. This is even easier if you install a search tool like grepWin.
Looking at the source is almost essential for finding out why those pesky OpenCV exceptions are thrown. It also means that you can answer most things about OpenCV yourself without having to ask here.
Here is a direct link to an excellent source code search, courtesy of Github. This is a very straightforward way to find the implementation and internal usages of a function or type.
All the source is now on github:
https://github.com/opencv/opencv and you can use it's search functionalities as well.
I found the answer by Drew Noakes to be the most helpful, especially given the fact that repository structures keep changing over time.
To search in the code or in other places inside a repository using a keyword, the instructions here can be followed.
What would be even easier for first-timers however, would be to simply search for a key word in the github search bar. Then the appropriate advanced search option would generate the tags described in the the earlier linked tutorial.

How i can generate QR Code using my iPhone/iPad Application?

I have some information like Name,company Name,Company Url,etc using this information i want to generate QR code for that so is there any free api is available for that or is there any way to generate QR code for this purpose?
There are several ways to do that. I have placed one of the example in this answer.
For This answer we are using QR code of 200 x 200 size. for more details see here.
QR code Google API below
http://chart.apis.google.com/chart?cht=qr&chs=200x200&chl=MECARD:
Example:
URL encoded:
http://chart.apis.google.com/chart?cht=qr&chs=200x200&chl=MECARD:ORG%3AArchitect+Of+The+Capitol%2CN%3ABarack+Obama%2CTEL%3A%28202%29+224-3121%2CADR%3A1331+F+St+NW+%23+SB15+Washington%2C+DC+20004-1107%2CEMAIL%3Awww.firstgov.gov
Normal URL:
http://chart.apis.google.com/chart?cht=qr&chs=200x200&chl=MECARD:ORG:Walmart Stores Inc,N:Mike Duke,TEL:(479) 273-4000,ADR:702 SW 8TH ST BENTONVILLE, AR 72712-6209,EMAIL:www.walmartstores.com
Refer to this project wraping c code for iPhone:
https://github.com/kuapay/iOS-QR-Code-Generator
Just couple of steps & you are done :
1) Attach the libz.dylib library to your target in Xcode.
2) Drag the QRDraw and libpng folder files into your project.
3) Update the Header Search path under build settings menu.
Hope this is enough for integration within your app.

LyXliteral programming

I keep writing codes in gedit but at the end of the week we need to submit a lyx literal programming file. Copying and pasting or importing is painful, since , we need to keep pressing tabs or enters. Can anyone suggest a simple alternative to this? Please keep in mind that we need to export the c file from the lyx file.
With the help of my friend, i have written a python code to convert the python or c or any other code, as it is to a lyx file. you can later add whatever you want to the lyx file
Here is the link: http://dpaste.com/hold/671718/
The aforementioned link is broken, but here's the original.
The script essentially takes code and creates LyX scrap from it. It requires that scrap and noweb be installed on the machine in question. Also, I believe I'd made this for LyX v.1.6. Not sure how it will hold up against newer versions. Then again, one can select and indent using tab in scrap code in the newer versions, so the OP's problem is somewhat mitigated.

change shortcut in scite dialog

does anyone know how to change alt-a (replace all) in scite's replace dialog to another shortcut? thanks a lot!
2 methods:
1. Use ResourceHacker and the uncompressed verion of SciTE.
You can get it from http://www.angusj.com/resourcehacker/
Open SciTE.exe with it, go to dialogs/400/1033.
Change the line that starts with
CONTROL "Replace &All"
Then recompile script.
2. recompile the source code...
Unzip the scite source and look for win32\SciTERes.rc
Roundabout line 400 you find the following line:
PUSHBUTTON "Replace &All",IDREPLACEALL,190,41,90,14
You can move the ampersand to a different position to change the shortcut key.
Then recompile SciTE
You can change one of ScITE's profile files by selecting from the Options menu. I usually change the User-level profile but the Global file is useful for seeing a more exhaustive list of settings.
Note 1: If you are the only user, you could change the Global settings but the User-level is just fine. One advantage to changing the User file, at lease in my case, is that User-level file (named .SciTEUser.properties) is saved in my /home/user_name directory -- I'm using Linux -- so it's included in my data backups.
Note 2: I found that altering ScITE settings is like shopping at Costco. You go in with a $30 shopping list in mind and leave $300 later. The number of things you can customize in ScITE is spectacular. It's the first time I have had an editor that feels tailor-made.
The ScITE website provides the documentation. Specifically, you'll want to look for "user.shortcuts" in this link. That section provides a link to all of the commands.

Resources