Posts

Showing posts from August, 2015

apache camel - How to stop file transferring in spring-batch -

i have created spring-batch job reading files local directory , upload remote directory through ftp using camel-spring-batch. doing same using chunk. spring batch job configuration looks : <bean id="consumertemplate" class="org.apache.camel.impl.defaultconsumertemplate" init-method="start" destroy-method="stop"> <constructor-arg ref="camelcontext"/> </bean> <bean id="producertemplate" class="org.apache.camel.impl.defaultproducertemplate" scope="step" init-method="start" destroy-method="stop"> <constructor-arg ref="camelcontext"/> </bean> <bean id="localfilereader" class="com.camel.springbatch.reader.localfilereader" scope="step" destroy-method="stop"> <constructor-arg value="file:#{jobparameters['dirpath']}"/> <constructor-arg ref="consumert...

c# - How to render MS date time JSON format in Razor files -

microsoft asp.net mvc's json serializer converts date time values "\/date(1239018869048)\/" . i have component on client side uses format show date-time picker. however, create date time values different sources: from json returned controller's action from values rendered in razor page the first source creates date times of required format, is, "\/date(1239018869048)\/" . however, second source renders date time in human-readable format, is, 7/31/2013 10:03:53 am . is there anyway create json serialized date formats in razor pages? json not define date format. however, date format used client side component number of milliseconds elapsed since 01 january 1970 00:00:00. produce expected output need compute number of milliseconds elapsed , can (assuming datetime contains date want convert): var epoch = new datetime(1970, 1, 1, 0, 0, 0, datetimekind.utc); var elapsedsinceepoch = datetime - epoch; var formatteddatetime = string.format(...

android - method called by javascript interface wont update view -

been stuck on while now. have webviewfragment has html file, created, loaded. in html file javascript allow me call methods in android application. here html: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <img src="guideline1.gif" usemap="#guideline9" border="0" /> <map name="guideline9" id="generalguideline9"> <area shape="rect" coords="124,329,290,357" onclick="android.testmethod();" /> </map> </body> </html> the webviewfragment code looks this: @suppresslint("javascriptinterface") public class mywebview extends webviewfrag...

Jquery Globalization -

i using mvc4.0 , jquery globalization plugin microsift " http://www.scottgu.com/blogposts/jqueryglobalizationdemos.zip " got " http://weblogs.asp.net/scottgu/archive/2010/06/10/jquery-globalization-plugin-from-microsoft.aspx ". plugin using amount formating e.g var result= $.format(1000, "c", "en-gb"); this plugin working fine when giving reference "glob.js" , "glob.all.js" files directly on page(view), when giving reference same files on master page crashing in jquery.validate.js file. $.each(params, function( i, n ) { source = source.replace( new regexp("\\{" + + "\\}", "g"), function() { return n; }); }); i getting error replace function undefined. please me. and, link latest version of microsoft jquery globalization plugin? thanks in advance the jquery globalization plugin microsoft has been accepted offical jquery plugin couple of years ago ( htt...

Android arduino communication via usb using adk mode -

i working on android , arduino application uses adk mode communication have implemented runnable in main activity , in run method of reading values , when reading finishes writing values arduino board , communication running infinite.i using handler updating gui application stops it's communication after sometime not able figure out problem? gui update in handler takes more time happening or else? following code receiving , sending data: while (true) { // read data try { int ret_read = 0; byte[] buffer_read = new byte[128]; ret_read = minputstream.read(buffer_read); (int p = 0; p < 2 * (nooffsensors); p = p + 2) { intlistvalues.add((int) composeint(buffer_read[p], buffer_read[p + 1])); log.d("jankari", "pu value : "+string.valueof((int) composeint(buffer_read[p], buffer_read[p + 1]))); } message mpu = message.obtain(mhandlerpusensors); mpu.obj = new valuemsgpusensors(...

java - Parallelizing many GET requests -

is there efficient way parallelize large numer of requests in java. have file 200,000 lines, each 1 needing request wikimedia. , have write part of response common file. i've pasted main part of code below reference. while ((line = br.readline()) != null) { count++; if ((count % 1000) == 0) { system.out.println(count + " tags parsed"); fbw.flush(); bw.flush(); } //system.out.println(line); string target = new string(line); if (target.startswith("\"") && (target.endswith("\""))) { target = target.replaceall("\"", ""); } string url = "http://en.wikipedia.org/w/api.php?action=query&prop=revisions&format=xml&rvprop=timestamp&rvlimit=1&rvdir=newer&titles="; url = url + urlencoder.encode(target, "utf-8"); url obj = new url(url); httpurlconnection con = (httpurlconnection) obj.openconnection()...

Determine if a Java class is a portable SE class -

i'm working on java code analyzer (ast stuff using trees api) , i'm trying create report on whether or not code being inspected makes use of non-portable apis. stuff sun packages , such should cause warning. defined list of se 7 portable classes? there more machine parsable se javadocs? if javadocs "the" portable listing how generated java source openjdk? portable code kept separate or ...? the core se classes defined 1 of files used in jdk build process can found at: https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/make/docs/core_pkgs.gmk # core_pkgs list of packages form # java api specification. # ### ***important note*** ### there "regexp" variable in docs/makefile ### determines table packages go in on main page. ### currently, there table ("platform packages") , ### goes in it, regexp "*". if policy ### changes, packages added need reflected in ### list of wildcard expressions, well. ### core_pkgs = ...

c# - Is it possible to represent non gregorian dates as DateTime in .NET? -

i'm having trouble representing persian (solar hijri calendar) dates datetime in c#, on days of particular months, example 31/04 in gregorian calendar such date meaningless: system.globalization.persiancalendar p = new system.globalization.persiancalendar(); datetime date = new datetime(2013,7,22); int year = p.getyear(date); int month = p.getmonth(date); int day = p.getdayofmonth(date); datetime d1 = new datetime(year, month, day); the above code result in argumentoutofrangeexception saying: year, month, , day parameters describe un-representable datetime. which expected. how can represent persian dates datetime s in .net taking accounts dates such 30/02 , 31/04? the above code result in argumentoutofrangeexception saying: year, month, , day parameters describe un-representable datetime. yes, because unless specify calendar, datetime arguments expected gregorian. can specify calendar though: datetime d1 = new datetime(year, month, day, p); note i...

javascript - Sum of elements, differences between code -

i have 2 pieces of code both calculating sum of elements of array: var sum = array.reduce(function(previousvalue, currentvalue) { return previousvalue + currentvalue; }, 0); or var sum = 0; array.foreach(function(e) { sum += e; }); are there differences between them beside different implementations? when better use one? besides personal style preference, there difference in actual performance. 2 perform however. if you're doing operation lot (or large arrays) consider using third way: var sum = 0; (l = array.length; l--; ) { sum += array[l]; } this way faster. check this performance test actual results. note: gain speed if cache array length. instead of doing this: for (var = 0; < array.length; i++) {...} do this: var l = array.length; (; l--; ) { ... } or this: for (l = array.length; l--;) { ... }

sql server - Returning a table from a function with parameters in SQL -

as far know, can return table result of db function: create function myfunction(@value varchar(100)) returns table return (select * mytable columnname = '@value') in example can make column name parameter function. question is, can write column name , table name parameter function? hence can write more generic function like: create function mygenericsearchfunction(@tablename varchar(100), @columnname varchar(100), @value varchar(100)) returns table return (select * @tablename @columnname = '@value') no, can't. this dynamic query. dynamic queries in sql server, 1 has use exec() or sp_executesql() functions, not allowed in functions.

task - ArcGIS Geoprocessing Service results updates -

i trying run long (processing multiple objects) , heavy processing operation through arcgis geoprocessing service. working fine in execute synchronous or asynchronous operation, however, status update messages while geoprocessor executing , show them progress using arcgis silverlight or arcgis flex client. i appreciate if can provide clue, literature or poc in regard. in advance, thank time , support. i found solution , can find details @ url ' http://forums.arcgis.com/threads/89581-arcgis-geoprocessing-service-results-updates-as-porgress '. hope helps looking similar matters.

javascript - Select multiple HTML table rows with Ctrl+click and Shift+click -

demo i want select multiple rows using windows shift , ctrl keys, multiple folder selection in windows. from table of selected rows have first column (student id) , pass server side c# , delete records database. i have written code in javascript classname not being applied <tr> on shift or ctrl + left click . html <table id="tablestudent" border="1"> <thead> <tr> <th>id</th> <th>name</th> <th>class</th> </tr> </thead> <tbody> <tr onmousedown="rowclick(this,false);"> <td>1</td> <td>john</td> <td>4th</td> </tr> <tr onmousedown="rowclick(this,false);"> <td>2</td> <td>jack</td> <td>5th</td> </tr...

visual studio 2010 - Why can't I use the Column data annotation with Entity Framework 5? -

Image
i want use column data annotation shown in sample code below compiler (and intellisense) not seem know particular data annotation. i'm using ef 5 in visual studio 2010. installed ef 5 using nuget. required , maxlength annotations working. using system; using system.collections.generic; using system.componentmodel.dataannotations; namespace model { public class destination { public int destinationid { get; set; } [required] public string name { get; set; } public string country { get; set; } [maxlength(500)] public string description { get; set; } [column(typename="image")] public byte[] photo { get; set; } public list<lodging> lodgings { get; set; } } } what missing? column in: using system.componentmodel.dataannotations.schema; the following code: using system.componentmodel.dataannotations.schema; using system.data.entity; namespace consoleapplication2 {...

angularjs - Load the route Template/Controller after all the $http async calls have completed -

currently, have index.html below contents: <div ng-controller="maincntl"> <div ng-view></div> </div> ng-view loads either "template1.html" or "template2.html" based on route url. "template1" controlled "controller1" , "template2" controlled "controller2". what want do : load url mapped content(using $routeprovider) after async calls inside maincontroller have completed. any suggestion highly appreciated. angularjs routes have property purpose, resolve property: window.angular.module('app',[]) .config(['$routeprovider', function($routeprovider) { $routeprovider .when('/', { templateurl: 'afterdoingsomething.html', controller: 'appctrl', resolve: { // function returns promise } }) .otherwise({ redirectto: '/' }); }]) this way, after ret...

ios - Change height of cell with change frame of content -

i can make animating of changing row height bad uitableviewrowanimationfade, because it's flickers when animate - (void)viewdidload { [super viewdidload]; self.title = @"main vc"; selectedindexes = [nsmutabledictionary new]; } - (void)willanimaterotationtointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration { [self.tableview reloaddata]; } - (bool)cellisselected:(nsindexpath *)indexpath { nsnumber *selectedindex = [selectedindexes objectforkey:indexpath]; return selectedindex == nil ? no : [selectedindex boolvalue]; } - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { static bool nofirst; if (!indexpath.row && !nofirst) { [selectedindexes setobject:@(yes) forkey:indexpath]; nofirst = yes; } if ([self cellisselected:indexpath]) { uiimage *cellimage = helperdf.dataarray[indexpath.row][@"image"];...

android - Face detection on Samsung devices -

i use android face detection api camera.facedetectionlistener . i have several tablets. a galaxy tab gt-p5110 2 version 4.0.3 (kernel: 3.0.8-365113-user dpi dell155 @ # 1) a galaxy tab gt-p5110 2 version 4.1.1 (kernel: 3.0.31-523998 se.infra @ sep-98 # 1) a galaxy tab gt-p5210 3 version 4.2.2 (kernel: 3.4.34-1135839 se.infra @ s0210-10 # 1) the detection works on first on second tab 2, turn on face detection, preview flick , detection slow. on tab 3, listener never invoked if did not detect faces. i tried sample : http://developer.samsung.com/android/samples/mad-hatter-face-recogition have same issues. is there known bug on samsung devices ? thanks it known samsung's devices perform differently. have treat different samsung's device carefully. can use 2 steps investigate issue: 1. pass bitmap directly detection api check whether can work. 2. check preview fps. maybe have set different parameters improve camera performance.

ios - Stops audio AVPlayer on iPhone sleep (iOS6, iPhone5) -

if has experienced issue, great hear from. so here case scenario when audio stops working: load app, start playing exit app the phone goes grey mode, sleeps audio stops playing uunlocked phone bring app back stream loads back

php - Can't get friends list to display -

i'm trying users friends list display on profile page, can display name of users profile, not of friends or profile picture. my tables so users user_id username profile friends user_id friend_id accepted (enum 0 no, 1 accepted). here code using, haven't started converting site mysqli yet, yes know code vulnerable. <?php $user_id = $_session['user_id']; $sql = "select friends.id, friends.user_id, friends.friend_id, friends.accepted, users.user_id, users.username, users.profile `friends` left join `users` on users.user_id = friends.user_id or users.user_id = friends.friend_id friends.friend_id = $user_id or friends.user_id = $user_id , users.user_id != $user_id , friends.accepted = '1' or friends.friend_id = $user_id , friends.accepted = '1'"; $result = mysql_query($sql); ?> <img src="<? echo $profile; ?>"><? echo $username; ?> thank...

twitter - Tweet form within an interactive PDF? -

i'm creating interactive pdf file users given text field fill in , , have content included in partially filled out tweet . eg : saw mother santa claus, , _ __ _ __ _ __ _ _ . where first part of message part of tweet, , text field fills in specific part of status user. any ideas? the simplest solution add submit button in pdf submits form data server. on server side collect form data , post tweets.

Low performance in Mysql 5.6.12 -

i have table 30 columns, , add 1 column table. in mysql 5.6.12 operation takes 0.7 seconds, when in mysql 5.0.51 takes more more smaller. the whole database takes 2.7 mb. ues innodb. settings default. could tell me why in mysql 5.6.12 altering queries executed slowly? there tweak related this? maybe there known bug related issue? any appreciated! please check following points how many rows there in table ? is there default assignment being done when new column getting added ? check space available in data directory of mysql-5.6 , compare mysql-5.5 installation 'data' directory. check steps followed migrate/upgrade mysql-5.5 mysql-5.6 ? may wrong there.

Android 4.3 Webview not scrolling when soft keypad is displayed for form fields -

i have normal webview displays form. form has many fields, if focus on field in lower part of screen webview not scroll , softkeypad hides input fields. have problem n 4.3 (i testing on nexus 4) ps : same webview works on 4.2 , below. is known issue or there workaround ? did try scrollview webview , both inside relative layout <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bg_header" > <scrollview android:layout_width="fill_parent" android:layout_height="match_parent" > <webview android:id="@+id/webview" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </scrollview> try , set verticalscrolling true.

android - How to send the byte[] data of onPreviewFrame method over socket -

i've create simple camera application, in onpreviewframe method, data byte array, byte of image preview , how can send on socket phone phone? camera.setpreviewcallback(new previewcallback() { public void onpreviewframe(byte[] data, camera camera) { //send data client outputstream.write(data, 0, data.length); } } is send data array correct? if yes, how client can receive data @ show it's @ image? thank you.

java bonecp connection-pool handling issue -

i can't find anywhere web code example how enable connection watch because message in log 153624 [com.google.common.base.internal.finalizer] warn com.jolbox.bonecp.connectionpartition - bonecp detected unclosed connection , attempt close you. should closing connection in application - enable connectionwatch additional debugging assistance. this definition: bonecpconfig config = new bonecpconfig(); class.forname(loc.driver); // load db driver config.setjdbcurl(loc.url); // set jdbc url config.setusername(loc.user); // set username config.setpassword(loc.password); // set password config.setminconnectionsperpartition(5); config.setmaxconnectionsperpartition(10); config.setpartitioncount(5); config.setacquireincrement(5); //config.setcloseconnectionwatch(true); connectionpool = new bonecp(config); i used the: config.setcloseconnectionwatch(true); but didn't give me additional debugging assistance. i realize old , resolved,...

java - Android: set Holo Light theme for Navigation Drawer - color of listview -

i've downloaded exmple "navigationdrawer.zip" google official guide , basic exmple navigation drawer. the navigation drawer in exmple designed holo dark. question how set navigation drawer holo light? what tried set background color of holo light easy - <listview ... android:background="#xxxx"/> but <listview ... android:colortext="#xxxx"/> don't work. i dont know if have to, implemented custom adapter textview. doing able set colour of text way.

parallel processing - makeCluster function in R snow hangs indefinitely -

i using makecluster function r package snow linux machine start sock cluster on remote linux machine. seems settled 2 machines communicate succesfully (i able estabilish ssh connections between two). but: makecluster("192.168.128.24",type="sock") does not throw result, hangs indefinitely. what doing wrong? thanks lot unfortunately, there lot of things can go wrong when creating snow (or parallel) cluster object, , common failure mode hang indefinitely. problem makesockcluster launches cluster workers 1 one, , each worker (if started) must make socket connection master before master proceeds launch next worker. if of workers fail connect master, makesockcluster hang without error message. worker may issue error message, default error message redirected /dev/null . in addition ssh problems, makesockcluster hang because: r not installed on worker machine snow not installed on worker machine r or snow not installed in same location loca...

asp.net - White Div in the center of the page on transparent div -

i trying display small white div on semi transparent div (which 100% of page , opacity of 0.6) divs: <div id="confirmdialogsingle" class="loading" runat="server" visible="false"> <div id="msgbox" class="loadingimg"> <br /> have request on chosen date. sure want submit request?<br /><br /> <asp:button id="btnconfirmsingle" runat="server" text="yes" width="60px" onclick="btnconfirmsingle_click" />&nbsp; <asp:button id="btnno" runat="server" text="cancel" onclick="btnno_click" /> </div> </div> css: .loading { width: 100%; height: 100%; top:0; bottom: 0; left: 0; right: 0; margin: auto; position: fixed; background: white; opacity:0.6; z-index:9999; transition: width 2s; -moz-transition: width 2s;/* firefox 4 */ -webkit-tran...

php - tcpdf for Arabic display the characters as question marks '?????? ???' -

i wanna create arabic pdf same file witch had in ms execl format. while creating pdf using tcpdf in php arabic charactors displyaed '????' marks. the characters copied excel file $htmlcontent2 = '<span color="#0000ff">"مجوهرات السليمان"this arabic "مجوهرات السليمان" example tcpdf.</span>'; $pdf->writehtml($htmlcontent2, true, 0, true, 0); the output file display below, ??? ???? ?????? ??????this arabic "??????? ????????" example tcpdf. i solved issue adding following line: $pdf->setfont('aealarabiya', '', 18); it turned out need set proper font type remove ugly ????? characters. the exmaple mentioned in link useful solve issue.

php - Click the data retrieved after While loop and getting extra information again from database -

here problem help. using while loop, extracted 'name' , 'designation' of employees database table (using php script) the html shows retrieved data list. i tagged 'name' data href link inside php script inside while loop. intention when click each 'name' link, must rest of information 'qualification', 'dt of birth','current_work' etc etc database of particular 'name'. can please me or refer example online? based on asked, pass person's name(or whatever primary key) or ever in link, , in page fetches details, use person's name/your primary key fetch details. edit: for example give link person's name like: <a href="yoursite.com/getdetails.php?key=yourkey">name</a> replace yourkey whatever want pass primarykey. , in getdetails.php use key received , fetch data database. edit-2 you can fetch key in getdetails.php using $_get["key"]

entity framework - create table in database using EF from our applictaion Dynamically -

can create table in database our web application dynamically using ef user define fields table. working on mvc 4. is possible ? , if yes how it. depends on understand dynamic here. changing runtime version of context isnt possible. generating, compiling, loading new code is. new context, , poco code can declared. compiled , loaded. controlled piece of running code. however, ongoing lifecycle gets complicated. use of code first migrations becomes tricky. how manage chnages extensions in prod. how merge ongoing dev , prod. managing mapping in fluent api in generated code awful. cant in attributes. the context backflips , automated migrations nightmares have cost me many night. dealing main build natural extensions , production/localised implementation extension gets hard. need make sure incorporated build. and must need know how manage different contexts on same db @ same time. i have unfinished project @ moment. have put on hold until on ef6. expect spend ...

alignment - Parse/Read Bitmap file in C -

i'm trying make program read data bitmap file (.bmp, windows file format, 8bit). right i'm stuck on reading headers before image data. i used specifications bmp found here make these structs hold file header, info header, , image data of bmp: typedef struct { unsigned char filemarker1; unsigned char filemarker2; unsigned int bfsize; ...

java - Jackson API: partially update a string -

i have complex json object string: { "a": ..., "b":..., /* lots of other properties */ "z":... } that read partially jackson , map java class: class partialobjectforb { @jsonproperty("b") private objectb b; } i use readvalue() method objectmapper class , want... far, good. now, want update values in partialobjectforb , update initial string had. figured how update java object jackson (by using readerforupdating) can't find how opposite: update json object/string java object. i know how solve problem using jsonobject. example, if want update 1 value: jsonobject j = new jsonobject(/* full json string */); j.getjsonobject("b").getjsonobject("bb")/* etc. */.put("bbbb", 4); j.tostring(); // give me full original text "b" updated. but can't find how jackson. any idea? notes: my input/output strings, can't change that. i don't know data in json object. know may have prop...