Tuesday, December 25, 2012

Modify Headers Add-on: testing your website on Firefox like mobile device

There are some add-ons for Firefox which can simulate data sent to servers to make it seem as if the user agent is browsing on a mobile device, even when they’re not. One of them is Modify Headers addon.

Here is its quick start: http://www.garethhunt.com/modifyheaders/help/quickstart/

Here is the list of iPhone User-Agent: http://enterpriseios.com/wiki/Complete_List_of_iOS_User_Agent_Strings

Here is the other User-Agent profile: http://w3development.de/rdf/uaprof_repository/

Here is iPad UA:
Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10

For Google Chrome, you can try out the User-Agent Switcher extension.

Happy testing :)

Monday, December 24, 2012

Joomla 2.5: Load module by module id

This plugin will help you load a module into an article by its id.
http://www.pages-and-items.com/extensions/load-module-into-article

+Thoi Trang Tre Em

Wednesday, December 5, 2012

Convert RTF to HTML

Here are some places to get the source code:
http://code.msdn.microsoft.com/windowsdesktop/Converting-between-RTF-and-aaa02a6e
(old: http://blogs.msdn.com/b/matt/archive/2009/09/28/converting-rtf-to-html.aspx)
http://www.codeproject.com/Articles/27431/Writing-Your-Own-RTF-Converter
http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx
http://sourceforge.net/projects/rtf2html-lite/
http://www.codeguru.com/cpp/controls/richedit/conversions/article.php/c5377/RTFtoHTML-Converter.htm


Friday, November 30, 2012

Uninstall the "Send to Bluetooth Add-In"


First find the location of the Add In dll:

to find the btsendto_office.dll go to File/Options/Add-In select the Send to add in and observe the path at the bottom of the screen

Close all office applications and unregister the Add In with:

regsvr32 /u "C:\Program Files\ThinkPad\Bluetooth Software\btsendto_office.dll"

If you want re-register the Add In with

regsvr32 "C:\Program Files\ThinkPad\Bluetooth Software\btsendto_office.dll"

Thursday, November 29, 2012

Check if 32bit or 64bit version of Office is installed


1. Open Microsoft Office 2010 application like Microsoft Word on your computer.

2. Once the application window is opened, goto File menu and click Help option.

3. Check for the information on right side of this Help window. You should see Office version under “About Microsoft Word’ option as 32bit or 64bit next to version details.

Wednesday, November 14, 2012

MS SQL 2012: bug reseed of Identity after restarting MS SQL server

F.Y.I
https://connect.microsoft.com/SQLServer/feedback/details/739013/alwayson-failover-results-in-reseed-of-identity

==> don't use MS SQL untill this bug is fixed, if your system / application uses/combines ID of row of the table for documents, such as: Invoice / Receipt ....

Monday, November 5, 2012

MS Word 2010 crashed when opening document

If you got this problem, it may come from an addin of MS Word 2010. Below is the way to help you find out which addin causes this problem.
1. Open MS Word in Safe Mode: hold Ctrl key >> click MS Word icon >> choose Yes in a dialog displayed
2. Click File menu >> Addins >> click Go button in the Manage: Com-in Add
3. Clear the checkboxes to disable all addins
4. Close MS Word
5. Try to open your document again. If MS Word can open the doc, it means an addin caused this crash.
6. Open MS Word in Safe Mode again
7. Enable one by one addin and open the doc to check when it's crashed ==> the bad guy -:)

CSS: horizontal ul li

HTML
<ul class="mylist">
<li id="active"><a href="#" id="current">Item one</a></li>
<li><a href="#">Item two</a></li>
<li><a href="#">Item three</a></li>
<li><a href="#">Item four</a></li>
<li><a href="#">Item five</a></li>
</ul>

CSS
.mylist li
{
display: inline;
float: left;
list-style-type: none;
padding-right: 20px;
}

Friday, November 2, 2012

MySQL: [1406]Data too long for column

If you get this 1406 error while you run SQL command to insert data into a TEXT column.

1. Check if max_allowed_packet size is enough for your SQL command size. If not, change it in the my.ini file. Just nnclude the single line under [mysqld] in your file, for example:
max_allowed_packet=16M
Then restart mysql.

2. If max_allowed_packet is OK, try to change the column to LONGTEXT.

Hope it can help some bodies -:)

Monday, October 22, 2012

Auto task ftp backup mysql

This guide helps you backup mysql db via FTP with a schedule.
1. Requirements
-WinRAR
-FTP client (command lines)

2. Create batch file (for example mysql_backup.bat) with following code

@echo off
setlocal
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c%%a%%b)
"<your mysql folder>\bin\mysqldump.exe" -u <mysqluser> --password=<mysqlpassword> yourdb > "<your mysql backup folder>\yourdb%mydate%.sql"
"<your WinRAR folder>\WinRAR.exe" a -r -inul<your mysql backup folder>\yourdb%mydate%.rar <your mysql backup folder>\yourdb%mydate%.sql
del <your mysql backup folder>\yourdb%mydate%.sql
copy <your mysql backup folder>\yourdb%mydate%.rar <your folder to upload>
ftp -v -i -s:ftpscript.txt
del <your folder to upload>\tmcrm%mydate%.rar


3. Create ftp script file (ftpscript.txt)

open <your server>
<username>
<password>
lcd  <your folder to upload>
cd <your server folder to hold backup>
binary
mput "*.*"
disconnect
bye

4. Create Windows' task schedule for this mysql_backup.bat

End ./.

Friday, October 19, 2012

Export MSSQL 2012 and Import to old version

A. Export from MSSQL 2012
1. On Microsoft SQL Server Management Studio of SQL Server 2012. Right click on the database that you want to backup and select Tasks >> Generate Scripts.
2. On tab Introduction of Generate and Publish Scripts screen, click Next.
3. On tab Choose Objects of Generate and Publish Scripts screen, select Script entire database and all database objects, then click Next.
4. On tab Set Scripting Options, click Advanced button
5. On Advanced Scripting Options screen:
  -set Script for Server Version to old version which you want (e.g. SQL Server 2008 R2);
  -set Types of data to script to Schema and data
  -in Table/View options: select types of scripts which you want
6. After selecting advanced options, then file name to save and click Next
7. Wait for finishing

B. Import to old version (e.g. MSSQL 2008 R2)
- Open SQL Server Management Studio >>  open the sql file and run to import
- In the case large file, you can run command:
SQLCMD -E -i input.sql -o output.txt
-Or run command below, if you want to import to existing DB
SQLCMD -E -d db -i input.sql -o output.txt



Saturday, October 13, 2012

CSS img shadow and change border on hover

For example, you have html a tag as the following:
<a class= 'aclass' href='aurl' title='short text' target='_blank'><img src='imgurl' style='width:160px;  height:160px;' class='ish' alt='short text' title='short text' /></a>

Let try the css below:

.aclass img
{
margin: 3px 4px 5px 4px;
border: 1px solid #C0C0C0;
}

.ish
{
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
-goog-ms-box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
filter:progid:DXImageTransform.Microsoft.Shadow(color='#000000', Direction=120, Strength=5);
}

img.ish:hover
{
border: 1px solid green;
}


Wednesday, October 10, 2012

IIS 7.5: Enable Parent Paths

Why need?
Classic ASP Parent Paths let developers use relative addresses that contain ".." in the paths to files or folders. For example, the following code excerpt illustrates an ASP page that maps a parent path:
<%
Response.Write Server.MapPath("../example.asp")
%>

The above code will fire 500 error ==> so need to enable parent path

Steps:

1.  Once logged into your server, open IIS Manager.  You can do this by clicking your Windows Start button and entering "inetmgr" into the search box.  Then press enter.

2.  On the Connections pane, expand the server node and select your site from underneath "Sites."




3.  On the Features view, double-click "ASP."




4.  Change "Enable Parent Paths" to "True."




5.  Under the Actions page, click "Apply."

MS SQL 2012: Some important configurations


I. Change security authentication mode
  1. In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
  2. On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
  3. In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
  4. In Object Explorer, right-click your server, and then click Restart. If SQL Server Agent is running, it must also be restarted.
II. Enable the sa login
  1. In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
  2. On the General page, you might have to create and confirm a password for the login.
  3. On the Status page, in the Login section, click Enabled, and then click OK.
III. Change memory
  1. In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
  2. On the Memory page, set Minimum & Maximum server memory
  3. In Object Explorer, right-click your server, and then click Restart. If SQL Server Agent is running, it must also be restarted.
IV. Change IP & port to connect
  1. Open SQL Server Configuration Manager
  2. Under SQL Server Network Configuration >> Protocols for MSSQLSERVER >> right side >> right click on TCP/IP >> select Properties >> tab IP Address
  3. Select an IP option (e.g. IP2) >> change IP Address value to the IP which you want to use for connection >> Change TCP Port to the port which you want >> select Enable = Yes
  4. Restart MS SQL Server
V. Change auto growth
By default DB will have auto growth is 10% for its data file and log file. It may cause disk space problem when your DB increase data. To change, let do below steps:
  1. Right click on the DB >> select Properties >> select Files
  2. Click on ... button (see the following picture) then change the auto growth number.





Tuesday, October 9, 2012

Webmaster: guidelines for rich snippets


Traditional, text-only, search result snippets aim to summarize the content of a page in our search results. Rich snippets (shown below) allow webmasters to help us provide even better summaries using structured data markup that they can add to their pages. Today we're introducing a set of guidelines to help you implement high quality structured data markup for rich snippets.



Once you've correctly added structured data markup to you site, rich snippets are generated algorithmically based on that markup. If the markup on a page offers an accurate description of the page's content, is up-to-date, and is visible and easily discoverable on your page and by users, our algorithms are more likely to decide to show a rich snippet in Google’s search results.

Alternatively, if the rich snippets markup on a page is spammy, misleading, or otherwise abusive, our algorithms are much more likely to ignore the markup and render a text-only snippet. Keep in mind that, while rich snippets are generated algorithmically, we do reserve the right to take manual action (e.g., disable rich snippets for a specific site) in cases where we see actions that hurt the experience for our users.

To illustrate these guidelines with some examples:

  • If your page is about a band, make sure you mark up concerts being performed by that band, not by related bands or bands in the same town.
  • If you sell products through your site, make sure reviews on each page are about that page's product and not the store itself.
  • If your site provides song lyrics, make sure reviews are about the quality of the lyrics, not the quality of the song itself.

In addition to the general rich snippets quality guidelines we're publishing today, you'll find usage guidelines for specific types of rich snippets in our Help Center. As always, if you have any questions or feedback, please tell us in the Webmaster Help Forum.

Posted by Jeremy Lubin, Consumer Experience Specialist, & Pierre Far, Webmaster Trends Analyst

Friday, October 5, 2012

Joomla 2.5: add google gadget

A. Add to a position on the Joomla website
1. Goto Google Gadgets For Your Webpage.
2. Click "Add to your webpage" button.
3. Click "Get the code" button you will see the script to run the gadget.
4. Create a Custom HTML module on your Joomla site. Remember to clean up Prohibited Elements in Editor - TinyMCE plugin.
5. Copy and paste the code from step 3 into the source of the Custom HTML module

B. Add to an article of Joomla
1. Do same 3 steps as mentined in A
2. Copy and paste to source HTML of the article

C. Add Google sites gadget to Joomla site
1. Add the gadget to your Google sites
2. In FireFox, select the area which contains the gadget >> then right click >> View Selection Source
3. Find <iframe> tag in the source HTML and copy its content. For example, I add Google Maps gadget into my Google sites and get its iframe as the following:


<iframe class="map_embed" frameborder="0" height="500" scrolling="no" src="//maps.google.com/maps/ms?z=16&amp;ie=UTF8&amp;msa=0&amp;msid=204746671798990797697.0004a78f5b3a13d5f4a43&amp;output=embed&amp;output=embed" title="BABY &amp; KIDS FASHION" width="100%"></iframe>

4. Copy and paste to source HTML of an article or Custom HTML module

Monday, October 1, 2012

Chrome Web Store: new way to publish Google Apps Script


Apps Script developers that wished to share their work with a larger audience have traditionally turned to the Script Gallery, which allows other users to copy and install the script into their own spreadsheets. While appropriate for custom functions and spreadsheet extensions, it didn't fit well when distributing more complex functionality and apps.

In this blog post we'll be highlighting a newer way to distribute your scripts: deploying them as a web app and publishing them to the Chrome Web Store. Compared to the Script Gallery, the Chrome Web Store has some distinct advantages for developers:

  • Automatic updates - Change your code, do some testing, and publish a new version to update the app for all users instantly.
  • More information - Detailed descriptions, promotional images, ratings, and reviews lead tocompelling listings.
  • Greater discoverability - Visit the Chrome Web Store site to learn about the benefits.

Looking through the Script Gallery we believe there are many scripts that would be a great fit for the Chrome Web Store and would benefit from the advantages listed above. Some aspects of a good candidate script are:

  • Custom UI - Users interact with your script through a custom user interface, not via custom spreadsheet functions or onEdit triggers.
  • Background processing - Your script uses time-based triggers to do work in the background and doesn't require that the Google Spreadsheet is open.
  • Not primarily about Google Spreadsheets - Your script's main focus isn't spreadsheets and you utilize a variety of services to provide separate functionality.

A great example of such a script is Gmail Meter, which was first launched in the Script Gallery but has since been published to Chrome Web Store. Now users can install and run the script without needing to create a spreadsheet, see script code, or set up triggers. It may take a little work to update a spreadsheet-based script to use the web app model, and some common tasks are:

  • Implement doGet() - Instead of showing your custom UI on the spreadsheet with Spreadsheet.show(), put the same code into the doGet() method and return the finalUiInstance or HtmlOutput object.
  • Deploy as a web app - Configure your script to run as a web app, which will assign it a unique URL. In most cases you'll want the web app to run as the user so that it can access their services.
  • Remove references to active spreadsheet - When published as a web app there is no active spreadsheet, so if your script needs access to a spreadsheet then you'll need to use SpreadsheetApp.openById() instead. You can use the DocsList service or theDocsListDialog UI widget to help users locate the desired spreadsheet.
  • Handle multiple users - When published as a web app users access the same copy of the script, so you may need to change the way you organize data to avoid conflicts.UserProperties work well for small settings, and when using ScriptDb make the user's login ID or email address part of the objects so that you can filter for them later.

Publishing to the Chrome Web Store only takes a few clicks, and we provide instructions for the process in our documentation. We hope that you are inspired to take your scripts to the next level, and if you have any questions along the way feel free to reach out to us on StackOverflow or Google+.

By Eric Koleda
Ref: http://googleappsdeveloper.blogspot.com/2012/09/expand-your-reach-with-web-apps.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+GoogleAppsDeveloperBlog+%28Google+Apps+Developer+Blog%29

Wednesday, September 26, 2012

Auto refresh page with Javascript & Meta tag

1. Using meta tag, for example to auto refresh to your url every 1 second.
<meta http-equiv="refresh" content="1;url='http://your_url' " />

2. Using Javascript, for example to auto refresh to your url every 1 second:
<script>
  function auto_refresh() {
    window.location = 'http://your_url';
  }
  setTimeout(auto_refresh, 1000);
</script>


3. Using Javascript + jQuery to auto refresh when having no activity in some minutes (e.g. 1 minute)
<script>
     var time = new Date().getTime();
     $(document.body).bind("mousemove keypress", function(e) {
         time = new Date().getTime();
     });

     function auto_refresh() {
         if(new Date().getTime() - time >= 60000)
             window.location.reload(true);
         else
             setTimeout(auto_refresh, 10000);
     }

     setTimeout(auto_refresh, 10000);
</script>


Tuesday, September 25, 2012

IIS 7: set maxLogFileSizeKB

When the log size comes over maxLogFileSizeKB, you will get LOG_FILE_MAX_SIZE_TRUNCATE event in the log file. To change maxLogFileSizeKB to 1024 KB (default is 512 KB), run on shell (cmd):


cd /d  %windir%\system32\inetsrv
appcmd set config /section:sites -siteDefaults.traceFailedRequestsLogging.maxLogFileSizeKB:1024

Saturday, September 22, 2012

MS SQL Server Management Studio 2008: edit table data


1. Right-Click table and select "Edit Top 200 Rows"
2. Right-Click anywhere on the results, navigate to Pane -> SQL

==> Change the SELECT statement there, e.g. adding a WHERE clause at the bottom.

Friday, September 21, 2012

Windows Server 2008: Add IIS6 Compatibility

Do you need IIS Compatibility to run your old apps, just do as the following:

Server Manager >> Roles >> Web Server (IIS ) >> right click >> Add Role Service >> select IIS6 Management Compatibility >> Next >> Install

Wednesday, September 19, 2012

MS SQL 2008 R2: Export table data to SQL file

1. Right click on the DB
2. Select Task >> Generate Scripts
3. In Choose Object section, select specific database objects
4. Select your tables
5. Next, in Set Scripting Options, click Advanced button >> Types of data to script >> select Data only

Hint:
For old versions of MS SQL, using Sql Server Management Studio 2008 R2 to connect & export data

MS SQL: empty data of all tables

Sometimes you need to empty data of all tables in a database, what you should do:

1. Backup your DB, and run the following command to see disabled triggers:
SELECT
    sysobjects.name AS trigger_name
    ,USER_NAME(sysobjects.uid) AS trigger_owner
    ,s.name AS table_schema
    ,OBJECT_NAME(parent_obj) AS table_name
    ,OBJECTPROPERTY( id, 'ExecIsUpdateTrigger') AS isupdate
    ,OBJECTPROPERTY( id, 'ExecIsDeleteTrigger') AS isdelete
    ,OBJECTPROPERTY( id, 'ExecIsInsertTrigger') AS isinsert
    ,OBJECTPROPERTY( id, 'ExecIsAfterTrigger') AS isafter
    ,OBJECTPROPERTY( id, 'ExecIsInsteadOfTrigger') AS isinsteadof
    ,OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') AS [disabled]
FROM sysobjects

INNER JOIN sysusers
    ON sysobjects.uid = sysusers.uid

INNER JOIN sys.tables t
    ON sysobjects.parent_obj = t.object_id

INNER JOIN sys.schemas s
    ON t.schema_id = s.schema_id

WHERE sysobjects.type = 'TR' and OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') = 1
order by table_name


2. Create a store procedure, e.g. emptyAllTables with code as the following:

CREATE PROCEDURE emplyAllTables
AS

EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'ALTER TABLE ? DISABLE TRIGGER ALL'
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'ALTER TABLE ? ENABLE TRIGGER ALL'
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'

GO

In the case of you want to skips some important tables and reset identity of table, you can use the following SP:


CREATE PROCEDURE emplyAllTables (@ResetIdentity bit)
AS

EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'ALTER TABLE ? DISABLE TRIGGER ALL'


DECLARE @SkipTables nvarchar(max)
DECLARE @TableName varchar(255)
DECLARE @SQL varchar(255)
SET @SkipTables = 'table1,table2,table3'

DECLARE curTable CURSOR LOCAL FOR
SELECT Table_Name FROM INFORMATION_SCHEMA.TABLES WHERE CHARINDEX(Table_Name,@SkipTables) = 0 AND TABLE_TYPE='BASE TABLE'

OPEN curTable
FETCH Next FROM curTable INTO @TableName
WHILE @@FETCH_STATUS=0
BEGIN
SET @SQL = 'DELETE FROM ' + @TableName

IF @ResetIdentity = 1 AND OBJECTPROPERTY (OBJECT_ID(@TableName),'TableHasIdentity') = 1
SET @SQL = @SQL + '; DBCC CHECKIDENT(''' + @TableName + ''',RESEED,0)'

EXECUTE(@SQL)
--PRINT @SQL

FETCH Next FROM curTable INTO @TableName
END


EXEC sp_MSForEachTable 'ALTER TABLE ? ENABLE TRIGGER ALL'
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'

GO

3. Manually disable triggers in step 1

Now you have an empty DB for your new start up :)

Saturday, September 15, 2012

MySQL: Check logs of queries

Apply for MySQL >= 5.1.12:
1. Open MySQL console
2. Execute SET GLOBAL log_output = 'TABLE';
3. Execute SET GLOBAL general_log = 'ON';
4. Check table mysql.general_log (should ORDER BY event_time DESC)

To turn off:
5. Execute SET GLOBAL general_log = 'OFF';

If you want to put logs to file:
SET GLOBAL log_output = "FILE";
SET GLOBAL general_log_file = "your_folder/your_file.log"

Thursday, September 13, 2012

Joomla 2.5: Where Does JToolBarHelper::custom Load Icon?

It's loaded from: administrator/templates/<selected template>/images/toolbar

For example: create a NewButton on the toolbar of your component
1. Copy ButtonIcon into administrator/templates/<selected template>/images/toolbar floder
2. Add new line to administrator/templates/<selected template>/css/template.css
.icon-32-ButtonIcon { background-image: url(../images/toolbar/icon-32-ButtonIcon.png); }
3. Declare it in your code:
JToolBarHelper::custom( 'yourtask', 'ButtonIcon.png', ' ButtonIcon .png', 'Button Name', false,  false );

Wednesday, September 12, 2012

Best free web hosting services



Free Web Hosting
Services

Disk
Space
Monthly
Bandwidth
MySQL
Databases
FTP
Support
Uploaded File
Restrictions
Forced
Ads
Xtreemhost
2500 MB
100 GB
10
yes
4 MB
no
Frihost
1500 MB
35 GB
unlimited
yes
unlimited
no
000webhost
1536 MB
100 GB
2
yes
5 MB
no
Byethost
unlimited
unlimited
unlimited
yes
4 MB
no
Podserver
300 MB
10 GB
7
yes
5 MB
yes
Freehostia
250 MB
6 GB
1
yes
500 KB
no
Zymic
6000 MB
50 GB
3
yes
15 MB
no
Uhostfull
unlimited
unlimited
unlimited
yes
unlimited
no
Beesimple
1024 MB
10 GB
10
yes
2 MB
no                                         

Saturday, August 18, 2012

DB Server: Maintenance tasks

1. Must have
+Full DB backup: daily, should be scheduled in off hours
+Verify DB backup: daily, after full back up, to make sure DB can restore ok
+Check db integrity: daily, should be scheduled in off hours
+Transaction log backups: every 15 minutes
+Maintenance cleanup: daily
+Update statistics: daily

2. Should have
+Shrink tempdb: daily, should do with max capacity of your disk space
+Rebuild index: weekly, be careful, should check with SQL Server Profiler tool to make sure new indexes be effective or worse

Ref:
http://www.sql-server-pro.com/dbcc-checkdb.html
http://msdn.microsoft.com/en-us/library/ms176064.aspx


Thursday, August 16, 2012

PHP SoapClient calls .NET web service


1. Link to the WSDL output of the .NET web service as below
$client = new SoapClient("http://yourhost/your_web_service.asmx?wsdl");

2. Declare params
$params = array();
$params['param1'] = $value1; //param1 = first variable name in  YourWebMethod  of .Net web service
$params['param2'] = $value2; //param2 = second variable name in  YourWebMethod  of .Net web service
...

3. Call web method / function
$result = $client->YourWebMethod($params)->YourWebMethodResult;

4. Process $result


Friday, August 10, 2012

MSSQL: Move DB files or tempdb

1. Check where  is tempdb stored

USE tempdb
GO
EXEC sp_helpfile
GO

2. Change the folder

USE master
GO
ALTER DATABASE tempdb 
MODIFY FILE (NAME = tempdev, FILENAME = 'D:\VIP\tempdb.mdf')
GO
ALTER DATABASE tempdb 
MODIFY FILE (NAME = templog, FILENAME = 'D:\VIP\tempdb.ldf')
GO

You can apply this for any DB which you want to move to the other folder. Changing does not take effect immediately, but will be used the next time the database starts up.

Set the database offline:
ALTER DATABASE foo SET OFFLINE WITH ROLLBACK IMMEDIATE;

Use WITH ROLLBACK IMMEDIATE to kick everyone out and rollback all currently open transactions.

Move/Copy the files to the new location:
Just copy the DB files to the new location

Bring the database online:
ALTER DATABASE foo SET ONLINE;

3. Work / monitor tempdb

Read: http://technet.microsoft.com/en-us/library/cc966545.aspx#EDAA



Thursday, August 9, 2012

Excel: Create Pie chart from single column


  1. Add new column (e.g. Count) and fill it with 1
    enter image description here
  2. Select your data (both columns) and create a Pivot Table: On the Insert tab click on the PivotTable | Pivot Table (you can create it on the same worksheet or on a new sheet)
    enter image description here
  3. On the PivotTable Filed List drag Country to Row Labels and Count to Values
    enter image description here
  4. Now select the pivot table data and create your pie chart as usual.
    enter image description here
P.S. I use the pivot table for I update the data on a regular basis, then I just replace the "Country" data and refresh the pivot table.

Wednesday, August 1, 2012

Hangouts with SEO Webmaster

Some experiences with experts of SEO
http://googleandyourbusiness.blogspot.com/2012/07/help-desk-hangouts-seo-webmaster.html

Some of the questions we answered during the Hangout:
My site used to rank really well, but now it doesn’t. What happened?
There could be several reasons that your site is not be ranking in search the same way that it did in the past. Three common reasons why this may happen are that your site has a technical problem which is preventing Googlebot from accessing it, your site violates our quality guidelines, or your site is simply ranking differently due to changes to our algorithm, which is updated hundreds of times per year. The first thing we’d recommend to diagnose your issue is to check your site in Google Webmaster Tools, a free service that gives you information about how your site is performing in Google. If we’ve detected a problem with your site, we may have sent you a message there. For a more detailed checklist to help you diagnose a change in ranking, visit our Help Center.

I'd love to learn more about the Knowledge Graph and what, if anything we should be doing as SEOs & Webmasters.

The Knowledge Graph is a way for users to see additional relevant information on searches for certain people, places and things on the right hand side of the results page. This information helps users get to answers quickly; in many cases, they may find answers to questions they hadn’t even thought to ask. It also helps people discover more about the topic they’re interested in by showing people, places or things that are closely related to their searches. For example, if you search for an artist like Leonardo da Vinci, you’ll see a short biography, some of his most famous works, and other frequently searched-for artists. Currently, there isn’t any functionality in Webmaster Tools to be included in the Knowledge Graph. Right now this is not about individual businesses but rather about generally known facts about the world.

How do you rank item detail pages where there may be many websites which have the same item for sale (with a standard "technical description")? Who rises to the top when the content is basically static?

Great question! Many merchant and affiliate sites use product descriptions taken straight from the manufacturer or from the end merchant site. While sometimes this can be appropriate, we typically recommend looking for ways you can add your own value to that page - can you provide some original reviews or recommendations about the item? If you are adding value of your own you’ll be providing a better experience for users. If you are concerned about this, check out our material on duplicate content and watch this video about our Webmaster Guidelines.

Where can I go for more information, help, or to prove my own knowledge?

Our experts mentioned a bunch of incredible resources available to you. Here are a few links to get you started:



Google Apps Script: Cool Dashboards

If you ofter work with figures & charts, you may love Dashboards of Google Apps Script.
See more details at:
http://googleappsdeveloper.blogspot.com/2012/07/introducing-dashboards-in-google-apps.html

Friday, July 27, 2012

Wednesday, July 25, 2012

Learn jQuery Widgets

Some good places for learning  jQuery Widgets:

http://www.erichynds.com/jquery/tips-for-developing-jquery-ui-widgets/
http://jqueryui.com/demos/widget/#default
http://alexmarandon.com/articles/web_widget_jquery/
http://bililite.com/blog/understanding-jquery-ui-widgets-a-tutorial/
http://msdn.microsoft.com/en-us/library/hh404085.aspx

Tuesday, July 24, 2012

Twitter Bootstrap Plugin for Joomla

A product from phproberto: https://github.com/digitaldisseny/plg_sys_twbootstrap

If you need to use overrides:
1. In your template create the folder
templates/YOURTEMPLATE/plg_system_twbootstrap
2. Copy the js & css folders from
plugins/system/twbootstrap
to:
templates/YOURTEMPLATE/html/plg_system_twbootstrap
3. You are done! The plugin will detect any file overriden and load it instead of plugin's default version


Joomla! 2.5: modify meta tag to guide robots


By default Joomla 2.5 does not add the robots meta tag in the header and you have no handy tool by default to do it in one place, unless you don't use some add-on which let you do this easily.

But what if you prefer to do it yourself, bare-handed, without seeing even some code? You might be surprised, but in fact in Joomla 2.5 it's very easy to set up meta tag robots for your home page and content articles.

Tweaking these settings might add you an edge over your competition in the race for better ranking in Google and Bing searches - to name only the biggest players. You can do this in two easy to follow steps:

Step 1. Go to Content >> Category Manager and open the category you need to change
Open the parameters tab "Metadata Options" and set the value of Robots for example to "noindex, follow" to prevent indexing of category blog pages, but invite search-engine bots to follow the links in the page to discover all content items linked to them.

Step 2. Go to Menus >> Menu Manager and open the menu containing the menu item to the category blog you need to change. Open the menu item, then open the parameters tab "Metadata Options" and set the value of Robots to "Index, Follow".

Done! The web bots now are properly instructed how to discover and index your site. Using these settings the category pages will have lower ranks/importance as the content pages, this way facilitating the "concentration" of Page Rank to your content pages - at least this is the SEO guys out there are claiming.

If you use still Joomla 1.5, to change the value of meta tag robots in Joomla! 1.5 for content category pages you have to add some code in your template.

// Set robots for category pages
$document =& JFactory::getDocument();
$view = JRequest::getVar('view');
if ($view == 'category') { $document->setMetaData('robots','noindex,follow'); }

Saturday, July 21, 2012

Major updates for Google Apps Script

Update from Google I/O:


1. Script.google.com as a new destination for Apps Script developers. You can now create scripts from script.google.com  or from Google Drive. Your projects are now stored in Google Drive, and you can share them just like a Google document or spreadsheet.


2. HtmlService can help you create beautiful interfaces using Apps Script. HtmlService allows you to create web apps using HTML, client-side JavaScript, and CSS. You can also use jQuery to build web apps. HtmlService uses Google Caja  to ensure that the HTML content served by your web apps is safer for you and your users.


3. ScriptDb is a better way to store your application's data. Every script now has an embedded JSON database. You no longer have to rely on a spreadsheet to store the data. Using ScriptDb, you can store a larger volume of data and search easily. We designed ScriptDb to be easy to use. It doesn't need connection strings or special passwords, and you can directly store and search your JavaScript objects without the need to convert them to a different format. You can learn more about ScriptDb on the Google Apps Script Developers page.


4. You can now publish your apps in the Chrome Web Store . Register and package your app directly from the Publish menu in Google Apps Script. Then customize your listing from the Chrome Web Store and publish your app to the world.


5.  New developer reference documentation , new user guide, reach GAS team on Stack Overflowmake feature requests and report issues on the Apps Script page on Google Code.

Tuesday, July 17, 2012

Joomla 2.5: set session inside & get session outside


We have a need to set a session in joomla extension (e.g. component) and get (read) session in a external file  (outside joomla).

Here is the sample code:

//set session in a joomla extension
$session =& JFactory::getSession();
$session->set('asession', 'avalue');


//get session in a external file (outside joomla)

define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/..' )); //should change to match to your file directory
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$session =& JFactory::getSession();
$asessionvalue = $session->get(' asession ');

Monday, July 9, 2012

Google Apps Script: get url request parameter

Get it from doGet(e) { e.parameter.ParameterName; //or  e.parameter["param"]; }

E.g. URL: https://sites.google.com/macros/exec?service=XXXXXXXXXXXXX&test=sample_parameter


Code sample:


function doGet(e) {
  var app = UiApp.createApplication();
  var aLabel = app.createLabel("I love Apps Script!").setStyleAttribute("fontSize","16px");
  var verticalpanel = app.createVerticalPanel();
  var mybutton = app.createButton(e.parameter.test);
  verticalpanel.add(aLabel);
  verticalpanel.add(mybutton);
  app.add(verticalpanel);
  return app;
}

Friday, July 6, 2012

Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126

Solving:

1. Copy new xpstar90.dll of same MS SQL version to C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\xpstar90.dll

OR

2. Reinstall MS SQL

Thursday, July 5, 2012

jquery week calendar associated with php & mysql

Here is the sample for jquery week calendar associated with php & mysql.
It supports:
+Read events from mysql db
+Save new events to mysql db
Sorry,
I have no time to add more functions.

Download sample here: http://lvhung.googlecode.com/files/calendar.rar

Tuesday, July 3, 2012

Free calendar script


Refer: http://stackoverflow.com/questions/8087537/what-are-some-free-web-based-open-source-calendar-solutions
jquery-week-calendar similar to Google Calendar.
Similer
wdCalendar – jQuery Based Google Calendar Clone, Demo URL
wdCalendar
Monket Calendar coded in HTML, CSS, Javascript, and PHP, Demo Url
Monket Calendar
More open-source calendars can be found in http://www.webappers.com/category/components/calendar, they are more than 35 calendar projects.

Wednesday, June 20, 2012

Joomla mobile template

Some Joomla templates support mobile devices. It's the easiest way to create a mobile template for Joomla.


But if you built a template, you can use some extension to present your website on various mobile device types. Mobile Joomla might be one of the first plug-ins recommendations.

You can read this article to know more about Joomla mobile solution.

For concepts of mobile template,  read this article may be helpful for you, too.

Google Sites Html Box


Experiments

The HTML Box will not allow all code, e.g. you cannot make calls to external JavaScript files, but you can use JavaScript embedded on the page.

The HTML box is not the answer to free-reign scripting. You can use more HTML, CSS, Javascript, and jQuery, but you cannot use all of it.

I did notice that the HTML box isn't an iframe like gadgets, so I think that creates room for interesting use of embedding code on your pages. I've had quite an interest in Google Analytics with Google Sites for event tracking.

For how to insert HTML box into your site, please see:
http://support.google.com/sites/bin/answer.py?hl=en&answer=2500646

Thursday, June 14, 2012

10 useful api providers


Today we had 10 new APIs added to our API directory including a Latin America travel site, IP location and information service, biochemical system simulation service, mobile location serviceonline and mobile payment service, digital media streaming service, weather data service and telephone spammer database. Below is more details on each of these new APIs.
CopasiWSCopasiWS API: CopasiWS is a suite of APIs based on COPASI software for simulating biochemical systems. In addition to converting and validating files for use, users can find the steady state of a dynamic system or determine a system's trajectory. One API quantifies the effects of reaction rates on chemical concentrations, while others calculate the sensitivities of biochemical models and their responses to parameter changes. All CopasiWS APIs make use of the SOAP protocol.
DespegarDespegar API: Despegar is a travel agency specializing in Latin American destinations. Visitors to the site can search for hotels, flights and more and find the lowest prices. The API provides access to the data stored by Despegar. Data includes availability of accommodations, hotels, booking, airports, currencies and more. The API uses RESTful calls and responses are formatted in JSON.
GeoIPsGeoIPs API: GeoIPs.com is an application that offers users IP tracking data, web tools and geographic resources. The service lets users identify IP addresses in real-time. The API lets users trace their website visitors by providing their geographic location and IP related information. Developers can integrate the data with their own sites and applicatilns. The API uses RESTful calls and responses are formatted in XML and JSON.
Golm Metabalome DatabaseGolm Metabalome Database API: The Golm Metabolome Database (GMD) offers a collection of APIs that provide programmatic access to the GMD's search functions. These APIs allow users to search for metabolites by inputting GC-MS spectral data consisting of a retention index and mass intensity ratios. Metabolites that don't yet have reference mass spectra included in the GMD can be characterized by the predicted presence or absence of functional groups. There is also a search API specific to the GoBioSpace database, which is part of the GMD. The GMD APIs operate over SOAP, GET, and POST protocols.
GSMA OneAPI Zonal PresenceGSMA OneAPI Zonal Presence API: The GSMA is an association of mobile operators worldwide. Representing more than 800 mobile operators in more than 220 countries, the GSMA supports the standardizing, deployment and promotion of the GSM mobile telephone system. The GSMA also produces industry-leading events such as the Mobile World Congress and Mobile Asia Expo.
The GSMA OneAPI is a set of APIs that expose network capabilities over HTTP. The OneAPI Zonal Presence interface allows a Web application to query a ‘Zone’. A zone is a cluster of one or more Femtocells to which end user phones may be connected. With the Zonal Presence API you can determine the number of users in a zone, be notified of entries to/exits from the Zone, and the user path taken through the Femtocells in a Zone.
HUSAR Bioinformatics LabHUSAR Bioinformatics Lab API: The HUSAR Bioinformatics Lab at DKFZ provides a large number of freely available APIs. Many of these are useful in aligning DNA, RNA, or protein sequences. Alignments can be pairwise or multiple, local or global. Some of the APIs help visualize sequences or alignment results. Others edit biological sequences to make them more comprehensible to researchers.
One large group of APIs is dedicated specifically to working with nucleic acid sequences. Some analyze sequence composition or codon usage, while others locate specific genes, motifs, or CpG islands within a sequence. One group of these APIs focuses on translating DNA sequences to proteins and vice versa. A handful of others focus on working with sequence profiles. Still more look for primers, repeats, restriction sites, or transcription factors. A few others allow the user to play with sequence mutations.
Yet another group of APIs works exclusively with proteins. A few APIs in this category focus on identification and profiling. There are some that assess secondary and tertiary structure, while others focus on determining protein composition and motifs. A couple are designed to simulate mutations in proteins.
A handful of miscellaneous APIs provide background information on sequences, alignment methods, available databases, and other relevant subjects. One simply returns the current EMBOSS version number.
All of HUSAR's services are based on EMBOSS freeware and possess their own individual WSDL endpoints.
LevelUpLevelUp API: LevelUp is an online and mobile payment service. Users can set up their own QR code that allows them to pay various merchants via scanning the QR code. LevelUp also offers users savings when paying with the LevelUp application. Merchants can integrate the LevelUp system with their point-of-sale systems to accept LevelUp payments for goods and services.
The LevelUp API allows developers to access and integrate the functionality of LevelUp with other applications, such as point-of-sale systems and to create new applications. Some example API methods include accepting online payments, accepting mobile payments, and retrieving reporting information. Interested developers should sign up here: https://docs.google.com/spreadsheet/viewform?formkey=dEJOVkZTcU81cTYtVC1rWFNubFRQMXc6MQ#gid=0.
RokuRoku API: The service streams video from affiliated providers via wireless or wired network connections to television sets and other video display devices. Applications can establish public or private channels, paid or free of charge, to provide media content to end-user devices. The provider's SDK supports creation of code that, when uploaded to the service, will retrieve and display media resources.
API methods support detection of device models, authentication of end users and account management, control of user interactions with the platform, and grouping of categories, episodes, etc. with navigation to desired content. Methods also support handling of media resources, including specification of playback formats and streaming from designated sources.
Tenki WeatherTenki Weather API: Tenki is the website of the Japan Weather Association. The Tenki API provides users with weather information such as the forecast, UV and pollen information, umbrella index and more. This data can be integrated with a user's web site or application. The API uses RESTful calls and responses are formatted in XML and JSON.
VemringdeVemringde API: Vemringde is a service that lists phone numbers from unwanted callers. With the vemringde.se API, users can search for information about issues in the database and use it in their own applications. An example use would be to help to block sales calls on an IP phone or mobile phone. The API consists of two parts, the List API lists the most common numbers on vemringde.se. The Search API provides information about any number in the database, it works much like a normal number lookup. The API uses RESTful calls and responses are formatted in XML, JSON, Text and Vcard.
Subscribe to RSS Feed Follow me on Twitter!