Posts

Showing posts from August, 2010

javascript - XPages - displaying attachments in read mode -

i have xpage file upload control , rich text control. after upload attachment , save document, unable see attachment after document has been opened in read mode. <xp:inputrichtext id="richtext1" value="#{document1.richtext1}"></xp:inputrichtext> <xp:fileupload id="fileupload1" value="#{document1.richtext1}"> </xp:fileupload> what need display saved attachment when document in read mode? the file upload control uploading files. show uploaded files need add file download control xpage. ckeditor shows text "see attached file foo.jpg"

r - Find a block of steady column values -

5can give me hint speed following program? situation: have huge amount of measurement data. need extract data "10 minutes stable operation conditions" of 5 parameters i.e. column values. here (working, slow) solution: - take first 10 rows dataframe - compare min , max of each column first value of column - if @ least 1 column min or max not within tolerance, delete first row, repeat - if within tolerance, calculate mean of results, store them, delete 10 rows, repeat. - break when dataframe has less 10 rows since using repeat loop, takes 30min extract 610 operation points 86.220 minutes of data. any appreciated. thanks! edit: created code explain. please note deleted checking routines na values , standby operation (values around 0): n_cons<-5 # number of consistent minutes? ### function check wheter value within tolerance f_cons<-function(min,max,value,tol){ z<-max > (value + tol) | min < (value - tol); return(z) } # define +/- tolera...

Entity Framework 5 table-per-type update, change sub type but keep same base type -

i have simple hierarchy public abstract class communicationsupport { public supporttypeenum type { get; set; } public country origin { get; set; } // national or foreign support } public class telecomsupport : communicationsupport { public string number { get; set; } } public class postalsupport : communicationsupport { public address address { get; set; } } i plan use table-per-type hierarchy db. 3 tables created, 1 base , 2 child using same pk base. my problem want able update communicationsupport changing it's type. let's create telecomsupport, save , change it's type postalsupport , save again (update). result expect ef keep same base record (communicationsupport id) delete record in telecomsupport table , create new 1 in postalsupport. telecomsupport , postalsupport exclusive , cannot share same base communicationsupport. how can using entityframework 5? thanks help! i don't have answer, can think of 4 "solutions" ...

c++ - Why does this not compile without enable_if? -

why following code not compile if remove enable_if? template<class t, class = typename std::enable_if< std::is_constructible<t, double,double,double>::value >::type > operator t() const { return t{x, y, z}; } example code: enable_if http://ideone.com/nwdmjh without enable_if + compile error http://ideone.com/fbmamf without enable_if , conversion operator exists every type. error if attempting instantiate conversion operator types cannot constructed {x, y, z} , doesn't change fact operator exists. because exists, type considered convertible double * , , overload resolution cannot pick best match.

Exception:java.lang.NullPointerException when comparing two strings of two different string arrays -

i'm coding trough codingbat.com/java , ran error don't understand. got 2 string arrays , want compare them. if use arrays works fine (but result not right). right result programmed helper function eliminates duplicates of array. tested helper function, returns array shortened of duplicates. i can retrieve values in new arrays _a[i] etc., , don't errors, if use _a[0].equals(_b[0]) or _a[0].compareto(_b[0]) nullpointerexception (_a[0] == _b[0] works fine...) . if use original arrays a,b code runs without problems. don't comprehend why nullpointerexception there. thanks help! code: public int commontwo(string[] a, string[] b) { string[] _a = killduplicate(a); string[] _b = killduplicate(b); int ai=0, bi=0,count=0; (int = 0; ai < _a.length & bi < _b.length; i++){ if ( _a[ai].compareto(_b[bi]) > 0) { //nullpointerexception here, not if use a,b bi++; } else if ( _a[ai].compareto(_b[bi]) <...

resolution - Get user's screen&viewport dimensions in php on first load -

i want in php height/width of both screen , viewport when user visits page. i've tried different ways cause other problems. my goals: get info on first load (no jump page, no reload). not change url not affect rest of php runs on load, or make php run twice what i've tried far: javascript viewport dimensions: if(!isset($_post['width']) || !isset($_post['height'])) { echo ' <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { var height = $(window).height(); var width = $(window).width(); $.ajax({ type: \'post\', data: { "height": height, "width": width }, success: function (data) { $("body").html(data); }, }); }); </script> '; } $user_width = $_post['width']; $user_height = ...

java - how to add data from text file and Sort this data data received from text file using fileInputStream -

i want should read text text file using file inputstream..and store data using set or method..and sort data using arraylist... class songdetail used set values of song,moviename , artist.... there text file "text1.txt" had store song/moviename/artist details... want when read file in class1,string reurned splited song,moviename,artist , set in songdetail class. import java.io.bufferedreader; import java.io.fileinputstream; import java.io.inputstreamreader; import java.util.*; public class class1 { public static void main(string[] args) { //arraylist <string>list = new arraylist<string>(); arraylist <string>list = new arraylist<string>(); try { fileinputstream in = new fileinputstream("text1.txt"); bufferedreader br = new bufferedreader(new inputstreamreader(in)); string strline; while((strline = br.readline())!= null) { // system.out.println(strline); list.add(strline); //sy...

boost::spirit::karma output of string in quotation marks -

i trying escape string in quotation marks using boost::spirit::karma. works fine if it's string. however, string in boost::variant in std::vector, not. printing string work however, not quite understand why. line (1) works fine, doesn't want. line (2) should it, doesn't. #include <iostream> #include <string> #include <boost/variant.hpp> #include <boost/spirit/include/karma.hpp> namespace karma = boost::spirit::karma; typedef std::vector<boost::variant<int, std::string>> parameterlist; typedef boost::variant<int, std::string, parameterlist> parameter; main() { using karma::int_; using boost::spirit::ascii::string; using karma::eol; using karma::lit; std::string generated; std::back_insert_iterator<std::string> sink(generated); // (1) karma::rule<std::back_insert_iterator<std::string>, parameterlist()> parameterlistrule = (int_ | string) % lit(", "); // works!...

javascript - How to get values using function argument in js in codeigniter -

in ajax getting values values variable, values not getting items variable. reason that? what doing wrong? inside onload function, values variable alerted undefined. can me please? thanks. the code using follows: <script type="text/javascript" language="javascript"> var values; $.ajax({ cache : false, type: "get", url: 'chartvalues', format:'json', success: function(response) { //alert(response); values = response; //alert (values); } }); window.onload = function () { onloaddoc(); } var chart1; function onloaddoc() { chart1 = new cfx.chart();chart1.getanimations().getload().setenabled(true); var axisy = chart1.getaxisy(); axisy.setmin(0); axisy.setm...

c# - hide the default value of a textBoxFor -

note - asp.net mvc 4 application using razor 2 views... have textbox in view waiting user input data, data makes values properties of model want save db. the data associated textbox has [required] tab in model. cannot save model without value textbox model not valid. i know can add @value @htmltextboxfor line, put means value displayed user. is there away have default value hidden, user see's placeholder text "value" saved db. ideas...? textbox.. @html.textboxfor(n => n.article.title, new { @class = "span4 m-wrap", rows = 1 , @placeholder = "enter news articles main subject or title here" , @value = "title"}) controller if (modelstate.isvalid) newsarticle newnews = new newsarticle(); newnews.title = newsarticle.article.title; you can add id textbox follows: @html.textboxfor(n => n.article.title, new { @class = "span4 m-wrap", rows = 1 , @placeholder = "enter news articles main su...

Bash : echo binary output -

for script must create file , add line (only numeric) this. should in binary mode, havent found solution. my commands: size=200 touch quota echo $size >> quota how can in binary mode? perhaps need use -n option? echo -n "$size" >> quota or maybe need binary representation limited 8 bits or 255. echo -ne "$(printf '\\x%x' 200)" >> quota also make sure need use >> , not > >> appends data existing files, not overwrite it.

css - Proportionate Columns in Bootstrap -

Image
does bootstrap have way specify justified columns, in same way tables? in other words, know want 6 columns across, using span2 give me 6 equal columns. inconsistent because of columns have less text others, , want them equally spaced. if resorted tables , didn't specify column widths, distribute each column width proportionately, giving me exact effect i'm looking for. any ideas? no, can not. not unless want tweak grid yourself. having span2 column has less width other span2 columns breaks layout , defeats point. one possibility create inner div inside column , give either padding or margins make content area smaller. otherwise, roll own grid , use instead. it's easy.

c - Function pointers - outside library, warning: initialization from incompatible pointer type -

with yours compiled code function pointers. exact same thing functions "outside" library. typedef, arguments, compilation flags 100% fine, got warning when try call function outside library (when wrote function same prototype , tried call code fine). ideas? #include <stdio.h> #include <stdlib.h> #include "libs/outlib.h" typedef int (*vfuncv)(int, double); void call(int which, vfuncv* fun, int a, double b) { fun[which](a, b); } int main() { vfuncv fun[2] = {outlibfun1, outlibfun2}; call(0, fun, 3, 4.5); return 0; } warning: funargs.c: in function ‘main’: funargs.c:14:5: warning: initialization incompatible pointer type [enabled default] funargs.c:14:5: warning: (near initialization ‘fun[0]’) [enabled default] funargs.c:14:5: warning: initialization incompatible pointer type [enabled default] funargs.c:14:5: warning: (near initialization ‘fun[1]’) [enabled default] and 14th line: vfuncv fun[2] = {outlibfun1, outlibfun2}; ...

sass - Adding units to font-size and line-height variables in font shorthand -

i try learn sass. in order compile files, use prepros app. worked until started use mixins. code follows: @mixin fontface($size) { font: ($size)px/($size*1.7)px "roboto slab", georgia, sans-serif; } and use this: @include fontface(28); when compile it, got spaces added variables, this: font: 28 px/47.6 px "roboto slab", georgia, sans-serif; how can change it? because app, or doing wrong? the correct way add unit via multiplication. however, need turn 1 of values string in order prevent division in shorthand: @mixin fontface($size) { font: #{$size * 1px}/#{$size * 1.7px} "roboto slab", georgia, sans-serif; } instead, may want apply unit before passing mixin: @mixin fontface($size) { font: #{$size}/#{$size * 1.7} "roboto slab", georgia, sans-serif; } .foo { @include fontface(10px); } or use unitless line-height: @mixin fontface($size) { font: #{$size}/1.7 "roboto slab", georgia, sans-...

javascript - JS and JQuery, passing arguments to functions -

so started making webpage change , want animate buttons , on. want write function wich takes object (in case ) , declares functions hover-event. function works totaly fine in (not usefull) version: function hoverover() { $(document).ready(function(){ $("#forma").hover(function(){ $("#buttona").animate({marginleft:"5px", opacity:"1"}, "fast"); }, function(){ $("#buttona").animate({marginleft:"0px", opacity:"0.5"}, "fast"); }); }); but in order use function on multiple buttons, want write this: function hoverover(source) { $(document).ready(function(){ source.parent().hover(function(){ source.animate({marginleft:"5px", opacity:"1"}, "fast"); }, function(){ source.animate({marginleft:"0px", opa...

Cutting a graph in R -

i have following simple problem. have distance matrix number of nodes, , list of subsets of nodes such within each subset, every 2 nodes @ minimum distance dmin. is, each 2 nodes connected edge has associated value. want remove every edge value smaller dmin, , list resulting disconnected graphs. essentially want clusters of data points close each other, not clustering algorithm, instead using threshold value distance. my question is, naturally, how can accomplish in r. consider following matrix m: b c d 1.0 0.9 0.2 0.3 b 0.9 1.0 0.4 0.1 c 0.2 0.4 1.0 0.7 d 0.3 0.1 0.7 1.0 there 4 nodes (a, b, c, d). search function or package given matrix (which in fact 1 - distance matrix) , threshold dmin, example dmin <- 0.5 , produce 2 sets: {a,b} , {c,d} . inefficient way of accomplishing follows: clusters <- list() nodes <- colnames( m ) dmin <- 0.5 # loop on nodes for( n in nodes ) { found <- false # check whether node can associated 1 of existing ...

image processing - CMYK vs sRGB - which one is better -

guys have 2 images 1 cmyk color model , other srgb.. find out color model better use while dealing image processing resizing, cropping, color filling etc.. in advance guys.. ! cmyk color space used print, (s)rgb used screens (web, monitors, tvs etc). if 1 open cmyk document in viewer/program doesn't support color profile (which not uncommon, since cmyk isn't supported rbg) colors appear extremely over-saturated. if altering images use on web, or in application, highly recommend use variant of rgb. in short, neither better other in general, depends on using images (apples , oranges, comes mind). cmyk better print, , (s)rgb better screens. update in response op's comment: just clear (forgive me if know this) color space/profiles not affect resolution of image, affect how colors handled/encoded. resolution affected file dimensions, dpi/ppi (dots/pixels per inch) , compression. update 2 in response op's comment: i'm not familiar "imagemagic...

multithreading - how to run back-end (Non-Stop process) process without affect the Ui Thread in Android -

my problem : trying run continues non-stop process time of activity created destroyed. if ui thread stop execution / unable access ui in emulator.., is there way it? guide me please.. @forgivegod right (about service), in background. however, if process tightly coupled activity (i.e. want match lifecycle starting on activity start , stopping on activity stop, instead of running outside of lifecycle) think asynctask need.

c++ - Why can I declare constructor out of the class -

consider link . see code: class myclass { public: myclass(); ~myclass(); private: int _a; }; myclass::myclass() { } myclass::~myclass() { } we can declare constructor out of class. why can declare constructor out of class , why should this? you cannot declare constructor out of class. talking constructor definition . class myclass { public: myclass(); // declaration }; myclass::myclass() // definition { } you should read this . the main reason why should define constructor outside class readability. clearer declare class in header file , define in source file. can apply rule members of class. a little quote standard : 12.1 constructors struct s { s(); // declares constructor }; s::s() { } // defines constructor

Adding a field for instruction at LLVM X86 codegen -

for x86 codegen add new field each instruction (power of each instruction), how can map each instruction power number? i able associate power level number each machineinstruction, once go on instruction after scheduling sum power numbers of machineinstruction being scheduled , problem don't know add @ .td file of x86 codegen thanks jawad

How to add new tokens into PostgreSQL? -

i add more tokens such open postgresql, procedure should follow? did not find corresponding documents. thanks. (assuming mean "the postgresql server" not "the command line client psql , "token" mean "sql command / statement type"): ... yeah, that's not super simple. if it's utility command not require query planning isn't super hard. can take existing utility commands guidance on how work. they're quite different though. start processutility . if it's intended produce query plan, select , insert , update , delete , create table as , etc ... well, tends lot more complicated. this sort of thing require quality time reading postgresql source code , developer documentation . it's way complex give step-by-step how-to here, since have not explained command wish add supposed do. if @ possible should develop functionality need user defined function first. start pl/pgsql, pl/perl, or whatever, , if hit limitation...

plsql - Sequence and Trigger PL/SQL script for Automatic ID generation on a table -

can me fix code. doesn´t run on pl/sql (sqlplus @script.sql), giving sp2-0552: bind variable "new" not declared. script.sql prompt creating table systemdatalog; declare counter1 integer; counter2 integer; begin select count(*) counter1 all_tables table_name='systemdatalog' , owner='mzmesdb'; if counter1 = 1 drop table systemdatalog; end if; select count(*) counter2 all_sequences sequence name='seqsystemdatalog'; if counter2 = 1 drop sequence seqsystemdatalogid; endif; create table "mzmesdb"."systemdatalog" ( "id" integer not null , "datetime" date not null , "type" varchar2(64) not null, "severity" integer not null, "source" varchar2(64) not null, "user" varchar2(64) not null,...

android - Get instance of current visible activity -

how instance of visible activity in android? i've read can componentname of activity using activitymanager list of tasks , messing that, that's recipe disaster. is there way instance of topmost activity, or if activity isn't mine , can't access it, null? to instance of visible activity, context as: context mcontext = getapplicationcontext(); or mcontext = this; now use activity related tasks. or instance of activity; keep static activityclass instance somewhere else , use getter setter set instance like: public void setactivity(myactivity activity) { myactivity = activity; } public myactivity getmyactivity() { return myactivity; }

javascript - AJAX PHP Submission not working -

i'm trying execute php script updates mysql db on click of image. i'm using snippet found online so: function execute(filename,var1,var2) { var xmlhttp; if(window.xmlhttprequest) { //code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else if(window.activexobject) { //code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } else { alert("your browser not support ajax!"); } var url = filename+"?"; var params = "id="+var1+"&complete="+var2; xmlhttp.open("post", url, true); xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate==4) { //below line fill div id 'response' //with reply server. can use troubleshoot //document.getelementbyid('response').innerhtml=xmlhttp.responsetext; x...

not equal sign not working in javascript -

this question has answer here: ! operator in javascript 5 answers i using not equal sign convert false true giving false. have tried 0 , 1 working fine. when changing value "false" "true" working problem "false" only. <script type="text/javascript"> var test= "false"; alert(!test) </script> you assigning string "false" , assign boolean false var test = false; alert(!test);

android - Custom RatingBar doesn't work on Dialog -

Image
i have set custom ratingbar style inside style.xml code: <item name="android:ratingbarstyle">@style/ratingbarstyle</item> <style name="ratingbarstyle" parent="android:widget.ratingbar"> <item name="android:progressdrawable">@drawable/ratingbar</item> <item name="android:minheight">13dip</item> <item name="android:maxheight">13dip</item> </style> now have created custom layout dialog (xml) [is inside relativelayout]: <ratingbar android:id="@+id/custom_dialog_vota_ratingbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/custom_dialog_vota_label_ratingbar" android:layout_below="@+id/custom_dialog_vota_label_ratingbar" android:layout_margintop="2dp" android:max="5" android:numstars="...

button - How to add soundButton(on&off) on a activity in android apps? -

i have created branch activity .now wanted add 2 button on branch activity. when click on 'sound on' button beep sound on start , when clicked on 'sound off' beep sound off. , hide simultaneously. thank's my code on activity @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.sound_layout); soundbttnon =(button) findviewbyid(r.id.soundbttnon); soundbttnon.setonclicklistener( new onclicklistener(){ @override public void onclick(view v) { startmediaplayer(); } } ); soundbttnoff =(button) findviewbyid(r.id.soundbttnoff); soundbttnoff.setonclicklistener( new onclicklistener(){ @override public void onclick(view v) { stopmediaplayer(); } } ...

c# - Entity Framework Code First - Cast smallint and integer to int32 -

im working on small service tool database. problem due last update, smallint-colums had be changed integer. public class test { public int id { get; set; } //public int16 id { get; set; } public string test { get; set; } } i changed type int16 int. works fine, except can't use old version of database anymore. exception "system.int32 expected, found typ system.int16". is there way cast smallint , integer int32? any ideas? environment: entityframework 5.0.0 .net 4.5 firebirdclient 3.0.2.0 i tried force cast in modelbuilder: modelbuilder.entity<test>() .property(p => p.id) .hascolumntype("smallint"); exception: error 2019: member mapping specified not valid. type 'edm.int32[nullable=false,defaultvalue=]' of member 'id' in typ 'contextrepository.test' not compatible 'firebirdclient.smallint[nullable=false,defaultvalue=,storegeneratedpattern=identity]' of member '...

mysql - Update multiple rows from results from a SELECT query to the same table -

i'm trying figure out how combine these 2 queries. select `o`.`order_id` `orders` `o` join `customerdetails` `cd` on `cd`.`customer_id` = `o`.`customer_id` `o`.`orderplaceservertime` >= '2013-06-01 00:00:00' , `o`.`orderplaceservertime` <= '2013-06-31 23:59:59' , `cd`.`salesrep_id` = 6 this gives me list of order_id s need update salesrep_id = 6 above query. after list of order_id s query above use... update orders set salesrep_id = '6' (order_id = 541304 or order_id = 541597 or order_id = 542318) doing updates orders correct salesrep_id . ultimately i'd combine these make 1 query change salesrep_id a solution proper update syntax join mysql update orders o join customerdetails d on d.customer_id = o.customer_id set o.salesrep_id = 6 o.orderplaceservertime >= '2013-06-01 00:00:00' , o.orderplaceservertime <= '2013-06-31 23:59:59' , d.salesrep_id = 6 here sqlfiddle demo

php - Codeigniter config file change at runtime -

is possible edit config file @ runtime? i'm developing module manager , has able change aspects of configuration dynamically. this means being able read , writte file @ runtime, , modify example line. $config ['webtitle'] = 'foo'; some tips? pd: dont wont create new table in database store configuration. alternatives? edit: after searching time found answer quite similar i'm looking for, have not had success. it might. htaccess block this? link response : link it sounds want modify config file. if so, yes, can it. need make sure file writable web server. fopen() file, fread() memory, change what's needed, fwrite() out again. easy! :) please keep in mind there security risk if in shared hosting situation. if doing setup process, may want check permissions call fileperms(). if permissions not correct, tell user need ftp account , make file writable. then, after setup done, tell user mark file non-writable again.

html - Is there a header alternative to <base>? -

might ignorant question client-side application uses it's resources. html page rendered server involves template engine , template variable because base url changes. wondering if there alternative base (maybe header?). way can let server serve html , set header , not have deal template engine , such. the document controls base, not protocol (http). can, however, use javascript change value. see: how set page's base href in javascript?

How to keep jQuery Validation plugin from adding 'error' class to input box -

i have jquery validation plugin: //name validation cnform.validate({ rules: { customername: { required: true, minlength: 3 }, date: { required: true, dateregex: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d$/, maxlength: 10 } }, onkeyup: false, onclick: false, onfocusout: false, messages: { customername: { required: "unable proceed, search field empty" }, date: { required: "unable proceed, search field empty" } }, errorplacement: function(error, element) { var trigger = element.next('.ui-datepicker-trigger'); error.insertafter(trigger.length > 0 ? trigger : element); } });...

c# - 'Global' variables Razor -

i'm creating form members of site can change passwords accounts, , i'd display message explaining mistakes users made while filling fields (such password short, needs @ least non-alphanumeric character, etc.). i'd display these messages in same page, beside field names. here's code: @helper renderform() { <form method="post"> <p>change password below</p> <div><label for="currentpassword">current password</label> <input type="password" id="currentpassword" name="currentpassword"/></div> <div><label for="newpassword">new password:</label> <input type="password" id="newpassword" name="newpassword"/></div> <div><label for="confirmpassword">confirm new password</label> <input type="password" id="confirmpassword" name=...

matlab - specific column [Remove elements up to last zero element, then remove elements from first zero element to the end] -

this specific question. have m*3 matrix. first column contains m set of elements. may follow this. 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 my interest 1s , corresponding other column values. can remove zeros new set of matrix 1s, may follow this: 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 when situation above want disregard 1s in beginning , remove elements in m*3 matrix first 1, when reaches second start of zeros in column can remove values end of column. (so 13*3 matrix). i'm doing in matlab. thank :) let's call matrix a: firstcol = a(:, 1); indices = find(firstcol); check = find(diff(indices) ~= 1); if (isempty(check) ) afinal = a(indices, :); else indices2 = indices(check(1)+1:1:check(2)); afinal = a(indices2, :); end afinal should output you're looking for.

debugging - Chrome debugger stops working when paused at unknown point in jquery file -

Image
chrome debugger stops working @ point. know sometime execution stopped in jquery.js file @ unknown point , can resume execution using resume button, happens that button doesn't work , way resume execution have close debugger, no other buttons in debugger window works. seeing long time since started using debugger, never came know why happens. i want know why happens pause of execution shown in jquery.js file, pause not set me. when such pause occurs button in image below not work, not other button in window works. can tell me why happens?

iphone - CGContextFillRects: invalid context - Objective C -

i have piece of code give images color need: - (uiimage*)converttomask: (uiimage *) image { uigraphicsbeginimagecontextwithoptions(image.size, no, image.scale); cgrect imagerect = cgrectmake(0.0f, 0.0f, image.size.width, image.size.height); cgcontextref ctx = uigraphicsgetcurrentcontext(); // draw white background (for white mask) cgcontextsetrgbfillcolor(ctx, 1.0f, 1.0f, 1.0f, 0.9f); cgcontextfillrect(ctx, imagerect); // apply source image's alpha [image drawinrect:imagerect blendmode:kcgblendmodedestinationin alpha:1.0f]; uiimage* outimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return outimage; } everything works great in first view when add detail view, gives me error (it still works): cgcontextsetrgbfillcolor: invalid context 0x0. serious error. application, or library uses, using invalid context , thereby contributing overall degradation of system stability , reliability. n...

Removing blank Excel Pivot Table entries -

i have pivot table based on powerpivot multiple levels in rows section. quite few of elements blank. there way suppress blank rows? my pivot table looks @ moment. product1 release 1 iteration 1 (blank) iteration 2 (blank) release 2 (blank) (blank) product2 (blank) product3 release 1 iteration 1 sprint 1 (blank) (blank) (blank) this want like product1 release 1 iteration 1 iteration 2 release 2 product2 product3 release 1 iteration 1 sprint 1 that's example. i've tried set filters each level not display blanks if filter each level hide blank fields pivot table doesn't have items in it. seems excel ends filtering each level out has blank values. not sure if made sense or provided enough information troubleshooting. i'm pretty brain dead @ moment apologize. please let me know if doesn't mak...

c++ - Should std::chrono::steady_clock::now be noexcept? -

i've noticed std::chrono::steady_clock::now has noexcept specifier in documentation @ cplusplus.com . however, haven't found provision in latest c++11 draft (unfortunately don't have copy of standard). is mistake in cplusplus.com documenation or should std::chrono::steady_clock::now have noexcept specifier? § 20.11.7.2 of c++11 standard's definition of steady_clock : class steady_clock { public: typedef unspecified rep; typedef ratio<unspecified , unspecified > period; typedef chrono::duration<rep, period> duration; typedef chrono::time_point<unspecified, duration> time_point; static const bool is_steady = true; static time_point now() noexcept; }; so yes, std::steady_clock::now() should noexcept , isn't error in documentation. it seems cppreference says same .

jquery - Select first drop down and focus -

what selector first select node (drop down)? this works first input need find first select (drop down). $('.modal :input:first').focus(); this not find dropdown. $('.modal select:first').focus(); try this $("select:first").focus();

iphone - Xcode env variables not set -

i downloaded new xcode5 preview , have found cannot build main project. ok in 4.6.3 . aware xcode5 in beta , should not discussed in public forums question not specific xcode5 . the reason project not building environment variables not being set build_components empty build_dir , build_root not being set i can see variables set using xcodebuild showbuildsettings command can tell me these variables pulled use xcode can fix issue thanks

objective c - Force early call to background task expiration handler on iOS devices for testing -

i testing , debugging expiration block in - beginbackgroundtaskwithexpirationhandler: . is there way force block call happens quicker, instead of waiting 10 minutes each time need debug it? i not interested in debugging actual code in block, rather interested in sequence of calls , backtrace, etc.; that's why need callback happen, 10 minutes each time long! yep, basically, isolate background task block, call using nstimer or `- (void)performselector:(sel)aselector withobject:(id)anargument afterdelay:(nstimeinterval)delay` at least thats how it.

how to return a function in a different class in python 3.3 -

i know bad description how can work: class test1(): def test_p1(): print("this part 1 of test1") def test2(): return test_p1() thanks in advance! well, there several options. the basic are: create instance first class test1(): def test_p1(self): print("this part 1 of test1") def test2(): return test1().test_p1() however, should use when having new instance makes sense (depends on api). make class method class test1(): @classmethod def test_p1(cls): print("this part 1 of test1") def test2(): return test1.test_p1() make static method (discouraged) class test1(): @staticmethod def test_p1(): print("this part 1 of test1") def test2(): return test1.test_p1() alternative: use inheritance in cases (maybe case too, not know) makes sense utilize inheritance: create class inherit test1 . way can override parts of , refer parent methods. example: class t...

Can an iOS app "reregister" to handle a URL scheme without reinstallation? -

an ios app can register handle url scheme when it's installed. officially, "if more 1 third-party app registers handle same url scheme, there no process determining app given scheme," according the "communicating other apps" section of apple's "advanced app tricks" . in practice, though, seems app registered handle url scheme 1 it's given to. in event second app has registered handle url scheme app registered, possible first app somehow "reregister" handler url scheme without reinstallation? i have no proof @ hand, pretty sure registration url schemes registration file type handling etc. installation time procedure. however, experience, providing update via app store , updating app triggers installation procedure (since updated app may register new url schemes). hence, if keep apps "up date" providing frequent updates, ios should prefer (and point of view, unofficial rule recent handler used, makes sense)....

asp.net - RegularExpressionValidator is not working -

i'm total newbie in using asp.net , have regular expression validator working fine before after made huge edit textboxes not working anymore. in before edit, when try submit form, if textbox empty or value = "" show error message , not redirect page. in after edit, when try submit form, whether textbox empty or not redirect page. not stopping page redirecting or showing validator before edit. <asp:textbox id="txttstimmlen" cssclass="forimmlentb" runat="server" width="118" text="enter value here" onclick="this.value=''" onblur="tryplaceholder(this,'enter value here')" ></asp:textbox> <asp:regularexpressionvalidator id="vldtstimmlen" controltovalidate="txttstimmlen" display="dynamic" errormessage="immersion length" text="*" validationexpression="(0*[1-9]\d*)" runat="server"/> after edit...

java - Way to enforce coding rules with check ins -

currently have verbal agreement in checking code code should complied without errors, unit tested (with unit tests passed), @ least 80% coverage, complexity less 10, documented java comments , should reviewed team. @ point should fine check in (using perforce). know visual studio have team edition can enforce rules , prevent check ins unless rules have been satisfied. use sonar test our code, want prior checking in enforce dev team follow these rules. there such method java perforce or eclipse? thanks you can use perforce pre-submit trigger, here few examples: http://public.perforce.com/wiki/pre-submit_trigger_examples update: since "change-content" pre-commit triggers give access not list of files content of changed files, in principle write trigger applies these changes full content of branch , runs sonar on it. however, sense triggers typically used brief validations rather more complex processing takes long time execute. longer validations tend belong...

c# - Passing collection from backgroundworker DoWork to backgroundworker Completed and perform a foreach -

my goal here is: user types full or partial computername combobox button click event starts background worker passing computername dowork method dowork method searches activedirectory computername , passes collection workercompleted method workercompleted method adds each computername combobox items. my error @ foreach loop in backgroundworker_runworkercompleted method. "foreach statement cannot operate on variables of type 'object' because 'object' not contain public definition 'getenumerator'" if messagebox.show(results.first().tostring()); in dowork method, can view first computername in collection. (forgive me if collection correct term) if messagebox.show(e.result.tostring()); in dowork , workercompleted method, this: "system.directoryservices.accountmanagement.principalsearchresult`1[system.directoryservices.accountmanagement.principal]" i picked c# month ago , i'm coming powershell apologize in advance if...

javascript - How to pass data to AJAX call -

can tell me how pass data jsp making ajax call ? trying: here ajax call: $.get("gridedit.jsp", { before: "row", time: "2pm" }) .done(function(data) { alert("data loaded: " + data); }); here gridedit.jsp <% string b=request.getparameter("before"); if(b.equalsignorecase("row")) { system.out.println("row row row boat"); out.println("bummer"); } %> i want store value returned gridedit.jsp javascript variable. how should ? please help thanks edit: here tried $.ajax({ url: "gridedit.jsp", async: true, cache: false, type:"get", data: { before:'row', }, error: function(msg) { alert(msg); }, complete: function (xhr...

objective c - How to parse JSON query from ON CONNECT -

i have json [ { "tmsid": "mv004613580000", "rootid": "9756367", "title": "2 guns", "titlelang": "en", "descriptionlang": "en", "releaseyear": 2013, "runtime": "pt01h49m", "showtimes": [ { "theatre": { "id": "5658", "name": "regal fenway stadium 13" }, "barg": true, "datetime": "2013-08-06t10:00", "ticketuri": "http://www.fandango.com/tms.asp?t=aaovd&m=126005&d=2013-08-06", "quals": "descriptive video services|rpx|no passes or super savers|stadium seating|closed captioned" } under showtimes want save "id" , "name" attributes nsstrings variables. any suggestions how approach json? ...

javascript - images in Aptana 3 project not displaying -

i adding images existing webapp, using aptana 3 on windows 7. first cut , pasted images folder, didn't work, created new folder in project directory , imported files. when run code error in firebug saying 'file not found'. i can click on image aptana directory, , opens in windows photo viewer. path given same path given firebug. have refreshed folder , enclosing folders, , have ran app ie, firefox , chrome, still cannot see images in app. i tried running code using aptana's internal server (set firefox) , tried mount code on our development server...no images in either case. the images added in html/css so: (html:) <div class="image"></div> (css:) .image{ height:15px; width:15px; background-image: url(../images/legend/image.png); background-position: center top; } ..in existing code, there several other images added in same way (by else), , these images show in app. can tell me wrong here? try removing ../ ...

newtonscript - How do I set custom buttons when using protoApp instead of newtApplication? -

i'm developing newton os app in newtonscript , protoapp proto fits application type better newtapplication proto (i.e. newtapp). protoapp provides title & status bar close box, how insert custom buttons in status bar (since shows clock)? i found this thread on newtontalk , paul guyot says: you don't need use protoapp. can use protofloater instead. can add nicer newtonos 2.x-like status bar replace ugly clock/battery picker of protoapp , put close box on bar. trick steal bar newtapp framework, i.e. use newtstatusbarnoclose. did several projects, it's documented in doc (the fact can use newtstatusbar[noclose] instead of protostatusbar) , can take advantage of buttons handling code (to align them automatically on left , on right). it turns out suggestion of using newtstatusbar instead of protostatus is documented in newton programmer's guide (2.0) on page 7-19: note new status bar protos newtstatusbarnoclose ...

ios - Rotating a UIView around a center point without rotating the view itself -

i rotate uiview around center point without rotating uiview itself. more cars of ferris wheel (always staying upright) opposed hands of clock. the times i've rotated uiviews around center point, i've used layer position/anchorpoint/transform accomplish effect. changes orientation of view itself. any help? keller this pretty easy in core animation. i've used pretty boring static values example, you'll want make modifications. show how move view along circular uibezierpath. uiview *view = [uiview new]; [view setbackgroundcolor:[uicolor redcolor]]; [view setbounds:cgrectmake(0.0f, 0.0f, 50.0f, 50.0f)]; [view setcenter:[self pointaroundcircumferencefromcenter:self.view.center withradius:140.0f andangle:0.0f]]; [self.view addsubview:view]; uibezierpath *path = [uibezierpath bezierpathwithovalinrect:cgrectmake(cgrectgetmidx(self.view.frame) - 140.0f, cgrectgetmidy(self.view.frame) - 140.0f, 280.0f, 280.0f)]; cakeyframeanimation *pathanimation = [cakeyfr...