Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User cocamm's Avatar
    Join Date
    Sep 2010
    Posts
    14
    Hi

    I'm trying generate a random Id, but is happening some troubles.

    i'm using this function:

    Code:
    function makeid(){
        var text = "";
        var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    	now = new Date();
        var seed = now.getSeconds();
        for(var i = 0; i < 5; i++) {
    		text += possible.charAt(Math.floor(Math.random(seed) * possible.length));
    	}
        
        return text;
    }
    In aptana emulator, the function is OK. Always show me a new string, but in my phone(e63) and others(n95), always show me "qyqjG".
    have any other way to get a random string?

    Tnk u

  2. #2
    Nokia Developer Moderator isalento's Avatar
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    831
    Hello,

    There is a issue with Math.random on older browsers. It has been discussed here.

    You could try with modern 7.1 or 7.2 browser if it works to rule out the Math.random issue.
    If you don't own suitable test device you can use RDA if you wish.

    Br,
    Ilkka

  3. #3
    Registered User cocamm's Avatar
    Join Date
    Sep 2010
    Posts
    14
    Tnks for reply, it's works finest now =) i'm using Date.getTime()

    but i have a one more doubt:
    I need that user download the api bridge for use my wrt, i'm using this code "widget.openURL('http://www.yourserver.com/APIBridge_v1_1.sis');" but the link open in cel notepad...
    Why?? Any sugestion?
    tnks again

  4. #4
    Registered User cocamm's Avatar
    Join Date
    Sep 2010
    Posts
    14
    Tnks for reply....it´s ok now....i'm using Date.getTime() for random string@Num now!! =)

    But i still have a problem....

    I need the api bridge for my wrt execution.
    I put him in my webserver and the url link for download in the mobile website.....but when the user click in "link", the api brige open in notepad!!
    Why?? Any sugestion?

    Tngs again

  5. #5
    Nokia Developer Moderator isalento's Avatar
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    831
    Have you set the MIME type for SIS files on a server side?

    http://wiki.forum.nokia.com/index.ph...m_your_website


    -Ilkka

Similar Threads

  1. Random string generation in symbian
    By vinayakak in forum Symbian C++
    Replies: 2
    Last Post: 2010-02-26, 09:19
  2. javascript random NOT random
    By captain_dixie in forum Symbian Web Runtime
    Replies: 2
    Last Post: 2009-05-24, 02:33
  3. Replies: 5
    Last Post: 2006-02-26, 17:29
  4. Problem with String
    By fcobsb in forum Symbian C++
    Replies: 2
    Last Post: 2003-11-13, 05:32
  5. problem with Random()
    By doomer999 in forum Mobile Java General
    Replies: 2
    Last Post: 2003-05-05, 15:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved