I have a small app I am testing in XCode6 and I get 2 compiler warnings for the SBSJsonParser.m file
Semantic Issue variable 'k' may be uninitialized when used here (in function scanRestOfDictionary)
c++;
if (![self scanValue:&v]) {
NSString *string = [NSString stringWithFormat:#"Object value expected for key: %#", k];
[self addErrorWithCode:EPARSE description: string];
return NO;
}
and same again variable 'lo' may be uninitialized when used here (in function scanUnicodeChar)
if (lo < 0xdc00 || lo >= 0xdfff) {
[self addErrorWithCode:EUNICODE description:#"Invalid low surrogate char"];
return NO;
}
anyone with any ideas?
Erm, which version of SBJson are you using? Version 2.3.x? Version 3 and above doesn't have the code you're referring to in a file with that name. Version 4 and above doesn't have that class.
If you're still using a SBJson version prior to version 3.0, I'd suggest you just should use NSJSONSerialisation instead. If you insist on using SBJson I suggest you upgrade to either version 3 or 4 series. (Depending on your needs.)
(Disclaimer: I am the author of SBJson.)
Related
can anybody help me with solving my problem of Hex2Bin and Bin2Hex functions?
First I was trying to make the conversion Hex2Bin. I would like to call the AddIn function from macro so I called createUNOservice:
Function fcHex2Bin(arg as variant, NumberOfBits As integer) as string
Dim oService as Object
oService = createUNOService("com.sun.star.sheet.addin.Analysis")
sArg = cStr(arg)
fcHex2Bin = oService.getHex2Bin(sArg,NumberOfBits)
End Function
but all the time ends with fault message like "The object variable is not set.". I already don't know why.
My final goal would be to make all functions of Calc running in macros, but at this moment I would be glad to have two functions Hex2Bin and Bin2Hex running - anyhow.
My LibreOffice version:
Version: 7.1.3.2 (x64) / LibreOffice Community
Build ID: 47f78053abe362b9384784d31a6e56f8511eb1c1
CPU threads: 8; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL
Thank you for your help.
This way works.
Function fcHex2Bin(aNum As String, rPlaces As Any) As String
Dim oFunc As Object
oFunc = CreateUnoService("com.sun.star.sheet.FunctionAccess")
Dim aArgs(0 to 1) As Variant
aArgs(0) = aNum
aArgs(1) = rPlaces
fcHex2Bin = oFunc.callFunction("com.sun.star.sheet.addin.Analysis.getHex2Bin", aArgs())
End Function
As for why the other way does not work, many analysis functions require a hidden XPropertySet object as the first argument. The following code produces informative error messages:
REM IllegalArgumentException: expected 3 arguments, got 1
sResult = oService.getHex2Bin(ThisComponent.getPropertySetInfo())
REM IllegalArgumentException: arg no. 0 expected: "com.sun.star.beans.XPropertySet"
sResult = oService.getHex2Bin(ThisComponent.getPropertySetInfo(), "2", 4)
However I tried passing ThisComponent.getPropertySetInfo().getProperties() from a Calc spreadsheet and it still didn't work, so I'm not exactly sure what is required to do it that way.
The documentation at https://help.libreoffice.org/latest/he/text/sbasic/shared/calc_functions.html does not really explain this. You could file a bug report about missing documentation, perhaps related to https://bugs.documentfoundation.org/show_bug.cgi?id=134032.
I have the following declaration for a function and I don't know what I am doing wrong with regards to the type declaration:
//function is defined in the OpenCVWrapper.mm file .....no errors
+ (NSArray *)analysePoints:(std::vector<cv::Point> )pointsVector{
.......
}
//error is in the OpenCVWrapper.h file
#interface OpenCVWrapper : NSObject
+ (NSArray *)analysePoints:(NSMutableArray *)mutableArray:(std::vector<cv::Point>)pointsArray;
//red marker under the std
#end
I am getting the error "expecting type" for the vector. What am I doing wrong here?
Actually, I found the solution through user11118321 input to look at the bigger picture. I am using this set up in a swift app that uses openCV through a bridging header. It is actually not possible to import or use a vector in swift.
I use CoffeeScript [CS] /heavily/ in my meteor sources. In fact, everything in my project is written using CS. I want to write packages by the same token. How should they be organized, declared, and written so they leverage the power of the CS dialect while maximizing testability and portability?
In short, you need only api.use('coffeescript'); in your Package.onUse and Package.onTest in order to write your packages in CoffeeScript. See the docs for an outline of the namespacing quirks.
Here's a simple example of a package called safe which contains the following four files:
package.js
Package.describe({
name: 'safe',
summary: 'Encrypt strings to keep them safe (or not)'
});
Package.onUse(function(api) {
api.versionsFrom('1.1.0.3');
api.export('Safe');
api.use('coffeescript');
api.addFiles('encrypt.coffee');
api.addFiles('safe.coffee');
});
Package.onTest(function(api) {
api.use('tinytest');
api.use('safe');
api.use('coffeescript');
api.addFiles('tests.coffee');
});
encrypt.coffee
# use the share object to export code to other files in the package
share.encrypt = (string) ->
# a super strong encryption :)
string.replace /[a-zA-Z]/g, (c) ->
String.fromCharCode (if ((if c <= "Z" then 90 else 122)) >= (c = c.charCodeAt(0) + 13) then c else c - 26)
safe.coffee
{encrypt} = share
class Safe
constructor: (#string) ->
encrypt: ->
encrypt #string
tests.coffee
Tinytest.add 'safe encryption', (test) ->
safe = new Safe 'pandapants'
test.equal safe.encrypt(), 'cnaqncnagf'
This should give you a template to start from. If you need additional clarification, just ask in the comments and I'll update the answer as needed.
I 'm using OpenCV 2.3.1 and Qt and i am facing a problem with cv::calcOpticalFlowPyrLK. I am using oodFeaturesToTrack and calcOpticalFlowPyrLK to track a face that I have previously detected.
std::vector<cv::Point2f> Feat;
GrayFrame=FrameBuffer->GetFrame();
cv::goodFeaturesToTrack(GrayFrame,
Feat,
maxcorners,
qualitylevel,
mindistance);
while(1){
std::vector<cv::Point2f> NewFeat;
std::vector<uchar> status;
std::vector<float> err;
GrayFramePrev=GrayFrame.clone();
GrayFrame=FrameBuffer->GetFrame();
cv::calcOpticalFlowPyrLK(GrayFramePrev,
GrayFrame,
Feat,
NewFeat,
status,
err);
Feat=NewFeat;
}//while(1)
GrayFrame takes an image from a buffer where i store the images captured from a webcam both GrayFrame and GrayFramePrev contain the right image (GrayFrame -> FrameBuffer[i], GrayFramePrev -> FrameBuffer[i-1]) when they are at cv::calcOpticalFlowPyrLK and the Feat parameter contains points from goodFeaturesToTrack. But when calcOpticalFlowPyrLK is executed it returns via NewFeat the exact same points.
Please tell me what i am doing wrong with the `calcOpticalFlowPyrLK
Solution (For me)
I used the following parameters and it worked (i probably mixed up Feat and NewFeat also so that was the problem).
cv::calcOpticalFlowPyrLK(GreyFramePrev,
GreyFrame,
Feat,
NewFeat,
status,
err,
*WinSize,
maxLevel,
*TermCrit,
derivLamda,
LKflags,
minEigThreshold);
Parameter values
WinSize= new cv::Size(31,31);
maxLevel=3;
TermCrit= new cv::TermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03);
derivLamda=0;
LKflags=0;
minEigThreshold=0.001;
I'm trying to get some urls using post method in tcl 8.0.
it doesn't print any output.
here is chunk of my code.
foreach sKey [array names aQuery] {
set sValue $aQuery($sKey)
append sQueryString "[::http::formatQuery $sKey $sValue]&"
}
set sQueryString [string trim $sQueryString "&"]
set sToken [::http::geturl $sUrl -query $sQueryString -channel stdout]
::http::wait $sToken
upvar #0 $sToken state
foreach sKey [array names state] {
puts "$sKey $state($sKey)"
}
Upgrade already. Why the heck are you using a version that was released in the last millenium.
The http::formatQuery procedure takes one or more key value pairs as arguments so that part would be better rendered as below. If in doubt its probably better to avoid using the -channel option and check for the status yourself. So something like:
set query [eval ::http::formatQuery [array get aQuery]]
set tok [http::geturl $sUrl -query $query -timeout 10000]
http::wait $tok
if {![string compare [http::status] "ok"]} {
puts [http::data $tok]
} else {
puts stderr [http::error $tok]
}
http::cleanup $tok
Note that in more recent versions of tcl you could have used [http::status] eq "ok" or [string equal [http::status] "ok"]. Don't forget to cleanup the http token. If you are doing this in a GUI program, use the -command option and do all the work in the callback so you don't freeze the UI while doing the http::wait.