Posted on Leave a comment

Printing from Canon MF4150 printer using CUPS – Raspberry Pi Forums

I’m trying to print Canon ImageClass from my raspberry pi running raspbian jessie and from my iPad running iOS 10 using the manufacturers latest linux driver but I’m not having any luck. I have setup up the printer using CUPS, samba, avahi-daemon and avahi discover on the raspberry pi and used the manufacturers linux driver 3.31 of the CNCUPSMF4100ZS.ppd file in the CUPS configuration. I have shared the printer and installed the windows driver in a Windows 10 machine and I have no problem printing from windows 10 machine. At first I went to check the status of the printer in the CUPS printers page, it said ” IDLE – “File “usr/lib/cups/filter/pstoufr2cpca” not available: no such file or directory.” Then I copied the pstoufr2cpca directory from the manufacturers 3.31 linux driver to the /usr/lib/cups/filter/pstoufr2cpca and now I get this message ” Idle – “File “/Usr/lib/cups/filter/pstoufr2cpca” not available: Too many levels of symbolic links”.
Any suggestions? I would gladly appreciate it. … imageCLASS

Source: Printing from Canon MF4150 printer using CUPS – Raspberry Pi Forums

Posted on Leave a comment

Quicksort Algorithm – Cesar’s Tech Insights – Medium

“What is Quicksort?” This is another question you’ll face in almost every tech job interview. Quicksort it is probably the most used sorting algorithm because it’s easy to implement on average, gives high efficiency for large-data applications, it can be optimized for different needs and it’s relatively flexible on it’s input data.

Quicksort is a logarithmic-time algorithm, in other words, it has a Big O notation of O(log n)-(more about Big O Notation)- and depending on the way you implement it, it can be up to 2x or even 3x faster than Merge Sort or Heap Sort. Do note that the O(log n) speed is a best-case/average time, in worst case scenarios it can be O(n2) depending on the implementation.

Let’s explore one implementation of Quicksort using JavaScript (ECMA6):

const quickSort = list => {
  if (list.length < 2) 
    return list;  let pivot = list[0];
  let left  = []; 
  let right = [];  for (let i = 1, total = list.length; i < total; i++){
    if (list[i] < pivot)
  }  return [

Quicksort uses recursiondivide-and-conquer and comparison-sort. It works by partitioning an array into two sub-arrays and then recursively sorting those arrays independently. To make it clear, let’s put this in 3 main steps:

  • Choose the pivot (reference value).
  • Divide the rest of the array in two, placing everything smaller than the pivot on the left and greater than the pivot on the right.
  • Recursively apply the previous steps to the sub-arrays if they have more than 1 element.

In the following chart you can see our example algorithm in action; pivots are green, left arrays are red, and right ones are blue.

quickSort( [6,3,8,4,5,2,9,33,12,64]) = [2, 3, 4, 5, 6, 8, 9, 12, 33, 64]

Another great advantage of Quicksort is that it can be implemented using task parallelism, so, with some tweaking of the code it can be used to get a great performance boost in multi-core processing or even better, GPU processing for extreme performance.

Although JavaScript is a single-threaded language, if your application requires a lot of power, you can enable parallel high-performance GPU processing via WebCL or use NodeJS and a library called node-cuda, the latter allows you to use NVIDIA CUDA™ -although you need an NVIDIA CUDA-enabled GPU-, but with hundreds of compatible models, you probably can get some science out of your current gaming computer!

Source: Quicksort Algorithm – Cesar’s Tech Insights – Medium

Posted on Leave a comment

.NET Design Patterns in C# and VB.NET – Gang of Four (GOF) –

Design patterns are solutions to software design problems you find again and again in real-world application development. Patterns are about reusable designs and interactions of objects.

The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral (for a complete list see below).

To give you a head start, the C# source code for each pattern is provided in 2 forms: structural and real-world. Structural code uses type names as defined in the pattern definition and UML diagrams. Real-world code provides real-world programming situations where you may use these patterns.

A third form, .NET optimized, demonstrates design patterns that fully exploit built-in .NET 4.5 features, such as, generics, attributes, delegates, reflection, and more. These and much more are available in our .NET Design Pattern Framework 4.5. You can see the Singleton page for a .NET 4.5 Optimized example.

Source: .NET Design Patterns in C# and VB.NET – Gang of Four (GOF) –

Posted on Leave a comment

programming languages – What is early and late binding? – Software Engineering Stack Exchange

There are two major concepts in confusion: binding and loading. It is conflated by the concept of DataBinding, which is somewhere in the middle often doing both. After considering it, I am going to add one more concept, to complete the trifecta, dispatch.


Late Bindingtype is unknown until the variable is exercised during run-time; usually through assignment but there are other means to coerce a type; dynamically typed languages call this an underlying feature, but many statically typed languages have some method of achieving late binding

Implemented often using [special] dynamic types, introspection/reflection, flags and compiler options, or through virtual methods by borrowing and extending dynamic dispatch

Early Bindingtype is known before the variable is exercised during run-time, usually through a static, declarative means

Implemented often using standard primitive types


Static Dispatchknown, specific function or subroutine at compile time; it is unambiguous and matched by the signature

Implemented as static functions; no method can have the same signature

Dynamic Dispatchnot a specific function or subroutine at compile time; determined by the context during execution. There are two different approaches to “dynamic dispatch,” distinguished by what contextual information is used to select the appropriate function implementation.

In single [dynamicdispatch, only the type of the instance is used to determine the appropriate function implementation. In statically-typed languages, what this means in practice is that the instance type decides which method implementation is used irrespective of the reference type indicated when the variable is declared/assigned. Because only a single type — the type of the object instance — is used to infer the appropriate implementation, this approach is called “single dispatch”.

There is also multiple [dynamicdispatch, where input parameter types also help determine which function implementation to call. Because multiple types — both the type of the instance and the type(s) of the parameter(s) — influence which method implementation is selected, this approach is dubbed “multiple dispatch”.

Implemented as virtual or abstract functions; other clues include overridden, hidden, or shadowed methods.

NB: Whether or not method overloading involves dynamic dispatch is language-specific. For example, in Java, overloaded methods are statically dispatched.


Lazy Loading: object initialization strategy that defers value assignment until needed; allows an object to be in an essentially valid but knowingly incomplete state and waiting until the data is needed before loading it; often found particularly useful for loading large datasets or waiting on external resources

Implemented often by purposefully not loading a collection or list into a composite object during the constructor or initialization calls until some downstream caller asks to see the contents of that collection (eg. get_value_at, get_all_as, etc). Variations include loading meta information about the collection (like size or keys), but omitting the actual data; also provides a mechanism to some runtimes to provide developers with a fairly safe and efficient singleton implementation scheme

Eager Loading: object initialization strategy that immediately performs all value assignments in order to have all the data needed to be complete before considering itself to be in a valid state.

Implemented often by providing a composite objects with all their known data as soon as possible, like during a constructor call or initialization

Data Binding: often involves creating an active link or map between two compatible information streams so that changes to one are reflected back into the other and vice versa; in order to be compatible they often have to have a common base type, or interface

Implemented often as an attempt to provide cleaner, consistent synchronization between different application aspects (eg view-model to view, model to controller, etc.) and talks about concepts like source and target, endpoints, bind/unbind, update, and events like on_bind, on_property_change, on_explicit, on_out_of_scope

Source: programming languages – What is early and late binding? – Software Engineering Stack Exchange

Posted on Leave a comment

object oriented – Does composition increase or decrease the coupling – Software Engineering Stack Exchange

To keep it simple, and as a rule of thumb (and not as laws graved in the marble), for lose coupling:

  • prefer composition over inheritance, because inheritance is always a strong coupling (any change in the parent class might require a change in all the child classes) and furthermore, it’s defined at compile time.
  • use interface segregation for the type you refer to, in order not to have a dependency on something you shouldn’t need to care about.
  • inject dependencies, in order to avoid implicit dependencies to specific constructors of specific types

Source: object oriented – Does composition increase or decrease the coupling – Software Engineering Stack Exchange