Monday, December 10, 2018

xdg-open; vscode acts as default application for html

Opening html files stopped launching the browser, but launched the vscode application.

> xdg-mime query default text/html
code-url-handler.desktop

It turned out a new handler was configured

check your ~/.config/mimeapps.list file

The line

[Default Applications]
text/html=code-url-handler.desktop

sends the text/html files to a handler that launches vscode.

Just remove that line. And the xdg-open <>  will work again as expected

Thursday, December 07, 2017

make files explained if you did not grew up with them

Here is a nice post on how to define makefiles for a go project and actually teaching you some makefile constructs:

https://sahilm.com/makefiles-for-golang/

Thursday, October 26, 2017

Removing 'uninstallable' Packages from Windows10

I assume you'll have to some admin skill knowledge.
So how do you install all these pre-installed windows apps that are on your new laptop?

'Add Remove' programs only allows you to report a problem. Well the problem is that you want to uninstall it. So here is how you can do it:

Open a powershell in admin mode

You can search for packages with the command

> Get-AppxPackage | Where-Object {$_.Name -like '*3D*'}

And you get something like

Name              : Microsoft.Microsoft3DViewer
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 2.1709.8012.0
PackageFullName   : Microsoft.Microsoft3DViewer_2.1709.8012.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.Microsoft3DViewer_2.1709.8012.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.Microsoft3DViewer_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
Dependencies      : {Microsoft.VCLibs.140.00.UWPDesktop_14.0.25426.0_x64__8wekyb3d8bbwe,
                    Microsoft.VCLibs.140.00_14.0.25426.0_x64__8wekyb3d8bbwe,
                    Microsoft.NET.Native.Framework.1.3_1.3.24201.0_x64__8wekyb3d8bbwe,
                    Microsoft.NET.Native.Runtime.1.4_1.4.24201.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False


Remove the 3D viewer (a.k.a. mixed reality)

> Get-AppxPackage Microsoft.Microsoft3DViewer | Remove-AppxPackage

So it is just a matter of guessing the name of the package you want to install. But you get the idea.

Remove OneNote

>  Get-AppxPackage Microsoft.Office.OneNote | Remove-AppxPackage

Remove XBox stuff
> Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage
> Get-AppxPackage Microsoft.XboxSpeechToTextOverlay | Remove-AppxPackage


Thursday, January 19, 2017

Notes on GSM USB dongles on linux.

Analyzing Huawei GSM dongles


In the last few months I've been writing drivers for Huawei GSM dongles. In particular to be used in combination with the Android RIL (Radio Interface Layer). In general Android runs on top of a Linux Kernel. The drivers that ships with GSM dongles typically works with Windows software. So we often have to do some reverse engineering. 

Here are my notes:

My target environment is a Linux Kernel 2.6....  My first step is to see if it works with the Windows software. Does the dongle pick up a signal. Can it register to a network. etc. 
Next step, setup a connection by providing the relevant APN, username and password. 

Huawei dongles typically ships with variations of Mobinil software. There is an option to use different connection type. RAS (modem) or NDIS

Selecting RAS (modem) mode
When you select the RAS (modem) we can use a tool like USBlyzer to inspect the AT commands that are used to register the the GSM dongle to the network.

There are generic AT commands but  also vendor specific AT commands.

... to be continued.







Linux 

When switching to Linux the first challenge you might run into is that the device nodes are not created. Typically their modem software is included inside the GSM dongle and will be installed by telling the OS that it is a mass storage device, or tells the OS is behaves as a CD-rom. And it launches the install software.

In order to stop fooling the OS, we can use a tool USBMode_switch. The site has good forum discussions and a lot of hints to get your specific vendor dongle recognized. Most linux distros have a very recent version installed. What you might notice is that the product id from the GSM dongle is changing. 
You can see this when you call 'lsusb' and do this a couple of times (every 5 sec) while putting in the GSM dongle. 
You will see the USB being recognized by linux. It disappears briefly and reappears with a different product id.  You can see with 'dmesg' that new device nodes are being created. If that is not the case you first have to go over this hump. 


AT commands 

AT+CLAC will reveal most (not all) supported commands for the stick
There are different options to send the commands and monitory the result.

I've used putty on linux and start a serial connection type. (the /dev/ttyUSB3 is just an example.)

A bit more primitive but still working is to open to shell sessions.
Monitor the output in one session:

cat /dev/ttyUSB1

And in another terminal session, send the at commands.:

echo "AT^SETPORT=?" > /dev/ttyUSB1

The question is to find out which node you can use. And I've only come to a trial and error mode.
I quickly try the commands
cat /dev/ttyUSB1
cat /dev/ttyUSB2
cat /dev/ttyUSB3
cat /dev/ttyUSB4
...
To find out on which node I can communication. You will often see some AT^BOOT messages, ^RSSI, ^CSNR, ^MODE messages  passing by. They are rather an annoyance when you use putty. So the first commands I use during a putty session is to

  • turn off the boot messages with  AT^BOOT=0,0
  • turn off RSSI reporting with AT^CURC=0


The output of the AT^SETPORT=?" will give you a list of the different 'ports'.

output::
1:MODEM
2:PCUI
3:DIAG
4:PCSC
5:GPS
6:GPS CONTROL
7:NDIS
A:BLUE TOOTH
B:FINGER PRINT
D:MMS
E:PC VOICE
A1:CDROM
A2:SD

You can enable /disable these 'ports' by enumerating them in the AT^SETPORT="A1,A2;1,2"
This would enable modem and pcui on ttyUSB0 and ttyUSB1.

If you change the order AT^SETPORT="A1,A2;2,1"
The modem and pcui will be on ttyUSB1 and ttyUSB0.

I'm not sure how to reset a dongle to factory setting to restore the port mode. But you can imagine, you have to be carefull with these AT commands. If you disable the Application interface (PCUI) I would not know of a mechanism to undo you changes (maybe via the NDIS interface?)


echo -e "AT^GETPORTMODE" > /dev/ttyUSB1

output:: /
^getportmode:type:WCDMA:Qualcomm,MDM:0,NDIS:1,DIAG:2,PCUI:3

(suggesting it was 1,7,3,2)


# echo -e "AT^SETPORT=\"A1,A2;1,2\"" > /dev/ttyUSB1


plug in and out the dongle.
ls /dev/ttyU*
/dev/ttyUSB0  /dev/ttyUSB1

# echo "AT^GETPORTMODE" > /dev/ttyUSB1

^getportmode:type:WCDMA:Qualcomm,MDM:0,PCUI:1


E353 specific


TIGO dongle:


echo "AT^SYSCFG=?" > /dev/ttyUSB1
^SYSCFG:(2,13,14,16),(0-3),((400380,"GSM900/GSM1800/WCDMA2100"),(4a80000,"GSM850/GSM1900/WCDMA850/WCDMA1900"),(3fffffff,"All Bands")),(0-2),(0-4)

Probably default is 
echo -e "AT^SETPORT=\"A1,A2;1,7,3,2,A1\"" > /dev/ttyUSB1



3 Dongle:

echo "AT^GETPORTMODE" > /dev/ttyUSB4

^getportmode:type:WCDMA:Qualcomm,MDM:0,NDIS:1,DIAG:2,PCUI:3,CDROM:

"AT^SYSCFG=?" > /dev/ttyUSB4
^SYSCFG:(2,13,14,16),(0-3),((400000,"WCDMA2100")),(0-2),(0-4)



Thursday, November 10, 2011

Watin => Selenium ?

I've been using Watin for quite some browser automation projects. But it seems that Watin is a bit dead in the water. No Chrome support. No Firefox 4 or higher support. It also seems to be an heroic effort of a few people.

So it might be time to move over to Selenium. Active development, wide browser support...

Friday, April 25, 2008

External function calls

The latest release of the Rule Manager allows to import external functions into the business vocabulary. As a little exercise I tried to get the current weather condition for a zipcode (maybe I can write some rules if I should bring my umbrella while I leave my house in L.A.)

Initially I intended to call a webservice, but it seems that all free weather webservice calls is something from the past. Yahoo offers weather information as an RSS feed. So a simple XPath query can select the information that I'm interested in:

Here is the code (note the FunctionAttribute decoration on the method)


1 using System.IO;

2 using System.Net;

3 using System.Xml;

4 using AcumenBusiness.IModel;

5 using Type=AcumenBusiness.IModel.Type;

6

7 namespace TestCallWebService

8 {

9 [Concept("Weather info", "Try to get weather forecast from different services")]

10 public class WeatherInfoProvider

11 {

12 private static readonly string YahooWeatherURLFormat = "http://weather.yahooapis.com/forecastrss?p={0}";

13

14 [Term("workaround", "import function requires one field. (bug)")]

15 private string dummyField;

16 public string DummyField

17 {

18 get { return dummyField; }

19 set { dummyField = value; }

20 }

21

22 [Function("Get temperature", "Get the weather info from Yahoo",

23 ReturnType = Type.text,

24 ArgumentTypes = new Type[] { Type.integer })]

25 public static string GetWeatherInfoAsFeed(int zipCode)

26 {

27 HttpWebRequest request = (HttpWebRequest) WebRequest.Create(string.Format(YahooWeatherURLFormat, zipCode));

28 // execute the request

29 HttpWebResponse response = (HttpWebResponse) request.GetResponse();

30

31 // we will read data via the response stream

32 Stream resStream = response.GetResponseStream();

33 XmlDocument rssFeed = new XmlDocument();

34 rssFeed.Load(resStream);

35

36 //set an XmlNamespaceManager since we have to make explicit namespace searches

37 XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(rssFeed.NameTable);

38 //Add the namespaces used in the xml doc to the XmlNamespaceManager.

39 xmlnsManager.AddNamespace("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0");

40

41 XmlNode weatherCondition = rssFeed.SelectSingleNode("/rss/channel/item/yweather:condition/@temp", xmlnsManager);

42 if (weatherCondition != null) {

43 return weatherCondition.Value;

44 }

45 return null;

46 }

47 }

48 }



With the Import Schema adapter I can import this function and call it from my business rules. The coolest part is that you can invoke this from the Interactive Rule Map. So you can see how your rules are executing with this external data. It seems to be 76 fahrenheid in L.A.
Nice weather to jump on the bike and cycle to work...





Thursday, January 10, 2008

.NET SOA BizTalk: BizTalk Tools and guidelines

Kishore Dharanikota has created a nice list of tools and guidelines for BizTalk developers and designers .NET SOA BizTalk: BizTalk Tools and guidelines. The Rule Manager is mentioned in the Development category. Interesting to see this classification. I probably would have placed it in the Design category. But that all depends on your frame of reference. Or it might hint that many BizTalk developers are playing a dual role of business analyst and developer.

Tuesday, October 30, 2007

RenewCert - Renew Expired Certificates

It's been just over a year when I deployed the RuleManager with a ClickOnce certificate. Today it expired. Visual Studio 2005 would suggest to generate a new certificate file, however none of the existing users would be able to update the Application (because of different certificate keys).
The error you would get is:

System.NullReferenceException: Object reference not set to an instance of an object.
at System.Deployment.Application.ApplicationTrust.RequestTrust(SubscriptionState subState, Boolean isShellVisible, Boolean isUpdate, ActivationContext actCtx, TrustManagerContext tmc)
at System.Deployment.Application.DeploymentManager.DetermineTrustCore(Boolean blocking, TrustParams tp)
at System.Deployment.Application.DeploymentManager.DetermineTrust(TrustParams trustParams)
at System.Deployment.Application.ApplicationDeployment.CheckForDetailedUpdate()



There is a workaround made by Cliff Stanford RenewCert, which allows you to regenerate an expired certification.

Thanks Cliff!

Sunday, October 14, 2007

Graphical Rule Editor for RuleML format


In the last few weeks we have created the RuleML adapter for the Rule Manager. The RuleML adapter allows to export a business rules policy to the Reaction RuleML format.

Please bear with us that we are no experts in RuleML and certain rule constructions might be exported incorrectly. I hope the RuleML community can provide us with the feedback and we will incorporate any changes into our automatic update process as soon as possible. You can give feedback at the http://www.acumenbusiness.com/support forum.

Installation:
The Rule Manager product is available from the website http://www.acumenbusiness.com/

You can export to the RuleML format by installing the RuleML adapter module. See the screenshot [Menu: File\Options\Adapters\Rule ML]

The adapter will provide the new export format "RuleML (*.rrml)" in the Export wizard. [Menu: File\Export]
You can set .rrml as the default export type by changing the File Export type on the Import & Export options
[Menu: File\Options\Import & Export\File Export = RuleML (*.rrml)]

An example of the Driver Eligibility export is here
Posted by Picasa

Wednesday, August 08, 2007

Paul Andrew : What to use Windows Workflow Foundation for?

Paul Andrew has a nice write up on why you would use Windows Workflow Foundation. There are some excellent arguments for the use of the rules component: the visibility into the business logic and the ability to change this business logic.

That is exactly the reason why I'm currently designing a Windows Workflow Foundation architecture for a very large client. Performance will become critical...

Wednesday, July 18, 2007

Rule Vendors - Product Derby

Once a year, during the business rules symposium, vendors of rule engines can show how they implement a general use case that contains many business rules. This use case is known as the UServ Product Derby. You can read the specifications here.

A few years ago I was actively involved with the implementation using Aion (from CA). Last year I put together the web front-end for Corticon. And recently I've been examining the implementation from Microsoft with WF rules.

Microsoft's example (download here) illustrates the technical feasibility of using WF rules. Although this example shows that it's technical possible, it does not highlight the business rules management, rule audit trail and rule traceability.

For me it was a nice opportunity to see if the Rule Manager from Acumen Business could visualize the rules and perform rule verification on the policy to discover if the actual implementation was logically correct.

We start this blog series with a closer look at the 'Driver's Eligibility' policy as defined in the use case. After a few adjustments on the Rule Manager, I produced this report (PDF, XPS) from Microsoft's example implementation.

The part that got my attention right away was the discovered contradiction. On first look, the rule DA_7 is rather complicated. It is a typical programmer's construction to use a not (expr and expr)
Such a statement has probably a few nanoseconds advantage on your processor. However do we really want the business user to decipher this statement by applying De Morgan's law?

Just keep it simple stupid. Where possible, avoid negated nested expressions and split or-statements in multiple rules.

You might wonder if we found an error with the rules example? The example should work fine, however the example uses rule priorities to ensure that rule DA_7 (priority -1) , is executed after DA_8 (priority 0). The problem that I have with rule priorities is that you throw away the declarative features of a rule engine. Suddenly the rule writer has to be aware of priority values in order to achieve the desired result.

Also note that DA_7 does not halt the rules engine. In a case where we have a male driver of 71 years old, the rules engine first assign 'Senior' to the Driver class, and consecutively overwrites this value with 'Typical Driver'. Now we also have to make sure that rule 'DA_3' must be executed after DA_7 and DA_8. If DA_3 would fire before, we make the incorrect conclusion that a 71 year old senior is eligible without checking his training certificate.

A second problem related to the priority and overwriting conclusions is that a rule audit report would show incorrect results. So please use rule priorities careful. We will show below that the Driver Eligibility policy actually don't require priorities.

Finally, the generated rule graph shows two disjoint rule networks. We have to wonder what happened with the rules that determine the 'Training Certification'. Also how is the DUI related to the Training Certificate? It seems that the example is not a complete implementation of the specification. Visualizing a rule policy in a complete rule graph does make the business rules code review an easy task.

Again, Microsoft example was only illustrating the technical aspects of WF rules. And the example shows how you can achieve First Order Logic with WF rules. (For All Drivers do...)
I changed the Driver Eligibilty policy to remove the contradiction and remove the priorities to keep the rules 100% declarative. We let the rules engine decide which rule should be executed next. Here is a produced report of my rewrite (PDF, XPS).

There are no disjoint rule graphs, no self contradictions within the rules, and no rule anomalies among rules. We do discover some incompleteness. E.g. is a Female of 24 years old eligible?
This incompleteness can be a misinterpretation of the use case specification, or an actual incompleteness in the specification. But with this rule report it's very easy to get these issues clarified.

Wednesday, July 04, 2007

WebCast on Advanced Scenarios of WFRules

Kavita (Microsoft) will give a presentation this Friday (7/6/2007) about some advanced scenarios using rules with Windows Workflow Foundation.

During this presentation you will see screenshots of Acumen Business Rule Manager as an example of an advanced Business Rules solution!

The Rule Manager provides the additional functionality of Rule Authoring, Rule Repository Rule Verification & Validation. Only by empowering the business users with a complete business rules tool set, you will achieve a truly agile business policy that becomes transparent within your organization.

Here are the details of the Live Webcast:

Event Name: Webcast: Introduction to Windows Workflow Foundation Rules - Part II

Start Date: 7/6/07
Start Time: 1:30 PM (GMT-05:00) Eastern Time (US & Canada)
End Time: 3:00 PM (GMT-05:00) Eastern Time (US & Canada)
Audio conferencing: +1 (866) 500-6738
Participant code: 7545634
Presenter code: 9070863

Click on this link for more information regarding this Webcast

Thursday, June 28, 2007

A Test suite for business rules

I mentioned in a previous posts that the rule validation in the interactive rule map (cause-effect graph between terms and rules) is part one of the rule validation.

In the image on the right (click to zoom) you see the second part that is currently being developed. Test cases that are created in the interactive rule map can be saved to a test suite. A test suite (a collection of test cases for business rules) can be executed in a batch process.

For every test record we compare the user defined expected value with the rules engine computed value. Any discrepancies are flagged with a red info, and the test record would be marked red to indicate a failure. Green test records have all computed values equal to the business users defined expected values.

In the output terms you have to indicate which term you want to set as a goal for the rules engine. One test suite can process multiple goals. But every test record can only have one goal defined.

Similar to the meta information on a business rule, a test record contains the meta information of who the author is, when it was created, a description field etc.

You can imagine that among business users a difference of opinion might exists what the expected outcome value must be for a particular situation. We can not say what is right or wrong withing a rule policy, but we can show there is a difference.

Finally, the test suite can be used perfectly for regression testing your rule policy and can give a good impact analysis what happens when you modify your rule policy.
Posted by Picasa

Monday, June 11, 2007

Microsoft XPS format

During a web demonstration of the Rule Manager I had to go for a full OS reboot. Not very pretty for a product demonstration. What happened? Not really sure, but it seems that the latest version of Adobe Acrobat (8.1.0) started to lock the generated Rule PDF report.

Few days later I started to get the forced updates from Adobe. Considering I have many VM installations to test all different platforms and configurations, you can imagine I'm not too happy with these forced downloads.

Finally the free PDF viewer started to contain advertisement to FedEx. These 'convenient' link buttons are always a big annoyance to me.

It was time to provide an alternative to the PDF format. The latest release of the Rule Manager (1.5.0.17) supports now the Microsoft XPS as an alternative.

The good part of this is that an XPS viewer comes pre-installed on Microsoft Vista. I'm not really sure if it is part of .NET 3.0 framework, but on my XP SP2 box I could use the XPS viewer as well.

Currently the Adobe PDF format is still the default report format, but you can easily change that (and we will store your preferences in your user settings)

The main shortcoming I currently see with the XPS viewer is that you can not rotate a page.

Here are the results:
XPS: http://www.acumenbusiness.com/portals/Loan%20Mortgage%20Approval.xps
PDF: http://www.acumenbusiness.com/portals/Loan%20Mortgage%20Approval.pdf

Monday, June 04, 2007

Rule Manager 1.5.0.x is released

The new Rule Manager (1.5.0.x) is released! There are many new features and enhancements. Here are some of the highlights:
  • Rule Validation; in the interactive rule map you can let the rules engine resolve any term.
    This starts an animated goal seeking process. The default waiting time is 0.5 sec. You can change this in the debug options.
  • Panning and zooming of the interactive rule map.
  • Creation of business rules and business terms are completely accessible during the trial period.
  • Export your rule policy to Windows Workflow Foundation, and you see the rules executing on top of Microsoft's Forward chaining rules engine. By default the rule tracing is on. You can see the rule execution in the output console of Visual Studio.
Existing users can follow the internal update wizard (except that you need the .NET Framework 3.0)

New users can start the installation wizard that is available here.

Saturday, May 26, 2007

Suppress “A first chance exception of type…” Messages in VS 2005

When writing an API framework, it's good practice to throw appropriate framework exceptions. I have several extended application exceptions in my rule engine framework. When executing all unit tests, or just stepping through the development code, I would see hundred of messages in Visual Studio of 'A first chance exception of type' ...
This is just perfect behavior from my development point of view. I'm throwing these exceptions myself from the framework. I've made several attempts to find how to disable these messages. And finally I found the answer on Peter Macej blog:

How To Disable “A first chance exception of type…” Messages in VS 2005
So how do we suppress the messages? You most likely see these messages in
Immediate Window because you have set Redirect all Output Window text to the
Immediate Window in Tools - Options… - Debugging - General. That’s why when you
right-click in Immediate Window, you cannot see any option to disable messages.
It’s Output Window text and thus you need to set it in the Output Window. So
open Output Window, right-click and uncheck Exception Messages from context
menu. Simple but it took me one hour to find it.


It was just a simple context menu option on the Output window: Uncheck the 'Exception Messages'.

I was always trying to do this somewhere in the Debug \ Exceptions form. Well I'm glad I found it. It makes the Output windows trace less convoluted with irrelevant messages.

Thursday, May 17, 2007

WebCast about Windows Workflow Foundation Rules

Tomorrow, there is a free webcast by Kavita Kamani (Microsoft) about using the rules engine that is part of Windows Workflow Foundation. You can register for this event here.

Microsoft's rules engine is a bare bones forward-chaining rules engine. The rule engine can also be invoked without using the workflow engine. When you export a business rule policy from the Rule Manager, it will generate a C# solution that illustrates how rules are invoked without the workflow engine.

Start Date: 5/18/07
Start Time: 2:00 PM (GMT-05:00) Eastern Time (US & Canada)
End Time: 3:30 PM (GMT-05:00) Eastern Time (US & Canada)

Friday, March 30, 2007

Rule Validation Video

The Rule Manager will soon be enhanced with a new feature that allows the Interactive Rule Map as a Rule Debugger. See a video here: Rule Validation Video. It almost became an action movie :).

This is part one of providing Rule Validation (that is: testing your rules) with the Rule Manager.


Color legend for Rule:
  • Green: Rule fired
  • Red: Rule failed
  • Orange: Rule is pending

Color legend for Term:

  • Green: Term is assigned
  • Orange: Term is unknown

How it works? We use the backward chaining algorithm to resolve a goal. The user can select any business term as a goal.

  • When the user clicks resolve, the inference engine will try to resolve this goal by executing the rules.
  • When a term is encountered that can not be derived from other rules, an ask dialog will be shown to the user. The user value will be stored into an internal table, so consecutive runs will first use this table before asking the user. Internally the rule manager supports defining restrictions on business terms. This allows the inference engine to show input options when asking a value for a term.

About the user data value table:

  • The table can be cleared by clicking on 'Reset All Values' from the context menu.
  • You can change the value of one particular term by selecting the 'Reset Term' on the Term context menu.
  • Note: also business terms that are inferred by the inference engine can be overwritten by the user. Be careful with this because this would skip the backward-chaining of this rule branch.

Saturday, March 24, 2007

13 years ago

Found my old research paper from 1994 "An object-oriented approach to knowledge representation in a biomedical domain". Looked like they scanned the contents of the original paper.

It's pretty outdated. Note that this was before the existence of Java or C#, but there was good old Smalltalk.

One thing is still relevant. The construction of a hybrid knowledge based system. Translated to 2007; the semantic web 3.0. Defining a clear terminological component (vocabulary) in order to make assertions from basic facts.

xdg-open; vscode acts as default application for html

Opening html files stopped launching the browser, but launched the vscode application. > xdg-mime query default text/html code-url-h...