Posts

Showing posts from April, 2012

C for loop control using difference not giving the result -

i writing code keep calculating sequence 1+(2/2!)+(3/3!)+..... until difference between 2 subsequent members of sequence 10^-4 subtraction giving me 0.00 , not stopping loop #include<stdio.h> #include<stdlib.h> int main() { int c = 0; double sum = 0; double fact = 1; double seq; double temp = 0; bool check = false; while (check != true) { c++; fact = fact * c; seq = c/fact; if(temp-seq == 1e-04) check = true; // printf("%f\n",temp-seq); temp = seq; } printf("stopped @ %d operations \n",c); system("pause"); return 0; } first of all, read other replies, have info. second, not doing calculations right, se below working example. #include<stdio.h> #include<stdlib.h> #include<stdbool.h> int main() { int count = 0; double sequence = 0; double previous = sequence; double factori...

jquery - javascript .on() function not working -

i have select list, #select1 , when user chooses option list, action happens. tried following javascript code sadly not working: script jquery(document).ready(function(){ $( document ).on( "change", "#select1", function() { alert("test"); }); }); so when choose option, don't test alert. any idea why happening? edit html <select id="select1"> <option selected="selected" disabled="disabled">choose country</option> <option value="2">canada</option> <option value="3">france</option> <option value="4">india</option> <option value="5">poland</option> </select> i think work $('body').on('change','#select1',function(){ alert("test"); }); demo here

layout - Big Cartel Luna Theme. Cart will not proceed to checkout -

i'd love this. on cart page, when "use stores layout" selected, when customers click "check out", keeps cycling on page , won't proceed checkout. known issue luna theme bigcartel. the solution found says need uncheck it, when do, error message: "you must include {{ head_content }} inside <head> tag of content" this means there's no page formatting in code. i'm not big on code, though i've tried bit work, stealing code other pages in theme, , failed. (it's been years since i've messed code, big one). thank you here's code page: <header class="product_header page_header"> <h1>cart</h1> <span class="dash"></span> </header> {% if cart.items != blank %} <form id="cart-form" {% unless cart.shipping.enabled or cart.discount.enabled %}class="no_options"{% endunless %} method="post" action="/cart" ac...

c# - Using .Matches with regex for a char in fluent -

i have class called transaction contains property named source within transaction class have validation using fluentvalidation , trying validate source property using regex i'm having issue //source isnt required when present must 1 character 'x' or 'y' rulefor(transaction => transacion.source) .matches("^(x|y)?$") .when(transaction => transaction.source != null); i getting: error 1 fluentvalidation.irulebuilderinitial<myutility.transaction,char?> not contain definition 'matches' , best extension method overload fluentvalidation.defaultvalidatorextensions.matches<t>(fluentvalidation.irulebuilder<t,string>, system.text.regularexpressions.regex) has invalid arguments i have used exact same code different property no problems, although string not char. there's dot . in code between matches , ("^(x|y)?$") . .rulefor(transaction => transaction....

javascript - Jquery .ajax() local testing -

i've got little .ajax function trying load content after document ready. $(document).ready(function(){ $.ajax({ url: 'php/accounts-blocks.php', cache: false, beforesend: function() { $('#accounts-blocks').html('please wait...'); }, success: function(html) { $('#accounts-blocks').html(html); } }); }); however, when i'm trying test page locally (just on pc), ajax shows "please wait" message forever, , doesn't load content. should install local hosting or in order test ajax functionality, or wrong script? ajax (xhr) not work in browsers (there exceptions such firefox) when running script locally without having local web server installed. chrome example not allow it. use browser less strict security, or install local http server.

uitableview - calling another ViewController on row selection in TableViewController -

Image
i using uitableviewcontroller , on selection of row list want open scene , send info of selected row. got 1 link , followed , attched segue1 segue2 in push mode. when executing throwing error no such segue associated segue1. below code row selection: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nslog(@"index %ld",(long)indexpath.row ); [self performseguewithidentifier:@"put_controller" sender:indexpath.self]; } -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"put_controller"]) { nsindexpath *indexpath = [self.tableview indexpathforselectedrow]; nsdate *object = _objects[indexpath.row]; [[segue destinationviewcontroller] setdetailitem:object]; } } don't forget set storyboard segue identifier:- put_controller

algorithm - Given an integer z<=10^100, find the smallest row of Pascal's triangle that contains z -

how can find algorithm solve problem using c++: given integer z<=10^100, find smallest row of pascal's triangle contains number z. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 for example if z=6 => result on 4th row. another way describe problem: given integer z<=10^100, find smallest integer n: exist integer k c(k,n) = z. c(k,n) combination of n things taken k @ time without repetition edit solution needs logarithmic time, it's o(log z) . or maybe o( (log z)^2 ) . say looking n,k binomial(n,k)==z given z. each row has largest value in middle, starting n=0 increase row number, n , long middle value smaller given number. actually, 10^100 isn't big, before row 340 find position n0,k0=n0/2 value triangle larger or equal z : binomial(n0,k0)>=z you walk left, i.e. decrease column number k , until find value smaller z . if there matching value in row have hit now. k not large, less 170, step won't executed more , not present perform...

c# - Why I can't use Server.MapPath() in my class? -

i have following problem when try call server.mappath(); inside class. it give me following error message: error 3 name 'server' not exist in current context c:\develop\earlywarning\public\implementazione\ver2\pdfreport\itextdocumentbase.cs 122 13 pdfreport so think maybe have add namespace related server object looking on official documentation can't found no related namespace: http://msdn.microsoft.com/en-us/library/ms525541%28v=vs.90%29.aspx why? can solve? tnx do in class: system.web.httpcontext.current.server.mappath("relative path");

vba - Populating reports with calculated values -

i hope simple question , don't have waste of time on it. have report (called reprad78) contains textbox (called txtrad8). populate txtrad8 calculated value based on numbers pulled query called qryrrad78. looking through forums looks recordsets solution first foray recordsets , it's not going well. :( code have pasted in below have pulled number of places , doesn't produce errors puts same value txtrad8 records. i'm sorry if stupid question it's been driving me potty. many time. al. public sub calc() dim dbs dao.database dim rst dao.recordset set dbs = currentdb set rst = dbs.openrecordset("qryrrad78") rst.movefirst until rst.eof = true dim lngmean long dim lngrad78max long dim lngrad78_1 long dim lngrad78_2 long dim lngrad78_3 long dim lngrad7 long dim lngrad8 long lngrad78_1 = rst![rad78_1] lngrad78_2 = rst![rad78_2] lngrad78_3 = rst![rad78_3] lngrad8b_c = rst![rad8b_c] lngmean = (lngrad78_1 + lngrad78_2 + lngrad78_3) / 3 lngrad78max = maximu...

c - How to record sound in buffer using ALSA -

i'm begining learn linux , alsa , wondering if there way store sound record microphone directly buffer. read here http://www.linuxjournal.com/article/6735?page=0,2 how make recording program. need little more complex. need record sound untill hit key. reason need because i'm messing raspberrypi(debian on it) , see if turn sound monitoring/detecting device. my main problem when try use record (./rec >name.raw ) nothing. ouputs empty .raw file. #define alsa_pcm_new_hw_params_api #include <termios.h> #include <alsa/asoundlib.h> struct termios stdin_orig; // structure save parameters void term_reset() { tcsetattr(stdin_fileno,tcsanow,&stdin_orig); tcsetattr(stdin_fileno,tcsaflush,&stdin_orig); } void term_nonblocking() { struct termios newt; tcgetattr(stdin_fileno, &stdin_orig); fcntl(stdin_fileno, f_setfl, o_nonblock); // non-blocking newt = stdin_orig; newt.c_lflag &= ~(icanon | ec...

xml - XSLT Can't match element with specific namespace -

i have xml source file: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="c:\iso19139_rve.xsl"?> <md_metadata xmlns="http://www.isotc211.org/schemas/2005/gmd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:gco="http://www.isotc211.org/schemas/2005/gco" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemalocation="http://www.isotc211.org/schemas/2005/gmd/gmd.xsd"> <identificationinfo> <md_dataidentification> <extent> <ex_extent> <geographicelement> <ex_geographicextent> <ex_geographicboundingbox> <westboundlongitude> <gco:decimal>1</gco:decimal> ...

c# - EF: Get list of objects where primary key is not referenced anywhere -

my current database has files table, referenced couple of other tables. trying achieve, retrieve list of files primary key not referenced @ all. structure of models below. public class file { public int fileid { get; set; } public ...... } public class afiles { public int afilesid { get; set; } [foreignkey("file")] public int fileid { get; set; } public virtual file file { get; set; } ..... } public class bfiles { public int bfilesid { get; set; } [foreignkey("file")] public int fileid { get; set; } public virtual file file { get; set; } ..... } what have been trying is: return context.file.where(x => !context.afiles.any(y => y.fileid == x.fileid) && !context.bfiles.any(y => y.fileid == x.fileid) ).select(x => x.fileid).tolist(); but throws error of unable create constant value of type 'afile'. primitive types or enumeration types supported ...

gimp edit blend in python script produces different blend than the blend tool -

i'm trying write script re-sizes, moves , blends 2 images in 1 using gimp 2.8 on ubuntu 13.10. i uploaded 2 needed images , results here: http://imgur.com/a/bjgia i managed run 1 point fails. blending command. reduced problem pdb.gimp_edit_blend command instead of blending layer mask transparent background creates opaque gradient. image = gimp.image_list()[0] #image 237x300 png above pdb.gimp_image_resize(image, 300, 300, -100, 0) fg_layer = pdb.gimp_image_get_active_layer(image) mask = pdb.gimp_layer_create_mask(fg_layer,add_white_mask) pdb.gimp_image_add_layer_mask(image, fg_layer, mask) # here goes wrong, if skip step can correct result # using gimp blent tool gui using same settings here pdb.gimp_edit_blend(fg_layer, fg_bg_rgb_mode, normal_mode, gradient_linear, 100, 0, 0, true, false, 0, 0, true, 0, 150, 150, 150) the whole code here: http://pastie.org/9079343 any idea i'm doing wrong? lot your error pretty in own code - calling blending function p...

patch - How do I write a Makefile rule to apply patches using Quilt? -

i'm 1 of developers of inkscape. incorporate few modified chunks of various free libraries, in our code-base , we'd handle our patches software in more maintainable way. i've used quilt patch tool apply patches upstream code in debian packages, , have considered using in build inkscape i.e., patch relevant upstream files using quilt compile source this allow maintain pristine copy of upstream library , separate patch set, can forward upstream. my problem aside debian documentation, haven't found examples of how neatly include quilt in makefile. can point me project this? we use automake, if there elegant way of running "patch" rule before main build, great. i can't point project that, i've done myself before creating new patch (which last one) creates file named patched.txt in convenient spot. makefile simple project looks this: cxx = clang ldflags += -lstdc++ cxxflags += -wall -pedantic --std=c++11 all: patched.txt...

c# - how to select only one check box with JQuery -

<div class="form-group"> @html.checkboxfor(x => x.clientaccountishospitality, new { @type = "checkbox" }) @html.labelfor(x => x.clientaccountishospitality) </div> <div class="form-group"> @html.checkboxfor(x => x.clientaccountisretail, new { @type = "checkbox" }) @html.labelfor(x => x.clientaccountisretail) </div> <script type="text/javascript" language="javascript"> $(document).ready(function () { $("input[type='checkbox']").change(function () { $(this).closest(".checkboxcontainer").find("input[type='checkbox']").not(this).prop("checked", false); $(this).prop("checked", true); }); }); </script> i hoping when user selects check box, other check box de-select, if selected. problem code user can select check box cant de-select aga...

How to extract the variables out from "add_shortcode" function in Wordpress? -

in wordpress (now in template fiile), lets have custom shortcode function, like: in page: [myshortcode id='1234'] then, in template file: function parseuserid_func( $atts ){ //parse $atts here... $userid = 1234; //now userid is, 1234 } add_shortcode( 'myshortcode', 'parseuserid_func' ); //now .. echo value of $userid here? <---------- printout_userdetails( $userid ); as can see, how can processed value of $userid variable out shortcode function please? (as in last line) the $userid not touchable outside. actually i'm trying like: pass id page, using [myshortcode id="1234"] parse out id shortcode's function. ( parseuserid_func above) when id , need pass custom function printout_userdetails($id){} function (written in template file) .. continue processing works. (something like) print out user details on page, printout_userdetails() function. this why need pass value shortcode , parse it, pass id ...

Use Replace in Access SQL only when the first two characters of the string match my pattern -

i'm working database names apostophes in them (e.g. irish or scottish style names such o’doherty) stored space instead of apostophe (e.g. "o doherty"). in query, want return names in correct format (just in select query, rather changing data), i've used: replace([snametemp],"o ","o’") this works in theory, problem i'm having there matches pattern further along string: e.g., "do not use" returned "do’ not use". how write replace statement checked first 2 characters of string? should in access iif(snametemp "o *", replace([snametemp],"o ","o’"), snametemp)

How to fetch records for every day in a month using mysql -

i working mysql , having requirement reports registration data every day (if search month) in month , every month (if search based on year). here query used result query: select count(tenant_id) registered, date_format(created_date,'%d') weeks asign_user date_format(created_date,'%m')='02' , date_format(created_date,'%y') = '2014' group date_format(created_date,'%d'); ------------------------------- day | registered ------------------------------- 11 5 12 6 13 1 14 8 16 9 25 15 expected result should ------------------------------- day | registered ------------------------------- 01 0 02 0 03 0 04 0 05 0 06 0 . . . . . . ....

angularjs - Minify HTML/CSS/Javascript and replace URLs with link to Amazon S3 files -

i have created web app in angularjs node.js backend. i'm planning deploy backend ec2 , static files: javascript, html , css s3. using grunt automate tasks. my problem follows. in index.html file have list of script tags including bunch of js files, however, when these files concatenated , minified, how these script tags replaced 1 (or two) script tag pointing minified file? people manually, write script or there tools can this? what if want upload these static files s3. have seen s3 grunt plugin, how links static files replaced in html , everywhere files needed?

java - Maven standard convention for application properties file -

i hava maven project of type jar. intended standalone java se application running service. usual has own app.properties file properties database connection information goes. not project ment uploaded maven central, it's supposed stay in organization , makes sense have property file alongside jar. i have seen many places people put applicaiton properties file inside src/main/resources. gets copied inside jar excatly dont' want. i can manage ask maven copy inside example src/main/external-resources/* target/* when package project can java -jar ... , properties file alongside jar. but messes netbeans expects properties file inside src/main/external-resources how make app.properties file available in classpath of ide when debug it. means can access file new file("app.properties") how make when package application app.properties file goes alongside .jar file. basically want able debug program in ide , use properties file new file("app.properties...

Using "cocos run" command with cocos2d-js 3.0alpha on sample js-moonwarrior -

i discovered new commandline in cocos2d-js (3.0alpha on os x 10.9.2) awsome. 2 commands can create project , deploy on web, android, ios , mac. tried web , android , worked instantly. then tried run sample game js-moonwarriors comes framework using cocos run -p android from within project directory. stops error: can't find projects directories in project. no idea. missing? update: cocos2d-js 3.0alpha2 out , working fine. i got answer cocos2d-x forum: hi, functionality missing in 3.0 alpha, tomorrow release 3.0 alpha2, , issue have been solved, can use cocos command compile , run js-tests , moon warriors.

character encoding - String ordering in Lua -

i'm reading programming in lua, 1st edition (yup, know it's bit outdated), , in section 3.2 (about relational operators), author says: for instance, european latin-1 locale, have "acai" < "açaí" < "acorde". i don't it. me, it's ok have "acai" < "açaí" , why "açaí" < "acorde" ? afaik ( and wikipedia seems confirm ), "c" < "ç" , or wrong? you reference code page, maps codepoints characters. codepoints, being finite set of non-negative integers, well-ordered, distinct entities. however, not characters about. characters have collation order, partial ordering: characters can "equal" not same. collation user-valued concept varies locale (and on time). strings more complicated because character sets (e.g. unicode) can have combining characters. allows "character" represented single character or base character followed combin...

sql server - Update field in hierarchy data using C# -

Image
i've table contains, employeeid, managerid & employeeorder i need write c# code or sql statment update employeeorder records according managerid relation like: you can write function update employeeorder of 1 hierarchy , call recursively: void update(string managerid){ var employees = db.employees.where(e=>e.managerid == managerid).toarray(); for(int i=0;i<employees.length;i++){ employees[i].employeeorder = m.employeeorder + i.tostring("000"); update(employees[i].employeeid); } } as recursive methods, have kick start it. in case perhaps use like: update(null); that is, of course, assuming you're using linq sql or entityframwork or similar can use linq access database. optionally can write sql statement equivalent or stored procedure equivalent of above algorithm.

Run Python Script with Bash - null-object doesn't work -

i've got following script converts pdf-files python-script python-script has 3 inputs: pperation-key input-file output-file. operation-key can have value null, 1, 2. #!/bin/bash f in *.pdf outputdir="`pwd`/${f%.pdf}_out.pdf" inputdir="`pwd`/$f" python <myscript> "null" $inputdir $outputdir done in terminal python-script works following inputs, not in shell-script: python convertpdf.py null /users/admin/test.pdf /users/admin/test_out.pdf how can deliever null object script? it missing double quotes! now following script works perfect! #!/bin/bash f in *.pdf outputdir="`pwd`/${f%.pdf}_out.pdf" inputdir="`pwd`/$f" python <myscript> "null" "$inputdir" "$outputdir" done

ios - dataSource is nil in initWithCoder -

i have following initwithcoder implementation depends on callback of datasource method. somehow datasource nil , datasource methods aren't called. i'm using storyboard , therefor have overwritten initwithcoder-method. - (id)initwithcoder:(nscoder *)adecoder { self = [super initwithcoder:adecoder]; if (self) { nsuinteger rows = 0; nsuinteger columns = 0; if (self.datasource && [self.datasource respondstoselector:@selector(numberofheaderrowsinspreadsheetview:)]) { rows = [self.datasource numberofheaderrowsinspreadsheetview:self]; } if (self.datasource && [self.datasource respondstoselector:@selector(numberofheadercolumnsinspreadsheetview:)]) { columns = [self.datasource numberofheadercolumnsinspreadsheetview:self]; } [self setupwithnumberofheaderrows:rows numberofheadercolumns:columns]; } return self; } does has clue? thanks in advance. i wouldn’t su...

c++ - Can I wrap a shared library in a static library to contain its dependencies? -

i have been provided shared library file third party (call libfoo.so link application. not have source code libfoo.so , associated c++ headers , resulting binary provided third party. libfoo.so has few shared library dependencies, notably few boost libraries, such libboost_thread.so.1.48 . other that, dependency list thin (essentially libstdc++.so.6 ). here's catch: application, uses boost heavily, built against newer version, v1.55. therefore, if try link application against v1.55 libraries needs v1.48 libraries libfoo.so pulls in, i'm bound run problems duplicate symbols; that's non-starter. roll application v1.48 little work, i'd prevent 1 dependency holding me changing boost versions in future. is there kind of intermediate product create sits between libfoo.so , application decouple boost dependencies each other? found number of similar questions, none find captured particular situation; it's not boost-specific per se , instead relates devising way ...

Android Show Custom Nav and Footer on Tap Like ImageViewer -

Image
i want show activity full screen , want show/hide custom title bar button , footer 1 button only. full screen image viewer android if activity : when touch , tap anywhere in screen should like: update i have searched lot haven't find proper solution. want android 4.2 jelly bean (api level 17) . i got solution [immersive full-screen mode] 3 android 4.4 kitkat (api level 19) . any advice appreciated! try now: activity_main.xml : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rlmain" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#f2af2a" > </relativelayout> mainactivity.java : public class mainactivity extends activity { handler mhandler = new handler(); relativelayout rlmain; runnable mrunnable = new runnable() { @suppresslint("newapi") @...

unix - appening recursive command for a Linux STDIN -

when moving / copying contents 1 folder another. asked if want overwrite files sharing identical names. in example: [root@public/]# sudo mv * /var/www/public/html/ for example, if public has 100 files exist in html ask if want overwrite each file name 100 time. there way append y command? i linux newbie. know can stdin, stdout , stderr. though append doing < "echo y"; ain't working. basically can use program yes such purposes: yes | mv ... yes called without arguments repeats string "y" forever if pass argument ouput argument. leads nice call yes no | program which can used repeatedly "no" :) however, in case mv has option -f wich suppress questions , enforce actions. use care questions meant prevent data loss.

mysql - Reading a CSV and writing to a database with Python -

i'm brand new python, have history r. i've been tasked read csv file , upload it's contents database upon completion of process on windows application. basically, application completes task, updates csv file locally. i've been told others python can invoked upon condition (a change in csv) , upload mysql database easily. can point out right direction begin here , pitfalls/words of advice switching r python complete this? thank you use watchdog watch changes in csv file. use built-in csv module read file. use sqlalchemy model , interact database.

javascript - Hiding a button onClick="" before launching the following method calls -

i not familiar inline js. have button such <button onclick="return dosomething()"></button> how hide & disable button before return , dosomething called? (jquery available too). i need button hidden & disabled before onclick methods called. you can this: <button onclick="this.disabled = true;this.style.display = 'none';return dosomething()"></button> or in dosomething function: <button onclick="return dosomething(this)"></button> function dosomething(obj){ obj.disabled = true; obj.style.display = 'none' // other stuff }

jquery - Browser "back" Button doesn't restart javascript -

a similar question has been asked, im not @ happy solutions, can't ones in such simple case. so i've got page javascript animation. there 4 images anchors, link new pages, , once click on them, grow full size , looks transform background, because image background of next page. so here's problem: when click link goes well, image grows screen size , anchor triggers delay , links new page. then, once click on "back" button in browser on new page, come page screen filled image i've clicked, , refreshing gets out of it. is there way reload page when come through "back" button in browser? did try putting code in jquery $(..) code in side paranthesis!

html - Why is my image not showing in CSS? -

i new css , learning it. looked through these forums in search of answer question yet nothing tried worked. here's code. <html> <head> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> <br> <div> <a href="http://www.google.com" class="boxa"> </a> </div> </body> </html> here css: .boxa { display: block; background:url(c:\users\sidworld\desktop\app-google-icon.png); width: 512px; height: 512px; -webkit-transition:width 0.1s, height 0.1s, background-color 0.4s, -webkit-transform 0.5s; transition:width 0.1s, height 0.1s, background-color 0.4s, transform 0.1s; } .boxa:hover { background:url(..\desktop\app-google-icon.png); width:1024px; height:1024px; } i'm new here please bear bad formatting. image on desktop , have checked it. change background: url(c:\users\sidworld\desktop\app-goo...

wordpress - Trying to add a meta box using wpcf7_add_meta_boxes hook -

i've written plugin extend contact form 7 plugin. want add metabox in editing area each form shows checkbox enables/disables plugin extension. /** * add edit options each cf7 form */ add_action('wpcf7_add_meta_boxes', 'wpcf7ev_add_form_options'); function wpcf7ev_add_form_options() { add_meta_box('wpcf7ev_form_options', 'email verification', 'wpcf7ev_display_options', 'wpcf7_contact_form'); } function wpcf7ev_display_options() { wp_mail('myemail@gmail.com', 'debug', 'adding checkbox'); $wpcf7ev_options['active'] = 1; ?> <input type="checkbox" id="wpcf7ev-active" name="wpcf7ev-[active]" value="1"<?php echo ( $wpcf7ev_options['active']==1 ) ? ' checked="checked"' : ''; ?> /> <label for="wpcf7ev-active">use email verification</label> <?php } the wpcf7ev_display_op...

java - ERROR: Encountered an error executing the step org.springframework.batch.item.ItemStreamException: Failed to initialize the reader -

this flatfileitemreader configuration <beans:bean id="myfileitemreader" class="org.springframework.batch.item.file.flatfileitemreader" p:resource="file://tmp/my-#{jobparameters[date]}/data.txt" p:linemapper-ref="mylinemapper" scope="step"/> i getting error error: org.springframework.batch.core.step.abstractstep - encountered error executing step org.springframework.batch.item.itemstreamexception: failed initialize reader @ org.springframework.batch.item.support.abstractitemcountingitemstreamitemreader.open(abstractitemcountingitemstreamitemreader.java:142) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.springframework.aop.support.aoputils.invokejoinp...

regex - RegularExpressionValidator asp.net -

i trying make sure user can input a-z , 0-9 characters. have used regularexpressionvalidator class: <asp:textbox id="input" text="search" runat="server" ontextchanged="searchfunc"></asp:textbox> <asp:regularexpressionvalidator id="regexp" runat="server" errormessage="only a-z or 0-9 allowed" controltovalidate="input" validationexpression="^[a-z0-9]+$" /> though in code behind trying check if user entered valid input using regexp.isvalid but method returns true if user inputs !&%() can't understand i've done wrong. regular expression wrong? call regexp.isvalid after validation has been performed otherwise default value set true. try calling regexp.validate() before checking isvalid property.

mysql - Log-In page - Java Swing -

i'm having bother jdbc , creation of log in page. have button called btnlogin , 2 text fields, 1 called usernamefield, , other called passwordfield(which actual password field). what i'm trying achieve is, when user enters information fields, database searches the database have set up, 'logs in' displaying appropriate welcome message or error message. what doing wrong? very lost. code below. btnlogin.addactionlistener(new actionlistener() { @suppresswarnings({ "deprecation" }) public void actionperformed(actionevent arg0) { // creating connection , query variables connection conn = null; resultset rs = null; preparedstatement pst = null; string url = "jdbc:mysql://my.db.url/*******"; //load driver try { class.forname("com.mysql.jdbc.driver"); // making connection conn = drivermanage...

java - Google Cloud Endpoints client libraries generation duplicates entities -

i've found strange behavior when generate client libraries endpoints. in appengine project, have 2 endpoint classes handles operations 2 entities: groupendpoint entity group contactendpoint entity contact the group entity has list of contacts, because when api method of groupendpoint called, have update contacts. the problem when generate client libraries, contact entity generated in 2 different namespaces (one each endpoint), quite confusing, because end same class (exactly same) twice. here example: group.java package backend; import java.util.list; import javax.jdo.annotations.idgeneratorstrategy; import javax.jdo.annotations.persistencecapable; import javax.jdo.annotations.persistent; import javax.jdo.annotations.primarykey; @persistencecapable public class group { @primarykey @persistent(valuestrategy = idgeneratorstrategy.identity) private long id; @persistent private list<contact> contactlist; public long getid() { ...

sql - Oracle query - without temporary table -

i'm new oracle , need query. have table data samples /records like: name | datetime ----------- | 20140414 10:00 | 20140414 10:30 | 20140414 11:00 b | 20140414 11:30 b | 20140414 12:00 | 20140414 12:30 | 20140414 13:00 | 20140414 13:30 and need "group"/get informations form: name | datetime_from | datetime_to ---------------------------------- | 20140414 10:00 | 20140414 11:00 b | 20140414 11:30 | 20140414 12:00 | 20140414 12:30 | 20140414 13:30 i couldnt find solution query similar this. please me? note: dont want use temporary tables. thanks, pavel you need find periods values same. easiest way in oracle use lag() function, logic, , aggregation: select name, min(datetime), max(datetime) (select t.*, sum(case when name <> prevname 1 else 0 end) on (order datetime) cnt (select t.*, lag(name) on (order datetime) prevname table t ) t ) t group name, cnt; wha...

javascript - On button click run function that add stuff to body -

sorry noobish question, new html/javascript. lets have from: <form id="pass" > <p> password: <input type="password" name="password" > username: <input type="text" name="username" value="user"> <input type="submit" value="send" class=btn> <input type="reset" class=btn> </p> </form> and when button pressed. want run function in script.js file, example clear body. what right way it? many thanks! add code in form tag onsubmit="javascript: function_name();" example: <form name="name" id="name" onsubmit="javascript: function_name();"> // code </form> now in js, write: <script> function function_name() { alert("hi"); } </script>

recommendation engine - Server/Client software to push file changes -

i wondering if can recommend software(preferably free) has server/client setup can push file change server clients on network pc's? 1 particular file changes daily , push out clients instead of keeping users permissions administrator copy down shared drive setup via application startup script. add users group, give group read access file, won't need admin privileges anymore. as make change file, pick changes.

c# - ForeignKey using ASP.NET MVC 4 Migration Code first -

how create foreign key below user class on id of computer class? user table: [table("user")] class user{ [key] public int iduser; public int idcomputer; //foreignkey } computer table: [table("computer")] class computer{ [key] public int idcomputer; } how one-to-many relationship , one-to-one relationship between these classes, please? to set user has many computers , computer has 1 user, this: class user { public int iduser {get;set;} public virtual icollection<computer> computers {get;set;} } class computer { public int idcomputer {get;set;} public int userid {get;set;} // automatically detected foreignkey since format [classname]id public virtual user user {get;set;} } to set computer has many users , user has 1 computer, do: class user { public int iduser {get;set;} public int computerid {get;set;} public virtual computer computer {get;set;} } class computer { public int idcomputer...

python - Choosing a matplotlib backend for a specific IPython profile -

matplotlib has config file , ipython has own. 1 has precedence when comes setting things matplotlib backends? for example, config file matplotlib says use specific backend, modify ipython startup or config files use different one. 1 used when start ipython , import matplotlib ? more generally, right way set things different profiles use different matplotlib backends or matplotlib configurations? ipython configuration used, ipython chooses matplotlib backend. for reference, see ipython:core/pylabtools.py:activate_matplotlib , notice how matplotlib.use(backend) called explicitly.

c++ - How to use container neighbours in std algorithms in a right way -

are std algorithms designed use several neighbor elements in container? here have done read samples file(each sample has it's own offset) long offsets[] = { 0x00000000, 0x00000010, 0x00000020, .... } ifstream file(path, ios::binary); vector<sample> samples; for_each(begin(offsets), end(offsets), [](long &offset){ auto samplesize = *(&offset+1)-offset; sample s; file.read( s.getbuffer(), samplesize); samples.push_back(s); }); to figure out size need 2 adjacent elements vector. think use std::advance() or std::next() instead of *(&offset+1). right approach @ here use standard algorithm? if yes, algorithms designed used in way? with boost zip iterator, may like: // assume offsets not empty. std::for_each( boost::make_zip_iterator(boost::make_tuple(begin(offsets), begin(offsets + 1))), boost::make_zip_iterator(boost::make_tuple(end(offsets) - 1, end(offsets))), [&](const boost::tuple<const long&, const long...

jquery - jstree AJAX doesn't work, has a Syntax error: unrecognized expression for the json -

i use jstree api request json data ajax, doesn't work, , shows me error: error: syntax error, unrecognized expression: {"results":[{"id":"a","parent":"b","text":"hello","icon":"something..."}, {"id":"b","parent":"#","text":"world","icon":"somethingelse..."}]} it seems json right format, ajax cannot recognize it. my ajax code this: $('#jstree').jstree({ 'core' : { 'data' : { 'url' : 'loadjstree.php', 'data' : function (node) { return { 'id' : node.id }; } }, } }); and api demo: link demo why doesn't work? cound me? thank you! have tried removing "results" object? {"results":[{"id":"a","parent":"b","text...

vb.net - File Transfer over ip in vb -

in visual basic there function called file copy filecopy(source,destination) is possible copy computer on ip? ex: filecopy("c:\user\name\desktop\test.txt",//192.168.x.x) if yes correct syntax? you need specify unc path correctly, example: filecopy("c:\user\name\desktop\test.txt","\\192.168.x.x\c$\user\name\desktop") also it's better use file.io.copy instead of old vb6 syntax.

sql server - Conditional CASE/IF in constructing T-SQL statement -

i have query in front-end code i'm trying convert stored procedure. front-end code has conditional logic in construct correct sql based on form values. did not write original sql have been tasked conversion. the issue i'm facing don't have enough knowledge/experience go doing this. have consulted these links help, don't quite me there: sql: conditional statement in group clause sql case statement specifiying condition in clause? pseudo-code: where b.active=1 , year(metric_year) = @frmyear if @selorg not null , @selorg != 'all' if @selorg = 'org1' , org in('org1','org2','org3') , measure_id not in(0,1,2,3,4) else , org = @selorg else , measure_id not in(0,1,2,3,4) trying simple results in "incorrect syntax near end" error. where b.active=1 , year(metric_year) = @frmyear , case @selorg when 'org1' org in('org1','org2','org3'...

tomcat - EMMA failed to dump coverage data: java.io.FileNotFoundException: coverage.ec (Permission denied) -

i have done following steps. copied emma.jar classpath instrumented code , got coverage.em restarted server , checked tomcat log(no suggestion of emma collecting coverage data) started doing tests on application stopped tomcat, below when stopped tomcat. java.io.filenotfoundexception: coverage.ec (permission denied) @ java.io.randomaccessfile.open(native method) @ java.io.randomaccessfile.<init>(randomaccessfile.java:236) @ com.vladium.emma.data.datafactory.persist(datafactory.java:656) @ com.vladium.emma.data.datafactory.persist(datafactory.java:86) @ com.vladium.emma.rt.rtcoveragedatapersister.dumpcoveragedata(rtcoveragedatapersister.java:54) @ com.vladium.emma.rt.rtexithook.run(rtexithook.java:32) @ java.lang.thread.run(thread.java:701) exception in thread "emma shutdown handler thread" java.lang.runtimeexception: emma failed dump coverage data: java.io.filenotfoundexception: coverage.ec (permission de...