Posts

Showing posts from February, 2011

MomentJS, issue with hours and queries -

i issue when try implement moment on nodejs application... the date posted user : 1894-01-01 09:03:00 the date in query : 1894-01-01 08:03:00 when use moment parse date, hour -1 , don't know why... my code : var start = moment(a.startmonth+'-'+a.startday+'-'+a.startyear+' '+a.starthour+':'+a.startminute, "mm-dd-yyyy hh:mm"); try moment.utc(number[]); moment.utc(string); moment.utc(string, string); in utc mode display methods display in utc time instead of local time. moment().format(); // 2013-02-04t10:35:24-08:00 moment.utc().format(); // 2013-02-04t18:35:24+00:00 additionally, while in utc mode, getters , setters internally use date#getutc* , date#setutc* methods instead of date#get* , date#set* methods. read more

android - How can we determine in onPause() if an application/activity is going into the background (onStop) or will be destroyed (onDestroy) -

i had telephonic interview session , interviewer asked peculiar question. wanted know if can, means, know if activity/application stopped (onstop) or destroyed (onstop ondestroy) before happens , when flow in onpause method. i mean execution inside onpause , there can tell if ondestroy(aplication closed) or onstop (backgrounded). could not find answer anywhere. i believe you're looking isfinishing() . if true, activity in process of finishing. checked onpause() android isfinishing documentation

icons - How do I make a google plus button with a custom layout in android? -

i want create custom layout google plus button, ideas? i've tried calling onclickevent of google plus button (that doesn't work) , i've tried changing background image. source code: <com.google.android.gms.plus.plusonebutton xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" android:id="@+id/plus_one_button" android:layout_width="wrap_content" android:layout_height="wrap_content" plus:size="standard" plus:annotation="inline"/> holder.mplusonebutton = (plusonebutton) holder.content.findviewbyid(r.id.plus_one_button); holder.mplusonebutton.initialize("http://www.xxx.xx/", 0); add custom button layout set onclicklistener custom button use plusclient described here handle login procedure as example can provide controller class handling google plus login: public c

excel vba - Userform Multipage disabling tab click -

i have userform multipage tabs, within each tab there "next" command button allows move onto next tab if there no errors (if there error, prompts user , sets focus error on tab). when userform open, can click tabs jump around without completing defeats purpose of error handling. is there way disable tab selection? or add sub tab itself? thanks change style property of multipage fmtabstylenone (2).

javascript - Check if text field is empty before executing jQuery -

this might easy question, find confusing. how run myfunc() if textfield_1 not empty? excicute .on('click', '#openbutton', myfunc) if ($('#textfield_1').val()!="") ? check inside handler: .on('click', '#openbutton', function() { if( !$('#textfield_1').val().trim().length ) myfunc(); //thanks @mike suggestion on trim , length, see comments })

javascript - Check if DOM element is editable (allow user input) with pure JS -

i have: document.body.addeventlistener("keydown", function(event) { var key = event.keycode || event.which; switch (key) { case 38: ui.action.up(); break; case 40: ui.action.down(); break; case 37: ui.action.left(); break; case 39: ui.action.right(); break; } return false; }); in code implement 2048 game. i have user forms , want exit handler if document.activeelement point input or textarea or select handler break ability perform normal edit operation users. currently see 2 paths such check: ["input", "textarea", "select"].indexof(document.activeelement.nodename) > -1 and: document.activeelement instanceof htmlinputelement || document.activeelement instanceof htmltextareaelement || document.activeelement instanceof htmlselectelement what portable way , best confirm html 5 standard , shortest one? update try 3rd strategy - check properties unique editable elements. standard htt

java - How to encode a cookie data in jsp and decode it in php? -

we have created cookie below cookie usernamecookie = new cookie ("username", urlencoder.encode(snuser.getusername(), "utf-8")); usernamecookie.setpath("/"); usernamecookie.setmaxage(60); response.addcookie(usernamecookie); but want create cookie encoded data , has decode in php. can 1 please me. java's urlencoder.encode() uses same encoding standards php's urlencode() function. therefore, decode string has been encoded using java's urlencoder.encode() , can use php's urldecode() function. e.g. $username_encoded = $_cookie["username"]; $username_decoded = urldecode($username_encoded);

Is it possible for a C method not be able to be included in a C++ project? -

i know can include c methods inside c++ project using extern "c" thing. lets suppose i'm thinking in creating c++ project use quite lot of c methods coming both libraries made me libraries made other people/companies developing details , compilation specifications i'm not aware of. is possible of methods of c libraries, unknown compilation , configuration details, not included in c++ project extern "c" ? or c methods 100% compatible c++ code insofar extern "c" used? it's possible of functions exported c use names collide c++ keywords. wouldn't able declare using extern "c" . functions exported assembler use names conflict c keywords. those , functions declared static can still called via function pointer, long library gives way one. headers might not parse-able in c++ mode same reasons -- things restrict keyword. other naming issues, c++ has full support c calling convention. that's extern "c&q

python - Issue with building standalone PyQT Application on Mac OSX -

i trying build simple pyqt application using pyinstaller. following code: import sys pyqt4.qtgui import qapplication, qmessagebox def main(): print "hello" = qapplication(sys.argv) m = qmessagebox(qmessagebox.information, "title", "hello") m.exec_() if __name__=="__main__": main() i used following command generate specfile: python utils/makespec.py scigraph/main.py i got following output: → python utils/makespec.py scigraph/main.py wrote /users/vessilli/desktop/untitled folder/pywork/pyinstaller-2.1/main/main.spec run pyinstaller.py build executable then ran code: python pyinstaller.py --windowed main/main.spec and found following error message: → python pyinstaller.py --windowed main/main.spec 51 warning: running 64-bit python: created binaries work on mac os x 10.6+. if need 10.4-10.5 compatibility, run python 32-bit binary command: versioner_python_prefer_32_bit=yes arch -i386 /users/vessilli/librar

javascript - function triggers on window width but will not turn off if bigger than set width -

here have work if window width under 1024 still trigger though set trigger if on 1024 $(function () { $('#hamburger').click(function () { $('div.burger_nav').slidetoggle(); }); $(window).resize(function () { if ($(window).width() < 1024) { $('.nav_shown').hide(); $('div.footerdiv_2').hide(); $('div.hidden_nav').hide(); $('div.burger_btn').show(); $('#ft').removeclass('footerdiv_3').addclass('footer_img_clear'); } //end of if else { $(".nav_shown").show(); $('.footerdiv_2').show(); $('div.burger_btn').hide(); $('#ft').removeclass('footer_img_clear').addclass('footerdiv_3'); $(document).scroll(function () { var headershow = $(this).scrolltop(); if (headershow >

Bundle validation error when including the Google+ SDK in my iOS app -

i'm trying submit app google+ sdk on board. i'm getting following error time: error itms-9000 bundle invalid. application bundle's signature contains code signing entitlements not supported on ios specifically, value ****** .com.example.test key application-identifier in ' payload/*****.app/googleplus.bundle/gppsignin3resource ' not supported. value should string teamid, followed dot ., followed bundle identifier. also, see same error gppcommonshareresources , gppshareboxsharedresources . i've tried clean project, relaunch xcode, etc., doesn't help. i'm sure bundle id of app same, xcode's asking for. so, doing wrong? remove files in googleplus.bundle in finder: googleplus.bundle/gppsignin3presources googleplus.bundle/gppcommonsharedresources.bundle/gppcommonsharedresources googleplus.bundle/gppshareboxsharedresources.bundle/gppshareboxsharedresources and clear project ---edit---- upgrade new sdk v1.7.1

wordpress - WooCommerce email templete customization for custom field -

i have integrate woocommerce in wordpress. after placed order , checkout getting 1 default email in recipient mail box. working fine. now need customize them. suppose have 2 products , each have quantity 2-items. so, customize email template per quantity. for e.g product name : mouse quantity : 2 product name : keyboard quantity : 3 so here total item quantity 5. need generate 5 different random password , add in email template. later send recipient after success of payment.

php - UTF-8 all the way through -

i'm setting new server, , want support utf-8 in web application. have tried in past on existing servers , seem end having fall iso-8859-1. where need set encoding/charsets? i'm aware need configure apache, mysql , php - there standard checklist can follow, or perhaps troubleshoot mismatches occur? this new linux server, running mysql 5, php 5 , apache 2. data storage : specify utf8mb4 character set on tables , text columns in database. makes mysql physically store , retrieve values encoded natively in utf-8. note mysql implicitly use utf8mb4 encoding if utf8mb4_* collation specified (without explicit character set). in older versions of mysql (< 5.5.3), you'll unfortunately forced use utf8 , supports subset of unicode characters. wish kidding. data access : in application code (e.g. php), in whatever db access method use, you'll need set connection charset utf8mb4 . way, mysql no conversion native utf-8 when hands data off applicati

ios - reorder and save UITableView -

i parse data server contains passengers details. passengers details saved passenger class. main viewcontroller contains uitableview loads passengers data , allows user rearrange cells order. my question how can save tables new order , load again each time app starts, new passenger details parsed server. prefer not use core data. here code: passenger.h #import <foundation/foundation.h> @interface passenger : nsobject { nsstring *name; nsstring *code; nsstring *country; nsstring *date; } @property (nonatomic, strong) nsstring *name; @property (nonatomic, strong) nsstring *code; @property (nonatomic, strong) nsstring *country; @property (nonatomic, strong) nsstring *date; mainviewcontroller m - (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)sourceindexpath toindexpath:(nsindexpath *)destinationindexpath { nsstring *stringtomove = passengersarray[sourceindexpath.row]; [passengersarray removeobjectatindex

javascript - Bootstrap 3 with Masonary 3 column format wrapping -

Image
i using masonary boostrap 3. instead of 3 columns showing, 3rd col wrapping below. here sample code , screenshot. idea why col-md-3, col-md-5 , col-md-3 not showing on 1 line <div id="mason"> <div class="container"> <div class="row"> <div class="col-md-4 item"> <!--some content--> </div> <div class="col-md-5 item"> <!--some content--> </div> <div class="col-md-3 item"> <!--some content--> </div> </div> </div> </div> $(document).ready(function(){ var $container = $('#mason'); $container.masonry({ itemselector : '.item', columnwidth : '.item', transitionduration : 0 }); });

Is there a way to parse Android manifest in C/C++? -

i'm trying write small application should check parse androidmanifest.xml apk in c/c++. know there ways in java/c#, or in python, need c. is there way of doing it? , if not, there documentation regarding binary format of androidmanifest.xml in apk package? thanks in advance, k.

sql - Select where column in not null array -

i trying : select * table column in (select col table2 col2 = value ) but want check if second request doesn't return null array. how possible? thanks in advance simply add not null check in subquery omit null values returned. select * table column in (select col table2 col2 = value , col not null);

sap - Can JCO3 and JCO2 co-exist in Solaris? -

can sap java connector jco3 lib , jco2 lib co-exist in solaris/apache/tomcat server? thinking if can use jco3 new application without touching existing jco2 applications. yes! classes , packages, jar files , native libraries independent , have different names, can have both loaded @ same time. api different though, code have different each.

html - Issue with editing hover state of KendoUI Button -

i attempting alter hover functionality of kendoui button. html looks following: <div class="div-vertical-delimitor div-float-left"></div> <a id="a-draw-point" class="k-button single" title="point"> <img id="img-draw-point" src="../images/dt_drawpoint.png"> </a> </div> the issue is, i'm not seeing k-state-hover class being activated when hover on button. however, button change when hovering on it. when hovering on other objects on page such toptab links see k-state-hover being applied when mousing on top of link. any appreciated. i'm new css , kendoui.

objective c - Prompt the user to authorise the application to share types in HealthKit -

Image
when first calling requestauthorizationtosharetypes:readtypes:completion: of hkhealthstore set of hkquantitytype want permissions to, can see modal view requesting authorization user read , share every type of object application may require access. i'm trying figure out if there way prompt user modal view, besides first time i'm calling: requestauthorizationtosharetypes:readtypes:completion: . i tried calling requestauthorizationtosharetypes:readtypes:completion: every time same set after first call not prompting anymore. when trying change set new type wasn't there before can prompt screen, don't think calling method each time new hkquantitytype in set right way (as there limit amount of types exists). is possible? thanks whatsoever. update i'll add code snippet of call: [self.healthstore requestauthorizationtosharetypes:writedatatypes readtypes:readdatatypes completion:^(bool success, nserror *error) { if (!success) {

php - Phalcon: how to run example unit test? -

i tried run example here: http://docs.phalconphp.com/en/latest/reference/unit-testing.html i created composer file: { "require": { "phalcon/incubator": "dev-master" } } after composer installation i've tried run phpunit , got error: php fatal error: class 'codeception\testcase\test' not found in /www/tests/vendor/phalcon/incubator/codeception/unit/phalcon/validation/validator/db/uniquenesstest.php on line 9 i added new dependency: composer require "codeception/codeception:*" it added many dependencies. after got error: php warning: require_once(tests/data/app/data.php): failed open stream: no such file or directory in www/tests/vendor/codeception/codeception/tests/unit/codeception/module/facebooktest.php on line 3 i changed require_once(tests/data/app/data.php) to require_once(__dir__ . '/../../../../tests/data/app/data.php') in follow follow files: www/tests/vendor/codecepti

html5 - Canvas (Zebra UI) & Internet Explorer 11 with Surface Pro 3 on Windows 8.1 -

i'm developing web application , decided use zebra ui. http://www.zebkit.com using canvas application has surpassed web developer dreams of making cross-browser application doesn't rely on hacks account differences between browsers. is, until microsoft. using surface pro 3 tablet, windows 8.1 , internet explorer 11, i've found odd behaviors. in ie=edge canvas not respond. why might when mode works ie on standard pcs win7/8.1 not on surface? in ie=9 canvas elements work, html5 things filereader api not useable rely upon heavily. zebra ui suggests ie=9 boggles me, why use old spec that? there way can use localstorage, , filereader api while in ie=9 mode? in chrome stylus seems behave differently finger touches, found odd, explanation? have experienced similar while working surface pro? according zebkit , ie edge isn't supported yet , dev version being prepared fix issue.

sockets - C# BeginReceiveFrom is giving me an error -

i need program listen several machines send out udp on status. cut , pasted bits chat program , got things working on startup error "an operation on socket not performed because system lacked sufficient buffer space or because queue full". if ok error works well. in code below if remove while(true) not error 1 entry. thought may wrong callback keep running , everytime gets data send dealt with. believe problem cannot work out how fix how keep receiving data without polling socket? private void form1_load(object sender, eventargs e) { try { checkforillegalcrossthreadcalls = false; //we using udp sockets serversocket = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); //assign ip of machine , listen on port number 701 ipendpoint ipendpoint = new ipendpoint(ipaddress.any, 701); //bind address server serversocket.bind(ipendpoint); ipendpoint ipesender = new ipendpoint(ipaddr

python - vectorized matrix power and matrix dot using numpy -

i want calculate power of many 2-d matrices, , fast possible. couldn't find vectorized method it. for example: import numpy np mat_list = [np.mat(np.random.randn(100,100)) in range(1000)] output = [np.linalg.matrix_power(mat_list[i], 100) in xrange(len(mat_list))] i same dot multiplications: import numpy np mat_list1 = [np.mat(np.random.randn(100,100)) in range(1000)] mat_list2 = [np.mat(np.random.randn(100,100)) in range(1000)] output = [np.dot(a,b) a,b in zip(mat_list1,mat_list2)]

oracle - Select subsequence n days between date -

i want display records every 7 days between 2 date following select * user1.report1 project_name = 'f1' , to_date(report_date, 'yyyy/mm/dd') >= to_date('2013/1/1', 'yyyy/mm/dd') , (to_date(report_date,'yyyy/mm/dd') between to_date('2013/1/1','yyyy/mm/dd') + 7 , current_timestamp) order report_date, report_time desc tried refrence here not work out input: started date (in case, 2013/1/1 in statement above) expected output: records started date(2013/1/1) until current date (1 week 1 record, if started date fall on monday, next record monday , on...) you use mod function every seventh day starting given start date e.g. select * user1.report1 project_name = 'f1' , to_date(report_date,'yyyy/mm/dd') between to_date('2013/01/01','yyyy/mm/dd') , sysdate , mod(to_date(report_date,'yyyy/mm/dd') - to_date('

c++ - When is std::move redundant? -

simply put have class in i'd move wrapped object. std::string m_s; string_t(string_t&& s) : m_s(s.m_s) { } i omitted surrounding class structure, added member m_s completeness sake. am required wrap member access std::move or work since s passed rvalue reference? you need move here. s.m_s lvalue expression, not bind _rvalue_ reference. even s lvalue expression, you'd need move if wanted use move-construct variable.

php - If category/page in wp_nav_menu exist -

i need i have 3 custom menu(wp_nav_menu) customize via admin menu section. <!-- first menu -> <?php companymenu(); ?> <!-- second menu -> <?php servicesmenu(); ?> <!-- third menu -> <?php partnersmenu(); ?> i want show 1 nav menu opened post/page/category belongs for example: when i'm on home page click "contacts" in menu redirects me "contacts" page , because page defined (with other menu links) in companymenu() wp_nav_menu function shows it depend on how many pages need check against solution viable- fewer pages better. you wrap menu code in if statements , use is_page wordpress function check if on page. see link below more information. http://codex.wordpress.org/function_reference/is_page code example if(is_page( 'contact' )){ servicesmenu(); } as general rule wordpress codex has great wealth of knowledge found helpful when starting wordpress development

Timer JavaScript not running in Chrome & Mozilla when window minimized -

hi using java script timer, works in ie in chrome when window minimized becomes slow, in mozilla stops timer. can suggest ? code follows :- <html> <head> <script> var millisec = 0; var seconds = 0; var timer; function display(){ if (millisec>=9){ millisec=0 seconds+=1 } else millisec+=1 document.d.d2.value = seconds + "." + millisec; timer = settimeout("display()",100); } function starttimer() { if (timer > 0) { return; } display(); } function stoptimer() { cleartimeout(timer); timer = 0; } function startstoptimer() { if (timer > 0) { cleartimeout(timer); timer = 0; } else { display(); } } function resettimer() { stoptimer(); millisec = 0; seconds = 0; } </script> </head> <body> <h5>millisecond javascript timer</h5> <form name="d"> <input type="text" size="8" name="d2&

How to change jekyll's default include folder -

i know can change default layout directory specifying new directory in _config.yaml this: layouts: "templates" doing same includes directory doesn't seem working. cannot find documentation either on jekyll website. here tried includes: "partials" its not working though. great if out this. thanks! no way, it's hard coded in jekyll::tags::includetag. you can try override class or make feature request jekyll team if want able change include directory in future.

java - How to prevent Eclipse use existing file tab when opening a new file -

this happens: when try open file using mouse click, java file opened in previous existed file tab, opened file tab replaced new file. annoying since wanted compare 2 file , eclipse open 1 me. have 4-5 tabs not have many files opened. most of time, new file tab added. how change behavior of eclipse? as far know file opened in previous tab if open search panel. if want compare 2 files, open them package explorer or navigator panels. however, can change behavior in way described here: https://superuser.com/questions/130353/how-to-leave-the-open-file-in-eclipse-tab-after-search

user interface - GUI Loop Issue Java -

i novice trying use basic gui functions make simple question , answer program first 56 elements practice. however when run code, errors during running of code randomly. a text box appear no dialogue message name of text box, , x button exit. when press x goes next line in code, other times quits out. hard me reproduce error, since seems happen randomly. my main method posted below: import java.math.*; import java.text.decimalformat; import java.io.*; import java.util.*; import javax.swing.joptionpane; import java.util.random; //this lab study periodc table of elements simple gui output public class practicefiftyeight { public static void main(string[] args) { string input; boolean answer; random myran = new random(); int randint = 0; //random num 0 - 56 string[] arrayelements = {"hydrogen","helium","lithium","beryllium","boron","carbon","nitrogen","oxygen","fl

jquery - Cannot get selected radio button selected -

i have form: <form> <label>login method</label> <ul> <li> <label class="">safeword</label> <input type="radio" value="safeword" name="auth-method" /> </li> <li> <label>multi-factor</label> <input type="radio" value="multi_factor" name="auth-method" /> </li> <li> <label>digital certificate</label> <input type="radio" value="digital_cert" name="auth-method" /> </li> <li> <button name="auth-method-submit" value="continue" class="continue">continue</button> </li> </ul> i need manually set inputs checked when li clicked. on submit, want input has been choosen. heres js: var selectedinput, selectedlabel; $('form li *&#

c# - iTextSharp how to know busy or available space in one page -

i have report prints tables, processes generate table same.. each repetition prints 1 table... then, how can know available space of current page? want know if in free space fits 2 rows or if not how skip next page? public void imprime() { console.writeline("generando documento..."); document.open(); alto = convert.toint32(document.pagesize.height); //parrafo paragraph unparrafo = generarparrafo(); document.add(unparrafo); //genero y agrego salto de linea document.add(new paragraph(" ")); //imagen //itextsharp.text.image unaimagen = generarimagen(); //document.add(unaimagen); //genero y agrego salto de linea document.add(new paragraph(" ")); //tabla //pdfptable unatabla = muestra_tabla(); //pdfptable unatabla = arma_tabla(document); //document.add(unatabla); arma_tabla(); //cierr

Powershell launch at specific times -

i building system restart computers patch purposes. of skeleton there , working, use workflows , functions allow me capture errors , reboot systems in number of ways in case of failures. one thing not sure of how set timing. working on web interface people can schedule reboots, either dynamic (one-time) or regularly scheduled (monthly). server info , times boots stored in sql database. the part missing how trigger reboots when scheduled. can think of allowing whole hour increments, , run script hourly checking see if servers in db have reboot time "matches" current time. work, inflexible. can think of better way? sort of daemon? for instance, user x has 300 servers assigned him. wants 200 rebooted @ 10 pm on each friday, , 50 once month on saturday @ 11 pm. there on dozen users rebooting 3000-4000 computers, multiple times monthly. ok, let's have script takes date , time argument computers reboot based on specific date , time, or schedule, or

java - Is there an elegant way to make JTable stop editing when user closes the application window? -

i trying find out elegant way make jtable stop cell editing (cancel actually) when user closes main application window. know can done using windowadapter work need reference window. problem not have it. an abrupt exit may need handled @ several levels. assuming user must navigate out of table click on exit control, should desired result setting table's "terminateeditonfocuslost" property. table.putclientproperty("terminateeditonfocuslost", true); if have resort windowlistener or similar, can stop editing explicitly shown here . celleditor celleditor = table.getcelleditor(); if (celleditor != null) { if (celleditor.getcelleditorvalue() != null) { celleditor.stopcellediting(); } else { celleditor.cancelcellediting(); } } because host owns frame decorations, platforms require special handling intercept close control, discussed here . preferences makes best effort persist updated values.

CakePHP/CakePHP 2.4 app -

i developing cakephp 2.4 app , trying manage changes database table schemas schema manager. figured out how generate schema , restore it, there way backup entire database's schema it? seems should method solve this... thoughts? of course, use schema dump command cake console. it write entire schema .sql file , store in app/config/schema . example of usage: console/cake schema dump --write filename.sql (change 'filename.sql' whatever dump file should called.) this can find in cake docs: http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html

limit git add . -A -n to present directory (no subdirectories) -

how limit output of: git add . -a -n to present directory only? e.g. like: git add . -a -n --depth=0 i @ base directory of project , want see files changed @ level only. using grep -v part of post-processing output not practical due git add . -a -n taking long when has scan sub-directories well. ls -p|grep -v / |xargs git add -an

xcode5 - ios 8, how to get all photos using ALAssetLibrary to replace the missing camera roll album -

i have app has custom image picker uses alassetlibrary create album picker , image picker. we've implemented custom picker in order our customers select multiple images. image picker works great under ios 7 , shows "camera roll" album user's photos. however, when running same app under ios 8, seems apple has removed "camera roll" album albums view , shows "recent photos". can see, way access photos in ios 8 through collection view (in photos app or new built-in picker). unfortunately, can't use photokit @ time because still need support ios 6 & 7 users. know of way obtain assets , create custom camera roll album using alassetlibrary when running ios 7 app under ios 8 (compiled in xcode 5)? update well, stated in original post above, not able use new photos framework (photokit). however, moved our builds xcode 6 , can use photos framework create group of photos (look @ wwdc exampleappusingphotosframework sample code how this).

c# - Orchard CMS: adding filter to Contents/List -

i trying add additional filter option list of contents (admin/contents/list) in orchard. started replicating existing filter content types, , have gotten point able display new filter list, populate it, etc. in admincontroller contents there actionresult method called list called both on initial load, after post (via redirect) seems query built. looking @ existing filter content types see this: query = query.fortype(model.typename); what little confused on here how extend example query locale (culture) of content item. make sense use .forpart method? though need careful here since in default view want show "en" - want display items without localizationpart (as opposed when filtering specific culture - , not want show items no localizationpart) i have read through following, none of these seem address exact scenario (unless reading 1 wrong).. how filter related content parts within orchard cms query sorting , filtering lists in orchard filter content type

dependency injection - Convert Ninject DI to Unity DI -

how convert following ninject di unity? i'm having trouble understanding correct syntax. /// <summary> /// load modules or register services here! /// </summary> /// <param name="kernel">the kernel.</param> private static void registerservices(ikernel kernel) { database.setinitializer(new migratedatabasetolatestversion<defaultmembershiprebootdatabase, brockallen.membershipreboot.ef.migrations.configuration>()); var config = membershiprebootconfig.create(); kernel.bind<membershiprebootconfiguration>().toconstant(config); kernel.bind<useraccountservice>().toself(); kernel.bind<authenticationservice>().to<samauthenticationservice>(); kernel.bind<iuseraccountquery>().to<defaultuseraccountrepository>().inrequestscope(); kernel.bind<iuseraccountrepository>().to<defaultuseraccountrepository>().inrequestscope(); }

spring - Wildfly jsp encoding by jboss-web.xml -

i'm working on corporate project using wildfly . wonder if there way configure " jsp-encoding " property single project , not in standalone.xml , affects projects? i'm using spring web mvc 4.0.6 on maven project in netbeans 8. did tried add web.xml ?: <filter> <filter-name>encoding-filter</filter-name> <filter-class> org.springframework.web.filter.characterencodingfilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> <init-param> <param-name>forceencoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

android-wear embedding old (cached) wear apk in the mobile-release apk -

i generating signed apk using option build -> generate signed apk problem mobile-release.apk doesn't embed updated wear apk. have tried changing text / logic, display old thing. i have tried of following, ideas why keep embedding old wear apk instead of creating new one. file -> invalidate cache / restart. build -> clean + rebuild project clear cache of wear app on phone settings -> resync apps (option on handheld wear app) manually delete apks in build folder of both mobile , wear mobile. any hints, or facing similar issue, please reply. update 1: i tested generated wear-release.apk separately, latest, still somehow embedded apk old. i changed gradle config manually include newly generated apk, compile filetree(dir: 'libs', include: ['*.jar']) // wearapp project(':wear') wearapp files('wear-release11.apk') // renamed purposefully make sure picking right file. it indeed give error if wear-release11.apk missin

python - Simplest way of converting RGB to Saturation -

i'm totally inexperienced python or programming language, i'm couple days programming , want convert rgb values saturation, have no experience @ programming, keep code simple, i'm using program called cinema 4d python in thing called "xpresso", have plugged in red green , blue values through "xpresso" python don't need define them myself [here link screenshot of i'm doing http://www.4shared.com/download/5uwpm-uece/bandicam_2014-09-10_21-36-26-1.png?lgfp=3000 ], thing need convert values saturation, might unclear question, or wrong place ask question on i'm going ask anyway, simplest way convert rgb saturation value python if want calculate "by hand": def main(): global output output = rgb_to_s(red, green, blue) def rgb_to_s(r, g, b): # if have 0-255 rgb values: r = float(r)/255 g = float(g)/255 b = float(b)/255 cmax = max(r, g, b) cmin = min(r, g, b) l = (cmax + cmin)/2 d = c

python - Does numpy.all_close check for shape for the array like elements being compared -

its not clear documentation whether numpy.all_close check shape. the code allclose is: def allclose(a, b, rtol=1.e-5, atol=1.e-8): # doc... x = array(a, copy=false, ndmin=1) y = array(b, copy=false, ndmin=1) # special handling of 'inf'... errstate(invalid='ignore'): r = all(less_equal(abs(x-y), atol + rtol * abs(y))) return r notice insures inputs arrays (with @ least 1 dim). that's why works nested lists. secondly core action x-y . checks absolute difference terms small. if can broadcast arrays math, can compare arrays. it's subtraction issues broadcasting valueerror .

grails - How to upgrade from 2.2.4 to 2.4.3 -

i trying upgrade 2.2.4 2.4.3 what best way this? i've made following changes buildconfig.groovy plugins { runtime ':hibernate4:4.3.5.2' runtime ':jquery:1.11.0.2' runtime ":jquery-ui:1.8.24" //runtime ":resources:1.2" runtime ':twitter-bootstrap:3.2.0.2' compile ':spring-security-core:2.0-rc4' compile ":rabbitmq:1.0.0" compile (":events-push:1.0.m7") { excludes "resources" } compile ":rest-client-builder:1.0.3" test(":spock:0.7") { exclude "spock-grails-support" } build ':tomcat:7.0.52.1' runtime ':database-migration:1.4.0' compile ':cache:1.1.3' compile ":pretty-time:0.3" compile ":tagcloud:0.3" compile ':asset-pipeline:1.8.3' } after making changes command need run? there changes need make since resources plugin replaced

ios - How to scale a UIImage view to a square with Autolayout inside a UIScrollView -

Image
i've been struggling learn autolayout (finally). want have vertically scrolling uiscrollview holds content view. want pin uiimage view top of scrollview , keep image square (scaletofill). want (only want autolayout): i can't image keep aspect ratio while staying within screen bounds. whenever add aspect ratio constraint imageview grows 600 points (the width of png think), want wide screen. i think setting constraints uiimageview correctly because if rid of scrollview , drop imageviw directly on view seems want to. trick putting inside scrollview. this how have set up: the 4 vertical/horizontal space constraints on scroll view set constant 0. since size of uiscrollview depends on content, cannot have size of uiimageview subview dependent on it. you have remove aspect ratio constraint of uiimageview , use fixed width one. can have uiimageview width dependent on view in uiscrollview has either fixed width or otherwise unambiguous width. don't

php - Doctrine refresh copy of entity -

i have customeraccount entity. after entity has had changes made via form, before entity has been persisted database, need fetch new copy of same customeraccount entity exists in database. reason need want fire off changed event both old , new data in service. one hack used $oldaccount = unserialize(serialize($account)); , passing old service, thats hackish. what really have doctrine pull copy of original entity (while keeping changes new version). is possible? update it appears want impossible @ time way doctrine architected. update 2 i added solution ended using @ bottom. i'm not happy because feels hackish, gets job done , allows me move on. it depends. i mean, doctrine2 use identitymap prevents "accidentally" query db same object on , on again same request. way force doctrine fetch entity object again detach entity entity manager , request entity again. this, however, lead strange behaviour "slip" out of control: you can

javascript - jQuery Slide to right - and replacing HTML -

original html: <div id="filler"> <h2 class="rankings-header">donor rankings <img src="<?php bloginfo('stylesheet_directory'); ?>/img/right_arrow.png" style="right:0; padding-left:10px; cursor:pointer;" id="dr_collapse"></h2> </div> jquery: jquery(document).ready(function($){ $("#dr_collapse").click(function(){ $("#rankings-list").toggle("slide",{direction:"right"},700); $("#filler" ).html( '<h2 class="rankings-header">donor rankings <img src="/wp-content/themes/ati/img/left_arrow.png" style="right:0; padding-left:10px; cursor:pointer;" id="dr_collapse"></h2>' ); }); }); for reason, when click image, slide happens...once. , changes arrow image. can inspect html , see changed html. but when click again, nothing happens ,

java - Updating jLabel based on jSpinner -

right have jframe spinner has numbers. storing value of spinner this int value = (integer) jspinner1.getvalue(); and outputting jlabel this jlabel5.settext("counter = " + value ); i wondering if there way update jlabel every time number changed on spinner? add changelistener , set label there. jlabel l = ...; jspinner spinner = ...; spinner.addchangelistener(new changelistener() { public void statechanged(changeevent e) { l.settext("counter = " + spinner.getvalue()); } }

c - Console program does not execute correctly when run from SciTE -

i'm learning c tutorial concurrently general programming course. course setup advised windows users use scite, did. possibly because have windows 8, had edit scite cpp.properties file sample programs run. make/go section of properties file looks like: ccopts=-pedantic -os cc=g++ $(filenameext) -o $(filename).exe ccc=gcc $(filenameext) -o $(filename).exe make.command=make command.compile.*.c=$(ccc) -std=c99 command.build.*.c=$(make.command) command.build.*.h=$(make.command) command.clean.*.c=$(make.command) clean command.clean.*.h=$(make.command) clean command.go.*.c=$(filename) my problem cannot 1 program execute in scite. works fine in powershell/cmd if try execute in scite, don't first printout , providing input nothing. never ends, if stop executing. have go task manager , end program. have had problem before, because mistyped. don't know i've mistyped here: #include <stdio.h> #include <conio.h> int main(void) { int num1; int num2;

javascript - highcharts: A chart with 1 or 0 in Y axis -

we have pcs , ip-cameras working , wrote python script check machines if or not pinging them. if machine result 1 , if it's down result 0. script writing current time. there 2 tables. devices: keeps devices id, name, ip, etc ping: keeps ping results. the script getting ip address , id of device devices table , pinging , writing results ping table. here code (i know it's verdantly): # -*- coding: utf-8 -*- import subprocess, sys time import sleep try: import mysqldb except: print "please install python's mysqldb library" sys.exit(0) class bcolors: header = '\033[95m' okblue = '\033[94m' okgreen = '\033[92m' warning = '\033[93m' fail = '\033[91m' endc = '\033[0m' def cprint(txt, typ): print "%s%s%s" %(typ, txt, bcolors.endc) def ping(hname, verbose=false): response = p = subprocess.popen(["ping", "-c1", hname], stdout=subprocess.