Searching for algorithm/logic to place overlapping calendar event items (like toast ui calendar for example) - html

I have these items already successfully placed vertically with position: absolute and a calculated top value–
my library of choice for all things time related (dayjs) also comes with functionality to check if one item overlaps with another one, nice.
Each item has a startedAt and endedAt property holding ISO datetime strings, i.e. 2022-03-31T17:34Z – using dayjs I can convert them to anything the overlap detection needs.
In the screenshot you can see some examples of overlaps we would like to see in the final result. After some research the TUI calendar solves the issue pretty much just like we want it.
For a lot of reasons we can't use tui-calendar as a whole and extracting the logic to place the items (basically get width and left for each overlapping item) is way beyond my skills (although I think I've found the functions that are responsible for this)
So far I've failed miserably to solve this myself; both using recursion and loops :X
Questions:
– Is there an easier way?
– Is there a dedicated library to solve this?
– Any ideas how to kickstart a solution myself?
Kinda desperate here :D
Thanks!

Related

Looking for a simple method to adjust positions of grid points

I'm looking for a good method to shift grid points around in a numerical problem that I am solving (gradient descent). I was hoping someone knew of a good resource that discussed simple methods to shift the positions of grid points to make a resulting integration more accurate. I don't think I need a fancy method, just something for one dimension. I'm having more trouble finding a simple explanation than I thought I would.
Something like shifting the points towards larger values of the function I'm integrating would be fine, but I don't want to guess on how to write the cost function for shifting the grid points and want to do something established instead of making a new method.

Scrollable list with resizable items

I need to put together a prototype of a scrollable list with items that can be vertically resized. For example, a list of charts. I wish I could post any code but dont even know where to start from. Tried googling but nothing came up.
Any idea what a good starting point might be?
Thanks
Personally I would start with creating a list of elements in a vertical fashion. That should be pretty straight forward.
Second I'd reuse a library which may already have a resizable component that you can use. This should allow you to learn about resizable elements.
http://jqueryui.com/resizable/
Finally, put them together and see where your bugs are!

HTML adjustments

I made the following website (http://abrradesignstudio.com/) using a HTML builder template.
Looking at the categories (All, Brochures, Resumes.... etc.) I see that they are somehow aligned to the left. Maybe they are centered, but if the row is not sufficient, it makes a new one, leaving the first one with too much space to the right (making it look left aligned).
How can I avoid that and make them really centered?
Is there a fast way to make all other images disappear (instead of dim/gray-out in the background) when selecting a certain category?
Another question: My contact form is not working. I saw on a similar website that they use https://formspree.io/.
I did the same, but I still get an error submitting. My code is 1:1 with the other one (that works), just the e-mail is different.
If you know very little about HTML or CSS it may be best to read up some blogs and tutorials on CSS (there are many, many out on the net) .
The Solution
In .filters li (line 4542 in theme-nearblack.css) turn off float:left; and your display will show as you want.
floats do just that, they float outside of the flow of the document so it's much more tedious to try and centre them. As the parent element to this li is already floated there isn't much point floating the contents as well.
Stack Overflow Questions
Please when asking questions can you paste a minimum working version of your code which displays your problem, rather than links to external websites which will change. Posting code blocks into your question means whenever someone in the future reads your question they can see exactly the issues you are having (and how they are solved).
Please Take the Tour.
If my solution works for you can you mark up and tick, thanks.

Why aren't Camera.unproject() and Camera.project() inverses of each other in libGdx?

It's even written in the doc that Camera.unproject() assumes that the screen has it'origin in the top left corner, on the other hand Camera.project() assumes that the screen has its origin in the bottom left corner. This is so annoying. Is this intentional? Am I not getting something?
tmp3.x = selected.pos.x;
tmp3.y = selected.pos.y;
camera.unproject(tmp3);
camera.project(tmp3);
This flips the vector, where it should return the same vector.
EDIT:
First I was trying to use Viewport.project() and Viewport.unproject() to convert points from one viewport to another (to position a context menu over a game element).They also inherit this naming confusion, and it's not even mentioned in the javadocs there.
PS. I really like libGdx. I've just written this to maybe spare some headache for someone in the future as I didn't find this anywhere on the web pointed out directly.
The Javadoc for the project method explains why. I think the assumption is that the most common reason to project a point is to line something up with the UI which will also be Y-up. But when I projecting, it is most likely to convert a touch coordinate to world coordinates.
Or in another way of looking at it, everything you do in OpenGL is Y-up so everything's designed to be Y-up or to get you there.
Not saying this is necessarily the best way; just trying to guess at the thought process. It probably wouldn't hurt to submit a PR for another type of project method of you need one, or you could subclass whichever type of camera you're using and add the additional method.

Custom cell in list in Flash AS3

I am no expert in Flash, and I need some quick help here, without needing to learn everything from scratch.
Short story, I have to make a list where each cell contains an image, two labels, and a button.
List/Cell example:
img - label - label - button
img - label - label - button
As a Java-programmer, I have tried to quicly learn the syntax and visualness of Flash and AS3, but with no luck so far.
I have fairly understood the basics of movie clips etc.
I saw a tutorial on how to add a list, and add some text to it. So I dragged in a list, and in the code went list.addItem({label:"hello"}); , and that worked ofc. So i thought if I double-clicked the MC of the list, i would get to tweak some things. In there I have been wandering around different halls of cell-renderers etc.
I have now come to the point that I entered the CellRenderer_skinUp or something, and customized it to my liking. When this was done, I expected i could use list.addItem(); and get an empty "version" of my cell, with the img, labels and the button. But AS3 expects an input in addItem. From my object-oriented view, I am thinking that i have to create an object of the cell i have made, but i have no luck reaching it.. I tried to go
var test:CellRenderer = list.listItem;
list.addItem(test);
..But with no luck.
This is just for funsies, but I really want to make this work, however not so much that I am willing to read up on ALOT of Flash and AS3. I felt that I was closing in on the prize, but the compiler expected a semicolon after the variable (list.addItem({test:something});).
Note: If possible, I do NOT want this:
list.addItem({image:"src",label:"text",label"text",button:"text"});
Well.. It actually is what I want, but I would really like to custom-draw everything.
Does anyone get what I am trying to do, and has any answers for me? Am I approaching this the wrong way? I have searched the interwebs for custom list-cells, but with no luck.
Please, any guiding here is appreciated!
Sti
You could use a Datagrid as well, with each column pointing to the appropriate part of the data source (possibly even the same field, depending on what you're doing). You can then just use the ImageCell as the renderer for the second and third colums.
I think you're just not understanding that Adobe, in the own woolly-headed little way, is separating the Model from the View on your behalf. You hand the Model to the View and then get out of the way. The extent of what you can/should change is just telling it what renderer to pop your data into.
In fact, the fl.controls don't give you much control at all about how they work--I wouldn't go down the road of trying to create a custom itemRenderer with any signifcant functionality for them if you don't fully understand how the Display List works and if you're not comfortable digging around in the debugger and ferreting out all kinds of undocumented information.
For more details (to the extent anyone knows anything about how these work), see
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt1.html
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt2.htmlhttp://www.adobe.com/devnet/flash/quickstart/datagrid_pt3.html
http://www.adobe.com/devnet/flash/quickstart/tilelist_component_as3.html
Do you have the option to use the Flex Framework instead of pure Flash? It makes this kind of extension much more satisfying. It's aimed more at application developers, whereas Adobe sees Flash users more as designers.