2015年06月

CRM Package Deployer: Add data to package

I managed to make packages for Microsoft CRM 2015 with CRM Package Deployer, including different solutions and executing own C# code.



But import of data into tables failed. I used DataMigrationUtility.exe from SDK to export data from source system. But I couldn't add this data to my target CRM.



My questions:

Does anyone have some samples how to add data with CRM Package Deployer?

Format of files?

Parameters in ImportConfig.xml?

Experiences, best practices?



--> Thanks a lot!





Android: How to request inherited field via Facebook Graph API

In the below link it says video.watches has an inherited field named [image], how can I modify below code to request it (Receive it)?



https://developers.facebook.com/docs/reference/opengraph/action-type/video.watches



Bundle params.putString("fields", "data{image}");




Node.js: How to append files to a (archiverjs) zip from url

I have an object containing an array of slides. Every slide can have a media parameter containing the url to an image or video file or the link to a youtube or vimeo video.



My goal is to have the slides viewer zipped and inside the zip I also must have the image or video files taken from the urls.



To create the zip I'm currently using Archiver and it works fine, but I don't know how to put the media files inside the zip (possibly) without writing them on the filesystem first. I think I have to use streams, since archiver.append() can take a stream as first parameter, but I don't know how to do that.



I have implemented some code to understand if the url points to a file or not, writing the files' url inside an array (avoiding youtube or viemo urls).



This is how the zip is created:



...
var urls_array = ["http://url1/file1.jpg", "http://url2/file2.png"]; //the array of urls I take the media files from

var zip = archiver('zip');
zip.pipe(res);

zip.directory(__dirname + '/../../zip/', 'slideshow');
zip.append( new Buffer( file ), { name: 'slideshow/assets/slides.json' });
zip.finalize();


I suppose I have to cycle the url_array and for each url perform a http.get() call, but I can't understand how to .pipe() the response inside the zip.



Is there anyone who can help me?
Don't hesitate to ask me more information :)



Thank you in advance.



Answers

You should use the request method to create a stream from a remote URL to be passed to the append function of archiver, as a first argument, like this:



for ( var slide in slides ) {
archive.append( request( slide.url ), { name: slide.name } );
}


see archiver.append documentation ( https://github.com/archiverjs/node-archiver#appendinput-data )



Hope it helps.





WPF + EF: binding an entity and track changes from different contexts

I have a WPF application using Entity Framework and two views:




ProductsListView
ProductEditView


Considering the following scenario:




The ProductListView is opened: a DbContext is instantiated, the product list is filled and the DbContext is closed.
The user selects a product and click in the edit button.
The ProductEditView is opened: a DbContext is instantiated, the product is loaded by its ID, the fields are filled and the DbContext is closed.
The user changes the fields and click in the save button: a DbContext is instantiated, the product is loaded by its ID, the changes are applied and the DbContext is closed.


How the selected product's bindings in the product list would be notified?





In a memory context:




I just pass the product object from the ProductListView to the ProductEditView,
I bind the fields to the ProductEditViewModel properties,
When the save button is clicked, I update the product reference.


Since it's the same reference I don't need to do anything to the product list
be updated.





I don't see how I could do the same thing using EF context.



Any sugestions?



Answers

In EF Context, I would suggest you keep the DbContext across all 4 actions. This will save you a lot of hastle.



Not unless your products data is very large and you only retrieve the title and id lets say in initial list fetch, then keep the same DbContext open from time they open EditView till they close it. And if they save, EF will find the changes.



It finds changes by comparing the values it retrieved from database, to the values currently set to the entity. By closing the entity context, you are getting rid of the OriginalValues.





Android Build failed at ':app:dexDebug' with exception ( library and app project )

I am using some third party libraries in my library project.
The following is my library project build.gradle



apply plugin: 'com.android.library'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//dexOptions {
// javaMaxHeapSize "4g"
//}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
productFlavors {
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.adobe.creativesdk:image:4.0.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
repositories {
jcenter()

mavenCentral()

maven {
//url "${project.rootDir}/mobilexpresslib/creativesdk-repo"
url "${project.projectDir}/creativesdk-repo"
//java.lang.System.println(${project(':mobilexpresslib').projectDir});
// println "[$project.rootDir]"
println "[$project.projectDir]"

// url "${project(':mobilexpresslib').projectDir}/creativesdk-repo"
//ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
}
}


The following is my app build.gradle



apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.dgflick.mxpro.mobilexpresspro"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {

exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
productFlavors {
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':mobilexpressprolib')
}
repositories {
jcenter()

mavenCentral()

maven {
//url "${project.rootDir}/creativesdk-repo"
//ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
url "${project(":mobilexpressprolib").projectDir}/creativesdk-repo"
}
}


After today's update of Android Studio with Android SDK, I am getting the following error.



UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_71\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED


I have updated the 'compile' lines in library build.gradle to the latest one.



After searching other links, still I could not find the problem. It is possibly related to the version of library or multiple occurrence of library entries.



There is also a possibility of 'creativesdk' library has older non-compatible version.



Please comment on what could be wrong.



Thanks in advance .....



Answers

Your app has reached a limit of the Android app methods number.
You have to use Multidex (https://developer.android.com/tools/building/multidex.html#mdex-gradle)



Answers

The Answer by Yuriy Mysochenko is Perfect.



While reading the link in the answer, I figured out, when I changed the Google Play service library link to current new version, the error started appearing.



As in our Project, we are only using Google Maps feature, I tried changing the library link in Build.gradle as following. ( We can use different component of the Google Play library, instead of using full library )



compile 'com.google.android.gms:play-services-maps:7.5.0'


Now as I was not using full Google Play Library, 'the limit of Android app methods number' was not reached. The app built properly.



So currently I have not used Multidex. May be in future when we grow the app, we may have to use Multidex.





↑このページのトップヘ