XML to MySQL and SQLite - mysql

I need to load an XML file into a MySQL database. I also need to load the XML file for a SQLite database but I do not know how to do it.
<CommunicationLog xmlns="http://knx.org/xml/telegrams/01">
<RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<RecordStop Timestamp="" />
</CommunicationLog>

Related

Adding supported file type in windows phone 8.1

I have added four file type association in my package.appmanifest file
in which .pdf is one of them. Due to this when i am clicking on any
external pdf file, My app is also coming in the list along with Adobe
reader. What could be the reason.
Following is the code of my app.manifest file
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
<Identity Name="195c0ec0-b933-4837-99c7-30250bbd0f9b" Publisher="CN=etu10" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="195c0ec0-b933-4837-99c7-30250bbd0f9b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>eBasta</DisplayName>
<PublisherDisplayName>etu10</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.3.1</OSMinVersion>
<OSMaxVersionTested>6.3.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="eBasta.App">
<m3:VisualElements DisplayName="eBasta" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="eBasta" ForegroundText="light" BackgroundColor="transparent">
<m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png">
</m3:DefaultTile>
<m3:SplashScreen Image="Assets\SplashScreen.png" />
<m3:InitialRotationPreference>
<m3:Rotation Preference="portrait" />
<m3:Rotation Preference="landscape" />
<m3:Rotation Preference="landscapeFlipped" />
</m3:InitialRotationPreference>
</m3:VisualElements>
<Extensions>
<Extension Category="windows.fileTypeAssociation">
<FileTypeAssociation Name="text">
<DisplayName>text</DisplayName>
<SupportedFileTypes>
<FileType ContentType="text/xml">.xml</FileType>
<FileType ContentType="application/pdf">.pdf</FileType>
<FileType ContentType="application/zip">.zip</FileType>
<FileType ContentType="application/zip">.ebs</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extension>
<Extension Category="windows.fileTypeAssociation">
<FileTypeAssociation Name=".pdf">
<DisplayName>pdf</DisplayName>
<SupportedFileTypes>
<FileType ContentType="application/pdf">.pdf</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClientServer" />
<Capability Name="removableStorage" />
<Capability Name="picturesLibrary" />
<Capability Name="musicLibrary" />
<Capability Name="enterpriseAuthentication" />
<m3:Capability Name="contacts" />
<m3:Capability Name="appointments" />
<Capability Name="sharedUserCertificates" />
<Capability Name="videosLibrary" />
<DeviceCapability Name="location" />
<DeviceCapability Name="proximity" />
<DeviceCapability Name="webcam" />
</Capabilities>
</Package>
Well it's normal that your app is listed there as you supported that file extension. If you expected that your app opens the file alone, that's not possible in Windows phone as defining default file opener is not supported

Phonegap Permission for camera

I cannot get my app properly working I target android but I use a config.xml to build my app in phonegap. What do I need to add here to make my app show camera permission when installing my app?
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.sample.com" version = "1.0.0" versionCode = "1" >`enter code here`
<name>sample</name>
<description>sample</description>
<author>sample</author>
<gap:platforms>
<gap:platform name="ios" />
<gap:platform name="android" />
<gap:platform name="webos" />
<gap:platform name="symbian.wrt" />
<gap:platform name="blackberry" project="widgets"/>
</gap:platforms>
<icon src="icon.png" />
<preference name="phonegap-version" value="3.6.3" />
<feature id="blackberry.media.camera" />
<plugin name="Camera" value="org.apache.cordova.CameraLauncher" />
<access origin="*" subdomains="true" />
<access uri="*" subdomains="true" />
<access uri="http://redasmobile.esy.es/" subdomains="true" />
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.InAppBrowser" />
</feature>
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="false" />
<preference name="target-device" value="universal" />
<feature name="Camera">
<param name="blackberry-package" value="org.apache.cordova.camera.Camera" />
</feature>
</widget>
Add those lines to your config.xml
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/file" /><!-- WRITE_EXTERNAL_STORAGE; required for camera to write to camera roll -->
Do you use the cli command ie cordova build android or do you use build.phonegap.com ?
If you use the client, you have to do a : cordova plugin add org.apache.cordova.camera
If you use build phonegap you have to add
<gap:plugin name="org.apache.cordova.camera" version="0.2.4" />
in your config.xml

API search in mediawiki don't work

I want to make search with wikimedia API in my local mediawiki.
When I try this url on the wikipedia API online
http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=fran&srprop=timestamp
I get this
<?xml version="1.0"?>
<api>
<query-continue>
<search sroffset="10" />
</query-continue>
<query>
<searchinfo totalhits="13454" />
<search>
<p ns="0" title="Fran" timestamp="2013-07-10T11:08:52Z" />
<p ns="0" title="Hurricane Fran" timestamp="2013-10-27T17:30:58Z" />
<p ns="0" title="Fran Drescher" timestamp="2013-12-10T01:10:38Z" />
<p ns="0" title="Fran Walsh" timestamp="2013-11-19T04:12:29Z" />
<p ns="0" title="List of The Nanny characters" timestamp="2013-11-29T17:26:10Z" />
<p ns="0" title="Fran González" timestamp="2013-07-16T14:44:50Z" />
<p ns="0" title="Fran Landesman" timestamp="2013-08-02T19:36:03Z" />
<p ns="0" title="Fran Mérida" timestamp="2013-12-08T23:27:28Z" />
<p ns="0" title="Tropical Storm Fran" timestamp="2012-11-11T18:44:02Z" />
<p ns="0" title="Fran (film)" timestamp="2013-10-30T11:49:53Z" />
</search>
</query>
</api>
When I type the same url in my mediawiki API with dump of wikipedia:
http://www.mylocalhost.com/begoo/assets/mediawiki/api.php?action=query&list=search&srsearch=fran&srprop=timestamp
I get this
<?xml version="1.0"?>
<api>
<query>
<search />
</query>
</api>
I correctly installed all dump of wikipedia and only the API OpenSearch Work fine,not the API Search.What is wrong?

Update app.config from WIX setup?

I am trying Wix 3.6 and this is how it looks right now :
<?xml version="1.0" encoding="UTF-8"?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="myappINSTALLDIR" Name="myapp5Service">
<Component Id="SampleServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="myapp5.WindowsService.exe" Name="myapp5.WindowsService.exe" Source="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe" KeyPath='yes'/>
...
<ServiceInstall Id="InstallmyappService" DisplayName="myappService" Name="myapp5.WindowsService.exe" Description="myapp 5 Service - För effektivare och enklare operationsplanering" Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlmyappService" Name="myapp5.WindowsService.exe" Start="install" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
</Directory>
</Directory>
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
Now I need to add a dialog to the Wix setup where one appSetting and one baseadress(WCF) is set to the app.config. This most be done before the installation becouse it will decide the name of the Windows Service that the Wix is installning.
And exampel would be great!
Edit 1:
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="SERVICEADDRESS" Value="http://serviceaddress"/>
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<util:XmlFile Id="UpdateBaseAddress"
Action="setValue"
File="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe.config"
SelectionLanguage="XPath"
Permanent="yes"
ElementPath="/configuration/applicationSettings/ServiceName"
Name="baseAddress" Value="[SERVICEADDRESS]" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
You could add in a reference to the WixUtilExtension.dll to the installer project, then use XmlFile to update the app.config like:
<Property Id="SERVICEADDRESS" Value="http://serviceaddress"/>
<util:XmlFile Id="UpdateBaseAddress"
Action="setValue"
File="[DirApplication]$(var.app.config)"
SelectionLanguage="XPath"
Permanent="yes"
ElementPath="/configuration/applicationSettings/...."
Name="baseAddress" Value="[SERVICEADDRESS]" />
Note that you'll need to set the directory and the name of the .config file (you could just use $(var.ProjectName.TargetFileName).config which should work it out for you automatically

Can't resolve types from unity config file

Trying to set up Unity via XML configurations I'm getting this exception
The type name or alias ServiceHost could not be resolved. Please check your configuration file and verify this type name.
Trying to comment that out I get the same exception for the next and then the next after that so the problem must lie somewhere in my setup.
<unity>
<typeAliases>
<!-- Lifetime manager types -->
<typeAlias alias="singleton"
type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager,
Microsoft.Practices.Unity" />
<typeAlias alias="external"
type="Microsoft.Practices.Unity.ExternallyControlledLifetimeManager,
Microsoft.Practices.Unity" />
<typeAlias alias="perThread"
type="Microsoft.Practices.Unity.PerThreadLifetimeManager,
Microsoft.Practices.Unity" />
<!-- User-defined type aliases -->
<typeAlias alias="ServiceHost"
type="System.ServiceModel.ServiceHost, System.ServiceModel" />
<typeAlias alias="UnityServiceHost"
type="MyProjectServiceLibrary.Hosting.UnityServiceHost" />
<typeAlias alias="IServiceBehavior"
type="System.ServiceModel.Descriptions.IServiceBehavior, System.ServiceModel" />
<typeAlias alias="UnityServiceBehavior"
type="MyProjectServiceLibrary.Hosting.UnityServiceBehavior, MyProjectServiceLibrary" />
<typeAlias alias="IInstanceProvider"
type="System.ServiceModel.Dispatcher.IInstanceProvider, System.ServiceModel" />
<typeAlias alias="UnityInstanceProvider"
type="MyProjectServiceLibrary.Hosting.UnityInstanceProvider, MyProjectServiceLibrary" />
<typeAlias alias="MyProjectService"
type="MyProjectServiceLibrary.Service.MyProjectService, MyProjectServiceLibrary" />
<typeAlias alias="IRepositoryFactory"
type="MyProjectDataModelLibrary.Repository.IRepositoryFactory, MyProjectDataModelLibrary" />
<typeAlias alias="RepositoryFactory"
type="MyProjectDataModelLibrary.Repository.RepositoryFactory, MyProjectDataModelLibrary" />
<typeAlias alias="IDbContext"
type="MyProjectDataModelLibrary.DataContext.IDbContext, MyProjectDataModelLibrary" />
<typeAlias alias="MyProjectDatabase"
type="MyProjectDataModelLibrary.DataContext.MyProjectDatabase, MyProjectDataModelLibrary" />
<typeAlias alias="IRepositoryOfT"
type="MyProjectDataModelLibrary.Repository.IRepository`1, MyProjectDataModelLibrary" />
<typeAlias alias="EntityRepositoryOfT"
type="MyProjectDataModelLibrary.Repository.EntityRepository`1, MyProjectDataModelLibrary" />
</typeAliases>
<containers>
<container>
<types>
<type type="MyProjectService" />
<type type="ServiceHost"
mapTo="UnityServiceHost" />
<type type="IServiceBehavior"
mapTo="UnityServiceBehavior" />
<type type="IInstanceProvider"
mapTo="UnityInstanceProvider" />
<type type="IRepositoryFactory"
mapTo="RepositoryFactory" />
<type type="IDbContext"
mapTo="MyProjectDatabase" />
<type type="IRepositoryOfT"
mapTo="EntityRepositoryOfT" />
</types>
</container>
</containers>
</unity>
I've tried reading around to see what I'm doing wrong. I doubt it's the fully qualified name though I can't be sure as I haven't really used that before.
IUnityContainer container = new UnityContainer();
container.RegisterInstance<IUnityContainer>(container);
UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
section.Configure(container);
The exception is thrown in the last line here.
Since you're referencing system types, it's most likely trying to pull those types from the GAC. In that case, you'll need to use the fully qualified assembly names, including version number, culture, and public key token. Something like this:
<typeAlias alias="ServiceHost"
type="System.ServiceModel.ServiceHost, System.ServiceModel,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,
processorArchitecture=MSIL" />
You'll need to look up the appropriate version # and public key tokens for the version of .NET you're using, of course.