Wednesday, May 26, 2010

The List of Real Life Cheat Codes!!!!

1. Stop: Stop: Play. Skip advertisements in movies and go straight to the movie.

2. Dial 0 during most automatic menu phone systems to be taken to operator to route your call. Whenever you have a voice automated phone system, typically saying "representative" gets you someone right away.

3. When getting lectured into voice mail, hit 1, pause momentarily. If you aren't put through immediately, hit *, pause. Finally, hit # if neither 1 or * worked. It is called the 1-star-pound technique, and it works for all cell carriers.

4. At the end of your shower turn the water really (or all the way) cold. This will wake you up and get the blood flowing.

5. Macy's credit cards usually have a 20% discount on purchases. I pay with the Macy's card, and then while still at the register, I immediately pay off the charge with my debit card. I just got 20% off my purchase and I never get a credit card bill. - This also works with JCP and kohl's cards.

6. How to eliminate late movie rental fees: Acquire late fees, call and tell them you lost the movies, they wipe the fees and put the cost of the movies on your account. Bring the movies back saying you found them, they wipe the cost of the movies, and now your account is back to zero. This can work in other situations such as libraries as well.

7. Buy things out of season, this can save you money. Unless its food, then buy it in season.

8. When you have forgotten someone’s name, simply say : "I'm sorry, but what was your name one more time." They may act offended, but when they give you there first name you simply reply "No, I meant your last name." (More socially acceptable to forget). Bingo. First and last names.

9. Gently work an orange in your hands to loosen the peel from the fruit. This makes it easy enough to get the whole peel in one shot.

10. Holding your car remote up under your chin and opening your mouth increases the range you can unlock the car from.(This is a good one)

11. If you get a ticket on the windshield of your car, you can potentially get away with parking illegally in the same lot for a few more days (or at least for the remainder of that day) by keeping the ticket on your windshield.

12. Most tinfoil and saran wrap boxes have little push-in tabs on the sides. If you push them in, the roll won't fall out when you try to rip out a sheet of it.

13. If you are driving an unfamiliar car and you don't know which side the gas tank is on, just look at the little pump icon next to the gas gauge on the dashboard. The pump handle on the icon will be on the side of the tank.

14. When you park, always reverse into the parking space. It is much easier to reverse into a confined space than into a place where other people drive. You are also more alert. The chance of an accident is reduced dramatically.

15. To get through tech support quickly with an ISP, choose the option for becoming a new customer. Then when you get there ask to transfer to tech support. Usually they won't put you on hold because they see the number coming from the new customer line.

16. When you're giving a presentation, bring a bottle of water up to the podium. If you find yourself in a spot where you blank, taking a drink will allow you to gather your thoughts. Nobody will be the wiser.

17. If your paper is just a bit short of the length guidelines, do a find/replace for all your punctuation in 2 font sizes larger. The extra spacing may give you the few lines you need without changing the letter font size.

18. Sprinkle some salt on your napkin coaster at the bar. Your beer won't stick to it every time.

19. Lift yourself a little off the toilet if noise is a concern and you're having a particularly gaseous bowel movement. The volume will decrease at least 50-60%.

20. Drop a square of Toilet Paper in the toilet, it will break the surface tension and prevent splash back.

21. On most elevators, press "close door" and your floor number at the same time for express service. You will skip all floors between even if people are calling the elevator.

22. If you feel uncomfortable looking into someone's eyes when they're talking to you, look at their nose instead. They cannot tell the difference.

23. Always get in the leftmost line. Unless you're in Britain, then get in the rightmost queue. People naturally line up on the same side that they're used to driving on the road.

24. Tie a knot to one of your earphone wires right at the top, to easily distinguish from left to right.

25. When receiving a call from a solicitor, simply press 9; the call will be dropped and your phone number is then put on the companies do not call list. 95% of companies support this feature.

Source: Reddit.com

Thursday, April 8, 2010

ObjectScript Iterators in Cache Database

I found a very good blog from Phil Jones who talks in depth about the ObjectScript Iterators in his series. Here is the link to the series.
In this post he gives some background and explanations of how Caché ObjectScript programs see the database.

The Caché database is structured as sparse, multi-dimensional arrays (known as "globals") containing chunks of data in strings. Because the arrays can use strings as indexes (ie. the keys can be strings) meaningful information in a record is usually spread across both the keys and the actual value. But only keys are easy to search on. This is different from a relational database where all fields are more or less equal.

Let's create an example. A rather simplistic patient record might be stored something like this :

^Patient("general hospital",324542)=john~smith~malaria

where the hospital name is the first key, patient id is the second, and the actual data (first name, last name and disease) is encoded as sub-strings (known as "pieces" in Caché terminology)
separated by the ~ character.

Such a database structure makes it easy and very fast, to pull out data if you have all the necessary keys. To get this record from the database into a variable p :
set p = ^Patient("general hospital",324542)

It's also pretty simple to manipulate a subtree. For example there are operations which can copy an entire subtree to another variable.

merge gh = ^Patient("general hospital")

will grab all general hospital patients and put them into a subtree in the variable gh.

You can delete subtrees with

kill ^Patient("old hospital")

On the other hand, if you want to find all patients who have malaria, you have a slog. You either have to manually run through all the records checking which contain "malaria" in the disease field of the string. Or, if looking-up patients by disease is a common requirement that needs to be fast, you make a second array as a fast, searchable index, that is structured like this.

^PatientDiseaseIndex("malaria","general hospital",324542)

Iterating through these multi-dimensional arrays is "baroque" to say the least. Caché ObjectScript provides two commands : $order and $query for looping through tables.

$order takes as argument an array descriptor (name and keys), and returns the next key at the same level of hierarchy as the right-most key listed in the array expression.

To make that last sentence clearer, here's an example.

Let's suppose we have three patient records :

^Patient("general hospital",324542)=john~smith~malaria
^Patient("general hospital",324549)=martha~jones~measles
^Patient("local clinic",2323)=donna~noble~flu



Calling the $order function like this:
$order(^Patient("general hospital",324542))

will return the value 324549. Why? Because 324549 is the next key at the "patient id" level of the key indexes.

Similarly

$order(^Patient("general hospital"))

will return the string "local clinic", because here we're only giving the top-level key of ^Patient. And the next key after "general hospital" is "local clinic".

Using $order, then, it's possible to loop through each key at a particular level of the hierarchy. It also knows how to find the first key at any level; you simply pass it an empty string. So

$order(^Patient(""))

returns "general hospital", the first top level key. And

$order(^Patient("general hospital",""))

returns 324542, the first second level key below "general hospital".

When the $order runs out of keys at any particular level of a subtree, it returns an empty string.

For example,

$order(^Patient("general hospital",324549))

returns "", which signals to us that there are no patient ids after 324549 in the "general hospital" subtree.

To loop through all records in the table we have to use nested loops. Typically something like this


set hospital=""
for {
set hospital=$order(^Patient(hospital))
quit:hospital=""
set id=""
for {
set id=$order(^Patient(hospital,id))
quit:id=""
set p = $get(^Patient(hospital,id))

... do something with patient p
}
}

it's a huge performance! Especially when you come from the sort of language where you're used to being able to write something like this :


for p in Patient {
... do something with patient p
}

But the problem is far more pernicious than simple verbosity. This code hardwires a great deal of commitment to the particular database structure. Let's suppose we realize at a later date that we really need to add a third key to Patients. For example, our hospital network expands into a neighbouring state and we now need to support a new structure :

^NewPatient(region,hospital,id)

Migrating the existing data is a bit of work. But now every single place in the code that loops through patients looking for records that match some criteria will have to be rewritten as well!

The alternative iterating function $query offers some help. But has its own bizarre qualities.

Like $order, the $query function takes an array name and keys. But it returns a string which contains the full array access expression of the next item regardless of the level of hierarchy. So

$query(^Patient("general hospital",324542))

will return a string containing "^Patient("general hospital",324549)"

This can then be evaled in the next statement. ObjectScript has an @ operator for eval, so we loop through the array like this.

set q=$query(^Patient)
for {
if q '= ""
{
set p = @q
... do something with patient p
}
set q=$query(@q)
quit:q=""
}


As before, there's a way to get at the first record - the $query(^Patient), and when $query returns "" we've reached the end.

This is somewhat of an improvement in that we're back to one loop. And it would still work if we moved to a new structure for ^Patient. It's a minor inconvenience that we've got ourselves into a "for" which only tests for the exit condition at the end of the loop body so we need an extra test that q isn't "" for the actual "do something" part.

The bigger concern is that we've now lost our keys. The value of q is going to be something like "^Patient("general hospital",324549)" while the value of p is "martha~jones~measles". If, in the "do something", I want to know what hospital we're talking about I'm going to have to cut up the string q to extract it. That's a bit painful.

Friday, September 18, 2009

Random thoughts from people our age

1. I wish Google Maps had an “Avoid Ghetto” routing option.

2. Nothing sucks more than that moment during an argument when you realize you’re wrong.

3. More often than not, when someone is telling me a story all I can think about is that I can’t wait for them to finish so that I can tell my own story that’s not only better, but also more directly involves me.

4. Have you ever been walking down the street and realized that you’re going in the complete opposite direction of where you are supposed to be going? But instead of just turning a 180 and walking back in the direction from which you came, you have to first do something like check your watch or phone or make a grand arm gesture and mutter to yourself to ensure that no one in the surrounding area thinks you’re crazy by randomly switching directions on the sidewalk.

5. Sometimes I’ll look down at my watch 3 consecutive times and still not know what time it is.

6. Sometimes, I’ll watch a movie that I watched when I was younger and suddenly realize I had no idea what the f was going on when I first saw it.
7. I would rather try to carry 10 plastic grocery bags in each hand than take 2 trips to bring my groceries in.

8. The only time I look forward to a red light is when I’m trying to finish a text.

9. LOL has gone from meaning, “laugh out loud” to “I have nothing else to say”.

10. How many times is it appropriate to say “What?” before you just nod and smile because you still didn’t hear what they said?

11. While driving yesterday I saw a banana peel in the road and instinctively swerved to avoid it…thanks Mario Kart.

12. Shirts get dirty. Underwear gets dirty. Pants? Pants never get dirty, and you can wear them forever.

13. I can’t remember the last time I wasn’t at least kind of tired.

14. Why is it that during an icebreaker, when the whole room has to go around and say their name and where they are from, I get so incredibly nervous? Like I know my name, I know where I’m from, this shouldn’t be a problem….

15. You never know when it will strike, but there comes a moment at work when you’ve made up your mind that you just aren’t doing anything productive for the rest of the day.

16. I’m always slightly terrified when I exit out of Word and it asks me if I want to save any changes to my ten page research paper that I swear I did not make any changes to.

17. I hate when I just miss a call by the last ring (Hello? Hello? Dammit!), but when I immediately call back, it rings nine times and goes to voicemail. What’d you do after I didn’t answer? Drop the phone and run away?

18. I like all of the music in my iTunes, except when it’s on shuffle, then I like about one in every fifteen songs in my iTunes.

19. Why is a school zone 20 mph? That seems like the optimal cruising speed for pedophiles…

20. I keep some people’s phone numbers in my phone just so I know not to answer when they call.

21. Even under ideal conditions people have trouble locating their car keys in a pocket, , and Pinning the Tail on the Donkey - but I’d bet everyone can find and push the Snooze button from 3 feet away, in about 1.7 seconds, eyes closed, first time every time…

22. It really pisses me off when I want to read a story on CNN.com and the link takes me to a video instead of text.

23. I wonder if cops ever get pissed off at the fact that everyone they drive behind obeys the speed limit.

24. I think the freezer deserves a light as well.

25. I disagree with Kay Jewelers. I would bet on any given Friday or Saturday night more kisses begin with Miller Lites than Kay.

Original Post : Reddit

Wednesday, December 3, 2008

Programmatically customize site navigation in WSS 3.0 and MOSS 2007 - By Todd Baginski

I am summarizing one beautiful article from Todd about Adding/Updating/Deleting Navigation Items in sharepoint.

Here is an example of how to set a sub site not to use the navigation from a parent’s site.

SPSite noSharedNavSite = new SPSite(“http://server/test/nosharednav”);
SPWeb noSharedNavWeb = noSharedNavSite.OpenWeb();
noSharedNavWeb.Navigation.UseShared = false;
QuickLaunch Menu Items
Here is how you add a menu item to the QuickLaunch navigation menu.
These QuickLaunch examples assume you have created a top level site named quicklaunch.
Once this top level site has been created its URL will look like this: http://server/quicklaunch
In this example we will add two links to the QuickLaunch menu for the quicklaunch
top level site, one link will be internal and one will be external. The internal
link will point to the Links list in the QuickLaunch site. The external
link will point to the SharePoint Experts web site.

SPSite quickLaunchSite = new SPSite(“http://server/quicklaunch”);
SPWeb quickLaunchWeb = quickLaunchSite.OpenWeb();
SPNavigationNodeCollection quickLaunchNodes = quickLaunchWeb.Navigation.QuickLaunch;
SPNavigationNode internalMenuItem = new SPNavigationNode(“Links”, “Lists/Links/AllItems.aspx”, false);
quickLaunchNodes.AddAsFirst(internalMenuItem);
SPNavigationNode externalMenuItem = new SPNavigationNode(“SharePoint Experts”,
“http://www.SharePointExperts.com”, true);
quickLaunchNodes.AddAsFirst(externalMenuItem);
quickLaunchWeb.Update();
*Note: If you do not call the Update() method on the SPWeb object you are working
with, you will need to reset IIS to see your changes.
Here is what the quicklaunch Site Collection looks like after the above code has
been executed:

Here is how you remove a menu item from the QuickLaunch navigation menu.
In this example we will remove the external link to the SharePoint Experts web site.
SPSite quickLaunchSite = new SPSite(“http://server/quicklaunch”);
SPWeb quickLaunchWeb = quickLaunchSite.OpenWeb();
SPNavigationNodeCollection quickLaunchNodes = quickLaunchWeb.Navigation.QuickLaunch;
quickLaunchNodes.Delete(quickLaunchNodes([0]));
quickLaunchWeb.Update();
Here is what the quicklaunch Site Collection looks like after the above code has
been executed:

Taking the QuickLaunch menu one step further
The QuickLaunch menu is capable of displaying links in a grouped fashion, as you see
in the screenshot above. For example, the Lists menu item in the screenshot
above has two items under it – the Calendar and Tasks links. Creating your own
grouped links can be done programmatically. This is once again a simple process
that requires very little code.
Here is how you add grouped menu items to the QuickLaunch navigation menu.
In this example create a header link for the group of links and name it
Administration. Then we will add two links under the Administration header link.
The links will link to the Create and Site Settings pages for the
quicklaunch Site Collection.
SPSite quickLaunchSite = new SPSite("http://" + serverTextBox.Text + "/quicklaunch");
SPWeb quickLaunchWeb = quickLaunchSite.OpenWeb();
SPNavigationNodeCollection quickLaunchNodes = quickLaunchWeb.Navigation.QuickLaunch;
SPNavigationNode internalMenuItem = new SPNavigationNode("Administration", "", false);
quickLaunchNodes.AddAsFirst(internalMenuItem);
SPNavigationNode externalSubMenuItem1 = new SPNavigationNode("Site Settings",
quickLaunchWeb.Url + "/_layouts/settings.aspx", true);
quickLaunchNodes[0].Children.AddAsFirst(externalSubMenuItem1);
SPNavigationNode externalSubMenuItem2 = new SPNavigationNode("Create",
quickLaunchWeb.Url + "/_layouts/create.aspx", true);
quickLaunchNodes[0].Children.AddAsFirst(externalSubMenuItem2);
quickLaunchWeb.Update();
Here is what the quicklaunch Site Collection looks like after the above code has
been executed:
href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh3aWGZatNNPic81FuwQVmNATKvSvkVtj6RMQ94JG2Whd1KpfbTYPGK9Fafv_qg2R4QWFmlYO2MGT6GkMs-aCwqZQt3yZEBkO_RF_7wuTIjrfSKCfYCwFg-hZl83DV7drFe0V19OuA3BCx/s1600-h/sitenav7.jpg">
Top Navigation Menu Items

SPSite topNavigationSite = new SPSite(“http://server/topnavigation”);
SPWeb topNavigationWeb = topNavigationSite.OpenWeb();
SPNavigationNodeCollection topNavigationNodes =
topNavigationWeb.Navigation.TopNavigationBar;
SPNavigationNode internalMenuItem = new SPNavigationNode(“Links”, “Lists/Links
/AllItems.aspx”, false);
topNavigationNodes.AddAsFirst(internalMenuItem);
SPNavigationNode externalMenuItem = new SPNavigationNode(“SharePoint Experts”,
“http://www.SharePointExperts.com”, true);
topNavigationNodes.AddAsFirst(externalMenuItem);
topNavigationWeb.Update();
Here is what the topnavigation top level site looks like after the above code has
been executed:

Here is how you delete a menu item from the top navigation menu. In this example we
will remove the Links link we just added to the top navigation menu for the
topnavigation top level site.
SPSite topNavigationSite = new SPSite(“http://server/topnavigation”);
SPWeb topNavigationWeb = topNavigationSite.OpenWeb();
SPNavigationNodeCollection topNavigationNodes =
topNavigationWeb.Navigation.TopNavigationBar;
topNavigationNodes.Delete(topNavigationNodes[0]);
topNavigationWeb.Update();
Here is what the topnavigation top level site looks like after the above code has
been executed:

Taking the Top Navigation one step further
The top Navigation menu is capable of displaying dropdown menus that consist of
multiple items. Adding additional sub menu items under the topmost item is a
simple process and requires very little code.
Here is how you add a sub menu item to a top level menu item in the top navigation
menu. In this example we will add a new top level menu item to the top
navigation menu that has two sub menu items under it for the topnavigation top
level site.
SPSite topNavigationSite = new SPSite(“http://server/topnavigation”);
SPWeb topNavigationWeb = topNavigationSite.OpenWeb();
SPNavigationNodeCollection topNavigationBarNodes =
topNavigationWeb.Navigation.TopNavigationBar;
SPNavigationNode headerMenuItem = new SPNavigationNode("SharePoint Sites", "",
false); topNavigationBarNodes.AddAsFirst(headerMenuItem);
SPNavigationNode externalSubMenuItem1 = new SPNavigationNode("SharePoint Experts",
"http://www.SharePointExperts.com", true);
topNavigationBarNodes[0].Children.AddAsFirst(externalSubMenuItem1);
SPNavigationNode externalSubMenuItem2 = new SPNavigationNode("SharePoint
University", "http://www.SharePointU.com", true);
topNavigationBarNodes[0].Children.AddAsFirst(externalSubMenuItem2);
topNavigationWeb.Update();
Here is the code used to add the links:

SPSite topNavigationSite = new SPSite(“http://server/topnavigation”);
SPWeb topNavigationWeb = topNavigationLaunchSite.OpenWeb();
SPNavigationNodeCollection topNavigationBarNodes =
topNavigationWeb.Navigation.TopNavigationBar;
SPNavigationNode headerMenuItem = new SPNavigationNode("Administration", "", false);
topNavigationBarNodes.AddAsFirst(headerMenuItem);
SPNavigationNode externalSubMenuItem1 = new SPNavigationNode("Site Settings",
topNavigationWeb.Url + "/_layouts/settings.aspx", true);
topNavigationBarNodes[0].Children.AddAsFirst(externalSubMenuItem1);
SPNavigationNode externalSubMenuItem2 = new SPNavigationNode("Create",
topNavigationWeb.Url + "/_layouts/create.aspx", true);
topNavigationBarNodes[0].Children.AddAsFirst(externalSubMenuItem2);
topNavigationWeb.Update();


Link to Original Article

Tuesday, October 7, 2008

SharePoint Tip - Shortcut to 12 hive with ease

I have to go to 12 Hives from command prompt so often that i looked for a better
solution to reach there . Here is what you have to do:
(1) Create a new text file in notepad and write the path to 12 hives like this :
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12
(2) Save the file as 12.cmd
(3) Copy the file and put it inside c:\Windows folder
(4) Job done... from anywhere in command prompt as soon as you press 12 , you get to
12 hives of sharepoint..
;)

Friday, October 3, 2008

Creating a Scope and Tab for MOSS Search Center -By : Scot Hillier

I found a good article from Scot About Creating a Scope and Tab for MOSS Search
Center. Here is a direct link to the Article : Click Here

Create the new Search Center Tab


New tabs for Search Center involve several different parts. First, you must create a
search page. Then you must create a search results page. Finally, you must
associate the scope with the new pages and create tabs to display them. Follow
these steps to get it all working:

1. From the Search Center page, select Site Actions>>Create Page

2. On the Create Page

- Enter HR Documents Search in the Title field
- SharePoint should automatically generate a valid page name
- Select "Search Page" from the list of available Page Layouts
- Click the Create button

3. A new page should now be visible with a Search Box web part

- Select Modify Shared Web Part from the web part's edit menu
- Expand the Miscellaneous section
- Enter HRDocumentsResults.aspx in the Target Search Results Page URL field
(you will create this page next)
- Uncheck the box labeled "Display Advanced Search Link"
- Click the OK button
- Click the Publish button at the top of the page

4. From the new page, select Site Actions>>Create Page

5. On the Create Page

- Enter HR Documents Search Results in the Title field
- SharePoint should automatically generate a valid page name
- Select "Search Results Page" from the list of available Page Layouts
- Click the Create button

6. A new page should now be visible with a several search web parts

- Select Modify Shared Web Part from the Search web part's edit menu
- Expand the Miscellaneous section
- Enter HRDocumentsResults.aspx in the Target Search Results Page URL field
- Uncheck the box labeled "Display Advanced Search Link"
- Click the OK button
- Select Modify Shared Web Part from the Search Core Results web part
- Expand the Miscellaneous section
- Enter HR Documents in the Scope field
- Click the OK button
- Click the Publish button at the top of the page

7. From the new page, select Site Actions>>View All Site Content

8. On the All Site Content page, click the "Tabs in Search Pages" link

9. On the Tabs in Search Pages list, click the New button

10. On the New Item page

- Enter HR Documents in the Tab Name field
- Enter HRDocumentsSearch.aspx in the Page field
- Click the OK button

11. From the list, select Site Actions>>View All Site Content

12. On the All Site Content page, click the "Tabs in Search Results" link

13. On the Tabs in Search Results list, click the New button

14. On the New Item page

- Enter HR Documents in the Tab Name field
- Enter HRDocumentsSearchResults.aspx in the Page field
- Click the OK button

Return to the Search Center home page and you should now see a new tab visible for
HR Documents.

Migrating Site / SubSite / Content and Content Deployment Tool from Chris O' Brien

If you came across situation like these :
* I just need to move this document library from A to B
* I just need to move these selected files (e.g. master page, page layouts, CSS

etc.) from A to B
* I just need to move this web from A to B
* I just need to move this site collection from A to B
* I just need to move these 20 list items from A to B

Then Chris O'Brien is here for rescue.
I know there are other 2 methods to accomplish the same task :

(1) Using Sharepoint designer tool to Backup and restore the site
(2) Stsadm.exe command line tool

The only thing i dint like about these two methods is the limitation of what you can migrate.
Sharepoint designer allows site migration of size with 25 MB or below. Also Both methods
want you to create an empty site before export of data.
Then I found a very handy tool for migrating my stuff from one site collection to another. This
tool designed by Chris O' Brien is so Cool, The migration of Stuff becomes so so easy. It is
a must see tool for all SharePoint Developer. The new and better 1.1 version is released
in CodePlex , This time he has Provided the Code of the Content Deployment Wizard as
well.
You Can Learn about the Product Here
You can learn on product operation Here
You can directly download the latest Version of Product as well as the source code Here

Job done with little pain ;)

RootComponent types in solution.xml file in Dynamics CRM 365/2016

In Microsoft Dynamic CRM 2016/365 are you as confused as me when looking at the solution.xml from the solution export? looking at the xml a...