|
I can't figure this out.
I have an array ...
And I want the array record with the minimum distance of 6, in which I calculated already. I figured PHP7 had a function to just select a record in an array, but I can't find it, or it's done some other way that I'm not familiar with.
Input word: mini-stonescape group iii - Lev Distance: 6 - Shortest: 6
Did you mean: stonescapes group iii
Smallest Distance: 6
array(16) {
[0]=>
array(3) {
["key"]=> string(10) "REF_PA_365"
["value"]=> string(21) "stonescapes group iii"
["distance"]=> int(6)
}
[1]=>
array(3) {
["key"]=> string(10) "REF_PA_364"
["value"]=> string(20) "stonescapes group ii"
["distance"]=> int(7)
}
[2]=>
array(3) {
["key"]=> string(10) "REF_PA_081"
["value"]=> string(19) "stonescapes group i"
["distance"]=> int(8)
}
As far as code goes, well I tried about 10 things with failure. So I deleted all my tries. I have nothing but an array. I just need a nudge, a keyword or something.
if ($distance <= $shortest || $shortest < 0) {
$closest = $value;
$shortest = $distance;
}
echo "Input word: $partDescription - Lev Distance: $distance - Shortest: $shortest\n";
if ($shortest == 0) {
echo "Exact match found: $closest\n\n";
$pValue = $closest;
} else {
echo "Did you mean: $closest\n\n";
$distances = array_column($comparisons, 'distance');
$smallestDistance = min($distances);
echo "Smallest Distance: $smallestDistance\n";
var_dump($comparisons);
echo "Best choice: $closest\n\n";
var_dump($pValue);
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I think I figured it out ...
array_search return the index of the record I'm looking for.
And then just call the record by index number.
$distances = array_column($comparisons, 'distance');
$smallestDistance = $distances[0];
$idx = array_search($smallestDistance, $comparisons, true);
$comparison = $comparisons[$idx];
$pValue = $comparison['key'];
$closest = $comparison['value'];
break;
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
have anyone here used Robinhood API to make trading using C# program?
it sounds exciting to have access to Robinhood API to trade crypto currencies since I am a developer...
diligent hands rule....
modified 17-Jan-22 16:02pm.
|
|
|
|
|
Um ... Robin Hood ... didn't he steal from the rich?
I'm not sure I'd want to trust crypto (already a hiding place from crooks and con men) trading (ditto) with a package named after a famous robber!
Mind you, I suspect if you do write C# code to trade Crypto, you could lose your shirt even quicker than you could manually ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
to wear a shirt in my home, it is fine
diligent hands rule....
|
|
|
|
|
No, I prefer the Indiana Jones API
|
|
|
|
|
a quick google search:
Robinhood API - A Complete Guide - AlgoTrading101 Blog[^]
But to answer your question, no, I have not used the Robinhood API. I have a Robinhood account and I trade with Robinhood, just don't have the time now to look into their API - though it looks interesting.
I did not see any documentation that you can trade crypto currency through the API, but I did not review thourougly.
good luck.
|
|
|
|
|
thanks for this link!
I would like to try Crypto trading this year with small fraction of money in 2022...
diligent hands rule....
|
|
|
|
|
I haven't tried it yet but it sounds promising, maybe in a couple of months...
|
|
|
|
|
I want to create social media sharing links for Facebook, Twitter, Pinterest, Tumblr, LinkedIn, WhatsApp and other social media platforms. please suggest me an useful tool.
|
|
|
|
|
I want to create social media sharing links for Facebook, Twitter, Pinterest, Tumblr, LinkedIn, WhatsApp and other social media platforms. please suggest me an useful tool.
|
|
|
|
|
Is Dreamweaver still the best program to use for website development and design? I am trying to encourage a young person to consider becoming a developer and wonder what is the best program today for them to use to start learning on.
|
|
|
|
|
I'm sorry this answer is coming so late! I hope it's still useful. Dreamweaver is still around, but it no longer reigns supreme. Besides, it's not free and it's expensive.
An excellent code editor is Microsoft's Visual Studio Code. This is separate from the Visual Studio used to develop in C# and Visual Basic, and it's free to use. I'd post a link to download it but the link could change, plus it's hardly hard to find.
Now, to learn web development, I've recently come across a fantastic resource that was there, hiding in plain sight all the time. Forget the paid, online academies and check out the Mozilla Developer Network's free course on web development, starting here: Front-end web developer - Learn web development | MDN[^]
This is no two-hour video that rushes you through like one of those "ten countries in ten days" tours of Europe. It starts with HTML, goes on to CSS, and then Javascript. After you're done with HTML/CSS/Javascript, you can go on to Angular, React, etc. The course also includes numerous checkpoints where you can assess what you've learned, and there's a really friendly forum on Discourse, where you can ask questions if you get stuck.
The course has lots of encouraging language while pushing you to think like a software developer. I really can't speak highly enough of it.
|
|
|
|
|
If you can find an old copy of Dreamweaver that you can purchase, that is still a great choice. New is not always better. New(er) is not always better(er). Sometimes, maybe often, new is better, but the boolean statement that new is better is false. Get that old version of Dreamweaver. Find it. Buy it. Use it.
Stay away from Microsoft Visual [anything]. Do not go near it.
Thank you for asking.
|
|
|
|
|
Message Removed
modified 4-Jan-22 7:17am.
|
|
|
|
|
Hi,
Can someone gives me an idea how to get the quotasize on a synology server.
The server works with apache 2.4 and php 7.4. I can use exec commands
I know disk_free_space and disk_total_space but those commands don't look at quota.
Jan
I've been lookking with
$pad = '/volume5/web';
foreach (array(
'quota -u jan',
'df',
'du'
) as $cmd) {
echo $cmd . '<br>';
passthru($cmd);
echo '<hr>';
}
$used = exec("du -c -a $pad");
echo 'used: ' . $used . '<br>';
echo 'quota: ' . exec("quota -u jan") . '<br>';
$var = exec("cat " . pad . " | grep domz | tail -n 1 | awk '{print $4}'");
echo 'var: ' . $var . '<br>';
But so far no luck
|
|
|
|
|
Hey i'm a new member nice to met you!... but i'm natural speaking french
|
|
|
|
|
I'm so much glad to have a chat with you here. I'm also a newbie. Enjoy!
|
|
|
|
|
I want to setup a web server on a raspberry pi for internal use/testing, and I want to be deploy MVC and .Net Core web apps to it. I have no idea where to start. I googled it of course, and info is all over the places as to what to do.
Regarding the apps themselves, I suppose I should use containers to make deployment a little simpler. I've never done ANYTHING with regards to containers, and I don't intend to push anything to extreme limits. Which do I use? Docker, Kubernetes, or...?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
#realJSOP wrote: I've never done ANYTHING with regards to containers, and I don't intend to push anything to extreme limits. Which do I use? Docker, Kubernetes, or...?
Start with Docker because Kubernetes requires knowledge of Docker. Here's a free course I took to study Docker: DevOps with Docker[^]. There's one for Kubernetes as well: https://devopswithkubernetes.com/[^]
|
|
|
|
|
|
I have tried it. It's another layer of pain and difficulty.
|
|
|
|
|
|
Hi John,
I've not done this on a pi but I have on a similar sbc.
First off you need the dotnet sdk and runtimes installed ( plenty of info on Google )
Get the applications ( api, websites or whatever ) working under dotnet first ( dotnet run ) before involving docker.
Install docker.io and docker-compose.
I can post a Dockerfile and docker-compose.yml file on here which with very little modifications would dockerize your programs
Let me know if you want them
"Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
|
|
|
|
|
Hello, I am searching a developer or teams to do several customisation on my company's website. I need to update some features, Create a custom, holiday-themed logo and new banner advertisements . Needless to say the person should be a professional that is reliable and keeps me up to date regarding the projects.
|
|
|
|