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