Posts

Showing posts from July, 2011

angularjs - $resouce response data is not updated on html -

i not amount updated on ui, when network, able see response value. there wrong code, not familiar $resource , new angularjs. <ion-view title="hsf" id="page4"> <ion-content overflow-scroll="true" padding="true" class="has-header"> <h3 id="hsf-heading5" style="color:#000000;text-align:center;">summary</h3> <ion-scroll> <ul class="list" data-ng-repeat="mth in monthlist()"> <li class="item item-positive" ng-click=""> {{mth.label}} <span style="float: right;">total: ${{mth.amount}}</span> </li> </ul> </ion-scroll> </ion-content> </ion-view> .factory('restservice',['$resource', function($r

asp.net - Alternative to ClientScript.RegisterClientScriptBlock? -

the asp.net function clientscript.registerclientscriptblock can used register chunk of javascript code added page when it's rendered. idea here have multiple instances of various user controls trying register same script on , over, ensures included once. the problem is, don't have control on where code added page. insert code inside body tag of page, need add (not limited javascript code) head block. i'm aware of various methods of adding head block via contentplaceholder block or "head.controls.add these options not address problem of same thing being added multiple times. is there existing way this, or have write class similar clientscript.registerclientscriptblock except targeting head block? i threw user control. there's nothing in markup @ all, can add new web forms user control project , put in code behind: public partial class scriptcontrol : system.web.ui.usercontrol { private dictionary<string, string> _scripts = new

css - JQuery Scroll controls opacity of a Nav to fade in, how to stop Nav fading out on reverse scroll? -

i in need of jquery. have fixed nav @ top of page thats opacity set 0 on page load. when page scrolled down nav fades in using: function easypeasyparallax() { scrollpos = $(this).scrolltop(); $('#nav').css({ 'opacity': 0+(scrollpos/800) }); }); how can make when page scrolled doesn't fade out? i have tried doing if statement jquery isn't hot. thanks in advance. edd neal. try this: $(document).ready(function(){ $(window).scroll(function(){ if($(this).scrolltop() > 200){ $('#nav').fadein(1000); } }); }); with css: #nav{ display:none; position:fixed; top:0px; left:0px; width:100%; height:50px; background-color:red; } a working jsfiddle can found here . using fadein() better manually changing css because jquery takes care of cross browser css issues automatically. example, opacity ie alpha(opacity=50)

How to dynamically create a dojo button using option such as iconClass -

i want dynamically create dojo button, , have issue use option such as iconclass. here how create button <td valign="middle" align=" <button data-dojo-type="dijit/form/button" data-dojo-props="iconclass:'icon_btn_add', showlabel: false" type="button" onclick='require(["routeview.js"], function( s ) { s.cb_click_btn_add(1); })' id="id_btn_add_0" </td> i have tried btn = new button({ "data-dojo-props": "iconclass:icon_btn_add, showlabel: false", "onclick": "require(['routeview.js'], function( s ) { s.cb_click_btn_add("+(n)+ "id": "id_btn_add_"+n, "disabled": "true" }, id_td3); and this: domconstruct.create("button", {  "data-dojo-type": "dijit/form/button", "data-dojo-props": "iconclass:icon_btn_add, showlabe

javascript - JS condition on argument/variable's value? -

i'm trying simple on progress-bar script non-existent knowledges of javascript making me struggle little bit. what have looks : if (progress == 100) { var element = document.getelementbyid("avatar-progress"); element.classlist.add("finish"); settimeout(function () { $('#avatar-progress').circleprogress( 'value', 0 ); }, 250); } if ($('#avatar-progress').circleprogress('value') == 0) { var element = document.getelementbyid("avatar-progress"); element.removeattribute("class"); } $('#avatar-progress').circleprogress({ value: 0, size: 156, fill: { color: "#60bcff" }, emptyfill: "#ffffff", thickness: 2, }); basically happens progress-bar : when uploading hits 100% : class added #avatar-progress cool pulse effect, then, after requiered delay pulse animation, value set 0, maki

BASH SCRIPT - Change TRUE to FALSE for a Key in an Array -

i have basic knowledge of bash scripts nothing complex. i've been searching/testing days , can't results need... i have info.plist located in: /dir1/dir2 in info.plist array: cfbundleurltypes in array key: cfbundleurlisprivate and key is: true <key>cfbundleurltypes</key> <array> <dict> <key>cfbundleurlisprivate</key> <true/> </dict> i want change value false testing hasn't worked. here's i've tried , if there's better way this, please let me know! tia #!/bin/bash #access working directory cd /dir1/dir2 sed -i "/<key>cfbundleurlisprivate</{n;s/true/false/;}" info.plist the sed pattern should work fine, however, on os x (which i'll assume you're using) in-place edits have done different: sed -i '' "/<key>cfbundleurlisprivate</{n;s/true/false/;}" info.plist if don't include '' you'll invalid command error.

How can I do search category.name by using elasticsearch in Rails? -

my search working fine. have type "1" or "2" results of "roommate" or "sublet". model has column called category_id integer. model category has column :name string. thus, have category_id 1 having "roommate" , 2 "sublet" below housing model: class housing < activerecord::base extend friendlyid friendly_id :title, use: :slugged include elasticsearch::model include elasticsearch::model::callbacks belongs_to :user belongs_to :category validates :title, :presence => true validates :category_id, :presence => true validates :created_at, :presence => false validates :user_email, :presence => true validates :description, :presence => false validates_length_of :title, :maximum => 30 def self.search(query) __elasticsearch__.search( { query: { # multi_match: { simple_query_string: { query:

amazon web services - For S3 site, how to configure S3, Route53, and Cloudfront to always use the root domain -

using route53, how can configure cloudfront enabled s3 site use root/naked domain? take example, well, domain called example.com. first, know 1 needs create 2 buckets, www.example.com , example.com. beyond this, gets tricky when using cloudfront , route53. figured out: s3 put contents of site in bucket example.com. note endpoint url. in case, it's example.com.s3-website-us-east-1.amazonaws.com . in properties example.com bucket, set ' enable web hosting ' in properties www.example.com bucket, set ' redirect requests host name ' , redirect requests to set example.com cloudfront create cloudfront distribution origin: example.com.s3-website-us-east-1.amazonaws.com (note, when using cloudfront, default origin options in picklist appeared example.com.s3.amazonaws.com, should example.com.s3-website-us-east-1.amazonaws.com. former standard east , should work, ran issues). route53 for example.com hosted zone, create 2 dns records (should hav

mysql - Return rows in common with another user in SQL (Collaborative Filtering) -

i'm trying build basic collaborative filtering recommendation system using mysql. have user rating table this: user_id movie_id rating 1 131 342 3 <<< user 131 has rated movie 342 2 131 312 5 <<< , 312 3 122 312 4 4 213 342 5 5 141 342 5 <<< user 141 has rated 342 6 141 312 4 <<< , 312 (2 movies in common) 7 141 323 3 so i'm trying find similar users 131. want return users have @ least 2 movies in common , ratings above 3. should return rows 5 , 6 (as shown above). this have far: select * user_ratings rating >= 3 , movie_id in (select movie_id user_rating user_id = 131) , user_id != 131 this returns: user_id movie_id rating 3 122 312 4 <<< don't want these 2 4 213 342 5 <<< 5 141 342 5 6 141 312 4 it returns movies users have in c

javascript - Control escape string -

i have function result each group. problem got error because of escape string. how control it. sampel e: o'neil here script: function specificname(e) { var resulta; var resultb; var resultc; console.log("name:"+ e); (var = 0; < a.length; i++) { if (a[i].nama_a == e) { resulta=a[i]; } } (var = b.length - 1; >= 0; i--) { if(b[i].nama_b == e){ resultb=b[i]; } } (var = c.length - 1; >= 0; i--) { if(c[i].nama_c ==e){ resultc=c[i]; } } i have try this. var mystr2 = e.replace(/'/g, "''"); but same. thank helping me. you need escape quote, like: var mystr2 = str.replace(/'/g, "\\'"); console.log(mystr2); // gives o\'neil

mysql - distinct value combinations in sql -

i have columns this: value1____value2 value3____value4 value2____value1 value5____value6 is there way eliminate combination on 3rd line, since it's same { value1, value2 }? what approach? alter table the_table add constraint my_check unique (least(column1, column2), greatest(column1, column2))

javascript - Execute if statement everytime when the url hash changed -

i using easytab create tab page, therefore page won't refresh when switching tab i'd need create function hidden buttons specific tab. so javascript, have built checker url hash //hiding 30d/90d/1y button feed var feedpanelchecker = location.hash; if(feedpanelchecker == "#panel-feeds"){ $("#30days").css("display","none"); $("#12weeks").css("display","none"); $("#12months").css("display","none"); } }); but don't know how make excute everytime when hash tag change, should id use .change() ? seem input type elements only use onhashchange event , fires when window's hash changes window.addeventlistener("hashchange", function() { var feedpanelchecker = location.hash; if (feedpanelchecker == "#panel-feeds") { $("#30days").css("display", "non

java - How to make a Junit test case fail if there is any exception in the code? -

i wrote junit test unit test code. want junit test case fail when exception in code. tried using assert statement, when exception in code, junit test case passing. please can tell me how can achieve this? thanks. you can assert global variable "excepted" = null or , initialize equal information string in catch block.

reactjs - Redux Keep Session -

redux's state goes away after refresh. keeping usertoken object inside global user object. since session should persist after refresh, assume there's better place store token . what's conventional way redux manage sessions? , in case, should keep token ? previous answered suggested use localstorage keep tokens, i'd advise against localstorage reliable store. there's multiples cases making localstorage improper store important data. notably, there's space quota , browsers turn off in private browsing. as token needs accompany each logged request server, want cookie .

Avoid duplicate elements in a random array from a string in javascript -

now, let known i've looked on , i've been unable find answer specific problem i've got. i'm new js , i've been trying teach myself, i'm making basic, "noob" mistake. so apologies in advance. i'm trying make "random generator" of sorts, pulling 2 words given list , i'm not quite sure how avoid duplicate results appearing. i suppose i'm doing wrong in following code: var randomdiv = document.getelementbyid("myrandomdiv"); document.getelementbyid("mybutton").addeventlistener("click", function() { randomindex = math.ceil((math.random()*randomstrings.length-1)); randomindex2 = math.ceil((math.random()*randomstrings.length-1)); newtext = randomstrings[randomindex]+" + "; newtext2 = randomstrings[randomindex2]; randomdiv.innerhtml = newtext+newtext2; you need keep fetching randomindex2 till different value replace randomindex2 = math.ceil((m

php - How to get the exact date and time when mysql database table last updated? -

hi new in web development , suffering problem date , time when mysql database table last updated because have show on web page. getting last updated date correctly not correct time please me. <?php $sql = "show table status mydatabasename 'tablename'"; $tablestatus = mysql_query($sql); while ($array = mysql_fetch_array($tablestatus)) { $updatetime = $array['update_time']; $datetime = new datetime($updatetime); echo $updatetime ; } ?> if you select update_time information_schema.tables table_schema = 'dbname' , table_name = 'tabname' how can tell when mysql table last updated?

vagrantfile - Cannot download Vagrant box file -

i tried standard $ vagrant , vagrant give me an error occurred while downloading remote file. error message, if any, reproduced below. please fix error , try again. transfer closed 100 bytes remaining read i tried bypass manually downloading box image browser , run there , able play vagrant. more problem arrive when tried download jdk in vagrant , give same error message an error occurred while downloading remote file. error message, if any, reproduced below. please fix error , try again. transfer closed 100 bytes remaining read so assume there wrong. using mac, , vagrant port 8088. i'm wondering if have error before? thanks

ios - EKEvent is not following EKRecurrenceRule -

Image
i adding event in ios calendar using eventkit . event recurring event. setting recurring rules event programmatically. event getting added in calendar dates shown on calendar not same set them. event details recurring rules. after event added calendar in calendar entry my event being show 2017 didn't set end date 2017 2016. i tried adding event ios calendar , got same result. below code using. /*! * method, called added event calendar */ - (void)addeventtocalendar { @try { /* event added device calendar */ [singleton.eventstore requestaccesstoentitytype:ekentitytypeevent completion:^(bool granted, nserror *error) { if (granted) { [singleton.event_dateformat setdateformat:[self dateformatforselectedlanguage]]; ekevent *event = [ekevent eventwitheventstore:singleton.eventstore]; event.title = _event.eventtitle; event.startdate = [singleton.event_dateformat datefro

jquery - Show Modal Popup window based on Dropdown selection -

here have dropdown selection "create new" option. when user selects "create new" should display modal popup window. this dropdown code <asp:dropdownlist id="dropdownconfigfile" runat="server" cssclass="selectpicker"> <asp:listitem text="create new" value="1" ></asp:listitem> </asp:dropdownlist> here jquery opening popup window, <script type="text/javascript"> $(function () { //attach click event dropdownlist $("#dropdownconfigfile").change(function () { //get selected valu of dropdownlist selection = $(this).val(); //if 1 show dialog window. can change condition per need if (selection == 1) { //show modal window $('#mymodal').modal('show'); } }); }); </script> this modal popup design. <div id="my

php - Customized validation messages not working? -

am trying add custom validation messages form, cannot figure out life of me.. help/advice appreciated...thank you. i have tried few tutorials, nothing seems clicking me, sure simple, cant seem figure out. thanks form validation: <?php if (isset($_post['insert'])) { require_once('connection.php'); $ok = false; $sql = 'insert students (studenttitle, studentfirstname, studentlastname) values(:studenttitle, :studentfirstname, :studentlastname)'; $stmt = $conn->prepare($sql); $stmt->bindparam(':studenttitle', $_post['studenttitle'], pdo::param_str); $stmt->bindparam(':studentfirstname', $_post['studentfirstname'], pdo::param_str); $stmt->bindparam(':studentlastname', $_post['studentlastname'], pdo::param_str); $stmt->execute(); $ok = $stmt->rowcount(); if ($ok) { header('location: http://localhost/mysqlquiz/student.php'); exit; } else { $error =

YII2 RESTFUL 404 -

i search less infomesion while doing my config (rest.php) <?php $params = require(__dir__ . '/params.php'); $config = [ 'id' => 'rest-api', 'basepath' => dirname(__dir__), 'language' => 'zh-cn', 'controllernamespace' => 'rest\controllers', 'bootstrap' => ['log'], 'modules' => [ 'v1' => [ 'class' => 'rest\versions\v1\module', ], ], 'components' => [ 'errorhandler' => [ 'erroraction' => 'site/index', ], 'urlmanager' => [ 'enableprettyurl' => true, 'enablestrictparsing' => true, 'showscriptname' => false, 'rules' => [ [ 'class' => 'yii\rest\urlrule', 'controller' => [

.net - How to print content of RichTextBox with multiple font type using C# -

i want print richtextbox content contains multiple font type in c# in wpf app can this var printdlg = new printdialog(); if (printdlg.showdialog() == true) { documentpaginator paginator = ((idocumentpaginatorsource)myrichtextbox.document).documentpaginator; printdlg.printdocument(paginator, "printing"); }

matlab - Octave subplots with plotyy, right Y-axis stacking -

Image
i having issue octave plotting, right axis in second plot of subplot using plotyy has overlapping tick marks. plot example here snip of code, let me know if need more of code solve issue: figure(4) subplot(2,1,1) [hay,hline1,hline2] = plotyy(t_i,y_gc(:,1),t_i,y_pos); ylabel(hay(1),'cube angular velocity (rad/s)') % left y-axis ylabel(hay(2),'cube angular position (rad)') % right y-axis title('cube response') xlabel('time (sec)') subplot(2,1,2) [hax,hline3,hline4] = plotyy(t_i(1:end-1),y_vel(1:end-1),t_i(1:end-1),y_torque); ylabel(hax(1),'motor-a angular velocity (rad/s)') % left y-axis ylabel(hax(2),'motor torque (mnm)') % right y-axis title('motor response') xlabel('time (sec)') i don't think makes difference using gnuplot adding: graphics_toolkit("gnuplot")

vim - Detect Backspace in VimL -

i'm attempting detect whenever backspace hit when typing in specific scenario in vim. i'm using getchar() grab general characters user input. ideally, i'd detect backspace keystroke in manner. thinking of using stty somehow, i'm not of yet. suggestions? if using getchar can check whether user typed backspace using let char=getchar() if char is# "\<bs>" … endif . assumes vim configured (only terminal vim, gvim not have problem). of time is, in place of fixing terminfo or, more likely, using set <bs>={<c-v><bs>} , users map characters produced when pressing <bs> . can’t helped.

JQuery Cycle Plugin - Slideshow padding disappears when using div as slide -

i redesigning website , upgrading jquery cycle jquery cycle 2. using cycle latest news/events , each of slides div containing image acts link. http://www.fbclovis.com/newsite however, you'll see, images in top left corner of container div instead being nicely centered. have set container padding 15px make things pretty being ignored. issue occurs when set "data-cycle-slides" cycle option "> div.promo". if have images outside of divs behaves fine. works if set margin of slides 15px , set padding of container 0px - isn't correct coding , try semantic. so why jquery cycle 2 ignoring padding of slideshow container? you have error in html markup, see closing > not should be. post here html in case can not find problem. <div id="main"> <div id="main-content" class="content-section"> <div id="promo-cycle" class="cycle-slideshow" data-cycle-fx="f

android - JNI method to return bitmap from file path -

below code byte[] specified in parameters want bitmap path represent not byte array don't have convert bitmap in java. jniexport jbytearray jnicall java_com_lightbox_android_photoprocessing_photoprocessing_getfile(jnienv *env, jobject thisobj,jstring string) { char * path; path = (*env)->getstringutfchars( env, string , null ) ; char* buffer = 0; long length; file * f = fopen (path,"r"); //was "rb" if (f) { fseek (f, 0, seek_end); length = ftell (f); fseek (f, 0, seek_set); buffer = (char*)malloc ((length+1)*sizeof(char)); if (buffer) { fread (buffer, sizeof(char), length, f); } fclose (f); } buffer[length+1] = '\0'; int size = length+1; jbytearray array = (*env)->newbytearray(env, size); (*env)->setbytearrayregion(env, array, 0, size,buffer); free(buffer); return array; }

javascript - How to get object value in jquery -

i using croppie jquery plugin.all things going good.after resizing image ,i not able dataurl promise object .please me in this. here screenshot of data getting on click of button. http://prntscr.com/awi9co the code below var basic = $('#divloadlogo').croppie({ viewport: { width: 150, height: 50 }, enableorientation: true }); basic.croppie('bind', { url: url, points: [77, 469, 280, 739], }); $("#saveresizeimage").click(function() { var canvasdata = basic.croppie('result', 'canvas'); //this contains promise object $.ajax({ type: 'post', url: '/user/saveresizedcanvasimage', data: '{ "imagedata" : "' + canvasdata + '" }', contenttype: 'application/json; charset=utf-8', datatype: 'json', async: false, success: function(data) { if (data.success) {

amazon web services - Kinesis ProvisionedThroughputExceededException even after sufficient shards -

we have facing provisionedthroughputexceededexception issue while writing data on kinesis stream. case 1: used single m4.4xlarge (16 core, 64gb mem) instance write data on stream pass 3k request jmeter, ec2 instance provides 1100 request per second, choose 2 shard stream(i.e. 2000 eps). in result able write data on stream without loss. case 2: further testing had created 10 ec2 m4.4xlarge (16 core, 64gb mem) cluster , 11 shard stream (based on simple calculation 1000eps 1 shard, 10 shard + 1 provision). when test ec2 cluster different request cases jmeter 3, 10, 30 millions. receive provisionedthroughputexceededexception error on our log file. on jmeter side ec2 cluster provides 7500eps , believe 7500eps stream having 11000eps capacity should not return such error. could me understand reason behind issue. check producer side, sure inserting data different shards? "partitionkey" value in putrecordrequest call may you.

java - Getting ints array instead of characters array -

i trying code problem convert double string , insert array. tried various methods these don't give expected output. public int[] makepi() { double pi = math.pi; string spi = string.valueof(pi); int[] arr = new int[3]; for(int =0; i<3; i++) { arr[i] = spi.charat(i); } return arr; } output should array first 3 characters of pi below :- [ 3, 1, 4 ] while getting [51, 46, 49] i handle decimal character if needed. just hint needed. please don't provide full program spoiler. :-) look @ ascii table. see corresponding chars integers you're getting? should hint you. note you're assigning result int array, while you're running on characters .

node.js - Mocha Test #getImpact "before all" hook: Error: timeout of 2000ms exceeded -

i want test module runs jar file , gives me result. the problem jar file bound take 5 minutes execute , give result, because of error callgraph_class_traversal #getimpact "before all" hook: error: timeout of 2000ms exceeded my testing code is describe("callgraph_class_traversal", function() { describe("#getimpact", function() { var gerritdata var revert; var result; var resmock = function() {}; var updatedatabasemock = function(res, _gerritdata) { gerritdata = _gerritdata; res(); }; before(function(done) { callgraph_class_traversal.__set__({ updatedatabase: updatedatabasemock, up: upmock }); callgraph_class_traversal.getimpact(methodschanged, done, gerritid); }); it('should correct api paths', function() { assert.deepequal(gerritdata.apiresult.paths, expectedgerritdata.apiresult.paths); }); it('should correct api objects', function() { assert.deepequal(gerritdata.apiresult.names, expectedgerritd

ajaxcontroltoolkit - modalPopupExtender when shown from code-behind doesnt apply the transparency to the background -

while wanting modalpopupextender show code-behind, works except the opacity , alpha(filter) properties of css not applied meaning modal popup color set in backgroundcssclass , hence cannot see original controls in background. anyone facing weird behavior , have solution this? b.t.w, works when targetcontrolid not hidden. i battled same issue of day today. have 3 pages identical code in them. 2 of pages worked expected, transparent background, 1 did not. in one, background 100% opaque. finally, realised had accidentally deleted < !doctype html > line in page. adding 1 line page fixed problem instantly. simple. , little unexpected. hth

php fopen dynamic file path -

i trying make simple script allow user upload image database. have problem php fopen function. i need allow user upload image file on computer path file different every time. <form method="post"> <input type="file" name="img"> <input type="submit" value="uload"> </form> this simple form returning string value of file , need open file using fopen function needs direct path file. fopen($_post["img"],"r"); this works if file in same directory php script. so asking if there way how find file stored open using fopen function. i advice first have php manual file uploads: http://www.php.net/manual/en/features.file-upload.post-method.php because such code may open security hall in system. speaking not recommended directly execute users files before doing check virus scan, binary signature of images, image validaty trying resize it, etc.. performance persp

java - Tabs getting opened automatically -

new tabs getting opened after executing quit() function in selenium webdriver. happens browsers( chrome, ie, firefox). have tried terminating process in eclipse , tried killing javaw.exe task manager. still issue persists. solutions or workarounds public static string quit() throws exception { try { application_logs.info("executing keyword quit"); driver.quit(); wbdv.quit(); application_logs.info("browser closed"); result="driver closed"; return "pass"; } catch(exception t) { application_logs.info("error while generating quit -" + object + t.getmessage()); result = t.getmessage(); throw new exception("exception raised in function :quit"); } }

python - Interface name of router -

i want sniff interface of router traffic (packets) thats going on network. how can find it's interface name ? install tcpdump if can, do: [root@b6leb1 tools]# tcpdump -d then result like: 1.eth0 2.nflog (linux netfilter log (nflog) interface) 3.nfqueue (linux netfilter queue (nfqueue) interface) 4.eth1 5.usbmon1 (usb bus number 1) 6.eth2 7.usbmon2 (usb bus number 2) 8.any (pseudo-device captures on interfaces) 9.lo

Trouble finding element in Selenium with Python -

i have been trying collect list of live channels/viewers on youtube gaming. using selenium python force website scroll down page loads more 11 channels. reference, this webpage working on. i have found location of data want, struggling getting selenium go there. part having trouble looks this: <div class="style-scope ytg-gaming-video-renderer" id="video-metadata"><span class="title ellipsis-2 style-scope ytg-gaming-video-renderer"><ytg-nav-endpoint class="style-scope ytg-gaming-video-renderer x-scope ytg-nav-endpoint-2"><a href="/watch?v=ffksd1hhrda" tabindex="0" class="style-scope ytg-nav-endpoint" target="_blank"> live met bo3 </a></ytg-nav-endpoint></span> <div class="channel-info small layout horizontal center style-scope ytg-gaming-video-renderer"> <ytg-owner-badges class="style-scope ytg-ga

java - Can not find where maven local repository path in netbeans 8.0.2 is set -

in netbeans when go tools->options->java->maven panel showing maven home: bundeled maven home but can not find in netbeans 8.0.2 maven local repository path can seen in netbeans 7.0.1 maven local repository in 7.0.1 in system .m2 folder located @ c:\users\acs\.m2 but there repository @ c:\users\acs\appdata\roaming\netbeans\8.0.2\config\preferences\org\netbeans\modules\maven now have installed apache-maven(which have not installed on sysetm) , set maven home path c:\users\acs\apache-maven-3.3.9 in netbeans and wanted know @ location netbeans maven local repository path is. unable find in 8.0.2 does know how find it? using external maven installations, local repository @ (by default) ${user.home}/.m2/repository check out maven settings or maven mini guide you can set local repository dir path, changing global settings ${maven.home}/conf/settings.xml or user settings ${user.home}/.m2/settings.xml like here: <settings xmlns=&qu

node.js - How to do error handling in Express and NodeJS for Mongoose Error. -

i have nodejs application express web server , mongoose abstraction layer on mongodb.now simple express route written this. module.exports.getprofile = function(req, res, next) { users.findone({ '_id': req.user._id }).exec(function(err, profile) { if (err) { res.sendstatus(500); } else if (profile) { res.status(200).send(json.stringify({ 'profile': profile })); } else { res.status(400).send(json.stringify({ 'message': "profile not found" })); } }); }; now have @ least 100 function these in app , instead of writing res.sendstatus(500) every time, want create 1 function this. var senderror = function(err, res, next) { if (err) { res.status(500).send(json.stringify({ 'message': "internal server error. couldn't connect database. please report issue , try again"

Apache Drill Impersonation -

i'm trying build in security on our drill (1.6.0) system. managed security user authentication work(jpam explained in documentation), impersonation not seem work. seems execute , fetch via the admin user regardless of has logged in via odbc. my drill-override.conf file configured follows: drill.exec: { cluster-id: "drillbits1", zk.connect: "localhost:2181", impersonation: { enabled: true, max_chained_user_hops: 3 }, security.user.auth { enabled: true, packages += "org.apache.drill.exec.rpc.user.security", impl: "pam", pam_profiles: [ "sudo", "login" ] } } we using drill on 1 server, therefore i'm running drill-embedded start things up. troubleshooting: root@srv001:/opt/apache-drill-1.6.0# bin/sqlline -u "jdbc:drill:schema=dfs;zk=localhost:2181;impersonation_target=duser001" -n entryuser -p entryuserpassword error: failure in connecting drill:

php - How to default order results of belongsTo relationship? -

//model user class user extends eloquent { public function post() { return $this>hasmany('post'); } } //model post class post extends eloquent { public function user() { return $this->belongsto('user'); } } taken laravel documentation : since, eloquent models themselves, relationships serve powerful query builders, defining relationships functions provides powerful method chaining , querying capabilities. so, this: class user extends model { public function posts() { return $this->hasmany('app\post')->orderby('field_name'); } }

excel vba - Copy rows to separate sheets based on value in a particular column -

the group column in table contains value either 1 or 2 . want copy row value 1 sheet2 , rows values 2 sheet3 using button. should show error message if cells left blank or if value neither 1 nor 2. roll no meter width group 112 150 130 1 since new coding have following approach check if cell empty , generate error message check if cell contains value other 1 or 2 , generate error message finally copy row values 1 sheet2 , rest in sheet3 i need in doing effective way. have keep size of file down enter code here private sub commandbutton2_click() dim integer p = sheet1.range("l1").value 'no. of filled cells in range application.displayalerts = false sheet1.activate ''checking if range empty = 29 p + 29 if sheet1.range("l" & i).value = "" msgbox ("please enter shrinkage group cell no. l" & i) range("l" &

ios - Library not loaded (Dyld Message). Only on 32bits devices -

Image
i've encountered problem on iphone 5c. application crashes directly on launch message : dyld error message: dyld message: library not loaded: @rpath/sharedfitback.framework/sharedfitback referenced from: /var/containers/bundle/application/d5646575-c0e6-462c-8a4a-f445c52fde91/patient.app/patient reason: image not found dyld version: 390.7 i tried iphone 5s, 6 et 6s , works, problem appear when try run on 4s, 5 , 5c devices. based on tests, imagine issue linked architecture. i knew kind of issue, never had on few models. -- here configuration on sharedfitback.plist architectures linking -- here configuration on patient.app - general section it sounds sharedfitback compatible 64bits devices . is have idea issue ?

ios - Camera view rotate 90 degree in Swift -

when i'm making customized camera app in swift. when try access camera, view in camera rotated 90 degrees. try find solution. 1 solution find adding fixorientation function fix view. not working... here full code: let cihueadjust = "cihueadjust" let cihueadjustfilter = cifilter(name: "cihueadjust", withinputparameters: ["inputangle" : 1.24]) let filters = [cihueadjust: cihueadjustfilter] let filternames = [string](filters.keys).sort() class livecamviewcontroller : uiviewcontroller,avcapturevideodataoutputsamplebufferdelegate{ let maingroup = uistackview() let imageview = uiimageview(frame: cgrectzero) let filterscontrol = uisegmentedcontrol(items: filternames) override func viewdidload() { super.viewdidload() view.addsubview(maingroup) maingroup.axis = uilayoutconstraintaxis.vertical maingroup.distribution = uistackviewdistribution.fill maingroup.addarrangedsubview(imageview) maingroup.addarrangedsubview(filterscontr

jax rs - Not null object but empty json -

i have jax-rs method returns me list do's. unfortunetly when go path mapped method empty json list like: [{}, {}, {}] my resource method looks this: @get @produces("application/json") public list<modeldo> getmodels() { list<modeldo> models = modelrepo.findallmodelswithname("name"); return models; } i'm 100% sure objects exists , list isn't empty, because have checked in debugger. the modeldo class simple pojo: public class modeldo { private int id; private string name; //public getters } what should non empty json response? ps. when i'm returning single object same problem -> {} edit: modelrepo: public list<modeldo> findallmodelswithname(string name){ return new jpaqueryfactory(entitymanager).selectfrom(modelentity) .where(modelentity.name.eq(name)) .fetch(); } modelrepo.class @injected resoure class

angularjs - Through rest service data is inserted successfully in DB but got $http status 0 : ionic -

i having issue in rest service in ionic. call ionic rest service. service called , data inserted in database..but in ionic after got status 0. how can solve this? in service response set status 201.. if call service through rest client got 201 but in ionic got 0 below controller angular.module('starter.services', []) .factory('regservice', function($http,$q) { return{ insertregistration: function (reg) { var config = { headers : { 'content-type': 'application/json;' } } $http.post("http://xxx:8080/xxx/add/", reg) //success: callback called asynchronously when response available .then(function (response) { console.log("successful: response submitting data server was: " + response); alert("succ"); $q.defer().resolve({ data: response //returning response since

javascript - Parse Query.First Success / Error Callback intermittently not called -

i'm working on parse cloud code issue has been puzzling me couple of days. i have function check if user has registered push notifications , hasn't disabled them afterwards. takes response object input, field name check pfuser pointer, , callback. function shouldsendpushnotification(object, field, callback){ user = object.get(field); if(!user){ console.log("error: no user in object"); return; } console.log('user is:'); console.log(user); userid = user.id; console.log('seeking push status user: ' +userid); console.log(object); userquery = new parse.query(parse.user); userquery.equalto("objectid", userid); console.log('user query:'); console.log(userquery); userquery.first ({ success: function(userretrieved) { console.log('successfully found user:'); console.log(userretrieved); if(userretrieved.get("pushenabled") == false){ console.log('error: push not

c# - Cast MyClass<string> to MyClass<object> fails in runtime -

in developing class should handle various generic lambda expressions, fell rather familiar hole: had myclass<t> class, , tried cast myclass<string> myclass<object> , so: myclass<string> myclassstring = getmyclass(); // returns myclass<string> myclass<object> myclassobject = myclassstring; doing returned compilation error saying there there's no implicit conversion between 2 types, explicit conversion exist. added explicit conversion: myclass<object> myclassobject = (myclass<object>)myclassstring; now code compiled, failed in runtime, claiming conversion illegal. i using visual studio 2012, , code part of portable class library project compiled c# 5. just make sure, replaced myclass ilist - same behavior appeared - explicit conversion allowed, fails during run-time. why? why compiler accept this? what's point of explicit conversion if fails in runtime? in order allow cast, need mark covariant. however

mysql - PHP Basket quantity variable -

i trying create php page materials database populated. users should able enter quantity next item wish order , have created qty text field this <?php session_start(); include("db.php"); $pagename="order material"; echo "<html>"; echo "<title>".$pagename."</title>"; echo "<h2>".$pagename."</h2>"; include ("detectlogin.php"); echo "<link rel=stylesheet type=text/css href=mystylesheet.css>"; $sql="select * material"; $result=mysqli_query($con, $sql) or die(mysqli_error($con)); echo "<table border=1>"; echo "<tr>"; echo "<th>material name</th>"; echo "<th>material description</th>"; echo "<th>toxicity level</th>"; echo "</tr>"; while ($arraymaterials=mysqli_fetch_array($result)) { ec

javascript - date loop increment and growing variable ( mootools ) -

can please take @ fresh eyes. var start_date = date.parse('2013-07-01'); var i_date = date.parse('2013-07-5'); console.log(start_date + '---before loop '); (var n = start_date; n < i_date; n.increment()) { console.log(start_date + '---inside loop '); } console.log(start_date + '---after loop '); this code produces this: mon jul 01 2013 00:00:00 gmt+0200 (w. europe daylight time)---before loop mon jul 01 2013 00:00:00 gmt+0200 (w. europe daylight time)---inside loop tue jul 02 2013 00:00:00 gmt+0200 (w. europe daylight time)---inside loop wed jul 03 2013 00:00:00 gmt+0200 (w. europe daylight time)---inside loop thu jul 04 2013 00:00:00 gmt+0200 (w. europe daylight time)---inside loop fri jul 05 2013 00:00:00 gmt+0200 (w. europe daylight time)---after loop why start_date variable grow? (fiddle here if needed) the problem n , start_date pointing same object. need clone date creating new date object, example: