Posts

Showing posts from July, 2012

oracle - Dashes Causing SQL Trouble in DBI -

i have sql query clause typically has values including dash stored in database char(10). when explicitly call in following: $sth = $dbh->prepare("select status_code mytable acc_type = 'a-50c'"); it works , returns 1 row; if following: my $code = 'a-50c'; $sth = $dbh->prepare("select status_code mytable acc_type = ?"); $sth->execute($code); or do: my $code = 'a-50c'; $sth = $dbh->prepare("select status_code mytable acc_type = ?"); $sth->bind_param(1, $code); $sth->execute(); the query completes, no results. suspect has dash being interpretted incorrectly, can't link perl issue have printed $code variable using print "my content: $code\n"; can confirm not being strangely converted. tried including third value bind_param , if specify ora_varchar2, sql_varchar (tried possibilities) still no results. if change long form i.e. { type => sql_varchar } gives me error of dbi::st=has

javascript - How do I get the filename of an input file and display it again on button click without uploading it? -

Image
i having hard time thinking on need achieve goals. goals: 1. copy filename of file want upload , display when click on button not upload it. 2. able upload when submit button clicked. steps: step 1: choose file upload. click on choose file. step 2: should show name of file i've chosen on step 1. then, click on "next". step 3: clicking "next" display what's in step 2 it's grayed-out , instead of next button, there "submit" button. it's confirmation if sure upload file. when click on "submit", that's time file gets uploaded. so need able step 3. don't know how though. :'( . i using php , js on this. i not sure if question correct. feel free provide corrections well. any very appreciated. much!!! here quick snippet to, hopefully, going: <body> <input type="file" name="upload" id="upload"> <div id="filename"></div>

ios - Do I need to embed a UINavigationController & Programmatically add UINavigationBar? -

i don't see of navigation bar. there outline of nav bar be. set navigationbar color , tint colors define nav bar if had no items. i used storyboards make functional ui. my story board ui includes delegates,custom collection view cells,custom table view cells,and animations. by end of app wanted add nav bars programmatically each of viewcontrollers. (see code) i have used code in 6 other classes. , have 6 flawless navigation bars in viewcontrollers. - (void)viewdidload { [super viewdidload]; uitapgesturerecognizer *tapgesture = [[uitapgesturerecognizeralloc] initwithtarget:self action:@selector(titlegesturelabelmethod)]; uilabel * titleview = [uilabel new]; titleview.text = @"title"; titleview.textcolor = [uicolor greencolor]; [titleview sizetofit]; titleview.userinteractionenabled = yes; [titleview addgesturerecognizer:tapgesture]; self.navigationitem.titleview = titleview; [self.v

javascript - fullPage js scrolls wrong height in IE -

i developing website fullpage js create scrolling site. the scrolling works fine in chrome , firefox in internet explorer off. the scroll goes in between pages , wrong pages , can't use site @ all. don't know why happening. www.mpaccione.com/correlation-one/index.html in the fullpage.js documentation can read following: be careful! data-anchor tags can not have same value id element on site (or name element ie). looking resulting html code can see how use anchor employers , id employers : <div id='employers' class='howworks graybg'></div> ie might not case sensitive.

Batch File compare 3 Strings in a row, multiple strings -

i want check condition, if 2 files' modified dates have been updated system's date, trigger something. code works, except %dateonly%==%systemdate%==%ziponly% , part has issue, right format compare 3 strings in batch? or there way separate them? all!! @echo off /f "tokens=1,2,3,4 delims=. " %%i in ('date /t') set systemdate=%%k%%j echo %systemdate% system date pause %%a in (d:\myfile.txt) set filedate=%%~ta set dateonly=%filedate:~0,10% echo %dateonly% modified date pause %%a in (d:\daildn.txt) set zipdate=%%~ta set ziponly=%zipdate:~0,10% echo %ziponly% modified date pause :check if %dateonly%==%systemdate%==%ziponly% ( start c:\dailyrun.bat ) else ( cls echo please waiting files ready timeout /t 10 /nobreak goto :check )

Detect programmatically, if the System lock can be disable or not in Android? -

there few apps out there installing user unable remove system-security. eg.. when user installs outlook configured exchange, prompted set pin/password , , after none , slider option grayed out in system security page. can programmatically detect whether none or slider grayed out or not given device ?

c++ - matlab c shared library: capturing matlab function output with mxArray*/mxArray** -

i trying call matlab function c code, trying follow whatever can on web. using matlab version r2014a running on ubuntu 14.04. lets function testfun.m looks below -- function c = testfun(a, b) disp('doing testfun()'); c = + b ; disp('done testfun()'); end now invoked mcc make c-wrapper -- user@pc:/tmp/test$ mcc -b csharedlib:libtestfun testfun.m -v then have libtestfun.c , libtestfun.h , libtestfun.so files , create c file calls testfun() -- #include <stdio.h> #include "libtestfun.h" int main() { libtestfuninitialize(); mxarray *a, *b, **c; double *x ; = mxcreatedoublescalar(4); x = mxgetpr(a); printf("a = %.1f\n", x[0]); b = mxcreatedoublescalar(5); x = mxgetpr(b); printf("b = %.1f\n", x[0]); *c = mxcreatedoublematrix(1, 1, mxreal); mlftestfun(1, c, a, b); x = mxgetpr(c[0]); printf("c = %.1f\n", x[0]); libtestfunterminate(); return 1 ; }

Including *.so files with gradle and Android Studio 1.2.2 -

can guide me on correct placement of *.so files supposed housed gradle/android project? i have them in: project->app->src->main->jnilibs and assets, java, , res folders siblings in main don't seem included when apk built causing 'unsatisfiedlinkerror' edit i have looked at: include .so library in apk in android studio and have tried changing director both libs , lib no luck. update 1 the apk de-compiled shows *.so files under /lib , have them under project -> app -> src -> main -> jnilibs -> armeabi , architecture but getting unsatisfiedlinkerror when calling method within native library although seems past system.loadlibrary call in static constructor without showing error *.so files included , shown in decompiled apk now...hitting issue posted here: unsatisfiedlinkerror when calling method native library although system.loadlibrary seems ok

How to show region specific products magento? -

how show products in magento based on selected state , city? there extension available feature? or how can achieve this? you can add 1 (city) or 2 (state , city) attributes in product model (by back-office panel). your news attributes can contain list (in example string delimiter commas) list of state/city product allowed sell. for retrieve state/city allowed list can : <?php // id product 12345 // city allowed list attribute code 'city_list' $id = 12345; $product = mage::getmodel('catalog/product')->load($id); $citylist = $product->getattributetext('city_list'); var_dump($citylist); output : string(38) "los angeles, new delhi, caen, etc, etc" it's possible may add ->getattributetoselect('city_list') after load($id) if attribute isn't retrieve catalog/product model.

How to transfer a money from one account to another account using paypal in android programmatically -

i working on android app eclipse adt. have integrate paypal escrow payment , haven't find appropriate documentation this. need sample code or suggestions on escrow payment. helpful thanks in advance the paypal api not support kind of case on mobile device. instead, you'd need implement functionality secure backend , call payout api.

oracle - Unscramble string code in sql -

i have function in oracle sql scrambles given input. need unscramble it. i need program can reverse output of program below. source in varchar2 sgarbled varchar2(510); index number; length number; onec number; begin length := length(source); if length > 255 length := 255; end if; index := 1; sgarbled := ''; while index <= length loop onec := ascii(substr(source, index, 1)) - 30; if (onec < 10) sgarbled := sgarbled || '0'; end if; sgarbled := sgarbled || cast(onec varchar2); index := index + 1; end loop; return sgarbled; end it can possible, if allowing character values in original string before scrambling it, characters of alphabet. code this: sgarbled in varchar2 unsgarbled varchar2(255); length number; index number; onec number; begin length := length(sgarbled); index := 1; unsgarbled := ''; while index <= length loop onec := substr(sgarbled, index, 1); if (on

c# - How to call a function whose parameter is char ** from dll? -

a function in dll defined this: int dlldir nvcp_ep_to_buf(int ep_id, unsigned char** o_buf); i want call function using dllimport , how declare function in c#, , how can call function? if call function in c++, allocate memory o_buf , call function, works.

ios - How to show .srt/subtitle file in MPmovieviewController -

i working on mpmovieviewcontroller player showing video in app need show .srt i have used below code if(self.liveplayer) { [self.liveplayer.view removefromsuperview]; [self.liveplayer stop]; self.liveplayer=nil; } self.liveplayer = [[mpmovieplayercontroller alloc] init]; [self.view addsubview:self.liveplayer.view]; self.liveplayer.view.frame = cgrectmake(5.0, 64.0, [[uiscreen mainscreen] bounds].size.width - 10.0, viwvideo.frame.size.height - 10.0); self.liveplayer.view.autoresizingmask=uiviewautoresizingflexiblewidth; [self.liveplayer.view settranslatesautoresizingmaskintoconstraints:true]; self.liveplayer.controlstyle = mpmoviecontrolstyledefault; self.liveplayer.moviesourcetype = mpmoviesourcetypestreaming; self.liveplayer.shouldautoplay = no; frame = self.liveplayer.view.frame;

ios - Apple Developer program Membership Enrolment -

i have enrolled individual / sole proprietor / single person business type membership programme. possible change type company / organization? yes can. can switch membership individual organization? yes, if founder/co-founder of organization. start conversion process, please contact us. may asked submit business documents verify company's identity. for reference: https://developer.apple.com/support/account/ steps: please check below link. hope helpful: [moving individual company] http://www.cocoanetics.com/2011/10/moving-from-individual-to-company/

Saving video from Android camera as local .mjpeg file -

i working on application save video .mpeg file on android devices. have been working vanevery's mjpeg project on github modest success, ( https://github.com/vanevery/android-mjpeg-video-capture-ffmpeg/blob/master/src/com/mobvcasting/mjpegffmpeg/mjpegffmpegtest.java ). here code far: public class videocapture extends activity implements onclicklistener, surfaceholder.callback, camera.previewcallback { public static final string logtag = "videocapture"; string szboundarystart = "\r\n\r\n--myboundary\r\ncontent-type: image/jpeg\r\ncontent-length: "; string szboundarydeltatime = "\r\ndelta-time: 110"; string szboundaryend = "\r\n\r\n"; private surfaceholder holder; private camera camera; private camcorderprofile camcorderprofile; boolean brecording = false; boolean bpreviewrunning = false; byte[] previewcallbackbuffer; file mjpegfile; fileoutputstream fos; bufferedoutputstream bos; button btnrecord; camera.parameters p; @overrid

javascript - Jquery Display Div with Interval -

i looking hide several divs 1 one or time interval of 5 seconds, tried below doesn't seem work though <div id="container"> <div id="data1">123</div> <div id="data2">456</div> <div id="data3">789</div> <div id="data4">012</div> </div> <script> $('document').ready(function(){ window.settimeout('mytimer()',5000); }); $('document').ready(function(){ window.settimeout('mytimer2()',10000); }); $('document').ready(function(){ window.settimeout('mytimer3()',15000); }); $('document').ready(function(){ window.settimeout('mytimer4()',20000); }); function mytimer(){ $('#data1').hide(); } function mytimer2(){ $('#data2').hide(); } function mytimer3(){ $('#data3').hide(); } function mytimer4(){ $('#data4').hide(); }

javascript - How to get the positions of an specified char? -

i have string "hello world". want positions of char "l" string. my code following: str = "hello world"; pos = str.search(/l/g); out.value = pos; the result of code 2, wanted result 2,3,9. how can result? edit: help. but want sum of (2+1*105) + (3+1*105) + (9+1*105). can me again? what small function it? str = "hello world"; find = (function(str,c){ results = [] for(i=0;i<str.length;i++){ if (str[i].tolowercase()===c) results.push(i) } return results }); find(str,'l') here working fiddle: http://jsfiddle.net/bx8sj0gv/

Cordova build -release Android Unsigned apk -

i'm trying generate release apk deploy on play store. i'm running command sudo cordova build android --release which generating me file named android-release-unsigned.apk i tried many solutions, creating keystore keytool -genkey -v -keystore key-name.keystore -alias alias-name -keyalg rsa -keysize 2048 -validity 10000 or trick of creating ant.properties file here , none of them worked @ all. any other possible solution ? cordova version 5.1.1 if have keystore file generated, should work. you may need remove console plugin if same apk directly goes production. in cordova 6.2.0 cd cordova/ #change root cordova folder platforms/android/cordova/clean #clean if want cordova build android --release -- --keystore="/path/to/keystore" --storepassword=password --alias=alias_name #password prompted if have

hadoop - Hive Could not initialize class java.net.NetworkInterface -

i have emr setup, supposed come hive , hadoop pre-configured. as far, can see command require mapreduce job, hive fails. failed: execution error, return code 2 org.apache.hadoop.hive.ql.exec.mr.mapredtask so, went job tracking url, , here relevant output: diagnostics: not initialize class java.net.networkinterface java.lang.noclassdeffounderror: not initialize class java.net.networkinterface @ org.apache.hadoop.net.netutils.islocaladdress(netutils.java:690) ... any error appreciated... stack trace points codes: org.apache.hadoop.net.netutils network interface definition i got exact stacktrace when trying run datanode. ipv4 address of eth0 interface forward-resolvable in dns, wasn't reverse-resolvable (i.e. resolve hostname ip reverse lookup of ip corresponding hostname didn't work). datanode started expected once ptr record pointing ip hostname got created.

kubernetes - How to set environment variables in CoreOS -

i need set environment variable in kubernetes slave coreos system. have tried using export and declare keeps reading each argument separate command don't set variables in command field, take @ env field.

javascript - Accessing nested urls when using for loop to generate the list items on feed tab -

note: using ionic framework , angular. short explanation: have json file information. each object file has id, category, title, etc. using loop filling feed tab every object item, quick post, option click read more. loop used because of infinite-scrolling. problem: when using infinite-scrolling , loop messed , link nested page info every object json file doesn't work. in order take full info item using it's id. goal want able when on feed tab click on item , see nested page info it. edit here link (demo) in plunker. http://embed.plnkr.co/66hgiixngtxouvzgqkvz/preview i'll post main code here in post too, in case catches someone's eye / app.js var starter = angular.module('starter', ['ionic']) starter.run(function($ionicplatform) { $ionicplatform.ready(function() { if(window.cordova && window.cordova.plugins.keyboard) { cordova.plugins.keyboard.hidekeyboardaccessorybar(true); } if(window.statusbar) {

matlab - How can I visualize the tracking of every non-zero elements in a 2D matrix? -

Image
i have 2d matrix in elements either 1 or 0. as time progresses, matrix gets updated w.r.t. other variables. update such '1' elements of matrix moves through coordinates aggregate particular location (may centre of 2d matrix). so track motion of each '1' elements towards centre. how can realize this? this answer visualisation of points , movement history, not handle tracking of non-zeros elements. let's start sample data: %% // sample data nmax = 10 ; %// max size of matrice m0 = randi([0 1],nmax) ; %// populate random "0" , "1" [x,y] = find(m0==1) ; %// find coordinates of "1"s npt = numel(x) ; %// how many have got then draw initial state. used 2 graphic objects per 1 : 1 single point display specific marker show "head" of trace (the last position of point), , 1 dotted fine line (with no markers) show history trace. %% // display initial state hf = figure ; hax = axes(

regex - angular ng-pattern match any non-word, non-space, non-digit not working? -

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.min.js"></script> <div ng-app> <form class="edit-segment edit-form" name="form"> <input type="text" class="form-control" ng-model="dname" name="name" maxlength="100" ng-pattern="/[a-z0-9 ]+/" ng-required='true' /> <output>{{form}}</output> <output>{{dname}}</output> <output>{{form.name.$valid}}</output> </form> </div> the pattern is: /[a-z0-9 ]+/ for reason angular-infused html not acting way i'm expecting. i'm expecting happen user enters non-word, non-digit, non-space character, input becomes invalid, $form.name.$valid should false. instead happens is, long input contains letter, number or space, input becomes $valid becomes true. so: lkajskdjf<.?{} val

sql server - SQL find duplicate records from past 7 days -

hi trying find duplicate webvisits within past 7 days, have built query taking long run. in optimizing query appreciated. finding duplicates using visitorguid. tooclose ( select a.visitid beforeid, b.visitid afterid, a.omniturecid [before om id], b.omniturecid [after om id], a.pubid [before pub id], b.pubid [after pub id], a.visitorguid [before guid], b.visitorguid [after guid], a.date [before date], b.date [after date] webvisits inner join webvisits b on a.visitorguid = b.visitorguid , a.date < b.date , datediff(day, a.date, b.date) < 7 a.date >= '7/1/2015') select * tooclose beforeid not in (select afterid tooclose) if understand question correctly, trying find duplicate webvisits within past 7 days. not sure qualifies duplicate webvisit, here attempt might work you: ;with q1 ( select a.visitorguid ,a.date webvisits a.date >=

How to solve gulp image copy issue on build? -

problem - copied images end size 0 x 0 px . in gulpfile.js copy images app directory dist directory, works well. here's simplified version of task: gulp.task('html-deploy', function() { return gulp.src([ 'app/img/**/*', 'app/**/*.html' ], { base: 'app' } ) .pipe(gulp.dest('dist')) }); my file structure looks this: /app index.html /img image1.png image2.png everything copies on , nice, images don't display in browser, though filepaths correct. the weird thing when locate images directly in finder (osx) can't view them there either, although filesizes , read/write values correct too. this because copied images end being 0x0 px in size. why happening? this kind of answer own question - @ least fixed problem. instead of directly copying images copy them via gulp-imagemin , , voilà! var gulp = require('gulp');

ios - Get current video duration from CMSampleBufferRef -

how can current recorded video duration cmsamplebufferref in delegate method - (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection; please guide sample code the details need in video meta data. video meta data may need convert cmsamplebuffer cvpixelbuffer . cmsamplebuffer core foundation-style opaque type; instance contains sample buffer frame of video data. cvpixelbuffer core video pixels sample buffer. you can pixel buffer sample buffer using below cmsamplebuffergetimagebuffer: cvpixelbufferref pixelbuffer = cmsamplebuffergetimagebuffer(<#a cmsamplebuffer#>); once got pixel buffer can video meta datas timing , format informations. to timing informations use cmsamplebuffergetpresentationtimestamp , cmsamplebuffergetdecodetimestamp respectively. for more info read representations of media

php - A confision of increment operator -

this question has answer here: increment behavior on strings - php easter egg? 3 answers $a = 'z99'; var_dump(++$a); above code output aa00 .i'm confused output. can me? that's because php follows perl's convention. you can find more information on http://php.net/manual/en/language.operators.increment.php so because string 99 goes 00 -> next increment , z goes aa. if have done y99 have been z00. $s = 'w'; ($n=0; $n<6; $n++) { echo ++$s . php_eol; } returns: x y z aa ab ac note decrementing strings won't work in php. $s = 'w'; ($n=0; $n<6; $n++) { echo --$s . php_eol; } returns: w w w w w w

calling function returning user type from different schema in Oracle -

i trying call function inside package returning user defined type present in different schema. the function , package declaration --- create or replace package pa_webhook authid current_user type gcur_table_data ref cursor; type typ_tab_updated_ids table of orders.order_sid%type; function fn_order_customer_get (p_str_order_id in orders.order_id%type) return gcur_table_data; end pa_webhook; / as evident function returning ref cursor output selected number of rows. now in order achieve this, have followed following steps-- 1) creating role -- create role ecommerce_app_role; 2) providing privilege role --- grant execute on pa_webhook ecommerce_app_role; 3) assigning role user schema grant ecommerce_app_role ecomm_app; 4) creating synonym package in other schema although able call function different schema getting null in result set, whenever executing query mentioned in function can see results. is because of type created inside package, if yes can

HTML-CSS a href text-align half left half right -

Image
i have example code: <li><a href="#"><em>&euro; 2,75</em> koffie</a></li> witch have make image. "euro 2,75" right-aligned "koffie" left-aligned what have tried far css: em { float: right; } { float: left; } and <li><a href="#"><em>&euro;<span style="float:right;"> 2,75</span></em> <span style="float:left;"> koffie</span></a></li> witch has work on normal line text none of these works. possible? li { width: 200px; } .one { float: left; text-align: left; } .two { float: right; text-align: right; } <li><a href="#"><span class="one"><em>koffie</em></span><span class="two">&euro; 2,75</span></a></li>

python - PDF page stored as what in bytes -

i'm trying write script work , having difficulty researching particular question. assumed each pdf page image, such jpg, though reading file doesn't happen case. question is: respective pdf pages stored if not images? here code working work: pdf = user_file.file.read() startmark = b"\xff\xd8" startfix = 0 endmark = b"\xff\xd9" endfix = 2 = 0 njpg = 0 while true: istream = pdf.find("stream", i) if istream < 0: break istart = pdf.find(startmark, istream, istream+20) if istart < 0: = istream+20 continue iend = pdf.find("endstream", istart) if iend < 0: raise exception("didn't find end of stream!") iend = pdf.find(endmark, iend-20) if iend < 0: raise exception("didn't find end of jpg!") istart += startfix iend += endfix

jquery - My first function is having a syntax error -

hello getting writing functions , think bit on head. javascript console stating uncaught error: syntax error, unrecognized expression: "# insert jsfiddle url " since don't have enough reputation cannot post 2 links, "insert jsfiddle url" jsfiddles url, becomes url of site run code on. here code code it: function menuclick(menuitem, menucontent) { $('"#' + menuitem + '"').click(function() { $('#cssmenu').hide(); $('"#' + menucontent + '"').show(); $('#goback').show(); }) }; menuclick(aboutlink, aboutcontainer); here link jsfiddle of it. in code $('"#' + menuitem + '"') wrong . when menuitem = "hello" , above code becomes $('"#hello"') not want. you want $('#' + menuitem) results in $('#hello') when menuitem = "hello" check out fiddle . here sn

does using external libraries in C++ make sense? -

a colleague of mine stated that c++ based off of templates completely. dlls c-leftover. 95% of classes templates, why dlls not make sense , not work c++. i kind of understand argument, @ least large parts of standard library using templates. on other hand, argument not apply shared objects plain, statically linked archives, stating kind of external library "c-leftover", not seem true me. personally though, of classes not templated , have never had problems building static or shared libraries, while had templates. so, concluding, colleague bring argument, or rather invalid? furthermore, how libraries boost manage handle templates? i "i don't agree that." if car industry, equally "now have plastic , carbon fibre, don't need metal build cars. sure, it's possible build cars [aside engine , wheelbearings, etc] in plastic , carbon fibre. @ same time, it's not practical, , it's not "best choice" (unless running f

Google Maps v3 places autocomplete shows address, but returns no place result? -

Image
i have set-up page using google maps places autocomplete service. below screen snapshot of address being entered text field (controlled) places autocomplete (works fine)... when click on option presented google drop down list, place changed handler invoked (as should be) , following code executed place result object: var place = m_autocomplete.getplace(); examining place object in debugger reveals 1 property defined; name property, below place object json string: {"name":"2701 riverside dr, ottawa, on k1a 0b1, canada"} the place object missing other properties (ie: no geometry, no address_components, etc) outlined in google maps documentation placeresult object . so, added more code (to fallback) , call geocoder service directly when place results object incomplete, ie: var geocoder = new google.maps.geocoder(); geocoder.geocode({ 'address': addr }, geocoder_callback_handler); where addr contained value text field (confirmed via debugg

c# - Business Rule - Specified cast is not valid -

i have searched answer question, , can't seem find situation, or haven't grasped yet. working on business rule company's business software , receiving "specified cast not valid" error. know has char variable and/or null, can't figure out how fix or why i'm getting error (it's simple). below code rule. supposed compare unit_price price1, both fields in table, , replace unit_price price1 if price1 higher, , every row in table. i had code working until tried add class4. class4 specifies items locked prices. used prevent changing prices of items locked prices. class4 char[8] field in table, , has 2 values, locked , null. issues began. i have removed references program legal purposes. forgive me if code messy or inefficient or incorrect. i'm new c# , have been guessing part. public class pricecheck : program.extensions.businessrule.rule { decimal unit = 0m; decimal price1 = 0m; string class4;

javascript - Validating form controls before inserting to database -

i want insert records database(mysql) before insertion want validate form fields whether filled users or not, must validate onclick of submit button , inserting records using annotation method related java file so, when trying insert records using spring annotation method , validating records in javascript gives me following error: http status 500 - request processing failed; nested exception java.lang.numberformatexception: input string: "" my javascript: <script type="text/javascript"> function validatefields() { var c_name = document.formregisterclinic.ctl00$cphmaster$txtclinicname.value; var p_no = document.formregisterclinic.ctl00$cphmaster$txtphone.value; var st_address = document.formregisterclinic.ctl00$cphmaster$txtstreetaddress.value; var state = document.formregisterclinic.ctl00$cphmaster$txtstate.value; var city = document.formregisterclinic.ctl00$cphmaster$txtcity.value;} var z

javascript - Using fadeIn / fadeOut with Scroll Up For Menu -

i'm using jquery script "scroll menu" david simpson, ( github link ) , trying uses fadein , fadeout , when scroll fades out, , when scroll nav fade in. can't seem figure out add it. better add easing event nav div (in case #top ) or fadein within script? js ;(function ( $, window, document, undefined ) { var pluginname = 'scrollupmenu'; var defaults = { waittime: 100, transitiontime: 550, menucss: { 'position': 'fixed', 'top': '0'}, showdelta: 0 }; var lastscrolltop = 0; var $header; var timer; var pixelsfromthetop; // actual plugin constructor function plugin ( element, options ) { this.element = element; this.settings = $.extend( {}, defaults, options ); this._defaults = defaults; this._name = pluginname; this.init(); } plugin.prototype = { init: function () { var self = this; $header = $(this.element); $header.css(self.settings.menu

Visual Studio 2015 characters get mixed up sometimes -

sometimes when write code characters mixed up. example when i'm writing "integer", text appears "igetnre". when try paste code, have press ctrl+v several times in order work. i tried disabling hardware acceleration , same thing happens. anyone knows what's going on? this never happened when using visual studio 2013. looks problem resharper 9.1.2. updated 9.1.3 , fixed. this changelog: http://blog.jetbrains.com/dotnet/2015/07/24/resharper-9-1-3-to-the-rescue/

csv - Unable to loop through dictionary to compare 2 strings and return max ratio in Python -

i have list of items stored in csv. trying compare item name csv list see if there match. load csv list dictionary pass function. each item on dictionary compared input item give matching ratio. want return item highest ratio , highest ratio must higher set max ratio. example of item csv file 001 green apple 002 red apple 003 orange 004 mango this have tried far def fuzzy_token_set_matching(index_dict, str_for_comparison): matching_threshold = 70 #if try dict size here, it's 0 print(len(index_dict)) index, indexed_string in index_dict.items(): max_ratio = 0 #compare input name vs name in dictionary fuzz_matching_ratio = fuzz.token_sort_ratio(indexed string, str_for_comparison) if fuzz_matching_ratio > max_ratio: max_ratio = fuzz_matching_ratio if max_ratio > matching_threshold: return index, indexed_string else:

java - BeanIO - UnidentifiedRecordException when parsing UTF8 file -

i have problem when parsing file encoded utf8. i have 2 files identical, except encoding. (i copied file , saved utf8, contents identical). 1 encoded using ansi, other utf8. file encoded ansi succesfully parsed while other file causes beanio throw unidentifiedrecordexception when calling beanreader.read() method: org.beanio.unidentifiedrecordexception: unidentified record @ line 1 i have tried solve explicitly setting encoding utf8 using code: public static beanreader getbeanreader(file file, streambuilder builder) { streamfactory factory = streamfactory.newinstance(); factory.define(builder); inputstream istream; try { istream = new fileinputstream(file); } catch (filenotfoundexception e) { throw new customexception("could not create beanreader, file not found", e); } reader reader = new inputstreamreader(istream, standardcharsets.utf_8); return factory.createreader("reader", reader); } which d

ruby - Create single method in Rails that handles multiple method names? -

is possible dry-up following code: def is_user? is_role? roles[:user] end def is_mod? is_role? roles[:mod] end def is_admin? is_role? roles[:admin] end private def is_role?(role) self.roles & role == role end into single function, yet still have ability call function names ( is_user? , is_mod? , etc) update: using aetherus' answer below created following managing user roles (where user can have multiple roles): class user < activerecord::base # use bitwise values more roles (double previous values) roles = { user: 1, dummy: 2, mod: 4, admin: 8 } # add desired role def add_role(role) self.roles |= roles[role] end # eg: add_role :admin # removed desired role def remove_role(role) self.roles &= ~roles[role] end # methods each role (mod? admin? etc) roles.keys.each |role| define_method("#{role}?") self.roles & roles[role] == roles[role] end end end you can define multiple metho

java - Error: RestAdapter(...) has private access in 'retrofit.RestAdapter' -

i trying make class uses retrofit make api calls. public class redditutils { private restadapter restadapter; private redditapiservice service; private final string redditbaseurl = "https://oauth.reddit.com"; public redditutils() { restadapter = new restadapter().builder().setendpoint(redditbaseurl).build(); service = restadapter.create(redditapiservice.class); } public void fetchtoken(string token) { service.gettoken(token, new callback<redditaccesstoken>() { @override public void success(redditaccesstoken redditaccesstoken, response response) { log.d("redditaccesstoken", redditaccesstoken.getaccesstoken()); } @override public void failure(retrofiterror error) { log.d("redditaccesstokenfailed", error.tostring()); } }); } } when set restadapter equalt new restadapter(), error restadapter(*long path name*) has private access in 'retrofit.res

OrientDB: UPDATE of adjacent vertex -

background i have model represented graph in orientdb. model consists of few classes, among others a , b . classes connected relation has edge a b . edge connects a other classes: a ---has--> b ---has--> c problem i want update property of b if has has edge a given recordid. my solution currently selecting target/out vertex of edges has of class b starting @ given recordid. works feels missing easier solution this. update (select expand(out('has')[@class = 'b']) #11:1) set prop = true i tried following, did not work expected: update b set prop = true in('has').@rid = #11:1 my question is there simpler solution update subselect? i don't think there premade sql function kind of filtering in update . your first query way go because traverses instead of filtering on vertices. yes, have subquery faster using in update statement. it cool have syntax : update #9:1.inv('edgeclassname')[@class='cla

pdf - How can I selectively print text and graphs in IPython? -

so i'm building report generating project , want print/save pdf graphs , potentially text explain them. at moment can print entire ipython notebook , don't want bog down report code. is there way add multiple outputs 1 pdf? or should generate of graphs 1 script , print that? i can live without text explanations titles should self explanatory, better have them in. happy add , modules necessary.

Horizontal news slider in html css -

Image
i making latest news bar website. needs this: here fiddle . please guide me how can achieve image design. thanks. html: <div class="green"> latest news </div> <div class="black"> text here </div> css: .green{ height:30px; background-color:#3e6a56; color:#fff; width:130px; float:left; } .black{ height:30px; background-color:#000000; display:inline; float:right; color:#fff; width:100%; } http://jsfiddle.net/b648z1ve/2/ .green{ height:30px; background-color:#3e6a56; color:#fff; width:130px; float:left; width:30%; } .black{ height:30px; background-color:#000000; display:inline; float:right; color:#fff; width:70%; }

java - size of linkedList -

i'm new java, , given linkedlist set-up, need use recursion or while loop write size function return size of linkedlist. guess i'm confused how size function when linkedlist setup doesn't initialize node, head etc. package list; public class linkedlist { public int value; public linkedlist next; public linkedlist (int value, linkedlist next) { this.value = value; this.next = next; } public static linkedlist list () { return new linkedlist(1, new linkedlist(2, new linkedlist(3, null))); } public int size () { int size = 0; node current = head; while(current.next != null) { current = current.next; size++; } return size; } } in current formulation, linkedlist instances nodes lists. that's ok, means there no distinguished "head" of list ... in context, fix change: node current = head; to linkedlist current = this; (and, yes, size variable should start 1 .

java - What could i put in response in @ApiOperation of Swagger -

in code use status.class @apioperation when method return response.nocontent.build();? @delete @path("/property/{id}") @apioperation(value = "delete", notes = "delete persisted property data source.", response = status.class??) public response delete(string id){ ... ... return response.nocontent().build(); } you can omit response part , use void.class default. docs : public abstract class<?> response the response type of operation. in jax-rs applications, the return type of method automatically used, unless javax.ws.rs.core.response . in case, operation return type default void actual response type cannot known. (emphasis mine) setting property override automatically-derived data type. if value used class representing primitive ( integer , long , ...) corresponding primitive type used. default : java.lang.void.class

ruby - identify zero and non-zero scenario - with one value (zero) having special meaning -

i comparing values in multiple arrays. want flag values have 'zero' , 'non-zero' @ same time in same array. reason stuck. here test cases / scenarios: 1. 0 , 0 => ignore 2. non-zero , non-zero => ignore 3. 0 , non-zero => after! 4. 0 => ignore 5. non-zero => ignore here code far: def unique_with_zero?(*arr) arr.uniq! arr.sort! if arr.size == 1 print 'ignore: ', arr, "\n" end if arr.size > 2 print 'candidate: ', arr, "\n" end end #test cases unique_with_zero?(30,20,40) #false unique_with_zero?(111,0,500) #true - 0 , other non-zero values unique_with_zero?(1,1,3,1) #false unique_with_zero?(0) #false - need multiple values unique_with_zero?(1) #false unique_with_zero?(0,0) #false array.any?(&:zero?) && array.uniq.length > 1

cpu - Android Get Processor Model -

i want processor model similar du booster. cpu model contains arm processor version , revision. example: armv7 processor rev 3 (v7l) i have tried system.getproperty("os.arch") returns architecture and string[] args = {"/system/bin/cat", "/proc/cpuinfo"}; to cpu info. able right information in of devices not in all. i tried in asus fonepad 7 doesn't return property of processor(but returns processor(small p) it returns like processor : 0 vendor_id : genuineintel cpu family : 6 model : 53 model name : intel(r) atom(tm) cpu z2520 @ 1.20ghz stepping : 1 microcode : 0x10e cpu mhz : 800.000 cache size : 512 kb physical id : 0 siblings : 4 i want result "armv7 processor rev 3 (v7l)" . in advance.. you don't need implement separated methods work differ processors types. use code show info architectures. model_name string differ, replace cpu_model , here go. i've underscored keys names

jquery - What language(s) i have to use to make a success or an error situation for PHP mail form? -

Image
i've got php mail form coded : and appear banner coded using css , jquery, if form succeed send mail, or not : i know language use make happens ? advices ? here html code form : <form id="my_form" enctype="multipart/form-data" method=post action=formmail.php> <input type="hidden" name="subject" value="formmail"> <!-- pseudo --> <p> <h3> pseudo <font class="color-red"> * : </font> <span class="padding1"><input type="text" class="form-control" name="pseudo" aria-required="true" aria-invalid="false"></span></p><br> <!-- email --> <p> email <font class="color-red"> * : </font> <span class="your-email padding1"><input type=