Pages

Showing posts with label link. Show all posts
Showing posts with label link. Show all posts

Thursday, August 4, 2011

How to link items to a UserControl - WPF

In this article we will see how to perform the binding controls within a UserControl to a WPF application.

And accomplish this task using:
  • The DataContext property of the user control.

Reviewing concepts

A UserControl is a control created from existing controls, adding these controls into a single control in order to optimize your code. It is indicated when you realize that there is a loop in the structure of which involved controls so that if you create a composite control, these controls with the data manipulation is facilitated.

Note: Do not confuse a User Control with a Custom Control in WPF. A Custom Control is a control derived from other control and is used when you create a control from the existing one to include a feature that has no existing control.

After the user control is created to use it just do the following:
  • Include a reference to the namespace of the user control, (and if the user control assembly is not in the same assembly);

  • Include the XAML control in the window where we want to use it.

We will see how to perform data binding to a ListBox control used on a UserControl.

Creating a WPF application

Open Visual Basic 2010 Express Edition and create a new application type WPF Application with the name UserControl_Binding.


On the Project menu, click Add New Item and select the template User Control (WPF), then enter the name macLista.xaml.


Note that the model exists Custom Control (WPF) which is different from User Control (WPF).

Then set the following XAML code for this user control that we create:

Download code now (notepad 4kb)

We define a user control with two first ListBox where the Listbox has the property ItemsSource linked to the current DataContext. Specifying Path =. is used to link to the source of current. Specify the Path =. is not required, can also be written like this: ItemsSource = "{Binding}".

The second ListBox gets ItemsSource MeuItemsSource dependency property. ItemsSource Since this property is linked to user control, you must specify the element whose property is linked to the listbox, then we have this way: ElementName = meuUserControl.

The layout of the ListBox control displays two and can be seen below: (Below is the XAML code).



Linking items to the UserControl in our application

Let us now use the UserControl macListBox we create in our application.

Open the file and the XAML code MainWindow.xaml will include the following statements:

Download your code now (notepad 1kb)

As shown below, we see the result of the inclusion of two lines of XAML code above:


Let us now define the file MainWindow.xaml code to use the user control and perform linking of items in the ListBox control.

Change the code MainWindow.xaml XAML file as shown below:


 Now all we have to do and set the data source file MainWindow.xaml.vb as the code below:

Imports System.Collections 
Imports System.Windows
Public Class MainWindow

Private _testaLista The List (Of String)

Public ReadOnly Property TestaLista () As List (Of String)
Get
If _testaLista Is Nothing Then
start ()
End If
Return _testaLista
End Get
End Property

Private Sub start ()
_testaLista = New List (Of String) ()
_testaLista.Add ("Jose Carlos Macoratti")
_testaLista.Add ("Ana Maria Fonseca.")
_testaLista.Add ("Miriam Estela Ribeiro.")
_testaLista.Add ("Jefferson-Day Andre")
_testaLista.Add ("Janice Rachel Smith.")
_testaLista.Add ("Mario Santos")
_testaLista.Add ("Jessica Lang Lima Bueno")
End Sub

End Class 

When we run the project the following happens:

The first user control in the first TabItem binds to TestaLista DataContext of the window.

After the first listbox in the user control is linked to the DataContext that will show the contents of TestaLista.

The result is shown below:


Although the dependency property defined in MeuItemsSource user control, not used in the example. To do so would have to set the user in control for the dependency property as follows:

Imports System.Collections 
Imports System.Windows
Imports System.Windows.Controls

Partial Public Class macLista
Inherits UserControl

Public Shared ReadOnly MeuItemsSourceProperty The DependencyProperty

Shared Sub New ()
macLista.MeuItemsSourceProperty DependencyProperty.Register =
("MeuItemsSource", GetType (IEnumerable), GetType (macLista))
End Sub

Public Property MeuItemsSource () As IEnumerable
Get
Return DirectCast (GetValue (macLista.MeuItemsSourceProperty), IEnumerable)
End Get
Set (ByVal value As IEnumerable)
SetValue (macLista.MeuItemsSourceProperty, value)
End Set
End Property
Sub New ()
End Sub
End Class

Then just set the file MainWindow.xaml another TabItem defined as follows:

Download your code now (notepad 132bytes)

Thus we show how to perform the binding in controls created by the user.
Get the complete project here: UserControl_Binding.zip


Wednesday, August 3, 2011

Komentar SPAM (memiliki link dalam isi komentar) tidak mempengaruhi SEO

Komentar memang sangat berharga bagi anda agar bisa mendapat suatu dukungan yang bisa membangkitkan semangat atau sebagai bahan acuan agar anda bisa mengoreksi diri anda dari kekurangan. Namun mungkin anda akan merasa sangat jengkel jika ada seseorang yang berkomentar, namun komentar tersebut dideteksi sebagai komentar spam. banyak diantara para blogger yang mengungkapakan bahwa, komentar spam akan mempengaruhi SEO blog anda. Mungkin sedikit membingungkan mengapa komentar spam bisa sampai mempengaruhi SEO (Search Engine Optimization). Mari kita sedikit bahas tentang komentar spam yang bisa mempengaruhi SEO dibawah ini.

Banyak para blogger yang tau bahwa outbound link sangatlah buruk untuk perkembangan SEO pada blog anda (saya sangat setuju). Biasanya komentar spam selalu diidentikkan dengan komentar yang menyisipkan link didalam sebuah komentar. Nah penyisipan link yang dilakukan membuat para blogger beranggapan bahwa hal tersebut merupakan salah satu yang termasuk outbound link (link keluar). Memang benar link yang dipasang memang mengarah keluar dari blog anda, tetapi menurut saya komentar yang tanpa memiliki link didalam isi komentar pun termasuk komentar yang memiliki outbound link.

Mengapa saya bilang komentar yang tidak memiliki link didalam komentar sebagai outbound link ?

Karena setiap komentar biasanya menyantumkan nama dan URL blog anda. Menurut saya hal ini juga merupakan outbound link, karena link yang terpasang pada nama si komentator merupakan suatu link yang mengarah keluar dari blog anda. Keputusan ada di tangan anda sebagai moderator, untuk memutuskan komentar itu pantas atau tidak untuk dipublikasikan.

Jadi apakah buruk dan pantas komentar yang memiliki link pada isi komentar yang dianggap sebagai komentar spam ?

Menurut saya tidak, karena setiap komentar dibuat untuk menanggapi sebuah artikel/ post yang anda publikasikan. Google pun tidak melarang penggunaan link pada isi komentar blog anda, karena ada beberapa HTML tags yang Google setujui. Berikut ini adalah artikel yang saya dapat dari Google.

Note : Silahkan hapus komentar yang hanya menyisipkan link tanpa menanggapi artikel yang anda tulis. Namun keputusan selalu ada pada diri anda.

Sumber : http://www.google.com/support/blogger/bin/answer.py?answer=42064

Preventing Unwanted Comments and Comment Spam


Blogger has several built-in measures for dealing with comment spam and other associated dastardly behavior.

1.   Only five html tags are accepted:

<a> (for making links)
<strong> and <b> (for making text bold)
<em> and <i> (for making text italicicized)

2.   All links will automagically use the rel="nofollow" tag, so they'll receive no PageRank boost.

3.   You can choose to receive notification by email when new comments have been posted on your blog. This way, you can monitor them for spam and delete them when necessary.

4.   You can enable word verification for your comments. This will require an extra step in the commenting process, which will deter automated comment spamming systems.

5.   You can enable comment moderation, which will let you view new comments and approve or reject them before they appear on your blog.


Translated :

Mencegah Komentar Spam dan Komentar Yang Tidak Diinginkan


Blogger memiliki beberapa langkah-langkah built-in (fitur yang sudah ada pada blogger) untuk menangani komentar spam dan perilaku pengecut lainnya yang terkait.

1. Hanya lima tag html yang diterima:

<a> (untuk membuat link)
<strong> and <b> (untuk membuat teks tebal)
<em> and <i> (untuk membuat teks miring)

2. Semua link otomatis akan menggunakan rel = "nofollow" tag, sehingga mereka tidak akan menerima peningkatan PageRank.

3. Anda dapat memilih untuk menerima pemberitahuan melalui email ketika ada komentar baru telah diposting di blog Anda. Dengan cara ini, Anda dapat memonitor mereka untuk spam dan menghapusnya bila diperlukan.

4. Anda dapat mengaktifkan verifikasi kata (WWord Verification) untuk komentar Anda. Hal ini akan memerlukan langkah tambahan dalam proses komentar, yang akan mencegah sistem komentar spam otomatis.

5. Anda dapat mengaktifkan moderasi komentar, yang akan membiarkan Anda melihat komentar baru dan menyetujui atau menolak mereka sebelum mereka muncul di blog Anda.


Dari artikel yang saya dapat dari Google langsung, kita bisa pelajari bahwa penggunaan link didalam sebuah komentar itu tidak dilarang. Karena Google menyetujui penggunaan html tags <a> di dalam isi komentar. Jika dilarang oleh Google, maka selama ini kotak komentar tidak dapat diisi dengan menyisipkan link didalam isi komentar. Selain itu untuk mengurangi banyaknya komentar di blog anda, maka Google merekomendasikan anda agar mengaktifkan Word verification dan Comment Moderation.

Untuk apa Word Verification diaktifkan ?

Tentu saja Word Verification diaktifkan untuk menghindari adanya komentar spam. Biasanya Word Verification digunakan untuk menghindari adanya komentar dari robot, karena komentar dari automated comment spamming (mungkin itu namanya) hanya akan menjadi sampah di kotak komentar anda.

Lalu untuk apa Comment Moderation ?

Tentunya, comment moderation akan melibatkan diri anda sebagai seorang moderator komentar. Anda disini berperan sebagai moderator yang berhak memilih komentar yang ditinggalkan di blog anda, dan anda berhak menyutujui atau menghapus komentar tersebut sebelum komentar tersebut dipublikasikan.

Lalu mengapa anda beranggapan bahwa komentar Spam tidak mempengaruhi SEO ?

Mudah saja untuk dijelaskan. Begini logikanya, anda tau bahwa outbound link sangat buruk bagi SEO. tapi faktanya Google menyetujui html tags <a> (html tags untuk link) untuk bisa disisipkan kedalam isi komentar anda, namun anda menganggap komentar itu SPAM karena termasuk outbound link. Padahal semua komentar yang menyisipkan link, All links will automagically use the rel="nofollow" tag, so they'll receive no PageRank boost. Jadi tidak merugikan bukan, lagipula link yang disisipkan adalah link nofollow.

Selain itu, mungkin ada diantara kalian yang menganggap bahwa komentar spam adalah komentar yang bersifat ingin menjatuhkan blog anda. Biasanya komentar tersebut berisi penghinaan terhadap blog anda, namun apakah komentar itu mempengaruhi SEO anda ? Tentu saja tidak. Apa hubungan komentar penghinaan dengan SEO ? Saya rasa tidak ada hubungannya sama sekali. Komentar yang berisi penghinaan atau komentar yang bersifat ingin menjatuhkan blog anda hanya akan merusak reputasi blog anda bukan mempengaruhi SEO blog anda. Buktinya ada beberapa blog yang sering saya baca dan sering mendapatkan hujatan komentar (sebut saja blogernas), tetapi setiap harinya memiliki traffic yang sangat besar. Namun jika anda kurang berkenan, anda bisa menghapus komentar tersebut sebelum dipublikasikan, karena anda adalah moderator yang berhak memilih komentar yang pantas untuk dipublikasikan. Sekali lagi keputusan untuk publikasi komentar ada pada diri anda.

Ok hanya sedikit analisa dari saya tentang komentar spam terhadap pengaruh SEO, mungkin ada beberapa hal yang salah. Tapi saya tetap berkeyakinan bahwa, kometar bukanlah suatu yang bisa mempengaruhi baik atau buruknya SEO blog anda. Karena baik atau buruknya konten anda, semua tergantung pada Search Engine yang memilih.

SPAM Comments (have a link in the content of comments) do not affect SEO

Comments are very valuable for all people in the world in order to get an endorsement that can be uplifting or as a reference so you can correct yourself from shortages. However you might feel very annoyed when someone commented, but the comments are detected as comment spam. many of the bloggers who say that, comment spam will affect the SEO of your blog. Maybe a little confusing why the comment spam can affect the SEO (Search Engine Optimization). Let us discuss a little about the comment spam that could affect SEO below.

Many of the bloggers who know that the outbound link is very bad for the development of SEO on your blog (I strongly agree). Usually the spam comments are always identified with the comments that inserting a link in a comment. Now insertion of links that do make the bloggers think that it is one that includes outbound links (links out). It is true that the link posted it leads out of your blog, but I think the comments without having any links within the content of comments, including comments that have outbound links.

Why do I say comments that do not have a link in the comment as an outbound link?

Because every comment is usually insert the name and URL. I think this is also an outbound link, because the links are inserted on the commentator's name is a link that leads out of your blog. But the decision is yours as a moderator, to decide appropriate or not comment for publication.

So, whether bad or inappropriate comments that have links on the content of the comments are considered as comment spam?

I think not, because every comment made ​​in response to an article / post you publish. Google also does not prohibit the use of links in the content of your blog comments, because there are some HTML tags that Google agreed to. Here's an article that I got from Google.

Note : Please delete comments that only insert a link without responding to the article that you write. But the decision is always in your hand.

Sources : http://www.google.com/support/blogger/bin/answer.py?answer=42064

Preventing Unwanted Comments and Comment Spam


Blogger has several built-in measures for dealing with comment spam and other associated dastardly behavior.

1.   Only five html tags are accepted:

<a> (for making links)
<strong> and <b> (for making text bold)
<em> and <i> (for making text italicicized)

2.   All links will automagically use the rel="nofollow" tag, so they'll receive no PageRank boost.

3.  You can choose to receive notification by email when new comments have been posted on your blog. This way, you can monitor them for spam and delete them when necessary.

4.   You can enable word verification for your comments. This will require an extra step in the commenting process, which will deter automated comment spamming systems.

5.   You can enable comment moderation, which will let you view new comments and approve or reject them before they appear on your blog.

From the articles I get from Google directly, we can learn that the use of links in a comment that is not prohibited. Because Google approve the use of html tags <a> inside the content of comments. If not approved by Google, so long as this comment box could not be filled by inserting a link in the content of comments. In addition to reducing the number of comments on your blog, Google recommends you to activate Word verification and Comment Moderation.

For what Word Verification is enabled ?

Of course, Word Verification is enabled to avoid comment spam. Word Verification typically used to avoid any comments from the robot, because comments from bots or spam bots comment (maybe that's his name) would just be a waste in your comment box.

Then for what the Comment Moderation?

Certainly, comment moderation will involve yourself as a moderator comment. You are here acting as a moderator who has the right to choose the comments left on your blog, and you are entitled to approve or delete the comment before comments are published.

Then why do I think that comment spam does not affect SEO?

It's easy to explain. Here's the logic, you know that the outbound link is very bad for SEO. but the fact that Google agreed <a> html tags (html tags for links) to be inserted into the contents of  comments, but you think that comment spam because it includes outbound links. Though all the comments that insert a link, All links Will automaically use the rel = "nofollow" tag, so they'll receive no PageRank boost. So no harm is not, after all the inserted links are nofollow links.

In addition, there may be amongst you who think that comment spam is a comment that is like dropping your blog. Usually such an insulting comment on your blog, but if that comment affect your SEO? Of course not. What is the relationship humiliation comments with SEO? I think there is no connection at all. Comments that contain that are insulting or comments that want to drop your blog will only damage the reputation of your blog not affect the SEO of your blog. The proof there are some blogs that I frequently read and often get comments blasphemy (let's call it blogernas), but every day has a very large traffic. But if you are not pleased, you can delete the comment before it is published, because you are the moderator who has the right to choose an appropriate comment for publication. Once again there is a decision for publication comments is in yourself.

Ok just a few of my analysis about the comment spam to the effects of SEO, there may be some things wrong. But I still believe that, comments is not something that can affect good or bad SEO of your blog. Since your content is good or bad, all depending on the Search Engines to choose.

Monday, August 1, 2011

How to link items to a UserControl - WPF

In this article we will see how to perform the binding controls within a UserControl to a WPF application.

And accomplish this task using:
  • The DataContext property of the user control.

Reviewing concepts

A UserControl is a control created from existing controls, adding these controls into a single control in order to optimize your code. It is indicated when you realize that there is a loop in the structure of which involved controls so that if you create a composite control, these controls with the data manipulation is facilitated.

Note: Do not confuse a User Control with a Custom Control in WPF. A Custom Control is a control derived from other control and is used when you create a control from the existing one to include a feature that has no existing control.

After the user control is created to use it just do the following:
  • Include a reference to the namespace of the user control, (and if the user control assembly is not in the same assembly);

  • Include the XAML control in the window where we want to use it.

We will see how to perform data binding to a ListBox control used on a UserControl.

Creating a WPF application

Open Visual Basic 2010 Express Edition and create a new application type WPF Application with the name UserControl_Binding.


On the Project menu, click Add New Item and select the template User Control (WPF), then enter the name macLista.xaml.


Note that the model exists Custom Control (WPF) which is different from User Control (WPF).

Then set the following XAML code for this user control that we create:

Download code now (notepad 4kb)

We define a user control with two first ListBox where the Listbox has the property ItemsSource linked to the current DataContext. Specifying Path =. is used to link to the source of current. Specify the Path =. is not required, can also be written like this: ItemsSource = "{Binding}".

The second ListBox gets ItemsSource MeuItemsSource dependency property. ItemsSource Since this property is linked to user control, you must specify the element whose property is linked to the listbox, then we have this way: ElementName = meuUserControl.

The layout of the ListBox control displays two and can be seen below: (Below is the XAML code).



Linking items to the UserControl in our application

Let us now use the UserControl macListBox we create in our application.

Open the file and the XAML code MainWindow.xaml will include the following statements:

Download your code now (notepad 1kb)

As shown below, we see the result of the inclusion of two lines of XAML code above:


Let us now define the file MainWindow.xaml code to use the user control and perform linking of items in the ListBox control.

Change the code MainWindow.xaml XAML file as shown below:


 Now all we have to do and set the data source file MainWindow.xaml.vb as the code below:

Imports System.Collections 
Imports System.Windows
Public Class MainWindow

Private _testaLista The List (Of String)

Public ReadOnly Property TestaLista () As List (Of String)
Get
If _testaLista Is Nothing Then
start ()
End If
Return _testaLista
End Get
End Property

Private Sub start ()
_testaLista = New List (Of String) ()
_testaLista.Add ("Jose Carlos Macoratti")
_testaLista.Add ("Ana Maria Fonseca.")
_testaLista.Add ("Miriam Estela Ribeiro.")
_testaLista.Add ("Jefferson-Day Andre")
_testaLista.Add ("Janice Rachel Smith.")
_testaLista.Add ("Mario Santos")
_testaLista.Add ("Jessica Lang Lima Bueno")
End Sub

End Class 

When we run the project the following happens:

The first user control in the first TabItem binds to TestaLista DataContext of the window.

After the first listbox in the user control is linked to the DataContext that will show the contents of TestaLista.

The result is shown below:


Although the dependency property defined in MeuItemsSource user control, not used in the example. To do so would have to set the user in control for the dependency property as follows:

Imports System.Collections 
Imports System.Windows
Imports System.Windows.Controls

Partial Public Class macLista
Inherits UserControl

Public Shared ReadOnly MeuItemsSourceProperty The DependencyProperty

Shared Sub New ()
macLista.MeuItemsSourceProperty DependencyProperty.Register =
("MeuItemsSource", GetType (IEnumerable), GetType (macLista))
End Sub

Public Property MeuItemsSource () As IEnumerable
Get
Return DirectCast (GetValue (macLista.MeuItemsSourceProperty), IEnumerable)
End Get
Set (ByVal value As IEnumerable)
SetValue (macLista.MeuItemsSourceProperty, value)
End Set
End Property
Sub New ()
End Sub
End Class

Then just set the file MainWindow.xaml another TabItem defined as follows:

Download your code now (notepad 132bytes)

Thus we show how to perform the binding in controls created by the user.
Get the complete project here: UserControl_Binding.zip