Tizen is not defined? Trying to create alarm - alarm

When I run in the simulator it works, but in tablets, smartphones, etc., I get "Reference Error - Tizen is not defined."
My main:
//Initialize function
var init = function () {
// TODO:: Do your initialization job
console.log("init() called");
// add eventListener for tizenhwkey
document.addEventListener('tizenhwkey', function(e) {
if(e.keyName == "back") {
alert(tizen.application);
tizen.application.getCurrentApplication().exit();
}
});
notificationMe = function () {
try {
console.log(tizen.application);
window.tizen.alarm.removeAll();
var appControl = new window.tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
var alarm = new window.tizen.AlarmAbsolute(new Date(2014, 1, 27, 10, 20));
window.tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
alert('Prepare to Tizen Alert');
alert(alarm.getNextScheduledDate()+" - "+window.tizen.alarm.getAll().length);
} catch(err) {
alert(err.name+" : "+err.message);
}
}
};
$(document).ready(init);
config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/Alarm" version="1.0.0" viewmodes="maximized">
<tizen:application id="___ID_OCULTED__" package="__OCULTED__" required_version="2.0"/>
<content src="index.html"/>
<feature name="http://tizen.org/api/tizen"/>
<feature name="http://tizen.org/api/application"/>
<feature name="http://tizen.org/api/application.kill"/>
<feature name="http://tizen.org/api/application.launch"/>
<feature name="http://tizen.org/api/application.read"/>
<feature name="http://tizen.org/api/alarm"/>
<feature name="http://tizen.org/api/alarm.read"/>
<feature name="http://tizen.org/api/alarm.write"/>
<icon src="icon.png"/>
<name>Alarm</name>
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
<tizen:privilege name="http://tizen.org/privilege/alarm"/>
<tizen:privilege name="http://tizen.org/privilege/notification"/>
<tizen:privilege name="http://tizen.org/privilege/application.read"/>
<tizen:privilege name="http://tizen.org/privilege/application.info"/>
<tizen:setting screen-orientation="portrait" context-menu="enable" background- support="disable" encryption="disable" install-location="auto" hwkey-event="enable"/>
</widget>
Any suggestions?
I tried tizen, window.tizen ... no effect on tables, smartphones, but in the simulator it still work.

Just disable checkbutton "Enable Live Editing" in "Run Configurations" menu (rigth click on project -> "Run as" -> "Run configurations...")
P.S.
The same problem in: Tizen SDK: Can't find variable: tizen

Check for tizen object in js console. If it is undefined, reinstall wrt-plugins-tizen packages.
Logs from js console (debug) would be helpful...

Most probably you're running that on devices that doesn't support Tizen.
Even now there's only a handful of devices that support Tizen.
I know only Samsung smartwatches Gear 1 & 2 & S and "experimental" smartphone Samsung Z1.

Related

Adding reference assemblies to Roslyn analyzer code fix unit tests

I'm attempting to write a unit test to test a Roslyn analyzer code fix. Things have moved on since the introduction of analyzers and editing DiagnosticVerifier.Helper.cs is no longer the way ( https://www.productiverage.com/creating-a-c-sharp-roslyn-analyser-for-beginners-by-a-beginner )
My analyzer works on mvc ControllerBase derived types yet adding the name of the AspNetCore assemblies to the reference assemblies does not resolve the issue of my test not resolving the AspNetCore namespace includes in the test source code
var test = new VerifyCS.Test();
mytest.ReferenceAssemblies = test.ReferenceAssemblies.AddAssemblies( ImmutableArray.Create(new string[] { "Microsoft.AspNetCore.Mvc"}));
error CS0234: The type or namespace name 'AspNetCore' does not exist
in the namespace 'Microsoft' (are you missing an assembly reference?)
EDIT:
fixed, using:
mytest.ReferenceAssemblies = mytest.ReferenceAssemblies.WithPackages(ImmutableArray.Create(new PackageIdentity[] { new PackageIdentity("Microsoft.AspNetCore.Mvc.Core", "2.2.5") }));
You need to use the long syntax of VerifyCS.Test:
await new VerifyCS.Test
{
ReferenceAssemblies = referenceAssemblies,
TestState =
{
Sources = {test },
//ExpectedDiagnostics = {VerifyCS.Diagnostic().WithLocation(0).WithArguments("xxx")}
}, // FixedCode = "yyy", etc.
}.RunAsync();
You can add assemblies and nuget packages:
var referenceAssemblies = ReferenceAssemblies.Default
.AddPackages(ImmutableArray.Create(
new PackageIdentity("serilog", "2.10.0"),
new PackageIdentity("Othe.Package.Name", "1.2.0")
)
).AddAssemblies(
ImmutableArray.Create(
"Microsoft.Extensions.DependencyInjection.Abstractions",
"Microsoft.Extensions.Hosting",
"Microsoft.Extensions.Hosting.Abstractions")
);
BEWARE: the nuget packages are recovered only from the feeds specified in nuget.config, so, if you're using pacakages from an special feed, like your company's DevOps feed, you need to include it in this config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
....
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="myCompanyFeed" value="https://mycompanyfeed.pkgs.visualstudio.com/_packaging/MyCoNuget/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
Removing the <clear/> is another option, but less portable.

ClickOnce manual update still asks for update

I disabled update checking in Visual Studio by unchecking the publish property The application should check for updates.
My app checks for updates and the user has to option to decline to update.
The issue is when the user skips the update, the next time he starts the app the default ClickOnce update screen is presented again.
How do I make sure it never shows the default ClickOnce update dialog?
My update code:
private void CheckForUpdates()
{
if (!ApplicationDeployment.IsNetworkDeployed)
{
return;
}
var currentDeployment = ApplicationDeployment.CurrentDeployment;
UpdateCheckInfo info;
try
{
info = currentDeployment.CheckForDetailedUpdate();
}
catch (Exception e)
{
return;
}
if (!info.UpdateAvailable)
{
return;
}
var changelogDialog = new Changelog();
if (changelogDialog.ShowDialog() != true)
{
return;
}
currentDeployment.Update();
Exit();
}
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="test.ccpl.Desktop.application" version="1.0.0.89" publicKeyToken="7613da056444d824" language="en-CA" processorArchitecture="x86" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="test ccpl" co.v1:suiteName="test" asmv2:product="test ccpl" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" mapFileExtensions="true" co.v1:createDesktopShortcut="true">
<deploymentProvider codebase="https://test-test.test.ca/Installers/test.ccpl.Desktop.application" />
</deployment>
<dependency>
<dependentAssembly dependencyType="install" codebase="Application Files\test.ccpl.Desktop_1_0_0_89\test.ccpl.Desktop.exe.manifest" size="58997">
<assemblyIdentity name="test.ccpl.Desktop.exe" version="1.0.0.89" publicKeyToken="7613da056444d824" language="en-CA" processorArchitecture="x86" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>u36JKY4n1mmu2LZC3Ea5uRLheiM=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.7.2" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<publisherIdentity ...>
I think that everything you are seeing is by design.
As soon as you call currentDeployment.CheckForDetailedUpdate(), clickonce will store that update metadata in the registry. On next startup, clickonce will always look at this information to see if there is a pending deployment and if so, it will also determine if the user has skipped this newer version or not. If you want or not, this is by design.
However, if you really want to get rid of the clickonce Update dialog on startup, then there is an ugly solution available :-) Update: See below for a second workaround.
First, lets have a look at the registry and how everything works:
Navigate to this location:
HKEY_CURRENT_USER\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment\SideBySide\2.0\PackageMetadata\{2ec93463-b0c3-45e1-8364-327e96aea856}_{3f471841-eef2-47d6-89c0-d028f03a4ad5}\
You will see 3 sub keys for every clickonce application you have installed.
In my case the application is called WindowsApplication and the public key token is a619d47505395849. So the important key to look for starts with wind..tion_a619d47505395849_
You should see something similar to test..tion_7613da056444d824_xxxxxxxxxx on your side. Just iterate over the keys, look for the public key token and choose the shortest key.
Now comes the important part. Look at the value which name ends with !PendingDeployment. After calling the CheckForDetailedUpdate method, it should look like this:
This is why the Update Dialog is showing up.
And then just replace the value with this and you are done:
The Update Dialog will then not appear anymore. The user can manually check for an update within your application, accept or ignore it again and again.
You can test these steps manually to see if everything works as expected. Putting it in code should become something similar to this:
var changelogDialog = new Changelog();
if (changelogDialog.ShowDialog() != true)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(#"Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment\SideBySide\2.0\PackageMetadata\{2ec93463-b0c3-45e1-8364-327e96aea856}_{3f471841-eef2-47d6-89c0-d028f03a4ad5}");
var subkeyName = key.GetSubKeyNames().Where(x => x.Contains("7613da056444d824")).OrderBy(x => x.Length).First();
var subkey = key.OpenSubKey(subkeyName, true);
subkey.SetValue("{2ad613da-6fdb-4671-af9e-18ab2e4df4d8}!PendingDeployment", new byte[] { 00, 00 }, RegistryValueKind.Binary);
return;
}
UPDATE
Another Workaround:
Instead of calling the built-in function CheckForDetailedUpdate(), you can create your own "CheckForUpdate" method. That is not be a big deal:
private CustomUpdateCheckInfo CheckForUpdate()
{
var info = new CustomUpdateCheckInfo();
var currentVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion;
var manifestUri = ApplicationDeployment.CurrentDeployment.UpdateLocation;
using (XmlTextReader reader = new XmlTextReader(manifestUri.AbsoluteUri))
{
var doc = XDocument.Load(reader);
var version = doc.Descendants().FirstOrDefault(n => n.Name.LocalName == "assemblyIdentity").Attribute("version").Value;
info.NewestVersion = version;
info.IsUpdateAvailable = currentVersion.ToString() != version;
}
return info;
}
It will compare the currently deployed version with the newest version in the manifest file and returns an instance of CustomUpdateCheckInfo:
public class CustomUpdateCheckInfo
{
public bool IsUpdateAvailable { get; set; }
public string NewestVersion { get; set; }
}

Exception when using cassandra-unit to test cassandra

In my Java-Mavan-Spring project I'm using cassandra unit to try and test my DAO.
I created 2 files in my classpath:
A simple XML that describes my initial data
A cassandra configuration file (cassandra.yaml)
Here is my test class:
public class UserProfilingCassandraDaoUTest extends BaseJunitTestCase {
#Rule
public CassandraUnit cassandraUnit = new CassandraUnit(new ClassPathXmlDataSet("cassandraTestValues.xml"), "cassandra.yaml", "127.0.0.1");
private HectorCassandraConnection connection;
#Before
public void init() throws Exception {
connection = Mockito.mock(HectorCassandraConnection.class);
Mockito.when(connection.getKeyspace()).thenReturn(cassandraUnit.keyspace);
}
#Test
public void shouldHaveLoadTestDataSet() throws Exception {
Assert.assertNotNull(cassandraUnit.keyspace);
Assert.assertEquals(cassandraUnit.keyspace.getKeyspaceName(), "rtb");
}
#Test
public void getUserStatsTest() {
// Some Test
}
}
This is my cassandraTestValues.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<keyspace xmlns="http://xml.dataset.cassandraunit.org">
<name>rtb</name>
<columnFamilies>
<columnFamily>
<name>my_column_family</name>
<keyType>UTF8Type</keyType>
<comparatorType>UTF8Type</comparatorType>
<defaultColumnValueType>UTF8Type</defaultColumnValueType>
<row>
<key>12345__678_910</key>
<column>
<name>Col1</name>
<value>6</value>
</column>
<column>
<name>Col2</name>
<value>6</value>
</column>
<column>
<name>Col3</name>
<value>3</value>
</column>
</row>
</columnFamily>
</columnFamilies>
</keyspace>
As I run my test I'm getting this log with this error.
I have tried for hours many different methods to overcome the issue with no success.
Any ideas?
This is a bit sad, but changing cassandra-unit version from 1.2.0.1 to 1.0.3.1 and it worked like a charm.
I got to the solution by importing this project to my workspace. The imported project worked just fine and after compering both found that the difference between the versions is what causing the issue.
In addition, non of the later maven versions worked, meaning that all the version that came out after 1.0.3.1 failed (1.2.0.1, 1.1.2.1, 1.1.1.3, 1.1.1.2, 1.1.1.1, 1.1.0.1).
I hope this could save some time to someone in the future.. it sure took me a while.

How do I determine if services.msc snap-in is loaded into mmc console?

I need to prompt user to close services.msc snap-in on program uninstall. How do I do that?
You need to write custom action to do that. You can use Process to check whether services.msc is loaded in mmc or not.
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
foreach (Process getProcess in Process.GetProcesses())
{
if (getProcess.ProcessName.Contains("mmc"))
{
if (getProcess.MainWindowTitle == "Services")
{
session["SERVICES_MSC"] = "Running";
break;
}
}
}
return ActionResult.Success;
}
Calls the Custom action in uninstall and stop the uninstallation based on the SERVICES_MSC property.
<Binary Id="Check_Services" SourceFile="..\TestProject\bin\Release\TestProject.CA.dll" />
<CustomAction Id="CHECK_SERVICES" BinaryKey="Check_Services" DllEntry="CustomAction1" Return="check" />
<CustomAction Id="STOP_INSTALLATION" Error="Services.msc is running.Please close that Window before uninstall the setup." />
Inside the Install Execute sequence call the custom actions.
<Custom Action="CHECK_SERVICES" After="InstallValidate">REMOVE ~= "ALL"</Custom>
<Custom Action="STOP_INSTALLATION" After="CHECK_SERVICES">(REMOVE ~= "ALL") AND SERVICES_MSC</Custom>

How do I handle click event in Spark List control in Flex 4

I have a s:List component. I want to handle a click event to know what list item is selected. I don't see Click event in s:List. Any workarounds?
Thanks.
I know I'm late to the party here, but the simplest way to get the selected node from list in a click event is to use the currentTarget property.
function myClickHandler(event:MouseEvent):void{
Alert.show("My Var: " + event.currentTarget.selectedItem.myVar);
}
<s:List ... click="myClickHandler(event);">
...
</s:List>
see:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7cdb.html
You can use the IndexChangeEvent.CHANGE on List
http://docs.huihoo.com/flex/4/spark/events/IndexChangeEvent.html
Package spark.events
Class public class IndexChangeEvent
Inheritance IndexChangeEvent Event Object
Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5
The IndexChangeEvent class represents events that are dispatched when an index changes in a Spark component.
See also
spark.components.supportClasses.ListBase
spark.components.List
spark.components.ButtonBar
I figured how to do this. Thought I would share so that it helps others like me:
<s:List id="taskList" creationComplete="taskList.addEventListener('listClickEvent',handleListClick);" width="100%" height="80%" labelField="description" dataProvider="{todoList}"
useHandCursor="true">
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer click="handleClick(event)">
<fx:Script>
<![CDATA[
import ListClickEvent;
import flash.events.MouseEvent;
import mx.controls.Alert;
private function handleClick(me:MouseEvent):void
{
var listClickEvent:ListClickEvent = new ListClickEvent("listClickEvent");
listClickEvent.index = itemIndex;
owner.dispatchEvent(listClickEvent);
}
]]>
</fx:Script>
<s:Label text="{data.description}" top="5" bottom="5" right="3" left="3"/>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
Another way:
<s:List id="myid"
dataProvider="{listDP}"
width="100%"
height="100%"/>
on application creation complete:
myid.addEventListener(MouseEvent.CLICK,clickHandler);
Handler:
private function clickHandler(event:MouseEvent):void
{
if(myid.selectedIndex>=0)
{
...
}
myid.selectedIndex=-1;//to detect click on same item
}
Thanks guys,
Just make sure your List has its id variable set. Then you call in your click handler function like this:
private function listClickHandler(event:IndexChangeEvent) {
if(myListsID.seletectedIndex == 0){
navigator.pushView(whateverViewyouwant)
} else if(myListsID.selectedIndex ==1){
navigator.pushView(changetoanotherview)
} else if(myListsID.selectedIndex == 2){
navigator.pushView(mobileViewsareEasy)
} else if(myListsID.selectedIndex == 3){
navigator.pushView(wowSomanyViews)
}
}
The variable that goes into the pushView function corresponds to the mxml file name for the view you want to load
That is farrrr too complex here is a better way:
<s:List id="whatever" dataProvider="{allMyData}" click="whateverList_click(event)"> </s:List>
<fx:Script>
var whatWasClicked:String = whatever.dataProvider.getItemAt(whatever.selectedIndex).label;
</fx:Script>
Boo ya.
<s:List id="lstDesc" width="100%" height="100%">
<s:change>
Descselected();//do your stuff here
</s:change>
</s:List>
in flash builder.