I want to create google map using a pre-defined set of bounds.
So instead of the usual:
var map = new GMap2(document.getElementById('map'));
map.setCenter(new GLatLng(0,0),5);
I want to do something like:
var map = new GMap2(document.getElementById('map'));
map.setBounds(new GLatLng(10,10), new GLatLng(20,20));
Is this possible?
Yes, see below:
var map = new GMap2(document.getElementById('map'));
var bounds = new GLatLngBounds(new GLatLng(10,10), new GLatLng(20,20));
map.setCenter(bounds.getCenter());
map.setZoom(map.getBoundsZoomLevel(bounds));
Related
I have a custom aspect, and I'm trying to update it's property through OpenCMIS with CmisExtensionElement.
Currently, I'm able to update custom properties having type String with following codes:
CmisExtensionElement extension = new CmisExtensionElementImpl(namespace, "value", null, String-value);
Question is, how will I able to update custom aspect having property with type datetime, as I'm not able to pass in other than string? (If I convert date object into a string, and pass it on, it throws an error...)
Judging by this : https://chemistry.apache.org/docs/cmis-samples/samples/properties/
You should probably use something like :
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("my:dateVar1", new GregorianCalendar());
// OR
properties.put("my:dateVar2", new Date());
// update
cmisObject.updateProperties(properties);
Here is an example of code provided by Jeff Potts that shows how to do it: https://gist.github.com/jpotts/6136702
I am working on search functionality for a website designed through umbraco. I am using Examine to fetch the search results. Here is my code:
var Searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
var searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or);
var query = searchCriteria.Field("tags", searchTerm.Fuzzy(0.5f)).Compile();
var searchResults = Searcher.Search(query);
With this method i can only get the nodes in which the search term belongs.But I want to directly fetch the whole value from the property.
I want to know what is the fastest way to fetch all the values from the same property in all the nodes.
I have finally managed to get the values directly from the property.This is the code I have used:
List<string> nodesList = new List<string>();
var Searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
var searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or);
var query = searchCriteria.Field("tags", queryString.Fuzzy(0.5f)).Compile();
var searchResults = Searcher.Search(query);
foreach (var item in searchResults)
{
string paths = ((Examine.SearchResult)item).Fields["tags"];
nodesList.Add(paths);
}
using ((Examine.SearchResult)item).Fields["tags"] gets the property value directly.
If you want to costumize your search you need to define a new index set with the properties that you actually want to search on the /config/examineIndex.config file.
Quite well explained in this post.
I have added a custom property for members and would like to create a routine that loops through all the members and initializes the custom property.
Im using Ektron Version 8.5 sp1
Here are the two methods that I have tried:
Method 1 - This method does not return the userData object
var userManager = new Ektron.Cms.Framework.User.UserManager(Ektron.Cms.Framework.ApiAccessMode.Admin);
var userData = userManager.GetItem(userManager.UserId, true);
userData.CustomProperties["Year 7 Year"].Value = newYear7Year;
userManager.Update(userData);
Method 2 - Im concerned this won't work because I don't specify the ApiAccessMode to be Admin
var commonApi = new Ektron.Cms.CommonApi();
var userApi = new Ektron.Cms.API.User.User();
var userData = userApi.GetUser(commonApi.UserId, false, false);
userData.CustomProperties["Year 7 Year"].Value = newYear7Year;
userApi.UpdateUser(userData);
How should I update the Member?
I have custom properties that I update. I update them when the user creates an account but I don't think this is any different.
I don't use the CommonApi.
Here is the basics of what I do:
Ektron.Cms.API.User.User userApi = new Ektron.Cms.API.User.User();
Ektron.Cms.UserData userData = userApi.GetUser(PUT_USER_ID_HERE);
userData.CustomProperties[keyName].Value = value;
userApi.UpdateUser(userData);
The value of PUT_USER_ID_HERE determines which user will be updated.
I didn't need to do anything special with an Admin User or anything like that so hopefully it won't be a problem for you either.
I have some properties in my viewmodel. At runtime I need to add one more property into that viewmodel.
For example:
var avm= new AnalysisViewModel();
foreach (var grades in gradeList)
{
avm = new AnalysisViewModel
{
InfractionAverage = searchResult.Where(x=>x.GradeId == grades),
//Here i want to add one move property and want to assign value for my list.
};
}
Please guide me how to achieve this requirement
Hmm try with PropertyBuilder. http://msdn.microsoft.com/en-us/library/system.reflection.emit.propertybuilder.aspx
Im reading this book but I JavaScriptSerializer from the System.Web.Script.Serialization namespace because it seems to be unavailable?
I know this a really old post but by chance someone stumbles upon this like I have, System.Web.Script.Serialization is available in System.Web.Extensions.
Download source here and add as existing project.
Then add as reference:
http://www.bloxify.com/post/MonoTouch-Easy-JSON-Library.aspx
Edit:
You may also find that the monotouch linker is pretty aggressive. I would have code work fine in the simulator but crash in the device with method missing exceptions. Add a method somewhere in your app (you dont have to call it) like so:
public void FixMonoTouchErrors()
{
var gc = new System.ComponentModel.GuidConverter();
var sc = new System.ComponentModel.StringConverter();
var dc = new System.ComponentModel.DateTimeConverter();
var cc = new System.ComponentModel.CharConverter();
var sh = new System.ComponentModel.Int16Converter();
var sh1 = new System.ComponentModel.Int32Converter();
var sh2 = new System.ComponentModel.Int64Converter();
var dec = new System.ComponentModel.DecimalConverter();
var nc0 = new System.ComponentModel.NullableConverter(typeof(Int16?));
var nc1 = new System.ComponentModel.NullableConverter(typeof(Int32?));
var nc2 = new System.ComponentModel.NullableConverter(typeof(Int64?));
var nc3 = new System.ComponentModel.NullableConverter(typeof(decimal?));
var nc4 = new System.ComponentModel.NullableConverter(typeof(DateTime?));
}