Posts

Showing posts from September, 2013

signals - Qt Unique connection -

i wondering either there possibility in qt, co create signal-slot connection, automatically break other connections particular slot/ signal? appreciate help. qt doesn't provide such functionality directly. moreover, it's impossible iterate signal-slot connections, can't implement in general. what should doing keeping track of connections initiate yourself, , removing them appropriate. for example: enum class connectiondisposal { dispose, keep }; class uniqueconnector { q_disable_copy(uniqueconnector) qmetaobject::connection m_conn; connectiondisposal m_cd; public: explicit uniqueconnector(connectiondisposal cd = connectiondisposal::dispose) : m_cd(cd) {} ~uniqueconnector() { if (m_cd == connectiondisposal::dispose) disconnect(); } template <typename t, typename r> qmetaobject::connection connect(const qobject * tx, t txf, const qobject * rx, r rxf, qt::connectiont

ios - Can I assign two buttons to a same action or outlet in Xcode 7? -

Image
i have created user interface iphones in 'w compact h any' tab in interface builder. decided make different interface ipad version of app, in 'w regular h regular', when dragging buttons , labels actions , outlets in viewcontroller.h file, replace buttons , labels in other interface. is there way can preserve both @ same time? you can click+drag from ibaction method's little connector circle straight to control in storyboard, if it's been connected 1 (and think can drag storyboard object ibaction too). just keep in mind if you're using different classes, you'll want use id , check class name before stuff it: - (ibaction)buttonpressed:(id)sender { if ([sender iskindofclass:[uibutton class]]) { // } } to verify it's connected both, click method circle: if you're writing swift in xcode 7 or 8, method created use any type; you'll need change uibutton in order work: @ibaction func buttonpressed(s

numpy - Convert custom class to standard Python type -

i working numpy array called predictions . playing around following code: print type(predictions) print list(predictions) the output was: <type 'numpy.ndarray'>` [u'yes', u'no', u'yes', u'yes', u'yes'] i wondering how numpy managed build ndarray class converted list not own list function, standard python function. python version: 2.7, numpy version: 1.9.2 i have answered pure python perspective below, numpy 's arrays implemented in c - see e.g. the array_iter function . the documentation defines argument list iterable ; new_list = list(something) works little bit like: new_list = [] element in something: new_list.append(element) (or, in list comprehension: new_list = [element element in something] ). therefore implement behaviour custom class, need define __iter__ magic method : >>> class demo(object): def __iter__(self): return iter((1, 2, 3)) >>&g

c# - System.Web.MVC.ModelState does not have a definition for IsValid -

in mvc 5 application, have try-catch block in deleteconfirmed actionresult works well. don't repeat code, tried place indicated part of following code block function outside controller. added function custom errorlog class, when did, intellisense indicated "system.web.mvc.modelstate not have definition isvalid." this link indicates error comes trying use modelstate class instead of property. however, article did not indicate should done instead. below code have followed do. question need differently can save errorlog entry database table? this code have in controller catch (exception e) { var _e = new errorlog().fillandsend(e, "delete", "childactionnames"); // following identical each time use catch(exception e) block unitofworkerrorlog uw = new unitofworkerrorlog(); if (modelstate.isvalid) { uw.errorlogrepository.insert(_e); uw.save(); return view("errormanaged"); } } this

c++ - Poisson Reconstruction Function not compiling -

i trying implement poisson reconstruction function in cgal , however, bombarded whole host of errors. i know line causing errors line: poisson_reconstruction_function function(points.begin(), points.end(),cgal::first_of_pair_property_map<pointvectorpair>(),cgal::second_of_pair_property_map<pointvectorpair>()); this not on documentation, have this: poisson_reconstruction_function function(points.begin(), points.end(), cgal::make_normal_of_point_with_normal_pmap(pointlist::value_type()) ); but line comes whole host of errors. any appreciated, , please let me know if need more information! thanks! here full code: (header file) #ifndef __tutorials__cgaldelaunaytriangulation__ #define __tutorials__cgaldelaunaytriangulation__ #include <stdio.h> #include <cgal/exact_predicates_inexact_constructions_kernel.h> #include <cgal/exact_predicates_exact_constructions_kernel.h> #include <cgal/triangulation_3.h> #include <cgal/delauna

sql server 2008 - Insert into table with auto-increment field -

i have 2 tables called hrdata , hrdatahistory. hrdatahistory has same structure hrdata except first column autoincrement field , last column datetime field. hrdata has trigger: create trigger [hr].[hrdata_history] on [hr].[hrdata] after insert, update insert hr.hrdatahistory select *, getdate() inserted ; go this working on existing development machine. trying mirror relationship on local sql server instance can test changes. using ssms used 'script table create to...' , created structure of each table , index on local sql server instance. when trigger following error: an explicit value identity column in table 'hr.hrdatahistory' can specified when column list used , identity_insert on. i know preferred method specify columns, want mirror production not , further want understand why working in production not on test database. you're getting error because you're trying insert data identity column, auto-populates whenever in

sql server - Import Table definition (fields) from excel sheet -

my excel sheets contains table definitions follows: fieldname fieldtype id int name text each sheet represents different table , got 20 tables total of 800 fields.i need creating these tables in database, in quickest way possible. solutions have in mind are: 1- create them 1 one manually 2- copy , past excel sheet field definitions sql management studio , add/adjust necessary syntax each field "create table" query. i find both of these solutions time-consuming, there way directly import table definition excel sheet? there few ways build table definitions in excel. either through vb script/macro and/or excel formulas. vb script provide opportunity more robust solution more involved. however, formulas can of job done quickly. i put example formulas. in question, present field name , field type. helpful add field width , precision variable length string fields , numeric fields. mentioned using sql server. in case

c# - Checking if root nodes and child nodes in a TreeView are the same -

so have treeview , checking duplicates. if add node tree , try add same node, code won't let happen. want. need check child nodes, if root nodes same if first child of root node different 1 being added, want add child nodes under root node that's there. have tried: if(node.text == root.text && node.firstnode.text == root.firstnode.text) nodes.remove(node); but gives me null exception on root.firstnode.text , i'm not sure why getting null when node.firstnode.text shows child node. any suggestions appreciated. it means whatever node you've assigned root has no children (hence root.firstnode null). node.firstnode can still show it's first child node if whichever node assigned 1 different 1 assigned root . the important thing here because have same text, doesn't mean same node. judging code provided, referring different object (with different collections of child nodes, or lack of) i'm imagining following (not actual c

TravisCI test elasticsearch error with Python 2, ok for Python 3 -

my tests in travis failed when connecting elasticsearch. have error, python 2.x : connectionerror: connectionerror(('connection aborted.', responsenotready())) caused by: protocolerror(('connection aborted.', responsenotready())) for python 3.x (same code), works fine. any idea of going wrong ? fine time ago. i had exact same problem , saw post posted few hours. after digging, found urllib3 version 1.11 breaks elasticsearch reason. pinned version urllib3==1.10.3 , seems working.

C# file not saving on correct folder -

i need save txt file on correct create folder. saving on c:\nova pasta need save on "c:\nova pasta\"+valor.retorna_nome+combobox1.text whats wrong ? private void btn_savefile_click(object sender, eventargs e) { objsql.search_rgp_cadastroprint(convert.toint32(combobox1.text), str_list); objsql.searchprint(convert.toint32(combobox1.text)); string path = @"c:\nova pasta\"+valor.retorna_nome+combobox1.text; if (!directory.exists(path)) { directory.createdirectory(path); } streamwriter file = new system.io.streamwriter(path + ".txt"); file.writeline("---------------------------------------------------------------------------------------------------------"); file.writeline("nome: " + valor.retorna_nome); file.writeline("rgp: " + combobox1.text); file.writeline("endereço: " + valor.retorna_endereco); file.writeline("telefone: " + valor.retorna_telef

c++ - Continually erasing a string leads to an infinite loop -

what trying take path in , continually erase path directory directory, checking see if symbolic link @ point. here have: static bool islinkdirinsymlink (std::string linkpath) { dir *basedir; struct dirent *currentdir; { basedir = opendir(linkpath.c_str()); if (basedir) { currentdir = readdir(basedir); if (currentdir->d_type == dt_lnk) return true; } linkpath.erase (linkpath.find_last_of("/") + 1, linkpath.find_first_of("\0")); } while (strcmp(linkpath.c_str(), "") != 0); return false; } this gets stuck in infinite loop. when run program in gdb happens send in linkpath of /home/user/test/linktest/out/mdirs/testdir1/test , when erases , left /home/user/test/linktest/out/mdirs/testdir1 , infinite loop begins. though in same format first path when goes erase , nothing happens. have tried many different variations of er

javascript - fade out of alphabet onkeypress of letter equal to value in a div -

i want add riddle website , i've got question template. below <table width="474" border="0" align="center" cellpadding="7" cellspacing="7"> <tr> <td width="41"><label for="riddle">riddle</label></td> <td colspan="6">what goes , never comes down?</td> </tr> <tr> <td>&nbsp;</td> <td width="52"><div id="div1" class="answerbox">a</div></td> <td width="25"><div id="div2"class="answerbox">s</div></td> <td width="50"><div id="div3"class="answerbox">d</div></td> <td width="50"><div id="div4"class="answerbox">f</div></td> <td width="50"><div

ubuntu - InvalidProtocolBufferException: on Impala connecting to Hadoop 2.x.x -

i have installed cdh hadoop hadoop-2.5.0-cdh5.3.2 , impala 2.1 http://archive.cloudera.com/impala/ubuntu/precise/amd64/impala/pool/contrib/i/impala/ in ubuntu 12.04 64 bit version . i configured both hadoop , impala. i want use impala query csv on hdfs directly . my hadoop along hdfs , running . but whenever trying make impala , getting below error. failed on local exception: com.google.protobuf.invalidprotocolbufferexception: message missing required fields: callid, status; host details : local host is: "localhost/127.0.0.1"; destination host is: "localhost":54310; i understand hadoop 2 using protobuf version 2.5 impala have installed using protobuf version 2.4 . please me how sort out problem . how install hadoop 2.x version working impala ??? thanks !!! i resolved issue . problem due protobuf version mismatch. the impala using hdfs directly without taking of mapreduce framework . in order talk each other need use common protob

Wordpress Gravity Forms: Pass dropdown's value to 2nd page's dropdown -

i have wordpress gravity form. on 1st page of form, have dropdown box dynamically populated. no problems here. now, on 2nd page of same form , have dropdown need dynamically populate too, based on selected option 1st dropdown. is possible, , if so, not complicated do? here's example i'm populating drop down on page 2 post meta based on post selected drop down on page 1: add_filter( 'gform_pre_render_918', 'populate_post_meta' ); add_filter( 'gform_pre_validation_918', 'populate_post_meta' ); add_filter( 'gform_pre_submission_filter_918', 'populate_post_meta' ); add_filter( 'gform_admin_pre_render_918', 'populate_post_meta' ); function populate_post_meta( $form ) { $field_id = 3; $post_field_id = 1; foreach ( $form['fields'] &$field ) { if ( $field->id != $field_id ) { continue; } // can add additional parameters here alter

ios - Call using an app when uibutton is clicked -

i have app displays telephone number, , number in uibutton. when button clicked, want call. best way it? get text button nsurl , pass in: let url = nsurl(string: button.currenttitle) uiapplication.sharedapplication().openurl(url)

javascript - Instantly detect an input being checked -

say have input type "checkbox" <input type='checkbox' id='checker'> i need able detect instantly whether box checked, without button click or function call. checking , unchecking box lighten or darken text. how check whether box unchecked or not in vanilla javascript? need able this, preferably without infinite for-loop that'll crash page. know method it var value=document.getelementbyid('checker').checked; but need way see whether has been checked or not without reloading page using vanilla javascript. please help! edit: considering using 2 radio buttons, 1 value true , other value false, still need way of seeing 1 checked. check working demo: http://jsfiddle.net/rrath8tg/1/ : // checkbox reference element checkbox.onchange = function() { if(this.checked) { // when checked } }; or onchange on checkbox element.

cmd - Find PID by searching for a process keyword -

in task manager, find several processes running, process description not short on server , difficult identify process based on description. is there script through can search pid searching keyword in description. eg: searching keyword "weblogic" you can use below command find out weblogic process pid using port on windows: netstat -ano|find /i "7001" where 7001 weblogic port. check last column of output pid

Rails: How to create an url shortener? -

i'm not sure if url shortener right name it, because of search results point toward things bit.ly . so, here want: given url strings like: http://avc.com http://firstround.com/review/feed/ http://svpg.com/articles/ http://www.medium.com/ http://www.paulgraham.com/ turn avc.com firstround.com svpg.com medium.com paulgraham.com no subdomain, no subdirectory, no / . i can url.split('://')[1].split('/')[0] , cannot rid of www , , i'm wondering if there better way of doing it? you can use uri module , use regexp parse out first www. like def host(url) uri = uri.parse(url) uri.host.sub(/^www./, '') end

ios - Array does not perform a command in swift -

this question has answer here: how find index of list item in swift? 11 answers array not perform command in swift i show simple example var array = ["x", "y", "z"] var index = array.indexof("y") i error '[string]' not have member named 'indexof' i saw this question doesn't me. i imported import uikit import foundation import avfoundation import coreaudio import mediaplayer import avkit indexof available in swift 2.0

memorystream to datatable in c# -

will please me out data memory stream datatable below code m following var config = new marketplacewebserviceconfig { serviceurl = serviceurl }; var client = new marketplacewebserviceclient(awsaccesskeyid, secretkey, appname, version, config); var request = new getreportrequest { merchant = sellerid, reportid = reportid }; var ms = new memorystream(); request.report = ms; var response = client.getreport(request); please me out form ms data table m not able make it thanks, jimmy darji first of format memorystream data in? example, message stream below in binary format receive data memeorystream object tell start @ beginning of stream , deserialise object want. memorystream mem = (memorystream) incoming.bodystream; mem.seek(0, seekorigin.begin); iformatter ifm = new binaryformatter(); var tt = (travelmessageserviceobjects) ifm.deserialize(mem); tt can use

json - Scala Play 2.4 Serialize with Parameter Type -

i took at: scala type deferring , looks close problem can't resolve answer, unfortunately. so, here's code: my genericmodel abstract class genericmodel[t] { val _id: option[bsonobjectid] def withid(newid: bsonobjectid): t } my implemented model case class push (_id: option[bsonobjectid], text: string) extends genericmodel[push] { override def withid(newid: bsonobjectid) = this.copy(_id = some(newid)) } object push{ implicit val pushformat = json.format[push] } my dao, using case class trait genericdao[t <: genericmodel[t]] { val db: db val collectionname: string /** * inserts new object * @param newobject * @return some(stringified bsonid) or none if error */ def insert(newobject: t)(implicit tjs: writes[t]): future[option[bsonobjectid]] = { val bsonid = bsonobjectid.generate val beaconwithid = newobject.withid(bsonid) db.collection[jsoncollection](collectionname).insert(beaconwithid).map{ lasterror => if(

ios - NSURLSessionUploadTask request pause and resume causes 400 -

while app goes background,i pause the upload task amazon s3 , resuming same task on foreground.this causes nsurlsession 's delegate method didcompletewitherror:(nserror *) error throw 400 , error nil , fails upload. how solve problem

javascript - Controlling an embeded player -

i've got embedded sc player on page , want user able jump specific timecodes within sound file links on page. i've got working first click. if user clicks on link segment, sc player ignores it. keeps playing along , ignores input. here's relevant code: function playsc(seekto){ seekto = hmstoms(seekto); var container = document.getelementbyid("scplayer"); var iframe = container.getelementsbytagname("iframe"); var widgetiframe = iframe[0], widget = sc.widget(widgetiframe); widget.bind(sc.widget.events.ready, function() { widget.play(); }); widget.bind(sc.widget.events.play, function() { widget.seekto(seekto); }); widget.bind(sc.widget.events.seek, function() { widget.unbind(sc.widget.events.play); }); widget.bind(sc.widget.events.pause, function() { widget.unbind(sc.widget.events.play); }); widget.bind(sc.widget.events.play, function() { widget.unbind(sc.widget.events.play); }); } var container = document.geteleme

java - Error code: ssl_error_no_cypher_overlap when trying to sign with own CA -

i using web application running in apache tomcat 6.0.44 uses oracle jre1.7u72. i've followed below steps sign server certificate using self created ca. followed steps link creation of own ca openssl genrsa -des3 -out ca.key 4096 openssl req -new -x509 -days 365 -key ca.key -out ca.crt openssl genrsa -des3 -out server.key 4096 openssl req -new -key server.key -out server.csr openssl x509 -req -days 365 -in server.csr -ca ca.crt -cakey ca.key -set_serial 01 -out server.crt deleting old certificate using keytool command keytool -list -keystore <path of keystore file> -alias aliasname -storepass password importing newly created server certificate signed own ca keytool -importcert -keystore <path of keystore> -alias alias -storepass password -file server.crt and obtained follow error secure connection failed an error occurred during connection x.x.x.x. cannot communicate securely peer: no common encryption algorithm(s). (error code: ssl_error_no_cypher_o

elixir - Different vendor file for production and development -

i'm using phoenix 0.14.0 , i'm planning use reactjs create user interface. the way i'm doing putting react.min.js in web/static/vendor folder. thing is, want in development non-minified version of react used instead, since has debugging code. when use react.min.js final size of minified app.js ~150k, , if use react.js final size 550k, don't think negligible difference. is there way can use different static file production , development in phoenix? you can either put regular react.js in project , let plugin uglify-js-brunch minify on production builds, or can put both files there , use overrides in brunch config include/exclude want depending on environment. latter might this: conventions: ignored: [ /[\\/]_/, 'web/static/vendor/react.min.js' ] overrides: production: conventions: ignored: [ /[\\/]_/, 'web/static/vendor/react.js' ]

etl - Restart-ability in pentaho community edition -

i using pentaho 5.2 community edition both production environment , aware there no restartability (checkpoint) in pentaho community edition. how setup restartability in pentaho community edition. references or link useful. there not such feature in ce edition. idea of ee restart-ability have separate database table (like log tables - exists in ce edition) , control on fail/success job entries based on records. gain automatically restart failed job entries , ability show execution results on time. example - 1 can monitor job execution status code via console , restart job console. in case whole job restarted. if checkpoints , restart-ability - job restarted failed entry. if have jobs contains 1 or 2 entries, if in case of restart-ability running time not critical, or fail-handling implemented other way - may don't need feature @ all. once again - restart-ability restart failed job entries. if case failed job entry made db inconsistent - restart of job entry should fix

How to get the ip address range of subnet using azure powershell -

i ip address range (starting ip, ending ip) subnet in azure using powershell. any great. thanks, paul you need dig through vnet xml config: [xml]$vnetconfig = (get-azurevnetconfig).xmlconfiguration $vnetsites = $vnetconfig.networkconfiguration.virtualnetworkconfiguration.virtualnetworksites.virtualnetworksite foreach ($site in $vnetsites) { foreach ($subnet in $site.subnets) { $subnet.subnet } }

assembly - Disassmble , modifying , reassmble and create .exe -

so looking dissassmbler dose following : 1. dissassmbl .exe file assembly code 2. ability modify code 3. reassemble modified code exe 4. save exe there ant software can ??? ps: not going use in illegal activtes while ollydbg works great 32bit binaries i've gotten away since doesn't support 64bit binaries. these days pretty use windbg or idapro , hex editor editing instructions. tools explorersuite come in handy if you're trying edit portions of pe header etc. has quick disassembler, alterations perform nopping out instructions.

scala - How to read some specific files from a collection of files as one RDD -

i have collection of files in directory , want read specific files form these files 1 rdd , example: 2000.txt 2001.txt 2002.txt 2003.txt 2004.txt 2005.txt 2006.txt 2007.txt 2008.txt 2009.txt 2010.txt 2011.txt 2012.txt and want read every specific range these files, example: range = 4 = 2004 read files : 2004.txt , 2005.txt , 2006.txt , 2007.txt 1 rdd (data) how can in spark scala? because spark's textfile exposes hadoop's fileinputformat , can specify varargs of directories , wildcards. hence should work (untested): def datedrange(fromyear: int, years: int) = sc.textfile(seq.tabulate(years)(x => fromyear + x).map(y => s"/path/to/dir/$y"): _*)

android - Remove Dynamically added layouts from listview extends base adapter -

here have number of layouts inflated, when length of ei.duedate.size() 0 views not removed. i have search lots of didn't how can remove views listview . i have inflated 5-6 child layouts when size goes 1-2 inflated views can not remove. please me if guys have idea. below you'll find adapter code: public class immunisationadapter extends baseadapter { @override public int getcount() { // todo auto-generated method stub return immumainarraylist.size(); } @override public object getitem(int position) { // todo auto-generated method stub return immumainarraylist.get(position); } @override public long getitemid(int position) { // todo auto-generated method stub return position; } @override public view getview(final int position, view view, viewgroup parent) { // todo auto-generated method stub viewholder holder = null; final immunimodel ei =

mysql - sql store the data in the column wise -

id user_id apt_id name value datetime 1 1 1 bp 109 .... 2 1 1 sugar 180 .... 3 2 2 bp 170 .... i trying create table in approach because, patient column not standard one, patient store bp , sugar, sometime bp. am right in creating design. if right, how records of single patient. thanks, if not wrong, userid patientid in scenario, in case, use below query single patient record, select * patienttable user_id = '1' here single patient record. i.e., user_id = 1 output: id user_id apt_id name value datetime 1 1 1 bp 109 .... 2 1 1 sugar 180 .... note: can change want instead of 1

uisegmentedcontrol - Segmented control in action sheet IOS -

Image
i trying add segmented control in actionsheet same way apple's maps application has used. i found way add subview in actionsheet's view not recommended apple.i found following comment somewhere. you might want careful this. apple may not it. documentation: "uiactionsheet not designed subclassed, nor should add views hierarchy. if need present sheet more customization provided uiactionsheet api, can create own , present modally presentviewcontroller:animated:completion:." – eric goldberg mar 4 '14 @ 2:28 can suggest me way achieve this. that isn't uiactionsheet @ all. uiviewcontroller presenting using custom 1uipresentationcontroller1 , transitiondelegate . easy tell because takes on bar , doesn't have same style uiactionsheet . you can create own viewcontroller manage view you'd like, present using new custom transition api ios7. here resources started. https://developer.apple.com/library/ios/documentation/uikit/refe

regex - Extract values with ampersands from query string -

i want extract baz value following query string: foo=bar&baz=qux&norf&corge=grault the problem value of baz contains &. i've had success using lookhead this: /baz=(.*)(?=[^=]*&)/ however, can't handle end of line or when there more 1 key-value after it. is there regexp can handle this? baz=([^=]*)(?=&|$) this should you.see demo. https://regex101.com/r/oc5ry5/1

html - Prevent columns from stacking when view port changes? (BS) -

i have modified navbar in bootstrap use x-scroll instead of hamburger/dropdown style. problem having .navbar-nav , .navbar-header stacking on mobile , need them remain inline. i have tried lots of methods they're extremely messy , inconsistent. <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#"></a> </div> <ul class="nav navbar-nav"> <li><a href="#">link</a></li> ... </ul> </div> </nav> css: .navbar-nav { float: none; white-space: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; } .nav li { display: inline-block; float: none; } demo: http://jsfiddle.net/1u7zyehs/2/ i know default behaviour of bs stack containers on mobile, there clean way

uiview - Howto Size the Modal View programmatically (SWIFT) -

i want present small option dialog on existing main uiviewcontroller/uiview , on ipad see small dialog , in background see main view. i managed show uiviewcontroller/uiview in modal view style follow: func showoptions(){ let storyboard = uistoryboard(name: "main", bundle: nil) let controller = storyboard.instantiateviewcontrollerwithidentifier("options") as! uiviewcontroller controller.modalpresentationstyle = uimodalpresentationstyle.popover let popoverpresentationcontroller = controller.popoverpresentationcontroller // result optional (but should not nil if modalpresentationstyle popover) if let _popoverpresentationcontroller = popoverpresentationcontroller { // set view pop _popoverpresentationcontroller.sourceview = self.view; //_popoverpresentationcontroller.sourcerect = cgrectmake(60, 100, 500, 500) //_popoverpresentationcontroller. .setpopovercontentsize(cgsizemake(550, 600), animated: true

Is there a way to reuse an XML declaration of a UI component in Android? -

i've done snooping around feel relatively simple, however, guess wasn't quite sure how phrase question because wasn't getting many results. apologize if duplicate question. want define edittext attributes so: <edittext android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputtype="numberdecimal" android:background="#00000000" android:digits="0123456789.," android:ellipsize="start" android:maxlines="1" android:gravity="center" android:hint=" "/> and there, wish declare myedittext (assuming above definition called myedittext), , not have worry defining these 9 attributes every time wish use edittext of style. possible? have read through android's guide custom components , however, seems overkill trying accomplish. (i not wish custom persay, i'm looking package existing functionality single compone

typoscript - TYPO3: Assign altText to dynamic header image -

i using typoscript snipped render header image first image assigned in page's resources: headerimage = coa headerimage { 10 = image 10 { params = class="logo" file { import = uploads/media/ import.data = levelmedia:-1, slide import.listnum = 0 width.field = imagewidth width.wrap = |m height.field = imageheight height.wrap = |m treatidasreference = 1 } } } how set alttext that coming image's properties , not fixed value set alttext = xyz ? cheers

css - simple croppic example jquery -

i working on upload profile picture. i using www.croppic.net because browser compitible. i wasted 2 days on it.but cant proper example. i have downloaded whole website link website footer section. but after remove unnecessary js/css (bootstrap,etc.). still don't know how works :d.. please suggest me other jquery provide upload , crop browser compitible you have aware include necessary files. have ran , post image ajax request , save on server. files : croppic.css @ header include css image area, example have div tag parent of plugin , called cropheaderwrapper , has overflow:hidden;height: 420px;direction: ltr; the plugin tell later include https://code.jquery.com/jquery-2.1.3.min.js include jquery.mousewheel.min.js include croppic.min.js and initialize tell you for case of 3, have these codes : <div class="col-xs-12 text-center cropheaderwrapper"> <div id="croppic"></div> <span class="btn

javascript - How to add additional functionalities? -

i got simple javascript based blog . first have @ below codes , ask question. index.html have following codes in body <script language="javascript" type="text/javascript" src="blog/config.js"> </script> <script language="javascript" type="text/javascript" src="blog/single.js"> </script> <script language="javascript" type="text/javascript" src="blog/posts.js"> </script> config.js has //this configuration file of blog system. //change these variables suit style , needs var head = "h2"; //the heading style, ex. h1, h2, ect. use "h2" rather "<h2>" var text = "text"; //the text style, style sheet, it's in <div> tag var divider = "<hr>"; //the division between posts var newer = "newer"; //the class link next newest page var older = "older"; //the class link next ol

java - Show popup menu on a jlist -

i have problem popup menu. that want when user click right mouse button on jlist popup menu appear. have created class create popup menu, class extend mouselistener, , class add mouse listener jlist. in class extend mouselistener call class of popup menu , show it. problem popup menu doesn't appear. package mouselistener; import java.awt.event.mouseevent; import java.awt.event.mouselistener; import javax.swing.*; import view.___poupupmenu___; public class add_popupmenu_categoria implements mouselistener { jlist <string> l = new jlist <string> (); public add_popupmenu_categoria (jlist <string> l) { this.l = l; } public void mouseclicked(mouseevent evt) { system.out.println("clicked"); if (evt.ispopuptrigger()) { system.out.println("enter in clicked"); ___poupupmenu___ p = new ___poupupmenu___(); l.setselectedindex(l.locationtoindex(evt.getpoint())); system.out.println(evt.ge

javascript - How to use jquery autocompleter with simple json? -

i using jquery autocomplete function serviceurl - $('#locationsdiv').autocomplete({ serviceurl : '${pagecontext.request.contextpath}/pages/getlocationlist.do', paramname : "value", delimiter : ",", transformresult : function(response) { return { //must convert json javascript object before process suggestions : $.map($.parsejson(response), function(key,value) { return { value : key, data : value }; }) }; } }); in response of serviceurl got response - {"1":"jaipur","2":"amer","3":"gurgaon"} this json coming hashmap - hashmap<string, string> locationmap = new hashmap<string, string>(); locationmap.pu

filestream - Java How to list files with directory with pattern matcher -

the file structure following: root -- [anything] -- access.log -- [anything] -- access.log path: /root/*/access.log thank you. directoryscanner scanner = new directoryscanner(); scanner.setincludes(new string[]{"*/access.log"}); scanner.setbasedir(basepath); scanner.scan(); string[] files = scanner.getincludedfiles(); this simplest solution using org.apache.tools.ant.directoryscanner

powershell - Eliminate Inner Loop -

i have 2 loops in program.first loop setting retry peocess , inner loop testing connection status. for($retry=0;$retry<=3;$retry++) { while (!(test-connection "mycomputer")) { if (time exceed) { $status=$false write-host "machine offline" break } } if($status) { write-host "machine online" break } } is there way eliminate inner loop without changing output not entirely sure mean "time exceeded" - time what? if want wait between test-connection attempts, can introduce artificial delay start-sleep : $computer = "mycomputer" $timeoutseconds = 5 for($retry=0; $retry -lt 3; $retry++) { if(test-connection -computername $computer -count 1 -quiet){ # didn't work write-host "machine offline" # let's wait few seconds before retry start-sleep -seconds $timeoutseconds } else { write-host "machine online!" break

javascript - Datatables initialization warning -

i have dropdown multiple options initializes datatable using javascript. works fine problem comes during execution in when option selected second time error , check out fiddle , datatables warning (table id = 'defdiv'): cannot reinitialise datatable. and below code : if(user.position=="def"){ var table = $('#defdiv').datatable({ "aadata":defenders, "idisplaylength":15, "aocolumns": [ { "mdataprop": "playerinfo" }, { "mdataprop": "playername" }, { "mdataprop": "playerclub" }, { "mdataprop": "playervalue" }, { "mdataprop": "playerpoints" }, ], "order": [[ 3, "desc" ]], }); } question how can prevent warning happening when option selected again ? i've altered code , works now: var goalkepeers = [{ "playername&qu

AngularJS one-time binding with checking array length -

i'm trying use one-time binding when displaying content user if there values in array. i'm using code: app.controller('mainctrl', function($scope, $timeout) { loadheroes = function() { $scope.heroes = ['superman', 'batman', 'spider-man']; }; $timeout(loadheroes, 5000); }); and this: <div ng-controller="mainctrl"> <pre ng-show="::heroes.length > 2">there few heroes!</pre> <pre>{{::heroes | json}}</pre> </div> here plunker: http://plnkr.co/edit/k1kxutld8fowsoxc81sk?p=preview but message not showing. tried set parentheses around array, it's not working either. any idea how can achieve one-time binding checking array length? use ng-if : var app = angular.module('plunker', []); app.controller('mainctrl', function($scope, $timeout) { loadheroes = function () { $scope.heroes = ['superman', 'batman',