Posts

Showing posts from June, 2010

YUI3: How to bundle dependencies for offline deployment? -

i building web application using yui3 , it's "loader" , "app" components. separate application different modules yui.add(). going far. however, application going run off-line (distributed .zip file or so), no access yui cdn. looking way neatly bundle dependencies without shipping many megabytes yui3. is there best-practice way bundle dependencies need application? the closest thing found http://yuilibrary.com/yui/docs/yui/loader-resolve.html , feel there must easier way write myself. willing restructure sources should need to, or switch using builder or shifter if helps.

c# - Import ORACLE SDO_GEOMETRY to SQL Server Geometry -

i'm building service selects number of geometries system stores geometries in oracle 10g, , save copy of sql server database use system. looked first @ sdo_util.to_wktgeometry(). however, geometries stored 3d geometries (even though z-layer 0, not work wkt works if in 2d). option number 2 sdo_util.to_gmlgeometry(), returns gmls in v2, , sql server them in gml v3.1.1(from read)(and have not found simple way convert these). does have idea of ​​other options, maybe third-party libraries can used this? one possibility use towkb? function in oracle spatial convert sdo_geometry wkb. use below linked server oracle sql server. with (select mi_prinx, street,geometry::stgeomfromwkb(wkb,4283).makevalid() geom sistdb..gips.wkb_roads_test_v)insert sde.tra_lan_queenslandroadsselect mi_prinx id, street,geography::stgeomfromwkb(geom.stasbinary(),4283) geog a;

MySQL String to Date (Generic) -

can suggest function converts strings date? > function takes string , give: > 0000-00-00 if string cannot converted (string in <> date out) > null if string null or blank(string in = date out) > yyyy-mm-dd if string can converted (string in = date out) > function takes string , give: > 0000-00-00 if string cannot converted (string in <> date out) > null if string null or blank(string in = date out) > yyyy-mm-dd if string can converted (string in = date out) drop function if exists stringtodate; delimiter $$ create function `stringtodate`(v text) returns date begin declare result date; if (v null or v = '') set result = null; elseif (str_to_date(v,'%d-%m-%y') not null , length(clean(v)) > 8) set result = str_to_date(v,'%d-%m-%y'); elseif (str_to_date(v,'%d,%m,%y') not null , length(clean(v)) > 8) set result = str_to_date(v,'%d,%m,%y'); elseif (str_to_date(v,'%d/%m/%y') not n

java - How to use 3DES algorithm on Android? -

on server side, encyption/decryption of password field done in c#. now, need implement same functionality in android application. so, followed tutorial: http://ttux.net/post/3des-java-encrypter-des-java-encryption/ below: import java.security.messagedigest; import java.security.spec.keyspec; import java.util.arrays; import javax.crypto.cipher; import javax.crypto.secretkey; import javax.crypto.secretkeyfactory; import javax.crypto.spec.desedekeyspec; import javax.crypto.spec.ivparameterspec; import org.apache.commons.codec.binary.base64; public class encrypter { private keyspec keyspec; private secretkey key; private ivparameterspec iv; public encrypter(string keystring, string ivstring) { try { final messagedigest md = messagedigest.getinstance("md5"); final byte[] digestofpassword = md.digest(base64.decodebase64(keystring.getbytes("utf-8"))); final byte[] keybytes = arrays.copyof(digestofpassword, 24)

email - PHP mail from address header -

Image
i'm using php mail function send messages web app. i've created table holds e-mail addresses , messages send. script fetches number of messages , sends them. $headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=' . $charset . "\r\n"; $headers .= 'to: ' . $destname . ' <' . $destaddress . '>' . "\r\n"; $headers .= 'from:' . $fromname . ' <' . $fromaddress . '>' . "\r\n"; $headers .= "reply-to: ". $fromname . ' <' . $fromaddress . '>' . "\r\n"; mail($destaddress, $subject, $msgbody, $headers); my problem that, setting , reply-to header, address shown on list of received messages strange (not 1 i've sent). see picture below, but when open message, seems ok, ie sender 1 i've configured. can me? if ther

c# - Get CurrentPage of ReportViewer in Print Preview mode? -

in normal mode (by default @ first time loading reportviewer local report), can currentpage correctly current page in current view mode. but after changing preview mode (can done using setdisplaymode(displaymode.printlayout) ), can't value of currentpage property can access know current page of reportviewer. need achieve because want customize own toolbar reportviewer, has been done except currentpage seems fixed 1 after switching printlayout mode. here code display current page: private void binddata(){ mytextbox.databindings.clear(); mytextbox.databindings.add("text", myreportviewer, "currentpage"); } //register events re-bind data , other updated info (such totalpages)... myreportviewer.renderingcomplete += (s,e) => { binddata(); }; myreportviewer.pagesettingschanged += (s,e) => { binddata(); }; that works ok when in normal mode (the pagesettingschanged handler added switching printlayout mode doesn't seem work, update to

php - xmlDocumentElement is not defined -

here code: html: <!doctype html> <html> <head> <script type="text/javascript" src="foodstore.js"></script> </head> <body onload="process()"> <h3>welcome our online food store</h3> please type want order: <input type="text" id="userinput" ></input> <div id="underinput"></div> </body> </html> php <?php header('content-type: text/xml'); echo"<?xml version='1.0' encoding='utf-8' standalone='yes'?>"; echo '<response>'; $food = $_get['food']; $foodarray = array('tuna','bacon','beef','loaf','mutton'); if(in_array($food,$foodarray)) echo 'we have'.' '.$food; elseif($food=='')

c# - How to save own project file? -

i working on vs2010, .net 4.0 coding in c# wpf application. i making tool process data. reads files , adds them stack, processing done , data saved disk too. need save current state of project in file can open again. i know how can make project file. 1 thing can think of using xml , add info it. other options there? thanks in advance. cheers add values windows registry isolated storage a database i'd opt xml file, keep simple

parallel processing - MPI_Send is blocking in ring communication with large data size -

i trying form ring communication using mpi, each process sending result next process , last process sending result 0th process. lets assume have 4 processes 0th process send result 1st, 1st 2nd, 2nd 3rd , 3rd 0th. #include "mpi.h" #include <stdio.h> #include<stdlib.h> #define nelem 1000 int main (int argc, char *argv[]) { int numtasks, rank, rc, i, dest = 1, tag = 111, source = 0, size; double *data, result; void *buffer; data=(double*)malloc(sizeof(double)*nelem); if(data==null) { printf("unable allocate memory\n"); return; } mpi_status status; mpi_init (&argc, &argv); mpi_comm_size (mpi_comm_world, &numtasks); mpi_comm_rank (mpi_comm_world, &rank); (i = 0; < nelem; i++) data[i] = (double) random (); if (rank == 0) source=numtasks-1; else source=rank-1; if(rank==numtasks-1) dest=0; else dest=rank+1;

windows 8 - Is it possible to hide the application tile of a metro app -

is possible hide live tile of metro app?. after metro app installed in machine tile app displayed in start screen default. possible not display tile of app programatically. requirement user should able open app through thing custom url scheme not clicking on tile. app not going submitted windows store. internal use only. dont need worry if there hacked ways this. i dont know if wanted anyway: go package.appxmanifest. under declarations select protocol , press add. choose name app , save changes. you can open "run" , type in name , ":test" , app open.

ios - facebook login works on iphone simulator but not on iphone device -

in app, want take photos facebook. used facebook ios sdk. can able authorize below code: if (appdelegate.session.isopen) { //[appdelegate.session closeandcleartokeninformation]; [self retrievealbums]; } else { if (appdelegate.session.state != fbsessionstatecreated) { // create new, logged out session. appdelegate.session = [[fbsession alloc] init]; } // if session isn't open, let's open , present login ux user [appdelegate.session openwithcompletionhandler:^(fbsession *session, fbsessionstate status, nserror *error) { // , here make sure update our ux according new session state //nslog(@"%@",session.accesstokendata.accesstoken); [self retrievealbums]; }]; it works fi

vim configuration to turn on syntax for .conf files -

i have config file under python project, called "logging.conf", file looks like: [formatters] keys: console, logging [formatter_console] format: %(asctime)s | %(message)s [formatter_logging] format: %(message)s etc etc etc tried :syntax on , nothing happened, .conf files plain. there anyway can turn on syntax make .conf file more colorful , readable? you can check vim.org or internet suitable syntax. as first approximation, looks dos / windows ini files . vim comes syntax them; try :setf dosini if suits you, can add filetype detection rule: :autocmd bufread,bufnewfile logging.conf setf dosini see :help ftdetect details.

Google maps android api v2 in fragment -

hy everyone....... i've got google maps android api v2 working google maps uses fragmentactivity displaying map want use fragment display map inside m using code @suppresslint("newapi") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); try { setcontentview(r.layout.maps); map = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap(); marker hamburg = map.addmarker(new markeroptions() .position(hamburg).title("hamburg")); marker kiel = map.addmarker(new markeroptions() .position(kiel) .title("kiel") .snippet("kiel cool") .icon(bitmapdescriptorfactory .fromresource(r.drawable.ic_launcher))); // move camera instantly hamburg zoom of 15. map.movecamera(cameraupdatefactory.newlatlngzoom(

email - How do i log all Exception in windows phone 8? -

Image
i craete 1 app using emailcomposetask in windows phone8. it's working fine. @ final of sent mail throw exception. below image. how can solve problem , why problem occurred?. please me. in advance. here code. private void saveemailaddresstask_completed(object sender, taskeventargs e) { if (e.taskresult == taskresult.ok) { messagebox.show("email saved.."); } } private void emailaddresschoosertask_completed(object sender, emailresult e) { try { if (e.taskresult == taskresult.ok) { messagebox.show("selected email :" + e.email); } } catch (exception ex) { messagebox.show(ex.message); } } private void mail_tap(object sender, system.windows.input.gestureeventargs e) { try { emailcomposetask myemail_composetask = new em

php - IF current url equals Onepage Checkout hide element ELSE show element - Magento -

i trying write simple script hide "checkout" button located on sidebar mini cart in magento if on checkout page. obvious reasons don't think checkout button should still visible if customer on checkout page... here have done not working , not sure how far off am. <?php if(mage::geturl('checkout/onepage') == mage::helper('core/url')->getcurrenturl()): ?> <?php echo $this->__('checking out...') ?> <?php else: ?> <button type="button" title="<?php echo $this->__('checkout') ?>" class="btn btn-mini btn-success" onclick="setlocation('<?php echo $this->getcheckouturl() ?>')"><span><span><?php echo $this->__('checkout') ?></span></span></button> <?php endif ?> if kind enough give me shift in right direction i'd grateful or let me know of better me

Where does Rails show the logging output -

in method wrting this: rails.logger.debug("------i here ------- ") i can see if put break point on next line of code, hitting break point, using rubymine ide , running server debug mode, has passed logger.debug method did print it? can't find in console ... there easier way? logs default go #{rails.root}/log/#{rails.env}.log file. that's development.log in case.

Strange values being output to screen from ruby script -

define_method :hash_count hash = '' hash << 'x' while hash.length < 25 hash # returns hash method end puts hash i expecting xxxxxxxxxxxxxxxxxxxxxxxx to outputted screen. instead bizarre random numbers such 3280471151433993928 and -1945829393073068570 could please explain? scoping in ruby seems way weirder in php/javascript! i see expect this. scope problem. the variable hash exists both inside , outside of block function call. whenever declare variable or function same name shadowing in scope - is, make older invalid , using defined behaviour name. in case, declared in scope of block, , shadowed object#hash function string variable inside do/end block. however, variable not shadowed outside of block, , kept original function call. so, example hash = '' define_method :hash_count hash << 'x' while hash.length < 25 hash # returns hash method end puts hash should work expected because

c# - Create Instance using base constructor -

for reasons out of scope of question, i'm needing dynamically create instance of child class inherits base class, calling constructor doesn't exist argument passed base class constructor using example below: should create instance of exampleclass sending value argument1 of baseclass . class baseclass { public baseclass() { } public baseclass(string argument1) { //... } } class exampleclass : baseclass { public exampleclass() { } } edit : made topic explain source or problem: entity framework dbcontext dynamic instatiation custom connection string if understand correct can't modify exampleclass need create instance of uses different constructor base class? i belive there not build in way in framework achive it, reflection. goal should bypass framework , use msil however, topic found on looks promissing. dynamically create type , call constructor of base-class

c# - Add Service Reference Error -

i trying use .wsdl file own wcf project. understand of it, need add service reference of .wsdl file wcf project. error getting 1 : the document understood, not processed. the wsdl document contains links not resolved. there error downloading ' http://address.com/myservice.svc?xsd=xsd0 '. unable connect remote server a connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond 10.7.6.60:80 if service defined in current solution, try building solution , adding service reference again. i have been searching error solution add proxy address not using proxy.

ios - Easiest way to add iPad to Apple developer account -

i have remote beta-testers not @ technically savvy. going testing native ipad app. in country. i need add ipads apple developer account. easiest way them add machines developer account. need simplest approach. use udid app this one udids , add them provisioning profile. then use testflight distribution. testflight send testers email link can download app. no itunes, no xcode. that easiest way!

javascript - Changing img source by clicking button -

i want replace number in image src (eg. eyes1 eyes2) when click button. moverightbtn.on('click', function(){ var eyesimg = $('#eyesimg').get(0).src; console.log(eyesimg) // <--- folder/folder/folder/img/eyes1.png //iterate 1 (eg. eyes1.png eyes2.png) , change src? } what best way this? just expand on pmandell answer, keep increment (if that's want do) also, seems image has id of eyesimg, i've taken account also var counter = 0; moverightbtn.on('click', function(){ $('#eyesimg').attr('src','folder/folder/folder/img/eyes' + counter + '.png'); counter++ } edit here's example involving cats. cats help http://jsfiddle.net/alexjamesbrown/6cve9/

django - Using radio button control to select foreign key pointing to an item in nested inline formset -

i have following classes defined define node class. each node can have multiple nodeintf's assigned it. each nodeintf can have multiple nodeintfipaddr's assigned it. 1 of nodeintfipaddr's maybe assigned mgmt_ipaddr attribute on node object. , 1 of them maybe assigned mgmt_ipaddr_v6 attribute. in template, have nested table interfaces , want use radio button selector choose of ipaddrs selected mgmt_ipaddr(_v6) attributes on node object, i'm not quite sure how it. think that, iterate on ipaddr_formset, have check see if ipaddr represents selected mgmt_ipaddr, i'm not sure how that. appreciated. class node(models.model): name = models.charfield(max_length=64, primary_key=true) mgmt_ipaddr = models.foreignkey('nodeintfipaddr', null=true, on_delete=models.set_null) mgmt_ipaddr_v6 = models.foreignkey('nodeintfipaddr', null=true, on_delete=models.set_null) class nodeintf(models.model): intf = models.charfield(max_length=32)

asp.net - VB/SQL issue - Object reference not set to an instance of an object -

new user here , forum posts have been useful me in past. have problem beginning annoy me , wondering if guys can lend me hand! my problem piece of code: private sub drpuser_databound(byval sender object, byval e system.eventargs) handles drpuser.databound dim newlabel label newlabel = page.master.findcontrol("lbla") me.drpuser.items.findbyvalue(newlabel.text).selected = true end sub the server throws out 'object reference not set instance of object.' , references line 15, be: me.drpuser.items.findbyvalue(newlabel.text).selected = true what don't when run debugger on workstation, code runs. pulls data server fine , identifies me. when change newlabel else, label2, give me object reference error , run fine. but here's thing that's getting me. when switch label names , update server, error gives me references code still same old one! show newlabel when re-uploaded code renamed label2. any thoughts? in advance... you should use new

java - How can I update a table using ajax? -

my problem want whenever new message gets put messages list display in table. problem i'm running can't delete old rows in table setinterval keeps adding same messages table every second or can code hornservice sends new messages when leave page , come don't have messages on list because there no messages in list. in support.jsp have: <table id="supportmessages" class="supporttable"> <tr> <td class="supportcolumn"> status </td> </tr> </table> <script type="text/javascript"> $(document).ready(function() { setinterval(ajaxall, 1000); function ajaxall() { $.ajax ({ url: "/horn/rest/main/getmessages", datatype: "json", type: "get", success: function(json) { for(var = 0; < json.length; i++) { $('#supportmessages tr:nth-child(1)').after( '<

java - Placing an image into a JavaFX 2 table -

i'm trying pretty simple. want place icon in column particular row in table. if it's folder, display folder icon. if it's file, display file icon. does know how in javafx 2? i've tried many things , seems should pretty simple or @ least example somewhere. okay had huge dummy moment. turns out had image url path wrong. i did find site provides great example adding elements table. helped me understand everything. now if 4 different ways tried before would've worked, don't know because image url path wrong. anyway here link , code snippet. bottom line need have cellvaluefactory , cellfactory . attempting use either or. updateitem template method in tablecell relies on value dervied cellvaluefactory . http://blog.ngopal.com.np/2011/10/01/tableview-cell-modifiy-in-javafx/ tablecolumn albumart = new tablecolumn("album art"); albumart.setcellvaluefactory(new propertyvaluefactory("album")); albumart.setpre

css - @media queries not applying some styles -

i have following media query applies background style body successfully, not change others, ideas pleople? @media (min-width: 980px) , (max-width: 1200px) { body { background:#f00; } .contentsearch.navbar {     margin-left: -475px !important;     top: 200px !important;     width: 950px !important; } .contenttabs {     margin-left: -475px !important;     width: 948px !important; } .ui-tabs-panel {  width: 948px !important; } } heres original css these elements .contentsearch.navbar { position:absolute; top:200px; width:1170px; left:50%; margin-left:-585px; } .contenttabs { border-bottom: 1px solid #aaaaaa; border-left: 1px solid #aaaaaa; border-right: 1px solid #aaaaaa; bottom: 55px; height: auto !important; left: 50%; margin-left: -585px; position: absolute !important; top: 241px; width: 1168px; } .ui-tabs-panel { border-bottom: 1px solid #dddddd !important; border-top: 1px solid #cccccc !

objective c - Filter and NSDictionary of NSArray of NSDictionary's -

i have nsdictionary contains 150 keys of boiler manufacturers. value each key nsarray of nsdictionary. each nsdictionary represents boiler properties: nsdictionary boilerdata = { @"alpha" = [{name: boiler1, rating: 80}, {name:boiler2, rating: 90}], @"beta" = [{name: boiler3, rating: 80}, {name:boiler4, rating: 91}, {name:boiler5, rating: 78}], ... } i able filter boiler's have rating of 80. know need nspredicate, can't figure out how build it? none of other articles i've found seem fit requirement. nsdictionary *boilerdata = @{ @"alpha" : @[@{@"name": @"boiler1", @"rating": @80}, @{@"name": @"boiler2", @"rating": @90}], @"beta" : @[@{@"name": @"boiler3", @"rating": @98}, @{@"name": @"boiler4", @"rating": @80}, @{@"name": @"boiler5", @"rating": @90}

python - Infoblox WAPI: how to search for an IP -

our network team uses infoblox store information ip ranges (location, country, etc.) there api available infoblox's documentation , examples not practical. i search via api details ip. start - happy server. modified the example found import requests import json url = "https://10.6.75.98/wapi/v1.0/" object_type = "network" search_string = {'network':'10.233.84.0/22'} response = requests.get(url + object_type, verify=false, data=json.dumps(search_string), auth=('adminname', 'adminpass')) print "status code: ", response.status_code print response.text which returns error 400 status code: 400 { "error": "admconprotoerror: invalid input: '{\"network\": \"10.233.84.0/22\"}'", "code": "client.ibap.proto", "text": "invalid input: '{\"network\": \"10.233.84.0/22\"}'" } i appreciate point

Update row in SQlite database by row position in android -

i have database contains "date" column , "item" column. want user update specific row in database. trying update method in sqlitedatabase class. problem dont know how make update method find row want. saw example use parameters 1 word. this: ourdatabase.update(tablename, cvupdate, rowid + "=" + item , null); my problem want update row have specific item , date. name of item alone not enough. tried code below didnt work, hope youll can me. public void updateentry(string item, string date) throws sqlexception{ string[] columns = new string[]{myitem, mydate}; cursor c = ourdatabase.query(tablename, columns, null, null, null, null, null); long position; contentvalues cvupdate = new contentvalues(); cvupdate.put(date, mydate); cvupdate.put(item, myexercise); int itemall = c.getcolumnindex(myitem); int dateall = c.getcolumnindex(mydate); (c.movetofirst(); !c.isafterlast(); c.movetonext()){

sql - If I need to check if all instances of a tuple are true and return the values of those that are how should I start? -

the question asks me find managers @ specific company have been employed more of more subordinate staff. st_name persons name, st_hiredate when hired , st_possition if manager, assistant or supervisor. when run query below correctly tuples need make comparison can't run produce tuples of managers hired after of junior staff. is there condition can use says if instances of staff member's name not same instances of hire date being before junior staff don't return name? select a.st_name, a.st_hiredate, b.st_name, b.st_hiredate (select st_name, st_hiredate, st_position staff st_position = 'assistant' or st_position = 'supervisor') b join (select st_name, st_hiredate, st_position staff st_position = 'manager') a; there 17 staff 6 of managers , 11 of not. when run above query brings 66 tuples means accurately comparing each manager against each of subordinates. how state must greater every other subordinate staff member? try kind of

sql - Sqlmap inline parameters -

hi ive hear error in cakephp allows sql inyection; https://twitter.com/cakephp/status/328610604778651649 i trying test site using sqlmap, cant find how specify params. the url testing is; http://127.0.0.1/categories/index/page:1/sort:id/direction:asc and parameters want sqlmap inyect in url (page:,sort:,direction:) i have try run; python sqlmap.py -u "http://127.0.0.1/categories/index/page:1/sort:id/direction:asc" but nothing... clue? thanks! in cakephp there passed arguments , named parameters , , querystring parameters . passed arguments .../index/arg accessed $this->request->pass[0] , '0' array index. named parameters .../index/key:value , accessed $this->request->named['key'] . querystring parameters ̀.../index?key=value and accessed with $this->request->query['key']`. your url uses named parameters should (without question mark): http://127.0.0.1/categories/index/page:1/sort:id/direction:asc e

c# - How do I set encoding in an NpgsqlConnection -

i have postgresql database, uses character encoding win1252 . when querying database, records produce error when trying read data, because trying convert utf8 . happens on foreign names containing non-latin characters. the error is: error: 22p05: character byte sequence 0x81 in encoding "win1252" has no equivalent in encoding "utf8" it happens when call read() on npgsqldatareader . my connection defined as: new npgsqlconnection("server=127.0.0.1;port=5432;database=xyz;user id=****;password=****;"); what can read data using c#? i've managed solve problem. there no way of setting property in connection string or of properties of npgsqlconnection or npgsqlcommand . however, able set value of client_encoding in query. directly after opening connection first executed (non)query: set client_encoding = 'win1252' after that, subsequent command on same connection used proper encoding , returned results without complai

Set Location Center of Map - GMaps v2 - Android -

how set center of map specific location using gmaps v2? how did using gmaps v1: public void setcenter( latlng point ) { if( point.latitude*1000000 != 0 && point.longitude*1000000 != 0 ) { if( mmapcontroller != null ) { mmapcontroller.setcenter( point ); } /*else if( mopenstreetmapviewcontrollersource != null ) { mopenstreetmapviewcontrollersource.getcontroller().setcenter( new org.osmdroid.util.geopoint( point.getlatitudee6(), point.getlongitudee6() ) ); mpostponedsetcenterpoint = point; }*/ } } i have looked through api gmaps v2 , can't find , similar functionality. how do this? you can try: map.movecamera(cameraupdatefactory.newlatlngzoom(new latlng(latitude, longitude), zoom)); where map googlemap instance.

scanning - uk.co.mmscomputing.device.twain.TwainIOException : Cannot load Twain Source Manager -

hi every 1 using uk.co.mmscomputing.device lib scan images on computer 32 bit when switched project computer using 64bit system i got error =( uk.co.mmscomputing.device.twain.twainioexception: cannot load twain source manager. @ uk.co.mmscomputing.device.twain.jtwain.getsourcemanager(jtwain.java:126) @ uk.co.mmscomputing.device.twain.jtwain.select(jtwain.java:154) @ uk.co.mmscomputing.device.twain.twainscanner.select(twainscanner.java:25) @ scan.twainappletexample.actionperformed(twainappletexample.java:81) @ java.awt.button.processactionevent(button.java:392) @ java.awt.button.processevent(button.java:360) @ java.awt.component.dispatcheventimpl(component.java:4630) @ java.awt.component.dispatchevent(component.java:4460) @ java.awt.eventqueue.dispatchevent(eventqueue.java:599) @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:269) @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:184) @ java.awt.eventdispatchthread.pumpeven

jquery - JS templating: How do if/else upon value? -

given json data/css.json such: { "css": [ { "group":"boxes", "css-class":"img", "syntaxe": "img/css-metric.png", "logic-english": "", "level":"a1" }, { "group":"boxes", "css-class":"list", "syntaxe": "margin", "logic-english": "", "level":"a1" }, { "group":"boxes", "css-class":"list", "syntaxe": "margin-top", "logic-english": "", "level":"b2" }, { "group":"boxes", "css-class":"list", "syntaxe": "margin-right", "logic-english": "", "level":"b2" } ]} html such as: <body id="anchor"></body> html's js such as: <scri

ms access - Hide report page footer -

i have developed access report made of 4 subreports. first subreport cover page report. in main report footer have added page numbers. page numbers displayed on every page of report including cover page. not want display page number (which page 1 ) on cover page. had similar problem , if me problem, thanks there's no automatic way it. if know vba, can create function you. you'll want textbox in page footer section. use =showpage() control source . you'll want code in module: function showpage(optional clearpage boolean) static pagenum integer if clearpage pagenum = 0 end if if pagenum > 0 showpage = pagenum end if pagenum = pagenum + 1 end function lastly, put ' showpage true ' under report_load event. reset counter each time report run.

c++ - Can't connect to remote ip -

Image
i'm trying connect client server. local address (127.0.0.1) works fine, when try use remote address, doesn't work. search thing on internet couldn't find anything. server side: bool start_server() { int = 1; if(wsastartup(makeword(2,0),&wsadat) != 0) { cout << "wsa error!" << endl; system("pause"); return false; } if ( lobyte( wsadat.wversion ) != 2 || hibyte( wsadat.wversion ) != 0 ) { cout << "bad version of winsocket" << endl; system("pause"); wsacleanup(); return 0; } serwer = socket(af_inet, sock_stream, 0); if(serwer == invalid_socket) { cout << "can't create socketa!" << endl; system("pause"); wsacleanup(); return 0; } int port; cout << "port input " << endl; cin >> port;

oracle - PL/SQL cursor to find all classes that have more than two students whose test scores are above 90% of the average scores of their classrooms? -

i having problems working right value number of students. need use cursors , ouput of program should this... looking led right direction go here little confused. thanks! class name number of students ================================= biology 6 calc 3 german 5 here current code: declare cursor c_1 select c.class_name, avg(s.grade) class c, student s c.class_id = s.class_id group class_name order class_name; grade_rec c_1%rowtype; begin dbms_output.put_line(('class name') || ' ' || ('number of students')); dbms_output.put_line('--------------------------------------'); grade_rec in c_1 loop dbms_output.put_line(rpad(grade_rec.class_name, 15) || ' ' || lpad(grade_rec.avg_grade, 10)); end loop; end; this bit tricky. c

is there a way to switch an activity to android's default bluetooth activity -

i wanted ask if there way in current activity can switch system's default bluetooth activity when go setting>wireless , network>bluetooth settings ?? there is intent settingsintent = new intent(android.provider.settings.action_bluetooth_settings); startactivity(settingsintent); you may find docs useful bluetooth docs

php - Uncaught exception 'DOMException' with message 'Hierarchy Request Error' -

Image
i'm getting error while replacing or adding child node. required : i want change to.. <?xml version="1.0"?> <contacts> <person>adam</person> <person>eva</person> <person>john</person> <person>thomas</person> </contacts> like <?xml version="1.0"?> <contacts> <person>adam</person> <p> <person>eva</person> </p> <person>john</person> <person>thomas</person> </contacts> error is fatal error: uncaught exception 'domexception' message 'hierarchy request error' my code is function changetagname($changeble) { ($index = 0; $index < count($changeble); $index++) { $new = $xmldoc->createelement("p"); $new ->setattribute("channel", "wp.com"); $new ->appendchild($changeble[$index]); $old = $cha

php - Finding Out if a Value in a Generated Array Exists Without Getting a Notice -

i have array, $beerarray , obtained parsing data json api , putting php array. there values, $beer_name, expect in json data aren't there, causing value not exist in array. i've set if... else statements adjust these cases: if (!($beerarray->response->beer->beer_name)) { } else { else } } this prevents errors trying assign variable array value doesn't exist, still pesky notice: notice: undefined property: stdclass::$beer_name in /users/x_/documents/html/php/populatebeer.php on line 66 is there better way structure logic avoid these notices? fills log false positives i'd avoid. use isset() function. pass variable wish see set or not , function return true if variable exists or false if not. for example change if statement to: if (!isset($beerarray->response->beer->beer_name)) { the first block executes if there no beer_name set. 2nd block executes if has name here documentation: http://php.net/manua

java - Does it worth to put entity under @Transactional service layer if just for searching? -

in spring mvc, put jpa entity (from domain layer) manipulation under service layer , crud actions, have make service method or class @transactional . but, thinking, if regular finder method, like myentity myentity = myentity.findbyaliceandbob(alice alice, bob bob); so questions are: do need put under @transactional method? if not necessary , still so, there performance cost? if not necessary, why not call finder method controller? simple answers: do need put under @transactional method? no. if not necessary , still so, there performance cost? yes, you're opening transaction , closing when don't need (note impact on database depends on rdbms vendor). if not necessary, why not call finder method controller? you can it, imo shouldn't since break layered structure. operations against data source (in case, database) must done in dao layer, not in service layer.

javascript - Dynamic Navigation - Loading page into a DIV, without messing up the target page includes (CSS, JS files) -

i've tried use: $("#mydiv").load("myexternalfile.html"); and $get() method, both of them won't load target page properly, loads css fine, happening won't load js includes target file. i don't want use iframes/frames, there other option create dynamic navigation, in way target file includes work fine?

java - ArrayIndexOutOfBoundsException / GUI -

this question has answer here: how avoid arrayindexoutofboundsexception or indexoutofboundsexception? [duplicate] 2 answers i working on programm takes input file , stores information in array. then, there 5 methods adding, deleting, printing information, etc. have created embedded class gui. there 1 button each method. the problem "addentry" method works fine when read information file, when try add information array individually, gives "arrayindexoutofboundsexception". happens through gui. if call method in main class works fine. add method: public void addentry(string sur, string init, string telex) { currentplace++; setsurname(sur); setinitial(init); settelext(telex); array[currentplace] = (new entry(getsurname(), getinitial(), gettelext())); } the variable currentplace field place of last element in array stored. e

linux - Batch File > Javascript > WinSCP > Check if file exists -

i have batch file launch .js file which, via winscp, checks if file exists , returns batch file if or not. the problem is: returns not found, , cannot figure out why. unsure how use wildcard in scenario. the batch file looks this: cscript /nologo file.js if errorlevel 1 goto notfound exit :notfound (another script copy file over) only 1 file can exist on server @ once. every ten min, batch file run, check if there file, if not, copy 1 over. the file.js: // configuration // remote file search var filepath = "../filepath/tss*"; // session connect var session = "mysession@someplace.come"; // path winscp.com var winscp = "c:\\program files (x86)\\winscp\\winscp.com"; var filesys = wscript.createobject("scripting.filesystemobject"); var shell = wscript.createobject("wscript.shell"); var logfilepath = filesys.getspecialfolder(2) + "\\" + filesys.gettempname() + ".xml"; var p = filepath.lastindexof(

css - iOS HTML5 date picker won't accept width: 100%; -

i have html5 date picker in form mobile version of site. text inputs set width:100% , parent td set padding-right:15px make fit. means fields nicely formatted , adjust fill half of container when orientation of device changes. date picker not behave in same way, can help? form: <form method="get" action="home"> <table id="form"> <tr><td> <input type="text" name="title" class="tbox" placeholder="title" /> </td><td> <input type="text" name="genre" class="tbox" placeholder="genre" /> </td></tr> <tr><td> <input type="text" name="location" class="tbox" placeholder="location" /> </td><td> <input type="date" name="date" class="tbox" placeholder="dd/mm/yy" /> </td></tr> <tr><td> &l

extjs - How to write structured data with JSON writer? -

how can include hasone associated model data in json post? structured data required web api in form of: { id: 1234, name: 'aaron smith', address: { address1: '1925 isaac newton sq', address2: 'suite 300', city: 'reston', state: 'va', zip: 20190 } } @nonino i think know how having similar problem. can't associations give me associated data. anyway have scrounged on internet make custom writer or in default writers getrecorddata: function(record,operation) here custom writer ext.define('wakanda.writer', { extend: 'ext.data.writer.json', // alternateclassname: 'simplyfundraising.data.wakandawriter', alias: 'writer.wakanda', writeallfields: false, getrecorddata: function(record,operation) { debugger; ext.apply(record.data,record.getassociateddata()); debugger; var isphantom = reco

javascript - Can someone explain what this Email regex means -

^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\")) @((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.) +[a-za-z]{2,}))$ i understand parts of regex not entire expression , like ([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*) match 1 or more characters that's not characters <>()[\]\\.,;:\s@\" \\ not sure [\]\\ , \s@\ means i understand of other parts not single entity. here go: ^( ( [^<>()[\]\\.,;:\s@\"]+ // disallow these characters amount of times ( \. // allow dots [^<>()[\]\\.,;:\s@\"]+ // disallow these characters amount of times )* // group must occur once or more ) | // or (\".+\") // surrounded quotes (is legal?) ) @ // @ symbol litterally ( // ip address ( \[ // allows square bracket [0-9]{1,3} // 1 3 digits (for ip add

knockout.js - Tracking changes - observable element in observableArray -

i need edit array of integers in web application, using javascript , knockout.js. array bound text boxes, , whenever value of text box changed, array updated. , when gets updated, sum of elements calculated. this first try: http://jsfiddle.net/zls2a/0/ . not working (the sum value not update when typing new value element). that's when realized observablearray trigger sum function after inserting or removing items. <h4>numbers</h4> <button data-bind="click: add">add</button> <ul data-bind="foreach: numbers"> <li> <input data-bind="value: $data"></input> </li> </ul> <span data-bind="text: sum"></span> function myviewmodel() { var self = this; self.numbers = ko.observablearray([ 1, 2, 3 ]); self.sum = ko.computed(function() { var items = self.numbers(); var total = 0; (var = 0; < it

How do I merge data from two tables into one using Sql Server 2008? -

i'm using sql merge , trying merge 2 tables single table. basically, there 3 tables named: t1,t2,t3. i'm attempting t2 table data , t3 table data t1 table using merge. here code: merge daily_so_invoice target1 using temp_invoice source1 ,temp_so_invoicedetail source2 on target1.invoice_id = right('00000000'+ convert(varchar,source1.invoice_instance_id),8) , target1.linekey<>'9999' , right('0000000'+convert(varchar,source1.invoice_instance_id),7) = right('0000000'+convert(varchar,source2.invoice_instance_id),7) when matched update set target1.batchno = upper(right('00'+convert(varchar,day(source1.billing_date)),2) + left(datename(month, source1.billing_date), 3)) when not matched insert ( invoice_id, linekey, item_unit_price , invoiced , batchno , item_name , item_description , quantity ) values ( right('00000000'+convert(varchar,source2.invoice_instance_id),8), right('0

c# - Automatically delete TextBox and label if TextBox.Text = Empty on focus leave -

i have code windows form starts 1 label , 1 textbox , when user starts type on textbox1 ,it creates new textbox , label down (also change location of 2 buttons , change windows form size,it happens max of 10 text box + 10 labels (side-side) like: (label1) enter name 1: - textbox1 imput (label2) enter name 2: - textbox2 imput (label1) enter name 3: - textbox3 imput ... it works great, have little "problem": my code creates new textbox / label when user starts type on last textbox if user stops on textbox7 example, code have created textbox8 although not needed , not contain text (is blank), therefore delete automatically if user tabs textbox7 textbox8 , leaves textbox8 (without entering text tb8) my code isn't working (will explain below) , if click on button verify if last textbox text empty , if is, delete text box , label @ side , changes localization buttons , windows form size). i have many problems because textbox 2 10 create