Posts

Showing posts from August, 2010

Strange behavior using a JSON in meteor -

in meteor app, have json file containing list of languages : list of language codes in yaml or json? template.myprofile.helpers({ isolang: function(){ return json.parse(assets.gettext("myfile.json")); } }); <select> {{#each isolang}} whaterver put here {{/each}} </select> the problem no matter return in helper, save file, app template change login template (im using iron outer), , don't understand how it's possible. i tried langauages list js object, public folder or myprofile subfolder (in client folder), brings me same problem, , no matter try, never enter {{#each}} condition. what doing bad in use of json / js object ? thanks you, david the list of language codes neither json array (missing square brackets) nor (mongo) cursor. spacebar's #each meant to iterate on array or database cursor (cf meteor docs ): so need transform json object json array. here's basic sketch: var jsonobj= {"a":&quo

angularjs - Chrome browser on iOS with ngRepeat overscrolls on reload -

Image
i've hit incredibly annoying edge case small one-page angularjs app i've been developing client. for simplicity, consider following html code: <div ng-controller="serviceguidectrl"> <h1>care assessment</h1> <form ng-submit="loadresults($event);"> <div> <h2>is or loved one?</h2> <ul> <li><input type="radio" ng-model="who" value="do you"> me</li> <li><input type="radio" ng-model="who" value="does loved one"> loved one</li> </ul> </div> <div ng-repeat="question in questions"> <h2>{{ question.text }}</h2> <ul> <li><input type="radio"> yes</li> <li><input type="radio"&g

php - Magento Display out of stock products not working -

i wasted more 5 hours trying figure out why can't see out of stock products in home page of magento. i'm using sm tablisting and, before ask, yes, supports out of stock products. i know story. configuration > inventory > display out of stock products > yes > save & re-index. bad still can't see out of stock products in home page. i debugged entire list.php file of magento , seems problem in core of magento. let me explain. i'm using inventory functionalities , when product not in stock (quantity = 0) magento puts "availability" equal "not available". obvious reasons can't put "available" when quanitity 0 , array of products in home page comes "available" products. what's solution? don't point of setting display out of stock products > yes. i update message code website using show products in home page: class sm_tablisting_block_list extends mage_catalog_block_product_abstract { protec

pdf viewer - PDF some objects become blacked out after downloading from gmail -

Image
i'm downloading pdf file sent me gmail, , in preview looks perfect. however, when download , open it, objects become 'blacked out'. don't think has sensitive/redacted content. here url pdf: napco_k3dgtl_user_guide interestingly enough, on computers shows properly.

ruby on rails - How to restart puma after deploy? -

i'm using rails, puma, capistrano3. have installed gem capistrano3-puma well. started puma puma jungle https://github.com/puma/puma/tree/master/tools/jungle/upstart how restart puma during deployment? you can restart manually using following command bundle exec pumactl -p /home/deploy/.pids/puma.pid restart make sure point correct pid path.

How to exclude particular mail in jenkins -

in jenkins, when build broke, list of culprits scm , email send culprits using "editable email notification" plugin. problem want exclude users that list of emails. because no way related broke. i found "excluded recipients" in jenkins-> configure systems. option exclude recipients list.

ruby on rails - No Route Matches [GET] with # or ? parameter error -

i have route: # :chwid => camera hardware id - :mid => machine id - :fs => formatstring '/videocams/video/:chwid/:mid/:fs' => "videocams#get_videocams_id", :constraints => { :chwid => /[^\/]+/, :mid => /[^\/]+/, :fs => /[^\/]+/ } but when call route, first parameter :chwid contains character # , ? : (@device:pnp:\?\root#image#0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global) and error called: started "/videocams/video/@device:pnp:%5c%5c?%5croot" actioncontroller::routingerror (no route matches [get] "videocams/video/@device:pnp:%5c%5c": what might triggering error , how can fix it? url-escape characters have meaning in urls lie # , ? .

javascript - Why I cannot see the XML files for XML views? -

when use xml view page in sapui5, , open developer tools on google chrome , check, under "sources" tab, directory has ".controller" file, cannot see "view.xml" file. why happen? browser "excludes" xml file after processed ui5 core? in advance! the sources tab in google chrome developer tools meant debugging logic of application. allows add break-points, see calls stack , observe/tinker intermediate variable values. as sapui5 xml views don't contain logic, doesn't make sense show in sources tab, there no logic debug. can see xml files in network tab though, if want inspection on contents. more info on debugging using source tab can found here: https://developer.chrome.com/devtools/docs/javascript-debugging

css - Html: How to dynamically move a Image using the arrow keys? -

i trying make image move on command (the arrow keys), using css. i thought this: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <script> function a() { // k global variable dont know how declare document.getelementbyid("img1").style.top = k + "px"; k++; // , dont know how trigger function using arrow keys } </script> <body> <form id="form1" runat="server"> <div> <img id="img1" src="images/logo.jpg" height="100" width="100" style="position:absolute; left:100px; top:100px; z-index:1" /> </div> </form> </body> </html> you use onkeypress event using javascript capture keypress events of keyboard. for eg: <input type="text&q

android - Lollipop Google Agenda Colorpicker custom or...? -

Image
i wondering if knows if colorpicker custom or in lollipop library? how looks on lg g3 android lollipop - in basic calendar app. on friends phone tough, not this. i colorpicker use it. here source code calendar app in android 5.1 revision 3. check out calendarcolorpickerdialog.java. that class extends class called colorpickerdialog.java. find colorpicker project here . pretty interesting thing pointed out. thinking of using them! :d

xcode6.3 - Xcode 6.3: Crash while archiving a project -

Image
i have got xcode 6.3 installed , receiving xcode crash while archiving project. and actually, don't know how proceed. cannot push product itunes connect. i checking if can roll xcode 6.2. process: xcode [4677] path: /applications/xcode.app/contents/macos/xcode identifier: com.apple.dt.xcode version: 6.3 (7569) build info: ideframeworks-7569000000000000~2 app item id: 497799835 app external id: 812135760 code type: x86-64 (native) parent process: ??? [1] responsible: xcode [4677] user id: 502 date/time: 2015-04-09 22:23:04.523 +0200 os version: mac os x 10.10.3 (14d131) report version: 11 time awake since boot: 9100 seconds time since wake: 2000 seconds crashed thread: 12 dispatch queue: nsoperationqueue 0x7f946daa5ef0 :: nsoperation 0x7f946d9284b0 (qos: user_initiated) exception type: exc_

json - angularjs count duplicate values in array of objects -

i'm working angularjs. have array of objects this: $scope.documents = [ { "id": "221", "activate": "t" }, { "id": "1", "activate": "t" }, { "id": "2", "activate": "t" }, { "id": "221", "activate": "t" }, { "id": "5", "activate": "t" }, { "id": "221", "activate": "t" }, { "id": "221", "activate": "t" }, { "id": "7", "act

ios - WatchKit XCODE 6.3 ISSUE -

i have problem watchkit in xcode 6.3 can't build app. xcode tell me error: watchkit apps must have deployment target equal ios 8.2 (was 8.3). do knows issue ? your ios app can target versions less 8.2, watchkit app , watchkit extension must target ios 8.2 (or later i'm assuming). please make sure you're satisfying requirements. see this apple developer forums link more info.

css - My design has two columns, the right is on the right but below the left column. Why? -

my design has 2 columns .leftcolumn & .rightcolumn . suppose next each other in design, both left , right should be, .rightcolumn below .leftcolumn on right. why? css: .coursecontent { width: 1200px; } .leftcolumn{ width: 860px; float: left; border-right-style: solid; border-right-width: 2px; border-right-color: #efefef; } .rightcolumn{ float: right; width: 300px; } the page: <!doctype html> <html> <?php /** * template name: single event template */ get_header(); ?> <div class="coursecontent"> <div class="leftcolumn"> <?php while ( have_posts() ) : the_post(); ?> <h1> <?php the_title(); ?> </h1> </br> <?php echo '<div class="tagsremove">'; global $post; $nexttagthumb='-1'; $tags = wp_get_post_tags($post->id); foreach ($tags $tag) : if ($tags) { $what_tag = $tags[($nexttagth

c# - Make a large model observable -

i'm on second wpf project , ran uncomfortable situation. model: public class layout { public string name { get; set; } public motor motor { get; set; } } public class motor { public string property1 { get; set; } ... public string property150 { get; set; } } this mainviewmodel: public class mainviewmodel : viewmodelbase { public motor motor {get; set;} ... } ok, have bound 150 properties of motor class textboxes: <textbox text="{binding layout.motor.property1}"/> problem 1) if want trigger action whenever user changes 1 of these, have implement 150 times?? private string property1 { get; set; } public string property1 { { return property1; } set { property1 = value; raisepropertychanged(() => property1); } } problem 2) have implement in mainviewmodel, in model "motor" or need "motorviewmodel"? of these mean lot of copy&p

c# - Deploying in azure error Could not resolve this reference. Could not locate the assembly System.Web.Http, Version=4.0.0.0 -

i'm trying deploy website in azure, have error: d:\windows\microsoft.net\framework\v4.0.30319\microsoft.common.targets(1605,5): warning msb3245: not resolve reference. not locate assembly "system.web.http, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35, processorarchitecture=msil". check make sure assembly exists on disk. if reference required code, may compilation errors. [d:\home\site\repository\src\presentation\nop.web.framework\nop.web.framework.csproj] mvc\api\authorizeapiattribute.cs(13,53): error cs0234: type or namespace name 'http' not exist in namespace 'system.web' (are missing assembly reference?) i checked , 'copy local' option activated in solution. idea what's problem? check web.config , make sure loading correct versions , make sure referencing system.net.http.dll in .net 4.0 or nuget microsoft.aspnet.webapi.core . version use must match have in web.config . e.g. nuget microsoft.aspn

amazon ec2 - Deploying EC2 Instances with Jenkins -

i using jenkins "glue" on current project. it's being used usual continuous integration, various test being ran , deployments made. using aws host application , require cluster of ec2 instances. cluster instances handle http requests public. instances won't build processes. what able have jenkins handle creation (and termination) of ec2 instances. not automatically. want kick off job creates instance, registers instance jenkins slave, runs jobs install tools on instance, test instance , add cluster handle traffic. i've tried setting using standard shell commands in jobs seems bit fiddly , made me think surely there must plugin this. i have installed , tested jenkins ec2 plugin, must great, doesn't quite fit needs. start seems aimed @ handling load jenkins build jobs. doesn't allow me hook job , example, automatically kick off deploy & test jobs on new instance. can recommend method or plugin handle creation of ec2 instances? thanks

javascript - What triggers the isFinal property of a pan event in Hammerjs? -

i using hammerjs handle simple drag , drop scenario. want element bounce when within region of bounding box or zoom off screen if outside of that. using isfinal property determine when call callback function, handles bouncing back. issue is, not clear on how 'pan' event works, unless element still moving when mouse released, gets stuck , isfinal property stays false. so need figure out how trigger isfinal property @ anytime when element released. the code below context. var registernodedraggable = function(oargs) { if (!oargs.id || !oargs.el) { return; } var x = parseint(oargs.el.style.left,10) || 0; //var y = parseint(oargs.el.style.top,10) || 0; window[oargs.id + 'hammer'] = { hammer: new window.hammer(oargs.el), x: x, //y: y }; var obj = window[oargs.id + 'hammer']; if (obj.hammer) { obj.hammer.on('panleft panright', function(e) {

Triggers in SQL syntax issue in code SQL DB2 -

question: my code works until reachs last line throws syntax error. error : db21034e command processed sql statement because not valid command line processor command. during sql processing returned: sql0104n unexpected token "temp_dept" found following "(case when ". expected tokens may include: "join". sqlstate=42601 i trying this: after each insert on rd_emp for each row insert rd_supervisor check cases, if temp_dept.rd_e_id <= 0 rd_supervisor.rd_e_sup 0 code: create trigger rd_total_dep_emp \ after insert on rd_emp \ referencing new table temp_dept each statement \ insert rd_supervisor(rd_e_sup, rd_e_emp, rd_quot) \ select temp_dept.rd_e_id, (case \ when temp_dept.rd_e_id <= 0 0 \ when temp_dept.rd_e_id > 0 , temp_dept.rd_e_id <= 15 15 \ when temp_dept.rd_e_id > 15 , temp_dept.rd_e_id <= 25 25 \ when temp_dept.rd_e_id > 25 , temp_dept.rd_e_id <= 35

How to pass arguments to streaming job on Amazon EMR -

i want produce output of map function, filtering data dates. in local tests, call application passing dates parameters as: cat access_log | ./mapper.py 20/12/2014 31/12/2014 | ./reducer.py then parameters taken in map function #!/usr/bin/python date1 = sys.argv[1]; date2 = sys.argv[2]; the question is: how pass date parameters map calling on amazon emr ? i beginner in map reduce . appreciate help. first of all, when run local test, , should possible. correct format (in order reproduce how map-reduce works) is: cat access_log | ./mapper.py 20/12/2014 31/12/2014 | sort | ./reducer.py | sort that way hadoop framework works. if looking on big file, should in steps verify results of each line. meaning: cat access_log | ./mapper.py 20/12/2014 31/12/2014 > map_result.txt cat map_result.txt | sort > map_result_sorted.txt cat map_result_sorted.txt | ./reducer.py > reduce_result.txt cat reduce_result.txt | sort > map_reduce_result.txt in regard mai

Chrome extension authorize in new tab -

i'm trying implement user authorization chrome extension. i want open new tab, log in there , receive access token , next extension tab update options page (show user logged). use chrome.identity.launchwebauthflow opens new window instead of tab i'd to. want achieve login similar in pocket extension. do have suggestions? then need forgo using chrome.identity api. there no such option. instead, you'll have magic content scripts extract resulting token, , might have problems regards callback url - can no longer use 1 provided identity api.

python - how to split column of tuples in pandas dataframe? -

i have pandas dataframe (this little piece) >>> d1 y norm test y norm train len(y_train) len(y_test) \ 0 64.904368 116.151232 1645 549 1 70.852681 112.639876 1645 549 svr rbf \ 0 (35.652207342877873, 22.95533537448393) 1 (39.563683797747622, 27.382483096332511) lcv \ 0 (19.365430594452338, 13.880062435173587) 1 (19.099614489458364, 14.018867136617146) ridge cv \ 0 (4.2907610988480362, 12.416745648065584) 1 (4.18864306788194, 12.980833914392477) rf \ 0 (9.9484841581029428, 16.46902345373697) 1 (10.139848213735391, 16.282141345406522) gb \ 0 (0.012816232716538605, 15.950164822266007) 1 (0.012814519804493328, 15.305745202851712)

Percentages in css using meteor? -

i'm started making first meteor app , wanted div to same height page, logically set height 100%. didn't work. set width 100%. didn't work. there mistake in code? or maybe meteor parse css weirdly? <head> <title>facer</title> </head> <body> </body> <template name="home"> <div id="face"> <img id="faceimg" src="http://raritea.com/raritea/images/logo.svg"/> </div> </template> css: body { margin: 0px; background-color: grey; } #face { background-color: black; width: 100%; height: 100%; } js: router.map(function(){ this.route('home', {path: '/'}); }); or maybe meteor parse css weirdly? no , meteor works other web framework. try css. #face { background-color: black; width: 100%; height: 100%; position: absolute; } also in order use iron:route , off <body> tag recommend use layout template

osx - Find FileVault2 user in fdesetup output with Awk -

i have 2 user profiles (fred, fredmoo) filevault 2 enabled. i have following bash: ## logged in user's name username=$(/usr/bin/stat -f%su /dev/console) this first user check sees if logged in account authorized filevault 2 usercheck=`fdesetup list | awk -v usrn="$username" -f, 'index($0, usrn) {print $1}'` if [ "${usercheck}" != "${username}" ]; echo "this user not filevault 2 enabled user." exit 3 fi if echo $username , get fred if echo $usercheck , get fred fredmoo the conditional statement above works if there's 1 profile. unix or linux image, since mac has more 1 user profile, statement echo "this user not filevault 2 enabled user." , exit. usercheck has both profiles. how modify if statement if username not equal 1st usercheck or 2nd usercheck, echo "this user not filevault 2 enabled user." , exit? the output fdesetup list looks this: fredmoo,485a09cf-b0d5-469a-8224

c++ - Does steady_clock have only 10ms resolution on windows/cygwin? -

i have suprising observation steady_clock gives poor 10ms resolution when measuring durations. compile windows under cygwin. sad true or doing sth wrong? auto start = std::chrono::steady_clock::now(); /*...*/ auto end = std::chrono::steady_clock::now(); std::cout << std::chrono::duration_cast<std::chrono::microseconds> (end - start).count(); result 10000,20000 etc. the resolution of std::steady_clock implementation dependent, , shouldn't rely on precise minimum duration. varies across platforms/compiler implementations. from http://cppreference.com : class std::chrono::steady_clock represents monotonic clock. time points of clock cannot decrease physical time moves forward. clock not related wall clock time, , best suitable measuring intervals. related: difference between std::system_clock , std::steady_clock? if don't care monotonicity (i.e., don't care if changes wall clock

html - jQuery not working at all? -

when type code in, label div title, , put jquery code in expand when mouse on it. however, doesn't seem working when put in code? the code i'm using here: http://www.codecademy.com/courseblaster14854_53a1c3f8631fe99231000802_deleted_53a1c3f8631fe99231000802_deleted/codebits/giogou/edit it looks did not link jquery library. try adding 1 of following lines <head> : 1.x <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> 2.x <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> e.g. <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="script.js"></script> <title> risebush|home </title> </head> update: replace script.js this: $(document).ready(function () { $("#info").hover(funct

Enable compiler warnings for implicit conversions (C#) -

this question has answer here: how warned potential arithmetic errors due type conversion? 2 answers is there way enable compiler warnings implicit conversions in c#? recently been debugging on hour until realized had following code: double = int / int; which didn't quite work intended. compiler not show warning it, @ warning level 4. i'm working microsoft visual studio 2013. this "problem" more of heuristics issue. in effect code doing following. int numerator = ...; int denominator = ...; int integerdivide = numerator / denominator; double result = integerdivide; at no point there compiler should flag error. sure treat whole warning, not in spirit of how compilers work. it possible add warning on kind of productivity tool, resharper or roslyn. never added core compiler.

linker - Can rpath value be a symbolic link? -

in makefile i'm passing rpath linker this -wl,-rpath,/absolute_path_to_folder_with_lib everything works, when -wl,-rpath,~/symlink where ~/symlink -> /absolute_path_to_folder_with_lib library not loaded can value of rpath symbolic link ? can value of rpath symbolic link? it sure can, misunderstood problem, not symbolic link, ~ expansion. when link binary -wl,-rpath,~/symlink , end rpath literally ~/symlink . such directory (or symlink) not exist. when type e.g. ls ~/symlink shell, happens shell expands ~ whatever $home set to, , readdir on expanded result. but dynamic linker not perform such expansion, , literally looks ./~/symlink , of course doesn't exist. what want is: -wl,-rpath,$home/symlink .

Regex to transpose somewhat tricky last name, first name , title -

is possible use 1 regex convert both doe, john c., jr., m.d. doe, jane, m.d. to read john c. doe jr., m.d. jane doe, m.d. replace ^([^,]+),\s([^,]+),(?:(\s[^,]+),)?\s([^,]+)$ with $2 $1$3, $4 demo

c - What will happen if scanf() gets some character which doesn't match the format string? -

#include <stdio.h> int main(void) { int i, j, k; scanf("%d%d%d", &i, &j, &k); printf("%d %d %d", i, j, k); return 0; } if input 1,2,3 , happen? , why? according https://stackoverflow.com/a/18297691/2646069 , if scanf() reads unexpected string, return not modifying value after last successful value. i tried clang (llvm 6.1.0), on -o0 , explanation above correct, on -o2 , second variable random number not same before scanf() , , third variable 0 . according the manual , scanf s return value tells whether it's safe use arguments or not. upon successful completion, these functions shall return number of matched , assigned input items; number can 0 in event of matching failure. if input ends before first matching failure or conversion, eof shall returned. if read error occurs, error indicator stream set, eof shall returned if input 1,2,3 scanf return 1 , indicating first argument safe use , match failu

HTML5 video tag always gives Invalid source -

here code: <video width="400" controls> <source src="d:/lscweb/presentations/2015-04-07 ampersand.mp4" type="video/mp4"> </video> but when load page "aborted" in video player. if this: <video width="400" controls> <source src="d:/lscweb/presentations/2015-04-07 ampersand.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> browser not support html5 video. </video> i "invalid source". assume it's trying mov_bbb.ogg file doesn't exist. want play first one. it's mp4. why won't play? you can't use link references absolute windows os paths. i suggest move video same folder html document , src="video.mp4" avoid ne

python - Scrapy error " AttributeError: 'HtmlResponse' object has no attribute 'xpath' " -

when try scrapy shell, have problems can not solve. in [1]: response.xpath('//title') --------------------------------------------------------------------------- attributeerror traceback (most recent call last) in () ----> 1 response.xpath('//title') attributeerror: 'htmlresponse' object has no attribute 'xpath' anyone can me solve problem? you should upgrade scrapy steps: 1.download scrapy 0.24.6 http://pypi.python.org/packages/source/s/scrapy/scrapy-0.24.6.tar.gz 2.uncompress files 3.and then: f:\scrapy-0.24.6>python setup.py install

r - Fill area under a curve that does not overlap any other curves -

Image
this questions relates a question posted . however, have narrowed down trying , feel question different enough previous question warrant new post. i adding multiple (>50) curves plot in r. each curve has corresponding probability (0-1). have sorted curves probability , shade area under each curve transparency alpha weighted probability. i adding plots in descending sequence probability. shade just portion under each curve not covered curves on graph. i have read many posts on shading areas between curves, or under curves, cannot figure out how shade just area not covered other plot on graph. hope not considered duplicate. shaded area under 2 curves using r shading kernel density plot between 2 points. how make gradient color filled timeseries plot in r shading between curves in r here example picture (marked in ms paint) of final plot (except without lines inside polygons). used 4 curves in example, adding many more when figure out. added curve highest res

ios - Error using activateConstraints on a collection of Container View constraints -

Image
in ios 8 app using size classes, ipad have different layout in portrait , landscape have iboutletcollection each orientation activate , deactivate. has worked great until introduction of container view. i'm adding new vc separate tab item in iphone version, embed ipad layout using container view. i'll focus on 1 size class, regularregular. container view has 4 constraints: trailing, leading, top, , bottom. when run app, looks fine (in single orientation). now, when add these 4 constraints iboutletcollection , activateconstraints message fails following error message: *** terminating app due uncaught exception 'nsgenericexception', reason: 'unable activate constraint items ; layer = ; contentoffset: {0, 0}; contentsize: {460, 78}> , > because have no common ancestor. constraint reference items in different view hierarchies? that's illegal.' the constraints don't reference items in different view hierarchies. top, bottom, , leadi

ruby - Can't install Rails on Yosemite - I feel like I've tried everything -

i feel i've read every tutorial , stackexchange posts, , still same error when trying install rails. here common error get: $ gem install rails --no-ri --no-rdoc building native extensions. take while... error: error installing rails: error: failed build gem native extension. /users/jdesilvio/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150409-59802-iosiis.rb extconf.rb checking if c compiler accepts ... yes checking if c compiler accepts -wno-error=unused-command-line-argument-hard-error-in-future... no building nokogiri using packaged libraries. checking gzdopen() in -lz... yes checking iconv... yes ************************************************************************ important notice: building nokogiri packaged version of libxml2-2.9.2 following patches applied: - 0001-revert-missing-initialization-for-the-catalog-module.patch - 0002-fix-missing-entities-after-cve-2014-3660-fix.patch team nokogiri keep on doing best provide security updates in t