Sunday, August 15, 2010

A simple way to install a SharePoint Farm server.

A SharePoint Farm includes many SharePoint server join into the server which is hosting the Central Admin. However, the servers which joined into the server also can host the Central Admin. A SharePoint Farm only use one a SQL box and can share the resources, data, security,...


This is a simple way to install a sharepoint farm with a highest security and make your server to be safer.

Before installing the farm, create 2 accounts in domain named sqlaccount and spinstaller
Prepare 3 computers: C1, C2 and C3.


We will install MS SQL on C1, SharePoint server hosts Central Admin on C2 and a child server on C3 to join in C2.

Step 1: Login on C1 by Administrator (Local Admin) and install SQL Server
Step 2: Login on C2 by Administrator (Local Admin) and add the account spinstaller into Local Administrators Group.


Step 3: Login on C2 again by spinstaller to install SharePoint. Remember to select Web Front-End option when you install SharePoint.


Step 4: After the installing progress finish, run the SharePoint configuration wizard, type the SQL Server name, database name and use sqlaccount to config the SharePoint.

Step 5: Login on C3 by spinstaller (also add this account into Local Administrators Group) to install SharePoint and select Web Front-End option.


Step 6: Run the SharePoint configuration wizard on C3. At this time, the wizard will ask you to install the new server or connect to existed server. Click on Connect to Existed server. Type the SQL Server and lick Retrieve database, you will get the SharePoint_Config database (that is already existed on C1), type the account sqlaccount to wizard finish the configuration.


That's all. Good luck.

Monday, August 9, 2010

Can not print DIV background & TABLE layout

Sometime, you wonder why could not print the background of DIV and TABLE. Of course, you will take a look at your HTML code, or read the article on MSDN or found something on the internet after google the key of issue.

If you can not print the background or the layout you saw after review the print then please do as a following things:

1) Be sure that DTD is referenced correct. I mean if you are working on Master Page (it's often used the DTD to format the layout). It look likes:

Some DTDs disable or enable some of attributes of DIV tag and TABLE. Sometime you can not get its offsetWidth or its offsetHeight because of using DTD.

2) Ensure that your browser allow to print the background

For IE: go to menu Tool -> Internet Options -> Click on Advanced Tab -> Scroll down and check Print Background
3) Check the code.
If you never use DTD to re-design your layout, you should check the following things:
Please take a look at code:



<div style="float: left; height: 50px; width: 75px;">
Hello</div>



^lt;div style="float: left; height: 50px; width: 125px;">
How are you doing?</div>


When you print or print-review, you only see Hello or even nothing is shown on area printable. When you use float:left, print media did not understand that attribute, so the height of DIV will increase and pull down the text, you won't see the data. 


Solutions: just change DIV to SPAN and remove "float:left" or "float:right"




<div style="overflow: hidden;">

your HTML content
</div>



When you print or review, the content shows like this:

Even thought you had been formatted the layout as well.
Solutions: just remove the overflow:hidden

Saturday, July 31, 2010

Can not save properties WP in publishing site...

There's the interesting thing when you are a developer based on SharePoint that why do not save the properties of Web Part if it is publishing site template.

Of course, when you save the properties at the runtime, you must set SaveProperties = true to apply the any changes.

But in publishing site, before doing any changes on WP, you must do check out and after finish changing to do check in. At the same time, only one user can be checked-out/checked-in to avoid the conflict.

.....

Một điều thú vị mà ai khi lập trình SharePoint cũng sẻ hỏi là, tại sao không lưu được các thuộc tính của webpart khi sử dụng template Publishing Site.

Dĩ nhiên, khi thực hiện thao tác lưu thuộc tính của webpart cho dù runtime hay không thì việc s73 dụng thuộc tính SaveProperties = true cũng chẳng ảnh hưởng nhiều, mục đích chỉ để Apply những thì đã thay đổi.

Trong publishing site, muôn lưu lại các thuộc tính của WP thì truoc tiên phải Check Out site đó ra, rồi thao tác trên WP, sau khi thao tác xong, nhớ check in lên; Tại 1 thời điểm chỉ có 1 user có thể check out và check in để tránh conflict.

Tuesday, July 27, 2010

SPSiteDataQuery error on Discussion Board List

SPSiteDataQuery is used to get the data from multiple list with the same type. The code below shows how to get all items in Discussion Board List. Only show Subject and ID after returning data.

SPSiteDataQuery query = new SPSiteDataQuery();


query.ViewFields = "<FieldRef Name=\"LinkDiscussionTitle\"/><FieldRef Name=\"ID\"/>";
query.Lists = "<Lists ServerTemplate=\"108\"/>";


DataTable table = web.GetSiteData(query);

But you will get an error like this:


AAAAA.Data.UnitTest.GetInternalName.GetDataFromDB : Microsoft.SharePoint.SPException : Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
  ----> System.Runtime.InteropServices.COMException : Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))


The details:



 at Microsoft.SharePoint.Library.SPRequest.CrossListQuery(String bstrUrl, String bstrXmlWebs, String bstrXmlLists, String bstrXmlQuery, ISP2DSafeArrayWriter pCallback, Object& pvarColumns)
   at Microsoft.SharePoint.SPWeb.GetSiteData(SPSiteDataQuery query)
   at Bamboo.Data.UnitTest.GetInternalName.GetDataFromDB() in D:\BambooFolder\TFS2008\Bamboo.WP.ListConsolidator\Bamboo.ListConsolidatorSoln\Bamboo.Data.UnitTest\GetInternalName.cs:line 168
--COMException
   at Microsoft.SharePoint.Library.SPRequestInternalClass.CrossListQuery(String bstrUrl, String bstrXmlWebs, String bstrXmlLists, String bstrXmlQuery, ISP2DSafeArrayWriter pCallback, Object& pvarColumns)
   at Microsoft.SharePoint.Library.SPRequest.CrossListQuery(String bstrUrl, String bstrXmlWebs, String bstrXmlLists, String bstrXmlQuery, ISP2DSafeArrayWriter pCallback, Object& pvarColumns)


The LinkDiscussionTitle is one of the internalname of Discussion Board List, but if you try to query by that column, you will get an error. You can query by any column, except for LinkDiscussionTitle. Just remove that column out your query string, it works fine.

SPSiteDataQuery has been supported all functions like SPQuery exception for GroupBy, if you try to put the GroupBy clause into query, it will throw exception but you can work with filtering and sorting.

Sunday, July 25, 2010

Những cách viết hay JavaScript trong SharePoint - Phần 3

3) Đăng ký StartUpScript hay BlockScript

Có rất nhiều lý do chúng ta đăng 1 đoạn script, thông thường trong C# có 4-5 cách để đăng ký. Đôi khi, lập trình viên cứ quen cách viết mặc định là ClientScript.RegisterClientScriptBlock, tác hại là code không chạy được, bỗng dưng...bực bội.

Tham khảo đoạn code sau nha:

<form action="page.aspx?...">

<script language="javascript">
var myWP = document.getElementById("ms-WP01");
var myCal = myWP.getElementsByTagName("DIV");
myCal[0].style.border = "1px solid red";
</script>

<div id="ms-WP01">
<div id="182C-0123-DB46EF67687-021C" class="ms-cal">
....
</div>
</div>

</form>

Lúc chạy trang web IE nó báo error JavaScript vàng khè ở thanh status bar, click đúp vào thì thấy "myWP is null or undefined", còn chạy Firefox thì im um bà rù.

Thắc mắc: code mình không sai, dò lại thấy trong hàm OnPrerender viết như sau

string strCode = @"var myWP = document.getElementById("ms-WP01");
var myCal = myWP.getElementsByTagName("DIV");
myCal[0].style.border = "1px solid red";";
if (!Page.ClientScript.IsRegisterClientScriptBlock("MyCode"))
{
Page.ClientScript.RegisterClientScriptBlock(this.getType(), "MyCode", strCode, true);
}

Lạ nhỉ, code đúng, build thành công nhưng chạy thì nó báo lỗi. Đơn giản thôi vì cái code JavaScript nó chạy từ trên xuống, đến đoạn nào thực thi ngay đoạn đó, code của chúng ta chạy cũng chẳng có gì phức tạp. myWP chắc chắn sẽ null, vì đến khi chạy lúc đó đối tượng ms-WP01 chưa được Render ra, document nó chưa hiểu ms-WP01 là cái mô tê gì hết.

Do vậy, để tránh những trường hợp thế này chúng ta nên để ý, đoạn code chúng ta đặt ở vị trí nào cho phu hợp, trong trường hợp này chúng ta đặt ở vị trí trước khi kết thúc tag FORM, nghĩa là dùng hàm RegisterStartUpScript, thì mọi chuyện được giải quyết êm xui.

Chúc các bạn thành công.

Những cách viết hay JavaScript trong SharePoint - Phần 2

2) Overload / overwrite

Chúng ta rất thường sử dụng các sự kiện của window và document, ví dụ như window.onload, document.onload... Đôi khi chúng ta viết riêng thì code chúng ta chạy rất tốt, nhưng khi nhúng vào 1 web site có sẵn thì chúng không chạy được hoặc một số chức năng có sẵn của web đó không chạy được, chúng ta không biết vì sao...

Thật ra khi chúng ta viết code JavaScript, độ ưu tiên là code cuối cùng được khai báo trong trình duyệt, do vậy để code có sẵn của web chạy được và code của chúng ta cũng chạy được chúng ta nên viết như sau:

1) backup lại hàm đã có
2) kiểm tra có tồn tại hay không
3) overwrite lại sự kiện đó
4) gọi lại các hàm đã backup và hàm của chúng ta

Ví dụ: trong ví dụ này chúng ta giả sữ trong window.onload chúng ta cần làm một số việc và để trong hàm wOnload.


function wOnload()
{
//TODO: làm cái gì đó đi cho vui cửa vui nhà
}

var oldF = window.onload; //backup lại hàm cũ nha
if (oldF && typeof oldF == "function")
{
//Nếu có ai đó đã định nghĩa sẵn window.onload thì nó sẽ nhảy vào đây
window.onload = function(e) {
oldF(); // Gọi hàm người ta cho nó thực thi
wOnload(); // rồi thực thi hàm của mình
}
}
else {
//Nếu không có ai định nghĩa thì quất hàm của mình luôn
window.onload = wOnload;
}

Những cách viết hay JavaScript trong SharePoint

Bài viết này xin giới thiệu cho các bạn cách chúng ta viết Code JavaScript sao cho tốt nhất và ít đụng chạm đến code của người khác.

Đôi khi chúng ta viết code JavaScript mà để code độc lập riêng mình thì nó chạy rất tốt, nhưng khi gắn cái của mình vào những chỗ có sẵn, hoặc những có có JavaScript thì code của mình tịt ngòi, không chạy được, không rõ nguyên nhân. Vậy làm sao tránh gặp những lỗi rắc rối này?

1) Tránh giá trị Null

Đôi khi chúng ta không thể xác định được giá trị của biến mình đang dùng có bị null hay không, nhất là trong những trường hợp Corssbrowser.

Ví dụ: ở IE bạn có thể sử dụng parentElement nhưng Firefox và các trình duyệt khác không bao giờ biết parentElement là cái gì, tuy nhiên khi bạn viết parentNode thì tất cả trình duyệt đều hiểu và giá trị luôn khác null. Do đó, cách tốt nhất chúng ta nên viết là:

var pNode = this.parentElement || this.parentNode;

Hay như đối tượng event ( window.event), trình duyệt firefox không hiểu nó là cái quái gì hết, Firefox chỉ hiểu event chỉ khi nào đối tượng có xảy ra 1 sự kiện nào đó, và trong sự kiện đó lập trỉnh viên phải tự thêm một argument bất kỳ để firefox gửi đối tượng event vào trong đó.

Ví dụ:


trong JavaScript chúng ta có thể viết:

function dMouseOver()
{
var evt = window.event.srcElement;
}


Với Firefox code này bó tay, chúng ta phải viết lại




function dMouseOver(e)
{
var evt = e.srcElement;
}


Như vậy trong 2 cách viết đó, chúng ta phải gộp lại thành 1 code chuẩn duy nhất mà có thể chạy trên tất cả các trình duyệt




function dMouseOver(e)
{
e = e || window.event;
var evt = e.srcElement;
}

Saturday, April 17, 2010

Bamboo System Log Manager 1.2

And finally, the Bamboo System Log Manager 1.2 has been released. I had to spend a long time on this project and after many times the logic changes, my team overcome a project difficulty. What is the news and enhancements on 1.2?

1) User can view the log of any front-end remotely by using the Bamboo System Log Manager Desktop Application. We've used the REST technology to get the data over the internet and improve the speed of response very fast. From the server, all the data will be cached on front-end which hosted the Central Administration.

(REST technology can get the data through http/https and firewall-on.)

Before we the desktop application, we have to config for Bamboo Log Manager Timer Job to craw the data and store into the cache file. Of course, that makes the delay as directly. That is the limitation.

2) For the Web UI, we had supported 2 functions to connect to log source directly.
- If we use the Web UI before saving the setting for Bamboo Timer Job,  Web UI will access to all logs by Application Pool account. If AP account does not belogs to Local Admin, Web UI will response the error like "Access denied" on IIS and Security log.
- After user save the setting page, Web UI will connect to IIS and security log by access account. This account have enough the rights to access all resources on all front-ends.

To download the trial, click here

Thursday, February 4, 2010

God Bless The U.S.A

Tình cờ một người bạn ở công ty hỏi có biết bài hát trong vở kịch Mong Chờ (do Quang Minh và Hồng Đào) đóng hay không, lúc đó mình cũng cảm thấy bài này giai điệu rất hay, nhưng thú thật mình chưa xem vở kịch này bao giờ nên trả lởi là không biết. Rồi bạn mình gửi cho mình xem, thì mới thấy vở kịch hết sức cảm động. Vở kịch nói về 2 ông bà có 2 người con trai đi lính chỉ vì muốn được làm chính mình chứ không muốn núp vào cái bóng quá lớn của cha mẹ, dù rất thương ông bà đơn chiếc, nhưng vì muốn được thể hiện vai trò của mình một cách rõ ràng nên quyết định ra đi.


Bà mẹ thì hiểu được lòng con nên phần nào người con của bà cũng thanh thản, nhưng con của người đàn ông kia đã không được cha mình thông cảm và hiểu nên cứ nghĩ đứa con ra đi mục đích cũng chỉ để trốn nợ đời (là mấy cô bồ và 1 chồng hóa đơn), nhưng người con vẫn quyết định ra đi không hẹn ngày về,... Sau 2 năm ra đi, nỗi nhớ cũng dâng trào, 2 người con quay về thăm cha mẹ của mình mà niềm vui không thể tả.

Trong vở kịch có sử dụng bài hát God Bless The U.S.A cũng nói về tâm sự của một người Mỹ cảm tạ những người lính đã hy sinh vì nước Mỹ, xin trích giới thiệu đến các bạn.
 
Nếu ngày mai, tất cả mọi thứ tôi đã dành dụm suốt cuộc đời này mất đi

Chỉ còn lại vợ hiền và con ngoan
Thì tôi phải bắt đầu lại
Tôi muốn cảm ơn tới những vì sao may mắn của tôi
Đang sống với tôi hôm nay
Vì lá cờ vẫn còn nói lên sự tự do
Và chúng không bị lấy đi
Và tôi tự hào vì là một người Mỹ
Đang sống ở một nơi mà ít ra tôi biết mình được tự do
Nhưng tôi sẽ không hề quên những người đã nằm xuống
Những người mang đến cho tôi cái quyền ấy
Và tôi sẵn sàng đứng lên
Bên cạnh bạn
Và bảo vệ những người phụ nữ cho đến tận hôm nay

Vì không có sự nghi ngờ nào về tình yêu tôi dành cho mảnh đất này
Chúa ban phước lành cho chúng ta

Từ những ao hồ của vùng Minnesota
Cho đến những ngọn đồi ở Tennessee
Băng qua những cánh đồng mênh mông của Texas
Từ bờ biển đến tận khơi xa
Từ Detroit xuống tận Houston
Và từ New York đến L.A
Đều là niềm kiêu hãnh trong mỗi trái tim người Mỹ
Đến lúc chúng ta phải đứng lên và nói rằng
Tôi tự hào là người Mỹ
(NSUT HaiBanhXeo dịch)

If tomorrow all the things were gone

I’d worked for all my life
And I had to start again
With just my children and my wife
I’d thank my lucky stars To be living here today
Cause the flag still stands for freedom
And they can’t take that away
And I’m proud to be an American
Where at least I know I’m free
But I won’t forget the men who died
Who gave that right to me
And I gladly stand up
Next to you
And defend her still today
Cause there ain’t no doubtI love this land
God bless the U.S.A

From the lakes of Minnesota
To the hills of Tennessee
Across the plains of Texas
From sea to shining sea
From Detroit down to Houston
And new york to L.A.
There’s pride in every American heart
And it’s time we stand and say
And I’m proud to be and American
Where at least I know I’m free
And I won’t forget the men who died
Who gave that right to me
And I gladly stand upNext to you
And defend her still today
Cause there ain’t no doubtI love this land
God bless the U.S.A.

Tuesday, November 24, 2009

Careers at Bamboo Solutions

1).Inside Sales (IS) Representatives are responsible for achieving sales targets for Bamboo Solutions’ family of software products and services that enhance Microsoft SharePoint. IS representatives have territory assignments that include target lists of trial buyers and/or existing customer accounts, with expectations of proactively identifying new sales opportunities, explaining the specific business value, and closing sales. The Inside Sales Person for Europe will spend approximately 50% on answering inbound sales opportunities and should be prepared to spend 50% on outbound sales and account management. The position will also require that the IS Rep Europe become personally knowledgeable on the use of Bamboo products.


Core job functions include:



Proactively engage in developing and qualifying selling opportunities within territory assignment.
Collaboratively establish/define buying objectives and or requirements with information technology executives, managers and project managers.
Help prospects to develop a buying vision and to understand where Bamboo products and services can deliver value in their business.
Handle pre-sales inquiries about products and assist customers during their 30 day trial.

Collaborate effectively with other functional groups within Bamboo Solutions as required in the selling process.
Develop proposals and quotations as required within the selling process.
Document all required information in Bamboo’s CRM database.
Build, maintain, and forecast a pipeline of opportunities in accordance to sales management guidelines.
Produce contracted business that meets or exceeds quarterly/annual quota guidelines.
Limited travel as approved by sales management.

Qualifications:


Bachelor’s degree
3+ year of B2B experience selling software
Technical knowledge of Microsoft SharePoint preferred
Proficient with MS Office and MS CRM
Excellent oral and written communications skills
Strong Multi-lingual preferred

----------------------------------
2). The Pre-Sales Support Representative is responsible for supporting the Sales team in achieving sales targets for Bamboo Solutions' collection of SharePoint products and services. The Pre-Sales Support Representative will provide timely and high quality responses to technical product inquiries. This includes troubleshooting problems over the phone, through modem/VPN access or via web conferencing. This person will also identify recurring problems, create service notes and training and application notes, as required. The Pre-Sales Support Representative will provide product demonstrations via the web and in person.


Qualifications:

Bachelors degree preferred
1-2 yrs of technical software sales support
Excellent written and verbal communication skills
Strong customer service orientation with the ability to convey technical concepts to non-technical users.
Proficient using and administering SharePoint WSS and MOSS 2007 implementations
Ability to analyze and troubleshoot web server errors
Experience using and troubleshooting IIS, Exchange, AD and/or SQL Server.

-----------------------------------------------
3). Bamboo is seeking an individual to join our team as a Technical Support Engineer to assist customers with the issues they encounter with Bamboo products. The Support Engineer will primarily communicate with customers through an email/ticket system, as well as phone or Live Meetings when necessary. Technical Support staff also have means of conferring with our developers directly in working issues through to resolution.


Qualifications:

Bachelors in engineering, technology, computer science or related field. MBA or equivalent training a plus.
Candidates must have experience with SharePoint's MOSS and/or WSSv3, knowledge of IIS, great communication skills, and work well in a small team environment.
Excellent written and verbal communication skills
Strong customer service orientation with the ability to convey technical concepts to non-technical users.
Ability to analyze and troubleshoot web server errors
Experience using and troubleshooting IIS, Exchange, AD and/or SQL Server.