February 17, 2019

Check plagiarism on essays, homework and academic papers

TheGuardian recently published an interesting report on plagiarism of essays, homework and academic papers:

Reports suggest plagiarism is rife in universities. The internet has provided a “wealth of information that can be plagiarised”, says Wendy Sutherland-Smith, an expert in plagiarism from Deakin University. As a result, a Times investigation two years ago found almost 50,000 students were caught cheating in the previous three years, amounting to a so-called “plagiarism epidemic”. The government and universities are meanwhile desperately trying to crack down on essay-mill websites, which write essays for paying students.
This could be prevented by using a tool like Copybot to check for plagiarism from Wikipedia (and other sources).

Copybot shows you exactly which passages of homework, essays and papers were copied, and from where.

Most plagiarism checkers will store and use your documents on checks for other users, which is a questionable privacy practice. Copybot is a bit more focused on privacy and stores your document until you delete it, but it is not visible or accessible to anyone but you. The document is only stored to allow you to access it and see the results, but it is not used for other plagiarism checks.


October 27, 2009

ORA-27069 and ORA-01114

When creating a new object on a database (e.g. an index, a table) you get a set of ORA-27069 errors, each of them accompanied by ORA-01114. The description for these errors is:

ORA-27069 skgfdisp: attempt to do I/O beyond the range of the file
Cause: This is an internal error. The range of blocks being read or written is
outside the range of the file, additional information indicates the starting block
number, number of blocks in I/O, and the last valid block in the file.
Action: Check for a trace file and contact Oracle Support Services.

ORA-01114: IO error writing block to file string (block # string)
Cause: The device on which the file resides is probably offline. If the file is a temporary file, then it is also possible that the device has run out of space. This could happen because disk space of temporary files is not necessarily allocated at file creation time.
Action: Restore access to the device or remove unnecessary files to free up space.

How to work it out:

This can happen for a multitude or reasons: damaged storage, lack of storage space, etc. On Windows, namely Windows Server 2003 running a 32-bit file system, this can happen when one of the files in your tablespace reaches or crosses 4GB, 8GB, 12GB etc, so this may be the first thing to check.

You can use Oracle Enterprise Manager to check this: http://download.oracle.com/docs/html/B14399_01/rev_precon_db.htm#CACDJBBF

If, in fact, the problem is related to having a file with the characteristics above, you have plenty of options. For example, if you have an 8GB file in the USERS tablespace, you may have trouble adding data to that tablespace (which is the default for user tables, indexes, etc). To solve it, you can:
- set the file's maximum size below the size limit that started causing problems (e.g. 8GB)
- add more files to the tablespace where that file resides, so the tablespace can grow without creating very large files
- move indexes to a specific table space (ALTER INDEX REBUILD TABLESPACE ;)
- furthermore, you can create specific tablespaces for specific objects and move them there, which is way better than having every single object cramping up your default tablespace


All in all, the best way to solve this problem is to correctly manage your storage, tablespaces and files. Oracle ASM can help you with this. If you're running older versions, start here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/physical.htm

June 18, 2009

Format large HDD as FAT32 for your PS3 or DVD

Do you have a PS3 or DVD/Bluray player on which you'd like to use your external USB HDD, but it's capacity (160GB, 250GB, 320GB, 500GB, 1TB, whatever) results in the drive being formatted in NTFS, and therefore your console or disc player can't read it?

You have to format it in FAT32 so your Playstation or DVD can read it, but as you probably noticed already, you can't do this in Windows XP: http://support.microsoft.com/kb/314463

But you can simply grab a free utility, like EASEUS Partition Manager, format the external USB HDD to FAT32 and you're good to go! :)

May 8, 2009

Copy SQL Server database tables

Ever needed to copy an SQL Server database, but get only its data and leave out everything else?
Here's a T-SQL script that you can use to copy all the database's tables' data, and leave out everything else (indexes, partitions, programmability components, etc...)
The script will go through all tables in the 'dbo' schema of the source database (named 'sourceDatabase' in this example), create a copy of the table in the 'dbo' schema of the destination database (named 'targetDatabase') and insert all data from the source table in the destination table (by using a SELECT INTO).

Here's the code:

DECLARE @tableName varchar(300)
DECLARE @sqlStmt nvarchar(300)

DECLARE curTables CURSOR LOCAL FOR
SELECT table_name FROM sourceDatabase.INFORMATION_SCHEMA.tables


OPEN curTables

FETCH NEXT FROM curTables INTO @tableName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sqlStmt = 'SELECT * INTO targetDatabase.dbo.' + @tableName + ' FROM sourceDatabase.dbo.' + @tableName
EXEC sp_executesql @sqlStmt

FETCH NEXT FROM curTables INTO @tableName
END

CLOSE curTables
DEALLOCATE curTables

August 14, 2008

Hyperlink on Oracle Answers or Interactive Dashboard values

This is both an example on how to add custom hyperlinks to Oracle BI dashboards' values and on the importance that context information from the Web has for BI systems.

So let's get to it: create a new Answers request and include the columns you desire. Go to the Criteria tab and, for the column on which you want to create the hyperlink, click on the "Column Properties" button. Click the "Data Format", enable "Override Default Data Format" and on "Treat Text As" choose "Custom Text Format".

On the text box below, you'll have to enter the expression to create the link - the syntax isn't quite well documented, although this is where you usually insert ActionLinks to interact with Siebel. To create a standard hyperlink, the syntax is:
@[html]"<a href=\"http://codingassistance.blogspot.com \">"@"</a>"

Trying it out, it's easy to determine that the "@" (quotation marks are required) stands for the row value, so this hyperlink will be something like <a href="website.com">RowValue</a>.

If you want to kick it up a notch, you can pass the row value itself as an argument for the URL; for example, the expression
@[html]"<a href=\"http://maps.google.com?q="@"\" \" target="_blank">"@"</a>"
passes the row value to (the q parameter of) maps.google.com and opens a new window pointing to the map of the row value. On a dashboard, the row values are hyperlinks to, for example, "http://maps.google.com/?q=SANTA%20CRUZ%20DAS%20FLORES" where "SANTA%20CRUZ%20DAS%20FLORES" is one of the row values. In this particular case, the row value is a geographical location, hence the choice of Google Maps.

We can embelish it a bit by adding a title to the anchor, like this:
@[html]"<a href=\"http://maps.google.com?q="@"\" \" target="_blank" title=\"Click to view this location on a map\">"@"</a>"
(don't forget to escape your quotation marks!)

So, bringing it all together, we'll have a dashboard like this:



After clicking, a new window opens with a map for the location:





July 31, 2008

Describe a table in SQL Server 2005

Here's a quick snippet of SQL that allows you to describe a table in a SQL Server 2005 database, similar to the DESC or DESCRIBE command in Oracle and MySQL:

SELECT column_name, data_type,column_default, is_nullable, character_maximum_lenght, numeric_precision, datetime_precision
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name='MyTableName'

Detailed info
on INFORMATION_SCHEMA: http://msdn.microsoft.com/en-us/library/ms186778.aspx

May 14, 2008

Error 26 connecting to SQL Server 2005

While connecting to a remote SQL Server 2005 instance, you get an error like this:
SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

If you are sure that there are no firewalls blocking connections between the two machines, and that the server is configured to accept remote TCP connections, then the likely solution is to start the SQL Server Browser service on the remote machine.


More information:

SQL Server Browser service: http://msdn.microsoft.com/en-us/library/ms181087.aspx
Configure remote connections on SQL Server 2005: http://support.microsoft.com/kb/914277

April 24, 2008

Oracle BI default password

If you are having trouble (rejected password) logging in to Oracle Answers or Oracle BI Publisher, be aware that both have a default password that differs from the password you were asked upon installation of the Oracle BI suite. The default account credentials for these services are:
Username: Administrator
Password: Administrator

(remember that the password is case sensitive)

February 19, 2008

How to create folders programatically in Business Objects XI repository

This is an example of how to create folders in the Business Objects XI InfoStore using VB6 and the COM API. This code creates a folder called "MyNewFolder" beneath "TestFolder", which is created at the folder root.



Dim sessionMgr, entSession, infoStore, pluginMgr, folderPlugin

'create a session and connect to the InfoStore
Set sessionMgr = CreateObject("CrystalEnterprise.SessionMgr")
Set entSession = sessionMgr.Logon("Administrator", "myPassword", "myBoServer", "secEnterprise")
Set infoStore = entSession.Service("", "InfoStore")
Set pluginMgr = infoStore.PluginManager
Set folderPlugin = pluginMgr.PluginInfo("Folder")

Dim infoObjectCollection, newFolder

Set infoObjectCollection = infoStore.NewInfoObjectCollection()
Set newFolder = infoObjectCollection.Add(folderPlugin)

newFolder.Title = "MyNewFolder"
newFolder.Description = "This is the folder we're creating in the example"

Dim infoObjectCollectionAux 'used to help determine the parent folder id
Dim queryStr As String
Dim queryStr1 As String
Dim queryStr2 As String

'build a query to get the parent folder id
'you can test this using the Query Builder in the Admin Launchpad
queryStr1 = "SELECT * FROM CI_INFOOBJECTS WHERE SI_NAME='"
queryStr2 = "' AND SI_KIND='Folder' AND SI_PARENTID=0" 'the root folder has id=0
queryStr = queryStr1 & "TestFolder" & queryStr2

'execute the query and get the parent folder id
'if "TestFolder" doesn't exist in the root, the infoObjectCollectionAux will be empty
Set infoObjectCollectionAux = infoStore.Query(queryStr)
Dim parentFolderId As Long
'only get the first item, for example simplicity sake
parentFolderId = infoObjectCollectionAux.Item(1).Id

'set the new folder's parent id and commit the changes
newFolder.ParentID = parentFolderId
infoStore.Commit (infoObjectCollection)

January 14, 2008

WIS 00504 error on Business Objects XI

If you get a WIS 00504 error message when trying to perform an action that requires access to a Universe (e.g. new WebI or DeskI report), this probably means that you don't have enough security privileges to acess the Universe's data. You need to have "View on Demand" rights over the Universe and "View on Demand" rights over the corresponding Universe Connection.

January 2, 2008

SSIS Script Component throws "Object reference not set to an instance of an object"

In Integration Services 2005, if you get an Object reference not set to an instance of an object exception when trying to manipulate rows from a Script Component, even after you have guaranteed that the column is set as an input for the script, try checking if the column you're accessing is not null, using the automatically available "_IsNull" property. For example, if the input column is called myInputCol, you can try something like this:
If Not Row.myInputCol_IsNull Then
'code that access the column here
End If

December 27, 2007

How to reset SQL Server identity column

Generally, to reset an identity column to value n on table XYZ:
DBCC CHECKIDENT('XYZ',RESEED,n)

So, to reset an identity column to value 17 on table XYZ:
DBCC CHECKIDENT('XYZ',RESEED,17)

November 21, 2007

The page cannot be found in Infoview

In Business Objects XI, you may get an error saying The page cannot be found when trying to access InfoView or the Central Management Console. One cause for this problem is that, on Windows Server 2003, IIS 6.0 blocks .NET 2.o .aspx applications by default. To enable them, go to Administrative Tools -> Internet Information Services (IIS) Manager, click the Web Service Extensions, select ASP .NET v2.0xxxx and click Allow.

Detailed info on this operation:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/596ff388-bc4c-472f-b029-aea2b0418bea.mspx?mfr=true

[repo_proxy 13] SessionFacade::openSessionLogon with user info has failed

When trying to log on to InfoView on BusinessObjects XI, you may get this error because the CMS can't be contacted. This may be happen because of a firewall or traffic filtering on your network. The first reason is reasonably easy to solve: make sure there is no firewall blocking you in the path from the client to the BO server. If you suspect it's the latter, try putting localhost on the System textbox.

November 1, 2007

Access and consume a Web Service from Integration Services

Sometimes you need to consume a Web Service that is specific enough for you not be able to use the default Web Service Task available on SSIS 2005.

In this example I'm going to show how to consume a Web Service that returns a .NET object (a serialized DataSet, for example). For this, we'll have to use a Script Component that allows us to insert some custom code that is able to do what we need. The
Script Component will be part of a Data Flow acting as a Source that provides rows to Transformations down the pipeline.

Acessing a Web Service from a Script Component is pretty much similar to how we'd do it in a standard .NET application:
  1. You need a proxy class (in the VB language) for the Web Service you want to consume. You can create it using the wsdl.exe application like this:
    wsdl /language:VB http://yourserver/yourWebService?WSDL /out:yourProxyClass.vb
  2. Access the Script Component's code and, on the code window, go to the Project menu and select "Add Existing Item". The item you have to add is the proxy class you created previously (yourProxyClass.vb, in this example). Next, go to the Project menu, select "Add Reference" and add the System.Xml and System.Web.Services assemblies.
  3. Now you have to write the code to acess the Web Service and output its results onto the outputs you defined for the Script Component.
    In this example, the Web Service defines a class called Export which has a method called getDataSet(String) that outputs is a serialized DataSet. The Script Component has one output, called Output0, with two columns (colOne and colTwo) defined as a String (DT_STR)
Public Class ScriptMain
Inherits UserComponent


Dim webServiceExport As Export
Dim dsResults As DataSet

'Prepare the required connections and initialize objects
Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
MyBase.AcquireConnections(Transaction)

webServiceExport = New Export()
dsResults = Nothing

End Sub


'Get the data from the WebService
Public Overrides Sub PreExecute()
MyBase.PreExecute()

webServiceExport.Timeout = 3600
dsResults = webServiceExport.getDataSet("test parameter string")

End Sub


'Go through the received data and add it to the output rows
Public Overrides Sub CreateNewOutputRows()

Dim dtResults As New DataTable

dtResults = dsResults.Tables(0)

Output0Buffer.colOne = dtResults.Columns(0).ToString()
Output0Buffer.colTwo = dtResults.Columns(1).ToString()

Output0Buffer.AddRow()

End Sub

End Class

If you need some Web Services for testing you can search at http://www.webservicex.net/WS/default.aspx

Detailed information links:
Wsdl.exe:
http://msdn2.microsoft.com/en-us/library/7h3ystb6(VS.80).aspx
Referencing Assemblies in a script: http://msdn2.microsoft.com/en-us/library/ms136007.aspx
Using the Script Component as a source: http://msdn2.microsoft.com/en-us/library/ms136060.aspx


October 25, 2007

Convert Access' Memo to a VARCHAR string

The problem: the Memo data type in Access is a Unicode text stream (i.e. no fixed width) and the VARCHAR type is a non Unicode text string (fixed width). So, if you're transferring data from a Memo column on an Access file to a database column of the VARCHAR(n) type, you'll have to use a Data Conversion transformation to convert the Memo to String (DT_STR, which maps to VARCHAR) and when you do, Integration Services will throw the following error
Conversion from DT_NTEXT to DT_STR is not supported
This means that you cannot directly convert a Unicode stream to a non Unicode string.
What you can do in this situation is create a Data Conversion that converts the Memo column to DT_TEXT (non Unicode stream) and after that use another Data Conversion to convert that same column from DT_TEXT to DT_STR. Keep in mind that truncation may occur if the conversion to DT_STR doesn't reserve enough width on the column to fit the whole stream contents (i.e. if the stream has at most 500 characters you'll need to set up the Length of the column to 500 in the Data Conversion transformation)
Another option could be using a Derived Column to perform both casts in a single transformation (haven't tried this solution).

October 24, 2007

Custom logging with Integration Services

Integration Services 2005 allows you to insert custom log entries from a Script Task by sending events of a specific type to your log provider. You can use something like this from within a script:
Dts.Events.FireInformation(0, "CustomInfoHere", "This is a custom log entry thrown by a script task")
You can also use this technique to raise errors, warnings, progress information, etc...

If you need help on how to set up logging for a package see this: http://msdn2.microsoft.com/en-us/library/ms141727.aspx

October 22, 2007

Freeware encryption and compression

FreeSecurity is an easy to use freeware application that allows you to use AES encryption to secure your files and safeguard your privacy, also allowing file compression. It's developed in Java and requires only that your operating system has Java 1.4 or above installed, therefore being able to run in any operating system which provides the mentioned Java support.
I developed it in 2005 and released it as a freeware application, you can get it here: http://www.canudo.net/derelict/freesecurity/

Convert MPC to MP3 and MPC to WAV

FreeMPC is a freeware, graphical and easy to use application for listening and converting MPC audio files. It can convert MPC to WAV and to MP3 (all bitrates) and you can also use it to play MPC files without having to convert them.
I developed it in 2006 and released it as a freeware application, you can get it here: http://www.canudo.net/derelict/freempc

Execute SQL Task (SSIS) with parameters

On Integration Services 2005, when using a query with parameters in the Execute SQL Task, mind that in the Parameter Name field the counting starts at 0 (if, at least, the connection type is OLE DB). Therefore, if you are using multiple parameters the first Parameter Name must be 0, the second must be 1, and so on.
Otherwise, you'll get this error:
[Execute SQL Task] Error: Executing the query "DELETE FROM myTable WHERE key = ?" failed with the following error: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Check here for more information: http://msdn2.microsoft.com/en-us/library/ms187685.aspx