Home Blog Page 24

The solution Homework 3.3 M101JS: MongoDB for Node.js Developers

The solution homework 3.3 M101JS: MongoDB for Node.js Developers

Making your blog accept comments

In this homework, you will add code to your blog so that it accepts comments. Download and unpack the files for this homework from the Download Handout link. You will be using the same code as you downloaded for homework 3.2, along with the changes you made.

We have removed parts of the code that uses the Node.js driver to query MongoDB from posts.js and marked the area where you need to work for HW 3.3 with “hw3.3 TODO”.

In a terminal:

Linux/Mac:

cd blog/ 
grep -rn "hw3.3 TODO" *

Windows:

cd blog/ 
find /n "hw3.3 TODO" *

You should not need to touch any other code. The database call that you are going to add will add a new comment to a given post.

This assignment has fairly little code, but it’s a little more subtle than the previous assignment because you are going to be manipulating an array within the Mongo document. For the sake of clarity, here is a document out of the posts collection from a working project that also has comments.

{
"_id" : ObjectId("513d396da0ee6e58987bae74"),
"author" : "andrew",
"body" : "Representatives from the planet Mars announced today that the planet would adopt MongoDB as a planetary standard. Head Martian Flipblip said that MongoDB was the perfect tool to store the diversity of life that exists on Mars.",
"comments" : [
{
"author" : "Larry Ellison",
"body" : "While I am deeply disappointed that Mars won't be standardizing on a relational database, I understand their desire to adopt a more modern technology for the red planet.",
"email" : "larry@oracle.com"
},
{
"author" : "Salvatore Sanfilippo",
"body" : "This make no sense to me. Redis would have worked fine."
}
],
"date" : ISODate("2013-03-11T01:54:53.692Z"),
"permalink" : "martians_to_use_mongodb",
"tags" : [
"martians",
"seti",
"nosql",
"worlddomination"
],
"title" : "Martians to use MongoDB"
}

As a reminder, to run your blog, go into the blog directory and type:

npm install
node app.js

Note that you add comments in this blog from the blog post detail page, which appears at

http://localhost:8082/post/post_slug

where post_slug is the permalink. For the sake of eliminating doubt, the permalink for the example blog post above is

http://localhost:8082/post/martians_to_use_mongodb

Ok, now it’s time to validate you got it all working.

From the top of this page, there was one additional program that should have been downloaded:mongoProc.

With it, you can test your code and look at the Feedback section. When it says “user creation successful” and “user login successful”, you can Turn in your assignment.

Solution:

Open blog/user.js and paste following codes or make changes near hw3.3

/* The PostsDAO must be constructed with a connected database object */
function PostsDAO(db) {
    "use strict";

    /* If this constructor is called without the "new" operator, "this" points
     * to the global object. Log a warning and call it correctly. */
    if (false === (this instanceof PostsDAO)) {
        console.log('Warning: PostsDAO constructor called without "new" operator');
        return new PostsDAO(db);
    }

    var posts = db.collection("posts");

    this.insertEntry = function (title, body, tags, author, callback) {
        "use strict";
        console.log("inserting blog entry" + title + body);

        // fix up the permalink to not include whitespace
        var permalink = title.replace( /\s/g, '_' );
        permalink = permalink.replace( /\W/g, '' );

        // Build a new post
        var post = {"title": title,
                "author": author,
                "body": body,
                "permalink":permalink,
                "tags": tags,
                "comments": [],
                "date": new Date()}

        // now insert the post
        // hw3.2 TODO

        //Solution:
        //callback(Error("insertEntry NYI"), null);
        posts.insert(post,function(err,result){
            if(!err){
                console.log("Post inserted " + result[0].permalink);
                return callback(null, result[0].permalink);
            }
            return callback(err, null);
        });
    }

    this.getPosts = function(num, callback) {
        "use strict";

        posts.find().sort('date', -1).limit(num).toArray(function(err, items) {
            "use strict";
            if (err) return callback(err, null);
            console.log("Found " + items.length + " posts");
            callback(err, items);
        });
    }

    this.getPostsByTag = function(tag, num, callback) {
        "use strict";

        posts.find({ tags : tag }).sort('date', -1).limit(num).toArray(function(err, items) {
            "use strict";

            if (err) return callback(err, null);

            console.log("Found " + items.length + " posts");

            callback(err, items);
        });
    }

    this.getPostByPermalink = function(permalink, callback) {
        "use strict";
        posts.findOne({'permalink': permalink}, function(err, post) {
            "use strict";

            if (err) return callback(err, null);

            callback(err, post);
        });
    }

    this.addComment = function(permalink, name, email, body, callback) {
        "use strict";

        var comment = {'author': name, 'body': body}

        if (email != "") {
            comment['email'] = email
        }

        // hw3.3 TODO
        //callback(Error("addComment NYI"), null);
        var query = { "permalink" : permalink };
        var operator = { '$push' : { 'comments' : comment } };
        posts.update(query, operator, function(err, updated){
            "use strict"
            if(err)
                return callback(err, null);
            //console.log("Comment: " + comment.body + " inserted in post: " + permalink );
            console.log("Comment: " + updated);
            return callback(null, updated);
        });
    }
}

module.exports.PostsDAO = PostsDAO;

The solution Homework 3.2 M101JS: MongoDB for Node.js Developers

Making your blog accept posts

In this homework, you will be enhancing the blog project to insert entries into the posts collection. After this, the blog will have basic functionality. It will allow you to add blog posts with a title, body, and tags and have it be added to the posts collection properly.

We have provided the code that creates users and allows you to log in (the assignment from last week). Download and unpack the files for this homework from the Download Handout link.

We have removed parts of the code that uses the Node.js driver to query MongoDB from posts.js and marked the area where you need to work for hw3.2 with “hw3.2 TODO”.

In a terminal:

Linux/Mac:

cd blog/ 
grep -rn "hw3.2 TODO" *

Windows:

cd blog/ 
find /n "hw3.2 TODO" *

You should not need to touch any other code. The database call that you are going to add will insert a new post into the posts collection. Here is an example of a valid blog post:

> db.posts.find().pretty()
{
"_id" : ObjectId("513d396da0ee6e58987bae74"),
"title" : "Martians to use MongoDB",
"author" : "andrew",
"body" : "Representatives from the planet Mars announced today that the planet would adopt MongoDB as a planetary standard. Head Martian Flipblip said that MongoDB was the perfect tool to store the diversity of life that exists on Mars.",
"permalink" : "martians_to_use_mongodb",
"tags" : [
"martians",
"seti",
"nosql",
"worlddomination"
],
"comments" : [ ],
"date" : ISODate("2013-03-11T01:54:53.692Z")
}

As a reminder, to run your blog, go into the blog directory and type:

npm install
node app.js

To play with the blog you can navigate to the following URLs:

http://localhost:8082/
http://localhost:8082/signup
http://localhost:8082/login
http://localhost:8082/newpost

Ok, now it’s time to validate you got it all working.

From the top of this page, there was one additional program that should have been downloaded:mongoProc.

With it, you can test your code and look at the Feedback section. When it says “user creation successful” and “user login successful”, you can Turn in your assignment.


Solution:

Open blog/posts.js and paste following codes or make changes near hw3.2

/* The PostsDAO must be constructed with a connected database object */
function PostsDAO(db) {
    "use strict";

    /* If this constructor is called without the "new" operator, "this" points
     * to the global object. Log a warning and call it correctly. */
    if (false === (this instanceof PostsDAO)) {
        console.log('Warning: PostsDAO constructor called without "new" operator');
        return new PostsDAO(db);
    }

    var posts = db.collection("posts");

    this.insertEntry = function (title, body, tags, author, callback) {
        "use strict";
        console.log("inserting blog entry" + title + body);

        // fix up the permalink to not include whitespace
        var permalink = title.replace( /\s/g, '_' );
        permalink = permalink.replace( /\W/g, '' );

        // Build a new post
        var post = {"title": title,
                "author": author,
                "body": body,
                "permalink":permalink,
                "tags": tags,
                "comments": [],
                "date": new Date()}

        // now insert the post
        // hw3.2 TODO

        //Solution:
        //callback(Error("insertEntry NYI"), null);
        posts.insert(post,function(err,result){ if(!err){ console.log("Post inserted " + result[0].permalink); return callback(null, result[0].permalink); } return callback(err, null); });}

    this.getPosts = function(num, callback) {
        "use strict";

        posts.find().sort('date', -1).limit(num).toArray(function(err, items) {
            "use strict";
            if (err) return callback(err, null);
            console.log("Found " + items.length + " posts");
            callback(err, items);
        });
    }

    this.getPostsByTag = function(tag, num, callback) {
        "use strict";

        posts.find({ tags : tag }).sort('date', -1).limit(num).toArray(function(err, items) {
            "use strict";

            if (err) return callback(err, null);

            console.log("Found " + items.length + " posts");

            callback(err, items);
        });
    }

    this.getPostByPermalink = function(permalink, callback) {
        "use strict";
        posts.findOne({'permalink': permalink}, function(err, post) {
            "use strict";

            if (err) return callback(err, null);

            callback(err, post);
        });
    }

    this.addComment = function(permalink, name, email, body, callback) {
        "use strict";

        var comment = {'author': name, 'body': body}

        if (email != "") {
            comment['email'] = email
        }

        // hw3.3 TODO
        //callback(Error("addComment NYI"), null);
        var query = { "permalink" : permalink };
        var operator = { '$push' : { 'comments' : comment } };
        posts.update(query, operator, function(err, updated){
            "use strict"
            if(err)
                return callback(err, null);
            //console.log("Comment: " + comment.body + " inserted in post: " + permalink );
            console.log("Comment: " + updated);
            return callback(null, updated);
        });
    }
}

module.exports.PostsDAO = PostsDAO;

Top 30 Drupal 8 modules to use in 2019 SEO, Workflow, Securities and others

Following are the list of Drupal 8 modules that we find must-have modules for 2019, by which site will be SEO friendly, most of the securities are covered, easy to write codes, easy to debug, easy administration and many more. The list of required modules are:

  1. Paragraphs
    Better than Field collections module
    Site Builders — to make things cleaner so that you can give more editing power to your end-users
    https://www.drupal.org/project/paragraphs
  2. Bootstrap Paragraphs Types
    This Drupal module creates a suite of Paragraph bundles to allow content creators to harness the power of the Bootstrap framework for functionality and layout.
    https://bp.jimbir.ch
    https://www.drupal.org/project/bootstrap_paragraphs
  3. Display Suite
    Instead of Panels
    https://www.drupal.org/project/ds
  4. admin_toolbar
    Useful administration menu
    https://www.drupal.org/project/admin_toolbar
  5. Dropzonejs
    Functionality like “Media” in D7
    https://www.drupal.org/project/dropzonejs
  6. Embed
    Used in many fields
    https://www.drupal.org/project/embed
  7. Token
    Token module
    https://www.drupal.org/project/token
  8. Entity
    Entity
    https://www.drupal.org/project/entity
  9. entity_browser
    For Media Files
    https://drupal.org/project/entity_browser
  10. entity_reference_revisions
    Entity Reference Revisions
    https://www.drupal.org/project/entity_browser
  11. file_browser
    Media files popup
    https://www.drupal.org/project/file_browser
  12. file_entity
    File Entity
    https://www.drupal.org/project/file_entity
  13. Shortcode
    Shortcodes
    https://www.drupal.org/project/shortcode
  14. Ctools
    Chaos tools
    https://www.drupal.org/project/ctools
  15. inline_entity_form
    Inline Entity Form
    https://www.drupal.org/project/inline_entity_form
  16. entity_reference_revisions
    Inline Reference Revisions
    https://www.drupal.org/project/entity_reference_revisions
  17. entity_embed
    Entity Embed
    https://www.drupal.org/project/entity_embed
  18. Libraries
    Libraries
    https://www.drupal.org/project/libraries
  19. state_machine
    State Machine
    https://www.drupal.org/project/state_machine
  20. Webform
    WebForm
    https://www.drupal.org/project/webform
  21. tb_megamenu
    Mega Menu
    https://www.drupal.org/project/tb_megamenu
  22. Checklistapi
    simple interface for modules to create fillable, persistent checklists that track progress with completion times and users. https://www.drupal.org/project/checklistapi
  23. Better Exposed Filters
    Works with Views Filters
    Better Exposed Filters gives you greater control over the rendering of exposed filters. https://www.drupal.org/project/better_exposed_filtersSEO Modules:
  24. Pathauto
    Pathauto module automatically generates URL/path aliases for various kinds of content
    https://www.drupal.org/project/pathauto
  25. seo_checklist
    SEO Checklist module
    https://www.drupal.org/project/seo_checklist
  26. Robots txt
    Generates the robots.txt file dynamically and gives you the chance to edit it
    https://www.drupal.org/project/robotstxt
  27. Metatag
    Allows you to automatically provide structured metadata
    https://www.drupal.org/project/metatag
  28. Hreflang
    In Drupal 8, the core Content Translation module adds href lang tags only to translated entity pages.
    https://www.drupal.org/project/hreflang
  29. XML sitemap
    Creates a sitemap that conforms to the sitemaps.org specification
    https://www.drupal.org/project/xmlsitemap
  30. Security
    login_security
    limit the number of invalid login attempts before blocking accounts, or deny access by IP address, temporarily or permanently.
    https://www.drupal.org/project/login_security
  31. Security Kit
    SecKit provides Drupal with various security-hardening options. This lets you mitigate the risks of exploitation of different web application vulnerabilities.
    https://www.drupal.org/project/seckit
  32. Security Review
    Security Review module automates testing for many of the easy-to-make mistakes that render your site insecure. https://www.drupal.org/project/security_review
  33. Coder
    Coder checks your Drupal code against coding standards and other best practices.
    https://www.drupal.org/project/coder
  34. Captcha
    challenge-response test most often placed within web forms to determine whether the user is human.
    https://www.drupal.org/project/captcha
  35. Honeypot
    Honeypot uses both the honeypot and timestamp methods of deterring spam bots from completing forms on your Drupal site https://www.drupal.org/project/honeypot
  36. Encryption
    Needed for market and other modules
    https://www.drupal.org/project/encryption
  37. Workflow
    This module allows you to create arbitrary Workflows, and assign them to Entities.
    https://www.drupal.org/project/workflow

Let us know if you have your favorite modules if you have any. Check how you can set up PHP development environment with VSCode and let us know if you have other extensions.

Internship final report sample, Introduction, SWOT analysis, and recommendation

In this internship final report sample, we are showing you the full report, with a background of the study, objectives of the study, Limitations of the Study, Selection Method of Data Collection and the whole report body.

CHAPTER 1

Introduction

1.1 Background of the study

The internship program has become the bridge for those who want to enter to corporate level from the college life, through an internship I got to know the real working environment which was very much different from my course study.

The internship has developed a kind of confidence in me that now I can do something different from new employees and I can work as an employee. The main things I learned from the internship are the value of time and the importance of punctuality and rules and regulations that we have to follow as an employee.

1.2 Objectives of the study

The general objective of this report is to partially fulfill the requirements for the degree of BCIS. However, the specific objectives are as follows:

  • To find the use of Websites in today’s society.
  • To develop the Management Skills, Personality, and Teamwork.
  • To develop interpersonal skills, conceptual as well as technical skills.
  • Tips and techniques to design and program websites.
  • The technique to earn online.

1.4 Limitations of the Study:

Major limitations of internship report are as follows:

  • Lack of proper research and detailed information about the company and its operating activities.
  • The time frame to perform an internship was short.
  • Lack of knowledge to run programs and software used by DP Sign.
  • Object-oriented based programming and use of different programming languages in DP Sign stopped me to learn more.

1.5 Selection Method of Data Collection

There are two major approaches to gathering information in my internship about the situation, person, problems or phenomenon and software in DP Sign.

  • Internal information
  • External Information

This information was collected with the help of both primary and secondary resources.

  1. Primary Data: They are collected by me on the concerned topic, which is original. While studying I have come across sources such as direct interviews with the supervisor, opinion of the different employees, informal talks with the employees, etc.
  2. Secondary Data: They are collected by me on the basis of the study of networking in organizations. For preparing this report on networking and data communication I have collected information through Nepal Bank, internet, books, teachers, and some previous records.

CHAPTER 2

Report Body

2.1 Introduction of DP Sign

D.P. Sign

  1. stands for Digital
  2. stands for Printed

The sign stands for different kinds of signs.

Registered Name:                   D.P. Sign

Address:                                  New Baneshwore, Shankhamool-125/28, KTM.

Phone:                                     01-4783309

Website:                                  https://webocreation.com

E-mail:                                     webocreation.com@gmail.com

DP SIGN is a global IT services company providing IT consulting, technology and outsourcing services. Using our enhanced global delivery model, innovative platforming approach and industry expertise, we provide cost‐effective services that enable our clients to use IT to enhance business performance, accelerate time‐to‐market, increase productivity and improve customer service.

DP SIGN provides value to its customers through innovation, accomplishment, trust, and long‐term relationships through its unique service portfolio and expertise.

DP SIGN brings quality services and products to its customers on time and at the most competitive prices. DP SIGN has very strong software engineering processes for software design and development activities. These strengths enable DP SIGN to smoothly adapt to the rapid enhancements in the technological domain while maintaining constant focus on the ever-changing business needs of its clients. With the vision of becoming the best IT service provider of the nation, DP SIGN has been a trailblazer in various domains of software engineering in Nepal.

Embedded system programming, Quality assurance techniques and process-oriented approach towards the design and development are those where DP SIGN has become a pioneer in the local context. Again, sustained quality delivery on time, post‐delivery services, corporate culture, documented knowledge acquisition, and continuous learning environments are the critical success factors of DP SIGN to achieve its vision.

2.2 Corporate Goal of the Company

The three pillars on which the DP Sign has its corporate structure are:

  1. Continuous improvement
  2. Customer’s satisfaction
  3. Quality of product and system

All these pillars are the pillars of the quality system which the organization owns in order to satisfy its customers. Continuous improvement means the process of quality is not still at a certain point, it continuously moving towards the improvement and can’t be still to some location, and the sole objective of this continuous improvement is to satisfy the customer’s need by giving the customer the quality products.

2.3 Mission Statement of the company

“Our mission is to offer advanced, convenient, and money-saving digitally printing things in Monitors or papers with the implementation of distinctive ideas and expertise. Our foundation of survival is based on providing valued clients a convenient and affordable source for digitalizing the world“.

In a clear sense, our motto is to be “A strategic partner of our clients, not a mere vendor.”

2.4 D.P. Sign’s spirit is infused into every component

D.P. Sign doesn’t simply just make and sell products; we are also deeply concerned with a number of issues, such as quality products, quick service, after-sale services and what type of services would be ideal for the clients. This enables us to refine existing work procedures and technologies. Every work is done and processed with the clients in our minds.

2.5 Services

DP SIGN offers a broad range of printing, IT consulting, custom programming services and online earning training. We have significant experience satisfying the most special technical needs of our customers. We understand the importance of a balanced technical design. We apply the appropriate level of technology to each project, keeping smaller projects simple and larger projects robust.

Our clients represent a broad cross‐section of businesses. We are very proud of the relationships we have built, and we have earned them through listening, learning, and communicating with our clients.

The categories below summarize our most common tasks.

2.5.1 Web Development

  • Web Services
  • Content Management
  • E‐business solution (CMS, E‐auction, E‐catalogs, etc)
  • Search Engine optimization
  • E‐commerce and portals
  • E‐Learning Management System

2.5.2 Web-based application design and development

  • Business workflow management
  • CRM
  • MIS

2.5.3 Generic/custom software solutions (in different platforms/domains)

  • Auto
  • Pharmaceuticals
  • Mortgage

2.5.4 Embedded software solutions

2.5.5 Online Earning Training

2.6 Engagement Models

2.6.1. Fixed price turnkey model

This model is applicable for projects where requirement specifications and timelines are clearly defined and frozen. This helps clients if they have a fixed budget for development and are clear about their requirements. We work with our client to define expected deliverables to determine a mutually agreed fixed price.

2.6.2. Per resource model

This model offers clients the flexibility to alter requirement specification, team size and timeline of projects based on market trends and feedback. This model suits best for most of the projects due to a software development project’s inherent need for altering specifications throughout the development life cycle. The client pays a monthly fee per resource (development, QA or management).

2.6.3. Offshore model

Our core expertise lies in establishing Offshore Development Centers for its clients. Through this model we serve our clients with highly experienced professionals with varied skill sets, resources, flexibility and time & cost‐to‐market advantages, allowing them to enjoy the long term gains of offshore outsourcing. DP SIGN operates as an extension to clients’ existing software engineering business. The secret of its success can be attributed to the fact that this model gives an opportunity to the client to make direct communication with DP SIGN through the onsite center and at the same time gives them the chance of enjoying the benefits of offshore development. Round the clock development is seamlessly done with this model. In this model, the client pays an offshore center on a per month basis.

2.7 Delivery Model

A proper combination of synthesis motivates every engagement, enabling us to deliver technology solutions that give our clients a decisive competitive advantage. The client can decide among one of the following delivery models

  • Full offshore development
  • Full Onsite development with our developers and QA resource deployed at the client’s site
  • Hybrid model when the majority of the team is offshore and the few members are onsite to help gather business requirements and help in deliverables.

Above mentioned models cater to the different requirements of clients like augmenting their development or QA teams, forming a new and complete project team, getting architects and designers for new technology development. However, more onsite involvement increases the total cost of development. DP SIGN management team works with the client to help them choose the best model that fits into their business requirements.

2.8 Process and Standards

The following standards summarize the commitment of DP SIGN towards the international best practices.

2.8.1 Project management standards

At DP SIGN, we believe that project management is the key to the success of any project, more so for IT projects. We closely follow the PMBOK as set by the Project Management Institute (PMI) standards.

2.8.2 CMMI: The process improvement initiatives

We have initiated the development of process standards in‐house with the implementation of CMMI (Capability Maturity Model Integration). This process improvement approach will provide our organization with the essential elements of effective processes. CMMI can be used to:

  • guide process improvement across a project or throughout an entire organization
  • integrate traditionally separate organizational functions
  • set process improvement priorities and goals

Processes being the pivot of the realization of products/services, DP SIGN ensures that every pertinent activity comports with the defined processes. The following sequence features the processes that are executed during the entire development lifecycle

2.8.3.1. The offshore team-building process

This process primarily focuses on the team-building approach and deals with both onshore and offshore development centers. The following phases and activities summarize this process

Phase: Project team creation

Activities:

  • Defining and signing off the scope agreement
  • Identification of key team members for the project
  • Signing off the related agreements

Phase: Onsite to Offsite knowledge transition

Activities:

  • Offshore Team Building Process
  • Project Outsourcing Process
  • Project Management Process

Phase: Offshore process definition

Activities:

  • Tailoring standard methodology to comply with the client’s requirements

Phase: Offshore simulation

Activities:

  • Simulation of a client’s environment at an offshore development center
  • Review and comply with service level agreements
  • Establishment of required infrastructure
  • Setting up the offshore team structure
  • Training the ODC team for client’s requirements

Phase: Offshore project execution

Activities:

  • Define and review the different phases of the project
  • Establishment of project plans for each phase
  • Execution of the project in a phase‐wise manner in adherence to the corresponding project plan.
  • “Project outsourcing process” continues hereafter.
  • Review of the project plan as and when required

Phase: Review of ODC team and infrastructure

Activities:

  • Establishment of metrics to identify the client’s satisfaction level in
  • Terms of team structure/communication, infrastructure, and any other relevant issues
  • Implementation of feedback from the client

2.8.3.2 Project outsourcing process

This process comprises of the following phases, activities, and deliverables related to the project execution.

Phase: Analysis of requirements

Activities:

  • Requirement capture
  • Describing the old architecture
  • Identification of critical issues
  • Identification/assessment of client risk and mitigation measures
  • Establishment of project scope

Phase: Creation of Design Documents

Activities:

  • Development of system design schema
  • Creation of detailed project plan

Deliverables:

  • Design documents
  • Hardware and system architecture

Phase: Development/Unit testing

Activities:

  • Modules coding
  • Unit testing
  • Test case design and documentation

Deliverables:

  • Test Plan
  • Issue tracking log
  • Code walkthrough review
  • System test cases

Phase: System Integration/Testing

Activities:

  • Execution of test cases
  • Fixing bugs
  • Change request review
  • Update test cases
  • Update design documents

Deliverables:

  • Test plan and Test cases
  • Test log sheet
  • Approved changed request
  • Updated design documents

Phase: Acceptance/ release to production

Activities:

  • Verification of acceptance criteria
  • Fixing bugs
  • Review of Change request
  • User training
  • Development of user manuals

Deliverables:

  • Sign off on acceptance
  • Detail QA reports
  • User manual
  • Installation/release notes

2.8.3.3 Project management process

Phase: Initial Project Plan

Activities:

  • Estimation of effort and development time with the support of lead developer and QA manager
  • Resource allocation for each task

Phase: Project tracking/visibility (recurring step till the delivery of project)

Activities:

  • Preparation of weekly status by the project manager (For some clients there will be daily Scrum).
  • Discussion on project status with the client in the defined period
  • Readjustment of resource as required
  • Updating the project plan in accordance with the change request issued by the client

Phase: Project plan for the next phase (recurring step till the delivery of project)

Activities:

  • Generation of the project plan for the next phase
  • Tracking of next phase

2.9 Domain Profile

DP SIGN offers its skills/services in two different segments i.e. System level programming and application-level programming.

2.9.1 System Level Programming

DP SIGN has been doing various projects related to embedded system development. It is basically developing systems in C. We have good expertise in working on the Linux platform as well as on Windows. Our work involves working in different protocols related to the network. We have also been working with media formats like MPEG4. Following is the summary of Tools and Technology we use at DP SIGN at the System Programming unit:

System Programming unitSoftware
Development IDEEclipse CDT
Compilersgcc and g++
Debugging and Profiling toolsgdb, GPROF, Strace, Mtrace, Linux trace toolkit
Testing ToolsCUnit, CGreen
Bug Tracking SystemBugzilla
Version Control SystemSubversion
PlatformMontavista Linux 4.1, Red Hat Enterprise Linux
Protocols for NetworkReal-Time Streaming Protocol(RTSP), Session Description Protocol(SDP), Real‐Time Transport   Protocol(RTP), UDP, TCP
Media FormatMpeg4

Tab: 2.1 System units and its Software

2.9.2 Application Level Programming

We provide specialized services to cater to the specific web requirements that are by practice defined by the client. In this context, we concentrate more on the implementation approach for the customer defined requirements coupled with the right technologies to deliver a high-quality web solution. Our expertise is distributed but not limited to the client-server solution, thin client-based application, and web-based application development. We have been working with our clients mostly in the area of E‐commerce solutions, CRM solutions, and third party web integration.

Here is a list of technologies and platforms that we use to bring you the best, most efficient and cost‐effective solution.

TechnologyPlatform
Operating SystemLinux, Windows2000/ XP, WinNT
Web Page Design Scripting TechnologyAJAX, HTML/DHTML, XML, JavaScript, PHP, Perl / CGI, .NET, ASP
DatabaseMysql, MSSQL, MS Access, Oracle
Graphics Design ToolsAdobe Photoshop, Adobe Illustrator, CorelDraw, GNOME Imaging Software
Web Development ToolsUltradev Dreamweaver, DeamweaverMX, PHP Editor, Microsoft Visual Basics, Microsoft Visual Studio.NET, Macromedia Flash
Programming LanguagesPHP, ASP, VB, C/C++, C#
Testing ToolsTest Track, Track+, Cpp‐Unit, N‐Unit, Win Runner, Load Runner
Bug Tracking SystemBugzilla
Version Control System:Subversion, CVS
Content Management SystemJoomla, Mambo, Droople, PHPNuke
EcommerceOscommerce, Creloaded, Zencart, XCart, OscMax
Design and PM toolsMS‐Project, MS‐Visio, Rational Rose

Tab: 2.2 List of technology with a platform

2.10 Competitive Advantage of DP Sign

DP SIGN maintains working hours with Time‐match/Time‐overlap facility. This way, our Japanese and American clients get complete visibility and interaction with the development team. DP SIGN possesses a strong team of architects, DBA, Programmers, QA personals and support staff with graduation in computer science from reputed universities. Not only that, it maintains formal tie‐up with reputed universities for the interrupted supply of trained human resource

  • Compelling cost arbitrage advantage (better than India and the Philippines)
  • Reduces time‐to‐market and provides a frequent delivery and support model
  • In‐house Training facility for the project members depending upon the nature of the project
  • Developers possess sound oral and written communication in English and are further trained by the American Language Center
  • Defined Software process with state of the art tools/techniques involved in all phases of complete life‐cycle

2.11 Physical Infrastructure

  • 8000 sq feet Software Development Centre capable of accommodating more than 100 resources (Can be extended as and when required)
  • 24 hour guarded premises (guarded by internationally acclaimed “Group 4 Falk) at the heart of Kathmandu.
  • Multi‐skilled resource pool
  • A strong team of architects/DBA/Programmers/QA personals and support staff
  • Networked workstations running Linux, embedded Linux and Windows NT/2000/XP
  • Dedicated server room with high security and standard network and server equipment
  • Hardware firewall (Sonic Wall) protected development environment
  • Uninterrupted Power Supply
  • Ergonomically designed workspaces
  • Backup placed at multiple locations (in multiple buildings)
  • Multiple leases and broad‐band internet connection extendable to 1Mbps of connectivity.
  • Dedicated conference room

2.12 Organizational Hierarchy Chart

organizational chart

Fig-2.1: Organization Structure

2.13 Number of employees

PrintingWeb site and online earnings
Technician-                  12   J. Technician-              8 Designer-                     2 Printer Operator-         2 Administration-           4 Marketing-                  3 Designer 7 Database designer 3 Marketing 10 Customer Relation (Callers) 10 Data Entry 14 Teachers   Programmers 6+   10

Tab: 2.3 Number of employees

2.14 Introduction of Departments I have worked

2.14.2 Website development Department

Web site development in DP Sign is done in two ways, either it is built in-house or it is bought.

2.14.2.1 In-House Development

            2.14.2.1.1 Design the application architecture

Application architecture defines the technologies to be used by one or more or all information systems in terms of their data, processes, interfaces and network components. In DP Sign database like MySQL, SQL, Oracle, MySQL, etc were in use, I use MySQL. They use .net and PHP as the programming language and I prefer to use PHP language in website programming.

The physical data flow diagram is used to establish physical processes and location issues.

            2.14.2.1.2 Design the database(s)

The purpose of this task is to prepare technical design specifications for a database that will be adaptable to future requirements and expansion. System analyst also participates in the database modeling and the system designers are responsible for the completion of the activity as databases are shared resource.

The database schema is also structured.

            2.14.2.1.3 Design the system interface

In this, the system designer works with the system to develop input, output and dialogue specifications. For output, the terminal screen or the printed papers were used and for input, the data capture method is used.

System designers are responsible for the task and can use GUI (graphical user interface). For this, I have used Macromedia Dreamweaver and Phpmyadmin.

2.14.2.1.4 Package Design Specifications

The final design task involves packaging all the specifications from the previous design tasks into a set of specifications that will guide the computer programmer’s activities during the construction phase of the systems development methodology.

            2.14.2.1.5 Update the Project Plan

Revaluation of the project is done. The project manager in conjunction with system owners and the entire team facilitates this tas

2.14.2.2 Buy Solution

If the DP Sign is willing to buy the website from the outsider then following is done:

2.14.2.2.1 Identify and Research Specific Products

In this task, we research technical alternatives. The requirements specify the functionality, features and critical performance parameters for our new website. Research and information are collected from internal standards, information services, trade newspapers, and periodicals offer. System Designer with the help of a project manager is responsible to complete the task

            2.14.2.2.2 Solicit Proposals or Quotes from Vendors

The solicitation task requires the preparation of RFQ (Request for Quotations) and RFP (Request for proposal). Request for Quotations is a formal document that communicates business, technical and support requirements for the application software package to a single vendor that has been determined as being able to supply that application package and services.

Request for proposal is also a formal document that communicates business, technical and support requirements for an application software package to vendors that may wish to compete for the sale of that application package and services,

2.14.2.2.3 Select and recommend the best vendor.

The purpose of this task is to validate requests for proposals and/or quotations received from vendors. Designer involves in data and database administrators, network administrators and application administrators. The key outputs of this task are those vendor proposals that proved to be validated proposals or claims and others whose claims were not validated.

            2.14.2.2.4 Contract with the awarded vendor to obtain the product

Having ranked the vendor proposals the next activity usually includes presenting a recommendation to management for final approval. Salesmanship and communication skills are important. The purpose of this activity is to negotiate a contract with the vendor who supplied the winning proposal and to debrief the vendors that submitted losing proposals. A contract will be produced to the winning vendors.

2.14.2 Online Earning Department

2.14.2.1 Online Earning Training:

In this training, we were taught how we can earn money online without investing money. This training lasts for 15 days for normal computer operator and for advance the time period is less. Online earning can be done by different means in this global market. Some of them are:

2.14.2.1.1 Online earning through blogging:

Blog or Weblog is nothing but a personal website where you can express your personal views, ideas, feelings, etc. There are many sites such as Blogger, Typepad, Soul cast who provide blog services. You can earn online through Adsense. Here you have to place Adsense ads on your blog. You will earn whenever viewers click on the ads.

2.14.2.1.2 Online earning through Ad Typing:

Online earning by Ad typing is another unique job opportunity. All you have to need to post Ads on various Free Ad sites. There are tons of sites that provide Ad Typing jobs. Typeinternational is a very popular site. Typeinternational is providing nine different homes based earnings opportunities.

2.14.2.1.3 Online earning through Medical Transcription:

Medical Transcription is the fastest-growing field in health care. It is the process where you need accurately and swiftly transcribes medical records dictated by doctors and others, including medical history and physical reports, X-ray reports and pathology reports, etc. Good English pronunciation, typing skill and acquaintance with medical terminology are the basic need of the job. You can earn lots of money through Medical Transcription.

2.14.2.1.4 Online earning through the filling of Market Survey Forms:

Filling of Market Survey Forms is another popular online job opportunity. Thousands of consumer products are fighting to get a pie of the billions of consumers worldwide. You can earn by simply filling up of forms regarding a particular product of a company.

2.14.2.1.5 Top Pay per click (PPC) Business Sites

Some of the sites that pay per click are: Name of sitesName of sites
www.google.com/adsense
www.yahoo.com/overtrue
www.publisher.yahoo.com
www.search123.com
www.lycos.com
www.click-share.com
www.income-machine.com
www.bidvertiser.com
www.typeinternational.com
www.daily-payday.com

Tab: 2.4 Collection of PPC sites

2.14.2.1.6 Earn money by blog posting:

We are paid from these sites on posting our comments or posts. Some of the sites are:

SNName of sites
1  
2
3
4
5
www.technorati.com
www.digg.com
www.netscape.com
www.reddit.com
www.tailrank.com


2.15 Some of our major Clients:

SNName of ClientSNName of Client
1.Laxmi Bank2.Siddhartha Bank
3.Jyoti Bikash Bank4.Kathmandu Medical College
5.Advanced Imaging & Diagnostic Centre6.Beijing Duck Restaurant
7.Institute of Professional Excellence8.Bok Choy
9.Oral Dental Home10.Glamour
11.South Asia Commodities & Brokerage12Cosmopolitan
13Axis Broking Solution  

Tab: 2.5 List of major clients

2.16 Business Volume:

DP Sign was founded in 2007. So it is a newly entered company in the corporate world. But its sales figures are outstanding. The company has sales of over 10 million Nepali rupees in the financial year 2008-2009.

The overall sales volume is generated from three areas domestic, commercial and International. The prices of the products of the company range from Rs. 350(Domestic) to Rs. 1.5 million.

The Major portion of the revenue of DP Sign is Flex Printing, Online earning training, and website designing and programming.

The partition of sales to total sales graph is given below:

business volume of webocreation

Fig: 2.2 Business volume of DP Sign

According to the figures company’s 52% sales of Revenue is earned through website designing and programming, 11% of revenue is from online training, and 15% and 22% from online training and other sources respectively

Although DP Sign was founded in 2007 it remained successful in getting its share in the market in a very short time (2007-2009) and through it’s loyal, devoted, professional and hardworking management it is expected that the company will expand its sales to about 4 million during 2010-2011.

Besides that company has also earned impressive goodwill in the market through its quality services.

2.17 Products offered by DP Sign

2.17.1 Printing Services

SNMaterial TypeRateRemarks
1Printed backlit with box & light with fitting at site199.00p.sq.ft.Without vat
2Vinyl sticker cutting & pasting on backlit with box & light with fitting at site221.00p.sq.ft.Without vat
3Flex/ Frame & fitting at site38.00p.sq.ft.Without vat
4Mimaki Soljet print Normal vinyl50.00p.sq.ft.Without Vat
5Soljet vinyl print & pasting on  forex sheet95.00p.sq.ft.Without vat

Tab: 2.6 Printing product of DP Sign

2.17.2 Web services

SNWeb Service TypeRate
1.Domain RegistrationRs. 1000+
2.Web spaceAs per space requirement
3..np domain registrationFree
4.Website design and developmentAs per design and requirement
5.Open  Source CMS (joomla, word press, durpal, umbraco, tomato, mambo, hippo, nuxeo)As per design and requirement
6.Search Engine Optimization(twitter marketing, social marketing, facebook marketing, affiliation program)As per the design and requirement
7.Online Earning TrainingRs 1500+

Tab: 2.7 Web services providing by DP Sign

2.18 Time Frame of Internship

timeline internship project

Fig: 2.3 Time frame representation in Gantt chart

Chapter 3

Analysis

3.1 Strategic Business Unit’s Analysis

DP Sign has different strategic business units and management as DP Sign is well aware that how to use these units strategically. In order to fully analyze the business units of DP Sign that are web development, online earning training, and printing, I have used different analysis which not only gives the true picture of the company’s different unit but it also gives the depiction of the overall industry analysis in which company is currently working. There are four types of Analysis which I have performed in order to explore the working of the organization.

3.1.1Web Development department Analysis

3.1.2 Online Earning department Analysis

3.1.3 PEST Analysis

3.1.4 SWOT Analysis

3.1.5 Five S’s of Workplace Organization.

All these analyses have been performed by getting data from real-time industry situation as well as the organization. Research articles, news articles, internship reports, manuals are being used in order to effectively analyze the working of the organization. The historical data for the analysis has been taken or a maximum of 5-7 years back while current data until 2009 has been used.

3.1.1 Web Development department Analysis

Present status of Website development in DP Sign

Though the Website development in Nepal is developing and every year many companies are being registered but a professional person is lacking in our country. DP Sign is also facing the same problem so it is hiring professionals from other countries. Like other companies in Nepal, DP Sign is also lacking local customers as our country is lacking the knowledge to use technology and computers.

But the use of technology and website in Nepal is also increasing thus DP Sign also has to focus on the local customers. Even personal websites are taking a market so DP Sign should focus on this site by reducing the costs but increase the volume of sale which ultimately leads to an increase in the profit.

Schools, colleges, institutions, shopping center are increasing thus DP Sign should focus in this sector also. One of the lackings of the DP Sign is that it lacks advertisement.

DP Sign has to face competition from:

  • Strong local market
  • New entrants in the international market
  • Competition from existing customers
  • Economic recession

From a strong local market, the competition has been arising from a few companies. These companies are well renowned not only locally but also internationally. In these local companies, DP Sign has been facing competition at website development. At locally and internationally DP Sign is facing the competition as the number of companies is increasing. As economic recession is a period of recession and throughout the global world is suffering from the economic crisis, in such a scenario, there is an effect on website development also.

In the context of DP Sign, the market capture internationally is very low in the context of other website company so the company should focus on maintaining international customers.

3.1.2 Online Earning department Analysis

In the context of DP Sign Online Earning, training generates about 15% of the Revenue. So this is also one of the most important departments of DP Sign but DP Sign is not focusing on it.

The Internet in Nepal is increasing. Some businesses and people are eager to earn online by sitting at home and being bosses of themselves so online earning has also a potential market to earn.

But DP Sign is not focusing on this sector and I suggest them to make a website to unite their team and the exchange of click can be done so that everyone can get benefits.

3.1.3 PEST Analysis

PEST analysis is the analysis which we tend to perform in order to analyze the external as well as the internal environment in which the organization is currently working. PEST analysis revolves around four things.

  • Political Environment
  • Economic Environment
  • Social Environment
  • Technological Environment

Political Factors

There are many factors, which entice the organization with the Government.

  • Tax policy
  • Quota
  • Cyber Laws
  • Online transactions law
  • Labor policy

Economic Environment

Recession, devaluation of the currency and the policy of the government have an adverse effect on the economy.

Social Factors

Due to an increase in the education and technology sector, the educational power of the customers is increasing at a speedy rate. They are becoming aware of the brands and the latest technology. Due to this, they are demanding a high technological website at a low price in the international market.

Technological Factors

Technology is also a key sector in terms of the external environment for website development. The technology is working as a substitute for manpower with more efficiency. DP Sign has to focus on following

  • Error reduction
  • Less labor cost

DP Sign should have to focus on maintaining the harmony between the factors of PEST analysis so that it can progress in its life cycle.

3.1.4 SWOT Analysis

Performing SWOT analysis involves the generation and recording of the strengths, weaknesses, opportunities, and threats in relation to a particular task or objective.

Strengths

  • Strong and Prominent International Image
  • Latest Technology
  • Competitive Workforce
  • Creativity and Innovation
  • Management Information System
  • ISO Certified Company
  • Locally Working(Expenses in NRs but earning in Dollars)

Weaknesses

  • Individualism
  • Low Production capacity
  • No opportunity for Training and Development
  • Lack of teamwork
  • Lack of continuity of Policies
  • Too much Specialized Jobs

Opportunities

  • New Emerging Markets
  • Bright Local Market
  • New Cyber laws and Policies
  • Implementation of technology and websites in government sector

Threats

  • Non-supportive government
  • Government Policies
  • Growing Competition
  • Political uncertainties

3.1.5 5 S’s of Workplace Organization.

I recommend the DP Sign to follow the 5 S’s techniques to promote workplace organization, ensure adherence to standards and foster the spirit of continues improvement.

  • The 1st S: Sort

To get rid of unwanted items, things should be in the right place so that it can be gain ant the right time. Decide what is needed to be kept, and what is not needed and to be discarded.

  • The 2nd S: Set Location and Limits

To locate a specific place for specific items of a specific quantity, where needed. Determine addresses for materials and equipment. Put them in that place and keep them there.

  • The 3rd S: Shine and Sweep

Shine and sweep mean to use cleaning to identify abnormalities and areas for improvement. Clean the workplace and at the same time visually sweep for abnormalities or out or control conditions.

  • The 4th S: Standardize

To consolidate the first 3 S’s by establishing standard procedures. Determine the best work practices and find ways of ensuring everyone does it the same “best” way.

  • The 5th S: Sustain

Sustain improvements and make further improvements by encouraging effective use of the ‘Check-Act-Plan-Do’ cycles. Keep all current improvements in place and develop an environment for future improvements.

3.2 What I would improve or do differently if I had the opportunity:

  • I could be better organized, especially with regards to the paperwork required for capital purchases and expense reporting for business travel.
  • I could learn to manage my time better, planning parallel execution of some short-duration activities when long-running operational activities are occurring.
  • This would reduce personal idle time when waiting for long-duration activities to complete.

Chapter 4

Recommendations

There are few things which can be implemented and improvements can be made.

  1. There must be a career development opportunity for the employees so that they can work energetically in the organization as there is high turnover due to lack of information in the related sector.
  2. Remuneration System must help in motivation as a better remuneration package can do more in this highly competitive environment.
  3. The work environment at DP Sign is such that it does not encourage the staff to work effectively and I recommend that jobs should be such that the worker really enjoys what they are really doing.
  4. The staff as an individual is good but as a team is very bad, this thing should be overcome by promoting the team-based culture by the company.
  5. What I feel while working in DP Sign was that the top management is taking HRD as an expense rather than an investment as in the future the real capital or asset will be in the form of the workforce rather than monetary capital.
  6. In DP Sign there are uses of advance technology so the employee outside the world cannot cope easily with the internal environment so the socialization process should perform while recruiting the new employee.
  7. I suggest DP Sign to make a website to unite their online earning team and the exchange of click can be done so that everyone can get benefits.
  8. There are problems in web hosting services as the mail is sent to the scams sector so it should be maintained and the reliable up to date time is 98% only so the web hosting services should be changed.

Chapter 5

Conclusion

During my internship training at DP Sign, I have learned a lot and my vision and practical exposure have broadened very much from my three months internship. In the website development and online earning sector, DP Sign is contributing a lot and is using modern technology to take the company to new horizons and is moving as per its slogan “A strategic partner of our clients, not a mere vendor”.

I have carried out my responsibilities and duties in the field of website designing and online earning by which I am capable to design and program website and started to earn online.

After doing my internship it becomes clear to me that books are only dealing with the ideal situation while in the real world it is not so, and you have to face many problems particularly in programming and designing field in which you are dealing with codes and the behavior of software to handle them. Besides this, I just came across with abstract and the concepts developed with thorough study able to make a vague mental image while working in a real scenario.

Further, I also concluded that 100 percent concentration, full care, analytical, descriptive, knowledge and communication skills are the key prerequisites for working in the real world.

Anyhow, precisely speaking this internship of three months is a memorable period for me during which I availed the opportunity to flourish my communication skills, polish my capabilities and abilities, upgrade my knowledge about the latest technology and application tools and broaden my vision and exposure towards practical life.

This internship proves better for me in two way, on one side it helps to develop a personality in me which exactly match the professionalism in web development and secondly it helps to strengthen my decision about the specialization in web technology as my personality exactly match the nature of the job.

Chapter 6

PROGRAM WORKPLACE RELATIONSHIP

This project has proved to be very useful in putting the theoretical knowledge learned in college into practical knowledge. Through this project, the various subjects learned by us such as the principle of management, system analysis, and design, C programming, web technologies, Object-oriented languages, organizational behavior, and other programming have been put into use practically.

The subject matter of system analysis and design and other programming languages and web technologies learned theoretically were put into use in this project. Planning of the assignment, locating information sources, collecting and analyzing data, presenting charts and tables, programming, website designing and programming, understanding system and software as well as re-engineering them, etc. which are already studied by us in books was very helpful in putting it into practical experiences and preparing this project. The theoretical knowledge of web technologies, programming languages and managerial courses were helpful in carrying out the SWOT analysis, PEST analysis, and other analysis.

This program is very helpful in putting our theoretical knowledge into practical knowledge. All the subject matter studied by us in the previous semester was put into use while carrying out this project. Studying books is a different thing and going through all the things studied is different. This program has provided a platform to undergo real-life problems and experiences of business which will be fruitful to us in the coming years.

Bibliography

  1. Book References:
  1. Annual Report of DP Sign
  2. Operating Manuals of the DP Sign
  3. Publications of the DP Sign
  4. System Analysis and Design Methods, McGraw-Hill Companies
  5. Internship Report Management Information System, Prentice Hall
  6. Software Project Management by E.M. Bennaton Second Edition.
  7. Website References:
  1. dpsign.com.np
  2. google.com and other search engines to search
  3. scribd.com
  4. esnipps.com
  5. wikipedia.com (The encyclopedia)

APPENDICES

project delivery organization for large project

Fig: Sample Project Delivery Organization for a large project in DP Sign

in house development process internship

Fig: In-House Development process in DP SIGN

Like this, we are complete the full internship report to submit to the college.

Regarding the internship provision Internship letter

This post is regarding the internship provision internship letter, internship letter, cover letter, intern letter, letter of the internship.

17th Dec 2009

To,
The HR manager
Everest Bank Ltd
New Baneshwor, Kathmandu

Subject: Regarding the internship provision

Respected sir/madam,

As a potential intern, with required qualifications and a strong desire to excel in the banking profession, I am seeking to align myself as an intern with a company that ranks top at the global market and also offers an internship to undergraduates like me.
I am seeking a professional opportunity where my educational and other co-curricular experiences can benefit your company as well as lead me to my career goal and drive me along my career path.

I keep forth my kind request to consider my application for an internship at your bank for a period of six weeks which is a must for the course of BCIS(Bachelor in computer information system) under Pokhara University. As under the university norms, we are supposed to select the specialized subject in the final year and I have decided to take part in the IT sector. This opportunity will help me to explore more during my classes and learn more.

I assure you that I will strongly adhere to the bank norms and rules during my tenure as an intern and at any time in the future. I will also fulfill my responsibilities with utmost dedication if given any.

I wait for your positive response.

Thanking you.

Yours sincerely,
Rupak Nepali
BCIS 7th semester
Nobel College

internship letter, cover letter, intern letter, letter of internship

The solution to HOMEWORK 4.4 M101JS: MongoDB for Node.js Developers

HOMEWORK: HOMEWORK 4.4

In this problem, you will analyze a profile log taken from a MongoDB instance. To start, please download sysprofile.json from Download Handout link and import it with the following command:

mongoimport -d m101 -c profile < sysprofile.json

Now query the profile data, looking for all queries to the students’ collection in the databaseschool2, sorted in order of decreasing latency. What is the latency of the longest-running operation to the collection, in milliseconds?

hw4.4answer

  Answer: 15820

The solution to HOMEWORK 4.2 M101JS: MongoDB for Node.js Developers

HOMEWORK: HOMEWORK 4.2

Suppose you have a collection called tweets whose documents contain information about thecreated_at time of the tweet and the user’s followers_count at the time they issued the tweet. What can you infer from the following explain output?

> db.tweets.explain("executionStats").find({"user.followers_count":{$gt:1000}}).limit(10).skip(5000).sort( { created_at : 1 } )
{
    "queryPlanner" : {
        "plannerVersion" : 1,
        "namespace" : "twitter.tweets",
        "indexFilterSet" : false,
        "parsedQuery" : {
            "user.followers_count" : {
                "$gt" : 1000
            }
        },
        "winningPlan" : {
            "stage" : "LIMIT",
            "limitAmount" : 0,
            "inputStage" : {
                "stage" : "SKIP",
                "skipAmount" : 0,
                "inputStage" : {
                    "stage" : "FETCH",
                    "filter" : {
                        "user.followers_count" : {
                            "$gt" : 1000
                        }
                    },
                    "inputStage" : {
                        "stage" : "IXSCAN",
                        "keyPattern" : {
                            "created_at" : -1
                        },
                        "indexName" : "created_at_-1",
                        "isMultiKey" : false,
                        "direction" : "backward",
                        "indexBounds" : {
                            "created_at" : [
                                "[MinKey, MaxKey]"
                            ]
                        }
                    }
                }
            }
        },
        "rejectedPlans" : [ ]
    },
    "executionStats" : {
        "executionSuccess" : true,
        "nReturned" : 10,
        "executionTimeMillis" : 563,
        "totalKeysExamined" : 251120,
        "totalDocsExamined" : 251120,
        "executionStages" : {
            "stage" : "LIMIT",
            "nReturned" : 10,
            "executionTimeMillisEstimate" : 500,
            "works" : 251121,
            "advanced" : 10,
            "needTime" : 251110,
            "needFetch" : 0,
            "saveState" : 1961,
            "restoreState" : 1961,
            "isEOF" : 1,
            "invalidates" : 0,
            "limitAmount" : 0,
            "inputStage" : {
                "stage" : "SKIP",
                "nReturned" : 10,
                "executionTimeMillisEstimate" : 500,
                "works" : 251120,
                "advanced" : 10,
                "needTime" : 251110,
                "needFetch" : 0,
                "saveState" : 1961,
                "restoreState" : 1961,
                "isEOF" : 0,
                "invalidates" : 0,
                "skipAmount" : 0,
                "inputStage" : {
                    "stage" : "FETCH",
                    "filter" : {
                        "user.followers_count" : {
                            "$gt" : 1000
                        }
                    },
                    "nReturned" : 5010,
                    "executionTimeMillisEstimate" : 490,
                    "works" : 251120,
                    "advanced" : 5010,
                    "needTime" : 246110,
                    "needFetch" : 0,
                    "saveState" : 1961,
                    "restoreState" : 1961,
                    "isEOF" : 0,
                    "invalidates" : 0,
                    "docsExamined" : 251120,
                    "alreadyHasObj" : 0,
                    "inputStage" : {
                        "stage" : "IXSCAN",
                        "nReturned" : 251120,
                        "executionTimeMillisEstimate" : 100,
                        "works" : 251120,
                        "advanced" : 251120,
                        "needTime" : 0,
                        "needFetch" : 0,
                        "saveState" : 1961,
                        "restoreState" : 1961,
                        "isEOF" : 0,
                        "invalidates" : 0,
                        "keyPattern" : {
                            "created_at" : -1
                        },
                        "indexName" : "created_at_-1",
                        "isMultiKey" : false,
                        "direction" : "backward",
                        "indexBounds" : {
                            "created_at" : [
                                "[MinKey, MaxKey]"
                            ]
                        },
                        "keysExamined" : 251120,
                        "dupsTested" : 0,
                        "dupsDropped" : 0,
                        "seenInvalidated" : 0,
                        "matchTested" : 0
                    }
                }
            }
        }
    },
    "serverInfo" : {
        "host" : "generic-name.local",
        "port" : 27017,
        "version" : "3.0.1",
        "gitVersion" : "534b5a3f9d10f00cd27737fbcd951032248b5952"
    },
    "ok" : 1
}

Solution:
The query uses an index to determine the order in which to return result documents
The query examines 251120 documents.

hw4.2answer

Answer for Homework 2.1 M101JS Courseware

HOMEWORK: HOMEWORK 2.1

In this problem, you will be using an old weather dataset. Download weather_data.csv from the Download Handout link. This is a comma separated value file that you can import into MongoDB as follows:

mongoimport –type csv –headerline weather_data.csv -d weather -c data

You can verify that you’ve imported the data correctly by running the following commands in the mongo shell:

> use weather
> db.data.find().count()
> 2963

Reading clockwise from true north, the wind direction is measured by degrees around the compass up to 360 degrees.

90 is East

180 is South

270 is West

360 is North

Your assignment is to figure out the “State” that recorded the lowest “Temperature” when the wind was coming from the west (“Wind Direction” between 180 and 360). Please enter the name of the state that meets this requirement. Do not include the surrounding quotes in providing your answer.

Answer is:
New Mexico

Write New Mexico and submit.

If you need query then following is the query to retrieve the data

db.data.find({"Wind Direction":{$gte:180,$lte:360}}, {"State":true,"Temperature":true, "_id":false, "Wind Direction":true}).sort({"Temperature":1})

 

Steps to create custom URL to work locally Xampp localhost virtual host

Steps to create a custom URL to work locally:

If you had installed Xampp in D:/ folder then follow the following steps, if you have installed in C:/ or another folder then replace D with respective folder name.

  • Open up the Xampp control panel and stop Apache (Ensure that you don’t have it running as a service.
  • Navigate to D:/xampp/apache/conf/extra or wherever you installed Xampp
  • Open up your text editor with administrative privileges and open up httpd-vhosts.conf found in the D:/xampp/apache/conf/extra folder
  • At the very bottom of the file paste the following (check if it exists there already) <VirtualHost *:80> DocumentRoot “D:/xampp/htdocs” ServerName localhost </VirtualHost>
  • Without that line of code, you will lose access to your default htdocs/ For eg: http://localhost/ will be inaccessible.
  • Now copy and paste the code below: <VirtualHost *:80> DocumentRoot “D:/xampp/htdocs/webocreation” ServerName webocreation.dev ServerAlias www.webocreation.dev <Directory “D:/xampp/htdocs/webocreation”> AllowOverride All Require all Granted </Directory> </VirtualHost>
  • Now we head over to our Windows Hosts File, to edit the HOSTS. File will be located at C:/Windows/System32/drivers/etc/hosts, where hosts is the file. 127.0.0.1             localhost
  • Look for the line above and enter your site mimicking the layout 127.0.0.1             localhost 127.0.0.1             webocreation.dev
  • Change this to the domain name you choose earlier
  • Change it to reflect the lines above (if you have problems saving it meant you didn’t have your text editor running in admin mode.
  • Restart Apache and test to make sure it is working.
  • Go to the URL

Limit number of sub-categories to show at OpenCart 2

It is not recommended to change the default files of OpenCart as if you upgrade then all changes will be lost so we have seen one solution to achieve your requirement by changing the header.tpl. Open catalog/view/theme/YOUR_THEME/template/common/header.tpl
Find the following lines of code:

<?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
              <ul class="list-unstyled">
                <?php foreach ($children as $child) { ?>
                <li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
                <?php } ?>
              </ul>
              <?php } ?>

And replace with following lines of code:

<ul class="list-unstyled">
  <?php foreach ($category['children'] as $key=>$child) { ?>
  <?php if($key<5){ ?>
  <li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
  <?php } ?>
  <?php } ?>
</ul>

With this change, there will be only one column.

For many sub-categories, you can make multiple columns of sub-categories in OpenCart.
While inserting the category, in the data tab, insert the “Columns” value to show multiple columns. You can see examples of the “MP3 Players” category and its sub-categories in the default installation.

limit-sub-categories-opencart-menu


Coming soon products opencart free module

Products to show without the add to cart button, another Opencart free module “Coming Soon Products module  OpenCart version 2.0”. When you enabled this module, you will be able to see the products which available date is greater than today.

The module will look like below:

coming soon opencart module

Admin section will look like:

future products opencart module

Download Coming Soon Future Products free module from the link below:

Download Coming Soon Future Products free Module

Installation:

  1. Unzip the downloaded folder.
  2. Upload the files in the root folder to your server, no file is overwritten.
  3. Then activate the “Future Products” module.

Activating the “Future Products” module:

  1. After uploading files to servers, it’s time to install the “Future Products” module
  2. We are showing the “Future Products” module at the right column of the Category page (Category Layout) but you can show it wherever you like as this acts as a normal module.
  3. Go to Admin section
  4. Then click on Extensions on the left menu
  5. After that Click Modules and go to “Future Products” in the modules list
  6. Then click the Green button for the “Future Products” to install the module (see the image below)
  7. Then click the blue edit button
  8. After that, you will see the form which has the status field, select “Enabled” and then click the Save button.
  9. Your module is active and is ready to use in the layout.

Setup layout for the sidebar “Future Products” module at the right column of the home page:

  1. From the admin section go to System >> Design >> Layouts.
  2. You will see a list of layouts, from which edit the Home layout.
  3. Then click Blue add the button to add rows at module section which is shown in the image below:
  4. Second, you choose the “Future Products” in the module column and Column right in the Position column and insert the sort order as required.
  5. Then click save button

Your custom home page is ready with the “Future Products” module in the right column. Likewise, you can show in many other layouts and pages.

Codes of “Future Products” modules of the presentation layer’s controller:

Go to catalog/controller/module/futureproducts.php

<?php
class ControllerModuleFutureProducts extends Controller {
   public function index($setting) {
      $this->load->language('module/futureproducts');
      $data['heading_title'] = $setting['name'];
      $data['text_tax'] = $this->language->get('text_tax');
      $data['button_cart'] = $this->language->get('button_cart');
      $data['button_wishlist'] = $this->language->get('button_wishlist');
      $data['button_compare'] = $this->language->get('button_compare');
      $this->load->model('catalog/product');
      $this->load->model('catalog/futureproducts');
      $this->load->model('tool/image');

      $data['products'] = array();
      $filter_data = array(
         'sort'  => 'p.date_added',
         'order' => 'DESC',
         'start' => 0,
         'limit' => $setting['limit']
      );

      $results = $this->model_catalog_futureproducts->getProducts($filter_data);
      if ($results) {
         foreach ($results as $result) {
            if ($result['image']) {
               $image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
            } else {
               $image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
            }
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
               $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
               $price = false;
            }
            if ((float)$result['special']) {
               $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
               $special = false;
            }
            if ($this->config->get('config_tax')) {
               $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price']);
            } else {
               $tax = false;
            }
            if ($this->config->get('config_review_status')) {
               $rating = $result['rating'];
            } else {
               $rating = false;
            }
            $data['products'][] = array(
               'product_id'  => $result['product_id'],
               'thumb'       => $image,
               'name'        => $result['name'],
               'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
               'price'       => $price,
               'special'     => $special,
               'tax'         => $tax,
               'rating'      => $rating,
               'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id']),
            );
         }
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/futureproducts.tpl')) {
            return $this->load->view($this->config->get('config_template') . '/template/module/futureproducts.tpl', $data);
         } else {
            return $this->load->view('default/template/module/futureproducts.tpl', $data);
         }
      }
   }
}

Codes of “Future Products” modules of the presentation layer’s language file:

Go to catalog/language/english/module/futureproducts.php

<?php
// Heading
$_['heading_title'] = 'Future Products';
// Text
$_['text_tax']      = 'Ex Tax:';

Codes of “Account Login” modules of the presentation layer’s template file:

Go to catalog/view/theme/default/module/futureproducts.tpl

<h3><?php echo $heading_title; ?></h3>
<div class="row">
  <?php foreach ($products as $product) { ?>
  <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
    <div class="product-thumb transition">
      <div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></div>
      <div class="caption">
        <h4><?php echo $product['name']; ?></h4>
        <p><?php echo $product['description']; ?></p>
        <?php if ($product['rating']) { ?>
        <div class="rating">
          <?php for ($i = 1; $i <= 5; $i++) { ?>
          <?php if ($product['rating'] < $i) { ?>
          <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
          <?php } else { ?>
          <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
          <?php } ?>
          <?php } ?>
        </div>
        <?php } ?>
        <?php if ($product['price']) { ?>
        <p class="price">
          <?php if (!$product['special']) { ?>
          <?php echo $product['price']; ?>
          <?php } else { ?>
          <span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
          <?php } ?>
          <?php if ($product['tax']) { ?>
          <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
          <?php } ?>
        </p>
        <?php } ?>
      </div>

    </div>
  </div>
  <?php } ?>
</div>

Similarly, in the admin section, we have three files for the module

  1. admin/controller/module/futureproducts.php
  2. admin/language/english/module/futureproducts.php
  3. admin/view/template/module/futureproducts.tpl

Codes of “Future Products” modules of the admin layer’s  controller file:

Go to admin/controller/module/futureproducts.php

<?php
class ControllerModuleFutureProducts extends Controller {
   private $error = array();
   public function index() {
      $this->load->language('module/futureproducts');
      $this->document->setTitle($this->language->get('heading_title'));
      $this->load->model('extension/module');
      if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
         if (!isset($this->request->get['module_id'])) {
            $this->model_extension_module->addModule('futureproducts', $this->request->post);
         } else {
            $this->model_extension_module->editModule($this->request->get['module_id'], $this->request->post);
         }
         $this->cache->delete('product');
         $this->session->data['success'] = $this->language->get('text_success');
         $this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
      }
      $data['heading_title'] = $this->language->get('heading_title');
      $data['text_edit'] = $this->language->get('text_edit');
      $data['text_enabled'] = $this->language->get('text_enabled');
      $data['text_disabled'] = $this->language->get('text_disabled');
      $data['entry_name'] = $this->language->get('entry_name');
      $data['entry_limit'] = $this->language->get('entry_limit');
      $data['entry_width'] = $this->language->get('entry_width');
      $data['entry_height'] = $this->language->get('entry_height');
      $data['entry_status'] = $this->language->get('entry_status');
      $data['button_save'] = $this->language->get('button_save');
      $data['button_cancel'] = $this->language->get('button_cancel');
      if (isset($this->error['warning'])) {
         $data['error_warning'] = $this->error['warning'];
      } else {
         $data['error_warning'] = '';
      }
      if (isset($this->error['name'])) {
         $data['error_name'] = $this->error['name'];
      } else {
         $data['error_name'] = '';
      }
      if (isset($this->error['width'])) {
         $data['error_width'] = $this->error['width'];
      } else {
         $data['error_width'] = '';
      }
      if (isset($this->error['height'])) {
         $data['error_height'] = $this->error['height'];
      } else {
         $data['error_height'] = '';
      }
      $data['breadcrumbs'] = array();
      $data['breadcrumbs'][] = array(
         'text' => $this->language->get('text_home'),
         'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
      );
      $data['breadcrumbs'][] = array(
         'text' => $this->language->get('text_module'),
         'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL')
      );
      if (!isset($this->request->get['module_id'])) {
         $data['breadcrumbs'][] = array(
            'text' => $this->language->get('heading_title'),
            'href' => $this->url->link('module/futureproducts', 'token=' . $this->session->data['token'], 'SSL')
         );
      } else {
         $data['breadcrumbs'][] = array(
            'text' => $this->language->get('heading_title'),
            'href' => $this->url->link('module/futureproducts', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL')
         );
      }
      if (!isset($this->request->get['module_id'])) {
         $data['action'] = $this->url->link('module/futureproducts', 'token=' . $this->session->data['token'], 'SSL');
      } else {
         $data['action'] = $this->url->link('module/futureproducts', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL');
      }
      $data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
      if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
         $module_info = $this->model_extension_module->getModule($this->request->get['module_id']);
      }
      if (isset($this->request->post['name'])) {
         $data['name'] = $this->request->post['name'];
      } elseif (!empty($module_info)) {
         $data['name'] = $module_info['name'];
      } else {
         $data['name'] = '';
      }
      if (isset($this->request->post['limit'])) {
         $data['limit'] = $this->request->post['limit'];
      } elseif (!empty($module_info)) {
         $data['limit'] = $module_info['limit'];
      } else {
         $data['limit'] = 5;
      }
      if (isset($this->request->post['width'])) {
         $data['width'] = $this->request->post['width'];
      } elseif (!empty($module_info)) {
         $data['width'] = $module_info['width'];
      } else {
         $data['width'] = 200;
      }
      if (isset($this->request->post['height'])) {
         $data['height'] = $this->request->post['height'];
      } elseif (!empty($module_info)) {
         $data['height'] = $module_info['height'];
      } else {
         $data['height'] = 200;
      }
      if (isset($this->request->post['status'])) {
         $data['status'] = $this->request->post['status'];
      } elseif (!empty($module_info)) {
         $data['status'] = $module_info['status'];
      } else {
         $data['status'] = '';
      }
      $data['header'] = $this->load->controller('common/header');
      $data['column_left'] = $this->load->controller('common/column_left');
      $data['footer'] = $this->load->controller('common/footer');
      $this->response->setOutput($this->load->view('module/futureproducts.tpl', $data));
   }
   protected function validate() {
      if (!$this->user->hasPermission('modify', 'module/futureproducts')) {
         $this->error['warning'] = $this->language->get('error_permission');
      }
      if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {
         $this->error['name'] = $this->language->get('error_name');
      }
      if (!$this->request->post['width']) {
         $this->error['width'] = $this->language->get('error_width');
      }
      if (!$this->request->post['height']) {
         $this->error['height'] = $this->language->get('error_height');
      }
      return !$this->error;
   }
}

Codes of “Future Products” modules of the admin layer’s language file:

Go to admin/language/english/module/futureproducts.php

<?php
// Heading
$_['heading_title']    = 'Future Products';
// Text
$_['text_module']      = 'Modules';
$_['text_success']     = 'Success: You have modified Future Products module!';
$_['text_edit']        = 'Edit Future Products Module';
// Entry
$_['entry_name']       = 'Module Name';
$_['entry_limit']      = 'Limit';
$_['entry_image']      = 'Image (W x H) and Resize Type';
$_['entry_width']      = 'Width';
$_['entry_height']     = 'Height';
$_['entry_status']     = 'Status';
// Error
$_['error_permission'] = 'Warning: You do not have permission to modify Future Products module!';
$_['error_name']       = 'Module Name must be between 3 and 64 characters!';
$_['error_width']      = 'Width required!';
$_['error_height']     = 'Height required!';

Codes of “Account Login” modules of the admin layer’s template file:

Go to admin/view/module/futureproducts.tpl

<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-bestseller" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
      <h1><?php echo $heading_title; ?></h1>
      <ul class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
        <?php } ?>
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    <?php if ($error_warning) { ?>
    <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    <?php } ?>
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3>
      </div>
      <div class="panel-body">
        <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-bestseller" class="form-horizontal">
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-name"><?php echo $entry_name; ?></label>
            <div class="col-sm-10">
              <input type="text" name="name" value="<?php echo $name; ?>" placeholder="<?php echo $entry_name; ?>" id="input-name" class="form-control" />
              <?php if ($error_name) { ?>
              <div class="text-danger"><?php echo $error_name; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-limit"><?php echo $entry_limit; ?></label>
            <div class="col-sm-10">
              <input type="text" name="limit" value="<?php echo $limit; ?>" placeholder="<?php echo $entry_limit; ?>" id="input-limit" class="form-control" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-width"><?php echo $entry_width; ?></label>
            <div class="col-sm-10">
              <input type="text" name="width" value="<?php echo $width; ?>" placeholder="<?php echo $entry_width; ?>" id="input-width" class="form-control" />
              <?php if ($error_width) { ?>
              <div class="text-danger"><?php echo $error_width; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-height"><?php echo $entry_height; ?></label>
            <div class="col-sm-10">
              <input type="text" name="height" value="<?php echo $height; ?>" placeholder="<?php echo $entry_height; ?>" id="input-height" class="form-control" />
              <?php if ($error_height) { ?>
              <div class="text-danger"><?php echo $error_height; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-status"><?php echo $entry_status; ?></label>
            <div class="col-sm-10">
              <select name="status" id="input-status" class="form-control">
                <?php if ($status) { ?>
                <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                <option value="0"><?php echo $text_disabled; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_enabled; ?></option>
                <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                <?php } ?>
              </select>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
<?php echo $footer; ?>

Please let us know if you have any questions or concerns. Please don’t forget to post your questions or comments so that we can add extra topics and Opencart free module. You can follow us at our twitter account @rupaknpl and subscribe to our YouTube channel for opencart tutorials.

Drupal Select Node by EntityFieldQuery by translate language

While working as drupal developer in multi language Drupal 7 site you may find EntityFieldQuery class which allows finding entities based on entity properties and keep on getting confused with the propertyCondition and entityCondition for language translation.

Below example of entity field query helps me to find node main language specific featured blog post and

  global $language;
  $query = new EntityFieldQuery;
  $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', $bundletype)
      ->propertyCondition('status', NODE_PUBLISHED) // in case you need it
      ->propertyCondition('language', $language->language)
      ->fieldCondition('field_featured_blog', 'value', '1', "=")
      ->propertyOrderBy('changed', 'DESC')
      ->range(0,1);
  $query->execute();

Below will find data as per the translated entity based language featured blog.

  global $language;
  $query = new EntityFieldQuery;
  $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', $bundletype)
      ->propertyCondition('status', NODE_PUBLISHED)
      ->entityCondition('language', $language->language)
      ->fieldCondition('field_featured_blog','value', '1', "=")
      ->propertyOrderBy('created', 'DESC');
  $query->execute();

Drupal EntityFieldQuery by language

When you do print_r($query), then you will get following:

EntityFieldQuery Object
(
    [altered] => 1
    [entityConditions] => Array
        (
            [entity_type] => Array
                (
                    [value] => node
                    [operator] => =
                )

            [bundle] => Array
                (
                    [value] =>
                    [operator] => 
                )

            [language] => Array
                (
                    [value] => en
                    [operator] => =
                )

        )

    [fieldConditions] => Array
        (
            [0] => Array
                (
                    [field] => Array
                        (
                            [translatable] => 1
                            [entity_types] => Array
                                (
                                )

                            [settings] => Array
                                (
                                    [allowed_values] => Array
                                        (
                                            [0] => 
                                            [1] => 
                                        )

                                    [allowed_values_function] => 
                                    [entity_translation_sync] => 
                                )

                            [storage] => Array
                                (
                                    [type] => field_sql_storage
                                    [settings] => Array
                                        (
                                        )

                                    [module] => field_sql_storage
                                    [active] => 1
                                    [details] => Array
                                        (
                                            [sql] => Array
                                                (
                                                    [FIELD_LOAD_CURRENT] => Array
                                                        (
                                                            [field_data_field_featured_blog] => Array
                                                                (
                                                                    [value] => field_featured_blog_value
                                                                )

                                                        )

                                                    [FIELD_LOAD_REVISION] => Array
                                                        (
                                                            [field_revision_field_featured_blog] => Array
                                                                (
                                                                    [value] => field_featured_blog_value
                                                                )

                                                        )

                                                )

                                        )

                                )

                            [foreign keys] => Array
                                (
                                )

                            [indexes] => Array
                                (
                                    [value] => Array
                                        (
                                            [0] => value
                                        )

                                )

                            [id] => 260
                            [field_name] => field_featured_blog
                            [type] => list_boolean
                            [module] => list
                            [active] => 1
                            [locked] => 0
                            [cardinality] => 1
                            [deleted] => 0
                            [columns] => Array
                                (
                                    [value] => Array
                                        (
                                            [type] => int
                                            [not null] => 
                                        )

                                )

                            [bundles] => Array
                                (
                                    [node] => Array
                                        (
                                            [0] => 
                                            [1] => 
                                        )

                                )

                        )

                    [column] => value
                    [value] => 1
                    [operator] => =
                    [delta_group] => 
                    [language_group] => 
                )

        )

    [fieldMetaConditions] => Array
        (
        )

    [propertyConditions] => Array
        (
            [0] => Array
                (
                    [column] =>
                    [value] => 1
                    [operator] => 
                )

        )

    [order] => Array
        (
            [0] => Array
                (
                    [type] => property
                    [specifier] =>
                    [direction] => DESC
                )

        )

    [range] => Array
        (
        )

    [pager] => Array
        (
        )

    [deleted] => 
    [fields] => Array
        (
            [0] => Array
                (
                    [translatable] => 1
                    [entity_types] => Array
                        (
                        )

                    [settings] => Array
                        (
                            [allowed_values] => Array
                                (
                                    [0] => 
                                    [1] => 
                                )

                            [allowed_values_function] => 
                            [entity_translation_sync] => 
                        )

                    [storage] => Array
                        (
                            [type] => field_sql_storage
                            [settings] => Array
                                (
                                )

                            [module] => field_sql_storage
                            [active] => 1
                            [details] => Array
                                (
                                    [sql] => Array
                                        (
                                            [FIELD_LOAD_CURRENT] => Array
                                                (
                                                    [field_data_field_featured_blog] => Array
                                                        (
                                                            [value] => field_featured_blog_value
                                                        )

                                                )

                                            [FIELD_LOAD_REVISION] => Array
                                                (
                                                    [field_revision_field_featured_blog] => Array
                                                        (
                                                            [value] => field_featured_blog_value
                                                        )

                                                )

                                        )

                                )

                        )

                    [foreign keys] => Array
                        (
                        )

                    [indexes] => Array
                        (
                            [value] => Array
                                (
                                    [0] => value
                                )

                        )

                    [id] => 260
                    [field_name] => field_featured_blog
                    [type] => list_boolean
                    [module] => list
                    [active] => 1
                    [locked] => 0
                    [cardinality] => 1
                    [deleted] => 0
                    [columns] => Array
                        (
                            [value] => Array
                                (
                                    [type] => int
                                    [not null] => 
                                )

                        )

                    [bundles] => Array
                        (
                            [node] => Array
                                (
                                    [0] =>
                                    [1] =>
                                )

                        )

                )

        )

    [count] => 
    [age] => FIELD_LOAD_CURRENT
    [tags] => Array
        (
        )

    [metaData] => Array
        (
        )

    [orderedResults] => Array
        (
        )

    [executeCallback] => 
)

Full details of EntityFieldQuery at:
https://api.drupal.org/api/drupal/includes%21entity.inc/class/EntityFieldQuery/7.x

The function defaults to either = or IN depending on the value param as an array or string.
https://api.drupal.org/api/drupal/includes%21entity.inc/function/EntityFieldQuery%3A%3ApropertyCondition/7.x

 

 

Convert node id to full redirect url in drupal

Convert node id to full redirect url in drupal

$link=url(drupal_get_path_alias('node/nodeid', array('absolute' => TRUE));
echo $link;

In above code node/nodeid need to be something like node/1 or so.

Line Delimited JSON (LDJ) protocol

The protocol that use newlines to separate messages, we’ll call this protocol Line Delimited JSON (LDJ). There are no line breaks in JSON messages. Although JSON is whitespace agnostic it ignores whitespace outside of string value.

Serializing Messages with JSON

Let’s develop the message-passing protocol that uses JSON to serialize messages. Each message is a JSON-serialized object, which is a hash of key-value pairs. Here’s an example JSON object with two key-value pairs:

{"key":"value","anotherKey":"anotherValue"}

The net-watcher service we’ve been developing in this chapter sends two kinds of messages that we need to convert to JSON:
When the connection is first established, the client receives the string
Now watching target.txt for changes…
Whenever the target file changes, the client receives a string like this: File “target.txt” changed: Sat Jan 12, 2013, 12:35:52 GMT-0500 (EST)
We’ll encode the first kind of message this way:

{"type":"watching","file":"target.txt"}

The type field indicates that this is a watching message the specified file is now being watched.
The second type of message is encoded this way:

{"type":"changed","file":"target.txt","timestamp":1358175733785}

Here the type field announces that the target file has changed. The timestamp field contains an integer value representing the number of milliseconds since midnight, January 1, 1970. This happens to be an easy time format to work within JavaScript. For example, you can get the current time in this format with Date.now().

To relieve the client program from the danger of split JSON messages, we’ll implement Line Delimited JSON (LDJ) buffering client module. Then we’ll incorporate it into the network-watcher client.

First, let’s have a look at how the Node does inheritance. The following code sets up LDJClientto inherit from EventEmitter.

const
    events=require('events'),
    util=require('util'),
    //clientconstructor
    LDJClient=function(stream){
        events.EventEmitter.call(this);
    };
util.inherits(LDJClient,events.EventEmitter);

LDJClient is a constructor function, which means other code should call new LDJClient(stream) to get an instance. The stream parameter is an object that emits data events, such as a Socket connection. Inside the constructor function, we call the EventEmitter constructor on this. That line of code is roughly equivalent to calling super() in languages with classical inheritance.

Finally, we call util.inherits() to make LDJClient’s prototypal parent object the EventEmitterprototype. If this sounds cryptic to you, don’t worry. It’s like saying classLDJClientinherits from EventEmitter in languages with a classical inheritance model. It means that if you look for a property on an LDJClientand it’s not there, the EventEmitteris the next place to look

Exporting Functionality in a Module
Let’s pull together the previous code samples and expose LDJClientas a module. Open a text editor and insert the following: /ldj.js

"usestrict";
const
    events=require('events'),
    util=require('util'),
//clientconstructor
    LDJClient=function(stream){
        events.EventEmitter.call(this);
        let
            self=this,
            buffer='';
        stream.on('data',function(data){
            buffer+=data;
            letboundary=buffer.indexOf('\n');
            while(boundary!==-1){
                letinput=buffer.substr(0,boundary);
                buffer=buffer.substr(boundary+1);
                self.emit('message',JSON.parse(input));
                boundary=buffer.indexOf('\n');
            }
        });
    };
report erratum •discuss
Extending Core Classes in Custom Modules • 37
www.it-ebooks.info
util.inherits(LDJClient,events.EventEmitter);
//exposemodulemethods
exports.LDJClient=LDJClient;
exports.connect=function(stream){
    returnnewLDJClient(stream);
};

To create an LDJClientinstance.
Code to use the LDJ module will look something like this:

const
    ldj=require('./ldj.js'),
    client=ldj.connect(networkStream);
client.on('message',function(message){
    //takeactionforthismessage
});

Account login module for free OpenCart version 2.0

“Account login module for free OpenCart version 2.0” is another opencart free extensions when it is enabled you will be able to see the login form only when the customer is not logged in and if the customer is logged in then the form will be replaced with account links.

When the customer is not logged in you will see a form like this:

account login form display

When logged in it will be seen the link the image below:

account login form display
account_login_form_display

Download Account Login Form display free module from the link below:

Download Account Login Show as Module OpenCart free module

Installation:

  1. Unzip the downloaded folder.
  2. Upload the files in the root folder to your server, no file is overwritten.
  3. Then activate the “Account Login” module.

Activating the “Account Login” module:

  1. After uploading files to servers, it’s time to install the “Account Login” module
  2. We are showing the “Account Login” module at the right column of the Home page (Home Layout) but you can show it wherever you like as this acts as a normal module.
  3. Go to Admin section
  4. Then click on Extensions on the left menu
  5. After that Click Modules and go to “Account Login” in the modules list
  6. Then click the Green button for the “Account Login” to install the module (see the image below)installation_of_module
  7. Then click the blue edit button
  8. After that, you will see the form which has the status field, select “Enabled” and then click the Save button.
  9. Your module is active and is ready to use in the layout.

Setup layout for the sidebar “Account Login” module at the right column of home page:

  1. From the admin section go to System >> Design >> Layouts.
  2. You will see a list of layouts, from which edit the “Home” layout.
  3. Then click Blue add the button to add rows at the module section which is shown in the image below:
    siderbar_shopping_cart_installation
  4. Second, you choose the “Account Login” in the module column and Column right in the Position column and insert the sort order as required.
  5. Then click save button

Your custom home page is ready with the “Account Login” module in the right column. Likewise, you can show in many other layouts and pages.

Codes of “Account Login” modules of the presentation layer’s controller:

Go to catalog/controller/module/accountlogin.php

<?php
class ControllerModuleAccountlogin extends Controller {
	public function index() {
		$this->load->language('module/accountlogin');

		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_register'] = $this->language->get('text_register');
		$data['text_login'] = $this->language->get('text_login');
		$data['text_logout'] = $this->language->get('text_logout');
		$data['text_forgotten'] = $this->language->get('text_forgotten');
		$data['text_accountlogin'] = $this->language->get('text_accountlogin');
		$data['text_account'] = $this->language->get('text_account');
		$data['text_edit'] = $this->language->get('text_edit');
		$data['text_password'] = $this->language->get('text_password');
		$data['text_address'] = $this->language->get('text_address');
		$data['text_wishlist'] = $this->language->get('text_wishlist');
		$data['text_order'] = $this->language->get('text_order');
		$data['text_download'] = $this->language->get('text_download');
		$data['text_reward'] = $this->language->get('text_reward');
		$data['text_return'] = $this->language->get('text_return');
		$data['text_transaction'] = $this->language->get('text_transaction');
		$data['text_newsletter'] = $this->language->get('text_newsletter');
		$data['text_recurring'] = $this->language->get('text_recurring');

		$data['logged'] = $this->customer->isLogged();
		$data['register'] = $this->url->link('account/register', '', 'SSL');
		$data['login'] = $this->url->link('account/login', '', 'SSL');
		$data['logout'] = $this->url->link('account/logout', '', 'SSL');
		$data['forgotten'] = $this->url->link('account/forgotten', '', 'SSL');
		$data['accountlogin'] = $this->url->link('account/account', '', 'SSL');
		$data['account'] = $this->url->link('account/account', '', 'SSL');
		$data['edit'] = $this->url->link('account/edit', '', 'SSL');
		$data['password'] = $this->url->link('account/password', '', 'SSL');
		$data['address'] = $this->url->link('account/address', '', 'SSL');
		$data['wishlist'] = $this->url->link('account/wishlist');
		$data['order'] = $this->url->link('account/order', '', 'SSL');
		$data['download'] = $this->url->link('account/download', '', 'SSL');
		$data['reward'] = $this->url->link('account/reward', '', 'SSL');
		$data['return'] = $this->url->link('account/return', '', 'SSL');
		$data['transaction'] = $this->url->link('account/transaction', '', 'SSL');
		$data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL');
		$data['recurring'] = $this->url->link('account/recurring', '', 'SSL');

		$data['email'] = $this->language->get('email');
		$data['returningcustomer'] = $this->language->get('returningcustomer');
		$data['password'] = $this->language->get('password');
		$data['forget'] = $this->language->get('forget');
		$data['register'] = $this->language->get('register');

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/accountlogin.tpl')) {
			return $this->load->view($this->config->get('config_template') . '/template/module/accountlogin.tpl', $data);
		} else {
			return $this->load->view('default/template/module/accountlogin.tpl', $data);
		}
	}
}

Codes of “Account Login” modules of the presentation layer’s language file:

Go to catalog/language/english/module/accountlogin.php

<?php
// Heading
$_['heading_title']    = 'Account Login';

// Text
$_['text_register']    = 'Register';
$_['text_login']       = 'Login';
$_['text_logout']      = 'Logout';
$_['text_forgotten']   = 'Forgotten Password';
$_['text_account']     = 'My Account';
$_['text_edit']        = 'Edit Account';
$_['text_password']    = 'Password';
$_['text_address']     = 'Address Book';
$_['text_wishlist']    = 'Wish List';
$_['text_order']       = 'Order History';
$_['text_download']    = 'Downloads';
$_['text_reward']      = 'Reward Points';
$_['text_return']      = 'Returns';
$_['text_transaction'] = 'Transactions';
$_['text_newsletter']  = 'Newsletter';
$_['text_recurring']   = 'Recurring payments';

$_['email']            = 'E-mail';
$_['returningcustomer']= 'Returning Customer';
$_['password']         = 'Password';
$_['forget']           = 'Forgotten Password?';
$_['register']         = 'Register New Account?';

Codes of “Account Login” modules of the presentation layer’s template file:

Go to catalog/view/theme/default/module/accountlogin.php

<?php if(!$logged){ ?>
<div class="col-sm-12">
  <div class="well">
    <p><strong><?php echo $returningcustomer; ?></strong></p>
    <form action="index.php?route=account/login" method="post" enctype="multipart/form-data">
      <div class="form-group">
        <label class="control-label" for="input-email"><?php echo $email; ?></label>
        <input type="text" name="email" value="" placeholder="<?php echo $email; ?>" id="input-email" class="form-control" autocomplete="off" style="cursor: auto; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QsPDiEFu6xIcAAAAXhJREFUOMvNk8FLVFEUxn/ffRdmIAla1CbBFDGCpoiQWYlBLty7UHAvEq2HYLhveDMws2/TIly6E9SdIEj+AVYgRaTgXhe2C968x2nhTOjow8pNZ/ede/ide893Lvx3UavVhkMIk30dQqiGECpF9e68CCG8LpfL3yStAAIk6Z2kT3Ect68C+AGdSroFVEII82aWSXoGYGYHVwE0qOM43pU0BXw3s1zSI2AnSZKXhYB6vT7inLvd7XZ/eu8fOOe2JEW9zjkwZ2bHkoayLDtpt9ufLzzBe/8GWC6VSpc7nIE2pLPLeu/fA0uDQ3T/6pp6039uZnfN7Ieke1EUrQOu3/VawPloNBrbwIyZ7TvnLvg/+mKOJ3xk88NR4R4sADM92fp9MDRMdXaRxenHVMbuFy8SMAFkZval2Wyu9ZN3Hk4zWx0nAtKsWwxotVrNNE2f5nn+CrB+/nRvlSR5y2EK0TWbSKfT+fo3Lribfr4bA/yfl56y2kkuZX8BjXVyqMs8oFcAAAAASUVORK5CYII=); background-attachment: scroll; background-position: 100% 50%; background-repeat: no-repeat;">
      </div>
      <div class="form-group">
        <label class="control-label" for="input-password"><?php echo $password; ?></label>
        <input type="password" name="password" value="" placeholder="<?php echo $password; ?>" id="input-password" class="form-control" autocomplete="off" style="cursor: auto; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QsPDiEFu6xIcAAAAXhJREFUOMvNk8FLVFEUxn/ffRdmIAla1CbBFDGCpoiQWYlBLty7UHAvEq2HYLhveDMws2/TIly6E9SdIEj+AVYgRaTgXhe2C968x2nhTOjow8pNZ/ede/ide893Lvx3UavVhkMIk30dQqiGECpF9e68CCG8LpfL3yStAAIk6Z2kT3Ect68C+AGdSroFVEII82aWSXoGYGYHVwE0qOM43pU0BXw3s1zSI2AnSZKXhYB6vT7inLvd7XZ/eu8fOOe2JEW9zjkwZ2bHkoayLDtpt9ufLzzBe/8GWC6VSpc7nIE2pLPLeu/fA0uDQ3T/6pp6039uZnfN7Ieke1EUrQOu3/VawPloNBrbwIyZ7TvnLvg/+mKOJ3xk88NR4R4sADM92fp9MDRMdXaRxenHVMbuFy8SMAFkZval2Wyu9ZN3Hk4zWx0nAtKsWwxotVrNNE2f5nn+CrB+/nRvlSR5y2EK0TWbSKfT+fo3Lribfr4bA/yfl56y2kkuZX8BjXVyqMs8oFcAAAAASUVORK5CYII=); background-attachment: scroll; background-position: 100% 50%; background-repeat: no-repeat;">
        <a href="index.php?route=account/forgotten"><?php echo $forget; ?></a></div>
      <input type="submit" value="Login" class="btn btn-primary">
    </form>
    <p>
    <br />
    <a href="<?php echo $registerlink; ?>"><?php echo $register; ?></a>
    </p>
  </div>
</div>

<?php }else{ ?>
<div class="list-group">
  <?php if (!$logged) { ?>
  <a href="<?php echo $login; ?>" class="list-group-item"><?php echo $text_login; ?></a> <a href="<?php echo $register; ?>" class="list-group-item"><?php echo $text_register; ?></a> <a href="<?php echo $forgotten; ?>" class="list-group-item"><?php echo $text_forgotten; ?></a>
  <?php } ?>
  <a href="<?php echo $account; ?>" class="list-group-item"><?php echo $text_account; ?></a>
  <?php if ($logged) { ?>
  <a href="<?php echo $edit; ?>" class="list-group-item"><?php echo $text_edit; ?></a> <a href="<?php echo $password; ?>" class="list-group-item"><?php echo $text_password; ?></a>
  <?php } ?>
  <a href="<?php echo $address; ?>" class="list-group-item"><?php echo $text_address; ?></a> <a href="<?php echo $wishlist; ?>" class="list-group-item"><?php echo $text_wishlist; ?></a> <a href="<?php echo $order; ?>" class="list-group-item"><?php echo $text_order; ?></a> <a href="<?php echo $download; ?>" class="list-group-item"><?php echo $text_download; ?></a><a href="<?php echo $recurring; ?>" class="list-group-item"><?php echo $text_recurring; ?></a> <a href="<?php echo $reward; ?>" class="list-group-item"><?php echo $text_reward; ?></a> <a href="<?php echo $return; ?>" class="list-group-item"><?php echo $text_return; ?></a> <a href="<?php echo $transaction; ?>" class="list-group-item"><?php echo $text_transaction; ?></a> <a href="<?php echo $newsletter; ?>" class="list-group-item"><?php echo $text_newsletter; ?></a>
  <?php if ($logged) { ?>
  <a href="<?php echo $logout; ?>" class="list-group-item"><?php echo $text_logout; ?></a>
  <?php } ?>
</div>
<?php } ?>

Similarly in the admin section, we have three files for the module

  1. admin/controller/module/accountlogin.php
  2. admin/language/english/module/accountlogin.php
  3. admin/view/template/module/accountlogin.tpl

Codes of “Account Login” modules of the admin layer’s controller file:

Go to admin/controller/module/accountlogin.php

<?php
class ControllerModuleAccountlogin extends Controller {
	private $error = array();

	public function index() {
		$this->load->language('module/accountlogin');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('setting/setting');

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$this->model_setting_setting->editSetting('accountlogin', $this->request->post);
			$this->session->data['success'] = $this->language->get('text_success');
			$this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
		}

		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_edit'] = $this->language->get('text_edit');
		$data['text_enabled'] = $this->language->get('text_enabled');
		$data['text_disabled'] = $this->language->get('text_disabled');

		$data['entry_status'] = $this->language->get('entry_status');

		$data['button_save'] = $this->language->get('button_save');
		$data['button_cancel'] = $this->language->get('button_cancel');

		if (isset($this->error['warning'])) {
			$data['error_warning'] = $this->error['warning'];
		} else {
			$data['error_warning'] = '';
		}

		$data['breadcrumbs'] = array();
		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
		);
		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_module'),
			'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('module/accountlogin', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['action'] = $this->url->link('module/accountlogin', 'token=' . $this->session->data['token'], 'SSL');

		$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

		if (isset($this->request->post['accountlogin_status'])) {
			$data['accountlogin_status'] = $this->request->post['accountlogin_status'];
		} else {
			$data['accountlogin_status'] = $this->config->get('accountlogin_status');
		}

		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');

		$this->response->setOutput($this->load->view('module/accountlogin.tpl', $data));
	}

	protected function validate() {
		if (!$this->user->hasPermission('modify', 'module/accountlogin')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		return !$this->error;
	}
}

Codes of “Account Login” modules of the admin layer’s language file:

Go to admin/language/english/module/accountlogin.php

<?php
// Heading
$_['heading_title']    = 'Account Login';

$_['text_module']      = 'Modules';
$_['text_success']     = 'Success: You have modified account login module!';
$_['text_edit']        = 'Edit Account Login Module';

// Entry
$_['entry_status']     = 'Status';

// Error
$_['error_permission'] = 'Warning: You do not have permission to modify account login module!';

Codes of “Account Login” modules of the admin layer’s template file:

Go to admin/view/module/accountlogin.php

<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-account" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
      <h1><?php echo $heading_title; ?></h1>
      <ul class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
        <?php } ?>
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    <?php if ($error_warning) { ?>
    <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    <?php } ?>
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3>
      </div>
      <div class="panel-body">
        <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-account" class="form-horizontal">
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-status"><?php echo $entry_status; ?></label>
            <div class="col-sm-10">
              <select name="accountlogin_status" id="input-status" class="form-control">
                <?php if ($accountlogin_status) { ?>
                <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                <option value="0"><?php echo $text_disabled; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_enabled; ?></option>
                <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                <?php } ?>
              </select>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
<?php echo $footer; ?>

Please let us know if you have any questions or concerns. Please don’t forget to post your questions or comments so that we can add extra topics and Opencart free module. You can follow us at our twitter account @rupaknpl and subscribe to our YouTube channel for opencart tutorials.

Great experience working with Limelight CRM

We have had great experienced working with Limelight CRM. Here are the following things that we have worked:

  1. Campaign management and offer management
  2. Maintain the servers
  3. Sites are all hosted in RackSpace and have load balancing to balance the visitor’s load.
  4. Maintain security: Uses Cloudflare to maintain security and have performed many other tasks to obtain the best security
  5. Maintain page loads
  6. Integrate limelight in more than 50 websites.
    Uses both the Webform and API form and integrated into the design, sometimes 2-page checkout sometime one-page-checkout
  7. Subscription management of the campaign
    Have not to design the PSD but can perform image changing and editing as per the necessity of the site.
  8. Bootstrap uses for responsiveness
  9. Upsell management for each offer and campaigns
  10. Payment load balancing management
  11. and many more.

Let us know if you have any questions or suggestions or requirements. You can also find us on Twitter and Facebook.

Sidebar column shopping cart for OpenCart Version 2/3

Hi, today we are publishing another free Opencart module “Sidebar Shopping Cart” and we made this for OpenCart version 2.0.3.1. Problem is we cannot edit js file with vQmod so you need to override the common.js file. But we have described where you need to put the extra code below in this post.

JS/CSS files are rendered at the browser level, not at the server level, so vQmod has no effect on these files. You can, however, create new files and use vQmod to alter the tpl files to point to these new CSS/JS files.

Output after installing the module is shown as in the image below:

sidebar shopping cart
Sidebar Shopping Cart

You can see how we copied the header cart section and show it as a module inside the cart box or side shopping cart. You can show anywhere you like as this is a module so you can show at the left column, right column or top content or bottom content.

Download the module from here:

Download Sidebar shopping cart OpenCart free module

Installation:

  1. Unzip the downloaded folder.
  2. Upload the files in the root folder to your server, the common.js file is overwritten so if you have any kind of custom javascript used then please transfer to the file and upload the common.js.
  3. Then activate the Shopping Cart module.

Activating the Sidebar Shopping Cart module:

  1. After uploading files to servers, it’s time to install Sidebar shopping cart module
  2. We are showing the sidebar shopping cart in the right column but you can show it wherever you like as this is acts as a normal module.
  3. Go to Admin section
  4. Then click on Extensions on the left menu
  5. After that Click Modules and go to “Shopping Cart” in the modules list
  6. Then click the green button to install the module (see the image below)
installation of module
installation_of_module

Then click the blue edit button

After that, you will see the form which has the status field, select “Enabled” and then click the Save button.

Your module is active and is ready to use in the layout.

Setup layout for the sidebar shopping cart at home page:

  1. From the admin section go to System >> Design >> Layouts.
  2. You will see a list of layouts, from which edit the “Home” layout.
  3. Then click Blue add the button to add rows at module section which is shown in the image below:
siderbar shopping cart installation
siderbar_shopping_cart_installation

Second, you choose the Shopping Cart in the module column and Column right in the Position column and insert the sort order as required.

Then click save button

Your custom sidebar shopping cart is showing in the right column of the home page. Likewise, you can show in many other layouts and pages.

Codes to added to common.js if you don’t want to override it:

  1. Open catalog/view/javascript/common.js
  2. Find the following lines of code
    $('#cart > ul').load('index.php?route=common/cart/info ul li');
  3. Just below it add following lines of code
    $('#shoppingcart > span').load('index.php?route=module/shoppingcart/info span');
  4. There are around 4 places where you have to add the above code.
  5. Then save the common.js file and upload it to the server and the module works perfectly.
  6. Your module is ready to use in other places except for the product detail page.

Making changes in the product detail page to make our module works:

  1. Go to catalog/view/theme/YOURTHEMENAME/product/product.tpl
  2. Find the following lines of code.
    $('#cart > ul').load('index.php?route=common/cart/info ul li');
  3. Just below it add following lines of code
    $('#shoppingcart > span').load('index.php?route=module/shoppingcart/info span');
  4. Then save and upload to the server and Sidebar shopping cart is ready to be used on the product page also.

Now click add to cart button and see how shopping cart animation changes the details with the use of Ajax functionality.

Let me know if you get any problem with performing the above tasks in the comment so that we can help if you have any.

OpenCart reCAPTCHA to show in registration and contact us page Part 2

In part 1 we showed how to activate google reCaptcha in contact us page, now we show how to show it on the registration page. Although it is not that simple as showing in the contact us page, we have to make some changes in code. For now, we are changing directly into the default file although it is not recommended :). We will try to provide OCMOD soon in the next post so you need to wait for the next post.

Go to the link below to see how to set up in OpenCart version 2.3.0.1
https://webocreation.com/set-google-recaptcha-basic-captcha-opencart-2-3-0-1

SEE for Opencart 3: Set up google reCaptcha in Opencart version 3

Steps are as follows:

Changes to be made at the language file:

  1. First go to catalog/language/english/account/ and open register.php file.
  2. Add the following code to the end of the file.
    $_['text_google_recaptcha']= 'Google reCaptcha';
    $_['error_captcha'] = 'Verification code does not match the image!';
  3. Save the file

Changes to be made at the controller file:

  1. Go to catalog/controller/account/ and open register.php file
  2. Find the following lines of code which is inside the index method
    $data['column_left'] = $this->load->controller('common/column_left');
  3. Just above that code paste following code
    $data['text_google_recaptcha'] = $this->language->get('text_google_recaptcha');
    if (isset($this->error['captcha'])) {
    $data['error_captcha'] = $this->error['captcha'];
    } else { $data['error_captcha'] = ''; }
    if ($this->config->get('config_google_captcha_status')) {
    $this->document->addScript('https://www.google.com/recaptcha/api.js');
    $data['site_key'] = $this->config->get('config_google_captcha_public');
    } else { $data['site_key'] = ''; }
  4. Now find the following lines of code which is inside the validated method.
    // Agree to terms
    if ($this->config->get('config_account_id')) {
    $this->load->model('catalog/information');
    $information_info = $this->model_catalog_information->getInformation($this->config->get('config_account_id'));
    if ($information_info && !isset($this->request->post['agree'])) {
    $this->error['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']); } }
  5. Now above that code paste following code.
    if ($this->config->get('config_google_captcha_status')) {
    $recaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('config_google_captcha_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']);
    $recaptcha = json_decode($recaptcha, true);
    if (!$recaptcha['success']) {
    $this->error['captcha'] = $this->language->get('error_captcha');
    }
    }
  6. Save the file and your controller is ready

Changes to be made at the template theme file:

  1. Go to catalog/view/theme/default*/account/ and open register.tpl, default* means if you are not using default theme then it will be theme name you are using.
  2. Find the following line of code
    <?php if ($text_agree) { ?>
  3. Just above the code above, paste the following code
    <fieldset>
    <legend><?php echo $text_google_recaptcha; ?></legend>
    <?php if ($site_key) { ?>
    <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
    <div class="g-recaptcha" data-sitekey="<?php echo $site_key; ?>"></div>
    <?php if ($error_captcha) { ?>
    <div class="text-danger"><?php echo $error_captcha; ?></div>
    <?php } ?>
    </div>
    </div>
    <?php } ?>
    </fieldset>
  4. Save the file

Now go to your registration page and you will see the page like below:

Activate google recaptcha at registration page in Opencart
Activate google ReCaptcha at registration page in Opencart

Let us know if we missed anything and if you need any help.

Thanks
Rupak Nepali

Laravel Shop Coming Soon

Hi to all,

I have started to read laravel and started it with registering http://laravelshop.com and all my updates will be posted at laravelshop.com. Today I make logo and set up server and register domain. Likewise I set up facebook page https://www.facebook.com/pages/Laravel-Shop/1420260531616136

GitHub page is https://github.com/rupaknepali/laravelshop

Google plus page : https://plus.google.com/+Laravelshop-page/about

Logo designed as below, I am not good at designing but also I managed to make as following taking laravel logo and opencart logo 🙂

laravel shop logo
laravel shop logo

I try to keep you update daily how I am moving with laravel and how i achieve updates in laravelshop.com

Thanks
Rupak Nepali

Create a class diagram for free and store it privately and collaborate with multiple users

I was searching for the best website where I can create a class diagram for free and I found Cacoo which provides a website to create class diagram for free and can store it privately and collaborate with multiple users. Being a developer I have to design a class diagram, flow charts, business organizational chart, matrix diagram, Venn diagram, SWOT diagram, and schedule diagram and many more. I was looking for a free and private class diagram and found this Cacoo and am very happy to use it and it’s drag and drop system is so easy to use.

create class diagram  for free
create class diagram for free

We can draw:

  1. Business Diagram like: Business organizational chart, matrix diagram, Venn diagram, SWOT diagram, and schedule diagram
  2. Flow Chart
  3. Mind Map
  4. Network Map like network diagram and AWS design template
  5. Office layout
  6. Sitemap
  7. Wireframe for different devices
  8. UML where you can draw state machine diagram, use case diagram, sequence diagram, class diagram, activity diagram, package diagram
  9. Database design
  10. Greeting Card design, Happy New Year, happy holidays, happy birthday and many more
  11. Electronics diagrams like Ohm’s law
  12. And also contained User-defined Templates.

So containing many drawing sections, I am happy to use it and hope it keeps on providing a free account. https://cacoo.com/