Archive

Archive for the ‘Uncategorized’ Category

Muse Survival Piano and Vocal cover

July 14, 2012 Leave a comment

So they released a new single and I couldn’t resist covering it!

Advertisements
Categories: Uncategorized

Adding SearchBar to filter TableView Data

July 8, 2012 Leave a comment

step1: add a searchBar UI element to your tableView and create and outlet for it.

step2: in viewDidLoad (or similar), set the searchBar as self-delegate:

searchBar.delegate=(id)self; 

step3: add a bool variable to your class, I’ve called mine isFiltered

step4: implement the searchBars textDidChange delegate method:

 -(void)searchBar:(UISearchBar*)searchBar textDidChange:(NSString*)text
{
  if(text.length == 0) self.isFiltered = FALSE;
  else
  {
    self.isFiltered = true;
    newData = [[NSMutableArray alloc] init];
    NSObject *item;
    for ( item in tableFullDataArray){
    NSRange nameRange = [item.sometextproperty rangeOfString:text options:NSCaseInsensitiveSearch];
    if(nameRange.location != NSNotFound) [newData addObject:item];
   }
  }
  [self.updateTableView reloadData];
}

step5: alter the tableview datasource if isFiltered is True. You must change the rowsInSections, and cellForRowAtIndexPath methods. if isFiltered is true, you want to use the newData array. if not, you want to use your complete data array.
step6: finally, to get rid of the keybaord when user taps on the search button, you must also implement the searchButtonClicked delegate method:

-(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar{</pre>
[self.searchBar resignFirstResponder];

} 

								
Categories: Uncategorized

Long Texts And GridViews: What A Tooltip

September 13, 2011 Leave a comment

Yet another GridView tweak. Ever tried to display a big chunk of text into a GridView and saw your entire page ultimately ruined? Fear no more. There’s a very, very simple solution and that is using a Tooltip. It’s easy to do, just follow these steps:

1Cut a hole in a box: First, we need to create a RowDataBound event for our GridView. You can find this from GridView properties -> Events -> Data-> RowDataBound

In your .aspx page it should look something like this:

OnRowDataBound="GridViewID_RowDataBound"

2- You put your junk in that box: in the code behind, populate RowDataBound


protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ViewState["myToolTip"] = e.Row.Cells[0].Text;
                if (e.Row.Cells[0].Text.Length >= 30)
                {
                    e.Row.Cells[0].Text = e.Row.Cells[0].Text.Substring(0, 30) + "...";
                    e.Row.Cells[0].ToolTip = ViewState["myToolTip"].ToString();
                }

            }
        }

3- Make her open the box: now if you just hover your mouse over the row containing … a tooltip will appear with the complete string in it.

And that’s the way you do it!

Categories: Uncategorized

The HTTP verb POST used to access path […] is not allowed. (ASP.NET)

August 9, 2011 Leave a comment

Hello dear developer who found this page by Google-ing the infamous error message! This error might show up for a number of various reasons. It’s widely discussed on the forums etc and is often over complicated.

Now, if you get this error after clicking on a link button there is a very simple solution to this. Don’t use LinkButton ! Instead grab a HyperLink control from the Toolbox. HyperLink has a property named “NavigateUrl” which can be set from either code behind or in Properties window.

From what I understand the difference between HyperLink and LinkButton (which well explains this error message) is that a LinkButton performs a server PostBack while HyperLink simply redirects you to the URL you set for its NavigateUrl property.

Therefore LinkButtons can’t be directly use to redirect the browser to another directory root. If you haven’t noticed, when you get this error, click on the address bar and hit enter. Yes, it does load your requested page. And that’s because you don’t PostBack this time.

 

However if the LinkButton is not why you get this error, your solution might be a bit tricky and it usually has to do with handler mappings that IIS does. Have a look at the following link for an example:

Luke Melia » ASP.NET – The HTTP verb POST used to access path … is not allowed http://bit.ly/qTLsiQ 

Categories: Uncategorized

“Just do it ALL in Photoshop”

April 27, 2011 Leave a comment

We’re all aware of the awesomeness Adobe’s Photoshop and yes the new features in CS5 blew us away but hey did you know that you can actually make animations with Ps? no flash, no illustrator “do it all in photoshop”. These folks at Three Legged Legs have done an amazing job. check it out!

Categories: Uncategorized

The Fear

April 24, 2011 Leave a comment

It was my 23rd birthday today and to be honest it’s scaring the hell out of me. As I’m getting closer to the end of my bachelor degree I can feel “the fear” growing in me. something that I call graduation crisis. And the fact that I’m only getting my first university degree at this age doesn’t help at all. I started a Electrical Engineering BSc in Iran back in 2006, right after I finished high school. but after two years I realised I wasn’t enjoying it. Not only I didn’t like the university and the number of close minded people around me  I wasn’t even liking the course. So I made a big decision. I quit. I simply threw away two years of my life (no need to mention all the hard work I did to get into that university). I quit, not only from my course or my university but also from my country. And I started it all over again. Electronics and Computing Eng, was indeed a great choice of course and despite a few rather stupid decisions that our school made (which I believe happens everywhere) I did enjoy doing it. But now, all I’m thinking of is “what’s next?” . Now I do have a long term plan (dream?) and that is Silicon Valley. but it seems very far from me. Holding an Iranian passport does limit my options. I have a PhD offer but they want me to pay £48k for it while they’d pay a home student more than that to do the same research. I think I will have to reject the offer. I’ve applied for some summer, 12month internships as well as master degrees and I have no bloody clue what I will be doing next year.

I’ve been taken over by “the fear”.

Categories: Uncategorized

Hello wordpress!

March 28, 2011 Leave a comment

So I finally started a wordpress and bought this domain!

why htmltypewrite?  Because I find it a beautiful paradox. Coding webpages using an old school typewriter might not make a freaking sense, but it reminds us (at least myself) of what we were and what we are.

This blog will be mainly about electronics&computing  related stuff (it’s what I’m studying) but I might also bring other stuff in from my photographic and musical world, the two hobbies that make my life more enjoyable. Maybe a little bit of politics too!

Till then, remember the htmltypewriter!

Categories: Uncategorized