Posts

Showing posts from June, 2013

php - regex to get everything between apostrophes but do not return apostrophes -

i using following code grab challenge preg_match("/'03ahj(.*?)'/", $recaptcha_page_response,$captchastring); on following text var recaptchastate = { challenge : '03ahj_vuvttaeouhgwbbxlqxnyrpyagvrs5lff2n90asrwhio3payqd6lfnhnwb_cvexafwhcgtk5zmhpetpy2nawxfodlcxuub3v2guaa7ezdn0vqa6chewwif8yfbm3i7zn0xtkzhkitsxfcarzgmh4arft-owzsrogpam_og0hp12czmgwmv15fwcnctfuypkxnphdv8fagw4ydinvxal8nhxijeen6m4ibjx4kgcjolyqimbzj54i7jfzas9omlk-giv3coq7ahutgjeg9f9joya4wkxxksg', timeout : 1800, lang : 'en', server : 'http://www.google.com/recaptcha/api/', site : '6lec3o0saaaaac_ycszkqches7yidmtp_h-6uttx', error_message : '', programming_error : '', however returns ' in array[0] becomes $captchastring = "http://www.google.com/recaptcha/api/image?c=$captchastring[0]"; this http://www.google.com/recaptcha/api/image?c='03ahj_vutyynskzgrlzb3czhaotgfl2jgc-r0s5fvxz9oelzqn-cbgtfqbzo0m-zyfrcx...

php - Pop up window on page load -

i want create pop window text box , appear whenever redirected page. found code w3schools there have click try button pop -up window appears. here code <!doctype html> <html> <body> <p>click button demonstrate prompt box.</p> <button onclick="myfunction()">try it</button> <script> function myfunction() { var person = prompt("please enter name", "harry potter"); if (person != null) { document.getelementbyid("demo").innerhtml = "hello " + person + "! how today?"; } } </script> </body> </html> replace <body> <body onload='myfunction()'> .

regex - How to find lines using patterns in a file in UNIX -

i trying use .txt file around 5000 patterns (spaced line) search through file of 18000 lines matches. far i've tried every form of grep , awk can find on internet , it's still not working, stumped. here's text each file. pattern.txt rs2622590 rs925489 rs2798334 rs6801957 rs6801957 rs13137008 rs3807989 rs10850409 rs2798269 rs549182 there's no spaces or anything. file.txt snpid hg18chr bp a1 a2 zscore pval ceumaf rs3131972 1 742584 g 0.289 0.7726 . rs3131969 1 744045 g 0.393 0.6946 . rs3131967 1 744197 t c 0.443 0.658 . rs1048488 1 750775 t c -0.289 0.7726 . rs12562034 1 758311 g -1.552 0.1207 0.09167 rs4040617 1 769185 g -0.414 0.6786 0.875 rs4970383 1 828418 c 0.214 0.8303 . rs4475691 1 836671 t c -0.604 0.5461 . rs1806509 1 ...

internationalization - django app with different and dynamic translation files -

currently i'm working on task, require every django user have different locale file , translation of course e.g. different translation same app. i'm tried changes on own scenario , next lines finished , works fine met troubles whole app translated on english , german when create new user, copy default translation file .po new directory related user. case made container app hold custom translation , directory schema 'apps/trans/locale/user1/', 'apps/trans/locale/user2/' , on. these paths added settings.locale_paths when app started. i have implemented rosetta django admin , display correct .po file of them (custom .po) the django tempalatetags i18n.py copied teplatetags directory , extended purpose i want custom modification django.core.translation module , copy file project, not know how load module correctly override default django functionality, because want replace default translation custom here for use _ _ import _ _ , replace sys.modules[...

android - ViewPagerIndicator - TabPageIndicator page titles randomly get split into 2 lines -

Image
sometimes page title in tabpageindicator split 2 lines, whole words , broken words. here screen shots 1) split 2 lines - broken words 2) split 2 lines - whole words 3) not split 2 lines here layout code: <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.viewpagerindicator.tabpageindicator android:layout_width="fill_parent" android:layout_height="45dp" android:layout_gravity="top" android:paddingtop="2dp" android:layout_marginbottom="2dp" /> <android.support.v4.view.viewpager android:layout_width="match_parent" android:layout_height="fill_parent"> </android.support.v4.view.viewpager> </linearlayout> here style code: <style name="customtabpageindicator"> <item nam...

regex - PHP How can I get full image url by useing preg_match_all -

for example $string = 'aaaaaaasssssshttp://www.1.com/images/001/001/001/1.jpgddwxeaaaaaa crewcwehttp://www.2.com/images/002/002/002/2.jpgrcegcger cgwcgrewhttp://www.3.com/images/003/003/003/3.jpgcgergcer cerggewrcgrewhttp://www.4.com/images/004/004/004/4.jpgecgewrcgerwcg cerghttp://www.5.com/images/005/005/005/5.jpg'; i want first image full url form stiring : "http://www.1.com/images/001/001/001/1.jpg" i use function not work if (preg_match_all('^http:\/\/\.(png|jpeg|jpg|gif|bmp)$/i', $string, $matches)) print_r ($matches[1]); who can me ? thank much! i've tested following code, , works. captures jpg-urls. $string = 'aaaaaaasssssshttp://www.1.com/images/001/001/001/1.jpgddwxeaaaaaa crewcwehttp://www.2.com/images/002/002/002/2.jpgrcegcger cgwcgrewhttp://www.3.com/images/003/003/003/3.jpgcgergcer cerggewrcgrewhttp://www.4.com/images/004/004/004/4.jpgecgewrcgerwcg cerghttp://www.5.com/images/005/005/005/5.jpg'; preg_m...

arrays - How to break an Integer[] arr in more than one interger[] arrs in Java? -

i have comma separated string of ids. want break comma separated string in more 1 strings if total no. of ids greater 500. what can do: can convert string in integer array , test it's size. break array in more 1 arrays, , re-convert them in comma separated strings. my code far: integer[] empidint = null; string tokens[]=application.splitstr(outerarray, ","); if(!ermutil.isnull(tokens) && tokens.length>0){ empidint=new integer[tokens.length]; for(int i=0;i<tokens.length;i++){ empidint[i]=integer.valueof(tokens[i]); } } questions is right approach tackle problem? if yes,how break integer[] array in more 1 arrays? if no, should do? edit: input : "1,2,3,4,5,6,7,8,9,10,11" //list of ids; i want break them more 1 string if no. of ids greater let's 3. it's 10 i.e...

java - Spring define batch job at runtime -

i working on spring-mvc application. i have requirement of scheduling batch job @ runtime for concentrating on creating batch job @ runtime . i taking example this . in example, following entry in xml file <!-- failed step tasklet declaration --> <bean id="failedsteptasklet" class="com.onlinetechvision.tasklet.failedsteptasklet"> <property name="taskresult" value="error occurred!" /> </bean> <batch:job id="secondjob"> <batch:step id="firstfailedstep"> <batch:tasklet ref="failedsteptasklet" /> </batch:step> </batch:job> my requirement create batch job , batch step @ runtime. there can multiple batch job multiple batch steps in each job. can 1 please me, how configure @ runtime. thanks.

javascript - Is there a way to force ember to always use plural -

i've been looking around , couldn't find way except with: var inflector = ember.inflector.inflector; inflector.uncountable('news'); inflector.uncountable('rules'); declaring each model bit cumbersome , know if there's way make more general. finally reason using english grammar rule inflection? , inflection supposed provide? thanks

how to get integer value from Ms Excel to java -

i imported apache.poi package , want integer value excel cell java console. know how string value excel cell java console system.out.println(sh1.getrow(0).getcell(2).getrichstringcellvalue().tostring()); but don't know how integer value. please me. the code below. import java.io.fileoutputstream; import org.apache.poi.hssf.usermodel.hssfworkbook; import org.apache.poi.ss.usermodel.workbook; import org.apache.poi.ss.usermodel.sheet; import org.apache.poi.ss.util.workbookutil; import org.apache.poi.ss.usermodel.row; import org.apache.poi.ss.usermodel.cell; public class excel { public static void main(string[] arg){ workbook workbook = new hssfworkbook(); sheet sh1 = workbook.createsheet("sheet1"); cell cell1 = sh1.createrow(0).createcell(0); cell cell2 = sh1.createrow(0).createcell(1); cell cell3 = sh1.createrow(0).createcell(2); cell1.setcellvalue(100); cell2.setcellvalue(200); cell3....

how to use @Service annotation in Spring MVC to create the bean of Service layer -

can tell how bean of service layer in spring mvc. 1 way bean of service layer using @service annotation how that, don't know. controller: @controller public class configureapplicationcontroller { @requestmapping(value="/configureapplication.html", method=requestmethod.get) public modelandview getlistofallconfigureapplication(){ appconfigureserviceimpl getservice=new appconfigureserviceimpl(); arraylist<configureapplication> results =getservice.getlistofallappconfigure(); modelandview model=new modelandview("configureapplication"); model.addobject("results",results); return model; } and serviceimpl is: @service("appconfigureserviceimpl") public class appconfigureserviceimpl implements appconfigureservice { public arraylist<configureapplication> getlistofallappconfigure(){ @suppresswarnings("resource") applicationcontext ctx=new classpat...

ajax - Pagination in gridview Yii2 without page reload -

i yii2 beginner. have completed of grid-view except pagination. tried use pjax can't find solution. you have set timeout pjax (default 1000 ms). not enough , plugin reload page completely. <?php \yii\widgets\pjax::begin(['timeout' => 10000, 'clientoptions' => ['container' => 'pjax-container']]); ?> <?= gridview::widget([ // ... configuration here ]);?> <?php \yii\widgets\pjax::end(); ?> see here

What is the difference between <include> and <ViewStub> tags in android? -

i fresher in android development,and curious know difference between , i've read tutorials, haven't yet found simple example usage. would happy if provide such example or give pointer one. <include /> include xml contents in base xml file if whole thing single big file. it's nice way share layout parts between different layouts. <viewstub /> bit different because not directly included, , loaded when use/need it, i.e. when set visibility "true". nice optimization because have complex layout tons of small views or headers anywhere, , still have activity load fast. once use 1 of views, it'll loaded. include it used reuse layout resource viewstub it used lazily inflate layout resource

parsing - Getting frame count and delay between frames from gif using javascript -

Image
i trying know frame count , delay between frames of gif usign javascript , without actualy parsing gif canvas, possibly header . after long search in google, return no results, i've tried understand gif parsign libraries such 'giflib' no success of understanding. at end want using simple code cant include library existed code , an y other parsing tools wont used @ all , specific parameters thanks. how jsgif ? it allows parse animated gif file javascript , add controls it. modification can change counter of how many frames gif file has?

javascript - How to form POST message from several dialog menus? -

i have several pop-up menus (like modal menus in bootstrap). need collect information of them ( user filling first menu, after or presses next, first menu disappears , next menu appears , on) , in end user presses submit on last menu , passes whole collected information on server side. how can collect information among menus on client side? example of dialogs here: http://jsfiddle.net/opustics/rftoafs2/1/ with 4 step-by-step menus: <div id="test-modal-11" class="white-popup-block-big mfp-hide" style="text-align:center;"> <div id="test-modal-12" class="white-popup-block-big mfp-hide" style="text-align:center;"> <div id="test-modal-13" class="white-popup-block-big mfp-hide" style="text-align:center;"> and <div id="test-modal-14" class="white-popup-block-big mfp-hide" style="text-align:center;">

javascript - CasperJS not working in login website -

here code, want print out element's value logged in page have, failed. https://mp.weixin.qq.com/cgi-bin/loginpage?t=wxm2-login&lang=zh_cn page want login. /** * usage: casperjs test.js 111111@qq.com password * # phantomjs --version * 1.9.7 * # casperjs --version * 1.1.0-beta3 */ var casper = require('casper').create({ loglevel: 'debug', verbose: true, pagesettings: { loadimages: false, // not load images loadplugins: false // not load npapi plugins (flash, silverlight, ...) }, clientscripts: [ './jquery-1.11.1.min.js' ], }); casper.useragent('mozilla/5.0 (windows nt 6.1; rv:29.0) gecko/20100101 firefox/29.0'); // removing default options passed python executable casper.cli.drop("cli"); casper.cli.drop("casper-path"); if (casper.cli.args.length === 0 && object.keys(casper.cli.options).length === 0) { casper.echo("no arg nor option passed"...

asp.net - multiline can stored text just 128 Character -

i got stuck on need store data multiline textbox sql server database , write code this asp.net <asp:textbox id="txtproductfeatures" runat="server" cssclass="full-width-input" textmode="multiline" rows="10"></asp:textbox> code behind cmd.parameters.addwithvalue("@productfeatures", txtproductfeatures.text.replace("\r\n", "<br />")) i tried store lorem lorem ipsum dolor sit amet, consectetur adipiscing elit. vestibulum ultrices luctus semper. mauris facilisis ac mauris id commodo. cras non efficitur magna, non sollicitudin erat. maecenas blandit nisl est mollis, eu luctus mi euismod. mauris aliquam lorem nec risus vehicula, vel faucibus ante tincidunt. sed erat odio, fermentum @ nulla ut, fringilla gravida orci. quisque interdum, massa sed laoreet auctor, ipsum nisi ornare libero, dignissim risus nunc ac magna. suspendisse tortor mi, blandit id ipsum ac, mattis fi...

Rename the dir once update is finished - perl -

platform - windows7 i looking script change name of latest modified directory : here how getting latest modified directory : my $epoch_timestamp = (stat("logdir"))[9]; @date=localtime($epoch_timestamp); $date[5] +=1900; $date[4] +=1; print "$date[5]-$date[4]-$date[3] $date[2]:$date[1]:$date[0]\n"; exp : c:/dir_name/renamedir i have folder c:/dir_name ; inside copying 1 folder after another. need change name of folder has been copied completely. c:/dir_name/renamedir1 c:/dir_name/renamedir2 the issue facing : need change name once update finished, i.e. after files have been copied in dir. so can let me know how come can sure files got copied in folder? could please try way: use file::copy; $origdir = 'c:\dir_name\renamedir1\file1.txt'; $desdir = 'c:\dir_name\renamedir2\file1.txt'; #check whether files copied or not copy($origdir, $desdir) || die "couldn't able copy files: $!"; on other way try c...

mysql - compare date from database with value i get from inputtext in java jsp and sql -

i have table , there 4 fields: name , start date , time (timestamp) , end date , time (timpestamp) , car . in java/mysql, i need compare database start date time , end start date time , compare value given in textbox date time field . now problem need book person(driver) , car, if car , person not booked in given time (that checked database) , can booked else not. please tell me logic/query this. if have code please mention it. try query, select name table having '2014-11-28' between start_date , end_date;

create a 24*30 matrix from a 100*30 matrix excel vba -

i have looked , didn't found suits problem. so, have 100*30 matrix , want make average of first 4 elements in first row, average of next elements in first row , on. from this, i'll have 24*30 matrix. i've done that, mt log paste results spaced 4 elements. how can create matrix ? here's code: private sub commandbutton1_click() dim media_horaria long dim hora long media_horaria = 0 hora = 0 sheets("folha1") = 28 58 j = 3 100 step 3 hora = cells(i, j).value + cells(i, j + 1).value + cells(i, j + 2).value + cells(i, j + 3).value media_horaria = hora / 4 cells(i + 45, j).value = media_horaria next j media_horaria = 0 hora = 0 next end end sub edit: with result matrix, create colour map depending on cell value. instance, if cell value under 0.5 , above 0.45 paint in light red. if cell above 0.50 , under 0.55 ...

javascript - Preview image by its own id separately for each comment -

in commentary upload image system, browse image , display it. if browse image in comment, display others comment's display field. possible display browse image each comment separately own $id. (n.b. comment field show/hide own $id, remove here use) this work http://jsfiddle.net/er9e72ww/2/ and preview image script is: //preview image $(".repfile").change(function(){ previewpic(this); }); function previewpic(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { $(".preview_rep").attr('src', e.target.result); $(".output_rep").show(); $(".replycom").focus(); $('#img').hide(); }; reader.readasdataurl(input.files[0]); } } and php upload form: <div align="left" id="show_img_upload_rep" class="show_img_upload_rep" style="padding-top:5px; display:none"> <d...

java - What does the dot operator `.` (before the generic parameter) mean? -

i saw code today: immutablemap<class<? extends clientcommand>, commandprocessorinterface> immutablemap = immutablemap.<class<? extends clientcommand>, commandprocessorinterface>of(... what syntax mean? immutablemap.<class .. i knew generics right after class name. no? what difference between: immutablemap<class.. , immutablemap.<class.. it means you're invoking generic static method, called of in immutablemap class. it's pretty same you're invoking static method, nested in class: someclass.staticmethod(); for cases when method has type-parameter defined, can explicitly provide generic type , done this: someclass.<type>genericstaticmethod(); and answer final question: what difference between immutablemap<class...> , immutablemap.<class... ? the first used when creating instance of generic class. it's used define generic-type on class level, while second used...

c# - CustomAttribute with property that is a AttributeTarget property name as string -

i want change customattribute usage in way, i'm using refer search parameters of autocomplete dropdown now: [entitysearchdropbox(id="id",searchcolumns="name")] public virtual class mytarget but hate strings defining entity properties , best solution me passing attributetarget property without writing free strings. [entitysearchdropbox(id=mytarget.id,searchcolumns=mytarget.name)] public virtual class mytarget mytarget example public class mytarget{ public int id {get; set;} public string name {get; set;} public string otherproperty { get; set; } //etc.. }

How to set a custom font of Webview in Android 4.2.2? -

Image
i want set custom font in webview android 4.2.2. did code set custom font that's not working on 4.2.2 , same code working on other android version. here used below code data="ઘૂંટણની સખત ત્વચા અને કાળી પડી ગયેલી કોણી પર લીંબુમાં ખાંડ મિક્સ કરી આ મિશ્રણ બરાબર ઘસો"; string head = "@font-face {font-family: 'myfont';src: url('file:///android_asset/notosansgujaratiui-regular.ttf')}body {font-family: 'myfont';}"; string htmldata = "" + head + "" + data + ""; webview.loaddatawithbaseurl("", htmldata, "text/html", "charset=utf-8", ""); i post screenshots of running device it shows working device in green circle , not working device in red circle means 4.2.2 pls give me solution regarding this

python - Middleware redirect user to path if user is invalid -

im trying write middleware redirect auth users if invalid members. here code: from django.conf import settings django.http import httpresponsepermanentredirect class usercheckmiddleware: def process_request(self, request): #paths inactive_path = settings.inactive_user_url #first check if user logged in if request.user.is_authenticated(): #check if user has valid membership if not request.user.profile.is_valid_member: #check if path inactive_path prevent endless redirectloop if not request.path in (inactive_path): #redirect inactive_path return httpresponsepermanentredirect(inactive_path) here model code: class profile(models.model): user = models.onetoonefield(user) memberend = models.datetimefield(blank=true, null=true) def is_valid_member(self): if self.memberend: #return true if memberend in fut...

imagej - Where to find for IJ package documentation? -

i going work fiji (fiji imagej). want learn package ij. have searched lot not getting whole document (same javadoc) , difficult search each method.(i have source of imagej). if 1 know link ij package document can found. the javadoc ij.ij class here . in addition, http://javadoc.imagej.net/ provides links javadocs of imagej-related projects.

c - Normalize random value of _int64 -

let's suppose have noramlly distributed random int values function: unsigned int myrand(); the commonest way shrink range [0, a] (int a) follows: (double)rand() / uint_max * now need same values in range of __int64: unsigned __int64 max64; unsigned __int64 r64 = myrand(); r64 <<= 32; r64 |= myrand(); r64 = normalize(r64, max64); the problem normalize return range __int64 because not placed in double. wouldn't use various libraries big numbers due performance reasons. there way shrink return range , while saving normal distribution of values? the method give (double)myrand() / uint_max * is broken. example, if = 1 , want integers in range [0, 1] ever value of 1 if myrand () returned uint_max. if meant range [0, a), value 0, still broken because in case return value outside range. no matter what, introducing bias. if want a+1 different values 0 inclusive, , 2^32 ≤ < 2^64, proceed follows: step 1: calculate 64 bit random number r did. if 1...

python - Adding spaces in elements of list(PY) -

i have problem: i have list consists of elements of different lenghts: det_slopes_jkh = ['superpipe bolgen','jatzpark','avalanch training center','bräma schwer'] and add spaces ' ' shorter words, purpose of having elements of list same lenght. det_slopes_jkh2 = [] element in det_slopes_jkh: if len(element) < len(element[2]: det_slopes_jkh2.append(element + ' ') thanks your goal not clear assuming want have strings of same length. this adds space each string until of same length (the length of longest string): def equalize_lengths(l): length = len(max(l, key=len)) return [e.ljust(length) e in l]

matlab - how to generate bit sequence randomized over 2 bits -

i have network 4 different types of nodes a, b, c , d represented 00, 01, 10 , 11 respectively. want create random sequence of nodes, e.g. a b d c d c b c d (00 01 11 10 00 11 10 01 10 11) , such that: no_of_type nodes > no_of_type b nodes > no_of_type c nodes . how can generate such bit sequence using matlab. use randperm obtain random permuation of ordered sequence of as, bs, cs , ds number of as, bs, cs, ds descending. can achieve drawing random numbers have constant sum (effectively drawing 1 less) , sorting them. in simple approach need retry several times because numbers of as, bs, cs or ds cannot equal according specification. code example: % total length of sequence n = 10; % try again until found list of lengths has no equal entries ni = [0,0]; % long there 2 equal numbers inside while any(diff(ni) == 0) % 1 length can value n1 = round(rand()*n); % remaining n2 = round(rand()*(n-n1)); % remaining n3 = round(rand()*(n-n1-n2)...

uitableview - Table layout / swift - iOS -

i'm trying re-create view in ios using swift. i saw example on site: http://www.binpress.com/app/ios-data-grid-table-view/586 unfortunately not know language objective-c. can me giving me advice on implementation? you can use custom cell or prototype cell , use basic tableview delegate methods. work you. your basic method below: func tableview(tableview: uitableview!, numberofrowsinsection section: int) -> int { return self.items.count; } func tableview(tableview: uitableview!, cellforrowatindexpath indexpath: nsindexpath!) -> uitableviewcell! { var simpletableidentifier:nsstring="viewcontroller1" var cell:viewcontroller1?=tableview.dequeuereusablecellwithidentifier(simpletableidentifier) as? viewcontroller1 if (cell == nil) { var nib:nsarray=nsbundle.mainbundle().loadnibnamed("viewcontroller1", owner: self, options: nil) cell = nib.objectatindex(0) as? viewcontroller1 ...

xsl fo - Horizontal blocks using XSL-FO -

using xsl-fo, possible create horizontal block elements? want every line has variable number of columns variable lenght. don't use table objects because every line has different number of "columns". possible using blocks or other elements?

How to make the URL shorter using Javascript/JQuery? -

i trying make url shorter access html pages different folders. my folder structure is: project -output -files -css -js -html when trying access files html folder, need write complete url in browser. eg. http:// coder:8055/ files/html/login.html but, want use url: http:// coder:8055/ login.html same folder structure. same problem showing other html files access folder structure. want keep same folder structure , show shorter url in browser. how create type of url access html files...? this worked history.pushstate('', '', '/login.html');

regex - Powershell search matching string in word document -

i have simple requirement. need search string in word document , result need matching line / words around in document. so far, search string in folder containing word documents returns true / false based on whether find search string or not. #error reporting set-strictmode -version latest $path = "c:\morlab" $files = get-childitem $path -include *.docx,*.doc -recurse | where-object { !($_.psiscontainer) } $output = "c:\wordfiletry.txt" $application = new-object -comobject word.application $application.visible = $false $findtext = "crhpcd01" function getstringmatch { # loop through *.doc files in $path directory foreach ($file in $files) { $document = $application.documents.open($file.fullname,$false,$true) $range = $document.content $wordfound = $range.find.execute($findtext) if($wordfound) { "$file.fullname has $wordfound" | out-file $output -append } } $document.close() $application.quit()...

c# - Can I check if the selectedItem of comboBox is there in the itemsource or not using triggers and/or converters? -

i have various comboboxes in various view have different itemsource want generic way check if user selected value there in corresponding itemsource. comboboxes editable want inform user when enetering junk value changing foreground red. <window x:class="customcombobox.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <stackpanel verticalalignment="center"> <combobox name="cmbbox" width="100" height="30" iseditable="true" staysopenonedit="true" > <combobox.style> <style targettype="combobox"> <style.triggers> <trigger property="sel...

mysql - Trying to check the login credentials using JDBCTemplate, But failed to Execute Sql Queries -

here java code: public user checkcredentials(string username, string password){ string sql="select * ct_login_user_t login_user_name = ? , login_user_password = ?".touppercase(); system.out.println("checking valid user."+sql); user user=(user)getjdbctemplate().queryforlist(sql, new obje ct[]{"%"+username+"%","%"+password+"%"}, new beanpropertyrowmapper<user>(user.class)); system.out.println("user in impl....."+user); return user; } i getting following exception: java.sql.sqlexception: invalid argument value: java.io.notserializableexception

Chaging the output directory of CMake generated files -

my project has structure : root |- src/ |- bin/ |- include/ |- cmakefiles/ |- cmakelists.txt when run cmake command generates files : cmakecache.txt , cmake_install.cmake there way send automatically in cmakefiles or delete afterwards ? i want use cmake (not command line combo cmake -g"unix makefiles" && rm -f cmakecache.txt cmake_install.cmake ) it better use out-of-source build tree. create new directory build : root |- src/ |- bin/ |- include/ |- cmakefiles/ |- cmakelists.txt build and run cmake in build directory: cd build cmake ../root all cmake generated files , build artifacts located in build tree , not pollute source directory. it recommended way work cmake : http://www.cmake.org/wiki/cmake_faq#out-of-source_build_trees

node.js - Cannot call method 'use' of undefined -

Image
i have problem implementing passport in node.js express. i trying follow different guides, won't succeed.. this time theres error this: my code looks this: in app.js: var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); // configuring passport var passport = require('passport'); var expresssession = require('express-session'); // todo - why need key ? app.use(expresssession({secret: 'mysecretkey'})); app.use(passport.initialize()); app.use(passport.session()); any idea why wont work? have installed express-session, passport, passport-local etc. you need initialize app express() var express= require('express'); var app=express();

hadoop - Solr - IO Exception while posting data: java.net.ConnectionException -

i trying use apache solr index data on clouera in hadoop using cloudera's cdh 4.7 $ java -durl=http://localhost:8983/solr/collection1/update -jar post.jar monitor.xml" throws error "simpleposttool version 1.5 posting files base url http://localhost:8993/solr/collection1/update using content-type application/xml.. posting file monitor.xml simpleposttool: fatal: ioexception while posting data: java.net.connectexception: connection refused" i ensured other settings have been performed correctly. went through blogs posted couldn't still figure out why connection getting refused. solr service in cloudera manager running on port 8983. please help. in advance i recommend go cloudera cdh 5.2 has resolved issue. solr folder missing in /user/share/docs , have explicitly put solr files inside.

javascript - How to add dynamic dropdown values in jQgrid? -

in editoptions select dropdown pass static values after instantiate of grid_data. works fine until choose editing. data remains constant , static. all dropdown remains same. should not happen, has load appropriate data rows should dynamic. var data = { "id" : "citygrid", "grid_data" : response, "colnames" : ['city name','select state','local'], "colmodel": [ {"name":'cityname',"index":'cityname', "width":150,"editable": true,"editoptions":{"size":"20","maxlength":"30"}}, {"name":'selectstate',"index":'selectstate',"width":90,"editable": true,"edittype":"select","editoptions":{"value":"tn:tamilnadu;ap:andhrapradesh;mp:madhyapradesh", ...

jersey - Embedded Java HTTPS server for integration testing -

i'm writing integration tests mule esb application connects external api via https. i'd mock external api , run end-to-end integration test during maven build. question setting embedded https server. i've tried use jersey, provides http. looking @ example https://github.com/jersey/jersey/tree/master/examples/https-clientserver-grizzly and wondering if there still manual step involved, or if works automatically setting every time build kicked off. any suggestions or ideas? edit. final goal deploy jax-rs service in embedded server accessible via https. , needs no client-side keys/certificate configuration. edit 2. problem concerns certificates. point of integration tests mock external components , verify application works. now, if set embedded https server , use cmd-line built certificate, need add ssl configuration in client (as @ryan hoegg pointed out). not ideally want: there solution working without having modify client application code? should general java...

cqrs - NEventStore RavenDB - Obtain Commit Data -

i'm working through basic example of working neventstore ravendb , i've hit stumbling block. i've managed succesfully commit events ravendb datasource, need pull them out, replay them (cqrs - es) pattern. i can bring collection of eventmesssage objects usng neventstore istoreevents unterface :- public ienumerable<eventmessage> getevents(guid aggregaterootid) { using (var stream = _store.openstream(aggregaterootid, 0)) { return stream.committedevents; } } in each eventmessage, can access header & body properties. in body property actual event have submitted, want pull out , inspect. i'm not sure if i'm trying achieve correct. should using raven idocumentstore class retrieve event objects or should done via neventstore stream. at basic level you're doing correct: it's same code shown in quick-start neventstore sample code . if work in more ddd context, shoul...

javascript - An iframe that contains a photo slideshow breaks on Chrome -

i have weird problem , can't seem find wrong. let me explain step step. here link slideshow developed: http://guusebump.com/view/lennie/weddings (pin 1234). click on play , slideshow play music. i've developed widget version slideshow, located at: http://guusebump.com/widget/lennie/weddings , works fine well. now, problem is, i'm trying plug widget in website using iframe: <iframe width="900" height="600" frameborder="0" scrolling="yes" marginheight="0" marginwidth="0" src="http://guusebump.com/widget/lennie/weddings"></iframe> but slideshow wouldn't work on chrome - won't work. link: http://trisle.net/demoguuse/ (scroll down bit widget). tested site on safari , firefox, works browsers not on chrome. not sure happen on browsers, i'm sure there's wrong iframe. what think? appreciated :) -update- the screen record of error is: https://www.dropbox.com/s/j2ujp...

android - Open pdf in adobe reader from https -

this gives me toast message error: document not opened : intent adobeintent = getpackagemanager().getlaunchintentforpackage("com.adobe.reader"); if (adobeintent != null) { adobeintent.setdataandtype(uri.parse("https://www.adobe.com/enterprise/accessibility/pdfs/acro6_pg_ue.pdf"), "application/pdf"); startactivity(adobeintent); } and working fine: intent adobeintent = getpackagemanager().getlaunchintentforpackage("com.adobe.reader"); if (adobeintent != null) { adobeintent.setdataandtype(uri.parse("http://www.adobe.com/enterprise/accessibility/pdfs/acro6_pg_ue.pdf"), "application/pdf"); startactivity(adobeintent); } am missing parameter or not possible?

Need Whatsapp Api for Sending SMS from Website to WhatsApp? -

i have developed website www.mobilestore.pk need support of sending sms whatsapp. googled thing not found solution. can body suggest me php api? need aprox 500 sms per day. check these apis : whatsapi you can see tutorial use those. usage

excel - If two sets of dates fall within another set of dates -

Image
see example below. i need show true , false values shown in example. the logic needs make sure "start , end" falls within columns time period. column d's time period therefore 9th 14th dec, next column (e) 15th 20th december , on. think of gantt chart showing timeframes. here version =and(d$1<=$b2,e$1-1>=$a2) see: check if 2 date ranges overlap note: above formula can shown equivalent 'not' form using de morgan's law could simplify further =and(d$1<=$b2,e$1>$a2)

arrays - ReferenceError: Error #1069 Actionscript 3 -

so have been stuck on 2 weeks , have no idea how progress. i have array of movie clips called "_main.speederarray" , i'm trying make if collide each other both destroyed. here code in "speeder class" detect collision. private function detectionhandler():void{ //trace("array length", _main.speederarray.length); detectionid = _main.gamecounter; ( var i:int = _main.speederarray.length -1; >= 0; i--){ var speeder:speeder = _main.speederarray[i]; if(speeder.destroyme) continue; if(speeder.detectionid == this.detectionid) continue; if (boxintersect(this, speeder)){ trace("collision"); destroyme = true; speeder.destroyme = true; } } } here boxintersect function code refers to. it's in same class private function boxintersect ( speeder1:speeder, speeder2:speeder):bool...

javascript - magnifying DIV using jquery? -

Image
i have div on page position absolute , id magnify , under div there div auto moving/scrolling small images... what i'm trying make div magnify act magnifying glass.. so each small image goes under div, shows image bit bigger magnifying glass. here have far code doesn't make magnify div magnifying glass , don't understand why! <script> $(document).ready(function () { function () { $('#magnify').animate({ 'zoom': 1}); } }); </script> could please advise on this? edit: this example of referring to: so icons moving/scrolling under magnifying glass/div... magnifying div doesn't move. thing moves images/icons under magnifying glass. i'm not sure how slider works when image want magnify active/under 'magnifying glass' add css class scale using css. i.e. .image { transition: .2s ease-in-out; } .image-active { transform: scale(1.5); }

authentication - How to prevent a window to load if it has not previously gone through the stage of login in Java? -

i have made program in java has 2 windows (jframes): a) log-in window, b) main window. the correct way run program run first "log-in window" , if username , password correct, window redirects "main window", making "log-in window" dispose. but if runs directly "main window" (ignoring log-in stage), window run correctly without authentication ... so how can prevent "main window" loading , running if runs directly (e.g. >> java main_window )? want program run only order (1) "log-in window" , (2) "main window". edit the main_window class has 1 main method below code: public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { final main_window frame = new main_window(); frame.setlocationrelativeto(null); frame.setvisible(true); frame.addwindowlistener(new windowadapter() { ...

arduino serial communcation with vixen -

Image
i trying use arduino take incoming data vixen software through serial comm. , move data 12 other arduino works if keep channel numbers vixen 43 need control 480 channels. first arduino controls 43 channels next 44-87 , on. this master code: `void setup() { serial.begin(9600); serial3.begin(9600); } void loop() { // read port 0, send port 1: if (serial.available()) { int inbyte = serial.read(); serial3.write(inbyte); } } slave code: // output int cue1 = 3; int cue2 = 4; int cue3 = 5; int cue4 = 6; int cue5 = 7; int cue6 = 8; int cue7 = 9; int cue8 = 10; int cue9 = 11; int cue10 = 12; int cue11 = 13; int cue12 = 22; int cue13 = 23; int cue14 = 24; int cue15 = 25; int cue16 = 26; int cue17 = 27; int cue18 = 28; int cue19 = 29; int cue20 = 30; int cue21 = 31; int cue22 = 32; int cue23 = 33; int cue24 = 34; int cue25 = 35; int cue26 = 36; int cue27 = 37; int cue28 = 38; int cue29 = 39; int cue30 = 40; int cue31 = 41; int cue32 = 42; int cue33 = 43; int ...

c - Unable to kill processes running concurrently -

i running program a.c concurrently, 5 times. part of code given below: int main(int argc, char *argv[]){ char s = 0; int = 0; pid_t procb_id = 0; int retval = 0; struct sigaction act; ch = &c[0]; memset(c, 0, 50); // open file entered in command-line reading fptr = fopen(argv[1], "r"); if(fptr == null){ printf("error - input file not opened reading!\n"); exit(exit_failure); } // write characters read file pointer array while((s=fgetc(fptr)) != eof){ ch[i] = s; i++; } printf("length of text: %d\n",i); sigemptyset(&act.sa_mask); act.sa_flags = sa_siginfo; act.sa_sigaction = handlera; if((sigaction(sigrtmin, &act, null)) != 0){ printf("signal not registered!\n"); } //get pid of daemon b able send real-time signal, indicating has started procb_id = getbprocessid(); printf("pro...

asp.net - SQL Query - SELECT WHERE Table1.ID = Table2.ID AND Table2.Var = @Var -

Image
i trying create sql query asp net drop down list using 2 tables , session variable. i want retrieve values table 1 correspond matching ids in table 2, table 2 filtered external variable. as clear not know how word question, here simplified example of attempting do: my site has session variable holds current colour user "filtering". a dropdown list show list of cars corresponding colour using sql query. for example if session variable "blue" dropdown list contain "punto" can see colour id "blue" 12 , "punto" car name corresponding colour. linked image: http://i.imgur.com/fe9l12c.png as session variables can assigned , called in asp net custom queries session variable can referred as, example, @externalvar (colours.id (colours.name = @externalvar)) apologies had word quiz question; giving simplified example way articulate question. i think should trick if understand question above select * cars c inner jo...

grep - How to extract multiple line strings between two keywords using grepwin -

hi have directory of files , each file has multiple languages text strings on multiple lines. using grepwin extract english text strings , save text file. typically in each file english text inside switch/case condition this: default //english bitmap 8 20 "bmp5/warning.bmp" ltext 5 1 11 "usb device overload" ltext 85 20 13 "usb" ltext 50 33 13 "device overload!" break case _french bitmap 8 20 "bmp5/warning.bmp" ltext 5 1 11 "surcharge clé usb!" ltext 45 30 13 "surcharge clé usb" break since english text between 'default' , 'break' want use 2 keywords delimeter. text between 2 keywords needs saved out text file. can @ all. thanks guys through grep. $ grep -opz '(?s)(?<=\n|^)default\b[^\n]*\n\k.*?(?=\nbreak\b)' file bitmap 8 20 "bmp5/warning.bmp" ltext 5 1 11 "usb device overload" ...

html - Turning navigation bar into a drop down navigation -

i'm trying edit code when hovers on products, drop down , show different sub categories, want display 4 options, 450, 250, 2 strokes , junior. here html: <link rel="stylesheet" type="text/css" href="website.css"> <font face="tahoma"> <font color="lightgray"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <style type="text/css"> body { font-family: verdana, helvetica, sans-serif; font-size: 20px; } .horizontal_menu { display: inline; text-align:center; border: 1px lightgray; background-color: white; opacity: 0.5; filter: alpha(opacity=50); margin: 2px; border: 2px solid #a1a1a1; padding: 5px 20px; width: 800px; border-radius: 10px; } .horizontal_menu li { text-align:center; ...

javascript - Semantic UI Sidebar & Dropdown menu -

i trying create simple web ui semantic ui. i want sidebar menu in in items have subitems... shouldn't hard hu? http://jsfiddle.net/ycm8ctfx/ <div class="ui vertical menu sidebar teal"> <div class="menu"> <a class="item" target="_blank" href="http://semantic-ui.com/modules/dropdown.html"> example </a> <div class="ui left pointing dropdown link item"> <i class="dropdown icon"></i> messages <div class="menu"> how sub items "fly-out" of sidebar on normal page content? if click "messages" within example, menu appear (watch scrollbar @ bottom appear) since children of sidebar, being shown within sidebar. want them float on normal content! didn't work via fiddle z-index any hints appreciated! cheers, corelgott if sidebar configured use overlay transition can fixed specifying ....

Facebook oauth dialog redirect without code -

i'm trying code use /oauth/access_token access_token facebook app. i've read (here , in facebook dev docs access token), have make request @ adress : http://www.facebook.com/dialog/oauth/?client_id=269256053176066&redirect_uri=https%3a%2f%2fwww.outils.ch%2ffacebook%2fgroupemutuel%2fcanevas%2fadvices%2f&scope=publish_stream,manage_pages and should give me parameter code use generate access_token. i'm stuck, redirect me facebook app page, without code. i've been on since yesterday , can't figure i'm missing , dont find similar post. well find out problem, page redirecting automatically facebook app page (whitout code). able find code chrome console in network tab.

how can i move the content of a svn folder in another? -

we have svn folder stucture this: svn-repo | +------usera | | | +----projaa | | | +----projab | ... | +------userb | | ... +----projba | +----projbb ... with sources directly under projaa, proj ab, ... we want make use of tags , branches in future. therefore want have structure this: svn-repo | +------usera | | | +----projaa | | | | | +---tags | | | | | +---branches | | | | | +---trunk | | | +----projab | | | | | +---tags | | | | | +---branches | | | | | +---trunk | ... | +------userb | | ... +----projba | | | +---tags | | ...