Jump to content

mostafatalebi

Members
  • Posts

    200
  • Joined

  • Last visited

Posts posted by mostafatalebi

  1. Hello

     

    My main operating system in Windows Xp. I have a Linux CentOS 7.0 Which is installed on a vmware. Due to some reasons, I cannot install ZendServer on this virtual machine. What I like to do, is to install it on another virtual machine configured in my Windows. So basically there would be two virtual linux on a host Windows. Is it possible to connect my main working virtual linux to the second linux which has zendserver installed? How should I connect to the second linux virtual machine via the first one?

  2. Hello

     

    My question is not a Vs. type of question. I want to know which language is better to learn when you are a PHP programmer, Java or C++?

     

    I mean from an economic point of view. I already know what Java and C++ can do and how they are different. But my question is that, when you are a PHP programmer, and want to learn a programming language, which is better, Java or C++, from a job point of view?

  3.  

    If Canada is anything like the States, then having a degree in something is usually necessary to even be considered for anything that's not freelancing.  It doesn't have to be programming/computer science related, although that's definitely more desirable, but a college/university degree in something is usually a requirement in even getting your foot in the door.

     

    AFAIK, certificates aren't desirable.  They show that you know certain language features and minutiae, but don't illustrate whether or not you can problem solve.  A better route to go would be to build a portfolio of sites/projects that show you tackling specific problems.  That shows practical, in-the-field knowledge that's far more valuable to an employer.

     

    thanks for your reply.

     

    I have a MA degree in English Literature. Then, based on your given points, this might come useful to me. Of course, assuming I have the necessary practical knowledge of Web Design and Development.

  4. Hello

    I have two domains. My main domain is working for around 1 year, while my second domain is only one day old. I have added the second domain as my addon admin to the first one via cPanel. the second domain contains an index.php which redirect the visitor to the main domain.

    I have bought, due to some issues with first domain, the second domain for Google Adwords. Now, I'm confused whether or not do I need to do any SEO things to the second domain? Because when people search the google, Google Adwords will show my second domain as the website domain.

     

     

    thanks

  5. Hello

     

    I have problem with Adobe Dreamweaver. When I minimize it or when after writing one or two lines of code I maximize another application (such as firefox), dreamweaver alerts me. the below picture shows you exactly what I mean. Because I do not know the exact technical word when an application task bar icon turns blue as if some operation in it has taken place.

     

    Take a look at this:

     

    and if you know whether OS or DW are the cause, tell me.

     

    08315537659678950482.jpg

     

    thanks in advance

  6. Hello

     

    I have an order from one of my clients which would turn into a huge website with many daily visits and download/uploads.

     

    Now, I'm searching for a fine hosting solution. But what confuses me, is that, for such a project should I select a shared-hosting or a dedicated hosting? Because I need PHP 5.3 (most probably 5.4).....Please help me in this regard

  7. Hello everybody

     

    I don't know what should I do for cross-domain ajax request. Whatever I do does not work. For instance the following code just fails:

    $.ajax({
        type : "GET",
        dataType : "jsonp",
        url : "myurl.com/file_to_process.php",
        data : "name=myName",
        success : function (msg)
        {
           console.log(msg);
         }
         error : function ()
         {
           console.log("ERROR");
         }
    });

    the server PHP file:

    if(isset($_GET['name']))
    {
        echo $_GET['callback'];
    }
    

    The above code always console.log "ERROR" and has made me mad. I have tried it with numerous tiny changes

  8. Hello everybody

     

    I'm developing a simple product-gallery website. Due to my client request, I should code it from scratch and don't use CMS such as wordpress. I wonder what is the best way for a product to have cateogries? Let me explain:

     

    I have product A which is a Laptop. It has following categories:

     

    ASUS, light, expensive, office, award-winner

     

    Each of the above words a category. For instance the cateogry "office" includes laptop appropriate for office and non-graphical tasks and the other words are explanatory as well. Then, I want to make a product table, what is the best solution for category field? Should I make a column for each cateogry, in that way I have to impose a limit on it. For instance 5 columns for category which makes it limited. Or, I should use only one category and separate them with comma. In that way I should use a little reg exp.

     

    What is your suggestion?

     

    thanks in advance

     

  9. Hello everybody

     

    I'm developing a website. This website neither uses framework nor uses CMS, and I'm going totally bare with PHP. My question is that, is it ok to go with simple $_SESSION['username'] variable or for better performance (and of course more secure environment) I can go with some methods of encryption? Can anyone help me please. I want to see if there is a proper way of securing sessions.

     

    thanks in advance

  10. Hello everybody

    I'm beginning a site with CodeIgniter. I have sketched a template structure is photoshop. I need somebody checks the structure to see if it is proper for a well-structured site:

    Here is the picture of what I have in mind:

     

    80474377253711927293.jpg

     

    Explanation:

     

    The site is three-columned

    when the user request the index.php -> it loads three parent section which are header, body, and footer. then, each section should load other pieces of of data. For instance the footer should load two other files called footer-copyright and footer-section(a bunch of foot-menus). Is this working?

  11. Hello

    I have written a mechanism to upload a file using AJAX technology (pure javascript) in CodeIgniter.

    Explanation:

    1- I have written an scrip.js file which is responsible to handle AJAX/Javascript process of the upload.

    2- I have written a controller in CodeIgniter which receives request from AJAX to upload the file.

    3- I have written a simple HTML page

     

    PROBLEM: When I hit the upload button, simply nothing happens! No error is shown.

     

    Here are files:

     

    This is JAVASCRIPT

    // JavaScript Document
    var doUpload =  function(event){
            // globally used variables in this function
            var progressBar = document.getElementById('progressBar');
            
            event.preventDefault(); // prevents the default action of an element
            event.stopPropagation();        
            // get the file-input id
            var fileId = document.getElementById('file');    
            
            // this variable makes an object which accept key/value pairs which could be sent via ajax.send
            var formObj = new FormData();
            
            // append currently selected file to the dataObject            
            formObj.append('file', fileId.files[0]);        
            
        
            // this is a variable to check in the php script (controller if the codeIgniter is used)
            formObj.append('error-check', true);
            formObj.append('finish-check', true);
                        
            // let's make the ajax request object
            var ajaxReq = new XMLHttpRequest();
                                                    
            // PROGRESS  OF THE FILE /////////////////////////////////////////////
                // now trigger a function during the progress-process of the file-upload process
            
            ajaxReq.upload.addEventListener('progress', function(event){        
                    
                    console.log('this is a very good.');        
                    
                    // first let's get the amount of the file loaded. it is in decimals
                    var percent = event.loaded / event.total;
                    // get the name of the element that the progress-indicator is outputted there
                    
                    if(event.lengthComputable) // if a file is inserted and everything is just OK for uploading
                    {
                        if(progressBar.hasChildNodes()) // cleans the div container for a new progress to display
                        {
                            progressBar.removeChild(progressBar.firsChild);
                        }
                        progressBar.appendChild(document.createTextNode('The Progress So Far: '+percent*100+' %'));
                    }
            // END OF PROGRESS  OF THE FILE /////////////////////////////////////////////
            
            
            
            // LOAD  OF THE FILE /////////////////////////////////////////////
                ajaxReq.upload.addEventListener('load', function(event){
                    progressBar.appendChild(document.createTextNode(" Completed!"));
                });
            // END OF LOAD  OF THE FILE /////////////////////////////////////////////
            
            // ERROR  OF THE FILE /////////////////////////////////////////////
                ajaxReq.upload.addEventListener('error', function(event){
                    progressBar.removeChild();
                    progressBar.appendChild(document.createTextNode("Failed to Upload the File."));
                });    
            // END OF THE ERROR  OF THE FILE /////////////////////////////////////////////
            
            // JSON            
            
            // OPEN THE AJAX REQUEST
            ajaxReq.open('POST', 'upload/uploader');
            
            // Set the header of the POST request
            ajaxReq.setRequestHeader('Cache-Control', 'no-cache');
            
            // send the file. remember, we shoud pass a formData object as an argument to the ajaxRequest.send();
            ajaxReq.send(formObj);
            
            });
            
    }
    
    window.addEventListener('load', function(event)
    {    
            // get the submit id of the form
            var submitButton = document.getElementById('submit');
            submitButton.addEventListener('click', doUpload);
    });
    

    This is PHP Controller in CodeIgniter

    <?php
    class Upload extends CI_Controller
    {
             function index()
            {
                $this->load->view('pages/form');
             }
             function uploader ()
             {
                    // define the required settings for the upload library to instanciate
                    $config['upload_path'] = './uploads/';
                    $config['allowed_types'] = 'gif|jpg|png|doc|txt';
                    $config['max_size']  = 1024 * 8;
                    $config['encrypt_name'] = TRUE;
                    
                    
                    // load the upload library
                    $this->load->library('upload', $config);
                    
                    
                    if(!$this->upload->do_upload('file'))
                    {
                        $data['error'] = $this->upload->display_errors();
                        //$this->load->view('pages/form', $data);
                        json_encode($data['error']);
                    }
                    else
                    {
                        $data['uploaded'] = $this->upload->data();
                        //$this->load->view('pages/form', $data);    
                    }
                    
                    
             }
            
    }

    This is the HTML

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Upload Form With Ajax</title>
    <script src="<?php echo base_url(); ?>js/script.js" type='text/javascript'></script>
    </head>
    
    <body>
    <div id='error' style='color: red;height: 40px; width: 200px;'>
    <?php
    if(!empty($error)){echo $error; }
    ?>
    </div>
    <form id='form' name='form' enctype="multipart/form-data" >
    <input type='file' name='file' id='file'/>
    <input type='submit' name='submit' id='submit' value='Upload File' />
    </form>
    <div style='height: 200px; width: 300px; color: red; padding: 10px; background-color: #CCC;' id='progressBar'></div>
    </body>
    </html>
  12. Hello everybody

     

    I have searched the net but have not understood the following question's answer perfectly.

     

    What is the difference between the

    event.preventDefault();
    

    and

    event.stopPropagation();
    

    in Javascript as it seems both of them deals with the default action of an element.

     

    Thanks in advance

  13. Hello everybody

     

    I wonder whether or not using a Responsive strategy is necessary when dealing with customer? I mean, is responsive design (now in 2013) a necessity and an inherent quality, or it is a very good extra option? Because, I'm new in web business, there are  customers out there who mentions responsive design, while the rest of them, simply are careless about it. What shall I do for those who are careless and ignore responsive design? Shall I go on and only consider desktop users or consider mobile users as well?

     

    For web design, is it good to use Frameworks such as Foundation, or simply coding from the scratch?

     

    An extra question, why some website offer a separate sub-domain to mobile, when it is possible to achieve it with responsive web design? (for instance, m.facebook.com).

     

    Thanks in advance

  14. Hello everybody

     

    I have written following plugin:

    (function(){   
        var cont = $("#container");
        $.fn.doTabs = function(options){
            var options = $.extend({
               startTab : 1            
            })
            return this.each(function(){
               // here goes the rest of the code
               })
            })
        }    
    })(jQuery)

    When I call it like this:

    $("#container").doTabs();

    it works.

    But When I call it with a parameter passed to it, it works as if no parameter is passed.(like this:)

    $("#container").doTabs({startTab: 3});

    What shall I do?

     

    Thanks in advance

×
×
  • 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.