Posts

Showing posts from September, 2015

java - Last square of 8x8 grid not drawn, using two nested FOR loops -

i'm having trouble understanding why code isn't working. should display checkerboard grid 8x8, but last square doesn't drawn ! idea why? i searched see if had been asked before, , didn't find anything. in advance! code: /* * file:checkerboard.java * ---------------------- */ import acm.graphics.*; import acm.program.*; public class checkerboard extends graphicsprogram { int row, column, x, y; public void run() { // checkerboard (row = 0; row < 8; row++) { (column = 0; column < 8; column++) { // x, y, x width, y width add(new grect(x, y, 50, 50)); x = column * 50; y = row * 50; } } } } btw: book i'm reading asks use 2 nested loops ( "the art , science of java" , chapter 4, exercise 11, cs-106a) you need set x , y before drawing rectangle. otherwise, last rectangle not going display: for (row = 0; row <

What design pattern is this code in Javascript? -

this question has answer here: why write “.call(this)” @ end of javascript anonymous function? [duplicate] 4 answers what kind of design pattern , significance of using closure? (function(){ // code here }).call(this); edit then difference between above code , following this keyword still refer same object in both ways. (function(){ // code here })(); thats invoked function expression. more info here: http://benalman.com/news/2010/11/immediately-invoked-function-expression/ the purpose run code while protecting scope (so variables declared within don't leak out global scope. update call sets value of this function being applied on. without it, value set window object, there set outer scope.

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

in javascript code, download bunch of links of images, , draw them canvas in grid theme. number of links there are, , set width , height of canvas accordingly, there 200 images per row. height based on total number images. problem noticing based on height use, images show on canvas. example, if set height 12 rows, see images, if set on that, no images show up. when setting in 1 row, images show in firefox 23. ie9 , chrome29 shows nothing. does know if there wrong here, or stable way drawing lots of images large canvas? thanks. function onprofilesuccessmethod(sender, args) { alert("request arrived"); var listenumerator, piccount, item, picobj, path, office, ctx, x, y, imageobj; listenumerator = listitems.getenumerator(); piccount = listitems.get_count(); var w = 125; var h = 150; var rl = 200; var canvas = document.createelement('canvas'); canvas.id = "picgallery"; canvas.width = w * rl; canvas.

mysql - Rails refuses to insert one field into the database -

basically grab id of element table , insert another. vuln_id = activerecord::base.connection.execute("select blah ...") pid = vuln_id.first puts "==============================" puts pid # echos id puts "==============================" if pid.empty? puts "pid empty" end rd = report.new(:plugin_id => pid, :report_id => report_id) rd.save() in rails console, when report.dbaction(params) it runs model , here output (0.3ms) select statement..... ============================== 186 ============================== (3.0ms) begin sql (0.3ms) insert `report_data` (`created_at`, `report_id`, `updated_at`) values ('2013-07-10 22:03:59', 6, '2013-07-10 22:03:59') (33.9ms) commit it inserts report_id doesnt insert pid value database, though exists. why this? quick edit: plugin_id exists in table. triple checked. here rest of model file looks like class report < activerecord::base

javascript - Count length of each class -

i have below code in this fiddle . html <span class="myname">john smith</span> <span class="myname">john smith</span> <span class="myname">john smith</span> <span class="myname">john smith</span> <span class="myname">john smith</span> <span class="myname">john smith</span> javascript $('.myname').each(function(){ var text = $(this).html().split(' '), len = text.length, test = $(this).val().length, result = []; console.log('outside: ' + test); for( var = 0; < len; i++ ) { result[i] = '<span class="name-'+[i]+'" >' + text[i] + '</span>'; console.log('inside: ' + test); } $(this).html(result.join(' ')); console.log('after

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -

i have have cloudera cdh3u4 cluster setup. have secondarynamenode daemon running on 1 of nodes. i have ensure user has root access node on cluster (for example, datanode not have other daemons running) should not able start instance of secondarynamenode daemon on node (thereby having 2 secondarynamenodes on cluster) how can achieve this? thanks in advance. add property hdfs-site.xml namedfs.secondary.http.address valuesecondarynamenode-host address or ip:50090

gruntjs - Grunt usemin task to replace resources -

using gruntjs , possible replace resources in html file remote path (or perhaps anypath)? i'm particularly interested in doing usemin plugin. possible sample functionality: before <!-- build:js //cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.js --> <script src="/lib/angular.js"></script> <!-- endbuild --> after <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.js"></script> this idea similar usemin plugin skips concatenation of enclosed resources new file of specified name. in other words, replaces enclosed html single resource of specified path. i wrote grunt-dom-munger because found usemin specific. can use grunt-dom-munger alter html see fit , read script tags , send concat/uglify/etc. grunt-dom-munger

ios - Interactive UITableViewController in container -

working on , ios app have set of: rootviewcontroller hooked uitableviewcontroller via [self addchildviewcontroller:tablevc]; with tablevc.view subview of rootviewcontrollers view. rootvc has uipangesturerecognizer used animate pan left showing table. this works fine , table great static view, when try fire - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath by tapping on cell, never called. have checked if taps being accidentally registered gesture recogniser aren't. do need somehow tell rootvc when tableview on screen send taps child uitableviewcontroller? thanks rdelmar helping me solve advice on using cliptobounds property of uitableview's superview. this showed uiviews being revealed through panning werent responding touches out of bounds of superview. i solved adding view 'spanview' appropriate dimensions envelope subviews. after responded touches expected. the hiearchy ended being:

escaping - Is it properly quoted when I using '*' or '**/*' in bash? -

find -name '*.jpg' -print0 | xargs -0 qiv qiv **/*.jpg both safely escaped , delivered qiv ? yes. in first case, find expanding wildcard internally, , delivering results xargs expects them. in second, shell expanding them , passing each match separate argument. both correct (assuming shell support ** , , command line length maximum isn't exceeded).

Oracle ODP.net Managed vs Unmanaged Driver -

Image
are there performance benchmarks between managed , unmanaged oracle odp.net drivers? (i.e. there advantage moving managed driver other architectural/deployment simplicity) i share results. think small lack of performance worth compared easiness of deployment. note: seg means seconds. sorry that. of course simple test, , there several topics not covered connection pool, stability, reliability , on... it important mention, scenarios executed 100 times. time quantities average of 100 executions.

javascript - Programmatically apply media query without changing iframe size -

i have small iframe houses larger content page. iframe has overflow: scroll can scroll around , see entire content page, however, content page css has media queries getting triggered because of iframe's small size, though actual page larger. is there way either manually pick when apply these query styles or trick iframe thinking it's full width of content without changing size? the option i've thought of break media queries separate files , programmatically change additional link's href point @ them needed, seems kind of messy. thanks in advance

css - bootstrap nav pull-right makes header zoom off screen -

upon zooming in mobile header zoomed in section of header class nav pull-right gets cut off screen. how can fix this? perhap fixing header size width of screen? <nav> <ul class="nav pull-right"> <div class="signinform" <% if request.path == root_path && current_user.nil? %> style="padding-top: 18px;" <% end %>> <%= form_for(:session, url: sessions_path, :html => { :class => "form-inline"}) |f| %> <input id="session_email" name="session[email]" type="text" class="input-medium" placeholder="email"> <input id="session_password" name="session[password]" type="password" class="input-medium" placeholder="password"> <button type="submit" class="btn btn-small btn-primary">sign in</button>

winforms - Windows Form not changing underlying Entity Data -

Image
can see simple mistake can't? i opening form allow assigning job numbers invoices not have any. this code in applications main form handles this: dim unknownjobs = pur in context.purchases pur.senttomyob = false andalso pur.job.jobnumber = string.empty select pur if unknownjobs.any frmjobs2.jobsbindingsource.datasource = (from j in context.jobs1 order j.jobnumber select j).tolist frmjobs2.purchasesbindingsource.datasource = unknownjobs progress.hide() if frmjobs2.showdialog = windows.forms.dialogresult.ok context.savechanges() end if end if this form gets opened relevant column details displayed the code behind simple , consists of: public class formjobs2 ''' <summary> ''' ok clicked ''' </summary> ''' <param nam

javascript - Determin Type of Input - jQuery -

i needing determine type of element, possibly identified id property of it. for example, in following form... <form id='my-form'> <input type='text' id='title' /> <textarea id='comment'></textarea> </form> i have way identify $('#title') text box. after searches, tried thing this, returns undefined . $('#title').type but thing seems work, don't know why... $('#my-form :input').each( function() { alert(this.type); } ); the above give text , textarea guess. when use first, gives undefined. given id of element, how can find type of it. thank in advance. input normal tag, should use: $('#my-form input').each( function() { alert(this.type); }); this return undefined: $('#title').type because $("#title") jquery object , type property of html element. can html element jquery object this: $('#title').get(0).type

How to append two image tags in div tag using jQuery -

iam trying place 2 image tags different images/src values init, in end 2 image tags have been appended same src value instead of different. may know s wrong append: $("<div/>", { "id": 'card'+i, "class": blockarr[k], html: $("<img src='"+key+"'/><img src='_ls-global/layout-images/layout2.png'/>") }).appendto("#gtable"); any ideas ? thanks you can supply plain html in case: demo $("<div/>", { id: 'card'+i, class: blockarr[k], html: "<img src='"+key+"'/><img src='_ls-global/layout-images/layout2.png'/>" }).appendto("#gtable");

jquery - Closing dialogs in multipage template -

trying work out how close dialog , return calling page (where page div within multipage template). the dialog defaults first page div (back button) or # (x button) - need close , remain on referring page/div. tried this: $('#dialog').live('pagehide', function (e) { $.mobile.changepage("#full-map"); }); but still flick #index before transitioning #full-map. there can intercept close function itself? i trigger dialog so, on clicking google map marker: google.maps.event.addlistener(marker, 'click', function () { $.mobile.changepage("#dialog", { transition: "pop", reverse: false, changehash: false, }); }); you missing role:dialog? full api here $.mobile.changepage( "#mydialog", { role: "dialog" } ); i think keep site scrolling main page, can add button , close dialog javascript instead of relying on default dialog close button. $( "#mydialog&quo

javascript - Execution order of multiple setTimeout() functions with same interval -

consider following javascript code: function(){ settimeout(function() { $("#output").append(" 1 "); }, 1000); settimeout(function() { $("#output").append(" 2 "); }, 1000); } you can see example on jsfiddle . can sure value of #output "one two" , in order? usually, handle problem this: function(){ settimeout(function() { $("#output").append(" 1 "); $("#output").append(" 2 "); }, 1000)); } but can not way because messages server tells me function execute (in example append "one" or append "two" ), have execute small delay. i tested code in internet explorer 9, firefox 14, chrome 20 , opera 12, , output "one two" , can sure case? the spec here . my interpretation of settimeout step 8 in section 7.3 execution order is supposed guaranteed. however, investigated issue because when windo

php - Error using composer in Windows -

i need use composer in windows installed xampp, php 5.4.7. everytime run $ php composer.phar install i keep getting error: [composer\downloader\transportexception] " https://packagist.org/packages.json " file not downloaded: failed open stream: system detected invalid pointer address in attempting use pointer argument in call. what issue ? please.

syntax error - Importing a file with LESS won't see the @filename var -

i'm trying load .less file main theme, filestructure: main.less themes/pink.less themes/yellow.less themes/blue.less i'm using mixin retrieve selected theme: .theme(@filename){ @import 'themes/@{filename}.less'; } .theme('pink'); it doesn't work , error: syntaxerror: variable @filename undefined .theme('pink'); i'm used same background images without getting errors, i'm wrong? unfortunately less.js throws error describe imports .less files (it works fine imports .css files), if define variable in in mixin parameter/attribute, works if define variable directly inside (localy) or outside mixin (globaly). example, should work: @filename: 'pink'; .theme(){ @import 'themes/@{filename}.less'; } .theme(); here link discussion plan of implementing has been discussed while ago , , seems longterm goal have version working well, hasn't happened yet ^_^ however, if want load theme accordin

sql - Selecting a column from table including the default value -

i wonder if can have query gives me values of column including default value column. doable? i dont want use union or joins. for example, have table emp create table emp (emp_name varchar2(20) default 'xxx'); and insert emp(emp_name) values('a'); insert emp(emp_name) values('b'); and when query like select emp_name emp; i want result a b xxx business logic: table emp master table list of employees. in ui screen have oraganization task eg: org_task have ui screen 2 columns, task_name, assinged_employee , assined_employee column not nullable various other reasons. so, when want create new task, enter task, description in column , need choose employee drop down in assined_employee column. in case if task cannot assigned @ point of time of employees, want drop down have default value called tbd. the source dropdown query selects employee names emp table. want append tbd values in dropdown it's not possible using simple sel

Checking for null selection variable value in the command framework of Eclipse RCP -

how can check whether selection variable value null when open editor? i want activate context menu command when editor opened, not dirty , nothing selected user. first 2 coditions working fine: <and> <with variable="activepartid"> <equals value="com.eclipse.someeditor"> </equals> </with> <with variable="activepart"> <not> <test property="com.eclipse.iseditordirty"> </test> </not> </with> <and> my current problem straightforward solution include condition: <with variable="selection"> <count value="0" /> </with> unfortunately when editor first opened, count not 0. null . if user selects , deselects, becomes 0. ideas how check whether value of selection null or similar? update i tried creating property

What is the shortcut to find next occurrence of a word in IntelliJ IDEA? -

in eclipse keyboard shortcut find next occurrence of word in file ctrl + k . finds occurrence of selected word in file 1 one in loop. equivalent keyboard shortcut intellij idea? if not can configure how? first you'll have highlight symbol pressing ctrl + shift + f7 . then press f3 or shift + f3 no navigate between highlighted symbols. when done press esc exit highlight searching. it described on highlightning usages in intellij web help .

Coldfusion Hash SHA-1 Doesnt look the same as the sample -

im working on script hash "fingerprint" communicating secure pay direct post api. the issue have im trying create sha-1 string matches sample code provided can ensure things posted accurately. the example sha-1 string appears encoded like 01a1edbb159aa01b99740508d79620251c2f871d however string when converted appears 7871d5c9a366339da848fc64cb32f6a9ad8fcadd completely different... my code follows.. <cfset variables.finger_print = "abc0010|txnpassword|0|test reference|1.00|20110616221931"> <cfset variables.finger_print = hash(variables.finger_print,'sha-1')> <cfoutput> #variables.finger_print# </cfoutput> im using coldfusion 8 this it generates 40 character hash, can see generating different strings. hopefully out there has done before , can point me in right direction... thanks in advance ** edit the article creating hash contains following information. example: setting fingerprint fields joined | sepa

android - Incorrect stretching of simple 9-patch image to get 1px border on high-res devices -

Image
i want simple 1px border white background 9-patch view in android application. works fine on samsung galaxy tab 730, suprise, result on samsung nexus 10 different: desired result (1px blue border , white background): . actual result (1px blue border , light blue background): the used 9-patch simple: , enlarged: two solutions found worked me: dirty hack: replacing image following bigger image (that not affected rescaling on larger screen device, might affected on larger displays): , enlarged correct solution: moving 9-patch image folder res/drawable-nodpi (see 9patch stretching areas didn't mark ) prevent being rescaled on devices.

casting - cast dynamic object in other type .net -

.net 4 introduced dynamic objects can assign proprieties @ run time. have dynamic object , need cast in type. following code snippet public class eobject : dynamicobject { dictionary<string, object> m_dictfields = new dictionary<string, object>(); private string m_strname; public string name { { return m_strname; } set { m_strname = value; } } public override bool trygetmember(getmemberbinder binder, out object result) { if (m_dictfields.containskey(binder.name)) { result = m_dictfields[binder.name]; return true; } else { return base.trygetmember(binder, out result); } } public override bool trysetmember(setmemberbinder binder, object value) { if (!m_dictfields.containskey(binder.name)) m_dictfields.add(binder.name, value); else m_dictfields[binder.name] = value; return true; } } // assigning properties dynamic object static void main(strin

html - Dynamically created image layout -

Image
using html, css, , jquery, , given set of images various dimensions, how generate image layout resembling below? [note: don't want generate exactly layout - know how construct in html tables , rowspan/colspan (ugly), how programmatically, , nicely?] i have no idea how approach this, html rather box-row-column-based, , sort of stepping out of that. there way @ makes easier program? (perhaps absolute positioning , bashing out computations?) a follow-up question might how avoid problem of inevitably inexact dimensions. fine have below, long everything's lined , square each other. using css position easy way long have static image data here i.e. have images , not change. harm here have calculate positions manually. just make "holder" div , give css position: relative , inner stuff position: absolute : <div id=""holder> <img id="image1" /> <img id="image2" /> . . . </div> css:

html - JavaScript code returning to many digits after decimal -

i have code need number arrives return 1 or 2 digits after decimal not 15 now, here have. function getdiff (dt) { smins = " min"; shours = " hrs"; sdays = " days"; if ( math.abs (datediff ("n", now, dt)) < 1440 ) { if ( math.abs (datediff ("n", now, dt)) <= 60 ) { return (math.abs (datediff ("n", now, dt)) + smins); } else { return (math.abs (datediff ("n", now, dt)/60) + shours); } } else { return (math.abs (datediff ("n", now, dt)/1440) + sdays); } } you can use .tofixed(2) format number 2 decimal places. note .tofixed() returns string if want work result number again, you'll need parsefloat() . function getdiff (dt) { smins = " min"; shours = " hrs"; sdays = " days"; if ( math.abs (datediff ("n", now, dt)) < 1

Prevent jQuery .html() from removing self closing tag slash -

i'm sure of know following: var str = '<img src="path/to/some/image" />' $('#selector').html(str); this output following html: <div id="selector"> <img src="path/to/some/image"> </div> it removes self closing "slash" @ end of img tag because jquery renders true html, not xhtml. my hands tied using cms validates against xhtml markup copied or created in systems wysiwyg must contain "slash" @ end of self closing tag. my predicament using bootstrap form builder create quick , dirty forms. application uses jquery .html() create rendered html. < input > closing tag slashes being stripped. when copy , paste rendered code cms, won't let me published it. anybody have clever way prevent .html() removing "slashes"? or @ least putting slashes in without having manually it? if read the documentation see following text: this method uses browser's

windows server 2008 r2 - Automatic services do not start -

i have handful of console apps installed services running under topshelf , if install , run manually work fine. none automatically start though startup type set automatic. the apps configured follows: hostfactory.run(x => { x.service<myapp>(s => { s.constructusing(name => container.resolve<myapp>()); s.whenstarted(tc => tc.start()); s.whenstopped(tc => { tc.stop(); container.dispose(); }); }); x.runaslocalsystem(); x.startautomatically(); x.enableservicerecovery(rc => rc.restartservice(5)); }); the apps run under win 2008 r2 , installed using batch file executed admin. batch file includes following: app.exe install --sudo app.exe start after executing the batch file services run expected. if reboot remain stopped. the event log returns same pair of events each service: event 7000: service failed start due following error: service did not respon

android - I converted the linear layout into Bitmap image but when saving it in folder the image is empty -

below code. here captures image not saved in specified folder, instead creates empty folder in name. code running fine capturing image not saving view in folder.since new android dont know how solve this. thanx in advance <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/ic_launcher" android:orientation="vertical" > <button android:id="@+id/button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="capture" > </button> <imageview android:id="@+id/imageview01" android:layout_width="match_parent" an

ios - UISegmentedControl titletext is blurry -

Image
i have implemented header view in collection view. uisegmentedcontroll 3 items. here code: nsarray *itemarray = [nsarray arraywithobjects: @"following", @"everybody", @"nearby", nil]; uisegmentedcontrol *segmentedcontrol = [[uisegmentedcontrol alloc] initwithitems:itemarray]; uifont *font = [uifont fontwithname:@"patuaone-regular" size:12.0f]; uicolor *notchosenbuttoncolor = [uicolor colorwithred:(201.0/255.0f) green:(198.0/255.0f) blue:(191.0/255.0f) alpha:1.0]; uicolor *chosenbuttoncolor = [uicolor colorwithred:(235.0/255.0f) green:(218.0/255.0f) blue:(102.0/255.0f) alpha:1.0]; nsdictionary *normalattributes = [nsdictionary dictionarywithobjectsandkeys: font, uitextattributefont, notchosenbuttoncolor, uitextattributetextcolor, nil]; nsdictionary *selectedattributes = [nsdictionary dictionarywithobjectsandkeys: font, u

css - How to pass a code block to a function or mixin in Stylus -

i'm moving sass stylus , have lots of mixins pass in code block accessible inside mixin @content . for example... @mixin respond-min($width) { // if we're outputting fixed media query set... @if $fix-mqs { // ...and if should apply these rules... @if $fix-mqs >= $width { // ...output content user gave us. @content; } } @else { // otherwise, output using regular media query @media , (min-width: $width) { @content; } } } @include respond-min($mq-group2) { & { border: 1px solid green; } } i want convert above code stylus, main problem far been how pass code block mixin stylus doesn't appear have feature. is there alternative solution? any appreciated. this become possible latest release of stylus — 0.41.0, code above written in stylus this: respond-min($width) // if we're outputting fixed media query set... if $fix-mqs

c++ - Trying count distinct strings, whats going wrong -

whats wrong in approach #include<algorithm> #include<iomanip> #include<ios> #include<iostream> #include<string> #include<vector> using std::cin;using std::cout; using std::endl; using std::setprecision; using std::string; using std::streamsize; using std::sort; using std::vector; int main(){ string zz; typedef vector<string> vs; vs input,distinct;vector<int> count; cout<<"enter words"; while(cin>>zz){ input.push_back(zz); } if(input.size()==0){ cout<<"enter atleast single word"; return 1; } int i=0,j=0; sort(input.begin(),input.end()); while(i!=input.size()){ int count2=0; for(j=i;j<input.size();j++) { if(input[j]==input[j+1]) { count2++; }else{ break; } } distinct.push_back(input[i]); coun

jshint active in emacs via flymode, but does not produce any output -

i have install jshint , checked on sample file bash , works. now, when open .js file in emacs , go flymake-mode, message jshint server has started on 127.0.0.13003. now, when enter wrong line of code var var0 = 10 // ok varnx var1 = 10; // wrong jshint sits there , not warn me. thank you!

google drive sdk - Stream video file in GoogleDrive in iOS using MPMoviePlayerViewController -

i working on app requires stream videos on google drive iphone. list files , folders . can display files ppt,docx in uiwebview when pass url of video mpmovieplayerviewcontroller throws error. _itemfailedtoplaytoend: { kind = 1; new = 2; old = 0; } its mp4 video. the video works fine on google drive ios app. has faces issues? thanks in advance nitesh

jquery - Sliding up div overlaps outer div? -

i trying slideup other sub-menu div , fadein current sub-menu while sliding other sub-menu div overlaps outer div. here code : fiddle $(document).ready(function(e){ $(".item").click(function(){ $(this).nextall().children('div').stop().slideup(); $(this).prevall().children('div').stop().slideup(); $(this).children('div').fadein(1000); }); }); why not : see fiddle $(document).ready(function(e){ $(".item").click(function(){ $(this).nextall().children('div').stop().slideup(); $(this).prevall().children('div').stop().slideup(); $(this).children('div').slidedown(); }); });

default - SourceTree: stop remember password -

Image
pulling sources repository needs password. sourcetree remembers password default. don't want sourcetree remember password. i have disable every time! how can disable default behaviour? thanks! i use sourcetree un mac , me, should work same way in windows: open hosted repositories window clicking view > show hosted repositories or command + shift + h. click edit accounts double-click on account click set password

jquery - jCarasole not working -

i unable make jquery jcarousel don't know why. here html markup: <div id="carousel-hl-assistant" class="jcarousel"> <!-- wrapper slides --> <div class="carousel-inner"> <div class="item active hla-b1"> <div class="container"> <div class="col-sm-12 text-center"><h3>hublife cloud hosted centralize data - allowing users access , use accounts anywhere, anytime , on device same <strong><em>simple-to-use</em></strong> , intuitive user experience.</h3></div> <div class="col-sm-12 text-center"> <img src="images/img/hl-cloud.png" class="img-responsive"> </div> </div>

html - Aligning two objects on left one right, on the same level -

how align 2 images equal, on different sides of page? any help? <img src="image1.png" style="float:left"> <img src="image2.png" style="float:right">

colors - Android Camera Parameter - Mono Effect -

hi trying capture images in black , white, while searching google notice android camera has parameter mono effect. i used this: parameters param = camera.getparameters(); param.setcoloreffect(camera.parameters.effect_whiteboard); cameraobject.setparameters(param); but there problem, not black , white, there grey tones also, want 2 colors ! black , white ! there way it? how? thanks alot in advance ! i have found it take monochrome picture (black , white) android if has better/faster solution please tell me :) thanks alot

mschart - Control the width of the column bar in a chart c# -

i using ms chart displaying information , have show different charts when user clicks bar. works totally fine. width totally out of control. looks weird. tried adjust using : series["pointwidth"] = pointwidth.tostring(); but if bars placed far each other. widen drastically making worse. there way can provide constant width bars? and how can calculate width of x axis plane. since width should dynamic per number of bar. have calculate it...any ???? chart1.series[0]("pixelpointwidth") = 2

sql - Mysql variable inside a long query -

i think have problem variable inside mysql query on mysql 5.6: select distinct trim(trailing '.' merge_s.rdata) `content`, '120' ttl, `merge_s`.`pri` `prio`, (select type types type = @type:='mx') `type`, (select id soa concat(substring_index((select @rr:='mina.net'),'.',-2),'.')=soa.origin) domain_id, `merge_s`.`rr` `rr` (`merge_s` left join `merge_s` `db2` on (((`merge_s`.`rr` = `db2`.`rr`) , (`merge_s`.`pri` < `db2`.`pri`) , (`merge_s`.`type` = `db2`.`type`)))) ((`merge_s`.`status` = '1') or (`merge_s`.`type` = 'ns') or (`merge_s`.`type` = 'soa')) , (isnull(`db2`.`pri`) or (`merge_s`.`type` = 'mx')) , (merge_s.type=@type , merge_s.rr=@rr) the query returns correct without rows. same query, replace hands last row (merge_s.type=@type , merge_s.rr=@rr) aspects in variable returns right 2 rows

python - List of lists changes reflected across sublists unexpectedly -

i needed create list of lists in python, typed following: mylist = [[1] * 4] * 3 the list looked this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]] then changed 1 of innermost values: mylist[0][0] = 5 now list looks this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]] which not wanted or expected. can please explain what's going on, , how around it? when write [x]*3 get, essentially, list [x, x, x] . is, list 3 references same x . when modify single x visible via 3 references it. to fix it, need make sure create new list @ each position. 1 way is [[1]*4 n in range(3)] the multiplication operator * operates on objects, without seeing expressions. when use * multiply [[1] * 4] 3, * sees 1-element list [[1] * 4] evaluates to, not [[1] * 4 expression text. * has no idea how make copies of element, no idea how reevaluate [[1] * 4] , , no idea want copies, , in general, there might not way copy element. the option * has make new referenc

jsp - WebApplication not working properly while running Tomcat as service -

i have web application infobase.war created on eclipse , hosted on tomcat (7.0.27) (os: windows server 2003) . index.jsp of application navigates location on network access files , display on webpage (see complete index.jsp code below). the problem application works fine when tomcat run console manually running startup.bat . if tomcat run service (through windows services) application runs fails access files on remote machine , webpage gets displayed error message put such cases (non-access)in code. the tomcat service settings through tomcat7w.exe have been done. heap limit has been increased. the code index.jsp is: <html> <head> <title>infobase </title> <link rel="stylesheet" type="text/css" href="my.css"></link> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ //$("div#

removeall - How to remove everything after certain character in SQL? -

i've got list 400 rows +. each row looks similar this: example-example123 remove past '-' i'm left beginning part: example123 appreciated. you can use sql trim() function select trim(trailing '-' bhexlivesqlvs1-live61mssql) trailing_trim table; the result should "bhexlivesqlvs1"

logging - Enterprise Library 6 LogCallHandler throwing exception "The LogWriter has not been set for the Logger static class" -

guys i'm trying using logcallhandler interception this: <interception> <policy name="policylogcallhandler"> <matchingrule name="logsmachingrule" type="namespacematchingrule"> <constructor> <param name="namespacename" value="nettcpcontracts" /> </constructor> </matchingrule> <callhandler type="microsoft.practices.enterpriselibrary.logging.policyinjection.logcallhandler, microsoft.practices.enterpriselibrary.policyinjection, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" name="callhandlerlog"> <constructor> <param name="eventid" value="9002"/> <param name="logbeforecall" value="true"/> <param name="logaftercall" value="true"/>

ios - Flip layout on iPhone for RTL languages -

here issue : i've localized application in arabic. (it's different regular localization, have different targets, 1 each language). on simulator, view flipped, auto-layout , leading / trailing part of constraints, can't seem same result on device. autolayout + rtl + uilabel text alignment shows example of flipped view on simulator. i've found indication supported in auto-layout guide : « the attributes leading , trailing same left , right left-to-right languages such english, in right-to-left environment such hebrew or arabic, leading , trailing same right , left ». lets me think supposed flip view, on simulator. i use -applelanguages (ar_sa) in scheme on simulator, flips view, fail find proper setting in device same thing. setting language , region format arabic doesn't seem much. on iphone 4s, ios 7.0.4 tldr: setting should change on actual iphone device in « arabic environment » , have flipped view, or missing flips in simulator not on device ?

Retrieve a record that has 2 specific features in SQL -

i have following database of pictures (a picture can have multiple features): table picture ------------- id name 1 mona lisa 2 scream table features ------------- id name pictureid (fk picture) 1 portrait 2 2 expressive 2 3 big 2 4 small 1 5 expressive 1 5 big 1 i'd wish query retrieves pictures portrait , big, (so result in case "scream"). i've come query retrieve it, i'm not sure if prettiest , efficient way it. here's proposal: select * picture o (select count(*) feature c o.id = c.pictureid , c.name '%portrait%') >= 1 , (select count(*) feature c o.id = c.pictureid , c.name '%big%') >= 1 in case, have go through features table twice (which, personal taste, find "ugly"). thanks , regards select picture.name picture join features on picture.id=features.pictureid features.name in('portrait','big') grou

Is there any way through which we can update List records based on specified condition in C#, any customized method will also work except loop -

lststudents.first(m => m.passed == "").passoutyear= currentyear; is there other way update records in bulk above statement updates on first record in list. foreach (var student in lststudents.where(m => m.passed == "")) { student.passoutyear = currentyear; }

objective c - Is there a native Cocoa library to parse eBook metadata information? -

Image
i need metadata info ebook such author, publication date, publisher, plot, etc. formats '.mobi', '.azw', '.azw2', '.azw3', '.epub'. is there cocoa class that? if not, libraries suggest me? i think no, formats have xml based metadata formats, use xml parser like. just unzip file , see inside. example internals of .epub

SQL join one column to many based on condition -

i have 2 tables follows: table a docnumber line amount doctype 1000 1 100 3 1000 2 200 3 1001 1 300 5 table b docnumber debit credit account 1000 100 0 5410 1000 200 0 5560 1001 0 300 6790 i'm trying create select looks this: docnumber line amount account 1000 1 100 5410 1000 2 200 5560 1001 1 300 6790 so, logically, i'm trying figure out way join a.amount b.debit a.doctype = 3 , join a.amount b.credit a.doctype = 5 as can see, i'm novice appreciated assuming sql server. assuming docnumber intended play role in join well, despite not being explicitly stated in question. you can use conditions on join want: select a.docnumber, a.line, a.amount, b.account join b on a.docnumber = b.docnumber , ((a.doctype = 3 , a.amount = b.debit) or (a.doctype = 5 , a.amount = b.cre

javascript - HTML5 Canvas - fillRect() vs rect() -

in code below, second fillstyle overrides color specified in first 1 if use rect() , fill() in both places (ie, both rects green) works expected (ie, first rect being blue , second being green) if change first rect() fillrect() . why so? thought fillrect() rect() , fill() , right? ctx.translate(canvas.width/2, canvas.height/2); ctx.fillstyle = "#5a9bdc"; ctx.fillrect(0, 0, rectwidth, rectheight); // ctx.rect(0, 0, rectwidth, rectheight); // ctx.fill(); ctx.translate(-canvas.width/2, -canvas.height/2); ctx.fillstyle = "#31b131"; ctx.rect(0, 0, rectwidth, rectheight); ctx.fill(); tested in chrome | fiddle fillrect .fillrect "stand-alone" command draws , fills rectangle. so if issue multiple .fillrect commands multiple .fillstyle commands, each new rect filled preceeding fillstyle. ctx.fillstyle="red"; ctx.fillrect(10,10,10,10); // filled red ctx.fillstyle="green"; ctx.fillrect(20,20,10,10); // fille

ios - Testing Facebook App Ads for Installs -

i following guide https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads , i've done explained: added facebook sdk, triggered "app activate" event corresponding app id in app delegate, set info.plist id. when test application through simulator , on testing device open app dashboard -> insights -> app events -> overview , track of "fb_mobile_activate_app" events instantly, incrementing. should have know sdk implemented correctly , can update app on app store without worries , run ads campaign on facebook? asking because things bit confusing on insights -> "mobile app installs" page: this dashboard shows organic , paid app installs reported either facebook sdk ios, facebook sdk android, or mobile measurement partner. dashboard serves as indicator of app install volume, user demographics, , baseline understanding how ads increasing installs of app. developers can use dashboard debugging ensure app installs being recorded.

how ajax site wide browsing works on phpfox? -

i'm trying use ajax wide browsing on phpfox dont understand how works, idea please ? found in static/jscript/main.js code : $core.ajax = function(scall, $oparams) { var sparams = '&' + getparam('sglobaltokenname') + '[ajax]=true&' + getparam('sglobaltokenname') + '[call]=' + scall; if (!sparams.match(/\[security_token\]/i)) { sparams += '&' + getparam('sglobaltokenname') + '[security_token]=' + ocore['log.security_token']; } if (isset($oparams['params'])) { if (typeof($oparams['params']) == 'string') { sparams += $oparams['params']; } else { $.each($oparams['params'], function($skey, $svalue) { sparams += '&' + $skey + '=' + encodeuricomponent($svalue) + ''; }); } } $.ajax( { type: (isset($oparams['type']) ? $o

jquery ajax call to check data from database always return an error - .NET -

i developping functionality whereby users can check if email exist in database( on registration page ). basically testing purposes, have added user email address 'test@yopmail.com' in database manually. i trying check via ajax if email exist. here codes using: [webmethod(messagename = "checkemailavailability", description = "check whether email available.")] public string checkemailavailability(string email) { var checkemailavailabilityresult = string.empty; try { var membershipuser = membership.getusernamebyemail(email); if (!string.isnullorwhitespace(membershipuser)) { checkemailavailabilityresult = "email_already_exist"; } else { checkemailavailabilityresult = "email_not_exist"; } } catch (exception ex) { checkemailavailabilityresult = &qu

svg - math—convert world transform to local transform -

i getting kind of headache… using jsbox2d.js 2d game, based on svg graphics. »connect« b2d-body svg element, works debug draw, not graphics in scene. setup: there svg, including arbitrary nested structure of groups , shapes. each 1 have transformations, each element resides in own coordinate space. aside there box2d simulation , bodies represent element in svg. i apply b2body's transform svg-element represents, animation looks correctly. working debug draw, using code: // links array [[b2body, svgelement],…] (var = 0; < links.length; i++) { var t = links[i][0].gettransform(); //tiny helper function taking values , //setting element // transform(element, a,b,c,d,e,f) //|a c e| //|b d f| svghelper.transform(links[i][1], t.q.c, t.q.s, -t.q.s, t.q.c, t.p.x, t.p.y); } the main difference is, elements used debug draw generated on fly, without transformations, using world coordinates of vertices of b2dshapes. but graphics sce