WordAds, when will it be introduced on JetPack for self-hosted WordPress Users?

As defined by WordPress,

WordAds is the official WordPress.com advertising program which lets you monetize your hosted blog.

Here is more about WordAds if you like to read more details.

WordAds has been introduced to WordPress on Nov 29, 2011 and since then is running on more than ten thousand sites.

The only problem is that WordAds at the moment is only enabled for users hosting their sites on WordPress, this excludes all the millions of  sites who are hosting a WordPress blog on their own servers.

Update:

I just went to WordAds site http://wordads.co/plugin-setup/ and it seems that WordPress have already enabled the Beta program for self hosted WordPress users having jetpack.

Also I went to here http://wordads.co/signup/ and I am able to apply my site to WordAds…

This means that WordAds is already active on Jetpack. Too bad I don’t have enough visitors on notesfromanerd.com to apply to WordAds. So who knows, :), maybe sometime in the future

 

Mixing running with programming with video editing…

so here is what i’ve been up to…

One of my favorite hobbies is running and of course programming is another. I have recently started recording my Starcraft II Heart of the Swarm videos and I had to commentate my games and edit and upload them to youtube… so in the process of doing all that, i discovered i had a new hobby which is video editing.

So what does a nerd with three such hobbies do? Mix it all together and the result is this:

Standard Chartered Dubai Marathon 2014

 

So what is so special about this video? Good question, and here is your answer:

  1. The video was taken while I was running a full marathon, 42.195 km or shall we say 26.2 Miles for my dear american readers who have no idea what a KM is :p. (i.e. first hobby running)
  2. I had to edit the video to remove the bad footage and put it all together. (i.e. second hobby video editing)
  3. I used programming to
    1. sync and embed (distance, elapsed time, elapsed distance) from my GPS enabled Garmin watch  with my video (i.e. third hobby programming)
    2. extract each runner’s info from the Dubai marathon results page and then sync and embed it with my video  (i.e. third hobby programming)

 

Here is how I did it:

1- I used php code to crawl the results pages from here : dubai.mikatiming.de/2014/ and save them into a csv file

2- After editing my video footage, I wrote down each runners bib, example, 2384,3:53… it means load the info of runner 2384 at the 3 minutes and 53 seconds of the video. I saved this info in a csv

3- During my run, I video taped my watch at the start of the race to know which point does my video and watch coincide at. Then I defined these coinciding points in another csv file.

4- I used extended script in After effects to programmatically create the compositions, solids and text boxes, create key frames, add opacity transitions based on the csv files in steps 1, 2 and 3…

… I rendered the video and here we are…

If you have any questions, or need help doing a similar project, or would like to see some sample code, please feel free to comment on this post and I’ll happy to answer your questions.

The overwhelming digital life of 2013

Yes… Overwhelming, why?

The world seems to be spinning faster, the days are getting shorter and there is simply too many things to do in 24 hours…

I graduated in 2005 as an Electrical Engineer/ Communication and Electronics major, but after 5 years of study, 2000 – 2005 and a 7 years working in the Engineering Industry 2005 to 2013, I found my passion in the IT world, the world which is moving at the speed of light.

I’ve been always a nerdy techy, or that is what i thought. This is what I thought, until i saw other people’s achievements in the world of technology, there is just too much to learn, in blogging/ content management systems blogger, wordpress, drupal, joomla, wix, tumbler, there are just thousands of software platforms, there are too many programming / scripting languages, VBA, ASP.NET, PHP, C#, C++, Java, JavaScript… The mobile technology is moving too fast… I feel that my world is spinning so fast… I feel my days are too short to become a real expert in any of that, and in a very competitive world, mediocrity is a spell for failure.

How do you cope with the fast pace of technology? how do you manage to become an expert in ANYTHING AT ALL if the fast pace of technology is forcing you forward without a chance to go deep to any topic at all?

I am back… whats new?

So, It has been forever seen my last post… many things have changed since last year… Here is a short update:

  • 7 Months ago, I decided to take along unpaid leave to pursue my entrepreneurship dream
  • I designed a new site from scratch. Enjoyed every programming moment, but the results were not really what I expected. In short, the site wasn’t a huge success, so I had to consider Plan B
  • I started searching for a new job and that is how I came across countless job sites, job search engines and job fairs, I tried to take advantage of the experience, so I created another site, Career Watch, that should be useful to anyone who is looking for a job as well.
  • So here I am… after 7 months of hard work, back to square 1… or maybe square zero. Why? I lost half my savings, My websites aren’t doing that well and I simply have to go back to my old job.

 

So I am back, and this time, I am back and I will be blogging daily. I decided to make this blog more casual, less serious. It doesn’t have to be just about programming, web development and IT related topics. It will be really just “notes from a nerd”… If I learn sometime new, I will blog about it, If not, I will just share my thoughts, my plans, my dreams.

Loop though and process all open excel workbooks using VBA

The code below does the following:

  1. Loop though all open Excel workbooks in Excel
  2. Sequentially activate each of the workbook
  3. Do some processing related to the active workbook
  4. Save the workbook then move on to the next workbook
Sub Loop_through_all_workbooks()
   Dim wb As Workbook, x As String
   For Each wb In Workbooks
      If wb.Name  ThisWorkbook.Name Then
         x = wb.Name
         Workbooks(x).Activate
      End If 
      Call Do_some_actions() 
      Call ActiveWorkbook.Save
   Next wb 
End Sub 

Sub do_some_actions
   'here goes some code to be executed in the activeworkbook
End Sub

Loop through all sheets in an open excel workbook using VBA

The code below does the following:

  1. Loops through all sheets in the active excel workbooks
  2. activates each of the sheets
  3. calls myFunction subroutine (which would normally be a set of actions done in the active sheet)
Sub myMainProgram ()
   For i = 1 To Sheets.count
      Sheets(i).Activate
      Call myFunction()
   Next i
End Sub

Sub myFunction ()
   'Do something in my activesheet
End Sub

Load a range of non blank excel cells into an array in VBA

The code below will allow you to

  1. Define a range of cells in excel that contain data ( are non-blanks)
  2. Load the data into an array
  3. Loop through the data (… process the records as needed….)
Sub read_nonblank_cells()
   firstrow = Cells.Find("*", SearchOrder:=xlByRows, LookIn:=xlValues, SearchDirection:=xlNext).Row
   firstcolumn = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlNext).Column
   lastrow = Cells.Find("*", SearchOrder:=xlByRows, LookIn:=xlValues, SearchDirection:=xlPrevious).Row
   lastcolumn = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPrevious).Column
   Dim arrData() As Variant 
   arrData = ActiveSheet.Range(Cells(firstrow, firstcolumn), Cells(lastrow, lastcolumn)).Value
   countarray = UBound(arrData)
   For i = 1 To countarray
      ' Do something with your array
      ' each column of data could be addressed with its index
      ' as follows: arrData(i,n)
      ' where n is your column number

Next i End Sub

Limited Connectivity (No Internet Connection) on my Wireless Router

The problem: Limited Connectivity (No Internet Connection)

For more than one year, I had to restart my wireless router for more than 1000 times, just to be able to connect two of my laptops and my phone to the internet. This was really a pain in the ass, because even if I shutdown my laptop then i turn it on, I wouldn’t be able to connect to the internet again unless I restart my router. Even worse, every time my android phone automatically disabled the phone’s wireless to save battery, this meant I had to restart my wireless router again to be able to reconnect my phone to the internet…

All that was until I decided to stop being lazy and do some research on the issue and now the problem is solved and I feel great. If you have a similar problem, then read on and learn how to fix this issue.

Scenario: Multiple Laptops and a smart phone connected to the internet through a Wireless Router

My ISP has provided a DSL Modem to my house, which had no wireless interface and instead had LAN interface to multiple ports through the house . Therefore I had to buy my own wireless router ( in my case: I used ADSL DLINK – 2640 T which I had at home from a previous ISP). This was a wireless DSL Modem with multiple Lan output/input and a wireless interface. So by connecting my ISP’s Lan output to my wireless router input, The router acted as a repeater and I could connect all my devices to it.

How I resolved the problem!

The solution was as easy as disabling my DHCP

The ISP’s DSL Modem was already handling the DHCP for me, so keeping the DHCP enabled in my wireless router was a mistake. Snapshots below show how you can do it on Dlink 2640t. It should be easy for you to find out how to do it in different routers.

Different Scenarios: I still Can’t connect to the internet

While doing my research, I was able to find some common issues many people are facing.

So, If you have a different setup and in the case where your DSL modem is also your wireless router. Try the following:

  • Change DHCP lease time:

    Router Automatically Disconnects my devices, then try to change the DHCP to enabled and set the lease time in the DHCP menu to 99999 instead of 3600.

  • Upgrading Wireless Router Firmware:

    (Only do this at your own risk!!! If something goes wrong, recovering your old firmware might not be an option) If all the above doesn’t work even though you are confident that you have properly setup your wireless router, then it is possible that upgrading the firmware of the wireless router could help. Usually vendors release updated firmwares where known and common bugs are fixes. You can do that by:

  • 1- Visit the vendor’s website, for example dlink.com and search for firmware updates corresponding to the model of your wireless router.

    2- Download the firmware image.

    3- Log in to your wireless device and update the firmware by using the web interface to upload the downloaded firmware image

    Caution:

    1- Only use trusted firmware from a known website, in my case, i found the firmware of Dlink 2640t by searching “dlink ftp server firmware 2640t” which finally led me to this link (ftp://ftp.dlink-me.com/DLink_ME/ADSL/DSL-2640T/Firmwares)
    2- Updating your firmware might reset your configuration, so be sure to have your DSL login information ready in case you loose it + remember to setup your admin password again + your wireless password…

Goodluck, Hope this helps, Please leave a comment if this is helpful to you, It would really make me happy to know that my notes made someone’s life easier :), Thanks

Basic shell commands

Print Text into the standard output

In case you have a variable, use:
echo $variablename

In case you want to print a text prompting a user, use:
echo This text will be printed on the screen

or you may use if you need to space at the end of the line:
echo "This text will be printed on the screen: "

Read Variables from standard input

Read a single variable:

read something
when executing the above shell command, the terminal will pause and wait for user’s input.

Once the user inputs some text and presses enter, the text will be stored in a variable name called $something.

Read multiple variables:

read something1 something2 something3

If user inputs: word1 word2 word3 then it is equivalent to,
$something1 =”word1″
$something2 =”word2″
$something3 =”word3″

If user inputs: word1 then it is equivalent to,
$something1 =”word1″
$something2 =””
$something3 =””

If user inputs: word1 word2 word3 word4 word5 then it is equivalent to,
$something1 =”word1″
$something2 =”word2″
$something3 =”word3 word4 word5″

Output Redirection

the “>” redirects the output into a new file / replaces existing file.

ls -ltr > filelist

The above would save the output of the “ls -ltr” into the filelist file.

the “>>” Appends the standard output of a command into existing file.


echo the above was a list of files found inside the directory: >> filelist
pwd >> filelist

The above would append the output of the first echo statement and the folder path returned by pwd into filelist.

Pipeline commands

Pipeline is the process of using the standard output of one shell program as the standard input of another. This can be done by the usage of the character “|”

program1 | program2

In the above case, the output of program1 is used as input to program2.

Getting an input from a file

To use a file as an input to a script or program requiring standard input, use the “<" character.

Example:
Read filedata < filelist

The above command would place the content of the first line of filelist into $filedata variable.

Listing system processes and displaying memory & CPU usage

System Processes

To list the running processes from within a terminal/ shell, type the command top.


/$ top

OUTPUT:
top - 21:23:56 up 5:25, 3 users, load average: 0.04, 0.08, 0.27
Tasks: 195 total, 1 running, 194 sleeping, 0 stopped, 0 zombie
Cpu(s): 9.1%us, 2.1%sy, 0.0%ni, 88.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3025620k total, 2349540k used, 676080k free, 86940k buffers
Swap: 13631116k total, 0k used, 13631116k free, 1798184k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1473 root 20 0 81692 33m 14m S 10 1.1 11:38.01 Xorg
4659 root 20 0 93804 22m 17m S 13 0.8 0:20.23 gnome-system-mo
3632 root 20 0 95176 14m 10m S 4 0.5 0:07.93 gnome-terminal
...
...
...

Memory usage

vmstat n gives the memory usage cyclically every “n” seconds.
Example

/$ vmstat 3

Sample output:
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 542736 90120 1815648 0 0 30 47 417 13 22 3 75 1
1 0 0 542604 90120 1815660 0 0 0 0 222 360 0 1 99 0
0 0 0 542604 90140 1815660 0 0 0 45 239 416 0 1 97 2

CPU usage

Similarly, iostat command is used to monitor the CPU usage.

/$ iostat n

Design a site like this with WordPress.com
Get started