Search Results

Search found 2536 results on 102 pages for 'initialize'.

Page 33/102 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • how to drag a 'div' element to the google maps ,that be changed to a 'marker'..use jquery

    - by zjm1126
    this is my code : <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"> </head> <body onload="initialize()" onunload="GUnload()"> <style type="text/css"> </style> <div id="map_canvas" style="width: 500px; height: 300px;float:left;"></div> <div id=b style="width: 50px; height: 50px;background:red;float:left;margin-left:300px;"></div> <script src="jquery-1.4.2.js" type="text/javascript"></script> <script src="jquery-ui-1.8rc3.custom.min.js" type="text/javascript"></script> <script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=ABQIAAAA-7cuV3vqp7w6zUNiN_F4uBRi_j0U6kJrkFvY4-OX2XYmEAa76BSNz0ifabgugotzJgrxyodPDmheRA&sensor=false"type="text/javascript"></script> <script type="text/javascript"> //********** function initialize() { if (GBrowserIsCompatible()) { // function createMarker(point, number) { var marker = new GMarker(point); var message = ["?","?","?","??","??"]; marker.value = number; GEvent.addListener(marker, "click", function() { var myHtml = "<b>#" + number + "</b><br/>" + message[number -1]; map.openInfoWindowHtml(point, myHtml); }); return marker; } // var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(39.9493, 116.3975), 13); // Add 5 markers to the map at random locations var bounds = map.getBounds(); var southWest = bounds.getSouthWest(); var northEast = bounds.getNorthEast(); var lngSpan = northEast.lng() - southWest.lng(); var latSpan = northEast.lat() - southWest.lat(); for (var i = 0; i < 5; i++) { var point = new GLatLng(southWest.lat() + latSpan * Math.random(), southWest.lng() + lngSpan * Math.random()); map.addOverlay(createMarker(point, i + 1)); } } } //************* $("#b").draggable(); </script> </body> </html>

    Read the article

  • Controlling usb devices from a droid?

    - by user324721
    Anyone know where I can find information on how I can control the USB port on a Droid running Android 2.0? I want to know how to either initialize the USB port or send data across it vi a program. I want to be able to atatch a device to the USB port to act as a switch to control a microservo. So when I said "send data" across the port, I just need to be able to energize the transmit pin on the USB to turn the servo on. Thanks ahead, Tom

    Read the article

  • Ruby Inserting Key, Value elements in Hash.

    - by kokogyi
    I want to add elements to my Hash lists, which can have more than one value. Here is my code. I don't know how I can solve it! class dictionary def initialize(publisher) @publisher=publisher @list=Hash.new() end def []=(key,value) @list << key unless @list.has_key?(key) @list[key] = value end end dic = Dictionary.new dic["tall"] = ["long", "word-2", "word-3"] p dic Many thanks in advance. regards, koko

    Read the article

  • What does the MS Ajax Framework use location.hash for?

    - by DDaviesBrackett
    I've noticed that the MS ajax framework touches the action of the default form during Sys.Application.initialize, appending location.hash to it. This is interfering with other code in my app that expects different behaviour. What does the framework do with that? It refers to the values it puts on the hash as 'state', but how do I find out what it's communicating and from where?

    Read the article

  • NullPointerException when thying to add an object to a PriorityQueue

    - by meagan
    i keep getting a null pointer exception when trying to add an object to a priority queue i initialize the queue: private PriorityQueue<NodeObject> nodes; and here i try to add to it: NodeObject childNode = new NodeObject(child, 1); nodes.add(childNode); why doesn't this work? i know my NodeObject is not null because i create it right before i add it.

    Read the article

  • using jQTouch for large website

    - by totato
    I want to use jQTouch to build iPhone app for large website. When searched for it, I understood that I must edit my HTML code for website to be Suitable to my app, how I can do this without conflict with the style for my website? Also, what is the basic steps to using jQTouch ? just Add scripts and Initialize as here : http://code.google.com/p/jqtouch/wiki/GettingStarted . help me with many thanks.

    Read the article

  • On Redirect - Failed to generate a user instance of SQL Server...

    - by Craig Russell
    Hello (this is a long post sorry), I am writing a application in ASP.NET MVC 2 and I have reached a point where I am receiving this error when I connect remotely to my Server. Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed. I thought I had worked around this problem locally, as I was getting this error in debug when site was redirected to a baseUrl if a subdomain was invalid using this code: protected override void Initialize(RequestContext requestContext) { string[] host = requestContext.HttpContext.Request.Headers["Host"].Split(':'); _siteProvider.Initialise(host, LiveMeet.Properties.Settings.Default["baseUrl"].ToString()); base.Initialize(requestContext); } protected override void OnActionExecuting(ActionExecutingContext filterContext) { if (Site == null) { string[] host = filterContext.HttpContext.Request.Headers["Host"].Split(':'); string newUrl; if (host.Length == 2) newUrl = "http://sample.local:" + host[1]; else newUrl = "http://sample.local"; Response.Redirect(newUrl, true); } ViewData["Site"] = Site; base.OnActionExecuting(filterContext); } public Site Site { get { return _siteProvider.GetCurrentSite(); } } The Site object is returned from a Provider named siteProvider, this does two checks, once against a database containing a list of all available subdomains, then if that fails to find a valid subdomain, or valid domain name, searches a memory cache of reserved domains, if that doesn't hit then returns a baseUrl where all invalid domains are redirected. locally this worked when I added the true to Response.Redirect, assuming a halting of the current execution and restarting the execution on the browser redirect. What I have found in the stack trace is that the error is thrown on the second attempt to access the database. #region ISiteProvider Members public void Initialise(string[] host, string basehost) { if (host[0].Contains(basehost)) host = host[0].Split('.'); Site getSite = GetSites().WithDomain(host[0]); if (getSite == null) { sites.TryGetValue(host[0], out getSite); } _site = getSite; } public Site GetCurrentSite() { return _site; } public IQueryable<Site> GetSites() { return from p in _repository.groupDomains select new Site { Host = p.domainName, GroupGuid = (Guid)p.groupGuid, IsSubDomain = p.isSubdomain }; } #endregion The Linq query ^^^ is hit first, with a filter of WithDomain, the error isn't thrown till the WithDomain filter is attempted. In summary: The error is hit after the page is redirected, so the first iteration is executing as expected (so permissions on the database are correct, user profiles etc) shortly after the redirect when it filters the database query for the possible domain/subdomain of current redirected page, it errors out.

    Read the article

  • I have to select the checkbox two times to check/uncheck in jTable

    - by 117526709403775781607
    I have a jTable code i intend to use, but the problem with it is that when i click on the checkbox once it doesn't select/deselect it, instead i have to click twice. But if i select any other cell in the row except the one containing the checkbox the purpose is solved. HERE IS MY CODE : public class TableSelectionTest extends JFrame implements ListSelectionListener { private final int COLUMN_COUNT = 5; private TblModel model; public TableSelectionTest() { initialize(); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); } private void initialize() { List data = new ArrayList(); for (int i = 0; i < 10; i++) { Object record[] = new Object[COLUMN_COUNT]; record[0] = Boolean.FALSE; for (int j = 1; j < COLUMN_COUNT; j++) { record[j] = new Integer(j); } data.add(record); } model = new TblModel(data); JTable table = new JTable(model); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener (this); JScrollPane scroll = new JScrollPane(table); getContentPane().add(scroll, BorderLayout.CENTER); } public static void main(String[] args) { TableSelectionTest f = new TableSelectionTest(); f.show(); } class TblModel extends AbstractTableModel { private List data; public TblModel(List data) { this.data = data; } public int getColumnCount() { return COLUMN_COUNT; } public int getRowCount() { return data == null ? 0 : data.size(); } public void setValueAt(Object value, int rowIndex, int columnIndex) { getRecord(rowIndex)[columnIndex] = value; super.fireTableCellUpdated(rowIndex, columnIndex); } public Object getValueAt(int rowIndex, int columnIndex) { return getRecord(rowIndex)[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { if(columnIndex == 0) return true; else return false; } public Class getColumnClass(int columnIndex) { if (data == null || data.size() == 0) { return Object.class; } Object o = getValueAt(0, columnIndex); return o == null ? Object.class : o.getClass(); } private Object[] getRecord(int rowIndex) { return (Object[]) data.get(rowIndex); } } public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); int index = lsm.getMinSelectionIndex(); if(model.getRecord(index)[0] == Boolean.FALSE) model.setValueAt(Boolean.TRUE, index, 0); else if(model.getRecord(index)[0] == Boolean.TRUE) model.setValueAt(Boolean.FALSE, index, 0); } } } Please reply soon as it is bugging me a lot Thank you in advance :)

    Read the article

  • Array Concatenation in C#

    - by Betamoo
    1- How to smartly initialize an Array with 2 (or more) other arrays in C#? double[] d1=new double[5]; double[] d2=new double[3]; double[] dTotal=new double[8];// I need this to be {d1 then d2} 2- Another question: How to concatenate C# arrays efficiently? Thanks

    Read the article

  • Gaining access to jndi environment variables within a Tomcat LifecycleListener

    - by rmarimon
    I'm using a LifecycleListener in tomcat to initialize some objects required by contexts in my web server. Within LifecycleListener I would like to have access to GlobalNamingResources Environment variables to keep the configuration for the server inside the server.xml file. When trying various approaches I get the following error: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I'm assuming that the jndi is not initialized by this stage of the server startup process. Any ideas on how to tackle this?

    Read the article

  • More elegant way to write this?

    - by tesmar
    Hi, I am trying to make a multi-dimensional array of characters in ruby, and this works, but is there a more elegant way? def initialize(text) @map = Array.new i = 0 text.split("\n").each do |x| @map[i] = x.scan(/./) i += 1 end #@map = text end#constructor

    Read the article

  • Defining a recursive function in a Prototype class?

    - by btl
    I'm trying to create an image rotator class that cycles through an arbitrary number of images in an unordered list. Is it possible to define a recursive function within a class declaration? E.g: var Rotator = Class.create() { initialize: function() { do something... this.rotate(); } rotate: function() { do something... this.rotate() } }

    Read the article

  • How to verify StructureMap is disposing of objects properly

    - by Kevin Pang
    I'm currently using StructureMap to inject instances of NHibernate ISessions using the following code: ObjectFactory.Initialize(x => { x.ForRequestedType<ISession>() .CacheBy(InstanceScope.PerRequest) .TheDefault.Is.ConstructedBy(y => NHibernateSessionManager.Instance.GetSession()); }); I'm assuming that the CacheBy(InstanceScope.PerRequest) will properly dispose of the ISession it creates, but I'd like to make sure. What's the easiest way to test this?

    Read the article

  • Is this pointer initialization necessary?

    - by bstullkid
    Lets say I have the following: CHARLINK * _init_link(CHARLINK **link) { short i; (*link)->cl = (CHARLINK **) calloc(NUM_CHARS, sizeof(CHARLINK *)); for (i = 0; i < NUM_CHARS; i++) (*link)->cl[i] = NULL; return (*link); } Is the loop to initialize each element to NULL necessary or are they automatically NULL from calloc?

    Read the article

  • What's the best way to keep java app data stored redundantly in a file?

    - by Bijan
    If I have systems that are based on realtime data, how can I ensure that all the information that is current is redundantly stored in a file? So that when the program starts again, it uses this information to initialize itself back to where it was when it closed. I know of xstream and HSQLDB. but wasn't sure if this was the best option for data that needs to be a literal carbon copy.

    Read the article

  • call glutinit in an php extension

    - by Yijinsei
    hi guys, I am developing an php extension that require the use of opengl I tried to initialize the library with glutinit, and it works in CLI environment, but when i tried on browser, it doesn't seem to execute the code. I very new to opengl, so I'm not sure what kind of error is this, does anybody have any knowledge with this?

    Read the article

  • Handling Input with Zend Framework outside MVC

    - by Pekka
    In a classic Zend Framework MVC setup, there seems to be access to a generic _request object from within the model/view/controller instance as outlined here: $this->_request->getPost('variablename'); is this request object somehow available in a non-MVC setup as well? If yes: how would I initialize and access it?

    Read the article

  • Constructor within a constructor

    - by Chiramisu
    Is this a bad idea? Does calling a generic private constructor within a public constructor create multiple instances, or is this a valid way of initializing class variables? Private Class MyClass Dim _msg As String Sub New(ByVal name As String) Me.New() 'Do stuff End Sub Sub New(ByVal name As String, ByVal age As Integer) Me.New() 'Do stuff End Sub Private Sub New() 'Initializer constructor Me._msg = "Hello StackOverflow" 'Initialize other variables End Sub End Class

    Read the article

  • Any special assertion to test if the resulting integer lies within a range

    - by barerd
    I would like to test if an instance variable lies in a range of numbers. I solved the problem by using assert_in_delta but would like to know if there is a formal assertion for this. #part of the tested class def initialize(value = 70 + rand(30)) @value = value end #test_value.rb class ValueTestCase < Test::Unit::TestCase def test_if_value_in_range assert_in_delta(85, p.value, 15) end end

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >