Posts

Showing posts from February, 2012

javascript - how to check entered regex pattern and example are correct or not -

i have 2 textbox in form. first regex pattern, , second input text. i try check enter regex pattern , entered text matches or not. this my simple attempt . and working demo: '01-01-2012'.match( /\d{2}-\d{2}-\d{4}/ ) fiddle any solution query? use var pattern = new regexp($('#pattern').val()); . in case have enter pattern without slashes, \d{2}-\d{2}-\d{4} (or can make check presence , cut them). though can create regexp in code var pattern = /\d{2}-\d{2}-\d{4}/ , when pattern input field , assign variable, javascript not parse regular expression, assign string variable. , because of have explicitly create regexp object , pass string constructor, interpreter create regular expression it.

java - Can you hook into an interface-less jar? -

is possible run function upon function call in interface-less import?if i'm importing library, example, possible each time function foo called, function, bar, called well? thanks if can edit code , class foo resides in non-final, can override class's foo call bar well: class myfooclass extends fooclass{ @override void foo(){ bar(); //not sure if want bar static or not, or if want bar first or last. super.foo(); } } then use myfooclass instead of fooclass throughout code.

jQuery Validate plugin - don't evaluate empty fields -

i'm using jquery validate plugin , i'm trying should relatively easy, can't work. i've got input field not mandatory/required field. if nothing entered field don't want run form of validation on field. if form field changes , contains input want validate against, example, numbers only, if field blank, remove / don't validate. i tried doing this: valform('excessfrm'); var vou = $('input[name="voucher"]'); vou.blur(function(){ if($(this).val() == ''){ ( "#voucher" ).rules( "remove" ); } else { ( "#voucher" ).rules( "add", { number: true }); } }) but no matter put in code i'm getting error: uncaught typeerror: object #voucher has no method 'rules' even though i'm sure validate() object has been initiated, valform() function calls validation object , setup default rules etc. can offer words of wisdom please? quote op:

java - Sequence doesn't count upwards -

i have following piece of code, append corect, sequence doesn't count upwards. idea whats wrong there? globalmap.containskey(row1.file_name.touppercase()) ? (string)globalmap.get(row1.file_name.touppercase()) : (globalmap.put(row1.file_name.touppercase(), row1.file_name.touppercase() + "-id-" + numeric.sequence(row1.file_name, 1, +1).tostring()) == null ? (string)globalmap.get(row1.file_name.touppercase()) : (string)globalmap.get(row1.file_name.touppercase()) thanks in advance advice! i don't see incrementing value repeatedly, maybe why sequence not increasing. if(globalmap.containskey(row1.file_name.touppercase())){ (string)globalmap.get(row1.file_name.touppercase()) }else{ if((globalmap.put(row1.file_name.touppercase(), row1.file_name.touppercase() + "-id-" + numeric.sequence(row1.file_name, 1, +1).tostring()) == null){ (string)globalmap.get(row1.file_name.touppercase()); }else{ (st

wix - Service does not start after updating; how to do dependencies between components -

we have installer install windows service , files. when update installation new installation (by installing new package; minor upgrade, product version changes, product id not change), service cannot start. because files missing in installation folder needed service during service start up. currently have <feature /> , there 1 <componentgroup /> . <componentgroup /> contains service , contains other components, has files. looks (empty attributes placeholders , filled): <component id="" guid="" directory=""> <file source="" id="" /> <file source="" id="" /> </component> <component id="" guid="" directory=""> <file source="" id="" /> <file source="" id="" /> </component> <component id="" guid="" directory=""> <file so

How to overwrite: catalog/product/view/type/default.phtml with XML Magento -

i have simple module , want overwrite templates files. for instance, when want overwrite view.phtml via xml open module layout xml file , add: <catalog_product_view> <reference name="product.info"> <action method="settemplate"> <template>my-module-template-folder/catalog/product/view.phtml</template> </action> </reference> </catalog_product_view> but want overwrite: catalog/product/view/type/default.phtml , have tried nothing works. (to bad way easy) thought add <action method="settemplate"> new file nothing offcourse. can please provide me right code? either put copy of catalog/product/view/type/default.phtml design override under app/design/frontend/default/<yourdesign>/template/ . or can use unset in layout xml @ first before redefining block setting template again. take @ app/design/frontend/base/default/layout/catalog.xml:268 <product_type_si

webserver - C# Mini Http Server, Knowing when to close a connection -

i've been coding own http web server in c# using tcplistener class. before mentions this, know of httplistener, after using previously, i.ve had issues due firewall exceptions , needing have admin account etc etc. application, easier make simple, built web server. i've been using python application connect c# webserver, , send simple request, , receive in return simple response. my question this.. server supposed close connection, or client? ask because if close connection in server after sending response, python app doesn't read of response. instead, socket error thrown "error 10054, 'connection reset peer'". but, if force python app close connection, i'm not sure how detect on c# server, since c# tcpclient not contain disconnect event. do? how know when connected client has received full response can close connection? currently, works (with thread sleep) // write headers , body socket networkstream stream = client.getstream();

html - Cross Browser Automatically Click Link On Page Load with Javascript -

i have simple html page iframe image link. after page loads want link clicked automatically. need link clicked instead of doing meta refresh thats out of question. searched around , seems firefox not support methods so...there has cross browser solution. here have far wont work...why? <script type="text/javascript"> window.onload=functionname; $(document).ready(function(){ $('#clicked').trigger('click') }); </script> <div id="clicked"> <iframe src="http://mysource.com" width="40" height="10" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe> </div> add # before id value $('clicked').trigger('click'); to $('#clicked').trigger('click')

No trusted certificate found using CAS and JBoss -

i'm trying authenticate through cas+ldap in jboss app. config this: server 1: jboss 6.10. cas deployed here. server 1: ldap using opends. server 2: jboss whith app login into. i've configured both jboss use ssl correctly , cas succesfyuly reads , authenticates against ldap. when (through https) server1:8443/app/ i'm redirected server2:8443/cas/ , login screen displayed. login valid user on ldap when flow gets app i'm getting this: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: no trusted certificate found i've read certificate problem and, dev enviroment i'm trying self-signed certificate. did this: gen self signed in server1 with keytool -genkey -alias jbosskey -keypass password -keyalg rsa -keystore server.keystore get certificate of server1 with: keytool -export -alias jbosskey -keypass password -file server.crt -keystore server.keystore copy server.crt server2 , import truststore of jboss. keytool

ios - How to make a DIV get Voiceover focus when it doesn't contain any focusable HTML? -

i have email client application, , i'm changing way show attachments email. had them @ top of email viewer in scrollable list; we're moving them they're displayed list @ bottom of email content. reasons related uiwebview control, necessary me implement these attachments html code programmatically appended html of original email (instead of doing them normal person would, each attachment uiview in ios). i'm trying configure accessibility these html elements , running problems. each "attachment" consists of button-like background constructed 3 images: 1 left side of button, 1 right side of button, , middle portion stretchable (this allows button stretch in width without distorting edges). there's paper clip image , right-arrow image laid out on "button", , 2 sub-divs displaying file name , size. the problem want make outer div encompasses of these sub-elements thing focusable voiceover, , want able control announced voiceover div (so can in

c# - Hide the icon of main window when navigate to another window -

in wpf application, i've 4 windows. every window, i've written following code minimize system tray. problem when navigate 1 window another, first window's icon still appears in system tray. want hide icon when navigate window? please suggest ways proceed? my main window code is- public partial class monthview : metrowindow { public datetime selecteddate { get; set; } private system.windows.forms.contextmenu contextmenu1; private system.windows.forms.menuitem menuitem1; private system.windows.forms.menuitem menuitem2; public monthview() { initializecomponent(); calmain.displaydate = datetime.today; globals._globalcontroller = new appcontroller(); globals._globalcontroller.apptaskmanager.setuplocal(); globals._globalcontroller.setmonthviewwindow(this); globals.ni = new notifyicon(); this.contextmenu1 = new system.windows.forms.contextmenu(); this

A callback for publish method in Autobahn? -

i wonder why there no callback defined on publish method in autobahnjs? think useful client tries publish know whether publish call succeeded or not , react accordingly. wonder if other frameworks support pub/sub have such callback publishing. how define "success" publish? depending on that, pubsub different. today, wamp pubsub best-effort service. wampv2 might other qos levels in addition.

html - table background image not display on printing paper -

template.html {% block css-custom %} <link rel="stylesheet" type="text/css" media="print" href="{{ static_url }}style/print.css" /> <link rel="stylesheet" type="text/css" media="screen" href="{{ static_url }}style/print.css" /> {% endblock %} {% block main-content %} '''''''''''''' <table width="100%" border="0" class="printimg"> <tr><td>some data</td></tr></table> ''''''''''''''''' {% endblock %} i want set above image background table.if set same image in tag in , coming display, background not happening.as html page working,problem printing in paper. on print preview background image coming display on printing in paper image gets disappeared. edit: report.css .prin

opencv - Finding right point matches using RANSAC -

i have 2 images. each has 8 points corners of 2 squares in each image. need find corresponding correct matches between them. so, when pass 64 possible combinations of matches ransac (findfundamentalmatrix), gave me 7 matches suppose inliers but, turned out wrong matches. i have been scratching head since many days trying figure out wrong. since new opencv, need figuring out. thanks for solve problem in first use findhomography() compute rotation value in last use perspectivetransform() transform input points original points. point2f first_8_points[8],second_8_points[8]; mat h = findhomography(first_8_points, second_8_points, cv_ransac ); float roatation = acos( h.at<double>(0,0)) * 180/cv_pi; perspectivetransform( first_8_points, second_8_points, h);

php - Page Restrict Error using plugin -

when tried use page restrict worked above login page showing warning: creating default object empty value in c:\xampp\htdocs\prac\wp-content\plugins\pagerestrict\pagerestrict.php on line 76 any suggestionson how fix it??

How do I write to a website/HTML Documet using python 3? -

i'm using python 3 , able read code html document unable write it. how go this. i'll show mean: import urllib.request locator=urllib.request.urlopen("file:///e:/programming/calculator.html", "r") transfer=locator.read() print("\n\n",transfer, "\n") locator.close() locator=urllib.request.urlopen("file:///e:/programming/calculator.html","w+") locator.write("<p> hello site has been changed</p>") locator.close() locator=urllib.request.urlopen("file:///e:/programming/calculator.html","r") new=locator.read() print(new) locator.close() so i'm read can't write or change of it's code. why this? also, tried read actual url website using exact same code above replacing url , removing write function. interpreter came error, , wasn't able read site. how can read website too? note: i'm learning, i'm not gonna illegal want become more knowle

java - 3d Cylinder Bar Chart with Jfreechart -

i need make 3d cylinder bar chart jfreechart shown in picture on link: http://www.jzy3d.org/gallery/web/demo-histogram.png . have problems on 2 lines of code: chart.getaxelayout().setmaincolor(color.white); , chart.getview().setbackgroundcolor(color.black); , both in main method. know problem here? thanks in advance import java.awt.color; import org.jzy3d.chart.chart; import org.jzy3d.chart.chartlauncher; import org.jzy3d.colors.colormapper; import org.jzy3d.colors.colormaps.colormaprainbow; import org.jzy3d.maths.coord3d; import org.jzy3d.plot3d.primitives.multicolorscatter; public class chart { int size = 100000; float x; float y; float z; public void crtaj() { coord3d[] points = new coord3d[size]; // create scatter points for(int i=0; i<size; i++){ x = (float)math.random() - 0.5f; y = (float)math.random() - 0.5f; z = (float)math.random() - 0.5f; points[i] = new coord3d(x,

android - Gradle build failure when trying to use Facebook SDK -

i trying use facebook sdk in project in android studio. following step 3 of this tutorial. when try run app, "gradle: execution failed task ':facebookapp:dexdebug'." error. below output if error gradle: execution failed task ':facebookapp:dexdebug'. failed run command: c:\android-sdk\build-tools\18.0.0\dx.bat --dex --output c:\users\brandon\androidstudioprojects\facebookappproject\facebookapp\build\libs\facebookapp-debug.dex c:\users\brandon\androidstudioprojects\facebookappproject\facebookapp\build\classes\debug c:\users\brandon\androidstudioprojects\facebookappproject\facebookapp\build\dependency-cache\debug c:\users\brandon\androidstudioprojects\facebookappproject\facebookapp\build\exploded-bundles\facebookappprojectlibrariesfacebookunspecified.aar\classes.jar c:\users\brandon\androidstudioprojects\facebookappproject\facebookapp\build\exploded-bundles\facebookappprojectlibrariesfacebookunspecified.aar\libs\android-support-v4.jar c:\android

NULL values in MySQL database after I set default '0' to the column -

i have payouts table whom set default 0.000 total_tips column (extract table schema): total_tips | decimal(12, 4) | yes | | 0.0000 | <- default set '0.0000' but now, can explain why have still null values inside table: mysql> select total_tips payouts id = 4157; +------------+ | total_tips | +------------+ | null | +------------+ 1 row in set (0.00 sec) before ran alter command (to set default value): mysql> alter table payouts change total_tips total_tips decimal(12,4) default 0 ; you maybe didn't set value not null , null value accepted. need update whole base with: update payouts set total_tips = 0 total_tips null

CSS margin not according parent -

i have 2 divs, " container " , "content" . if content inside container, fit container. #container { display:block; width:300px; margin:auto; background:green; } #content { display:block; margin:20px; /* here error */ background:yellow; } the top , bottom margins not inside parent, left , right are. why happens? edit: jsfiddle example: this due margin collapsing - top margins of block level elements' first child (assuming it's block level , participates in normal flow ) collapse top margin of parent. one way around change display value of child div inline-block . #content { background: yellow; display: inline-block; margin: 20px; } note: andyg pointed out can prevent margin collapsing using padding or borders on container div among many other ways. see spec complete list.

c++ - Environment to simulate classic distributed computation model on single machine -

i'm searching tool simulate classic distributed computation model on single machine implement several algorithms in purpose of paper i'm working on. thus, performance isn't important, it's scientific applications. i want have possibility specify number of processes , communication links between them. in other words, want define network graph structure. the computation should asynchronous , message driven i.e. want send messages between connected processes , react these messages. is there library or framework such computations? simpler better. language doesn't matter much, i'd prefer python or c++. i've given @ celery didn't find there possibility specify connection between processes. very easy - python remote objects - pyro run on single machine or on multiple across network.

c++ - Code for Project Euler No 45 not working -

here problem, project euler #45 and here's code wrote it: #include <iostream> #include <math.h> using namespace std; bool ispent (long num){ long double x = (sqrt(24*num+1) + 1.0)/6.0; if (floor(x)==x) return true; else return false; } bool ishex (long num){ long double x = (sqrt(8*num+1) + 1.0)/4.0; if (floor(x)==x) return true; else return false; } int main(){ int i=286; while(true){ long x = (i*(i+1))/2; if((ispent(x)) && (ishex(x))){ cout << x; break; } i++; } } this gives output 40755, whereas require next number. possible bug? the issue using square roots check if number pentagonal or hexagonal imprecise, test fail , overflow x . to fix this, can use type more precision, replacing long unsigned long , or unsigned long long .

How to Use Background Image in BootStrap .carousel-control -

Image
can please let me know how can update .carousel-control css use background image this arrows image? tried update css code adding position:absolute; display:none; top:50%; margin-top:-28px; z-index:60; height: 50px; width: 51px; background-image: url(http://www.promap.ca/img/arrows.png); /*max-height:20%; max-width:12%; background-size:200% 200%;*/ to following code didn't go through! .carousel-control { position: absolute; top: 40%; left: 15px; width: 40px; height: 40px; margin-top: -20px; font-size: 60px; font-weight: 100; line-height: 30px; color: #ffffff; text-align: center; background: #222222; border: 3px solid #ffffff; -webkit-border-radius: 23px; -moz-border-radius: 23px; border-radius: 23px; opacity: 0.5; filter: alpha(opacity=50); } .carousel-control.right { right: 15px; left: auto; } .carousel-control:hover, .carousel-control:focus { color: #ffffff; text-decoration

github - Redirect a.com/suffix to b.com -

context: i'm developing website conference happening next year. i'm using tito.io process registrations , github pages host website. at moment, users register visiting https://tito.io/maine-civic-hack-day/maine-civic-hack-day-2013 . i'd clean up, , point them http://mainecivichackday.com/register instead. i've read 301, 302, , masked redirects, far i've seen far, applicable subdomains. instance, can make work register.mainecivichackday.com , not mainecivichackday.com/register . what options? tldr : how point a.com/b c.com ? you can set redirect on a.com/b page b.com/a user see redirected to. if want show clean url user, webserver @ tito.io have configured answer desired url such http://register.mainecivichackday.com

HTML5 date input control custom validation based on JSON Schema -

in application using backbone, have json object tells display html5 controls, "items": [ { "key": "user.fname", "title" : "first name" }, { "key" : "user.lname", "title": "last name" }, { "key": "user.dateofbirth", "title": "date of birth", "type": "date" }, { "type": "submit", "title": "check", "htmlclass": "chkbtn" } ] and value entered user validated using json schema, "user" : { "required" : true, "minitems" : 1, "properties" : { "fname" :

xml - Cannot read XMLFile with exception: java.io.FileNotFoundException: C:\Temp\logger.dtd (The system cannot find the file specified) -

i having trouble reading xmlfile created class below. led believe there property here need set in order correct file directory used. xmlfile generated with: <?xml version="1.0" encoding="windows-1252"?> <!doctype log system "logger.dtd"> at top can read if remove line containing "logger.dtd" . can explain going on? reading same uri set using saxparser api. followed instructions sax parsing here: http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/ package logging; import java.io.ioexception; import java.util.logging.filehandler; import java.util.logging.handler; import java.util.logging.level; import java.util.logging.logger; import java.util.logging.simpleformatter; import java.util.logging.xmlformatter; import javax.xml.parsers.saxparser; import javax.xml.parsers.saxparserfactory; import org.xml.sax.attributes; import org.xml.sax.saxexception; import or

Date with Hawaii timezone makes invalid JavaScript date -

for reason, when pass date hawaii time zone javascript's date() "invalid date", other time zone don't. there workaround this? var hast = 'wed, 31 jul 2013 07:21:16 hast'; var hawaiitime = new date(hast); console.log("hawaii time: "+hawaiitime); // hawaii time: invalid date var pst = 'wed, 31 jul 2013 07:21:16 pst'; var pacifictime = new date(pst); console.log("pacific time: "+pacifictime); // pacific time: wed jul 31 2013 09:21:16 gmt-0600 (mdt) jsfiddle rfc 2822 supports north american ut offsets (see page 32 ). "est" / "edt" / ; eastern: - 5/ - 4 "cst" / "cdt" / ; central: - 6/ - 5 "mst" / "mdt" / ; mountain: - 7/ - 6 "pst" / "pdt" / ; pacific: - 8/ - 7 for else, should use numeric value relative utc or gmt. hast, utc-1000 (10 hours before utc): var hast = 'wed, 31 jul 2013 07:21:16 ut

c# - SqlGeometry / DbGeometry Isvalid exception when hosting on Azure Web Role -

i'm trying create dbgeometry type polygon. works fine on local machine getting error on return statement when hosting website on azure web role. code: string polygon = “polygon ((-30.3637216 30.7124139,-30.3632216 30.7124139,-30.3632216 30.7129139,-30.3637216 30.7129139,-30.3637216 30.7124139))”; return dbgeometry.fromtext(polygon, 4326); exception: exception has been thrown target of invocation. @ system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, boolean constructor) @ system.reflection.runtimemethodinfo.unsafeinvokeinternal(object obj, object[] parameters, object[] arguments) @ system.reflection.runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture) @ system.data.sqlclient.sqlspatialservices.geometryfromtext(string geometrytext) @ library.modules.findmyway.spatialfunctions.getdefaultbox(decimal latitude, decimal longitude) @ library.stop.imp

php - Text Grab from a large content -

i need grab text surrounded within quotes assigned variable string . how content be inspired , recalling tricks learned doc , friends, mcqueen emerges lead race final laps. hicks, refusing lose, sends weathers dangerous accident. seeing , recalling doc's fate, mcqueen stops short of finish line, allowing hicks win, , drives push weathers on finish line. crowd , media condemn hicks' victory string="mickey" , give praise mcqueen's sportsmanship. though offered dinoco sponsorship deal, mcqueen declines, insisting on staying current sponsors appreciation of past support. i need grab mickey whole content. i tried substr on php , didn't though. ideas ? p.s. string inside quotes may vary. if have 1 of these quoted words in string easiest thing be: $myarr = explode('"',$string); // break string array " dilimeter echo $myarr[1]; // echo second element. update: many quots - pick 1 after string= : $my

ruby - rails, how to combine two ActiveRecord query results -

i have following association class location < activerecord::base has_many :items end class item < activerecord::base belongs_to :location end suppose have instances of location, query items belong locations. managed result array items =[] location.near(latitude,longitude,distance).find_each |location| location.items.find_each |item| items << item end end however, there way can results activerecord::relation. because want further query results using "where" activerecord::relation. p.s. "near" method geocoder gem, returns activerecord::relation. ---------------------edit---------------------------- thank replies find solution locations = location.near(latitude,longitude,distance) item.where(location_id: locations.pluck(:id)) is right way it? me bit unintuitive. ----------------------edit again --------------------------- just small comment: unintuitive because switching datamapper. if datamapper, qui

pyzmq - How to close sockets left open by a killed program? -

i kinda new sockets, bare me. have program (python) in point uses zmq.context.socket(zmq.rep) and zmq.context.socket(zmq.pair) sockets problem when program killed sockets still can found using: 'ps aux | grep zmq' command. can make them disappear after program killed? according to; https://superuser.com/questions/127863/manually-closing-a-port-from-commandline only application can close sockets using, after applications process killed, sockets should automatically freed within couple of minutes. being patient enough?

visual studio 2010 - suo file not saved in VS2010 -

i have visual studio 2010 project noticed .suo file missing , not saved each time exit vs. more specifically, exit vs new .suo file 0 kb created , deleted. seems if vs having trouble writing new .suo file , deleted (yes have write permission solution directory). result have no .suo file , none of settings saved across vs restarts. annoying. ideas how fix this? thanks. the problem drive me crazy in similar way. visual studio did not update .suo file on exit sucks pretty much. in case, deleting .suo file made visual studio update .suo properly. (well, far =d) you're not lucky, though. i suggest make changes in project outlining, breakpoint toggling, etc., , close visual studio. give try.

Is it possible to change the SMTP information in the php.ini file to point to Microsoft's Live email SMTP servers? -

here's what's in php.ini file: [mail function] ; win32 only. ; http://php.net/smtp smtp = localhost ; http://php.net/smtp-port smtp_port = 25 is possible change localhost smtp.live.com , change port (smtp_port) point different port (specifically, 567, required microsoft) in order send email microsoft live email address via php? tried normal mail() route, never received email script, , can assume has smtp authentication. don't have experience php. no, won't work. smtp.live.com requires authentication, , php mail() command not support authentication. pascamel suggested, should use library supports sending mail through remote smtp server using authentication. phpmailer good.

java - Saving in a web application -

i have web application (using vaadin, hibernate, , postgres database) in users can add data table. when user adds item table asked enter name, date, , selected table related products. when click save able save name , date database having trouble grabbing items table , putting them set add. bean class table looks this: /** created hibernate **/ public class beanclass implements serializable { private string name; private date date; private set relatedproducts = new hashset(0); . . . } the code using save item user wants add is: beanclass toadd = new beanclass(); set temp = null /** there table user can select products want add * when select item goes table, doing here * adding looping through latter table , adding items selected * set (supposedly think should work **/ (object item : table) { temp.add(table.getcontainerproperty("id", item)); } toadd.setname(namefield.getvalue()); //i have input fields name , date toadd.setdate(datefi

java - Need clarification regarding Transaction attribute -

i have read transactionattributetype.required that if client running within transaction , invokes enterprise bean’s method, method executes within client’s transaction. if client not associated transaction, container starts new transaction before running method. the client ejb application deployed on server a, , invokes method methodb of bean deployed on server b within transaction. if methodb has transactionattributetype.required , it'll run under same transaction started client application. right? if yes, how application deployed on different server know transaction started on server? if no, how methodb use same transaction? i new ejb please go easy on me. pointer right direction highly appreciated. if client on server has started transaction, transaction context propagated bean annotated transactionattributetype.required . it's part of invocation. so answer first question yes: methodb in server b, called ejb application on server a, runs in

java - getting date from a Jspinner of SPinnerDateModel -

i creating employee parole system include accepting date of joining. i using swings create interface in java. want user set value of spinner in date , program must able obtain day month , year selected user. my employee object consists of variable of class date created me. i want object of employee created when user clicks submit button. im unable find solution. here few snippets of program. mainframe.java private jspinner sdoj; private spinnerdatemodel sp; sp=new spinnerdatemodel(); sdoj=new jspinner(sp); submit.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent arg0) { employee emp=new employee(); emp.setdoj(sp.getcalendarfield()); //this have tried not successful } } employee.java public class employee { private int employeeid; private string employeename,employeeaddress; private boolean bc, bcplus,bjava; private enumgender egender; private enumdepartment edepartment; private enumq

When source_address of python socket.create_connection is used? -

socket.create_connection(address[, timeout[, source_address]]) any example show usage of source_address? as the documentation says: if supplied, source_address must 2-tuple ( host , port ) socket bind source address before connecting. if host or port ‘’ or 0 respectively os default behavior used. in other words, it's used when need bind socket before connecting. if don't know why you'd ever need that, don't need it. here's brief sketch of example: ftp server needs able make outgoing data connection on same interface incoming control connection. can binding same local address control connection has. so: def make_data_conn(controlconn, port, timeout): return socket.create_connection((controlconn.getpeername()[0], port), timeout, (controlconn.getsockname()[0], 0))

Display Tier Price on Cart page in Magento -

how can display tier price on cart page in magento? i understand method gettierpricehtml() works on list , detail page, cannot use on cart page. i'm editing /template/checkout/cart/item/default.phtml you want tier price in cart page also.i think useful functionality you can directly use code in checkout/cart/item/default.phtml: after $_item = $this->getitem(); (in line 28).... **$tierprice = $this->getlayout()->createblock( 'catalog/product_view', 'product.tierprices', array( 'product_id' => $_item->getproductid() ) );** **$tierprice->settemplate('catalog/product/view/tierprices.phtml');** **echo $tierprice->gettierpricehtml();** you can create own style template file can use in place of catalog/product/view/tierprice.phml catalog/product/view/tierprice1.phml

new to javascript: not sure what function (o) means -

what o ? if not mistaken, prototype means f going inherit o , can understand here. can break down me: if (!object.create) { object.create = (function () { var f = function(){}; return function (o) { if (arguments.length !== 1) { throw new error('object.create implementation accepts 1 parameter.'); } f.prototype = o; return new f(); }; }()); o parameter pass function. for example: var myobj = object.create({ myfn: function(){} }); then can do: myobj.myfn();

clojure - New user, can not use contrib -

i new clojure , can not use clojure.contrib.math . want exponentiation (power 2 3) --> 8 i have been looking morning solution have become more confused. if try (use 'clojure.contrib.math) file not found error. suspecting classpath issue tried resolve way, not able locate contrib jar... then see contrib perhaps deprecated. so simple question, how access math functions? clojure 1.5.1 leiningen 2.2.0 tahnks yes, clojure.contrib has been deprecated. replacement clojure.contrib.math clojure.math.numeric-tower . need add dependency in project.clj file, per instructions in readme. here's example particular function mentioned: (clojure.math.numeric-tower/expt 2 3) ;=> 8 see where did clojure.contrib go document replacement libraries.

java - How to change data in dynamically added Android Views at runtime -

i have , android app adds tableviews, tablerows , textviews dynamically @ run time according data found in firebase repository. more specifically, tableview added each "poll" found in repo static linearlayout , each "election" found in poll tablerow added tablelayout , , each "nominee" in election tablerow containing 2 textviews data added tablelayout well. potentially have multiple tables added @ runtime, each containing rows multiple elections, , each election having multiple data rows nominees. here's static layout measure.... <?xml version="1.0"?> <scrollview android:layout_height="android:layout_width="match_parent" android:id="@+id/scrollview1" xmlns:android="http://schemas.android.com/apk/res/android"> <linearlayout android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/linearlayout" android:orien

grails - Basic Groovy query regarding security / visibility -

i building .gsp page list user details of application specifications. i want let 3 roles view allow admin role save changes make. want save button visible on screen when admin logs in. i know should handling in controller, being new programming have no idea how can achieved? even if point me link explains helpful. i assume grails? you shouldnt invent own security layer, possibilities getting wrong huge. have @ spring-core-security plugin it has detailed documentation (and bit in question when set up, the documentation here) there tutorials found on web ( one here )

VBScript /w AppActivate for multiple instances of an application -

we have application minimize top-left corner of screen when disconnect vmware view desktop. wrote following vbs activate app , maximize works fine. set objshell = createobject("wscript.shell") objshell.appactivate "notepad" objshell.sendkeys "% r" objshell.sendkeys "% x" but users have multiple instances of same app open. i'm wondering how script execute every instance of application? i'm assuming i'll have key off of pid, since each instance have own pid, i'm unsure how this. thanks, brian appactivate accepts pid. use wmi retrieve pids of processes name. option explicit dim shell, wmi, wql, process set shell = createobject("wscript.shell") set wmi = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2") wql = "select processid win32_process name = 'notepad.exe'" each process in wmi.execquery(wql) shell.appactivate process.processid shell.send

html - making a cell border exactly like Excel's fill handle? -

Image
i trying make webpage looks excel spreadsheet. instead of using other tools images, want using html , css only. a screenshot of local webpage @ imgur: http://imgur.com/vzxiont but problem don't know how put square @ bottom-right of border of cell b2, looks fill handle in excel. please me. table coding have used is: <style type="text/css"> .exceltableformationcol { width: 55px; height: 20px; text-align: center; font-family: arial narrow; font-size: 14px; } .exceltableformationrow { background-color: #eeeeee; text-align: center; font-family: calibri; font-size: 16px; height: 20px; } #lastrow td { border-bottom-width: 0px;

C++ - Deprecated conversion from string constant to char -

i don't understand why compiler giving me warning deprecated conversion string char. this complaining warning: just bit of background of i'm doing.. i'm trying understand , practice exceptions... i'm not sure if better work char[1000] first name , on.. appreciate if understand warning , me find solution.. thanks.. ================================================================================= class teloenyuco { string fn, ln, r; double income; public: const char *getters(){return fn.data(), ln.data(), r.data();} virtual char *getfacilityaccess()=0; teloenyuco(char *fn, char *ln, char r, double inc) { if(fn==0) throw exception(1, "first name null"); //warning #1 if(ln==0) throw exception(2, "last name null"); //warning #2 if(r==0) throw exception(3, "rank null"); //warning #3 if(inc<=0) throw exception(4, "income null"); //warning #4 fn=fn;

java - Context having reference to class in android -

hi trying understand use of context though couldn't. following program using context. question significance of " context = class.this " ? class public vcardactivity extends activity { string vcard = "vcard"; context context; } public void oncreate ( bundle bn ) { super.oncreate(bn); setcontentview(r.layout.main); context = vcardactivity.this; } your current code doesn't show use of context. shows activity context. textview sometext=new textview(context); this code of mine shows, passing context constructor of textview in order make object. reason is, object needs know information, state of current context, , reason why many views, classes, helpers needs context. context = vcardactivity.this; in code having activity object assign context context. works because activity class inherits context , many classes needs context create it.

android - Ovelay image over loaded image in the touched position -

i need add picture on touched position in image or directly on camera preview. how touch coordinates , set image in touched area? and if want move added images? what right way code stuff? there sample or tutorial? event.getx() , event.gety() should give coordinates. here more detailed answer on getting coordinates. get co-ordinates of touch event on android

memory leaks - iPhone 4S is unable to handle full resolution from AVCaptureSessionPresetPhoto -

i've been developing project on iphone 4s , iphone5. in project, after picture taken, crop , resize image apply photo filters. iphone 5 seems handle on iphone 4s, seems crash @ different points during picture taking process. checked see if there we're memory leaks may have missed. here code below: [stillimageoutput capturestillimageasynchronouslyfromconnection:videoconnection completionhandler: ^(cmsamplebufferref imagesamplebuffer, nserror *error) { [capturesession stoprunning]; nsdata *imagedata = [avcapturestillimageoutput jpegstillimagensdatarepresentation:imagesamplebuffer]; uiimage *newimage = [[uiimage alloc] initwithdata:imagedata]; after this, automatically detect orientation of picture taken , rotate picture upright. after this, crop image square using nyximageskit float filteringsquareratio = 307.0/320.0; uiimage *cropped = [newimage croptosize:cgsizemake(filteringsquareratio * newimage.size.width, filteringsquareratio * newima