Posts

Showing posts from April, 2012

jQuery slideshow ... how to add text from alt tag? -

i have been playing around slideshow: http://tympanus.net/codrops/2013/02/26/full-width-image-slider/ what have text current image alt tag show below image in center .... possible? there .attr() property in jquery. clear usage of property in link this official jquery page

php - Submitting more than one html tag cause 404 Error in Codeigniter and Grocery Crud? -

Image
i'm using grocery crud codeigniter change database columns,but have problem when use html tags, 404 not found error in firebug. the following work: but following doesn't work because have tried style : when click on source in top left of wysiwyg editor , try type in html, works , not: <p>this works</p> the following doesn't work (404 not found): <p> <p>hello</p> not work </p> the following doesn't work (404 not found ): <p></p> the following works <p>aaaa</p> idea why 404 if put empty tag works if put inside ?? in advance long can see, works 1 tag if use more 1 tag doesn't work : <h1> single line work </h1> but if use more 1 html tag won't work, example following doesn't work ( 404 not found ?) <h1>hello</h1> <h1>world</h1> though there little information given, have inserted html tags inside visual mode of editor o...

java - How to check if checkbox was checked? -

i creating quiz app androids. have 3 fragments , 3 checkboxes on first 2 of them. on last fragment there button when pressed opens activity called "end". need on "end" activity result appear of how many correct answers 1 have chosen. firstly, i've tried check if it's working first fragment, got stuck. app closes when press button. end.java : package bandymas.viewpagerexample; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.checkbox; import android.widget.textview; public class end extends actionbaractivity { private checkbox checkbox1, checkbox2, checkbox3; private button button; textview newresult = (textview)findviewbyid(r.id.textview1); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setco...

javascript - How to get "computed" text content of an HTML node (whitespace adjusted) -

Image
i want able "computed" text content of html node, i.e. rendered browser. example : consider following html: <html> <body> <p>a b c d e f &nbsp; g <div>1</div><div>2</div> <a>3</a><a>4</a> <button onclick="javascript:alert(document.body.textcontent)">click me</button> </p> <pre>h i</pre> </body> </html> here's picture of how above html renders in chrome 41.0.2272.101 m on windows 7: is there simple, or relatively simple, way approximate text of <body> node, example, in way captures fact html node boundaries "generate" whitespace (like boundary between <div> nodes in above example)? i approximation of text of <body> node string like: a b c d e f g 1 2 34 click me h ...

eclipse - displaying Java double value -

here's piece of java code: import java.util.*; public class javatests { public static void main(string[] args) { double decimal = 0.60; system.out.println(decimal); } } i'm trying print 0.60, compiler prints 0.6. how can print 0.60? thanks! numberformat formatter = new decimalformat("#0.00"); double decimal = 0.60; system.out.println(formatter.format(decimal));

javascript - Angular $scope not working inside modal window -

i'm following this guide implement authentication angular app , i'm having trouble accessing models inside controller. somewhere in app, open modal window this: loginmodal().then(function() { // successful login, proceed page user wants return $state.go(tostate.name, toparams); }).catch(function() { // login failed, return home return $state.go('home'); }); loginmodal() service, looks this: myapp.service('loginmodal', function($modal, $localstorage) { function assigncurrentuser(user) { $localstorage.user = user; return user; } return function() { var instance = $modal.open({ templateurl: '/partials/modals/login.html', controller: 'logincontroller', windowclass: 'small' }); return instance.result.then(assigncurrentuser); }; }); when loginmodal() service used, opens modal window on page contains html of /partials/mo...

shell - Searching for calls to a function with a certain number of arguments / where the N-th argument matches a regex -

i looking unix command line tools (to used on linux , mac os x gnu tools installed) allows me search through source code of large c++ (or java, or ...) project , 1 or both of following: given name of function , positive integer n, find calls function n-th parameter equal value resp. matches regex find calls function number of arguments function n (alternatively: @ least / @ / less / greater than). of course in full generallity, may arbitrarily hard, assuming here code base sufficiently nice, parameters function calls strings, numbers, other function calls, arithmetic expressions, etc., not, say, lambda expressions or other crazy stuff. not mind occassional false positive, , don't worry class names / templates etc. being confused function name. indeed, if 1 worries false positives / negatives, variation list occurance of function name, , each list number of arguments, or unknown if script failed determine it. i pretty sure write perl script of need, seems such usef...

ruby on rails - Status code 500 Paperclip amazon s3 connection refused - (Connection refused - connect(2) for "bucket.s3.amazonaws.com" port 443 -

paperclip can't seem connect amazon s3 bucket instance gives error - *** exception errno::econnrefused in rack application object (connection refused - connect(2) "bucket-images-test.s3.amazonaws.com" port 443) my production.rb looks this: config.paperclip_defaults = { :storage => :s3, :s3_credentials => { :bucket => 'bucket-images', :access_key_id => 'accesskey', :secret_access_key => 'seceretkey', :host_name => 's3-website-us-east-1' }, :default_url => "/missing.png", :path => "/:attachment/:id/:style/:filename", :url => "/:attachment/:id/:style/:filename" } i'm using: paperclip version 4.2.0 aws-sdk version 1.63 aws-sdk-resources version 2 the problem gems , iptables gemfile gem 'paperclip', '~> 4.2.0' gem 'aws-sdk', '~> 1.5.8' gem ...

java - Google Places API for Android - PlacePikcer without search option -

i building application, user has select place wants. for that, using placepicker dialog, google places api android teaching in api reference site. however, when user click button , open place picker dialog, not have button user can type name of place wants select. so, user have select place dragging on map; horrible user, specially if wants choose specific location far location or doesn't know place on map. so, i've tried searching on google , foruns on internet , didn't find how set dialog appear search button. thank you! ;) unfortunately place picker not support asking for.

algorithm - computing 3D reduced convex hull -

i'm looking algorithm provides call "shrunken convex hull" (as distinct "reduced convex hull") in 3d. defining shrunken hull, h', volume of space has, no less d distance original convex hull, h. analytically, can formed moving each plane of h inwards along normal d, computing convex hull (if exists) of resultant planes. tricky bit planes might trimmed or dropped, others may move past other planes, , entirely "snipped" out due normal reversal (if d big enough). i’m bit fuzzy on how algorithm, have badly thought out ideas below. i doing identify subset of points in dataset guaranteed no less given distance surface of original point set (which assumed convex, , have this). remove surface effects disrupting our signal in calculations doing. i'm looking name, or examples of doing this, or way compute this. ideally good-old open code great, think problem far niche. i found reduced convex hulls, seems different idea. current closest thin...

Meteor Conditionally displaying nested templates -

i have template several sub nested templates should conditionally show based on data saved in templatec collection shown below, used if condition in template shown below, having sub templates displayed despite if condition return true or false. can please check code , tell me missing here? thanks var templatearray = ['false', 'false']; template.formbuilderpreview.created = function() { var cursor = templatesc.find({}, { sort: { templatecode: 1 }}); if (!cursor.count()) return; cursor.foreach(function (row) { //only case 1 return in switch below case 2 never exist switch(row.templatecode) { case 1: templatearray[0] = true; break; case 2: templatearray[1] = true; break; default: templatearray[0] = true; } }); }; template.formbuilderpreview.helpers({ template1bo...

javascript - Angular custom method on $resource with .then() function causing error -

i have in angular service: return $resource(base + '/cases/:id', {id: '@id'}, { status: {method: 'get', params: {status: '@status'}} }); when using method added $resource definition along promise's .then() function, i'm getting error: cases.status({status: 'pending'}) .then(function(res) { console.log(res); $scope.cases.pending = res.data.cases; }) .then(function() { $scope.tabbed.pending = true; }); after above snippet run, error is: typeerror: undefined not function on line: .then(function(res) { can not use these functions when i'm using method defined on $resource ? i think need use $promise of $resource object call success function when actual promise gets resolved & proceed promise chain. code cases.status({status: 'pending'}) .$promise .then(function(res) { console.log(res); $scope.cases.pending = res.data.cases; }) .then(f...

php - $_FILES empty after multiple files upload -

i trying upload multiple files mysql database. everything works fine untill surpass around 7 8 mb. lot of internet reactions should have php.ini settings, i've tried check them. php version 5.2.17 code below: <?php include_once "mysql.php"; ?> <body> <form action="" method="post" enctype="multipart/form-data"> <label for="album">album</label> <input type="text" id="album" name="album" /><br> <label for="fotos">foto's</label> <input type="file" id="files" name="files[]" multiple accept="image/*" /> <input type="submit" value="upload" /> </form> <?php echo "<br>upload_max_filesize: ".ini_get('upload_max_filesize'); echo "<br>post_max_size: ".ini_get('post_max_size'); echo "<br>memory_limit: ...

c++ - Opencv findcontours CV_RETR_EXTERNAL not working -

i've image: edit sorry had remove images! i need extract contour of non-black picture, used findcontour cv_retr_external parameter, obtain this: here's code: static mat canny_output, grey,draw; vector<vector<point>> contours; cvtcolor(final_img, grey, cv_bgr2gray); canny(grey, canny_output, 100, 200); findcontours(canny_output, contours, cv_retr_external, cv_chain_approx_simple); draw = mat::zeros(canny_output.size(), cv_8uc3); (size_t = 0; < contours.size(); i++) { drawcontours(draw, contours, i, scalar(255, 0, 0)); } how can resolve? simply add binarization minimal threshold, , remove canny: cvtcolor(final_img, grey, cv_bgr2gray); //threshold=1: low value, anyway rest of image pure black threshold(grey, binary, 1, 255, cv_thresh_binary); findcontours(binary, contours, cv_retr_external, cv_chain_approx_simple);

haskell - How do I gain access to environment variables in a subsite that is in a separate package? -

my yesod subsite needs write files relative application's root directory. looking @ this , appears scaffolded yesod site of plumbing, how can access in subsite doesn't know app record? approot defined in scaffolded yesod project using reference appsettings , also element of app : approot = approotmaster $ approot . appsettings is there function gives me application root (or @ least valid file path root directory) without having know implementation details? being able reuse existing yesod functionality nicest, of course. you can't access master site's fields without knowing type of master site itself, defeats purpose of having subsite. typical options are: make data you're looking explicit argument subsite require typeclass constraint master site must instance of, gets data master site yesod-static example of former approach; yesod-auth example of latter.

python - Generate two random strings with dash in between -

i wondering how make code in python 3.4.3 can generate 2 3 character long strings. 1 digits 0 - 9, , other capital letters of alphabet. there has dash between them. examples: mus-875 kle-443 ami-989 this have from random import randint print(randint(2,9)) try picking random string of letters, random string of digits, joining them hyphen: import string, random def pick(num): j in range(num): print("".join([random.choice(string.ascii_uppercase) in range(3)])+"-"+"".join([random.choice(string.digits) in range(3)])) as such: >>> pick(5) osd-711 krh-340 mde-271 zjf-921 lux-920 >>> pick(0) >>> pick(3) sft-252 xsl-209 maf-579

jquery - How can I place a line behind my divs? -

Image
i want move place dashed line behind divs. keep staying on top of divs. here have right : here hoping : **css** /*background border*/ .border-center { width: 100%; position: relative; } .slide:before { content: ''; position: absolute; border-bottom: 3px #3498db dashed; z-index: 1; top: 50%; margin-top:-2px; right: 10%; left: 40%; width: 25%; } i wish can put more code, since rep low, got warning : more details : jsfiddle giving fiddle z-index of 0 accomplished this, , background:white on .tl-box http://jsfiddle.net/1q6ur85k/2/

sql - Create a database view in HANA with data types defined -

when using hana sqlscript possible create view data types defined or need cast type in every select statement being used? running implicit data type issues hana doesn't seem evaluating data being used. when create view data type defined syntax errors wondering if possible. on hana revision 84. --trying create view datatype defined create view testview ( measure1 decimal(25,10) ) select 4493.3489212 dummy --creating view casting type in select statement create view testview (measure1) select cast(4493.3489212 decimal(25,10)) dummy when creating sql views via create view, you're not using sqlscript standard sql. , standard sql doesn't have explicit output structure definition, you're depending on data types create in select statement (e.g. via cast()). when dealing actual sap hana information models (e.g. scripted calculation view) explicitly define output structure (semantics tab).

using a function in custom javascript file in drupal -

i made module creates block , using #attached added custom .js file block content, without drupal.behaviors , function($) things code works clock in page (outside of drupal) in drupal, have no idea how add function in .js file here codes: (function($){ drupal.behaviors.mymodule = { attach:function(context, settings) { function show_more(count){ var counter = count; var id = document.getelementbyid("id").value; var xmlhttp; if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest; } xmlhttp.onreadystatechange = function() { if(xmlhttp.readystate == 4 && xmlhttp.status == 200) { document.getelementbyid("div_id").innerhtml =xmlhttp.responsetext; } } xmlhttp.open("post","some_page.php",true); ...

ios - Tab bar's navbar stuck under custom navbar? -

Image
i implementing custom nav bar of application, transition tab bar based navigation paradigm other portions of app. when switch tab bar portion of app , navigate "more" section of tab bar controller, navbar has "edit" button of more section obscured custom navbar. i have tried removing navbar view, bringing tab bar's navbar top of view, etc. the goal here gain access edit button's functionality in order rearrange icons on tab bar. i'd either invoke edit functionality of tab bar programmatically or bring tab bar's navbar front of view. thanks in advance!

javascript - jquery ajax "SyntaxError: Unexpected end of input" on valid JSON -

the json returned php is: {"success":0,"message":"error: no entityid passed!"} still javascript tells me "syntaxerror: unexpected end of input". php: ... //check if image id passed removal in post data if ( isset($_post["entityid"])) { $entityid = $_post["entityid"]; } else { //setup response json $resp = array(); $resp['success'] = 0; $resp['message'] = "error: no entityid passed!"; header('content-type: application/json'); echo json_encode($resp); } ... js: // send xhr request $.ajax({ datatype: 'json', type: $theform.attr('method'), url: $theform.attr('action'), data: $theform.serialize(), success: function(data) { //backend returns jso...

regex - htaccess mod_rewrite regular expressions -

i have old website indexed on google , need make 301's let ex. google know page moved. i moved site wordpress "builded os", single urls. it goes first page, when need 301 redirect sub links fails. code: redirect 301 /what-we-do/ mypage.nu/services redirect 301 /what-we-do/about-us mypage.nu/about second line fucks , makes "servicesabout" - cant found. how can make hyphen (-) old url , sub url, direct "single urls" - mean ex. mypage.nu/what-we-do/about-us/members ex mypage.nu/members please me, i'd tried several regulair expressions ex redirect 301 /what-we-do/about([^/_]+?)-?us mypage.nu/about nothing works, can fine rewritematch - mod_rewrite activated on server. can me? use redirectmatch regex support match exact urls: redirectmatch 301 ^/what-we-do/?$ mypage.nu/services redirectmatch 301 ^/what-we-do/about-us/?$ mypage.nu/about better test in new browser avoid old cache.

php - Set the zoom level for the html file generated using PHPExcel? -

i trying generate html file using phpexcel. have more 30 columns , zoom page. i've tried using code below, hasn't worked. $objphpexcel->getactivesheet()->getpagesetup()->setfittopage(true); $objphpexcel->getactivesheet()->getpagesetup()->setfittowidth(2); i've tried using this, hasn't worked either. $objphpexcel->getactivesheet()->getsheetview()->setzoomscale(250); both options don't work in case of html page, zoom works if excel file. going wrong? as may see chaining of commands, setzoomscale() method part of worksheet class , have impact in case worksheet written, not when read. the phpdoc phpexcel lists internal command _writesheetviews() excel2007 writer , _storezoom old excel versions whereas phpexcel_writer_html doesn't offer similar behavior. what may try adding custom css styling created html file may use smaller font-sizes table. afaik won't able change zoom level of browser programmatically...

node.js - use hiredis for node_redis -

i using node_redis https://github.com/mranney/node_redis it says pieter noordhuis has provided binding official hiredis c library, non-blocking , fast. use hiredis, do: npm install hiredis redis i follow instruction , compile hiredis, found hiredis.node located in /node_modules/hiredis/build/release/hiredis.node . but node_redis located @ /node_modules/redis i afraid node_redis can find hiredis.node c library. question : how can determine if node_redis using hiredis parser? should move hiredis.node /node_modules/redis directory? should yum install hiredis ? not sure if hiredis.node uses hiredis static library or dynamic library. according documentation have npm install hiredis redis var client = redis.createclient(options); console.log(client.reply_parser.name); // retrieve parser name check test file in benchmarks folder edit: can pass parser in options, did in link above l27-31 var options = { parser: 'hiredis' }; ...

javascript - Pushing data into an array in a Json object -

i need push an object array in in json file. make simple lets json looks this: var jsonobj = { "elements" : [] } i tried push() method didnt work. tried assign jsonobj.elements[0]= ... fails. how can make work? try way, has work: jsonobj.elements.push(1); fiddle: https://jsfiddle.net/29qa4bfw/1/

Powershell - Check if file is finished writing -

i have powershell code acts file listener on given folder path. listener kicks off command line call program opens , plays file. the problem powershell code kicks off command line call if file put folder. problem if file large (say 100+mb) because when person copies file folder, file may 5% done 'writing' when command function kicks off , tries open file (and fails). is there way in powershell check if file still being written too? way build loop check every x seconds , run once write completed? does file maintain "lock" if being written too? can checked in powershell? thanks everyone! there may lock check available in system.io.fileinfo, or somewhere use simple length check. goes in called script not file watcher script. $lastlength = 1 $newlength = (get-item $filename).length while ($newlength -ne $lastlength) { $lastlength = $newlength start-sleep -seconds 60 $newlength = (get-item $filename).length }

Understanding relations between model view and controller -

Image
i went through lot of readings mvc , each of these more or less clear. haven't understood yet how relate. mean, know these relationships but how implemented? happens in mvc framework? i have few questions: i read a view can't coupled controller , in other words can't have controller object inside, how use proper controller if view supposed trigger in it? how can model update view if unique job represent data? is business logic inside controller or model? have read conflicting points of view the basic explination of mvc have each of 3 layers. model this contains data. i.e database or set of classes. view this displays data user i.e html page. contains controls user interaction. controller all access data should go through layer. i.e load data data source(model) , save data data source. carries out data manipulation before saving or loading. this create separation of concerns theoretically allowing change in either layer without ...

wordpress - Link to archive post type on the specific post -

i have code in loop on post : <div class="retour"><a href="<?php echo get_post_type_archive_link( 'projets' ); ?>">projets</a></div> when goes post_type_archive page, i'd browser go directly on specific post. can add anchor tag function ? how can manage ? thank ! just add anchor tag end this: <div class="retour"><a href="<?php echo get_post_type_archive_link( 'projets' ); ?>#youranchor">projets</a></div>

how to check if a field exist in facebook graph api using python? -

as facebook graph api uses json format show data.i want books name liked friends using python , facebook graph api program stops when of friend have not read book. please give me way check if field exist or not.thanks in advance. here code : print name of friends , books liked them. id , access token given user. import requests import json base_url = raw_input("enter id : ") access_token = raw_input("paste here access token : ") base_url = '6365047697172' access_token = 'caacedeose0cbancfk1kuosp6gzcosmqzc17v1vzcmwra5fw16pks7iuoz2zailizcfnij32rzcvzb7kah0aa6dqludloyzbi6gs30vlzay2jp7zczm0tpbcnermkrpdt2pifxxdscnbzasskypikuxsppkksncemkeugbzb3upxniy4bw0dmkkqeuhqrns5xuxcdynevtyh17pzb09lgzboipw2' base_url = ' https://graph.facebook.com/ ' + base_url fields ='friends{books,name}' url = '%s?fields=%s&access_token=%s' % \ (base_url, fields, access_token,) def get_books(): """ return...

java - Spring Data Jpa and Specification - how to work with ManyToOne and ManyToMany relations? -

i have simple model in project. [updatepackage] >- (manytoone) - [version] -< [usecase] - (manytomany) public class updatepackage implements comparable<updatepackage> { @manytoone(fetch = fetchtype.eager, cascade = cascadetype.all) @joincolumn(name = column_orig_version, nullable = true) private version origversion; // setters , getters } @entity @table(name = version.table_name) public class version { @manytomany(fetch = fetchtype.eager, cascade = cascadetype.all) @jointable(name = jvuc_table, joincolumns = { @joincolumn(name = jvuc_column_version, referencedcolumnname = column_id) }, inversejoincolumns = { @joincolumn(name = jvuc_column_usecase, referencedcolumnname = usecase.column_id) }) private final set<usecase> usecases = new hashset<usecase>(); // setters , getters } @entity @table(name = usecase.table_name) public class usecase { @column(name = column_name, nullable = false) private string name; // setters...

objective c - IOS Apple Watch voice input -

i plan develop application apple watch. need implement text input voice. on official website found following method: - (void)presenttextinputcontrollerwithsuggestions:(nsarray *)suggestions allowedinputmode:(wktextinputmode)inputmode completion:(void (^)(nsarray *results))completion interested in following: what languages supported input? is possible set desired language programmatically? can programmatically selected language? the input language presenttextinputcontrollerwithsuggestions depends on selected language of selected keyboard on iphone.

javafx - Set image on left side of dialog -

Image
i created simple example javafx alert dialog javafx8u40. public class mainapp extends application { public static void main(string[] args) { application.launch(args); } private stage stage; @override public void start(stage primarystage) throws exception { button create = new button("create alert"); create.settooltip(new tooltip("create alert dialog")); create.setonaction(e -> { createalert(); }); primarystage.setscene(new scene(create)); primarystage.show(); stage = primarystage; } protected alert createalert() { alert alert = new alert(alerttype.warning); image image1 = new image("http://www.mcaprojecttraining.com/images/java-big-icon.png"); imageview imageview = new imageview(image1); alert.setgraphic(imageview); alert.initmodality(modality.application_modal); alert.in...

file - Powershell: Missing '=' operator after key in hash literal Error -

the code: $serverlistfile = "d:\scripts\serverlist.txt" $serverlist = get-content $serverlistfile -erroraction silentlycontinue $result = @() foreach($computername in $serverlist) { $avgproc = get-wmiobject -computername $computername win32_processor | measure-object -property loadpercentage -average | select average $os = gwmi -class win32_operatingsystem -computername $computername | select-object @{name = "memoryusage"; expression = {“{0:n2}” -f ((($_.totalvisiblememorysize - $_.freephysicalmemory)*100)/ $_.totalvisiblememorysize) } get-eventlog -logname security -newest 5000 | where-object {$_.eventid -eq "4624"} | select-object @{name ='username'; expression = {$_.replacementstrings[1]}} } $result += [pscustomobject] @{ servername = "$computername" cpuload = "$($avgproc.average)%" memload = "$($os.memoryusage)%" eventlog = "$username" } ...

android - setSupportActionBar() throws Nullpointer exception -

i new android , following following tutorial material design toolbar : http://www.android4devs.com/2014/12/how-to-make-material-design-app.html but after implementation of code. following error shown in logcat : 04-01 19:16:10.214 2246-2253/com.example.bhaskar.ddit_results e/art﹕ failed sending reply debugger: broken pipe 04-01 19:16:11.985 2246-2246/com.example.bhaskar.ddit_results e/androidruntime﹕ fatal exception: main process: com.example.bhaskar.ddit_results, pid: 2246 java.lang.runtimeexception: unable start activity componentinfo{com.example.bhaskar.ddit_results/com.example.bhaskar.ddit_results.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.charsequence android.support.v7.widget.toolbar.gettitle()' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2298) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2360) @ android.app.acti...

Cassandra control SSTable size -

is there way control max size of sstable, example 100 mb when there more 100mb of data cf, cassandra creates next sstable? unfortunately answer not simple, sizes of sstables influenced compaction strategy , there no direct way control max sstable size. sstables created when memtables flushed disk sstables. size of these tables depends on memtable settings , size of heap ( memtable_total_space_in_mb being large influencer). typically these sstables pretty small. sstables merged part of process called compaction . if use size-tiered compaction strategy have opportunity have large sstables. stcs combine sstables in minor compaction when there @ least min_threshold (default 4) sstables of same size combining them 1 file, expiring data , merging keys. has possibility create large sstables after while. using leveled compaction strategy there sstable_size_in_mb option controls target size sstables. in general sstables less or equal size unless have partition key lo...

Beginner - How to print the external values of an array in Matlab? -

## want write function receives array parameter , prints array's external values better using loops. e.g. if = [1, 2, 3, 4; 5, 6, 7, 8; 9, 10, 11, 12] then call printframe(a) display in code shows. this far can obtain array 0 in middle, not sure if way can lead me final purpose ---- printing frame of array## % text not showing clear enough want display following 1 2 3 4 5 8 9 10 11 12 function f = printframe(a) mat = []; [m,n]=size(a); i=1:n e = a(1,i); mat = [mat,e]; end j=2:(m-1) e = a(j,1); mat = [mat,e]; k = 2:(n-1) a(j,k)=0; g = a(j,k); mat = [mat,g]; end e = a(j,end); mat = [mat,e]; end i=1:n h = a(end,i); mat = [mat,h]; end l = 1:length(mat); f = fprintf('%5d',mat(l)); if rem(l,n) == 0 fprintf('\n'); end end fprintf('\n\n') end use bsxfun create mask , apply logical index . a needs transposed order want (rows first, columns). b = a.'; %' mask = bsxfun(@or, [1 zeros(1,s...

ios - Core Data and unix timestamp date -

i have core data user locations: longitude,latitude etc. and try list of available days: nsmanagedobjectcontext *context = [self managedobjectcontext]; nsfetchrequest * request = [[nsfetchrequest alloc]init]; [request setentity:[nsentitydescription entityforname:@"locations" inmanagedobjectcontext:context]]; nspredicate *predicate = [nspredicate predicatewithformat:@"device_id == %@", deviceid]; [request setpredicate:predicate]; nssortdescriptor *sortdescriptor = [nssortdescriptor sortdescriptorwithkey:@"created_at" ascending:no]; [request setsortdescriptors:[nsarray arraywithobject:sortdescriptor]]; request.returnsdistinctresults = yes; [request setpropertiestofetch:@[@"created_at"]]; [request setresulttype:nsdictionaryresulttype]; nsarray *results = [context executefetchrequest:request error:null]; nsmutablearray *datearray = [[nsmutablearray alloc]init]; nsdateformatter *formatter= [[nsdateformatter alloc] init]; for(nsdict...

python - Scikit-learn installed but not found, -

i have installed scipy, numpy , scikit-learn when i'm on python shell can't import sklearn, says there's no module name: requirement up-to-date: numpy in .../lib/python2.7/site-packages requirement up-to-date: scipy in .../site-packages requirement up-to-date: scikit-learn in ...7/site-packages >>> import sklearn traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named sklearn what problem?

java - servicemix 4.5 NoInitialContextException -

we have osgi application worked on servicemix 5. reasons must migrate servicemix 4.5. tried , got this error parsing sql mapper configuration. cause: org.apache.ibatis.builder.builderexception: error parsing sql mapperconfiguration. cause: org.apache.ibatis.datasource.datasourceexception: there error configuring jndidatasourcetransactionpool. cause: javax.naming.noinitialcontextexception: need specify class name in environment or system property, or applet parameter, or in application resource file: java.naming.factory.initial what need? install aries jndi feature? features:install jndi

security - Lock rptdesign file -

i trying find out if possible lock rptdesign file. the idea run report service, without being able change default parameters. know hide parameter window still user edit rptdesign file , hard code new values. does has previous experience this? is possible make rptdesign file non-editable? if want prevent users modifying rptdesign file, should on os level enable users.

web services - Random questions on JAX-WS and JAX-RPC compatibilities -

we have web service running on old version of application server. old application server running on java ee 1.4. clients on server running on same version of application server. the move upgrade our application server has started. new version run on java ee 6. thing is, clients still run on old version. still able access web service running on java ee 6? if yes answer #2, have follow question below our web service created using jax-ws. mean should generate client classes jax-rpc? clients running in old version able access it? if yes, how? to rephrase question, if have jax-ws web service, how generate jax-ws client , how generate jax-rpc client? ive done initial research , seem done same way, i'm not sure correct. im confused. thanks since mentioned j2ee 1.4, guessing web service based upon jax-rpc 1.x standard. java ee 6 based web service based on jax-ws, suggest generating client stubs using wsimport command using wsdl new service generate stub classes. ...

java - AWT Panel not getting rendered in JFX -

i want add java.awt.panel javafx8 application. unfortunately seems panel doesn't rendered when attached swingnode . i have simple testapplication: import java.awt.dimension; import java.util.concurrent.callable; import java.util.concurrent.executionexception; import java.util.concurrent.futuretask; import java.util.logging.level; import java.util.logging.logger; import javafx.application.application; import javafx.embed.swing.swingnode; import javafx.scene.group; import javafx.scene.scene; import javafx.stage.stage; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.swingutilities; public class awtinjfx extends application { @override public void start(stage stage) { final awtinitializertask awtinitializertask = new awtinitializertask(() -> { awtpanel panel = new awtpanel(); return panel; }); swingnode swingnode = new swingnode(); swingutilities.invokelater(awtinitializert...

asp.net web api - web api default action selector -

i have web api 1 in project. can't use web api 2. route config config.routes.maphttproute( name: "images api", routetemplate: "api/objects/{objectid}/{controller}/{action}", defaults: new { controller = "images" }); i post request hit post action of imagescontroller (action named post), , request hit method named get. in both cases 404. i'm missing? this solution: config.routes.maphttproute( name: "images api", routetemplate: "api/objects/{objectid}/{controller}", defaults: new { controller = "images" }); just excluded action routetemplate.

GitHub Pages - Url Rewrite Support -

i have setup github page site working on, following steps laid out here ( https://pages.github.com/ ) the site have setup hosted under iis , makes use of url rewrite module. is there equivalent module or similar use rewrite url requests within application? for security reasons, github pages doesn't allow server configuration files, so, no url rewriting. but can use html redirection of jekyll-redirect-from . this how github pages advises redirect .

ghci - new line in vim doesn't display? -

Image
i invoke ghci in gvim using :!ghci % load haskell file, however, newline displayed ^j image below shows: if invoke ghci in vim instead of gvim , ok, how newline in gvim ? for graphical version of vim, gvim, crude built-in terminal emulation used shell commands (cp. :help gui-shell ). page mentions, has limitations, , not meant used interactive commands. switching vim in terminal run shell command inside terminal (with full capabilities); guess best alternative if cannot live discrepancies, , don't want launch separate terminal gvim (i.e. :! xterm -e ghci % )

How to make PHP recognize multiple instance of parameter as an Array? -

is there option in php via (php.ini) recognize parameter passed multiple times in url array? /cars.php?color=a&color=b the above query should result in array of colors ['a','b'] instead of second parameter 'b' overwriting first parameter 'a' use this: /cars.php?color[]=a&color[]=b //^^ ^^ no need enable in php.ini, accessing $_get['color'] return array.

windows phone 8 - How to prevent rotating of a single element on page in WP8.1 universall app? -

i need disable auto rotation (when device orientation changed) 1 single element on page. can disable in app by: windows.graphics.display.displayinformation.autorotationpreferences = displayorientations.portrait; but not want. how can that? cannot disable rotate individual item. if application changes screen orientation rotated elements. if track event screen rotation, , resize element in opposite direction. don't think it's solution.

javascript - Catching the response of the iFrame once receiving the response -

i posting message iframe. iframe returns response boolean. need catch response when response arrives parent window iframe. code not working. idea onthis? iframe <iframe id="opiframe" src="https://localhost:9443/oauth2/session" > </iframe> i'm sending message iframe periodically var iframe = document.getelementbyid("opiframe"); setinterval(function(){ message ='test' ; console.log('request rp: ' + message); iframe.contentwindow.postmessage(message,"https://localhost:9443/oauth2/session"); },6000); what need receive response of iframe periodically. code working. added eventlistener iframe below. iframe.addeventlistener("message",test,false); function test(event){ alert("test"); } but not firing periodically it simple: added listener on iframe (as element of parent window's dom), instead of on iframe's window...

php - User authentication via android application in laravel 3 web service -

Image
i using laravel 3 web application. outdated not getting laravel3 for: android application integration laravel 3. problem: when submit request web services when submit post request login user, not working. because of session_payload , laravel_session, every time laravel sending different session_apyload request server. how send session_payload android app , send post request login user? at moment difficult me migrate laravel 3 laravel 5, continuing in l3. appreciated.

c# - Why do i get this app.config related error when i try to acess EF from console application? -

here simple project structure - idea acess entity information in console application sln - data access layer (entity framework , metadata) , repository - service layer list of items in each entity - console project access service layer am using windsor castle , code in console is static void main(string[] args) { // registering var container = new windsorcontainer(); container.register(component.for<irefrepository>().implementedby<refrepository>()); container.register(component.for<ireflservice>().implementedby<refservice>()); container.register(component.for<refentities>()); // resolving var list = container.resolve<irefservice>(); list.getcountries(); } i getting following error on var list = container.resolve(); the specified named connection either not found in configuration, not intended used entityclient provider, or not valid. my app.config generated ef in data access laye...

I want to change reference of css in html files -

i want change reference of css file local server cdn , have got many pages ,rather changing them 1 one want change them ,i using visual studio 2010. if recall correctly there function in visual studio replace same code in entire project. try ctrl + shift + h.

dictionary - C++ STL associative containers: Get iterator from element? -

this has been asked vectors . possible sets & co too? c.equal_range(elem); for set-like, or c.equal_range(elem.first); for map-type containers return pair of iterators equivalent (under container's rules) element. takes between o(k) , o(lg n) time, n number of elements in container, , k number of elements pseudo-equivalent elem / elem.first (pseudo, hash collisions modulo bucket count count). average constant (for unordered)/lg n (for ordered).

node.js - Multiple authentication controllers on one route -

i trying add 2 authentication controllers 1 route. example, trying make: router.route('/employees') .get(authcontroller1.isauthenticated, mycontroller1.get1) .get(authcontroller2.isauthenticated, mycontroller2.get2); the isauthenticated function follows: exports.isauthenticated = passport.authenticate('basic', { session: false }); does know how possible? thanks, daniel route: router.route('/employees') .get(authcontroller.isauthenticated1, authcontroller.isauthenticated2, mycontroller1.get1) authcontroller : exports.isauthenticated = function(req, res, next) { // authentication code if (!req.isauthenticated) { // not authenticated return res.status(401).send({ message: 'user not authenticated' }); } next(); }; exports.isauthenticated2 = function(req, res, next) { // authentication2 code if (!req.isauthenticated2) { // not authenticated ...

How to interact with the running process in python? -

for example, opened power-shell manually in windows.now know process id of it. want run commands on process using python. open power-shell manually. find process id. execute commands using process id. please mention code ** you can subprocess python standard library https://docs.python.org/2/library/subprocess.html

Gcov is not generating *.gcda file -

i using gcov analyzing coverage of .c file. on compilation generation .gcna on execution not generating gcda file. applied -fprofile-arcs -ftest-coverage flags in run.sh script. , using library -lgcov -coverage . i running on arm compiled environment

Show jQuery date picker in jQuerymodal dialog -

Image
there seems problem showing datepicker in modal dialog. i'm using: $(".dpicker").datepicker({ numberofmonths: 2, dateformat: 'd m yy', showbuttonpanel: true }); to enable datepicker on given input field. please check fiddle: http://jsfiddle.net/ozjyu9k5/3/ it's working except while rendered in modal dialog. any suggestions make datepicker working in dialog? please don't mark duplicate searched entire internet working solution , none of them seems working. why not use popup this one . can see full api here on official api page . it this: when click in input field show dialog this your code this: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui datepicker - default functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css...

c# - Compare two input fields in asp.net mvc -

this question has answer here: mvc validation lower/higher other value 4 answers i have 2 properties in model class: public datetime startdate { get; set; } public datetime enddate { get; set; } here, startdate should less enddate there data annotation in asp.net mvc there option write own custom attribute, shown in this answer . another option use foolproof (available nuget). public class eventviewmodel { [required] public string name { get; set; } [required] public datetime start { get; set; } [required] [greaterthan("start")] public datetime end { get; set; } }

jsp - org.springframework.beans.NotReadablePropertyException: Invalid property 'idValue' of bean class [java.lang.String]: -

i have dropdown, value of generating in controller , passing value jsp page. getting following exception in "itemvalue" attribute of "form:options" tag. why need getter setter itemvalue because having value "typecode". avoid confusion, added getter setter idvalue also, still getting same error. kindly help. jsp: <% map lcclstypecode = (map) request.getattribute("lcclstypecode"); system.out.println("lcclstypecode:"+lcclstypecode); %> <form:form action="/tradelc/clssave" method="post" onsubmit="return checkpassword()"> . . . . . <form:select path="typecode"> <form:options items="<%=lcclstypecode%>" itemvalue="idvalue" itemlabel="displayvalue"/> </form:select> . . . <a href="javascript:submitpagex();">create</a> <script> function submitpagex() { document.forms[0].submit(); r...