.htaccess useful tricks

.htaccess useful tricks

RewriteEngine on

#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] #RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

#RewriteEngine On

#RewriteCond %{HTTPS} !=on

#RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

ErrorDocument 404 /index.php

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([^\.]+)$ $1.php [NC,L]

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php


How to convert a PFX to a seperate .key/.crt file



How to convert a PFX to a seperate .key/.crt file

In this article will show you the commands you need to convert your .PFX Certificate file to a seperate certificate and keyfile. This article can come in handy when you need to import your certificates on devices like Cisco routers/loadbalancers etc. where you probably need to import the certificates and keyfiles in plain text (unencrypted). Tool of choice (but there might be others) is OpenSSL for Windows, which can be downloaded here.

  1. Installed OpenSSL – start it from it’s Bin folder.
  2. Start command prompt and cd to the folder that contains your .pfx file.
  3. First type the first command to extract the private key:openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]

    What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.

  4. Extract the certificate:openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt] Just press enter and your certificate appears.
  5. Now as I mentioned in the intro of this article you sometimes need to have an unencrypted .key file to import on some devices. I probably don’t need to mention that you should be carefully. If you store your unencrypted keypair somewhere on an unsafe location anyone can have a go with it and impersonate for instance a website or a person of your company. So always be extra careful when it comes to private keys! Just throw the unencrypted keyfile away when you’re done with it, saving just the encrypted one.The command:

    openssl rsa -in [keyfile-encrypted.key] -out [keyfile-decrypted.key]

    Again you need to enter an import password. This time you need to enter the new password that you created in step 1. After that you’re done. You decrypted your private key. In the folder you ran OpenSSL from you’ll find the certifcate (.crt) and the two private keys (encrypted and unencrypted).

 

In some cases you might be forced to convert your private key to PEM format. You can do so with the following command:

openssl rsa -in [keyfile-encrypted.key] -outform PEM -out [keyfile-encrypted-pem.key]



.htaccess to hide extension for both html and php files

.htaccess to hide extension for both html and php

<IfModule mod_rewrite.c>

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.website.com/$1 [R,L]

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

</IfModule>



10 Secrets that will make you a master of Opencart Events

10 Secrets that will make you a master of Opencart Events

If you are an Opencart Developer, you have probably heard about events. If you come from wordpress like me, you would definitely relate this to their hooks API and when Opencart Events first arrived in opencart 2.0.0.0 they were very similar in terms of the naming approach. This changed in the version 2.2.0.0 when the Opencart team changed the way events where triggered and this we believe will revolutionize Opencart forever.

What are events?

First of all, what are ¨events〃 in the opencart core understanding? Events are methods that are called when an action takes place. In other words, you can define specifically the moment when you want your custom function to run in the opencart store.

You can find more information here and here

10 Secrets that will make you a master of Opencart Events?



Why not use VQMOD/OCMOD?

Before ¨events〃 for a long time we have been using VQMOD, a modification system that uses an XML file to add changes to files of opencart. It would run in the beginning, creating vqmod cache files with the modifications and then the opencart core system would use those new files to make the changes. In other words, you would change the codebase, but the changes would be added on the fly.

The idea was great at that moment and it really boosted opencart since it allowed for the developer to create any kind of modification without altering the actually core files, making installation of modules and the future opencart upgrade easier.

As good as it sounds, it created a whole level of conflicts between custom modules, leading to hours and even days of work to fix. Mostly, due to poorly created modifications.

Still, even with this drawback, VQMOD, and further OCMOD, a native implementation of VQMOD concept directly in Opencart, gives us, developers, a great tool.

So how can Events help me better then VQMOD/OCMOD?

Events are simple functions that execute at a specific moment in your opencart runtime and modify the output  not the codebase. For example, if you want to run a function before the common/header controller is loaded, you can do that. Or if you want to add some html to the output of the common/header view  you can do that as well. There is no file manipulation so you wonˇt need to worry about creating conflicts by altering the code  the code base stays the same.

Sound interesting, but how do I actually use it?

Lets try an example. Say, you have another tpl file for the header and you need the header controller to load my_custom_header.tpl.

VQMOD/OCMOD solution:

Create a modification that would edit the $this->load->view method in the controller.

  1. <file name="catalog/controller/common/header.php">
  2.   <operation>
  3.     <search position="replace"><![CDATA return $this->load->view('common/header', $data);]]></search>
  4.     <add><![CDATA return $this->load->view('common/my_custom_header', $data);]]></add>
  5.   </operation>
  6. </file>

This works perfectly until another extension comes along and needs this line of code to work. Now you have a conflict.

Eventˇs Solution:

With events you will not alter the code, you will change the $route parameter, that is passed into the $this-load->view($route, $data) like so.

Create a file (use descriptive names  saves the time of finding the right event file):
catalog/event/change_view_common_header.php

Code:

  1. <?php
  2.   class ControllerEventChangeViewCommonHeader extends Controller {
  3.     public function before_view(&$route, &$data, &$output){
  4.       $route = str_replace('common/header', 'common/my_custom_header', $route);
  5.     }
  6.   }

Now add the trigger:

  1. $this->load->model('extension/event');
  2. $this->model_extension_event->addEvent(ˉmy_custom_header', 'catalog/view/common/header/beforeˇ,ˇ event/change_view_common_header/before_viewˇ);

You would need to add the trigger yourself during the installation of your module or use the Event Manager to do it manually

10 Secrets that will make you a master of Opencart Events?

Of course there could be an extension that also wants to change the tpl file and load its second_custom_header.tpl  so there are always a possibility of conflicts, yet with events the chances are dramatically reduced.

You can find more information in the documentation here

10 Tips that will make you events rock!

There are some rules you should know about events and trigger naming before diving into events.

1. The trigger name starts with admin or catalog. Even if you are calling a config file,which is in systemfolder, you will call it either in admin or catalog.Ex: trigger: admin/config/admin/after

2. Actions are defined only in the controllers. So even if you want to trigger them for a model, you still must define them in a controller. Ex: file location will be admin/controller/event/admin_config_modification.php

3. The Catalog View trigger before and after are different. This is not necessarily a bug, yet is not obvious from the start. Ex: before trigger: catalog/view/common/header/before Ex: after trigger: catalog/view/default/template/common/header/after

The reason this happens, is that the controller passes the $route value of ‘common/header’ yet opencart builds up the $route with the theme settings using an event action located in catalog/controller/event/theme.php. This only happens in the

catalog (frontend) and not in the admin since admin does not have a theme option.

4. You can use the wildcard symbol (*) in your trigger. This will save you the time creatingalmost the same triggers for different paths.

5. You will need to set the events upfront in your admin using the event model from your admin/model/extension/event.php. The perfect way of adding is when someone is installing your extension.

6. You can not create events from the catalog, only admin. There is no method in the catalog/model for that. Well, why would you, right?

7. Remember, that the $this-&gt;load- &gt;config does not return anything, so you can’t actually modify the $output of the config file, yet you can still add modify with $this-&gt;config-&gt;set() method.

8. Same goes for Language files, the only difference is the language $output is returned and you can evaluate it. But you still need $this-&gt;language- &gt;set() method to modify.

9. To avoid theme conflicts, you can alter the html $output of the view with simple html DOM library. You can also move the selectors to the module config and allow edit in the admin panel for the user to set it in case the custom theme differs from the default.


10. Remember that your event action is not he only one in the loop. Try to return the$output that the next action can safely use. This is probably the most important rule of them all.

NEW DELHI: Satta Matka is a form of gambling or lottery that ..

NEW DELHI: Satta Matka is a form of gambling or lottery that ..

NEW DELHI: Satta Matka is a form of gambling or lottery that had originated before the Independence of India.

Originally, the game of Matka gambling involved betting on the opening and closing rates of cotton as transmitted to the Bombay Cotton Exchange from the New York Cotton Exchange, via teleprinters.

The modern-day Matka gambling/ Satta King is based on random number selection and betting. The players participating in the Satta Matka game/ gambling are required to choose the right number for winning the game. The player who wins the game becomes Satta King and is rewarded financially.

Two of the most famous Matka games are – Kalyan and Worli.

The Kalyan Matka gambling was started by Kalyanji Bhagat, a farmer from Gujarat, in 1962 and it ran for all days of the week.

Another Matka gambling, New Worli Matka, was started by the Rattan Khatri in 1964 with slight modifications to the rules of the game. Khatri’s Matka ran only five days a week, from Monday to Friday.

 

Term Meaning
Matka Matka means earthen pot that were used to draw numbers
Single Any digit between 0 and 9
Jodi/Pair Any pair of two digits between 00 and 99
Patti/Panna Three digit number
Open result / close result Outcome of matka betting
Berij Berij is last digit of jodi’s/pair’s sum

Any form of Satta Matka gambling is illegal in India.

 

Disclaimer: This content is for reference purpose only and The Times of India claims no ownership of this content. The Times of India does not support or promote piracy in any manner.

view display as html in drupal 7

view display as html in drupal 7

<?php
print views_embed_view(‘search’, ‘page_1’, array(23,44,100));
?>

<?php
$output = views_embed_view(“content_link”,”block_3″);
if ($output){
print $output;
}

?>

 

<?php
if (views_embed_view(“content_link”,”block_3″)->result):
print views_embed_view(“content_link”,”block_3″);
endif;
?>

 

<div class=”container”>
<div class=”row”>

<?php
$my_view_name = ‘real_estate’;
$my_display_name = ‘Grid Properties with Pager’;
$output = views_embed_view($my_view_name,”block_6″);
if ($output){
print $output;
}

?>
</div>

</div>

Advantages and Drawbacks of Inline Styles in CSS

Advantages and Drawbacks of Inline Styles in CSS

CSS, or Cascading Style Sheets, are what is used in modern website design to apply the visual look to a page. While HTML creates the structure of the page and Javascript can handle behaviors, the look and feel of a website is the domain of CSS. When it comes to these styles, they are most often applied using external style sheets, but you can also apply CSS styles to a single, specific element by using what are known as “inline styles.”



Inline styles are CSS styles that are applied directly in the page’s HTML. There are both advantages and disadvantages to this approach. First, let’s look at exactly how these styles are written.

How to Write an Inline Style

To create an inline CSS style, you begin by writing your style property similar to how you would in a style sheet, but it needs to be all one line. Separate multiple properties with a semicolon just as you would in a style sheet.

background:#ccc; color:#fff; border: solid black 1px;

Place that line of styles inside the style attribute of the element you want to be styled. For example, if you wanted to apply this style to a paragraph in your HTML, that element would look like this:

<p style="background:#ccc; color:#000; border: solid black 1px;">

In this example, this particular paragraph would appear with a light grey background (that is what #ccc would render), black text (from the #000 color), and with a 1-pixel solid black border around all four sides of the paragraph.

Advantages of Inline Styles




Thanks to the cascade of Cascading Style Sheet inline styles have the highest precedence or specificity in a document. This means they are going to be applied no matter what else is dictated in your external stylesheet (with the one exception being any styles that are given the !important declaration that sheet, but this is not something that should be done in production sites if it can be avoided). The only styles that have higher precedence than inline styles are user styles applied by the readers themselves. If you are having trouble getting your changes to apply, you can try setting an inline style on the element. If you styles still do not display using an inline style, you know there’s something else going on.

Inline styles are easy and quick to add and you do not need to worry about writing the proper CSS selector since you are adding the styles directly to the element you want to change (that element essentially replaces the selector you would write in an external style sheet). You don’t need to create a whole new document (as with external style sheets) or edit a new element in the head of your document (as with internal style sheets). You just add the style attribute that is valid on nearly every HTML element. These are all reasons why you may be tempted to use inline styles, but you must also be aware of some very significant disadvantages to this approach.

Disadvantages of Inline Styles

Because inline styles they are the most specific in the cascade, they can over-ride things you didn’t intend them to. They also negate one of the most powerful aspects of CSS – the ability to style lots and lots of web pages from one central CSS file to make future updates and style changes much easier to manage.

If you had to only use inline styles, your documents would quickly become bloated and very hard to maintain. This is because inline styles must be applied to every element you want them on. So if you want all your paragraphs to have the font family“Arial”, you have to add an inline style to each <p> tag in your document. This adds both maintenance work for the designer and download time for the reader since you would need to change this across every page in your site to change that font-family. Alternatively, if you use a separate stylesheet, you may be able to change it in one spot and have every page receive that update. Truthfully, this is a step backward in web design – back the days of the <font> tag!

Another drawback to inline styles is that it’s impossible to style pseudo-elements and -classes with them. For example, with external style sheets, you can style the visited, hover, active, and link color of an anchor tag, but with an inline style, all you can style is the link itself, because that’s what the style attribute is attached to.

Ultimately, we recommend not using inline styles for your web pages because they cause problems and make the pages a lot more work to maintain. The only time we use them is when we want to check a style quickly during development. Once we’ve got it looking right for that one element, we move it to our external style sheet.

Heading Tags SEO: Tips for Using H1 to H6 Right Way

Heading Tags SEO: Tips for Using H1 to H6 Right Way

As we know, heading tags are imperative for every web document to structure the content. By using Heading Tags, we differentiate our web page content. Use heading tags for headings only not for making Text Large or Bold.  

Note: At the end of the article I have outlined 2 common heading tags mistakes by bloggers. Don’t miss reading it!

Definition of Heading Tags

Heading Tags are well-defined by W3Schools that:

<h1> to <h6> tags are used to define Heading on a web document.

“According to W3Schools – <h1> </h1> is the first heading which is critical for any web document and <h6></h6> is the least important heading that holds very less importance in a web document as compared to other heading tags. ”

Defined Heading Tags are:

<h1>some text here</h1>

<h2> some text here </h2>

<h3> some text here </h3>

<h4> some text here </h4>

<h5> some text here </h5>

<h6> some text here </h6>


h1 tag should be main headings which if followed by further h2, h3 and so on. The h1 is usually the boldest one whereas h6 font size is smallest.

Don’t get confuse yourself and stop thinking that Heading Tags as merely formatting for the web pages and Search Engines Heading Tags are for just categorization of content on web page.

Heading Tags come with various attributes to make user-friendly websites but Search Engines use these defined headings solely to index the structure and content of web documents including blog posts.

In other words, you can say that Heading Tags are used to show the web document structure.

How to use Heading Tags for SEO?

Apart from the web designing point of view, there are a few more things that you should know about Heading Tags.

– Purpose of using Heading Tags

The main purpose of categorizing your content with different headings so that your design become more user-friendly and people will get a notion about your website more easily by just reading the Sub-headings.

Now we know H1 tag is most important tag so whenever you going to use it for your webpage heading just try to make it like that people get an idea about your website just reading your heading. So that h1 tag should be in that way which describes everything about your web page just in one shot.

– Hierarchy

Hierarchy on your web page should be like <h1> comes first which is followed by <h2>, <h2> followed by <h3>, <h3> followed by <h4>, <h4> followed by <h5> and <h5> followed by <h6>.  For better SEO of your web page, one should have to follow the hierarchy in this way.

– Headings Tags with Keywords

Keywords are first and foremost priority of any SEO Expert. In the matter, we first do the research of best keywords according to the web page and then categorize these keywords into focus keyword, primary keyword, secondary keyword and tertiary keyword. Focus Keyword is always one for the web page. It’s better to include your focus keyword into the title, Meta tags, and h1 of the webpage.

– Frequency of Using the Heading Tags especially h1 tag

It is recommended that one should have to use h1 tag per web page because h1 tag should be like a newspaper heading and other content should be structured with subheadings by following the hierarchy of heading tags. Using of subheadings depend on the way your content is structured.

H1 Tag In Latest HTML5




In the previous versions of HTML, only one H1 tag is allowed to designers to use per web document and what people do that time – they just used H1 tag to wrap the business logoon the web page which is important for any business web page and start the main heading of the web page with the H2 tag. But with the help of updated version of Html i.e. HTML5 which allows the designer to have multiple h1 tags on a web page according to the requirements of the web page design.

Ex: Single page websites.

Well, Heading tags are crucial for the proper On page SEO of your blog posts. One mistake which is common among newbie bloggers is excessive use of H2 or H3 tags & at times skipping H2 tags & only using H3 tags.

how can access yahoo notepad in yahoo app

how can access yahoo notepad in yahoo app

Either I solved my own problem by using this URL to get to yahoo notepad…

https://calendar.yahoo.com/?view=notepad#

OR…

Yahoo Notepad is now back up and running after having been down for two or three days. Who knows?

 

I’m happy about this but I’m not pleased that Yahoo has no tech support or help desk that I can send

email to or call or chat with in the event of problems or to inquire about changes. I DO pay Yahoo $19.95 for premium service every year but evidently that does not include help or tech support from a human.



Yahoo Help Community was not useful for me in finding the solution or answer to my problem either.