Quickchart Wordcloud API is returning spread and small text - url

I am trying to get the Quickchart Wordcloud API to work, however, I get very spread apart and small text.
This used to work fine (I tested it a few weeks ago), but something seems to have changed to cause the issue you can test below.
Example
Apart from the text, you can see the querystring below:
rotation=0&format=png&height=176px&width=506px&font-family=sans-serif&removeStopwords=true&text=
Any insight into how I can get this to work would be appreciated.

I maintain this API and want to apologize for the trouble you encountered over the last few weeks. This should be fixed now with no action required on your end.
Some background on the trouble: the underlying library, d3-cloud, is a bit finicky and under certain conditions it will not show top words if they are too large. We attempt to resolve this by sizing the words explicitly, but this can be imprecise because we do not have full rendering information. In the long term, I'd like to move to a more robust rendering library but for now we're tuning the workaround.
Related issues in the d3-cloud repo:
https://github.com/jasondavies/d3-cloud/issues/166
https://github.com/jasondavies/d3-cloud/issues/159
https://github.com/jasondavies/d3-cloud/issues/36

Related

Is there a way to have a formula or script pick an amount of pre-set lengths to cover an area

Apologies if the title isn't very clear.
What I am trying to do is get a google sheet to automatically calculate how many lengths of a material I will need to cover an area, hopefully to include a mix if needed. There are three different lengths of material that never change, but the total area I need to cover changes on a case by case basis. It is only a straight line so there is no need to worry about width or height.
The data breaks down as follows:
Pre-set lengths to choose from
10'6"
12'6"
14'6"
Length of area I need to cover only comes in inches (ie. 68 1/2"; 70"; 59")
The only thing I have been successful in doing is getting the length I need to cover and then manually picking out how many pieces of each length I need, but I cannot think of any way for me to have a formula or script optimize how many of each piece I need. I can understand formulas well enough, but once trying to script anything comes into play I start getting lost. I believe this issue may be beyond the capabilities of formulas.
This is an interesting problem - I don't have the 'reputation' required to comment, but to be clear: you're actually trying to find the 'best fit' of the available lengths to cover the required length?
If that's the case then yes, you're not going to get there without scripting. Fortunately, there are other folks who have this problem and have solved it... you could look at this online cut-list calculator for an example. I think that one even includes an embeddable script for your sheets.
If you're looking to solve the problem yourself because it's interesting, googling 'optimal cut list' or the like will turn up references. Usually you're optimizing on two variables (e.g. 'fewest joins' and 'least waste'), which tips you over into the world of linear programming (only just...) if you want to go there. If it were me, I'd just dig up a few example scripts and map how they operate back to a theoretical description (e.g. this wiki article.)

Google Sheets add-on with custom functions not running

I have written an add-on for Google Sheets that contains some custom functions. This has been working fine for months, but suddenly today it started have problems for some spreadsheets. The problem we're seeing is that the custom functions are not running at all, they just show Loading... forever.
I've done a lot of we searching, but none of the suggestions have helped in this case. I've also tried a lot of investigation and the most notable point I've found is that it seems these functions are not running at all. I'm determining that by looking at the Apps Script Execution Logs. For the cases when the functions works I see these custom functions in the log as Completed, but for the cases when it does not there is no log entry at all (no error or anything).
I should clarify that the problem seems to be spreadsheet related. That is, the functions work fine in some spreadsheet, but don't work in others. Also, my add on exposes multiple custom functions, and when this problem is happening it happens for all of the functions.
Furthermore, I've seen that this problem sometimes happens in a freshly created empty spreadsheet, but other times it is fine.
As I mentioned above, everything has been working fine for months, so I don't think it is a bug with my functions.
Is anyone else seeing problems like this? Does anyone have suggestions on how to investigate further? Any other ideas?
You may want to star issue 222342097 in the issue tracker. Click the star icon ☆ in the top left-hand corner to vote for fixing the issue and get notified of status changes. Please do not post a "me too" or "+1" reply, but just click the star icon. Google prioritizes issues with the most stars.

Is the path loss formula correct?

I have been doing some tests with the path loss formula and it gives me some pretty good results so far. However, I looked at the original code and saw that the formula used is
distance = Math.pow(10.0, ((-adjustedRssi+txPower)/10*0.35))
where adjustedRssi is RSSI - adjustment. This was giving me very small values for distance so I thought that I must have modified it at some point by accident. After doing the maths and playing around a bit I found that using txPower-adjustment instead of txPower-adjustedRSSI gives me correct distances.
I figured that the error must have been my fault but looking back at an original copy of the library I am seeing that the formula was actually this way all along.
Is this a mistake or am I missing something obvious? Using the formla as is right now gives me wrong results while modifying it the way I did gives right results.
Also, why is the formula only used if the ratio<1. Shouldn't it work in either case?
Yes, you are absolutely right! Reviewing this now, I can see that this was a simple coding error I made when I originally wrote this. I paused work on the path loss formula because I was getting poor results, probably because of this error.
Since this is a development branch of an open source library hosted on Github, it is probably most appropriate to discuss this in that forum. Please feel free to comment directly on the pull request thread here: https://github.com/AltBeacon/android-beacon-library/pull/251. As the lead developer on that project, I would also welcome a pull request with the changes you are making.

F# Priority Queue

I have tried to use this snippet of code
https://code.msdn.microsoft.com/windowsdesktop/Net-Implementation-of-a-d3ac7b9d
to implement a heap-based implementation of Prim's algorithm to solve the Minimum Spanning Tree (MST) problem in a non-directed connected graph.
after a few iterations, i find that the heap/priority queue is not well maintained anymore.
that is the head of the PriorityQueue doesn't have the lowest Key in the Heap.
PQ 0 [-7230, 309]
...
PQ 146 [-7277, 308]
Has anyone use this code and experienced similar problems ?
I can post a link on GitHub if anyone would be looking at it
My needs are for a heap datastructure which supports deletion of an element in the middle. It looks like Fsharpx.collections doesnt have such a data structure.
does anybody know a good implementation available somewhere ?
thanks
Recently, I ported a MaxHeap from PLINQ to F# here and made it MinHeap. It is array-based and performs much better than any "pure functional" alternative.
However, after a lot of benchmarking, I found that SortedDeque based on just a simple sorted circular buffer performs significantly better on most use cases even when I need to add or delete in the middle.
My answer is inspired by V.B. but here it is in full
I have used another library than FSharpx.collections, it is called
Spreads
read that page for details and instructions.
SortedDeque is the data structure i need for this problem.
I used the same code, just changing from the microsoft blog page code to the library functions and found the good result, so it is indeed some bug in the microsoft blog page code
PS. this spreads library has been designed to format financial data for quantitative analysis and i'm happy i found it !!! IT looks like this library is rather recent and thats why its not on top of Google's search or referenced in any other SO question (or if it is i didn't see it)
FSharpx.Collections is of no use for that problem as you can see from that discussion heap issue in FSharpx.Collections

Delphi printing primer

I need to add printing capabilities to an app and I have been looking around for information about printing. Logical/physical sizes, dpi, font scaling, etc, lots to digest since I never programmed printing into any app before.
Are there any sites that would offer a primer on the topics of page sizes, margins and all the other elements required to understand printing on Windows? I've been looking around for a while but what I find is either cryptic or years old...
I've been playing around with TPrinter, but I would like to build solid printing functionalities and understand what I'm doing better.
Using a report solution is not an option, even though I'm sure it would provide better results much sooner.
Two links to get you started:
Printing with TPrinter
Printing via the TPrinter Canvas
I think that you are looking too lowlevel.
Try looking at the build reporting tools (Rave or whatever is in your product).
Personally i am using a product called Report Builder from Digital Metaphors.
But if you want to do the lowlevel stuff lot og good information can be found at efg's computer lab - printing
Well, I have done things a variety of ways in the past, including the "hard way" with TPrinter. In fact, I recently had to do that again to run a special inventory label printer.
On the other hand, sometimes you are better off taking work others have done and using it for your benefit. I agree that ReportSmith isn't so great, and also it's Delphi (and Windows) specific. Using Excel or Word has those limitations, plus the fact that the user has to actually have them installed.
One thing I have done to make printing easy for some simple applications is just to generate an HTML file and call the user's web browser, then they can print it. HTML tables can be created relatively easily for numerical data, and you can include photos, etc. as well. This works well for some applications, and works on every platform where a web browser is installed. The downside, of course, is that HTML isn't the most precise layout language.
The version of Delphi you´re using is important. A number of Delphis came with print engines like ReportSmith (ugh). Another option thinking laterally is to use MS Word as a print engine. I´ve hooked into instances of Word & Excel before & utilised their functionality. As to raw printing using TPrinter or the print method of TForm you´d have to be pretty desperate. I seem to recall the Pacheo / Texeira Delphi books coming with a pretty good overview so you might want to see if you can find a copy of that somewhere.

Resources