Posts

c++ - Null vs ZeroMemory -

what difference between setting object null , using zeromemory? i hear practice in winapi (which c) person should use zeromemory on c objects. come background of c# , seems c++ guy should know. i found directx api, whether zeromemory objects or not, application still works, samples use zeromemory , don't. can clarify these things? zeromemory fills block of memory zeros. setting pointer null make pointer points nothing, , is different filling memory pointer pointing zeros (you still able access memory via pointer, example). before can useful object, need replace these zeros more meaningful - why both programs use zeromemory or not works. reason zeromemory in context find operations on objects not initialized @ point of access (for example, visual studio filling uninitialized memory 0x0c0c0c0c /* or similar */, when encounter pattern during debugging, know object has not been initialized yet).

json - php script to push data 2d array -

i there add data file.but trying ti figure out exact syntax..any highly appreciated.. my php script $inp = file_get_contents('jsontrail.json'); $temparray = json_decode($inp, true); //adding matchid index of matches array $matchid=3; $arrne['games']['matches'][$matchid]['winner'] ="winner"; $arrne['games']['matches'][$matchid]['player1id'] ="player1id"; $arrne['games']['matches'][$matchid]['player2id'] ="player2id"; array_push($temparray,$arrne ); $jsondata = json_encode($temparray); file_put_contents('jsontrail.json', $jsondata); print_r( $inp); my valid json file { "players": [ { "name": "moldova", "image": "/images/moldova.jpg", "roll_over_image": "tank.jpg" }, /* repeat */ ], "games": [ { "matches": [ { ...

c# - How do i get dynamic properties using EPIServer webservice -

i'm trying dynamic property using episerver webservice. thing see can create new properties using pagestoreservice.rawproperty dynproperty = new pagestoreservice.rawproperty(); dynproperty.isdynamicproperty = true; but have no clue how property. question this. proper way dynamicproperty dynproperty = dynamicproperty.load(therootnode, "mydynamicprop"); using episerver webservice? in advance! very similar this question. roll own service obtain information [webservice(namespace=http://yournamespace/")] public class pagereferenceservice : system.web.services.webservice { [webmethod()] public pagereference getdynamicproperty(pagereference rootnode, string propertyname) { return dynamicproperty.load(rootnode, propertyname); } } (untested)

c# - Attribute to generate compilerwarning for a method in class -

i have class, use singleton-pattern. class looks like public class messageaccess { private static messageaccess instance; public static messageaccess instance { { return instance ?? (instance = new messageaccess()); } } private messageaccess() { } public void initialize(string data) { //... isinitialized = true; } private bool isinitialized; public void readdata1() { // method can called } public void readdata2() { // method can called, if initialize called. otherwise exception thrown } } is possible generate compiler-warning if method initialize never called while understand point of view, don't think such warning handy think. i'm afraid .net framework doesn't cater type of warnings couple of defined reasons (please refer link: http://blogs.msdn.com/b/csharpfaq/archive/2004/03/19/why-doesn-t-c-warn-about-unused-methods.aspx ). one mig...

How-to generate a JKS keystore Report? -

i have been looking generating report keystore of type jks. looking see following details in report: alias name issued validity validity i know, possible using keystore manager tool manually. there way of extracting such information programatically? [or automated process] thank you. i have got following method: create batch file followed: @echo off :top keytool -list -v -keystore -storepass :enter

ios - GMSGroundOverlay animating - should I be using a CATiledLayer? -

i experimenting google maps ios sdk latest version 1.2.1.2944 animate gmsgroundoverlay . user has control on image sequence, using animated uiimage isn't possibility sadly, i'm loading in uiimage on fly. gmsgroundoverlay.icon set uiimage being updated. aside high memory usage, seem have struck limitation in whenever try overlay uiimage using gmsgroundoverlay.icon more 1000px x 1000px, crashes. referencing uiimage of 1000px x 1000px gets around crash. it strikes me though maybe should utilise catiledlayer handling image load memory , subsequently icon property of gmsgroundoverlay , has had experience of using catiledlayer google maps ios sdk , sequencing images animated gmsgroundoverlay ? i got answer pressinganswer.com, think may helps you. as cannot use "position" keypath animating, ended animating using "latitude" , "longitude" keypaths separately. first calculate points , add them 2 separate arrays, 1 latitude value...

In DB2 Database, How to find out the actual storage size of data in varchar column? -

i new db2, , looking function memory_size(column_name) return number of bytes occupied column of particular row. example: having column named 'address' of varchar(50) datatype & data stored 'fountain street, zip-12345' , function should return memory occupied these 26 characters, not total column size nor length of data. thank you! you can find precision of column, via catalog (length query database catalog). however, real storage size vary. you cannot infer like cardinality * (leght(column1) + lenght(column2) + ...) = occupied storage there many other facts affect storage. also, title of question storage size (it seems tablespace -> container), in body talking memory (bufferpool) , things different in databases. what mean "memory occupied"? column precision or storage usage?

jquery - Bootstrap chevron icon doesn't change onclick, why? -

i have section: <div id="weather"> <h4><i class="icon-chevron-down"></i> weather</h4> and code this: $('#weather h4').click(function (){ $('#weather .entries').toggle(); $('#weather .icon-chevron-down').toggleclass('icon-chevron-right'); }); jsbin1 and doesn't work, if change places icon-chevron, works: jsbin2 is bug or doing wrong?? this 1 working: http://jsbin.com/omerep/1/edit $('#weather h4').click(function (){ $('#weather .entries').toggle(); $(this).find('i').toggleclass('icon-chevron-right icon-chevron-down', 200); });

Start Activity clearing top in Android -

i have following activities in stack: a , b , c, d i want relaunch b in order stack: a , b' where b' new b instance (not old receiving onnewintent callback, how can it? by way i'm using intent.setflags(intent.flag_activity_clear_top); when launching b activity way onnewintent called instead of start new instance use android:nohistory=true in manifest file particular activity clear.hope might solve issue.

Android: Showing cards like layout as in Google Keep -

Image
i wondering how show snapshot of notes, checklists, images in grid view. have no trouble creating grid view creating preview of challenge i'm facing right need add different type of views(text, checklist, imageview) grid according time of creation. works fine single type of view image or text only. or in other words. how add different views dynamically gridview adapter? all or appreciated. thanks. they surely not use gridview google keep - adapter nonetheless. to use different views adapter can use different view types: override getviewtypecount() return number of view types support. return appropriate type in getitemviewtype(int position) specific item. create correct view in getview(int position, view convertview, viewgroup parent) . keep in mind rules recycling, viewholder , on still apply. multiple types recycling happens correct type. marcus körner shared gist jake wharton on g+ recently might useful.

reading public data insights from page fan about facebook -

i have noticed obtaining insight information, facebook provides particular graph api unfortunately can access @ page_fans_country , page_storytellers data. however i've seen if go in general fan page, there "likes" section (in "about" page) created graph trend of "talking_about_this" number , trend of "like" number. this 2 graph "canvas" object , if move mouse on them, displayed information impossible obtain graph api. i've tried find method take information analysing javascript code. once thing i'v understood there "mouseover" event active code @ 118 line javascript page , code show div element in html page classname "graphtooltip". dont able text information in div element. know how obtain text?

return object from dictionary of nested lists when a condition (python) -

i have dictionary looks like: myd={'key_0':[[['descrp_0_0'],obj_0_0],.....,[['descrp_0_n'],obj_0_n]] ,....., 'key_n':[[['descrp_n_0'],obj_n_0],.....,[['descrp_n_n'],obj_n_n]]} all objs ndarrays of same shape , have function f() returns x float i.e.: obj_0_0.f() --> x_0_0 i want extract dictionary descrp , obj , respective key obj.f() (i.e. x) minimum values in each key (at myd scope of n keys give n items in shape of [descrp,obj]): the result must like: resd = {'key_0':[[descrp_0_min],obj_0_min], ....., 'key_n':[[descrp_n_min],obj_0_min]} something like: minxs = [min([item[-1].f() item in v]) k,v in myd.iteritems()] minobjs = [item k,v in myd.iteritems() item in v if item[-1].get_potential_energy() == minxs[myd.keys().index(k)]] resultlist = zip(myd.keys(),minobjs) resultdict = dict() in resultlist: resultdict[i[0]]=i[1] although works rather cumbersome , think there must easie...

objective c - Can not call class method -

i'm building tag-based application , want call same function each tab ( viewcontroller ). i'm trying in following way: #import "optionsmenu.h" - (ibaction) optionsbutton:(id)sender{ uiview *optionsview = [options showoptions:4]; nslog(@"options view tag %d", optionsview.tag); } optionsmenu.h file: #import <uikit/uikit.h> @interface optionsmenu : uiview - (uiview*) showoptions: (nsinteger) tabnumber; @end optionsmenu.m file: @import "optionsmenu.h" @implementation optionsmenu - (uiview*) showoptions:(nsinteger) tabnumber{ nslog(@"show options called"); uiview* optionsview = [[uiview alloc] initwithframe:[[uiscreen mainscreen] bounds]]; optionsview.opaque = no; optionsview.backgroundcolor = [[uicolor blackcolor] colorwithalphacomponent:0.5f]; //creating several buttons on optionsview optionsview.tag = 100; return optionsview; } @end the result never "show options called" d...