when i make the json inline it does work. but when i use the webservice it doesn't work.The idea is that i call json for grabbing the data from the "server".
i work with phonegap , did i miss something? feel free to message.
**edit
datatype:"json",
console.log =
[phonegap] [console.log] { readyState: 4,
responseText: '{"rapporten":[{"image":"img/house.jpg","straatnaam":"Dornaardst
raat 14", "postcode":"4901 BN","dossiercode":"8543529681"},{"image":"img/house2.
jpg", "straatnaam":"andersstraat 113", "postcode":"4901 AA", "dossiercode":"9154
374529"},{"image":"img/house3.jpg","straatnaam":"vuurtorenstraat 21", "postcode"
:"1257 HS","dossiercode":"9652063174"}]}{"d":null}',
status: 200,
statusText: 'OK' }
datatype:"html"
console.log =
[phonegap] [console.log] { readyState: 4,
responseText: '{"rapporten":[{"image":"img/house.jpg","straatnaam":"Dornaardst
raat 14", "postcode":"4901 BN","dossiercode":"8543529681"},{"image":"img/house2.
jpg", "straatnaam":"andersstraat 113", "postcode":"4901 AA", "dossiercode":"9154
374529"},{"image":"img/house3.jpg","straatnaam":"vuurtorenstraat 21", "postcode"
:"1257 HS","dossiercode":"9652063174"}]}{"d":null}',
status: 200,
statusText: 'OK' }
datatype:"text"
console.log =
[phonegap] [console.log] {"rapporten":[{"image":"img/house.jpg","straatnaam":"Do
rnaardstraat 14", "postcode":"4901 BN","dossiercode":"8543529681"},{"image":"img
/house2.jpg", "straatnaam":"andersstraat 113", "postcode":"4901 AA", "dossiercod
e":"9154374529"},{"image":"img/house3.jpg","straatnaam":"vuurtorenstraat 21", "p
ostcode":"1257 HS","dossiercode":"9652063174"}]}{"d":null}
HTML
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json",
data: "",
url: "http://localhost:1460/wsApp.asmx/TestingJsonCall",
dataType: "json",
error: function (data) {
console.log("error underneath this:")
console.log(data);
},
success: function (data) {
console.log(data)
try {
var ob = jQuery.parseJSON(data); //this does not work
//i stringify because of the jquery.parseJSON
data = JSON.stringify(data)
//var ob = jQuery.parseJSON('{"rapporten":[{"image":"img/house.jpg","straatnaam":"Dornaardstraat 14", "postcode":"4901 BN","dossiercode":"8543529681"},{"image":"img/house2.jpg", "straatnaam":"andersstraat 113", "postcode":"4901 AA", "dossiercode":"9154374529"},{"image":"img/house3.jpg","straatnaam":"vuurtorenstraat 21", "postcode":"1257 HS","dossiercode":"9652063174"}]}');
console.log(ob);
var A = 1;
var html ='';
var length = ob.rapporten.length;
for (var i = 0; i < length; i++ & A++) {
html += '<div class="rapportItem padding3precent">';
html += '<span id="rapport' + A + '"></span>';
html += '<div class="rapportImage">';
html += '<img id="currentReportsImg' + A + '" src=""/>';
html += '</div>';
html += '<div class="rapportInformation">';
html += '<h3 id="strNm' + A + '"></h3>';
html += '<h3 id="post' + A + '"></h3>';
html += '<p id="docNum' + A + '"></hp>'
html += '</div>';
html += '</div>';
}
$('#content').html(html)
var B = 1;
for (var i = 0; i < length; i++ & B++) {
$("#currentReportsImg" + B).attr("src", ob.rapporten[i].image)
$("#strNm" + B).html(ob.rapporten[i].straatnaam)
$("#post" + B).html(ob.rapporten[i].postcode)
$("#docNum" + B).html(ob.rapporten[i].dossiercode)
}
} catch (e) {
console.log("FOUT JSON PARSE: " + e);
}
},
});
});
webservice in visual basic
<WebMethod> _
Public Sub testingJsonCall()
Dim test = "{" + Chr(34) + "rapporten" + Chr(34) + ":[{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house.jpg" + Chr(34) + "," + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "Dornaardstraat 14" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "4901 BN" + Chr(34) + "," + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "8543529681" + Chr(34) + "},{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house2.jpg" + Chr(34) + ", " + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "andersstraat 113" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "4901 AA" + Chr(34) + ", " + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "9154374529" + Chr(34) + "},{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house3.jpg" + Chr(34) + "," + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "vuurtorenstraat 21" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "1257 HS" + Chr(34) + "," + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "9652063174" + Chr(34) + "}]}"
HttpContext.Current.Response.Write(test)
End Sub
When returning JSON you shouldn't have '' around your objects.
So:
{ readyState: 4,
responseText: '{"rapporten":[{"image":"img/house.jpg","straatnaam":"Dornaardst
raat 14", "postcode":"4901 BN","dossiercode":"8543529681"},{"image":"img/house2.
jpg", "straatnaam":"andersstraat 113", "postcode":"4901 AA", "dossiercode":"9154
374529"},{"image":"img/house3.jpg","straatnaam":"vuurtorenstraat 21", "postcode"
:"1257 HS","dossiercode":"9652063174"}]}{"d":null}',
status: 200,
statusText: 'OK' }
should be:
{ readyState: 4,
responseText: {"rapporten":[{"image":"img/house.jpg","straatnaam":"Dornaardst
raat 14", "postcode":"4901 BN","dossiercode":"8543529681"},{"image":"img/house2.
jpg", "straatnaam":"andersstraat 113", "postcode":"4901 AA", "dossiercode":"9154
374529"},{"image":"img/house3.jpg","straatnaam":"vuurtorenstraat 21", "postcode"
:"1257 HS","dossiercode":"9652063174"}]}{"d":null},
status: 200,
statusText: 'OK' }
Your method has to be shared unless you do this you won’t be able to call the methods:
<WebMethod> _
Public Shared Sub testingJsonCall()
Dim test = "something"
HttpContext.Current.Response.Write(test)
End Sub
THANK YOU
i have found my solution, but i will post it anyway.. mabey if someone stumbles on the same problem. =D
HTML
<link href="css/loads.css" rel="stylesheet" />
<div id="content">
Sorry, there is a connection error...<br/>
Please wait a second.<br />
else , try to restart the program.
</div>
but the problem was my ajax call and response from my webservice
ajax call
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8;",
url: "http://localhost:1460/wsApp.asmx/TestingJsonCall1",
data: "{}",
datatype: "JSON",
error: function (data) { console.log('ERR'); },
dataFilter: function (data) {
var msg = eval('(' + data + ')');
if (msg.hasOwnProperty('d'))
return msg.d;
else
return msg;
},
success: function (msg) {
console.log(msg);
var A = 1;
var html = '';
var length = msg.rapporten.length;
for (var i = 0; i < length; i++ & A++) {
html += '<div class="rapportItem padding3precent">';
html += '<span id="rapport' + A + '"></span>';
html += '<div class="rapportImage">';
html += '<img id="currentReportsImg' + A + '" src=""/>';
html += '</div>';
html += '<div class="rapportInformation">';
html += '<h3 id="strNm' + A + '"></h3>';
html += '<h3 id="post' + A + '"></h3>';
html += '<p id="docNum' + A + '"></hp>';
html += '</div>';
html += '</div>';
}
$('#content').html(html)
var B = 1;
for (var i = 0; i < length; i++ & B++) {
$("#currentReportsImg" + B).attr("src", msg.rapporten[i].image);
$("#strNm" + B).html(msg.rapporten[i].straatnaam);
$("#post" + B).html(msg.rapporten[i].postcode);
$("#docNum" + B).html(msg.rapporten[i].dossiercode);
}
}
});
and my webservice..
webservice
<WebMethod> _
Public Function reports() As String
Dim currentReports As String = "{" + Chr(34) + "rapporten" + Chr(34) + ":[" + _
"{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house.jpg" + Chr(34) + "," + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "Dornaardstraat 14" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "4901 BN" + Chr(34) + "," + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "8543529681" + Chr(34) + "}" + _
",{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house2.jpg" + Chr(34) + ", " + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "andersstraat 113" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "8246 AA" + Chr(34) + ", " + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "9154374529" + Chr(34) + "}" + _
",{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house3.jpg" + Chr(34) + ", " + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "Torenstraat 72a" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "6735 GH" + Chr(34) + ", " + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "5727257342" + Chr(34) + "}" + _
",{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house.jpg" + Chr(34) + ", " + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "andersstraat 21" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "6832 EN" + Chr(34) + ", " + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "4836136116" + Chr(34) + "}" + _
",{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house3.jpg" + Chr(34) + ", " + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "ietsstraat 235" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "8145 PH" + Chr(34) + ", " + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "8643285938" + Chr(34) + "}" + _
",{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house2.jpg" + Chr(34) + ", " + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "dummystreet 3" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "5721 QT" + Chr(34) + ", " + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "1379428192" + Chr(34) + "}" + _
",{" + Chr(34) + "image" + Chr(34) + ":" + Chr(34) + "img/house.jpg" + Chr(34) + ", " + Chr(34) + "straatnaam" + Chr(34) + ":" + Chr(34) + "iemandstraat 11" + Chr(34) + ", " + Chr(34) + "postcode" + Chr(34) + ":" + Chr(34) + "4782 TB" + Chr(34) + ", " + Chr(34) + "dossiercode" + Chr(34) + ":" + Chr(34) + "7254861307" + Chr(34) + "}" + _
"]}"
Return currentReports
End Function
if someone has a better solution i will still mark it.
Related
I am trying to solve a non-linear equation system with maxima.
I use wxmaxima (17.05.0). The non-linear system is rather long and I am deeply sorry for posting the hole problem, but otherwise I do not think my problem will be clear.
I would like to solve these equations for eleven unkowns (K2 to K11) When I run this after some time the error message "No more room for LISP objects" occurs.
I have no glue how I can give it more cpu or to avoid the error.
I need the symbolic solutions for further calculations.
debugmode(true);
gcd : subres;
eq1:mBA*(K10*RABm10 + K11*RABm11 + K12*RABm12 + K7*RABm7 + K8*RABm8 + K9*RABm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RBm2 + K3*RBm3 + K4*RBm4 + K5*RBm5 + K6*RBm6) +
mAB*(K10*RABm10 + K11*RABm11 + K12*RABm12 + K7*RABm7 + K8*RABm8 +
K9*RABm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RBm10 + K11*M11*RBm11 + K12*M12*RBm12 + K2*M2*RBm2 +
K3*M3*RBm3 + K4*M4*RBm4 + K5*M5*RBm5 + K6*M6*RBm6 + K7*M7*RBm7 +
K8*M8*RBm8 + K9*M9*RBm9) =
mBA*(K10*RABm10 + K11*RABm11 + K12*RABm12 + K7*RABm7 + K8*RABm8 +
K9*RABm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RBm10 + K11*RBm11 + K12*RBm12 + K7*RBm7 + K8*RBm8 + K9*RBm9) +
mAB*(K10*RABm10 + K11*RABm11 + K12*RABm12 + K7*RABm7 + K8*RABm8 +
K9*RABm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RBm10 + K11*M11*RBm11 + K12*M12*RBm12 +
K2*M2*RBm2 + K3*M3*RBm3 + K4*M4*RBm4 + K5*M5*RBm5 + K6*M6*RBm6 +
K7*M7*RBm7 + K8*M8*RBm8 + K9*M9*RBm9)$
eq2:mCA*(K10*RACm10 + K11*RACm11 + K12*RACm12 + K7*RACm7 + K8*RACm8 + K9*RACm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RCm2 + K3*RCm3 + K4*RCm4 + K5*RCm5 + K6*RCm6) +
mAC*(K10*RACm10 + K11*RACm11 + K12*RACm12 + K7*RACm7 + K8*RACm8 +
K9*RACm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RCm10 + K11*M11*RCm11 + K12*M12*RCm12 + K2*M2*RCm2 +
K3*M3*RCm3 + K4*M4*RCm4 + K5*M5*RCm5 + K6*M6*RCm6 + K7*M7*RCm7 +
K8*M8*RCm8 + K9*M9*RCm9) =
mCA*(K10*RACm10 + K11*RACm11 + K12*RACm12 + K7*RACm7 + K8*RACm8 +
K9*RACm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RCm10 + K11*RCm11 + K12*RCm12 + K7*RCm7 + K8*RCm8 + K9*RCm9) +
mAC*(K10*RACm10 + K11*RACm11 + K12*RACm12 + K7*RACm7 + K8*RACm8 +
K9*RACm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RCm10 + K11*M11*RCm11 + K12*M12*RCm12 +
K2*M2*RCm2 + K3*M3*RCm3 + K4*M4*RCm4 + K5*M5*RCm5 + K6*M6*RCm6 +
K7*M7*RCm7 + K8*M8*RCm8 + K9*M9*RCm9)$
eq3:mDA*(K10*RADm10 + K11*RADm11 + K12*RADm12 + K7*RADm7 + K8*RADm8 + K9*RADm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RDm2 + K3*RDm3 + K4*RDm4 + K5*RDm5 + K6*RDm6) +
mAD*(K10*RADm10 + K11*RADm11 + K12*RADm12 + K7*RADm7 + K8*RADm8 +
K9*RADm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RDm10 + K11*M11*RDm11 + K12*M12*RDm12 + K2*M2*RDm2 +
K3*M3*RDm3 + K4*M4*RDm4 + K5*M5*RDm5 + K6*M6*RDm6 + K7*M7*RDm7 +
K8*M8*RDm8 + K9*M9*RDm9) =
mDA*(K10*RADm10 + K11*RADm11 + K12*RADm12 + K7*RADm7 + K8*RADm8 +
K9*RADm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RDm10 + K11*RDm11 + K12*RDm12 + K7*RDm7 + K8*RDm8 + K9*RDm9) +
mAD*(K10*RADm10 + K11*RADm11 + K12*RADm12 + K7*RADm7 + K8*RADm8 +
K9*RADm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RDm10 + K11*M11*RDm11 + K12*M12*RDm12 +
K2*M2*RDm2 + K3*M3*RDm3 + K4*M4*RDm4 + K5*M5*RDm5 + K6*M6*RDm6 +
K7*M7*RDm7 + K8*M8*RDm8 + K9*M9*RDm9)$
eq4:mEA*(K10*RAEm10 + K11*RAEm11 + K12*RAEm12 + K7*RAEm7 + K8*RAEm8 + K9*RAEm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*REm2 + K3*REm3 + K4*REm4 + K5*REm5 + K6*REm6) +
mAE*(K10*RAEm10 + K11*RAEm11 + K12*RAEm12 + K7*RAEm7 + K8*RAEm8 +
K9*RAEm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*REm10 + K11*M11*REm11 + K12*M12*REm12 + K2*M2*REm2 +
K3*M3*REm3 + K4*M4*REm4 + K5*M5*REm5 + K6*M6*REm6 + K7*M7*REm7 +
K8*M8*REm8 + K9*M9*REm9) =
mEA*(K10*RAEm10 + K11*RAEm11 + K12*RAEm12 + K7*RAEm7 + K8*RAEm8 +
K9*RAEm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*REm10 + K11*REm11 + K12*REm12 + K7*REm7 + K8*REm8 + K9*REm9) +
mAE*(K10*RAEm10 + K11*RAEm11 + K12*RAEm12 + K7*RAEm7 + K8*RAEm8 +
K9*RAEm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*REm10 + K11*M11*REm11 + K12*M12*REm12 +
K2*M2*REm2 + K3*M3*REm3 + K4*M4*REm4 + K5*M5*REm5 + K6*M6*REm6 +
K7*M7*REm7 + K8*M8*REm8 + K9*M9*REm9)$
eq5:mFA*(K10*RAFm10 + K11*RAFm11 + K12*RAFm12 + K7*RAFm7 + K8*RAFm8 + K9*RAFm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RFm2 + K3*RFm3 + K4*RFm4 + K5*RFm5 + K6*RFm6) +
mAF*(K10*RAFm10 + K11*RAFm11 + K12*RAFm12 + K7*RAFm7 + K8*RAFm8 +
K9*RAFm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RFm10 + K11*M11*RFm11 + K12*M12*RFm12 + K2*M2*RFm2 +
K3*M3*RFm3 + K4*M4*RFm4 + K5*M5*RFm5 + K6*M6*RFm6 + K7*M7*RFm7 +
K8*M8*RFm8 + K9*M9*RFm9) =
mFA*(K10*RAFm10 + K11*RAFm11 + K12*RAFm12 + K7*RAFm7 + K8*RAFm8 +
K9*RAFm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RFm10 + K11*RFm11 + K12*RFm12 + K7*RFm7 + K8*RFm8 + K9*RFm9) +
mAF*(K10*RAFm10 + K11*RAFm11 + K12*RAFm12 + K7*RAFm7 + K8*RAFm8 +
K9*RAFm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RFm10 + K11*M11*RFm11 + K12*M12*RFm12 +
K2*M2*RFm2 + K3*M3*RFm3 + K4*M4*RFm4 + K5*M5*RFm5 + K6*M6*RFm6 +
K7*M7*RFm7 + K8*M8*RFm8 + K9*M9*RFm9)$
eq6:mGA*(K10*RAGm10 + K11*RAGm11 + K12*RAGm12 + K7*RAGm7 + K8*RAGm8 + K9*RAGm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RGm2 + K3*RGm3 + K4*RGm4 + K5*RGm5 + K6*RGm6) +
mAG*(K10*RAGm10 + K11*RAGm11 + K12*RAGm12 + K7*RAGm7 + K8*RAGm8 +
K9*RAGm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RGm10 + K11*M11*RGm11 + K12*M12*RGm12 + K2*M2*RGm2 +
K3*M3*RGm3 + K4*M4*RGm4 + K5*M5*RGm5 + K6*M6*RGm6 + K7*M7*RGm7 +
K8*M8*RGm8 + K9*M9*RGm9) =
mGA*(K10*RAGm10 + K11*RAGm11 + K12*RAGm12 + K7*RAGm7 + K8*RAGm8 +
K9*RAGm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RGm10 + K11*RGm11 + K12*RGm12 + K7*RGm7 + K8*RGm8 + K9*RGm9) +
mAG*(K10*RAGm10 + K11*RAGm11 + K12*RAGm12 + K7*RAGm7 + K8*RAGm8 +
K9*RAGm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RGm10 + K11*M11*RGm11 + K12*M12*RGm12 +
K2*M2*RGm2 + K3*M3*RGm3 + K4*M4*RGm4 + K5*M5*RGm5 + K6*M6*RGm6 +
K7*M7*RGm7 + K8*M8*RGm8 + K9*M9*RGm9)$
eq7:mHA*(K10*RAHm10 + K11*RAHm11 + K12*RAHm12 + K7*RAHm7 + K8*RAHm8 + K9*RAHm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RHm2 + K3*RHm3 + K4*RHm4 + K5*RHm5 + K6*RHm6) +
mAH*(K10*RAHm10 + K11*RAHm11 + K12*RAHm12 + K7*RAHm7 + K8*RAHm8 +
K9*RAHm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RHm10 + K11*M11*RHm11 + K12*M12*RHm12 + K2*M2*RHm2 +
K3*M3*RHm3 + K4*M4*RHm4 + K5*M5*RHm5 + K6*M6*RHm6 + K7*M7*RHm7 +
K8*M8*RHm8 + K9*M9*RHm9) =
mHA*(K10*RAHm10 + K11*RAHm11 + K12*RAHm12 + K7*RAHm7 + K8*RAHm8 +
K9*RAHm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RHm10 + K11*RHm11 + K12*RHm12 + K7*RHm7 + K8*RHm8 + K9*RHm9) +
mAH*(K10*RAHm10 + K11*RAHm11 + K12*RAHm12 + K7*RAHm7 + K8*RAHm8 +
K9*RAHm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RHm10 + K11*M11*RHm11 + K12*M12*RHm12 +
K2*M2*RHm2 + K3*M3*RHm3 + K4*M4*RHm4 + K5*M5*RHm5 + K6*M6*RHm6 +
K7*M7*RHm7 + K8*M8*RHm8 + K9*M9*RHm9)$
eq8:mIA*(K10*RAIm10 + K11*RAIm11 + K12*RAIm12 + K7*RAIm7 + K8*RAIm8 + K9*RAIm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RIm2 + K3*RIm3 + K4*RIm4 + K5*RIm5 + K6*RIm6) +
mAI*(K10*RAIm10 + K11*RAIm11 + K12*RAIm12 + K7*RAIm7 + K8*RAIm8 +
K9*RAIm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RIm10 + K11*M11*RIm11 + K12*M12*RIm12 + K2*M2*RIm2 +
K3*M3*RIm3 + K4*M4*RIm4 + K5*M5*RIm5 + K6*M6*RIm6 + K7*M7*RIm7 +
K8*M8*RIm8 + K9*M9*RIm9) =
mIA*(K10*RAIm10 + K11*RAIm11 + K12*RAIm12 + K7*RAIm7 + K8*RAIm8 +
K9*RAIm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RIm10 + K11*RIm11 + K12*RIm12 + K7*RIm7 + K8*RIm8 + K9*RIm9) +
mAI*(K10*RAIm10 + K11*RAIm11 + K12*RAIm12 + K7*RAIm7 + K8*RAIm8 +
K9*RAIm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RIm10 + K11*M11*RIm11 + K12*M12*RIm12 +
K2*M2*RIm2 + K3*M3*RIm3 + K4*M4*RIm4 + K5*M5*RIm5 + K6*M6*RIm6 +
K7*M7*RIm7 + K8*M8*RIm8 + K9*M9*RIm9)$
eq9:mJA*(K10*RAJm10 + K11*RAJm11 + K12*RAJm12 + K7*RAJm7 + K8*RAJm8 + K9*RAJm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RJm2 + K3*RJm3 + K4*RJm4 + K5*RJm5 + K6*RJm6) +
mAJ*(K10*RAJm10 + K11*RAJm11 + K12*RAJm12 + K7*RAJm7 + K8*RAJm8 +
K9*RAJm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RJm10 + K11*M11*RJm11 + K12*M12*RJm12 + K2*M2*RJm2 +
K3*M3*RJm3 + K4*M4*RJm4 + K5*M5*RJm5 + K6*M6*RJm6 + K7*M7*RJm7 +
K8*M8*RJm8 + K9*M9*RJm9) =
mJA*(K10*RAJm10 + K11*RAJm11 + K12*RAJm12 + K7*RAJm7 + K8*RAJm8 +
K9*RAJm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RJm10 + K11*RJm11 + K12*RJm12 + K7*RJm7 + K8*RJm8 + K9*RJm9) +
mAJ*(K10*RAJm10 + K11*RAJm11 + K12*RAJm12 + K7*RAJm7 + K8*RAJm8 +
K9*RAJm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RJm10 + K11*M11*RJm11 + K12*M12*RJm12 +
K2*M2*RJm2 + K3*M3*RJm3 + K4*M4*RJm4 + K5*M5*RJm5 + K6*M6*RJm6 +
K7*M7*RJm7 + K8*M8*RJm8 + K9*M9*RJm9)$
eq10:mKA*(K10*RAKm10 + K11*RAKm11 + K12*RAKm12 + K7*RAKm7 + K8*RAKm8 + K9*RAKm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RKm2 + K3*RKm3 + K4*RKm4 + K5*RKm5 + K6*RKm6) +
mAK*(K10*RAKm10 + K11*RAKm11 + K12*RAKm12 + K7*RAKm7 + K8*RAKm8 +
K9*RAKm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RKm10 + K11*M11*RKm11 + K12*M12*RKm12 + K2*M2*RKm2 +
K3*M3*RKm3 + K4*M4*RKm4 + K5*M5*RKm5 + K6*M6*RKm6 + K7*M7*RKm7 +
K8*M8*RKm8 + K9*M9*RKm9) =
mKA*(K10*RAKm10 + K11*RAKm11 + K12*RAKm12 + K7*RAKm7 + K8*RAKm8 +
K9*RAKm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RKm10 + K11*RKm11 + K12*RKm12 + K7*RKm7 + K8*RKm8 + K9*RKm9) +
mAK*(K10*RAKm10 + K11*RAKm11 + K12*RAKm12 + K7*RAKm7 + K8*RAKm8 +
K9*RAKm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RKm10 + K11*M11*RKm11 + K12*M12*RKm12 +
K2*M2*RKm2 + K3*M3*RKm3 + K4*M4*RKm4 + K5*M5*RKm5 + K6*M6*RKm6 +
K7*M7*RKm7 + K8*M8*RKm8 + K9*M9*RKm9)$
eq11:mLA*(K10*RALm10 + K11*RALm11 + K12*RALm12 + K7*RALm7 + K8*RALm8 + K9*RALm9)*
(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 + K2*M2*RAm2 +
K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 + K7*M7*RAm7 +
K8*M8*RAm8 + K9*M9*RAm9)*
(1 + K2*RLm2 + K3*RLm3 + K4*RLm4 + K5*RLm5 + K6*RLm6) +
mAL*(K10*RALm10 + K11*RALm11 + K12*RALm12 + K7*RALm7 + K8*RALm8 +
K9*RALm9)*(1 + K2*RAm2 + K3*RAm3 + K4*RAm4 + K5*RAm5 + K6*RAm6)*
(M1 + K10*M10*RLm10 + K11*M11*RLm11 + K12*M12*RLm12 + K2*M2*RLm2 +
K3*M3*RLm3 + K4*M4*RLm4 + K5*M5*RLm5 + K6*M6*RLm6 + K7*M7*RLm7 +
K8*M8*RLm8 + K9*M9*RLm9) =
mLA*(K10*RALm10 + K11*RALm11 + K12*RALm12 + K7*RALm7 + K8*RALm8 +
K9*RALm9)*(M1 + K10*M10*RAm10 + K11*M11*RAm11 + K12*M12*RAm12 +
K2*M2*RAm2 + K3*M3*RAm3 + K4*M4*RAm4 + K5*M5*RAm5 + K6*M6*RAm6 +
K7*M7*RAm7 + K8*M8*RAm8 + K9*M9*RAm9)*
(K10*RLm10 + K11*RLm11 + K12*RLm12 + K7*RLm7 + K8*RLm8 + K9*RLm9) +
mAL*(K10*RALm10 + K11*RALm11 + K12*RALm12 + K7*RALm7 + K8*RALm8 +
K9*RALm9)*(K10*RAm10 + K11*RAm11 + K12*RAm12 + K7*RAm7 + K8*RAm8 +
K9*RAm9)*(M1 + K10*M10*RLm10 + K11*M11*RLm11 + K12*M12*RLm12 +
K2*M2*RLm2 + K3*M3*RLm3 + K4*M4*RLm4 + K5*M5*RLm5 + K6*M6*RLm6 +
K7*M7*RLm7 + K8*M8*RLm8 + K9*M9*RLm9)$
sol:solve([eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11],[K2,K3,K4,K5,K6,K7,K8,K9,K10,K11])$
Here are the missing infos about my system.
wxMaxima version: 17.05.0
Maxima version: 5.40.0
Maxima build date: 2017-06-01 18:54:32
Host type: x86_64-w64-mingw32
System type:
gcc -mno-cygwin -g -O2 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O2 -fexpensive-optimizations -falign-functions=4 -D_WIN32 -DENABLE_UNICODE -I/usr/local/include -DDYNAMIC_FFI -I. -L/usr/local/lib -lintl /usr/local/lib/libreadline.dll.a -L/usr/local/lib -ltermcap /usr/local/lib/libavcall.a /usr/local/lib/libcallback.a -luser32 -lws2_32 -lole32 -loleaut32 -luuid -liconv -L/usr/local/lib -lsigsegv libgnu_cl.a
SAFETY=0 HEAPCODES STANDARD_HEAPCODES GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.8
libiconv 1.13
libreadline 6.0 GNU C 3.4.5 (mingw-vista special r3) PC/386
Lisp implementation type: CLISP
Lisp implementation version: 2.49 (2010-07-07) (built on toshiba [192.168.43.206])
This seems to me like heap exhaustion. Using the :lisp directive from my comment above, you can investigate the current heap size in the underlying Lisp. This is implementation-specific, but assuming you're running on SBCL, the following would retrieve the heap size:
:lisp (cl-user::dynamic-space-size)
Now, Maxima recognizes an environment variable MAXIMA_LISP_OPTIONS, which is just a list of command line parameters passed to Lisp. In SBCL there's a parameter --dynamic-space-size, which specifies the heap size in megabytes. So by running Maxima as follows:
MAXIMA_LISP_OPTIONS="--dynamic-space-size 10000" maxima
you should run the underlying SBCL with 10 GB of heap space, which you can verify as above. This approach would have to be appropriately modified for other Lisp implementations. Let me know if this allows your calculations to run to completion.
I have changed a line in the maxima.bat file.
There you can find some thing like
if exist "%maxima_prefix%/bin/libgcc_s_seh-1.dll" (
if "%lisp_options%"=="" set lisp_options=--dynamic-space-size^ 200
)
I have changed the 200 MB to 8000 MB, this help me to increase the heap size but still I was not able to solve my system of non-linear equations.
I have a native query I want to pass parameters to the following query:
SELECT dqlist.*,score(1) AS rank FROM dq_list_hash_full dqlist WHERE contains(dqlist.dq_english_name,'definescore(fuzzy(, 1, 6, weight),relevance)',1) > 0
I am using the question mark operator but somehow it is not understanding and giving me SQL grammer exception:
Here is my try:
SELECT dqlist.*,score(1) AS rank FROM dq_list_hash_full dqlist WHERE contains(dqlist.dq_english_name,'definescore(fuzzy('?1', 1, 6, weight),relevance)',1) > 0
My JPA repo method:
#Query(nativeQuery = true,value="SELECT\r\n" +
" a.EXTERNALID_ENC,\r\n" +
" a.EXTERNALID,\r\n" +
" a.TELNUMBER,\r\n" +
" a.TELAREACODE,\r\n" +
" a.DQ_ENGLISH_NAME,\r\n" +
" a.DQ_ARABIC_NAME,\r\n" +
" a.NAMEFIELD_1,\r\n" +
" a.USAGETYPE,\r\n" +
" a.STATE,\r\n" +
" a.REGION,\r\n" +
" a.LOCALITY,\r\n" +
" a.ADDITIONALLOCALITYINFO,\r\n" +
" a.GEN_TEXT_7,\r\n" +
" a.GEN_SHORTTEXT_1,\r\n" +
" a.GEN_SHORTTEXT_4,\r\n" +
" a.GEN_SHORTTEXT_9,\r\n" +
" a.GEN_SHORTTEXT_10,\r\n" +
" a.CBCM_ENGLISH_NAME,\r\n" +
" a.CBCM_ARABIC_NAME,\r\n" +
" a.CBCM_EMIRATE_NAME,\r\n" +
" a.CBCM_PARTY_ID,\r\n" +
" a.CBCM_ACCOUNT_ID,\r\n" +
" a.RECORD_ID,\r\n" +
" a.DISPLAY_FLAG,\r\n" +
" a.DISPLAY_FLAG_GROUP,\r\n" +
" a.LONGITUDE,\r\n" +
" a.LATITUDE,\r\n" +
" a.NORMALIZED_ENGLISH_NAME,\r\n" +
" a.CBCM_PARTY_ENGLISH_NAME,\r\n" +
" a.CBCM_PARTY_ARABIC_NAME,\r\n" +
" a.MANUAL_UPDATE_FLAG,\r\n" +
" a.RULE_UPDATE_FLAG,\r\n" +
" a.BUSINESS_UPDATE_FLAG,\r\n" +
" a.EXCEL_UPDATE_FLAG\r\n" +
" \r\n" +
" FROM\r\n" +
" (\r\n" +
" SELECT\r\n" +
" *\r\n" +
" FROM\r\n" +
" (\r\n" +
" SELECT\r\n" +
" dqlist.*,\r\n" +
" score(1) AS rank\r\n" +
" FROM\r\n" +
" dq_list_hash_full dqlist\r\n" +
" WHERE\r\n" +
" contains(dqlist.dq_english_name,'definescore(fuzzy(?1, 1, 6, weight),relevance)',1) > 0\r\n" +
" UNION\r\n" +
" SELECT\r\n" +
" dqlist.*,\r\n" +
" score(1) AS rank\r\n" +
" FROM\r\n" +
" dq_list_hash_full dqlist\r\n" +
" WHERE\r\n" +
" contains(dqlist.dq_english_name,'!?1' ,1) > 0\r\n" +
" )\r\n" +
" ORDER BY\r\n" +
" rank DESC\r\n" +
" ) a\r\n" +
"")
public List<DqListHashFullEntity> findByEngName(#Param("englishName") String englishName);
#Query(value="SELECT\r\n" +
" a.EXTERNALID_ENC,\r\n" +
" a.EXTERNALID,\r\n" +
" a.TELNUMBER,\r\n" +
" a.TELAREACODE,\r\n" +
" a.DQ_ENGLISH_NAME,\r\n" +
" a.DQ_ARABIC_NAME,\r\n" +
" a.NAMEFIELD_1,\r\n" +
" a.USAGETYPE,\r\n" +
" a.STATE,\r\n" +
" a.REGION,\r\n" +
" a.LOCALITY,\r\n" +
" a.ADDITIONALLOCALITYINFO,\r\n" +
" a.GEN_TEXT_7,\r\n" +
" a.GEN_SHORTTEXT_1,\r\n" +
" a.GEN_SHORTTEXT_4,\r\n" +
" a.GEN_SHORTTEXT_9,\r\n" +
" a.GEN_SHORTTEXT_10,\r\n" +
" a.CBCM_ENGLISH_NAME,\r\n" +
" a.CBCM_ARABIC_NAME,\r\n" +
" a.CBCM_EMIRATE_NAME,\r\n" +
" a.CBCM_PARTY_ID,\r\n" +
" a.CBCM_ACCOUNT_ID,\r\n" +
" a.RECORD_ID,\r\n" +
" a.DISPLAY_FLAG,\r\n" +
" a.DISPLAY_FLAG_GROUP,\r\n" +
" a.LONGITUDE,\r\n" +
" a.LATITUDE,\r\n" +
" a.NORMALIZED_ENGLISH_NAME,\r\n" +
" a.CBCM_PARTY_ENGLISH_NAME,\r\n" +
" a.CBCM_PARTY_ARABIC_NAME,\r\n" +
" a.MANUAL_UPDATE_FLAG,\r\n" +
" a.RULE_UPDATE_FLAG,\r\n" +
" a.BUSINESS_UPDATE_FLAG,\r\n" +
" a.EXCEL_UPDATE_FLAG\r\n" +
" \r\n" +
" FROM\r\n" +
" (\r\n" +
" SELECT\r\n" +
" *\r\n" +
" FROM\r\n" +
" (\r\n" +
" SELECT\r\n" +
" dqlist.*,\r\n" +
" score(1) AS rank\r\n" +
" FROM\r\n" +
" dq_list_hash_full dqlist\r\n" +
" WHERE\r\n" +
" contains(dqlist.dq_english_name,'!?1',1) > 0\r\n" +
" )\r\n" +
" ORDER BY\r\n" +
" rank DESC\r\n" +
" ) a\r\n" +
"", nativeQuery=true)
public List<DqListHashFullEntity> findByEngNameTwo(#Param("englishName") String englishName);
I know I am missing something here. Can anybody help me out please?
Edit 1 : I have added the JPA method with whole native query the englishName parameter is binded in two places.
SQL generated in the logs:
SELECT
a.EXTERNALID_ENC,
a.EXTERNALID,
a.TELNUMBER,
a.TELAREACODE,
a.DQ_ENGLISH_NAME,
a.DQ_ARABIC_NAME,
a.NAMEFIELD_1,
a.USAGETYPE,
a.STATE,
a.REGION,
a.LOCALITY,
a.ADDITIONALLOCALITYINFO,
a.GEN_TEXT_7,
a.GEN_SHORTTEXT_1,
a.GEN_SHORTTEXT_4,
a.GEN_SHORTTEXT_9,
a.GEN_SHORTTEXT_10,
a.CBCM_ENGLISH_NAME,
a.CBCM_ARABIC_NAME,
a.CBCM_EMIRATE_NAME,
a.CBCM_PARTY_ID,
a.CBCM_ACCOUNT_ID,
a.RECORD_ID,
a.DISPLAY_FLAG,
a.DISPLAY_FLAG_GROUP,
a.LONGITUDE,
a.LATITUDE,
a.NORMALIZED_ENGLISH_NAME,
a.CBCM_PARTY_ENGLISH_NAME,
a.CBCM_PARTY_ARABIC_NAME,
a.MANUAL_UPDATE_FLAG,
a.RULE_UPDATE_FLAG,
a.BUSINESS_UPDATE_FLAG,
a.EXCEL_UPDATE_FLAG
FROM
(
SELECT
*
FROM
(
SELECT
dqlist.*,
score(1) AS rank
FROM
dq_list_hash_full dqlist
WHERE
contains(dqlist.dq_english_name,'definescore(fuzzy(?1, 1, 6, weight),relevance)',1) > 0
UNION
SELECT
dqlist.*,
score(1) AS rank
FROM
dq_list_hash_full dqlist
WHERE
contains(dqlist.dq_english_name, '!Bhularam' ,1) > 0
)
ORDER BY
rank DESC
) a
It should work by replacing '?1' with ?
So all you have to do is remove the 1 and the '. You can work with multiple parameters by putting multiple ? There's no need to number or escape them
The Query should be like this
SELECT dqlist,score(1) AS rank FROM dq_list_hash_full dqlist WHERE contains(dqlist.dq_english_name,'definescore(fuzzy('?1', 1, 6, weight),relevance)',1) > 0
the .* is not needed here
then before exceuting the query you need to set the param as
query.setParameter(1, "ABC").getResultList();
Try using :1
SELECT dqlist,score(1) AS rank FROM dq_list_hash_full dqlist WHERE
contains(dqlist.dq_english_name,'definescore(fuzzy(:1, 1, 6,
weight),relevance)',1) > 0
This should work
try :1 instead of ?1. It will work.
After a struggle I finally able to come up with a solution. I have use the '||' operator as it is used for String concatenation in Oracle. So my solution is:
SELECT dqlist,score(1) AS rank FROM dq_list_hash_full dqlist WHERE contains(dqlist.dq_english_name,'definescore(fuzzy('||?1||', 1, 6, weight),relevance)',1) > 0
We have some code that checks each incoming file against 3 different criteria before processing (Not a weekend, not after 6pm, not a holiday). This being said, I need to figure out how to have it check for a half hour now (bolded part). I have tried adding a + mRelease > 30 as well as AND mRelease > 30 and both have failed. I have been altering this line
Do While (WeekDay(dRelease) = 1) OR (WeekDay(dRelease) = 7) OR (UBound(fHoliday) > -1) OR (tRelease >17)
Here is the code currently in place:
result = ""
dRelease = Now
tRelease = CStr(Hour(Now))
mRelease = CStr(Minute(Now))
aHoliday = Array("01/02/2017","01/16/2017","05/29/2017","07/04/2017","09/04/2017","10/09/2017","11/23/2017","11/24/2017","12/25/2017","12/26/2017")
dNow = CStr(DatePart("m",Date)) + "/" + CStr(DatePart("d",Date)) + "/" + CStr(DatePart("yyyy",Date))
dMonth = "0" + CStr(Month(dRelease))
dDay = "0" + CStr(Day(dRelease))
dYear = CStr(Year(dRelease))
fHoliday = Filter(aHoliday,Right(dMonth,2) + "/" + Right(dDay,2) + "/" + dYear)
'fHoliday = Filter(aHoliday,dNow)
'result = UBound(fHoliday)
'result = Left(dRelease,10)
'result = CStr(DatePart("m",Date)) + "/" + CStr(DatePart("d",Date)) + "/" + CStr(DatePart("yyyy",Date))
'While release date is a weekend, or release date is a holiday
Do While (WeekDay(dRelease) = 1) OR (WeekDay(dRelease) = 7) OR (UBound(fHoliday) > -1) OR (tRelease >17)
'increase release date by 1
dRelease = dRelease + 1
'result = dRelease
'check for holiday
dMonth = "0" + CStr(Month(dRelease))
dDay = "0" + CStr(Day(dRelease))
dYear = CStr(Year(dRelease))
'fHoliday = Filter(aHoliday,Left(dRelease,10))
fHoliday = Filter(aHoliday,Right(dMonth,2) + "/" + Right(dDay,2) + "/" + dYear)
tRelease = 00
Loop
'Format the release date to the Esker deferred date/time standard.
dMonth = "0" + CStr(Month(dRelease))
dDay = "0" + CStr(Day(dRelease))
dYear = CStr(Year(dRelease))
dtCurrent = Right(dMonth,2) + "/" + Right(dDay,2) + "/" + dYear
If dRelease > Now Then
tRelease = "00:" + mRelease
Else
tRelease = CStr(Hour(Now)) + ":" + CStr(Minute(Now))
End If
result = dtCurrent + " " + tRelease
Change this:
Do While (WeekDay(dRelease) = 1) OR (WeekDay(dRelease) = 7) OR (UBound(fHoliday) > -1) OR (tRelease >17)
...
Loop
into this:
If (WeekDay(dRelease) = 1) Or (WeekDay(dRelease) = 7) Or (UBound(fHoliday) > -1) Or (Time > CDate("16:30")) Then
...
End If
I've got a block of code in my 'Update()' function wich gets the active chunk in my scene, when it has found that chunk, it passes those coordinates to the 'generateFromMiddleOfChunk()' function. That function will generate all the chunks in a 3 radius around the player, it does that with 25 'Instantiate()' functions and a formula. But it only should instantiate the chunks where there isn't already a chunk. It doesn't do that, if anyone could take a look at my code, I would greatly appreciate that. I'm sorry for the very repetetive code and alot of Debug.Log() functions. Every help is greatly appreciated, thank you very much.
Jordi,
I've got this block of code in my Update() function:
function Update() {
var gameObjects : GameObject[] = FindObjectsOfType(GameObject) as GameObject[];
for (var i = 0; i < gameObjects.length ; i++) {
if(gameObjects[i].name.Substring(0,6) == "ACTIVE")
if(gameObjects[i].tag != "Player") {
var xco = gameObjects[i].transform.position.x;
var yco = gameObjects[i].transform.position.y;
var zco = gameObjects[i].transform.position.z;
Debug.Log(xco.ToString()+yco.ToString()+zco.ToString());
generateFromMiddleOfChunk(xco, yco, zco);
}
}
}
This block of codes get the chunk in my scene and gets its x, y and z coordinates, it passes those coordinates to the generateFromMiddleOfChunk() function. This function looks like this:
function generateFromMiddleOfChunk(xco : int, yco : int, zco : int) {
//V1
chunk1 = "Chunk (" + xco.ToString() + ", " + yco.ToString() + ", " + zco.ToString() + ")";
chunk2 = "Chunk (" + (xco + chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco+chunkWidth).ToString() + ")";
chunk3 = "Chunk (" + (xco + chunkWidth).ToString() + ", " + yco.ToString() + ", " + zco.ToString() + ")";
chunk4 = "Chunk (" + (xco + chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco * -1).ToString() + ")";
chunk5 = "Chunk (" + (xco + chunkWidth * -1).ToString() + ", " + yco.ToString() + ", " + (zco+chunkWidth).ToString() + ")";
chunk6 = "Chunk (" + (xco + chunkWidth * -1).ToString() + ", " + yco.ToString() + ", " + zco.ToString() + ")";
chunk7 = "Chunk (" + (xco + chunkWidth * -1).ToString() + ", " + yco.ToString() + ", " + (zco * -1).ToString() + ")";
chunk8 = "Chunk (" + xco.ToString() + ", " + yco.ToString() + ", " + (zco + chunkWidth).ToString() + ")";
chunk9 = "Chunk (" + xco.ToString() + ", " + yco.ToString() + ", " + (zco * -1).ToString() + ")";
chunk10= "Chunk (" + (xco + chunkWidth * -2).ToString() + ", " + yco.ToString() + ", " + (zco + 2 * chunkWidth).ToString() + ")";
chunk11= "Chunk (" + (xco + chunkWidth * -2).ToString() + ", " + yco.ToString() + ", " + (zco + chunkWidth).ToString() + ")";
chunk12= "Chunk (" + (xco + chunkWidth * -2).ToString() + ", " + yco.ToString() + ", " + zco.ToString() + ")";
chunk13= "Chunk (" + (xco + chunkWidth * -2).ToString() + ", " + yco.ToString() + ", " + (zco * -1).ToString() + ")";
chunk14= "Chunk (" + (xco + chunkWidth * -2).ToString() + ", " + yco.ToString() + ", " + (zco + -2 * chunkWidth).ToString() + ")";
chunk15= "Chunk (" + (xco + chunkWidth * -1).ToString() + ", " + yco.ToString() + ", " + (zco + 2 * chunkWidth).ToString() + ")";
chunk16= "Chunk (" + (xco + chunkWidth * -1).ToString() + ", " + yco.ToString() + ", " + (zco + -2 * chunkWidth).ToString() + ")";
chunk17= "Chunk (" + xco.ToString() + ", " + yco.ToString() + ", " + (zco + 2 * chunkWidth).ToString() + ")";
chunk18= "Chunk (" + xco.ToString() + ", " + yco.ToString() + ", " + (zco + -2 * chunkWidth).ToString() + ")";
chunk19= "Chunk (" + (xco + chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco + 2 * chunkWidth).ToString() + ")";
chunk20= "Chunk (" + (xco + chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco + -2 * chunkWidth).ToString() + ")";
chunk21= "Chunk (" + (xco + 2 * chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco + 2 * chunkWidth).ToString() + ")";
chunk22= "Chunk (" + (xco + 2 * chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco + chunkWidth).ToString() + ")";
chunk23= "Chunk (" + (xco + 2 * chunkWidth).ToString() + ", " + yco.ToString() + ", " + zco.ToString() + ")";
chunk24= "Chunk (" + (xco + 2 * chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco * -1).ToString() + ")";
chunk25= "Chunk (" + (xco + 2 * chunkWidth).ToString() + ", " + yco.ToString() + ", " + (zco + -2 * chunkWidth).ToString() + ")";
var chunksInScene : GameObject[] = FindObjectsOfType(GameObject) as GameObject[];
for (var i = 0; i < chunksInScene.length ; i++) {
if(chunksInScene[i].name.Substring(0,5) == "Chunk" || chunksInScene[i].name.Substring(0,5) == "_TERR" || chunksInScene[i].name.Substring(0,5) == "ACTIV") {
if(chunksInScene[i].tag != "Player") {
var oldXco = chunksInScene[i].transform.position.x;
var oldYco = chunksInScene[i].transform.position.y;
var oldZco = chunksInScene[i].transform.position.z;
oldChunk1 = "Chunk (" + oldXco.ToString() + ", " + oldYco.ToString() + ", " + oldZco.ToString() + ")";
oldChunk2 = "Chunk (" + (oldXco + chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco+chunkWidth).ToString() + ")";
oldChunk3 = "Chunk (" + (oldXco + chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + oldZco.ToString() + ")";
oldChunk4 = "Chunk (" + (oldXco + chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco * -1).ToString() + ")";
oldChunk5 = "Chunk (" + (oldXco + chunkWidth * -1).ToString() + ", " + oldYco.ToString() + ", " + (oldZco+chunkWidth).ToString() + ")";
oldChunk6 = "Chunk (" + (oldXco + chunkWidth * -1).ToString() + ", " + oldYco.ToString() + ", " + oldZco.ToString() + ")";
oldChunk7 = "Chunk (" + (oldXco + chunkWidth * -1).ToString() + ", " + oldYco.ToString() + ", " + (oldZco * -1).ToString() + ")";
oldChunk8 = "Chunk (" + oldXco.ToString() + ", " + oldYco.ToString() + ", " + (oldZco + chunkWidth).ToString() + ")";
oldChunk9 = "Chunk (" + oldXco.ToString() + ", " + oldYco.ToString() + ", " + (oldZco * -1).ToString() + ")";
oldChunk10= "Chunk (" + (oldXco + chunkWidth * -2).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + 2 * chunkWidth).ToString() + ")";
oldChunk11= "Chunk (" + (oldXco + chunkWidth * -2).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + chunkWidth).ToString() + ")";
oldChunk12= "Chunk (" + (oldXco + chunkWidth * -2).ToString() + ", " + oldYco.ToString() + ", " + oldZco.ToString() + ")";
oldChunk13= "Chunk (" + (oldXco + chunkWidth * -2).ToString() + ", " + oldYco.ToString() + ", " + (oldZco * -1).ToString() + ")";
oldChunk14= "Chunk (" + (oldXco + chunkWidth * -2).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + -2 * chunkWidth).ToString() + ")";
oldChunk15= "Chunk (" + (oldXco + chunkWidth * -1).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + 2 * chunkWidth).ToString() + ")";
oldChunk16= "Chunk (" + (oldXco + chunkWidth * -1).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + -2 * chunkWidth).ToString() + ")";
oldChunk17= "Chunk (" + oldXco.ToString() + ", " + oldYco.ToString() + ", " + (oldZco + 2 * chunkWidth).ToString() + ")";
oldChunk18= "Chunk (" + oldXco.ToString() + ", " + oldYco.ToString() + ", " + (oldZco + -2 * chunkWidth).ToString() + ")";
oldChunk19= "Chunk (" + (oldXco + chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + 2 * chunkWidth).ToString() + ")";
oldChunk20= "Chunk (" + (oldXco + chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + -2 * chunkWidth).ToString() + ")";
oldChunk21= "Chunk (" + (oldXco + 2 * chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + 2 * chunkWidth).ToString() + ")";
oldChunk22= "Chunk (" + (oldXco + 2 * chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + chunkWidth).ToString() + ")";
oldChunk23= "Chunk (" + (oldXco + 2 * chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + oldZco.ToString() + ")";
oldChunk24= "Chunk (" + (oldXco + 2 * chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco * -1).ToString() + ")";
oldChunk25= "Chunk (" + (oldXco + 2 * chunkWidth).ToString() + ", " + oldYco.ToString() + ", " + (oldZco + -2 * chunkWidth).ToString() + ")";
}
}
}
if(oldChunk1.Equals(chunk1)){load1 = false;}
if(oldChunk2.Equals(chunk2)){load2 = false;}
if(oldChunk3.Equals(chunk3)){load3 = false;}
if(oldChunk4.Equals(chunk4)){load4 = false;}
if(oldChunk5.Equals(chunk5)){load5 = false;}
if(oldChunk6.Equals(chunk6)){load6 = false;}
if(oldChunk7.Equals(chunk7)){load7 = false;}
if(oldChunk8.Equals(chunk8)){load8 = false;}
if(oldChunk9.Equals(chunk9)){load9 = false;}
if(oldChunk10.Equals(chunk10)){load10 = false;}
if(oldChunk11.Equals(chunk11)){load11 = false;}
if(oldChunk12.Equals(chunk12)){load12 = false;}
if(oldChunk13.Equals(chunk13)){load13 = false;}
if(oldChunk14.Equals(chunk14)){load14 = false;}
if(oldChunk15.Equals(chunk15)){load15 = false;}
if(oldChunk16.Equals(chunk16)){load16 = false;}
if(oldChunk17.Equals(chunk17)){load17 = false;}
if(oldChunk18.Equals(chunk18)){load18 = false;}
if(oldChunk19.Equals(chunk19)){load19 = false;}
if(oldChunk20.Equals(chunk20)){load20 = false;}
if(oldChunk21.Equals(chunk21)){load21 = false;}
if(oldChunk22.Equals(chunk22)){load22 = false;}
if(oldChunk23.Equals(chunk23)){load23 = false;}
if(oldChunk24.Equals(chunk24)){load24 = false;}
if(oldChunk25.Equals(chunk25)){load25 = false;}
Debug.Log("1" + chunk1 + oldChunk1 + load1);
Debug.Log("2" + chunk2 + oldChunk2 + load2);
Debug.Log("3" + chunk3 + oldChunk3 + load3);
Debug.Log("4" + chunk4 + oldChunk4 + load4);
Debug.Log("5" + chunk5 + oldChunk5 + load5);
Debug.Log("6" + chunk6 + oldChunk6 + load6);
Debug.Log("7" + chunk7 + oldChunk7 + load7);
Debug.Log("8" + chunk8 + oldChunk8 + load8);
Debug.Log("9" + chunk9 + oldChunk9 + load9);
Debug.Log("10" + chunk10 + oldChunk10 + load10);
Debug.Log("11" + chunk11 + oldChunk11 + load11);
Debug.Log("12" + chunk12 + oldChunk12 + load12);
Debug.Log("13" + chunk13 + oldChunk13 + load13);
Debug.Log("14" + chunk14 + oldChunk14 + load14);
Debug.Log("15" + chunk15 + oldChunk15 + load15);
Debug.Log("16" + chunk16 + oldChunk16 + load16);
Debug.Log("17" + chunk17 + oldChunk17 + load17);
Debug.Log("18" + chunk18 + oldChunk18 + load18);
Debug.Log("19" + chunk19 + oldChunk19 + load19);
Debug.Log("20" + chunk20 + oldChunk20 + load20);
Debug.Log("21" + chunk21 + oldChunk21 + load21);
Debug.Log("22" + chunk22 + oldChunk22 + load22);
Debug.Log("23" + chunk23 + oldChunk23 + load23);
Debug.Log("24" + chunk24 + oldChunk24 + load24);
Debug.Log("25" + chunk25 + oldChunk25 + load25);
/*
//V1
if(load1){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco, yco, zco), Quaternion.identity);}
//V2
if(load2){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth, yco, zco + chunkWidth), Quaternion.identity);}
if(load3){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth, yco, zco), Quaternion.identity);}
if(load4){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth, yco, zco * -1), Quaternion.identity);}
if(load5){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -1, yco, zco + chunkWidth), Quaternion.identity);}
if(load6){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -1, yco, zco), Quaternion.identity);}
if(load7){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -1, yco, zco * -1), Quaternion.identity);}
if(load8){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco, yco, zco + chunkWidth), Quaternion.identity);}
if(load9){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco, yco, zco * -1), Quaternion.identity);}
//V3
if(load10){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -2, yco, zco + 2 * chunkWidth), Quaternion.identity);}
if(load11){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -2, yco, zco + chunkWidth), Quaternion.identity);}
if(load12){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -2, yco, zco), Quaternion.identity);}
if(load13){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -2, yco, zco * -1), Quaternion.identity);}
if(load14){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -2, yco, zco + -2 * chunkWidth), Quaternion.identity);}
if(load15){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -1, yco, zco + 2 * chunkWidth), Quaternion.identity);}
if(load16){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth * -1, yco, zco + -2 * chunkWidth), Quaternion.identity);}
if(load17){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco, yco, zco + 2 * chunkWidth), Quaternion.identity);}
if(load18){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco, yco, zco + -2 * chunkWidth), Quaternion.identity);}
if(load19){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth, yco, zco + 2 * chunkWidth), Quaternion.identity);}
if(load20){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + chunkWidth, yco, zco + -2 * chunkWidth), Quaternion.identity);}
if(load21){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + 2 * chunkWidth, yco, zco + 2 * chunkWidth), Quaternion.identity);}
if(load22){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + 2 * chunkWidth, yco, zco + chunkWidth), Quaternion.identity);}
if(load23){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + 2 * chunkWidth, yco, zco), Quaternion.identity);}
if(load24){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + 2 * chunkWidth, yco, zco * -1), Quaternion.identity);}
if(load25){Instantiate(terrains[Random.Range(0,terrains.length)], Vector3(xco + 2 * chunkWidth, yco, zco + -2 * chunkWidth), Quaternion.identity);}
*/
}
http://answers.unity3d.com/questions/177931/tutorial-minecraft-chunks.html
This is a link to the UnityAnswers with a tutorial on how to chunk in Unity3D . You can look ther efor more information ,and hopefully an answer to your quetsion.
I want to use "diamond" symbol in D3.
I am not sure how the sizing for symbols works in D3. My requirement is:
svg = d3.select("svg");
svg.append("g").append("path")
.attr("d", d3.svg.symbol()
.size( function(d) { return 15 })
.type( function(d) { return "diamond" }))
.attr("transform", "translate(250, 150)")
.style("fill", "black");
I want the height of the diamond to be set to 15px. Can anyone help me on this ? Thanks in advance.
Following on from the answer by Adam Pearce, I am using the following code, which appears to deliver consistent and accurate results across all of the available d3.svg.symbol shapes (e.g. diamond, cross, square etc.):
d3.svg.symbol().size(function(d) {
return (itemHeight * itemHeight) / 2;
}))
Where itemHeight refers to a fixed height for the shape.
Try:
.size( function(d) { return 15*15 })
From the documentation:
sets the size-accessor to the specified function or constant in square
pixels
Since I need a exact height / width, ended up using something like this to get the "d" attribute:
if (shape == "triangle") {
return "M " + dim / 2 + " 0 L " + dim + " " + dim + " L 0 " + dim + " " + dim / 2 + " 0";
}
if (shape == "diamond") {
return "M " + dim / 2 + " 0 L " + dim + " " + dim / 2 + " L " + dim / 2 + " " + dim + " L 0 " + dim / 2 + " L " + dim / 2 + " 0";
}
where "dim" is the height value.