Sunday 15 February 2015

c# - Locking property get/set -



c# - Locking property get/set -

is next code safe, multiple threads accessing property not writing particular object. new objects beingness created , assigned. multiple threads phone call createxmldoc , readxmldoc

public class dataholder { public xmldocument xmldoc {get; set;} } public class accessclass { dataholder dataholderinstance; public accessclass(dataholder _dataholder) { dataholderinstance = _dataholder; } private void createxmldoc() { xmldocument _xmldoc = new xmldocument(); dataholderinstance.xmldoc = _xmldoc; } private void readxmldoc() { xmlnodelist elemlist = dataholderinstance.xmldoc.getelementsbytagname("title"); } }

from purely technical standpoint, code have provided above, not exhibit thread safety issues (i.e. info corruption etc).. question have inquire is, functional standpoint, "thread safe" behavior desired.

c# .net

How to write unclosed HTML statements with JavaScript -



How to write unclosed HTML statements with JavaScript -

in writing javascript project, i've run problem. need create couple of div elements, clone selection list , close divs. using innerhtml has side-effect of automatically closing "open" html statements left hanging. here's example:

<html><head></head><body> <div id="mydiv"></div> <script> var mydiv = document.getelementbyid("mydiv"); mydiv.innerhtml = mydiv.innerhtml + '<i>this should <b>bold '; mydiv.innerhtml = mydiv.innerhtml + '</b> , should not</i>'; </script> </body></html>

when executed browser, italic , bold first innerhtml assignment automatically "closed" me. can maintain them open?

since seem using appendchild other things , need insert dom objects document, should consider like:

var mydiv, span; mydiv = document.getelementbyid("mydiv"); span = document.createelement('span'); span.classname = 'boldclass'; span.appendchild(document.createtextnode('this should bold')); div.appendchild(span); // add together other dom objects here span = document.createelement('span'); span.classname = 'notboldclass'; span.appendchild(document.createtextnode(' , should not')); div.appendchild(span);

you can have function returns dom elements based on passed parameters, e.g.

function makeelement(tagname, props) { var el = document.createelement(tagname); (var p in props) { if (props.hasownproperty(p)) { el[p] = props[p]; } } homecoming el; }

so can things like:

span = makeelement('span', {classname: 'boldclass'});

note there few quirks deal research , test thoroughly.

javascript html

How to keep the Spring Tool Suite maven JVM processes from placing java icons on Dock for a mac? -



How to keep the Spring Tool Suite maven JVM processes from placing java icons on Dock for a mac? -

using:

mac os x 10.9.5 spring tool suite 3.6.1.release using maven-surefire-plugin run unit tests in forked mode.

spring tool suite 3.6.1.release using maven-surefire-plugin run unit tests in forked mode.

all solutions problem found around web putting -djava.awt.headless=true in various places: spring preferences->java->installed jres->default vm arguments, maven_opts, .mavenrc, run configurations, etc. none of them stopped icons populating mac dock.

how maintain spring tool suite maven jvm processes placing java icons on dock mac?

--pat

after trying every suggestion found here , elsewhere on web seek java vm stop putting java cup icon on mac dock, i've found solution causing in case. posting hoping help others.

what work, @ to the lowest degree in particular case, given next in our pom.xml configure surefire:

<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>${org.apache.maven.plugins.surefire-version}</version> <configuration> <argline>-djava.awt.headless=true</argline> <reuseforks>false</reuseforks> <forkcount>20</forkcount> <excludedgroups>com.xxx.yyyy.util.integrationtests</excludedgroups> </configuration> </plugin>

the prepare beingness adding of -djava.awt.headless=true.

you want configure maven_opts. did in .bashrc file:

export maven_opts=-djava.awt.headless=true

no more annoying icons pop , take focus current window.

hope helpful.

--pat

java spring osx dock

java - android EditText, remove focus when clicking another object -



java - android EditText, remove focus when clicking another object -

can help me, im beginner in android development, edittext focused, , want remove focus when clicking other object, example, listview, button... want edittext focus when user clicks onto it

you can seek using clearfocus() method on edittext..

edittext txt; txt=(edittext) findviewbyid(r.id.somename); txt.clearfocus();

or can use

private void hidedefaultkeyboard() { activity.getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_state_always_hidden);//u have got lot of methods here }

java android xml android-layout

javascript - sorting feature in ngTable using Jasmine Testing -



javascript - sorting feature in ngTable using Jasmine Testing -

i have created application using ng-table , application working fine don'nt know how write test case sorting , getdata.

can please tell me solution testing functionality

my code given below

jasmine test case

describe('testing controllers', function() { describe('testing workcontroller controller', function() { var workcontroller, $scope; beforeeach(module('wsd')); beforeeach(inject(function($controller, $rootscope) { $scope = $rootscope.$new(); workcontroller = $controller('workcontroller', { $rootscope: $rootscope, $scope: $scope, ngtableparams : ngtableparams, $filter: $filter }); })); it('should tableparams when tableparams called', function() { }); }); });

workstation/main.js

angular.module('wsd.workstations', []) .controller('workcontroller', function($rootscope, $scope, $filter, ngtableparams) { $scope.myvalues = [{name: "moroni", age: 50}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}]; $scope.tableparams = new ngtableparams({ sorting: { name: 'asc' } }, { getdata: function($defer, params) { $scope.myvalues = $filter('orderby')($scope.myvalues, params.orderby()); $defer.resolve($scope.myvalues); } }); $scope.searchdocuments = function() { // other logic }; });

update 2

i have done testing, getting

<failure type="">typeerror: &apos;undefined&apos; not function (evaluating &apos;$defer.resolve($scope.myvalues)&apos;)

test cases

it('should check tableparams getdata sorting', inject(function($q) { var deferred = $q.defer(); var promise = deferred.promise; promise.then(function(result) { expect(result).toequal(expectedresult); }); $scope.myvalues = [{name: "moroni", age: 50}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}]; $scope.getdata(promise, $scope.tableparams ); }));

you could:

declare getdata function on controller's $scope, making available in test:

$scope.tableparams = new ngtableparams({ sorting: { name: 'asc' } }, { getdata: $scope.getdata }); $scope.getdata = function($defer, params) { $scope.myvalues = $filter('orderby')($scope.myvalues, params.orderby()); $defer.resolve($scope.myvalues); }

inject $q in beforeeach().

create promise object using $q.

assign $scope.myvalues unit test.

declare variable containing expected result - sorted $scope.myvalues array. then:

promise.then(function(result){ expect(result).toequal(expectedresult); } $scope.getdata(deferred , $scope.tableparams);

javascript angularjs karma-jasmine ngtable

spring batch with AMQP Listener -



spring batch with AMQP Listener -

i want utilize spring batch rabbitmq listener

when message received, first step called , repeat treatment after each message reciption

this listener : public class mymessagelistener implements messagelistener {

@override public void onmessage(message msg) { string messagebody= new string(msg.getbody()); logger.info("listener received message {}", messagebody); gson gson = new gson(); //call spring batch step generate study //todo }

}

you can utilize spring batch integration , joblaunchinggateway launch job each message.

however, if want multiple messages comprise "batch", should utilize rabbittemplate within itemreader receive() messages want processed batch (instead of listener).

spring spring-batch spring-rabbit

php error on joomla site -



php error on joomla site -

we have 2 instances running of joomla hosted site. 1 on test server while other 1 on live server.

we getting 1 issue on test server, site displaying correctly not on live server.

we zeroed on 1 particular line in page source view, here difference of 1 function both test live server

test server

<script language="javascript"> $(document).ready( function (){ $(".pikame403").pikachoose(); }); </script>

live server

<script language="javascript"> $(document).ready( function (){ $(".pikame<?=$list['id']?>").pikachoose(); }); </script>

to me looks on live server, php not concatinating id. hints/suggestions welcome. nice if indicate addins store code.

not servers allow utilize short tags <?= echoing. on test server short tags switched on, on production -- switched off, don't work.

you can solve problem in 2 ways:

switch on short tags on production server.

do not utilize short tags (which recommend). alter code <?=$list['id']?> <?php echo $list['id']; ?>.

php joomla pikachoose

jquery - add variable string to img src path on click -



jquery - add variable string to img src path on click -

i'm trying set variable within , image path using jquery on click. models function below sets folder variable folder name within image path. illustration of button 1 clicked want variable 'folder' set 'folder1', when click colour takes the image form folder. problem when take colour variable not passed path , right path assign image src.

jquery...

var folder = ''; //models $(function() { $('.folder1').click(function(){ var folder = 'folder1'; $(".selected-car").attr('src',"img/folder1/pic1.jpeg"); homecoming false; }); $('.folder2').click(function(){ var folder = 'folder2'; $(".selected-car").attr('src',"img/folder2/pic1.jpeg"); alert(model); homecoming false; }); $('.folder3').click(function(){ var folder = 'folder3'; $(".selected-car").attr('src',"img/folder3/pic1.jpeg"); homecoming false; }); $('.folder4').click(function(){ var folder = 'folder4'; $(".selected-car").attr('src',"img/folder4/pic1.jpeg"); homecoming false; }); }); //colours $(function() { $('.colour1').click(function(){ $(".selected-car").attr('src',"img/"+folder+"/cooper1.jpeg"); homecoming false; }); $('.colour2').click(function(){ $(".selected-car").attr('src',"img/"+folder+"/cooper2.jpeg"); homecoming false; }); });

html...

<div class="select-model"> <button class="folder1">model 1</button> <button class="folder2">model 2</button> <button class="folder3">model 3</button> <button class="folder4">model 4</button> </div> <div class="configuration clearfix"> <img src="img/folder1/pic6.jpeg" class="selected-car"><!-- default pic --> <div class="select-colour clearfix"> <a href="#"><img src="img/colour/colour1.jpeg" class="colour1"></a> <a href="#"><img src="img/colour/colour2.jpeg" class="colour2"></a> <a href="#"><img src="img/colour/colour3.jpeg" class="colour3"></a> <a href="#"><img src="img/colour/colour4.jpeg" class="colour4"></a> <a href="#"><img src="img/colour/colour5.jpeg" class="colour5"></a> <a href="#"><img src="img/colour/colour6.jpeg" class="colour6"></a> <a href="#"><img src="img/colour/colour7.jpeg" class="colour7"></a> <a href="#"><img src="img/colour/colour8.jpeg" class="colour8"></a> <a href="#"><img src="img/colour/colour9.jpeg" class="colour9"></a> <a href="#"><img src="img/colour/colour10.jpeg" class="colour10"></a> </div> </div>

i think should alter 'modal' variable name 'folder'. turn these :

var model = 'folder1'; var model = 'folder2'; var model = 'folder3'; var model = 'folder4';

to these :

var folder = 'folder1'; var folder = 'folder2'; var folder = 'folder3'; var folder = 'folder4';

jquery

How to authorize/deny write access to a directory on Windows using Python? -



How to authorize/deny write access to a directory on Windows using Python? -

i able authorize or deny write access specific directory on windows xp , more.

i tried following, , don't work:

os.chmod(): file read-only attribute can specified, see python's doc win32api.setfileattribute() file_attribute_readonly: file read-only. [...] attribute not honored on directories, see msdn's setfileattribute

it looks alternative have access , update "security info" of directory, i've tried several hours done without much success (i'm unfamiliar win32 api).

any ideas on how that?

this challenging thing do. i've started this great answer helps similar thing.

you can start listing acls directory, done using code:

class="lang-python prettyprint-override">import win32security import ntsecuritycon con filename = r'd:\tmp\acc_test' sd = win32security.getfilesecurity(filename, win32security.dacl_security_information) dacl = sd.getsecuritydescriptordacl() ace_count = dacl.getacecount() print('ace count:', ace_count) in range(0, ace_count): rev, access, usersid = dacl.getace(i) user, group, type = win32security.lookupaccountsid('', usersid) print('user: {}/{}'.format(group, user), rev, access)

you can find method pyacl.getacecount() returns number of aces.

the getace(i) function returns access_allowed_ace header tuple:

ace_header - 2 integers acetype, aceflags - trial , error showed me aceflags set 11 meant inherit privileges , 3 not inherited access_mask - detailed list here or in ntsecuritycon.py sid

now able read old aces , deleting old ones quite simple:

class="lang-python prettyprint-override">for in range(0, ace_count): dacl.deleteace(0)

and after can add together privileges calling addaccessallowedaceex() [msdn]:

class="lang-python prettyprint-override">userx, domain, type = win32security.lookupaccountname ("", "your.user") usery, domain, type = win32security.lookupaccountname ("", "other.user") dacl.addaccessallowedaceex(win32security.acl_revision, 3, 2032127, userx) # total command dacl.addaccessallowedaceex(win32security.acl_revision, 3, 1179785, usery) # read sd.setsecuritydescriptordacl(1, dacl, 0) # may not necessary win32security.setfilesecurity(filename, win32security.dacl_security_information, sd)

i've taken numbers 3, 2032127 , 1179785 listing in first half of script (before running script i've set privileges in explorer->right click->properties->security->advanced):

just illustrative image borrowed http://technet.microsoft.com/

class="lang-none prettyprint-override">user: domain/user (0, 3) 2032127 user: domain/user2 (0, 3) 1179785

but corresponds to:

3 -> object_inherit_ace|container_inherit_ace 2032127 -> file_all_access (well, con.file_all_access = 2032639, 1 time apply on file , read you'll 2032127; difference 512 - 0x0200 - constant haven't found in ntsecuritycon.py/file security permissions) 1179785 -> file_generic_read

you can remove access, alter or remove should solid start you.

tl;dr - codes class="lang-python prettyprint-override">import win32security import ntsecuritycon con filename = r'd:\tmp\acc_test' userx, domain, type = win32security.lookupaccountname ("", "your.user") usery, domain, type = win32security.lookupaccountname ("", "other.user") sd = win32security.getfilesecurity(filename, win32security.dacl_security_information) dacl = sd.getsecuritydescriptordacl() ace_count = dacl.getacecount() print('ace count:', ace_count) # listing in range(0, ace_count): rev, access, usersid = dacl.getace(i) user, group, type = win32security.lookupaccountsid('', usersid) print('user: {}/{}'.format(group, user), rev, access) # removing old ones in range(0, ace_count): dacl.deleteace(0) # add together total command user x dacl.addaccessallowedaceex(win32security.acl_revision, con.object_inherit_ace|con.container_inherit_ace, con.file_all_access, userx) # add together read access user y dacl.addaccessallowedaceex(win32security.acl_revision, con.object_inherit_ace|con.container_inherit_ace, con.file_generic_read, usery) sd.setsecuritydescriptordacl(1, dacl, 0) # may not necessary win32security.setfilesecurity(filename, win32security.dacl_security_information, sd) mini utility finish ace listing

i wrote little script parsing file aces:

class="lang-python prettyprint-override">import win32security import ntsecuritycon con import sys # list of file masks interesting access_masks = ['file_read_data', 'file_list_directory', 'file_write_data', 'file_add_file', 'file_append_data', 'file_add_subdirectory', 'file_create_pipe_instance', 'file_read_ea', 'file_write_ea', 'file_execute', 'file_traverse', 'file_delete_child', 'file_read_attributes', 'file_write_attributes', 'file_all_access', 'file_generic_read', 'file_generic_write', 'file_generic_execute'] # list of inheritance flags ace_flags = ['object_inherit_ace', 'container_inherit_ace', 'no_propagate_inherit_ace', 'inherit_only_ace'] # list of ace types ace_types = ['access_min_ms_ace_type', 'access_allowed_ace_type', 'access_denied_ace_type', 'system_audit_ace_type', 'system_alarm_ace_type', 'access_max_ms_v2_ace_type', 'access_allowed_compound_ace_type', 'access_max_ms_v3_ace_type', 'access_min_ms_object_ace_type', 'access_allowed_object_ace_type', 'access_denied_object_ace_type', 'system_audit_object_ace_type', 'system_alarm_object_ace_type', 'access_max_ms_object_ace_type', 'access_max_ms_v4_ace_type', 'access_max_ms_ace_type', 'access_allowed_callback_ace_type', 'access_denied_callback_ace_type', 'access_allowed_callback_object_ace_type', 'access_denied_callback_object_ace_type', 'system_audit_callback_ace_type', 'system_alarm_callback_ace_type', 'system_audit_callback_object_ace_type', 'system_alarm_callback_object_ace_type', 'system_mandatory_label_ace_type', 'access_max_ms_v5_ace_type'] ################################################################################ def get_ace_types_str(ace_type): ''' yields matching ace types strings ''' t in ace_types: if getattr(con, t) == ace_type: yield t ################################################################################ def get_ace_flags_str(ace_flag): ''' yields matching ace flags strings ''' t in ace_flags: attr = getattr(con, t) if (attr & ace_flag) == attr: yield t ################################################################################ def get_access_mask_str(access_mask): ''' yields matching ace flags strings ''' t in access_masks: attr = getattr(con, t) if (attr & access_mask) == attr: yield t ################################################################################ def list_file_ace(filename): ''' method listing of file aces ''' # load info sd = win32security.getfilesecurity(filename, win32security.dacl_security_information) dacl = sd.getsecuritydescriptordacl() # print ace count ace_count = dacl.getacecount() print('file', filename, 'has', ace_count, 'aces') # go trough individual aces in range(0, ace_count): (ace_type, ace_flag), access_mask, usersid = dacl.getace(i) user, group, usertype = win32security.lookupaccountsid('', usersid) print('\tuser: {}\\{}'.format(group, user)) print('\t\tace type ({}):'.format(ace_type), '; '.join(get_ace_types_str(ace_type))) print('\t\tace flags ({}):'.format(ace_flag), ' | '.join(get_ace_flags_str(ace_flag))) print('\t\taccess mask ({}):'.format(access_mask), ' | '.join(get_access_mask_str(access_mask))) print() ################################################################################ # execute defaults if __name__ == '__main__': filename in sys.argv[1:]: list_file_ace(filename) print()

it prints out strings this:

class="lang-none prettyprint-override">d:\tmp>acc_list.py d:\tmp d:\tmp\main.bat file d:\tmp has 8 aces user: builtin\administrators ace type (0): access_min_ms_ace_type; access_allowed_ace_type ace flags (0): access mask (2032127): file_read_data | file_list_directory | file_write_data | file_add_file | file_append_data | file_add_subdirectory | file_create_pipe_instance | file_read_ea | file_write_ea | file_execute | file_traverse | file_delete_child | file_read_attributes | file_write_attributes | file_generic_read | file_generic_write | file_generic_execute ...

python windows winapi authorization

asp.net mvc - MVC MultiSelectList Binding -



asp.net mvc - MVC MultiSelectList Binding -

i utilize asp.net mvc .. when post form it's raise cast error when model validate. how can fixed view model or validation way?

"the parameter conversion type 'system.string' type 'system.web.mvc.selectlistitem' failed because no type converter can convert between these types." give thanks you..

//my view model public class prodgroupviewmodel { //i've fixed here or way? public ienumerable<selectlistitem> rooms { get; set; } } //controller public actionresult create(int id) { homecoming view(new prodgroupviewmodel { rooms = new multiselectlist(_roomservice.getall(), "roomid", "roomname"), }); } //in view <div class="form-group"> <label class="col-md-3 control-label">oda</label> <div class="col-md-9"> @html.listboxfor(model => model.rooms, (multiselectlist)model.rooms, new { @class = "form-control" }) </div> </div>

you're trying post same property holds select list. posted result of selections in listbox comma-delimited string of selected alternative values, modelbinder incapable of binding property of type multiselectlist.

you need additional model property hold posted value like:

public list<int> selectedroomids { get; set; }

and in view:

@html.listboxfor(m => m.selectedroomids, model.rooms, new { @class = "form-control" })

also, don't need cast model.rooms, since it's strongly-typed.

asp.net-mvc validation razor

java - I am borrowing a method that catches 10 kinds of exceptions but does nothing with them. Can I replace them with just (Exception e) -



java - I am borrowing a method that catches 10 kinds of exceptions but does nothing with them. Can I replace them with just (Exception e) -

im borrowing method found on internet:

private static int getexiforientation(string src) throws ioexception { int orientation = 1; seek { /* * if targeting api level >= 5 exifinterface exif = new exifinterface(src); orientation = exif.getattributeint(exifinterface.tag_orientation, 1); */ if (build.version.sdk_int >= 5) { class<?> exifclass = class.forname("android.media.exifinterface"); constructor<?> exifconstructor = exifclass.getconstructor(new class[] { string.class }); object exifinstance = exifconstructor.newinstance(new object[] { src }); method getattributeint = exifclass.getmethod("getattributeint", new class[] { string.class, int.class }); field tagorientationfield = exifclass.getfield("tag_orientation"); string tagorientation = (string) tagorientationfield.get(null); orientation = (integer) getattributeint.invoke(exifinstance, new object[] { tagorientation, 1 }); } } grab (classnotfoundexception e) { e.printstacktrace(); } grab (securityexception e) { e.printstacktrace(); } grab (nosuchmethodexception e) { e.printstacktrace(); } grab (illegalargumentexception e) { e.printstacktrace(); } grab (instantiationexception e) { e.printstacktrace(); } grab (illegalaccessexception e) { e.printstacktrace(); } grab (invocationtargetexception e) { e.printstacktrace(); } grab (nosuchfieldexception e) { e.printstacktrace(); } homecoming orientation; } // end of getexiforientation

can replace these multiple grab statements just

} grab (exception e) {

or there chance if dont mention each exception name, might slip grab exception e check ?

to sum up: "catch exception e" grab kinds of exceptions or should each 1 named individually (all in cases not want react differently in each case)

to sum up: "catch exception e" grab kinds of exceptions or should each 1 named individually

it catches of type exception or subclass. not grab other throwables, e.g. error. given exceptions you've specified do subclass exception, can grab that.

however, it's still going alter behaviour - because also grab runtimeexceptions, ones weren't mentioned before. if you're using java 7 or higher, might want utilize the ability specify multiple types single grab block:

catch (classnotfoundexception | securityexception | nosuchmethodexception | illegalargumentexception | instantiationexception | illegalaccessexception | invocationtargetexception | nosuchfieldexception e) { // ... }

java

php - How to add quantity field and add to cart button in a custom template? -



php - How to add quantity field and add to cart button in a custom template? -

i creating custom woocommerce template , need display quantity field as add together cart button.

i have used 'woocommerce_single_product_summary' there seems no woocommerce styling applied , when add together item cart no woocommerce messages appear if go woocommerce archive page message there wrong place.

<?php do_action('woocommerce_simple_add_to_cart'); ?>

this add together quantity spinner , add together cart button.

php wordpress templates plugins woocommerce

wpf - Master-Detail Display with Sorting -



wpf - Master-Detail Display with Sorting -

i have looked @ ~15 threads on topic, none of seem address problem.

i have 2 tables in typed dataset. 1 list of categories primary key categoryid. sec list of items foreign key same categoryid. in dataset, define relationship betweeen 2 tables relctoi.

my wpf form contains listbox listing categories , listbox display items category listbox category user picks. both listboxs sorted name.

my pseudo-xaml looks this:

class="lang-xaml prettyprint-override"><window.resources> <collectionviewsource x:key="cvscategories" source="{binding source={staticresource mydataset}, path=categories}"> <collectionviewsource.sortdescriptions> <scm:sortdescription propertyname="categoryname" /> </collectionviewsource.sortdescriptions> </collectionviewsource> <collectionviewsource x:key="cvsitems" ....same thing items path=items ... </collectionviewsource> <datatemplate x:key="mytemplate" <textblock text="{binding source={staticresource cvsitems}, path=itemname}" /> </datatemplate> </window.resources> <grid datacontext="{staticresource cvscategories}"> <....define columns /> <listbox name="lbxcategories" grid.column="0" itemssource="{binding}" displaymemberpath="categoryname" /> <listbox name="lbxitems" grid.column="1" itemssource="{binding path=relctoi}" itemtemplate="{staticresource mytemplate}"/>

the category listbox works fine item listbox blank. wrong xaml?

wpf xaml listbox

android - PNG file or PDF file- Which offers better quality -



android - PNG file or PDF file- Which offers better quality -

i have list of thumbnail images coming server. on clicking thumbnail nail image, image should enlarged. have confusion file format(which 1 use: pdf/png). can suggest me format better

pdf

portable document format (pdf) open file format makes pdf format suitable sharing. these files can viewed in professional software programme or free acrobat reader.

png

new image file format advantages on gif , jpeg. png utilize lossless compression of info in wonderful way – format compress images not able observe degradation of quality. png files saved .png extension. png file can back upwards both 8-bit or 24-bit colors, using lossless compression approach.

png file settings can controlled are: transparency info file defined background color adobe gamma correction

use of png file in web project fit. however, because of lack of back upwards cmyk color space, , fact there can no color separations, png file not fit in print production cycle.

nontheless, jpg still offers highest compression ratios. , gif offers ability of showing small animations (which can simulate displaying series of pngs in sequence), if using maximum of 256 colors, 1 of can set transparent.

android png mupdf

What is the equivalent of a TeraData PREPARE statement in SQL Server -



What is the equivalent of a TeraData PREPARE statement in SQL Server -

i in situation converting big tera info stored procedure sql server. have got through of it, below code has stumped me. trying find online help on this, apart description, haven't been able see working illustration of how prepare statement behaves in conjunction cursor. (i dont know much teradata , has been 2 weeks since started scratching surface)

set cur_stmt1=v_select_stmt||v_where_stmt; prepare s1 cur_stmt1; open cur1; set v_record_cnt = activity_count; if(v_record_cnt=0) close cur1; set cur_stmt1='select 0 cnt1,' || v_col_null_stmt; prepare s1 cur_stmt1; open cur1; end if;

can please help me translate code more t-sql'ised form?

to homecoming results of select need utilize cursor in teradata (and standard sql), of course of study not real cursor fetch 1 row after other, it's spool other result set.

in case there's select using dynamic sql, should translate t-sql as

exec sp_executesql @cur_stmt1;

and it's checking if reply set empty , returns single row reply set select 0 ... instead.

sql-server sql-server-2008 teradata data-migration prepare

ios - Can 300dpi screens be captured in XCode? -



ios - Can 300dpi screens be captured in XCode? -

does know if it's possible capture screens app in 300 dpi? i'd build script takes screens print use.

run (retina) simulator(s), cmd + s save screenshot desktop. dpi varies between 264 - 400 newer devices.

ios xcode screenshot

jboss - Prevent deployment to entry node, only deploy to other nodes -



jboss - Prevent deployment to entry node, only deploy to other nodes -

i have free openshift business relationship default 3 gears. on have installed wildfly 8.1 image using openshift web console. set minimal , maximal scaling 3.

what happens openshift create 3 jboss wildfly instances:

one on entry node (which running haproxy) one on auxiliary node one on auxiliary node

the weird thing jboss wildfly instance on entry node default disabled in load balancer config (haproxy.conf). but, openshift still deploying war archive whenever commit in associated git repo.

what's problematic here because of incredibly low number of max user processes (250 via ulimit -u), jboss wildfly instance on entry node cannot startup. during startup jboss wildfly throw random 'java.lang.outofmemoryerror: unable create new native thread' (and no, memory fine, it's os process limit).

as result, deployment process hang.

so summarize:

a jboss wildfly instance created on entry node, disabled in load balancer jboss wildfly in default configuration cannot startup on entry node, not trivial war. the deployer process attempts deploy jboss wildfly on entry node, despite beingness disabled in load balancer

now question:

how can modify deployer process (including gear start command) not effort deploy jboss wildfly instance on entry node?

when app scales 2 gears 3, haproxy stops routing traffic application on headgear , routes 2 other gears. assures haproxy getting cpu possible application on headgear (where haproxy running) no longer serving requests.

the out of memory message you're seeing might not actual out of memory issue bug relating ulimit https://bugzilla.redhat.com/show_bug.cgi?id=1090092.

jboss openshift wildfly-8

vb.net - How to get value from dynamically created texboxes? -



vb.net - How to get value from dynamically created texboxes? -

im new here , im having problem vb.net code. have dynamically created few textboxes on panel, , want code after submitting form save values database. problem cannot find way how grab values texboxes. tried found on net still getting error message "object reference not set instance of object". can advice me doing wrong. here code how created texboxes:

integer = 0 cntpos -1 dim txtjobto textbox = new textbox() txtjobto.id = "txtjobto_" & jobid dim label label = new label() label.text = pospanel.rows(i).item("position") pnlcontainer.controls.add(label) pnlcontainer.controls.add(new literalcontrol("</td><td>")) pnlcontainer.controls.add(txtjobto) next

this line of code shows texboxes on page

<tr bgcolor="#ffcc99"><td colspan="4"> <asp:panel id="pnlcontainer" runat="server" visible="true"></asp:panel></td></tr> <tr><td colspan='6' align='center'> <asp:button id="cmdsave" text="save" tooltip="cmdsave" commandargument="cmdsave_click" runat="server" /></td></tr>

and part of code should save data

sub cmdsave_click(byval sender system.object, e eventargs) handles cmdsave.click ... integer = 0 cntposins -1 dim strto textbox = new textbox() posid = posins.rows(i).item("id_pos") strto.text =ctype(pnlcontainer.findcontrol("txtjobto_" & posid.tostring()),textbox).text .... 'insert database next

i error message on line strto.text =ctype(pnlcontainer.findcontrol("txtjobto_" & posid.tostring()),textbox).text can please give me advice on how prepare this? proper way read value dynamically created textboxes in situation? give thanks you

there 2 aspects think. dynamic controls bit of minefield , can take while understand.

a) create sue create dynamic controls , add together them page during oninit or createchildcontrols. access value in event handler or during onprerender...otherwise have problem using standard textbox.text property value. it's tricky using dynamic controls because values not nowadays whole page lifecycle without inspecting page.request property.

b) personally, when dynamically create input elements, don't "let go" of them , rely on findcontrol handle onto them me.

when create controls dynamically, store them in e.g. lovely dictionary(of string, textbox) accessible rest of code, e.g. property or fellow member variable.

' lookup declared outside of consuming methods accessible both private dictcontrolslookup new dictionary(of string, textbox) sub yoursubname integer = 0 cntpos -1 dim txtjobto textbox = new textbox() txtjobto.id = "txtjobto_" & jobid dim label label = new label() label.text = pospanel.rows(i).item("position") pnlcontainer.controls.add(label) pnlcontainer.controls.add(new literalcontrol("</td><td>")) pnlcontainer.controls.add(txtjobto) dictcontrolslookup.add(txtjobto.id, textjobto) next end sub sub cmdsave_click(byval sender system.object, e eventargs) handles cmdsave.click ... integer = 0 cntposins -1 dim strto textbox = new textbox() posid = posins.rows(i).item("id_pos") dim ctlid string = "txtjobto_" & posid.tostring() if dictcontrolslookup.containskey(ctlid) strto.text = dictcontrolslookup(ctlid).text end if .... 'insert database next end sub

alternatively iterate dictcontrolslookup.values collection in save_click access text boxes :-)

vb.net

c# - How to properly dispose collection of unmanaged resources from finalizer? -



c# - How to properly dispose collection of unmanaged resources from finalizer? -

here illustration uncertain:

public class someclass : idisposable { ~someclass() { dispose(false); } public void dispose() { dispose(true); gc.suppressfinalize(this); } private bool _disposed; protected virtual void dispose(bool disposing) { if (!_disposed) { if (disposing) { // todo: release managed resources here... } // ?! safe enumerate dictionary here ?! foreach (var resource in _resources.values) releasebuffer(resource); _resources = null; _disposed = true; } } private dictionary<string, intptr> _resources; ... }

will safe enumerate managed dictionary in order release unmanaged resources?

is availability of dictionary uncertain since order in finalizers invoked not defined?

here quote taken msdn find confusing [1]:

the finalizers of 2 objects not guaranteed run in specific order, if 1 object refers other. is, if object has reference object b , both have finalizers, object b might have been finalized when finalizer of object starts. http://msdn.microsoft.com/en-us/library/system.object.finalize(v=vs.110).aspx

rather having dictionary of unmanaged resources, suggest having dictionary of independent wrapper objects, each of responsible guarding 1 unmanaged resource. if object holding dictionary abandoned , no other references exist wrapper objects, of wrapper objects finalized without needing involve dictionary in process. using such approach create easier sanely handle cases in exception occurs during object construction, , @ to the lowest degree somewhat-sanely deal situations object finds resurrected between time has been enqueued finalization , time finalizer runs [code can't expected run "correctly" in such cases, should avoid corrupting state of rest of system].

for example, code uses handle may acquire lock during utilize and, after use, check "disposeobjectasap" flag; if set, re-acquire lock , dispose object. finalizer should set flag , seek acquire lock; if acquires lock, should dispose object. if unable, fact set flag should imply code has lock destined check flag , clean object, finalizer doesn't have to. if finalizer runs prematurely, may release resources thread going need, causing actions on other thread fail, finalizer won't release resources while thread using them or disposing them, since releasing resources in situations cause massive scheme corruption.

c# .net collections dispose idisposable

browser - Reading external file using javascript ajax -



browser - Reading external file using javascript ajax -

is possible read m3u8 file(or other text file example) external source via http request of ajax? , not using server side(such node.js or c#) request file. file sitting in http : // ... / file.m3u8 give thanks you:)

sure, can utilize xmlhttprequest read files local javascript, example:

var request = new xmlhttprequest(); request.open('get', '../file.m3u8', false); request.send(); console.log('file contents: ' + request.responsetext);

full details on xmlhttprequest on mozilla website.

javascript browser request

Angularjs Prev and Next sliding animation -



Angularjs Prev and Next sliding animation -

i making angular app previous , next buttons. want ng-view animate different directions depending on button user clicks (prev or next). have working illustration animates view next button. how create work prev button?

http://plnkr.co/edit/3dex35iag6eqr1iiygqo?p=preview

if alter css this:

.view-animate.ng-enter { left:100%; } .view-animate.ng-enter.ng-enter-active { left:0; } .view-animate.ng-leave.ng-leave-active { left:-100%; }

to this:

.view-animate.ng-enter { left:-100%; } .view-animate.ng-enter.ng-enter-active { left:0; } .view-animate.ng-leave.ng-leave-active { left:100%; }

then animation reverses quite nicely. how do dynamically base of operations on wether user presses prev or next button?

angularjs

c++ - 32 bit python on 64 bit windows machine -



c++ - 32 bit python on 64 bit windows machine -

i've downloaded pythonxy (2.7.6.1) on new 64 bit windows machine (windows 7 enterprise, sp1). when seek run python, error saying side-by-side configuration incorrect. winpython 32 bit (2.7.6.3) shows same behavior, winpython 64 bit fine.

however, badly need compile python modules boost , found myself taking first few steps believe searching-the-internet/configuration/compilation hell 64 bit, i'd rather seek create 32-bit python work, have whole mingw procedure set , working. know need in order prepare side-by-side error? install redristributable bundle or that?

from event log message, looks wants newer version of vc90 c-runtime. 2 options:

the installer may have installed newer redistributable, reboot may still required finish process.

try installing latest c-runtime distributable yourself: microsoft visual c++ 2008 sp1 redistributable bundle (x86).

python c++ windows boost-python

Dart: Use Futures to asynchronously fill a static var -



Dart: Use Futures to asynchronously fill a static var -

i have defined static var map instances of element. if contains specific key, should utilize value. if key not contains instance should info request , save in static map, other instances utilize it.

class="lang-dart prettyprint-override">static var info = new map(); func() { if (elem.data.containskey(['key']) { list = elem.data['key']; } else { helper.getdata().then((requesteddata) { list = requesteddata; elem.data.addall({ 'key' : requesteddata }); } }

the problem instances go else, since key not contained in map @ moment other instances @ if. need them wait, until info in map.

class="lang-dart prettyprint-override">static var info = new map(); static completer _datacompleter; future<bool> func() { if(_datacompleter == null) { _datacompleter = new completer(); helper.getdata().then((requesteddata) { list = requesteddata; elem.data.addall({ 'key' : requesteddata }); _datacompleter.complete(true); }) } if(_datacompleter.iscompleted) { homecoming new future.value(true); } homecoming _datacompleter.future; }

and phone call like

class="lang-dart prettyprint-override">func().then((success) => /* go on here when `key` in `data` has value.

dart dart-async

c++ - time since epoch to string using boost -



c++ - time since epoch to string using boost -

auto timesinceepoch = boost::chrono::duration_cast<boost::chrono::microseconds>(boost::chrono::steady_clock::now().time_since_epoch()).count(); boost::posix_time::ptime now(boost::gregorian::date(1970, 1, 1), boost::posix_time::microsec(static_cast<std::int64_t>(timesinceepoch))); std::string str = boost::posix_time::to_iso_string(now);

output : 19700114t232422.133653 incorrect, doing wrong ?

on systems, epoch of steady_clock nanoseconds since boot.

you more useful expected result other clocks:

live on coliru

#include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/chrono.hpp> #include <string> #include <iostream> int main() { boost::posix_time::ptime const time_epoch(boost::gregorian::date(1970, 1, 1)); auto ms = (boost::posix_time::microsec_clock::local_time() - time_epoch).total_microseconds(); std::cout << "microseconds: " << ms << "\n"; boost::posix_time::ptime = time_epoch + boost::posix_time::microseconds(ms); std::cout << boost::posix_time::to_iso_string(now); }

prints

microseconds: 1415115992000000 20141104t154632

c++ boost time

javascript - Individual index.html files for each EmberApp -



javascript - Individual index.html files for each EmberApp -

i'm trying have 2 apps, related, have different access points server. ember build returns on index.html in dist/. next setup:

/* global require, module */ var emberapp = require('ember-cli/lib/broccoli/ember-app'); var mergetrees = require('broccoli-merge-trees'); var app = new emberapp(); var viewer = new emberapp({ storeconfiginmeta: false, trees: { app: 'viewer', templates: 'viewer/templates', styles: 'viewer/styles' }, outputpaths: { app: { css: '/assets/viewer.css', js: '/assets/viewer.js' }, vendor: { css: '/assets/viewer-vendor.css', js: '/assets/viewer-vendor.js' } } }); app.import('bower_components/socket.io-client/socket.io.js'); viewer.import('bower_components/socket.io-client/socket.io.js'); module.exports = mergetrees([viewer.totree(), app.totree()], { overwrite: true });

i able specify html output path well, after looking around in https://github.com/stefanpenner/ember-cli/blob/master/lib/broccoli/ember-app.js i'm no smarter should do. using different configs, doesn't work configpath.. errors:

enoent, no such file or directory '/users/user/project/tmp/tree_merger-tmp_dest_dir-fen1dz3z.tmp/project/config/environment.js'

ok, looks next version of ember-cli back upwards (current 0.1.2). see merged pr: https://github.com/stefanpenner/ember-cli/pull/2523

so isn't possible version, next, as:

app: { html: 'my-custom.html' }

edit

this feature introduced pr , released in v0.1.3, see changelog.

javascript ember.js build ember-cli

c++ - Integrating Cocos2d-x v2.2.5 into Marmalade -



c++ - Integrating Cocos2d-x v2.2.5 into Marmalade -

i've changed post question regarding error getting (which btw received no answers) actual instructions on how-to integrate cocos2d-x version 2.2.5 marmalade (because none found online). should prove valuable new marmalade developers , experienced developers alike. marmalade comes older , (oh dear, a) beta version of cocos2dx (version 2.1.0 beta3 of post) , want upgrade that. these instructions apply mac osx systems similar approach (minus directory soft-linking) can applied win32 systems well.

assuming you've downloaded , installed marmalade. download cocos2dx version 2.2.5 (or latest 2.x branch) open applications folder (from gui) , scroll downwards marmalade, right-click on marmalade , take show bundle contents. drill downwards next path ./contents/modules/third_party/ rename cocos2dx directory cocos2dx_2.1.0_beta3 (you can tell version of cocos2dx came marmalade opening ./cocos2dx/cocos2dx/ folders , viewing cocoos2d.cpp file.) create new folder called cocos2dx_2.2.5. copy next folders cocos2dx 2.2.5 download: cocos2dx, cocosdenshion, extenstions, external, licenses, scripting, tools. paste new cocos2dx_2.2.5 folder. open terminal , cd /applications/marmalade.app/contents/modules/third_party create soft-link new cocos2dx_2.2.5 directory: ln -s cocos2dx_2.2.5/ cocos2dx (note: win32 users, rename new directory cocos2dx).

performing ls -l under /applications/marmalade.app/contents/modules/third_party should yield looks similar following:

drwxr-xr-x@ 8 user admin 272 oct 1 08:35 photon drwxr-xr-x@ 6 user admin 204 oct 1 08:35 c-ares lrwxr-xr-x 1 user admin 15 nov 5 23:32 cocos2dx -> cocos2dx_2.2.5/ <-- soft-link drwxr-xr-x@ 9 user admin 306 oct 1 08:35 cocos2dx_2.1.0_beta3 <-- drwxr-xr-x 9 user admin 306 nov 5 23:28 cocos2dx_2.2.5 <-- drwxr-xr-x@ 7 user admin 238 oct 1 08:35 curl drwxr-xr-x@ 8 user admin 272 oct 1 08:35 expat drwxr-xr-x@ 6 user admin 204 oct 1 08:35 gaf drwxr-xr-x@ 11 user admin 374 oct 1 08:35 jsoncpp drwxr-xr-x@ 8 user admin 272 oct 1 08:35 libjpeg drwxr-xr-x@ 6 user admin 204 oct 1 08:35 libpng drwxr-xr-x@ 8 user admin 272 oct 1 08:35 lua drwxr-xr-x@ 7 user admin 238 oct 1 08:35 ode drwxr-xr-x@ 12 user admin 408 oct 1 08:35 openquick drwxr-xr-x@ 12 user admin 408 oct 1 08:35 openssl drwxr-xr-x@ 7 user admin 238 oct 1 08:35 sqlite drwxr-xr-x@ 6 user admin 204 oct 1 08:35 tiniconv drwxr-xr-x@ 10 user admin 340 oct 1 08:35 tinyxml drwxr-xr-x@ 6 user admin 204 oct 1 08:35 twitcurl drwxr-xr-x@ 7 user admin 238 oct 1 08:35 zlib

from on marmalade utilize latest 2.x release of cocos2dx. alter soft-link point newer version when comes out, or older version if have problems.

hope helps.

to in more marmalade friendly way, suggest following:

do not place code in marmalade sdk area - means everytime new sdk comes along have hack things, , won't work out of box.

instead add together next near top of mkb programs want use:

option module_path="whereeveriputcoscos/cocos2dx_2.2.5"

filling in right path. not tried it, basic method. 1 time you've got setup, utilize without having fiddle sdk first.

c++ xcode6 cocos2d-x marmalade

Strange PHP string compare effect, could this be made nicer? -



Strange PHP string compare effect, could this be made nicer? -

i've updated website , found annoying problem in pages resolved it, i'm not realy convinced should this. me i'm not php expert unusual behaviour explain me whats going on.

i had code:

if($menu == "index"){ {if ($language == "uk"){echo "<td><h1>welcome</h1>";} {if ($language == "nl"){echo "<td><h1>welkom </h1>";} } else // if $menu not index displayed hyperlink welcome page

the string thing here while checking language worked fine. comparing $menu did not work, if contained word index whole page generated on fly , string operations done before assumed maybe, despite tested with

echo "dump menu variable " . $menu

which resulted in jut displaying word index on page. maybe there go wrong in string types or that

so experimented with

if($menu === "index")

no luck

well solved

if (strpos($menu,'index' !==false)

is way should done???, don't sense comfortable it. me unusual $language works should (in opinion). there type problem here, or maybe unwanted endings \n perhaps ehm normalize string content of readable string comparions or, different type of equal operator. feels me $menu handled more easily. maybe reformat or i'm not sure here.

looks indeed index-string containing whitespaces, instead of strpos utilize trim( $menu ) rid of them.

but best prevent occurence. seek echo "dump menu variable |" . $menu ."|"; or var_dump( $menu ) identify additional characters.

maybe post, code-segment $menu filled.

(sorry can't comment)

php string compare

image - Javascript - getElementById that have existing ids which are created dynmaically -



image - Javascript - getElementById that have existing ids which are created dynmaically -

i building page in expressionengine , each time user adds new image, id of img element increments 1 (to give each image unique id). example, if admin uploads 3 images ids each mainimg0, mainimg1, mainimg2. user can add together many pictures need to.

i'm using next javascript/jquery allow frontend user print images input button, right code prints first image. what's best way in js grab each unique id when user clicks print, respective image opens in new tab , printed?

here's current js:

$(document).ready(function(){ $('#printimg').click(function(){ pwin = window.open(document.getelementbyid("mainimg0").src,"_blank"); pwin.onload = function () {window.print();} }); });

here's output of html:

<div class="machine_parts_left"> <div class="machine_parts_left_img"> <a class="fancybox-effects-c" href="{image}" title="{image_title}"><img id="mainimg0" src="{image}" alt="{image_title} diagram" /></a> <p>click zoom image</p> <input type="button" value="print image" id="printimg" /> </div> </div> <div class="machine_parts_left"> <div class="machine_parts_left_img"> <a class="fancybox-effects-c" href="{image}" title="{image_title}"><img id="mainimg1" src="{image}" alt="{image_title} diagram" /></a> <p>click zoom image</p> <input type="button" value="print image" id="printimg" /> </div> </div> <div class="machine_parts_left"> <div class="machine_parts_left_img"> <a class="fancybox-effects-c" href="{image}" title="{image_title}"><img id="mainimg2" src="{image}" alt="{image_title} diagram" /></a> <p>click zoom image</p> <input type="button" value="print image" id="printimg" /> </div> </div>

you traverse dom:

$('.printimg').click(function(){ // clicked element, find closest ancestor <div>, // search element <img> elements, utilize get() homecoming dom // node (not jquery collection): var img = $(this).closest('div').find('img').get(0), pwin = window.open(img.src,"_blank"); pwin.onload = function () {window.print();} });

note utilize of .printimg, instead of #printimg; since, seem realise in question, id must unique within document.

using class-selector (.printimg) requires amending html:

<div class="machine_parts_left"> <div class="machine_parts_left_img"> <a class="fancybox-effects-c" href="{image}" title="{image_title}"><img id="mainimg0" src="{image}" alt="{image_title} diagram" /></a> <p>click zoom image</p> <input type="button" value="print image" class="printimg" /> </div> </div> <!-- other repeated elements removed brevity -->

references:

closest(). find(). get().

javascript image printing expressionengine

java - What is a Null Pointer Exception, and how do I fix it? -



java - What is a Null Pointer Exception, and how do I fix it? -

what null pointer exceptions (java.lang.nullpointerexception) , causes them?

what methods/tools can used determine cause stop exception causing programme terminate prematurely?

when declare reference variable (i.e. object) creating pointer object. consider next code declare variable of primitive type int:

int x; x = 10;

in illustration variable x int , java initialize 0 you. when assign 10 in sec line value 10 written memory location pointed x.

but, when seek declare reference type different happens. take next code:

integer num; num = new integer(10);

the first line declares variable named num, but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing".

in sec line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot).

the exception asked occurs when declare variable did not create object. if effort dereference num before creating object nullpointerexception. in trivial cases compiler grab problem , allow know "num may not have been initialized" sometime write code not straight create object.

for instance may have method follows:

public void dosomething(integer num){ //do num }

in case not creating object num, rather assuming created before dosomething method called. unfortunately possible phone call method this:

dosomething(null);

in case num null. best way avoid type of exception check null when did not create object yourself. dosomething should re-written as:

public void dosomething(integer num){ if(num != null){ //do num } }

finally, how pinpoint exception location & cause using stack trace

java nullpointerexception

subprocess - Killing child processes created in class __init__ in Python -



subprocess - Killing child processes created in class __init__ in Python -

(new python , oo - apologize in advance if i'm beingness stupid here)

i'm trying define python 3 class such when instance created 2 subprocesses created. these subprocesses work in background (sending , listening udp packets). subprocesses need communicate each other , instance (updating instance attributes based on received udp, among other things).

i creating subprocesses os.fork because don't understand how utilize subprocess module send multiple file descriptors kid processes - maybe part of problem.

the problem running how kill kid processes when instance destroyed. understanding shouldn't utilize destructors in python because stuff should cleaned , garbage collected automatically python. in case, next code leaves children running after exits.

what right approach here?

import os time import sleep class a: def __init__(self): sfp, pts = os.pipe() # senderfromparent, parenttosender pfs, stp = os.pipe() # parentfromsender, sendertoparent pfl, ltp = os.pipe() # parentfromlistener, listenertoparent sfl, lts = os.pipe() # senderfromlistener, listenertosender pid = os.fork() if pid: # parent os.close(sfp) os.close(stp) os.close(lts) os.close(ltp) os.close(sfl) self.pts = os.fdopen(pts, 'w') # allow creator of inst self.pfs = os.fdopen(pfs, 'r') # send , receive messages self.pfl = os.fdopen(pfl, 'r') # to/from sender , else: # listener processes # sender or listener os.close(pts) os.close(pfs) os.close(pfl) pid = os.fork() if pid: # sender os.close(ltp) os.close(lts) sender(self, sfp, stp, sfl) else: # listener os.close(stp) os.close(sfp) os.close(sfl) listener(self, ltp, lts) def sender(a, sfp, stp, sfl): sfp = os.fdopen(sfp, 'r') # receive messages parent stp = os.fdopen(stp, 'w') # send messages parent sfl = os.fdopen(sfl, 'r') # received messages listener while true: # send udp packets based on messages parent , process # responses listener (some responses passed parent) print("sender alive") sleep(1) def listener(a, ltp, lts): ltp = os.fdopen(ltp, 'w') # send messages parent lts = os.fdopen(lts, 'w') # send messages sender while true: # hear , process incoming udp packets, sending # sender , parent print("listener alive") sleep(1) = a()

running above produces:

sender live listener live sender live listener live ...

actually, should utilize destructors. python objects have __del__ method, called before object garbage-collected.

in case, should define

def __del__(self): ...

within class a sends appropriate kill signals kid processes. don't forget store kid pids in parent process, of course.

python subprocess fork kill

javascript - Add a horizontal line to the chart -



javascript - Add a horizontal line to the chart -

i have requirement have horizontal lines in kendo line chart denote maximum , minimum values high limit , low limit.

another solution add together plotbands.

example:

<div id="chart"></div> <script> $("#chart").kendochart({ valueaxis: { plotbands: [ { from: 89, to: 90, color: "red" } ] } }); </script>

javascript kendo-dataviz kendo-chart

c++ - Unnamed and Named Namespace Resolution -



c++ - Unnamed and Named Namespace Resolution -

should reference name exists in both unnamed namespace , local named namespace result in error ambiguity or resolution well-defined? i'm seeing next work fine on g++ , clang, less on msvc.

namespace foo { class bar { public: int x; }; } namespace { class bar { public: int y; }; } namespace foo { void tester() { bar b; } } int main() { foo::tester(); homecoming 0; }

gcc , clang right. within foo::tester, unqualified utilize of bar unambiguously refers foo::bar.

unqualified lookup specified c++11 3.4.1/1:

the scopes searched declaration in order listed in each of respective categories; name lookup ends declaration found name.

the scopes searched utilize of name in function listed in 3.4.1/6:

a name used in definition of function [...] fellow member of namespace n [...] shall declared before utilize in block [...] or, shall declared before utilize in namespace n or, if n nested namespace, shall declared before utilize in 1 of n’s enclosing namespaces.

in case, function fellow member of foo, foo searched before enclosing (global) namespace, includes unnamed namespace. foo::bar found there, , lookup ends.

c++ namespaces

javascript - Renew Loading JSON Repeat Last Post -



javascript - Renew Loading JSON Repeat Last Post -

i made json script bring posts json page , when user scroll downwards renew loading bring more posts , works great problem when json load first time repeat lastly post. here live demo of script. how can see when scroll downwards end script show more posts repeating lastly post called "automatic slideshow blogger 3d gallery".

html code

<div id="result-container"> <ol></ol> <span class="loading">memuat...</span> </div>

css code

#result-container { height:400px; width:400px; overflow:auto; margin:50px auto; font:normal normal 12px 'trebuchet ms',trebuchet,geneva,arial,sans-serif; } #result-container ol { margin:0 0; padding:0 0; background-color:#b5d68c; } #result-container li { margin:0 0; padding:0 0; list-style:none; } #result-container li:nth-child(even) {background-color:#a2c179} #result-container li { display:block; padding:5px 10px; font-weight:bold; color:#396b18; text-decoration:none; } #result-container li a:hover { background-color:#396b18; color:white; text-decoration:none; } #result-container .loading { display:block; height:26px; font:normal bold 11px/26px arial,sans-serif; color:white; text-align:center; background-color:#b75a6f; border-top:2px solid #222; } #result-container .loading.the-end {background-color:#666}

javascript code

var widget_config = { home_page: 'http://www.dte.web.id', // blog homepage container_id: 'result-container', // id of result container script_id: 'load-on-scroll-end-script', // id of asynchronous script max_result: 25, // max result post @ 1 time script loading end_text: 'habis' // end text if posts has been loaded }; var elem = document.getelementbyid(widget_config.container_id), inner = elem.getelementsbytagname('ol')[0], loading = elem.getelementsbytagname('span')[0], start = 0, // dynamic start-index max = widget_config.max_result; function grablist(json) { var list = json.feed.entry, link, skeleton = ""; if (list !== undefined) { (var = 0; < list.length; i++) { (var j = 0; j < list[i].link.length; j++) { if (list[i].link[j].rel == "alternate") { link = list[i].link[j].href; } } skeleton += '<li><a href="' + link + '">' + list[i].title.$t + '</a></li>'; } inner.innerhtml += skeleton; // insert list container loading.style.display = "none"; // hide loading indicator } else { // if json empty (list == undefined), // add together new class loading indicator called `the-end` loading.classname += ' the-end'; // replace loading indicator text `fully loaded!` illustration loading.textcontent = widget_config.end_text; } } // create indirect script loader 2 parameters: start-index , max-result post function updatescript(a, b) { var head = document.getelementsbytagname('head')[0], script = document.createelement('script'); script.type = 'text/javascript'; script.id = widget_config.script_id; script.src = widget_config.home_page + '/feeds/posts/summary?alt=json-in-script&start-index=' + + '&max-results=' + b + '&callback=grablist'; // if there old script in document... if (document.getelementbyid(widget_config.script_id)) { var oldscript = document.getelementbyid(widget_config.script_id); // remove old script, , replace new 1 has updated start-index value oldscript.parentnode.removechild(oldscript); } head.appendchild(script); } // start loading callback script start-index of 1 updatescript(1, max); // when container beingness scrolled... elem.onscroll = function() { // ... check scroll distance if ((this.scrolltop + this.offsetheight) == inner.offsetheight) { // if distance equal height of inner container... start++; // increment start value 1 // load new script updated start-index updatescript(start*max, max); // , show loading indicator loading.style.display = "block"; } };

seems api link starting on index 1 not taken consideration when fetching next page.

try updatescript(start*max + 1, max);

javascript jquery html css json

c# - Default mvc/webapi site works in IIS Express but not in IIS 7.5 -



c# - Default mvc/webapi site works in IIS Express but not in IIS 7.5 -

i've googled , searched stackoverflow, next not helpful

restful service works in iis express / vs2013 not on iis server - hot prepare when run says "the update not applicable computer."

different result in iis express , iis - not running dotnetnuke or webmatrix

running win7pro, iis7.5 have vs2013pro udpate 3 installed, had vs14ctp installed uninstalled.

create new project, chose web application, mvc+webapi, have webapi 2.2 installed via nuget. create no changes app, nail f5, app starts in chrome, see default asp.net site link home , api. clicking api link takes help page describing api calls available.

publish site file system, create new iis website, point site published folder, add together defaultapppool user folder. browse site within iis manager. site displayes no styles displayed. setup site machinename:80 tried machinename:50102. not using ssl or authentication.

in chrome console there 3 errors (this not happen in iisexpress) uncaught syntaxerror: unexpected token < modernizr:1 uncaught syntaxerror: unexpected token < jquery:1 uncaught syntaxerror: unexpected token < bootstrap:1

trying navigate api link, refreshes page, help page not displayed.

using fiddler seek nail 1 of services in iis express works expected. using fiddler seek nail of servcies returns default home page.

please recall no changes made code, default mvc+webapi solution created.

checked application_start(), contains globalconfiguration.configure(webapiconfig.register); sec line.

any help appreciated.

it comes downwards how created solution. in visual studio 2013 professional, file->new project -> visual c# -> web -> asp.net web application click ok. in pop under "add folders , core refrences for:" mvc checked , greyed out, cannot un-select it. check "web api" check box, click ok. work fine while working in vs. 1 time published release. point iis @ published folder, if needed, navigate page. page loads has errors described above.

to avoid this, not check "web api" check box when creating new project. add together web api solution after creating it, not during creation.

vs version 12.0.31101.0 update 4 .net version 4.5.52747

c# asp.net-mvc iis asp.net-web-api iis-express

c# - how to insert value to database that is fetched by jquery using json autocomplete in asp.net -



c# - how to insert value to database that is fetched by jquery using json autocomplete in asp.net -

to whom may respond to,

we trying insert info oracle dbms, fetched json calling asp.net webservices. here,aspx page modified code stackoverflow answer. have utilize json 1 time again send values codebehind ? if so, how? http://www.codingfusion.com/post/jquery-json-add-edit-update-delete-in-asp-net sample scripts

thank concern

<%@ page title="home page" language="c#" masterpagefile="~/site.master" autoeventwireup="true" codebehind="default.aspx.cs" inherits="test7._default" %> <asp:content id="headercontent" runat="server" contentplaceholderid="headcontent"> </asp:content> <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <asp:scriptmanagerproxy id="scriptmanagerproxy1" runat="server"> <scripts> <asp:scriptreference path="scripts/jquery-1.11.1.min.js" /> <asp:scriptreference path="scripts/jquery-ui.min.js" /> </scripts> </asp:scriptmanagerproxy> <div id="outer" style="width: 100%; background-color: #737ca1"> <div id="headdiv" style="width: 90%; background-color: #737ca1"> <script type="text/javascript" id="butcelist"> $(function () { $("#txtbutce").autocomplete({ source: function (request, response) { var param = { prefixtext: $('#txtbutce').val() }; $.ajax({ url: "default.aspx/getbutce", data: json.stringify(param), datatype: "json", type: "post", contenttype: "application/json; charset=utf-8", datafilter: function (data) { homecoming data; }, success: function (data) { response($.map(data.d, function (item) { homecoming { value: item } })) }, error: function (xmlhttprequest, textstatus, errorthrown) { alert(textstatus); } }); }, minlength: 2//minlength 2, means when ever user come in 2 character in textbox autocomplete method fire , source data. }); }); </script> <script type="text/javascript" id="tiplist"> $(function () { $("#txttip").autocomplete({ source: function (request, response) { var param = { prefixtext: $('#txttip').val() }; $.ajax({ url: "default.aspx/gettip", data: json.stringify(param), datatype: "json", type: "post", contenttype: "application/json; charset=utf-8", datafilter: function (data) { homecoming data; }, success: function (data) { response($.map(data.d, function (item) { homecoming { value: item } })) }, error: function (xmlhttprequest, textstatus, errorthrown) { alert(textstatus); } }); }, minlength: 2//minlength 2, means when ever user come in 2 character in textbox autocomplete method fire , source data. }); }); </script> <script type="text/javascript"> function openmodalform() { window.showmodaldialog('details.aspx', '', 'status:1; resizable:1; dialogwidth:900px; dialogheight:500px; dialogtop=50px; dialogleft:100px') } </script> <script type="text/javascript"> function savedata() { //==== phone call validatedata() method perform validation. method homecoming 0 //==== if validation pass else returns number of validations fails. //var errcount = validatedata(); //==== if validation pass save data. var txtbutce = $("#txtbutce").val(); var txttip = $("#txttip").val(); $.ajax({ type: "post", url: "default.aspx/savedata", data: json.stringify({butce:txtbutce,tip:txttip}), contenttype: "application/json; charset=utf-8", datatype: "jsondata", async: "true", success: function (response) { $(".errmsg ul").remove(); var myobject = eval('(' + response.d + ')'); if (myobject > 0) { $(".errmsg").append("<ul><li>data kaydedildi</li></ul>"); } else { $(".errmsg").append("<ul><li>kayıt işleminde hata olustu, tekrar deneyiniz.</li></ul>"); } $(".errmsg").show("slow"); clear(); }, error: function (response) { alert(response.status + ' ' + response.statustext); } }); } </script> <div class="ui-widget"> <label for="txtbutce" >bütçe kodu/lokasyon: </label> <input id="txtbutce"> <br /> <label for="txttip">tip/alttip: </label> <input id="txttip" /> </div> <asp:label id="lbldateinfo" runat="server" style="color: white;" /><br /> <asp:button id="btncalshow" runat="server" text="tarih seçiniz" /> <asp:button id="btnshow" runat="server" text="show modal popup" /> </div> <br /> <asp:button id="btnpenaltycalculate" text="hesapla" runat="server" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px;" /> <asp:button id="btnpenaltysubmit" text="kaydet" runat="server" style="margin-left: 5px; margin-top: 5px; margin-bottom: 5px;" /> <%-- %> <asp:button id="btnrefresh" runat="server" text="haftayı yeniden yükle" style="margin-left:60px;margin-top:5px;margin-bottom:5px;" /> --%> </div> </asp:content>

you need ajax post webmethod (or asp.net postback) send info server can update database.

c# jquery asp.net json database

How can I Configure Linux Mint 17 to get the latest VirtualBox -



How can I Configure Linux Mint 17 to get the latest VirtualBox -

how can configure linux mint 17 (64bits) can latest version of virtual-box (which 4.3.18) via aptitude?

aptitude show virtualbox-4.3:amd64 shows 4.3.12 version available in repos.

the way i've set (like mentioned in official vb docs) adding "trusty repo" sources.list .i guess should me latest updates. still same problem!

i activated unstable romeo channel via settings>software sources .still same problem; not getting latest update.

again, want latest updates via aptitude not installing .deb package. so, please. thoughts how that? ps: have set actual vb installation check updates daily, , new releases , pre-releases

that happens because there bundle same name in repository apt considers have higher priority. illustration if run

> apt-cache policy virtualbox-4.3

it output along lines of

virtualbox-4.3: installed: 4.3.12-93733~ubuntu~raring candidate: 4.3.12-93733~ubuntu~raring version table: 4.3.20-96996~ubuntu~raring 0 500 http://download.virtualbox.org/virtualbox/debian/ trusty/contrib amd64 packages *** 4.3.12-93733~ubuntu~raring 0 700 http://extra.linuxmint.com/ qiana/main amd64 packages 100 /var/lib/dpkg/status

which means 4.3.12 version installed , won't upgraded 4.3.20 though version available official repo.

now, there several ways solve this. simple 1 create

> /etc/apt/preferences.d/virtualbox-org.pref

file next content

package: * pin: origin download.virtualbox.org pin-priority: 800

running command 1 time again output

virtualbox-4.3: installed: 4.3.12-93733~ubuntu~raring candidate: 4.3.20-96996~ubuntu~raring version table: 4.3.20-96996~ubuntu~raring 0 800 http://download.virtualbox.org/virtualbox/debian/ trusty/contrib amd64 packages *** 4.3.12-93733~ubuntu~raring 0 700 http://extra.linuxmint.com/ qiana/main amd64 packages 100 /var/lib/dpkg/status

which shows 4.3.20 candidate installation. run

> sudo aptitude install virtualbox-4.3

4.3.20 installed , you'll happy forever.

if want begin learning how magic works take @ https://help.ubuntu.com/community/pinninghowto

linux virtualbox linuxmint

Cognos BI 10.1.2 how to create a new user? -



Cognos BI 10.1.2 how to create a new user? -

i'm trying create new user in cognos bi 10.1.2.

after bit of research i've discovered new user must created in "authentication source" such example: ibm cognos series 7 namespace, active directory server, custom authentication provider, ldap, ca siteminder, racf, sap.

so question is, how setup "authentication source" , users create in authentication source shown in cognos connection web portal?

cognos cognos-bi cognos-10

sitecore - how to manage presentation details for multiple pages in single place -



sitecore - how to manage presentation details for multiple pages in single place -

i have next item construction in sitecore:

root (tab 1)tab 2tab 3tab 4

items can accessed urls:

/root/root/tab-2/root/tab-3/root/tab-4

this items renders tabs user , user can click tab , switch other tab. on /root first tab active.

items have few placeholders: header, footer, content, aside, , tab.

all items have render same controls placeholders except "tab" placeholder. tab placeholder have different controls, see different things on each tab.

easy solution inquire client edit controls on items. instance if want's add together image above tabs, have add together image on items: root, tab 2, tab 3, tab 4.

but need solution this, client edit controls in 1 place. have separate controls each tab.

update:

i using ajax request switching tabs, regular request should work tabs , urls tabs should above. of course of study can specify initial set of controls on _standard values template, when editor alter within page editor should reflect on tabs.

so far come next solution (but editing in page editor in not working tabs root one):

i crated processor within pipeline (after: sitecore.pipelines.insertrenderings.processors.getitem):

class="lang-cs prettyprint-override">public class setroottabascontextitem : insertrenderingsprocessor { /// <summary> /// processes specified args. /// </summary> /// <param name="args">the argumentss.</param> public override void process(insertrenderingsargs args) { assert.argumentnotnull(args, "args"); var contextitem = context.item; if (contextitem.isinsideroottab()) { args.contextitem = context.item.getroottabitem(); } } }

i created additional placeholders tabs: tab_1, tab_2, tab_3. within tab placeholder there sublayout has additional placeholders in displaying placeholder should visible on specific tab.

so tab's presentation details configured on root tab. processor created controls root tab rendered on tabs.

but sadly page editor working on root tab. when i'm trying add together command page editor when i'm on not root tab, i'm getting javascrip error, null reference.

another alternative utilize jquery/javascript based tab plugin (something jquery ui tabs). in "root" item add together tab control, renders required html markup (to match spec of javascript tab plugin).

the tab command should @ it's datasource value or if not set iterate on it's own children specific template. need decide best placed. in global shared folder, straight beneath content item (putting in folder in case there sub-navigation number page)... both have advantages , disadvantages, comes downwards design selection based on requirements , preference.

your url's change, using hashes instead of specific paths end result same. can see illustration of on tab page linked to.

/root /root#tab-2 /root#tab-3 /root#tab-4

so rest of page same. also, advantage of there no page reload in order show content.

remember design component page editor in mind, javascript plays little bit of funkiness additional markup sitecore injects in, can detect page mode in javascript.

edit:

personally not bother ajax load unless there big amounts of info nowadays in tabs, call.

an alternative insert processor after itemresolver, checks if current request tab template. if so, set context.item parent. can switch right tab using javascript extract lastly part of current url (which should same tab id). if utilize right controls , set item on correctly pageeditor should work.

it get's tricky if need ajax load tab data, since request tab url redirect user (essentially). pass additional parameter in ajax call, ?request=ajax or check request type. processor skip it's logic , homecoming tab content instead. of course of study not work in pageeditor, instead need add together logic sublayout check if page in editing mode fall not using ajax.

sitecore sitecore7.2

html - Jquery Select element before and Element after remove/add class -



html - Jquery Select element before and Element after remove/add class -

i'm trying remove 2 classes div content:

<div class="content"> <div class="1 hide">class1</div> <div class="2">class2</div> <div class="3 hide">class3</div> </div> <div class="content"> <div class="1 hide">class1</div> <div class="2">class2</div> <div class="3 hide">class3</div> </div> <div class="content"> <div class="1 hide">class1</div> <div class="2">class2</div> <div class="3 hide">class3</div> </div> <script> $( ".content" ).click(function() { remove classes hide class 1 , 3 in content div if clicked on div leave other content divs class 1 , 3 hidden }); </script>

whats best way can't figure out how :(

thanks helping!

you need utilize context bases selector like

class="snippet-code-js lang-js prettyprint-override">$(".content").click(function () { $(this).find('.hide').removeclass('hide') }); class="snippet-code-css lang-css prettyprint-override">.hide { display: none; } class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="content"> <div class="1 hide">class1</div> <div class="2">class2</div> <div class="3 hide">class3</div> </div> <div class="content"> <div class="1 hide">class1</div> <div class="2">class2</div> <div class="3 hide">class3</div> </div> <div class="content"> <div class="1 hide">class1</div> <div class="2">class2</div> <div class="3 hide">class3</div> </div>

jquery html class

javascript - validation on a required field -



javascript - validation on a required field -

working validation example: http://www.w3schools.com/aspnet/showaspx.asp?filename=demo_validationsum

using asp.net display error message 'you must come in value in next fields:' include field name wrong, when info incorrectly entered.

so far user cant go on until right info entered , reddish * appears beside column. add together error message.

<div id="floater_editdata_panel_popup" title="feature information" class="floaterdiv"> select feature view/edit feature information. <p>&nbsp;</p> <asp:updatepanel runat="server" id="updatepaneldetails1" updatemode="conditional" childrenastriggers="false"> <contenttemplate> <asp:placeholder id="placeholder1" runat="server" > </asp:placeholder> <br /> <br /> <div id="editdatapanelmessageoutput" style="color:red;"> <asp:validationsummary id="validationsummary1" headertext="you must come in value in next fields:" displaymode="bulletlist" enableclientscript="true" runat="server"/> </div> <div id="featuremeasureoutput"></div> <br /> <br /> <div class="buttonwrap"> <div id="span2" class="actionbtns" style="display: inline-block;" > <asp:button runat="server" id="updatebutton" value="save" text="save" onclientclick="validateeditdata();" causesvalidation="true" validationgroup="g_currentselectedlayername" /> </div> </div> </contenttemplate> </asp:updatepanel> </div> function validateeditdata() { if (page_clientvalidate(g_currentselectedlayername)) { //alert('it valid'); updatefeature(); homecoming true; } else { //alert('data not valid'); homecoming false; } }

shouldnt validation summary tag apply entire page?

how about:

<asp:validationsummary id="validationsummary1" headertext="you must come in value in next fields:" displaymode="bulletlist" enableclientscript="true" validationgroup="g_currentselectedlayername" runat="server"/> <asp:textbox id="txtfirstname" runat="server"></asp:textbox> <asp:requiredfieldvalidator runat="server" display="dynamic" controltovalidate="txtfirstname" errormessage="first name required" validationgroup="g_currentselectedlayername"></asp:requiredfieldvalidator> <asp:button runat="server" text="submit" validationgroup="g_currentselectedlayername" />

and add together appsetting web.config:

<appsettings> <add key="validationsettings:unobtrusivevalidationmode" value="none" /> </appsettings>

javascript html asp.net requiredfieldvalidator

python - Weird load_module input parameters -



python - Weird load_module input parameters -

i have written custom python module loader/importer has find_module , load_module methods. run bit of problem when want import cherrypy module it.

in

cherrypy/__ init __.py

it has lines such as:

from cherrypy._cpcompat import urljoin

when utilize default python importer, adding false importer such as:

class fakeimporter(object): def find_module(self, module_name, path=none): print module_name, path homecoming none

i next calls:

find_module('cherrypy')

find_module('cherrypy.cherrypy')

find_module('cherrypy._cpcompat')

sounds normal. when utilize custom loader calls:

find_module('cherrypy')

find_module('cherrypy.cherrypy')

find_module('cherrypy.cherrypy._cpcompat')

what causing issue? handling load_module('cherrypy.cherrypy') wrong? load module memory, set cherrypy.path ['cherrypy'], set file 'cherrypy', loader loader, name 'cherrypy' , package 'cherrypy'. there missing?

i figured out wrong: in find_module returned importer, blocked absolute imports ever happening.

python python-2.7 package python-import

sql - pgSQL to overwrite one set of table rows with another based on ID -



sql - pgSQL to overwrite one set of table rows with another based on ID -

i have table along lines of -

set_id, id, ... 0, 1, a, b, ... 1, 1, c, d, ... 2, 1, e, f, ... 0, 2, g, h, ... 1, 2, i, j, ... 2, 2, k, l, ...

where (set_id, id) primary key

i replace fields except set_id entries set_id 0 equivalent entry (if exists) set_id 1. table above become -

set_id, id, ... 0, 1, c, d, ... < 1, 1, c, d, ... 2, 1, e, f, ... 0, 2, i, j, ... < 1, 2, i, j, ... 2, 2, k, l, ...

is there sane way in sql or need utilize client side code?

thanks

if i'm reading correctly, want re-create info in row set_id=1 row set_id=0 each value of id.

one way of doing simple update from;

update mytable set field_a = ms.field_a, field_b = ms.field_b mytable ms mytable.id=ms.id , mytable.set_id=0 , ms.set_id=1

note need list fields want moved, "row copy" not automatic fields.

an sqlfiddle test with.

sql database postgresql

android - Check if Fragment exists in Fragment TabHost Activity -



android - Check if Fragment exists in Fragment TabHost Activity -

i have activity a, implements fragment tab host 2 tabs. first tab list view , sec tab has same info in expandable list view. below code snippet fragment activity:

mtabhost = (fragmenttabhost) findviewbyid(android.r.id.tabhost); mtabhost.setup(this, getsupportfragmentmanager(), r.layout.activity_list); mtabhost.addtab( mtabhost.newtabspec("tab1").setindicator("list"), listfragment.class, null); mtabhost.addtab( mtabhost.newtabspec("tab2").setindicator("exlist"), expandablelistfragment.class, arg2);

now issue if phone call activity 1 time again creating fragments again. need check if fragment exists need not add together new one. tried below stuff isn't working

fragment f = getsupportfragmentmanager().findfragmentbytag("list"); if (f!=null && f instanceof listfragment){ log.i("listactivity","already created"); }

for above code getting null fragment f when activity called again. read similar posts nil seem working. please advise how can create sure fragments not created 1 time again when listactivity called. thanks.

i don't think should matter maintain instance of fragment live in tabactivity. if activity not destroyed, won't fragments be. if activity destroyed, , fragments too, it's not big problem recreated, old instance cleaned garbage collector. don't understand why you'd want command behavior. initialize tabbar in oncreate() of activity, destroy in ondestroy() , allow android lifecycle it's job.

android android-fragments

Getting creation-SQL of a table in HP Vertica using a query -



Getting creation-SQL of a table in HP Vertica using a query -

i using hp vertica db engine. there tables created in database. have requirement wherein need create-table script of table given table name querying on system-table or stored-proc or otherwise. help in reaching need highly appreciated. thanks.

the easiest way table definition table using export_tables(). function allows multiple objects scope.

you can script export statement , execute within script, such as:

select 'select export_tables('''', ''' || table_schema || '.' || table_name || ''');' v_catalog.tables;

alternatively, can roll schema level using:

select export_tables('', 'schema');

the difference beingness export_tables not produce definition projections associated table. if need projection table definition, utilize export_objects.

sql vertica