Posts

Showing posts from January, 2010

winapi - How are printer notifications in Windows supposed to work with network printers? -

i have application needs print files of different types using associated applications printing using shellexecute , "print" verb. application needs (hopefully) reliably know when 1 print job processed , can issue next one. accomplish using findnextprinterchangenotification , seems work fine using local printers, e.g. installed via usb, different behavior if network printers involved. one of clients used application network printer, meaning professional printer it's own print server embedded, installed on windows server 2008 r2 , shared installed printer using windows it's clients. in scenario findnextprinterchangenotification returned success, it's returned structures got flag printer_notify_info_discarded set well. reproduce behavior windows server 2008 r2 on own didn't export printer it's own embedded printer server, locally installed freepdf xp. additionally, same behavior if use samba, cups , cups-pdf on 1 of our ubuntu development servers: samba

c++ - Using MySQL++ throws EXC_BAD_ACCESS -

i'm attempting connect mysql database following code. throws exc_bad_access gets "query query = conn.query()" line. reason? in advance! #include <iostream> #include <mysql++/mysql++.h> using namespace mysqlpp; int main(int argc, const char * argv[]) { try { connection conn(false); if (conn.connect("db", "localhost", "root", "root")) { query query = conn.query("select * django_site"); } } catch (badquery er) { std::cerr << "error: " << er.what(); return -1; } catch (const badconversion& er) { // handle bad conversions std::cerr << "conversion error: " << er.what() << std::endl << "\tretrieved data size: " << er.retrieved << ", actual size: " << er.actual_size << std::endl; return -1; } catch

Resize png image in Delphi - incorrect alpha channel -

Image
i resizing png images might have alpha channel. everything works good, 1 exception: gray pixels around transparent areas. the original image doesn't have drop shadows. is there way fix / work around? i using smoothresize gustavo daud (see first answer this question ), resize png image. i cannot provide code using did not write , not have author's permission publish it. i suspect caused 2 things: funny rgba values in png , naive resizing code. you need check png contents. looking rgb values in transparent areas. despite transparent areas having alpha @ 0, still have rgb info. in case expect transparent areas filled black rgb value. might cause grey outline after resize if resize done naively. example: happens if code resizes 2 adjustent pixels (0,0,0,0) , (255,255,255,255) one? both pixels contribute 50% result 128,128,128,128) semi-transparent grey. same thing happens when upscale e.g x1.5, added pixel inbetween original 2 grey. not happen because i

android - Getting Frequent Outgoing SMS -

in android application, want access contacts whom messages sent in particular period. using servives , broadcast receiver, have accessed outoging sms details: contact, time, no of messages sent(depending on length of message). want to count of each contact appearing in cursor adding (no. of messages) , sort results giving frequent outgoing messages , contacts.

node.js - CompoundJS: Create model from external REST API -

i've got external restful endpoint i'm trying build model off of in compoundjs app. i'm bit confused couple of things: how build model off of external restful api (most models seem database focused)? what's best way access restful api? right now, i'm doing this: var options = { host: 'api.local', port: 80, path: '/users', method: 'get', headers: { 'content-type': 'application/json' } }; var http = require('http'); http.get(options, function(res) { var output = ""; res.on('data', function(chunk) { output += chunk; }); res.on('end', function() { var obj = json.parse(output); send({code: 200, data: obj}); }); }); obj return of user data (but in json). json returned looks this: { time: integer, count: integer, data: [{ userid: string, name: string, email: string }, { userid: string, ... }] } json's grea

sql - Query Designer Settings -

i seem have setting not want in query window , can't figure out called change in sql management studio 2008. at end of join statement (or other statements) alias table, if use d or e , hit return key, autocomplete changes d delete , e execute. in past when hit return key, cursor make new line, want. anyone know settings correlate action? i'd change them. i found issue d , e...it part of ssms tool pack installed. in tool pack part of sql snippets section. there several one-letter snippets , don't one-letter snippets deleted them

exception - Mule Quartz endpoint not commiting transaction -

i have quartz scheduler configured shown below. <quartz:inbound-endpoint jobname="retryjob" repeatinterval="5000" cronexpression="0 0/1 * * * ?"> <quartz:endpoint-polling-job> <quartz:job-endpoint ref="retryqueue"/> </quartz:endpoint-polling-job> </quartz:inbound-endpoint> <flow-ref name="callmysubflow" /> <choice-exception-strategy> <catch-exception-strategy when="groovy:message.getinvocationproperty('next') == 'done'"> <logger level="info" message="done"/> </catch-exception-strategy> <rollback-exception-strategy> <on-redelivery-attempts-exceeded> <logger level="info" message="redelivery exceeded. done retries."/> </on-redelivery-attempts-exceeded> </rollback-exception-strategy> </choice-exception-strategy> <jms:connector name=&q

php - RewriteCond won't rewrite my URL, instead it throws and error 500 -

i trying strip out single level of new written directory avoid repetition of entity names in url. specific name of "well service" duplicated passing both page category , pump category url render page , perform relevant queries. my current url looks this http://mysite/wellservice/well-service/pumpid01 although not major problem aesthetic perspective clean url further stripping 1 level of "well service" url create looks this: http://mysite/well-service/pumpid01 i have tried build query handle causes server respond error: 500, query can seen below: rewritecond %{query_string} ^?id=([\w-]+)&s=wellservice&c=(well-service)$ rewriterule ^product.php/?$ /pumps/%2/%1/? [r=301,l] have done wrong in code error 500 returned, or not possible trying do. note: variable "id" = pumps id query database variable "s" = category pump belongs to refine query result variable "c" = page category generate page specific stylin

twitter bootstrap - Internet explorer 8 scrolling bug jumping at the bottom of the page -

i have page built bootstrap, runs ok in browsers except internet explorer 8. when viewing page on browser if scroll way down can't see bottom of page because scroll jumps (about 200px) automatically. searching web found out solutions, need final user change browser configurations, that's not good.. i deactivated scripts created me, didn't seems internet explorer bug. it's joomla 3 site. for has widgetkit solves issue on ie8. .wk-slideshow .slides li{ /*autoscroll fix ie8*/ position: relative !important; }

php - shortcode not comging through on wordpress template -

so i'm using awesome plugin "anything slider" , have integrated template. however, it's bringing in slides instead of category. shortcode i'm using... brings in slides... <?php echo do_shortcode( "[anything_slides cat="ur"]" ); ?> the shortcode bring in category works within wysiqyg editor this: [anything_slides cat="ur"] can possibly help? http://wordpress.org/plugins/anythingslider-for-wordpress/ i think "double-quote" have escaped: <?php echo do_shortcode( "[anything_slides cat=\"ur\"]" ); ?> or <?php echo do_shortcode( '[anything_slides cat="ur"]' ); ?> hope helps!

shell - Renaming directories inside the tar.gz while extracting the tar in linux -

i have tarball index.tar.gz. inside have directories this index1/db_newtime_oldtime_0 index1/db_newtime_oldtime_1 index1/db_newtime_oldtime_2 index2/db_newtime_oldtime_0 index2/db_newtime_oldtime_1 index2/db_newtime_oldtime_2 while extracting tar file, want add 99 numeric value @ end of db directory name. after extraction directory structure should this index1/db_newtime_oldtime_99 index1/db_newtime_oldtime_100 index1/db_newtime_oldtime_101 index2/db_newtime_oldtime_99 index2/db_newtime_oldtime_100 index2/db_newtime_oldtime_101 so possible rename using shell script ? after extracting tar ball can rename each of directory names inside index*/ ... can use loop : for in $(\ls -d index*/*); dst=$(echo "$i" | sed -e 's/oldtime_/oldtime_ /g' | awk '{print $1$2+99}'); mv "$i" "$dst"; done

Ckfinder encodes URL but doesn't tell Ckeditor -

i'm using ckeditor version 3.6.5 , ckfinder version 2.0.2. when upload file percent sign in inserted editor, file getting uploaded "thisis%20a%20test%20%2520%20percents.bmp" inserted ckeditor "thisis test %20 percents.bmp". uploading via "insert image" button in ckeditor. bug or can fix somehow?

android - SlidingMenu - RuntimeException -

i following [this tutorial][1], has 2 parts. followed part 1 , ran app, worked perfectly. followed part 2 , keep getting runtimeexception 09-03 18:32:29.339: e/androidruntime(21044): java.lang.runtimeexception: unable start activity componentinfo{com.tvgenius/com.tvgenius.mainactivity}: android.view.inflateexception: binary xml file line #2: error inflating class fragment 09-03 18:32:29.339: e/androidruntime(21044): @ android.app.activitythread.performlaunchactivity(activitythread.java:2100) 09-03 18:32:29.339: e/androidruntime(21044): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2125) i followed tutorial exactly. don't know i'm missing... solution: minsdkversion fragments required 12, mine 11. to use fragments need minimum sdk version 12 or have download support library . just right click on project->android tools -> add support library... instead of: import android.app.fragment; you have use: import androi

merge - SQL Server 2012: Change a Master List return value, to a different return value that already exists. -

i have following entries in database: employer_id name 69ab90ae-f172-4a84-bb35-8553674e3905 none5 34850fe7-5e7f-4e39-9fd6-9f88ef7075fe none what commands change 69ab90ae-f172-4a84-bb35-8553674e3905 none5 become 34850fe7-5e7f-4e39-9fd6-9f88ef7075fe none , rid of none5? this may you update table set guidcol = cast(uniqueidentifier, '" guid varchar "') condtion

Using java libraries on iphone apps -

i have develop iphone app , have use java libraries, there way it?, or options have?, thought maybe use libraries server calls (using web services maybe) don't know if possible either. thank you! currently there no way use java libraries directly on iphone. need find objective-c equivalent. your idea use server-side code , call iphone sounds more reasonable, however, need consider drawbacks of solution: network bandwith , latency iphone must online libraries work

CSS different border widths overlapping themselves -

i'm having trouble borders overlapping because of different width border-top has. here example code of problem: http://jsfiddle.net/u7khx/ .border{ width: 200px; height: 200px; border-top:5px solid #894b9d; border-right: 1px solid #dad9d9; border-bottom: 1px solid #dad9d9; border-left: 1px solid #dad9d9; as can see purple part not complete. any ideas? you can make top border perfect rectangle , still have other borders way want them using div's ::after pseudo element. put top border on div , other 3 borders on pseudo-element. for example: .border { width: 200px; height: 200px; border-top:5px solid #894b9d; padding: 0 1px 1px 1px; position:relative; } .border::after { display:block; content:''; position:absolute; top:0; left:0; width:200px; height:200px; border-color:#dad9d9; border-style:solid; border-width:0 1px 1px 1px; } see updated fiddle . edit: or if don't want rely on given width , height, this: .

ember.js - defining redirecting route in ember causing other route to not work -

i have route defined as: as.router.map(function(){ this.resource('analytics', {path: '/analytics'}, function(){ this.route('index', {path: '/'}); this.route('config', {path: '/config'}); ); }); as.analyticsroute = ember.route.extend({ redirect: function() { this.transitionto('analytics.index'); } }); with above config, able load pages : /#/analytics --this loads analytics/index template /#/analytics/config --this loads analytics/config template but #/analytics/index doesn't load, shows loading gif image. here how templates : analytics: {{outlet}} analytics\index: index analytics\config: config is there way make url link #/analytics/index work without breaking #/analytics? thanks, dee if define resource in router map analytics.index implicit route , should not defined explicit. default behaviour analytics.index template rendered analytics t

jquery - Make a bootstrap affix draggable around the screen -

i have bootstrap affix sticky window. shows meta data information user hovering on right now. trying make sticky notification movable around screen user can move out of way if obstructs seeing. how do this? you can use solution; have inserted button inside affix set on jquery ui draggable; same used toggle affix back. html: <div id="nav-wrapper"> <div id="nav" class="navbar"> <div class="navbar-inner"> <div class="container"> <div class="span12"> <a class="brand" href="#">my brand</a> <span class="navbar-text"> navbar. </span> <button id="mover" class="btn-danger pull-right">move me!</button> </div> </div> <!-- container --> </d

javascript - what event triggers youtube iframe to show controls -

i have youtube iframe div same size on top of it. when mouse enters youtube iframe, youtube control bar automatically shown. because of overlaying div, event not triggering. trying trigger event whenever mouse enters overlaying div using jquery. the problem can't seem figure out event triggers control bar show (or if want possible). have tried hover, mouseenter/mouseleave, no avail...

Rotating a polygon makes operator< disappear in visual c++ -

i'm new stackoverflow, sorry if format text wrong. i have polygon want rotate given angle. void polygon::rotateby( const float cosx, const float sinx ) { ( std::deque<polygonpoint>::iterator = point_list.begin(); != point_list.end(); ++i ) { i->x = (i->x * cosx) - (i->y * sinx); i->y = (i->x * sinx) + (i->y * cosx); } } this has unexpected result: polygon.rotateby(ccosx, csinx); std::priority_queue<edge, std::vector<edge>, comparepolysegmentsbyy> segments; for(std::deque<polygonpoint>::const_iterator = (polygon.point_list.cbegin() + 1); != polygon.point_list.cend(); ++i) { segments.push(edge(*(i-1), *i, i-1)); } segments.push(edge(polygon.point_list[ polygon.point_list.size() - 1 ], polygon.point_list[0], polygon.point_list.end() - 1)); the comparepolysegmentsbyy: class comparepolysegmentsbyy { public: bool operator()(const edge& pol1, const edge& pol2) const {

r - Create a boxplot for multiple stations and line joining median of the stations -

Image
i have dataset follows: 24 i=6,j=529, depth avg 129 1 129.041687011719 1.00000035762787 129.08332824707 .99999988079071 129.125015258789 1.00000011920929 129.166687011719 1.00000023841858 129.20832824707 1.00000035762787 129.250030517578 1.00000047683716 129.29167175293 1.00000035762787 129.333343505859 1.00000011920929 129.375030517578 .999998927116394 129.41667175293 .999999940395355 129.458358764648 1.00000107288361 129.5 1.00000059604645 129.541687011719 1.00000059604645 129.58332824707 1.00000059604645 129.625015258789 .999999284744263 129.666687011719 1.00000095367432 129.70832824707 1.00000107288361 129.750030517578 .999999940395355 129.79167175293 .99999988079071 129.833343505859 1.00000011920929 129.875030517578 1 129.91667175293 .99999988079071 129.958358764648 .999999761581421 24 i=7,j=505, depth avg 129 .999983608722687 129.041687011719 .999982953071594 129.08332824707 .999985218048096

plone - Do some Zope 3 resources take parameters from the URL? -

Image
in plone 4, have custom dexterity content type has namedblobfile field called audio_artifact. when using default edit view edit type, see urls this: what's going on here? i'm familiar zope 3 resources in general, here looks widget resource being passed @@download view parameter. correct? or confused. suspect latter. ++something++ traversal namespace, it's not resource per se, ++resource++ instead namespace. namespaces custom namespace handlers, given rest of item name. in case widget namespace handler given name of widget, forms.widgets.audio_artifact , , use widget on add form. @@download view on widget, enables download file in widget. images there view allows thumbnails etc.

ExecJS::RuntimeError running the Getting Started with Rails blog on cygwin (windows7) -

i trying run getting started rails blog on cygwin (windows7). following error message: execjs:: runtimeerror in welcome#index module.js:340 throw err; ^ error: cannot find module 'c:\tmp\execjs20130903-50672-1vn7gqc.js' @ function.module._resolvefilename (module.js:338:15) @ function.module._load (module.js:280:25) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:901:3 (in /usr/lib/ruby/gems/1.9.1/gems/turbolinks-1.3.0/lib/assets/javascripts /turbolinks.js.coffee) node installed. this after $rails generate controller welcome index $rails s i running rails 4.0 on cygwin ideas why might happening? thanks umbregachoong i encountered error , had path temp file being wrong. able fix changing following 2 files in \gems\[ruby version]\gems\execjs-2.0.2\lib\execjs . (possibly found in \usr\lib\ruby\ , depends on how ruby installed. i'm using rvm mine different.) external_runtime.

c++ - Is static object guaranteed to be initialized -

i trying learn initialization of static objects. static initialization seems pretty straight forward, assuming understand constant expressions , constexpr . dynamic initialization seems quite bit more tricky. [basic.start.init]/4 it implementation-defined whether dynamic initialization of non-local variable static storage duration done before first statement of main. if initialization deferred point in time after first statement of main, shall occur before first odr-use (3.2) of function or variable defined in same translation unit variable initialized. footnote 34 a non-local variable static storage duration having initialization side-effects must initialized if not odr-used (3.2, 3.7.1). [basic.start.init]/5 it implementation-defined whether dynamic initialization of non-local variable static or thread storage duration done before first statement of initial function of thread. if initialization deferred point in time after first statement of initial function of th

How to change the polling interval in Newrelic platform -

how can change polling interval default 60 s in newrelic platform plugin api? using ruby api, , have statistics report lengthy calculate , cannot completed in default interval. cannot find relevant documentation on topic. you can set default value here: https://github.com/newrelic-platform/newrelic_plugin/blob/fffddc35e9085d8320f893c6a1c10bd4103800d1/lib/newrelic_platform_binding/config.rb#l31 units in seconds. it should noted new relic expecting data once per minute have drops in graphs if not post once per minute. new relic suggests if change polling time not set value greater 300 seconds. one alternative changing default report same metric multiple polling cycles. when have new metric send update , send new relic.

java - How do I generate random numbers in an array that add up to a defined total? -

i need randomly generate array 7 slots in java. these slots must have value of @ least 1, combined, have total value of defined number. need int value, no 1.5 or 0.9816465684646 numbers. example: int a=10; int[] ar = new int[7] ar[0] = 1 ar[1] = 1 ar[2] = 2 ar[3] = 2 ar[4] = 1 ar[5] = 2 ar[6] = 1 i want generate that, if int a=15, numbers total 15 in order the standard way generate n random numbers add given sum think of sum number line, generate n-1 random points on line, sort them, use differences between points final values. minimum 1, start subtracting n sum, run algorithm given, add 1 each segment. public class rand { public static void main(string[] args) { int count = 8; int sum = 100; java.util.random g = new java.util.random(); int vals[] = new int[count]; sum -= count; (int = 0; < count-1; ++i) { vals[i] = g.nextint(sum); } vals[count-1] = sum; java.util.arrays.

php - HTML Form Case Sensitive -

this might rather weird question, when log in webpage, works, if write in capitals. anyway, i've made "kill" function on page (role playing game can kill others). , i've tried make simple function make unable kill yourself. here code: if ("$killuser"=="$user") { echo "you can't kill yourself!"; } $user = current user logged in, trying use function $killuser = input in html form (the user trying kill) the problem is, if username "user", , attempt kill "user", says can't kill myself, if write in capitals, or not it's stored in database, won't, , i'll able kill myself. way, username table in database varchar , collation utf8_general_ci. convert both variables lower-case , compare it: if ( strtolower($killuser) == strtolower($user)) { echo "you can't kill yourself!"; } alternatively, use strcasecmp() : if (strcasecmp($killuser, $user)

java - Extending a static factory method pattern -

i have existing code base uses static factory method design instantiating object types: public static createsomething(int x, int y, .....) { // creates object } i'd extend method allowing initializing object in different way, based on new parameter(s) dictate how object created. the simplest (and least scalable) way add new parameters factory method. this doesn't seem right way doing things: there's more 1 factory method needs updated, not one. creating new method force changing client code calls factory. sort of defeats purpose of having single location generates objects. adding more parameters makes long parameter lists uneasy use. is there better approach extending factory method ? create new method, , use parameter object argument ( is named pattern? ). way, don't change previous implementation, , open new implementation (you change parameter object without affecting existing calls method). additional thoughts : yes, way, have 2 m

Python's asyncore client send only last element from list inside a thread -

this client: class testclient(asyncore.dispatcher): #private _buffer = "" #public def __init__(self, host, port): asyncore.dispatcher.__init__(self) self.create_socket(socket.af_inet, socket.sock_stream) self.connect((host, port)) self.client = sender(self) self.client.start() # other code def handle_connect(self): pass def handle_close(self): self.close() self.client.stop() def handle_read(self): try: data = self.recv(8192) self.artist.parsefromstring(data) # print data here except exception ex: print ex def writable(self): return (len(self._buffer) > 0) def handle_write(self): sent = self.send(self._buffer) self.buffer = self._buffer[sent:] def link(self, name): return name.replace(' ', '%20') def sendartist(self, artist): prin

php - Find In Object of Arrays A Value -

i have following code: function searchobject($obj, $field, $value) { foreach ($obj $item){ # gets products foreach ($item $child) { #gets products, products array of products foreach ($child $grandchild){ #gets products array if (isset($grandchild->$field) && $grandchild->$field == $value) { return $grandchild; } } } } return "not found"; } this how it's called: $freetrialobj = searchobject($arr, "pid", 15); but doesn't work, reporting 'invalid argument'. here print_r of object of arrays: array: stdclass object ( [result] => success [clientid] => 706 [serviceid] => [pid] => [domain] => [totalresults] => 1 [startnumber] => 0 [numreturned] => 1 [products] => stdclass object ( [product] => array ( [0] => stdclass object (

c# - Take & remove elements from collection -

what's performant way remove n elements collection , add removed n elements existing, different, collection? currently i've got this: var entries = collection.take(5).tolist(); foreach(var entry in entries) collection.remove(entry); othercollection.addrange(entries); however, doesn't performant @ me ( multiple linear algorithms instead of one). a possible solution may of course change collection implementation - long following requirements met: othercollection must implement ienumerable<t> , of type list<t> collection must implement icollection<t> , of type linkedlist<t> hint: entries not implement equals() or gethashcode() . what's performant way reach goal? as has been hard understand performance considerations, here once more code example: var entries = collection.take(1000).tolist(); // 1000 steps foreach(var entry in entries) // 1000 * 1 steps (as remove finds element @ beginning) collection.remove(entr

jquery - Re-write a Javascript function that selects active navigation tabs to work in IE8 -

i have inherited code in recent project makes use of css3 selectors add classes top level tab navigation. due way has been implemented on back-end, js searching window.location.pathname match string, , using in function add classname in dom. second function using nth-child(x) x loop corresponds appropriate matching string in pathname , li. however, know, nth-child not supported in ie8. i going use this style of emulating nth-child in ie8, unclear how write function add existing code. here js code referencing: var tabname = 'product', tabtype = window.location.pathname; if(tabtype.indexof('product')>-1) tabname = 'product'; else if(tabtype.indexof('business')>-1) tabname = 'business'; else if(tabtype.indexof('support')>-1) tabname = 'support'; else if(tabtype.indexof('article')>-1) tabname = 'article'; $('.category-tabs li').removeclass('active'); for( var tn

Running ILNumerics application under Mono and SuSE Linux 12.3 -

i'm new mono , ilnumerics. after downloading community edition, wanted run "hello ilnumerics! - core functionality" application ilnumerics quickstart page. compiling (with monodevelop 3.0.6) worked, when start program in x86 debug mode, error messages like: unhandled exception: system.typeinitializationexception: exception thrown type initializer ilnumerics.ilmath ---> ilnumerics.exceptions.ilargumentexception: conversion single fcomplex not supported. @ ilnumerics.ilmath.convert[single,fcomplex] (ilnumerics.ilinarray`1 x) [0x00027] in /home/dom/ilnumerics/functions/builtin/convert.cs:910 @ ilnumerics.ilmath.tofcomplex (ilnumerics.ilinarray`1 x) [0x00001] in /home/do /ilnumerics/functions/builtin/convert.cs:1633 @ ilnumerics.native.ilmklfft.fftforward1d (ilnumerics.ilinarray`1 a, int32 dim) [0x00072] in /home/dom/ilnumerics/native/fft/ilmklfft.cs:657 @ ilnumerics.ilmath.fft (ilnumerics.ilinarray`1 a) [0x0005d]

windows phone 8 - Navigation in phonegap application fails when I use GET variables -

i've created small 2 page application, fails when navigate page using variables, like window.location.href = 'game.html?id=2' navigating using www/game.html works great, breaks logic. tell me why is? the above window.location.href throws cordovabrowser_navigationfailed :: www/game.html?id=2 try below code has work. var dirpath = location.href.replace(/\\/g, '/').replace(/\/[^\/]*$/, ''); window.location = dirpath +"/game.html";

PHP Convert formatted date into unixtime -

this question has answer here: how convert date timestamp in php? 18 answers i have dates in format y-m-d hour-minute-second 2013-09-03 12:10:28 , need unixtimestamp. php has slough of functions transforming dates , times, apprently none can accept date , format , convert unixtime. closest function found mktime() , need parse current date each of components. there easier way? strtotime ('2013-09-03 12:10:28');

android - Floating imageview with text and buttons -

Image
i loading images db listview , want create floating window. once 1 of them clicked floating window pic attached. i know how handle onclick events list can't find way create activity layout correctly and came far - <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/image_dialog_root" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/transparent" android:gravity="center" android:paddingleft="5dp" android:paddingright="5dp" > <imageview android:id="@+id/your_image" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scaletype="centerinside" android:src="@drawable/ab" />

Undefined variable: _SESSION [APP\Controller\UsersController.php in cakephp 2.0 -

undefined variable: _session [app\controller\userscontroller.php in cakephp 2.0 have included session component in userscontroller var $components = array('session', 'cookie'); code that: if(!empty($id)) { print "<br><pre>"; print_r($_session['text']); print "<br><pre>"; print_r($this->session->read("captchatext")); die; } else { $_session['text'] = "jjsssssjj"; $this->session->write("captchatext", "ddddddssssssssssdddd"); print "ddddddssssssssssdddd"; } try public $components = array('session'); and why not use cakephp syntax reading session like: print "<br><pre>"; print_r($this->session->read('text')); print "<br><pre>";

How do you map a HasOne relationship with nHibernate Fluent mapping and avoid N+1? -

i have 2 tables atable , aatable both have shared primary key - atable.akey , aatable.akey represent one-to-one relationship. fluent mapping have hasone relationship defined within fluent atablemapping, of works fine. have noticed querying atable generates 2nd query (n+1) child table aatable . understanding hasone eager loads default, , had assumed part of query atable, may have wrong? i have researched various solutions including using .not.lazyload().fetch.join(), propertyref, foreignkey cannot seem resolve n+1 either eager loaded 1 query, or lazy loaded , can fetch child queries. has had issues or have example know work no n+1? grateful advice. you have 2 options: not.lazyload() disables possibility provide lazy loaded related entity , enforce nhb provide corresponding subselect within original query use component mapping both entities point same table. better approach once decided fetch both entities together, generated queries hit 1 table - not 2 wi

d3.js: How do I draw and highlight links in this relationship graph? -

Image
i've been trying solve graph problem couple weeks now... still pretty new d3.js, things seem might simple still elude me. here's illustration of i'm trying do: the goals : i want show relationships between industry nodes/size nodes , product nodes. when hover product node, want highlight link, source (industry or size) , target (product) of each relevant relationship. when hover industry or size node, want highlight it's links relevant products. the questions how draw links? know somehow involves using d3.map... can't figure out. how highlight nodes , links (goals 2 , 3)? if there better, more efficient way of getting layout , behavior, please let me know - trying hard learn tricks! the fiddle renders basic layout simplified set of data: http://jsfiddle.net/9hgbd/ the data looks this: var data = { "product": [ { "type": "product", "name": "product 1&q

xml - Append new child node between existing nodes -

can know how append new child node between existing nodes.i using org.w3c.dom parsing current: <parent node> <row>a</row> <row>c</row> <row>d</row> <row>e</row> </parent node> i want add new node between , c <parent node> <row>a</row> <row>b</row> <row>c</row> <row>d</row> <row>e</row> </parent node> i tried appending child under current node getting added @ end element testnode = doc.createelement("testnode"); currentnode.appendchild(testnode); with jquery can insert @ nth position follows: $("<row>f</row>").insertafter($("parentnode row:nth-child(2)"));