Thursday, May 30, 2013

More wp theme progress

So I added the featured image widget box to the post page by following the instructions on here: http://codex.wordpress.org/Post_Thumbnails

I changed the post loop of the first-letter.php since my last post to this: http://pastebin.com/T4Jb0VB5 With this change the posts will be split into two separate unordered lists (col1, col2).  I found that you can get the amount of posts after a query by using the code from this thread: http://wordpress.org/support/topic/count-query_posts

The rest of today I spent styling the theme.  I managed to get the structure nice and neat and started going into the details of things.  Here's what I'm ending with today:

As you can see it's actually looking somewhat like the original design now.  Tomorrow is definitely the day I finish for sure (idk if it's Friday).

Sorting posts by first letter in Wordpress

So after taking a look at pieces of code I printed out from this amazing tutorial: http://wp.tutsplus.com/tutorials/getting-loopy-ajax-powered-loops-with-jquery-and-wordpress/

I figured out how to display posts by the letter of the button they click on.  To start, in my index.php, I inserted this above the post loop I had before:
<?php $l = 'A';?>
<div id="sort-by">
<a name="0-9">0-9</a>
<?php
while (strlen($l) <= 1) {
?> <a name="<?php echo $l; ?>"><?php echo $l; ?></a><?php
++$l;
}
?>
</div> <!-- #sort-by -->

<div id="alphebatized">
</div> <!-- #alphebatized -->


The while loop loops though all the uppercase letters by simply adding 1 to $l and prevents it from going past Z by checking if its length is >= 1.  The alphebatized div is where all the posts for the letter selected will go.

I've added a couple functions to my functions.php that were posted by the moderator on here: http://wordpress.org/support/topic/what-argument-to-use-in-query_posts-to-get-posts-with-given-letter
These functions allow you to query letters using the query_posts function: http://codex.wordpress.org/Function_Reference/query_posts

Then I created a javascript file, named active.js, put it in the js directory and added the following code to it: http://pastebin.com/pu2dCRsJ
This makes heavy use of .ajax() which is put into a function and assigned to the load_posts var for use.      Before the GET request is sent, the content (list of posts) will fade out quickly.  After, when the request gets sent the content, and then the data, will fade in quickly.  Any existing content is also cleared and the content for the newly selected letter gets appended to it.  Since this function is loaded on page load, there won't be a value for l.  So when this is the case l automatically equals 'a'.  The request gets sent to my first-letter.php.

Lastly, for my first-letter.php I have the following code: http://pastebin.com/Py6SvX0b
This just grabs the letter from the request, puts it in a query_posts, and then prints out all the matching posts.  wp_reset_query() is added to reset query_posts for the other loop in index.php.


So as of now I see no problems with this so I'm going onto styling everything with css.  I hope to be done by very late tonight.

Wednesday, May 29, 2013

wordpress conversion day 4

I switched from the ad plugin I had before to this one: http://wordpress.org/plugins/ad-codez-widget/

I also added a tertiary sidebar to the site by adding the following to animeseries_widgets_init() in functions.php:
register_sidebar( array(
'name' => __( 'Secondary Widget Area', 'shape' ),
'id' => 'sidebar-2',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );


Plan is to work with existing css.  Delete colliding css during/after theme is done.

Now onto querying posts by the letter they start with... http://wordpress.org/support/topic/what-argument-to-use-in-query_posts-to-get-posts-with-given-letter

Okay when I started typing this post it was 8pm.  It's now 1am and I'm still stuck on the alphabetized post issue.  I've found a way to filter the posts by letter but now I need to figure out how to make the posts update by letter via button click using ajax.  This has been very aggravating and I'm too tired to continue trying things that I know won't work.  So day 4, I got stuck again, but once I finish this the rest of the template is just css and although that can be frustrating too, it's nowhere near as annoying.

Tuesday, May 28, 2013

Conversion continues

Didn't get any work done yesterday because I was too miserable.  This is because I fell asleep on the beach (with no sunscreen on) and awoke with my entire back straight red.  Today I did yesterdays work and jotted down different dimensions and margins/padding.  I've also jotted down some css notes and planned out a couple other things as well.  I'm contemplating hardcoding the chatbox into the aside so it stays out of the tertiary, secondary and other sections of the sidebar.  This way I can easily align everything with the content-sidebar-sidebar css from here: http://themeshaper.com/2012/11/12/how-to-reset-rebuild-wordpress-theme-css-define-your-layouts/

As for chatbox plugins this appears to be what I need: http://wordpress.org/plugins/schreikasten/screenshots/

I'm not sure how I'll hardcode it but I don't think it will be too difficult.  I'll probably just need to put the plugin files in my theme directory instead and put the code that it would normally insert on its own into the sidebar.php.  This is all well documented here: http://themeshaper.com/2012/11/08/the-wordpress-theme-sidebar-and-footer-templates/

So today is day 3 and there's little to nothing done (mainly because I've been studying all day today for a calc quiz I need to pass the marking period tomorrow).  This means that tomorrow and the day after will be a couple power work days (no sleep).  Guess that's it.

Sunday, May 26, 2013

Working with wordpress again

Today I set up a new wordpress directory in my localhost and a new _s theme in preparation for a new  theme I'm working on.  Once I complete this I might have a paid gig or two in store for me but I'm unsure if they'll still be available by the time I finish this free one.

btw I downloaded _s theme from here: http://underscores.me/
And upon installing the theme I found that I needed to fix line 151 in the functions.php by adding a /* in  front of line 150.

Here's a picture of the design (I marked it up to protect from any rippers since it isn't coded yet):

Top menu (that stretches 100%) will be hardcoded with options (in the theme's options panel) to set the twitter link, and enable disable it or the rss feed, and a search bar will be floating to the right of it.  Then below there's a container containing the logo with the menu floating to the left of it.  Inside this white transparent container will be another container that holds all the content.

As you can see this template wouldn't be like a traditional theme.  Rather than having the latest posts as the main focus would be an A-Z index listing.  This will probably come in handy with coding that: https://bountify.co/a-z-index-listing-of-all-posts-and-pages-with-wordpress
Then there's the latest posts (or the post loop) underneath that only showing the latest 4 and separated into two columns.

The sidebar is separated into two columns.  The first widget, a chatbox, takes up both columns (code for this can be grabbed from somewhere).  Then there's the newest episodes (recent posts widget), popular episodes (this widget: http://wordpress.org/plugins/wordpress-popular-posts/), and the sponsored links next to both of these (http://wordpress.org/plugins/html-javascript-adder/).

The footer will also stretch 100% and will most likely be hardcoded because I'm looking to finish this asap.  It also has some weird watermark in the background.

This doesn't look very challenging to code but looks can be deceiving and only god knows what I'll find challenging with this in the near future.  I'm going to start the css from scratch (besides the reset css) so I know what's going on.  Tomorrow, as with all the other designs (only a couple really), I'm going to print out three copies.  One copy I'll mark dimensions.  One I'll mark padding/margins.  Another I'll mark html/php.

I'm looking to complete this in 5 days max.  For any readers out there, wish me luck.

Saturday, May 25, 2013

Finished design and js annoyances

Today I spent majority of my time browsing wj/hf/tbn and fixing an older html template.  Btw here's the website that I finished recently:

I know you might not like the design but that was all by the person that provided it too me.  All I did was code it exactly the way he specified (and there were plenty of specifications).

Other than that while fixing another template I found that when you get a repeating decimal in js you'll just get the NaN result.  While trying to resize images according to the width of the container they were in and their margin-right I kept getting the damn NaN.  I tried avoiding it but eventually gave up ending with this code:
var imageCount = $('.slider-wrapper img').length;
var marginRight = $('#thumbnails div').css('margin-right').replace('px', '');
var width = $('#thumbnails').css('width').replace('px', '');
var thumbLength;

width = width - (imageCount * marginRight);
thumbLength = width / imageCount;
$('#thumbnails div').css('width', ((+thumbLength).toFixed(1)).replace(/^-?\d*\.?|0+$/g, '').length);


This line: ((+thumbLength).toFixed(1)).replace(/^-?\d*\.?|0+$/g, '').length
Was supposed to round for me so it wouldn't return that NaN but that didn't work.  It would just return 1.  btw I've also tried Math.Round, Floor, and Ceil and none of them worked either.  I'm just really aggravated that js doesn't have something to round off repeating decimals automatically like many other languages have.

Other than that I've been looking to buy a high potential (for earnings from adsense) website for cheap.  I didn't expect to find any today but I'm going to keep an eye open for any good deals.  It'd be nice to get a website where majority of the work is done and I only need to mod a couple things to start earning.  I'm too tired to really code anything today so I'm going back to browsing till I pass out.  Pce.

Friday, May 24, 2013

New Design - Day 3 & 4

I didn't get to post this last night, but after two days I finished the new design.  Once again though, I can't post it until I mod everything to the owner's liking and he uploads it somewhere.  However these are the new (ones I haven't already posted) that have helped me achieve my goal of finishing it:
I feel as though I've gotten much more comfortable with jQuery.  For example, yesterday I wrote this function for animating the background color of elements in 5 minutes:

function animateBG(selector, changeColor, startColor){
$(selector).hover(function(){
$(this).animate({ backgroundColor: changeColor }, 'fast');
});
$(selector).mouseleave(function(){
$(this).animate({ backgroundColor: startColor }, 'fast');
});
}



So an example of me using the code would be:
animateBG('#login_box a', '#c53939', '#b61e1e');

One thing I probably should have used more in the past but just remembered recently was google fonts: http://www.google.com/fonts/

With google fonts I no longer need to store the fonts on my server and can load it straight from theirs in my css.  I'm not positive that it's faster but it should be according to my common sense.

So I'll edit this post with the website/design once it's complete.  Pce for now.

Tuesday, May 21, 2013

New design - day two

Today is day two of working on the design and I:

  • Typed out all the markup.
  • Sliced all the images I'm going to need.
  • Found all the css shadows (including inset ones) I'm going to need using this site: http://www.css3maker.com/box-shadow.html
  • Found all the fonts I'm going to use and included them in the font directory/in the css.
Tomorrow I'm finishing the style and trying to finish all the jquery/js as well.  Boring day and not much else to post so pce

Monday, May 20, 2013

New design!

Someone on WJ finally responded and gave me a psd they needed coded.  Although it won't be functional, the site will appear to be a link securer site.  The only things I've done tonight are:

  • written down dimensions for elements
  • written down spaces/padding in and between elements
  • written down the html tags I'd think I'd use for each element
I will need to use some jquery for a dropdown login box.  This article will help guide me in the direction of accomplishing that: http://www.red-team-design.com/simple-and-effective-dropdown-login-box

Tomorrow I will put everything into code and hopefully finish that night.  As for the rest of tonight, I'm exceptionally tired for whatever reason, so I'm going to bed.

Sunday, May 19, 2013

Brushing up on php

Well, I still haven't written any articles for that articleport blog yet (I need $$$ motivation) but I will eventually.  As procrastination though I'm going to be brushing up on my php tonight and the next few nights (depending on what I finish today) through phpacademy: https://phpacademy.org/.  Today's notes will be posted below...

Tutorial one - unique hit counter | Part1: http://www.youtube.com/watch?v=BFv6wa7Xgh8

  • They're starting off telling you they're going to make a hit counter (keeping track of ips) but it's keeping the ips in a text file which is bandwidth wasting and moronic compared to using a db.  I'll go along with it for now though to learn the php file methods they'll be teaching.
  • This tutorial uses an index.php, ip.txt and a counter.txt.
  • Now I've declared two vars $filename and $ip_filename and assigned them to 'counter.txt' and 'ip.txt'.
  • Next I declared a function and declared the two vars as global inside of them to make it "global to the function to use it inside".  I'm not sure I'd have to do this and I think this is unnecessary but who am I to judge?  I'll test that out later.
  • Then above this and in the function, I'm making an $ip var and assigning it $_SERVER['REMOTEADDR'] which is the users ip.
  • Next we are creating $current_value = () ? : ;
    • In () goes the condition to be evaluated.
    • After the ? goes the code for if the condition is true.
    • After the : goes the code for if the condition is false.
  • $current_value = (file_exists($filename)) ? file_get_contents($filename) : 0 ;
    • file_exists obviously checks if counter.txt exists and file_get_contents obviously grabs the text from it if it exists which should be a number else it returns 0.
  • file_put_contents($filename, ++$current_value);
    • Adds 1 to the value retrieved from counter.txt.
The video is over and the current code is: http://pastebin.com/JzFbHgcr  Upon running it, the code works and 1 is added to counter.txt every reload.

Tutorial one - unique hit counter | Part2: http://www.youtube.com/watch?v=xkJI3TNQ9uk
  • For video 2, as you might have guessed, the goal is to check for the ip in the ip.txt and add it if it's not there and add one to the counter.  If it is already there it will do nothing.
  • To start off, they wrapped the $current_value and file_put_contents in: if(!in_array($ip, file($ip_filename, FILE_IGNORE_NEW_LINES))) { }
    • in_array checks if a string is in an array.  With the ! in front it's saying if it isn't in the array then do whatever.
    • $ip will be the users ip to check in the ip.txt text array.
    • file() retrieves a text array and FILE_IGNORE_NEW_LINES will prevent white spaces in this array.
  • Then they insert, file_put_contents($ip_filename, $ip."\n", FILE_APPEND);, in the loop.
    • This adds the ip + a newline to the file.  FILE_APPEND makes sure you append to the file and not rewrite it like you do with the counter.txt.
  • lol then the guy in the video figures out he spelled "ignore" wrong.  Tired people these days...
Anyways when he runs it again it works so the final code is: http://pastebin.com/DWJHbGXG

I'm done with tutorials for today (I know it was just one but summarizing is hard work for a lazy person).  I did all this in a new folder on my localhost (I use wampserver).  This taught me a couple cool methods for future use but nothing amazing.  Those include:
The rest of tonight I'm just derping around my usual forums.  Post more about this tomorrow if no one responds to my free psd to html service still.

Saturday, May 18, 2013

Today.

I finished the website and uploaded it to the server.  The person I made it for hasn't uploaded their content to it yet though so I'm not going to post a link for you guys yet.  One problem I have noticed though, is that one of the effects causes nivo to glitch out.  This problem didn't appear on my localhost but rather than fixing it I set nivo to just use the working fade effect.  All the other effects were a bit much for such a small page anyways.

I also created my freelancer.com profile today and added the things I've done to my portfolio on there. I still think that my portfolio is lacking too much too get hired by anyone on there though.  This is why I'm looking to build it up before I get started with anything serious.  I've been offering one service for free psd to html conversion already on tbn and gs but I've had 0 takers!  I can understand not having any on gs but I was sure people on tbn would need this: http://thebotnet.com/user-giveaways/199042-free-psd-to-html5-conversion/  If no one takes it within the next few days I'll just bring this to wj instead where I can hopefully get some takers.

Not only am I offering web development services but I'm also offering article writing/rewriting as well.  However, I'm too lazy to even start building up a portfolio on this.  Along with writing articles I'm offering vb.net and java coding services too.  Unfortunately, I've found that majority of the projects on there involving these languages are much too complex/time consuming at this point.

Right now I'm a little motivated though, so I'm going to create a new blog and rewrite some articles I find.  The url is here: http://articleport.blogspot.com/

omw to the other blog now.  Pce niggs.

Friday, May 17, 2013

Messin with nivo

I know, it's been a few days since I last posted.  This is because I was busy getting frustrated trying to create a jquery image slideshow/gallery from scratch.  All this frustration caused me to give up and just make a few modifications to nivo slider: http://dev7studios.com/nivo-slider/

How did I mod it?  Before I start, here are some links I found useful during modding it (or for other things as well):

The first thing I figured out how to do was create custom next/previous buttons.  To do this you just create you're custom ones then do the following in js after setting the nivo slider button's display to none in css:

$("a.previous").click(function(){$(".nivo-directionNav .nivo-prevNav").click()})
$("a.next").click(function(){$(".nivo-directionNav .nivo-nextNav").click()})

Then I used the following to generate thumbs and put them in the thumbnails div:

$('#thumbnails').html(function(){
var html = "";
var i = 0;
$('.slider-wrapper img').each(function(){
html = html + "<div class='" + i + "'>\n";
html = html + "<img src='" + $(this).attr('src') + "' alt='" + $(this).attr('alt') + "' />\n";
html = html + "</div>";
i++;
});

return html;
});
The class for each div will only be a number which increments by one.

After they are generated, they will function just like the custom next/previous buttons I've made and click the rel according to their class:

$('#thumbnails').delegate('div', 'click', function(){
var divName = $(this).attr('class');
$("a.nivo-control[rel=" + divName + "]").click();
});

Next in the jquery.nivo.slider.js I made a couple of mods.  I changed the "// Process Title function" to the following:

var processTitle = function(settings){
var nivoTitle = $('.nivo-title', slider);
if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){
var title = vars.currentImage.attr('title');
if(title.substr(0,1) == '#') title = $(title).html();
$('main section h6').html(title);
} else{
$('main section h6').text('nothing');
}
}
I use .html(title); instead of .text(title); so it can process span tags and not escape them.  The span tags are used to decide whether the text is bold or not.

Then I changed the "// Process caption function" to the following:

var processCaption = function(settings){
var nivoCaption = $('.nivo-caption', slider);
if(vars.currentImage.attr('alt') != '' && vars.currentImage.attr('alt') != undefined){
var alt = vars.currentImage.attr('alt');
if(alt.substr(0,1) == '#') alt = $(alt).html();   
$('p.image_description').text(alt);
} else{
$('p.image_description').text('nothing');
}
}

To have these both go into affect I had to make sure these were added:

//Process title
processTitle(settings);

// Process caption
processCaption(settings); 

Oh and I can't forget that this css helped make the images in the slider display properly:

.nivoSlider {
position:relative;
width:100%;
height:auto;
overflow: hidden;
z-index:0;
}
.nivoSlider img {
position:absolute;
top:0px;
left:0px;
max-width: none;
}
.nivo-main-image {
display: block !important;
position: relative !important; 
width: 100% !important;
}

/* If an image is wrapped in a link */
.nivoSlider a.nivo-imageLink {
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
border:0;
padding:0;
margin:0;
z-index:6;
display:none;
}

/* The slices and boxes in the Slider */
.nivo-slice {
display:block;
position:absolute;
z-index:5;
height:100%;
top:0;
}
.nivo-box {
display:block;
position:absolute;
z-index:5;
overflow:hidden;
}
.nivo-box img { display:block; }

That's all that is too it.  I think the thing that was the most frustrating to me was finding that I could have just done this all along instead of spending so much time trying to make everything from scratch. I still think trying to make things from scratch is the best for learning but when you're trying to finish a project by a certain deadline it's not the best idea to reinvent the wheel.

Monday, May 13, 2013

Another day of planning

Today I received the web design that I was working on the image slider for and started planning on it.  So far I've taken down all of the measurements of elements and margins, decided which elements needed to be sliced and what I can use css on, and decided the html tags I'd use for each element.  This will be a fixed layout and everything will be wrapped in a container that will remain at the center of the page.  The <body> will have a black background.

For future reference, this site holds a great html5 tag reference: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/HTML5_element_list

Also I've decided to fully support a new open source ecurrency called BlooCoin: http://hackforums.net/showthread.php?tid=3421627

To do so I shared it with a couple other communities:
It's about 2am now and I'm too tired to write anymore about them.  So if you're interested just check out one of the threads (preferably the hf one) or just wait for me to (maybe) write about it tomorrow.

Sunday, May 12, 2013

How to send a click to a coordinate in an inactive program in vb.net

Today I'm writing down how to send a click to an exact coordinate in an inactive program in vb.net.  I used this in the iRazoo bot I just released.  I'm writing this down to remember this for the future and understand it better.  Before I begin, here are useful resources that helped teach me how to accomplish this:
To begin we need to make something that can grab the coordinates.  To do this add a textbox and set it to multiline and set the scrollbars property to vertical.  Then add a button and change it's text to find point.  Lastly, add a timer and set its interval to 1000.  With this all added you should now have the following:
What are we going to do with these three controls?  Well, on the button click we are going to enable timer1 if it's disabled and disable it if it's enabled with the following:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If Timer1.Enabled = True Then

Timer1.Enabled = False

ElseIf Timer1.Enabled = False Then

Timer1.Enabled = True

End If

End Sub


Then on the timer1 tick event, we're going to add the coordinate of the cursor's position on the form to textbox1's text by doing:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

TextBox1.Text = TextBox1.Text + vbNewLine + Me.Cursor.Position.ToString

End Sub


So now when you run you're app and click the button you should get something like this:

Now that we've got a way to find our coordinates we can make something to send a click to a certain coordinate.  First let's add something that we want to click to our form (like a button).  Then add a couple textboxes and another button underneath that.  Lastly, add another timer to the form and set it's interval for whatever time you'd like to wait before another click is sent (I set mine at 1000).  So now you're form should look something like this:
The first text box you added is for the x coordinate and the second is for the y coordinate.  The click point button will work the same way as the find point button and trigger timer2.  Before we code this and anything else though, let's paste the following below, Public Class Form1:
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _

Public Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer

End Function



<DllImport("user32.dll")> _

Shared Function WindowFromPoint(ByVal pnt As Point) As IntPtr

End Function

Private point As New Point
Private lButtonUp As UInteger = &H202
Private lButtonDown As UInteger = &H201

Private Function returnlParam(ByVal Lo As Short, ByVal Hi As Short) As IntPtr
Return CInt(Hi) << 16 Or Lo
End Function


  • The private var point is what we assign our textbox1's and textbox2's text too for our x and y.
  • The private var lButtonUp is a uint that contains the code for sending an on left mouse click up message.
  • The private var lButtonDown is a unit that contains the code for sending an on left mouse click down message.
With that done let's go back to our button2 (click point button) and add code to it's click event:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

point = New Point(TextBox2.Text, TextBox3.Text)



If Timer2.Enabled = True Then

Timer2.Enabled = False

ElseIf Timer2.Enabled = False Then
Timer2.Enabled = True
End If
End Sub

This first sets point equal two a new point with textbox2 as its x coord and textbox3 as its y coord and then does the same thing with timer2 that button1 does.  Okay almost done.  Now let's fill in the code for the timer2 tick event:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim hWnd As IntPtr
Dim wParam As IntPtr
Dim lParam As IntPtr

hWnd = WindowFromPoint(point)
wParam = CUInt(Keys.LButton)
lParam = returnlParam(point.X, point.Y)

PostMessage(hWnd, lButtonDown, wParam, lParam)
PostMessage(hWnd, lButtonUp, wParam, lParam)
End Sub


With Dim hWnd, wParam, and lParam you're just declaring the vars you'll be using for the PostMessage function.  Then we are assigning things to them.  hWnd will be getting the handle given off from the WindowFromPoint function.  wParam will be getting a uinteger data type of keys.LButton (which is the left mouse key).  lParam will be getting whatever is returned from the returnlParam function.  Then we use the postmessage function twice.  One time we use it with lButtonDown and the other with lButtonUp (simulating when you click the mouse down then let go of it).

Now if you run you're code, grab the point of the item you want to click, type in the coordinates, and hit the click point button it will send a click to the point you desire.  For all you botters out there, this might come in useful if you need to click something on a webbrowser (and can't figure out how normally;this way is kinda cheating).  Hope some of you find this interesting/useful.

btw if you want to just click a control and don't care what point it is you can always just use the control's handle.  So if I wanted to click button3 it would be:
PostMessage(button3.handle, lButtonDown, wParam, lParam)
PostMessage(button3.handle, lButtonUp, wParam, lParam)

You can download the complete project from here: http://www.mediafire.com/download.php?m5b4ht8j75n6j1l

Friday, May 10, 2013

Today's work

Today I spent majority of my time on the computer trying to figure out why the iRazoo bot was not working at first for everyone on tbn.  The reason was the HtmlAgilityPack.dll had to be in the same directory as the executable file.

Other than that, I've spent majority of my time trying to fully understand the function I used to send a click to an exact coordinate.  These are the msdn references I looked up to help:
What I can't figure out though, is how to display coordinates that I can use for the sending click code.  I posted a thread about it here to try and get some help: http://www.vbforums.com/showthread.php?721245-Sending-a-click-to-exact-coordinates-in-an-inactive-program

Tomorrow, I'll be doing very little work on the computer and if I do it will be for the image slider/gallery I need to make.

iRazoo Video Bot Release

Alright guys here is the release for the bot finally.  It obviously won't run flawlessly because I didn't have enough time to iron out all the bugs.  So if you do run into any trouble feel free to report the errors here or on thebotnet.  Here is a video of it working:


How to run?:
  • enter login details
  • hit start

Virus Scan:

Enjoy guys and subscribe to my blog/youtube for more.  And if you don't have an account you can signup by this link: http://www.irazoo.com/ReferedNewUser.aspx?RefBy=kaed

EDIT:
I've decided to release the source of this project because of all the bugs it has.  You can get it from here: http://www.mediafire.com/download.php?b0rydb1hcq9lo4p

Thursday, May 9, 2013

Image Gallery plan

Ok so I need to make an image slider/gallery for a new web design.  It will follow the same format as the following image:


  • The previous/next buttons at the top will cycle through the images for the slider.
  • Without clicking the buttons the main displayed image will go to the next image in the images for the slider every interval (probably 5 seconds).
  • The displayed image will fade in out to the next image.
    • I need to look at other special display affects I can make in js as well.
I didn't get a chance to read through it thoroughly yet but this should help me with learning how to fade in and out of images with jquery: http://kaidez.com/tutorial-simple-jquery-fade-in-fade-out/

This just about does it for the planning for this.  I'm going to start coding this on my localhost when I get home later and have some free time.

Tuesday, May 7, 2013

iRazoo bot debugging continues

It's night 2 of development and I think I'm close to getting rid of the major bugs that will keep this from running continuously when you're afk.  Every now and then I've noticed that the bot will sometimes get stuck on the categories page.  This could be caused by my shitty internet lagging then causing the bot to miss the code in the loop.

To avoid this problem I've added in a second timer and a private integer.  Every second the timer will add one too the integer.  If the integer = 60 it will go back to the videos page and start the bot loop over.  Basically what this does is it prevents the bot from timing out.  This was the main issue I found after running the bot for 2 hours.

Another thing I learned was that when you get a point, "&gotpoints=1" gets added to the end of the category url.  So I had to add this to the bot loop and then everything was working.  That's all for today.  I'm starting up a new project soon coding an irl friend's daughter's (who is a graphic designer) website.  Too do this I'm going to need a lot of time so I'm going to need to finish this tomorrow.

Monday, May 6, 2013

iRazoo bot progress

I saw another thread on tbn today that interested me: http://thebotnet.com/selling/201286-irazoo-v2-irazoo-com-video-bot/

This site offers you points for watching videos (which you can do unlimited amounts of times in the US) and these can be redeemed for GCs.  Looking at the thread I saw the poorly coded bot that user made and saw he's actually made some profit with it.  This leads me to believe that if I put any effort into making one I can do just as well as he can.

When I make the bot I'm going to do the following:
  • Use it until I get paid.
  • Sell the payment for bitcoins.
  • Make thread giving away bot for free.
    • Show payment proof.
    • Put referral link to a different account made under a vpn make more money and stop using bot to avoid getting banned.
Like the user that already made his bot, this will be based off the webbrowser and be made in vb.net.

So how does the video watching work?
  • Click a video from the list.
  • You get redirected to the video page.
  • You have to click the video to play it.
  • Ad pops up.
  • Video plays.
  • Redirects you to video page.
How can I automate this?
  • Grab all types of videos using the html agility pack and xpath
    • xpath: //*[@id="videonav"]//li//a
    • or I can hardcode the links instead and pick them at random.  (a better idea).
  • Pick one of links then visit it.
  • Grab video links using html agility pack and xpath:
    • xpath: //*[@id="ctl00_middleContent_dataListVideos"]/tbody//tr//td//table//tbody//tr[2]//td//a
    • pick random video link and click it.
  • Use autoit class to click video.
  • Wait for class to redirect to video page.
    • Create sub for all of above code and place on webpage loaded event so if the page <> the video selection page it will run.
    • Else if video page it will click the video too play it.
To learn to use html agility pack again I'm just going to look through my old projects (dafont leech).

How can I avoid getting banned with this?
  • Only run max 4-6 hours every day because obviously a bot would run nonstop.
  • I think they'd be able to tell if there was a referrer.  With this bot there would be a referrer and random videos would be selected so this could be avoided easily.
I think that's the only precautions they take to defend against bots.  They might check if you only do videos too but I doubt it.

Now I'm off to coding...
I'm not going to actually post the code cause I'm goin to keep this private but I'm going to updare this every time I finish something new. First I'm going to do the login system.

http://howtostartprogramming.com/vb-net/vb-net-tutorial-41-website-login/
http://stackoverflow.com/questions/2476360/disable-javascript-error-in-webbrowser-control

Ok the login system is done.  Now I'm onto picking a category page.  All (277) of the categories are hardcoded.  You might think, wow that must have taken forever you fag.  No, it actually took two seconds after I grabbed them and output them in the vb.net array format using this:
$('#videonav li a').each(function() {
var link = $(this).attr('href');
if (link != undefined || link != null) {
console.log("\"" + link + "\", _" );
}
});


Basically the same code as the gatherproxy.com script but with a few minor mods.

Useful links for modding visual studio:
http://msdn.microsoft.com/en-us/library/ms165340(v=vs.80).aspx
http://blogs.msdn.com/b/zainnab/archive/2010/08/13/change-your-visual-studio-color-scheme-vstipenv0034.aspx

Note that when you search for a link you need to use the entire http://etc.com/ to compare.

Okay picking category page is done now onto grabbing all the video links per page.  I need to write a loop to pick a new category page if there's no videos on it.

Html agility pack: http://htmlagilitypack.codeplex.com/

Xpath for grabbing videos: //*[@id='ctl00_middleContent_dataListVideos']//a

Useful links for figuring out how to send clicks to a non-active form:
http://www.hackforums.net//showthread.php?tid=232812
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bc635c72-f2bb-4d9b-a5f7-e596b133468a/
http://social.msdn.microsoft.com/Forums/en-US/vbinterop/thread/21cc58c5-fc34-45b0-9407-952aae80fc1c

Now I'm in the debugging stage and are recording it running using camtasia.  So next step after I make some gcs off this (or get banned) I'll be release it to tbn.

Saturday, May 4, 2013

gatherproxy.com proxy gatherer

So while browsing tbn I've found a thread asking for a gatherproxy.com bot: http://thebotnet.com/bot-requests/203930-req-gather-proxy-bot/

I've never heard of this site before but when I take a look at it all I see is an interface that slowly shows new proxies.  You can't grab them with an html parser as you normally would because the html is generated dynamically though some javascript functions on the page.  I figured this would be a be better to do in jquery/javascript because I'd need to use a headless browser to make it in vb, java or even python.

Getting started I needed a plugin for chrome (cause I like to use it better) that would let me inject my custom js into the gatherproxy site (just like scratchpad that you open with Shift+F4 in firefox).  So I've picked this one and it works perfectly: https://chrome.google.com/webstore/detail/javascript-injector-nicho/abdogfafejmdomllalkdegagoehgbdbk

Now that I had that installed I just wrote some simple jQuery that would grab the proxy ip/port and dump it to the console so I could copy and paste it into a text file.  Here is that code I came up with:
$('table tbody tr').each(function() {
var proxy = $(this).attr('prx');
if (proxy != undefined || proxy != null) {
console.log(proxy);
}
});


.each() method: http://api.jquery.com/each/
.attr() method: http://api.jquery.com/attr/

While inspecting the dynamically made proxy tables I found that each proxy is found in the tr element.  Then I found that each proxy tr element holds a special attribute prx that holds the ip:port that I need (What luck!).   Since there are other tr elements that don't have this trx attribute field I wrote an if loop to filter them out.  Lastly, I dumped the proxy to the console for manual copying and pasting into a text file.

The only downside to this is the lack of a gui but there is really no need for one.  This way, it grabs proxies very fast, and avoids the use of those slow headless browsers.  I assumed this is what AceJunior wanted because that is all that is going on with this site.  I looked into creating a text file and writing the proxies to it though js but I had a tough time with it even after reading through this article: http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-file-appending

I'm going to make a video demonstrating the use for this so I don't get a million questions on it.  I'll edit this post with it + the url for my post on tbn once it's done.

Friday, May 3, 2013

Friday night dreams

So it's Friday night (1am) and there's no possibility of me working on memepls so I'm just derping around the internet at this point.  I'm trying to think of some other possibilities I can make some type of income other than relying on ad money when I finish memepls, if I ever finish it.  For starters I can always try selling the little skills I have including:

  • psd to wordpress/html
  • content/article writing
  • essay writing
  • vb.net freelance
Psd to wordpress/html conversion is a great way to make some money but my portfolio isn't impressive enough at all to attract any customers.  I've already tried offering this for free (on tbn & gs) but still no one is interested.

I consider myself a strong writer when I try.  Obviously now I don't give a fuck about the way I write but when I've tried in English I've always received a perfect score on the essay.  Writing content for websites isn't very hard either because all you need to do is make it original, lengthy enough and interesting.  To get started with this I'll need to write a few solid sample articles and advertise it on various forums.  I'd probably need do a couple freebies to attract customers too.

Now in visual basic I can code just about anything but I'm always unmotivated if I'm not getting paid.  I see requests for bots to be made all the time on tbn and I'm sure I can throw together some half-assed bots (which are still better than the majority of the bots on there) to make some easy cash.  This is like a last resort though.

Another idea that doesn't involve selling my services is setting up a blog just for maplestory hacks and macros.  I've made some useful macros in autoit for maple before that I'm sure other people would love.  If I made another blog on here for these macros and hacks I could make some money off adsense.  I'd also make YouTube videos for them and make YouTube adsense money as well.  This idea sounds like it would require the least work on my part and has some potential.  However, I quit the game recently and wasn't looking to run back to it already.

I'm looking to make good money off one of these ideas though, not $5 after a week or so.  Majority of posts on forums these days are how to make minute amounts of cash.  For the amount of work a person would have to do to make that money, it's not worth it.  Working at my local grocery store (which hires everyone) pays at least $8 hourly.  I'm looking to make at least 3 grand after a couple months of working nonstop online + irl.  As of now these are just pointless dreams though.  Maybe one day, I'll put them into effect.

setTimeout not working the way I wanted

Continuing with the pv app today the setTimeout method didn't work at all.  In fact it ran the exact same way as before and then ran the code it was supposed to after the delay.  I'm out of time today so my only other options tomorrow are to either try the setTimeout command again outside of the gapi.client.load brackets or try messing around with setInterval: http://www.w3schools.com/js/js_timing.asp

I've done google searches about related issues but found none of use to me so far.  Maybe I'll find a resolution tomorrow.  Right now I'm really frustrated with this though.

Thursday, May 2, 2013

Why not to copy and paste code mindlessly

While working to try and fix what was preventing the status messages from showing I came across a few things that were wrong and all come from copying and pasting code.  This is why I need to get better with writing in these languages rather than copy and paste shit because in the end I waste more time trying to fix the code.

I posted a link to a wordpress support forum where a user posted "working" code for retrieving a user id from a username: http://wordpress.org/support/topic/getting-user-id-from-username  The code I used from here was:
$user = get_userdatabylogin('admin');
var_dump($user);
echo $user->ID; // prints the id of the user


get_userdatabylogin (http://codex.wordpress.org/Function_Reference/get_userdatabylogin), is a deprecated function and was replaced with get_user_by (http://codex.wordpress.org/Function_Reference/get_user_by).  This wasn't what caused the error but it's always nice to be using updated code.

What was causing the error was the var_dumphttp://php.net/manual/en/function.var-dump.php
This is used to dump information about the variable but with the get_user_by function I surely don't need it and when I took it out and ran it with the get_userdatabylogin it still worked.  So maybe something changed in wordpress (since that solution was posted 4 years ago) to make this not work.

The last problem I found was that I left two variables with the same names from the php file they were in before ($wti_like_message and $wti_unlike_message).  So I fixed this (renamed them to $like_count and $unlike_count) and now they will work again and be put into the $result array.

At the end of everything here's today's handlelikedata.php: http://pastebin.com/7fuf5R0i

So not much was accomplished today but I did once again learn the lesson that it can sometimes be better to code things from scratch so you have a complete understanding of what's going on.  Mindlessly copying and pasting things is never the answer and can cause you to waste more time in the end.  I still have to build the level system onto this and put the $author_id and sql queries I've made already to good use.  For the rest of the night though I'm just going to lurk on my usual forums.

pv app - the issue discovered

Today I found why the loop I made to loop through all the days doesn't work and just increments the days to the max and then starts the requests.  The issue is that the google calendar api and all of its functions are asynchronous so if you put it in a loop it will just run on its own and not according to the loop at all (it will just do its thing).

From reading about this here, https://groups.google.com/forum/?fromgroups=#!topic/google-ajax-search-api/1DxzKw5mzOY, I've found that there's no way to make it synchronous.  The only other solution I've thought of so far was to make the loop wait before making an increment by using the setTimeout method: http://www.w3schools.com/jsref/met_win_settimeout.asp

I've also changed the loop just to work with the day var now rather than I so it's:
for (day = 1; day < 30; day++) {

So will the issue be resolved today?  No, because there's no time left in this period but hopefully everything can be fixed easily tomorrow.

Wednesday, May 1, 2013

The school project - pv calendar app

Today I'm going to shed some light on the project I'm working on at school.  I'm unsure about where this project is headed and right now it's completion seems extremely far away.  The goal is to make an android app for the pv google calendar.  I know there's plenty of apps that can import google calendars already but for whatever reason we (as in the other kid working with me and my teacher) wanted to remake it.

So beginning the project I figured we needed to use the java google calendar api because android apps are created in java.  The only problem with this was I could not import the needed libraries for the life of me.  I imported literally everything google gave me and couldn't get the needed ones (oauth2.draft10) to configure my app as they show: https://developers.google.com/google-apps/calendar/instantiate

For whatever reason I decided not to start off the working example, I think because I ran into another error, but I'm not sure cause that was so long ago.  Anyways I then came up with the idea to try using the api for a web language like javascript because importing the libraries should be very simple to do (which it was) and I got the api working correctly.  Since I have it working correctly I came up with the idea to make a webpage and just have a WebView on the android app load it.

Now by "got the api working correctly" I mean that I followed this dudes blog post to understand the basic configuration and api usage: http://googleappsdeveloper.blogspot.com/2011/12/using-new-js-library-to-unlock-power-of.html

I still have plenty of work to do to get the actual full working web page to load in the WebView and before I go any further into explaining the code I'm going to post entire current web page: http://pastebin.com/UaLqfkfJ

The first problem I had was the function firing twice which I took care of with the firedOnce boolean and the loops I used with it.  The second problem was getting the start and end date for all the events.  This following does grab the start and end date for each item:
var date = document.createTextNode('Start: ' + resp.items[i].start.date + ' End: ' + resp.items[i].end.date);
But the problem was that the .start.date and .end.date is undefined for a lot of the events and there are no other properties to read the date they start from.

With this in mind, I figured I just need to loop through every day of the month and pull the events from that day.  That way I'd know what the date of the event is and I wouldn't have to rely on google to get it.  To get a certain day's events I'd have to add in the timeMin and timeMax parameters to the google request like so:
'timeMin': 'year-month-dayT00:00:00-06:00'.replace('year', year).replace('month', month).replace('day', day),
'timeMax': 'year-month-dayT23:59:59-06:00'.replace('year', year).replace('month', month).replace('day', day)


Why use replace and not just concatenate the string using +?  Concatenation didn't work for me for whatever reason and replacement did.  Now if you look right after, gapi.client.load('calendar', 'v3', function() {, you'll see a commented out loop and an increment on the days variable.  This is the loop that's supposed to increment the days/months that doesn't work at all.  It's like it increments the days (cause that's all I was testing the increment on atm) till it's done and then does the google request and displays it on the screen.  If I could solve this issue the coding would pretty much be done and I'd be able to add it to the android app.

Now that I've explained all this the period is over and I'll start making progress on this next period tomorrow.