Wednesday, May 20, 2009

Disable Sprint One-Click Carousel

Here are instructions on how to disable/enable Sprint One-Click Carousel which is on the Samsung Rant phones and probably many others:

Push in ##3282# as if it was a phone number (it is also ##DATA#).
Go down to *.XUI and turn it on/off using XUI on/off.

The phone will run much better with it disabled. Mine used to freeze ocassionally while one-click was fetching updates or something. This was especially annoying when I was pressing * back to unlock the phone and it would just sit there doing nothing for 45 seconds while I repeatedly entered * back, * back, * back.

Tuesday, May 19, 2009

4 Javascript functions - Post 1


<html>
<head>
<title>Javascript examples</title>
<style>
.c1 {} .c2{} .c3 {} .c4{} .c5 {} .c6{} .c7 {} .c8{} .c9 {} .c10{}
.LockOff { display: none; visibility: hidden; }
.LockOn
{
display: block;
visibility: visible;
position: absolute;
z-index: 998;
top: 0px;
left: 0px;
width: 105%;
height: 105%;
font-size: 4em;
background-color: #ccc;
text-align: center;
padding-top: 20%;
padding-bottom: 40%;
filter: alpha(opacity=55);
opacity: 0.55;
}
</style>
<script>
var previousRow;
var previousRowColor;
function highlightRow(row, newColor)
{
if(previousRow != null) previousRow.style.backgroundColor = previousRowColor;
if(previousRow != row)
{
previousRow = row;
previousRowColor = row.style.backgroundColor;
row.style.backgroundColor = newColor;
}
else previousRow = null;
}

function getRadioValue(radioObj)
{
if (!radioObj) return "";
if(radioObj.checked) return radioObj.value;
for (var i = 0; i < radioObj.length; i++) { if (radioObj[i].checked) return radioObj[i].value; }
return "";
}

function hideClass(className)
{
for(i=0; i<document.styleSheets.length; i++)
{
rules = document.styleSheets[i].rules;
if(rules == null) rules = document.styleSheets[i].cssRules;

for(j=0; j<rules.length; j++)
{
if(rules[j].selectorText == '.'+className) rules[j].style.display='none';
}
}
}

function w()
{
var lock = document.getElementById('pleaseWaitPane');
if(lock) lock.className = 'LockOn';
}

function no_w()
{
var lock = document.getElementById('pleaseWaitPane');
if(lock) lock.className = 'LockOff';
}
</script>
</head>
<body>
<h2>Here are examples of 4 useful javascript functions</h2>
<div id="pleaseWaitPane" class="LockOff">
Please Wait   
<button onclick="no_w(); document.execCommand('stop');">Cancel</button>
</div>

<a href="https://webapp1.tamc.amedd.army.mil/phonelist/slowLoading.jsp" onclick="w();">Wait example link</a>

<form method="get" action="https://webapp1.tamc.amedd.army.mil/phonelist/slowLoading.jsp" onsubmit="w();">
<input type="submit" value="Wait example form"/>
</form>

<input type="radio" name="radio1" value="value1"/>value1
<input type="radio" name="radio1" value="value2"/>value2
<input type="radio" name="radio1" value="value3"/>value3
<input type="radio" name="radio1" value="value4"/>value4
   
<button onclick="var str=getRadioValue(radio1); if(str == '') alert('Please choose a value'); else alert('You choose '+str); ">
getRadioValue example
</button><br/><br/>

<b>HideColumn example</b>: click an x to temporarily hide a column.<br/>
<b>HighlightRow example</b>: click a row to see it highlighted.<br/>
<table border="1">
<tr>
<th class="c1">col1 <a href="#" onclick="hideClass('c1');">x</a></th>
<th class="c2">col2 <a href="#" onclick="hideClass('c2');">x</a></th>
<th class="c3">col3 <a href="#" onclick="hideClass('c3');">x</a></th>
<th class="c4">col4 <a href="#" onclick="hideClass('c4');">x</a></th>
<th class="c5">col5 <a href="#" onclick="hideClass('c5');">x</a></th>
<th class="c6">col6 <a href="#" onclick="hideClass('c6');">x</a></th>
</tr>
<tr onclick="highlightRow(this,'pink');"><td class="c1">test1</td><td class="c2">test2</td><td class="c3">test3</td><td class="c4">test4</td><td class="c5">test5</td><td class="c6">test6</td></tr>
<tr onclick="highlightRow(this,'pink');"><td class="c1">test1</td><td class="c2">test2</td><td class="c3">test3</td><td class="c4">test4</td><td class="c5">test5</td><td class="c6">test6</td></tr>
<tr onclick="highlightRow(this,'pink');"><td class="c1">test1</td><td class="c2">test2</td><td class="c3">test3</td><td class="c4">test4</td><td class="c5">test5</td><td class="c6">test6</td></tr>
<tr onclick="highlightRow(this,'pink');"><td class="c1">test1</td><td class="c2">test2</td><td class="c3">test3</td><td class="c4">test4</td><td class="c5">test5</td><td class="c6">test6</td></tr>
<tr onclick="highlightRow(this,'pink');"><td class="c1">test1</td><td class="c2">test2</td><td class="c3">test3</td><td class="c4">test4</td><td class="c5">test5</td><td class="c6">test6</td></tr>
<tr onclick="highlightRow(this,'pink');"><td class="c1">test1</td><td class="c2">test2</td><td class="c3">test3</td><td class="c4">test4</td><td class="c5">test5</td><td class="c6">test6</td></tr>
</table>

</body>
</html>

Friday, May 15, 2009

Sprint Cell Phone customization - Post 2

Changing the XUI URL and XUI FEED URL did nothing! It didn't even break any of the XUI features (that I've noticed yet). Nothing showed up on the tcpdump. I pointed both at my own server and watched for any traffic from my phone.

Here are some browser version and browser strings from my old phone and my new phone:

Samsung Upstage:
Default: Samsung-SPHM620 AU-MIC-M620/2.0 MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
Opera: Mozilla/5.0 (compatible; OpenWeb 5.6.1.3-03) Opera 8.54
Unknown: Mozilla/5.0 (compatible; OpenWeb 5.7.4-09)

Samsung Rant:
Polaris (Default): Samsung-SPHM540 Polaris/6.0 MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
BOLT: Mozilla/5.0 (X11; 78; CentOS; US-en) AppleWebKit/527+ (KHTML, like Gecko) Bolt/0.920 Version/3.0 Safari/523.15
Opera: Opera/8.01 (J2ME/MIDP; Opera Mini/3.1.10423/1724; en; U; ssr)

.NET annoyance 6 - asp:DropDownList


asp:DropDownList departmentDD has 0 elements.
In the code-behind I set departmentDD.SelectedIndex = 9;
In the debugger I see that departmentDD.SelectedIndex stays at 0.
I would expect it to throw an error, stay at zero, or switch to 9.
It stayed at 0. I'm ok with that.
Further down in the codebehind I do push some data into
departmentDD and departmentDD.databind.
Suddently departmentDD.SelectedIndex is equal to 9!
It remembered and set the value later once it could do it.
That's nice of it. I don't expect or want to object to be nice.
I want it to be consistant and predictable.




How many other weird quirks are in the web component objects?




So I ran another test.
asp:DropDownList departmentDD has 2 elements.
In the code-behind I set departmentDD.SelectedIndex = 1;
In the debugger I see that departmentDD.SelectedIndex is now 1.
I don't like this.
If it's going to some lame late update of selectedIndex when databound,
it should do it that way everytime.

Thursday, May 14, 2009

Sprint Cell Phone customization

I just got a Sprint Samsung Rant cell phone for free. It is a big bulky thing but has a nice keyboard.

I got the MSL service code, copied the primary NAI to the tethered NAI using bitpm and QPST, and other fun stuff I'm not going to explain in detail. If you enter ##DATA# as phone number you can get at a lot of extra settings. Also going into settings, display, press # has more settings but you need your MSL.

So anyways.. I want to customize the user interface. Using ##DATA# I can disable XUI making the One-Click Carousel go away. That leaves the phone in safe mode. It seems to be fully functional and faster in safe mode. Safe mode is probably how the phone manufacturer wanted the phone to work. so now we have One-Click or Safe Mode.

I found that ##BREW# brings up a whole different user interface. Now we have Brew also as a UI.

I see in ##DATA# an XUI URL and XUI FEED URL. They are set to tileservice.sprint.com/xui/live and feedservice.sprint.com. I've been searching google and I can't find anything about those settings or those urls! Has no one else wanted to change the tiles available in the One-Click interface? That can't be! Maybe sprint is killing off everyone mentioning it. I'll start saying my goodbyes soon.

Those urls are not accessable from my computer's browser. They don't seem to work from the default browser, Bolt, or Opera Mini 3 either. Maybe I will try some tests while using the phone as a modem (tethered). Maybe those services aren't on port 80.

Later I'll have to point those urls at my hosting server and use a packet sniffer to see what the phone sends. Maybe I will find some neat ways to customize the One-Click XUI.

Monday, May 11, 2009

.NET annoyance 5 - asp:CheckBox tag

HTML allows you to check a checkbox and submit any value.
Web developers get used to that type of thing.
.NET has an asp:CheckBox that only allows you to submit "on" or nothing.

I have a search page that has 10 checkboxes. In java I would just simply put those checkbox submitted values into a query (after sql escaping them). The checkboxes are type1-5 and skill1-5.

<input type="checkbox" name="type1" value="AD"/>Active Duty
<input type="checkbox" name="type2" value="CIV"/>Civilian
...

select name, department, type, skill from personTable where type in (@type1,@type2,@type3,@type4, @type5) and skill in (@skill1, @skill2, @skill3, @skill4, @skill5)

Push the request values into that sql query and Bing bang bong done. Not in .NET using asp:checkbox tags though. I would have to have code behind with the value of each of those checkboxes. I hate to put things that could change in two places.

<asp:CheckBox ID="type1" runat="server" Text="Active Duty" />
<asp:CheckBox ID="type2" runat="server" Text="Civilian" />
...

(In this example I am using a asp:SqlDataSource peopleDS) Then in the codebehind (in
peopleDS_Selecting) I would have to put code in to modify the sql query.
if (!type1.Checked) e.Command.Parameters["@type1"].Value = "AD";
if (!type2.Checked) e.Command.Parameters["@type2"].Value = "CIV";
...

Very annoying. Now I have the sql query split between .. Nevermind. I'll setup a better example later.

.NET annoyance 4 - Lack of conditional tags

There are no conditional tags in .NET web components.

So instead of a nice jstl tag in java like:

Java/JSP/JSTL/EL Solution #1:
<c:if test="${row.name == ''}"%gt;BLANK%lt;/c:if>

In .NET I would have to create a code-behind wrapper method like:

Solution #2:
protected String testEmpty(String stringToCheck, String trueReturn, String falseReturn)
{
if("".Equals(stringToCheck)) return(trueReturn);
else return(falseReturn);
}

Then use this in the form view:
<%# testEmpty(DataBinder.Eval(Container.DataItem, "name"),
"BLANK", DataBinder.Eval(Container.DataItem, "name")) %>

Or Solution #3:
protected void OnRowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView dataRow = e.Row.DataItem as DataRowView;
Object dataValue = dataRow["name"];
if("".Equals(dataValue)) e.Row.Cells[2].Text = "BLANK";
}
}

In solution 2 I am essentially creating my own conditional tag. Why shouldn't there be one like this by default? In solution 3 I am creating codebehind that will break if I reorder the fields in the formview.

.NET annoyance 3

If you use masterpages expect all of your form variables to be renamed for you.
<input type="yourName" value=""/>
Is submitted as ctl00$body$yourName.
http://forums.asp.net/t/647306.aspx

.NET annoyance 2

Make sure you don't use # signs in html comments. Master Pages choke on those. Example: <!-- #BeginEditable "sidebar" -->
http://www.vbforums.com/showthread.php?t=547336

.NET annoyance 1

I am converting web applications from Java to .NET C#.
Many things bother me about .NET.
One of them is that I can't reuse a Master Pages content ContentPlaceHolder.
Here is someone describing the exact lame problem:
http://stackoverflow.com/questions/760334/contentplaceholders-repeated-content