For each database engine we have different ways to retrieve the last inserted id, let’s say that we have the following table:

Product(productID, name, description)

And we have the following query:

<cfquery name=”test” datasource=”my_data”>

insert into Product (name, description) values (‘someProd’, ‘description O fThe Prod’)

</cfquery>

now for each engine we can get the last ID in the following way:

MSSQL: <cfoutput>#test.IDENTITYCOL#</cfoutput>

Oracle: <cfoutput>#test.ROWID#</cfoutput>

Sybase:<cfoutput>#test.SYB_IDENTITY#</cfoutput>

Informix:<cfoutput>#test.SERIAL_COL#</cfoutput>

MySQL: <cfoutput>#test.GENERATED_KEY#</cfoutput>

I guess that this is because each engine uses different methods and the internal database variables are different from engine to engine.

MSSQL, where is NOW() from MySQL?

Posted: 18th May 2012 by admin in MSSQL

To get the current date-time on MSSQL we just have to use the function GETDATE():

select GETDATE();

This will display the same as the NOW() function from MySQL.

MSN contact do not display on Pidgin Fix

Posted: 14th March 2011 by admin in Applications
Tags: , , ,

This happened to me a few weeks ago, when I tried to add some new contacts, I made the following steps:

1) I made a friend request.

2) they instead of accepting made a friend request also.

3) the result is that we both look off line 🙁

Looks like the problem is that MSN did not recognized Pidgin invite and since MSN sent a request it hangs on receiving the answer, so the only thing that I can recommend on this scenario is to confirm with your contact that they sent the request and make another request from Pidgin, once they accept the second invite you will be able to see each other.

here is th info that worked for me on this scenario, this only works for POP and it downloads only the inbox.

1) set POP server to: pop3.live.com and use the default port (995)

2) on usernameputit just like you where using Hotmail web site ([email protected], [email protected], etc.)

3) use SSL under secure connection.

4) use “Normal password” under Authentication method.

Done, this should do the trick, if you have any questions please leave a comment.

I was installing MS SQL Server when I get with that message, unfortunately the MS site(http://support.microsoft.com/kb/300956) was no help so after two hours of searching finally found that the problem was on one forum so I followed this steps:

1) first of all compile the following code using Visual Studio and run it:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string str2 = string.Format(“{0,3}”, CultureInfo.InstalledUICulture.Parent.LCID.ToString(“X”)).Replace(” “, “0”);
Console.Write(str2);
Console.Read();
}
}
}

This will give you a value… it was 00A on my computer

Function ereg() is deprecated in html2fpdf.php

Posted: 18th January 2011 by admin in programming
Tags:

Since on PHP the function ereg is deprecated we should use:

preg_match()

But here is a catch!!!! since the POSIX regular expressions are different from the PCRE used in preg_match(), you need to replace:

ereg(‘^([^=]*)=[“\’]?([^”\’]*)[“\’]?$’,$v,$a3)

with:

preg_match(‘/^([^=]*)=[“\’]?([^”\’]*)[“\’]?$/’, $v, $a3)

Note that the / works as delimiter.

That’s all

session_start(): ps_files_cleanup_dir

Posted: 17th January 2011 by admin in programming
Tags:

This happens when PHP does not have permission to write on the session directory, to correct this go to your /var/www directory and change the owner of the files to root like:

/var/www$ chown root.root myProjectDir -R

Where “myProjectDir” is the directory of the system that you are creating.

Using document.getElementById()

Posted: 2nd December 2010 by admin in programming
Tags:

With document.getElemebtById() we can have access and modify the properties of any HTML element for instance if we have the following element:

<input id="myText" type="text" />

To access all it’s properties like style or value, we just refer to the element and make the change:


<script>
document.getElementById("myText").value = "Hello";
</script>

If you put this pieces of code into a page it will not work because there is no action that call the the assigned variable, to make a proper call we should create a function or place a button if you like:

This issue is due has two possible causes, the first one in which the certificate may be expired, to fix this:

1) go to Tools->Certificates

2) delete the omega certificate

Try to log in again, if the problem persists is likely MSN is down on you region, so there is nothing more to do unless login in through a Web Based MSN service.