Facebook downgrade
Ok I had an issue with my new Blackberry curve and Facebook. The photo upload sucked! So I did some research and I found a post for version 1.5 of Blackberry Facebook software.
Version 1.5 is the version that worked!!!
Here is a link to my zip file that worked. And
here is the post. Note my zip file was for BB 4.5, not 4.6, BUT the post has both versions...
On SQL Express I had to do the following to get FULLTEXT index setup. I also had to make sure there was a primary key, then I went to the design of the table and right clicked on the primary key (or any colum) and select the fulltext index, when the dialog came up on the right side I selected the columns I wanted to add, click close and I was set...
use mydatabase
exec sp_fulltext_database 'enable'
go
exec sp_fulltext_catalog 'tblMyTable', 'create'
go
I did NOT write this, I wanted a javascript slidshow to show off project screen shots and found this code and wanted to make sure I had it in my archives to search for later! Got this off: http://www.javascriptkit.com/howto/show3.shtml
in head:
<script type="text/javascript">
<!--
//preload images
var image1=new Image()
image1.src="images/screenshot.jpg"
var image2=new Image()
image2.src="images/screenshot2.jpg"
var image3=new Image()
image3.src="images/screenshot3.jpg"
var image4=new Image()
image4.src="images/screenshot4.jpg"
//-->
</script>
In the body where you want the "images" to show up...
<a href="javascript:slidelink()">
<img src="images/screenshot.jpg" name="slide" border="0" width="492" height="354" /></a>
<script type="text/javascript">
<!--
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<4)
step++
else
step=1
setTimeout("slideit()",4000)
}
slideit()
function slidelink(){
if (whichimage==1)
window.location="page1.html"
else if (whichimage==2)
window.location="page2.html"
else if (whichimage==3)
window.location="page3.html"
else if (whichimage==4)
window.location="page4.html"
}
//-->
</script>
Ok I needed a function that would select certain CheckBoxList items of an ASP.NET CheckBoxList, so here it is, hope is helps someone else out!
if you want I use this function hightlight the item in yellow:
function uStyle(cb) {
cb.parentNode.style.backgroundColor = cb.checked ? "yellow" : "";
cb.parentNode.style.color = cb.checked ? "blue" : "";
}
function doCertainOnes(cbControl) {
var chkBoxList = document.getElementById(cbControl);
var chkBoxCount = chkBoxList.getElementsByTagName("input");
chkBoxCount[5].checked = true;
chkBoxCount[5].focus(); //GOING TO JUMP DOWN IN THE LIST TO THE FIRST SELECTED
uStyle(chkBoxCount[5]);
chkBoxCount[6].checked = true;
uStyle(chkBoxCount[6]);
chkBoxCount[7].checked = true;
uStyle(chkBoxCount[7]);
for (var i = 10; i < 50; i++) {
chkBoxCount[i].checked = true;
uStyle(chkBoxCount[i]);
}
}
I am selecting items (array) 5, 6, 7 and 10 through 49 in the list, now you can repeat the for loop and select different ones to. I happen to know that there will always be 100 items in the checkbox list and which ones they are... I use the "focus()" function to jump to the first item selected in the list...
Use it like this:
<a href="JavaScript:doCertainOnes('<% =CheckBoxList1.ClientID %>');">Select My Favs</a>
Ok it is NEVER a good idea to store a cookie on a client's machine with an ID or username and password in the cookie. Can steal the cookie. Come on, cookies are good to eat, chocolate chip cookies are my fav! Anyway, take a look at this, I think joomla does this and I don't take all the credit, but this works great:
1. Obviously a login.aspx page with a checkbox to save my login.
2. Evertime the user is logged in, either themselves or through the cookie, it deletes the old one in the table and writes a new one in the table and updates the client's cookie, or adds the cookie on the client
I call this function when the log in is successful
Public Sub doChocolateChipCookies()
Using cooks As New dsTableAdapters.cookiesTableAdapter (I use dataset object)
Dim q, s, t As String
Dim expires As Date
q = (a GUID the is stored in the user table) STORED IN THE USER TABLE
s = (this is the current sessionID from the server I save) STORED IN THE USER TABLE
t = RandomQIDNumber() (see function below) THIS IS NEW EACH TIME
Dim dt As New Data.DataTable
dt = cooks.GetDataByExpires(q)
If dt.Rows.Count > 0 Then
expires = dt.Rows(0)("expires")
Else
expires = Date.Today.AddDays(90)
End If
dt.Dispose()
Response.Cookies("epauth")("epq") = q 'guid to look up user to log them in with
Response.Cookies("epauth")("eps") = s 'series to match with token from db and cookie sent
Response.Cookies("epauth")("ept") = t 'token to match with db and cookie
Response.Cookies("epauth").Expires = expires
'if the "s" does NOT match "t", someone could have stollen the cookie we will clear all cookies from the db
'and require the user to login again...
'remove any old cookies from db
cooks.DeleteQuery(q, s) on every login, or cookie login, see later in this post, we delete old cookies out of the table
'add new one
cooks.Insert(q, s, t, expires)
End Using
End Sub
Public Function RandomQIDNumber() As String
Return String.Format("{0}{1}", System.Guid.NewGuid, Now.Second)
End Function
Ok, now when the session expires because I store info in session and in a session table in SQL 08 (my sessions are stored via SQL, not cookie based) I call this function and pass in the cookie if a cookie is found
If Not Request.Cookies("epauth") Is Nothing Then
If Not checkChocolateChipCookie(Request.Cookies("epauth")) Then
Session("epexp") = "y"
Response.Redirect("login.aspx")
End If
End If
Public Function checkChocolateChipCookie(ByVal cookie As HttpCookie) As Boolean
Dim cooks As New dsTableAdapters.cookiesTableAdapter
Dim q, s, t As String
Dim dt As New Data.DataTable
Dim bln As Boolean
q = cookie.Item("epq")
s = cookie.Item("eps")
t = cookie.Item("ept")
dt = cooks.GetDataByAuth(q, s, t) so I have a cookie table in the db and a ds routine that gets a table by all three values
If dt.Rows.Count > 0 Then
'lets setup a currentuser
Session("CurrentUser") = New objUser(q) I have an objUser class
doChocolateChipCookies() setup a new cookie delte the old one
bln = True
Else
'possible security issue, remove all
cooks.DeleteQuery1(q)
bln = False
End If
dt.Dispose()
cooks.Dispose()
Return bln
End Function
Hope this helps!
Hi there guys, had an issue with WebForm_DoPostBackWithOptions vs __doPostback. WebForm_DoPostBackWithOptions started showing up on a page and not showing up on other .NET pages. It was a pain in my butt! Because WebForm_DoPostBackWithOptions wasn't working, all my linkbutton had this javascript function rendered and none of the events were firing!
So after looking around I found out that I had some panels that were hidden on the page. And in one of those panels, I have a validation control, if a validation control is "hidden" on the page (the panel's visibility is set to false and later made visible) then .NET adds WebForm_DoPostBackWithOptions to the button controls and thus does not work.
To fix this I had to change the linkbuttons that were not hidden to cause validation to false. (CauseValidation=False). Once I did that, it work! What a pain in the butt!
My webservice call to, example: service1.asmx/myfunction just wasn't working on the server, but on my local box it worked great, so I had to add entries in the web config...
This needs to go between your <system.web> tags in the web.config
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
I needed to display the age of of a birthday field from a database. I was so tired of coding and came across this function!
I got this from a guy named "hans" on a forum, great little function I didn't have to write!
Private Function Age(ByVal Birthday As DateTime) As Integer
Dim year As Integer = Today.Year - Birthday.Year
If Today.Month < Birthday.Month Or (Today.Month = Birthday.Month And Today.Day < Birthday.Day) Then
Return year - 1
Else
Return year
End If
End Function