Fix XSane' s problems with Debian.

Sunday, 25 October 2009 11:12 by myro

XSane is a graphical scanning frontend that makes easy to use you scanner. But when i lauched XSane for the first time under my Debian Lenny enviroment, XSane reported:

Failed to open device `v4l:/dev/video0': Invalid argument

To prevent this error, you should comment out the “/dev/video0″ line in /etc/sane.d/v4l.conf. Now you should be able attach your USB scanner and launch correctly the program.
But what happens if XSane says that no scanner is found? Follow these steps that helped me to solve the problem:ù

  1. Ensure the that libsane-extras package is insalled in your machine
  2. Try to run XSane as root. If it work, and finds your scanner, you should fix the permeission sets on your scanner device.
  3. Find out which bus your usb scanner resides on, this is easily done with the lsusb command:

    debian:/home/myo# lsusb
    Bus 008 Device 004: ID 054c:0377 Sony Corp.
    Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 007 Device 002: ID 05ca:183d Ricoh Co., Ltd
    Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 007: ID 04b8:010b Seiko Epson Corp. Perfection 1240
    Bus 003 Device 006: ID 046d:c01d Logitech, Inc. MX510 Optical Mouse
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

    You can see the scanner resides on Bus 003 and is the 007 device in this case.
    Change the permissions using:
    debian:/home/myo# chmod a+w /dev/bus/usb/003/007 .  Replace the bus and the devices numbers with yours.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:  
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed

SharePoint 2007 - Extract SharePoint Users informations to an Excel file format

Monday, 12 October 2009 09:57 by myro

SharePoint 2007 is missing a feature that lets you export all Users that belong to a particular group into a Excel compatibile file format. What happens if someone asks you: "May I have a list of all users that belongs to a particular group?". Would be nice to have a simple Form Application that saves the list provinding for each user informations like the domain name, the full name and the email?

With just few lines of code you can accomplish that or if you prefer, you can download my little project: SharePoint Group Users Info which does exactly this job:

Once you have insered your SharePoint's site url, click the Get Groups button. Select the group you wish to export and press Get Users Info. A Save File Dialog will pop up, asking you where would you save your CVS file. Open it with Excel and you are done!

Download Visual Studio 2008 Project: SharePointGroupUsersInfo.rar (70.63 kb)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   SharePoint 2007
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed

Working with DashCommerce 3.x - recreate the SQL Full Text Catalog

Sunday, 11 October 2009 20:29 by myro

The SQL Full Text Catalog, provides a fast search of you products into you DashCommerce's  database. But what happens if you mess up the catalog? You will receive errors like

A critical error has occurred: Cannot drop full-text catalog 'dashCommerce_Catalog' because it contains a full-text index

and you will not able to drop the catalog

Cannot drop full-text catalog 'dashCommerce_Catalog' because it contains a full-text index.

Unless you follow the steps illustrated below.

Connect to you DashCommerce's database,  and launch:

SELECT name, ftcatid FROM sysobjects WHERE ftcatid > 0
GO

This will return the table where the Full Text Catalg is use:



Now, we can drop it:


EXEC sp_fulltext_table 'dashCommerce_Store_Product', 'drop'
GO

DROP FULLTEXT CATALOG dashCommerce_Catalog
GO


And recreate it, by using the fulltextcatalog.sql script, located under /Install/Scripts


EXEC sp_fulltext_database 'enable'
GO
CREATE FULLTEXT CATALOG dashCommerce_Catalog
GO

CREATE FULLTEXT INDEX ON [dbo].[dashCommerce_Store_Product] KEY INDEX [PK_dashCommerce_Products] ON [dashCommerce_Catalog] WITH CHANGE_TRACKING AUTO
GO

ALTER FULLTEXT INDEX ON [dbo].[dashCommerce_Store_Product] ADD ([Name] LANGUAGE 1033)
GO
ALTER FULLTEXT INDEX ON [dbo].[dashCommerce_Store_Product] ADD (ShortDescription LANGUAGE 1033)
GO
ALTER FULLTEXT INDEX ON [dbo].[dashCommerce_Store_Product] ADD (BaseSku LANGUAGE 1033)
GO

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   Sql
Actions:   Bookmark and Share | Permalink | Comments (1) | Comment RSSRSS comment feed

Add WaterMark to TextBox in Asp.Net: The simple way!

Sunday, 11 October 2009 17:17 by myro

There are different solutions on the web that describes how to implement a watermark over an asp.net TextBox. The solution I still prefer is just using JavaScript with  of asp.net's parser capabilities:

Into your ASPX markup page, try the solution posted below. solution:

<script type = "text/javascript">


// This Javascript is written by Peter Velichkov (www.creonfx.com)
// and is distributed under the following license : http://creativecommons.org/licenses/by-sa/3.0/
// Use and modify all you want just keep this comment. Thanks
// Defining array that holds the IDs or Names of the inputs and the default text to display
// If you are using Names remeber that I am taking only the first one.
// The format is : 'ID1','VALUE1','ID2','VALUE2'....
// var inputs = new Array('firstname','firstvalue','secondid','secondvalue','thirdid','thirdvalue')
// Defining "indexOf" function for Internet Explorer
// It returns the index of the first occurance of an item in the array


// As you can see i'm just inject the Asp.Net TextBoxes client side's IDs into the Javascript Code


var inputs = new Array('<%= txtSearchTerms.ClientID  %>','Search...','<%= txrLogin.ClientID  %>','Login...');

if (!Array.indexOf) {
    Array.prototype.indexOf = function(obj, start) {
        for (var i = (start || 0); i < this.length; i++) {
            if (this[i] == obj) {
                return i;
            }
        }
    }
}
 
// Defining addEvent function since Internet Explorer
 does not support the official way of adding events
 
function addEvent(obj, type, fn) {
    if (obj.addEventListener)
    obj.addEventListener(type, fn, false);
    else if (obj.attachEvent)
    {
        obj["e" + type + fn] = fn;
        obj[type + fn] = function() {
            obj["e" + type + fn](window.event);
        }
        obj.attachEvent("on" + type, obj[type + fn]);
    }
}
 
function inputWatermark() {
    if (inputs.length < 2 || inputs.length % 2 != 0) {
        alert('Wrong usage - please read the source comments!');
    }
    for (i = 0; i < inputs.length; i++) {
        if (i % 2 == 0 && (document.getElementById(inputs[i]) || document.getElementsByName(inputs[i])[0])) {
            var cur = (document.getElementById(inputs[i])) ? (document.getElementById(inputs[i])) : (document.getElementsByName(inputs[i])[0]);
            cur.value = inputs[i + 1];
            addEvent(cur, "focus", onFocusHandler);
            addEvent(cur, "blur", onBlurHandler);
        }
    }
}
 
function onFocusHandler() {
    var inpname = this.id ? this.id: this.name;
    if (this.value == '' || this.value == inputs[inputs.indexOf(inpname) + 1]) {
        this.value = '';
    }
}
 
function onBlurHandler() {
    var inpname = this.id ? this.id: this.name;
    if (this.value == '') {
        this.value = inputs[inputs.indexOf(inpname) + 1];
    }
}
 
addEvent(window, "load", inputWatermark);
</script>


<asp:TextBox ID="txtSearchTerms" runat="server" />
<asp:TextBox ID="txtLogin" runat="server" />

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   .NET | Web
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed

Convert DataReader to DataSet in c#

Monday, 5 October 2009 15:35 by myro

I've just founded an usefull code snippet that returns a DataSet from a DataReader. As you can see, I'm passing a DbDataReader, because I prefer to work with the DbProviderFactory instead of using directly the System.Data.Sql namespace. A replace of the DbDataReader into SqlDataReader, will work exactly the same.

public static DataSet convertDataReaderToDataSet(DbDataReader reader)
{
    DataSet dataSet = new DataSet();
    do
    {
        // Create new data table
        DataTable schemaTable = reader.GetSchemaTable();
        DataTable dataTable = new DataTable();

        if (schemaTable != null)
        {
            // A query returning records was executed
            for (int i = 0; i < schemaTable.Rows.Count; i++)
            {
                DataRow dataRow = schemaTable.Rows[i];
                // Create a column name that is unique in the data table
                string columnName = (string)dataRow["ColumnName"];
                // Add the column definition to the data table
                DataColumn column = new DataColumn(columnName, (Type)dataRow["DataType"]);
                dataTable.Columns.Add(column);
            }
            dataSet.Tables.Add(dataTable);
            // Fill the data table we just created
            while (reader.Read())
            {
                DataRow dataRow = dataTable.NewRow();

                for (int i = 0; i < reader.FieldCount; i++)
                    dataRow[i] = reader.GetValue(i);

                dataTable.Rows.Add(dataRow);
            }
        }
        else
        {
            // No records were returned
            DataColumn column = new DataColumn("RowsAffected");
            dataTable.Columns.Add(column);
            dataSet.Tables.Add(dataTable);
            DataRow dataRow = dataTable.NewRow();
            dataRow[0] = reader.RecordsAffected;
            dataTable.Rows.Add(dataRow);
        }
    }
    while (reader.NextResult());
    return dataSet;
}

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   .NET
Actions:   Bookmark and Share | Permalink | Comments (1) | Comment RSSRSS comment feed