Posts

Showing posts from 2014

Entity Framework Common Issues

Problem: Unable to update model with new SQL View Solution:  Check the messages under Error List tab. If the message says "primary key is not defined" and "unable to infer primary key", make sure you have a primary key on the table. Simply, you may add ISNULL( ROW_NUMBER() OVER( ORDER BY ID), <value>) as PrimaryKey  to your SQL View.  *Please make sure you click "Run custom tool" http://stackoverflow.com/questions/1013333/entity-framework-and-sql-server-view Problem: Intellisense is not  working for updated model or Updating model doesn't reflect in DB Context Solution:  Please make sure you click "Run custom tool http://stackoverflow.com/questions/14161277/after-updating-edmx-model-what-about-dbcontext Problem : Duplicate rows in LINQ fetch via SQL View Solution: Make sure your inferred primary key is really unique.  Add  ROW_NUMBER() OVER( ORDER BY ID) as PrimaryKey to your SQL View http://www.itworld.com/development/...

Atlassian Confluence - Collecting Usage Metrics

Below are the scripts I used to collect usage stats from Confluence 3.5.x -- Average Number Of Edits select contenttype, min(number_of_changes), max(number_of_changes), avg(number_of_changes) from (     select contenttype, cast(lastmoddate As Date) as changedate, count(*) as number_of_changes     from content     where content.creationdate > DATEADD(year,-2,getDate()) and version=1     group by contenttype, cast(lastmoddate As Date)             ) as dates group by contenttype -- Number of users select lastmodifier,count(*) from content where lastmoddate>DATEADD(year,-2,getDate()) group by lastmodifier having count(*)>10 order by 2 desc -- New pages create in X years select contenttype, count(*) from content where lastmoddate>DATEADD(year,-2,getDate()) AND prevver is NULL group by content.contenttype -- Total number of pages SELECT COUNT(*) FROM content WHERE contenttype='PAGE' AND...

Sample code to upload a file to chatter feed using REST API

Image
Step 1: Download required files Download the following files from internet httpcomponents-client-4.2.3-bin.zip org.apache.commons.httpclient.jar From the files, I have added following JARS to my project in eclipse.    Screenshot from Ecclipse Step 2: Get Access Token Through Chrome Login to your Salesforce instance and navigate to Setup -> Create -> Apps.  Create a custom app and fill Client ID and CallBack URL (ex: http://www.google.com) in the following URL. Encode the CallBack URL before passing it as a parameter.  https:// <instance_name> .salesforce.com/services/oauth2/authorize?response_type=token&client_id= <Client_ID_Goes_Here> &redirect_uri= <CallBack_URL> Paste this URL in chrome In Developer Tool -> Network select "preserve log upon navigation" Load the page. We see below page. The page will take us to RemoteAccessAuthorizationPage.apexp which inturn will lea...

How to expand VirtualBox's Virtual Hard Disk

Image
Last month, I was trying to expand my Ubuntu 12.04 Guest OS's virtual hard disk size from 8 GB to 30 GB. After some time I realized that the process is not so straight forward. Finally I relied on two blog posts to finish my task.  As mentioned in the first article, it's important to understand the prerequisites.  Prerequisites: Make sure you have the VBoxManage command-line tool installed on your host system. Download the ISO for a  GParted Live CD  or else a  Linux Live CD  using a Linux distribution that includes the GParted partition editor utility. IMPORTANT:  If the virtual disk you want to resize is attached to a virtual machine with snapshots,  you will need to delete these snapshots  so that all disk state information is merged into the base virtual disk VDI file.  I was using VirtualBox 4.3.4.  And, I partitioned the virtual hard disk by using GParted. Somehow, Linux Live CD didn't work for me. A...

Rooting HTC Explorer a310e

Image
Step 1: Precautions Charge your phone fully. I recommend 100%. General recommendation is above 70%. Enable USB debugging on the phone. (Settings -> Applications -> USB Debugging) Install following software on your PC. If they already exist, please make sure they are up to date.  Google Android SDK zip Java Runtime HTC Sync (Windows Only) Backup data. Below are the steps I have done. But, the steps are not exhaustive. Don't neglect these steps as unlocking bootloader may delete all your personal data.   I backed up my data using HTC Sync Additionally, I backed up the entire SD Card on my local machine One useful app I found is Backup SMS Contacts  https://play.google.com/store/apps/details?id=com.idea.backup.smscontacts Step 2: Prepare Download A310E Recovery File  & Superuser.zip Get ready to unlock   your bootloader Navigate to   http://www.htcdev.com/bootloader/   Create an account In the sup...