יום ראשון, 3 במרץ 2013

03-03-2013

Camel

Component – Create endpoints based on the URI

file –> FileComponent –> FileEndpoints

EndPoint  - edge of a channel send and receive messages from and to the channel . creates producer consumer and exchange messages .

producer – Create and send messages to the endpoint

consumer –. Receive messages from the producer

Event driven consumer – async

Polling consumer – sync

Neo4j

graphdb.getNodeByID

Node.CreateRelationShipTo

Traversal.Descriptor.evaluator (new Evaluator ){

@override
public Evaluation evaluate (Path)



 


Redis


redis.multi do  -> Begin Transaction 


end


ZREVRANGE key start stop

Return the range of elements from the sorted set

Mget (*Keys ) –> return the values of all the specified keys

 


MongoDB


Try to fetch data in a single query  .

 

Embedded Linux 


make xconfig

$cp.config.old.config

physical address

bus address

virtual address  

address translation macros


virt_to_phys


Translation look aside buffers –> tlb


kmalloc , kfree


start_kernel main.c


setup_arch


setup_processor


Microsoft surface


TagVisualizer


 


 


 


 


 


 



יום שבת, 2 במרץ 2013

DDD and control systems part 2

כאשר אני צריך entity כאן ועכשיו בתוך שיכבת ה Domain אני ניגש ל Entity Repository על מנת לבקש אותו .

כלומר כאשר ה Service שמטפל בהחזרה של ה שואב האבק הרובוטי לתחנת העגינה צריך את הEntity של תחנת העגינה או את הentity של השואב האבק הרובוטי הוא ניגש לEntityRepository על מנת לבקש את reference לobject שלהם .

ראיתי מספר גישות למימוש ה Entity Repository :

לייצר עבור כל סוג של Entity את ה EntityRepository משל עצמו .כאשר החיסרון של גישה זו הינה שיכולים להיווצר הרבה מאוד class ים של entities repositories כאשר לכל אחד תפקיד מצומצם מאוד של להחזיק referance לEntity .

Capture4

לייצר Entity repository אחד מרכזי עבור כל ה Entities כאשר כאן החיסרון יכול להיות הפרה של עקרון ה Srp ומה קורה כאשר entities מוגדרים ב assemblies שונים ? אפשר להתחיל לסבך את המערכת .

Capture5

 

שיטה היברידית של חלק Entity Repository יעודי וחלק משותף המאפשר אגידה של concrete entities המיצגים את את התפקיד במימוש שונה

Capture6

02.03.2013

Android

Row , synthetic sensors

SensorManager   class

Sensor class

public boolean isAccelerometerSupported(Context context)
{
SensorManager sm = (SensorManager) context
.getSystemService(Context.SENSOR_SERVICE);
List<Sensor> sensors = sm.getSensorList(Sensor.TYPE_ACCELEROMETER);
return sensors.size() > 0;
}
SensorEvent.timestamp 
Sensor.getMinDelay ()
Sensor.getMaximumRange ()
Sensor.getResulotion ()
SensorEventListener 

Java SE


java 8 lambdas


List<Int>  theList =  Arrays.asList(1,2,3,4,16)
.stream()
.map(s -> "Hello " + s)
.collect(Collectors.toList());





 
 
SoccerService soccerService = (teamA, teamB) -> {
SoccerResult result = null;
if (teamA == teamB) {
result = SoccerResult.DRAW;
}
else if(teamA < teamB) {
result = SoccerResult.LOST;
}
else {
result = SoccerResult.WON;
}

return result;
};


 


Ruby 

sub and gsub (Replace all )
myStr = “test test”
myStr2 = myStr.sub (/te/ , “*”)
puts “#{mystr2}”
 
class Regexp
Regexp.new (“mm/dd”)
%{mm/dd}
=~ positive match 
!~ negative match 
 

Groovy


assert


class Book {



String titie


}


def gb = new Book ()


gb.SetTitle (“Mazal sadon”)


gb.Title = “my life”


Linux


struct cdev *my_cdex = cdev_alloc ();


cdev_add


cdev_del


The user-level library glibc.so has an implementation of the threads.


light-weight processes – representation of the user space thread in kernel space


 Each user-thread has a 1×1 mapping to an LWP


for each process its light weight process share the same group id allowing resource sharing

#include <sched.h>
int clone (int (*fn) (void *), void *child_stack, int flags, void *arg);



 


 

 

 

 

 

 

יום שישי, 1 במרץ 2013

DDD and control systems part I

משפט פתיחה קצת מסובך :

בניגוד למערכת IT שמסתובבות סביב ה DB ורק ל5% מהם מתאימה ארכיטקטורה של Domain driven Design (המטוטולוגיה כלומר ההתמקדות בdomain עם שפת ה domain מתאימה לכולם אבל שיכבת ה domain ב BLL עם ה Services , Entities and Value objects  מתאימה רק למקצת מפרויקטי ה IT ). הארכיטקטורה של DDD מתאימה לרוב פרויקטי שו”ב ומפשטת את המימוש של המורכבות שלהם .

ניקח כדוגמא את המערכת הבאה של שואב אבק רובוטי אשר נשלט על ידי מחשב Desktop .כלומר המשימה שלו (איזה חדרים לנקות , מתי להתחיל לפעול קבלת התראות על מצב הסוללה )נשלטת על ידי המחשב הDesktop אופן התזוזה של השואב  ההחלטה אם המגירה של ה אבק מלאה נשלטים על ידי מחשב פנימי .

blog1

 

Capture2

 

Domain

ב Domain driven design של המערכת הזו כאשר בוחנים את המורכבות  שלה סביר להניח שיש domain אחד שאחראי על כל הפעולות שלה .אולי אם המערכת היתה שולטת גם על הספריקלים של הכיסוי אש אולי היה טעם להפריד לשני domain ים שונים .

 

QCRS Query Command Responsibility segregation

בהתאם לעקרונות של QCRS אנו נפצל את המערכת לשניים :

חלק של Query :

שתפקידיו:

  • להציג מפה של הבית ובה מיקום השואב כרגע איזה חדרים נוקו כבר איזה חדרים צריך עוד לנקות מכשולים שמוגדרים מראש וכד
  • להציג גרף של ניקיון הבית באחוזים
  • להציג נתוני Data Mining איזה חדר היה הכי מלוכלך
  • להציג נתוני הפעלה של השואב כגון מד סיבובי מנוע , מצב המגירה של האבק באחוזים
  • להציג התראות כגון “קשה לי מצטער תנקה קודם כל קצת ידנית ואח”כ אני אכנס לפעולה בחדר הזה “

 

חלק של Command :

חלק שמאפשר לבעלת הבית לתת פיקוד ישירות לשואב אבק כדוגמת :

עזוב עכשיו מלשאוב את חדר השינה וחוש לנקות את החדר של הילדה (המורה הפרטי לאלגברה צריך לבוא עוד כרבע שעה ואם הוא יראה את הבלאגן שמה לא אדע איפה לקבור את עצמי מבושה )

חלק אשר מנצל את יכולתו החישובית של ה מחשב ה desktop ומנתח לפי הנתונים שזורמים מהשואב היכן כדאי לשואב לעבור עכשיו על מנת לעבוד יותר יעיל ,היכן בהסתמך על נתוני העבר האיזור היותר מגופגפ בבית שבו צריך לתת יותר גז בשאיבה וכד

את החלק של ה command אנו נתכנן ונבנה באמצעות DDD

Entitites

הEntities של המערכת יכולים להיות כדלקמן :

  • תחנת עגינה וטעינה
  • השואב הרובוטי עצמו
  • מכשול שאליו אסור להתקרב כדוגמת ואזה
  • חדר בבית (שאותו צריך לנקות )
  • הבית עצמו
  • תוכנית ניקוי
  • סוללה של השואב הרובוטי

לכל ישות ישנו id המורה על יחודיות לדוגמא תוכנית ניקוי עם id של תוכנית ניקוי קצרה לפני שהחותנת באה וכד

ה Entities  מכילים  State לדוגמא :

הישות של השואב הרובוטי מכילה את ה state של האם נוריות האזהרה דולקות , מצב המקום הפנוי בתא האבק וכד

וגם operational כדוגמת :

הדלק אורות

Value objects

  • כמות אבק במגירה
  • זמן עבודה נותר
  • כמות האנרגיה שנשארה לשואב הרובוטי

Aggregations

הישות סוללה של השואב הרובוטי מחוברת כ aggregate root של ישות השואב , אין לסוללה הזו משמעות ללא הקשר לשואב .

Services

אילו מרכיבים את לב הלוגיקה של המערכת ומכילים את הפעולות שלא ניתן לפנות אל entity ספציפי ולדרוש שיבצעם 

דוגמאות :

VCGotoDockingStationService

הפקודה לשואב הרובוטי לחזור לתחנת העגינה אינה יכולה להיות חלק מהישות של השואב הרובוטי עקב כך שהיא מכילה פניה למספר Entities שונים : תחנת העגינה , השואב עצמו , המחשולים שפזורים בדרך ועוד לכן העדפתי לממש אותה כService .

Capture3

 

יש עוד הרבה נושאים לדבר עליהם :

  • Repositories
  • Factories
  • השילוב של ה Domain layer בין השכבות של ה application , UI , ו Infrastracture
  • המימוש של המערכת

אם אקבל תגובות אשמח להמשיך לכתוב על הנושא

יום חמישי, 28 בפברואר 2013

28.02.2013

Linux

Struct file_operations

Struct file – represents open file

filp – file pointer f_mode (read , write )  , f_op  , f_pos , private data , inode

inode – represent file

i_rdev actual device number

i_cdev char device info  

process descriptor

struct tast_struct

process state –> task_running , task_interruptible , task_stopped (after signal )  task_traced (debug mode )

exit_state –> exit_zombie , exit_dead

multiplexed IO

select method waits for files to become ready (can be used to sleep )

gnome

gdk+

g_signal_connect

gdk_window_new

gdk_main

Tomcat

Tomcat class loaders

loads classes in the following hierarchy:

Bootstrap –> $java_home/jre/lib/ext + jvm

System –> $catalina_home base jars

common

Webappx –> class loaders for each web app

JAVA

getClassLoader –> every class after compilation has a property class that can retrieve the class loader

the class loader can load classes from the net or from byte array

Embedded Linux

 

LXR : Linux cross reference utility

Block drivers request struct blk_fs_request

physical memory

pg_data_t

config_page_data

The physical memory is divides to 3 parts :

Zone_DMA  , Zone_normal < 1G , Zone_Hight

http://www.makelinux.net/books/lkd2/ch11lev1sec2

mmu – memory managements unit

Kernel logic address –> 840Mb ממופה למקום קבוע

Kernel virtual address , user space , zero pages –> random opportunities

Spring

autowire = “constractor”

annotations of bean members :

@Required
@autowired –> the required can be cancel on the annotation

@qualifier

BeanInitializeException

Bash

$./myscript 3>&1 1&sdtout.log 2> &3 | tee –a stderr.log

ps –ax | tee processes.txt | more

OSGI

BundleActivator interface

context.RegisterService

Context.getServiceReferances

DDD

Refactoring

WIF

wif claims programming model

ClaimIdentity implements IIdentity

ClaimsPrincipal implements IIPrincipal

claim class

asp .net

OAuthWebSecurity

Spring integration

Gatway – sync , async

Allow to create a gateway to the channels in order to send messages

Service_Interafce = “<the interface >”

Service_Activator

maven

maven eclipse pluging

QT

require “qt”

class QTapp < qt::widget

def initialize

super

hotlable = qt::Label.new .self

 

MDX

The with statement allow to add calculation to the facts table

יום רביעי, 27 בפברואר 2013

27.02.2013

Sql server

@@Identity , Scope_identity

Ident_current

Sequence –

האפשרות לקבוע את הסדר של ההכנסה באמצעות שימוש ב over כאשר עושים insert into and select

php

parent::_construct

 

python

super (myClass ,self )._init_()

camel

Camel message model

message – unique identifier , headers attachments

body –> java.lang.object

Exchange   : envelop of the message that send over the channels

Routing engine , routes , dsl,  processor

neo4j

Cypher , gremlin neo4 traversal api

mysql

Load Data

on duplicate –> belong to create item

create table space

Redis

$redis = Redis.new (:timeout = 0 )

$redis.subscribe ( channels names ) do | on |

on.messsage do |chanell ,msg |

.

.

.

end

end

implements pub sub

Hadoop

class reducer

SetSortComperatorClass

SetGroupingComperatorClass

MongoDB

locks on the DB

read , write locks writes lock has a priory over read lock

Sharding – every instance has its on lock

CXF

cxf frontends – jax ws

contract or code first development

service endpoint interface sei

@Webservice jaxax.jws.webservice –> ServiceName , port name

@SoapBinding

@WebMethod

c++

move assignable

is_move_assignable

struct b

{

B(B&&) = delete ;

}

Regex

.

.{1,3}

http://Regexpal.com

? zero or one

Hibernate

@ManyToMany

@JoinTable

מוגדר ביחד עם ה Set

RabitMQ

ack messgae , reject a message

UPNP

When device become enable it send a multicast SSDP notify message

Control point – search for devices by sending SSDP M_SEARCH multicast message

Device description –> device data , services list

upnp control –> post http soap formating message

upnp eventing

upnp presentation –> http get page

 

 

 

 

יום שלישי, 29 בינואר 2013

אז מה היה לנו היום

עמית לעבודה ביקש ממני שאכתוב באיזה טכנולוגיות התעסקתי בכל יום אני לא בטוח שאצליח להתמיד בכך מעבר להיום אבל אנסה .

SQL SERVER

דבר ראשון היום עבדתי על פרויקט ב .net עם דרישה ל db די גדול (לא ענק אבל די גדול ) וזמני תגובה טובים .מכיוון שאין לנו נתונים גם לא מזויפים לdb בסדר גודל שהולך להיות ב production אנו משתמשים בטכניקה של update statistics על מנת לדמות לsql server את הסטאיסטיקטת שהולכות להיות לו ב production לצרכי בחינת ה execution plans השונים (בעיקר העיקריים שלנו)

UPDATE STATISTICS myTable (PK_myTable) WITH ROWCOUNT = 100000

את השיטה למדתי מבלוג post מצויין:

http://blogs.microsoft.co.il/blogs/nayatech/archive/2012/03/07/update-statistics.aspx

UPNP

באחד הפרויקטים שלנו אנו מריצים כעת poc שמשתמש ב פרוטוקול של upnp לטובת discovery של devices ברשת.הDevices הינם מבוססי linux embedded . ה poc נכתב כולו ב windows 7 הן ה server שימשיך להיות מפותח בwindows 7 והן ה devices שכרגע לצורכי ה poc בלבד נכתבו ב windows 7.

Domain driver design

פרויקט בשלבי התכנון נשאלתי לגבי מימוש של יחידה שתפקידה לשלוח איימילים איך זה מבוטא כ service ב ddd ואיך services אחרים צריכים לפנות אליו .

 

Android

נגעתי בבאג שטחן לנו את הסוללה בפרויקט שמבוסס על byod  בקטע קוד שתפקידו להפעיל network location provider לעדכון מיקום בסביבה של מבנה עם חללים פנימים .

 

Neo4J

פרויקט שנמצא בשלבי ארכיטקטורה מתקדמים כאשר למרות שיש בו צורך ב relational db עדיין אנו משלבים Neo4j ליצוג קשרים ב graph של ישויות. הפרויקט נכתב ב python

Cxf

הדגמתי שימוש ב Cxf ליצירת web service דגש על השילוב של Cxf ו Spring היום זה היה החלק הפשוט אך בהמשך אנו נצטרך לנגוע עמוק ב cxf עקב דרישות שאפרט בהמשך.

Wcf

עזרתי לפתור באג שנוגע ל דריסת נתונים ב server עקב זה שה methods סומנו כ OneWay ונקראו אסינכרונית על ידי ה service .

JNDI

עזרתי לתכנת לכתוב custom resource factory של jndi דבר די פשוט עם המימוש של

ObjectFactory 

 


Rubi


Ruby הינה שפת תיכנות די חדשה אצלנו עזרתי לתכנת להבין את הנושא של iterators ו block code


Linux


במערכת embedded שמפתחים אצלנו כרגע אנו כותבים block driver ל storage יחודי .