Posts

Showing posts from January, 2013

C++ Access private member of nested class -

the title might bit misleading. have following problem: have tree consisting of leaves , internal nodes. user should able store information in leaves and tree has methods set of user-defined values , need access corresponding leaves in constant time (not amortized). i came following idea not work because unfortunately cannot access private members of nested class: user creates tree and each leaf instance of userelement contains user_defined value corresponding leaf. once method dosomethingwiththetree(list>) called , tree built, tree creates corresponding leaves , saves in private field leaf . whenever user wants call method of leaves corresponding user_defined values, he/she has call method giving corresponding userelement s , tree can retrieve corresponding leaves in constant time. class tree { public: template <typename t> class userelement { private: t user_value; tree_node* leaf; // has private

Magento Block construct - use _construct or __construct? -

i little bit confused. read alan storm's excellent article magento block lifecycle methods , far understand 1 should using protected _construct() method initialize block. in case want set right block template. assume should using protected function _construct() { parent::_construct(); $this->settemplate('stenik/qaforum/forum.phtml'); } however, when @ blocks of of core magento modules, seem use php __construct method it. example mage_poll_block_poll , mage_productalert_block_price , mage_rating_block_entity_detailed , mage_review_block_form although both ways work, i'd know right way it. it's academic, right way it® override magento constructor i.e. _construct requested core team in mage_core_block_abstract : /** * internal constructor, called real constructor * * please override 1 instead of overriding real __construct constructor * */ protected function _construct() { /** * please override 1 instead of overriding re

How to get first-level elements from HTML file with HTML Agility Pack & c# -

i want first-level elements via parsing html file html agility pack ,for example result this: <html> <body> <div class="header">....</div> <div class="main">.....</div> <div class="right">...</div> <div class="left">....</div> <div class="footer">...</div> </body> </html> that each contains other tag... want extract text exist in website,but separately . example right side separate,left side separate , footer , so... can me? thanks... use htmlagilitypack load webpage given url, parse selecting correct corresponding tags. htmlweb page = new htmlweb(); htmldocument doc = new htmldocument(); docc = page.load("http://www.google.com"); if want select specific div class name ' header ', using documentnode property of document object. string maintext = doc.documentnode.selectsinglen

phpmyadmin - Find and replace <p> with return key entry in MySQL -

i have implemented nl2br(htmlspecialchars(... display user entered mysql data. annoyingly various posts littered tags before knew nl2br . there quick way scan through mysql (i use php myadmin) , replace <p> return key entry nl2br picks on? there tags in 1 of columns. thanks edit: example ...d wood on front car cracked - has stood test of time well. <p> such ancient coaster, affords surprisingly ride – relic can still deliver.. so <p> should removed , replaced empty line given example, <p> elements not necessary. can replaced \n : update yourtable set thecolumn = replace(thecolumn, '<p>', '\n')

html - How do I add an image map link? -

i'm unsure if correct approach, or question, elaborate. please visit live page http://thedinnerparcel.co.uk/index.php?option=com_content&view=article&id=22&itemid=3 i asking if possible overlay link somewhere in header div? on sticker background image on right? i didn't build site, have added sticker right corner of header div. (fyi it's joomla site uses php template file.). i did background image , used padding , negative margin make overflow, realised sticker needs link order page. would image map best way make link? or there better method? if image map way has got code example. i've tried below code, edited tutorial on similar subject, doesn't work <div id="header" usemap="#image-maps_2201202140621298"> <map id="image-maps_2201202140621298" name="image-maps_2201202140621298"> <area shape="rect" coords="0,0,275,44" href="#" alt="dinner parcel&

gis - gdal/ogr: How to really crop a shapefile? -

given shp file corresponding european countries , and... given defined area corresponting france such : west : 005° 48' w east : 010° e north : 051° 30' n south : 041° n how dots/geometries intersects defined area gdal ? crop indeed real crop, keep necessary geometries. strong preference gdal , ogr or console solutions. use gdal's ogr2ogr command-line utility. if have file europe.shp has spatial reference units of degrees, use -clipsrc option decimal degrees make new shapefile: ogr2ogr -clipsrc -5.8 41 10 51.5 france.shp europe.shp there an example @ ogr2ogr page france used example.

javascript - Google Maps DirectionsService multiple calls -

does know why giving me directions n+1 routes. example a-b-c-d-e-f, give me following routes: a-b b-c (empty result) c-d d-e (empty result) e-f here's google maps code, , i'm calling (inside uiwebview): showdirections([a, b, c, d, e], true); var directionsservice = new google.maps.directionsservice(); function showdirections(locations, metric) { var units = metric ? google.maps.unitsystem.metric : google.maps.unitsystem.imperial; (i=0; i<locations.length-1; i++) { console.log('navigating: '+locations[i].title+' '+locations[i+1].title); var request = { origin: new google.maps.latlng(locations[i].location.lat, locations[i].location.lng), destination: new google.maps.latlng(locations[i+1].location.lat, locations[i+1].location.lng), travelmode: google.maps.directionstravelmode.driving, avoidhighways: !!(locations[i].avoidhighway), unitsystem: units }; settimeout(function() { getdi

Vim sign column toggle -

when signs defined in vim, column appears @ left of screen. from vim help: when signs defined file, vim automatically add column of two characters display them in. when last sign unplaced column disappears again. is possible remove column whilst there still signs defined? ideally toggle column on / off. well, need unplace signs current buffer have them not displayed. recent vims (e.g. newer thane 7.3.596) can use :sign unplace * . you can take plugin https://github.com/chrisbra/savesigns.vim save signs temporary file (which in fact create vim script, able replace signs. using plugin can write custom function toggle displaying signs. something might work you: fu! mysignstoggle() if !has("signs") || empty(bufname('')) return endif if !exists("s:signfile") let s:signfile = tempname().'_' endif redir =>a|exe "sil sign place buffer=".bufnr('')|redir end let

Using the Google javascript client library in a native Mac app -

i'm using google javascript client library use google drive view , open files. it works fine on website work in webview in native mac app. when try authorize app in javascript in webview on mac failed load resource: server responded status of 400 (bad request) . the problem url parameter origin=file:// in request. from i've read should localhost don't know how correct through client library.

node.js - What is the naming convention of NodeJS? -

i found naming conversion of node little strange. instance, in file system module , read link function 's letters lower cased: fs.readlink but read file function 's name camelized: fs.readfile it confused me. after mistyping times, think shoud ask. there naming convention me memorize api names? node's default convention camelcase. functions in file system module named according respective posix c interface functions. example readdir , readlink . these functions names well-known linux developers , therefore it's decided use them is(as single word), without camelizing.

c# - SortedSet.Contains gives error "at least one object must implement ICombarable" -

i have 2 sortedsets: sortedset<sortedset<int>> sset1 = new sortedset<sortedset<int>>(); sortedset<sortedset<int>> sset2 = new sortedset<sortedset<int>>(); later on check make new sorted set: sortedset<int> newsset = methodthatreturnssortedset(); now want check if sset1 , sset2 contain newsset: if (!sset1.contains(newsset) && !sset2.contains(newsset)) <--error on line { sset1.add(next); //some more code } so error argument exception, "at least 1 of these objects must implement icomparable. i have looked @ other questions same problem, in case want compare own classes. checking if item in set. yea..i have no idea how solve this, pointers? you can't have sortedset of sortedset s unless specify custom comparer, because sortedset not implement icomparable in itself. whenever use type sortedset<x> , set organized in increasing order based on x , x must icompa

What's the best way to clear session files for a cherrypy app on RHEL 6 without clearing active sessions? -

what's best way clear session files cherrypy app on rhel 6.3 without clearing active sessions? can run cron job clears files last modified greater 15 days old? i've tried executing command... find /path/to/files* -mtime +5 -exec rm {} \; from this site but doesn't remove files modified @ least 5 days ago. appreciated. the sessions in cherrypy expired , removed given parameters of session: timeout: specify minutes of inactivity mark expired. clean_freq: specify frequency of session cleaning in minutes for example dispatch thread delete files each 3 minutes , timeout of 5 minutes configure session this: {'tools.sessions.timeout': 5, 'tools.sessions.clean_freq': 3} for more information on properties of session check out the official documentation. but if looking execute cleaning cronjob why not specify +4 instead of +5 include 5 on date range, like: find /path/to/files* -mtime +4 -exec rm {} \;

ruby on rails - Parsing JSON in Controller w/ HTTParty -

in controller have following code... response = httparty.get('https://graph.facebook.com/zuck') logger.debug(response.body.id) i getting nomethoderror / undefined method `id' if do... logger.debug(response.body) it outputs should... {"id":"4","name":"mark zuckerberg","first_name":"mark","last_name":"zuckerberg","link":"http:\/\/www.facebook.com\/zuck","username":"zuck","gender":"male","locale":"en_us"} one think it's response.body.id , that's not working. in advance! try this: body = json.parse(response.body) id = body["id"] for kind of thing, i'd recommend either a) using koala or b) create class using httparty. can set format: json auto parse returned json. see here , here

Kendo UI Web grid read fails after pagination -

Image
i using kendo ui web grid on asp.net mvc 4 application. noticed strange problem in it. i have grid 72 records, show 20 records per page size. can click on pagination see next 20 records. after click on next page 2 can see next 20 records of 72. here have jquery call refresh grid. var grid = $("#mygrid").data("kendogrid"); grid.datasource.read(); i noticed problem is, when use jquery read grid again. not resetting [datasourcerequest] datasourcerequest request , creating problem. how can fix this. solution following @paris below code resolved issue. var grid = $("#mygrid").data("kendogrid"); grid.datasource.page(1); grid.datasource.read(); try putting grid.datasource.page(1); before read() call if don't mind refreshing grid page one.

android - onFocusChangeListener on EditText created at runtime -

i want setup onfocuschangelistener() on dynamically created edittext. function of listener same edittexts creating same kind of edittext. once edittext has created edittext should stop listening onfocuschange. note: know have asked question couldn't find solution how setup onfocuschangelistener() on dynamically created set of edittexts?

HTML Form Action Java -

i have java program want input html form . if possible load url this .../html_form_action.asp?kill=kill+server but i'm not sure how load url in java. how this? or there better way send action html form ? depending on security, can make http call in java . referred restful call. httpurlconnection class offers encapsulation basic get/post requests. there httpclient apache .

javascript - CKEDITOR style with unique id -

i using ckeditor styles system -- i'd create style assigns unique attribute. i have simple plugin calls style create: editor.addcommand( 'tag', { exec: function( editor ) { var randnumber = math.floor((math.random()*1000000000)+1); var mysqldatetime = new date(); ckeditor.config.tag = { element : 'span', attributes : { 'class': 'tag-'+randnumber, 'data-datetime' : mysqldatetime, 'data-tag': 'tag' } }; var style = new ckeditor.style( editor.config.tag ); editor.addcommand( 'tag', new ckeditor.stylecommand( style ) ); } }); but datetime , randomnumber generated once. how can attributes calculated each time command executed? try following code ( jsfiddle ): ckeditor.replace( 'editor1', { plugins: 'wysiwygarea,sourcearea,toolbar,basicstyles,link', on: { pluginsloaded: funct

java - Painting a Runnable JPanel -

i working on little horse race simulator , stuck it. want user first select number of horses in race (2-6) , click on "start" button. then, want draw/paint race track , horses (represented circles). reason, when code reaches point of creating instance of horse, never gets drawn frame. below code. missing? main.java: import javax.swing.swingutilities; public class main { public static void main(string[] args) { swingutilities.invokelater(new runnable() { @override public void run() { racetrack myrace = new racetrack(); myrace.setvisible(true); } }); } } racetrack.java: import java.awt.borderlayout; import java.awt.container; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.borderfactory; import javax.swing.buttongroup; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.jradiobu

Perl DBI SQL Server not returning full column -

i having issue sql server , perl. if run sql statement via isql expecting. when running perl columns after first seem truncated. have below set. $dbh->{longtruncok} = 1; $dbh->{longreadlen} = 1000 * 1024; expected output: | xxxxx | 2013-08-19 10:04:53.843 | nnnn | description what getting: | xxxxx | 2013-08-19 10:0 | n | desci any ideas?

python - Getting strange results from wxPython WebView -

i'm making huffington post rss feed aggregator in wxpython, i've run trouble. in program there 2 panels in main wx.frame: 1 shows list of articles , other show web view of article user selects. haven't gotten part yet, decided test web view widget loading google. when this, i'm getting strange results. here relevant code: hbox = wx.boxsizer(wx.horizontal) listpanel = wx.panel(self, -1, style=wx.sunken_border) htmlpanel = wx.panel(self, -1, style=wx.sunken_border) browser = wx.html2.webview.new(htmlpanel) browser.loadurl("http://www.google.com") hbox.add(listpanel, 1, wx.expand) hbox.add(htmlpanel, 2, wx.expand) self.setautolayout(true) self.setsizer(hbox) self.layout() and here picture of get: http://i.imgur.com/tvukzre.png i seem text box in upper left corner, possibly google search box? no clue or why i'm getting this. if happens see i've gone wrong, appreciate help. edit: here runnable code shows problem: import wx import wx.ht

Git - where are the files stored -

i new git , version control in general, bear me. i followed directions @ http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/ create git repository on server. note bare repository. what unable understand files stored on server. not present in folder in repo created. folder structure (ls command): branches config description head hooks info objects refs i cannot find files (bunch of sql files) anywhere in here. they? note git clone user@server.com:/path/to/repo local machine works fine. the files in objects in few large binary files. won't find separate sql files there. need use git command access them.

'awk' version of this Python code? -

this python code: with open('a') f: a, b = f a, b = a.strip(), b.strip() while awk code: awk '{printf $1":"}' i modify awk code can python code above does. as seen above, awk code mess. i need grab line 1 , 2 file a , permit me use variables. possible in python code. or perhaps there else native linux? that should of? if not mistaken, there is: sed awk python but fastest of awk. i hope python code has error/exception handling, in case file a has more 2 lines. i assume file has 2 lines, , in awk: awk '{a[nr]=$0}end{ #here whatever a[1] (a) , a[2] (b)}' file for example: kent$ seq 2|awk '{a[nr]=$0}end{print "hello "a[1]; print "hi "a[2]}' hello 1 hi 2 or this: kent$ seq 2|awk '{a[nr]=$0}end{printf "%s:%s\n",a[1],a[2]}' 1:2 i hope helps.

java - Comparing 2 sets of integer values in 2 separate arrays -

i quite new java , have problem struggling work with. have 2 sets of numbers, stored in 2 separate arrays, representing lottery numbers. first set user numbers , second set numbers lottery webpage. have tried compare numbers position position in array unsure result leaves me correct number of matches , how can include match bonus ball, there 6 user numbers lottery, 7 lottery numbers in draw (6 numbers plus bonus number). have included code below: // set array store numbers latest draw on lottery web page integer [] numbers = new integer [split.length]; int = 0; (string strno : split) { numbers [i] = integer.valueof(strno); i++; } (integer no : numbers) { system.out.println(no); } element bonuselement = firstlottorow.child(3); integer bonusball = integer.valueof(bonuselement.text()); system.out.println("bonus ball: " + bonusball); //elements elementshtml = doc.getelementsbytag("main-ar

jquery - GWT Disable horizontal drag scrolling -

i have celltable inside scroll panel. way can vertically scroll through items. have been using gquery plugin drag , drop functionality. wanting drag item 1 table another. problem when try drag , item table 1 table 2, scroll panel doing horizontal autoscroll, item never escaping scroll panel. how drag , item outside scroll panel? you horizontal overflow if , if widget within scroll panel (i.e. 1 set using flowpanel.setwidget(widget) ) horizontally larger scroll panel. the easiest way avoid use standard flowpanel widget, because default, wide scroll panel.

python - how to setup custom middleware in django -

i trying create middleware optionally pass kwarg every view meets condition. the problem cannot find example of how setup middleware. have seen classes override method want to, process_view: class checkconditionmiddleware(object): def process_view(self, request): return none but put class? create middleware app , put class inside of , reference in settings.middleware ? first: path structure if don't have need create middleware folder within app following structure: yourproject/yourapp/middleware the folder middleware should placed in same folder settings.py, urls, templates... important: don't forget create __init__.py empty file inside middleware folder app recognize folder second: create middleware now should create file our custom middleware, in example let's supose want middleware filter users based on ip, create file called filter_ip_middleware.py inside middleware folder code: class filteripmiddleware(object):

Layar: Opening App Store from Layar HTML Widget in JavaScript or JQuery -

i'm unsing html widget in layar has control interaction. no layar buttons. trying use simple javascript / jquery function open target app in app store: $('.btn-download').click(function(){ window.location.href = "itms://itunes.com/apps/someapp"; }); i simular opening mail window mailto: works fine. somehow nothing. b.t.w. has work on ios. try using this: settimeout(function() { window.location = "http://itunes.com/apps/someapp"; }, 25); window.location = "custom-uri://"; copied from: is possible register http+domain-based url scheme iphone apps, youtube , maps?

subquery - mysql: group functions on subqueries with limits -

i have group of users perform tasks on scored. i'm trying create report showing average of each user's last 50 tasks. user table: userid, username, usertype task table: taskid, score, tasktype, userid if do: select u.userid, u.username, (select avg(score) task t t.userid = u.userid , t.tasktype = 'task1' order t.taskid desc limit 50) avgscore user u u.usertype = 'utype'; that doesn't work because limit 50 after average of everything. what need this: select u.userid, u.username, avg(select t.score task t t.userid = u.userid , t.tasktype = 'task1' order t.taskid desc limit 50) avgscore user u u.usertype = 'utype'; but not valid syntax i've tried sub-sub queries, can't way either, problem limit, or join, or unknown fields when reference u.userid in su

problems Integrating an asp.net website into an asp.net mvc 4 application -

i creating asp.net mvc 4 application replace suite of existing projects including asp.net 3.5 website , windows forms. i have spent many months developing asp.net mvc 4 application scratch , have been focusing on windows forms appliction. i trying integrate asp.net 3.5 website....for trying add website project. have looked how , see of need...but have few problems. i using areas. carrier area (where website applies) have added folder called aspnet...and have added webpages , other code folder....all of compiles. i have modified routconfig.cs file adding line: routes.ignoreroute("{resource}.aspx/{*pathinfo}"); when added webpages project added code, ignoring project files , web.config asp.net website..... i don't think need convert on project files @ all...but trying figure out web.config....i know can have web.config in aspnet folder....but put question..... i tried copying existing file, had issues different .net version (website v3.5 , mv

sql - error deleting content that matches the result of a Select in ODBC -

i working odbc driver, , trying delete old comments database. getting error , don't know why. tables exist , accessible me. delete [z_test_pnt.pnt_comment_record] [z_test_pnt.pnt_comment_record].[l2key] in (select point.queuekey [z_test_pnt.pnt_header_record] point (datediff(day, point.last_update_time, now()) > 7)) i error: [odbc eop driver][openaccess sdk sql engine]base table:z_test_pnt.pnt_header_record not found.[10129] i appreciate suggestions. thank you. found it! needed remove brackets table names. added them in first place because having error running query vbs, , thought error couldn't have name more 1 dot on it. code works: delete z_test_pnt.pnt_comment_record z_test_pnt.pnt_comment_record.[l2key] in (select point.queuekey z_test_pnt.pnt_header_record point (datediff(day, point.last_update_time, now()) > 7))

c# - Convert DateTime Column Format in DataSet from US/UK to US -

how can optimize below method convert dataset datetime column us/uk format format. initial date format can us/uk or other country. need convert date format in output dataset private dataset modifydatetousformat(dataset ds) { dataset dsres = new dataset(); datetimeformatinfo usdtfi = new cultureinfo("en-us", false).datetimeformat; //convert datetime string type datatable dtcloned = ds.tables[0].clone(); foreach (datacolumn dc in ds.tables[0].columns) { if (dc.datatype == typeof(datetime)) dtcloned.columns[dc.columnname].datatype = typeof(string); } foreach (datarow row in ds.tables[0].rows) dtcloned.importrow(row); //change string format format. since database expects format only. foreach (datarow row in dtcloned.rows) { foreach (datacolumn dc in ds.tables[0].columns) { if (dc.datatype == typeof(dat

php - Make Image with Text Function Not Working -

i'm trying create images text on them. here function have created: function maketitleimage($text){ $im = imagecreatetruecolor(160,160); $background_color = imagecolorallocate($im,154,205,50); $text_color = imagecolorallocate($im,255,255,255); imagefill($im,0,0,$background_color); imagettftext($im,10,0,0,$text_color,"./asansblack.ttf",$text); header('content-type: image/png'); imagepng($im,($text.'.jpg')); imagedestroy($im); } this creates 160x160px image background colour no text, named appropriately (so know $text being passed in correctly). path .ttf file accurate. not sure else going on? silly. thanks! your imagettftext function missing parameter, y-coordinate of text. try like imagettftext($im,10,0,0,10,$text_color,"./asansblack.ttf",$text);

How do you access activities from the public activity gem inside the rails console? -

i trying figure out how activities in rails console when using public activity gem. you rails console doing rails c and publicactivity::activity.all

javascript - PhoneGap / Android WebView throws "Unknown chromium error: 0" -

i'm developing project using phonegap , need ajax request local webserver has already: php code header('access-control-allow-origin: *'); anyway, when ajax request jquery on android error (in adb logcat): d/chromium(23078): unknown chromium error: 0 the javascript code is: $.ajax({url:"http://192.168.1.219/works/privati/folder/api.php/getlastmaginfo",datatype:"json",success:function(data) { console.log("finished loading ajax"); console.log(data); }}); in ripple emulator works expected, in android nope. any suggestion? thank help! update 2013-08-21: after researches came @ conclusion $.ajax won't work phonegap (don't know why, maybe bug?). must use $.get instead, when request $.get unknown chromium error: -6 read here problem due android's bug webview url mechanism. i'll continue research until find , working solution update 2013-08-21 (2): not using works... var filetransfer = new filet

emacs - A smarter alternative to delete-window? -

sometimes multiple windows open same buffer (or similar one) , have differentiate whether or not buffer in window same before deciding either kill or delete window. is there way in emacs delete window if buffer exists in another? ideally same function kill buffer , window if instance of buffer in window. (defun delete-extra-windows () (interactive) (let* ((selwin (selected-window)) (buf (window-buffer selwin))) (walk-windows (lambda (ww) (unless (eq ww selwin) (when (eq (window-buffer ww) buf) (delete-window ww)))) 'no-mini 'this-frame)))

android - S Pen and ProGuard issue when creating canvas -

Image
i running issue w/ s pen sdk v2.3 , proguard v4.9 non-signed apk enables me use entire canvas/note whereas signed apk, gives me access partial note - 1 half of note, while visible, doesn't allow me write. i mucked around lot w/ proguard config , yet have no luck. tried creating signed apk simple s pen project , can work expected. however, there must in package preventing me accessing note. here proguard.cfg: -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dontwarn com.google.common.** -dontwarn org.apache.commons.* -dontwarn org.scribe.services.* -dontwarn com.fasterxml.jackson.databind.** #after updating android support library rev.18 -dontwarn android.support.v4.** # activities, services , broadcast receivers specified in manifest file won't automatically included -keep public class * extends and

php - Object has no method sort -

i having issue php javascript , sorting. have following js script function sortby(param, data) { switch (param) { case "aplha": console.log(data); data.sort(); break; } } the array passing through json_encode , array looks array ( [0] => array ( [name] => 123456 [clean_name] => 123456 [createdate] => 1372479841 ) [1] => array ( [name] => 123456 [clean_name] => 123456 [createdate] => 1372479841 ) ) however above error when try pass data.sort() . ideas? php arrays aren't js arrays, json objects, can't have , array on js code. however, there's workaround, refer this answer more info. cheers

Visual Studio through MSDN: Can they know it is not mine? -

so, arguing great friend of mine visual studio 2012 , microsoft being able detect 1 used. according him if hands on direct msdn download of visual studio 2012 professional, , end creating app, game or something, , submit windows app store, never know visual studio version used develop app, or if owner of or not. is right? because thought visual studio how left footprint behind on .exe file letting microsoft know licensing information. or should go apologize him calling him f...ing liar. if guys leave print, can show proof, or link read more it? guys. your friend correct. why ms bother when make freely available tools need compile program. can build .net applications without visual studio ide. see related question is possible install c# compiler without visual studio?

Can any Java program be deployed to Geronimo -

i'm working in lab typically deploy apps geronimo. have existing stand-alone server based app written in java. can java application hosted in geronimo? if so, there reference take existing app , host in geronimo? there benefit hosting in geronimo or there times when best left stand-alone app? when work on application server, there specific way program should written qualified deployment on app server. program can servlet, ejb, jsp etc. if existing stand-alone server based app of these, can surely deployed on geronimo.

java - Rectangle.y issue, persistently rendering at 0 -

i'm trying render rectangle jpanel: playerrect = new rectangle(100,100,10,10); problem is, playerrect renders @ 100,0 every time. i've updated eclipse , java, troubleshoot code , played x, y, width, height (although i'm not sure how code affect java.awt.rectangle). any clue causing this? package game; import java.awt.color; import java.awt.graphics; import java.awt.image; import java.awt.rectangle; import java.awt.event.mouseevent; import javax.swing.imageicon; public class player { private world world; private rectangle playerrect; private image playerimg; protected int xdirection, ydirection; //block variables private int hoverx, hovery; private boolean hovering; public player(world world){ this.world = world; playerimg = new imageicon("d:/student data/gametest1/gameengine/res/player.png").getimage(); playerrect = new rectangle(100, 100, 10, 10); // ### here's issue ### } private void setxdirection(int d){ xdirection

ios - Optimizing an array of UIImages -

so i'm building app user takes pictures of themselves, saves them camera roll, , i'm saving references asset urls display them in app. @ first model seemed work fine, took more , more pictures started receiving memory warnings , crashed. there better way approach this? this how load saved photos @ launch of app (which freezes app 10 seconds depending on how many being loaded): - (void) loadphotosarray { _photos = [[nsmutablearray alloc] init]; nsdata* data = [[nsuserdefaults standarduserdefaults] objectforkey: @"savedimages"]; if (data) { nsarray* storedurls = [[nsarray alloc] initwitharray: [nskeyedunarchiver unarchiveobjectwithdata: data]]; // reverse array nsarray* urls = [[storedurls reverseobjectenumerator] allobjects]; (nsurl* asseturl in urls) { // block handle image handling success alassetslibraryassetforurlresultblock resultblock = ^(alasset *myasset) {

ios - Loading image from folder using NSBundle and plist -

Image
trying display load image folder present on mac desktop using path (/users/sai/desktop/images/aaa.jpg) created in plist file called data.plist @ item0. im using nsbundle diaplying image path not loading image desktop .i have done lots of research still couldn't find solution .plz me .here code nsstring *path=[[nsbundle mainbundle]pathforresource:@"data" oftype:@"plist"]; nsdata *plistxml = [[nsfilemanager defaultmanager] contentsatpath:path]; nsstring *errordesc = nil; nspropertylistformat format; nsdictionary *temp = (nsdictionary *)[nspropertylistserialization propertylistfromdata:plistxml mutabilityoption:nspropertylistmutablecontainersandleaves format:&format errordescription:&errordesc]; nsarray *array=[nsarray arraywitharray:[temp objectforkey:@"images"]]; nsstring *object=[array objectatindex:0]; nslog(@"object @ index %@",[object lastpathcomponent]); nsstring *image=[object lastpathcomponent]; mimageview.image=[uiimage

Excel VBA copy cells on key press -

i'm using vba dynamically change worksheet while typing cell. so, i've been using api code found here: excel track keypresses so sub sheet_keypress describes desired action upon pressing key. however, i've been running problems following: private sub sheet_keypress(byval keyascii integer, _ byval keycode integer, _ byval target range, _ cancel boolean) dim col string col = chr(keyascii) worksheets(1).range("g" & 4 & ":g" & 6).value = _ worksheets(1).range(col & 1 & ":" & col & 3).value end sub when go sheet , type somewhere not in rows 1-3, first keypress fine. however, second keypress not recorded, , further key gives error 1004. causing error , possible avoid it? the problem appears stem fact excel locks worksheets being changed whilst in "edit mode" (i.e. editing value in cell) until after exi

c# - How to Use IsolatedStorage to Set Lock Screen Background in Windows Phone 8 -

i able use image isolatedstorage modify lock screen background, having trouble getting correct syntax of isolatedstorage file path set lock screen background. in following http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206968(v=vs.105).aspx , calling lockhelper method in button click event once image has been selected list named recent (which has been populated picturerepository.cs loads images isolatedstorage) private void recent_selectionchanged(object sender, selectionchangedeventargs e) { capturedpicture = (sender longlistselector).selecteditem capturedpicture; if (capturedpicture != null) { //filename name of image in isolatedstorage filename = capturedpicture.filename; } } void setaslockscreenmenuitem_click(object sender, eventargs e) { if (!string.isnullorempty(filename)) { //picturerepository.isolatedstoragepath string = "pictures"

asp.net - StoredProcedure in C#, passing parameters from text boxes -

i have simple page wan find out how pass data text boxes procedure. kind of new passing parameters code behind in db,i have 1 page code <%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:textbox id="lastname" runat="server"></asp:textbox> <asp:textbox id="firstname" runat="server"></asp:textbox> <asp:textbox id="phone1" runat="server"></asp:textbox> <asp:textbox id="phone2" runat="server"></asp:textbox> <br /> <asp:button id="button1" ru

Apache won't start in MAMP Pro -

i’ve tried several ways mamp pro work me. main issue apache keeps conking out, not sure why. apache starts when don’t have servers other local. when start create new servers apache won’t run. here setup per screen shots: shot 1: http://kualitydesign.com/css-tricks/mamp-1.png shot 2: http://kualitydesign.com/css-tricks/mamp-2.png i’ve googled, i’ve been able find how start new server, know how when mp starts normally. what don’t know how troubleshoot mp when apache doesn’t start. need work locally new wp build , love , running. if has had same issue, can spot error, or has other ways fix issue , cares share, rule! my hunch, , it’s noob hunch, apache on mac running , it’s conflicting mp’s apache, if that’s possible. re-call reading somewhere. thank you.