CHUVASH.eu
  • About
  • Search

Posts

May 13, 2012

javascript toolkit on text file

Referencing javascript libraries from Content Delivery Networks (CDN) like jQuery can have many benefits. The self-hosted javascript files are on the other hand give you more control. But in one situation it is much better with cdns: the development. Like Marc D Anderson pointed:

I didn’t realize it at the time, but this txt file has become a standard part of my toolkit already. I’ve added it to three client environments just since last week. It’s the A #1 fastest way to get something up and running, even if you know you’re going to host the files locally later.

read more
May 11, 2012

jQuery mobile and SharePoint

In this post I want to explore how to build a mobile app using jQuery mobile. Recently I discovered two great blog posts about this:

  1. Building SharePoint web apps using Sencha Touch by Luc Stakenborg
  2. jQuery mobile and SharePoint by Chris Quick

In my post I’ll use their findings and share some of mine thougts. I’ll focus mostly on how to get started with jQuery mobile and SharePoint. So go ahead and create your jQuery mobile app, just drag’n’drop some controls: Download it and yout get an “app.html” file and “my.css”. For now ignore my.css. app.html is something like that:

read more
May 11, 2012

Install android sdk and eclipse in Ubuntu 12.04

Download and unpack the Android SDK, move it to your home folder. I prefer to set a point in front of the directory folder to make it be hidden so that my home directoy still looks tidy: .android-sdk-linux. Then add this to your path:

export PATH=${PATH}:~/.android-sdk-linux/tools:~/.android-sdk-linux/platform-tools

.android-sdk-tools is for running android command, and .android-sdk-tools/platform-tools is for running adb command And add it to your .bashrc-file so that this path is loaded automatically when you log on.

read more
April 21, 2012

Android: Asynchronously download images

In the Malmöfestivalen for Android where I participate we wanted to show thumbnails of events in lists. We have urls of thumbnails from Malmofestivalen API. This information is stored in a sqlite database and a SimpleCursorAdapter is used for getting the events from the database. It is possible to bind the urls to ImageView objects (by downloading the stream: 1, 2, 3). The problem is in a listactivity with many images it will freeze. So it must be an AsyncTask, and it should be some kind of local cache to avoid loading same images over and over again. Fortunately there is already ImageDownloader class provided in the android blog post: Multithreading For Performance . The next step is to create custom adapter and extend from SimpleCursorAdapter: EventCursorAdapter, like described on Android-er and and SP-Technolab: [sourcecode language=“java”]public class EventCursorAdapter extends SimpleCursorAdapter { private final ImageDownloader imageDownloader = new ImageDownloader(); public EventCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { super(context, layout, c, from, to); imageDownloader.setMode(ImageDownloader.Mode.NO_DOWNLOADED_DRAWABLE); } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = super.getView(position, convertView, parent); Cursor cursor = getCursor(); cursor.moveToPosition(position); ImageView iv = (ImageView) row.findViewById(R.id.eventitemrowimage); String url = cursor.getString(cursor.getColumnIndex(EventProvider.EVENT_KEY_URISMALLIIMAGE)); if (url.length() > 0) { imageDownloader.download(url, iv); } String start = cursor.getString(cursor.getColumnIndex(EventProvider.EVENT_KEY_STARTDATE)); String end = cursor.getString(cursor.getColumnIndex(EventProvider.EVENT_KEY_ENDDATE)); String dateString = DateHelper.createShortDateResume(start, end); TextView tv = (TextView) row.findViewById(R.id.eventitemrowtimeresume); tv.setText(dateString); return row; } }[/sourcecode] In this code the view is created by the super class and then it is modified, the alternative is to “inflate the view” completely self. The result is an event list which opens directly and loads thumbnails asynchronously: listactivity with images

read more
April 21, 2012

Implement public wcf service in SharePoint

If you have an external web service reference in your sharepoint solution, you can use web.config configuration like:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding\_ISuperService" >
                <security mode="None">
                    <message clientCredentialType="None" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://super.domain/SuperService.svc"
            binding="wsHttpBinding"
            bindingConfiguration="WSHttpBinding\_ISuperService" 
            contract="ISuperService"
            name="SuperServiceEndpoint">
        </endpoint>
    </client>
</system.serviceModel>
```security mode is set to "None". Then in code just get this configuration:

var proxy = new SuperServiceClient(“SuperServiceEndpoint”); var result = proxy.GetSomething();

var binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.None; var endpoint = new EndpointAddress(“http://super.domain/SuperService.svc"); var proxy = new ExternalServices.DreamServiceClient(binding, endpoint); var result = proxy.GetSomething();

read more
April 10, 2012

Creating custom powershell cmdlet

Why

I need to to activate a feature in PowerShell and specify some properties. Simple? Yes. Possible? No. In the default Enable-SPFeature cmdlet you can’t specify any properties:

Enable-SPFeature –Identity "b5eef7d1-f46f-44d1-b53e-410f62032846" -URL http://dev

We can of course easily add properties when activating features in onet.xml:

<!-- Publishing Resources -->
<Feature ID="AEBC918D-B20F-4a11-A1DB-9ED84D79C87E">
  <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
    <Property Key="AllowRss" Value="false" />
    <Property Key="SimplePublishing" Value="false" />
  </Properties>
</Feature>

So I went to SharePoint StackExchange and asked the question. Then I realized: the standard Sharepoin API doesn’t support this neither. The methods of SPFeatureCollection which have SPFeatureProperties as parameter are internal. So the only way is to use Reflection like Hristo Pavlov (2008) and Yaroslav Pentsarsky (2010) suggest. So why not to try to create a cmdlet?

read more
April 10, 2012

Out-Gridview in PowerShell

Did you know that we can pipe the output from PowerShell into a graphical GridView? I have used PowerShell for one year and only now I discovered this nice feature. You can add filter criteria, you can filter by typing in a textbox:

Other useful output cmdlets
  • out-file
  • out-clip
  • out-null
read more
April 10, 2012

ResxCrunch: Localization tool

If your solution has two or more languages to support, I can recommend an open source tool ResxCrunch. Btw, you can even use ResxCrunch for localization of Android applications.

read more
April 9, 2012

Run powershell remotely

To run powershell remotely is really easy. First enable it on the machine which will receive the remote commands:

Enable-PSRemoting

Then go to another machine and connect to your host:

$cred = Get-Credential
Enter-PSSession -Computername dev -Credential $cred

If you want to know more about powershell remoting, I recommend “A layman’s guide…”. See even a detailed example on poshcode.

read more
April 4, 2012

Access User Profile Properties from Powershell

To use only SPUser objects isn’t always sufficient. To get other properties we have to retrieve user profiles. Giles Hamson gives an example how to get and how to update user profile properties with powershell. Here is an example how to get all work phones:

$url = "http://intranet/"
$site = Get-SPSite $url
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profiles = $profileManager.GetEnumerator()

while ($profiles.MoveNext()) {
  $userProfile = $profiles.Current
  $name = $userProfile.DisplayName
  $phone = $userProfile\["WorkPhone"\]
  $line = '{0};{1}' -f $name, $phone
  write $line
}

If you are not sure what properties are called, see the whole list by typing:

read more
  • ««
  • «
  • 21
  • 22
  • 23
  • 24
  • 25
  • »
  • »»
© CHUVASH.eu 2025