Jump to content

biggieuk

Members
  • Posts

    159
  • Joined

  • Last visited

Posts posted by biggieuk

  1. Hi all,

     

    I am building a random prize assigner function based on weighted percentages.

     

    I am able to assign a basic true/false weighting but am struggling to form a way of selecting an array based prize based on the win rate. 

     

    Heres my current code:

    
    function selectPrize() { 
        
        $prizes = array(
            0 => array(
                'name' => 'Top Prize',
                'rate' => 50
            ),
            1 => array(
                'name' => 'Middle Prize',
                'rate' => 30
            ),
            2 => array(
                'name' => 'Bottom Prize',
                'rate' => 20
            ),
         
        );
        
        // oops
    } 
    
    selectPrize(); 
    

    Could somebody please give me pointers on how i could approach this?

     

    Thanks.

  2. Hi,

     

    I am building an RSS Aggregator plugin for my Wordpress Installation.

     

    One of the feeds I am using is:  https://news.google.co.uk/news/feeds?pz=1&cf=all&ned=uk&hl=en&cf=all&as_qdr=w&output=rss&q

     

    As you can see this feeds content is a table of data including news headline, excerpt and a tiny thumbnail image.

     

    How is it possible for me to extract the actual full article text and the large Image from the <link> tag of the RSS item or does it look like I have the wrong news feed?

     

    Thanks for advice with this.

  3. Hi all,

     

    I am using a MAC to tunnel to the servers at my work so that I can work from home.

     

    I am using http://coccinellida.sourceforge.net/ to firstly tunnel into the work server then create a local alias at localhost port 2000.

     

    I am then able to use Filezilla to SFTP to localhost:2000 using my username and password.  I want to be able to create a local drive so that I can work with the files in my code IDE.

     

    I tried ExpanDrive and Transmit, both won't connect to the same localhost connection that Filezilla will connect to.  Expandrive gives no errors but Transmit says permission denied.

     

    Anybody have an idea how to sort this problem out so that i can mount the sftp as a local drive?

     

    Thank you for your help

  4. Hi all,

     

    Having a little trouble designing my database for a project.

     

    The web app consists of a number of 'pages', each page with a form and some fields on.  The fields on each form need to be editable and stored in a database. So basically it is a number of forms with dynamic fields.

     

    My current table structure is as follows:

     

    Questions Table

    id

    field_name

    title

    description

    orderno

     

    1

    company_name

    Company Name

    What is your company name

    1

     

    2

    telephone

    Telephone Number

    What is your telephone number

    2

     

    Then for each time a user starts a questionnaire a row is created/updated in the 'assessments' table:

     

    Assessments Table

    id

    user_id

    question_id

    answer

     

    1

    32423

    1

    My Company

     

    2

    32423

    2

    01144556677

     

     

    For a static form I usually would do an INSERT statement and insert the value corresponding to the column name, however using the approach above I would need to do an INSERT for each separate question on each form.

     

    Does this seem like the best approach for storing data on a per user basis for a dynamic table?

     

    thanks for your guidance on this.

     

     

     

     

  5. Hi all,

     

    Bit of an odd question. 

     

    I am using Maxmind GeoIP (http://www.maxmind.com/app/ip-location) to locate the approx location of users.

     

    The api returns an object containing longitude and latitude.  I now need to use these longitude/latitude values to determine if the user is:

     

    England

    Scotland

    Wales

    Republic Ireland

    Northern Ireland

    Rest of World

     

    An option is to gather the lon/lat of these areas and test if the user is within this range.

     

    What would be the best way to go about this? Anyone done anything similar?

     

    Thanks for help with this!

  6. Thanks for the reply.

     

    I am aware of Google but didn't find anything that did the same job of SecureCRT but without the ancient command line interface.

     

    I guess it's just something I will need to get used to until I find the right powerful GUI.

  7. Hi all,

     

    Not entirely sure if this is the correct forum for this question.

     

    I am relatively new to git and SSH.  After starting a new job I quickly realised that I need to learn this.

     

    I am using SecureCRT to connect to the webserver and have been using commands such as:

     

    git add ...

    git commit ...

    :qw

    ./publish

     

    I understand the basic principles of git and committing changes to the server but I can't help but feel that there should be a simpler GUI to do this for Windows7.

     

    Is there a program for windows that would make this process easier to understand?

     

    thank you.

     

     

     

     

     

     

  8. I am developing a mobile specific version of a web site.

     

    I am using the following tags in the header which work for the iPhone:

     

    <meta name="viewport" content="width=device-width, user-scalable=no" />
    

     

    However on an Android phone the initial view is zoomed in too close. Is there something i'm missing that can fix this problem?

     

    Thanks :confused:

  9. thanks for your reply, I think my explanation could have been better.

     

    Basically I am currently returning rows like so:

     

    code

    colour

    size

    quantity

    admin

    123

    2

    34

    1

    0

    143

    6

    23

    3

    0

    145

    8

    37

    1

    0

     

    The query is grouping the rows by code, size and colour then counting the quantity column.

     

    I need the query to group the results like above but only if the admin column is 0.  If admin is 1 then just output the row without grouping  like so:

     

    code

    colour

    size

    quantity

    admin

    123

    2

    34

    1

    0

    143

    6

    23

    1

    1

    143

    6

    23

    1

    1

    143

    6

    23

    1

    1

    145

    8

    37

    1

    0

     

     

    Is that any clearer?

  10. Hi all,

     

    I have a SQL statement which selects all records from a table, groups them by product_code, product_colour & product_size. I have added a new column 'admin'. I need to alter the query to return the items like before but only group the items that have 'admin' set to 0.

     

    Is this possible in one single query?

     

    SELECT *, SUM(quantity) as item_quantity
    FROM orders_items
    WHERE orders_id="1" 
    GROUP BY  code, sizes_id, sizes_id_2, colours_id
    ORDER BY id ASC
    

     

    Thanks for help with this

  11. Hi all,

     

    I have a PHP snippet that determines which state the website is in. LOCAL/ TEST or LIVE:

     

    if($_SERVER['REMOTE_ADDR'] == '127.0.0.1') $state = 'LOCAL';
    elseif(preg_match(".............<Not sure>..............", $_SERVER['HTTP_HOST'], $vresult)) $state = 'TEST';
    else $state = 'LIVE';
    

     

    Im struggling with the preg_match section to determine if the website is on a development server. The development servers are structured like so:

     

    devXX.WEBSITE.com

     

    XX - any number

    WEBSITE - the website name for my dev server

     

    any help with this would be greatly appreciated.

     

    Thanks

  12. Thanks for your reply.

     

    The black line was added by me for illustration purposes.  The lack line represents what I want the user to see at 1024x768 resolution.

     

    I am looking for a way to show only the black highlighted area rather than the left hand padded area at 1024 resolution as this causes horizontal scroll bars.

     

    Thanks

  13. Hi all,

     

    I have a question that may be related more to the jQuery forum if this is not possible with CSS.

     

    Here a visual of my layout

     

    sample.jpg

     

    The black line is the area that I want to be visible to 1024x768 users, however as the header is protruding slightly, it is showing this part and chopping off the right hand side resulting in horizontal scroll bars.

     

    Here is my current DOM structure sample:

     

    <body>
       <wrapper>
           <header></header>
           <main></main>
       </wrapper>
    </body>
    

     

    Here is a css sample:

     

    body{
    background:url(../images/bg_top.gif) repeat-x 0 0;
    font-family: 'Droid Sans', arial, serif;
    font-size:12px;
    color:#333;
    }
    #wrapper{
    width:1052px;
    margin:0 auto;
    }
    #header{
    width:100%;
    height:177px;
    background:url(../images/header_bg.jpg) no-repeat;
    }
    #main{
    background:url(../images/content_bg.png) repeat-y;
    padding:13px 55px;
    position:relative;
    min-height:400px;	
    z-index:1;
    }
    

     

    What is the best method to have only the black marked area show and hide the protruded part of the header at 1024x768 resolution?

     

    Thanks for your help.

  14. Your line:

     

    $myurls = 'http://'.$url2.'/'.$newurl[1].'/'.viewprofile.'/'.$profile_name.'/'.$profile_id.'.'.html;
    

     

    is missing the <b>$</b> tag for viewprofile.  Does that solve the issue?

     

    EDIT:

     

    also the string is formatted incorrectly, try this:

     

    $myurls = 'http://'.$url2.'/'.$newurl[1].'/'.$viewprofile.'/'.$profile_name.'/'.$profile_id.'.html';
    

  15. Hi all,

     

    Here is my problem: http://jsfiddle.net/faRur/2/

     

    I have a horizontal menu which opens up a dropdown sub menu when hovered over.  I want to float each separate UL list inside the 'sub-menu-content' div however they are displaying as a long list.

     

    As the sub menu data is dynamic I cannot define a width for the 'sub-menu' div (which when defined seems to work ok).

     

    Any ideas please?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.