lunes, 31 de octubre de 2011

# Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified

 You can try copying the ReportViewer assemblies manually. Normally if the ReportViewer.exe successfully completes the setup process, the following files should be placed within the following folder :
C:\Program Files\Microsoft Visual Studio 8\ReportViewer or
C:\Program Files\Microsoft Visual Studio 9.0\ReportViewer




  • Microsoft.ReportViewer.Common.dll
  • Microsoft.ReportViewer.WebForms.dll
  • Microsoft.ReportViewer.WebForms.xml
  • Microsoft.ReportViewer.WinForms.dll
  • Microsoft.ReportViewer.WinForms.xml





  • You can manually copy the following dll files into the application folder /bin directory. After copying the files into the application bin folder the web application will start responding successfully. And ASP.NET ReportViewer control will work on your web application.

    Bytes!! :)

    miércoles, 12 de octubre de 2011

    Solomon Crystal reports printer error 513: Printer undefined


    The 513 error message usually occurs when Dynamics SL cannot find the printer. 
    If the printer appears to be fine, then try logging out of Dynamics  log back into Dynamics SL
    and test printing.

    You might want to check your Windows Default printer to make certain that there are no issues. You might also delete and recreate your printer in case the printer corrupted.
    
    
    Or if yu're using Citrix check if the name of printer is too long and try to put a short name, and it work's.
    
    
    bytes,

    domingo, 9 de octubre de 2011

    Troubleshooting: Common failure reasons while deploying applications to the BlackBerry PlayBook simulator


    As described in the BlackBerry Tablet OS Application development guides (Getting Started – Adobe AIRGetting Started - BlackBerry WebWorks), deploying an *.bar BlackBerry® PlayBook™ Tablet application to the BlackBerry® Tablet Simulator requires the following 2 steps:


    1. Enable development mode on the target Simulator
    2. Use the blackberry-deploy service, found within the BlackBerry® Tablet OS SDK, to deploy your *.bar application to the simulator:
    or If You're trying with Flash Builder, and get an error like this:

    actual_id::MjA5OGRhZTZkMDY2MmUxICAgICA
    actual_version::1.0.0.0
    result::failure
    Error: Connection to 192.168.198.137 refused.
    Cannot connect:Connection to https://192.168.181.129 refused. Please check Ip address settings for the target. You May have to reboot the target.

    Go to the command promt and type ping to your playbook simulator

    Enable your VMware NetWork Adapter. 
    Go again to the command promt and type ping to your playbook simulator

    That's all . 

    bytes. !!

    miércoles, 14 de septiembre de 2011

    How to get GPS data from Playbook and save in a File and read it.

    import flash.sensors.Geolocation;
    import flashx.textLayout.factory.StringTextLineFactory;
    import mx.events.FlexEvent;
    import qnx.media.QNXStageWebView;
    private var geoLocation:Geolocation;
    private var ObjfiletoSave:File;
    private var Objstream:FileStream = new FileStream();
    private var Objstream2:FileStream = new FileStream();
    private var Count:Number =0;
    private var Coord: String="";

    protected function application1_applicationCompleteHandler(event:FlexEvent):void {
    lectura.text="file applicationdirectory: "+File.applicationDirectory.nativePath +"\n"
    +"file applicationStorageDirectory: "+File.applicationStorageDirectory.nativePath +"\n"
    +"file desktopDirectory: "+File.desktopDirectory.nativePath +"\n"
    +"file documentsDirectory: "+File.documentsDirectory.nativePath +"\n"
    +"file userDirectory: "+File.userDirectory.nativePath +"\n"
    // TODO Auto-generated method stub
    if(Geolocation.isSupported==true){
    geoLocation = new Geolocation();
    geoLocation.setRequestedUpdateInterval(1000);
    geoLocation.addEventListener(GeolocationEvent.UPDATE,handleLocateRequest);
    }else{
    status.text="No soporta Geolocalización!"
    }
    }
    private function handleLocateRequest(event:GeolocationEvent):void{
    var mph:Number = event.speed * 2.23693629;
    var kph:Number = event.speed * 3.6;
    info.text="Actualización: " + new Date().toTimeString() + "\n\n"
    + "latitud: " + event.latitude.toString() + "\n"
    + "longitud: " + event.longitude.toString() + "\n"
    + "altitud: " + event.altitude.toString() + "\n"
    + "speed: " + event.speed.toString() + "\n"
    + "speed: " + mph.toString() + "\n"
    + "speed: " + kph.toString() + "\n"
    + "cabecera: " + event.heading.toString()+ "\n"
    + "horizontal accuracy: " + event.horizontalAccuracy.toString() + "\n"
    + "vertical accuracy: " + event.verticalAccuracy.toString() ;
    SaveinTextFile(event.latitude.toString(),event.longitude.toString());
    }

    private function SaveinTextFile(Latitud:String,Longitud:String):void{
    var Fecha:String = new Date().toTimeString();
    ObjfiletoSave=File.documentsDirectory.resolvePath("samples/GPS.txt");
    status.text="Salva Lectura de " + File.documentsDirectory.nativePath + "/samples/GPS.txt";
    Objstream.open(ObjfiletoSave, FileMode.APPEND);
    Objstream.writeUTFBytes("var Count"+ Count.toString() +"=new GLatLng("+ Latitud + "," + Longitud + "); \n" )
    Coord= Coord + "Count" + Count.toString()+",";
    Count ++;
    }

    private function ReadTextFile():void{
    ObjfiletoSave=File.documentsDirectory.resolvePath("samples/GPS.txt");
    status.text="Lectura de " + File.documentsDirectory.name + "/samples/GPS.txt";
    var Objstream2:FileStream = new FileStream();
    Objstream.open(ObjfiletoSave, FileMode.READ);
    lectura.text = Objstream.readUTFBytes(Objstream.bytesAvailable);
    Objstream.close();
    //status.text="Lectura..." }
    protected function detener_clickHandler(event:MouseEvent):void
    {
    // TODO Auto-generated method stub
    geoLocation.removeEventListener(GeolocationEvent.UPDATE,handleLocateRequest);
    status.text="Lectura detenida";
    Objstream.writeUTFBytes(Coord );
    Objstream.close();
    }

    protected function mostrar_clickHandler(event:MouseEvent):void {
    // TODO Auto-generated method stub
    ReadTextFile();
    }

    protected function continua_clickHandler(event:MouseEvent):void {
    // TODO Auto-generated method stub
    geoLocation = new Geolocation();
    geoLocation.setRequestedUpdateInterval(1000);
    geoLocation.addEventListener(GeolocationEvent.UPDATE,handleLocateRequest);
    }

    martes, 30 de agosto de 2011

    A generic error occurred in GDI+.

    If you have a troubble just like this,
    [ExternalException (0x80004005): A generic error occurred in GDI+.] System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) System.Drawing.Image.Save(String filename, ImageFormat format) Infragistics.WebUI.UltraWebChart.UltraChart.Render(HtmlTextWriter output) [ImageStoreException: Unable to write chart image files at given file path. Please check and correct UltraChart's DeploymentScenario property. Or please provide write permissions to directory path where chart must save images. Please refer Deployment Scenario section in help files.

    Follow the next steps.
    1. In Windows Explorer (shortcut: Windows Key-E), browse to the web application folder or to the virtual directory that contains content (for example, D:\MyWeb\MyApplication\ChartImages).
    2. Right-click the folder, and then click Properties.
    3. On the Security tab, click Add. If you are running Windows XP and do not see a Security tab, you may have simple sharing enabled; you must de-activate it to assign specific security privileges, see "How to disable simplified sharing in Windows XP" for more information.
    4. For Windows 2003 Server, type NETWORK SERVICE (for example, on a computer that is named 'Webdev', type Webdev\NETWORK SERVICE), and then click OK. For most other versions of Windows, type LocalMachineName\ASPNET (for example, on a computer that is named 'Webdev', type Webdev\ASPNET), and then click OK.
    5. Allow the following permissions for the ASP.NET worker process account to this folder, files and all subfolders:
    • Full Control
    1. Click OK to close the Properties dialog box and to save the changes.


    viernes, 26 de agosto de 2011

    SQL injection samples.

    This is an example when a SQL injection occurs.

    I pick this article off from

    http://blogs.msdn.com/b/raulga/archive/2007/01/04/dynamic-sql-sql-injection.aspx
    it´s not mine but is very interesting.

    -- An innocent looking SP

    CREATE PROC [sp_demo_injection01]( @name sysname )

    AS

    -- ...with an obvious SQL injection-vulnerable sample

    EXEC( 'SELECT * FROM sys.database_principals WHERE name = ''' + @name +'''' )

    go

    -- This is how it was intended to be used

    declare @var sysname

    SET @var = 'Some Name'

    EXEC [sp_demo_injection01] @var

    go

    -- As you can see, I can easily abuse this module in the following manner

    declare @var sysname

    SET @var = 'Some Name''; GRANT CONTROL TO [Malicious User]; PRINT ''Game over! This system is no longer yours!''-- Malicious User now can control the database!!!'

    EXEC [sp_demo_injection01] @var

    go

    When the attacker runs this query the system will concatenate the input to the command we defined in the SP:

    EXEC ( 'SELECT * FROM sys.database_principals WHERE name = ''' + 'Some Name''; GRANT CONTROL TO [Malicious User]; PRINT ''Game over! This system is no longer yours!''-- Malicious User now can control the database!!!' +'''' )

    The attacker is able to close the quote in the user name (notice the trailing quote in Some Name’) and converted the rest of what should have been a user name into a different SQL statement, causing the following command to be executed:

    SELECT * FROM sys.database_principals WHERE name = 'Some Name'; GRANTCONTROL TO [Malicious User]; PRINT 'Game over! This system is no longer yours!'-- Malicious User now can control the database!!!'

    As you can see the attacker was able to add extra SQL statements that were not intended by the author of the stored procedure, in this case granting CONTROL on the database to herself and printing a note.

    Parameterization

    In most of these scenarios there is an alternative to the example used above using parameterization. Using parameterization gives you the advantage that you can clearly specify the data type and avoid pitfalls as well as the final T-SQL statement generated will reference the parameters as variables and not directly use the user defined input to generate the statement.

    If you are using T-SQL directly to generate dynamic SQL, you can take advantage of sp_ExecuteSql to execute parameterized queries, for example:

    -- An improved version of [sp_demo_injection01]

    CREATE PROC [sp_demo_injection02]( @name sysname )

    AS

    declare @cmd nvarchar(max)

    declare @parameters nvarchar(max)

    set @cmd = N'SELECT * FROM sys.database_principals WHERE name = @name'

    set @parameters = '@name sysname'

    EXEC sp_executesql @cmd, @parameters, @name = @name

    go

    -- This is how it was intended to be used

    declare @var sysname

    SET @var = 'Some Name'

    EXEC [sp_demo_injection02] @var

    go

    -- The previous attack no longer has any effect!

    declare @var sysname

    SET @var = 'Some Name''; GRANT CONTROL TO [Malicious User]; PRINT ''Game over! This system is no longer yours!''-- Malicious User now can control the database!!!'

    EXEC [sp_demo_injection02] @var

    go

    CREATE PROC [sp_demo_injection03]( @Value nvarchar(100) )

    AS

    declare @cmd nvarchar(max)

    declare @parameters nvarchar(max)

    set @cmd = N'SELECT * FROM sys.database_principals WHERE principal_id = @Value'

    set @parameters = '@Value int'

    EXEC sp_executesql @cmd, @parameters, @value = @value

    go

    -- Should work

    declare @var sysname

    SET @var = '1'

    EXEC [sp_demo_injection03] @var

    go

    -- Expect error 8114

    -- Error converting data type nvarchar to int.

    declare @var sysname

    SET @var = '1; select * from sys.objects'

    EXEC [sp_demo_injection03] @var

    go

    But be careful, using sp_executesql is not a guarantee that the SQL statement to be executed is not susceptible to SQL injection; the parameters should be used properly in order to really take advantage of this feature. The following example is a demonstration of a common mistake I have seen a few times: constructing the @cmd parameter using user-defined data instead of using it as a parameter.

    -------------------------------------------------------------

    -- Incorrect usage of sp_executeSql

    CREATE PROC [sp_demo_injection04]( @name sysname )

    AS

    declare @cmd nvarchar(max)

    declare @parameters nvarchar(max)

    -- Looks famliar? yep, same injection as [sp_demo_injection01]

    set @cmd = N'SELECT * FROM sys.database_principals WHERE name = ''' +@name + N''''

    -- No parameters!!! This is typically a sign of misusing sp_execsql.

    set @parameters = null

    EXEC sp_executesql @cmd, @parameters

    go

    -- and now run the same attack we tried before...

    declare @var sysname

    SET @var = 'Some Name''; GRANT CONTROL TO [Malicious User]; PRINT ''Game over! This system is no longer yours!''-- Malicious User now can control the database!!!'

    EXEC [sp_demo_injection04] @var

    -- ... and it is game over!

    go

    Be aware that sp_ExecuteSql doesn’t automatically protect against every SQL injection. It helps you to create the parameterized query, but it has to be used properly in order to work. I have seen a common misuse of this stored procedure: using the user-defined input (untrusted data) to generate the @statement parameter.

    ---------------------------------------------------------------------

    -- Incorrect usage of sp_executeSql

    CREATE PROC [sp_demo_injection04]( @name sysname )

    AS

    declare @cmd nvarchar(max)

    declare @parameters nvarchar(max)

    -- Looks famliar? yep, same injection as [sp_demo_injection01]

    set @cmd = N'SELECT * FROM sys.database_principals WHERE name = ''' +@name + N''''

    -- No parameters!!! This is typically a sign of misusing sp_execsql.

    set @parameters = null

    EXEC sp_executesql @cmd, @parameters

    go

    -- and now run the same attack we tried before...

    declare @var sysname

    SET @var = 'Some Name''; GRANT CONTROL TO [Malicious User]; PRINT ''Game over! This system is no longer yours!''-- Malicious User now can control the database!!!'

    EXEC [sp_demo_injection04] @var

    -- ... and it is game over!

    go

    If you are using the .Net framework, you can use the SqlParameter class to create parameterized queries in a similar way, and the same warning still applies: Do not use user-defined input directly when constructing the parameterized statement. For further reference on this class, please refer tohttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqlparameterclasstopic.asp