Posts

Showing posts from July, 2010

ios - Delete Several Substrings from a String in Objective-C, given Ranges of each Substring -

this can considered follow-up question this question how 'delete substring given nsrange'. let's have long string, , delete few characters location 'a', few location 'b', few location 'c' , on. if single location , range, have used like: nsstring *result = [basestring stringbyreplacingcharactersinrange:range withstring:@""]; in case of several locations , ranges, can use loop. inconvenient because have change every other range string size @ every iteration of deleting something. is there simpler way in single iteration? you can delete substrings end of string begin. first delete "c" after "b" , "a". in case don't need recalculate range of remaining substrings.

php - How do I call model function on create event? Laravel-5 -

i'm trying create referral url when user first created. function inside user model looks this: private function make_url() { $url = str_random(40); $this->referral_url->url = $url; if ($this->save()){ return true; } else{ return false; } } within model, i've tried doing didn't work user::creating(function ($this){ $this->make_url(); }) i tried calling in user controller within create user action public function create(userrequest $request) { $data = $request->all() $data['password']= bcrypt($request->input('password')); if($user=user::create($data)) { $user->make_url(); } } i error in return indirect modification of overloaded property app\user::$referral_url has no effect thanks in advance guys =] p.s: if there's better way go creating referral urls please tell me. update my entire user model <?php namespace app; use illuminate\auth\authenticatable; use illu

python - GAE/P: Storing list of keys to guarantee getting up to date data -

in google app engine app, have large number of entities representing people. @ times, want process these entities, , important have date data. there far many put them in same entity group or cross-group transaction. as solution, considering storing list of keys in google cloud storage. use person's email address key name can store list of email addresses in text file. when want process of entities, can following: read file google cloud storage iterate on file in batches (say 100) use ndb.get_multi() entities (this give recent data) process entities repeat next batch until done are there problems process or there better way it? if, in comments, lists change , cant use ancestors (i assume because of write frequency in rest of system), proposed solution work fine. can many get(multi) , wish, datastore can handle it. since mentioned can handle having keys list updated needed, way it. can stream-read big file (say cloud storage 1 row per line) , use data

java - A static method parseInt(char[]) that converts an array of numeric characters to an int value -

this question has answer here: what's simplest way print java array? 23 answers here's code public static int[] parseint(char[] mychar) { int[] myint = new int[mychar.length]; for(int x = 0; x < mychar.length; x++) { myint[x] = (int)mychar[x]; } return myint; } when system.out.println(object.parseint(mychar)); values {'1','2','3'} expect print myint corresponding unicode values {'1','2','3'} . instead [i@15db9742 any ideas on i'm doing wrong? that because printing object, hence java shows: [i - name of type (in case 1 dimensional [ array of int) @ - joins string 15db9742the hashcode of object. the memory address default. can use: system.out.println(arrays.aslist(parseint(array)));

gulp - Why dependency files still included after using Browserify -

Image
all: i pretty new gulp , browserify, did transpile jsx code , browserify them bundle.js file. var gulp = require("gulp"); var browserify = require("browserify"); var source = require("vinyl-source-stream"); var reactify = require("reactify"); gulp.task("default", function(){ browserify({ entries: ["js/app.js"], debug: true }) .transform(reactify) .bundle() .pipe(source("bundle.js")) .pipe(gulp.dest("dist/js/")); }); in app.js, specify few require dependencies(each 1 may require other file), , thought browserify parse them , compile single bundle.js file, when run it, include bundle.js in index.html page, still includes dependency files when check in chrome source tab, i wonder if chrome's feature parse bundle file gives me list of dependency file list or download dependency files well ( confuse can click , open dependency files, guess chrome download

c# - How do I get selected database name from Combo box in a text box when I choose the Path name -

Image
i want database name database selection when select path in database backup... e.g: selected name of database name 'sample' , click browse button , choose path want backup... now, want selected database name sample after location... instance: c:\users\abc\desktop\sample... me selected name of database in text box. code browse button of backup: private void btnbrowseba_click(object sender, eventargs e) { folderbrowserdialog dlg = new folderbrowserdialog(); if(dlg.showdialog()== dialogresult.ok) { txtlocba.text = dlg.selectedpath; } } folderbrowserdialog dlg = new folderbrowserdialog(); if(dlg.showdialog()== dialogresult.ok) { var database = yourdatabasecombobox.selecteditem.tostring(); var extension= "bak"; var databasefilename = string.format("{0}.{1}", database, extension); txtlocba.text = system.io.path.combine(dlg.selectedpath, databasefile

ruby on rails - undefined method `to_model' for 1:Fixnum -

artist/show.html.erb <% if @artist.songs.any? %> <div class="col-md-8"> <% @artist.songs.each |song| -%> <span><%= link_to song.title, song.artist %></span> <% end -%> </div> <% end %> routes.rb resources :artists, :path => "/music", only: [:show] resources :songs, :path => "/", only: [:show] end artist controller class artistscontroller < applicationcontroller def show @artist = artist.friendly.find(params[:id]) end end song controller class songscontroller < applicationcontroller def show artist = artist.friendly.find(params[:artist_id]) @song = artist.songs.find(params[:id]) end end artist model class artist < activerecord::base extend friendlyid friendly_id :name, use: :slugged has_many :songs, dependent: :destroy validates :name, presence: true, length: { maximum: 50 }, uniquene

forms - c# add label from form2 -

form2 code: public void button2_click(object sender, eventargs e) { form1 form1form = new form1(); label asd = new label(); asd.text = "asdasasdasdasd"; form1form.controls.add(asd); form2 form2form = new form2(); form2form.close(); } i want add new label , button on form1 form2 how made ? thanks if want access form1form form2form must have public reference form1form . declare property in form1form below: public static form1form instance { get; private set; } then set instance in load event of form1form : private void form1form_load(object sender, eventargs e) { instance = this; } in form2form : public void button2_click(object sender, eventargs e) { label asd = new label(); asd.text = "asdasasdasdasd"; form1form.instance.controls.add(asd); }

format - Switch statement doesn't change value android -

i have imageview , button , onclick want set different types of display (full screen, square, , other vertical format), have switch statement doesn't work don't know doing wrong, please me, maybe easy question still cant find solutions in google, private int format; private void changeformat(){ switch (format) { case 0: format = 0; system.out.println("format " + format); formatfullscreen(); break; case 1: format = 1; system.out.println("format " + format); formatsquare(); break; case 2: format = 2; system.out.println("format " + format); formatvertical(); break; default: format = 0; system.out.println("format " + format); formatfullscreen(); break; } } button.setonclicklistener

converting C# Lists (more than one) to JavaScript Associative Arrays -

i after this: i have multiple lists in c# so: list<string> names = new list<string>() { "name1", "name2", "name3" }; list<double> values = new list<double>() { 1, 2, 3 }; i want serialize them array in javascript (i looking return string) this: [ { name: "name1", value: 1 }, { name: "name2", value: 2 }, { name: "name3", value: 3 } ] so far have tried this: public class bmdata { string _name; public string name { { return this._name; } set { this._name = value; } } double _value; public double value { { return this._value; } set { this._value = value; } } } zip them , wrap "data item" class. want keep functionality other reason. zipped key value pairs new class: list<bmdata> namesvalues = names.zip(values, (x, y) => new bmdata{name = x, value = y}).tolist(); finally tried se

caching - How to lazily build a cache from spark streaming data -

i running streaming job , want build lookup map incrementally( track unique items, filter duplicated incomings example), thinking keep 1 dataframe in cache, , union new dataframe created in each batch, items.foreachrdd((rdd: rdd[string]) => { ... val uf = rdd.todf cached_df = cached_df.unionall(uf) cached_df.cache cached_df.count // materialize ... }) my concern cached_df seems remember lineages previous rdd s appended every batch iteration, in case, if don't care recompute cached rdd if crashes, overhead maintain growing dag? as alternative, @ beginning of each batch, load lookup parquet file, instead of keeping in memory, @ end of each batch append new rdd same parquet file: noduplicateddf.write.mode(savemode.append).parquet("lookup") this works expected, there straight forward way keep lookup in memory? thanks wanchun appending parquet right approach. optimize lookup. if okay

python - How do I override requirements in PBR? -

i'm trying package python code pbr (python build reasonableness). generates requirements metadata through set of conventions. the requirement files tried in order (n being python major version number used install package): requirements-pyn.txt tools/pip-requires-py3 requirements.txt tools/pip-requires in directory, need have requirements.txt convention it's needed docker container has different set of requirements published target. want keep both docker image generation , python package building in project because have common files. how specify requirement such requirements-pbr.txt , override fact pbr pull in requirements.txt ? after rooting through pbr source, found can change through environment variable. should it. pbr_requirements_files="requirements-pbr.txt" python setup.py sdist

git - Forking a repo on Github, and then saving it in another repo's private folder -

it's class project, , supposed fork project, , save in class folder (which private repo). mean there "2" repos, fork kind of untouched, , changes happen in private repo? i ended using git clone of fork appropriate folder, i'm worried might kind of redundant , i'll have 2 folders rather 1 of forked repo? don't forget "fork" in github sense clone on server side . done because don't have right push directly original repo (which don't own). if fork done on server, end 2 new repos, 1 fork, 1 class folder. once assignment completed in class folder (shared repo class collaborate), can push fork (which own , have right push to), , make pr (pull request) there.

javascript - How to start page at center of center or at specific height after load -

i want start page @ center horizontally , vertically when had loaded (not @ top), suggestions? or @ specific height if possible. thank you! you can this: $(document).ready(function() { $(window).scrolltop($(window).height()/2); $(window).scrollleft($(window).width()/2); }); you can change position suit needs. also can use $(window).scrollto($(window).width()/2, $(window).height()/2);

javascript - How to add Time Timestamp to DateTime Timestamp? -

Image
i having project have time duration service have converted strtotime , also, have datetime picker have converted strtotime, in data base, so, using calendar https://github.com/almasaeed2010/adminlte , now, here problem, in calendar sample there code { title: 'long event', start: new date(y, m, d - 5), end: new date(y, m, d - 2), backgroundcolor: "#f39c12", //yellow bordercolor: "#f39c12" //yellow }, what trying accomplish service duration,let's duration 2 hours converted strtotime, how can add timestamp of datetime? these code , screenshot below, can see, result wrong since appoint_end 2 hours appointment displayed days, events: [ <?php $event_query = mysql_query("select * appointment,service,user appointment.user_id = user.user_id , service.service_id = appointment.service_id")or di

Keyboard shortcut to disable Javascript on Chrome? -

i doing testing on page , need disable javascript keyboard shortcut. my problem test involves popups on screen in chrome asking confirmation, if possible me disable javascript @ will, past trail of popups come on these test pages. knows way? if @ global level? if using mac, try create keyboard short cut. system preferences > keyboard > keyboards shortcuts > application shortcuts now need find exact command in language. a full tutorial here: https://computers.tutsplus.com/tutorials/how-to-set-up-custom-keyboard-shortcuts-on-your-mac--mac-176 i haven't tested procedure disabling js found barmar's hint quick java script switcher plugin super useful.

data visualization - Recreate graph gradient colors in R -

Image
i'm looking create high quality data visualization in r , i'm not sure how create of gradient colors in in bar graph below (full link here ). i believe ggplot can gradient fills, in case, i'd need stacked color , background color, both of light grey-to-orange gradient. can't find command that. column widths have full , dark grey border. (i don't need symbols). what ggplot (or other) command replicate design? direction. hoping can recreate of favorite designs in r.

unity3d - How to move an object without going through colliders -

i'm using unity , doing pong game. able move paddles mouse key. have tried moving position of course "teleport" them through colliders along edge of playing field. tried using addforce() , making rigidbody fixed in x position, however, happens when ball hits paddle, pushes , paddle snaps back. of ball's energy lost (there gravity in game). how can move box collider not let on lap other box colliders while moving? thanks!!! your paddle should kinematic (iskinematic parameter) rigidbody (attached rigidbody2d) collider while edges should static collider. but, should control limits/edges of paddle movement within script. if things way, ball naturally bounce of edges , off paddle. if, however, want ball pass through edges notify of doing (e.g. lose condition), should make edges static trigger collider (istrigger parameter). here's detailed list interactions between different types of colliders: http://docs.unity3d.com/manual/collidersoverview.html .

math - How to determine error in floating-point calculations? -

i have following equation want implement in floating-point arithmetic: equation: sqrt((a-b)^2 + (c-d)^2 + (e-f)^2) i wondering how determine how width of mantissa affects accuracy of results? how affect accuracy of result? wondering correct mathematical approach determining is? for instance, if perform following operations, how accuracy affected after each step? here steps: step 1 , perform following calculations in 32-bit single precision floating point: x=(a-b), y=(c-d), z=(e-f) step 2 , round 3 results have mantissa of 16 bits (not including hidden bit), step 3 , perform following squaring operations: x2 = x^2, y2 = y^2, z2 = z^2 step 4 , round x2, y2, , z2 mantissa of 10 bits (after decimal point). step 5 , add values: w = x2 + y2 = z2 step 6 , round results 16 bits step 7, take square root: sqrt(w) step 8 , round 20 mantissa bits (not including mantissa). there various ways of representing error of floating point numbers. there relative error

javascript - Adding directive scope makes the rest non-updateable -

there's directive called foo defined this: <div ng-app="app" ng-controller="maincontroller"> {{ name }} <foo param="123"></foo> </div> and here's relevant initialization fragment: var app = angular.module('app', []); app.controller('maincontroller', function($scope){ $scope.name = 'initial name'; }); app.directive('foo', function(){ return { restrict : 'e', controller : function($scope){ $scope.name = 'name defined in directive'; console.log($scope.param); // undefined } }; }); that works expected , overrides initial name name defined in directive . however, since there's param attribute wanted access value. did 1 way binding this: return { restrict : 'e', controller : function($scope){ $scope.name = 'name defined in directive';

java - Trying to create a dice in Processing but clicking is not triggering it -

i want make program show face of die after click in rectangle says "roll" when click, nothing happens. can explain i'm doing wrong? import java.util.random; public random random = new random(); public color purple = #b507f5; public int dicechoose = random.nextint(6); public int x = mousex; public int y = mousey; public void setup() { size(750, 900); background(255); } public void draw() { strokeweight(3); //dice roll button rect(100, 700, 550, 150); textsize(100); fill(purple); text("roll", 280, 815); nofill(); //dice face rect(100, 100, 550, 550); roll(); } public void one() { fill(0); ellipse(375, 375, 100, 100); nofill(); } public void two() { fill(0); ellipse(525, 225, 100, 100); ellipse(225, 525, 100, 100); nofill(); } public void three() { fill(0); ellipse(375, 375, 100, 100); ellipse(525, 225, 100, 100); ellipse(225, 525, 100, 100); nofill(); } public void four() { fill(0); ellipse(5

c# - How do i solve the exception of missing dll ? The dll file is in the directory -

Image
this line: boolean bl = initializedirectx(mypb); and initializedirectx method use directx: public boolean initializedirectx(picturebox pb) { dispmode = manager.adapters[manager.adapters.default.adapter].currentdisplaymode; d3dpp = new presentparameters(); d3dpp.backbufferformat = dispmode.format; d3dpp.presentflag = presentflag.lockablebackbuffer; d3dpp.swapeffect = swapeffect.discard; d3dpp.presentationinterval = presentinterval.one; //wait vertical sync. synchronizes painting //monitor refresh rate smoooth animation d3dpp.windowed = true; //the application has borders try { d3ddev = new device(manager.adapters.default.adapter, devicetype.hardware, pb.handle, createflags.softwarevertexprocessing, d3dpp); d3ddev.vertexformat = customvertex.pos

windows runtime - WinRT: List box does not select previous item on Up key -

when vertical list box item selected, pressing down key selects next item, pressing key has no effect! can list box selecting previous item on key? for selecting previous item listbox needs have focus. after focus set on listbox select previous items well.

html - ASP.Net: Fail to put <script> inside <head> -

i put <script> inside <head> tag in master page. rendered result in browser, put @ bottom of <body> . rebuilding application doesn't work, neither cleaning browser cache. idea? thanks. <head><script type="text/javascript">alert();</script></head> you can use appendchild add script head . this: document.getelementsbytagname('head')[0].appendchild(script); edit: as mentioned in comments , here take @ this article: it provides nice clean way add script head element using extension method.

android - MPAndroidChart conditional dataset color -

hello folks: wondering if there better way conditional coloring bars using mpandroidchart. solution create conditional array of colors follows: private void setdatacolored(list<string> labels, list<float> values) { final int greencolor = color.parsecolor("#66bb6a"); final int redcolor = color.parsecolor("#ef5350"); arraylist<barentry> entries = new arraylist<>(); list<integer> colors = new arraylist<>(); (int pos = 0; pos < values.size(); pos++) { float value = values.get(pos); entries.add(new barentry(math.abs(value), pos)); colors.add(value >= 0 ? greencolor : redcolor); } bardataset dataset = new bardataset(entries, "values"); dataset.setcolors(colors); arraylist<bardataset> datasets = new arraylist<bardataset>(); datasets.add(dataset); bardata data = new bardata(labels, datasets); data.setdrawvalues(true); mchart

javascript - smoothState.js - Identifying the referring page -

when clicking on link smoothstate loads new page's content, i'd identify referring page class visible on new page. there way this? this isn't dynamic solution, ended doing setting classes anchor tags on referring page. smoothstate has onbefore() callback, passes $currenttarget, i.e. anchor element clicked start transition. read href off anchor element , detect want way (or store off somewhere until later). so in html, declare link so: <a href="new_page.html" class="special_case">new page</a> then when i'm setting smoothstate, declare onbefore() callback: onbefore: function( $currenttarget, $container ) { if ( $currenttarget.is( ".special_case" ) ) { // logic here globalspecialcase = true; } } since smoothstate keeps in same place , ajax call request new page html, swaps out page content, current javascript environment remains, global variables , all. set global flag (or make whatever data st

android - Store async data in recycler view -

i have main activity in have used view pager.so can move between 4 tabs , view pager handles of that.one of tabs scans contacts on phone details , display in recylerview in same tab,this task takes long time , doing in async task.everything working fine problem if move tab while scanning going on data not applied recycler view possible because fragment being destroyed. there workaround or should prevent user shifting tabs while scanning going on (if sort of code or link code helpfull). i wouldn't recommend force user stay on page whilst data loads. sounds frustrate people. end, have couple of ideas should keep asynctask running whilst fragment isn't visible. first, call setoffscreenpagelimit(2) on viewpager . have 4 fragment s, should mean of them stored in memory. viewpager.setoffscreenpagelimit(2); another approach may able create ui-less fragment sole function conduct asynctask , then, once reaches onpostexecute() , pass cursor result fragment requi

Is it possible to find and upload a particular list of files using JQuery or JavaScript? -

i'd make routine finds predetermined amount of files found in same location, , have same filenames. possible find these files , upload them webserver, minimal user intervention? ideally, i'd want user click button once, find these files locally , upload them webserver. going use form , make user click "search file" window each file, need upload 20 small files @ same time, approach quite time consuming. any pointers or ideas? is possible find these files , upload them webserver, minimal user intervention? user should select user files user filesysystem @ each user action @ input type="file" element . user selected files should accessible @ filelist object within onchange event . if files saved @ same directory , , browser supports directory attribute , user should able upload user selected folder. chrome, chromium allow folder upload when webkitdirectory attribute set ; firefox not allow folder upload currently, though user c

php - mysqli::real_connect(): (HY000/2002): Connection refused on Live -

i create web site using php, mysql, , codeignater version 3. host on ipage. when upload on live make changes in config file. $db['default'] = array( 'dsn' => '', 'hostname' => '66.96.147.118', 'username' => 'bit_root', 'password' => 'root', 'database' => 'bit_shilp', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => false, 'db_debug' => (environment !== 'production'), 'cache_on' => false, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => false, 'compress' => false, 'stricton' => false, 'failover' => array(), 'save_queries' => true ); i

visualization - Visualize polyhedron with colored edges -

i want visualize 3d polyhedron consists of polygons (not triangles) , in parts coloured: facets, edges , vertices. possible in polyhedron format? stanford ply format support edge colours, failed find visualization program supports edges colouring in ply format. example, paraview can color facets, can't color edges if input ply file contains colored edges. no, there no such option. after long investigation have found no way color edges in paraview. workaround create additional colored thin facets near edges needed colored.

python - update all minimums in list to the next minimum -

how increment numbers in python list such current minimums in list updated. example: a = [15,15,14,12,10,10,10] i have number x=12 need optimally allocate array such maximal minimum, ie, first give 2,2,2 each 10 2,2,2 3 12s. , final list looks this: a = [15,15,14,14,14,14,12] to update minimums in list next minimum can use following approach. first determine smallest value using python's min function. calculate second smallest iterating on each of values. possible use list comprehension update value less second smallest value second smallest value: import sys = [15,15,14,12,10,10,10] smallest = min(a) second_smallest = sys.maxint # largest possible allowed integer x in a: if smallest < x < second_smallest: second_smallest = x a[:] = [second_smallest if x < second_smallest else x x in a] print this displays following: [15, 15, 14, 12, 12, 12, 12]

javascript - Pinterest redirect uri not working -

i'm trying use pinterest apis fetching information. in order access that, need access token can returned using pinterest javascript sdk, pdk. refer this i'm able integrate in web app when trying fetch token, gives me following response: {"status": "failure", "code": 7, "host": "coreapp-ngapi-prod-cc8abc1f", "generated_at": "sat, 03 oct 2015 08:05:09 +0000", "message": "you not permitted access resource.", "data": "the provided redirect_uri not match of registered redirect uris."} also, on looking @ pinterest app have created, seems redirect uris field empty though gave redirect uri during intitial registration. if try update field, there no option of save changes. can please tell me work around ? also, have tried using basic site url in redirect params , https still no help. thanks so it's not obvious in interface how set uris -- need press enter

android - ListView in OnpostExecute and display respective info -

sir have written code custom list view perfectely fine want write code onitem click listenet in onpostexecutemethod , show respective info according ticket. want show ticket info of selected item. class viewticket extends asynctask<string, void, string> { @override protected void onpreexecute() { super.onpreexecute(); pdialog = new progressdialog(userlogedin.this); pdialog.setmessage("loading...."); pdialog.setindeterminate(false); pdialog.setcancelable(false); pdialog.show(); } @override protected string doinbackground(string... params) { list<namevaluepair> param = new arraylist<namevaluepair>(); param.add(new basicnamevaluepair("userid", u_id)); // jsonobject jsonarray = jpar.makehttprequest(urlmyticket, "post", param); servicehandler sh = new servicehandler(); string jsonstr = sh.makeservicecall(urlmyticket, servic

vba - Excel charts pastespecial format -

excel offers possibility paste chart format chart (in chart sheet) through pastespecial. recording procedure macro gives following code: sub macro4() activechart.chartarea.select activechart.pastespecial format:=2 end sub trying run fails (method not found). i referring here chart sheet , not embedded chart. please advise.

php - After deleting/changing a specific CSS part ERR_TOO_MANY_REDIRECTS occurs -

Image
a few days added overlaying gradient effect 1 of pages. wrote directly between 2 <style> tags testing index.php . wanted copy .css file whenever delete or change following part file site not accessible anymore because of err_too_many_redirects error. this ist part causing problem (notice: css works find. can't delete anymore source file without causing errors): gradient { position:absolute; z-index:2; right:17px; bottom:25px; left:17px; height:125px; /* adjust needs */ background: url(data:image/svg+xml;base64,alotofcodehere); background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 70%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(70%,rgba(255,255,255,1))); background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 70%); background: -o-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 70%); background: -ms-linear-grad

checking for name of Pandas dataframe as a condition -

when want check pandas dataframe being called, how use dataframe name in if condition? i keep getting "the truth value of dataframe ambiguous...." , can't figure out way around it. df_even = pd.dataframe( data=[2,4,6,12,64,866,222]) df_prime = pd.dataframe( data=[5,7,11,13,17,19]) df_list = [df_even, df_prime] frame in df_list: if frame == df_even: name = 'even' elif frame == df_prime: name = 'prime' # dataframe next since you're testing identity, should use is opertator. note distinction between equality, i.e. logical values of 2 objects same, , identity, i.e. same object , i.e., 2 names refer same address in memory. if frame df_even: ... your original code isn't working because pandas overrides == operator perform value-by-value comparison (rather dataframe-level comparison). special override not returning boolean == ordinarily does. more == vs is .

html - How to stop an element from appearing outside it's parent division? -

i have division class "centre" inside division called "parallaxone". css, if view in laptop, showing divisions properly, if view in mobile phone, "centre" division appearing outside "parallaxone" division, , in other browsers, appearing in front of text. why happening, , how correct it? here code: .centre { position: absolute; top: 75%; left: 50%; transform: translatey(-15%); width: 0; height: 140px; border-left: 6px dashed #0079a5; } .arrow { position: absolute; top: 0; left: -6px; height: 40px; width: 6px; background: #007; animation: animate 2s infinite; } .arrow:before { content: ''; position: absolute; bottom: 0; left: -10px; width: 20px; height: 20px; border-bottom: 6px solid #007; border-right: 6px solid #007; transform: rotate(45deg); } @keyframes animate { 0% { transform: translatey(0); opacity: 0.5; } 50% { trans

NIFI:Configuring Cron sheduling -

i want use cron sheduling in invokehttp , generateflowfile processors , use expression * 57 12 1/1 * ? * ti start workin @ tiem see invokehttp processor starts work @ 12:57 minutes , processing flowfiles in flowfile queue result doesn't process flowfiles generated after 12:57 . should force work usual( mean processing flowfiles after 12:57 too) ?

r - how I can make a plot with two variable like the one in the picture -

Image
i have data frame i want make plot ggplot2 which function should use? or name of plot this give similar plot. library(ggplot2) library(ggrepel) #sample data df <- data.frame(age_range = c('m.25-34', 'm.18-24', 'm.13-17', 'f.25-34', 'f.18-24', 'f.13-17'), count = c(3356, 2071, 15, 5619, 4342 ,29)) #pre-process dataframe can used ggplot2 df$sex <- gsub('(\\s).*', '\\1',df$age_range) df$age <- gsub('\\s{2}(.*)', '\\1',df$age_range) #plot ggplot(df, aes(x= age, y= (count/sum(count))*ifelse(sex=="f",1,-1), fill=sex)) + geom_bar(stat="identity", position = "identity") + geom_text_repel(aes(y = (count/sum(count))*ifelse(sex=="f",1,-1), label=paste0(round(count/sum(count)*100, digits = 2),"%"))) + ylab("your fans") + ggtitle("the people page") + theme(axis.text.y=element_blank()) hope

php - How to get contact form 7 field value in mail? -

this form created on contact form 7. on mail option option choose field values want receive on email. used drop down list tag , pipe drop down thing , pick amount every time picks display value. how can send data of selected amount field mail. need create custom tag ? <label> mobile number </label> [tel* tel-385 id:mobile] <label> amount </label> <select name="amount" id="amount" aria-invalid="false"> <option value="30">30 pesos $1.00</option> <option value="100">100 pesos $2.70</option> <option value="200">200 pesos $5.20</option> <option value="300">300 pesos $7.60</option> </select> [paypalsubmit email:###### itemamount:amount "send load"] the fix quite simple .just create drop down list using tag ..and copy complete html drop down code .directly put on contact form 7 .

openerp - How partial payment hit accounting statements in odoo 10 Using Point Of sale? -

as have purchased pos_partial_payment module found incomplete requirement need modify / add new functionality it. perform partial payment (remaining credit amount) there not changes accounting. example such partial paid amount not showing in accounting , not changing account recieivable cash journal. @api.one def pay_partial_payment(self, amount): # comment method because don't want generate payment accounting entry, if want uncomment it... print "partnerrrrrrrrrrrrrrrrrrrrrrr id",self print "****************codeeeeeeeeeeeeeeeeeeeeeeeee",amount #finding recivble print "id of account rec account",self.property_account_receivable_id.id lines = [] partner_line = {'account_id':self.property_account_receivable_id.id, 'name':'/', 'date':date.today(), 'partner_id': self.id, 'debit':float(amount), 'credit':0.0, } lines.ap

javascript - If product in cart, on refresh stay at the top of front page. Woocommerce -

my problem... i've created woocommerce page checkout @ bottom of front page, i've created select quantity pick, when user select it, ajax sends add_to_cart url , display new quantity , price in checkout form via .empty.append(). i've added couple of functions if there's empty cart should automatically add 1x product in cart , if there new qunatity added delete old 1 , add new. everything works ok far, when product added cart , refresh page won't stay @ top of page or pointing before refresh. point bottom -> checkoutform. i know function have or should edit stay @ top of page or pointing before refresh when product in cart.

javascript - How can I re-enable a text field? -

i trying re-enable text field gets automatically filled in , disabled on website use ticketing. possible inspect element, , enable manually field enter want. i'd remove step. trying make (very) simple chrome extension detect when field has been disabled , switch on, i'm having no luck. i've tried several iterations, no success. here's i've got @ moment. var subject = document.getelementbyid('title_fs'); subject.onchange = function() {fix()} function fix(){ subject.setattribute("enabled", true)} i tried var subject = document.getelementbyid('title_fs'); subject.addeventlistener("change", {subject.setattribute("disabled", false)}); the success i've had far accidentally disabling field page loaded. suggestions? simply remove attribute document.getelementbyid('title_fs').removeattribute('disabled'); document.getelementbyid('removedisabled').addeventlistener('

Take photo in background without UI. Android -

i'm looking code take pictures in background , save bitmap. did research , found this: https://stackoverflow.com/a/17859926/7391954 kinda works freezes ui if call takepicture worker thread , cannot take photos faster 1/sec (i'd 3/sec). can me @ this? you can use surfaceviewe . take @ document surfaceview

java - Spring JPA - How to force custom order of repository calls within a transaction -

using spring data jpa 1.11.6.release, have following trouble; with simple 1-to-n relationship between them, have tablea , , tableb , a contains multiple b . , have repository of tableb custom delete method; public interface brepository extends jparepository<tableb, string> { @modifying void deletebytablea(tablea tablea); } where deletes fk value, pk of tablea in service class, use these; @service public class theservice { @autowired private arepository arepository; @autowired private brepository brepository; @transactional public void deleteinsert(list<tableb> blist) { tablea tablea = arepository.findbyetc(...); brepository.deletebytablea(tablea); brepository.save(blist); } } but issue order of operations inside @transactional method changes according optimization done hibernate. causing unique constraint violations, in case have duplicate entities of tableb exist in new table. if put breposit

Java- Wrapping a function in another class function -

i want check if java code oop enough, say have class called shop , inside class have method called getaverageearnings i have class called simulator , inside have wrapper function wrap shop class getaverageearnings i have hide shop class user. eg: public class shop{ public double getaverage(){ return (this.total/5); } } public class simulator{ shop shop; public simulator(){ shop = new shop(); } public double getaverage(){ return shop.getaverage(); } } is practice or bad practice in terms of oop-ness? as far understand question is, want call method of shop class simulator class don't want shop involve in outer world. right. if case, suggest follow below steps design module. i) declare shop abstract, because have tightly coupled logic in , create protected method getaverage. ii) extend shop in simulator or fragment class , call getaverage supper method. hope help.

php - How to pass textbox value to another modal -

i want pass value of textbox (the value of order_id, more specific) ordermodal.php ordermodal2.php use query. this code ordermodal.php include_once 'ordermodal2.php'; /** *ordermodal.php **/ $id = ""; $order_date = ""; $order_time = ""; $order_id = ""; $order_delivercharge = ""; $order_status = ""; $order_totalamount= ""; $coordinates = ""; $driver_number = ""; $address = ""; $food_name=""; $special_request=""; $quantity=""; $amount=""; $orders=""; ?> <!-- modals --> <!-- details --> <div id="mymodal" class="modal fade" role="dialog" style="z-index: 1400;"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <form action="" meth

arrays - PHP data collection - use class construct to replace numerical key with string ident -

i experimenting data collection objects , want use class construct make changes array keys of arrays passed newly instantiated object. the main idea arrays can passed numerical keys , each numerical key replaced string value. system predicated on fact arrays single array of array each containing 3 key/value pairs. (see data example). know fragile , intend address issue next. class: class newscollection { private $collection; public function __construct($data) { foreach ($data[0] $key => $value) { switch ($key) { case 0: // replace key id string ie. 0 "headline" break; case 1: // replace key id string ie. 1 "date" break; case 2: // replace key id string ie. 2 "author" break; } } $this->collection = $data; }

c# - BLOB Data retrieval in table form -

mysqlconnection con= new mysqlconnection("server=localhost;database=databasename;user=username;password=password"); string query="select *from table"; using (mysqldataadapter adpt= new mysqldataadapter(query,con)) { dataset dset= new dataset(); adpt.fill(dset); mytabledatagridview.datasource=dset.tables[0]; } con.close the following code can retrieve data of varchar , int, don't retrieve blob kind of data ....plzz give solution blob can read method or other method downloadable file mode the blob data should read database byte array. should it: filestream fs = new filestream(filepath, filemode.open, fileaccess.read); binaryreader br = new binaryreader(fs); byte[] photo = br.readbytes((int)fs.length); br.close(); fs.close(); i took code here: https://www.akadia.com/services/dotnet_read_write_blob.html . note load blob memory stream instead of filestream if wanted display blob on screen e.g. if photo.

c++ - Fill edges and center of array/vector with different values -

i create function initializes vector or array of size width * height , creates border around these values. the values around outside need initialized different value ones in center. the objects storing not have default constructor, cannot rely on initialization. this code have far, feels there should simpler or more idiomatic way of doing this. i can use features , including c++1z. #include <iostream> #include <vector> void fill_values(const unsigned width, const unsigned height, std::vector<int> &values) { for(unsigned y=0; y<height+2; ++y) { for(unsigned x=0; x<width+2; ++x) { if(x==0 || x==width+1 || y==0 || y==height+1) { values.push_back(1); } else { values.push_back(0); } } } } int main(int argc, char *argv[]) { const unsigned width = 4; const unsigned height = 3; std::vector<int> values; fill_values(width, height, values);