Posted on Leave a comment

How to fix the Node error “Cannot find module”

Sometimes you can get this error when installing a new module in your application.

module.js:471
throw err;
^

Error: Cannot find module ‘@sendgrid/mail’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/var/www/html/msg.js:2:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

In most cases the fix is to just check if you installed the module in the right folder of the application you need.
So, being in your current application folder, type again npm install your_module.

If that does not work, you have to delete the node_modules folder in your local app folder then type

npm install

or if that does not work either you have to delete package.json and package_locked.json files then npm install again.

 

Posted on Leave a comment

How to Easily Add Videos in Blog Posts

Videos add a new dimension to your blog posts. There are many things you will much better understand in a short video instead of thousand words.
This video will show you how to easily embed third-party videos in your wordpress blog posts.

First of all, you upload your video on YouTube or another video hosting providers.

Then, all you need to do is paste the video URL (web address) into the content area. All you need to make sure that the URL is on it’s own line and not clickable (hyperlinked).

What are the White-Listed Providers?

  • YouTube
  • Vimeo
  • DailyMotion
  • blip.tv
  • Flickr (both videos and images)
  • Viddler
  • Hulu
  • Qik
  • Revision3
  • Scribd
  • Photobucket
  • PollDaddy
  • Google Video
  • WordPress.tv (only VideoPress-type videos for the time being)
  • SmugMug (WordPress 3.0+)
  • FunnyOrDie.com (WordPress 3.0+)

If you upload your videos or other media on one of these sites, then WordPress will automatically embed. Otherwise, you would have to post the embed code manually.

Why can’t I upload the videos to my WordPress?

Well you can, but we do not recommend you to do so. On our shared-hosting accounts videos take a lot of server resource and if your video got tons of traffic, your site is more likely to crash. Secondly, you are missing out the traffic from YouTube users. We highly recommend that you pick a third party site such as Youtube, Vimeo etc to upload your videos.

We hope this post is of help to you.

Posted on Leave a comment

Video sync 1

[flv flashvars=”image=http://www.artitmedia.eu/wp-content/uploads/vpsync/modelok.jpg&logo.file=http://www.artitmedia.eu/wp-content/uploads/vpsync/videotrain-logo-small.png&logo.hide=false&logo.position=top-left&plugins=captions-2,slidesync-1,slidescroller-1&slidesync.xmlPath=http://www.artitmedia.eu/wp-content/uploads/vpsync/vpsync.xml&slidesync.position=right&slidesync.size=450&slidesync.bgcolor=FFFFFF&slidescroller.xmlPath=http://www.artitmedia.eu/wp-content/uploads/vpsync/vpsync.xml&slidescroller.position=bottom&slidescroller.size=150&captions.labels=english,française&captions.files=/wp-content/uploads/vpsync/eng.xml,/wp-content/uploads/vpsync/fra.xml&skin=/wp-content/plugins/vipers-video-quicktags/resources/jw-flv-player/skins/modieusgr.zip” width=”800″ height=”500″]http://www.artitmedia.eu/wp-content/uploads/vpsync/vpsync.flv[/flv]

Posted on Leave a comment

Enable ASP detailed error messages in Plesk 11.5 on Win server 2000 with IIS 7

1. Disable “Custom error documents” by going to “Website Scripting and Security”.

2. Create a new text file with the name “web.config” that you save in the root of the site and put this content into it:

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    </system.webServer>
</configuration>

3. Refresh the page and you should have the details about the asp error.

Posted on Leave a comment

Update Custom field in WP

1 Jan – 7 Jan 2014, 1 week, single (£350)
<a href=”?p=450&amp;aimarrivaldate=01/01/2014&amp;aimprice=350#simple-wp-booking-enquiry-form”>Book Now</a>

 

<?php
if($_GET[‘aimprice’]){
  echo ‘<span style=”font-weight:bold; color:red;”>Price: £’ . $_GET[‘aimprice’] . ‘</span>’ ;
  update_post_meta(450, ‘price’, $_GET[‘aimprice’]);
  echo ‘<script type=”text/javascript”> document.getElementById(“arrivaldate”).value=”‘.$_GET[‘aimarrivaldate’].'”; </script>’;
}
?>

Posted on

WordPress Comment/Review form with posts dropdown menu

This is used to for when you need a single form to submit a comment/review by choosing a post from a dropdown menu with all/several posts titles.

1st version shows ALL the posts in the menu and 2nd one allows you to ignore posts from a certain category.

1st version:

<form name=”commentform” action=”wp-comments-post.php” method=”post” id=”commentform”>
<select name=”archive-dropdown” onchange=”var str=this.options[this.selectedIndex].value; document.commentform.comment_post_ID.value = str.substring(str.search(‘p=’)+2);”>
<option value=\”\”><?php echo attribute_escape(__(‘Select Tour’)); ?></option>

<?php wp_get_archives(‘type=postbypost&format=option&show_post_count=0’); ?>

</select>

—————————————

2nd version:

<form name=”commentform” action=”wp-comments-post.php” method=”post” id=”commentform”>
<select name=”archive-dropdown” onchange=”var str=this.options[this.selectedIndex].value; document.commentform.comment_post_ID.value = str.substring(str.search(‘p=’)+2);”>
<option value=\”\”><?php echo attribute_escape(__(‘Select Tour’)); ?></option>

<?php
    $args=array(
      ‘cat’ => -69,
      ‘post_type’ => ‘post’,
      ‘post_status’ => ‘publish’,
      ‘posts_per_page’ => 10,
      ‘caller_get_posts’=> 1
      );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <option value=”<?php the_permalink() ?>”><?php the_title(); ?></option>
       <?php
      endwhile;
    }
  wp_reset_query();  // Restore global post data stomped by the_post().
?>

</select>

&nbsp;<p>Your email address will not be published. Required fields are marked <span>*</span></p>
<p><label for=”author”>Name</label> <span>*</span><input id=”author” name=”author” type=”text” value=”” size=”30″ aria-required=”true” /></p>
<p><label for=”email”>Email</label> <span>*</span>
<input id=”email” name=”email” type=”text” value=”” size=”30″ aria-required=”true” /></p>
<p><label for=”url”>Website</label><input id=”url” name=”url” type=”text” value=”” size=”30″ /></p>
<p><label for=”comment”>Review</label><textarea id=”comment” name=”comment” cols=”45″ rows=”8″ aria-required=”true”></textarea></p>
<p>You may use these <abbr title=”HyperText Markup Language”>HTML</abbr> tags and attributes:  <code>&lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </code></p>
<p>
<input name=”submit” type=”submit” id=”submit” value=”Post Review” />
<input type=”hidden” name=”comment_post_ID” value=”” id=”comment_post_ID” />
<input type=”hidden” name=”comment_parent” id=”comment_parent” value=”0” /></p>
<input type=”hidden” id=”_wp_unfiltered_html_comment” name=”_wp_unfiltered_html_comment” value=”8b42defd9a” />
<p style=”display: none;”>
<input type=”hidden” id=”akismet_comment_nonce” name=”akismet_comment_nonce” value=”b3ef566a7d” />
</p>
</form>

—————————-

To just display a list of these posts instead of options in a form, use this code:

<?php
    $args=array(
      'cat' => -3,
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => 5,
      'caller_get_posts'=> 1
      );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of 5 Posts but excluding category id 3';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
       <?php
      endwhile;
    }
  wp_reset_query();  // Restore global post data stomped by the_post().
?>
Posted on

Loop through form ids with different names in Javascript

<select name=”EiPromoPenny0″ id=”EiPromoPenny0″>
<option value=0>00</option>
<option value=99>99</option>
<option value=1 selected=”selected”>01</option>
<option value=2>02</option>
<option value=3>03</option>
</select>
<select name=”EiPromoPenny1″ id=”EiPromoPenny1″>
<option value=”red”>red</option>
<option value=”green” selected=”selected”>green</option>
<option value=”blue”>blue</option>
</select>
<select name=”EiPromoPenny2″ id=”EiPromoPenny2″>
<option value=”a”>a</option>
<option value=”b” selected=”selected”>b</option>
<option value=”c”>c</option>
</select>

<script language=”javascript” type=”text/javascript”>
for( var i = 0; i<=2; i++){
alert(document.getElementById(“EiPromoPenny” + i).value);
}
</script>

Posted on

IIS7: HOW TO enable detailed error messages for a website on browsers?

In IIS 7, you can control the detailed error messages being sent to the clients. By default, the detailed error messages can be viewed only by browsing the site from the server itself.

But, this is dangerous because Detailed errors may contain about the inner workings of your web-site. We should allow only trusted persons to see the detailed error messages, that’s why it is configured default to be viewable only from the server.

Example : For a 404.0 error, if the detailed error message is not enabled for the website, then the users will see the following on their browsers:

Server Error

————————————————————————-

HTTP Error 404 – File or directory not found.

If the web browser is installed on the same physical machine as IIS is installed on, the error message may resemble the following:

Server Error in Application “”

————————————————————————–

HTTP Error 404.0 – Not Found

This will be followed by HRESULT, possible cause and resolutions sections.

If you want to enable this detailed error message to be shown on the clients as well, then you need to change the setting in the IIS7 manager.

Follow the below steps for the same:

1. Open the IIS7 manager

2. Select the Website and on its features view, double click on “Error Pages”.

3. Right click and select the “Edit Feature Settings…” or select the same from the Actions pane (in the right hand side)

4. Select the “Detailed errors” radio button and click on OK

5. Now, even your client browsers will be able to see the detailed error messages.

This article gives more information on this detailed error messages with IIS7.

Hope this helps!