web-development

JQuery/Javascript - how to minimize duplicated code?

If I wanted to use the following code on multiple DIV#ID, how do I do so without duplicating code var scrollElem = $('#div1'); scrollElem.scroll(function() { /* find the closest (hlisting) home listing to the middle of the scrollwindow */ var scrollElemPos = scrollElem.offset(); var newCenter = $(document.elementFromPoint( ...

onclick open window and specific size

i have a link like this: <a href="/index2.php?option=com_jumi&amp;fileid=3&amp;Itemid=11" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,') i want the window that is opening to be a specific size. how do i specify the height and width? ...

JQuery - how to use the hover() event on a list of DIVs?

I have the following HTML: <div id="panel"> <div class="listing" id="ref_1">...</div> <div class="listing" id="ref_2">...</div> <div class="listing" id="ref_3">...</div> <div class="listing" id="ref_4">...</div> </div> What I should like to do is, when someone hovers over a div.listing, to alert() to the screen the id name. M...

PersonViewModel inherits from Person - clever or code smell?

In my ASP.NET app, I have a Person and a PersonViewModel. My Person was generated by LinqToSql. It has the properties that will be persisted in the database. My PersonViewModel has everything Person has, plus a couple "select lists", which will be used to populate combo boxes, as well as a FormattedPhoneNumber (which is basically a Pho...

JQuery: My 'scroll' event is CRAZY slow. What am I doing wrong?

I have 4 DIV that I want to have a scroll event fired when you scroll on one of those div's. This is the code below. $('#div1, #div2, #div3, #div4').scroll(function() { alert('...'); }); In Firefox/Chrome, this runs fast; however, in Internet Explorer this runs so slow that it actually prevents me from scrolling the div. I'm usin...

JQuery: selector performance

I have the following HTML: ... <div id="panel"> <div class="abc"> <p class="xyz">Hello</p> </div> </div> ... Question: What's the fastest way with JQuery for me to access the p.xyz element? I've read some performance reviews but they don't account for all different scenarios. I could do the following, but don't know h...

Does a ViewModel have its own logic ?

When assigning ViewModel fields, should the domain objects be passed directly to the ViewModel objects which will then determine how to present the data, or should another class like a service be assigning data from the Model to the ViewModel? also: EDIT:is there any sense in dividing a viewmodel into receiver and presenter? (instead ...

How can I associate a live event with an index selector using jQuery?

I have the following HTML: <ul id="tabs"> <li><a href="...">One</a></li> <li><a href="...">Two</a></li> <li><a href="...">Three</a></li> </ul> I want to perform a unique action when someone clicks on each of the links. I tried the following and it did not work $("#tabs li").eq(1).live('click',function(){alert('ONE....');...

jQuery AJAX POST New Line Problem

So on our site we currently have a textarea for commenting on certain items. The site uses AJAX so the user can press the button and see their message fade in (Imagine a Facebook style commenting.) The jQuery/AJAX: $(function() { $("input#comment_submit").click(function() { var comment = $("#comment_box").val(); var dataString = 'comme...

Active X Control not loading on second time

Hi All, i created an Active X Control for my web Form first time when i executes my page its works fine.. but when i modified my Active X Control then place my ActiveX Control dll to my web site root directory then my Active X Control is not loading on my Web page.. Can u please let me know what is the problem is going on... Thanks in ...

Applet JAR loading fails, since the http request doesn't include a basic auth header

It's a farily simple setup. A .jar is hosted on a site which is protected by basic auth. I try to load the jar with an object tag - which works perfectly when tested without authentication. When the .jar is requested from the server, the basic auth header isn't included in the request. Why is this? ...

Can I let a user select a contact from his iPhone's contact list in a web application?

So that only a single contact is passed to the web application with the explicit permission of the user.. ...

Implementing Finite State Machine for Web UI

I am intending to develop a Finite State Machine in the following manner. Extract Control IDs from a --> web-page, Write control IDs to a XML --> Controls-XML. Manually declare States and Transition in the --> Controls-XML Scan Controls-XML and attach pre-declared Jscript to eventhandlers embed them in the --> web-page.. 5. How feas...

How does a browser know what to do with a link for downloading not redirecting?

Hi, I was wondering how a browser decides what to do when you provide a link that is actually meant for downloading not redirecting to another page. How does the browser know for example not to redirect you to a page called http://domain/Music.mp3 rather that just throw the option to download the said file instead? Does the browser look...

How to hide the text box blinking cursor?

I need to hide the text box blinking cursor in CSS / Javascript. Is it possible? ...

Share login info between CMSs (Wordpress and phpBB)

Hi, Say I want to develop a site with some CMS embedded in it - e.g., a Wordpress blog and phpbb forum. What's the most convenient way to unify the log-in and sign-up process for my site? Letting users have a different registration process for each part of the site would probably scare any sane user away. EDIT I prefer generic solu...

Best Java framework to manage/create dynamic security policy rules?

Typically in any web application, the major security concern is securing the resources from the malicious users who are trying to access un-authorized resources. They can change a value in the request parameter and try to access something that doesn't belong to that particular user. For Example: http://blah.com/id=foo a user can change...

How to insert text in a td with id, using javascript

I know it may be a simple thing, but I cant figure out,I am trying to insert some text coming from a javascript function onload event into a td. <html> <head> <script type="text/javascript"> function insertText () { //function to insert any text on the td with id "td1" } <script> </head> <body onload="javascript:insertText()"> <table> <...

How to determine a development strategy change from the middle management?

We are a start-up, with a few (14) clients using our products. These products were developed in a close source web development framework only maintained by one developer on the core. Basically the framework server is required to be able to run any application built in it. So there is no code, in our layer of the application. Think of...

JQuery: How to cache DOM?

I used Firefug to profile my web application and found that the following function is called, and needs to be called, literally hundreds of times per user visit. So I want to optimize it since Firebug says it uses the most resources/times. function highlightChildDiv(parentDiv) { /* find the closest (hlisting) home listing to the m...