Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am working with JSON parsing for the first time on Iphone. I need to parse the following json string:
{
EmpMaster :
[
{"empId" : 1,"firstName" : "Yogesh","lastName":"Chaudhari","isSupervisor" : "1","supervisorId":"1"},
{"empId" : 2,"firstName" : "Sahil","lastName":"Khurana","isSupervisor" : "1","supervisorId":"1"},
{"empId" : 3,"firstName" : "Anutag","lastName":"Chaudhari","isSupervisor" : "1","supervisorId":"1"},
{"empId" : 4,"firstName" : "Sameer","lastName":"Vaidya","isSupervisor" : "1","supervisorId":"1"}
]
}
Please provide me with some sample code or link with the help of which i can parse the json string and separate the empId, firstName, lastName, isSupervisor and supervisorId.
You need to add JSON Framework . It will simply parse your JSON String and return you NSDictionary with all the keys.
MODIFIED
Download Zip file from this link
1. Open Folder and rename Classes folder to "JSON".
2. Copy JSON Folder and include in your project.
3. Import header file like below in controller where you want to parse JSON String.
#import "SBJSON.h"
#import "NSString+SBJSON.h"
4. Now, Parse your response string in to NSDictionary like below.
NSMutableDictionary *dictResponse = [strResponse JSONValue];
Hope this help.
One of the most popular framework is touchJSON. Easy to add, easy to use.
Related
I just wanna monitor whether an endpoint is up or not that's it. I can return a simple JSON as shown below
localhost:8080/status
{ "status" : "UP/Down/Critical"}
I want to show this simple information in Grafana real-time
Currently I'm using Infinity Datasource or Sample JSON data source. I intend to use Status panel visualization tool, which is not working.
Moreover, in grafana-api is saw datasource field, which I don't know How to use.
A newbee to Grafana
you should totally be able to visualize status using this plugin, if your source data is pure json.
please clarify whether the data is localhost:8080/status { "status" : "UP/Down/Critical"} or { "status" : "UP/Down/Critical"}
please clarify what do you mean by "not working"
in general the best way to ask such questions is to at least write what you did, what you expected and what you actually got.
Much better option is to quote commands/settings, and show output examples/screenshots.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have built project for a web application configuration. It includes generated (from TypeScript) JSONSchemas. To simplify - user can configure things like forms - field order (string[]), hidden fields(string[]) etc. JSON Schmeas are very helpful for users, who aren't too familiar with the configuration, and it validates some errors, that could rise from mistakes in the configuration.
But they cannot help in every situation - in those string arrays - user can put any string, and the schema will be valid.
What I would want to make - is some dynamic validation - when the user opens [ for the field order - he has to choose from the list of fields, that would be fetched from the APIs.
Something, like when you type packageName: "" in the package.json dependencies - it gets a version for the given package.
I would think, that I would have to make some VSCode extension for this - but I don't know - where to start. Can someone point me in the direction - an example, where someone uses real time JSON schema validation would be grateful.
Found an answer by digging through vscode source code. Searched all files, that contains package.json and dependencies (regex search (package.json[\s\S\n]*dependencies)|(dependencies[\s\S\n]*package.json)) and found a class PackageJSONContribution and this was exactly what I was looking for.
Then I made a simple extension using yo code (as from the example of Your first extension).
Some interfaces and classes I was unable to import from vscode, I just made a local copies for my extension. Made my own class FooJSONContribution with the only difference -
it's getDocumentSelector() function changed to
public getDocumentSelector(): vscode.DocumentSelector {
return [{ language: 'json', scheme: '*', pattern: '**/foo.json' }];
}
Adjusted extensions package.json activationEvents and added "onLanguage:json" (this could be optimised).
Adjusted activate event of the extension by adding
const contribution = new FooJSONContribution(xhr, true);
const disposableCompletionItemProvider = vscode.languages.registerCompletionItemProvider(
contribution.getDocumentSelector(),
new JSONCompletionItemProvider(contribution),
'"',
':'
);
context.subscriptions.push(disposableCompletionItemProvider);
And that's it. All of the foo.json files now work like package.json files -
Things I need to do now - adjust the code of FooJSONContribution.ts to work for my own needs, for my own API's, for my own files.
I Uploaded this example here https://github.com/leqwasd/VsCodeAsyncJsonAutocomplete
I am trying to improve accuracy of passport MRZ reading with tesseract ocr and passportEye I have found few github repositories containing "*.traineddata", it says to move it into tesseract ocr tessdata folder, I did that. No where in readme of these repos says how to use it, I believe it is something trivial, but I am very new to this tesseract thing.
How do I use it with passportEye in python, I am completely lost here. searched a lot. Here is the current code.
import os
from passporteye import read_mrz
pr_path = os.getcwd()
file_path = os.path.join(pr_path,'my_app', 'data')
mrz = read_mrz(file_path + '/test1.jpg')
print(mrz)
This is the .traineddata file I want to test for more accuracy : https://github.com/DoubangoTelecom/tesseractMRZ/blob/master/tessdata_best/mrz.traineddata
I do not want to use bulky openCV. Please help
From looking into the source code I would say you can`t, without changing the codebase of PassportEye:
Normally you would pass the language you are using via: -l paramerter to tesseract - in your case:
-l mrz
But the PassportEye implementation does not give you that option:
https://github.com/konstantint/PassportEye/blob/929c186c4dfa80a1ac975b5f2b95002ca12889d0/passporteye/util/ocr.py#L48
they pass lang=None, you would need to change that part to lang=mrz
pytesseract.run_tesseract(input_file_name,
output_file_name_base,
'txt',
lang='mrz',
config=config)
From what I read in the package documentation ,
the "searchBarController" parameter should allow to filter the results, but I can't find any documentation. I also read through the package content but can't find how to use it.
I found the answer to my question in the example file, which shows how to us the SearchBarController : https://github.com/smartnsoft/flappy_search_bar/blob/master/example/lib/main.dart
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm studying the Caltech101 computer vision dataset using Matlab..
I wanted to classify and train the images of caltech-101 using phow_caltech.m file
but there was a problem, I don't know how to change the categories...
these are what I did.
setup lv_setup
test version : vl_version verbose OK
vl_demo OK
make m_file phow_caltech101.m (copy)
I downloaded caltech101 images at [here][2] by myself and copied to data/caltech-101
>>phow_caltech101 (in command widnow)
I saw fixed example categories (BACKGROUND_Goole, Faces, Faces_easy, Leopards, Motobikes)
I've tried to change the example categories(BACKGROUND_Goole, Faces, Faces_easy, Leopards, Motobikes)
I want to use categories ( accordion, airplanes, anchor, ant in caltech-101)
I changed some codes of phow_caltech101.m but it didn't work...
plz give me some advice ... help me
I look forward to replying your mail or answer thank you~!
this is phow_caltech101 code
C:\VLFEAT\data\caltech-101 ( there are many image folders )
conf.calDir = 'data/caltech-101' ; ( I changed like this in phow_caltech101.m file)
From the help header to phow_caltech101:
The program can also be used to train a model on custom data by pointing CONF.CALDIR to it. Just create a subdirectory for each class and put the training images there. Make sure to adjust
CONF.NUMTRAIN accordingly.
Create a folder (say 'data/myclasses') containing the new classes (image collections) and have conf.caldir point to it, in phow_caltech101.m. That should be the first thing you change. There should be no need to change conf.prefiX if you are still putting the classes under data/.... but you need to adjust conf.numtrain to be the number of training sets you want to use.
caveat: my answer is based entirely on the documentation, I have not run the software.
Edit
Rather than attempt to run the script directly, start by trying to run the following lines at the matlab prompt, to check that you set up your folders correctly:
% the following line should contain the path to your data...
conf.calDir = 'data/caltech-101'; % <-- change this line if necessary
% make sure matlab finds the folder with your data
exist(conf.calDir, 'dir') % should return a "1"
% check the contents of the calibration data folder
classes = dir(conf.calDir)
If the folder does not exist or the contents being listed as classes are incorrect you need to adjust conf.calDir or the location of your data.