Posts

Showing posts from May, 2010

ftp - how to write output channel from itemWriter in spring batch and spring integration? -

firstly attention, combined spring batch , spring integration, defined job flow , retrieve files ftp adapter , sent jobchannel, , process on spring batch , want write output channel , consume channel after processing, code is: <int-ftp:outbound-gateway id="gatewayget" local-directory-expression="'./backup/' +#remotedirectory" session-factory="ftpsessionfactory" request-channel="togetchannel" reply-channel="toprocesschannel" command="get" temporary-file-suffix=".writing" command-options="-p" expression="payload.remotedirectory + '/' + payload.filename"/> <int:channel id="toprocesscha

database normalization first normal form confusion - when should separating tables out -

Image
please consider academic view not practical engineering view. 1nf , 1nf only. considering unnormalized form below, primary key {trainingdatetime, employeenumber}, how make first normal form? if separate course, instructor , employee tables out separate tables, automatically become 3nf. ! if split different rows, like: but problem here obvious - primary key no longer valid. changing primary key {trainingdatetime, employeenumber, employeeskill} doesn't seems sensible solution. just make satisfy 1nf, need have seperate rows individual teaching skills. should ensuring higher normal forms satisfied splitting tables. 1 row should have teaching skill advanced php , second row advanced java , third row advanced sql , on same employee.

C++ .cpp file do not see variables from .h -

i have written program in c++. first have wrote (normally not write in c++) , wanted put variables in header , code in .cpp file. problem class in .cpp not see variales - "identifier undefined". a.h #include <iostream> #include <string> #include <cmath> #include <vector> using namespace std; class hex { private: int n; string value; bool negative = false; public: hex(); bool iscorrect(); string getvalue(); void setvalue(); }; a.cpp #include "a.h" #include "stdafx.h" class hex { public: hex(int n, string w) { //some implementation } //rest class } what i'm doing wrong? if important i'm working on vs 2013. you're defining class twice, once in header file , once in .cpp file. assuming want declare functions in header file , define them in .cpp file way go : header: #include <iostream> #include <string> #include <cmath> #include

weblogic12c - WELD-001409 , jbpm 6.1 -

i want deploy .war on weblogic 12c. use jbpm 6.1 in project. app very simple, sure there no error in code, error receive must libs imported project, config, or maybe incompatibility in app server , frameworks use. when want deploy on weblogic, receive error: org.jboss.weld.exceptions.deploymentexception: exception list 3 exceptions: exception 0 : org.jboss.weld.exceptions.deploymentexception: weld-001409 ambiguous dependencies type [executorservice] qualifiers [@default] @ injection point [[field] @inject private org.jbpm.executor.impl.executorservicelifecyclecontroller.executorservice]. possible dependencies [[producer method [executorservice] qualifiers [@any @default] declared [[method] @produces public org.jbpm.executor.impl.mem.inmemoryexecutorserviceproducer.produceexecutorservice()], producer method [executorservice] qualifiers [@any @default] declared [[method] @produces public org.jbpm.executor.impl.jpa.jpaexecutorserviceproducer.produceexecutorservice()]]] @ org.j

Maven multiple parent-child hierarchy -

i have project built in next manner: parent module named production , holds 2 modules named apps , libs , each of them holds various projects. production apps common utils libs api dev production pom <groupid>com.prod</groupid> <packaging>pom</packaging> <modules> <module>libs</module> <module>apps</module> </modules> apps pom <parent> <groupid>com.prod</groupid> <artifactid>apps</artifactid> </parent> <modules> <module>common</module> <module>utild</module> </modules> where packaging of production , apps , libs pom . while packaging rest war / jar . when try run mvn install on production (or other module/project) non-resolvable parent pom: failure find only when run mvn install -n on production , apps , libs , can start working projects. is there better way accompl

c# - IClientMessageInspector not working in WCF -

i have class messageinspector implements iclientmessageinspector. namespace wcfauthentication { public class messageinspector : iclientmessageinspector { public void afterreceivereply(ref system.servicemodel.channels.message reply, object correlationstate) { //throw new notimplementedexception(); debug.writeline("iclientmessageinspector.afterreceivereply called."); debug.writeline("message: {0}", reply.tostring()); } public object beforesendrequest(ref system.servicemodel.channels.message request, system.servicemodel.iclientchannel channel) { //throw new notimplementedexception(); debug.writeline("iclientmessageinspector.beforesendrequest called."); return null; } } } i have configured in web.config of wcf : <?xml version="1.0"?> <configuration> <appsettings> <add key="asp

html - Centered, boxed math(s) equations -

i'm trying make centered, boxed math(s) equations using mathml part of html5. problem boxes. if put border on div element, border tall enough, extends way left , right sides of screen. if put border on math element, right width, isn't tall enough elements inside multiline table. <div align="center" style="border: 1px solid #000;"> <math style="border: 1px solid #000;"><mi>x</mi><mfenced open="{" close=""><mtable> <mtr><mtd><mtext>row 1</mtext></td></mtr> <mtr><mtd><mtext>row 2</mtext></td></mtr> </mtable></mfenced></math> </div> why elements have such strange sizes? shouldn't both size of contents? how can create box big enough contain text, without giving element explicit size? (apologies lack of image. uploaded one, don't have proper reputation post it.) thanks.

php - Real-time chatting and notifications in laravel 5 -

i need implement real-time chatting , real-time notifications in application. best way using laravel-5? suggest me packages or expert views on them. for real time chat need use asynchronous websockets. you can try library https://github.com/ratchetphp/ratchet laravel 5.2 chat and project github.com/assertchris/tutorial-laravel-4-real-time-chat good library github.com/brainboxlabs/brain-socket also amazing tutorial socket io www.codetutorial.io/laravel-5-and-socket-io-tutorial/ video example ajax , laravel 4 https://www.youtube.com/watch?v=gldjgbbbvog

g++ - Overloading function in C++ as unsigned char and unsigned int result in ambiguous -

i have overloaded functions: void wypisz(unsigned int32 x, int n = 1); void wypisz(unsigned char x, int n = 1); here code rise them: main() { wypisz((int32)(32), 7); wypisz('a', 7); return 0; } and when try compile using g++ error: test.cpp: in function ' int main() ': test.cpp:10:21: error: call of overloaded ' wypisz(int, int) ' ambiguous wypisz((int)(32), 7); test.cpp:10:21: note: candidates are: test.cpp:5:6: note: void wypisz(unsigned int, int) void wypisz(unsigned int x, int n = 1); test.cpp:6:6: note: void wypisz(unsigned char, int) void wypisz(unsigned char x, int n = 1); when remove unsigned compile fine. is there way call method - wha ti should change in call statement? unfortunatelly can not change in declaration = must stay are. the problem that, in function call, casting int32 , neither unsigned char nor unsigned int32 . in fact, implicitly castable either of them (the compiler ca

c# - Bitmap from Drawing not render outside of Load_Form -

i'm trying render bitmap created drawing screen render after minimize , maximize again. i follow these steps: using bitmaps persistent graphics in c# but can render bitmap in screen outside of load_form. if put code: using system.drawing; ... graphics graphicsobj; mybitmap = new bitmap(this.clientrectangle.width, this.clientrectangle.height, imaging.pixelformat.format24bpprgb); graphicsobj = graphics.fromimage(mybitmap); pen mypen = new pen(color.plum, 3); rectangle rectangleobj = new rectangle(10, 10, 200, 200); graphicsobj.drawellipse(mypen, rectangleobj); graphicsobj.dispose(); in other place, example button, need minimize , maximize see image. edit: bmp bitmap global variable create instance in form event load_form1 bmp = new bitmap(this.clientrectangle.width, this.clientrectangle.height, system.drawing.imaging.pixelformat.format24bpprgb); paint event of form redraw: private void form1_paint(object

android - JSONObject cannot be cast to com.parse.ParseGeoPoint -

i saving geopoint in jsonobject using: jsonobject obj=new jsonobject(); jsonarray ja=new jsonarray(); if(lx.size()==0){ toast.maketext(ctx, "no location upload now", toast.length_long).show(); } else{ for(int uq=0;uq<lx.size();uq++){ double latit=lx.get(uq).getlatit(); double longit=lx.get(uq).getlongit(); parsegeopoint pgpoint=new parsegeopoint(latit,longit); ja.put(pgpoint); } try { obj.put("locations",ja); } catch (jsonexception e1) { // todo auto-generated catch block e1.printstacktrace(); } after sending jsonobject parse cloud. po.put("historyfile", obj); po.saveinbackground(new savecallback() { now tried this: jsonarray locations; parsegeopoint

java - Generic DAO in Spring Web Development -

how can set these codes in dao layer generic in order me avoid code redundancy , efficiently use simple set of codes in multiple circumstances using spring web development? iteminfodao.xml <select id = "getitem1" resultmap="resultitem1"> select item_id, name, area item1 </select> <insert id="insertitem1"> insert item1 (item_id, name, area) values (#{itemid}, #{itemname}, #{itemarea}) </insert> <select id = "getitem2" resultmap="resultitem2"> select item_id, name, area item2 </select> <insert id="insertitem2"> insert item2 (item_id, name, area) values (#{itemid}, #{itemname}, #{itemarea}) </insert> iteminfodao.java list<package> getitem1(package package); void insertitem1(package package ); list<box> getitem2(box box); void insertitem2(box box); use spring-data-jpa avoid boilerplate code simple db crud ope

asp.net mvc - Track last user login with ASP MVC Identity 2.0 -

what´s best place track last login date user? web app supports cookie authentication, external authentication google / facebook , old username / password auth. needs done somewhere deep in system. first accountcontroller.signinasync looked idea, doesnt seem called on cookie authentication. ideas?

javascript - log file redirection in node js -

i writing socket server in nodejs using websocket library, have requirement if give logfilename in server.js argument logs should redirected logfile otherwise should displayed on console. it seems trivial issue new node js, can guys me how acheive it. you can try using library. has file transport logger. https://github.com/winstonjs/winston

inheritance - Trouple accessing python superclass attributes -

this question has answer here: python method name double-underscore overridden? 2 answers i have 2 classes loosely take form below: class foo: def __init__(self, foo): self.__foo = foo class bar(foo): def bar(self): print self.__foo when try invoke bar method on instance of bar , fails. b = bar('foobar') b.bar() result: traceback (most recent call last): file "foobar.py", line 14, in <module> b.bar() file "foobar.py", line 10, in bar print self.__foo attributeerror: bar instance has no attribute '_bar__foo' my understanding code should work based on two other questions, why doesn't it? simple. __foo contains 2 underscores in beginning, it's assumed class-private method , it's transformed _classname__method . when request access attribute named

non linear regression - Genetic algorithm for parameter estimation -

i use genetic algorithm function in ga package parameter estimation in nonlinear model. use simulation data, of variables have multicolinearity problem. when use ga function, found parameter estimated ga function biased. can explain me why happened? solution estimate parameter using ga function multicolinearity data? thanks. library("lestat") beta1<-c(0.1835,0.5932,-0.0065,0.4153,-0.0431) beta2<-c(0.1,0.2,0.3,0.4) corr<-matrix(1:64,8,8) (i in 1:8){ (j in 1:8){ ifelse (i==j, corr[i,j]<-1, corr[i,j]<-0.8) } } corr dist<-mvrnorm(10000,rep(50,8), corr) dist pop1<-dist[,1] pop2<-dist[,2] pop3<-dist[,3] pop4<-dist[,4] pop5<-dist[,5] pop6<-dist[,6] pop7<-dist[,7] pop8<-dist[,8] resp<-exp(beta1[1])*(pop1^beta1[2])*(pop2^beta1[3])*(pop3^beta1[4])* (pop4^beta1[5])*(pop5^beta2[1])*(pop6^beta2[2])*(pop7^beta2[3])* (pop8^beta2[4])+e popgab2<-data.frame(resp,pop1,pop2,pop3,pop4,pop5,pop6,pop7,pop8) popg

javascript - Accessing HTML attributes inside Listener Function -

i'm trying access custom html attribute within function attached event listener far have been unable work. i'm not sure how correctly reference target element. currently have: <td id= "kayak1" data-picid="1"><img src= "thumbnail.jpg"></td> a listener: var cat1 = document.getelementbyid("kayak1"); cat1.addeventlistener("dblclick", showcatpix); and function: function showcatpix () { var picselect = this.getattribute("data-picid"); switch(picselect) { case 1: var catpix = document.getelementbyid("showcatpics"); catpix.src ="cat_kayak.jpg"; break; } } the event calling function correctly showcatpix isn't accessing picid attribute , nothing being displayed. tried using this.dataset.picid. didn't work either. tips on how correctly reference property great. the picselect retrieved dom attribute str

Round Robin C scheduling simulator -

i making simulator round robin scheduling algorithm in c. right made time quantum 2. every 2 seconds takes "process" front of list, reduces remaining time 2, , sticks end of list , grabs next one. also, every second, increases others' waiting time 1. when try remove process front of list (so can put in end of list) in function round_robin() , removes it. not append end of linked list. doing wrong? thank you! using command line arguments : ./a.out input.dat text.txt 5 0.4 and here input.dat : 1 0 10 50 2 2 0 40 3 3 20 50 4 4 7 35 5 5 10 50 6 6 0 40 7 7 20 50 8 9 7 35 9 10 10 50 10 12 0 40 and here code: #include <stdio.h> #include <stdlib.h> #include <string.h> #define n 10 char *crr;//get argument rr time char *calpha;//get argument alpha int full[40]; int arraylength; int rr;//to hold rr time int int i=0;//used count amount of numbers in test file double alpha;//hold alpha time double int at[n]; int global_timer=-1; typed

ios - If - else in Swift -

i can alert show, has problems: the title not appear i can't if statement part work. alert pops showing only: the message numbers must 24 or less along close button , never changes. using xcode 6.3 , ios 8. var title: string! if difference > hourslabel { title = "sorry!" } else if difference < hourslabel { title = "that's better!" } let message = "number must 24 or less" var alert = uialertcontroller(title: title, message: message, preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "close", style: .default, handler: nil)) self .presentviewcontroller(alert, animated: true, completion: nil) based on provided, seems problem using else if , rather else only solution 1: var title: string! if difference > hourslabel { title = "sorry!" } else { title = "that's better!" } solution 2: let title = (difference > hourslabel

java - Converting strings to integers from an array of strings -

i'm trying convert strings array integers using parseint(). reading in lines many separate files this: car,house,548544587,645871266 i have code below: string [] tokens = line.split(","); try { line = line.trim(); int = integer.parseint(tokens[2]); int b = integer.parseint(tokens[3]); int c = (b - a); system.out.println(c); } catch (numberformatexception e) { system.out.println(e); } but fails errors this, each line read in: java.lang.numberformatexception: input string: "548544587" java.lang.numberformatexception: input string: "645871266" any idea might missing? you need remove quotes before splitting. fails convert "number" actual number because of quotes. string line = "\"car\",\"house\",\"548544587\",\"645871266\""; string[] tokens = line.replace("\"", "").

android - java.util.zip.ZipException: duplicate entry -

i have been battling error day in android studio. project imported eclipse solution. have been trying implement fixes listed similar posts, nothing working. android beginner. i happy provide further information. error:execution failed task ':app:packagealldebugclassesformultidex'. java.util.zip.zipexception: duplicate entry: com/google/zxing/barcodeformat.class please help!! should try run in eclipse? // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.2' } } allprojects { repositories { jcenter() } } apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.appname.android" minsdkversion 8 targetsdkversion 18 multidexenabled

javascript - Firebase: Push Item in If Statement -

i'm trying work out why function isn't pushing item object availableproviders array within if statement. serviceproviders.on('value', function(snapshot) { var availableproviders = []; snapshot.foreach(function(childsnapshot) { var key = childsnapshot.key(); providers.on('value', function(snap) { if (snap.haschild(key)) { var item = snap.child(key); availableproviders.push(item); } }); }); console.log(availableproviders); }); for reason console.log @ end returns empty array. any reason why item isn't being pushed. appreciated. in advance!

c++ - Removing element from dynamic list -

i have dynamic list, current spot, a-> prev - previous element, a-> next - next element, need delete 1 element of list (and set previous/next of adjacent elements 1 another) if(a->va == var && a->pa == pav){ -> prev -> next = -> next; -> next -> prev = -> prev; delete a; } you have handle edge cases. if found element first 1 in list, a -> prev null. similarly, if it's last, a -> next null.

php - Print only part of values or to a specific character -

i have in mysql table column "class" , in items : ds1 (1 koera toukerattavedu al.14 a.) dck1 (koerakross, lapsed 6-9) dbw (jalgrattavedu, naised al.16 a.) dr4 (3-4 koera käruvedu, al.16 a.) dr6 (4-6 koera käruvedu al. 16 a.) dck2 (koerakross, lapsed10-13 a.) etc.. with print '<td>' .$row["klass"].'</td>'; prints whole text. can print somehow until "(" ? to display : ds1 dck1 dbw etc... you use preg_replace remove entire paranthesis : function removeparanthesis($text) { return preg_replace('/\s*\([^)]*\)/', '', $text); } print '<td>'.removeparanthesis($row["klass"]).'</td>'; would give desired output.

android - very large background textures -

for game i'm developing must use large background images. these images around 5000x3000. when attempting display single texture black boxes in gwt , android. created class splits image grid of textures: public class largeimage extends loadablegroup { private boolean smooth=true; public string filename; private int truewidth,trueheight; private arraylist<image> tiles=new arraylist<image>(); private arraylist<texture> textures=new arraylist<texture>(); private final int maxtexturesize = 512; public largeimage(string filename, callbackassetmanager manager) { super(); this.filename=filename; pixmapparameter param=new pixmapparameter(); param.format=pixmap.format.rgba8888; addasset(new assetdescriptor(filename, pixmap.class,param)); manager.add(this); } public largeimage(pixmap map, boolean smooth) { super(); this.smooth=smooth; frompixmap(map); } public void loaded(callbackassetmanager manager) { if(!manager.isloa

sql - Inserting values of a column from one dataframe to another while respecting a given condition -

i have 2 data frames d1 , d2 . d2 has column contains data prefer added d1 . each of data frames have equal number of rows , columns. > d1 t1 t2 numvehicles avgbyrunrep 1 0.2 0.3 10 225.5000 2 0.2 0.4 10 219.6667 3 0.2 0.5 10 205.1667 4 0.2 0.6 10 220.6667 5 0.2 0.7 10 205.1667 > d2 t1 t2 numvehicles avglostperrep 1 0.2 0.3 10 14.333333 2 0.2 0.4 10 9.000000 3 0.2 0.5 10 8.000000 4 0.2 0.6 10 8.000000 5 0.2 0.7 10 6.833333 so values in d2 's avglostperrep column "transferred" d1 matching t1 , t2 , numvehicles . so in end d1 like: > d1 t1 t2 numvehicles avgbyrunrep avglostperrep 1 0.2 0.3 10 225.5000 14.333333 2 0.2 0.4 10 219.6667 9.000000 3 0.2 0.5 10 205.1667 8.000000 4 0.2 0.6 10 220.6667 8.000000 5 0.2 0.7

actionscript 3 - Rotate object around centre? -

Image
i'm working on project , need wheel rotates mouse movement, i've made wheel rotate mouse, rotates around corner, not center. what code can add make rotate around center? this code i'm using far: var dx : number; var dy : number; stage.addeventlistener( event.enter_frame, checkmouse ); function checkmouse( evt : event ) : void { dx = mousex - rota.x; dy = mousey - rota.y; rota.rotation = (math.atan2(dy, dx) * 180 / math.pi); } you'll ever rotating object around origin, , origin can't moved. however, can move child object rest @ center of parent's origin. when rotating parent, child appears move around own center. programmatically, if wheel child of rota , you'd following... wheel.x = -wheel.width/2; wheel.y = -wheel.height/2; rota.rotation = (math.atan2(dy, dx) * 180 / math.pi)

javascript - binding not refreshing in angularjs -

i'm using angularjs , need update content of html after user logged in. in fact html load controller once when load page, meaning when user not yet logged. after login html did not refresh page display user's login? how can fix that. below html <section class="hero hero-1 hero-small" ng-controller="homecontroller"> <header class="navbar" role="navigation"> <div class="container" ng-controller="usercontroller"> {{username}} <nav> <a class="navbar--logo" ui-sref="home">espritacademy</a> </nav> <nav> <ul class="navbar--list pull-right"> <li class="navbar--list-item"><a ui-sref="#">features</a></li> <li class="navbar--list-item"><a ui-sref=&q

mysql - htaccess rewrite subdomain for image directory -

so duplicated , installed existing wordpress site on server , linked subdomain: sub.domain.com after finished work put on main domain problem every image on site has url sub.domain.com/wp-content/... instead of domain.com/wp-content/... , doesnt displayed. is somehow possible rewrite url using htaccess images displayed or need change every single url on every image via mysql? my htaccess approach like: rewriteengine on rewritecond %{http_host} ^(.*)\.domain\.com rewriterule ^(.*)$ http://www.domain.com/$1 [l,nc,qsa] if doesnt work, how can in mysql? every link in database automated overwrite i not use rewrite this. pretty messy. if links stored in db update in mysql. can 1 easy replace command. update your_table set your_field = replace(your_field, 'http://sub.domain.com', 'http://www.domain.com') your_field '%http://sub.domain.com%' always db before doing special updates this.

c# - Adding SelectListItem manually to SelectList to use in DropDownListFor -

Image
when create seleclist wish able add seleclistitem's manually , use code: list<selectlistitem> provinces = new list<selectlistitem>(); provinces.add(new selectlistitem() { text = "northern cape", value = "nc" }); provinces.add(new selectlistitem() { text = "free state", value = "fs" }); provinces.add(new selectlistitem() { text = "western cape", value = "wc" }); selectlist lstprovinces = new selectlist(provinces); instead of : var lstprovinces = new selectlist(new[] { "northern cape", "free state", "western cape" }); after created selectlist, pass dropdownlistfor via viewbag : html.dropdownlistfor(m => m.startpointprovince, (selectlist)viewbag.provinces) however when create selectlist using first method, doesn't work - adds 3 values dropdown list, values display as: *screenshot of output however when use second method, works fine. wish use first method be