CSS Tip 2 : Quotes are optional in URL

The format of a URI value is ’url(’ followed by optional white space followed by an optional single quote (’) or double quote (“Smilie: ;) character followed by the URI itself, followed by an optional single quote (’) or double quote (“Smilie: ;) character followed
by optional white space followed by ’)’. The two quote characters must be the same.
Example(s):
An example without quotes:

li { list-style: url(http://www.example.com/redball.png) disc }
body { background: url("http://www.example.com/pinkish.png") }

Both are valid quotes are optional in url.

Posted in CSS, Tips

CSS Rules 1 : ex ,em,px Know the difference

Css Rules No 1
There are two types of length units: relative and absolute. Relative length units
specify a length relative to another length property. Style sheets that use relative
units will more easily scale from one medium to another (e.g., from a computer
display to a laser printer).
Relative units are:
em: the ’font-size’ of the relevant font
ex: the ’x-height’ of the relevant font
px: pixels, relative to the viewing device
Example(s):

h1 { margin: 0.5em } /* em */
h1 { margin: 1ex } /* ex */
p { font-size: 12px } /* px */

The ’em’ unit is equal to the computed value of the ’font-size’ property of the
element on which it is used. The exception is when ’em’ occurs in the value of the
’font-size’ property itself, in which case it refers to the font size of the parent element.
It may be used for vertical or horizontal measurement.

Posted in CSS, Rules Tagged , , , ,

CSS Tips 1 : Support for 2 values of same css property

If a User Agent(UA) does not support a particular value, it will ignore that value when parsing
style sheets, as if that value was an illegal value . For example:
Example(s):

h3 {
display: inline;
display: run-in;
}

A UA that supports the ’run-in’ value for the ’display’ property will accept the first
display declaration and then “write over” that value with the second display
declaration. A UA that does not support the ’run-in’ value will process the first display
declaration and ignore the second display declaration

So always remember when you’re writing some CSS always use one generic and one specific value for the property. Only in the cases when you’ve to create browser specific code.
Mostly avoid this act. Smilie: :)

Posted in CSS, Tips Tagged ,

gOS error : Virtual PC 2007

Microsoft Virtual PC 2007: An unrecoverable processor error has been encountered.

install Suse Linux/Fedora and also gOS to Virtual PC 2007

Type(append to other options )

noreplace-paravirt

to boot option

This solves my problem.

Posted in gOS, Linux Tagged ,

vb.net htmlattributes example

ASP.NET MVC Code
 
Example 1.
       < % Html.BeginForm("Create", "Model", "", "", New With {.id = "CreateForm"})%>
Example 2
       < % Html.BeginForm("Create", "Model", FormMethod.Post, New With {.id = "CreateForm"})%>

Posted in ASP.NET, VB.NET Tagged , , ,

Qt Code Example: New File | Open File | Save File | Save as File | File Print | Print Preview | File Print Preview | Print Preview

Text Editor QT Code
These are few code snippet taken from Qt examples.
I’m making easier to look for particular functions. That’s it Smilie: :) .

New File
Open File
Save File
Save as File
File Print
Print Preview
File Print Preview
Print Preview
Save as PDF

 
void TextEdit::fileNew()
{
    if (maybeSave()) {
        textEdit->clear();
        setCurrentFileName(QString());
    }
}
 
void TextEdit::fileOpen()
{
    QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."),
                                              QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
    if (!fn.isEmpty())
        load(fn);
}
 
bool TextEdit::fileSave()
{
    if (fileName.isEmpty())
        return fileSaveAs();
 
    QTextDocumentWriter writer(fileName);
    bool success = writer.write(textEdit->document());
    if (success)
        textEdit->document()->setModified(false);
    return success;
}
 
bool TextEdit::fileSaveAs()
{
    QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
                                              QString(), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"));
    if (fn.isEmpty())
        return false;
    if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
        fn += ".odt"; // default
    setCurrentFileName(fn);
    return fileSave();
}
 
void TextEdit::filePrint()
{
#ifndef QT_NO_PRINTER
    QPrinter printer(QPrinter::HighResolution);
    QPrintDialog *dlg = new QPrintDialog(&printer, this);
    if (textEdit->textCursor().hasSelection())
        dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
    dlg->setWindowTitle(tr("Print Document"));
    if (dlg->exec() == QDialog::Accepted) {
        textEdit->print(&printer);
    }
    delete dlg;
#endif
}
 
void TextEdit::filePrintPreview()
{
#ifndef QT_NO_PRINTER
    QPrinter printer(QPrinter::HighResolution);
    QPrintPreviewDialog preview(&printer, this);
    connect(&preview, SIGNAL(paintRequested(QPrinter *)), SLOT(printPreview(QPrinter *)));
    preview.exec();
#endif
}
 
void TextEdit::printPreview(QPrinter *printer)
{
#ifdef QT_NO_PRINTER
    Q_UNUSED(printer);
#else
    textEdit->print(printer);
#endif
}
 
 
void TextEdit::filePrintPdf()
{
#ifndef QT_NO_PRINTER
//! [0]
    QString fileName = QFileDialog::getSaveFileName(this, "Export PDF",
                                                    QString(), "*.pdf");
    if (!fileName.isEmpty()) {
        if (QFileInfo(fileName).suffix().isEmpty())
            fileName.append(".pdf");
        QPrinter printer(QPrinter::HighResolution);
        printer.setOutputFormat(QPrinter::PdfFormat);
        printer.setOutputFileName(fileName);
        textEdit->document()->print(&printer);
    }
//! [0]
#endif
}

Posted in Featured, Qt Tagged , , , , , ,

Qt Code Example: MessageBox

QT Code MessageBox

 
QMessageBox::about(this, tr("About Syntax Highlighter"),
          tr("<p>The <b>Syntax Highlighter</b> example shows how " \
            "to perform simple syntax highlighting by subclassing " \
            "the QSyntaxHighlighter class and describing " \
            "highlighting rules using regular expressions.</p>"));

Posted in Featured, Qt Tagged ,

Qt Code Example : Open File

QT Code Open File

void MainWindow::openFile(const QString &path)
{
    QString fileName = path;
 
    if (fileName.isNull())
        fileName = QFileDialog::getOpenFileName(this,
            tr("Open File"), "", "C++ Files (*.cpp *.h)");
 
    if (!fileName.isEmpty()) {
        QFile file(fileName);
        if (file.open(QFile::ReadOnly | QFile::Text))
            editor->setPlainText(file.readAll());
 
    }
}

Posted in Featured, Qt Tagged