Robert Ingmarsson

Ranch Hand
+ Follow
since Jan 12, 2015
Robert likes ...
Netbeans IDE PHP Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
5
Received in last 30 days
0
Total given
11
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robert Ingmarsson

I am working on a php application, a social media site. I am using tabs as a navigation method in the users profile page.  
I have encountered an annoying issue. My tabs keep pushing the content down as I click on them, the content sort of
jumps down a bit. I wan't my tabs stable as the content below is changing when they are visited.

I know about the event.preventDefault() method and or the use of return false in the anchors onclick function.
But they are of no help. The content keeps gettings pushed down when the user clicks the tabs.

Here is the part in my javascript code that I am having in which I am having theese problems.



Could someone tell me what causes the content getting pushed down
every time I click on my tabs and how to prevent it?

What is the general approach to the solution of this annoying issue?

Best wishes,
Robert!



Hello, forum!

I am having problem with a movie database application. I have a class that is named MediaTitle in wich I have a function
that takes care of duplicate actor names. I want to first insert the actor name and then if it exists already I wan't to update
the actor names that are equal to the currently inserted name with a number at the end of the following
duplicates. This describes better what II am trying to accomplish

1  Billy
2  Billy-2
3  Billy-3
4 Billy-4

.... And so on.

This is what I have tried so far but I fail every time I set up to it. ( Sorry for missing code parts and bad
code in general )



The method name is_available directs to a method that looks for duplcate actor names.
The variable $cast_list points to an array that holds values from a group of textfields.

Am I on the right track? If so please let me know.
If more code is needed I will provide it. But for now I am greatly thankful to any form of
replies.

Best regards,
Robert!





1 year ago
PHP
Best ranchers!

I am working on a simple datepicker using pure javascript and DOM. I have encountered a weird
problem in the process that updates the calendar through an on click event handler.  This event
handler is registered to my previous and next date buttons.

The first function is called clearList("cal-days");, the second updateLabel();
and the third is called updateCalendar();

This is what the function clearList(id) looks like



I am using a ul list as a component for displaying week days and dates. Everything is working fine until when it comes to
the update and add date function - updateCalendar(); The list date items won't clear from the previous or next month selection.
Am I doing this right? I am appending new list items in a for loop like the small code below shows.  



My date list or mainList as I call it won't remove the items from the previous selection instead it keeps them
so they are increasing all the time. What am I missing here? Can anyone see the solution to my problem here?
Sorry for the small amount of code that I posted here. I have a very large script file at my hands but I decided to pick
that part of code which is troubling me to display here in this post. I hope someone knows the
correct procedure here and can help me move on.

Very best regards,
Robert!

   




 

Hi!

I must have solved this now. I created a function called getDaysUntilMonday() and it returns 2
(Saturday, Sunday as of this day, Friday)




Well that was me in a nutshell. Thanks a lot for the hints it helped!  

Bye!


Best ranchers!

Thank you so much for the answer. But I am completely stuck with this. I am still struggling date handling in javascript.
Could anyone show how it's done when it comes to calculating how many days to a specific day in the week
in my case it is monday from the current day? I  think one must use percentage in the calculation here but i am not
sure. Sorry for being a slow learner.

Im terrible at all things math and still i code every day    

Best Wishes,
Robert!
Hello, ranchers!

I have begun work on a simple calendar in javascript. I have studied some date handling in javascript but im still very new to that math. My issue here is that I need to come up with a function that calculates how many days there are left until monday from the current day in the week.  

I know this must sound very simple to many of you but I wan't to see how the pros do it. So if anyone would like to pinch me in the right direction I would be very
grateful.

I know how to get the current year, month and day / date of a date object. But my math limitations are the big bandit here.

Ok, that's it from me so far!
Thanks for reading!

 
Best ranchers!

I have a question about event handling in javascript. I need to figure out a crossbrowser friendly way to keep track
on the mouse when the user leaves a certain div element.

I know about the "mouseleave" attribute in the addEventListener method, but it is not ie compatible and thats the
eye of the problem. I have tested around with the event.cancelBubble  = true (ie) and event.stopPropagation (w3c)
methods.

How can I prevent - in ie - a div from closing after the mouse leaves a li-element in a list and when the mouse leaves
the parent element in this case the former mentioned div tag?

Thanks for visiting!



Best ranchers!

Thanks for all the replies here.

I am just wondering what is the procedure to detect if a mouse pointer is outside
a specific element such as a div tag?

I am looking into pageX and pageY methods on google is that the correct approach?
I wan't to be able to capture events when the mouse leaves my menu element.
Is it possible to accomplish that?

Best regards,
Robert!
Mr. Bibeault!

Do you mean replacing and removing elements using dom?

I am completely stuck here. My script will still only run one time per page load.
It's almost fascinating to watch   It won't execute the method in the function call
in the loop more than once.

You mentioned something earlier about replacing the class names? I am using ids
to find the divs. I know about getElementsByClassName.

Has anyone encountered this phenomena before please give a comment or two.

Regards,
Robert!

Best, Mr. Bibeault!

Sorry for a late reply. The problem still occur. The script still only executes after a page load. I will definately consider using another approach
with the addEventListener method.

By the way, with "destroyed", are you refering to the method clearTimeout, i just realized I missed it out? What was your thoughts to this?

Today I will look into an alternate approach.

Best regards,
Robert!
Best, racnhers!

I am developing a script for a dropdown menu component in pure javascript and dom.
The html markup is printed from a php function. My problem is with the javascript part.
The menubar has a "My Profile" menu which has a submenu that consists of several items.

When I click on the "My Profile" menu then its submenu should appear repeatedly times
when the user hover over it with the mouse which is the general way. But as it is now, this
event gets triggered only once per page load and I can't understand why?

Below is the code for my drop down component it is hardly commented but I hope that a viewer
still will get a clear idea of what is going on. If the html markup is required as necessary material
then I will post the php code that generates it. But for now here is my javascript code.

Please forgive for maybe a badly described issue. I am a little bit stressed out over this.
Thank you very much in advance!



Best regards,
Robert!




   
Best, all!

First of all I must say that this problem that I have encountered is of a very complex nature to me. I am terrible at explaining my problems here in english so have patience with me. Also forgive me if I don't have any code at the moment to post here to demonstrate the problem from that point of view. I have mainly only questions. And I am not
sure on my reasoning or logic.

With that said I have a project in which I have a JTree that is populated with parent nodes that has user objects which can contain user defined information about stores of different kind, like their respective type of branch, number of employees and their financial income per year and so on. The user inserts theese with the click of a button in a form in a JDialog. The information in the store info nodes are displayed in that fore mentioned form. The user can also insert child nodes to theese Store nodes and they are called Department nodes. So I have a JTree that consists of Store and Department - nodes.

I know how to traverse or loop though a JTree, insert and remove nodes from the model and I always reload the model after each such action. My problem is how to code a counter that let the user know at which store info node he or she is at. This counter should increment for every new store info node the user adds to the model and for every deletion of a store info node the counter should move back up.




Example of JTree - structure ( during insert - mode )
------------------------------------------------------------
Store Info

  Store 1
      Department 1
      Department 2

  Store 2
      Department 1
      Department 2
      Department 3

  Store 3
      Department 1
      Department 2

------------------------------------------------------------




The user edits the names of the stores and departments in the form that is presented to him or her in add mode. My problem like my question is that I don't know how to write the counter that must be displayed in each Store node after the user have added one to the model of the JTree.  If the user deletes Store 2 then I want the counter to remember that node 2 was deleted were three Store nodes in the JTree so it starts to count from 3 when the next Store node is inserted by the user. Can a helpful soul here push me in the right direction. I am completely stuck and time limited. I hope I have not been to complicated thoughout theese lines.

I should mention that I am looking in to the TreeModelListener interface and is experimenting around with the treeNodesInserted -and treeNodesRemoved - methods, would that be in the right direction?.

Many thanks for your visit, Sir!
Kindly, Robert!
       
3 years ago
@Tim Holloway!

I tried your regex but it gave me an error exception as listed below



Best regards,
Robert!
3 years ago
@Carey Brown

I have written an example of what I am trying to accomplish. This is just a loose sample and has nothing to do with the application I am working on at the moment. But it gives an idea of what kind of a problem that I have encountered.



I hope that helps to see what's bothering me. My english is like my java, like everything else in my life, nothing is real, all is purely on a wannabe level  

Kind Regards,
Robert!

 


3 years ago
Hi, again!

I think I have found a solution to my problem here.



Some what hasty maybe. But I would have liked a single regex string for this situation. Sorry for my bad code.

Thanks for your visit,
Robert!



3 years ago