Thursday, December 8, 2011

Redirect to a mobile site

It's quite useful piece of code-behind, which redirects to a mobile version of the site.

Please use and modify for your needs. This routine is being written in VB.NET

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strUserAgent As String
Dim flag As String
flag = "0"
strUserAgent = Request.UserAgent.ToString().ToLower()
If (strUserAgent.Contains("iphone")) Then flag = "1"
If (strUserAgent.Contains("blackberry")) Then flag = "1"
If (strUserAgent.Contains("mobile")) Then flag = "1"
If (strUserAgent.Contains("windows ce")) Then flag = "1"
If (strUserAgent.Contains("opera mini")) Then flag = "1"
If (strUserAgent.Contains("palm")) Then flag = "1"
If (strUserAgent.Contains("android")) Then flag = "1"

If (strUserAgent.Length <> 0) Then
If (Request.Browser.IsMobileDevice = "True" And flag = "1") Then
Response.Redirect("http://www.test1.org")
End If
End If
End Sub

Wednesday, December 7, 2011

First Mobile Web site

It took 2 weeks to finish my first mobile website. It was quite interesting journey. First of all, jQuery Mobile is a new Javascript library and I was interested to implement it for new mobile site.

I discovered that current version of jQueryMobile does fully support with AJAX extensions all mobile platforms except Blackberry 5.

I had a problem with iPhone view. There is a quite good fix, which must be place in a head of the page to bring a picture to the stable condition on all mobile platforms:
<meta name="viewport" content="width=device-width, initial-scale=1">

Wednesday, November 16, 2011

jQueryMobile

Yesterday my coworker dowloaded the latest version of jQuery Mobile, and I received my new project. I have to update mobile site for www.usrds.org. Therefore I started to play around new Javascript library. By the end of the second day I created one page-application which will serve as a menu for the full site.

For resources I used:

Tuesday, November 8, 2011

Excel 2010 and SharePoint

Today I had to solve a problem existing in SharePoint 2010. Many of my users cannot download Excel files from SharePoint by double-clicking. It's a quite unusual because they are able to do the same thing with Word and Powerpoint files. Researching the problem, I found that we're not alone. Some users complain about the same thing, especially if file was saved in Excel 2010 format. I found out that in my case it only applies to Excel 2010 files. Querying the Web I found several solutions which I presented to my SharePoint administrator. He changed configuration in a minute, and my users became happy. Now everything work as should work.

About resources I presented:

http://neelb.wordpress.com/2011/09/20/unable-to-process-the-request-when-opening-an-excel-document-in-sharepoint-2010/

http://horsik.wordpress.com/2011/04/05/excel-services-is-unable-to-process-the-request-wait-a-few-minutes-and-try-performing-this-operation-again-%E2%80%9D/

http://blog.armgasys.com/?p=133

Monday, October 31, 2011

More Math


First of all, I found the excellent resource for doing more math. Please visit the page Authors did the best possible job to represent math in HTML. So, I use their experience to construct more formulas in HTML.

Here's a HTML code for first example (see pic):
<table border="0" cellpadding="0" cellspacing="0">
<tr align="center" style="line-height: 1em">
<td>&#921;<sub>k</sub>(t)= </td>
<td><small> <i>t</i></small><br>
&#8992;<br>&#8993;<br>
<small><i>0</i> </small></td>
<td><i>&#955;<sub>k</sub>(s)S(s)</i><small> </small>d<i>s</i></td>
</tr>
</table>

Here's a HTML code for second example (see pic):
<table cellpadding="0" cellsapcing="0" border="0">
<tr align="center">
<td><br />&#206;<sub>k</sub>(t)= </td>
<td><br />
<big><big>&&8721;</big></big><br>
<small><i>j:t,&#8804;t</i></small></td>
<td valign="top">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span style="vertical-align:-150%;">^ ^</span></td>
</tr>
<tr>
<td><i>&#955;<sub>k</sub>(t<sub>j</sub>)S(t<sub>j-1</sub>)</i></td>
</tr>
</table>
</td>
</tr>
</table>

Friday, October 28, 2011

Square Root on-line


Math formulas on-line...

I never did before... I had never thought I will have to code math formulas. But I did. It's was first time for me. Instead of images I used an art
of HTML to code some math formulas for scientific documentation I'm doing now for online presentation. First of all, I found some helpful pages for my
assignment. Here are some of them:

  • http://www.visibone.com/htmlref/char/ceralpha.htm

  • http://webdesign.about.com/od/localization/l/blhtmlcodes-math.htm

  • http://www.scientificpsychic.com/etc/square-root.html

  • http://www.alanwood.net/demos/symbol.html

Finally, I can reveal some results for my coding.
1.HTML-code for the first sample:

<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>d = </td>
<td>
<table cellspacing="0" cellpadding="0" border="0" bordercolor="red">
<tr>
<td style="border-bottom:2px solid #000000;">100 (<span style="text-decoration:overline"> x</span><sub>treatment</sub> − <span style="text-decoration:overline"> x</span><sub>control</sub>)</td>
</tr>
<tr>
<td align="center" valign="top">
<table cellpadding="0" cellspacing="0" align="left" border="0">
<tr>
<td><span style="font-size: large; vertical-align:-25%;">&#8730;</span>
<span style="text-decoration:overline">
&#189; (s<span style="font-size: 10px;vertical-align:+25%;">2</span><sub>treatment</sub> + s<span style="font-size: 10px;vertical-align:+25%;">2</span><sub>control</sub>)
</span></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

2.HTML-code for second sample:

<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>d = </td>
<td>
<table cellspacing="0" cellpadding="0" border="0" bordercolor="red">
<tr>
<td style="border-bottom:2px solid #000000;">100 (p<sub>treatment</sub> - p<sub>control</sub>)</td>
</tr>
<tr>
<td align="center" valign="top">
<table cellpadding="0" cellspacing="0" align="left" border="0">
<tr>
<td><span style="font-size: large; vertical-align:-25%;">&#8730;</span>
<span style="text-decoration:overline">
&#189; (p<sub>t</sub>(1-p<sub>t</sub>)+p<sub>c</sub>(1-p<sub>c</sub>))
   </span></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

Wednesday, October 5, 2011

New Line (VB.NET)

How to embedd a new line into body of the message sent from the aspx-form? I tried several combinations including
"<br>", "\n" and "\r\n". It does not work in ASPX-environment. Searching the Internet, I found interesting solution
which works for me.

message.Body = "This message was sent by " + name
message.Body += Environment.NewLine + "from email address " + email
message.Body += Environment.NewLine + "Organization: " + org
message.Body += Environment.NewLine + "Phone: " + phone
message.Body += Environment.NewLine + "Fax: " + fax
message.Body += Environment.NewLine + "Request " + data

Friday, September 23, 2011

Top of the Page.

<p align="center"><a href="#top"><img src="images/top_arrow.png" border="0" alt="top arrow" title="Go to the top of the page"/></a></p>
This code works in IE and does not work in other browsers. I found that I have to add <div id="top"> </div> on a top of the page.
After I added it works for all browsers. Enjoy world of browsers!

Thursday, September 15, 2011

Send Email via SMTP using VB.NET

Create an aspx-file and enter the code for form:
<div align="left" id="dataform">
<table align="left" cellpadding="5" cellspacing="0" border="0" width="100%" bgcolor="#f2f2f2">
<tr>
<td colspan="2" align="center"><h3>Data Request Form</h3></td>
</tr>
<tr>
<td align="center" colspan="2"><asp:Label ID="FinalMessage" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td align="right" width="250" valign="top"><asp:Label ID="Lbl_fname" runat="server" Text="Fist Name"></asp:Label></td>
<td align="left" valign="top">
<asp:TextBox ID="txt_fname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" id="reqFName"
controltovalidate="txt_fname" style="color:Red;" >*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" width="250" valign="top"><asp:Label ID="Lbl_lname" runat="server" Text="Last Name"></asp:Label></td>
<td align="left" valign="top">
<asp:TextBox ID="txt_lname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" id="reqLName"
controltovalidate="txt_lname" style="color:Red;">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" width="250" valign="top"><asp:Label ID="Lbl_email" runat="server" Text="Email"></asp:Label></td>
<td align="left" valign="top">
<asp:TextBox ID="txt_email" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_email" style="color:Red;">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ControlToValidate="txt_email"
ErrorMessage="You must enter a valid email address" style="color:Red;"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td align="right" width="250" valign="top"><asp:Label ID="Lbl_org" runat="server" Text="Organization"></asp:Label></td>
<td align="left" valign="top">
<asp:TextBox ID="txt_org" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" id="reqOrg"
controltovalidate="txt_org" style="color:Red;">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" width="250" valign="top"><asp:Label ID="Lbl_phone" runat="server" Text="Phone"></asp:Label></td>
<td align="left" valign="top">
<asp:TextBox ID="txt_phone" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" width="250" valign="top"><asp:Label ID="Lbl_fax" runat="server" Text="Fax"></asp:Label></td>
<td align="left" valign="top">
<asp:TextBox ID="txt_fax" runat="server"></asp:TextBox>
</td>
</tr>
<tr><td colspan="2" height="30px"></td></tr>
<tr>
<td align="right" width="250" valign="top"><asp:Label ID="Lbl_data" runat="server" Text="Data Requested"></asp:Label></td>
<td align="left" valign="top">
<asp:TextBox ID="txt_data" runat="server" TextMode="multiline" Rows="10" Columns="45"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" id="reqdata"
controltovalidate="txt_data" style="color:Red;">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="250"> </td>
<td align="left"><asp:Button ID="Send" runat="server" Text="Send" type="Submit"/>
<asp:Button ID="Reset" runat="server" Text="Reset" OnClientClick="this.form.reset();return false;" /></td>
</tr>
<tr>
<td height="20" colspan="2"> </td>
</tr>
</table>
</div>
Open the corresponding aspx.vb-file and enter "Imports System.Net.Mail" on a top. Enter the code below:Protected Sub Send_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Send.Click
'original code http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.from.aspx

Dim email, name, org, phone, fax, data As String
email = txt_email.Text.Trim()
name = txt_fname.Text.Trim() + " " + txt_lname.Text.Trim()
org = txt_org.Text.Trim()
phone = txt_phone.Text.Trim()
fax = txt_fax.Text.Trim()
data = txt_data.Text.Trim()

Dim [from] As New MailAddress(email, name)
Dim [to] As New MailAddress("astaroseletskaya@cdrg.org", "Alla Staroseletskaya")
Dim message As New MailMessage([from], [to])
message.Subject = "Data Request"
message.Body = "This message was sent by" + name + " from email address " + email + ". Organization: " + org + " Phone: " + phone + " Fax: " + fax + " Request: " + data

Dim smtpClient As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()
Try
smtpClient.Send(message)
FinalMessage.Text = "Message Sent"
Catch ex As Exception
FinalMessage.Text = ex.ToString()
End Try
End Sub

Tuesday, September 13, 2011

ListView with HyperLink column


Here's my first try to work with a ListView. Before I had never used this control, but in my situation it became very handy. The results on my picture.
Here's a source code

<asp:ListView runat="server" ID="ListView1"
DataSourceID="SqlDataSource1">
<LayoutTemplate>
<table runat="server" id="table1" cellpadding="0" cellspacing="0" border="0">
<tr runat="server" id="itemPlaceholder" ></tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr id="Tr1" runat="server">
<td id="Td1" runat="server" valign="top">
<asp:Label ID="Year" runat="server" Text='<%#Eval("year") %>'/>
</td>
<td width="30px"> </td>
<td id="Td2" runat="server">
<asp:Label ID="Title" runat="server"
Text='<%#Eval("title") %>' style="font-weight:bold;" />
</td>
</tr>
<tr id="Tr2" runat="server">
<td> </td>
<td width="30px"> </td>
<td id="Td3" runat="server">
<asp:Label ID="Author" runat="server"
Text='<%#Eval("author") %>'/>
</td>
</tr>
<tr id="Tr3" runat="server">
<td> </td>
<td width="30px"> </td>
<td id="Td4" runat="server">
<asp:Label ID="Journal" runat="server"
Text='<%#Eval("journal") %>'/>
</td>
</tr>
<tr id="Tr4" runat="server">
<td> </td>
<td width="30px"> </td>
<td id="Td5" runat="server">
<asp:HyperLink ID="Link" Target="_blank"
NavigateUrl='<%# Eval("link") %>'
runat="server">Link to the article</asp:HyperLink>
</td>
</tr>
</ItemTemplate>
</asp:ListView>

Most interesting part is a HyperLink column. This feature became very useful for my project and works just fine.

Again Section 508

Today I concentrate on section 508. There are a lot of new and interesting ideas to work on. I'm surprised, how difficult is to satisfy gov requirements. From another side, it's quite good that government takes care of people with vision problems. It's great that more and more people can access Internet and be part of Web community. American government creates a very detailed document to follow. Now I do have more understanding of section 508.

Wednesday, September 7, 2011

CSS maker

Here's a very useful site for css. I hope everyone will enjoy site capabilities and implements in own projects. Enjoy!

Friday, August 26, 2011

My Sharepoint project.


Within last 2-3 months I try to train myself in SharePoint 2010 to set up a website for my company. This site will serve a very simple goal is to share documents among different committees. I created site for each committee, structured and organized all them. I also set up permissions within the committee for different users. Needless to say, I learned a lot. I started with very simple one site project and ended with multiple sites, multiple libraries and lists SharePoint application. In time it became easy to use SharePoint navigation and all features presented in SharePoint 2010. For now I created a very structured website. Strangely, I did not use any programmatic tools. It was quite enough to use features built in SharePoint by Microsoft. My site was tested by internal users. And… they are OK. First part of my project is over. I’m working towards external users. I need some approval from them. I know, there is a request from some external users to begin to use my SharePoint–site. I hope, they will like it. Also I’m learning FBA (Form-Based Authentication) for SharePoint 2010. I have to implement a custom built login-page for my project. My SharePoint admin is on vacation, and I have plenty of time to learn.

Monday, August 15, 2011

Shadow

How to create a shadow around the border of rectangle with width 964px. It's quite simple and quick.
1. Insert div-tag into HTML-page.
<div class="shadow"> </div>
Put HTML code inside of the div
2. Insert a couple rows in css.
.shadow {
width: 964px;
margin: 0 auto;
-moz-box-shadow: 0 0 10px 1px #888;
-webkit-box-shadow: 0 0 10px 1px #888;
box-shadow: 0 0 10px 1px #888;
background-color: white;
}
Please view Microsoft documentation on the topic

Friday, August 12, 2011

Tutoring others

Just couple months ago I began exploring world of SharePoint. My goal was to be comfortable with software and build up first portal website for the company I work. I was very new and my knowledge was so limited. I had a feeling I never can build this site. Thanks to a couple books and my determination to learn SharePoint up to the point when I would feel comfortable to satisfy needs of my colleagues, today I finished my first SharePoint portal website and ready to present to my coworkers. I'm really proud of myself. My boss asked to organize a tutoring session for 12 people who will use my site a lot. It's quite privileage and honor to tutor people especially for me who learned new software quickly and effectively. I'm still in learning phase, I'm still thinking I need to improve my skills a lot. It's just a first steps for me. Now I have to prepare myself for tutoring presentation.

Monday, August 8, 2011

YearPicker with JQuery

Here's my first attempt to use JQUERY in my work. I created a year-picker. My script shows up the drop down box with years after 1993 and redirects to appropriate page on change.

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<div id="adr1">
<table cellpadding="10" cellspacing="0" border="0">
<tr>
<td><img src="sample.jpg" alt="Sample1" /></td>
<td><h2>Sample2</h2><br /><br />
<select name="yearpicker" id="yearpicker" onchange="location = 'adr_' + this.options[this.selectedIndex].value + '.htm';"></select>
<script type="text/javascript">
for (i = new Date().getFullYear(); i > 1993; i--) { $('#yearpicker').append($('<option />').val(i).html(i)); }
</script>
</td>
</tr>
</table>
</div>
</asp:Content>

Friday, July 22, 2011

ASP.NET Menu and cross-browser compatability.

I'm not a first or last one who spends a lot of time trying to adjust code for all possible browsers. In my previous post I uploaded a code how to general multilevel menu in ASP.NET environment. In this post I would like to take some time to talk about issues with various browsers which render code differently. Therefore, we might have different presentation.

I'm not first or last one who writes how painful for developers to code and recode pieces of software only because different browsers have own standards. As many of you know, in most cases Microsoft code works OK in IE, but have some problems with Firefox or Chrome.
In my case, it did work with IE and Mozilla Firefox, but if did not work for with Chrome and Safari. No matter how I tried to adjust menu for Chrome, it did not work out. I took a simple, but it looks to me, elegant decision.

I found a site and downloaded a sample-code. I worked on this code
and made the menu look exactly like I want and plugged into my code. Therefore, now my code works with most of popular browsers without any problem.

Friday, July 8, 2011

Custom Error Pages in ASP.NET

First of all, thanks Ted for putting out useful article about this issue.

1. Make sure HTTP errors is enabled/installed in IIS (see picture)



2. Add some code in top-level web.config file. (For example, this displays an ASP.NET page when a 404 error occurs, without rewriting the URL (the visitor will still see the requested URL in the address bar))
- inside <system.webServer>-tag add:

<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/errors/pagenotfound.aspx" responseMode="ExecuteURL" />
</httpErrors>

- inside <system.web>-tag add:

<customErrors mode="On" defaultRedirect="~/errors/GeneralError.aspx">
<error statusCode="404" redirect="~/errors/PageNotFound.aspx" />
</customErrors>

3. Create 2 error-pages GeneralError.aspx and PageNotFound.aspx-page in errors-folder.
4. For example, go to SRTR and try to type in URL box something like https://securesrtr.transplant.hrsa.gov/you and hit Enter. PageNotFound must show up.

Wednesday, July 6, 2011

Problems, problems, and problems.

Calendar implementation is taking a lot more time that we initially thought. We have to synchronize SharePoint calendar (one domain) with master Outlook calendar (another domain). It's not easy as it sounds. We spent 2 days googling Internet and trying to find a solution. Finally
we found something interesting and closed to our need. It's an Exchange calendar web part written by Swiss software company which specializes in Sharepoint web parts. It's quite interesting piece of software written for SharePoint. It contains several dll-files and one web part file.

We'll see if it's going to work for us... A day later I can say: IT WORKS only with right permissions between domains.

Friday, July 1, 2011

Always something new.

Every day I learn something new and exciting. Today I found a very interesting article and video.

Who invented mathematical constant pi? According to Wikipedia,the Greek letter p was first adopted for the number as an abbreviation of the Greek word for perimeter,
or as an abbreviation for "periphery/diameter", by William Jones in 1706. The constant is also known as Archimedes' Constant, after Archimedes of Syracuse who provided an approximation of the number, although this name for the constant is uncommon in modern English-speaking contexts. Now ancient constant is going through transformation. We shall see who is right...

Tuesday, June 28, 2011

Section 508 and alt-text

Today I spent fair amount of time researching screen readers programs to satisfy rules of section 508.
Actually I was intrigued by the idea to find free screen-reader program. I found several programs, but all of them don't read alt-text. The best FREE choice is NVDA (http://www.nvda-project.org/). The program reads out all links which is quite comfortable. I continued my search and found that only some of the screen reader programs CAN read alt-text. One of them is JAWS
(http://www.freedomscientific.com/products/fs/jaws-product-page.asp). JAWS is quite popular in software community.

List of screen reader programs

Actually I found another interesting site. It's a site of The HiSoftware CynthiaSays portal
(joint Education and Outreach project of HiSoftware, ICDRI, and the Internet Society Disability and Special Needs Chapter). Using the site you can check if your site is section 508 complaint. It generates quite good and detailed report. I really like the fact, that we can test compatibility before submitting the site. Previously I used the similar site for HTML-quality code. With HTML5 implementation, I'm not sure, that the html-validator will work good as it used to be.

Wednesday, June 22, 2011

How to add the custom theme to SharePoint-site.

Now I learned enough to begin customizations of my SharePoint sites. Unexpectable for me, I found a lot of short tutorials about SharePoint in www.youtube.com
First of all, I found excellent promoting videos for my presentation. Some companies posted case studies about SharePoint as new document management technology.
At my surprise, Coca-Cola has around 1,000 SharePoint sites, using SharePoint Monsanto increased work efficiency by 40%, even non-profit organizations such as
Leukemia & Lymphoid Society implemented SharePoint. Comcast offers SharePoint site as a part of their business internet package.

For now, I found a very good short tutorial to customize a theme on my site. It's really helpful.
Watch the video

Monday, June 20, 2011

.NET GURUS CAN COOK!

Yes, they can cook and bake. They even putted together a small cookbook for us. I think, it's interesting. Enjoy the recipes created by computer gurus.
I hope, each of you will find a tasteful recipe to prepare.
Download the book

Section 508 and ASP.NET

This is my second post about section 508. This time it's related to asp-server control Menu.
There are 2 attributes such as DynamicPopOutImageUrl and StaticPopOutImageUrl which is often used for building a Menu. Both of these attributes MUST be accompanied by another 2 attributes such as DynamicPopOutImageTextFormatString and StaticPopOutImageTextFormatString respectevely for proper implementation rules of section 508. Both of these attributes generate text for image alt attribute. It's quite important moment because menu plays an significant role on a web-page.

Actually I did not find much information about it on Internet. Therefore I decided to post a couple words about it.

Tuesday, June 14, 2011

Display data in label field and have line breaks that user entered in textbox

I received a request to modify a text to keep a line breaks previously entered in textbox. I tried several different methods to accomplish this task. The best solution is

<asp:Label ID="commentLabel" runat="server" Text='<%# Eval("comment").ToString().Replace(vbCRLF, "<br/>") %>' Wrap="true" />

It works very well. Thanks Forums.asp.net for quick and very elegant solution. My coworker have already whispered "Alla, Good Job!" It makes my day!

Thursday, June 9, 2011

Understanding the RESX Resource Files

(from article Peter Morath)

"When you first start looking through a SharePoint 2010 aspx page you realize that there isn’t an awful lot of actual changeable code in them. Its is pretty much impossible to decode the cryptic references used by the ASP.NET controls, such as text boxes, labels."

For example: <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,login_pageUserName%>" EncodeMethod='HtmlEncode'/>

You’ve found the wss.resx file under "drive:\inetput\wwwroot\wss\VirtualDirectories\app_name\App_GlobalResources".
Open the wss.resx file in text or application editor such Visual Studio 2010 or Notepad++ and find variable "login_pageUserName"

For example:
<data name="login_pageUserName">
<value>User name:</value>
</data>

To change the value of login_pageUserName (text), please rename this variable in aspx-file. For example, login_pageUserName_new
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,login_pageUserName_new%>" EncodeMethod='HtmlEncode'/>

And add new data element in wss.resx file such as
<data name="login_pageUserName_new">
<value>Customer name:</value>
</data>

If you were to change the contents between the <value>…</value> tags, the changes would be picked up by all aspx pages that referenced it.

Wednesday, June 8, 2011

Requirement analysis

How to conduct a proper requirement analysis?..

Here are some sites with useful information for requirement analysis

1. Wikipedia
2. Tips to gather business requirements
3. Mind tools
4. Business requirements for Sharepoint projects

Tomorrow I'm beginning to gather requirements for my first Sharepoint project.

Tuesday, June 7, 2011

First Sharepoint site


Here's my first Sharepoint site. I'm still very beginner in Sharepoint and search for any good tutorials, especially video-ones. If you know, please leave a comment.

The Ultimate Guide to Twitter Optimization

I really like to read about new ideas for SEO. It brings a lot of new information and interesting things. Therefore I subscribe and often read Website magazine. This time I found an interesting article about Twitter Optimization.
I'm not the biggest Twitter fan, but it looks like this tool take a lot of attention and many people use it, someone of them even for business needs. Business needs require a business logic. So, twitter came up with own optimization techniques. Here they are:
read this
 It's quite interesting what do you think about them, do you use them?

Friday, June 3, 2011

Step-By-Step


I'm facing my first project with Sharepoint. As a beginner, I need some basic knowledge about Sharepoint.
A coworker borrowed me a very good book for beginners. It's "Microsoft® Windows® SharePoint® Services 3.0 Step by Step" by
Olga Londer, Bill English, Todd Bleeker and Penelope Coventry. I'm doing my steps through book and software. Wish me GOOD LUCK!

Wednesday, June 1, 2011

How to combine three columns into one column using SQL?

I need to display SSN as one datacolumn in Gridview. My data is in 3 different table fields. As I found, there is no way to combine data using BoundField.
Therefore, I use SQL statement to concatenate 3 fields together. Here is a statement:
SELECT studentid, fname, mi, lname, dob, (ss1 + '-' + ss2 + '-' + ss3) as ssn FROM students order by studentid asc

Now I can easily display SSN in GridView:
<asp:BoundField DataField="ssn" HeaderText="SSN#" SortExpression="ssn" />

Tuesday, May 31, 2011

Introducing HTML 5

Finally I finished my first HTML 5 reading. My very first book about such important topic was "Introducing HTML 5" by By Bruce Lawson and Remy Sharp (http://introducinghtml5.com/).
What I should say about the book... First of all, I choose this book because of good Internet reviews. Several websites suggested that if you’re looking for a nice, readable, non-stuffy, example-rich book to help you get started with HTML 5, please check out Bruce Lawton’s and Remy Sharp’s "Introducing HTML 5" For a second, the same sites listed areas of coverage of HTML 5 in the book, which was very interested to me. So, I was intrigued by the book.
The book successfully and intelligently covers the news things in HTML5, offers meaningful examples and provides a link between old world (HTML 4) and new world (HTML 5). It's not strictly manual. I would say, it's author's presentation of new version of the language, which covers certain areas for as many as possible browsers including a mobile ones. It gives overall conception for those who used to deal with HTML4 and tries to learn HTML 5. Definetely it's a book for experienced technical professionals. Personally I want to know how HTML 5 will work in multi-browser world. In recent years we have a choice to choose a browser and device to surf, but we did not have a choice in language. It looks to me, HTML 5 does a good work for multi-platform Internet word.
Definetely I would recommend this book for pro.

Thursday, May 26, 2011

SEO (several tips)

1. Very often people ask me the same question "Where to get some publicly available info about their website?"
and my very first answer is www.alexa.com . Using www.alexa.com, you can find Alexa Traffic Rank, link popularity, top sites by country or by category, search analytics, and audience. It's quite full picture for someone who is anxious about how his/her website is doing in Internet community.

2. What is Link popularity? It's new Internet-based terminology, but it has old meaning for those who like to make friends in life.
So according to Google, "link popularity refers to the number of hyper-links pointing to a page on the Web." Link popularity assumes that NOT all inbound links are equal.
How to check you linkage? I prefer www.linkpopularity.com . I'm sure you can find on Internet more tools to measure your site link popularity and all of them equally good.
They will give you a picture who is talking to you on Internet, who uses your info and who refer the traffic to you site.

3. Link exchange program. There are a lot of sites which offer this service to site owners. Personally I don't recommend to use these programs. Make a friends in Internet community by yourself. I know it's not easy, but it's possible.

Good luck!

Monday, May 23, 2011

ASP.NET Reset button to clear form fields

As per me there is no such reset functionality provided by Asp.Net. So, I decided to research anything about possible solution. One thing what I have tried was a server-side routine such as

For Each ctrl As Control In Me.Controls
' clean up the textboxes
If TypeOf ctrl Is TextBox Then
DirectCast(ctrl, TextBox).Text = String.Empty
End If

' clean up the checkboxes
If TypeOf ctrl Is CheckBox Then
DirectCast(ctrl, CheckBox).Checked = "False"
End If

'clean up dropdown lists
If TypeOf ctrl Is DropDownList Then
DirectCast(ctrl, DropDownList).SelectedIndex = -1
DirectCast(ctrl, DropDownList).Text = String.Empty
End If
Next
This idea did not work out at all and I moved to javascript-based solution. I found 2 choices. One of them to add a code
ResetQuote.Attributes.Add("onClick", "document.forms[0].reset();return false;"). I tried and this did work out at all. therefore I choose the last possible solution. It's elegant and Front-end solution. It did not take any of server resources. here it is:
<asp:Button id="btnReset" OnClientClick="this.form.reset();return false;" runat="server" Text="Clear Form">
Magically this idea works very well. From application stand point, this is the ideal solution in a way to implement button "reset/clear form". I hope, it will work for you.

Tuesday, May 17, 2011

Adding Client-Side Message Boxes in ASP.NET Pages

Today I learned about option for LinkButton "onclientclick" This option gives me a chance to execute a javascript function directly from asp.net page. Here's an example

<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" onclientclick="return confirm('Are you sure you want to delete?');" />

We can reach the same effect using code-behind:

Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If (Not Page.IsPostBack) Then
Me.DeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")
End If
End Sub

It's quite interesting how asp-net works with javascript

Section 508

Many people has no clue about "section 508". I would like to spend some time and blog about this topic. For developers who used to develop a lot of front-end screen "section 508" becomes one of the important issues. First of all, there are number of sites dedicated to such important topic. Here are two of them:
section508.gov
HHS about section 508

Recently I did one special project dedicated to section 508. I worked on SRTR.ORG
I would like to share some guidelines from section 508 acceptance list.

- Checked for Description and Title Metadata, inserted Copyright Status
- Checked all URL’s contain the correct hyperlink, displayed the fully qualified URL and all URL's linked to the correct Web destinations
- Inserted in all images, grouped images and non-text elements that convey information ALTERNATIVE text descriptions
- Checked if all complex images have descriptive text immediately after the image
- Checked if all data tables in the document have a logical reading order from left to right, top to bottom
- Checked all documents file name not contain spaces or special characters. It's quite important for cyber security.
- Checked if document is free of scanned signatures because scanned signatures within documents are a considered a theft-of-identity risk

Full section 508 acceptance list could be find on Webaim

Monday, May 16, 2011

ASP.NET - Limit number of characters in TextBox control

I researched Internet and found a perfect solution . I would like to copy the solution into my blog for future references.

Here it is:

1. Create folder Scripts and file JScript.js in it. Copy and paste this code into it.

function validateLimit(obj, divID, maxchar) {

objDiv = get_object(divID);

if (this.id) obj = this;

var remaningChar = maxchar - trimEnter(obj.value).length;


if (objDiv.id) {
objDiv.innerHTML = remaningChar + " characters left"; }
if (remaningChar <= 0) {
obj.value = obj.value.substring(maxchar, 0);

if (objDiv.id) { objDiv.innerHTML = "0 characters left";}
return false;
}
else
{ return true; }
}

function get_object(id) {

var object = null;
if (document.layers) {
object = document.layers[id];
} else if (document.all) {
object = document.all[id];
} else if (document.getElementById) {
object = document.getElementById(id);
}
return object;
}
function trimEnter(dataStr) {
return dataStr.replace(/(\r\n|\r|\n)/g, "");
}

2. Create aspx-page and insert a code below:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Without master page</title>
<script type="text/javascript" src="Scripts/JScript.js" ></script>
</head>
<body>
<form id="form1" runat="server">
<div id="lblMsg1">240 characters left</div>
<asp:TextBox ID="TextBox1" runat="server" Height="50px" MaxLength="240" TextMode="MultiLine"
Width="600px" ToolTip="Summary:(240 characters)"
onkeyup="return validateLimit(this, 'lblMsg1', 240)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" Display="Dynamic"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
<br /><br /><br />
</form>
</body>
</html>

3. Test the aspx-page.

Friday, May 13, 2011

HTML-code

Recently I began experience some difficulties to insert "raw" HTML code in blogger-window. The problem was that HTML code did not show up under browser as HTML code because all tags were executed. I still want to show some code in my blog. Therefore I searched Internet for the answer. And I found very easy and appropriate solution: replace all "<"-signs to and all ">"-signs on

I tested and it works. Now I can insert some "raw" code. Thanks Mr.Internet for a good tip.

Tuesday, May 10, 2011

Error:


Error Message: "Cannot insert the value NULL into column; column does not allow nulls"

The code, I have written, tries to insert NULL into column, which does not allow nulls, and column is a primary key one.
Solution:
- set up "Data type" as "int" for the column
- set up Identity Specification to Yes (see image)
- test the code

Monday, May 9, 2011

Sharepoint (first steps)

Next project. What should you do facing a new and challenging project? How to "attack" new assignment?
I know, I can get many suggestions and all of them would equally good and promising. Also I think, one of the suggestion would be to get as many as possible self-help books and read, read, and read...
Taking this advice, I have already choosen 3 books for initial reading. Here they are:
- "Inside Microsoft SharePoint 2010" by Ted Pattison
- "Sharepoint 2010 all-in-one for dummies" by Emer McKenna
- "Sharepoint 2010 Development with Visual Studio 2010" by Eric Carter
So far , I did not find a good tutorial online for beginners. I would be more than happy if someone will help me with this task (!)
I have already read first chapter of "Sharepoint 2010 all-in-one for dummies". It's quite good and informative. Now I'm taking another book "Sharepoint 2010 Development with Visual Studio 2010" and begin my reading. I hope to enjoy it. Also I'm taking some steps to learn more about HTML 5.

Saturday, May 7, 2011

ASP.NET (ask question)

Sooner or later all of us have questions without answers. Where to find reliable answers? There are lot of ways and one of then is Forums on ASP.NET.

Friday, May 6, 2011

Spokeo.com

Here's my first blog-entry about sites we should know and use. In a future I plan to add new sites for public use.

Spokeo.com

Additional info about site

Beginning ASP.NET 4: in C# and VB

Beginning ASP.NET 4: in C# and VB (Wrox Programmer to Programmer)
Imar Spaanjaars

Here's my first computer book I have read this year. It's good and "must have" book. I did not read a previous one and was a bit skeptical about this book. Truthfully speaking, I'm always skeptical about computer books because for me many of them are so outdated.
This book is quite different. Actually I learned a LOTS in the book even if its a starting book for ASP.NET. This is the first time I read a WROX book and I am impressed! before choosing the book, I took some time and read feedback about the book on www.amazon.com Here some of the best responses:

  • Lots of great examples step by step with a section that explain you the whole process each time.

  • Code are written in both C# and VB.NET.

  • Very comprehensive writing. The author explain everything and make things clear!

  • Very informative even if you are an advanced user in ASP.NET.

  • The book cover a nice project which go from a subject to another easily.

  • Cover LOTS of subject, even cover AJAX and JQUERY.


I hope, you will enjoy this book as much as I did. Definitely I recommend this book for those who are heavily involve in software development using Microsoft technologies.
I found very useful author's web site imar.spaanjaars.com

Thursday, May 5, 2011

Time-dependent Hyperlink (VB.NET)

1. Open up Visual Studio 2010.
2. Create web-form and name it default.aspx
3. Drag Hyperlink-element from toolbox and place on a page between body-tags.
Give ID="HyperLinkTime"
Save the form.
4. Open up code-behind page Default.aspx.vb and place some code on Page_Load
'Time-dependent hyperlink
Dim DateStart As Date = "3/1/2011 12:00AM"
Dim DateEnd As Date = "6/1/2011 12:00PM"
Dim DateNow As Date = System.DateTime.Now

Dim result1 As Integer = DateTime.Compare(DateNow, DateStart)
Dim result2 As Integer = DateTime.Compare(DateNow, DateEnd)

If (result1 > 0) And (result2 < 0) Then
HyperLinkTime.NavigateUrl = "http://www.yahoo.com"
HyperLinkTime.Text = "Yahoo.com"
Else
' Do nothing
End If
Save and test.
Hyperlink "Yahoo.com" will show up only between 3/1/2011 and 6/1/2011. The dates can be changed any time.

Hello World!

If you want to become a better programmer, start blogging!