martes, 12 de marzo de 2013

Download IbexPrima

Aplicación muy sencilla desarrollada para poder acceder de una forma rápida...

IbexPrima V 1.3.2

Very simple application developed to access quickly and easily in one application to real-time data of the risk premium in Spain and the value of the benchmark for the country, the Ibex35.
The latest version includes the consultation of various publicly traded securities.

Change History
===================

1.3.2b

· We are still in beta phase
· Added the application icon
· Tab in tests to check the values ​​of the stocks of Bombay Stock Exchange
· Restored the news tab.
· Removing Bugs from the previous version has been very problematic.

miércoles, 23 de enero de 2013

Handling Excel files with C# .net

Looking at Internet for a easy way to read and write Excel files in an automated way i have foud a very helpfull class.

It is a very easy way to get done all usual task with an Excel file. To get work you must to add the COM reference to Excel  “Microsoft Excel 11.0 Object Library”.

I hope you find it as helpful as it has been for me.

Note: If you are using VS2008 (or may be other versions too) you must to replace the method "getSheetsNames" with:

public string[] GetSheetsNames()
        {
            List<string> names = new List<string>();
            Worksheet sheet = null;

            for (int i = 1; i <= this.book.Worksheets.Count; i++)
            {
                sheet = (Worksheet)this.book.Worksheets[i];
                names.Add(sheet.Name);
            }

            return names.ToArray();
        }

 Or you get some errors with the List Object.



 
Enjoy it!


Source [+]

// A library to handle excel files in a simple way.
// Copyright (C) 2009  Gorka Suárez García
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see .
using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.Office.Interop.Excel;

namespace Excel {
    /// <summary>
    /// This class is used to handle an excel file to write and read from it.
    /// Author: Gorka Suárez García
    /// </summary>
    public class ExcelHandler {
        /// <summary>
        /// The excel application instance.
        /// </summary>
        private ApplicationClass app;

        /// <summary>
        /// The excel book.
        /// </summary>
        private Workbook book;

        /// <summary>
        /// The path of the excel file.
        /// </summary>
        private string path;

        /// <summary>
        /// Constructs a new ExcelHandler object.
        /// </summary>
        public ExcelHandler() {
            this.app = null;
            this.book = null;
            this.path = null;
        }

        /// <summary>
        /// Destroys the ExcelHandler object.
        /// </summary>
        ~ExcelHandler() {
            if (this.app != null) {
                this.app.Quit();
            }
        }

        /// <summary>
        /// Opens an excel file.
        /// </summary>
        /// <param name="path">The file to open.</param>
        public void Open(string path) {
            this.path = path;

            this.app = new ApplicationClass();
            this.app.Visible = false;
            this.app.ScreenUpdating = false;
            this.app.DisplayAlerts = false;

            this.book = this.app.Workbooks.Open(this.path, Missing.Value, Missing.Value, Missing.Value,
                                                Missing.Value, Missing.Value, Missing.Value, Missing.Value,
                                                Missing.Value, Missing.Value, Missing.Value, Missing.Value,
                                                Missing.Value, Missing.Value, Missing.Value);

            if (this.book == null)
                throw new Exception("Can't open the excel book file.");
        }

        /// <summary>
        /// Writes a value in a cell.
        /// </summary>
        /// <param name="sheet">The sheet to write.</param>
        /// <param name="cell">The cell to write.</param>
        /// <param name="value">The value to write.</param>
        public void Write(string sheet, string cell, string value) {
            Worksheet wsheet = this.getSheet(sheet);
            Range range = wsheet.get_Range(cell, cell);
            range.Value2 = value;
        }

        /// <summary>
        /// Reads a value from a cell.
        /// </summary>
        /// <param name="sheet">The sheet to read.</param>
        /// <param name="cell">The cell to read.</param>
        /// <returns>The value from the cell.</returns>
        public string Read(string sheet, string cell) {
            Worksheet wsheet = this.getSheet(sheet);
            Range range = wsheet.get_Range(cell, cell);

            if (range.Value2 != null)
                return range.Value2.ToString();
            else
                return "";
        }

        /// <summary>
        /// Clears the content of the excel book.
        /// </summary>
        public void Clear() {
            Worksheet sheet = null;
            for (int i = 1; i <= this.book.Worksheets.Count; i++) {
                sheet = (Worksheet)this.book.Worksheets[i];
                sheet.Cells.Clear();
            }
        }

        /// <summary>
        /// Closes the excel file.
        /// </summary>
        public void Close() {
            this.book.SaveAs(this.path, XlFileFormat.xlWorkbookNormal, Missing.Value, Missing.Value,
                             false, false, XlSaveAsAccessMode.xlShared, false, false, Missing.Value,
                             Missing.Value, Missing.Value);
            this.book.Close(true, Missing.Value, Missing.Value);
            this.app.Quit();

            this.app = null;
            this.book = null;
            this.path = null;
        }

        /// <summary>
        /// Gets all the names of the sheets inside the excel book.
        /// </summary>
        /// <returns>A list of the sheets names.</returns>
        public string[] GetSheetsNames() {
            List names = new List();
            Worksheet sheet = null;

            for (int i = 1; i <= this.book.Worksheets.Count; i++) {
                sheet = (Worksheet)this.book.Worksheets[i];
                names.Add(sheet.Name);
            }

            return names.ToArray();
        }

        /// <summary>
        /// Gets a sheet we're looking for.
        /// </summary>
        /// <param name="name">The name of the sheet.</param>
        /// <returns>The sheet we're looking for.</returns>
        protected Worksheet getSheet(string name) {
            int index = this.getSheetIndex(name);
            if (index == 0)
                throw new Exception("Invalid sheet name.");

            Worksheet sheet = (Worksheet)this.book.Worksheets[index];
            return sheet;
        }

        /// <summary>
        /// Gets the index of a sheet we're looking for.
        /// </summary>
        /// <param name="name">The name of the sheet.</param>
        /// <returns>The index of the sheet we're looking for.</returns>
        protected int getSheetIndex(string name) {
            Worksheet sheet = null;
            for (int i = 1; i <= this.book.Worksheets.Count; i++) {
                sheet = (Worksheet)this.book.Worksheets[i];
                if (sheet.Name == name) return i;
            }
            return 0;
        }
    }
}

miércoles, 24 de octubre de 2012

How to download Android SDK, if you are blocked by a proxy, for example.

I've been looking all over the Internet intensively how to do this and honestly I have been almost impossible to find somewhere to explain how. Source [+].

The trick to getting this task lies in the XML file that Google uses to distribute their Platforms.

https://dl-ssl.google.com/android/repository/repository-5.xml

If you look inside the XML, to download the latest version will find this information:

<sdk:archive arch="any" os="any">

<sdk:size>44758833</sdk:size>

<sdk:checksum type="sha1">f2aa75133c29916b0b0b984974c2d5e46cb09e9c</sdk:checksum>
<sdk:url>android-15_r01.zip</sdk:url>
</sdk:archive>


So the URL to download the package we need is:

So the URL will be is 


http://dl-ssl.google.com/android/repository/android-15_r01.zip

I hope that helps as much as me this information.

lunes, 20 de agosto de 2012

Error on blank images with EXT JS (Sencha) and Internet Explorer (IE 6-8)

Is very normal to get errors in your Web Page designed with ExtJs if you use Internet Explorer.
For example, there is a typical error when you use HTTPS.
When you are using a secure HTTP server IE will show you an error error image over each image link or action image. This is a blank image and i am not sure the utility but you will see your image and over it another one like an error.

To solve this issue you must to add to your code this line 

Ext.BLANK_IMAGE_URL = '[path-to-ext]/resources/themes/images/default/tree/s.gif'; 

You must to add this after  OnReady. The result is something like that:

Ext.onReady(function() {
        Ext.BLANK_IMAGE_URL = '[path-to-ext]/resources/themes/images/default/tree/s.gif'; 
        [Your Code]
}

Good Luck

miércoles, 1 de agosto de 2012

Using Ext JS 3 to create a windows Iframe

This example is very easy.
All you need are few lines to get a very nice floating frame in your web.

Have you download Ext Js?
Let´s do it: Click here to get it

After that let´s write code.
Firstly you have to add references to de JS files. You need only 2 references because this is very basic example

<head>
...
<script type="text/javascript" language="javascript" src="../../includes/ext-3.3.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" language="javascript" src="../../includes/ext-3.3.1/ext-all.js"></script>
...
</head>

Now you must to add a reference to CSS file

 <head>
...
<link rel="Stylesheet" href="../../includes/ext-3.3.1/resources/css/ext-all.css"/>
...
</head> 

Note: you can add ext-all.css or one of other which 
represents diferents themes (blue, gray, black...)


Now in your code add this lines:

<body>
...
<div id="hello-win" class="x-hidden"></div>
...
</body>

And finishing the script code.

<script language="javascript" type="text/javascript">
function ventanaCargaFicheros(p) {
        var win;
        if (!win) {
            win = new Ext.Window({
                title: 'Subida de ficheros',
                applyTo: 'hello-win',
                layout: 'fit',
                width: 500,
                height: 350,
                closeAction: 'close',
                buttons: [{ text: 'Cerrar', handler: function() { win.close(); } }],
                keys: [{ key: 27, /* hide on Esc*/fn: function() { win.close(); } }],
                html: '<iframe src=SubidaFichero/index.aspx?P=' + p + ' style="width:485px;height:283px;"></iframe>'
                });
            }
            win.show(this);
    }
</script>


Done all before you have an windows iframe, now you must to decide how to lunch it, for example whith a button, with a link there are many diferents ways to do that.

<a href="#" onclick="ventanaCargaFicheros(params);">window</a>







viernes, 22 de junio de 2012

Use C# and VB.net class in the same project

One of the best benefits to my VS.net like is that you can use different programming languages simultaneously. In this case we are talking about VB.net and C #. Net.

It is straightforward to add a form in C # or VB, is as simple as clicking on the project with the right mouse button and select add that we add a form / WebPage language you want.
If we try to do that with a class, we see that not everything works so well.
In this case it will be necessary to do something more.

You shall do the same as before, add, add kind of language we want, put it within the app code in a folder that we create called CScode (for file C #) or VBCode (for VB) depending on language and go to the file "web.config".

Once opened we have to add this fragment:



 </compilation> 
...
    <codeSubDirectories>
        <add directoryName="CSCode"/>
        <add directoryName="CSCode"/>
    </codeSubDirectories>
...
</compilation>


Once done, everything works perfectly and you can make calls between classes of different languages.

I hope you have been helpful.

jueves, 24 de mayo de 2012

Develop Chrome Extensions IV

Some days ago i wrote how test your extensions.
Well I was planned to explain how to autoupdating your extension, so i have been trying to do it and I can not get it.
The problem has been very simple, has been imposible to get a hosting where locate a crx file to allow google chrome download the updated file.

Well, there is a solution for that. If you want your users get automatically your updates, you can upload the extension to the Chrome Market.
If you decide that you must to consider two important things


  1. first time to upload something you must pay 3,85€ or 5$
  2. you must to start to publish your extension as test.
The second one is very important.
Let´s see: if you upload an bad product and you recibe a poor puntation, in the future you will be curtailed to be a good creator.
I recomend you to publish your extension when you will be  sure that it is a good product.

martes, 8 de mayo de 2012

Developping chrome extensions III

You can feel reading this text that i am explain nothing about code. Ok it is right. I dont mind to explain developping techniques, i want to tell you steeps to get an extensin from the begin to the market.

Lets see... now you have a extension which you can add a button to a web, por example. Now its time to share it and start ti test for bugs. If you try to do it alone its imposible.
The best way is to tell it to your friends in G+ for example. Firstly you must to upload your crx file to Gdrive and share with your friends the link to this file.

How can i get a crx file?. the answer its very Easy



You must access to the extension properties page and you must check  the developper mode. Now appears new buttons. One of them is "package an extension". If you click here  you will be asked about the folder extension, and about a private key. If it is the first time, you must to leave blank the private key in other case you must to link to file generated first time, if you want to Chrome detects this as extension update.

After that, you will get a crx file.  Now you can host this crx file where you want and share the link with your friends.

In the next chapter will learn to get automatically updates.



Developping chrome extensions II

Now you are having a folder with all your files.
You are ready to test your extension.



As you can see in the upper picture, when you check developper mode appears different buttons. If you click in "load uncompressed extension" you will be asked about the location of the folder contains all files.

Once do it, will appears as a new extension in your panel and you will be able to test and debug it.

As a very light gide lines about your first extension... for example have you think about change the styles of a page getting something that you prefer instead the original? For example have you think about to get disapear the chat in Gmail?

Please check web reference about Jquery