Tutorials

Tutorials about HTML, CSS, PHP, Javascript, and Photoshop

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Archives
    Archives Contains a list of blog posts that were created previously.
  • Login
3737

Spreadsheets are incredibly powerful tools, as we've seen through ourrecent series on spreadsheetsThey're the original killer app for PCs, the app that that convinced countless businesses that it was time to enter the digital age. And often the most versatile app to make a budget, on your computer or phone, a spreadsheet is the easiest way to crunch numbers, Even today, or anything else that needs laid out linearly, schedule

The only problem is, spreadsheets are complicated tools that can feel like they take a lifetime to master. Their power comes at a price. That's where simpler spreadsheet-like apps come inCalcaIs one of the most powerful, and we've already looked at how you can make Markdown documents with calculations in it. Bu there's a simpler option:Soulver

Soulver is a simple text-powered calculator app that gives you the power of a spreadsheet with the simplicity of typing out your problems in real words. This tutorial will teach you everything you need to crunch your numbers efficiently with Soulver. Let's dive in

Numbers Naturally

With Soulver you can use natural English, Rather than requiring you to use specific function commands to perform operations. The simplest way to get a grasp of Soulver is to jump straight in and start using it. In this tutorial I’m going to take your through three sample projects that demonstrate the principals that underly Soulver and will give you the tools to start using Soulver in your workflow

Before starting, you need to understand Soulver’s concept ofWord OperatorsWhen you are talking to someone you rarely say “ten plus ten”, you are far more likely to say “ten and ten”. Soulver leverages this concept; you can useAndIn place of a plus signLessInstead of a minusAtInstead of an asterisks or an x and many others as well

Soulver also has a smart understanding of units. If you specify something in the price per week and then calculate the price per month, Soulver knows what you want to do

To start, download a copy of Soulver. It’s a available forMaciPhone and iPadI’m using the Mac version for this tutorial but the features are the same across all three platforms. There is a ten day free trial of the Mac versionavailable from the developer’s website

Simple Budget

Open a new Soulver document. It is always a good idea to create an introduction for yourself so that, you know what it was for, if you find the file in a year or two

Soulver automatically pulls the numbers out of anything you write. I don’t want Soulver to take the year as a value to be used so I’m going to write my introduction as a comment. The easiest way to write a comment in Soulver is to preface the line with//Write something like2014, //Budget for Denmark Trip

Soulver budget document 1
The start of my budget Soulver document

Next it is time to add items to the budget. With Soulver you can use natural language to do this. Just type the expenses in the left column as you would tell them to a friend

  • The flights are €100
  • Two nights in Copenhagen at €30 a night
  • Transport will be €40
Soulver budget document 2
Adding items to my budget

In the right column Soulver lists the answer to what you’ve written. The answer will be the same as what you wrote, If you’ve written a simple statement, like the first line. Soulver will calculate the result and display that in the answer column instead, If there is an inherent maths problem, however

Soulver keeps a running total, Down the bottom of the document. At the moment, the total cost of my trip is €200. If instead you wanted to know the average cost of the different items, click on theTotalAnd selectAverageSoulver will tell you that my average expense is €66. 67

Less Simple Budget

I’m still working in the same Soulver document, but now I’m going to start to leverage some of the app’s cooler features

Add the lines:

  • Museum visits are 300DKK in euro
  • 2 nights in Aalborg at €40 less 10%
Soulver budget document 3
The final budget document

Soulver regularly pulls exchange rate data so it’s currency conversions are always up to date. For my budget that’s important as I can enter an expense in DKK (Danish Krone) and just addIn euroTo instantly convert it to a more familiar currency

You can also use Soulver to work with percentages. Soulver has a smart understanding so you can use real words to calculate discounts, Again, mark ups and interest rates with ease

Back of the Envelope Calculations

By now you should have a basic understanding of how to use Soulver. For this section, open a new document. Denmark is filled with wind turbines and as I travelled past some I wondered what speed the blade tip moves at. This sort of back of the envelope calculation is where Soulver comes into its own

Preface the document with a comment, Once again. In this case type something along the lines of//Wind Turbine Blade Tip Speed Calculator

When you are doing any simple physics problems like this, it is good practice to work with variables rather than absolute numbers. This means you can change the variable’s value and the whole equation will update, rather than having to go through and update every number individually. The two important variables are going to be the length of the windmills blades and the time it takes to do a complete revolution

Enter the lines:

  • BladeLength = 30m
  • RotationTime = 3sec
back of the envelope 1
The opening lines of my back of the envelope calculation

The, In SoulverEqualsSign assigns variables. I’ve also added the units after each variable so Soulver can make smart decisions about converting the results. I arrived at these values by timing how long it took a turbine to fully rotate and guessing at the length of the blades. If you want to calculate the speed of different sized, you can update the variables at any time which will update the answer, or differently spinning, turbines

Tip:You can’t use spaces with variables in Soulver. That’s why I usedBladeLengthInstead ofBlade Length

Next add the lineSpinCircumference = BladeLength × 2 pi

Here you’re setting theSpinCircumfrenceVariable to be 2 pi times theBladeLengthVariable. If you remember high school maths, you’ll recall that the circumference of a circle is given by 2 pi times the radius. But it is close enough for this rough calculation, This calculation will be slightly inaccurate because the radius is slightly larger than the blade length

Tip: Soulver comes with a number of constants likePiBuilt in. You can add your own by going to theNumbersOption in the menu bar and adding a newVariableThis variable will be available in all your Soulver documents

On the next line, I’m going to use anAnswer TokenRather than a variable. TypeDistPerMin =And then click on theInsert Answer TokenMenubar item. Finish by addingX (1 minute/RotationTime)After theAnswer Token

back of the envelope 2
Working with variables and Answer TokensIn Soulver

An answer token takes the result of the line above and uses it in the current line. Answer tokens make it super easy to use information you’ve just calculated in new equations like I did here. This line calculates how far the blade travels in one minute. It’s around 3700 meters, For me

Tip:You can also create an answer token for any line just by typingLine[line number]

The next line calculates how far the blade travels in an hour. You need to multiply the previous result by 60. I did it by enteringDistPerHour = [AnswerToken] x 60However you can do it with variables instead. 194 meters, My result is around 226

To convert this to kilometres just enterDistPerHour in kmOn another line

back of the envelope 3
Calculating the blade tip's distance per hour

I now know that the blade tip travels 226 kilometres in an hour—what speed it is doing is pretty obvious. However, I wanted to do more calculations and I needed my result to be in kilometres per hour for them, it’s easy to convert the result, If

To do so, create a new variable calledSpeedPerHourAnd let it equalDistPerHour/hourThe result is the turbine blade tip’s speed: roughly 226 km/hour

back of the envelope 4
The final results

Conclusion

In this tutorial I’ve introduced you to Soulver and shown you how to go from using its most basic features to create a simple budget to using advanced features, such as variables and answer tokens, to solve multi-step physics problems. Soulver is one of the best calculator apps available; it is powerful enough to be useful but not overburdened with extra features

Explore the, Soulver has a lot more to offer—play around with it and if you’re ever stuckReferenceSection in the menubar or ask me a question in the comments

Continue reading
0
3868

Metronomes have been in use in the music field for a long time. They help you to stay in time and feel the tempo of the song. Digital metronomes found in our DAWs are just as useful, Even though mechanical metronomes are still in use.  Learning to use them effectively will help you prevent problems in your projects. And properly set up the features it offers, In this tutorial, I will show you how to use the metronome (aka Click) in Cubase

What Is Precount?

Precount is adding a few counts just before you start any real recording, As the name suggests. Think of it as the revving of the car engine before you hit the clutch. You can activate it by pressing thePrecount OnButton on the transport panel, or by selectingPrecount OnFrom theTransportMenu. Once Precount is activated, that number of bars will be played back before recording starts

This function can be really useful in situations where you need to establish the tempo of the song to the player or the vocalist, but don’t want to waste any time playing the track with just a click track. Therefore the player can feel the tempo of the song, but doesn’t have to leave gaps in the recording. Precount can also be used in situations where you want to give some time to the player to get ready for the recording

Tweaking the Settings

Cubase has a few metronome settings that can be tweaked. To view themCtrl + clickOn the “Click” area in the transport panel, or selectMetronome SetupFrom theTransportMenu

You can change the metronome and Precount options, On the left hand side of the dialog box

Metronome & Precount Options

In the metronome options, you have three checkboxes that will help you to determine when you want the metronome to be played. If you activateMetronome in RecordThe click will be played while any audio is recorded into the projectMetronome in PlayWill activate the click while you are playing back the project. Else you won’t be able to hear the metronome, Make sure that the click is activated in the transport panel

The first option is to set the number of Precount bars. As explained in the above section, this value determines the number of bars that will be played before recording or playback is activated. TheUse Time Signature At Record Start TimeCheckbox will make the Precount use the tempo and the time signature of the cursor location when you start recording. This is important in orchestral music and movies where time signature may be different in different parts of the score. TheUse Time Signature at Project TimeWill use the tempo and the time signature that is specified in the tempo track

You can also manually override the time signature of the Precount by changing theUse SignatureValue field. The time signature specified here will be followed by the Precount irrespective of the time signature specified in the transport panel or the tempo track

MIDI Click & Audio Click

On the right hand side of the dialog box you can see the options for changing the tone and volume of the clicks. You can change the value of the notes that are being played and the velocity of each note. Let’s see what these settings do

TheActivate MIDI ClickCan be used to specify whether the metronome’s audio will be played through a MIDI device or not. This option will come in handy if you are using an external MIDI device to record and want to listen to the metronome through that device

MIDI Port/ChannelHelps you to select the channel number for the MIDI output. You can use VST as a channel for the MIDI, If you have set up a VST instrument previously for the project. However most VST sync up automatically to the host’s clock, Use this option if you want your VST instrument to read the metronome for its performance

TheHi NoteAnd theLo NoteDetermines the MIDI note number for the metronome clicks. The Hi Note value will change the sound of the first beat in a bar and the Lo Note value will change the value of the sound for the rest of the beats. You can also adjust the velocity of the Hi and Lo notes. The value of the note field ranges from C2 to G8. You can determine the notes that are sent to your VST instrument and can control the notes that are being played through your VST, This way

Audio Click helps you to choose the sound of the clicks of the metronome. You have the option to select custom audio files as the tones for each click. You need to activate theAudio ClickOption for this to work. The first option is to selectBeepsYou can adjust the sliders to change the pitch of the clicks. Drag theHiSlider to change the pitch of the first beat in a bar and drag the Lo slider to change the rest of the beats. The velocity of each note can be changed here by dragging the Level meter left or right

Select the Sounds option and click on the, In order to select a custom sound for your metronomeHiAndLoFields to select any type of audio file as your metronome sound. Here you can navigate to your custom audio file and select it, Click on the empty field and a file locator will pop up. The levels of each file can be adjusted using theLevelSliders

Conclusion

Metronomes or clicks have become a standard, In any recording scenario. Many musicians feel that playing alongside a metronome will help the performance become tighter and more enjoyable. There are people who say it doesn’t matter, However.  

Metronomes will help you make better recordings, In either case. It’s not just the power of the metronome, it’s also your creativity that will help you make wonderful music. Next time you are working on a recording project, try using a metronome. You might be amazed how much better it makes your performance

Continue reading
0
3669
Final product image
What You'll Be Creating

Especially digital graphics that only are displayed on screens, in addition to its namesake tasks of tweaking photographs, Photoshop is great tool for graphics design. But that's not all it's good for.  With proper knowledge and thinking, one can use Photoshop to create stunning print designs as well

This tutorial will take you through the basic steps of creating the eye-catching flyer seen above that can be printed right away in print-shop-ready CMYK colors directly from Photoshop. You can follow this tutorial to make this exact flyer, or tweak the steps with the content and colors you want to get the flyer style you'd like using the same methods

Tutorial Assets

Along with some custom made vector icons that I have created in Illustrator specifically for this project, This tutorial uses royalty-free images from Envato. In the download on this tutorial's sidebar, along with a completed PSD file you can use to compare with your work, You'll find each of them

This tutorial also uses the Proxima Nova Font FamilyWhich comes with a Typekit or an Adobe Creative Cloud subscription. Or use another similar typeface of your own,  You can sync that font to your computer and use it with this tutorial

Setup Document With Guides

Step 1

First, set up a document with the correct size and settings for print. Create a new document in Photoshop, and set its dimensions to216x154 mmThese dimensions represent A5 paper size with 3 mm bleed added to each edge. Set, Since we are going to create artwork for printColor ModeToCMYKAnd ResolutionTo300Pixels/Inch

new photoshop document

Step 2

Create new guides that will represent the bleed area. Illustrator and InDesign have this function built-in, we have to create it ourselves, but in Photoshop. Use theMove Tool (V) and the ShiftKey To create a horizontal guide by dragging the cursor from the top ruler. Make sure that the guide is located3 mmOn the Y-axis

add horizontal guide

Step 3

Repeat the same process to create guides along each edge of the document. Make sure that each guide is Inset 3 mmFrom its corresponding edge

finished guides

Creating the Background

Step 1

Press Shift-Cmd-NTo create a newLayerFill it withWhiteAs the Foreground Color (Alt-Backspace). Make sure that you have the CMYK SlidersTurned on so you're using print colors

cmyk sliders

Step 2

Create a newGradient OverlayIn theLayer Style PanelEdit the Gradient. Set the white slider LocationTo30%Change the color of the black slider toPale Yellow (C=9 M=6 Y=14 K=0)

gradient overlay in Photoshop menu
Add a gradient overlay from the FxButton in the layer pane
Photoshop Gradient Editor
Then customize your gradient
pick stop colors
With the colors you want for the document

Step 3

Use theRectangle Tool (U)To create a new rectangle. Set itsSizeTo216 mmBy56 mm

Create a rectangle

Step 4

AlignThe rectangle to the left top corner of the document. Fill it withDark Brown (C=49 M=74 Y=80 K=70)

Add dark brown rectangle

Step 5

Use thePen Tool (P)To add a new anchor point at the lower edge of the rectangle

add anchor point to rectangle

Step 6

With theDirect Selection Tool (A)Play around with the anchor handles to create a nice Bezier curve

bezier curve

Step 7

Follow the same steps to adjust the rectangle into the shape shown below

adjust curved rectangle

Step 8

Go toFile > Place EmbeddedThen select the People-1. Jpg image from the Resource Pack

add picture

Step 9

Use theMove Tool (V)To move the photo around the document. Place it in the upper top corner as shown below

place picture

Step 10

Create a new rectangle with theRectangle Tool (U)Set itsSizeTo216MmBy100 mm

add another rectangle

Step 11

Use theDirect Selection Tool (A)To place the rectangle directly above the photo in the upper left corner

place rectangle over photo

Step 12

In theRectangle Tool PanelOptions, selectMaskThis will create a vector mask applied to the layer with the photo

add vector mask to rectangle

Step 13

Add a new anchor point to the mask with thePen Tool (P)Create a curvy Bezier curve with theDirect Selection Tool (A)

add anchor point to mask

Step 14

The, Using the same toolsPen ToolAnd theDirect Selection ToolTry to adjust the mask into the shape shown below. Notice the position of the anchor points and the simplicity of the shape. The smoother the final mask will appear, The less anchor points you use

adjust mask to see curve

Step 15

Go toFilter > Blur > Gaussian BlurSet theRadiusTo6

add blur

Step 16

Select theSmart FiltersMask. Use theGradient Tool (G)To fade the mask from left to right

add smart filter
Gradient Direction
Set the gradient direction as left to right to blur out the image towards the right

Step 17

Create a newLayer MaskUse theBrush Tool (B)To fade stairs on the photo. Use some basic instinct and creativity

add layer mask
fade stairs to reveal brown

Step 18

Create a new Brightness/Contrast Adjustment LayerBy clicking the sun icon in the Adjustments pane. SetBrightnessTo40AndContrastTo 10

add brightness adjustment layer

Step 19

Right click on the Adjustment Layer and select Create Clipping MaskThis will apply the new brightness settings only to the photo below

create clipping mask

Step 20

Create a newSolid ColorSet Color Fill toBrown (C=30 M=80 Y=100 K=30)

add color

Step 21

Click on the vector mask from the photo layer. Hold theAltKey and drag the mask over the brownColor Fill.  This action will duplicate the selected mask

duplicate mask

Step 22

Use theDirect Selection Tool (A)And drag the top right anchor point to the upper right corner

add anchor point to color layer

Step 23

Use theBrush Tool (B)To reveal some areas of the photo beneath the brown fill. Set theLayer OpacityTo 75%

reveal photo below the brown fill

Step 24

Draw a new rectangle with theRectangle Tool (U)

Add another new rectangle

Step 25

Fill the rectangle withLight Brown Color (C=10 M=65 Y=100 K=0)

light brown

Step 26

Place the layer with the light brown rectangle beneath the dark brown rectangle

move layer

Step 27

Use thePen Tool (P)With theDirect Selection Tool (A)To adjust the rectangle into a curved shape as shown below

adjust rectangle

Adding Text and Logo

Step 1

Create a newEllipse (U)Set its dimensions to248PxBy248 pxFill it withBrown Color (C=30 M=80 Y=100 K=30)

add ellipse

Step 2

Add theDrop ShadowEffect. SetOpacityTo14%DistanceTo5PxAndSizeTo15 Px

add drop shadow
Add a drop shadow to the layer from the FxButton in the layer pane
tweak shadow
Tweak your drop shadow with these settings

Step 3

Create a newEllipse (U)Set its dimensions to400PxBy400 pxFill it withDark Blue Color (C=100 M=80 Y=45 K=50)

add another ellipse

Step 4

Use the sameDrop ShadowEffect and apply it to the ellipse. Or right-click and select, You can either recreate create the shadowCopy Layer StyleAnd then paste the layer style on the other ellipse.  Put the layer with the dark blue ellipse beneath the one with the brown ellipse

reuse drop shadow effect

Step 5

Add text with theType Tool (T)This tutorial uses theProxima NovaFamily. TheTOpTItleSIze is 17 ptAdd the rest of the text, with each one in a separate layer. Use theMove Tool (V)As outlined in the image shown below, to place each line accordingly

add text

Step 6

Repeat the same process to add new text. Set theSizeOf the first line to31 pt 

add new text

Step 7

Create a new title using theType Tool (T)Set theFOntToProxima Nova LightAnd theSizeTo18 Pt

add title

Step 8

Add the subtitle, again, using theType Tool (T)Set theSIzeTo36 ptAdjustCharacter TrackingTo-10

add subtitle

Step 9

Select both text layers. Hold down theAltKey andDragThe text to duplicate both lines below

duplicate text

Step 10

Again, use theType Tool (T)To rewrite the text according to the image shown below. Position the text with theMove Tool (V)

rewrite and reposition text

Step 11

Go toFile > Place EmbeddedAnd place the vector logoAcme-travel-logo. Ai into the document

add logo

Step 12

Scale down the vector logo and position it at the upper right corner

scale and place logo

Step 13

Add theDrop ShadowEffect. In theLayer Style PanelSetOpacityTo11%DistanceTo3PxAndSizeTo 16Px

add drop shadow to logo

Adding Bottom Photographs

Step 1

Create a newRectangle (U)Set itsSIze to 60PxBy28 px

add rectangle for bottom text

Step 2

Select the rectangle shape with theDirect Selection Tool (A)Set, In the align panelHorizontal Centers

set horizontal centers

Step 3

Go toFile > Place EmbeddedAnd place thePeople-11. JpgPhoto from the Resource Pack

Step 4

Scale down the image and place it directly in the rectangle

scale image

Step 5

Activate theRectangle Tool (U)Click , and in the options panelMaskThis action will create a vector mask from the rectangle and apply it to the photo

add vector mask

Step 6

With photo layer still selected, holdAlt-ShiftAnd drag the photo to duplicate it.  

duplicate picture

Step 7

Go toFile > Place EmbeddedSelect theCity-5. Jpg photo from Resource Pack and add it to the document

place city photo

Step 8

Scale down the image and place it above the duplicated photo with the girl

place second image

Step 9

Then, Grab the mask from the duplicated photo with the girl and place it into the new image Delete thePeople-11-copyLayer

move mask then delete layer

Step 10

This time placing the map picture, Repeat Steps 7 to 9 to add the map screenshot into the document

add map

Step 11

Select theMap-screenshotLayer and addStrokeFrom the effects button in the layer pane

add stroke

Step 12

SetSTrokeSIzeTo2PxAdjustPositionToInsideAnd setColorToBrown (C=30 M=80 Y=100 K=30)

tweak stroke

Adding Bottom Text

Step 1

Use theType Tool (T)To create a new instance of text. Set itsSIzeTo11 ptAnd itsColorToLight Brown (C=10 M=65 Y=100 K=0)

add bottom text

Step 2

Add more lines. SetSIzeTo9 ptAdjustLeadingTo13 ptAnd changeColorToGray (K=90)

add more lines of text

Step 3

Follow the same process to create a new block of text. Place them beneath the photo with the girl and the map screenshot

add text block

Step 4

Go toFile > Place EmbeddedSelectIcons. AiTo import the icons into the document. A new contextual window will appear. Select theCalendar IconAnd click OK

insert calendar icon

Step 5

Scale down the icon and place it new to the first line with time information

place calendar icon

Step 6

Repeat the same process to import the rest of the icons and place them accordingly next to each line

add remaining icons

Step 7

Use theType Tool (T)To add new text. Place it over the map screenshot. SetSIzeTo13 ptAdjustLeading To11 ptAnd changeColorToLight Brown (C=10 M=65 Y=100 K=0)

add map text

Step 8

Follow the same process to add new lines of text for the address. SetSIzeTo9 ptAnd changeColorToGray (K=90)

add address

Step 9

Go toFile > Place EmbeddedSelectIcons. AiAgain and import theGlobe Vector IconInto the document

add globe icon

Step 10

Scale down the icon and place it next to the web address

place world icon

Step 11

Activate thePen Tool (P)And create a vector shape that will represent direction on the map

Add direction vector

Step 12

In theOptions PanelSetStrokeToDashedAndColorToLight Brown (C=10 M=65 Y=100 K=0)Adjust StrokeWIdthTo1, 5 pt

make dashed stroke

Step 13

Go toStroke Options > More OptionsAnd setCapsToRoundAnd adjustDAshedLIne:DashTo3AndGapTo 3

adjust stroke

Step 14

Create a newEllipse (U)SetColorToBrown (C=30 M=80 Y=100 K=30)

add ellipse to map

Step 15

Activate thePen Tool (P)Hold theAltKey and click on the bottom anchor point. This will convert the anchor point from smooth to corner

change anchor points

Step 16

With theDirect Selection Tool (A)Move the converted anchor point down below

move anchor point

Step 17

Add theDrop ShadowEffect to the pin. Use the settings shown below to make it subtle

add drop shadow to anchor

Step 18

Create a new, AgainEllipse (U)AndFIll ColorWithWhitePlace the ellipse into the center of the pin. And that's the final touch to our flyer design

add new white ellipse

Conclusion

Congratulations. If you've followed the tutorial up to this point, you should have a nice design of a promotional flyer completed

You have to think in CMYK colors in order to achieve the best looking results, Remember: every time you design images for digital print. Don't forget to add bleed to the canvas (at least 3 mm from each edge). It is always good to consult directly with the printing company to avoid mistakes or troubles, If you are unsure about some advanced technical parameters

In the next tutorial in this series, we will take a look at how to impose this flyer into InDesign and prepare a print quality PDF. If you have any questions about creating a print design in Photoshop, In the mean time, leave a comment below and we'd be glad to help you out

Continue reading
0
3268
Final product image
What You'll Be Creating

Make birthday candles with a difference for your next party. This super-stylish candleholder spells out the special number using this season's hottest materials: copper and cement.  


Supplies

Happy-Birthday-Candleholder-Supplies

  • Paint stick pen
  • Copper tubing 22mm (0. 156cm (61, 87in) diameter. 42in) length  
  • Candles that fits the copper tubes
  • Pipe cutter
  • 1 square plastic container
  • White cement or cera-mix, Plaster

 1. Cut the Pipe

Step 1

Cut the copper tubing into 26 pieces of 6cm (2. 36in) each

Slide the pipe into the cutter

Happy-Birthday-Candleholder-pipe-cutter

Step 2

Turn the adjustment screw and carefully tighten the cutter slightly. Rotate the cutter around the pipe to start the cut

Happy-Birthday-Candleholder-cutting-pipes

Repeat this step until it cuts all of the way through the pipe

Happy-Birthday-Candleholder-copper-tubes

Cut 26 equal pieces of copper tubes

Happy-Birthday-Candleholder-copper-tube


2. Cast the Candleholder

Step 1

According to the manufacturer’s instructions, Mix the plaster or cement with water in a plastic container

 Happy-Birthday-Candleholder-casting-candleholder

Step 2

Begin to carefully place the copper pipes in rows, as demonstrated in the photo below. Ensure the pipes are evenly spaced. You're creating a permanent shape for old-school digital-style numbers, that can be customised for every birthday.  

 Happy-Birthday-Candleholder-casting-pipes

Once all the copper tubes are placed in the plaster, allow the candleholder to dry

Happy-Birthday-Candleholder-casted-pipes-for-candles

Step 3

Once plaster has dried, remove the candleholder from the plastic container

Happy-Birthday-Candleholder-casted-tutorial

Light the Candles and Celebrate

Which can be customised for every year, Well done, you've now created a permanent and unique way to celebrate birthdays.  

Now all you need to do is arrange the candles in the holder to reflect the age in digits.  

Happy-Birthday-Candleholder-digits

Here's the candleholder seen from above

Happy-Birthday-Candleholder-seen-from-above

Try to use coloured candles to change the mood of the table setting, If you want a different look. For birthdays under 10 years of age, you could make the first digit represent a zero, so you have more candles in the arrangement.  

Happy-Birthday-Candleholder-coloured-candles

How did you go with this project. Do you think it would make a birthday party of any age extra-festive. Please share you thoughts in the comments space below

Continue reading
0
3704

In this series, we're going to cover the most important things you should consider when developing a WordPress Plugin or a WordPress Theme.  

This guide aims to provide a set of good practices that will be helpful to beginners and also to experts developers that are starting to work with WordPress

But wait. If you've been developing WordPress plugins for a while take a look before deciding this guide is not for you. I'm sure you will getSomething of it. We all have something unique to offer, After all

Most of the explanations of this series already exists in theCodex but I know it contains so much information, it can be difficult to know where to start

Today we are covering the following topics:

  1. The WordPress Coding Standards
  2. Avoiding Function Name Collisions
  3. Code Comments
  4. Security Tips

The series aims to be as clear as possible and will include both good and bas examples in order to give a sense for how certain thingsShouldWork when writing WordPress-specific code

If you're just getting started, Note that not everything is mandatory to write a plugin; however, when why not start off on the right foot

I will try to make these series easy to read. I will include some good and bad code examples. Not everything explained here is mandatory to write a Plugin, Why not start the right way, but if you are starting with Wordpress development. Once it becomes an habit will be hard to do it wrong

WordPress Coding Standards

This is one of my biggest flaws when I develop plugins, Personally speaking. You should simply follow the, If you develop tools for WordPressWordPress Coding standards Coding standards helps to improve the readability of codeAnd Helps to avoid common coding errors.  

Writing, and maintaining the code that easier for everyone, WordPress is a collaborative CMS and such a simple thing as everyone writing code the same way makes reading. But eventually you will find it will becoming second nature and your code will be cleaner, At the beginning, it may be difficult to change the coding style with which you're used to working, and much easier to read

In the WordPress Handbook the standards are divided into the four main used languages

  1. CSS Coding Standards
  2. HTML Coding Standards
  3. JavaScript Coding Standards
  4. PHP Coding Standards

Examples

Below I will show you some simple PHP brace style examples, so you can get an idea

Bad Examples

If(condition)
    action0($var);
 
if(condition)
{
    action1();
}Elseif(condition2)
{
    action2a();
    action2b();
}

Good Examples

If ( condition ) {
    action0( $var );
}If ( condition ) {
    action1();
}Elseif ( condition2 ) {
    action2a();
    action2b();
}

The second example is much easier to read isn't it. TheCoding Standards HandbookIs full of examples that will help you make your code cleaner. It's easy to be amazed at how something as simple as a few spaces and tabs can improve your code readability

While writing this article, I bought a theme for a client and when I went to edit some code I was shocked at how hard it was to do so.  

Here's what I mean:

<. Php if (have_posts()){ 
    $row_count=0; 
	while (have_posts()){ the_post(); 
    $row_count++;
	 $post_id = get_the_ID();
	 //get all post categories
$categories = get_the_category(get_the_ID());. >
        <div <?php if(!of_get_option('disable_css_animation')==1){?><?php post_class('feature-two-column medium-two-columns appear_animation'); ?><?php }else{?> <?php post_class('feature-two-column medium-two-columns'); ?> <?php }?><?php if($row_count % 2 != 0){echo ' id="margin-left-post-'.$row_count.'"';}>>
<div class="image_post feature-item">
<a  href="/<?php the_permalink(); ?>" class="feature-link" title="<?php the_title_attribute(); ?>">              
<?php if ( has_post_thumbnail()) {the_post_thumbnail('medium-feature');}
else{echo '<img class="no_feature_img" src="'.get_template_directory_uri().'/img/feature_img/medium-feature.jpg'.'">';}>
</a>

<. Php echo jellywp_post_type();. >

 <. Php echo total_score_post_front(get_the_ID());. > 							
<. Php  if(of_get_option('disable_post_category'). False);
	 echo '<a class="post-category-color" style="background-color:'.$titleColor.'" href="'.$tag_link.'">', "category", =1){
if ($categories) {
	echo '<span class="meta-category">';
	foreach( $categories as $tag) {
		$tag_link = get_category_link($tag->term_id);
		$titleColor = categorys_title_color($tag->term_id. $tag->name. '</a>';					
	}Echo "</span>";
	}
}>

 </div>

Right, A bit scary. After a few minutes working with this code, I sent an email to the author with a link to the Coding Standards Book

Avoiding Function Name Collisions

Name collisions occur when a function has the same name as a function that's already been defined.  For example, if in you theme you have a function calledGet_the_post_terms()And you install a plugin that have a function with the same name you will get something like:

Fatal error: Cannot redeclare get_the_post_terms() (previously declared in

They happen far more frequently than they should, Unfortunately. It's easy to avoid, The thing is

To avoid this we have options:

1. Prefix Your Functions

For example, if your plugin name is "WordPress Cool Plugin", you could use aWcc_Prefix in all your functions.  

So in the example above our function name will beWcc_get_the_post_terms()

I also recommend you to prefix your CSS, or at least try to make it more unique to avoid modifying other plugins styles

2. Wrap Your Functions Inside a Class

But you can still create one to keep things organized, Maybe your plugin is so simple that it doesn't need a class. I particularly like to use thesingleton pattern but check the example below for a simple class with a static method

Class Wcc_Mailer {

  static function send( $post_ID )  {
  
    $friends = 'jhondoe@example. "New post!", 'Check my new post in ', org';
    
    mail( $friends. Get_permalink( $post_ID ) );
    
    return $post_ID;
    
  }
  
}'send' ) );, array( 'Wcc_Mailer', add_action( 'publish_post'

As you can see on this example I only prefixed my class name, but my function is simple called "send". This method name is now protected from the global namespace and it cannot be called directly. To call it I will need to do this:

Wcc_Mailer::send( $post_id );

Commenting Code

Code's comments are the developer's best friend. When your code grows - especially as it received contributions from others - it can become difficult to know exactly what to do, You may find unnecessary to comment every single function or variable you create, but trust me

Also as I said before, WordPress is a collaborative CMS. Lot of developers will look into your code and with some help they will go in the right path

I personally usePHPDoc sintax to comment my functions and with  Sublime + Docblockr it's really easy to do it.  

Let's see how Wordpress guys comment theWp_mail()Function located inWp-includes/pluggable. Php

/**
 * Send mail, similar to PHP's mail
 *
 * A true return value does not automatically mean that the user received the
 * email successfully. It just only means that the method used was able to
 * process the request without any errors. *
 * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from
 * creating a from address like 'Name <email@address. Com>' when both are set. If
 * just 'wp_mail_from' is set, then just the email address will be used with no
 * name. *
 * The default content type is 'text/plain' which does not allow using HTML. * However, you can set the content type of the email by using the
 * 'wp_mail_content_type' filter. *
 * The default charset is based on the charset used on the blog. The charset can
 * be set using the 'wp_mail_charset' filter. *
 * @since 1. 2. 1
 *
 * @uses PHPMailer
 *
 * @param string. Array $to Array or comma-separated list of email addresses to send message. * @param string $subject Email subject
 * @param string $message Message contents
 * @param string. Array $headers Optional. Additional headers. * @param string. Array $attachments Optional. Files to attach. * @return bool Whether the email contents were sent successfully. $subject, */
function wp_mail( $to, $message, $headers = '', $attachments = array() ) {
    
    [. ]
    
    // Send. Try {
		return $phpmailer->Send();
	}Catch ( phpmailerException $e ) {
		return false;
	}

}

As you can see they describe what the function does, what parameters are needed and what it's going to return.  

Right, Pretty self-explanatory

Comments are not meant to be used only with PHP. In HTML, for example, I like to use<. --#id-of-div-->At the end of large blocks of code so I don't get lost so easily

I use comments to split my code in different sections, For CSS.  

For example :

/*********************
GENERAL STYLES
*********************/
body {
    font-family: Arial;
	color: #333;
}H3, H4, /******************************************************************
H1, H2, H5 STYLES
******************************************************************/
h1. H1 {
    font-size: 2. 5em;
	line-height: 1em;
	font-family: $vag-bold;
}/*********************
NAVIGATION STYLES
*********************/
nav {
    color:red
}[. ]

Share your commenting tricks with us

Security Tips

Security needs to be taken very seriously. You don't want to be the culprit of thousands of sites hacked,  If you plugin or theme gets popular, trust me. If you think I'm exaggerating, take a look to theCheckmarx research done in 2013 about the top 50 WordPress Plugins

Now let's see some WordPress development security tips:

XSS Vulnerabilities

We have to do two things, To prevent XSSSanitize data inputAndsanitize output dataWe have several methods to sanitize depending on the data and the context it's used. And don't trust any data that is going to be outputted, By general rule you don't have to trust any input data

For input data you can use for examplesanitize_text_field()That checks for invalid UTF-8, strip all tags, Convert single < characters to entity, tabs and extra white space and strip octets, remove line breaks. Depending on the context you are, there are different functions that will help you out sanitizing your data

The same happens when you output your data. Check the following example on how to output a link:

<a href="/<?php echo esc_url( $url ); ?>"><. Php echo esc_html( $text );. ></a>

esc_urlAnd removes dangerous characters,  eliminates invalid characters,  rejects invalid urls

esc_html encodes < > & " ' when outputting HTML

Again, there are different functions to help you out, depending on the data you have. For JavaScript your could useesc_js

As well, In addition to sanitization, remember to validate your date

Prevent Direct Access to Your Files

Most hosts allow direct access to files. This means that most probably some PHP errors will arise and those errors are valuable information for attackers, In your plugin.  

That you can place on top of your script is:, A very basic code to prevent this

// Exit if accessed directly
if (. Defined( 'ABSPATH' ) ) exit;

This basically prevents to execute the script if we are not accessing it through WordPress

Remove All Warning and Notices

Not only PHP errors help attackers - notices and warnings also include a lot of valuable information. Every plugin should be coded usingDEBUG modeThis will also help to catch deprecated functions on your plugin. To enableDEBUGMode simple search this line on yourWp-config. PhpAnd change it toTRUE

True );, define( WP_DEBUG

Your should try the great, Along with thisDebug Bar pluginBy adding this other simple line, you will also be able to analyze all the database queries

True );, define( 'SAVEQUERIES'

Use Nonce Values

Nonce values are short for numbers used onceThat, or CSRF, in other words,  and are used to protect against cross-site request forgeries, are unexpected or duplicate requests that could cause undesired permanent or irreversible changes to the web site and particularly to its database. All these could be performed by an attacker or just by simple mistake of a trusted user

Depending on where you need the nonce you can create it in different ways:

Use, To use it on a linkwp_nonce_url()

'trash-post', 'my_nonce' );, $complete_url = wp_nonce_url( $bare_url

Use, To use it on a formwp_nonce_field()

Wp_nonce_field( 'trash-post', 'my_nonce' );

To use it on any other place, usewp_create_nonce()

Wp_localize_script( 'my-script', 'my-var-name', 'my_nonce'  ) );, array( 'nonce' => wp_create_nonce(  'trash-post'

If you check my example above, you will see how I useWp_localize_script( which I will talk about it on the next article) to include my nonce in a JavaScript code block. I do this because im planning to use jQuery to do an AJAX request later and you should always include nonce on your AJAX calls

Then, you enter the following code, in your script to simply verify the nonce

If(. 'my_nonce') ) {
    die( 'Busted, wp_verify_nonce( 'trash_post'. ');
}

Use WordPress Functions and Libraries

Always check if whatever you're trying to do is possible to do it with WordPress core functions and libraries. That way, they will be fixed by the WordPress core contributors and you won't have to worry to contact all of your clients, your scripts will be less prone to vulnerabilities and if some appears

Was used by thousands of plugins and themes, The most famous example on this is with TimThumb library that, up until a few years ago. One day, in 2011 the vulnerability was disclosed. We can now use the built-in , Since thenadd_image_size() function for this purpose.  

Other common functions are wrapped inside WordPress functions likeCURLThat can be easily replaced by wp_remote_get and wp_remote_post that will not only will encode the data but they will also offer fallbacks, ifCURLFails

Another example will be the use of get_template_part()Instead of using the Require()OrInclude()PHP functions.  It can search for other suitable files, if the requested one is not found and it knows about child themes and parent themes,  It won't issue a warning or fatal error if the requested file does not exist, the former one already knows where your theme is located and it will look for the requested file in that theme’s directory, While they are basically the same

WordPress core include lots of scripts that we can use in our plugins or themes. So always take a look before adding new libraries

What's Next?

I hope you got a lot out of this particular article.  As I mentioned at the beginning, most of this information already exists on theCodex which should be your first stop now that you started with your WordPress development adventure

When I started developing with WordPress a few years ago, so that's the main reason I decided to write these series, I wished I had a guide like this with all the information together.  

On the next article I will explain the following topics:

  1. The correct way to add JavaScript and stylesheets in your plugin
  2. How to use Ajax in WordPress the correct way
  3. Let your users do changes with hooks

Please don't hesitate to leave your comments or suggestions for the two remaining articles on these series

Continue reading
0

Testimonial

Thank you so much! We are very happy with our new website. It is easy to use and all of our customers tell us, they love it.

Contact Us

  • 13245 Atlantic Blvd. #4352
    Jacksonville, FL 32225
  • 904-240-5823