Posts

Showing posts from March, 2014

vb.net - Dex Algorithm Overflow Exception -

i trying develop encryption algorithm using dex . seems getting exception regarding byte overflow , have tried changing cint , gives same error. details: system.overflowexception occurred hresult=0x80131516 message=arithmetic operation resulted in overflow. source=windowsapp1 stacktrace: @ windowsapp1.shitcrypt.cryptoclass.dexencrypt(byte[] byte_0, string string_0) in c:\users\jij\documents\visual studio 2017\projects\windowsapp1\windo public shared function dexencrypt(byte_0 byte(), string_0 string) byte() 'fonction de cryptage dim bytes byte() = encoding.ascii.getbytes(string_0) double = 0 4 j double = 0 byte_0.length - 1 byte_0(j) = byte_0(j) xor bytes(j mod bytes.length) k double = 0 bytes.length - 1 byte_0(j) = cbyte(clng(byte_0(j)) xor (clng(clng(bytes(k)) << (i , 31)) xor k) + j) next next next return byte_0

read from json (string) android with Gson -

its json file {"visitorslist":[{"visitorid":"09005451","visitorname":" xxxx","visitorphon":"","visitoraddr":"xxxx","geocode":"","autokey":1},{"visitorid":"09005468","visitorname":"xxxxxx","visitorphon":"09005468","visitoraddr":"xxxx","geocode":"","autokey":2}]} and wanna read , show information file listview my visitorslistactivity is: public class visitorslistactivity extends appcompatactivity { public listview lstvisitors; static visitorslist visitorslist; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.visitor_list); try { //********************************** comelete section ********************************************* new jsonhelper.ge

c# - XtraTabbedMdiManager Layout (Tile Vertical, Tile Horizontal. Tile Cascade) -

i have ribbon form 3 button.. want change tabbed child form become vertical, horizontal, or cascade... there how ? if using frmmain property ismdicontainer=true private void btn1_itemclick(object sender, devexpress.xtrabars.itemclickeventargs e) { form1 frm1 = new form1(); frm1.mdiparent=this; frm1.show(); } private void btnvertical_itemclick(object sender, devexpress.xtrabars.itemclickeventargs e) { layoutmdi(mdilayout.tilevertical); } private void btnhorizontal_itemclick(object sender, devexpress.xtrabars.itemclickeventargs e) { layoutmdi(mdilayout.tilehorizontal); } private void btncascade_itemclick(object sender, devexpress.xtrabars.itemclickeventargs e) { layoutmdi(mdilayout.cascade); } the question is, how change layout when press btnvertical change layout to make layoutmdi method work, remove xtratabbedmdimanager form or nullify xtratabbedmdimanager.mdiparent property because mdilayout mode not applicable xtratabbedmdim

angular - ngbPopover with html inside -

is possible put html inside ngbpopover? exactly, need put list of items. have parameters: `ngbpopover="{{column.popup.get(row)}}" triggers="mouseenter:mouseleave" popovertitle="{{column.popup.title | translate}}" container="body"` yes, need use <ng-template> element so: <ng-template #popcontent>hello, <b>{{name}}</b>!</ng-template> <button type="button" class="btn btn-secondary" [ngbpopover]="popcontent" popovertitle="fancy content"> i've got markup , bindings in popover! </button> here working plunker: http://plnkr.co/edit/re1jbpmif11qm3pf3btw?p=preview this documented on out demo page: https://ng-bootstrap.github.io/#/components/popover/examples

javascript - Error-notice on blog-page from Content Aware Sidbars plugin -

i'm using genesis lifestyle pro child theme. url: https://www.test.rainerklar.de/blog-fuer-verjuengung-und-gesundheit/ on blog-page showing posts excerpt see error-notice on top of header: notice: array string conversion in /home/jungvita/public_html/test/wp-content/plugins/content-aware-sidebars/lib/wp-content-aware-engine/core.php on line 312 if use sidebar-plugin or not page error visible , needs fix. page should have standard primary sidebar. tried work without plugin page, , plugin setting "posts" page-type, without else definition. here code of line 312 , 313: $data = "({$id}.meta_value null or {$id}.meta_value in ('".implode("','",$data) ."'))"; } edit: debug-plugin got notice: notice: wp-content/plugins/content-aware-sidebars/lib/wp-content-aware- engine/core.php:312 - array string conversion require('wp-blog-header.php'), requir

Laravel Eloquent - Order users relationship by a method on the user model -

i'm working on api endpoint laravel spark. this endpoint returns given team along users. // in app\team public function users() { return $this->belongstomany( 'app\user', 'team_users', 'team_id', 'user_id' )->withpivot('role'); } however, wish order users method on user model. on app\user model have method: public function currentqueuelength() { returns integer based upon users current appointments, } is there way can return users relationship order users result of method? if add current_queue_length attribute user model, can order attribute. you can add attribute adding $appends array , creating accessor: class user extends model { protected $appends = ['currentqueuelength']; public function getcurrentqueuelengthattribute() { return $this->currentqueuelength(); } } credit question: add custom attribute laravel / eloquent model on load? then in

3d - THREE.JS loads the textures from an OBJ/MTL file half way -

Image
i have obj, mtl , texture images exported cinema 4d . designers gave me files in zip. trying display them of three.js . use following code: var mtlloader = new three.mtlloader(); mtlloader.setpath('shipka-obj/'); mtlloader.load('shipka.mtl', function (materials) { materials.preload(); var objloader = new three.objloader(); objloader.setmaterials(materials); objloader.setpath('shipka-obj/'); objloader.load('shipka.obj', function (object) { scene.add(object); }); }); the problem monument missing parts: the designers wrong can't see can be? please, help! thanks. edit: i've uploaded zip obj, mtl , texture images dropbox. here link. https://www.dropbox.com/s/ah8yhjadgihrihr/shipka-obj.zip?dl=0 you didn't wrong. looked @ obj, , looks person modeled geometry made few mistakes: faces: three.js can render three-sided faces (triangles). understands qu

python 3.x - What is mean yield None (tornado.gen.moment) -

i need async subprocess lock in web application. writes next code: r = redis.redis('localhost') pipe = r.pipeline() is_locked = false while not is_locked: try: pipe.watch(lock_name) current_locked = int(pipe.get(lock_name)) if current_locked == 0: pipe.multi() pipe.incr(lock_name) pipe.execute() is_locked = true else: yield none except redis.watcherror: yield none return true in documentation writen tornado.gen.moment ( yield none since version 4.5) special object may yielded allow ioloop run 1 iteration. how works? next iteration other feature object (from other request) or not? correct yield none usage? the gen.moment resolved future object added ioloop callback. allows run 1 iteration of ioloop. the yield none converted gen.moment using convert_yielded in coroutine's gen.runner. the ioloop (basically while true ) each iteration things li

ios - How to animate tabbar badge count in swift -

Image
i want animate badge count on tabbar bouncing animation . has implemented native uitabbarcontroller . not using third party class adding uitabbarcontroller in project. i thing before share code first create 2 functions first 1 : func loopthrowviews(view:uiview){ subview in (view.subviews){ let type = string(describing: type(of: subview)) print(type) if type == "_uibadgeview" { print("this badgeview") animateview(view: subview) } else { loopthrowviews(view:subview) } } } this function take view , loop throw subviews until find badge view it's call animate method 1 func animateview(view:uiview){ let shakeanimation = cabasicanimation(keypath: "position") shakeanimation.duration = 0.05 shakeanimation.repeatcount = 50 shakeanimation.autoreverses = true shakeanimation.fromvalue = nsvalue(cgpoint: cgpoint(x:view.center.x - 10, y:view.cente

laravel: Input array forms for multiple entries. How to ignore not filled entries after submitting -

i have page shows 4 empty entries in single form. following basic form html code. have lables , validation code added each input not showing keep things simple. <form> <!-- entry 1 --> <input type="text" class="form-control" placeholder="level" name="levels[level][]"> <input type="text" class="form-control" placeholder="time" name="levels[build_time][]"> <!-- entry 2 --> <input type="text" class="form-control" placeholder="level" name="levels[level][]"> <input type="text" class="form-control" placeholder="time" name="levels[build_time][]"> <!-- entry 3 --> <input type="text" class="form-control" placeholder="level" name="levels[level][]"> <input type="text" class="form-control" plac

php - Like-Unlike function in codeigniter -

i implement , unlike codeigniter. can in normal php using following codes don't why not working in codeigniter below database table , model view , controller. appritiated. thanks. posts table create table `posts` ( `id` int(11) not null primary key auto_increment, `title` varchar(100) not null, `content` text not null, `timestamp` timestamp not null default current_timestamp on update current_timestamp ) engine=innodb default charset=latin1; like-unlike table create table `like-unlike` ( `id` int(11) not null primary key auto_increment, `user_id` int(11) not null, `post_id` int(11) not null, `purpose` int(2) not null, `timestamp` timestamp not null default current_timestamp on update current_timestamp ) engine=innodb default charset=latin1; jquery file function likeitem(post_id) { if ($("#likeitem_" + post_id).text() == "like") { $("#likeitem_" + postid).html('unlike'); var purpose = &qu

javascript - Bootstrap Typeahead : How to get all fetched remote values in typeahead bind function -

is possible fetched remote values in typeahead bind function. var banknames = new bloodhound({ datumtokenizer: function (datum) { return bloodhound.tokenizers.whitespace(datum.value); }, querytokenizer: bloodhound.tokenizers.whitespace, limit: 10, remote: { url: '/payments/bankwithdrawal/bankdetails?str=%query, prepare: function (query, settings) { var encoded = query.tounicode(); settings.url = settings.url.replace('%query', encoded); return settings; } } }); banknames.initialize(); // initializing typeahead $('.typeahead').typeahead({ hint: true, highlight: true, // enable substring highlighting minlength: 1 // specify minimum characters required showing result }, { name: 'bankname',

javascript - AJAX Success function if there is no returned JSON data -

i know simple struggling right. using jquery/ajax retrieve data (json) database. have success function display data. works fine want have alert user if there no returned results. my php excerpt encodes json: ... while($row = $result->fetch_all()) { $returnresult = $row; } echo json_encode(['result' => $returnresult, 'errors' => $errors]); .... my json data format looks this: {"result":[["grade 12","studies","john","doe"]],"errors":false} my jquery uses json data , displays in html elements: function getworkload(){ $.ajax({ type: "post", url: "modules/getworkload.php", datatype: 'json', data: {id:id}, cache: false, }) .success(function(response) { if(!response.errors && response.result) { $.each(response.result, function( index, value) {

javascript - on submit redirect to same tab of the same page -

i have page 4 different tabs. the first tab loaded default , when click on tab opens particular tab. now, in 1 tab resetting password , on button submit want load same tab again. default tab loaded. i have tried many javascript codes can´t desired result. please me issue. below code using on page. <?php include('../logic.php'); ?> <?php $username=$_session['username']; echo $username; include 'inc/header.inc.php'; include '../connect.php'; ?> <?php $username=$_session['username']; if(isset($_post['submit']) && isset($_post['password'])){ $password = $_post['password']; $confirmpassword = $_post['confirmpassword']; include '../connect.php'; if ($password == $confirmpassword && $password!=' ' && $confirmpassword!=' ') { $sql = "update partner set password='$password' username='".$_session['username'

c# - How can I check hash generated Cryptonight before to send? -

i have made miner c# language make bcn, xmr , works pools. but want check hash generated code target received pool. i have made that: public bool checkhash(byte[] hash, byte[] target) { (int = 0; < target.length; i++) { (int k = hash.length-1; k >= 0; k--) { log("test de: " + (hash[k] & 0x20)); if ((hash[k] & 0x20) > (target[i] & 0x04)) { log("hash invalid: " + _cryptonightlib.tohexstring(hash)); return false; } if ((hash[k] & 0x20) < (target[i] & 0x04)) { log("hash valid: " + _cryptonightlib.tohexstring(hash)); return true; } } } log("hash invalid: "+_cryptonightlib.tohexstring(hash)); return false; } but not work. examp

wordpress - How to list post of certain category (only one category lets say cat id = 5 ) only on blog listing page? -

i need list posts of category on blog listing page , let's of category id 5. need plugins or function.php file. not want change template files, think blog listing on index.php. i used parse_query hook following. affect other places . menu bar gone. please me. thank you. add_filter( 'parse_query', 'pp_posts_filter' ); function pp_posts_filter( $query ){ $query->query_vars['cat'] = 5; } to make query changes specific main query , not secondary ones menus or sidebars etc. use is_main_query function i.e. add_action( 'pre_get_posts', 'foo_modify_query_exclude_category' ); function foo_modify_query_exclude_category( $query ) { if ( ! is_admin() && $query->is_main_query() && ! $query->get( 'cat' ) ) $query->set( 'cat', '-5' ); }

php variable in ajax doesn't change value -

i have button while loop on php file. button associated php value changing mysqli_fetch_array . load 3 values in mysqli_fetch_array . ajax function has data in it, problem is accepting first row's value, , not other rows value. in fact, function ok @ first row of mysqli_fetch_array , , seems code not working on other rows, if php loop stopped @ first row. here javscript code (it declared on same page of loop, after while): <script type="text/javascript"> $(document).ready(function() { $("#up").click(function() { var varno_commentaire = $("#no_commentaire").val(); $.ajax({ url: "upvotecommentaire.php", type: "post", data: { no_commentaire: varno_commentaire }, async: false, success: function(result) { alert(result); } }); }); }); </script> and here php loop : <?php while($comm = mysqli_fetch_array

How to write a file in Android/Java? -

i try write text file cannot view file, , not write. the bit of code focusing on @ moment is: string file_name = ".txt"; string title = ed1.gettext().tostring(); try { fileoutputstream fileout=openfileoutput("mytextfile.txt", mode_private); outputstreamwriter outputwriter=new outputstreamwriter(fileout); outputwriter.write("job title"); outputwriter.write(ed1.gettext().tostring()); outputwriter.close(); toast.maketext(getbasecontext(), "file saved successfully!", toast.length_short).show(); } catch (exception e) { e.printstacktrace(); } here errors coming out of logcat: 07-25 12:22:39.775 4537-4537/? e/phoneinterfacemanager: [phoneintfmgr] geticcid: icc id null or empty. 07-25 12:22:40.628 1556-4236/? e/motosensors: proximity covered 1 07-25 12:22:41.067 1556-4236/? e/motosensors: proximity covered 2 07-25 12:22:41.563 1556-4275/? e/wifiscanningservice: got invalid work source re

post - JsonAPI - send list (array) of objects -

couldn't find example sending list of objects in jsonapi format. example, 1 object: { "data": { "type": "filetype", "id": "c33e05b7-8f55-4ee1-8d61-5b5da9110b2f", "attributes": { "created_at": "2017-07-02t09:11:10.005351z", "updated_at": "2017-07-02t09:11:10.005374z", "created_by": "user_id", "url_page": null, "resource_urls": null, "attachment_type_id": "1", "url_type_id": "1", "url_version": null }, "relationships": { "item": { "data": { "type": "items", "id": "f0c2e244-ec02-4a75-bd36-da1f703136e7" } } } } } how should list (array) of such objects valid jsonap

dart - How can I expose a StatefulWidget's method? -

say want build statefulwidget named myslidewidget provides public instance method: animate() . when press button on parent of myslidewidget , can call myslidewidget 's animate() method trigger internal slidetransition of myslidewidget . the usage this: class myslidewidgetdemo extends statelesswidget { @override widget build(buildcontext context) { myslidewidget myslidewidget = new myslidewidget(); return new scaffold( body: myslidewidget, floatingactionbutton: new floatingactionbutton( onpressed: () { myslidewidget.animate(); }, tooltip: 'start', child: new icon(icons.add), )); } } what wondering how encapsulate implementations of animationcontroller , _controller.forward() inside myslidewidget , user of myslidewidget can call animate() . is possible? or idea way encapsulation in flutter? you should use animationcontroller , pass slidetransition . call c

osx - git falsely marks entire file as merge conflict on same platform -

before downvote: i've read through autocrlf posts, nothing helped (we're not cross platform). edit 2 : looks file corrupt. creating new 1 solved problem, guess not git related. edit : editing , using git diff | cat -t gives like: diff —git a/css/style.css b/css/style.css index bd9b50a..8f8f7dc 100644 —- a/css/style.css +++ b/css/style.css @@ -1 +1 @@ -/* typo */^m^mbody {^m font-size: 16px;^m line-height: 1.5;^m}^m^ma {^m color: #000;^m color: #0770b2;^m}^m^m.main-carousel .item .carousel-caption .caption-content h1,^mh1 {^m edit: not happen in other files of repo we're 2 guys on os x working git. it's freaking css file being marked merge conflict no obvious reason. basically, when both work on file , instance both change 2 existing, different lines each , commit, 1 pushes , other 1 pulls, person gets merge conflict entire file. we've both tried autocrlf auto, input , false, no difference. strangely, when pull , see conflict message , diff

c# - How to save a stackpanel as an XPS document in multiple pages in WPF? -

i need save large stackpanel xps document. since stackpanel lengthy, cannot accommodated in single page while printing. there way save stackpanel in xps expanding multiple pages? below code saves single page: transform transform = stkpnlmain.layouttransform; stkpnlmain.layouttransform = null; size size = new size(stkpnlmain.actualwidth, stkpnlmain.actualheight); stkpnlmain.measure(size); stkpnlmain.arrange(new rect(size)); package package = package.open(destination.localpath, filemode.create); xpsdocument doc = new xpsdocument(package); xpsdocumentwriter writer = xpsdocument.createxpsdocumentwriter(doc); writer.write(stkpnlmain); doc.close(); package.close(); here, stkpnlmain lengthy block.

jquery - How to change a children type using Javascript -

i using video.js , want play both youtube , mp4 videos. have following code player <video id="my-video" class="video-js vjs-big-play-centered" data-setup='{ "controls": true, "autoplay": true, "preload": "auto" }' width="1250" height="900" poster="" data-setup='{" techorder ": ["youtube "]}'> <source src="https://www.youtube.com/watch?v=_z_se7ejnim" type='video/youtube'> <p class="vjs-no-js"> view video please enable javascript, , consider upgrading web browser <a href="http://videojs.com/html5-video-support/" target="_blank">supports html5 video</a> </p> here code used change source whenever link id (source_one) clicked: var = document.getelementbyid('source_one'); a.addeventlistener('click', function() { document.getelementbyid("

Partitioned table loading using DataFlow job -

i want read file , need write bigquery partitioned table, based on date value present in field of file. e.g. if file contains 2 dates 25 , 26 july dataflow should write data 2 partitions based on data present in file. public class starterpipeline { private static final logger log = loggerfactory.getlogger(starterpipeline.class); public static void main(string[] args) { dataflowpipelineoptions options = pipelineoptionsfactory.as(dataflowpipelineoptions.class); options.setproject(""); options.settemplocation("gs://stage_location/"); pipeline p = pipeline.create(options); list<tablefieldschema> fields = new arraylist<>(); fields.add(new tablefieldschema().setname("id").settype("string")); fields.add(new tablefieldschema().setname("name").settype("string")); fields.add(new tablefieldschema().setname("designation").settype("string")); fields.add

converting base64 string to attachment c# -

i trying convert base64 string(image/svg+xml) image attachment in c#, trying convert string image(png), save it, attach mail. tried send embedded image in mail didn't work because not client apps support embedded images in mail. what data uri support in major email client software? have convert file(png,pdf...), attach it, , send it. code send embedded image : public actionresult sendmail(string data , string mailstosend) { try { string[] mailsarr = mailstosend.split('/'); mailmessage mailmsg = new mailmessage(); smtpclient client = new smtpclient(); var imagedata = convert.frombase64string(data); var contentid = guid.newguid().tostring(); var linkedresource = new linkedresource(new memorystream(imagedata), "image/svg+xml"); linkedresource.contentid = contentid; linkedresource.transferencoding = transferencoding.base64; var body = string.format("<img src=\&quo

php - PayPal Incoming JSON request does not map to API -

i'm trying create payment paypal , errors. errors: 400{"name":"malformed_request","message":"incoming json request not map api request","information_link":" https://developer.paypal.com/webapps/developer/docs/api/#malformed_request ","debug_id":"f79dc9a739991"}exception 'paypal\exception\paypalconnectionexception' message 'got http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment .' in /home/nork/domains/nork.lt/public_html/cms/xxx/system/payments/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/core/paypalhttpconnection.php:202 stack trace: #0 /home/nork/domains/nork.lt/public_html/cms/xxx/system/payments/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php(73): paypal\core\paypalhttpconnection->execute('{"intent":"sale...') #1 /home/nork/domains/nork.lt/public_html/cms/xxx/system/payments

microsoft graph - Update Office365 personal Contacts -

the context: our company has 12 coordinators. each coordinator manages bunch of personal contacts. coordinator1 manages 409 personal contacts. coordinator2 manages 216 personal contacts. etc... we have nightly task populates sql server table holding personal contact information. the data in table extracted 12 different csv files in turn sent each coordinator. the coordinator has responsibility import csv file outlook in order keep list of personal contacts up-to-date (yes, personal contacts change daily). the entire importing of csv file bit of these coordinators , goal automate or have synchronizes outlook personal contacts these coordinators won’t have daily manual task. what i’ve tried: i’ve created c# console application , i’ve added adal , microsoft graph client library nuget packages. i’ve correctly registered application in azure , obtained client id , client secret . i’ve set appropriate application , delegated permissions . i’m able run app

javascript - Angular 2 - bypassSecurityTrustHtml along with bypassSecurityTrustScript -

i have button (on left navigation side), click on which, want display template (.html) on right side (content section). template (.html) path fetched web service , different every time (so no hard coded values). that template (.html) can have it's own script tags. till angular 1.x easy ng-include tag, seems angular 2 not support anymore. i able display html's content (as css) using below workaround - this.sanitizer.bypasssecuritytrusthtml(url); but scripts not getting loaded or executed. thanks in advance help. the official document says bypasssecuritytrusthtml() should work in case. i assuming must using [innerhtml] attribute populate contents in target container. i had kind of similar reuirement needed single html tag single script tag. used bypasssecuritytrustresourceurl() that. return this.sanitizer.bypasssecuritytrustresourceurl(url) i pretty sure work in case fetching executable source. you can try combimation bypasssecuritytrustscript

c# - Inserting a row into Relational database table -

i new c# , asp.net mvc. i'm building hr portal our company user can submit leave form among other things... i'm using mssql database server , using entity frame work communicate it. have 3 entities, user (containing user details), permissions (the user permissions allowing actions in app) , leave form table (where leave form details stored). there 1 many relationship between user - permission , 1 many relationship between user-leave. not fazed permissions gets created when user account being created. the problem facing is, how add leave form specific user? below controller code: [httppost] [validateantiforgerytoken] public actionresult leave(masterviewmodel model) { docsubviewmodel mv = model.dsmodel; int userid = convert.toint32(session["userid"]); try { using (hrdcpdbcontainer db = new hrdcpdbcontainer()) { var leave = db.leaves.create(); leave.datefrom = mv.datefrom; leave.datesubmitted = d

asp.net mvc - MVC Binding to a transformed property -

i have object class tag {string key; string text;} , object record bind storage table. class record { [...id & other properties...] public string name { get; set; } // "firstrecord" public string tags { get; set; } // "3,4,9" } updating name not present problem. have difficulties tags ... can see tags property csv of int keys (say {1:".net",2:"java",3:"perl" ...} ). in record 's edit view build dictionary available tags: dictionary<string, string> tags = viewdata["tags"] dictionary<string, string>; [...] <div class="form-group"> <label class="col-md-2 control-label">tags</label> <div class="col-md-10"> @foreach (var tag in tags) { <div class="checkbox-inline"> <label for="tag_@tag.key"> <input type="checkbox" id=&q

java - Add different layout of infoWindow to marker -

i have couple of markers on map. each 1 of them, want inflate custom infowindow. the problem i'm having infowindow same each one. have read couple of stack threads haven't figured out how fix it. snippet add markers map (int = 0; i<cityobjects.size(); i++){ cityobject cobject = cityobjects.get(i); coordinates loc = cobject.getcoordinates(); latlng pos = new latlng(loc.getlatitude(), loc.getlongitude()); mmap.addmarker(new markeroptions().position(pos).title(cobject.getname())); loadinfowindow(cobject.getimgs().get(0), cobject.getname()); builder.include(pos); } method inflate custom infowindow public void loadinfowindow(final string url, final charsequence title) { mmap.setinfowindowadapter(new googlemap.infowindowadapter() { @override public view getinfowindow(marker arg0) { arg0.getid(); view v = getact

python - Extracting the first day of month of a datetime type column in pandas -

i have following dataframe: user_id purchase_date 1 2015-01-23 14:05:21 2 2015-02-05 05:07:30 3 2015-02-18 17:08:51 4 2015-03-21 17:07:30 5 2015-03-11 18:32:56 6 2015-03-03 11:02:30 and purchase_date datetime64[ns] column. need add new column df[month] contains first day of month of purchase date: df['month'] 2015-01-01 2015-02-01 2015-02-01 2015-03-01 2015-03-01 2015-03-01 i'm looking date_format(purchase_date, "%y-%m-01") m in sql. have tried following code: df['month']=df['purchase_date'].apply(lambda x : x.replace(day=1)) it works somehow returns: 2015-01-01 14:05:21 . simpliest , fastest convert numpy array values , cast: df['month'] = df['purchase_date'].values.astype('datetime64[m]') print (df) user_id purchase_date month 0 1 2015-01-23 14:05:21 2015-01-01 1 2 2015-02-05 05:07:30 2015-02-01 2

codenameone - How to draw on top of an Image in CodeName One? -

i have been successful in drawing arbitrary paths on whole screen modifying definition of signaturepanel class according need. next, want want able draw on picture selected user. basically, picture should remain in background , should able manipulate it. tried mutable image don't quite how implement it. sort of code me started appreciated. here's have coded far: main class:- package com.mycompany.myapp; import com.codename1.ui.display; import com.codename1.ui.form; import com.codename1.ui.graphics; import com.codename1.ui.image; import com.codename1.ui.button; import com.codename1.ui.container; import com.codename1.ui.dialog; import com.codename1.ui.label; import com.codename1.ui.painter; import com.codename1.ui.plaf.uimanager; import com.codename1.ui.util.resources; import com.codename1.io.log; import com.codename1.io.multipartrequest; import com.codename1.ui.toolbar; import com.codename1.ui.urlimage; import com.codename1.ui.events.actionevent; import com.codename1