Tuesday, 15 March 2011

java - messageReceived not called -



java - messageReceived not called -

i've created class called messagehandler:

@override public void initchannel(socketchannel ch) throws exception { ch.pipeline().addlast( new logginghandler(loglevel.info), new gameserverhandler()); ch.pipeline().addlast("protobufhandler", new messagehandler()); }

also, added messagereceiver function, can't override documentation says because gives me error:

public class messagehandler extends simplechannelinboundhandler<object> { // @override public void messagereceived(channelhandlercontext ctx, object msg) { system.out.println(msg); // super.messagereceived(ctx, msg); } @override public void exceptioncaught(channelhandlercontext ctx, throwable cause) { cause.printstacktrace(); ctx.close(); } @override protected void channelread0(channelhandlercontext arg0, object arg1) throws exception { // todo auto-generated method stub } }

but messagereceived function never called:

info: [id: 0xbb603bfd, /127.0.0.1:54206 => /127.0.0.1:5000] active oct 07, 2014 10:48:49 pm io.netty.handler.logging.logginghandler logmessage info: [id: 0xbf711f5f, /127.0.0.1:54205 => /127.0.0.1:5000] received(383b) // message printed netty logger, not function.

i netty 4.x method need override , set system.out.println(...) stuff in channelread0(...). in netty 5 messagereceived(...).

java netty

c# - How to store meta data in a SQL Server database to differentiate it from other databases? -



c# - How to store meta data in a SQL Server database to differentiate it from other databases? -

i have scenario need show many databases kind of database, done querying see if database has 4 tables:

select case count(*) when 4 'true' else 'false' end sys.tables upper(name) in ('a', 'b', 'c', 'd')

if returns true right db , should show in list. question is, other alternatives there storing sort of meta info access developer, c# decide more (instead of querying every single db) , accurately (someone might add together tables) if right database?

sql server objects have got extended properties associated them purpose. can set extended properties. covered in link http://technet.microsoft.com/en-us/library/ms190243(v=sql.105).aspx.

sp_addextendedproperty @name='isofinteresttome', @value=1

will create extended property of name , value on current database.

c# sql-server database metadata

plsql - Sync between two tables and show the result in an oracle function -



plsql - Sync between two tables and show the result in an oracle function -

i making oracle function sync values between 2 tables , intention show string show how many rows affected , displays when user execute function.

my function creation this

create or replace function weltesadmin.dum_mst_sync(projname in varchar2) homecoming number num_rows number; begin merge master_drawing dst using (select weight_dum, head_mark_dum dummy_master_drawing) src on (dst.head_mark = src.head_mark_dum) when matched update set dst.weight = src.weight_dum dst.project_name = src.project_name_dum , dst.project_name = projname; dbms_output.put_line( sql%rowcount || ' rows merged' ); end;

if execute begin part in toad or sql developer can see how many rows affected. target collect function procedure , when user wants sync tables need run procedure projname value supplied specific project.

please help me on how improve code, best regards

you can utilize sql%rowcount number of rows affected merge. add together next statement in code after merge :

dbms_output.put_line( sql%rowcount || ' rows merged' );

to homecoming value, declare number variable , assign sql%rowcount value it. , homecoming value. :

function ....... homecoming number ....... num_rows number; ...... begin merge.... num_rows := sql%rowcount; homecoming num_rows; end;

and, don't need procedure execute function. can execute in sql :

select function(project_name) dual /

update since op trying utilize dml within function, need create autonomous transaction able perform dml without raising ora-14551.

you utilize directive pragma autonomous_transaction. run function independent transaction able perform dml without raising ora-14551. however, remember, results of dml committed outside of scope of parent transaction. if have single transaction, utilize workaround suggested. add, pragma autonomous_transaction; after return statement before begin.

create or replace function weltesadmin.dum_mst_sync( projname in varchar2) homecoming number num_rows number; pragma autonomous_transaction; begin merge master_drawing dst using (select weight_dum, head_mark_dum dummy_master_drawing ) src on (dst.head_mark = src.head_mark_dum) when matched update set dst.weight = src.weight_dum dst.project_name = src.project_name_dum , dst.project_name = projname; num_rows := sql%rowcount; commit; homecoming num_rows; end; /

oracle plsql

tags - How to manually push stack entry into vim tagstack? -



tags - How to manually push stack entry into vim tagstack? -

just title says: "how manually force stack entry vim tagstack?"

here problem: have been using gtags/global + unite.vim plugins while (btw, these 2 plugins awesome!), failed automatically insert tag entry tagstack. there way prepare it?

in confidential lh-tags plugin, have lh#tags#jump() function utilize inject tags , jump them.

i know there bug happens sometimes, of time, works enough.

nb: lh-tags depends on 2 other plugins, see addon-info file.

vim tags

java - VS-Android produces "wrong" names when linking to shared libraries -



java - VS-Android produces "wrong" names when linking to shared libraries -

i'm using vs-android build ndk program. have 2 libraries, "bridge" , "utils", , first 1 uses sec one. both libraries compile succesfully , files named correctly libbridge.so , libutils.so. however, when seek load files, unsatisfiedlinkerror saying libbridge.so cannot access liblibutils. why trying search liblibutils?

here's java code utilize load libraries:

static { system.loadlibrary("utils"); // loads ok system.loadlibrary("bridge"); // found causes unsatisfiedlinkerror }

the exact error is:

java.lang.unsatisfiedlinkerror: dlopen failed: not load library "liblibutils" needed "libbridge.so"; caused library "liblibutils" not found

both library files located in same folder:

(projectfolder)/libs/armeabi-v7a/libbridge.so (projectfolder)/libs/armeabi-v7a/libutils.so

now, in visual studio, relevant output of linking phase of libutils.so this:

-o e:/ndkproject/debug/armeabi-v7a/libutils.so -lc -lm -llog -lgcc -wl,-soname,libutils

and relevant output of libbridge.so:

-o e:/ndkproject/debug/armeabi-v7a/libbridge.so -le:/ndkproject/debug/armeabi-v7a -lutils -lc -lm -llog -lgcc -wl,-soname,libbridge

the project properties libutils.so this:

target name: libutils 'soname' setting: $(targetname)

and libbridge.so:

target name: libbridge 'soname' setting: $(targetname) additional dependencies: -lutils

i'm baffled. "lib" come when bridge library tries utilize utils library? utils library load succesfully, , bridge library if don't link utils library , comment out calls stuff in utils library.

so far, i've tried alter target name "utils" instead of "libutils", doesn't work. i've tried utilize lib$(targetname) soname setting, doesn't work either.

i don't know why log mentions liblibutils, code should changed if want work on typical android system. reason libutils.so part of standard distribution, , sits in /system/lib. loadlibrary() , native loader, /system/lib takes precedence on app-specific lib directory, , libutils.so never had chance load. hence, unsatisfiedlinkerror inevitable.

use more unique name utils library, , loader happy.

java android c++ android-ndk vs-android

Empty objects using app.post and AngularJS + mongoose on node.js -



Empty objects using app.post and AngularJS + mongoose on node.js -

my rest api posting empty objects.

i getting value req.body.name

if log console.log(req.body.name); value on console.

post: { name: 'typing name', status: null } typing name

so workflow between frontend (angular.js), form , backend (node.js, express, mongoose) seems work. post value, empty object in mongodb.

{"_id":"543a50a974de6e2606bd8478","__v":0}

app.post('/api/offers', function (req, res){ var offer; console.log("post: "); console.log(req.body); console.log(req.body.name); offer = new offermodel({ name: req.body.name, value: req.body.value, title: req.body.title, content: req.body.content, }); offer.save(function (err) { if (!err) { homecoming console.log("created offer" + req.body.name); } else { homecoming console.log(err); } }); homecoming res.send(offer); });

and here model:

var offerschema = mongoose.schema({ offer : { name : string, value : string, title : string, content : string, image : string, start : string, end : string, targets : string, beacons : string, published : string } }); var offermodel = mongoose.model('offer', offerschema);

schema incorrect, must this:

var offerschema = mongoose.schema({ name : string, value : string, title : string, content : string, image : string, start : string, end : string, targets : string, beacons : string, published : string });

node.js angularjs mongodb express mongoose

sql - Sturctured Query Language -



sql - Sturctured Query Language -

create table customer( custno number(10) constraint foo primary key, custname character(15), city character(15), phone number(10)); create table invoice( invo number(10) constraint inv primary key, invdate date(10), constarint c references customer(custno));

i cannot able create sec table , having uncertainty of info type date , if neglected attribute(invdate) still cannot able create sec table.reason please.

create table client ( custno int constraint foo primary key ,custname character(15) ,city character(15) ,phone int ) go create table invoice ( invo int constraint inv primary key constraint ck references customer(custno) ,invdate date )

sql